remove version checks
[openwrt-10.03/.git] / target / linux / ar7 / files / arch / mips / ar7 / platform.c
index 980739f90aeba1031cd01c2b1981d34e98f322fe..c2629861e13478137dc718a4600a9afd3480a960 100644 (file)
 #include <linux/serial_8250.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
+#include <linux/version.h>
+#include <linux/vlynq.h>
+#include <linux/leds.h>
 
 #include <asm/addrspace.h>
 #include <asm/ar7/ar7.h>
 #include <asm/ar7/gpio.h>
 #include <asm/ar7/prom.h>
-#include <asm/ar7/vlynq.h>
 
 struct plat_vlynq_data {
        struct plat_vlynq_ops ops;
@@ -176,6 +178,27 @@ static struct resource vlynq_high_res[] = {
        },
 };
 
+static struct resource usb_res[] = {
+       {
+               .name = "regs",
+               .flags = IORESOURCE_MEM,
+               .start = AR7_REGS_USB,
+               .end = AR7_REGS_USB + 0xff,
+       },
+       {
+               .name = "irq",
+               .flags = IORESOURCE_IRQ,
+               .start = 32,
+               .end = 32,
+       },
+       {
+               .name = "mem",
+               .flags = IORESOURCE_MEM,
+               .start = 0x03400000,
+               .end = 0x034001fff,
+       },
+};
+
 static struct physmap_flash_data physmap_flash_data = {
        .width = 2,
 };
@@ -295,6 +318,43 @@ static struct platform_device uart = {
 };
 #endif
 
+static struct gpio_led default_leds[] = {
+       { .name = "status", .gpio = 8, .active_low = 1, },
+};
+
+static struct gpio_led fb_leds[] = {
+       { .name = "1", .gpio = 7, },
+       { .name = "2", .gpio = 13, .active_low = 1, },
+       { .name = "3", .gpio = 10, .active_low = 1, },
+       { .name = "4", .gpio = 12, .active_low = 1, },
+       { .name = "5", .gpio = 9, .active_low = 1, },
+};
+
+static struct gpio_led fb_fon_leds[] = {
+       { .name = "1", .gpio = 8, },
+       { .name = "2", .gpio = 3, .active_low = 1, },
+       { .name = "3", .gpio = 5, },
+       { .name = "4", .gpio = 4, .active_low = 1, },
+       { .name = "5", .gpio = 11, .active_low = 1, },
+};
+
+static struct gpio_led_platform_data ar7_led_data;
+
+static struct platform_device ar7_gpio_leds = {
+       .name = "leds-gpio",
+       .id = -1,
+       .dev = {
+               .platform_data = &ar7_led_data,
+       }
+};
+
+static struct platform_device ar7_udc = {
+       .id = -1,
+       .name = "ar7_udc",
+       .resource = usb_res,
+       .num_resources = ARRAY_SIZE(usb_res),
+};
+
 static inline unsigned char char2hex(char h)
 {
        switch (h) {
@@ -409,6 +469,17 @@ static int __init ar7_register_devices(void)
 
        cpmac_get_mac(0, cpmac_low_data.dev_addr);
        res = platform_device_register(&cpmac_low);
+       if (res)
+               return res;
+
+#warning FIXME: add model detection
+       ar7_led_data.num_leds = ARRAY_SIZE(default_leds);
+       ar7_led_data.leds = default_leds;
+       res = platform_device_register(&ar7_gpio_leds);
+       if (res)
+               return res;
+
+       res = platform_device_register(&ar7_udc);
 
        return res;
 }