diff mbox series

[OpenWrt-Devel,v1,2/8] apm821xx: MR24: add to uboot-envtools

Message ID d920aa95897068b7d50edf483aa6535dede681ea.1539808453.git.chunkeey@gmail.com
State Accepted
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel,v1,1/8] apm821xx: add uboot-envtools support | expand

Commit Message

Christian Lamparter Oct. 17, 2018, 8:37 p.m. UTC
This patch adds the complicated u-boot
environment access settings for to the
MR24 target.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
 package/boot/uboot-envtools/files/apm821xx |  4 ++++
 target/linux/apm821xx/dts/meraki-mr24.dts  | 25 +++++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/package/boot/uboot-envtools/files/apm821xx b/package/boot/uboot-envtools/files/apm821xx
index 3cedd8bc2d..94c0d8944a 100644
--- a/package/boot/uboot-envtools/files/apm821xx
+++ b/package/boot/uboot-envtools/files/apm821xx
@@ -10,6 +10,10 @@  touch /etc/config/ubootenv
 board=$(board_name)
 
 case "$board" in
+meraki,mr24)
+	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4"
+	ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x4000" "4"
+	;;
 esac
 
 config_load ubootenv
diff --git a/target/linux/apm821xx/dts/meraki-mr24.dts b/target/linux/apm821xx/dts/meraki-mr24.dts
index fc879fe8c1..3b05d9c24e 100644
--- a/target/linux/apm821xx/dts/meraki-mr24.dts
+++ b/target/linux/apm821xx/dts/meraki-mr24.dts
@@ -55,7 +55,30 @@ 
 
 			partition@0 {
 				label = "u-boot";
-				reg = <0x00000000 0x00170000>;
+				reg = <0x00000000 0x00150000>;
+				read-only;
+			};
+
+			partition@150000 {
+				/*
+				 * The u-boot environment size is one NAND
+				 * block (16KiB). u-boot allocates four NAND
+				 * blocks (64KiB) in order to have spares
+				 * around for bad block management
+				 */
+				label = "u-boot-env";
+				reg = <0x00150000 0x00010000>;
+				read-only;
+			};
+
+			partition@160000 {
+				/*
+				 * redundant u-boot environment.
+				 * has to be kept it in sync with the
+				 * data in "u-boot-env".
+				 */
+				label = "u-boot-env-redundant";
+				reg = <0x00160000 0x00010000>;
 				read-only;
 			};