Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
[linux-2.6.git] / arch / arm / mach-mx3 / pcm037.c
index d7b29b7..6cbaabe 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/spi/spi.h>
 #include <linux/irq.h>
 #include <linux/fsl_devices.h>
+#include <linux/can/platform/sja1000.h>
 
 #include <media/soc_camera.h>
 
 #include <mach/mxc_nand.h>
 
 #include "devices.h"
+#include "pcm037.h"
+
+static enum pcm037_board_variant pcm037_instance = PCM037_PCM970;
+
+static int __init pcm037_variant_setup(char *str)
+{
+       if (!strcmp("eet", str))
+               pcm037_instance = PCM037_EET;
+       else if (strcmp("pcm970", str))
+               pr_warning("Unknown pcm037 baseboard variant %s\n", str);
+
+       return 1;
+}
+
+/* Supported values: "pcm970" (default) and "eet" */
+__setup("pcm037_variant=", pcm037_variant_setup);
+
+enum pcm037_board_variant pcm037_variant(void)
+{
+       return pcm037_instance;
+}
+
+/* UART1 with RTS/CTS handshake signals */
+static unsigned int pcm037_uart1_handshake_pins[] = {
+       MX31_PIN_CTS1__CTS1,
+       MX31_PIN_RTS1__RTS1,
+       MX31_PIN_TXD1__TXD1,
+       MX31_PIN_RXD1__RXD1,
+};
+
+/* UART1 without RTS/CTS handshake signals */
+static unsigned int pcm037_uart1_pins[] = {
+       MX31_PIN_TXD1__TXD1,
+       MX31_PIN_RXD1__RXD1,
+};
 
 static unsigned int pcm037_pins[] = {
        /* I2C */
@@ -76,11 +112,6 @@ static unsigned int pcm037_pins[] = {
        MX31_PIN_CSPI1_SS0__SS0,
        MX31_PIN_CSPI1_SS1__SS1,
        MX31_PIN_CSPI1_SS2__SS2,
-       /* UART1 */
-       MX31_PIN_CTS1__CTS1,
-       MX31_PIN_RTS1__RTS1,
-       MX31_PIN_TXD1__TXD1,
-       MX31_PIN_RXD1__RXD1,
        /* UART2 */
        MX31_PIN_TXD2__TXD2,
        MX31_PIN_RXD2__RXD2,
@@ -139,6 +170,8 @@ static unsigned int pcm037_pins[] = {
        MX31_PIN_CSI_MCLK__CSI_MCLK,
        MX31_PIN_CSI_PIXCLK__CSI_PIXCLK,
        MX31_PIN_CSI_VSYNC__CSI_VSYNC,
+       /* GPIO */
+       IOMUX_MODE(MX31_PIN_ATA_DMACK, IOMUX_CONFIG_GPIO),
 };
 
 static struct physmap_flash_data pcm037_flash_data = {
@@ -214,12 +247,11 @@ static struct imxuart_platform_data uart_pdata = {
 };
 
 static struct resource smsc911x_resources[] = {
-       [0] = {
+       {
                .start          = CS1_BASE_ADDR + 0x300,
                .end            = CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
                .flags          = IORESOURCE_MEM,
-       },
-       [1] = {
+       }, {
                .start          = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
                .end            = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
                .flags          = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
@@ -309,8 +341,7 @@ static struct i2c_board_info pcm037_i2c_devices[] = {
                I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
                .platform_data = &board_eeprom,
        }, {
-               I2C_BOARD_INFO("rtc-pcf8563", 0x51),
-               .type = "pcf8563",
+               I2C_BOARD_INFO("pcf8563", 0x51),
        }
 };
 
@@ -459,6 +490,22 @@ static const struct fb_videomode fb_modedb[] = {
                .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_OE_ACT_HIGH,
                .vmode          = FB_VMODE_NONINTERLACED,
                .flag           = 0,
+       }, {
+               /* 240x320 @ 60 Hz */
+               .name           = "CMEL-OLED",
+               .refresh        = 60,
+               .xres           = 240,
+               .yres           = 320,
+               .pixclock       = 185925,
+               .left_margin    = 9,
+               .right_margin   = 16,
+               .upper_margin   = 7,
+               .lower_margin   = 9,
+               .hsync_len      = 1,
+               .vsync_len      = 1,
+               .sync           = FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
+               .vmode          = FB_VMODE_NONINTERLACED,
+               .flag           = 0,
        },
 };
 
@@ -469,6 +516,33 @@ static struct mx3fb_platform_data mx3fb_pdata = {
        .num_modes      = ARRAY_SIZE(fb_modedb),
 };
 
+static struct resource pcm970_sja1000_resources[] = {
+       {
+               .start   = CS5_BASE_ADDR,
+               .end     = CS5_BASE_ADDR + 0x100 - 1,
+               .flags   = IORESOURCE_MEM,
+       }, {
+               .start   = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)),
+               .end     = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)),
+               .flags   = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
+       },
+};
+
+struct sja1000_platform_data pcm970_sja1000_platform_data = {
+       .clock          = 16000000 / 2,
+       .ocr            = 0x40 | 0x18,
+       .cdr            = 0x40,
+};
+
+static struct platform_device pcm970_sja1000 = {
+       .name = "sja1000_platform",
+       .dev = {
+               .platform_data = &pcm970_sja1000_platform_data,
+       },
+       .resource = pcm970_sja1000_resources,
+       .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
+};
+
 /*
  * Board specific initialization.
  */
@@ -479,6 +553,14 @@ static void __init mxc_board_init(void)
        mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
                        "pcm037");
 
+       if (pcm037_variant() == PCM037_EET)
+               mxc_iomux_setup_multiple_pins(pcm037_uart1_pins,
+                       ARRAY_SIZE(pcm037_uart1_pins), "pcm037_uart1");
+       else
+               mxc_iomux_setup_multiple_pins(pcm037_uart1_handshake_pins,
+                       ARRAY_SIZE(pcm037_uart1_handshake_pins),
+                       "pcm037_uart1");
+
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
        mxc_register_device(&mxc_uart_device0, &uart_pdata);
@@ -521,6 +603,8 @@ static void __init mxc_board_init(void)
 
        if (!pcm037_camera_alloc_dma(4 * 1024 * 1024))
                mxc_register_device(&mx3_camera, &camera_pdata);
+
+       platform_device_register(&pcm970_sja1000);
 }
 
 static void __init pcm037_timer_init(void)
@@ -538,8 +622,7 @@ MACHINE_START(PCM037, "Phytec Phycore pcm037")
        .io_pg_offst    = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
        .boot_params    = PHYS_OFFSET + 0x100,
        .map_io         = mx31_map_io,
-       .init_irq       = mxc_init_irq,
+       .init_irq       = mx31_init_irq,
        .init_machine   = mxc_board_init,
        .timer          = &pcm037_timer,
 MACHINE_END
-