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

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * (C) Copyright 1997-1998 DAVICOM Semiconductor,Inc. All Rights Reserved.
39 /* Board/System/Debug information/definition ---------------- */
57 MODULE_PARM_DESC(debug, "dm9000 debug level (0-6)");
87 /* Structure/enum declaration ------------------------------- */
143 dev_dbg(db->dev, msg); \
152 /* DM9000 network board routine ---------------------------- */
160 writeb(reg, db->io_addr); in ior()
161 return readb(db->io_data); in ior()
171 writeb(reg, db->io_addr); in iow()
172 writeb(value, db->io_data); in iow()
178 dev_dbg(db->dev, "resetting device\n"); in dm9000_reset()
180 /* Reset DM9000, see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 in dm9000_reset()
182 * instruction is to set LBK into MAC internal loopback mode. in dm9000_reset()
187 dev_err(db->dev, "dm9000 did not respond to first reset\n"); in dm9000_reset()
193 dev_err(db->dev, "dm9000 did not respond to second reset\n"); in dm9000_reset()
267 if (db->in_suspend || db->in_timeout) in dm9000_msleep()
282 mutex_lock(&db->addr_lock); in dm9000_phy_read()
284 spin_lock_irqsave(&db->lock, flags); in dm9000_phy_read()
287 reg_save = readb(db->io_addr); in dm9000_phy_read()
295 writeb(reg_save, db->io_addr); in dm9000_phy_read()
296 spin_unlock_irqrestore(&db->lock, flags); in dm9000_phy_read()
300 spin_lock_irqsave(&db->lock, flags); in dm9000_phy_read()
301 reg_save = readb(db->io_addr); in dm9000_phy_read()
309 writeb(reg_save, db->io_addr); in dm9000_phy_read()
310 spin_unlock_irqrestore(&db->lock, flags); in dm9000_phy_read()
312 mutex_unlock(&db->addr_lock); in dm9000_phy_read()
314 dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret); in dm9000_phy_read()
328 if (!db->in_timeout) in dm9000_phy_write()
329 mutex_lock(&db->addr_lock); in dm9000_phy_write()
331 spin_lock_irqsave(&db->lock, flags); in dm9000_phy_write()
334 reg_save = readb(db->io_addr); in dm9000_phy_write()
346 writeb(reg_save, db->io_addr); in dm9000_phy_write()
347 spin_unlock_irqrestore(&db->lock, flags); in dm9000_phy_write()
351 spin_lock_irqsave(&db->lock, flags); in dm9000_phy_write()
352 reg_save = readb(db->io_addr); in dm9000_phy_write()
357 writeb(reg_save, db->io_addr); in dm9000_phy_write()
359 spin_unlock_irqrestore(&db->lock, flags); in dm9000_phy_write()
360 if (!db->in_timeout) in dm9000_phy_write()
361 mutex_unlock(&db->addr_lock); in dm9000_phy_write()
378 db->dumpblk = dm9000_dumpblk_8bit; in dm9000_set_io()
379 db->outblk = dm9000_outblk_8bit; in dm9000_set_io()
380 db->inblk = dm9000_inblk_8bit; in dm9000_set_io()
385 dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit\n"); in dm9000_set_io()
388 db->dumpblk = dm9000_dumpblk_16bit; in dm9000_set_io()
389 db->outblk = dm9000_outblk_16bit; in dm9000_set_io()
390 db->inblk = dm9000_inblk_16bit; in dm9000_set_io()
395 db->dumpblk = dm9000_dumpblk_32bit; in dm9000_set_io()
396 db->outblk = dm9000_outblk_32bit; in dm9000_set_io()
397 db->inblk = dm9000_inblk_32bit; in dm9000_set_io()
404 if (db->type == TYPE_DM9000E) in dm9000_schedule_poll()
405 schedule_delayed_work(&db->phy_poll, HZ * 2); in dm9000_schedule_poll()
413 return -EINVAL; in dm9000_ioctl()
415 return generic_mii_ioctl(&dm->mii, if_mii(req), cmd, NULL); in dm9000_ioctl()
424 spin_lock_irqsave(&db->lock, flags); in dm9000_read_locked()
426 spin_unlock_irqrestore(&db->lock, flags); in dm9000_read_locked()
455 if (timeout-- < 0) { in dm9000_wait_eeprom()
456 dev_dbg(db->dev, "timeout waiting EEPROM\n"); in dm9000_wait_eeprom()
472 if (db->flags & DM9000_PLATF_NO_EEPROM) { in dm9000_read_eeprom()
478 mutex_lock(&db->addr_lock); in dm9000_read_eeprom()
480 spin_lock_irqsave(&db->lock, flags); in dm9000_read_eeprom()
485 spin_unlock_irqrestore(&db->lock, flags); in dm9000_read_eeprom()
489 /* delay for at-least 150uS */ in dm9000_read_eeprom()
492 spin_lock_irqsave(&db->lock, flags); in dm9000_read_eeprom()
499 spin_unlock_irqrestore(&db->lock, flags); in dm9000_read_eeprom()
501 mutex_unlock(&db->addr_lock); in dm9000_read_eeprom()
505 * Write a word data to SROM
512 if (db->flags & DM9000_PLATF_NO_EEPROM) in dm9000_write_eeprom()
515 mutex_lock(&db->addr_lock); in dm9000_write_eeprom()
517 spin_lock_irqsave(&db->lock, flags); in dm9000_write_eeprom()
522 spin_unlock_irqrestore(&db->lock, flags); in dm9000_write_eeprom()
528 spin_lock_irqsave(&db->lock, flags); in dm9000_write_eeprom()
530 spin_unlock_irqrestore(&db->lock, flags); in dm9000_write_eeprom()
532 mutex_unlock(&db->addr_lock); in dm9000_write_eeprom()
542 strscpy(info->driver, CARDNAME, sizeof(info->driver)); in dm9000_get_drvinfo()
543 strscpy(info->bus_info, to_platform_device(dm->dev)->name, in dm9000_get_drvinfo()
544 sizeof(info->bus_info)); in dm9000_get_drvinfo()
551 return dm->msg_enable; in dm9000_get_msglevel()
558 dm->msg_enable = value; in dm9000_set_msglevel()
566 mii_ethtool_get_link_ksettings(&dm->mii, cmd); in dm9000_get_link_ksettings()
575 return mii_ethtool_set_link_ksettings(&dm->mii, cmd); in dm9000_set_link_ksettings()
581 return mii_nway_restart(&dm->mii); in dm9000_nway_reset()
588 netdev_features_t changed = dev->features ^ features; in dm9000_set_features()
594 spin_lock_irqsave(&dm->lock, flags); in dm9000_set_features()
596 spin_unlock_irqrestore(&dm->lock, flags); in dm9000_set_features()
606 if (dm->flags & DM9000_PLATF_EXT_PHY) in dm9000_get_link()
607 ret = mii_link_ok(&dm->mii); in dm9000_get_link()
625 int offset = ee->offset; in dm9000_get_eeprom()
626 int len = ee->len; in dm9000_get_eeprom()
632 return -EINVAL; in dm9000_get_eeprom()
634 if (dm->flags & DM9000_PLATF_NO_EEPROM) in dm9000_get_eeprom()
635 return -ENOENT; in dm9000_get_eeprom()
637 ee->magic = DM_EEPROM_MAGIC; in dm9000_get_eeprom()
649 int offset = ee->offset; in dm9000_set_eeprom()
650 int len = ee->len; in dm9000_set_eeprom()
655 if (dm->flags & DM9000_PLATF_NO_EEPROM) in dm9000_set_eeprom()
656 return -ENOENT; in dm9000_set_eeprom()
658 if (ee->magic != DM_EEPROM_MAGIC) in dm9000_set_eeprom()
659 return -EINVAL; in dm9000_set_eeprom()
678 len -= done; in dm9000_set_eeprom()
690 /* note, we could probably support wake-phy too */ in dm9000_get_wol()
691 w->supported = dm->wake_supported ? WAKE_MAGIC : 0; in dm9000_get_wol()
692 w->wolopts = dm->wake_state; in dm9000_get_wol()
699 u32 opts = w->wolopts; in dm9000_set_wol()
702 if (!dm->wake_supported) in dm9000_set_wol()
703 return -EOPNOTSUPP; in dm9000_set_wol()
706 return -EINVAL; in dm9000_set_wol()
711 mutex_lock(&dm->addr_lock); in dm9000_set_wol()
713 spin_lock_irqsave(&dm->lock, flags); in dm9000_set_wol()
715 spin_unlock_irqrestore(&dm->lock, flags); in dm9000_set_wol()
717 mutex_unlock(&dm->addr_lock); in dm9000_set_wol()
719 if (dm->wake_state != opts) { in dm9000_set_wol()
722 if (!dm->wake_state) in dm9000_set_wol()
723 irq_set_irq_wake(dm->irq_wake, 1); in dm9000_set_wol()
724 else if (dm->wake_state && !opts) in dm9000_set_wol()
725 irq_set_irq_wake(dm->irq_wake, 0); in dm9000_set_wol()
728 dm->wake_state = opts; in dm9000_set_wol()
751 struct net_device *ndev = db->ndev; in dm9000_show_carrier()
752 struct mii_if_info *mii = &db->mii; in dm9000_show_carrier()
756 lpa = mii->mdio_read(mii->dev, mii->phy_id, MII_LPA); in dm9000_show_carrier()
757 dev_info(db->dev, in dm9000_show_carrier()
758 "%s: link up, %dMbps, %s-duplex, lpa 0x%04X\n", in dm9000_show_carrier()
759 ndev->name, (nsr & NSR_SPEED) ? 10 : 100, in dm9000_show_carrier()
762 dev_info(db->dev, "%s: link down\n", ndev->name); in dm9000_show_carrier()
771 struct net_device *ndev = db->ndev; in dm9000_poll_work()
773 if (db->flags & DM9000_PLATF_SIMPLE_PHY && in dm9000_poll_work()
774 !(db->flags & DM9000_PLATF_EXT_PHY)) { in dm9000_poll_work()
791 mii_check_media(&db->mii, netif_msg_link(db), 0); in dm9000_poll_work()
807 iounmap(db->io_addr); in dm9000_release_board()
808 iounmap(db->io_data); in dm9000_release_board()
812 if (db->data_req) in dm9000_release_board()
813 release_resource(db->data_req); in dm9000_release_board()
814 kfree(db->data_req); in dm9000_release_board()
816 if (db->addr_req) in dm9000_release_board()
817 release_resource(db->addr_req); in dm9000_release_board()
818 kfree(db->addr_req); in dm9000_release_board()
848 iow(db, oft, dev->dev_addr[i]); in dm9000_hash_table_unlocked()
850 if (dev->flags & IFF_PROMISC) in dm9000_hash_table_unlocked()
853 if (dev->flags & IFF_ALLMULTI) in dm9000_hash_table_unlocked()
858 hash_val = ether_crc_le(6, ha->addr) & 0x3f; in dm9000_hash_table_unlocked()
877 spin_lock_irqsave(&db->lock, flags); in dm9000_hash_table()
879 spin_unlock_irqrestore(&db->lock, flags); in dm9000_hash_table()
891 iow(db, DM9000_IMR, db->imr_all); in dm9000_unmask_interrupts()
909 /* I/O mode */ in dm9000_init_dm9000()
910 db->io_mode = ior(db, DM9000_ISR) >> 6; /* ISR bit7:6 keeps I/O mode */ in dm9000_init_dm9000()
912 /* Checksum mode */ in dm9000_init_dm9000()
913 if (dev->hw_features & NETIF_F_RXCSUM) in dm9000_init_dm9000()
915 (dev->features & NETIF_F_RXCSUM) ? RCSR_CSUM : 0); in dm9000_init_dm9000()
923 if (db->type == TYPE_DM9000B) { in dm9000_init_dm9000()
928 ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; in dm9000_init_dm9000()
932 * a wake-mask in DM9000_WCR */ in dm9000_init_dm9000()
933 if (db->wake_supported) in dm9000_init_dm9000()
942 iow(db, DM9000_SMCR, 0); /* Special Mode */ in dm9000_init_dm9000()
951 if (db->type != TYPE_DM9000E) in dm9000_init_dm9000()
954 db->imr_all = imr; in dm9000_init_dm9000()
957 db->tx_pkt_cnt = 0; in dm9000_init_dm9000()
958 db->queue_pkt_len = 0; in dm9000_init_dm9000()
970 spin_lock_irqsave(&db->lock, flags); in dm9000_timeout()
971 db->in_timeout = 1; in dm9000_timeout()
972 reg_save = readb(db->io_addr); in dm9000_timeout()
982 writeb(reg_save, db->io_addr); in dm9000_timeout()
983 db->in_timeout = 0; in dm9000_timeout()
984 spin_unlock_irqrestore(&db->lock, flags); in dm9000_timeout()
994 if (dm->ip_summed != ip_summed) { in dm9000_send_packet()
999 dm->ip_summed = ip_summed; in dm9000_send_packet()
1022 if (db->tx_pkt_cnt > 1) in dm9000_start_xmit()
1025 spin_lock_irqsave(&db->lock, flags); in dm9000_start_xmit()
1028 writeb(DM9000_MWCMD, db->io_addr); in dm9000_start_xmit()
1030 (db->outblk)(db->io_data, skb->data, skb->len); in dm9000_start_xmit()
1031 dev->stats.tx_bytes += skb->len; in dm9000_start_xmit()
1033 db->tx_pkt_cnt++; in dm9000_start_xmit()
1035 if (db->tx_pkt_cnt == 1) { in dm9000_start_xmit()
1036 dm9000_send_packet(dev, skb->ip_summed, skb->len); in dm9000_start_xmit()
1039 db->queue_pkt_len = skb->len; in dm9000_start_xmit()
1040 db->queue_ip_summed = skb->ip_summed; in dm9000_start_xmit()
1044 spin_unlock_irqrestore(&db->lock, flags); in dm9000_start_xmit()
1063 db->tx_pkt_cnt--; in dm9000_tx_done()
1064 dev->stats.tx_packets++; in dm9000_tx_done()
1067 dev_dbg(db->dev, "tx done, NSR %02x\n", tx_status); in dm9000_tx_done()
1070 if (db->tx_pkt_cnt > 0) in dm9000_tx_done()
1071 dm9000_send_packet(dev, db->queue_ip_summed, in dm9000_tx_done()
1072 db->queue_pkt_len); in dm9000_tx_done()
1101 rxbyte = readb(db->io_data); in dm9000_rx()
1105 dev_warn(db->dev, "status check fail: %d\n", rxbyte); in dm9000_rx()
1115 writeb(DM9000_MRCMD, db->io_addr); in dm9000_rx()
1117 (db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr)); in dm9000_rx()
1122 dev_dbg(db->dev, "RX: status %02x, length %04x\n", in dm9000_rx()
1129 dev_dbg(db->dev, "RX: Bad Packet (runt)\n"); in dm9000_rx()
1133 dev_dbg(db->dev, "RST: RX Len:%x\n", RxLen); in dm9000_rx()
1143 dev_dbg(db->dev, "fifo error\n"); in dm9000_rx()
1144 dev->stats.rx_fifo_errors++; in dm9000_rx()
1148 dev_dbg(db->dev, "crc error\n"); in dm9000_rx()
1149 dev->stats.rx_crc_errors++; in dm9000_rx()
1153 dev_dbg(db->dev, "length error\n"); in dm9000_rx()
1154 dev->stats.rx_length_errors++; in dm9000_rx()
1162 rdptr = skb_put(skb, RxLen - 4); in dm9000_rx()
1166 (db->inblk)(db->io_data, rdptr, RxLen); in dm9000_rx()
1167 dev->stats.rx_bytes += RxLen; in dm9000_rx()
1170 skb->protocol = eth_type_trans(skb, dev); in dm9000_rx()
1171 if (dev->features & NETIF_F_RXCSUM) { in dm9000_rx()
1173 skb->ip_summed = CHECKSUM_UNNECESSARY; in dm9000_rx()
1178 dev->stats.rx_packets++; in dm9000_rx()
1183 (db->dumpblk)(db->io_data, RxLen); in dm9000_rx()
1200 /* holders of db->lock must always block IRQs */ in dm9000_interrupt()
1201 spin_lock_irqsave(&db->lock, flags); in dm9000_interrupt()
1204 reg_save = readb(db->io_addr); in dm9000_interrupt()
1212 dev_dbg(db->dev, "interrupt status %02x\n", int_status); in dm9000_interrupt()
1222 if (db->type != TYPE_DM9000E) { in dm9000_interrupt()
1224 /* fire a link-change request */ in dm9000_interrupt()
1225 schedule_delayed_work(&db->phy_poll, 1); in dm9000_interrupt()
1231 writeb(reg_save, db->io_addr); in dm9000_interrupt()
1233 spin_unlock_irqrestore(&db->lock, flags); in dm9000_interrupt()
1245 spin_lock_irqsave(&db->lock, flags); in dm9000_wol_interrupt()
1250 dev_dbg(db->dev, "%s: NSR=0x%02x, WCR=0x%02x\n", __func__, nsr, wcr); in dm9000_wol_interrupt()
1257 dev_info(db->dev, "wake by link status change\n"); in dm9000_wol_interrupt()
1259 dev_info(db->dev, "wake by sample packet\n"); in dm9000_wol_interrupt()
1261 dev_info(db->dev, "wake by magic packet\n"); in dm9000_wol_interrupt()
1263 dev_err(db->dev, "wake signalled with no reason? " in dm9000_wol_interrupt()
1267 spin_unlock_irqrestore(&db->lock, flags); in dm9000_wol_interrupt()
1278 disable_irq(dev->irq); in dm9000_poll_controller()
1279 dm9000_interrupt(dev->irq, dev); in dm9000_poll_controller()
1280 enable_irq(dev->irq); in dm9000_poll_controller()
1292 unsigned int irq_flags = irq_get_trigger_type(dev->irq); in dm9000_open()
1295 dev_dbg(db->dev, "enabling %s\n", dev->name); in dm9000_open()
1301 dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n"); in dm9000_open()
1305 /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */ in dm9000_open()
1312 if (request_irq(dev->irq, dm9000_interrupt, irq_flags, dev->name, dev)) in dm9000_open()
1313 return -EAGAIN; in dm9000_open()
1320 db->dbug_cnt = 0; in dm9000_open()
1322 mii_check_media(&db->mii, netif_msg_link(db), 1); in dm9000_open()
1326 schedule_delayed_work(&db->phy_poll, 1); in dm9000_open()
1338 iow(db, DM9000_GPR, 0x01); /* Power-Down PHY */ in dm9000_shutdown()
1353 dev_dbg(db->dev, "shutting down %s\n", ndev->name); in dm9000_stop()
1355 cancel_delayed_work_sync(&db->phy_poll); in dm9000_stop()
1361 free_irq(ndev->irq, ndev); in dm9000_stop()
1386 struct device_node *np = dev->of_node; in dm9000_parse_dt()
1390 return ERR_PTR(-ENXIO); in dm9000_parse_dt()
1394 return ERR_PTR(-ENOMEM); in dm9000_parse_dt()
1396 if (of_find_property(np, "davicom,ext-phy", NULL)) in dm9000_parse_dt()
1397 pdata->flags |= DM9000_PLATF_EXT_PHY; in dm9000_parse_dt()
1398 if (of_find_property(np, "davicom,no-eeprom", NULL)) in dm9000_parse_dt()
1399 pdata->flags |= DM9000_PLATF_NO_EEPROM; in dm9000_parse_dt()
1401 ret = of_get_mac_address(np, pdata->dev_addr); in dm9000_parse_dt()
1402 if (ret == -EPROBE_DEFER) in dm9000_parse_dt()
1414 struct dm9000_plat_data *pdata = dev_get_platdata(&pdev->dev); in dm9000_probe()
1417 struct device *dev = &pdev->dev; in dm9000_probe()
1430 if (PTR_ERR(power) == -EPROBE_DEFER) in dm9000_probe()
1431 return -EPROBE_DEFER; in dm9000_probe()
1466 pdata = dm9000_parse_dt(&pdev->dev); in dm9000_probe()
1476 ret = -ENOMEM; in dm9000_probe()
1480 SET_NETDEV_DEV(ndev, &pdev->dev); in dm9000_probe()
1482 dev_dbg(&pdev->dev, "dm9000_probe()\n"); in dm9000_probe()
1487 db->dev = &pdev->dev; in dm9000_probe()
1488 db->ndev = ndev; in dm9000_probe()
1490 db->power_supply = power; in dm9000_probe()
1492 spin_lock_init(&db->lock); in dm9000_probe()
1493 mutex_init(&db->addr_lock); in dm9000_probe()
1495 INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work); in dm9000_probe()
1497 db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); in dm9000_probe()
1498 db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); in dm9000_probe()
1500 if (!db->addr_res || !db->data_res) { in dm9000_probe()
1501 dev_err(db->dev, "insufficient resources addr=%p data=%p\n", in dm9000_probe()
1502 db->addr_res, db->data_res); in dm9000_probe()
1503 ret = -ENOENT; in dm9000_probe()
1507 ndev->irq = platform_get_irq(pdev, 0); in dm9000_probe()
1508 if (ndev->irq < 0) { in dm9000_probe()
1509 ret = ndev->irq; in dm9000_probe()
1513 db->irq_wake = platform_get_irq_optional(pdev, 1); in dm9000_probe()
1514 if (db->irq_wake >= 0) { in dm9000_probe()
1515 dev_dbg(db->dev, "wakeup irq %d\n", db->irq_wake); in dm9000_probe()
1517 ret = request_irq(db->irq_wake, dm9000_wol_interrupt, in dm9000_probe()
1518 IRQF_SHARED, dev_name(db->dev), ndev); in dm9000_probe()
1520 dev_err(db->dev, "cannot get wakeup irq (%d)\n", ret); in dm9000_probe()
1524 ret = irq_set_irq_wake(db->irq_wake, 1); in dm9000_probe()
1526 dev_err(db->dev, "irq %d cannot set wakeup (%d)\n", in dm9000_probe()
1527 db->irq_wake, ret); in dm9000_probe()
1529 irq_set_irq_wake(db->irq_wake, 0); in dm9000_probe()
1530 db->wake_supported = 1; in dm9000_probe()
1535 iosize = resource_size(db->addr_res); in dm9000_probe()
1536 db->addr_req = request_mem_region(db->addr_res->start, iosize, in dm9000_probe()
1537 pdev->name); in dm9000_probe()
1539 if (db->addr_req == NULL) { in dm9000_probe()
1540 dev_err(db->dev, "cannot claim address reg area\n"); in dm9000_probe()
1541 ret = -EIO; in dm9000_probe()
1545 db->io_addr = ioremap(db->addr_res->start, iosize); in dm9000_probe()
1547 if (db->io_addr == NULL) { in dm9000_probe()
1548 dev_err(db->dev, "failed to ioremap address reg\n"); in dm9000_probe()
1549 ret = -EINVAL; in dm9000_probe()
1553 iosize = resource_size(db->data_res); in dm9000_probe()
1554 db->data_req = request_mem_region(db->data_res->start, iosize, in dm9000_probe()
1555 pdev->name); in dm9000_probe()
1557 if (db->data_req == NULL) { in dm9000_probe()
1558 dev_err(db->dev, "cannot claim data reg area\n"); in dm9000_probe()
1559 ret = -EIO; in dm9000_probe()
1563 db->io_data = ioremap(db->data_res->start, iosize); in dm9000_probe()
1565 if (db->io_data == NULL) { in dm9000_probe()
1566 dev_err(db->dev, "failed to ioremap data reg\n"); in dm9000_probe()
1567 ret = -EINVAL; in dm9000_probe()
1571 /* fill in parameters for net-dev structure */ in dm9000_probe()
1572 ndev->base_addr = (unsigned long)db->io_addr; in dm9000_probe()
1577 /* check to see if anything is being over-ridden */ in dm9000_probe()
1579 /* check to see if the driver wants to over-ride the in dm9000_probe()
1582 if (pdata->flags & DM9000_PLATF_8BITONLY) in dm9000_probe()
1585 if (pdata->flags & DM9000_PLATF_16BITONLY) in dm9000_probe()
1588 if (pdata->flags & DM9000_PLATF_32BITONLY) in dm9000_probe()
1592 * over-rides */ in dm9000_probe()
1594 if (pdata->inblk != NULL) in dm9000_probe()
1595 db->inblk = pdata->inblk; in dm9000_probe()
1597 if (pdata->outblk != NULL) in dm9000_probe()
1598 db->outblk = pdata->outblk; in dm9000_probe()
1600 if (pdata->dumpblk != NULL) in dm9000_probe()
1601 db->dumpblk = pdata->dumpblk; in dm9000_probe()
1603 db->flags = pdata->flags; in dm9000_probe()
1607 db->flags |= DM9000_PLATF_SIMPLE_PHY; in dm9000_probe()
1621 dev_err(db->dev, "read wrong id 0x%08x\n", id_val); in dm9000_probe()
1625 dev_err(db->dev, "wrong id: 0x%08x\n", id_val); in dm9000_probe()
1626 ret = -ENODEV; in dm9000_probe()
1633 dev_dbg(db->dev, "dm9000 revision 0x%02x\n", id_val); in dm9000_probe()
1637 db->type = TYPE_DM9000A; in dm9000_probe()
1640 db->type = TYPE_DM9000B; in dm9000_probe()
1643 dev_dbg(db->dev, "ID %02x => defaulting to DM9000E\n", id_val); in dm9000_probe()
1644 db->type = TYPE_DM9000E; in dm9000_probe()
1648 if (db->type == TYPE_DM9000A || db->type == TYPE_DM9000B) { in dm9000_probe()
1649 ndev->hw_features = NETIF_F_RXCSUM | NETIF_F_IP_CSUM; in dm9000_probe()
1650 ndev->features |= ndev->hw_features; in dm9000_probe()
1655 ndev->netdev_ops = &dm9000_netdev_ops; in dm9000_probe()
1656 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); in dm9000_probe()
1657 ndev->ethtool_ops = &dm9000_ethtool_ops; in dm9000_probe()
1659 db->msg_enable = NETIF_MSG_LINK; in dm9000_probe()
1660 db->mii.phy_id_mask = 0x1f; in dm9000_probe()
1661 db->mii.reg_num_mask = 0x1f; in dm9000_probe()
1662 db->mii.force_media = 0; in dm9000_probe()
1663 db->mii.full_duplex = 0; in dm9000_probe()
1664 db->mii.dev = ndev; in dm9000_probe()
1665 db->mii.mdio_read = dm9000_phy_read; in dm9000_probe()
1666 db->mii.mdio_write = dm9000_phy_write; in dm9000_probe()
1675 if (!is_valid_ether_addr(ndev->dev_addr) && pdata != NULL) { in dm9000_probe()
1677 eth_hw_addr_set(ndev, pdata->dev_addr); in dm9000_probe()
1680 if (!is_valid_ether_addr(ndev->dev_addr)) { in dm9000_probe()
1686 eth_hw_addr_set(ndev, pdata->dev_addr); in dm9000_probe()
1689 if (!is_valid_ether_addr(ndev->dev_addr)) { in dm9000_probe()
1701 dev_warn(db->dev, "%s: Invalid ethernet MAC address. Please set using ip\n", in dm9000_probe()
1702 ndev->name); in dm9000_probe()
1704 ndev->name, dm9000_type_to_char(db->type), in dm9000_probe()
1705 db->io_addr, db->io_data, ndev->irq, in dm9000_probe()
1706 ndev->dev_addr, mac_src); in dm9000_probe()
1711 dev_err(db->dev, "not found (%d).\n", ret); in dm9000_probe()
1731 db->in_suspend = 1; in dm9000_drv_suspend()
1739 if (!db->wake_state) in dm9000_drv_suspend()
1753 /* reset if we were not in wake mode to ensure if in dm9000_drv_resume()
1755 if (!db->wake_state) { in dm9000_drv_resume()
1763 db->in_suspend = 0; in dm9000_drv_resume()
1782 if (dm->power_supply) in dm9000_drv_remove()
1783 regulator_disable(dm->power_supply); in dm9000_drv_remove()
1785 dev_dbg(&pdev->dev, "released and freed device\n"); in dm9000_drv_remove()