xref: /onnv-gate/usr/src/uts/common/sys/usb/hcd/ehci/ehci_hub.h (revision 10039:f8ab5da25490)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52340Sgc161489  * Common Development and Distribution License (the "License").
62340Sgc161489  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*10039SPengcheng.Chen@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_USB_EHCI_HUB_H
270Sstevel@tonic-gate #define	_SYS_USB_EHCI_HUB_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifdef	__cplusplus
310Sstevel@tonic-gate extern "C" {
320Sstevel@tonic-gate #endif
330Sstevel@tonic-gate 
340Sstevel@tonic-gate /*
350Sstevel@tonic-gate  * Enchanced Host Controller Driver (EHCI)
360Sstevel@tonic-gate  *
370Sstevel@tonic-gate  * The EHCI driver is a software driver which interfaces to the Universal
380Sstevel@tonic-gate  * Serial Bus layer (USBA) and the Host Controller (HC). The interface to
390Sstevel@tonic-gate  * the Host Controller is defined by the EHCI Host Controller Interface.
400Sstevel@tonic-gate  *
410Sstevel@tonic-gate  * This header file describes the data structures required by the EHCI
420Sstevel@tonic-gate  * Driver for the root hub operations.
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * Root hub information structure
470Sstevel@tonic-gate  *
480Sstevel@tonic-gate  * The Root hub is a Universal Serial Bus hub attached directly to the
490Sstevel@tonic-gate  * Host Controller (HC) and all the internal registers of the root hub
500Sstevel@tonic-gate  * are exposed to the Host Controller Driver (HCD) which is responsible
510Sstevel@tonic-gate  * for providing the proper hub-class protocol with the  USB driver and
520Sstevel@tonic-gate  * proper control of the root hub. This structure contains information
530Sstevel@tonic-gate  * about the root hub and its ports.
540Sstevel@tonic-gate  */
550Sstevel@tonic-gate typedef struct ehci_root_hub {
560Sstevel@tonic-gate 	/* Copy of the Root Hub descriptor */
570Sstevel@tonic-gate 	usb_hub_descr_t		rh_descr;
580Sstevel@tonic-gate 
590Sstevel@tonic-gate 	/* Number of Companion Controllers */
600Sstevel@tonic-gate 	uint_t			rh_companion_controllers;
610Sstevel@tonic-gate 
620Sstevel@tonic-gate 	/* Last state & status for each root hub port */
630Sstevel@tonic-gate 	uint_t			rh_port_status[EHCI_MAX_RH_PORTS];
640Sstevel@tonic-gate 	uint_t			rh_port_state[EHCI_MAX_RH_PORTS];
650Sstevel@tonic-gate 
660Sstevel@tonic-gate 	/* Root hub control pipe handle */
670Sstevel@tonic-gate 	usba_pipe_handle_data_t	*rh_ctrl_pipe_handle;
680Sstevel@tonic-gate 
690Sstevel@tonic-gate 	/* Current control request pointer */
700Sstevel@tonic-gate 	usb_ctrl_req_t		*rh_curr_ctrl_reqp;
710Sstevel@tonic-gate 
720Sstevel@tonic-gate 	/* Root hub control pipe state */
730Sstevel@tonic-gate 	uint_t			rh_ctrl_pipe_state;
740Sstevel@tonic-gate 
750Sstevel@tonic-gate 	/* Root hub interrupt pipe handle */
760Sstevel@tonic-gate 	usba_pipe_handle_data_t	*rh_intr_pipe_handle;
770Sstevel@tonic-gate 
780Sstevel@tonic-gate 	/* Current interrupt request pointer */
790Sstevel@tonic-gate 	usb_intr_req_t		*rh_curr_intr_reqp;
800Sstevel@tonic-gate 
810Sstevel@tonic-gate 	/* Saved original interrupt request pointer */
820Sstevel@tonic-gate 	usb_intr_req_t		*rh_client_intr_reqp;
830Sstevel@tonic-gate 
840Sstevel@tonic-gate 	/* Root hub interrupt pipe state and timer-id */
850Sstevel@tonic-gate 	uint_t			rh_intr_pipe_state;
860Sstevel@tonic-gate 	usb_port_mask_t		rh_intr_pending_status;
870Sstevel@tonic-gate 	timeout_id_t		rh_intr_pipe_timer_id;
880Sstevel@tonic-gate } ehci_root_hub_t;
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /* Port States */
910Sstevel@tonic-gate #define	UNINIT		0x00	/* Uninitialized port */
920Sstevel@tonic-gate #define	POWERED_OFF	0x01	/* Port has no power */
930Sstevel@tonic-gate #define	DISCONNECTED	0x02	/* Port has power, no dev */
940Sstevel@tonic-gate #define	DISABLED	0x03	/* Dev connected, no data */
950Sstevel@tonic-gate #define	ENABLED		0x04	/* Downstream data is enabled */
960Sstevel@tonic-gate #define	SUSPEND		0x05	/* Suspended port */
970Sstevel@tonic-gate 
980Sstevel@tonic-gate /*
990Sstevel@tonic-gate  * Time waits for the different EHCI Root Hub specific operations.
1000Sstevel@tonic-gate  * These timeout values are specified in terms of microseconds.
1010Sstevel@tonic-gate  */
1027138Szl227052 #define	EHCI_RH_POLL_TIME		256000	/* RH polling interval */
103*10039SPengcheng.Chen@Sun.COM #define	EHCI_PORT_RESET_TIMEWAIT	50000	/* RH port reset time */
1040Sstevel@tonic-gate #define	EHCI_PORT_RESET_COMP_TIMEWAIT	2000	/* RH port reset complete */
1050Sstevel@tonic-gate #define	EHCI_PORT_SUSPEND_TIMEWAIT	10000	/* RH port suspend time */
1060Sstevel@tonic-gate #define	EHCI_PORT_RESUME_TIMEWAIT	20000	/* RH port resume time */
1070Sstevel@tonic-gate #define	EHCI_PORT_RESUME_COMP_TIMEWAIT	2000	/* RH port resume complete */
108*10039SPengcheng.Chen@Sun.COM #define	EHCI_PORT_RESET_RETRY_MAX	10	/* RH port reset retry max */
109*10039SPengcheng.Chen@Sun.COM #define	EHCI_PORT_RESUME_RETRY_MAX	10	/* RH port resume retry max */
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate #ifdef __cplusplus
1120Sstevel@tonic-gate }
1130Sstevel@tonic-gate #endif
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate #endif /* _SYS_USB_EHCI_HUB_H */
116