- patches.suse/slab-handle-memoryless-nodes-v2a.patch: Refresh.
[linux-flexiantxendom0-3.2.10.git] / arch / arm / mach-omap1 / board-perseus2.c
index 8340669..1387a4f 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/input.h>
+#include <linux/smc91x.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/flash.h>
 #include <asm/mach/map.h>
 
-#include <mach/tc.h>
+#include <plat/tc.h>
 #include <mach/gpio.h>
-#include <mach/mux.h>
-#include <mach/fpga.h>
-#include <mach/nand.h>
-#include <mach/keypad.h>
-#include <mach/common.h>
-#include <mach/board.h>
+#include <plat/mux.h>
+#include <plat/fpga.h>
+#include <plat/keypad.h>
+#include <plat/common.h>
+#include <plat/board.h>
 
 static int p2_keymap[] = {
        KEY(0,0,KEY_UP),
@@ -67,6 +67,12 @@ static int p2_keymap[] = {
        0
 };
 
+static struct smc91x_platdata smc91x_info = {
+       .flags  = SMC91X_USE_16BIT | SMC91X_NOWAIT,
+       .leda   = RPC_LED_100_10,
+       .ledb   = RPC_LED_TX_RX,
+};
+
 static struct resource smc91x_resources[] = {
        [0] = {
                .start  = H2P2_DBG_FPGA_ETHR_START,     /* Physical */
@@ -74,7 +80,7 @@ static struct resource smc91x_resources[] = {
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .start  = INT_730_MPU_EXT_NIRQ,
+               .start  = INT_7XX_MPU_EXT_NIRQ,
                .end    = 0,
                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
@@ -134,8 +140,40 @@ static struct platform_device nor_device = {
        .resource       = &nor_resource,
 };
 
-static struct omap_nand_platform_data nand_data = {
-       .options        = NAND_SAMSUNG_LP_OPTIONS,
+static void nand_cmd_ctl(struct mtd_info *mtd, int cmd,        unsigned int ctrl)
+{
+       struct nand_chip *this = mtd->priv;
+       unsigned long mask;
+
+       if (cmd == NAND_CMD_NONE)
+               return;
+
+       mask = (ctrl & NAND_CLE) ? 0x02 : 0;
+       if (ctrl & NAND_ALE)
+               mask |= 0x04;
+       writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
+}
+
+#define P2_NAND_RB_GPIO_PIN    62
+
+static int nand_dev_ready(struct mtd_info *mtd)
+{
+       return gpio_get_value(P2_NAND_RB_GPIO_PIN);
+}
+
+static const char *part_probes[] = { "cmdlinepart", NULL };
+
+static struct platform_nand_data nand_data = {
+       .chip   = {
+               .nr_chips               = 1,
+               .chip_offset            = 0,
+               .options                = NAND_SAMSUNG_LP_OPTIONS,
+               .part_probe_types       = part_probes,
+       },
+       .ctrl   = {
+               .cmd_ctrl       = nand_cmd_ctl,
+               .dev_ready      = nand_dev_ready,
+       },
 };
 
 static struct resource nand_resource = {
@@ -145,7 +183,7 @@ static struct resource nand_resource = {
 };
 
 static struct platform_device nand_device = {
-       .name           = "omapnand",
+       .name           = "gen_nand",
        .id             = 0,
        .dev            = {
                .platform_data  = &nand_data,
@@ -157,14 +195,17 @@ static struct platform_device nand_device = {
 static struct platform_device smc91x_device = {
        .name           = "smc91x",
        .id             = 0,
+       .dev    = {
+               .platform_data  = &smc91x_info,
+       },
        .num_resources  = ARRAY_SIZE(smc91x_resources),
        .resource       = smc91x_resources,
 };
 
 static struct resource kp_resources[] = {
        [0] = {
-               .start  = INT_730_MPUIO_KEYPAD,
-               .end    = INT_730_MPUIO_KEYPAD,
+               .start  = INT_7XX_MPUIO_KEYPAD,
+               .end    = INT_7XX_MPUIO_KEYPAD,
                .flags  = IORESOURCE_IRQ,
        },
 };
@@ -201,13 +242,6 @@ static struct platform_device *devices[] __initdata = {
        &lcd_device,
 };
 
-#define P2_NAND_RB_GPIO_PIN    62
-
-static int nand_dev_ready(struct omap_nand_platform_data *data)
-{
-       return gpio_get_value(P2_NAND_RB_GPIO_PIN);
-}
-
 static struct omap_lcd_config perseus2_lcd_config __initdata = {
        .ctrl_name      = "internal",
 };
@@ -220,7 +254,7 @@ static void __init omap_perseus2_init(void)
 {
        if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
                BUG();
-       nand_data.dev_ready = nand_dev_ready;
+       gpio_direction_input(P2_NAND_RB_GPIO_PIN);
 
        omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
        omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
@@ -270,7 +304,7 @@ static void __init omap_perseus2_map_io(void)
        /*
         * Hold GSM Reset until needed
         */
-       omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
+       omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
 
        /*
         * UARTs -> done automagically by 8250 driver
@@ -281,21 +315,21 @@ static void __init omap_perseus2_map_io(void)
         */
 
        /* Flash: CS0 timings setup */
-       omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
-       omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
+       omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
+       omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
 
        /*
         * Ethernet support through the debug board
         * CS1 timings setup
         */
-       omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
-       omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
+       omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
+       omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
 
        /*
         * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
         * It is used as the Ethernet controller interrupt
         */
-       omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
+       omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
 }
 
 MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")