[PATCH 2/2] spi/omap2_mcspi: When SPI wake up from OFF mode, CS is in wrong state: force it to unactive state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Gregory CLEMENT <gclement00@xxxxxxxxx>
---
 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);
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);
 

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux