18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Driver for the NXP ISP1760 chip 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright 2014 Laurent Pinchart 68c2ecf20Sopenharmony_ci * Copyright 2007 Sebastian Siewior 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * Contacts: 98c2ecf20Sopenharmony_ci * Sebastian Siewior <bigeasy@linutronix.de> 108c2ecf20Sopenharmony_ci * Laurent Pinchart <laurent.pinchart@ideasonboard.com> 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef _ISP1760_REGS_H_ 148c2ecf20Sopenharmony_ci#define _ISP1760_REGS_H_ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* ----------------------------------------------------------------------------- 178c2ecf20Sopenharmony_ci * Host Controller 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* EHCI capability registers */ 218c2ecf20Sopenharmony_ci#define HC_CAPLENGTH 0x000 228c2ecf20Sopenharmony_ci#define HC_LENGTH(p) (((p) >> 00) & 0x00ff) /* bits 7:0 */ 238c2ecf20Sopenharmony_ci#define HC_VERSION(p) (((p) >> 16) & 0xffff) /* bits 31:16 */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define HC_HCSPARAMS 0x004 268c2ecf20Sopenharmony_ci#define HCS_INDICATOR(p) ((p) & (1 << 16)) /* true: has port indicators */ 278c2ecf20Sopenharmony_ci#define HCS_PPC(p) ((p) & (1 << 4)) /* true: port power control */ 288c2ecf20Sopenharmony_ci#define HCS_N_PORTS(p) (((p) >> 0) & 0xf) /* bits 3:0, ports on HC */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci#define HC_HCCPARAMS 0x008 318c2ecf20Sopenharmony_ci#define HCC_ISOC_CACHE(p) ((p) & (1 << 7)) /* true: can cache isoc frame */ 328c2ecf20Sopenharmony_ci#define HCC_ISOC_THRES(p) (((p) >> 4) & 0x7) /* bits 6:4, uframes cached */ 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* EHCI operational registers */ 358c2ecf20Sopenharmony_ci#define HC_USBCMD 0x020 368c2ecf20Sopenharmony_ci#define CMD_LRESET (1 << 7) /* partial reset (no ports, etc) */ 378c2ecf20Sopenharmony_ci#define CMD_RESET (1 << 1) /* reset HC not bus */ 388c2ecf20Sopenharmony_ci#define CMD_RUN (1 << 0) /* start/stop HC */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define HC_USBSTS 0x024 418c2ecf20Sopenharmony_ci#define STS_PCD (1 << 2) /* port change detect */ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define HC_FRINDEX 0x02c 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#define HC_CONFIGFLAG 0x060 468c2ecf20Sopenharmony_ci#define FLAG_CF (1 << 0) /* true: we'll support "high speed" */ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci#define HC_PORTSC1 0x064 498c2ecf20Sopenharmony_ci#define PORT_OWNER (1 << 13) /* true: companion hc owns this port */ 508c2ecf20Sopenharmony_ci#define PORT_POWER (1 << 12) /* true: has power (see PPC) */ 518c2ecf20Sopenharmony_ci#define PORT_USB11(x) (((x) & (3 << 10)) == (1 << 10)) /* USB 1.1 device */ 528c2ecf20Sopenharmony_ci#define PORT_RESET (1 << 8) /* reset port */ 538c2ecf20Sopenharmony_ci#define PORT_SUSPEND (1 << 7) /* suspend port */ 548c2ecf20Sopenharmony_ci#define PORT_RESUME (1 << 6) /* resume it */ 558c2ecf20Sopenharmony_ci#define PORT_PE (1 << 2) /* port enable */ 568c2ecf20Sopenharmony_ci#define PORT_CSC (1 << 1) /* connect status change */ 578c2ecf20Sopenharmony_ci#define PORT_CONNECT (1 << 0) /* device connected */ 588c2ecf20Sopenharmony_ci#define PORT_RWC_BITS (PORT_CSC) 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci#define HC_ISO_PTD_DONEMAP_REG 0x130 618c2ecf20Sopenharmony_ci#define HC_ISO_PTD_SKIPMAP_REG 0x134 628c2ecf20Sopenharmony_ci#define HC_ISO_PTD_LASTPTD_REG 0x138 638c2ecf20Sopenharmony_ci#define HC_INT_PTD_DONEMAP_REG 0x140 648c2ecf20Sopenharmony_ci#define HC_INT_PTD_SKIPMAP_REG 0x144 658c2ecf20Sopenharmony_ci#define HC_INT_PTD_LASTPTD_REG 0x148 668c2ecf20Sopenharmony_ci#define HC_ATL_PTD_DONEMAP_REG 0x150 678c2ecf20Sopenharmony_ci#define HC_ATL_PTD_SKIPMAP_REG 0x154 688c2ecf20Sopenharmony_ci#define HC_ATL_PTD_LASTPTD_REG 0x158 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci/* Configuration Register */ 718c2ecf20Sopenharmony_ci#define HC_HW_MODE_CTRL 0x300 728c2ecf20Sopenharmony_ci#define ALL_ATX_RESET (1 << 31) 738c2ecf20Sopenharmony_ci#define HW_ANA_DIGI_OC (1 << 15) 748c2ecf20Sopenharmony_ci#define HW_DEV_DMA (1 << 11) 758c2ecf20Sopenharmony_ci#define HW_COMN_IRQ (1 << 10) 768c2ecf20Sopenharmony_ci#define HW_COMN_DMA (1 << 9) 778c2ecf20Sopenharmony_ci#define HW_DATA_BUS_32BIT (1 << 8) 788c2ecf20Sopenharmony_ci#define HW_DACK_POL_HIGH (1 << 6) 798c2ecf20Sopenharmony_ci#define HW_DREQ_POL_HIGH (1 << 5) 808c2ecf20Sopenharmony_ci#define HW_INTR_HIGH_ACT (1 << 2) 818c2ecf20Sopenharmony_ci#define HW_INTR_EDGE_TRIG (1 << 1) 828c2ecf20Sopenharmony_ci#define HW_GLOBAL_INTR_EN (1 << 0) 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define HC_CHIP_ID_REG 0x304 858c2ecf20Sopenharmony_ci#define HC_SCRATCH_REG 0x308 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define HC_RESET_REG 0x30c 888c2ecf20Sopenharmony_ci#define SW_RESET_RESET_HC (1 << 1) 898c2ecf20Sopenharmony_ci#define SW_RESET_RESET_ALL (1 << 0) 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#define HC_BUFFER_STATUS_REG 0x334 928c2ecf20Sopenharmony_ci#define ISO_BUF_FILL (1 << 2) 938c2ecf20Sopenharmony_ci#define INT_BUF_FILL (1 << 1) 948c2ecf20Sopenharmony_ci#define ATL_BUF_FILL (1 << 0) 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define HC_MEMORY_REG 0x33c 978c2ecf20Sopenharmony_ci#define ISP_BANK(x) ((x) << 16) 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#define HC_PORT1_CTRL 0x374 1008c2ecf20Sopenharmony_ci#define PORT1_POWER (3 << 3) 1018c2ecf20Sopenharmony_ci#define PORT1_INIT1 (1 << 7) 1028c2ecf20Sopenharmony_ci#define PORT1_INIT2 (1 << 23) 1038c2ecf20Sopenharmony_ci#define HW_OTG_CTRL_SET 0x374 1048c2ecf20Sopenharmony_ci#define HW_OTG_CTRL_CLR 0x376 1058c2ecf20Sopenharmony_ci#define HW_OTG_DISABLE (1 << 10) 1068c2ecf20Sopenharmony_ci#define HW_OTG_SE0_EN (1 << 9) 1078c2ecf20Sopenharmony_ci#define HW_BDIS_ACON_EN (1 << 8) 1088c2ecf20Sopenharmony_ci#define HW_SW_SEL_HC_DC (1 << 7) 1098c2ecf20Sopenharmony_ci#define HW_VBUS_CHRG (1 << 6) 1108c2ecf20Sopenharmony_ci#define HW_VBUS_DISCHRG (1 << 5) 1118c2ecf20Sopenharmony_ci#define HW_VBUS_DRV (1 << 4) 1128c2ecf20Sopenharmony_ci#define HW_SEL_CP_EXT (1 << 3) 1138c2ecf20Sopenharmony_ci#define HW_DM_PULLDOWN (1 << 2) 1148c2ecf20Sopenharmony_ci#define HW_DP_PULLDOWN (1 << 1) 1158c2ecf20Sopenharmony_ci#define HW_DP_PULLUP (1 << 0) 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci/* Interrupt Register */ 1188c2ecf20Sopenharmony_ci#define HC_INTERRUPT_REG 0x310 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci#define HC_INTERRUPT_ENABLE 0x314 1218c2ecf20Sopenharmony_ci#define HC_ISO_INT (1 << 9) 1228c2ecf20Sopenharmony_ci#define HC_ATL_INT (1 << 8) 1238c2ecf20Sopenharmony_ci#define HC_INTL_INT (1 << 7) 1248c2ecf20Sopenharmony_ci#define HC_EOT_INT (1 << 3) 1258c2ecf20Sopenharmony_ci#define HC_SOT_INT (1 << 1) 1268c2ecf20Sopenharmony_ci#define INTERRUPT_ENABLE_MASK (HC_INTL_INT | HC_ATL_INT) 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci#define HC_ISO_IRQ_MASK_OR_REG 0x318 1298c2ecf20Sopenharmony_ci#define HC_INT_IRQ_MASK_OR_REG 0x31c 1308c2ecf20Sopenharmony_ci#define HC_ATL_IRQ_MASK_OR_REG 0x320 1318c2ecf20Sopenharmony_ci#define HC_ISO_IRQ_MASK_AND_REG 0x324 1328c2ecf20Sopenharmony_ci#define HC_INT_IRQ_MASK_AND_REG 0x328 1338c2ecf20Sopenharmony_ci#define HC_ATL_IRQ_MASK_AND_REG 0x32c 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci/* ----------------------------------------------------------------------------- 1368c2ecf20Sopenharmony_ci * Peripheral Controller 1378c2ecf20Sopenharmony_ci */ 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci/* Initialization Registers */ 1408c2ecf20Sopenharmony_ci#define DC_ADDRESS 0x0200 1418c2ecf20Sopenharmony_ci#define DC_DEVEN (1 << 7) 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci#define DC_MODE 0x020c 1448c2ecf20Sopenharmony_ci#define DC_DMACLKON (1 << 9) 1458c2ecf20Sopenharmony_ci#define DC_VBUSSTAT (1 << 8) 1468c2ecf20Sopenharmony_ci#define DC_CLKAON (1 << 7) 1478c2ecf20Sopenharmony_ci#define DC_SNDRSU (1 << 6) 1488c2ecf20Sopenharmony_ci#define DC_GOSUSP (1 << 5) 1498c2ecf20Sopenharmony_ci#define DC_SFRESET (1 << 4) 1508c2ecf20Sopenharmony_ci#define DC_GLINTENA (1 << 3) 1518c2ecf20Sopenharmony_ci#define DC_WKUPCS (1 << 2) 1528c2ecf20Sopenharmony_ci 1538c2ecf20Sopenharmony_ci#define DC_INTCONF 0x0210 1548c2ecf20Sopenharmony_ci#define DC_CDBGMOD_ACK_NAK (0 << 6) 1558c2ecf20Sopenharmony_ci#define DC_CDBGMOD_ACK (1 << 6) 1568c2ecf20Sopenharmony_ci#define DC_CDBGMOD_ACK_1NAK (2 << 6) 1578c2ecf20Sopenharmony_ci#define DC_DDBGMODIN_ACK_NAK (0 << 4) 1588c2ecf20Sopenharmony_ci#define DC_DDBGMODIN_ACK (1 << 4) 1598c2ecf20Sopenharmony_ci#define DC_DDBGMODIN_ACK_1NAK (2 << 4) 1608c2ecf20Sopenharmony_ci#define DC_DDBGMODOUT_ACK_NYET_NAK (0 << 2) 1618c2ecf20Sopenharmony_ci#define DC_DDBGMODOUT_ACK_NYET (1 << 2) 1628c2ecf20Sopenharmony_ci#define DC_DDBGMODOUT_ACK_NYET_1NAK (2 << 2) 1638c2ecf20Sopenharmony_ci#define DC_INTLVL (1 << 1) 1648c2ecf20Sopenharmony_ci#define DC_INTPOL (1 << 0) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci#define DC_DEBUG 0x0212 1678c2ecf20Sopenharmony_ci#define DC_INTENABLE 0x0214 1688c2ecf20Sopenharmony_ci#define DC_IEPTX(n) (1 << (11 + 2 * (n))) 1698c2ecf20Sopenharmony_ci#define DC_IEPRX(n) (1 << (10 + 2 * (n))) 1708c2ecf20Sopenharmony_ci#define DC_IEPRXTX(n) (3 << (10 + 2 * (n))) 1718c2ecf20Sopenharmony_ci#define DC_IEP0SETUP (1 << 8) 1728c2ecf20Sopenharmony_ci#define DC_IEVBUS (1 << 7) 1738c2ecf20Sopenharmony_ci#define DC_IEDMA (1 << 6) 1748c2ecf20Sopenharmony_ci#define DC_IEHS_STA (1 << 5) 1758c2ecf20Sopenharmony_ci#define DC_IERESM (1 << 4) 1768c2ecf20Sopenharmony_ci#define DC_IESUSP (1 << 3) 1778c2ecf20Sopenharmony_ci#define DC_IEPSOF (1 << 2) 1788c2ecf20Sopenharmony_ci#define DC_IESOF (1 << 1) 1798c2ecf20Sopenharmony_ci#define DC_IEBRST (1 << 0) 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci/* Data Flow Registers */ 1828c2ecf20Sopenharmony_ci#define DC_EPINDEX 0x022c 1838c2ecf20Sopenharmony_ci#define DC_EP0SETUP (1 << 5) 1848c2ecf20Sopenharmony_ci#define DC_ENDPIDX(n) ((n) << 1) 1858c2ecf20Sopenharmony_ci#define DC_EPDIR (1 << 0) 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci#define DC_CTRLFUNC 0x0228 1888c2ecf20Sopenharmony_ci#define DC_CLBUF (1 << 4) 1898c2ecf20Sopenharmony_ci#define DC_VENDP (1 << 3) 1908c2ecf20Sopenharmony_ci#define DC_DSEN (1 << 2) 1918c2ecf20Sopenharmony_ci#define DC_STATUS (1 << 1) 1928c2ecf20Sopenharmony_ci#define DC_STALL (1 << 0) 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_ci#define DC_DATAPORT 0x0220 1958c2ecf20Sopenharmony_ci#define DC_BUFLEN 0x021c 1968c2ecf20Sopenharmony_ci#define DC_DATACOUNT_MASK 0xffff 1978c2ecf20Sopenharmony_ci#define DC_BUFSTAT 0x021e 1988c2ecf20Sopenharmony_ci#define DC_EPMAXPKTSZ 0x0204 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci#define DC_EPTYPE 0x0208 2018c2ecf20Sopenharmony_ci#define DC_NOEMPKT (1 << 4) 2028c2ecf20Sopenharmony_ci#define DC_EPENABLE (1 << 3) 2038c2ecf20Sopenharmony_ci#define DC_DBLBUF (1 << 2) 2048c2ecf20Sopenharmony_ci#define DC_ENDPTYP_ISOC (1 << 0) 2058c2ecf20Sopenharmony_ci#define DC_ENDPTYP_BULK (2 << 0) 2068c2ecf20Sopenharmony_ci#define DC_ENDPTYP_INTERRUPT (3 << 0) 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci/* DMA Registers */ 2098c2ecf20Sopenharmony_ci#define DC_DMACMD 0x0230 2108c2ecf20Sopenharmony_ci#define DC_DMATXCOUNT 0x0234 2118c2ecf20Sopenharmony_ci#define DC_DMACONF 0x0238 2128c2ecf20Sopenharmony_ci#define DC_DMAHW 0x023c 2138c2ecf20Sopenharmony_ci#define DC_DMAINTREASON 0x0250 2148c2ecf20Sopenharmony_ci#define DC_DMAINTEN 0x0254 2158c2ecf20Sopenharmony_ci#define DC_DMAEP 0x0258 2168c2ecf20Sopenharmony_ci#define DC_DMABURSTCOUNT 0x0264 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci/* General Registers */ 2198c2ecf20Sopenharmony_ci#define DC_INTERRUPT 0x0218 2208c2ecf20Sopenharmony_ci#define DC_CHIPID 0x0270 2218c2ecf20Sopenharmony_ci#define DC_FRAMENUM 0x0274 2228c2ecf20Sopenharmony_ci#define DC_SCRATCH 0x0278 2238c2ecf20Sopenharmony_ci#define DC_UNLOCKDEV 0x027c 2248c2ecf20Sopenharmony_ci#define DC_INTPULSEWIDTH 0x0280 2258c2ecf20Sopenharmony_ci#define DC_TESTMODE 0x0284 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci#endif 228