[ARM] pxa: introduce plat-pxa for PXA common code and add DMA support
[safe/jmp/linux-2.6] / arch / arm / mach-pxa / lubbock.c
index a9e3206..f04c833 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/smc91x.h>
 
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
-#include <asm/arch/pxa2xx_spi.h>
+#include <mach/pxa2xx_spi.h>
 
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
-#include <asm/hardware.h>
+#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/sizes.h>
 
 
 #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/lubbock.h>
-#include <asm/arch/udc.h>
-#include <asm/arch/irda.h>
-#include <asm/arch/pxafb.h>
-#include <asm/arch/mmc.h>
+#include <mach/pxa25x.h>
+#include <mach/gpio.h>
+#include <mach/audio.h>
+#include <mach/lubbock.h>
+#include <mach/udc.h>
+#include <mach/irda.h>
+#include <mach/pxafb.h>
+#include <mach/mmc.h>
+#include <mach/pm.h>
 
 #include "generic.h"
+#include "clock.h"
 #include "devices.h"
 
 static unsigned long lubbock_pin_config[] __initdata = {
        GPIO15_nCS_1,   /* CS1 - Flash */
+       GPIO78_nCS_2,   /* CS2 - Baseboard FGPA */
        GPIO79_nCS_3,   /* CS3 - SMC ethernet */
+       GPIO80_nCS_4,   /* CS4 - SA1111 */
 
        /* SSP data pins */
        GPIO23_SSP1_SCLK,
        GPIO25_SSP1_TXD,
        GPIO26_SSP1_RXD,
 
+       /* LCD - 16bpp DSTN */
+       GPIO58_LCD_LDD_0,
+       GPIO59_LCD_LDD_1,
+       GPIO60_LCD_LDD_2,
+       GPIO61_LCD_LDD_3,
+       GPIO62_LCD_LDD_4,
+       GPIO63_LCD_LDD_5,
+       GPIO64_LCD_LDD_6,
+       GPIO65_LCD_LDD_7,
+       GPIO66_LCD_LDD_8,
+       GPIO67_LCD_LDD_9,
+       GPIO68_LCD_LDD_10,
+       GPIO69_LCD_LDD_11,
+       GPIO70_LCD_LDD_12,
+       GPIO71_LCD_LDD_13,
+       GPIO72_LCD_LDD_14,
+       GPIO73_LCD_LDD_15,
+       GPIO74_LCD_FCLK,
+       GPIO75_LCD_LCLK,
+       GPIO76_LCD_PCLK,
+
        /* BTUART */
        GPIO42_BTUART_RXD,
        GPIO43_BTUART_TXD,
@@ -87,8 +113,14 @@ static unsigned long lubbock_pin_config[] __initdata = {
        GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
 };
 
+#define LUB_HEXLED             __LUB_REG(LUBBOCK_FPGA_PHYS + 0x010)
 #define LUB_MISC_WR            __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
 
+void lubbock_set_hexled(uint32_t value)
+{
+       LUB_HEXLED = value;
+}
+
 void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
 {
        unsigned long flags;
@@ -129,8 +161,7 @@ static void lubbock_irq_handler(unsigned int irq, struct irq_desc *desc)
                GEDR(0) = GPIO_bit(0);  /* clear our parent irq */
                if (likely(pending)) {
                        irq = LUBBOCK_IRQ(0) + __ffs(pending);
-                       desc = irq_desc + irq;
-                       desc_handle_irq(irq, desc);
+                       generic_handle_irq(irq);
                }
                pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
        } while (pending);
@@ -150,7 +181,7 @@ static void __init lubbock_init_irq(void)
        }
 
        set_irq_chained_handler(IRQ_GPIO(0), lubbock_irq_handler);
-       set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
+       set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING);
 }
 
 #ifdef CONFIG_PM
@@ -196,11 +227,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,
@@ -221,41 +247,13 @@ 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 | IORESOURCE_IRQ_HIGHEDGE,
-       },
-       [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 pxa2xx_spi_master pxa_ssp_master_info = {
-       .num_chipselect = 0,
-};
-
-static struct platform_device pxa_ssp = {
-       .name           = "pxa2xx-spi",
-       .id             = 1,
-       .dev = {
-               .platform_data  = &pxa_ssp_master_info,
-       },
+       .num_chipselect = 1,
 };
 
 static int lubbock_ads7846_pendown_state(void)
@@ -296,11 +294,38 @@ 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 smc91x_platdata lubbock_smc91x_info = {
+       .flags  = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_IO_SHIFT_2,
+};
+
 static struct platform_device smc91x_device = {
        .name           = "smc91x",
        .id             = -1,
        .num_resources  = ARRAY_SIZE(smc91x_resources),
        .resource       = smc91x_resources,
+       .dev            = {
+               .platform_data = &lubbock_smc91x_info,
+       },
 };
 
 static struct resource flash_resources[] = {
@@ -368,11 +393,9 @@ 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],
-       &pxa_ssp,
 };
 
 static struct pxafb_mode_info sharp_lm8v31_mode = {
@@ -395,8 +418,8 @@ 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)
@@ -476,6 +499,7 @@ static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
        } else if (mode & IR_FIRMODE) {
                LUB_MISC_WR |= 1 << 4;
        }
+       pxa2xx_transceiver_mode(dev, mode);
        local_irq_restore(flags);
 }
 
@@ -490,10 +514,12 @@ static void __init lubbock_init(void)
 
        pxa2xx_mfp_config(ARRAY_AND_SIZE(lubbock_pin_config));
 
+       clk_add_alias("SA1111_CLK", NULL, "GPIO11_CLK", NULL);
        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;
@@ -505,6 +531,7 @@ static void __init lubbock_init(void)
        lubbock_flash_data[flashboot].name = "boot-rom";
        (void) platform_add_devices(devices, ARRAY_SIZE(devices));
 
+       pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
        spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
 }