drivers/spi/omap3: Bug fix of premature write transfer completion
PATCH 1/1 drivers/spi/omap3: Bug fix of premature write transfer completion
The logic determining SPI "write" transfer completion was faulty. At certain conditions (e.g. slow SPI clock freq) the transfers were interrupted before completion. Both EOT and TXS flags of channel status registeer shall be checked to ensure that all data was transferred. Tested on AM3359 chip.
Signed-off-by Vasili Galka <[email protected]>
--- drivers/spi/omap3_spi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/spi/omap3_spi.c +3 -2
@@ -260,8 +260,9 @@ int omap3_spi_write(struct spi_slave *slave, unsigned int len, const void *txp, }/* wait to finish of transfer */ -while (!(readl (&ds->regs->channel[ds->slave.cs].chstat) & -OMAP3_MCSPI_CHSTAT_EOT )); +while ((readl (&ds->regs->channel[ds->slave.cs].chstat) & + (OMAP3_MCSPI_CHSTAT_EOT |OMAP3_MCSPI_CHSTAT_TXS )) != + (OMAP3_MCSPI_CHSTAT_EOT |OMAP3_MCSPI_CHSTAT_TXS ));/* Disable the channel otherwise the next immediate RX will get affected */ omap3_spi_set_enable (ds,OMAP3_MCSPI_CHCTRL_DIS );
Signature · 1 line
1.8.1.msysgit.1
Quoted 7 lines · Vasili Galka
The logic determining SPI "write" transfer completion was faulty. At certain conditions (e.g. slow SPI clock freq) the transfers were interrupted before completion. Both EOT and TXS flags of channel status registeer shall be checked to ensure that all data was transferred. Tested on AM3359 chip.
Signed-off-by Vasili Galka <[email protected]>
Applied to u-boot-ti/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140312/99694a8f/attachment.pgp>