blob: 6dd17f0f84e0ac04f36fd4fcbc507149b7ce5656 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* linux/include/asm/hardware/s3c2410/regs-gpio.h
2 *
3 * Copyright (c) 2003,2004 Simtec Electronics <linux@simtec.co.uk>
4 * http://www.simtec.co.uk/products/SWLINUX/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * S3C2410 GPIO register definitions
11 *
12 * Changelog:
13 * 19-06-2003 BJD Created file
14 * 23-06-2003 BJD Updated GSTATUS registers
15 * 12-03-2004 BJD Updated include protection
16 * 20-07-2004 BJD Added GPIO pin numbers, added Port A definitions
17 * 04-10-2004 BJD Fixed number of bugs, added EXT IRQ filter defs
18 * 17-10-2004 BJD Added GSTATUS1 register definitions
19 * 18-11-2004 BJD Fixed definitions of GPE3, GPE4, GPE5 and GPE6
20 * 18-11-2004 BJD Added S3C2440 AC97 controls
21 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
22 * 28-Mar-2005 LCVR Fixed definition of GPB10
Ben Dooks42d3a122005-10-28 15:26:41 +010023 * 26-Oct-2005 BJD Added generic configuration types
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +000024 * 27-Nov-2005 LCVR Added definitions to S3C2400 registers
Lucas Correia Villa Real0ca5bc32006-02-01 21:24:23 +000025 * 15-Jan-2006 LCVR Written S3C24XX_GPIO_BASE() macro
Linus Torvalds1da177e2005-04-16 15:20:36 -070026*/
27
28
29#ifndef __ASM_ARCH_REGS_GPIO_H
30#define __ASM_ARCH_REGS_GPIO_H "$Id: gpio.h,v 1.5 2003/05/19 12:51:08 ben Exp $"
31
32#define S3C2410_GPIONO(bank,offset) ((bank) + (offset))
33
34#define S3C2410_GPIO_BANKA (32*0)
35#define S3C2410_GPIO_BANKB (32*1)
36#define S3C2410_GPIO_BANKC (32*2)
37#define S3C2410_GPIO_BANKD (32*3)
38#define S3C2410_GPIO_BANKE (32*4)
39#define S3C2410_GPIO_BANKF (32*5)
40#define S3C2410_GPIO_BANKG (32*6)
41#define S3C2410_GPIO_BANKH (32*7)
42
Lucas Correia Villa Real0ca5bc32006-02-01 21:24:23 +000043#ifdef CONFIG_CPU_S3C2400
44#define S3C24XX_GPIO_BASE(x) S3C2400_GPIO_BASE(x)
45#define S3C24XX_MISCCR S3C2400_MISCCR
46#else
47#define S3C24XX_GPIO_BASE(x) S3C2410_GPIO_BASE(x)
Ben Dooks68d9ab32006-06-24 21:21:27 +010048#define S3C24XX_MISCCR S3C24XX_GPIOREG2(0x80)
Lucas Correia Villa Real0ca5bc32006-02-01 21:24:23 +000049#endif /* CONFIG_CPU_S3C2400 */
50
51
52/* S3C2400 doesn't have a 1:1 mapping to S3C2410 gpio base pins */
53
54#define S3C2400_BANKNUM(pin) (((pin) & ~31) / 32)
55#define S3C2400_BASEA2B(pin) ((((pin) & ~31) >> 2))
56#define S3C2400_BASEC2H(pin) ((S3C2400_BANKNUM(pin) * 10) + \
57 (2 * (S3C2400_BANKNUM(pin)-2)))
58
59#define S3C2400_GPIO_BASE(pin) (pin < S3C2410_GPIO_BANKC ? \
60 S3C2400_BASEA2B(pin)+S3C24XX_VA_GPIO : \
61 S3C2400_BASEC2H(pin)+S3C24XX_VA_GPIO)
62
63
Linus Torvalds1da177e2005-04-16 15:20:36 -070064#define S3C2410_GPIO_BASE(pin) ((((pin) & ~31) >> 1) + S3C24XX_VA_GPIO)
65#define S3C2410_GPIO_OFFSET(pin) ((pin) & 31)
66
67/* general configuration options */
68
69#define S3C2410_GPIO_LEAVE (0xFFFFFFFF)
Ben Dooks42d3a122005-10-28 15:26:41 +010070#define S3C2410_GPIO_INPUT (0xFFFFFFF0)
71#define S3C2410_GPIO_OUTPUT (0xFFFFFFF1)
72#define S3C2410_GPIO_IRQ (0xFFFFFFF2) /* not available for all */
73#define S3C2410_GPIO_SFN2 (0xFFFFFFF2) /* not available on A */
74#define S3C2410_GPIO_SFN3 (0xFFFFFFF3) /* not available on A */
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Ben Dooks68d9ab32006-06-24 21:21:27 +010076/* register address for the GPIO registers.
77 * S3C24XX_GPIOREG2 is for the second set of registers in the
78 * GPIO which move between s3c2410 and s3c2412 type systems */
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
80#define S3C2410_GPIOREG(x) ((x) + S3C24XX_VA_GPIO)
Ben Dooks68d9ab32006-06-24 21:21:27 +010081#define S3C24XX_GPIOREG2(x) ((x) + S3C24XX_VA_GPIO2)
82
83
84/* configure GPIO ports A..G */
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +000086/* port A - S3C2410: 22bits, zero in bit X makes pin X output
87 * S3C2400: 18bits, zero in bit X makes pin X output
Linus Torvalds1da177e2005-04-16 15:20:36 -070088 * 1 makes port special function, this is default
89*/
90#define S3C2410_GPACON S3C2410_GPIOREG(0x00)
91#define S3C2410_GPADAT S3C2410_GPIOREG(0x04)
92
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +000093#define S3C2400_GPACON S3C2410_GPIOREG(0x00)
94#define S3C2400_GPADAT S3C2410_GPIOREG(0x04)
95
Linus Torvalds1da177e2005-04-16 15:20:36 -070096#define S3C2410_GPA0 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 0)
97#define S3C2410_GPA0_OUT (0<<0)
98#define S3C2410_GPA0_ADDR0 (1<<0)
99
100#define S3C2410_GPA1 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 1)
101#define S3C2410_GPA1_OUT (0<<1)
102#define S3C2410_GPA1_ADDR16 (1<<1)
103
104#define S3C2410_GPA2 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 2)
105#define S3C2410_GPA2_OUT (0<<2)
106#define S3C2410_GPA2_ADDR17 (1<<2)
107
108#define S3C2410_GPA3 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 3)
109#define S3C2410_GPA3_OUT (0<<3)
110#define S3C2410_GPA3_ADDR18 (1<<3)
111
112#define S3C2410_GPA4 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 4)
113#define S3C2410_GPA4_OUT (0<<4)
114#define S3C2410_GPA4_ADDR19 (1<<4)
115
116#define S3C2410_GPA5 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 5)
117#define S3C2410_GPA5_OUT (0<<5)
118#define S3C2410_GPA5_ADDR20 (1<<5)
119
120#define S3C2410_GPA6 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 6)
121#define S3C2410_GPA6_OUT (0<<6)
122#define S3C2410_GPA6_ADDR21 (1<<6)
123
124#define S3C2410_GPA7 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 7)
125#define S3C2410_GPA7_OUT (0<<7)
126#define S3C2410_GPA7_ADDR22 (1<<7)
127
128#define S3C2410_GPA8 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 8)
129#define S3C2410_GPA8_OUT (0<<8)
130#define S3C2410_GPA8_ADDR23 (1<<8)
131
132#define S3C2410_GPA9 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 9)
133#define S3C2410_GPA9_OUT (0<<9)
134#define S3C2410_GPA9_ADDR24 (1<<9)
135
136#define S3C2410_GPA10 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 10)
137#define S3C2410_GPA10_OUT (0<<10)
138#define S3C2410_GPA10_ADDR25 (1<<10)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000139#define S3C2400_GPA10_SCKE (1<<10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140
141#define S3C2410_GPA11 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 11)
142#define S3C2410_GPA11_OUT (0<<11)
143#define S3C2410_GPA11_ADDR26 (1<<11)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000144#define S3C2400_GPA11_nCAS0 (1<<11)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145
146#define S3C2410_GPA12 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 12)
147#define S3C2410_GPA12_OUT (0<<12)
148#define S3C2410_GPA12_nGCS1 (1<<12)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000149#define S3C2400_GPA12_nCAS1 (1<<12)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150
151#define S3C2410_GPA13 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 13)
152#define S3C2410_GPA13_OUT (0<<13)
153#define S3C2410_GPA13_nGCS2 (1<<13)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000154#define S3C2400_GPA13_nGCS1 (1<<13)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155
156#define S3C2410_GPA14 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 14)
157#define S3C2410_GPA14_OUT (0<<14)
158#define S3C2410_GPA14_nGCS3 (1<<14)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000159#define S3C2400_GPA14_nGCS2 (1<<14)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160
161#define S3C2410_GPA15 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 15)
162#define S3C2410_GPA15_OUT (0<<15)
163#define S3C2410_GPA15_nGCS4 (1<<15)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000164#define S3C2400_GPA15_nGCS3 (1<<15)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165
166#define S3C2410_GPA16 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 16)
167#define S3C2410_GPA16_OUT (0<<16)
168#define S3C2410_GPA16_nGCS5 (1<<16)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000169#define S3C2400_GPA16_nGCS4 (1<<16)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170
171#define S3C2410_GPA17 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 17)
172#define S3C2410_GPA17_OUT (0<<17)
173#define S3C2410_GPA17_CLE (1<<17)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000174#define S3C2400_GPA17_nGCS5 (1<<17)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175
176#define S3C2410_GPA18 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 18)
177#define S3C2410_GPA18_OUT (0<<18)
178#define S3C2410_GPA18_ALE (1<<18)
179
180#define S3C2410_GPA19 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 19)
181#define S3C2410_GPA19_OUT (0<<19)
182#define S3C2410_GPA19_nFWE (1<<19)
183
184#define S3C2410_GPA20 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 20)
185#define S3C2410_GPA20_OUT (0<<20)
186#define S3C2410_GPA20_nFRE (1<<20)
187
188#define S3C2410_GPA21 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 21)
189#define S3C2410_GPA21_OUT (0<<21)
190#define S3C2410_GPA21_nRSTOUT (1<<21)
191
192#define S3C2410_GPA22 S3C2410_GPIONO(S3C2410_GPIO_BANKA, 22)
193#define S3C2410_GPA22_OUT (0<<22)
194#define S3C2410_GPA22_nFCE (1<<22)
195
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000196/* 0x08 and 0x0c are reserved on S3C2410 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000198/* S3C2410:
199 * GPB is 10 IO pins, each configured by 2 bits each in GPBCON.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700200 * 00 = input, 01 = output, 10=special function, 11=reserved
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000201
202 * S3C2400:
203 * GPB is 16 IO pins, each configured by 2 bits each in GPBCON.
204 * 00 = input, 01 = output, 10=data, 11=special function
205
Linus Torvalds1da177e2005-04-16 15:20:36 -0700206 * bit 0,1 = pin 0, 2,3= pin 1...
207 *
208 * CPBUP = pull up resistor control, 1=disabled, 0=enabled
209*/
210
211#define S3C2410_GPBCON S3C2410_GPIOREG(0x10)
212#define S3C2410_GPBDAT S3C2410_GPIOREG(0x14)
213#define S3C2410_GPBUP S3C2410_GPIOREG(0x18)
214
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000215#define S3C2400_GPBCON S3C2410_GPIOREG(0x08)
216#define S3C2400_GPBDAT S3C2410_GPIOREG(0x0C)
217#define S3C2400_GPBUP S3C2410_GPIOREG(0x10)
218
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219/* no i/o pin in port b can have value 3! */
220
221#define S3C2410_GPB0 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 0)
222#define S3C2410_GPB0_INP (0x00 << 0)
223#define S3C2410_GPB0_OUTP (0x01 << 0)
224#define S3C2410_GPB0_TOUT0 (0x02 << 0)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000225#define S3C2400_GPB0_DATA16 (0x02 << 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700226
227#define S3C2410_GPB1 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 1)
228#define S3C2410_GPB1_INP (0x00 << 2)
229#define S3C2410_GPB1_OUTP (0x01 << 2)
230#define S3C2410_GPB1_TOUT1 (0x02 << 2)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000231#define S3C2400_GPB1_DATA17 (0x02 << 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232
233#define S3C2410_GPB2 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 2)
234#define S3C2410_GPB2_INP (0x00 << 4)
235#define S3C2410_GPB2_OUTP (0x01 << 4)
236#define S3C2410_GPB2_TOUT2 (0x02 << 4)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000237#define S3C2400_GPB2_DATA18 (0x02 << 4)
238#define S3C2400_GPB2_TCLK1 (0x03 << 4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239
240#define S3C2410_GPB3 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 3)
241#define S3C2410_GPB3_INP (0x00 << 6)
242#define S3C2410_GPB3_OUTP (0x01 << 6)
243#define S3C2410_GPB3_TOUT3 (0x02 << 6)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000244#define S3C2400_GPB3_DATA19 (0x02 << 6)
245#define S3C2400_GPB3_TXD1 (0x03 << 6)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246
247#define S3C2410_GPB4 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 4)
248#define S3C2410_GPB4_INP (0x00 << 8)
249#define S3C2410_GPB4_OUTP (0x01 << 8)
250#define S3C2410_GPB4_TCLK0 (0x02 << 8)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000251#define S3C2400_GPB4_DATA20 (0x02 << 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252#define S3C2410_GPB4_MASK (0x03 << 8)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000253#define S3C2400_GPB4_RXD1 (0x03 << 8)
254#define S3C2400_GPB4_MASK (0x03 << 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255
256#define S3C2410_GPB5 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 5)
257#define S3C2410_GPB5_INP (0x00 << 10)
258#define S3C2410_GPB5_OUTP (0x01 << 10)
259#define S3C2410_GPB5_nXBACK (0x02 << 10)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000260#define S3C2400_GPB5_DATA21 (0x02 << 10)
261#define S3C2400_GPB5_nCTS1 (0x03 << 10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262
263#define S3C2410_GPB6 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 6)
264#define S3C2410_GPB6_INP (0x00 << 12)
265#define S3C2410_GPB6_OUTP (0x01 << 12)
266#define S3C2410_GPB6_nXBREQ (0x02 << 12)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000267#define S3C2400_GPB6_DATA22 (0x02 << 12)
268#define S3C2400_GPB6_nRTS1 (0x03 << 12)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269
270#define S3C2410_GPB7 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 7)
271#define S3C2410_GPB7_INP (0x00 << 14)
272#define S3C2410_GPB7_OUTP (0x01 << 14)
273#define S3C2410_GPB7_nXDACK1 (0x02 << 14)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000274#define S3C2400_GPB7_DATA23 (0x02 << 14)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275
276#define S3C2410_GPB8 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 8)
277#define S3C2410_GPB8_INP (0x00 << 16)
278#define S3C2410_GPB8_OUTP (0x01 << 16)
279#define S3C2410_GPB8_nXDREQ1 (0x02 << 16)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000280#define S3C2400_GPB8_DATA24 (0x02 << 16)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281
282#define S3C2410_GPB9 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 9)
283#define S3C2410_GPB9_INP (0x00 << 18)
284#define S3C2410_GPB9_OUTP (0x01 << 18)
285#define S3C2410_GPB9_nXDACK0 (0x02 << 18)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000286#define S3C2400_GPB9_DATA25 (0x02 << 18)
287#define S3C2400_GPB9_I2SSDI (0x03 << 18)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288
289#define S3C2410_GPB10 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 10)
290#define S3C2410_GPB10_INP (0x00 << 20)
291#define S3C2410_GPB10_OUTP (0x01 << 20)
292#define S3C2410_GPB10_nXDRE0 (0x02 << 20)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000293#define S3C2400_GPB10_DATA26 (0x02 << 20)
294#define S3C2400_GPB10_nSS (0x03 << 20)
295
296#define S3C2400_GPB11 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 11)
297#define S3C2400_GPB11_INP (0x00 << 22)
298#define S3C2400_GPB11_OUTP (0x01 << 22)
299#define S3C2400_GPB11_DATA27 (0x02 << 22)
300
301#define S3C2400_GPB12 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 12)
302#define S3C2400_GPB12_INP (0x00 << 24)
303#define S3C2400_GPB12_OUTP (0x01 << 24)
304#define S3C2400_GPB12_DATA28 (0x02 << 24)
305
306#define S3C2400_GPB13 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 13)
307#define S3C2400_GPB13_INP (0x00 << 26)
308#define S3C2400_GPB13_OUTP (0x01 << 26)
309#define S3C2400_GPB13_DATA29 (0x02 << 26)
310
311#define S3C2400_GPB14 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 14)
312#define S3C2400_GPB14_INP (0x00 << 28)
313#define S3C2400_GPB14_OUTP (0x01 << 28)
314#define S3C2400_GPB14_DATA30 (0x02 << 28)
315
316#define S3C2400_GPB15 S3C2410_GPIONO(S3C2410_GPIO_BANKB, 15)
317#define S3C2400_GPB15_INP (0x00 << 30)
318#define S3C2400_GPB15_OUTP (0x01 << 30)
319#define S3C2400_GPB15_DATA31 (0x02 << 30)
320
321#define S3C2410_GPB_PUPDIS(x) (1<<(x))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322
323/* Port C consits of 16 GPIO/Special function
324 *
325 * almost identical setup to port b, but the special functions are mostly
326 * to do with the video system's sync/etc.
327*/
328
329#define S3C2410_GPCCON S3C2410_GPIOREG(0x20)
330#define S3C2410_GPCDAT S3C2410_GPIOREG(0x24)
331#define S3C2410_GPCUP S3C2410_GPIOREG(0x28)
332
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000333#define S3C2400_GPCCON S3C2410_GPIOREG(0x14)
334#define S3C2400_GPCDAT S3C2410_GPIOREG(0x18)
335#define S3C2400_GPCUP S3C2410_GPIOREG(0x1C)
336
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337#define S3C2410_GPC0 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 0)
338#define S3C2410_GPC0_INP (0x00 << 0)
339#define S3C2410_GPC0_OUTP (0x01 << 0)
340#define S3C2410_GPC0_LEND (0x02 << 0)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000341#define S3C2400_GPC0_VD0 (0x02 << 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342
343#define S3C2410_GPC1 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 1)
344#define S3C2410_GPC1_INP (0x00 << 2)
345#define S3C2410_GPC1_OUTP (0x01 << 2)
346#define S3C2410_GPC1_VCLK (0x02 << 2)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000347#define S3C2400_GPC1_VD1 (0x02 << 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348
349#define S3C2410_GPC2 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 2)
350#define S3C2410_GPC2_INP (0x00 << 4)
351#define S3C2410_GPC2_OUTP (0x01 << 4)
352#define S3C2410_GPC2_VLINE (0x02 << 4)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000353#define S3C2400_GPC2_VD2 (0x02 << 4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354
355#define S3C2410_GPC3 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 3)
356#define S3C2410_GPC3_INP (0x00 << 6)
357#define S3C2410_GPC3_OUTP (0x01 << 6)
358#define S3C2410_GPC3_VFRAME (0x02 << 6)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000359#define S3C2400_GPC3_VD3 (0x02 << 6)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360
361#define S3C2410_GPC4 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 4)
362#define S3C2410_GPC4_INP (0x00 << 8)
363#define S3C2410_GPC4_OUTP (0x01 << 8)
364#define S3C2410_GPC4_VM (0x02 << 8)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000365#define S3C2400_GPC4_VD4 (0x02 << 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700366
367#define S3C2410_GPC5 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 5)
368#define S3C2410_GPC5_INP (0x00 << 10)
369#define S3C2410_GPC5_OUTP (0x01 << 10)
370#define S3C2410_GPC5_LCDVF0 (0x02 << 10)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000371#define S3C2400_GPC5_VD5 (0x02 << 10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700372
373#define S3C2410_GPC6 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 6)
374#define S3C2410_GPC6_INP (0x00 << 12)
375#define S3C2410_GPC6_OUTP (0x01 << 12)
376#define S3C2410_GPC6_LCDVF1 (0x02 << 12)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000377#define S3C2400_GPC6_VD6 (0x02 << 12)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378
379#define S3C2410_GPC7 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 7)
380#define S3C2410_GPC7_INP (0x00 << 14)
381#define S3C2410_GPC7_OUTP (0x01 << 14)
382#define S3C2410_GPC7_LCDVF2 (0x02 << 14)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000383#define S3C2400_GPC7_VD7 (0x02 << 14)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384
385#define S3C2410_GPC8 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 8)
386#define S3C2410_GPC8_INP (0x00 << 16)
387#define S3C2410_GPC8_OUTP (0x01 << 16)
388#define S3C2410_GPC8_VD0 (0x02 << 16)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000389#define S3C2400_GPC8_VD8 (0x02 << 16)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700390
391#define S3C2410_GPC9 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 9)
392#define S3C2410_GPC9_INP (0x00 << 18)
393#define S3C2410_GPC9_OUTP (0x01 << 18)
394#define S3C2410_GPC9_VD1 (0x02 << 18)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000395#define S3C2400_GPC9_VD9 (0x02 << 18)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396
397#define S3C2410_GPC10 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 10)
398#define S3C2410_GPC10_INP (0x00 << 20)
399#define S3C2410_GPC10_OUTP (0x01 << 20)
400#define S3C2410_GPC10_VD2 (0x02 << 20)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000401#define S3C2400_GPC10_VD10 (0x02 << 20)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402
403#define S3C2410_GPC11 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 11)
404#define S3C2410_GPC11_INP (0x00 << 22)
405#define S3C2410_GPC11_OUTP (0x01 << 22)
406#define S3C2410_GPC11_VD3 (0x02 << 22)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000407#define S3C2400_GPC11_VD11 (0x02 << 22)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408
409#define S3C2410_GPC12 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 12)
410#define S3C2410_GPC12_INP (0x00 << 24)
411#define S3C2410_GPC12_OUTP (0x01 << 24)
412#define S3C2410_GPC12_VD4 (0x02 << 24)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000413#define S3C2400_GPC12_VD12 (0x02 << 24)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414
415#define S3C2410_GPC13 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 13)
416#define S3C2410_GPC13_INP (0x00 << 26)
417#define S3C2410_GPC13_OUTP (0x01 << 26)
418#define S3C2410_GPC13_VD5 (0x02 << 26)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000419#define S3C2400_GPC13_VD13 (0x02 << 26)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700420
421#define S3C2410_GPC14 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 14)
422#define S3C2410_GPC14_INP (0x00 << 28)
423#define S3C2410_GPC14_OUTP (0x01 << 28)
424#define S3C2410_GPC14_VD6 (0x02 << 28)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000425#define S3C2400_GPC14_VD14 (0x02 << 28)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426
427#define S3C2410_GPC15 S3C2410_GPIONO(S3C2410_GPIO_BANKC, 15)
428#define S3C2410_GPC15_INP (0x00 << 30)
429#define S3C2410_GPC15_OUTP (0x01 << 30)
430#define S3C2410_GPC15_VD7 (0x02 << 30)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000431#define S3C2400_GPC15_VD15 (0x02 << 30)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700432
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000433#define S3C2410_GPC_PUPDIS(x) (1<<(x))
434
435/*
436 * S3C2410: Port D consists of 16 GPIO/Special function
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 *
438 * almost identical setup to port b, but the special functions are mostly
439 * to do with the video system's data.
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000440 *
441 * S3C2400: Port D consists of 11 GPIO/Special function
442 *
443 * almost identical setup to port c
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444*/
445
446#define S3C2410_GPDCON S3C2410_GPIOREG(0x30)
447#define S3C2410_GPDDAT S3C2410_GPIOREG(0x34)
448#define S3C2410_GPDUP S3C2410_GPIOREG(0x38)
449
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000450#define S3C2400_GPDCON S3C2410_GPIOREG(0x20)
451#define S3C2400_GPDDAT S3C2410_GPIOREG(0x24)
452#define S3C2400_GPDUP S3C2410_GPIOREG(0x28)
453
Linus Torvalds1da177e2005-04-16 15:20:36 -0700454#define S3C2410_GPD0 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 0)
455#define S3C2410_GPD0_INP (0x00 << 0)
456#define S3C2410_GPD0_OUTP (0x01 << 0)
457#define S3C2410_GPD0_VD8 (0x02 << 0)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000458#define S3C2400_GPD0_VFRAME (0x02 << 0)
Ben Dooks96ce2382006-06-18 23:06:41 +0100459#define S3C2442_GPD0_nSPICS1 (0x03 << 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700460
461#define S3C2410_GPD1 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 1)
462#define S3C2410_GPD1_INP (0x00 << 2)
463#define S3C2410_GPD1_OUTP (0x01 << 2)
464#define S3C2410_GPD1_VD9 (0x02 << 2)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000465#define S3C2400_GPD1_VM (0x02 << 2)
Ben Dooks96ce2382006-06-18 23:06:41 +0100466#define S3C2442_GPD1_SPICLK1 (0x03 << 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467
468#define S3C2410_GPD2 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 2)
469#define S3C2410_GPD2_INP (0x00 << 4)
470#define S3C2410_GPD2_OUTP (0x01 << 4)
471#define S3C2410_GPD2_VD10 (0x02 << 4)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000472#define S3C2400_GPD2_VLINE (0x02 << 4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473
474#define S3C2410_GPD3 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 3)
475#define S3C2410_GPD3_INP (0x00 << 6)
476#define S3C2410_GPD3_OUTP (0x01 << 6)
477#define S3C2410_GPD3_VD11 (0x02 << 6)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000478#define S3C2400_GPD3_VCLK (0x02 << 6)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479
480#define S3C2410_GPD4 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 4)
481#define S3C2410_GPD4_INP (0x00 << 8)
482#define S3C2410_GPD4_OUTP (0x01 << 8)
483#define S3C2410_GPD4_VD12 (0x02 << 8)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000484#define S3C2400_GPD4_LEND (0x02 << 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700485
486#define S3C2410_GPD5 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 5)
487#define S3C2410_GPD5_INP (0x00 << 10)
488#define S3C2410_GPD5_OUTP (0x01 << 10)
489#define S3C2410_GPD5_VD13 (0x02 << 10)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000490#define S3C2400_GPD5_TOUT0 (0x02 << 10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491
492#define S3C2410_GPD6 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 6)
493#define S3C2410_GPD6_INP (0x00 << 12)
494#define S3C2410_GPD6_OUTP (0x01 << 12)
495#define S3C2410_GPD6_VD14 (0x02 << 12)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000496#define S3C2400_GPD6_TOUT1 (0x02 << 12)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700497
498#define S3C2410_GPD7 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 7)
499#define S3C2410_GPD7_INP (0x00 << 14)
500#define S3C2410_GPD7_OUTP (0x01 << 14)
501#define S3C2410_GPD7_VD15 (0x02 << 14)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000502#define S3C2400_GPD7_TOUT2 (0x02 << 14)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700503
504#define S3C2410_GPD8 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 8)
505#define S3C2410_GPD8_INP (0x00 << 16)
506#define S3C2410_GPD8_OUTP (0x01 << 16)
507#define S3C2410_GPD8_VD16 (0x02 << 16)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000508#define S3C2400_GPD8_TOUT3 (0x02 << 16)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509
510#define S3C2410_GPD9 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 9)
511#define S3C2410_GPD9_INP (0x00 << 18)
512#define S3C2410_GPD9_OUTP (0x01 << 18)
513#define S3C2410_GPD9_VD17 (0x02 << 18)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000514#define S3C2400_GPD9_TCLK0 (0x02 << 18)
515#define S3C2410_GPD9_MASK (0x03 << 18)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516
517#define S3C2410_GPD10 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 10)
518#define S3C2410_GPD10_INP (0x00 << 20)
519#define S3C2410_GPD10_OUTP (0x01 << 20)
520#define S3C2410_GPD10_VD18 (0x02 << 20)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000521#define S3C2400_GPD10_nWAIT (0x02 << 20)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522
523#define S3C2410_GPD11 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 11)
524#define S3C2410_GPD11_INP (0x00 << 22)
525#define S3C2410_GPD11_OUTP (0x01 << 22)
526#define S3C2410_GPD11_VD19 (0x02 << 22)
527
528#define S3C2410_GPD12 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 12)
529#define S3C2410_GPD12_INP (0x00 << 24)
530#define S3C2410_GPD12_OUTP (0x01 << 24)
531#define S3C2410_GPD12_VD20 (0x02 << 24)
532
533#define S3C2410_GPD13 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 13)
534#define S3C2410_GPD13_INP (0x00 << 26)
535#define S3C2410_GPD13_OUTP (0x01 << 26)
536#define S3C2410_GPD13_VD21 (0x02 << 26)
537
538#define S3C2410_GPD14 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 14)
539#define S3C2410_GPD14_INP (0x00 << 28)
540#define S3C2410_GPD14_OUTP (0x01 << 28)
541#define S3C2410_GPD14_VD22 (0x02 << 28)
542
543#define S3C2410_GPD15 S3C2410_GPIONO(S3C2410_GPIO_BANKD, 15)
544#define S3C2410_GPD15_INP (0x00 << 30)
545#define S3C2410_GPD15_OUTP (0x01 << 30)
546#define S3C2410_GPD15_VD23 (0x02 << 30)
547
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000548#define S3C2410_GPD_PUPDIS(x) (1<<(x))
549
550/* S3C2410:
551 * Port E consists of 16 GPIO/Special function
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 *
553 * again, the same as port B, but dealing with I2S, SDI, and
554 * more miscellaneous functions
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000555 *
556 * S3C2400:
557 * Port E consists of 12 GPIO/Special function
558 *
559 * GPIO / interrupt inputs
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560*/
561
562#define S3C2410_GPECON S3C2410_GPIOREG(0x40)
563#define S3C2410_GPEDAT S3C2410_GPIOREG(0x44)
564#define S3C2410_GPEUP S3C2410_GPIOREG(0x48)
565
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000566#define S3C2400_GPECON S3C2410_GPIOREG(0x2C)
567#define S3C2400_GPEDAT S3C2410_GPIOREG(0x30)
568#define S3C2400_GPEUP S3C2410_GPIOREG(0x34)
569
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570#define S3C2410_GPE0 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 0)
571#define S3C2410_GPE0_INP (0x00 << 0)
572#define S3C2410_GPE0_OUTP (0x01 << 0)
573#define S3C2410_GPE0_I2SLRCK (0x02 << 0)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000574#define S3C2400_GPE0_EINT0 (0x02 << 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575#define S3C2410_GPE0_MASK (0x03 << 0)
576
577#define S3C2410_GPE1 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 1)
578#define S3C2410_GPE1_INP (0x00 << 2)
579#define S3C2410_GPE1_OUTP (0x01 << 2)
580#define S3C2410_GPE1_I2SSCLK (0x02 << 2)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000581#define S3C2400_GPE1_EINT1 (0x02 << 2)
582#define S3C2400_GPE1_nSS (0x03 << 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583#define S3C2410_GPE1_MASK (0x03 << 2)
584
585#define S3C2410_GPE2 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 2)
586#define S3C2410_GPE2_INP (0x00 << 4)
587#define S3C2410_GPE2_OUTP (0x01 << 4)
588#define S3C2410_GPE2_CDCLK (0x02 << 4)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000589#define S3C2400_GPE2_EINT2 (0x02 << 4)
590#define S3C2400_GPE2_I2SSDI (0x03 << 4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591
592#define S3C2410_GPE3 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 3)
593#define S3C2410_GPE3_INP (0x00 << 6)
594#define S3C2410_GPE3_OUTP (0x01 << 6)
595#define S3C2410_GPE3_I2SSDI (0x02 << 6)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000596#define S3C2400_GPE3_EINT3 (0x02 << 6)
597#define S3C2400_GPE3_nCTS1 (0x03 << 6)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598#define S3C2410_GPE3_nSS0 (0x03 << 6)
599#define S3C2410_GPE3_MASK (0x03 << 6)
600
601#define S3C2410_GPE4 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 4)
602#define S3C2410_GPE4_INP (0x00 << 8)
603#define S3C2410_GPE4_OUTP (0x01 << 8)
604#define S3C2410_GPE4_I2SSDO (0x02 << 8)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000605#define S3C2400_GPE4_EINT4 (0x02 << 8)
606#define S3C2400_GPE4_nRTS1 (0x03 << 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700607#define S3C2410_GPE4_I2SSDI (0x03 << 8)
608#define S3C2410_GPE4_MASK (0x03 << 8)
609
610#define S3C2410_GPE5 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 5)
611#define S3C2410_GPE5_INP (0x00 << 10)
612#define S3C2410_GPE5_OUTP (0x01 << 10)
613#define S3C2410_GPE5_SDCLK (0x02 << 10)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000614#define S3C2400_GPE5_EINT5 (0x02 << 10)
615#define S3C2400_GPE5_TCLK1 (0x03 << 10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700616
617#define S3C2410_GPE6 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 6)
618#define S3C2410_GPE6_INP (0x00 << 12)
619#define S3C2410_GPE6_OUTP (0x01 << 12)
620#define S3C2410_GPE6_SDCMD (0x02 << 12)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000621#define S3C2400_GPE6_EINT6 (0x02 << 12)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700622
623#define S3C2410_GPE7 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 7)
624#define S3C2410_GPE7_INP (0x00 << 14)
625#define S3C2410_GPE7_OUTP (0x01 << 14)
626#define S3C2410_GPE7_SDDAT0 (0x02 << 14)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000627#define S3C2400_GPE7_EINT7 (0x02 << 14)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700628
629#define S3C2410_GPE8 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 8)
630#define S3C2410_GPE8_INP (0x00 << 16)
631#define S3C2410_GPE8_OUTP (0x01 << 16)
632#define S3C2410_GPE8_SDDAT1 (0x02 << 16)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000633#define S3C2400_GPE8_nXDACK0 (0x02 << 16)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700634
635#define S3C2410_GPE9 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 9)
636#define S3C2410_GPE9_INP (0x00 << 18)
637#define S3C2410_GPE9_OUTP (0x01 << 18)
638#define S3C2410_GPE9_SDDAT2 (0x02 << 18)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000639#define S3C2400_GPE9_nXDACK1 (0x02 << 18)
640#define S3C2400_GPE9_nXBACK (0x03 << 18)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700641
642#define S3C2410_GPE10 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 10)
643#define S3C2410_GPE10_INP (0x00 << 20)
644#define S3C2410_GPE10_OUTP (0x01 << 20)
645#define S3C2410_GPE10_SDDAT3 (0x02 << 20)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000646#define S3C2400_GPE10_nXDREQ0 (0x02 << 20)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647
648#define S3C2410_GPE11 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 11)
649#define S3C2410_GPE11_INP (0x00 << 22)
650#define S3C2410_GPE11_OUTP (0x01 << 22)
651#define S3C2410_GPE11_SPIMISO0 (0x02 << 22)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000652#define S3C2400_GPE11_nXDREQ1 (0x02 << 22)
653#define S3C2400_GPE11_nXBREQ (0x03 << 22)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700654
655#define S3C2410_GPE12 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 12)
656#define S3C2410_GPE12_INP (0x00 << 24)
657#define S3C2410_GPE12_OUTP (0x01 << 24)
658#define S3C2410_GPE12_SPIMOSI0 (0x02 << 24)
659
660#define S3C2410_GPE13 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 13)
661#define S3C2410_GPE13_INP (0x00 << 26)
662#define S3C2410_GPE13_OUTP (0x01 << 26)
663#define S3C2410_GPE13_SPICLK0 (0x02 << 26)
664
665#define S3C2410_GPE14 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 14)
666#define S3C2410_GPE14_INP (0x00 << 28)
667#define S3C2410_GPE14_OUTP (0x01 << 28)
668#define S3C2410_GPE14_IICSCL (0x02 << 28)
669#define S3C2410_GPE14_MASK (0x03 << 28)
670
671#define S3C2410_GPE15 S3C2410_GPIONO(S3C2410_GPIO_BANKE, 15)
672#define S3C2410_GPE15_INP (0x00 << 30)
673#define S3C2410_GPE15_OUTP (0x01 << 30)
674#define S3C2410_GPE15_IICSDA (0x02 << 30)
675#define S3C2410_GPE15_MASK (0x03 << 30)
676
677#define S3C2440_GPE0_ACSYNC (0x03 << 0)
678#define S3C2440_GPE1_ACBITCLK (0x03 << 2)
679#define S3C2440_GPE2_ACRESET (0x03 << 4)
680#define S3C2440_GPE3_ACIN (0x03 << 6)
681#define S3C2440_GPE4_ACOUT (0x03 << 8)
682
683#define S3C2410_GPE_PUPDIS(x) (1<<(x))
684
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000685/* S3C2410:
686 * Port F consists of 8 GPIO/Special function
Linus Torvalds1da177e2005-04-16 15:20:36 -0700687 *
688 * GPIO / interrupt inputs
689 *
690 * GPFCON has 2 bits for each of the input pins on port F
691 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 undefined
692 *
693 * pull up works like all other ports.
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000694 *
695 * S3C2400:
696 * Port F consists of 7 GPIO/Special function
697 *
698 * GPIO/serial/misc pins
Linus Torvalds1da177e2005-04-16 15:20:36 -0700699*/
700
701#define S3C2410_GPFCON S3C2410_GPIOREG(0x50)
702#define S3C2410_GPFDAT S3C2410_GPIOREG(0x54)
703#define S3C2410_GPFUP S3C2410_GPIOREG(0x58)
704
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000705#define S3C2400_GPFCON S3C2410_GPIOREG(0x38)
706#define S3C2400_GPFDAT S3C2410_GPIOREG(0x3C)
707#define S3C2400_GPFUP S3C2410_GPIOREG(0x40)
708
Linus Torvalds1da177e2005-04-16 15:20:36 -0700709#define S3C2410_GPF0 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 0)
710#define S3C2410_GPF0_INP (0x00 << 0)
711#define S3C2410_GPF0_OUTP (0x01 << 0)
712#define S3C2410_GPF0_EINT0 (0x02 << 0)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000713#define S3C2400_GPF0_RXD0 (0x02 << 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700714
715#define S3C2410_GPF1 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 1)
716#define S3C2410_GPF1_INP (0x00 << 2)
717#define S3C2410_GPF1_OUTP (0x01 << 2)
718#define S3C2410_GPF1_EINT1 (0x02 << 2)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000719#define S3C2400_GPF1_RXD1 (0x02 << 2)
720#define S3C2400_GPF1_IICSDA (0x03 << 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700721
722#define S3C2410_GPF2 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 2)
723#define S3C2410_GPF2_INP (0x00 << 4)
724#define S3C2410_GPF2_OUTP (0x01 << 4)
725#define S3C2410_GPF2_EINT2 (0x02 << 4)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000726#define S3C2400_GPF2_TXD0 (0x02 << 4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700727
728#define S3C2410_GPF3 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 3)
729#define S3C2410_GPF3_INP (0x00 << 6)
730#define S3C2410_GPF3_OUTP (0x01 << 6)
731#define S3C2410_GPF3_EINT3 (0x02 << 6)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000732#define S3C2400_GPF3_TXD1 (0x02 << 6)
733#define S3C2400_GPF3_IICSCL (0x03 << 6)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700734
735#define S3C2410_GPF4 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 4)
736#define S3C2410_GPF4_INP (0x00 << 8)
737#define S3C2410_GPF4_OUTP (0x01 << 8)
738#define S3C2410_GPF4_EINT4 (0x02 << 8)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000739#define S3C2400_GPF4_nRTS0 (0x02 << 8)
740#define S3C2400_GPF4_nXBACK (0x03 << 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700741
742#define S3C2410_GPF5 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 5)
743#define S3C2410_GPF5_INP (0x00 << 10)
744#define S3C2410_GPF5_OUTP (0x01 << 10)
745#define S3C2410_GPF5_EINT5 (0x02 << 10)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000746#define S3C2400_GPF5_nCTS0 (0x02 << 10)
747#define S3C2400_GPF5_nXBREQ (0x03 << 10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748
749#define S3C2410_GPF6 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 6)
750#define S3C2410_GPF6_INP (0x00 << 12)
751#define S3C2410_GPF6_OUTP (0x01 << 12)
752#define S3C2410_GPF6_EINT6 (0x02 << 12)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000753#define S3C2400_GPF6_CLKOUT (0x02 << 12)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700754
755#define S3C2410_GPF7 S3C2410_GPIONO(S3C2410_GPIO_BANKF, 7)
756#define S3C2410_GPF7_INP (0x00 << 14)
757#define S3C2410_GPF7_OUTP (0x01 << 14)
758#define S3C2410_GPF7_EINT7 (0x02 << 14)
759
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000760#define S3C2410_GPF_PUPDIS(x) (1<<(x))
761
762/* S3C2410:
763 * Port G consists of 8 GPIO/IRQ/Special function
Linus Torvalds1da177e2005-04-16 15:20:36 -0700764 *
765 * GPGCON has 2 bits for each of the input pins on port F
766 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
767 *
768 * pull up works like all other ports.
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000769 *
770 * S3C2400:
771 * Port G consists of 10 GPIO/Special function
Linus Torvalds1da177e2005-04-16 15:20:36 -0700772*/
773
774#define S3C2410_GPGCON S3C2410_GPIOREG(0x60)
775#define S3C2410_GPGDAT S3C2410_GPIOREG(0x64)
776#define S3C2410_GPGUP S3C2410_GPIOREG(0x68)
777
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000778#define S3C2400_GPGCON S3C2410_GPIOREG(0x44)
779#define S3C2400_GPGDAT S3C2410_GPIOREG(0x48)
780#define S3C2400_GPGUP S3C2410_GPIOREG(0x4C)
781
Linus Torvalds1da177e2005-04-16 15:20:36 -0700782#define S3C2410_GPG0 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 0)
783#define S3C2410_GPG0_INP (0x00 << 0)
784#define S3C2410_GPG0_OUTP (0x01 << 0)
785#define S3C2410_GPG0_EINT8 (0x02 << 0)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000786#define S3C2400_GPG0_I2SLRCK (0x02 << 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787
788#define S3C2410_GPG1 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 1)
789#define S3C2410_GPG1_INP (0x00 << 2)
790#define S3C2410_GPG1_OUTP (0x01 << 2)
791#define S3C2410_GPG1_EINT9 (0x02 << 2)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000792#define S3C2400_GPG1_I2SSCLK (0x02 << 2)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700793
794#define S3C2410_GPG2 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 2)
795#define S3C2410_GPG2_INP (0x00 << 4)
796#define S3C2410_GPG2_OUTP (0x01 << 4)
797#define S3C2410_GPG2_EINT10 (0x02 << 4)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000798#define S3C2400_GPG2_CDCLK (0x02 << 4)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799
800#define S3C2410_GPG3 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 3)
801#define S3C2410_GPG3_INP (0x00 << 6)
802#define S3C2410_GPG3_OUTP (0x01 << 6)
803#define S3C2410_GPG3_EINT11 (0x02 << 6)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000804#define S3C2400_GPG3_I2SSDO (0x02 << 6)
805#define S3C2400_GPG3_I2SSDI (0x03 << 6)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806
807#define S3C2410_GPG4 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 4)
808#define S3C2410_GPG4_INP (0x00 << 8)
809#define S3C2410_GPG4_OUTP (0x01 << 8)
810#define S3C2410_GPG4_EINT12 (0x02 << 8)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000811#define S3C2400_GPG4_MMCCLK (0x02 << 8)
812#define S3C2400_GPG4_I2SSDI (0x03 << 8)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813#define S3C2410_GPG4_LCDPWREN (0x03 << 8)
814
815#define S3C2410_GPG5 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 5)
816#define S3C2410_GPG5_INP (0x00 << 10)
817#define S3C2410_GPG5_OUTP (0x01 << 10)
818#define S3C2410_GPG5_EINT13 (0x02 << 10)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000819#define S3C2400_GPG5_MMCCMD (0x02 << 10)
820#define S3C2400_GPG5_IICSDA (0x03 << 10)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700821#define S3C2410_GPG5_SPIMISO1 (0x03 << 10)
822
823#define S3C2410_GPG6 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 6)
824#define S3C2410_GPG6_INP (0x00 << 12)
825#define S3C2410_GPG6_OUTP (0x01 << 12)
826#define S3C2410_GPG6_EINT14 (0x02 << 12)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000827#define S3C2400_GPG6_MMCDAT (0x02 << 12)
828#define S3C2400_GPG6_IICSCL (0x03 << 12)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700829#define S3C2410_GPG6_SPIMOSI1 (0x03 << 12)
830
831#define S3C2410_GPG7 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 7)
832#define S3C2410_GPG7_INP (0x00 << 14)
833#define S3C2410_GPG7_OUTP (0x01 << 14)
834#define S3C2410_GPG7_EINT15 (0x02 << 14)
835#define S3C2410_GPG7_SPICLK1 (0x03 << 14)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000836#define S3C2400_GPG7_SPIMISO (0x02 << 14)
837#define S3C2400_GPG7_IICSDA (0x03 << 14)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838
839#define S3C2410_GPG8 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 8)
840#define S3C2410_GPG8_INP (0x00 << 16)
841#define S3C2410_GPG8_OUTP (0x01 << 16)
842#define S3C2410_GPG8_EINT16 (0x02 << 16)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000843#define S3C2400_GPG8_SPIMOSI (0x02 << 16)
844#define S3C2400_GPG8_IICSCL (0x03 << 16)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700845
846#define S3C2410_GPG9 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 9)
847#define S3C2410_GPG9_INP (0x00 << 18)
848#define S3C2410_GPG9_OUTP (0x01 << 18)
849#define S3C2410_GPG9_EINT17 (0x02 << 18)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000850#define S3C2400_GPG9_SPICLK (0x02 << 18)
851#define S3C2400_GPG9_MMCCLK (0x03 << 18)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700852
853#define S3C2410_GPG10 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 10)
854#define S3C2410_GPG10_INP (0x00 << 20)
855#define S3C2410_GPG10_OUTP (0x01 << 20)
856#define S3C2410_GPG10_EINT18 (0x02 << 20)
857
858#define S3C2410_GPG11 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 11)
859#define S3C2410_GPG11_INP (0x00 << 22)
860#define S3C2410_GPG11_OUTP (0x01 << 22)
861#define S3C2410_GPG11_EINT19 (0x02 << 22)
862#define S3C2410_GPG11_TCLK1 (0x03 << 22)
863
864#define S3C2410_GPG12 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 12)
865#define S3C2410_GPG12_INP (0x00 << 24)
866#define S3C2410_GPG12_OUTP (0x01 << 24)
867#define S3C2410_GPG12_EINT20 (0x02 << 24)
868#define S3C2410_GPG12_XMON (0x03 << 24)
Ben Dooks96ce2382006-06-18 23:06:41 +0100869#define S3C2442_GPG12_nSPICS0 (0x03 << 24)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870
871#define S3C2410_GPG13 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 13)
872#define S3C2410_GPG13_INP (0x00 << 26)
873#define S3C2410_GPG13_OUTP (0x01 << 26)
874#define S3C2410_GPG13_EINT21 (0x02 << 26)
875#define S3C2410_GPG13_nXPON (0x03 << 26)
876
877#define S3C2410_GPG14 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 14)
878#define S3C2410_GPG14_INP (0x00 << 28)
879#define S3C2410_GPG14_OUTP (0x01 << 28)
880#define S3C2410_GPG14_EINT22 (0x02 << 28)
881#define S3C2410_GPG14_YMON (0x03 << 28)
882
883#define S3C2410_GPG15 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 15)
884#define S3C2410_GPG15_INP (0x00 << 30)
885#define S3C2410_GPG15_OUTP (0x01 << 30)
886#define S3C2410_GPG15_EINT23 (0x02 << 30)
887#define S3C2410_GPG15_nYPON (0x03 << 30)
888
889
890#define S3C2410_GPG_PUPDIS(x) (1<<(x))
891
892/* Port H consists of11 GPIO/serial/Misc pins
893 *
894 * GPGCON has 2 bits for each of the input pins on port F
895 * 00 = 0 input, 1 output, 2 interrupt (EINT0..7), 3 special func
896 *
897 * pull up works like all other ports.
898*/
899
900#define S3C2410_GPHCON S3C2410_GPIOREG(0x70)
901#define S3C2410_GPHDAT S3C2410_GPIOREG(0x74)
902#define S3C2410_GPHUP S3C2410_GPIOREG(0x78)
903
904#define S3C2410_GPH0 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 0)
905#define S3C2410_GPH0_INP (0x00 << 0)
906#define S3C2410_GPH0_OUTP (0x01 << 0)
907#define S3C2410_GPH0_nCTS0 (0x02 << 0)
908
909#define S3C2410_GPH1 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 1)
910#define S3C2410_GPH1_INP (0x00 << 2)
911#define S3C2410_GPH1_OUTP (0x01 << 2)
912#define S3C2410_GPH1_nRTS0 (0x02 << 2)
913
914#define S3C2410_GPH2 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 2)
915#define S3C2410_GPH2_INP (0x00 << 4)
916#define S3C2410_GPH2_OUTP (0x01 << 4)
917#define S3C2410_GPH2_TXD0 (0x02 << 4)
918
919#define S3C2410_GPH3 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 3)
920#define S3C2410_GPH3_INP (0x00 << 6)
921#define S3C2410_GPH3_OUTP (0x01 << 6)
922#define S3C2410_GPH3_RXD0 (0x02 << 6)
923
924#define S3C2410_GPH4 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 4)
925#define S3C2410_GPH4_INP (0x00 << 8)
926#define S3C2410_GPH4_OUTP (0x01 << 8)
927#define S3C2410_GPH4_TXD1 (0x02 << 8)
928
929#define S3C2410_GPH5 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 5)
930#define S3C2410_GPH5_INP (0x00 << 10)
931#define S3C2410_GPH5_OUTP (0x01 << 10)
932#define S3C2410_GPH5_RXD1 (0x02 << 10)
933
934#define S3C2410_GPH6 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 6)
935#define S3C2410_GPH6_INP (0x00 << 12)
936#define S3C2410_GPH6_OUTP (0x01 << 12)
937#define S3C2410_GPH6_TXD2 (0x02 << 12)
938#define S3C2410_GPH6_nRTS1 (0x03 << 12)
939
940#define S3C2410_GPH7 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 7)
941#define S3C2410_GPH7_INP (0x00 << 14)
942#define S3C2410_GPH7_OUTP (0x01 << 14)
943#define S3C2410_GPH7_RXD2 (0x02 << 14)
944#define S3C2410_GPH7_nCTS1 (0x03 << 14)
945
946#define S3C2410_GPH8 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 8)
947#define S3C2410_GPH8_INP (0x00 << 16)
948#define S3C2410_GPH8_OUTP (0x01 << 16)
949#define S3C2410_GPH8_UCLK (0x02 << 16)
950
951#define S3C2410_GPH9 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 9)
952#define S3C2410_GPH9_INP (0x00 << 18)
953#define S3C2410_GPH9_OUTP (0x01 << 18)
954#define S3C2410_GPH9_CLKOUT0 (0x02 << 18)
Ben Dooks96ce2382006-06-18 23:06:41 +0100955#define S3C2442_GPH9_nSPICS0 (0x03 << 18)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700956
957#define S3C2410_GPH10 S3C2410_GPIONO(S3C2410_GPIO_BANKH, 10)
958#define S3C2410_GPH10_INP (0x00 << 20)
959#define S3C2410_GPH10_OUTP (0x01 << 20)
960#define S3C2410_GPH10_CLKOUT1 (0x02 << 20)
961
Ben Dooks68d9ab32006-06-24 21:21:27 +0100962/* The S3C2412 and S3C2413 move the GPJ register set to after
963 * GPH, which means all registers after 0x80 are now offset by 0x10
964 * for the 2412/2413 from the 2410/2440/2442
965*/
966
Linus Torvalds1da177e2005-04-16 15:20:36 -0700967/* miscellaneous control */
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000968#define S3C2400_MISCCR S3C2410_GPIOREG(0x54)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700969#define S3C2410_MISCCR S3C2410_GPIOREG(0x80)
970#define S3C2410_DCLKCON S3C2410_GPIOREG(0x84)
971
Ben Dooks68d9ab32006-06-24 21:21:27 +0100972#define S3C24XX_DCLKCON S3C24XX_GPIOREG2(0x84)
973
Linus Torvalds1da177e2005-04-16 15:20:36 -0700974/* see clock.h for dclk definitions */
975
976/* pullup control on databus */
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000977#define S3C2410_MISCCR_SPUCR_HEN (0<<0)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700978#define S3C2410_MISCCR_SPUCR_HDIS (1<<0)
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000979#define S3C2410_MISCCR_SPUCR_LEN (0<<1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700980#define S3C2410_MISCCR_SPUCR_LDIS (1<<1)
981
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +0000982#define S3C2400_MISCCR_SPUCR_LEN (0<<0)
983#define S3C2400_MISCCR_SPUCR_LDIS (1<<0)
984#define S3C2400_MISCCR_SPUCR_HEN (0<<1)
985#define S3C2400_MISCCR_SPUCR_HDIS (1<<1)
986
987#define S3C2400_MISCCR_HZ_STOPEN (0<<2)
988#define S3C2400_MISCCR_HZ_STOPPREV (1<<2)
989
990#define S3C2410_MISCCR_USBDEV (0<<3)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700991#define S3C2410_MISCCR_USBHOST (1<<3)
992
993#define S3C2410_MISCCR_CLK0_MPLL (0<<4)
994#define S3C2410_MISCCR_CLK0_UPLL (1<<4)
995#define S3C2410_MISCCR_CLK0_FCLK (2<<4)
996#define S3C2410_MISCCR_CLK0_HCLK (3<<4)
997#define S3C2410_MISCCR_CLK0_PCLK (4<<4)
998#define S3C2410_MISCCR_CLK0_DCLK0 (5<<4)
Ben Dooks3fc3e1c2006-03-20 17:10:07 +0000999#define S3C2410_MISCCR_CLK0_MASK (7<<4)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001000
Ben Dooks68d9ab32006-06-24 21:21:27 +01001001#define S3C2412_MISCCR_CLK0_RTC (2<<4)
1002
Linus Torvalds1da177e2005-04-16 15:20:36 -07001003#define S3C2410_MISCCR_CLK1_MPLL (0<<8)
1004#define S3C2410_MISCCR_CLK1_UPLL (1<<8)
1005#define S3C2410_MISCCR_CLK1_FCLK (2<<8)
1006#define S3C2410_MISCCR_CLK1_HCLK (3<<8)
1007#define S3C2410_MISCCR_CLK1_PCLK (4<<8)
1008#define S3C2410_MISCCR_CLK1_DCLK1 (5<<8)
Ben Dooks3fc3e1c2006-03-20 17:10:07 +00001009#define S3C2410_MISCCR_CLK1_MASK (7<<8)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001010
Ben Dooks68d9ab32006-06-24 21:21:27 +01001011#define S3C2412_MISCCR_CLK1_CLKsrc (0<<8)
1012
Linus Torvalds1da177e2005-04-16 15:20:36 -07001013#define S3C2410_MISCCR_USBSUSPND0 (1<<12)
1014#define S3C2410_MISCCR_USBSUSPND1 (1<<13)
1015
1016#define S3C2410_MISCCR_nRSTCON (1<<16)
1017
1018#define S3C2410_MISCCR_nEN_SCLK0 (1<<17)
1019#define S3C2410_MISCCR_nEN_SCLK1 (1<<18)
Ben Dooks68d9ab32006-06-24 21:21:27 +01001020#define S3C2410_MISCCR_nEN_SCLKE (1<<19) /* not 2412 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07001021#define S3C2410_MISCCR_SDSLEEP (7<<17)
1022
1023/* external interrupt control... */
1024/* S3C2410_EXTINT0 -> irq sense control for EINT0..EINT7
1025 * S3C2410_EXTINT1 -> irq sense control for EINT8..EINT15
1026 * S3C2410_EXTINT2 -> irq sense control for EINT16..EINT23
1027 *
1028 * note S3C2410_EXTINT2 has filtering options for EINT16..EINT23
1029 *
1030 * Samsung datasheet p9-25
1031*/
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +00001032#define S3C2400_EXTINT0 S3C2410_GPIOREG(0x58)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001033#define S3C2410_EXTINT0 S3C2410_GPIOREG(0x88)
1034#define S3C2410_EXTINT1 S3C2410_GPIOREG(0x8C)
1035#define S3C2410_EXTINT2 S3C2410_GPIOREG(0x90)
1036
Ben Dooks68d9ab32006-06-24 21:21:27 +01001037#define S3C24XX_EXTINT0 S3C24XX_GPIOREG2(0x88)
1038#define S3C24XX_EXTINT1 S3C24XX_GPIOREG2(0x8C)
1039#define S3C24XX_EXTINT2 S3C24XX_GPIOREG2(0x90)
1040
Linus Torvalds1da177e2005-04-16 15:20:36 -07001041/* values for S3C2410_EXTINT0/1/2 */
1042#define S3C2410_EXTINT_LOWLEV (0x00)
1043#define S3C2410_EXTINT_HILEV (0x01)
1044#define S3C2410_EXTINT_FALLEDGE (0x02)
1045#define S3C2410_EXTINT_RISEEDGE (0x04)
1046#define S3C2410_EXTINT_BOTHEDGE (0x06)
1047
1048/* interrupt filtering conrrol for EINT16..EINT23 */
1049#define S3C2410_EINFLT0 S3C2410_GPIOREG(0x94)
1050#define S3C2410_EINFLT1 S3C2410_GPIOREG(0x98)
1051#define S3C2410_EINFLT2 S3C2410_GPIOREG(0x9C)
1052#define S3C2410_EINFLT3 S3C2410_GPIOREG(0xA0)
1053
Ben Dooks68d9ab32006-06-24 21:21:27 +01001054#define S3C24XX_EINFLT0 S3C24XX_GPIOREG2(0x94)
1055#define S3C24XX_EINFLT1 S3C24XX_GPIOREG2(0x98)
1056#define S3C24XX_EINFLT2 S3C24XX_GPIOREG2(0x9C)
1057#define S3C24XX_EINFLT3 S3C24XX_GPIOREG2(0xA0)
1058
Linus Torvalds1da177e2005-04-16 15:20:36 -07001059/* values for interrupt filtering */
1060#define S3C2410_EINTFLT_PCLK (0x00)
1061#define S3C2410_EINTFLT_EXTCLK (1<<7)
1062#define S3C2410_EINTFLT_WIDTHMSK(x) ((x) & 0x3f)
1063
1064/* removed EINTxxxx defs from here, not meant for this */
1065
1066/* GSTATUS have miscellaneous information in them
1067 *
Ben Dooks68d9ab32006-06-24 21:21:27 +01001068 * These move between s3c2410 and s3c2412 style systems.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001069 */
1070
1071#define S3C2410_GSTATUS0 S3C2410_GPIOREG(0x0AC)
1072#define S3C2410_GSTATUS1 S3C2410_GPIOREG(0x0B0)
1073#define S3C2410_GSTATUS2 S3C2410_GPIOREG(0x0B4)
1074#define S3C2410_GSTATUS3 S3C2410_GPIOREG(0x0B8)
1075#define S3C2410_GSTATUS4 S3C2410_GPIOREG(0x0BC)
1076
Ben Dooks68d9ab32006-06-24 21:21:27 +01001077#define S3C2412_GSTATUS0 S3C2410_GPIOREG(0x0BC)
1078#define S3C2412_GSTATUS1 S3C2410_GPIOREG(0x0C0)
1079#define S3C2412_GSTATUS2 S3C2410_GPIOREG(0x0C4)
1080#define S3C2412_GSTATUS3 S3C2410_GPIOREG(0x0C8)
1081#define S3C2412_GSTATUS4 S3C2410_GPIOREG(0x0CC)
1082
1083#define S3C24XX_GSTATUS0 S3C24XX_GPIOREG2(0x0AC)
1084#define S3C24XX_GSTATUS1 S3C24XX_GPIOREG2(0x0B0)
1085#define S3C24XX_GSTATUS2 S3C24XX_GPIOREG2(0x0B4)
1086#define S3C24XX_GSTATUS3 S3C24XX_GPIOREG2(0x0B8)
1087#define S3C24XX_GSTATUS4 S3C24XX_GPIOREG2(0x0BC)
1088
Linus Torvalds1da177e2005-04-16 15:20:36 -07001089#define S3C2410_GSTATUS0_nWAIT (1<<3)
1090#define S3C2410_GSTATUS0_NCON (1<<2)
1091#define S3C2410_GSTATUS0_RnB (1<<1)
1092#define S3C2410_GSTATUS0_nBATTFLT (1<<0)
1093
1094#define S3C2410_GSTATUS1_IDMASK (0xffff0000)
1095#define S3C2410_GSTATUS1_2410 (0x32410000)
Ben Dooks68d9ab32006-06-24 21:21:27 +01001096#define S3C2410_GSTATUS1_2412 (0x32412001)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001097#define S3C2410_GSTATUS1_2440 (0x32440000)
Ben Dooks96ce2382006-06-18 23:06:41 +01001098#define S3C2410_GSTATUS1_2442 (0x32440aaa)
Linus Torvalds1da177e2005-04-16 15:20:36 -07001099
1100#define S3C2410_GSTATUS2_WTRESET (1<<2)
1101#define S3C2410_GSTATUS2_OFFRESET (1<<1)
1102#define S3C2410_GSTATUS2_PONRESET (1<<0)
1103
Lucas Correia Villa Real192cdc52005-11-28 18:08:43 +00001104/* open drain control register */
1105#define S3C2400_OPENCR S3C2410_GPIOREG(0x50)
1106
1107#define S3C2400_OPENCR_OPC_RXD1DIS (0<<0)
1108#define S3C2400_OPENCR_OPC_RXD1EN (1<<0)
1109#define S3C2400_OPENCR_OPC_TXD1DIS (0<<1)
1110#define S3C2400_OPENCR_OPC_TXD1EN (1<<1)
1111#define S3C2400_OPENCR_OPC_CMDDIS (0<<2)
1112#define S3C2400_OPENCR_OPC_CMDEN (1<<2)
1113#define S3C2400_OPENCR_OPC_DATDIS (0<<3)
1114#define S3C2400_OPENCR_OPC_DATEN (1<<3)
1115#define S3C2400_OPENCR_OPC_MISODIS (0<<4)
1116#define S3C2400_OPENCR_OPC_MISOEN (1<<4)
1117#define S3C2400_OPENCR_OPC_MOSIDIS (0<<5)
1118#define S3C2400_OPENCR_OPC_MOSIEN (1<<5)
1119
Ben Dooks68d9ab32006-06-24 21:21:27 +01001120/* 2412/2413 sleep configuration registers */
1121
1122#define S3C2412_GPBSLPCON S3C2410_GPIOREG(0x1C)
1123#define S3C2412_GPCSLPCON S3C2410_GPIOREG(0x2C)
1124#define S3C2412_GPDSLPCON S3C2410_GPIOREG(0x3C)
1125#define S3C2412_GPESLPCON S3C2410_GPIOREG(0x4C)
1126#define S3C2412_GPFSLPCON S3C2410_GPIOREG(0x5C)
1127#define S3C2412_GPGSLPCON S3C2410_GPIOREG(0x6C)
1128#define S3C2412_GPHSLPCON S3C2410_GPIOREG(0x7C)
1129
1130/* definitions for each pin bit */
1131#define S3C2412_SLPCON_LOW(x) ( 0x00 << ((x) * 2))
1132#define S3C2412_SLPCON_HI(x) ( 0x01 << ((x) * 2))
1133#define S3C2412_SLPCON_IN(x) ( 0x02 << ((x) * 2))
1134#define S3C2412_SLPCON_PDWN(x) ( 0x03 << ((x) * 2))
1135#define S3C2412_SLPCON_MASK(x) ( 0x03 << ((x) * 2))
1136
Linus Torvalds1da177e2005-04-16 15:20:36 -07001137#endif /* __ASM_ARCH_REGS_GPIO_H */
1138