Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: cadence-qspi: Make sure write protection is disabled

Renesas RZ/N1 QSPI controllers embed the Cadence IP with some
modifications. For instance, they feature a write protection of the
direct mapping at the controller level, with this feature all data
writes to the AHB region are aborted.

Despite the fact that the flag setting write protection is disabled by
default, Bootloaders may (and actually do) set it, so mark this feature
as being available with a specific flag to, if applicable, make sure it
is disabled.

Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Miquel Raynal (Schneider Electric) <miquel.raynal@bootlin.com>
Tested-by: Santhosh Kumar K <s-k6@ti.com>
Link: https://patch.msgid.link/20260122-schneider-6-19-rc1-qspi-v4-12-f9c21419a3e6@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Miquel Raynal (Schneider Electric) and committed by
Mark Brown
590f2430 ae62e7cf

+7
+7
drivers/spi/spi-cadence-quadspi.c
··· 48 48 #define CQSPI_DISABLE_STIG_MODE BIT(9) 49 49 #define CQSPI_DISABLE_RUNTIME_PM BIT(10) 50 50 #define CQSPI_NO_INDIRECT_MODE BIT(11) 51 + #define CQSPI_HAS_WR_PROTECT BIT(12) 51 52 52 53 /* Capabilities */ 53 54 #define CQSPI_SUPPORTS_OCTAL BIT(0) ··· 220 219 221 220 #define CQSPI_REG_IRQSTATUS 0x40 222 221 #define CQSPI_REG_IRQMASK 0x44 222 + 223 + #define CQSPI_REG_WR_PROT_CTRL 0x58 223 224 224 225 #define CQSPI_REG_INDIRECTRD 0x60 225 226 #define CQSPI_REG_INDIRECTRD_START_MASK BIT(0) ··· 1645 1642 writel(cqspi->fifo_depth * cqspi->fifo_width / 8, 1646 1643 cqspi->iobase + CQSPI_REG_INDIRECTWRWATERMARK); 1647 1644 } 1645 + 1646 + /* Disable write protection at controller level */ 1647 + if (cqspi->ddata && cqspi->ddata->quirks & CQSPI_HAS_WR_PROTECT) 1648 + writel(0, cqspi->iobase + CQSPI_REG_WR_PROT_CTRL); 1648 1649 1649 1650 /* Disable direct access controller */ 1650 1651 if (!cqspi->use_direct_mode) {