Skip to contentSkip to conversation

configs: keystone2: Unwind KERNEL_MTD_PARTS definition

PATCH Superseded Andrew Davis 2 participants 5 messages Jul 25, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 configs: keystone2: Unwind KERNEL_MTD_PARTS definition

This is more complex than it needs to be and makes converting these boards over to plain text env files more difficult. Simplify this environment variable scheme.

---
 include/configs/k2e_evm.h            |  5 +----
 include/configs/k2g_evm.h            |  4 +---
 include/configs/k2hk_evm.h           |  5 +----
 include/configs/k2l_evm.h            |  5 +----
 include/configs/ti_armv7_keystone2.h |  6 +-----
 include/environment/ti/spi.h         | 14 --------------
 6 files changed, 5 insertions(+), 34 deletions(-)
 delete mode 100644 include/environment/ti/spi.h
include/configs/k2e_evm.h +1 -4
index 630dfdc5b7f..46e33233650 100644
@@ -9,8 +9,6 @@
 #ifndef __CONFIG_K2E_EVM_H
 #define __CONFIG_K2E_EVM_H
 
-#include <environment/ti/spi.h>
-
 /* U-Boot general configuration */
 #define ENV_KS2_BOARD_SETTINGS						\
 	DEFAULT_FW_INITRAMFS_BOOT_ENV					\
@@ -19,6 +17,7 @@
 	"boot=ubi\0"							\
 	"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs "	\
 	"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0"	\
+	"mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)\0"			\
 	"name_fdt=keystone-k2e-evm.dtb\0"				\
 	"name_mon=skern-k2e.bin\0"					\
 	"name_ubi=k2e-evm-ubifs.ubi\0"					\
@@ -27,8 +26,6 @@
 
 #include <configs/ti_armv7_keystone2.h>
 
-#define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
-
 /* Network */
 #define CFG_KSNET_CPSW_NUM_PORTS	9
 
include/configs/k2g_evm.h +1 -3
index d0634a99f49..744f1539a37 100644
@@ -10,7 +10,6 @@
 #define __CONFIG_K2G_EVM_H
 
 #include <environment/ti/mmc.h>
-#include <environment/ti/spi.h>
 
 /* U-Boot general configuration */
 #define ENV_KS2_BOARD_SETTINGS						\
@@ -37,6 +36,7 @@
 		"else if test $name_fdt = undefined; then " \
 			"echo WARNING: Could not determine device tree to use;"\
 		"fi;fi;fi;fi; setenv fdtfile ${name_fdt}\0" \
+	"mtdparts=spi1.0:1m(u-boot-spl)ro,-(misc)\0"			\
 	"name_mon=skern-k2g.bin\0"					\
 	"name_ubi=k2g-evm-ubifs.ubi\0"					\
 	"name_uboot=u-boot-spi-k2g-evm.gph\0"				\
@@ -54,8 +54,6 @@
 #define CFG_KSNET_CPSW_NUM_PORTS	2
 #define PHY_ANEG_TIMEOUT	10000 /* PHY needs longer aneg time */
 
-#define SPI_MTD_PARTS	KEYSTONE_SPI1_MTD_PARTS
-
 #include <configs/ti_armv7_keystone2.h>
 
 #endif /* __CONFIG_K2G_EVM_H */
include/configs/k2hk_evm.h +1 -4
index ed54be839ff..c688c4d738b 100644
@@ -9,8 +9,6 @@
 #ifndef __CONFIG_K2HK_EVM_H
 #define __CONFIG_K2HK_EVM_H
 
-#include <environment/ti/spi.h>
-
 /* U-Boot general configuration */
 #define ENV_KS2_BOARD_SETTINGS						\
 	DEFAULT_FW_INITRAMFS_BOOT_ENV					\
@@ -19,6 +17,7 @@
 	"boot=ubi\0"							\
 	"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs "	\
 	"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0"	\
+	"mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)\0"			\
 	"name_fdt=keystone-k2hk-evm.dtb\0"				\
 	"name_mon=skern-k2hk.bin\0"					\
 	"name_ubi=k2hk-evm-ubifs.ubi\0"					\
@@ -27,8 +26,6 @@
 
 #include <configs/ti_armv7_keystone2.h>
 
-#define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
-
 /* Network */
 #define CFG_KSNET_CPSW_NUM_PORTS	5
 
include/configs/k2l_evm.h +1 -4
index 69d42eaf9f1..c0af0bc2fe5 100644
@@ -9,8 +9,6 @@
 #ifndef __CONFIG_K2L_EVM_H
 #define __CONFIG_K2L_EVM_H
 
-#include <environment/ti/spi.h>
-
 /* U-Boot general configuration */
 #define ENV_KS2_BOARD_SETTINGS						\
 	DEFAULT_FW_INITRAMFS_BOOT_ENV					\
@@ -19,6 +17,7 @@
 	"boot=ubi\0"							\
 	"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs "	\
 	"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,4096\0"	\
+	"mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)\0"			\
 	"name_fdt=keystone-k2l-evm.dtb\0"				\
 	"name_mon=skern-k2l.bin\0"					\
 	"name_ubi=k2l-evm-ubifs.ubi\0"					\
@@ -27,8 +26,6 @@
 
 #include <configs/ti_armv7_keystone2.h>
 
-#define SPI_MTD_PARTS KEYSTONE_SPI0_MTD_PARTS
-
 /* Network */
 #define CFG_KSNET_CPSW_NUM_PORTS	5
 
include/configs/ti_armv7_keystone2.h +1 -5
index a47f0902a26..06aa02a6d40 100644
@@ -78,10 +78,6 @@
 
 /* EDMA3 */
 
-#define KERNEL_MTD_PARTS						\
-	"mtdparts="							\
-	SPI_MTD_PARTS
-
 #define DEFAULT_FW_INITRAMFS_BOOT_ENV					\
 	"name_fw_rd=k2-fw-initrd.cpio.gz\0"				\
 	"set_rd_spec=setenv rd_spec ${rdaddr}:${filesize}\0"		\
@@ -149,7 +145,7 @@
 	"burn_uboot_nand=nand erase 0 0x100000; "			\
 		"nand write ${loadaddr} 0 ${filesize}\0"		\
 	"args_all=setenv bootargs console=ttyS0,115200n8 rootwait "	\
-		KERNEL_MTD_PARTS					\
+		"mtdparts=${mtdparts}\0"				\
 	"args_net=setenv bootargs ${bootargs} rootfstype=nfs "		\
 		"root=/dev/nfs rw nfsroot=${serverip}:${nfs_root},"	\
 		"${nfs_options} ip=dhcp\0"				\
include/environment/ti/spi.h deleted +0 -14
deleted file mode 100644
index 1681dc8635e..00000000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com
- *
- * Environment variable definitions for SPI on TI boards.
- */
-
-#ifndef __TI_SPI_H
-#define __TI_SPI_H
-
-#define KEYSTONE_SPI0_MTD_PARTS "spi0.0:1m(u-boot-spl)ro,-(misc);\0"
-#define KEYSTONE_SPI1_MTD_PARTS "spi1.0:1m(u-boot-spl)ro,-(misc);\0"
-
-#endif
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 configs: keystone2: Change to using env files

Move to using .env file for setting up environment variables for K2x_evm.

---
 board/ti/ks2_evm/Kconfig                      | 12 +++
 board/ti/ks2_evm/k2e_evm.env                  | 13 +++
 board/ti/ks2_evm/k2g_evm.env                  | 46 +++++++++
 board/ti/ks2_evm/k2hk_evm.env                 | 13 +++
 board/ti/ks2_evm/k2l_evm.env                  | 13 +++
 include/configs/k2e_evm.h                     | 15 ---
 include/configs/k2g_evm.h                     | 41 --------
 include/configs/k2hk_evm.h                    | 15 ---
 include/configs/k2l_evm.h                     | 15 ---
 include/configs/ti_armv7_keystone2.h          | 95 -------------------
 include/environment/ti/ti_armv7_keystone2.env | 61 ++++++++++++
 11 files changed, 158 insertions(+), 181 deletions(-)
 create mode 100644 board/ti/ks2_evm/k2e_evm.env
 create mode 100644 board/ti/ks2_evm/k2g_evm.env
 create mode 100644 board/ti/ks2_evm/k2hk_evm.env
 create mode 100644 board/ti/ks2_evm/k2l_evm.env
 create mode 100644 include/environment/ti/ti_armv7_keystone2.env
board/ti/ks2_evm/Kconfig +12 -0
index 9477f5336b8..8b3a43a5aa8 100644
@@ -9,6 +9,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "k2e_evm"
 
+config ENV_SOURCE_FILE
+       default "k2e_evm"
+
 endif
 
 if TARGET_K2HK_EVM
@@ -22,6 +25,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "k2hk_evm"
 
+config ENV_SOURCE_FILE
+       default "k2hk_evm"
+
 endif
 
 if TARGET_K2L_EVM
@@ -35,6 +41,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "k2l_evm"
 
+config ENV_SOURCE_FILE
+       default "k2l_evm"
+
 endif
 
 if TARGET_K2G_EVM
@@ -48,6 +57,9 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "k2g_evm"
 
+config ENV_SOURCE_FILE
+       default "k2g_evm"
+
 endif
 
 source "board/ti/common/Kconfig"
board/ti/ks2_evm/k2e_evm.env new file +13 -0
new file mode 100644
index 00000000000..d8e02280370
@@ -0,0 +1,13 @@
+#include <environment/ti/ti_armv7_common.env>
+#include <environment/ti/ti_armv7_keystone2.env>
+
+findfdt=setenv fdtfile ${name_fdt}
+boot=ubi
+args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048
+mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)
+
+name_fdt=keystone-k2e-evm.dtb
+name_mon=skern-k2e.bin
+name_ubi=k2e-evm-ubifs.ubi
+name_uboot=u-boot-spi-k2e-evm.gph
+name_fs=arago-console-image-k2e-evm.cpio.gz
board/ti/ks2_evm/k2g_evm.env new file +46 -0

46 lines not on this page · raw message

board/ti/ks2_evm/k2hk_evm.env new file +13 -0
new file mode 100644
index 00000000000..c9ef56b74b8
@@ -0,0 +1,13 @@
+#include <environment/ti/ti_armv7_common.env>
+#include <environment/ti/ti_armv7_keystone2.env>
+
+findfdt=setenv fdtfile ${name_fdt}
+boot=ubi
+args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048
+mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)
+
+name_fdt=keystone-k2hk-evm.dtb
+name_mon=skern-k2hk.bin
+name_ubi=k2hk-evm-ubifs.ubi
+name_uboot=u-boot-spi-k2hk-evm.gph
+name_fs=arago-console-image-k2hk-evm.cpio.gz
board/ti/ks2_evm/k2l_evm.env new file +13 -0
new file mode 100644
index 00000000000..f78fc8ccc90
@@ -0,0 +1,13 @@
+#include <environment/ti/ti_armv7_common.env>
+#include <environment/ti/ti_armv7_keystone2.env>
+
+findfdt=setenv fdtfile ${name_fdt}
+boot=ubi
+args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,4096
+mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)
+
+name_fdt=keystone-k2l-evm.dtb
+name_mon=skern-k2l.bin
+name_ubi=k2l-evm-ubifs.ubi
+name_uboot=u-boot-spi-k2l-evm.gph
+name_fs=arago-console-image-k2l-evm.cpio.gz\0"
include/configs/k2e_evm.h +0 -15
index 46e33233650..5cdd87c0a17 100644
@@ -9,21 +9,6 @@
 #ifndef __CONFIG_K2E_EVM_H
 #define __CONFIG_K2E_EVM_H
 
-/* U-Boot general configuration */
-#define ENV_KS2_BOARD_SETTINGS						\
-	DEFAULT_FW_INITRAMFS_BOOT_ENV					\
-	DEFAULT_FIT_TI_ARGS						\
-	"findfdt=setenv fdtfile ${name_fdt}\0"				\
-	"boot=ubi\0"							\
-	"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs "	\
-	"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0"	\
-	"mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)\0"			\
-	"name_fdt=keystone-k2e-evm.dtb\0"				\
-	"name_mon=skern-k2e.bin\0"					\
-	"name_ubi=k2e-evm-ubifs.ubi\0"					\
-	"name_uboot=u-boot-spi-k2e-evm.gph\0"				\
-	"name_fs=arago-console-image-k2e-evm.cpio.gz\0"
-
 #include <configs/ti_armv7_keystone2.h>
 
 /* Network */
include/configs/k2g_evm.h +0 -41

47 lines not on this page · raw message

include/configs/k2hk_evm.h +0 -15
index c688c4d738b..5e52bbb98f8 100644
@@ -9,21 +9,6 @@
 #ifndef __CONFIG_K2HK_EVM_H
 #define __CONFIG_K2HK_EVM_H
 
-/* U-Boot general configuration */
-#define ENV_KS2_BOARD_SETTINGS						\
-	DEFAULT_FW_INITRAMFS_BOOT_ENV					\
-	DEFAULT_FIT_TI_ARGS						\
-	"findfdt=setenv fdtfile ${name_fdt}\0"				\
-	"boot=ubi\0"							\
-	"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs "	\
-	"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0"	\
-	"mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)\0"			\
-	"name_fdt=keystone-k2hk-evm.dtb\0"				\
-	"name_mon=skern-k2hk.bin\0"					\
-	"name_ubi=k2hk-evm-ubifs.ubi\0"					\
-	"name_uboot=u-boot-spi-k2hk-evm.gph\0"				\
-	"name_fs=arago-console-image-k2hk-evm.cpio.gz\0"
-
 #include <configs/ti_armv7_keystone2.h>
 
 /* Network */
include/configs/k2l_evm.h +0 -15
index c0af0bc2fe5..199959fbd42 100644
@@ -9,21 +9,6 @@
 #ifndef __CONFIG_K2L_EVM_H
 #define __CONFIG_K2L_EVM_H
 
-/* U-Boot general configuration */
-#define ENV_KS2_BOARD_SETTINGS						\
-	DEFAULT_FW_INITRAMFS_BOOT_ENV					\
-	DEFAULT_FIT_TI_ARGS						\
-	"findfdt=setenv fdtfile ${name_fdt}\0"				\
-	"boot=ubi\0"							\
-	"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs "	\
-	"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,4096\0"	\
-	"mtdparts=spi0.0:1m(u-boot-spl)ro,-(misc)\0"			\
-	"name_fdt=keystone-k2l-evm.dtb\0"				\
-	"name_mon=skern-k2l.bin\0"					\
-	"name_ubi=k2l-evm-ubifs.ubi\0"					\
-	"name_uboot=u-boot-spi-k2l-evm.gph\0"				\
-	"name_fs=arago-console-image-k2l-evm.cpio.gz\0"
-
 #include <configs/ti_armv7_keystone2.h>
 
 /* Network */
include/configs/ti_armv7_keystone2.h +0 -95

107 lines not on this page · raw message

include/environment/ti/ti_armv7_keystone2.env new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
2.39.2
#2 lore raw
In reply to Andrew Davis
Quoted 5 lines · Andrew Davis

This is more complex than it needs to be and makes converting these boards over to plain text env files more difficult. Simplify this environment variable scheme.

Quoted 9 lines
---
 include/configs/k2e_evm.h            |  5 +----
 include/configs/k2g_evm.h            |  4 +---
 include/configs/k2hk_evm.h           |  5 +----
 include/configs/k2l_evm.h            |  5 +----
 include/configs/ti_armv7_keystone2.h |  6 +-----
 include/environment/ti/spi.h         | 14 --------------
 6 files changed, 5 insertions(+), 34 deletions(-)
 delete mode 100644 include/environment/ti/spi.h

So this unwinding isn't quite enough as the defconfigs also set CONFIG_MTDPARTS_DEFAULT and that's the best way.

Signature · 1 line
Tom
#3 lore raw
Quoted 17 lines · Tom Rini
Quoted 13 lines · Andrew Davis

This is more complex than it needs to be and makes converting these boards over to plain text env files more difficult. Simplify this environment variable scheme.

---
  include/configs/k2e_evm.h            |  5 +----
  include/configs/k2g_evm.h            |  4 +---
  include/configs/k2hk_evm.h           |  5 +----
  include/configs/k2l_evm.h            |  5 +----
  include/configs/ti_armv7_keystone2.h |  6 +-----
  include/environment/ti/spi.h         | 14 --------------
  6 files changed, 5 insertions(+), 34 deletions(-)
Quoted 1 line

delete mode 100644 include/environment/ti/spi.h

Quoted 3 lines

So this unwinding isn't quite enough as the defconfigs also set CONFIG_MTDPARTS_DEFAULT and that's the best way.

The one in CONFIG_MTDPARTS_DEFAULT is different from the one defined in k2*_evm.h, so switching would change the env. This patch was attempting to make no changes.

Maybe a better question is do we need these anymore? They don't seem to do anything anymore and these partitions are board specific, so couldn't be set universally in defconfig anyway. Plus They are instead already defined (correctly too) in the DTS files for each board. Should we just drop mtdparts=?

Andrew

#4 lore raw
Quoted 21 lines · Andrew Davis
Quoted 17 lines · Tom Rini
Quoted 13 lines · Andrew Davis

This is more complex than it needs to be and makes converting these boards over to plain text env files more difficult. Simplify this environment variable scheme.

---
  include/configs/k2e_evm.h            |  5 +----
  include/configs/k2g_evm.h            |  4 +---
  include/configs/k2hk_evm.h           |  5 +----
  include/configs/k2l_evm.h            |  5 +----
  include/configs/ti_armv7_keystone2.h |  6 +-----
  include/environment/ti/spi.h         | 14 --------------
  6 files changed, 5 insertions(+), 34 deletions(-)
Quoted 1 line

delete mode 100644 include/environment/ti/spi.h

Quoted 2 lines

So this unwinding isn't quite enough as the defconfigs also set CONFIG_MTDPARTS_DEFAULT and that's the best way.

Quoted 7 lines

The one in CONFIG_MTDPARTS_DEFAULT is different from the one defined in k2*_evm.h, so switching would change the env. This patch was attempting to make no changes.

Maybe a better question is do we need these anymore? They don't seem to do anything anymore and these partitions are board specific, so couldn't be set universally in defconfig anyway. Plus They are instead already defined (correctly too) in the DTS files for each board. Should we just drop mtdparts=?

So, CONFIG_MTDPARTS_DEFAULT (and related) largely just results in setting mtdparts= in the default environment. So yes, if they're correct in the DTS files the best thing to do is remove the CONFIG options and remove the environment settings and then there won't be confusion about which one is the source of truth.

Signature · 1 line
Tom