aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bmac.c')
-rw-r--r--drivers/net/bmac.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index 6fad83f24c4f..b0c19292b60d 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -333,7 +333,7 @@ bmac_init_registers(struct net_device *dev)
333 udelay(10000); 333 udelay(10000);
334 } 334 }
335 335
336 bmwrite(dev, RSEED, (unsigned short)0x1968); 336 bmwrite(dev, RSEED, (unsigned short)0x1968);
337 337
338 regValue = bmread(dev, XIFC); 338 regValue = bmread(dev, XIFC);
339 regValue |= TxOutputEnable; 339 regValue |= TxOutputEnable;
@@ -373,7 +373,7 @@ bmac_init_registers(struct net_device *dev)
373 bmwrite(dev, BHASH2, bp->hash_table_mask[1]); /* bits 31 - 16 */ 373 bmwrite(dev, BHASH2, bp->hash_table_mask[1]); /* bits 31 - 16 */
374 bmwrite(dev, BHASH1, bp->hash_table_mask[2]); /* bits 47 - 32 */ 374 bmwrite(dev, BHASH1, bp->hash_table_mask[2]); /* bits 47 - 32 */
375 bmwrite(dev, BHASH0, bp->hash_table_mask[3]); /* bits 63 - 48 */ 375 bmwrite(dev, BHASH0, bp->hash_table_mask[3]); /* bits 63 - 48 */
376 376
377 pWord16 = (unsigned short *)dev->dev_addr; 377 pWord16 = (unsigned short *)dev->dev_addr;
378 bmwrite(dev, MADD0, *pWord16++); 378 bmwrite(dev, MADD0, *pWord16++);
379 bmwrite(dev, MADD1, *pWord16++); 379 bmwrite(dev, MADD1, *pWord16++);
@@ -411,11 +411,11 @@ bmac_start_chip(struct net_device *dev)
411 /* enable rx dma channel */ 411 /* enable rx dma channel */
412 dbdma_continue(rd); 412 dbdma_continue(rd);
413 413
414 oldConfig = bmread(dev, TXCFG); 414 oldConfig = bmread(dev, TXCFG);
415 bmwrite(dev, TXCFG, oldConfig | TxMACEnable ); 415 bmwrite(dev, TXCFG, oldConfig | TxMACEnable );
416 416
417 /* turn on rx plus any other bits already on (promiscuous possibly) */ 417 /* turn on rx plus any other bits already on (promiscuous possibly) */
418 oldConfig = bmread(dev, RXCFG); 418 oldConfig = bmread(dev, RXCFG);
419 bmwrite(dev, RXCFG, oldConfig | RxMACEnable ); 419 bmwrite(dev, RXCFG, oldConfig | RxMACEnable );
420 udelay(20000); 420 udelay(20000);
421} 421}
@@ -456,12 +456,12 @@ static void bmac_init_chip(struct net_device *dev)
456#ifdef CONFIG_PM 456#ifdef CONFIG_PM
457static int bmac_suspend(struct macio_dev *mdev, pm_message_t state) 457static int bmac_suspend(struct macio_dev *mdev, pm_message_t state)
458{ 458{
459 struct net_device* dev = macio_get_drvdata(mdev); 459 struct net_device* dev = macio_get_drvdata(mdev);
460 struct bmac_data *bp = netdev_priv(dev); 460 struct bmac_data *bp = netdev_priv(dev);
461 unsigned long flags; 461 unsigned long flags;
462 unsigned short config; 462 unsigned short config;
463 int i; 463 int i;
464 464
465 netif_device_detach(dev); 465 netif_device_detach(dev);
466 /* prolly should wait for dma to finish & turn off the chip */ 466 /* prolly should wait for dma to finish & turn off the chip */
467 spin_lock_irqsave(&bp->lock, flags); 467 spin_lock_irqsave(&bp->lock, flags);
@@ -477,7 +477,7 @@ static int bmac_suspend(struct macio_dev *mdev, pm_message_t state)
477 if (bp->opened) { 477 if (bp->opened) {
478 volatile struct dbdma_regs __iomem *rd = bp->rx_dma; 478 volatile struct dbdma_regs __iomem *rd = bp->rx_dma;
479 volatile struct dbdma_regs __iomem *td = bp->tx_dma; 479 volatile struct dbdma_regs __iomem *td = bp->tx_dma;
480 480
481 config = bmread(dev, RXCFG); 481 config = bmread(dev, RXCFG);
482 bmwrite(dev, RXCFG, (config & ~RxMACEnable)); 482 bmwrite(dev, RXCFG, (config & ~RxMACEnable));
483 config = bmread(dev, TXCFG); 483 config = bmread(dev, TXCFG);
@@ -506,7 +506,7 @@ static int bmac_suspend(struct macio_dev *mdev, pm_message_t state)
506 506
507static int bmac_resume(struct macio_dev *mdev) 507static int bmac_resume(struct macio_dev *mdev)
508{ 508{
509 struct net_device* dev = macio_get_drvdata(mdev); 509 struct net_device* dev = macio_get_drvdata(mdev);
510 struct bmac_data *bp = netdev_priv(dev); 510 struct bmac_data *bp = netdev_priv(dev);
511 511
512 /* see if this is enough */ 512 /* see if this is enough */
@@ -855,12 +855,12 @@ crc416(unsigned int curval, unsigned short nxtval)
855 else high_crc_set = 1; 855 else high_crc_set = 1;
856 856
857 cur = cur << 1; 857 cur = cur << 1;
858 858
859 if ((next & 0x0001) == 0) low_data_set = 0; 859 if ((next & 0x0001) == 0) low_data_set = 0;
860 else low_data_set = 1; 860 else low_data_set = 1;
861 861
862 next = next >> 1; 862 next = next >> 1;
863 863
864 /* do the XOR */ 864 /* do the XOR */
865 if (high_crc_set ^ low_data_set) cur = cur ^ ENET_CRCPOLY; 865 if (high_crc_set ^ low_data_set) cur = cur ^ ENET_CRCPOLY;
866 } 866 }
@@ -869,7 +869,7 @@ crc416(unsigned int curval, unsigned short nxtval)
869 869
870static unsigned int 870static unsigned int
871bmac_crc(unsigned short *address) 871bmac_crc(unsigned short *address)
872{ 872{
873 unsigned int newcrc; 873 unsigned int newcrc;
874 874
875 XXDEBUG(("bmac_crc: addr=%#04x, %#04x, %#04x\n", *address, address[1], address[2])); 875 XXDEBUG(("bmac_crc: addr=%#04x, %#04x, %#04x\n", *address, address[1], address[2]));
@@ -887,7 +887,7 @@ bmac_crc(unsigned short *address)
887 887
888static void 888static void
889bmac_addhash(struct bmac_data *bp, unsigned char *addr) 889bmac_addhash(struct bmac_data *bp, unsigned char *addr)
890{ 890{
891 unsigned int crc; 891 unsigned int crc;
892 unsigned short mask; 892 unsigned short mask;
893 893
@@ -902,7 +902,7 @@ bmac_addhash(struct bmac_data *bp, unsigned char *addr)
902 902
903static void 903static void
904bmac_removehash(struct bmac_data *bp, unsigned char *addr) 904bmac_removehash(struct bmac_data *bp, unsigned char *addr)
905{ 905{
906 unsigned int crc; 906 unsigned int crc;
907 unsigned char mask; 907 unsigned char mask;
908 908
@@ -1054,13 +1054,13 @@ static void bmac_set_multicast(struct net_device *dev)
1054 bmwrite(dev, RXCFG, rx_cfg); 1054 bmwrite(dev, RXCFG, rx_cfg);
1055 } else { 1055 } else {
1056 u16 hash_table[4]; 1056 u16 hash_table[4];
1057 1057
1058 rx_cfg = bmread(dev, RXCFG); 1058 rx_cfg = bmread(dev, RXCFG);
1059 rx_cfg &= ~RxPromiscEnable; 1059 rx_cfg &= ~RxPromiscEnable;
1060 bmwrite(dev, RXCFG, rx_cfg); 1060 bmwrite(dev, RXCFG, rx_cfg);
1061 1061
1062 for(i = 0; i < 4; i++) hash_table[i] = 0; 1062 for(i = 0; i < 4; i++) hash_table[i] = 0;
1063 1063
1064 for(i = 0; i < dev->mc_count; i++) { 1064 for(i = 0; i < dev->mc_count; i++) {
1065 addrs = dmi->dmi_addr; 1065 addrs = dmi->dmi_addr;
1066 dmi = dmi->next; 1066 dmi = dmi->next;
@@ -1220,7 +1220,7 @@ bmac_get_station_address(struct net_device *dev, unsigned char *ea)
1220 int i; 1220 int i;
1221 unsigned short data; 1221 unsigned short data;
1222 1222
1223 for (i = 0; i < 6; i++) 1223 for (i = 0; i < 6; i++)
1224 { 1224 {
1225 reset_and_select_srom(dev); 1225 reset_and_select_srom(dev);
1226 data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits); 1226 data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits);
@@ -1244,7 +1244,7 @@ static void bmac_reset_and_enable(struct net_device *dev)
1244 bmac_start_chip(dev); 1244 bmac_start_chip(dev);
1245 bmwrite(dev, INTDISABLE, EnableNormal); 1245 bmwrite(dev, INTDISABLE, EnableNormal);
1246 bp->sleeping = 0; 1246 bp->sleeping = 0;
1247 1247
1248 /* 1248 /*
1249 * It seems that the bmac can't receive until it's transmitted 1249 * It seems that the bmac can't receive until it's transmitted
1250 * a packet. So we give it a dummy packet to transmit. 1250 * a packet. So we give it a dummy packet to transmit.
@@ -1286,7 +1286,7 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
1286 printk(KERN_ERR "BMAC: alloc_etherdev failed, out of memory\n"); 1286 printk(KERN_ERR "BMAC: alloc_etherdev failed, out of memory\n");
1287 return -ENOMEM; 1287 return -ENOMEM;
1288 } 1288 }
1289 1289
1290 bp = netdev_priv(dev); 1290 bp = netdev_priv(dev);
1291 SET_MODULE_OWNER(dev); 1291 SET_MODULE_OWNER(dev);
1292 SET_NETDEV_DEV(dev, &mdev->ofdev.dev); 1292 SET_NETDEV_DEV(dev, &mdev->ofdev.dev);
@@ -1379,7 +1379,7 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
1379 printk("%c%.2x", (j? ':': ' '), dev->dev_addr[j]); 1379 printk("%c%.2x", (j? ':': ' '), dev->dev_addr[j]);
1380 XXDEBUG((", base_addr=%#0lx", dev->base_addr)); 1380 XXDEBUG((", base_addr=%#0lx", dev->base_addr));
1381 printk("\n"); 1381 printk("\n");
1382 1382
1383 return 0; 1383 return 0;
1384 1384
1385err_out_irq2: 1385err_out_irq2:
@@ -1471,7 +1471,7 @@ bmac_start(struct net_device *dev)
1471 1471
1472 if (bp->sleeping) 1472 if (bp->sleeping)
1473 return; 1473 return;
1474 1474
1475 spin_lock_irqsave(&bp->lock, flags); 1475 spin_lock_irqsave(&bp->lock, flags);
1476 while (1) { 1476 while (1) {
1477 i = bp->tx_fill + 1; 1477 i = bp->tx_fill + 1;
@@ -1559,9 +1559,9 @@ static void bmac_tx_timeout(unsigned long data)
1559 } 1559 }
1560 1560
1561 /* turn it back on */ 1561 /* turn it back on */
1562 oldConfig = bmread(dev, RXCFG); 1562 oldConfig = bmread(dev, RXCFG);
1563 bmwrite(dev, RXCFG, oldConfig | RxMACEnable ); 1563 bmwrite(dev, RXCFG, oldConfig | RxMACEnable );
1564 oldConfig = bmread(dev, TXCFG); 1564 oldConfig = bmread(dev, TXCFG);
1565 bmwrite(dev, TXCFG, oldConfig | TxMACEnable ); 1565 bmwrite(dev, TXCFG, oldConfig | TxMACEnable );
1566 1566
1567 spin_unlock_irqrestore(&bp->lock, flags); 1567 spin_unlock_irqrestore(&bp->lock, flags);
@@ -1571,10 +1571,10 @@ static void bmac_tx_timeout(unsigned long data)
1571static void dump_dbdma(volatile struct dbdma_cmd *cp,int count) 1571static void dump_dbdma(volatile struct dbdma_cmd *cp,int count)
1572{ 1572{
1573 int i,*ip; 1573 int i,*ip;
1574 1574
1575 for (i=0;i< count;i++) { 1575 for (i=0;i< count;i++) {
1576 ip = (int*)(cp+i); 1576 ip = (int*)(cp+i);
1577 1577
1578 printk("dbdma req 0x%x addr 0x%x baddr 0x%x xfer/res 0x%x\n", 1578 printk("dbdma req 0x%x addr 0x%x baddr 0x%x xfer/res 0x%x\n",
1579 ld_le32(ip+0), 1579 ld_le32(ip+0),
1580 ld_le32(ip+1), 1580 ld_le32(ip+1),
@@ -1630,7 +1630,7 @@ static int __devexit bmac_remove(struct macio_dev *mdev)
1630 unregister_netdev(dev); 1630 unregister_netdev(dev);
1631 1631
1632 free_irq(dev->irq, dev); 1632 free_irq(dev->irq, dev);
1633 free_irq(bp->tx_dma_intr, dev); 1633 free_irq(bp->tx_dma_intr, dev);
1634 free_irq(bp->rx_dma_intr, dev); 1634 free_irq(bp->rx_dma_intr, dev);
1635 1635
1636 iounmap((void __iomem *)dev->base_addr); 1636 iounmap((void __iomem *)dev->base_addr);
@@ -1644,7 +1644,7 @@ static int __devexit bmac_remove(struct macio_dev *mdev)
1644 return 0; 1644 return 0;
1645} 1645}
1646 1646
1647static struct of_device_id bmac_match[] = 1647static struct of_device_id bmac_match[] =
1648{ 1648{
1649 { 1649 {
1650 .name = "bmac", 1650 .name = "bmac",
@@ -1659,7 +1659,7 @@ static struct of_device_id bmac_match[] =
1659}; 1659};
1660MODULE_DEVICE_TABLE (of, bmac_match); 1660MODULE_DEVICE_TABLE (of, bmac_match);
1661 1661
1662static struct macio_driver bmac_driver = 1662static struct macio_driver bmac_driver =
1663{ 1663{
1664 .name = "bmac", 1664 .name = "bmac",
1665 .match_table = bmac_match, 1665 .match_table = bmac_match,