aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/cpmac.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/drivers/net/cpmac.c b/drivers/net/cpmac.c
index c951dd43f29b..7b311c6d14ab 100644
--- a/drivers/net/cpmac.c
+++ b/drivers/net/cpmac.c
@@ -1117,22 +1117,23 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1117 1117
1118 pdata = pdev->dev.platform_data; 1118 pdata = pdev->dev.platform_data;
1119 1119
1120 for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) { 1120 if (external_switch || dumb_switch) {
1121 if (!(pdata->phy_mask & (1 << phy_id))) 1121 strncpy(mdio_bus_id, "0", BUS_ID_SIZE); /* fixed phys bus */
1122 continue; 1122 phy_id = pdev->id;
1123 if (!cpmac_mii->phy_map[phy_id]) 1123 } else {
1124 continue; 1124 for (phy_id = 0; phy_id < PHY_MAX_ADDR; phy_id++) {
1125 break; 1125 if (!(pdata->phy_mask & (1 << phy_id)))
1126 continue;
1127 if (!cpmac_mii->phy_map[phy_id])
1128 continue;
1129 strncpy(mdio_bus_id, cpmac_mii->id, BUS_ID_SIZE);
1130 break;
1131 }
1126 } 1132 }
1127 1133
1128 if (phy_id == PHY_MAX_ADDR) { 1134 if (phy_id == PHY_MAX_ADDR) {
1129 if (external_switch || dumb_switch) { 1135 dev_err(&pdev->dev, "no PHY present\n");
1130 strncpy(mdio_bus_id, "0", BUS_ID_SIZE); /* fixed phys bus */ 1136 return -ENODEV;
1131 phy_id = pdev->id;
1132 } else {
1133 dev_err(&pdev->dev, "no PHY present\n");
1134 return -ENODEV;
1135 }
1136 } 1137 }
1137 1138
1138 dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES); 1139 dev = alloc_etherdev_mq(sizeof(*priv), CPMAC_QUEUES);
@@ -1166,8 +1167,11 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
1166 priv->msg_enable = netif_msg_init(debug_level, 0xff); 1167 priv->msg_enable = netif_msg_init(debug_level, 0xff);
1167 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr)); 1168 memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
1168 1169
1169 priv->phy = phy_connect(dev, dev_name(&cpmac_mii->phy_map[phy_id]->dev), 1170 snprintf(priv->phy_name, BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id);
1170 &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII); 1171
1172 priv->phy = phy_connect(dev, priv->phy_name, &cpmac_adjust_link, 0,
1173 PHY_INTERFACE_MODE_MII);
1174
1171 if (IS_ERR(priv->phy)) { 1175 if (IS_ERR(priv->phy)) {
1172 if (netif_msg_drv(priv)) 1176 if (netif_msg_drv(priv))
1173 printk(KERN_ERR "%s: Could not attach to PHY\n", 1177 printk(KERN_ERR "%s: Could not attach to PHY\n",