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 PHY registers start at index 1. Now USB w...



details:   https://anonhg.NetBSD.org/src/rev/85042f11d4b4
branches:  trunk
changeset: 825084:85042f11d4b4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Jun 29 20:54:03 2017 +0000

description:
PHY registers start at index 1. Now USB works.

diffstat:

 sys/arch/arm/sunxi/sunxi_usbphy.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (54 lines):

diff -r 9acfaae1c317 -r 85042f11d4b4 sys/arch/arm/sunxi/sunxi_usbphy.c
--- a/sys/arch/arm/sunxi/sunxi_usbphy.c Thu Jun 29 19:38:24 2017 +0000
+++ b/sys/arch/arm/sunxi/sunxi_usbphy.c Thu Jun 29 20:54:03 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_usbphy.c,v 1.1 2017/06/29 17:08:52 jmcneill Exp $ */
+/* $NetBSD: sunxi_usbphy.c,v 1.2 2017/06/29 20:54:03 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.1 2017/06/29 17:08:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.2 2017/06/29 20:54:03 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -58,7 +58,7 @@
        NULL
 };
 
-#define        SUNXI_MAXUSBPHY         5
+#define        SUNXI_MAXUSBPHY         4
 
 struct sunxi_usbphy {
        u_int                   phy_index;
@@ -69,6 +69,7 @@
 struct sunxi_usbphy_softc {
        device_t                sc_dev;
        bus_space_tag_t         sc_bst;
+       bus_space_handle_t      sc_bsh_phy_ctrl;
 
        struct sunxi_usbphy     sc_phys[SUNXI_MAXUSBPHY];
        u_int                   sc_nphys;
@@ -181,8 +182,17 @@
        sc->sc_dev = self;
        sc->sc_bst = faa->faa_bst;
 
+       if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
+               aprint_error(": couldn't get phy ctrl registers\n");
+               return;
+       }
+       if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh_phy_ctrl) != 0) {
+               aprint_error(": couldn't map phy ctrl registers\n");
+               return;
+       }
+
        for (sc->sc_nphys = 0; sc->sc_nphys < SUNXI_MAXUSBPHY; sc->sc_nphys++) {
-               if (fdtbus_get_reg(phandle, sc->sc_nphys, &addr, &size) != 0)
+               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;



Home | Main Index | Thread Index | Old Index