diff options
| author | Marc Kleine-Budde <mkl@pengutronix.de> | 2026-09-14 17:35:57 +0200 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-10-06 17:30:42 +0200 |
| commit | 672ba6d88324f223634dd2dc4098f6fb6b346b25 (patch) | |
| tree | 5ecf9eb40ac8aa31ae2c7e3905f9c58b122c1f47 /tools/perf/scripts/python | |
| parent | ee109e2bbea0986f6ad34bfbcba90fce36f17538 (diff) | |
spi: spi-sun4i: sun4i_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 arithmetic). This results in a too high
clock rate for the SPI transfer.
E.g.: with an mclk_rate of 24 MHz and an SPI transfer speed of 10 MHz,
the original code calculates a reg of "0", which results in an effective
divider of "2" and a 12 MHz clock for the SPI transfer.
Use DIV_ROUND_UP() instead of a plain integer division to fix the
problem.
While there simplify the divider calculation for the CDR1 case, use
order_base_2() instead of two ilog2() calculations.
Fixes: b5f6517948cc ("spi: sunxi: Add Allwinner A10 SPI controller driver")
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
Link: https://patch.msgid.link/20260914-spi-sun4i-fixes-v3-3-9fe919d5cecf@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
