spi: cadence_qspi_apb: Ensure baudrate doesn't exceed max value
authorChin Liang See <clsee@altera.com>
Sun, 7 Aug 2016 14:50:40 +0000 (22:50 +0800)
committerMarek Vasut <marex@denx.de>
Sun, 7 Aug 2016 19:54:21 +0000 (21:54 +0200)
commit5405817a6e7a6538c4bcb1c3076ddc83fe5d03f9
tree2a5b2c7cdf863fc4c7b18745c0fa16c26b05b38a
parent2da375c9194ad85fc117088a8ebbca192b685207
spi: cadence_qspi_apb: Ensure baudrate doesn't exceed max value

Ensuring the baudrate divisor value doesn't exceed the max value
in the calculation.It will be capped at max value to ensure the
correct value being written into the register.

Example of the existing bug is when calculated div = 16. After and
with the mask, the value written to register is actually 0 (register
field for baudrate divisor). With this fix, the value written is now
15 which is max value for baudrate divisor.

Signed-off-by: Chin Liang See <clsee@altera.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jteki@openedev.com>
Cc: Dinh Nguyen <dinguyen@altera.com>
drivers/spi/cadence_qspi_apb.c