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 Make failure-to-attach errors a little mo...



details:   https://anonhg.NetBSD.org/src/rev/4f15de273e26
branches:  trunk
changeset: 1000204:4f15de273e26
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Jul 13 21:56:23 2019 +0000

description:
Make failure-to-attach errors a little more informative.

diffstat:

 sys/arch/arm/sunxi/sunxi_emac.c |  35 +++++++++++++++++++++++------------
 1 files changed, 23 insertions(+), 12 deletions(-)

diffs (86 lines):

diff -r 8dba22752a36 -r 4f15de273e26 sys/arch/arm/sunxi/sunxi_emac.c
--- a/sys/arch/arm/sunxi/sunxi_emac.c   Sat Jul 13 21:55:52 2019 +0000
+++ b/sys/arch/arm/sunxi/sunxi_emac.c   Sat Jul 13 21:56:23 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.27 2019/05/23 10:40:39 msaitoh Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.28 2019/07/13 21:56:23 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.27 2019/05/23 10:40:39 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.28 2019/07/13 21:56:23 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1280,23 +1280,33 @@
        bus_addr_t addr, size;
 
        /* Map EMAC registers */
-       if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0)
+       if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
+               aprint_error_dev(sc->dev, "unable to get registers\n");
                return ENXIO;
-       if (bus_space_map(sc->bst, addr, size, 0, &sc->bsh) != 0)
+       }
+       if (bus_space_map(sc->bst, addr, size, 0, &sc->bsh) != 0) {
+               aprint_error_dev(sc->dev, "unable to map registers\n");
                return ENXIO;
+       }
 
        /* Get SYSCON registers */
        sc->syscon = fdtbus_syscon_acquire(phandle, "syscon");
-       if (sc->syscon == NULL)
+       if (sc->syscon == NULL) {
+               aprint_error_dev(sc->dev, "unable to acquire syscon\n");
                return ENXIO;
+       }
 
        /* The "ahb"/"stmmaceth" clock and reset is required */
        if ((sc->clk_ahb = fdtbus_clock_get(phandle, "ahb")) == NULL &&
-           (sc->clk_ahb = fdtbus_clock_get(phandle, "stmmaceth")) == NULL)
+           (sc->clk_ahb = fdtbus_clock_get(phandle, "stmmaceth")) == NULL) {
+               aprint_error_dev(sc->dev, "unable to get clock\n");
                return ENXIO;
+       }
        if ((sc->rst_ahb = fdtbus_reset_get(phandle, "ahb")) == NULL &&
-           (sc->rst_ahb = fdtbus_reset_get(phandle, "stmmaceth")) == NULL)
+           (sc->rst_ahb = fdtbus_reset_get(phandle, "stmmaceth")) == NULL) {
+               aprint_error_dev(sc->dev, "unable to get reset\n");
                return ENXIO;
+       }
 
        /* Internal PHY clock and reset are optional properties. */
        sc->clk_ephy = fdtbus_clock_get(phandle, "ephy");
@@ -1366,12 +1376,16 @@
        sc->type = of_search_compatible(phandle, compat_data)->data;
        sc->phy_id = sunxi_emac_get_phyid(sc);
 
+       aprint_naive("\n");
+       aprint_normal(": EMAC\n");
+
        if (sunxi_emac_get_resources(sc) != 0) {
-               aprint_error(": cannot allocate resources for device\n");
+               aprint_error_dev(self,
+                   "cannot allocate resources for device\n");
                return;
        }
        if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
-               aprint_error(": cannot decode interrupt\n");
+               aprint_error_dev(self, "cannot decode interrupt\n");
                return;
        }
 
@@ -1379,9 +1393,6 @@
        callout_init(&sc->stat_ch, CALLOUT_FLAGS);
        callout_setfunc(&sc->stat_ch, sunxi_emac_tick, sc);
 
-       aprint_naive("\n");
-       aprint_normal(": EMAC\n");
-
        /* Setup clocks and regulators */
        if (sunxi_emac_setup_resources(sc) != 0)
                return;



Home | Main Index | Thread Index | Old Index