Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/sunxi Enable parent clocks



details:   https://anonhg.NetBSD.org/src/rev/b717fdb827de
branches:  trunk
changeset: 999291:b717fdb827de
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue May 28 00:02:32 2019 +0000

description:
Enable parent clocks

diffstat:

 sys/arch/arm/sunxi/sun9i_a80_mmcclk.c |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (46 lines):

diff -r 5518dceb491f -r b717fdb827de sys/arch/arm/sunxi/sun9i_a80_mmcclk.c
--- a/sys/arch/arm/sunxi/sun9i_a80_mmcclk.c     Mon May 27 23:28:41 2019 +0000
+++ b/sys/arch/arm/sunxi/sun9i_a80_mmcclk.c     Tue May 28 00:02:32 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sun9i_a80_mmcclk.c,v 1.1 2017/10/08 18:00:36 jmcneill Exp $ */
+/* $NetBSD: sun9i_a80_mmcclk.c,v 1.2 2019/05/28 00:02:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: sun9i_a80_mmcclk.c,v 1.1 2017/10/08 18:00:36 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun9i_a80_mmcclk.c,v 1.2 2019/05/28 00:02:32 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -79,6 +79,9 @@
 {
        struct sunxi_ccu_softc * const sc = device_private(self);
        struct fdt_attach_args * const faa = aux;
+       const int phandle = faa->faa_phandle;
+       struct fdtbus_reset *rst;
+       struct clk *clk;
 
        sc->sc_dev = self;
        sc->sc_phandle = faa->faa_phandle;
@@ -90,6 +93,17 @@
        sc->sc_clks = sun9i_a80_mmcclk_clks;
        sc->sc_nclks = __arraycount(sun9i_a80_mmcclk_clks);
 
+       clk = fdtbus_clock_get(phandle, "ahb");
+       if (clk == NULL || clk_enable(clk) != 0) {
+               aprint_error(": couldn't enable clock\n");
+               return;
+       }
+       rst = fdtbus_reset_get(phandle, "ahb");
+       if (rst == NULL || fdtbus_reset_deassert(rst) != 0) {
+               aprint_error(": couldn't de-assert reset\n");
+               return;
+       }
+
        if (sunxi_ccu_attach(sc) != 0)
                return;
 



Home | Main Index | Thread Index | Old Index