xref: /openbmc/u-boot/board/freescale/t1040qds/eth.c (revision 83d290c56fab2d38cd1ab4c4cc7099559c1d5046)
1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
25b7672fcSPrabhakar Kushwaha /*
35b7672fcSPrabhakar Kushwaha  * Copyright 2013 Freescale Semiconductor, Inc.
45b7672fcSPrabhakar Kushwaha  */
55b7672fcSPrabhakar Kushwaha 
65b7672fcSPrabhakar Kushwaha /*
75b7672fcSPrabhakar Kushwaha  * The RGMII PHYs are provided by the two on-board PHY connected to
85b7672fcSPrabhakar Kushwaha  * dTSEC instances 4 and 5. The SGMII PHYs are provided by one on-board
95b7672fcSPrabhakar Kushwaha  * PHY or by the standard four-port SGMII riser card (VSC).
105b7672fcSPrabhakar Kushwaha  */
115b7672fcSPrabhakar Kushwaha 
125b7672fcSPrabhakar Kushwaha #include <common.h>
135b7672fcSPrabhakar Kushwaha #include <netdev.h>
145b7672fcSPrabhakar Kushwaha #include <asm/fsl_serdes.h>
155b7672fcSPrabhakar Kushwaha #include <asm/immap_85xx.h>
165b7672fcSPrabhakar Kushwaha #include <fm_eth.h>
175b7672fcSPrabhakar Kushwaha #include <fsl_mdio.h>
185b7672fcSPrabhakar Kushwaha #include <malloc.h>
198225b2fdSShaohui Xie #include <fsl_dtsec.h>
20a83fccc2SCodrin Ciubotariu #include <vsc9953.h>
215b7672fcSPrabhakar Kushwaha 
225b7672fcSPrabhakar Kushwaha #include "../common/fman.h"
235b7672fcSPrabhakar Kushwaha #include "../common/qixis.h"
245b7672fcSPrabhakar Kushwaha 
255b7672fcSPrabhakar Kushwaha #include "t1040qds_qixis.h"
265b7672fcSPrabhakar Kushwaha 
275b7672fcSPrabhakar Kushwaha #ifdef CONFIG_FMAN_ENET
285b7672fcSPrabhakar Kushwaha  /* - In T1040 there are only 8 SERDES lanes, spread across 2 SERDES banks.
295b7672fcSPrabhakar Kushwaha  *   Bank 1 -> Lanes A, B, C, D
305b7672fcSPrabhakar Kushwaha  *   Bank 2 -> Lanes E, F, G, H
315b7672fcSPrabhakar Kushwaha  */
325b7672fcSPrabhakar Kushwaha 
335b7672fcSPrabhakar Kushwaha  /* Mapping of 8 SERDES lanes to T1040 QDS board slots. A value of '0' here
345b7672fcSPrabhakar Kushwaha   * means that the mapping must be determined dynamically, or that the lane
355b7672fcSPrabhakar Kushwaha   * maps to something other than a board slot.
365b7672fcSPrabhakar Kushwaha   */
375b7672fcSPrabhakar Kushwaha static u8 lane_to_slot[] = {
385b7672fcSPrabhakar Kushwaha 	0, 0, 0, 0, 0, 0, 0, 0
395b7672fcSPrabhakar Kushwaha };
405b7672fcSPrabhakar Kushwaha 
415b7672fcSPrabhakar Kushwaha /* On the Vitesse VSC8234XHG SGMII riser card there are 4 SGMII PHYs
425b7672fcSPrabhakar Kushwaha  * housed.
435b7672fcSPrabhakar Kushwaha  */
445b7672fcSPrabhakar Kushwaha static int riser_phy_addr[] = {
455b7672fcSPrabhakar Kushwaha 	CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR,
465b7672fcSPrabhakar Kushwaha 	CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR,
475b7672fcSPrabhakar Kushwaha 	CONFIG_SYS_FM1_DTSEC3_RISER_PHY_ADDR,
485b7672fcSPrabhakar Kushwaha 	CONFIG_SYS_FM1_DTSEC4_RISER_PHY_ADDR,
495b7672fcSPrabhakar Kushwaha };
505b7672fcSPrabhakar Kushwaha 
515b7672fcSPrabhakar Kushwaha /* Slot2 does not have EMI connections */
525b7672fcSPrabhakar Kushwaha #define EMI_NONE	0xFFFFFFFF
535b7672fcSPrabhakar Kushwaha #define EMI1_RGMII0	0
545b7672fcSPrabhakar Kushwaha #define EMI1_RGMII1	1
555b7672fcSPrabhakar Kushwaha #define EMI1_SLOT1	2
565b7672fcSPrabhakar Kushwaha #define EMI1_SLOT3	3
575b7672fcSPrabhakar Kushwaha #define EMI1_SLOT4	4
585b7672fcSPrabhakar Kushwaha #define EMI1_SLOT5	5
595b7672fcSPrabhakar Kushwaha #define EMI1_SLOT6	6
605b7672fcSPrabhakar Kushwaha #define EMI1_SLOT7	7
615b7672fcSPrabhakar Kushwaha #define EMI2		8
625b7672fcSPrabhakar Kushwaha 
635b7672fcSPrabhakar Kushwaha static int mdio_mux[NUM_FM_PORTS];
645b7672fcSPrabhakar Kushwaha 
655b7672fcSPrabhakar Kushwaha static const char * const mdio_names[] = {
665b7672fcSPrabhakar Kushwaha 	"T1040_QDS_MDIO0",
675b7672fcSPrabhakar Kushwaha 	"T1040_QDS_MDIO1",
685b7672fcSPrabhakar Kushwaha 	"T1040_QDS_MDIO2",
695b7672fcSPrabhakar Kushwaha 	"T1040_QDS_MDIO3",
705b7672fcSPrabhakar Kushwaha 	"T1040_QDS_MDIO4",
715b7672fcSPrabhakar Kushwaha 	"T1040_QDS_MDIO5",
725b7672fcSPrabhakar Kushwaha 	"T1040_QDS_MDIO6",
735b7672fcSPrabhakar Kushwaha 	"T1040_QDS_MDIO7",
745b7672fcSPrabhakar Kushwaha };
755b7672fcSPrabhakar Kushwaha 
765b7672fcSPrabhakar Kushwaha struct t1040_qds_mdio {
775b7672fcSPrabhakar Kushwaha 	u8 muxval;
785b7672fcSPrabhakar Kushwaha 	struct mii_dev *realbus;
795b7672fcSPrabhakar Kushwaha };
805b7672fcSPrabhakar Kushwaha 
t1040_qds_mdio_name_for_muxval(u8 muxval)815b7672fcSPrabhakar Kushwaha static const char *t1040_qds_mdio_name_for_muxval(u8 muxval)
825b7672fcSPrabhakar Kushwaha {
835b7672fcSPrabhakar Kushwaha 	return mdio_names[muxval];
845b7672fcSPrabhakar Kushwaha }
855b7672fcSPrabhakar Kushwaha 
mii_dev_for_muxval(u8 muxval)865b7672fcSPrabhakar Kushwaha struct mii_dev *mii_dev_for_muxval(u8 muxval)
875b7672fcSPrabhakar Kushwaha {
885b7672fcSPrabhakar Kushwaha 	struct mii_dev *bus;
895b7672fcSPrabhakar Kushwaha 	const char *name = t1040_qds_mdio_name_for_muxval(muxval);
905b7672fcSPrabhakar Kushwaha 
915b7672fcSPrabhakar Kushwaha 	if (!name) {
925b7672fcSPrabhakar Kushwaha 		printf("No bus for muxval %x\n", muxval);
935b7672fcSPrabhakar Kushwaha 		return NULL;
945b7672fcSPrabhakar Kushwaha 	}
955b7672fcSPrabhakar Kushwaha 
965b7672fcSPrabhakar Kushwaha 	bus = miiphy_get_dev_by_name(name);
975b7672fcSPrabhakar Kushwaha 
985b7672fcSPrabhakar Kushwaha 	if (!bus) {
995b7672fcSPrabhakar Kushwaha 		printf("No bus by name %s\n", name);
1005b7672fcSPrabhakar Kushwaha 		return NULL;
1015b7672fcSPrabhakar Kushwaha 	}
1025b7672fcSPrabhakar Kushwaha 
1035b7672fcSPrabhakar Kushwaha 	return bus;
1045b7672fcSPrabhakar Kushwaha }
1055b7672fcSPrabhakar Kushwaha 
t1040_qds_mux_mdio(u8 muxval)1065b7672fcSPrabhakar Kushwaha static void t1040_qds_mux_mdio(u8 muxval)
1075b7672fcSPrabhakar Kushwaha {
1085b7672fcSPrabhakar Kushwaha 	u8 brdcfg4;
1095b7672fcSPrabhakar Kushwaha 	if (muxval <= 7) {
1105b7672fcSPrabhakar Kushwaha 		brdcfg4 = QIXIS_READ(brdcfg[4]);
1115b7672fcSPrabhakar Kushwaha 		brdcfg4 &= ~BRDCFG4_EMISEL_MASK;
1125b7672fcSPrabhakar Kushwaha 		brdcfg4 |= (muxval << BRDCFG4_EMISEL_SHIFT);
1135b7672fcSPrabhakar Kushwaha 		QIXIS_WRITE(brdcfg[4], brdcfg4);
1145b7672fcSPrabhakar Kushwaha 	}
1155b7672fcSPrabhakar Kushwaha }
1165b7672fcSPrabhakar Kushwaha 
t1040_qds_mdio_read(struct mii_dev * bus,int addr,int devad,int regnum)1175b7672fcSPrabhakar Kushwaha static int t1040_qds_mdio_read(struct mii_dev *bus, int addr, int devad,
1185b7672fcSPrabhakar Kushwaha 				int regnum)
1195b7672fcSPrabhakar Kushwaha {
1205b7672fcSPrabhakar Kushwaha 	struct t1040_qds_mdio *priv = bus->priv;
1215b7672fcSPrabhakar Kushwaha 
1225b7672fcSPrabhakar Kushwaha 	t1040_qds_mux_mdio(priv->muxval);
1235b7672fcSPrabhakar Kushwaha 
1245b7672fcSPrabhakar Kushwaha 	return priv->realbus->read(priv->realbus, addr, devad, regnum);
1255b7672fcSPrabhakar Kushwaha }
1265b7672fcSPrabhakar Kushwaha 
t1040_qds_mdio_write(struct mii_dev * bus,int addr,int devad,int regnum,u16 value)1275b7672fcSPrabhakar Kushwaha static int t1040_qds_mdio_write(struct mii_dev *bus, int addr, int devad,
1285b7672fcSPrabhakar Kushwaha 				int regnum, u16 value)
1295b7672fcSPrabhakar Kushwaha {
1305b7672fcSPrabhakar Kushwaha 	struct t1040_qds_mdio *priv = bus->priv;
1315b7672fcSPrabhakar Kushwaha 
1325b7672fcSPrabhakar Kushwaha 	t1040_qds_mux_mdio(priv->muxval);
1335b7672fcSPrabhakar Kushwaha 
1345b7672fcSPrabhakar Kushwaha 	return priv->realbus->write(priv->realbus, addr, devad, regnum, value);
1355b7672fcSPrabhakar Kushwaha }
1365b7672fcSPrabhakar Kushwaha 
t1040_qds_mdio_reset(struct mii_dev * bus)1375b7672fcSPrabhakar Kushwaha static int t1040_qds_mdio_reset(struct mii_dev *bus)
1385b7672fcSPrabhakar Kushwaha {
1395b7672fcSPrabhakar Kushwaha 	struct t1040_qds_mdio *priv = bus->priv;
1405b7672fcSPrabhakar Kushwaha 
1415b7672fcSPrabhakar Kushwaha 	return priv->realbus->reset(priv->realbus);
1425b7672fcSPrabhakar Kushwaha }
1435b7672fcSPrabhakar Kushwaha 
t1040_qds_mdio_init(char * realbusname,u8 muxval)1445b7672fcSPrabhakar Kushwaha static int t1040_qds_mdio_init(char *realbusname, u8 muxval)
1455b7672fcSPrabhakar Kushwaha {
1465b7672fcSPrabhakar Kushwaha 	struct t1040_qds_mdio *pmdio;
1475b7672fcSPrabhakar Kushwaha 	struct mii_dev *bus = mdio_alloc();
1485b7672fcSPrabhakar Kushwaha 
1495b7672fcSPrabhakar Kushwaha 	if (!bus) {
1505b7672fcSPrabhakar Kushwaha 		printf("Failed to allocate t1040_qds MDIO bus\n");
1515b7672fcSPrabhakar Kushwaha 		return -1;
1525b7672fcSPrabhakar Kushwaha 	}
1535b7672fcSPrabhakar Kushwaha 
1545b7672fcSPrabhakar Kushwaha 	pmdio = malloc(sizeof(*pmdio));
1555b7672fcSPrabhakar Kushwaha 	if (!pmdio) {
1565b7672fcSPrabhakar Kushwaha 		printf("Failed to allocate t1040_qds private data\n");
1575b7672fcSPrabhakar Kushwaha 		free(bus);
1585b7672fcSPrabhakar Kushwaha 		return -1;
1595b7672fcSPrabhakar Kushwaha 	}
1605b7672fcSPrabhakar Kushwaha 
1615b7672fcSPrabhakar Kushwaha 	bus->read = t1040_qds_mdio_read;
1625b7672fcSPrabhakar Kushwaha 	bus->write = t1040_qds_mdio_write;
1635b7672fcSPrabhakar Kushwaha 	bus->reset = t1040_qds_mdio_reset;
164192bc694SBen Whitten 	strcpy(bus->name, t1040_qds_mdio_name_for_muxval(muxval));
1655b7672fcSPrabhakar Kushwaha 
1665b7672fcSPrabhakar Kushwaha 	pmdio->realbus = miiphy_get_dev_by_name(realbusname);
1675b7672fcSPrabhakar Kushwaha 
1685b7672fcSPrabhakar Kushwaha 	if (!pmdio->realbus) {
1695b7672fcSPrabhakar Kushwaha 		printf("No bus with name %s\n", realbusname);
1705b7672fcSPrabhakar Kushwaha 		free(bus);
1715b7672fcSPrabhakar Kushwaha 		free(pmdio);
1725b7672fcSPrabhakar Kushwaha 		return -1;
1735b7672fcSPrabhakar Kushwaha 	}
1745b7672fcSPrabhakar Kushwaha 
1755b7672fcSPrabhakar Kushwaha 	pmdio->muxval = muxval;
1765b7672fcSPrabhakar Kushwaha 	bus->priv = pmdio;
1775b7672fcSPrabhakar Kushwaha 
1785b7672fcSPrabhakar Kushwaha 	return mdio_register(bus);
1795b7672fcSPrabhakar Kushwaha }
1805b7672fcSPrabhakar Kushwaha 
1815b7672fcSPrabhakar Kushwaha /*
1825b7672fcSPrabhakar Kushwaha  * Initialize the lane_to_slot[] array.
1835b7672fcSPrabhakar Kushwaha  *
1845b7672fcSPrabhakar Kushwaha  * On the T1040QDS board the mapping is controlled by ?? register.
1855b7672fcSPrabhakar Kushwaha  */
initialize_lane_to_slot(void)1865b7672fcSPrabhakar Kushwaha static void initialize_lane_to_slot(void)
1875b7672fcSPrabhakar Kushwaha {
1885b7672fcSPrabhakar Kushwaha 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
1895b7672fcSPrabhakar Kushwaha 	int serdes1_prtcl = (in_be32(&gur->rcwsr[4]) &
1905b7672fcSPrabhakar Kushwaha 				FSL_CORENET2_RCWSR4_SRDS1_PRTCL)
1915b7672fcSPrabhakar Kushwaha 		>> FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT;
1925b7672fcSPrabhakar Kushwaha 
1935b7672fcSPrabhakar Kushwaha 	QIXIS_WRITE(cms[0], 0x07);
1945b7672fcSPrabhakar Kushwaha 
1955b7672fcSPrabhakar Kushwaha 	switch (serdes1_prtcl) {
1965b7672fcSPrabhakar Kushwaha 	case 0x60:
1975b7672fcSPrabhakar Kushwaha 	case 0x66:
1985b7672fcSPrabhakar Kushwaha 	case 0x67:
1995b7672fcSPrabhakar Kushwaha 	case 0x69:
2005b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2015b7672fcSPrabhakar Kushwaha 		lane_to_slot[2] = 6;
2025b7672fcSPrabhakar Kushwaha 		lane_to_slot[3] = 5;
2035b7672fcSPrabhakar Kushwaha 		break;
2045b7672fcSPrabhakar Kushwaha 	case 0x86:
2055b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2065b7672fcSPrabhakar Kushwaha 		lane_to_slot[2] = 7;
2075b7672fcSPrabhakar Kushwaha 		lane_to_slot[3] = 7;
2085b7672fcSPrabhakar Kushwaha 		break;
2095b7672fcSPrabhakar Kushwaha 	case 0x87:
2105b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2115b7672fcSPrabhakar Kushwaha 		lane_to_slot[2] = 7;
2125b7672fcSPrabhakar Kushwaha 		lane_to_slot[3] = 7;
2135b7672fcSPrabhakar Kushwaha 		lane_to_slot[7] = 7;
2145b7672fcSPrabhakar Kushwaha 		break;
2155b7672fcSPrabhakar Kushwaha 	case 0x89:
2165b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2175b7672fcSPrabhakar Kushwaha 		lane_to_slot[2] = 7;
2185b7672fcSPrabhakar Kushwaha 		lane_to_slot[3] = 7;
219ea191e6dSCodrin Ciubotariu 		lane_to_slot[6] = 7;
2205b7672fcSPrabhakar Kushwaha 		lane_to_slot[7] = 7;
2215b7672fcSPrabhakar Kushwaha 		break;
2225b7672fcSPrabhakar Kushwaha 	case 0x8d:
2235b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2245b7672fcSPrabhakar Kushwaha 		lane_to_slot[2] = 7;
2255b7672fcSPrabhakar Kushwaha 		lane_to_slot[3] = 7;
2265b7672fcSPrabhakar Kushwaha 		lane_to_slot[5] = 3;
2275b7672fcSPrabhakar Kushwaha 		lane_to_slot[6] = 3;
2285b7672fcSPrabhakar Kushwaha 		lane_to_slot[7] = 3;
2295b7672fcSPrabhakar Kushwaha 		break;
2305b7672fcSPrabhakar Kushwaha 	case 0x8F:
2315b7672fcSPrabhakar Kushwaha 	case 0x85:
2325b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2335b7672fcSPrabhakar Kushwaha 		lane_to_slot[2] = 6;
2345b7672fcSPrabhakar Kushwaha 		lane_to_slot[3] = 5;
2355b7672fcSPrabhakar Kushwaha 		lane_to_slot[6] = 3;
2365b7672fcSPrabhakar Kushwaha 		lane_to_slot[7] = 3;
2375b7672fcSPrabhakar Kushwaha 		break;
2385b7672fcSPrabhakar Kushwaha 	case 0xA5:
2395b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2405b7672fcSPrabhakar Kushwaha 		lane_to_slot[6] = 3;
2415b7672fcSPrabhakar Kushwaha 		lane_to_slot[7] = 3;
2425b7672fcSPrabhakar Kushwaha 		break;
2435b7672fcSPrabhakar Kushwaha 	case 0xA7:
2445b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2455273aa38SPriyanka Jain 		lane_to_slot[2] = 6;
2465273aa38SPriyanka Jain 		lane_to_slot[3] = 5;
2475b7672fcSPrabhakar Kushwaha 		lane_to_slot[7] = 7;
2485b7672fcSPrabhakar Kushwaha 		break;
2495b7672fcSPrabhakar Kushwaha 	case 0xAA:
2505b7672fcSPrabhakar Kushwaha 		lane_to_slot[1] = 7;
2515b7672fcSPrabhakar Kushwaha 		lane_to_slot[6] = 7;
2525b7672fcSPrabhakar Kushwaha 		lane_to_slot[7] = 7;
2535b7672fcSPrabhakar Kushwaha 		break;
2545b7672fcSPrabhakar Kushwaha 	case 0x40:
2555b7672fcSPrabhakar Kushwaha 		lane_to_slot[2] = 7;
2565b7672fcSPrabhakar Kushwaha 		lane_to_slot[3] = 7;
2575b7672fcSPrabhakar Kushwaha 		break;
2585b7672fcSPrabhakar Kushwaha 	default:
2595b7672fcSPrabhakar Kushwaha 		printf("qds: Fman: Unsupported SerDes Protocol 0x%02x\n",
2605b7672fcSPrabhakar Kushwaha 		       serdes1_prtcl);
2615b7672fcSPrabhakar Kushwaha 		break;
2625b7672fcSPrabhakar Kushwaha 	}
2635b7672fcSPrabhakar Kushwaha }
2645b7672fcSPrabhakar Kushwaha 
2655b7672fcSPrabhakar Kushwaha /*
2665b7672fcSPrabhakar Kushwaha  * Given the following ...
2675b7672fcSPrabhakar Kushwaha  *
2685b7672fcSPrabhakar Kushwaha  * 1) A pointer to an Fman Ethernet node (as identified by the 'compat'
2695b7672fcSPrabhakar Kushwaha  * compatible string and 'addr' physical address)
2705b7672fcSPrabhakar Kushwaha  *
2715b7672fcSPrabhakar Kushwaha  * 2) An Fman port
2725b7672fcSPrabhakar Kushwaha  *
2735b7672fcSPrabhakar Kushwaha  * ... update the phy-handle property of the Ethernet node to point to the
2745b7672fcSPrabhakar Kushwaha  * right PHY. This assumes that we already know the PHY for each port.
2755b7672fcSPrabhakar Kushwaha  *
2765b7672fcSPrabhakar Kushwaha  * The offset of the Fman Ethernet node is also passed in for convenience, but
2775b7672fcSPrabhakar Kushwaha  * it is not used, and we recalculate the offset anyway.
2785b7672fcSPrabhakar Kushwaha  *
2795b7672fcSPrabhakar Kushwaha  * Note that what we call "Fman ports" (enum fm_port) is really an Fman MAC.
2805b7672fcSPrabhakar Kushwaha  * Inside the Fman, "ports" are things that connect to MACs. We only call them
2815b7672fcSPrabhakar Kushwaha  * ports in U-Boot because on previous Ethernet devices (e.g. Gianfar), MACs
2825b7672fcSPrabhakar Kushwaha  * and ports are the same thing.
2835b7672fcSPrabhakar Kushwaha  *
2845b7672fcSPrabhakar Kushwaha  */
board_ft_fman_fixup_port(void * fdt,char * compat,phys_addr_t addr,enum fm_port port,int offset)2855b7672fcSPrabhakar Kushwaha void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr,
2865b7672fcSPrabhakar Kushwaha 			      enum fm_port port, int offset)
2875b7672fcSPrabhakar Kushwaha {
2885b7672fcSPrabhakar Kushwaha 	phy_interface_t intf = fm_info_get_enet_if(port);
2895b7672fcSPrabhakar Kushwaha 	char phy[16];
2905b7672fcSPrabhakar Kushwaha 
2915b7672fcSPrabhakar Kushwaha 	/* The RGMII PHY is identified by the MAC connected to it */
2925b7672fcSPrabhakar Kushwaha 	if (intf == PHY_INTERFACE_MODE_RGMII) {
2935b7672fcSPrabhakar Kushwaha 		sprintf(phy, "rgmii_phy%u", port == FM1_DTSEC4 ? 1 : 2);
2945b7672fcSPrabhakar Kushwaha 		fdt_set_phy_handle(fdt, compat, addr, phy);
2955b7672fcSPrabhakar Kushwaha 	}
2965b7672fcSPrabhakar Kushwaha 
2975b7672fcSPrabhakar Kushwaha 	/* The SGMII PHY is identified by the MAC connected to it */
2985b7672fcSPrabhakar Kushwaha 	if (intf == PHY_INTERFACE_MODE_SGMII) {
2995b7672fcSPrabhakar Kushwaha 		int lane = serdes_get_first_lane(FSL_SRDS_1, SGMII_FM1_DTSEC1
3005b7672fcSPrabhakar Kushwaha 						 + port);
3015b7672fcSPrabhakar Kushwaha 		u8 slot;
3025b7672fcSPrabhakar Kushwaha 		if (lane < 0)
3035b7672fcSPrabhakar Kushwaha 			return;
3045b7672fcSPrabhakar Kushwaha 		slot = lane_to_slot[lane];
3055b7672fcSPrabhakar Kushwaha 		if (slot) {
3065b7672fcSPrabhakar Kushwaha 			/* Slot housing a SGMII riser card */
3075b7672fcSPrabhakar Kushwaha 			sprintf(phy, "phy_s%x_%02x", slot,
3085b7672fcSPrabhakar Kushwaha 				(fm_info_get_phy_address(port - FM1_DTSEC1)-
3095b7672fcSPrabhakar Kushwaha 				CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR + 1));
3105b7672fcSPrabhakar Kushwaha 			fdt_set_phy_handle(fdt, compat, addr, phy);
3115b7672fcSPrabhakar Kushwaha 		}
3125b7672fcSPrabhakar Kushwaha 	}
3135b7672fcSPrabhakar Kushwaha }
3145b7672fcSPrabhakar Kushwaha 
fdt_fixup_board_enet(void * fdt)3155b7672fcSPrabhakar Kushwaha void fdt_fixup_board_enet(void *fdt)
3165b7672fcSPrabhakar Kushwaha {
3175b7672fcSPrabhakar Kushwaha 	int i, lane, idx;
3185b7672fcSPrabhakar Kushwaha 
3195b7672fcSPrabhakar Kushwaha 	for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
3205b7672fcSPrabhakar Kushwaha 		idx = i - FM1_DTSEC1;
3215b7672fcSPrabhakar Kushwaha 		switch (fm_info_get_enet_if(i)) {
3225b7672fcSPrabhakar Kushwaha 		case PHY_INTERFACE_MODE_SGMII:
3235b7672fcSPrabhakar Kushwaha 			lane = serdes_get_first_lane(FSL_SRDS_1,
3245b7672fcSPrabhakar Kushwaha 						     SGMII_FM1_DTSEC1 + idx);
3255b7672fcSPrabhakar Kushwaha 			if (lane < 0)
3265b7672fcSPrabhakar Kushwaha 				break;
3275b7672fcSPrabhakar Kushwaha 
3285b7672fcSPrabhakar Kushwaha 			switch (mdio_mux[i]) {
3295b7672fcSPrabhakar Kushwaha 			case EMI1_SLOT3:
3305b7672fcSPrabhakar Kushwaha 				fdt_status_okay_by_alias(fdt, "emi1_slot3");
3315b7672fcSPrabhakar Kushwaha 				break;
3325b7672fcSPrabhakar Kushwaha 			case EMI1_SLOT5:
3335b7672fcSPrabhakar Kushwaha 				fdt_status_okay_by_alias(fdt, "emi1_slot5");
3345b7672fcSPrabhakar Kushwaha 				break;
3355b7672fcSPrabhakar Kushwaha 			case EMI1_SLOT6:
3365b7672fcSPrabhakar Kushwaha 				fdt_status_okay_by_alias(fdt, "emi1_slot6");
3375b7672fcSPrabhakar Kushwaha 				break;
3385b7672fcSPrabhakar Kushwaha 			case EMI1_SLOT7:
3395b7672fcSPrabhakar Kushwaha 				fdt_status_okay_by_alias(fdt, "emi1_slot7");
3405b7672fcSPrabhakar Kushwaha 				break;
3415b7672fcSPrabhakar Kushwaha 			}
3425b7672fcSPrabhakar Kushwaha 		break;
3435b7672fcSPrabhakar Kushwaha 		case PHY_INTERFACE_MODE_RGMII:
3445b7672fcSPrabhakar Kushwaha 			if (i == FM1_DTSEC4)
3455b7672fcSPrabhakar Kushwaha 				fdt_status_okay_by_alias(fdt, "emi1_rgmii0");
3465b7672fcSPrabhakar Kushwaha 
3475b7672fcSPrabhakar Kushwaha 			if (i == FM1_DTSEC5)
3485b7672fcSPrabhakar Kushwaha 				fdt_status_okay_by_alias(fdt, "emi1_rgmii1");
3495b7672fcSPrabhakar Kushwaha 			break;
3505b7672fcSPrabhakar Kushwaha 		default:
3515b7672fcSPrabhakar Kushwaha 			break;
3525b7672fcSPrabhakar Kushwaha 		}
3535b7672fcSPrabhakar Kushwaha 	}
3545b7672fcSPrabhakar Kushwaha }
3555b7672fcSPrabhakar Kushwaha #endif /* #ifdef CONFIG_FMAN_ENET */
3565b7672fcSPrabhakar Kushwaha 
set_brdcfg9_for_gtx_clk(void)3575b7672fcSPrabhakar Kushwaha static void set_brdcfg9_for_gtx_clk(void)
3585b7672fcSPrabhakar Kushwaha {
3595b7672fcSPrabhakar Kushwaha 	u8 brdcfg9;
3605b7672fcSPrabhakar Kushwaha 	brdcfg9 = QIXIS_READ(brdcfg[9]);
3616666017fSvijay rai /* Initializing EPHY2 clock to RGMII mode */
3626666017fSvijay rai 	brdcfg9 &= ~(BRDCFG9_EPHY2_MASK);
3636666017fSvijay rai 	brdcfg9 |= (BRDCFG9_EPHY2_VAL);
3645b7672fcSPrabhakar Kushwaha 	QIXIS_WRITE(brdcfg[9], brdcfg9);
3655b7672fcSPrabhakar Kushwaha }
3665b7672fcSPrabhakar Kushwaha 
t1040_handle_phy_interface_sgmii(int i)3675b7672fcSPrabhakar Kushwaha void t1040_handle_phy_interface_sgmii(int i)
3685b7672fcSPrabhakar Kushwaha {
3695b7672fcSPrabhakar Kushwaha 	int lane, idx, slot;
3705b7672fcSPrabhakar Kushwaha 	idx = i - FM1_DTSEC1;
3715b7672fcSPrabhakar Kushwaha 	lane = serdes_get_first_lane(FSL_SRDS_1,
3725b7672fcSPrabhakar Kushwaha 			SGMII_FM1_DTSEC1 + idx);
3735b7672fcSPrabhakar Kushwaha 
3745b7672fcSPrabhakar Kushwaha 	if (lane < 0)
3755b7672fcSPrabhakar Kushwaha 		return;
3765b7672fcSPrabhakar Kushwaha 	slot = lane_to_slot[lane];
3775b7672fcSPrabhakar Kushwaha 
3785b7672fcSPrabhakar Kushwaha 	switch (slot) {
3795b7672fcSPrabhakar Kushwaha 	case 1:
3805b7672fcSPrabhakar Kushwaha 		mdio_mux[i] = EMI1_SLOT1;
3815b7672fcSPrabhakar Kushwaha 		fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
3825b7672fcSPrabhakar Kushwaha 		break;
3835b7672fcSPrabhakar Kushwaha 	case 3:
3845b7672fcSPrabhakar Kushwaha 		if (FM1_DTSEC4 == i)
3855b7672fcSPrabhakar Kushwaha 			fm_info_set_phy_address(i, riser_phy_addr[0]);
3865b7672fcSPrabhakar Kushwaha 		if (FM1_DTSEC5 == i)
3875b7672fcSPrabhakar Kushwaha 			fm_info_set_phy_address(i, riser_phy_addr[1]);
3885b7672fcSPrabhakar Kushwaha 
3895b7672fcSPrabhakar Kushwaha 		mdio_mux[i] = EMI1_SLOT3;
3905b7672fcSPrabhakar Kushwaha 
3915b7672fcSPrabhakar Kushwaha 		fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
3925b7672fcSPrabhakar Kushwaha 		break;
3935b7672fcSPrabhakar Kushwaha 	case 4:
3945b7672fcSPrabhakar Kushwaha 		mdio_mux[i] = EMI1_SLOT4;
3955b7672fcSPrabhakar Kushwaha 		fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
3965b7672fcSPrabhakar Kushwaha 		break;
3975b7672fcSPrabhakar Kushwaha 	case 5:
3985b7672fcSPrabhakar Kushwaha 		/* Slot housing a SGMII riser card? */
3995b7672fcSPrabhakar Kushwaha 		fm_info_set_phy_address(i, riser_phy_addr[0]);
4005b7672fcSPrabhakar Kushwaha 		mdio_mux[i] = EMI1_SLOT5;
4015b7672fcSPrabhakar Kushwaha 		fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
4025b7672fcSPrabhakar Kushwaha 		break;
4035b7672fcSPrabhakar Kushwaha 	case 6:
4045b7672fcSPrabhakar Kushwaha 		/* Slot housing a SGMII riser card? */
4055b7672fcSPrabhakar Kushwaha 		fm_info_set_phy_address(i, riser_phy_addr[0]);
4065b7672fcSPrabhakar Kushwaha 		mdio_mux[i] = EMI1_SLOT6;
4075b7672fcSPrabhakar Kushwaha 		fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
4085b7672fcSPrabhakar Kushwaha 		break;
4095b7672fcSPrabhakar Kushwaha 	case 7:
4105b7672fcSPrabhakar Kushwaha 		if (FM1_DTSEC1 == i)
4115b7672fcSPrabhakar Kushwaha 			fm_info_set_phy_address(i, riser_phy_addr[0]);
4125b7672fcSPrabhakar Kushwaha 		if (FM1_DTSEC2 == i)
4135b7672fcSPrabhakar Kushwaha 			fm_info_set_phy_address(i, riser_phy_addr[1]);
4145b7672fcSPrabhakar Kushwaha 		if (FM1_DTSEC3 == i)
4155b7672fcSPrabhakar Kushwaha 			fm_info_set_phy_address(i, riser_phy_addr[2]);
4165273aa38SPriyanka Jain 		if (FM1_DTSEC5 == i)
4175273aa38SPriyanka Jain 			fm_info_set_phy_address(i, riser_phy_addr[3]);
4185b7672fcSPrabhakar Kushwaha 
4195b7672fcSPrabhakar Kushwaha 		mdio_mux[i] = EMI1_SLOT7;
4205b7672fcSPrabhakar Kushwaha 		fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
4215b7672fcSPrabhakar Kushwaha 		break;
4225b7672fcSPrabhakar Kushwaha 	default:
4235b7672fcSPrabhakar Kushwaha 		break;
4245b7672fcSPrabhakar Kushwaha 	}
4255b7672fcSPrabhakar Kushwaha 	fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
4265b7672fcSPrabhakar Kushwaha }
t1040_handle_phy_interface_rgmii(int i)4275b7672fcSPrabhakar Kushwaha void t1040_handle_phy_interface_rgmii(int i)
4285b7672fcSPrabhakar Kushwaha {
4295b7672fcSPrabhakar Kushwaha 	fm_info_set_phy_address(i, i == FM1_DTSEC5 ?
4305b7672fcSPrabhakar Kushwaha 			CONFIG_SYS_FM1_DTSEC5_PHY_ADDR :
4315b7672fcSPrabhakar Kushwaha 			CONFIG_SYS_FM1_DTSEC4_PHY_ADDR);
4325b7672fcSPrabhakar Kushwaha 	mdio_mux[i] = (i == FM1_DTSEC5) ? EMI1_RGMII1 :
4335b7672fcSPrabhakar Kushwaha 		EMI1_RGMII0;
4345b7672fcSPrabhakar Kushwaha 	fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
4355b7672fcSPrabhakar Kushwaha }
4365b7672fcSPrabhakar Kushwaha 
board_eth_init(bd_t * bis)4375b7672fcSPrabhakar Kushwaha int board_eth_init(bd_t *bis)
4385b7672fcSPrabhakar Kushwaha {
4395b7672fcSPrabhakar Kushwaha #ifdef CONFIG_FMAN_ENET
4405b7672fcSPrabhakar Kushwaha 	struct memac_mdio_info memac_mdio_info;
4415b7672fcSPrabhakar Kushwaha 	unsigned int i;
442a83fccc2SCodrin Ciubotariu #ifdef CONFIG_VSC9953
443a83fccc2SCodrin Ciubotariu 	int lane;
444a83fccc2SCodrin Ciubotariu 	int phy_addr;
445a83fccc2SCodrin Ciubotariu 	phy_interface_t phy_int;
446a83fccc2SCodrin Ciubotariu 	struct mii_dev *bus;
447a83fccc2SCodrin Ciubotariu #endif
4485b7672fcSPrabhakar Kushwaha 
4495b7672fcSPrabhakar Kushwaha 	printf("Initializing Fman\n");
4505b7672fcSPrabhakar Kushwaha 	set_brdcfg9_for_gtx_clk();
4515b7672fcSPrabhakar Kushwaha 
4525b7672fcSPrabhakar Kushwaha 	initialize_lane_to_slot();
4535b7672fcSPrabhakar Kushwaha 
4545b7672fcSPrabhakar Kushwaha 	/* Initialize the mdio_mux array so we can recognize empty elements */
4555b7672fcSPrabhakar Kushwaha 	for (i = 0; i < NUM_FM_PORTS; i++)
4565b7672fcSPrabhakar Kushwaha 		mdio_mux[i] = EMI_NONE;
4575b7672fcSPrabhakar Kushwaha 
4585b7672fcSPrabhakar Kushwaha 	memac_mdio_info.regs =
4595b7672fcSPrabhakar Kushwaha 		(struct memac_mdio_controller *)CONFIG_SYS_FM1_DTSEC_MDIO_ADDR;
4605b7672fcSPrabhakar Kushwaha 	memac_mdio_info.name = DEFAULT_FM_MDIO_NAME;
4615b7672fcSPrabhakar Kushwaha 
4625b7672fcSPrabhakar Kushwaha 	/* Register the real 1G MDIO bus */
4635b7672fcSPrabhakar Kushwaha 	fm_memac_mdio_init(bis, &memac_mdio_info);
4645b7672fcSPrabhakar Kushwaha 
4655b7672fcSPrabhakar Kushwaha 	/* Register the muxing front-ends to the MDIO buses */
4665b7672fcSPrabhakar Kushwaha 	t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_RGMII0);
4675b7672fcSPrabhakar Kushwaha 	t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_RGMII1);
4685b7672fcSPrabhakar Kushwaha 	t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT1);
4695b7672fcSPrabhakar Kushwaha 	t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT3);
4705b7672fcSPrabhakar Kushwaha 	t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT4);
4715b7672fcSPrabhakar Kushwaha 	t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT5);
4725b7672fcSPrabhakar Kushwaha 	t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT6);
4735b7672fcSPrabhakar Kushwaha 	t1040_qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT7);
4745b7672fcSPrabhakar Kushwaha 
4755b7672fcSPrabhakar Kushwaha 	/*
4765b7672fcSPrabhakar Kushwaha 	 * Program on board RGMII PHY addresses. If the SGMII Riser
4775b7672fcSPrabhakar Kushwaha 	 * card used, we'll override the PHY address later. For any DTSEC that
4785b7672fcSPrabhakar Kushwaha 	 * is RGMII, we'll also override its PHY address later. We assume that
4795b7672fcSPrabhakar Kushwaha 	 * DTSEC4 and DTSEC5 are used for RGMII.
4805b7672fcSPrabhakar Kushwaha 	 */
4815b7672fcSPrabhakar Kushwaha 	fm_info_set_phy_address(FM1_DTSEC4, CONFIG_SYS_FM1_DTSEC4_PHY_ADDR);
4825b7672fcSPrabhakar Kushwaha 	fm_info_set_phy_address(FM1_DTSEC5, CONFIG_SYS_FM1_DTSEC5_PHY_ADDR);
4835b7672fcSPrabhakar Kushwaha 
4845b7672fcSPrabhakar Kushwaha 	for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
4855b7672fcSPrabhakar Kushwaha 		switch (fm_info_get_enet_if(i)) {
4865b7672fcSPrabhakar Kushwaha 		case PHY_INTERFACE_MODE_QSGMII:
487d9fb29c7SCodrin Ciubotariu 			fm_info_set_mdio(i, NULL);
4885b7672fcSPrabhakar Kushwaha 			break;
4895b7672fcSPrabhakar Kushwaha 		case PHY_INTERFACE_MODE_SGMII:
4905b7672fcSPrabhakar Kushwaha 			t1040_handle_phy_interface_sgmii(i);
4915b7672fcSPrabhakar Kushwaha 			break;
4925b7672fcSPrabhakar Kushwaha 
4935b7672fcSPrabhakar Kushwaha 		case PHY_INTERFACE_MODE_RGMII:
4945b7672fcSPrabhakar Kushwaha 			/* Only DTSEC4 and DTSEC5 can be routed to RGMII */
4955b7672fcSPrabhakar Kushwaha 			t1040_handle_phy_interface_rgmii(i);
4965b7672fcSPrabhakar Kushwaha 			break;
4975b7672fcSPrabhakar Kushwaha 		default:
4985b7672fcSPrabhakar Kushwaha 			break;
4995b7672fcSPrabhakar Kushwaha 		}
5005b7672fcSPrabhakar Kushwaha 	}
5015b7672fcSPrabhakar Kushwaha 
502a83fccc2SCodrin Ciubotariu #ifdef CONFIG_VSC9953
503a83fccc2SCodrin Ciubotariu 	for (i = 0; i < VSC9953_MAX_PORTS; i++) {
504a83fccc2SCodrin Ciubotariu 		lane = -1;
505a83fccc2SCodrin Ciubotariu 		phy_addr = 0;
506a83fccc2SCodrin Ciubotariu 		phy_int = PHY_INTERFACE_MODE_NONE;
507a83fccc2SCodrin Ciubotariu 		switch (i) {
508a83fccc2SCodrin Ciubotariu 		case 0:
509a83fccc2SCodrin Ciubotariu 		case 1:
510a83fccc2SCodrin Ciubotariu 		case 2:
511a83fccc2SCodrin Ciubotariu 		case 3:
512a83fccc2SCodrin Ciubotariu 			lane = serdes_get_first_lane(FSL_SRDS_1, QSGMII_SW1_A);
513a83fccc2SCodrin Ciubotariu 			/* PHYs connected over QSGMII */
514a83fccc2SCodrin Ciubotariu 			if (lane >= 0) {
515a83fccc2SCodrin Ciubotariu 				phy_addr = CONFIG_SYS_FM1_QSGMII21_PHY_ADDR +
516a83fccc2SCodrin Ciubotariu 						i;
517a83fccc2SCodrin Ciubotariu 				phy_int = PHY_INTERFACE_MODE_QSGMII;
518a83fccc2SCodrin Ciubotariu 				break;
519a83fccc2SCodrin Ciubotariu 			}
520a83fccc2SCodrin Ciubotariu 			lane = serdes_get_first_lane(FSL_SRDS_1,
521a83fccc2SCodrin Ciubotariu 					SGMII_SW1_MAC1 + i);
522a83fccc2SCodrin Ciubotariu 
523a83fccc2SCodrin Ciubotariu 			if (lane < 0)
524a83fccc2SCodrin Ciubotariu 				break;
525a83fccc2SCodrin Ciubotariu 
526a83fccc2SCodrin Ciubotariu 			/* PHYs connected over QSGMII */
527a83fccc2SCodrin Ciubotariu 			if (i != 3 || lane_to_slot[lane] == 7)
528a83fccc2SCodrin Ciubotariu 				phy_addr = CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR
529a83fccc2SCodrin Ciubotariu 					+ i;
530a83fccc2SCodrin Ciubotariu 			else
531a83fccc2SCodrin Ciubotariu 				phy_addr = CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR;
532a83fccc2SCodrin Ciubotariu 			phy_int = PHY_INTERFACE_MODE_SGMII;
533a83fccc2SCodrin Ciubotariu 			break;
534a83fccc2SCodrin Ciubotariu 		case 4:
535a83fccc2SCodrin Ciubotariu 		case 5:
536a83fccc2SCodrin Ciubotariu 		case 6:
537a83fccc2SCodrin Ciubotariu 		case 7:
538a83fccc2SCodrin Ciubotariu 			lane = serdes_get_first_lane(FSL_SRDS_1, QSGMII_SW1_B);
539a83fccc2SCodrin Ciubotariu 			/* PHYs connected over QSGMII */
540a83fccc2SCodrin Ciubotariu 			if (lane >= 0) {
541a83fccc2SCodrin Ciubotariu 				phy_addr = CONFIG_SYS_FM1_QSGMII11_PHY_ADDR +
542a83fccc2SCodrin Ciubotariu 						i - 4;
543a83fccc2SCodrin Ciubotariu 				phy_int = PHY_INTERFACE_MODE_QSGMII;
544a83fccc2SCodrin Ciubotariu 				break;
545a83fccc2SCodrin Ciubotariu 			}
546a83fccc2SCodrin Ciubotariu 			lane = serdes_get_first_lane(FSL_SRDS_1,
547a83fccc2SCodrin Ciubotariu 					SGMII_SW1_MAC1 + i);
548a83fccc2SCodrin Ciubotariu 			/* PHYs connected over SGMII */
549a83fccc2SCodrin Ciubotariu 			if (lane >= 0) {
550a83fccc2SCodrin Ciubotariu 				phy_addr = CONFIG_SYS_FM1_DTSEC1_RISER_PHY_ADDR
551a83fccc2SCodrin Ciubotariu 						+ i - 3;
552a83fccc2SCodrin Ciubotariu 				phy_int = PHY_INTERFACE_MODE_SGMII;
553a83fccc2SCodrin Ciubotariu 			}
554a83fccc2SCodrin Ciubotariu 			break;
555a83fccc2SCodrin Ciubotariu 		case 8:
556a83fccc2SCodrin Ciubotariu 			if (serdes_get_first_lane(FSL_SRDS_1,
557a83fccc2SCodrin Ciubotariu 						  SGMII_FM1_DTSEC1) < 0)
558a83fccc2SCodrin Ciubotariu 				/* FM1@DTSEC1 is connected to SW1@PORT8 */
559a83fccc2SCodrin Ciubotariu 				vsc9953_port_enable(i);
560a83fccc2SCodrin Ciubotariu 			break;
561a83fccc2SCodrin Ciubotariu 		case 9:
562a83fccc2SCodrin Ciubotariu 			if (serdes_get_first_lane(FSL_SRDS_1,
563a83fccc2SCodrin Ciubotariu 						  SGMII_FM1_DTSEC2) < 0) {
564a83fccc2SCodrin Ciubotariu 				/* Enable L2 On MAC2 using SCFG */
565a83fccc2SCodrin Ciubotariu 				struct ccsr_scfg *scfg = (struct ccsr_scfg *)
566a83fccc2SCodrin Ciubotariu 						CONFIG_SYS_MPC85xx_SCFG;
567a83fccc2SCodrin Ciubotariu 
568a83fccc2SCodrin Ciubotariu 				out_be32(&scfg->esgmiiselcr,
569a83fccc2SCodrin Ciubotariu 					 in_be32(&scfg->esgmiiselcr) |
570a83fccc2SCodrin Ciubotariu 					 (0x80000000));
571a83fccc2SCodrin Ciubotariu 				vsc9953_port_enable(i);
572a83fccc2SCodrin Ciubotariu 			}
573a83fccc2SCodrin Ciubotariu 			break;
574a83fccc2SCodrin Ciubotariu 		}
575a83fccc2SCodrin Ciubotariu 
576a83fccc2SCodrin Ciubotariu 		if (lane >= 0) {
577a83fccc2SCodrin Ciubotariu 			bus = mii_dev_for_muxval(lane_to_slot[lane]);
578a83fccc2SCodrin Ciubotariu 			vsc9953_port_info_set_mdio(i, bus);
579a83fccc2SCodrin Ciubotariu 			vsc9953_port_enable(i);
580a83fccc2SCodrin Ciubotariu 		}
581a83fccc2SCodrin Ciubotariu 		vsc9953_port_info_set_phy_address(i, phy_addr);
582a83fccc2SCodrin Ciubotariu 		vsc9953_port_info_set_phy_int(i, phy_int);
583a83fccc2SCodrin Ciubotariu 	}
584a83fccc2SCodrin Ciubotariu 
585a83fccc2SCodrin Ciubotariu #endif
5865b7672fcSPrabhakar Kushwaha 	cpu_eth_init(bis);
5875b7672fcSPrabhakar Kushwaha #endif
5885b7672fcSPrabhakar Kushwaha 
5895b7672fcSPrabhakar Kushwaha 	return pci_eth_init(bis);
5905b7672fcSPrabhakar Kushwaha }
591