]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
arm: mvebu: Change network init code to allow a more flexible setup
authorStefan Roese <sr@denx.de>
Sat, 25 Apr 2015 04:29:52 +0000 (06:29 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:37:12 +0000 (22:37 +0200)
With the introduction of the Armada 38x support, its necessary to change
the mvneta ethernet driver init call from always 4 times to a
configurable value. Lets make this init call more flexible by moving
the actually used devices to the config header.

Additionally this patch takes care of the slightly different base
addresses for the ethernet controllers on A38x.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Tested-by: Dirk Eibach <dirk.eibach@gdsys.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
arch/arm/mach-mvebu/cpu.c
board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c
include/configs/db-mv784mp-gp.h
include/configs/maxbcm.h

index eca5e2176cdefe351f0be99b577fc8aba796fb1f..8058fadb22baa1cb52f2744ba63b4d91615078df 100644 (file)
@@ -216,10 +216,22 @@ int arch_misc_init(void)
 #ifdef CONFIG_MVNETA
 int cpu_eth_init(bd_t *bis)
 {
-       mvneta_initialize(bis, MVEBU_EGIGA0_BASE, 0, CONFIG_PHY_BASE_ADDR + 0);
-       mvneta_initialize(bis, MVEBU_EGIGA1_BASE, 1, CONFIG_PHY_BASE_ADDR + 1);
-       mvneta_initialize(bis, MVEBU_EGIGA2_BASE, 2, CONFIG_PHY_BASE_ADDR + 2);
-       mvneta_initialize(bis, MVEBU_EGIGA3_BASE, 3, CONFIG_PHY_BASE_ADDR + 3);
+       u32 enet_base[] = { MVEBU_EGIGA0_BASE, MVEBU_EGIGA1_BASE,
+                           MVEBU_EGIGA2_BASE, MVEBU_EGIGA3_BASE };
+       u8 phy_addr[] = CONFIG_PHY_ADDR;
+       int i;
+
+       /*
+        * Only Armada XP supports all 4 ethernet interfaces. A38x has
+        * slightly different base addresses for its 2-3 interfaces.
+        */
+       if (mvebu_soc_family() != MVEBU_SOC_AXP) {
+               enet_base[1] = MVEBU_EGIGA2_BASE;
+               enet_base[2] = MVEBU_EGIGA3_BASE;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(phy_addr); i++)
+               mvneta_initialize(bis, enet_base[i], i, phy_addr[i]);
 
        return 0;
 }
index b3dae8910d49ae124045f0f6d17537da42b910e2..00ca878873d92a807a92a5af7778119eb80609c5 100644 (file)
@@ -86,7 +86,8 @@ int checkboard(void)
 /* Configure and enable MV88E1545 PHY */
 void reset_phy(void)
 {
-       u16 devadr = CONFIG_PHY_BASE_ADDR;
+       u8 phy_addr[] = CONFIG_PHY_ADDR;
+       u16 devadr = phy_addr[0];
        char *name = "neta0";
        u16 reg;
 
index 897f473f0c3d1ca42d2180b510f393de3cc03133..77d34080fd880d8884e3ee92c64825b854ff9e05 100644 (file)
@@ -53,7 +53,7 @@
 #define CONFIG_ENV_SECT_SIZE           (64 << 10) /* 64KiB sectors */
 
 #define CONFIG_PHY_MARVELL             /* there is a marvell phy */
-#define CONFIG_PHY_BASE_ADDR   0x10
+#define CONFIG_PHY_ADDR                        { 0x10, 0x11, 0x12, 0x13 }
 #define CONFIG_SYS_NETA_INTERFACE_TYPE PHY_INTERFACE_MODE_QSGMII
 #define PHY_ANEG_TIMEOUT       8000    /* PHY needs a longer aneg time */
 #define CONFIG_RESET_PHY_R
index a0ff067d1d2b0e9ebe2db6a7e086e4ce6d30f390..d8811a47cdc93ddd31949461fed64fffea632120 100644 (file)
@@ -53,7 +53,7 @@
 #define CONFIG_ENV_SECT_SIZE           (64 << 10) /* 64KiB sectors */
 
 #define CONFIG_PHY_MARVELL             /* there is a marvell phy */
-#define CONFIG_PHY_BASE_ADDR   0x0
+#define CONFIG_PHY_ADDR                        { 0x0, 0x1, 0x2, 0x3 }
 #define CONFIG_SYS_NETA_INTERFACE_TYPE PHY_INTERFACE_MODE_SGMII
 #define PHY_ANEG_TIMEOUT       8000    /* PHY needs a longer aneg time */
 #define CONFIG_RESET_PHY_R