add first batch of enrik's ar7 system code cleanups
[openwrt.git] / openwrt / target / linux / linux-2.4 / patches / ar7 / 002-led_driver.patch
index 1982ac3..81fe153 100644 (file)
@@ -1,6 +1,63 @@
-diff -urN linux.old/drivers/char/avalanche_led/gpio.c linux.dev/drivers/char/avalanche_led/gpio.c
---- linux.old/drivers/char/avalanche_led/gpio.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux.dev/drivers/char/avalanche_led/gpio.c        2005-07-22 06:52:42.973338640 +0200
+diff -urN linux.dev/drivers/char/Config.in linux.dev2/drivers/char/Config.in
+--- linux.dev/drivers/char/Config.in   2005-10-21 17:02:20.199991500 +0200
++++ linux.dev2/drivers/char/Config.in  2005-10-21 18:03:44.541778750 +0200
+@@ -133,6 +133,10 @@
+       fi
+    fi
+ fi
++if [ "$CONFIG_AR7" = "y" ]; then
++   bool  'Enable LED support' CONFIG_AR7_LED
++fi
++
+ if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_ZORRO" = "y" ]; then
+    tristate 'Commodore A2232 serial support (EXPERIMENTAL)' CONFIG_A2232
+ fi
+diff -urN linux.dev/drivers/char/Makefile linux.dev2/drivers/char/Makefile
+--- linux.dev/drivers/char/Makefile    2005-10-21 17:02:20.199991500 +0200
++++ linux.dev2/drivers/char/Makefile   2005-10-21 18:03:44.541778750 +0200
+@@ -190,6 +190,12 @@
+   obj-$(CONFIG_PCI) += keyboard.o $(KEYMAP)
+ endif
++#
++# Texas Intruments LED driver
++# 
++obj-$(CONFIG_AR7_LED) += avalanche_led/avalanche_led.o
++subdir-$(CONFIG_AR7_LED) += avalanche_led
++
+ obj-$(CONFIG_HIL) += hp_keyb.o
+ obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
+ obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
+diff -urN linux.dev/drivers/char/avalanche_led/Makefile linux.dev2/drivers/char/avalanche_led/Makefile
+--- linux.dev/drivers/char/avalanche_led/Makefile      1970-01-01 01:00:00.000000000 +0100
++++ linux.dev2/drivers/char/avalanche_led/Makefile     2005-10-21 18:03:44.513777000 +0200
+@@ -0,0 +1,23 @@
++# File: drivers/char/avalanche_led/Makefile
++#
++# Makefile for the Linux LED device driver.
++#
++
++
++O_TARGET := avalanche_led.o
++obj-m := avalanche_led.o
++list-multi      := avalanche_led.o
++
++EXTRA_CFLAGS := -I$(TOPDIR)/include/asm/ar7
++
++export-objs := ledmod.o leds.o
++
++avalanche_led-objs := ledmod.o gpio.o uartled.o leds.o
++
++include $(TOPDIR)/Rules.make
++
++avalanche_led.o:      $(avalanche_led-objs)
++      $(LD) -r -o $@ $(avalanche_led-objs)
++
++clean:
++      rm -f core *.o *.a *.s
+diff -urN linux.dev/drivers/char/avalanche_led/gpio.c linux.dev2/drivers/char/avalanche_led/gpio.c
+--- linux.dev/drivers/char/avalanche_led/gpio.c        1970-01-01 01:00:00.000000000 +0100
++++ linux.dev2/drivers/char/avalanche_led/gpio.c       2005-10-21 18:03:44.513777000 +0200
 @@ -0,0 +1,382 @@
 +#include <linux/kernel.h>
 +#include <asm/uaccess.h>
@@ -384,9 +441,9 @@ diff -urN linux.old/drivers/char/avalanche_led/gpio.c linux.dev/drivers/char/ava
 +
 +
 +
-diff -urN linux.old/drivers/char/avalanche_led/ledmod.c linux.dev/drivers/char/avalanche_led/ledmod.c
---- linux.old/drivers/char/avalanche_led/ledmod.c      1970-01-01 01:00:00.000000000 +0100
-+++ linux.dev/drivers/char/avalanche_led/ledmod.c      2005-07-22 06:52:42.975338336 +0200
+diff -urN linux.dev/drivers/char/avalanche_led/ledmod.c linux.dev2/drivers/char/avalanche_led/ledmod.c
+--- linux.dev/drivers/char/avalanche_led/ledmod.c      1970-01-01 01:00:00.000000000 +0100
++++ linux.dev2/drivers/char/avalanche_led/ledmod.c     2005-10-21 18:03:44.513777000 +0200
 @@ -0,0 +1,1116 @@
 +#include <linux/config.h>
 +#include <linux/init.h>
@@ -1504,9 +1561,9 @@ diff -urN linux.old/drivers/char/avalanche_led/ledmod.c linux.dev/drivers/char/a
 +EXPORT_SYMBOL_NOVERS(register_led_drv);
 +EXPORT_SYMBOL_NOVERS(deregister_led_drv);
 +
-diff -urN linux.old/drivers/char/avalanche_led/leds.c linux.dev/drivers/char/avalanche_led/leds.c
---- linux.old/drivers/char/avalanche_led/leds.c        1970-01-01 01:00:00.000000000 +0100
-+++ linux.dev/drivers/char/avalanche_led/leds.c        2005-07-22 06:52:42.976338184 +0200
+diff -urN linux.dev/drivers/char/avalanche_led/leds.c linux.dev2/drivers/char/avalanche_led/leds.c
+--- linux.dev/drivers/char/avalanche_led/leds.c        1970-01-01 01:00:00.000000000 +0100
++++ linux.dev2/drivers/char/avalanche_led/leds.c       2005-10-21 18:03:44.513777000 +0200
 @@ -0,0 +1,133 @@
 +#include <linux/config.h>
 +#include <linux/init.h>
@@ -1641,36 +1698,9 @@ diff -urN linux.old/drivers/char/avalanche_led/leds.c linux.dev/drivers/char/ava
 +
 +
 +
-diff -urN linux.old/drivers/char/avalanche_led/Makefile linux.dev/drivers/char/avalanche_led/Makefile
---- linux.old/drivers/char/avalanche_led/Makefile      1970-01-01 01:00:00.000000000 +0100
-+++ linux.dev/drivers/char/avalanche_led/Makefile      2005-07-22 06:52:42.977338032 +0200
-@@ -0,0 +1,23 @@
-+# File: drivers/char/avalanche_led/Makefile
-+#
-+# Makefile for the Linux LED device driver.
-+#
-+
-+
-+O_TARGET := avalanche_led.o
-+obj-m := avalanche_led.o
-+list-multi      := avalanche_led.o
-+
-+EXTRA_CFLAGS := -I$(TOPDIR)/include/asm/ar7
-+
-+export-objs := ledmod.o leds.o
-+
-+avalanche_led-objs := ledmod.o gpio.o uartled.o leds.o
-+
-+include $(TOPDIR)/Rules.make
-+
-+avalanche_led.o:      $(avalanche_led-objs)
-+      $(LD) -r -o $@ $(avalanche_led-objs)
-+
-+clean:
-+      rm -f core *.o *.a *.s
-diff -urN linux.old/drivers/char/avalanche_led/uartled.c linux.dev/drivers/char/avalanche_led/uartled.c
---- linux.old/drivers/char/avalanche_led/uartled.c     1970-01-01 01:00:00.000000000 +0100
-+++ linux.dev/drivers/char/avalanche_led/uartled.c     2005-07-22 06:52:42.977338032 +0200
+diff -urN linux.dev/drivers/char/avalanche_led/uartled.c linux.dev2/drivers/char/avalanche_led/uartled.c
+--- linux.dev/drivers/char/avalanche_led/uartled.c     1970-01-01 01:00:00.000000000 +0100
++++ linux.dev2/drivers/char/avalanche_led/uartled.c    2005-10-21 18:03:44.529778000 +0200
 @@ -0,0 +1,55 @@
 +#include <linux/kernel.h>
 +#include <asm/uaccess.h>
@@ -1727,39 +1757,102 @@ diff -urN linux.old/drivers/char/avalanche_led/uartled.c linux.dev/drivers/char/
 +  return;
 +}
 +
-diff -urN linux.old/drivers/char/Config.in linux.dev/drivers/char/Config.in
---- linux.old/drivers/char/Config.in   2005-07-10 20:53:55.650624000 +0200
-+++ linux.dev/drivers/char/Config.in   2005-07-22 06:52:58.716945248 +0200
-@@ -133,6 +133,10 @@
-       fi
-    fi
- fi
-+if [ "$CONFIG_AR7" = "y" ]; then
-+   bool  'Enable LED support' CONFIG_AR7_LED
-+fi
-+
- if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_ZORRO" = "y" ]; then
-    tristate 'Commodore A2232 serial support (EXPERIMENTAL)' CONFIG_A2232
- fi
-diff -urN linux.old/drivers/char/Makefile linux.dev/drivers/char/Makefile
---- linux.old/drivers/char/Makefile    2005-07-10 20:53:55.651623000 +0200
-+++ linux.dev/drivers/char/Makefile    2005-07-22 06:53:35.321380528 +0200
-@@ -190,6 +190,12 @@
-   obj-$(CONFIG_PCI) += keyboard.o $(KEYMAP)
- endif
-+#
-+# Texas Intruments LED driver
-+# 
-+obj-$(CONFIG_AR7_LED) += avalanche_led/avalanche_led.o
-+subdir-$(CONFIG_AR7_LED) += avalanche_led
-+
- obj-$(CONFIG_HIL) += hp_keyb.o
- obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
- obj-$(CONFIG_ATARI_DSP56K) += dsp56k.o
-diff -urN linux.old/include/asm-mips/ar7/ledapp.h linux.dev/include/asm-mips/ar7/ledapp.h
---- linux.old/include/asm-mips/ar7/ledapp.h    1970-01-01 01:00:00.000000000 +0100
-+++ linux.dev/include/asm-mips/ar7/ledapp.h    2005-07-22 06:52:42.982337272 +0200
+diff -urN linux.dev/include/asm-mips/ar7/led_config.h linux.dev2/include/asm-mips/ar7/led_config.h
+--- linux.dev/include/asm-mips/ar7/led_config.h        1970-01-01 01:00:00.000000000 +0100
++++ linux.dev2/include/asm-mips/ar7/led_config.h       2005-10-21 17:02:25.568327000 +0200
+@@ -0,0 +1,55 @@
++/******************************************************************************    
++ * FILE PURPOSE:     - LED config Header                                       
++ ******************************************************************************    
++ * FILE NAME:     led_config.h                                                        
++ *                                                                                 
++ * DESCRIPTION:  Header file for LED configuration parameters
++ *               and data structures                                                 
++ *                                                                                 
++ * REVISION HISTORY:                                                               
++ * 11 Oct 03 - PSP TII                                                             
++ *                                                                                 
++ * (C) Copyright 2002, Texas Instruments, Inc                                      
++ *******************************************************************************/  
++                                                                                   
++
++#ifndef __LED_CONFIG__
++#define __LED_CONFIG__
++
++/* LED config parameters */
++#define  MAX_GPIO_PIN_NUM           64
++#define  MAX_GPIOS_PER_STATE         5
++#define  MAX_MODULE_ENTRIES         25
++#define  MAX_MODULE_INSTANCES        4
++#define  MAX_STATE_ENTRIES          25
++#define  MAX_LED_ENTRIES            25
++
++
++/* LED modes */
++#define LED_OFF                    0
++#define LED_ON                     1
++#define LED_ONESHOT_OFF            2
++#define LED_ONESHOT_ON             3
++#define LED_FLASH                  4
++#define LED_BLINK_CODE0            5    /*--- param1: on time, param2: blink nr , (param2 > 100 blink off) ---*/
++#define LED_BLINK_CODE1            6 
++#define LED_BLINK_CODE2            7 
++
++#define NUM_LED_MODES              8
++
++
++
++/* Data structure for LED configuration */
++typedef struct led_config{
++    unsigned char name[80];
++    unsigned int instance;
++    unsigned int state;
++    unsigned int gpio[MAX_GPIOS_PER_STATE];
++    unsigned int mode[MAX_GPIOS_PER_STATE];
++    unsigned int gpio_num;
++    unsigned int param1;
++    unsigned int param2;
++}LED_CONFIG_T;
++
++
++#endif /* __LED_CONFIG__ */
+diff -urN linux.dev/include/asm-mips/ar7/led_hal.h linux.dev2/include/asm-mips/ar7/led_hal.h
+--- linux.dev/include/asm-mips/ar7/led_hal.h   1970-01-01 01:00:00.000000000 +0100
++++ linux.dev2/include/asm-mips/ar7/led_hal.h  2005-10-21 17:02:25.568327000 +0200
+@@ -0,0 +1,30 @@
++/******************************************************************************
++ * FILE PURPOSE:     - LED HAL module Header
++ ******************************************************************************
++ * FILE NAME:     led_hal.h
++ *
++ * DESCRIPTION:    LED HAL API's.
++ *
++ * REVISION HISTORY:
++ * 11 Oct 03 - PSP TII
++ *
++ * (C) Copyright 2002, Texas Instruments, Inc
++ *******************************************************************************/
++
++#ifndef __LED_HAL__
++#define __LED_HAL__
++
++/* Interface prototypes */
++#include "led_config.h"
++
++int avalanche_led_hal_init (int *gpio_off_value, int num_gpio_pins);
++int avalanche_led_config_set (LED_CONFIG_T * led_cfg);
++int avalanche_led_config_get (LED_CONFIG_T *led_cfg,int module_id,int instance, int state);
++void *avalanche_led_register (const char *module_name, int instance_num);
++void  avalanche_led_action (void *handle, int state_id);
++void avalanche_led_late_actions(void);
++int avalanche_led_unregister (void *handle);
++void avalanche_led_free_all(void);
++void avalanche_led_hal_exit (void);
++
++#endif /*__LED_HAL__ */
+diff -urN linux.dev/include/asm-mips/ar7/ledapp.h linux.dev2/include/asm-mips/ar7/ledapp.h
+--- linux.dev/include/asm-mips/ar7/ledapp.h    1970-01-01 01:00:00.000000000 +0100
++++ linux.dev2/include/asm-mips/ar7/ledapp.h   2005-10-21 18:03:44.573780750 +0200
 @@ -0,0 +1,59 @@
 +#ifndef __LED_APP__
 +#define __LED_APP__