Module Name:    src
Committed By:   skrll
Date:           Mon May 18 09:56:43 UTC 2015

Modified Files:
        src/sys/arch/arm/nvidia: tegra_ehci.c tegra_ehcireg.h

Log Message:
Re-enable EHCIF_ETTF and provide a sc_vendor_port_status to get port
speed from HOSTSC1

My FS usb stick works with this change.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/nvidia/tegra_ehci.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/nvidia/tegra_ehcireg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_ehci.c
diff -u src/sys/arch/arm/nvidia/tegra_ehci.c:1.4 src/sys/arch/arm/nvidia/tegra_ehci.c:1.5
--- src/sys/arch/arm/nvidia/tegra_ehci.c:1.4	Sat May  9 18:56:51 2015
+++ src/sys/arch/arm/nvidia/tegra_ehci.c	Mon May 18 09:56:43 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_ehci.c,v 1.4 2015/05/09 18:56:51 jmcneill Exp $ */
+/* $NetBSD: tegra_ehci.c,v 1.5 2015/05/18 09:56:43 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c,v 1.4 2015/05/09 18:56:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c,v 1.5 2015/05/18 09:56:43 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -66,6 +66,8 @@ struct tegra_ehci_softc {
 };
 
 static void	tegra_ehci_utmip_init(struct tegra_ehci_softc *);
+static int	tegra_ehci_port_status(struct ehci_softc *sc, uint32_t v,
+		    int i);
 
 CFATTACH_DECL2_NEW(tegra_ehci, sizeof(struct tegra_ehci_softc),
 	tegra_ehci_match, tegra_ehci_attach, NULL,
@@ -96,7 +98,9 @@ tegra_ehci_attach(device_t parent, devic
 	sc->sc.sc_bus.hci_private = &sc->sc;
 	sc->sc.sc_bus.dmatag = tio->tio_dmat;
 	sc->sc.sc_bus.usbrev = USBREV_2_0;
-	sc->sc.sc_flags = 0;	/* XXX EHCIF_ETTF */
+	sc->sc.sc_vendor_port_status = tegra_ehci_port_status;
+	sc->sc.sc_ncomp = 0;
+	sc->sc.sc_flags = EHCIF_ETTF;
 	sc->sc.sc_id_vendor = 0x10de;
 	strlcpy(sc->sc.sc_vendor, "Tegra", sizeof(sc->sc.sc_vendor));
 	sc->sc.sc_size = loc->loc_size;
@@ -311,3 +315,30 @@ tegra_ehci_utmip_init(struct tegra_ehci_
 		    0, TEGRA_EHCI_UTMIP_BIAS_CFG1_PDTRK_POWERDOWN);
 	}
 }
+
+
+static int
+tegra_ehci_port_status(struct ehci_softc *sc, uint32_t v, int i)
+{
+	bus_space_tag_t iot = sc->iot;
+	bus_space_handle_t ioh = sc->ioh;
+
+	i &= ~UPS_HIGH_SPEED;
+
+	uint32_t val = bus_space_read_4(iot, ioh,
+	    TEGRA_EHCI_HOSTPC1_DEVLC_REG);
+
+	switch (__SHIFTOUT(val, TEGRA_EHCI_HOSTPC1_DEVLC_PSPD)) {
+	case TEGRA_EHCI_HOSTPC1_DEVLC_PSPD_FS:
+		i |= UPS_FULL_SPEED;
+		break;
+	case TEGRA_EHCI_HOSTPC1_DEVLC_PSPD_LS:
+		i |= UPS_LOW_SPEED;
+		break;
+	case TEGRA_EHCI_HOSTPC1_DEVLC_PSPD_HS:
+	default:
+		i |= UPS_HIGH_SPEED;
+		break;
+	}
+	return i;
+}

Index: src/sys/arch/arm/nvidia/tegra_ehcireg.h
diff -u src/sys/arch/arm/nvidia/tegra_ehcireg.h:1.1 src/sys/arch/arm/nvidia/tegra_ehcireg.h:1.2
--- src/sys/arch/arm/nvidia/tegra_ehcireg.h:1.1	Sat May  9 18:56:51 2015
+++ src/sys/arch/arm/nvidia/tegra_ehcireg.h	Mon May 18 09:56:43 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_ehcireg.h,v 1.1 2015/05/09 18:56:51 jmcneill Exp $ */
+/* $NetBSD: tegra_ehcireg.h,v 1.2 2015/05/18 09:56:43 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca>
@@ -42,6 +42,20 @@
 #define TEGRA_EHCI_HOSTPC1_DEVLC_PTS_ULPI	2
 #define TEGRA_EHCI_HOSTPC1_DEVLC_PTS_ICUSB_SER	3
 #define TEGRA_EHCI_HOSTPC1_DEVLC_STS		__BIT(28)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_PTW		__BIT(27)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_PSPD		__BITS(26,25)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_PSPD_FS	0
+#define TEGRA_EHCI_HOSTPC1_DEVLC_PSPD_LS	1
+#define TEGRA_EHCI_HOSTPC1_DEVLC_PSPD_HS	2
+#define TEGRA_EHCI_HOSTPC1_DEVLC_ALPD		__BIT(24)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_PFSC		__BIT(23)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_PHCD		__BIT(22)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_H_LPMX		__BITS(21,20)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_H_EPLPM	__BITS(19,16)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_H_LPMFRM	__BITS(15,12)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_D_ASUS		__BIT(17)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_D_STL		__BIT(16)
+#define TEGRA_EHCI_HOSTPC1_DEVLC_BA		__BITS(11,1)
 
 #define TEGRA_EHCI_USBMODE_REG			0x1f8
 #define TEGRA_EHCI_USBMODE_CM			__BITS(1,0)

Reply via email to