When SPI wake up from OFF mode, CS is in wrong state: force it to unactive state

Signed-off-by: Gregory CLEMENT <gclemen...@gmail.com>
---
 drivers/spi/omap2_mcspi.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index b3a94ca..3083bd0 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -1137,7 +1137,15 @@ static u8 __initdata spi4_txdma_id[] = {
        OMAP34XX_DMA_SPI4_TX0,
 };
 #endif
-
+/* When SPI wake up, CS is in wrong state: force it to unactive state*/
+static void omap2_mcspi_resume(struct spi_device *spi)
+{
+       omap2_mcspi_enable_clocks( spi_master_get_devdata(spi->master));
+/* We need to togle CS state for OMAP take this chang in account*/
+       omap2_mcspi_force_cs(spi, 1);
+       omap2_mcspi_force_cs(spi, 0);
+       omap2_mcspi_disable_clocks( spi_master_get_devdata(spi->master));
+}
 static int __init omap2_mcspi_probe(struct platform_device *pdev)
 {
        struct spi_master       *master;
@@ -1193,6 +1201,7 @@ static int __init omap2_mcspi_probe(struct
platform_device *pdev)
        master->transfer = omap2_mcspi_transfer;
        master->cleanup = omap2_mcspi_cleanup;
        master->num_chipselect = num_chipselect;
+       master->resume = omap2_mcspi_resume;

        dev_set_drvdata(&pdev->dev, master);
------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to