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 clocks and de-assert resets



details:   https://anonhg.NetBSD.org/src/rev/42f9ec03d4ad
branches:  trunk
changeset: 827334:42f9ec03d4ad
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Oct 23 21:03:24 2017 +0000

description:
Enable clocks and de-assert resets

diffstat:

 sys/arch/arm/sunxi/sunxi_com.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (40 lines):

diff -r 7b0d8ba076bd -r 42f9ec03d4ad sys/arch/arm/sunxi/sunxi_com.c
--- a/sys/arch/arm/sunxi/sunxi_com.c    Mon Oct 23 19:36:01 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_com.c    Mon Oct 23 21:03:24 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_com.c,v 1.2 2017/06/29 17:05:26 jmcneill Exp $ */
+/* $NetBSD: sunxi_com.c,v 1.3 2017/10/23 21:03:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.2 2017/06/29 17:05:26 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.3 2017/10/23 21:03:24 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -106,10 +106,18 @@
        sc->sc_dev = self;
 
        ssc->ssc_clk = fdtbus_clock_get_index(faa->faa_phandle, 0);
-       ssc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0);
+       if (ssc->ssc_clk == NULL) {
+               aprint_error(": couldn't get clock\n");
+               return;
+       }
+       if (clk_enable(ssc->ssc_clk) != 0) {
+               aprint_error(": couldn't enable clock\n");
+               return;
+       }
 
-       if (ssc->ssc_clk == NULL) {
-               aprint_error(": couldn't get frequency\n");
+       ssc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0);
+       if (ssc->ssc_rst && fdtbus_reset_deassert(ssc->ssc_rst) != 0) {
+               aprint_error(": couldn't de-assert reset\n");
                return;
        }
 



Home | Main Index | Thread Index | Old Index