Lines Matching full:lp
194 #define SMC_ENABLE_INT(lp, x) do { \ argument
197 spin_lock_irqsave(&lp->lock, smc_enable_flags); \
198 mask = SMC_GET_INT_MASK(lp); \
200 SMC_SET_INT_MASK(lp, mask); \
201 spin_unlock_irqrestore(&lp->lock, smc_enable_flags); \
205 #define SMC_DISABLE_INT(lp, x) do { \ argument
208 spin_lock_irqsave(&lp->lock, smc_disable_flags); \
209 mask = SMC_GET_INT_MASK(lp); \
211 SMC_SET_INT_MASK(lp, mask); \
212 spin_unlock_irqrestore(&lp->lock, smc_disable_flags); \
220 #define SMC_WAIT_MMU_BUSY(lp) do { \ argument
221 if (unlikely(SMC_GET_MMU_CMD(lp) & MC_BUSY)) { \
223 while (SMC_GET_MMU_CMD(lp) & MC_BUSY) { \
240 struct smc_local *lp = netdev_priv(dev); in smc_reset() local
241 void __iomem *ioaddr = lp->base; in smc_reset()
248 spin_lock_irq(&lp->lock); in smc_reset()
249 SMC_SELECT_BANK(lp, 2); in smc_reset()
250 SMC_SET_INT_MASK(lp, 0); in smc_reset()
251 pending_skb = lp->pending_tx_skb; in smc_reset()
252 lp->pending_tx_skb = NULL; in smc_reset()
253 spin_unlock_irq(&lp->lock); in smc_reset()
266 SMC_SELECT_BANK(lp, 0); in smc_reset()
267 SMC_SET_RCR(lp, RCR_SOFTRST); in smc_reset()
274 SMC_SELECT_BANK(lp, 1); in smc_reset()
283 if (lp->cfg.flags & SMC91X_NOWAIT) in smc_reset()
292 SMC_SET_CONFIG(lp, cfg); in smc_reset()
305 SMC_SELECT_BANK(lp, 0); in smc_reset()
306 SMC_SET_RCR(lp, RCR_CLEAR); in smc_reset()
307 SMC_SET_TCR(lp, TCR_CLEAR); in smc_reset()
309 SMC_SELECT_BANK(lp, 1); in smc_reset()
310 ctl = SMC_GET_CTL(lp) | CTL_LE_ENABLE; in smc_reset()
321 SMC_SET_CTL(lp, ctl); in smc_reset()
324 SMC_SELECT_BANK(lp, 2); in smc_reset()
325 SMC_SET_MMU_CMD(lp, MC_RESET); in smc_reset()
326 SMC_WAIT_MMU_BUSY(lp); in smc_reset()
334 struct smc_local *lp = netdev_priv(dev); in smc_enable() local
335 void __iomem *ioaddr = lp->base; in smc_enable()
341 SMC_SELECT_BANK(lp, 0); in smc_enable()
342 SMC_SET_TCR(lp, lp->tcr_cur_mode); in smc_enable()
343 SMC_SET_RCR(lp, lp->rcr_cur_mode); in smc_enable()
345 SMC_SELECT_BANK(lp, 1); in smc_enable()
346 SMC_SET_MAC_ADDR(lp, dev->dev_addr); in smc_enable()
350 if (lp->version >= (CHIP_91100 << 4)) in smc_enable()
352 SMC_SELECT_BANK(lp, 2); in smc_enable()
353 SMC_SET_INT_MASK(lp, mask); in smc_enable()
368 struct smc_local *lp = netdev_priv(dev); in smc_shutdown() local
369 void __iomem *ioaddr = lp->base; in smc_shutdown()
375 spin_lock_irq(&lp->lock); in smc_shutdown()
376 SMC_SELECT_BANK(lp, 2); in smc_shutdown()
377 SMC_SET_INT_MASK(lp, 0); in smc_shutdown()
378 pending_skb = lp->pending_tx_skb; in smc_shutdown()
379 lp->pending_tx_skb = NULL; in smc_shutdown()
380 spin_unlock_irq(&lp->lock); in smc_shutdown()
384 SMC_SELECT_BANK(lp, 0); in smc_shutdown()
385 SMC_SET_RCR(lp, RCR_CLEAR); in smc_shutdown()
386 SMC_SET_TCR(lp, TCR_CLEAR); in smc_shutdown()
390 SMC_SELECT_BANK(lp, 1); in smc_shutdown()
391 SMC_SET_CONFIG(lp, SMC_GET_CONFIG(lp) & ~CONFIG_EPH_POWER_EN); in smc_shutdown()
400 struct smc_local *lp = netdev_priv(dev); in smc_rcv() local
401 void __iomem *ioaddr = lp->base; in smc_rcv()
406 packet_number = SMC_GET_RXFIFO(lp); in smc_rcv()
413 SMC_SET_PTR(lp, PTR_READ | PTR_RCV | PTR_AUTOINC); in smc_rcv()
416 SMC_GET_PKT_HDR(lp, status, packet_len); in smc_rcv()
434 SMC_WAIT_MMU_BUSY(lp); in smc_rcv()
435 SMC_SET_MMU_CMD(lp, MC_RELEASE); in smc_rcv()
462 SMC_WAIT_MMU_BUSY(lp); in smc_rcv()
463 SMC_SET_MMU_CMD(lp, MC_RELEASE); in smc_rcv()
472 if (lp->version == 0x90) in smc_rcv()
482 SMC_PULL_DATA(lp, data, packet_len - 4); in smc_rcv()
484 SMC_WAIT_MMU_BUSY(lp); in smc_rcv()
485 SMC_SET_MMU_CMD(lp, MC_RELEASE); in smc_rcv()
540 struct smc_local *lp = from_tasklet(lp, t, tx_task); in smc_hardware_send_pkt() local
541 struct net_device *dev = lp->dev; in smc_hardware_send_pkt()
542 void __iomem *ioaddr = lp->base; in smc_hardware_send_pkt()
550 if (!smc_special_trylock(&lp->lock, flags)) { in smc_hardware_send_pkt()
552 tasklet_schedule(&lp->tx_task); in smc_hardware_send_pkt()
556 skb = lp->pending_tx_skb; in smc_hardware_send_pkt()
558 smc_special_unlock(&lp->lock, flags); in smc_hardware_send_pkt()
561 lp->pending_tx_skb = NULL; in smc_hardware_send_pkt()
563 packet_no = SMC_GET_AR(lp); in smc_hardware_send_pkt()
568 smc_special_unlock(&lp->lock, flags); in smc_hardware_send_pkt()
573 SMC_SET_PN(lp, packet_no); in smc_hardware_send_pkt()
574 SMC_SET_PTR(lp, PTR_AUTOINC); in smc_hardware_send_pkt()
586 SMC_PUT_PKT_HDR(lp, 0, len + 6); in smc_hardware_send_pkt()
589 SMC_PUSH_DATA(lp, buf, len & ~1); in smc_hardware_send_pkt()
592 SMC_outw(lp, ((len & 1) ? (0x2000 | buf[len - 1]) : 0), ioaddr, in smc_hardware_send_pkt()
593 DATA_REG(lp)); in smc_hardware_send_pkt()
607 SMC_SET_MMU_CMD(lp, MC_ENQUEUE); in smc_hardware_send_pkt()
608 smc_special_unlock(&lp->lock, flags); in smc_hardware_send_pkt()
614 SMC_ENABLE_INT(lp, IM_TX_INT | IM_TX_EMPTY_INT); in smc_hardware_send_pkt()
631 struct smc_local *lp = netdev_priv(dev); in smc_hard_start_xmit() local
632 void __iomem *ioaddr = lp->base; in smc_hard_start_xmit()
638 BUG_ON(lp->pending_tx_skb != NULL); in smc_hard_start_xmit()
660 smc_special_lock(&lp->lock, flags); in smc_hard_start_xmit()
663 SMC_SET_MMU_CMD(lp, MC_ALLOC | numPages); in smc_hard_start_xmit()
671 status = SMC_GET_INT(lp); in smc_hard_start_xmit()
673 SMC_ACK_INT(lp, IM_ALLOC_INT); in smc_hard_start_xmit()
678 smc_special_unlock(&lp->lock, flags); in smc_hard_start_xmit()
680 lp->pending_tx_skb = skb; in smc_hard_start_xmit()
685 SMC_ENABLE_INT(lp, IM_ALLOC_INT); in smc_hard_start_xmit()
691 smc_hardware_send_pkt(&lp->tx_task); in smc_hard_start_xmit()
704 struct smc_local *lp = netdev_priv(dev); in smc_tx() local
705 void __iomem *ioaddr = lp->base; in smc_tx()
712 packet_no = SMC_GET_TXFIFO(lp); in smc_tx()
719 saved_packet = SMC_GET_PN(lp); in smc_tx()
720 SMC_SET_PN(lp, packet_no); in smc_tx()
723 SMC_SET_PTR(lp, PTR_AUTOINC | PTR_READ); in smc_tx()
724 SMC_GET_PKT_HDR(lp, tx_status, pkt_len); in smc_tx()
745 SMC_WAIT_MMU_BUSY(lp); in smc_tx()
746 SMC_SET_MMU_CMD(lp, MC_FREEPKT); in smc_tx()
749 SMC_WAIT_MMU_BUSY(lp); in smc_tx()
750 SMC_SET_PN(lp, saved_packet); in smc_tx()
753 SMC_SELECT_BANK(lp, 0); in smc_tx()
754 SMC_SET_TCR(lp, lp->tcr_cur_mode); in smc_tx()
755 SMC_SELECT_BANK(lp, 2); in smc_tx()
763 struct smc_local *lp = netdev_priv(dev); in smc_mii_out() local
764 void __iomem *ioaddr = lp->base; in smc_mii_out()
767 mii_reg = SMC_GET_MII(lp) & ~(MII_MCLK | MII_MDOE | MII_MDO); in smc_mii_out()
776 SMC_SET_MII(lp, mii_reg); in smc_mii_out()
778 SMC_SET_MII(lp, mii_reg | MII_MCLK); in smc_mii_out()
785 struct smc_local *lp = netdev_priv(dev); in smc_mii_in() local
786 void __iomem *ioaddr = lp->base; in smc_mii_in()
789 mii_reg = SMC_GET_MII(lp) & ~(MII_MCLK | MII_MDOE | MII_MDO); in smc_mii_in()
790 SMC_SET_MII(lp, mii_reg); in smc_mii_in()
793 if (SMC_GET_MII(lp) & MII_MDI) in smc_mii_in()
796 SMC_SET_MII(lp, mii_reg); in smc_mii_in()
798 SMC_SET_MII(lp, mii_reg | MII_MCLK); in smc_mii_in()
810 struct smc_local *lp = netdev_priv(dev); in smc_phy_read() local
811 void __iomem *ioaddr = lp->base; in smc_phy_read()
814 SMC_SELECT_BANK(lp, 3); in smc_phy_read()
826 SMC_SET_MII(lp, SMC_GET_MII(lp) & ~(MII_MCLK|MII_MDOE|MII_MDO)); in smc_phy_read()
831 SMC_SELECT_BANK(lp, 2); in smc_phy_read()
841 struct smc_local *lp = netdev_priv(dev); in smc_phy_write() local
842 void __iomem *ioaddr = lp->base; in smc_phy_write()
844 SMC_SELECT_BANK(lp, 3); in smc_phy_write()
853 SMC_SET_MII(lp, SMC_GET_MII(lp) & ~(MII_MCLK|MII_MDOE|MII_MDO)); in smc_phy_write()
858 SMC_SELECT_BANK(lp, 2); in smc_phy_write()
866 struct smc_local *lp = netdev_priv(dev); in smc_phy_detect() local
871 lp->phy_type = 0; in smc_phy_detect()
891 lp->mii.phy_id = phyaddr & 31; in smc_phy_detect()
892 lp->phy_type = id1 << 16 | id2; in smc_phy_detect()
903 struct smc_local *lp = netdev_priv(dev); in smc_phy_fixed() local
904 void __iomem *ioaddr = lp->base; in smc_phy_fixed()
905 int phyaddr = lp->mii.phy_id; in smc_phy_fixed()
921 if (lp->ctl_rfduplx) in smc_phy_fixed()
924 if (lp->ctl_rspeed == 100) in smc_phy_fixed()
931 SMC_SELECT_BANK(lp, 0); in smc_phy_fixed()
932 SMC_SET_RPC(lp, lp->rpc_cur_mode); in smc_phy_fixed()
933 SMC_SELECT_BANK(lp, 2); in smc_phy_fixed()
949 * Must be called with lp->lock locked.
953 struct smc_local *lp = netdev_priv(dev); in smc_phy_reset() local
960 spin_unlock_irq(&lp->lock); in smc_phy_reset()
962 spin_lock_irq(&lp->lock); in smc_phy_reset()
980 struct smc_local *lp = netdev_priv(dev); in smc_phy_powerdown() local
982 int phy = lp->mii.phy_id; in smc_phy_powerdown()
984 if (lp->phy_type == 0) in smc_phy_powerdown()
990 cancel_work_sync(&lp->phy_configure); in smc_phy_powerdown()
1006 struct smc_local *lp = netdev_priv(dev); in smc_phy_check_media() local
1007 void __iomem *ioaddr = lp->base; in smc_phy_check_media()
1009 if (mii_check_media(&lp->mii, netif_msg_link(lp), init)) { in smc_phy_check_media()
1011 if (lp->mii.full_duplex) { in smc_phy_check_media()
1012 lp->tcr_cur_mode |= TCR_SWFDUP; in smc_phy_check_media()
1014 lp->tcr_cur_mode &= ~TCR_SWFDUP; in smc_phy_check_media()
1017 SMC_SELECT_BANK(lp, 0); in smc_phy_check_media()
1018 SMC_SET_TCR(lp, lp->tcr_cur_mode); in smc_phy_check_media()
1033 struct smc_local *lp = in smc_phy_configure() local
1035 struct net_device *dev = lp->dev; in smc_phy_configure()
1036 void __iomem *ioaddr = lp->base; in smc_phy_configure()
1037 int phyaddr = lp->mii.phy_id; in smc_phy_configure()
1043 spin_lock_irq(&lp->lock); in smc_phy_configure()
1048 if (lp->phy_type == 0) in smc_phy_configure()
1066 SMC_SELECT_BANK(lp, 0); in smc_phy_configure()
1067 SMC_SET_RPC(lp, lp->rpc_cur_mode); in smc_phy_configure()
1070 if (lp->mii.force_media) { in smc_phy_configure()
1098 if (lp->ctl_rspeed != 100) in smc_phy_configure()
1101 if (!lp->ctl_rfduplx) in smc_phy_configure()
1106 lp->mii.advertising = my_ad_caps; in smc_phy_configure()
1124 SMC_SELECT_BANK(lp, 2); in smc_phy_configure()
1125 spin_unlock_irq(&lp->lock); in smc_phy_configure()
1136 struct smc_local *lp = netdev_priv(dev); in smc_phy_interrupt() local
1137 int phyaddr = lp->mii.phy_id; in smc_phy_interrupt()
1142 if (lp->phy_type == 0) in smc_phy_interrupt()
1159 struct smc_local *lp = netdev_priv(dev); in smc_10bt_check_media() local
1160 void __iomem *ioaddr = lp->base; in smc_10bt_check_media()
1165 SMC_SELECT_BANK(lp, 0); in smc_10bt_check_media()
1166 new_carrier = (SMC_GET_EPH_STATUS(lp) & ES_LINK_OK) ? 1 : 0; in smc_10bt_check_media()
1167 SMC_SELECT_BANK(lp, 2); in smc_10bt_check_media()
1175 if (netif_msg_link(lp)) in smc_10bt_check_media()
1183 struct smc_local *lp = netdev_priv(dev); in smc_eph_interrupt() local
1184 void __iomem *ioaddr = lp->base; in smc_eph_interrupt()
1189 SMC_SELECT_BANK(lp, 1); in smc_eph_interrupt()
1190 ctl = SMC_GET_CTL(lp); in smc_eph_interrupt()
1191 SMC_SET_CTL(lp, ctl & ~CTL_LE_ENABLE); in smc_eph_interrupt()
1192 SMC_SET_CTL(lp, ctl); in smc_eph_interrupt()
1193 SMC_SELECT_BANK(lp, 2); in smc_eph_interrupt()
1203 struct smc_local *lp = netdev_priv(dev); in smc_interrupt() local
1204 void __iomem *ioaddr = lp->base; in smc_interrupt()
1210 spin_lock(&lp->lock); in smc_interrupt()
1217 saved_pointer = SMC_GET_PTR(lp); in smc_interrupt()
1218 mask = SMC_GET_INT_MASK(lp); in smc_interrupt()
1219 SMC_SET_INT_MASK(lp, 0); in smc_interrupt()
1225 status = SMC_GET_INT(lp); in smc_interrupt()
1229 ({ int meminfo; SMC_SELECT_BANK(lp, 0); in smc_interrupt()
1230 meminfo = SMC_GET_MIR(lp); in smc_interrupt()
1231 SMC_SELECT_BANK(lp, 2); meminfo; }), in smc_interrupt()
1232 SMC_GET_FIFO(lp)); in smc_interrupt()
1242 SMC_ACK_INT(lp, IM_TX_INT); in smc_interrupt()
1250 tasklet_hi_schedule(&lp->tx_task); in smc_interrupt()
1257 SMC_SELECT_BANK(lp, 0); in smc_interrupt()
1258 card_stats = SMC_GET_COUNTER(lp); in smc_interrupt()
1259 SMC_SELECT_BANK(lp, 2); in smc_interrupt()
1269 ({ int eph_st; SMC_SELECT_BANK(lp, 0); in smc_interrupt()
1270 eph_st = SMC_GET_EPH_STATUS(lp); in smc_interrupt()
1271 SMC_SELECT_BANK(lp, 2); eph_st; })); in smc_interrupt()
1272 SMC_ACK_INT(lp, IM_RX_OVRN_INT); in smc_interrupt()
1278 SMC_ACK_INT(lp, IM_MDINT); in smc_interrupt()
1281 SMC_ACK_INT(lp, IM_ERCV_INT); in smc_interrupt()
1287 SMC_SET_PTR(lp, saved_pointer); in smc_interrupt()
1288 SMC_SET_INT_MASK(lp, mask); in smc_interrupt()
1289 spin_unlock(&lp->lock); in smc_interrupt()
1326 struct smc_local *lp = netdev_priv(dev); in smc_timeout() local
1327 void __iomem *ioaddr = lp->base; in smc_timeout()
1332 spin_lock_irq(&lp->lock); in smc_timeout()
1333 status = SMC_GET_INT(lp); in smc_timeout()
1334 mask = SMC_GET_INT_MASK(lp); in smc_timeout()
1335 fifo = SMC_GET_FIFO(lp); in smc_timeout()
1336 SMC_SELECT_BANK(lp, 0); in smc_timeout()
1337 eph_st = SMC_GET_EPH_STATUS(lp); in smc_timeout()
1338 meminfo = SMC_GET_MIR(lp); in smc_timeout()
1339 SMC_SELECT_BANK(lp, 2); in smc_timeout()
1340 spin_unlock_irq(&lp->lock); in smc_timeout()
1352 if (lp->phy_type != 0) in smc_timeout()
1353 schedule_work(&lp->phy_configure); in smc_timeout()
1368 struct smc_local *lp = netdev_priv(dev); in smc_set_multicast_list() local
1369 void __iomem *ioaddr = lp->base; in smc_set_multicast_list()
1377 lp->rcr_cur_mode |= RCR_PRMS; in smc_set_multicast_list()
1392 lp->rcr_cur_mode |= RCR_ALMUL; in smc_set_multicast_list()
1428 lp->rcr_cur_mode &= ~(RCR_PRMS | RCR_ALMUL); in smc_set_multicast_list()
1434 lp->rcr_cur_mode &= ~(RCR_PRMS | RCR_ALMUL); in smc_set_multicast_list()
1444 spin_lock_irq(&lp->lock); in smc_set_multicast_list()
1445 SMC_SELECT_BANK(lp, 0); in smc_set_multicast_list()
1446 SMC_SET_RCR(lp, lp->rcr_cur_mode); in smc_set_multicast_list()
1448 SMC_SELECT_BANK(lp, 3); in smc_set_multicast_list()
1449 SMC_SET_MCAST(lp, multicast_table); in smc_set_multicast_list()
1451 SMC_SELECT_BANK(lp, 2); in smc_set_multicast_list()
1452 spin_unlock_irq(&lp->lock); in smc_set_multicast_list()
1464 struct smc_local *lp = netdev_priv(dev); in smc_open() local
1469 lp->tcr_cur_mode = TCR_DEFAULT; in smc_open()
1470 lp->rcr_cur_mode = RCR_DEFAULT; in smc_open()
1471 lp->rpc_cur_mode = RPC_DEFAULT | in smc_open()
1472 lp->cfg.leda << RPC_LSXA_SHFT | in smc_open()
1473 lp->cfg.ledb << RPC_LSXB_SHFT; in smc_open()
1479 if (lp->phy_type == 0) in smc_open()
1480 lp->tcr_cur_mode |= TCR_MON_CSN; in smc_open()
1487 if (lp->phy_type != 0) in smc_open()
1488 smc_phy_configure(&lp->phy_configure); in smc_open()
1490 spin_lock_irq(&lp->lock); in smc_open()
1492 spin_unlock_irq(&lp->lock); in smc_open()
1508 struct smc_local *lp = netdev_priv(dev); in smc_close() local
1517 tasklet_kill(&lp->tx_task); in smc_close()
1529 struct smc_local *lp = netdev_priv(dev); in smc_ethtool_get_link_ksettings() local
1531 if (lp->phy_type != 0) { in smc_ethtool_get_link_ksettings()
1532 spin_lock_irq(&lp->lock); in smc_ethtool_get_link_ksettings()
1533 mii_ethtool_get_link_ksettings(&lp->mii, cmd); in smc_ethtool_get_link_ksettings()
1534 spin_unlock_irq(&lp->lock); in smc_ethtool_get_link_ksettings()
1540 if (lp->ctl_rspeed == 10) in smc_ethtool_get_link_ksettings()
1542 else if (lp->ctl_rspeed == 100) in smc_ethtool_get_link_ksettings()
1547 cmd->base.duplex = lp->tcr_cur_mode & TCR_SWFDUP ? in smc_ethtool_get_link_ksettings()
1561 struct smc_local *lp = netdev_priv(dev); in smc_ethtool_set_link_ksettings() local
1564 if (lp->phy_type != 0) { in smc_ethtool_set_link_ksettings()
1565 spin_lock_irq(&lp->lock); in smc_ethtool_set_link_ksettings()
1566 ret = mii_ethtool_set_link_ksettings(&lp->mii, cmd); in smc_ethtool_set_link_ksettings()
1567 spin_unlock_irq(&lp->lock); in smc_ethtool_set_link_ksettings()
1576 // lp->port = cmd->base.port; in smc_ethtool_set_link_ksettings()
1577 lp->ctl_rfduplx = cmd->base.duplex == DUPLEX_FULL; in smc_ethtool_set_link_ksettings()
1599 struct smc_local *lp = netdev_priv(dev); in smc_ethtool_nwayreset() local
1602 if (lp->phy_type != 0) { in smc_ethtool_nwayreset()
1603 spin_lock_irq(&lp->lock); in smc_ethtool_nwayreset()
1604 ret = mii_nway_restart(&lp->mii); in smc_ethtool_nwayreset()
1605 spin_unlock_irq(&lp->lock); in smc_ethtool_nwayreset()
1613 struct smc_local *lp = netdev_priv(dev); in smc_ethtool_getmsglevel() local
1614 return lp->msg_enable; in smc_ethtool_getmsglevel()
1619 struct smc_local *lp = netdev_priv(dev); in smc_ethtool_setmsglevel() local
1620 lp->msg_enable = level; in smc_ethtool_setmsglevel()
1626 struct smc_local *lp = netdev_priv(dev); in smc_write_eeprom_word() local
1627 void __iomem *ioaddr = lp->base; in smc_write_eeprom_word()
1629 spin_lock_irq(&lp->lock); in smc_write_eeprom_word()
1631 SMC_SELECT_BANK(lp, 1); in smc_write_eeprom_word()
1632 SMC_SET_GP(lp, word); in smc_write_eeprom_word()
1634 SMC_SELECT_BANK(lp, 2); in smc_write_eeprom_word()
1635 SMC_SET_PTR(lp, addr); in smc_write_eeprom_word()
1637 SMC_SELECT_BANK(lp, 1); in smc_write_eeprom_word()
1638 ctl = SMC_GET_CTL(lp); in smc_write_eeprom_word()
1639 SMC_SET_CTL(lp, ctl | (CTL_EEPROM_SELECT | CTL_STORE)); in smc_write_eeprom_word()
1643 } while (SMC_GET_CTL(lp) & CTL_STORE); in smc_write_eeprom_word()
1645 SMC_SET_CTL(lp, ctl); in smc_write_eeprom_word()
1646 SMC_SELECT_BANK(lp, 2); in smc_write_eeprom_word()
1647 spin_unlock_irq(&lp->lock); in smc_write_eeprom_word()
1654 struct smc_local *lp = netdev_priv(dev); in smc_read_eeprom_word() local
1655 void __iomem *ioaddr = lp->base; in smc_read_eeprom_word()
1657 spin_lock_irq(&lp->lock); in smc_read_eeprom_word()
1659 SMC_SELECT_BANK(lp, 2); in smc_read_eeprom_word()
1660 SMC_SET_PTR(lp, addr | PTR_READ); in smc_read_eeprom_word()
1662 SMC_SELECT_BANK(lp, 1); in smc_read_eeprom_word()
1663 SMC_SET_GP(lp, 0xffff); /* init to known */ in smc_read_eeprom_word()
1664 ctl = SMC_GET_CTL(lp); in smc_read_eeprom_word()
1665 SMC_SET_CTL(lp, ctl | (CTL_EEPROM_SELECT | CTL_RELOAD)); in smc_read_eeprom_word()
1669 } while (SMC_GET_CTL(lp) & CTL_RELOAD); in smc_read_eeprom_word()
1671 *word = SMC_GET_GP(lp); in smc_read_eeprom_word()
1673 SMC_SET_CTL(lp, ctl); in smc_read_eeprom_word()
1674 SMC_SELECT_BANK(lp, 2); in smc_read_eeprom_word()
1675 spin_unlock_irq(&lp->lock); in smc_read_eeprom_word()
1773 static int smc_findirq(struct smc_local *lp) in smc_findirq() argument
1775 void __iomem *ioaddr = lp->base; in smc_findirq()
1779 DBG(2, lp->dev, "%s: %s\n", CARDNAME, __func__); in smc_findirq()
1789 SMC_SELECT_BANK(lp, 2); in smc_findirq()
1790 SMC_SET_INT_MASK(lp, IM_ALLOC_INT); in smc_findirq()
1796 SMC_SET_MMU_CMD(lp, MC_ALLOC | 1); in smc_findirq()
1804 int_status = SMC_GET_INT(lp); in smc_findirq()
1817 SMC_SET_INT_MASK(lp, 0); in smc_findirq()
1850 struct smc_local *lp = netdev_priv(dev); in smc_probe() local
1859 val = SMC_CURRENT_BANK(lp); in smc_probe()
1876 SMC_SELECT_BANK(lp, 0); in smc_probe()
1877 val = SMC_CURRENT_BANK(lp); in smc_probe()
1889 SMC_SELECT_BANK(lp, 1); in smc_probe()
1890 val = SMC_GET_BASE(lp); in smc_probe()
1902 SMC_SELECT_BANK(lp, 3); in smc_probe()
1903 revision_register = SMC_GET_REV(lp); in smc_probe()
1920 lp->base = ioaddr; in smc_probe()
1921 lp->version = revision_register & 0xff; in smc_probe()
1922 spin_lock_init(&lp->lock); in smc_probe()
1925 SMC_SELECT_BANK(lp, 1); in smc_probe()
1926 SMC_GET_MAC_ADDR(lp, addr); in smc_probe()
1952 dev->irq = smc_findirq(lp); in smc_probe()
1970 tasklet_setup(&lp->tx_task, smc_hardware_send_pkt); in smc_probe()
1971 INIT_WORK(&lp->phy_configure, smc_phy_configure); in smc_probe()
1972 lp->dev = dev; in smc_probe()
1973 lp->mii.phy_id_mask = 0x1f; in smc_probe()
1974 lp->mii.reg_num_mask = 0x1f; in smc_probe()
1975 lp->mii.force_media = 0; in smc_probe()
1976 lp->mii.full_duplex = 0; in smc_probe()
1977 lp->mii.dev = dev; in smc_probe()
1978 lp->mii.mdio_read = smc_phy_read; in smc_probe()
1979 lp->mii.mdio_write = smc_phy_write; in smc_probe()
1984 if (lp->version >= (CHIP_91100 << 4)) in smc_probe()
1992 lp->msg_enable = NETIF_MSG_LINK; in smc_probe()
1993 lp->ctl_rfduplx = 0; in smc_probe()
1994 lp->ctl_rspeed = 10; in smc_probe()
1996 if (lp->version >= (CHIP_91100 << 4)) { in smc_probe()
1997 lp->ctl_rfduplx = 1; in smc_probe()
1998 lp->ctl_rspeed = 100; in smc_probe()
2008 lp->cfg.flags |= SMC91X_USE_DMA; in smc_probe()
2010 if (lp->cfg.flags & SMC91X_USE_DMA) { in smc_probe()
2015 lp->dma_chan = dma_request_channel(mask, NULL, NULL); in smc_probe()
2024 lp->base, dev->irq); in smc_probe()
2026 if (lp->dma_chan) in smc_probe()
2027 pr_cont(" DMA %p", lp->dma_chan); in smc_probe()
2030 lp->cfg.flags & SMC91X_NOWAIT ? " [nowait]" : "", in smc_probe()
2041 if (lp->phy_type == 0) { in smc_probe()
2043 } else if ((lp->phy_type & 0xfffffff0) == 0x0016f840) { in smc_probe()
2045 } else if ((lp->phy_type & 0xfffffff0) == 0x02821c50) { in smc_probe()
2052 if (retval && lp->dma_chan) in smc_probe()
2053 dma_release_channel(lp->dma_chan); in smc_probe()
2061 struct smc_local *lp = netdev_priv(ndev); in smc_enable_device() local
2104 if (!SMC_16BIT(lp)) in smc_enable_device()
2125 struct smc_local *lp __maybe_unused = netdev_priv(ndev); in smc_request_attrib()
2140 struct smc_local *lp __maybe_unused = netdev_priv(ndev); in smc_release_attrib()
2150 struct smc_local *lp = netdev_priv(ndev); in smc_request_datacs() local
2161 lp->datacs = ioremap(res->start, SMC_DATA_EXTENT); in smc_request_datacs()
2168 struct smc_local *lp = netdev_priv(ndev); in smc_release_datacs() local
2171 if (lp->datacs) in smc_release_datacs()
2172 iounmap(lp->datacs); in smc_release_datacs()
2174 lp->datacs = NULL; in smc_release_datacs()
2242 struct smc_local *lp; in smc_drv_probe() local
2261 lp = netdev_priv(ndev); in smc_drv_probe()
2262 lp->cfg.flags = 0; in smc_drv_probe()
2265 memcpy(&lp->cfg, pd, sizeof(lp->cfg)); in smc_drv_probe()
2266 lp->io_shift = SMC91X_IO_SHIFT(lp->cfg.flags); in smc_drv_probe()
2268 if (!SMC_8BIT(lp) && !SMC_16BIT(lp)) { in smc_drv_probe()
2282 ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio, in smc_drv_probe()
2291 ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio, in smc_drv_probe()
2300 if (lp->reset_gpio) in smc_drv_probe()
2307 lp->cfg.flags |= SMC91X_USE_8BIT; in smc_drv_probe()
2309 lp->cfg.flags |= SMC91X_USE_16BIT; in smc_drv_probe()
2311 lp->cfg.flags |= SMC91X_USE_32BIT; in smc_drv_probe()
2313 lp->cfg.flags |= SMC91X_USE_16BIT; in smc_drv_probe()
2317 lp->io_shift = val; in smc_drv_probe()
2318 lp->cfg.pxa_u16_align4 = in smc_drv_probe()
2324 lp->cfg.flags |= (SMC_CAN_USE_8BIT) ? SMC91X_USE_8BIT : 0; in smc_drv_probe()
2325 lp->cfg.flags |= (SMC_CAN_USE_16BIT) ? SMC91X_USE_16BIT : 0; in smc_drv_probe()
2326 lp->cfg.flags |= (SMC_CAN_USE_32BIT) ? SMC91X_USE_32BIT : 0; in smc_drv_probe()
2327 lp->cfg.flags |= (nowait) ? SMC91X_NOWAIT : 0; in smc_drv_probe()
2330 if (!lp->cfg.leda && !lp->cfg.ledb) { in smc_drv_probe()
2331 lp->cfg.leda = RPC_LSA_DEFAULT; in smc_drv_probe()
2332 lp->cfg.ledb = RPC_LSB_DEFAULT; in smc_drv_probe()
2385 struct smc_local *lp = netdev_priv(ndev); in smc_drv_probe() local
2386 lp->device = &pdev->dev; in smc_drv_probe()
2387 lp->physaddr = res->start; in smc_drv_probe()
2417 struct smc_local *lp = netdev_priv(ndev); in smc_drv_remove() local
2425 if (lp->dma_chan) in smc_drv_remove()
2426 dma_release_channel(lp->dma_chan); in smc_drv_remove()
2428 iounmap(lp->base); in smc_drv_remove()
2463 struct smc_local *lp = netdev_priv(ndev); in smc_drv_resume() local
2468 if (lp->phy_type != 0) in smc_drv_resume()
2469 smc_phy_configure(&lp->phy_configure); in smc_drv_resume()