blob: e5d21270ca3b5f213e2bc4d2477490888d28b646 [file] [log] [blame]
Kevin O'Connor59f02832009-10-12 10:09:15 -04001#ifndef __USB_OHCI_H
2#define __USB_OHCI_H
3
4// usb-ohci.c
5struct usb_s;
6int ohci_init(struct usb_s *cntl);
7int ohci_control(u32 endp, int dir, const void *cmd, int cmdsize
8 , void *data, int datasize);
9struct usb_pipe *ohci_alloc_intr_pipe(u32 endp, int period);
Kevin O'Connor1c46a542009-10-17 23:53:32 -040010int ohci_poll_intr(struct usb_pipe *pipe, void *data);
Kevin O'Connor59f02832009-10-12 10:09:15 -040011
12
13/****************************************************************
14 * ohci structs and flags
15 ****************************************************************/
16
17struct ohci_ed {
18 u32 hwINFO;
19 u32 hwTailP;
20 u32 hwHeadP;
21 u32 hwNextED;
22} PACKED;
23
24#define ED_ISO (1 << 15)
25#define ED_SKIP (1 << 14)
26#define ED_LOWSPEED (1 << 13)
27#define ED_OUT (0x01 << 11)
28#define ED_IN (0x02 << 11)
29
30#define ED_C (0x02)
31#define ED_H (0x01)
32
33struct ohci_td {
34 u32 hwINFO;
35 u32 hwCBP;
36 u32 hwNextTD;
37 u32 hwBE;
38} PACKED;
39
40#define TD_CC 0xf0000000
41#define TD_CC_GET(td_p) ((td_p >>28) & 0x0f)
42#define TD_DI 0x00E00000
Kevin O'Connor59f02832009-10-12 10:09:15 -040043
44#define TD_DONE 0x00020000
45#define TD_ISO 0x00010000
46
47#define TD_EC 0x0C000000
48#define TD_T 0x03000000
49#define TD_T_DATA0 0x02000000
50#define TD_T_DATA1 0x03000000
51#define TD_T_TOGGLE 0x00000000
52#define TD_DP 0x00180000
53#define TD_DP_SETUP 0x00000000
54#define TD_DP_IN 0x00100000
55#define TD_DP_OUT 0x00080000
56
57#define TD_R 0x00040000
58
59struct ohci_hcca {
60 u32 int_table[32];
61 u32 frame_no;
62 u32 done_head;
63 u8 reserved[120];
64} PACKED;
65
66struct ohci_regs {
67 u32 revision;
68 u32 control;
69 u32 cmdstatus;
70 u32 intrstatus;
71 u32 intrenable;
72 u32 intrdisable;
73
74 u32 hcca;
75 u32 ed_periodcurrent;
76 u32 ed_controlhead;
77 u32 ed_controlcurrent;
78 u32 ed_bulkhead;
79 u32 ed_bulkcurrent;
80 u32 donehead;
81
82 u32 fminterval;
83 u32 fmremaining;
84 u32 fmnumber;
85 u32 periodicstart;
86 u32 lsthresh;
87
88 u32 roothub_a;
89 u32 roothub_b;
90 u32 roothub_status;
91 u32 roothub_portstatus[15];
92} PACKED;
93
Kevin O'Connor1c46a542009-10-17 23:53:32 -040094#define OHCI_CTRL_CBSR (3 << 0)
95#define OHCI_CTRL_PLE (1 << 2)
96#define OHCI_CTRL_CLE (1 << 4)
97#define OHCI_CTRL_HCFS (3 << 6)
98# define OHCI_USB_RESET (0 << 6)
99# define OHCI_USB_OPER (2 << 6)
100#define OHCI_CTRL_RWC (1 << 9)
101
102#define OHCI_HCR (1 << 0)
103#define OHCI_CLF (1 << 1)
104
Kevin O'Connor59f02832009-10-12 10:09:15 -0400105#define OHCI_INTR_MIE (1 << 31)
106
Kevin O'Connor1c46a542009-10-17 23:53:32 -0400107#define RH_PS_CCS 0x00000001
108#define RH_PS_PES 0x00000002
109#define RH_PS_PSS 0x00000004
110#define RH_PS_POCI 0x00000008
111#define RH_PS_PRS 0x00000010
112#define RH_PS_PPS 0x00000100
113#define RH_PS_LSDA 0x00000200
114#define RH_PS_CSC 0x00010000
115#define RH_PS_PESC 0x00020000
116#define RH_PS_PSSC 0x00040000
117#define RH_PS_OCIC 0x00080000
118#define RH_PS_PRSC 0x00100000
119
120#define RH_HS_LPS 0x00000001
121#define RH_HS_OCI 0x00000002
122#define RH_HS_DRWE 0x00008000
123#define RH_HS_LPSC 0x00010000
124#define RH_HS_OCIC 0x00020000
125#define RH_HS_CRWE 0x80000000
126
127#define RH_B_DR 0x0000ffff
128#define RH_B_PPCM 0xffff0000
129
130#define RH_A_NDP (0xff << 0)
131#define RH_A_PSM (1 << 8)
132#define RH_A_NPS (1 << 9)
133#define RH_A_DT (1 << 10)
134#define RH_A_OCPM (1 << 11)
135#define RH_A_NOCP (1 << 12)
136#define RH_A_POTPGT (0xff << 24)
137
Kevin O'Connor59f02832009-10-12 10:09:15 -0400138#endif // usb-ohci.h