[PATCH] spi: i.MX: reset controller on init

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

 



In rare cases the controller is does not work right after probe. When
this happens the registers show that the TXFIFO contains words, but
the transfer is never started. We observed that on some boards which
boot from SPI NOR. The xload SPI code leaves the controller enabled,
so the SPI controller is enabled during probe(). Disabling it before
usage (and thus resetting it) helps. We haven't found out why exactly
this happens.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/spi/imx_spi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c
index 806ca67..876699a 100644
--- a/drivers/spi/imx_spi.c
+++ b/drivers/spi/imx_spi.c
@@ -348,6 +348,13 @@ static u32 imx_xchg_single(struct spi_device *spi, u32 tx_val)
 	return imx_spi_maybe_reverse_bits(spi, rx_val);
 }
 
+static void cspi_2_3_init(struct imx_spi *imx)
+{
+	void __iomem *base = imx->regs;
+
+	writel(0, base + CSPI_2_3_CTRL);
+}
+
 static void imx_spi_do_transfer(struct spi_device *spi)
 {
 	struct imx_spi *imx = container_of(spi->master, struct imx_spi, master);
@@ -519,6 +526,7 @@ static __maybe_unused struct spi_imx_devtype_data spi_imx_devtype_data_2_3 = {
 	.chipselect = cspi_2_3_chipselect,
 	.do_transfer = cspi_2_3_do_transfer,
 	.xchg_single = cspi_2_3_xchg_single,
+	.init = cspi_2_3_init,
 };
 
 static int imx_spi_dt_probe(struct imx_spi *imx)
-- 
2.10.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux