summaryrefslogtreecommitdiffstats
path: root/u-boot/drivers/misc/gpio_led.c
diff options
context:
space:
mode:
authorH. Nikolaus Schaller <hns@goldelico.com>2012-03-26 20:55:28 +0200
committerH. Nikolaus Schaller <hns@goldelico.com>2012-03-26 20:55:28 +0200
commit92988a21ad4c4c9504295ccb580c9f806134471b (patch)
tree5effc9f14170112450de05c67dafbe8d5034d595 /u-boot/drivers/misc/gpio_led.c
parentca2b506783b676c95762c54ea24dcfdaae1947c9 (diff)
downloadbootable_bootloader_goldelico_gta04-92988a21ad4c4c9504295ccb580c9f806134471b.zip
bootable_bootloader_goldelico_gta04-92988a21ad4c4c9504295ccb580c9f806134471b.tar.gz
bootable_bootloader_goldelico_gta04-92988a21ad4c4c9504295ccb580c9f806134471b.tar.bz2
added boot script files to repository
Diffstat (limited to 'u-boot/drivers/misc/gpio_led.c')
-rw-r--r--u-boot/drivers/misc/gpio_led.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/u-boot/drivers/misc/gpio_led.c b/u-boot/drivers/misc/gpio_led.c
new file mode 100644
index 0000000..3fedddc
--- /dev/null
+++ b/u-boot/drivers/misc/gpio_led.c
@@ -0,0 +1,26 @@
+/*
+ * Status LED driver based on GPIO access conventions of Linux
+ *
+ * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <status_led.h>
+#include <asm/gpio.h>
+
+void __led_init(led_id_t mask, int state)
+{
+ gpio_request(mask, "gpio_led");
+ gpio_direction_output(mask, state == STATUS_LED_ON);
+}
+
+void __led_set(led_id_t mask, int state)
+{
+ gpio_set_value(mask, state == STATUS_LED_ON);
+}
+
+void __led_toggle(led_id_t mask)
+{
+ gpio_set_value(mask, !gpio_get_value(mask));
+}