summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-bitbang-txrx.h
diff options
context:
space:
mode:
authorWolfram Sang <wsa@kernel.org>2022-09-16 22:42:18 +0300
committerWolfram Sang <wsa@kernel.org>2022-09-16 22:42:18 +0300
commitd819524d3144f4703f45f473fdc85ad7579ae94c (patch)
tree9bcb29b9b1a24ecf5a1a367c1af7d9be138ba041 /drivers/spi/spi-bitbang-txrx.h
parent859d64685d6c868db62b86064769b053db8bf834 (diff)
parent80e78fcce86de0288793a0ef0f6acf37656ee4cf (diff)
downloadlinux-d819524d3144f4703f45f473fdc85ad7579ae94c.tar.xz
Merge tag 'v6.0-rc5' into i2c/for-mergewindow
Linux 6.0-rc5
Diffstat (limited to 'drivers/spi/spi-bitbang-txrx.h')
-rw-r--r--drivers/spi/spi-bitbang-txrx.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/spi/spi-bitbang-txrx.h b/drivers/spi/spi-bitbang-txrx.h
index 267342dfa738..2dcbe166df63 100644
--- a/drivers/spi/spi-bitbang-txrx.h
+++ b/drivers/spi/spi-bitbang-txrx.h
@@ -116,6 +116,7 @@ bitbang_txrx_le_cpha0(struct spi_device *spi,
{
/* if (cpol == 0) this is SPI_MODE_0; else this is SPI_MODE_2 */
+ u8 rxbit = bits - 1;
u32 oldbit = !(word & 1);
/* clock starts at inactive polarity */
for (; likely(bits); bits--) {
@@ -135,7 +136,7 @@ bitbang_txrx_le_cpha0(struct spi_device *spi,
/* sample LSB (from slave) on leading edge */
word >>= 1;
if ((flags & SPI_MASTER_NO_RX) == 0)
- word |= getmiso(spi) << (bits - 1);
+ word |= getmiso(spi) << rxbit;
setsck(spi, cpol);
}
return word;
@@ -148,6 +149,7 @@ bitbang_txrx_le_cpha1(struct spi_device *spi,
{
/* if (cpol == 0) this is SPI_MODE_1; else this is SPI_MODE_3 */
+ u8 rxbit = bits - 1;
u32 oldbit = !(word & 1);
/* clock starts at inactive polarity */
for (; likely(bits); bits--) {
@@ -168,7 +170,7 @@ bitbang_txrx_le_cpha1(struct spi_device *spi,
/* sample LSB (from slave) on trailing edge */
word >>= 1;
if ((flags & SPI_MASTER_NO_RX) == 0)
- word |= getmiso(spi) << (bits - 1);
+ word |= getmiso(spi) << rxbit;
}
return word;
}