Lines Matching refs:db
150 #define dm9000_dbg(db, lev, msg...) do { \ argument
152 dev_dbg(db->dev, msg); \
167 ior(struct board_info *db, int reg) in ior() argument
169 writeb(reg, db->io_addr); in ior()
170 return readb(db->io_data); in ior()
178 iow(struct board_info *db, int reg, int value) in iow() argument
180 writeb(reg, db->io_addr); in iow()
181 writeb(value, db->io_data); in iow()
185 dm9000_reset(struct board_info *db) in dm9000_reset() argument
187 dev_dbg(db->dev, "resetting device\n"); in dm9000_reset()
193 iow(db, DM9000_NCR, NCR_RST | NCR_MAC_LBK); in dm9000_reset()
195 if (ior(db, DM9000_NCR) & 1) in dm9000_reset()
196 dev_err(db->dev, "dm9000 did not respond to first reset\n"); in dm9000_reset()
198 iow(db, DM9000_NCR, 0); in dm9000_reset()
199 iow(db, DM9000_NCR, NCR_RST | NCR_MAC_LBK); in dm9000_reset()
201 if (ior(db, DM9000_NCR) & 1) in dm9000_reset()
202 dev_err(db->dev, "dm9000 did not respond to second reset\n"); in dm9000_reset()
277 static void dm9000_msleep(struct board_info *db, unsigned int ms) in dm9000_msleep() argument
279 if (db->in_suspend || db->in_timeout) in dm9000_msleep()
289 struct board_info *db = netdev_priv(dev); in dm9000_phy_read() local
294 mutex_lock(&db->addr_lock); in dm9000_phy_read()
296 spin_lock_irqsave(&db->lock, flags); in dm9000_phy_read()
299 reg_save = readb(db->io_addr); in dm9000_phy_read()
302 iow(db, DM9000_EPAR, DM9000_PHY | reg); in dm9000_phy_read()
305 iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); in dm9000_phy_read()
307 writeb(reg_save, db->io_addr); in dm9000_phy_read()
308 spin_unlock_irqrestore(&db->lock, flags); in dm9000_phy_read()
310 dm9000_msleep(db, 1); /* Wait read complete */ in dm9000_phy_read()
312 spin_lock_irqsave(&db->lock, flags); in dm9000_phy_read()
313 reg_save = readb(db->io_addr); in dm9000_phy_read()
315 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ in dm9000_phy_read()
318 ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); in dm9000_phy_read()
321 writeb(reg_save, db->io_addr); in dm9000_phy_read()
322 spin_unlock_irqrestore(&db->lock, flags); in dm9000_phy_read()
324 mutex_unlock(&db->addr_lock); in dm9000_phy_read()
326 dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret); in dm9000_phy_read()
335 struct board_info *db = netdev_priv(dev); in dm9000_phy_write() local
339 dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value); in dm9000_phy_write()
340 if (!db->in_timeout) in dm9000_phy_write()
341 mutex_lock(&db->addr_lock); in dm9000_phy_write()
343 spin_lock_irqsave(&db->lock, flags); in dm9000_phy_write()
346 reg_save = readb(db->io_addr); in dm9000_phy_write()
349 iow(db, DM9000_EPAR, DM9000_PHY | reg); in dm9000_phy_write()
352 iow(db, DM9000_EPDRL, value); in dm9000_phy_write()
353 iow(db, DM9000_EPDRH, value >> 8); in dm9000_phy_write()
356 iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); in dm9000_phy_write()
358 writeb(reg_save, db->io_addr); in dm9000_phy_write()
359 spin_unlock_irqrestore(&db->lock, flags); in dm9000_phy_write()
361 dm9000_msleep(db, 1); /* Wait write complete */ in dm9000_phy_write()
363 spin_lock_irqsave(&db->lock, flags); in dm9000_phy_write()
364 reg_save = readb(db->io_addr); in dm9000_phy_write()
366 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ in dm9000_phy_write()
369 writeb(reg_save, db->io_addr); in dm9000_phy_write()
371 spin_unlock_irqrestore(&db->lock, flags); in dm9000_phy_write()
372 if (!db->in_timeout) in dm9000_phy_write()
373 mutex_unlock(&db->addr_lock); in dm9000_phy_write()
382 static void dm9000_set_io(struct board_info *db, int byte_width) in dm9000_set_io() argument
390 db->dumpblk = dm9000_dumpblk_8bit; in dm9000_set_io()
391 db->outblk = dm9000_outblk_8bit; in dm9000_set_io()
392 db->inblk = dm9000_inblk_8bit; in dm9000_set_io()
397 dev_dbg(db->dev, ": 3 byte IO, falling back to 16bit\n"); in dm9000_set_io()
399 db->dumpblk = dm9000_dumpblk_16bit; in dm9000_set_io()
400 db->outblk = dm9000_outblk_16bit; in dm9000_set_io()
401 db->inblk = dm9000_inblk_16bit; in dm9000_set_io()
406 db->dumpblk = dm9000_dumpblk_32bit; in dm9000_set_io()
407 db->outblk = dm9000_outblk_32bit; in dm9000_set_io()
408 db->inblk = dm9000_inblk_32bit; in dm9000_set_io()
413 static void dm9000_schedule_poll(struct board_info *db) in dm9000_schedule_poll() argument
415 if (db->type == TYPE_DM9000E) in dm9000_schedule_poll()
416 schedule_delayed_work(&db->phy_poll, HZ * 2); in dm9000_schedule_poll()
430 dm9000_read_locked(struct board_info *db, int reg) in dm9000_read_locked() argument
435 spin_lock_irqsave(&db->lock, flags); in dm9000_read_locked()
436 ret = ior(db, reg); in dm9000_read_locked()
437 spin_unlock_irqrestore(&db->lock, flags); in dm9000_read_locked()
442 static int dm9000_wait_eeprom(struct board_info *db) in dm9000_wait_eeprom() argument
459 status = dm9000_read_locked(db, DM9000_EPCR); in dm9000_wait_eeprom()
467 dev_dbg(db->dev, "timeout waiting EEPROM\n"); in dm9000_wait_eeprom()
479 dm9000_read_eeprom(struct board_info *db, int offset, u8 *to) in dm9000_read_eeprom() argument
483 if (db->flags & DM9000_PLATF_NO_EEPROM) { in dm9000_read_eeprom()
489 mutex_lock(&db->addr_lock); in dm9000_read_eeprom()
491 spin_lock_irqsave(&db->lock, flags); in dm9000_read_eeprom()
493 iow(db, DM9000_EPAR, offset); in dm9000_read_eeprom()
494 iow(db, DM9000_EPCR, EPCR_ERPRR); in dm9000_read_eeprom()
496 spin_unlock_irqrestore(&db->lock, flags); in dm9000_read_eeprom()
498 dm9000_wait_eeprom(db); in dm9000_read_eeprom()
503 spin_lock_irqsave(&db->lock, flags); in dm9000_read_eeprom()
505 iow(db, DM9000_EPCR, 0x0); in dm9000_read_eeprom()
507 to[0] = ior(db, DM9000_EPDRL); in dm9000_read_eeprom()
508 to[1] = ior(db, DM9000_EPDRH); in dm9000_read_eeprom()
510 spin_unlock_irqrestore(&db->lock, flags); in dm9000_read_eeprom()
512 mutex_unlock(&db->addr_lock); in dm9000_read_eeprom()
519 dm9000_write_eeprom(struct board_info *db, int offset, u8 *data) in dm9000_write_eeprom() argument
523 if (db->flags & DM9000_PLATF_NO_EEPROM) in dm9000_write_eeprom()
526 mutex_lock(&db->addr_lock); in dm9000_write_eeprom()
528 spin_lock_irqsave(&db->lock, flags); in dm9000_write_eeprom()
529 iow(db, DM9000_EPAR, offset); in dm9000_write_eeprom()
530 iow(db, DM9000_EPDRH, data[1]); in dm9000_write_eeprom()
531 iow(db, DM9000_EPDRL, data[0]); in dm9000_write_eeprom()
532 iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW); in dm9000_write_eeprom()
533 spin_unlock_irqrestore(&db->lock, flags); in dm9000_write_eeprom()
535 dm9000_wait_eeprom(db); in dm9000_write_eeprom()
539 spin_lock_irqsave(&db->lock, flags); in dm9000_write_eeprom()
540 iow(db, DM9000_EPCR, 0); in dm9000_write_eeprom()
541 spin_unlock_irqrestore(&db->lock, flags); in dm9000_write_eeprom()
543 mutex_unlock(&db->addr_lock); in dm9000_write_eeprom()
757 static void dm9000_show_carrier(struct board_info *db, in dm9000_show_carrier() argument
761 struct net_device *ndev = db->ndev; in dm9000_show_carrier()
762 struct mii_if_info *mii = &db->mii; in dm9000_show_carrier()
763 unsigned ncr = dm9000_read_locked(db, DM9000_NCR); in dm9000_show_carrier()
767 dev_info(db->dev, in dm9000_show_carrier()
772 dev_info(db->dev, "%s: link down\n", ndev->name); in dm9000_show_carrier()
780 struct board_info *db = container_of(dw, struct board_info, phy_poll); in dm9000_poll_work() local
781 struct net_device *ndev = db->ndev; in dm9000_poll_work()
783 if (db->flags & DM9000_PLATF_SIMPLE_PHY && in dm9000_poll_work()
784 !(db->flags & DM9000_PLATF_EXT_PHY)) { in dm9000_poll_work()
785 unsigned nsr = dm9000_read_locked(db, DM9000_NSR); in dm9000_poll_work()
792 if (netif_msg_link(db)) in dm9000_poll_work()
793 dm9000_show_carrier(db, new_carrier, nsr); in dm9000_poll_work()
801 mii_check_media(&db->mii, netif_msg_link(db), 0); in dm9000_poll_work()
804 dm9000_schedule_poll(db); in dm9000_poll_work()
813 dm9000_release_board(struct platform_device *pdev, struct board_info *db) in dm9000_release_board() argument
817 iounmap(db->io_addr); in dm9000_release_board()
818 iounmap(db->io_data); in dm9000_release_board()
822 if (db->data_req) in dm9000_release_board()
823 release_resource(db->data_req); in dm9000_release_board()
824 kfree(db->data_req); in dm9000_release_board()
826 if (db->addr_req) in dm9000_release_board()
827 release_resource(db->addr_req); in dm9000_release_board()
828 kfree(db->addr_req); in dm9000_release_board()
848 struct board_info *db = netdev_priv(dev); in dm9000_hash_table_unlocked() local
855 dm9000_dbg(db, 1, "entering %s\n", __func__); in dm9000_hash_table_unlocked()
858 iow(db, oft, dev->dev_addr[i]); in dm9000_hash_table_unlocked()
874 iow(db, oft++, hash_table[i]); in dm9000_hash_table_unlocked()
875 iow(db, oft++, hash_table[i] >> 8); in dm9000_hash_table_unlocked()
878 iow(db, DM9000_RCR, rcr); in dm9000_hash_table_unlocked()
884 struct board_info *db = netdev_priv(dev); in dm9000_hash_table() local
887 spin_lock_irqsave(&db->lock, flags); in dm9000_hash_table()
889 spin_unlock_irqrestore(&db->lock, flags); in dm9000_hash_table()
893 dm9000_mask_interrupts(struct board_info *db) in dm9000_mask_interrupts() argument
895 iow(db, DM9000_IMR, IMR_PAR); in dm9000_mask_interrupts()
899 dm9000_unmask_interrupts(struct board_info *db) in dm9000_unmask_interrupts() argument
901 iow(db, DM9000_IMR, db->imr_all); in dm9000_unmask_interrupts()
910 struct board_info *db = netdev_priv(dev); in dm9000_init_dm9000() local
914 dm9000_dbg(db, 1, "entering %s\n", __func__); in dm9000_init_dm9000()
916 dm9000_reset(db); in dm9000_init_dm9000()
917 dm9000_mask_interrupts(db); in dm9000_init_dm9000()
920 db->io_mode = ior(db, DM9000_ISR) >> 6; /* ISR bit7:6 keeps I/O mode */ in dm9000_init_dm9000()
924 iow(db, DM9000_RCSR, in dm9000_init_dm9000()
927 iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ in dm9000_init_dm9000()
928 iow(db, DM9000_GPR, 0); in dm9000_init_dm9000()
933 if (db->type == TYPE_DM9000B) { in dm9000_init_dm9000()
938 ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; in dm9000_init_dm9000()
943 if (db->wake_supported) in dm9000_init_dm9000()
946 iow(db, DM9000_NCR, ncr); in dm9000_init_dm9000()
949 iow(db, DM9000_TCR, 0); /* TX Polling clear */ in dm9000_init_dm9000()
950 iow(db, DM9000_BPTR, 0x3f); /* Less 3Kb, 200us */ in dm9000_init_dm9000()
951 iow(db, DM9000_FCR, 0xff); /* Flow Control */ in dm9000_init_dm9000()
952 iow(db, DM9000_SMCR, 0); /* Special Mode */ in dm9000_init_dm9000()
954 iow(db, DM9000_NSR, NSR_WAKEST | NSR_TX2END | NSR_TX1END); in dm9000_init_dm9000()
955 iow(db, DM9000_ISR, ISR_CLR_STATUS); /* Clear interrupt status */ in dm9000_init_dm9000()
961 if (db->type != TYPE_DM9000E) in dm9000_init_dm9000()
964 db->imr_all = imr; in dm9000_init_dm9000()
967 db->tx_pkt_cnt = 0; in dm9000_init_dm9000()
968 db->queue_pkt_len = 0; in dm9000_init_dm9000()
975 struct board_info *db = netdev_priv(dev); in dm9000_timeout() local
980 spin_lock_irqsave(&db->lock, flags); in dm9000_timeout()
981 db->in_timeout = 1; in dm9000_timeout()
982 reg_save = readb(db->io_addr); in dm9000_timeout()
986 dm9000_unmask_interrupts(db); in dm9000_timeout()
992 writeb(reg_save, db->io_addr); in dm9000_timeout()
993 db->in_timeout = 0; in dm9000_timeout()
994 spin_unlock_irqrestore(&db->lock, flags); in dm9000_timeout()
1028 struct board_info *db = netdev_priv(dev); in dm9000_start_xmit() local
1030 dm9000_dbg(db, 3, "%s:\n", __func__); in dm9000_start_xmit()
1032 if (db->tx_pkt_cnt > 1) in dm9000_start_xmit()
1035 spin_lock_irqsave(&db->lock, flags); in dm9000_start_xmit()
1038 writeb(DM9000_MWCMD, db->io_addr); in dm9000_start_xmit()
1040 (db->outblk)(db->io_data, skb->data, skb->len); in dm9000_start_xmit()
1043 db->tx_pkt_cnt++; in dm9000_start_xmit()
1045 if (db->tx_pkt_cnt == 1) { in dm9000_start_xmit()
1049 db->queue_pkt_len = skb->len; in dm9000_start_xmit()
1050 db->queue_ip_summed = skb->ip_summed; in dm9000_start_xmit()
1054 spin_unlock_irqrestore(&db->lock, flags); in dm9000_start_xmit()
1067 static void dm9000_tx_done(struct net_device *dev, struct board_info *db) in dm9000_tx_done() argument
1069 int tx_status = ior(db, DM9000_NSR); /* Got TX status */ in dm9000_tx_done()
1073 db->tx_pkt_cnt--; in dm9000_tx_done()
1076 if (netif_msg_tx_done(db)) in dm9000_tx_done()
1077 dev_dbg(db->dev, "tx done, NSR %02x\n", tx_status); in dm9000_tx_done()
1080 if (db->tx_pkt_cnt > 0) in dm9000_tx_done()
1081 dm9000_send_packet(dev, db->queue_ip_summed, in dm9000_tx_done()
1082 db->queue_pkt_len); in dm9000_tx_done()
1099 struct board_info *db = netdev_priv(dev); in dm9000_rx() local
1108 ior(db, DM9000_MRCMDX); /* Dummy read */ in dm9000_rx()
1111 rxbyte = readb(db->io_data); in dm9000_rx()
1115 dev_warn(db->dev, "status check fail: %d\n", rxbyte); in dm9000_rx()
1116 iow(db, DM9000_RCR, 0x00); /* Stop Device */ in dm9000_rx()
1125 writeb(DM9000_MRCMD, db->io_addr); in dm9000_rx()
1127 (db->inblk)(db->io_data, &rxhdr, sizeof(rxhdr)); in dm9000_rx()
1131 if (netif_msg_rx_status(db)) in dm9000_rx()
1132 dev_dbg(db->dev, "RX: status %02x, length %04x\n", in dm9000_rx()
1138 if (netif_msg_rx_err(db)) in dm9000_rx()
1139 dev_dbg(db->dev, "RX: Bad Packet (runt)\n"); in dm9000_rx()
1143 dev_dbg(db->dev, "RST: RX Len:%x\n", RxLen); in dm9000_rx()
1152 if (netif_msg_rx_err(db)) in dm9000_rx()
1153 dev_dbg(db->dev, "fifo error\n"); in dm9000_rx()
1157 if (netif_msg_rx_err(db)) in dm9000_rx()
1158 dev_dbg(db->dev, "crc error\n"); in dm9000_rx()
1162 if (netif_msg_rx_err(db)) in dm9000_rx()
1163 dev_dbg(db->dev, "length error\n"); in dm9000_rx()
1176 (db->inblk)(db->io_data, rdptr, RxLen); in dm9000_rx()
1193 (db->dumpblk)(db->io_data, RxLen); in dm9000_rx()
1201 struct board_info *db = netdev_priv(dev); in dm9000_interrupt() local
1206 dm9000_dbg(db, 3, "entering %s\n", __func__); in dm9000_interrupt()
1211 spin_lock_irqsave(&db->lock, flags); in dm9000_interrupt()
1214 reg_save = readb(db->io_addr); in dm9000_interrupt()
1216 dm9000_mask_interrupts(db); in dm9000_interrupt()
1218 int_status = ior(db, DM9000_ISR); /* Got ISR */ in dm9000_interrupt()
1219 iow(db, DM9000_ISR, int_status); /* Clear ISR status */ in dm9000_interrupt()
1221 if (netif_msg_intr(db)) in dm9000_interrupt()
1222 dev_dbg(db->dev, "interrupt status %02x\n", int_status); in dm9000_interrupt()
1230 dm9000_tx_done(dev, db); in dm9000_interrupt()
1232 if (db->type != TYPE_DM9000E) { in dm9000_interrupt()
1235 schedule_delayed_work(&db->phy_poll, 1); in dm9000_interrupt()
1239 dm9000_unmask_interrupts(db); in dm9000_interrupt()
1241 writeb(reg_save, db->io_addr); in dm9000_interrupt()
1243 spin_unlock_irqrestore(&db->lock, flags); in dm9000_interrupt()
1251 struct board_info *db = netdev_priv(dev); in dm9000_wol_interrupt() local
1255 spin_lock_irqsave(&db->lock, flags); in dm9000_wol_interrupt()
1257 nsr = ior(db, DM9000_NSR); in dm9000_wol_interrupt()
1258 wcr = ior(db, DM9000_WCR); in dm9000_wol_interrupt()
1260 dev_dbg(db->dev, "%s: NSR=0x%02x, WCR=0x%02x\n", __func__, nsr, wcr); in dm9000_wol_interrupt()
1264 iow(db, DM9000_NSR, NSR_WAKEST); in dm9000_wol_interrupt()
1267 dev_info(db->dev, "wake by link status change\n"); in dm9000_wol_interrupt()
1269 dev_info(db->dev, "wake by sample packet\n"); in dm9000_wol_interrupt()
1271 dev_info(db->dev, "wake by magic packet\n"); in dm9000_wol_interrupt()
1273 dev_err(db->dev, "wake signalled with no reason? " in dm9000_wol_interrupt()
1277 spin_unlock_irqrestore(&db->lock, flags); in dm9000_wol_interrupt()
1301 struct board_info *db = netdev_priv(dev); in dm9000_open() local
1304 if (netif_msg_ifup(db)) in dm9000_open()
1305 dev_dbg(db->dev, "enabling %s\n", dev->name); in dm9000_open()
1311 dev_warn(db->dev, "WARNING: no IRQ resource flags set.\n"); in dm9000_open()
1316 iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ in dm9000_open()
1327 dm9000_unmask_interrupts(db); in dm9000_open()
1330 db->dbug_cnt = 0; in dm9000_open()
1332 mii_check_media(&db->mii, netif_msg_link(db), 1); in dm9000_open()
1336 schedule_delayed_work(&db->phy_poll, 1); in dm9000_open()
1344 struct board_info *db = netdev_priv(dev); in dm9000_shutdown() local
1348 iow(db, DM9000_GPR, 0x01); /* Power-Down PHY */ in dm9000_shutdown()
1349 dm9000_mask_interrupts(db); in dm9000_shutdown()
1350 iow(db, DM9000_RCR, 0x00); /* Disable RX */ in dm9000_shutdown()
1360 struct board_info *db = netdev_priv(ndev); in dm9000_stop() local
1362 if (netif_msg_ifdown(db)) in dm9000_stop()
1363 dev_dbg(db->dev, "shutting down %s\n", ndev->name); in dm9000_stop()
1365 cancel_delayed_work_sync(&db->phy_poll); in dm9000_stop()
1426 struct board_info *db; /* Point a board information structure */ in dm9000_probe() local
1488 db = netdev_priv(ndev); in dm9000_probe()
1490 db->dev = &pdev->dev; in dm9000_probe()
1491 db->ndev = ndev; in dm9000_probe()
1493 spin_lock_init(&db->lock); in dm9000_probe()
1494 mutex_init(&db->addr_lock); in dm9000_probe()
1496 INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work); in dm9000_probe()
1498 db->addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); in dm9000_probe()
1499 db->data_res = platform_get_resource(pdev, IORESOURCE_MEM, 1); in dm9000_probe()
1501 if (!db->addr_res || !db->data_res) { in dm9000_probe()
1502 dev_err(db->dev, "insufficient resources addr=%p data=%p\n", in dm9000_probe()
1503 db->addr_res, db->data_res); in dm9000_probe()
1510 dev_err(db->dev, "interrupt resource unavailable: %d\n", in dm9000_probe()
1516 db->irq_wake = platform_get_irq(pdev, 1); in dm9000_probe()
1517 if (db->irq_wake >= 0) { in dm9000_probe()
1518 dev_dbg(db->dev, "wakeup irq %d\n", db->irq_wake); in dm9000_probe()
1520 ret = request_irq(db->irq_wake, dm9000_wol_interrupt, in dm9000_probe()
1521 IRQF_SHARED, dev_name(db->dev), ndev); in dm9000_probe()
1523 dev_err(db->dev, "cannot get wakeup irq (%d)\n", ret); in dm9000_probe()
1527 ret = irq_set_irq_wake(db->irq_wake, 1); in dm9000_probe()
1529 dev_err(db->dev, "irq %d cannot set wakeup (%d)\n", in dm9000_probe()
1530 db->irq_wake, ret); in dm9000_probe()
1533 irq_set_irq_wake(db->irq_wake, 0); in dm9000_probe()
1534 db->wake_supported = 1; in dm9000_probe()
1539 iosize = resource_size(db->addr_res); in dm9000_probe()
1540 db->addr_req = request_mem_region(db->addr_res->start, iosize, in dm9000_probe()
1543 if (db->addr_req == NULL) { in dm9000_probe()
1544 dev_err(db->dev, "cannot claim address reg area\n"); in dm9000_probe()
1549 db->io_addr = ioremap(db->addr_res->start, iosize); in dm9000_probe()
1551 if (db->io_addr == NULL) { in dm9000_probe()
1552 dev_err(db->dev, "failed to ioremap address reg\n"); in dm9000_probe()
1557 iosize = resource_size(db->data_res); in dm9000_probe()
1558 db->data_req = request_mem_region(db->data_res->start, iosize, in dm9000_probe()
1561 if (db->data_req == NULL) { in dm9000_probe()
1562 dev_err(db->dev, "cannot claim data reg area\n"); in dm9000_probe()
1567 db->io_data = ioremap(db->data_res->start, iosize); in dm9000_probe()
1569 if (db->io_data == NULL) { in dm9000_probe()
1570 dev_err(db->dev, "failed to ioremap data reg\n"); in dm9000_probe()
1576 ndev->base_addr = (unsigned long)db->io_addr; in dm9000_probe()
1579 dm9000_set_io(db, iosize); in dm9000_probe()
1587 dm9000_set_io(db, 1); in dm9000_probe()
1590 dm9000_set_io(db, 2); in dm9000_probe()
1593 dm9000_set_io(db, 4); in dm9000_probe()
1599 db->inblk = pdata->inblk; in dm9000_probe()
1602 db->outblk = pdata->outblk; in dm9000_probe()
1605 db->dumpblk = pdata->dumpblk; in dm9000_probe()
1607 db->flags = pdata->flags; in dm9000_probe()
1611 db->flags |= DM9000_PLATF_SIMPLE_PHY; in dm9000_probe()
1614 dm9000_reset(db); in dm9000_probe()
1618 id_val = ior(db, DM9000_VIDL); in dm9000_probe()
1619 id_val |= (u32)ior(db, DM9000_VIDH) << 8; in dm9000_probe()
1620 id_val |= (u32)ior(db, DM9000_PIDL) << 16; in dm9000_probe()
1621 id_val |= (u32)ior(db, DM9000_PIDH) << 24; in dm9000_probe()
1625 dev_err(db->dev, "read wrong id 0x%08x\n", id_val); in dm9000_probe()
1629 dev_err(db->dev, "wrong id: 0x%08x\n", id_val); in dm9000_probe()
1636 id_val = ior(db, DM9000_CHIPR); in dm9000_probe()
1637 dev_dbg(db->dev, "dm9000 revision 0x%02x\n", id_val); in dm9000_probe()
1641 db->type = TYPE_DM9000A; in dm9000_probe()
1644 db->type = TYPE_DM9000B; in dm9000_probe()
1647 dev_dbg(db->dev, "ID %02x => defaulting to DM9000E\n", id_val); in dm9000_probe()
1648 db->type = TYPE_DM9000E; in dm9000_probe()
1652 if (db->type == TYPE_DM9000A || db->type == TYPE_DM9000B) { in dm9000_probe()
1663 db->msg_enable = NETIF_MSG_LINK; in dm9000_probe()
1664 db->mii.phy_id_mask = 0x1f; in dm9000_probe()
1665 db->mii.reg_num_mask = 0x1f; in dm9000_probe()
1666 db->mii.force_media = 0; in dm9000_probe()
1667 db->mii.full_duplex = 0; in dm9000_probe()
1668 db->mii.dev = ndev; in dm9000_probe()
1669 db->mii.mdio_read = dm9000_phy_read; in dm9000_probe()
1670 db->mii.mdio_write = dm9000_phy_write; in dm9000_probe()
1676 dm9000_read_eeprom(db, i / 2, ndev->dev_addr+i); in dm9000_probe()
1688 ndev->dev_addr[i] = ior(db, i+DM9000_PAR); in dm9000_probe()
1703 dev_warn(db->dev, "%s: Invalid ethernet MAC address. Please set using ip\n", in dm9000_probe()
1706 ndev->name, dm9000_type_to_char(db->type), in dm9000_probe()
1707 db->io_addr, db->io_data, ndev->irq, in dm9000_probe()
1713 dev_err(db->dev, "not found (%d).\n", ret); in dm9000_probe()
1715 dm9000_release_board(pdev, db); in dm9000_probe()
1726 struct board_info *db; in dm9000_drv_suspend() local
1729 db = netdev_priv(ndev); in dm9000_drv_suspend()
1730 db->in_suspend = 1; in dm9000_drv_suspend()
1738 if (!db->wake_state) in dm9000_drv_suspend()
1749 struct board_info *db = netdev_priv(ndev); in dm9000_drv_resume() local
1755 if (!db->wake_state) { in dm9000_drv_resume()
1757 dm9000_unmask_interrupts(db); in dm9000_drv_resume()
1763 db->in_suspend = 0; in dm9000_drv_resume()