Lines Matching refs:ip

115 static inline void ioc3_stop(struct ioc3_private *ip);
116 static void ioc3_init(struct ioc3_private *ip);
348 static void ioc3_get_eaddr_nic(struct ioc3_private *ip) in ioc3_get_eaddr_nic() argument
350 struct ioc3 *ioc3 = ip->regs; in ioc3_get_eaddr_nic()
377 ip->dev->dev_addr[i - 2] = nic[i]; in ioc3_get_eaddr_nic()
385 static void ioc3_get_eaddr(struct ioc3_private *ip) in ioc3_get_eaddr() argument
390 ioc3_get_eaddr_nic(ip); in ioc3_get_eaddr()
394 printk("%02x", ip->dev->dev_addr[i]); in ioc3_get_eaddr()
406 static u16 mii_read(struct ioc3_private *ip, int reg) in mii_read() argument
408 struct ioc3 *ioc3 = ip->regs; in mii_read()
409 int phy = ip->phy; in mii_read()
418 static void mii_write(struct ioc3_private *ip, int reg, u16 data) in mii_write() argument
420 struct ioc3 *ioc3 = ip->regs; in mii_write()
421 int phy = ip->phy; in mii_write()
429 static int ioc3_mii_init(struct ioc3_private *ip);
433 struct ioc3_private *ip = dev->priv; in ioc3_get_stats() local
434 struct ioc3 *ioc3 = ip->regs; in ioc3_get_stats()
436 ip->stats.collisions += (ioc3->etcdc & ETCDC_COLLCNT_MASK); in ioc3_get_stats()
437 return &ip->stats; in ioc3_get_stats()
441 ioc3_rx(struct ioc3_private *ip) in ioc3_rx() argument
444 struct ioc3 *ioc3 = ip->regs; in ioc3_rx()
450 rxr = (unsigned long *) ip->rxr; /* Ring base */ in ioc3_rx()
451 rx_entry = ip->rx_ci; /* RX consume index */ in ioc3_rx()
452 n_entry = ip->rx_pi; in ioc3_rx()
454 skb = ip->rx_skbs[rx_entry]; in ioc3_rx()
463 skb->protocol = eth_type_trans(skb, ip->dev); in ioc3_rx()
469 ip->stats.rx_dropped++; in ioc3_rx()
475 ip->rx_skbs[rx_entry] = NULL; /* Poison */ in ioc3_rx()
477 new_skb->dev = ip->dev; in ioc3_rx()
484 ip->dev->last_rx = jiffies; in ioc3_rx()
485 ip->stats.rx_packets++; /* Statistics */ in ioc3_rx()
486 ip->stats.rx_bytes += len; in ioc3_rx()
492 ip->stats.rx_errors++; in ioc3_rx()
495 ip->stats.rx_crc_errors++; in ioc3_rx()
497 ip->stats.rx_frame_errors++; in ioc3_rx()
499 ip->rx_skbs[n_entry] = new_skb; in ioc3_rx()
507 skb = ip->rx_skbs[rx_entry]; in ioc3_rx()
512 ip->rx_pi = n_entry; in ioc3_rx()
513 ip->rx_ci = rx_entry; in ioc3_rx()
517 ioc3_tx(struct ioc3_private *ip) in ioc3_tx() argument
520 struct ioc3 *ioc3 = ip->regs; in ioc3_tx()
525 spin_lock(&ip->ioc3_lock); in ioc3_tx()
529 o_entry = ip->tx_ci; in ioc3_tx()
535 skb = ip->tx_skbs[o_entry]; in ioc3_tx()
538 ip->tx_skbs[o_entry] = NULL; in ioc3_tx()
546 ip->stats.tx_packets += packets; in ioc3_tx()
547 ip->stats.tx_bytes += bytes; in ioc3_tx()
548 ip->txqlen -= packets; in ioc3_tx()
550 if (ip->txqlen < 128) in ioc3_tx()
551 netif_wake_queue(ip->dev); in ioc3_tx()
553 ip->tx_ci = o_entry; in ioc3_tx()
554 spin_unlock(&ip->ioc3_lock); in ioc3_tx()
565 ioc3_error(struct ioc3_private *ip, u32 eisr) in ioc3_error() argument
567 struct net_device *dev = ip->dev; in ioc3_error()
583 ioc3_stop(ip); in ioc3_error()
584 ioc3_init(ip); in ioc3_error()
585 ioc3_mii_init(ip); in ioc3_error()
596 struct ioc3_private *ip = dev->priv; in ioc3_interrupt() local
597 struct ioc3 *ioc3 = ip->regs; in ioc3_interrupt()
611 ioc3_error(ip, eisr); in ioc3_interrupt()
613 ioc3_rx(ip); in ioc3_interrupt()
615 ioc3_tx(ip); in ioc3_interrupt()
654 static int ioc3_try_next_permutation(struct ioc3_private *ip) in ioc3_try_next_permutation() argument
656 ip->sw_bmcr = mii_read(ip, MII_BMCR); in ioc3_try_next_permutation()
659 if (ip->sw_bmcr & BMCR_FULLDPLX) { in ioc3_try_next_permutation()
660 ip->sw_bmcr &= ~BMCR_FULLDPLX; in ioc3_try_next_permutation()
661 mii_write(ip, MII_BMCR, ip->sw_bmcr); in ioc3_try_next_permutation()
667 if (ip->sw_bmcr & BMCR_SPEED100) { in ioc3_try_next_permutation()
668 ip->sw_bmcr &= ~BMCR_SPEED100; in ioc3_try_next_permutation()
669 mii_write(ip, MII_BMCR, ip->sw_bmcr); in ioc3_try_next_permutation()
679 ioc3_display_link_mode(struct ioc3_private *ip) in ioc3_display_link_mode() argument
683 ip->sw_lpa = mii_read(ip, MII_LPA); in ioc3_display_link_mode()
685 if (ip->sw_lpa & (LPA_100HALF | LPA_100FULL)) { in ioc3_display_link_mode()
686 if (ip->sw_lpa & LPA_100FULL) in ioc3_display_link_mode()
691 if (ip->sw_lpa & LPA_10FULL) in ioc3_display_link_mode()
697 printk(KERN_INFO "%s: Link is up at %s.\n", ip->dev->name, tmode); in ioc3_display_link_mode()
701 ioc3_display_forced_link_mode(struct ioc3_private *ip) in ioc3_display_forced_link_mode() argument
705 ip->sw_bmcr = mii_read(ip, MII_BMCR); in ioc3_display_forced_link_mode()
706 if (ip->sw_bmcr & BMCR_SPEED100) in ioc3_display_forced_link_mode()
710 if (ip->sw_bmcr & BMCR_FULLDPLX) in ioc3_display_forced_link_mode()
715 printk(KERN_INFO "%s: Link has been forced up at %s%s", ip->dev->name, in ioc3_display_forced_link_mode()
719 static int ioc3_set_link_modes(struct ioc3_private *ip) in ioc3_set_link_modes() argument
721 struct ioc3 *ioc3 = ip->regs; in ioc3_set_link_modes()
728 if (ip->timer_state == arbwait) { in ioc3_set_link_modes()
729 ip->sw_lpa = mii_read(ip, MII_LPA); in ioc3_set_link_modes()
730 if (!(ip->sw_lpa & (LPA_10HALF | LPA_10FULL | in ioc3_set_link_modes()
733 if (ip->sw_lpa & LPA_100FULL) in ioc3_set_link_modes()
735 else if (ip->sw_lpa & LPA_100HALF) in ioc3_set_link_modes()
737 else if (ip->sw_lpa & LPA_10FULL) in ioc3_set_link_modes()
743 ip->sw_bmcr = mii_read(ip, MII_BMCR); in ioc3_set_link_modes()
744 if (ip->sw_bmcr & BMCR_FULLDPLX) in ioc3_set_link_modes()
751 ip->emcr |= EMCR_DUPLEX; in ioc3_set_link_modes()
753 ip->emcr &= ~EMCR_DUPLEX; in ioc3_set_link_modes()
755 ioc3->emcr = ip->emcr; in ioc3_set_link_modes()
765 static int is_lucent_phy(struct ioc3_private *ip) in is_lucent_phy() argument
770 mr2 = mii_read(ip, MII_PHYSID1); in is_lucent_phy()
771 mr3 = mii_read(ip, MII_PHYSID2); in is_lucent_phy()
781 struct ioc3_private *ip = (struct ioc3_private *) data; in ioc3_timer() local
784 ip->timer_ticks++; in ioc3_timer()
785 switch (ip->timer_state) { in ioc3_timer()
791 if (ip->timer_ticks >= 10) { in ioc3_timer()
794 ip->sw_bmcr = mii_read(ip, MII_BMCR); in ioc3_timer()
796 " trying force link mode\n", ip->dev->name); in ioc3_timer()
797 ip->sw_bmcr = BMCR_SPEED100; in ioc3_timer()
798 mii_write(ip, MII_BMCR, ip->sw_bmcr); in ioc3_timer()
800 if (!is_lucent_phy(ip)) { in ioc3_timer()
806 ip->sw_csconfig = mii_read(ip, MII_CSCONFIG); in ioc3_timer()
807 ip->sw_csconfig &= ~(CSCONFIG_TCVDISAB); in ioc3_timer()
808 mii_write(ip, MII_CSCONFIG, ip->sw_csconfig); in ioc3_timer()
810 ip->timer_state = ltrywait; in ioc3_timer()
811 ip->timer_ticks = 0; in ioc3_timer()
815 ip->sw_bmsr = mii_read(ip, MII_BMSR); in ioc3_timer()
816 if (ip->sw_bmsr & BMSR_ANEGCOMPLETE) { in ioc3_timer()
820 ret = ioc3_set_link_modes(ip); in ioc3_timer()
836 ip->timer_state = lupwait; in ioc3_timer()
851 ip->sw_bmsr = mii_read(ip, MII_BMSR); in ioc3_timer()
852 if (ip->sw_bmsr & BMSR_LSTATUS) { in ioc3_timer()
857 ioc3_display_link_mode(ip); in ioc3_timer()
858 ip->timer_state = asleep; in ioc3_timer()
861 if (ip->timer_ticks >= 10) { in ioc3_timer()
863 "not completely up.\n", ip->dev->name); in ioc3_timer()
864 ip->timer_ticks = 0; in ioc3_timer()
879 ip->sw_bmsr = mii_read(ip, MII_BMSR); in ioc3_timer()
880 ip->sw_csconfig = mii_read(ip, MII_CSCONFIG); in ioc3_timer()
881 if (ip->timer_ticks == 1) { in ioc3_timer()
882 if (!is_lucent_phy(ip)) { in ioc3_timer()
888 ip->sw_csconfig |= CSCONFIG_TCVDISAB; in ioc3_timer()
889 mii_write(ip, MII_CSCONFIG, ip->sw_csconfig); in ioc3_timer()
894 if (ip->timer_ticks == 2) { in ioc3_timer()
895 if (!is_lucent_phy(ip)) { in ioc3_timer()
896 ip->sw_csconfig &= ~(CSCONFIG_TCVDISAB); in ioc3_timer()
897 mii_write(ip, MII_CSCONFIG, ip->sw_csconfig); in ioc3_timer()
902 if (ip->sw_bmsr & BMSR_LSTATUS) { in ioc3_timer()
904 ioc3_display_forced_link_mode(ip); in ioc3_timer()
905 ioc3_set_link_modes(ip); /* XXX error? then what? */ in ioc3_timer()
906 ip->timer_state = asleep; in ioc3_timer()
909 if (ip->timer_ticks >= 4) { /* 6 seconds or so... */ in ioc3_timer()
912 ret = ioc3_try_next_permutation(ip); in ioc3_timer()
920 ip->dev->name); in ioc3_timer()
922 ioc3_init(ip); in ioc3_timer()
925 if (!is_lucent_phy(ip)) { in ioc3_timer()
926 ip->sw_csconfig = mii_read(ip, in ioc3_timer()
928 ip->sw_csconfig |= CSCONFIG_TCVDISAB; in ioc3_timer()
929 mii_write(ip, MII_CSCONFIG, in ioc3_timer()
930 ip->sw_csconfig); in ioc3_timer()
932 ip->timer_ticks = 0; in ioc3_timer()
944 "one anyways!\n", ip->dev->name); in ioc3_timer()
946 ip->timer_ticks = 0; in ioc3_timer()
947 ip->timer_state = asleep; /* foo on you */ in ioc3_timer()
952 ip->ioc3_timer.expires = jiffies + ((12 * HZ)/10); /* 1.2s */ in ioc3_timer()
953 add_timer(&ip->ioc3_timer); in ioc3_timer()
958 ioc3_start_auto_negotiation(struct ioc3_private *ip, struct ethtool_cmd *ep) in ioc3_start_auto_negotiation() argument
963 ip->sw_bmsr = mii_read(ip, MII_BMSR); in ioc3_start_auto_negotiation()
964 ip->sw_bmcr = mii_read(ip, MII_BMCR); in ioc3_start_auto_negotiation()
965 ip->sw_physid1 = mii_read(ip, MII_PHYSID1); in ioc3_start_auto_negotiation()
966 ip->sw_physid2 = mii_read(ip, MII_PHYSID2); in ioc3_start_auto_negotiation()
970 ip->sw_advertise = mii_read(ip, MII_ADVERTISE); in ioc3_start_auto_negotiation()
973 if (ip->sw_bmsr & BMSR_10HALF) in ioc3_start_auto_negotiation()
974 ip->sw_advertise |= ADVERTISE_10HALF; in ioc3_start_auto_negotiation()
976 ip->sw_advertise &= ~ADVERTISE_10HALF; in ioc3_start_auto_negotiation()
978 if (ip->sw_bmsr & BMSR_10FULL) in ioc3_start_auto_negotiation()
979 ip->sw_advertise |= ADVERTISE_10FULL; in ioc3_start_auto_negotiation()
981 ip->sw_advertise &= ~ADVERTISE_10FULL; in ioc3_start_auto_negotiation()
982 if (ip->sw_bmsr & BMSR_100HALF) in ioc3_start_auto_negotiation()
983 ip->sw_advertise |= ADVERTISE_100HALF; in ioc3_start_auto_negotiation()
985 ip->sw_advertise &= ~ADVERTISE_100HALF; in ioc3_start_auto_negotiation()
986 if (ip->sw_bmsr & BMSR_100FULL) in ioc3_start_auto_negotiation()
987 ip->sw_advertise |= ADVERTISE_100FULL; in ioc3_start_auto_negotiation()
989 ip->sw_advertise &= ~ADVERTISE_100FULL; in ioc3_start_auto_negotiation()
990 mii_write(ip, MII_ADVERTISE, ip->sw_advertise); in ioc3_start_auto_negotiation()
1001 ASD(("%s: Advertising [ ", ip->dev->name)); in ioc3_start_auto_negotiation()
1002 if (ip->sw_advertise & ADVERTISE_10HALF) in ioc3_start_auto_negotiation()
1004 if (ip->sw_advertise & ADVERTISE_10FULL) in ioc3_start_auto_negotiation()
1006 if (ip->sw_advertise & ADVERTISE_100HALF) in ioc3_start_auto_negotiation()
1008 if (ip->sw_advertise & ADVERTISE_100FULL) in ioc3_start_auto_negotiation()
1013 ip->sw_bmcr |= BMCR_ANENABLE; in ioc3_start_auto_negotiation()
1014 mii_write(ip, MII_BMCR, ip->sw_bmcr); in ioc3_start_auto_negotiation()
1017 ip->sw_bmcr |= BMCR_ANRESTART; in ioc3_start_auto_negotiation()
1018 mii_write(ip, MII_BMCR, ip->sw_bmcr); in ioc3_start_auto_negotiation()
1024 ip->sw_bmcr = mii_read(ip, MII_BMCR); in ioc3_start_auto_negotiation()
1025 if (!(ip->sw_bmcr & BMCR_ANRESTART)) in ioc3_start_auto_negotiation()
1032 ip->dev->name, ip->sw_bmcr); in ioc3_start_auto_negotiation()
1034 "detection.\n", ip->dev->name); in ioc3_start_auto_negotiation()
1037 ip->timer_state = arbwait; in ioc3_start_auto_negotiation()
1052 ip->sw_bmcr = BMCR_SPEED100; in ioc3_start_auto_negotiation()
1055 ip->sw_bmcr = BMCR_SPEED100; in ioc3_start_auto_negotiation()
1057 ip->sw_bmcr = 0; in ioc3_start_auto_negotiation()
1059 ip->sw_bmcr |= BMCR_FULLDPLX; in ioc3_start_auto_negotiation()
1061 mii_write(ip, MII_BMCR, ip->sw_bmcr); in ioc3_start_auto_negotiation()
1063 if (!is_lucent_phy(ip)) { in ioc3_start_auto_negotiation()
1069 ip->sw_csconfig = mii_read(ip, MII_CSCONFIG); in ioc3_start_auto_negotiation()
1070 ip->sw_csconfig &= ~(CSCONFIG_TCVDISAB); in ioc3_start_auto_negotiation()
1071 mii_write(ip, MII_CSCONFIG, ip->sw_csconfig); in ioc3_start_auto_negotiation()
1073 ip->timer_state = ltrywait; in ioc3_start_auto_negotiation()
1076 del_timer(&ip->ioc3_timer); in ioc3_start_auto_negotiation()
1077 ip->timer_ticks = 0; in ioc3_start_auto_negotiation()
1078 ip->ioc3_timer.expires = jiffies + (12 * HZ)/10; /* 1.2 sec. */ in ioc3_start_auto_negotiation()
1079 ip->ioc3_timer.data = (unsigned long) ip; in ioc3_start_auto_negotiation()
1080 ip->ioc3_timer.function = &ioc3_timer; in ioc3_start_auto_negotiation()
1081 add_timer(&ip->ioc3_timer); in ioc3_start_auto_negotiation()
1084 static int ioc3_mii_init(struct ioc3_private *ip) in ioc3_mii_init() argument
1090 spin_lock_irq(&ip->ioc3_lock); in ioc3_mii_init()
1092 ip->phy = i; in ioc3_mii_init()
1093 word = mii_read(ip, 2); in ioc3_mii_init()
1100 spin_unlock_irq(&ip->ioc3_lock); in ioc3_mii_init()
1104 ioc3_start_auto_negotiation(ip, NULL); // XXX ethtool in ioc3_mii_init()
1106 spin_unlock_irq(&ip->ioc3_lock); in ioc3_mii_init()
1112 ioc3_clean_rx_ring(struct ioc3_private *ip) in ioc3_clean_rx_ring() argument
1117 for (i = ip->rx_ci; i & 15; i++) { in ioc3_clean_rx_ring()
1118 ip->rx_skbs[ip->rx_pi] = ip->rx_skbs[ip->rx_ci]; in ioc3_clean_rx_ring()
1119 ip->rxr[ip->rx_pi++] = ip->rxr[ip->rx_ci++]; in ioc3_clean_rx_ring()
1121 ip->rx_pi &= 511; in ioc3_clean_rx_ring()
1122 ip->rx_ci &= 511; in ioc3_clean_rx_ring()
1124 for (i = ip->rx_ci; i != ip->rx_pi; i = (i+1) & 511) { in ioc3_clean_rx_ring()
1126 skb = ip->rx_skbs[i]; in ioc3_clean_rx_ring()
1133 ioc3_clean_tx_ring(struct ioc3_private *ip) in ioc3_clean_tx_ring() argument
1139 skb = ip->tx_skbs[i]; in ioc3_clean_tx_ring()
1141 ip->tx_skbs[i] = NULL; in ioc3_clean_tx_ring()
1144 ip->txr[i].cmd = 0; in ioc3_clean_tx_ring()
1146 ip->tx_pi = 0; in ioc3_clean_tx_ring()
1147 ip->tx_ci = 0; in ioc3_clean_tx_ring()
1151 ioc3_free_rings(struct ioc3_private *ip) in ioc3_free_rings() argument
1156 if (ip->txr) { in ioc3_free_rings()
1157 ioc3_clean_tx_ring(ip); in ioc3_free_rings()
1158 free_pages((unsigned long)ip->txr, 2); in ioc3_free_rings()
1159 ip->txr = NULL; in ioc3_free_rings()
1162 if (ip->rxr) { in ioc3_free_rings()
1163 n_entry = ip->rx_ci; in ioc3_free_rings()
1164 rx_entry = ip->rx_pi; in ioc3_free_rings()
1167 skb = ip->rx_skbs[n_entry]; in ioc3_free_rings()
1173 free_page((unsigned long)ip->rxr); in ioc3_free_rings()
1174 ip->rxr = NULL; in ioc3_free_rings()
1179 ioc3_alloc_rings(struct net_device *dev, struct ioc3_private *ip, in ioc3_alloc_rings() argument
1186 if (ip->rxr == NULL) { in ioc3_alloc_rings()
1188 ip->rxr = (unsigned long *) get_free_page(GFP_ATOMIC); in ioc3_alloc_rings()
1189 rxr = (unsigned long *) ip->rxr; in ioc3_alloc_rings()
1205 ip->rx_skbs[i] = skb; in ioc3_alloc_rings()
1215 ip->rx_ci = 0; in ioc3_alloc_rings()
1216 ip->rx_pi = RX_BUFFS; in ioc3_alloc_rings()
1219 if (ip->txr == NULL) { in ioc3_alloc_rings()
1221 ip->txr = (struct ioc3_etxd *)__get_free_pages(GFP_KERNEL, 2); in ioc3_alloc_rings()
1222 if (!ip->txr) in ioc3_alloc_rings()
1224 ip->tx_pi = 0; in ioc3_alloc_rings()
1225 ip->tx_ci = 0; in ioc3_alloc_rings()
1230 ioc3_init_rings(struct net_device *dev, struct ioc3_private *ip, in ioc3_init_rings() argument
1235 ioc3_free_rings(ip); in ioc3_init_rings()
1236 ioc3_alloc_rings(dev, ip, ioc3); in ioc3_init_rings()
1238 ioc3_clean_rx_ring(ip); in ioc3_init_rings()
1239 ioc3_clean_tx_ring(ip); in ioc3_init_rings()
1242 ring = (0xa5UL << 56) | ((unsigned long)ip->rxr & TO_PHYS_MASK); in ioc3_init_rings()
1245 ioc3->ercir = (ip->rx_ci << 3); in ioc3_init_rings()
1246 ioc3->erpir = (ip->rx_pi << 3) | ERPIR_ARM; in ioc3_init_rings()
1248 ring = (0xa5UL << 56) | ((unsigned long)ip->txr & TO_PHYS_MASK); in ioc3_init_rings()
1250 ip->txqlen = 0; /* nothing queued */ in ioc3_init_rings()
1255 ioc3->etpir = (ip->tx_pi << 7); in ioc3_init_rings()
1256 ioc3->etcir = (ip->tx_ci << 7); in ioc3_init_rings()
1261 ioc3_ssram_disc(struct ioc3_private *ip) in ioc3_ssram_disc() argument
1263 struct ioc3 *ioc3 = ip->regs; in ioc3_ssram_disc()
1277 ip->emcr = EMCR_RAMPAR; in ioc3_ssram_disc()
1280 ip->emcr = EMCR_BUFSIZ | EMCR_RAMPAR; in ioc3_ssram_disc()
1284 static void ioc3_init(struct ioc3_private *ip) in ioc3_init() argument
1286 struct net_device *dev = ip->dev; in ioc3_init()
1287 struct ioc3 *ioc3 = ip->regs; in ioc3_init()
1289 del_timer(&ip->ioc3_timer); /* Kill if running */ in ioc3_init()
1306 ioc3->ehar_h = ip->ehar_h; in ioc3_init()
1307 ioc3->ehar_l = ip->ehar_l; in ioc3_init()
1310 ioc3_init_rings(ip->dev, ip, ioc3); in ioc3_init()
1312 ip->emcr |= ((RX_OFFSET / 2) << EMCR_RXOFF_SHIFT) | EMCR_TXDMAEN | in ioc3_init()
1314 ioc3->emcr = ip->emcr; in ioc3_init()
1321 static inline void ioc3_stop(struct ioc3_private *ip) in ioc3_stop() argument
1323 struct ioc3 *ioc3 = ip->regs; in ioc3_stop()
1333 struct ioc3_private *ip = dev->priv; in ioc3_open() local
1341 ip->ehar_h = 0; in ioc3_open()
1342 ip->ehar_l = 0; in ioc3_open()
1343 ioc3_init(ip); in ioc3_open()
1352 struct ioc3_private *ip = dev->priv; in ioc3_close() local
1354 del_timer(&ip->ioc3_timer); in ioc3_close()
1358 ioc3_stop(ip); in ioc3_close()
1361 ioc3_free_rings(ip); in ioc3_close()
1428 struct ioc3_private *ip; in ioc3_probe() local
1443 ip = dev->priv; in ioc3_probe()
1444 ip->dev = dev; in ioc3_probe()
1457 ip->regs = ioc3; in ioc3_probe()
1463 spin_lock_init(&ip->ioc3_lock); in ioc3_probe()
1464 init_timer(&ip->ioc3_timer); in ioc3_probe()
1466 ioc3_stop(ip); in ioc3_probe()
1467 ioc3_init(ip); in ioc3_probe()
1469 ioc3_mii_init(ip); in ioc3_probe()
1471 if (ip->phy == -1) { in ioc3_probe()
1478 ioc3_ssram_disc(ip); in ioc3_probe()
1479 ioc3_get_eaddr(ip); in ioc3_probe()
1495 vendor = (ip->sw_physid1 << 12) | (ip->sw_physid2 >> 4); in ioc3_probe()
1496 model = (ip->sw_physid2 >> 4) & 0x3f; in ioc3_probe()
1497 rev = ip->sw_physid2 & 0xf; in ioc3_probe()
1499 "rev %d.\n", dev->name, ip->phy, vendor, model, rev); in ioc3_probe()
1501 ip->emcr & EMCR_BUFSIZ ? 128 : 64); in ioc3_probe()
1506 ioc3_stop(ip); in ioc3_probe()
1508 ioc3_free_rings(ip); in ioc3_probe()
1519 struct ioc3_private *ip = dev->priv; in ioc3_remove_one() local
1520 struct ioc3 *ioc3 = ip->regs; in ioc3_remove_one()
1555 struct ioc3_private *ip = dev->priv; in ioc3_start_xmit() local
1556 struct ioc3 *ioc3 = ip->regs; in ioc3_start_xmit()
1561 spin_lock_irq(&ip->ioc3_lock); in ioc3_start_xmit()
1566 produce = ip->tx_pi; in ioc3_start_xmit()
1567 desc = &ip->txr[produce]; in ioc3_start_xmit()
1605 ip->tx_skbs[produce] = skb; /* Remember skb */ in ioc3_start_xmit()
1607 ip->tx_pi = produce; in ioc3_start_xmit()
1610 ip->txqlen++; in ioc3_start_xmit()
1612 if (ip->txqlen > 127) in ioc3_start_xmit()
1615 spin_unlock_irq(&ip->ioc3_lock); in ioc3_start_xmit()
1622 struct ioc3_private *ip = dev->priv; in ioc3_timeout() local
1626 ioc3_stop(ip); in ioc3_timeout()
1627 ioc3_init(ip); in ioc3_timeout()
1628 ioc3_mii_init(ip); in ioc3_timeout()
1663 struct ioc3_private *ip = dev->priv; in ioc3_ioctl() local
1666 struct ioc3 *ioc3 = ip->regs; in ioc3_ioctl()
1671 if (ip->phy == -1) in ioc3_ioctl()
1673 data[0] = ip->phy; in ioc3_ioctl()
1683 spin_lock_irq(&ip->ioc3_lock); in ioc3_ioctl()
1688 spin_unlock_irq(&ip->ioc3_lock); in ioc3_ioctl()
1702 spin_lock_irq(&ip->ioc3_lock); in ioc3_ioctl()
1707 spin_unlock_irq(&ip->ioc3_lock); in ioc3_ioctl()
1725 ecmd.phy_address = ip->phy; in ioc3_ioctl()
1728 spin_lock_irq(&ip->ioc3_lock); in ioc3_ioctl()
1729 ip->sw_bmcr = mii_read(ip, MII_BMCR); in ioc3_ioctl()
1730 ip->sw_lpa = mii_read(ip, MII_LPA); in ioc3_ioctl()
1731 spin_unlock_irq(&ip->ioc3_lock); in ioc3_ioctl()
1732 if (ip->sw_bmcr & BMCR_ANENABLE) { in ioc3_ioctl()
1734 ecmd.speed = (ip->sw_lpa & in ioc3_ioctl()
1738 ecmd.duplex = (ip->sw_lpa & (LPA_100FULL)) ? in ioc3_ioctl()
1741 ecmd.duplex = (ip->sw_lpa & (LPA_10FULL)) ? in ioc3_ioctl()
1745 ecmd.speed = (ip->sw_bmcr & BMCR_SPEED100) ? in ioc3_ioctl()
1747 ecmd.duplex = (ip->sw_bmcr & BMCR_FULLDPLX) ? in ioc3_ioctl()
1767 del_timer(&ip->ioc3_timer); in ioc3_ioctl()
1768 spin_lock_irq(&ip->ioc3_lock); in ioc3_ioctl()
1769 ioc3_start_auto_negotiation(ip, &ecmd); in ioc3_ioctl()
1770 spin_unlock_irq(&ip->ioc3_lock); in ioc3_ioctl()
1784 struct ioc3_private *ip = dev->priv; in ioc3_set_multicast_list() local
1785 struct ioc3 *ioc3 = ip->regs; in ioc3_set_multicast_list()
1794 ip->emcr |= EMCR_PROMISC; in ioc3_set_multicast_list()
1795 ioc3->emcr = ip->emcr; in ioc3_set_multicast_list()
1798 ip->emcr &= ~EMCR_PROMISC; in ioc3_set_multicast_list()
1799 ioc3->emcr = ip->emcr; /* Clear promiscuous. */ in ioc3_set_multicast_list()
1806 ip->ehar_h = 0xffffffff; in ioc3_set_multicast_list()
1807 ip->ehar_l = 0xffffffff; in ioc3_set_multicast_list()
1818 ip->ehar_h = ehar >> 32; in ioc3_set_multicast_list()
1819 ip->ehar_l = ehar & 0xffffffff; in ioc3_set_multicast_list()
1821 ioc3->ehar_h = ip->ehar_h; in ioc3_set_multicast_list()
1822 ioc3->ehar_l = ip->ehar_l; in ioc3_set_multicast_list()