Skip to content

Commit e8bb8f1

Browse files
Witold Sadowskibroonie
authored andcommitted
spi: cadence: Fix busy cycles calculation
If xSPI is in x2/x4/x8 mode to calculate busy cycles, busy bits count must be divided by the number of lanes. If opcommand is using 8 busy bits, but SPI is in x4 mode, there will be only 2 busy cycles. Signed-off-by: Witold Sadowski <[email protected]> Reviewed-by: Chandrakala Chavva <[email protected]> Reviewed-by: Sunil Kovvuri Goutham <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent b24cded commit e8bb8f1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/spi/spi-cadence-xspi.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@
177177
#define CDNS_XSPI_CMD_FLD_DSEQ_CMD_3(op) ( \
178178
FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R3_DCNT_H, \
179179
((op)->data.nbytes >> 16) & 0xffff) | \
180-
FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R3_NUM_OF_DUMMY, (op)->dummy.nbytes * 8))
180+
FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R3_NUM_OF_DUMMY, \
181+
(op)->dummy.buswidth != 0 ? \
182+
(((op)->dummy.nbytes * 8) / (op)->dummy.buswidth) : \
183+
0))
181184

182185
#define CDNS_XSPI_CMD_FLD_DSEQ_CMD_4(op, chipsel) ( \
183186
FIELD_PREP(CDNS_XSPI_CMD_DSEQ_R4_BANK, chipsel) | \

0 commit comments

Comments
 (0)