blob: c26748ad4265934c5ca83b2774163ad6db156806 [file] [log] [blame]
Brian Swetland3e7e21a2009-01-19 19:41:24 -08001/*
2 * Copyright (c) 2008, Google Inc.
3 * All rights reserved.
4 *
Eugene Yasman7b7b6282013-02-26 13:13:20 +02005 * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
Shashank Mittal23b8f422010-04-16 19:27:21 -07006 *
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
Eugene Yasman7b7b6282013-02-26 13:13:20 +020014 * the documentation and/or other materials provided with the
Brian Swetland3e7e21a2009-01-19 19:41:24 -080015 * 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
Eugene Yasman7b7b6282013-02-26 13:13:20 +020024 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
Brian Swetland3e7e21a2009-01-19 19:41:24 -080025 * 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)
Deepa Dinamani0687ecd2012-08-10 16:00:26 -070045#define USB_AHB_MODE (MSM_USB_BASE + 0x0098)
Brian Swetland3e7e21a2009-01-19 19:41:24 -080046
Ajay Dudanib01e5062011-12-03 23:23:42 -080047#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */
48#define USB_HCIVERSION (MSM_USB_BASE + 0x0102) /* 16 bit */
Brian Swetland3e7e21a2009-01-19 19:41:24 -080049#define USB_HCSPARAMS (MSM_USB_BASE + 0x0104)
50#define USB_HCCPARAMS (MSM_USB_BASE + 0x0108)
Ajay Dudanib01e5062011-12-03 23:23:42 -080051#define USB_DCIVERSION (MSM_USB_BASE + 0x0120) /* 16 bit */
Brian Swetland3e7e21a2009-01-19 19:41:24 -080052#define USB_USBCMD (MSM_USB_BASE + 0x0140)
53#define USB_USBSTS (MSM_USB_BASE + 0x0144)
54#define USB_USBINTR (MSM_USB_BASE + 0x0148)
55#define USB_FRINDEX (MSM_USB_BASE + 0x014C)
56#define USB_DEVICEADDR (MSM_USB_BASE + 0x0154)
57#define USB_ENDPOINTLISTADDR (MSM_USB_BASE + 0x0158)
58#define USB_BURSTSIZE (MSM_USB_BASE + 0x0160)
59#define USB_TXFILLTUNING (MSM_USB_BASE + 0x0164)
60#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170)
61#define USB_ENDPTNAK (MSM_USB_BASE + 0x0178)
62#define USB_ENDPTNAKEN (MSM_USB_BASE + 0x017C)
63#define USB_PORTSC (MSM_USB_BASE + 0x0184)
64#define USB_OTGSC (MSM_USB_BASE + 0x01A4)
65#define USB_USBMODE (MSM_USB_BASE + 0x01A8)
66#define USB_ENDPTSETUPSTAT (MSM_USB_BASE + 0x01AC)
67#define USB_ENDPTPRIME (MSM_USB_BASE + 0x01B0)
68#define USB_ENDPTFLUSH (MSM_USB_BASE + 0x01B4)
69#define USB_ENDPTSTAT (MSM_USB_BASE + 0x01B8)
70#define USB_ENDPTCOMPLETE (MSM_USB_BASE + 0x01BC)
71#define USB_ENDPTCTRL(n) (MSM_USB_BASE + 0x01C0 + (4 * (n)))
Eugene Yasman7b7b6282013-02-26 13:13:20 +020072#define USB_OTG_HS_PHY_CTRL (MSM_USB_BASE + 0x0240)
73#define USB_OTG_HS_PHY_SEC_CTRL (MSM_USB_BASE + 0x0278)
Brian Swetland3e7e21a2009-01-19 19:41:24 -080074
Brian Swetland3e7e21a2009-01-19 19:41:24 -080075#define USBCMD_RESET 2
76#define USBCMD_ATTACH 1
77
78#define USBMODE_DEVICE 2
79#define USBMODE_HOST 3
80
Ajay Dudanib01e5062011-12-03 23:23:42 -080081struct ept_queue_head {
82 unsigned config;
83 unsigned current; /* read-only */
Brian Swetland3e7e21a2009-01-19 19:41:24 -080084
Ajay Dudanib01e5062011-12-03 23:23:42 -080085 unsigned next;
86 unsigned info;
87 unsigned page0;
88 unsigned page1;
89 unsigned page2;
90 unsigned page3;
91 unsigned page4;
92 unsigned reserved_0;
93
94 unsigned char setup_data[8];
95
96 unsigned reserved_1;
97 unsigned reserved_2;
98 unsigned reserved_3;
99 unsigned reserved_4;
Brian Swetland3e7e21a2009-01-19 19:41:24 -0800100};
101
102#define CONFIG_MAX_PKT(n) ((n) << 16)
Ajay Dudanib01e5062011-12-03 23:23:42 -0800103#define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */
104#define CONFIG_IOS (1 << 15) /* IRQ on setup */
Brian Swetland3e7e21a2009-01-19 19:41:24 -0800105
Ajay Dudanib01e5062011-12-03 23:23:42 -0800106struct ept_queue_item {
107 unsigned next;
108 unsigned info;
109 unsigned page0;
110 unsigned page1;
111 unsigned page2;
112 unsigned page3;
113 unsigned page4;
114 unsigned reserved;
Brian Swetland3e7e21a2009-01-19 19:41:24 -0800115};
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
Ajay Dudanib01e5062011-12-03 23:23:42 -0800126#define STS_NAKI (1 << 16) /* */
127#define STS_SLI (1 << 8) /* R/WC - suspend state entered */
128#define STS_SRI (1 << 7) /* R/WC - SOF recv'd */
129#define STS_URI (1 << 6) /* R/WC - RESET recv'd - write to clear */
130#define STS_FRI (1 << 3) /* R/WC - Frame List Rollover */
131#define STS_PCI (1 << 2) /* R/WC - Port Change Detect */
132#define STS_UEI (1 << 1) /* R/WC - USB Error */
133#define STS_UI (1 << 0) /* R/WC - USB Transaction Complete */
Brian Swetland3e7e21a2009-01-19 19:41:24 -0800134
135/* bits used in all the endpoint status registers */
136#define EPT_TX(n) (1 << ((n) + 16))
137#define EPT_RX(n) (1 << (n))
138
Brian Swetland3e7e21a2009-01-19 19:41:24 -0800139#define CTRL_TXE (1 << 23)
140#define CTRL_TXR (1 << 22)
141#define CTRL_TXI (1 << 21)
142#define CTRL_TXD (1 << 17)
143#define CTRL_TXS (1 << 16)
144#define CTRL_RXE (1 << 7)
145#define CTRL_RXR (1 << 6)
146#define CTRL_RXI (1 << 5)
147#define CTRL_RXD (1 << 1)
148#define CTRL_RXS (1 << 0)
149
150#define CTRL_TXT_CTRL (0 << 18)
151#define CTRL_TXT_ISOCH (1 << 18)
152#define CTRL_TXT_BULK (2 << 18)
153#define CTRL_TXT_INT (3 << 18)
154
155#define CTRL_RXT_CTRL (0 << 2)
156#define CTRL_RXT_ISOCH (1 << 2)
157#define CTRL_RXT_BULK (2 << 2)
158#define CTRL_RXT_INT (3 << 2)
159
160#define ULPI_WAKEUP (1 << 31)
161#define ULPI_RUN (1 << 30)
162#define ULPI_WRITE (1 << 29)
163#define ULPI_READ (0 << 29)
164#define ULPI_STATE_NORMAL (1 << 27)
165#define ULPI_ADDR(n) (((n) & 255) << 16)
166#define ULPI_DATA(n) ((n) & 255)
167#define ULPI_DATA_READ(n) (((n) >> 8) & 255)
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -0800168
Brian Swetland3e7e21a2009-01-19 19:41:24 -0800169#endif