Skip to contentSkip to conversation

spi: omap3: fix set_wordlen() reading from incorrect address for CHCONF

PATCH In review David Rivshin 2 participants 2 messages Feb 18, 2019 – Feb 28, 2019 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: omap3: fix set_wordlen() reading from incorrect address for CHCONF

From: David Rivshin <[email protected]>

_omap3_spi_set_wordlen() indexed the regs->channel[] array with the old wordlen (instead of the chipselect number) when reading the current CHCONF register value. This meant it read from the wrong memory location, modified that value, and then wrote it back to the correct CHCONF register. The end result is that most slave configuration settings would be lost, such as clock divisor, clock/chipselect polarities, etc.

Fixes 77b8d04854f4 ("spi: omap3: Convert to driver model")
---
 drivers/spi/omap3_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/omap3_spi.c +1 -1
index c7fcf050a5..ff4c700645 100644
@@ -415,7 +415,7 @@ static void _omap3_spi_set_wordlen(struct omap3_spi_priv *priv)
 	unsigned int confr;
 
 	/* McSPI individual channel configuration */
-	confr = readl(&priv->regs->channel[priv->wordlen].chconf);
+	confr = readl(&priv->regs->channel[priv->cs].chconf);
 
 	/* wordlength */
 	confr &= ~OMAP3_MCSPI_CHCONF_WL_MASK;

base-commit: d3689267f92c5956e09cc7d1baa4700141662bff

Signature · 1 line
2.20.1
#1 lore raw
Quoted 11 lines · David Rivshin

From: David Rivshin <[email protected]>

_omap3_spi_set_wordlen() indexed the regs->channel[] array with the old wordlen (instead of the chipselect number) when reading the current CHCONF register value. This meant it read from the wrong memory location, modified that value, and then wrote it back to the correct CHCONF register. The end result is that most slave configuration settings would be lost, such as clock divisor, clock/chipselect polarities, etc.

Fixes 77b8d04854f4 ("spi: omap3: Convert to driver model")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190228/294b7161/attachment.sig>