aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gcc-plugins/sancov_plugin.c
diff options
context:
space:
mode:
authorMarc Kleine-Budde <[email protected]>2020-07-06 14:34:34 +0000
committerMark Brown <[email protected]>2020-07-06 15:39:45 +0000
commited7815db70d17b1741883f2da8e1d80bc2efe517 (patch)
tree72995bdfd9ab1aed4a97a24652b5d127276a0f50 /scripts/gcc-plugins/sancov_plugin.c
parentspi: mediatek: use correct SPI_CFG2_REG MACRO (diff)
downloadkernel-ed7815db70d17b1741883f2da8e1d80bc2efe517.tar.gz
kernel-ed7815db70d17b1741883f2da8e1d80bc2efe517.zip
spi: spi-sun6i: sun6i_spi_transfer_one(): fix setting of clock rate
A SPI transfer defines the _maximum_ speed of the SPI transfer. However the driver doesn't take into account that the clock divider is always rounded down (due to integer arithmetics). This results in a too high clock rate for the SPI transfer. E.g.: with a mclk_rate of 24 MHz and a SPI transfer speed of 10 MHz, the original code calculates a reg of "0", which results in a effective divider of "2" and a 12 MHz clock for the SPI transfer. This patch fixes the issue by using DIV_ROUND_UP() instead of a plain integer division. While there simplify the divider calculation for the CDR1 case, use order_base_2() instead of two ilog2() calculations. Fixes: 3558fe900e8a ("spi: sunxi: Add Allwinner A31 SPI controller driver") Signed-off-by: Marc Kleine-Budde <[email protected]> Acked-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'scripts/gcc-plugins/sancov_plugin.c')
0 files changed, 0 insertions, 0 deletions