Lines Matching +full:mdio +full:- +full:pin
1 // SPDX-License-Identifier: GPL-2.0-only
20 #include <linux/mdio-bitbang.h>
60 bb_set(bitbang->dir, bitbang->mdio_msk); in mdio_dir()
62 bb_clr(bitbang->dir, bitbang->mdio_msk); in mdio_dir()
65 in_be32(bitbang->dir); in mdio_dir()
71 return bb_read(bitbang->dat, bitbang->mdio_msk); in mdio_read()
74 static inline void mdio(struct mdiobb_ctrl *ctrl, int what) in mdio() function
79 bb_set(bitbang->dat, bitbang->mdio_msk); in mdio()
81 bb_clr(bitbang->dat, bitbang->mdio_msk); in mdio()
84 in_be32(bitbang->dat); in mdio()
92 bb_set(bitbang->dat, bitbang->mdc_msk); in mdc()
94 bb_clr(bitbang->dat, bitbang->mdc_msk); in mdc()
97 in_be32(bitbang->dat); in mdc()
104 .set_mdio_data = mdio,
113 struct bb_info *bitbang = bus->priv; in fs_mii_bitbang_init()
120 return -ENODEV; in fs_mii_bitbang_init()
122 /* This should really encode the pin number as well, but all in fs_mii_bitbang_init()
123 * we get is an int, and the odds of multiple bitbang mdio buses in fs_mii_bitbang_init()
126 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start); in fs_mii_bitbang_init()
128 data = of_get_property(np, "fsl,mdio-pin", &len); in fs_mii_bitbang_init()
130 return -ENODEV; in fs_mii_bitbang_init()
133 data = of_get_property(np, "fsl,mdc-pin", &len); in fs_mii_bitbang_init()
135 return -ENODEV; in fs_mii_bitbang_init()
138 bitbang->dir = ioremap(res.start, resource_size(&res)); in fs_mii_bitbang_init()
139 if (!bitbang->dir) in fs_mii_bitbang_init()
140 return -ENOMEM; in fs_mii_bitbang_init()
142 bitbang->dat = bitbang->dir + 4; in fs_mii_bitbang_init()
143 bitbang->mdio_msk = 1 << (31 - mdio_pin); in fs_mii_bitbang_init()
144 bitbang->mdc_msk = 1 << (31 - mdc_pin); in fs_mii_bitbang_init()
153 int ret = -ENOMEM; in fs_enet_mdio_probe()
159 bitbang->ctrl.ops = &bb_ops; in fs_enet_mdio_probe()
161 new_bus = alloc_mdio_bitbang(&bitbang->ctrl); in fs_enet_mdio_probe()
165 new_bus->name = "CPM2 Bitbanged MII", in fs_enet_mdio_probe()
167 ret = fs_mii_bitbang_init(new_bus, ofdev->dev.of_node); in fs_enet_mdio_probe()
171 new_bus->phy_mask = ~0; in fs_enet_mdio_probe()
173 new_bus->parent = &ofdev->dev; in fs_enet_mdio_probe()
176 ret = of_mdiobus_register(new_bus, ofdev->dev.of_node); in fs_enet_mdio_probe()
183 iounmap(bitbang->dir); in fs_enet_mdio_probe()
195 struct bb_info *bitbang = bus->priv; in fs_enet_mdio_remove()
199 iounmap(bitbang->dir); in fs_enet_mdio_remove()
205 .compatible = "fsl,cpm2-mdio-bitbang",
213 .name = "fsl-bb-mdio",