diff options
Diffstat (limited to 'drivers/net/ethernet/calxeda/xgmac.c')
-rw-r--r-- | drivers/net/ethernet/calxeda/xgmac.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c index 78d6d6b970e1..48f52882a22b 100644 --- a/drivers/net/ethernet/calxeda/xgmac.c +++ b/drivers/net/ethernet/calxeda/xgmac.c | |||
@@ -106,7 +106,6 @@ | |||
106 | #define XGMAC_DMA_HW_FEATURE 0x00000f58 /* Enabled Hardware Features */ | 106 | #define XGMAC_DMA_HW_FEATURE 0x00000f58 /* Enabled Hardware Features */ |
107 | 107 | ||
108 | #define XGMAC_ADDR_AE 0x80000000 | 108 | #define XGMAC_ADDR_AE 0x80000000 |
109 | #define XGMAC_MAX_FILTER_ADDR 31 | ||
110 | 109 | ||
111 | /* PMT Control and Status */ | 110 | /* PMT Control and Status */ |
112 | #define XGMAC_PMT_POINTER_RESET 0x80000000 | 111 | #define XGMAC_PMT_POINTER_RESET 0x80000000 |
@@ -384,6 +383,7 @@ struct xgmac_priv { | |||
384 | struct device *device; | 383 | struct device *device; |
385 | struct napi_struct napi; | 384 | struct napi_struct napi; |
386 | 385 | ||
386 | int max_macs; | ||
387 | struct xgmac_extra_stats xstats; | 387 | struct xgmac_extra_stats xstats; |
388 | 388 | ||
389 | spinlock_t stats_lock; | 389 | spinlock_t stats_lock; |
@@ -1291,14 +1291,12 @@ static void xgmac_set_rx_mode(struct net_device *dev) | |||
1291 | netdev_dbg(priv->dev, "# mcasts %d, # unicast %d\n", | 1291 | netdev_dbg(priv->dev, "# mcasts %d, # unicast %d\n", |
1292 | netdev_mc_count(dev), netdev_uc_count(dev)); | 1292 | netdev_mc_count(dev), netdev_uc_count(dev)); |
1293 | 1293 | ||
1294 | if (dev->flags & IFF_PROMISC) { | 1294 | if (dev->flags & IFF_PROMISC) |
1295 | writel(XGMAC_FRAME_FILTER_PR, ioaddr + XGMAC_FRAME_FILTER); | 1295 | value |= XGMAC_FRAME_FILTER_PR; |
1296 | return; | ||
1297 | } | ||
1298 | 1296 | ||
1299 | memset(hash_filter, 0, sizeof(hash_filter)); | 1297 | memset(hash_filter, 0, sizeof(hash_filter)); |
1300 | 1298 | ||
1301 | if (netdev_uc_count(dev) > XGMAC_MAX_FILTER_ADDR) { | 1299 | if (netdev_uc_count(dev) > priv->max_macs) { |
1302 | use_hash = true; | 1300 | use_hash = true; |
1303 | value |= XGMAC_FRAME_FILTER_HUC | XGMAC_FRAME_FILTER_HPF; | 1301 | value |= XGMAC_FRAME_FILTER_HUC | XGMAC_FRAME_FILTER_HPF; |
1304 | } | 1302 | } |
@@ -1321,7 +1319,7 @@ static void xgmac_set_rx_mode(struct net_device *dev) | |||
1321 | goto out; | 1319 | goto out; |
1322 | } | 1320 | } |
1323 | 1321 | ||
1324 | if ((netdev_mc_count(dev) + reg - 1) > XGMAC_MAX_FILTER_ADDR) { | 1322 | if ((netdev_mc_count(dev) + reg - 1) > priv->max_macs) { |
1325 | use_hash = true; | 1323 | use_hash = true; |
1326 | value |= XGMAC_FRAME_FILTER_HMC | XGMAC_FRAME_FILTER_HPF; | 1324 | value |= XGMAC_FRAME_FILTER_HMC | XGMAC_FRAME_FILTER_HPF; |
1327 | } else { | 1325 | } else { |
@@ -1342,8 +1340,8 @@ static void xgmac_set_rx_mode(struct net_device *dev) | |||
1342 | } | 1340 | } |
1343 | 1341 | ||
1344 | out: | 1342 | out: |
1345 | for (i = reg; i < XGMAC_MAX_FILTER_ADDR; i++) | 1343 | for (i = reg; i <= priv->max_macs; i++) |
1346 | xgmac_set_mac_addr(ioaddr, NULL, reg); | 1344 | xgmac_set_mac_addr(ioaddr, NULL, i); |
1347 | for (i = 0; i < XGMAC_NUM_HASH; i++) | 1345 | for (i = 0; i < XGMAC_NUM_HASH; i++) |
1348 | writel(hash_filter[i], ioaddr + XGMAC_HASH(i)); | 1346 | writel(hash_filter[i], ioaddr + XGMAC_HASH(i)); |
1349 | 1347 | ||
@@ -1761,6 +1759,13 @@ static int xgmac_probe(struct platform_device *pdev) | |||
1761 | uid = readl(priv->base + XGMAC_VERSION); | 1759 | uid = readl(priv->base + XGMAC_VERSION); |
1762 | netdev_info(ndev, "h/w version is 0x%x\n", uid); | 1760 | netdev_info(ndev, "h/w version is 0x%x\n", uid); |
1763 | 1761 | ||
1762 | /* Figure out how many valid mac address filter registers we have */ | ||
1763 | writel(1, priv->base + XGMAC_ADDR_HIGH(31)); | ||
1764 | if (readl(priv->base + XGMAC_ADDR_HIGH(31)) == 1) | ||
1765 | priv->max_macs = 31; | ||
1766 | else | ||
1767 | priv->max_macs = 7; | ||
1768 | |||
1764 | writel(0, priv->base + XGMAC_DMA_INTR_ENA); | 1769 | writel(0, priv->base + XGMAC_DMA_INTR_ENA); |
1765 | ndev->irq = platform_get_irq(pdev, 0); | 1770 | ndev->irq = platform_get_irq(pdev, 0); |
1766 | if (ndev->irq == -ENXIO) { | 1771 | if (ndev->irq == -ENXIO) { |