• Home
  • Raw
  • Download

Lines Matching refs:de

335 static void de_tx (struct de_private *de);
336 static void de_clean_rings (struct de_private *de);
337 static void de_media_interrupt (struct de_private *de, u32 status);
340 static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media);
374 #define dr32(reg) ioread32(de->regs + (reg))
375 #define dw32(reg, val) iowrite32((val), de->regs + (reg))
378 static void de_rx_err_acct (struct de_private *de, unsigned rx_tail, in de_rx_err_acct() argument
381 netif_dbg(de, rx_err, de->dev, in de_rx_err_acct()
388 netif_warn(de, rx_err, de->dev, in de_rx_err_acct()
391 de->net_stats.rx_length_errors++; in de_rx_err_acct()
395 de->net_stats.rx_errors++; /* end of a packet.*/ in de_rx_err_acct()
396 if (status & 0x0890) de->net_stats.rx_length_errors++; in de_rx_err_acct()
397 if (status & RxErrCRC) de->net_stats.rx_crc_errors++; in de_rx_err_acct()
398 if (status & RxErrFIFO) de->net_stats.rx_fifo_errors++; in de_rx_err_acct()
402 static void de_rx (struct de_private *de) in de_rx() argument
404 unsigned rx_tail = de->rx_tail; in de_rx()
415 skb = de->rx_skb[rx_tail].skb; in de_rx()
418 status = le32_to_cpu(de->rx_ring[rx_tail].opts1); in de_rx()
423 mapping = de->rx_skb[rx_tail].mapping; in de_rx()
426 de->net_stats.rx_dropped++; in de_rx()
431 de_rx_err_acct(de, rx_tail, status, len); in de_rx()
437 netif_dbg(de, rx_status, de->dev, in de_rx()
441 buflen = copying_skb ? (len + RX_OFFSET) : de->rx_buf_sz; in de_rx()
442 copy_skb = netdev_alloc_skb(de->dev, buflen); in de_rx()
444 de->net_stats.rx_dropped++; in de_rx()
451 pci_unmap_single(de->pdev, mapping, in de_rx()
456 de->rx_skb[rx_tail].mapping = in de_rx()
457 pci_map_single(de->pdev, copy_skb->data, in de_rx()
459 de->rx_skb[rx_tail].skb = copy_skb; in de_rx()
461 pci_dma_sync_single_for_cpu(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); in de_rx()
465 pci_dma_sync_single_for_device(de->pdev, mapping, len, PCI_DMA_FROMDEVICE); in de_rx()
471 skb->protocol = eth_type_trans (skb, de->dev); in de_rx()
473 de->net_stats.rx_packets++; in de_rx()
474 de->net_stats.rx_bytes += skb->len; in de_rx()
481 de->rx_ring[rx_tail].opts2 = in de_rx()
482 cpu_to_le32(RingEnd | de->rx_buf_sz); in de_rx()
484 de->rx_ring[rx_tail].opts2 = cpu_to_le32(de->rx_buf_sz); in de_rx()
485 de->rx_ring[rx_tail].addr1 = cpu_to_le32(mapping); in de_rx()
487 de->rx_ring[rx_tail].opts1 = cpu_to_le32(DescOwn); in de_rx()
492 netdev_warn(de->dev, "rx work limit reached\n"); in de_rx()
494 de->rx_tail = rx_tail; in de_rx()
500 struct de_private *de = netdev_priv(dev); in de_interrupt() local
507 netif_dbg(de, intr, dev, "intr, status %08x mode %08x desc %u/%u/%u\n", in de_interrupt()
509 de->rx_tail, de->tx_head, de->tx_tail); in de_interrupt()
514 de_rx(de); in de_interrupt()
519 spin_lock(&de->lock); in de_interrupt()
522 de_tx(de); in de_interrupt()
525 de_media_interrupt(de, status); in de_interrupt()
527 spin_unlock(&de->lock); in de_interrupt()
532 pci_read_config_word(de->pdev, PCI_STATUS, &pci_status); in de_interrupt()
533 pci_write_config_word(de->pdev, PCI_STATUS, pci_status); in de_interrupt()
534 netdev_err(de->dev, in de_interrupt()
542 static void de_tx (struct de_private *de) in de_tx() argument
544 unsigned tx_head = de->tx_head; in de_tx()
545 unsigned tx_tail = de->tx_tail; in de_tx()
552 status = le32_to_cpu(de->tx_ring[tx_tail].opts1); in de_tx()
556 skb = de->tx_skb[tx_tail].skb; in de_tx()
562 pci_unmap_single(de->pdev, de->tx_skb[tx_tail].mapping, in de_tx()
563 sizeof(de->setup_frame), PCI_DMA_TODEVICE); in de_tx()
567 pci_unmap_single(de->pdev, de->tx_skb[tx_tail].mapping, in de_tx()
572 netif_dbg(de, tx_err, de->dev, in de_tx()
575 de->net_stats.tx_errors++; in de_tx()
577 de->net_stats.tx_window_errors++; in de_tx()
579 de->net_stats.tx_aborted_errors++; in de_tx()
581 de->net_stats.tx_carrier_errors++; in de_tx()
583 de->net_stats.tx_fifo_errors++; in de_tx()
585 de->net_stats.tx_packets++; in de_tx()
586 de->net_stats.tx_bytes += skb->len; in de_tx()
587 netif_dbg(de, tx_done, de->dev, in de_tx()
594 de->tx_skb[tx_tail].skb = NULL; in de_tx()
599 de->tx_tail = tx_tail; in de_tx()
601 if (netif_queue_stopped(de->dev) && (TX_BUFFS_AVAIL(de) > (DE_TX_RING_SIZE / 4))) in de_tx()
602 netif_wake_queue(de->dev); in de_tx()
608 struct de_private *de = netdev_priv(dev); in de_start_xmit() local
613 spin_lock_irq(&de->lock); in de_start_xmit()
615 tx_free = TX_BUFFS_AVAIL(de); in de_start_xmit()
618 spin_unlock_irq(&de->lock); in de_start_xmit()
623 entry = de->tx_head; in de_start_xmit()
625 txd = &de->tx_ring[entry]; in de_start_xmit()
628 mapping = pci_map_single(de->pdev, skb->data, len, PCI_DMA_TODEVICE); in de_start_xmit()
637 de->tx_skb[entry].skb = skb; in de_start_xmit()
638 de->tx_skb[entry].mapping = mapping; in de_start_xmit()
644 de->tx_head = NEXT_TX(entry); in de_start_xmit()
645 netif_dbg(de, tx_queued, dev, "tx queued, slot %d, skblen %d\n", in de_start_xmit()
651 spin_unlock_irq(&de->lock); in de_start_xmit()
666 struct de_private *de = netdev_priv(dev); in build_setup_frame_hash() local
685 setup_frm = &de->setup_frame[13*6]; in build_setup_frame_hash()
696 struct de_private *de = netdev_priv(dev); in build_setup_frame_perfect() local
710 setup_frm = &de->setup_frame[15*6]; in build_setup_frame_perfect()
722 struct de_private *de = netdev_priv(dev); in __de_set_rx_mode() local
745 build_setup_frame_hash (de->setup_frame, dev); in __de_set_rx_mode()
747 build_setup_frame_perfect (de->setup_frame, dev); in __de_set_rx_mode()
753 entry = de->tx_head; in __de_set_rx_mode()
757 de->tx_skb[entry].skb = DE_DUMMY_SKB; in __de_set_rx_mode()
759 dummy_txd = &de->tx_ring[entry]; in __de_set_rx_mode()
769 de->tx_skb[entry].skb = DE_SETUP_SKB; in __de_set_rx_mode()
770 de->tx_skb[entry].mapping = mapping = in __de_set_rx_mode()
771 pci_map_single (de->pdev, de->setup_frame, in __de_set_rx_mode()
772 sizeof (de->setup_frame), PCI_DMA_TODEVICE); in __de_set_rx_mode()
775 txd = &de->tx_ring[entry]; in __de_set_rx_mode()
777 txd->opts2 = cpu_to_le32(SetupFrame | RingEnd | sizeof (de->setup_frame)); in __de_set_rx_mode()
779 txd->opts2 = cpu_to_le32(SetupFrame | sizeof (de->setup_frame)); in __de_set_rx_mode()
791 de->tx_head = NEXT_TX(entry); in __de_set_rx_mode()
793 if (TX_BUFFS_AVAIL(de) == 0) in __de_set_rx_mode()
807 struct de_private *de = netdev_priv(dev); in de_set_rx_mode() local
809 spin_lock_irqsave (&de->lock, flags); in de_set_rx_mode()
811 spin_unlock_irqrestore (&de->lock, flags); in de_set_rx_mode()
814 static inline void de_rx_missed(struct de_private *de, u32 rx_missed) in de_rx_missed() argument
817 de->net_stats.rx_missed_errors += RxMissedMask; in de_rx_missed()
819 de->net_stats.rx_missed_errors += (rx_missed & RxMissedMask); in de_rx_missed()
822 static void __de_get_stats(struct de_private *de) in __de_get_stats() argument
826 de_rx_missed(de, tmp); in __de_get_stats()
831 struct de_private *de = netdev_priv(dev); in de_get_stats() local
834 spin_lock_irq(&de->lock); in de_get_stats()
836 __de_get_stats(de); in de_get_stats()
837 spin_unlock_irq(&de->lock); in de_get_stats()
839 return &de->net_stats; in de_get_stats()
842 static inline int de_is_running (struct de_private *de) in de_is_running() argument
847 static void de_stop_rxtx (struct de_private *de) in de_stop_rxtx() argument
863 if (!de_is_running(de)) in de_stop_rxtx()
868 netdev_warn(de->dev, "timeout expired, stopping DMA\n"); in de_stop_rxtx()
871 static inline void de_start_rxtx (struct de_private *de) in de_start_rxtx() argument
882 static void de_stop_hw (struct de_private *de) in de_stop_hw() argument
888 de_stop_rxtx(de); in de_stop_hw()
894 de->rx_tail = 0; in de_stop_hw()
895 de->tx_head = de->tx_tail = 0; in de_stop_hw()
898 static void de_link_up(struct de_private *de) in de_link_up() argument
900 if (!netif_carrier_ok(de->dev)) { in de_link_up()
901 netif_carrier_on(de->dev); in de_link_up()
902 netif_info(de, link, de->dev, "link up, media %s\n", in de_link_up()
903 media_name[de->media_type]); in de_link_up()
907 static void de_link_down(struct de_private *de) in de_link_down() argument
909 if (netif_carrier_ok(de->dev)) { in de_link_down()
910 netif_carrier_off(de->dev); in de_link_down()
911 netif_info(de, link, de->dev, "link down\n"); in de_link_down()
915 static void de_set_media (struct de_private *de) in de_set_media() argument
917 unsigned media = de->media_type; in de_set_media()
920 if (de_is_running(de)) in de_set_media()
921 netdev_warn(de->dev, "chip is running while changing media!\n"); in de_set_media()
923 if (de->de21040) in de_set_media()
926 dw32(CSR14, de->media[media].csr14); in de_set_media()
927 dw32(CSR15, de->media[media].csr15); in de_set_media()
928 dw32(CSR13, de->media[media].csr13); in de_set_media()
940 netif_info(de, link, de->dev, "set link %s\n", media_name[media]); in de_set_media()
941 netif_info(de, hw, de->dev, "mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n", in de_set_media()
944 netif_info(de, hw, de->dev, "set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", in de_set_media()
945 macmode, de->media[media].csr13, in de_set_media()
946 de->media[media].csr14, de->media[media].csr15); in de_set_media()
951 static void de_next_media (struct de_private *de, const u32 *media, in de_next_media() argument
957 if (de_ok_to_advertise(de, media[i])) { in de_next_media()
958 de->media_type = media[i]; in de_next_media()
966 struct de_private *de = (struct de_private *) data; in de21040_media_timer() local
967 struct net_device *dev = de->dev; in de21040_media_timer()
975 if (de->media_type != DE_MEDIA_AUI && (status & LinkFailStatus)) in de21040_media_timer()
978 de->media_timer.expires = jiffies + DE_TIMER_LINK; in de21040_media_timer()
979 add_timer(&de->media_timer); in de21040_media_timer()
981 de_link_up(de); in de21040_media_timer()
983 netif_info(de, timer, dev, "%s link ok, status %x\n", in de21040_media_timer()
984 media_name[de->media_type], status); in de21040_media_timer()
988 de_link_down(de); in de21040_media_timer()
990 if (de->media_lock) in de21040_media_timer()
993 if (de->media_type == DE_MEDIA_AUI) { in de21040_media_timer()
995 de_next_media(de, &next_state, 1); in de21040_media_timer()
998 de_next_media(de, &next_state, 1); in de21040_media_timer()
1001 spin_lock_irqsave(&de->lock, flags); in de21040_media_timer()
1002 de_stop_rxtx(de); in de21040_media_timer()
1003 spin_unlock_irqrestore(&de->lock, flags); in de21040_media_timer()
1004 de_set_media(de); in de21040_media_timer()
1005 de_start_rxtx(de); in de21040_media_timer()
1008 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; in de21040_media_timer()
1009 add_timer(&de->media_timer); in de21040_media_timer()
1011 netif_info(de, timer, dev, "no link, trying media %s, status %x\n", in de21040_media_timer()
1012 media_name[de->media_type], status); in de21040_media_timer()
1015 static unsigned int de_ok_to_advertise (struct de_private *de, u32 new_media) in de_ok_to_advertise() argument
1019 if (!(de->media_advertise & ADVERTISED_Autoneg)) in de_ok_to_advertise()
1021 if (!(de->media_advertise & (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full))) in de_ok_to_advertise()
1025 if (!(de->media_advertise & ADVERTISED_BNC)) in de_ok_to_advertise()
1029 if (!(de->media_advertise & ADVERTISED_AUI)) in de_ok_to_advertise()
1033 if (!(de->media_advertise & ADVERTISED_10baseT_Half)) in de_ok_to_advertise()
1037 if (!(de->media_advertise & ADVERTISED_10baseT_Full)) in de_ok_to_advertise()
1047 struct de_private *de = (struct de_private *) data; in de21041_media_timer() local
1048 struct net_device *dev = de->dev; in de21041_media_timer()
1059 if ((de->media_type == DE_MEDIA_TP_AUTO || in de21041_media_timer()
1060 de->media_type == DE_MEDIA_TP || in de21041_media_timer()
1061 de->media_type == DE_MEDIA_TP_FD) && in de21041_media_timer()
1065 de->media_timer.expires = jiffies + DE_TIMER_LINK; in de21041_media_timer()
1066 add_timer(&de->media_timer); in de21041_media_timer()
1068 de_link_up(de); in de21041_media_timer()
1070 netif_info(de, timer, dev, in de21041_media_timer()
1072 media_name[de->media_type], in de21041_media_timer()
1077 de_link_down(de); in de21041_media_timer()
1080 if (de->media_lock) in de21041_media_timer()
1088 if (de->media_type == DE_MEDIA_AUI || in de21041_media_timer()
1089 de->media_type == DE_MEDIA_BNC) { in de21041_media_timer()
1090 if (de_ok_to_advertise(de, DE_MEDIA_TP_AUTO)) in de21041_media_timer()
1091 de->media_type = DE_MEDIA_TP_AUTO; in de21041_media_timer()
1097 else if (((de->media_supported & DE_AUI_BNC) == SUPPORTED_BNC) && in de21041_media_timer()
1098 de_ok_to_advertise(de, DE_MEDIA_BNC)) in de21041_media_timer()
1099 de->media_type = DE_MEDIA_BNC; in de21041_media_timer()
1102 else if (((de->media_supported & DE_AUI_BNC) == SUPPORTED_AUI) && in de21041_media_timer()
1103 de_ok_to_advertise(de, DE_MEDIA_AUI)) in de21041_media_timer()
1104 de->media_type = DE_MEDIA_AUI; in de21041_media_timer()
1119 if (de->media_type == DE_MEDIA_AUI) { in de21041_media_timer()
1123 de_next_media(de, next_states, ARRAY_SIZE(next_states)); in de21041_media_timer()
1124 } else if (de->media_type == DE_MEDIA_BNC) { in de21041_media_timer()
1128 de_next_media(de, next_states, ARRAY_SIZE(next_states)); in de21041_media_timer()
1133 de_next_media(de, next_states, ARRAY_SIZE(next_states)); in de21041_media_timer()
1137 spin_lock_irqsave(&de->lock, flags); in de21041_media_timer()
1138 de_stop_rxtx(de); in de21041_media_timer()
1139 spin_unlock_irqrestore(&de->lock, flags); in de21041_media_timer()
1140 de_set_media(de); in de21041_media_timer()
1141 de_start_rxtx(de); in de21041_media_timer()
1144 de->media_timer.expires = jiffies + DE_TIMER_NO_LINK; in de21041_media_timer()
1145 add_timer(&de->media_timer); in de21041_media_timer()
1147 netif_info(de, timer, dev, "no link, trying media %s, status %x\n", in de21041_media_timer()
1148 media_name[de->media_type], status); in de21041_media_timer()
1151 static void de_media_interrupt (struct de_private *de, u32 status) in de_media_interrupt() argument
1155 if ((de->media_type == DE_MEDIA_AUI || in de_media_interrupt()
1156 de->media_type == DE_MEDIA_BNC) && in de_media_interrupt()
1157 (de->media_lock || in de_media_interrupt()
1158 !de_ok_to_advertise(de, DE_MEDIA_TP_AUTO))) in de_media_interrupt()
1161 if ((de->media_type == DE_MEDIA_AUI || in de_media_interrupt()
1162 de->media_type == DE_MEDIA_BNC)) { in de_media_interrupt()
1163 de->media_type = DE_MEDIA_TP_AUTO; in de_media_interrupt()
1164 de_stop_rxtx(de); in de_media_interrupt()
1165 de_set_media(de); in de_media_interrupt()
1166 de_start_rxtx(de); in de_media_interrupt()
1168 de_link_up(de); in de_media_interrupt()
1169 mod_timer(&de->media_timer, jiffies + DE_TIMER_LINK); in de_media_interrupt()
1175 if (netif_carrier_ok(de->dev) && de->media_type != DE_MEDIA_AUI && in de_media_interrupt()
1176 de->media_type != DE_MEDIA_BNC) { in de_media_interrupt()
1177 de_link_down(de); in de_media_interrupt()
1178 mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK); in de_media_interrupt()
1182 static int de_reset_mac (struct de_private *de) in de_reset_mac() argument
1216 static void de_adapter_wake (struct de_private *de) in de_adapter_wake() argument
1220 if (de->de21040) in de_adapter_wake()
1223 pci_read_config_dword(de->pdev, PCIPM, &pmctl); in de_adapter_wake()
1226 pci_write_config_dword(de->pdev, PCIPM, pmctl); in de_adapter_wake()
1233 static void de_adapter_sleep (struct de_private *de) in de_adapter_sleep() argument
1237 if (de->de21040) in de_adapter_sleep()
1241 pci_read_config_dword(de->pdev, PCIPM, &pmctl); in de_adapter_sleep()
1243 pci_write_config_dword(de->pdev, PCIPM, pmctl); in de_adapter_sleep()
1246 static int de_init_hw (struct de_private *de) in de_init_hw() argument
1248 struct net_device *dev = de->dev; in de_init_hw()
1252 de_adapter_wake(de); in de_init_hw()
1256 rc = de_reset_mac(de); in de_init_hw()
1260 de_set_media(de); /* reset phy */ in de_init_hw()
1262 dw32(RxRingAddr, de->ring_dma); in de_init_hw()
1263 dw32(TxRingAddr, de->ring_dma + (sizeof(struct de_desc) * DE_RX_RING_SIZE)); in de_init_hw()
1276 static int de_refill_rx (struct de_private *de) in de_refill_rx() argument
1283 skb = netdev_alloc_skb(de->dev, de->rx_buf_sz); in de_refill_rx()
1287 de->rx_skb[i].mapping = pci_map_single(de->pdev, in de_refill_rx()
1288 skb->data, de->rx_buf_sz, PCI_DMA_FROMDEVICE); in de_refill_rx()
1289 de->rx_skb[i].skb = skb; in de_refill_rx()
1291 de->rx_ring[i].opts1 = cpu_to_le32(DescOwn); in de_refill_rx()
1293 de->rx_ring[i].opts2 = in de_refill_rx()
1294 cpu_to_le32(RingEnd | de->rx_buf_sz); in de_refill_rx()
1296 de->rx_ring[i].opts2 = cpu_to_le32(de->rx_buf_sz); in de_refill_rx()
1297 de->rx_ring[i].addr1 = cpu_to_le32(de->rx_skb[i].mapping); in de_refill_rx()
1298 de->rx_ring[i].addr2 = 0; in de_refill_rx()
1304 de_clean_rings(de); in de_refill_rx()
1308 static int de_init_rings (struct de_private *de) in de_init_rings() argument
1310 memset(de->tx_ring, 0, sizeof(struct de_desc) * DE_TX_RING_SIZE); in de_init_rings()
1311 de->tx_ring[DE_TX_RING_SIZE - 1].opts2 = cpu_to_le32(RingEnd); in de_init_rings()
1313 de->rx_tail = 0; in de_init_rings()
1314 de->tx_head = de->tx_tail = 0; in de_init_rings()
1316 return de_refill_rx (de); in de_init_rings()
1319 static int de_alloc_rings (struct de_private *de) in de_alloc_rings() argument
1321 de->rx_ring = pci_alloc_consistent(de->pdev, DE_RING_BYTES, &de->ring_dma); in de_alloc_rings()
1322 if (!de->rx_ring) in de_alloc_rings()
1324 de->tx_ring = &de->rx_ring[DE_RX_RING_SIZE]; in de_alloc_rings()
1325 return de_init_rings(de); in de_alloc_rings()
1328 static void de_clean_rings (struct de_private *de) in de_clean_rings() argument
1332 memset(de->rx_ring, 0, sizeof(struct de_desc) * DE_RX_RING_SIZE); in de_clean_rings()
1333 de->rx_ring[DE_RX_RING_SIZE - 1].opts2 = cpu_to_le32(RingEnd); in de_clean_rings()
1335 memset(de->tx_ring, 0, sizeof(struct de_desc) * DE_TX_RING_SIZE); in de_clean_rings()
1336 de->tx_ring[DE_TX_RING_SIZE - 1].opts2 = cpu_to_le32(RingEnd); in de_clean_rings()
1340 if (de->rx_skb[i].skb) { in de_clean_rings()
1341 pci_unmap_single(de->pdev, de->rx_skb[i].mapping, in de_clean_rings()
1342 de->rx_buf_sz, PCI_DMA_FROMDEVICE); in de_clean_rings()
1343 dev_kfree_skb(de->rx_skb[i].skb); in de_clean_rings()
1348 struct sk_buff *skb = de->tx_skb[i].skb; in de_clean_rings()
1351 de->net_stats.tx_dropped++; in de_clean_rings()
1352 pci_unmap_single(de->pdev, in de_clean_rings()
1353 de->tx_skb[i].mapping, in de_clean_rings()
1357 pci_unmap_single(de->pdev, in de_clean_rings()
1358 de->tx_skb[i].mapping, in de_clean_rings()
1359 sizeof(de->setup_frame), in de_clean_rings()
1365 memset(&de->rx_skb, 0, sizeof(struct ring_info) * DE_RX_RING_SIZE); in de_clean_rings()
1366 memset(&de->tx_skb, 0, sizeof(struct ring_info) * DE_TX_RING_SIZE); in de_clean_rings()
1369 static void de_free_rings (struct de_private *de) in de_free_rings() argument
1371 de_clean_rings(de); in de_free_rings()
1372 pci_free_consistent(de->pdev, DE_RING_BYTES, de->rx_ring, de->ring_dma); in de_free_rings()
1373 de->rx_ring = NULL; in de_free_rings()
1374 de->tx_ring = NULL; in de_free_rings()
1379 struct de_private *de = netdev_priv(dev); in de_open() local
1380 const int irq = de->pdev->irq; in de_open()
1383 netif_dbg(de, ifup, dev, "enabling interface\n"); in de_open()
1385 de->rx_buf_sz = (dev->mtu <= 1500 ? PKT_BUF_SZ : dev->mtu + 32); in de_open()
1387 rc = de_alloc_rings(de); in de_open()
1401 rc = de_init_hw(de); in de_open()
1408 mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK); in de_open()
1415 de_free_rings(de); in de_open()
1421 struct de_private *de = netdev_priv(dev); in de_close() local
1424 netif_dbg(de, ifdown, dev, "disabling interface\n"); in de_close()
1426 del_timer_sync(&de->media_timer); in de_close()
1428 spin_lock_irqsave(&de->lock, flags); in de_close()
1429 de_stop_hw(de); in de_close()
1432 spin_unlock_irqrestore(&de->lock, flags); in de_close()
1434 free_irq(de->pdev->irq, dev); in de_close()
1436 de_free_rings(de); in de_close()
1437 de_adapter_sleep(de); in de_close()
1443 struct de_private *de = netdev_priv(dev); in de_tx_timeout() local
1444 const int irq = de->pdev->irq; in de_tx_timeout()
1448 de->rx_tail, de->tx_head, de->tx_tail); in de_tx_timeout()
1450 del_timer_sync(&de->media_timer); in de_tx_timeout()
1453 spin_lock_irq(&de->lock); in de_tx_timeout()
1455 de_stop_hw(de); in de_tx_timeout()
1459 spin_unlock_irq(&de->lock); in de_tx_timeout()
1463 __de_get_stats(de); in de_tx_timeout()
1466 de_clean_rings(de); in de_tx_timeout()
1468 de_init_rings(de); in de_tx_timeout()
1470 de_init_hw(de); in de_tx_timeout()
1475 static void __de_get_regs(struct de_private *de, u8 *buf) in __de_get_regs() argument
1485 de_rx_missed(de, rbuf[8]); in __de_get_regs()
1488 static int __de_get_settings(struct de_private *de, struct ethtool_cmd *ecmd) in __de_get_settings() argument
1490 ecmd->supported = de->media_supported; in __de_get_settings()
1493 ecmd->advertising = de->media_advertise; in __de_get_settings()
1495 switch (de->media_type) { in __de_get_settings()
1514 if (de->media_lock) in __de_get_settings()
1524 static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd) in __de_set_settings() argument
1535 if (de->de21040 && ecmd->port == PORT_BNC) in __de_set_settings()
1541 if (ecmd->advertising & ~de->media_supported) in __de_set_settings()
1574 if ((new_media == de->media_type) && in __de_set_settings()
1575 (media_lock == de->media_lock) && in __de_set_settings()
1576 (ecmd->advertising == de->media_advertise)) in __de_set_settings()
1579 de_link_down(de); in __de_set_settings()
1580 mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK); in __de_set_settings()
1581 de_stop_rxtx(de); in __de_set_settings()
1583 de->media_type = new_media; in __de_set_settings()
1584 de->media_lock = media_lock; in __de_set_settings()
1585 de->media_advertise = ecmd->advertising; in __de_set_settings()
1586 de_set_media(de); in __de_set_settings()
1587 if (netif_running(de->dev)) in __de_set_settings()
1588 de_start_rxtx(de); in __de_set_settings()
1595 struct de_private *de = netdev_priv(dev); in de_get_drvinfo() local
1599 strlcpy(info->bus_info, pci_name(de->pdev), sizeof(info->bus_info)); in de_get_drvinfo()
1609 struct de_private *de = netdev_priv(dev); in de_get_settings() local
1612 spin_lock_irq(&de->lock); in de_get_settings()
1613 rc = __de_get_settings(de, ecmd); in de_get_settings()
1614 spin_unlock_irq(&de->lock); in de_get_settings()
1621 struct de_private *de = netdev_priv(dev); in de_set_settings() local
1624 spin_lock_irq(&de->lock); in de_set_settings()
1625 rc = __de_set_settings(de, ecmd); in de_set_settings()
1626 spin_unlock_irq(&de->lock); in de_set_settings()
1633 struct de_private *de = netdev_priv(dev); in de_get_msglevel() local
1635 return de->msg_enable; in de_get_msglevel()
1640 struct de_private *de = netdev_priv(dev); in de_set_msglevel() local
1642 de->msg_enable = msglvl; in de_set_msglevel()
1648 struct de_private *de = netdev_priv(dev); in de_get_eeprom() local
1650 if (!de->ee_data) in de_get_eeprom()
1655 memcpy(data, de->ee_data, eeprom->len); in de_get_eeprom()
1662 struct de_private *de = netdev_priv(dev); in de_nway_reset() local
1665 if (de->media_type != DE_MEDIA_TP_AUTO) in de_nway_reset()
1667 if (netif_carrier_ok(de->dev)) in de_nway_reset()
1668 de_link_down(de); in de_nway_reset()
1672 netif_info(de, link, dev, "link nway restart, status %x,%x\n", in de_nway_reset()
1680 struct de_private *de = netdev_priv(dev); in de_get_regs() local
1682 regs->version = (DE_REGS_VER << 2) | de->de21040; in de_get_regs()
1684 spin_lock_irq(&de->lock); in de_get_regs()
1685 __de_get_regs(de, data); in de_get_regs()
1686 spin_unlock_irq(&de->lock); in de_get_regs()
1702 static void de21040_get_mac_address(struct de_private *de) in de21040_get_mac_address() argument
1715 de->dev->dev_addr[i] = value; in de21040_get_mac_address()
1723 static void de21040_get_media_info(struct de_private *de) in de21040_get_media_info() argument
1727 de->media_type = DE_MEDIA_TP; in de21040_get_media_info()
1728 de->media_supported |= SUPPORTED_TP | SUPPORTED_10baseT_Full | in de21040_get_media_info()
1730 de->media_advertise = de->media_supported; in de21040_get_media_info()
1737 de->media[i].type = i; in de21040_get_media_info()
1738 de->media[i].csr13 = t21040_csr13[i]; in de21040_get_media_info()
1739 de->media[i].csr14 = t21040_csr14[i]; in de21040_get_media_info()
1740 de->media[i].csr15 = t21040_csr15[i]; in de21040_get_media_info()
1743 de->media[i].type = DE_MEDIA_INVALID; in de21040_get_media_info()
1786 static void de21041_get_srom_info(struct de_private *de) in de21041_get_srom_info() argument
1790 unsigned ee_addr_size = tulip_read_eeprom(de->regs, 0xff, 8) & 0x40000 ? 8 : 6; in de21041_get_srom_info()
1797 cpu_to_le16(tulip_read_eeprom(de->regs, i, ee_addr_size)); in de21041_get_srom_info()
1813 de->dev->dev_addr[i] = ee_data[i + sa_offset]; in de21041_get_srom_info()
1832 case 0x0001: de->media_type = DE_MEDIA_BNC; break; in de21041_get_srom_info()
1833 case 0x0002: de->media_type = DE_MEDIA_AUI; break; in de21041_get_srom_info()
1834 case 0x0204: de->media_type = DE_MEDIA_TP_FD; break; in de21041_get_srom_info()
1835 default: de->media_type = DE_MEDIA_TP_AUTO; break; in de21041_get_srom_info()
1838 if (netif_msg_probe(de)) in de21041_get_srom_info()
1840 de->board_idx, ofs, media_name[de->media_type]); in de21041_get_srom_info()
1844 de->media[i].type = DE_MEDIA_INVALID; in de21041_get_srom_info()
1845 de->media[i].csr13 = 0xffff; in de21041_get_srom_info()
1846 de->media[i].csr14 = 0xffff; in de21041_get_srom_info()
1847 de->media[i].csr15 = 0xffff; in de21041_get_srom_info()
1861 de->media_supported |= SUPPORTED_TP | SUPPORTED_10baseT_Half in de21041_get_srom_info()
1864 de->media[DE_MEDIA_TP_AUTO].type = DE_MEDIA_TP_AUTO; in de21041_get_srom_info()
1867 de->media_supported |= SUPPORTED_BNC; in de21041_get_srom_info()
1871 de->media_supported |= SUPPORTED_AUI; in de21041_get_srom_info()
1875 de->media_supported |= SUPPORTED_TP | SUPPORTED_10baseT_Full in de21041_get_srom_info()
1878 de->media[DE_MEDIA_TP_AUTO].type = DE_MEDIA_TP_AUTO; in de21041_get_srom_info()
1884 de->media[idx].type = idx; in de21041_get_srom_info()
1886 if (netif_msg_probe(de)) in de21041_get_srom_info()
1888 de->board_idx, i, in de21041_get_srom_info()
1889 media_name[de->media[idx].type]); in de21041_get_srom_info()
1894 de->media[idx].csr13 = get_unaligned(&ib->csr13); in de21041_get_srom_info()
1895 de->media[idx].csr14 = get_unaligned(&ib->csr14); in de21041_get_srom_info()
1896 de->media[idx].csr15 = get_unaligned(&ib->csr15); in de21041_get_srom_info()
1900 if (netif_msg_probe(de)) in de21041_get_srom_info()
1902 de->media[idx].csr13, in de21041_get_srom_info()
1903 de->media[idx].csr14, in de21041_get_srom_info()
1904 de->media[idx].csr15); in de21041_get_srom_info()
1907 if (netif_msg_probe(de)) in de21041_get_srom_info()
1915 de->media_advertise = de->media_supported; in de21041_get_srom_info()
1920 if (de->media[i].csr13 == 0xffff) in de21041_get_srom_info()
1921 de->media[i].csr13 = t21041_csr13[i]; in de21041_get_srom_info()
1922 if (de->media[i].csr14 == 0xffff) { in de21041_get_srom_info()
1925 if (de->pdev->revision < 0x20) in de21041_get_srom_info()
1926 de->media[i].csr14 = t21041_csr14_brk[i]; in de21041_get_srom_info()
1928 de->media[i].csr14 = t21041_csr14[i]; in de21041_get_srom_info()
1930 if (de->media[i].csr15 == 0xffff) in de21041_get_srom_info()
1931 de->media[i].csr15 = t21041_csr15[i]; in de21041_get_srom_info()
1934 de->ee_data = kmemdup(&ee_data[0], DE_EEPROM_SIZE, GFP_KERNEL); in de21041_get_srom_info()
1941 de->media[i].type = i; in de21041_get_srom_info()
1942 de->media_supported = in de21041_get_srom_info()
1967 struct de_private *de; in de_init_one() local
1990 de = netdev_priv(dev); in de_init_one()
1991 de->de21040 = ent->driver_data == 0 ? 1 : 0; in de_init_one()
1992 de->pdev = pdev; in de_init_one()
1993 de->dev = dev; in de_init_one()
1994 de->msg_enable = (debug < 0 ? DE_DEF_MSG_ENABLE : debug); in de_init_one()
1995 de->board_idx = board_idx; in de_init_one()
1996 spin_lock_init (&de->lock); in de_init_one()
1997 init_timer(&de->media_timer); in de_init_one()
1998 if (de->de21040) in de_init_one()
1999 de->media_timer.function = de21040_media_timer; in de_init_one()
2001 de->media_timer.function = de21041_media_timer; in de_init_one()
2002 de->media_timer.data = (unsigned long) de; in de_init_one()
2048 de->regs = regs; in de_init_one()
2050 de_adapter_wake(de); in de_init_one()
2053 rc = de_reset_mac(de); in de_init_one()
2062 if (de->de21040) { in de_init_one()
2063 de21040_get_mac_address(de); in de_init_one()
2064 de21040_get_media_info(de); in de_init_one()
2066 de21041_get_srom_info(de); in de_init_one()
2076 de->de21040 ? "21040" : "21041", in de_init_one()
2085 de_adapter_sleep(de); in de_init_one()
2090 kfree(de->ee_data); in de_init_one()
2104 struct de_private *de = netdev_priv(dev); in de_remove_one() local
2108 kfree(de->ee_data); in de_remove_one()
2109 iounmap(de->regs); in de_remove_one()
2120 struct de_private *de = netdev_priv(dev); in de_suspend() local
2126 del_timer_sync(&de->media_timer); in de_suspend()
2129 spin_lock_irq(&de->lock); in de_suspend()
2131 de_stop_hw(de); in de_suspend()
2136 spin_unlock_irq(&de->lock); in de_suspend()
2140 __de_get_stats(de); in de_suspend()
2143 de_clean_rings(de); in de_suspend()
2145 de_adapter_sleep(de); in de_suspend()
2157 struct de_private *de = netdev_priv(dev); in de_resume() local
2170 de_init_rings(de); in de_resume()
2171 de_init_hw(de); in de_resume()