blob: 93b840e8fa603d32d5b9e6fcfbbb33e7fa0e0b37 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _IMX_REGS_H
2#define _IMX_REGS_H
3/* ------------------------------------------------------------------------
4 * Motorola IMX system registers
5 * ------------------------------------------------------------------------
6 *
7 */
8
9/*
10 * Register BASEs, based on OFFSETs
11 *
12 */
13#define IMX_AIPI1_BASE (0x00000 + IMX_IO_BASE)
14#define IMX_WDT_BASE (0x01000 + IMX_IO_BASE)
15#define IMX_TIM1_BASE (0x02000 + IMX_IO_BASE)
16#define IMX_TIM2_BASE (0x03000 + IMX_IO_BASE)
17#define IMX_RTC_BASE (0x04000 + IMX_IO_BASE)
18#define IMX_LCDC_BASE (0x05000 + IMX_IO_BASE)
19#define IMX_UART1_BASE (0x06000 + IMX_IO_BASE)
20#define IMX_UART2_BASE (0x07000 + IMX_IO_BASE)
21#define IMX_PWM_BASE (0x08000 + IMX_IO_BASE)
22#define IMX_DMAC_BASE (0x09000 + IMX_IO_BASE)
23#define IMX_AIPI2_BASE (0x10000 + IMX_IO_BASE)
24#define IMX_SIM_BASE (0x11000 + IMX_IO_BASE)
25#define IMX_USBD_BASE (0x12000 + IMX_IO_BASE)
26#define IMX_SPI1_BASE (0x13000 + IMX_IO_BASE)
27#define IMX_MMC_BASE (0x14000 + IMX_IO_BASE)
28#define IMX_ASP_BASE (0x15000 + IMX_IO_BASE)
29#define IMX_BTA_BASE (0x16000 + IMX_IO_BASE)
30#define IMX_I2C_BASE (0x17000 + IMX_IO_BASE)
31#define IMX_SSI_BASE (0x18000 + IMX_IO_BASE)
32#define IMX_SPI2_BASE (0x19000 + IMX_IO_BASE)
33#define IMX_MSHC_BASE (0x1A000 + IMX_IO_BASE)
34#define IMX_PLL_BASE (0x1B000 + IMX_IO_BASE)
35#define IMX_GPIO_BASE (0x1C000 + IMX_IO_BASE)
36#define IMX_EIM_BASE (0x20000 + IMX_IO_BASE)
37#define IMX_SDRAMC_BASE (0x21000 + IMX_IO_BASE)
38#define IMX_MMA_BASE (0x22000 + IMX_IO_BASE)
39#define IMX_AITC_BASE (0x23000 + IMX_IO_BASE)
40#define IMX_CSI_BASE (0x24000 + IMX_IO_BASE)
41
42/* PLL registers */
43#define CSCR __REG(IMX_PLL_BASE) /* Clock Source Control Register */
44#define CSCR_SYSTEM_SEL (1<<16)
45
46#define MPCTL0 __REG(IMX_PLL_BASE + 0x4) /* MCU PLL Control Register 0 */
47#define MPCTL1 __REG(IMX_PLL_BASE + 0x8) /* MCU PLL and System Clock Register 1 */
48#define SPCTL0 __REG(IMX_PLL_BASE + 0xc) /* System PLL Control Register 0 */
49#define SPCTL1 __REG(IMX_PLL_BASE + 0x10) /* System PLL Control Register 1 */
50#define PCDR __REG(IMX_PLL_BASE + 0x20) /* Peripheral Clock Divider Register */
51
52#define CSCR_MPLL_RESTART (1<<21)
53
54/*
55 * GPIO Module and I/O Multiplexer
56 * x = 0..3 for reg_A, reg_B, reg_C, reg_D
57 */
58#define DDIR(x) __REG2(IMX_GPIO_BASE + 0x00, ((x) & 3) << 8)
59#define OCR1(x) __REG2(IMX_GPIO_BASE + 0x04, ((x) & 3) << 8)
60#define OCR2(x) __REG2(IMX_GPIO_BASE + 0x08, ((x) & 3) << 8)
61#define ICONFA1(x) __REG2(IMX_GPIO_BASE + 0x0c, ((x) & 3) << 8)
62#define ICONFA2(x) __REG2(IMX_GPIO_BASE + 0x10, ((x) & 3) << 8)
63#define ICONFB1(x) __REG2(IMX_GPIO_BASE + 0x14, ((x) & 3) << 8)
64#define ICONFB2(x) __REG2(IMX_GPIO_BASE + 0x18, ((x) & 3) << 8)
65#define DR(x) __REG2(IMX_GPIO_BASE + 0x1c, ((x) & 3) << 8)
66#define GIUS(x) __REG2(IMX_GPIO_BASE + 0x20, ((x) & 3) << 8)
67#define SSR(x) __REG2(IMX_GPIO_BASE + 0x24, ((x) & 3) << 8)
68#define ICR1(x) __REG2(IMX_GPIO_BASE + 0x28, ((x) & 3) << 8)
69#define ICR2(x) __REG2(IMX_GPIO_BASE + 0x2c, ((x) & 3) << 8)
70#define IMR(x) __REG2(IMX_GPIO_BASE + 0x30, ((x) & 3) << 8)
71#define ISR(x) __REG2(IMX_GPIO_BASE + 0x34, ((x) & 3) << 8)
72#define GPR(x) __REG2(IMX_GPIO_BASE + 0x38, ((x) & 3) << 8)
73#define SWR(x) __REG2(IMX_GPIO_BASE + 0x3c, ((x) & 3) << 8)
74#define PUEN(x) __REG2(IMX_GPIO_BASE + 0x40, ((x) & 3) << 8)
75
76#define GPIO_PIN_MASK 0x1f
77#define GPIO_PORT_MASK (0x3 << 5)
78
79#define GPIO_PORTA (0<<5)
80#define GPIO_PORTB (1<<5)
81#define GPIO_PORTC (2<<5)
82#define GPIO_PORTD (3<<5)
83
84#define GPIO_OUT (1<<7)
85#define GPIO_IN (0<<7)
86#define GPIO_PUEN (1<<8)
87
88#define GPIO_PF (0<<9)
89#define GPIO_AF (1<<9)
90
91#define GPIO_OCR_MASK (3<<10)
92#define GPIO_AIN (0<<10)
93#define GPIO_BIN (1<<10)
94#define GPIO_CIN (2<<10)
95#define GPIO_GPIO (3<<10)
96
97#define GPIO_AOUT (1<<12)
98#define GPIO_BOUT (1<<13)
99
100/* assignements for GPIO alternate/primary functions */
101
102/* FIXME: This list is not completed. The correct directions are
103 * missing on some (many) pins
104 */
105#define PA0_PF_A24 ( GPIO_PORTA | GPIO_PF | 0 )
106#define PA0_AIN_SPI2_CLK ( GPIO_PORTA | GPIO_OUT | GPIO_AIN | 0 )
107#define PA0_AF_ETMTRACESYNC ( GPIO_PORTA | GPIO_AF | 0 )
108#define PA1_AOUT_SPI2_RXD ( GPIO_PORTA | GPIO_IN | GPIO_AOUT | 1 )
109#define PA1_PF_TIN ( GPIO_PORTA | GPIO_PF | 1 )
110#define PA2_PF_PWM0 ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 2 )
111#define PA3_PF_CSI_MCLK ( GPIO_PORTA | GPIO_PF | 3 )
112#define PA4_PF_CSI_D0 ( GPIO_PORTA | GPIO_PF | 4 )
113#define PA5_PF_CSI_D1 ( GPIO_PORTA | GPIO_PF | 5 )
114#define PA6_PF_CSI_D2 ( GPIO_PORTA | GPIO_PF | 6 )
115#define PA7_PF_CSI_D3 ( GPIO_PORTA | GPIO_PF | 7 )
116#define PA8_PF_CSI_D4 ( GPIO_PORTA | GPIO_PF | 8 )
117#define PA9_PF_CSI_D5 ( GPIO_PORTA | GPIO_PF | 9 )
118#define PA10_PF_CSI_D6 ( GPIO_PORTA | GPIO_PF | 10 )
119#define PA11_PF_CSI_D7 ( GPIO_PORTA | GPIO_PF | 11 )
120#define PA12_PF_CSI_VSYNC ( GPIO_PORTA | GPIO_PF | 12 )
121#define PA13_PF_CSI_HSYNC ( GPIO_PORTA | GPIO_PF | 13 )
122#define PA14_PF_CSI_PIXCLK ( GPIO_PORTA | GPIO_PF | 14 )
123#define PA15_PF_I2C_SDA ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 15 )
124#define PA16_PF_I2C_SCL ( GPIO_PORTA | GPIO_OUT | GPIO_PF | 16 )
125#define PA17_AF_ETMTRACEPKT4 ( GPIO_PORTA | GPIO_AF | 17 )
126#define PA17_AIN_SPI2_SS ( GPIO_PORTA | GPIO_AIN | 17 )
127#define PA18_AF_ETMTRACEPKT5 ( GPIO_PORTA | GPIO_AF | 18 )
128#define PA19_AF_ETMTRACEPKT6 ( GPIO_PORTA | GPIO_AF | 19 )
129#define PA20_AF_ETMTRACEPKT7 ( GPIO_PORTA | GPIO_AF | 20 )
130#define PA21_PF_A0 ( GPIO_PORTA | GPIO_PF | 21 )
131#define PA22_PF_CS4 ( GPIO_PORTA | GPIO_PF | 22 )
132#define PA23_PF_CS5 ( GPIO_PORTA | GPIO_PF | 23 )
133#define PA24_PF_A16 ( GPIO_PORTA | GPIO_PF | 24 )
134#define PA24_AF_ETMTRACEPKT0 ( GPIO_PORTA | GPIO_AF | 24 )
135#define PA25_PF_A17 ( GPIO_PORTA | GPIO_PF | 25 )
136#define PA25_AF_ETMTRACEPKT1 ( GPIO_PORTA | GPIO_AF | 25 )
137#define PA26_PF_A18 ( GPIO_PORTA | GPIO_PF | 26 )
138#define PA26_AF_ETMTRACEPKT2 ( GPIO_PORTA | GPIO_AF | 26 )
139#define PA27_PF_A19 ( GPIO_PORTA | GPIO_PF | 27 )
140#define PA27_AF_ETMTRACEPKT3 ( GPIO_PORTA | GPIO_AF | 27 )
141#define PA28_PF_A20 ( GPIO_PORTA | GPIO_PF | 28 )
142#define PA28_AF_ETMPIPESTAT0 ( GPIO_PORTA | GPIO_AF | 28 )
143#define PA29_PF_A21 ( GPIO_PORTA | GPIO_PF | 29 )
144#define PA29_AF_ETMPIPESTAT1 ( GPIO_PORTA | GPIO_AF | 29 )
145#define PA30_PF_A22 ( GPIO_PORTA | GPIO_PF | 30 )
146#define PA30_AF_ETMPIPESTAT2 ( GPIO_PORTA | GPIO_AF | 30 )
147#define PA31_PF_A23 ( GPIO_PORTA | GPIO_PF | 31 )
148#define PA31_AF_ETMTRACECLK ( GPIO_PORTA | GPIO_AF | 31 )
149#define PB8_PF_SD_DAT0 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 8 )
150#define PB8_AF_MS_PIO ( GPIO_PORTB | GPIO_AF | 8 )
151#define PB9_PF_SD_DAT1 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 9 )
152#define PB9_AF_MS_PI1 ( GPIO_PORTB | GPIO_AF | 9 )
153#define PB10_PF_SD_DAT2 ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 10 )
154#define PB10_AF_MS_SCLKI ( GPIO_PORTB | GPIO_AF | 10 )
155#define PB11_PF_SD_DAT3 ( GPIO_PORTB | GPIO_PF | 11 )
156#define PB11_AF_MS_SDIO ( GPIO_PORTB | GPIO_AF | 11 )
157#define PB12_PF_SD_CLK ( GPIO_PORTB | GPIO_PF | 12 )
158#define PB12_AF_MS_SCLK0 ( GPIO_PORTB | GPIO_AF | 12 )
159#define PB13_PF_SD_CMD ( GPIO_PORTB | GPIO_PF | GPIO_PUEN | 13 )
160#define PB13_AF_MS_BS ( GPIO_PORTB | GPIO_AF | 13 )
161#define PB14_AF_SSI_RXFS ( GPIO_PORTB | GPIO_AF | 14 )
162#define PB15_AF_SSI_RXCLK ( GPIO_PORTB | GPIO_AF | 15 )
163#define PB16_AF_SSI_RXDAT ( GPIO_PORTB | GPIO_IN | GPIO_AF | 16 )
164#define PB17_AF_SSI_TXDAT ( GPIO_PORTB | GPIO_OUT | GPIO_AF | 17 )
165#define PB18_AF_SSI_TXFS ( GPIO_PORTB | GPIO_AF | 18 )
166#define PB19_AF_SSI_TXCLK ( GPIO_PORTB | GPIO_AF | 19 )
167#define PB20_PF_USBD_AFE ( GPIO_PORTB | GPIO_PF | 20 )
168#define PB21_PF_USBD_OE ( GPIO_PORTB | GPIO_PF | 21 )
169#define PB22_PFUSBD_RCV ( GPIO_PORTB | GPIO_PF | 22 )
170#define PB23_PF_USBD_SUSPND ( GPIO_PORTB | GPIO_PF | 23 )
171#define PB24_PF_USBD_VP ( GPIO_PORTB | GPIO_PF | 24 )
172#define PB25_PF_USBD_VM ( GPIO_PORTB | GPIO_PF | 25 )
173#define PB26_PF_USBD_VPO ( GPIO_PORTB | GPIO_PF | 26 )
174#define PB27_PF_USBD_VMO ( GPIO_PORTB | GPIO_PF | 27 )
175#define PB28_PF_UART2_CTS ( GPIO_PORTB | GPIO_OUT | GPIO_PF | 28 )
176#define PB29_PF_UART2_RTS ( GPIO_PORTB | GPIO_IN | GPIO_PF | 29 )
177#define PB30_PF_UART2_TXD ( GPIO_PORTB | GPIO_OUT | GPIO_PF | 30 )
178#define PB31_PF_UART2_RXD ( GPIO_PORTB | GPIO_IN | GPIO_PF | 31 )
179#define PC3_PF_SSI_RXFS ( GPIO_PORTC | GPIO_PF | 3 )
180#define PC4_PF_SSI_RXCLK ( GPIO_PORTC | GPIO_PF | 4 )
181#define PC5_PF_SSI_RXDAT ( GPIO_PORTC | GPIO_IN | GPIO_PF | 5 )
182#define PC6_PF_SSI_TXDAT ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 6 )
183#define PC7_PF_SSI_TXFS ( GPIO_PORTC | GPIO_PF | 7 )
184#define PC8_PF_SSI_TXCLK ( GPIO_PORTC | GPIO_PF | 8 )
185#define PC9_PF_UART1_CTS ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 9 )
186#define PC10_PF_UART1_RTS ( GPIO_PORTC | GPIO_IN | GPIO_PF | 10 )
187#define PC11_PF_UART1_TXD ( GPIO_PORTC | GPIO_OUT | GPIO_PF | 11 )
188#define PC12_PF_UART1_RXD ( GPIO_PORTC | GPIO_IN | GPIO_PF | 12 )
189#define PC13_PF_SPI1_SPI_RDY ( GPIO_PORTC | GPIO_PF | 13 )
190#define PC14_PF_SPI1_SCLK ( GPIO_PORTC | GPIO_PF | 14 )
191#define PC15_PF_SPI1_SS ( GPIO_PORTC | GPIO_PF | 15 )
192#define PC16_PF_SPI1_MISO ( GPIO_PORTC | GPIO_PF | 16 )
193#define PC17_PF_SPI1_MOSI ( GPIO_PORTC | GPIO_PF | 17 )
194#define PD6_PF_LSCLK ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 6 )
195#define PD7_PF_REV ( GPIO_PORTD | GPIO_PF | 7 )
196#define PD7_AF_UART2_DTR ( GPIO_PORTD | GPIO_IN | GPIO_AF | 7 )
197#define PD7_AIN_SPI2_SCLK ( GPIO_PORTD | GPIO_AIN | 7 )
198#define PD8_PF_CLS ( GPIO_PORTD | GPIO_PF | 8 )
199#define PD8_AF_UART2_DCD ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 8 )
200#define PD8_AIN_SPI2_SS ( GPIO_PORTD | GPIO_AIN | 8 )
201#define PD9_PF_PS ( GPIO_PORTD | GPIO_PF | 9 )
202#define PD9_AF_UART2_RI ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 9 )
203#define PD9_AOUT_SPI2_RXD ( GPIO_PORTD | GPIO_IN | GPIO_AOUT | 9 )
204#define PD10_PF_SPL_SPR ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 10 )
205#define PD10_AF_UART2_DSR ( GPIO_PORTD | GPIO_OUT | GPIO_AF | 10 )
206#define PD10_AIN_SPI2_TXD ( GPIO_PORTD | GPIO_OUT | GPIO_AIN | 10 )
207#define PD11_PF_CONTRAST ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 11 )
208#define PD12_PF_ACD_OE ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 12 )
209#define PD13_PF_LP_HSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 13 )
210#define PD14_PF_FLM_VSYNC ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 14 )
211#define PD15_PF_LD0 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 15 )
212#define PD16_PF_LD1 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 16 )
213#define PD17_PF_LD2 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 17 )
214#define PD18_PF_LD3 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 18 )
215#define PD19_PF_LD4 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 19 )
216#define PD20_PF_LD5 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 20 )
217#define PD21_PF_LD6 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 21 )
218#define PD22_PF_LD7 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 22 )
219#define PD23_PF_LD8 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 23 )
220#define PD24_PF_LD9 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 24 )
221#define PD25_PF_LD10 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 25 )
222#define PD26_PF_LD11 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 26 )
223#define PD27_PF_LD12 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 27 )
224#define PD28_PF_LD13 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 28 )
225#define PD29_PF_LD14 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 29 )
226#define PD30_PF_LD15 ( GPIO_PORTD | GPIO_OUT | GPIO_PF | 30 )
227#define PD31_PF_TMR2OUT ( GPIO_PORTD | GPIO_PF | 31 )
228#define PD31_BIN_SPI2_TXD ( GPIO_PORTD | GPIO_BIN | 31 )
229
230/*
Sascha Hauerd7def6c2005-05-10 19:01:35 +0100231 * PWM controller
232 */
233#define PWMC __REG(IMX_PWM_BASE + 0x00) /* PWM Control Register */
234#define PWMS __REG(IMX_PWM_BASE + 0x04) /* PWM Sample Register */
235#define PWMP __REG(IMX_PWM_BASE + 0x08) /* PWM Period Register */
236#define PWMCNT __REG(IMX_PWM_BASE + 0x0C) /* PWM Counter Register */
237
238#define PWMC_HCTR (0x01<<18) /* Halfword FIFO Data Swapping */
239#define PWMC_BCTR (0x01<<17) /* Byte FIFO Data Swapping */
240#define PWMC_SWR (0x01<<16) /* Software Reset */
241#define PWMC_CLKSRC (0x01<<15) /* Clock Source */
242#define PWMC_PRESCALER(x) (((x-1) & 0x7F) << 8) /* PRESCALER */
243#define PWMC_IRQ (0x01<< 7) /* Interrupt Request */
244#define PWMC_IRQEN (0x01<< 6) /* Interrupt Request Enable */
245#define PWMC_FIFOAV (0x01<< 5) /* FIFO Available */
246#define PWMC_EN (0x01<< 4) /* Enables/Disables the PWM */
247#define PWMC_REPEAT(x) (((x) & 0x03) << 2) /* Sample Repeats */
248#define PWMC_CLKSEL(x) (((x) & 0x03) << 0) /* Clock Selection */
249
250#define PWMS_SAMPLE(x) ((x) & 0xFFFF) /* Contains a two-sample word */
251#define PWMP_PERIOD(x) ((x) & 0xFFFF) /* Represents the PWM's period */
252#define PWMC_COUNTER(x) ((x) & 0xFFFF) /* Represents the current count value */
253
254/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 * DMA Controller
256 */
257#define DCR __REG(IMX_DMAC_BASE +0x00) /* DMA Control Register */
258#define DISR __REG(IMX_DMAC_BASE +0x04) /* DMA Interrupt status Register */
259#define DIMR __REG(IMX_DMAC_BASE +0x08) /* DMA Interrupt mask Register */
260#define DBTOSR __REG(IMX_DMAC_BASE +0x0c) /* DMA Burst timeout status Register */
261#define DRTOSR __REG(IMX_DMAC_BASE +0x10) /* DMA Request timeout Register */
262#define DSESR __REG(IMX_DMAC_BASE +0x14) /* DMA Transfer Error Status Register */
263#define DBOSR __REG(IMX_DMAC_BASE +0x18) /* DMA Buffer overflow status Register */
264#define DBTOCR __REG(IMX_DMAC_BASE +0x1c) /* DMA Burst timeout control Register */
265#define WSRA __REG(IMX_DMAC_BASE +0x40) /* W-Size Register A */
266#define XSRA __REG(IMX_DMAC_BASE +0x44) /* X-Size Register A */
267#define YSRA __REG(IMX_DMAC_BASE +0x48) /* Y-Size Register A */
268#define WSRB __REG(IMX_DMAC_BASE +0x4c) /* W-Size Register B */
269#define XSRB __REG(IMX_DMAC_BASE +0x50) /* X-Size Register B */
270#define YSRB __REG(IMX_DMAC_BASE +0x54) /* Y-Size Register B */
271#define SAR(x) __REG2( IMX_DMAC_BASE + 0x80, (x) << 6) /* Source Address Registers */
272#define DAR(x) __REG2( IMX_DMAC_BASE + 0x84, (x) << 6) /* Destination Address Registers */
273#define CNTR(x) __REG2( IMX_DMAC_BASE + 0x88, (x) << 6) /* Count Registers */
274#define CCR(x) __REG2( IMX_DMAC_BASE + 0x8c, (x) << 6) /* Control Registers */
275#define RSSR(x) __REG2( IMX_DMAC_BASE + 0x90, (x) << 6) /* Request source select Registers */
276#define BLR(x) __REG2( IMX_DMAC_BASE + 0x94, (x) << 6) /* Burst length Registers */
277#define RTOR(x) __REG2( IMX_DMAC_BASE + 0x98, (x) << 6) /* Request timeout Registers */
278#define BUCR(x) __REG2( IMX_DMAC_BASE + 0x98, (x) << 6) /* Bus Utilization Registers */
279
280#define DCR_DRST (1<<1)
281#define DCR_DEN (1<<0)
282#define DBTOCR_EN (1<<15)
283#define DBTOCR_CNT(x) ((x) & 0x7fff )
284#define CNTR_CNT(x) ((x) & 0xffffff )
285#define CCR_DMOD_LINEAR ( 0x0 << 12 )
286#define CCR_DMOD_2D ( 0x1 << 12 )
287#define CCR_DMOD_FIFO ( 0x2 << 12 )
288#define CCR_DMOD_EOBFIFO ( 0x3 << 12 )
289#define CCR_SMOD_LINEAR ( 0x0 << 10 )
290#define CCR_SMOD_2D ( 0x1 << 10 )
291#define CCR_SMOD_FIFO ( 0x2 << 10 )
292#define CCR_SMOD_EOBFIFO ( 0x3 << 10 )
293#define CCR_MDIR_DEC (1<<9)
294#define CCR_MSEL_B (1<<8)
295#define CCR_DSIZ_32 ( 0x0 << 6 )
296#define CCR_DSIZ_8 ( 0x1 << 6 )
297#define CCR_DSIZ_16 ( 0x2 << 6 )
298#define CCR_SSIZ_32 ( 0x0 << 4 )
299#define CCR_SSIZ_8 ( 0x1 << 4 )
300#define CCR_SSIZ_16 ( 0x2 << 4 )
301#define CCR_REN (1<<3)
302#define CCR_RPT (1<<2)
303#define CCR_FRC (1<<1)
304#define CCR_CEN (1<<0)
305#define RTOR_EN (1<<15)
306#define RTOR_CLK (1<<14)
307#define RTOR_PSC (1<<13)
308
309/*
310 * Interrupt controller
311 */
312
313#define IMX_INTCNTL __REG(IMX_AITC_BASE+0x00)
314#define INTCNTL_FIAD (1<<19)
315#define INTCNTL_NIAD (1<<20)
316
317#define IMX_NIMASK __REG(IMX_AITC_BASE+0x04)
318#define IMX_INTENNUM __REG(IMX_AITC_BASE+0x08)
319#define IMX_INTDISNUM __REG(IMX_AITC_BASE+0x0c)
320#define IMX_INTENABLEH __REG(IMX_AITC_BASE+0x10)
321#define IMX_INTENABLEL __REG(IMX_AITC_BASE+0x14)
322
323/*
324 * General purpose timers
325 */
326#define IMX_TCTL(x) __REG( 0x00 + (x))
327#define TCTL_SWR (1<<15)
328#define TCTL_FRR (1<<8)
329#define TCTL_CAP_RIS (1<<6)
330#define TCTL_CAP_FAL (2<<6)
331#define TCTL_CAP_RIS_FAL (3<<6)
332#define TCTL_OM (1<<5)
333#define TCTL_IRQEN (1<<4)
334#define TCTL_CLK_PCLK1 (1<<1)
335#define TCTL_CLK_PCLK1_16 (2<<1)
336#define TCTL_CLK_TIN (3<<1)
337#define TCTL_CLK_32 (4<<1)
338#define TCTL_TEN (1<<0)
339
340#define IMX_TPRER(x) __REG( 0x04 + (x))
341#define IMX_TCMP(x) __REG( 0x08 + (x))
342#define IMX_TCR(x) __REG( 0x0C + (x))
343#define IMX_TCN(x) __REG( 0x10 + (x))
344#define IMX_TSTAT(x) __REG( 0x14 + (x))
345#define TSTAT_CAPT (1<<1)
346#define TSTAT_COMP (1<<0)
347
348/*
349 * LCD Controller
350 */
351
352#define LCDC_SSA __REG(IMX_LCDC_BASE+0x00)
353
354#define LCDC_SIZE __REG(IMX_LCDC_BASE+0x04)
355#define SIZE_XMAX(x) ((((x) >> 4) & 0x3f) << 20)
356#define SIZE_YMAX(y) ( (y) & 0x1ff )
357
358#define LCDC_VPW __REG(IMX_LCDC_BASE+0x08)
359#define VPW_VPW(x) ( (x) & 0x3ff )
360
361#define LCDC_CPOS __REG(IMX_LCDC_BASE+0x0C)
362#define CPOS_CC1 (1<<31)
363#define CPOS_CC0 (1<<30)
364#define CPOS_OP (1<<28)
365#define CPOS_CXP(x) (((x) & 3ff) << 16)
366#define CPOS_CYP(y) ((y) & 0x1ff)
367
368#define LCDC_LCWHB __REG(IMX_LCDC_BASE+0x10)
369#define LCWHB_BK_EN (1<<31)
370#define LCWHB_CW(w) (((w) & 0x1f) << 24)
371#define LCWHB_CH(h) (((h) & 0x1f) << 16)
372#define LCWHB_BD(x) ((x) & 0xff)
373
374#define LCDC_LCHCC __REG(IMX_LCDC_BASE+0x14)
375#define LCHCC_CUR_COL_R(r) (((r) & 0x1f) << 11)
376#define LCHCC_CUR_COL_G(g) (((g) & 0x3f) << 5)
377#define LCHCC_CUR_COL_B(b) ((b) & 0x1f)
378
379#define LCDC_PCR __REG(IMX_LCDC_BASE+0x18)
380#define PCR_TFT (1<<31)
381#define PCR_COLOR (1<<30)
382#define PCR_PBSIZ_1 (0<<28)
383#define PCR_PBSIZ_2 (1<<28)
384#define PCR_PBSIZ_4 (2<<28)
385#define PCR_PBSIZ_8 (3<<28)
386#define PCR_BPIX_1 (0<<25)
387#define PCR_BPIX_2 (1<<25)
388#define PCR_BPIX_4 (2<<25)
389#define PCR_BPIX_8 (3<<25)
390#define PCR_BPIX_12 (4<<25)
391#define PCR_BPIX_16 (4<<25)
392#define PCR_PIXPOL (1<<24)
393#define PCR_FLMPOL (1<<23)
394#define PCR_LPPOL (1<<22)
395#define PCR_CLKPOL (1<<21)
396#define PCR_OEPOL (1<<20)
397#define PCR_SCLKIDLE (1<<19)
398#define PCR_END_SEL (1<<18)
399#define PCR_END_BYTE_SWAP (1<<17)
400#define PCR_REV_VS (1<<16)
401#define PCR_ACD_SEL (1<<15)
402#define PCR_ACD(x) (((x) & 0x7f) << 8)
403#define PCR_SCLK_SEL (1<<7)
404#define PCR_SHARP (1<<6)
405#define PCR_PCD(x) ((x) & 0x3f)
406
407#define LCDC_HCR __REG(IMX_LCDC_BASE+0x1C)
408#define HCR_H_WIDTH(x) (((x) & 0x3f) << 26)
409#define HCR_H_WAIT_1(x) (((x) & 0xff) << 8)
410#define HCR_H_WAIT_2(x) ((x) & 0xff)
411
412#define LCDC_VCR __REG(IMX_LCDC_BASE+0x20)
413#define VCR_V_WIDTH(x) (((x) & 0x3f) << 26)
414#define VCR_V_WAIT_1(x) (((x) & 0xff) << 8)
415#define VCR_V_WAIT_2(x) ((x) & 0xff)
416
417#define LCDC_POS __REG(IMX_LCDC_BASE+0x24)
418#define POS_POS(x) ((x) & 1f)
419
420#define LCDC_LSCR1 __REG(IMX_LCDC_BASE+0x28)
421#define LSCR1_PS_RISE_DELAY(x) (((x) & 0x7f) << 26)
422#define LSCR1_CLS_RISE_DELAY(x) (((x) & 0x3f) << 16)
423#define LSCR1_REV_TOGGLE_DELAY(x) (((x) & 0xf) << 8)
424#define LSCR1_GRAY2(x) (((x) & 0xf) << 4)
425#define LSCR1_GRAY1(x) (((x) & 0xf))
426
427#define LCDC_PWMR __REG(IMX_LCDC_BASE+0x2C)
428#define PWMR_CLS(x) (((x) & 0x1ff) << 16)
429#define PWMR_LDMSK (1<<15)
430#define PWMR_SCR1 (1<<10)
431#define PWMR_SCR0 (1<<9)
432#define PWMR_CC_EN (1<<8)
433#define PWMR_PW(x) ((x) & 0xff)
434
435#define LCDC_DMACR __REG(IMX_LCDC_BASE+0x30)
436#define DMACR_BURST (1<<31)
437#define DMACR_HM(x) (((x) & 0xf) << 16)
438#define DMACR_TM(x) ((x) &0xf)
439
440#define LCDC_RMCR __REG(IMX_LCDC_BASE+0x34)
441#define RMCR_LCDC_EN (1<<1)
442#define RMCR_SELF_REF (1<<0)
443
444#define LCDC_LCDICR __REG(IMX_LCDC_BASE+0x38)
445#define LCDICR_INT_SYN (1<<2)
446#define LCDICR_INT_CON (1)
447
448#define LCDC_LCDISR __REG(IMX_LCDC_BASE+0x40)
449#define LCDISR_UDR_ERR (1<<3)
450#define LCDISR_ERR_RES (1<<2)
451#define LCDISR_EOF (1<<1)
452#define LCDISR_BOF (1<<0)
453
454/*
455 * UART Module. Takes the UART base address as argument
456 */
457#define URXD0(x) __REG( 0x0 + (x)) /* Receiver Register */
458#define URTX0(x) __REG( 0x40 + (x)) /* Transmitter Register */
459#define UCR1(x) __REG( 0x80 + (x)) /* Control Register 1 */
460#define UCR2(x) __REG( 0x84 + (x)) /* Control Register 2 */
461#define UCR3(x) __REG( 0x88 + (x)) /* Control Register 3 */
462#define UCR4(x) __REG( 0x8c + (x)) /* Control Register 4 */
463#define UFCR(x) __REG( 0x90 + (x)) /* FIFO Control Register */
464#define USR1(x) __REG( 0x94 + (x)) /* Status Register 1 */
465#define USR2(x) __REG( 0x98 + (x)) /* Status Register 2 */
466#define UESC(x) __REG( 0x9c + (x)) /* Escape Character Register */
467#define UTIM(x) __REG( 0xa0 + (x)) /* Escape Timer Register */
468#define UBIR(x) __REG( 0xa4 + (x)) /* BRM Incremental Register */
469#define UBMR(x) __REG( 0xa8 + (x)) /* BRM Modulator Register */
470#define UBRC(x) __REG( 0xac + (x)) /* Baud Rate Count Register */
471#define BIPR1(x) __REG( 0xb0 + (x)) /* Incremental Preset Register 1 */
472#define BIPR2(x) __REG( 0xb4 + (x)) /* Incremental Preset Register 2 */
473#define BIPR3(x) __REG( 0xb8 + (x)) /* Incremental Preset Register 3 */
474#define BIPR4(x) __REG( 0xbc + (x)) /* Incremental Preset Register 4 */
475#define BMPR1(x) __REG( 0xc0 + (x)) /* BRM Modulator Register 1 */
476#define BMPR2(x) __REG( 0xc4 + (x)) /* BRM Modulator Register 2 */
477#define BMPR3(x) __REG( 0xc8 + (x)) /* BRM Modulator Register 3 */
478#define BMPR4(x) __REG( 0xcc + (x)) /* BRM Modulator Register 4 */
479#define UTS(x) __REG( 0xd0 + (x)) /* UART Test Register */
480
481/* UART Control Register Bit Fields.*/
482#define URXD_CHARRDY (1<<15)
483#define URXD_ERR (1<<14)
484#define URXD_OVRRUN (1<<13)
485#define URXD_FRMERR (1<<12)
486#define URXD_BRK (1<<11)
487#define URXD_PRERR (1<<10)
488#define UCR1_ADEN (1<<15) /* Auto dectect interrupt */
489#define UCR1_ADBR (1<<14) /* Auto detect baud rate */
490#define UCR1_TRDYEN (1<<13) /* Transmitter ready interrupt enable */
491#define UCR1_IDEN (1<<12) /* Idle condition interrupt */
492#define UCR1_RRDYEN (1<<9) /* Recv ready interrupt enable */
493#define UCR1_RDMAEN (1<<8) /* Recv ready DMA enable */
494#define UCR1_IREN (1<<7) /* Infrared interface enable */
495#define UCR1_TXMPTYEN (1<<6) /* Transimitter empty interrupt enable */
496#define UCR1_RTSDEN (1<<5) /* RTS delta interrupt enable */
497#define UCR1_SNDBRK (1<<4) /* Send break */
498#define UCR1_TDMAEN (1<<3) /* Transmitter ready DMA enable */
499#define UCR1_UARTCLKEN (1<<2) /* UART clock enabled */
500#define UCR1_DOZE (1<<1) /* Doze */
501#define UCR1_UARTEN (1<<0) /* UART enabled */
502#define UCR2_ESCI (1<<15) /* Escape seq interrupt enable */
503#define UCR2_IRTS (1<<14) /* Ignore RTS pin */
504#define UCR2_CTSC (1<<13) /* CTS pin control */
505#define UCR2_CTS (1<<12) /* Clear to send */
506#define UCR2_ESCEN (1<<11) /* Escape enable */
507#define UCR2_PREN (1<<8) /* Parity enable */
508#define UCR2_PROE (1<<7) /* Parity odd/even */
509#define UCR2_STPB (1<<6) /* Stop */
510#define UCR2_WS (1<<5) /* Word size */
511#define UCR2_RTSEN (1<<4) /* Request to send interrupt enable */
512#define UCR2_TXEN (1<<2) /* Transmitter enabled */
513#define UCR2_RXEN (1<<1) /* Receiver enabled */
514#define UCR2_SRST (1<<0) /* SW reset */
515#define UCR3_DTREN (1<<13) /* DTR interrupt enable */
516#define UCR3_PARERREN (1<<12) /* Parity enable */
517#define UCR3_FRAERREN (1<<11) /* Frame error interrupt enable */
518#define UCR3_DSR (1<<10) /* Data set ready */
519#define UCR3_DCD (1<<9) /* Data carrier detect */
520#define UCR3_RI (1<<8) /* Ring indicator */
521#define UCR3_TIMEOUTEN (1<<7) /* Timeout interrupt enable */
522#define UCR3_RXDSEN (1<<6) /* Receive status interrupt enable */
523#define UCR3_AIRINTEN (1<<5) /* Async IR wake interrupt enable */
524#define UCR3_AWAKEN (1<<4) /* Async wake interrupt enable */
525#define UCR3_REF25 (1<<3) /* Ref freq 25 MHz */
526#define UCR3_REF30 (1<<2) /* Ref Freq 30 MHz */
527#define UCR3_INVT (1<<1) /* Inverted Infrared transmission */
528#define UCR3_BPEN (1<<0) /* Preset registers enable */
529#define UCR4_CTSTL_32 (32<<10) /* CTS trigger level (32 chars) */
530#define UCR4_INVR (1<<9) /* Inverted infrared reception */
531#define UCR4_ENIRI (1<<8) /* Serial infrared interrupt enable */
532#define UCR4_WKEN (1<<7) /* Wake interrupt enable */
533#define UCR4_REF16 (1<<6) /* Ref freq 16 MHz */
534#define UCR4_IRSC (1<<5) /* IR special case */
535#define UCR4_TCEN (1<<3) /* Transmit complete interrupt enable */
536#define UCR4_BKEN (1<<2) /* Break condition interrupt enable */
537#define UCR4_OREN (1<<1) /* Receiver overrun interrupt enable */
538#define UCR4_DREN (1<<0) /* Recv data ready interrupt enable */
539#define UFCR_RXTL_SHF 0 /* Receiver trigger level shift */
540#define UFCR_RFDIV (7<<7) /* Reference freq divider mask */
541#define UFCR_TXTL_SHF 10 /* Transmitter trigger level shift */
542#define USR1_PARITYERR (1<<15) /* Parity error interrupt flag */
543#define USR1_RTSS (1<<14) /* RTS pin status */
544#define USR1_TRDY (1<<13) /* Transmitter ready interrupt/dma flag */
545#define USR1_RTSD (1<<12) /* RTS delta */
546#define USR1_ESCF (1<<11) /* Escape seq interrupt flag */
547#define USR1_FRAMERR (1<<10) /* Frame error interrupt flag */
548#define USR1_RRDY (1<<9) /* Receiver ready interrupt/dma flag */
549#define USR1_TIMEOUT (1<<7) /* Receive timeout interrupt status */
550#define USR1_RXDS (1<<6) /* Receiver idle interrupt flag */
551#define USR1_AIRINT (1<<5) /* Async IR wake interrupt flag */
552#define USR1_AWAKE (1<<4) /* Aysnc wake interrupt flag */
553#define USR2_ADET (1<<15) /* Auto baud rate detect complete */
554#define USR2_TXFE (1<<14) /* Transmit buffer FIFO empty */
555#define USR2_DTRF (1<<13) /* DTR edge interrupt flag */
556#define USR2_IDLE (1<<12) /* Idle condition */
557#define USR2_IRINT (1<<8) /* Serial infrared interrupt flag */
558#define USR2_WAKE (1<<7) /* Wake */
559#define USR2_RTSF (1<<4) /* RTS edge interrupt flag */
560#define USR2_TXDC (1<<3) /* Transmitter complete */
561#define USR2_BRCD (1<<2) /* Break condition */
562#define USR2_ORE (1<<1) /* Overrun error */
563#define USR2_RDR (1<<0) /* Recv data ready */
564#define UTS_FRCPERR (1<<13) /* Force parity error */
565#define UTS_LOOP (1<<12) /* Loop tx and rx */
566#define UTS_TXEMPTY (1<<6) /* TxFIFO empty */
567#define UTS_RXEMPTY (1<<5) /* RxFIFO empty */
568#define UTS_TXFULL (1<<4) /* TxFIFO full */
569#define UTS_RXFULL (1<<3) /* RxFIFO full */
570#define UTS_SOFTRST (1<<0) /* Software reset */
571
572#endif // _IMX_REGS_H