Lines Matching +full:child +full:- +full:node

1 // SPDX-License-Identifier: GPL-2.0-only
31 * ethernet-phy-idAAAA.BBBB */
38 struct device_node *child, u32 addr) in of_mdiobus_phy_device_register() argument
41 of_fwnode_handle(child), in of_mdiobus_phy_device_register()
47 struct device_node *child, u32 addr) in of_mdiobus_register_phy() argument
49 return fwnode_mdiobus_register_phy(mdio, of_fwnode_handle(child), addr); in of_mdiobus_register_phy()
53 struct device_node *child, u32 addr) in of_mdiobus_register_device() argument
55 struct fwnode_handle *fwnode = of_fwnode_handle(child); in of_mdiobus_register_device()
63 /* Associate the OF node with the device structure so it in of_mdiobus_register_device()
67 device_set_node(&mdiodev->dev, fwnode); in of_mdiobus_register_device()
72 device_set_node(&mdiodev->dev, NULL); in of_mdiobus_register_device()
78 dev_dbg(&mdio->dev, "registered mdio device %pOFn at address %i\n", in of_mdiobus_register_device()
79 child, addr); in of_mdiobus_register_device()
90 { .compatible = "brcm,40nm-ephy" },
100 { .compatible = "moxa,moxart-rtl8201cp", },
105 * Return true if the child node is for a phy. It must either:
106 * o Compatible string of "ethernet-phy-idX.X"
107 * o Compatible string of "ethernet-phy-ieee802.3-c45"
108 * o Compatible string of "ethernet-phy-ieee802.3-c22"
115 bool of_mdiobus_child_is_phy(struct device_node *child) in of_mdiobus_child_is_phy() argument
119 if (of_get_phy_id(child, &phy_id) != -EINVAL) in of_mdiobus_child_is_phy()
122 if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c45")) in of_mdiobus_child_is_phy()
125 if (of_device_is_compatible(child, "ethernet-phy-ieee802.3-c22")) in of_mdiobus_child_is_phy()
128 if (of_match_node(whitelist_phys, child)) { in of_mdiobus_child_is_phy()
131 child); in of_mdiobus_child_is_phy()
135 if (!of_property_present(child, "compatible")) in of_mdiobus_child_is_phy()
143 * __of_mdiobus_register - Register mii_bus and create PHYs from the device tree
149 * for each child node of @np.
154 struct device_node *child; in __of_mdiobus_register() local
161 /* Do not continue if the node is disabled */ in __of_mdiobus_register()
163 return -ENODEV; in __of_mdiobus_register()
167 mdio->phy_mask = ~0; in __of_mdiobus_register()
169 device_set_node(&mdio->dev, of_fwnode_handle(np)); in __of_mdiobus_register()
172 mdio->reset_delay_us = DEFAULT_GPIO_RESET_DELAY; in __of_mdiobus_register()
173 of_property_read_u32(np, "reset-delay-us", &mdio->reset_delay_us); in __of_mdiobus_register()
174 mdio->reset_post_delay_us = 0; in __of_mdiobus_register()
175 of_property_read_u32(np, "reset-post-delay-us", &mdio->reset_post_delay_us); in __of_mdiobus_register()
182 /* Loop over the child nodes and register a phy_device for each phy */ in __of_mdiobus_register()
183 for_each_available_child_of_node(np, child) { in __of_mdiobus_register()
184 addr = of_mdio_parse_addr(&mdio->dev, child); in __of_mdiobus_register()
190 if (of_mdiobus_child_is_phy(child)) in __of_mdiobus_register()
191 rc = of_mdiobus_register_phy(mdio, child, addr); in __of_mdiobus_register()
193 rc = of_mdiobus_register_device(mdio, child, addr); in __of_mdiobus_register()
195 if (rc == -ENODEV) in __of_mdiobus_register()
196 dev_err(&mdio->dev, in __of_mdiobus_register()
207 for_each_available_child_of_node(np, child) { in __of_mdiobus_register()
209 if (of_property_present(child, "reg")) in __of_mdiobus_register()
218 dev_info(&mdio->dev, "scan phy %pOFn at address %i\n", in __of_mdiobus_register()
219 child, addr); in __of_mdiobus_register()
221 if (of_mdiobus_child_is_phy(child)) { in __of_mdiobus_register()
222 /* -ENODEV is the return code that PHYLIB has in __of_mdiobus_register()
226 rc = of_mdiobus_register_phy(mdio, child, addr); in __of_mdiobus_register()
229 if (rc != -ENODEV) in __of_mdiobus_register()
238 of_node_put(child); in __of_mdiobus_register()
245 * of_mdio_find_device - Given a device tree node, find the mdio_device
246 * @np: pointer to the mdio_device's device tree node
259 * of_phy_find_device - Give a PHY node, find the phy_device
260 * @phy_np: Pointer to the phy's device tree node
272 * of_phy_connect - Connect to the phy described in the device tree
274 * @phy_np: Pointer to device tree node for the PHY
294 phy->dev_flags |= flags; in of_phy_connect()
299 put_device(&phy->mdio.dev); in of_phy_connect()
307 * - Get phy node and connect to the phy described in the device tree
309 * @np: Pointer to device tree node for the net_device claiming the phy
331 netdev_err(dev, "broken fixed-link specification\n"); in of_phy_get_and_connect()
336 phy_np = of_parse_phandle(np, "phy-handle", 0); in of_phy_get_and_connect()
352 * - the old DT binding, where 'fixed-link' was a property with 5
354 * - the new DT binding, where 'fixed-link' is a sub-node of the
364 dn = of_get_child_by_name(np, "fixed-link"); in of_phy_is_fixed_link()
375 if (of_get_property(np, "fixed-link", &len) && in of_phy_is_fixed_link()
391 strcmp(managed, "in-band-status") == 0) { in of_phy_register_fixed_link()
397 fixed_link_node = of_get_child_by_name(np, "fixed-link"); in of_phy_register_fixed_link()
401 "full-duplex"); in of_phy_register_fixed_link()
405 return -EINVAL; in of_phy_register_fixed_link()
409 "asym-pause"); in of_phy_register_fixed_link()
416 if (of_property_read_u32_array(np, "fixed-link", fixed_link_prop, in of_phy_register_fixed_link()
426 return -ENODEV; in of_phy_register_fixed_link()
443 put_device(&phydev->mdio.dev); /* of_phy_find_device() */ in of_phy_deregister_fixed_link()