several cleanups for ifxmips. removes all code that has not been cleaned up properly
[openwrt/openwrt.git] / target / linux / ifxmips / files / arch / mips / ifxmips / board.c
index 937737968cbeb9a2e5aa2b372439f156d440862b..364d33baa794802853be7d634f7c3d8adf8cfb71 100644 (file)
@@ -34,6 +34,7 @@
 #include <asm/bootinfo.h>
 #include <asm/irq.h>
 #include <asm/ifxmips/ifxmips.h>
+#include <asm/ifxmips/ifxmips_irq.h>
 
 #define MAX_BOARD_NAME_LEN             32
 #define MAX_IFXMIPS_DEVS               9
@@ -70,7 +71,7 @@ struct ifxmips_board {
        int num_devs;
 };
 
-spinlock_t ebu_lock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(ebu_lock);
 EXPORT_SYMBOL_GPL(ebu_lock);
 
 static unsigned char ifxmips_ethaddr[6];
@@ -132,6 +133,7 @@ static struct gpio_led arv4519_gpio_leds[] = {
        { .name = "ifx:green:internet", .gpio = 5, .active_low = 1, },
        { .name = "ifx:red:internet", .gpio = 8, .active_low = 1, },
        { .name = "ifx:green:wlan", .gpio = 6, .active_low = 1, },
+       { .name = "ifx:green:usbpwr", .gpio = 14, .active_low = 1, },
        { .name = "ifx:green:usb", .gpio = 19, .active_low = 1, },
 };
 
@@ -146,18 +148,41 @@ static struct platform_device ifxmips_gpio_leds = {
 };
 #endif
 
+static struct resource dwc_usb_res[] = {
+       {
+               .name = "dwc_usb_membase",
+               .flags = IORESOURCE_MEM,
+               .start = 0x1E101000,
+               .end = 0x1E101FFF
+       },
+       {
+               .name = "dwc_usb_irq",
+               .flags = IORESOURCE_IRQ,
+               .start = IFXMIPS_USB_INT,
+       }
+};
+
+static struct platform_device dwc_usb =
+{
+       .id = 0,
+       .name = "dwc_usb",
+       .resource = dwc_usb_res,
+       .num_resources = ARRAY_SIZE(dwc_usb_res),
+};
+
 struct platform_device *easy50712_devs[] = {
        &ifxmips_led, &ifxmips_gpio, &ifxmips_mii,
-       &ifxmips_mtd, &ifxmips_wdt, &ifxmips_gpio_dev
+       &ifxmips_mtd, &ifxmips_wdt, &ifxmips_gpio_dev, &dwc_usb
 };
 
 struct platform_device *easy4010_devs[] = {
        &ifxmips_led, &ifxmips_gpio, &ifxmips_mii,
-       &ifxmips_mtd, &ifxmips_wdt, &ifxmips_gpio_dev
+       &ifxmips_mtd, &ifxmips_wdt, &ifxmips_gpio_dev, &dwc_usb
 };
 
 struct platform_device *arv5419_devs[] = {
-       &ifxmips_gpio, &ifxmips_mii, &ifxmips_mtd, &ifxmips_wdt,
+       &ifxmips_gpio, &ifxmips_mii, &ifxmips_mtd,
+       &ifxmips_gpio_dev, &ifxmips_wdt, &dwc_usb,
 #ifdef CONFIG_LEDS_GPIO
        &ifxmips_gpio_leds,
 #endif
@@ -179,6 +204,7 @@ static struct gpio_led easy4010_leds[] = {
 
 static struct ifxmips_board boards[] = {
        {
+               /* infineon eval kit */
                .type = EASY50712,
                .name = "EASY50712",
                .system_type = SYSTEM_DANUBE_CHIPID1,
@@ -189,6 +215,7 @@ static struct ifxmips_board boards[] = {
                        .end = (1 << 0) | (1 << 1)},
                .ifxmips_leds = easy50712_leds,
        }, {
+               /* infineon eval kit */
                .type = EASY4010,
                .name = "EASY4010",
                .system_type = SYSTEM_TWINPASS_CHIPID,
@@ -199,6 +226,7 @@ static struct ifxmips_board boards[] = {
                        .end = (1 << 0) | (1 << 1)},
                .ifxmips_leds = easy4010_leds,
        }, {
+               /* arcaydian annex-a board used by thompson, airties, ... */
                .type = ARV4519,
                .name = "ARV4519",
                .system_type = SYSTEM_DANUBE_CHIPID2,
@@ -245,7 +273,7 @@ static int __init ifxmips_set_ethaddr(char *str)
 {
 #define IS_HEX(x) \
        (((x >= '0' && x <= '9') || (x >= 'a' && x <= 'f') \
-               || (x >= 'A' && x <= 'F'))?(1):(0))
+               || (x >= 'A' && x <= 'F')) ? (1) : (0))
        int i;
        str = strchr(str, '=');
        if (!str)
@@ -336,6 +364,7 @@ int __init ifxmips_init_devices(void)
                ifxmips_led_data.num_leds = ARRAY_SIZE(easy4010_leds);
                break;
        case ARV4519:
+               /* set some sane defaults for the gpios */
                gpio_set_value(3, 0);
                gpio_set_value(4, 0);
                gpio_set_value(5, 0);
@@ -354,8 +383,8 @@ int __init ifxmips_init_devices(void)
 #endif
        ifxmips_led_data.leds = board->ifxmips_leds;
 
-       printk(KERN_INFO "%s:%s[%d]adding %d devs\n",
-               __FILE__, __func__, __LINE__, board->num_devs);
+       printk(KERN_INFO "%s: adding %d devs\n",
+               __func__, board->num_devs);
 
        ifxmips_gpio.resource = &board->reset_resource;
        ifxmips_gpio_dev.resource = &board->gpiodev_resource;