* [PATCH] spi: i.MX: reset controller on init
@ 2016-11-22 11:51 Sascha Hauer
0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2016-11-22 11:51 UTC (permalink / raw)
To: Barebox List; +Cc: uol
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@pengutronix.de>
---
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-11-22 11:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-22 11:51 [PATCH] spi: i.MX: reset controller on init Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox