Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Fix up USBMODE registers in sc_vendor_init functions and...
details: https://anonhg.NetBSD.org/src/rev/6fde54f2b170
branches: trunk
changeset: 810674:6fde54f2b170
user: skrll <skrll%NetBSD.org@localhost>
date: Fri Sep 11 06:51:43 2015 +0000
description:
Fix up USBMODE registers in sc_vendor_init functions and not in the ehci
driver.
diffstat:
sys/arch/mips/atheros/dev/ehci_arbus.c | 30 ++++++++++++++++++++++++++++--
sys/arch/powerpc/booke/dev/pq3ehci.c | 29 +++++++++++++++++++++++++++--
sys/dev/usb/ehci.c | 15 ++-------------
sys/dev/usb/ehcireg.h | 11 +----------
4 files changed, 58 insertions(+), 27 deletions(-)
diffs (197 lines):
diff -r a728244fa58a -r 6fde54f2b170 sys/arch/mips/atheros/dev/ehci_arbus.c
--- a/sys/arch/mips/atheros/dev/ehci_arbus.c Fri Sep 11 02:26:22 2015 +0000
+++ b/sys/arch/mips/atheros/dev/ehci_arbus.c Fri Sep 11 06:51:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci_arbus.c,v 1.2 2012/07/20 02:14:02 matt Exp $ */
+/* $NetBSD: ehci_arbus.c,v 1.3 2015/09/11 06:51:43 skrll Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_arbus.c,v 1.2 2012/07/20 02:14:02 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_arbus.c,v 1.3 2015/09/11 06:51:43 skrll Exp $");
#include "locators.h"
@@ -50,12 +50,24 @@
#include <dev/usb/ehcireg.h>
#include <dev/usb/ehcivar.h>
+/*
+ * This is relative to the start of the unreserved registers in USB contoller
+ * block and not the full USB block which would be 0x1a8.
+ */
+#define ARBUS_USBMODE 0xa8 /* USB mode */
+#define USBMODE_CM __BITS(0,1) /* Controller Mode */
+#define USBMODE_CM_IDLE __SHIFTIN(0,USBMODE_CM) /* Idle (both) */
+#define USBMODE_CM_DEVICE __SHIFTIN(2,USBMODE_CM) /* Device Controller */
+#define USBMODE_CM_HOST __SHIFTIN(3,USBMODE_CM) /* Host Controller */
+
static int ehci_arbus_match(device_t, cfdata_t, void *);
static void ehci_arbus_attach(device_t, device_t, void *);
CFATTACH_DECL_NEW(ehci_arbus, sizeof (ehci_softc_t),
ehci_arbus_match, ehci_arbus_attach, NULL, NULL);
+static void ehci_arbus_init(struct ehci_soft *);
+
int
ehci_arbus_match(device_t parent, cfdata_t cf, void *aux)
{
@@ -85,6 +97,7 @@
sc->sc_bus.dmatag = aa->aa_dmat;
sc->sc_bus.usbrev = USBREV_1_0;
sc->sc_flags |= EHCIF_ETTF;
+ sc->sc_vendor_init = ehci_arbus_init;
error = bus_space_map(aa->aa_bst, aa->aa_addr, aa->aa_size, 0,
&sc->ioh);
@@ -136,3 +149,16 @@
sc->sc_child = config_found(self, &sc->sc_bus, usbctlprint);
}
+static void
+ehci_arbus_init(struct ehci_softc *sc)
+{
+ /* Set host mode */
+ uint32_t old = bus_space_read_4(sc->iot, sc->ioh, ARBUS_USBMODE);
+ uint32_t reg = old;
+
+ reg &= ~USBMODE_CM;
+ reg |= USBMODE_CM_HOST;
+ if (reg != old)
+ bus_space_write_4(sc->iot, sc->ioh, ARBUS_USBMODE, reg);
+
+}
diff -r a728244fa58a -r 6fde54f2b170 sys/arch/powerpc/booke/dev/pq3ehci.c
--- a/sys/arch/powerpc/booke/dev/pq3ehci.c Fri Sep 11 02:26:22 2015 +0000
+++ b/sys/arch/powerpc/booke/dev/pq3ehci.c Fri Sep 11 06:51:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pq3ehci.c,v 1.5 2012/07/20 02:14:01 matt Exp $ */
+/* $NetBSD: pq3ehci.c,v 1.6 2015/09/11 06:51:43 skrll Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pq3ehci.c,v 1.5 2012/07/20 02:14:01 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3ehci.c,v 1.6 2015/09/11 06:51:43 skrll Exp $");
#include "opt_usb.h"
@@ -54,6 +54,16 @@
#include <dev/usb/ehcireg.h>
#include <dev/usb/ehcivar.h>
+/*
+ * This is relative to the start of the unreserved registers in USB contoller
+ * block and not the full USB block which would be 0x1a8.
+ */
+#define PQ3_USBMODE 0xa8 /* USB mode */
+#define USBMODE_CM __BITS(0,1) /* Controller Mode */
+#define USBMODE_CM_IDLE __SHIFTIN(0,USBMODE_CM) /* Idle (both) */
+#define USBMODE_CM_DEVICE __SHIFTIN(2,USBMODE_CM) /* Device Controller */
+#define USBMODE_CM_HOST __SHIFTIN(3,USBMODE_CM) /* Host Controller */
+
#ifdef EHCI_DEBUG
#define DPRINTF(x) if (ehcidebug) printf x
extern int ehcidebug;
@@ -69,6 +79,8 @@
void *sc_ih; /* interrupt vectoring */
};
+static void pq3ehci_init(struct ehci_softc *);
+
CFATTACH_DECL_NEW(pq3ehci, sizeof(struct pq3ehci_softc),
pq3ehci_match, pq3ehci_attach, NULL, NULL);
@@ -99,6 +111,7 @@
sc->sc.sc_bus.usbrev = USBREV_2_0;
sc->sc.sc_ncomp = 0;
sc->sc.sc_flags |= EHCIF_ETTF;
+ sc->sc.sc_vendor_init = pq3ehci_init;
aprint_naive(": USB controller\n");
aprint_normal(": USB controller\n");
@@ -161,3 +174,15 @@
}
return;
}
+
+static void
+pq3ehci_init(struct ehci_softc *hsc)
+{
+ uint32_t old = bus_space_read_4(hsc->iot, hsc->ioh, PQ3_USBMODE);
+ uint32_t reg = old;
+
+ reg &= ~USBMODE_CM;
+ reg |= USBMODE_CM_HOST;
+ if (reg != old)
+ bus_space_write_4(hsc->iot, hsc->ioh, PQ3_USBMODE, reg);
+}
diff -r a728244fa58a -r 6fde54f2b170 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Fri Sep 11 02:26:22 2015 +0000
+++ b/sys/dev/usb/ehci.c Fri Sep 11 06:51:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.244 2015/08/24 23:55:04 pooka Exp $ */
+/* $NetBSD: ehci.c,v 1.245 2015/09/11 06:51:43 skrll Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.244 2015/08/24 23:55:04 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.245 2015/09/11 06:51:43 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -450,17 +450,6 @@
if (sc->sc_vendor_init)
sc->sc_vendor_init(sc);
- /*
- * If we are doing embedded transaction translation function, force
- * the controller to host mode.
- */
- if (sc->sc_flags & EHCIF_ETTF) {
- uint32_t usbmode = EOREAD4(sc, EHCI_USBMODE);
- usbmode &= ~EHCI_USBMODE_CM;
- usbmode |= EHCI_USBMODE_CM_HOST;
- EOWRITE4(sc, EHCI_USBMODE, usbmode);
- }
-
/* XXX need proper intr scheduling */
sc->sc_rand = 96;
diff -r a728244fa58a -r 6fde54f2b170 sys/dev/usb/ehcireg.h
--- a/sys/dev/usb/ehcireg.h Fri Sep 11 02:26:22 2015 +0000
+++ b/sys/dev/usb/ehcireg.h Fri Sep 11 06:51:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehcireg.h,v 1.35 2015/09/05 06:13:54 skrll Exp $ */
+/* $NetBSD: ehcireg.h,v 1.36 2015/09/11 06:51:43 skrll Exp $ */
/*
* Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -175,15 +175,6 @@
#define EHCI_PORT_RESET_COMPLETE 2 /* ms */
-#define EHCI_USBMODE 0xa8 /* USB Device mode */
-#define EHCI_USBMODE_SDIS __BIT(4) /* Stream disable mode 1=act */
-#define EHCI_USBMODE_SLOM __BIT(3) /* setup lockouts on */
-#define EHCI_USBMODE_ES __BIT(2) /* Endian Select ES=1 */
-#define EHCI_USBMODE_CM __BITS(0,1) /* Controller Mode */
-#define EHCI_USBMODE_CM_IDLE 0x00 /* Idle (combo host/device) */
-#define EHCI_USBMODE_CM_DEV 0x02 /* Device Controller */
-#define EHCI_USBMODE_CM_HOST 0x03 /* Host Controller */
-
#define EHCI_FLALIGN_ALIGN 0x1000
#define EHCI_MAX_PORTS 16 /* only 4 bits available in EHCI_HCS_N_PORTS */
Home |
Main Index |
Thread Index |
Old Index