First patches to get to .21 kernel
[openwrt/svn-archive/archive.git] / target / linux / at91-2.6 / patches / 002-led-driver.patch
index 51877d0682c8e7421329a929a9e4a2c90315715f..e78ed443c03850e38f750550a24bd1a2e7ee69a9 100644 (file)
@@ -1,24 +1,92 @@
-diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/Makefile linux-2.6.19.2/arch/arm/mach-at91rm9200/Makefile
---- linux-2.6.19.2.old/arch/arm/mach-at91rm9200/Makefile       2007-03-06 11:29:37.000000000 +0100
-+++ linux-2.6.19.2/arch/arm/mach-at91rm9200/Makefile   2007-03-06 20:52:28.000000000 +0100
-@@ -40,6 +40,7 @@
+diff -urN linux-2.6.21.1.orig/arch/arm/mach-at91/board-vlink.c linux-2.6.21.1/arch/arm/mach-at91/board-vlink.c
+--- linux-2.6.21.1.orig/arch/arm/mach-at91/board-vlink.c       2007-05-28 13:33:41.000000000 +0200
++++ linux-2.6.21.1/arch/arm/mach-at91/board-vlink.c    2007-05-28 14:43:28.000000000 +0200
+@@ -61,7 +61,7 @@
+       at91rm9200_initialize(18432000, AT91RM9200_PQFP);
+       /* Setup the LEDs */
+-//    at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
++      at91_init_leds(AT91_PIN_PC14, AT91_PIN_PC15);
+       /* Setup the serial ports and console */
+       at91_init_serial(&vlink_uart_config);
+@@ -81,10 +81,12 @@
+       .ports          = 1,
+ };
++/*
+ static struct at91_udc_data __initdata vlink_udc_data = {
+       .vbus_pin       = AT91_PIN_PD4,
+       .pullup_pin     = AT91_PIN_PD5,
+ };
++*/
+ static struct at91_mmc_data __initdata vlink_mmc_data = {
+ //    .det_pin        = AT91_PIN_PB27,
+@@ -108,18 +110,19 @@
+ #endif
+ };
+-static struct at91_gpio_led vlink_leds[] = {
++/*static struct at91_gpio_led vlink_leds[] = {
+       {
+               .name           = "led0",
+-              .gpio           = AT91_PIN_PB1,
++              .gpio           = AT91_PIN_PC14,
+               .trigger        = "heartbeat",
+       },
+       {
+               .name           = "led1",
+-              .gpio           = AT91_PIN_PB2,
++              .gpio           = AT91_PIN_PC15,
+               .trigger        = "timer",
+       }
+ };
++*/
+ static void __init vlink_board_init(void)
+ {
+@@ -130,8 +133,8 @@
+       /* USB Host */
+       at91_add_device_usbh(&vlink_usbh_data);
+       /* USB Device */
+-      at91_add_device_udc(&vlink_udc_data);
+-      at91_set_multi_drive(vlink_udc_data.pullup_pin, 1);     /* pullup_pin is connected to reset */
++//    at91_add_device_udc(&vlink_udc_data);
++//    at91_set_multi_drive(vlink_udc_data.pullup_pin, 1);     /* pullup_pin is connected to reset */
+       /* I2C */
+       at91_add_device_i2c();
+       /* SPI */
+@@ -145,7 +148,7 @@
+       at91_add_device_mmc(0, &vlink_mmc_data);
+ #endif
+       /* LEDs */
+-      at91_gpio_leds(vlink_leds, ARRAY_SIZE(vlink_leds));
++//    at91_gpio_leds(vlink_leds, ARRAY_SIZE(vlink_leds));
+ }
+ MACHINE_START(VLINK, "FDL VersaLink")
+diff -urN linux-2.6.21.1.orig/arch/arm/mach-at91/Makefile linux-2.6.21.1/arch/arm/mach-at91/Makefile
+--- linux-2.6.21.1.orig/arch/arm/mach-at91/Makefile    2007-05-28 13:13:15.000000000 +0200
++++ linux-2.6.21.1/arch/arm/mach-at91/Makefile 2007-05-28 14:19:06.000000000 +0200
+@@ -52,7 +52,7 @@
  led-$(CONFIG_MACH_CSB637)     += leds.o
  led-$(CONFIG_MACH_KB9200)     += leds.o
  led-$(CONFIG_MACH_KAFA)               += leds.o
-+led-$(CONFIG_MACH_VLINK)  += vlink_leds.o
+-led-$(CONFIG_MACH_VLINK)      += leds.o
++led-$(CONFIG_MACH_VLINK)      += vlink_leds.o
  obj-$(CONFIG_LEDS) += $(led-y)
  
  # VGA support
-diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/vlink_leds.c linux-2.6.19.2/arch/arm/mach-at91rm9200/vlink_leds.c
---- linux-2.6.19.2.old/arch/arm/mach-at91rm9200/vlink_leds.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.19.2/arch/arm/mach-at91rm9200/vlink_leds.c       2007-03-06 21:11:16.000000000 +0100
-@@ -0,0 +1,151 @@
+diff -urN linux-2.6.21.1.orig/arch/arm/mach-at91/vlink_leds.c linux-2.6.21.1/arch/arm/mach-at91/vlink_leds.c
+--- linux-2.6.21.1.orig/arch/arm/mach-at91/vlink_leds.c        1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.21.1/arch/arm/mach-at91/vlink_leds.c     2007-05-28 14:41:03.000000000 +0200
+@@ -0,0 +1,105 @@
 +/*
 + * LED driver for Atmel AT91-based boards.
 + *
 + *  Copyright (C) SAN People (Pty) Ltd
-+ *
-+ * Modified for FDL Versalink board (c) Guthrie Consulting
++ *    Modified for FDL VersaLink Copyright (C) Guthrie Consulting
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
@@ -35,10 +103,6 @@ diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/vlink_leds.c linux-2.6.19.
 +#include <asm/arch/board.h>
 +#include <asm/arch/gpio.h>
 +
-+#define LED_CPU 0
-+#define LED_TIMER 1
-+#define LED_COM1 2
-+#define LED_COM2 3
 +
 +static inline void at91_led_on(unsigned int led)
 +{
@@ -52,20 +116,26 @@ diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/vlink_leds.c linux-2.6.19.
 +
 +static inline void at91_led_toggle(unsigned int led)
 +{
-+      unsigned long is_off = at91_get_gpio_value(AT91_PIN_PC7);
++      unsigned long is_off = at91_get_gpio_value(led);
 +      if (is_off) {
-+              at91_set_gpio_value(AT91_PIN_PC7, 0);
-+              at91_set_gpio_value(AT91_PIN_PC8, 1);
-+      } else {
-+              at91_set_gpio_value(AT91_PIN_PC7, 1);
-+              at91_set_gpio_value(AT91_PIN_PC8, 0);
-+      }
++              at91_led_on(led);
++              at91_led_off(at91_leds_cpu);
++              }
++      else {
++              at91_led_on(at91_leds_cpu);
++              at91_led_off(led);
++              }
 +}
 +
 +
 +/*
 + * Handle LED events.
 + */
++
++/*
++ * VersaLink has a single bi-coloured LED which changes colour when the
++ * polarity is reversed
++ */
 +static void at91_leds_event(led_event_t evt)
 +{
 +      unsigned long flags;
@@ -74,20 +144,11 @@ diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/vlink_leds.c linux-2.6.19.
 +
 +      switch(evt) {
 +      case led_start:         /* System startup */
-+//            at91_led_on(at91_leds_cpu);
 +              at91_led_toggle(at91_leds_timer);
-+/*
-+              at91_set_gpio_value(AT91_PIN_PC7, 0);
-+              at91_set_gpio_value(AT91_PIN_PC8, 1);
-+*/
 +              break;
 +
 +      case led_stop:          /* System stop / suspend */
 +              at91_led_toggle(at91_leds_timer);
-+/*
-+              at91_set_gpio_value(AT91_PIN_PC7, 1);
-+              at91_set_gpio_value(AT91_PIN_PC8, 0);
-+*/
 +              break;
 +
 +#ifdef CONFIG_LEDS_TIMER
@@ -99,18 +160,10 @@ diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/vlink_leds.c linux-2.6.19.
 +#ifdef CONFIG_LEDS_CPU
 +      case led_idle_start:    /* Entering idle state */
 +              at91_led_toggle(at91_leds_timer);
-+/*
-+              at91_set_gpio_value(AT91_PIN_PC7, 1);
-+              at91_set_gpio_value(AT91_PIN_PC8, 0);
-+*/
 +              break;
 +
 +      case led_idle_end:      /* Exit idle state */
 +              at91_led_toggle(at91_leds_timer);
-+/*
-+              at91_set_gpio_value(AT91_PIN_PC7, 0);
-+              at91_set_gpio_value(AT91_PIN_PC8, 1);
-+*/
 +              break;
 +#endif
 +
@@ -124,38 +177,8 @@ diff -urN linux-2.6.19.2.old/arch/arm/mach-at91rm9200/vlink_leds.c linux-2.6.19.
 +
 +static int __init leds_init(void)
 +{
-+/*    if (!at91_leds_timer || !at91_leds_cpu)
++      if (!at91_leds_timer || !at91_leds_cpu)
 +              return -ENODEV;
-+*/
-+//    printk("leds_init()\n");
-+
-+      /* Enable PIO to access the LEDs */
-+      at91_set_gpio_output(AT91_PIN_PC7, 1);
-+      at91_set_gpio_output(AT91_PIN_PC8, 1);
-+      at91_set_gpio_output(AT91_PIN_PC14, 1);
-+      at91_set_gpio_output(AT91_PIN_PC15, 1);
-+      at91_set_gpio_output(AT91_PIN_PB14, 1);
-+      at91_set_gpio_output(AT91_PIN_PB15, 1);
-+      at91_set_gpio_output(AT91_PIN_PB16, 1);
-+      at91_set_gpio_output(AT91_PIN_PB17, 1);
-+
-+      at91_set_gpio_output(AT91_PIN_PB9, 1);
-+      at91_set_gpio_output(AT91_PIN_PB10, 1);
-+      at91_set_gpio_output(AT91_PIN_PB11, 1);
-+      at91_set_gpio_output(AT91_PIN_PB12, 1);
-+
-+      at91_set_gpio_input(AT91_PIN_PB8, 1);
-+      at91_set_gpio_input(AT91_PIN_PB22, 1);
-+      at91_set_gpio_input(AT91_PIN_PA19, 1);
-+      at91_set_gpio_input(AT91_PIN_PA24, 1);
-+      at91_set_gpio_output(AT91_PIN_PA29, 1);
-+      at91_set_gpio_output(AT91_PIN_PB2, 1);
-+      at91_set_gpio_output(AT91_PIN_PB3, 1);
-+      at91_set_gpio_output(AT91_PIN_PB4, 1);
-+
-+      at91_set_gpio_input(AT91_PIN_PB27, 1);
-+      at91_set_gpio_input(AT91_PIN_PB28, 1);
-+      at91_set_gpio_input(AT91_PIN_PB29, 1);
 +
 +      leds_event = at91_leds_event;
 +