Lines Matching refs:aup
247 struct au1000_private *aup = netdev_priv(dev); in au1000_enable_mac() local
249 spin_lock_irqsave(&aup->lock, flags); in au1000_enable_mac()
251 if (force_reset || (!aup->mac_enabled)) { in au1000_enable_mac()
252 writel(MAC_EN_CLOCK_ENABLE, aup->enable); in au1000_enable_mac()
256 | MAC_EN_CLOCK_ENABLE), aup->enable); in au1000_enable_mac()
260 aup->mac_enabled = 1; in au1000_enable_mac()
263 spin_unlock_irqrestore(&aup->lock, flags); in au1000_enable_mac()
271 struct au1000_private *aup = netdev_priv(dev); in au1000_mdio_read() local
272 u32 *const mii_control_reg = &aup->mac->mii_control; in au1000_mdio_read()
273 u32 *const mii_data_reg = &aup->mac->mii_data; in au1000_mdio_read()
304 struct au1000_private *aup = netdev_priv(dev); in au1000_mdio_write() local
305 u32 *const mii_control_reg = &aup->mac->mii_control; in au1000_mdio_write()
306 u32 *const mii_data_reg = &aup->mac->mii_data; in au1000_mdio_write()
365 struct au1000_private *aup = netdev_priv(dev); in au1000_hard_stop() local
368 netif_dbg(aup, drv, dev, "hard stop\n"); in au1000_hard_stop()
370 reg = readl(&aup->mac->control); in au1000_hard_stop()
372 writel(reg, &aup->mac->control); in au1000_hard_stop()
379 struct au1000_private *aup = netdev_priv(dev); in au1000_enable_rx_tx() local
382 netif_dbg(aup, hw, dev, "enable_rx_tx\n"); in au1000_enable_rx_tx()
384 reg = readl(&aup->mac->control); in au1000_enable_rx_tx()
386 writel(reg, &aup->mac->control); in au1000_enable_rx_tx()
394 struct au1000_private *aup = netdev_priv(dev); in au1000_adjust_link() local
403 spin_lock_irqsave(&aup->lock, flags); in au1000_adjust_link()
405 if (phydev->link && (aup->old_speed != phydev->speed)) { in au1000_adjust_link()
418 aup->old_speed = phydev->speed; in au1000_adjust_link()
423 if (phydev->link && (aup->old_duplex != phydev->duplex)) { in au1000_adjust_link()
429 reg = readl(&aup->mac->control); in au1000_adjust_link()
437 writel(reg, &aup->mac->control); in au1000_adjust_link()
442 aup->old_duplex = phydev->duplex; in au1000_adjust_link()
447 if (phydev->link != aup->old_link) { in au1000_adjust_link()
452 aup->old_speed = 0; in au1000_adjust_link()
453 aup->old_duplex = -1; in au1000_adjust_link()
456 aup->old_link = phydev->link; in au1000_adjust_link()
460 spin_unlock_irqrestore(&aup->lock, flags); in au1000_adjust_link()
474 struct au1000_private *const aup = netdev_priv(dev); in au1000_mii_probe() local
478 if (aup->phy_static_config) { in au1000_mii_probe()
479 BUG_ON(aup->mac_id < 0 || aup->mac_id > 1); in au1000_mii_probe()
481 if (aup->phy_addr) in au1000_mii_probe()
482 phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr); in au1000_mii_probe()
492 if (mdiobus_get_phy(aup->mii_bus, phy_addr)) { in au1000_mii_probe()
493 phydev = mdiobus_get_phy(aup->mii_bus, phy_addr); in au1000_mii_probe()
494 if (!aup->phy_search_highest_addr) in au1000_mii_probe()
499 if (aup->phy1_search_mac0) { in au1000_mii_probe()
501 if (!phydev && (aup->mac_id == 1)) { in au1000_mii_probe()
511 mdiobus_get_phy(aup->mii_bus, in au1000_mii_probe()
514 if (aup->mac_id == 1) in au1000_mii_probe()
549 aup->old_link = 0; in au1000_mii_probe()
550 aup->old_speed = 0; in au1000_mii_probe()
551 aup->old_duplex = -1; in au1000_mii_probe()
563 static struct db_dest *au1000_GetFreeDB(struct au1000_private *aup) in au1000_GetFreeDB() argument
566 pDB = aup->pDBfree; in au1000_GetFreeDB()
569 aup->pDBfree = pDB->pnext; in au1000_GetFreeDB()
574 void au1000_ReleaseDB(struct au1000_private *aup, struct db_dest *pDB) in au1000_ReleaseDB() argument
576 struct db_dest *pDBfree = aup->pDBfree; in au1000_ReleaseDB()
579 aup->pDBfree = pDB; in au1000_ReleaseDB()
584 struct au1000_private *const aup = netdev_priv(dev); in au1000_reset_mac_unlocked() local
589 writel(MAC_EN_CLOCK_ENABLE, aup->enable); in au1000_reset_mac_unlocked()
592 writel(0, aup->enable); in au1000_reset_mac_unlocked()
596 aup->tx_full = 0; in au1000_reset_mac_unlocked()
599 aup->rx_dma_ring[i]->buff_stat &= ~0xf; in au1000_reset_mac_unlocked()
603 aup->tx_dma_ring[i]->buff_stat &= ~0xf; in au1000_reset_mac_unlocked()
606 aup->mac_enabled = 0; in au1000_reset_mac_unlocked()
612 struct au1000_private *const aup = netdev_priv(dev); in au1000_reset_mac() local
615 netif_dbg(aup, hw, dev, "reset mac, aup %x\n", in au1000_reset_mac()
616 (unsigned)aup); in au1000_reset_mac()
618 spin_lock_irqsave(&aup->lock, flags); in au1000_reset_mac()
622 spin_unlock_irqrestore(&aup->lock, flags); in au1000_reset_mac()
631 au1000_setup_hw_rings(struct au1000_private *aup, void __iomem *tx_base) in au1000_setup_hw_rings() argument
636 aup->rx_dma_ring[i] = (struct rx_dma *) in au1000_setup_hw_rings()
640 aup->tx_dma_ring[i] = (struct tx_dma *) in au1000_setup_hw_rings()
651 struct au1000_private *aup = netdev_priv(dev); in au1000_get_drvinfo() local
655 aup->mac_id); in au1000_get_drvinfo()
660 struct au1000_private *aup = netdev_priv(dev); in au1000_set_msglevel() local
661 aup->msg_enable = value; in au1000_set_msglevel()
666 struct au1000_private *aup = netdev_priv(dev); in au1000_get_msglevel() local
667 return aup->msg_enable; in au1000_get_msglevel()
690 struct au1000_private *aup = netdev_priv(dev); in au1000_init() local
695 netif_dbg(aup, hw, dev, "au1000_init\n"); in au1000_init()
700 spin_lock_irqsave(&aup->lock, flags); in au1000_init()
702 writel(0, &aup->mac->control); in au1000_init()
703 aup->tx_head = (aup->tx_dma_ring[0]->buff_stat & 0xC) >> 2; in au1000_init()
704 aup->tx_tail = aup->tx_head; in au1000_init()
705 aup->rx_head = (aup->rx_dma_ring[0]->buff_stat & 0xC) >> 2; in au1000_init()
708 &aup->mac->mac_addr_high); in au1000_init()
711 &aup->mac->mac_addr_low); in au1000_init()
715 aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE; in au1000_init()
732 writel(control, &aup->mac->control); in au1000_init()
733 writel(0x8100, &aup->mac->vlan1_tag); /* activate vlan support */ in au1000_init()
736 spin_unlock_irqrestore(&aup->lock, flags); in au1000_init()
768 struct au1000_private *aup = netdev_priv(dev); in au1000_rx() local
775 netif_dbg(aup, rx_status, dev, "au1000_rx head %d\n", aup->rx_head); in au1000_rx()
777 prxd = aup->rx_dma_ring[aup->rx_head]; in au1000_rx()
781 pDB = aup->rx_db_inuse[aup->rx_head]; in au1000_rx()
824 aup->rx_head = (aup->rx_head + 1) & (NUM_RX_DMA - 1); in au1000_rx()
828 prxd = aup->rx_dma_ring[aup->rx_head]; in au1000_rx()
863 struct au1000_private *aup = netdev_priv(dev); in au1000_tx_ack() local
866 ptxd = aup->tx_dma_ring[aup->tx_tail]; in au1000_tx_ack()
874 aup->tx_tail = (aup->tx_tail + 1) & (NUM_TX_DMA - 1); in au1000_tx_ack()
875 ptxd = aup->tx_dma_ring[aup->tx_tail]; in au1000_tx_ack()
877 if (aup->tx_full) { in au1000_tx_ack()
878 aup->tx_full = 0; in au1000_tx_ack()
901 struct au1000_private *aup = netdev_priv(dev); in au1000_open() local
903 netif_dbg(aup, drv, dev, "open: dev=%p\n", dev); in au1000_open()
924 netif_dbg(aup, drv, dev, "open: Initialization done.\n"); in au1000_open()
932 struct au1000_private *const aup = netdev_priv(dev); in au1000_close() local
934 netif_dbg(aup, drv, dev, "close: dev=%p\n", dev); in au1000_close()
939 spin_lock_irqsave(&aup->lock, flags); in au1000_close()
948 spin_unlock_irqrestore(&aup->lock, flags); in au1000_close()
958 struct au1000_private *aup = netdev_priv(dev); in au1000_tx() local
965 netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n", in au1000_tx()
966 (unsigned)aup, skb->len, in au1000_tx()
967 skb->data, aup->tx_head); in au1000_tx()
969 ptxd = aup->tx_dma_ring[aup->tx_head]; in au1000_tx()
974 aup->tx_full = 1; in au1000_tx()
981 if (aup->tx_full) { in au1000_tx()
982 aup->tx_full = 0; in au1000_tx()
986 pDB = aup->tx_db_inuse[aup->tx_head]; in au1000_tx()
1002 aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1); in au1000_tx()
1021 struct au1000_private *aup = netdev_priv(dev); in au1000_multicast_list() local
1024 netif_dbg(aup, drv, dev, "%s: flags=%x\n", __func__, dev->flags); in au1000_multicast_list()
1025 reg = readl(&aup->mac->control); in au1000_multicast_list()
1041 writel(mc_filter[1], &aup->mac->multi_hash_high); in au1000_multicast_list()
1042 writel(mc_filter[0], &aup->mac->multi_hash_low); in au1000_multicast_list()
1046 writel(reg, &aup->mac->control); in au1000_multicast_list()
1062 struct au1000_private *aup = NULL; in au1000_probe() local
1125 aup = netdev_priv(dev); in au1000_probe()
1127 spin_lock_init(&aup->lock); in au1000_probe()
1128 aup->msg_enable = (au1000_debug < 4 ? in au1000_probe()
1134 aup->vaddr = dma_alloc_coherent(&pdev->dev, MAX_BUF_SIZE * in au1000_probe()
1136 &aup->dma_addr, 0); in au1000_probe()
1137 if (!aup->vaddr) { in au1000_probe()
1144 aup->mac = (struct mac_reg *) in au1000_probe()
1146 if (!aup->mac) { in au1000_probe()
1153 aup->enable = (u32 *)ioremap(macen->start, in au1000_probe()
1155 if (!aup->enable) { in au1000_probe()
1160 aup->mac_id = pdev->id; in au1000_probe()
1162 aup->macdma = ioremap(macdma->start, resource_size(macdma)); in au1000_probe()
1163 if (!aup->macdma) { in au1000_probe()
1169 au1000_setup_hw_rings(aup, aup->macdma); in au1000_probe()
1171 writel(0, aup->enable); in au1000_probe()
1172 aup->mac_enabled = 0; in au1000_probe()
1178 aup->phy1_search_mac0 = 1; in au1000_probe()
1187 aup->phy_static_config = pd->phy_static_config; in au1000_probe()
1188 aup->phy_search_highest_addr = pd->phy_search_highest_addr; in au1000_probe()
1189 aup->phy1_search_mac0 = pd->phy1_search_mac0; in au1000_probe()
1190 aup->phy_addr = pd->phy_addr; in au1000_probe()
1191 aup->phy_busid = pd->phy_busid; in au1000_probe()
1192 aup->phy_irq = pd->phy_irq; in au1000_probe()
1195 if (aup->phy_busid > 0) { in au1000_probe()
1201 aup->mii_bus = mdiobus_alloc(); in au1000_probe()
1202 if (!aup->mii_bus) { in au1000_probe()
1208 aup->mii_bus->priv = dev; in au1000_probe()
1209 aup->mii_bus->read = au1000_mdiobus_read; in au1000_probe()
1210 aup->mii_bus->write = au1000_mdiobus_write; in au1000_probe()
1211 aup->mii_bus->reset = au1000_mdiobus_reset; in au1000_probe()
1212 aup->mii_bus->name = "au1000_eth_mii"; in au1000_probe()
1213 snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", in au1000_probe()
1214 pdev->name, aup->mac_id); in au1000_probe()
1217 if (aup->phy_static_config) in au1000_probe()
1218 if (aup->phy_irq && aup->phy_busid == aup->mac_id) in au1000_probe()
1219 aup->mii_bus->irq[aup->phy_addr] = aup->phy_irq; in au1000_probe()
1221 err = mdiobus_register(aup->mii_bus); in au1000_probe()
1233 pDB = aup->db; in au1000_probe()
1237 pDB->vaddr = aup->vaddr + MAX_BUF_SIZE * i; in au1000_probe()
1238 pDB->dma_addr = aup->dma_addr + MAX_BUF_SIZE * i; in au1000_probe()
1241 aup->pDBfree = pDBfree; in au1000_probe()
1245 pDB = au1000_GetFreeDB(aup); in au1000_probe()
1249 aup->rx_dma_ring[i]->buff_stat = lower_32_bits(pDB->dma_addr); in au1000_probe()
1250 aup->rx_db_inuse[i] = pDB; in au1000_probe()
1254 pDB = au1000_GetFreeDB(aup); in au1000_probe()
1258 aup->tx_dma_ring[i]->buff_stat = lower_32_bits(pDB->dma_addr); in au1000_probe()
1259 aup->tx_dma_ring[i]->len = 0; in au1000_probe()
1260 aup->tx_db_inuse[i] = pDB; in au1000_probe()
1287 if (aup->mii_bus) in au1000_probe()
1288 mdiobus_unregister(aup->mii_bus); in au1000_probe()
1296 if (aup->rx_db_inuse[i]) in au1000_probe()
1297 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]); in au1000_probe()
1300 if (aup->tx_db_inuse[i]) in au1000_probe()
1301 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]); in au1000_probe()
1304 mdiobus_free(aup->mii_bus); in au1000_probe()
1306 iounmap(aup->macdma); in au1000_probe()
1308 iounmap(aup->enable); in au1000_probe()
1310 iounmap(aup->mac); in au1000_probe()
1313 aup->vaddr, aup->dma_addr); in au1000_probe()
1329 struct au1000_private *aup = netdev_priv(dev); in au1000_remove() local
1334 mdiobus_unregister(aup->mii_bus); in au1000_remove()
1335 mdiobus_free(aup->mii_bus); in au1000_remove()
1338 if (aup->rx_db_inuse[i]) in au1000_remove()
1339 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]); in au1000_remove()
1342 if (aup->tx_db_inuse[i]) in au1000_remove()
1343 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]); in au1000_remove()
1346 aup->vaddr, aup->dma_addr); in au1000_remove()
1348 iounmap(aup->macdma); in au1000_remove()
1349 iounmap(aup->mac); in au1000_remove()
1350 iounmap(aup->enable); in au1000_remove()