From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from smtp3-g21.free.fr ([2a01:e0c:1:1599::12]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W4UOU-0003RR-Qm for barebox@lists.infradead.org; Sat, 18 Jan 2014 11:48:56 +0000 From: Robert Jarzmik Date: Sat, 18 Jan 2014 12:48:08 +0100 Message-Id: <1390045689-23127-5-git-send-email-robert.jarzmik@free.fr> In-Reply-To: <1390045689-23127-1-git-send-email-robert.jarzmik@free.fr> References: <1390045689-23127-1-git-send-email-robert.jarzmik@free.fr> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] ARM: mioa701 change MTD layout To: barebox@lists.infradead.org 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 --- 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@3649536(msipl) -addpart /dev/mtd0.raw 270336@3649536(barebox) +addpart /dev/mtd0.raw 2162688@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@3456k(barebox)ro,256k(barebox-logo),128k(barebox-env),4M(kernel),-(root)" +mtdparts="2048k@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..9857c83e0718d0268dd8c2082193063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