Lines Matching full:db
141 #define dm9000_dbg(db, lev, msg...) do { \ argument
143 dev_dbg(db->dev, msg); \
158 ior(struct board_info *db, int reg) in ior() argument
160 writeb(reg, db->io_addr); in ior()
161 return readb(db->io_data); in ior()
169 iow(struct board_info *db, int reg, int value) in iow() argument
171 writeb(reg, db->io_addr); in iow()
172 writeb(value, db->io_data); in iow()
176 dm9000_reset(struct board_info *db) in dm9000_reset() argument
178 dev_dbg(db->dev, "resetting device\n"); in dm9000_reset()
184 iow(db, DM9000_NCR, NCR_RST | NCR_MAC_LBK); in dm9000_reset()
186 if (ior(db, DM9000_NCR) & 1) in dm9000_reset()
187 dev_err(db->dev, "dm9000 did not respond to first reset\n"); in dm9000_reset()
189 iow(db, DM9000_NCR, 0); in dm9000_reset()
190 iow(db, DM9000_NCR, NCR_RST | NCR_MAC_LBK); in dm9000_reset()
192 if (ior(db, DM9000_NCR) & 1) in dm9000_reset()
193 dev_err(db->dev, "dm9000 did not respond to second reset\n"); in dm9000_reset()
265 static void dm9000_msleep(struct board_info *db, unsigned int ms) in dm9000_msleep() argument
267 if (db->in_suspend || db->in_timeout) in dm9000_msleep()
277 struct board_info *db = netdev_priv(dev); in dm9000_phy_read() local
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()
290 iow(db, DM9000_EPAR, DM9000_PHY | reg); in dm9000_phy_read()
293 iow(db, DM9000_EPCR, EPCR_ERPRR | EPCR_EPOS); 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()
298 dm9000_msleep(db, 1); /* Wait read complete */ 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()
303 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer read command */ in dm9000_phy_read()
306 ret = (ior(db, DM9000_EPDRH) << 8) | ior(db, DM9000_EPDRL); 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()
323 struct board_info *db = netdev_priv(dev); in dm9000_phy_write() local
327 dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value); in dm9000_phy_write()
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()
337 iow(db, DM9000_EPAR, DM9000_PHY | reg); in dm9000_phy_write()
340 iow(db, DM9000_EPDRL, value); in dm9000_phy_write()
341 iow(db, DM9000_EPDRH, value >> 8); in dm9000_phy_write()
344 iow(db, DM9000_EPCR, EPCR_EPOS | EPCR_ERPRW); 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()
349 dm9000_msleep(db, 1); /* Wait write complete */ 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()
354 iow(db, DM9000_EPCR, 0x0); /* Clear phyxcer write command */ 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()
370 static void dm9000_set_io(struct board_info *db, int byte_width) in dm9000_set_io() argument
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()
402 static void dm9000_schedule_poll(struct board_info *db) in dm9000_schedule_poll() argument
404 if (db->type == TYPE_DM9000E) in dm9000_schedule_poll()
405 schedule_delayed_work(&db->phy_poll, HZ * 2); in dm9000_schedule_poll()
419 dm9000_read_locked(struct board_info *db, int reg) in dm9000_read_locked() argument
424 spin_lock_irqsave(&db->lock, flags); in dm9000_read_locked()
425 ret = ior(db, reg); in dm9000_read_locked()
426 spin_unlock_irqrestore(&db->lock, flags); in dm9000_read_locked()
431 static int dm9000_wait_eeprom(struct board_info *db) in dm9000_wait_eeprom() argument
448 status = dm9000_read_locked(db, DM9000_EPCR); in dm9000_wait_eeprom()
456 dev_dbg(db->dev, "timeout waiting EEPROM\n"); in dm9000_wait_eeprom()
468 dm9000_read_eeprom(struct board_info *db, int offset, u8 *to) in dm9000_read_eeprom() argument
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()
482 iow(db, DM9000_EPAR, offset); in dm9000_read_eeprom()
483 iow(db, DM9000_EPCR, EPCR_ERPRR); in dm9000_read_eeprom()
485 spin_unlock_irqrestore(&db->lock, flags); in dm9000_read_eeprom()
487 dm9000_wait_eeprom(db); in dm9000_read_eeprom()
492 spin_lock_irqsave(&db->lock, flags); in dm9000_read_eeprom()
494 iow(db, DM9000_EPCR, 0x0); in dm9000_read_eeprom()
496 to[0] = ior(db, DM9000_EPDRL); in dm9000_read_eeprom()
497 to[1] = ior(db, DM9000_EPDRH); 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()
508 dm9000_write_eeprom(struct board_info *db, int offset, u8 *data) in dm9000_write_eeprom() argument
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()
518 iow(db, DM9000_EPAR, offset); in dm9000_write_eeprom()
519 iow(db, DM9000_EPDRH, data[1]); in dm9000_write_eeprom()
520 iow(db, DM9000_EPDRL, data[0]); in dm9000_write_eeprom()
521 iow(db, DM9000_EPCR, EPCR_WEP | EPCR_ERPRW); in dm9000_write_eeprom()
522 spin_unlock_irqrestore(&db->lock, flags); in dm9000_write_eeprom()
524 dm9000_wait_eeprom(db); in dm9000_write_eeprom()
528 spin_lock_irqsave(&db->lock, flags); in dm9000_write_eeprom()
529 iow(db, DM9000_EPCR, 0); 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()
747 static void dm9000_show_carrier(struct board_info *db, in dm9000_show_carrier() argument
751 struct net_device *ndev = db->ndev; in dm9000_show_carrier()
752 struct mii_if_info *mii = &db->mii; in dm9000_show_carrier()
753 unsigned ncr = dm9000_read_locked(db, DM9000_NCR); in dm9000_show_carrier()
757 dev_info(db->dev, in dm9000_show_carrier()
762 dev_info(db->dev, "%s: link down\n", ndev->name); in dm9000_show_carrier()
770 struct board_info *db = container_of(dw, struct board_info, phy_poll); in dm9000_poll_work() local
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()
775 unsigned nsr = dm9000_read_locked(db, DM9000_NSR); in dm9000_poll_work()
782 if (netif_msg_link(db)) in dm9000_poll_work()
783 dm9000_show_carrier(db, new_carrier, nsr); in dm9000_poll_work()
791 mii_check_media(&db->mii, netif_msg_link(db), 0); in dm9000_poll_work()
794 dm9000_schedule_poll(db); in dm9000_poll_work()
803 dm9000_release_board(struct platform_device *pdev, struct board_info *db) in dm9000_release_board() argument
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()
838 struct board_info *db = netdev_priv(dev); in dm9000_hash_table_unlocked() local
845 dm9000_dbg(db, 1, "entering %s\n", __func__); in dm9000_hash_table_unlocked()
848 iow(db, oft, dev->dev_addr[i]); in dm9000_hash_table_unlocked()
864 iow(db, oft++, hash_table[i]); in dm9000_hash_table_unlocked()
865 iow(db, oft++, hash_table[i] >> 8); in dm9000_hash_table_unlocked()
868 iow(db, DM9000_RCR, rcr); in dm9000_hash_table_unlocked()
874 struct board_info *db = netdev_priv(dev); in dm9000_hash_table() local
877 spin_lock_irqsave(&db->lock, flags); in dm9000_hash_table()
879 spin_unlock_irqrestore(&db->lock, flags); in dm9000_hash_table()
883 dm9000_mask_interrupts(struct board_info *db) in dm9000_mask_interrupts() argument
885 iow(db, DM9000_IMR, IMR_PAR); in dm9000_mask_interrupts()
889 dm9000_unmask_interrupts(struct board_info *db) in dm9000_unmask_interrupts() argument
891 iow(db, DM9000_IMR, db->imr_all); in dm9000_unmask_interrupts()
900 struct board_info *db = netdev_priv(dev); in dm9000_init_dm9000() local
904 dm9000_dbg(db, 1, "entering %s\n", __func__); in dm9000_init_dm9000()
906 dm9000_reset(db); in dm9000_init_dm9000()
907 dm9000_mask_interrupts(db); in dm9000_init_dm9000()
910 db->io_mode = ior(db, DM9000_ISR) >> 6; /* ISR bit7:6 keeps I/O mode */ in dm9000_init_dm9000()
914 iow(db, DM9000_RCSR, in dm9000_init_dm9000()
917 iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ in dm9000_init_dm9000()
918 iow(db, DM9000_GPR, 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()
933 if (db->wake_supported) in dm9000_init_dm9000()
936 iow(db, DM9000_NCR, ncr); in dm9000_init_dm9000()
939 iow(db, DM9000_TCR, 0); /* TX Polling clear */ in dm9000_init_dm9000()
940 iow(db, DM9000_BPTR, 0x3f); /* Less 3Kb, 200us */ in dm9000_init_dm9000()
941 iow(db, DM9000_FCR, 0xff); /* Flow Control */ in dm9000_init_dm9000()
942 iow(db, DM9000_SMCR, 0); /* Special Mode */ in dm9000_init_dm9000()
944 iow(db, DM9000_NSR, NSR_WAKEST | NSR_TX2END | NSR_TX1END); in dm9000_init_dm9000()
945 iow(db, DM9000_ISR, ISR_CLR_STATUS); /* Clear interrupt status */ 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()
965 struct board_info *db = netdev_priv(dev); in dm9000_timeout() local
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()
976 dm9000_unmask_interrupts(db); 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()
1018 struct board_info *db = netdev_priv(dev); in dm9000_start_xmit() local
1020 dm9000_dbg(db, 3, "%s:\n", __func__); in dm9000_start_xmit()
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()
1033 db->tx_pkt_cnt++; in dm9000_start_xmit()
1035 if (db->tx_pkt_cnt == 1) { 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()
1057 static void dm9000_tx_done(struct net_device *dev, struct board_info *db) in dm9000_tx_done() argument
1059 int tx_status = ior(db, DM9000_NSR); /* Got TX status */ in dm9000_tx_done()
1063 db->tx_pkt_cnt--; in dm9000_tx_done()
1066 if (netif_msg_tx_done(db)) 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()
1089 struct board_info *db = netdev_priv(dev); in dm9000_rx() local
1098 ior(db, DM9000_MRCMDX); /* Dummy read */ in dm9000_rx()
1101 rxbyte = readb(db->io_data); in dm9000_rx()
1105 dev_warn(db->dev, "status check fail: %d\n", rxbyte); in dm9000_rx()
1106 iow(db, DM9000_RCR, 0x00); /* Stop Device */ 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()
1121 if (netif_msg_rx_status(db)) in dm9000_rx()
1122 dev_dbg(db->dev, "RX: status %02x, length %04x\n", in dm9000_rx()
1128 if (netif_msg_rx_err(db)) 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()
1142 if (netif_msg_rx_err(db)) in dm9000_rx()
1143 dev_dbg(db->dev, "fifo error\n"); in dm9000_rx()
1147 if (netif_msg_rx_err(db)) in dm9000_rx()
1148 dev_dbg(db->dev, "crc error\n"); in dm9000_rx()
1152 if (netif_msg_rx_err(db)) in dm9000_rx()
1153 dev_dbg(db->dev, "length error\n"); in dm9000_rx()
1166 (db->inblk)(db->io_data, rdptr, RxLen); in dm9000_rx()
1183 (db->dumpblk)(db->io_data, RxLen); in dm9000_rx()
1191 struct board_info *db = netdev_priv(dev); in dm9000_interrupt() local
1196 dm9000_dbg(db, 3, "entering %s\n", __func__); in dm9000_interrupt()
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()
1206 dm9000_mask_interrupts(db); in dm9000_interrupt()
1208 int_status = ior(db, DM9000_ISR); /* Got ISR */ in dm9000_interrupt()
1209 iow(db, DM9000_ISR, int_status); /* Clear ISR status */ in dm9000_interrupt()
1211 if (netif_msg_intr(db)) in dm9000_interrupt()
1212 dev_dbg(db->dev, "interrupt status %02x\n", int_status); in dm9000_interrupt()
1220 dm9000_tx_done(dev, db); in dm9000_interrupt()
1222 if (db->type != TYPE_DM9000E) { in dm9000_interrupt()
1225 schedule_delayed_work(&db->phy_poll, 1); in dm9000_interrupt()
1229 dm9000_unmask_interrupts(db); in dm9000_interrupt()
1231 writeb(reg_save, db->io_addr); in dm9000_interrupt()
1233 spin_unlock_irqrestore(&db->lock, flags); in dm9000_interrupt()
1241 struct board_info *db = netdev_priv(dev); in dm9000_wol_interrupt() local
1245 spin_lock_irqsave(&db->lock, flags); in dm9000_wol_interrupt()
1247 nsr = ior(db, DM9000_NSR); in dm9000_wol_interrupt()
1248 wcr = ior(db, DM9000_WCR); in dm9000_wol_interrupt()
1250 dev_dbg(db->dev, "%s: NSR=0x%02x, WCR=0x%02x\n", __func__, nsr, wcr); in dm9000_wol_interrupt()
1254 iow(db, DM9000_NSR, NSR_WAKEST); 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()
1291 struct board_info *db = netdev_priv(dev); in dm9000_open() local
1294 if (netif_msg_ifup(db)) 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()
1306 iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ in dm9000_open()
1317 dm9000_unmask_interrupts(db); 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()
1334 struct board_info *db = netdev_priv(dev); in dm9000_shutdown() local
1338 iow(db, DM9000_GPR, 0x01); /* Power-Down PHY */ in dm9000_shutdown()
1339 dm9000_mask_interrupts(db); in dm9000_shutdown()
1340 iow(db, DM9000_RCR, 0x00); /* Disable RX */ in dm9000_shutdown()
1350 struct board_info *db = netdev_priv(ndev); in dm9000_stop() local
1352 if (netif_msg_ifdown(db)) in dm9000_stop()
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()
1415 struct board_info *db; /* Point a board information structure */ in dm9000_probe() local
1485 db = netdev_priv(ndev); 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()
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()
1539 if (db->addr_req == NULL) { in dm9000_probe()
1540 dev_err(db->dev, "cannot claim address reg area\n"); 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()
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()
1557 if (db->data_req == NULL) { in dm9000_probe()
1558 dev_err(db->dev, "cannot claim data reg area\n"); 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()
1572 ndev->base_addr = (unsigned long)db->io_addr; in dm9000_probe()
1575 dm9000_set_io(db, iosize); in dm9000_probe()
1583 dm9000_set_io(db, 1); in dm9000_probe()
1586 dm9000_set_io(db, 2); in dm9000_probe()
1589 dm9000_set_io(db, 4); in dm9000_probe()
1595 db->inblk = pdata->inblk; in dm9000_probe()
1598 db->outblk = pdata->outblk; 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()
1610 dm9000_reset(db); in dm9000_probe()
1614 id_val = ior(db, DM9000_VIDL); in dm9000_probe()
1615 id_val |= (u32)ior(db, DM9000_VIDH) << 8; in dm9000_probe()
1616 id_val |= (u32)ior(db, DM9000_PIDL) << 16; in dm9000_probe()
1617 id_val |= (u32)ior(db, DM9000_PIDH) << 24; 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()
1632 id_val = ior(db, DM9000_CHIPR); 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()
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()
1672 dm9000_read_eeprom(db, i / 2, addr + i); in dm9000_probe()
1685 addr[i] = ior(db, i + DM9000_PAR); in dm9000_probe()
1701 dev_warn(db->dev, "%s: Invalid ethernet MAC address. Please set using ip\n", 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()
1711 dev_err(db->dev, "not found (%d).\n", ret); in dm9000_probe()
1713 dm9000_release_board(pdev, db); in dm9000_probe()
1727 struct board_info *db; in dm9000_drv_suspend() local
1730 db = netdev_priv(ndev); in dm9000_drv_suspend()
1731 db->in_suspend = 1; in dm9000_drv_suspend()
1739 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()