]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
spi_mpc83xx: turn off SPI unit while switching mode
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Tue, 31 Jul 2007 07:38:40 +0000 (00:38 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 31 Jul 2007 22:39:39 +0000 (15:39 -0700)
Documentation clearly states, that mode should not be changed till
SPMODE_ENABLE bit set.  I've seen hangs w/o this patch.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/spi/spi_mpc83xx.c

index 3295cfcc9f2060ce321550e0b6bebdcd50f4eec9..0b99fd9f517125cb9d4a787acf09ff750e8e0d72 100644 (file)
@@ -176,6 +176,8 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
                        regval |= SPMODE_PM(pm);
                }
 
+               /* Turn off SPI unit prior changing mode */
+               mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
                mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
                if (mpc83xx_spi->activate_cs)
                        mpc83xx_spi->activate_cs(spi->chip_select, pol);
@@ -249,6 +251,8 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
        regval &= 0xff0fffff;
        regval |= SPMODE_LEN(bits_per_word);
 
+       /* Turn off SPI unit prior changing mode */
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
        mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
 
        return 0;