blob: 5efa3041f3929f4121ebbc0ccdfe99e7e715d183 [file] [log] [blame]
Brian Swetland3e7e21a2009-01-19 19:41:24 -08001/*
2 * Copyright (c) 2008, Google Inc.
3 * All rights reserved.
4 *
Shashank Mittal23b8f422010-04-16 19:27:21 -07005 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
6 *
Brian Swetland3e7e21a2009-01-19 19:41:24 -08007 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
24 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
27 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#ifndef _MSM7200_USB_H_
32#define _MSM7200_USB_H_
33
Ajay Dudani7d605522010-10-01 19:52:37 -070034#ifndef MSM_USB_BASE
Brian Swetland3e7e21a2009-01-19 19:41:24 -080035#define MSM_USB_BASE 0xA0800000
Ajay Dudani232ce812009-12-02 00:14:11 -080036#endif
Brian Swetland3e7e21a2009-01-19 19:41:24 -080037
38#define USB_ID (MSM_USB_BASE + 0x0000)
39#define USB_HWGENERAL (MSM_USB_BASE + 0x0004)
40#define USB_HWHOST (MSM_USB_BASE + 0x0008)
41#define USB_HWDEVICE (MSM_USB_BASE + 0x000C)
42#define USB_HWTXBUF (MSM_USB_BASE + 0x0010)
43#define USB_HWRXBUF (MSM_USB_BASE + 0x0014)
44#define USB_SBUSCFG (MSM_USB_BASE + 0x0090)
45
46#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */
47#define USB_HCIVERSION (MSM_USB_BASE + 0x0102) /* 16 bit */
48#define USB_HCSPARAMS (MSM_USB_BASE + 0x0104)
49#define USB_HCCPARAMS (MSM_USB_BASE + 0x0108)
50#define USB_DCIVERSION (MSM_USB_BASE + 0x0120) /* 16 bit */
51#define USB_USBCMD (MSM_USB_BASE + 0x0140)
52#define USB_USBSTS (MSM_USB_BASE + 0x0144)
53#define USB_USBINTR (MSM_USB_BASE + 0x0148)
54#define USB_FRINDEX (MSM_USB_BASE + 0x014C)
55#define USB_DEVICEADDR (MSM_USB_BASE + 0x0154)
56#define USB_ENDPOINTLISTADDR (MSM_USB_BASE + 0x0158)
57#define USB_BURSTSIZE (MSM_USB_BASE + 0x0160)
58#define USB_TXFILLTUNING (MSM_USB_BASE + 0x0164)
59#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170)
60#define USB_ENDPTNAK (MSM_USB_BASE + 0x0178)
61#define USB_ENDPTNAKEN (MSM_USB_BASE + 0x017C)
62#define USB_PORTSC (MSM_USB_BASE + 0x0184)
63#define USB_OTGSC (MSM_USB_BASE + 0x01A4)
64#define USB_USBMODE (MSM_USB_BASE + 0x01A8)
65#define USB_ENDPTSETUPSTAT (MSM_USB_BASE + 0x01AC)
66#define USB_ENDPTPRIME (MSM_USB_BASE + 0x01B0)
67#define USB_ENDPTFLUSH (MSM_USB_BASE + 0x01B4)
68#define USB_ENDPTSTAT (MSM_USB_BASE + 0x01B8)
69#define USB_ENDPTCOMPLETE (MSM_USB_BASE + 0x01BC)
70#define USB_ENDPTCTRL(n) (MSM_USB_BASE + 0x01C0 + (4 * (n)))
71
72
73#define USBCMD_RESET 2
74#define USBCMD_ATTACH 1
75
76#define USBMODE_DEVICE 2
77#define USBMODE_HOST 3
78
79struct ept_queue_head
80{
81 unsigned config;
82 unsigned current; /* read-only */
83
84 unsigned next;
85 unsigned info;
86 unsigned page0;
87 unsigned page1;
88 unsigned page2;
89 unsigned page3;
90 unsigned page4;
91 unsigned reserved_0;
92
93 unsigned char setup_data[8];
94
95 unsigned reserved_1;
96 unsigned reserved_2;
97 unsigned reserved_3;
98 unsigned reserved_4;
99};
100
101#define CONFIG_MAX_PKT(n) ((n) << 16)
102#define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */
103#define CONFIG_IOS (1 << 15) /* IRQ on setup */
104
105struct ept_queue_item
106{
107 unsigned next;
108 unsigned info;
109 unsigned page0;
110 unsigned page1;
111 unsigned page2;
112 unsigned page3;
113 unsigned page4;
114 unsigned reserved;
115};
116
117#define TERMINATE 1
118
119#define INFO_BYTES(n) ((n) << 16)
120#define INFO_IOC (1 << 15)
121#define INFO_ACTIVE (1 << 7)
122#define INFO_HALTED (1 << 6)
123#define INFO_BUFFER_ERROR (1 << 5)
124#define INFO_TX_ERROR (1 << 3)
125
126
127#define STS_NAKI (1 << 16) /* */
128#define STS_SLI (1 << 8) /* R/WC - suspend state entered */
129#define STS_SRI (1 << 7) /* R/WC - SOF recv'd */
130#define STS_URI (1 << 6) /* R/WC - RESET recv'd - write to clear */
131#define STS_FRI (1 << 3) /* R/WC - Frame List Rollover */
132#define STS_PCI (1 << 2) /* R/WC - Port Change Detect */
133#define STS_UEI (1 << 1) /* R/WC - USB Error */
134#define STS_UI (1 << 0) /* R/WC - USB Transaction Complete */
135
136
137/* bits used in all the endpoint status registers */
138#define EPT_TX(n) (1 << ((n) + 16))
139#define EPT_RX(n) (1 << (n))
140
141
142#define CTRL_TXE (1 << 23)
143#define CTRL_TXR (1 << 22)
144#define CTRL_TXI (1 << 21)
145#define CTRL_TXD (1 << 17)
146#define CTRL_TXS (1 << 16)
147#define CTRL_RXE (1 << 7)
148#define CTRL_RXR (1 << 6)
149#define CTRL_RXI (1 << 5)
150#define CTRL_RXD (1 << 1)
151#define CTRL_RXS (1 << 0)
152
153#define CTRL_TXT_CTRL (0 << 18)
154#define CTRL_TXT_ISOCH (1 << 18)
155#define CTRL_TXT_BULK (2 << 18)
156#define CTRL_TXT_INT (3 << 18)
157
158#define CTRL_RXT_CTRL (0 << 2)
159#define CTRL_RXT_ISOCH (1 << 2)
160#define CTRL_RXT_BULK (2 << 2)
161#define CTRL_RXT_INT (3 << 2)
162
163#define ULPI_WAKEUP (1 << 31)
164#define ULPI_RUN (1 << 30)
165#define ULPI_WRITE (1 << 29)
166#define ULPI_READ (0 << 29)
167#define ULPI_STATE_NORMAL (1 << 27)
168#define ULPI_ADDR(n) (((n) & 255) << 16)
169#define ULPI_DATA(n) ((n) & 255)
170#define ULPI_DATA_READ(n) (((n) >> 8) & 255)
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -0800171
Brian Swetland3e7e21a2009-01-19 19:41:24 -0800172#endif