diff mbox

spi: sirf: reset SPI controller in init stage

Message ID 1416493987-6024-1-git-send-email-21cnbao@gmail.com (mailing list archive)
State Accepted
Commit 8509c55fcb5192b7f70ec596a8752c2ec39942e3
Headers show

Commit Message

Barry Song Nov. 20, 2014, 2:33 p.m. UTC
From: Qipan Li <Qipan.Li@csr.com>

in SPI boot mode, romcode uses SPI controller to fetch data from NOR
flash. Here we need to reset the hardware IP to restore its state.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 drivers/spi/spi-sirf.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Mark Brown Nov. 21, 2014, 6:11 p.m. UTC | #1
On Thu, Nov 20, 2014 at 10:33:07PM +0800, Barry Song wrote:
> From: Qipan Li <Qipan.Li@csr.com>
> 
> in SPI boot mode, romcode uses SPI controller to fetch data from NOR
> flash. Here we need to reset the hardware IP to restore its state.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index 90dc05b..73a88b3 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -23,6 +23,7 @@ 
 #include <linux/dmaengine.h>
 #include <linux/dma-direction.h>
 #include <linux/dma-mapping.h>
+#include <linux/reset.h>
 
 #define DRIVER_NAME "sirfsoc_spi"
 
@@ -647,6 +648,12 @@  static int spi_sirfsoc_probe(struct platform_device *pdev)
 	int irq;
 	int i, ret;
 
+	ret = device_reset(&pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "SPI reset failed!\n");
+		return ret;
+	}
+
 	master = spi_alloc_master(&pdev->dev, sizeof(*sspi));
 	if (!master) {
 		dev_err(&pdev->dev, "Unable to allocate SPI master\n");