From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@xxxxxxxxxxxxxxx> On Intel Lightning Mountain SoCs QSPI controller do not use auto-poll. This patch disables auto polling when direct access mode is disabled Signed-off-by: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@xxxxxxxxxxxxxxx> --- drivers/mtd/spi-nor/cadence-quadspi.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c index 0ad076eaa81b..c2333f0473e3 100644 --- a/drivers/mtd/spi-nor/cadence-quadspi.c +++ b/drivers/mtd/spi-nor/cadence-quadspi.c @@ -88,6 +88,7 @@ struct cqspi_st { bool rclk_en; u32 trigger_address; u32 wr_delay; + bool auto_poll; struct cqspi_flash_pdata f_pdata[CQSPI_MAX_CHIPSELECT]; }; @@ -136,6 +137,8 @@ struct cqspi_driver_platdata { #define CQSPI_REG_RD_INSTR_TYPE_DATA_MASK 0x3 #define CQSPI_REG_RD_INSTR_DUMMY_MASK 0x1F +#define CQSPI_REG_WR_COMPLETION_CTRL 0x38 +#define CQSPI_REG_WR_COMPLETION_DISABLE_AUTO_POLL BIT(14) #define CQSPI_REG_WR_INSTR 0x08 #define CQSPI_REG_WR_INSTR_OPCODE_LSB 0 #define CQSPI_REG_WR_INSTR_TYPE_ADDR_LSB 12 @@ -1175,6 +1178,18 @@ static int cqspi_of_get_pdata(struct platform_device *pdev) return 0; } +static int cqspi_disable_auto_poll(struct cqspi_st *cqspi) +{ + void __iomem *reg_base = cqspi->iobase; + unsigned int reg; + + reg = readl(reg_base + CQSPI_REG_WR_COMPLETION_CTRL); + reg |= CQSPI_REG_WR_COMPLETION_DISABLE_AUTO_POLL; + writel(reg, reg_base + CQSPI_REG_WR_COMPLETION_CTRL); + + return 0; +} + static void cqspi_controller_init(struct cqspi_st *cqspi) { u32 reg; @@ -1206,6 +1221,10 @@ static void cqspi_controller_init(struct cqspi_st *cqspi) reg |= CQSPI_REG_CONFIG_ENB_DIR_ACC_CTRL; writel(reg, cqspi->iobase + CQSPI_REG_CONFIG); + /* Disable auto-polling */ + if (!cqspi->auto_poll) + cqspi_disable_auto_poll(cqspi); + cqspi_controller_enable(cqspi, 1); } @@ -1421,6 +1440,9 @@ static int cqspi_probe(struct platform_device *pdev) cqspi->wr_delay = 5 * DIV_ROUND_UP(NSEC_PER_SEC, cqspi->master_ref_clk_hz); + if (ddata && (ddata->quirks & CQSPI_DISABLE_DAC_MODE)) + cqspi->auto_poll = false; + ret = devm_request_irq(dev, irq, cqspi_irq_handler, 0, pdev->name, cqspi); if (ret) { -- 2.11.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/