aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/smsc911x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/smsc911x.c')
-rw-r--r--drivers/net/smsc911x.c53
1 files changed, 20 insertions, 33 deletions
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
index 494cd91ea39..4fd1d8b3878 100644
--- a/drivers/net/smsc911x.c
+++ b/drivers/net/smsc911x.c
@@ -770,29 +770,25 @@ static int smsc911x_mii_probe(struct net_device *dev)
770{ 770{
771 struct smsc911x_data *pdata = netdev_priv(dev); 771 struct smsc911x_data *pdata = netdev_priv(dev);
772 struct phy_device *phydev = NULL; 772 struct phy_device *phydev = NULL;
773 int phy_addr; 773 int ret;
774 774
775 /* find the first phy */ 775 /* find the first phy */
776 for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { 776 phydev = phy_find_first(pdata->mii_bus);
777 if (pdata->mii_bus->phy_map[phy_addr]) {
778 phydev = pdata->mii_bus->phy_map[phy_addr];
779 SMSC_TRACE(PROBE, "PHY %d: addr %d, phy_id 0x%08X",
780 phy_addr, phydev->addr, phydev->phy_id);
781 break;
782 }
783 }
784
785 if (!phydev) { 777 if (!phydev) {
786 pr_err("%s: no PHY found\n", dev->name); 778 pr_err("%s: no PHY found\n", dev->name);
787 return -ENODEV; 779 return -ENODEV;
788 } 780 }
789 781
790 phydev = phy_connect(dev, dev_name(&phydev->dev), 782 SMSC_TRACE(PROBE, "PHY %d: addr %d, phy_id 0x%08X",
791 &smsc911x_phy_adjust_link, 0, pdata->config.phy_interface); 783 phy_addr, phydev->addr, phydev->phy_id);
792 784
793 if (IS_ERR(phydev)) { 785 ret = phy_connect_direct(dev, phydev,
786 &smsc911x_phy_adjust_link, 0,
787 pdata->config.phy_interface);
788
789 if (ret) {
794 pr_err("%s: Could not attach to PHY\n", dev->name); 790 pr_err("%s: Could not attach to PHY\n", dev->name);
795 return PTR_ERR(phydev); 791 return ret;
796 } 792 }
797 793
798 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n", 794 pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
@@ -1383,33 +1379,24 @@ static void smsc911x_set_multicast_list(struct net_device *dev)
1383 pdata->clear_bits_mask = (MAC_CR_PRMS_ | MAC_CR_HPFILT_); 1379 pdata->clear_bits_mask = (MAC_CR_PRMS_ | MAC_CR_HPFILT_);
1384 pdata->hashhi = 0; 1380 pdata->hashhi = 0;
1385 pdata->hashlo = 0; 1381 pdata->hashlo = 0;
1386 } else if (dev->mc_count > 0) { 1382 } else if (!netdev_mc_empty(dev)) {
1387 /* Enabling specific multicast addresses */ 1383 /* Enabling specific multicast addresses */
1388 unsigned int hash_high = 0; 1384 unsigned int hash_high = 0;
1389 unsigned int hash_low = 0; 1385 unsigned int hash_low = 0;
1390 unsigned int count = 0; 1386 struct dev_mc_list *mc_list;
1391 struct dev_mc_list *mc_list = dev->mc_list;
1392 1387
1393 pdata->set_bits_mask = MAC_CR_HPFILT_; 1388 pdata->set_bits_mask = MAC_CR_HPFILT_;
1394 pdata->clear_bits_mask = (MAC_CR_PRMS_ | MAC_CR_MCPAS_); 1389 pdata->clear_bits_mask = (MAC_CR_PRMS_ | MAC_CR_MCPAS_);
1395 1390
1396 while (mc_list) { 1391 netdev_for_each_mc_addr(mc_list, dev) {
1397 count++; 1392 unsigned int bitnum = smsc911x_hash(mc_list->dmi_addr);
1398 if ((mc_list->dmi_addrlen) == ETH_ALEN) { 1393 unsigned int mask = 0x01 << (bitnum & 0x1F);
1399 unsigned int bitnum = 1394
1400 smsc911x_hash(mc_list->dmi_addr); 1395 if (bitnum & 0x20)
1401 unsigned int mask = 0x01 << (bitnum & 0x1F); 1396 hash_high |= mask;
1402 if (bitnum & 0x20) 1397 else
1403 hash_high |= mask; 1398 hash_low |= mask;
1404 else
1405 hash_low |= mask;
1406 } else {
1407 SMSC_WARNING(DRV, "dmi_addrlen != 6");
1408 }
1409 mc_list = mc_list->next;
1410 } 1399 }
1411 if (count != (unsigned int)dev->mc_count)
1412 SMSC_WARNING(DRV, "mc_count != dev->mc_count");
1413 1400
1414 pdata->hashhi = hash_high; 1401 pdata->hashhi = hash_high;
1415 pdata->hashlo = hash_low; 1402 pdata->hashlo = hash_low;