[PATCH 7/7] spi: zynq_qspi: Add parallel memories support in QSPI driver

2023-08-17 Thread Ashok Reddy Soma
Add support for parallel memories in zynq_qspi.c driver. In case of
parallel memories STRIPE bit is set and sent to the qspi ip, which will
send data bits to both the flashes in parallel. However for few commands
we should not use stripe, instead send same data to both the flashes.
Those commands are exclueded by using zynqmp_qspi_update_stripe().

Also update copyright info for this file.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---

 drivers/spi/zynq_qspi.c | 139 
 include/spi.h   |   3 +
 2 files changed, 129 insertions(+), 13 deletions(-)

diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index 069d2a77de..9f4c1f487b 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -1,7 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * (C) Copyright 2013 Xilinx, Inc.
+ * (C) Copyright 2013 - 2022, Xilinx, Inc.
  * (C) Copyright 2015 Jagan Teki 
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
  *
  * Xilinx Zynq Quad-SPI(QSPI) controller driver (master mode only)
  */
@@ -13,10 +14,12 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include "../mtd/spi/sf_internal.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,6 +45,22 @@ DECLARE_GLOBAL_DATA_PTR;
 #define ZYNQ_QSPI_TXD_00_01_OFFSET 0x80/* Transmit 1-byte inst */
 #define ZYNQ_QSPI_TXD_00_10_OFFSET 0x84/* Transmit 2-byte inst */
 #define ZYNQ_QSPI_TXD_00_11_OFFSET 0x88/* Transmit 3-byte inst */
+#define ZYNQ_QSPI_FR_QOUT_CODE 0x6B/* read instruction code */
+#define ZYNQ_QSPI_FR_DUALIO_CODE   0xBB
+
+#define QSPI_SELECT_LOWER_CS   BIT(0)
+#define QSPI_SELECT_UPPER_CS   BIT(1)
+
+/*
+ * QSPI Linear Configuration Register
+ *
+ * It is named Linear Configuration but it controls other modes when not in
+ * linear mode also.
+ */
+#define ZYNQ_QSPI_LCFG_TWO_MEM_MASK0x4000 /* QSPI Enable Bit Mask */
+#define ZYNQ_QSPI_LCFG_SEP_BUS_MASK0x2000 /* QSPI Enable Bit Mask */
+#define ZYNQ_QSPI_LCFG_U_PAGE  0x1000 /* QSPI Upper memory set */
+#define ZYNQ_QSPI_LCFG_DUMMY_SHIFT 8
 
 #define ZYNQ_QSPI_TXFIFO_THRESHOLD 1   /* Tx FIFO threshold level*/
 #define ZYNQ_QSPI_RXFIFO_THRESHOLD 32  /* Rx FIFO threshold level */
@@ -101,7 +120,12 @@ struct zynq_qspi_priv {
int bytes_to_transfer;
int bytes_to_receive;
unsigned int is_inst;
+   unsigned int is_parallel;
+   unsigned int is_stacked;
+   unsigned int is_dio;
+   unsigned int u_page;
unsigned cs_change:1;
+   unsigned is_strip:1;
 };
 
 static int zynq_qspi_of_to_plat(struct udevice *bus)
@@ -112,7 +136,6 @@ static int zynq_qspi_of_to_plat(struct udevice *bus)
 
plat->regs = (struct zynq_qspi_regs *)fdtdec_get_addr(blob,
  node, "reg");
-
return 0;
 }
 
@@ -147,6 +170,9 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv)
/* Disable Interrupts */
writel(ZYNQ_QSPI_IXR_ALL_MASK, >idr);
 
+   /* Disable linear mode as the boot loader may have used it */
+   writel(0x0, >lqspicfg);
+
/* Clear the TX and RX threshold reg */
writel(ZYNQ_QSPI_TXFIFO_THRESHOLD, >txftr);
writel(ZYNQ_QSPI_RXFIFO_THRESHOLD, >rxftr);
@@ -164,12 +190,11 @@ static void zynq_qspi_init_hw(struct zynq_qspi_priv *priv)
confr |= ZYNQ_QSPI_CR_IFMODE_MASK | ZYNQ_QSPI_CR_MCS_MASK |
ZYNQ_QSPI_CR_PCS_MASK | ZYNQ_QSPI_CR_FW_MASK |
ZYNQ_QSPI_CR_MSTREN_MASK;
-   writel(confr, >cr);
 
-   /* Disable the LQSPI feature */
-   confr = readl(>lqspicfg);
-   confr &= ~ZYNQ_QSPI_LQSPICFG_LQMODE_MASK;
-   writel(confr, >lqspicfg);
+   if (priv->is_stacked)
+   confr |= 0x10;
+
+   writel(confr, >cr);
 
/* Enable SPI */
writel(ZYNQ_QSPI_ENR_SPI_EN_MASK, >enr);
@@ -180,6 +205,8 @@ static int zynq_qspi_child_pre_probe(struct udevice *bus)
struct spi_slave *slave = dev_get_parent_priv(bus);
struct zynq_qspi_priv *priv = dev_get_priv(bus->parent);
 
+   slave->multi_cs_cap = true;
+   slave->dio = priv->is_dio;
priv->max_hz = slave->max_hz;
 
return 0;
@@ -363,8 +390,8 @@ static void zynq_qspi_fill_tx_fifo(struct zynq_qspi_priv 
*priv, u32 size)
unsigned len, offset;
struct zynq_qspi_regs *regs = priv->regs;
static const unsigned offsets[4] = {
-   ZYNQ_QSPI_TXD_00_00_OFFSET, ZYNQ_QSPI_TXD_00_01_OFFSET,
-   ZYNQ_QSPI_TXD_00_10_OFFSET, ZYNQ_QSPI_TXD_00_11_OFFSET };
+   ZYNQ_QSPI_TXD_00_01_OFFSET, ZYNQ_QSPI_TXD_00_10_OFFSET,
+   ZYNQ_QSPI_TXD_00_11_OFFSET, ZYNQ_QSPI_TXD_00_00_OFFSET };
 
while ((fifocount < size) &&
(priv-

[PATCH 6/7] spi: zynqmp_gqspi: Add parallel memories support in GQSPI driver

2023-08-17 Thread Ashok Reddy Soma
Add support for parallel memories in zynqmp_gqspi.c driver. In case of
parallel memories STRIPE bit is set and sent to the qspi ip, which will
send data bits to both the flashes in parallel. However for few commands
we should not use stripe, instead send same data to both the flashes.
Those commands are exclueded by using zynqmp_qspi_update_stripe().

Also update copyright info for this file.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---

 drivers/spi/zynqmp_gqspi.c | 146 -
 include/spi.h  |  12 +++
 2 files changed, 140 insertions(+), 18 deletions(-)

diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index c4aee279aa..1c7483bbd8 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * (C) Copyright 2018 Xilinx
+ * (C) Copyright 2013 - 2022, Xilinx, Inc.
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
  *
  * Xilinx ZynqMP Generic Quad-SPI(QSPI) controller driver(master mode only)
  */
@@ -23,6 +24,8 @@
 #include 
 #include 
 #include 
+#include 
+#include "../mtd/spi/sf_internal.h"
 #include 
 
 #define GQSPI_GFIFO_STRT_MODE_MASK BIT(29)
@@ -86,6 +89,9 @@
 #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_ALIGN0x4
 #define GQSPI_MAX_BAUD_RATE_VAL7
 #define GQSPI_DFLT_BAUD_RATE_VAL   2
@@ -181,13 +187,14 @@ struct zynqmp_qspi_priv {
int bytes_to_transfer;
int bytes_to_receive;
const struct spi_mem_op *op;
+   unsigned int is_parallel;
+   unsigned int u_page;
+   unsigned int bus;
+   unsigned int stripe;
+   unsigned int flags;
+   u32 max_hz;
 };
 
-__weak int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 
value)
-{
-   return 0;
-}
-
 static int zynqmp_qspi_of_to_plat(struct udevice *bus)
 {
struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
@@ -234,9 +241,30 @@ static u32 zynqmp_qspi_bus_select(struct zynqmp_qspi_priv 
*priv)
 {
u32 gqspi_fifo_reg = 0;
 
-   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
-GQSPI_GFIFO_CS_LOWER;
-
+   if (priv->is_parallel) {
+   if (priv->bus == SPI_XFER_ON_BOTH)
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
+GQSPI_GFIFO_UP_BUS |
+GQSPI_GFIFO_CS_UPPER |
+GQSPI_GFIFO_CS_LOWER;
+   else if (priv->bus == SPI_XFER_ON_LOWER)
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
+GQSPI_GFIFO_CS_UPPER |
+GQSPI_GFIFO_CS_LOWER;
+   else if (priv->bus == SPI_XFER_ON_UPPER)
+   gqspi_fifo_reg = GQSPI_GFIFO_UP_BUS |
+GQSPI_GFIFO_CS_LOWER |
+GQSPI_GFIFO_CS_UPPER;
+   else
+   debug("Wrong Bus selection:0x%x\n", priv->bus);
+   } else {
+   if (priv->u_page)
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
+GQSPI_GFIFO_CS_UPPER;
+   else
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS |
+GQSPI_GFIFO_CS_LOWER;
+   }
return gqspi_fifo_reg;
 }
 
@@ -279,7 +307,6 @@ static void zynqmp_qspi_fill_gen_fifo(struct 
zynqmp_qspi_priv *priv,
GQSPI_TIMEOUT, 1);
if (ret)
printf("%s Timeout\n", __func__);
-
 }
 
 static void zynqmp_qspi_chipselect(struct zynqmp_qspi_priv *priv, int is_on)
@@ -291,7 +318,13 @@ static void zynqmp_qspi_chipselect(struct zynqmp_qspi_priv 
*priv, int is_on)
gqspi_fifo_reg |= GQSPI_SPI_MODE_SPI |
  GQSPI_IMD_DATA_CS_ASSERT;
} else {
-   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS;
+   if (priv->is_parallel)
+   gqspi_fifo_reg = GQSPI_GFIFO_UP_BUS |
+GQSPI_GFIFO_LOW_BUS;
+   else if (priv->u_page)
+   gqspi_fifo_reg = GQSPI_GFIFO_UP_BUS;
+   else
+   gqspi_fifo_reg = GQSPI_GFIFO_LOW_BUS;
gqspi_fifo_reg |= GQSPI_IMD_DATA_CS_DEASSERT;
}
 
@@ -362,13 +395,15 @@ static int zynqmp_qspi_set_speed(struct udevice *bus, 
uint speed)
u32 confr;
u8 baud_rate_val = 0;
 
-   debug("%s\n", __func__);
-   if (speed > plat->frequency)
-   speed = plat->frequency;
+   /

[PATCH 5/7] spi: spi-uclass: Read chipselect and restrict capabilities

2023-08-17 Thread Ashok Reddy Soma
Read chipselect properties from DT which are populated using 'reg'
property and save it in plat->cs[] array for later use.

Also read multi chipselect capability which is used for
parallel-memories and return errors if they are passed on using DT but
driver is not capable of handling it.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---

 drivers/spi/spi-uclass.c | 21 -
 drivers/spi/xilinx_spi.c |  4 ++--
 drivers/spi/zynq_qspi.c  |  6 +++---
 drivers/spi/zynq_spi.c   |  6 +++---
 include/spi.h|  2 +-
 5 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index c929e7c1d0..cdcf16d346 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -257,7 +257,7 @@ int spi_chip_select(struct udevice *dev)
 {
struct dm_spi_slave_plat *plat = dev_get_parent_plat(dev);
 
-   return plat ? plat->cs : -ENOENT;
+   return plat ? plat->cs[0] : -ENOENT;
 }
 
 int spi_find_chip_select(struct udevice *bus, int cs, struct udevice **devp)
@@ -294,8 +294,8 @@ int spi_find_chip_select(struct udevice *bus, int cs, 
struct udevice **devp)
struct dm_spi_slave_plat *plat;
 
plat = dev_get_parent_plat(dev);
-   dev_dbg(bus, "%s: plat=%p, cs=%d\n", __func__, plat, plat->cs);
-   if (plat->cs == cs) {
+   dev_dbg(bus, "%s: plat=%p, cs=%d\n", __func__, plat, 
plat->cs[0]);
+   if (plat->cs[0] == cs) {
*devp = dev;
return 0;
}
@@ -448,7 +448,7 @@ int _spi_get_bus_and_cs(int busnum, int cs, int speed, int 
mode,
return ret;
}
plat = dev_get_parent_plat(dev);
-   plat->cs = cs;
+   plat->cs[0] = cs;
if (speed) {
plat->max_hz = speed;
} else {
@@ -479,6 +479,11 @@ int _spi_get_bus_and_cs(int busnum, int cs, int speed, int 
mode,
slave = dev_get_parent_priv(dev);
bus_data = dev_get_uclass_priv(bus);
 
+   if ((dev_read_bool(dev, "parallel-memories")) && !slave->multi_cs_cap) {
+   dev_err(dev, "controller doesn't support multi CS\n");
+   return -EINVAL;
+   }
+
/*
 * In case the operation speed is not yet established by
 * dm_spi_claim_bus() ensure the bus is configured properly.
@@ -541,8 +546,14 @@ int spi_slave_of_to_plat(struct udevice *dev, struct 
dm_spi_slave_plat *plat)
 {
int mode = 0;
int value;
+   int ret;
+
+   ret = dev_read_u32_array(dev, "reg", plat->cs, SPI_CS_CNT_MAX);
+   if (ret && ret != -EOVERFLOW) {
+   dev_err(dev, "has no valid 'reg' property (%d)\n", ret);
+   return ret;
+   }
 
-   plat->cs = dev_read_u32_default(dev, "reg", -1);
plat->max_hz = dev_read_u32_default(dev, "spi-max-frequency",
SPI_DEFAULT_SPEED_HZ);
if (dev_read_bool(dev, "spi-cpol"))
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index b58a3f632a..7c4a9b79bb 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -270,7 +270,7 @@ static void xilinx_spi_startup_block(struct spi_slave *spi)
 * Perform a dummy read as a work around for
 * the startup block issue.
 */
-   spi_cs_activate(spi->dev, slave_plat->cs);
+   spi_cs_activate(spi->dev, slave_plat->cs[0]);
txp = 0x9f;
start_transfer(spi, (void *), NULL, 1);
 
@@ -298,7 +298,7 @@ static int xilinx_spi_mem_exec_op(struct spi_slave *spi,
startup++;
}
 
-   spi_cs_activate(spi->dev, slave_plat->cs);
+   spi_cs_activate(spi->dev, slave_plat->cs[0]);
 
if (op->cmd.opcode) {
ret = start_transfer(spi, (void *)>cmd.opcode, NULL, 1);
diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index cb52c0f307..069d2a77de 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -586,13 +586,13 @@ static int zynq_qspi_xfer(struct udevice *dev, unsigned 
int bitlen,
struct zynq_qspi_priv *priv = dev_get_priv(bus);
struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev);
 
-   priv->cs = slave_plat->cs;
+   priv->cs = slave_plat->cs[0];
priv->tx_buf = dout;
priv->rx_buf = din;
priv->len = bitlen / 8;
 
-   debug("zynq_qspi_xfer: bus:%i cs:%i bitlen:%i len:%i flags:%lx\n",
- dev_seq(bus), slave_plat->cs, bitlen, priv->len, flags);
+   debug("zynq_qspi_xfer: bus:%i cs[0]:%i bitlen:%i len:%i flags:%lx\n",
+ dev_seq(bus), slave_plat->

[PATCH 3/7] mtd: spi-nor: Add parallel memories support for read_sr and read_fsr

2023-08-17 Thread Ashok Reddy Soma
Add support for parallel memories flash configuration in read status
register and read flag status register functions.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---

 drivers/mtd/spi/spi-nor-core.c | 50 --
 1 file changed, 36 insertions(+), 14 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 061d88b627..e733b180de 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -437,8 +437,9 @@ static ssize_t spi_nor_write_data(struct spi_nor *nor, 
loff_t to, size_t len,
 }
 
 /*
- * Read the status register, returning its value in the location
- * Return the status register value.
+ * Return the status register value. If the chip is parallel, then the
+ * read will be striped, so we should read 2 bytes to get the sr
+ * register value from both of the parallel chips.
  * Returns negative if error occurred.
  */
 static int read_sr(struct spi_nor *nor)
@@ -470,18 +471,29 @@ static int read_sr(struct spi_nor *nor)
if (spi_nor_protocol_is_dtr(nor->reg_proto))
op.data.nbytes = 2;
 
-   ret = spi_nor_read_write_reg(nor, , val);
-   if (ret < 0) {
-   pr_debug("error %d reading SR\n", (int)ret);
-   return ret;
+   if (nor->flags & SNOR_F_HAS_PARALLEL) {
+   op.data.nbytes = 2;
+   ret = spi_nor_read_write_reg(nor, , [0]);
+   if (ret < 0) {
+   pr_debug("error %d reading SR\n", (int)ret);
+   return ret;
+   }
+   val[0] |= val[1];
+   } else {
+   ret = spi_nor_read_write_reg(nor, , [0]);
+   if (ret < 0) {
+   pr_debug("error %d reading SR\n", (int)ret);
+   return ret;
+   }
}
 
-   return *val;
+   return val[0];
 }
 
 /*
- * Read the flag status register, returning its value in the location
- * Return the status register value.
+ * Return the flag status register value. If the chip is parallel, then
+ * the read will be striped, so we should read 2 bytes to get the fsr
+ * register value from both of the parallel chips.
  * Returns negative if error occurred.
  */
 static int read_fsr(struct spi_nor *nor)
@@ -513,13 +525,23 @@ static int read_fsr(struct spi_nor *nor)
if (spi_nor_protocol_is_dtr(nor->reg_proto))
op.data.nbytes = 2;
 
-   ret = spi_nor_read_write_reg(nor, , val);
-   if (ret < 0) {
-   pr_debug("error %d reading FSR\n", ret);
-   return ret;
+   if (nor->flags & SNOR_F_HAS_PARALLEL) {
+   op.data.nbytes = 2;
+   ret = spi_nor_read_write_reg(nor, , [0]);
+   if (ret < 0) {
+   pr_debug("error %d reading SR\n", (int)ret);
+   return ret;
+   }
+   val[0] &= val[1];
+   } else {
+   ret = spi_nor_read_write_reg(nor, , [0]);
+   if (ret < 0) {
+   pr_debug("error %d reading FSR\n", ret);
+   return ret;
+   }
}
 
-   return *val;
+   return val[0];
 }
 
 /*
-- 
2.17.1



[PATCH 4/7] mtd: spi-nor: Add parallel and stacked memories support in read_bar and write_bar

2023-08-17 Thread Ashok Reddy Soma
Add support for parallel memories and stacked memories configuration
in read_bar and write_bar functions.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---

 drivers/mtd/spi/spi-nor-core.c | 55 +-
 1 file changed, 47 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index e733b180de..4d15a90c8f 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -884,12 +884,32 @@ static int clean_bar(struct spi_nor *nor)
 
 static int write_bar(struct spi_nor *nor, u32 offset)
 {
-   u8 cmd, bank_sel;
+   u8 cmd, bank_sel, upage_curr;
int ret;
+   struct mtd_info *mtd = >mtd;
+
+   /* Wait until previous write command is finished */
+   if (spi_nor_wait_till_ready(nor))
+   return 1;
+
+   if (nor->flags & (SNOR_F_HAS_PARALLEL | SNOR_F_HAS_STACKED) &&
+   mtd->size <= SZ_32M)
+   return 0;
+
+   if (mtd->size <= SZ_16M)
+   return 0;
+
+   offset = offset % (u32)mtd->size;
+   bank_sel = offset >> 24;
 
-   bank_sel = offset / SZ_16M;
-   if (bank_sel == nor->bank_curr)
-   goto bar_end;
+   upage_curr = nor->spi->flags & SPI_XFER_U_PAGE;
+
+   if (!(nor->flags & SNOR_F_HAS_STACKED) && bank_sel == nor->bank_curr)
+   return 0;
+   else if (upage_curr == nor->upage_prev && bank_sel == nor->bank_curr)
+   return 0;
+   else
+   nor->upage_prev = upage_curr;
 
cmd = nor->bank_write_cmd;
write_enable(nor);
@@ -899,15 +919,19 @@ static int write_bar(struct spi_nor *nor, u32 offset)
return ret;
}
 
-bar_end:
nor->bank_curr = bank_sel;
-   return nor->bank_curr;
+
+   return write_disable(nor);
 }
 
 static int read_bar(struct spi_nor *nor, const struct flash_info *info)
 {
u8 curr_bank = 0;
int ret;
+   struct mtd_info *mtd = >mtd;
+
+   if (mtd->size <= SZ_16M)
+   return 0;
 
switch (JEDEC_MFR(info)) {
case SNOR_MFR_SPANSION:
@@ -919,15 +943,30 @@ static int read_bar(struct spi_nor *nor, const struct 
flash_info *info)
nor->bank_write_cmd = SPINOR_OP_WREAR;
}
 
+   if (nor->flags & SNOR_F_HAS_PARALLEL)
+   nor->spi->flags |= SPI_XFER_LOWER;
+
ret = nor->read_reg(nor, nor->bank_read_cmd,
-   _bank, 1);
+   _bank, 1);
if (ret) {
debug("SF: fail to read bank addr register\n");
return ret;
}
nor->bank_curr = curr_bank;
 
-   return 0;
+   // Make sure both chips use the same BAR
+   if (nor->flags & SNOR_F_HAS_PARALLEL) {
+   write_enable(nor);
+   ret = nor->write_reg(nor, nor->bank_write_cmd, _bank, 1);
+   if (ret)
+   return ret;
+
+   ret = write_disable(nor);
+   if (ret)
+   return ret;
+   }
+
+   return ret;
 }
 #endif
 
-- 
2.17.1



[PATCH 2/7] mtd: spi-nor: Add parallel and stacked memories support

2023-08-17 Thread Ashok Reddy Soma
In parallel mode, the current implementation assumes that a maximum of
two flashes are connected. The QSPI controller splits the data evenly
between both the flashes so, both the flashes that are connected in
parallel mode should be identical.
During each operation SPI-NOR sets 0th bit for CS0 & 1st bit for CS1 in
nor->flags.

In stacked mode the current implementation assumes that a maximum of two
flashes are connected and both the flashes are of same make but can
differ in sizes. So, except the sizes all other flash parameters of both
the flashes are identical

Spi-nor will pass on the appropriate flash select flag to low level
driver, and it will select pass all the data to that particular flash.

Write operation in parallel mode are performed in page size * 2 chunks as
each write operation results in writing both the flashes. For doubling
the address space each operation is performed at addr/2 flash offset,
where addr is the address specified by the user.

Similarly for read and erase operations it will read from both flashes,
so size and offset are divided by 2 and send to flash.

Signed-off-by: Ashok Reddy Soma 
Signed-off-by: Venkatesh Yadav Abbarapu 
---

 drivers/mtd/spi/spi-nor-core.c | 280 +
 include/linux/mtd/spi-nor.h|  13 ++
 include/spi.h  |  12 ++
 3 files changed, 277 insertions(+), 28 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 6093277f17..061d88b627 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -638,12 +638,17 @@ static u8 spi_nor_convert_3to4_erase(u8 opcode)
 static void spi_nor_set_4byte_opcodes(struct spi_nor *nor,
  const struct flash_info *info)
 {
+   bool shift = 0;
+
+   if (nor->flags & SNOR_F_HAS_PARALLEL)
+   shift = 1;
+
/* Do some manufacturer fixups first */
switch (JEDEC_MFR(info)) {
case SNOR_MFR_SPANSION:
/* No small sector erase for 4-byte command set */
nor->erase_opcode = SPINOR_OP_SE;
-   nor->mtd.erasesize = info->sector_size;
+   nor->mtd.erasesize = info->sector_size << shift;
break;
 
default:
@@ -964,8 +969,8 @@ static int spi_nor_erase_sector(struct spi_nor *nor, u32 
addr)
 static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
 {
struct spi_nor *nor = mtd_to_spi_nor(mtd);
+   u32 addr, len, rem, offset;
bool addr_known = false;
-   u32 addr, len, rem;
int ret, err;
 
dev_dbg(nor->dev, "at 0x%llx, len %lld\n", (long long)instr->addr,
@@ -990,6 +995,19 @@ static int spi_nor_erase(struct mtd_info *mtd, struct 
erase_info *instr)
ret = -EINTR;
goto erase_err;
}
+
+   offset = addr;
+   if (nor->flags & SNOR_F_HAS_PARALLEL)
+   offset /= 2;
+
+   if (nor->flags & SNOR_F_HAS_STACKED) {
+   if (offset >= (mtd->size / 2)) {
+   offset = offset - (mtd->size / 2);
+   nor->spi->flags |= SPI_XFER_U_PAGE;
+   } else {
+   nor->spi->flags &= ~SPI_XFER_U_PAGE;
+   }
+   }
 #ifdef CONFIG_SPI_FLASH_BAR
ret = write_bar(nor, addr);
if (ret < 0)
@@ -1393,6 +1411,9 @@ static const struct flash_info *spi_nor_read_id(struct 
spi_nor *nor)
u8  id[SPI_NOR_MAX_ID_LEN];
const struct flash_info *info;
 
+   if (nor->flags & SNOR_F_HAS_PARALLEL)
+   nor->spi->flags |= SPI_XFER_LOWER;
+
tmp = nor->read_reg(nor, SPINOR_OP_RDID, id, SPI_NOR_MAX_ID_LEN);
if (tmp < 0) {
dev_dbg(nor->dev, "error %d reading JEDEC ID\n", tmp);
@@ -1417,28 +1438,57 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t 
from, size_t len,
 {
struct spi_nor *nor = mtd_to_spi_nor(mtd);
int ret;
+   u32 offset = from;
+   u32 stack_shift = 0;
+   u32 read_len = 0;
+   u32 rem_bank_len = 0;
+   u8 bank;
+   u8 is_ofst_odd = 0;
 
dev_dbg(nor->dev, "from 0x%08x, len %zd\n", (u32)from, len);
 
-   while (len) {
-   loff_t addr = from;
-   size_t read_len = len;
+   if ((nor->flags & SNOR_F_HAS_PARALLEL) && (offset & 1)) {
+   /* We can hit this case when we use file system like ubifs */
+   from = (loff_t)(from - 1);
+   len = (size_t)(len + 1);
+   is_ofst_odd = 1;
+   }
 
-#ifdef CONFIG_SPI_FLASH_BAR
-   u32 remain_len;
+   while (len) {
+   i

[PATCH 1/7] dm: core: support reading a single indexed u64 value

2023-08-17 Thread Ashok Reddy Soma
Add helper function to allow reading a single indexed u64 value from a
device-tree property containing multiple u64 values, that is an array of
u64's.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/core/of_access.c | 22 ++
 drivers/core/ofnode.c| 30 ++
 include/dm/of_access.h   | 19 +++
 include/dm/ofnode.h  | 12 
 4 files changed, 83 insertions(+)

diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index 57f10445b1..b5c315ac3a 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -570,6 +570,28 @@ int of_read_u32_index(const struct device_node *np, const 
char *propname,
return 0;
 }
 
+int of_read_u64_index(const struct device_node *np, const char *propname,
+ int index, u64 *outp)
+{
+   const __be64 *val;
+
+   debug("%s: %s: ", __func__, propname);
+   if (!np)
+   return -EINVAL;
+
+   val = of_find_property_value_of_size(np, propname,
+sizeof(*outp) * (index + 1));
+   if (IS_ERR(val)) {
+   debug("(not found)\n");
+   return PTR_ERR(val);
+   }
+
+   *outp = be64_to_cpup(val + index);
+   debug("%#x (%d)\n", *outp, *outp);
+
+   return 0;
+}
+
 int of_read_u64(const struct device_node *np, const char *propname, u64 *outp)
 {
const __be64 *val;
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 8df16e56af..9a43343ed3 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -344,6 +344,36 @@ int ofnode_read_u32_index(ofnode node, const char 
*propname, int index,
return 0;
 }
 
+int ofnode_read_u64_index(ofnode node, const char *propname, int index,
+ u64 *outp)
+{
+   const fdt64_t *cell;
+   int len;
+
+   assert(ofnode_valid(node));
+
+   if (ofnode_is_np(node))
+   return of_read_u64_index(ofnode_to_np(node), propname, index,
+outp);
+
+   cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
+  propname, );
+   if (!cell) {
+   debug("(not found)\n");
+   return -EINVAL;
+   }
+
+   if (len < (sizeof(int) * (index + 1))) {
+   debug("(not large enough)\n");
+   return -EOVERFLOW;
+   }
+
+   *outp = fdt64_to_cpu(cell[index]);
+   debug("%#llx (%lld)\n", *outp, *outp);
+
+   return 0;
+}
+
 u32 ofnode_read_u32_index_default(ofnode node, const char *propname, int index,
  u32 def)
 {
diff --git a/include/dm/of_access.h b/include/dm/of_access.h
index c556a18f7d..9e027c9293 100644
--- a/include/dm/of_access.h
+++ b/include/dm/of_access.h
@@ -333,6 +333,25 @@ int of_read_u32(const struct device_node *np, const char 
*propname, u32 *outp);
 int of_read_u32_index(const struct device_node *np, const char *propname,
  int index, u32 *outp);
 
+/**
+ * of_read_u64_index() - Find and read a 64-bit value from a multi-value
+ *   property
+ *
+ * Search for a property in a device node and read a 64-bit value from
+ * it.
+ *
+ * @np:device node from which the property value is to be read.
+ * @propname:  name of the property to be searched.
+ * @index: index of the u32 in the list of values
+ * @outp:  pointer to return value, modified only if return value is 0.
+ *
+ * Return:
+ *   0 on success, -EINVAL if the property does not exist, or -EOVERFLOW if the
+ *   property data isn't large enough.
+ */
+int of_read_u64_index(const struct device_node *np, const char *propname,
+ int index, u64 *outp);
+
 /**
  * of_read_u64() - Find and read a 64-bit integer from a property
  *
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 0f38b3e736..0a85db31f3 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -434,6 +434,18 @@ int ofnode_read_u32(ofnode node, const char *propname, u32 
*outp);
 int ofnode_read_u32_index(ofnode node, const char *propname, int index,
  u32 *outp);
 
+/**
+ * ofnode_read_u64_index() - Read a 64-bit integer from a multi-value property
+ *
+ * @node:  valid node reference to read property from
+ * @propname:  name of the property to read from
+ * @index: index of the integer to return
+ * @outp:  place to put value (if found)
+ * Return: 0 if OK, -ve on error
+ */
+int ofnode_read_u64_index(ofnode node, const char *propname, int index,
+ u64 *outp);
+
 /**
  * ofnode_read_s32() - Read a 32-bit integer from a property
  *
-- 
2.17.1



[PATCH 0/7] spi-nor: Add parallel and stacked memories support

2023-08-17 Thread Ashok Reddy Soma
This series adds support for Xilinx qspi parallel and stacked memeories.

In parallel mode, the current implementation assumes that a maximum of
two flashes are connected. The QSPI controller splits the data evenly
between both the flashes so, both the flashes that are connected in
parallel mode should be identical.
During each operation SPI-NOR sets 0th bit for CS0 & 1st bit for CS1 in
nor->flags.

In stacked mode the current implementation assumes that a maximum of two
flashes are connected and both the flashes are of same make but can
differ in sizes. So, except the sizes all other flash parameters of both
the flashes are identical

Spi-nor will pass on the appropriate flash select flag to low level
driver, and it will select pass all the data to that particular flash.

Write operation in parallel mode are performed in page size * 2 chunks as
each write operation results in writing both the flashes. For doubling
the address space each operation is performed at addr/2 flash offset,
where addr is the address specified by the user.

Similarly for read and erase operations it will read from both flashes,
so size and offset are divided by 2 and send to flash.



Ashok Reddy Soma (7):
  dm: core: support reading a single indexed u64 value
  mtd: spi-nor: Add parallel and stacked memories support
  mtd: spi-nor: Add parallel memories support for read_sr and read_fsr
  mtd: spi-nor: Add parallel and stacked memories support in read_bar
and write_bar
  spi: spi-uclass: Read chipselect and restrict capabilities
  spi: zynqmp_gqspi: Add parallel memories support in GQSPI driver
  spi: zynq_qspi: Add parallel memories support in QSPI driver

 drivers/core/of_access.c   |  22 ++
 drivers/core/ofnode.c  |  30 +++
 drivers/mtd/spi/spi-nor-core.c | 385 -
 drivers/spi/spi-uclass.c   |  21 +-
 drivers/spi/xilinx_spi.c   |   4 +-
 drivers/spi/zynq_qspi.c| 145 +++--
 drivers/spi/zynq_spi.c |   6 +-
 drivers/spi/zynqmp_gqspi.c | 146 +++--
 include/dm/of_access.h |  19 ++
 include/dm/ofnode.h|  12 +
 include/linux/mtd/spi-nor.h|  13 ++
 include/spi.h  |  29 ++-
 12 files changed, 737 insertions(+), 95 deletions(-)

-- 
2.17.1



[PATCH] dm: core: support reading a single indexed u64 value

2023-08-11 Thread Ashok Reddy Soma
Add helper function to allow reading a single indexed u64 value from a
device-tree property containing multiple u64 values, that is an array of
u64's.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/core/of_access.c | 22 ++
 drivers/core/ofnode.c| 30 ++
 include/dm/of_access.h   | 19 +++
 include/dm/ofnode.h  | 12 
 4 files changed, 83 insertions(+)

diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index 57f10445b1..b5c315ac3a 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -570,6 +570,28 @@ int of_read_u32_index(const struct device_node *np, const 
char *propname,
return 0;
 }
 
+int of_read_u64_index(const struct device_node *np, const char *propname,
+ int index, u64 *outp)
+{
+   const __be64 *val;
+
+   debug("%s: %s: ", __func__, propname);
+   if (!np)
+   return -EINVAL;
+
+   val = of_find_property_value_of_size(np, propname,
+sizeof(*outp) * (index + 1));
+   if (IS_ERR(val)) {
+   debug("(not found)\n");
+   return PTR_ERR(val);
+   }
+
+   *outp = be64_to_cpup(val + index);
+   debug("%#x (%d)\n", *outp, *outp);
+
+   return 0;
+}
+
 int of_read_u64(const struct device_node *np, const char *propname, u64 *outp)
 {
const __be64 *val;
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 8df16e56af..9a43343ed3 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -344,6 +344,36 @@ int ofnode_read_u32_index(ofnode node, const char 
*propname, int index,
return 0;
 }
 
+int ofnode_read_u64_index(ofnode node, const char *propname, int index,
+ u64 *outp)
+{
+   const fdt64_t *cell;
+   int len;
+
+   assert(ofnode_valid(node));
+
+   if (ofnode_is_np(node))
+   return of_read_u64_index(ofnode_to_np(node), propname, index,
+outp);
+
+   cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
+  propname, );
+   if (!cell) {
+   debug("(not found)\n");
+   return -EINVAL;
+   }
+
+   if (len < (sizeof(int) * (index + 1))) {
+   debug("(not large enough)\n");
+   return -EOVERFLOW;
+   }
+
+   *outp = fdt64_to_cpu(cell[index]);
+   debug("%#llx (%lld)\n", *outp, *outp);
+
+   return 0;
+}
+
 u32 ofnode_read_u32_index_default(ofnode node, const char *propname, int index,
  u32 def)
 {
diff --git a/include/dm/of_access.h b/include/dm/of_access.h
index c556a18f7d..9e027c9293 100644
--- a/include/dm/of_access.h
+++ b/include/dm/of_access.h
@@ -333,6 +333,25 @@ int of_read_u32(const struct device_node *np, const char 
*propname, u32 *outp);
 int of_read_u32_index(const struct device_node *np, const char *propname,
  int index, u32 *outp);
 
+/**
+ * of_read_u64_index() - Find and read a 64-bit value from a multi-value
+ *   property
+ *
+ * Search for a property in a device node and read a 64-bit value from
+ * it.
+ *
+ * @np:device node from which the property value is to be read.
+ * @propname:  name of the property to be searched.
+ * @index: index of the u32 in the list of values
+ * @outp:  pointer to return value, modified only if return value is 0.
+ *
+ * Return:
+ *   0 on success, -EINVAL if the property does not exist, or -EOVERFLOW if the
+ *   property data isn't large enough.
+ */
+int of_read_u64_index(const struct device_node *np, const char *propname,
+ int index, u64 *outp);
+
 /**
  * of_read_u64() - Find and read a 64-bit integer from a property
  *
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 0f38b3e736..0a85db31f3 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -434,6 +434,18 @@ int ofnode_read_u32(ofnode node, const char *propname, u32 
*outp);
 int ofnode_read_u32_index(ofnode node, const char *propname, int index,
  u32 *outp);
 
+/**
+ * ofnode_read_u64_index() - Read a 64-bit integer from a multi-value property
+ *
+ * @node:  valid node reference to read property from
+ * @propname:  name of the property to read from
+ * @index: index of the integer to return
+ * @outp:  place to put value (if found)
+ * Return: 0 if OK, -ve on error
+ */
+int ofnode_read_u64_index(ofnode node, const char *propname, int index,
+ u64 *outp);
+
 /**
  * ofnode_read_s32() - Read a 32-bit integer from a property
  *
-- 
2.17.1



[PATCH 3/3] pinctrl: zynqmp: Add support for output-enable and bias-high-impedance

2023-08-10 Thread Ashok Reddy Soma
Add support to handle 'output-enable' and 'bias-high-impedance'
configurations in pinctrl driver.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/pinctrl/pinctrl-zynqmp.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c
index e9857f5ed9..517035961d 100644
--- a/drivers/pinctrl/pinctrl-zynqmp.c
+++ b/drivers/pinctrl/pinctrl-zynqmp.c
@@ -473,6 +473,10 @@ static int zynqmp_pinconf_set(struct udevice *dev, 
unsigned int pin,
 pin);
break;
case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
+   param = PM_PINCTRL_CONFIG_TRI_STATE;
+   arg = PM_PINCTRL_TRI_STATE_ENABLE;
+   ret = zynqmp_pm_pinctrl_set_config(pin, param, arg);
+   break;
case PIN_CONFIG_LOW_POWER_MODE:
/*
 * This cases are mentioned in dts but configurable
@@ -481,6 +485,11 @@ static int zynqmp_pinconf_set(struct udevice *dev, 
unsigned int pin,
 */
ret = 0;
break;
+   case PIN_CONFIG_OUTPUT_ENABLE:
+   param = PM_PINCTRL_CONFIG_TRI_STATE;
+   arg = PM_PINCTRL_TRI_STATE_DISABLE;
+   ret = zynqmp_pm_pinctrl_set_config(pin, param, arg);
+   break;
default:
dev_warn(dev, "unsupported configuration parameter '%u'\n",
 param);
-- 
2.17.1



[PATCH 1/3] firmware: zynqmp: Add support to check feature

2023-08-10 Thread Ashok Reddy Soma
Add firmware API to check if given feature is supported.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/firmware/firmware-zynqmp.c | 13 +
 include/zynqmp_firmware.h  |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/drivers/firmware/firmware-zynqmp.c 
b/drivers/firmware/firmware-zynqmp.c
index ab4c4f1a69..43fb7fa778 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -195,6 +195,19 @@ int zynqmp_pm_set_sd_config(u32 node, enum 
pm_sd_config_type config, u32 value)
return ret;
 }
 
+int zynqmp_pm_feature(const u32 api_id)
+{
+   int ret;
+   u32 ret_payload[PAYLOAD_ARG_CNT];
+
+   /* Check feature check API version */
+   ret = xilinx_pm_request(PM_FEATURE_CHECK, api_id, 0, 0, 0,
+   ret_payload);
+
+   /* Return feature check version */
+   return ret_payload[1] & FIRMWARE_VERSION_MASK;
+}
+
 int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id)
 {
int ret;
diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h
index 18a87d2749..73198a6a6e 100644
--- a/include/zynqmp_firmware.h
+++ b/include/zynqmp_firmware.h
@@ -456,6 +456,7 @@ int zynqmp_pm_set_gem_config(u32 node, enum 
pm_gem_config_type config,
 int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id);
 int zynqmp_mmio_read(const u32 address, u32 *value);
 int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
+int zynqmp_pm_feature(const u32 api_id);
 
 /* Type of Config Object */
 #define PM_CONFIG_OBJECT_TYPE_BASE 0x1U
@@ -492,6 +493,8 @@ enum zynqmp_pm_request_ack {
 /* PM API versions */
 #define PM_API_VERSION_2   2
 
+#define PM_PINCTRL_PARAM_SET_VERSION   2
+
 struct zynqmp_ipi_msg {
size_t len;
u32 *buf;
-- 
2.17.1



[PATCH 2/3] pinctrl: zynqmp: Add version check for TRISTATE configuration

2023-08-10 Thread Ashok Reddy Soma
Support for configuring TRISTATE parameter is added in ZYNQMP PMUFW(Xilinx
ZynqMP Platform Management Firmware) Configuration Param Set version 2.0.
If the requested configuration is TRISTATE then check the version before
requesting Xilinx firmware to set the configuration.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/pinctrl/pinctrl-zynqmp.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c
index 02626a7561..e9857f5ed9 100644
--- a/drivers/pinctrl/pinctrl-zynqmp.c
+++ b/drivers/pinctrl/pinctrl-zynqmp.c
@@ -158,6 +158,12 @@ static int zynqmp_pm_pinctrl_set_config(const u32 pin, 
const u32 param, u32 valu
 {
int ret;
 
+   if (param == PM_PINCTRL_CONFIG_TRI_STATE) {
+   ret = zynqmp_pm_feature(PM_PINCTRL_CONFIG_PARAM_SET);
+   if (ret < PM_PINCTRL_PARAM_SET_VERSION)
+   return -EOPNOTSUPP;
+   }
+
/* Request the pin first */
ret = xilinx_pm_request(PM_PINCTRL_REQUEST, pin, 0, 0, 0, NULL);
if (ret) {
-- 
2.17.1



[PATCH 0/3] pinctrl: zynqmp: Add tri-state configuration support

2023-08-10 Thread Ashok Reddy Soma
Add support for pinctrl driver to handle 'output-enable' and
'bias-high-impedance' configurations.

This support has been added in Xilinx ZynqMP Platform Management Firmware
recently, hence add a version check to avoid backward compatibility
issues.



Ashok Reddy Soma (3):
  firmware: zynqmp: Add support to check feature
  pinctrl: zynqmp: Add version check for TRISTATE configuration
  pinctrl: zynqmp: Add support for output-enable and bias-high-impedance

 drivers/firmware/firmware-zynqmp.c | 13 +
 drivers/pinctrl/pinctrl-zynqmp.c   | 15 +++
 include/zynqmp_firmware.h  |  3 +++
 3 files changed, 31 insertions(+)

-- 
2.17.1



[PATCH] clk: zynqmp: Add gem rx and tsu clocks to return register

2023-07-20 Thread Ashok Reddy Soma
Add gem_tsu and gem0_rx till gem3_rx to return proper register from
zynqmp_clk_get_register. Otherwise firmware won't be able to set clock
for these due to incorrect register address.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/clk/clk_zynqmp.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/clk/clk_zynqmp.c b/drivers/clk/clk_zynqmp.c
index 27479391e1..b0843fe546 100644
--- a/drivers/clk/clk_zynqmp.c
+++ b/drivers/clk/clk_zynqmp.c
@@ -269,17 +269,22 @@ static u32 zynqmp_clk_get_register(enum zynqmp_clk id)
case usb3_dual_ref:
return CRL_APB_USB3_DUAL_REF_CTRL;
case gem_tsu_ref:
+   case gem_tsu:
return CRL_APB_GEM_TSU_REF_CTRL;
case gem0_tx:
+   case gem0_rx:
case gem0_ref:
return CRL_APB_GEM0_REF_CTRL;
case gem1_tx:
+   case gem1_rx:
case gem1_ref:
return CRL_APB_GEM1_REF_CTRL;
case gem2_tx:
+   case gem2_rx:
case gem2_ref:
return CRL_APB_GEM2_REF_CTRL;
case gem3_tx:
+   case gem3_rx:
case gem3_ref:
return CRL_APB_GEM3_REF_CTRL;
case usb0_bus_ref:
-- 
2.17.1



[PATCH] clk: zynqmp: Add set_rate support for gem rx and tsu clks

2023-07-19 Thread Ashok Reddy Soma
gem0_rx till gem3_rx  and gem_tsu are missing from set rate function.
Add them, so that they can be set from pmu firmware via clock framework.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/clk/clk_zynqmp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk_zynqmp.c b/drivers/clk/clk_zynqmp.c
index be0ee50e0e..27479391e1 100644
--- a/drivers/clk/clk_zynqmp.c
+++ b/drivers/clk/clk_zynqmp.c
@@ -718,6 +718,8 @@ static ulong zynqmp_clk_set_rate(struct clk *clk, ulong 
rate)
switch (id) {
case gem0_ref ... gem3_ref:
case gem0_tx ... gem3_tx:
+   case gem0_rx ... gem3_rx:
+   case gem_tsu:
case qspi_ref ... can1_ref:
case usb0_bus_ref ... usb3_dual_ref:
return zynqmp_clk_set_peripheral_rate(priv, id,
-- 
2.17.1



[PATCH] clk: Dont return error when assigned-clocks is empty or missing

2023-07-11 Thread Ashok Reddy Soma
There is a chance that assigned-clock-rates is given and assigned-clocks
could be empty. Dont return error in that case, because the probe of the
corresponding driver will not be called at all if this fails.
Better to continue to look for it and return 0.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/clk/clk-uclass.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index dc3e9d6a26..f186fcbcdb 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -329,7 +329,13 @@ static int clk_set_default_rates(struct udevice *dev,
dev_dbg(dev,
"could not get assigned clock %d (err = %d)\n",
index, ret);
-   continue;
+   /* Skip if it is empty */
+   if (ret == -ENOENT) {
+   ret = 0;
+   continue;
+   }
+
+   return ret;
}
 
/* This is clk provider device trying to program itself
-- 
2.17.1



[PATCH 1/2] cmd: thordown: Add proper dependency for CMD_THOR_DOWNLOAD

2023-07-09 Thread Ashok Reddy Soma
When CONFIG_CMD_USB and CONFIG_USB are disabled some compilation errors
are seen as below.

cmd/thordown.o: in function `usb_gadget_initialize':
include/linux/usb/gadget.h:981: undefined reference to `board_usb_init'
cmd/thordown.o: in function `do_thor_down':
cmd/thordown.c:68: undefined reference to `g_dnl_unregister'
cmd/thordown.o: in function `usb_gadget_release':
include/linux/usb/gadget.h:986: undefined reference to `board_usb_cleanup'
cmd/thordown.o: in function `do_thor_down':
cmd/thordown.c:41: undefined reference to `g_dnl_register'
cmd/thordown.c:48: undefined reference to `thor_init'
cmd/thordown.c:56: undefined reference to `thor_handle'
gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld.bfd: line 4:  8485
Segmentation fault  (core dumped) $CC --sysroot=$LIBC
--no-warn-rwx-segment "$@"
Makefile:1779: recipe for target 'u-boot' failed
make: *** [u-boot] Error 139
make: *** Deleting file 'u-boot'

Add dependency of CMD_USB for CONFIG_CMD_THOR_DOWNLOAD to fix the errors.

Signed-off-by: Ashok Reddy Soma 
---

 cmd/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 02e54f1e50..b44df9d67a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -526,6 +526,7 @@ config CMD_SPL_WRITE_SIZE
 
 config CMD_THOR_DOWNLOAD
bool "thor - TIZEN 'thor' download"
+   depends on CMD_USB
select DFU
help
  Implements the 'thor' download protocol. This is a way of
-- 
2.17.1



[PATCH 2/2] zynqmp: config: Add proper dependencies for USB

2023-07-09 Thread Ashok Reddy Soma
When CONFIG_CMD_USB and CONFIG_USB are disabled, still some compilation
errors are seen as below.

In file included from include/configs/xilinx_zynqmp.h:173,
 from include/config.h:3,
 from include/common.h:16,
 from env/common.c:10:
include/config_distro_bootcmd.h:302:9: error: expected '}' before 
'BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB'
  302 | BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
  | ^
include/config_distro_bootcmd.h:302:9: note: in definition of macro
'BOOTENV_DEV_NAME_USB'
  302 | BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB
  | ^
include/configs/xilinx_zynqmp.h:77:41: note: in expansion of macro
'BOOTENV_DEV_NAME'
   77 | # define BOOT_TARGET_DEVICES_USB(func)  func(USB, usb, 0)
   func(USB, usb, 1)
  | ^~~~
include/configs/xilinx_zynqmp.h:168:9: note: in expansion of macro
'BOOT_TARGET_DEVICES_USB'
  168 | BOOT_TARGET_DEVICES_USB(func) \
  | ^~~
include/config_distro_bootcmd.h:454:25: note: in expansion of macro
'BOOT_TARGET_DEVICES'
  454 | "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0"
  | ^~~
include/config_distro_bootcmd.h:474:9: note: in expansion of macro
'BOOTENV_BOOT_TARGETS'
  474 | BOOTENV_BOOT_TARGETS \
  | ^~~~
include/configs/xilinx_zynqmp.h:179:9: note: in expansion of macro
'BOOTENV'
  179 | BOOTENV
  | ^~~
include/env_default.h:120:9: note: in expansion of macro
'CFG_EXTRA_ENV_SETTINGS'
  120 | CFG_EXTRA_ENV_SETTINGS
  | ^~
In file included from env/common.c:32:
include/env_default.h:27:36: note: to match this '{'
   27 | const char default_environment[] = {
  |^
scripts/Makefile.build:256: recipe for target 'env/common.o' failed
make[1]: *** [env/common.o] Error 1
Makefile:1853: recipe for target 'env' failed
make: *** [env] Error 2
make: *** Waiting for unfinished jobs

Add CONFIG_USB_STORAGE as dependency for USB related macro's such as
BOOT_TARGET_DEVICES_USB() and DFU_DEFAULT_POLL_TIMEOUT and
CONFIG_THOR_RESET_OFF.

Remove CONFIG_ZYNQMP_USB from Kconfig and also from defconfig since it
is not used anywhere else.

Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/mach-zynqmp/Kconfig | 3 ---
 configs/xilinx_zynqmp_virt_defconfig | 1 -
 include/configs/xilinx_zynqmp.h  | 4 ++--
 3 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
index fd6f07715a..26b80b7882 100644
--- a/arch/arm/mach-zynqmp/Kconfig
+++ b/arch/arm/mach-zynqmp/Kconfig
@@ -84,9 +84,6 @@ config ZYNQMP_SPL_PM_CFG_OBJ_FILE
  Leave this option empty if your PMU firmware has a hard-coded
  configuration object or you are loading it by any other means.
 
-config ZYNQMP_USB
-   bool "Configure ZynqMP USB"
-
 config ZYNQMP_NO_DDR
bool "Disable DDR MMU mapping"
help
diff --git a/configs/xilinx_zynqmp_virt_defconfig 
b/configs/xilinx_zynqmp_virt_defconfig
index c4bbde2206..6bda4f8453 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -17,7 +17,6 @@ CONFIG_ENV_OFFSET_REDUND=0x1E8
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI=y
 CONFIG_CMD_FRU=y
-CONFIG_ZYNQMP_USB=y
 CONFIG_SYS_LOAD_ADDR=0x800
 CONFIG_AHCI=y
 CONFIG_SYS_MEMTEST_START=0x
diff --git a/include/configs/xilinx_zynqmp.h b/include/configs/xilinx_zynqmp.h
index 011f0034c5..44f8914b80 100644
--- a/include/configs/xilinx_zynqmp.h
+++ b/include/configs/xilinx_zynqmp.h
@@ -29,7 +29,7 @@
 
 /* Miscellaneous configurable options */
 
-#if defined(CONFIG_ZYNQMP_USB)
+#if defined(CONFIG_USB_STORAGE)
 #define DFU_DEFAULT_POLL_TIMEOUT   300
 
 # define PARTS_DEFAULT \
@@ -73,7 +73,7 @@
 # define BOOT_TARGET_DEVICES_SCSI(func)
 #endif
 
-#if defined(CONFIG_ZYNQMP_USB)
+#if defined(CONFIG_USB_STORAGE)
 # define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1)
 #else
 # define BOOT_TARGET_DEVICES_USB(func)
-- 
2.17.1



[PATCH 0/2] Fix dependencies of USB Kconfig options

2023-07-09 Thread Ashok Reddy Soma
When USB device driver CONFIG_USB and CONFIG_CMD_USB are disabled, some
compilation issues are seen. Also CMD_THOR_DOWNLOAD should depend on
CONFIG_CMD_USB. Add dependencies to resolve those issues and compile
properly. Also remove unused config CONFIG_ZYNQMP_USB.


Ashok Reddy Soma (2):
  cmd: thordown: Add proper dependency for CMD_THOR_DOWNLOAD
  zynqmp: config: Add proper dependencies for USB

 arch/arm/mach-zynqmp/Kconfig | 3 ---
 cmd/Kconfig  | 1 +
 configs/xilinx_zynqmp_virt_defconfig | 1 -
 include/configs/xilinx_zynqmp.h  | 4 ++--
 4 files changed, 3 insertions(+), 6 deletions(-)

-- 
2.17.1



[PATCH v2] dfu: Add proper dependency for CONFIG_DFU_MMC

2023-07-07 Thread Ashok Reddy Soma
When CONFIG_CMD_MMC and CONFIG_MMC are disabled, still some compilation
errors are seen as below due to unresolved symbols.

drivers/dfu/dfu_mmc.o: in function `mmc_block_op':
drivers/dfu/dfu_mmc.c:32: undefined reference to `find_mmc_device'
drivers/dfu/dfu_mmc.c:54: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.c:67: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.c:70: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.o: in function `dfu_fill_entity_mmc':
drivers/dfu/dfu_mmc.c:369: undefined reference to `find_mmc_device'
drivers/dfu/dfu_mmc.c:376: undefined reference to `mmc_init'
drivers/dfu/dfu_mmc.c:403: undefined reference to `mmc_get_blk_desc'
gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld.bfd: line 4:
31661 Segmentation fault  (core dumped) $CC --sysroot=$LIBC
--no-warn-rwx-segment "$@"
Makefile:1760: recipe for target 'u-boot' failed
make: *** [u-boot] Error 139
make: *** Deleting file 'u-boot'

Add dependency of CONFIG_MMC for CONFIG_DFU_MMC config to fix the errors.

Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Changed patch subject prefix to dfu from zynqmp: config

 drivers/dfu/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index 8d7f13dcb0..8e9e8eb4fe 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -35,6 +35,7 @@ config DFU_TIMEOUT
 
 config DFU_MMC
bool "MMC back end for DFU"
+   depends on MMC
help
  This option enables using DFU to read and write to MMC based storage.
 
-- 
2.17.1



[PATCH] zynqmp: config: Add proper dependency for CONFIG_DFU_MMC

2023-07-07 Thread Ashok Reddy Soma
When CONFIG_CMD_MMC and CONFIG_MMC are disabled, still some compilation
errors are seen as below due to unresolved symbols.

drivers/dfu/dfu_mmc.o: in function `mmc_block_op':
drivers/dfu/dfu_mmc.c:32: undefined reference to `find_mmc_device'
drivers/dfu/dfu_mmc.c:54: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.c:67: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.c:70: undefined reference to `mmc_get_blk_desc'
drivers/dfu/dfu_mmc.o: in function `dfu_fill_entity_mmc':
drivers/dfu/dfu_mmc.c:369: undefined reference to `find_mmc_device'
drivers/dfu/dfu_mmc.c:376: undefined reference to `mmc_init'
drivers/dfu/dfu_mmc.c:403: undefined reference to `mmc_get_blk_desc'
gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld.bfd: line 4:
31661 Segmentation fault  (core dumped) $CC --sysroot=$LIBC
--no-warn-rwx-segment "$@"
Makefile:1760: recipe for target 'u-boot' failed
make: *** [u-boot] Error 139
make: *** Deleting file 'u-boot'

Add dependency of CONFIG_MMC for CONFIG_DFU_MMC config to fix the errors.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/dfu/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index 8d7f13dcb0..8e9e8eb4fe 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -35,6 +35,7 @@ config DFU_TIMEOUT
 
 config DFU_MMC
bool "MMC back end for DFU"
+   depends on MMC
help
  This option enables using DFU to read and write to MMC based storage.
 
-- 
2.17.1



[PATCH] env: Fix default environment saving issue

2023-07-04 Thread Ashok Reddy Soma
When CONFIG_SYS_REDUNDAND_ENVIRONMENT is enabled, by default env is
getting saved to redundant environment irrespective of primary env is
present or not.

It means even if primary and redundant environment are not present, by
default, env is getting stored to redundant environment. Even if primary
env is present, it is choosing to store in redudndant env.

Ideally it should look for primary env and choose to store in primary env
if it is present. If both primary and redundant env are not present then
it should save in to primary env area.

Fix the issue by making env_valid = ENV_INVALID when both the
environments are not present.

Signed-off-by: Ashok Reddy Soma 
---

 env/common.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/env/common.c b/env/common.c
index 8beb8e6aa4..0ecdb248a0 100644
--- a/env/common.c
+++ b/env/common.c
@@ -353,6 +353,7 @@ int env_check_redund(const char *buf1, int buf1_read_fail,
tmp_env2->crc;
 
if (!crc1_ok && !crc2_ok) {
+   gd->env_valid = ENV_INVALID;
return -ENOMSG; /* needed for env_load() */
} else if (crc1_ok && !crc2_ok) {
gd->env_valid = ENV_VALID;
-- 
2.17.1



[PATCH 3/3] xilinx: versal-net: Add mini eMMC 5.1 configuration

2023-06-14 Thread Ashok Reddy Soma
Add support for Versal NET mini eMMC 5.1 configuration. Add device tree
and defconfig.

Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/dts/Makefile |  1 +
 arch/arm/dts/versal-net-mini-emmc.dts | 64 +++
 configs/xilinx_versal_net_mini_emmc_defconfig | 63 ++
 3 files changed, 128 insertions(+)
 create mode 100644 arch/arm/dts/versal-net-mini-emmc.dts
 create mode 100644 configs/xilinx_versal_net_mini_emmc_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index e6a06a226f..ffb128b424 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -413,6 +413,7 @@ dtb-$(CONFIG_ARCH_VERSAL) += \
xilinx-versal-virt.dtb
 dtb-$(CONFIG_ARCH_VERSAL_NET) += \
versal-net-mini.dtb \
+   versal-net-mini-emmc.dtb \
versal-net-mini-ospi-single.dtb \
versal-net-mini-qspi-single.dtb \
xilinx-versal-net-virt.dtb
diff --git a/arch/arm/dts/versal-net-mini-emmc.dts 
b/arch/arm/dts/versal-net-mini-emmc.dts
new file mode 100644
index 00..4bdbc1dad1
--- /dev/null
+++ b/arch/arm/dts/versal-net-mini-emmc.dts
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Xilinx Versal NET Mini eMMC Configuration
+ *
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
+ *
+ * Michal Simek 
+ * Ashok Reddy Soma 
+ */
+
+/dts-v1/;
+
+/ {
+   compatible = "xlnx,versal-net-mini";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   model = "Xilinx Versal NET MINI eMMC";
+
+   aliases {
+   serial0 = 
+   mmc0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200";
+   };
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0 0 0 0x2000>;
+   };
+
+   clk200: clk200 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <2>;
+   };
+
+   dcc: dcc {
+   compatible = "arm,dcc";
+   status = "okay";
+   u-boot,dm-pre-reloc;
+   };
+
+   amba: amba {
+   u-boot,dm-pre-reloc;
+   compatible = "simple-bus";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   sdhci1: sdhci@f105 {
+   compatible = "xlnx,versal-net-emmc";
+   status = "okay";
+   non-removable;
+   disable-wp;
+   bus-width = <8>;
+   reg = <0 0xf105 0 0x1>;
+   clock-names = "clk_xin", "clk_ahb";
+   clocks = <>, <>;
+   xlnx,mio-bank = <0>;
+   };
+   };
+};
diff --git a/configs/xilinx_versal_net_mini_emmc_defconfig 
b/configs/xilinx_versal_net_mini_emmc_defconfig
new file mode 100644
index 00..6d5affcd52
--- /dev/null
+++ b/configs/xilinx_versal_net_mini_emmc_defconfig
@@ -0,0 +1,63 @@
+CONFIG_ARM=y
+CONFIG_SYS_CONFIG_NAME="xilinx_versal_net_mini"
+CONFIG_COUNTER_FREQUENCY=1
+CONFIG_ARCH_VERSAL_NET=y
+CONFIG_TEXT_BASE=0x1
+CONFIG_SYS_MALLOC_LEN=0x8
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x1
+CONFIG_ENV_SIZE=0x80
+CONFIG_DEFAULT_DEVICE_TREE="versal-net-mini-emmc"
+CONFIG_SYS_PROMPT="Versal NET> "
+# CONFIG_PSCI_RESET is not set
+CONFIG_SYS_LOAD_ADDR=0x800
+# CONFIG_EXPERT is not set
+CONFIG_REMAKE_ELF=y
+# CONFIG_AUTOBOOT is not set
+CONFIG_SYS_CONSOLE_INFO_QUIET=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_BOARD_EARLY_INIT_R=y
+# CONFIG_BOARD_LATE_INIT is not set
+# CONFIG_CMDLINE_EDITING is not set
+# CONFIG_AUTO_COMPLETE is not set
+# CONFIG_SYS_LONGHELP is not set
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_CONSOLE is not set
+# CONFIG_CMD_BOOTD is not set
+# CONFIG_CMD_BOOTM is not set
+# CONFIG_CMD_BOOTI is not set
+# CONFIG_CMD_ELF is not set
+# CONFIG_CMD_FDT is not set
+# CONFIG_CMD_GO is not set
+# CONFIG_CMD_RUN is not set
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_EXPORTENV is not set
+# CONFIG_CMD_IMPORTENV is not set
+# CONFIG_CMD_EDITENV is not set
+# CONFIG_CMD_SAVEENV is not set
+# CONFIG_CMD_ENV_EXISTS is not set
+# CONFIG_CMD_CRC32 is not set
+# CONFIG_CMD_LOADB is not set
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+# CONFIG_CMD_ECHO is not set
+# CONFIG_CMD_ITEST is not set
+# CONFIG_CMD_SOURCE is not set
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_OF_EMBED=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+# CONFIG_NET is not set
+# CONFIG_DM_WARN is not set
+# CONFIG_DM_DEVICE_REMOVE is not set
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ZYNQ=y
+CONFIG_ARM_DCC=y
+CONFIG_FAT_WRITE=y
+# CONFIG_GZIP is not set
+# CONFIG_EFI_LOADER is not set
+# CONFIG_LMB is not set
-- 
2.17.1



[PATCH 2/3] xilinx: versal-net: Add mini ospi configuration

2023-06-14 Thread Ashok Reddy Soma
Add support for Versal NET mini Octal SPI flash configuration. This runs
from onchip memory, so it has to be compact. Hence only Octal SPI
related settings are enabled.

Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/dts/Makefile |  1 +
 arch/arm/dts/versal-net-mini-ospi-single.dts  | 19 +
 arch/arm/dts/versal-net-mini-ospi.dtsi| 78 +++
 configs/xilinx_versal_net_mini_ospi_defconfig | 71 +
 4 files changed, 169 insertions(+)
 create mode 100644 arch/arm/dts/versal-net-mini-ospi-single.dts
 create mode 100644 arch/arm/dts/versal-net-mini-ospi.dtsi
 create mode 100644 configs/xilinx_versal_net_mini_ospi_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 7b2fd0653b..e6a06a226f 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -413,6 +413,7 @@ dtb-$(CONFIG_ARCH_VERSAL) += \
xilinx-versal-virt.dtb
 dtb-$(CONFIG_ARCH_VERSAL_NET) += \
versal-net-mini.dtb \
+   versal-net-mini-ospi-single.dtb \
versal-net-mini-qspi-single.dtb \
xilinx-versal-net-virt.dtb
 dtb-$(CONFIG_ARCH_ZYNQMP_R5) += \
diff --git a/arch/arm/dts/versal-net-mini-ospi-single.dts 
b/arch/arm/dts/versal-net-mini-ospi-single.dts
new file mode 100644
index 00..11a8e8b136
--- /dev/null
+++ b/arch/arm/dts/versal-net-mini-ospi-single.dts
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Xilinx Versal NET OSPI single DTS
+ *
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
+ *
+ * Michal Simek 
+ * Ashok Reddy Soma 
+ */
+
+#include "versal-net-mini-ospi.dtsi"
+
+/ {
+   model = "Xilinx Versal NET MINI OSPI SINGLE";
+};
+
+ {
+   spi-rx-bus-width = <8>;
+};
diff --git a/arch/arm/dts/versal-net-mini-ospi.dtsi 
b/arch/arm/dts/versal-net-mini-ospi.dtsi
new file mode 100644
index 00..1fd8504d9a
--- /dev/null
+++ b/arch/arm/dts/versal-net-mini-ospi.dtsi
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Xilinx Versal NET Mini OSPI Configuration
+ *
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
+ *
+ * Michal Simek 
+ * Ashok Reddy Soma 
+ */
+
+/dts-v1/;
+
+/ {
+   compatible = "xlnx,versal-net-mini";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   model = "Xilinx Versal NET MINI OSPI";
+
+   aliases {
+   serial0 = 
+   spi0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200";
+   };
+
+   memory@bbf0 {
+   device_type = "memory";
+   reg = <0 0xBBF0 0 0x10>;
+   };
+
+   clk125: clk125 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <12500>;
+   };
+
+   dcc: dcc {
+   compatible = "arm,dcc";
+   status = "okay";
+   u-boot,dm-pre-reloc;
+   };
+
+   amba: amba {
+   u-boot,dm-pre-reloc;
+   compatible = "simple-bus";
+   #address-cells = <0x2>;
+   #size-cells = <0x2>;
+   ranges;
+
+   ospi: spi@f101 {
+   compatible = "cadence,qspi", "cdns,qspi-nor";
+   status = "okay";
+   reg = <0 0xf101 0 0x1>, <0 0xc000 0 
0x2000>;
+   clock-names = "ref_clk", "pclk";
+   clocks = <>, <>;
+   bus-num = <2>;
+   num-cs = <1>;
+   cdns,fifo-depth = <256>;
+   cdns,fifo-width = <4>;
+   cdns,is-dma = <1>;
+   cdns,is-stig-pgm = <1>;
+   cdns,trigger-address = <0xc000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   flash0: flash@0 {
+   compatible = "mt35xu02g", "micron,m25p80",
+"jedec,spi-nor";
+   reg = <0>;
+   spi-tx-bus-width = <8>;
+   spi-rx-bus-width = <8>;
+   spi-max-frequency = <2000>;
+   };
+   };
+   };
+};
diff --git a/configs/xilinx_versal_net_mini_ospi_defconfig 
b/configs/xilinx_versal_net_mini_ospi_defconfig
new file mode 100644
index 00..d11e180780
--- /dev/null
+++ b/configs/xilinx_versal_net_mini_ospi_defconfig
@@ -0,0 +1,71 @@
+CONFIG_ARM=y
+CONFIG_SYS_CONFIG_NAME="xilinx_versal_net_mini"
+CONFIG_COUNTER_FREQUENCY=1
+

[PATCH 1/3] xilinx: versal-net: Add mini qspi configuration

2023-06-14 Thread Ashok Reddy Soma
Add support for Versal NET mini Quad SPI flash configuration. This runs
from onchip memory, so it has to be compact. Hence only Quad SPI
related settings are enabled.

Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/dts/Makefile |  1 +
 arch/arm/dts/versal-net-mini-qspi-single.dts  | 16 
 arch/arm/dts/versal-net-mini-qspi.dtsi| 72 ++
 configs/xilinx_versal_net_mini_qspi_defconfig | 75 +++
 4 files changed, 164 insertions(+)
 create mode 100644 arch/arm/dts/versal-net-mini-qspi-single.dts
 create mode 100644 arch/arm/dts/versal-net-mini-qspi.dtsi
 create mode 100644 configs/xilinx_versal_net_mini_qspi_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 480269fa60..7b2fd0653b 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -413,6 +413,7 @@ dtb-$(CONFIG_ARCH_VERSAL) += \
xilinx-versal-virt.dtb
 dtb-$(CONFIG_ARCH_VERSAL_NET) += \
versal-net-mini.dtb \
+   versal-net-mini-qspi-single.dtb \
xilinx-versal-net-virt.dtb
 dtb-$(CONFIG_ARCH_ZYNQMP_R5) += \
zynqmp-r5.dtb
diff --git a/arch/arm/dts/versal-net-mini-qspi-single.dts 
b/arch/arm/dts/versal-net-mini-qspi-single.dts
new file mode 100644
index 00..fec1b514ed
--- /dev/null
+++ b/arch/arm/dts/versal-net-mini-qspi-single.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Xilinx Versal NET QSPI single DTS
+ *
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
+ */
+
+#include "versal-net-mini-qspi.dtsi"
+
+/ {
+   model = "Xilinx Versal NET MINI QSPI SINGLE";
+};
+
+ {
+   spi-rx-bus-width = <4>;
+};
diff --git a/arch/arm/dts/versal-net-mini-qspi.dtsi 
b/arch/arm/dts/versal-net-mini-qspi.dtsi
new file mode 100644
index 00..2c91d8
--- /dev/null
+++ b/arch/arm/dts/versal-net-mini-qspi.dtsi
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Xilinx Versal NET Mini QSPI Configuration
+ *
+ * (C) Copyright 2023, Advanced Micro Devices, Inc.
+ *
+ * Michal Simek 
+ * Ashok Reddy Soma 
+ */
+
+/dts-v1/;
+
+/ {
+   compatible = "xlnx,versal-net-mini";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   model = "Xilinx Versal NET MINI QSPI";
+
+   aliases {
+   serial0 = 
+   spi0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200";
+   };
+
+   memory@bbf0 {
+   device_type = "memory";
+   reg = <0 0xbbf0 0 0x10>;
+   };
+
+   clk150: clk150 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <15000>;
+   };
+
+   dcc: dcc {
+   compatible = "arm,dcc";
+   status = "okay";
+   u-boot,dm-pre-reloc;
+   };
+
+   amba: amba {
+   u-boot,dm-pre-reloc;
+   compatible = "simple-bus";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   qspi: spi@f103 {
+   compatible = "xlnx,versal-qspi-1.0";
+   status = "okay";
+   clock-names = "ref_clk", "pclk";
+   num-cs = <1>;
+   reg = <0 0xf103 0 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = <>, <>;
+
+   flash0: flash@0 {
+   compatible = "n25q512a", "micron,m25p80",
+"jedec,spi-nor";
+   reg = <0>;
+   spi-tx-bus-width = <4>;
+   spi-rx-bus-width = <4>;
+   spi-max-frequency = <2000>;
+   };
+   };
+   };
+};
diff --git a/configs/xilinx_versal_net_mini_qspi_defconfig 
b/configs/xilinx_versal_net_mini_qspi_defconfig
new file mode 100644
index 00..a7ebc38cda
--- /dev/null
+++ b/configs/xilinx_versal_net_mini_qspi_defconfig
@@ -0,0 +1,75 @@
+CONFIG_ARM=y
+CONFIG_SYS_CONFIG_NAME="xilinx_versal_net_mini"
+CONFIG_COUNTER_FREQUENCY=1
+CONFIG_ARCH_VERSAL_NET=y
+CONFIG_TEXT_BASE=0xBBF0
+CONFIG_SYS_MALLOC_LEN=0x2000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xBBF2
+CONFIG_SF_DEFAULT_SPEED=3000
+CONFIG_ENV_SIZE=0x80
+CONFIG_DEFAULT_DEVICE_TREE="versal-net-mini-qspi-single"
+CONFIG_SYS_PROMPT="Versal NET> "
+CONFIG_SYS_MEM_RSVD_FOR_MMU=y
+# CONFIG_PSCI_RESET is not set
+CONFIG_SYS_LOAD_ADDR=0x

[PATCH 0/3] Add Versal NET mini U-Boot configurations

2023-06-14 Thread Ashok Reddy Soma
In this patch series add support for Versal NET mini U-Boot
configurations for qspi, ospi and emmc flashes.



Ashok Reddy Soma (3):
  xilinx: versal-net: Add mini qspi configuration
  xilinx: versal-net: Add mini ospi configuration
  xilinx: versal-net: Add mini eMMC 5.1 configuration

 arch/arm/dts/Makefile |  3 +
 arch/arm/dts/versal-net-mini-emmc.dts | 64 +++
 arch/arm/dts/versal-net-mini-ospi-single.dts  | 19 +
 arch/arm/dts/versal-net-mini-ospi.dtsi| 78 +++
 arch/arm/dts/versal-net-mini-qspi-single.dts  | 16 
 arch/arm/dts/versal-net-mini-qspi.dtsi| 72 +
 configs/xilinx_versal_net_mini_emmc_defconfig | 63 +++
 configs/xilinx_versal_net_mini_ospi_defconfig | 71 +
 configs/xilinx_versal_net_mini_qspi_defconfig | 75 ++
 9 files changed, 461 insertions(+)
 create mode 100644 arch/arm/dts/versal-net-mini-emmc.dts
 create mode 100644 arch/arm/dts/versal-net-mini-ospi-single.dts
 create mode 100644 arch/arm/dts/versal-net-mini-ospi.dtsi
 create mode 100644 arch/arm/dts/versal-net-mini-qspi-single.dts
 create mode 100644 arch/arm/dts/versal-net-mini-qspi.dtsi
 create mode 100644 configs/xilinx_versal_net_mini_emmc_defconfig
 create mode 100644 configs/xilinx_versal_net_mini_ospi_defconfig
 create mode 100644 configs/xilinx_versal_net_mini_qspi_defconfig

-- 
2.17.1



[PATCH] cadence_qspi: Enable flash reset for Versal NET platform

2023-06-14 Thread Ashok Reddy Soma
Enable flash reset functionality for Versal NET platform.
In cadence_qspi.c there is weak function defined for reset, hence remove
the check for config, so that it will work for Versal and Versal NET
platforms.

Add register defines in Versal NET hardware.h for mini U-Boot flash
reset.

Add read_delay initialization for Versal NET also.

Signed-off-by: Ashok Reddy Soma 
---
 arch/arm/mach-versal-net/include/mach/hardware.h | 11 +++
 drivers/spi/cadence_ospi_versal.c|  3 +--
 drivers/spi/cadence_qspi.c   | 13 +
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-versal-net/include/mach/hardware.h 
b/arch/arm/mach-versal-net/include/mach/hardware.h
index 89b84a2efc..67b864101e 100644
--- a/arch/arm/mach-versal-net/include/mach/hardware.h
+++ b/arch/arm/mach-versal-net/include/mach/hardware.h
@@ -80,3 +80,14 @@ enum versal_net_platform {
 #define VERSAL_SLCR_BASEADDR   0xF106
 #define VERSAL_AXI_MUX_SEL (VERSAL_SLCR_BASEADDR + 0x504)
 #define VERSAL_OSPI_LINEAR_MODEBIT(1)
+
+#define FLASH_RESET_GPIO   0xc
+#define WPROT_CRP  0xF126001C
+#define RST_GPIO   0xF1260318
+#define WPROT_LPD_MIO  0xFF080728
+#define WPROT_PMC_MIO  0xF1060828
+#define BOOT_MODE_DIR  0xF1020204
+#define BOOT_MODE_OUT  0xF1020208
+#define MIO_PIN_12 0xF1060030
+#define BANK0_OUTPUT   0xF1020040
+#define BANK0_TRI  0xF1060200
diff --git a/drivers/spi/cadence_ospi_versal.c 
b/drivers/spi/cadence_ospi_versal.c
index 434c6038f3..a7685a2f51 100644
--- a/drivers/spi/cadence_ospi_versal.c
+++ b/drivers/spi/cadence_ospi_versal.c
@@ -130,7 +130,6 @@ int cadence_qspi_apb_wait_for_dma_cmplt(struct 
cadence_spi_priv *priv)
 #if defined(CONFIG_DM_GPIO)
 int cadence_qspi_versal_flash_reset(struct udevice *dev)
 {
-#ifndef CONFIG_ARCH_VERSAL_NET
struct gpio_desc gpio;
u32 reset_gpio;
int ret;
@@ -166,7 +165,7 @@ int cadence_qspi_versal_flash_reset(struct udevice *dev)
/* Set value 1 to pin */
dm_gpio_set_value(, 1);
udelay(1);
-#endif
+
return 0;
 }
 #else
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 2d715e478c..cc3a54f295 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -249,17 +249,14 @@ static int cadence_spi_probe(struct udevice *bus)
 
priv->wr_delay = 50 * DIV_ROUND_UP(NSEC_PER_SEC, priv->ref_clk_hz);
 
-   if (IS_ENABLED(CONFIG_ARCH_VERSAL)) {
-   /* Versal platform uses spi calibration to set read delay */
+   /* Versal and Versal-NET use spi calibration to set read delay */
+   if (CONFIG_IS_ENABLED(ARCH_VERSAL) ||
+   CONFIG_IS_ENABLED(ARCH_VERSAL_NET))
if (priv->read_delay >= 0)
priv->read_delay = -1;
-   /* Reset ospi flash device */
-   ret = cadence_qspi_versal_flash_reset(bus);
-   if (ret)
-   return ret;
-   }
 
-   return 0;
+   /* Reset ospi flash device */
+   return cadence_qspi_versal_flash_reset(bus);
 }
 
 static int cadence_spi_remove(struct udevice *dev)
-- 
2.17.1



[PATCH] arm64: versal-net: spi: Update boot sequence dynamically

2023-06-14 Thread Ashok Reddy Soma
Currently xspi0 is used for all spi boot modes, it means it will use "sf
probe 0 0 0" for all spi's irrespective of which node it is wired.

Get boot sequence from dev_seq() and update boot command for xspi
dynamically.

As a result bootcmd for spi is updated as below when two instances of spi
are present in DT node.
bootcmd_xspi0=devnum_xspi=0; run xspi_boot
bootcmd_xspi1=devnum_xspi=1; run xspi_boot

xspi_boot=sf probe $devnum_xspi:0 0 0 && sf read $scriptaddr
$script_offset_f $script_size_f && echo XSPI: Trying to boot script at
${scriptaddr} && source ${scriptaddr}; echo XSPI: SCRIPT FAILED:
continuing...;

Signed-off-by: Ashok Reddy Soma 
---

 board/xilinx/versal-net/board.c | 24 +---
 include/configs/xilinx_versal_net.h | 19 ---
 2 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
index 6595d6f3e8..00b01d9641 100644
--- a/board/xilinx/versal-net/board.c
+++ b/board/xilinx/versal-net/board.c
@@ -214,15 +214,33 @@ int board_late_init(void)
break;
case QSPI_MODE_24BIT:
puts("QSPI_MODE_24\n");
-   mode = "xspi0";
+   if (uclass_get_device_by_name(UCLASS_SPI,
+ "spi@f103", )) {
+   puts("Boot from QSPI but without QSPI enabled!\n");
+   return -1;
+   }
+   mode = "xspi";
+   bootseq = dev_seq(dev);
break;
case QSPI_MODE_32BIT:
puts("QSPI_MODE_32\n");
-   mode = "xspi0";
+   if (uclass_get_device_by_name(UCLASS_SPI,
+ "spi@f103", )) {
+   puts("Boot from QSPI but without QSPI enabled!\n");
+   return -1;
+   }
+   mode = "xspi";
+   bootseq = dev_seq(dev);
break;
case OSPI_MODE:
puts("OSPI_MODE\n");
-   mode = "xspi0";
+   if (uclass_get_device_by_name(UCLASS_SPI,
+ "spi@f101", )) {
+   puts("Boot from OSPI but without OSPI enabled!\n");
+   return -1;
+   }
+   mode = "xspi";
+   bootseq = dev_seq(dev);
break;
case EMMC_MODE:
puts("EMMC_MODE\n");
diff --git a/include/configs/xilinx_versal_net.h 
b/include/configs/xilinx_versal_net.h
index 424ead038e..613cce46f9 100644
--- a/include/configs/xilinx_versal_net.h
+++ b/include/configs/xilinx_versal_net.h
@@ -76,20 +76,24 @@
 # define BOOT_TARGET_DEVICES_DHCP(func)
 #endif
 
-#if defined(CONFIG_ZYNQMP_GQSPI) || defined(CONFIG_CADENCE_OSPI_VERSAL_NET)
-# define BOOT_TARGET_DEVICES_XSPI(func)func(XSPI, xspi, 0)
+#if defined(CONFIG_ZYNQMP_GQSPI) || defined(CONFIG_CADENCE_OSPI_VERSAL)
+# define BOOT_TARGET_DEVICES_XSPI(func)func(XSPI, xspi, 0) func(XSPI, 
xspi, 1)
+# define BOOTENV_DEV_SHARED_XSPI \
+   "xspi_boot=sf probe $devnum_xspi:0 0 0 && " \
+   "sf read $scriptaddr $script_offset_f $script_size_f && " \
+   "echo XSPI: Trying to boot script at ${scriptaddr} && " \
+   "source ${scriptaddr}; echo XSPI: SCRIPT FAILED: continuing...;\0"
 #else
 # define BOOT_TARGET_DEVICES_XSPI(func)
+# define BOOTENV_DEV_SHARED_XSPI
 #endif
 
 #define BOOTENV_DEV_XSPI(devtypeu, devtypel, instance) \
-   "bootcmd_xspi0=sf probe 0 0 0 && " \
-   "sf read $scriptaddr $script_offset_f $script_size_f && " \
-   "echo XSPI: Trying to boot script at ${scriptaddr} && " \
-   "source ${scriptaddr}; echo XSPI: SCRIPT FAILED: continuing...;\0"
+   "bootcmd_" #devtypel #instance "=" \
+   "devnum_xspi=" #instance "; run " #devtypel "_boot\0" \
 
 #define BOOTENV_DEV_NAME_XSPI(devtypeu, devtypel, instance) \
-   "xspi0 "
+   ""
 
 #define BOOT_TARGET_DEVICES_JTAG(func) func(JTAG, jtag, na)
 
@@ -127,6 +131,7 @@
 #define CFG_EXTRA_ENV_SETTINGS \
ENV_MEM_LAYOUT_SETTINGS \
BOOTENV \
+   BOOTENV_DEV_SHARED_XSPI \
DFU_ALT_INFO
 #endif
 
-- 
2.17.1



[PATCH v2 4/6] mtd: nand: zynq_nand: Change datatype of status and ecc_status to int

2023-06-14 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

status and ecc_status are of unsigned type where they are compared for
negative value. This is pointed by below sparse warning. Change datatype
to int to fix this.
warning: comparison of unsigned expression in '< 0' is always false
[-Wtype-limits]

Signed-off-by: Algapally Santosh Sagar 
Reviewed-by: Michael Trimarchi 
Signed-off-by: Ashok Reddy Soma 
---

(no changes since v1)

 drivers/mtd/nand/raw/zynq_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c
index 9e3ee7412d..545fdd7b69 100644
--- a/drivers/mtd/nand/raw/zynq_nand.c
+++ b/drivers/mtd/nand/raw/zynq_nand.c
@@ -285,7 +285,7 @@ static int zynq_nand_init_nand_flash(struct mtd_info *mtd, 
int option)
 {
struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct nand_drv *smc = nand_get_controller_data(nand_chip);
-   u32 status;
+   int status;
 
/* disable interrupts */
writel(ZYNQ_NAND_CLR_CONFIG, >reg->cfr);
@@ -332,7 +332,7 @@ static int zynq_nand_calculate_hwecc(struct mtd_info *mtd, 
const u8 *data,
struct nand_drv *smc = nand_get_controller_data(nand_chip);
u32 ecc_value = 0;
u8 ecc_reg, ecc_byte;
-   u32 ecc_status;
+   int ecc_status;
 
/* Wait till the ECC operation is complete */
ecc_status = zynq_nand_waitfor_ecc_completion(mtd);
-- 
2.17.1



[PATCH v2 6/6] xilinx: zynq: Add the missing function prototypes

2023-06-14 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add the missing prototypes for the functions pointed by the below
sparse warnings
warning: no previous prototype for 'set_dfu_alt_info'
[-Wmissing-prototypes]
warning: no previous prototype for 'board_debug_uart_init'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

(no changes since v1)

 board/xilinx/zynq/board.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 9a59445b44..3b6581e304 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -5,6 +5,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.17.1



[PATCH v2 5/6] arm: zynq: Pass the missing argument type in function definition

2023-06-14 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Pass missing argument type in the function definition to fix the
sparse warning, warning: old-style function definition
[-Wold-style-definition]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Added argument void in below files to fix warning
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c
board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c
board/xilinx/zynq/zynq-zed/ps7_init_gpl.c

 board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c | 4 ++--
 board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c| 4 ++--
 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c| 4 ++--
 board/xilinx/zynq/zynq-zed/ps7_init_gpl.c  | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c 
b/board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c
index c2a6f9199a..602a789e77 100644
--- a/board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c
+++ b/board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c
@@ -12408,7 +12408,7 @@ unsigned long *ps7_ddr_init_data = 
ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12427,7 +12427,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
diff --git a/board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c 
b/board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c
index fd102a3ce4..9343683f4d 100644
--- a/board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c
+++ b/board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c
@@ -12741,7 +12741,7 @@ unsigned long *ps7_ddr_init_data = 
ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12760,7 +12760,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
diff --git a/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c 
b/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c
index 796e5b0c5f..6b153aa379 100644
--- a/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c
+++ b/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c
@@ -12648,7 +12648,7 @@ unsigned long *ps7_ddr_init_data = 
ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12667,7 +12667,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
diff --git a/board/xilinx/zynq/zynq-zed/ps7_init_gpl.c 
b/board/xilinx/zynq/zynq-zed/ps7_init_gpl.c
index baf89a5800..6f2edf16c2 100644
--- a/board/xilinx/zynq/zynq-zed/ps7_init_gpl.c
+++ b/board/xilinx/zynq/zynq-zed/ps7_init_gpl.c
@@ -12306,7 +12306,7 @@ unsigned long *ps7_ddr_init_data = 
ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12325,7 +12325,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
-- 
2.17.1



[PATCH v2 3/6] spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op

2023-06-14 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynq_qspi_mem_exec_op' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

(no changes since v1)

 drivers/spi/zynq_qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index d1d4048966..cb52c0f307 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -747,8 +747,8 @@ static int zynq_qspi_check_buswidth(struct spi_slave 
*slave, u8 width)
return -EOPNOTSUPP;
 }
 
-bool zynq_qspi_mem_exec_op(struct spi_slave *slave,
-  const struct spi_mem_op *op)
+static bool zynq_qspi_mem_exec_op(struct spi_slave *slave,
+ const struct spi_mem_op *op)
 {
if (zynq_qspi_check_buswidth(slave, op->cmd.buswidth))
return false;
-- 
2.17.1



[PATCH v2 1/6] spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op

2023-06-14 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the below sparse warning
warning: no previous prototype for 'xilinx_qspi_mem_exec_op'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

(no changes since v1)

 drivers/spi/xilinx_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 33575fe757..b58a3f632a 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -363,8 +363,8 @@ static int xilinx_qspi_check_buswidth(struct spi_slave 
*slave, u8 width)
return -EOPNOTSUPP;
 }
 
-bool xilinx_qspi_mem_exec_op(struct spi_slave *slave,
-const struct spi_mem_op *op)
+static bool xilinx_qspi_mem_exec_op(struct spi_slave *slave,
+   const struct spi_mem_op *op)
 {
if (xilinx_qspi_check_buswidth(slave, op->cmd.buswidth))
return false;
-- 
2.17.1



[PATCH v2 2/6] xilinx: zynq: Add missing prototype for zynqmp_mmio_write

2023-06-14 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Move prototype declaration from sys_proto.h to include/zynqmp_firmware.h

 include/zynqmp_firmware.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h
index f7a4a39d35..3cbd91e216 100644
--- a/include/zynqmp_firmware.h
+++ b/include/zynqmp_firmware.h
@@ -454,6 +454,7 @@ int zynqmp_pm_set_sd_config(u32 node, enum 
pm_sd_config_type config, u32 value);
 int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config,
 u32 value);
 int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id);
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
 
 /* Type of Config Object */
 #define PM_CONFIG_OBJECT_TYPE_BASE 0x1U
-- 
2.17.1



[PATCH v2 0/6] Fix sparse warnings in zynq platform

2023-06-14 Thread Ashok Reddy Soma
Fix below sparse warnings
 - Add missing prototype for zynqmp_mmio_write
 - Add missing prototype for zynq_qspi_mem_exec_op
 - Change datatype of status and ecc_status from u32 to int
 - Pass the missing argument type in function definition
 - Add the missing function prototypes
 - Add missing prototype for xilinx_qspi_mem_exec_op


Changes in v2:
 - Move prototype declaration from sys_proto.h to include/zynqmp_firmware.h
 - Added argument void in below files to fix warning
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c
board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c
board/xilinx/zynq/zynq-zed/ps7_init_gpl.c

Algapally Santosh Sagar (6):
  spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op
  xilinx: zynq: Add missing prototype for zynqmp_mmio_write
  spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op
  mtd: nand: zynq_nand: Change datatype of status and ecc_status to int
  arm: zynq: Pass the missing argument type in function definition
  xilinx: zynq: Add the missing function prototypes

 board/xilinx/zynq/board.c  | 2 ++
 board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c | 4 ++--
 board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c| 4 ++--
 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c| 4 ++--
 board/xilinx/zynq/zynq-zed/ps7_init_gpl.c  | 4 ++--
 drivers/mtd/nand/raw/zynq_nand.c   | 4 ++--
 drivers/spi/xilinx_spi.c   | 4 ++--
 drivers/spi/zynq_qspi.c| 4 ++--
 include/zynqmp_firmware.h  | 1 +
 9 files changed, 17 insertions(+), 14 deletions(-)

-- 
2.17.1



[PATCH 6/6] xilinx: zynq: Add the missing function prototypes

2023-06-09 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add the missing prototypes for the functions pointed by the below
sparse warnings
warning: no previous prototype for 'set_dfu_alt_info'
[-Wmissing-prototypes]
warning: no previous prototype for 'board_debug_uart_init'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 board/xilinx/zynq/board.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 9a59445b44..3b6581e304 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -5,6 +5,8 @@
  */
 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
-- 
2.17.1



[PATCH 5/6] arm: zynq: Pass the missing argument type in function definition

2023-06-09 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Pass missing argument type in the function definition to fix the
sparse warning, warning: old-style function definition
[-Wold-style-definition]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c 
b/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c
index 796e5b0c5f..6b153aa379 100644
--- a/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c
+++ b/board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c
@@ -12648,7 +12648,7 @@ unsigned long *ps7_ddr_init_data = 
ps7_ddr_init_data_3_0;
 unsigned long *ps7_peripherals_init_data = ps7_peripherals_init_data_3_0;
 
 int
-ps7_post_config()
+ps7_post_config(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
@@ -12667,7 +12667,7 @@ ps7_post_config()
 }
 
 int
-ps7_init()
+ps7_init(void)
 {
   // Get the PS_VERSION on run time
   unsigned long si_ver = ps7GetSiliconVersion ();
-- 
2.17.1



[PATCH 4/6] mtd: nand: zynq_nand: Change datatype of status and ecc_status to int

2023-06-09 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

status and ecc_status are of unsigned type where they are compared for
negative value. This is pointed by below sparse warning. Change datatype
to int to fix this.
warning: comparison of unsigned expression in '< 0' is always false
[-Wtype-limits]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 drivers/mtd/nand/raw/zynq_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c
index 9e3ee7412d..545fdd7b69 100644
--- a/drivers/mtd/nand/raw/zynq_nand.c
+++ b/drivers/mtd/nand/raw/zynq_nand.c
@@ -285,7 +285,7 @@ static int zynq_nand_init_nand_flash(struct mtd_info *mtd, 
int option)
 {
struct nand_chip *nand_chip = mtd_to_nand(mtd);
struct nand_drv *smc = nand_get_controller_data(nand_chip);
-   u32 status;
+   int status;
 
/* disable interrupts */
writel(ZYNQ_NAND_CLR_CONFIG, >reg->cfr);
@@ -332,7 +332,7 @@ static int zynq_nand_calculate_hwecc(struct mtd_info *mtd, 
const u8 *data,
struct nand_drv *smc = nand_get_controller_data(nand_chip);
u32 ecc_value = 0;
u8 ecc_reg, ecc_byte;
-   u32 ecc_status;
+   int ecc_status;
 
/* Wait till the ECC operation is complete */
ecc_status = zynq_nand_waitfor_ecc_completion(mtd);
-- 
2.17.1



[PATCH 3/6] spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op

2023-06-09 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynq_qspi_mem_exec_op' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 drivers/spi/zynq_qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index d1d4048966..cb52c0f307 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -747,8 +747,8 @@ static int zynq_qspi_check_buswidth(struct spi_slave 
*slave, u8 width)
return -EOPNOTSUPP;
 }
 
-bool zynq_qspi_mem_exec_op(struct spi_slave *slave,
-  const struct spi_mem_op *op)
+static bool zynq_qspi_mem_exec_op(struct spi_slave *slave,
+ const struct spi_mem_op *op)
 {
if (zynq_qspi_check_buswidth(slave, op->cmd.buswidth))
return false;
-- 
2.17.1



[PATCH 2/6] xilinx: zynq: Add missing prototype for zynqmp_mmio_write

2023-06-09 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/mach-zynq/include/mach/sys_proto.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-zynq/include/mach/sys_proto.h 
b/arch/arm/mach-zynq/include/mach/sys_proto.h
index 268ec50ad8..74f9665fbb 100644
--- a/arch/arm/mach-zynq/include/mach/sys_proto.h
+++ b/arch/arm/mach-zynq/include/mach/sys_proto.h
@@ -16,5 +16,6 @@ extern u32 zynq_slcr_get_idcode(void);
 extern int zynq_slcr_get_mio_pin_status(const char *periph);
 extern void zynq_ddrc_init(void);
 extern unsigned int zynq_get_silicon_version(void);
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
 
 #endif /* _SYS_PROTO_H_ */
-- 
2.17.1



[PATCH 1/6] spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op

2023-06-09 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the below sparse warning
warning: no previous prototype for 'xilinx_qspi_mem_exec_op'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 drivers/spi/xilinx_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 33575fe757..b58a3f632a 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -363,8 +363,8 @@ static int xilinx_qspi_check_buswidth(struct spi_slave 
*slave, u8 width)
return -EOPNOTSUPP;
 }
 
-bool xilinx_qspi_mem_exec_op(struct spi_slave *slave,
-const struct spi_mem_op *op)
+static bool xilinx_qspi_mem_exec_op(struct spi_slave *slave,
+   const struct spi_mem_op *op)
 {
if (xilinx_qspi_check_buswidth(slave, op->cmd.buswidth))
return false;
-- 
2.17.1



[PATCH 0/6] Fix sparse warnings in zynq platform

2023-06-09 Thread Ashok Reddy Soma
Fix below sparse warnings
 - Add missing prototype for zynqmp_mmio_write
 - Add missing prototype for zynq_qspi_mem_exec_op
 - Change datatype of status and ecc_status from u32 to int
 - Pass the missing argument type in function definition
 - Add the missing function prototypes
 - Add missing prototype for xilinx_qspi_mem_exec_op



Algapally Santosh Sagar (6):
  spi: xilinx_spi: Add missing prototype for xilinx_qspi_mem_exec_op
  xilinx: zynq: Add missing prototype for zynqmp_mmio_write
  spi: zynq_qspi: Add missing prototype for zynq_qspi_mem_exec_op
  mtd: nand: zynq_nand: Change datatype of status and ecc_status to int
  arm: zynq: Pass the missing argument type in function definition
  xilinx: zynq: Add the missing function prototypes

 arch/arm/mach-zynq/include/mach/sys_proto.h | 1 +
 board/xilinx/zynq/board.c   | 2 ++
 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 4 ++--
 drivers/mtd/nand/raw/zynq_nand.c| 4 ++--
 drivers/spi/xilinx_spi.c| 4 ++--
 drivers/spi/zynq_qspi.c | 4 ++--
 6 files changed, 11 insertions(+), 8 deletions(-)

-- 
2.17.1



[PATCH 2/2] arm64: versal: Add missing prototypes

2023-06-09 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototypes to fix the below sparse warnings
1. warning: no previous prototype for 'set_r5_halt_mode'
[-Wmissing-prototypes]
2. warning: no previous prototype for 'set_r5_tcm_mode'
[-Wmissing-prototypes]
3. warning: no previous prototype for 'release_r5_reset'
[-Wmissing-prototypes]
4.warning: no previous prototype for 'enable_clock_r5'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/mach-versal/mp.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-versal/mp.c b/arch/arm/mach-versal/mp.c
index 9b0518d6a2..5b850f3f89 100644
--- a/arch/arm/mach-versal/mp.c
+++ b/arch/arm/mach-versal/mp.c
@@ -23,7 +23,7 @@
 #define VERSAL_CRL_RST_CPU_R5_RESET_PGE_MASK   0x10
 #define VERSAL_CRLAPB_CPU_R5_CTRL_CLKACT_MASK  0x100
 
-void set_r5_halt_mode(u8 halt, u8 mode)
+static void set_r5_halt_mode(u8 halt, u8 mode)
 {
u32 tmp;
 
@@ -44,7 +44,7 @@ void set_r5_halt_mode(u8 halt, u8 mode)
}
 }
 
-void set_r5_tcm_mode(u8 mode)
+static void set_r5_tcm_mode(u8 mode)
 {
u32 tmp;
 
@@ -62,7 +62,7 @@ void set_r5_tcm_mode(u8 mode)
writel(tmp, _base->rpu_glbl_ctrl);
 }
 
-void release_r5_reset(u8 mode)
+static void release_r5_reset(u8 mode)
 {
u32 tmp;
 
@@ -77,7 +77,7 @@ void release_r5_reset(u8 mode)
writel(tmp, _base->rst_cpu_r5);
 }
 
-void enable_clock_r5(void)
+static void enable_clock_r5(void)
 {
u32 tmp;
 
-- 
2.17.1



[PATCH 1/2] arm64: versal: Add missing prototype for initialize_tcm

2023-06-09 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add the missing prototype pointed by below sparse warning
warning: no previous prototype for 'initialize_tcm'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/mach-versal/include/mach/sys_proto.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-versal/include/mach/sys_proto.h 
b/arch/arm/mach-versal/include/mach/sys_proto.h
index 3f01508ecb..433f9ba07c 100644
--- a/arch/arm/mach-versal/include/mach/sys_proto.h
+++ b/arch/arm/mach-versal/include/mach/sys_proto.h
@@ -10,6 +10,7 @@ enum {
TCM_SPLIT,
 };
 
+void initialize_tcm(bool mode);
 void tcm_init(u8 mode);
 void mem_map_fill(void);
 
-- 
2.17.1



[PATCH 0/2] Fix sparse warnings

2023-06-09 Thread Ashok Reddy Soma
In this patch series, fix sparse warnings in below files
 - arch/arm/mach-versal/mp.c
 - arch/arm/mach-versal/include/mach/sys_proto.h



Algapally Santosh Sagar (2):
  arm64: versal: Add missing prototype for initialize_tcm
  arm64: versal: Add missing prototypes

 arch/arm/mach-versal/include/mach/sys_proto.h | 1 +
 arch/arm/mach-versal/mp.c | 8 
 2 files changed, 5 insertions(+), 4 deletions(-)

-- 
2.17.1



[PATCH] board: xilinx: Add missing prototypes

2023-05-22 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototypes to fix the below sparse warnings
1. warning: no previous prototype for 'soc_name_decode'
[-Wmissing-prototypes]
2. warning: no previous prototype for 'soc_detection'
[-Wmissing-prototypes]
3. warning: no previous prototype for 'board_name_decode'
[-Wmissing-prototypes]
4. warning: no previous prototype for 'board_detection'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 board/xilinx/common/board.h | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/board/xilinx/common/board.h b/board/xilinx/common/board.h
index 69e642429b..922c9d557a 100644
--- a/board/xilinx/common/board.h
+++ b/board/xilinx/common/board.h
@@ -11,4 +11,11 @@ int board_late_init_xilinx(void);
 
 int xilinx_read_eeprom(void);
 
+char *board_name_decode(void);
+
+bool board_detection(void);
+
+char *soc_name_decode(void);
+
+bool soc_detection(void);
 #endif /* BOARD_XILINX_COMMON_BOARD_H */
-- 
2.17.1



[PATCH v2] arm64: versal-net: Detect and display bootmode

2023-05-16 Thread Ashok Reddy Soma
Read boodmode register using versal_net_get_bootmode() in board_late_init
and prepare corresponding distro boot command sequence based on it.

versal_net_get_bootmode() will be changed to use smc calls later, but
for now directly reads the register.

Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
- Remove check for mmc/sdhci node enabled or not in EMMC bootmode
- Remove check for sdhci node enabled or not in SD0 and SD1 bootmode

 .../mach-versal-net/include/mach/hardware.h   |  21 
 board/xilinx/versal-net/board.c   | 114 ++
 2 files changed, 135 insertions(+)

diff --git a/arch/arm/mach-versal-net/include/mach/hardware.h 
b/arch/arm/mach-versal-net/include/mach/hardware.h
index c5e4e22040..89b84a2efc 100644
--- a/arch/arm/mach-versal-net/include/mach/hardware.h
+++ b/arch/arm/mach-versal-net/include/mach/hardware.h
@@ -27,7 +27,13 @@ struct iou_scntrs_regs {
u32 base_frequency_id_register; /* 0x20 */
 };
 
+struct crp_regs {
+   u32 reserved0[128];
+   u32 boot_mode_usr;  /* 0x200 */
+};
+
 #define VERSAL_NET_CRL_APB_BASEADDR0xEB5E
+#define VERSAL_NET_CRP_BASEADDR0xF126
 #define VERSAL_NET_IOU_SCNTR_SECURE0xEC92
 
 #define CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT  BIT(25)
@@ -36,6 +42,7 @@ struct iou_scntrs_regs {
 #define IOU_SCNTRS_CONTROL_EN  1
 
 #define crlapb_base ((struct crlapb_regs *)VERSAL_NET_CRL_APB_BASEADDR)
+#define crp_base ((struct crp_regs *)VERSAL_NET_CRP_BASEADDR)
 #define iou_scntr_secure ((struct iou_scntrs_regs 
*)VERSAL_NET_IOU_SCNTR_SECURE)
 
 #define PMC_TAP0xF11A
@@ -49,6 +56,20 @@ struct iou_scntrs_regs {
 # define PLATFORM_VERSION_MASK GENMASK(31, 28)
 #define PMC_TAP_USERCODE   (PMC_TAP + 0x8)
 
+/* Bootmode setting values */
+#define BOOT_MODES_MASK0x000F
+#define QSPI_MODE_24BIT0x0001
+#define QSPI_MODE_32BIT0x0002
+#define SD_MODE0x0003 /* sd 0 */
+#define SD_MODE1   0x0005 /* sd 1 */
+#define EMMC_MODE  0x0006
+#define USB_MODE   0x0007
+#define OSPI_MODE  0x0008
+#define SD1_LSHFT_MODE 0x000E /* SD1 Level shifter */
+#define JTAG_MODE  0x
+#define BOOT_MODE_USE_ALT  0x100
+#define BOOT_MODE_ALT_SHIFT12
+
 enum versal_net_platform {
VERSAL_NET_SILICON = 0,
VERSAL_NET_SPP = 1,
diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
index 6724c7290f..6595d6f3e8 100644
--- a/board/xilinx/versal-net/board.c
+++ b/board/xilinx/versal-net/board.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -165,8 +166,32 @@ int board_early_init_r(void)
return 0;
 }
 
+static u8 versal_net_get_bootmode(void)
+{
+   u8 bootmode;
+   u32 reg = 0;
+
+   reg = readl(_base->boot_mode_usr);
+
+   if (reg >> BOOT_MODE_ALT_SHIFT)
+   reg >>= BOOT_MODE_ALT_SHIFT;
+
+   bootmode = reg & BOOT_MODES_MASK;
+
+   return bootmode;
+}
+
 int board_late_init(void)
 {
+   u8 bootmode;
+   struct udevice *dev;
+   int bootseq = -1;
+   int bootseq_len = 0;
+   int env_targets_len = 0;
+   const char *mode;
+   char *new_targets;
+   char *env_targets;
+
if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
debug("Saved variables - Skipping\n");
return 0;
@@ -175,6 +200,95 @@ int board_late_init(void)
if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG))
return 0;
 
+   bootmode = versal_net_get_bootmode();
+
+   puts("Bootmode: ");
+   switch (bootmode) {
+   case USB_MODE:
+   puts("USB_MODE\n");
+   mode = "usb_dfu0 usb_dfu1";
+   break;
+   case JTAG_MODE:
+   puts("JTAG_MODE\n");
+   mode = "jtag pxe dhcp";
+   break;
+   case QSPI_MODE_24BIT:
+   puts("QSPI_MODE_24\n");
+   mode = "xspi0";
+   break;
+   case QSPI_MODE_32BIT:
+   puts("QSPI_MODE_32\n");
+   mode = "xspi0";
+   break;
+   case OSPI_MODE:
+   puts("OSPI_MODE\n");
+   mode = "xspi0";
+   break;
+   case EMMC_MODE:
+   puts("EMMC_MODE\n");
+   mode = "mmc";
+   bootseq = dev_seq(dev);
+   break;
+   case SD_MODE:
+   puts("SD_MODE\n");
+   if (uclass_get_device_by_name(UCLASS_MMC,
+ "mmc@f104", )) {
+   puts("Boot from SD0 but without SD0 enabled!\n");
+   return -1;
+   }
+

[PATCH v3] cmd: sf/nand: Print and return failure when 0 length is passed

2023-05-16 Thread Ashok Reddy Soma
For sf commands, when '0' length is passed for erase, update, write or
read, there might be undesired results. Ideally '0' length means nothing to
do.

So print 'ERROR: Invalid size 0' and return cmd failure when length '0' is
passed to sf commands. Same thing applies for nand commands also.

Example:

ZynqMP> sf erase 0 0
ERROR: Invalid size 0
ZynqMP> sf write 1 0 0
ERROR: Invalid size 0
ZynqMP> sf read 1 0 0
ERROR: Invalid size 0
ZynqMP> sf update 1000 1 0
ERROR: Invalid size 0
ZynqMP>

Signed-off-by: Ashok Reddy Soma 
---

Changes in v3:
 - Change printf to debug as it is too verbose

Changes in v2:
 - Changed print from 'size is 0' to Invalid size 0 without quites.
 - Modified description to be imperative
 - Fixed typo in description from "samething" to "same thing"

 cmd/legacy-mtd-utils.c | 5 +
 cmd/sf.c   | 5 +
 2 files changed, 10 insertions(+)

diff --git a/cmd/legacy-mtd-utils.c b/cmd/legacy-mtd-utils.c
index ac7139f84d..5903a90fe5 100644
--- a/cmd/legacy-mtd-utils.c
+++ b/cmd/legacy-mtd-utils.c
@@ -88,6 +88,11 @@ int mtd_arg_off_size(int argc, char *const argv[], int *idx, 
loff_t *off,
return -1;
}
 
+   if (*size == 0) {
+   debug("ERROR: Invalid size 0\n");
+   return -1;
+   }
+
 print:
printf("device %d ", *idx);
if (*size == chipsize)
diff --git a/cmd/sf.c b/cmd/sf.c
index 11b9c25896..55bef2f769 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -353,6 +353,11 @@ static int do_spi_flash_erase(int argc, char *const argv[])
if (ret != 1)
return CMD_RET_USAGE;
 
+   if (size == 0) {
+   debug("ERROR: Invalid size 0\n");
+   return CMD_RET_FAILURE;
+   }
+
/* Consistency checking */
if (offset + size > flash->size) {
printf("ERROR: attempting %s past flash size (%#x)\n",
-- 
2.17.1



[PATCH] arm64: versal-net: Detect and display bootmode

2023-05-09 Thread Ashok Reddy Soma
Read boodmode register using versal_net_get_bootmode() in board_late_init
and prepare corresponding distro boot command sequence based on it.

versal_net_get_bootmode() will be changed to use smc calls later, but
for now directly reads the register.

Signed-off-by: Ashok Reddy Soma 
---

 .../mach-versal-net/include/mach/hardware.h   |  21 +++
 board/xilinx/versal-net/board.c   | 126 ++
 2 files changed, 147 insertions(+)

diff --git a/arch/arm/mach-versal-net/include/mach/hardware.h 
b/arch/arm/mach-versal-net/include/mach/hardware.h
index c5e4e22040..89b84a2efc 100644
--- a/arch/arm/mach-versal-net/include/mach/hardware.h
+++ b/arch/arm/mach-versal-net/include/mach/hardware.h
@@ -27,7 +27,13 @@ struct iou_scntrs_regs {
u32 base_frequency_id_register; /* 0x20 */
 };
 
+struct crp_regs {
+   u32 reserved0[128];
+   u32 boot_mode_usr;  /* 0x200 */
+};
+
 #define VERSAL_NET_CRL_APB_BASEADDR0xEB5E
+#define VERSAL_NET_CRP_BASEADDR0xF126
 #define VERSAL_NET_IOU_SCNTR_SECURE0xEC92
 
 #define CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT  BIT(25)
@@ -36,6 +42,7 @@ struct iou_scntrs_regs {
 #define IOU_SCNTRS_CONTROL_EN  1
 
 #define crlapb_base ((struct crlapb_regs *)VERSAL_NET_CRL_APB_BASEADDR)
+#define crp_base ((struct crp_regs *)VERSAL_NET_CRP_BASEADDR)
 #define iou_scntr_secure ((struct iou_scntrs_regs 
*)VERSAL_NET_IOU_SCNTR_SECURE)
 
 #define PMC_TAP0xF11A
@@ -49,6 +56,20 @@ struct iou_scntrs_regs {
 # define PLATFORM_VERSION_MASK GENMASK(31, 28)
 #define PMC_TAP_USERCODE   (PMC_TAP + 0x8)
 
+/* Bootmode setting values */
+#define BOOT_MODES_MASK0x000F
+#define QSPI_MODE_24BIT0x0001
+#define QSPI_MODE_32BIT0x0002
+#define SD_MODE0x0003 /* sd 0 */
+#define SD_MODE1   0x0005 /* sd 1 */
+#define EMMC_MODE  0x0006
+#define USB_MODE   0x0007
+#define OSPI_MODE  0x0008
+#define SD1_LSHFT_MODE 0x000E /* SD1 Level shifter */
+#define JTAG_MODE  0x
+#define BOOT_MODE_USE_ALT  0x100
+#define BOOT_MODE_ALT_SHIFT12
+
 enum versal_net_platform {
VERSAL_NET_SILICON = 0,
VERSAL_NET_SPP = 1,
diff --git a/board/xilinx/versal-net/board.c b/board/xilinx/versal-net/board.c
index 6724c7290f..c83f1c0682 100644
--- a/board/xilinx/versal-net/board.c
+++ b/board/xilinx/versal-net/board.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -165,8 +166,32 @@ int board_early_init_r(void)
return 0;
 }
 
+static u8 versal_net_get_bootmode(void)
+{
+   u8 bootmode;
+   u32 reg = 0;
+
+   reg = readl(_base->boot_mode_usr);
+
+   if (reg >> BOOT_MODE_ALT_SHIFT)
+   reg >>= BOOT_MODE_ALT_SHIFT;
+
+   bootmode = reg & BOOT_MODES_MASK;
+
+   return bootmode;
+}
+
 int board_late_init(void)
 {
+   u8 bootmode;
+   struct udevice *dev;
+   int bootseq = -1;
+   int bootseq_len = 0;
+   int env_targets_len = 0;
+   const char *mode;
+   char *new_targets;
+   char *env_targets;
+
if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
debug("Saved variables - Skipping\n");
return 0;
@@ -175,6 +200,107 @@ int board_late_init(void)
if (!IS_ENABLED(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG))
return 0;
 
+   bootmode = versal_net_get_bootmode();
+
+   puts("Bootmode: ");
+   switch (bootmode) {
+   case USB_MODE:
+   puts("USB_MODE\n");
+   mode = "usb_dfu0 usb_dfu1";
+   break;
+   case JTAG_MODE:
+   puts("JTAG_MODE\n");
+   mode = "jtag pxe dhcp";
+   break;
+   case QSPI_MODE_24BIT:
+   puts("QSPI_MODE_24\n");
+   mode = "xspi0";
+   break;
+   case QSPI_MODE_32BIT:
+   puts("QSPI_MODE_32\n");
+   mode = "xspi0";
+   break;
+   case OSPI_MODE:
+   puts("OSPI_MODE\n");
+   mode = "xspi0";
+   break;
+   case EMMC_MODE:
+   puts("EMMC_MODE\n");
+   if (uclass_get_device_by_name(UCLASS_MMC,
+ "mmc@f105", ) &&
+   uclass_get_device_by_name(UCLASS_MMC,
+ "sdhci@f105", )) {
+   puts("Boot from EMMC but without SD1 enabled!\n");
+   return -1;
+   }
+   debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev));
+   mode = "mmc";
+   bootseq

[PATCH v2 2/2] .mailmap: Map all Xilinx users mail ids to AMD

2023-04-26 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

The mail ids of all the current Xilinx users are to be mapped to AMD
following the merger with AMD. The mailmap file is updated accordingly.

The ids of Marek Behún and Michal Simek are taken as reference.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Updated the missing mailids
 - Removed the space after mail id
 - Added closing brace for Vikhyat Goyal email id

 .mailmap | 55 ---
 1 file changed, 52 insertions(+), 3 deletions(-)

diff --git a/.mailmap b/.mailmap
index 80076f7206..312a428dc9 100644
--- a/.mailmap
+++ b/.mailmap
@@ -17,27 +17,47 @@
 
 Alexander Graf  
 Allen Martin 
+Amanda Baze  
+Amit Kumar Mahapatra  

 Andreas Bießmann 
 Andreas Bießmann 
 Aneesh V 
 Anup Patel  
+Anurag Kumar Vulisha  

+Appana Durga Kedareswara rao  

+Ashok Reddy Soma  
 Atish Patra  
+Bharat Kumar Gogada  

+Bharat Kumar Gogada  
+Bhargava Sreekantappa Gayathri  

 Bin Meng  
 Boris Brezillon  
 Boris Brezillon  
+Christian Kohn  
 Dirk Behme 
+Durga Challa  
 Eugen Hristev  
 Fabio Estevam 
+Harini Katakam  
+Harsha  
 Heinrich Schuchardt  
 Heinrich Schuchardt  xypron.g...@gmx.de 

+Ibai Erkiaga  
 Igor Opaniuk  
 Igor Opaniuk  
+Izhar Ameer Shaikh  
 Jagan Teki <402ja...@gmail.com>
 Jagan Teki 
 Jagan Teki 
 Jagan Teki 
 Jagan Teki 
+Jay Buddhabhatti  
 Jernej Skrabec  
+John Linn  
+Jyotheeswar Reddy Mutthareddyvari  

+Jyotheeswar Reddy Mutthareddyvari  

+Kalyani Akula  
+Love Kumar  
 Lukasz Majewski 
 Marek Behún  
 Marek Behún  Marek Behun 
@@ -47,27 +67,56 @@ Marek Vasut  
 Markus Klotzbuecher 
 Masahiro Yamada  
 Masahiro Yamada  
+Michal Simek  
 Michal Simek  
-Michal Simek  
-Michal Simek  
-Michal Simek  
+Michal Simek  
+Michal Simek  
 Mirza 
+Mounika Grace Akula  
+Mubin Usman Sayyed  
+Nathalie Chan King Choy  

+Nathalie Chan King Choy  
+Nava kishore Manne  
+Neal Frager  
 Neil Armstrong  
 Nicolas Saenz Julienne  
 Patrice Chotard  
 Patrick Delaunay  
 Paul Burton  
+Piyush Mehta  
 Prabhakar Kushwaha 
+Punnaiah Choudary Kalluri  

+Radhey Shyam Pandey  

 Rajeshwari Shinde 
+Raju Kumar Pothuraju  

+Ravi Patel  
 Ricardo Ribalda  
 Ricardo Ribalda  
+Rohit Visavalia  
 Ruchika Gupta  
+Saeed Nowshadi  
+Sai Krishna Potthuri  

+Sai Pavan Boddu  
+Sandeep Gundlupet Raju  

 Sandeep Paulraj 
+Sandeep Reddy Ghanapuram  

 Shaohui Xie 
+Shravya Kumbham  
+Shubhrajyoti Datta  
+Siva Durga Prasad Paladugu  

+Siva Durga Prasad Paladugu  

+Srinivas Goud  
+Srinivas Neeli  
 Stefan Roese  
 Stefano Babic 
+Stefano Stabellini  
 Tom Rini  
+Tomas Thoresen  
 TsiChung Liew 
+Varalaxmi Bingi  
+Venkatesh Yadav Abbarapu  

+Vikhyat Goyal  
+Vishal Patel  
 Wolfgang Denk  
 Wolfgang Denk  
 Wolfgang Denk  
-- 
2.17.1



[PATCH v2 1/2] .mailmap: Sort the mailmap ids in dictionary order

2023-04-26 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

The mailmap ids are not arranged in the dictionary order. So, sort the
mailmap ids in the dictionary order.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

(no changes since v1)

 .mailmap | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/.mailmap b/.mailmap
index 4b3532ea9c..80076f7206 100644
--- a/.mailmap
+++ b/.mailmap
@@ -30,26 +30,28 @@ Eugen Hristev  

 Fabio Estevam 
 Heinrich Schuchardt  
 Heinrich Schuchardt  xypron.g...@gmx.de 

+Igor Opaniuk  
+Igor Opaniuk  
 Jagan Teki <402ja...@gmail.com>
 Jagan Teki 
 Jagan Teki 
 Jagan Teki 
 Jagan Teki 
 Jernej Skrabec  
-Igor Opaniuk  
-Igor Opaniuk  
+Lukasz Majewski 
 Marek Beh??n  
 Marek Beh??n  Marek Behun 
 Marek Vasut  
 Marek Vasut  
 Marek Vasut  
 Markus Klotzbuecher 
-Masahiro Yamada  
 Masahiro Yamada  
+Masahiro Yamada  
 Michal Simek  
-Michal Simek  
 Michal Simek  
+Michal Simek  
 Michal Simek  
+Mirza 
 Neil Armstrong  
 Nicolas Saenz Julienne  
 Patrice Chotard  
@@ -57,8 +59,8 @@ Patrick Delaunay  

 Paul Burton  
 Prabhakar Kushwaha 
 Rajeshwari Shinde 
-Ricardo Ribalda  
 Ricardo Ribalda  
+Ricardo Ribalda  
 Ruchika Gupta  
 Sandeep Paulraj 
 Shaohui Xie 
@@ -66,17 +68,15 @@ Stefan Roese  
 Stefano Babic 
 Tom Rini  
 TsiChung Liew 
-Wolfgang Denk  
-Wolfgang Denk  
-Wolfgang Denk  
-Wolfgang Denk  
-Wolfgang Denk  
 Wolfgang Denk  
 Wolfgang Denk  
-Wolfgang Denk  
+Wolfgang Denk  
 Wolfgang Denk  
-York Sun 
+Wolfgang Denk  
+Wolfgang Denk  
+Wolfgang Denk  
+Wolfgang Denk  
+Wolfgang Denk  
 York Sun 
+York Sun 
 ??ukasz Majewski 
-Lukasz Majewski 
-Mirza 
-- 
2.17.1



[PATCH v2 0/2] Update mailmap ids

2023-04-26 Thread Ashok Reddy Soma
In this patch series
  - Sort mailmap ids according to dictionary order
  - Update all Xilinx users mail ids to AMD

Changes in v2:
 - Updated the missing mailids
 - Removed the space after mail id
 - Added closing brace for Vikhyat Goyal email id

Algapally Santosh Sagar (2):
  .mailmap: Sort the mailmap ids in dictionary order
  .mailmap: Map all Xilinx users mail ids to AMD

 .mailmap | 81 +---
 1 file changed, 65 insertions(+), 16 deletions(-)

-- 
2.17.1



[PATCH 2/2] .mailmap: Map all Xilinx users mail ids to AMD

2023-04-24 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

The mail ids of all the current Xilinx users are to be mapped to AMD
following the merger with AMD. The mailmap file is updated accordingly.

The ids of Marek Behún and Michal Simek are taken as reference.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 .mailmap | 54 +++---
 1 file changed, 51 insertions(+), 3 deletions(-)

diff --git a/.mailmap b/.mailmap
index 80076f7206..46a8619d78 100644
--- a/.mailmap
+++ b/.mailmap
@@ -17,27 +17,46 @@
 
 Alexander Graf  
 Allen Martin 
+Amanda Baze  
+Amit Kumar Mahapatra  

 Andreas Bießmann 
 Andreas Bießmann 
 Aneesh V 
 Anup Patel  
+Anurag Kumar Vulisha  

+Appana Durga Kedareswara rao  

+Ashok Reddy Soma  
 Atish Patra  
+Bharat Kumar Gogada  

+Bharat Kumar Gogada  
+Bhargava Sreekantappa Gayathri  

 Bin Meng  
 Boris Brezillon  
 Boris Brezillon  
+Christian Kohn  
 Dirk Behme 
+Durga Challa  
 Eugen Hristev  
 Fabio Estevam 
+Harini Katakam  
+Harsha  
 Heinrich Schuchardt  
 Heinrich Schuchardt  xypron.g...@gmx.de 

+Ibai Erkiaga  
 Igor Opaniuk  
 Igor Opaniuk  
+Izhar Ameer Shaikh  
 Jagan Teki <402ja...@gmail.com>
 Jagan Teki 
 Jagan Teki 
 Jagan Teki 
 Jagan Teki 
+Jay Buddhabhatti  
 Jernej Skrabec  
+John Linn  
+Jyotheeswar Reddy Mutthareddyvari  

+Kalyani Akula  
+Love Kumar  
 Lukasz Majewski 
 Marek Behún  
 Marek Behún  Marek Behun 
@@ -47,27 +66,56 @@ Marek Vasut  
 Markus Klotzbuecher 
 Masahiro Yamada  
 Masahiro Yamada  
+Michal Simek  
 Michal Simek  
-Michal Simek  
-Michal Simek  
-Michal Simek  
+Michal Simek  
+Michal Simek  
 Mirza 
+Mounika Grace Akula  
+Mubin Usman Sayyed  
+Nathalie Chan King Choy  

+Nathalie Chan King Choy  
+Nava kishore Manne  
+Neal Frager  
 Neil Armstrong  
 Nicolas Saenz Julienne  
 Patrice Chotard  
 Patrick Delaunay  
 Paul Burton  
+Piyush Mehta  
 Prabhakar Kushwaha 
+Punnaiah Choudary Kalluri  

+Radhey Shyam Pandey  

 Rajeshwari Shinde 
+Raju Kumar Pothuraju  

+Ravi Patel  
 Ricardo Ribalda  
 Ricardo Ribalda  
+Rohit Visavalia  
 Ruchika Gupta  
+Saeed Nowshadi  
+Sai Krishna Potthuri  

+Sai Pavan Boddu  
+Sandeep Gundlupet Raju  

 Sandeep Paulraj 
+Sandeep Reddy Ghanapuram  

 Shaohui Xie 
+Shravya Kumbham  
+Shubhrajyoti Datta  
+Siva Durga Prasad Paladugu  

+Siva Durga Prasad Paladugu  

+Srinivas Goud  
+Srinivas Neeli  
 Stefan Roese  
 Stefano Babic 
+Stefano Stabellini  
 Tom Rini  
+Tomas Thoresen  
 TsiChung Liew 
+Varalaxmi Bingi  
+Venkatesh Yadav Abbarapu  

+Vikhyat Goyal   
 Wolfgang Denk  
 Wolfgang Denk  
 Wolfgang Denk  
-- 
2.17.1



[PATCH 1/2] .mailmap: Sort the mailmap ids in dictionary order

2023-04-24 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

The mailmap ids are not arranged in the dictionary order. So, sort the
mailmap ids in the dictionary order.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 .mailmap | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/.mailmap b/.mailmap
index 4b3532ea9c..80076f7206 100644
--- a/.mailmap
+++ b/.mailmap
@@ -30,26 +30,28 @@ Eugen Hristev  

 Fabio Estevam 
 Heinrich Schuchardt  
 Heinrich Schuchardt  xypron.g...@gmx.de 

+Igor Opaniuk  
+Igor Opaniuk  
 Jagan Teki <402ja...@gmail.com>
 Jagan Teki 
 Jagan Teki 
 Jagan Teki 
 Jagan Teki 
 Jernej Skrabec  
-Igor Opaniuk  
-Igor Opaniuk  
+Lukasz Majewski 
 Marek Beh??n  
 Marek Beh??n  Marek Behun 
 Marek Vasut  
 Marek Vasut  
 Marek Vasut  
 Markus Klotzbuecher 
-Masahiro Yamada  
 Masahiro Yamada  
+Masahiro Yamada  
 Michal Simek  
-Michal Simek  
 Michal Simek  
+Michal Simek  
 Michal Simek  
+Mirza 
 Neil Armstrong  
 Nicolas Saenz Julienne  
 Patrice Chotard  
@@ -57,8 +59,8 @@ Patrick Delaunay  

 Paul Burton  
 Prabhakar Kushwaha 
 Rajeshwari Shinde 
-Ricardo Ribalda  
 Ricardo Ribalda  
+Ricardo Ribalda  
 Ruchika Gupta  
 Sandeep Paulraj 
 Shaohui Xie 
@@ -66,17 +68,15 @@ Stefan Roese  
 Stefano Babic 
 Tom Rini  
 TsiChung Liew 
-Wolfgang Denk  
-Wolfgang Denk  
-Wolfgang Denk  
-Wolfgang Denk  
-Wolfgang Denk  
 Wolfgang Denk  
 Wolfgang Denk  
-Wolfgang Denk  
+Wolfgang Denk  
 Wolfgang Denk  
-York Sun 
+Wolfgang Denk  
+Wolfgang Denk  
+Wolfgang Denk  
+Wolfgang Denk  
+Wolfgang Denk  
 York Sun 
+York Sun 
 ??ukasz Majewski 
-Lukasz Majewski 
-Mirza 
-- 
2.17.1



[PATCH 0/2] Update mailmap ids

2023-04-24 Thread Ashok Reddy Soma
In this patch series
  - Sort mailmap ids according to dictionary order
  - Update all Xilinx users mail ids to AMD


Algapally Santosh Sagar (2):
  .mailmap: Sort the mailmap ids in dictionary order
  .mailmap: Map all Xilinx users mail ids to AMD

 .mailmap | 80 
 1 file changed, 64 insertions(+), 16 deletions(-)

-- 
2.17.1



[PATCH 2/2] arm64: versal: Enable ADIN ethernet phy

2023-04-20 Thread Ashok Reddy Soma
Versal VEK280 board has Analog Devices ethernet phy. So, enable
CONFIG_PHY_ADIN config in Versal defconfig.

Signed-off-by: Ashok Reddy Soma 
---

 configs/xilinx_versal_virt_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configs/xilinx_versal_virt_defconfig 
b/configs/xilinx_versal_virt_defconfig
index 018ec72765..c5d65fae95 100644
--- a/configs/xilinx_versal_virt_defconfig
+++ b/configs/xilinx_versal_virt_defconfig
@@ -7,6 +7,7 @@ CONFIG_TEXT_BASE=0x800
 CONFIG_SYS_MALLOC_F_LEN=0x10
 CONFIG_DEFAULT_DEVICE_TREE="xilinx-versal-virt"
 CONFIG_SYS_PROMPT="Versal> "
+CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_ENV_OFFSET_REDUND=0x7F0
 CONFIG_CMD_FRU=y
@@ -97,6 +98,7 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_PHY_ADIN=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_NATSEMI=y
 CONFIG_PHY_REALTEK=y
@@ -137,4 +139,3 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x03FD
 CONFIG_USB_GADGET_PRODUCT_NUM=0x0300
 CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_THOR=y
-CONFIG_OF_LIBFDT_OVERLAY=y
-- 
2.17.1



[PATCH 1/2] arm64: zynqmp: Enable ADIN ethernet phy

2023-04-20 Thread Ashok Reddy Soma
Some of the Kria SOM and ZynqMP boards are using Analog Devices ethernet
phy. So, enable CONFIG_PHY_ADIN for all ZynqMP platforms.

Signed-off-by: Ashok Reddy Soma 
---

 configs/xilinx_zynqmp_virt_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/xilinx_zynqmp_virt_defconfig 
b/configs/xilinx_zynqmp_virt_defconfig
index fb6bf62265..53b6287b71 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -170,6 +170,7 @@ CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
 # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_SPI_FLASH_MTD=y
+CONFIG_PHY_ADIN=y
 CONFIG_PHY_MARVELL=y
 CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
-- 
2.17.1



[PATCH 0/2] Enable ADIN phy for ZynqMP and Versal platforms

2023-04-20 Thread Ashok Reddy Soma
In this patch series enable support for Analog Devices ethernet phy for
ZynqMP and Versal platforms.



Ashok Reddy Soma (2):
  arm64: zynqmp: Enable ADIN ethernet phy
  arm64: versal: Enable ADIN ethernet phy

 configs/xilinx_versal_virt_defconfig | 3 ++-
 configs/xilinx_zynqmp_virt_defconfig | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

-- 
2.17.1



[PATCH v2] cmd: sf/nand: Print and return failure when 0 length is passed

2023-04-12 Thread Ashok Reddy Soma
For sf commands, when '0' length is passed for erase, update, write or
read, there might be undesired results. Ideally '0' length means nothing to
do.

So print 'ERROR: Invalid size 0' and return cmd failure when length '0' is
passed to sf commands. Same thing applies for nand commands also.

Example:

ZynqMP> sf erase 0 0
ERROR: Invalid size 0
ZynqMP> sf write 1 0 0
ERROR: Invalid size 0
ZynqMP> sf read 1 0 0
ERROR: Invalid size 0
ZynqMP> sf update 1000 1 0
ERROR: Invalid size 0
ZynqMP>

Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Changed print from 'size is 0' to Invalid size 0 without quites.
 - Modified description to be imperative
 - Fixed typo in description from "samething" to "same thing"

 cmd/legacy-mtd-utils.c | 5 +
 cmd/sf.c   | 5 +
 2 files changed, 10 insertions(+)

diff --git a/cmd/legacy-mtd-utils.c b/cmd/legacy-mtd-utils.c
index ac7139f84d..61987918a4 100644
--- a/cmd/legacy-mtd-utils.c
+++ b/cmd/legacy-mtd-utils.c
@@ -88,6 +88,11 @@ int mtd_arg_off_size(int argc, char *const argv[], int *idx, 
loff_t *off,
return -1;
}
 
+   if (*size == 0) {
+   printf("ERROR: Invalid size 0\n");
+   return -1;
+   }
+
 print:
printf("device %d ", *idx);
if (*size == chipsize)
diff --git a/cmd/sf.c b/cmd/sf.c
index 11b9c25896..a6aadc2b00 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -353,6 +353,11 @@ static int do_spi_flash_erase(int argc, char *const argv[])
if (ret != 1)
return CMD_RET_USAGE;
 
+   if (size == 0) {
+   printf("ERROR: Invalid size 0\n");
+   return CMD_RET_FAILURE;
+   }
+
/* Consistency checking */
if (offset + size > flash->size) {
printf("ERROR: attempting %s past flash size (%#x)\n",
-- 
2.17.1



[PATCH] cmd: sf/nand: Print and return failure when 0 length is passed

2023-04-12 Thread Ashok Reddy Soma
For sf commands, when '0' length is passed for erase, update, write or
read, we might see undesired results. Ideally '0' length means nothing to
do.

So print 'size is 0' and return cmd failure when length '0' is passed to sf
commands. Samething applies for nand commands also.

Example:

ZynqMP> sf erase 0 0
'size is 0'
ZynqMP> sf write 1 0 0
'size is 0'
ZynqMP> sf read 1 0 0
'size is 0'
ZynqMP> sf update 1000 1 0
'size is 0'
ZynqMP>

Signed-off-by: Ashok Reddy Soma 
---

 cmd/legacy-mtd-utils.c | 5 +
 cmd/sf.c   | 5 +
 2 files changed, 10 insertions(+)

diff --git a/cmd/legacy-mtd-utils.c b/cmd/legacy-mtd-utils.c
index ac7139f84d..7b49bfd858 100644
--- a/cmd/legacy-mtd-utils.c
+++ b/cmd/legacy-mtd-utils.c
@@ -88,6 +88,11 @@ int mtd_arg_off_size(int argc, char *const argv[], int *idx, 
loff_t *off,
return -1;
}
 
+   if (*size == 0) {
+   printf("'size is 0'\n");
+   return -1;
+   }
+
 print:
printf("device %d ", *idx);
if (*size == chipsize)
diff --git a/cmd/sf.c b/cmd/sf.c
index 11b9c25896..46b5475fe8 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -353,6 +353,11 @@ static int do_spi_flash_erase(int argc, char *const argv[])
if (ret != 1)
return CMD_RET_USAGE;
 
+   if (size == 0) {
+   printf("'size is 0'\n");
+   return CMD_RET_FAILURE;
+   }
+
/* Consistency checking */
if (offset + size > flash->size) {
printf("ERROR: attempting %s past flash size (%#x)\n",
-- 
2.17.1



[PATCH v3 2/2] spl: Add missing prototype for board_boot_order

2023-03-01 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'board_boot_order' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v3:
 - Replaced xilinx: zynqmp with just spl: from the commit header

Changes in v2:
 - Moved function prototype from sys_proto.h to include/spl.h

 include/spl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/spl.h b/include/spl.h
index 827bd25c88..bad12fb01f 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -884,5 +884,6 @@ void spl_perform_fixups(struct spl_image_info *spl_image);
  */
 struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size);
 
+void board_boot_order(u32 *spl_boot_list);
 void spl_save_restore_data(void);
 #endif
-- 
2.17.1



[PATCH v3 1/2] xilinx: zynqmp: Add missing prototype for zynqmp_mmio_write

2023-03-01 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

(no changes since v1)

 arch/arm/mach-versal-net/include/mach/sys_proto.h | 7 +--
 arch/arm/mach-versal/include/mach/sys_proto.h | 6 +-
 drivers/mmc/zynq_sdhci.c  | 1 +
 drivers/spi/zynqmp_gqspi.c| 5 +
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-versal-net/include/mach/sys_proto.h 
b/arch/arm/mach-versal-net/include/mach/sys_proto.h
index 5bba9030f2..a20cf02712 100644
--- a/arch/arm/mach-versal-net/include/mach/sys_proto.h
+++ b/arch/arm/mach-versal-net/include/mach/sys_proto.h
@@ -8,9 +8,4 @@
 
 void mem_map_fill(void);
 
-static inline int zynqmp_mmio_write(const u32 address, const u32 mask,
-   const u32 value)
-{
-   BUILD_BUG();
-   return -EINVAL;
-}
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
diff --git a/arch/arm/mach-versal/include/mach/sys_proto.h 
b/arch/arm/mach-versal/include/mach/sys_proto.h
index 8e5712e0c9..3f01508ecb 100644
--- a/arch/arm/mach-versal/include/mach/sys_proto.h
+++ b/arch/arm/mach-versal/include/mach/sys_proto.h
@@ -13,8 +13,4 @@ enum {
 void tcm_init(u8 mode);
 void mem_map_fill(void);
 
-static inline int zynqmp_mmio_write(const u32 address, const u32 mask, const 
u32 value)
-{
-   BUILD_BUG();
-   return -EINVAL;
-}
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 8b559d8a7a..9dc310663f 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -14,6 +14,7 @@
 #include "mmc_private.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index 335b458cb9..c4aee279aa 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -183,6 +183,11 @@ struct zynqmp_qspi_priv {
const struct spi_mem_op *op;
 };
 
+__weak int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 
value)
+{
+   return 0;
+}
+
 static int zynqmp_qspi_of_to_plat(struct udevice *bus)
 {
struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
-- 
2.17.1



[PATCH v3 0/2] Fix sparse warnings

2023-03-01 Thread Ashok Reddy Soma
Run and fix sparse warnings in below files
 -arch/arm/mach-zynqmp/include/mach/sys_proto.h
 -common/spl/spl.c
 -arch/arm/mach-versal-net/include/mach/sys_proto.h
 -arch/arm/mach-versal/include/mach/sys_proto.h
 -drivers/mmc/zynq_sdhci.c
 -drivers/spi/zynqmp_gqspi.c


Changes in v3:
 - Replaced xilinx: zynqmp with just spl: from the commit header

Changes in v2:
 - Moved function prototype from sys_proto.h to include/spl.h

Algapally Santosh Sagar (2):
  xilinx: zynqmp: Add missing prototype for zynqmp_mmio_write
  spl: Add missing prototype for board_boot_order

 arch/arm/mach-versal-net/include/mach/sys_proto.h | 7 +--
 arch/arm/mach-versal/include/mach/sys_proto.h | 6 +-
 drivers/mmc/zynq_sdhci.c  | 1 +
 drivers/spi/zynqmp_gqspi.c| 5 +
 include/spl.h | 1 +
 5 files changed, 9 insertions(+), 11 deletions(-)

-- 
2.17.1



[PATCH 4/4] arm64: dts: zynqmp: Enable nand-on-flash-bbt in DT by default

2023-02-23 Thread Ashok Reddy Soma
By default enable nand-on-flash-bbt DT flag, so that driver always refers
to the bad block table(bbt) present on the flash device.

Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/dts/zynqmp-zc1751-xm016-dc2.dts | 2 ++
 arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/dts/zynqmp-zc1751-xm016-dc2.dts 
b/arch/arm/dts/zynqmp-zc1751-xm016-dc2.dts
index 4e6160bcd8..b6bc2f5be0 100644
--- a/arch/arm/dts/zynqmp-zc1751-xm016-dc2.dts
+++ b/arch/arm/dts/zynqmp-zc1751-xm016-dc2.dts
@@ -142,6 +142,7 @@
label = "main-storage-0";
nand-ecc-step-size = <1024>;
nand-ecc-strength = <24>;
+   nand-on-flash-bbt;
 
partition@0 {   /* for testing purpose */
label = "nand-fsbl-uboot";
@@ -178,6 +179,7 @@
label = "main-storage-1";
nand-ecc-step-size = <1024>;
nand-ecc-strength = <24>;
+   nand-on-flash-bbt;
 
partition@0 {   /* for testing purpose */
label = "nand1-fsbl-uboot";
diff --git a/arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts 
b/arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts
index 8a06c2a90a..6021f8b4e1 100644
--- a/arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts
+++ b/arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts
@@ -138,6 +138,7 @@
label = "main-storage-0";
nand-ecc-step-size = <1024>;
nand-ecc-strength = <24>;
+   nand-on-flash-bbt;
 
partition@0 {   /* for testing purpose */
label = "nand-fsbl-uboot";
@@ -174,6 +175,7 @@
label = "main-storage-1";
nand-ecc-step-size = <1024>;
nand-ecc-strength = <24>;
+   nand-on-flash-bbt;
 
partition@0 {   /* for testing purpose */
label = "nand1-fsbl-uboot";
-- 
2.17.1



[PATCH 3/4] arm64: dts: zynqmp: Fix nand dt node

2023-02-23 Thread Ashok Reddy Soma
DC3 nand node is not correct, it is showing all partitions under
controller node directly. Create two sub nand nodes with partitions for
each.

Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts | 117 ++-
 1 file changed, 70 insertions(+), 47 deletions(-)

diff --git a/arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts 
b/arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts
index 13812470ae..8a06c2a90a 100644
--- a/arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts
+++ b/arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts
@@ -128,54 +128,77 @@
arasan,has-mdma;
num-cs = <2>;
 
-   partition@0 {   /* for testing purpose */
-   label = "nand-fsbl-uboot";
-   reg = <0x0 0x0 0x40>;
+   nand@0 {
+   reg = <0x0>;
+   #address-cells = <0x2>;
+   #size-cells = <0x1>;
+   nand-ecc-mode = "soft";
+   nand-ecc-algo = "bch";
+   nand-rb = <0>;
+   label = "main-storage-0";
+   nand-ecc-step-size = <1024>;
+   nand-ecc-strength = <24>;
+
+   partition@0 {   /* for testing purpose */
+   label = "nand-fsbl-uboot";
+   reg = <0x0 0x0 0x40>;
+   };
+   partition@1 {   /* for testing purpose */
+   label = "nand-linux";
+   reg = <0x0 0x40 0x140>;
+   };
+   partition@2 {   /* for testing purpose */
+   label = "nand-device-tree";
+   reg = <0x0 0x180 0x40>;
+   };
+   partition@3 {   /* for testing purpose */
+   label = "nand-rootfs";
+   reg = <0x0 0x1C0 0x140>;
+   };
+   partition@4 {   /* for testing purpose */
+   label = "nand-bitstream";
+   reg = <0x0 0x300 0x40>;
+   };
+   partition@5 {   /* for testing purpose */
+   label = "nand-misc";
+   reg = <0x0 0x340 0xFCC0>;
+   };
};
-   partition@1 {   /* for testing purpose */
-   label = "nand-linux";
-   reg = <0x0 0x40 0x140>;
-   };
-   partition@2 {   /* for testing purpose */
-   label = "nand-device-tree";
-   reg = <0x0 0x180 0x40>;
-   };
-   partition@3 {   /* for testing purpose */
-   label = "nand-rootfs";
-   reg = <0x0 0x1C0 0x140>;
-   };
-   partition@4 {   /* for testing purpose */
-   label = "nand-bitstream";
-   reg = <0x0 0x300 0x40>;
-   };
-   partition@5 {   /* for testing purpose */
-   label = "nand-misc";
-   reg = <0x0 0x340 0xFCC0>;
-   };
-
-   partition@6 {   /* for testing purpose */
-   label = "nand1-fsbl-uboot";
-   reg = <0x1 0x0 0x40>;
-   };
-   partition@7 {   /* for testing purpose */
-   label = "nand1-linux";
-   reg = <0x1 0x40 0x140>;
-   };
-   partition@8 {   /* for testing purpose */
-   label = "nand1-device-tree";
-   reg = <0x1 0x180 0x40>;
-   };
-   partition@9 {   /* for testing purpose */
-   label = "nand1-rootfs";
-   reg = <0x1 0x1C0 0x140>;
-   };
-   partition@10 {  /* for testing purpose */
-   label = "nand1-bitstream";
-   reg = <0x1 0x300 0x40>;
-   };
-   partition@11 {  /* for testing purpose */
-   label = "nand1-misc";
-   reg = <0x1 0x340 0xFCC0>;
+   nand@1 {
+   reg = <0x1>;
+   #address-cells = <0x2>;
+   #size-cells = <0x1>;
+   nand-ecc-mode = "soft";
+   nand-ecc-algo = "bch";
+   nand-rb = <0>;
+   label = "main-storage-1";
+   nand-ecc-step-size = <1024>;
+   nand-ecc-strength = <24>;
+
+   partition@0 {   /* for testing purpose */
+   label = "nand1-fsbl-uboot";
+   reg = <0x0 0x0 0x40>;
+   };
+   partition@1 {   /* for testing purpose */
+   label = "nand1-linux";
+   reg = <0x0 0x4

[PATCH 2/4] mtd: nand: arasan: Set ofnode value

2023-02-23 Thread Ashok Reddy Soma
Ofnode value is not set, so all the DT properties are not being read
and due to this default values are being used.

Find nand node and set chip->flash_node value.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/mtd/nand/raw/arasan_nfc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/raw/arasan_nfc.c 
b/drivers/mtd/nand/raw/arasan_nfc.c
index ddb4cb1cba..99e2681c14 100644
--- a/drivers/mtd/nand/raw/arasan_nfc.c
+++ b/drivers/mtd/nand/raw/arasan_nfc.c
@@ -1230,12 +1230,16 @@ static int arasan_probe(struct udevice *dev)
struct nand_drv *info = >nand_ctrl;
struct nand_config *nand = >config;
struct mtd_info *mtd;
+   ofnode child;
int err = -1;
 
info->reg = (struct nand_regs *)dev_read_addr(dev);
mtd = nand_to_mtd(nand_chip);
nand_set_controller_data(nand_chip, >nand_ctrl);
 
+   ofnode_for_each_subnode(child, dev_ofnode(dev))
+   nand_set_flash_node(nand_chip, child);
+
 #ifdef CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
nand_chip->options |= NAND_NO_SUBPAGE_WRITE;
 #endif
-- 
2.17.1



[PATCH 1/4] mtd: nand: arasan: Remove hardcoded bbt option

2023-02-23 Thread Ashok Reddy Soma
Bad block table option is hardcoded to read from flash with
NAND_BBT_USE_FLASH option. This decision should be done based on DT
property. Remove this hardcoding, to be able to use DT property.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/mtd/nand/raw/arasan_nfc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/arasan_nfc.c 
b/drivers/mtd/nand/raw/arasan_nfc.c
index 4621bfb03e..ddb4cb1cba 100644
--- a/drivers/mtd/nand/raw/arasan_nfc.c
+++ b/drivers/mtd/nand/raw/arasan_nfc.c
@@ -1248,7 +1248,6 @@ static int arasan_probe(struct udevice *dev)
/* Buffer read/write routines */
nand_chip->read_buf = arasan_nand_read_buf;
nand_chip->write_buf = arasan_nand_write_buf;
-   nand_chip->bbt_options = NAND_BBT_USE_FLASH;
 
writel(0x0, >reg->cmd_reg);
writel(0x0, >reg->pgm_reg);
-- 
2.17.1



[PATCH 0/4] Fix arasan nand driver issues

2023-02-23 Thread Ashok Reddy Soma
In this patch series
 - Remove hardcoding of NAND_BBT_USE_FLASH in nand->bbt_options
 - Find and update nand ofnode.
 - Fix nand node in zynqmp-zc1751-xm017-dc3.dts file
 - Enable nand-on-flash-bbt flag in zynqmp DT's by default


Ashok Reddy Soma (4):
  mtd: nand: arasan: Remove hardcoded bbt option
  mtd: nand: arasan: Set ofnode value
  arm64: dts: zynqmp: Fix nand dt node
  arm64: dts: zynqmp: Enable nand-on-flash-bbt in DT by default

 arch/arm/dts/zynqmp-zc1751-xm016-dc2.dts |   2 +
 arch/arm/dts/zynqmp-zc1751-xm017-dc3.dts | 119 ++-
 drivers/mtd/nand/raw/arasan_nfc.c|   5 +-
 3 files changed, 78 insertions(+), 48 deletions(-)

-- 
2.17.1



[PATCH v2 1/2] xilinx: zynqmp: Add missing prototype for zynqmp_mmio_write

2023-02-23 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

(no changes since v1)

 arch/arm/mach-versal-net/include/mach/sys_proto.h | 7 +--
 arch/arm/mach-versal/include/mach/sys_proto.h | 6 +-
 drivers/mmc/zynq_sdhci.c  | 1 +
 drivers/spi/zynqmp_gqspi.c| 5 +
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-versal-net/include/mach/sys_proto.h 
b/arch/arm/mach-versal-net/include/mach/sys_proto.h
index 5bba9030f2..a20cf02712 100644
--- a/arch/arm/mach-versal-net/include/mach/sys_proto.h
+++ b/arch/arm/mach-versal-net/include/mach/sys_proto.h
@@ -8,9 +8,4 @@
 
 void mem_map_fill(void);
 
-static inline int zynqmp_mmio_write(const u32 address, const u32 mask,
-   const u32 value)
-{
-   BUILD_BUG();
-   return -EINVAL;
-}
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
diff --git a/arch/arm/mach-versal/include/mach/sys_proto.h 
b/arch/arm/mach-versal/include/mach/sys_proto.h
index 8e5712e0c9..3f01508ecb 100644
--- a/arch/arm/mach-versal/include/mach/sys_proto.h
+++ b/arch/arm/mach-versal/include/mach/sys_proto.h
@@ -13,8 +13,4 @@ enum {
 void tcm_init(u8 mode);
 void mem_map_fill(void);
 
-static inline int zynqmp_mmio_write(const u32 address, const u32 mask, const 
u32 value)
-{
-   BUILD_BUG();
-   return -EINVAL;
-}
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 8b559d8a7a..9dc310663f 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -14,6 +14,7 @@
 #include "mmc_private.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index 335b458cb9..c4aee279aa 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -183,6 +183,11 @@ struct zynqmp_qspi_priv {
const struct spi_mem_op *op;
 };
 
+__weak int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 
value)
+{
+   return 0;
+}
+
 static int zynqmp_qspi_of_to_plat(struct udevice *bus)
 {
struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
-- 
2.17.1



[PATCH v2 0/2] Fix sparse warnings

2023-02-23 Thread Ashok Reddy Soma
Run and fix sparse warnings in below files
 -arch/arm/mach-zynqmp/include/mach/sys_proto.h
 -common/spl/spl.c
 -arch/arm/mach-versal-net/include/mach/sys_proto.h
 -arch/arm/mach-versal/include/mach/sys_proto.h
 -drivers/mmc/zynq_sdhci.c
 -drivers/spi/zynqmp_gqspi.c


Changes in v2:
 - Moved function prototype from sys_proto.h to include/spl.h

Algapally Santosh Sagar (2):
  xilinx: zynqmp: Add missing prototype for zynqmp_mmio_write
  xilinx: zynqmp: Add missing prototype for board_boot_order

 arch/arm/mach-versal-net/include/mach/sys_proto.h | 7 +--
 arch/arm/mach-versal/include/mach/sys_proto.h | 6 +-
 drivers/mmc/zynq_sdhci.c  | 1 +
 drivers/spi/zynqmp_gqspi.c| 5 +
 include/spl.h | 1 +
 5 files changed, 9 insertions(+), 11 deletions(-)

-- 
2.17.1



[PATCH v2 2/2] xilinx: zynqmp: Add missing prototype for board_boot_order

2023-02-23 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'board_boot_order' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Moved function prototype from sys_proto.h to include/spl.h

 include/spl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/spl.h b/include/spl.h
index 827bd25c88..bad12fb01f 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -884,5 +884,6 @@ void spl_perform_fixups(struct spl_image_info *spl_image);
  */
 struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size);
 
+void board_boot_order(u32 *spl_boot_list);
 void spl_save_restore_data(void);
 #endif
-- 
2.17.1



[PATCH 2/2] xilinx: zynqmp: Add missing prototype for board_boot_order

2023-02-20 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'board_boot_order' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/mach-zynqmp/include/mach/sys_proto.h | 1 +
 common/spl/spl.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h 
b/arch/arm/mach-zynqmp/include/mach/sys_proto.h
index c6733ed1bb..0f648c47a3 100644
--- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h
+++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h
@@ -51,6 +51,7 @@ unsigned int zynqmp_get_silicon_version(void);
 int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
 int zynqmp_mmio_read(const u32 address, u32 *value);
 
+void board_boot_order(u32 *spl_boot_list);
 void initialize_tcm(bool mode);
 void mem_map_fill(void);
 #if defined(CONFIG_SYS_MEM_RSVD_FOR_MMU) || defined(CONFIG_DEFINE_TCM_OCM_MMAP)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index a630e79866..6e5f326481 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.17.1



[PATCH 1/2] xilinx: zynqmp: Add missing prototype for zynqmp_mmio_write

2023-02-20 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'zynqmp_mmio_write' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 arch/arm/mach-versal-net/include/mach/sys_proto.h | 7 +--
 arch/arm/mach-versal/include/mach/sys_proto.h | 6 +-
 drivers/mmc/zynq_sdhci.c  | 1 +
 drivers/spi/zynqmp_gqspi.c| 5 +
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-versal-net/include/mach/sys_proto.h 
b/arch/arm/mach-versal-net/include/mach/sys_proto.h
index 5bba9030f2..a20cf02712 100644
--- a/arch/arm/mach-versal-net/include/mach/sys_proto.h
+++ b/arch/arm/mach-versal-net/include/mach/sys_proto.h
@@ -8,9 +8,4 @@
 
 void mem_map_fill(void);
 
-static inline int zynqmp_mmio_write(const u32 address, const u32 mask,
-   const u32 value)
-{
-   BUILD_BUG();
-   return -EINVAL;
-}
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
diff --git a/arch/arm/mach-versal/include/mach/sys_proto.h 
b/arch/arm/mach-versal/include/mach/sys_proto.h
index 8e5712e0c9..3f01508ecb 100644
--- a/arch/arm/mach-versal/include/mach/sys_proto.h
+++ b/arch/arm/mach-versal/include/mach/sys_proto.h
@@ -13,8 +13,4 @@ enum {
 void tcm_init(u8 mode);
 void mem_map_fill(void);
 
-static inline int zynqmp_mmio_write(const u32 address, const u32 mask, const 
u32 value)
-{
-   BUILD_BUG();
-   return -EINVAL;
-}
+int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value);
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 8b559d8a7a..9dc310663f 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -14,6 +14,7 @@
 #include "mmc_private.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index 335b458cb9..c4aee279aa 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -183,6 +183,11 @@ struct zynqmp_qspi_priv {
const struct spi_mem_op *op;
 };
 
+__weak int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 
value)
+{
+   return 0;
+}
+
 static int zynqmp_qspi_of_to_plat(struct udevice *bus)
 {
struct zynqmp_qspi_plat *plat = dev_get_plat(bus);
-- 
2.17.1



[PATCH 0/2] Fix sparse warnings

2023-02-20 Thread Ashok Reddy Soma
Run and fix sparse warnings in below files
 -arch/arm/mach-zynqmp/include/mach/sys_proto.h
 -common/spl/spl.c
 -arch/arm/mach-versal-net/include/mach/sys_proto.h
 -arch/arm/mach-versal/include/mach/sys_proto.h
 -drivers/mmc/zynq_sdhci.c
 -drivers/spi/zynqmp_gqspi.c



Algapally Santosh Sagar (2):
  xilinx: zynqmp: Add missing prototype for zynqmp_mmio_write
  xilinx: zynqmp: Add missing prototype for board_boot_order

 arch/arm/mach-versal-net/include/mach/sys_proto.h | 7 +--
 arch/arm/mach-versal/include/mach/sys_proto.h | 6 +-
 arch/arm/mach-zynqmp/include/mach/sys_proto.h | 1 +
 common/spl/spl.c  | 1 +
 drivers/mmc/zynq_sdhci.c  | 1 +
 drivers/spi/zynqmp_gqspi.c| 5 +
 6 files changed, 10 insertions(+), 11 deletions(-)

-- 
2.17.1



[PATCH] arm64: zynqmp: Add missing ZYNQMP_FIRMWARE dependencies

2023-02-01 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

There are missing Kconfig dependencies in the code which is using
firmware interface.
The commit 71efd45a5fc7 ("arm64: zynqmp: Change firmware dependency")
add option to also disable ZYNQMP_FIRMWARE. But not all Kconfig
dependencies were properly described and also sdhci and gem drivers
didn't protect the code properly.
So, add the missing ZYNQMP_FIRMWARE dependencies.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 board/xilinx/zynqmp/Kconfig | 1 +
 drivers/clk/Kconfig | 4 ++--
 drivers/fpga/Kconfig| 2 +-
 drivers/mmc/zynq_sdhci.c| 4 ++--
 drivers/net/zynq_gem.c  | 2 +-
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/board/xilinx/zynqmp/Kconfig b/board/xilinx/zynqmp/Kconfig
index 7d1f7398c3..ffa2f0215d 100644
--- a/board/xilinx/zynqmp/Kconfig
+++ b/board/xilinx/zynqmp/Kconfig
@@ -6,6 +6,7 @@ if ARCH_ZYNQMP
 
 config CMD_ZYNQMP
bool "Enable ZynqMP specific commands"
+   depends on ZYNQMP_FIRMWARE
default y
help
  Enable ZynqMP specific commands like "zynqmp secure"
diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
index 09aa97ee8c..42280cbf83 100644
--- a/drivers/clk/Kconfig
+++ b/drivers/clk/Kconfig
@@ -185,7 +185,7 @@ config CLK_VERSACLOCK
 config CLK_VERSAL
bool "Enable clock driver support for Versal"
depends on (ARCH_VERSAL || ARCH_VERSAL_NET)
-   select ZYNQMP_FIRMWARE
+   imply ZYNQMP_FIRMWARE
help
  This clock driver adds support for clock realted settings for
  Versal platform.
@@ -219,7 +219,7 @@ config CLK_ZYNQ
 config CLK_ZYNQMP
bool "Enable clock driver support for ZynqMP"
depends on ARCH_ZYNQMP
-   select ZYNQMP_FIRMWARE
+   imply ZYNQMP_FIRMWARE
help
  This clock driver adds support for clock realted settings for
  ZynqMP platform.
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 4113de230c..f8b0aeb3ee 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -63,7 +63,7 @@ config FPGA_XILINX
 
 config FPGA_ZYNQMPPL
bool "Enable Xilinx FPGA driver for ZynqMP"
-   depends on FPGA_XILINX
+   depends on FPGA_XILINX && ZYNQMP_FIRMWARE
help
  Enable FPGA driver for loading bitstream in BIT and BIN format
  on Xilinx Zynq UltraScale+ (ZynqMP) device.
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 91e309d275..8b559d8a7a 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -988,7 +988,7 @@ static const struct sdhci_ops arasan_ops = {
 };
 #endif
 
-#if defined(CONFIG_ARCH_ZYNQMP)
+#if defined(CONFIG_ARCH_ZYNQMP) && defined(CONFIG_ZYNQMP_FIRMWARE)
 static int sdhci_zynqmp_set_dynamic_config(struct arasan_sdhci_priv *priv,
   struct udevice *dev)
 {
@@ -1090,7 +1090,7 @@ static int arasan_sdhci_probe(struct udevice *dev)
 
host = priv->host;
 
-#if defined(CONFIG_ARCH_ZYNQMP)
+#if defined(CONFIG_ARCH_ZYNQMP) && defined(CONFIG_ZYNQMP_FIRMWARE)
if (device_is_compatible(dev, "xlnx,zynqmp-8.9a")) {
ret = zynqmp_pm_is_function_supported(PM_IOCTL,
  IOCTL_SET_SD_CONFIG);
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index cc49788012..211b2c6e55 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -738,7 +738,7 @@ static int gem_zynqmp_set_dynamic_config(struct udevice 
*dev)
u32 pm_info[2];
int ret;
 
-   if (IS_ENABLED(CONFIG_ARCH_ZYNQMP)) {
+   if (IS_ENABLED(CONFIG_ARCH_ZYNQMP) && 
IS_ENABLED(CONFIG_ZYNQMP_FIRMWARE)) {
if (!zynqmp_pm_is_function_supported(PM_IOCTL,
 IOCTL_SET_GEM_CONFIG)) {
ret = ofnode_read_u32_array(dev_ofnode(dev),
-- 
2.17.1



[PATCH v2 4/4] drivers: mmc: Change datatype of tuning_loop_counter to int

2023-01-19 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

tuning_loop_counter is of char type, which is not capable of handling
the entire data range of this variable. This is pointed by below sparse
warning. Change datatype to int to fix this.
warning: comparison is always false due to limited range of data type.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Updated description

 drivers/mmc/zynq_sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 7dcf6ad842..be4075c97a 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -249,7 +249,7 @@ static int arasan_sdhci_execute_tuning(struct mmc *mmc, u8 
opcode)
u32 ctrl;
struct sdhci_host *host;
struct arasan_sdhci_priv *priv = dev_get_priv(mmc->dev);
-   char tuning_loop_counter = SDHCI_TUNING_LOOP_COUNT;
+   int tuning_loop_counter = SDHCI_TUNING_LOOP_COUNT;
 
dev_dbg(mmc->dev, "%s\n", __func__);
 
-- 
2.17.1



[PATCH v2 3/4] xilinx: versal: Add missing header

2023-01-19 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Changed subject from missing prototype to missing header
 - Moved include file in alphabetical order

 board/xilinx/versal/board.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index f9f5457ed2..4cdc2ecd1d 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -4,6 +4,7 @@
  * Michal Simek 
  */
 
+#include 
 #include 
 #include 
 #include 
-- 
2.17.1



[PATCH v2 2/4] gpio: zynqmp: Handle error from get_gpio_modepin

2023-01-19 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

There is a unused variable ret, due to which we are getting sparse warning
as below.
warning: variable 'ret' set but not used [-Wunused-but-set-variable].

Return ret incase of error.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Instead of removing ret variable, take it and return incase of error.
 - Updated description as per this.

 drivers/gpio/zynqmp_gpio_modepin.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpio/zynqmp_gpio_modepin.c 
b/drivers/gpio/zynqmp_gpio_modepin.c
index 078fd83395..e9565ff543 100644
--- a/drivers/gpio/zynqmp_gpio_modepin.c
+++ b/drivers/gpio/zynqmp_gpio_modepin.c
@@ -48,6 +48,9 @@ static int modepin_gpio_set_value(struct udevice *dev, 
unsigned int offset,
int ret;
 
ret = get_gpio_modepin(ret_payload);
+   if (ret)
+   return ret;
+
if (value)
out_val = OUTVAL(offset) | ret_payload[1];
else
-- 
2.17.1



[PATCH v2 1/4] xilinx: common: Include header file to fix warning

2023-01-19 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Prototype is missing for board_get_usable_ram_top, which is pointed by
below sparse warning. Include init.h header file to fix this.

warning: no previous prototype for 'board_get_usable_ram_top'
[-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Included header file instead of declaring prototype
 - Modified description to reflect the same

 board/xilinx/common/board.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 59d87f2352..a5bd289776 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-- 
2.17.1



[PATCH v2 0/4] Fix sparse warnings

2023-01-19 Thread Ashok Reddy Soma
Run and fix sparse warnings in below files
 -drivers/mmc/zynq_sdhci.c
 -board/xilinx/common/board.h
 -drivers/gpio/zynqmp_gpio_modepin.c
 -board/xilinx/versal/board.c

Changes in v2:
 - Included header file instead of declaring prototype
 - Modified description to reflect the same
 - Instead of removing ret variable, take it and return incase of error.
 - Updated description as per this.
 - Changed subject from missing prototype to missing header
 - Moved include file in alphabetical order
 - Updated description

Algapally Santosh Sagar (4):
  xilinx: common: Include header file to fix warning
  gpio: zynqmp: Handle error from get_gpio_modepin
  xilinx: versal: Add missing header
  drivers: mmc: Change datatype of tuning_loop_counter to int

 board/xilinx/common/board.c| 1 +
 board/xilinx/versal/board.c| 1 +
 drivers/gpio/zynqmp_gpio_modepin.c | 3 +++
 drivers/mmc/zynq_sdhci.c   | 2 +-
 4 files changed, 6 insertions(+), 1 deletion(-)

-- 
2.17.1



[4/4] mmc: zynq_sdhci: Add support and quirk for HS400

2023-01-10 Thread Ashok Reddy Soma
Add support for HS400 in mode2timing array.
Add a quirk for Versal NET platform to indicate that HS400 is supported
through bit63 of capability register.

Signed-off-by: Ashok Reddy Soma 
---
 drivers/mmc/zynq_sdhci.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 8415da3373..72de6c6227 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -153,6 +153,7 @@ static const u8 mode2timing[] = {
[UHS_DDR50] = MMC_TIMING_UHS_DDR50,
[UHS_SDR104] = MMC_TIMING_UHS_SDR104,
[MMC_HS_200] = MMC_TIMING_MMC_HS200,
+   [MMC_HS_400] = MMC_TIMING_MMC_HS400,
 };
 
 #if defined(CONFIG_ARCH_VERSAL_NET)
@@ -1133,6 +1134,10 @@ static int arasan_sdhci_probe(struct udevice *dev)
if (priv->no_1p8)
host->quirks |= SDHCI_QUIRK_NO_1_8_V;
 
+   if (CONFIG_IS_ENABLED(ARCH_VERSAL_NET) &&
+   device_is_compatible(dev, "xlnx,versal-net-5.1-emmc"))
+   host->quirks |= SDHCI_QUIRK_CAPS_BIT63_FOR_HS400;
+
plat->cfg.f_max = CONFIG_ZYNQ_SDHCI_MAX_FREQ;
 
ret = mmc_of_parse(dev, >cfg);
-- 
2.17.1



[3/4] mmc: sdhci: Enable HS400 support if available in caps

2023-01-10 Thread Ashok Reddy Soma
HS400 is indicated in bit63 of capability register in few IP's.
Add a quirk to check this and add HS400 to host capabilities.

Signed-off-by: Ashok Reddy Soma 
---
 drivers/mmc/sdhci.c | 4 
 include/sdhci.h | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 181ab9b7cb..c6b250b9a1 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -995,6 +995,10 @@ int sdhci_setup_cfg(struct mmc_config *cfg, struct 
sdhci_host *host,
cfg->host_caps |= MMC_CAP(UHS_SDR50);
}
 
+   if ((host->quirks & SDHCI_QUIRK_CAPS_BIT63_FOR_HS400) &&
+   (caps_1 & SDHCI_SUPPORT_HS400))
+   cfg->host_caps |= MMC_CAP(MMC_HS_400);
+
if (caps_1 & SDHCI_SUPPORT_DDR50)
cfg->host_caps |= MMC_CAP(UHS_DDR50);
 
diff --git a/include/sdhci.h b/include/sdhci.h
index 64a3d309da..70fefca2a9 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -189,6 +189,7 @@
 #define  SDHCI_SUPPORT_SDR50   0x0001
 #define  SDHCI_SUPPORT_SDR104  0x0002
 #define  SDHCI_SUPPORT_DDR50   0x0004
+#define  SDHCI_SUPPORT_HS400   BIT(31)
 #define  SDHCI_USE_SDR50_TUNING0x2000
 
 #define  SDHCI_CLOCK_MUL_MASK  0x00FF
@@ -248,6 +249,8 @@
 #define SDHCI_QUIRK_USE_WIDE8  (1 << 8)
 #define SDHCI_QUIRK_NO_1_8_V   (1 << 9)
 #define SDHCI_QUIRK_SUPPORT_SINGLE (1 << 10)
+/* Capability register bit-63 indicates HS400 support */
+#define SDHCI_QUIRK_CAPS_BIT63_FOR_HS400   BIT(11)
 
 /* to make gcc happy */
 struct sdhci_host;
-- 
2.17.1



[2/4] mmc: sdhci: Check and call config_dll callback functions

2023-01-10 Thread Ashok Reddy Soma
Check if the low level driver supports config_dll callback function and
call it if it does. Call with dll disable before calling set_clock and
with dll enable after it.

Signed-off-by: Ashok Reddy Soma 
---
 drivers/mmc/sdhci.c | 16 
 include/sdhci.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index a80ad8329a..181ab9b7cb 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -396,6 +396,14 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
}
}
 
+   if (host->ops && host->ops->config_dll) {
+   ret = host->ops->config_dll(host, clock, false);
+   if (ret) {
+   printf("%s: Error while configuring dll\n", __func__);
+   return ret;
+   }
+   }
+
if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {
/*
 * Check if the Host Controller supports Programmable Clock
@@ -439,6 +447,14 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
if (host->ops && host->ops->set_clock)
host->ops->set_clock(host, div);
 
+   if (host->ops && host->ops->config_dll) {
+   ret = host->ops->config_dll(host, clock, true);
+   if (ret) {
+   printf("%s: Error while configuring dll\n", __func__);
+   return ret;
+   }
+   }
+
clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
<< SDHCI_DIVIDER_HI_SHIFT;
diff --git a/include/sdhci.h b/include/sdhci.h
index 24b4599b85..64a3d309da 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -272,6 +272,8 @@ struct sdhci_ops {
void(*set_clock)(struct sdhci_host *host, u32 div);
int (*platform_execute_tuning)(struct mmc *host, u8 opcode);
int (*set_delay)(struct sdhci_host *host);
+   /* Callback function to set DLL clock configuration */
+   int (*config_dll)(struct sdhci_host *host, u32 clock, bool enable);
int (*deferred_probe)(struct sdhci_host *host);
 
/**
-- 
2.17.1



[1/4] mmc: zynq_sdhci: Add support for eMMC5.1 for Versal NET platform

2023-01-10 Thread Ashok Reddy Soma
Add support for eMMC 5.1 for Versal NET platform
 - Add new compatible string(xlnx,versal-net-5.1-emmc).
 - Add CONFIG_ARCH_VERSAL_NET condition wherever required.
 - Add DLL and Delay Chain mode support
 - Add input and output tap delays for eMMC.
 - Add Strobe select tap for HS400 mode.

Signed-off-by: Ashok Reddy Soma 
---
 drivers/mmc/zynq_sdhci.c | 287 ++-
 1 file changed, 284 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 7dcf6ad842..8415da3373 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * (C) Copyright 2013 - 2015 Xilinx, Inc.
+ * (C) Copyright 2013 - 2022, Xilinx, Inc.
+ * (C) Copyright 2022, Advanced Micro Devices, Inc.
  *
  * Xilinx Zynq SD Host Controller Interface
  */
@@ -16,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -48,6 +50,41 @@
 #define SD0_OTAPDLYSEL_MASKGENMASK(5, 0)
 #define SD1_OTAPDLYSEL_MASKGENMASK(21, 16)
 
+#define MIN_PHY_CLK_HZ 5000
+
+#define PHY_CTRL_REG1  0x270
+#define PHY_CTRL_ITAPDLY_ENA_MASK  BIT(0)
+#define PHY_CTRL_ITAPDLY_SEL_MASK  GENMASK(5, 1)
+#define PHY_CTRL_ITAPDLY_SEL_SHIFT 1
+#define PHY_CTRL_ITAP_CHG_WIN_MASK BIT(6)
+#define PHY_CTRL_OTAPDLY_ENA_MASK  BIT(8)
+#define PHY_CTRL_OTAPDLY_SEL_MASK  GENMASK(15, 12)
+#define PHY_CTRL_OTAPDLY_SEL_SHIFT 12
+#define PHY_CTRL_STRB_SEL_MASK GENMASK(23, 16)
+#define PHY_CTRL_STRB_SEL_SHIFT16
+#define PHY_CTRL_TEST_CTRL_MASKGENMASK(31, 24)
+
+#define PHY_CTRL_REG2  0x274
+#define PHY_CTRL_EN_DLL_MASK   BIT(0)
+#define PHY_CTRL_DLL_RDY_MASK  BIT(1)
+#define PHY_CTRL_FREQ_SEL_MASK GENMASK(6, 4)
+#define PHY_CTRL_FREQ_SEL_SHIFT4
+#define PHY_CTRL_SEL_DLY_TX_MASK   BIT(16)
+#define PHY_CTRL_SEL_DLY_RX_MASK   BIT(17)
+#define FREQSEL_200M_170M  0x0
+#define FREQSEL_170M_140M  0x1
+#define FREQSEL_140M_110M  0x2
+#define FREQSEL_110M_80M   0x3
+#define FREQSEL_80M_50M0x4
+#define FREQSEL_275M_250M  0x5
+#define FREQSEL_250M_225M  0x6
+#define FREQSEL_225M_200M  0x7
+#define PHY_DLL_TIMEOUT_MS 100
+
+#define VERSAL_NET_EMMC_ICLK_PHASE_DDR52_DLY_CHAIN 39
+#define VERSAL_NET_EMMC_ICLK_PHASE_DDR52_DLL   146
+#define VERSAL_NET_PHY_CTRL_STRB90_STRB180_VAL 0X77
+
 struct arasan_sdhci_clk_data {
int clk_phase_in[MMC_TIMING_MMC_HS400 + 1];
int clk_phase_out[MMC_TIMING_MMC_HS400 + 1];
@@ -64,6 +101,7 @@ struct arasan_sdhci_priv {
u32 node_id;
u8 bank;
u8 no_1p8;
+   bool internal_phy_reg;
struct reset_ctl_bulk resets;
 };
 
@@ -84,7 +122,7 @@ __weak int zynqmp_pm_is_function_supported(const u32 api_id, 
const u32 id)
return 1;
 }
 
-#if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL)
+#if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL) || 
defined(CONFIG_ARCH_VERSAL_NET)
 /* Default settings for ZynqMP Clock Phases */
 static const u32 zynqmp_iclk_phases[] = {0, 63, 63, 0, 63,  0,
 0, 183, 54,  0, 0};
@@ -97,6 +135,12 @@ static const u32 versal_iclk_phases[] = {0, 132, 132, 0, 
132,
 static const u32 versal_oclk_phases[] = {0,  60, 48, 0, 48, 72,
 90, 36, 60, 90, 0};
 
+/* Default settings for versal-net eMMC Clock Phases */
+static const u32 versal_net_emmc_iclk_phases[] = {0, 0, 0, 0, 0, 0, 0, 0, 39,
+ 0, 0};
+static const u32 versal_net_emmc_oclk_phases[] = {0, 113, 0, 0, 0, 0, 0, 0,
+ 113, 79, 45};
+
 static const u8 mode2timing[] = {
[MMC_LEGACY] = MMC_TIMING_LEGACY,
[MMC_HS] = MMC_TIMING_MMC_HS,
@@ -111,6 +155,121 @@ static const u8 mode2timing[] = {
[MMC_HS_200] = MMC_TIMING_MMC_HS200,
 };
 
+#if defined(CONFIG_ARCH_VERSAL_NET)
+/**
+ * arasan_phy_set_delaychain - Set eMMC delay chain based Input/Output clock
+ *
+ * @host:  Pointer to the sdhci_host structure
+ * @enable:Enable or disable Delay chain based Tx and Rx clock
+ * Return: None
+ *
+ * Enable or disable eMMC delay chain based Input and Output clock in
+ * PHY_CTRL_REG2
+ */
+static void arasan_phy_set_delaychain(struct sdhci_host *host, bool enable)
+{
+   u32 reg;
+
+   reg = sdhci_readw(host, PHY_CTRL_REG2);
+   if (enable)
+   reg |= PHY_CTRL_SEL_DLY_TX_MASK | PHY_CTRL_SEL_DLY_RX_MASK;
+   else
+   reg &= ~(PHY_CTRL_SEL_DLY_TX_MASK | PHY_CTRL_SEL_DLY_RX_MASK);
+
+   sdhci_writew(host, reg, PHY_CTRL_REG2);
+}
+
+/**
+ * arasan_phy_set_dll - Set eMMC DLL clock
+ *
+ * @host:  Poi

[0/4] Add eMMC 5.1 support for Versal NET

2023-01-10 Thread Ashok Reddy Soma
This patch series,
 - Add support for eMMC5.1 on Versal NET platform by adding new compatible
   string and PHY support.
 - Add support for input and output tap delays for eMMC
 - Add support for enabling HS400 in host capabilities by checking quirk.
 - Add quirk to support HS400 for Versal NET 

Ashok Reddy Soma (4):
  mmc: zynq_sdhci: Add support for eMMC5.1 for Versal NET platform
  mmc: sdhci: Check and call config_dll callback functions
  mmc: sdhci: Enable HS400 support if available in caps
  mmc: zynq_sdhci: Add support and quirk for HS400

 drivers/mmc/sdhci.c  |  20 +++
 drivers/mmc/zynq_sdhci.c | 292 ++-
 include/sdhci.h  |   5 +
 3 files changed, 314 insertions(+), 3 deletions(-)

-- 
2.17.1



[PATCH 4/4] drivers: mmc: Change datatype to fix a warning

2023-01-06 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

tuning_loop_counter is of char type. Change to int to fix below warning.
warning: comparison is always false due to limited range of data type.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 drivers/mmc/zynq_sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 7dcf6ad842..be4075c97a 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -249,7 +249,7 @@ static int arasan_sdhci_execute_tuning(struct mmc *mmc, u8 
opcode)
u32 ctrl;
struct sdhci_host *host;
struct arasan_sdhci_priv *priv = dev_get_priv(mmc->dev);
-   char tuning_loop_counter = SDHCI_TUNING_LOOP_COUNT;
+   int tuning_loop_counter = SDHCI_TUNING_LOOP_COUNT;
 
dev_dbg(mmc->dev, "%s\n", __func__);
 
-- 
2.17.1



[PATCH 3/4] xilinx: versal: Add missing prototype

2023-01-06 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no
previous prototype for 'do_go_exec' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 board/xilinx/versal/board.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index f9f5457ed2..d8562ce47a 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include "../common/board.h"
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-- 
2.17.1



[PATCH 2/4] gpio: zynqmp: Remove unused variable ret

2023-01-06 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

There is a unused variable ret, due to which we are getting sparse warning
as below.
warning: variable 'ret' set but not used [-Wunused-but-set-variable].

Remove variable ret.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 drivers/gpio/zynqmp_gpio_modepin.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/zynqmp_gpio_modepin.c 
b/drivers/gpio/zynqmp_gpio_modepin.c
index 078fd83395..52eda9ceb4 100644
--- a/drivers/gpio/zynqmp_gpio_modepin.c
+++ b/drivers/gpio/zynqmp_gpio_modepin.c
@@ -45,9 +45,8 @@ static int modepin_gpio_set_value(struct udevice *dev, 
unsigned int offset,
 {
u32 ret_payload[PAYLOAD_ARG_CNT];
u32 out_val = 0;
-   int ret;
 
-   ret = get_gpio_modepin(ret_payload);
+   get_gpio_modepin(ret_payload);
if (value)
out_val = OUTVAL(offset) | ret_payload[1];
else
-- 
2.17.1



[PATCH 1/4] xilinx: common: Add missing prototype for board_get_usable_ram_top

2023-01-06 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

Add missing prototype to fix the sparse warning, warning: no previous
prototype for 'board_get_usable_ram_top' [-Wmissing-prototypes].

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 board/xilinx/common/board.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/board/xilinx/common/board.h b/board/xilinx/common/board.h
index 69e642429b..ef7f3f3dce 100644
--- a/board/xilinx/common/board.h
+++ b/board/xilinx/common/board.h
@@ -11,4 +11,8 @@ int board_late_init_xilinx(void);
 
 int xilinx_read_eeprom(void);
 
+#if defined(CONFIG_LMB)
+phys_size_t board_get_usable_ram_top(phys_size_t total_size);
+#endif
+
 #endif /* BOARD_XILINX_COMMON_BOARD_H */
-- 
2.17.1



[PATCH 0/4] Fix sparse warnings

2023-01-06 Thread Ashok Reddy Soma
Run and fix sparse warnings in below files
 -drivers/mmc/zynq_sdhci.c
 -board/xilinx/common/board.h
 -drivers/gpio/zynqmp_gpio_modepin.c
 -board/xilinx/versal/board.c


Algapally Santosh Sagar (4):
  xilinx: common: Add missing prototype for board_get_usable_ram_top
  gpio: zynqmp: Remove unused variable ret
  xilinx: versal: Add missing prototype
  drivers: mmc: Change datatype to fix a warning

 board/xilinx/common/board.h| 4 
 board/xilinx/versal/board.c| 1 +
 drivers/gpio/zynqmp_gpio_modepin.c | 3 +--
 drivers/mmc/zynq_sdhci.c   | 2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

-- 
2.17.1



[PATCH v2] mtd: nand: Mark reserved blocks

2023-01-05 Thread Ashok Reddy Soma
Reserved blocks are used for storing bad block tables. With "nand bad"
command, these reserved blocks are shown as bad blocks. This is leading
to confusion when compared with Linux bad blocks. Hence, display
"bbt reserved" when printing reserved blocks with "nand bad" command.

To acheive this, return 2 which represents reserved from nand_isbad_bbt()
instead of 1 in case of reserved blocks and catch it in cmd/nand.c.

"nand bad" command display's hexadecimal numbers, so add "0x" prefix.

Example log will show up as below.

ZynqMP> nand bad

Device 0 bad blocks:
  0x0040
  0x1680
  0x16c0
  0x1700
  0x3d80
  0x3e40
  0xe840
  0xff00 (bbt reserved)
  0xff40 (bbt reserved)
  0xff80 (bbt reserved)
  0xffc0 (bbt reserved)
  0x11680
  0x116c0
  0x1ff00(bbt reserved)
  0x1ff40(bbt reserved)
  0x1ff80(bbt reserved)
  0x1ffc00000(bbt reserved)

Signed-off-by: Ashok Reddy Soma 
Reviewed-by: Michael Trimarchi 
---

Changes in v2:
 - Changed "Reserved for bbt" to (bbt reserved)
 - Updated description and the log in the description

 cmd/nand.c  | 9 ++---
 drivers/mtd/nand/raw/nand_bbt.c | 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/cmd/nand.c b/cmd/nand.c
index 9a723f5757..b41e54ec42 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -567,9 +567,12 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int 
argc,
 
if (strcmp(cmd, "bad") == 0) {
printf("\nDevice %d bad blocks:\n", dev);
-   for (off = 0; off < mtd->size; off += mtd->erasesize)
-   if (nand_block_isbad(mtd, off))
-   printf("  %08llx\n", (unsigned long long)off);
+   for (off = 0; off < mtd->size; off += mtd->erasesize) {
+   ret = nand_block_isbad(mtd, off);
+   if (ret)
+   printf("  0x%08llx%s\n", (unsigned long 
long)off,
+  ret == 2 ? "\t (bbt reserved)" : "");
+   }
return 0;
}
 
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c
index 911472e91e..cd451870a6 100644
--- a/drivers/mtd/nand/raw/nand_bbt.c
+++ b/drivers/mtd/nand/raw/nand_bbt.c
@@ -1330,6 +1330,7 @@ int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs)
  * @mtd: MTD device structure
  * @offs: offset in the device
  * @allowbbt: allow access to bad block table region
+ * Return: 0 - good block, 1- bad block, 2 - reserved block
  */
 int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
 {
@@ -1348,7 +1349,7 @@ int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int 
allowbbt)
case BBT_BLOCK_WORN:
return 1;
case BBT_BLOCK_RESERVED:
-   return allowbbt ? 0 : 1;
+   return allowbbt ? 0 : 2;
}
return 1;
 }
-- 
2.17.1



[PATCH] mtd: nand: Mark reserved blocks

2023-01-05 Thread Ashok Reddy Soma
Reserved blocks are used for storing bad block tables. With "nand bad"
command, these reserved blocks are shown as bad blocks. This is leading
to confusion when compared with Linux bad blocks. Hence, display
"Reserved for bbt" when printing reserved blocks with "nand bad" command.

To acheive this, return 2 which represents reserved from nand_isbad_bbt()
instead of 1 in case of reserved blocks and catch it in cmd/nand.c.

"nand bad" command display's hexadecimal numbers, so add "0x" prefix.

Example log will show up as below.

ZynqMP> nand bad

Device 0 bad blocks:
  0x0040
  0x1680
  0x16c0
  0x1700
  0x3d80
  0x3e40
  0xe840
  0xff00 <--- Reserved for bbt
  0xff40 <--- Reserved for bbt
  0xff80 <--- Reserved for bbt
  0xffc0 <--- Reserved for bbt
  0x11680
  0x116c0
  0x1ff00<--- Reserved for bbt
  0x1ff40<--- Reserved for bbt
  0x1ff80<--- Reserved for bbt
  0x1ffc0<--- Reserved for bbt

Signed-off-by: Ashok Reddy Soma 
---

 cmd/nand.c  | 9 ++---
 drivers/mtd/nand/raw/nand_bbt.c | 3 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/cmd/nand.c b/cmd/nand.c
index 9a723f5757..feb6b0e3ec 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -567,9 +567,12 @@ static int do_nand(struct cmd_tbl *cmdtp, int flag, int 
argc,
 
if (strcmp(cmd, "bad") == 0) {
printf("\nDevice %d bad blocks:\n", dev);
-   for (off = 0; off < mtd->size; off += mtd->erasesize)
-   if (nand_block_isbad(mtd, off))
-   printf("  %08llx\n", (unsigned long long)off);
+   for (off = 0; off < mtd->size; off += mtd->erasesize) {
+   ret = nand_block_isbad(mtd, off);
+   if (ret)
+   printf("  0x%08llx%s\n", (unsigned long 
long)off,
+  ret == 2 ? "\t <--- Reserved for bbt" : 
"");
+   }
return 0;
}
 
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c
index 911472e91e..cd451870a6 100644
--- a/drivers/mtd/nand/raw/nand_bbt.c
+++ b/drivers/mtd/nand/raw/nand_bbt.c
@@ -1330,6 +1330,7 @@ int nand_isreserved_bbt(struct mtd_info *mtd, loff_t offs)
  * @mtd: MTD device structure
  * @offs: offset in the device
  * @allowbbt: allow access to bad block table region
+ * Return: 0 - good block, 1- bad block, 2 - reserved block
  */
 int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt)
 {
@@ -1348,7 +1349,7 @@ int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int 
allowbbt)
case BBT_BLOCK_WORN:
return 1;
case BBT_BLOCK_RESERVED:
-   return allowbbt ? 0 : 1;
+   return allowbbt ? 0 : 2;
}
return 1;
 }
-- 
2.17.1



[PATCH] spi: cadence-qspi: Remove condition for calling enable linear mode

2022-11-29 Thread Ashok Reddy Soma
cadence_qspi_apb_enable_linear_mode() has a weak function defined, so no
need to gaurd this under if (CONFIG_IS_ENABLED(ARCH_VERSAL)).

In cadence_qspi_apb_write_execute(), enable linear mode is called twice by
mistake, remove extra one.

Signed-off-by: Ashok Reddy Soma 
---

 drivers/spi/cadence_qspi_apb.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index cfae5dcbda..d1f89138ef 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -735,8 +735,7 @@ int cadence_qspi_apb_read_execute(struct cadence_spi_priv 
*priv,
void *buf = op->data.buf.in;
size_t len = op->data.nbytes;
 
-   if (CONFIG_IS_ENABLED(ARCH_VERSAL))
-   cadence_qspi_apb_enable_linear_mode(true);
+   cadence_qspi_apb_enable_linear_mode(true);
 
if (priv->use_dac_mode && (from + len < priv->ahbsize)) {
if (len < 256 ||
@@ -905,9 +904,6 @@ int cadence_qspi_apb_write_execute(struct cadence_spi_priv 
*priv,
const void *buf = op->data.buf.out;
size_t len = op->data.nbytes;
 
-   if (CONFIG_IS_ENABLED(ARCH_VERSAL))
-   cadence_qspi_apb_enable_linear_mode(true);
-
/*
 * Some flashes like the Cypress Semper flash expect a dummy 4-byte
 * address (all 0s) with the read status register command in DTR mode.
-- 
2.17.1



[PATCH v2] spi: zynqmp_gqspi: Update tapdelay value

2022-11-23 Thread Ashok Reddy Soma
From: T Karthik Reddy 

The driver was using an incorrect value for GQSPI_LPBK_DLY_ADJ_DLY_1
tapdelay for Versal for frequencies above 100MHz. Change it from 2 to 1
based on the recommended value in IP spec.

Signed-off-by: T Karthik Reddy 
Signed-off-by: Ashok Reddy Soma 
---

Changes in v2:
 - Updated description to explain why MACRO value is changed.

 drivers/spi/zynqmp_gqspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index 48eff777df..83a5c8aebf 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -94,7 +94,7 @@
 
 #define GQSPI_BAUD_DIV_SHIFT   2
 #define GQSPI_LPBK_DLY_ADJ_LPBK_SHIFT  5
-#define GQSPI_LPBK_DLY_ADJ_DLY_1   0x2
+#define GQSPI_LPBK_DLY_ADJ_DLY_1   0x1
 #define GQSPI_LPBK_DLY_ADJ_DLY_1_SHIFT 3
 #define GQSPI_LPBK_DLY_ADJ_DLY_0   0x3
 #define GQSPI_USE_DATA_DLY 0x1
-- 
2.17.1



[PATCH] spi: zynqmp_gqspi: Update tapdelay value

2022-11-22 Thread Ashok Reddy Soma
From: T Karthik Reddy 

Update GQSPI_LPBK_DLY_ADJ_DLY_1 tapdelay value for Versal for
frequencies above 100MHz.

Signed-off-by: T Karthik Reddy 
Signed-off-by: Ashok Reddy Soma 
---

 drivers/spi/zynqmp_gqspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index 48eff777df..83a5c8aebf 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -94,7 +94,7 @@
 
 #define GQSPI_BAUD_DIV_SHIFT   2
 #define GQSPI_LPBK_DLY_ADJ_LPBK_SHIFT  5
-#define GQSPI_LPBK_DLY_ADJ_DLY_1   0x2
+#define GQSPI_LPBK_DLY_ADJ_DLY_1   0x1
 #define GQSPI_LPBK_DLY_ADJ_DLY_1_SHIFT 3
 #define GQSPI_LPBK_DLY_ADJ_DLY_0   0x3
 #define GQSPI_USE_DATA_DLY 0x1
-- 
2.17.1



[PATCH] mtd: spi-nor-core: Invert logic to reflect sst26 flash unlocked

2022-11-21 Thread Ashok Reddy Soma
From: Algapally Santosh Sagar 

flash_is_locked is changed to flash_is_unlocked with commit 513c6071ce73
("mtd: spi: Convert is_locked callback to is_unlocked"). sst26_is_locked()
is also changed to sst26_is_unlocked() but the logic remained same.
Invert the logic for the flash lock/unlock to work properly.

Signed-off-by: Algapally Santosh Sagar 
Signed-off-by: Ashok Reddy Soma 
---

 drivers/mtd/spi/spi-nor-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 78de3c5281..1ea8363d9f 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -1600,7 +1600,7 @@ static int sst26_is_unlocked(struct spi_nor *nor, loff_t 
ofs, uint64_t len)
ofs -= ofs & (SZ_64K - 1);
len = len & (SZ_64K - 1) ? (len & ~(SZ_64K - 1)) + SZ_64K : len;
 
-   return sst26_lock_ctl(nor, ofs, len, SST26_CTL_CHECK);
+   return !sst26_lock_ctl(nor, ofs, len, SST26_CTL_CHECK);
 }
 
 static int sst_write_byteprogram(struct spi_nor *nor, loff_t to, size_t len,
-- 
2.17.1



[PATCH 3/3] arm64: versal: Add octal spi flash mini u-boot configuration

2022-11-16 Thread Ashok Reddy Soma
Add configuration file for mini u-boot configuration which runs on a
smaller footprint from on chip memory(OCM). This configuration has
required CONFIG's enabled to support octal spi flash and uses DCC terminal
for console output. Add required dts for octal spi flash mini u-boot
configuration.

Signed-off-by: Ashok Reddy Soma 
---

Changes in v3:
 - Add dts files for octal flash mini u-boot.
 - Add below configs to fix compilation error.
   CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
   CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xFFFE

Changes in v2:
 - Run savedefconfig and updated mini config for ospi to align with
   latest Kconfig layout

 arch/arm/dts/Makefile |  1 +
 arch/arm/dts/versal-mini-ospi-single.dts  | 16 +
 arch/arm/dts/versal-mini-ospi.dtsi| 77 +++
 configs/xilinx_versal_mini_ospi_defconfig | 72 +
 4 files changed, 166 insertions(+)
 create mode 100644 arch/arm/dts/versal-mini-ospi-single.dts
 create mode 100644 arch/arm/dts/versal-mini-ospi.dtsi
 create mode 100644 configs/xilinx_versal_mini_ospi_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 7d3cac0eb7..43951a7731 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -383,6 +383,7 @@ dtb-$(CONFIG_ARCH_VERSAL) += \
versal-mini.dtb \
versal-mini-emmc0.dtb \
versal-mini-emmc1.dtb \
+   versal-mini-ospi-single.dtb \
versal-mini-qspi-single.dtb \
xilinx-versal-virt.dtb
 dtb-$(CONFIG_ARCH_VERSAL_NET) += \
diff --git a/arch/arm/dts/versal-mini-ospi-single.dts 
b/arch/arm/dts/versal-mini-ospi-single.dts
new file mode 100644
index 00..23f6e47a18
--- /dev/null
+++ b/arch/arm/dts/versal-mini-ospi-single.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Xilinx Versal QSPI single DTS
+ *
+ * Copyright (C) 2018-2020 Xilinx, Inc.
+ */
+
+#include "versal-mini-ospi.dtsi"
+
+/ {
+   model = "Xilinx Versal MINI OSPI SINGLE";
+};
+
+ {
+   spi-rx-bus-width = <8>;
+};
diff --git a/arch/arm/dts/versal-mini-ospi.dtsi 
b/arch/arm/dts/versal-mini-ospi.dtsi
new file mode 100644
index 00..a4b76e2b99
--- /dev/null
+++ b/arch/arm/dts/versal-mini-ospi.dtsi
@@ -0,0 +1,77 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Xilinx Versal Mini OSPI Configuration
+ *
+ * (C) Copyright 2018-2019, Xilinx, Inc.
+ *
+ * Siva Durga Prasad 
+ * Michal Simek 
+ */
+
+/dts-v1/;
+
+/ {
+   compatible = "xlnx,versal";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   model = "Xilinx Versal MINI OSPI";
+
+   clk125: clk125 {
+   compatible = "fixed-clock";
+   #clock-cells = <0x0>;
+   clock-frequency = <12500>;
+   };
+
+   dcc: dcc {
+   compatible = "arm,dcc";
+   status = "okay";
+   u-boot,dm-pre-reloc;
+   };
+
+   amba: amba {
+   u-boot,dm-pre-reloc;
+   compatible = "simple-bus";
+   #address-cells = <0x2>;
+   #size-cells = <0x2>;
+   ranges;
+
+   ospi: spi@f101 {
+   compatible = "cadence,qspi", "cdns,qspi-nor";
+   status = "okay";
+   reg = <0 0xf101 0 0x1 0 0xc000 0 
0x2000>;
+   clock-names = "ref_clk", "pclk";
+   clocks = < >;
+   bus-num = <2>;
+   num-cs = <1>;
+   cdns,fifo-depth = <256>;
+   cdns,fifo-width = <4>;
+   cdns,is-dma = <1>;
+   cdns,trigger-address = <0xc000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   flash0: flash@0 {
+   compatible = "n25q512a", "micron,m25p80",
+"jedec,spi-nor";
+   reg = <0x0>;
+   spi-tx-bus-width = <8>;
+   spi-rx-bus-width = <8>;
+   spi-max-frequency = <2000>;
+   };
+   };
+   };
+
+   aliases {
+   serial0 = 
+   spi0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200";
+   };
+
+   memory@fffc {
+   device_type = "memory";
+   reg = <0x0 0xfffc 0x0 0x4>;
+   };
+};
diff --git a/configs/xilinx_versal_mini_ospi_defconfig 
b/configs/xilinx_versal_mini_ospi_defconfig
new file mode 100644
index 0

[PATCH 2/3] spi: cadence-qspi: Fix compilation error in mini u-boot flash reset

2022-11-16 Thread Ashok Reddy Soma
When cadence_qspi_versal_flash_reset() function is called in mini
u-boot where there is no firmware support, it is missing defines for
macro's BOOT_MODE_POR_0 & BOOT_MODE_POR_1. Remove them and replace with
already define macro's which have same values as these.

Signed-off-by: Ashok Reddy Soma 
---

(no changes since v1)

 drivers/spi/cadence_ospi_versal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/cadence_ospi_versal.c 
b/drivers/spi/cadence_ospi_versal.c
index a9547a8200..e0d5e6b9e6 100644
--- a/drivers/spi/cadence_ospi_versal.c
+++ b/drivers/spi/cadence_ospi_versal.c
@@ -182,11 +182,11 @@ int cadence_qspi_versal_flash_reset(struct udevice *dev)
 
/* set direction as output */
writel((readl(BOOT_MODE_DIR) | BIT(FLASH_RESET_GPIO)),
-  BOOT_MODE_POR_0);
+  BOOT_MODE_DIR);
 
/* Data output enable */
writel((readl(BOOT_MODE_OUT) | BIT(FLASH_RESET_GPIO)),
-  BOOT_MODE_POR_1);
+  BOOT_MODE_OUT);
 
/* IOU SLCR write enable */
writel(0, WPROT_PMC_MIO);
-- 
2.17.1



[PATCH 1/3] arm64: versal: Add qspi flash mini u-boot configuration

2022-11-16 Thread Ashok Reddy Soma
Add configuration file for mini u-boot configuration which runs on a
smaller footprint from on chip memory(OCM). This configuration has
required CONFIG's enabled to support qspi flash and uses DCC terminal
for console output. Add required dts files for qspi mini configuration.

Signed-off-by: Ashok Reddy Soma 

---

Changes in v3:
 - Added dts files for qspi mini configuration
 - Added CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xfffe
 to fix compilation error.

Changes in v2:
 - Removed configs/xilinx_* from MAINTAINERS as, it is already taken  care.
 - Run savedefconfig and updated mini config to align with latest  Kconfig 
layout

 arch/arm/dts/Makefile |  1 +
 arch/arm/dts/versal-mini-qspi-single.dts  | 16 +
 arch/arm/dts/versal-mini-qspi.dtsi| 72 ++
 configs/xilinx_versal_mini_qspi_defconfig | 75 +++
 4 files changed, 164 insertions(+)
 create mode 100644 arch/arm/dts/versal-mini-qspi-single.dts
 create mode 100644 arch/arm/dts/versal-mini-qspi.dtsi
 create mode 100644 configs/xilinx_versal_mini_qspi_defconfig

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index e89598af30..7d3cac0eb7 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -383,6 +383,7 @@ dtb-$(CONFIG_ARCH_VERSAL) += \
versal-mini.dtb \
versal-mini-emmc0.dtb \
versal-mini-emmc1.dtb \
+   versal-mini-qspi-single.dtb \
xilinx-versal-virt.dtb
 dtb-$(CONFIG_ARCH_VERSAL_NET) += \
versal-net-mini.dtb \
diff --git a/arch/arm/dts/versal-mini-qspi-single.dts 
b/arch/arm/dts/versal-mini-qspi-single.dts
new file mode 100644
index 00..ee518d5d6a
--- /dev/null
+++ b/arch/arm/dts/versal-mini-qspi-single.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Xilinx Versal QSPI single DTS
+ *
+ * Copyright (C) 2018-2019 Xilinx, Inc.
+ */
+
+#include "versal-mini-qspi.dtsi"
+
+/ {
+   model = "Xilinx Versal MINI QSPI SINGLE";
+};
+
+ {
+   spi-rx-bus-width = <4>;
+};
diff --git a/arch/arm/dts/versal-mini-qspi.dtsi 
b/arch/arm/dts/versal-mini-qspi.dtsi
new file mode 100644
index 00..71d0ba5e00
--- /dev/null
+++ b/arch/arm/dts/versal-mini-qspi.dtsi
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dts file for Xilinx Versal Mini QSPI Configuration
+ *
+ * (C) Copyright 2018-2019, Xilinx, Inc.
+ *
+ * Siva Durga Prasad 
+ * Michal Simek 
+ */
+
+/dts-v1/;
+
+/ {
+   compatible = "xlnx,versal";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   model = "Xilinx Versal MINI QSPI";
+
+   clk150: clk150 {
+   compatible = "fixed-clock";
+   #clock-cells = <0x0>;
+   clock-frequency = <15000>;
+   };
+
+   dcc: dcc {
+   compatible = "arm,dcc";
+   status = "okay";
+   u-boot,dm-pre-reloc;
+   };
+
+   amba: amba {
+   u-boot,dm-pre-reloc;
+   compatible = "simple-bus";
+   #address-cells = <0x2>;
+   #size-cells = <0x2>;
+   ranges;
+
+   qspi: spi@f103 {
+   compatible = "xlnx,versal-qspi-1.0";
+   status = "okay";
+   clock-names = "ref_clk", "pclk";
+   num-cs = <0x1>;
+   reg = <0x0 0xf103 0x0 0x1000>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   clocks = < >;
+
+   flash0: flash@0 {
+   compatible = "n25q512a", "micron,m25p80",
+"jedec,spi-nor";
+   reg = <0x0>;
+   spi-tx-bus-width = <4>;
+   spi-rx-bus-width = <4>;
+   spi-max-frequency = <2000>;
+   };
+   };
+   };
+
+   aliases {
+   serial0 = 
+   spi0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200";
+   };
+
+   memory@fffc {
+   device_type = "memory";
+   reg = <0x0 0xfffc 0x0 0x4>;
+   };
+};
diff --git a/configs/xilinx_versal_mini_qspi_defconfig 
b/configs/xilinx_versal_mini_qspi_defconfig
new file mode 100644
index 00..0062f6a69f
--- /dev/null
+++ b/configs/xilinx_versal_mini_qspi_defconfig
@@ -0,0 +1,75 @@
+CONFIG_ARM=y
+CONFIG_SYS_CONFIG_NAME="xilinx_versal_mini_qspi"
+CONFIG_COUNTER_FREQUENCY=1
+CONFIG_ARCH_VERSAL=y
+CONFIG_TEXT_BASE=0xFFFC0

[PATCH 0/3] Add quad & octal spi flash mini u-boot configuration files

2022-11-16 Thread Ashok Reddy Soma
Add new configuration files and device trees for quad and octal spi flash
mini u-boot. With these configs's mini u-boot will run from on chip
memory(OCM) and uses DCC terminal for console output.

Changes in v3:
 - Added dts files for qspi mini configuration
 - Added CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xfffe
 to fix compilation error.
 - Add dts files for octal flash mini u-boot.
 - Add below configs to fix compilation error.
   CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
   CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xFFFE

Changes in v2:
 - Removed configs/xilinx_* from MAINTAINERS as, it is already taken  care.
 - Run savedefconfig and updated mini config to align with latest  Kconfig 
layout
 - Run savedefconfig and updated mini config for ospi to align with
   latest Kconfig layout

Ashok Reddy Soma (3):
  arm64: versal: Add qspi flash mini u-boot configuration
  spi: cadence-qspi: Fix compilation error in mini u-boot flash reset
  arm64: versal: Add octal spi flash mini u-boot configuration

 arch/arm/dts/Makefile |  2 +
 arch/arm/dts/versal-mini-ospi-single.dts  | 16 +
 arch/arm/dts/versal-mini-ospi.dtsi| 77 +++
 arch/arm/dts/versal-mini-qspi-single.dts  | 16 +
 arch/arm/dts/versal-mini-qspi.dtsi| 72 +
 configs/xilinx_versal_mini_ospi_defconfig | 72 +
 configs/xilinx_versal_mini_qspi_defconfig | 75 ++
 drivers/spi/cadence_ospi_versal.c |  4 +-
 8 files changed, 332 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/versal-mini-ospi-single.dts
 create mode 100644 arch/arm/dts/versal-mini-ospi.dtsi
 create mode 100644 arch/arm/dts/versal-mini-qspi-single.dts
 create mode 100644 arch/arm/dts/versal-mini-qspi.dtsi
 create mode 100644 configs/xilinx_versal_mini_ospi_defconfig
 create mode 100644 configs/xilinx_versal_mini_qspi_defconfig

-- 
2.17.1



  1   2   3   >