aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/r6040.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 142c381e1d73..0a00850da79d 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -200,7 +200,7 @@ struct r6040_private {
200 int old_duplex; 200 int old_duplex;
201}; 201};
202 202
203static char version[] __devinitdata = KERN_INFO DRV_NAME 203static char version[] __devinitdata = DRV_NAME
204 ": RDC R6040 NAPI net driver," 204 ": RDC R6040 NAPI net driver,"
205 "version "DRV_VERSION " (" DRV_RELDATE ")"; 205 "version "DRV_VERSION " (" DRV_RELDATE ")";
206 206
@@ -224,7 +224,8 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
224} 224}
225 225
226/* Write a word data from PHY Chip */ 226/* Write a word data from PHY Chip */
227static void r6040_phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val) 227static void r6040_phy_write(void __iomem *ioaddr,
228 int phy_addr, int reg, u16 val)
228{ 229{
229 int limit = 2048; 230 int limit = 2048;
230 u16 cmd; 231 u16 cmd;
@@ -348,8 +349,8 @@ static int r6040_alloc_rxbufs(struct net_device *dev)
348 } 349 }
349 desc->skb_ptr = skb; 350 desc->skb_ptr = skb;
350 desc->buf = cpu_to_le32(pci_map_single(lp->pdev, 351 desc->buf = cpu_to_le32(pci_map_single(lp->pdev,
351 desc->skb_ptr->data, 352 desc->skb_ptr->data,
352 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE)); 353 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE));
353 desc->status = DSC_OWNER_MAC; 354 desc->status = DSC_OWNER_MAC;
354 desc = desc->vndescp; 355 desc = desc->vndescp;
355 } while (desc != lp->rx_ring); 356 } while (desc != lp->rx_ring);
@@ -491,12 +492,14 @@ static int r6040_close(struct net_device *dev)
491 492
492 /* Free Descriptor memory */ 493 /* Free Descriptor memory */
493 if (lp->rx_ring) { 494 if (lp->rx_ring) {
494 pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma); 495 pci_free_consistent(pdev,
496 RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
495 lp->rx_ring = NULL; 497 lp->rx_ring = NULL;
496 } 498 }
497 499
498 if (lp->tx_ring) { 500 if (lp->tx_ring) {
499 pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma); 501 pci_free_consistent(pdev,
502 TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
500 lp->tx_ring = NULL; 503 lp->tx_ring = NULL;
501 } 504 }
502 505
@@ -547,7 +550,7 @@ static int r6040_rx(struct net_device *dev, int limit)
547 } 550 }
548 goto next_descr; 551 goto next_descr;
549 } 552 }
550 553
551 /* Packet successfully received */ 554 /* Packet successfully received */
552 new_skb = netdev_alloc_skb(dev, MAX_BUF_SIZE); 555 new_skb = netdev_alloc_skb(dev, MAX_BUF_SIZE);
553 if (!new_skb) { 556 if (!new_skb) {
@@ -556,13 +559,13 @@ static int r6040_rx(struct net_device *dev, int limit)
556 } 559 }
557 skb_ptr = descptr->skb_ptr; 560 skb_ptr = descptr->skb_ptr;
558 skb_ptr->dev = priv->dev; 561 skb_ptr->dev = priv->dev;
559 562
560 /* Do not count the CRC */ 563 /* Do not count the CRC */
561 skb_put(skb_ptr, descptr->len - 4); 564 skb_put(skb_ptr, descptr->len - 4);
562 pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf), 565 pci_unmap_single(priv->pdev, le32_to_cpu(descptr->buf),
563 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE); 566 MAX_BUF_SIZE, PCI_DMA_FROMDEVICE);
564 skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev); 567 skb_ptr->protocol = eth_type_trans(skb_ptr, priv->dev);
565 568
566 /* Send to upper layer */ 569 /* Send to upper layer */
567 netif_receive_skb(skb_ptr); 570 netif_receive_skb(skb_ptr);
568 dev->stats.rx_packets++; 571 dev->stats.rx_packets++;
@@ -710,8 +713,10 @@ static int r6040_up(struct net_device *dev)
710 return ret; 713 return ret;
711 714
712 /* improve performance (by RDC guys) */ 715 /* improve performance (by RDC guys) */
713 r6040_phy_write(ioaddr, 30, 17, (r6040_phy_read(ioaddr, 30, 17) | 0x4000)); 716 r6040_phy_write(ioaddr, 30, 17,
714 r6040_phy_write(ioaddr, 30, 17, ~((~r6040_phy_read(ioaddr, 30, 17)) | 0x2000)); 717 (r6040_phy_read(ioaddr, 30, 17) | 0x4000));
718 r6040_phy_write(ioaddr, 30, 17,
719 ~((~r6040_phy_read(ioaddr, 30, 17)) | 0x2000));
715 r6040_phy_write(ioaddr, 0, 19, 0x0000); 720 r6040_phy_write(ioaddr, 0, 19, 0x0000);
716 r6040_phy_write(ioaddr, 0, 30, 0x01F0); 721 r6040_phy_write(ioaddr, 0, 30, 0x01F0);
717 722
@@ -946,7 +951,7 @@ static const struct net_device_ops r6040_netdev_ops = {
946 .ndo_set_multicast_list = r6040_multicast_list, 951 .ndo_set_multicast_list = r6040_multicast_list,
947 .ndo_change_mtu = eth_change_mtu, 952 .ndo_change_mtu = eth_change_mtu,
948 .ndo_validate_addr = eth_validate_addr, 953 .ndo_validate_addr = eth_validate_addr,
949 .ndo_set_mac_address = eth_mac_addr, 954 .ndo_set_mac_address = eth_mac_addr,
950 .ndo_do_ioctl = r6040_ioctl, 955 .ndo_do_ioctl = r6040_ioctl,
951 .ndo_tx_timeout = r6040_tx_timeout, 956 .ndo_tx_timeout = r6040_tx_timeout,
952#ifdef CONFIG_NET_POLL_CONTROLLER 957#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -1039,7 +1044,7 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
1039 u16 *adrp; 1044 u16 *adrp;
1040 int i; 1045 int i;
1041 1046
1042 printk("%s\n", version); 1047 pr_info("%s\n", version);
1043 1048
1044 err = pci_enable_device(pdev); 1049 err = pci_enable_device(pdev);
1045 if (err) 1050 if (err)
@@ -1113,7 +1118,8 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
1113 /* Some bootloader/BIOSes do not initialize 1118 /* Some bootloader/BIOSes do not initialize
1114 * MAC address, warn about that */ 1119 * MAC address, warn about that */
1115 if (!(adrp[0] || adrp[1] || adrp[2])) { 1120 if (!(adrp[0] || adrp[1] || adrp[2])) {
1116 netdev_warn(dev, "MAC address not initialized, generating random\n"); 1121 netdev_warn(dev, "MAC address not initialized, "
1122 "generating random\n");
1117 random_ether_addr(dev->dev_addr); 1123 random_ether_addr(dev->dev_addr);
1118 } 1124 }
1119 1125