Lines Matching defs:nic
107 #include "nic.h"
479 static int mdio_read(struct nic *nic, int phy_id, int location);
480 static void mdio_write(struct nic *nic, int phy_id, int location, int value);
482 static void parse_eeprom(struct nic *nic);
484 static void tulip_init_ring(struct nic *nic);
485 static void tulip_reset(struct nic *nic);
486 static void tulip_transmit(struct nic *nic, const char *d, unsigned int t,
488 static int tulip_poll(struct nic *nic, int retrieve);
490 static void nway_start(struct nic *nic);
491 static void pnic_do_nway(struct nic *nic);
492 static void select_media(struct nic *nic, int startup);
493 static void init_media(struct nic *nic);
494 static void start_link(struct nic *nic);
495 static int tulip_check_duplex(struct nic *nic);
566 int mdio_read(struct nic *nic __unused, int phy_id, int location)
627 void mdio_write(struct nic *nic __unused, int phy_id, int location, int value)
730 static void parse_eeprom(struct nic *nic)
749 if (nic->node_addr[0] == eeprom_fixups[i].addr0
750 && nic->node_addr[1] == eeprom_fixups[i].addr1
751 && nic->node_addr[2] == eeprom_fixups[i].addr2) {
752 if (nic->node_addr[2] == 0xE8 && ee_data[0x1a] == 0x55)
897 static void tulip_init_ring(struct nic *nic __unused)
934 static void set_rx_mode(struct nic *nic __unused) {
952 static void tulip_reset(struct nic *nic)
980 tulip_init_ring(nic);
983 u32 addr_high = (nic->node_addr[1]<<8) + (nic->node_addr[0]<<0);
985 outl((nic->node_addr[5]<<8) + nic->node_addr[4] +
986 (nic->node_addr[3]<<24) + (nic->node_addr[2]<<16),
993 u32 addr_low = cpu_to_le32(get_unaligned((u32 *)nic->node_addr));
994 u32 addr_high = cpu_to_le32(get_unaligned((u16 *)(nic->node_addr+4)));
1021 txb[0] = nic->node_addr[0];
1022 txb[1] = nic->node_addr[1];
1023 txb[4] = nic->node_addr[2];
1024 txb[5] = nic->node_addr[3];
1025 txb[8] = nic->node_addr[4];
1026 txb[9] = nic->node_addr[5];
1037 init_media(nic);
1059 tulip_check_duplex(nic);
1061 set_rx_mode(nic);
1070 static void tulip_transmit(struct nic *nic, const char *d, unsigned int t,
1085 memcpy(txb + ETH_ALEN, nic->node_addr, ETH_ALEN);
1130 static int tulip_poll(struct nic *nic, int retrieve)
1147 nic->packetlen = (rx_ring[tp->cur_rx].status & 0x3FFF0000) >> 16;
1158 memcpy(nic->packet, rxb + tp->cur_rx * BUFLEN, nic->packetlen);
1172 struct nic *nic = (struct nic *)dev;
1178 tulip_reset(nic);
1193 static void tulip_irq(struct nic *nic __unused, irq_action_t action __unused)
1210 struct nic *nic = (struct nic *)dev;
1222 nic->ioaddr = pci->ioaddr & ~3;
1223 nic->irqno = 0;
1321 nic->node_addr[i] = value;
1331 put_unaligned(le16_to_cpu(value), ((u16*)nic->node_addr) + i);
1336 put_unaligned(inl(ioaddr + 0xA4), (u32 *)nic->node_addr);
1337 put_unaligned(inl(ioaddr + 0xA8), (u16 *)(nic->node_addr + 4));
1339 sum += nic->node_addr[i];
1359 nic->node_addr[i] = ee_data[i + sa_offset];
1364 if ((nic->node_addr[0] == 0xA0 || nic->node_addr[0] == 0xC0)
1365 && nic->node_addr[1] == 0x00)
1367 char tmp = nic->node_addr[i];
1368 nic->node_addr[i] = nic->node_addr[i+1];
1369 nic->node_addr[i+1] = tmp;
1375 nic->node_addr[i] = last_phys_addr[i];
1376 nic->node_addr[i] = last_phys_addr[i] + 1;
1380 last_phys_addr[i] = nic->node_addr[i];
1382 printf("%s: %! at ioaddr %hX\n", tp->nic_name, nic->node_addr, ioaddr);
1405 parse_eeprom(nic);
1408 start_link(nic);
1411 tulip_reset(nic);
1414 nic->poll = tulip_poll;
1415 nic->transmit = tulip_transmit;
1416 nic->irq = tulip_irq;
1424 static void start_link(struct nic *nic)
1441 select_media(nic, 2);
1450 int mii_status = mdio_read(nic, phy, 1);
1453 int mii_reg0 = mdio_read(nic, phy, 0);
1454 int mii_advert = mdio_read(nic, phy, 4);
1471 mdio_write(nic, phy, 4, to_advert);
1474 mdio_write(nic, phy, 0, mii_reg0 |
1515 nway_start(nic);
1543 static void nway_start(struct nic *nic __unused)
1579 static void init_media(struct nic *nic)
1631 select_media(nic, 1);
1637 nway_start(nic);
1641 select_media(nic, 1);
1645 tp->nic_name, tp->phys[0], mdio_read(nic, tp->phys[0], 1));
1653 nway_start(nic);
1656 nway_start(nic);
1664 pnic_do_nway(nic);
1693 select_media(nic, 1);
1697 static void pnic_do_nway(struct nic *nic __unused)
1734 static void select_media(struct nic *nic, int startup)
1863 mdio_write(nic, tp->phys[phy_num], 4, tp->mii_advertise);
1969 static int tulip_check_duplex(struct nic *nic)
1973 bmsr = mdio_read(nic, tp->phys[0], 1);
1974 lpa = mdio_read(nic, tp->phys[0], 5);
1985 int new_bmsr = mdio_read(nic, tp->phys[0], 1);