arm/imx2x: removes a bunch of sparse-warnings
[safe/jmp/linux-2.6] / arch / arm / mach-mx2 / pcm038.c
index 91a1e4b..2942d59 100644 (file)
 
 #include <linux/platform_device.h>
 #include <linux/mtd/physmap.h>
+#include <linux/mtd/plat-ram.h>
+#include <linux/io.h>
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 #include <mach/common.h>
 #include <mach/hardware.h>
-#include <mach/iomux-mx1-mx2.h>
+#include <mach/iomux.h>
 #include <asm/mach/time.h>
 #include <mach/imx-uart.h>
 #include <mach/board-pcm038.h>
+#include <mach/mxc_nand.h>
 
 #include "devices.h"
 
 /*
+ * Phytec's PCM038 comes with 2MiB battery buffered SRAM,
+ * 16 bit width
+ */
+
+static struct platdata_mtd_ram pcm038_sram_data = {
+       .bankwidth = 2,
+};
+
+static struct resource pcm038_sram_resource = {
+       .start = CS1_BASE_ADDR,
+       .end   = CS1_BASE_ADDR + 512 * 1024 - 1,
+       .flags = IORESOURCE_MEM,
+};
+
+static struct platform_device pcm038_sram_mtd_device = {
+       .name = "mtd-ram",
+       .id = 0,
+       .dev = {
+               .platform_data = &pcm038_sram_data,
+       },
+       .num_resources = 1,
+       .resource = &pcm038_sram_resource,
+};
+
+/*
  * Phytec's phyCORE-i.MX27 comes with 32MiB flash,
  * 16 bit width
  */
@@ -143,7 +171,7 @@ static int mxc_fec_pins[] = {
        PD11_AOUT_FEC_TX_CLK,
        PD12_AOUT_FEC_RXD0,
        PD13_AOUT_FEC_RX_DV,
-       PD14_AOUT_FEC_CLR,
+       PD14_AOUT_FEC_RX_CLK,
        PD15_AOUT_FEC_COL,
        PD16_AIN_FEC_TX_ER,
        PF23_AIN_FEC_TX_EN
@@ -161,19 +189,37 @@ static void gpio_fec_inactive(void)
                        ARRAY_SIZE(mxc_fec_pins));
 }
 
+static struct mxc_nand_platform_data pcm038_nand_board_info = {
+       .width = 1,
+       .hw_ecc = 1,
+};
+
 static struct platform_device *platform_devices[] __initdata = {
        &pcm038_nor_mtd_device,
        &mxc_w1_master_device,
+       &pcm038_sram_mtd_device,
 };
 
+/* On pcm038 there's a sram attached to CS1, we enable the chipselect here and
+ * setup other stuffs to access the sram. */
+static void __init pcm038_init_sram(void)
+{
+       __raw_writel(0x0000d843, CSCR_U(1));
+       __raw_writel(0x22252521, CSCR_L(1));
+       __raw_writel(0x22220a00, CSCR_A(1));
+}
+
 static void __init pcm038_init(void)
 {
        gpio_fec_active();
+       pcm038_init_sram();
 
        mxc_register_device(&mxc_uart_device0, &uart_pdata[0]);
        mxc_register_device(&mxc_uart_device1, &uart_pdata[1]);
        mxc_register_device(&mxc_uart_device2, &uart_pdata[2]);
-       mxc_gpio_mode(PE16_AF_RTCK); /* OWIRE */
+
+       mxc_gpio_mode(PE16_AF_OWIRE);
+       mxc_register_device(&mxc_nand_device, &pcm038_nand_board_info);
 
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 
@@ -184,11 +230,10 @@ static void __init pcm038_init(void)
 
 static void __init pcm038_timer_init(void)
 {
-       mxc_clocks_init(26000000);
-       mxc_timer_init("gpt_clk.0");
+       mx27_clocks_init(26000000);
 }
 
-struct sys_timer pcm038_timer = {
+static struct sys_timer pcm038_timer = {
        .init = pcm038_timer_init,
 };