[oe-commits] org.oe.dev linux-2.6.23: fix LEDs driver for mpc8313e-rdb

jeremy_laine commit openembedded-commits at lists.openembedded.org
Mon Dec 3 10:37:28 UTC 2007


linux-2.6.23: fix LEDs driver for mpc8313e-rdb

Author: jeremy_laine at openembedded.org
Branch: org.openembedded.dev
Revision: 9e08f0a0ea353d01da3e8da16012b96b9e4e2fa2
ViewMTN: http://monotone.openembedded.org/revision/info/9e08f0a0ea353d01da3e8da16012b96b9e4e2fa2
Files:
1
packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch
Diffs:

#
# mt diff -r4a23c4203458081f8c8097c7f903f33869fbb5bf -r9e08f0a0ea353d01da3e8da16012b96b9e4e2fa2
#
# 
# 
# patch "packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch"
#  from [17503c55f830f3a3deb1876d7d390a42edb3bc6b]
#    to [bc9b6320d36d6556339ca6526a84f192b7c3f86f]
# 
============================================================
--- packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch	17503c55f830f3a3deb1876d7d390a42edb3bc6b
+++ packages/linux/linux-2.6.23/mpc8313e-rdb/mpc8313e-rdb-leds.patch	bc9b6320d36d6556339ca6526a84f192b7c3f86f
@@ -1,6 +1,6 @@ diff -urN linux-2.6.23.orig/drivers/leds
 diff -urN linux-2.6.23.orig/drivers/leds/Kconfig 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-29 09:02:42.000000000 +0100
++++ linux-2.6.23/drivers/leds/Kconfig	2007-12-03 11:08:06.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.
@@ -16,8 +16,8 @@ diff -urN linux-2.6.23.orig/drivers/leds
  config LEDS_TRIGGERS
 diff -urN linux-2.6.23.orig/drivers/leds/leds-mpc8313e-rdb.c linux-2.6.23/drivers/leds/leds-mpc8313e-rdb.c
 --- linux-2.6.23.orig/drivers/leds/leds-mpc8313e-rdb.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.23/drivers/leds/leds-mpc8313e-rdb.c	2007-11-29 09:02:42.000000000 +0100
-@@ -0,0 +1,128 @@
++++ linux-2.6.23/drivers/leds/leds-mpc8313e-rdb.c	2007-12-03 11:08:36.000000000 +0100
+@@ -0,0 +1,127 @@
 +/*
 + * drivers/leds/leds-mpc8313e-rdb.c
 + * Copyright (C) 2007 Leon Woestenberg <leon at sidebranch.com>
@@ -38,18 +38,18 @@ diff -urN linux-2.6.23.orig/drivers/leds
 +#include <linux/err.h>
 +#include <asm/io.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);
++#define LEDS_BASE 0xfa000000
++#define LEDS_SIZE 0x2
 +
 +static struct platform_dev *leds_pdev = NULL;
 +static struct resource *led_mem = NULL;
-+static void *p = NULL;
++static void *led_io = NULL;
++static u8 led_state = 0;
 +
 +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);
++	led_state = value ? led_state&~32 : led_state|32;
++	iowrite8(led_state, led_io);
 +}
 +
 +static struct led_classdev mpc8313_green_led = {
@@ -59,8 +59,8 @@ diff -urN linux-2.6.23.orig/drivers/leds
 +
 +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);
++	led_state = value ? led_state&~64 : led_state|64;
++	iowrite8(led_state, led_io);
 +}
 +
 +static struct led_classdev mpc8313_yellow_led = {
@@ -70,8 +70,8 @@ diff -urN linux-2.6.23.orig/drivers/leds
 +
 +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);
++	led_state = value ? led_state&~128 : led_state|128;
++	iowrite8(led_state, led_io);
 +}
 +
 +static struct led_classdev mpc8313_red_led = {
@@ -117,12 +117,11 @@ diff -urN linux-2.6.23.orig/drivers/leds
 +
 +static int __init mpc8313leds_init(void)
 +{
-+	led_mem = request_mem_region(0xfa000000, 0x100, "mpc8313-leds");
-+	if (led_mem == NULL) return -ENOMEM;
-+	p = ioremap(0xfa000000, 0x100);
-+	if (p == NULL)
++	if (!(led_mem = request_mem_region(LEDS_BASE, LEDS_SIZE, "mpc8313-leds")))
++		return -ENOMEM;
++	if (!(led_io = ioremap(LEDS_BASE, LEDS_SIZE)))
 +	{
-+		if (led_mem) release_mem_region(0xfa000000, 0x100);
++		release_mem_region(LEDS_BASE, LEDS_SIZE);
 +		led_mem = NULL;
 +		return -ENOMEM;
 +	}
@@ -133,7 +132,7 @@ diff -urN linux-2.6.23.orig/drivers/leds
 +
 +static void __exit mpc8313leds_exit(void)
 +{
-+	if (led_mem) release_mem_region(0xfa000000, 0x100);
++	if (led_mem) release_mem_region(LEDS_BASE, LEDS_SIZE);
 +	led_mem = NULL;
 +	platform_driver_unregister(&mpc8313leds_driver);
 +
@@ -148,7 +147,7 @@ diff -urN linux-2.6.23.orig/drivers/leds
 +MODULE_LICENSE("GPL");
 diff -urN linux-2.6.23.orig/drivers/leds/Makefile linux-2.6.23/drivers/leds/Makefile
 --- linux-2.6.23.orig/drivers/leds/Makefile	2007-10-09 22:31:38.000000000 +0200
-+++ linux-2.6.23/drivers/leds/Makefile	2007-11-29 09:03:09.000000000 +0100
++++ linux-2.6.23/drivers/leds/Makefile	2007-12-03 11:08:06.000000000 +0100
 @@ -17,6 +17,7 @@
  obj-$(CONFIG_LEDS_H1940)		+= leds-h1940.o
  obj-$(CONFIG_LEDS_COBALT)		+= leds-cobalt.o






More information about the Openembedded-commits mailing list