Skip to contentSkip to conversation

Add driver for VSC9953 Ethernet Switch

PATCH New Codrin Ciubotariu 3 participants 24 messages Jan 12, 2015 – Jan 23, 2015

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

v3 cover Add driver for VSC9953 Ethernet Switch

This patches add support for VSC9953, a Vitesse L2 Switch IP which is integrated in the T1040/T1020 Freescale SoCs.

About Device:
=============
The Seville Gigabit Ethernet switch core contains eight 10/100/1000 Mbps Ethernet ports and two 10/100/1000/2500 Mbps ports. It provides a rich set of Ethernet switching features such as advanced TCAM-based VLAN and QoS processing as well as security processing using a TCAM.

Switch interfaces:
- 8 Gigabit switch ports (ports 0 to 7) are external and
are connected to external PHYs
- 2 switch ports (ports 8 and 9) of 2.5 G are connected
(fixed links) to FMan ports (FM1 at DTSEC1 and FM1 at DTSEC2)

Commands Overview:
=============
Commands supported
- enable/disable a port
- check a port's link speed, duplexity and status.

Commands syntax
ethsw port <port_nr> enable|disable
- enable/disable an l2 switch port
ethsw port <port_nr> show
- show an l2 switch port's configuration

port_nr=0..9; use "all" for all ports

=> ethsw port all show

    Port   Status     Link    Speed   Duplex
       0  enabled     down       10     half
       1  enabled     down       10     half
       2  enabled     down       10     half
       3  enabled       up     1000     full
       4 disabled     down        -     half
       5 disabled     down        -     half
       6 disabled     down        -     half
       7 disabled     down        -     half
       8  enabled       up     2500     full
       9  enabled       up     2500     full

=>

Changes for v2:
- split the bug fix from the implementation of SerDes protocols of L2 Switch ports patch;
- added debug messages if MDIO reads or writes timeout;
- added debug messages when reset of VSC9953 switch fails;
- replaced Copyright and license to the generic one;
- added patch descriptions;

Changes for v3:
- replaced the arrays type from 'int' to 'u8' int the fix for mapping of Freescale SerDes protocols;
- removed "Change-id" lines from almost all the patches;

Codrin Ciubotariu (11):
net/fm: Fix error when FMAN MAC has no PHY
arch/powerpc: Fix mapping of Freescale SerDes protocols arch/powerpc: Add SGMII support for the L2 Switch ports net/fm: Enable FMAN ports if l2switch ports are connected over SGMII net/vsc9953: Add driver for Vitesse VSC9953 L2 Switch IP arch/powerpc: Enable VSC9953 driver on T1040 and T1020 board/T1040qds: Fix lane-to-slot mapping for SerDes protocol 0x89 board/T1040qds: T1040 FMAN ports FM1 at DTSEC1 and FM1 at DTSEC2 have no
PHYs
board/T104xrdb: T1040 FMAN ports FM1 at DTSEC1 and FM1 at DTSEC2 have no
PHYs
board/T1040qds: Add VSC9953 support for T1040qds board board/T1040rdb: Add VSC9953 support for T1040rdb board

 arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c |  73 ++--
 arch/powerpc/cpu/mpc85xx/t1040_serdes.c        |   8 +-
 arch/powerpc/cpu/mpc8xxx/cpu.c                 |   5 +
 arch/powerpc/include/asm/config_mpc85xx.h      |   3 +
 arch/powerpc/include/asm/fsl_serdes.h          |   7 +
 board/freescale/t1040qds/eth.c                 |  93 +++++
 board/freescale/t104xrdb/eth.c                 |  59 ++-
 doc/README.t1040-l2switch                      |  49 +++
 drivers/net/Makefile                           |   1 +
 drivers/net/fm/eth.c                           |  30 +-
 drivers/net/fm/t1040.c                         |   3 +-
 drivers/net/vsc9953.c                          | 497 +++++++++++++++++++++++++
 include/configs/T1040QDS.h                     |   4 +
 include/configs/T104xRDB.h                     |   6 +
 include/vsc9953.h                              | 402 ++++++++++++++++++++
 15 files changed, 1191 insertions(+), 49 deletions(-)
 create mode 100644 doc/README.t1040-l2switch
 create mode 100644 drivers/net/vsc9953.c
 create mode 100644 include/vsc9953.h
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH v3 1/11 net/fm: Fix error when FMAN MAC has no PHY

U-boot assumes that all FMAN ports have a PHY. Some SoCs (like T1040) have fixed links. This means that the ports are connected MAC to MAc and there is no Ethernet PHY attatched. This patch initializes a FMAN MAC even if it doesn't have a PHY attached.

---

Changes for v2: None

Changes for v3: None

 drivers/net/fm/eth.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/net/fm/eth.c +18 -12
index f1e39b9..1d1089d 100644
@@ -410,10 +410,15 @@ static int fm_eth_open(struct eth_device *dev, bd_t *bd)
 	fmc_tx_port_graceful_stop_disable(fm_eth);
 
 #ifdef CONFIG_PHYLIB
-	ret = phy_startup(fm_eth->phydev);
-	if (ret) {
-		printf("%s: Could not initialize\n", fm_eth->phydev->dev->name);
-		return ret;
+	if (fm_eth->phydev) {
+		ret = phy_startup(fm_eth->phydev);
+		if (ret) {
+			printf("%s: Could not initialize\n",
+			       fm_eth->phydev->dev->name);
+			return ret;
+		}
+	} else {
+		return 0;
 	}
 #else
 	fm_eth->phydev->speed = SPEED_1000;
@@ -447,7 +452,8 @@ static void fm_eth_halt(struct eth_device *dev)
 	/* disable bmi Rx port */
 	bmi_rx_port_disable(fm_eth->rx_port);
 
-	phy_shutdown(fm_eth->phydev);
+	if (fm_eth->phydev)
+		phy_shutdown(fm_eth->phydev);
 }
 
 static int fm_eth_send(struct eth_device *dev, void *buf, int len)
@@ -625,11 +631,12 @@ static int init_phy(struct eth_device *dev)
 	if (fm_eth->bus) {
 		phydev = phy_connect(fm_eth->bus, fm_eth->phyaddr, dev,
 					fm_eth->enet_if);
-	}
-
-	if (!phydev) {
-		printf("Failed to connect\n");
-		return -1;
+		if (!phydev) {
+			printf("Failed to connect\n");
+			return -1;
+		}
+	} else {
+		return 0;
 	}
 
 	if (fm_eth->type == FM_ETH_1G_E) {
@@ -711,8 +718,7 @@ int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info)
 	if (!fm_eth_startup(fm_eth))
 		return 0;
 
-	if (init_phy(dev))
-		return 0;
+	init_phy(dev);
 
 	/* clear the ethernet address */
 	for (i = 0; i < 6; i++)
Signature · 1 line
1.7.11.7
#2 lore raw

PATCH v3 1/11 net/fm: Fix error when FMAN MAC has no PHY

Quoted 11 lines · Codrin Ciubotariu

U-boot assumes that all FMAN ports have a PHY. Some SoCs (like T1040) have fixed links. This means that the ports are connected MAC to MAc and there is no Ethernet PHY attatched. This patch initializes a FMAN MAC even if it doesn't have a PHY attached.

---

Changes for v2: None

Changes for v3: None

Applied to u-boot-mpc85xx master branch, awaiting upstream.

York

#3 lore raw

PATCH v3 2/11 arch/powerpc: Fix mapping of Freescale SerDes protocols

In reply to Codrin Ciubotariu

The number of supported serdes protocols on Freescale SoCs has increased over time. Until now, an u64 variable have been initialized on boot with the configured protocols. However, since this number has increased (enum srds_prtcl has more than 64 values), 64 bits are no longer sufficient to hold track of all the configured protocols.
This patch replaces the u64 map values with static arrays. To keep track of the number of serdes protocols, the SERDES_PRCTL_COUNT vale has been added at the end of enum srds_prtcl. This value must always be the last one.

---

Changes for v2: There is no v1 version of this patch;

Changes for v3:
- replaced 'int' type of seredesX_prtcl_map[] with 'u8';
- removed "Change-id" line from comment;

 arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c | 67 ++++++++++++++------------
 arch/powerpc/include/asm/fsl_serdes.h          |  1 +
 2 files changed, 38 insertions(+), 30 deletions(-)
arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c +37 -30
index 5cfae47..c7d9622 100644
@@ -15,16 +15,16 @@
 #include "fsl_corenet2_serdes.h"
 
 #ifdef CONFIG_SYS_FSL_SRDS_1
-static u64 serdes1_prtcl_map;
+static u8 serdes1_prtcl_map[SERDES_PRCTL_COUNT];
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_2
-static u64 serdes2_prtcl_map;
+static u8 serdes2_prtcl_map[SERDES_PRCTL_COUNT];
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_3
-static u64 serdes3_prtcl_map;
+static u8 serdes3_prtcl_map[SERDES_PRCTL_COUNT];
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_4
-static u64 serdes4_prtcl_map;
+static u8 serdes4_prtcl_map[SERDES_PRCTL_COUNT];
 #endif
 
 #ifdef DEBUG
@@ -83,19 +83,19 @@ static const char *serdes_prtcl_str[] = {
 
 int is_serdes_configured(enum srds_prtcl device)
 {
-	u64 ret = 0;
+	int ret = 0;
 
 #ifdef CONFIG_SYS_FSL_SRDS_1
-	ret |= (1ULL << device) & serdes1_prtcl_map;
+	ret |= serdes1_prtcl_map[device];
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_2
-	ret |= (1ULL << device) & serdes2_prtcl_map;
+	ret |= serdes2_prtcl_map[device];
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_3
-	ret |= (1ULL << device) & serdes3_prtcl_map;
+	ret |= serdes3_prtcl_map[device];
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_4
-	ret |= (1ULL << device) & serdes4_prtcl_map;
+	ret |= serdes4_prtcl_map[device];
 #endif
 
 	return !!ret;
@@ -171,12 +171,14 @@ int serdes_get_first_lane(u32 sd, enum srds_prtcl device)
 #define BCAP_OVD_MASK		0x10000000
 #define BYP_CAL_MASK		0x02000000
 
-u64 serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift)
+void serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift,
+		u8 serdes_prtcl_map[SERDES_PRCTL_COUNT])
 {
 	ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-	u64 serdes_prtcl_map = 0;
 	u32 cfg;
 	int lane;
+
+	memset(serdes_prtcl_map, 0, sizeof(serdes_prtcl_map));
 #ifdef CONFIG_SYS_FSL_ERRATUM_A007186
 	struct ccsr_sfp_regs  __iomem *sfp_regs =
 			(struct ccsr_sfp_regs __iomem *)(CONFIG_SYS_SFP_ADDR);
@@ -312,38 +314,43 @@ u64 serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift)
 
 	for (lane = 0; lane < SRDS_MAX_LANES; lane++) {
 		enum srds_prtcl lane_prtcl = serdes_get_prtcl(sd, cfg, lane);
-		serdes_prtcl_map |= (1ULL << lane_prtcl);
+		if (unlikely(lane_prtcl >= SERDES_PRCTL_COUNT))
+			debug("Unknown SerDes lane protocol %d\n", lane_prtcl);
+		else
+			serdes_prtcl_map[lane_prtcl] = 1;
 	}
-
-	return serdes_prtcl_map;
 }
 
 void fsl_serdes_init(void)
 {
 
 #ifdef CONFIG_SYS_FSL_SRDS_1
-	serdes1_prtcl_map = serdes_init(FSL_SRDS_1,
-		CONFIG_SYS_FSL_CORENET_SERDES_ADDR,
-		FSL_CORENET2_RCWSR4_SRDS1_PRTCL,
-		FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT);
+	serdes_init(FSL_SRDS_1,
+		    CONFIG_SYS_FSL_CORENET_SERDES_ADDR,
+		    FSL_CORENET2_RCWSR4_SRDS1_PRTCL,
+		    FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT,
+		    serdes1_prtcl_map);
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_2
-	serdes2_prtcl_map = serdes_init(FSL_SRDS_2,
-		CONFIG_SYS_FSL_CORENET_SERDES_ADDR + FSL_SRDS_2 * 0x1000,
-		FSL_CORENET2_RCWSR4_SRDS2_PRTCL,
-		FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT);
+	serdes_init(FSL_SRDS_2,
+		    CONFIG_SYS_FSL_CORENET_SERDES_ADDR + FSL_SRDS_2 * 0x1000,
+		    FSL_CORENET2_RCWSR4_SRDS2_PRTCL,
+		    FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT,
+		    serdes2_prtcl_map);
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_3
-	serdes3_prtcl_map = serdes_init(FSL_SRDS_3,
-		CONFIG_SYS_FSL_CORENET_SERDES_ADDR + FSL_SRDS_3 * 0x1000,
-		FSL_CORENET2_RCWSR4_SRDS3_PRTCL,
-		FSL_CORENET2_RCWSR4_SRDS3_PRTCL_SHIFT);
+	serdes_init(FSL_SRDS_3,
+		    CONFIG_SYS_FSL_CORENET_SERDES_ADDR + FSL_SRDS_3 * 0x1000,
+		    FSL_CORENET2_RCWSR4_SRDS3_PRTCL,
+		    FSL_CORENET2_RCWSR4_SRDS3_PRTCL_SHIFT,
+		    serdes3_prtcl_map);
 #endif
 #ifdef CONFIG_SYS_FSL_SRDS_4
-	serdes4_prtcl_map = serdes_init(FSL_SRDS_4,
-		CONFIG_SYS_FSL_CORENET_SERDES_ADDR + FSL_SRDS_4 * 0x1000,
-		FSL_CORENET2_RCWSR4_SRDS4_PRTCL,
-		FSL_CORENET2_RCWSR4_SRDS4_PRTCL_SHIFT);
+	serdes_init(FSL_SRDS_4,
+		    CONFIG_SYS_FSL_CORENET_SERDES_ADDR + FSL_SRDS_4 * 0x1000,
+		    FSL_CORENET2_RCWSR4_SRDS4_PRTCL,
+		    FSL_CORENET2_RCWSR4_SRDS4_PRTCL_SHIFT,
+		    serdes4_prtcl_map);
 #endif
 
 }
arch/powerpc/include/asm/fsl_serdes.h +1 -0
index 8e0e190..2dd32c2 100644
@@ -87,6 +87,7 @@ enum srds_prtcl {
 	SGMII_2500_FM2_DTSEC6,
 	SGMII_2500_FM2_DTSEC9,
 	SGMII_2500_FM2_DTSEC10,
+	SERDES_PRCTL_COUNT	/* Keep this item the last one */
 };
 
 enum srds {
Signature · 1 line
1.7.11.7
#4 lore raw

PATCH v3 2/11 arch/powerpc: Fix mapping of Freescale SerDes protocols

Quoted 11 lines · Codrin Ciubotariu

The number of supported serdes protocols on Freescale SoCs has increased over time. Until now, an u64 variable have been initialized on boot with the configured protocols. However, since this number has increased (enum srds_prtcl has more than 64 values), 64 bits are no longer sufficient to hold track of all the configured protocols.
This patch replaces the u64 map values with static arrays. To keep track of the number of serdes protocols, the SERDES_PRCTL_COUNT vale has been added at the end of enum srds_prtcl. This value must always be the last one.

Quoted 9 lines

---

Changes for v2: There is no v1 version of this patch;

Changes for v3:
- replaced 'int' type of seredesX_prtcl_map[] with 'u8';
- removed "Change-id" line from comment;

Applied to u-boot-mpc85xx master branch, awaiting upstream.

York

#5 lore raw

PATCH v3 3/11 arch/powerpc: Add SGMII support for the L2 Switch ports

In reply to Codrin Ciubotariu

Some Freescale SoCs like T1020 and T1040 have an integrated L2 Switch. The L2 Switch ports may be connected to Ethernet PHYs over SGMII and QSGMII.

---

Changes for v2:

	- split a bug fix regarding Freescale SerDes protocols
	into a different patch;

Changes for v3: Removed "Change-id" line from comment;

 arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c | 6 ++++++
 arch/powerpc/cpu/mpc85xx/t1040_serdes.c        | 8 ++++----
 arch/powerpc/include/asm/fsl_serdes.h          | 6 ++++++
 3 files changed, 16 insertions(+), 4 deletions(-)
arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c +6 -0
index c7d9622..acb1353 100644
@@ -78,6 +78,12 @@ static const char *serdes_prtcl_str[] = {
 	[INTERLAKEN] = "INTERLAKEN",
 	[QSGMII_SW1_A] = "QSGMII_SW1_A",
 	[QSGMII_SW1_B] = "QSGMII_SW1_B",
+	[SGMII_SW1_MAC1] = "SGMII_SW1_MAC1",
+	[SGMII_SW1_MAC2] = "SGMII_SW1_MAC2",
+	[SGMII_SW1_MAC3] = "SGMII_SW1_MAC3",
+	[SGMII_SW1_MAC4] = "SGMII_SW1_MAC4",
+	[SGMII_SW1_MAC5] = "SGMII_SW1_MAC5",
+	[SGMII_SW1_MAC6] = "SGMII_SW1_MAC6",
 };
 #endif
 
arch/powerpc/cpu/mpc85xx/t1040_serdes.c +4 -4
index d86bb27..d5dccd5 100644
@@ -33,10 +33,10 @@ static u8 serdes_cfg_tbl[][SRDS_MAX_LANES] = {
 		PCIE2, PCIE2, SGMII_FM1_DTSEC4, SGMII_FM1_DTSEC5},
 	[0x87] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
 		PCIE2, PCIE3, PCIE4, SGMII_FM1_DTSEC5},
-	[0x89] = {PCIE1, QSGMII_SW1_A, QSGMII_SW1_A, QSGMII_SW1_A,
-		PCIE2, PCIE3, QSGMII_SW1_B, SATA1},
-	[0x8D] = {PCIE1, QSGMII_SW1_A, QSGMII_SW1_A, QSGMII_SW1_A,
-		PCIE2, QSGMII_SW1_B, QSGMII_SW1_B, QSGMII_SW1_B},
+	[0x89] = {PCIE1, SGMII_SW1_MAC3, SGMII_SW1_MAC1, SGMII_SW1_MAC2,
+		PCIE2, PCIE3, SGMII_SW1_MAC4, SATA1},
+	[0x8D] = {PCIE1, SGMII_SW1_MAC3, SGMII_SW1_MAC1, SGMII_SW1_MAC2,
+		PCIE2, SGMII_SW1_MAC6, SGMII_SW1_MAC4, SGMII_SW1_MAC5},
 	[0x8F] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
 		AURORA, NONE, SGMII_FM1_DTSEC4, SGMII_FM1_DTSEC5},
 	[0xA5] = {PCIE1, SGMII_FM1_DTSEC3, SGMII_FM1_DTSEC1, SGMII_FM1_DTSEC2,
arch/powerpc/include/asm/fsl_serdes.h +6 -0
index 2dd32c2..45e248e 100644
@@ -87,6 +87,12 @@ enum srds_prtcl {
 	SGMII_2500_FM2_DTSEC6,
 	SGMII_2500_FM2_DTSEC9,
 	SGMII_2500_FM2_DTSEC10,
+	SGMII_SW1_MAC1,
+	SGMII_SW1_MAC2,
+	SGMII_SW1_MAC3,
+	SGMII_SW1_MAC4,
+	SGMII_SW1_MAC5,
+	SGMII_SW1_MAC6,
 	SERDES_PRCTL_COUNT	/* Keep this item the last one */
 };
 
Signature · 1 line
1.7.11.7
#6 lore raw

PATCH v3 3/11 arch/powerpc: Add SGMII support for the L2 Switch ports

Quoted 4 lines · Codrin Ciubotariu

Some Freescale SoCs like T1020 and T1040 have an integrated L2 Switch. The L2 Switch ports may be connected to Ethernet PHYs over SGMII and QSGMII.

Quoted 10 lines

---

Changes for v2:

	- split a bug fix regarding Freescale SerDes protocols
	into a different patch;

Changes for v3: Removed "Change-id" line from comment;

Applied to u-boot-mpc85xx master branch, awaiting upstream.

York

#7 lore raw

PATCH v3 4/11 net/fm: Enable FMAN ports if l2switch ports are connected over SGMII

In reply to Codrin Ciubotariu

If SerDes is configured to connect L2 Switch ports from T1040
over SGMII or QSGMII, the two FMAN fixed ports (FM1 at DTSEC1 and FM2 at DTSEC2) that are connected to two L2 swtch ports must be enabled. These ports don't have PHYs and must be treated accordingly.

---

Changes for v2: None

Changes for v3: Removed "Change-id" line from comment;

 drivers/net/fm/t1040.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/fm/t1040.c +2 -1
index d2a097e..0458366 100644
@@ -50,7 +50,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
 	switch (port) {
 	case FM1_DTSEC1:
 	case FM1_DTSEC2:
-		if (is_serdes_configured(QSGMII_SW1_A + port - FM1_DTSEC1))
+		if (is_serdes_configured(QSGMII_SW1_A + port - FM1_DTSEC1) ||
+		    is_serdes_configured(SGMII_SW1_MAC1  + port - FM1_DTSEC1))
 			return PHY_INTERFACE_MODE_QSGMII;
 	case FM1_DTSEC3:
 	case FM1_DTSEC4:
Signature · 1 line
1.7.11.7
#8 lore raw

PATCH v3 4/11 net/fm: Enable FMAN ports if l2switch ports are connected over SGMII

Quoted 5 lines · Codrin Ciubotariu

If SerDes is configured to connect L2 Switch ports from T1040
over SGMII or QSGMII, the two FMAN fixed ports (FM1 at DTSEC1 and FM2 at DTSEC2) that are connected to two L2 swtch ports must be enabled. These ports don't have PHYs and must be treated accordingly.

Quoted 7 lines

---

Changes for v2: None

Changes for v3: Removed "Change-id" line from comment;

Applied to u-boot-mpc85xx master branch, awaiting upstream.

York

#9 lore raw

PATCH v3 5/11 net/vsc9953: Add driver for Vitesse VSC9953 L2 Switch IP

In reply to Codrin Ciubotariu

This patch adds a driver for VSC9953 L2 Switch. This Vitesse IP is integrated in Freescale T1040 and T1020 SoCs.
The L2 switch has 10 Ethernet ports: 2 internal fixed-links (ports 8 and 9) at 2.5 Gbps and and 8 external ports at 1 Gbps. The external ports may be connected to PHYs over QSGMII and SGMII.

Commands have also been added to enable/disable a port and to check a port's link speed, duplexity and status. The commands are:

ethsw port <port_nr> enable|disable - enable/disable an l2 switch port ethsw port <port_nr> show - show an l2 switch port's configuration

port_nr=0..9; use "all" for all ports

For more detailse please see doc/README.t1040-l2switch

---

Changes for v2:
- added debug messages if MDIO reads or writes timeout;
- added debug messages when reset of VSC9953 switch fails;
- replaced Copyright and license to the generic one;

Changes for v3: Removed "Change-id" line from comment;

 doc/README.t1040-l2switch |  49 +++++
 drivers/net/Makefile      |   1 +
 drivers/net/vsc9953.c     | 497 ++++++++++++++++++++++++++++++++++++++++++++++
 include/vsc9953.h         | 402 +++++++++++++++++++++++++++++++++++++
 4 files changed, 949 insertions(+)
 create mode 100644 doc/README.t1040-l2switch
 create mode 100644 drivers/net/vsc9953.c
 create mode 100644 include/vsc9953.h
doc/README.t1040-l2switch new file +49 -0
new file mode 100644
index 0000000..6324f18
@@ -0,0 +1,49 @@
+This file contains information for VSC9953, a Vitesse L2 Switch IP
+which is integrated in the T1040/T1020 Freescale SoCs.
+
+About Device:
+=============
+VSC9953 is an 8-port Gigabit Ethernet switch supports the following features:
+	-	8192 MAC addresses
+	-	Static Address provisioning
+	-	Dynamic learning of MAC addresses and aging
+	-	4096 VLANs
+	-	Independent and shared VLAN learning (IVL, SVL)
+	-	Policing with storm control and MC/BC protection
+	-	IPv4 and IPv6 multicast
+	-	Jumbo frames (9.6 KB)
+	-	Access Control List
+	-	VLAN editing, translation and remarking
+	-	RMON counters per port
+
+Switch interfaces:
+	-	8 Gigabit switch ports (ports 0 to 7) are external and are connected to external PHYs
+	-	2 switch ports (ports 8 and 9) of 2.5 G are connected (fixed links)
+		to FMan ports (FM1 at DTSEC1 and FM1 at DTSEC2)
+
+Commands Overview:
+=============
+Commands supported
+	- enable/disable a port
+	- check a port's link speed, duplexity and status.
+
+Commands syntax
+	ethsw port <port_nr> enable|disable		- enable/disable an l2 switch port
+	ethsw port <port_nr> show			- show an l2 switch port's configuration
+
+	port_nr=0..9; use "all" for all ports
+
+=> ethsw port all show
+    Port   Status     Link    Speed   Duplex
+       0  enabled     down       10     half
+       1  enabled     down       10     half
+       2  enabled     down       10     half
+       3  enabled       up     1000     full
+       4 disabled     down        -     half
+       5 disabled     down        -     half
+       6 disabled     down        -     half
+       7 disabled     down        -     half
+       8  enabled       up     2500     full
+       9  enabled       up     2500     full
+=>
+
drivers/net/Makefile +1 -0
index fb0cf8c..46c4ac6 100644
@@ -66,3 +66,4 @@ obj-$(CONFIG_XILINX_LL_TEMAC) += xilinx_ll_temac.o xilinx_ll_temac_mdio.o \
 		xilinx_ll_temac_fifo.o xilinx_ll_temac_sdma.o
 obj-$(CONFIG_ZYNQ_GEM) += zynq_gem.o
 obj-$(CONFIG_FSL_MC_ENET) += fsl_mc/
+obj-$(CONFIG_VSC9953) += vsc9953.o
drivers/net/vsc9953.c new file +497 -0

497 lines not on this page · raw message

include/vsc9953.h new file +402 -0

402 lines not on this page · raw message

Signature · 1 line
1.7.11.7
#10 lore raw

PATCH v3 5/11 net/vsc9953: Add driver for Vitesse VSC9953 L2 Switch IP

Quoted 12 lines · Codrin Ciubotariu

This patch adds a driver for VSC9953 L2 Switch. This Vitesse IP is integrated in Freescale T1040 and T1020 SoCs.
The L2 switch has 10 Ethernet ports: 2 internal fixed-links (ports 8 and 9) at 2.5 Gbps and and 8 external ports at 1 Gbps. The external ports may be connected to PHYs over QSGMII and SGMII.

Commands have also been added to enable/disable a port and to check a port's link speed, duplexity and status. The commands are:

ethsw port <port_nr> enable|disable - enable/disable an l2 switch port ethsw port <port_nr> show - show an l2 switch port's configuration

Quoted 7 lines

port_nr=0..9; use "all" for all ports

For more detailse please see doc/README.t1040-l2switch

---

Joe,

I am trying to bring in this patch. Please let me know if you have any comment.
http://patchwork.ozlabs.org/patch/427693/

York

#11 lore raw

PATCH v3 5/11 net/vsc9953: Add driver for Vitesse VSC9953 L2 Switch IP

In reply to Codrin Ciubotariu
Quoted 80 lines · Codrin Ciubotariu

This patch adds a driver for VSC9953 L2 Switch. This Vitesse IP is integrated in Freescale T1040 and T1020 SoCs.
The L2 switch has 10 Ethernet ports: 2 internal fixed-links (ports 8 and 9) at 2.5 Gbps and and 8 external ports at 1 Gbps. The external ports may be connected to PHYs over QSGMII and SGMII.

Commands have also been added to enable/disable a port and to check a port's link speed, duplexity and status. The commands are:

ethsw port <port_nr> enable|disable - enable/disable an l2 switch port ethsw port <port_nr> show - show an l2 switch port's configuration

port_nr=0..9; use "all" for all ports

For more detailse please see doc/README.t1040-l2switch

---

Changes for v2:
- added debug messages if MDIO reads or writes timeout;
- added debug messages when reset of VSC9953 switch fails;
- replaced Copyright and license to the generic one;

Changes for v3: Removed "Change-id" line from comment;

 doc/README.t1040-l2switch |  49 +++++
 drivers/net/Makefile      |   1 +
 drivers/net/vsc9953.c     | 497 ++++++++++++++++++++++++++++++++++++++++++++++
 include/vsc9953.h         | 402 +++++++++++++++++++++++++++++++++++++
 4 files changed, 949 insertions(+)
 create mode 100644 doc/README.t1040-l2switch
 create mode 100644 drivers/net/vsc9953.c
 create mode 100644 include/vsc9953.h
doc/README.t1040-l2switch new file +39 -0
new file mode 100644
index 0000000..6324f18
@@ -0,0 +1,49 @@
+This file contains information for VSC9953, a Vitesse L2 Switch IP
+which is integrated in the T1040/T1020 Freescale SoCs.
+
+About Device:
+=============
+VSC9953 is an 8-port Gigabit Ethernet switch supports the following features:
+	-	8192 MAC addresses
+	-	Static Address provisioning
+	-	Dynamic learning of MAC addresses and aging
+	-	4096 VLANs
+	-	Independent and shared VLAN learning (IVL, SVL)
+	-	Policing with storm control and MC/BC protection
+	-	IPv4 and IPv6 multicast
+	-	Jumbo frames (9.6 KB)
+	-	Access Control List
+	-	VLAN editing, translation and remarking
+	-	RMON counters per port
+
+Switch interfaces:
+	-	8 Gigabit switch ports (ports 0 to 7) are external and are connected to external PHYs
+	-	2 switch ports (ports 8 and 9) of 2.5 G are connected (fixed links)
+		to FMan ports (FM1 at DTSEC1 and FM1 at DTSEC2)
+
+Commands Overview:
+=============
+Commands supported
+	- enable/disable a port
+	- check a port's link speed, duplexity and status.
+
+Commands syntax
+	ethsw port <port_nr> enable|disable		- enable/disable an l2 switch port
+	ethsw port <port_nr> show			- show an l2 switch port's configuration
+
+	port_nr=0..9; use "all" for all ports
+
+=> ethsw port all show
+    Port   Status     Link    Speed   Duplex
+       0  enabled     down       10     half
+       1  enabled     down       10     half

doc/README.t1040-l2switch line 49

Quoted 10 lines
doc/README.t1040-l2switch new file +10 -0
+       2  enabled     down       10     half
+       3  enabled       up     1000     full
+       4 disabled     down        -     half
+       5 disabled     down        -     half
+       6 disabled     down        -     half
+       7 disabled     down        -     half
+       8  enabled       up     2500     full
+       9  enabled       up     2500     full
+=>
+

Extra line at the end. No need to respin the patch. I can remove it when I apply the patch.

York

#12 lore raw

PATCH v3 5/11 net/vsc9953: Add driver for Vitesse VSC9953 L2 Switch IP

In reply to Codrin Ciubotariu
Quoted 10 lines · Codrin Ciubotariu

This patch adds a driver for VSC9953 L2 Switch. This Vitesse IP is integrated in Freescale T1040 and T1020 SoCs.
The L2 switch has 10 Ethernet ports: 2 internal fixed-links (ports 8 and 9) at 2.5 Gbps and and 8 external ports at 1 Gbps. The external ports may be connected to PHYs over QSGMII and SGMII.

Commands have also been added to enable/disable a port and to check a port's link speed, duplexity and status. The commands are:

Quoted 8 lines

ethsw port <port_nr> enable|disable - enable/disable an l2 switch port ethsw port <port_nr> show - show an l2 switch port's configuration

port_nr=0..9; use "all" for all ports

For more detailse please see doc/README.t1040-l2switch

#13 lore raw

PATCH v3 5/11 net/vsc9953: Add driver for Vitesse VSC9953 L2 Switch IP

In reply to Codrin Ciubotariu
Quoted 17 lines · Codrin Ciubotariu

This patch adds a driver for VSC9953 L2 Switch. This Vitesse IP is integrated in Freescale T1040 and T1020 SoCs.
The L2 switch has 10 Ethernet ports: 2 internal fixed-links (ports 8 and 9) at 2.5 Gbps and and 8 external ports at 1 Gbps. The external ports may be connected to PHYs over QSGMII and SGMII.

Commands have also been added to enable/disable a port and to check a port's link speed, duplexity and status. The commands are:

ethsw port <port_nr> enable|disable - enable/disable an l2 switch port ethsw port <port_nr> show - show an l2 switch port's configuration

port_nr=0..9; use "all" for all ports

For more detailse please see doc/README.t1040-l2switch

Quoted 9 lines

---

Changes for v2:
- added debug messages if MDIO reads or writes timeout;
- added debug messages when reset of VSC9953 switch fails;
- replaced Copyright and license to the generic one;

Changes for v3: Removed "Change-id" line from comment;

Applied to u-boot-mpc85xx master branch, awaiting upstream.

York

#14 lore raw

PATCH v3 6/11 arch/powerpc: Enable VSC9953 driver on T1040 and T1020

In reply to Codrin Ciubotariu

T1040 and T1020 are two Freescale SoCs with an integrated VSC9953 Gigabit L2 Switch. This patch initializes this L2 switch on boards with T1040 and T1020.

---

Changes for v2:
- added patch description;

Changes for v3:
- Removed "Change-id" line from comment;

 arch/powerpc/cpu/mpc8xxx/cpu.c            | 5 +++++
 arch/powerpc/include/asm/config_mpc85xx.h | 3 +++
 2 files changed, 8 insertions(+)
arch/powerpc/cpu/mpc8xxx/cpu.c +5 -0
index 2d28eb2..c92589f 100644
@@ -15,6 +15,7 @@
 #include <netdev.h>
 #include <asm/cache.h>
 #include <asm/io.h>
+#include <vsc9953.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -271,5 +272,9 @@ int cpu_eth_init(bd_t *bis)
 #ifdef CONFIG_FMAN_ENET
 	fm_standard_init(bis);
 #endif
+
+#ifdef CONFIG_VSC9953
+	vsc9953_init(bis);
+#endif
 	return 0;
 }
arch/powerpc/include/asm/config_mpc85xx.h +3 -0
index 01b0905..79caac1 100644
@@ -747,6 +747,9 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define CONFIG_SYS_FSL_QORIQ_CHASSIS2	/* Freescale Chassis generation 2 */
 #define CONFIG_SYS_FSL_CORES_PER_CLUSTER 1
 #define CONFIG_SYS_FSL_QMAN_V3		/* QMAN version 3 */
+#if defined(CONFIG_PPC_T1040) || defined(CONFIG_PPC_T1020)
+#define CONFIG_VSC9953			/* Vitesse L2 Switch */
+#endif
 #ifdef CONFIG_SYS_FSL_DDR4
 #define CONFIG_SYS_FSL_DDRC_GEN4
 #endif
Signature · 1 line
1.7.11.7
#15 lore raw

PATCH v3 6/11 arch/powerpc: Enable VSC9953 driver on T1040 and T1020

Quoted 45 lines · Codrin Ciubotariu

T1040 and T1020 are two Freescale SoCs with an integrated VSC9953 Gigabit L2 Switch. This patch initializes this L2 switch on boards with T1040 and T1020.

---

Changes for v2:
- added patch description;

Changes for v3:
- Removed "Change-id" line from comment;

 arch/powerpc/cpu/mpc8xxx/cpu.c            | 5 +++++
 arch/powerpc/include/asm/config_mpc85xx.h | 3 +++
 2 files changed, 8 insertions(+)
arch/powerpc/cpu/mpc8xxx/cpu.c +5 -0
index 2d28eb2..c92589f 100644
@@ -15,6 +15,7 @@
 #include <netdev.h>
 #include <asm/cache.h>
 #include <asm/io.h>
+#include <vsc9953.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -271,5 +272,9 @@ int cpu_eth_init(bd_t *bis)
 #ifdef CONFIG_FMAN_ENET
 	fm_standard_init(bis);
 #endif
+
+#ifdef CONFIG_VSC9953
+	vsc9953_init(bis);
+#endif
 	return 0;
 }
arch/powerpc/include/asm/config_mpc85xx.h +0 -0
index 01b0905..79caac1 100644

arch/powerpc/include/asm/config_mpc85xx.h defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022) · line 755

Quoted 9 lines
arch/powerpc/include/asm/config_mpc85xx.h +3 -0
@@ -747,6 +747,9 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
 #define CONFIG_SYS_FSL_QORIQ_CHASSIS2	/* Freescale Chassis generation 2 */
 #define CONFIG_SYS_FSL_CORES_PER_CLUSTER 1
 #define CONFIG_SYS_FSL_QMAN_V3		/* QMAN version 3 */
+#if defined(CONFIG_PPC_T1040) || defined(CONFIG_PPC_T1020)
+#define CONFIG_VSC9953			/* Vitesse L2 Switch */
+#endif
 #ifdef CONFIG_SYS_FSL_DDR4
 #define CONFIG_SYS_FSL_DDRC_GEN4
 #endif

Codrin,

A question, do you want to enable the L2 switch regardless if the ports are connected on the board? Would it be better to enable the feature in board header file?

York

#16 lore raw

PATCH v3 7/11 board/T1040qds: Fix lane-to-slot mapping for SerDes protocol 0x89

In reply to Codrin Ciubotariu

---

Changes for v2: None

Changes for v3:
- Removed "Change-id" line from comment;

 board/freescale/t1040qds/eth.c | 1 +
 1 file changed, 1 insertion(+)
board/freescale/t1040qds/eth.c +1 -0
index 06d9086..c6fc146 100644
@@ -216,6 +216,7 @@ static void initialize_lane_to_slot(void)
 		lane_to_slot[1] = 7;
 		lane_to_slot[2] = 7;
 		lane_to_slot[3] = 7;
+		lane_to_slot[6] = 7;
 		lane_to_slot[7] = 7;
 		break;
 	case 0x8d:
Signature · 1 line
1.7.11.7
#17 lore raw

PATCH v3 7/11 board/T1040qds: Fix lane-to-slot mapping for SerDes protocol 0x89

Quoted 8 lines · Codrin Ciubotariu

---

Changes for v2: None

Changes for v3:
- Removed "Change-id" line from comment;

Applied to u-boot-mpc85xx master branch, awaiting upstream.

York

#18 lore raw

PATCH v3 8/11 board/T1040qds: T1040 FMAN ports FM1@DTSEC1 and FM1@DTSEC2 have no PHYs

In reply to Codrin Ciubotariu

Freescale's T1040qds board may be configured to have up to 5 FMAN ports (FM1 at DTSEC1 to FM1 at DTSEC5). From these 5 ports, 2 of them may be fixed-links (FM1 at DTSEC1 annd FM1 at DTSEC2), connected to other two ports from an intergrated VSC9953 L2 Switch (switch ports 8 and 9). These fixed-link ports have no PHYs attatched, so they don't have a corresponding MDIO.

---

Changes for v2:
- added patch description;

Changes for v3:
- Removed "Change-id" line from comment;

 board/freescale/t1040qds/eth.c | 1 +
 1 file changed, 1 insertion(+)
board/freescale/t1040qds/eth.c +1 -0
index c6fc146..2f8e753 100644
@@ -478,6 +478,7 @@ int board_eth_init(bd_t *bis)
 	for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
 		switch (fm_info_get_enet_if(i)) {
 		case PHY_INTERFACE_MODE_QSGMII:
+			fm_info_set_mdio(i, NULL);
 			break;
 		case PHY_INTERFACE_MODE_SGMII:
 			t1040_handle_phy_interface_sgmii(i);
Signature · 1 line
1.7.11.7
#19 lore raw

PATCH v3 8/11 board/T1040qds: T1040 FMAN ports FM1@DTSEC1 and FM1@DTSEC2 have no PHYs

Quoted 8 lines · Codrin Ciubotariu

Freescale's T1040qds board may be configured to have up to 5 FMAN ports (FM1 at DTSEC1 to FM1 at DTSEC5). From these 5 ports, 2 of them may be fixed-links (FM1 at DTSEC1 annd FM1 at DTSEC2), connected to other two ports from an intergrated VSC9953 L2 Switch (switch ports 8 and 9). These fixed-link ports have no PHYs attatched, so they don't have a corresponding MDIO.

Quoted 9 lines

---

Changes for v2:
- added patch description;

Changes for v3:
- Removed "Change-id" line from comment;

Applied to u-boot-mpc85xx master branch, awaiting upstream.

York

#20 lore raw

PATCH v3 9/11 board/T104xrdb: T1040 FMAN ports FM1@DTSEC1 and FM1@DTSEC2 have no PHYs

In reply to Codrin Ciubotariu

Freescale's T1040qds board may be configured to have up to 5 FMAN ports (FM1 at DTSEC1 to FM1 at DTSEC5). From these 5 ports, 2 of them may be fixed-links (FM1 at DTSEC1 annd FM1 at DTSEC2), connected to other two ports from an intergrated VSC9953 L2 Switch (switch ports 8 and 9). These fixed-link ports have no PHYs attatched, so they don't have a corresponding MDIO.

---

Changes for v2:
- Added patch description;

Changes for v3:
- Removed "Change-id" line from comment;

 board/freescale/t104xrdb/eth.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
board/freescale/t104xrdb/eth.c +7 -2
index c8b6c67..f5c0ec8 100644
@@ -72,8 +72,13 @@ int board_eth_init(bd_t *bis)
 			fm_info_set_phy_address(i, 0);
 			break;
 		}
-		fm_info_set_mdio(i,
-				 miiphy_get_dev_by_name(DEFAULT_FM_MDIO_NAME));
+		if (fm_info_get_enet_if(i) == PHY_INTERFACE_MODE_QSGMII ||
+		    fm_info_get_enet_if(i) == PHY_INTERFACE_MODE_NONE)
+			fm_info_set_mdio(i, NULL);
+		else
+			fm_info_set_mdio(i,
+					 miiphy_get_dev_by_name(
+							DEFAULT_FM_MDIO_NAME));
 	}
 
 	cpu_eth_init(bis);
Signature · 1 line
1.7.11.7
#21 lore raw

PATCH v3 9/11 board/T104xrdb: T1040 FMAN ports FM1@DTSEC1 and FM1@DTSEC2 have no PHYs

Quoted 8 lines · Codrin Ciubotariu

Freescale's T1040qds board may be configured to have up to 5 FMAN ports (FM1 at DTSEC1 to FM1 at DTSEC5). From these 5 ports, 2 of them may be fixed-links (FM1 at DTSEC1 annd FM1 at DTSEC2), connected to other two ports from an intergrated VSC9953 L2 Switch (switch ports 8 and 9). These fixed-link ports have no PHYs attatched, so they don't have a corresponding MDIO.

Quoted 9 lines

---

Changes for v2:
- Added patch description;

Changes for v3:
- Removed "Change-id" line from comment;

Applied to u-boot-mpc85xx master branch, awaiting upstream.

York

#22 lore raw

PATCH v3 10/11 board/T1040qds: Add VSC9953 support for T1040qds board

In reply to Codrin Ciubotariu

This patch configures and initializes the L2 switch on T1040QDS board. The L2 switch ports must be initialized according to the SerDes protocols.

---

Changes for v2: None

Changes for v3:
- Removed "Change-id" line from comment;

 board/freescale/t1040qds/eth.c | 91 ++++++++++++++++++++++++++++++++++++++++++
 include/configs/T1040QDS.h     |  4 ++
 2 files changed, 95 insertions(+)
board/freescale/t1040qds/eth.c +91 -0
index 2f8e753..8c82934 100644
@@ -18,6 +18,7 @@
 #include <fsl_mdio.h>
 #include <malloc.h>
 #include <asm/fsl_dtsec.h>
+#include <vsc9953.h>
 
 #include "../common/fman.h"
 #include "../common/qixis.h"
@@ -439,6 +440,12 @@ int board_eth_init(bd_t *bis)
 #ifdef CONFIG_FMAN_ENET
 	struct memac_mdio_info memac_mdio_info;
 	unsigned int i;
+#ifdef CONFIG_VSC9953
+	int lane;
+	int phy_addr;
+	phy_interface_t phy_int;
+	struct mii_dev *bus;
+#endif
 
 	printf("Initializing Fman\n");
 	set_brdcfg9_for_gtx_clk();
@@ -493,6 +500,90 @@ int board_eth_init(bd_t *bis)
 		}
 	}
 
+#ifdef CONFIG_VSC9953
+	for (i = 0; i < VSC9953_MAX_PORTS; i++) {
+		lane = -1;
+		phy_addr = 0;
+		phy_int = PHY_INTERFACE_MODE_NONE;
+		switch (i) {
+		case 0:
+		case 1:
+		case 2:
+		case 3:
+			lane = serdes_get_first_lane(FSL_SRDS_1, QSGMII_SW1_A);
+			/* PHYs connected over QSGMII */
+			if (lane >= 0) {
+				phy_addr = CONFIG_SYS_FM1_QSGMII21_PHY_ADDR +
+						i;
+				phy_int = PHY_INTERFACE_MODE_QSGMII;
+				break;
+			}
+			lane = serdes_get_first_lane(FSL_SRDS_1,
+					SGMII_SW1_MAC1 + i);
+
+			if (lane < 0)
+				break;
+
+			/* PHYs connected over QSGMII */
+			if (i != 3 || lane_to_slot[lane] == 7)
+				phy_addr = CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR
+					+ i;
+			else
+				phy_addr = CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR;
+			phy_int = PHY_INTERFACE_MODE_SGMII;
+			break;
+		case 4:
+		case 5:
+		case 6:
+		case 7:
+			lane = serdes_get_first_lane(FSL_SRDS_1, QSGMII_SW1_B);
+			/* PHYs connected over QSGMII */
+			if (lane >= 0) {
+				phy_addr = CONFIG_SYS_FM1_QSGMII11_PHY_ADDR +
+						i - 4;
+				phy_int = PHY_INTERFACE_MODE_QSGMII;
+				break;
+			}
+			lane = serdes_get_first_lane(FSL_SRDS_1,
+					SGMII_SW1_MAC1 + i);
+			/* PHYs connected over SGMII */
+			if (lane >= 0) {
+				phy_addr = CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR
+						+ i - 3;
+				phy_int = PHY_INTERFACE_MODE_SGMII;
+			}
+			break;
+		case 8:
+			if (serdes_get_first_lane(FSL_SRDS_1,
+						  SGMII_FM1_DTSEC1) < 0)
+				/* FM1 at DTSEC1 is connected to SW1@PORT8 */
+				vsc9953_port_enable(i);
+			break;
+		case 9:
+			if (serdes_get_first_lane(FSL_SRDS_1,
+						  SGMII_FM1_DTSEC2) < 0) {
+				/* Enable L2 On MAC2 using SCFG */
+				struct ccsr_scfg *scfg = (struct ccsr_scfg *)
+						CONFIG_SYS_MPC85xx_SCFG;
+
+				out_be32(&scfg->esgmiiselcr,
+					 in_be32(&scfg->esgmiiselcr) |
+					 (0x80000000));
+				vsc9953_port_enable(i);
+			}
+			break;
+		}
+
+		if (lane >= 0) {
+			bus = mii_dev_for_muxval(lane_to_slot[lane]);
+			vsc9953_port_info_set_mdio(i, bus);
+			vsc9953_port_enable(i);
+		}
+		vsc9953_port_info_set_phy_address(i, phy_addr);
+		vsc9953_port_info_set_phy_int(i, phy_int);
+	}
+
+#endif
 	cpu_eth_init(bis);
 #endif
 
include/configs/T1040QDS.h +4 -0
index b70bdfe..5b7c3c4 100644
@@ -689,6 +689,10 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_PHY_GIGE		/* Include GbE speed/duplex detection */
 #endif
 
+#define CONFIG_VSC9953_CMD
+#define CONFIG_SYS_FM1_QSGMII11_PHY_ADDR	0x14
+#define CONFIG_SYS_FM1_QSGMII21_PHY_ADDR	0x18
+
 /*
  * Dynamic MTD Partition support with mtdparts
  */
Signature · 1 line
1.7.11.7
#23 lore raw

PATCH v3 11/11 board/T1040rdb: Add VSC9953 support for T1040rdb board

In reply to Codrin Ciubotariu

This patch configures and initializes the L2 switch on T1040rdb board. The external L2 switch ports may be connected to PHYs only over QSGMII, for T1040rdb.

---

Changes for v2: None

Changed for v3:
- Removed "Change-id" line from comment;

 board/freescale/t104xrdb/eth.c | 50 ++++++++++++++++++++++++++++++++++++++++++
 include/configs/T104xRDB.h     |  6 +++++
 2 files changed, 56 insertions(+)
board/freescale/t104xrdb/eth.c +50 -0
index f5c0ec8..7581a4cd 100644
@@ -6,11 +6,13 @@
 
 #include <common.h>
 #include <netdev.h>
+#include <asm/fsl_serdes.h>
 #include <asm/immap_85xx.h>
 #include <fm_eth.h>
 #include <fsl_mdio.h>
 #include <malloc.h>
 #include <asm/fsl_dtsec.h>
+#include <vsc9953.h>
 
 #include "../common/fman.h"
 
@@ -20,6 +22,11 @@ int board_eth_init(bd_t *bis)
 	struct memac_mdio_info memac_mdio_info;
 	unsigned int i;
 	int phy_addr = 0;
+#ifdef CONFIG_VSC9953
+	phy_interface_t phy_int;
+	struct mii_dev *bus;
+#endif
+
 	printf("Initializing Fman\n");
 
 	memac_mdio_info.regs =
@@ -81,6 +88,49 @@ int board_eth_init(bd_t *bis)
 							DEFAULT_FM_MDIO_NAME));
 	}
 
+#ifdef CONFIG_VSC9953
+	/* SerDes configured for QSGMII */
+	if (serdes_get_first_lane(FSL_SRDS_1, QSGMII_SW1_A) >= 0) {
+		for (i = 0; i < 4; i++) {
+			bus = miiphy_get_dev_by_name(DEFAULT_FM_MDIO_NAME);
+			phy_addr = CONFIG_SYS_FM1_QSGMII11_PHY_ADDR + i;
+			phy_int = PHY_INTERFACE_MODE_QSGMII;
+
+			vsc9953_port_info_set_mdio(i, bus);
+			vsc9953_port_info_set_phy_address(i, phy_addr);
+			vsc9953_port_info_set_phy_int(i, phy_int);
+			vsc9953_port_enable(i);
+		}
+	}
+	if (serdes_get_first_lane(FSL_SRDS_1, QSGMII_SW1_B) >= 0) {
+		for (i = 4; i < 8; i++) {
+			bus = miiphy_get_dev_by_name(DEFAULT_FM_MDIO_NAME);
+			phy_addr = CONFIG_SYS_FM1_QSGMII21_PHY_ADDR + i - 4;
+			phy_int = PHY_INTERFACE_MODE_QSGMII;
+
+			vsc9953_port_info_set_mdio(i, bus);
+			vsc9953_port_info_set_phy_address(i, phy_addr);
+			vsc9953_port_info_set_phy_int(i, phy_int);
+			vsc9953_port_enable(i);
+		}
+	}
+
+	/* Connect DTSEC1 to L2 switch if it doesn't have a PHY */
+	if (serdes_get_first_lane(FSL_SRDS_1, SGMII_FM1_DTSEC1) < 0)
+		vsc9953_port_enable(8);
+
+	/* Connect DTSEC2 to L2 switch if it doesn't have a PHY */
+	if (serdes_get_first_lane(FSL_SRDS_1, SGMII_FM1_DTSEC2) < 0) {
+		/* Enable L2 On MAC2 using SCFG */
+		struct ccsr_scfg *scfg = (struct ccsr_scfg *)
+				CONFIG_SYS_MPC85xx_SCFG;
+
+		out_be32(&scfg->esgmiiselcr, in_be32(&scfg->esgmiiselcr) |
+			 (0x80000000));
+		vsc9953_port_enable(9);
+	}
+#endif
+
 	cpu_eth_init(bis);
 #endif
 
include/configs/T104xRDB.h +6 -0
index 57cdf72..c77b5d5 100644
@@ -726,6 +726,12 @@
 #define CONFIG_SYS_RGMII1_PHY_ADDR		0x01
 #define CONFIG_SYS_RGMII2_PHY_ADDR		0x02
 
+#ifdef CONFIG_T1040RDB
+#define CONFIG_VSC9953_CMD
+#define CONFIG_SYS_FM1_QSGMII11_PHY_ADDR	0x04
+#define CONFIG_SYS_FM1_QSGMII21_PHY_ADDR	0x08
+#endif
+
 #define CONFIG_MII		/* MII PHY management */
 #define CONFIG_ETHPRIME		"FM1 at DTSEC4"
 #define CONFIG_PHY_GIGE		/* Include GbE speed/duplex detection */
Signature · 1 line
1.7.11.7