Blame view
board/freescale/t208xqds/eth_t208xqds.c
17.3 KB
c4d0e8115 powerpc/t2080qds:... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
/* * Copyright 2013 Freescale Semiconductor, Inc. * * Shengzhou Liu <Shengzhou.Liu@freescale.com> * * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> #include <command.h> #include <netdev.h> #include <asm/mmu.h> #include <asm/processor.h> #include <asm/immap_85xx.h> #include <asm/fsl_law.h> #include <asm/fsl_serdes.h> #include <asm/fsl_portals.h> #include <asm/fsl_liodn.h> #include <malloc.h> #include <fm_eth.h> #include <fsl_mdio.h> #include <miiphy.h> #include <phy.h> #include <asm/fsl_dtsec.h> #include <asm/fsl_serdes.h> #include "../common/qixis.h" #include "../common/fman.h" |
254887a57 powerpc/t2081qds:... |
28 |
#include "t208xqds_qixis.h" |
c4d0e8115 powerpc/t2080qds:... |
29 30 31 32 33 |
#define EMI_NONE 0xFFFFFFFF #define EMI1_RGMII1 0 #define EMI1_RGMII2 1 #define EMI1_SLOT1 2 |
254887a57 powerpc/t2081qds:... |
34 |
#if defined(CONFIG_T2080QDS) |
c4d0e8115 powerpc/t2080qds:... |
35 36 37 38 |
#define EMI1_SLOT2 6 #define EMI1_SLOT3 3 #define EMI1_SLOT4 4 #define EMI1_SLOT5 5 |
254887a57 powerpc/t2081qds:... |
39 40 41 42 43 44 45 46 |
#elif defined(CONFIG_T2081QDS) #define EMI1_SLOT2 3 #define EMI1_SLOT3 4 #define EMI1_SLOT5 5 #define EMI1_SLOT6 6 #define EMI1_SLOT7 7 #endif #define EMI2 8 |
c4d0e8115 powerpc/t2080qds:... |
47 48 49 50 |
static int mdio_mux[NUM_FM_PORTS]; static const char * const mdio_names[] = { |
254887a57 powerpc/t2081qds:... |
51 |
#if defined(CONFIG_T2080QDS) |
c4d0e8115 powerpc/t2080qds:... |
52 53 54 55 56 57 58 59 |
"T2080QDS_MDIO_RGMII1", "T2080QDS_MDIO_RGMII2", "T2080QDS_MDIO_SLOT1", "T2080QDS_MDIO_SLOT3", "T2080QDS_MDIO_SLOT4", "T2080QDS_MDIO_SLOT5", "T2080QDS_MDIO_SLOT2", "T2080QDS_MDIO_10GC", |
254887a57 powerpc/t2081qds:... |
60 61 62 63 64 65 66 67 68 69 70 |
#elif defined(CONFIG_T2081QDS) "T2081QDS_MDIO_RGMII1", "T2081QDS_MDIO_RGMII2", "T2081QDS_MDIO_SLOT1", "T2081QDS_MDIO_SLOT2", "T2081QDS_MDIO_SLOT3", "T2081QDS_MDIO_SLOT5", "T2081QDS_MDIO_SLOT6", "T2081QDS_MDIO_SLOT7", "T2081QDS_MDIO_10GC", #endif |
c4d0e8115 powerpc/t2080qds:... |
71 72 73 |
}; /* Map SerDes1 8 lanes to default slot, will be initialized dynamically */ |
254887a57 powerpc/t2081qds:... |
74 |
#if defined(CONFIG_T2080QDS) |
c4d0e8115 powerpc/t2080qds:... |
75 |
static u8 lane_to_slot[] = {3, 3, 3, 3, 1, 1, 1, 1}; |
254887a57 powerpc/t2081qds:... |
76 77 78 |
#elif defined(CONFIG_T2081QDS) static u8 lane_to_slot[] = {2, 2, 2, 2, 1, 1, 1, 1}; #endif |
c4d0e8115 powerpc/t2080qds:... |
79 |
|
254887a57 powerpc/t2081qds:... |
80 |
static const char *t208xqds_mdio_name_for_muxval(u8 muxval) |
c4d0e8115 powerpc/t2080qds:... |
81 82 83 84 85 86 87 |
{ return mdio_names[muxval]; } struct mii_dev *mii_dev_for_muxval(u8 muxval) { struct mii_dev *bus; |
254887a57 powerpc/t2081qds:... |
88 |
const char *name = t208xqds_mdio_name_for_muxval(muxval); |
c4d0e8115 powerpc/t2080qds:... |
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
if (!name) { printf("No bus for muxval %x ", muxval); return NULL; } bus = miiphy_get_dev_by_name(name); if (!bus) { printf("No bus by name %s ", name); return NULL; } return bus; } |
254887a57 powerpc/t2081qds:... |
106 |
struct t208xqds_mdio { |
c4d0e8115 powerpc/t2080qds:... |
107 108 109 |
u8 muxval; struct mii_dev *realbus; }; |
254887a57 powerpc/t2081qds:... |
110 |
static void t208xqds_mux_mdio(u8 muxval) |
c4d0e8115 powerpc/t2080qds:... |
111 112 |
{ u8 brdcfg4; |
254887a57 powerpc/t2081qds:... |
113 |
if (muxval < 8) { |
c4d0e8115 powerpc/t2080qds:... |
114 115 116 117 118 119 |
brdcfg4 = QIXIS_READ(brdcfg[4]); brdcfg4 &= ~BRDCFG4_EMISEL_MASK; brdcfg4 |= (muxval << BRDCFG4_EMISEL_SHIFT); QIXIS_WRITE(brdcfg[4], brdcfg4); } } |
254887a57 powerpc/t2081qds:... |
120 |
static int t208xqds_mdio_read(struct mii_dev *bus, int addr, int devad, |
c4d0e8115 powerpc/t2080qds:... |
121 122 |
int regnum) { |
254887a57 powerpc/t2081qds:... |
123 |
struct t208xqds_mdio *priv = bus->priv; |
c4d0e8115 powerpc/t2080qds:... |
124 |
|
254887a57 powerpc/t2081qds:... |
125 |
t208xqds_mux_mdio(priv->muxval); |
c4d0e8115 powerpc/t2080qds:... |
126 127 128 |
return priv->realbus->read(priv->realbus, addr, devad, regnum); } |
254887a57 powerpc/t2081qds:... |
129 |
static int t208xqds_mdio_write(struct mii_dev *bus, int addr, int devad, |
c4d0e8115 powerpc/t2080qds:... |
130 131 |
int regnum, u16 value) { |
254887a57 powerpc/t2081qds:... |
132 |
struct t208xqds_mdio *priv = bus->priv; |
c4d0e8115 powerpc/t2080qds:... |
133 |
|
254887a57 powerpc/t2081qds:... |
134 |
t208xqds_mux_mdio(priv->muxval); |
c4d0e8115 powerpc/t2080qds:... |
135 136 137 |
return priv->realbus->write(priv->realbus, addr, devad, regnum, value); } |
254887a57 powerpc/t2081qds:... |
138 |
static int t208xqds_mdio_reset(struct mii_dev *bus) |
c4d0e8115 powerpc/t2080qds:... |
139 |
{ |
254887a57 powerpc/t2081qds:... |
140 |
struct t208xqds_mdio *priv = bus->priv; |
c4d0e8115 powerpc/t2080qds:... |
141 142 143 |
return priv->realbus->reset(priv->realbus); } |
254887a57 powerpc/t2081qds:... |
144 |
static int t208xqds_mdio_init(char *realbusname, u8 muxval) |
c4d0e8115 powerpc/t2080qds:... |
145 |
{ |
254887a57 powerpc/t2081qds:... |
146 |
struct t208xqds_mdio *pmdio; |
c4d0e8115 powerpc/t2080qds:... |
147 148 149 |
struct mii_dev *bus = mdio_alloc(); if (!bus) { |
254887a57 powerpc/t2081qds:... |
150 151 |
printf("Failed to allocate t208xqds MDIO bus "); |
c4d0e8115 powerpc/t2080qds:... |
152 153 154 155 156 |
return -1; } pmdio = malloc(sizeof(*pmdio)); if (!pmdio) { |
254887a57 powerpc/t2081qds:... |
157 158 |
printf("Failed to allocate t208xqds private data "); |
c4d0e8115 powerpc/t2080qds:... |
159 160 161 |
free(bus); return -1; } |
254887a57 powerpc/t2081qds:... |
162 163 164 165 |
bus->read = t208xqds_mdio_read; bus->write = t208xqds_mdio_write; bus->reset = t208xqds_mdio_reset; sprintf(bus->name, t208xqds_mdio_name_for_muxval(muxval)); |
c4d0e8115 powerpc/t2080qds:... |
166 167 168 169 170 171 172 173 174 175 176 177 178 |
pmdio->realbus = miiphy_get_dev_by_name(realbusname); if (!pmdio->realbus) { printf("No bus with name %s ", realbusname); free(bus); free(pmdio); return -1; } pmdio->muxval = muxval; bus->priv = pmdio; |
c4d0e8115 powerpc/t2080qds:... |
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
return mdio_register(bus); } void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr, enum fm_port port, int offset) { int phy; char alias[20]; struct fixed_link f_link; ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); u32 srds_s1 = in_be32(&gur->rcwsr[4]) & FSL_CORENET2_RCWSR4_SRDS1_PRTCL; srds_s1 >>= FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT; if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_SGMII) { phy = fm_info_get_phy_address(port); switch (port) { |
254887a57 powerpc/t2081qds:... |
197 |
#if defined(CONFIG_T2080QDS) |
c4d0e8115 powerpc/t2080qds:... |
198 199 200 201 |
case FM1_DTSEC1: case FM1_DTSEC2: case FM1_DTSEC9: case FM1_DTSEC10: |
254887a57 powerpc/t2081qds:... |
202 203 204 205 206 207 208 209 210 |
if (mdio_mux[port] == EMI1_SLOT2) { sprintf(alias, "phy_sgmii_s2_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot2"); } else if (mdio_mux[port] == EMI1_SLOT3) { sprintf(alias, "phy_sgmii_s3_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot3"); } |
c4d0e8115 powerpc/t2080qds:... |
211 212 213 214 215 216 217 218 219 220 221 222 223 |
break; case FM1_DTSEC5: case FM1_DTSEC6: if (mdio_mux[port] == EMI1_SLOT1) { sprintf(alias, "phy_sgmii_s1_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot1"); } else if (mdio_mux[port] == EMI1_SLOT2) { sprintf(alias, "phy_sgmii_s2_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot2"); } break; |
254887a57 powerpc/t2081qds:... |
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
#elif defined(CONFIG_T2081QDS) case FM1_DTSEC1: case FM1_DTSEC2: case FM1_DTSEC5: case FM1_DTSEC6: case FM1_DTSEC9: case FM1_DTSEC10: if (mdio_mux[port] == EMI1_SLOT2) { sprintf(alias, "phy_sgmii_s2_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot2"); } else if (mdio_mux[port] == EMI1_SLOT3) { sprintf(alias, "phy_sgmii_s3_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot3"); } else if (mdio_mux[port] == EMI1_SLOT5) { sprintf(alias, "phy_sgmii_s5_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot5"); } else if (mdio_mux[port] == EMI1_SLOT6) { sprintf(alias, "phy_sgmii_s6_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot6"); } else if (mdio_mux[port] == EMI1_SLOT7) { sprintf(alias, "phy_sgmii_s7_%x", phy); fdt_set_phy_handle(fdt, compat, addr, alias); fdt_status_okay_by_alias(fdt, "emi1_slot7"); } break; #endif |
c4d0e8115 powerpc/t2080qds:... |
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
default: break; } } else if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_XGMII) { switch (srds_s1) { case 0x66: /* XFI interface */ case 0x6b: case 0x6c: case 0x6d: case 0x71: f_link.phy_id = port; f_link.duplex = 1; f_link.link_speed = 10000; f_link.pause = 0; f_link.asym_pause = 0; /* no PHY for XFI */ fdt_delprop(fdt, offset, "phy-handle"); fdt_setprop(fdt, offset, "fixed-link", &f_link, sizeof(f_link)); break; default: break; } } } void fdt_fixup_board_enet(void *fdt) { return; } /* |
254887a57 powerpc/t2081qds:... |
287 288 |
* This function reads RCW to check if Serdes1{A:H} is configured * to slot 1/2/3/4/5/6/7 and update the lane_to_slot[] array accordingly |
c4d0e8115 powerpc/t2080qds:... |
289 290 291 292 293 294 295 296 297 298 |
*/ static void initialize_lane_to_slot(void) { ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); u32 srds_s1 = in_be32(&gur->rcwsr[4]) & FSL_CORENET2_RCWSR4_SRDS1_PRTCL; srds_s1 >>= FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT; switch (srds_s1) { |
254887a57 powerpc/t2081qds:... |
299 |
#if defined(CONFIG_T2080QDS) |
c4d0e8115 powerpc/t2080qds:... |
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
case 0x51: case 0x5f: case 0x65: case 0x6b: case 0x71: lane_to_slot[5] = 2; lane_to_slot[6] = 2; lane_to_slot[7] = 2; break; case 0xa6: case 0x8e: case 0x8f: case 0x82: case 0x83: case 0xd3: case 0xd9: case 0xcb: lane_to_slot[6] = 2; lane_to_slot[7] = 2; break; case 0xda: lane_to_slot[4] = 3; lane_to_slot[5] = 3; lane_to_slot[6] = 3; lane_to_slot[7] = 3; break; |
254887a57 powerpc/t2081qds:... |
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
#elif defined(CONFIG_T2081QDS) case 0x6b: lane_to_slot[4] = 1; lane_to_slot[5] = 3; lane_to_slot[6] = 3; lane_to_slot[7] = 3; break; case 0xca: case 0xcb: lane_to_slot[1] = 7; lane_to_slot[2] = 6; lane_to_slot[3] = 5; lane_to_slot[5] = 3; lane_to_slot[6] = 3; lane_to_slot[7] = 3; break; case 0xf2: lane_to_slot[1] = 7; lane_to_slot[2] = 7; lane_to_slot[3] = 7; lane_to_slot[5] = 4; lane_to_slot[6] = 3; lane_to_slot[7] = 7; break; #endif |
c4d0e8115 powerpc/t2080qds:... |
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
default: break; } } int board_eth_init(bd_t *bis) { #if defined(CONFIG_FMAN_ENET) int i, idx, lane, slot, interface; struct memac_mdio_info dtsec_mdio_info; struct memac_mdio_info tgec_mdio_info; ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); u32 rcwsr13 = in_be32(&gur->rcwsr[13]); u32 srds_s1; srds_s1 = in_be32(&gur->rcwsr[4]) & FSL_CORENET2_RCWSR4_SRDS1_PRTCL; srds_s1 >>= FSL_CORENET2_RCWSR4_SRDS1_PRTCL_SHIFT; initialize_lane_to_slot(); /* Initialize the mdio_mux array so we can recognize empty elements */ for (i = 0; i < NUM_FM_PORTS; i++) mdio_mux[i] = EMI_NONE; dtsec_mdio_info.regs = (struct memac_mdio_controller *)CONFIG_SYS_FM1_DTSEC_MDIO_ADDR; dtsec_mdio_info.name = DEFAULT_FM_MDIO_NAME; /* Register the 1G MDIO bus */ fm_memac_mdio_init(bis, &dtsec_mdio_info); tgec_mdio_info.regs = (struct memac_mdio_controller *)CONFIG_SYS_FM1_TGEC_MDIO_ADDR; tgec_mdio_info.name = DEFAULT_FM_TGEC_MDIO_NAME; /* Register the 10G MDIO bus */ fm_memac_mdio_init(bis, &tgec_mdio_info); /* Register the muxing front-ends to the MDIO buses */ |
254887a57 powerpc/t2081qds:... |
392 393 394 395 396 397 398 399 400 401 402 403 404 405 |
t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_RGMII1); t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_RGMII2); t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT1); t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT2); t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT3); #if defined(CONFIG_T2080QDS) t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT4); #endif t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT5); #if defined(CONFIG_T2081QDS) t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT6); t208xqds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT7); #endif t208xqds_mdio_init(DEFAULT_FM_TGEC_MDIO_NAME, EMI2); |
c4d0e8115 powerpc/t2080qds:... |
406 407 408 409 410 411 412 413 414 415 416 417 418 419 |
/* Set the two on-board RGMII PHY address */ fm_info_set_phy_address(FM1_DTSEC3, RGMII_PHY1_ADDR); if ((rcwsr13 & FSL_CORENET_RCWSR13_EC2) == FSL_CORENET_RCWSR13_EC2_DTSEC4_RGMII) fm_info_set_phy_address(FM1_DTSEC4, RGMII_PHY2_ADDR); else fm_info_set_phy_address(FM1_DTSEC10, RGMII_PHY2_ADDR); switch (srds_s1) { case 0x1c: case 0x95: case 0xa2: case 0x94: |
254887a57 powerpc/t2081qds:... |
420 |
/* T2080QDS: SGMII in Slot3; T2081QDS: SGMII in Slot2 */ |
c4d0e8115 powerpc/t2080qds:... |
421 422 423 424 |
fm_info_set_phy_address(FM1_DTSEC9, SGMII_CARD_PORT1_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT2_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR); |
254887a57 powerpc/t2081qds:... |
425 |
/* T2080QDS: SGMII in Slot2; T2081QDS: SGMII in Slot1 */ |
c4d0e8115 powerpc/t2080qds:... |
426 427 428 429 430 431 |
fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT4_PHY_ADDR); break; case 0x51: case 0x5f: case 0x65: |
254887a57 powerpc/t2081qds:... |
432 |
/* T2080QDS: XAUI/HiGig in Slot3; T2081QDS: in Slot2 */ |
c4d0e8115 powerpc/t2080qds:... |
433 |
fm_info_set_phy_address(FM1_10GEC1, FM1_10GEC1_PHY_ADDR); |
254887a57 powerpc/t2081qds:... |
434 |
/* T2080QDS: SGMII in Slot2; T2081QDS: in Slot3 */ |
c4d0e8115 powerpc/t2080qds:... |
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT4_PHY_ADDR); break; case 0x66: /* * XFI does not need a PHY to work, but to avoid U-boot use * default PHY address which is zero to a MAC when it found * a MAC has no PHY address, we give a PHY address to XFI * MAC, and should not use a real XAUI PHY address, since * MDIO can access it successfully, and then MDIO thinks * the XAUI card is used for the XFI MAC, which will cause * error. */ fm_info_set_phy_address(FM1_10GEC1, 4); fm_info_set_phy_address(FM1_10GEC2, 5); fm_info_set_phy_address(FM1_10GEC3, 6); fm_info_set_phy_address(FM1_10GEC4, 7); break; case 0x6b: fm_info_set_phy_address(FM1_10GEC1, 4); fm_info_set_phy_address(FM1_10GEC2, 5); fm_info_set_phy_address(FM1_10GEC3, 6); fm_info_set_phy_address(FM1_10GEC4, 7); |
254887a57 powerpc/t2081qds:... |
458 |
/* T2080QDS: SGMII in Slot2; T2081QDS: in Slot3 */ |
c4d0e8115 powerpc/t2080qds:... |
459 460 461 462 463 |
fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); break; case 0x6c: case 0x6d: |
1576b558b powerpc/t2080qds:... |
464 465 |
fm_info_set_phy_address(FM1_10GEC1, 4); fm_info_set_phy_address(FM1_10GEC2, 5); |
254887a57 powerpc/t2081qds:... |
466 |
/* T2080QDS: SGMII in Slot3; T2081QDS: in Slot2 */ |
c4d0e8115 powerpc/t2080qds:... |
467 |
fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR); |
1576b558b powerpc/t2080qds:... |
468 |
fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR); |
c4d0e8115 powerpc/t2080qds:... |
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
break; case 0x71: /* SGMII in Slot3 */ fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR); /* SGMII in Slot2 */ fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); break; case 0xa6: case 0x8e: case 0x8f: case 0x82: case 0x83: /* SGMII in Slot3 */ fm_info_set_phy_address(FM1_DTSEC9, SGMII_CARD_PORT1_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT2_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR); /* SGMII in Slot2 */ fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); break; case 0xa4: case 0x96: case 0x8a: /* SGMII in Slot3 */ fm_info_set_phy_address(FM1_DTSEC9, SGMII_CARD_PORT1_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT2_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR); break; |
254887a57 powerpc/t2081qds:... |
501 |
#if defined(CONFIG_T2080QDS) |
c4d0e8115 powerpc/t2080qds:... |
502 503 504 505 506 507 508 509 510 511 512 |
case 0xd9: case 0xd3: case 0xcb: /* SGMII in Slot3 */ fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT2_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT4_PHY_ADDR); /* SGMII in Slot2 */ fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); break; |
254887a57 powerpc/t2081qds:... |
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 |
#elif defined(CONFIG_T2081QDS) case 0xca: case 0xcb: /* SGMII in Slot3 */ fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT1_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); /* SGMII in Slot5 */ fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT1_PHY_ADDR); /* SGMII in Slot6 */ fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT1_PHY_ADDR); /* SGMII in Slot7 */ fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT3_PHY_ADDR); break; #endif case 0xf2: /* T2080QDS: SGMII in Slot3; T2081QDS: SGMII in Slot7 */ fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT1_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT2_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC10, SGMII_CARD_PORT3_PHY_ADDR); fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT4_PHY_ADDR); break; |
c4d0e8115 powerpc/t2080qds:... |
534 |
default: |
c4d0e8115 powerpc/t2080qds:... |
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 |
break; } for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) { idx = i - FM1_DTSEC1; interface = fm_info_get_enet_if(i); switch (interface) { case PHY_INTERFACE_MODE_SGMII: lane = serdes_get_first_lane(FSL_SRDS_1, SGMII_FM1_DTSEC1 + idx); if (lane < 0) break; slot = lane_to_slot[lane]; debug("FM1@DTSEC%u expects SGMII in slot %u ", idx + 1, slot); if (QIXIS_READ(present2) & (1 << (slot - 1))) fm_disable_port(i); switch (slot) { case 1: mdio_mux[i] = EMI1_SLOT1; fm_info_set_mdio(i, mii_dev_for_muxval( mdio_mux[i])); break; case 2: mdio_mux[i] = EMI1_SLOT2; fm_info_set_mdio(i, mii_dev_for_muxval( mdio_mux[i])); break; |
1576b558b powerpc/t2080qds:... |
565 566 567 |
case 3: mdio_mux[i] = EMI1_SLOT3; fm_info_set_mdio(i, mii_dev_for_muxval( |
254887a57 powerpc/t2081qds:... |
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
mdio_mux[i])); break; #if defined(CONFIG_T2081QDS) case 5: mdio_mux[i] = EMI1_SLOT5; fm_info_set_mdio(i, mii_dev_for_muxval( mdio_mux[i])); break; case 6: mdio_mux[i] = EMI1_SLOT6; fm_info_set_mdio(i, mii_dev_for_muxval( mdio_mux[i])); break; case 7: mdio_mux[i] = EMI1_SLOT7; fm_info_set_mdio(i, mii_dev_for_muxval( mdio_mux[i])); |
1576b558b powerpc/t2080qds:... |
585 |
break; |
254887a57 powerpc/t2081qds:... |
586 |
#endif |
1576b558b powerpc/t2080qds:... |
587 |
} |
c4d0e8115 powerpc/t2080qds:... |
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
break; case PHY_INTERFACE_MODE_RGMII: if (i == FM1_DTSEC3) mdio_mux[i] = EMI1_RGMII1; else if (i == FM1_DTSEC4 || FM1_DTSEC10) mdio_mux[i] = EMI1_RGMII2; fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i])); break; default: break; } } for (i = FM1_10GEC1; i < FM1_10GEC1 + CONFIG_SYS_NUM_FM1_10GEC; i++) { idx = i - FM1_10GEC1; switch (fm_info_get_enet_if(i)) { case PHY_INTERFACE_MODE_XGMII: if (srds_s1 == 0x51) { lane = serdes_get_first_lane(FSL_SRDS_1, XAUI_FM1_MAC9 + idx); } else if ((srds_s1 == 0x5f) || (srds_s1 == 0x65)) { lane = serdes_get_first_lane(FSL_SRDS_1, HIGIG_FM1_MAC9 + idx); } else { if (i == FM1_10GEC1 || i == FM1_10GEC2) lane = serdes_get_first_lane(FSL_SRDS_1, XFI_FM1_MAC9 + idx); else lane = serdes_get_first_lane(FSL_SRDS_1, XFI_FM1_MAC1 + idx); } if (lane < 0) break; mdio_mux[i] = EMI2; fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i])); if ((srds_s1 == 0x66) || (srds_s1 == 0x6b) || (srds_s1 == 0x6c) || (srds_s1 == 0x6d) || (srds_s1 == 0x71)) { /* As XFI is in cage intead of a slot, so * ensure doesn't disable the corresponding port */ break; } slot = lane_to_slot[lane]; if (QIXIS_READ(present2) & (1 << (slot - 1))) fm_disable_port(i); break; default: break; } } cpu_eth_init(bis); #endif /* CONFIG_FMAN_ENET */ return pci_eth_init(bis); } |