diff options
Diffstat (limited to 'arch/arm/boards/at91sam9260ek')
-rw-r--r-- | arch/arm/boards/at91sam9260ek/env/bin/init_board | 41 | ||||
-rw-r--r-- | arch/arm/boards/at91sam9260ek/init.c | 34 |
2 files changed, 68 insertions, 7 deletions
diff --git a/arch/arm/boards/at91sam9260ek/env/bin/init_board b/arch/arm/boards/at91sam9260ek/env/bin/init_board index 0da2781045..977430debd 100644 --- a/arch/arm/boards/at91sam9260ek/env/bin/init_board +++ b/arch/arm/boards/at91sam9260ek/env/bin/init_board @@ -1,18 +1,44 @@ #!/bin/sh -#PIOA_31 -gpio_get_value 63 +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" + +if [ $at91_udc0.vbus != 1 ] +then + echo "No USB Device cable plugged, normal boot" + exit +fi + +gpio_get_value ${dfu_button} if [ $? != 0 ] then + autoboot_timeout=16 + echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s" + usbserial + exit +fi + +echo "${button_name} pressed detected wait ${button_wait}s" +timeout -s -a ${button_wait} + +if [ $at91_udc0.vbus != 1 ] +then + echo "No USB Device cable plugged, normal boot" exit fi -echo "BP4 pressed detected wait 5s" -timeout -s -a 5 -gpio_get_value 63 +gpio_get_value ${dfu_button} if [ $? != 0 ] then - echo "BP4 released, normal boot" + echo "${button_name} released, normal boot" + autoboot_timeout=16 + echo "enable tty over USB Device, increase the boot delay to ${autoboot_timeout}s" + usbserial exit fi @@ -20,4 +46,5 @@ echo "" echo "Start DFU Mode" echo "" -dfu /dev/self0(barebox)sr,/dev/nand0.kernel.bb(kernel)r,/dev/nand0.root.bb(root)r -P 0x1234 -V 0x4321 +led ds5 1 +dfu ${dfu_config} -P ${product_id} -V ${vendor_id} diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c index df44e3e306..03abc0e3fc 100644 --- a/arch/arm/boards/at91sam9260ek/init.c +++ b/arch/arm/boards/at91sam9260ek/init.c @@ -201,6 +201,37 @@ static struct at91_udc_data __initdata ek_udc_data = { .pullup_pin = -EINVAL, /* pull-up driven by UDC */ }; +struct gpio_led leds[] = { + { + .gpio = AT91_PIN_PA6, + .active_low = 1, + .led = { + .name = "ds5", + }, + }, { + .gpio = AT91_PIN_PA9, + .led = { + .name = "ds3", + }, + }, +}; + +static void __init ek_add_led(void) +{ + int i; + +#ifdef CONFIG_AT91_HAVE_2MMC + leds[0].gpio = AT91_PIN_PB8; + leds[1].gpio = AT91_PIN_PB9; +#endif + + for (i = 0; i < ARRAY_SIZE(leds); i++) { + at91_set_gpio_output(leds[i].gpio, leds[i].active_low); + led_gpio_register(&leds[i]); + } + led_set_trigger(LED_TRIGGER_HEARTBEAT, &leds[1].led); +} + static int at91sam9260ek_mem_init(void) { at91_add_device_sdram(64 * 1024 * 1024); @@ -213,8 +244,10 @@ static void __init ek_add_device_buttons(void) { at91_set_gpio_input(AT91_PIN_PA30, 1); /* btn3 */ at91_set_deglitch(AT91_PIN_PA30, 1); + export_env_ull("dfu_button", AT91_PIN_PA30); at91_set_gpio_input(AT91_PIN_PA31, 1); /* btn4 */ at91_set_deglitch(AT91_PIN_PA31, 1); + export_env_ull("btn4", AT91_PIN_PA31); } static int at91sam9260ek_devices_init(void) @@ -226,6 +259,7 @@ static int at91sam9260ek_devices_init(void) at91_add_device_udc(&ek_udc_data); ek_usb_add_device_mci(); ek_add_device_buttons(); + ek_add_led(); armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100)); ek_set_board_type(); |