Skip to contentSkip to conversation

arm: mvebu: Add armada-xp-maxbcm.dts for maxbcm board

PATCH New Stefan Roese 3 participants 7 messages Nov 27, 2015 – Nov 30, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 arm: mvebu: Add armada-xp-maxbcm.dts for maxbcm board

This is needed for the upcoming ethernet DM conversion of the maxbcm board. The configuration of the PHY is then extracted from the DT instead of using the defines from the config header.

---
 arch/arm/dts/Makefile             |   3 +-
 arch/arm/dts/armada-xp-maxbcm.dts | 249 ++++++++++++++++++++++++++++++++++++++
 configs/maxbcm_defconfig          |   2 +-
 3 files changed, 252 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/armada-xp-maxbcm.dts
arch/arm/dts/Makefile +2 -1
index a56e440..0494997 100644
@@ -49,7 +49,8 @@ dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 dtb-$(CONFIG_ARCH_MVEBU) +=			\
 	armada-388-clearfog.dtb			\
 	armada-388-gp.dtb			\
-	armada-xp-gp.dtb
+	armada-xp-gp.dtb			\
+	armada-xp-maxbcm.dtb
 
 dtb-$(CONFIG_ARCH_UNIPHIER) += \
 	uniphier-ph1-ld4-ref.dtb \
arch/arm/dts/armada-xp-maxbcm.dts new file +249 -0

249 lines not on this page · raw message

configs/maxbcm_defconfig +1 -1
index 31cd7ef..4692a02 100644
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_MVEBU=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_TARGET_MAXBCM=y
-CONFIG_DEFAULT_DEVICE_TREE="armada-xp-gp"
+CONFIG_DEFAULT_DEVICE_TREE="armada-xp-maxbcm"
 CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
Signature · 1 line
2.6.3
#1 lore raw

PATCH 2/3 arm: mvebu: armada-388-gp.dts: Add ethernet aliases

Adding these aliases enables the update of the MAC addresses from within U-Boot.

---
 arch/arm/dts/armada-388-gp.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/dts/armada-388-gp.dts +2 -0
index f3bcbc6..7bc878f 100644
@@ -52,6 +52,8 @@
 	};
 
 	aliases {
+		ethernet0 = &eth0;
+		ethernet1 = &eth1;
 		spi0 = &spi0;
 	};
 
Signature · 1 line
2.6.3
#2 lore raw

PATCH 3/3 net: mvneta: Convert to driver model

In reply to Stefan Roese

Update this driver to support driver model. As all MVEBU boards using this driver are converted with this patch, the non-driver-model code can be removed completely. This is also the reason why this patch is quite big and includes a) the driver change and b) the platform change. As its not git-bisect save otherwise.

With this conversion, some parameters are now extracted from the DT instread of using the config header defines. The supported properties right now are:

PHY-mode ("phy-mode") and PHY-address ("reg").

The base addresses for the ethernet controllers can be removed from the header files as well.

Please note that this patch also removes the E1000 network driver from some MVEBU config headers. This is necessary, as with DM_ETH configured and the e1000 driver enabled, the PCI driver also needs to support DM. But the MVEBU PCI(e) driver still needs to get ported to DM. When this is done, the E1000 driver can be enabled again.

Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Simon Glass <[email protected]>
---
 arch/arm/Kconfig                            |   1 +
 arch/arm/mach-mvebu/cpu.c                   |  24 ---
 arch/arm/mach-mvebu/include/mach/soc.h      |   4 -
 board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c |  32 ++--
 board/maxbcm/maxbcm.c                       |  20 ++-
 drivers/net/mvneta.c                        | 230 ++++++++++++++++------------
 include/configs/db-88f6820-gp.h             |   3 -
 include/configs/db-mv784mp-gp.h             |   4 -
 include/configs/maxbcm.h                    |   3 -
 9 files changed, 154 insertions(+), 167 deletions(-)
arch/arm/Kconfig +1 -0
index 2e20212..0c4794b 100644
@@ -117,6 +117,7 @@ config ARCH_MVEBU
 	select OF_CONTROL
 	select OF_SEPARATE
 	select DM
+	select DM_ETH
 	select DM_SERIAL
 	select DM_SPI
 	select DM_SPI_FLASH
arch/arm/mach-mvebu/cpu.c +0 -24
index 1441b5c..c037854 100644
@@ -325,30 +325,6 @@ int arch_misc_init(void)
 }
 #endif /* CONFIG_ARCH_MISC_INIT */
 
-#ifdef CONFIG_MVNETA
-int cpu_eth_init(bd_t *bis)
-{
-	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;
-}
-#endif
-
 #ifdef CONFIG_MV_SDHCI
 int board_mmc_init(bd_t *bis)
 {
arch/arm/mach-mvebu/include/mach/soc.h +0 -4
index ad5a22a..b78da25 100644
@@ -58,13 +58,9 @@
 #define MVEBU_CPU_WIN_BASE	(MVEBU_REGISTER(0x20000))
 #define MVEBU_SDRAM_BASE	(MVEBU_REGISTER(0x20180))
 #define MVEBU_TIMER_BASE	(MVEBU_REGISTER(0x20300))
-#define MVEBU_EGIGA2_BASE	(MVEBU_REGISTER(0x30000))
-#define MVEBU_EGIGA3_BASE	(MVEBU_REGISTER(0x34000))
 #define MVEBU_REG_PCIE_BASE	(MVEBU_REGISTER(0x40000))
 #define MVEBU_AXP_USB_BASE      (MVEBU_REGISTER(0x50000))
 #define MVEBU_USB20_BASE	(MVEBU_REGISTER(0x58000))
-#define MVEBU_EGIGA0_BASE	(MVEBU_REGISTER(0x70000))
-#define MVEBU_EGIGA1_BASE	(MVEBU_REGISTER(0x74000))
 #define MVEBU_AXP_SATA_BASE	(MVEBU_REGISTER(0xa0000))
 #define MVEBU_SATA0_BASE	(MVEBU_REGISTER(0xa8000))
 #define MVEBU_NAND_BASE		(MVEBU_REGISTER(0xd0000))
board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c +12 -20
index d7aa149..9305284 100644
@@ -87,40 +87,32 @@ int board_eth_init(bd_t *bis)
 	return pci_eth_init(bis);
 }
 
-#ifdef CONFIG_RESET_PHY_R
-/* Configure and enable MV88E1545 PHY */
-void reset_phy(void)
+int board_phy_config(struct phy_device *phydev)
 {
-	u8 phy_addr[] = CONFIG_PHY_ADDR;
-	u16 devadr = phy_addr[0];
-	char *name = "neta0";
 	u16 reg;
 
-	if (miiphy_set_current_dev(name))
-		return;
-
 	/* Enable QSGMII AN */
 	/* Set page to 4 */
-	miiphy_write(name, devadr, 0x16, 4);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x16, 4);
 	/* Enable AN */
-	miiphy_write(name, devadr, 0x0, 0x1140);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x0, 0x1140);
 	/* Set page to 0 */
-	miiphy_write(name, devadr, 0x16, 0);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x16, 0);
 
 	/* Phy C_ANEG */
-	miiphy_read(name, devadr, 0x4, &reg);
+	reg = phy_read(phydev, MDIO_DEVAD_NONE, 0x4);
 	reg |= 0x1E0;
-	miiphy_write(name, devadr, 0x4, reg);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0x4, reg);
 
 	/* Soft-Reset */
-	miiphy_write(name, devadr, 22, 0x0000);
-	miiphy_write(name, devadr, 0, 0x9140);
+	phy_write(phydev, MDIO_DEVAD_NONE, 22, 0x0000);
+	phy_write(phydev, MDIO_DEVAD_NONE, 0, 0x9140);
 
 	/* Power up the phy */
-	miiphy_read(name, devadr, ETH_PHY_CTRL_REG, &reg);
+	reg = phy_read(phydev, MDIO_DEVAD_NONE, ETH_PHY_CTRL_REG);
 	reg &= ~(ETH_PHY_CTRL_POWER_DOWN_MASK);
-	miiphy_write(name, devadr, ETH_PHY_CTRL_REG, reg);
+	phy_write(phydev, MDIO_DEVAD_NONE, ETH_PHY_CTRL_REG, reg);
 
-	printf("88E1545 Initialized on %s\n", name);
+	printf("88E1545 Initialized\n");
+	return 0;
 }
-#endif /* CONFIG_RESET_PHY_R */
board/maxbcm/maxbcm.c +9 -11
index 119ba4c..db6ad99 100644
@@ -138,17 +138,15 @@ int checkboard(void)
 	return 0;
 }
 
-#ifdef CONFIG_RESET_PHY_R
 /* Configure and enable MV88E6185 switch */
-void reset_phy(void)
+int board_phy_config(struct phy_device *phydev)
 {
-	char *name = "neta0";
-
-	if (miiphy_set_current_dev(name))
-		return;
-
-	/* todo: fill this with the real setup / config code */
-
-	printf("88E6185 Initialized on %s\n", name);
+	/*
+	 * todo:
+	 * Fill this with the real setup / config code.
+	 * Please see board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c
+	 * for details.
+	 */
+	printf("88E6185 Initialized\n");
+	return 0;
 }
-#endif /* CONFIG_RESET_PHY_R */
drivers/net/mvneta.c +132 -98

415 lines not on this page · raw message

include/configs/db-88f6820-gp.h +0 -3
index dc48b5d..964ef64 100644
@@ -95,8 +95,6 @@
 #define CONFIG_ENV_SECT_SIZE		(256 << 10) /* 256KiB sectors */
 
 #define CONFIG_PHY_MARVELL		/* there is a marvell phy */
-#define CONFIG_PHY_ADDR			{ 1, 0 }
-#define CONFIG_SYS_NETA_INTERFACE_TYPE	PHY_INTERFACE_MODE_RGMII
 #define PHY_ANEG_TIMEOUT	8000	/* PHY needs a longer aneg time */
 
 /* PCIe support */
@@ -105,7 +103,6 @@
 #define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_PNP
 #define CONFIG_PCI_SCAN_SHOW
-#define CONFIG_E1000	/* enable Intel E1000 support for testing */
 #endif
 
 #define CONFIG_SYS_CONSOLE_INFO_QUIET	/* don't print console @ startup */
include/configs/db-mv784mp-gp.h +0 -4
index 8c6a7f6..1fd005c 100644
@@ -67,10 +67,7 @@
 #define CONFIG_ENV_SECT_SIZE		(64 << 10) /* 64KiB sectors */
 
 #define CONFIG_PHY_MARVELL		/* there is a marvell phy */
-#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
 
 #define CONFIG_SYS_CONSOLE_INFO_QUIET	/* don't print console @ startup */
 #define CONFIG_SYS_ALT_MEMTEST
@@ -92,7 +89,6 @@
 #define CONFIG_PCI_MVEBU
 #define CONFIG_PCI_PNP
 #define CONFIG_PCI_SCAN_SHOW
-#define CONFIG_E1000	/* enable Intel E1000 support for testing */
 #endif
 
 /* NAND */
include/configs/maxbcm.h +0 -3
index a9be133..70d6db3 100644
@@ -54,10 +54,7 @@
 #define CONFIG_ENV_SECT_SIZE		(64 << 10) /* 64KiB sectors */
 
 #define CONFIG_PHY_MARVELL		/* there is a marvell phy */
-#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
 
 #define CONFIG_SYS_CONSOLE_INFO_QUIET	/* don't print console @ startup */
 #define CONFIG_SYS_ALT_MEMTEST
Signature · 1 line
2.6.3
#3 lore raw

PATCH 3/3 net: mvneta: Convert to driver model

Quoted 27 lines · Stefan Roese

Update this driver to support driver model. As all MVEBU boards using this driver are converted with this patch, the non-driver-model code can be removed completely. This is also the reason why this patch is quite big and includes a) the driver change and b) the platform change. As its not git-bisect save otherwise.

With this conversion, some parameters are now extracted from the DT instread of using the config header defines. The supported properties right now are:

PHY-mode ("phy-mode") and PHY-address ("reg").

The base addresses for the ethernet controllers can be removed from the header files as well.

Please note that this patch also removes the E1000 network driver from some MVEBU config headers. This is necessary, as with DM_ETH configured and the e1000 driver enabled, the PCI driver also needs to support DM. But the MVEBU PCI(e) driver still needs to get ported to DM. When this is done, the E1000 driver can be enabled again.

Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Simon Glass <[email protected]>
Quoted 11 lines
---
 arch/arm/Kconfig                            |   1 +
 arch/arm/mach-mvebu/cpu.c                   |  24 ---
 arch/arm/mach-mvebu/include/mach/soc.h      |   4 -
 board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c |  32 ++--
 board/maxbcm/maxbcm.c                       |  20 ++-
 drivers/net/mvneta.c                        | 230 ++++++++++++++++------------
 include/configs/db-88f6820-gp.h             |   3 -
 include/configs/db-mv784mp-gp.h             |   4 -
 include/configs/maxbcm.h                    |   3 -
 9 files changed, 154 insertions(+), 167 deletions(-)
#4 lore raw

PATCH 3/3 net: mvneta: Convert to driver model

In reply to Stefan Roese
Quoted 44 lines · Stefan Roese

Update this driver to support driver model. As all MVEBU boards using this driver are converted with this patch, the non-driver-model code can be removed completely. This is also the reason why this patch is quite big and includes a) the driver change and b) the platform change. As its not git-bisect save otherwise.

With this conversion, some parameters are now extracted from the DT instread of using the config header defines. The supported properties right now are:

PHY-mode ("phy-mode") and PHY-address ("reg").

The base addresses for the ethernet controllers can be removed from the header files as well.

Please note that this patch also removes the E1000 network driver from some MVEBU config headers. This is necessary, as with DM_ETH configured and the e1000 driver enabled, the PCI driver also needs to support DM. But the MVEBU PCI(e) driver still needs to get ported to DM. When this is done, the E1000 driver can be enabled again.

Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Simon Glass <[email protected]>
---
 arch/arm/Kconfig                            |   1 +
 arch/arm/mach-mvebu/cpu.c                   |  24 ---
 arch/arm/mach-mvebu/include/mach/soc.h      |   4 -
 board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c |  32 ++--
 board/maxbcm/maxbcm.c                       |  20 ++-
 drivers/net/mvneta.c                        | 230 ++++++++++++++++------------
 include/configs/db-88f6820-gp.h             |   3 -
 include/configs/db-mv784mp-gp.h             |   4 -
 include/configs/maxbcm.h                    |   3 -
 9 files changed, 154 insertions(+), 167 deletions(-)
arch/arm/Kconfig +0 -0
index 2e20212..0c4794b 100644

arch/arm/Kconfig config ARCH_MVEBU · line 120

Quoted 4 lines
arch/arm/Kconfig +1 -0
@@ -117,6 +117,7 @@ config ARCH_MVEBU
        select OF_CONTROL
        select OF_SEPARATE
        select DM
+       select DM_ETH

All ARM boards? Am I missing something? Seems a bit broad for the scope of this patch.

arch/arm/Kconfig config ARCH_MVEBU · line 123

Quoted 3 lines
arch/arm/Kconfig +0 -0
        select DM_SERIAL
        select DM_SPI
        select DM_SPI_FLASH

Otherwise, looks good.

-Joe

#5 lore raw

PATCH 3/3 net: mvneta: Convert to driver model

Quoted 40 lines · Joe Hershberger
Quoted 39 lines · Stefan Roese

Update this driver to support driver model. As all MVEBU boards using this driver are converted with this patch, the non-driver-model code can be removed completely. This is also the reason why this patch is quite big and includes a) the driver change and b) the platform change. As its not git-bisect save otherwise.

With this conversion, some parameters are now extracted from the DT instread of using the config header defines. The supported properties right now are:

PHY-mode ("phy-mode") and PHY-address ("reg").

The base addresses for the ethernet controllers can be removed from the header files as well.

Please note that this patch also removes the E1000 network driver from some MVEBU config headers. This is necessary, as with DM_ETH configured and the e1000 driver enabled, the PCI driver also needs to support DM. But the MVEBU PCI(e) driver still needs to get ported to DM. When this is done, the E1000 driver can be enabled again.

Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Simon Glass <[email protected]>
---
 arch/arm/Kconfig                            |   1 +
 arch/arm/mach-mvebu/cpu.c                   |  24 ---
 arch/arm/mach-mvebu/include/mach/soc.h      |   4 -
 board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c |  32 ++--
 board/maxbcm/maxbcm.c                       |  20 ++-
 drivers/net/mvneta.c                        | 230 ++++++++++++++++------------
 include/configs/db-88f6820-gp.h             |   3 -
 include/configs/db-mv784mp-gp.h             |   4 -
 include/configs/maxbcm.h                    |   3 -
 9 files changed, 154 insertions(+), 167 deletions(-)
Quoted 12 lines

arch/arm/Kconfig config ARCH_MVEBU · line 120

Quoted 9 lines
arch/arm/Kconfig +1 -0
index 2e20212..0c4794b 100644
@@ -117,6 +117,7 @@ config ARCH_MVEBU
        select OF_CONTROL
        select OF_SEPARATE
        select DM
+       select DM_ETH

All ARM boards? Am I missing something? Seems a bit broad for the scope of this patch.

Nevermind. Didn't notice the scoping of "config ARCH_MVEBU".

Quoted 8 lines

arch/arm/Kconfig config ARCH_MVEBU · line 123

Quoted 4 lines
arch/arm/Kconfig +0 -0
        select DM_SERIAL
        select DM_SPI
        select DM_SPI_FLASH

Otherwise, looks good.

-Joe

#6 lore raw

PATCH 3/3 net: mvneta: Convert to driver model

In reply to Stefan Roese
Quoted 22 lines · Stefan Roese

Update this driver to support driver model. As all MVEBU boards using this driver are converted with this patch, the non-driver-model code can be removed completely. This is also the reason why this patch is quite big and includes a) the driver change and b) the platform change. As its not git-bisect save otherwise.

With this conversion, some parameters are now extracted from the DT instread of using the config header defines. The supported properties right now are:

PHY-mode ("phy-mode") and PHY-address ("reg").

The base addresses for the ethernet controllers can be removed from the header files as well.

Please note that this patch also removes the E1000 network driver from some MVEBU config headers. This is necessary, as with DM_ETH configured and the e1000 driver enabled, the PCI driver also needs to support DM. But the MVEBU PCI(e) driver still needs to get ported to DM. When this is done, the E1000 driver can be enabled again.

Quoted 5 lines
Cc Luka Perkov <[email protected]>
Cc Dirk Eibach <[email protected]>
Cc Joe Hershberger <[email protected]>
Cc Simon Glass <[email protected]>