Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/fdt If clock-output-names is specified, use it for t...



details:   https://anonhg.NetBSD.org/src/rev/e74e6365fd3e
branches:  trunk
changeset: 362574:e74e6365fd3e
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Jun 16 00:13:06 2018 +0000

description:
If clock-output-names is specified, use it for the clock name instead of the node name

diffstat:

 sys/dev/fdt/fixedclock.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (44 lines):

diff -r c5738f101e85 -r e74e6365fd3e sys/dev/fdt/fixedclock.c
--- a/sys/dev/fdt/fixedclock.c  Sat Jun 16 00:12:35 2018 +0000
+++ b/sys/dev/fdt/fixedclock.c  Sat Jun 16 00:13:06 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fixedclock.c,v 1.3 2018/04/28 15:21:05 jmcneill Exp $ */
+/* $NetBSD: fixedclock.c,v 1.4 2018/06/16 00:13:06 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fixedclock.c,v 1.3 2018/04/28 15:21:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fixedclock.c,v 1.4 2018/06/16 00:13:06 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -89,6 +89,11 @@
        struct fixedclock_softc * const sc = device_private(self);
        const struct fdt_attach_args *faa = aux;
        const int phandle = faa->faa_phandle;
+       const char *clkname;
+
+       clkname = fdtbus_get_string(phandle, "clock-output-names");
+       if (!clkname)
+               clkname = faa->faa_name;
 
        sc->sc_dev = self;
        sc->sc_phandle = phandle;
@@ -101,11 +106,11 @@
                return;
        }
        sc->sc_clk.base.domain = &sc->sc_clkdom;
-       sc->sc_clk.base.name = kmem_asprintf("%s", faa->faa_name);
+       sc->sc_clk.base.name = kmem_asprintf("%s", clkname);
        clk_attach(&sc->sc_clk.base);
 
        aprint_naive("\n");
-       aprint_normal(": %u Hz fixed clock\n", sc->sc_clk.rate);
+       aprint_normal(": %u Hz fixed clock (%s)\n", sc->sc_clk.rate, clkname);
 
        fdtbus_register_clock_controller(self, phandle, &fixedclock_fdt_funcs);
 }



Home | Main Index | Thread Index | Old Index