aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-03-15 13:42:31 -0400
committerGrant Likely <grant.likely@secretlab.ca>2012-03-15 17:14:13 -0400
commit35faa55cff56441477973e454f62408714f35cd3 (patch)
tree933a91b2e07ba392fa04d2e00aaa0d99e4d8553e /drivers/spi
parentbb9c5687e8cd02d6f8a3aea40c118b439cb09501 (diff)
spi/fsl-espi: make the clock computation easier to read
The -1 +1 thingy should probably do what DIV_ROUND_UP does. The 4 is 2 the "platform_clock => sysclock" and 2 from the computation part. The 64 is the same 4 times 16. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-fsl-espi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index d770f03705c3..43350f999314 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -180,7 +180,7 @@ static int fsl_espi_setup_transfer(struct spi_device *spi,
180 180
181 if ((mpc8xxx_spi->spibrg / hz) > 64) { 181 if ((mpc8xxx_spi->spibrg / hz) > 64) {
182 cs->hw_mode |= CSMODE_DIV16; 182 cs->hw_mode |= CSMODE_DIV16;
183 pm = (mpc8xxx_spi->spibrg - 1) / (hz * 64) + 1; 183 pm = DIV_ROUND_UP(mpc8xxx_spi->spibrg, hz * 16 * 4);
184 184
185 WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. " 185 WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. "
186 "Will use %d Hz instead.\n", dev_name(&spi->dev), 186 "Will use %d Hz instead.\n", dev_name(&spi->dev),
@@ -188,7 +188,7 @@ static int fsl_espi_setup_transfer(struct spi_device *spi,
188 if (pm > 16) 188 if (pm > 16)
189 pm = 16; 189 pm = 16;
190 } else { 190 } else {
191 pm = (mpc8xxx_spi->spibrg - 1) / (hz * 4) + 1; 191 pm = DIV_ROUND_UP(mpc8xxx_spi->spibrg, hz * 4);
192 } 192 }
193 if (pm) 193 if (pm)
194 pm--; 194 pm--;