Lines Matching +full:xcvr +full:- +full:setup

3     A PCMCIA ethernet driver for SMC91c92-based cards.
9 Copyright (C) 1999 David A. Hinds -- dahinds@users.sourceforge.net
14 (becker@scyld.com), Rowan Hughes (x-csrdh@jcu.edu.au),
239 /* BANK 3 -- not the same values as in smc9194! */
307 dev_dbg(&link->dev, "smc91c92_attach()\n"); in smc91c92_probe()
312 return -ENOMEM; in smc91c92_probe()
314 smc->p_dev = link; in smc91c92_probe()
315 link->priv = dev; in smc91c92_probe()
317 spin_lock_init(&smc->lock); in smc91c92_probe()
319 /* The SMC91c92-specific entries in the device structure. */ in smc91c92_probe()
320 dev->netdev_ops = &smc_netdev_ops; in smc91c92_probe()
321 dev->ethtool_ops = &ethtool_ops; in smc91c92_probe()
322 dev->watchdog_timeo = TX_TIMEOUT; in smc91c92_probe()
324 smc->mii_if.dev = dev; in smc91c92_probe()
325 smc->mii_if.mdio_read = mdio_read; in smc91c92_probe()
326 smc->mii_if.mdio_write = mdio_write; in smc91c92_probe()
327 smc->mii_if.phy_id_mask = 0x1f; in smc91c92_probe()
328 smc->mii_if.reg_num_mask = 0x1f; in smc91c92_probe()
335 struct net_device *dev = link->priv; in smc91c92_detach()
337 dev_dbg(&link->dev, "smc91c92_detach\n"); in smc91c92_detach()
354 return -1; in cvt_ascii_address()
361 (c - '0') : ((c & 0x0f) + 9); in cvt_ascii_address()
374 mhz_mfc_config() handles socket setup for multifunction (1144
382 struct net_device *dev = link->priv; in mhz_3288_power()
387 readb(smc->base+MEGAHERTZ_ISR); in mhz_3288_power()
389 readb(smc->base+MEGAHERTZ_ISR); in mhz_3288_power()
395 tmp = readb(smc->base + link->config_base + CISREG_COR); in mhz_3288_power()
397 writeb(tmp, smc->base + link->config_base + CISREG_COR); in mhz_3288_power()
405 p_dev->io_lines = 16; in mhz_mfc_config_check()
406 p_dev->resource[1]->start = p_dev->resource[0]->start; in mhz_mfc_config_check()
407 p_dev->resource[1]->end = 8; in mhz_mfc_config_check()
408 p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; in mhz_mfc_config_check()
409 p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; in mhz_mfc_config_check()
410 p_dev->resource[0]->end = 16; in mhz_mfc_config_check()
411 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; in mhz_mfc_config_check()
412 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; in mhz_mfc_config_check()
416 p_dev->resource[0]->start = k ^ 0x300; in mhz_mfc_config_check()
420 return -ENODEV; in mhz_mfc_config_check()
425 struct net_device *dev = link->priv; in mhz_mfc_config()
430 link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ | in mhz_mfc_config()
433 /* The Megahertz combo cards have modem-like CIS entries, so in mhz_mfc_config()
436 return -ENODEV; in mhz_mfc_config()
438 dev->base_addr = link->resource[0]->start; in mhz_mfc_config()
441 link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; in mhz_mfc_config()
442 link->resource[2]->start = link->resource[2]->end = 0; in mhz_mfc_config()
443 i = pcmcia_request_window(link, link->resource[2], 0); in mhz_mfc_config()
445 return -ENODEV; in mhz_mfc_config()
447 smc->base = ioremap(link->resource[2]->start, in mhz_mfc_config()
448 resource_size(link->resource[2])); in mhz_mfc_config()
449 offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0; in mhz_mfc_config()
450 i = pcmcia_map_mem_page(link, link->resource[2], offset); in mhz_mfc_config()
452 (smc->manfid == MANFID_MEGAHERTZ) && in mhz_mfc_config()
453 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) in mhz_mfc_config()
468 return -EINVAL; in pcmcia_get_versmac()
475 return -EINVAL; in pcmcia_get_versmac()
480 struct net_device *dev = link->priv; in mhz_setup()
487 if ((link->prod_id[3]) && in mhz_setup()
488 (cvt_ascii_address(dev, link->prod_id[3]) == 0)) in mhz_setup()
492 /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ in mhz_setup()
497 rc = -1; in mhz_setup()
520 struct net_device *dev = link->priv; in mot_config()
522 unsigned int ioaddr = dev->base_addr; in mot_config()
523 unsigned int iouart = link->resource[1]->start; in mot_config()
526 writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0); in mot_config()
527 writeb((iouart >> 8) & 0xff, smc->base + MOT_UART + CISREG_IOBASE_1); in mot_config()
528 writeb(MOT_NORMAL, smc->base + MOT_UART + CISREG_COR); in mot_config()
531 writeb(ioaddr & 0xff, smc->base + MOT_LAN + CISREG_IOBASE_0); in mot_config()
532 writeb((ioaddr >> 8) & 0xff, smc->base + MOT_LAN + CISREG_IOBASE_1); in mot_config()
533 writeb(MOT_NORMAL, smc->base + MOT_LAN + CISREG_COR); in mot_config()
541 struct net_device *dev = link->priv; in mot_setup()
542 unsigned int ioaddr = dev->base_addr; in mot_setup()
562 return -1; in mot_setup()
577 p_dev->resource[0]->end = 16; in smc_configcheck()
578 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; in smc_configcheck()
579 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; in smc_configcheck()
586 struct net_device *dev = link->priv; in smc_config()
589 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; in smc_config()
593 dev->base_addr = link->resource[0]->start; in smc_config()
601 struct net_device *dev = link->priv; in smc_setup()
608 if (link->prod_id[2]) { in smc_setup()
609 if (cvt_ascii_address(dev, link->prod_id[2]) == 0) in smc_setup()
612 return -1; in smc_setup()
619 struct net_device *dev = link->priv; in osi_config()
623 link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ; in osi_config()
624 link->resource[0]->end = 64; in osi_config()
625 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; in osi_config()
626 link->resource[1]->end = 8; in osi_config()
629 link->io_lines = 16; in osi_config()
630 link->config_index = 0x23; in osi_config()
633 link->resource[1]->start = com[j]; in osi_config()
640 link->config_index = 0x03; in osi_config()
641 link->resource[1]->end = 0; in osi_config()
644 dev->base_addr = link->resource[0]->start + 0x10; in osi_config()
653 err = request_firmware(&fw, FIRMWARE_NAME, &link->dev); in osi_load_firmware()
660 for (i = 0; i < fw->size; i++) { in osi_load_firmware()
661 outb(fw->data[i], link->resource[0]->start + 2); in osi_load_firmware()
674 if (tuple->TupleDataLen < 8) in pcmcia_osi_mac()
675 return -EINVAL; in pcmcia_osi_mac()
676 if (tuple->TupleData[0] != 0x04) in pcmcia_osi_mac()
677 return -EINVAL; in pcmcia_osi_mac()
679 eth_hw_addr_set(dev, &tuple->TupleData[2]); in pcmcia_osi_mac()
686 struct net_device *dev = link->priv; in osi_setup()
691 return -1; in osi_setup()
702 set_bits(0x300, link->resource[0]->start + OSITECH_AUI_PWR); in osi_setup()
704 set_bits(0x300, link->resource[0]->start + OSITECH_RESET_ISR); in osi_setup()
705 dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", in osi_setup()
706 inw(link->resource[0]->start + OSITECH_AUI_PWR), in osi_setup()
707 inw(link->resource[0]->start + OSITECH_RESET_ISR)); in osi_setup()
714 struct net_device *dev = link->priv; in smc91c92_suspend()
716 if (link->open) in smc91c92_suspend()
724 struct net_device *dev = link->priv; in smc91c92_resume()
728 if ((smc->manfid == MANFID_MEGAHERTZ) && in smc91c92_resume()
729 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) in smc91c92_resume()
731 if (smc->manfid == MANFID_MOTOROLA) in smc91c92_resume()
733 if ((smc->manfid == MANFID_OSITECH) && in smc91c92_resume()
734 (smc->cardid != PRODID_OSITECH_SEVEN)) { in smc91c92_resume()
736 set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR); in smc91c92_resume()
737 set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR); in smc91c92_resume()
739 if (((smc->manfid == MANFID_OSITECH) && in smc91c92_resume()
740 (smc->cardid == PRODID_OSITECH_SEVEN)) || in smc91c92_resume()
741 ((smc->manfid == MANFID_PSION) && in smc91c92_resume()
742 (smc->cardid == PRODID_PSION_NET100))) { in smc91c92_resume()
749 if (link->open) { in smc91c92_resume()
761 the revision code if successful. Otherwise, it returns -ENODEV.
767 struct net_device *dev = link->priv; in check_sig()
768 unsigned int ioaddr = dev->base_addr; in check_sig()
780 width = (link->resource[0]->flags == IO_DATA_PATH_WIDTH_AUTO); in check_sig()
798 netdev_info(dev, "using 8-bit IO window\n"); in check_sig()
805 return -ENODEV; in check_sig()
810 struct net_device *dev = link->priv; in smc91c92_config()
817 dev_dbg(&link->dev, "smc91c92_config\n"); in smc91c92_config()
819 smc->manfid = link->manf_id; in smc91c92_config()
820 smc->cardid = link->card_id; in smc91c92_config()
822 if ((smc->manfid == MANFID_OSITECH) && in smc91c92_config()
823 (smc->cardid != PRODID_OSITECH_SEVEN)) { in smc91c92_config()
825 } else if ((smc->manfid == MANFID_MOTOROLA) || in smc91c92_config()
826 ((smc->manfid == MANFID_MEGAHERTZ) && in smc91c92_config()
827 ((smc->cardid == PRODID_MEGAHERTZ_VARIOUS) || in smc91c92_config()
828 (smc->cardid == PRODID_MEGAHERTZ_EM3288)))) { in smc91c92_config()
843 if (smc->manfid == MANFID_MOTOROLA) in smc91c92_config()
846 dev->irq = link->irq; in smc91c92_config()
849 dev->if_port = if_port; in smc91c92_config()
851 dev_notice(&link->dev, "invalid if_port requested\n"); in smc91c92_config()
853 switch (smc->manfid) { in smc91c92_config()
856 i = osi_setup(link, smc->manfid, smc->cardid); break; in smc91c92_config()
869 dev_notice(&link->dev, "Unable to find hardware address.\n"); in smc91c92_config()
873 smc->duplex = 0; in smc91c92_config()
874 smc->rx_ovrn = 0; in smc91c92_config()
884 case 8: name = "100-FD"; break; in smc91c92_config()
888 ioaddr = dev->base_addr; in smc91c92_config()
898 smc->cfg = inw(ioaddr + CONFIG) & ~CFG_AUI_SELECT; in smc91c92_config()
899 smc->cfg |= CFG_NO_WAIT | CFG_16BIT | CFG_STATIC; in smc91c92_config()
900 if (smc->manfid == MANFID_OSITECH) in smc91c92_config()
901 smc->cfg |= CFG_IRQ_SEL_1 | CFG_IRQ_SEL_0; in smc91c92_config()
903 smc->cfg |= CFG_MII_SELECT; in smc91c92_config()
907 if (smc->cfg & CFG_MII_SELECT) { in smc91c92_config()
914 smc->mii_if.phy_id = (i < 32) ? i : -1; in smc91c92_config()
919 SET_NETDEV_DEV(dev, &link->dev); in smc91c92_config()
922 dev_err(&link->dev, "register_netdev() failed\n"); in smc91c92_config()
927 name, (rev & 0x0f), dev->base_addr, dev->irq, dev->dev_addr); in smc91c92_config()
934 pr_cont(" buffer, %s xcvr\n", in smc91c92_config()
935 (smc->cfg & CFG_MII_SELECT) ? "MII" : if_names[dev->if_port]); in smc91c92_config()
938 if (smc->cfg & CFG_MII_SELECT) { in smc91c92_config()
939 if (smc->mii_if.phy_id != -1) { in smc91c92_config()
941 smc->mii_if.phy_id, j); in smc91c92_config()
953 return -ENODEV; in smc91c92_config()
958 dev_dbg(&link->dev, "smc91c92_release\n"); in smc91c92_release()
959 if (link->resource[2]->end) { in smc91c92_release()
960 struct net_device *dev = link->priv; in smc91c92_release()
962 iounmap(smc->base); in smc91c92_release()
990 unsigned int addr = dev->base_addr + MGMT; in mdio_read()
995 for (i = 13; i >= 0; i--) { in mdio_read()
1000 for (i = 19; i > 0; i--) { in mdio_read()
1010 unsigned int addr = dev->base_addr + MGMT; in mdio_write()
1015 for (i = 31; i >= 0; i--) { in mdio_write()
1020 for (i = 1; i >= 0; i--) { in mdio_write()
1029 non-PCMCIA implementation.
1036 unsigned int ioaddr = dev->base_addr; in smc_dump()
1053 struct pcmcia_device *link = smc->p_dev; in smc_open()
1055 dev_dbg(&link->dev, "%s: smc_open(%p), ID/Window %4.4x.\n", in smc_open()
1056 dev->name, dev, inw(dev->base_addr + BANK_SELECT)); in smc_open()
1063 return -ENODEV; in smc_open()
1067 return -ENODEV; in smc_open()
1069 link->open++; in smc_open()
1072 smc->saved_skb = NULL; in smc_open()
1073 smc->packets_waiting = 0; in smc_open()
1076 timer_setup(&smc->media, media_check, 0); in smc_open()
1077 mod_timer(&smc->media, jiffies + HZ); in smc_open()
1087 struct pcmcia_device *link = smc->p_dev; in smc_close()
1088 unsigned int ioaddr = dev->base_addr; in smc_close()
1090 dev_dbg(&link->dev, "%s: smc_close(), status %4.4x.\n", in smc_close()
1091 dev->name, inw(ioaddr + BANK_SELECT)); in smc_close()
1103 /* Put the chip into power-down mode. */ in smc_close()
1107 link->open--; in smc_close()
1108 del_timer_sync(&smc->media); in smc_close()
1124 struct sk_buff *skb = smc->saved_skb; in smc_hardware_send_packet()
1125 unsigned int ioaddr = dev->base_addr; in smc_hardware_send_packet()
1140 smc->saved_skb = NULL; in smc_hardware_send_packet()
1145 dev->stats.tx_bytes += skb->len; in smc_hardware_send_packet()
1146 /* The card should use the just-allocated buffer. */ in smc_hardware_send_packet()
1154 u_char *buf = skb->data; in smc_hardware_send_packet()
1155 u_int length = skb->len; /* The chip will pad to ethernet min. */ in smc_hardware_send_packet()
1165 outw((length & 1) ? 0x2000 | buf[length-1] : 0, ioaddr + DATA_1); in smc_hardware_send_packet()
1176 smc->saved_skb = NULL; in smc_hardware_send_packet()
1187 unsigned int ioaddr = dev->base_addr; in smc_tx_timeout()
1191 dev->stats.tx_errors++; in smc_tx_timeout()
1194 smc->saved_skb = NULL; in smc_tx_timeout()
1202 unsigned int ioaddr = dev->base_addr; in smc_start_xmit()
1210 skb->len, inw(ioaddr + 2)); in smc_start_xmit()
1212 if (smc->saved_skb) { in smc_start_xmit()
1214 dev->stats.tx_aborted_errors++; in smc_start_xmit()
1215 netdev_dbg(dev, "Internal error -- sent packet while busy\n"); in smc_start_xmit()
1218 smc->saved_skb = skb; in smc_start_xmit()
1220 num_pages = skb->len >> 8; in smc_start_xmit()
1225 smc->saved_skb = NULL; in smc_start_xmit()
1226 dev->stats.tx_dropped++; in smc_start_xmit()
1227 return NETDEV_TX_OK; /* Do not re-queue this packet. */ in smc_start_xmit()
1230 smc->packets_waiting++; in smc_start_xmit()
1232 spin_lock_irqsave(&smc->lock, flags); in smc_start_xmit()
1236 if (smc->rx_ovrn) { in smc_start_xmit()
1238 smc->rx_ovrn = 0; in smc_start_xmit()
1243 for (time_out = MEMORY_WAIT_TIME; time_out >= 0; time_out--) { in smc_start_xmit()
1249 spin_unlock_irqrestore(&smc->lock, flags); in smc_start_xmit()
1254 /* Otherwise defer until the Tx-space-allocated interrupt. */ in smc_start_xmit()
1257 spin_unlock_irqrestore(&smc->lock, flags); in smc_start_xmit()
1271 unsigned int ioaddr = dev->base_addr; in smc_tx_err()
1284 dev->stats.tx_errors++; in smc_tx_err()
1285 if (tx_status & TS_LOSTCAR) dev->stats.tx_carrier_errors++; in smc_tx_err()
1286 if (tx_status & TS_LATCOL) dev->stats.tx_window_errors++; in smc_tx_err()
1288 dev->stats.tx_aborted_errors++; in smc_tx_err()
1289 smc->tx_err++; in smc_tx_err()
1295 /* re-enable transmit */ in smc_tx_err()
1297 outw(inw(ioaddr + TCR) | TCR_ENABLE | smc->duplex, ioaddr + TCR); in smc_tx_err()
1303 smc->packets_waiting--; in smc_tx_err()
1313 unsigned int ioaddr = dev->base_addr; in smc_eph_irq()
1320 /* Could be a counter roll-over warning: update stats. */ in smc_eph_irq()
1323 dev->stats.collisions += card_stats & 0xF; in smc_eph_irq()
1326 dev->stats.collisions += card_stats & 0xF; in smc_eph_irq()
1331 /* If we had a transmit error we must re-enable the transmitter. */ in smc_eph_irq()
1332 outw(inw(ioaddr + TCR) | TCR_ENABLE | smc->duplex, ioaddr + TCR); in smc_eph_irq()
1356 ioaddr = dev->base_addr; in smc_interrupt()
1361 spin_lock(&smc->lock); in smc_interrupt()
1362 smc->watchdog = 0; in smc_interrupt()
1365 /* The device does not exist -- the card could be off-line, or in smc_interrupt()
1367 netdev_dbg(dev, "SMC91c92 interrupt %d for non-existent/ejected device.\n", in smc_interrupt()
1400 dev->stats.tx_packets += smc->packets_waiting; in smc_interrupt()
1401 smc->packets_waiting = 0; in smc_interrupt()
1416 dev->stats.rx_errors++; in smc_interrupt()
1417 dev->stats.rx_fifo_errors++; in smc_interrupt()
1418 if (smc->duplex) in smc_interrupt()
1419 smc->rx_ovrn = 1; /* need MC_RESET outside smc_interrupt */ in smc_interrupt()
1424 } while (--bogus_cnt); in smc_interrupt()
1438 if ((smc->manfid == MANFID_OSITECH) && in smc_interrupt()
1439 (smc->cardid != PRODID_OSITECH_SEVEN)) { in smc_interrupt()
1441 mask_bits(0x00ff, ioaddr-0x10+OSITECH_RESET_ISR); in smc_interrupt()
1442 set_bits(0x0300, ioaddr-0x10+OSITECH_RESET_ISR); in smc_interrupt()
1444 if (smc->manfid == MANFID_MOTOROLA) { in smc_interrupt()
1446 cor = readb(smc->base + MOT_UART + CISREG_COR); in smc_interrupt()
1447 writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_UART + CISREG_COR); in smc_interrupt()
1448 writeb(cor, smc->base + MOT_UART + CISREG_COR); in smc_interrupt()
1449 cor = readb(smc->base + MOT_LAN + CISREG_COR); in smc_interrupt()
1450 writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_LAN + CISREG_COR); in smc_interrupt()
1451 writeb(cor, smc->base + MOT_LAN + CISREG_COR); in smc_interrupt()
1454 if ((smc->base != NULL) && /* Megahertz MFC's */ in smc_interrupt()
1455 (smc->manfid == MANFID_MEGAHERTZ) && in smc_interrupt()
1456 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) { in smc_interrupt()
1459 tmp = readb(smc->base+MEGAHERTZ_ISR); in smc_interrupt()
1460 tmp = readb(smc->base+MEGAHERTZ_ISR); in smc_interrupt()
1463 writeb(tmp, smc->base + MEGAHERTZ_ISR); in smc_interrupt()
1464 writeb(tmp, smc->base + MEGAHERTZ_ISR); in smc_interrupt()
1467 spin_unlock(&smc->lock); in smc_interrupt()
1475 unsigned int ioaddr = dev->base_addr; in smc_rx()
1505 dev->stats.rx_dropped++; in smc_rx()
1510 packet_length -= (rx_status & RS_ODDFRAME ? 5 : 6); in smc_rx()
1514 skb->protocol = eth_type_trans(skb, dev); in smc_rx()
1517 smc->last_rx = jiffies; in smc_rx()
1518 dev->stats.rx_packets++; in smc_rx()
1519 dev->stats.rx_bytes += packet_length; in smc_rx()
1521 dev->stats.multicast++; in smc_rx()
1524 dev->stats.rx_errors++; in smc_rx()
1526 if (rx_status & RS_ALGNERR) dev->stats.rx_frame_errors++; in smc_rx()
1528 dev->stats.rx_length_errors++; in smc_rx()
1529 if (rx_status & RS_BADCRC) dev->stats.rx_crc_errors++; in smc_rx()
1548 unsigned int ioaddr = dev->base_addr; in set_rx_mode()
1557 if (dev->flags & IFF_PROMISC) { in set_rx_mode()
1559 } else if (dev->flags & IFF_ALLMULTI) in set_rx_mode()
1566 u_int position = ether_crc(6, ha->addr); in set_rx_mode()
1574 spin_lock_irqsave(&smc->lock, flags); in set_rx_mode()
1581 spin_unlock_irqrestore(&smc->lock, flags); in set_rx_mode()
1593 if ((map->port != (u_char)(-1)) && (map->port != dev->if_port)) { in s9k_config()
1594 if (smc->cfg & CFG_MII_SELECT) in s9k_config()
1595 return -EOPNOTSUPP; in s9k_config()
1596 else if (map->port > 2) in s9k_config()
1597 return -EINVAL; in s9k_config()
1598 WRITE_ONCE(dev->if_port, map->port); in s9k_config()
1599 netdev_info(dev, "switched to %s port\n", if_names[dev->if_port]); in s9k_config()
1613 specified in dev->if_port.
1618 unsigned int ioaddr = dev->base_addr; in smc_set_xcvr()
1624 outw(smc->cfg | CFG_AUI_SELECT, ioaddr + CONFIG); in smc_set_xcvr()
1625 if ((smc->manfid == MANFID_OSITECH) && in smc_set_xcvr()
1626 (smc->cardid != PRODID_OSITECH_SEVEN)) in smc_set_xcvr()
1627 set_bits(OSI_AUI_PWR, ioaddr - 0x10 + OSITECH_AUI_PWR); in smc_set_xcvr()
1628 smc->media_status = ((dev->if_port == 0) ? 0x0001 : 0x0002); in smc_set_xcvr()
1630 outw(smc->cfg, ioaddr + CONFIG); in smc_set_xcvr()
1631 if ((smc->manfid == MANFID_OSITECH) && in smc_set_xcvr()
1632 (smc->cardid != PRODID_OSITECH_SEVEN)) in smc_set_xcvr()
1633 mask_bits(~OSI_AUI_PWR, ioaddr - 0x10 + OSITECH_AUI_PWR); in smc_set_xcvr()
1634 smc->media_status = ((dev->if_port == 0) ? 0x0012 : 0x4001); in smc_set_xcvr()
1641 unsigned int ioaddr = dev->base_addr; in smc_reset()
1659 No point in writing the I/O base register ;-> */ in smc_reset()
1665 smc_set_xcvr(dev, dev->if_port); in smc_reset()
1666 if ((smc->manfid == MANFID_OSITECH) && in smc_reset()
1667 (smc->cardid != PRODID_OSITECH_SEVEN)) in smc_reset()
1668 outw((dev->if_port == 2 ? OSI_AUI_PWR : 0) | in smc_reset()
1669 (inw(ioaddr-0x10+OSITECH_AUI_PWR) & 0xff00), in smc_reset()
1670 ioaddr - 0x10 + OSITECH_AUI_PWR); in smc_reset()
1674 outw((dev->dev_addr[i+1]<<8)+dev->dev_addr[i], in smc_reset()
1682 /* Re-enable the chip. */ in smc_reset()
1684 outw(((smc->cfg & CFG_MII_SELECT) ? 0 : TCR_MONCSN) | in smc_reset()
1685 TCR_ENABLE | TCR_PAD_EN | smc->duplex, ioaddr + TCR); in smc_reset()
1688 if (smc->cfg & CFG_MII_SELECT) { in smc_reset()
1692 mdio_write(dev, smc->mii_if.phy_id, 0, 0x8000); in smc_reset()
1695 mdio_write(dev, smc->mii_if.phy_id, 4, 0x01e1); in smc_reset()
1698 mdio_write(dev, smc->mii_if.phy_id, 0, 0x0000); in smc_reset()
1699 mdio_write(dev, smc->mii_if.phy_id, 0, 0x1200); in smc_reset()
1717 struct net_device *dev = smc->mii_if.dev; in media_check()
1718 unsigned int ioaddr = dev->base_addr; in media_check()
1723 spin_lock_irqsave(&smc->lock, flags); in media_check()
1733 if (smc->rx_ovrn) { in media_check()
1735 smc->rx_ovrn = 0; in media_check()
1744 spin_unlock_irqrestore(&smc->lock, flags); in media_check()
1748 if (smc->watchdog++ && ((i>>8) & i)) { in media_check()
1749 if (!smc->fast_poll) in media_check()
1752 smc_interrupt(dev->irq, dev); in media_check()
1754 smc->fast_poll = HZ; in media_check()
1756 if (smc->fast_poll) { in media_check()
1757 smc->fast_poll--; in media_check()
1758 smc->media.expires = jiffies + HZ/100; in media_check()
1759 add_timer(&smc->media); in media_check()
1763 spin_lock_irqsave(&smc->lock, flags); in media_check()
1767 if (smc->cfg & CFG_MII_SELECT) { in media_check()
1768 if (smc->mii_if.phy_id < 0) in media_check()
1772 link = mdio_read(dev, smc->mii_if.phy_id, 1); in media_check()
1775 smc->mii_if.phy_id = -1; in media_check()
1780 if (link != smc->link_status) { in media_check()
1781 u_short p = mdio_read(dev, smc->mii_if.phy_id, 5); in media_check()
1783 smc->duplex = (((p & 0x0100) || ((p & 0x1c0) == 0x40)) in media_check()
1787 "%dbaseT-%cD selected\n", in media_check()
1788 (p & 0x0180) ? 100 : 10, smc->duplex ? 'F' : 'H'); in media_check()
1791 outw(inw(ioaddr + TCR) | smc->duplex, ioaddr + TCR); in media_check()
1792 smc->link_status = link; in media_check()
1798 if (time_after(jiffies, smc->last_rx + HZ)) { in media_check()
1799 if (smc->tx_err || (smc->media_status & EPH_16COL)) in media_check()
1802 smc->tx_err = 0; in media_check()
1804 if (media != smc->media_status) { in media_check()
1805 if ((media & smc->media_status & 1) && in media_check()
1806 ((smc->media_status ^ media) & EPH_LINK_OK)) in media_check()
1808 smc->media_status & EPH_LINK_OK ? "lost" : "found"); in media_check()
1809 else if ((media & smc->media_status & 2) && in media_check()
1810 ((smc->media_status ^ media) & EPH_16COL)) in media_check()
1813 if (dev->if_port == 0) { in media_check()
1826 smc->media_status = media; in media_check()
1830 smc->media.expires = jiffies + HZ; in media_check()
1831 add_timer(&smc->media); in media_check()
1833 spin_unlock_irqrestore(&smc->lock, flags); in media_check()
1838 unsigned int ioaddr = dev->base_addr; in smc_link_ok()
1841 if (smc->cfg & CFG_MII_SELECT) { in smc_link_ok()
1842 return mii_link_ok(&smc->mii_if); in smc_link_ok()
1853 unsigned int ioaddr = dev->base_addr; in smc_netdev_get_ecmd()
1861 ecmd->base.port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP; in smc_netdev_get_ecmd()
1862 ecmd->base.speed = SPEED_10; in smc_netdev_get_ecmd()
1863 ecmd->base.phy_address = ioaddr + MGMT; in smc_netdev_get_ecmd()
1867 ecmd->base.duplex = (tmp & TCR_FDUPLX) ? DUPLEX_FULL : DUPLEX_HALF; in smc_netdev_get_ecmd()
1869 ethtool_convert_legacy_u32_to_link_mode(ecmd->link_modes.supported, in smc_netdev_get_ecmd()
1877 unsigned int ioaddr = dev->base_addr; in smc_netdev_set_ecmd()
1879 if (ecmd->base.speed != SPEED_10) in smc_netdev_set_ecmd()
1880 return -EINVAL; in smc_netdev_set_ecmd()
1881 if (ecmd->base.duplex != DUPLEX_HALF && in smc_netdev_set_ecmd()
1882 ecmd->base.duplex != DUPLEX_FULL) in smc_netdev_set_ecmd()
1883 return -EINVAL; in smc_netdev_set_ecmd()
1884 if (ecmd->base.port != PORT_TP && ecmd->base.port != PORT_AUI) in smc_netdev_set_ecmd()
1885 return -EINVAL; in smc_netdev_set_ecmd()
1887 if (ecmd->base.port == PORT_AUI) in smc_netdev_set_ecmd()
1894 if (ecmd->base.duplex == DUPLEX_FULL) in smc_netdev_set_ecmd()
1906 return -EINVAL; in check_if_running()
1912 strscpy(info->driver, DRV_NAME, sizeof(info->driver)); in smc_get_drvinfo()
1913 strscpy(info->version, DRV_VERSION, sizeof(info->version)); in smc_get_drvinfo()
1920 unsigned int ioaddr = dev->base_addr; in smc_get_link_ksettings()
1924 spin_lock_irqsave(&smc->lock, flags); in smc_get_link_ksettings()
1926 if (smc->cfg & CFG_MII_SELECT) in smc_get_link_ksettings()
1927 mii_ethtool_get_link_ksettings(&smc->mii_if, ecmd); in smc_get_link_ksettings()
1931 spin_unlock_irqrestore(&smc->lock, flags); in smc_get_link_ksettings()
1939 unsigned int ioaddr = dev->base_addr; in smc_set_link_ksettings()
1944 spin_lock_irqsave(&smc->lock, flags); in smc_set_link_ksettings()
1946 if (smc->cfg & CFG_MII_SELECT) in smc_set_link_ksettings()
1947 ret = mii_ethtool_set_link_ksettings(&smc->mii_if, ecmd); in smc_set_link_ksettings()
1951 spin_unlock_irqrestore(&smc->lock, flags); in smc_set_link_ksettings()
1958 unsigned int ioaddr = dev->base_addr; in smc_get_link()
1963 spin_lock_irqsave(&smc->lock, flags); in smc_get_link()
1967 spin_unlock_irqrestore(&smc->lock, flags); in smc_get_link()
1974 if (smc->cfg & CFG_MII_SELECT) { in smc_nway_reset()
1975 unsigned int ioaddr = dev->base_addr; in smc_nway_reset()
1980 res = mii_nway_restart(&smc->mii_if); in smc_nway_reset()
1985 return -EOPNOTSUPP; in smc_nway_reset()
2003 unsigned int ioaddr = dev->base_addr; in smc_ioctl()
2007 return -EINVAL; in smc_ioctl()
2009 spin_lock_irqsave(&smc->lock, flags); in smc_ioctl()
2012 rc = generic_mii_ioctl(&smc->mii_if, mii, cmd, NULL); in smc_ioctl()
2014 spin_unlock_irqrestore(&smc->lock, flags); in smc_ioctl()
2033 PCMCIA_DEVICE_PROD_ID12("dit Co., Ltd.", "PC Card-10/100BTX", 0xe59365c8, 0x6a2161d1),
2037 PCMCIA_DEVICE_PROD_ID12("MELCO/SMC", "LPC-TX", 0xa2cd8e6d, 0x42da662a),