1 /* $NetBSD: sl811hsvar.h,v 1.5 2008/04/08 12:07:27 cegger Exp $ */
4 * Not (c) 2007 Matthew Orgass
5 * This file is public domain, meaning anyone can make any use of part or all
6 * of this file including copying into other works without credit. Any use,
7 * modified or not, is solely the responsibility of the user. If this file is
8 * part of a collection then use in the collection is governed by the terms of
13 * Cypress/ScanLogic SL811HS USB Host Controller
17 #include <sys/simplelock.h>
18 #include "opt_slhci.h"
20 #define SC_DEV(sc) ((sc)->sc_dev)
21 #define SC_NAME(sc) (device_xname(SC_DEV(sc)))
23 typedef unsigned int Frame
;
26 /* Generally transfer related items. */
27 struct slhci_transfers
{
28 struct usbd_xfer
*rootintr
;
29 struct slhci_pipe
*spipe
[2]; /* current transfer (unless canceled) */
30 struct gcq_head q
[3]; /* transfer queues, Q_* index */
31 struct gcq_head timed
; /* intr transfer multi-frame wait */
32 struct gcq_head to
; /* timeout list */
33 struct gcq_head ap
; /* all pipes */
34 Frame frame
; /* current frame */
35 unsigned int flags
; /* F_* flags */
36 int pend
; /* pending for waitintr */
38 int16_t len
[2]; /* length of transfer or -1 if none */
39 uint8_t current_tregs
[2][4]; /* ab, ADR, LEN, PID, DEV */
40 uint8_t copyin
[2]; /* copyin ADR, LEN */
41 uint8_t rootaddr
; /* device address of root hub */
42 uint8_t rootconf
; /* root configuration */
43 uint8_t max_current
; /* max current / 2 */
44 uint8_t sltype
; /* revision */
52 typedef void (*PowerFunc
)(void *, enum power_change
);
54 /* Attachment code must call slhci_preinit before registering the ISR */
57 struct usbd_bus sc_bus
;
59 struct simplelock sc_lock
;
60 struct simplelock sc_wait_lock
;
62 struct slhci_transfers sc_transfers
; /* Info useful in transfers. */
64 struct gcq_head sc_waitq
;
66 bus_space_tag_t sc_iot
;
67 bus_space_handle_t sc_ioh
;
69 struct callout sc_timer
; /* for reset */
71 PowerFunc sc_enable_power
;
73 struct device
*sc_child
;
75 struct timeval sc_reserved_warn_rate
;
76 struct timeval sc_overflow_warn_rate
;
80 unsigned int sc_ier_check
;
82 int sc_mem_use
; /* XXX SLHCI_MEM_ACCOUNTING */
84 uint8_t sc_ier
; /* enabled interrupts */
85 uint8_t sc_stride
; /* port stride */
88 /* last preinit arguments are: max current (in mA, not mA/2), port stride */
89 /* register access uses byte access, but stride offsets the data port */
90 int slhci_supported_rev(uint8_t);
91 void slhci_preinit(struct slhci_softc
*, PowerFunc
, bus_space_tag_t
,
92 bus_space_handle_t
, uint16_t, uint8_t);
93 int slhci_attach(struct slhci_softc
*);
94 int slhci_detach(struct slhci_softc
*, int);
95 int slhci_activate(device_t
, enum devact
);
96 int slhci_intr(void *);