Skip to contentSkip to conversation

spi: cadence_xspi: enable automatic platform data allocation

PATCH In review Chen Huei Lok 2 participants 3 messages Feb 9 – Apr 17 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: cadence_xspi: enable automatic platform data allocation

Enable automatic allocation of platform data for the Cadence XSPI controller by setting .plat_auto.

Without this, dev_get_plat() may return invalid or uninitialized platform data when multiple XSPI controllers are present, leading to incorrect IOBASE/SDMABASE/AUXBASE values and causing SPI flash probe failures.

Setting .plat_auto ensures each controller instance receives a properly sized cdns_xspi_plat structure, allowing SF probe to work correctly.

Tested on an Altera Simics platform with multiple XSPI controllers.

---
 drivers/spi/cadence_xspi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/spi/cadence_xspi.c +1 -0
index 717f226b709..8a894025d02 100644
@@ -441,6 +441,7 @@ static const struct udevice_id cdns_xspi_of_match[] = {
 U_BOOT_DRIVER(cadence_xspi) = {
 	.name = CDNS_XSPI_NAME,
 	.id = UCLASS_SPI,
+	.plat_auto = sizeof(struct cdns_xspi_plat),
 	.of_match = cdns_xspi_of_match,
 	.ops = &cdns_xspi_ops,
 	.probe = cdns_xspi_probe,
Signature · 1 line
2.19.0
#1 lore raw

Hi Jagan, Tom,

I wanted to follow up to see if there are any comments.
If there are no concerns, would it be possible to consider this for inclusion? Thanks for your time.

Best Regards,
Lok

Quoted 31 lines · Chen Huei Lok

Enable automatic allocation of platform data for the Cadence XSPI controller by setting .plat_auto.

Without this, dev_get_plat() may return invalid or uninitialized platform data when multiple XSPI controllers are present, leading to incorrect IOBASE/SDMABASE/AUXBASE values and causing SPI flash probe failures.

Setting .plat_auto ensures each controller instance receives a properly sized cdns_xspi_plat structure, allowing SF probe to work correctly.

Tested on an Altera Simics platform with multiple XSPI controllers.

---
  drivers/spi/cadence_xspi.c | 1 +
  1 file changed, 1 insertion(+)
drivers/spi/cadence_xspi.c +1 -0
index 717f226b709..8a894025d02 100644
@@ -441,6 +441,7 @@ static const struct udevice_id cdns_xspi_of_match[] = {
  U_BOOT_DRIVER(cadence_xspi) = {
  	.name = CDNS_XSPI_NAME,
  	.id = UCLASS_SPI,
+	.plat_auto = sizeof(struct cdns_xspi_plat),
  	.of_match = cdns_xspi_of_match,
  	.ops = &cdns_xspi_ops,
  	.probe = cdns_xspi_probe,
#2 lore raw
In reply to Chen Huei Lok
Quoted 9 lines · Chen Huei Lok

Enable automatic allocation of platform data for the Cadence XSPI controller by setting .plat_auto.

Without this, dev_get_plat() may return invalid or uninitialized platform data when multiple XSPI controllers are present, leading to incorrect IOBASE/SDMABASE/AUXBASE values and causing SPI flash probe failures.

[...]

Applied to u-boot/master, thanks!

[1/1] spi: cadence_xspi: enable automatic platform data allocation

      commit: 39d1a96d71f8a77d9ffd55474a317e5bc6bc230a
Signature · 1 line
Tom