int board_eth_init(bd_t *bis) { #ifdef CONFIG_FEC_MXC struct ventana_board_info *info = &ventana_info; if (test_bit(EECONFIG_ETH0, info->config)) { setup_iomux_enet(GP_PHY_RST); cpu_eth_init(bis); } #endif #ifdef CONFIG_E1000 e1000_initialize(bis); #endif #ifdef CONFIG_CI_UDC /* For otg ethernet*/ usb_eth_initialize(bis); #endif /* default to the first detected enet dev */ if (!env_get("ethprime")) { struct eth_device *dev = eth_get_dev_by_index(0); if (dev) { env_set("ethprime", dev->name); printf("set ethprime to %s\n", env_get("ethprime")); } } return 0; }
void fsl_sgmii_riser_fdt_fixup(void *fdt) { struct eth_device *dev; int node; int i = -1; int etsec_num = 0; node = fdt_path_offset(fdt, "/aliases"); if (node < 0) return; while ((dev = eth_get_dev_by_index(++i)) != NULL) { struct tsec_private *priv; int enet_node; char enet[16]; const u32 *phyh; int phynode; const char *model; const char *path; if (!strstr(dev->name, "eTSEC")) continue; sprintf(enet, "ethernet%d", etsec_num++); path = fdt_getprop(fdt, node, enet, NULL); if (!path) { debug("No alias for %s\n", enet); continue; } enet_node = fdt_path_offset(fdt, path); if (enet_node < 0) continue; model = fdt_getprop(fdt, enet_node, "model", NULL); /* * We only want to do this to eTSECs. On some platforms * there are more than one type of gianfar-style ethernet * controller, and as we are creating an implicit connection * between ethernet nodes and eTSEC devices, it is best to * make the connection use as much explicit information * as exists. */ if (!strstr(model, "TSEC")) continue; phyh = fdt_getprop(fdt, enet_node, "phy-handle", NULL); if (!phyh) continue; phynode = fdt_node_offset_by_phandle(fdt, fdt32_to_cpu(*phyh)); priv = dev->priv; if (priv->flags & TSEC_SGMII) fdt_setprop_cell(fdt, phynode, "reg", priv->phyaddr); } }
__maybe_unused static void print_eths(void) { struct eth_device *dev; int i = 0; do { dev = eth_get_dev_by_index(i); if (dev) { printf("eth%dname = %s\n", i, dev->name); print_eth(i); i++; } } while (dev); printf("current eth = %s\n", eth_get_name()); printf("ip_addr = %s\n", getenv("ipaddr")); }
int board_eth_init(bd_t *bis) { int rc = 0; #ifdef CONFIG_SMC911X #define STR_ENV_ETHADDR "ethaddr" struct eth_device *dev; uchar eth_addr[6]; rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) { dev = eth_get_dev_by_index(0); if (dev) { eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr); } else { printf("omap3evm: Couldn't get eth device\n"); rc = -1; } } #endif return rc; }
void fsl_sgmii_riser_fdt_fixup(void *fdt) { struct eth_device *dev; int node; int mdio_node; int i = -1; int etsec_num = 0; node = fdt_path_offset(fdt, "/aliases"); if (node < 0) return; while ((dev = eth_get_dev_by_index(++i)) != NULL) { struct tsec_private *priv; int phy_node; int enet_node; uint32_t ph; char sgmii_phy[16]; char enet[16]; const char *model; const char *path; if (!strstr(dev->name, "eTSEC")) continue; priv = dev->priv; if (!(priv->flags & TSEC_SGMII)) { etsec_num++; continue; } mdio_node = fdt_node_offset_by_compatible(fdt, -1, "fsl,gianfar-mdio"); if (mdio_node < 0) return; sprintf(sgmii_phy, "sgmii-phy@%d", etsec_num); phy_node = fdt_subnode_offset(fdt, mdio_node, sgmii_phy); if (phy_node < 0) continue; fdt_increase_size(fdt, 32); ph = fdt_create_phandle(fdt, phy_node); if (!ph) continue; sprintf(enet, "ethernet%d", etsec_num++); path = fdt_getprop(fdt, node, enet, NULL); if (!path) { debug("No alias for %s\n", enet); continue; } enet_node = fdt_path_offset(fdt, path); if (enet_node < 0) continue; model = fdt_getprop(fdt, enet_node, "model", NULL); /* * We only want to do this to eTSECs. On some platforms * there are more than one type of gianfar-style ethernet * controller, and as we are creating an implicit connection * between ethernet nodes and eTSEC devices, it is best to * make the connection use as much explicit information * as exists. */ if (!strstr(model, "TSEC")) continue; fdt_setprop(fdt, enet_node, "phy-handle", &ph, sizeof(ph)); fdt_setprop_string(fdt, enet_node, "phy-connection-type", phy_string_for_interface(PHY_INTERFACE_MODE_SGMII)); } }