diff mbox series

[v1,11/12] powerpc/mpc85xx: socrates: enable protected Environment

Message ID 20230124170700.3889830-12-hs@denx.de
State Accepted
Commit 9e85d186eaa92fb9d460ed4954eb591c3581bc80
Delegated to: Tom Rini
Headers show
Series powerpc: mpc85xx: fixes and updates for socrates board | expand

Commit Message

Heiko Schocher Jan. 24, 2023, 5:06 p.m. UTC
enable protected Environment on socrates board.

Signed-off-by: Heiko Schocher <hs@denx.de>
---

 board/socrates/socrates.c  | 17 +++++++++++++++++
 configs/socrates_defconfig |  4 ++++
 include/configs/socrates.h |  2 ++
 3 files changed, 23 insertions(+)

Comments

Tom Rini Feb. 7, 2023, 4:51 p.m. UTC | #1
On Tue, Jan 24, 2023 at 06:06:59PM +0100, Heiko Schocher wrote:

> enable protected Environment on socrates board.
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index 1d63c81a9c..02e6afb099 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -13,6 +13,7 @@ 
 #include <common.h>
 #include <clock_legacy.h>
 #include <env.h>
+#include <env_internal.h>
 #include <init.h>
 #include <pci.h>
 #include <uuid.h>
@@ -221,3 +222,19 @@  int get_serial_clock(void)
 {
 	return 333333330;
 }
+
+enum env_location env_get_location(enum env_operation op, int prio)
+{
+	if (op == ENVOP_SAVE || op == ENVOP_ERASE)
+		return ENVL_FLASH;
+
+	switch (prio) {
+	case 0:
+		return ENVL_NOWHERE;
+	case 1:
+		return ENVL_FLASH;
+	default:
+		return ENVL_UNKNOWN;
+	}
+	return ENVL_UNKNOWN;
+}
diff --git a/configs/socrates_defconfig b/configs/socrates_defconfig
index 8640dc990a..d4c08f1941 100644
--- a/configs/socrates_defconfig
+++ b/configs/socrates_defconfig
@@ -68,9 +68,13 @@  CONFIG_MTDIDS_DEFAULT="nor0=fe000000.nor_flash,nand0=socrates_nand"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=fe000000.nor_flash:13312k(system1),13312k(system2),5120k(data),128k(env),128k(env-red),768k(u-boot);socrates_nand:256M(ubi-data1),-(ubi-data2)"
 # CONFIG_CMD_IRQ is not set
 CONFIG_OF_CONTROL=y
+CONFIG_ENV_IS_NOWHERE=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
 CONFIG_ENV_ADDR_REDUND=0xFFF00000
+CONFIG_ENV_APPEND=y
+CONFIG_ENV_WRITEABLE_LIST=y
+CONFIG_ENV_ACCESS_IGNORE_FORCE=y
 CONFIG_USE_ETHPRIME=y
 CONFIG_ETHPRIME="eTSEC0"
 CONFIG_SPD_EEPROM=y
diff --git a/include/configs/socrates.h b/include/configs/socrates.h
index e2afba96cd..305914de85 100644
--- a/include/configs/socrates.h
+++ b/include/configs/socrates.h
@@ -171,6 +171,8 @@ 
 	SOCRATES_ENV_MTD \
 	""
 
+#define CFG_ENV_FLAGS_LIST_STATIC "ethaddr:mw,eth1addr:mw,system1_addr:xw,serial#:sw,ethact:sw,ethprime:sw"
+
 /* pass open firmware flat tree */
 
 #endif	/* __CONFIG_H */