[PATCH 29/41] Convert CONFIG_OVERWRITE_ETHADDR_ONCE to Kconfig

Tom Rini
2022-12-02T21:48:23Z

This converts the following to Kconfig:
CONFIG_OVERWRITE_ETHADDR_ONCE

Signed-off-by: Tom Rini <trini@konsulko.com>
---
README | 7 -------
configs/M5253DEMO_defconfig | 1 +
configs/M5275EVB_defconfig | 1 +
configs/eb_cpu5282_defconfig | 1 +
configs/eb_cpu5282_internal_defconfig | 1 +
env/Kconfig | 9 +++++++++
include/configs/M5253DEMO.h | 2 --
include/configs/M5275EVB.h | 4 ----
include/configs/eb_cpu5282.h | 4 ----
9 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/README b/README
index 9e2627863ce5..3ebee1cb3755 100644
--- a/README
+++ b/README
@@ -1071,13 +1071,6 @@ The following options need to be configured:
completely disabled. Anybody can change or delete
these parameters.

- Alternatively, if you define _both_ an ethaddr in the
- default env _and_ CONFIG_OVERWRITE_ETHADDR_ONCE, a default
- Ethernet address is installed in the environment,
- which can be changed exactly ONCE by the user. [The
- serial# is unaffected by this, i. e. it remains
- read-only.]
-
The same can be accomplished in a more flexible way
for any variable by configuring the type of access
to allow for those variables in the ".flags" variable
diff --git a/configs/M5253DEMO_defconfig b/configs/M5253DEMO_defconfig
index 4de6290b7d31..ea079972c9bc 100644
--- a/configs/M5253DEMO_defconfig
+++ b/configs/M5253DEMO_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_CACHE=y
CONFIG_CMD_EXT2=y
CONFIG_CMD_FAT=y
CONFIG_MAC_PARTITION=y
+CONFIG_OVERWRITE_ETHADDR_ONCE=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_USE_HOSTNAME=y
CONFIG_HOSTNAME="M5253DEMO"
diff --git a/configs/M5275EVB_defconfig b/configs/M5275EVB_defconfig
index 01961e5ae27f..d84d9d98c5ac 100644
--- a/configs/M5275EVB_defconfig
+++ b/configs/M5275EVB_defconfig
@@ -31,6 +31,7 @@ CONFIG_CMD_MII=y
CONFIG_MII_INIT=y
CONFIG_CMD_PING=y
CONFIG_CMD_CACHE=y
+CONFIG_OVERWRITE_ETHADDR_ONCE=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y
CONFIG_SYS_RX_ETH_BUFFER=8
diff --git a/configs/eb_cpu5282_defconfig b/configs/eb_cpu5282_defconfig
index a831c1c5d2aa..7304b4938725 100644
--- a/configs/eb_cpu5282_defconfig
+++ b/configs/eb_cpu5282_defconfig
@@ -32,6 +32,7 @@ CONFIG_BOOTP_BOOTFILESIZE=y
CONFIG_CMD_MII=y
CONFIG_MII_INIT=y
CONFIG_CMD_DATE=y
+CONFIG_OVERWRITE_ETHADDR_ONCE=y
CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y
CONFIG_SYS_RX_ETH_BUFFER=8
CONFIG_SYS_I2C_LEGACY=y
diff --git a/configs/eb_cpu5282_internal_defconfig b/configs/eb_cpu5282_internal_defconfig
index 6a673c918110..5ecdda418aad 100644
--- a/configs/eb_cpu5282_internal_defconfig
+++ b/configs/eb_cpu5282_internal_defconfig
@@ -30,6 +30,7 @@ CONFIG_BOOTP_BOOTFILESIZE=y
CONFIG_CMD_MII=y
CONFIG_MII_INIT=y
CONFIG_CMD_DATE=y
+CONFIG_OVERWRITE_ETHADDR_ONCE=y
CONFIG_SYS_FAULT_ECHO_LINK_DOWN=y
CONFIG_SYS_RX_ETH_BUFFER=8
CONFIG_SYS_I2C_LEGACY=y
diff --git a/env/Kconfig b/env/Kconfig
index c28d9e89f68b..7ca992aa1d40 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -30,6 +30,15 @@ config ENV_OVERWRITE
Use this to permit overriding of certain environmental variables
like Ethernet and Serial

+config OVERWRITE_ETHADDR_ONCE
+ bool "Enable overwriting ethaddr environment variables once"
+ depends on !ENV_OVERWRITE
+ help
+ Enable this to allow for the ethaddr environment variables to be
+ overwritten one time per boot, only. This allows for a default
+ to be installed in the environment, which can be changed exactly ONCE
+ by the user.
+
config ENV_MIN_ENTRIES
int "Minimum number of entries in the environment hashtable"
default 64
diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h
index 65a7aa04086e..bc156df20d51 100644
--- a/include/configs/M5253DEMO.h
+++ b/include/configs/M5253DEMO.h
@@ -20,8 +20,6 @@
env/embedded.o(.text*);

#ifdef CONFIG_DRIVER_DM9000
-# define CONFIG_OVERWRITE_ETHADDR_ONCE
-
# define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"inpclk=" __stringify(CONFIG_SYS_INPUT_CLKSRC) "\0" \
diff --git a/include/configs/M5275EVB.h b/include/configs/M5275EVB.h
index ff9f85358963..41974cff410d 100644
--- a/include/configs/M5275EVB.h
+++ b/include/configs/M5275EVB.h
@@ -38,10 +38,6 @@
#define CFG_SYS_I2C_PINMUX_CLR (0xFFF0)
#define CFG_SYS_I2C_PINMUX_SET (0x000F)

-#ifdef CONFIG_MCFFEC
-# define CONFIG_OVERWRITE_ETHADDR_ONCE
-#endif /* FEC_ENET */
-
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"loadaddr=10000\0" \
diff --git a/include/configs/eb_cpu5282.h b/include/configs/eb_cpu5282.h
index b267b74b1595..26e4ade34ee7 100644
--- a/include/configs/eb_cpu5282.h
+++ b/include/configs/eb_cpu5282.h
@@ -42,10 +42,6 @@
* Network *
*----------------------------------------------------------------------*/

-#ifdef CONFIG_MCFFEC
-#define CONFIG_OVERWRITE_ETHADDR_ONCE
-#endif
-
/*-------------------------------------------------------------------------
* Low Level Configuration Settings
* (address mappings, register initial values, etc.)
--
2.25.1