aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sungem.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sungem.c')
-rw-r--r--drivers/net/sungem.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 1349e419673c..6f935cd30176 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -164,7 +164,7 @@ static u16 __phy_read(struct gem *gp, int phy_addr, int reg)
164 164
165static inline int _phy_read(struct net_device *dev, int mii_id, int reg) 165static inline int _phy_read(struct net_device *dev, int mii_id, int reg)
166{ 166{
167 struct gem *gp = dev->priv; 167 struct gem *gp = netdev_priv(dev);
168 return __phy_read(gp, mii_id, reg); 168 return __phy_read(gp, mii_id, reg);
169} 169}
170 170
@@ -197,7 +197,7 @@ static void __phy_write(struct gem *gp, int phy_addr, int reg, u16 val)
197 197
198static inline void _phy_write(struct net_device *dev, int mii_id, int reg, int val) 198static inline void _phy_write(struct net_device *dev, int mii_id, int reg, int val)
199{ 199{
200 struct gem *gp = dev->priv; 200 struct gem *gp = netdev_priv(dev);
201 __phy_write(gp, mii_id, reg, val & 0xffff); 201 __phy_write(gp, mii_id, reg, val & 0xffff);
202} 202}
203 203
@@ -863,7 +863,6 @@ static int gem_rx(struct gem *gp, int work_to_do)
863 863
864 gp->net_stats.rx_packets++; 864 gp->net_stats.rx_packets++;
865 gp->net_stats.rx_bytes += len; 865 gp->net_stats.rx_bytes += len;
866 gp->dev->last_rx = jiffies;
867 866
868 next: 867 next:
869 entry = NEXT_RX(entry); 868 entry = NEXT_RX(entry);
@@ -933,7 +932,7 @@ static int gem_poll(struct napi_struct *napi, int budget)
933static irqreturn_t gem_interrupt(int irq, void *dev_id) 932static irqreturn_t gem_interrupt(int irq, void *dev_id)
934{ 933{
935 struct net_device *dev = dev_id; 934 struct net_device *dev = dev_id;
936 struct gem *gp = dev->priv; 935 struct gem *gp = netdev_priv(dev);
937 unsigned long flags; 936 unsigned long flags;
938 937
939 /* Swallow interrupts when shutting the chip down, though 938 /* Swallow interrupts when shutting the chip down, though
@@ -979,7 +978,7 @@ static void gem_poll_controller(struct net_device *dev)
979 978
980static void gem_tx_timeout(struct net_device *dev) 979static void gem_tx_timeout(struct net_device *dev)
981{ 980{
982 struct gem *gp = dev->priv; 981 struct gem *gp = netdev_priv(dev);
983 982
984 printk(KERN_ERR "%s: transmit timed out, resetting\n", dev->name); 983 printk(KERN_ERR "%s: transmit timed out, resetting\n", dev->name);
985 if (!gp->running) { 984 if (!gp->running) {
@@ -1018,7 +1017,7 @@ static __inline__ int gem_intme(int entry)
1018 1017
1019static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev) 1018static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
1020{ 1019{
1021 struct gem *gp = dev->priv; 1020 struct gem *gp = netdev_priv(dev);
1022 int entry; 1021 int entry;
1023 u64 ctrl; 1022 u64 ctrl;
1024 unsigned long flags; 1023 unsigned long flags;
@@ -2191,7 +2190,7 @@ static void gem_stop_phy(struct gem *gp, int wol)
2191 2190
2192static int gem_do_start(struct net_device *dev) 2191static int gem_do_start(struct net_device *dev)
2193{ 2192{
2194 struct gem *gp = dev->priv; 2193 struct gem *gp = netdev_priv(dev);
2195 unsigned long flags; 2194 unsigned long flags;
2196 2195
2197 spin_lock_irqsave(&gp->lock, flags); 2196 spin_lock_irqsave(&gp->lock, flags);
@@ -2238,7 +2237,7 @@ static int gem_do_start(struct net_device *dev)
2238 2237
2239static void gem_do_stop(struct net_device *dev, int wol) 2238static void gem_do_stop(struct net_device *dev, int wol)
2240{ 2239{
2241 struct gem *gp = dev->priv; 2240 struct gem *gp = netdev_priv(dev);
2242 unsigned long flags; 2241 unsigned long flags;
2243 2242
2244 spin_lock_irqsave(&gp->lock, flags); 2243 spin_lock_irqsave(&gp->lock, flags);
@@ -2313,7 +2312,7 @@ static void gem_reset_task(struct work_struct *work)
2313 2312
2314static int gem_open(struct net_device *dev) 2313static int gem_open(struct net_device *dev)
2315{ 2314{
2316 struct gem *gp = dev->priv; 2315 struct gem *gp = netdev_priv(dev);
2317 int rc = 0; 2316 int rc = 0;
2318 2317
2319 mutex_lock(&gp->pm_mutex); 2318 mutex_lock(&gp->pm_mutex);
@@ -2332,7 +2331,7 @@ static int gem_open(struct net_device *dev)
2332 2331
2333static int gem_close(struct net_device *dev) 2332static int gem_close(struct net_device *dev)
2334{ 2333{
2335 struct gem *gp = dev->priv; 2334 struct gem *gp = netdev_priv(dev);
2336 2335
2337 mutex_lock(&gp->pm_mutex); 2336 mutex_lock(&gp->pm_mutex);
2338 2337
@@ -2351,7 +2350,7 @@ static int gem_close(struct net_device *dev)
2351static int gem_suspend(struct pci_dev *pdev, pm_message_t state) 2350static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2352{ 2351{
2353 struct net_device *dev = pci_get_drvdata(pdev); 2352 struct net_device *dev = pci_get_drvdata(pdev);
2354 struct gem *gp = dev->priv; 2353 struct gem *gp = netdev_priv(dev);
2355 unsigned long flags; 2354 unsigned long flags;
2356 2355
2357 mutex_lock(&gp->pm_mutex); 2356 mutex_lock(&gp->pm_mutex);
@@ -2415,7 +2414,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
2415static int gem_resume(struct pci_dev *pdev) 2414static int gem_resume(struct pci_dev *pdev)
2416{ 2415{
2417 struct net_device *dev = pci_get_drvdata(pdev); 2416 struct net_device *dev = pci_get_drvdata(pdev);
2418 struct gem *gp = dev->priv; 2417 struct gem *gp = netdev_priv(dev);
2419 unsigned long flags; 2418 unsigned long flags;
2420 2419
2421 printk(KERN_INFO "%s: resuming\n", dev->name); 2420 printk(KERN_INFO "%s: resuming\n", dev->name);
@@ -2489,7 +2488,7 @@ static int gem_resume(struct pci_dev *pdev)
2489 2488
2490static struct net_device_stats *gem_get_stats(struct net_device *dev) 2489static struct net_device_stats *gem_get_stats(struct net_device *dev)
2491{ 2490{
2492 struct gem *gp = dev->priv; 2491 struct gem *gp = netdev_priv(dev);
2493 struct net_device_stats *stats = &gp->net_stats; 2492 struct net_device_stats *stats = &gp->net_stats;
2494 2493
2495 spin_lock_irq(&gp->lock); 2494 spin_lock_irq(&gp->lock);
@@ -2525,7 +2524,7 @@ static struct net_device_stats *gem_get_stats(struct net_device *dev)
2525static int gem_set_mac_address(struct net_device *dev, void *addr) 2524static int gem_set_mac_address(struct net_device *dev, void *addr)
2526{ 2525{
2527 struct sockaddr *macaddr = (struct sockaddr *) addr; 2526 struct sockaddr *macaddr = (struct sockaddr *) addr;
2528 struct gem *gp = dev->priv; 2527 struct gem *gp = netdev_priv(dev);
2529 unsigned char *e = &dev->dev_addr[0]; 2528 unsigned char *e = &dev->dev_addr[0];
2530 2529
2531 if (!is_valid_ether_addr(macaddr->sa_data)) 2530 if (!is_valid_ether_addr(macaddr->sa_data))
@@ -2553,7 +2552,7 @@ static int gem_set_mac_address(struct net_device *dev, void *addr)
2553 2552
2554static void gem_set_multicast(struct net_device *dev) 2553static void gem_set_multicast(struct net_device *dev)
2555{ 2554{
2556 struct gem *gp = dev->priv; 2555 struct gem *gp = netdev_priv(dev);
2557 u32 rxcfg, rxcfg_new; 2556 u32 rxcfg, rxcfg_new;
2558 int limit = 10000; 2557 int limit = 10000;
2559 2558
@@ -2602,7 +2601,7 @@ static void gem_set_multicast(struct net_device *dev)
2602 2601
2603static int gem_change_mtu(struct net_device *dev, int new_mtu) 2602static int gem_change_mtu(struct net_device *dev, int new_mtu)
2604{ 2603{
2605 struct gem *gp = dev->priv; 2604 struct gem *gp = netdev_priv(dev);
2606 2605
2607 if (new_mtu < GEM_MIN_MTU || new_mtu > GEM_MAX_MTU) 2606 if (new_mtu < GEM_MIN_MTU || new_mtu > GEM_MAX_MTU)
2608 return -EINVAL; 2607 return -EINVAL;
@@ -2633,7 +2632,7 @@ static int gem_change_mtu(struct net_device *dev, int new_mtu)
2633 2632
2634static void gem_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 2633static void gem_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
2635{ 2634{
2636 struct gem *gp = dev->priv; 2635 struct gem *gp = netdev_priv(dev);
2637 2636
2638 strcpy(info->driver, DRV_NAME); 2637 strcpy(info->driver, DRV_NAME);
2639 strcpy(info->version, DRV_VERSION); 2638 strcpy(info->version, DRV_VERSION);
@@ -2642,7 +2641,7 @@ static void gem_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
2642 2641
2643static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 2642static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2644{ 2643{
2645 struct gem *gp = dev->priv; 2644 struct gem *gp = netdev_priv(dev);
2646 2645
2647 if (gp->phy_type == phy_mii_mdio0 || 2646 if (gp->phy_type == phy_mii_mdio0 ||
2648 gp->phy_type == phy_mii_mdio1) { 2647 gp->phy_type == phy_mii_mdio1) {
@@ -2688,7 +2687,7 @@ static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2688 2687
2689static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 2688static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2690{ 2689{
2691 struct gem *gp = dev->priv; 2690 struct gem *gp = netdev_priv(dev);
2692 2691
2693 /* Verify the settings we care about. */ 2692 /* Verify the settings we care about. */
2694 if (cmd->autoneg != AUTONEG_ENABLE && 2693 if (cmd->autoneg != AUTONEG_ENABLE &&
@@ -2719,7 +2718,7 @@ static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
2719 2718
2720static int gem_nway_reset(struct net_device *dev) 2719static int gem_nway_reset(struct net_device *dev)
2721{ 2720{
2722 struct gem *gp = dev->priv; 2721 struct gem *gp = netdev_priv(dev);
2723 2722
2724 if (!gp->want_autoneg) 2723 if (!gp->want_autoneg)
2725 return -EINVAL; 2724 return -EINVAL;
@@ -2736,13 +2735,13 @@ static int gem_nway_reset(struct net_device *dev)
2736 2735
2737static u32 gem_get_msglevel(struct net_device *dev) 2736static u32 gem_get_msglevel(struct net_device *dev)
2738{ 2737{
2739 struct gem *gp = dev->priv; 2738 struct gem *gp = netdev_priv(dev);
2740 return gp->msg_enable; 2739 return gp->msg_enable;
2741} 2740}
2742 2741
2743static void gem_set_msglevel(struct net_device *dev, u32 value) 2742static void gem_set_msglevel(struct net_device *dev, u32 value)
2744{ 2743{
2745 struct gem *gp = dev->priv; 2744 struct gem *gp = netdev_priv(dev);
2746 gp->msg_enable = value; 2745 gp->msg_enable = value;
2747} 2746}
2748 2747
@@ -2754,7 +2753,7 @@ static void gem_set_msglevel(struct net_device *dev, u32 value)
2754 2753
2755static void gem_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 2754static void gem_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
2756{ 2755{
2757 struct gem *gp = dev->priv; 2756 struct gem *gp = netdev_priv(dev);
2758 2757
2759 /* Add more when I understand how to program the chip */ 2758 /* Add more when I understand how to program the chip */
2760 if (gp->has_wol) { 2759 if (gp->has_wol) {
@@ -2768,7 +2767,7 @@ static void gem_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
2768 2767
2769static int gem_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) 2768static int gem_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
2770{ 2769{
2771 struct gem *gp = dev->priv; 2770 struct gem *gp = netdev_priv(dev);
2772 2771
2773 if (!gp->has_wol) 2772 if (!gp->has_wol)
2774 return -EOPNOTSUPP; 2773 return -EOPNOTSUPP;
@@ -2790,7 +2789,7 @@ static const struct ethtool_ops gem_ethtool_ops = {
2790 2789
2791static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 2790static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2792{ 2791{
2793 struct gem *gp = dev->priv; 2792 struct gem *gp = netdev_priv(dev);
2794 struct mii_ioctl_data *data = if_mii(ifr); 2793 struct mii_ioctl_data *data = if_mii(ifr);
2795 int rc = -EOPNOTSUPP; 2794 int rc = -EOPNOTSUPP;
2796 unsigned long flags; 2795 unsigned long flags;
@@ -2922,7 +2921,7 @@ static void gem_remove_one(struct pci_dev *pdev)
2922 struct net_device *dev = pci_get_drvdata(pdev); 2921 struct net_device *dev = pci_get_drvdata(pdev);
2923 2922
2924 if (dev) { 2923 if (dev) {
2925 struct gem *gp = dev->priv; 2924 struct gem *gp = netdev_priv(dev);
2926 2925
2927 unregister_netdev(dev); 2926 unregister_netdev(dev);
2928 2927
@@ -2966,7 +2965,6 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
2966 struct net_device *dev; 2965 struct net_device *dev;
2967 struct gem *gp; 2966 struct gem *gp;
2968 int err, pci_using_dac; 2967 int err, pci_using_dac;
2969 DECLARE_MAC_BUF(mac);
2970 2968
2971 if (gem_version_printed++ == 0) 2969 if (gem_version_printed++ == 0)
2972 printk(KERN_INFO "%s", version); 2970 printk(KERN_INFO "%s", version);
@@ -3026,7 +3024,7 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3026 } 3024 }
3027 SET_NETDEV_DEV(dev, &pdev->dev); 3025 SET_NETDEV_DEV(dev, &pdev->dev);
3028 3026
3029 gp = dev->priv; 3027 gp = netdev_priv(dev);
3030 3028
3031 err = pci_request_regions(pdev, DRV_NAME); 3029 err = pci_request_regions(pdev, DRV_NAME);
3032 if (err) { 3030 if (err) {
@@ -3150,9 +3148,8 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
3150 goto err_out_free_consistent; 3148 goto err_out_free_consistent;
3151 } 3149 }
3152 3150
3153 printk(KERN_INFO "%s: Sun GEM (PCI) 10/100/1000BaseT Ethernet " 3151 printk(KERN_INFO "%s: Sun GEM (PCI) 10/100/1000BaseT Ethernet %pM\n",
3154 "%s\n", 3152 dev->name, dev->dev_addr);
3155 dev->name, print_mac(mac, dev->dev_addr));
3156 3153
3157 if (gp->phy_type == phy_mii_mdio0 || 3154 if (gp->phy_type == phy_mii_mdio0 ||
3158 gp->phy_type == phy_mii_mdio1) 3155 gp->phy_type == phy_mii_mdio1)