1 // SPDX-License-Identifier: GPL-2.0+
13 #include "../common/fman.h"
15 int board_eth_init(bd_t *bis)
17 #ifdef CONFIG_FMAN_ENET
18 struct memac_mdio_info dtsec_mdio_info;
21 struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
23 srds_s1 = in_be32(&gur->rcwsr[4]) &
24 FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
25 srds_s1 >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
27 dtsec_mdio_info.regs =
28 (struct memac_mdio_controller *)CONFIG_SYS_FM1_DTSEC_MDIO_ADDR;
30 dtsec_mdio_info.name = DEFAULT_FM_MDIO_NAME;
32 /* Register the 1G MDIO bus */
33 fm_memac_mdio_init(bis, &dtsec_mdio_info);
35 /* QSGMII on lane B, MAC 6/5/10/1 */
36 fm_info_set_phy_address(FM1_DTSEC6, QSGMII_PORT1_PHY_ADDR);
37 fm_info_set_phy_address(FM1_DTSEC5, QSGMII_PORT2_PHY_ADDR);
38 fm_info_set_phy_address(FM1_DTSEC10, QSGMII_PORT3_PHY_ADDR);
39 fm_info_set_phy_address(FM1_DTSEC1, QSGMII_PORT4_PHY_ADDR);
45 printf("Invalid SerDes protocol 0x%x for LS1046AFRWY\n",
50 dev = miiphy_get_dev_by_name(DEFAULT_FM_MDIO_NAME);
51 fm_info_set_mdio(FM1_DTSEC6, dev);
52 fm_info_set_mdio(FM1_DTSEC5, dev);
53 fm_info_set_mdio(FM1_DTSEC10, dev);
54 fm_info_set_mdio(FM1_DTSEC1, dev);
56 fm_disable_port(FM1_DTSEC9);
61 return pci_eth_init(bis);
64 #ifdef CONFIG_FMAN_ENET
65 int fdt_update_ethernet_dt(void *blob)
71 struct ccsr_gur *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
73 srds_s1 = in_be32(&gur->rcwsr[4]) &
74 FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_MASK;
75 srds_s1 >>= FSL_CHASSIS2_RCWSR4_SRDS1_PRTCL_SHIFT;
77 /* Cycle through all aliases */
78 for (prop = 0; ; prop++) {
81 /* FDT might have been edited, recompute the offset */
82 offset = fdt_first_property_offset(blob,
86 /* Select property number 'prop' */
87 for (i = 0; i < prop; i++)
88 offset = fdt_next_property_offset(blob, offset);
93 path = fdt_getprop_by_offset(blob, offset, &name, NULL);
94 nodeoff = fdt_path_offset(blob, path);
98 if (!strcmp(name, "ethernet1"))
99 fdt_status_disabled(blob, nodeoff);
100 if (!strcmp(name, "ethernet2"))
101 fdt_status_disabled(blob, nodeoff);
102 if (!strcmp(name, "ethernet3"))
103 fdt_status_disabled(blob, nodeoff);
104 if (!strcmp(name, "ethernet6"))
105 fdt_status_disabled(blob, nodeoff);
108 printf("%s:Invalid SerDes prtcl 0x%x for LS1046AFRWY\n",