[adm5120] license cleanup
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / files / arch / mips / adm5120 / boards / mikrotik.c
index 1ca151412b7677ddef96eb70a0e12690661bc63d..48ea92f22be8fd5784f29555ea54c06be7f17d4c 100644 (file)
  *    Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
  *    The original Mikrotik code seems not to have a license.
  *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  as published by the Free Software Foundation; either version 2
- *  of the License, or (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the
- *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- *  Boston, MA  02110-1301, USA.
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
  *
  */
 
@@ -42,8 +31,8 @@
 #include <adm5120_nand.h>
 #include <adm5120_board.h>
 #include <adm5120_platform.h>
-#include <adm5120_cf.h>
 #include <adm5120_info.h>
+
 #include <prom/routerboot.h>
 
 #define RB1XX_NAND_CHIP_DELAY  25
 #define RB150_NAND_WRITE(v) \
        writeb((v), (void __iomem *)KSEG1ADDR(RB150_NAND_BASE))
 
-#define RB153_GPIO_CF_RDY      ADM5120_GPIO_P1L1
-#define RB153_GPIO_CF_WT       ADM5120_GPIO_P0L0
-
-extern struct rb_hard_settings rb_hs;
-
 /*--------------------------------------------------------------------------*/
 
 static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
@@ -127,8 +111,8 @@ static struct resource rb150_nand_resource[] = {
 static struct resource rb153_cf_resources[] = {
        {
                .name   = "cf_membase",
-               .start  = ADM5120_EXTIO0_BASE,
-               .end    = ADM5120_EXTIO0_BASE + ADM5120_MPMC_SIZE-1 ,
+               .start  = ADM5120_EXTIO1_BASE,
+               .end    = ADM5120_EXTIO1_BASE + ADM5120_EXTIO1_SIZE-1 ,
                .flags  = IORESOURCE_MEM
        }, {
                .name   = "cf_irq",
@@ -138,16 +122,11 @@ static struct resource rb153_cf_resources[] = {
        }
 };
 
-static struct cf_device rb153_cf_data = {
-       .gpio_pin = ADM5120_GPIO_PIN4
-};
-
 static struct platform_device rb153_cf_device = {
-       .name           = "rb153-cf",
+       .name           = "pata-rb153-cf",
        .id             = -1,
        .resource       = rb153_cf_resources,
        .num_resources  = ARRAY_SIZE(rb153_cf_resources),
-       .dev.platform_data = &rb153_cf_data,
 };
 
 static struct platform_device *rb153_devices[] __initdata = {
@@ -223,10 +202,14 @@ static void rb150_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
 static void __init rb1xx_mac_setup(void)
 {
        int i, j;
-       
-       for (i = 0; i < rb_hs.mac_count; i++) {
-               for (j = 0; j < RB_MAC_SIZE; j++)
-                       adm5120_eth_macs[i][j] = rb_hs.macs[i][j];
+
+       if (!rb_hs.mac_base)
+               return;
+
+       for (i = 0; i < 6; i++) {
+               for (j = 0; j < 5; j++)
+                       adm5120_eth_macs[i][j] = rb_hs.mac_base[j];
+               adm5120_eth_macs[i][5] = rb_hs.mac_base[5]+i;
        }
 }
 
@@ -245,15 +228,6 @@ static void __init rb1xx_flash_setup(void)
        adm5120_nand_data.chip.options = NAND_NO_AUTOINCR;
 }
 
-static void __init rb153_cf_setup(void)
-{
-       gpio_request(RB153_GPIO_CF_RDY, "cf-ready");
-       gpio_direction_input(RB153_GPIO_CF_RDY);
-       gpio_request(RB153_GPIO_CF_WT, "cf-wait");
-       gpio_direction_output(RB153_GPIO_CF_WT, 1);
-       gpio_direction_input(RB153_GPIO_CF_WT);
-}
-
 static void __init rb1xx_setup(void)
 {
        /* enable NAND flash interface */
@@ -292,7 +266,11 @@ static void __init rb150_setup(void)
 
 static void __init rb153_setup(void)
 {
-       rb153_cf_setup();
+       /* enable CSX1:INTX1 on GPIO[3:4] for the CF slot */
+       adm5120_gpio_csx1_enable();
+       /* enable the wait state pin GPIO[0] for external I/O control */
+       adm5120_gpio_ew_enable();
+
        rb1xx_setup();
 }