* [U-Boot] [PATCH v3] SPI: Fix 32 bit transfers in mxc_spi.c
@ 2010-02-09 21:05 Magnus Lilja
2010-02-11 18:19 ` Tom
0 siblings, 1 reply; 2+ messages in thread
From: Magnus Lilja @ 2010-02-09 21:05 UTC (permalink / raw)
To: u-boot
Commit f9b6a1575d9f1ca192e4cb60e547aa66f08baa3f, "i.MX31: fix SPI
driver for shorter than 32 bit" broke 32 bit transfers. This patch
makes single 32 bit transfer work again.
Transfer lengths that are known not to work will abort and print
an error message.
Tested on i.MX31 Litekit and i.MX31 PDK using 32 bit transfers to
the MC13783/ATLAS chip (using the 'date' command).
Signed-off-by: Magnus Lilja <lilja.magnus@gmail.com>
---
Changes since v2: Changed bitlen != 32 to (bitlen % 32).
drivers/spi/mxc_spi.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index fad9840..3a45200 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -131,6 +131,13 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
return 1;
}
+ /* This driver is currently partly broken, alert the user */
+ if (bitlen > 16 && (bitlen % 32)) {
+ printf("Error: SPI transfer with bitlen=%d is broken.\n",
+ bitlen);
+ return 1;
+ }
+
for (i = 0, in_l = (u32 *)din, out_l = (u32 *)dout;
i < n_blks;
i++, in_l++, out_l++, bitlen -= 32) {
@@ -142,6 +149,8 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
*(u8 *)din = data;
else if (bitlen < 17)
*(u16 *)din = data;
+ else
+ *in_l = data;
}
}
--
1.6.4.2
^ permalink raw reply related [flat|nested] 2+ messages in thread* [U-Boot] [PATCH v3] SPI: Fix 32 bit transfers in mxc_spi.c
2010-02-09 21:05 [U-Boot] [PATCH v3] SPI: Fix 32 bit transfers in mxc_spi.c Magnus Lilja
@ 2010-02-11 18:19 ` Tom
0 siblings, 0 replies; 2+ messages in thread
From: Tom @ 2010-02-11 18:19 UTC (permalink / raw)
To: u-boot
Magnus Lilja wrote:
> Commit f9b6a1575d9f1ca192e4cb60e547aa66f08baa3f, "i.MX31: fix SPI
> driver for shorter than 32 bit" broke 32 bit transfers. This patch
> makes single 32 bit transfer work again.
>
> Transfer lengths that are known not to work will abort and print
> an error message.
>
> Tested on i.MX31 Litekit and i.MX31 PDK using 32 bit transfers to
> the MC13783/ATLAS chip (using the 'date' command).
>
> Signed-off-by: Magnus Lilja <lilja.magnus@gmail.com>
Applied to u-boot-arm.
Thanks
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-02-11 18:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-09 21:05 [U-Boot] [PATCH v3] SPI: Fix 32 bit transfers in mxc_spi.c Magnus Lilja
2010-02-11 18:19 ` Tom
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox