enumerate devices under child "clocks" node

This commit is contained in:
jmcneill 2019-10-28 21:13:48 +00:00
parent 511f85a37d
commit a0504a86f5
1 changed files with 7 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscon.c,v 1.3 2019/02/25 19:28:36 jmcneill Exp $ */
/* $NetBSD: syscon.c,v 1.4 2019/10/28 21:13:48 jmcneill Exp $ */
/*-
* Copyright (c) 2018 Jared McNeill <jmcneill@invisible.ca>
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: syscon.c,v 1.3 2019/02/25 19:28:36 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: syscon.c,v 1.4 2019/10/28 21:13:48 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -113,6 +113,7 @@ syscon_attach(device_t parent, device_t self, void *aux)
const int phandle = faa->faa_phandle;
bus_addr_t addr;
bus_size_t size;
int child;
if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
aprint_error(": couldn't get registers\n");
@ -138,4 +139,8 @@ syscon_attach(device_t parent, device_t self, void *aux)
fdtbus_register_syscon(self, phandle, &sc->sc_syscon);
fdt_add_bus(self, phandle, faa);
child = of_find_firstchild_byname(phandle, "clocks");
if (child > 0)
fdt_add_bus(self, child, faa);
}