aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/r6040.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 504a48ff73c8..4e67884bdc9e 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -183,7 +183,7 @@ static char version[] __devinitdata = KERN_INFO DRV_NAME
183static int phy_table[] = { PHY1_ADDR, PHY2_ADDR }; 183static int phy_table[] = { PHY1_ADDR, PHY2_ADDR };
184 184
185/* Read a word data from PHY Chip */ 185/* Read a word data from PHY Chip */
186static int phy_read(void __iomem *ioaddr, int phy_addr, int reg) 186static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
187{ 187{
188 int limit = 2048; 188 int limit = 2048;
189 u16 cmd; 189 u16 cmd;
@@ -200,7 +200,7 @@ static int phy_read(void __iomem *ioaddr, int phy_addr, int reg)
200} 200}
201 201
202/* Write a word data from PHY Chip */ 202/* Write a word data from PHY Chip */
203static void phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val) 203static void r6040_phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val)
204{ 204{
205 int limit = 2048; 205 int limit = 2048;
206 u16 cmd; 206 u16 cmd;
@@ -216,20 +216,20 @@ static void phy_write(void __iomem *ioaddr, int phy_addr, int reg, u16 val)
216 } 216 }
217} 217}
218 218
219static int mdio_read(struct net_device *dev, int mii_id, int reg) 219static int r6040_mdio_read(struct net_device *dev, int mii_id, int reg)
220{ 220{
221 struct r6040_private *lp = netdev_priv(dev); 221 struct r6040_private *lp = netdev_priv(dev);
222 void __iomem *ioaddr = lp->base; 222 void __iomem *ioaddr = lp->base;
223 223
224 return (phy_read(ioaddr, lp->phy_addr, reg)); 224 return (r6040_phy_read(ioaddr, lp->phy_addr, reg));
225} 225}
226 226
227static void mdio_write(struct net_device *dev, int mii_id, int reg, int val) 227static void r6040_mdio_write(struct net_device *dev, int mii_id, int reg, int val)
228{ 228{
229 struct r6040_private *lp = netdev_priv(dev); 229 struct r6040_private *lp = netdev_priv(dev);
230 void __iomem *ioaddr = lp->base; 230 void __iomem *ioaddr = lp->base;
231 231
232 phy_write(ioaddr, lp->phy_addr, reg, val); 232 r6040_phy_write(ioaddr, lp->phy_addr, reg, val);
233} 233}
234 234
235static void r6040_free_txbufs(struct net_device *dev) 235static void r6040_free_txbufs(struct net_device *dev)
@@ -284,7 +284,7 @@ static void r6040_init_ring_desc(struct r6040_descriptor *desc_ring,
284} 284}
285 285
286/* Allocate skb buffer for rx descriptor */ 286/* Allocate skb buffer for rx descriptor */
287static void rx_buf_alloc(struct r6040_private *lp, struct net_device *dev) 287static void r6040_rx_buf_alloc(struct r6040_private *lp, struct net_device *dev)
288{ 288{
289 struct r6040_descriptor *descptr; 289 struct r6040_descriptor *descptr;
290 void __iomem *ioaddr = lp->base; 290 void __iomem *ioaddr = lp->base;
@@ -331,7 +331,7 @@ static void r6040_alloc_rxbufs(struct net_device *dev)
331 lp->rx_remove_ptr = lp->rx_insert_ptr = lp->rx_ring; 331 lp->rx_remove_ptr = lp->rx_insert_ptr = lp->rx_ring;
332 r6040_init_ring_desc(lp->rx_ring, lp->rx_ring_dma, RX_DCNT); 332 r6040_init_ring_desc(lp->rx_ring, lp->rx_ring_dma, RX_DCNT);
333 333
334 rx_buf_alloc(lp, dev); 334 r6040_rx_buf_alloc(lp, dev);
335 335
336 iowrite16(lp->rx_ring_dma, ioaddr + MRD_SA0); 336 iowrite16(lp->rx_ring_dma, ioaddr + MRD_SA0);
337 iowrite16(lp->rx_ring_dma >> 16, ioaddr + MRD_SA1); 337 iowrite16(lp->rx_ring_dma >> 16, ioaddr + MRD_SA1);
@@ -345,7 +345,7 @@ static void r6040_tx_timeout(struct net_device *dev)
345 printk(KERN_WARNING "%s: transmit timed out, status %4.4x, PHY status " 345 printk(KERN_WARNING "%s: transmit timed out, status %4.4x, PHY status "
346 "%4.4x\n", 346 "%4.4x\n",
347 dev->name, ioread16(ioaddr + MIER), 347 dev->name, ioread16(ioaddr + MIER),
348 mdio_read(dev, priv->mii_if.phy_id, MII_BMSR)); 348 r6040_mdio_read(dev, priv->mii_if.phy_id, MII_BMSR));
349 349
350 disable_irq(dev->irq); 350 disable_irq(dev->irq);
351 napi_disable(&priv->napi); 351 napi_disable(&priv->napi);
@@ -432,23 +432,23 @@ static int r6040_close(struct net_device *dev)
432} 432}
433 433
434/* Status of PHY CHIP */ 434/* Status of PHY CHIP */
435static int phy_mode_chk(struct net_device *dev) 435static int r6040_phy_mode_chk(struct net_device *dev)
436{ 436{
437 struct r6040_private *lp = netdev_priv(dev); 437 struct r6040_private *lp = netdev_priv(dev);
438 void __iomem *ioaddr = lp->base; 438 void __iomem *ioaddr = lp->base;
439 int phy_dat; 439 int phy_dat;
440 440
441 /* PHY Link Status Check */ 441 /* PHY Link Status Check */
442 phy_dat = phy_read(ioaddr, lp->phy_addr, 1); 442 phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 1);
443 if (!(phy_dat & 0x4)) 443 if (!(phy_dat & 0x4))
444 phy_dat = 0x8000; /* Link Failed, full duplex */ 444 phy_dat = 0x8000; /* Link Failed, full duplex */
445 445
446 /* PHY Chip Auto-Negotiation Status */ 446 /* PHY Chip Auto-Negotiation Status */
447 phy_dat = phy_read(ioaddr, lp->phy_addr, 1); 447 phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 1);
448 if (phy_dat & 0x0020) { 448 if (phy_dat & 0x0020) {
449 /* Auto Negotiation Mode */ 449 /* Auto Negotiation Mode */
450 phy_dat = phy_read(ioaddr, lp->phy_addr, 5); 450 phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 5);
451 phy_dat &= phy_read(ioaddr, lp->phy_addr, 4); 451 phy_dat &= r6040_phy_read(ioaddr, lp->phy_addr, 4);
452 if (phy_dat & 0x140) 452 if (phy_dat & 0x140)
453 /* Force full duplex */ 453 /* Force full duplex */
454 phy_dat = 0x8000; 454 phy_dat = 0x8000;
@@ -456,7 +456,7 @@ static int phy_mode_chk(struct net_device *dev)
456 phy_dat = 0; 456 phy_dat = 0;
457 } else { 457 } else {
458 /* Force Mode */ 458 /* Force Mode */
459 phy_dat = phy_read(ioaddr, lp->phy_addr, 0); 459 phy_dat = r6040_phy_read(ioaddr, lp->phy_addr, 0);
460 if (phy_dat & 0x100) 460 if (phy_dat & 0x100)
461 phy_dat = 0x8000; 461 phy_dat = 0x8000;
462 else 462 else
@@ -468,12 +468,12 @@ static int phy_mode_chk(struct net_device *dev)
468 468
469static void r6040_set_carrier(struct mii_if_info *mii) 469static void r6040_set_carrier(struct mii_if_info *mii)
470{ 470{
471 if (phy_mode_chk(mii->dev)) { 471 if (r6040_phy_mode_chk(mii->dev)) {
472 /* autoneg is off: Link is always assumed to be up */ 472 /* autoneg is off: Link is always assumed to be up */
473 if (!netif_carrier_ok(mii->dev)) 473 if (!netif_carrier_ok(mii->dev))
474 netif_carrier_on(mii->dev); 474 netif_carrier_on(mii->dev);
475 } else 475 } else
476 phy_mode_chk(mii->dev); 476 r6040_phy_mode_chk(mii->dev);
477} 477}
478 478
479static int r6040_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) 479static int r6040_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
@@ -560,7 +560,7 @@ static int r6040_rx(struct net_device *dev, int limit)
560 } 560 }
561 /* Allocate new RX buffer */ 561 /* Allocate new RX buffer */
562 if (priv->rx_free_desc < RX_DCNT) 562 if (priv->rx_free_desc < RX_DCNT)
563 rx_buf_alloc(priv, priv->dev); 563 r6040_rx_buf_alloc(priv, priv->dev);
564 564
565 return count; 565 return count;
566} 566}
@@ -672,18 +672,18 @@ static void r6040_up(struct net_device *dev)
672 /* Buffer Size Register */ 672 /* Buffer Size Register */
673 iowrite16(MAX_BUF_SIZE, ioaddr + MR_BSR); 673 iowrite16(MAX_BUF_SIZE, ioaddr + MR_BSR);
674 /* Read the PHY ID */ 674 /* Read the PHY ID */
675 lp->switch_sig = phy_read(ioaddr, 0, 2); 675 lp->switch_sig = r6040_phy_read(ioaddr, 0, 2);
676 676
677 if (lp->switch_sig == ICPLUS_PHY_ID) { 677 if (lp->switch_sig == ICPLUS_PHY_ID) {
678 phy_write(ioaddr, 29, 31, 0x175C); /* Enable registers */ 678 r6040_phy_write(ioaddr, 29, 31, 0x175C); /* Enable registers */
679 lp->phy_mode = 0x8000; 679 lp->phy_mode = 0x8000;
680 } else { 680 } else {
681 /* PHY Mode Check */ 681 /* PHY Mode Check */
682 phy_write(ioaddr, lp->phy_addr, 4, PHY_CAP); 682 r6040_phy_write(ioaddr, lp->phy_addr, 4, PHY_CAP);
683 phy_write(ioaddr, lp->phy_addr, 0, PHY_MODE); 683 r6040_phy_write(ioaddr, lp->phy_addr, 0, PHY_MODE);
684 684
685 if (PHY_MODE == 0x3100) 685 if (PHY_MODE == 0x3100)
686 lp->phy_mode = phy_mode_chk(dev); 686 lp->phy_mode = r6040_phy_mode_chk(dev);
687 else 687 else
688 lp->phy_mode = (PHY_MODE & 0x0100) ? 0x8000:0x0; 688 lp->phy_mode = (PHY_MODE & 0x0100) ? 0x8000:0x0;
689 } 689 }
@@ -699,10 +699,10 @@ static void r6040_up(struct net_device *dev)
699 iowrite16(0x0F06, ioaddr + MR_ICR); 699 iowrite16(0x0F06, ioaddr + MR_ICR);
700 700
701 /* improve performance (by RDC guys) */ 701 /* improve performance (by RDC guys) */
702 phy_write(ioaddr, 30, 17, (phy_read(ioaddr, 30, 17) | 0x4000)); 702 r6040_phy_write(ioaddr, 30, 17, (r6040_phy_read(ioaddr, 30, 17) | 0x4000));
703 phy_write(ioaddr, 30, 17, ~((~phy_read(ioaddr, 30, 17)) | 0x2000)); 703 r6040_phy_write(ioaddr, 30, 17, ~((~r6040_phy_read(ioaddr, 30, 17)) | 0x2000));
704 phy_write(ioaddr, 0, 19, 0x0000); 704 r6040_phy_write(ioaddr, 0, 19, 0x0000);
705 phy_write(ioaddr, 0, 30, 0x01F0); 705 r6040_phy_write(ioaddr, 0, 30, 0x01F0);
706 706
707 /* Interrupt Mask Register */ 707 /* Interrupt Mask Register */
708 iowrite16(INT_MASK, ioaddr + MIER); 708 iowrite16(INT_MASK, ioaddr + MIER);
@@ -721,7 +721,7 @@ static void r6040_timer(unsigned long data)
721 721
722 /* Polling PHY Chip Status */ 722 /* Polling PHY Chip Status */
723 if (PHY_MODE == 0x3100) 723 if (PHY_MODE == 0x3100)
724 phy_mode = phy_mode_chk(dev); 724 phy_mode = r6040_phy_mode_chk(dev);
725 else 725 else
726 phy_mode = (PHY_MODE & 0x0100) ? 0x8000:0x0; 726 phy_mode = (PHY_MODE & 0x0100) ? 0x8000:0x0;
727 727
@@ -1070,8 +1070,8 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
1070#endif 1070#endif
1071 netif_napi_add(dev, &lp->napi, r6040_poll, 64); 1071 netif_napi_add(dev, &lp->napi, r6040_poll, 64);
1072 lp->mii_if.dev = dev; 1072 lp->mii_if.dev = dev;
1073 lp->mii_if.mdio_read = mdio_read; 1073 lp->mii_if.mdio_read = r6040_mdio_read;
1074 lp->mii_if.mdio_write = mdio_write; 1074 lp->mii_if.mdio_write = r6040_mdio_write;
1075 lp->mii_if.phy_id = lp->phy_addr; 1075 lp->mii_if.phy_id = lp->phy_addr;
1076 lp->mii_if.phy_id_mask = 0x1f; 1076 lp->mii_if.phy_id_mask = 0x1f;
1077 lp->mii_if.reg_num_mask = 0x1f; 1077 lp->mii_if.reg_num_mask = 0x1f;