Skip to content

Commit 9cb2ff1

Browse files
Apurva Nandanbroonie
authored andcommitted
spi: cadence-quadspi: Disable Auto-HW polling
cadence-quadspi has a builtin Auto-HW polling funtionality using which it keep tracks of completion of write operations. When Auto-HW polling is enabled, it automatically initiates status register read operation, until the flash clears its busy bit. cadence-quadspi controller doesn't allow an address phase when auto-polling the busy bit on the status register. Unlike SPI NOR flashes, SPI NAND flashes do require the address of status register when polling the busy bit using the read register operation. As Auto-HW polling is enabled by default, cadence-quadspi returns a timeout for every write operation after an indefinite amount of polling on SPI NAND flashes. Disable Auto-HW polling completely as the spi-nor core, spinand core, etc. take care of polling the busy bit on their own. Signed-off-by: Apurva Nandan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 0e85ee8 commit 9cb2ff1

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

drivers/spi/spi-cadence-quadspi.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -800,19 +800,20 @@ static int cqspi_write_setup(struct cqspi_flash_pdata *f_pdata,
800800
reg = cqspi_calc_rdreg(f_pdata);
801801
writel(reg, reg_base + CQSPI_REG_RD_INSTR);
802802

803-
if (f_pdata->dtr) {
804-
/*
805-
* Some flashes like the cypress Semper flash expect a 4-byte
806-
* dummy address with the Read SR command in DTR mode, but this
807-
* controller does not support sending address with the Read SR
808-
* command. So, disable write completion polling on the
809-
* controller's side. spi-nor will take care of polling the
810-
* status register.
811-
*/
812-
reg = readl(reg_base + CQSPI_REG_WR_COMPLETION_CTRL);
813-
reg |= CQSPI_REG_WR_DISABLE_AUTO_POLL;
814-
writel(reg, reg_base + CQSPI_REG_WR_COMPLETION_CTRL);
815-
}
803+
/*
804+
* SPI NAND flashes require the address of the status register to be
805+
* passed in the Read SR command. Also, some SPI NOR flashes like the
806+
* cypress Semper flash expect a 4-byte dummy address in the Read SR
807+
* command in DTR mode.
808+
*
809+
* But this controller does not support address phase in the Read SR
810+
* command when doing auto-HW polling. So, disable write completion
811+
* polling on the controller's side. spinand and spi-nor will take
812+
* care of polling the status register.
813+
*/
814+
reg = readl(reg_base + CQSPI_REG_WR_COMPLETION_CTRL);
815+
reg |= CQSPI_REG_WR_DISABLE_AUTO_POLL;
816+
writel(reg, reg_base + CQSPI_REG_WR_COMPLETION_CTRL);
816817

817818
reg = readl(reg_base + CQSPI_REG_SIZE);
818819
reg &= ~CQSPI_REG_SIZE_ADDRESS_MASK;

0 commit comments

Comments
 (0)