Lines Matching refs:aup
267 struct au1000_private *aup = netdev_priv(dev); in au1000_enable_mac() local
269 spin_lock_irqsave(&aup->lock, flags); in au1000_enable_mac()
271 if (force_reset || (!aup->mac_enabled)) { in au1000_enable_mac()
272 writel(MAC_EN_CLOCK_ENABLE, aup->enable); in au1000_enable_mac()
276 | MAC_EN_CLOCK_ENABLE), aup->enable); in au1000_enable_mac()
280 aup->mac_enabled = 1; in au1000_enable_mac()
283 spin_unlock_irqrestore(&aup->lock, flags); in au1000_enable_mac()
291 struct au1000_private *aup = netdev_priv(dev); in au1000_mdio_read() local
292 u32 *const mii_control_reg = &aup->mac->mii_control; in au1000_mdio_read()
293 u32 *const mii_data_reg = &aup->mac->mii_data; in au1000_mdio_read()
324 struct au1000_private *aup = netdev_priv(dev); in au1000_mdio_write() local
325 u32 *const mii_control_reg = &aup->mac->mii_control; in au1000_mdio_write()
326 u32 *const mii_data_reg = &aup->mac->mii_data; in au1000_mdio_write()
385 struct au1000_private *aup = netdev_priv(dev); in au1000_hard_stop() local
388 netif_dbg(aup, drv, dev, "hard stop\n"); in au1000_hard_stop()
390 reg = readl(&aup->mac->control); in au1000_hard_stop()
392 writel(reg, &aup->mac->control); in au1000_hard_stop()
399 struct au1000_private *aup = netdev_priv(dev); in au1000_enable_rx_tx() local
402 netif_dbg(aup, hw, dev, "enable_rx_tx\n"); in au1000_enable_rx_tx()
404 reg = readl(&aup->mac->control); in au1000_enable_rx_tx()
406 writel(reg, &aup->mac->control); in au1000_enable_rx_tx()
414 struct au1000_private *aup = netdev_priv(dev); in au1000_adjust_link() local
423 spin_lock_irqsave(&aup->lock, flags); in au1000_adjust_link()
425 if (phydev->link && (aup->old_speed != phydev->speed)) { in au1000_adjust_link()
438 aup->old_speed = phydev->speed; in au1000_adjust_link()
443 if (phydev->link && (aup->old_duplex != phydev->duplex)) { in au1000_adjust_link()
449 reg = readl(&aup->mac->control); in au1000_adjust_link()
457 writel(reg, &aup->mac->control); in au1000_adjust_link()
462 aup->old_duplex = phydev->duplex; in au1000_adjust_link()
467 if (phydev->link != aup->old_link) { in au1000_adjust_link()
472 aup->old_speed = 0; in au1000_adjust_link()
473 aup->old_duplex = -1; in au1000_adjust_link()
476 aup->old_link = phydev->link; in au1000_adjust_link()
480 spin_unlock_irqrestore(&aup->lock, flags); in au1000_adjust_link()
494 struct au1000_private *const aup = netdev_priv(dev); in au1000_mii_probe() local
498 if (aup->phy_static_config) { in au1000_mii_probe()
499 BUG_ON(aup->mac_id < 0 || aup->mac_id > 1); in au1000_mii_probe()
501 if (aup->phy_addr) in au1000_mii_probe()
502 phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr); in au1000_mii_probe()
512 if (mdiobus_get_phy(aup->mii_bus, phy_addr)) { in au1000_mii_probe()
513 phydev = mdiobus_get_phy(aup->mii_bus, phy_addr); in au1000_mii_probe()
514 if (!aup->phy_search_highest_addr) in au1000_mii_probe()
519 if (aup->phy1_search_mac0) { in au1000_mii_probe()
521 if (!phydev && (aup->mac_id == 1)) { in au1000_mii_probe()
531 mdiobus_get_phy(aup->mii_bus, in au1000_mii_probe()
534 if (aup->mac_id == 1) in au1000_mii_probe()
579 aup->old_link = 0; in au1000_mii_probe()
580 aup->old_speed = 0; in au1000_mii_probe()
581 aup->old_duplex = -1; in au1000_mii_probe()
594 static struct db_dest *au1000_GetFreeDB(struct au1000_private *aup) in au1000_GetFreeDB() argument
597 pDB = aup->pDBfree; in au1000_GetFreeDB()
600 aup->pDBfree = pDB->pnext; in au1000_GetFreeDB()
605 void au1000_ReleaseDB(struct au1000_private *aup, struct db_dest *pDB) in au1000_ReleaseDB() argument
607 struct db_dest *pDBfree = aup->pDBfree; in au1000_ReleaseDB()
610 aup->pDBfree = pDB; in au1000_ReleaseDB()
615 struct au1000_private *const aup = netdev_priv(dev); in au1000_reset_mac_unlocked() local
620 writel(MAC_EN_CLOCK_ENABLE, aup->enable); in au1000_reset_mac_unlocked()
623 writel(0, aup->enable); in au1000_reset_mac_unlocked()
627 aup->tx_full = 0; in au1000_reset_mac_unlocked()
630 aup->rx_dma_ring[i]->buff_stat &= ~0xf; in au1000_reset_mac_unlocked()
634 aup->tx_dma_ring[i]->buff_stat &= ~0xf; in au1000_reset_mac_unlocked()
637 aup->mac_enabled = 0; in au1000_reset_mac_unlocked()
643 struct au1000_private *const aup = netdev_priv(dev); in au1000_reset_mac() local
646 netif_dbg(aup, hw, dev, "reset mac, aup %x\n", in au1000_reset_mac()
647 (unsigned)aup); in au1000_reset_mac()
649 spin_lock_irqsave(&aup->lock, flags); in au1000_reset_mac()
653 spin_unlock_irqrestore(&aup->lock, flags); in au1000_reset_mac()
662 au1000_setup_hw_rings(struct au1000_private *aup, void __iomem *tx_base) in au1000_setup_hw_rings() argument
667 aup->rx_dma_ring[i] = (struct rx_dma *) in au1000_setup_hw_rings()
671 aup->tx_dma_ring[i] = (struct tx_dma *) in au1000_setup_hw_rings()
683 struct au1000_private *aup = netdev_priv(dev); in au1000_get_drvinfo() local
688 aup->mac_id); in au1000_get_drvinfo()
693 struct au1000_private *aup = netdev_priv(dev); in au1000_set_msglevel() local
694 aup->msg_enable = value; in au1000_set_msglevel()
699 struct au1000_private *aup = netdev_priv(dev); in au1000_get_msglevel() local
700 return aup->msg_enable; in au1000_get_msglevel()
724 struct au1000_private *aup = netdev_priv(dev); in au1000_init() local
729 netif_dbg(aup, hw, dev, "au1000_init\n"); in au1000_init()
734 spin_lock_irqsave(&aup->lock, flags); in au1000_init()
736 writel(0, &aup->mac->control); in au1000_init()
737 aup->tx_head = (aup->tx_dma_ring[0]->buff_stat & 0xC) >> 2; in au1000_init()
738 aup->tx_tail = aup->tx_head; in au1000_init()
739 aup->rx_head = (aup->rx_dma_ring[0]->buff_stat & 0xC) >> 2; in au1000_init()
742 &aup->mac->mac_addr_high); in au1000_init()
745 &aup->mac->mac_addr_low); in au1000_init()
749 aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE; in au1000_init()
766 writel(control, &aup->mac->control); in au1000_init()
767 writel(0x8100, &aup->mac->vlan1_tag); /* activate vlan support */ in au1000_init()
770 spin_unlock_irqrestore(&aup->lock, flags); in au1000_init()
802 struct au1000_private *aup = netdev_priv(dev); in au1000_rx() local
809 netif_dbg(aup, rx_status, dev, "au1000_rx head %d\n", aup->rx_head); in au1000_rx()
811 prxd = aup->rx_dma_ring[aup->rx_head]; in au1000_rx()
815 pDB = aup->rx_db_inuse[aup->rx_head]; in au1000_rx()
858 aup->rx_head = (aup->rx_head + 1) & (NUM_RX_DMA - 1); in au1000_rx()
862 prxd = aup->rx_dma_ring[aup->rx_head]; in au1000_rx()
897 struct au1000_private *aup = netdev_priv(dev); in au1000_tx_ack() local
900 ptxd = aup->tx_dma_ring[aup->tx_tail]; in au1000_tx_ack()
908 aup->tx_tail = (aup->tx_tail + 1) & (NUM_TX_DMA - 1); in au1000_tx_ack()
909 ptxd = aup->tx_dma_ring[aup->tx_tail]; in au1000_tx_ack()
911 if (aup->tx_full) { in au1000_tx_ack()
912 aup->tx_full = 0; in au1000_tx_ack()
935 struct au1000_private *aup = netdev_priv(dev); in au1000_open() local
937 netif_dbg(aup, drv, dev, "open: dev=%p\n", dev); in au1000_open()
961 netif_dbg(aup, drv, dev, "open: Initialization done.\n"); in au1000_open()
969 struct au1000_private *const aup = netdev_priv(dev); in au1000_close() local
971 netif_dbg(aup, drv, dev, "close: dev=%p\n", dev); in au1000_close()
976 spin_lock_irqsave(&aup->lock, flags); in au1000_close()
985 spin_unlock_irqrestore(&aup->lock, flags); in au1000_close()
995 struct au1000_private *aup = netdev_priv(dev); in au1000_tx() local
1002 netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n", in au1000_tx()
1003 (unsigned)aup, skb->len, in au1000_tx()
1004 skb->data, aup->tx_head); in au1000_tx()
1006 ptxd = aup->tx_dma_ring[aup->tx_head]; in au1000_tx()
1011 aup->tx_full = 1; in au1000_tx()
1018 if (aup->tx_full) { in au1000_tx()
1019 aup->tx_full = 0; in au1000_tx()
1023 pDB = aup->tx_db_inuse[aup->tx_head]; in au1000_tx()
1039 aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1); in au1000_tx()
1058 struct au1000_private *aup = netdev_priv(dev); in au1000_multicast_list() local
1061 netif_dbg(aup, drv, dev, "%s: flags=%x\n", __func__, dev->flags); in au1000_multicast_list()
1062 reg = readl(&aup->mac->control); in au1000_multicast_list()
1078 writel(mc_filter[1], &aup->mac->multi_hash_high); in au1000_multicast_list()
1079 writel(mc_filter[0], &aup->mac->multi_hash_low); in au1000_multicast_list()
1083 writel(reg, &aup->mac->control); in au1000_multicast_list()
1110 struct au1000_private *aup = NULL; in au1000_probe() local
1174 aup = netdev_priv(dev); in au1000_probe()
1176 spin_lock_init(&aup->lock); in au1000_probe()
1177 aup->msg_enable = (au1000_debug < 4 ? in au1000_probe()
1183 aup->vaddr = (u32)dma_alloc_attrs(NULL, MAX_BUF_SIZE * in au1000_probe()
1185 &aup->dma_addr, 0, in au1000_probe()
1187 if (!aup->vaddr) { in au1000_probe()
1194 aup->mac = (struct mac_reg *) in au1000_probe()
1196 if (!aup->mac) { in au1000_probe()
1203 aup->enable = (u32 *)ioremap_nocache(macen->start, in au1000_probe()
1205 if (!aup->enable) { in au1000_probe()
1210 aup->mac_id = pdev->id; in au1000_probe()
1212 aup->macdma = ioremap_nocache(macdma->start, resource_size(macdma)); in au1000_probe()
1213 if (!aup->macdma) { in au1000_probe()
1219 au1000_setup_hw_rings(aup, aup->macdma); in au1000_probe()
1221 writel(0, aup->enable); in au1000_probe()
1222 aup->mac_enabled = 0; in au1000_probe()
1228 aup->phy1_search_mac0 = 1; in au1000_probe()
1237 aup->phy_static_config = pd->phy_static_config; in au1000_probe()
1238 aup->phy_search_highest_addr = pd->phy_search_highest_addr; in au1000_probe()
1239 aup->phy1_search_mac0 = pd->phy1_search_mac0; in au1000_probe()
1240 aup->phy_addr = pd->phy_addr; in au1000_probe()
1241 aup->phy_busid = pd->phy_busid; in au1000_probe()
1242 aup->phy_irq = pd->phy_irq; in au1000_probe()
1245 if (aup->phy_busid > 0) { in au1000_probe()
1251 aup->mii_bus = mdiobus_alloc(); in au1000_probe()
1252 if (aup->mii_bus == NULL) { in au1000_probe()
1258 aup->mii_bus->priv = dev; in au1000_probe()
1259 aup->mii_bus->read = au1000_mdiobus_read; in au1000_probe()
1260 aup->mii_bus->write = au1000_mdiobus_write; in au1000_probe()
1261 aup->mii_bus->reset = au1000_mdiobus_reset; in au1000_probe()
1262 aup->mii_bus->name = "au1000_eth_mii"; in au1000_probe()
1263 snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", in au1000_probe()
1264 pdev->name, aup->mac_id); in au1000_probe()
1267 if (aup->phy_static_config) in au1000_probe()
1268 if (aup->phy_irq && aup->phy_busid == aup->mac_id) in au1000_probe()
1269 aup->mii_bus->irq[aup->phy_addr] = aup->phy_irq; in au1000_probe()
1271 err = mdiobus_register(aup->mii_bus); in au1000_probe()
1283 pDB = aup->db; in au1000_probe()
1287 pDB->vaddr = (u32 *)((unsigned)aup->vaddr + MAX_BUF_SIZE*i); in au1000_probe()
1291 aup->pDBfree = pDBfree; in au1000_probe()
1295 pDB = au1000_GetFreeDB(aup); in au1000_probe()
1299 aup->rx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr; in au1000_probe()
1300 aup->rx_db_inuse[i] = pDB; in au1000_probe()
1305 pDB = au1000_GetFreeDB(aup); in au1000_probe()
1309 aup->tx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr; in au1000_probe()
1310 aup->tx_dma_ring[i]->len = 0; in au1000_probe()
1311 aup->tx_db_inuse[i] = pDB; in au1000_probe()
1340 if (aup->mii_bus != NULL) in au1000_probe()
1341 mdiobus_unregister(aup->mii_bus); in au1000_probe()
1349 if (aup->rx_db_inuse[i]) in au1000_probe()
1350 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]); in au1000_probe()
1353 if (aup->tx_db_inuse[i]) in au1000_probe()
1354 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]); in au1000_probe()
1357 mdiobus_free(aup->mii_bus); in au1000_probe()
1359 iounmap(aup->macdma); in au1000_probe()
1361 iounmap(aup->enable); in au1000_probe()
1363 iounmap(aup->mac); in au1000_probe()
1366 (void *)aup->vaddr, aup->dma_addr, in au1000_probe()
1383 struct au1000_private *aup = netdev_priv(dev); in au1000_remove() local
1388 mdiobus_unregister(aup->mii_bus); in au1000_remove()
1389 mdiobus_free(aup->mii_bus); in au1000_remove()
1392 if (aup->rx_db_inuse[i]) in au1000_remove()
1393 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]); in au1000_remove()
1396 if (aup->tx_db_inuse[i]) in au1000_remove()
1397 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]); in au1000_remove()
1400 (void *)aup->vaddr, aup->dma_addr, in au1000_remove()
1403 iounmap(aup->macdma); in au1000_remove()
1404 iounmap(aup->mac); in au1000_remove()
1405 iounmap(aup->enable); in au1000_remove()