Lines Matching +full:srom +full:- +full:page +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
30 #include <asm/page.h>
38 #define trunc_page(x) ((void *)(((unsigned long)(x)) & ~((unsigned long)(PAGE_SIZE - 1))))
39 #define round_page(x) trunc_page(((unsigned long)(x)) + ((unsigned long)(PAGE_SIZE - 1)))
180 dbdma_st32(&dmap->control, in dbdma_continue()
188 dbdma_st32(&dmap->control, in dbdma_reset()
191 while (dbdma_ld32(&dmap->status) & RUN) in dbdma_reset()
200 out_le16(&cp->command, cmd); in dbdma_setcmd()
201 out_le16(&cp->req_count, count); in dbdma_setcmd()
202 out_le32(&cp->phy_addr, addr); in dbdma_setcmd()
203 out_le32(&cp->cmd_dep, cmd_dep); in dbdma_setcmd()
204 out_le16(&cp->xfer_status, 0); in dbdma_setcmd()
205 out_le16(&cp->res_count, 0); in dbdma_setcmd()
211 out_le16((void __iomem *)dev->base_addr + reg_offset, data); in bmwrite()
218 return in_le16((void __iomem *)dev->base_addr + reg_offset); in bmread()
225 volatile struct dbdma_regs __iomem *rd = bp->rx_dma; in bmac_enable_and_reset_chip()
226 volatile struct dbdma_regs __iomem *td = bp->tx_dma; in bmac_enable_and_reset_chip()
233 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, macio_get_of_node(bp->mdev), 0, 1); in bmac_enable_and_reset_chip()
243 while (--nb >= 0) { in bmac_mif_readbits()
263 while (--nb >= 0) { in bmac_mif_writebits()
320 --i; in bmac_init_registers()
325 if (!bp->is_bmac_plus) { in bmac_init_registers()
367 for (i=0; i<4; i++) bp->hash_table_mask[i] = 0; in bmac_init_registers()
368 bmwrite(dev, BHASH3, bp->hash_table_mask[0]); /* bits 15 - 0 */ in bmac_init_registers()
369 bmwrite(dev, BHASH2, bp->hash_table_mask[1]); /* bits 31 - 16 */ in bmac_init_registers()
370 bmwrite(dev, BHASH1, bp->hash_table_mask[2]); /* bits 47 - 32 */ in bmac_init_registers()
371 bmwrite(dev, BHASH0, bp->hash_table_mask[3]); /* bits 63 - 48 */ in bmac_init_registers()
373 pWord16 = (const unsigned short *)dev->dev_addr; in bmac_init_registers()
402 volatile struct dbdma_regs __iomem *rd = bp->rx_dma; in bmac_start_chip()
431 if (bp->is_bmac_plus) { in bmac_init_phy()
462 spin_lock_irqsave(&bp->lock, flags); in bmac_suspend()
463 if (bp->timeout_active) { in bmac_suspend()
464 del_timer(&bp->tx_timeout); in bmac_suspend()
465 bp->timeout_active = 0; in bmac_suspend()
467 disable_irq(dev->irq); in bmac_suspend()
468 disable_irq(bp->tx_dma_intr); in bmac_suspend()
469 disable_irq(bp->rx_dma_intr); in bmac_suspend()
470 bp->sleeping = 1; in bmac_suspend()
471 spin_unlock_irqrestore(&bp->lock, flags); in bmac_suspend()
472 if (bp->opened) { in bmac_suspend()
473 volatile struct dbdma_regs __iomem *rd = bp->rx_dma; in bmac_suspend()
474 volatile struct dbdma_regs __iomem *td = bp->tx_dma; in bmac_suspend()
482 rd->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ in bmac_suspend()
483 td->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ in bmac_suspend()
486 if (bp->rx_bufs[i] != NULL) { in bmac_suspend()
487 dev_kfree_skb(bp->rx_bufs[i]); in bmac_suspend()
488 bp->rx_bufs[i] = NULL; in bmac_suspend()
492 if (bp->tx_bufs[i] != NULL) { in bmac_suspend()
493 dev_kfree_skb(bp->tx_bufs[i]); in bmac_suspend()
494 bp->tx_bufs[i] = NULL; in bmac_suspend()
498 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, macio_get_of_node(bp->mdev), 0, 0); in bmac_suspend()
508 if (bp->opened) in bmac_resume()
511 enable_irq(dev->irq); in bmac_resume()
512 enable_irq(bp->tx_dma_intr); in bmac_resume()
513 enable_irq(bp->rx_dma_intr); in bmac_resume()
527 spin_lock_irqsave(&bp->lock, flags); in bmac_set_address()
532 pWord16 = (const unsigned short *)dev->dev_addr; in bmac_set_address()
537 spin_unlock_irqrestore(&bp->lock, flags); in bmac_set_address()
547 spin_lock_irqsave(&bp->lock, flags); in bmac_set_timeout()
548 if (bp->timeout_active) in bmac_set_timeout()
549 del_timer(&bp->tx_timeout); in bmac_set_timeout()
550 bp->tx_timeout.expires = jiffies + TX_TIMEOUT; in bmac_set_timeout()
551 add_timer(&bp->tx_timeout); in bmac_set_timeout()
552 bp->timeout_active = 1; in bmac_set_timeout()
553 spin_unlock_irqrestore(&bp->lock, flags); in bmac_set_timeout()
563 len = skb->len; in bmac_construct_xmt()
564 vaddr = skb->data; in bmac_construct_xmt()
573 unsigned char *addr = skb? skb->data: bmac_emergency_rxbuf; in bmac_construct_rxbuff()
582 volatile struct dbdma_regs __iomem *td = bp->tx_dma; in bmac_init_tx_ring()
584 memset((char *)bp->tx_cmds, 0, (N_TX_RING+1) * sizeof(struct dbdma_cmd)); in bmac_init_tx_ring()
586 bp->tx_empty = 0; in bmac_init_tx_ring()
587 bp->tx_fill = 0; in bmac_init_tx_ring()
588 bp->tx_fullup = 0; in bmac_init_tx_ring()
591 dbdma_setcmd(&bp->tx_cmds[N_TX_RING], in bmac_init_tx_ring()
592 (DBDMA_NOP | BR_ALWAYS), 0, 0, virt_to_bus(bp->tx_cmds)); in bmac_init_tx_ring()
596 out_le32(&td->wait_sel, 0x00200020); in bmac_init_tx_ring()
597 out_le32(&td->cmdptr, virt_to_bus(bp->tx_cmds)); in bmac_init_tx_ring()
604 volatile struct dbdma_regs __iomem *rd = bp->rx_dma; in bmac_init_rx_ring()
609 memset((char *)bp->rx_cmds, 0, in bmac_init_rx_ring()
612 if ((skb = bp->rx_bufs[i]) == NULL) { in bmac_init_rx_ring()
613 bp->rx_bufs[i] = skb = netdev_alloc_skb(dev, RX_BUFLEN + 2); in bmac_init_rx_ring()
617 bmac_construct_rxbuff(skb, &bp->rx_cmds[i]); in bmac_init_rx_ring()
620 bp->rx_empty = 0; in bmac_init_rx_ring()
621 bp->rx_fill = i; in bmac_init_rx_ring()
624 dbdma_setcmd(&bp->rx_cmds[N_RX_RING], in bmac_init_rx_ring()
625 (DBDMA_NOP | BR_ALWAYS), 0, 0, virt_to_bus(bp->rx_cmds)); in bmac_init_rx_ring()
629 out_le32(&rd->cmdptr, virt_to_bus(bp->rx_cmds)); in bmac_init_rx_ring()
638 volatile struct dbdma_regs __iomem *td = bp->tx_dma; in bmac_transmit_packet()
643 /* bp->tx_empty, bp->tx_fill)); */ in bmac_transmit_packet()
644 i = bp->tx_fill + 1; in bmac_transmit_packet()
647 if (i == bp->tx_empty) { in bmac_transmit_packet()
649 bp->tx_fullup = 1; in bmac_transmit_packet()
651 return -1; /* can't take it at the moment */ in bmac_transmit_packet()
654 dbdma_setcmd(&bp->tx_cmds[i], DBDMA_STOP, 0, 0, 0); in bmac_transmit_packet()
656 bmac_construct_xmt(skb, &bp->tx_cmds[bp->tx_fill]); in bmac_transmit_packet()
658 bp->tx_bufs[bp->tx_fill] = skb; in bmac_transmit_packet()
659 bp->tx_fill = i; in bmac_transmit_packet()
661 dev->stats.tx_bytes += skb->len; in bmac_transmit_packet()
674 volatile struct dbdma_regs __iomem *rd = bp->rx_dma; in bmac_rxdma_intr()
682 spin_lock_irqsave(&bp->lock, flags); in bmac_rxdma_intr()
688 last = -1; in bmac_rxdma_intr()
689 i = bp->rx_empty; in bmac_rxdma_intr()
692 cp = &bp->rx_cmds[i]; in bmac_rxdma_intr()
693 stat = le16_to_cpu(cp->xfer_status); in bmac_rxdma_intr()
694 residual = le16_to_cpu(cp->res_count); in bmac_rxdma_intr()
697 nb = RX_BUFLEN - residual - 2; in bmac_rxdma_intr()
698 if (nb < (ETHERMINPACKET - ETHERCRC)) { in bmac_rxdma_intr()
700 dev->stats.rx_length_errors++; in bmac_rxdma_intr()
701 dev->stats.rx_errors++; in bmac_rxdma_intr()
703 skb = bp->rx_bufs[i]; in bmac_rxdma_intr()
704 bp->rx_bufs[i] = NULL; in bmac_rxdma_intr()
707 nb -= ETHERCRC; in bmac_rxdma_intr()
709 skb->protocol = eth_type_trans(skb, dev); in bmac_rxdma_intr()
711 ++dev->stats.rx_packets; in bmac_rxdma_intr()
712 dev->stats.rx_bytes += nb; in bmac_rxdma_intr()
714 ++dev->stats.rx_dropped; in bmac_rxdma_intr()
716 if ((skb = bp->rx_bufs[i]) == NULL) { in bmac_rxdma_intr()
717 bp->rx_bufs[i] = skb = netdev_alloc_skb(dev, RX_BUFLEN + 2); in bmac_rxdma_intr()
719 skb_reserve(bp->rx_bufs[i], 2); in bmac_rxdma_intr()
721 bmac_construct_rxbuff(skb, &bp->rx_cmds[i]); in bmac_rxdma_intr()
722 cp->res_count = cpu_to_le16(0); in bmac_rxdma_intr()
723 cp->xfer_status = cpu_to_le16(0); in bmac_rxdma_intr()
728 if (last != -1) { in bmac_rxdma_intr()
729 bp->rx_fill = last; in bmac_rxdma_intr()
730 bp->rx_empty = i; in bmac_rxdma_intr()
734 spin_unlock_irqrestore(&bp->lock, flags); in bmac_rxdma_intr()
752 spin_lock_irqsave(&bp->lock, flags); in bmac_txdma_intr()
758 /* del_timer(&bp->tx_timeout); */ in bmac_txdma_intr()
759 /* bp->timeout_active = 0; */ in bmac_txdma_intr()
762 cp = &bp->tx_cmds[bp->tx_empty]; in bmac_txdma_intr()
763 stat = le16_to_cpu(cp->xfer_status); in bmac_txdma_intr()
771 if (cp == bus_to_virt(in_le32(&bp->tx_dma->cmdptr))) in bmac_txdma_intr()
775 if (bp->tx_bufs[bp->tx_empty]) { in bmac_txdma_intr()
776 ++dev->stats.tx_packets; in bmac_txdma_intr()
777 dev_consume_skb_irq(bp->tx_bufs[bp->tx_empty]); in bmac_txdma_intr()
779 bp->tx_bufs[bp->tx_empty] = NULL; in bmac_txdma_intr()
780 bp->tx_fullup = 0; in bmac_txdma_intr()
782 if (++bp->tx_empty >= N_TX_RING) in bmac_txdma_intr()
783 bp->tx_empty = 0; in bmac_txdma_intr()
784 if (bp->tx_empty == bp->tx_fill) in bmac_txdma_intr()
788 spin_unlock_irqrestore(&bp->lock, flags); in bmac_txdma_intr()
791 XXDEBUG(("bmac_txdma_intr done->bmac_start\n")); in bmac_txdma_intr()
799 /* Real fast bit-reversal algorithm, 6-bit values */
820 /* Compute bit-by-bit */ in crc416()
845 newcrc = crc416(0xffffffff, *address); /* address bits 47 - 32 */ in bmac_crc()
846 newcrc = crc416(newcrc, address[1]); /* address bits 31 - 16 */ in bmac_crc()
847 newcrc = crc416(newcrc, address[2]); /* address bits 15 - 0 */ in bmac_crc()
864 crc = bmac_crc((unsigned short *)addr) & 0x3f; /* Big-endian alert! */ in bmac_addhash()
865 crc = reverse6[crc]; /* Hyperfast bit-reversing algorithm */ in bmac_addhash()
866 if (bp->hash_use_count[crc]++) return; /* This bit is already set */ in bmac_addhash()
869 bp->hash_use_count[crc/16] |= mask; in bmac_addhash()
879 crc = bmac_crc((unsigned short *)addr) & 0x3f; /* Big-endian alert! */ in bmac_removehash()
880 crc = reverse6[crc]; /* Hyperfast bit-reversing algorithm */ in bmac_removehash()
881 if (bp->hash_use_count[crc] == 0) return; /* That bit wasn't in use! */ in bmac_removehash()
882 if (--bp->hash_use_count[crc]) return; /* That bit is still in use */ in bmac_removehash()
885 bp->hash_table_mask[crc/16] &= mask; in bmac_removehash()
927 bmwrite(dev, BHASH3, bp->hash_table_mask[0]); /* bits 15 - 0 */ in bmac_update_hash_table_mask()
928 bmwrite(dev, BHASH2, bp->hash_table_mask[1]); /* bits 31 - 16 */ in bmac_update_hash_table_mask()
929 bmwrite(dev, BHASH1, bp->hash_table_mask[2]); /* bits 47 - 32 */ in bmac_update_hash_table_mask()
930 bmwrite(dev, BHASH0, bp->hash_table_mask[3]); /* bits 63 - 48 */ in bmac_update_hash_table_mask()
942 bmac_rx_on(dev, 1, (dev->flags & IFF_PROMISC)? 1 : 0);
953 bmac_rx_on(dev, 1, (dev->flags & IFF_PROMISC)? 1 : 0);
958 num_addrs == -1 Promiscuous mode, receive all packets
959 num_addrs == 0 Normal mode, clear multicast list
960 num_addrs > 0 Multicast mode, receive normal and MC packets, and do
961 best-effort filtering.
971 if (bp->sleeping) in bmac_set_multicast()
976 if((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 64)) { in bmac_set_multicast()
977 for (i=0; i<4; i++) bp->hash_table_mask[i] = 0xffff; in bmac_set_multicast()
981 } else if ((dev->flags & IFF_PROMISC) || (num_addrs < 0)) { in bmac_set_multicast()
986 XXDEBUG(("bmac: promisc mode enabled, rx_cfg=%#08x\n", rx_cfg)); in bmac_set_multicast()
988 for (i=0; i<4; i++) bp->hash_table_mask[i] = 0; in bmac_set_multicast()
989 for (i=0; i<64; i++) bp->hash_use_count[i] = 0; in bmac_set_multicast()
995 bmac_addhash(bp, ha->addr); in bmac_set_multicast()
1013 if((dev->flags & IFF_ALLMULTI) || (netdev_mc_count(dev) > 64)) { in bmac_set_multicast()
1018 } else if(dev->flags & IFF_PROMISC) { in bmac_set_multicast()
1030 crc = ether_crc_le(6, ha->addr); in bmac_set_multicast()
1053 /* if (status & FrameReceived) dev->stats.rx_dropped++; */ in bmac_misc_intr()
1054 if (status & RxErrorMask) dev->stats.rx_errors++; in bmac_misc_intr()
1055 if (status & RxCRCCntExp) dev->stats.rx_crc_errors++; in bmac_misc_intr()
1056 if (status & RxLenCntExp) dev->stats.rx_length_errors++; in bmac_misc_intr()
1057 if (status & RxOverFlow) dev->stats.rx_over_errors++; in bmac_misc_intr()
1058 if (status & RxAlignCntExp) dev->stats.rx_frame_errors++; in bmac_misc_intr()
1060 /* if (status & FrameSent) dev->stats.tx_dropped++; */ in bmac_misc_intr()
1061 if (status & TxErrorMask) dev->stats.tx_errors++; in bmac_misc_intr()
1062 if (status & TxUnderrun) dev->stats.tx_fifo_errors++; in bmac_misc_intr()
1063 if (status & TxNormalCollExp) dev->stats.collisions++; in bmac_misc_intr()
1079 #define SROMReadCount 3 /* number of words to read from SROM */
1141 val = addr >> (addr_len-i-1); in read_srom()
1145 /* Now read in the 16-bit data */ in read_srom()
1197 spin_lock_irqsave(&bp->lock, flags); in bmac_reset_and_enable()
1204 bp->sleeping = 0; in bmac_reset_and_enable()
1213 memcpy(data, dev->dev_addr, ETH_ALEN); in bmac_reset_and_enable()
1214 memcpy(data + ETH_ALEN, dev->dev_addr, ETH_ALEN); in bmac_reset_and_enable()
1217 spin_unlock_irqrestore(&bp->lock, flags); in bmac_reset_and_enable()
1241 int is_bmac_plus = ((int)match->data) != 0; in bmac_probe()
1245 return -ENODEV; in bmac_probe()
1248 "mac-address", NULL); in bmac_probe()
1251 "local-mac-address", NULL); in bmac_probe()
1253 printk(KERN_ERR "BMAC: Can't get mac-address\n"); in bmac_probe()
1254 return -ENODEV; in bmac_probe()
1261 return -ENOMEM; in bmac_probe()
1264 SET_NETDEV_DEV(dev, &mdev->ofdev.dev); in bmac_probe()
1267 bp->mdev = mdev; in bmac_probe()
1268 spin_lock_init(&bp->lock); in bmac_probe()
1275 dev->base_addr = (unsigned long) in bmac_probe()
1277 if (dev->base_addr == 0) in bmac_probe()
1280 dev->irq = macio_irq(mdev, 0); in bmac_probe()
1295 dev->netdev_ops = &bmac_netdev_ops; in bmac_probe()
1296 dev->ethtool_ops = &bmac_ethtool_ops; in bmac_probe()
1302 bp->is_bmac_plus = is_bmac_plus; in bmac_probe()
1303 bp->tx_dma = ioremap(macio_resource_start(mdev, 1), macio_resource_len(mdev, 1)); in bmac_probe()
1304 if (!bp->tx_dma) in bmac_probe()
1306 bp->tx_dma_intr = macio_irq(mdev, 1); in bmac_probe()
1307 bp->rx_dma = ioremap(macio_resource_start(mdev, 2), macio_resource_len(mdev, 2)); in bmac_probe()
1308 if (!bp->rx_dma) in bmac_probe()
1310 bp->rx_dma_intr = macio_irq(mdev, 2); in bmac_probe()
1312 bp->tx_cmds = (volatile struct dbdma_cmd *) DBDMA_ALIGN(bp + 1); in bmac_probe()
1313 bp->rx_cmds = bp->tx_cmds + N_TX_RING + 1; in bmac_probe()
1315 bp->queue = (struct sk_buff_head *)(bp->rx_cmds + N_RX_RING + 1); in bmac_probe()
1316 skb_queue_head_init(bp->queue); in bmac_probe()
1318 timer_setup(&bp->tx_timeout, bmac_tx_timeout, 0); in bmac_probe()
1320 ret = request_irq(dev->irq, bmac_misc_intr, 0, "BMAC-misc", dev); in bmac_probe()
1322 printk(KERN_ERR "BMAC: can't get irq %d\n", dev->irq); in bmac_probe()
1325 ret = request_irq(bp->tx_dma_intr, bmac_txdma_intr, 0, "BMAC-txdma", dev); in bmac_probe()
1327 printk(KERN_ERR "BMAC: can't get irq %d\n", bp->tx_dma_intr); in bmac_probe()
1330 ret = request_irq(bp->rx_dma_intr, bmac_rxdma_intr, 0, "BMAC-rxdma", dev); in bmac_probe()
1332 printk(KERN_ERR "BMAC: can't get irq %d\n", bp->rx_dma_intr); in bmac_probe()
1337 * re-enabled on open() in bmac_probe()
1339 disable_irq(dev->irq); in bmac_probe()
1340 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, macio_get_of_node(bp->mdev), 0, 0); in bmac_probe()
1348 dev->name, (is_bmac_plus ? "+" : ""), dev->dev_addr); in bmac_probe()
1349 XXDEBUG((", base_addr=%#0lx", dev->base_addr)); in bmac_probe()
1355 free_irq(bp->rx_dma_intr, dev); in bmac_probe()
1357 free_irq(bp->tx_dma_intr, dev); in bmac_probe()
1359 free_irq(dev->irq, dev); in bmac_probe()
1361 iounmap(bp->rx_dma); in bmac_probe()
1363 iounmap(bp->tx_dma); in bmac_probe()
1365 iounmap((void __iomem *)dev->base_addr); in bmac_probe()
1369 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, macio_get_of_node(bp->mdev), 0, 0); in bmac_probe()
1372 return -ENODEV; in bmac_probe()
1380 bp->opened = 1; in bmac_open()
1382 enable_irq(dev->irq); in bmac_open()
1389 volatile struct dbdma_regs __iomem *rd = bp->rx_dma; in bmac_close()
1390 volatile struct dbdma_regs __iomem *td = bp->tx_dma; in bmac_close()
1394 bp->sleeping = 1; in bmac_close()
1406 rd->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ in bmac_close()
1407 td->control = cpu_to_le32(DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE)); /* clear run bit */ in bmac_close()
1412 if (bp->rx_bufs[i] != NULL) { in bmac_close()
1413 dev_kfree_skb(bp->rx_bufs[i]); in bmac_close()
1414 bp->rx_bufs[i] = NULL; in bmac_close()
1419 if (bp->tx_bufs[i] != NULL) { in bmac_close()
1420 dev_kfree_skb(bp->tx_bufs[i]); in bmac_close()
1421 bp->tx_bufs[i] = NULL; in bmac_close()
1426 bp->opened = 0; in bmac_close()
1427 disable_irq(dev->irq); in bmac_close()
1428 pmac_call_feature(PMAC_FTR_BMAC_ENABLE, macio_get_of_node(bp->mdev), 0, 0); in bmac_close()
1441 if (bp->sleeping) in bmac_start()
1444 spin_lock_irqsave(&bp->lock, flags); in bmac_start()
1446 i = bp->tx_fill + 1; in bmac_start()
1449 if (i == bp->tx_empty) in bmac_start()
1451 skb = skb_dequeue(bp->queue); in bmac_start()
1456 spin_unlock_irqrestore(&bp->lock, flags); in bmac_start()
1463 skb_queue_tail(bp->queue, skb); in bmac_output()
1471 struct net_device *dev = macio_get_drvdata(bp->mdev); in bmac_tx_timeout()
1472 volatile struct dbdma_regs __iomem *td = bp->tx_dma; in bmac_tx_timeout()
1473 volatile struct dbdma_regs __iomem *rd = bp->rx_dma; in bmac_tx_timeout()
1480 spin_lock_irqsave(&bp->lock, flags); in bmac_tx_timeout()
1481 bp->timeout_active = 0; in bmac_tx_timeout()
1486 cp = &bp->tx_cmds[bp->tx_empty]; in bmac_tx_timeout()
1488 /* le32_to_cpu(td->status), le16_to_cpu(cp->xfer_status), bp->tx_bad_runt, */ in bmac_tx_timeout()
1489 /* mb->pr, mb->xmtfs, mb->fifofc)); */ in bmac_tx_timeout()
1496 out_le32(&td->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE|ACTIVE|DEAD)); in bmac_tx_timeout()
1497 printk(KERN_ERR "bmac: transmit timeout - resetting\n"); in bmac_tx_timeout()
1501 cp = bus_to_virt(le32_to_cpu(rd->cmdptr)); in bmac_tx_timeout()
1502 out_le32(&rd->control, DBDMA_CLEAR(RUN|PAUSE|FLUSH|WAKE|ACTIVE|DEAD)); in bmac_tx_timeout()
1503 out_le16(&cp->xfer_status, 0); in bmac_tx_timeout()
1504 out_le32(&rd->cmdptr, virt_to_bus(cp)); in bmac_tx_timeout()
1505 out_le32(&rd->control, DBDMA_SET(RUN|WAKE)); in bmac_tx_timeout()
1509 bp->tx_empty, bp->tx_fill, bp->tx_fullup)); in bmac_tx_timeout()
1510 i = bp->tx_empty; in bmac_tx_timeout()
1511 ++dev->stats.tx_errors; in bmac_tx_timeout()
1512 if (i != bp->tx_fill) { in bmac_tx_timeout()
1513 dev_kfree_skb_irq(bp->tx_bufs[i]); in bmac_tx_timeout()
1514 bp->tx_bufs[i] = NULL; in bmac_tx_timeout()
1516 bp->tx_empty = i; in bmac_tx_timeout()
1518 bp->tx_fullup = 0; in bmac_tx_timeout()
1520 if (i != bp->tx_fill) { in bmac_tx_timeout()
1521 cp = &bp->tx_cmds[i]; in bmac_tx_timeout()
1522 out_le16(&cp->xfer_status, 0); in bmac_tx_timeout()
1523 out_le16(&cp->command, OUTPUT_LAST); in bmac_tx_timeout()
1524 out_le32(&td->cmdptr, virt_to_bus(cp)); in bmac_tx_timeout()
1525 out_le32(&td->control, DBDMA_SET(RUN)); in bmac_tx_timeout()
1536 spin_unlock_irqrestore(&bp->lock, flags); in bmac_tx_timeout()
1567 return -ENOSYS;
1585 *start = buffer + (offset - begin);
1586 len -= (offset - begin);
1601 free_irq(dev->irq, dev); in bmac_remove()
1602 free_irq(bp->tx_dma_intr, dev); in bmac_remove()
1603 free_irq(bp->rx_dma_intr, dev); in bmac_remove()
1605 iounmap((void __iomem *)dev->base_addr); in bmac_remove()
1606 iounmap(bp->tx_dma); in bmac_remove()
1607 iounmap(bp->rx_dma); in bmac_remove()
1652 return -ENOMEM; in bmac_init()