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

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
59 device_t child;
67 if ((child = device_add_child_ordered(dev, order, name, unit)) == NULL) {
72 ivars->devinfo.obd_node = -1;
73 device_set_ivars(child, ivars);
75 return (child);
79 ofw_pwmbus_child_deleted(device_t dev, device_t child)
83 ivars = device_get_ivars(child);
85 ofw_bus_gen_destroy_devinfo(&ivars->devinfo);
96 return (&ivars->devinfo);
107 if (ofw_bus_get_node(dev) == -1) {
120 phandle_t node;
121 device_t child, parent;
126 sc->base.dev = dev;
129 if (PWMBUS_CHANNEL_COUNT(parent, &sc->base.nchannels) != 0 ||
130 sc->base.nchannels == 0) {
137 * Attach the children found in the fdt node of the hardware controller.
139 * that our call to ofw_bus_get_node() gets back the controller's node.
142 node = ofw_bus_get_node(dev);
143 for (node = OF_child(node); node != 0; node = OF_peer(node)) {
145 * The child has to have a reg property; its value is the
146 * channel number so range-check it.
148 if (OF_getencprop(node, "reg", &chan, sizeof(chan)) == -1)
150 if (chan >= sc->base.nchannels)
153 if ((child = ofw_pwmbus_add_child(dev, 0, NULL, -1)) == NULL)
156 ivars = device_get_ivars(child);
157 ivars->base.pi_channel = chan;
160 if (ofw_bus_gen_setup_devinfo(&ivars->devinfo, node) != 0) {
161 device_delete_child(dev, child);
168 * If we didn't find any children in the fdt data, add a pwmc(4) child
175 for (chan = 0; chan < sc->base.nchannels; ++chan) {
176 child = ofw_pwmbus_add_child(dev, 0, "pwmc", -1);
177 if (child == NULL) {
178 device_printf(dev, "failed to add pwmc child "
182 ivars = device_get_ivars(child);
183 ivars->base.pi_channel = chan;