diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2020-07-06 16:34:35 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-07-07 11:41:33 +0200 |
commit | 0bc7b8a2c307c52dbc9f3b5bc7855e93d281098a (patch) | |
tree | 080b506a6a1a3b88b123a3f6a0ef57832ae8267b /drivers | |
parent | spi: spi-sun6i: sun6i_spi_transfer_one(): fix setting of clock rate (diff) | |
download | linux-0bc7b8a2c307c52dbc9f3b5bc7855e93d281098a.tar.xz linux-0bc7b8a2c307c52dbc9f3b5bc7855e93d281098a.zip |
spi: spi-sun6i: sun6i_spi_transfer_one(): report effectivly used speed_hz of transfer
This patch implementes the reporting of the effectivly used speed_hz for the
transfer by setting tfr->effective_speed_hz.
See the following patch, which adds this feature to the SPI core for more
information:
5d7e2b5ed585 spi: core: allow reporting the effectivly used speed_hz for a transfer
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://lore.kernel.org/r/20200706143443.9855-3-mkl@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/spi/spi-sun6i.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c index fa11cc0e809b..64b4d8077010 100644 --- a/drivers/spi/spi-sun6i.c +++ b/drivers/spi/spi-sun6i.c @@ -291,9 +291,11 @@ static int sun6i_spi_transfer_one(struct spi_master *master, div_cdr2 = DIV_ROUND_UP(div_cdr1, 2); if (div_cdr2 <= (SUN6I_CLK_CTL_CDR2_MASK + 1)) { reg = SUN6I_CLK_CTL_CDR2(div_cdr2 - 1) | SUN6I_CLK_CTL_DRS; + tfr->effective_speed_hz = mclk_rate / (2 * div_cdr2); } else { div = min(SUN6I_CLK_CTL_CDR1_MASK, order_base_2(div_cdr1)); reg = SUN6I_CLK_CTL_CDR1(div); + tfr->effective_speed_hz = mclk_rate / (1 << div); } sun6i_spi_write(sspi, SUN6I_CLK_CTL_REG, reg); |