[ARM] 5085/2: PXA: Move AC97 over to the new central device declaration model
[safe/jmp/linux-2.6] / arch / arm / mach-pxa / lubbock.c
index 157cf47..a3fae41 100644 (file)
@@ -41,6 +41,9 @@
 #include <asm/hardware/sa1111.h>
 
 #include <asm/arch/pxa-regs.h>
+#include <asm/arch/pxa2xx-regs.h>
+#include <asm/arch/mfp-pxa25x.h>
+#include <asm/arch/audio.h>
 #include <asm/arch/lubbock.h>
 #include <asm/arch/udc.h>
 #include <asm/arch/irda.h>
 #include <asm/arch/mmc.h>
 
 #include "generic.h"
+#include "devices.h"
 
+static unsigned long lubbock_pin_config[] __initdata = {
+       GPIO15_nCS_1,   /* CS1 - Flash */
+       GPIO79_nCS_3,   /* CS3 - SMC ethernet */
+
+       /* SSP data pins */
+       GPIO23_SSP1_SCLK,
+       GPIO25_SSP1_TXD,
+       GPIO26_SSP1_RXD,
+
+       /* BTUART */
+       GPIO42_BTUART_RXD,
+       GPIO43_BTUART_TXD,
+       GPIO44_BTUART_CTS,
+       GPIO45_BTUART_RTS,
+
+       /* PC Card */
+       GPIO48_nPOE,
+       GPIO49_nPWE,
+       GPIO50_nPIOR,
+       GPIO51_nPIOW,
+       GPIO52_nPCE_1,
+       GPIO53_nPCE_2,
+       GPIO54_nPSKTSEL,
+       GPIO55_nPREG,
+       GPIO56_nPWAIT,
+       GPIO57_nIOIS16,
+
+       /* MMC */
+       GPIO6_MMC_CLK,
+       GPIO8_MMC_CS0,
+
+       /* wakeup */
+       GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
+};
 
 #define LUB_MISC_WR            __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
 
@@ -85,8 +123,7 @@ static struct irq_chip lubbock_irq_chip = {
        .unmask         = lubbock_unmask_irq,
 };
 
-static void lubbock_irq_handler(unsigned int irq, struct irqdesc *desc,
-                               struct pt_regs *regs)
+static void lubbock_irq_handler(unsigned int irq, struct irq_desc *desc)
 {
        unsigned long pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
        do {
@@ -94,7 +131,7 @@ static void lubbock_irq_handler(unsigned int irq, struct irqdesc *desc,
                if (likely(pending)) {
                        irq = LUBBOCK_IRQ(0) + __ffs(pending);
                        desc = irq_desc + irq;
-                       desc_handle_irq(irq, desc, regs);
+                       desc_handle_irq(irq, desc);
                }
                pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
        } while (pending);
@@ -104,12 +141,12 @@ static void __init lubbock_init_irq(void)
 {
        int irq;
 
-       pxa_init_irq();
+       pxa25x_init_irq();
 
        /* setup extra lubbock irqs */
        for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_LAST_IRQ; irq++) {
                set_irq_chip(irq, &lubbock_irq_chip);
-               set_irq_handler(irq, do_level_IRQ);
+               set_irq_handler(irq, handle_level_irq);
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }
 
@@ -126,7 +163,7 @@ static int lubbock_irq_resume(struct sys_device *dev)
 }
 
 static struct sysdev_class lubbock_irq_sysclass = {
-       set_kset_name("cpld_irq"),
+       .name = "cpld_irq",
        .resume = lubbock_irq_resume,
 };
 
@@ -136,9 +173,13 @@ static struct sys_device lubbock_irq_device = {
 
 static int __init lubbock_irq_device_init(void)
 {
-       int ret = sysdev_class_register(&lubbock_irq_sysclass);
-       if (ret == 0)
-               ret = sysdev_register(&lubbock_irq_device);
+       int ret = -ENODEV;
+
+       if (machine_is_lubbock()) {
+               ret = sysdev_class_register(&lubbock_irq_sysclass);
+               if (ret == 0)
+                       ret = sysdev_register(&lubbock_irq_device);
+       }
        return ret;
 }
 
@@ -156,11 +197,6 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
        // no D+ pullup; lubbock can't connect/disconnect in software
 };
 
-static struct platform_device lub_audio_device = {
-       .name           = "pxa2xx-ac97",
-       .id             = -1,
-};
-
 static struct resource sa1111_resources[] = {
        [0] = {
                .start  = 0x10000000,
@@ -181,55 +217,18 @@ static struct platform_device sa1111_device = {
        .resource       = sa1111_resources,
 };
 
-static struct resource smc91x_resources[] = {
-       [0] = {
-               .name   = "smc91x-regs",
-               .start  = 0x0c000c00,
-               .end    = 0x0c0fffff,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = LUBBOCK_ETH_IRQ,
-               .end    = LUBBOCK_ETH_IRQ,
-               .flags  = IORESOURCE_IRQ,
-       },
-       [2] = {
-               .name   = "smc91x-attrib",
-               .start  = 0x0e000000,
-               .end    = 0x0e0fffff,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
 /* ADS7846 is connected through SSP ... and if your board has J5 populated,
  * you can select it to replace the ucb1400 by switching the touchscreen cable
  * (to J5) and poking board registers (as done below).  Else it's only useful
  * for the temperature sensors.
  */
-static struct resource pxa_ssp_resources[] = {
-       [0] = {
-               .start  = __PREG(SSCR0_P(1)),
-               .end    = __PREG(SSCR0_P(1)) + 0x14,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = IRQ_SSP,
-               .end    = IRQ_SSP,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
 static struct pxa2xx_spi_master pxa_ssp_master_info = {
-       .ssp_type       = PXA25x_SSP,
-       .clock_enable   = CKEN3_SSP,
        .num_chipselect = 0,
 };
 
 static struct platform_device pxa_ssp = {
        .name           = "pxa2xx-spi",
        .id             = 1,
-       .resource       = pxa_ssp_resources,
-       .num_resources  = ARRAY_SIZE(pxa_ssp_resources),
        .dev = {
                .platform_data  = &pxa_ssp_master_info,
        },
@@ -273,6 +272,26 @@ static struct spi_board_info spi_board_info[] __initdata = { {
 },
 };
 
+static struct resource smc91x_resources[] = {
+       [0] = {
+               .name   = "smc91x-regs",
+               .start  = 0x0c000c00,
+               .end    = 0x0c0fffff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = LUBBOCK_ETH_IRQ,
+               .end    = LUBBOCK_ETH_IRQ,
+               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
+       },
+       [2] = {
+               .name   = "smc91x-attrib",
+               .start  = 0x0e000000,
+               .end    = 0x0e0fffff,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
 static struct platform_device smc91x_device = {
        .name           = "smc91x",
        .id             = -1,
@@ -345,7 +364,6 @@ static struct platform_device lubbock_flash_device[2] = {
 
 static struct platform_device *devices[] __initdata = {
        &sa1111_device,
-       &lub_audio_device,
        &smc91x_device,
        &lubbock_flash_device[0],
        &lubbock_flash_device[1],
@@ -372,14 +390,14 @@ static struct pxafb_mach_info sharp_lm8v31 = {
        .num_modes      = 1,
        .cmap_inverse   = 0,
        .cmap_static    = 0,
-       .lccr0          = LCCR0_SDS,
-       .lccr3          = LCCR3_PCP | LCCR3_Acb(255),
+       .lcd_conn       = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL |
+                         LCD_AC_BIAS_FREQ(255),
 };
 
 #define        MMC_POLL_RATE           msecs_to_jiffies(1000)
 
 static void lubbock_mmc_poll(unsigned long);
-static irqreturn_t (*mmc_detect_int)(int, void *, struct pt_regs *);
+static irq_handler_t mmc_detect_int;
 
 static struct timer_list mmc_timer = {
        .function       = lubbock_mmc_poll,
@@ -398,28 +416,24 @@ static void lubbock_mmc_poll(unsigned long data)
        if (LUB_IRQ_SET_CLR & (1 << 0))
                mod_timer(&mmc_timer, jiffies + MMC_POLL_RATE);
        else {
-               (void) mmc_detect_int(LUBBOCK_SD_IRQ, (void *)data, NULL);
+               (void) mmc_detect_int(LUBBOCK_SD_IRQ, (void *)data);
                enable_irq(LUBBOCK_SD_IRQ);
        }
 }
 
-static irqreturn_t lubbock_detect_int(int irq, void *data, struct pt_regs *regs)
+static irqreturn_t lubbock_detect_int(int irq, void *data)
 {
        /* IRQ is level triggered; disable, and poll for removal */
        disable_irq(irq);
        mod_timer(&mmc_timer, jiffies + MMC_POLL_RATE);
 
-       return mmc_detect_int(irq, data, regs);
+       return mmc_detect_int(irq, data);
 }
 
 static int lubbock_mci_init(struct device *dev,
-               irqreturn_t (*detect_int)(int, void *, struct pt_regs *),
+               irq_handler_t detect_int,
                void *data)
 {
-       /* setup GPIO for PXA25x MMC controller */
-       pxa_gpio_mode(GPIO6_MMCCLK_MD);
-       pxa_gpio_mode(GPIO8_MMCCS0_MD);
-
        /* detect card insert/eject */
        mmc_detect_int = detect_int;
        init_timer(&mmc_timer);
@@ -469,10 +483,13 @@ static void __init lubbock_init(void)
 {
        int flashboot = (LUB_CONF_SWITCHES & 1);
 
+       pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config));
+
        pxa_set_udc_info(&udc_info);
        set_pxa_fb_info(&sharp_lm8v31);
        pxa_set_mci_info(&lubbock_mci_platform_data);
        pxa_set_ficp_info(&lubbock_ficp_platform_data);
+       pxa_set_ac97_info(NULL);
 
        lubbock_flash_data[0].width = lubbock_flash_data[1].width =
                (BOOT_DEF & 1) ? 2 : 4;
@@ -501,27 +518,6 @@ static void __init lubbock_map_io(void)
        pxa_map_io();
        iotable_init(lubbock_io_desc, ARRAY_SIZE(lubbock_io_desc));
 
-       /* SSP data pins */
-       pxa_gpio_mode(GPIO23_SCLK_MD);
-       pxa_gpio_mode(GPIO25_STXD_MD);
-       pxa_gpio_mode(GPIO26_SRXD_MD);
-
-       /* This enables the BTUART */
-       pxa_gpio_mode(GPIO42_BTRXD_MD);
-       pxa_gpio_mode(GPIO43_BTTXD_MD);
-       pxa_gpio_mode(GPIO44_BTCTS_MD);
-       pxa_gpio_mode(GPIO45_BTRTS_MD);
-
-       /* This is for the SMC chip select */
-       pxa_gpio_mode(GPIO79_nCS_3_MD);
-
-       /* setup sleep mode values */
-       PWER  = 0x00000002;
-       PFER  = 0x00000000;
-       PRER  = 0x00000002;
-       PGSR0 = 0x00008000;
-       PGSR1 = 0x003F0202;
-       PGSR2 = 0x0001C000;
        PCFR |= PCFR_OPDE;
 }