spi: a3700: Fix clk prescaling for coefficient over 15
authorMaxime Chevallier <maxime.chevallier@smile.fr>
Mon, 27 Nov 2017 14:16:32 +0000 (15:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Dec 2017 16:53:47 +0000 (17:53 +0100)
commited1918e287547d92a795729993ce8e6ca7940eda
treea45820934edef63c9c23164e8fe5721f102ce79e
parente8f28db0f737690e3d7ecb26cfaf60c7af74f7e5
spi: a3700: Fix clk prescaling for coefficient over 15

commit 251c201bf4f8b5bf4f1ccb4f8920eed2e1f57580 upstream.

The Armada 3700 SPI controller has 2 ranges of prescaler coefficients.
One ranging from 0 to 15 by steps of 1, and one ranging from 0 to 30 by
steps of 2.

This commit fixes the prescaler coefficients that are over 15 so that it
uses the correct range of values. The prescaling coefficient is rounded
to the upper value if it is odd.

This was tested on Espressobin with spidev and a locigal analyser.

Signed-off-by: Maxime Chevallier <maxime.chevallier@smile.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi-armada-3700.c