2 * This file is part of the libpayload project.
4 * Copyright (C) 2010 coresystems GmbH
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #ifndef __EHCI_PRIVATE_H
31 #define __EHCI_PRIVATE_H
38 #define FLADJ_framelength(x) (((x)-59488)/16)
40 typedef volatile union {
43 unsigned long current_conn_status:1;
44 unsigned long conn_status_change:1;
45 unsigned long port_enable:1;
46 unsigned long port_enable_change:1;
47 unsigned long overcurrent:1;
48 unsigned long overcurrent_change:1;
49 unsigned long force_port_resume:1;
50 unsigned long suspend:1;
51 unsigned long port_reset:1;
53 unsigned long line_status:2;
55 unsigned long port_owner:1;
56 unsigned long port_indicator_control:2;
57 unsigned long port_test_control:4;
58 unsigned long wake_on_connect_en:1;
59 unsigned long wake_on_disconnect_en:1;
60 unsigned long wake_on_overcurrent_en:1;
62 } __attribute__ ((packed));
63 } __attribute__ ((packed)) portsc_t;
65 typedef volatile struct {
72 unsigned long n_ports:4;
75 unsigned long port_routing_rules:1;
76 unsigned long n_pcc:4;
78 unsigned long p_indicator:1;
80 unsigned long debug_port_number:4;
82 } __attribute__ ((packed));
87 unsigned long cap_64b_addr:1;
88 unsigned long cap_prog_framelist_size:1;
89 unsigned long cap_async_park:1;
91 unsigned long isoc_sched_threshold:4;
94 } __attribute__ ((packed));
99 unsigned long portroute0:4;
100 unsigned long portroute1:4;
101 unsigned long portroute2:4;
102 unsigned long portroute3:4;
103 unsigned long portroute4:4;
104 unsigned long portroute5:4;
105 unsigned long portroute6:4;
106 unsigned long portroute7:4;
107 unsigned long portroute8:4;
108 unsigned long portroute9:4;
109 unsigned long portroute10:4;
110 unsigned long portroute11:4;
111 unsigned long portroute12:4;
112 unsigned long portroute13:4;
113 unsigned long portroute14:4;
114 unsigned long portroute15:4;
116 } __attribute__ ((packed));
118 } __attribute__ ((packed)) hc_cap_t;
120 typedef volatile struct {
125 unsigned long hcreset:1;
126 unsigned long frame_list_size:2;
127 unsigned long periodic_sched_enable:1;
128 unsigned long async_sched_enable:1;
129 unsigned long irq_on_async_advance_doorbell:1;
130 unsigned long light_hc_reset:1;
131 unsigned long async_sched_park_mode_count:2;
133 unsigned long async_sched_park_mode_enable:1;
135 unsigned long irq_threshold_count:8;
137 } __attribute__ ((packed));
142 unsigned long usbint:1;
143 unsigned long usberrint:1;
144 unsigned long port_change_detect:1;
145 unsigned long frame_list_rollover:1;
146 unsigned long host_system_error:1;
147 unsigned long irq_on_async_advance:1;
149 unsigned long hchalted:1;
150 unsigned long reclamation:1;
151 unsigned long periodic_sched_status:1;
152 unsigned long async_sched_status:1;
154 } __attribute__ ((packed));
159 unsigned long en_usb_irq:1;
160 unsigned long en_usb_err_irq:1;
161 unsigned long en_port_change_irq:1;
162 unsigned long en_frame_list_rollover_irq:1;
163 unsigned long en_host_system_error_irq:1;
164 unsigned long en_irq_on_async_advance:1;
166 } __attribute__ ((packed));
170 u32 periodiclistbase;
177 typedef volatile struct {
181 unsigned long terminate:1;
184 } __attribute__ ((packed));
189 unsigned long alt_terminate:1;
192 } __attribute__ ((packed));
198 volatile unsigned long perr:1;
199 volatile unsigned long splitxstate:1;
200 volatile unsigned long missed_mframe:1;
201 volatile unsigned long xact_err:1;
202 volatile unsigned long babble:1;
203 volatile unsigned long data_buf_err:1;
204 volatile unsigned long halted:1;
205 volatile unsigned long active:1;
206 } __attribute__ ((packed));
209 volatile unsigned long cerr:2;
210 volatile unsigned long c_page:3;
212 volatile unsigned long total_len:15;
213 volatile unsigned long dt:1;
214 } __attribute__ ((packed));
218 volatile unsigned long cur_off:12;
220 } __attribute__ ((packed));
224 } __attribute__ ((packed)) qtd_t;
226 typedef volatile struct {
230 unsigned long terminate:1;
231 unsigned long type:2;
234 } __attribute__ ((packed));
237 unsigned long addr:7;
238 unsigned long inactivate:1;
242 unsigned long reclaim_head:1;
243 unsigned long max_packet_len:11;
244 unsigned long non_hs_control_ep:1;
245 unsigned long nak_cnt_reload:4;
246 } __attribute__ ((packed));
248 unsigned long irq_sched_mask:8;
249 unsigned long split_compl_mask:8;
250 unsigned long hub_addr:7;
251 unsigned long port_num:7;
252 unsigned long pipe_multiplier:2;
253 } __attribute__ ((packed));
254 volatile u32 current_td_ptr;
258 typedef struct ehci {
259 hc_cap_t *capabilities;
264 #define EHCI_INST(controller) ((ehci_t*)((controller)->instance))