mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2] LED support
@ 2010-12-20  9:53 Sascha Hauer
  2010-12-20  9:53 ` [PATCH 1/8] cfi flash driver: check for ctrl-c during erase Sascha Hauer
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

Hi,

This is the second version of the patch series with the comments
integrated I got from the first version.

Sascha


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/8] cfi flash driver: check for ctrl-c during erase
  2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
@ 2010-12-20  9:53 ` Sascha Hauer
  2010-12-20  9:53 ` [PATCH 2/8] Add generic poll infrastructure Sascha Hauer
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/nor/cfi_flash.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/nor/cfi_flash.c b/drivers/nor/cfi_flash.c
index 2fa2c6b..d190e35 100644
--- a/drivers/nor/cfi_flash.c
+++ b/drivers/nor/cfi_flash.c
@@ -498,6 +498,11 @@ static int __cfi_erase(struct cdev *cdev, size_t count, unsigned long offset,
                 if (ret)
                         goto out;
 
+		if (ctrlc()) {
+			ret = -EINTR;
+			goto out;
+		}
+
 		if (verbose)
 			show_progress(i - start);
         }
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/8] Add generic poll infrastructure
  2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
  2010-12-20  9:53 ` [PATCH 1/8] cfi flash driver: check for ctrl-c during erase Sascha Hauer
@ 2010-12-20  9:53 ` Sascha Hauer
  2010-12-20  9:53 ` [PATCH 3/8] basic LED support Sascha Hauer
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

From: Marc Kleine-Budde <mkl@pengutronix.de>

Barebox does not have interrupt functionality. Nevertheless it's
sometimes useful to periodically call functions, like for example
a heartbeat LED or watchdog reset. Instead of cluttering the code
with calls to these functions this patch adds a generic polling
infrastructure. Code which might run for longer now can call
poller_call() periodically which in turn will call all registered
pollers.
This patch adds a call to poller_call in two generic pathes. First
of them is getc() which covers waiting for uart input. Second is
ctrlc() which should be called anyway from code which might run
for longer. So instead adding poller_call directly to your code,
consider checking ctrlc instead which also gives additional
convenience to the user.
The poller code is safe against reentrancy which means that it's
safe to call poller_call inside a poller.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/Kconfig   |    3 +++
 common/Makefile  |    1 +
 common/console.c |    5 +++++
 common/poller.c  |   45 +++++++++++++++++++++++++++++++++++++++++++++
 include/poller.h |   31 +++++++++++++++++++++++++++++++
 5 files changed, 85 insertions(+), 0 deletions(-)
 create mode 100644 common/poller.c
 create mode 100644 include/poller.h

diff --git a/common/Kconfig b/common/Kconfig
index 617f640..02bc67e 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -414,6 +414,9 @@ config DEFAULT_ENVIRONMENT_PATH
 	  Relative pathes will be relative to the barebox Toplevel dir, but absolute
 	  pathes are fine aswell.
 
+config POLLER
+	bool "generic polling infrastructure"
+
 endmenu
 
 menu "Debugging                     "
diff --git a/common/Makefile b/common/Makefile
index 753455b..98c9d36 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_OF_FLAT_TREE)	+= ft_build.o
 obj-$(CONFIG_KALLSYMS)		+= kallsyms.o
 obj-$(CONFIG_ENV_HANDLING)	+= environment.o
 obj-$(CONFIG_AUTO_COMPLETE)	+= complete.o
+obj-$(CONFIG_POLLER)		+= poller.o
 
 obj-y += dlmalloc.o
 obj-y += clock.o
diff --git a/common/console.c b/common/console.c
index 82786f2..39ead4b 100644
--- a/common/console.c
+++ b/common/console.c
@@ -34,6 +34,7 @@
 #include <clock.h>
 #include <kfifo.h>
 #include <module.h>
+#include <poller.h>
 #include <linux/list.h>
 
 LIST_HEAD(console_list);
@@ -205,6 +206,8 @@ int getc(void)
 	 */
 	start = get_time_ns();
 	while (1) {
+		poller_call();
+
 		if (tstc()) {
 			kfifo_putc(console_input_buffer, getc_raw());
 
@@ -397,6 +400,8 @@ EXPORT_SYMBOL(vprintf);
 /* test if ctrl-c was pressed */
 int ctrlc (void)
 {
+	poller_call();
+
 	if (tstc() && getc() == 3)
 		return 1;
 	return 0;
diff --git a/common/poller.c b/common/poller.c
new file mode 100644
index 0000000..0583a53
--- /dev/null
+++ b/common/poller.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 Marc Kleine-Budde <mkl@pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#include <common.h>
+#include <driver.h>
+#include <malloc.h>
+#include <module.h>
+#include <param.h>
+#include <poller.h>
+
+static LIST_HEAD(poller_list);
+static int poller_active;
+
+int poller_register(struct poller_struct *poller)
+{
+	list_add_tail(&poller->list, &poller_list);
+
+	return 0;
+}
+
+int poller_unregister(struct poller_struct *poller)
+{
+	list_del(&poller->list);
+
+	return 0;
+}
+
+void poller_call(void)
+{
+	struct poller_struct *poller, *tmp;
+
+	if (poller_active)
+		return;
+
+	poller_active = 1;
+
+	list_for_each_entry_safe(poller, tmp, &poller_list, list)
+		poller->func(poller);
+
+	poller_active = 0;
+}
diff --git a/include/poller.h b/include/poller.h
new file mode 100644
index 0000000..dc98155
--- /dev/null
+++ b/include/poller.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 Marc Kleine-Budde <mkl@pengutronix.de>
+ *
+ * This file is released under the GPLv2
+ *
+ */
+
+#ifndef POLLER_H
+#define POLLER_H
+
+#include <linux/list.h>
+
+struct poller_struct {
+	void (*func)(struct poller_struct *poller);
+
+	struct list_head list;
+};
+
+int poller_register(struct poller_struct *poller);
+int poller_unregister(struct poller_struct *poller);
+
+
+#ifdef CONFIG_POLLER
+void poller_call(void);
+#else
+static inline void poller_call(void)
+{
+}
+#endif	/* CONFIG_POLLER */
+
+#endif	/* !POLLER_H */
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/8] basic LED support
  2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
  2010-12-20  9:53 ` [PATCH 1/8] cfi flash driver: check for ctrl-c during erase Sascha Hauer
  2010-12-20  9:53 ` [PATCH 2/8] Add generic poll infrastructure Sascha Hauer
@ 2010-12-20  9:53 ` Sascha Hauer
  2010-12-20  9:53 ` [PATCH 4/8] LED: Add gpio " Sascha Hauer
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

This patch adds core functionality for controlling LEDs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/Kconfig      |    1 +
 drivers/Makefile     |    1 +
 drivers/led/Kconfig  |    6 ++
 drivers/led/Makefile |    1 +
 drivers/led/core.c   |  157 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/led.h        |   27 +++++++++
 6 files changed, 193 insertions(+), 0 deletions(-)
 create mode 100644 drivers/led/Kconfig
 create mode 100644 drivers/led/Makefile
 create mode 100644 drivers/led/core.c
 create mode 100644 include/led.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index d94017b..86d8fb5 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -12,5 +12,6 @@ source "drivers/video/Kconfig"
 source "drivers/mci/Kconfig"
 source "drivers/clk/Kconfig"
 source "drivers/mfd/Kconfig"
+source "drivers/led/Kconfig"
 
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 242a564..b1b402f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_MCI) += mci/
 obj-$(CONFIG_VIDEO) += video/
 obj-y	+= clk/
 obj-y	+= mfd/
+obj-$(CONFIG_LED) += led/
diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig
new file mode 100644
index 0000000..964626c
--- /dev/null
+++ b/drivers/led/Kconfig
@@ -0,0 +1,6 @@
+menuconfig LED
+	bool "LED support"
+
+if LED
+
+endif
diff --git a/drivers/led/Makefile b/drivers/led/Makefile
new file mode 100644
index 0000000..0c1a6b6
--- /dev/null
+++ b/drivers/led/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_LED) += core.o
diff --git a/drivers/led/core.c b/drivers/led/core.c
new file mode 100644
index 0000000..748a978
--- /dev/null
+++ b/drivers/led/core.c
@@ -0,0 +1,157 @@
+/*
+ * core LED support for barebox
+ *
+ * (C) Copyright 2010 Sascha Hauer, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <linux/list.h>
+#include <errno.h>
+#include <asm/gpio.h>
+#include <led.h>
+#include <poller.h>
+#include <clock.h>
+#include <linux/ctype.h>
+
+/**
+ * @file
+ * @brief LED framework
+ *
+ * This file contains the core LED framework for barebox.
+ *
+ * Each LED can be set to a value where 0 means disabled and values
+ * > 0 mean enabled. LEDs can have different enable values where the
+ * exact meaning depends on the LED, for example a gpio controlled rgb
+ * LED can have enable values from 1 to 7 which correspond to different
+ * colors. value could also mean a brightness.
+ * Each LED is assigned a number. numbers start with 0 and are increased
+ * with each registered LED. The number stays the same during lifecycle,
+ * gaps because of unregistered LEDs are not filled up.
+ */
+
+static LIST_HEAD(leds);
+static int num_leds;
+
+/**
+ * led_by_number - get the number of a LED
+ * @param num number of the LED to return
+ */
+struct led *led_by_number(int num)
+{
+	struct led *led;
+
+	list_for_each_entry(led, &leds, list) {
+		if (led->num == num)
+			return led;
+	}
+
+	return NULL;
+}
+
+/**
+ * led_by_name - get a LED with its name
+ * @param name	name of the LED
+ */
+struct led *led_by_name(const char *name)
+{
+	struct led *led;
+
+	list_for_each_entry(led, &leds, list) {
+		if (led->name && !strcmp(led->name, name))
+			return led;
+	}
+
+	return NULL;
+}
+
+/**
+ * led_by_name_or_number - get a LED with its name or number
+ * @param str	if first character of str is a digit led_by_number
+ *		is returned, led_by_name otherwise.
+ */
+struct led *led_by_name_or_number(const char *str)
+{
+	if (isdigit(*str)) {
+		int l;
+
+		l = simple_strtoul(str, NULL, 0);
+
+		return led_by_number(l);
+	} else {
+		return led_by_name(str);
+	}
+}
+
+/**
+ * led_set - set the value of a LED
+ * @param led	the led
+ * @param value	the value of the LED (0 is disabled)
+ */
+int led_set(struct led *led, unsigned int value)
+{
+	if (value > led->max_value)
+		value = led->max_value;
+
+	led->set(led, value);
+
+	return 0;
+}
+
+/**
+ * led_set_num - set the value of a LED
+ * @param num	the number of the LED
+ * @param value	the value of the LED (0 is disabled)
+ */
+int led_set_num(int num, unsigned int value)
+{
+	struct led *led = led_by_number(num);
+
+	if (!led)
+		return -ENODEV;
+
+	return led_set(led, value);
+}
+
+/**
+ * led_register - Register a LED
+ * @param led	the led
+ */
+int led_register(struct led *led)
+{
+	if (led->name && led_by_name(led->name))
+		return -EBUSY;
+
+	led->num = num_leds++;
+
+	list_add_tail(&led->list, &leds);
+
+	return 0;
+}
+
+/**
+ * led_unregister - Unegister a LED
+ * @param led	the led
+ */
+void led_unregister(struct led *led)
+{
+	list_del(&led->list);
+}
diff --git a/include/led.h b/include/led.h
new file mode 100644
index 0000000..3e7b1d9
--- /dev/null
+++ b/include/led.h
@@ -0,0 +1,27 @@
+#ifndef __LED_H
+#define __LED_H
+
+struct led {
+	void (*set)(struct led *, unsigned int value);
+	int max_value;
+	char *name;
+	int num;
+	struct list_head list;
+};
+
+struct led *led_by_number(int no);
+struct led *led_by_name(const char *name);
+struct led *led_by_name_or_number(const char *str);
+
+static inline int led_get_number(struct led *led)
+{
+	return led->num;
+}
+
+int led_set_num(int num, unsigned int value);
+int led_set(struct led *led, unsigned int value);
+int led_register(struct led *led);
+void led_unregister(struct led *led);
+void led_unregister(struct led *led);
+
+#endif /* __LED_H */
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/8] LED: Add gpio LED support
  2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
                   ` (2 preceding siblings ...)
  2010-12-20  9:53 ` [PATCH 3/8] basic LED support Sascha Hauer
@ 2010-12-20  9:53 ` Sascha Hauer
  2010-12-20  9:53 ` [PATCH 5/8] LED: Add LED trigger support Sascha Hauer
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

This patch adds support for registering gpios as LEDs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/led/Kconfig    |    8 ++++
 drivers/led/Makefile   |    1 +
 drivers/led/led-gpio.c |   94 ++++++++++++++++++++++++++++++++++++++++++++++++
 include/led.h          |   43 ++++++++++++++++++++++
 4 files changed, 146 insertions(+), 0 deletions(-)
 create mode 100644 drivers/led/led-gpio.c

diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig
index 964626c..048a0f4 100644
--- a/drivers/led/Kconfig
+++ b/drivers/led/Kconfig
@@ -3,4 +3,12 @@ menuconfig LED
 
 if LED
 
+config LED_GPIO
+	bool "gpio LED support"
+	depends on GENERIC_GPIO
+
+config LED_GPIO_RGB
+	bool "gpio rgb LED support"
+	depends on LED_GPIO
+
 endif
diff --git a/drivers/led/Makefile b/drivers/led/Makefile
index 0c1a6b6..29b9fd5 100644
--- a/drivers/led/Makefile
+++ b/drivers/led/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_LED) += core.o
+obj-$(CONFIG_LED_GPIO) += led-gpio.o
diff --git a/drivers/led/led-gpio.c b/drivers/led/led-gpio.c
new file mode 100644
index 0000000..10c25c6
--- /dev/null
+++ b/drivers/led/led-gpio.c
@@ -0,0 +1,94 @@
+/*
+ * gpio LED support for barebox
+ *
+ * (C) Copyright 2010 Sascha Hauer, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <led.h>
+#include <asm/gpio.h>
+
+static void led_gpio_set(struct led *led, unsigned int value)
+{
+	struct gpio_led *gpio_led = container_of(led, struct gpio_led, led);
+
+	gpio_direction_output(gpio_led->gpio, !!value ^ gpio_led->active_low);
+}
+
+/**
+ * led_gpio_register - register a gpio controlled LED
+ * @param led	The gpio LED
+ *
+ * This function registers a single gpio as a LED. led->gpio
+ * should be initialized to the gpio to control.
+ */
+int led_gpio_register(struct gpio_led *led)
+{
+	led->led.set = led_gpio_set;
+	led->led.max_value = 1;
+
+	return led_register(&led->led);
+}
+
+/**
+ * led_gpio_unregister - remove a gpio controlled LED from the framework
+ * @param led	The gpio LED
+ */
+void led_gpio_unregister(struct gpio_led *led)
+{
+	led_unregister(&led->led);
+}
+
+#ifdef CONFIG_LED_GPIO_RGB
+
+static void led_gpio_rgb_set(struct led *led, unsigned int value)
+{
+	struct gpio_rgb_led *rgb = container_of(led, struct gpio_rgb_led, led);
+	int al = rgb->active_low;
+
+	gpio_direction_output(rgb->gpio_r, !!(value & 4) ^ al);
+	gpio_direction_output(rgb->gpio_g, !!(value & 2) ^ al);
+	gpio_direction_output(rgb->gpio_b, !!(value & 1) ^ al);
+}
+
+/**
+ * led_gpio_rgb_register - register three gpios as a rgb LED
+ * @param led	The gpio rg LED
+ *
+ * This function registers three gpios as a rgb LED. led->gpio[rgb]
+ * should be initialized to the gpios to control.
+ */
+int led_gpio_rgb_register(struct gpio_rgb_led *led)
+{
+	led->led.set = led_gpio_rgb_set;
+	led->led.max_value = 7;
+
+	return led_register(&led->led);
+}
+
+/**
+ * led_gpio_rgb_unregister - remove a gpio controlled rgb LED from the framework
+ * @param led	The gpio LED
+ */
+void led_gpio_rgb_unregister(struct gpio_led *led)
+{
+	led_unregister(&led->led);
+}
+#endif /* CONFIG_LED_GPIO_RGB */
diff --git a/include/led.h b/include/led.h
index 3e7b1d9..0210897 100644
--- a/include/led.h
+++ b/include/led.h
@@ -1,6 +1,8 @@
 #ifndef __LED_H
 #define __LED_H
 
+#include <errno.h>
+
 struct led {
 	void (*set)(struct led *, unsigned int value);
 	int max_value;
@@ -24,4 +26,45 @@ int led_register(struct led *led);
 void led_unregister(struct led *led);
 void led_unregister(struct led *led);
 
+/* gpio LED support */
+struct gpio_led {
+	int gpio;
+	bool active_low;
+	struct led led;
+};
+
+struct gpio_rgb_led {
+	int gpio_r, gpio_g, gpio_b;
+	bool active_low;
+	struct led led;
+};
+
+#ifdef CONFIG_LED_GPIO
+int led_gpio_register(struct gpio_led *led);
+void led_gpio_unregister(struct gpio_led *led);
+#else
+static inline int led_gpio_register(struct gpio_led *led)
+{
+	return -ENOSYS;
+}
+
+static inline void led_gpio_unregister(struct gpio_led *led)
+{
+}
+#endif
+
+#ifdef CONFIG_LED_GPIO_RGB
+int led_gpio_rgb_register(struct gpio_rgb_led *led);
+void led_gpio_rgb_unregister(struct gpio_led *led);
+#else
+static inline int led_gpio_rgb_register(struct gpio_rgb_led *led)
+{
+	return -ENOSYS;
+}
+
+static inline void led_gpio_rgb_unregister(struct gpio_led *led)
+{
+}
+#endif
+
 #endif /* __LED_H */
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/8] LED: Add LED trigger support
  2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
                   ` (3 preceding siblings ...)
  2010-12-20  9:53 ` [PATCH 4/8] LED: Add gpio " Sascha Hauer
@ 2010-12-20  9:53 ` Sascha Hauer
  2010-12-20  9:53 ` [PATCH 6/8] LED: Add led command Sascha Hauer
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

This patch allows to associate LEDs with certain triggers, such
as heartbeat or network activity.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/led/Kconfig        |    7 ++
 drivers/led/Makefile       |    1 +
 drivers/led/led-triggers.c |  153 ++++++++++++++++++++++++++++++++++++++++++++
 include/led.h              |   32 +++++++++
 include/net.h              |    3 +
 lib/vsprintf.c             |    4 +
 net/eth.c                  |    8 ++-
 net/net.c                  |   20 ++++--
 8 files changed, 222 insertions(+), 6 deletions(-)
 create mode 100644 drivers/led/led-triggers.c

diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig
index 048a0f4..106093b 100644
--- a/drivers/led/Kconfig
+++ b/drivers/led/Kconfig
@@ -11,4 +11,11 @@ config LED_GPIO_RGB
 	bool "gpio rgb LED support"
 	depends on LED_GPIO
 
+config LED_TRIGGERS
+	select POLLER
+	bool "LED triggers support"
+	help
+	  This allows to assign certain triggers like heartbeat or network
+	  activity to LEDs.
+
 endif
diff --git a/drivers/led/Makefile b/drivers/led/Makefile
index 29b9fd5..6aafa6d 100644
--- a/drivers/led/Makefile
+++ b/drivers/led/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_LED) += core.o
 obj-$(CONFIG_LED_GPIO) += led-gpio.o
+obj-$(CONFIG_LED_TRIGGERS) += led-triggers.o
diff --git a/drivers/led/led-triggers.c b/drivers/led/led-triggers.c
new file mode 100644
index 0000000..764b4e7
--- /dev/null
+++ b/drivers/led/led-triggers.c
@@ -0,0 +1,153 @@
+/*
+ * LED trigger support for barebox
+ *
+ * (C) Copyright 2010 Sascha Hauer, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <poller.h>
+#include <errno.h>
+#include <clock.h>
+#include <led.h>
+#include <init.h>
+
+/**
+ * @file
+ * @brief LED trigger framework
+ *
+ * This file contains triggers which can be associated to LEDs.
+ *
+ * With this framework LEDs can be associated to different events.
+ * An event can be a heartbeat, network activity or panic.
+ * led_trigger() is the central function which is called in the
+ * different barebox frameworks to trigger an event.
+ *
+ * currently there are the following triggers are defined:
+ *
+ * led_trigger_panic:		triggered in panic()
+ * led_trigger_heartbeat:	shows the heartbeat of barebox. Blinks as long
+ *				barebox is up and running.
+ * led_trigger_net_rx:		Triggered during network packet reception
+ * led_trigger_net_tx:		Triggered during network packet transmission
+ * led_trigger_net_txrx:	combination of the two above
+ */
+
+struct led_trigger_struct {
+	struct led *led;
+	uint64_t flash_start;
+};
+
+static struct led_trigger_struct triggers[LED_TRIGGER_MAX];
+
+static void trigger_func(struct poller_struct *poller)
+{
+	int i;
+
+	for (i = 0; i < LED_TRIGGER_MAX; i++) {
+		if (triggers[i].led &&
+		    triggers[i].flash_start &&
+		    is_timeout(triggers[i].flash_start, 200 * MSECOND)) {
+			led_set(triggers[i].led, 0);
+		}
+	}
+
+	if (triggers[LED_TRIGGER_HEARTBEAT].led &&
+			is_timeout(triggers[LED_TRIGGER_HEARTBEAT].flash_start, SECOND))
+		led_trigger(LED_TRIGGER_HEARTBEAT, TRIGGER_FLASH);
+}
+
+static struct poller_struct trigger_poller = {
+	.func = trigger_func,
+};
+
+/**
+ * led_trigger - triggers a trigger
+ * @param trigger	The trigger to enable/disable
+ * @param enable	true if enable
+ *
+ * Enable/disable a LED for a given trigger.
+ */
+void led_trigger(enum led_trigger trigger, enum trigger_type type)
+{
+	if (trigger >= LED_TRIGGER_MAX)
+		return;
+	if (!triggers[trigger].led)
+		return;
+
+	if (type == TRIGGER_FLASH) {
+		if (is_timeout(triggers[trigger].flash_start, 400 * MSECOND)) {
+			led_set(triggers[trigger].led, 1);
+			triggers[trigger].flash_start = get_time_ns();
+		}
+		return;
+	}
+
+	led_set(triggers[trigger].led, type == TRIGGER_ENABLE ? 1 : 0);
+}
+
+/**
+ * led_set_trigger - set the LED for a trigger
+ * @param trigger	The trigger to set a LED for
+ * @param led		The LED
+ *
+ * This function associates a trigger with a LED. Pass led = NULL
+ * to disable a trigger
+ */
+int led_set_trigger(enum led_trigger trigger, struct led *led)
+{
+	int i;
+
+	if (trigger >= LED_TRIGGER_MAX)
+		return -EINVAL;
+
+	if (led)
+		for (i = 0; i < LED_TRIGGER_MAX; i++)
+			if (triggers[i].led == led)
+				return -EBUSY;
+
+	if (triggers[trigger].led && !led)
+		led_set(triggers[trigger].led, 0);
+
+	triggers[trigger].led = led;
+
+	return 0;
+}
+
+/**
+ * led_get_trigger - get the LED for a trigger
+ * @param trigger	The trigger to set a LED for
+ *
+ * return the LED number of a trigger.
+ */
+int led_get_trigger(enum led_trigger trigger)
+{
+	if (trigger >= LED_TRIGGER_MAX)
+		return -EINVAL;
+	if (!triggers[trigger].led)
+		return -ENODEV;
+	return led_get_number(triggers[trigger].led);
+}
+
+int trigger_init(void)
+{
+	return poller_register(&trigger_poller);
+}
+late_initcall(trigger_init);
diff --git a/include/led.h b/include/led.h
index 0210897..9ec1f0d 100644
--- a/include/led.h
+++ b/include/led.h
@@ -26,6 +26,38 @@ int led_register(struct led *led);
 void led_unregister(struct led *led);
 void led_unregister(struct led *led);
 
+/* LED trigger support */
+enum led_trigger {
+	LED_TRIGGER_PANIC,
+	LED_TRIGGER_HEARTBEAT,
+	LED_TRIGGER_NET_RX,
+	LED_TRIGGER_NET_TX,
+	LED_TRIGGER_NET_TXRX,
+	LED_TRIGGER_MAX,
+};
+
+enum trigger_type {
+	TRIGGER_ENABLE,
+	TRIGGER_DISABLE,
+	TRIGGER_FLASH,
+};
+
+#ifdef CONFIG_LED_TRIGGERS
+int led_set_trigger(enum led_trigger trigger, struct led *led);
+void led_trigger(enum led_trigger trigger, enum trigger_type);
+#else
+static inline int led_set_trigger(enum led_trigger trigger, struct led *led)
+{
+	return 0;
+}
+
+static inline void led_trigger(enum led_trigger trigger, enum trigger_type type)
+{
+}
+#endif
+
+int led_get_trigger(enum led_trigger trigger);
+
 /* gpio LED support */
 struct gpio_led {
 	int gpio;
diff --git a/include/net.h b/include/net.h
index c695e5f..ccaab8b 100644
--- a/include/net.h
+++ b/include/net.h
@@ -18,6 +18,7 @@
 #include <malloc.h>
 #include <stdlib.h>
 #include <clock.h>
+#include <led.h>
 #include <asm/byteorder.h>	/* for nton* / ntoh* stuff */
 
 
@@ -417,4 +418,6 @@ static inline unsigned char *net_udp_get_payload(struct net_connection *con)
 int net_udp_send(struct net_connection *con, int len);
 int net_icmp_send(struct net_connection *con, int len);
 
+void led_trigger_network(enum led_trigger trigger);
+
 #endif /* __NET_H__ */
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index e2ea84d..fec87ba 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -17,6 +17,7 @@
 #include <malloc.h>
 
 #include <common.h>
+#include <led.h>
 #include <reloc.h>
 
 unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
@@ -625,6 +626,9 @@ void __noreturn panic(const char *fmt, ...)
 	vprintf(fmt, args);
 	putchar('\n');
 	va_end(args);
+
+	led_trigger(LED_TRIGGER_PANIC, TRIGGER_ENABLE);
+
 #if defined (CONFIG_PANIC_HANG)
 	hang();
 #else
diff --git a/net/eth.c b/net/eth.c
index a82a263..7502e98 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -77,6 +77,8 @@ int eth_send(void *packet, int length)
 		eth_current->active = 1;
 	}
 
+	led_trigger_network(LED_TRIGGER_NET_TX);
+
 	return eth_current->send(eth_current, packet, length);
 }
 
@@ -183,4 +185,8 @@ void eth_unregister(struct eth_device *edev)
 	list_del(&edev->list);
 }
 
-
+void led_trigger_network(enum led_trigger trigger)
+{
+	led_trigger(trigger, TRIGGER_FLASH);
+	led_trigger(LED_TRIGGER_NET_TXRX, TRIGGER_FLASH);
+}
diff --git a/net/net.c b/net/net.c
index a613d1d..9b4ab89 100644
--- a/net/net.c
+++ b/net/net.c
@@ -628,19 +628,29 @@ int net_receive(unsigned char *pkt, int len)
 {
 	struct ethernet *et = (struct ethernet *)pkt;
 	int et_protlen = ntohs(et->et_protlen);
+	int ret;
 
-	if (len < ETHER_HDR_SIZE)
-		return 0;
+	led_trigger_network(LED_TRIGGER_NET_RX);
+
+	if (len < ETHER_HDR_SIZE) {
+		ret = 0;
+		goto out;
+	}
 
 	switch (et_protlen) {
 	case PROT_ARP:
-		return net_handle_arp(pkt, len);
+		ret = net_handle_arp(pkt, len);
+		break;
 	case PROT_IP:
-		return net_handle_ip(pkt, len);
+		ret = net_handle_ip(pkt, len);
+		break;
 	default:
 		debug("%s: got unknown protocol type: %d\n", __func__, et_protlen);
-		return 1;
+		ret = 1;
+		break;
 	}
+out:
+	return ret;
 }
 
 static int net_init(void)
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 6/8] LED: Add led command
  2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
                   ` (4 preceding siblings ...)
  2010-12-20  9:53 ` [PATCH 5/8] LED: Add LED trigger support Sascha Hauer
@ 2010-12-20  9:53 ` Sascha Hauer
  2010-12-20  9:53 ` [PATCH 7/8] LED: Add trigger command Sascha Hauer
  2010-12-20  9:53 ` [PATCH 8/8] ARM pcm043 board: Add LED support Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

This patch allows controlling LEDs via the command line.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/Kconfig  |    7 ++++
 commands/Makefile |    1 +
 commands/led.c    |   90 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 commands/led.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 5416073..64e08bb 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -372,4 +372,11 @@ config CMD_I2C
 	  include i2c_probe, i2c_read and i2c_write commands to communicate
 	  on i2c bus.
 
+config CMD_LED
+	bool
+	depends on LED
+	prompt "led command"
+	help
+	  include led command to control LEDs
+
 endmenu
diff --git a/commands/Makefile b/commands/Makefile
index ca30b5f..0820483 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -53,3 +53,4 @@ obj-$(CONFIG_CMD_UBI)		+= ubi.o
 obj-$(CONFIG_CMD_MENU)		+= menu.o
 obj-$(CONFIG_CMD_PASSWD)	+= passwd.o
 obj-$(CONFIG_CMD_LOGIN)		+= login.o
+obj-$(CONFIG_CMD_LED)		+= led.o
diff --git a/commands/led.c b/commands/led.c
new file mode 100644
index 0000000..360ce7c
--- /dev/null
+++ b/commands/led.c
@@ -0,0 +1,90 @@
+/*
+ * LED command support for barebox
+ *
+ * (C) Copyright 2010 Sascha Hauer, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <led.h>
+#include <command.h>
+#include <getopt.h>
+#include <errno.h>
+
+static int do_led(struct command *cmdtp, int argc, char *argv[])
+{
+	unsigned long value;
+	struct led *led;
+	int ret;
+
+	if (argc == 1) {
+		int i = 0;
+
+		printf("registered LEDs:\n");
+
+		while ((led = led_by_number(i))) {
+			printf("%-2d: name: %-10s max_value: %d\n",
+					i, led->name ? led->name : "none",
+					led->max_value);
+			i++;
+		}
+		return 0;
+	}
+
+	if (argc != 3)
+		return COMMAND_ERROR_USAGE;
+
+	led = led_by_name_or_number(argv[1]);
+	if (!led) {
+		printf("no such LED: %s\n", argv[1]);
+		return 1;
+	}
+
+	value = simple_strtoul(argv[optind + 1], NULL, 0);
+
+	ret = led_set(led, value);
+	if (ret < 0) {
+		perror("led");
+		return 1;
+	}
+
+	return 0;
+}
+
+/**
+ * @page led_command
+
+The exact meaning of <value> is unspecified. It can be a color in case of rgb
+LEDs or a brightness if this is controllable. In most cases only 1 for enabled
+is allowed.
+
+*/
+
+BAREBOX_CMD_HELP_START(led)
+BAREBOX_CMD_HELP_USAGE("led <led> <value>\n")
+BAREBOX_CMD_HELP_SHORT("control the value of a LED. a value of 0 means disabled\n")
+BAREBOX_CMD_HELP_SHORT("without arguments the available LEDs are listed\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(led)
+	.cmd		= do_led,
+	.usage		= "led <led> <value>",
+	BAREBOX_CMD_HELP(cmd_led_help)
+BAREBOX_CMD_END
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 7/8] LED: Add trigger command
  2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
                   ` (5 preceding siblings ...)
  2010-12-20  9:53 ` [PATCH 6/8] LED: Add led command Sascha Hauer
@ 2010-12-20  9:53 ` Sascha Hauer
  2010-12-20  9:53 ` [PATCH 8/8] ARM pcm043 board: Add LED support Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

This patch allows controlling LED triggers vie the command line.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/Kconfig   |    8 ++++
 commands/Makefile  |    1 +
 commands/trigger.c |  107 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100644 commands/trigger.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 64e08bb..f137f47 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -379,4 +379,12 @@ config CMD_LED
 	help
 	  include led command to control LEDs
 
+config CMD_LED_TRIGGER
+	bool
+	depends on LED_TRIGGERS
+	prompt "trigger command"
+	help
+	  The trigger command allows to control LED triggers from the command
+	  line.
+
 endmenu
diff --git a/commands/Makefile b/commands/Makefile
index 0820483..c89adcf 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -54,3 +54,4 @@ obj-$(CONFIG_CMD_MENU)		+= menu.o
 obj-$(CONFIG_CMD_PASSWD)	+= passwd.o
 obj-$(CONFIG_CMD_LOGIN)		+= login.o
 obj-$(CONFIG_CMD_LED)		+= led.o
+obj-$(CONFIG_CMD_LED_TRIGGER)	+= trigger.o
diff --git a/commands/trigger.c b/commands/trigger.c
new file mode 100644
index 0000000..162da97
--- /dev/null
+++ b/commands/trigger.c
@@ -0,0 +1,107 @@
+/*
+ * LED trigger command support for barebox
+ *
+ * (C) Copyright 2010 Sascha Hauer, Pengutronix
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <led.h>
+#include <command.h>
+#include <getopt.h>
+#include <errno.h>
+
+#define LED_COMMAND_SET_TRIGGER		1
+#define LED_COMMAND_SHOW_INFO		2
+#define	LED_COMMAND_DISABLE_TRIGGER	3
+
+static char *trigger_names[] = {
+	[LED_TRIGGER_PANIC] = "panic",
+	[LED_TRIGGER_HEARTBEAT] = "heartbeat",
+	[LED_TRIGGER_NET_RX] = "net rx",
+	[LED_TRIGGER_NET_TX] = "net tx",
+	[LED_TRIGGER_NET_TXRX] = "net",
+};
+
+static int do_trigger(struct command *cmdtp, int argc, char *argv[])
+{
+	struct led *led;
+	int i, opt, ret = 0;
+	int cmd = LED_COMMAND_SHOW_INFO;
+	unsigned long trigger = 0;
+
+	while((opt = getopt(argc, argv, "t:d:")) > 0) {
+		switch(opt) {
+		case 't':
+			trigger = simple_strtoul(optarg, NULL, 0);
+			cmd = LED_COMMAND_SET_TRIGGER;
+			break;
+		case 'd':
+			trigger = simple_strtoul(optarg, NULL, 0);
+			cmd = LED_COMMAND_DISABLE_TRIGGER;
+		}
+	}
+
+	switch (cmd) {
+	case LED_COMMAND_SHOW_INFO:
+		for (i = 0; i < LED_TRIGGER_MAX; i++) {
+			int led = led_get_trigger(i);
+			printf("%d: %s", i, trigger_names[i]);
+			if (led >= 0)
+				printf(" (led %d)", led);
+			printf("\n");
+		}
+		break;
+
+	case LED_COMMAND_DISABLE_TRIGGER:
+		led_set_trigger(trigger, NULL);
+		return 0;
+	case LED_COMMAND_SET_TRIGGER:
+		if (argc - optind != 1)
+			return COMMAND_ERROR_USAGE;
+		led = led_by_name_or_number(argv[optind]);
+
+		if (!led) {
+			printf("no such led: %d\n", argv[optind]);
+			return 1;
+		}
+
+		ret = led_set_trigger(trigger, led);
+		break;
+	}
+
+	if (ret)
+		printf("trigger failed: %s\n", strerror(-ret));
+	return ret ? 1 : 0;
+}
+
+BAREBOX_CMD_HELP_START(trigger)
+BAREBOX_CMD_HELP_USAGE("trigger [OPTIONS]\n")
+BAREBOX_CMD_HELP_SHORT("control a LED trigger. Without options the currently assigned triggers are shown.\n")
+BAREBOX_CMD_HELP_OPT  ("-t <trigger> <led>",  "set a trigger for a led\n")
+BAREBOX_CMD_HELP_OPT  ("-d <trigger>",  "disable a trigger\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(trigger)
+	.cmd		= do_trigger,
+	.usage		= "handle LED triggers",
+	BAREBOX_CMD_HELP(cmd_trigger_help)
+BAREBOX_CMD_END
+
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 8/8] ARM pcm043 board: Add LED support
  2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
                   ` (6 preceding siblings ...)
  2010-12-20  9:53 ` [PATCH 7/8] LED: Add trigger command Sascha Hauer
@ 2010-12-20  9:53 ` Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-12-20  9:53 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/pcm043/pcm043.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boards/pcm043/pcm043.c b/arch/arm/boards/pcm043/pcm043.c
index 2191bc8..38f1b8f 100644
--- a/arch/arm/boards/pcm043/pcm043.c
+++ b/arch/arm/boards/pcm043/pcm043.c
@@ -39,6 +39,7 @@
 #include <mach/imx-nand.h>
 #include <fec.h>
 #include <fb.h>
+#include <led.h>
 #include <asm/mmu.h>
 #include <mach/imx-ipu-fb.h>
 #include <mach/imx-pll.h>
@@ -148,6 +149,10 @@ static int pcm043_mmu_init(void)
 postcore_initcall(pcm043_mmu_init);
 #endif
 
+struct gpio_led led0 = {
+	.gpio = 1 * 32 + 6,
+};
+
 static int imx35_devices_init(void)
 {
 	uint32_t reg;
@@ -157,6 +162,8 @@ static int imx35_devices_init(void)
 	writel(0x10000d03, CSCR_L(0));
 	writel(0x00720900, CSCR_A(0));
 
+	led_gpio_register(&led0);
+
 	reg = readl(IMX_CCM_BASE + CCM_RCSR);
 	/* some fuses provide us vital information about connected hardware */
 	if (reg & 0x20000000)
@@ -226,7 +233,8 @@ static struct pad_desc pcm043_pads[] = {
 	MX35_PAD_RTS1__UART1_RTS,
 	MX35_PAD_CTS1__UART1_CTS,
 	MX35_PAD_I2C1_CLK__I2C1_SCL,
-	MX35_PAD_I2C1_DAT__I2C1_SDA
+	MX35_PAD_I2C1_DAT__I2C1_SDA,
+	MX35_PAD_ATA_CS0__GPIO2_6, /* LED */
 };
 
 static int imx35_console_init(void)
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-12-20  9:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-20  9:53 [PATCH v2] LED support Sascha Hauer
2010-12-20  9:53 ` [PATCH 1/8] cfi flash driver: check for ctrl-c during erase Sascha Hauer
2010-12-20  9:53 ` [PATCH 2/8] Add generic poll infrastructure Sascha Hauer
2010-12-20  9:53 ` [PATCH 3/8] basic LED support Sascha Hauer
2010-12-20  9:53 ` [PATCH 4/8] LED: Add gpio " Sascha Hauer
2010-12-20  9:53 ` [PATCH 5/8] LED: Add LED trigger support Sascha Hauer
2010-12-20  9:53 ` [PATCH 6/8] LED: Add led command Sascha Hauer
2010-12-20  9:53 ` [PATCH 7/8] LED: Add trigger command Sascha Hauer
2010-12-20  9:53 ` [PATCH 8/8] ARM pcm043 board: Add LED support Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox