spi: Correct SPI clock frequency setting in spi_mpc8xxx
PATCH 1/1 spi: Correct SPI clock frequency setting in spi_mpc8xxx
Correct SPI clock frequency division factor rounding, preventing clock rates higher than the maximum specified clock frequency being used.
Signed-off-by Ernst Schwab <[email protected]>
---
Tested on MPC8314.
drivers/spi/spi_mpc8xxx.c +2 -2
@@ -365,7 +365,7 @@ int mpc8xxx_spi_setup_transfer(struct spif ((mpc8xxx_spi->spibrg / hz) >64 ) { cs->hw_mode |=SPMODE_DIV16 ; - pm = mpc8xxx_spi->spibrg / (hz *64 ); + pm = (mpc8xxx_spi->spibrg -1 ) / (hz *64 ) +1 ; WARN_ONCE(pm > 16, "%s: Requested speed is too low: %d Hz. " "Will use %d Hz instead.\n", dev_name(&spi->dev),
@@ -373,7 +373,7 @@ int mpc8xxx_spi_setup_transfer(struct spif (pm >16 ) pm =16 ; }else - pm = mpc8xxx_spi->spibrg / (hz *4 ); + pm = (mpc8xxx_spi->spibrg -1 ) / (hz *4 ) +1 ;if (pm) pm--;
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev