diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-12-31 16:21:36 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-01-02 12:08:25 +0100 |
commit | ff6e2a0ea3f829fab42f2c6d9a6c4111606911b9 (patch) | |
tree | ec016e2af52c2f3a73d16bc894c4062c3fdbedd5 /arch/arm | |
parent | 4484d3b96503988e9e9cbad490bc4298455ddaa1 (diff) | |
download | barebox-ff6e2a0ea3f829fab42f2c6d9a6c4111606911b9.tar.gz barebox-ff6e2a0ea3f829fab42f2c6d9a6c4111606911b9.tar.xz |
usb-a926x: add dfu support
detect it at boot time
if the user button is pressed 5s and the vbus is 1 start the dfu
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/boards/usb-a926x/env/bin/init_board | 43 | ||||
-rw-r--r-- | arch/arm/boards/usb-a926x/init.c | 9 |
2 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/boards/usb-a926x/env/bin/init_board b/arch/arm/boards/usb-a926x/env/bin/init_board new file mode 100644 index 0000000000..77e5c1a187 --- /dev/null +++ b/arch/arm/boards/usb-a926x/env/bin/init_board @@ -0,0 +1,43 @@ +#!/bin/sh + +button_name="dfu_bp" +button_wait=5 + +product_id=0x1234 +vendor_id=0x4321 + +dfu_config="/dev/nand0.barebox.bb(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.rootfs.bb(rootfs)r" + +gpio_get_value ${dfu_button} +if [ $? != 0 ] +then + exit +fi + +if [ $at91_udc0.vbus != 1 ] +then + echo "No USB Device cable plugged, normal boot" + exit +fi + +echo "${button_name} pressed detected wait ${button_wait}s" +timeout -s -a ${button_wait} + +gpio_get_value ${dfu_button} +if [ $? != 0 ] +then + echo "${button_name} released, normal boot" + exit +fi + +if [ $at91_udc0.vbus != 1 ] +then + echo "No USB Device cable plugged, normal boot" + exit +fi + +echo "" +echo "Start DFU Mode" +echo "" + +dfu ${dfu_config} -P ${product_id} -V ${vendor_id} diff --git a/arch/arm/boards/usb-a926x/init.c b/arch/arm/boards/usb-a926x/init.c index 469d98ea7d..364c1ba958 100644 --- a/arch/arm/boards/usb-a926x/init.c +++ b/arch/arm/boards/usb-a926x/init.c @@ -211,6 +211,14 @@ static int usb_a9260_mem_init(void) } mem_initcall(usb_a9260_mem_init); +static void __init ek_add_device_button(void) +{ + at91_set_GPIO_periph(AT91_PIN_PB10, 1); /* user push button, pull up enabled */ + at91_set_deglitch(AT91_PIN_PB10, 1); + + export_env_ull("dfu_button", AT91_PIN_PB10); +} + static int usb_a9260_devices_init(void) { usb_a9260_add_device_nand(); @@ -220,6 +228,7 @@ static int usb_a9260_devices_init(void) at91_add_device_usbh_ohci(&ek_usbh_data); ek_add_device_udc(); ek_add_led(); + ek_add_device_button(); armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100)); usb_a9260_set_board_type(); |