diff options
Diffstat (limited to 'drivers/net/b44.c')
-rw-r--r-- | drivers/net/b44.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index efeffdf9e5fa..a69331e06b8d 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -381,11 +381,11 @@ static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote) | |||
381 | __b44_set_flow_ctrl(bp, pause_enab); | 381 | __b44_set_flow_ctrl(bp, pause_enab); |
382 | } | 382 | } |
383 | 383 | ||
384 | #ifdef SSB_DRIVER_MIPS | 384 | #ifdef CONFIG_BCM47XX |
385 | extern char *nvram_get(char *name); | 385 | #include <asm/mach-bcm47xx/nvram.h> |
386 | static void b44_wap54g10_workaround(struct b44 *bp) | 386 | static void b44_wap54g10_workaround(struct b44 *bp) |
387 | { | 387 | { |
388 | const char *str; | 388 | char buf[20]; |
389 | u32 val; | 389 | u32 val; |
390 | int err; | 390 | int err; |
391 | 391 | ||
@@ -394,10 +394,9 @@ static void b44_wap54g10_workaround(struct b44 *bp) | |||
394 | * see https://dev.openwrt.org/ticket/146 | 394 | * see https://dev.openwrt.org/ticket/146 |
395 | * check and reset bit "isolate" | 395 | * check and reset bit "isolate" |
396 | */ | 396 | */ |
397 | str = nvram_get("boardnum"); | 397 | if (nvram_getenv("boardnum", buf, sizeof(buf)) < 0) |
398 | if (!str) | ||
399 | return; | 398 | return; |
400 | if (simple_strtoul(str, NULL, 0) == 2) { | 399 | if (simple_strtoul(buf, NULL, 0) == 2) { |
401 | err = __b44_readphy(bp, 0, MII_BMCR, &val); | 400 | err = __b44_readphy(bp, 0, MII_BMCR, &val); |
402 | if (err) | 401 | if (err) |
403 | goto error; | 402 | goto error; |
@@ -818,7 +817,7 @@ static int b44_rx(struct b44 *bp, int budget) | |||
818 | copy_skb->data, len); | 817 | copy_skb->data, len); |
819 | skb = copy_skb; | 818 | skb = copy_skb; |
820 | } | 819 | } |
821 | skb->ip_summed = CHECKSUM_NONE; | 820 | skb_checksum_none_assert(skb); |
822 | skb->protocol = eth_type_trans(skb, bp->dev); | 821 | skb->protocol = eth_type_trans(skb, bp->dev); |
823 | netif_receive_skb(skb); | 822 | netif_receive_skb(skb); |
824 | received++; | 823 | received++; |
@@ -1808,8 +1807,8 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1808 | if (bp->flags & B44_FLAG_ADV_100FULL) | 1807 | if (bp->flags & B44_FLAG_ADV_100FULL) |
1809 | cmd->advertising |= ADVERTISED_100baseT_Full; | 1808 | cmd->advertising |= ADVERTISED_100baseT_Full; |
1810 | cmd->advertising |= ADVERTISED_Pause | ADVERTISED_Asym_Pause; | 1809 | cmd->advertising |= ADVERTISED_Pause | ADVERTISED_Asym_Pause; |
1811 | cmd->speed = (bp->flags & B44_FLAG_100_BASE_T) ? | 1810 | ethtool_cmd_speed_set(cmd, ((bp->flags & B44_FLAG_100_BASE_T) ? |
1812 | SPEED_100 : SPEED_10; | 1811 | SPEED_100 : SPEED_10)); |
1813 | cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ? | 1812 | cmd->duplex = (bp->flags & B44_FLAG_FULL_DUPLEX) ? |
1814 | DUPLEX_FULL : DUPLEX_HALF; | 1813 | DUPLEX_FULL : DUPLEX_HALF; |
1815 | cmd->port = 0; | 1814 | cmd->port = 0; |
@@ -1821,7 +1820,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1821 | if (cmd->autoneg == AUTONEG_ENABLE) | 1820 | if (cmd->autoneg == AUTONEG_ENABLE) |
1822 | cmd->advertising |= ADVERTISED_Autoneg; | 1821 | cmd->advertising |= ADVERTISED_Autoneg; |
1823 | if (!netif_running(dev)){ | 1822 | if (!netif_running(dev)){ |
1824 | cmd->speed = 0; | 1823 | ethtool_cmd_speed_set(cmd, 0); |
1825 | cmd->duplex = 0xff; | 1824 | cmd->duplex = 0xff; |
1826 | } | 1825 | } |
1827 | cmd->maxtxpkt = 0; | 1826 | cmd->maxtxpkt = 0; |
@@ -1832,6 +1831,7 @@ static int b44_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1832 | static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1831 | static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) |
1833 | { | 1832 | { |
1834 | struct b44 *bp = netdev_priv(dev); | 1833 | struct b44 *bp = netdev_priv(dev); |
1834 | u32 speed = ethtool_cmd_speed(cmd); | ||
1835 | 1835 | ||
1836 | /* We do not support gigabit. */ | 1836 | /* We do not support gigabit. */ |
1837 | if (cmd->autoneg == AUTONEG_ENABLE) { | 1837 | if (cmd->autoneg == AUTONEG_ENABLE) { |
@@ -1839,8 +1839,8 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1839 | (ADVERTISED_1000baseT_Half | | 1839 | (ADVERTISED_1000baseT_Half | |
1840 | ADVERTISED_1000baseT_Full)) | 1840 | ADVERTISED_1000baseT_Full)) |
1841 | return -EINVAL; | 1841 | return -EINVAL; |
1842 | } else if ((cmd->speed != SPEED_100 && | 1842 | } else if ((speed != SPEED_100 && |
1843 | cmd->speed != SPEED_10) || | 1843 | speed != SPEED_10) || |
1844 | (cmd->duplex != DUPLEX_HALF && | 1844 | (cmd->duplex != DUPLEX_HALF && |
1845 | cmd->duplex != DUPLEX_FULL)) { | 1845 | cmd->duplex != DUPLEX_FULL)) { |
1846 | return -EINVAL; | 1846 | return -EINVAL; |
@@ -1874,7 +1874,7 @@ static int b44_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
1874 | } else { | 1874 | } else { |
1875 | bp->flags |= B44_FLAG_FORCE_LINK; | 1875 | bp->flags |= B44_FLAG_FORCE_LINK; |
1876 | bp->flags &= ~(B44_FLAG_100_BASE_T | B44_FLAG_FULL_DUPLEX); | 1876 | bp->flags &= ~(B44_FLAG_100_BASE_T | B44_FLAG_FULL_DUPLEX); |
1877 | if (cmd->speed == SPEED_100) | 1877 | if (speed == SPEED_100) |
1878 | bp->flags |= B44_FLAG_100_BASE_T; | 1878 | bp->flags |= B44_FLAG_100_BASE_T; |
1879 | if (cmd->duplex == DUPLEX_FULL) | 1879 | if (cmd->duplex == DUPLEX_FULL) |
1880 | bp->flags |= B44_FLAG_FULL_DUPLEX; | 1880 | bp->flags |= B44_FLAG_FULL_DUPLEX; |
@@ -2296,18 +2296,27 @@ static int b44_resume(struct ssb_device *sdev) | |||
2296 | if (!netif_running(dev)) | 2296 | if (!netif_running(dev)) |
2297 | return 0; | 2297 | return 0; |
2298 | 2298 | ||
2299 | spin_lock_irq(&bp->lock); | ||
2300 | b44_init_rings(bp); | ||
2301 | b44_init_hw(bp, B44_FULL_RESET); | ||
2302 | spin_unlock_irq(&bp->lock); | ||
2303 | |||
2304 | /* | ||
2305 | * As a shared interrupt, the handler can be called immediately. To be | ||
2306 | * able to check the interrupt status the hardware must already be | ||
2307 | * powered back on (b44_init_hw). | ||
2308 | */ | ||
2299 | rc = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev); | 2309 | rc = request_irq(dev->irq, b44_interrupt, IRQF_SHARED, dev->name, dev); |
2300 | if (rc) { | 2310 | if (rc) { |
2301 | netdev_err(dev, "request_irq failed\n"); | 2311 | netdev_err(dev, "request_irq failed\n"); |
2312 | spin_lock_irq(&bp->lock); | ||
2313 | b44_halt(bp); | ||
2314 | b44_free_rings(bp); | ||
2315 | spin_unlock_irq(&bp->lock); | ||
2302 | return rc; | 2316 | return rc; |
2303 | } | 2317 | } |
2304 | 2318 | ||
2305 | spin_lock_irq(&bp->lock); | ||
2306 | |||
2307 | b44_init_rings(bp); | ||
2308 | b44_init_hw(bp, B44_FULL_RESET); | ||
2309 | netif_device_attach(bp->dev); | 2319 | netif_device_attach(bp->dev); |
2310 | spin_unlock_irq(&bp->lock); | ||
2311 | 2320 | ||
2312 | b44_enable_ints(bp); | 2321 | b44_enable_ints(bp); |
2313 | netif_wake_queue(dev); | 2322 | netif_wake_queue(dev); |