Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Add vendor dependent functions.



details:   https://anonhg.NetBSD.org/src/rev/6acd27793c89
branches:  trunk
changeset: 758056:6acd27793c89
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Sat Oct 16 05:23:41 2010 +0000

description:
Add vendor dependent functions.
  sc_vendor_init()/sc_vendor_port_status().

diffstat:

 sys/dev/usb/ehci.c    |  13 +++++++++----
 sys/dev/usb/ehcivar.h |   5 ++++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diffs (74 lines):

diff -r f8c3fad3fd45 -r 6acd27793c89 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sat Oct 16 05:14:14 2010 +0000
+++ b/sys/dev/usb/ehci.c        Sat Oct 16 05:23:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.169 2010/07/07 03:55:01 msaitoh Exp $ */
+/*     $NetBSD: ehci.c,v 1.170 2010/10/16 05:23:41 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2004-2008 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.169 2010/07/07 03:55:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.170 2010/10/16 05:23:41 kiyohara Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -392,6 +392,8 @@
                aprint_error("%s: reset timeout\n", device_xname(sc->sc_dev));
                return (USBD_IOERROR);
        }
+       if (sc->sc_vendor_init)
+               sc->sc_vendor_init(sc);
 
        /* XXX need proper intr scheduling */
        sc->sc_rand = 96;
@@ -2254,6 +2256,8 @@
                if (v & EHCI_PS_OCA)    i |= UPS_OVERCURRENT_INDICATOR;
                if (v & EHCI_PS_PR)     i |= UPS_RESET;
                if (v & EHCI_PS_PP)     i |= UPS_PORT_POWER;
+               if (sc->sc_vendor_port_status)
+                       i = sc->sc_vendor_port_status(sc, v, i);
                USETW(ps.wPortStatus, i);
                i = 0;
                if (v & EHCI_PS_CSC)    i |= UPS_C_CONNECT_STATUS;
@@ -2289,7 +2293,7 @@
                case UHF_PORT_RESET:
                        DPRINTFN(5,("ehci_root_ctrl_start: reset port %d\n",
                                    index));
-                       if (EHCI_PS_IS_LOWSPEED(v)) {
+                       if (EHCI_PS_IS_LOWSPEED(v) && sc->sc_ncomp > 0) {
                                /* Low speed device, give up ownership. */
                                ehci_disown(sc, index, 1);
                                break;
@@ -2304,7 +2308,8 @@
                                goto ret;
                        }
                        /* Terminate reset sequence. */
-                       EOWRITE4(sc, port, v);
+                       v = EOREAD4(sc, port);
+                       EOWRITE4(sc, port, v & ~EHCI_PS_PR);
                        /* Wait for HC to complete reset. */
                        usb_delay_ms(&sc->sc_bus, EHCI_PORT_RESET_COMPLETE);
                        if (sc->sc_dying) {
diff -r f8c3fad3fd45 -r 6acd27793c89 sys/dev/usb/ehcivar.h
--- a/sys/dev/usb/ehcivar.h     Sat Oct 16 05:14:14 2010 +0000
+++ b/sys/dev/usb/ehcivar.h     Sat Oct 16 05:23:41 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehcivar.h,v 1.36 2010/02/24 22:38:09 dyoung Exp $ */
+/*     $NetBSD: ehcivar.h,v 1.37 2010/10/16 05:23:42 kiyohara Exp $ */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -167,6 +167,9 @@
        device_t sc_child; /* /dev/usb# device */
        char sc_dying;
        struct usb_dma_reserve sc_dma_reserve;
+
+       void (*sc_vendor_init)(struct ehci_softc *);
+       int (*sc_vendor_port_status)(struct ehci_softc *, uint32_t, int);
 } ehci_softc_t;
 
 #define EREAD1(sc, a) bus_space_read_1((sc)->iot, (sc)->ioh, (a))



Home | Main Index | Thread Index | Old Index