int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr) { uint32_t base_mii; struct mii_dev *bus = NULL; #ifdef CONFIG_PHYLIB struct phy_device *phydev = NULL; #endif int ret; #ifdef CONFIG_MX6 if (mx6_enet_fused(addr)) { printf("Ethernet@0x%x is fused, disable it\n", addr); return -2; } #endif #ifdef CONFIG_MX28 /* * The i.MX28 has two ethernet interfaces, but they are not equal. * Only the first one can access the MDIO bus. */ base_mii = MXS_ENET0_BASE; #else #ifdef CONFIG_FEC_MXC_MDIO_BASE base_mii = CONFIG_FEC_MXC_MDIO_BASE; #else base_mii = addr; #endif #endif debug("eth_init: fec_probe(bd, %i, %i) @ %08x\n", dev_id, phy_id, addr); bus = fec_get_miibus(base_mii, dev_id); if (!bus) return -ENOMEM; #ifdef CONFIG_PHYLIB phydev = phy_find_by_mask(bus, 1 << phy_id, PHY_INTERFACE_MODE_RGMII); if (!phydev) { free(bus); return -ENOMEM; } ret = fec_probe(bd, dev_id, addr, bus, phydev); #else ret = fec_probe(bd, dev_id, addr, bus, phy_id); #endif if (ret) { #ifdef CONFIG_PHYLIB free(phydev); #endif free(bus); } return ret; }
int board_eth_init(bd_t *bis) { uint32_t base = IMX_FEC_BASE; struct mii_dev *bus = NULL; struct phy_device *phydev = NULL; int ret; setup_iomux_enet(); #ifdef CONFIG_FEC_MXC bus = fec_get_miibus(base, -1); if (!bus) return 0; /* scan phy 4,5,6,7 */ phydev = phy_find_by_mask(bus, (0xf << 4), PHY_INTERFACE_MODE_RGMII); if (!phydev) { free(bus); return 0; } printf("using phy at %d\n", phydev->addr); ret = fec_probe(bis, -1, base, bus, phydev); if (ret) { printf("FEC MXC: %s:failed\n", __func__); free(phydev); free(bus); } #endif return 0; }
int board_eth_init(bd_t *bis) { uint32_t base = IMX_FEC_BASE; struct mii_dev *bus = NULL; struct phy_device *phydev = NULL; int ret; setup_iomux_enet(); bus = fec_get_miibus(base, -1); if (!bus) return 0; /* scan phy 0 and 5 */ phydev = phy_find_by_mask(bus, 0x21, PHY_INTERFACE_MODE_RGMII); if (!phydev) { free(bus); return 0; } /* depending on the phy address we can detect our board version */ if (phydev->addr == 0) setenv("boardver", ""); else setenv("boardver", "mr"); printf("using phy at %d\n", phydev->addr); ret = fec_probe(bis, -1, base, bus, phydev); if (ret) { printf("FEC MXC: %s:failed\n", __func__); free(phydev); free(bus); } return 0; }
int board_eth_init(bd_t *bis) { uint32_t base = IMX_FEC_BASE; struct mii_dev *bus = NULL; struct phy_device *phydev = NULL; int ret; bus = fec_get_miibus(base, -1); if (!bus) return 0; /* scan phy */ phydev = phy_find_by_mask(bus, (0xf << CONFIG_FEC_MXC_PHYADDR), PHY_INTERFACE_MODE_RGMII); if (!phydev) { free(bus); puts("No phy found\n"); return 0; } ret = fec_probe(bis, -1, base, bus, phydev); if (ret) { puts("FEC MXC: probe failed\n"); free(phydev); free(bus); } return 0; }
int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr) { int lout = 1; debug("eth_init: fec_probe(bd, %i, %i) @ %08x\n", dev_id, phy_id, addr); lout = fec_probe(bd, dev_id, phy_id, addr); return lout; }
int fecmxc_initialize(bd_t *bd) { int lout = 1; debug("eth_init: fec_probe(bd)\n"); lout = fec_probe(bd, -1, CONFIG_FEC_MXC_PHYADDR, IMX_FEC_BASE); return lout; }
int board_eth_init(bd_t *bis) { struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR; struct mii_dev *bus; struct phy_device *phydev; int ret = enable_fec_anatop_clock(0, ENET_25MHZ); if (ret) return ret; /* set gpr1[ENET_CLK_SEL] */ setbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK); setup_iomux_enet(); bus = fec_get_miibus(IMX_FEC_BASE, -1); if (!bus) return -EINVAL; phydev = phy_find_by_mask(bus, ETH_PHY_MASK, PHY_INTERFACE_MODE_RGMII); if (!phydev) { ret = -EINVAL; goto free_bus; } debug("using phy at address %d\n", phydev->addr); ret = fec_probe(bis, -1, IMX_FEC_BASE, bus, phydev); if (ret) goto free_phydev; return 0; free_phydev: free(phydev); free_bus: free(bus); return ret; }
int board_eth_init(bd_t *bis) { uint32_t base = IMX_FEC_BASE; struct mii_dev *bus = NULL; struct phy_device *phydev = NULL; int ret; setup_iomux_enet(); #ifdef CONFIG_FEC_MXC bus = fec_get_miibus(base, -1); if (!bus) return -EINVAL; /* scan phy 4,5,6,7 */ phydev = phy_find_by_mask(bus, (0xf << 4), PHY_INTERFACE_MODE_RGMII); if (!phydev) { ret = -EINVAL; goto free_bus; } printf("using phy at %d\n", phydev->addr); ret = fec_probe(bis, -1, base, bus, phydev); if (ret) goto free_phydev; #endif #ifdef CONFIG_CI_UDC /* For otg ethernet*/ usb_eth_initialize(bis); #endif return 0; free_phydev: free(phydev); free_bus: free(bus); return ret; }