sl811hsvar.h revision 1.1 1 1.1 isaki /* $NetBSD: sl811hsvar.h,v 1.1 2002/08/11 13:17:54 isaki Exp $ */
2 1.1 isaki
3 1.1 isaki /*
4 1.1 isaki * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 isaki * All rights reserved.
6 1.1 isaki *
7 1.1 isaki * This code is derived from software contributed to The NetBSD Foundation
8 1.1 isaki * by Tetsuya Isaki.
9 1.1 isaki *
10 1.1 isaki * Redistribution and use in source and binary forms, with or without
11 1.1 isaki * modification, are permitted provided that the following conditions
12 1.1 isaki * are met:
13 1.1 isaki * 1. Redistributions of source code must retain the above copyright
14 1.1 isaki * notice, this list of conditions and the following disclaimer.
15 1.1 isaki * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 isaki * notice, this list of conditions and the following disclaimer in the
17 1.1 isaki * documentation and/or other materials provided with the distribution.
18 1.1 isaki * 3. All advertising materials mentioning features or use of this software
19 1.1 isaki * must display the following acknowledgement:
20 1.1 isaki * This product includes software developed by the NetBSD
21 1.1 isaki * Foundation, Inc. and its contributors.
22 1.1 isaki * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 isaki * contributors may be used to endorse or promote products derived
24 1.1 isaki * from this software without specific prior written permission.
25 1.1 isaki *
26 1.1 isaki * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 isaki * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 isaki * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 isaki * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 isaki * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 isaki * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 isaki * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 isaki * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 isaki * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 isaki * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 isaki * POSSIBILITY OF SUCH DAMAGE.
37 1.1 isaki */
38 1.1 isaki
39 1.1 isaki /*
40 1.1 isaki * ScanLogic SL811HS/T USB Host Controller
41 1.1 isaki */
42 1.1 isaki
43 1.1 isaki #define MS_TO_TICKS(ms) ((ms) * hz / 1000)
44 1.1 isaki #define delay_ms(X) \
45 1.1 isaki ltsleep(&slhci_dummy, PZERO | PCATCH, "slhci", MS_TO_TICKS(X), NULL)
46 1.1 isaki
47 1.1 isaki #define SL11_PID_OUT (0x1)
48 1.1 isaki #define SL11_PID_IN (0x9)
49 1.1 isaki #define SL11_PID_SOF (0x5)
50 1.1 isaki #define SL11_PID_SETUP (0xd)
51 1.1 isaki
52 1.1 isaki struct slhci_xfer {
53 1.1 isaki usbd_xfer_handle sx_xfer;
54 1.1 isaki usb_callout_t sx_callout_t;
55 1.1 isaki };
56 1.1 isaki
57 1.1 isaki struct slhci_softc {
58 1.1 isaki struct usbd_bus sc_bus;
59 1.1 isaki bus_space_tag_t sc_iot;
60 1.1 isaki bus_space_handle_t sc_ioh;
61 1.1 isaki bus_dma_tag_t sc_dmat;
62 1.1 isaki
63 1.1 isaki void (*sc_enable_power)(void *, int);
64 1.1 isaki void (*sc_enable_intr)(void *, int);
65 1.1 isaki void *sc_arg;
66 1.1 isaki int sc_powerstat;
67 1.1 isaki #define POWER_ON (1)
68 1.1 isaki #define POWER_OFF (0)
69 1.1 isaki #define INTR_ON (1)
70 1.1 isaki #define INTR_OFF (0)
71 1.1 isaki
72 1.1 isaki device_ptr_t sc_child;
73 1.1 isaki
74 1.1 isaki struct device *sc_parent; /* parent device */
75 1.1 isaki int sc_sltype; /* revision */
76 1.1 isaki #define SLTYPE_SL11H (0x00)
77 1.1 isaki #define SLTYPE_SL811HS (0x01)
78 1.1 isaki #define SLTYPE_SL811HS_R12 SLTYPE_SL811HS
79 1.1 isaki #define SLTYPE_SL811HS_R14 (0x02)
80 1.1 isaki
81 1.1 isaki u_int8_t sc_addr; /* device address of root hub */
82 1.1 isaki u_int8_t sc_conf;
83 1.1 isaki SIMPLEQ_HEAD(, usbd_xfer) sc_free_xfers;
84 1.1 isaki
85 1.1 isaki /* Information for the root hub interrupt pipe */
86 1.1 isaki int sc_interval;
87 1.1 isaki usbd_xfer_handle sc_intr_xfer;
88 1.1 isaki usb_callout_t sc_poll_handle;
89 1.1 isaki
90 1.1 isaki int sc_flags;
91 1.1 isaki #define SLF_RESET (0x01)
92 1.1 isaki #define SLF_INSERT (0x02)
93 1.1 isaki
94 1.1 isaki /* Root HUB specific members */
95 1.1 isaki int sc_fullspeed;
96 1.1 isaki int sc_connect; /* XXX */
97 1.1 isaki int sc_change;
98 1.1 isaki };
99 1.1 isaki
100 1.1 isaki int sl811hs_find(struct slhci_softc *);
101 1.1 isaki int slhci_attach(struct slhci_softc *, struct device *);
102 1.1 isaki int slhci_intr(void *);
103