spi: sirf: reset SPI controller in init stage
authorQipan Li <Qipan.Li@csr.com>
Thu, 20 Nov 2014 14:33:07 +0000 (22:33 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 21 Nov 2014 18:11:21 +0000 (18:11 +0000)
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sirf.c

index bf3c6bc7753088a5a9bd79b567bc0cee5c9921b6..0a96a65f580fbe82ccf1f8b3bd99924de425230e 100644 (file)
@@ -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");