[adm5120] fix flash driver, it should work on RB150 as well
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / boards / mikrotik.c
index 64c32c6230cc99f26243d3de08939300bb398b30..855ec3afb1ccba7cf5cc5630c87402dff1d1d87b 100644 (file)
@@ -42,6 +42,7 @@
 #include <adm5120_nand.h>
 #include <adm5120_board.h>
 #include <adm5120_platform.h>
+#include <adm5120_cf.h>
 
 #define RB1XX_NAND_CHIP_DELAY  25
 
@@ -139,6 +140,7 @@ static unsigned char rb133c_vlans[6] __initdata = {
 static unsigned char rb15x_vlans[6] __initdata = {
        /* FIXME: untested */
        0x41, 0x42, 0x44, 0x48, 0x50, 0x00
+};
 
 static unsigned char rb192_vlans[6] __initdata = {
        /* FIXME: untested */
@@ -178,6 +180,37 @@ static void rb150_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
 }
 
 /*--------------------------------------------------------------------------*/
+static struct resource cf_slot0_res[] = {
+        {
+                .name = "cf_membase",
+               .start = ADM5120_EXTIO0_BASE, 
+               .end = ADM5120_EXTIO0_BASE + ADM5120_MPMC_SIZE-1 ,
+                .flags = IORESOURCE_MEM
+        }, {
+                .name = "cf_irq",
+                .start = ADM5120_IRQ_GPIO4, /* 5 */
+                .end = ADM5120_IRQ_GPIO4,
+                .flags = IORESOURCE_IRQ
+        }
+};
+
+static struct cf_device cf_slot0_data = {
+        .gpio_pin = 4
+};
+
+static struct platform_device cf_slot0 = {
+        .id = 0,
+        .name = "rb153-cf",
+        .dev.platform_data = &cf_slot0_data,
+        .resource = cf_slot0_res,
+        .num_resources = ARRAY_SIZE(cf_slot0_res),
+};
+
+static struct platform_device *rb153_devices[] __initdata = {
+        &adm5120_flash0_device,
+        &adm5120_nand_device,
+       &cf_slot0,
+};
 
 static void __init rb1xx_mac_setup(void)
 {
@@ -229,6 +262,8 @@ static void __init rb150_setup(void)
        adm5120_nand_data.ctrl.cmd_ctrl = rb150_nand_cmd_ctrl;
        adm5120_nand_data.ctrl.dev_ready = rb150_nand_ready;
 
+       adm5120_flash0_data.window_size = 512*1024;
+
        rb1xx_flash_setup();
        rb1xx_mac_setup();
 }
@@ -299,8 +334,8 @@ static struct adm5120_board rb153_board __initdata = {
        .board_setup    = rb1xx_setup,
        .eth_num_ports  = 5,
        .eth_vlans      = rb15x_vlans,
-       .num_devices    = ARRAY_SIZE(rb1xx_devices),
-       .devices        = rb1xx_devices,
+       .num_devices    = ARRAY_SIZE(rb153_devices),
+       .devices        = rb153_devices,
        .pci_nr_irqs    = ARRAY_SIZE(rb1xx_pci_irqs),
        .pci_irq_map    = rb1xx_pci_irqs,
 };