Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/nvidia Print an error if we can't acquire a clo...



details:   https://anonhg.NetBSD.org/src/rev/da45f6ef2a51
branches:  trunk
changeset: 826696:da45f6ef2a51
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Sep 22 11:01:24 2017 +0000

description:
Print an error if we can't acquire a clock or reset

diffstat:

 sys/arch/arm/nvidia/tegra210_xusbpad.c |  24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diffs (46 lines):

diff -r 074369d56c12 -r da45f6ef2a51 sys/arch/arm/nvidia/tegra210_xusbpad.c
--- a/sys/arch/arm/nvidia/tegra210_xusbpad.c    Fri Sep 22 10:55:43 2017 +0000
+++ b/sys/arch/arm/nvidia/tegra210_xusbpad.c    Fri Sep 22 11:01:24 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra210_xusbpad.c,v 1.3 2017/09/22 01:24:31 jmcneill Exp $ */
+/* $NetBSD: tegra210_xusbpad.c,v 1.4 2017/09/22 11:01:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra210_xusbpad.c,v 1.3 2017/09/22 01:24:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra210_xusbpad.c,v 1.4 2017/09/22 11:01:24 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -237,15 +237,19 @@
                return;         /* pad is disabled */
 
        /* Enable the pad's resources */
-       clk = fdtbus_clock_get_index(phandle, 0);
-       if (clk && clk_enable(clk) != 0) {
-               aprint_error_dev(sc->sc_dev, "couldn't enable %s's clock\n", name);
-               return;
+       if (of_hasprop(phandle, "clocks")) {
+               clk = fdtbus_clock_get_index(phandle, 0);
+               if (clk == NULL || clk_enable(clk) != 0) {
+                       aprint_error_dev(sc->sc_dev, "couldn't enable %s's clock\n", name);
+                       return;
+               }
        }
-       rst = fdtbus_reset_get_index(phandle, 0);
-       if (rst && fdtbus_reset_deassert(rst) != 0) {
-               aprint_error_dev(sc->sc_dev, "couldn't de-assert %s's reset\n", name);
-               return;
+       if (of_hasprop(phandle, "resets")) {
+               rst = fdtbus_reset_get_index(phandle, 0);
+               if (rst == NULL || fdtbus_reset_deassert(rst) != 0) {
+                       aprint_error_dev(sc->sc_dev, "couldn't de-assert %s's reset\n", name);
+                       return;
+               }
        }
 
        /* Configure lanes */



Home | Main Index | Thread Index | Old Index