All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver
@ 2020-02-26 10:38 Michal Simek
  2020-02-26 10:38 ` [PATCH v2 1/4] nand: raw: Do not free xnand structure Michal Simek
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Michal Simek @ 2020-02-26 10:38 UTC (permalink / raw)
  To: u-boot

Hi,

this series is switching Zynq to DM based cfi driver. On regular u-boot
this is described via SMCC but for cse it is enough to place just node to
DT.

Thanks,
Michal

Changes in v2:
- Add missing zynq cse nor conversion

Michal Simek (4):
  nand: raw: Do not free xnand structure
  nand: raw: zynq: Do not try to probe driver if nand flash is disabled
  ARM: zynq: Do not report NOR flash detection failure
  ARM: zynq: Enable DM for CFI NOR flash

 arch/arm/dts/zynq-cse-nor.dts      | 14 ++++++++++++++
 configs/xilinx_zynq_virt_defconfig |  1 +
 configs/zynq_cse_nor_defconfig     |  3 +++
 drivers/mtd/nand/raw/zynq_nand.c   | 25 ++++++++++++++-----------
 include/configs/zynq-common.h      |  3 +--
 5 files changed, 33 insertions(+), 13 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/4] nand: raw: Do not free xnand structure
  2020-02-26 10:38 [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
@ 2020-02-26 10:38 ` Michal Simek
  2020-04-03 14:44   ` Jagan Teki
  2020-02-26 10:38 ` [PATCH v2 2/4] nand: raw: zynq: Do not try to probe driver if nand flash is disabled Michal Simek
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Michal Simek @ 2020-02-26 10:38 UTC (permalink / raw)
  To: u-boot

xnand structure is private data structure and it is handled by core and
probe shouldn't touch it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2: None

 drivers/mtd/nand/raw/zynq_nand.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c
index 28db4153f5e0..703914969289 100644
--- a/drivers/mtd/nand/raw/zynq_nand.c
+++ b/drivers/mtd/nand/raw/zynq_nand.c
@@ -1081,18 +1081,18 @@ static int zynq_nand_probe(struct udevice *dev)
 	u8 set_feature[4] = {ONDIE_ECC_FEATURE_ENABLE, 0x00, 0x00, 0x00};
 	unsigned long ecc_cfg;
 	int ondie_ecc_enabled = 0;
-	int err = -1;
 	int is_16bit_bw;
 
 	smc->reg = (struct zynq_nand_smc_regs *)dev_read_addr(dev);
 	of_nand = dev_read_subnode(dev, "flash at e1000000");
 	if (!ofnode_valid(of_nand)) {
 		printf("Failed to find nand node in dt\n");
-		goto fail;
+		return -ENODEV;
 	}
+
 	if (ofnode_read_resource(of_nand, 0, &res)) {
 		printf("Failed to get nand resource\n");
-		goto fail;
+		return -ENODEV;
 	}
 
 	xnand->nand_base = (void __iomem *)res.start;
@@ -1119,7 +1119,7 @@ static int zynq_nand_probe(struct udevice *dev)
 	if (is_16bit_bw == NAND_BW_UNKNOWN) {
 		printf("%s: Unable detect NAND based on MIO settings\n",
 		       __func__);
-		goto fail;
+		return -EINVAL;
 	}
 
 	if (is_16bit_bw == NAND_BW_16BIT)
@@ -1130,13 +1130,13 @@ static int zynq_nand_probe(struct udevice *dev)
 	/* Initialize the NAND flash interface on NAND controller */
 	if (zynq_nand_init_nand_flash(mtd, nand_chip->options) < 0) {
 		printf("%s: nand flash init failed\n", __func__);
-		goto fail;
+		return -EINVAL;
 	}
 
 	/* first scan to find the device and get the page size */
 	if (nand_scan_ident(mtd, 1, NULL)) {
 		printf("%s: nand_scan_ident failed\n", __func__);
-		goto fail;
+		return -EINVAL;
 	}
 	/* Send the command for reading device ID */
 	nand_chip->cmdfunc(mtd, NAND_CMD_RESET, -1, -1);
@@ -1261,14 +1261,12 @@ static int zynq_nand_probe(struct udevice *dev)
 	/* Second phase scan */
 	if (nand_scan_tail(mtd)) {
 		printf("%s: nand_scan_tail failed\n", __func__);
-		goto fail;
+		return -EINVAL;
 	}
 	if (nand_register(0, mtd))
-		goto fail;
+		return -EINVAL;
+
 	return 0;
-fail:
-	free(xnand);
-	return err;
 }
 
 static const struct udevice_id zynq_nand_dt_ids[] = {
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/4] nand: raw: zynq: Do not try to probe driver if nand flash is disabled
  2020-02-26 10:38 [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
  2020-02-26 10:38 ` [PATCH v2 1/4] nand: raw: Do not free xnand structure Michal Simek
@ 2020-02-26 10:38 ` Michal Simek
  2020-04-03 14:44   ` Jagan Teki
  2020-02-26 10:38 ` [PATCH v2 3/4] ARM: zynq: Do not report NOR flash detection failure Michal Simek
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Michal Simek @ 2020-02-26 10:38 UTC (permalink / raw)
  To: u-boot

There is no reason to continue when DT status property indicates that NAND
flash is disabled. But that means that NOR flash should be present that's
why try it find it out.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2: None

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

diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c
index 703914969289..0aea83dac0e6 100644
--- a/drivers/mtd/nand/raw/zynq_nand.c
+++ b/drivers/mtd/nand/raw/zynq_nand.c
@@ -1090,6 +1090,11 @@ static int zynq_nand_probe(struct udevice *dev)
 		return -ENODEV;
 	}
 
+	if (!ofnode_is_available(of_nand)) {
+		debug("Nand node in dt disabled\n");
+		return dm_scan_fdt_dev(dev);
+	}
+
 	if (ofnode_read_resource(of_nand, 0, &res)) {
 		printf("Failed to get nand resource\n");
 		return -ENODEV;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 3/4] ARM: zynq: Do not report NOR flash detection failure
  2020-02-26 10:38 [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
  2020-02-26 10:38 ` [PATCH v2 1/4] nand: raw: Do not free xnand structure Michal Simek
  2020-02-26 10:38 ` [PATCH v2 2/4] nand: raw: zynq: Do not try to probe driver if nand flash is disabled Michal Simek
@ 2020-02-26 10:38 ` Michal Simek
  2020-02-26 10:38 ` [PATCH v2 4/4] ARM: zynq: Enable DM for CFI NOR flash Michal Simek
  2020-04-06 11:00 ` [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
  4 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2020-02-26 10:38 UTC (permalink / raw)
  To: u-boot

With multi defconfig targeting several board configurations bug report like
below is so verbose.
Flash: ## Unknown flash on Bank 1 - Size = 0x00000000 = 0 MB
0 Bytes

Do not report that message and simply say "Flash: 0 Bytes" because most of
Zynq boards are using different type of flashes than NOR.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2: None

 include/configs/zynq-common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index b1cef4d4695f..33fac35f6e32 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -51,6 +51,7 @@
 # define CONFIG_SYS_FLASH_WRITE_TOUT	5000
 # define CONFIG_FLASH_SHOW_PROGRESS	10
 # undef CONFIG_SYS_FLASH_EMPTY_INFO
+# define CONFIG_SYS_FLASH_QUIET_TEST
 #endif
 
 #ifdef CONFIG_NAND_ZYNQ
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 4/4] ARM: zynq: Enable DM for CFI NOR flash
  2020-02-26 10:38 [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
                   ` (2 preceding siblings ...)
  2020-02-26 10:38 ` [PATCH v2 3/4] ARM: zynq: Do not report NOR flash detection failure Michal Simek
@ 2020-02-26 10:38 ` Michal Simek
  2020-04-06 11:00 ` [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
  4 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2020-02-26 10:38 UTC (permalink / raw)
  To: u-boot

With multi defconfig NOR flash information about NOR should be taken from
DT that's why there is no reason to specify address and sizes via fixed
config.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v2:
- Add missing zynq cse nor conversion

 arch/arm/dts/zynq-cse-nor.dts      | 14 ++++++++++++++
 configs/xilinx_zynq_virt_defconfig |  1 +
 configs/zynq_cse_nor_defconfig     |  3 +++
 include/configs/zynq-common.h      |  2 --
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/arch/arm/dts/zynq-cse-nor.dts b/arch/arm/dts/zynq-cse-nor.dts
index 4030851eb36d..197fbd717aae 100644
--- a/arch/arm/dts/zynq-cse-nor.dts
+++ b/arch/arm/dts/zynq-cse-nor.dts
@@ -71,6 +71,20 @@
 				reg = <0x100 0x100>;
 			};
 		};
+
+		/*
+		 * This is partially hack because it is normally subnode of smcc
+		 * but for mini U-Boot there is no reason to enable SMCC driver
+		 * which does almost nothing in NOR flash configuration that's
+		 * why place cfi-flash directly here.
+		 */
+		flash at e2000000 {
+			u-boot,dm-pre-reloc;
+			compatible = "cfi-flash";
+			reg = <0xe2000000 0x2000000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+		};
 	};
 };
 
diff --git a/configs/xilinx_zynq_virt_defconfig b/configs/xilinx_zynq_virt_defconfig
index 2e9f3a0f7508..08b43de103a1 100644
--- a/configs/xilinx_zynq_virt_defconfig
+++ b/configs/xilinx_zynq_virt_defconfig
@@ -61,6 +61,7 @@ CONFIG_MMC_SDHCI_ZYNQ=y
 CONFIG_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
+CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 CONFIG_MTD_RAW_NAND=y
diff --git a/configs/zynq_cse_nor_defconfig b/configs/zynq_cse_nor_defconfig
index e2b9454c15c8..3b4e2f93fa30 100644
--- a/configs/zynq_cse_nor_defconfig
+++ b/configs/zynq_cse_nor_defconfig
@@ -52,8 +52,11 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 # CONFIG_DM_DEVICE_REMOVE is not set
 CONFIG_SPL_DM_SEQ_ALIAS=y
 # CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_FLASH_CFI_DRIVER=y
+CONFIG_CFI_FLASH=y
 CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_SYS_FLASH_CFI=y
 # CONFIG_EFI_LOADER is not set
diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h
index 33fac35f6e32..1eaf65b0a2a1 100644
--- a/include/configs/zynq-common.h
+++ b/include/configs/zynq-common.h
@@ -43,8 +43,6 @@
 
 /* NOR */
 #ifdef CONFIG_MTD_NOR_FLASH
-# define CONFIG_SYS_FLASH_BASE		0xE2000000
-# define CONFIG_SYS_FLASH_SIZE		(16 * 1024 * 1024)
 # define CONFIG_SYS_MAX_FLASH_BANKS	1
 # define CONFIG_SYS_MAX_FLASH_SECT	512
 # define CONFIG_SYS_FLASH_ERASE_TOUT	1000
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 1/4] nand: raw: Do not free xnand structure
  2020-02-26 10:38 ` [PATCH v2 1/4] nand: raw: Do not free xnand structure Michal Simek
@ 2020-04-03 14:44   ` Jagan Teki
  0 siblings, 0 replies; 8+ messages in thread
From: Jagan Teki @ 2020-04-03 14:44 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 26, 2020 at 4:08 PM Michal Simek <michal.simek@xilinx.com> wrote:
>
> xnand structure is private data structure and it is handled by core and
> probe shouldn't touch it.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 2/4] nand: raw: zynq: Do not try to probe driver if nand flash is disabled
  2020-02-26 10:38 ` [PATCH v2 2/4] nand: raw: zynq: Do not try to probe driver if nand flash is disabled Michal Simek
@ 2020-04-03 14:44   ` Jagan Teki
  0 siblings, 0 replies; 8+ messages in thread
From: Jagan Teki @ 2020-04-03 14:44 UTC (permalink / raw)
  To: u-boot

On Wed, Feb 26, 2020 at 4:09 PM Michal Simek <michal.simek@xilinx.com> wrote:
>
> There is no reason to continue when DT status property indicates that NAND
> flash is disabled. But that means that NOR flash should be present that's
> why try it find it out.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---

Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver
  2020-02-26 10:38 [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
                   ` (3 preceding siblings ...)
  2020-02-26 10:38 ` [PATCH v2 4/4] ARM: zynq: Enable DM for CFI NOR flash Michal Simek
@ 2020-04-06 11:00 ` Michal Simek
  4 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2020-04-06 11:00 UTC (permalink / raw)
  To: u-boot

st 26. 2. 2020 v 11:38 odes?latel Michal Simek <michal.simek@xilinx.com> napsal:
>
> Hi,
>
> this series is switching Zynq to DM based cfi driver. On regular u-boot
> this is described via SMCC but for cse it is enough to place just node to
> DT.
>
> Thanks,
> Michal
>
> Changes in v2:
> - Add missing zynq cse nor conversion
>
> Michal Simek (4):
>   nand: raw: Do not free xnand structure
>   nand: raw: zynq: Do not try to probe driver if nand flash is disabled
>   ARM: zynq: Do not report NOR flash detection failure
>   ARM: zynq: Enable DM for CFI NOR flash
>
>  arch/arm/dts/zynq-cse-nor.dts      | 14 ++++++++++++++
>  configs/xilinx_zynq_virt_defconfig |  1 +
>  configs/zynq_cse_nor_defconfig     |  3 +++
>  drivers/mtd/nand/raw/zynq_nand.c   | 25 ++++++++++++++-----------
>  include/configs/zynq-common.h      |  3 +--
>  5 files changed, 33 insertions(+), 13 deletions(-)
>
> --
> 2.25.1
>

Applied all.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-06 11:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 10:38 [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek
2020-02-26 10:38 ` [PATCH v2 1/4] nand: raw: Do not free xnand structure Michal Simek
2020-04-03 14:44   ` Jagan Teki
2020-02-26 10:38 ` [PATCH v2 2/4] nand: raw: zynq: Do not try to probe driver if nand flash is disabled Michal Simek
2020-04-03 14:44   ` Jagan Teki
2020-02-26 10:38 ` [PATCH v2 3/4] ARM: zynq: Do not report NOR flash detection failure Michal Simek
2020-02-26 10:38 ` [PATCH v2 4/4] ARM: zynq: Enable DM for CFI NOR flash Michal Simek
2020-04-06 11:00 ` [PATCH v2 0/4] ARM: zynq: Switch to CFI DM driver Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.