Lines Matching +full:a +full:- +full:child +full:- +full:node +full:- +full:property
1 /*-
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
94 if (ofw_bus_get_node(dev) == -1) in ofw_iicbus_probe()
106 phandle_t child, node, root; in ofw_iicbus_attach() local
114 sc->dev = dev; in ofw_iicbus_attach()
115 mtx_init(&sc->lock, "iicbus", NULL, MTX_DEF); in ofw_iicbus_attach()
118 * If there is a clock-frequency property for the device node, use it as in ofw_iicbus_attach()
123 node = ofw_bus_get_node(dev); in ofw_iicbus_attach()
125 OF_getencprop(node, "clock-frequency", &freq, sizeof(freq)); in ofw_iicbus_attach()
134 * Check if we're running on a PowerMac, needed for the I2C in ofw_iicbus_attach()
140 if (compatlen != -1) { in ofw_iicbus_attach()
151 for (child = OF_child(node); child != 0; child = OF_peer(child)) { in ofw_iicbus_attach()
153 * Try to get the I2C address first from the i2c-address in ofw_iicbus_attach()
154 * property, then try the reg property. It moves around in ofw_iicbus_attach()
157 if (OF_getencprop(child, "i2c-address", &paddr, in ofw_iicbus_attach()
158 sizeof(paddr)) == -1) in ofw_iicbus_attach()
159 if (OF_getencprop(child, "reg", &paddr, in ofw_iicbus_attach()
160 sizeof(paddr)) == -1) in ofw_iicbus_attach()
173 * 8-bit values. Apple OFW data contains 8-bit values, but in ofw_iicbus_attach()
174 * Linux FDT data contains 7-bit values, so shift them up to in ofw_iicbus_attach()
175 * 8-bit format. in ofw_iicbus_attach()
178 dinfo->opd_dinfo.addr = paddr; in ofw_iicbus_attach()
180 dinfo->opd_dinfo.addr = paddr << 1; in ofw_iicbus_attach()
182 if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != in ofw_iicbus_attach()
189 resource_list_init(&dinfo->opd_dinfo.rl); in ofw_iicbus_attach()
190 ofw_bus_intr_to_rl(childdev, child, in ofw_iicbus_attach()
191 &dinfo->opd_dinfo.rl, NULL); in ofw_iicbus_attach()
196 OF_device_register_xref(OF_xref_from_node(node), dev); in ofw_iicbus_attach()
204 device_t child; in ofw_iicbus_add_child() local
207 child = device_add_child_ordered(dev, order, name, unit); in ofw_iicbus_add_child()
208 if (child == NULL) in ofw_iicbus_add_child()
209 return (child); in ofw_iicbus_add_child()
213 device_delete_child(dev, child); in ofw_iicbus_add_child()
218 * NULL all the OFW-related parts of the ivars for non-OFW in ofw_iicbus_add_child()
221 devi->opd_obdinfo.obd_node = -1; in ofw_iicbus_add_child()
222 devi->opd_obdinfo.obd_name = NULL; in ofw_iicbus_add_child()
223 devi->opd_obdinfo.obd_compat = NULL; in ofw_iicbus_add_child()
224 devi->opd_obdinfo.obd_type = NULL; in ofw_iicbus_add_child()
225 devi->opd_obdinfo.obd_model = NULL; in ofw_iicbus_add_child()
227 device_set_ivars(child, devi); in ofw_iicbus_add_child()
229 return (child); in ofw_iicbus_add_child()
238 return (&dinfo->opd_obdinfo); in ofw_iicbus_get_devinfo()
248 * Setup OFW-related parts of the ivars for manually in ofw_iicbus_set_devinfo()
255 devi->opd_obdinfo.obd_node = ofw_node; in ofw_iicbus_set_devinfo()
257 devi->opd_obdinfo.obd_name = strdup(ofw_name, M_OFWPROP); in ofw_iicbus_set_devinfo()
259 devi->opd_obdinfo.obd_compat = strdup(ofw_compat, M_OFWPROP); in ofw_iicbus_set_devinfo()
260 devi->opd_dinfo.addr = i2c_addr; in ofw_iicbus_set_devinfo()