diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2021-01-13 11:19:16 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-01-13 13:19:09 +0100 |
commit | 81f68479ec4ec91c0b0d7fb20db433be28e00497 (patch) | |
tree | 4eb6c42c60e0ee3ef917dc55a96e9aa178cbdbcc /drivers/spi | |
parent | spi: sh-msiof: Fill in spi_transfer.effective_speed_hz (diff) | |
download | linux-81f68479ec4ec91c0b0d7fb20db433be28e00497.tar.xz linux-81f68479ec4ec91c0b0d7fb20db433be28e00497.zip |
spi: sh-msiof: Fill in controller speed limits
Fill in the controller speed limits, so the SPI core can use them for
validating SPI transfers, and adjust or reject transfers when needed.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20210113101916.1147695-3-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-sh-msiof.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index 90b8aba8a4fd..41ed9ff8fad0 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c @@ -1262,6 +1262,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) const struct sh_msiof_chipdata *chipdata; struct sh_msiof_spi_info *info; struct sh_msiof_spi_priv *p; + unsigned long clksrc; int i; int ret; @@ -1337,6 +1338,9 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) /* init controller code */ ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH; ctlr->mode_bits |= SPI_LSB_FIRST | SPI_3WIRE; + clksrc = clk_get_rate(p->clk); + ctlr->min_speed_hz = DIV_ROUND_UP(clksrc, 1024); + ctlr->max_speed_hz = DIV_ROUND_UP(clksrc, 1 << p->min_div_pow); ctlr->flags = chipdata->ctlr_flags; ctlr->bus_num = pdev->id; ctlr->num_chipselect = p->info->num_chipselect; |