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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50#include <common.h>
51#include <log.h>
52#include <net.h>
53#include <netdev.h>
54#include <asm/fsl_serdes.h>
55#include <fm_eth.h>
56#include <fsl_mdio.h>
57#include <malloc.h>
58#include <fdt_support.h>
59#include <fsl_dtsec.h>
60
61#include "../common/ngpixis.h"
62#include "../common/fman.h"
63
64#ifdef CONFIG_FMAN_ENET
65
66#define BRDCFG1_EMI1_SEL_MASK 0x70
67#define BRDCFG1_EMI1_SEL_SLOT1 0x10
68#define BRDCFG1_EMI1_SEL_SLOT2 0x20
69#define BRDCFG1_EMI1_SEL_SLOT5 0x30
70#define BRDCFG1_EMI1_SEL_SLOT6 0x40
71#define BRDCFG1_EMI1_SEL_SLOT7 0x50
72#define BRDCFG1_EMI1_SEL_SLOT3 0x60
73#define BRDCFG1_EMI1_SEL_RGMII 0x00
74#define BRDCFG1_EMI1_EN 0x08
75#define BRDCFG1_EMI2_SEL_MASK 0x06
76#define BRDCFG1_EMI2_SEL_SLOT1 0x00
77#define BRDCFG1_EMI2_SEL_SLOT2 0x02
78
79#define BRDCFG2_REG_GPIO_SEL 0x20
80
81
82#define PHY_BASE_ADDR 0x00
83#define REGNUM 0x00
84#define PORT_NUM_FM1 0x04
85#define PORT_NUM_FM2 0x02
86
87
88
89
90
91
92
93static struct {
94 u8 mask;
95 u8 val;
96} mdio_mux[NUM_FM_PORTS];
97
98
99
100
101
102
103static u8 lane_to_slot[] = {
104 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0
105};
106
107
108
109
110
111
112void super_hydra_mux_mdio(u8 mask, u8 val)
113{
114 clrsetbits_8(&pixis->brdcfg1, mask, val);
115}
116
117struct super_hydra_mdio {
118 u8 mask;
119 u8 val;
120 struct mii_dev *realbus;
121};
122
123static int super_hydra_mdio_read(struct mii_dev *bus, int addr, int devad,
124 int regnum)
125{
126 struct super_hydra_mdio *priv = bus->priv;
127
128 super_hydra_mux_mdio(priv->mask, priv->val);
129
130 return priv->realbus->read(priv->realbus, addr, devad, regnum);
131}
132
133static int super_hydra_mdio_write(struct mii_dev *bus, int addr, int devad,
134 int regnum, u16 value)
135{
136 struct super_hydra_mdio *priv = bus->priv;
137
138 super_hydra_mux_mdio(priv->mask, priv->val);
139
140 return priv->realbus->write(priv->realbus, addr, devad, regnum, value);
141}
142
143static int super_hydra_mdio_reset(struct mii_dev *bus)
144{
145 struct super_hydra_mdio *priv = bus->priv;
146
147 return priv->realbus->reset(priv->realbus);
148}
149
150static void super_hydra_mdio_set_mux(char *name, u8 mask, u8 val)
151{
152 struct mii_dev *bus = miiphy_get_dev_by_name(name);
153 struct super_hydra_mdio *priv = bus->priv;
154
155 priv->mask = mask;
156 priv->val = val;
157}
158
159static int super_hydra_mdio_init(char *realbusname, char *fakebusname)
160{
161 struct super_hydra_mdio *hmdio;
162 struct mii_dev *bus = mdio_alloc();
163
164 if (!bus) {
165 printf("Failed to allocate Hydra MDIO bus\n");
166 return -1;
167 }
168
169 hmdio = malloc(sizeof(*hmdio));
170 if (!hmdio) {
171 printf("Failed to allocate Hydra private data\n");
172 free(bus);
173 return -1;
174 }
175
176 bus->read = super_hydra_mdio_read;
177 bus->write = super_hydra_mdio_write;
178 bus->reset = super_hydra_mdio_reset;
179 strcpy(bus->name, fakebusname);
180
181 hmdio->realbus = miiphy_get_dev_by_name(realbusname);
182
183 if (!hmdio->realbus) {
184 printf("No bus with name %s\n", realbusname);
185 free(bus);
186 free(hmdio);
187 return -1;
188 }
189
190 bus->priv = hmdio;
191
192 return mdio_register(bus);
193}
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215void board_ft_fman_fixup_port(void *fdt, char *compat, phys_addr_t addr,
216 enum fm_port port, int offset)
217{
218 enum srds_prtcl device;
219 int lane, slot, phy;
220 char alias[32];
221
222
223
224 if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_SGMII) {
225 device = serdes_device_from_fm_port(port);
226 lane = serdes_get_first_lane(device);
227 slot = lane_to_slot[lane];
228 phy = fm_info_get_phy_address(port);
229
230 sprintf(alias, "phy_sgmii_slot%u_%x", slot, phy);
231 fdt_set_phy_handle(fdt, compat, addr, alias);
232 }
233}
234
235#define PIXIS_SW2_LANE_23_SEL 0x80
236#define PIXIS_SW2_LANE_45_SEL 0x40
237#define PIXIS_SW2_LANE_67_SEL_MASK 0x30
238#define PIXIS_SW2_LANE_67_SEL_5 0x00
239#define PIXIS_SW2_LANE_67_SEL_6 0x20
240#define PIXIS_SW2_LANE_67_SEL_7 0x10
241#define PIXIS_SW2_LANE_8_SEL 0x08
242#define PIXIS_SW2_LANE_1617_SEL 0x04
243#define PIXIS_SW11_LANE_9_SEL 0x04
244
245
246
247
248
249
250
251
252static void initialize_lane_to_slot(void)
253{
254 u8 sw2 = in_8(&PIXIS_SW(2));
255
256 u8 sw11 = in_8(&PIXIS_SW(9));
257
258 lane_to_slot[2] = (sw2 & PIXIS_SW2_LANE_23_SEL) ? 7 : 4;
259 lane_to_slot[3] = lane_to_slot[2];
260
261 lane_to_slot[4] = (sw2 & PIXIS_SW2_LANE_45_SEL) ? 7 : 6;
262 lane_to_slot[5] = lane_to_slot[4];
263
264 switch (sw2 & PIXIS_SW2_LANE_67_SEL_MASK) {
265 case PIXIS_SW2_LANE_67_SEL_5:
266 lane_to_slot[6] = 5;
267 break;
268 case PIXIS_SW2_LANE_67_SEL_6:
269 lane_to_slot[6] = 6;
270 break;
271 case PIXIS_SW2_LANE_67_SEL_7:
272 lane_to_slot[6] = 7;
273 break;
274 }
275 lane_to_slot[7] = lane_to_slot[6];
276
277 lane_to_slot[8] = (sw2 & PIXIS_SW2_LANE_8_SEL) ? 3 : 0;
278 lane_to_slot[9] = (sw11 & PIXIS_SW11_LANE_9_SEL) ? 0 : 3;
279
280 lane_to_slot[16] = (sw2 & PIXIS_SW2_LANE_1617_SEL) ? 1 : 0;
281 lane_to_slot[17] = lane_to_slot[16];
282}
283
284#endif
285
286
287
288
289
290
291
292
293
294
295
296
297void fdt_fixup_board_enet(void *fdt)
298{
299#ifdef CONFIG_FMAN_ENET
300 enum fm_port i;
301 int lane, slot;
302
303 for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
304 int idx = i - FM1_DTSEC1;
305
306 switch (fm_info_get_enet_if(i)) {
307 case PHY_INTERFACE_MODE_SGMII:
308 lane = serdes_get_first_lane(SGMII_FM1_DTSEC1 + idx);
309 if (lane >= 0) {
310 char alias[32];
311
312 slot = lane_to_slot[lane];
313 sprintf(alias, "hydra_sg_slot%u", slot);
314 fdt_status_okay_by_alias(fdt, alias);
315 debug("Enabled MDIO node %s (slot %i)\n",
316 alias, slot);
317 }
318 break;
319 case PHY_INTERFACE_MODE_RGMII:
320 case PHY_INTERFACE_MODE_RGMII_TXID:
321 case PHY_INTERFACE_MODE_RGMII_RXID:
322 case PHY_INTERFACE_MODE_RGMII_ID:
323 fdt_status_okay_by_alias(fdt, "hydra_rg");
324 debug("Enabled MDIO node hydra_rg\n");
325 break;
326 default:
327 break;
328 }
329 }
330
331 lane = serdes_get_first_lane(XAUI_FM1);
332 if (lane >= 0) {
333 char alias[32];
334
335 slot = lane_to_slot[lane];
336 sprintf(alias, "hydra_xg_slot%u", slot);
337 fdt_status_okay_by_alias(fdt, alias);
338 debug("Enabled MDIO node %s (slot %i)\n", alias, slot);
339 }
340
341#if CONFIG_SYS_NUM_FMAN == 2
342 for (i = FM2_DTSEC1; i < FM2_DTSEC1 + CONFIG_SYS_NUM_FM2_DTSEC; i++) {
343 int idx = i - FM2_DTSEC1;
344
345 switch (fm_info_get_enet_if(i)) {
346 case PHY_INTERFACE_MODE_SGMII:
347 lane = serdes_get_first_lane(SGMII_FM2_DTSEC1 + idx);
348 if (lane >= 0) {
349 char alias[32];
350
351 slot = lane_to_slot[lane];
352 sprintf(alias, "hydra_sg_slot%u", slot);
353 fdt_status_okay_by_alias(fdt, alias);
354 debug("Enabled MDIO node %s (slot %i)\n",
355 alias, slot);
356 }
357 break;
358 case PHY_INTERFACE_MODE_RGMII:
359 case PHY_INTERFACE_MODE_RGMII_TXID:
360 case PHY_INTERFACE_MODE_RGMII_RXID:
361 case PHY_INTERFACE_MODE_RGMII_ID:
362 fdt_status_okay_by_alias(fdt, "hydra_rg");
363 debug("Enabled MDIO node hydra_rg\n");
364 break;
365 default:
366 break;
367 }
368 }
369
370 lane = serdes_get_first_lane(XAUI_FM2);
371 if (lane >= 0) {
372 char alias[32];
373
374 slot = lane_to_slot[lane];
375 sprintf(alias, "hydra_xg_slot%u", slot);
376 fdt_status_okay_by_alias(fdt, alias);
377 debug("Enabled MDIO node %s (slot %i)\n", alias, slot);
378 }
379#endif
380#endif
381}
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424int board_eth_init(struct bd_info *bis)
425{
426#ifdef CONFIG_FMAN_ENET
427 struct fsl_pq_mdio_info dtsec_mdio_info;
428 struct tgec_mdio_info tgec_mdio_info;
429 unsigned int i, slot;
430 int lane;
431 struct mii_dev *bus;
432 int qsgmii;
433 int phy_real_addr;
434 ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
435 int srds_prtcl = (in_be32(&gur->rcwsr[4]) &
436 FSL_CORENET_RCWSR4_SRDS_PRTCL) >> 26;
437
438 printf("Initializing Fman\n");
439
440 initialize_lane_to_slot();
441
442
443 setbits_8(&pixis->brdcfg2, BRDCFG2_REG_GPIO_SEL);
444
445 memset(mdio_mux, 0, sizeof(mdio_mux));
446
447 dtsec_mdio_info.regs =
448 (struct tsec_mii_mng *)CONFIG_SYS_FM1_DTSEC1_MDIO_ADDR;
449 dtsec_mdio_info.name = DEFAULT_FM_MDIO_NAME;
450
451
452 fsl_pq_mdio_init(bis, &dtsec_mdio_info);
453
454 tgec_mdio_info.regs =
455 (struct tgec_mdio_controller *)CONFIG_SYS_FM1_TGEC_MDIO_ADDR;
456 tgec_mdio_info.name = DEFAULT_FM_TGEC_MDIO_NAME;
457
458
459 fm_tgec_mdio_init(bis, &tgec_mdio_info);
460
461
462 super_hydra_mdio_init(DEFAULT_FM_MDIO_NAME,
463 "SUPER_HYDRA_RGMII_MDIO");
464 super_hydra_mdio_init(DEFAULT_FM_MDIO_NAME,
465 "SUPER_HYDRA_FM1_SGMII_MDIO");
466 super_hydra_mdio_init(DEFAULT_FM_MDIO_NAME,
467 "SUPER_HYDRA_FM2_SGMII_MDIO");
468 super_hydra_mdio_init(DEFAULT_FM_MDIO_NAME,
469 "SUPER_HYDRA_FM3_SGMII_MDIO");
470 super_hydra_mdio_init(DEFAULT_FM_TGEC_MDIO_NAME,
471 "SUPER_HYDRA_FM1_TGEC_MDIO");
472 super_hydra_mdio_init(DEFAULT_FM_TGEC_MDIO_NAME,
473 "SUPER_HYDRA_FM2_TGEC_MDIO");
474
475
476
477
478
479
480 fm_info_set_phy_address(FM1_DTSEC1, CONFIG_SYS_FM1_DTSEC1_PHY_ADDR);
481 fm_info_set_phy_address(FM1_DTSEC2, CONFIG_SYS_FM1_DTSEC2_PHY_ADDR);
482 fm_info_set_phy_address(FM1_10GEC1, CONFIG_SYS_FM2_10GEC1_PHY_ADDR);
483
484#if (CONFIG_SYS_NUM_FMAN == 2)
485 fm_info_set_phy_address(FM2_DTSEC1, CONFIG_SYS_FM2_DTSEC1_PHY_ADDR);
486 fm_info_set_phy_address(FM2_DTSEC2, CONFIG_SYS_FM2_DTSEC2_PHY_ADDR);
487 fm_info_set_phy_address(FM2_DTSEC3, CONFIG_SYS_FM2_DTSEC1_PHY_ADDR);
488 fm_info_set_phy_address(FM2_DTSEC4, CONFIG_SYS_FM2_DTSEC2_PHY_ADDR);
489 fm_info_set_phy_address(FM2_10GEC1, CONFIG_SYS_FM1_10GEC1_PHY_ADDR);
490#endif
491
492 switch (srds_prtcl) {
493 case 0:
494 case 3:
495 case 4:
496 case 6:
497 case 0x11:
498 case 0x2a:
499 case 0x34:
500 case 0x36:
501 fm_info_set_phy_address(FM1_DTSEC3,
502 CONFIG_SYS_FM1_DTSEC3_PHY_ADDR);
503 fm_info_set_phy_address(FM1_DTSEC4,
504 CONFIG_SYS_FM1_DTSEC4_PHY_ADDR);
505 break;
506 case 1:
507 case 2:
508 case 5:
509 case 7:
510 case 0x35:
511 fm_info_set_phy_address(FM1_DTSEC3,
512 CONFIG_SYS_FM1_DTSEC1_PHY_ADDR);
513 fm_info_set_phy_address(FM1_DTSEC4,
514 CONFIG_SYS_FM1_DTSEC2_PHY_ADDR);
515 break;
516 default:
517 printf("Fman: Unsupport SerDes Protocol 0x%02x\n", srds_prtcl);
518 break;
519 }
520
521 for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) {
522 int idx = i - FM1_DTSEC1;
523
524 switch (fm_info_get_enet_if(i)) {
525 case PHY_INTERFACE_MODE_SGMII:
526 lane = serdes_get_first_lane(SGMII_FM1_DTSEC1 + idx);
527 if (lane < 0)
528 break;
529 slot = lane_to_slot[lane];
530 mdio_mux[i].mask = BRDCFG1_EMI1_SEL_MASK;
531 debug("FM1@DTSEC%u expects SGMII in slot %u\n",
532 idx + 1, slot);
533 switch (slot) {
534 case 1:
535 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT1 |
536 BRDCFG1_EMI1_EN;
537 break;
538 case 2:
539 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT2 |
540 BRDCFG1_EMI1_EN;
541 break;
542 case 3:
543 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT3 |
544 BRDCFG1_EMI1_EN;
545 break;
546 case 5:
547 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT5 |
548 BRDCFG1_EMI1_EN;
549 break;
550 case 6:
551 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT6 |
552 BRDCFG1_EMI1_EN;
553 break;
554 case 7:
555 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT7 |
556 BRDCFG1_EMI1_EN;
557 break;
558 };
559
560 super_hydra_mdio_set_mux("SUPER_HYDRA_FM1_SGMII_MDIO",
561 mdio_mux[i].mask, mdio_mux[i].val);
562 fm_info_set_mdio(i,
563 miiphy_get_dev_by_name("SUPER_HYDRA_FM1_SGMII_MDIO"));
564 break;
565 case PHY_INTERFACE_MODE_RGMII:
566 case PHY_INTERFACE_MODE_RGMII_TXID:
567 case PHY_INTERFACE_MODE_RGMII_RXID:
568 case PHY_INTERFACE_MODE_RGMII_ID:
569
570
571
572
573
574
575 debug("FM1@DTSEC%u is RGMII at address %u\n",
576 idx + 1, 0);
577 fm_info_set_phy_address(i, 0);
578 mdio_mux[i].mask = BRDCFG1_EMI1_SEL_MASK;
579 mdio_mux[i].val = BRDCFG1_EMI1_SEL_RGMII |
580 BRDCFG1_EMI1_EN;
581 super_hydra_mdio_set_mux("SUPER_HYDRA_RGMII_MDIO",
582 mdio_mux[i].mask, mdio_mux[i].val);
583 fm_info_set_mdio(i,
584 miiphy_get_dev_by_name("SUPER_HYDRA_RGMII_MDIO"));
585 break;
586 case PHY_INTERFACE_MODE_NONE:
587 fm_info_set_phy_address(i, 0);
588 break;
589 default:
590 printf("Fman1: DTSEC%u set to unknown interface %i\n",
591 idx + 1, fm_info_get_enet_if(i));
592 fm_info_set_phy_address(i, 0);
593 break;
594 }
595 }
596
597 bus = miiphy_get_dev_by_name("SUPER_HYDRA_FM1_SGMII_MDIO");
598 qsgmii = is_qsgmii_riser_card(bus, PHY_BASE_ADDR, PORT_NUM_FM1, REGNUM);
599
600 if (qsgmii) {
601 for (i = FM1_DTSEC1; i < FM1_DTSEC1 + PORT_NUM_FM1; i++) {
602 if (fm_info_get_enet_if(i) ==
603 PHY_INTERFACE_MODE_SGMII) {
604 phy_real_addr = PHY_BASE_ADDR + i - FM1_DTSEC1;
605 fm_info_set_phy_address(i, phy_real_addr);
606 }
607 }
608 switch (srds_prtcl) {
609 case 0x00:
610 case 0x03:
611 case 0x04:
612 case 0x06:
613 case 0x11:
614 case 0x2a:
615 case 0x34:
616 case 0x36:
617 fm_info_set_phy_address(FM1_DTSEC3, PHY_BASE_ADDR + 2);
618 fm_info_set_phy_address(FM1_DTSEC4, PHY_BASE_ADDR + 3);
619 break;
620 case 0x01:
621 case 0x02:
622 case 0x05:
623 case 0x07:
624 case 0x35:
625 fm_info_set_phy_address(FM1_DTSEC3, PHY_BASE_ADDR + 0);
626 fm_info_set_phy_address(FM1_DTSEC4, PHY_BASE_ADDR + 1);
627 break;
628 default:
629 break;
630 }
631 }
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646 lane = serdes_get_first_lane(XAUI_FM1);
647 if (lane >= 0) {
648 debug("FM1@TGEC1 expects XAUI in slot %u\n", lane_to_slot[lane]);
649 mdio_mux[i].mask = BRDCFG1_EMI2_SEL_MASK;
650 mdio_mux[i].val = BRDCFG1_EMI2_SEL_SLOT2;
651 super_hydra_mdio_set_mux("SUPER_HYDRA_FM1_TGEC_MDIO",
652 mdio_mux[i].mask, mdio_mux[i].val);
653 }
654
655 fm_info_set_mdio(FM1_10GEC1,
656 miiphy_get_dev_by_name("SUPER_HYDRA_FM1_TGEC_MDIO"));
657
658#if (CONFIG_SYS_NUM_FMAN == 2)
659 for (i = FM2_DTSEC1; i < FM2_DTSEC1 + CONFIG_SYS_NUM_FM2_DTSEC; i++) {
660 int idx = i - FM2_DTSEC1;
661
662 switch (fm_info_get_enet_if(i)) {
663 case PHY_INTERFACE_MODE_SGMII:
664 lane = serdes_get_first_lane(SGMII_FM2_DTSEC1 + idx);
665 if (lane < 0)
666 break;
667 slot = lane_to_slot[lane];
668 mdio_mux[i].mask = BRDCFG1_EMI1_SEL_MASK;
669 debug("FM2@DTSEC%u expects SGMII in slot %u\n",
670 idx + 1, slot);
671 switch (slot) {
672 case 1:
673 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT1 |
674 BRDCFG1_EMI1_EN;
675 break;
676 case 2:
677 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT2 |
678 BRDCFG1_EMI1_EN;
679 break;
680 case 3:
681 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT3 |
682 BRDCFG1_EMI1_EN;
683 break;
684 case 5:
685 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT5 |
686 BRDCFG1_EMI1_EN;
687 break;
688 case 6:
689 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT6 |
690 BRDCFG1_EMI1_EN;
691 break;
692 case 7:
693 mdio_mux[i].val = BRDCFG1_EMI1_SEL_SLOT7 |
694 BRDCFG1_EMI1_EN;
695 break;
696 };
697
698 if (i == FM2_DTSEC1 || i == FM2_DTSEC2) {
699 super_hydra_mdio_set_mux(
700 "SUPER_HYDRA_FM3_SGMII_MDIO",
701 mdio_mux[i].mask,
702 mdio_mux[i].val);
703 fm_info_set_mdio(i, miiphy_get_dev_by_name(
704 "SUPER_HYDRA_FM3_SGMII_MDIO"));
705 } else {
706 super_hydra_mdio_set_mux(
707 "SUPER_HYDRA_FM2_SGMII_MDIO",
708 mdio_mux[i].mask,
709 mdio_mux[i].val);
710 fm_info_set_mdio(i, miiphy_get_dev_by_name(
711 "SUPER_HYDRA_FM2_SGMII_MDIO"));
712 }
713
714 break;
715 case PHY_INTERFACE_MODE_RGMII:
716 case PHY_INTERFACE_MODE_RGMII_TXID:
717 case PHY_INTERFACE_MODE_RGMII_RXID:
718 case PHY_INTERFACE_MODE_RGMII_ID:
719
720
721
722
723
724
725 debug("FM2@DTSEC%u is RGMII at address %u\n",
726 idx + 1, 1);
727 fm_info_set_phy_address(i, 1);
728 mdio_mux[i].mask = BRDCFG1_EMI1_SEL_MASK;
729 mdio_mux[i].val = BRDCFG1_EMI1_SEL_RGMII |
730 BRDCFG1_EMI1_EN;
731 super_hydra_mdio_set_mux("SUPER_HYDRA_RGMII_MDIO",
732 mdio_mux[i].mask, mdio_mux[i].val);
733 fm_info_set_mdio(i,
734 miiphy_get_dev_by_name("SUPER_HYDRA_RGMII_MDIO"));
735 break;
736 case PHY_INTERFACE_MODE_NONE:
737 fm_info_set_phy_address(i, 0);
738 break;
739 default:
740 printf("Fman2: DTSEC%u set to unknown interface %i\n",
741 idx + 1, fm_info_get_enet_if(i));
742 fm_info_set_phy_address(i, 0);
743 break;
744 }
745 }
746
747 bus = miiphy_get_dev_by_name("SUPER_HYDRA_FM2_SGMII_MDIO");
748 set_sgmii_phy(bus, FM2_DTSEC3, PORT_NUM_FM2, PHY_BASE_ADDR);
749 bus = miiphy_get_dev_by_name("SUPER_HYDRA_FM3_SGMII_MDIO");
750 set_sgmii_phy(bus, FM2_DTSEC1, PORT_NUM_FM2, PHY_BASE_ADDR);
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765 lane = serdes_get_first_lane(XAUI_FM2);
766 if (lane >= 0) {
767 debug("FM2@TGEC1 expects XAUI in slot %u\n", lane_to_slot[lane]);
768 mdio_mux[i].mask = BRDCFG1_EMI2_SEL_MASK;
769 mdio_mux[i].val = BRDCFG1_EMI2_SEL_SLOT1;
770 super_hydra_mdio_set_mux("SUPER_HYDRA_FM2_TGEC_MDIO",
771 mdio_mux[i].mask, mdio_mux[i].val);
772 }
773
774 fm_info_set_mdio(FM2_10GEC1,
775 miiphy_get_dev_by_name("SUPER_HYDRA_FM2_TGEC_MDIO"));
776
777#endif
778
779 cpu_eth_init(bis);
780#endif
781
782 return pci_eth_init(bis);
783}
784