Skip to contentSkip to conversation

ArchosG9: add keyboard input and new reset menu entries

PATCH In review Vicente Bergas 2 participants 9 messages Mar 10, 2013 – Mar 12, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ArchosG9: add keyboard input and new reset menu entries

The first three patches are generic.
The last patch in this series depends on:
"[PATCH 0/9] Add support for booting ArchosG9 from sd-card"

Vicente Bergas (4):
gpio_keys: detect keys pressed before booting.
twl6030: add power button as an input key
OMAP4: add command to select next boot device priority
ArchosG9: add keyboard input and new reset menu entries

 arch/arm/boards/archosg9/board.c                | 25 +++++++
 arch/arm/boards/archosg9/env/bin/init           | 28 ++++++++
 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      | 29 ++++++++
 arch/arm/configs/archosg9_defconfig             | 11 +--
 arch/arm/mach-omap/include/mach/omap4-silicon.h | 20 ++++++
 arch/arm/mach-omap/omap4_generic.c              | 20 ++++++
 commands/Kconfig                                |  5 ++
 commands/Makefile                               |  1 +
 commands/boot_order.c                           | 83 +++++++++++++++++++++
 drivers/input/Kconfig                           |  7 ++
 drivers/input/Makefile                          |  1 +
 drivers/input/gpio_keys.c                       |  2 +
 drivers/input/twl6030_pwrbtn.c                  | 95 +++++++++++++++++++++++++
 include/twl6030_pwrbtn.h                        | 23 ++++++
 16 files changed, 348 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boards/archosg9/env/bin/init
 create mode 100644 arch/arm/boards/archosg9/env/menu/mainmenu
 create mode 100644 commands/boot_order.c
 create mode 100644 drivers/input/twl6030_pwrbtn.c
 create mode 100644 include/twl6030_pwrbtn.h
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 1/4 gpio_keys: detect keys pressed before booting.

If a key is pressed but not released before booting and the key is connected to an active low gpio it's not detected. This patch solves that.

---
 drivers/input/gpio_keys.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/input/gpio_keys.c +2 -0
index b02e0ed..b439111 100644
@@ -86,6 +86,8 @@ static int __init gpio_keys_probe(struct device_d *dev)
 			return ret;
 		}
 		gpio_direction_input(gpio);
+		pdata->buttons[i].previous_state =
+			pdata->buttons[i].active_low;
 	}
 
 	pdata->poller.func = gpio_key_poller;
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/4 twl6030: add power button as an input key

In reply to Vicente Bergas
---
 drivers/input/Kconfig          |  7 ++++
 drivers/input/Makefile         |  1 +
 drivers/input/twl6030_pwrbtn.c | 95 ++++++++++++++++++++++++++++++++++++++++++
 include/twl6030_pwrbtn.h       | 23 ++++++++++
 4 files changed, 126 insertions(+)
 create mode 100644 drivers/input/twl6030_pwrbtn.c
 create mode 100644 include/twl6030_pwrbtn.h
drivers/input/Kconfig +7 -0
index a6f1f47..3d9016b 100644
@@ -38,4 +38,11 @@ config KEYBOARD_QT1070
 	  Say Y here if you want to use Atmel AT42QT1070 QTouch
 	  Sensor chip as input device.
 
+config KEYBOARD_TWL6030
+	tristate "TWL6030 power button"
+	depends on MFD_TWL6030
+	select POLLER
+	help
+	  Say Y here if you want to use TWL6030 power button as a key.
+
 endmenu
drivers/input/Makefile +1 -0
index d042980..b9bcc82 100644
@@ -1,3 +1,4 @@
 obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
+obj-$(CONFIG_KEYBOARD_TWL6030) += twl6030_pwrbtn.o
 obj-$(CONFIG_KEYBOARD_IMX_KEYPAD) += imx_keypad.o
 obj-$(CONFIG_KEYBOARD_QT1070) += qt1070.o
drivers/input/twl6030_pwrbtn.c new file +95 -0

95 lines not on this page · raw message

include/twl6030_pwrbtn.h new file +23 -0
new file mode 100644
index 0000000..e7e8383
@@ -0,0 +1,23 @@
+#ifndef _TWL6030_PWRBTN_H
+#define _TWL6030_PWRBTN_H
+
+#include <poller.h>
+#include <kfifo.h>
+#include <mfd/twl6030.h>
+
+struct twl6030_pwrbtn_platform_data {
+	/* Configuration parameters */
+	int code;
+	/* optional */
+	int fifo_size;
+
+	/* internal */
+	u8 previous_state;
+
+	struct twl6030 *twl6030;
+	struct kfifo *recv_fifo;
+	struct poller_struct poller;
+	struct console_device cdev;
+};
+
+#endif
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

Re: [PATCH 2/4] twl6030: add power button as an input key

drivers/input/twl6030_pwrbtn.c line 67

Quoted 11 lines · Vicente Bergas
drivers/input/twl6030_pwrbtn.c new file +10 -0
+
+static int __init twl6030_pwrbtn_probe(struct device_d *dev)
+{
+	struct twl6030_pwrbtn_platform_data *pdata;
+	struct console_device *cdev;
+
+	pdata = dev->platform_data;
+
+	if (!pdata) {
+		pr_err("missing platform_data\n");

use dev_err and friends for driver messages.

Quoted 36 lines
drivers/input/twl6030_pwrbtn.c new file +28 -0
+		return -ENODEV;
+	}
+
+	pdata->twl6030 = twl6030_get();
+	if (!pdata->fifo_size)
+		pdata->fifo_size = 4;
+
+	pdata->recv_fifo = kfifo_alloc(pdata->fifo_size);
+
+	pdata->poller.func = ic2_key_poller;
+
+	cdev = &pdata->cdev;
+	dev->type_data = cdev;
+	cdev->dev = dev;
+	cdev->f_caps = CONSOLE_STDIN;
+	cdev->tstc = twl6030_pwrbtn_tstc;
+	cdev->getc = twl6030_pwrbtn_getc;
+
+	console_register(&pdata->cdev);
+
+	return poller_register(&pdata->poller);
+}
+
+static struct driver_d twl6030_pwrbtn_driver = {
+	.name	= "twl6030_pwrbtn",
+	.probe	= twl6030_pwrbtn_probe,
+};
+device_platform_driver(twl6030_pwrbtn_driver);
include/twl6030_pwrbtn.h new file +2 -0
new file mode 100644
index 0000000..e7e8383
@@ -0,0 +1,23 @@
+#ifndef _TWL6030_PWRBTN_H
+#define _TWL6030_PWRBTN_H

include/twl6030_pwrbtn.h line 12

Quoted 10 lines
include/twl6030_pwrbtn.h new file +10 -0
+
+#include <poller.h>
+#include <kfifo.h>
+#include <mfd/twl6030.h>
+
+struct twl6030_pwrbtn_platform_data {
+	/* Configuration parameters */
+	int code;
+	/* optional */
+	int fifo_size;

Since this driver handles a single key only, must the fifo size be configurable?

include/twl6030_pwrbtn.h line 21

Quoted 9 lines
include/twl6030_pwrbtn.h new file +9 -0
+
+	/* internal */
+	u8 previous_state;
+
+	struct twl6030 *twl6030;
+	struct kfifo *recv_fifo;
+	struct poller_struct poller;
+	struct console_device cdev;
+};

Please do not abuse platform_data for private driver data use. Allocate a separate struct for it.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 3/4 OMAP4: add command to select next boot device priority

In reply to Vicente Bergas

On OMAP4 SoC there is a SAR memory region (Save & Rescue) where the ROM code reads the device to boot from.
This patch adds a way to set this.

---
 arch/arm/mach-omap/include/mach/omap4-silicon.h | 20 ++++++
 arch/arm/mach-omap/omap4_generic.c              | 20 ++++++
 commands/Kconfig                                |  5 ++
 commands/Makefile                               |  1 +
 commands/boot_order.c                           | 83 +++++++++++++++++++++++++
 5 files changed, 129 insertions(+)
 create mode 100644 commands/boot_order.c
arch/arm/mach-omap/include/mach/omap4-silicon.h +20 -0
index 9e82435..7e67abc 100644
@@ -161,6 +161,25 @@
 #define OMAP44XX_PRM_RSTCTRL_RESET	0x01
 
 /*
+ * SAR (Save & Rescue) memory region
+ */
+#define OMAP44XX_SAR_RAM_BASE      0x4a326000
+#define OMAP44XX_SAR_CH_ADDRESS	   (OMAP44XX_SAR_RAM_BASE + 0xA00)
+#define OMAP44XX_SAR_CH_START	   (OMAP44XX_SAR_RAM_BASE + 0xA0C)
+#define OMAP44XX_SAR_BOOT_VOID     0x00
+#define OMAP44XX_SAR_BOOT_XIP      0x01
+#define OMAP44XX_SAR_BOOT_XIPWAIT  0x02
+#define OMAP44XX_SAR_BOOT_NAND     0x03
+#define OMAP44XX_SAR_BOOT_ONENAND  0x04
+#define OMAP44XX_SAR_BOOT_MMC1     0x05
+#define OMAP44XX_SAR_BOOT_MMC2_1   0x06
+#define OMAP44XX_SAR_BOOT_MMC2_2   0x07
+#define OMAP44XX_SAR_BOOT_UART     0x43
+#define OMAP44XX_SAR_BOOT_USB_1    0x45
+#define OMAP44XX_SAR_BOOT_USB_ULPI 0x46
+#define OMAP44XX_SAR_BOOT_USB_2    0x47
+
+/*
  * Non-secure SRAM Addresses
  * Non-secure RAM starts at 0x40300000 for GP devices. But we keep SRAM_BASE
  * at 0x40304000(EMU base) so that our code works for both EMU and GP
@@ -212,6 +231,7 @@ void omap4_ddr_init(const struct ddr_regs *, const struct dpll_param *);
 void omap4_power_i2c_send(u32);
 unsigned int omap4_revision(void);
 noinline int omap4_scale_vcores(unsigned vsel0_pin);
+void omap4_set_warmboot_order(u32 *device_list);
 
 #endif
 
arch/arm/mach-omap/omap4_generic.c +20 -0
index 2a09eb6..7f881f8 100644
@@ -41,6 +41,26 @@ void __noreturn reset_cpu(unsigned long addr)
 	while (1);
 }
 
+void omap4_set_warmboot_order(u32 *device_list)
+{
+	const u32 CH[] = {
+		0xCF00AA01,
+		0x0000000C,
+		(device_list[0] << 16) | 0x0000,
+		(device_list[2] << 16) | device_list[1],
+		0x0000 | device_list[3],
+		0x00000000,
+		0x00000000,
+		0x00000000,
+		0x00000000
+	};
+	int i;
+
+	for (i = 0; i < sizeof(CH)/sizeof(CH[0]); i++)
+		writel(CH[i], OMAP44XX_SAR_CH_START + i*sizeof(CH[0]));
+	writel(OMAP44XX_SAR_CH_START, OMAP44XX_SAR_CH_ADDRESS);
+}
+
 #define WATCHDOG_WSPR	0x48
 #define WATCHDOG_WWPS	0x34
 
commands/Kconfig +5 -0
index c1454c7..b4feb27 100644
@@ -474,6 +474,11 @@ config CMD_POWEROFF
 	depends on HAS_POWEROFF
 	prompt "poweroff"
 
+config CMD_BOOT_ORDER
+	tristate
+	depends on ARCH_OMAP4
+	prompt "boot_order"
+
 config CMD_GO
 	tristate
 	prompt "go"
commands/Makefile +1 -0
index 0ae6b95..428da57 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_CMD_SLEEP)		+= sleep.o
 obj-$(CONFIG_CMD_MSLEEP)	+= msleep.o
 obj-$(CONFIG_CMD_RESET)		+= reset.o
 obj-$(CONFIG_CMD_POWEROFF)	+= poweroff.o
+obj-$(CONFIG_CMD_BOOT_ORDER)	+= boot_order.o
 obj-$(CONFIG_CMD_GO)		+= go.o
 obj-$(CONFIG_NET)		+= net.o
 obj-$(CONFIG_CMD_PARTITION)	+= partition.o
commands/boot_order.c new file +83 -0

83 lines not on this page · raw message

Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

Re: [PATCH 3/4] OMAP4: add command to select next boot device priority

Quoted 18 lines · Vicente Bergas

On OMAP4 SoC there is a SAR memory region (Save & Rescue) where the ROM code reads the device to boot from.
This patch adds a way to set this.

---
 arch/arm/mach-omap/include/mach/omap4-silicon.h | 20 ++++++
 arch/arm/mach-omap/omap4_generic.c              | 20 ++++++
 commands/Kconfig                                |  5 ++
 commands/Makefile                               |  1 +
 commands/boot_order.c                           | 83 +++++++++++++++++++++++++
 5 files changed, 129 insertions(+)
 create mode 100644 commands/boot_order.c
commands/boot_order.c new file +4 -0
+static int cmd_boot_order(int argc, char *argv[])
+{
+	u32 device_list[] = {
+		OMAP44XX_SAR_BOOT_VOID,

commands/boot_order.c line 34

Quoted 10 lines
commands/boot_order.c new file +10 -0
+		OMAP44XX_SAR_BOOT_VOID,
+		OMAP44XX_SAR_BOOT_VOID,
+		OMAP44XX_SAR_BOOT_VOID,
+	};
+	int i, j = 1, do_reset = 0;
+
+	if (argc > 1 && strcmp(argv[1], "-r") == 0) {
+		do_reset = 1;
+		j = 2;
+	}

You should use getopt() to parse options.

Quoted 13 lines
commands/boot_order.c new file +13 -0
+	for (i = 0; i < 4 && j < argc; i++, j++) {
+		if      (strcmp(argv[j], "xip") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_XIP;
+		else if (strcmp(argv[j], "xipwait") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_XIPWAIT;
+		else if (strcmp(argv[j], "nand") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_NAND;
+		else if (strcmp(argv[j], "onenand") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_ONENAND;
+		else if (strcmp(argv[j], "mmc1") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_MMC1;
+		else if (strcmp(argv[j], "mmc2_1") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_MMC2_1;

commands/boot_order.c line 57

Quoted 10 lines
commands/boot_order.c new file +10 -0
+		else if (strcmp(argv[j], "mmc2_2") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_MMC2_2;
+		else if (strcmp(argv[j], "uart") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_UART;
+		else if (strcmp(argv[j], "usb_1") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_USB_1;
+		else if (strcmp(argv[j], "usb_ulpi") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_USB_ULPI;
+		else if (strcmp(argv[j], "usb_2") == 0)
+			device_list[i] = OMAP44XX_SAR_BOOT_USB_2;

You could add a table for this, something like

struct bootsrc {
	const char *name;
	uint32_t sar;
};

commands/boot_order.c line 67

Quoted 10 lines
commands/boot_order.c new file +10 -0
+	}
+	if (device_list[0] == OMAP44XX_SAR_BOOT_VOID) {
+		printf("First boot device can't be void\n");
+		return COMMAND_ERROR_USAGE;
+	}
+	omap4_set_warmboot_order(device_list);
+	if (do_reset) {
+		shutdown_barebox();
+		reset_cpu(0);
+	}

Why is this done here? I mean you could execute the reset command after this one.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH 4/4 ArchosG9: add keyboard input and new reset menu entries

In reply to Vicente Bergas
---
 arch/arm/boards/archosg9/board.c              | 25 +++++++++++++++++++++++
 arch/arm/boards/archosg9/env/bin/init         | 28 ++++++++++++++++++++++++++
 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    | 29 +++++++++++++++++++++++++++
 arch/arm/configs/archosg9_defconfig           | 11 ++++++----
 6 files changed, 91 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boards/archosg9/env/bin/init
 create mode 100644 arch/arm/boards/archosg9/env/menu/mainmenu
arch/arm/boards/archosg9/board.c +25 -0
index bf247de..edeb871 100644
@@ -20,6 +20,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){
@@ -44,11 +47,33 @@ mem_initcall(archosg9_mem_init);
 static struct i2c_board_info i2c_devices[] = {
 	{ I2C_BOARD_INFO("twl6030", 0x48), },
 };
+#ifdef CONFIG_KEYBOARD_TWL6030
+static struct twl6030_pwrbtn_platform_data pwrbtn_data = {
+	.code = KEY_ENTER
+};
+#endif
+#ifdef CONFIG_KEYBOARD_GPIO
+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),
+};
+#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);
+#ifdef CONFIG_KEYBOARD_TWL6030
+	add_generic_device_res("twl6030_pwrbtn", DEVICE_ID_DYNAMIC, 0, 0,
+		&pwrbtn_data);
+#endif
+#ifdef CONFIG_KEYBOARD_GPIO
+	add_gpio_keys_device(DEVICE_ID_DYNAMIC, &gk_data);
+#endif
 
 	armlinux_set_bootparams((void *)0x80000100);
 	/*
arch/arm/boards/archosg9/env/bin/init new file +28 -0
new file mode 100644
index 0000000..0b36299
@@ -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
arch/arm/boards/archosg9/env/boot/usb-android +1 -1
index f764681..7c6fb1f 100644
@@ -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" "$2"
 	exit
 fi
 
arch/arm/boards/archosg9/env/boot/usb-linux +1 -1
index 1d8e919..fe979fb 100644
@@ -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" "$2"
 	exit
 fi
 
arch/arm/boards/archosg9/env/menu/mainmenu new file +29 -0
new file mode 100644
index 0000000..1880692
@@ -0,0 +1,29 @@
+#!/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 boot
+
+	menu -e -a -R -m boot -c "$global.editcmd /env/network/eth0" -d "Network settings"
+	menu -e -a -R -m boot -c "$global.editcmd /env/config" -d "Config settings"
+	menu -e -a -m boot -c "boot-entries-edit" -d "Edit boot entries"
+	menu -e -a -m boot -c "init-entries-edit" -d "Edit init entries"
+	menu -e -a -R -m boot -c "saveenv || echo \"failed to save environment\" && sleep 2" -d "Save 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 -r mmc2_1' -d "${RED}Reboot into internal flash${NC}"
+	menu -e -a -m boot -c 'boot_order -r mmc1' -d "${RED}Reboot into SD card${NC}"
+	menu -e -a -m boot -c 'boot_order -r usb_1' -d "${RED}Reboot over usb${NC}"
+
+	menu -s -m boot
+	menu -r -m boot
+done
arch/arm/configs/archosg9_defconfig +7 -4
index cb0f6b2..40e4433 100644
@@ -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
Signature · 7 lines
1.8.1.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw
Quoted 48 lines · Vicente Bergas
---
 arch/arm/boards/archosg9/board.c              | 25 +++++++++++++++++++++++
 arch/arm/boards/archosg9/env/bin/init         | 28 ++++++++++++++++++++++++++
 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    | 29 +++++++++++++++++++++++++++
 arch/arm/configs/archosg9_defconfig           | 11 ++++++----
 6 files changed, 91 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boards/archosg9/env/bin/init
 create mode 100644 arch/arm/boards/archosg9/env/menu/mainmenu
arch/arm/boards/archosg9/board.c +18 -0
index bf247de..edeb871 100644
@@ -20,6 +20,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){
@@ -44,11 +47,33 @@ mem_initcall(archosg9_mem_init);
 static struct i2c_board_info i2c_devices[] = {
 	{ I2C_BOARD_INFO("twl6030", 0x48), },
 };
+#ifdef CONFIG_KEYBOARD_TWL6030
+static struct twl6030_pwrbtn_platform_data pwrbtn_data = {
+	.code = KEY_ENTER
+};
+#endif
+#ifdef CONFIG_KEYBOARD_GPIO
+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),
+};
+#endif
 
 static int archosg9_devices_init(void){

arch/arm/boards/archosg9/board.c mem_initcall(archosg9_mem_init); · line 76

Quoted 10 lines
arch/arm/boards/archosg9/board.c +7 -0
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
 	omap44xx_add_i2c1(NULL);
 	omap44xx_add_mmc1(NULL);
+#ifdef CONFIG_KEYBOARD_TWL6030
+	add_generic_device_res("twl6030_pwrbtn", DEVICE_ID_DYNAMIC, 0, 0,
+		&pwrbtn_data);
+#endif
+#ifdef CONFIG_KEYBOARD_GPIO
+	add_gpio_keys_device(DEVICE_ID_DYNAMIC, &gk_data);
+#endif

If you are not really really concerned about binary size I suggest to drop the ifdefs. It makes for better readability.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
author
#8 lore raw
Quoted 63 lines · Sascha Hauer
Quoted 48 lines · Vicente Bergas
---
 arch/arm/boards/archosg9/board.c              | 25 +++++++++++++++++++++++
 arch/arm/boards/archosg9/env/bin/init         | 28 ++++++++++++++++++++++++++
 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    | 29 +++++++++++++++++++++++++++
 arch/arm/configs/archosg9_defconfig           | 11 ++++++----
 6 files changed, 91 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boards/archosg9/env/bin/init
 create mode 100644 arch/arm/boards/archosg9/env/menu/mainmenu
arch/arm/boards/archosg9/board.c +18 -0
index bf247de..edeb871 100644
@@ -20,6 +20,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){
@@ -44,11 +47,33 @@ mem_initcall(archosg9_mem_init);
 static struct i2c_board_info i2c_devices[] = {
      { I2C_BOARD_INFO("twl6030", 0x48), },
 };
+#ifdef CONFIG_KEYBOARD_TWL6030
+static struct twl6030_pwrbtn_platform_data pwrbtn_data = {
+     .code = KEY_ENTER
+};
+#endif
+#ifdef CONFIG_KEYBOARD_GPIO
+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),
+};
+#endif
 
 static int archosg9_devices_init(void){

arch/arm/boards/archosg9/board.c mem_initcall(archosg9_mem_init); · line 76

Quoted 10 lines
arch/arm/boards/archosg9/board.c +7 -0
      i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
      omap44xx_add_i2c1(NULL);
      omap44xx_add_mmc1(NULL);
+#ifdef CONFIG_KEYBOARD_TWL6030
+     add_generic_device_res("twl6030_pwrbtn", DEVICE_ID_DYNAMIC, 0, 0,
+             &pwrbtn_data);
+#endif
+#ifdef CONFIG_KEYBOARD_GPIO
+     add_gpio_keys_device(DEVICE_ID_DYNAMIC, &gk_data);
+#endif

If you are not really really concerned about binary size I suggest to drop the ifdefs. It makes for better readability.

Quoted 7 lines

Sascha

--

Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

In fact I'm concerned about size, the first stage bootloader has been increased a lot since sd-card booting support was enabled (fat, mmc) and had to enable the thumb2 mode because of this.
So, only required code is desirable to go into the first stage.

Regards,
Vicente.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox