Lines Matching +full:mdio +full:- +full:mux
1 // SPDX-License-Identifier: GPL-2.0+
11 #include <linux/mdio-mux.h>
39 struct bcm6368_mdiomux_desc *md = bus->priv; in bcm6368_mdiomux_read()
43 __raw_writel(0, md->base + MDIOC_REG); in bcm6368_mdiomux_read()
48 if (md->ext_phy) in bcm6368_mdiomux_read()
51 __raw_writel(reg, md->base + MDIOC_REG); in bcm6368_mdiomux_read()
53 ret = __raw_readw(md->base + MDIOD_REG); in bcm6368_mdiomux_read()
61 struct bcm6368_mdiomux_desc *md = bus->priv; in bcm6368_mdiomux_write()
64 __raw_writel(0, md->base + MDIOC_REG); in bcm6368_mdiomux_write()
69 if (md->ext_phy) in bcm6368_mdiomux_write()
73 __raw_writel(reg, md->base + MDIOC_REG); in bcm6368_mdiomux_write()
84 md->ext_phy = desired_child; in bcm6368_mdiomux_switch_fn()
96 md = devm_kzalloc(&pdev->dev, sizeof(*md), GFP_KERNEL); in bcm6368_mdiomux_probe()
98 return -ENOMEM; in bcm6368_mdiomux_probe()
99 md->dev = &pdev->dev; in bcm6368_mdiomux_probe()
103 return -EINVAL; in bcm6368_mdiomux_probe()
106 * Just ioremap, as this MDIO block is usually integrated into an in bcm6368_mdiomux_probe()
109 md->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); in bcm6368_mdiomux_probe()
110 if (!md->base) { in bcm6368_mdiomux_probe()
111 dev_err(&pdev->dev, "failed to ioremap register\n"); in bcm6368_mdiomux_probe()
112 return -ENOMEM; in bcm6368_mdiomux_probe()
115 md->mii_bus = devm_mdiobus_alloc(&pdev->dev); in bcm6368_mdiomux_probe()
116 if (!md->mii_bus) { in bcm6368_mdiomux_probe()
117 dev_err(&pdev->dev, "mdiomux bus alloc failed\n"); in bcm6368_mdiomux_probe()
118 return -ENOMEM; in bcm6368_mdiomux_probe()
121 bus = md->mii_bus; in bcm6368_mdiomux_probe()
122 bus->priv = md; in bcm6368_mdiomux_probe()
123 bus->name = "BCM6368 MDIO mux bus"; in bcm6368_mdiomux_probe()
124 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d", pdev->name, pdev->id); in bcm6368_mdiomux_probe()
125 bus->parent = &pdev->dev; in bcm6368_mdiomux_probe()
126 bus->read = bcm6368_mdiomux_read; in bcm6368_mdiomux_probe()
127 bus->write = bcm6368_mdiomux_write; in bcm6368_mdiomux_probe()
128 bus->phy_mask = 0x3f; in bcm6368_mdiomux_probe()
129 bus->dev.of_node = pdev->dev.of_node; in bcm6368_mdiomux_probe()
133 dev_err(&pdev->dev, "mdiomux registration failed\n"); in bcm6368_mdiomux_probe()
139 rc = mdio_mux_init(md->dev, md->dev->of_node, in bcm6368_mdiomux_probe()
140 bcm6368_mdiomux_switch_fn, &md->mux_handle, md, in bcm6368_mdiomux_probe()
141 md->mii_bus); in bcm6368_mdiomux_probe()
143 dev_info(md->dev, "mdiomux initialization failed\n"); in bcm6368_mdiomux_probe()
147 dev_info(&pdev->dev, "Broadcom BCM6368 MDIO mux bus\n"); in bcm6368_mdiomux_probe()
160 mdio_mux_uninit(md->mux_handle); in bcm6368_mdiomux_remove()
161 mdiobus_unregister(md->mii_bus); in bcm6368_mdiomux_remove()
165 { .compatible = "brcm,bcm6368-mdio-mux", },
172 .name = "bcm6368-mdio-mux",