From 4c83cf701763bf55601a5e0e5e66ffe3f3f99b66 Mon Sep 17 00:00:00 2001 From: Apurva Nandan Date: Sat, 7 Oct 2023 04:29:40 +0530 Subject: [PATCH] spi: cadence-qspi: Use weak alias for finding ospi subnode OSPI0 instance can have multiple flash nodes with same chip select and node name values. Create a weak alias to give option for adding custom flash node selection logic for different boards. Signed-off-by: Udit Kumar Signed-off-by: Apurva Nandan --- drivers/spi/cadence_qspi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c index 5abb86610c..298f83d3ed 100644 --- a/drivers/spi/cadence_qspi.c +++ b/drivers/spi/cadence_qspi.c @@ -41,6 +41,11 @@ __weak int cadence_qspi_versal_flash_reset(struct udevice *dev) return 0; } +__weak ofnode cadence_qspi_get_subnode(struct udevice *dev) +{ + return dev_read_first_subnode(dev); +} + static int cadence_spi_get_temp(int *temp) { struct udevice *dev; @@ -992,7 +997,7 @@ static int cadence_spi_of_to_plat(struct udevice *bus) plat->is_dma = dev_read_bool(bus, "cdns,is-dma"); /* All other parameters are embedded in the child node */ - subnode = dev_read_first_subnode(bus); + subnode = cadence_qspi_get_subnode(bus); if (!ofnode_valid(subnode)) { printf("Error: subnode with SPI flash config missing!\n"); return -ENODEV;