xref: /linux/drivers/usb/isp1760/isp1760-regs.h (revision 7ef077a8ad3557f030d0407c4f56c5a0cf1e418a)
1*7ef077a8SLaurent Pinchart /*
2*7ef077a8SLaurent Pinchart  * Driver for the NXP ISP1760 chip
3*7ef077a8SLaurent Pinchart  *
4*7ef077a8SLaurent Pinchart  * Copyright 2014 Laurent Pinchart
5*7ef077a8SLaurent Pinchart  * Copyright 2007 Sebastian Siewior
6*7ef077a8SLaurent Pinchart  *
7*7ef077a8SLaurent Pinchart  * Contacts:
8*7ef077a8SLaurent Pinchart  *     Sebastian Siewior <bigeasy@linutronix.de>
9*7ef077a8SLaurent Pinchart  *     Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10*7ef077a8SLaurent Pinchart  *
11*7ef077a8SLaurent Pinchart  * This program is free software; you can redistribute it and/or
12*7ef077a8SLaurent Pinchart  * modify it under the terms of the GNU General Public License
13*7ef077a8SLaurent Pinchart  * version 2 as published by the Free Software Foundation.
14*7ef077a8SLaurent Pinchart  */
15*7ef077a8SLaurent Pinchart 
16*7ef077a8SLaurent Pinchart #ifndef _ISP1760_REGS_H_
17*7ef077a8SLaurent Pinchart #define _ISP1760_REGS_H_
18*7ef077a8SLaurent Pinchart 
19*7ef077a8SLaurent Pinchart /* -----------------------------------------------------------------------------
20*7ef077a8SLaurent Pinchart  * Host Controller
21*7ef077a8SLaurent Pinchart  */
22*7ef077a8SLaurent Pinchart 
23*7ef077a8SLaurent Pinchart /* EHCI capability registers */
24*7ef077a8SLaurent Pinchart #define HC_CAPLENGTH		0x000
25*7ef077a8SLaurent Pinchart #define HC_LENGTH(p)		(((p) >> 00) & 0x00ff)	/* bits 7:0 */
26*7ef077a8SLaurent Pinchart #define HC_VERSION(p)		(((p) >> 16) & 0xffff)	/* bits 31:16 */
27*7ef077a8SLaurent Pinchart 
28*7ef077a8SLaurent Pinchart #define HC_HCSPARAMS		0x004
29*7ef077a8SLaurent Pinchart #define HCS_INDICATOR(p)	((p) & (1 << 16))	/* true: has port indicators */
30*7ef077a8SLaurent Pinchart #define HCS_PPC(p)		((p) & (1 << 4))	/* true: port power control */
31*7ef077a8SLaurent Pinchart #define HCS_N_PORTS(p)		(((p) >> 0) & 0xf)	/* bits 3:0, ports on HC */
32*7ef077a8SLaurent Pinchart 
33*7ef077a8SLaurent Pinchart #define HC_HCCPARAMS		0x008
34*7ef077a8SLaurent Pinchart #define HCC_ISOC_CACHE(p)       ((p) & (1 << 7))	/* true: can cache isoc frame */
35*7ef077a8SLaurent Pinchart #define HCC_ISOC_THRES(p)       (((p) >> 4) & 0x7)	/* bits 6:4, uframes cached */
36*7ef077a8SLaurent Pinchart 
37*7ef077a8SLaurent Pinchart /* EHCI operational registers */
38*7ef077a8SLaurent Pinchart #define HC_USBCMD		0x020
39*7ef077a8SLaurent Pinchart #define CMD_LRESET		(1 << 7)		/* partial reset (no ports, etc) */
40*7ef077a8SLaurent Pinchart #define CMD_RESET		(1 << 1)		/* reset HC not bus */
41*7ef077a8SLaurent Pinchart #define CMD_RUN			(1 << 0)		/* start/stop HC */
42*7ef077a8SLaurent Pinchart 
43*7ef077a8SLaurent Pinchart #define HC_USBSTS		0x024
44*7ef077a8SLaurent Pinchart #define STS_PCD			(1 << 2)		/* port change detect */
45*7ef077a8SLaurent Pinchart 
46*7ef077a8SLaurent Pinchart #define HC_FRINDEX		0x02c
47*7ef077a8SLaurent Pinchart 
48*7ef077a8SLaurent Pinchart #define HC_CONFIGFLAG		0x060
49*7ef077a8SLaurent Pinchart #define FLAG_CF			(1 << 0)		/* true: we'll support "high speed" */
50*7ef077a8SLaurent Pinchart 
51*7ef077a8SLaurent Pinchart #define HC_PORTSC1		0x064
52*7ef077a8SLaurent Pinchart #define PORT_OWNER		(1 << 13)		/* true: companion hc owns this port */
53*7ef077a8SLaurent Pinchart #define PORT_POWER		(1 << 12)		/* true: has power (see PPC) */
54*7ef077a8SLaurent Pinchart #define PORT_USB11(x)		(((x) & (3 << 10)) == (1 << 10))	/* USB 1.1 device */
55*7ef077a8SLaurent Pinchart #define PORT_RESET		(1 << 8)		/* reset port */
56*7ef077a8SLaurent Pinchart #define PORT_SUSPEND		(1 << 7)		/* suspend port */
57*7ef077a8SLaurent Pinchart #define PORT_RESUME		(1 << 6)		/* resume it */
58*7ef077a8SLaurent Pinchart #define PORT_PE			(1 << 2)		/* port enable */
59*7ef077a8SLaurent Pinchart #define PORT_CSC		(1 << 1)		/* connect status change */
60*7ef077a8SLaurent Pinchart #define PORT_CONNECT		(1 << 0)		/* device connected */
61*7ef077a8SLaurent Pinchart #define PORT_RWC_BITS		(PORT_CSC)
62*7ef077a8SLaurent Pinchart 
63*7ef077a8SLaurent Pinchart #define HC_ISO_PTD_DONEMAP_REG	0x130
64*7ef077a8SLaurent Pinchart #define HC_ISO_PTD_SKIPMAP_REG	0x134
65*7ef077a8SLaurent Pinchart #define HC_ISO_PTD_LASTPTD_REG	0x138
66*7ef077a8SLaurent Pinchart #define HC_INT_PTD_DONEMAP_REG	0x140
67*7ef077a8SLaurent Pinchart #define HC_INT_PTD_SKIPMAP_REG	0x144
68*7ef077a8SLaurent Pinchart #define HC_INT_PTD_LASTPTD_REG	0x148
69*7ef077a8SLaurent Pinchart #define HC_ATL_PTD_DONEMAP_REG	0x150
70*7ef077a8SLaurent Pinchart #define HC_ATL_PTD_SKIPMAP_REG	0x154
71*7ef077a8SLaurent Pinchart #define HC_ATL_PTD_LASTPTD_REG	0x158
72*7ef077a8SLaurent Pinchart 
73*7ef077a8SLaurent Pinchart /* Configuration Register */
74*7ef077a8SLaurent Pinchart #define HC_HW_MODE_CTRL		0x300
75*7ef077a8SLaurent Pinchart #define ALL_ATX_RESET		(1 << 31)
76*7ef077a8SLaurent Pinchart #define HW_ANA_DIGI_OC		(1 << 15)
77*7ef077a8SLaurent Pinchart #define HW_DEV_DMA		(1 << 11)
78*7ef077a8SLaurent Pinchart #define HW_COMN_IRQ		(1 << 10)
79*7ef077a8SLaurent Pinchart #define HW_COMN_DMA		(1 << 9)
80*7ef077a8SLaurent Pinchart #define HW_DATA_BUS_32BIT	(1 << 8)
81*7ef077a8SLaurent Pinchart #define HW_DACK_POL_HIGH	(1 << 6)
82*7ef077a8SLaurent Pinchart #define HW_DREQ_POL_HIGH	(1 << 5)
83*7ef077a8SLaurent Pinchart #define HW_INTR_HIGH_ACT	(1 << 2)
84*7ef077a8SLaurent Pinchart #define HW_INTR_EDGE_TRIG	(1 << 1)
85*7ef077a8SLaurent Pinchart #define HW_GLOBAL_INTR_EN	(1 << 0)
86*7ef077a8SLaurent Pinchart 
87*7ef077a8SLaurent Pinchart #define HC_CHIP_ID_REG		0x304
88*7ef077a8SLaurent Pinchart #define HC_SCRATCH_REG		0x308
89*7ef077a8SLaurent Pinchart 
90*7ef077a8SLaurent Pinchart #define HC_RESET_REG		0x30c
91*7ef077a8SLaurent Pinchart #define SW_RESET_RESET_HC	(1 << 1)
92*7ef077a8SLaurent Pinchart #define SW_RESET_RESET_ALL	(1 << 0)
93*7ef077a8SLaurent Pinchart 
94*7ef077a8SLaurent Pinchart #define HC_BUFFER_STATUS_REG	0x334
95*7ef077a8SLaurent Pinchart #define ISO_BUF_FILL		(1 << 2)
96*7ef077a8SLaurent Pinchart #define INT_BUF_FILL		(1 << 1)
97*7ef077a8SLaurent Pinchart #define ATL_BUF_FILL		(1 << 0)
98*7ef077a8SLaurent Pinchart 
99*7ef077a8SLaurent Pinchart #define HC_MEMORY_REG		0x33c
100*7ef077a8SLaurent Pinchart #define ISP_BANK(x)		((x) << 16)
101*7ef077a8SLaurent Pinchart 
102*7ef077a8SLaurent Pinchart #define HC_PORT1_CTRL		0x374
103*7ef077a8SLaurent Pinchart #define PORT1_POWER		(3 << 3)
104*7ef077a8SLaurent Pinchart #define PORT1_INIT1		(1 << 7)
105*7ef077a8SLaurent Pinchart #define PORT1_INIT2		(1 << 23)
106*7ef077a8SLaurent Pinchart #define HW_OTG_CTRL_SET		0x374
107*7ef077a8SLaurent Pinchart #define HW_OTG_CTRL_CLR		0x376
108*7ef077a8SLaurent Pinchart #define HW_OTG_DISABLE		(1 << 10)
109*7ef077a8SLaurent Pinchart #define HW_OTG_SE0_EN		(1 << 9)
110*7ef077a8SLaurent Pinchart #define HW_BDIS_ACON_EN		(1 << 8)
111*7ef077a8SLaurent Pinchart #define HW_SW_SEL_HC_DC		(1 << 7)
112*7ef077a8SLaurent Pinchart #define HW_VBUS_CHRG		(1 << 6)
113*7ef077a8SLaurent Pinchart #define HW_VBUS_DISCHRG		(1 << 5)
114*7ef077a8SLaurent Pinchart #define HW_VBUS_DRV		(1 << 4)
115*7ef077a8SLaurent Pinchart #define HW_SEL_CP_EXT		(1 << 3)
116*7ef077a8SLaurent Pinchart #define HW_DM_PULLDOWN		(1 << 2)
117*7ef077a8SLaurent Pinchart #define HW_DP_PULLDOWN		(1 << 1)
118*7ef077a8SLaurent Pinchart #define HW_DP_PULLUP		(1 << 0)
119*7ef077a8SLaurent Pinchart 
120*7ef077a8SLaurent Pinchart /* Interrupt Register */
121*7ef077a8SLaurent Pinchart #define HC_INTERRUPT_REG	0x310
122*7ef077a8SLaurent Pinchart 
123*7ef077a8SLaurent Pinchart #define HC_INTERRUPT_ENABLE	0x314
124*7ef077a8SLaurent Pinchart #define HC_ISO_INT		(1 << 9)
125*7ef077a8SLaurent Pinchart #define HC_ATL_INT		(1 << 8)
126*7ef077a8SLaurent Pinchart #define HC_INTL_INT		(1 << 7)
127*7ef077a8SLaurent Pinchart #define HC_EOT_INT		(1 << 3)
128*7ef077a8SLaurent Pinchart #define HC_SOT_INT		(1 << 1)
129*7ef077a8SLaurent Pinchart #define INTERRUPT_ENABLE_MASK	(HC_INTL_INT | HC_ATL_INT)
130*7ef077a8SLaurent Pinchart 
131*7ef077a8SLaurent Pinchart #define HC_ISO_IRQ_MASK_OR_REG	0x318
132*7ef077a8SLaurent Pinchart #define HC_INT_IRQ_MASK_OR_REG	0x31c
133*7ef077a8SLaurent Pinchart #define HC_ATL_IRQ_MASK_OR_REG	0x320
134*7ef077a8SLaurent Pinchart #define HC_ISO_IRQ_MASK_AND_REG	0x324
135*7ef077a8SLaurent Pinchart #define HC_INT_IRQ_MASK_AND_REG	0x328
136*7ef077a8SLaurent Pinchart #define HC_ATL_IRQ_MASK_AND_REG	0x32c
137*7ef077a8SLaurent Pinchart 
138*7ef077a8SLaurent Pinchart /* -----------------------------------------------------------------------------
139*7ef077a8SLaurent Pinchart  * Peripheral Controller
140*7ef077a8SLaurent Pinchart  */
141*7ef077a8SLaurent Pinchart 
142*7ef077a8SLaurent Pinchart /* Initialization Registers */
143*7ef077a8SLaurent Pinchart #define DC_ADDRESS			0x0200
144*7ef077a8SLaurent Pinchart #define DC_DEVEN			(1 << 7)
145*7ef077a8SLaurent Pinchart 
146*7ef077a8SLaurent Pinchart #define DC_MODE				0x020c
147*7ef077a8SLaurent Pinchart #define DC_DMACLKON			(1 << 9)
148*7ef077a8SLaurent Pinchart #define DC_VBUSSTAT			(1 << 8)
149*7ef077a8SLaurent Pinchart #define DC_CLKAON			(1 << 7)
150*7ef077a8SLaurent Pinchart #define DC_SNDRSU			(1 << 6)
151*7ef077a8SLaurent Pinchart #define DC_GOSUSP			(1 << 5)
152*7ef077a8SLaurent Pinchart #define DC_SFRESET			(1 << 4)
153*7ef077a8SLaurent Pinchart #define DC_GLINTENA			(1 << 3)
154*7ef077a8SLaurent Pinchart #define DC_WKUPCS			(1 << 2)
155*7ef077a8SLaurent Pinchart 
156*7ef077a8SLaurent Pinchart #define DC_INTCONF			0x0210
157*7ef077a8SLaurent Pinchart #define DC_CDBGMOD_ACK_NAK		(0 << 6)
158*7ef077a8SLaurent Pinchart #define DC_CDBGMOD_ACK			(1 << 6)
159*7ef077a8SLaurent Pinchart #define DC_CDBGMOD_ACK_1NAK		(2 << 6)
160*7ef077a8SLaurent Pinchart #define DC_DDBGMODIN_ACK_NAK		(0 << 4)
161*7ef077a8SLaurent Pinchart #define DC_DDBGMODIN_ACK		(1 << 4)
162*7ef077a8SLaurent Pinchart #define DC_DDBGMODIN_ACK_1NAK		(2 << 4)
163*7ef077a8SLaurent Pinchart #define DC_DDBGMODOUT_ACK_NYET_NAK	(0 << 2)
164*7ef077a8SLaurent Pinchart #define DC_DDBGMODOUT_ACK_NYET		(1 << 2)
165*7ef077a8SLaurent Pinchart #define DC_DDBGMODOUT_ACK_NYET_1NAK	(2 << 2)
166*7ef077a8SLaurent Pinchart #define DC_INTLVL			(1 << 1)
167*7ef077a8SLaurent Pinchart #define DC_INTPOL			(1 << 0)
168*7ef077a8SLaurent Pinchart 
169*7ef077a8SLaurent Pinchart #define DC_DEBUG			0x0212
170*7ef077a8SLaurent Pinchart #define DC_INTENABLE			0x0214
171*7ef077a8SLaurent Pinchart #define DC_IEPTX(n)			(1 << (11 + 2 * (n)))
172*7ef077a8SLaurent Pinchart #define DC_IEPRX(n)			(1 << (10 + 2 * (n)))
173*7ef077a8SLaurent Pinchart #define DC_IEPRXTX(n)			(3 << (10 + 2 * (n)))
174*7ef077a8SLaurent Pinchart #define DC_IEP0SETUP			(1 << 8)
175*7ef077a8SLaurent Pinchart #define DC_IEVBUS			(1 << 7)
176*7ef077a8SLaurent Pinchart #define DC_IEDMA			(1 << 6)
177*7ef077a8SLaurent Pinchart #define DC_IEHS_STA			(1 << 5)
178*7ef077a8SLaurent Pinchart #define DC_IERESM			(1 << 4)
179*7ef077a8SLaurent Pinchart #define DC_IESUSP			(1 << 3)
180*7ef077a8SLaurent Pinchart #define DC_IEPSOF			(1 << 2)
181*7ef077a8SLaurent Pinchart #define DC_IESOF			(1 << 1)
182*7ef077a8SLaurent Pinchart #define DC_IEBRST			(1 << 0)
183*7ef077a8SLaurent Pinchart 
184*7ef077a8SLaurent Pinchart /* Data Flow Registers */
185*7ef077a8SLaurent Pinchart #define DC_EPINDEX			0x022c
186*7ef077a8SLaurent Pinchart #define DC_EP0SETUP			(1 << 5)
187*7ef077a8SLaurent Pinchart #define DC_ENDPIDX(n)			((n) << 1)
188*7ef077a8SLaurent Pinchart #define DC_EPDIR			(1 << 0)
189*7ef077a8SLaurent Pinchart 
190*7ef077a8SLaurent Pinchart #define DC_CTRLFUNC			0x0228
191*7ef077a8SLaurent Pinchart #define DC_CLBUF			(1 << 4)
192*7ef077a8SLaurent Pinchart #define DC_VENDP			(1 << 3)
193*7ef077a8SLaurent Pinchart #define DC_DSEN				(1 << 2)
194*7ef077a8SLaurent Pinchart #define DC_STATUS			(1 << 1)
195*7ef077a8SLaurent Pinchart #define DC_STALL			(1 << 0)
196*7ef077a8SLaurent Pinchart 
197*7ef077a8SLaurent Pinchart #define DC_DATAPORT			0x0220
198*7ef077a8SLaurent Pinchart #define DC_BUFLEN			0x021c
199*7ef077a8SLaurent Pinchart #define DC_DATACOUNT_MASK		0xffff
200*7ef077a8SLaurent Pinchart #define DC_BUFSTAT			0x021e
201*7ef077a8SLaurent Pinchart #define DC_EPMAXPKTSZ			0x0204
202*7ef077a8SLaurent Pinchart 
203*7ef077a8SLaurent Pinchart #define DC_EPTYPE			0x0208
204*7ef077a8SLaurent Pinchart #define DC_NOEMPKT			(1 << 4)
205*7ef077a8SLaurent Pinchart #define DC_EPENABLE			(1 << 3)
206*7ef077a8SLaurent Pinchart #define DC_DBLBUF			(1 << 2)
207*7ef077a8SLaurent Pinchart #define DC_ENDPTYP_ISOC			(1 << 0)
208*7ef077a8SLaurent Pinchart #define DC_ENDPTYP_BULK			(2 << 0)
209*7ef077a8SLaurent Pinchart #define DC_ENDPTYP_INTERRUPT		(3 << 0)
210*7ef077a8SLaurent Pinchart 
211*7ef077a8SLaurent Pinchart /* DMA Registers */
212*7ef077a8SLaurent Pinchart #define DC_DMACMD			0x0230
213*7ef077a8SLaurent Pinchart #define DC_DMATXCOUNT			0x0234
214*7ef077a8SLaurent Pinchart #define DC_DMACONF			0x0238
215*7ef077a8SLaurent Pinchart #define DC_DMAHW			0x023c
216*7ef077a8SLaurent Pinchart #define DC_DMAINTREASON			0x0250
217*7ef077a8SLaurent Pinchart #define DC_DMAINTEN			0x0254
218*7ef077a8SLaurent Pinchart #define DC_DMAEP			0x0258
219*7ef077a8SLaurent Pinchart #define DC_DMABURSTCOUNT		0x0264
220*7ef077a8SLaurent Pinchart 
221*7ef077a8SLaurent Pinchart /* General Registers */
222*7ef077a8SLaurent Pinchart #define DC_INTERRUPT			0x0218
223*7ef077a8SLaurent Pinchart #define DC_CHIPID			0x0270
224*7ef077a8SLaurent Pinchart #define DC_FRAMENUM			0x0274
225*7ef077a8SLaurent Pinchart #define DC_SCRATCH			0x0278
226*7ef077a8SLaurent Pinchart #define DC_UNLOCKDEV			0x027c
227*7ef077a8SLaurent Pinchart #define DC_INTPULSEWIDTH		0x0280
228*7ef077a8SLaurent Pinchart #define DC_TESTMODE			0x0284
229*7ef077a8SLaurent Pinchart 
230*7ef077a8SLaurent Pinchart #endif
231