[PATCH 1/7] board/km: move ls102xa boards to environment text files

Holger Brunck holger.brunck at hitachienergy.com
Fri Dec 2 18:22:37 CET 2022


Create a common.env which we can use later on also for other boards.

Signed-off-by: Holger Brunck <holger.brunck at hitachienergy.com>
---
 .../keymile/pg-wcom-ls102xa/pg-wcom-expu1.env |  3 +
 .../keymile/pg-wcom-ls102xa/pg-wcom-seli8.env |  3 +
 configs/pg_wcom_expu1_defconfig               |  2 +-
 configs/pg_wcom_expu1_update_defconfig        |  2 +-
 configs/pg_wcom_seli8_defconfig               |  2 +-
 configs/pg_wcom_seli8_update_defconfig        |  2 +-
 include/configs/km/pg-wcom-ls102xa.h          | 65 ------------------
 include/configs/pg-wcom-expu1.h               |  4 --
 include/configs/pg-wcom-seli8.h               |  5 --
 include/environment/pg-wcom/common.env        | 68 +++++++++++++++++++
 include/environment/pg-wcom/ls102xa.env       | 29 ++++++++
 11 files changed, 107 insertions(+), 78 deletions(-)
 create mode 100644 board/keymile/pg-wcom-ls102xa/pg-wcom-expu1.env
 create mode 100644 board/keymile/pg-wcom-ls102xa/pg-wcom-seli8.env
 create mode 100644 include/environment/pg-wcom/common.env
 create mode 100644 include/environment/pg-wcom/ls102xa.env

diff --git a/board/keymile/pg-wcom-ls102xa/pg-wcom-expu1.env b/board/keymile/pg-wcom-ls102xa/pg-wcom-expu1.env
new file mode 100644
index 0000000000..d960de6bfe
--- /dev/null
+++ b/board/keymile/pg-wcom-ls102xa/pg-wcom-expu1.env
@@ -0,0 +1,3 @@
+#include <environment/pg-wcom/ls102xa.env>
+
+hostname=EXPU1
diff --git a/board/keymile/pg-wcom-ls102xa/pg-wcom-seli8.env b/board/keymile/pg-wcom-ls102xa/pg-wcom-seli8.env
new file mode 100644
index 0000000000..4031f8bee9
--- /dev/null
+++ b/board/keymile/pg-wcom-ls102xa/pg-wcom-seli8.env
@@ -0,0 +1,3 @@
+#include <environment/pg-wcom/ls102xa.env>
+
+hostname=SELI8
diff --git a/configs/pg_wcom_expu1_defconfig b/configs/pg_wcom_expu1_defconfig
index ed55f7bfd0..94f66f7299 100644
--- a/configs/pg_wcom_expu1_defconfig
+++ b/configs/pg_wcom_expu1_defconfig
@@ -20,7 +20,6 @@ CONFIG_ENV_ADDR=0x60060000
 CONFIG_AHCI=y
 # CONFIG_DEEP_SLEEP is not set
 CONFIG_LAYERSCAPE_NS_ACCESS=y
-CONFIG_KM_DEF_NETDEV="eth2"
 CONFIG_KM_COMMON_ETH_INIT=y
 CONFIG_PIGGY_MAC_ADDRESS_OFFSET=3
 CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED=y
@@ -64,6 +63,7 @@ CONFIG_MTDIDS_DEFAULT="nor0=60000000.nor,nand0=68000000.flash"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=60000000.nor:128k(rcw),128k(qe),128k(envred),128k(env),512k(res),1m(u-boot),128k(redenvred),128k(redenv),1m(redu-boot),-(ubi0);68000000.flash:-(ubi1)"
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_SOURCE_FILE="pg-wcom-expu1"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
diff --git a/configs/pg_wcom_expu1_update_defconfig b/configs/pg_wcom_expu1_update_defconfig
index 64ddaf8aa6..2eb06bd0d0 100644
--- a/configs/pg_wcom_expu1_update_defconfig
+++ b/configs/pg_wcom_expu1_update_defconfig
@@ -19,7 +19,6 @@ CONFIG_ENV_ADDR=0x60220000
 CONFIG_AHCI=y
 # CONFIG_DEEP_SLEEP is not set
 CONFIG_LAYERSCAPE_NS_ACCESS=y
-CONFIG_KM_DEF_NETDEV="eth2"
 CONFIG_KM_COMMON_ETH_INIT=y
 CONFIG_PIGGY_MAC_ADDRESS_OFFSET=3
 CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED=y
@@ -62,6 +61,7 @@ CONFIG_MTDIDS_DEFAULT="nor0=60000000.nor,nand0=68000000.flash"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=60000000.nor:128k(rcw),128k(qe),128k(envred),128k(env),512k(res),1m(u-boot),128k(redenvred),128k(redenv),1m(redu-boot),-(ubi0);68000000.flash:-(ubi1)"
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_SOURCE_FILE="pg-wcom-expu1"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
diff --git a/configs/pg_wcom_seli8_defconfig b/configs/pg_wcom_seli8_defconfig
index ad08e3582e..2d92828d99 100644
--- a/configs/pg_wcom_seli8_defconfig
+++ b/configs/pg_wcom_seli8_defconfig
@@ -20,7 +20,6 @@ CONFIG_ENV_ADDR=0x60060000
 CONFIG_AHCI=y
 # CONFIG_DEEP_SLEEP is not set
 CONFIG_LAYERSCAPE_NS_ACCESS=y
-CONFIG_KM_DEF_NETDEV="eth2"
 CONFIG_KM_COMMON_ETH_INIT=y
 CONFIG_PIGGY_MAC_ADDRESS_OFFSET=3
 CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED=y
@@ -64,6 +63,7 @@ CONFIG_MTDIDS_DEFAULT="nor0=60000000.nor,nand0=68000000.flash"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=60000000.nor:128k(rcw),128k(qe),128k(envred),128k(env),512k(res),1m(u-boot),128k(redenvred),128k(redenv),1m(redu-boot),-(ubi0);68000000.flash:-(ubi1)"
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_SOURCE_FILE="pg-wcom-seli8"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
diff --git a/configs/pg_wcom_seli8_update_defconfig b/configs/pg_wcom_seli8_update_defconfig
index 01a6198d72..4b84cbb956 100644
--- a/configs/pg_wcom_seli8_update_defconfig
+++ b/configs/pg_wcom_seli8_update_defconfig
@@ -19,7 +19,6 @@ CONFIG_ENV_ADDR=0x60220000
 CONFIG_AHCI=y
 # CONFIG_DEEP_SLEEP is not set
 CONFIG_LAYERSCAPE_NS_ACCESS=y
-CONFIG_KM_DEF_NETDEV="eth2"
 CONFIG_KM_COMMON_ETH_INIT=y
 CONFIG_PIGGY_MAC_ADDRESS_OFFSET=3
 CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED=y
@@ -62,6 +61,7 @@ CONFIG_MTDIDS_DEFAULT="nor0=60000000.nor,nand0=68000000.flash"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=60000000.nor:128k(rcw),128k(qe),128k(envred),128k(env),512k(res),1m(u-boot),128k(redenvred),128k(redenv),1m(redu-boot),-(ubi0);68000000.flash:-(ubi1)"
 CONFIG_CMD_UBI=y
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_SOURCE_FILE="pg-wcom-seli8"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
diff --git a/include/configs/km/pg-wcom-ls102xa.h b/include/configs/km/pg-wcom-ls102xa.h
index 0613b77e96..b7da2b67b2 100644
--- a/include/configs/km/pg-wcom-ls102xa.h
+++ b/include/configs/km/pg-wcom-ls102xa.h
@@ -6,9 +6,6 @@
 #ifndef __CONFIG_PG_WCOM_LS102XA_H
 #define __CONFIG_PG_WCOM_LS102XA_H
 
-/* include common defines/options for all Keymile boards */
-#include "keymile-common.h"
-
 #define CONFIG_SYS_INIT_RAM_ADDR	OCRAM_BASE_ADDR
 #define CONFIG_SYS_INIT_RAM_SIZE	OCRAM_SIZE
 
@@ -177,68 +174,6 @@
 
 #define CONFIG_LS102XA_STREAM_ID
 
-/*
- * Environment
- */
-
-#define CONFIG_ENV_TOTAL_SIZE		0x40000
-#define ENV_DEL_ADDR		CONFIG_ENV_ADDR_REDUND  /* direct for newenv */
-
-#ifndef CONFIG_KM_DEF_ENV		/* if not set by keymile-common.h */
-#define CONFIG_KM_DEF_ENV
-#endif
-
-#ifndef CONFIG_KM_DEF_BOOT_ARGS_CPU
-#define CONFIG_KM_DEF_BOOT_ARGS_CPU		""
-#endif
-
-#define CONFIG_KM_DEF_ENV_CPU						\
-	"boot=bootm ${load_addr_r} - ${fdt_addr_r}\0"			\
-	"cramfsloadfdt="						\
-		"cramfsload ${fdt_addr_r} "				\
-		"fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb\0"		\
-	"u-boot=" CONFIG_HOSTNAME "/u-boot.bin\0"			\
-	"update=protect off " __stringify(CONFIG_SYS_MONITOR_BASE)	\
-		" +${filesize} && "					\
-		"erase " __stringify(CONFIG_SYS_MONITOR_BASE)		\
-		" +${filesize} && "					\
-		"cp.b ${load_addr_r} "					\
-		__stringify(CONFIG_SYS_MONITOR_BASE) " ${filesize} && "	\
-		"protect on " __stringify(CONFIG_SYS_MONITOR_BASE)	\
-		" +${filesize}\0"					\
-	"update-nor=protect off " __stringify(CONFIG_SYS_FLASH_BASE)	\
-		" +${filesize} && "					\
-		"erase " __stringify(CONFIG_SYS_FLASH_BASE)		\
-		" +${filesize} && "					\
-		"cp.b ${load_addr_r} "					\
-		__stringify(CONFIG_SYS_FLASH_BASE) " ${filesize} && "	\
-		"protect on " __stringify(CONFIG_SYS_MONITOR_BASE)	\
-		" +" __stringify(CONFIG_SYS_MONITOR_LEN)"\0"		\
-	"set_fdthigh=true\0"			\
-	"checkfdt=true\0"						\
-	""
-
-#define CONFIG_KM_NEW_ENV						\
-	"newenv=protect off " __stringify(ENV_DEL_ADDR)			\
-		" +" __stringify(CONFIG_ENV_TOTAL_SIZE) " && "		\
-		"erase " __stringify(ENV_DEL_ADDR)			\
-		" +" __stringify(CONFIG_ENV_TOTAL_SIZE) " && "		\
-		"protect on " __stringify(ENV_DEL_ADDR)			\
-		" +" __stringify(CONFIG_ENV_TOTAL_SIZE) "\0"
-
-#define CONFIG_HW_ENV_SETTINGS						\
-	"hwconfig=devdis:esdhc,usb3,usb2,sata,sec,dcu,duart2,qspi,"	\
-			"can1,can2_4,ftm2_8,i2c2_3,sai1_4,lpuart2_6,"	\
-			"asrc,spdif,lpuart1,ftm1\0"
-
-#define CONFIG_EXTRA_ENV_SETTINGS					\
-	CONFIG_KM_NEW_ENV						\
-	CONFIG_KM_DEF_ENV						\
-	CONFIG_HW_ENV_SETTINGS						\
-	"EEprom_ivm=pca9547:70:9\0"					\
-	"ethrotate=no\0"						\
-	""
-
 #define CONFIG_SYS_BOOTMAPSZ	(256 << 20) /* Increase map for Linux */
 
 #endif
diff --git a/include/configs/pg-wcom-expu1.h b/include/configs/pg-wcom-expu1.h
index e08d941412..e7c6cd926e 100644
--- a/include/configs/pg-wcom-expu1.h
+++ b/include/configs/pg-wcom-expu1.h
@@ -7,10 +7,6 @@
 #define __CONFIG_PG_WCOM_EXPU1_H
 
 #define WCOM_EXPU1
-#define CONFIG_HOSTNAME				"EXPU1"
-
-#define CONFIG_KM_UBI_PARTITION_NAME_BOOT	"ubi0"
-#define CONFIG_KM_UBI_PARTITION_NAME_APP	"ubi1"
 
 /* CLIPS FPGA Definitions */
 #define CONFIG_SYS_CSPR3_EXT	(0x00)
diff --git a/include/configs/pg-wcom-seli8.h b/include/configs/pg-wcom-seli8.h
index 9a7669c940..0113309f23 100644
--- a/include/configs/pg-wcom-seli8.h
+++ b/include/configs/pg-wcom-seli8.h
@@ -6,11 +6,6 @@
 #ifndef __CONFIG_PG_WCOM_SELI8_H
 #define __CONFIG_PG_WCOM_SELI8_H
 
-#define CONFIG_HOSTNAME			"SELI8"
-
-#define CONFIG_KM_UBI_PARTITION_NAME_BOOT	"ubi0"
-#define CONFIG_KM_UBI_PARTITION_NAME_APP	"ubi1"
-
 /* PAXK FPGA Definitions */
 #define CONFIG_SYS_CSPR3_EXT	(0x00)
 #define CONFIG_SYS_CSPR3	(CSPR_PHYS_ADDR(CONFIG_SYS_PAX_BASE) | \
diff --git a/include/environment/pg-wcom/common.env b/include/environment/pg-wcom/common.env
new file mode 100644
index 0000000000..4b660cebd6
--- /dev/null
+++ b/include/environment/pg-wcom/common.env
@@ -0,0 +1,68 @@
+
+#ifndef WCOM_UBI_PARTITION_APP
+/* one flash chip only called boot */
+# define WCOM_UBI_LINUX_MTD	ubi.mtd=ubi0
+ubiattach=ubi part ubi0
+#else /* WCOM_UBI_PARTITION_APP */
+/* two flash chips called boot and app */
+# define WCOM_UBI_LINUX_MTD	ubi.mtd=ubi0 ubi.mtd=ubi1
+ubiattach=if test ${boot_bank} -eq 0;
+          then;
+		ubi part ubi0;
+	  else;
+		ubi part ubi1;
+	  fi
+#endif /* WCOMC_UBI_PARTITION_APP */
+
+actual_bank=0
+
+add_default=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off:
+		console=ttyS0,${baudrate} mem=${kernelmem} init=${init}
+		phram.phram=phvar,${varaddr},CONFIG_KM_PHRAM
+		WCOM_UBI_LINUX_MTD
+
+addpanic=setenv bootargs ${bootargs} panic=1 panic_on_oops=1
+altbootcmd=run bootcmd
+backup_bank=0
+boot=bootm ${load_addr_r} - ${fdt_addr_r}
+
+bootcmd=km_checkbidhwk &&
+	setenv bootcmd 'if km_checktestboot;
+			then;
+				setenv boot_bank ${test_bank};
+			else;
+				setenv boot_bank ${actual_bank};
+			fi;
+			run ${subbootcmds}; reset' &&
+	setenv altbootcmd 'setenv boot_bank ${backup_bank};
+			   run ${subbootcmds};
+			   reset' &&
+	saveenv &&
+	saveenv &&
+	boot
+
+cramfsaddr=CONFIG_KM_CRAMFS_ADDR
+cramfsloadfdt=cramfsload ${fdt_addr_r} fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb
+cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}
+
+develop=tftp ${load_addr_r} scripts/develop-${arch}.txt &&
+	env import -t ${load_addr_r} ${filesize} &&
+	run setup_debug_env
+
+env_version=1
+fdt_addr_r=CONFIG_KM_FDT_ADDR
+flashargs=setenv bootargs root=mtdblock:rootfs${boot_bank} rootfstype=squashfs ro
+init=/sbin/init-overlay.sh
+load=tftpboot ${load_addr_r} ${hostname}/u-boot.bin
+load_addr_r=CONFIG_KM_KERNEL_ADDR
+pnvramsize=CONFIG_KM_PNVRAM
+
+ramfs=tftp ${load_addr_r} scripts/ramfs-${arch}.txt &&
+      env import -t ${load_addr_r} ${filesize} &&
+      run setup_debug_env
+
+release=run newenv; reset
+subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt set_fdthigh
+                      cramfsloadkernel flashargs add_default addpanic boot
+testbootcmd=setenv boot_bank ${test_bank}; run ${subbootcmds}; reset
+ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}
diff --git a/include/environment/pg-wcom/ls102xa.env b/include/environment/pg-wcom/ls102xa.env
new file mode 100644
index 0000000000..5b5bda95e2
--- /dev/null
+++ b/include/environment/pg-wcom/ls102xa.env
@@ -0,0 +1,29 @@
+#define WCOM_UBI_PARTITION_APP
+
+#include <environment/pg-wcom/common.env>
+
+EEprom_ivm=pca9547:70:9
+boot=bootm $load_addr_r - $fdt_addr_r
+checkfdt=true
+cramfsloadfdt=cramfsload $fdt_addr_r fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb
+ethrotate=no
+hwconfig=devdis:esdhc,usb3,usb2,sata,sec,dcu,duart2,qspi,can1,can2_4,ftm2_8,i2c2_3,sai1_4,lpuart2_6,asrc,spdif,lpuart1,ftm1
+netdev=eth2
+
+newenv=protect off CONFIG_ENV_ADDR_REDUND +0x40000 &&
+       erase CONFIG_ENV_ADDR_REDUND +0x40000 &&
+       protect on CONFIG_ENV_ADDR_REDUND +0x40000
+
+set_fdthigh=true
+
+update=protect off CONFIG_SYS_MONITOR_BASE +${filesize} &&
+       erase CONFIG_SYS_MONITOR_BASE +${filesize} &&
+       cp.b ${load_addr_r} CONFIG_SYS_MONITOR_BASE ${filesize} &&
+       protect on CONFIG_SYS_MONITOR_BASE +${filesize}
+
+update-nor=protect off CONFIG_SYS_FLASH_BASE +${filesize} &&
+	   erase CONFIG_SYS_FLASH_BASE +${filesize} &&
+	   cp.b ${load_addr_r} CONFIG_SYS_FLASH_BASE ${filesize} &&
+	   protect on CONFIG_SYS_MONITOR_BASE +0x100000
+
+uimage=uImage
-- 
2.31.1



More information about the U-Boot mailing list