Lines Matching refs:comm
18 static int spl2sw_mdio_access(struct spl2sw_common *comm, u8 cmd, u8 addr, u8 regnum, u16 wdata) in spl2sw_mdio_access() argument
27 reg = readl(comm->l2sw_reg_base + L2SW_MAC_FORCE_MODE); in spl2sw_mdio_access()
37 spin_lock_irq(&comm->mdio_lock); in spl2sw_mdio_access()
38 writel(reg, comm->l2sw_reg_base + L2SW_MAC_FORCE_MODE); in spl2sw_mdio_access()
39 writel(reg2, comm->l2sw_reg_base + L2SW_PHY_CNTL_REG0); in spl2sw_mdio_access()
40 spin_unlock_irq(&comm->mdio_lock); in spl2sw_mdio_access()
43 comm->l2sw_reg_base + L2SW_PHY_CNTL_REG1); in spl2sw_mdio_access()
49 reg = readl(comm->l2sw_reg_base + L2SW_MAC_FORCE_MODE); in spl2sw_mdio_access()
52 writel(reg, comm->l2sw_reg_base + L2SW_MAC_FORCE_MODE); in spl2sw_mdio_access()
62 struct spl2sw_common *comm = bus->priv; in spl2sw_mii_read() local
64 return spl2sw_mdio_access(comm, SPL2SW_MDIO_READ_CMD, addr, regnum, 0); in spl2sw_mii_read()
69 struct spl2sw_common *comm = bus->priv; in spl2sw_mii_write() local
72 ret = spl2sw_mdio_access(comm, SPL2SW_MDIO_WRITE_CMD, addr, regnum, val); in spl2sw_mii_write()
79 u32 spl2sw_mdio_init(struct spl2sw_common *comm) in spl2sw_mdio_init() argument
86 mdio_np = of_get_child_by_name(comm->pdev->dev.of_node, "mdio"); in spl2sw_mdio_init()
88 dev_err(&comm->pdev->dev, "No mdio child node found!\n"); in spl2sw_mdio_init()
93 mii_bus = devm_mdiobus_alloc(&comm->pdev->dev); in spl2sw_mdio_init()
100 mii_bus->parent = &comm->pdev->dev; in spl2sw_mdio_init()
101 mii_bus->priv = comm; in spl2sw_mdio_init()
104 snprintf(mii_bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&comm->pdev->dev)); in spl2sw_mdio_init()
108 dev_err(&comm->pdev->dev, "Failed to register mdiobus!\n"); in spl2sw_mdio_init()
112 comm->mii_bus = mii_bus; in spl2sw_mdio_init()
119 void spl2sw_mdio_remove(struct spl2sw_common *comm) in spl2sw_mdio_remove() argument
121 if (comm->mii_bus) { in spl2sw_mdio_remove()
122 mdiobus_unregister(comm->mii_bus); in spl2sw_mdio_remove()
123 comm->mii_bus = NULL; in spl2sw_mdio_remove()