From: Takahiro Kuwano <[email protected]>

priv->is_parallel 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-memories property.

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

Signed-off-by: Takahiro Kuwano <[email protected]>
---
 drivers/spi/zynqmp_gqspi.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index 2a095d0c58e..4a25ee0c459 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -89,9 +89,6 @@
 #define SPI_XFER_ON_LOWER              1
 #define SPI_XFER_ON_UPPER              2
 
-#define GQSPI_SELECT_LOWER_CS          BIT(0)
-#define GQSPI_SELECT_UPPER_CS          BIT(1)
-
 #define GQSPI_DMA_ALIGN                        0x4
 #define GQSPI_MAX_BAUD_RATE_VAL                7
 #define GQSPI_DFLT_BAUD_RATE_VAL       2
@@ -439,6 +436,13 @@ static int zynqmp_qspi_child_pre_probe(struct udevice *bus)
        slave->bytemode = SPI_4BYTE_MODE;
        priv->max_hz = slave->max_hz;
 
+       /*
+        * The property has 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");
+
        return 0;
 }
 
@@ -862,10 +866,6 @@ static int zynqmp_qspi_exec_op(struct spi_slave *slave,
        else
                priv->u_page = 0;
 
-       if ((slave->flags & GQSPI_SELECT_LOWER_CS) &&
-           (slave->flags & GQSPI_SELECT_UPPER_CS))
-               priv->is_parallel = true;
-
        priv->stripe = 0;
        priv->bus = 0;
 
@@ -889,7 +889,6 @@ static int zynqmp_qspi_exec_op(struct spi_slave *slave,
 
        zynqmp_qspi_chipselect(priv, 0);
 
-       priv->is_parallel = false;
        slave->flags &= ~SPI_XFER_LOWER;
 
        return ret;

-- 
2.34.1


Reply via email to