]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
spi: fsl-dspi: Fix clock rate scale values
authorAaron Brice <aaron.brice@datasoft.com>
Fri, 3 Apr 2015 20:39:29 +0000 (13:39 -0700)
committerMark Brown <broonie@kernel.org>
Mon, 6 Apr 2015 17:11:19 +0000 (18:11 +0100)
commite689d6df8257f92abf59e93736632b79c9b2aa66
tree741f6c42c8409550e05085fef5bcc7cccb0e5774
parentc517d838eb7d07bbe9507871fab3931deccff539
spi: fsl-dspi: Fix clock rate scale values

Previous algorithm had an outer loop with the values {2,3,5,7} and an
inner loop with {2,4,6,8,16,32,...,32768}, and would pick the first
value over the required scaling value (where the total scale was the two
numbers multiplied).

Since the inner loop went up to 32768 it would always pick a value of 2
for PBR and a much higher than necessary value for BR.  The desired
scale factor was being divided by two I believe to compensate for the
much higher scale factors (the divide by two not specified in the
reference manual).

Updated to check all values and find the smallest scale factor possible
without going over the desired clock rate.

Signed-off-by: Aaron Brice <aaron.brice@datasoft.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-dspi.c