ramips: ramips_esw: move hardware initialization into a separate function
authorGabor Juhos <juhosg@openwrt.org>
Wed, 8 Dec 2010 10:14:58 +0000 (10:14 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Wed, 8 Dec 2010 10:14:58 +0000 (10:14 +0000)
SVN-Revision: 24330

target/linux/ramips/files/drivers/net/ramips_esw.c

index e4c8ea3dbf2bd3ce503ae57df16521d5bf601ae4..e8041b48dfde08d4c38f3e62186811346add78ca 100644 (file)
@@ -75,17 +75,11 @@ out:
        return ret;
 }
 
        return ret;
 }
 
-static int
-rt305x_esw_init(void)
+static void
+rt305x_esw_hw_init(struct rt305x_esw *esw)
 {
 {
-       struct rt305x_esw *esw;
        int i;
 
        int i;
 
-       esw = &rt305x_esw;
-       esw->base = ioremap_nocache(RT305X_SWITCH_BASE, PAGE_SIZE);
-       if(!esw->base)
-               return -ENOMEM;
-
        /* vodoo from original driver */
        ramips_esw_wr(esw, 0xC8A07850, 0x08);
        ramips_esw_wr(esw, 0x00000000, 0xe4);
        /* vodoo from original driver */
        ramips_esw_wr(esw, 0xC8A07850, 0x08);
        ramips_esw_wr(esw, 0x00000000, 0xe4);
@@ -124,6 +118,18 @@ rt305x_esw_init(void)
        /* set default vlan */
        ramips_esw_wr(esw, 0x2001, 0x50);
        ramips_esw_wr(esw, 0x504f, 0x70);
        /* set default vlan */
        ramips_esw_wr(esw, 0x2001, 0x50);
        ramips_esw_wr(esw, 0x504f, 0x70);
+}
+
+static int
+rt305x_esw_init(void)
+{
+       struct rt305x_esw *esw;
+
+       esw = &rt305x_esw;
+       esw->base = ioremap_nocache(RT305X_SWITCH_BASE, PAGE_SIZE);
+       if(!esw->base)
+               return -ENOMEM;
 
 
+       rt305x_esw_hw_init(esw);
        return 0;
 }
        return 0;
 }