mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Vicente Bergas <vicencb@gmail.com>
To: barebox@lists.infradead.org
Cc: Vicente Bergas <vicencb@gmail.com>
Subject: [PATCH 5/6] ArchosG9: add keyboard input and new reset menu entries
Date: Sat, 16 Mar 2013 23:59:41 +0100	[thread overview]
Message-ID: <1363474782-21973-6-git-send-email-vicencb@gmail.com> (raw)
In-Reply-To: <1363474782-21973-1-git-send-email-vicencb@gmail.com>

The number of "#if" has been reduced to have less obfuscation, now have the
three keys or have none of them

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 arch/arm/boards/archosg9/board.c                  | 22 ++++++++++++++++++
 arch/arm/boards/archosg9/env/bin/init             | 28 +++++++++++++++++++++++
 arch/arm/boards/archosg9/env/boot/sd-card-android |  2 +-
 arch/arm/boards/archosg9/env/boot/sd-card-linux   |  2 +-
 arch/arm/boards/archosg9/env/boot/usb-android     |  2 +-
 arch/arm/boards/archosg9/env/boot/usb-linux       |  2 +-
 arch/arm/boards/archosg9/env/menu/mainmenu        | 25 ++++++++++++++++++++
 arch/arm/configs/archosg9_defconfig               | 11 +++++----
 8 files changed, 86 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/boards/archosg9/env/bin/init
 create mode 100644 arch/arm/boards/archosg9/env/menu/mainmenu

diff --git a/arch/arm/boards/archosg9/board.c b/arch/arm/boards/archosg9/board.c
index 3ae7051..3605f77 100644
--- a/arch/arm/boards/archosg9/board.c
+++ b/arch/arm/boards/archosg9/board.c
@@ -21,6 +21,9 @@
 #include <sizes.h>
 #include <i2c/i2c.h>
 #include <gpio.h>
+#include <gpio_keys.h>
+#include <twl6030_pwrbtn.h>
+#include <readkey.h>
 #include "archos_features.h"
 
 static int archosg9_console_init(void){
@@ -48,11 +51,30 @@ mem_initcall(archosg9_mem_init);
 static struct i2c_board_info i2c_devices[] = {
 	{ I2C_BOARD_INFO("twl6030", 0x48), },
 };
+#if defined(CONFIG_KEYBOARD_TWL6030) && defined(CONFIG_KEYBOARD_GPIO)
+static struct twl6030_pwrbtn_platform_data pwrbtn_data = {
+	.code = KEY_ENTER
+};
+static struct gpio_keys_button keys[] = {
+	{ .code = KEY_UP  , .gpio = 43, .active_low = 1 },
+	{ .code = KEY_DOWN, .gpio = 44, .active_low = 1 },
+};
+static struct gpio_keys_platform_data gk_data = {
+	.buttons = keys,
+	.nbuttons = ARRAY_SIZE(keys),
+	.fifo_size = ARRAY_SIZE(keys)*sizeof(int)
+};
+#endif
 
 static int archosg9_devices_init(void){
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
 	omap44xx_add_i2c1(NULL);
 	omap44xx_add_mmc1(NULL);
+#if defined(CONFIG_KEYBOARD_TWL6030) && defined(CONFIG_KEYBOARD_GPIO)
+	add_generic_device_res("twl6030_pwrbtn", DEVICE_ID_DYNAMIC, 0, 0,
+		&pwrbtn_data);
+	add_gpio_keys_device(DEVICE_ID_DYNAMIC, &gk_data);
+#endif
 
 	armlinux_set_bootparams((void *)0x80000100);
 	/*
diff --git a/arch/arm/boards/archosg9/env/bin/init b/arch/arm/boards/archosg9/env/bin/init
new file mode 100644
index 0000000..0b36299
--- /dev/null
+++ b/arch/arm/boards/archosg9/env/bin/init
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+export PATH=/env/bin
+
+global hostname=generic
+global user=none
+global boot.default=net
+global allow_color=true
+global linux.bootargs.base
+#linux.bootargs.dyn.* will be cleared at the beginning of boot
+global linux.bootargs.dyn.ip
+global linux.bootargs.dyn.root
+global editcmd=sedit
+
+/env/config
+
+timeout -s -a 0
+autoboot="$?"
+
+for i in /env/init/*; do
+	. $i
+done
+
+if [ "$autoboot" = 0 ]; then
+	boot
+fi
+
+/env/menu/mainmenu
diff --git a/arch/arm/boards/archosg9/env/boot/sd-card-android b/arch/arm/boards/archosg9/env/boot/sd-card-android
index dc6f15e..a10a763 100644
--- a/arch/arm/boards/archosg9/env/boot/sd-card-android
+++ b/arch/arm/boards/archosg9/env/boot/sd-card-android
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 if [ "$1" = menu ]; then
-	boot-menu-add-entry "$0" "Android from SD card" "$2"
+	boot-menu-add-entry "$0" "Android from SD card"
 	exit
 fi
 
diff --git a/arch/arm/boards/archosg9/env/boot/sd-card-linux b/arch/arm/boards/archosg9/env/boot/sd-card-linux
index 1ae7340..2ba9b9e 100644
--- a/arch/arm/boards/archosg9/env/boot/sd-card-linux
+++ b/arch/arm/boards/archosg9/env/boot/sd-card-linux
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 if [ "$1" = menu ]; then
-	boot-menu-add-entry "$0" "Linux from SD card" "$2"
+	boot-menu-add-entry "$0" "Linux from SD card"
 	exit
 fi
 
diff --git a/arch/arm/boards/archosg9/env/boot/usb-android b/arch/arm/boards/archosg9/env/boot/usb-android
index f764681..a7ddabe 100644
--- a/arch/arm/boards/archosg9/env/boot/usb-android
+++ b/arch/arm/boards/archosg9/env/boot/usb-android
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 if [ "$1" = menu ]; then
-	boot-menu-add-entry "$0" "Android from usb" "$2"
+	boot-menu-add-entry "$0" "Android over usb"
 	exit
 fi
 
diff --git a/arch/arm/boards/archosg9/env/boot/usb-linux b/arch/arm/boards/archosg9/env/boot/usb-linux
index 1d8e919..12ae638 100644
--- a/arch/arm/boards/archosg9/env/boot/usb-linux
+++ b/arch/arm/boards/archosg9/env/boot/usb-linux
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 if [ "$1" = menu ]; then
-	boot-menu-add-entry "$0" "Linux from usb" "$2"
+	boot-menu-add-entry "$0" "Linux over usb"
 	exit
 fi
 
diff --git a/arch/arm/boards/archosg9/env/menu/mainmenu b/arch/arm/boards/archosg9/env/menu/mainmenu
new file mode 100644
index 0000000..6856261
--- /dev/null
+++ b/arch/arm/boards/archosg9/env/menu/mainmenu
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+savepath=$PATH
+export menupath=$PATH:/env/menu
+
+. /env/data/ansi-colors
+
+while true; do
+	export PATH=${menupath}
+
+	echo $PATH
+
+	menu -a -m boot -d "${CYAN}Welcome to Barebox${NC}"
+
+	boot-entries-collect
+
+	menu -e -a -m boot -c "settings" -d "Settings"
+	menu -e -a -m boot -c 'PATH=$savepath; echo "enter exit to return to menu"; sh' -d "${DARK_YELLOW}Shell${NC}"
+	menu -e -a -m boot -c 'boot_order mmc2_1 && reset' -d "${RED}Reboot into internal flash${NC}"
+	menu -e -a -m boot -c 'boot_order mmc1 && reset' -d "${RED}Reboot into SD card${NC}"
+	menu -e -a -m boot -c 'boot_order usb_1 && reset' -d "${RED}Reboot over usb${NC}"
+
+	menu -s -m boot
+	menu -r -m boot
+done
diff --git a/arch/arm/configs/archosg9_defconfig b/arch/arm/configs/archosg9_defconfig
index cb0f6b2..40e4433 100644
--- a/arch/arm/configs/archosg9_defconfig
+++ b/arch/arm/configs/archosg9_defconfig
@@ -3,8 +3,8 @@ CONFIG_ARCH_OMAP4=y
 CONFIG_OMAP4_USBBOOT=y
 CONFIG_MACH_ARCHOSG9=y
 CONFIG_THUMB2_BAREBOX=y
-CONFIG_CMD_ARM_MMUINFO=y
 CONFIG_ARM_BOARD_APPEND_ATAG=y
+CONFIG_CMD_ARM_MMUINFO=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_UNWIND=y
 # CONFIG_MMU is not set
@@ -52,6 +52,7 @@ CONFIG_CMD_BOOTM_AIMAGE=y
 CONFIG_CMD_UIMAGE=y
 # CONFIG_CMD_BOOTU is not set
 CONFIG_CMD_RESET=y
+CONFIG_CMD_BOOT_ORDER=y
 CONFIG_CMD_GO=y
 CONFIG_CMD_TIMEOUT=y
 CONFIG_CMD_PARTITION=y
@@ -70,9 +71,9 @@ CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_RESOLV=y
 CONFIG_DRIVER_SERIAL_NS16550=y
 CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
+CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT=y
 CONFIG_NET_USB=y
 CONFIG_NET_USB_SMSC95XX=y
-CONFIG_DRIVER_SERIAL_OMAP4_USBBOOT=y
 # CONFIG_SPI is not set
 CONFIG_I2C=y
 CONFIG_I2C_OMAP=y
@@ -81,13 +82,15 @@ CONFIG_USB_EHCI=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
 CONFIG_MCI_OMAP_HSMMC=y
+CONFIG_MFD_TWL6030=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_LED_TRIGGERS=y
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_TWL6030=y
 CONFIG_FS_TFTP=y
-CONFIG_FS_NFS=y
-CONFIG_MFD_TWL6030=y
 CONFIG_FS_OMAP4_USBBOOT=y
+CONFIG_FS_NFS=y
 CONFIG_FS_FAT=y
 CONFIG_FS_FAT_WRITE=y
 CONFIG_FS_FAT_LFN=y
-- 
1.8.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-03-16 23:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-16 22:59 [PATCH 0/6] ArchosG9: add keyboard input and new reset menu entries (v2) Vicente Bergas
2013-03-16 22:59 ` [PATCH 1/6] OMAP4: check for usb availability at device registration Vicente Bergas
2013-03-16 22:59 ` [PATCH 2/6] ArchosG9: zero all features before setting them Vicente Bergas
2013-03-16 22:59 ` [PATCH 3/6] gpio_keys: detect keys pressed before booting Vicente Bergas
2013-03-16 22:59 ` [PATCH 4/6] OMAP4: add command to select next boot device priority Vicente Bergas
2013-03-25  9:36   ` Sascha Hauer
2013-03-16 22:59 ` Vicente Bergas [this message]
2013-03-16 22:59 ` [PATCH 6/6] menu: avoid errors when building submenus Vicente Bergas
2013-03-25  9:39 ` [PATCH 0/6] ArchosG9: add keyboard input and new reset menu entries (v2) Sascha Hauer
2013-03-25 13:56   ` vj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363474782-21973-6-git-send-email-vicencb@gmail.com \
    --to=vicencb@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox