Skip to content

Commit f5c2f9f

Browse files
blarson866broonie
authored andcommitted
spi: cadence-quadspi: Add compatible for AMD Pensando Elba SoC
The AMD Pensando Elba SoC has the Cadence QSPI controller integrated. The quirk CQSPI_NEEDS_APB_AHB_HAZARD_WAR is added and if enabled a dummy readback from the controller is performed to ensure synchronization. Signed-off-by: Brad Larson <blarson@amd.com Link: https://lore.kernel.org/r/20230515181606.65953-8-blarson@amd.com Signed-off-by: Mark Brown <broonie@kernel.org
1 parent 9f34baf commit f5c2f9f

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

drivers/spi/spi-cadence-quadspi.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define CQSPI_SUPPORT_EXTERNAL_DMA BIT(2)
4141
#define CQSPI_NO_SUPPORT_WR_COMPLETION BIT(3)
4242
#define CQSPI_SLOW_SRAM BIT(4)
43+
#define CQSPI_NEEDS_APB_AHB_HAZARD_WAR BIT(5)
4344

4445
/* Capabilities */
4546
#define CQSPI_SUPPORTS_OCTAL BIT(0)
@@ -90,6 +91,7 @@ struct cqspi_st {
9091
u32 pd_dev_id;
9192
bool wr_completion;
9293
bool slow_sram;
94+
bool apb_ahb_hazard;
9395
};
9496

9597
struct cqspi_driver_platdata {
@@ -1027,6 +1029,13 @@ static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata,
10271029
if (cqspi->wr_delay)
10281030
ndelay(cqspi->wr_delay);
10291031

1032+
/*
1033+
* If a hazard exists between the APB and AHB interfaces, perform a
1034+
* dummy readback from the controller to ensure synchronization.
1035+
*/
1036+
if (cqspi->apb_ahb_hazard)
1037+
readl(reg_base + CQSPI_REG_INDIRECTWR);
1038+
10301039
while (remaining > 0) {
10311040
size_t write_words, mod_bytes;
10321041

@@ -1754,6 +1763,8 @@ static int cqspi_probe(struct platform_device *pdev)
17541763
cqspi->wr_completion = false;
17551764
if (ddata->quirks & CQSPI_SLOW_SRAM)
17561765
cqspi->slow_sram = true;
1766+
if (ddata->quirks & CQSPI_NEEDS_APB_AHB_HAZARD_WAR)
1767+
cqspi->apb_ahb_hazard = true;
17571768

17581769
if (of_device_is_compatible(pdev->dev.of_node,
17591770
"xlnx,versal-ospi-1.0"))
@@ -1885,6 +1896,10 @@ static const struct cqspi_driver_platdata jh7110_qspi = {
18851896
.quirks = CQSPI_DISABLE_DAC_MODE,
18861897
};
18871898

1899+
static const struct cqspi_driver_platdata pensando_cdns_qspi = {
1900+
.quirks = CQSPI_NEEDS_APB_AHB_HAZARD_WAR | CQSPI_DISABLE_DAC_MODE,
1901+
};
1902+
18881903
static const struct of_device_id cqspi_dt_ids[] = {
18891904
{
18901905
.compatible = "cdns,qspi-nor",
@@ -1914,6 +1929,10 @@ static const struct of_device_id cqspi_dt_ids[] = {
19141929
.compatible = "starfive,jh7110-qspi",
19151930
.data = &jh7110_qspi,
19161931
},
1932+
{
1933+
.compatible = "amd,pensando-elba-qspi",
1934+
.data = &pensando_cdns_qspi,
1935+
},
19171936
{ /* end of table */ }
19181937
};
19191938

0 commit comments

Comments
 (0)