Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * hw.h - DesignWare HS OTG Controller hardware definitions |
| 3 | * |
| 4 | * Copyright 2004-2013 Synopsys, Inc. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions, and the following disclaimer, |
| 11 | * without modification. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. The names of the above-listed copyright holders may not be used |
| 16 | * to endorse or promote products derived from this software without |
| 17 | * specific prior written permission. |
| 18 | * |
| 19 | * ALTERNATIVELY, this software may be distributed under the terms of the |
| 20 | * GNU General Public License ("GPL") as published by the Free Software |
| 21 | * Foundation; either version 2 of the License, or (at your option) any |
| 22 | * later version. |
| 23 | * |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| 25 | * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 26 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 27 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 28 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 29 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 30 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 31 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 32 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 33 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 34 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 35 | */ |
| 36 | |
| 37 | #ifndef __DWC2_HW_H__ |
| 38 | #define __DWC2_HW_H__ |
| 39 | |
| 40 | #define HSOTG_REG(x) (x) |
| 41 | |
| 42 | #define GOTGCTL HSOTG_REG(0x000) |
| 43 | #define GOTGCTL_CHIRPEN (1 << 27) |
| 44 | #define GOTGCTL_MULT_VALID_BC_MASK (0x1f << 22) |
| 45 | #define GOTGCTL_MULT_VALID_BC_SHIFT 22 |
| 46 | #define GOTGCTL_OTGVER (1 << 20) |
| 47 | #define GOTGCTL_BSESVLD (1 << 19) |
| 48 | #define GOTGCTL_ASESVLD (1 << 18) |
| 49 | #define GOTGCTL_DBNC_SHORT (1 << 17) |
| 50 | #define GOTGCTL_CONID_B (1 << 16) |
| 51 | #define GOTGCTL_DEVHNPEN (1 << 11) |
| 52 | #define GOTGCTL_HSTSETHNPEN (1 << 10) |
| 53 | #define GOTGCTL_HNPREQ (1 << 9) |
| 54 | #define GOTGCTL_HSTNEGSCS (1 << 8) |
| 55 | #define GOTGCTL_SESREQ (1 << 1) |
| 56 | #define GOTGCTL_SESREQSCS (1 << 0) |
| 57 | |
| 58 | #define GOTGINT HSOTG_REG(0x004) |
| 59 | #define GOTGINT_DBNCE_DONE (1 << 19) |
| 60 | #define GOTGINT_A_DEV_TOUT_CHG (1 << 18) |
| 61 | #define GOTGINT_HST_NEG_DET (1 << 17) |
| 62 | #define GOTGINT_HST_NEG_SUC_STS_CHNG (1 << 9) |
| 63 | #define GOTGINT_SES_REQ_SUC_STS_CHNG (1 << 8) |
| 64 | #define GOTGINT_SES_END_DET (1 << 2) |
| 65 | |
| 66 | #define GAHBCFG HSOTG_REG(0x008) |
| 67 | #define GAHBCFG_AHB_SINGLE (1 << 23) |
| 68 | #define GAHBCFG_NOTI_ALL_DMA_WRIT (1 << 22) |
| 69 | #define GAHBCFG_REM_MEM_SUPP (1 << 21) |
| 70 | #define GAHBCFG_P_TXF_EMP_LVL (1 << 8) |
| 71 | #define GAHBCFG_NP_TXF_EMP_LVL (1 << 7) |
| 72 | #define GAHBCFG_DMA_EN (1 << 5) |
| 73 | #define GAHBCFG_HBSTLEN_MASK (0xf << 1) |
| 74 | #define GAHBCFG_HBSTLEN_SHIFT 1 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 75 | #define GAHBCFG_HBSTLEN_SINGLE 0 |
| 76 | #define GAHBCFG_HBSTLEN_INCR 1 |
| 77 | #define GAHBCFG_HBSTLEN_INCR4 3 |
| 78 | #define GAHBCFG_HBSTLEN_INCR8 5 |
| 79 | #define GAHBCFG_HBSTLEN_INCR16 7 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 80 | #define GAHBCFG_GLBL_INTR_EN (1 << 0) |
Paul Zimmerman | 4d3190e | 2013-07-16 12:22:12 -0700 | [diff] [blame] | 81 | #define GAHBCFG_CTRL_MASK (GAHBCFG_P_TXF_EMP_LVL | \ |
| 82 | GAHBCFG_NP_TXF_EMP_LVL | \ |
| 83 | GAHBCFG_DMA_EN | \ |
| 84 | GAHBCFG_GLBL_INTR_EN) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 85 | |
| 86 | #define GUSBCFG HSOTG_REG(0x00C) |
| 87 | #define GUSBCFG_FORCEDEVMODE (1 << 30) |
| 88 | #define GUSBCFG_FORCEHOSTMODE (1 << 29) |
| 89 | #define GUSBCFG_TXENDDELAY (1 << 28) |
| 90 | #define GUSBCFG_ICTRAFFICPULLREMOVE (1 << 27) |
| 91 | #define GUSBCFG_ICUSBCAP (1 << 26) |
| 92 | #define GUSBCFG_ULPI_INT_PROT_DIS (1 << 25) |
| 93 | #define GUSBCFG_INDICATORPASSTHROUGH (1 << 24) |
| 94 | #define GUSBCFG_INDICATORCOMPLEMENT (1 << 23) |
| 95 | #define GUSBCFG_TERMSELDLPULSE (1 << 22) |
| 96 | #define GUSBCFG_ULPI_INT_VBUS_IND (1 << 21) |
| 97 | #define GUSBCFG_ULPI_EXT_VBUS_DRV (1 << 20) |
| 98 | #define GUSBCFG_ULPI_CLK_SUSP_M (1 << 19) |
| 99 | #define GUSBCFG_ULPI_AUTO_RES (1 << 18) |
| 100 | #define GUSBCFG_ULPI_FS_LS (1 << 17) |
| 101 | #define GUSBCFG_OTG_UTMI_FS_SEL (1 << 16) |
| 102 | #define GUSBCFG_PHY_LP_CLK_SEL (1 << 15) |
| 103 | #define GUSBCFG_USBTRDTIM_MASK (0xf << 10) |
| 104 | #define GUSBCFG_USBTRDTIM_SHIFT 10 |
| 105 | #define GUSBCFG_HNPCAP (1 << 9) |
| 106 | #define GUSBCFG_SRPCAP (1 << 8) |
| 107 | #define GUSBCFG_DDRSEL (1 << 7) |
| 108 | #define GUSBCFG_PHYSEL (1 << 6) |
| 109 | #define GUSBCFG_FSINTF (1 << 5) |
| 110 | #define GUSBCFG_ULPI_UTMI_SEL (1 << 4) |
| 111 | #define GUSBCFG_PHYIF16 (1 << 3) |
Dinh Nguyen | 6ab5332 | 2014-04-14 14:13:33 -0700 | [diff] [blame] | 112 | #define GUSBCFG_PHYIF8 (0 << 3) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 113 | #define GUSBCFG_TOUTCAL_MASK (0x7 << 0) |
| 114 | #define GUSBCFG_TOUTCAL_SHIFT 0 |
| 115 | #define GUSBCFG_TOUTCAL_LIMIT 0x7 |
| 116 | #define GUSBCFG_TOUTCAL(_x) ((_x) << 0) |
| 117 | |
| 118 | #define GRSTCTL HSOTG_REG(0x010) |
| 119 | #define GRSTCTL_AHBIDLE (1 << 31) |
| 120 | #define GRSTCTL_DMAREQ (1 << 30) |
| 121 | #define GRSTCTL_TXFNUM_MASK (0x1f << 6) |
| 122 | #define GRSTCTL_TXFNUM_SHIFT 6 |
| 123 | #define GRSTCTL_TXFNUM_LIMIT 0x1f |
| 124 | #define GRSTCTL_TXFNUM(_x) ((_x) << 6) |
| 125 | #define GRSTCTL_TXFFLSH (1 << 5) |
| 126 | #define GRSTCTL_RXFFLSH (1 << 4) |
| 127 | #define GRSTCTL_IN_TKNQ_FLSH (1 << 3) |
| 128 | #define GRSTCTL_FRMCNTRRST (1 << 2) |
| 129 | #define GRSTCTL_HSFTRST (1 << 1) |
| 130 | #define GRSTCTL_CSFTRST (1 << 0) |
| 131 | |
| 132 | #define GINTSTS HSOTG_REG(0x014) |
| 133 | #define GINTMSK HSOTG_REG(0x018) |
| 134 | #define GINTSTS_WKUPINT (1 << 31) |
| 135 | #define GINTSTS_SESSREQINT (1 << 30) |
| 136 | #define GINTSTS_DISCONNINT (1 << 29) |
| 137 | #define GINTSTS_CONIDSTSCHNG (1 << 28) |
| 138 | #define GINTSTS_LPMTRANRCVD (1 << 27) |
| 139 | #define GINTSTS_PTXFEMP (1 << 26) |
| 140 | #define GINTSTS_HCHINT (1 << 25) |
| 141 | #define GINTSTS_PRTINT (1 << 24) |
| 142 | #define GINTSTS_RESETDET (1 << 23) |
| 143 | #define GINTSTS_FET_SUSP (1 << 22) |
| 144 | #define GINTSTS_INCOMPL_IP (1 << 21) |
Roman Bacik | ec1f9d9 | 2015-09-10 18:13:43 -0700 | [diff] [blame] | 145 | #define GINTSTS_INCOMPL_SOOUT (1 << 21) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 146 | #define GINTSTS_INCOMPL_SOIN (1 << 20) |
| 147 | #define GINTSTS_OEPINT (1 << 19) |
| 148 | #define GINTSTS_IEPINT (1 << 18) |
| 149 | #define GINTSTS_EPMIS (1 << 17) |
| 150 | #define GINTSTS_RESTOREDONE (1 << 16) |
| 151 | #define GINTSTS_EOPF (1 << 15) |
| 152 | #define GINTSTS_ISOUTDROP (1 << 14) |
| 153 | #define GINTSTS_ENUMDONE (1 << 13) |
| 154 | #define GINTSTS_USBRST (1 << 12) |
| 155 | #define GINTSTS_USBSUSP (1 << 11) |
| 156 | #define GINTSTS_ERLYSUSP (1 << 10) |
| 157 | #define GINTSTS_I2CINT (1 << 9) |
| 158 | #define GINTSTS_ULPI_CK_INT (1 << 8) |
| 159 | #define GINTSTS_GOUTNAKEFF (1 << 7) |
| 160 | #define GINTSTS_GINNAKEFF (1 << 6) |
| 161 | #define GINTSTS_NPTXFEMP (1 << 5) |
| 162 | #define GINTSTS_RXFLVL (1 << 4) |
| 163 | #define GINTSTS_SOF (1 << 3) |
| 164 | #define GINTSTS_OTGINT (1 << 2) |
| 165 | #define GINTSTS_MODEMIS (1 << 1) |
| 166 | #define GINTSTS_CURMODE_HOST (1 << 0) |
| 167 | |
| 168 | #define GRXSTSR HSOTG_REG(0x01C) |
| 169 | #define GRXSTSP HSOTG_REG(0x020) |
| 170 | #define GRXSTS_FN_MASK (0x7f << 25) |
| 171 | #define GRXSTS_FN_SHIFT 25 |
| 172 | #define GRXSTS_PKTSTS_MASK (0xf << 17) |
| 173 | #define GRXSTS_PKTSTS_SHIFT 17 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 174 | #define GRXSTS_PKTSTS_GLOBALOUTNAK 1 |
| 175 | #define GRXSTS_PKTSTS_OUTRX 2 |
| 176 | #define GRXSTS_PKTSTS_HCHIN 2 |
| 177 | #define GRXSTS_PKTSTS_OUTDONE 3 |
| 178 | #define GRXSTS_PKTSTS_HCHIN_XFER_COMP 3 |
| 179 | #define GRXSTS_PKTSTS_SETUPDONE 4 |
| 180 | #define GRXSTS_PKTSTS_DATATOGGLEERR 5 |
| 181 | #define GRXSTS_PKTSTS_SETUPRX 6 |
| 182 | #define GRXSTS_PKTSTS_HCHHALTED 7 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 183 | #define GRXSTS_HCHNUM_MASK (0xf << 0) |
| 184 | #define GRXSTS_HCHNUM_SHIFT 0 |
| 185 | #define GRXSTS_DPID_MASK (0x3 << 15) |
| 186 | #define GRXSTS_DPID_SHIFT 15 |
| 187 | #define GRXSTS_BYTECNT_MASK (0x7ff << 4) |
| 188 | #define GRXSTS_BYTECNT_SHIFT 4 |
| 189 | #define GRXSTS_EPNUM_MASK (0xf << 0) |
| 190 | #define GRXSTS_EPNUM_SHIFT 0 |
| 191 | |
| 192 | #define GRXFSIZ HSOTG_REG(0x024) |
Matthijs Kooijman | a1fc524 | 2013-08-30 18:45:20 +0200 | [diff] [blame] | 193 | #define GRXFSIZ_DEPTH_MASK (0xffff << 0) |
| 194 | #define GRXFSIZ_DEPTH_SHIFT 0 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 195 | |
| 196 | #define GNPTXFSIZ HSOTG_REG(0x028) |
Matthijs Kooijman | 4ab799d | 2013-08-30 18:45:11 +0200 | [diff] [blame] | 197 | /* Use FIFOSIZE_* constants to access this register */ |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 198 | |
| 199 | #define GNPTXSTS HSOTG_REG(0x02C) |
| 200 | #define GNPTXSTS_NP_TXQ_TOP_MASK (0x7f << 24) |
| 201 | #define GNPTXSTS_NP_TXQ_TOP_SHIFT 24 |
| 202 | #define GNPTXSTS_NP_TXQ_SPC_AVAIL_MASK (0xff << 16) |
| 203 | #define GNPTXSTS_NP_TXQ_SPC_AVAIL_SHIFT 16 |
| 204 | #define GNPTXSTS_NP_TXQ_SPC_AVAIL_GET(_v) (((_v) >> 16) & 0xff) |
| 205 | #define GNPTXSTS_NP_TXF_SPC_AVAIL_MASK (0xffff << 0) |
| 206 | #define GNPTXSTS_NP_TXF_SPC_AVAIL_SHIFT 0 |
| 207 | #define GNPTXSTS_NP_TXF_SPC_AVAIL_GET(_v) (((_v) >> 0) & 0xffff) |
| 208 | |
| 209 | #define GI2CCTL HSOTG_REG(0x0030) |
| 210 | #define GI2CCTL_BSYDNE (1 << 31) |
| 211 | #define GI2CCTL_RW (1 << 30) |
| 212 | #define GI2CCTL_I2CDATSE0 (1 << 28) |
| 213 | #define GI2CCTL_I2CDEVADDR_MASK (0x3 << 26) |
| 214 | #define GI2CCTL_I2CDEVADDR_SHIFT 26 |
| 215 | #define GI2CCTL_I2CSUSPCTL (1 << 25) |
| 216 | #define GI2CCTL_ACK (1 << 24) |
| 217 | #define GI2CCTL_I2CEN (1 << 23) |
| 218 | #define GI2CCTL_ADDR_MASK (0x7f << 16) |
| 219 | #define GI2CCTL_ADDR_SHIFT 16 |
| 220 | #define GI2CCTL_REGADDR_MASK (0xff << 8) |
| 221 | #define GI2CCTL_REGADDR_SHIFT 8 |
| 222 | #define GI2CCTL_RWDATA_MASK (0xff << 0) |
| 223 | #define GI2CCTL_RWDATA_SHIFT 0 |
| 224 | |
| 225 | #define GPVNDCTL HSOTG_REG(0x0034) |
| 226 | #define GGPIO HSOTG_REG(0x0038) |
| 227 | #define GUID HSOTG_REG(0x003c) |
| 228 | #define GSNPSID HSOTG_REG(0x0040) |
| 229 | #define GHWCFG1 HSOTG_REG(0x0044) |
| 230 | |
| 231 | #define GHWCFG2 HSOTG_REG(0x0048) |
| 232 | #define GHWCFG2_OTG_ENABLE_IC_USB (1 << 31) |
| 233 | #define GHWCFG2_DEV_TOKEN_Q_DEPTH_MASK (0x1f << 26) |
| 234 | #define GHWCFG2_DEV_TOKEN_Q_DEPTH_SHIFT 26 |
| 235 | #define GHWCFG2_HOST_PERIO_TX_Q_DEPTH_MASK (0x3 << 24) |
| 236 | #define GHWCFG2_HOST_PERIO_TX_Q_DEPTH_SHIFT 24 |
| 237 | #define GHWCFG2_NONPERIO_TX_Q_DEPTH_MASK (0x3 << 22) |
| 238 | #define GHWCFG2_NONPERIO_TX_Q_DEPTH_SHIFT 22 |
| 239 | #define GHWCFG2_MULTI_PROC_INT (1 << 20) |
| 240 | #define GHWCFG2_DYNAMIC_FIFO (1 << 19) |
| 241 | #define GHWCFG2_PERIO_EP_SUPPORTED (1 << 18) |
| 242 | #define GHWCFG2_NUM_HOST_CHAN_MASK (0xf << 14) |
| 243 | #define GHWCFG2_NUM_HOST_CHAN_SHIFT 14 |
| 244 | #define GHWCFG2_NUM_DEV_EP_MASK (0xf << 10) |
| 245 | #define GHWCFG2_NUM_DEV_EP_SHIFT 10 |
| 246 | #define GHWCFG2_FS_PHY_TYPE_MASK (0x3 << 8) |
| 247 | #define GHWCFG2_FS_PHY_TYPE_SHIFT 8 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 248 | #define GHWCFG2_FS_PHY_TYPE_NOT_SUPPORTED 0 |
| 249 | #define GHWCFG2_FS_PHY_TYPE_DEDICATED 1 |
| 250 | #define GHWCFG2_FS_PHY_TYPE_SHARED_UTMI 2 |
| 251 | #define GHWCFG2_FS_PHY_TYPE_SHARED_ULPI 3 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 252 | #define GHWCFG2_HS_PHY_TYPE_MASK (0x3 << 6) |
| 253 | #define GHWCFG2_HS_PHY_TYPE_SHIFT 6 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 254 | #define GHWCFG2_HS_PHY_TYPE_NOT_SUPPORTED 0 |
| 255 | #define GHWCFG2_HS_PHY_TYPE_UTMI 1 |
| 256 | #define GHWCFG2_HS_PHY_TYPE_ULPI 2 |
| 257 | #define GHWCFG2_HS_PHY_TYPE_UTMI_ULPI 3 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 258 | #define GHWCFG2_POINT2POINT (1 << 5) |
| 259 | #define GHWCFG2_ARCHITECTURE_MASK (0x3 << 3) |
| 260 | #define GHWCFG2_ARCHITECTURE_SHIFT 3 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 261 | #define GHWCFG2_SLAVE_ONLY_ARCH 0 |
| 262 | #define GHWCFG2_EXT_DMA_ARCH 1 |
| 263 | #define GHWCFG2_INT_DMA_ARCH 2 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 264 | #define GHWCFG2_OP_MODE_MASK (0x7 << 0) |
| 265 | #define GHWCFG2_OP_MODE_SHIFT 0 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 266 | #define GHWCFG2_OP_MODE_HNP_SRP_CAPABLE 0 |
| 267 | #define GHWCFG2_OP_MODE_SRP_ONLY_CAPABLE 1 |
| 268 | #define GHWCFG2_OP_MODE_NO_HNP_SRP_CAPABLE 2 |
| 269 | #define GHWCFG2_OP_MODE_SRP_CAPABLE_DEVICE 3 |
| 270 | #define GHWCFG2_OP_MODE_NO_SRP_CAPABLE_DEVICE 4 |
| 271 | #define GHWCFG2_OP_MODE_SRP_CAPABLE_HOST 5 |
| 272 | #define GHWCFG2_OP_MODE_NO_SRP_CAPABLE_HOST 6 |
| 273 | #define GHWCFG2_OP_MODE_UNDEFINED 7 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 274 | |
| 275 | #define GHWCFG3 HSOTG_REG(0x004c) |
| 276 | #define GHWCFG3_DFIFO_DEPTH_MASK (0xffff << 16) |
| 277 | #define GHWCFG3_DFIFO_DEPTH_SHIFT 16 |
| 278 | #define GHWCFG3_OTG_LPM_EN (1 << 15) |
| 279 | #define GHWCFG3_BC_SUPPORT (1 << 14) |
| 280 | #define GHWCFG3_OTG_ENABLE_HSIC (1 << 13) |
| 281 | #define GHWCFG3_ADP_SUPP (1 << 12) |
| 282 | #define GHWCFG3_SYNCH_RESET_TYPE (1 << 11) |
| 283 | #define GHWCFG3_OPTIONAL_FEATURES (1 << 10) |
| 284 | #define GHWCFG3_VENDOR_CTRL_IF (1 << 9) |
| 285 | #define GHWCFG3_I2C (1 << 8) |
| 286 | #define GHWCFG3_OTG_FUNC (1 << 7) |
| 287 | #define GHWCFG3_PACKET_SIZE_CNTR_WIDTH_MASK (0x7 << 4) |
| 288 | #define GHWCFG3_PACKET_SIZE_CNTR_WIDTH_SHIFT 4 |
| 289 | #define GHWCFG3_XFER_SIZE_CNTR_WIDTH_MASK (0xf << 0) |
| 290 | #define GHWCFG3_XFER_SIZE_CNTR_WIDTH_SHIFT 0 |
| 291 | |
| 292 | #define GHWCFG4 HSOTG_REG(0x0050) |
| 293 | #define GHWCFG4_DESC_DMA_DYN (1 << 31) |
| 294 | #define GHWCFG4_DESC_DMA (1 << 30) |
| 295 | #define GHWCFG4_NUM_IN_EPS_MASK (0xf << 26) |
| 296 | #define GHWCFG4_NUM_IN_EPS_SHIFT 26 |
| 297 | #define GHWCFG4_DED_FIFO_EN (1 << 25) |
Mian Yousaf Kaukab | f889f23 | 2015-01-30 09:09:36 +0100 | [diff] [blame] | 298 | #define GHWCFG4_DED_FIFO_SHIFT 25 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 299 | #define GHWCFG4_SESSION_END_FILT_EN (1 << 24) |
| 300 | #define GHWCFG4_B_VALID_FILT_EN (1 << 23) |
| 301 | #define GHWCFG4_A_VALID_FILT_EN (1 << 22) |
| 302 | #define GHWCFG4_VBUS_VALID_FILT_EN (1 << 21) |
| 303 | #define GHWCFG4_IDDIG_FILT_EN (1 << 20) |
| 304 | #define GHWCFG4_NUM_DEV_MODE_CTRL_EP_MASK (0xf << 16) |
| 305 | #define GHWCFG4_NUM_DEV_MODE_CTRL_EP_SHIFT 16 |
| 306 | #define GHWCFG4_UTMI_PHY_DATA_WIDTH_MASK (0x3 << 14) |
| 307 | #define GHWCFG4_UTMI_PHY_DATA_WIDTH_SHIFT 14 |
Matthijs Kooijman | de4a193 | 2013-08-30 18:45:22 +0200 | [diff] [blame] | 308 | #define GHWCFG4_UTMI_PHY_DATA_WIDTH_8 0 |
| 309 | #define GHWCFG4_UTMI_PHY_DATA_WIDTH_16 1 |
| 310 | #define GHWCFG4_UTMI_PHY_DATA_WIDTH_8_OR_16 2 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 311 | #define GHWCFG4_XHIBER (1 << 7) |
| 312 | #define GHWCFG4_HIBER (1 << 6) |
| 313 | #define GHWCFG4_MIN_AHB_FREQ (1 << 5) |
| 314 | #define GHWCFG4_POWER_OPTIMIZ (1 << 4) |
| 315 | #define GHWCFG4_NUM_DEV_PERIO_IN_EP_MASK (0xf << 0) |
| 316 | #define GHWCFG4_NUM_DEV_PERIO_IN_EP_SHIFT 0 |
| 317 | |
| 318 | #define GLPMCFG HSOTG_REG(0x0054) |
| 319 | #define GLPMCFG_INV_SEL_HSIC (1 << 31) |
| 320 | #define GLPMCFG_HSIC_CONNECT (1 << 30) |
| 321 | #define GLPMCFG_RETRY_COUNT_STS_MASK (0x7 << 25) |
| 322 | #define GLPMCFG_RETRY_COUNT_STS_SHIFT 25 |
| 323 | #define GLPMCFG_SEND_LPM (1 << 24) |
| 324 | #define GLPMCFG_RETRY_COUNT_MASK (0x7 << 21) |
| 325 | #define GLPMCFG_RETRY_COUNT_SHIFT 21 |
| 326 | #define GLPMCFG_LPM_CHAN_INDEX_MASK (0xf << 17) |
| 327 | #define GLPMCFG_LPM_CHAN_INDEX_SHIFT 17 |
| 328 | #define GLPMCFG_SLEEP_STATE_RESUMEOK (1 << 16) |
| 329 | #define GLPMCFG_PRT_SLEEP_STS (1 << 15) |
| 330 | #define GLPMCFG_LPM_RESP_MASK (0x3 << 13) |
| 331 | #define GLPMCFG_LPM_RESP_SHIFT 13 |
| 332 | #define GLPMCFG_HIRD_THRES_MASK (0x1f << 8) |
| 333 | #define GLPMCFG_HIRD_THRES_SHIFT 8 |
| 334 | #define GLPMCFG_HIRD_THRES_EN (0x10 << 8) |
| 335 | #define GLPMCFG_EN_UTMI_SLEEP (1 << 7) |
| 336 | #define GLPMCFG_REM_WKUP_EN (1 << 6) |
| 337 | #define GLPMCFG_HIRD_MASK (0xf << 2) |
| 338 | #define GLPMCFG_HIRD_SHIFT 2 |
| 339 | #define GLPMCFG_APPL_RESP (1 << 1) |
| 340 | #define GLPMCFG_LPM_CAP_EN (1 << 0) |
| 341 | |
| 342 | #define GPWRDN HSOTG_REG(0x0058) |
| 343 | #define GPWRDN_MULT_VAL_ID_BC_MASK (0x1f << 24) |
| 344 | #define GPWRDN_MULT_VAL_ID_BC_SHIFT 24 |
| 345 | #define GPWRDN_ADP_INT (1 << 23) |
| 346 | #define GPWRDN_BSESSVLD (1 << 22) |
| 347 | #define GPWRDN_IDSTS (1 << 21) |
| 348 | #define GPWRDN_LINESTATE_MASK (0x3 << 19) |
| 349 | #define GPWRDN_LINESTATE_SHIFT 19 |
| 350 | #define GPWRDN_STS_CHGINT_MSK (1 << 18) |
| 351 | #define GPWRDN_STS_CHGINT (1 << 17) |
| 352 | #define GPWRDN_SRP_DET_MSK (1 << 16) |
| 353 | #define GPWRDN_SRP_DET (1 << 15) |
| 354 | #define GPWRDN_CONNECT_DET_MSK (1 << 14) |
| 355 | #define GPWRDN_CONNECT_DET (1 << 13) |
| 356 | #define GPWRDN_DISCONN_DET_MSK (1 << 12) |
| 357 | #define GPWRDN_DISCONN_DET (1 << 11) |
| 358 | #define GPWRDN_RST_DET_MSK (1 << 10) |
| 359 | #define GPWRDN_RST_DET (1 << 9) |
| 360 | #define GPWRDN_LNSTSCHG_MSK (1 << 8) |
| 361 | #define GPWRDN_LNSTSCHG (1 << 7) |
| 362 | #define GPWRDN_DIS_VBUS (1 << 6) |
| 363 | #define GPWRDN_PWRDNSWTCH (1 << 5) |
| 364 | #define GPWRDN_PWRDNRSTN (1 << 4) |
| 365 | #define GPWRDN_PWRDNCLMP (1 << 3) |
| 366 | #define GPWRDN_RESTORE (1 << 2) |
| 367 | #define GPWRDN_PMUACTV (1 << 1) |
| 368 | #define GPWRDN_PMUINTSEL (1 << 0) |
| 369 | |
| 370 | #define GDFIFOCFG HSOTG_REG(0x005c) |
| 371 | #define GDFIFOCFG_EPINFOBASE_MASK (0xffff << 16) |
| 372 | #define GDFIFOCFG_EPINFOBASE_SHIFT 16 |
| 373 | #define GDFIFOCFG_GDFIFOCFG_MASK (0xffff << 0) |
| 374 | #define GDFIFOCFG_GDFIFOCFG_SHIFT 0 |
| 375 | |
| 376 | #define ADPCTL HSOTG_REG(0x0060) |
| 377 | #define ADPCTL_AR_MASK (0x3 << 27) |
| 378 | #define ADPCTL_AR_SHIFT 27 |
| 379 | #define ADPCTL_ADP_TMOUT_INT_MSK (1 << 26) |
| 380 | #define ADPCTL_ADP_SNS_INT_MSK (1 << 25) |
| 381 | #define ADPCTL_ADP_PRB_INT_MSK (1 << 24) |
| 382 | #define ADPCTL_ADP_TMOUT_INT (1 << 23) |
| 383 | #define ADPCTL_ADP_SNS_INT (1 << 22) |
| 384 | #define ADPCTL_ADP_PRB_INT (1 << 21) |
| 385 | #define ADPCTL_ADPENA (1 << 20) |
| 386 | #define ADPCTL_ADPRES (1 << 19) |
| 387 | #define ADPCTL_ENASNS (1 << 18) |
| 388 | #define ADPCTL_ENAPRB (1 << 17) |
| 389 | #define ADPCTL_RTIM_MASK (0x7ff << 6) |
| 390 | #define ADPCTL_RTIM_SHIFT 6 |
| 391 | #define ADPCTL_PRB_PER_MASK (0x3 << 4) |
| 392 | #define ADPCTL_PRB_PER_SHIFT 4 |
| 393 | #define ADPCTL_PRB_DELTA_MASK (0x3 << 2) |
| 394 | #define ADPCTL_PRB_DELTA_SHIFT 2 |
| 395 | #define ADPCTL_PRB_DSCHRG_MASK (0x3 << 0) |
| 396 | #define ADPCTL_PRB_DSCHRG_SHIFT 0 |
| 397 | |
| 398 | #define HPTXFSIZ HSOTG_REG(0x100) |
Matthijs Kooijman | 4ab799d | 2013-08-30 18:45:11 +0200 | [diff] [blame] | 399 | /* Use FIFOSIZE_* constants to access this register */ |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 400 | |
| 401 | #define DPTXFSIZN(_a) HSOTG_REG(0x104 + (((_a) - 1) * 4)) |
Matthijs Kooijman | 4ab799d | 2013-08-30 18:45:11 +0200 | [diff] [blame] | 402 | /* Use FIFOSIZE_* constants to access this register */ |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 403 | |
Matthijs Kooijman | 4ab799d | 2013-08-30 18:45:11 +0200 | [diff] [blame] | 404 | /* These apply to the GNPTXFSIZ, HPTXFSIZ and DPTXFSIZN registers */ |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 405 | #define FIFOSIZE_DEPTH_MASK (0xffff << 16) |
| 406 | #define FIFOSIZE_DEPTH_SHIFT 16 |
| 407 | #define FIFOSIZE_STARTADDR_MASK (0xffff << 0) |
| 408 | #define FIFOSIZE_STARTADDR_SHIFT 0 |
Dinh Nguyen | 6ab5332 | 2014-04-14 14:13:33 -0700 | [diff] [blame] | 409 | #define FIFOSIZE_DEPTH_GET(_x) (((_x) >> 16) & 0xffff) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 410 | |
| 411 | /* Device mode registers */ |
| 412 | |
| 413 | #define DCFG HSOTG_REG(0x800) |
| 414 | #define DCFG_EPMISCNT_MASK (0x1f << 18) |
| 415 | #define DCFG_EPMISCNT_SHIFT 18 |
| 416 | #define DCFG_EPMISCNT_LIMIT 0x1f |
| 417 | #define DCFG_EPMISCNT(_x) ((_x) << 18) |
| 418 | #define DCFG_PERFRINT_MASK (0x3 << 11) |
| 419 | #define DCFG_PERFRINT_SHIFT 11 |
| 420 | #define DCFG_PERFRINT_LIMIT 0x3 |
| 421 | #define DCFG_PERFRINT(_x) ((_x) << 11) |
| 422 | #define DCFG_DEVADDR_MASK (0x7f << 4) |
| 423 | #define DCFG_DEVADDR_SHIFT 4 |
| 424 | #define DCFG_DEVADDR_LIMIT 0x7f |
| 425 | #define DCFG_DEVADDR(_x) ((_x) << 4) |
| 426 | #define DCFG_NZ_STS_OUT_HSHK (1 << 2) |
| 427 | #define DCFG_DEVSPD_MASK (0x3 << 0) |
| 428 | #define DCFG_DEVSPD_SHIFT 0 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 429 | #define DCFG_DEVSPD_HS 0 |
| 430 | #define DCFG_DEVSPD_FS 1 |
| 431 | #define DCFG_DEVSPD_LS 2 |
| 432 | #define DCFG_DEVSPD_FS48 3 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 433 | |
| 434 | #define DCTL HSOTG_REG(0x804) |
| 435 | #define DCTL_PWRONPRGDONE (1 << 11) |
| 436 | #define DCTL_CGOUTNAK (1 << 10) |
| 437 | #define DCTL_SGOUTNAK (1 << 9) |
| 438 | #define DCTL_CGNPINNAK (1 << 8) |
| 439 | #define DCTL_SGNPINNAK (1 << 7) |
| 440 | #define DCTL_TSTCTL_MASK (0x7 << 4) |
| 441 | #define DCTL_TSTCTL_SHIFT 4 |
| 442 | #define DCTL_GOUTNAKSTS (1 << 3) |
| 443 | #define DCTL_GNPINNAKSTS (1 << 2) |
| 444 | #define DCTL_SFTDISCON (1 << 1) |
| 445 | #define DCTL_RMTWKUPSIG (1 << 0) |
| 446 | |
| 447 | #define DSTS HSOTG_REG(0x808) |
| 448 | #define DSTS_SOFFN_MASK (0x3fff << 8) |
| 449 | #define DSTS_SOFFN_SHIFT 8 |
| 450 | #define DSTS_SOFFN_LIMIT 0x3fff |
| 451 | #define DSTS_SOFFN(_x) ((_x) << 8) |
| 452 | #define DSTS_ERRATICERR (1 << 3) |
| 453 | #define DSTS_ENUMSPD_MASK (0x3 << 1) |
| 454 | #define DSTS_ENUMSPD_SHIFT 1 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 455 | #define DSTS_ENUMSPD_HS 0 |
| 456 | #define DSTS_ENUMSPD_FS 1 |
| 457 | #define DSTS_ENUMSPD_LS 2 |
| 458 | #define DSTS_ENUMSPD_FS48 3 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 459 | #define DSTS_SUSPSTS (1 << 0) |
| 460 | |
| 461 | #define DIEPMSK HSOTG_REG(0x810) |
Vardan Mikayelyan | 106528b | 2016-05-25 18:06:53 -0700 | [diff] [blame] | 462 | #define DIEPMSK_NAKMSK (1 << 13) |
| 463 | #define DIEPMSK_BNAININTRMSK (1 << 9) |
| 464 | #define DIEPMSK_TXFIFOUNDRNMSK (1 << 8) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 465 | #define DIEPMSK_TXFIFOEMPTY (1 << 7) |
| 466 | #define DIEPMSK_INEPNAKEFFMSK (1 << 6) |
| 467 | #define DIEPMSK_INTKNEPMISMSK (1 << 5) |
| 468 | #define DIEPMSK_INTKNTXFEMPMSK (1 << 4) |
| 469 | #define DIEPMSK_TIMEOUTMSK (1 << 3) |
| 470 | #define DIEPMSK_AHBERRMSK (1 << 2) |
| 471 | #define DIEPMSK_EPDISBLDMSK (1 << 1) |
| 472 | #define DIEPMSK_XFERCOMPLMSK (1 << 0) |
| 473 | |
| 474 | #define DOEPMSK HSOTG_REG(0x814) |
| 475 | #define DOEPMSK_BACK2BACKSETUP (1 << 6) |
Vardan Mikayelyan | 106528b | 2016-05-25 18:06:53 -0700 | [diff] [blame] | 476 | #define DOEPMSK_STSPHSERCVDMSK (1 << 5) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 477 | #define DOEPMSK_OUTTKNEPDISMSK (1 << 4) |
| 478 | #define DOEPMSK_SETUPMSK (1 << 3) |
| 479 | #define DOEPMSK_AHBERRMSK (1 << 2) |
| 480 | #define DOEPMSK_EPDISBLDMSK (1 << 1) |
| 481 | #define DOEPMSK_XFERCOMPLMSK (1 << 0) |
| 482 | |
| 483 | #define DAINT HSOTG_REG(0x818) |
| 484 | #define DAINTMSK HSOTG_REG(0x81C) |
| 485 | #define DAINT_OUTEP_SHIFT 16 |
| 486 | #define DAINT_OUTEP(_x) (1 << ((_x) + 16)) |
| 487 | #define DAINT_INEP(_x) (1 << (_x)) |
| 488 | |
| 489 | #define DTKNQR1 HSOTG_REG(0x820) |
| 490 | #define DTKNQR2 HSOTG_REG(0x824) |
| 491 | #define DTKNQR3 HSOTG_REG(0x830) |
| 492 | #define DTKNQR4 HSOTG_REG(0x834) |
Vardan Mikayelyan | 106528b | 2016-05-25 18:06:53 -0700 | [diff] [blame] | 493 | #define DIEPEMPMSK HSOTG_REG(0x834) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 494 | |
| 495 | #define DVBUSDIS HSOTG_REG(0x828) |
| 496 | #define DVBUSPULSE HSOTG_REG(0x82C) |
| 497 | |
| 498 | #define DIEPCTL0 HSOTG_REG(0x900) |
| 499 | #define DIEPCTL(_a) HSOTG_REG(0x900 + ((_a) * 0x20)) |
| 500 | |
| 501 | #define DOEPCTL0 HSOTG_REG(0xB00) |
| 502 | #define DOEPCTL(_a) HSOTG_REG(0xB00 + ((_a) * 0x20)) |
| 503 | |
| 504 | /* EP0 specialness: |
| 505 | * bits[29..28] - reserved (no SetD0PID, SetD1PID) |
| 506 | * bits[25..22] - should always be zero, this isn't a periodic endpoint |
| 507 | * bits[10..0] - MPS setting different for EP0 |
| 508 | */ |
| 509 | #define D0EPCTL_MPS_MASK (0x3 << 0) |
| 510 | #define D0EPCTL_MPS_SHIFT 0 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 511 | #define D0EPCTL_MPS_64 0 |
| 512 | #define D0EPCTL_MPS_32 1 |
| 513 | #define D0EPCTL_MPS_16 2 |
| 514 | #define D0EPCTL_MPS_8 3 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 515 | |
| 516 | #define DXEPCTL_EPENA (1 << 31) |
| 517 | #define DXEPCTL_EPDIS (1 << 30) |
| 518 | #define DXEPCTL_SETD1PID (1 << 29) |
| 519 | #define DXEPCTL_SETODDFR (1 << 29) |
| 520 | #define DXEPCTL_SETD0PID (1 << 28) |
| 521 | #define DXEPCTL_SETEVENFR (1 << 28) |
| 522 | #define DXEPCTL_SNAK (1 << 27) |
| 523 | #define DXEPCTL_CNAK (1 << 26) |
| 524 | #define DXEPCTL_TXFNUM_MASK (0xf << 22) |
| 525 | #define DXEPCTL_TXFNUM_SHIFT 22 |
| 526 | #define DXEPCTL_TXFNUM_LIMIT 0xf |
| 527 | #define DXEPCTL_TXFNUM(_x) ((_x) << 22) |
| 528 | #define DXEPCTL_STALL (1 << 21) |
| 529 | #define DXEPCTL_SNP (1 << 20) |
| 530 | #define DXEPCTL_EPTYPE_MASK (0x3 << 18) |
Dinh Nguyen | 6ab5332 | 2014-04-14 14:13:33 -0700 | [diff] [blame] | 531 | #define DXEPCTL_EPTYPE_CONTROL (0x0 << 18) |
| 532 | #define DXEPCTL_EPTYPE_ISO (0x1 << 18) |
| 533 | #define DXEPCTL_EPTYPE_BULK (0x2 << 18) |
| 534 | #define DXEPCTL_EPTYPE_INTERRUPT (0x3 << 18) |
| 535 | |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 536 | #define DXEPCTL_NAKSTS (1 << 17) |
| 537 | #define DXEPCTL_DPID (1 << 16) |
| 538 | #define DXEPCTL_EOFRNUM (1 << 16) |
| 539 | #define DXEPCTL_USBACTEP (1 << 15) |
| 540 | #define DXEPCTL_NEXTEP_MASK (0xf << 11) |
| 541 | #define DXEPCTL_NEXTEP_SHIFT 11 |
| 542 | #define DXEPCTL_NEXTEP_LIMIT 0xf |
| 543 | #define DXEPCTL_NEXTEP(_x) ((_x) << 11) |
| 544 | #define DXEPCTL_MPS_MASK (0x7ff << 0) |
| 545 | #define DXEPCTL_MPS_SHIFT 0 |
| 546 | #define DXEPCTL_MPS_LIMIT 0x7ff |
| 547 | #define DXEPCTL_MPS(_x) ((_x) << 0) |
| 548 | |
| 549 | #define DIEPINT(_a) HSOTG_REG(0x908 + ((_a) * 0x20)) |
| 550 | #define DOEPINT(_a) HSOTG_REG(0xB08 + ((_a) * 0x20)) |
Mian Yousaf Kaukab | b787d75 | 2015-01-09 13:38:43 +0100 | [diff] [blame] | 551 | #define DXEPINT_SETUP_RCVD (1 << 15) |
Vardan Mikayelyan | 106528b | 2016-05-25 18:06:53 -0700 | [diff] [blame] | 552 | #define DXEPINT_NYETINTRPT (1 << 14) |
| 553 | #define DXEPINT_NAKINTRPT (1 << 13) |
| 554 | #define DXEPINT_BBLEERRINTRPT (1 << 12) |
| 555 | #define DXEPINT_PKTDRPSTS (1 << 11) |
| 556 | #define DXEPINT_BNAINTR (1 << 9) |
| 557 | #define DXEPINT_TXFIFOUNDRN (1 << 8) |
| 558 | #define DXEPINT_OUTPKTERR (1 << 8) |
| 559 | #define DXEPINT_TXFEMP (1 << 7) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 560 | #define DXEPINT_INEPNAKEFF (1 << 6) |
| 561 | #define DXEPINT_BACK2BACKSETUP (1 << 6) |
| 562 | #define DXEPINT_INTKNEPMIS (1 << 5) |
Vardan Mikayelyan | 837e9f0 | 2016-05-25 18:07:22 -0700 | [diff] [blame] | 563 | #define DXEPINT_STSPHSERCVD (1 << 5) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 564 | #define DXEPINT_INTKNTXFEMP (1 << 4) |
| 565 | #define DXEPINT_OUTTKNEPDIS (1 << 4) |
| 566 | #define DXEPINT_TIMEOUT (1 << 3) |
| 567 | #define DXEPINT_SETUP (1 << 3) |
| 568 | #define DXEPINT_AHBERR (1 << 2) |
| 569 | #define DXEPINT_EPDISBLD (1 << 1) |
| 570 | #define DXEPINT_XFERCOMPL (1 << 0) |
| 571 | |
| 572 | #define DIEPTSIZ0 HSOTG_REG(0x910) |
| 573 | #define DIEPTSIZ0_PKTCNT_MASK (0x3 << 19) |
| 574 | #define DIEPTSIZ0_PKTCNT_SHIFT 19 |
| 575 | #define DIEPTSIZ0_PKTCNT_LIMIT 0x3 |
| 576 | #define DIEPTSIZ0_PKTCNT(_x) ((_x) << 19) |
| 577 | #define DIEPTSIZ0_XFERSIZE_MASK (0x7f << 0) |
| 578 | #define DIEPTSIZ0_XFERSIZE_SHIFT 0 |
| 579 | #define DIEPTSIZ0_XFERSIZE_LIMIT 0x7f |
| 580 | #define DIEPTSIZ0_XFERSIZE(_x) ((_x) << 0) |
| 581 | |
| 582 | #define DOEPTSIZ0 HSOTG_REG(0xB10) |
| 583 | #define DOEPTSIZ0_SUPCNT_MASK (0x3 << 29) |
| 584 | #define DOEPTSIZ0_SUPCNT_SHIFT 29 |
| 585 | #define DOEPTSIZ0_SUPCNT_LIMIT 0x3 |
| 586 | #define DOEPTSIZ0_SUPCNT(_x) ((_x) << 29) |
| 587 | #define DOEPTSIZ0_PKTCNT (1 << 19) |
| 588 | #define DOEPTSIZ0_XFERSIZE_MASK (0x7f << 0) |
| 589 | #define DOEPTSIZ0_XFERSIZE_SHIFT 0 |
| 590 | |
| 591 | #define DIEPTSIZ(_a) HSOTG_REG(0x910 + ((_a) * 0x20)) |
| 592 | #define DOEPTSIZ(_a) HSOTG_REG(0xB10 + ((_a) * 0x20)) |
| 593 | #define DXEPTSIZ_MC_MASK (0x3 << 29) |
| 594 | #define DXEPTSIZ_MC_SHIFT 29 |
| 595 | #define DXEPTSIZ_MC_LIMIT 0x3 |
| 596 | #define DXEPTSIZ_MC(_x) ((_x) << 29) |
| 597 | #define DXEPTSIZ_PKTCNT_MASK (0x3ff << 19) |
| 598 | #define DXEPTSIZ_PKTCNT_SHIFT 19 |
| 599 | #define DXEPTSIZ_PKTCNT_LIMIT 0x3ff |
| 600 | #define DXEPTSIZ_PKTCNT_GET(_v) (((_v) >> 19) & 0x3ff) |
| 601 | #define DXEPTSIZ_PKTCNT(_x) ((_x) << 19) |
| 602 | #define DXEPTSIZ_XFERSIZE_MASK (0x7ffff << 0) |
| 603 | #define DXEPTSIZ_XFERSIZE_SHIFT 0 |
| 604 | #define DXEPTSIZ_XFERSIZE_LIMIT 0x7ffff |
| 605 | #define DXEPTSIZ_XFERSIZE_GET(_v) (((_v) >> 0) & 0x7ffff) |
| 606 | #define DXEPTSIZ_XFERSIZE(_x) ((_x) << 0) |
| 607 | |
| 608 | #define DIEPDMA(_a) HSOTG_REG(0x914 + ((_a) * 0x20)) |
| 609 | #define DOEPDMA(_a) HSOTG_REG(0xB14 + ((_a) * 0x20)) |
| 610 | |
| 611 | #define DTXFSTS(_a) HSOTG_REG(0x918 + ((_a) * 0x20)) |
| 612 | |
| 613 | #define PCGCTL HSOTG_REG(0x0e00) |
| 614 | #define PCGCTL_IF_DEV_MODE (1 << 31) |
| 615 | #define PCGCTL_P2HD_PRT_SPD_MASK (0x3 << 29) |
| 616 | #define PCGCTL_P2HD_PRT_SPD_SHIFT 29 |
| 617 | #define PCGCTL_P2HD_DEV_ENUM_SPD_MASK (0x3 << 27) |
| 618 | #define PCGCTL_P2HD_DEV_ENUM_SPD_SHIFT 27 |
| 619 | #define PCGCTL_MAC_DEV_ADDR_MASK (0x7f << 20) |
| 620 | #define PCGCTL_MAC_DEV_ADDR_SHIFT 20 |
| 621 | #define PCGCTL_MAX_TERMSEL (1 << 19) |
| 622 | #define PCGCTL_MAX_XCVRSELECT_MASK (0x3 << 17) |
| 623 | #define PCGCTL_MAX_XCVRSELECT_SHIFT 17 |
| 624 | #define PCGCTL_PORT_POWER (1 << 16) |
| 625 | #define PCGCTL_PRT_CLK_SEL_MASK (0x3 << 14) |
| 626 | #define PCGCTL_PRT_CLK_SEL_SHIFT 14 |
| 627 | #define PCGCTL_ESS_REG_RESTORED (1 << 13) |
| 628 | #define PCGCTL_EXTND_HIBER_SWITCH (1 << 12) |
| 629 | #define PCGCTL_EXTND_HIBER_PWRCLMP (1 << 11) |
| 630 | #define PCGCTL_ENBL_EXTND_HIBER (1 << 10) |
| 631 | #define PCGCTL_RESTOREMODE (1 << 9) |
| 632 | #define PCGCTL_RESETAFTSUSP (1 << 8) |
| 633 | #define PCGCTL_DEEP_SLEEP (1 << 7) |
| 634 | #define PCGCTL_PHY_IN_SLEEP (1 << 6) |
| 635 | #define PCGCTL_ENBL_SLEEP_GATING (1 << 5) |
| 636 | #define PCGCTL_RSTPDWNMODULE (1 << 3) |
| 637 | #define PCGCTL_PWRCLMP (1 << 2) |
| 638 | #define PCGCTL_GATEHCLK (1 << 1) |
| 639 | #define PCGCTL_STOPPCLK (1 << 0) |
| 640 | |
| 641 | #define EPFIFO(_a) HSOTG_REG(0x1000 + ((_a) * 0x1000)) |
| 642 | |
| 643 | /* Host Mode Registers */ |
| 644 | |
| 645 | #define HCFG HSOTG_REG(0x0400) |
| 646 | #define HCFG_MODECHTIMEN (1 << 31) |
| 647 | #define HCFG_PERSCHEDENA (1 << 26) |
| 648 | #define HCFG_FRLISTEN_MASK (0x3 << 24) |
| 649 | #define HCFG_FRLISTEN_SHIFT 24 |
| 650 | #define HCFG_FRLISTEN_8 (0 << 24) |
| 651 | #define FRLISTEN_8_SIZE 8 |
| 652 | #define HCFG_FRLISTEN_16 (1 << 24) |
| 653 | #define FRLISTEN_16_SIZE 16 |
| 654 | #define HCFG_FRLISTEN_32 (2 << 24) |
| 655 | #define FRLISTEN_32_SIZE 32 |
| 656 | #define HCFG_FRLISTEN_64 (3 << 24) |
| 657 | #define FRLISTEN_64_SIZE 64 |
| 658 | #define HCFG_DESCDMA (1 << 23) |
| 659 | #define HCFG_RESVALID_MASK (0xff << 8) |
| 660 | #define HCFG_RESVALID_SHIFT 8 |
| 661 | #define HCFG_ENA32KHZ (1 << 7) |
| 662 | #define HCFG_FSLSSUPP (1 << 2) |
| 663 | #define HCFG_FSLSPCLKSEL_MASK (0x3 << 0) |
| 664 | #define HCFG_FSLSPCLKSEL_SHIFT 0 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 665 | #define HCFG_FSLSPCLKSEL_30_60_MHZ 0 |
| 666 | #define HCFG_FSLSPCLKSEL_48_MHZ 1 |
| 667 | #define HCFG_FSLSPCLKSEL_6_MHZ 2 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 668 | |
| 669 | #define HFIR HSOTG_REG(0x0404) |
| 670 | #define HFIR_FRINT_MASK (0xffff << 0) |
| 671 | #define HFIR_FRINT_SHIFT 0 |
| 672 | #define HFIR_RLDCTRL (1 << 16) |
| 673 | |
| 674 | #define HFNUM HSOTG_REG(0x0408) |
| 675 | #define HFNUM_FRREM_MASK (0xffff << 16) |
| 676 | #define HFNUM_FRREM_SHIFT 16 |
| 677 | #define HFNUM_FRNUM_MASK (0xffff << 0) |
| 678 | #define HFNUM_FRNUM_SHIFT 0 |
| 679 | #define HFNUM_MAX_FRNUM 0x3fff |
| 680 | |
| 681 | #define HPTXSTS HSOTG_REG(0x0410) |
| 682 | #define TXSTS_QTOP_ODD (1 << 31) |
| 683 | #define TXSTS_QTOP_CHNEP_MASK (0xf << 27) |
| 684 | #define TXSTS_QTOP_CHNEP_SHIFT 27 |
| 685 | #define TXSTS_QTOP_TOKEN_MASK (0x3 << 25) |
| 686 | #define TXSTS_QTOP_TOKEN_SHIFT 25 |
| 687 | #define TXSTS_QTOP_TERMINATE (1 << 24) |
| 688 | #define TXSTS_QSPCAVAIL_MASK (0xff << 16) |
| 689 | #define TXSTS_QSPCAVAIL_SHIFT 16 |
| 690 | #define TXSTS_FSPCAVAIL_MASK (0xffff << 0) |
| 691 | #define TXSTS_FSPCAVAIL_SHIFT 0 |
| 692 | |
| 693 | #define HAINT HSOTG_REG(0x0414) |
| 694 | #define HAINTMSK HSOTG_REG(0x0418) |
| 695 | #define HFLBADDR HSOTG_REG(0x041c) |
| 696 | |
| 697 | #define HPRT0 HSOTG_REG(0x0440) |
| 698 | #define HPRT0_SPD_MASK (0x3 << 17) |
| 699 | #define HPRT0_SPD_SHIFT 17 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 700 | #define HPRT0_SPD_HIGH_SPEED 0 |
| 701 | #define HPRT0_SPD_FULL_SPEED 1 |
| 702 | #define HPRT0_SPD_LOW_SPEED 2 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 703 | #define HPRT0_TSTCTL_MASK (0xf << 13) |
| 704 | #define HPRT0_TSTCTL_SHIFT 13 |
| 705 | #define HPRT0_PWR (1 << 12) |
| 706 | #define HPRT0_LNSTS_MASK (0x3 << 10) |
| 707 | #define HPRT0_LNSTS_SHIFT 10 |
| 708 | #define HPRT0_RST (1 << 8) |
| 709 | #define HPRT0_SUSP (1 << 7) |
| 710 | #define HPRT0_RES (1 << 6) |
| 711 | #define HPRT0_OVRCURRCHG (1 << 5) |
| 712 | #define HPRT0_OVRCURRACT (1 << 4) |
| 713 | #define HPRT0_ENACHG (1 << 3) |
| 714 | #define HPRT0_ENA (1 << 2) |
| 715 | #define HPRT0_CONNDET (1 << 1) |
| 716 | #define HPRT0_CONNSTS (1 << 0) |
| 717 | |
| 718 | #define HCCHAR(_ch) HSOTG_REG(0x0500 + 0x20 * (_ch)) |
| 719 | #define HCCHAR_CHENA (1 << 31) |
| 720 | #define HCCHAR_CHDIS (1 << 30) |
| 721 | #define HCCHAR_ODDFRM (1 << 29) |
| 722 | #define HCCHAR_DEVADDR_MASK (0x7f << 22) |
| 723 | #define HCCHAR_DEVADDR_SHIFT 22 |
| 724 | #define HCCHAR_MULTICNT_MASK (0x3 << 20) |
| 725 | #define HCCHAR_MULTICNT_SHIFT 20 |
| 726 | #define HCCHAR_EPTYPE_MASK (0x3 << 18) |
| 727 | #define HCCHAR_EPTYPE_SHIFT 18 |
| 728 | #define HCCHAR_LSPDDEV (1 << 17) |
| 729 | #define HCCHAR_EPDIR (1 << 15) |
| 730 | #define HCCHAR_EPNUM_MASK (0xf << 11) |
| 731 | #define HCCHAR_EPNUM_SHIFT 11 |
| 732 | #define HCCHAR_MPS_MASK (0x7ff << 0) |
| 733 | #define HCCHAR_MPS_SHIFT 0 |
| 734 | |
| 735 | #define HCSPLT(_ch) HSOTG_REG(0x0504 + 0x20 * (_ch)) |
| 736 | #define HCSPLT_SPLTENA (1 << 31) |
| 737 | #define HCSPLT_COMPSPLT (1 << 16) |
| 738 | #define HCSPLT_XACTPOS_MASK (0x3 << 14) |
| 739 | #define HCSPLT_XACTPOS_SHIFT 14 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 740 | #define HCSPLT_XACTPOS_MID 0 |
| 741 | #define HCSPLT_XACTPOS_END 1 |
| 742 | #define HCSPLT_XACTPOS_BEGIN 2 |
| 743 | #define HCSPLT_XACTPOS_ALL 3 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 744 | #define HCSPLT_HUBADDR_MASK (0x7f << 7) |
| 745 | #define HCSPLT_HUBADDR_SHIFT 7 |
| 746 | #define HCSPLT_PRTADDR_MASK (0x7f << 0) |
| 747 | #define HCSPLT_PRTADDR_SHIFT 0 |
| 748 | |
| 749 | #define HCINT(_ch) HSOTG_REG(0x0508 + 0x20 * (_ch)) |
| 750 | #define HCINTMSK(_ch) HSOTG_REG(0x050c + 0x20 * (_ch)) |
| 751 | #define HCINTMSK_RESERVED14_31 (0x3ffff << 14) |
| 752 | #define HCINTMSK_FRM_LIST_ROLL (1 << 13) |
| 753 | #define HCINTMSK_XCS_XACT (1 << 12) |
| 754 | #define HCINTMSK_BNA (1 << 11) |
| 755 | #define HCINTMSK_DATATGLERR (1 << 10) |
| 756 | #define HCINTMSK_FRMOVRUN (1 << 9) |
| 757 | #define HCINTMSK_BBLERR (1 << 8) |
| 758 | #define HCINTMSK_XACTERR (1 << 7) |
| 759 | #define HCINTMSK_NYET (1 << 6) |
| 760 | #define HCINTMSK_ACK (1 << 5) |
| 761 | #define HCINTMSK_NAK (1 << 4) |
| 762 | #define HCINTMSK_STALL (1 << 3) |
| 763 | #define HCINTMSK_AHBERR (1 << 2) |
| 764 | #define HCINTMSK_CHHLTD (1 << 1) |
| 765 | #define HCINTMSK_XFERCOMPL (1 << 0) |
| 766 | |
| 767 | #define HCTSIZ(_ch) HSOTG_REG(0x0510 + 0x20 * (_ch)) |
| 768 | #define TSIZ_DOPNG (1 << 31) |
| 769 | #define TSIZ_SC_MC_PID_MASK (0x3 << 29) |
| 770 | #define TSIZ_SC_MC_PID_SHIFT 29 |
Matthijs Kooijman | f923463 | 2013-08-30 18:45:13 +0200 | [diff] [blame] | 771 | #define TSIZ_SC_MC_PID_DATA0 0 |
| 772 | #define TSIZ_SC_MC_PID_DATA2 1 |
| 773 | #define TSIZ_SC_MC_PID_DATA1 2 |
| 774 | #define TSIZ_SC_MC_PID_MDATA 3 |
| 775 | #define TSIZ_SC_MC_PID_SETUP 3 |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 776 | #define TSIZ_PKTCNT_MASK (0x3ff << 19) |
| 777 | #define TSIZ_PKTCNT_SHIFT 19 |
| 778 | #define TSIZ_NTD_MASK (0xff << 8) |
| 779 | #define TSIZ_NTD_SHIFT 8 |
| 780 | #define TSIZ_SCHINFO_MASK (0xff << 0) |
| 781 | #define TSIZ_SCHINFO_SHIFT 0 |
| 782 | #define TSIZ_XFERSIZE_MASK (0x7ffff << 0) |
| 783 | #define TSIZ_XFERSIZE_SHIFT 0 |
| 784 | |
| 785 | #define HCDMA(_ch) HSOTG_REG(0x0514 + 0x20 * (_ch)) |
Paul Zimmerman | 56f5b1c | 2013-03-11 17:47:58 -0700 | [diff] [blame] | 786 | |
| 787 | #define HCDMAB(_ch) HSOTG_REG(0x051c + 0x20 * (_ch)) |
| 788 | |
| 789 | #define HCFIFO(_ch) HSOTG_REG(0x1000 + 0x1000 * (_ch)) |
| 790 | |
| 791 | /** |
| 792 | * struct dwc2_hcd_dma_desc - Host-mode DMA descriptor structure |
| 793 | * |
| 794 | * @status: DMA descriptor status quadlet |
| 795 | * @buf: DMA descriptor data buffer pointer |
| 796 | * |
| 797 | * DMA Descriptor structure contains two quadlets: |
| 798 | * Status quadlet and Data buffer pointer. |
| 799 | */ |
| 800 | struct dwc2_hcd_dma_desc { |
| 801 | u32 status; |
| 802 | u32 buf; |
| 803 | }; |
| 804 | |
| 805 | #define HOST_DMA_A (1 << 31) |
| 806 | #define HOST_DMA_STS_MASK (0x3 << 28) |
| 807 | #define HOST_DMA_STS_SHIFT 28 |
| 808 | #define HOST_DMA_STS_PKTERR (1 << 28) |
| 809 | #define HOST_DMA_EOL (1 << 26) |
| 810 | #define HOST_DMA_IOC (1 << 25) |
| 811 | #define HOST_DMA_SUP (1 << 24) |
| 812 | #define HOST_DMA_ALT_QTD (1 << 23) |
| 813 | #define HOST_DMA_QTD_OFFSET_MASK (0x3f << 17) |
| 814 | #define HOST_DMA_QTD_OFFSET_SHIFT 17 |
| 815 | #define HOST_DMA_ISOC_NBYTES_MASK (0xfff << 0) |
| 816 | #define HOST_DMA_ISOC_NBYTES_SHIFT 0 |
| 817 | #define HOST_DMA_NBYTES_MASK (0x1ffff << 0) |
| 818 | #define HOST_DMA_NBYTES_SHIFT 0 |
| 819 | |
| 820 | #define MAX_DMA_DESC_SIZE 131071 |
| 821 | #define MAX_DMA_DESC_NUM_GENERIC 64 |
| 822 | #define MAX_DMA_DESC_NUM_HS_ISOC 256 |
| 823 | |
| 824 | #endif /* __DWC2_HW_H__ */ |