xref: /netbsd-src/sys/dev/usb/ehci.c (revision 3b01aba77a7a698587faaae455bbfe740923c1f5)
1 /*	$NetBSD: ehci.c,v 1.2 2000/12/24 06:42:35 augustss Exp $	*/
2 
3 /*
4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Lennart Augustsson (lennart@augustsson.net).
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 /*
40  * USB Enhanced Host Controller Driver.
41  *
42  * EHCI 0.95 spec can be found at
43  * http://developer.intel.com/technology/usb/download/ehci-r095.pdf
44  *
45  * This is just a stub.
46  */
47 
48 #include <sys/param.h>
49 #include <sys/systm.h>
50 #include <sys/kernel.h>
51 #include <sys/malloc.h>
52 #include <sys/device.h>
53 #include <sys/select.h>
54 #include <sys/proc.h>
55 #include <sys/queue.h>
56 
57 #include <machine/bus.h>
58 #include <machine/endian.h>
59 
60 #include <dev/usb/usb.h>
61 #include <dev/usb/usbdi.h>
62 #include <dev/usb/usbdivar.h>
63 #include <dev/usb/usb_mem.h>
64 #include <dev/usb/usb_quirks.h>
65 
66 #include <dev/usb/ehcireg.h>
67 #include <dev/usb/ehcivar.h>
68 
69 #ifdef EHCI_DEBUG
70 #define DPRINTF(x)	if (ehcidebug) printf x
71 #define DPRINTFN(n,x)	if (ehcidebug>(n)) printf x
72 int ehcidebug = 0;
73 #define bitmask_snprintf(q,f,b,l) snprintf((b), (l), "%b", (q), (f))
74 #else
75 #define DPRINTF(x)
76 #define DPRINTFN(n,x)
77 #endif
78 
79 usbd_status
80 ehci_init(ehci_softc_t *sc)
81 {
82 	printf("EHCI not supported yet.\n");
83 	return (USBD_IOERROR);
84 }
85 
86 int
87 ehci_intr(void *v)
88 {
89 	return (0);
90 }
91 
92 int
93 ehci_detach(struct ehci_softc *sc, int flags)
94 {
95 	int rv = 0;
96 
97 	if (sc->sc_child != NULL)
98 		rv = config_detach(sc->sc_child, flags);
99 
100 	if (rv != 0)
101 		return (rv);
102 
103 	if (sc->sc_powerhook != NULL)
104 		powerhook_disestablish(sc->sc_powerhook);
105 	if (sc->sc_shutdownhook != NULL)
106 		shutdownhook_disestablish(sc->sc_shutdownhook);
107 
108 	/* XXX free other data structures XXX */
109 
110 	return (rv);
111 }
112 
113 
114 int
115 ehci_activate(device_ptr_t self, enum devact act)
116 {
117 	struct ehci_softc *sc = (struct ehci_softc *)self;
118 	int rv = 0;
119 
120 	switch (act) {
121 	case DVACT_ACTIVATE:
122 		return (EOPNOTSUPP);
123 		break;
124 
125 	case DVACT_DEACTIVATE:
126 		if (sc->sc_child != NULL)
127 			rv = config_deactivate(sc->sc_child);
128 		break;
129 	}
130 	return (rv);
131 }
132 
133