All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 09/13] arm: mvebu: Change network init code to allow a more flexible setup
Date: Tue, 14 Apr 2015 12:46:51 +0200	[thread overview]
Message-ID: <1429008415-27458-10-git-send-email-sr@denx.de> (raw)
In-Reply-To: <1429008415-27458-1-git-send-email-sr@denx.de>

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>
---

Changes in v2: None

 arch/arm/mach-mvebu/cpu.c                   | 20 ++++++++++++++++----
 board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c |  3 ++-
 include/configs/db-mv784mp-gp.h             |  2 +-
 include/configs/maxbcm.h                    |  2 +-
 4 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index eca5e21..8058fad 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -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;
 }
diff --git a/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c b/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c
index b3dae89..00ca878 100644
--- a/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c
+++ b/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c
@@ -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;
 
diff --git a/include/configs/db-mv784mp-gp.h b/include/configs/db-mv784mp-gp.h
index 24cd42f..8b94454 100644
--- a/include/configs/db-mv784mp-gp.h
+++ b/include/configs/db-mv784mp-gp.h
@@ -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
diff --git a/include/configs/maxbcm.h b/include/configs/maxbcm.h
index 496c2bd..db6a400 100644
--- a/include/configs/maxbcm.h
+++ b/include/configs/maxbcm.h
@@ -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
-- 
2.3.5

  parent reply	other threads:[~2015-04-14 10:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-14 10:46 [U-Boot] [PATCH v2 0/13] Add Marvell Armada A38x 88F6820 SoC support Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 01/13] arm: armada-xp: Move SoC sources to mach-mvebu Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 02/13] arm: armada-xp: Move SoC headers to mach-mvebu/include/mach Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 03/13] arm: mvebu: Move mvebu-common into mach-mvebu Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 04/13] arm: mvebu: Change header macros from ARMADA_XP to MVEBU Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 05/13] arm: mvebu: Remove unreferenced define Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 06/13] arm: mvebu: Only define MV88F78X60 for Armada XP Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 07/13] arm: mvebu: Move CONFIG_SPL_LDSCRIPT to common header Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 08/13] arm: mvebu: Add basic Armada 38x support Stefan Roese
2015-04-14 10:46 ` Stefan Roese [this message]
2015-04-14 10:46 ` [U-Boot] [PATCH v2 10/13] arm: mvebu: Add dynamic SoC detection to mbus driver Stefan Roese
2015-04-14 15:31   ` Thomas Petazzoni
2015-04-15  8:45     ` Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 11/13] arm: mvebu: mv-common.h: Add CONFIG_PREBOOT Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 12/13] arm: mvebu: Add d-cache invalidate before enabling the d-cache Stefan Roese
2015-04-14 10:46 ` [U-Boot] [PATCH v2 13/13] arm: mvebu: Add Armada A38x DB-88F6820-GP board support Stefan Roese
2015-04-16 20:22 ` [U-Boot] [PATCH v2 0/13] Add Marvell Armada A38x 88F6820 SoC support Kevin Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1429008415-27458-10-git-send-email-sr@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.