xref: /netbsd/sys/dev/ic/sl811hsvar.h (revision c4a72b64)
1 /*	$NetBSD: sl811hsvar.h,v 1.1 2002/08/11 13:17:54 isaki Exp $	*/
2 
3 /*
4  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Tetsuya Isaki.
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  * ScanLogic SL811HS/T USB Host Controller
41  */
42 
43 #define MS_TO_TICKS(ms) ((ms) * hz / 1000)
44 #define delay_ms(X) \
45 	ltsleep(&slhci_dummy, PZERO | PCATCH, "slhci", MS_TO_TICKS(X), NULL)
46 
47 #define SL11_PID_OUT	(0x1)
48 #define SL11_PID_IN 	(0x9)
49 #define SL11_PID_SOF	(0x5)
50 #define SL11_PID_SETUP	(0xd)
51 
52 struct slhci_xfer {
53 	usbd_xfer_handle sx_xfer;
54 	usb_callout_t sx_callout_t;
55 };
56 
57 struct slhci_softc {
58 	struct usbd_bus		 sc_bus;
59 	bus_space_tag_t		 sc_iot;
60 	bus_space_handle_t	 sc_ioh;
61 	bus_dma_tag_t		 sc_dmat;
62 
63 	void				(*sc_enable_power)(void *, int);
64 	void				(*sc_enable_intr)(void *, int);
65 	void				*sc_arg;
66 	int					 sc_powerstat;
67 #define POWER_ON	(1)
68 #define POWER_OFF	(0)
69 #define INTR_ON 	(1)
70 #define INTR_OFF	(0)
71 
72 	device_ptr_t		 sc_child;
73 
74 	struct device		*sc_parent;	/* parent device */
75 	int			 sc_sltype;	/* revision */
76 #define SLTYPE_SL11H	(0x00)
77 #define SLTYPE_SL811HS	(0x01)
78 #define SLTYPE_SL811HS_R12	SLTYPE_SL811HS
79 #define SLTYPE_SL811HS_R14	(0x02)
80 
81 	u_int8_t		 sc_addr;	/* device address of root hub */
82 	u_int8_t		 sc_conf;
83 	SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers;
84 
85 	/* Information for the root hub interrupt pipe */
86 	int			 sc_interval;
87 	usbd_xfer_handle	 sc_intr_xfer;
88 	usb_callout_t		 sc_poll_handle;
89 
90 	int				 sc_flags;
91 #define SLF_RESET	(0x01)
92 #define SLF_INSERT	(0x02)
93 
94 	/* Root HUB specific members */
95 	int				sc_fullspeed;
96 	int				sc_connect;	/* XXX */
97 	int				sc_change;
98 };
99 
100 int  sl811hs_find(struct slhci_softc *);
101 int  slhci_attach(struct slhci_softc *, struct device *);
102 int  slhci_intr(void *);
103