Skip to contentSkip to conversation

arm: mach-k3: am64: Add NAND configuration

PATCH Superseded Roger Quadros 4 participants 18 messages Jan 9, 2024 – Jan 11, 2024

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover arm: mach-k3: am64: Add NAND configuration

Hi,

AM64-EVM [1] supports NAND via expansion card.

This series fixes the GPMC memory and NAND drivers and provides NAND configuration for AM642 platform.

The extension card support and NAND DT overlay is still missing so NAND is not yet functional just with this series.

It was tested with NAND overlay [2] manually applied to base AM64-EVM DT.

CI test results are available at
https://github.com/u-boot/u-boot/pull/460

[1] https://www.ti.com/tool/TMDS64EVM
[2] https://lore.kernel.org/all/[email protected]/

Roger Quadros (4):
memory: ti-gpmc: Fix build
mtd: rawnand: omap_gpmc: Use DT provided IO address
arm: mach-k3: am642: Define NAND boot device
configs: am64x_evm_a53_defconfig: Enable NAND

 arch/arm/mach-k3/am642_init.c            |  3 +++
 arch/arm/mach-k3/include/mach/am64_spl.h |  1 +
 configs/am64x_evm_a53_defconfig          | 32 ++++++++++++++++++++++++
 drivers/memory/ti-gpmc.c                 |  2 +-
 drivers/mtd/nand/raw/omap_gpmc.c         | 19 ++++++++++----
 5 files changed, 51 insertions(+), 6 deletions(-)

base-commit: c2c598e87cfe56f5991730762c00733c5aa9a994
prerequisite-patch-id: e0465f3e924302d1c4bd47f2129b4eb3bd9faead

Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/4 memory: ti-gpmc: Fix build

sys_proto.h no longer exists for K3 platform so drop it. Include sizes.h to so SZ_16M is visible.

---
 drivers/memory/ti-gpmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/memory/ti-gpmc.c +1 -1
index 775e78c9a5..0b8674339e 100644
@@ -6,7 +6,6 @@
  */
 
 #include <asm/io.h>
-#include <asm/arch/sys_proto.h>
 #include <clk.h>
 #include <common.h>
 #include <dm.h>
@@ -17,6 +16,7 @@
 #include <linux/mtd/omap_gpmc.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
+#include <linux/sizes.h>
 #include "ti-gpmc.h"
 
 enum gpmc_clk_domain {
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/4 mtd: rawnand: omap_gpmc: Use DT provided IO address

In reply to Roger Quadros

For DM case we can get the NAND chip's IO address from DT so we don't need to rely on CFG_SYS_NAND_BASE.

---
 drivers/mtd/nand/raw/omap_gpmc.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/mtd/nand/raw/omap_gpmc.c +14 -5
index 0e25bd5dc2..f827c578d9 100644
@@ -8,13 +8,15 @@
 #include <log.h>
 #include <system-constants.h>
 #include <asm/io.h>
-#include <dm/uclass.h>
+#include <dm.h>
 #include <linux/errno.h>
 
 #ifdef CONFIG_ARCH_OMAP2PLUS
 #include <asm/arch/mem.h>
 #endif
 
+#include <linux/io.h>
+#include <linux/ioport.h>
 #include <linux/mtd/omap_gpmc.h>
 #include <linux/mtd/nand_ecc.h>
 #include <linux/mtd/rawnand.h>
@@ -1124,7 +1126,7 @@ int __maybe_unused omap_nand_switch_ecc(uint32_t hardware, uint32_t eccstrength)
  *   nand_scan about special functionality. See the defines for further
  *   explanation
  */
-int gpmc_nand_init(struct nand_chip *nand)
+int gpmc_nand_init(struct nand_chip *nand, void __iomem *nand_base)
 {
 	int32_t gpmc_config = 0;
 	int cs = cs_next++;
@@ -1164,7 +1166,7 @@ int gpmc_nand_init(struct nand_chip *nand)
 	info->control = NULL;
 	info->cs = cs;
 	info->ws = wscfg[cs];
-	info->fifo = (void __iomem *)CFG_SYS_NAND_BASE;
+	info->fifo = nand_base;
 	nand_set_controller_data(nand, &omap_nand_info[cs]);
 	nand->cmd_ctrl	= omap_nand_hwcontrol;
 	nand->options	|= NAND_NO_PADDING | NAND_CACHEPRG;
@@ -1214,9 +1216,16 @@ static int gpmc_nand_probe(struct udevice *dev)
 {
 	struct nand_chip *nand = dev_get_priv(dev);
 	struct mtd_info *mtd = nand_to_mtd(nand);
+	struct resource res;
+	void __iomem *base;
 	int ret;
 
-	gpmc_nand_init(nand);
+	ret = dev_read_resource(dev, 0, &res);
+	if (ret)
+		return ret;
+
+	base = devm_ioremap(dev, res.start, resource_size(&res));
+	gpmc_nand_init(nand, base);
 
 	ret = nand_scan(mtd, CONFIG_SYS_NAND_MAX_CHIPS);
 	if (ret)
@@ -1270,7 +1279,7 @@ void board_nand_init(void)
 
 int board_nand_init(struct nand_chip *nand)
 {
-	return gpmc_nand_init(nand);
+	return gpmc_nand_init(nand, (void __iomem *)CFG_SYS_NAND_BASE);
 }
 
 #endif /* CONFIG_SYS_NAND_SELF_INIT */
Signature · 1 line
2.34.1
#3 lore raw

PATCH 3/4 arm: mach-k3: am642: Define NAND boot device

In reply to Roger Quadros

AM642 SoC supports booting from GPMC NAND device.
Define boot device for it.

---
 arch/arm/mach-k3/am642_init.c            | 3 +++
 arch/arm/mach-k3/include/mach/am64_spl.h | 1 +
 2 files changed, 4 insertions(+)
arch/arm/mach-k3/am642_init.c +3 -0
index 6085379f1d..ddf47ef0a9 100644
@@ -348,6 +348,9 @@ static u32 __get_primary_bootmedia(u32 main_devstat)
 	case BOOT_DEVICE_EMMC:
 		return BOOT_DEVICE_MMC1;
 
+	case BOOT_DEVICE_NAND:
+		return BOOT_DEVICE_NAND;
+
 	case BOOT_DEVICE_MMC:
 		if ((bootmode_cfg & MAIN_DEVSTAT_PRIMARY_MMC_PORT_MASK) >>
 		     MAIN_DEVSTAT_PRIMARY_MMC_PORT_SHIFT)
arch/arm/mach-k3/include/mach/am64_spl.h +1 -0
index b4f396b2c0..a0a517019c 100644
@@ -22,6 +22,7 @@
 
 #define BOOT_DEVICE_USB			0x2A
 #define BOOT_DEVICE_DFU			0x0A
+#define BOOT_DEVICE_NAND		0x0B
 #define BOOT_DEVICE_GPMC_NOR		0x0C
 #define BOOT_DEVICE_PCIE		0x0D
 #define BOOT_DEVICE_XSPI		0x0E
Signature · 1 line
2.34.1
#4 lore raw

PATCH 4/4 configs: am64x_evm_a53_defconfig: Enable NAND

In reply to Roger Quadros

Enables configuration required for NAND in SPL and u-boot.

Enable MTD Driver model and MTD + UBI command line utilities.

Add mtdids/mtdparts for NAND as it is required for u-boot's MTD subsystem commands to recognize NAND partitions.

Add u-boot partition location.

---
 configs/am64x_evm_a53_defconfig | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
configs/am64x_evm_a53_defconfig +32 -0
index 05e35a8db6..e22153a958 100644
@@ -66,10 +66,15 @@ CONFIG_CMD_DFU=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_PMIC=y
 CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"
+CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="k3-am642-evm k3-am642-sk"
@@ -107,6 +112,9 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
 CONFIG_MMC_SDHCI_AM654=y
+CONFIG_MTD=y
+CONFIG_SPL_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
@@ -161,3 +169,27 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_MASS_STORAGE=y
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
+CONFIG_MEMORY=y
+CONFIG_SPL_MEMORY=y
+CONFIG_TI_GPMC=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_GPMC=y
+CONFIG_CMD_NAND=y
+CONFIG_NAND_OMAP_ELM=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH8_CODE_HW=y
+CONFIG_SYS_NAND_BLOCK_SIZE=0x40000
+CONFIG_SYS_NAND_ONFI_DETECTION=y
+CONFIG_SYS_NAND_PAGE_SIZE=0x1000
+CONFIG_SYS_NAND_PAGE_COUNT=0x40
+CONFIG_SYS_NAND_OOBSIZE=0x100
+CONFIG_SPL_NAND_SUPPORT=y
+CONFIG_SPL_NAND_DRIVERS=y
+CONFIG_SPL_NAND_BASE=y
+CONFIG_SPL_NAND_IDENT=y
+CONFIG_SPL_NAND_ECC=y
+CONFIG_SYS_NAND_MAX_CHIPS=1
+CONFIG_SYS_MAX_NAND_DEVICE=1
+# CONFIG_SPL_NAND_AM33XX_BCH is not set
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
+CONFIG_SYS_NAND_U_BOOT_OFFS=0x600000
Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 75 lines · Roger Quadros

Enables configuration required for NAND in SPL and u-boot.

Enable MTD Driver model and MTD + UBI command line utilities.

Add mtdids/mtdparts for NAND as it is required for u-boot's MTD subsystem commands to recognize NAND partitions.

Add u-boot partition location.

---
 configs/am64x_evm_a53_defconfig | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
configs/am64x_evm_a53_defconfig +32 -0
index 05e35a8db6..e22153a958 100644
@@ -66,10 +66,15 @@ CONFIG_CMD_DFU=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_PMIC=y
 CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"
+CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="k3-am642-evm k3-am642-sk"
@@ -107,6 +112,9 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
 CONFIG_MMC_SDHCI_AM654=y
+CONFIG_MTD=y
+CONFIG_SPL_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
@@ -161,3 +169,27 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_MASS_STORAGE=y
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
+CONFIG_MEMORY=y
+CONFIG_SPL_MEMORY=y
+CONFIG_TI_GPMC=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_GPMC=y
+CONFIG_CMD_NAND=y
+CONFIG_NAND_OMAP_ELM=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH8_CODE_HW=y
+CONFIG_SYS_NAND_BLOCK_SIZE=0x40000
+CONFIG_SYS_NAND_ONFI_DETECTION=y
+CONFIG_SYS_NAND_PAGE_SIZE=0x1000
+CONFIG_SYS_NAND_PAGE_COUNT=0x40
+CONFIG_SYS_NAND_OOBSIZE=0x100
+CONFIG_SPL_NAND_SUPPORT=y
+CONFIG_SPL_NAND_DRIVERS=y
+CONFIG_SPL_NAND_BASE=y
+CONFIG_SPL_NAND_IDENT=y
+CONFIG_SPL_NAND_ECC=y
+CONFIG_SYS_NAND_MAX_CHIPS=1
+CONFIG_SYS_MAX_NAND_DEVICE=1
+# CONFIG_SPL_NAND_AM33XX_BCH is not set
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
+CONFIG_SYS_NAND_U_BOOT_OFFS=0x600000
Signature · 1 line
2.34.1

Why not a config fragment?

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#6 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 70 lines · Nishanth Menon
Quoted 69 lines · Roger Quadros

Enables configuration required for NAND in SPL and u-boot.

Enable MTD Driver model and MTD + UBI command line utilities.

Add mtdids/mtdparts for NAND as it is required for u-boot's MTD subsystem commands to recognize NAND partitions.

Add u-boot partition location.

---
 configs/am64x_evm_a53_defconfig | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
configs/am64x_evm_a53_defconfig +29 -0
index 05e35a8db6..e22153a958 100644
@@ -66,10 +66,15 @@ CONFIG_CMD_DFU=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_PMIC=y
 CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"
+CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="k3-am642-evm k3-am642-sk"
@@ -107,6 +112,9 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
 CONFIG_MMC_SDHCI_AM654=y
+CONFIG_MTD=y
+CONFIG_SPL_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
@@ -161,3 +169,27 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_MASS_STORAGE=y
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
+CONFIG_MEMORY=y
+CONFIG_SPL_MEMORY=y
+CONFIG_TI_GPMC=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_GPMC=y
+CONFIG_CMD_NAND=y
+CONFIG_NAND_OMAP_ELM=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH8_CODE_HW=y
+CONFIG_SYS_NAND_BLOCK_SIZE=0x40000
+CONFIG_SYS_NAND_ONFI_DETECTION=y
+CONFIG_SYS_NAND_PAGE_SIZE=0x1000
+CONFIG_SYS_NAND_PAGE_COUNT=0x40
+CONFIG_SYS_NAND_OOBSIZE=0x100
+CONFIG_SPL_NAND_SUPPORT=y
+CONFIG_SPL_NAND_DRIVERS=y
+CONFIG_SPL_NAND_BASE=y
+CONFIG_SPL_NAND_IDENT=y
+CONFIG_SPL_NAND_ECC=y
+CONFIG_SYS_NAND_MAX_CHIPS=1
+CONFIG_SYS_MAX_NAND_DEVICE=1
+# CONFIG_SPL_NAND_AM33XX_BCH is not set
Quoted 8 lines
Quoted 6 lines
configs/am64x_evm_a53_defconfig +3 -0
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
+CONFIG_SYS_NAND_U_BOOT_OFFS=0x600000
Signature · 1 line
2.34.1

Why not a config fragment?

To me, this makes sense to keep in the main config. It can be turned off as needed, and at run time if it's not present, it's safe.

Signature · 1 line
Tom
#7 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

On 14:48-20240109, Tom Rini wrote:
[...]

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Signature · 1 line
2.34.1

Why not a config fragment?

To me, this makes sense to keep in the main config. It can be turned off as needed, and at run time if it's not present, it's safe.

Three reasons:
* There is going to be duplication across multiple boards
* It confuses the affair of trying to find the minimal configuration needed to boot the board.
* SRAM is limited already - we have been playing all kind of dances around this - NAND is a daughter card addon - while I am not trying to diminish NAND support, we are in a constant struggle to keep SRAM viable and adding additional boot modes to a single config, IMHO is the wrong direction to go.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#8 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 11 lines · Nishanth Menon

On 14:48-20240109, Tom Rini wrote:
[...]

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Signature · 1 line
2.34.1

Why not a config fragment?

To me, this makes sense to keep in the main config. It can be turned off as needed, and at run time if it's not present, it's safe.

Quoted 9 lines

Three reasons:
* There is going to be duplication across multiple boards
* It confuses the affair of trying to find the minimal configuration needed to boot the board.
* SRAM is limited already - we have been playing all kind of dances around this - NAND is a daughter card addon - while I am not trying to diminish NAND support, we are in a constant struggle to keep SRAM viable and adding additional boot modes to a single config, IMHO is the wrong direction to go.

At the end of the day, I'll leave it to TI folks. I see that drivers/mtd/Kconfig needs a whole lot of help as while I would have hoped that turning off just CONFIG_MTD would undo most of the changes here, it does not.

Signature · 1 line
Tom
#9 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

In reply to Roger Quadros
Quoted 20 lines · Roger Quadros

Enables configuration required for NAND in SPL and u-boot.

Enable MTD Driver model and MTD + UBI command line utilities.

Add mtdids/mtdparts for NAND as it is required for u-boot's MTD subsystem commands to recognize NAND partitions.

Add u-boot partition location.

---
 configs/am64x_evm_a53_defconfig | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
configs/am64x_evm_a53_defconfig +0 -0
index 05e35a8db6..e22153a958 100644
@@ -66,10 +66,15 @@ CONFIG_CMD_DFU=y
 CONFIG_CMD_GPT=y

configs/am64x_evm_a53_defconfig CONFIG_CMD_DFU=y · line 76

Quoted 10 lines
configs/am64x_evm_a53_defconfig +4 -0
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_CMD_PMIC=y
 CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"

Why not handle this as device tree partitions?

Quoted 45 lines
configs/am64x_evm_a53_defconfig +28 -0
+CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_LIST="k3-am642-evm k3-am642-sk"
@@ -107,6 +112,9 @@ CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
 CONFIG_MMC_SDHCI_AM654=y
+CONFIG_MTD=y
+CONFIG_SPL_MTD=y
+CONFIG_DM_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
@@ -161,3 +169,27 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_USB_FUNCTION_MASS_STORAGE=y
 CONFIG_SPL_DFU=y
 CONFIG_FS_FAT_MAX_CLUSTSIZE=16384
+CONFIG_MEMORY=y
+CONFIG_SPL_MEMORY=y
+CONFIG_TI_GPMC=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_OMAP_GPMC=y
+CONFIG_CMD_NAND=y
+CONFIG_NAND_OMAP_ELM=y
+CONFIG_NAND_OMAP_ECCSCHEME_BCH8_CODE_HW=y
+CONFIG_SYS_NAND_BLOCK_SIZE=0x40000
+CONFIG_SYS_NAND_ONFI_DETECTION=y
+CONFIG_SYS_NAND_PAGE_SIZE=0x1000
+CONFIG_SYS_NAND_PAGE_COUNT=0x40
+CONFIG_SYS_NAND_OOBSIZE=0x100
+CONFIG_SPL_NAND_SUPPORT=y
+CONFIG_SPL_NAND_DRIVERS=y
+CONFIG_SPL_NAND_BASE=y
+CONFIG_SPL_NAND_IDENT=y
+CONFIG_SPL_NAND_ECC=y
+CONFIG_SYS_NAND_MAX_CHIPS=1
+CONFIG_SYS_MAX_NAND_DEVICE=1
+# CONFIG_SPL_NAND_AM33XX_BCH is not set
+CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
+CONFIG_SYS_NAND_U_BOOT_OFFS=0x600000
Signature · 1 line
2.34.1
Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#10 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 25 lines · Nishanth Menon
Quoted 24 lines · Roger Quadros

Enables configuration required for NAND in SPL and u-boot.

Enable MTD Driver model and MTD + UBI command line utilities.

Add mtdids/mtdparts for NAND as it is required for u-boot's MTD subsystem commands to recognize NAND partitions.

Add u-boot partition location.

---
 configs/am64x_evm_a53_defconfig | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
configs/am64x_evm_a53_defconfig +1 -0
index 05e35a8db6..e22153a958 100644
@@ -66,10 +66,15 @@ CONFIG_CMD_DFU=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
 CONFIG_CMD_USB=y
Quoted 8 lines

configs/am64x_evm_a53_defconfig CONFIG_CMD_DFU=y · line 76

Quoted 6 lines
configs/am64x_evm_a53_defconfig +3 -0
 CONFIG_CMD_TIME=y
 CONFIG_CMD_PMIC=y
 CONFIG_CMD_REGULATOR=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"

Why not handle this as device tree partitions?

I honestly forget what the preferred way of defining and passing NAND partition information is these days. It might even be the funny case that passing as cmdline args is "best" rather than fixed-partitions binding?

Signature · 1 line
Tom
#11 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 10 lines · Tom Rini
Quoted 8 lines · Nishanth Menon

configs/am64x_evm_a53_defconfig CONFIG_CMD_DFU=y · line 76

Quoted 5 lines · Roger Quadros

CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y

configs/am64x_evm_a53_defconfig +3 -0
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"

Why not handle this as device tree partitions?

Quoted 4 lines

I honestly forget what the preferred way of defining and passing NAND partition information is these days. It might even be the funny case that passing as cmdline args is "best" rather than fixed-partitions binding?

According to past discussions [1] doing the fixup in U-Boot is not advised.

Using the command line or having the partition fixed in the DT are both valid options.

[1] https://lore.kernel.org/all/[email protected]/

Francesco

#12 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 16 lines · Francesco Dolcini
Quoted 10 lines · Tom Rini
Quoted 8 lines · Nishanth Menon

configs/am64x_evm_a53_defconfig CONFIG_CMD_DFU=y · line 76

Quoted 5 lines · Roger Quadros

CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y

configs/am64x_evm_a53_defconfig +3 -0
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"

Why not handle this as device tree partitions?

Quoted 4 lines

I honestly forget what the preferred way of defining and passing NAND partition information is these days. It might even be the funny case that passing as cmdline args is "best" rather than fixed-partitions binding?

Quoted 6 lines

According to past discussions [1] doing the fixup in U-Boot is not advised.

Using the command line or having the partition fixed in the DT are both valid options.

[1] https://lore.kernel.org/all/[email protected]/

yup - also why I wonder why we cant depend on DT.

Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#13 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

In reply to Francesco Dolcini
Quoted 16 lines · Francesco Dolcini
Quoted 10 lines · Tom Rini
Quoted 8 lines · Nishanth Menon

configs/am64x_evm_a53_defconfig CONFIG_CMD_DFU=y · line 76

Quoted 5 lines · Roger Quadros

CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y

configs/am64x_evm_a53_defconfig +3 -0
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"

Why not handle this as device tree partitions?

Quoted 4 lines

I honestly forget what the preferred way of defining and passing NAND partition information is these days. It might even be the funny case that passing as cmdline args is "best" rather than fixed-partitions binding?

Quoted 9 lines

According to past discussions [1] doing the fixup in U-Boot is not advised.

Using the command line or having the partition fixed in the DT are both valid options.

[1] https://lore.kernel.org/all/[email protected]/

Francesco

This was not about passing mtdparts to kernel but about getting 'mtdparts' command to work at u-boot. I need to figure out why OF partition parser didn't work here.

For a start I didn't have CONFIG_MTD_PARTITIONS set. Maybe I'm missing something more.

Signature · 2 lines
cheers,
-roger
#14 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

+Lukasz & Mattijs

Quoted 26 lines · Roger Quadros
Quoted 23 lines · Francesco Dolcini
Quoted 10 lines · Tom Rini
Quoted 8 lines · Nishanth Menon

configs/am64x_evm_a53_defconfig CONFIG_CMD_DFU=y · line 76

Quoted 5 lines · Roger Quadros

CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y

configs/am64x_evm_a53_defconfig +3 -0
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"

Why not handle this as device tree partitions?

Quoted 4 lines

I honestly forget what the preferred way of defining and passing NAND partition information is these days. It might even be the funny case that passing as cmdline args is "best" rather than fixed-partitions binding?

According to past discussions [1] doing the fixup in U-Boot is not advised.

Using the command line or having the partition fixed in the DT are both valid options.

[1] https://lore.kernel.org/all/[email protected]/

Quoted 8 lines
Quoted 2 lines

Francesco

This was not about passing mtdparts to kernel but about getting 'mtdparts' command to work at u-boot. I need to figure out why OF partition parser didn't work here.

For a start I didn't have CONFIG_MTD_PARTITIONS set. Maybe I'm missing something more.

The issue was the NAND driver was not setting chip->dev and chip->ofnode correctly. Now 'mtd list' shows partitions from the DT.
But, 'dfu 0 nand list' still fails like so.
"mtdparts variable not set, see 'help mtdparts'"

Looks like dfu_nand driver doesn't fall back to OF partitions if mtdparts environment is not defined.

Should we add OF partitions support to dfu_nand driver or is it deprecated in favor of dfu_mtd driver?

Signature · 2 lines
cheers,
-roger
#15 lore raw

Re: [PATCH 4/4] configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 43 lines · Roger Quadros

+Lukasz & Mattijs

Quoted 26 lines · Roger Quadros
Quoted 23 lines · Francesco Dolcini
Quoted 10 lines · Tom Rini
Quoted 8 lines · Nishanth Menon

configs/am64x_evm_a53_defconfig CONFIG_CMD_DFU=y · line 76

Quoted 5 lines · Roger Quadros

CONFIG_CMD_PMIC=y
CONFIG_CMD_REGULATOR=y

configs/am64x_evm_a53_defconfig +3 -0
+CONFIG_CMD_MTDPARTS=y
+CONFIG_MTDIDS_DEFAULT="nand0=omap2-nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=omap2-nand.0:2m(NAND.tiboot3),2m(NAND.tispl),2m(NAND.tiboot3.backup),4m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup),-(NAND.file-system)"

Why not handle this as device tree partitions?

Quoted 4 lines

I honestly forget what the preferred way of defining and passing NAND partition information is these days. It might even be the funny case that passing as cmdline args is "best" rather than fixed-partitions binding?

According to past discussions [1] doing the fixup in U-Boot is not advised.

Using the command line or having the partition fixed in the DT are both valid options.

[1] https://lore.kernel.org/all/[email protected]/

Quoted 8 lines
Quoted 2 lines

Francesco

This was not about passing mtdparts to kernel but about getting 'mtdparts' command to work at u-boot. I need to figure out why OF partition parser didn't work here.

For a start I didn't have CONFIG_MTD_PARTITIONS set. Maybe I'm missing something more.

The issue was the NAND driver was not setting chip->dev and chip->ofnode correctly. Now 'mtd list' shows partitions from the DT.
But, 'dfu 0 nand list' still fails like so.
"mtdparts variable not set, see 'help mtdparts'"

Quoted 5 lines

Looks like dfu_nand driver doesn't fall back to OF partitions if mtdparts environment is not defined.

Should we add OF partitions support to dfu_nand driver or is it deprecated in favor of dfu_mtd driver?

I would rather not have to populate the env variable as that will lead to confusion later on I fear (make a change and it's not populated onward).

Signature · 1 line
Tom
#16 lore raw
In reply to Roger Quadros
Quoted 26 lines · Roger Quadros

Hi,

AM64-EVM [1] supports NAND via expansion card.

This series fixes the GPMC memory and NAND drivers and provides NAND configuration for AM642 platform.

The extension card support and NAND DT overlay is still missing so NAND is not yet functional just with this series.

It was tested with NAND overlay [2] manually applied to base AM64-EVM DT.

CI test results are available at
https://github.com/u-boot/u-boot/pull/460

[1] https://www.ti.com/tool/TMDS64EVM
[2] https://lore.kernel.org/all/[email protected]/

Roger Quadros (4):
memory: ti-gpmc: Fix build
mtd: rawnand: omap_gpmc: Use DT provided IO address
arm: mach-k3: am642: Define NAND boot device
configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 6 lines
 arch/arm/mach-k3/am642_init.c            |  3 +++
 arch/arm/mach-k3/include/mach/am64_spl.h |  1 +
 configs/am64x_evm_a53_defconfig          | 32 ++++++++++++++++++++++++
 drivers/memory/ti-gpmc.c                 |  2 +-
 drivers/mtd/nand/raw/omap_gpmc.c         | 19 ++++++++++----
 5 files changed, 51 insertions(+), 6 deletions(-)

Please update am64x documentation as well. People will need to know how to actually build, flash and use it.

Quoted 7 lines

base-commit: c2c598e87cfe56f5991730762c00733c5aa9a994
prerequisite-patch-id: e0465f3e924302d1c4bd47f2129b4eb3bd9faead

Signature · 1 line
2.34.1
Signature · 3 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
#17 lore raw
Quoted 34 lines · Nishanth Menon
Quoted 26 lines · Roger Quadros

Hi,

AM64-EVM [1] supports NAND via expansion card.

This series fixes the GPMC memory and NAND drivers and provides NAND configuration for AM642 platform.

The extension card support and NAND DT overlay is still missing so NAND is not yet functional just with this series.

It was tested with NAND overlay [2] manually applied to base AM64-EVM DT.

CI test results are available at
https://github.com/u-boot/u-boot/pull/460

[1] https://www.ti.com/tool/TMDS64EVM
[2] https://lore.kernel.org/all/[email protected]/

Roger Quadros (4):
memory: ti-gpmc: Fix build
mtd: rawnand: omap_gpmc: Use DT provided IO address
arm: mach-k3: am642: Define NAND boot device
configs: am64x_evm_a53_defconfig: Enable NAND

Quoted 6 lines
 arch/arm/mach-k3/am642_init.c            |  3 +++
 arch/arm/mach-k3/include/mach/am64_spl.h |  1 +
 configs/am64x_evm_a53_defconfig          | 32 ++++++++++++++++++++++++
 drivers/memory/ti-gpmc.c                 |  2 +-
 drivers/mtd/nand/raw/omap_gpmc.c         | 19 ++++++++++----
 5 files changed, 51 insertions(+), 6 deletions(-)
Quoted 2 lines

Please update am64x documentation as well. People will need to know how to actually build, flash and use it.

As NAND is not yet functional till we implement the extension card support and add the NAND overlay. I'll limit this series to platform & driver fixes and leave the defconfig and documentation out for now.

Quoted 9 lines
Quoted 8 lines

base-commit: c2c598e87cfe56f5991730762c00733c5aa9a994
prerequisite-patch-id: e0465f3e924302d1c4bd47f2129b4eb3bd9faead

Signature · 1 line
2.34.1
Signature · 2 lines
cheers,
-roger