[PATCH 04/11] spi: zynq-qspi: Set priv->is_parallel/stacked in child_pre_probe()

Takahiro Kuwano via B4 Relay devnull+Takahiro.Kuwano.infineon.com at kernel.org
Wed Nov 19 06:13:03 CET 2025


From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>

priv->is_paralle/stacked should be set at probe instead of at every
exec_op(). It can be set in child_pre_probe() by checking the existence
of parallel/stacked-memories property.

Also remove QSPI_SELECT_LOWER/UPPER_CS flags. They are problematic as
they overwrite SPI_XFER_BEGIN/END defined in spi.h.

Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
---
 drivers/spi/zynq_qspi.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index e43dbb40c4a..a2d6d80d04e 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -46,9 +46,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ZYNQ_QSPI_TXD_00_11_OFFSET	0x88	/* Transmit 3-byte inst */
 #define ZYNQ_QSPI_FR_QOUT_CODE		0x6B    /* read instruction code */
 
-#define QSPI_SELECT_LOWER_CS            BIT(0)
-#define QSPI_SELECT_UPPER_CS            BIT(1)
-
 /*
  * QSPI Linear Configuration Register
  *
@@ -205,6 +202,15 @@ static int zynq_qspi_child_pre_probe(struct udevice *bus)
 	priv->max_hz = slave->max_hz;
 	slave->multi_cs_cap = true;
 
+	/*
+	 * The properties have values that represent flash sizes but we just
+	 * need to know the existence of the property here.
+	 */
+	priv->is_parallel = ofnode_read_bool(dev_ofnode(bus),
+					     "parallel-memories");
+	priv->is_stacked = ofnode_read_bool(dev_ofnode(bus),
+					    "stacked-memories");
+
 	return 0;
 }
 
@@ -757,12 +763,6 @@ static int zynq_qspi_exec_op(struct spi_slave *slave,
 	const u8 *tx_buf = NULL;
 	u8 *rx_buf = NULL;
 
-	if ((slave->flags & QSPI_SELECT_LOWER_CS) &&
-	    (slave->flags & QSPI_SELECT_UPPER_CS))
-		priv->is_parallel = true;
-	if (slave->flags & SPI_XFER_STACKED)
-		priv->is_stacked = true;
-
 	if (op->data.nbytes) {
 		if (op->data.dir == SPI_MEM_DATA_IN)
 			rx_buf = op->data.buf.in;
@@ -811,8 +811,6 @@ static int zynq_qspi_exec_op(struct spi_slave *slave,
 			return ret;
 	}
 
-	priv->is_parallel = false;
-	priv->is_stacked = false;
 	slave->flags &= ~SPI_XFER_LOWER;
 	spi_release_bus(slave);
 

-- 
2.34.1




More information about the U-Boot mailing list