From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 2/2] at91sam9260/9g20ek: add led support
Date: Thu, 5 Jan 2012 14:36:38 +0100 [thread overview]
Message-ID: <1325770598-10931-2-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1325770598-10931-1-git-send-email-plagnioj@jcrosoft.com>
use ds3 for heartbeat and ds5 for dfu
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
arch/arm/boards/at91sam9260ek/env/bin/init_board | 1 +
arch/arm/boards/at91sam9260ek/init.c | 32 ++++++++++++++++++++++
arch/arm/configs/at91sam9260ek_defconfig | 5 +++
arch/arm/configs/at91sam9g20ek_defconfig | 5 +++
4 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boards/at91sam9260ek/env/bin/init_board b/arch/arm/boards/at91sam9260ek/env/bin/init_board
index 0a6baf7..977430d 100644
--- a/arch/arm/boards/at91sam9260ek/env/bin/init_board
+++ b/arch/arm/boards/at91sam9260ek/env/bin/init_board
@@ -46,4 +46,5 @@ echo ""
echo "Start DFU Mode"
echo ""
+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 a11998a..4bff35e 100644
--- a/arch/arm/boards/at91sam9260ek/init.c
+++ b/arch/arm/boards/at91sam9260ek/init.c
@@ -200,6 +200,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);
@@ -227,6 +258,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();
diff --git a/arch/arm/configs/at91sam9260ek_defconfig b/arch/arm/configs/at91sam9260ek_defconfig
index f6d0f25..613dd9f 100644
--- a/arch/arm/configs/at91sam9260ek_defconfig
+++ b/arch/arm/configs/at91sam9260ek_defconfig
@@ -39,6 +39,8 @@ CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_PARTITION=y
CONFIG_CMD_GPIO=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_LED_TRIGGER=y
CONFIG_NET=y
CONFIG_NET_DHCP=y
CONFIG_NET_NFS=y
@@ -60,6 +62,9 @@ CONFIG_USB_GADGET_SERIAL=y
CONFIG_MCI=y
CONFIG_MCI_STARTUP=y
CONFIG_MCI_ATMEL=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_TRIGGERS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/configs/at91sam9g20ek_defconfig b/arch/arm/configs/at91sam9g20ek_defconfig
index 16b6252..18bd2ae 100644
--- a/arch/arm/configs/at91sam9g20ek_defconfig
+++ b/arch/arm/configs/at91sam9g20ek_defconfig
@@ -40,6 +40,8 @@ CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_PARTITION=y
CONFIG_CMD_GPIO=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_LED_TRIGGER=y
CONFIG_NET=y
CONFIG_NET_DHCP=y
CONFIG_NET_NFS=y
@@ -61,6 +63,9 @@ CONFIG_USB_GADGET_SERIAL=y
CONFIG_MCI=y
CONFIG_MCI_STARTUP=y
CONFIG_MCI_ATMEL=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_TRIGGERS=y
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
--
1.7.7
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2012-01-05 13:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 13:36 [PATCH 1/2] at91sam9260/9g20ek: add dfu and usb serial support Jean-Christophe PLAGNIOL-VILLARD
2012-01-05 13:36 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1325770598-10931-2-git-send-email-plagnioj@jcrosoft.com \
--to=plagnioj@jcrosoft.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox