Lines Matching refs:aup

250 	struct au1000_private *aup = netdev_priv(dev);  in au1000_enable_mac()  local
252 spin_lock_irqsave(&aup->lock, flags); in au1000_enable_mac()
254 if (force_reset || (!aup->mac_enabled)) { in au1000_enable_mac()
255 writel(MAC_EN_CLOCK_ENABLE, aup->enable); in au1000_enable_mac()
259 | MAC_EN_CLOCK_ENABLE), aup->enable); in au1000_enable_mac()
263 aup->mac_enabled = 1; in au1000_enable_mac()
266 spin_unlock_irqrestore(&aup->lock, flags); in au1000_enable_mac()
274 struct au1000_private *aup = netdev_priv(dev); in au1000_mdio_read() local
275 u32 *const mii_control_reg = &aup->mac->mii_control; in au1000_mdio_read()
276 u32 *const mii_data_reg = &aup->mac->mii_data; in au1000_mdio_read()
307 struct au1000_private *aup = netdev_priv(dev); in au1000_mdio_write() local
308 u32 *const mii_control_reg = &aup->mac->mii_control; in au1000_mdio_write()
309 u32 *const mii_data_reg = &aup->mac->mii_data; in au1000_mdio_write()
368 struct au1000_private *aup = netdev_priv(dev); in au1000_hard_stop() local
371 netif_dbg(aup, drv, dev, "hard stop\n"); in au1000_hard_stop()
373 reg = readl(&aup->mac->control); in au1000_hard_stop()
375 writel(reg, &aup->mac->control); in au1000_hard_stop()
382 struct au1000_private *aup = netdev_priv(dev); in au1000_enable_rx_tx() local
385 netif_dbg(aup, hw, dev, "enable_rx_tx\n"); in au1000_enable_rx_tx()
387 reg = readl(&aup->mac->control); in au1000_enable_rx_tx()
389 writel(reg, &aup->mac->control); in au1000_enable_rx_tx()
397 struct au1000_private *aup = netdev_priv(dev); in au1000_adjust_link() local
406 spin_lock_irqsave(&aup->lock, flags); in au1000_adjust_link()
408 if (phydev->link && (aup->old_speed != phydev->speed)) { in au1000_adjust_link()
421 aup->old_speed = phydev->speed; in au1000_adjust_link()
426 if (phydev->link && (aup->old_duplex != phydev->duplex)) { in au1000_adjust_link()
432 reg = readl(&aup->mac->control); in au1000_adjust_link()
440 writel(reg, &aup->mac->control); in au1000_adjust_link()
445 aup->old_duplex = phydev->duplex; in au1000_adjust_link()
450 if (phydev->link != aup->old_link) { in au1000_adjust_link()
455 aup->old_speed = 0; in au1000_adjust_link()
456 aup->old_duplex = -1; in au1000_adjust_link()
459 aup->old_link = phydev->link; in au1000_adjust_link()
463 spin_unlock_irqrestore(&aup->lock, flags); in au1000_adjust_link()
477 struct au1000_private *const aup = netdev_priv(dev); in au1000_mii_probe() local
481 if (aup->phy_static_config) { in au1000_mii_probe()
482 BUG_ON(aup->mac_id < 0 || aup->mac_id > 1); in au1000_mii_probe()
484 if (aup->phy_addr) in au1000_mii_probe()
485 phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr); in au1000_mii_probe()
495 if (mdiobus_get_phy(aup->mii_bus, phy_addr)) { in au1000_mii_probe()
496 phydev = mdiobus_get_phy(aup->mii_bus, phy_addr); in au1000_mii_probe()
497 if (!aup->phy_search_highest_addr) in au1000_mii_probe()
502 if (aup->phy1_search_mac0) { in au1000_mii_probe()
504 if (!phydev && (aup->mac_id == 1)) { in au1000_mii_probe()
514 mdiobus_get_phy(aup->mii_bus, in au1000_mii_probe()
517 if (aup->mac_id == 1) in au1000_mii_probe()
552 aup->old_link = 0; in au1000_mii_probe()
553 aup->old_speed = 0; in au1000_mii_probe()
554 aup->old_duplex = -1; in au1000_mii_probe()
567 static struct db_dest *au1000_GetFreeDB(struct au1000_private *aup) in au1000_GetFreeDB() argument
570 pDB = aup->pDBfree; in au1000_GetFreeDB()
573 aup->pDBfree = pDB->pnext; in au1000_GetFreeDB()
578 void au1000_ReleaseDB(struct au1000_private *aup, struct db_dest *pDB) in au1000_ReleaseDB() argument
580 struct db_dest *pDBfree = aup->pDBfree; in au1000_ReleaseDB()
583 aup->pDBfree = pDB; in au1000_ReleaseDB()
588 struct au1000_private *const aup = netdev_priv(dev); in au1000_reset_mac_unlocked() local
593 writel(MAC_EN_CLOCK_ENABLE, aup->enable); in au1000_reset_mac_unlocked()
596 writel(0, aup->enable); in au1000_reset_mac_unlocked()
600 aup->tx_full = 0; in au1000_reset_mac_unlocked()
603 aup->rx_dma_ring[i]->buff_stat &= ~0xf; in au1000_reset_mac_unlocked()
607 aup->tx_dma_ring[i]->buff_stat &= ~0xf; in au1000_reset_mac_unlocked()
610 aup->mac_enabled = 0; in au1000_reset_mac_unlocked()
616 struct au1000_private *const aup = netdev_priv(dev); in au1000_reset_mac() local
619 netif_dbg(aup, hw, dev, "reset mac, aup %x\n", in au1000_reset_mac()
620 (unsigned)aup); in au1000_reset_mac()
622 spin_lock_irqsave(&aup->lock, flags); in au1000_reset_mac()
626 spin_unlock_irqrestore(&aup->lock, flags); in au1000_reset_mac()
635 au1000_setup_hw_rings(struct au1000_private *aup, void __iomem *tx_base) in au1000_setup_hw_rings() argument
640 aup->rx_dma_ring[i] = (struct rx_dma *) in au1000_setup_hw_rings()
644 aup->tx_dma_ring[i] = (struct tx_dma *) in au1000_setup_hw_rings()
656 struct au1000_private *aup = netdev_priv(dev); in au1000_get_drvinfo() local
661 aup->mac_id); in au1000_get_drvinfo()
666 struct au1000_private *aup = netdev_priv(dev); in au1000_set_msglevel() local
667 aup->msg_enable = value; in au1000_set_msglevel()
672 struct au1000_private *aup = netdev_priv(dev); in au1000_get_msglevel() local
673 return aup->msg_enable; in au1000_get_msglevel()
697 struct au1000_private *aup = netdev_priv(dev); in au1000_init() local
702 netif_dbg(aup, hw, dev, "au1000_init\n"); in au1000_init()
707 spin_lock_irqsave(&aup->lock, flags); in au1000_init()
709 writel(0, &aup->mac->control); in au1000_init()
710 aup->tx_head = (aup->tx_dma_ring[0]->buff_stat & 0xC) >> 2; in au1000_init()
711 aup->tx_tail = aup->tx_head; in au1000_init()
712 aup->rx_head = (aup->rx_dma_ring[0]->buff_stat & 0xC) >> 2; in au1000_init()
715 &aup->mac->mac_addr_high); in au1000_init()
718 &aup->mac->mac_addr_low); in au1000_init()
722 aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE; in au1000_init()
739 writel(control, &aup->mac->control); in au1000_init()
740 writel(0x8100, &aup->mac->vlan1_tag); /* activate vlan support */ in au1000_init()
743 spin_unlock_irqrestore(&aup->lock, flags); in au1000_init()
775 struct au1000_private *aup = netdev_priv(dev); in au1000_rx() local
782 netif_dbg(aup, rx_status, dev, "au1000_rx head %d\n", aup->rx_head); in au1000_rx()
784 prxd = aup->rx_dma_ring[aup->rx_head]; in au1000_rx()
788 pDB = aup->rx_db_inuse[aup->rx_head]; in au1000_rx()
831 aup->rx_head = (aup->rx_head + 1) & (NUM_RX_DMA - 1); in au1000_rx()
835 prxd = aup->rx_dma_ring[aup->rx_head]; in au1000_rx()
870 struct au1000_private *aup = netdev_priv(dev); in au1000_tx_ack() local
873 ptxd = aup->tx_dma_ring[aup->tx_tail]; in au1000_tx_ack()
881 aup->tx_tail = (aup->tx_tail + 1) & (NUM_TX_DMA - 1); in au1000_tx_ack()
882 ptxd = aup->tx_dma_ring[aup->tx_tail]; in au1000_tx_ack()
884 if (aup->tx_full) { in au1000_tx_ack()
885 aup->tx_full = 0; in au1000_tx_ack()
908 struct au1000_private *aup = netdev_priv(dev); in au1000_open() local
910 netif_dbg(aup, drv, dev, "open: dev=%p\n", dev); in au1000_open()
931 netif_dbg(aup, drv, dev, "open: Initialization done.\n"); in au1000_open()
939 struct au1000_private *const aup = netdev_priv(dev); in au1000_close() local
941 netif_dbg(aup, drv, dev, "close: dev=%p\n", dev); in au1000_close()
946 spin_lock_irqsave(&aup->lock, flags); in au1000_close()
955 spin_unlock_irqrestore(&aup->lock, flags); in au1000_close()
965 struct au1000_private *aup = netdev_priv(dev); in au1000_tx() local
972 netif_dbg(aup, tx_queued, dev, "tx: aup %x len=%d, data=%p, head %d\n", in au1000_tx()
973 (unsigned)aup, skb->len, in au1000_tx()
974 skb->data, aup->tx_head); in au1000_tx()
976 ptxd = aup->tx_dma_ring[aup->tx_head]; in au1000_tx()
981 aup->tx_full = 1; in au1000_tx()
988 if (aup->tx_full) { in au1000_tx()
989 aup->tx_full = 0; in au1000_tx()
993 pDB = aup->tx_db_inuse[aup->tx_head]; in au1000_tx()
1009 aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1); in au1000_tx()
1028 struct au1000_private *aup = netdev_priv(dev); in au1000_multicast_list() local
1031 netif_dbg(aup, drv, dev, "%s: flags=%x\n", __func__, dev->flags); in au1000_multicast_list()
1032 reg = readl(&aup->mac->control); in au1000_multicast_list()
1048 writel(mc_filter[1], &aup->mac->multi_hash_high); in au1000_multicast_list()
1049 writel(mc_filter[0], &aup->mac->multi_hash_low); in au1000_multicast_list()
1053 writel(reg, &aup->mac->control); in au1000_multicast_list()
1080 struct au1000_private *aup = NULL; in au1000_probe() local
1143 aup = netdev_priv(dev); in au1000_probe()
1145 spin_lock_init(&aup->lock); in au1000_probe()
1146 aup->msg_enable = (au1000_debug < 4 ? in au1000_probe()
1152 aup->vaddr = (u32)dma_alloc_attrs(&pdev->dev, MAX_BUF_SIZE * in au1000_probe()
1154 &aup->dma_addr, 0, in au1000_probe()
1156 if (!aup->vaddr) { in au1000_probe()
1163 aup->mac = (struct mac_reg *) in au1000_probe()
1165 if (!aup->mac) { in au1000_probe()
1172 aup->enable = (u32 *)ioremap_nocache(macen->start, in au1000_probe()
1174 if (!aup->enable) { in au1000_probe()
1179 aup->mac_id = pdev->id; in au1000_probe()
1181 aup->macdma = ioremap_nocache(macdma->start, resource_size(macdma)); in au1000_probe()
1182 if (!aup->macdma) { in au1000_probe()
1188 au1000_setup_hw_rings(aup, aup->macdma); in au1000_probe()
1190 writel(0, aup->enable); in au1000_probe()
1191 aup->mac_enabled = 0; in au1000_probe()
1197 aup->phy1_search_mac0 = 1; in au1000_probe()
1206 aup->phy_static_config = pd->phy_static_config; in au1000_probe()
1207 aup->phy_search_highest_addr = pd->phy_search_highest_addr; in au1000_probe()
1208 aup->phy1_search_mac0 = pd->phy1_search_mac0; in au1000_probe()
1209 aup->phy_addr = pd->phy_addr; in au1000_probe()
1210 aup->phy_busid = pd->phy_busid; in au1000_probe()
1211 aup->phy_irq = pd->phy_irq; in au1000_probe()
1214 if (aup->phy_busid > 0) { in au1000_probe()
1220 aup->mii_bus = mdiobus_alloc(); in au1000_probe()
1221 if (aup->mii_bus == NULL) { in au1000_probe()
1227 aup->mii_bus->priv = dev; in au1000_probe()
1228 aup->mii_bus->read = au1000_mdiobus_read; in au1000_probe()
1229 aup->mii_bus->write = au1000_mdiobus_write; in au1000_probe()
1230 aup->mii_bus->reset = au1000_mdiobus_reset; in au1000_probe()
1231 aup->mii_bus->name = "au1000_eth_mii"; in au1000_probe()
1232 snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x", in au1000_probe()
1233 pdev->name, aup->mac_id); in au1000_probe()
1236 if (aup->phy_static_config) in au1000_probe()
1237 if (aup->phy_irq && aup->phy_busid == aup->mac_id) in au1000_probe()
1238 aup->mii_bus->irq[aup->phy_addr] = aup->phy_irq; in au1000_probe()
1240 err = mdiobus_register(aup->mii_bus); in au1000_probe()
1252 pDB = aup->db; in au1000_probe()
1256 pDB->vaddr = (u32 *)((unsigned)aup->vaddr + MAX_BUF_SIZE*i); in au1000_probe()
1260 aup->pDBfree = pDBfree; in au1000_probe()
1264 pDB = au1000_GetFreeDB(aup); in au1000_probe()
1268 aup->rx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr; in au1000_probe()
1269 aup->rx_db_inuse[i] = pDB; in au1000_probe()
1274 pDB = au1000_GetFreeDB(aup); in au1000_probe()
1278 aup->tx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr; in au1000_probe()
1279 aup->tx_dma_ring[i]->len = 0; in au1000_probe()
1280 aup->tx_db_inuse[i] = pDB; in au1000_probe()
1309 if (aup->mii_bus != NULL) in au1000_probe()
1310 mdiobus_unregister(aup->mii_bus); in au1000_probe()
1318 if (aup->rx_db_inuse[i]) in au1000_probe()
1319 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]); in au1000_probe()
1322 if (aup->tx_db_inuse[i]) in au1000_probe()
1323 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]); in au1000_probe()
1326 mdiobus_free(aup->mii_bus); in au1000_probe()
1328 iounmap(aup->macdma); in au1000_probe()
1330 iounmap(aup->enable); in au1000_probe()
1332 iounmap(aup->mac); in au1000_probe()
1335 (void *)aup->vaddr, aup->dma_addr, in au1000_probe()
1352 struct au1000_private *aup = netdev_priv(dev); in au1000_remove() local
1357 mdiobus_unregister(aup->mii_bus); in au1000_remove()
1358 mdiobus_free(aup->mii_bus); in au1000_remove()
1361 if (aup->rx_db_inuse[i]) in au1000_remove()
1362 au1000_ReleaseDB(aup, aup->rx_db_inuse[i]); in au1000_remove()
1365 if (aup->tx_db_inuse[i]) in au1000_remove()
1366 au1000_ReleaseDB(aup, aup->tx_db_inuse[i]); in au1000_remove()
1369 (void *)aup->vaddr, aup->dma_addr, in au1000_remove()
1372 iounmap(aup->macdma); in au1000_remove()
1373 iounmap(aup->mac); in au1000_remove()
1374 iounmap(aup->enable); in au1000_remove()