[PATCH] ARM: mioa701 change MTD layout

Robert Jarzmik robert.jarzmik at free.fr
Sat Jan 18 06:48:08 EST 2014


As barebox has grown up in size, because UBI support is now embedded in
barebox, and because the IPL is at least rewritten to be fully GPL,
modify mioa701 support to take into account this new layout :
 - IPL is version 0.5
 - MTD layout is fully changed
 - the boot sequence is rewritten :
   - the volume up button triggers console mode
   - upon PowerOn or Sleep exit, power key is debounced and if not
   help board is powered off back
   - sdcard environment override can now stop the autoboot sequence
   - mtd environment override can now stop the autoboot sequence

Signed-off-by: Robert Jarzmik <robert.jarzmik at free.fr>
---
 arch/arm/boards/mioa701/env/bin/barebox_update  |    7 +--
 arch/arm/boards/mioa701/env/bin/console_mode    |    6 +++
 arch/arm/boards/mioa701/env/bin/init            |   55 +++++++++++++++++++----
 arch/arm/boards/mioa701/env/bin/sdcard_override |    3 ++
 arch/arm/boards/mioa701/env/config              |    3 +-
 arch/arm/boards/mioa701/env/data/dps1.raw.gz    |  Bin 1239 -> 1324 bytes
 6 files changed, 62 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/boards/mioa701/env/bin/console_mode

diff --git a/arch/arm/boards/mioa701/env/bin/barebox_update b/arch/arm/boards/mioa701/env/bin/barebox_update
index 1023770..632c209 100644
--- a/arch/arm/boards/mioa701/env/bin/barebox_update
+++ b/arch/arm/boards/mioa701/env/bin/barebox_update
@@ -1,10 +1,11 @@
 #!/bin/sh
 
 # Page+OOB specific partitions
-addpart /dev/mtd0.raw 1081344 at 3649536(msipl)
-addpart /dev/mtd0.raw 270336 at 3649536(barebox)
+addpart /dev/mtd0.raw 2162688 at 405504(barebox)
 
 if [ -r /barebox.BIP0 ]; then
+	dps1_unlock
 	erase /dev/mtd0.raw.barebox
-	cp -v /barebox.BIP0 /dev/mtd0.raw.barebox
+	cp -v /barebox.BIPO /dev/mtd0.raw.barebox
+	dps1_unlock
 fi
diff --git a/arch/arm/boards/mioa701/env/bin/console_mode b/arch/arm/boards/mioa701/env/bin/console_mode
new file mode 100644
index 0000000..aa06e92
--- /dev/null
+++ b/arch/arm/boards/mioa701/env/bin/console_mode
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Script to run barebox in console mode
+
+splash /dev/mtd0.barebox-logo2
+echo
+echo "Welcome to barebox console"
diff --git a/arch/arm/boards/mioa701/env/bin/init b/arch/arm/boards/mioa701/env/bin/init
index ab5d84d..e914eae 100644
--- a/arch/arm/boards/mioa701/env/bin/init
+++ b/arch/arm/boards/mioa701/env/bin/init
@@ -7,13 +7,55 @@ export PATH
 addpart /dev/mtd0 $mtdparts
 
 usbserial -s "Mio A701 usb gadget"
-led keyboard 0
 
-sdcard_override
+gpio_get_value 22
+is_usb_connected=$?
+
+gpio_get_value 93
+is_vol_up=$?
 
 fb0.enable=1
+# Phase1: Handle Vol-Up key case : drop immediately to console
+if [ $is_vol_up != 0 ]; then
+	console_mode
+	exit
+fi
+
+# Phase2: Handle Power-On case : debounce PowerUp key or Halt
+if [ $global.system.reset = "POR" -o $global.system.reset = "WKE" ]; then
+	powerup_released=0
+
+	gpio_get_value 0
+	is_power_up=$?
+	if [ $is_power_up = 0 ]; then
+		powerup_released=1
+	fi
+	msleep 500
+
+	gpio_get_value 0
+	is_power_up=$?
+	if [ $is_power_up = 0 ]; then
+		powerup_released=1
+	fi
+
+	if [ $powerup_released = 1 ]; then
+		echo "Power button not held, halting"
+		poweroff
+	fi
+fi
+
+# Phase3: display logo
+led keyboard 0
 splash /dev/mtd0.barebox-logo
 
+# Phase4: check for SD Card override
+sdcard_override
+if [ $? = 0 ]; then
+    console_mode
+    exit
+fi
+
+# Phase5: check for MTD override
 mtd_env_override
 if [ $? = 0 ]; then
     echo "Switching to custom environment"
@@ -21,20 +63,17 @@ if [ $? = 0 ]; then
     exit
 fi
 
+# Phase6: check for user interrupting auto-boot
 echo "No custom environment found"
-
-gpio_get_value 22
-is_usb_connected=$?
 if [ $is_usb_connected != 0 ]; then
 	echo -n "Hit any key to stop autoboot: "
 	timeout -a $autoboot_timeout
 	if [ $? != 0 ]; then
-		echo
-		echo "Welcome to barebox console"
+		console_mode
 		exit
 	fi
 fi
 
+# Phase7: auto-boot linux kernel
 echo "Booting linux kernel on docg3 chip ..."
-bootargs="$bootargs mtdparts=docg3.0:$mtdparts ubi.mtd=4 rootfstype=ubifs root=ubi0:linux_root ro"
 bootm /dev/mtd0.kernel
diff --git a/arch/arm/boards/mioa701/env/bin/sdcard_override b/arch/arm/boards/mioa701/env/bin/sdcard_override
index ab83534..7003fa9 100644
--- a/arch/arm/boards/mioa701/env/bin/sdcard_override
+++ b/arch/arm/boards/mioa701/env/bin/sdcard_override
@@ -12,5 +12,8 @@ if [ $mci0.probe = 1 ]; then
 	if [ -f /sdcard/barebox.env ]; then
 		loadenv /sdcard/barebox.env /env.sd
 		/env.sd/bin/init
+		exit
 	fi
 fi
+trigger_error_return_code
+exit
diff --git a/arch/arm/boards/mioa701/env/config b/arch/arm/boards/mioa701/env/config
index 2cc44fd..9201451 100644
--- a/arch/arm/boards/mioa701/env/config
+++ b/arch/arm/boards/mioa701/env/config
@@ -2,4 +2,5 @@
 
 autoboot_timeout=3
 
-mtdparts="256k at 3456k(barebox)ro,256k(barebox-logo),128k(barebox-env),4M(kernel),-(root)"
+mtdparts="2048k at 384k(barebox)ro,256k(barebox-logo),256k(barebox-logo2),128k(barebox-env),5120k(kernel),-(root)"
+bootargs="$bootargs mtdparts=docg3.0:$mtdparts ubi.mtd=5 rootfstype=ubifs root=ubi0:linux_root ro"
diff --git a/arch/arm/boards/mioa701/env/data/dps1.raw.gz b/arch/arm/boards/mioa701/env/data/dps1.raw.gz
index 93112bfca14762534de50443d4e0b4c9333d0936..9857c83e0718d0268dd8c2082193063cd3dfbc72 100644
GIT binary patch
literal 1324
zcmV+{1=IQ;iwFo+Y|>Hy17vV>F)ngpcL42GacEUl82`?__vvdcy>1KV9D1A!%r?54
zujjVx?YVHIDc)LT!~!*=OvAMd!UEskb4xU8If)^`PMCj1U=)Nx@$8LJ{t?;=B>dyu
zd$_0#W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