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 Lookup reg resources by name instead of i...



details:   https://anonhg.NetBSD.org/src/rev/d34663b38da7
branches:  trunk
changeset: 826271:d34663b38da7
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Aug 25 12:28:51 2017 +0000

description:
Lookup reg resources by name instead of index; fixes USB on non-H3/A64 SoCs

diffstat:

 sys/arch/arm/sunxi/sunxi_usbphy.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r de1ce41e1780 -r d34663b38da7 sys/arch/arm/sunxi/sunxi_usbphy.c
--- a/sys/arch/arm/sunxi/sunxi_usbphy.c Fri Aug 25 12:28:10 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_usbphy.c Fri Aug 25 12:28:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_usbphy.c,v 1.4 2017/08/25 00:07:03 jmcneill Exp $ */
+/* $NetBSD: sunxi_usbphy.c,v 1.5 2017/08/25 12:28:51 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.4 2017/08/25 00:07:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.5 2017/08/25 12:28:51 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -194,7 +194,7 @@
        sc->sc_bst = faa->faa_bst;
        sc->sc_type = of_search_compatible(phandle, compat_data)->data;
 
-       if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
+       if (fdtbus_get_reg_byname(phandle, "phy_ctrl", &addr, &size) != 0) {
                aprint_error(": couldn't get phy ctrl registers\n");
                return;
        }
@@ -204,11 +204,14 @@
        }
 
        for (sc->sc_nphys = 0; sc->sc_nphys < SUNXI_MAXUSBPHY; sc->sc_nphys++) {
-               if (fdtbus_get_reg(phandle, sc->sc_nphys + 1, &addr, &size) != 0)
-                       break;
                phy = &sc->sc_phys[sc->sc_nphys];
                phy->phy_index = sc->sc_nphys;
-               if (bus_space_map(sc->sc_bst, addr, size, 0, &phy->phy_bsh) != 0) {
+               snprintf(pname, sizeof(pname), "pmu%d", sc->sc_nphys);
+               if (fdtbus_get_reg_byname(phandle, pname, &addr, &size) != 0) {
+                       /* There may be no registers for OTG PHY */
+                       if (sc->sc_nphys > 0)
+                               break;
+               } else if (bus_space_map(sc->sc_bst, addr, size, 0, &phy->phy_bsh) != 0) {
                        aprint_error(": failed to map reg #%d\n", sc->sc_nphys);
                        return;
                }



Home | Main Index | Thread Index | Old Index