Skip to content

Commit 4df3bea

Browse files
Ryceancurrybroonie
authored andcommitted
spi: bcm-qspi: when tx/rx buffer is NULL set to 0
Currently we set the tx/rx buffer to 0xff when NULL. This causes problems with some spi slaves where 0xff is a valid command. Looking at other drivers, the tx/rx buffer is usually set to 0x00 when NULL. Following this convention solves the issue. Fixes: fa236a7 ("spi: bcm-qspi: Add Broadcom MSPI driver") Signed-off-by: Justin Chen <[email protected]> Signed-off-by: Kamal Dasu <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 1b7ad8c commit 4df3bea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/spi/spi-bcm-qspi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,15 +666,15 @@ static void read_from_hw(struct bcm_qspi *qspi, int slots)
666666
if (buf)
667667
buf[tp.byte] = read_rxram_slot_u8(qspi, slot);
668668
dev_dbg(&qspi->pdev->dev, "RD %02x\n",
669-
buf ? buf[tp.byte] : 0xff);
669+
buf ? buf[tp.byte] : 0x0);
670670
} else {
671671
u16 *buf = tp.trans->rx_buf;
672672

673673
if (buf)
674674
buf[tp.byte / 2] = read_rxram_slot_u16(qspi,
675675
slot);
676676
dev_dbg(&qspi->pdev->dev, "RD %04x\n",
677-
buf ? buf[tp.byte] : 0xffff);
677+
buf ? buf[tp.byte / 2] : 0x0);
678678
}
679679

680680
update_qspi_trans_byte_count(qspi, &tp,
@@ -729,13 +729,13 @@ static int write_to_hw(struct bcm_qspi *qspi, struct spi_device *spi)
729729
while (!tstatus && slot < MSPI_NUM_CDRAM) {
730730
if (tp.trans->bits_per_word <= 8) {
731731
const u8 *buf = tp.trans->tx_buf;
732-
u8 val = buf ? buf[tp.byte] : 0xff;
732+
u8 val = buf ? buf[tp.byte] : 0x00;
733733

734734
write_txram_slot_u8(qspi, slot, val);
735735
dev_dbg(&qspi->pdev->dev, "WR %02x\n", val);
736736
} else {
737737
const u16 *buf = tp.trans->tx_buf;
738-
u16 val = buf ? buf[tp.byte / 2] : 0xffff;
738+
u16 val = buf ? buf[tp.byte / 2] : 0x0000;
739739

740740
write_txram_slot_u16(qspi, slot, val);
741741
dev_dbg(&qspi->pdev->dev, "WR %04x\n", val);

0 commit comments

Comments
 (0)