Lines Matching +full:3 +full:- +full:c22
1 // SPDX-License-Identifier: GPL-2.0-only
31 unsigned long fin_time = jiffies + 3 * HZ; /* 3 seconds */ in sxgbe_mdio_busy_wait()
39 return -EBUSY; in sxgbe_mdio_busy_wait()
48 ((sp->clk_csr & 0x7) << 19) | SXGBE_MII_BUSY; in sxgbe_mdio_ctrl_data()
49 writel(reg, sp->ioaddr + sp->hw->mii.data); in sxgbe_mdio_ctrl_data()
60 writel(reg, sp->ioaddr + sp->hw->mii.addr); in sxgbe_mdio_c45()
70 writel(1 << phyaddr, sp->ioaddr + SXGBE_MDIO_CLAUSE22_PORT_REG); in sxgbe_mdio_c22()
74 writel(reg, sp->ioaddr + sp->hw->mii.addr); in sxgbe_mdio_c22()
82 const struct mii_regs *mii = &sp->hw->mii; in sxgbe_mdio_access_c22()
85 rc = sxgbe_mdio_busy_wait(sp->ioaddr, mii->data); in sxgbe_mdio_access_c22()
89 /* Ports 0-3 only support C22. */ in sxgbe_mdio_access_c22()
91 return -ENODEV; in sxgbe_mdio_access_c22()
95 return sxgbe_mdio_busy_wait(sp->ioaddr, mii->data); in sxgbe_mdio_access_c22()
102 const struct mii_regs *mii = &sp->hw->mii; in sxgbe_mdio_access_c45()
105 rc = sxgbe_mdio_busy_wait(sp->ioaddr, mii->data); in sxgbe_mdio_access_c45()
111 return sxgbe_mdio_busy_wait(sp->ioaddr, mii->data); in sxgbe_mdio_access_c45()
119 * Description: this function used for C22 MDIO Read
123 struct net_device *ndev = bus->priv; in sxgbe_mdio_read_c22()
132 return readl(priv->ioaddr + priv->hw->mii.data) & 0xffff; in sxgbe_mdio_read_c22()
146 struct net_device *ndev = bus->priv; in sxgbe_mdio_read_c45()
155 return readl(priv->ioaddr + priv->hw->mii.data) & 0xffff; in sxgbe_mdio_read_c45()
164 * Description: this function is used for C22 MDIO write
169 struct net_device *ndev = bus->priv; in sxgbe_mdio_write_c22()
188 struct net_device *ndev = bus->priv; in sxgbe_mdio_write_c45()
199 struct sxgbe_mdio_bus_data *mdio_data = priv->plat->mdio_bus_data; in sxgbe_mdio_register()
209 return -ENOMEM; in sxgbe_mdio_register()
212 if (mdio_data->irqs) in sxgbe_mdio_register()
213 irqlist = mdio_data->irqs; in sxgbe_mdio_register()
215 irqlist = priv->mii_irq; in sxgbe_mdio_register()
218 mdio_bus->name = "sxgbe"; in sxgbe_mdio_register()
219 mdio_bus->read = sxgbe_mdio_read_c22; in sxgbe_mdio_register()
220 mdio_bus->write = sxgbe_mdio_write_c22; in sxgbe_mdio_register()
221 mdio_bus->read_c45 = sxgbe_mdio_read_c45; in sxgbe_mdio_register()
222 mdio_bus->write_c45 = sxgbe_mdio_write_c45; in sxgbe_mdio_register()
223 snprintf(mdio_bus->id, MII_BUS_ID_SIZE, "%s-%x", in sxgbe_mdio_register()
224 mdio_bus->name, priv->plat->bus_id); in sxgbe_mdio_register()
225 mdio_bus->priv = ndev; in sxgbe_mdio_register()
226 mdio_bus->phy_mask = mdio_data->phy_mask; in sxgbe_mdio_register()
227 mdio_bus->parent = priv->device; in sxgbe_mdio_register()
245 if ((mdio_data->irqs == NULL) && in sxgbe_mdio_register()
246 (mdio_data->probed_phy_irq > 0)) { in sxgbe_mdio_register()
247 irqlist[phy_addr] = mdio_data->probed_phy_irq; in sxgbe_mdio_register()
248 phy->irq = mdio_data->probed_phy_irq; in sxgbe_mdio_register()
255 if (priv->plat->phy_addr == -1) in sxgbe_mdio_register()
256 priv->plat->phy_addr = phy_addr; in sxgbe_mdio_register()
258 act = (priv->plat->phy_addr == phy_addr); in sxgbe_mdio_register()
259 switch (phy->irq) { in sxgbe_mdio_register()
267 sprintf(irq_num, "%d", phy->irq); in sxgbe_mdio_register()
272 phy->phy_id, phy_addr, irq_str, in sxgbe_mdio_register()
283 priv->mii = mdio_bus; in sxgbe_mdio_register()
288 err = -ENODEV; in sxgbe_mdio_register()
299 if (!priv->mii) in sxgbe_mdio_unregister()
302 mdiobus_unregister(priv->mii); in sxgbe_mdio_unregister()
303 priv->mii->priv = NULL; in sxgbe_mdio_unregister()
304 mdiobus_free(priv->mii); in sxgbe_mdio_unregister()
305 priv->mii = NULL; in sxgbe_mdio_unregister()