MCPcopy Create free account
hub / github.com/F-Stack/f-stack / as3722_attach

Function as3722_attach

freebsd/arm/nvidia/as3722.c:284–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284static int
285as3722_attach(device_t dev)
286{
287 struct as3722_softc *sc;
288 const char *dname;
289 int dunit, rv, rid;
290 phandle_t node;
291
292 sc = device_get_softc(dev);
293 sc->dev = dev;
294 sc->bus_addr = iicbus_get_addr(dev);
295 node = ofw_bus_get_node(sc->dev);
296 dname = device_get_name(dev);
297 dunit = device_get_unit(dev);
298 rv = 0;
299 LOCK_INIT(sc);
300
301 rid = 0;
302 sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
303 RF_ACTIVE);
304 if (sc->irq_res == NULL) {
305 device_printf(dev, "Cannot allocate interrupt.\n");
306 rv = ENXIO;
307 goto fail;
308 }
309
310 rv = as3722_parse_fdt(sc, node);
311 if (rv != 0)
312 goto fail;
313 rv = as3722_get_version(sc);
314 if (rv != 0)
315 goto fail;
316 rv = as3722_init(sc);
317 if (rv != 0)
318 goto fail;
319 rv = as3722_regulator_attach(sc, node);
320 if (rv != 0)
321 goto fail;
322 rv = as3722_gpio_attach(sc, node);
323 if (rv != 0)
324 goto fail;
325 rv = as3722_rtc_attach(sc, node);
326 if (rv != 0)
327 goto fail;
328
329 fdt_pinctrl_register(dev, NULL);
330 fdt_pinctrl_configure_by_name(dev, "default");
331
332 /* Setup interrupt. */
333 rv = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
334 NULL, as3722_intr, sc, &sc->irq_h);
335 if (rv) {
336 device_printf(dev, "Cannot setup interrupt.\n");
337 goto fail;
338 }
339 return (bus_generic_attach(dev));
340
341fail:

Callers

nothing calls this directly

Calls 15

device_get_softcFunction · 0.85
device_get_nameFunction · 0.85
device_get_unitFunction · 0.85
bus_alloc_resource_anyFunction · 0.85
device_printfFunction · 0.85
as3722_parse_fdtFunction · 0.85
as3722_get_versionFunction · 0.85
as3722_initFunction · 0.85
as3722_regulator_attachFunction · 0.85
as3722_gpio_attachFunction · 0.85
as3722_rtc_attachFunction · 0.85
bus_setup_intrFunction · 0.85

Tested by

no test coverage detected