summaryrefslogtreecommitdiff
path: root/packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch')
-rw-r--r--packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch162
1 files changed, 162 insertions, 0 deletions
diff --git a/packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch b/packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch
new file mode 100644
index 0000000000..cc5a120e4b
--- /dev/null
+++ b/packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch
@@ -0,0 +1,162 @@
+Index: linux-2.6.23/drivers/leds/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Kconfig 2007-10-09 22:31:38.000000000 +0200
++++ linux-2.6.23/drivers/leds/Kconfig 2007-11-28 23:16:05.000000000 +0100
+@@ -101,6 +101,12 @@
+ outputs. To be useful the particular board must have LEDs
+ and they must be connected to the GPIO lines.
+
++config LEDS_MPC8313E_RDB
++ tristate "LED Support for MPC8313E-RDB LEDs"
++ depends on LEDS_CLASS && PPC_83xx
++ help
++ This option enables support for the LEDs on MPC8313E-RDB board.
++
+ comment "LED Triggers"
+
+ config LEDS_TRIGGERS
+Index: linux-2.6.23/drivers/leds/leds-mpc8313e-rdb.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23/drivers/leds/leds-mpc8313e-rdb.c 2007-11-29 00:32:27.000000000 +0100
+@@ -0,0 +1,128 @@
++/*
++ * drivers/leds/leds-mpc8313e-rdb.c
++ * Copyright (C) 2007 Leon Woestenberg <leon@sidebranch.com>
++ * Copyright (C) 2007 Jeremy Laine <jeremy.laine@bolloretelecom.eu>
++ *
++ * This file is subject to the terms and conditions of the GNU General Public
++ * License. See the file COPYING in the main directory of this archive for
++ * more details.
++ *
++ * MPC8313E-RDB LEDs driver
++ *
++ */
++
++#include <linux/module.h>
++#include <linux/platform_device.h>
++#include <linux/leds.h>
++#include <linux/err.h>
++#include <asm/io.h>
++#include <asm/ioport.h>
++
++int par_io_config_pin(u8 port, u8 pin, int dir, int open_drain,
++ int assignment, int has_irq);
++int par_io_data_set(u8 port, u8 pin, u8 val);
++
++static struct platform_dev *leds_pdev = NULL;
++static struct resource *led_mem = NULL;
++static void *p = NULL;
++
++static void mpc8313leds_green_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ int d = ioread16(p);
++ iowrite16(value?d&~1:d|1, p);
++}
++
++static struct led_classdev mpc8313_green_led = {
++ .name = "mpc8313:green",
++ .brightness_set = mpc8313leds_green_set,
++};
++
++static void mpc8313leds_yellow_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ int d = ioread16(p);
++ iowrite16(value?d&~2:d|2, p);
++}
++
++static struct led_classdev mpc8313_yellow_led = {
++ .name = "mpc8313:yellow",
++ .brightness_set = mpc8313leds_yellow_set,
++};
++
++static void mpc8313leds_red_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ int d = ioread16(p);
++ iowrite16(value?d&~4:d|4, p);
++}
++
++static struct led_classdev mpc8313_red_led = {
++ .name = "mpc8313:red",
++ .brightness_set = mpc8313leds_red_set,
++};
++
++static int mpc8313leds_probe(struct platform_device *pdev)
++{
++ int ret;
++
++ ret = led_classdev_register(&pdev->dev, &mpc8313_green_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &mpc8313_yellow_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &mpc8313_red_led);
++ if (ret < 0)
++ return ret;
++
++ return ret;
++}
++
++static int mpc8313leds_remove(struct platform_device *pdev)
++{
++ led_classdev_unregister(&mpc8313_green_led);
++ led_classdev_unregister(&mpc8313_yellow_led);
++ led_classdev_unregister(&mpc8313_red_led);
++ return 0;
++}
++
++static struct platform_driver mpc8313leds_driver = {
++ .driver = {
++ .name = "mpc8313-leds",
++ .owner = THIS_MODULE,
++ },
++ .probe = mpc8313leds_probe,
++ .remove = mpc8313leds_remove,
++};
++
++static int __init mpc8313leds_init(void)
++{
++ led_mem = request_mem_region(0xfa000000, 0x100);
++ if (led_mem == NULL) return -ENOMEM;
++ p = ioremap(0xfa000000, 0x100);
++ if (p == NULL)
++ {
++ if (led_mem) release_mem_region(0xfa000000, 0x100);
++ led_mem = NULL;
++ return -ENOMEM;
++ }
++ leds_pdev = platform_device_register_simple("mpc8313-leds", -1, NULL, 0);
++
++ return platform_driver_register(&mpc8313leds_driver);
++}
++
++static void __exit mpc8313leds_exit(void)
++{
++ if (led_mem) release_mem_region(0xfa000000, 0x100);
++ led_mem = NULL;
++ platform_driver_unregister(&mpc8313leds_driver);
++
++ platform_device_unregister(leds_pdev);
++}
++
++module_init(mpc8313leds_init);
++module_exit(mpc8313leds_exit);
++
++MODULE_AUTHOR("Leon Woestenberg <leon@sidebranch.com>");
++MODULE_DESCRIPTION("MPC8313E-RDB LED driver");
++
+Index: linux-2.6.23/drivers/leds/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Makefile 2007-11-28 23:17:29.000000000 +0100
++++ linux-2.6.23/drivers/leds/Makefile 2007-11-28 23:35:32.000000000 +0100
+@@ -17,6 +17,7 @@
+ obj-$(CONFIG_LEDS_H1940) += leds-h1940.o
+ obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o
+ obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o
++obj-$(CONFIG_LEDS_MPC8313E_RDB) += leds-mpc8313e-rdb.o
+
+ # LED Triggers
+ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o