pcm037: use of new iomux implementation
[pandora-kernel.git] / arch / arm / mach-mx3 / pcm037.c
index 843f68c..18cda92 100644 (file)
 
 #include <linux/platform_device.h>
 #include <linux/mtd/physmap.h>
+#include <linux/mtd/plat-ram.h>
 #include <linux/memory.h>
+#include <linux/gpio.h>
+#include <linux/smc911x.h>
+#include <linux/interrupt.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -32,6 +36,7 @@
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
 #include <mach/board-pcm037.h>
+#include <mach/mxc_nand.h>
 
 #include "devices.h"
 
@@ -59,8 +64,75 @@ static struct imxuart_platform_data uart_pdata = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
+static struct resource smc911x_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,
+       },
+};
+
+static struct smc911x_platdata smc911x_info = {
+       .flags          = SMC911X_USE_32BIT,
+       .irq_flags      = IRQF_SHARED | IRQF_TRIGGER_LOW,
+};
+
+static struct platform_device pcm037_eth = {
+       .name           = "smc911x",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(smc911x_resources),
+       .resource       = smc911x_resources,
+       .dev            = {
+               .platform_data = &smc911x_info,
+       },
+};
+
+static struct platdata_mtd_ram pcm038_sram_data = {
+       .bankwidth = 2,
+};
+
+static struct resource pcm038_sram_resource = {
+       .start = CS4_BASE_ADDR,
+       .end   = CS4_BASE_ADDR + 512 * 1024 - 1,
+       .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device pcm037_sram_device = {
+       .name = "mtd-ram",
+       .id = 0,
+       .dev = {
+               .platform_data = &pcm038_sram_data,
+       },
+       .num_resources = 1,
+       .resource = &pcm038_sram_resource,
+};
+
+static struct mxc_nand_platform_data pcm037_nand_board_info = {
+       .width = 1,
+       .hw_ecc = 1,
+};
+
 static struct platform_device *devices[] __initdata = {
        &pcm037_flash,
+       &pcm037_eth,
+       &pcm037_sram_device,
+};
+
+static int uart0_pins[] = {
+       MX31_PIN_CTS1__CTS1,
+       MX31_PIN_RTS1__RTS1,
+       MX31_PIN_TXD1__TXD1,
+       MX31_PIN_RXD1__RXD1
+};
+
+static int uart2_pins[] = {
+       MX31_PIN_CSPI3_MOSI__RXD3,
+       MX31_PIN_CSPI3_MISO__TXD3
 };
 
 /*
@@ -70,17 +142,21 @@ static void __init mxc_board_init(void)
 {
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
-       mxc_iomux_mode(MX31_PIN_CTS1__CTS1);
-       mxc_iomux_mode(MX31_PIN_RTS1__RTS1);
-       mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
-       mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
-
+       mxc_iomux_setup_multiple_pins(uart0_pins, ARRAY_SIZE(uart0_pins), "uart-0");
        mxc_register_device(&mxc_uart_device0, &uart_pdata);
 
-       mxc_iomux_mode(MX31_PIN_CSPI3_MOSI__RXD3);
-       mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3);
-
+       mxc_iomux_setup_multiple_pins(uart2_pins, ARRAY_SIZE(uart2_pins), "uart-2");
        mxc_register_device(&mxc_uart_device2, &uart_pdata);
+
+       mxc_iomux_setup_pin(MX31_PIN_BATT_LINE__OWIRE, "batt-0wire");
+       mxc_register_device(&mxc_w1_master_device, NULL);
+
+       /* SMSC9215 IRQ pin */
+       if (!mxc_iomux_setup_pin(IOMUX_MODE(MX31_PIN_GPIO3_1, IOMUX_CONFIG_GPIO),
+                               "pcm037-eth"))
+               gpio_direction_input(MX31_PIN_GPIO3_1);
+
+       mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info);
 }
 
 /*
@@ -111,8 +187,7 @@ void __init pcm037_map_io(void)
 
 static void __init pcm037_timer_init(void)
 {
-       mxc_clocks_init(26000000);
-       mxc_timer_init("ipg_clk.0");
+       mx31_clocks_init(26000000);
 }
 
 struct sys_timer pcm037_timer = {