Skip to content

Commit

Permalink
spi: cadence-quadspi: setup ADDR Bits in cmd reads
Browse files Browse the repository at this point in the history
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 <d-gole@ti.com>
Link: https://lore.kernel.org/r/20230125081023.1573712-4-d-gole@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Dhruva Gole authored and Mark Brown committed Feb 14, 2023
1 parent e8c51b1 commit a8674ae
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/spi/spi-cadence-quadspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,17 @@ static int cqspi_command_read(struct cqspi_flash_pdata *f_pdata,
/* 0 means 1 byte. */
reg |= (((n_rx - 1) & CQSPI_REG_CMDCTRL_RD_BYTES_MASK)
<< CQSPI_REG_CMDCTRL_RD_BYTES_LSB);

/* setup ADDR BIT field */
if (op->addr.nbytes) {
reg |= (0x1 << CQSPI_REG_CMDCTRL_ADDR_EN_LSB);
reg |= ((op->addr.nbytes - 1) &
CQSPI_REG_CMDCTRL_ADD_BYTES_MASK)
<< CQSPI_REG_CMDCTRL_ADD_BYTES_LSB;

writel(op->addr.val, reg_base + CQSPI_REG_CMDADDRESS);
}

status = cqspi_exec_flash_cmd(cqspi, reg);
if (status)
return status;
Expand Down

0 comments on commit a8674ae

Please sign in to comment.