**************************************************************
*Indexed led gpio class for the DEN
*mwelling
*09/25/2007
*EMAC.Inc
************************************************************
diff -uprN linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/led-som9260m.c linux-2.6.20.snap/arch/arm/mach-at91rm9200/led-som9260m.c
--- linux-2.6.20-at92_e1.2/arch/arm/mach-at91rm9200/led-som9260m.c	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.20.snap/arch/arm/mach-at91rm9200/led-som9260m.c	2007-09-24 17:59:09.000000000 -0400
@@ -0,0 +1,63 @@
+/*
+ * arch/arm/mach-at91rm9200/led-som9260m.c
+ * EMAC.Inc SOM9260m low level led interactions
+ *
+ * Copyright (C) 2007 EMAC.Inc <support@emacinc.com>
+ */
+
+#include <asm/io.h>
+#include <asm/hardware.h>
+#include <linux/class/gpio.h>
+#include <asm/arch/board.h>
+#include <asm/arch/at91sam9260.h>
+#include <asm/arch/gpio.h>
+
+#define LED_CNT 2
+
+/* Global Variables Used in the Driver. */
+int led_array[LED_CNT] = { AT91_PIN_PA9, AT91_PIN_PA10 };
+char led_value[LED_CNT] = { 0, 0 };
+
+int som9260m_led_init(void){
+	int i;
+	
+	for(i=0;i<LED_CNT;i++)
+		at91_set_gpio_output(led_array[i],led_value[i]);
+	
+	return 0;
+}
+
+static gpio_data led_data_read(struct gpio_s *gpio){
+	return at91_get_gpio_value(led_array[gpio->index]);
+}
+
+static int led_data_write(struct gpio_s *gpio,gpio_data data){
+	led_value[gpio->index] = (char)data;
+	at91_set_gpio_output(led_array[gpio->index],led_value[gpio->index]);
+	return 0;
+}
+
+static gpio_data led_index_read(struct gpio_s *gpio){
+	return gpio->index;
+}
+	
+static int led_index_write(struct gpio_s *gpio,gpio_data index){
+	if(index>LED_CNT)return -1;
+	if(index<0)return -1;
+	gpio->index = index;
+	return 0;
+}
+
+struct class_device *som9260m_led_class_create(const char *name){
+	gpio_t *gpio = kmalloc(sizeof(gpio_t),GFP_KERNEL);
+	memset(gpio,0,sizeof(gpio_t));
+	gpio->name = name;
+	gpio->subclass = GPIO_SUBCLASS;
+	gpio->data_write = led_data_write;
+	gpio->data_read = led_data_read;
+	gpio->index_write = led_index_write;
+	gpio->index_read = led_index_read;
+	led_index_write(gpio,0);
+	printk("registering indexed led device: %s\n",name);
+	return gpio_register_class_device(gpio);
+} 

