diff options
author | Mark Brown <broonie@kernel.org> | 2019-05-02 05:20:26 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-05-02 05:20:26 +0300 |
commit | 58b860ed4a77d9cb17b78e663a0341b79a12e240 (patch) | |
tree | a82d81a9075394e7dc8b46fe2732270e24390a7a /drivers/spi/spi-pxa2xx.c | |
parent | 37624b58542fb9f2d9a70e6ea006ef8a5f66c30b (diff) | |
parent | 7e95b16625a3659a75c0ba4d5b0802324d16be13 (diff) | |
download | linux-58b860ed4a77d9cb17b78e663a0341b79a12e240.tar.xz |
Merge branch 'spi-5.1' into spi-linus
Diffstat (limited to 'drivers/spi/spi-pxa2xx.c')
-rw-r--r-- | drivers/spi/spi-pxa2xx.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index b6ddba833d02..d2076f2f468f 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -884,10 +884,14 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) rate = min_t(int, ssp_clk, rate); + /* + * Calculate the divisor for the SCR (Serial Clock Rate), avoiding + * that the SSP transmission rate can be greater than the device rate + */ if (ssp->type == PXA25x_SSP || ssp->type == CE4100_SSP) - return (ssp_clk / (2 * rate) - 1) & 0xff; + return (DIV_ROUND_UP(ssp_clk, 2 * rate) - 1) & 0xff; else - return (ssp_clk / rate - 1) & 0xfff; + return (DIV_ROUND_UP(ssp_clk, rate) - 1) & 0xfff; } static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, |