Skip to content

Commit a8674ae

Browse files
DhruvaG2000broonie
authored andcommitted
spi: cadence-quadspi: setup ADDR Bits in cmd reads
Setup the Addr bit field while issuing register reads in STIG mode. This is needed for example flashes like cypress define in their transaction table that to read any register there is 1 cmd byte and a few more address bytes trailing the cmd byte. Absence of addr bytes will obviously fail to read correct data from flash register that maybe requested by flash driver because the controller doesn't even specify which address of the flash register the read is being requested from. Signed-off-by: Dhruva Gole <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e8c51b1 commit a8674ae

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

drivers/spi/spi-cadence-quadspi.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,17 @@ static int cqspi_command_read(struct cqspi_flash_pdata *f_pdata,
532532
/* 0 means 1 byte. */
533533
reg |= (((n_rx - 1) & CQSPI_REG_CMDCTRL_RD_BYTES_MASK)
534534
<< CQSPI_REG_CMDCTRL_RD_BYTES_LSB);
535+
536+
/* setup ADDR BIT field */
537+
if (op->addr.nbytes) {
538+
reg |= (0x1 << CQSPI_REG_CMDCTRL_ADDR_EN_LSB);
539+
reg |= ((op->addr.nbytes - 1) &
540+
CQSPI_REG_CMDCTRL_ADD_BYTES_MASK)
541+
<< CQSPI_REG_CMDCTRL_ADD_BYTES_LSB;
542+
543+
writel(op->addr.val, reg_base + CQSPI_REG_CMDADDRESS);
544+
}
545+
535546
status = cqspi_exec_flash_cmd(cqspi, reg);
536547
if (status)
537548
return status;

0 commit comments

Comments
 (0)