2 * Copyright 2013 Freescale Semiconductor, Inc.
4 * Shengzhou Liu <Shengzhou.Liu@freescale.com>
6 * SPDX-License-Identifier: GPL-2.0+
13 #include <asm/processor.h>
14 #include <asm/immap_85xx.h>
15 #include <asm/fsl_law.h>
16 #include <asm/fsl_serdes.h>
17 #include <asm/fsl_portals.h>
18 #include <asm/fsl_liodn.h>
24 #include <asm/fsl_dtsec.h>
25 #include <asm/fsl_serdes.h>
27 #include "../common/qixis.h"
28 #include "../common/fman.h"
29 #include "t208xqds_qixis.h"
31 #define EMI_NONE 0xFFFFFFFF
35 #if defined(CONFIG_T2080QDS)
41 #elif defined(CONFIG_T2081QDS)
50 #define PCCR1_SGMIIA_KX_MASK 0x00008000
51 #define PCCR1_SGMIIB_KX_MASK 0x00004000
52 #define PCCR1_SGMIIC_KX_MASK 0x00002000
53 #define PCCR1_SGMIID_KX_MASK 0x00001000
54 #define PCCR1_SGMIIE_KX_MASK 0x00000800
55 #define PCCR1_SGMIIF_KX_MASK 0x00000400
56 #define PCCR1_SGMIIG_KX_MASK 0x00000200
57 #define PCCR1_SGMIIH_KX_MASK 0x00000100
59 static int mdio_mux[NUM_FM_PORTS];
61 static const char * const mdio_names[] = {
62 #if defined(CONFIG_T2080QDS)
63 "T2080QDS_MDIO_RGMII1",
64 "T2080QDS_MDIO_RGMII2",
65 "T2080QDS_MDIO_SLOT1",
66 "T2080QDS_MDIO_SLOT3",
67 "T2080QDS_MDIO_SLOT4",
68 "T2080QDS_MDIO_SLOT5",
69 "T2080QDS_MDIO_SLOT2",
71 #elif defined(CONFIG_T2081QDS)
72 "T2081QDS_MDIO_RGMII1",
73 "T2081QDS_MDIO_RGMII2",
74 "T2081QDS_MDIO_SLOT1",
75 "T2081QDS_MDIO_SLOT2",
76 "T2081QDS_MDIO_SLOT3",
77 "T2081QDS_MDIO_SLOT5",
78 "T2081QDS_MDIO_SLOT6",
79 "T2081QDS_MDIO_SLOT7",
84 /* Map SerDes1 8 lanes to default slot, will be initialized dynamically */
85 #if defined(CONFIG_T2080QDS)
86 static u8 lane_to_slot[] = {3, 3, 3, 3, 1, 1, 1, 1};
87 #elif defined(CONFIG_T2081QDS)
88 static u8 lane_to_slot[] = {2, 2, 2, 2, 1, 1, 1, 1};
91 static const char *t208xqds_mdio_name_for_muxval(u8 muxval)
93 return mdio_names[muxval];
96 struct mii_dev *mii_dev_for_muxval(u8 muxval)
99 const char *name = t208xqds_mdio_name_for_muxval(muxval);
102 printf("No bus for muxval %x\n", muxval);
106 bus = miiphy_get_dev_by_name(name);
109 printf("No bus by name %s\n", name);
116 struct t208xqds_mdio {
118 struct mii_dev *realbus;
121 static void t208xqds_mux_mdio(u8 muxval)
125 brdcfg4 = QIXIS_READ(brdcfg[4]);
126 brdcfg4 &= ~BRDCFG4_EMISEL_MASK;
127 brdcfg4 |= (muxval << BRDCFG4_EMISEL_SHIFT);
128 QIXIS_WRITE(brdcfg[4], brdcfg4);
132 static int t208xqds_mdio_read(struct mii_dev *bus, int addr, int devad,
135 struct t208xqds_mdio *priv = bus->priv;
137 t208xqds_mux_mdio(priv->muxval);
139 return priv->realbus->read(priv->realbus, addr, devad, regnum);
142 static int t208xqds_mdio_write(struct mii_dev *bus, int addr, int devad,
143 int regnum, u16 value)
145 struct t208xqds_mdio *priv = bus->priv;
147 t208xqds_mux_mdio(priv->muxval);
149 return priv->realbus->write(priv->realbus, addr, devad, regnum, value);
152 static int t208xqds_mdio_reset(struct mii_dev *bus)
154 struct t208xqds_mdio *priv = bus->priv;
156 return priv->realbus->reset(priv->realbus);
159 static int t208xqds_mdio_init(char *realbusname, u8 muxval)
161 struct t208xqds_mdio *pmdio;
162 struct mii_dev *bus = mdio_alloc();
165 printf("Failed to allocate t208xqds MDIO bus\n");
169 pmdio = malloc(sizeof(*pmdio));
171 printf("Failed to allocate t208xqds private data\n");
176 bus->read = t208xqds_mdio_read;
177 bus->write = t208xqds_mdio_write;
178 bus->reset = t208xqds_mdio_reset;
179 sprintf(bus->name, t208xqds_mdio_name_for_muxval(muxval));
181 pmdio->realbus = miiphy_get_dev_by_name(realbusname);
183 if (!pmdio->realbus) {
184 printf("No bus with name %s\n", realbusname);
190 pmdio->muxval = muxval;
192 return mdio_register(bus);
195 void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr,
196 enum fm_port port, int offset)
200 char lane_mode[2][20] = {"1000BASE-KX", "10GBASE-KR"};
201 char buf[32] = "serdes-1,";
202 struct fixed_link f_link;
206 ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
207 #ifdef CONFIG_T2080QDS
208 serdes_corenet_t *srds_regs =
209 (void *)CONFIG_SYS_FSL_CORENET_SERDES_ADDR;
210 u32 srds1_pccr1 = in_be32(&srds_regs->srdspccr1);
212 u32 srds_s1 = in_be32(&gur->rcwsr[4]) &
213 FSL_CORENET2_RCWSR4_SRDS1_PRTCL;
215 srds_s1 >>= FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT;
217 if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_SGMII) {
218 phy = fm_info_get_phy_address(port);
220 #if defined(CONFIG_T2080QDS)
222 if (hwconfig_sub("fsl_1gkx", "fm1_1g1")) {
224 fdt_set_phy_handle(fdt, compat, addr,
226 fdt_status_okay_by_alias(fdt, "1gkx_pcs_mdio1");
227 sprintf(buf, "%s%s%s", buf, "lane-c,",
228 (char *)lane_mode[0]);
229 out_be32(&srds_regs->srdspccr1, srds1_pccr1 |
230 PCCR1_SGMIIH_KX_MASK);
234 if (hwconfig_sub("fsl_1gkx", "fm1_1g2")) {
236 fdt_set_phy_handle(fdt, compat, addr,
238 fdt_status_okay_by_alias(fdt, "1gkx_pcs_mdio2");
239 sprintf(buf, "%s%s%s", buf, "lane-d,",
240 (char *)lane_mode[0]);
241 out_be32(&srds_regs->srdspccr1, srds1_pccr1 |
242 PCCR1_SGMIIG_KX_MASK);
246 if (hwconfig_sub("fsl_1gkx", "fm1_1g9")) {
248 fdt_set_phy_handle(fdt, compat, addr,
250 fdt_status_okay_by_alias(fdt, "1gkx_pcs_mdio9");
251 sprintf(buf, "%s%s%s", buf, "lane-a,",
252 (char *)lane_mode[0]);
253 out_be32(&srds_regs->srdspccr1, srds1_pccr1 |
254 PCCR1_SGMIIE_KX_MASK);
258 if (hwconfig_sub("fsl_1gkx", "fm1_1g10")) {
260 fdt_set_phy_handle(fdt, compat, addr,
262 fdt_status_okay_by_alias(fdt,
264 sprintf(buf, "%s%s%s", buf, "lane-b,",
265 (char *)lane_mode[0]);
266 out_be32(&srds_regs->srdspccr1, srds1_pccr1 |
267 PCCR1_SGMIIF_KX_MASK);
270 if (mdio_mux[port] == EMI1_SLOT2) {
271 sprintf(alias, "phy_sgmii_s2_%x", phy);
272 fdt_set_phy_handle(fdt, compat, addr, alias);
273 fdt_status_okay_by_alias(fdt, "emi1_slot2");
274 } else if (mdio_mux[port] == EMI1_SLOT3) {
275 sprintf(alias, "phy_sgmii_s3_%x", phy);
276 fdt_set_phy_handle(fdt, compat, addr, alias);
277 fdt_status_okay_by_alias(fdt, "emi1_slot3");
281 if (hwconfig_sub("fsl_1gkx", "fm1_1g5")) {
283 fdt_set_phy_handle(fdt, compat, addr,
285 fdt_status_okay_by_alias(fdt, "1gkx_pcs_mdio5");
286 sprintf(buf, "%s%s%s", buf, "lane-g,",
287 (char *)lane_mode[0]);
288 out_be32(&srds_regs->srdspccr1, srds1_pccr1 |
289 PCCR1_SGMIIC_KX_MASK);
293 if (hwconfig_sub("fsl_1gkx", "fm1_1g6")) {
295 fdt_set_phy_handle(fdt, compat, addr,
297 fdt_status_okay_by_alias(fdt, "1gkx_pcs_mdio6");
298 sprintf(buf, "%s%s%s", buf, "lane-h,",
299 (char *)lane_mode[0]);
300 out_be32(&srds_regs->srdspccr1, srds1_pccr1 |
301 PCCR1_SGMIID_KX_MASK);
304 if (mdio_mux[port] == EMI1_SLOT1) {
305 sprintf(alias, "phy_sgmii_s1_%x", phy);
306 fdt_set_phy_handle(fdt, compat, addr, alias);
307 fdt_status_okay_by_alias(fdt, "emi1_slot1");
308 } else if (mdio_mux[port] == EMI1_SLOT2) {
309 sprintf(alias, "phy_sgmii_s2_%x", phy);
310 fdt_set_phy_handle(fdt, compat, addr, alias);
311 fdt_status_okay_by_alias(fdt, "emi1_slot2");
314 #elif defined(CONFIG_T2081QDS)
321 if (mdio_mux[port] == EMI1_SLOT2) {
322 sprintf(alias, "phy_sgmii_s2_%x", phy);
323 fdt_set_phy_handle(fdt, compat, addr, alias);
324 fdt_status_okay_by_alias(fdt, "emi1_slot2");
325 } else if (mdio_mux[port] == EMI1_SLOT3) {
326 sprintf(alias, "phy_sgmii_s3_%x", phy);
327 fdt_set_phy_handle(fdt, compat, addr, alias);
328 fdt_status_okay_by_alias(fdt, "emi1_slot3");
329 } else if (mdio_mux[port] == EMI1_SLOT5) {
330 sprintf(alias, "phy_sgmii_s5_%x", phy);
331 fdt_set_phy_handle(fdt, compat, addr, alias);
332 fdt_status_okay_by_alias(fdt, "emi1_slot5");
333 } else if (mdio_mux[port] == EMI1_SLOT6) {
334 sprintf(alias, "phy_sgmii_s6_%x", phy);
335 fdt_set_phy_handle(fdt, compat, addr, alias);
336 fdt_status_okay_by_alias(fdt, "emi1_slot6");
337 } else if (mdio_mux[port] == EMI1_SLOT7) {
338 sprintf(alias, "phy_sgmii_s7_%x", phy);
339 fdt_set_phy_handle(fdt, compat, addr, alias);
340 fdt_status_okay_by_alias(fdt, "emi1_slot7");
348 /* set property for 1000BASE-KX in dtb */
349 off = fdt_node_offset_by_compat_reg(fdt,
350 "fsl,fman-memac-mdio", addr + 0x1000);
351 fdt_setprop_string(fdt, off, "lane-instance", buf);
354 } else if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_XGMII) {
356 case 0x66: /* XFI interface */
362 * if the 10G is XFI, check hwconfig to see what is the
363 * media type, there are two types, fiber or copper,
364 * fix the dtb accordingly.
368 if (hwconfig_sub("fsl_10gkr_copper", "fm1_10g1")) {
371 fdt_set_phy_handle(fdt, compat, addr,
373 fdt_status_okay_by_alias(fdt, "xfi_pcs_mdio9");
374 sprintf(buf, "%s%s%s", buf, "lane-a,",
375 (char *)lane_mode[1]);
379 if (hwconfig_sub("fsl_10gkr_copper", "fm1_10g2")) {
382 fdt_set_phy_handle(fdt, compat, addr,
384 fdt_status_okay_by_alias(fdt, "xfi_pcs_mdio10");
385 sprintf(buf, "%s%s%s", buf, "lane-b,",
386 (char *)lane_mode[1]);
390 if (hwconfig_sub("fsl_10gkr_copper", "fm1_10g3")) {
393 fdt_set_phy_handle(fdt, compat, addr,
395 fdt_status_okay_by_alias(fdt, "xfi_pcs_mdio1");
396 sprintf(buf, "%s%s%s", buf, "lane-c,",
397 (char *)lane_mode[1]);
401 if (hwconfig_sub("fsl_10gkr_copper", "fm1_10g4")) {
404 fdt_set_phy_handle(fdt, compat, addr,
406 fdt_status_okay_by_alias(fdt, "xfi_pcs_mdio2");
407 sprintf(buf, "%s%s%s", buf, "lane-d,",
408 (char *)lane_mode[1]);
416 /* fixed-link is used for XFI fiber cable */
417 f_link.phy_id = port;
419 f_link.link_speed = 10000;
421 f_link.asym_pause = 0;
422 fdt_delprop(fdt, offset, "phy-handle");
423 fdt_setprop(fdt, offset, "fixed-link", &f_link,
426 /* set property for copper cable */
427 off = fdt_node_offset_by_compat_reg(fdt,
428 "fsl,fman-memac-mdio", addr + 0x1000);
429 fdt_setprop_string(fdt, off,
430 "lane-instance", buf);
439 void fdt_fixup_board_enet(void *fdt)
445 * This function reads RCW to check if Serdes1{A:H} is configured
446 * to slot 1/2/3/4/5/6/7 and update the lane_to_slot[] array accordingly
448 static void initialize_lane_to_slot(void)
450 ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
451 u32 srds_s1 = in_be32(&gur->rcwsr[4]) &
452 FSL_CORENET2_RCWSR4_SRDS1_PRTCL;
454 srds_s1 >>= FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT;
457 #if defined(CONFIG_T2080QDS)
484 #elif defined(CONFIG_T2081QDS)
514 int board_eth_init(bd_t *bis)
516 #if defined(CONFIG_FMAN_ENET)
517 int i, idx, lane, slot, interface;
518 struct memac_mdio_info dtsec_mdio_info;
519 struct memac_mdio_info tgec_mdio_info;
520 ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
521 u32 rcwsr13 = in_be32(&gur->rcwsr[13]);
524 srds_s1 = in_be32(&gur->rcwsr[4]) &
525 FSL_CORENET2_RCWSR4_SRDS1_PRTCL;
526 srds_s1 >>= FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT;
528 initialize_lane_to_slot();
530 /* Initialize the mdio_mux array so we can recognize empty elements */
531 for (i = 0; i < NUM_FM_PORTS; i++)
532 mdio_mux[i] = EMI_NONE;
534 dtsec_mdio_info.regs =
535 (struct memac_mdio_controller *)CONFIG_SYS_FM1_DTSEC_MDIO_ADDR;
537 dtsec_mdio_info.name = DEFAULT_FM_MDIO_NAME;
539 /* Register the 1G MDIO bus */
540 fm_memac_mdio_init(bis, &dtsec_mdio_info);
542 tgec_mdio_info.regs =
543 (struct memac_mdio_controller *)CONFIG_SYS_FM1_TGEC_MDIO_ADDR;
544 tgec_mdio_info.name = DEFAULT_FM_TGEC_MDIO_NAME;
546 /* Register the 10G MDIO bus */
547 fm_memac_mdio_init(bis, &tgec_mdio_info);
549 /* Register the muxing front-ends to the MDIO buses */
550 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_RGMII1);
551 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_RGMII2);
552 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT1);
553 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT2);
554 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT3);
555 #if defined(CONFIG_T2080QDS)
556 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT4);
558 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT5);
559 #if defined(CONFIG_T2081QDS)
560 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT6);
561 t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT7);
563 t208xqds_mdio_init(DEFAULT_FM_TGEC_MDIO_NAME, EMI2);
565 /* Set the two on-board RGMII PHY address */
566 fm_info_set_phy_address(FM1_DTSEC3, RGMII_PHY1_ADDR);
567 if ((rcwsr13 & FSL_CORENET_RCWSR13_EC2) ==
568 FSL_CORENET_RCWSR13_EC2_DTSEC4_RGMII)
569 fm_info_set_phy_address(FM1_DTSEC4, RGMII_PHY2_ADDR);
571 fm_info_set_phy_address(FM1_DTSEC10, RGMII_PHY2_ADDR);
579 /* T2080QDS: SGMII in Slot3; T2081QDS: SGMII in Slot2 */
580 fm_info_set_phy_address(FM1_DTSEC9, SGMII_CARD_PORT1_PHY_ADDR);
581 fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT2_PHY_ADDR);
582 fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR);
583 fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR);
584 /* T2080QDS: SGMII in Slot2; T2081QDS: SGMII in Slot1 */
585 fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR);
586 fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT4_PHY_ADDR);
594 /* T2080QDS: XAUI/HiGig in Slot3; T2081QDS: in Slot2 */
595 fm_info_set_phy_address(FM1_10GEC1, FM1_10GEC1_PHY_ADDR);
596 /* T2080QDS: SGMII in Slot2; T2081QDS: in Slot3 */
597 fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR);
598 fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT4_PHY_ADDR);
603 * XFI does not need a PHY to work, but to avoid U-boot use
604 * default PHY address which is zero to a MAC when it found
605 * a MAC has no PHY address, we give a PHY address to XFI
606 * MAC, and should not use a real XAUI PHY address, since
607 * MDIO can access it successfully, and then MDIO thinks
608 * the XAUI card is used for the XFI MAC, which will cause
611 fm_info_set_phy_address(FM1_10GEC1, 4);
612 fm_info_set_phy_address(FM1_10GEC2, 5);
613 fm_info_set_phy_address(FM1_10GEC3, 6);
614 fm_info_set_phy_address(FM1_10GEC4, 7);
618 fm_info_set_phy_address(FM1_10GEC1, 4);
619 fm_info_set_phy_address(FM1_10GEC2, 5);
620 fm_info_set_phy_address(FM1_10GEC3, 6);
621 fm_info_set_phy_address(FM1_10GEC4, 7);
622 /* T2080QDS: SGMII in Slot2; T2081QDS: in Slot3 */
623 fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR);
624 fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR);
628 fm_info_set_phy_address(FM1_10GEC1, 4);
629 fm_info_set_phy_address(FM1_10GEC2, 5);
630 /* T2080QDS: SGMII in Slot3; T2081QDS: in Slot2 */
631 fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR);
632 fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR);
637 fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR);
638 fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR);
640 fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR);
641 fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR);
649 fm_info_set_phy_address(FM1_DTSEC9, SGMII_CARD_PORT1_PHY_ADDR);
650 fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT2_PHY_ADDR);
651 fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR);
652 fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR);
654 fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR);
655 fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR);
661 fm_info_set_phy_address(FM1_DTSEC9, SGMII_CARD_PORT1_PHY_ADDR);
662 fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT2_PHY_ADDR);
663 fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR);
664 fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR);
666 #if defined(CONFIG_T2080QDS)
671 fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT2_PHY_ADDR);
672 fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR);
673 fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR);
675 fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR);
676 fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR);
678 #elif defined(CONFIG_T2081QDS)
682 fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT1_PHY_ADDR);
683 fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR);
685 fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT1_PHY_ADDR);
687 fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT1_PHY_ADDR);
689 fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT3_PHY_ADDR);
693 /* T2080QDS: SGMII in Slot3; T2081QDS: SGMII in Slot7 */
694 fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT1_PHY_ADDR);
695 fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT2_PHY_ADDR);
696 fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT3_PHY_ADDR);
697 fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT4_PHY_ADDR);
703 for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
704 idx = i - FM1_DTSEC1;
705 interface = fm_info_get_enet_if(i);
707 case PHY_INTERFACE_MODE_SGMII:
708 lane = serdes_get_first_lane(FSL_SRDS_1,
709 SGMII_FM1_DTSEC1 + idx);
712 slot = lane_to_slot[lane];
713 debug("FM1@DTSEC%u expects SGMII in slot %u\n",
715 if (QIXIS_READ(present2) & (1 << (slot - 1)))
720 mdio_mux[i] = EMI1_SLOT1;
721 fm_info_set_mdio(i, mii_dev_for_muxval(
725 mdio_mux[i] = EMI1_SLOT2;
726 fm_info_set_mdio(i, mii_dev_for_muxval(
730 mdio_mux[i] = EMI1_SLOT3;
731 fm_info_set_mdio(i, mii_dev_for_muxval(
734 #if defined(CONFIG_T2081QDS)
736 mdio_mux[i] = EMI1_SLOT5;
737 fm_info_set_mdio(i, mii_dev_for_muxval(
741 mdio_mux[i] = EMI1_SLOT6;
742 fm_info_set_mdio(i, mii_dev_for_muxval(
746 mdio_mux[i] = EMI1_SLOT7;
747 fm_info_set_mdio(i, mii_dev_for_muxval(
753 case PHY_INTERFACE_MODE_RGMII:
755 mdio_mux[i] = EMI1_RGMII1;
756 else if (i == FM1_DTSEC4 || FM1_DTSEC10)
757 mdio_mux[i] = EMI1_RGMII2;
758 fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
765 for (i = FM1_10GEC1; i < FM1_10GEC1 + CONFIG_SYS_NUM_FM1_10GEC; i++) {
766 idx = i - FM1_10GEC1;
767 switch (fm_info_get_enet_if(i)) {
768 case PHY_INTERFACE_MODE_XGMII:
769 if (srds_s1 == 0x51) {
770 lane = serdes_get_first_lane(FSL_SRDS_1,
771 XAUI_FM1_MAC9 + idx);
772 } else if ((srds_s1 == 0x5f) || (srds_s1 == 0x65)) {
773 lane = serdes_get_first_lane(FSL_SRDS_1,
774 HIGIG_FM1_MAC9 + idx);
776 if (i == FM1_10GEC1 || i == FM1_10GEC2)
777 lane = serdes_get_first_lane(FSL_SRDS_1,
780 lane = serdes_get_first_lane(FSL_SRDS_1,
787 fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));
789 if ((srds_s1 == 0x66) || (srds_s1 == 0x6b) ||
790 (srds_s1 == 0x6a) || (srds_s1 == 0x70) ||
791 (srds_s1 == 0x6c) || (srds_s1 == 0x6d) ||
793 /* As XFI is in cage intead of a slot, so
794 * ensure doesn't disable the corresponding port
799 slot = lane_to_slot[lane];
800 if (QIXIS_READ(present2) & (1 << (slot - 1)))
809 #endif /* CONFIG_FMAN_ENET */
811 return pci_eth_init(bis);