{
struct phy_device *phydev;
struct mii_dev *bus;
+ const char *node_name;
+ int node;
+
+ node = fdt_path_offset(gd->fdt_blob, "ethernet0");
+ if (node < 0) {
+ printf("Cannot get eth0!\n");
+ return;
+ }
- bus = miiphy_get_dev_by_name("neta@30000");
+ node_name = fdt_get_name(gd->fdt_blob, node, NULL);
+ if (!node_name) {
+ printf("Cannot get eth0 node name!\n");
+ return;
+ }
+
+ bus = miiphy_get_dev_by_name(node_name);
if (!bus) {
printf("Cannot get MDIO bus device!\n");
return;
*/
if (peridot || topaz) {
struct mii_dev *bus;
+ const char *node_name;
+ int node;
- bus = miiphy_get_dev_by_name("neta@30000");
+ node = fdt_path_offset(gd->fdt_blob, "ethernet0");
+ node_name = (node >= 0) ? fdt_get_name(gd->fdt_blob, node, NULL) : NULL;
+ bus = node_name ? miiphy_get_dev_by_name(node_name) : NULL;
if (!bus) {
printf("Cannot get MDIO bus device!\n");
} else {