summaryrefslogtreecommitdiffstats
path: root/arch/arm/boards/at91sam9260ek
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2011-12-14 16:46:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-15 11:34:13 +0100
commit29bf8c9a78483c331a77c66607e1be10045b2861 (patch)
treebc31334d8517e9dc0bd0cb90da572de76efebb17 /arch/arm/boards/at91sam9260ek
parente305a3dbe4a80adac8b174e04fa5ee39a39921f8 (diff)
downloadbarebox-29bf8c9a78483c331a77c66607e1be10045b2861.tar.gz
barebox-29bf8c9a78483c331a77c66607e1be10045b2861.tar.xz
at91sam9260/9g20-ek: add usb host, device and mci support
configure BP4 and BP3 use BP4 to start DFU mode at boot if BP4 is pressed at boot time and maintain at least 5s the dfu is started otherwise we boot normaly Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/at91sam9260ek')
-rw-r--r--arch/arm/boards/at91sam9260ek/env/bin/init_board23
-rw-r--r--arch/arm/boards/at91sam9260ek/init.c46
2 files changed, 69 insertions, 0 deletions
diff --git a/arch/arm/boards/at91sam9260ek/env/bin/init_board b/arch/arm/boards/at91sam9260ek/env/bin/init_board
new file mode 100644
index 0000000000..0da2781045
--- /dev/null
+++ b/arch/arm/boards/at91sam9260ek/env/bin/init_board
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#PIOA_31
+gpio_get_value 63
+if [ $? != 0 ]
+then
+ exit
+fi
+
+echo "BP4 pressed detected wait 5s"
+timeout -s -a 5
+gpio_get_value 63
+if [ $? != 0 ]
+then
+ echo "BP4 released, normal boot"
+ exit
+fi
+
+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
diff --git a/arch/arm/boards/at91sam9260ek/init.c b/arch/arm/boards/at91sam9260ek/init.c
index 5aacc75123..dbd65418ec 100644
--- a/arch/arm/boards/at91sam9260ek/init.c
+++ b/arch/arm/boards/at91sam9260ek/init.c
@@ -165,6 +165,40 @@ static void at91sam9260ek_phy_reset(void)
AT91_RSTC_URSTEN);
}
+/*
+ * MCI (SD/MMC)
+ */
+#if defined(CONFIG_MCI_ATMEL)
+static struct atmel_mci_platform_data __initdata ek_mci_data = {
+ .bus_width = 4,
+};
+
+static void ek_usb_add_device_mci(void)
+{
+ if (machine_is_at91sam9g20ek())
+ ek_mci_data.detect_pin = AT91_PIN_PC9;
+
+ at91_add_device_mci(1, &ek_mci_data);
+}
+#else
+static void ek_usb_add_device_mci(void) {}
+#endif
+
+/*
+ * USB Host port
+ */
+static struct at91_usbh_data __initdata ek_usbh_data = {
+ .ports = 2,
+};
+
+/*
+ * USB Device port
+ */
+static struct at91_udc_data __initdata ek_udc_data = {
+ .vbus_pin = AT91_PIN_PC5,
+ .pullup_pin = -EINVAL, /* pull-up driven by UDC */
+};
+
static int at91sam9260ek_mem_init(void)
{
at91_add_device_sdram(64 * 1024 * 1024);
@@ -173,11 +207,23 @@ static int at91sam9260ek_mem_init(void)
}
mem_initcall(at91sam9260ek_mem_init);
+static void __init ek_add_device_buttons(void)
+{
+ at91_set_gpio_input(AT91_PIN_PA30, 1); /* btn3 */
+ at91_set_deglitch(AT91_PIN_PA30, 1);
+ at91_set_gpio_input(AT91_PIN_PA31, 1); /* btn4 */
+ at91_set_deglitch(AT91_PIN_PA31, 1);
+}
+
static int at91sam9260ek_devices_init(void)
{
ek_add_device_nand();
at91sam9260ek_phy_reset();
at91_add_device_eth(&macb_pdata);
+ at91_add_device_usbh_ohci(&ek_usbh_data);
+ at91_add_device_udc(&ek_udc_data);
+ ek_usb_add_device_mci();
+ ek_add_device_buttons();
armlinux_set_bootparams((void *)(AT91_CHIPSELECT_1 + 0x100));
ek_set_board_type();