• Home
  • Raw
  • Download

Lines Matching +full:bus +full:- +full:turnaround +full:- +full:ns

1 // SPDX-License-Identifier: GPL-2.0
18 #include <linux/mdio-bitbang.h>
33 /* Minimum MDC period is 400 ns, plus some margin for error. MDIO_DELAY
38 /* The PHY may take up to 300 ns to produce data, plus some margin
46 const struct mdiobb_ops *ops = ctrl->ops; in mdiobb_send_bit()
48 ops->set_mdio_data(ctrl, val); in mdiobb_send_bit()
50 ops->set_mdc(ctrl, 1); in mdiobb_send_bit()
52 ops->set_mdc(ctrl, 0); in mdiobb_send_bit()
58 const struct mdiobb_ops *ops = ctrl->ops; in mdiobb_get_bit()
61 ops->set_mdc(ctrl, 1); in mdiobb_get_bit()
63 ops->set_mdc(ctrl, 0); in mdiobb_get_bit()
65 return ops->get_mdio_data(ctrl); in mdiobb_get_bit()
73 for (i = bits - 1; i >= 0; i--) in mdiobb_send_num()
83 for (i = bits - 1; i >= 0; i--) { in mdiobb_get_num()
96 const struct mdiobb_ops *ops = ctrl->ops; in mdiobb_cmd()
99 ops->set_mdio_dir(ctrl, 1); in mdiobb_cmd()
132 can exist on the same bus. Normal devices should ignore the MDIO_ADDR
140 /* send the turnaround (10) */ in mdiobb_cmd_addr()
146 ctrl->ops->set_mdio_dir(ctrl, 0); in mdiobb_cmd_addr()
152 static int mdiobb_read(struct mii_bus *bus, int phy, int reg) in mdiobb_read() argument
154 struct mdiobb_ctrl *ctrl = bus->priv; in mdiobb_read()
163 ctrl->ops->set_mdio_dir(ctrl, 0); in mdiobb_read()
165 /* check the turnaround bit: the PHY should be driving it to zero, if this in mdiobb_read()
169 !(bus->phy_ignore_ta_mask & (1 << phy))) { in mdiobb_read()
170 /* PHY didn't drive TA low -- flush any bits it in mdiobb_read()
184 static int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val) in mdiobb_write() argument
186 struct mdiobb_ctrl *ctrl = bus->priv; in mdiobb_write()
194 /* send the turnaround (10) */ in mdiobb_write()
200 ctrl->ops->set_mdio_dir(ctrl, 0); in mdiobb_write()
207 struct mii_bus *bus; in alloc_mdio_bitbang() local
209 bus = mdiobus_alloc(); in alloc_mdio_bitbang()
210 if (!bus) in alloc_mdio_bitbang()
213 __module_get(ctrl->ops->owner); in alloc_mdio_bitbang()
215 bus->read = mdiobb_read; in alloc_mdio_bitbang()
216 bus->write = mdiobb_write; in alloc_mdio_bitbang()
217 bus->priv = ctrl; in alloc_mdio_bitbang()
219 return bus; in alloc_mdio_bitbang()
223 void free_mdio_bitbang(struct mii_bus *bus) in free_mdio_bitbang() argument
225 struct mdiobb_ctrl *ctrl = bus->priv; in free_mdio_bitbang()
227 module_put(ctrl->ops->owner); in free_mdio_bitbang()
228 mdiobus_free(bus); in free_mdio_bitbang()