Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / arm / mach-lh7a40x / arch-lpd7a40x.c
index 734cc75..12e2327 100644 (file)
 
 #include <linux/tty.h>
 #include <linux/init.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
 
 #include <asm/hardware.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
-#include <asm/hardware.h>      /* io_p2v() */
 #include <asm/irq.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/map.h>
 
-#include <linux/interrupt.h>
+#include "common.h"
 
 static struct resource smc91x_resources[] = {
        [0] = {
@@ -45,7 +45,6 @@ static struct platform_device smc91x_device = {
        .resource       = smc91x_resources,
 };
 
-#if 0
 static struct resource lh7a40x_usbclient_resources[] = {
        [0] = {
                .start  = USB_PHYS,
@@ -53,8 +52,8 @@ static struct resource lh7a40x_usbclient_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = IRQ_USB,
-               .end    = IRQ_USB,
+               .start  = IRQ_USBINTR,
+               .end    = IRQ_USBINTR,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -62,7 +61,7 @@ static struct resource lh7a40x_usbclient_resources[] = {
 static u64 lh7a40x_usbclient_dma_mask = 0xffffffffUL;
 
 static struct platform_device lh7a40x_usbclient_device = {
-       .name           = "lh7a40x-udc",
+       .name           = "lh7a40x_udc",
        .id             = 0,
        .dev            = {
                .dma_mask = &lh7a40x_usbclient_dma_mask,
@@ -71,7 +70,6 @@ static struct platform_device lh7a40x_usbclient_device = {
        .num_resources  = ARRAY_SIZE (lh7a40x_usbclient_resources),
        .resource       = lh7a40x_usbclient_resources,
 };
-#endif
 
 #if defined (CONFIG_ARCH_LH7A404)
 
@@ -105,8 +103,7 @@ static struct platform_device lh7a404_usbhost_device = {
 
 static struct platform_device *lpd7a40x_devs[] __initdata = {
        &smc91x_device,
-/*     &lh7a40x_usbclient_device, */
-
+       &lh7a40x_usbclient_device,
 #if defined (CONFIG_ARCH_LH7A404)
        &lh7a404_usbhost_device,
 #endif
@@ -116,7 +113,12 @@ extern void lpd7a400_map_io (void);
 
 static void __init lpd7a40x_init (void)
 {
-       CPLD_CONTROL = 0x0;     /* Enable LAN (Disable LCD) */
+       CPLD_CONTROL |=     (1<<6); /* Mask USB1 connection IRQ */
+       CPLD_CONTROL &= ~(0
+                         | (1<<1) /* Disable LCD */
+                         | (1<<0) /* Enable WLAN */
+               );
+
        platform_add_devices (lpd7a40x_devs, ARRAY_SIZE (lpd7a40x_devs));
 }
 
@@ -155,8 +157,6 @@ static struct irqchip lpd7a40x_cpld_chip = {
        .unmask = lh7a40x_unmask_cpld_irq,
 };
 
-#define IRQ_DISPATCH(irq) irq_desc[irq].handle ((irq), &irq_desc[irq], regs)
-
 static void lpd7a40x_cpld_handler (unsigned int irq, struct irqdesc *desc,
                                  struct pt_regs *regs)
 {
@@ -191,7 +191,7 @@ void __init lh7a40x_init_board_irq (void)
        int pinCPLD = (cpld_version == 0x28) ? 7 : 3;
 
 #if defined CONFIG_MACH_LPD7A404
-       cpld_version = 0x34;    /* Override, for now */
+       cpld_version = 0x34;    /* Coerce LPD7A404 to RevB */
 #endif
 
                /* First, configure user controlled GPIOF interrupts  */
@@ -204,7 +204,7 @@ void __init lh7a40x_init_board_irq (void)
 
                /* Then, configure CPLD interrupt */
 
-       CPLD_INTERRUPTS =   0x0c; /* Disable all CPLD interrupts */
+       CPLD_INTERRUPTS =   0x9c; /* Disable all CPLD interrupts */
        GPIO_PFDD       &= ~(1 << pinCPLD); /* Make input */
        GPIO_INTTYPE1   |=  (1 << pinCPLD); /* Edge triggered */
        GPIO_INTTYPE2   &= ~(1 << pinCPLD); /* Active low */
@@ -227,23 +227,79 @@ void __init lh7a40x_init_board_irq (void)
 }
 
 static struct map_desc lpd7a400_io_desc[] __initdata = {
-       {     IO_VIRT,      IO_PHYS,        IO_SIZE,    MT_DEVICE },
-       /* Mapping added to work around chip select problems */
-       { IOBARRIER_VIRT, IOBARRIER_PHYS, IOBARRIER_SIZE, MT_DEVICE },
-       { CF_VIRT,      CF_PHYS,        CF_SIZE,        MT_DEVICE },
+       {
+               .virtual        =     IO_VIRT,
+               .pfn            = __phys_to_pfn(IO_PHYS),
+               .length         =           IO_SIZE,
+               .type           = MT_DEVICE
+       }, {    /* Mapping added to work around chip select problems */
+               .virtual        = IOBARRIER_VIRT,
+               .pfn            = __phys_to_pfn(IOBARRIER_PHYS),
+               .length         = IOBARRIER_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CF_VIRT,
+               .pfn            = __phys_to_pfn(CF_PHYS),
+               .length         =       CF_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD02_VIRT,
+               .pfn            = __phys_to_pfn(CPLD02_PHYS),
+               .length         =       CPLD02_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD06_VIRT,
+               .pfn            = __phys_to_pfn(CPLD06_PHYS),
+               .length         =       CPLD06_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD08_VIRT,
+               .pfn            = __phys_to_pfn(CPLD08_PHYS),
+               .length         =       CPLD08_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD0C_VIRT,
+               .pfn            = __phys_to_pfn(CPLD0C_PHYS),
+               .length         =       CPLD0C_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD0E_VIRT,
+               .pfn            = __phys_to_pfn(CPLD0E_PHYS),
+               .length         =       CPLD0E_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD10_VIRT,
+               .pfn            = __phys_to_pfn(CPLD10_PHYS),
+               .length         =       CPLD10_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD12_VIRT,
+               .pfn            = __phys_to_pfn(CPLD12_PHYS),
+               .length         =       CPLD12_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD14_VIRT,
+               .pfn            = __phys_to_pfn(CPLD14_PHYS),
+               .length         =       CPLD14_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD16_VIRT,
+               .pfn            = __phys_to_pfn(CPLD16_PHYS),
+               .length         =       CPLD16_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD18_VIRT,
+               .pfn            = __phys_to_pfn(CPLD18_PHYS),
+               .length         =       CPLD18_SIZE,
+               .type           = MT_DEVICE
+       }, {
+               .virtual        = CPLD1A_VIRT,
+               .pfn            = __phys_to_pfn(CPLD1A_PHYS),
+               .length         =       CPLD1A_SIZE,
+               .type           = MT_DEVICE
+       },
        /* This mapping is redundant since the smc driver performs another. */
 /*     { CPLD00_VIRT,  CPLD00_PHYS,    CPLD00_SIZE,    MT_DEVICE }, */
-       { CPLD02_VIRT,  CPLD02_PHYS,    CPLD02_SIZE,    MT_DEVICE },
-       { CPLD06_VIRT,  CPLD06_PHYS,    CPLD06_SIZE,    MT_DEVICE },
-       { CPLD08_VIRT,  CPLD08_PHYS,    CPLD08_SIZE,    MT_DEVICE },
-       { CPLD0C_VIRT,  CPLD0C_PHYS,    CPLD0C_SIZE,    MT_DEVICE },
-       { CPLD0E_VIRT,  CPLD0E_PHYS,    CPLD0E_SIZE,    MT_DEVICE },
-       { CPLD10_VIRT,  CPLD10_PHYS,    CPLD10_SIZE,    MT_DEVICE },
-       { CPLD12_VIRT,  CPLD12_PHYS,    CPLD12_SIZE,    MT_DEVICE },
-       { CPLD14_VIRT,  CPLD14_PHYS,    CPLD14_SIZE,    MT_DEVICE },
-       { CPLD16_VIRT,  CPLD16_PHYS,    CPLD16_SIZE,    MT_DEVICE },
-       { CPLD18_VIRT,  CPLD18_PHYS,    CPLD18_SIZE,    MT_DEVICE },
-       { CPLD1A_VIRT,  CPLD1A_PHYS,    CPLD1A_SIZE,    MT_DEVICE },
 };
 
 void __init
@@ -259,30 +315,30 @@ lpd7a400_map_io(void)
 
 #ifdef CONFIG_MACH_LPD7A400
 
-extern void lh7a400_init_irq (void);
-
 MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10")
-       MAINTAINER ("Marc Singer")
-       BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000))
-       BOOT_PARAMS (0xc0000100)
-       MAPIO (lpd7a400_map_io)
-       INITIRQ (lh7a400_init_irq)
-       INIT_MACHINE (lpd7a40x_init)
+       /* Maintainer: Marc Singer */
+       .phys_io        = 0x80000000,
+       .io_pg_offst    = ((io_p2v (0x80000000))>>18) & 0xfffc,
+       .boot_params    = 0xc0000100,
+       .map_io         = lpd7a400_map_io,
+       .init_irq       = lh7a400_init_irq,
+       .timer          = &lh7a40x_timer,
+       .init_machine   = lpd7a40x_init,
 MACHINE_END
 
 #endif
 
 #ifdef CONFIG_MACH_LPD7A404
 
-extern void lh7a404_init_irq (void);
-
 MACHINE_START (LPD7A404, "Logic Product Development LPD7A404-10")
-       MAINTAINER ("Marc Singer")
-       BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000))
-       BOOT_PARAMS (0xc0000100)
-       MAPIO (lpd7a400_map_io)
-       INITIRQ (lh7a404_init_irq)
-       INIT_MACHINE (lpd7a40x_init)
+       /* Maintainer: Marc Singer */
+       .phys_io        = 0x80000000,
+       .io_pg_offst    = ((io_p2v (0x80000000))>>18) & 0xfffc,
+       .boot_params    = 0xc0000100,
+       .map_io         = lpd7a400_map_io,
+       .init_irq       = lh7a404_init_irq,
+       .timer          = &lh7a40x_timer,
+       .init_machine   = lpd7a40x_init,
 MACHINE_END
 
 #endif