[PATCH 09/16] eukrea_cpuimx35: use switch action to launch usbserial or dfu

Eric Bénard eric at eukrea.com
Thu May 17 11:46:11 EDT 2012


Signed-off-by: Eric Bénard <eric at eukrea.com>
---
 arch/arm/boards/eukrea_cpuimx35/env/bin/init_board |   21 ++++++++++++++++++++
 arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c  |   10 +++++++-
 arch/arm/configs/eukrea_cpuimx35_defconfig         |   12 +++++++---
 3 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boards/eukrea_cpuimx35/env/bin/init_board b/arch/arm/boards/eukrea_cpuimx35/env/bin/init_board
index cb624e5..7659cc4 100644
--- a/arch/arm/boards/eukrea_cpuimx35/env/bin/init_board
+++ b/arch/arm/boards/eukrea_cpuimx35/env/bin/init_board
@@ -11,6 +11,27 @@ elif [ -f /env/logo.bmp.lzo ]; then
 	gpio_set_value 1 1
 fi
 
+gpio_get_value 89
+if [ $? -eq 0 ]; then
+	gpio_set_value 93 0
+	usbserial
+	timeout -s -a 2
+	gpio_get_value 89
+	if [ $? -eq 0 ]; then
+		usbserial -d
+		dfu -V 0x1234 -P 0x1234 /dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.root.bb(root)r
+		gpio_get_value 89
+		if [ $? -eq 0 ]; then
+			usbserial
+			autoboot_timeout=60
+			exit
+		fi
+		reset
+	else
+		autoboot_timeout=28
+	fi
+fi
+
 if [ -z $eth0.ethaddr ]; then
 	while [ -z $eth0.ethaddr ]; do
 		readline "no MAC address set for eth0. please enter the one found on your board: " eth0.ethaddr
diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
index 17da569..bfdd9de 100644
--- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
+++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c
@@ -161,6 +161,12 @@ static int eukrea_cpuimx35_devices_init(void)
 	imx35_add_i2c0(NULL);
 	imx35_add_mmc0(NULL);
 
+	/* led default off */
+	gpio_direction_output(32 * 2 + 29, 1);
+
+	/* Switch : input */
+	gpio_direction_input(32 * 2 + 25);
+
 #ifdef CONFIG_USB
 	imx35_usb_init();
 	add_generic_usb_ehci_device(-1, IMX_OTG_BASE + 0x400, NULL);
@@ -220,6 +226,8 @@ static struct pad_desc eukrea_cpuimx35_pads[] = {
 	MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
 	MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
 	MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
+
+	MX35_PAD_LD19__GPIO3_25,
 };
 
 static int eukrea_cpuimx35_console_init(void)
@@ -231,8 +239,6 @@ static int eukrea_cpuimx35_console_init(void)
 	gpio_direction_output(4, 0);
 	/* backlight default off */
 	gpio_direction_output(1, 0);
-	/* led default off */
-	gpio_direction_output(32 * 2 + 29, 1);
 
 	imx35_add_uart0();
 	return 0;
diff --git a/arch/arm/configs/eukrea_cpuimx35_defconfig b/arch/arm/configs/eukrea_cpuimx35_defconfig
index 8a6bb0b..44be126 100644
--- a/arch/arm/configs/eukrea_cpuimx35_defconfig
+++ b/arch/arm/configs/eukrea_cpuimx35_defconfig
@@ -14,6 +14,7 @@ CONFIG_GLOB=y
 CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
 # CONFIG_CONSOLE_ACTIVATE_FIRST is not set
 CONFIG_CONSOLE_ACTIVATE_ALL=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
@@ -24,11 +25,13 @@ CONFIG_CMD_SAVEENV=y
 CONFIG_CMD_EXPORT=y
 CONFIG_CMD_PRINTENV=y
 CONFIG_CMD_READLINE=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENU_MANAGEMENT=y
+CONFIG_CMD_AUTOMOUNT=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
 CONFIG_CMD_MEMINFO=y
 CONFIG_CMD_IOMEM=y
-CONFIG_CMD_MD5SUM=y
 CONFIG_CMD_MTEST=y
 CONFIG_CMD_FLASH=y
 CONFIG_CMD_BOOTM_SHOW_TYPE=y
@@ -48,12 +51,12 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_UNCOMPRESS=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_LED=y
-CONFIG_CMD_LED_TRIGGER=y
 CONFIG_NET=y
 CONFIG_NET_DHCP=y
 CONFIG_NET_PING=y
 CONFIG_NET_TFTP=y
 CONFIG_NET_TFTP_PUSH=y
+CONFIG_NET_NETCONSOLE=y
 CONFIG_DRIVER_NET_FEC_IMX=y
 # CONFIG_SPI is not set
 CONFIG_I2C=y
@@ -61,6 +64,9 @@ CONFIG_I2C_IMX=y
 CONFIG_MTD=y
 CONFIG_MTD_RAW_DEVICE=y
 CONFIG_NAND=y
+# CONFIG_NAND_ECC_SOFT is not set
+# CONFIG_NAND_ECC_HW_SYNDROME is not set
+# CONFIG_NAND_ECC_HW_NONE is not set
 CONFIG_NAND_IMX=y
 CONFIG_USB=y
 CONFIG_USB_EHCI=y
@@ -74,8 +80,6 @@ CONFIG_MCI=y
 CONFIG_MCI_IMX_ESDHC=y
 CONFIG_LED=y
 CONFIG_LED_GPIO=y
-CONFIG_LED_TRIGGERS=y
-CONFIG_FS_TFTP=y
 CONFIG_FS_FAT=y
 CONFIG_FS_FAT_WRITE=y
 CONFIG_FS_FAT_LFN=y
-- 
1.7.7.6




More information about the barebox mailing list