diff options
Diffstat (limited to 'drivers/net/korina.c')
-rw-r--r-- | drivers/net/korina.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/drivers/net/korina.c b/drivers/net/korina.c index 26bf1b76b997..c7a9bef4dfb0 100644 --- a/drivers/net/korina.c +++ b/drivers/net/korina.c | |||
@@ -135,6 +135,7 @@ struct korina_private { | |||
135 | struct napi_struct napi; | 135 | struct napi_struct napi; |
136 | struct timer_list media_check_timer; | 136 | struct timer_list media_check_timer; |
137 | struct mii_if_info mii_if; | 137 | struct mii_if_info mii_if; |
138 | struct work_struct restart_task; | ||
138 | struct net_device *dev; | 139 | struct net_device *dev; |
139 | int phy_addr; | 140 | int phy_addr; |
140 | }; | 141 | }; |
@@ -375,7 +376,7 @@ static int korina_rx(struct net_device *dev, int limit) | |||
375 | if (devcs & ETH_RX_LE) | 376 | if (devcs & ETH_RX_LE) |
376 | dev->stats.rx_length_errors++; | 377 | dev->stats.rx_length_errors++; |
377 | if (devcs & ETH_RX_OVR) | 378 | if (devcs & ETH_RX_OVR) |
378 | dev->stats.rx_over_errors++; | 379 | dev->stats.rx_fifo_errors++; |
379 | if (devcs & ETH_RX_CV) | 380 | if (devcs & ETH_RX_CV) |
380 | dev->stats.rx_frame_errors++; | 381 | dev->stats.rx_frame_errors++; |
381 | if (devcs & ETH_RX_CES) | 382 | if (devcs & ETH_RX_CES) |
@@ -764,10 +765,9 @@ static int korina_alloc_ring(struct net_device *dev) | |||
764 | 765 | ||
765 | /* Initialize the receive descriptors */ | 766 | /* Initialize the receive descriptors */ |
766 | for (i = 0; i < KORINA_NUM_RDS; i++) { | 767 | for (i = 0; i < KORINA_NUM_RDS; i++) { |
767 | skb = dev_alloc_skb(KORINA_RBSIZE + 2); | 768 | skb = netdev_alloc_skb_ip_align(dev, KORINA_RBSIZE); |
768 | if (!skb) | 769 | if (!skb) |
769 | return -ENOMEM; | 770 | return -ENOMEM; |
770 | skb_reserve(skb, 2); | ||
771 | lp->rx_skb[i] = skb; | 771 | lp->rx_skb[i] = skb; |
772 | lp->rd_ring[i].control = DMA_DESC_IOD | | 772 | lp->rd_ring[i].control = DMA_DESC_IOD | |
773 | DMA_COUNT(KORINA_RBSIZE); | 773 | DMA_COUNT(KORINA_RBSIZE); |
@@ -890,12 +890,12 @@ static int korina_init(struct net_device *dev) | |||
890 | 890 | ||
891 | /* | 891 | /* |
892 | * Restart the RC32434 ethernet controller. | 892 | * Restart the RC32434 ethernet controller. |
893 | * FIXME: check the return status where we call it | ||
894 | */ | 893 | */ |
895 | static int korina_restart(struct net_device *dev) | 894 | static void korina_restart_task(struct work_struct *work) |
896 | { | 895 | { |
897 | struct korina_private *lp = netdev_priv(dev); | 896 | struct korina_private *lp = container_of(work, |
898 | int ret; | 897 | struct korina_private, restart_task); |
898 | struct net_device *dev = lp->dev; | ||
899 | 899 | ||
900 | /* | 900 | /* |
901 | * Disable interrupts | 901 | * Disable interrupts |
@@ -916,10 +916,9 @@ static int korina_restart(struct net_device *dev) | |||
916 | 916 | ||
917 | napi_disable(&lp->napi); | 917 | napi_disable(&lp->napi); |
918 | 918 | ||
919 | ret = korina_init(dev); | 919 | if (korina_init(dev) < 0) { |
920 | if (ret < 0) { | ||
921 | printk(KERN_ERR "%s: cannot restart device\n", dev->name); | 920 | printk(KERN_ERR "%s: cannot restart device\n", dev->name); |
922 | return ret; | 921 | return; |
923 | } | 922 | } |
924 | korina_multicast_list(dev); | 923 | korina_multicast_list(dev); |
925 | 924 | ||
@@ -927,8 +926,6 @@ static int korina_restart(struct net_device *dev) | |||
927 | enable_irq(lp->ovr_irq); | 926 | enable_irq(lp->ovr_irq); |
928 | enable_irq(lp->tx_irq); | 927 | enable_irq(lp->tx_irq); |
929 | enable_irq(lp->rx_irq); | 928 | enable_irq(lp->rx_irq); |
930 | |||
931 | return ret; | ||
932 | } | 929 | } |
933 | 930 | ||
934 | static void korina_clear_and_restart(struct net_device *dev, u32 value) | 931 | static void korina_clear_and_restart(struct net_device *dev, u32 value) |
@@ -937,7 +934,7 @@ static void korina_clear_and_restart(struct net_device *dev, u32 value) | |||
937 | 934 | ||
938 | netif_stop_queue(dev); | 935 | netif_stop_queue(dev); |
939 | writel(value, &lp->eth_regs->ethintfc); | 936 | writel(value, &lp->eth_regs->ethintfc); |
940 | korina_restart(dev); | 937 | schedule_work(&lp->restart_task); |
941 | } | 938 | } |
942 | 939 | ||
943 | /* Ethernet Tx Underflow interrupt */ | 940 | /* Ethernet Tx Underflow interrupt */ |
@@ -962,11 +959,8 @@ static irqreturn_t korina_und_interrupt(int irq, void *dev_id) | |||
962 | static void korina_tx_timeout(struct net_device *dev) | 959 | static void korina_tx_timeout(struct net_device *dev) |
963 | { | 960 | { |
964 | struct korina_private *lp = netdev_priv(dev); | 961 | struct korina_private *lp = netdev_priv(dev); |
965 | unsigned long flags; | ||
966 | 962 | ||
967 | spin_lock_irqsave(&lp->lock, flags); | 963 | schedule_work(&lp->restart_task); |
968 | korina_restart(dev); | ||
969 | spin_unlock_irqrestore(&lp->lock, flags); | ||
970 | } | 964 | } |
971 | 965 | ||
972 | /* Ethernet Rx Overflow interrupt */ | 966 | /* Ethernet Rx Overflow interrupt */ |
@@ -1086,6 +1080,8 @@ static int korina_close(struct net_device *dev) | |||
1086 | 1080 | ||
1087 | napi_disable(&lp->napi); | 1081 | napi_disable(&lp->napi); |
1088 | 1082 | ||
1083 | cancel_work_sync(&lp->restart_task); | ||
1084 | |||
1089 | free_irq(lp->rx_irq, dev); | 1085 | free_irq(lp->rx_irq, dev); |
1090 | free_irq(lp->tx_irq, dev); | 1086 | free_irq(lp->tx_irq, dev); |
1091 | free_irq(lp->ovr_irq, dev); | 1087 | free_irq(lp->ovr_irq, dev); |
@@ -1198,6 +1194,8 @@ static int korina_probe(struct platform_device *pdev) | |||
1198 | } | 1194 | } |
1199 | setup_timer(&lp->media_check_timer, korina_poll_media, (unsigned long) dev); | 1195 | setup_timer(&lp->media_check_timer, korina_poll_media, (unsigned long) dev); |
1200 | 1196 | ||
1197 | INIT_WORK(&lp->restart_task, korina_restart_task); | ||
1198 | |||
1201 | printk(KERN_INFO "%s: " DRV_NAME "-" DRV_VERSION " " DRV_RELDATE "\n", | 1199 | printk(KERN_INFO "%s: " DRV_NAME "-" DRV_VERSION " " DRV_RELDATE "\n", |
1202 | dev->name); | 1200 | dev->name); |
1203 | out: | 1201 | out: |