1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * mcf5329.h -- Definitions for Freescale Coldfire 5329
4 *
5 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
6 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
7 */
8
9#ifndef mcf5329_h
10#define mcf5329_h
11/****************************************************************************/
12
13/*********************************************************************
14* System Control Module (SCM)
15*********************************************************************/
16/* Bit definitions and macros for SCM_MPR */
17#define SCM_MPR_MPROT0(x)		(((x)&0x0F)<<28)
18#define SCM_MPR_MPROT1(x)		(((x)&0x0F)<<24)
19#define SCM_MPR_MPROT2(x)		(((x)&0x0F)<<20)
20#define SCM_MPR_MPROT4(x)		(((x)&0x0F)<<12)
21#define SCM_MPR_MPROT5(x)		(((x)&0x0F)<<8)
22#define SCM_MPR_MPROT6(x)		(((x)&0x0F)<<4)
23#define MPROT_MTR			4
24#define MPROT_MTW			2
25#define MPROT_MPL			1
26
27/* Bit definitions and macros for SCM_BMT */
28#define BMT_BME				(0x08)
29#define BMT_8				(0x07)
30#define BMT_16				(0x06)
31#define BMT_32				(0x05)
32#define BMT_64				(0x04)
33#define BMT_128				(0x03)
34#define BMT_256				(0x02)
35#define BMT_512				(0x01)
36#define BMT_1024			(0x00)
37
38/* Bit definitions and macros for SCM_PACRA */
39#define SCM_PACRA_PACR0(x)		(((x)&0x0F)<<28)
40#define SCM_PACRA_PACR1(x)		(((x)&0x0F)<<24)
41#define SCM_PACRA_PACR2(x)		(((x)&0x0F)<<20)
42#define PACR_SP	4
43#define PACR_WP	2
44#define PACR_TP	1
45
46/* Bit definitions and macros for SCM_PACRB */
47#define SCM_PACRB_PACR8(x)		(((x)&0x0F)<<28)
48#define SCM_PACRB_PACR12(x)		(((x)&0x0F)<<12)
49
50/* Bit definitions and macros for SCM_PACRC */
51#define SCM_PACRC_PACR16(x)		(((x)&0x0F)<<28)
52#define SCM_PACRC_PACR17(x)		(((x)&0x0F)<<24)
53#define SCM_PACRC_PACR18(x)		(((x)&0x0F)<<20)
54#define SCM_PACRC_PACR19(x)		(((x)&0x0F)<<16)
55#define SCM_PACRC_PACR21(x)		(((x)&0x0F)<<8)
56#define SCM_PACRC_PACR22(x)		(((x)&0x0F)<<4)
57#define SCM_PACRC_PACR23(x)		(((x)&0x0F)<<0)
58
59/* Bit definitions and macros for SCM_PACRD */
60#define SCM_PACRD_PACR24(x)		(((x)&0x0F)<<28)
61#define SCM_PACRD_PACR25(x)		(((x)&0x0F)<<24)
62#define SCM_PACRD_PACR26(x)		(((x)&0x0F)<<20)
63#define SCM_PACRD_PACR28(x)		(((x)&0x0F)<<12)
64#define SCM_PACRD_PACR29(x)		(((x)&0x0F)<<8)
65#define SCM_PACRD_PACR30(x)		(((x)&0x0F)<<4)
66#define SCM_PACRD_PACR31(x)		(((x)&0x0F)<<0)
67
68/* Bit definitions and macros for SCM_PACRE */
69#define SCM_PACRE_PACR32(x)		(((x)&0x0F)<<28)
70#define SCM_PACRE_PACR33(x)		(((x)&0x0F)<<24)
71#define SCM_PACRE_PACR34(x)		(((x)&0x0F)<<20)
72#define SCM_PACRE_PACR35(x)		(((x)&0x0F)<<16)
73#define SCM_PACRE_PACR36(x)		(((x)&0x0F)<<12)
74#define SCM_PACRE_PACR37(x)		(((x)&0x0F)<<8)
75#define SCM_PACRE_PACR38(x)		(((x)&0x0F)<<4)
76
77/* Bit definitions and macros for SCM_PACRF */
78#define SCM_PACRF_PACR40(x)		(((x)&0x0F)<<28)
79#define SCM_PACRF_PACR41(x)		(((x)&0x0F)<<24)
80#define SCM_PACRF_PACR42(x)		(((x)&0x0F)<<20)
81#define SCM_PACRF_PACR43(x)		(((x)&0x0F)<<16)
82#define SCM_PACRF_PACR44(x)		(((x)&0x0F)<<12)
83#define SCM_PACRF_PACR45(x)		(((x)&0x0F)<<8)
84#define SCM_PACRF_PACR46(x)		(((x)&0x0F)<<4)
85#define SCM_PACRF_PACR47(x)		(((x)&0x0F)<<0)
86
87/* Bit definitions and macros for SCM_PACRG */
88#define SCM_PACRG_PACR48(x)		(((x)&0x0F)<<28)
89
90/* Bit definitions and macros for SCM_PACRH */
91#define SCM_PACRH_PACR56(x)		(((x)&0x0F)<<28)
92#define SCM_PACRH_PACR57(x)		(((x)&0x0F)<<24)
93#define SCM_PACRH_PACR58(x)		(((x)&0x0F)<<20)
94
95/* PACRn Assignments */
96#define PACR0(x)			SCM_PACRA_PACR0(x)
97#define PACR1(x)			SCM_PACRA_PACR1(x)
98#define PACR2(x)			SCM_PACRA_PACR2(x)
99#define PACR8(x)			SCM_PACRB_PACR8(x)
100#define PACR12(x)			SCM_PACRB_PACR12(x)
101#define PACR16(x)			SCM_PACRC_PACR16(x)
102#define PACR17(x)			SCM_PACRC_PACR17(x)
103#define PACR18(x)			SCM_PACRC_PACR18(x)
104#define PACR19(x)			SCM_PACRC_PACR19(x)
105#define PACR21(x)			SCM_PACRC_PACR21(x)
106#define PACR22(x)			SCM_PACRC_PACR22(x)
107#define PACR23(x)			SCM_PACRC_PACR23(x)
108#define PACR24(x)			SCM_PACRD_PACR24(x)
109#define PACR25(x)			SCM_PACRD_PACR25(x)
110#define PACR26(x)			SCM_PACRD_PACR26(x)
111#define PACR28(x)			SCM_PACRD_PACR28(x)
112#define PACR29(x)			SCM_PACRD_PACR29(x)
113#define PACR30(x)			SCM_PACRD_PACR30(x)
114#define PACR31(x)			SCM_PACRD_PACR31(x)
115#define PACR32(x)			SCM_PACRE_PACR32(x)
116#define PACR33(x)			SCM_PACRE_PACR33(x)
117#define PACR34(x)			SCM_PACRE_PACR34(x)
118#define PACR35(x)			SCM_PACRE_PACR35(x)
119#define PACR36(x)			SCM_PACRE_PACR36(x)
120#define PACR37(x)			SCM_PACRE_PACR37(x)
121#define PACR38(x)			SCM_PACRE_PACR38(x)
122#define PACR40(x)			SCM_PACRF_PACR40(x)
123#define PACR41(x)			SCM_PACRF_PACR41(x)
124#define PACR42(x)			SCM_PACRF_PACR42(x)
125#define PACR43(x)			SCM_PACRF_PACR43(x)
126#define PACR44(x)			SCM_PACRF_PACR44(x)
127#define PACR45(x)			SCM_PACRF_PACR45(x)
128#define PACR46(x)			SCM_PACRF_PACR46(x)
129#define PACR47(x)			SCM_PACRF_PACR47(x)
130#define PACR48(x)			SCM_PACRG_PACR48(x)
131#define PACR56(x)			SCM_PACRH_PACR56(x)
132#define PACR57(x)			SCM_PACRH_PACR57(x)
133#define PACR58(x)			SCM_PACRH_PACR58(x)
134
135/* Bit definitions and macros for SCM_CWCR */
136#define CWCR_RO				(0x8000)
137#define CWCR_CWR_WH			(0x0100)
138#define CWCR_CWE			(0x0080)
139#define CWRI_WINDOW			(0x0060)
140#define CWRI_RESET			(0x0040)
141#define CWRI_INT_RESET			(0x0020)
142#define CWRI_INT			(0x0000)
143#define CWCR_CWT(x)			(((x)&0x001F))
144
145/* Bit definitions and macros for SCM_ISR */
146#define SCMISR_CFEI			(0x02)
147#define SCMISR_CWIC			(0x01)
148
149/* Bit definitions and macros for SCM_BCR */
150#define BCR_GBR				(0x00000200)
151#define BCR_GBW				(0x00000100)
152#define BCR_S7				(0x00000080)
153#define BCR_S6				(0x00000040)
154#define BCR_S4				(0x00000010)
155#define BCR_S1				(0x00000002)
156
157/* Bit definitions and macros for SCM_CFIER */
158#define CFIER_ECFEI			(0x01)
159
160/* Bit definitions and macros for SCM_CFLOC */
161#define CFLOC_LOC			(0x80)
162
163/* Bit definitions and macros for SCM_CFATR */
164#define CFATR_WRITE			(0x80)
165#define CFATR_SZ32			(0x20)
166#define CFATR_SZ16			(0x10)
167#define CFATR_SZ08			(0x00)
168#define CFATR_CACHE			(0x08)
169#define CFATR_MODE			(0x02)
170#define CFATR_TYPE			(0x01)
171
172/*********************************************************************
173* Reset Controller Module (RCM)
174*********************************************************************/
175
176/* Bit definitions and macros for RCR */
177#define RCM_RCR_FRCRSTOUT		(0x40)
178#define RCM_RCR_SOFTRST			(0x80)
179
180/* Bit definitions and macros for RSR */
181#define RCM_RSR_LOL			(0x01)
182#define RCM_RSR_WDR_CORE		(0x02)
183#define RCM_RSR_EXT			(0x04)
184#define RCM_RSR_POR			(0x08)
185#define RCM_RSR_SOFT			(0x20)
186
187/*********************************************************************
188* Interrupt Controller (INTC)
189*********************************************************************/
190#define INTC0_EPORT			INTC_IPRL_INT1
191
192#define INT0_LO_RSVD0			(0)
193#define INT0_LO_EPORT1			(1)
194#define INT0_LO_EPORT2			(2)
195#define INT0_LO_EPORT3			(3)
196#define INT0_LO_EPORT4			(4)
197#define INT0_LO_EPORT5			(5)
198#define INT0_LO_EPORT6			(6)
199#define INT0_LO_EPORT7			(7)
200#define INT0_LO_EDMA_00			(8)
201#define INT0_LO_EDMA_01			(9)
202#define INT0_LO_EDMA_02			(10)
203#define INT0_LO_EDMA_03			(11)
204#define INT0_LO_EDMA_04			(12)
205#define INT0_LO_EDMA_05			(13)
206#define INT0_LO_EDMA_06			(14)
207#define INT0_LO_EDMA_07			(15)
208#define INT0_LO_EDMA_08			(16)
209#define INT0_LO_EDMA_09			(17)
210#define INT0_LO_EDMA_10			(18)
211#define INT0_LO_EDMA_11			(19)
212#define INT0_LO_EDMA_12			(20)
213#define INT0_LO_EDMA_13			(21)
214#define INT0_LO_EDMA_14			(22)
215#define INT0_LO_EDMA_15			(23)
216#define INT0_LO_EDMA_ERR		(24)
217#define INT0_LO_SCM			(25)
218#define INT0_LO_UART0			(26)
219#define INT0_LO_UART1			(27)
220#define INT0_LO_UART2			(28)
221#define INT0_LO_RSVD1			(29)
222#define INT0_LO_I2C			(30)
223#define INT0_LO_QSPI			(31)
224#define INT0_HI_DTMR0			(32)
225#define INT0_HI_DTMR1			(33)
226#define INT0_HI_DTMR2			(34)
227#define INT0_HI_DTMR3			(35)
228#define INT0_HI_FEC_TXF			(36)
229#define INT0_HI_FEC_TXB			(37)
230#define INT0_HI_FEC_UN			(38)
231#define INT0_HI_FEC_RL			(39)
232#define INT0_HI_FEC_RXF			(40)
233#define INT0_HI_FEC_RXB			(41)
234#define INT0_HI_FEC_MII			(42)
235#define INT0_HI_FEC_LC			(43)
236#define INT0_HI_FEC_HBERR		(44)
237#define INT0_HI_FEC_GRA			(45)
238#define INT0_HI_FEC_EBERR		(46)
239#define INT0_HI_FEC_BABT		(47)
240#define INT0_HI_FEC_BABR		(48)
241/* 49 - 61 Reserved */
242#define INT0_HI_SCM			(62)
243
244/*********************************************************************
245* Watchdog Timer Modules (WTM)
246*********************************************************************/
247/* Bit definitions and macros for WTM_WCR */
248#define WTM_WCR_WAIT			(0x0008)
249#define WTM_WCR_DOZE			(0x0004)
250#define WTM_WCR_HALTED			(0x0002)
251#define WTM_WCR_EN			(0x0001)
252
253/*********************************************************************
254* Chip Configuration Module (CCM)
255*********************************************************************/
256/* Bit definitions and macros for CCM_CCR */
257#define CCM_CCR_CSC(x)			(((x)&0x0003)<<8|0x0001)
258#define CCM_CCR_LIMP			(0x0041)
259#define CCM_CCR_LOAD			(0x0021)
260#define CCM_CCR_BOOTPS(x)		(((x)&0x0003)<<3|0x0001)
261#define CCM_CCR_OSC_MODE		(0x0005)
262#define CCM_CCR_PLL_MODE		(0x0003)
263#define CCM_CCR_RESERVED		(0x0001)
264
265/* Bit definitions and macros for CCM_RCON */
266#define CCM_RCON_CSC(x)			(((x)&0x0003)<<8|0x0001)
267#define CCM_RCON_LIMP			(0x0041)
268#define CCM_RCON_LOAD			(0x0021)
269#define CCM_RCON_BOOTPS(x)		(((x)&0x0003)<<3|0x0001)
270#define CCM_RCON_OSC_MODE		(0x0005)
271#define CCM_RCON_PLL_MODE		(0x0003)
272#define CCM_RCON_RESERVED		(0x0001)
273
274/* Bit definitions and macros for CCM_CIR */
275#define CCM_CIR_PIN(x)			(((x)&0x03FF)<<6)
276#define CCM_CIR_PRN(x)			((x)&0x003F)
277
278/* Bit definitions and macros for CCM_MISCCR */
279#define CCM_MISCCR_PLL_LOCK		(0x2000)
280#define CCM_MISCCR_LIMP			(0x1000)
281#define CCM_MISCCR_LCD_CHEN		(0x0100)
282#define CCM_MISCCR_SSI_PUE		(0x0080)
283#define CCM_MISCCR_SSI_PUS		(0x0040)
284#define CCM_MISCCR_TIM_DMA		(0x0020)
285#define CCM_MISCCR_SSI_SRC		(0x0010)
286#define CCM_MISCCR_USBDIV		(0x0002)
287#define CCM_MISCCR_USBSRC		(0x0001)
288
289/* Bit definitions and macros for CCM_CDR */
290#define CCM_CDR_LPDIV(x)		(((x)&0x000F)<<8)
291#define CCM_CDR_SSIDIV(x)		((x)&0x000F)
292
293/* Bit definitions and macros for CCM_UHCSR */
294#define CCM_UHCSR_PORTIND(x)		(((x)&0x0003)<<14)
295#define CCM_UHCSR_WKUP			(0x0004)
296#define CCM_UHCSR_UHMIE			(0x0002)
297#define CCM_UHCSR_XPDE			(0x0001)
298
299/* Bit definitions and macros for CCM_UOCSR */
300#define CCM_UOCSR_PORTIND(x)		(((x)&0x0003)<<14)
301#define CCM_UOCSR_DPPD			(0x2000)
302#define CCM_UOCSR_DMPD			(0x1000)
303#define CCM_UOCSR_DRV_VBUS		(0x0800)
304#define CCM_UOCSR_CRG_VBUS		(0x0400)
305#define CCM_UOCSR_DCR_VBUS		(0x0200)
306#define CCM_UOCSR_DPPU			(0x0100)
307#define CCM_UOCSR_AVLD			(0x0080)
308#define CCM_UOCSR_BVLD			(0x0040)
309#define CCM_UOCSR_VVLD			(0x0020)
310#define CCM_UOCSR_SEND			(0x0010)
311#define CCM_UOCSR_PWRFLT		(0x0008)
312#define CCM_UOCSR_WKUP			(0x0004)
313#define CCM_UOCSR_UOMIE			(0x0002)
314#define CCM_UOCSR_XPDE			(0x0001)
315
316/* not done yet */
317/*********************************************************************
318* General Purpose I/O (GPIO)
319*********************************************************************/
320/* Bit definitions and macros for GPIO_PODR_FECH_L */
321#define GPIO_PODR_FECH_L7		(0x80)
322#define GPIO_PODR_FECH_L6		(0x40)
323#define GPIO_PODR_FECH_L5		(0x20)
324#define GPIO_PODR_FECH_L4		(0x10)
325#define GPIO_PODR_FECH_L3		(0x08)
326#define GPIO_PODR_FECH_L2		(0x04)
327#define GPIO_PODR_FECH_L1		(0x02)
328#define GPIO_PODR_FECH_L0		(0x01)
329
330/* Bit definitions and macros for GPIO_PODR_SSI */
331#define GPIO_PODR_SSI_4			(0x10)
332#define GPIO_PODR_SSI_3			(0x08)
333#define GPIO_PODR_SSI_2			(0x04)
334#define GPIO_PODR_SSI_1			(0x02)
335#define GPIO_PODR_SSI_0			(0x01)
336
337/* Bit definitions and macros for GPIO_PODR_BUSCTL */
338#define GPIO_PODR_BUSCTL_3		(0x08)
339#define GPIO_PODR_BUSCTL_2		(0x04)
340#define GPIO_PODR_BUSCTL_1		(0x02)
341#define GPIO_PODR_BUSCTL_0		(0x01)
342
343/* Bit definitions and macros for GPIO_PODR_BE */
344#define GPIO_PODR_BE_3			(0x08)
345#define GPIO_PODR_BE_2			(0x04)
346#define GPIO_PODR_BE_1			(0x02)
347#define GPIO_PODR_BE_0			(0x01)
348
349/* Bit definitions and macros for GPIO_PODR_CS */
350#define GPIO_PODR_CS_5			(0x20)
351#define GPIO_PODR_CS_4			(0x10)
352#define GPIO_PODR_CS_3			(0x08)
353#define GPIO_PODR_CS_2			(0x04)
354#define GPIO_PODR_CS_1			(0x02)
355
356/* Bit definitions and macros for GPIO_PODR_PWM */
357#define GPIO_PODR_PWM_5			(0x20)
358#define GPIO_PODR_PWM_4			(0x10)
359#define GPIO_PODR_PWM_3			(0x08)
360#define GPIO_PODR_PWM_2			(0x04)
361
362/* Bit definitions and macros for GPIO_PODR_FECI2C */
363#define GPIO_PODR_FECI2C_3		(0x08)
364#define GPIO_PODR_FECI2C_2		(0x04)
365#define GPIO_PODR_FECI2C_1		(0x02)
366#define GPIO_PODR_FECI2C_0		(0x01)
367
368/* Bit definitions and macros for GPIO_PODR_UART */
369#define GPIO_PODR_UART_7		(0x80)
370#define GPIO_PODR_UART_6		(0x40)
371#define GPIO_PODR_UART_5		(0x20)
372#define GPIO_PODR_UART_4		(0x10)
373#define GPIO_PODR_UART_3		(0x08)
374#define GPIO_PODR_UART_2		(0x04)
375#define GPIO_PODR_UART_1		(0x02)
376#define GPIO_PODR_UART_0		(0x01)
377
378/* Bit definitions and macros for GPIO_PODR_QSPI */
379#define GPIO_PODR_QSPI_5		(0x20)
380#define GPIO_PODR_QSPI_4		(0x10)
381#define GPIO_PODR_QSPI_3		(0x08)
382#define GPIO_PODR_QSPI_2		(0x04)
383#define GPIO_PODR_QSPI_1		(0x02)
384#define GPIO_PODR_QSPI_0		(0x01)
385
386/* Bit definitions and macros for GPIO_PODR_TIMER */
387#define GPIO_PODR_TIMER_3		(0x08)
388#define GPIO_PODR_TIMER_2		(0x04)
389#define GPIO_PODR_TIMER_1		(0x02)
390#define GPIO_PODR_TIMER_0		(0x01)
391
392/* Bit definitions and macros for GPIO_PODR_LCDDATAH */
393#define GPIO_PODR_LCDDATAH_1		(0x02)
394#define GPIO_PODR_LCDDATAH_0		(0x01)
395
396/* Bit definitions and macros for GPIO_PODR_LCDDATAM */
397#define GPIO_PODR_LCDDATAM_7		(0x80)
398#define GPIO_PODR_LCDDATAM_6		(0x40)
399#define GPIO_PODR_LCDDATAM_5		(0x20)
400#define GPIO_PODR_LCDDATAM_4		(0x10)
401#define GPIO_PODR_LCDDATAM_3		(0x08)
402#define GPIO_PODR_LCDDATAM_2		(0x04)
403#define GPIO_PODR_LCDDATAM_1		(0x02)
404#define GPIO_PODR_LCDDATAM_0		(0x01)
405
406/* Bit definitions and macros for GPIO_PODR_LCDDATAL */
407#define GPIO_PODR_LCDDATAL_7		(0x80)
408#define GPIO_PODR_LCDDATAL_6		(0x40)
409#define GPIO_PODR_LCDDATAL_5		(0x20)
410#define GPIO_PODR_LCDDATAL_4		(0x10)
411#define GPIO_PODR_LCDDATAL_3		(0x08)
412#define GPIO_PODR_LCDDATAL_2		(0x04)
413#define GPIO_PODR_LCDDATAL_1		(0x02)
414#define GPIO_PODR_LCDDATAL_0		(0x01)
415
416/* Bit definitions and macros for GPIO_PODR_LCDCTLH */
417#define GPIO_PODR_LCDCTLH_0		(0x01)
418
419/* Bit definitions and macros for GPIO_PODR_LCDCTLL */
420#define GPIO_PODR_LCDCTLL_7		(0x80)
421#define GPIO_PODR_LCDCTLL_6		(0x40)
422#define GPIO_PODR_LCDCTLL_5		(0x20)
423#define GPIO_PODR_LCDCTLL_4		(0x10)
424#define GPIO_PODR_LCDCTLL_3		(0x08)
425#define GPIO_PODR_LCDCTLL_2		(0x04)
426#define GPIO_PODR_LCDCTLL_1		(0x02)
427#define GPIO_PODR_LCDCTLL_0		(0x01)
428
429/* Bit definitions and macros for GPIO_PDDR_FECH */
430#define GPIO_PDDR_FECH_L7		(0x80)
431#define GPIO_PDDR_FECH_L6		(0x40)
432#define GPIO_PDDR_FECH_L5		(0x20)
433#define GPIO_PDDR_FECH_L4		(0x10)
434#define GPIO_PDDR_FECH_L3		(0x08)
435#define GPIO_PDDR_FECH_L2		(0x04)
436#define GPIO_PDDR_FECH_L1		(0x02)
437#define GPIO_PDDR_FECH_L0		(0x01)
438
439/* Bit definitions and macros for GPIO_PDDR_SSI */
440#define GPIO_PDDR_SSI_4			(0x10)
441#define GPIO_PDDR_SSI_3			(0x08)
442#define GPIO_PDDR_SSI_2			(0x04)
443#define GPIO_PDDR_SSI_1			(0x02)
444#define GPIO_PDDR_SSI_0			(0x01)
445
446/* Bit definitions and macros for GPIO_PDDR_BUSCTL */
447#define GPIO_PDDR_BUSCTL_3		(0x08)
448#define GPIO_PDDR_BUSCTL_2		(0x04)
449#define GPIO_PDDR_BUSCTL_1		(0x02)
450#define GPIO_PDDR_BUSCTL_0		(0x01)
451
452/* Bit definitions and macros for GPIO_PDDR_BE */
453#define GPIO_PDDR_BE_3			(0x08)
454#define GPIO_PDDR_BE_2			(0x04)
455#define GPIO_PDDR_BE_1			(0x02)
456#define GPIO_PDDR_BE_0			(0x01)
457
458/* Bit definitions and macros for GPIO_PDDR_CS */
459#define GPIO_PDDR_CS_1			(0x02)
460#define GPIO_PDDR_CS_2			(0x04)
461#define GPIO_PDDR_CS_3			(0x08)
462#define GPIO_PDDR_CS_4			(0x10)
463#define GPIO_PDDR_CS_5			(0x20)
464
465/* Bit definitions and macros for GPIO_PDDR_PWM */
466#define GPIO_PDDR_PWM_2			(0x04)
467#define GPIO_PDDR_PWM_3			(0x08)
468#define GPIO_PDDR_PWM_4			(0x10)
469#define GPIO_PDDR_PWM_5			(0x20)
470
471/* Bit definitions and macros for GPIO_PDDR_FECI2C */
472#define GPIO_PDDR_FECI2C_0		(0x01)
473#define GPIO_PDDR_FECI2C_1		(0x02)
474#define GPIO_PDDR_FECI2C_2		(0x04)
475#define GPIO_PDDR_FECI2C_3		(0x08)
476
477/* Bit definitions and macros for GPIO_PDDR_UART */
478#define GPIO_PDDR_UART_0		(0x01)
479#define GPIO_PDDR_UART_1		(0x02)
480#define GPIO_PDDR_UART_2		(0x04)
481#define GPIO_PDDR_UART_3		(0x08)
482#define GPIO_PDDR_UART_4		(0x10)
483#define GPIO_PDDR_UART_5		(0x20)
484#define GPIO_PDDR_UART_6		(0x40)
485#define GPIO_PDDR_UART_7		(0x80)
486
487/* Bit definitions and macros for GPIO_PDDR_QSPI */
488#define GPIO_PDDR_QSPI_0		(0x01)
489#define GPIO_PDDR_QSPI_1		(0x02)
490#define GPIO_PDDR_QSPI_2		(0x04)
491#define GPIO_PDDR_QSPI_3		(0x08)
492#define GPIO_PDDR_QSPI_4		(0x10)
493#define GPIO_PDDR_QSPI_5		(0x20)
494
495/* Bit definitions and macros for GPIO_PDDR_TIMER */
496#define GPIO_PDDR_TIMER_0		(0x01)
497#define GPIO_PDDR_TIMER_1		(0x02)
498#define GPIO_PDDR_TIMER_2		(0x04)
499#define GPIO_PDDR_TIMER_3		(0x08)
500
501/* Bit definitions and macros for GPIO_PDDR_LCDDATAH */
502#define GPIO_PDDR_LCDDATAH_0		(0x01)
503#define GPIO_PDDR_LCDDATAH_1		(0x02)
504
505/* Bit definitions and macros for GPIO_PDDR_LCDDATAM */
506#define GPIO_PDDR_LCDDATAM_0		(0x01)
507#define GPIO_PDDR_LCDDATAM_1		(0x02)
508#define GPIO_PDDR_LCDDATAM_2		(0x04)
509#define GPIO_PDDR_LCDDATAM_3		(0x08)
510#define GPIO_PDDR_LCDDATAM_4		(0x10)
511#define GPIO_PDDR_LCDDATAM_5		(0x20)
512#define GPIO_PDDR_LCDDATAM_6		(0x40)
513#define GPIO_PDDR_LCDDATAM_7		(0x80)
514
515/* Bit definitions and macros for GPIO_PDDR_LCDDATAL */
516#define GPIO_PDDR_LCDDATAL_0		(0x01)
517#define GPIO_PDDR_LCDDATAL_1		(0x02)
518#define GPIO_PDDR_LCDDATAL_2		(0x04)
519#define GPIO_PDDR_LCDDATAL_3		(0x08)
520#define GPIO_PDDR_LCDDATAL_4		(0x10)
521#define GPIO_PDDR_LCDDATAL_5		(0x20)
522#define GPIO_PDDR_LCDDATAL_6		(0x40)
523#define GPIO_PDDR_LCDDATAL_7		(0x80)
524
525/* Bit definitions and macros for GPIO_PDDR_LCDCTLH */
526#define GPIO_PDDR_LCDCTLH_0		(0x01)
527
528/* Bit definitions and macros for GPIO_PDDR_LCDCTLL */
529#define GPIO_PDDR_LCDCTLL_0		(0x01)
530#define GPIO_PDDR_LCDCTLL_1		(0x02)
531#define GPIO_PDDR_LCDCTLL_2		(0x04)
532#define GPIO_PDDR_LCDCTLL_3		(0x08)
533#define GPIO_PDDR_LCDCTLL_4		(0x10)
534#define GPIO_PDDR_LCDCTLL_5		(0x20)
535#define GPIO_PDDR_LCDCTLL_6		(0x40)
536#define GPIO_PDDR_LCDCTLL_7		(0x80)
537
538/* Bit definitions and macros for GPIO_PPDSDR_FECH */
539#define GPIO_PPDSDR_FECH_L0		(0x01)
540#define GPIO_PPDSDR_FECH_L1		(0x02)
541#define GPIO_PPDSDR_FECH_L2		(0x04)
542#define GPIO_PPDSDR_FECH_L3		(0x08)
543#define GPIO_PPDSDR_FECH_L4		(0x10)
544#define GPIO_PPDSDR_FECH_L5		(0x20)
545#define GPIO_PPDSDR_FECH_L6		(0x40)
546#define GPIO_PPDSDR_FECH_L7		(0x80)
547
548/* Bit definitions and macros for GPIO_PPDSDR_SSI */
549#define GPIO_PPDSDR_SSI_0		(0x01)
550#define GPIO_PPDSDR_SSI_1		(0x02)
551#define GPIO_PPDSDR_SSI_2		(0x04)
552#define GPIO_PPDSDR_SSI_3		(0x08)
553#define GPIO_PPDSDR_SSI_4		(0x10)
554
555/* Bit definitions and macros for GPIO_PPDSDR_BUSCTL */
556#define GPIO_PPDSDR_BUSCTL_0		(0x01)
557#define GPIO_PPDSDR_BUSCTL_1		(0x02)
558#define GPIO_PPDSDR_BUSCTL_2		(0x04)
559#define GPIO_PPDSDR_BUSCTL_3		(0x08)
560
561/* Bit definitions and macros for GPIO_PPDSDR_BE */
562#define GPIO_PPDSDR_BE_0		(0x01)
563#define GPIO_PPDSDR_BE_1		(0x02)
564#define GPIO_PPDSDR_BE_2		(0x04)
565#define GPIO_PPDSDR_BE_3		(0x08)
566
567/* Bit definitions and macros for GPIO_PPDSDR_CS */
568#define GPIO_PPDSDR_CS_1		(0x02)
569#define GPIO_PPDSDR_CS_2		(0x04)
570#define GPIO_PPDSDR_CS_3		(0x08)
571#define GPIO_PPDSDR_CS_4		(0x10)
572#define GPIO_PPDSDR_CS_5		(0x20)
573
574/* Bit definitions and macros for GPIO_PPDSDR_PWM */
575#define GPIO_PPDSDR_PWM_2		(0x04)
576#define GPIO_PPDSDR_PWM_3		(0x08)
577#define GPIO_PPDSDR_PWM_4		(0x10)
578#define GPIO_PPDSDR_PWM_5		(0x20)
579
580/* Bit definitions and macros for GPIO_PPDSDR_FECI2C */
581#define GPIO_PPDSDR_FECI2C_0		(0x01)
582#define GPIO_PPDSDR_FECI2C_1		(0x02)
583#define GPIO_PPDSDR_FECI2C_2		(0x04)
584#define GPIO_PPDSDR_FECI2C_3		(0x08)
585
586/* Bit definitions and macros for GPIO_PPDSDR_UART */
587#define GPIO_PPDSDR_UART_0		(0x01)
588#define GPIO_PPDSDR_UART_1		(0x02)
589#define GPIO_PPDSDR_UART_2		(0x04)
590#define GPIO_PPDSDR_UART_3		(0x08)
591#define GPIO_PPDSDR_UART_4		(0x10)
592#define GPIO_PPDSDR_UART_5		(0x20)
593#define GPIO_PPDSDR_UART_6		(0x40)
594#define GPIO_PPDSDR_UART_7		(0x80)
595
596/* Bit definitions and macros for GPIO_PPDSDR_QSPI */
597#define GPIO_PPDSDR_QSPI_0		(0x01)
598#define GPIO_PPDSDR_QSPI_1		(0x02)
599#define GPIO_PPDSDR_QSPI_2		(0x04)
600#define GPIO_PPDSDR_QSPI_3		(0x08)
601#define GPIO_PPDSDR_QSPI_4		(0x10)
602#define GPIO_PPDSDR_QSPI_5		(0x20)
603
604/* Bit definitions and macros for GPIO_PPDSDR_TIMER */
605#define GPIO_PPDSDR_TIMER_0		(0x01)
606#define GPIO_PPDSDR_TIMER_1		(0x02)
607#define GPIO_PPDSDR_TIMER_2		(0x04)
608#define GPIO_PPDSDR_TIMER_3		(0x08)
609
610/* Bit definitions and macros for GPIO_PPDSDR_LCDDATAH */
611#define GPIO_PPDSDR_LCDDATAH_0		(0x01)
612#define GPIO_PPDSDR_LCDDATAH_1		(0x02)
613
614/* Bit definitions and macros for GPIO_PPDSDR_LCDDATAM */
615#define GPIO_PPDSDR_LCDDATAM_0		(0x01)
616#define GPIO_PPDSDR_LCDDATAM_1		(0x02)
617#define GPIO_PPDSDR_LCDDATAM_2		(0x04)
618#define GPIO_PPDSDR_LCDDATAM_3		(0x08)
619#define GPIO_PPDSDR_LCDDATAM_4		(0x10)
620#define GPIO_PPDSDR_LCDDATAM_5		(0x20)
621#define GPIO_PPDSDR_LCDDATAM_6		(0x40)
622#define GPIO_PPDSDR_LCDDATAM_7		(0x80)
623
624/* Bit definitions and macros for GPIO_PPDSDR_LCDDATAL */
625#define GPIO_PPDSDR_LCDDATAL_0		(0x01)
626#define GPIO_PPDSDR_LCDDATAL_1		(0x02)
627#define GPIO_PPDSDR_LCDDATAL_2		(0x04)
628#define GPIO_PPDSDR_LCDDATAL_3		(0x08)
629#define GPIO_PPDSDR_LCDDATAL_4		(0x10)
630#define GPIO_PPDSDR_LCDDATAL_5		(0x20)
631#define GPIO_PPDSDR_LCDDATAL_6		(0x40)
632#define GPIO_PPDSDR_LCDDATAL_7		(0x80)
633
634/* Bit definitions and macros for GPIO_PPDSDR_LCDCTLH */
635#define GPIO_PPDSDR_LCDCTLH_0		(0x01)
636
637/* Bit definitions and macros for GPIO_PPDSDR_LCDCTLL */
638#define GPIO_PPDSDR_LCDCTLL_0		(0x01)
639#define GPIO_PPDSDR_LCDCTLL_1		(0x02)
640#define GPIO_PPDSDR_LCDCTLL_2		(0x04)
641#define GPIO_PPDSDR_LCDCTLL_3		(0x08)
642#define GPIO_PPDSDR_LCDCTLL_4		(0x10)
643#define GPIO_PPDSDR_LCDCTLL_5		(0x20)
644#define GPIO_PPDSDR_LCDCTLL_6		(0x40)
645#define GPIO_PPDSDR_LCDCTLL_7		(0x80)
646
647/* Bit definitions and macros for GPIO_PCLRR_FECH */
648#define GPIO_PCLRR_FECH_L0		(0x01)
649#define GPIO_PCLRR_FECH_L1		(0x02)
650#define GPIO_PCLRR_FECH_L2		(0x04)
651#define GPIO_PCLRR_FECH_L3		(0x08)
652#define GPIO_PCLRR_FECH_L4		(0x10)
653#define GPIO_PCLRR_FECH_L5		(0x20)
654#define GPIO_PCLRR_FECH_L6		(0x40)
655#define GPIO_PCLRR_FECH_L7		(0x80)
656
657/* Bit definitions and macros for GPIO_PCLRR_SSI */
658#define GPIO_PCLRR_SSI_0		(0x01)
659#define GPIO_PCLRR_SSI_1		(0x02)
660#define GPIO_PCLRR_SSI_2		(0x04)
661#define GPIO_PCLRR_SSI_3		(0x08)
662#define GPIO_PCLRR_SSI_4		(0x10)
663
664/* Bit definitions and macros for GPIO_PCLRR_BUSCTL */
665#define GPIO_PCLRR_BUSCTL_L0		(0x01)
666#define GPIO_PCLRR_BUSCTL_L1		(0x02)
667#define GPIO_PCLRR_BUSCTL_L2		(0x04)
668#define GPIO_PCLRR_BUSCTL_L3		(0x08)
669
670/* Bit definitions and macros for GPIO_PCLRR_BE */
671#define GPIO_PCLRR_BE_0			(0x01)
672#define GPIO_PCLRR_BE_1			(0x02)
673#define GPIO_PCLRR_BE_2			(0x04)
674#define GPIO_PCLRR_BE_3			(0x08)
675
676/* Bit definitions and macros for GPIO_PCLRR_CS */
677#define GPIO_PCLRR_CS_1			(0x02)
678#define GPIO_PCLRR_CS_2			(0x04)
679#define GPIO_PCLRR_CS_3			(0x08)
680#define GPIO_PCLRR_CS_4			(0x10)
681#define GPIO_PCLRR_CS_5			(0x20)
682
683/* Bit definitions and macros for GPIO_PCLRR_PWM */
684#define GPIO_PCLRR_PWM_2		(0x04)
685#define GPIO_PCLRR_PWM_3		(0x08)
686#define GPIO_PCLRR_PWM_4		(0x10)
687#define GPIO_PCLRR_PWM_5		(0x20)
688
689/* Bit definitions and macros for GPIO_PCLRR_FECI2C */
690#define GPIO_PCLRR_FECI2C_0		(0x01)
691#define GPIO_PCLRR_FECI2C_1		(0x02)
692#define GPIO_PCLRR_FECI2C_2		(0x04)
693#define GPIO_PCLRR_FECI2C_3		(0x08)
694
695/* Bit definitions and macros for GPIO_PCLRR_UART */
696#define GPIO_PCLRR_UART0		(0x01)
697#define GPIO_PCLRR_UART1		(0x02)
698#define GPIO_PCLRR_UART2		(0x04)
699#define GPIO_PCLRR_UART3		(0x08)
700#define GPIO_PCLRR_UART4		(0x10)
701#define GPIO_PCLRR_UART5		(0x20)
702#define GPIO_PCLRR_UART6		(0x40)
703#define GPIO_PCLRR_UART7		(0x80)
704
705/* Bit definitions and macros for GPIO_PCLRR_QSPI */
706#define GPIO_PCLRR_QSPI0		(0x01)
707#define GPIO_PCLRR_QSPI1		(0x02)
708#define GPIO_PCLRR_QSPI2		(0x04)
709#define GPIO_PCLRR_QSPI3		(0x08)
710#define GPIO_PCLRR_QSPI4		(0x10)
711#define GPIO_PCLRR_QSPI5		(0x20)
712
713/* Bit definitions and macros for GPIO_PCLRR_TIMER */
714#define GPIO_PCLRR_TIMER0		(0x01)
715#define GPIO_PCLRR_TIMER1		(0x02)
716#define GPIO_PCLRR_TIMER2		(0x04)
717#define GPIO_PCLRR_TIMER3		(0x08)
718
719/* Bit definitions and macros for GPIO_PCLRR_LCDDATAH */
720#define GPIO_PCLRR_LCDDATAH0		(0x01)
721#define GPIO_PCLRR_LCDDATAH1		(0x02)
722
723/* Bit definitions and macros for GPIO_PCLRR_LCDDATAM */
724#define GPIO_PCLRR_LCDDATAM0		(0x01)
725#define GPIO_PCLRR_LCDDATAM1		(0x02)
726#define GPIO_PCLRR_LCDDATAM2		(0x04)
727#define GPIO_PCLRR_LCDDATAM3		(0x08)
728#define GPIO_PCLRR_LCDDATAM4		(0x10)
729#define GPIO_PCLRR_LCDDATAM5		(0x20)
730#define GPIO_PCLRR_LCDDATAM6		(0x40)
731#define GPIO_PCLRR_LCDDATAM7		(0x80)
732
733/* Bit definitions and macros for GPIO_PCLRR_LCDDATAL */
734#define GPIO_PCLRR_LCDDATAL0		(0x01)
735#define GPIO_PCLRR_LCDDATAL1		(0x02)
736#define GPIO_PCLRR_LCDDATAL2		(0x04)
737#define GPIO_PCLRR_LCDDATAL3		(0x08)
738#define GPIO_PCLRR_LCDDATAL4		(0x10)
739#define GPIO_PCLRR_LCDDATAL5		(0x20)
740#define GPIO_PCLRR_LCDDATAL6		(0x40)
741#define GPIO_PCLRR_LCDDATAL7		(0x80)
742
743/* Bit definitions and macros for GPIO_PCLRR_LCDCTLH */
744#define GPIO_PCLRR_LCDCTLH_PCLRR_LCDCTLH0		(0x01)
745
746/* Bit definitions and macros for GPIO_PCLRR_LCDCTLL */
747#define GPIO_PCLRR_LCDCTLL0		(0x01)
748#define GPIO_PCLRR_LCDCTLL1		(0x02)
749#define GPIO_PCLRR_LCDCTLL2		(0x04)
750#define GPIO_PCLRR_LCDCTLL3		(0x08)
751#define GPIO_PCLRR_LCDCTLL4		(0x10)
752#define GPIO_PCLRR_LCDCTLL5		(0x20)
753#define GPIO_PCLRR_LCDCTLL6		(0x40)
754#define GPIO_PCLRR_LCDCTLL7		(0x80)
755
756/* Bit definitions and macros for GPIO_PAR_FEC */
757#ifdef CONFIG_M5329
758#define GPIO_PAR_FEC_MII(x)		(((x)&0x03)<<0)
759#define GPIO_PAR_FEC_7W(x)		(((x)&0x03)<<2)
760#define GPIO_PAR_FEC_7W_GPIO		(0x00)
761#define GPIO_PAR_FEC_7W_URTS1		(0x04)
762#define GPIO_PAR_FEC_7W_FEC		(0x0C)
763#define GPIO_PAR_FEC_MII_GPIO		(0x00)
764#define GPIO_PAR_FEC_MII_UART		(0x01)
765#define GPIO_PAR_FEC_MII_FEC		(0x03)
766#else
767#define GPIO_PAR_FEC_7W_FEC		(0x08)
768#define GPIO_PAR_FEC_MII_FEC		(0x02)
769#endif
770
771/* Bit definitions and macros for GPIO_PAR_PWM */
772#define GPIO_PAR_PWM1(x)		(((x)&0x03)<<0)
773#define GPIO_PAR_PWM3(x)		(((x)&0x03)<<2)
774#define GPIO_PAR_PWM5			(0x10)
775#define GPIO_PAR_PWM7			(0x20)
776
777/* Bit definitions and macros for GPIO_PAR_BUSCTL */
778#define GPIO_PAR_BUSCTL_TS(x)		(((x)&0x03)<<3)
779#define GPIO_PAR_BUSCTL_RWB		(0x20)
780#define GPIO_PAR_BUSCTL_TA		(0x40)
781#define GPIO_PAR_BUSCTL_OE		(0x80)
782#define GPIO_PAR_BUSCTL_OE_GPIO		(0x00)
783#define GPIO_PAR_BUSCTL_OE_OE		(0x80)
784#define GPIO_PAR_BUSCTL_TA_GPIO		(0x00)
785#define GPIO_PAR_BUSCTL_TA_TA		(0x40)
786#define GPIO_PAR_BUSCTL_RWB_GPIO	(0x00)
787#define GPIO_PAR_BUSCTL_RWB_RWB		(0x20)
788#define GPIO_PAR_BUSCTL_TS_GPIO		(0x00)
789#define GPIO_PAR_BUSCTL_TS_DACK0	(0x10)
790#define GPIO_PAR_BUSCTL_TS_TS		(0x18)
791
792/* Bit definitions and macros for GPIO_PAR_FECI2C */
793#define GPIO_PAR_FECI2C_SDA(x)		(((x)&0x03)<<0)
794#define GPIO_PAR_FECI2C_SCL(x)		(((x)&0x03)<<2)
795#define GPIO_PAR_FECI2C_MDIO(x)		(((x)&0x03)<<4)
796#define GPIO_PAR_FECI2C_MDC(x)		(((x)&0x03)<<6)
797#define GPIO_PAR_FECI2C_MDC_GPIO	(0x00)
798#define GPIO_PAR_FECI2C_MDC_UTXD2	(0x40)
799#define GPIO_PAR_FECI2C_MDC_SCL		(0x80)
800#define GPIO_PAR_FECI2C_MDC_EMDC	(0xC0)
801#define GPIO_PAR_FECI2C_MDIO_GPIO	(0x00)
802#define GPIO_PAR_FECI2C_MDIO_URXD2	(0x10)
803#define GPIO_PAR_FECI2C_MDIO_SDA	(0x20)
804#define GPIO_PAR_FECI2C_MDIO_EMDIO	(0x30)
805#define GPIO_PAR_FECI2C_SCL_GPIO	(0x00)
806#define GPIO_PAR_FECI2C_SCL_UTXD2	(0x04)
807#define GPIO_PAR_FECI2C_SCL_SCL		(0x0C)
808#define GPIO_PAR_FECI2C_SDA_GPIO	(0x00)
809#define GPIO_PAR_FECI2C_SDA_URXD2	(0x02)
810#define GPIO_PAR_FECI2C_SDA_SDA		(0x03)
811
812/* Bit definitions and macros for GPIO_PAR_BE */
813#define GPIO_PAR_BE0			(0x01)
814#define GPIO_PAR_BE1			(0x02)
815#define GPIO_PAR_BE2			(0x04)
816#define GPIO_PAR_BE3			(0x08)
817
818/* Bit definitions and macros for GPIO_PAR_CS */
819#define GPIO_PAR_CS1			(0x02)
820#define GPIO_PAR_CS2			(0x04)
821#define GPIO_PAR_CS3			(0x08)
822#define GPIO_PAR_CS4			(0x10)
823#define GPIO_PAR_CS5			(0x20)
824#define GPIO_PAR_CS1_GPIO		(0x00)
825#define GPIO_PAR_CS1_SDCS1		(0x01)
826#define GPIO_PAR_CS1_CS1		(0x03)
827
828/* Bit definitions and macros for GPIO_PAR_SSI */
829#define GPIO_PAR_SSI_MCLK		(0x0080)
830#define GPIO_PAR_SSI_TXD(x)		(((x)&0x0003)<<8)
831#define GPIO_PAR_SSI_RXD(x)		(((x)&0x0003)<<10)
832#define GPIO_PAR_SSI_FS(x)		(((x)&0x0003)<<12)
833#define GPIO_PAR_SSI_BCLK(x)		(((x)&0x0003)<<14)
834
835/* Bit definitions and macros for GPIO_PAR_UART */
836#define GPIO_PAR_UART_TXD0		(0x0001)
837#define GPIO_PAR_UART_RXD0		(0x0002)
838#define GPIO_PAR_UART_RTS0		(0x0004)
839#define GPIO_PAR_UART_CTS0		(0x0008)
840#define GPIO_PAR_UART_TXD1(x)		(((x)&0x0003)<<4)
841#define GPIO_PAR_UART_RXD1(x)		(((x)&0x0003)<<6)
842#define GPIO_PAR_UART_RTS1(x)		(((x)&0x0003)<<8)
843#define GPIO_PAR_UART_CTS1(x)		(((x)&0x0003)<<10)
844#define GPIO_PAR_UART_CTS1_GPIO		(0x0000)
845#define GPIO_PAR_UART_CTS1_SSI_BCLK	(0x0800)
846#define GPIO_PAR_UART_CTS1_ULPI_D7	(0x0400)
847#define GPIO_PAR_UART_CTS1_UCTS1	(0x0C00)
848#define GPIO_PAR_UART_RTS1_GPIO		(0x0000)
849#define GPIO_PAR_UART_RTS1_SSI_FS	(0x0200)
850#define GPIO_PAR_UART_RTS1_ULPI_D6	(0x0100)
851#define GPIO_PAR_UART_RTS1_URTS1	(0x0300)
852#define GPIO_PAR_UART_RXD1_GPIO		(0x0000)
853#define GPIO_PAR_UART_RXD1_SSI_RXD	(0x0080)
854#define GPIO_PAR_UART_RXD1_ULPI_D5	(0x0040)
855#define GPIO_PAR_UART_RXD1_URXD1	(0x00C0)
856#define GPIO_PAR_UART_TXD1_GPIO		(0x0000)
857#define GPIO_PAR_UART_TXD1_SSI_TXD	(0x0020)
858#define GPIO_PAR_UART_TXD1_ULPI_D4	(0x0010)
859#define GPIO_PAR_UART_TXD1_UTXD1	(0x0030)
860
861/* Bit definitions and macros for GPIO_PAR_QSPI */
862#define GPIO_PAR_QSPI_SCK(x)		(((x)&0x0003)<<4)
863#define GPIO_PAR_QSPI_DOUT(x)		(((x)&0x0003)<<6)
864#define GPIO_PAR_QSPI_DIN(x)		(((x)&0x0003)<<8)
865#define GPIO_PAR_QSPI_PCS0(x)		(((x)&0x0003)<<10)
866#define GPIO_PAR_QSPI_PCS1(x)		(((x)&0x0003)<<12)
867#define GPIO_PAR_QSPI_PCS2(x)		(((x)&0x0003)<<14)
868
869/* Bit definitions and macros for GPIO_PAR_TIMER */
870#define GPIO_PAR_TIN0(x)		(((x)&0x03)<<0)
871#define GPIO_PAR_TIN1(x)		(((x)&0x03)<<2)
872#define GPIO_PAR_TIN2(x)		(((x)&0x03)<<4)
873#define GPIO_PAR_TIN3(x)		(((x)&0x03)<<6)
874#define GPIO_PAR_TIN3_GPIO		(0x00)
875#define GPIO_PAR_TIN3_TOUT3		(0x80)
876#define GPIO_PAR_TIN3_URXD2		(0x40)
877#define GPIO_PAR_TIN3_TIN3		(0xC0)
878#define GPIO_PAR_TIN2_GPIO		(0x00)
879#define GPIO_PAR_TIN2_TOUT2		(0x20)
880#define GPIO_PAR_TIN2_UTXD2		(0x10)
881#define GPIO_PAR_TIN2_TIN2		(0x30)
882#define GPIO_PAR_TIN1_GPIO		(0x00)
883#define GPIO_PAR_TIN1_TOUT1		(0x08)
884#define GPIO_PAR_TIN1_DACK1		(0x04)
885#define GPIO_PAR_TIN1_TIN1		(0x0C)
886#define GPIO_PAR_TIN0_GPIO		(0x00)
887#define GPIO_PAR_TIN0_TOUT0		(0x02)
888#define GPIO_PAR_TIN0_DREQ0		(0x01)
889#define GPIO_PAR_TIN0_TIN0		(0x03)
890
891/* Bit definitions and macros for GPIO_PAR_LCDDATA */
892#define GPIO_PAR_LCDDATA_LD7_0(x)	((x)&0x03)
893#define GPIO_PAR_LCDDATA_LD15_8(x)	(((x)&0x03)<<2)
894#define GPIO_PAR_LCDDATA_LD16(x)	(((x)&0x03)<<4)
895#define GPIO_PAR_LCDDATA_LD17(x)	(((x)&0x03)<<6)
896
897/* Bit definitions and macros for GPIO_PAR_LCDCTL */
898#define GPIO_PAR_LCDCTL_CLS		(0x0001)
899#define GPIO_PAR_LCDCTL_PS		(0x0002)
900#define GPIO_PAR_LCDCTL_REV		(0x0004)
901#define GPIO_PAR_LCDCTL_SPL_SPR		(0x0008)
902#define GPIO_PAR_LCDCTL_CONTRAST	(0x0010)
903#define GPIO_PAR_LCDCTL_LSCLK		(0x0020)
904#define GPIO_PAR_LCDCTL_LP_HSYNC	(0x0040)
905#define GPIO_PAR_LCDCTL_FLM_VSYNC	(0x0080)
906#define GPIO_PAR_LCDCTL_ACD_OE		(0x0100)
907
908/* Bit definitions and macros for GPIO_PAR_IRQ */
909#define GPIO_PAR_IRQ1(x)		(((x)&0x0003)<<4)
910#define GPIO_PAR_IRQ2(x)		(((x)&0x0003)<<6)
911#define GPIO_PAR_IRQ4(x)		(((x)&0x0003)<<8)
912#define GPIO_PAR_IRQ5(x)		(((x)&0x0003)<<10)
913#define GPIO_PAR_IRQ6(x)		(((x)&0x0003)<<12)
914
915/* Bit definitions and macros for GPIO_MSCR_FLEXBUS */
916#define GPIO_MSCR_FLEXBUS_ADDRCTL(x)	((x)&0x03)
917#define GPIO_MSCR_FLEXBUS_DLOWER(x)	(((x)&0x03)<<2)
918#define GPIO_MSCR_FLEXBUS_DUPPER(x)	(((x)&0x03)<<4)
919
920/* Bit definitions and macros for GPIO_MSCR_SDRAM */
921#define GPIO_MSCR_SDRAM_SDRAM(x)	((x)&0x03)
922#define GPIO_MSCR_SDRAM_SDCLK(x)	(((x)&0x03)<<2)
923#define GPIO_MSCR_SDRAM_SDCLKB(x)	(((x)&0x03)<<4)
924
925/* Bit definitions and macros for GPIO_DSCR_I2C */
926#define GPIO_DSCR_I2C_DSE(x)		((x)&0x03)
927
928/* Bit definitions and macros for GPIO_DSCR_PWM */
929#define GPIO_DSCR_PWM_DSE(x)		((x)&0x03)
930
931/* Bit definitions and macros for GPIO_DSCR_FEC */
932#define GPIO_DSCR_FEC_DSE(x)		((x)&0x03)
933
934/* Bit definitions and macros for GPIO_DSCR_UART */
935#define GPIO_DSCR_UART0_DSE(x)		((x)&0x03)
936#define GPIO_DSCR_UART1_DSE(x)		(((x)&0x03)<<2)
937
938/* Bit definitions and macros for GPIO_DSCR_QSPI */
939#define GPIO_DSCR_QSPI_DSE(x)		((x)&0x03)
940
941/* Bit definitions and macros for GPIO_DSCR_TIMER */
942#define GPIO_DSCR_TIMER_DSE(x)		((x)&0x03)
943
944/* Bit definitions and macros for GPIO_DSCR_SSI */
945#define GPIO_DSCR_SSI_DSE(x)		((x)&0x03)
946
947/* Bit definitions and macros for GPIO_DSCR_LCD */
948#define GPIO_DSCR_LCD_DSE(x)		((x)&0x03)
949
950/* Bit definitions and macros for GPIO_DSCR_DEBUG */
951#define GPIO_DSCR_DEBUG_DSE(x)		((x)&0x03)
952
953/* Bit definitions and macros for GPIO_DSCR_CLKRST */
954#define GPIO_DSCR_CLKRST_DSE(x)		((x)&0x03)
955
956/* Bit definitions and macros for GPIO_DSCR_IRQ */
957#define GPIO_DSCR_IRQ_DSE(x)		((x)&0x03)
958
959/*********************************************************************
960* SDRAM Controller (SDRAMC)
961*********************************************************************/
962/* Bit definitions and macros for SDRAMC_SDMR */
963#define SDRAMC_SDMR_BNKAD_LEMR		(0x40000000)
964#define SDRAMC_SDMR_BNKAD_LMR		(0x00000000)
965#define SDRAMC_SDMR_AD(x)		(((x)&0x00000FFF)<<18)
966#define SDRAMC_SDMR_CMD			(0x00010000)
967
968/* Bit definitions and macros for SDRAMC_SDCR */
969#define SDRAMC_SDCR_MODE_EN		(0x80000000)
970#define SDRAMC_SDCR_CKE			(0x40000000)
971#define SDRAMC_SDCR_DDR			(0x20000000)
972#define SDRAMC_SDCR_REF			(0x10000000)
973#define SDRAMC_SDCR_MUX(x)		(((x)&0x00000003)<<24)
974#define SDRAMC_SDCR_OE_RULE		(0x00400000)
975#define SDRAMC_SDCR_RCNT(x)		(((x)&0x0000003F)<<16)
976#define SDRAMC_SDCR_PS_32		(0x00000000)
977#define SDRAMC_SDCR_PS_16		(0x00002000)
978#define SDRAMC_SDCR_DQS_OE(x)		(((x)&0x0000000F)<<8)
979#define SDRAMC_SDCR_IREF		(0x00000004)
980#define SDRAMC_SDCR_IPALL		(0x00000002)
981
982/* Bit definitions and macros for SDRAMC_SDCFG1 */
983#define SDRAMC_SDCFG1_SRD2RW(x)		(((x)&0x0000000F)<<28)
984#define SDRAMC_SDCFG1_SWT2RD(x)		(((x)&0x00000007)<<24)
985#define SDRAMC_SDCFG1_RDLAT(x)		(((x)&0x0000000F)<<20)
986#define SDRAMC_SDCFG1_ACT2RW(x)		(((x)&0x00000007)<<16)
987#define SDRAMC_SDCFG1_PRE2ACT(x)	(((x)&0x00000007)<<12)
988#define SDRAMC_SDCFG1_REF2ACT(x)	(((x)&0x0000000F)<<8)
989#define SDRAMC_SDCFG1_WTLAT(x)		(((x)&0x00000007)<<4)
990
991/* Bit definitions and macros for SDRAMC_SDCFG2 */
992#define SDRAMC_SDCFG2_BRD2PRE(x)	(((x)&0x0000000F)<<28)
993#define SDRAMC_SDCFG2_BWT2RW(x)		(((x)&0x0000000F)<<24)
994#define SDRAMC_SDCFG2_BRD2WT(x)		(((x)&0x0000000F)<<20)
995#define SDRAMC_SDCFG2_BL(x)		(((x)&0x0000000F)<<16)
996
997/* Bit definitions and macros for SDRAMC_SDDS */
998#define SDRAMC_SDDS_SB_E(x)		(((x)&0x00000003)<<8)
999#define SDRAMC_SDDS_SB_C(x)		(((x)&0x00000003)<<6)
1000#define SDRAMC_SDDS_SB_A(x)		(((x)&0x00000003)<<4)
1001#define SDRAMC_SDDS_SB_S(x)		(((x)&0x00000003)<<2)
1002#define SDRAMC_SDDS_SB_D(x)		((x)&0x00000003)
1003
1004/* Bit definitions and macros for SDRAMC_SDCS */
1005#define SDRAMC_SDCS_BASE(x)		(((x)&0x00000FFF)<<20)
1006#define SDRAMC_SDCS_CSSZ(x)		((x)&0x0000001F)
1007#define SDRAMC_SDCS_CSSZ_4GBYTE		(0x0000001F)
1008#define SDRAMC_SDCS_CSSZ_2GBYTE		(0x0000001E)
1009#define SDRAMC_SDCS_CSSZ_1GBYTE		(0x0000001D)
1010#define SDRAMC_SDCS_CSSZ_512MBYTE	(0x0000001C)
1011#define SDRAMC_SDCS_CSSZ_256MBYTE	(0x0000001B)
1012#define SDRAMC_SDCS_CSSZ_128MBYTE	(0x0000001A)
1013#define SDRAMC_SDCS_CSSZ_64MBYTE	(0x00000019)
1014#define SDRAMC_SDCS_CSSZ_32MBYTE	(0x00000018)
1015#define SDRAMC_SDCS_CSSZ_16MBYTE	(0x00000017)
1016#define SDRAMC_SDCS_CSSZ_8MBYTE		(0x00000016)
1017#define SDRAMC_SDCS_CSSZ_4MBYTE		(0x00000015)
1018#define SDRAMC_SDCS_CSSZ_2MBYTE		(0x00000014)
1019#define SDRAMC_SDCS_CSSZ_1MBYTE		(0x00000013)
1020#define SDRAMC_SDCS_CSSZ_DIABLE		(0x00000000)
1021
1022/*********************************************************************
1023* Phase Locked Loop (PLL)
1024*********************************************************************/
1025/* Bit definitions and macros for PLL_PODR */
1026#define PLL_PODR_CPUDIV(x)		(((x)&0x0F)<<4)
1027#define PLL_PODR_BUSDIV(x)		((x)&0x0F)
1028
1029/* Bit definitions and macros for PLL_PLLCR */
1030#define PLL_PLLCR_DITHEN		(0x80)
1031#define PLL_PLLCR_DITHDEV(x)		((x)&0x07)
1032
1033#endif				/* mcf5329_h */
1034