summaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2019-10-28 21:15:34 +0000
committerjmcneill <jmcneill@NetBSD.org>2019-10-28 21:15:34 +0000
commit937bd756bfd86ec20fb7ca54f8ea2da6e4a5ccce (patch)
tree0b6676331128475c4b62848b05145d39638f7d67 /sys/dev/fdt
parentce40651bedbdbe8eeba17b6185433e053576e970 (diff)
Add fdtbus_clock_count to count the number of clock references on a given node
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/fdt_clock.c12
-rw-r--r--sys/dev/fdt/fdtvar.h3
2 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/fdt/fdt_clock.c b/sys/dev/fdt/fdt_clock.c
index 28db66c1522..2079cbcdc2f 100644
--- a/sys/dev/fdt/fdt_clock.c
+++ b/sys/dev/fdt/fdt_clock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_clock.c,v 1.8 2019/02/27 16:56:00 jakllsch Exp $ */
+/* $NetBSD: fdt_clock.c,v 1.9 2019/10/28 21:15:34 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_clock.c,v 1.8 2019/02/27 16:56:00 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_clock.c,v 1.9 2019/10/28 21:15:34 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -133,8 +133,8 @@ fdtbus_clock_get_prop(int phandle, const char *clkname, const char *prop)
return fdtbus_clock_get_index(phandle, index);
}
-static u_int
-fdtbus_clock_count_prop(int phandle, const char *prop)
+u_int
+fdtbus_clock_count(int phandle, const char *prop)
{
u_int n, clock_cells;
int len, resid;
@@ -207,8 +207,8 @@ fdtbus_clock_assign(int phandle)
if (rates == NULL)
rates_len = 0;
- const u_int nclocks = fdtbus_clock_count_prop(phandle, "assigned-clocks");
- const u_int nparents = fdtbus_clock_count_prop(phandle, "assigned-clock-parents");
+ const u_int nclocks = fdtbus_clock_count(phandle, "assigned-clocks");
+ const u_int nparents = fdtbus_clock_count(phandle, "assigned-clock-parents");
const u_int nrates = rates_len / sizeof(*rates);
for (index = 0; index < nclocks; index++) {
diff --git a/sys/dev/fdt/fdtvar.h b/sys/dev/fdt/fdtvar.h
index 15119617ed2..44c52825024 100644
--- a/sys/dev/fdt/fdtvar.h
+++ b/sys/dev/fdt/fdtvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.55 2019/10/28 21:14:58 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.56 2019/10/28 21:15:34 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
@@ -366,6 +366,7 @@ struct clk * fdtbus_clock_get(int, const char *);
struct clk * fdtbus_clock_get_index(int, u_int);
struct clk * fdtbus_clock_byname(const char *);
void fdtbus_clock_assign(int);
+u_int fdtbus_clock_count(int, const char *);
struct fdtbus_reset *fdtbus_reset_get(int, const char *);
struct fdtbus_reset *fdtbus_reset_get_index(int, u_int);