Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
Duy Truong | f3ac7b3 | 2013-02-13 01:07:28 -0800 | [diff] [blame] | 5 | * Copyright (c) 2009-2010, The Linux Foundation. All rights reserved. |
Shashank Mittal | 23b8f42 | 2010-04-16 19:27:21 -0700 | [diff] [blame] | 6 | * |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 7 | * 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 Dudani | 7d60552 | 2010-10-01 19:52:37 -0700 | [diff] [blame] | 34 | #ifndef MSM_USB_BASE |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 35 | #define MSM_USB_BASE 0xA0800000 |
Ajay Dudani | 232ce81 | 2009-12-02 00:14:11 -0800 | [diff] [blame] | 36 | #endif |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 37 | |
| 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 Dinamani | 0687ecd | 2012-08-10 16:00:26 -0700 | [diff] [blame] | 45 | #define USB_AHB_MODE (MSM_USB_BASE + 0x0098) |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 46 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 47 | #define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */ |
| 48 | #define USB_HCIVERSION (MSM_USB_BASE + 0x0102) /* 16 bit */ |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 49 | #define USB_HCSPARAMS (MSM_USB_BASE + 0x0104) |
| 50 | #define USB_HCCPARAMS (MSM_USB_BASE + 0x0108) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 51 | #define USB_DCIVERSION (MSM_USB_BASE + 0x0120) /* 16 bit */ |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 52 | #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))) |
| 72 | |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 73 | #define USBCMD_RESET 2 |
| 74 | #define USBCMD_ATTACH 1 |
| 75 | |
| 76 | #define USBMODE_DEVICE 2 |
| 77 | #define USBMODE_HOST 3 |
| 78 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 79 | struct ept_queue_head { |
| 80 | unsigned config; |
| 81 | unsigned current; /* read-only */ |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 82 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 83 | unsigned next; |
| 84 | unsigned info; |
| 85 | unsigned page0; |
| 86 | unsigned page1; |
| 87 | unsigned page2; |
| 88 | unsigned page3; |
| 89 | unsigned page4; |
| 90 | unsigned reserved_0; |
| 91 | |
| 92 | unsigned char setup_data[8]; |
| 93 | |
| 94 | unsigned reserved_1; |
| 95 | unsigned reserved_2; |
| 96 | unsigned reserved_3; |
| 97 | unsigned reserved_4; |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 98 | }; |
| 99 | |
| 100 | #define CONFIG_MAX_PKT(n) ((n) << 16) |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 101 | #define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */ |
| 102 | #define CONFIG_IOS (1 << 15) /* IRQ on setup */ |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 103 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 104 | struct ept_queue_item { |
| 105 | unsigned next; |
| 106 | unsigned info; |
| 107 | unsigned page0; |
| 108 | unsigned page1; |
| 109 | unsigned page2; |
| 110 | unsigned page3; |
| 111 | unsigned page4; |
| 112 | unsigned reserved; |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 113 | }; |
| 114 | |
| 115 | #define TERMINATE 1 |
| 116 | |
| 117 | #define INFO_BYTES(n) ((n) << 16) |
| 118 | #define INFO_IOC (1 << 15) |
| 119 | #define INFO_ACTIVE (1 << 7) |
| 120 | #define INFO_HALTED (1 << 6) |
| 121 | #define INFO_BUFFER_ERROR (1 << 5) |
| 122 | #define INFO_TX_ERROR (1 << 3) |
| 123 | |
Ajay Dudani | b01e506 | 2011-12-03 23:23:42 -0800 | [diff] [blame] | 124 | #define STS_NAKI (1 << 16) /* */ |
| 125 | #define STS_SLI (1 << 8) /* R/WC - suspend state entered */ |
| 126 | #define STS_SRI (1 << 7) /* R/WC - SOF recv'd */ |
| 127 | #define STS_URI (1 << 6) /* R/WC - RESET recv'd - write to clear */ |
| 128 | #define STS_FRI (1 << 3) /* R/WC - Frame List Rollover */ |
| 129 | #define STS_PCI (1 << 2) /* R/WC - Port Change Detect */ |
| 130 | #define STS_UEI (1 << 1) /* R/WC - USB Error */ |
| 131 | #define STS_UI (1 << 0) /* R/WC - USB Transaction Complete */ |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 132 | |
| 133 | /* bits used in all the endpoint status registers */ |
| 134 | #define EPT_TX(n) (1 << ((n) + 16)) |
| 135 | #define EPT_RX(n) (1 << (n)) |
| 136 | |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 137 | #define CTRL_TXE (1 << 23) |
| 138 | #define CTRL_TXR (1 << 22) |
| 139 | #define CTRL_TXI (1 << 21) |
| 140 | #define CTRL_TXD (1 << 17) |
| 141 | #define CTRL_TXS (1 << 16) |
| 142 | #define CTRL_RXE (1 << 7) |
| 143 | #define CTRL_RXR (1 << 6) |
| 144 | #define CTRL_RXI (1 << 5) |
| 145 | #define CTRL_RXD (1 << 1) |
| 146 | #define CTRL_RXS (1 << 0) |
| 147 | |
| 148 | #define CTRL_TXT_CTRL (0 << 18) |
| 149 | #define CTRL_TXT_ISOCH (1 << 18) |
| 150 | #define CTRL_TXT_BULK (2 << 18) |
| 151 | #define CTRL_TXT_INT (3 << 18) |
| 152 | |
| 153 | #define CTRL_RXT_CTRL (0 << 2) |
| 154 | #define CTRL_RXT_ISOCH (1 << 2) |
| 155 | #define CTRL_RXT_BULK (2 << 2) |
| 156 | #define CTRL_RXT_INT (3 << 2) |
| 157 | |
| 158 | #define ULPI_WAKEUP (1 << 31) |
| 159 | #define ULPI_RUN (1 << 30) |
| 160 | #define ULPI_WRITE (1 << 29) |
| 161 | #define ULPI_READ (0 << 29) |
| 162 | #define ULPI_STATE_NORMAL (1 << 27) |
| 163 | #define ULPI_ADDR(n) (((n) & 255) << 16) |
| 164 | #define ULPI_DATA(n) ((n) & 255) |
| 165 | #define ULPI_DATA_READ(n) (((n) >> 8) & 255) |
Chandan Uddaraju | 7f5b901 | 2010-02-06 16:37:48 -0800 | [diff] [blame] | 166 | |
Brian Swetland | 3e7e21a | 2009-01-19 19:41:24 -0800 | [diff] [blame] | 167 | #endif |