aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2410
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-s3c2410')
-rw-r--r--arch/arm/mach-s3c2410/Makefile5
-rw-r--r--arch/arm/mach-s3c2410/cpu.c18
-rw-r--r--arch/arm/mach-s3c2410/cpu.h3
-rw-r--r--arch/arm/mach-s3c2410/devs.c57
-rw-r--r--arch/arm/mach-s3c2410/dma.c2
-rw-r--r--arch/arm/mach-s3c2410/gpio.c72
-rw-r--r--arch/arm/mach-s3c2410/s3c2400-gpio.c45
-rw-r--r--arch/arm/mach-s3c2410/s3c2410-gpio.c93
-rw-r--r--arch/arm/mach-s3c2410/sleep.S8
9 files changed, 203 insertions, 100 deletions
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index b4f1e051c768..1217bf00309c 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -10,9 +10,13 @@ obj-m :=
10obj-n := 10obj-n :=
11obj- := 11obj- :=
12 12
13# S3C2400 support files
14obj-$(CONFIG_CPU_S3C2400) += s3c2400-gpio.o
15
13# S3C2410 support files 16# S3C2410 support files
14 17
15obj-$(CONFIG_CPU_S3C2410) += s3c2410.o 18obj-$(CONFIG_CPU_S3C2410) += s3c2410.o
19obj-$(CONFIG_CPU_S3C2410) += s3c2410-gpio.o
16obj-$(CONFIG_S3C2410_DMA) += dma.o 20obj-$(CONFIG_S3C2410_DMA) += dma.o
17 21
18# Power Management support 22# Power Management support
@@ -25,6 +29,7 @@ obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
25obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o 29obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o
26obj-$(CONFIG_CPU_S3C2440) += s3c2440-irq.o 30obj-$(CONFIG_CPU_S3C2440) += s3c2440-irq.o
27obj-$(CONFIG_CPU_S3C2440) += s3c2440-clock.o 31obj-$(CONFIG_CPU_S3C2440) += s3c2440-clock.o
32obj-$(CONFIG_CPU_S3C2440) += s3c2410-gpio.o
28 33
29# bast extras 34# bast extras
30 35
diff --git a/arch/arm/mach-s3c2410/cpu.c b/arch/arm/mach-s3c2410/cpu.c
index 687fe371369d..00a379334b60 100644
--- a/arch/arm/mach-s3c2410/cpu.c
+++ b/arch/arm/mach-s3c2410/cpu.c
@@ -40,6 +40,7 @@
40 40
41#include "cpu.h" 41#include "cpu.h"
42#include "clock.h" 42#include "clock.h"
43#include "s3c2400.h"
43#include "s3c2410.h" 44#include "s3c2410.h"
44#include "s3c2440.h" 45#include "s3c2440.h"
45 46
@@ -55,6 +56,7 @@ struct cpu_table {
55 56
56/* table of supported CPUs */ 57/* table of supported CPUs */
57 58
59static const char name_s3c2400[] = "S3C2400";
58static const char name_s3c2410[] = "S3C2410"; 60static const char name_s3c2410[] = "S3C2410";
59static const char name_s3c2440[] = "S3C2440"; 61static const char name_s3c2440[] = "S3C2440";
60static const char name_s3c2410a[] = "S3C2410A"; 62static const char name_s3c2410a[] = "S3C2410A";
@@ -96,7 +98,16 @@ static struct cpu_table cpu_ids[] __initdata = {
96 .init_uarts = s3c2440_init_uarts, 98 .init_uarts = s3c2440_init_uarts,
97 .init = s3c2440_init, 99 .init = s3c2440_init,
98 .name = name_s3c2440a 100 .name = name_s3c2440a
99 } 101 },
102 {
103 .idcode = 0x0, /* S3C2400 doesn't have an idcode */
104 .idmask = 0xffffffff,
105 .map_io = s3c2400_map_io,
106 .init_clocks = s3c2400_init_clocks,
107 .init_uarts = s3c2400_init_uarts,
108 .init = s3c2400_init,
109 .name = name_s3c2400
110 },
100}; 111};
101 112
102/* minimal IO mapping */ 113/* minimal IO mapping */
@@ -148,12 +159,15 @@ static struct cpu_table *cpu;
148 159
149void __init s3c24xx_init_io(struct map_desc *mach_desc, int size) 160void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
150{ 161{
151 unsigned long idcode; 162 unsigned long idcode = 0x0;
152 163
153 /* initialise the io descriptors we need for initialisation */ 164 /* initialise the io descriptors we need for initialisation */
154 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc)); 165 iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
155 166
167#ifndef CONFIG_CPU_S3C2400
156 idcode = __raw_readl(S3C2410_GSTATUS1); 168 idcode = __raw_readl(S3C2410_GSTATUS1);
169#endif
170
157 cpu = s3c_lookup_cpu(idcode); 171 cpu = s3c_lookup_cpu(idcode);
158 172
159 if (cpu == NULL) { 173 if (cpu == NULL) {
diff --git a/arch/arm/mach-s3c2410/cpu.h b/arch/arm/mach-s3c2410/cpu.h
index 9cbe5eef492b..fc1067783f6d 100644
--- a/arch/arm/mach-s3c2410/cpu.h
+++ b/arch/arm/mach-s3c2410/cpu.h
@@ -17,11 +17,12 @@
17 * 14-Jan-2005 BJD Added s3c24xx_init_clocks() call 17 * 14-Jan-2005 BJD Added s3c24xx_init_clocks() call
18 * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ} & IODESC_ENT 18 * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ} & IODESC_ENT
19 * 14-Mar-2005 BJD Updated for __iomem 19 * 14-Mar-2005 BJD Updated for __iomem
20 * 15-Jan-2006 LCVR Updated S3C2410_PA_##x to new S3C24XX_PA_##x macro
20*/ 21*/
21 22
22/* todo - fix when rmk changes iodescs to use `void __iomem *` */ 23/* todo - fix when rmk changes iodescs to use `void __iomem *` */
23 24
24#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C2410_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } 25#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
25 26
26#ifndef MHZ 27#ifndef MHZ
27#define MHZ (1000*1000) 28#define MHZ (1000*1000)
diff --git a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c
index f58406e6ef5a..b8d994a24d1c 100644
--- a/arch/arm/mach-s3c2410/devs.c
+++ b/arch/arm/mach-s3c2410/devs.c
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 * 11 *
12 * Modifications: 12 * Modifications:
13 * 15-Jan-2006 LCVR Using S3C24XX_PA_##x macro for common S3C24XX devices
13 * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ} 14 * 10-Mar-2005 LCVR Changed S3C2410_{VA,SZ} to S3C24XX_{VA,SZ}
14 * 10-Feb-2005 BJD Added camera from guillaume.gourat@nexvision.tv 15 * 10-Feb-2005 BJD Added camera from guillaume.gourat@nexvision.tv
15 * 29-Aug-2004 BJD Added timers 0 through 3 16 * 29-Aug-2004 BJD Added timers 0 through 3
@@ -46,8 +47,8 @@ struct platform_device *s3c24xx_uart_devs[3];
46 47
47static struct resource s3c_usb_resource[] = { 48static struct resource s3c_usb_resource[] = {
48 [0] = { 49 [0] = {
49 .start = S3C2410_PA_USBHOST, 50 .start = S3C24XX_PA_USBHOST,
50 .end = S3C2410_PA_USBHOST + S3C24XX_SZ_USBHOST - 1, 51 .end = S3C24XX_PA_USBHOST + S3C24XX_SZ_USBHOST - 1,
51 .flags = IORESOURCE_MEM, 52 .flags = IORESOURCE_MEM,
52 }, 53 },
53 [1] = { 54 [1] = {
@@ -76,8 +77,8 @@ EXPORT_SYMBOL(s3c_device_usb);
76 77
77static struct resource s3c_lcd_resource[] = { 78static struct resource s3c_lcd_resource[] = {
78 [0] = { 79 [0] = {
79 .start = S3C2410_PA_LCD, 80 .start = S3C24XX_PA_LCD,
80 .end = S3C2410_PA_LCD + S3C24XX_SZ_LCD - 1, 81 .end = S3C24XX_PA_LCD + S3C24XX_SZ_LCD - 1,
81 .flags = IORESOURCE_MEM, 82 .flags = IORESOURCE_MEM,
82 }, 83 },
83 [1] = { 84 [1] = {
@@ -139,8 +140,8 @@ EXPORT_SYMBOL(s3c_device_nand);
139 140
140static struct resource s3c_usbgadget_resource[] = { 141static struct resource s3c_usbgadget_resource[] = {
141 [0] = { 142 [0] = {
142 .start = S3C2410_PA_USBDEV, 143 .start = S3C24XX_PA_USBDEV,
143 .end = S3C2410_PA_USBDEV + S3C24XX_SZ_USBDEV - 1, 144 .end = S3C24XX_PA_USBDEV + S3C24XX_SZ_USBDEV - 1,
144 .flags = IORESOURCE_MEM, 145 .flags = IORESOURCE_MEM,
145 }, 146 },
146 [1] = { 147 [1] = {
@@ -164,8 +165,8 @@ EXPORT_SYMBOL(s3c_device_usbgadget);
164 165
165static struct resource s3c_wdt_resource[] = { 166static struct resource s3c_wdt_resource[] = {
166 [0] = { 167 [0] = {
167 .start = S3C2410_PA_WATCHDOG, 168 .start = S3C24XX_PA_WATCHDOG,
168 .end = S3C2410_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1, 169 .end = S3C24XX_PA_WATCHDOG + S3C24XX_SZ_WATCHDOG - 1,
169 .flags = IORESOURCE_MEM, 170 .flags = IORESOURCE_MEM,
170 }, 171 },
171 [1] = { 172 [1] = {
@@ -189,8 +190,8 @@ EXPORT_SYMBOL(s3c_device_wdt);
189 190
190static struct resource s3c_i2c_resource[] = { 191static struct resource s3c_i2c_resource[] = {
191 [0] = { 192 [0] = {
192 .start = S3C2410_PA_IIC, 193 .start = S3C24XX_PA_IIC,
193 .end = S3C2410_PA_IIC + S3C24XX_SZ_IIC - 1, 194 .end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
194 .flags = IORESOURCE_MEM, 195 .flags = IORESOURCE_MEM,
195 }, 196 },
196 [1] = { 197 [1] = {
@@ -214,8 +215,8 @@ EXPORT_SYMBOL(s3c_device_i2c);
214 215
215static struct resource s3c_iis_resource[] = { 216static struct resource s3c_iis_resource[] = {
216 [0] = { 217 [0] = {
217 .start = S3C2410_PA_IIS, 218 .start = S3C24XX_PA_IIS,
218 .end = S3C2410_PA_IIS + S3C24XX_SZ_IIS -1, 219 .end = S3C24XX_PA_IIS + S3C24XX_SZ_IIS -1,
219 .flags = IORESOURCE_MEM, 220 .flags = IORESOURCE_MEM,
220 } 221 }
221}; 222};
@@ -239,8 +240,8 @@ EXPORT_SYMBOL(s3c_device_iis);
239 240
240static struct resource s3c_rtc_resource[] = { 241static struct resource s3c_rtc_resource[] = {
241 [0] = { 242 [0] = {
242 .start = S3C2410_PA_RTC, 243 .start = S3C24XX_PA_RTC,
243 .end = S3C2410_PA_RTC + 0xff, 244 .end = S3C24XX_PA_RTC + 0xff,
244 .flags = IORESOURCE_MEM, 245 .flags = IORESOURCE_MEM,
245 }, 246 },
246 [1] = { 247 [1] = {
@@ -268,8 +269,8 @@ EXPORT_SYMBOL(s3c_device_rtc);
268 269
269static struct resource s3c_adc_resource[] = { 270static struct resource s3c_adc_resource[] = {
270 [0] = { 271 [0] = {
271 .start = S3C2410_PA_ADC, 272 .start = S3C24XX_PA_ADC,
272 .end = S3C2410_PA_ADC + S3C24XX_SZ_ADC - 1, 273 .end = S3C24XX_PA_ADC + S3C24XX_SZ_ADC - 1,
273 .flags = IORESOURCE_MEM, 274 .flags = IORESOURCE_MEM,
274 }, 275 },
275 [1] = { 276 [1] = {
@@ -316,8 +317,8 @@ EXPORT_SYMBOL(s3c_device_sdi);
316 317
317static struct resource s3c_spi0_resource[] = { 318static struct resource s3c_spi0_resource[] = {
318 [0] = { 319 [0] = {
319 .start = S3C2410_PA_SPI, 320 .start = S3C24XX_PA_SPI,
320 .end = S3C2410_PA_SPI + 0x1f, 321 .end = S3C24XX_PA_SPI + 0x1f,
321 .flags = IORESOURCE_MEM, 322 .flags = IORESOURCE_MEM,
322 }, 323 },
323 [1] = { 324 [1] = {
@@ -341,8 +342,8 @@ EXPORT_SYMBOL(s3c_device_spi0);
341 342
342static struct resource s3c_spi1_resource[] = { 343static struct resource s3c_spi1_resource[] = {
343 [0] = { 344 [0] = {
344 .start = S3C2410_PA_SPI + 0x20, 345 .start = S3C24XX_PA_SPI + 0x20,
345 .end = S3C2410_PA_SPI + 0x20 + 0x1f, 346 .end = S3C24XX_PA_SPI + 0x20 + 0x1f,
346 .flags = IORESOURCE_MEM, 347 .flags = IORESOURCE_MEM,
347 }, 348 },
348 [1] = { 349 [1] = {
@@ -366,8 +367,8 @@ EXPORT_SYMBOL(s3c_device_spi1);
366 367
367static struct resource s3c_timer0_resource[] = { 368static struct resource s3c_timer0_resource[] = {
368 [0] = { 369 [0] = {
369 .start = S3C2410_PA_TIMER + 0x0C, 370 .start = S3C24XX_PA_TIMER + 0x0C,
370 .end = S3C2410_PA_TIMER + 0x0C + 0xB, 371 .end = S3C24XX_PA_TIMER + 0x0C + 0xB,
371 .flags = IORESOURCE_MEM, 372 .flags = IORESOURCE_MEM,
372 }, 373 },
373 [1] = { 374 [1] = {
@@ -391,8 +392,8 @@ EXPORT_SYMBOL(s3c_device_timer0);
391 392
392static struct resource s3c_timer1_resource[] = { 393static struct resource s3c_timer1_resource[] = {
393 [0] = { 394 [0] = {
394 .start = S3C2410_PA_TIMER + 0x18, 395 .start = S3C24XX_PA_TIMER + 0x18,
395 .end = S3C2410_PA_TIMER + 0x23, 396 .end = S3C24XX_PA_TIMER + 0x23,
396 .flags = IORESOURCE_MEM, 397 .flags = IORESOURCE_MEM,
397 }, 398 },
398 [1] = { 399 [1] = {
@@ -416,8 +417,8 @@ EXPORT_SYMBOL(s3c_device_timer1);
416 417
417static struct resource s3c_timer2_resource[] = { 418static struct resource s3c_timer2_resource[] = {
418 [0] = { 419 [0] = {
419 .start = S3C2410_PA_TIMER + 0x24, 420 .start = S3C24XX_PA_TIMER + 0x24,
420 .end = S3C2410_PA_TIMER + 0x2F, 421 .end = S3C24XX_PA_TIMER + 0x2F,
421 .flags = IORESOURCE_MEM, 422 .flags = IORESOURCE_MEM,
422 }, 423 },
423 [1] = { 424 [1] = {
@@ -441,8 +442,8 @@ EXPORT_SYMBOL(s3c_device_timer2);
441 442
442static struct resource s3c_timer3_resource[] = { 443static struct resource s3c_timer3_resource[] = {
443 [0] = { 444 [0] = {
444 .start = S3C2410_PA_TIMER + 0x30, 445 .start = S3C24XX_PA_TIMER + 0x30,
445 .end = S3C2410_PA_TIMER + 0x3B, 446 .end = S3C24XX_PA_TIMER + 0x3B,
446 .flags = IORESOURCE_MEM, 447 .flags = IORESOURCE_MEM,
447 }, 448 },
448 [1] = { 449 [1] = {
diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
index 65feaf20d23e..4dbd8e758ea6 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c2410/dma.c
@@ -1152,7 +1152,7 @@ static int __init s3c2410_init_dma(void)
1152 1152
1153 printk("S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics\n"); 1153 printk("S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics\n");
1154 1154
1155 dma_base = ioremap(S3C2410_PA_DMA, 0x200); 1155 dma_base = ioremap(S3C24XX_PA_DMA, 0x200);
1156 if (dma_base == NULL) { 1156 if (dma_base == NULL) {
1157 printk(KERN_ERR "dma failed to remap register block\n"); 1157 printk(KERN_ERR "dma failed to remap register block\n");
1158 return -ENOMEM; 1158 return -ENOMEM;
diff --git a/arch/arm/mach-s3c2410/gpio.c b/arch/arm/mach-s3c2410/gpio.c
index 23ea3d5fa09c..cd39e8684584 100644
--- a/arch/arm/mach-s3c2410/gpio.c
+++ b/arch/arm/mach-s3c2410/gpio.c
@@ -31,6 +31,7 @@
31 * 05-Nov-2004 BJD EXPORT_SYMBOL() added for all code 31 * 05-Nov-2004 BJD EXPORT_SYMBOL() added for all code
32 * 13-Mar-2005 BJD Updates for __iomem 32 * 13-Mar-2005 BJD Updates for __iomem
33 * 26-Oct-2005 BJD Added generic configuration types 33 * 26-Oct-2005 BJD Added generic configuration types
34 * 15-Jan-2006 LCVR Added support for the S3C2400
34 */ 35 */
35 36
36 37
@@ -48,7 +49,7 @@
48 49
49void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function) 50void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function)
50{ 51{
51 void __iomem *base = S3C2410_GPIO_BASE(pin); 52 void __iomem *base = S3C24XX_GPIO_BASE(pin);
52 unsigned long mask; 53 unsigned long mask;
53 unsigned long con; 54 unsigned long con;
54 unsigned long flags; 55 unsigned long flags;
@@ -95,7 +96,7 @@ EXPORT_SYMBOL(s3c2410_gpio_cfgpin);
95 96
96unsigned int s3c2410_gpio_getcfg(unsigned int pin) 97unsigned int s3c2410_gpio_getcfg(unsigned int pin)
97{ 98{
98 void __iomem *base = S3C2410_GPIO_BASE(pin); 99 void __iomem *base = S3C24XX_GPIO_BASE(pin);
99 unsigned long mask; 100 unsigned long mask;
100 101
101 if (pin < S3C2410_GPIO_BANKB) { 102 if (pin < S3C2410_GPIO_BANKB) {
@@ -111,7 +112,7 @@ EXPORT_SYMBOL(s3c2410_gpio_getcfg);
111 112
112void s3c2410_gpio_pullup(unsigned int pin, unsigned int to) 113void s3c2410_gpio_pullup(unsigned int pin, unsigned int to)
113{ 114{
114 void __iomem *base = S3C2410_GPIO_BASE(pin); 115 void __iomem *base = S3C24XX_GPIO_BASE(pin);
115 unsigned long offs = S3C2410_GPIO_OFFSET(pin); 116 unsigned long offs = S3C2410_GPIO_OFFSET(pin);
116 unsigned long flags; 117 unsigned long flags;
117 unsigned long up; 118 unsigned long up;
@@ -133,7 +134,7 @@ EXPORT_SYMBOL(s3c2410_gpio_pullup);
133 134
134void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) 135void s3c2410_gpio_setpin(unsigned int pin, unsigned int to)
135{ 136{
136 void __iomem *base = S3C2410_GPIO_BASE(pin); 137 void __iomem *base = S3C24XX_GPIO_BASE(pin);
137 unsigned long offs = S3C2410_GPIO_OFFSET(pin); 138 unsigned long offs = S3C2410_GPIO_OFFSET(pin);
138 unsigned long flags; 139 unsigned long flags;
139 unsigned long dat; 140 unsigned long dat;
@@ -152,7 +153,7 @@ EXPORT_SYMBOL(s3c2410_gpio_setpin);
152 153
153unsigned int s3c2410_gpio_getpin(unsigned int pin) 154unsigned int s3c2410_gpio_getpin(unsigned int pin)
154{ 155{
155 void __iomem *base = S3C2410_GPIO_BASE(pin); 156 void __iomem *base = S3C24XX_GPIO_BASE(pin);
156 unsigned long offs = S3C2410_GPIO_OFFSET(pin); 157 unsigned long offs = S3C2410_GPIO_OFFSET(pin);
157 158
158 return __raw_readl(base + 0x04) & (1<< offs); 159 return __raw_readl(base + 0x04) & (1<< offs);
@@ -166,70 +167,13 @@ unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change)
166 unsigned long misccr; 167 unsigned long misccr;
167 168
168 local_irq_save(flags); 169 local_irq_save(flags);
169 misccr = __raw_readl(S3C2410_MISCCR); 170 misccr = __raw_readl(S3C24XX_MISCCR);
170 misccr &= ~clear; 171 misccr &= ~clear;
171 misccr ^= change; 172 misccr ^= change;
172 __raw_writel(misccr, S3C2410_MISCCR); 173 __raw_writel(misccr, S3C24XX_MISCCR);
173 local_irq_restore(flags); 174 local_irq_restore(flags);
174 175
175 return misccr; 176 return misccr;
176} 177}
177 178
178EXPORT_SYMBOL(s3c2410_modify_misccr); 179EXPORT_SYMBOL(s3c2410_modify_misccr);
179
180int s3c2410_gpio_getirq(unsigned int pin)
181{
182 if (pin < S3C2410_GPF0 || pin > S3C2410_GPG15_EINT23)
183 return -1; /* not valid interrupts */
184
185 if (pin < S3C2410_GPG0 && pin > S3C2410_GPF7)
186 return -1; /* not valid pin */
187
188 if (pin < S3C2410_GPF4)
189 return (pin - S3C2410_GPF0) + IRQ_EINT0;
190
191 if (pin < S3C2410_GPG0)
192 return (pin - S3C2410_GPF4) + IRQ_EINT4;
193
194 return (pin - S3C2410_GPG0) + IRQ_EINT8;
195}
196
197EXPORT_SYMBOL(s3c2410_gpio_getirq);
198
199int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
200 unsigned int config)
201{
202 void __iomem *reg = S3C2410_EINFLT0;
203 unsigned long flags;
204 unsigned long val;
205
206 if (pin < S3C2410_GPG8 || pin > S3C2410_GPG15)
207 return -1;
208
209 config &= 0xff;
210
211 pin -= S3C2410_GPG8_EINT16;
212 reg += pin & ~3;
213
214 local_irq_save(flags);
215
216 /* update filter width and clock source */
217
218 val = __raw_readl(reg);
219 val &= ~(0xff << ((pin & 3) * 8));
220 val |= config << ((pin & 3) * 8);
221 __raw_writel(val, reg);
222
223 /* update filter enable */
224
225 val = __raw_readl(S3C2410_EXTINT2);
226 val &= ~(1 << ((pin * 4) + 3));
227 val |= on << ((pin * 4) + 3);
228 __raw_writel(val, S3C2410_EXTINT2);
229
230 local_irq_restore(flags);
231
232 return 0;
233}
234
235EXPORT_SYMBOL(s3c2410_gpio_irqfilter);
diff --git a/arch/arm/mach-s3c2410/s3c2400-gpio.c b/arch/arm/mach-s3c2410/s3c2400-gpio.c
new file mode 100644
index 000000000000..5127f39fa9bf
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2400-gpio.c
@@ -0,0 +1,45 @@
1/* linux/arch/arm/mach-s3c2410/gpio.c
2 *
3 * Copyright (c) 2006 Lucas Correia Villa Real <lucasvr@gobolinux.org>
4 *
5 * S3C2400 GPIO support
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * Changelog
22 * 15-Jan-2006 LCVR Splitted from gpio.c, adding support for the S3C2400
23 */
24
25#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/module.h>
28#include <linux/interrupt.h>
29#include <linux/ioport.h>
30
31#include <asm/hardware.h>
32#include <asm/irq.h>
33#include <asm/io.h>
34
35#include <asm/arch/regs-gpio.h>
36
37int s3c2400_gpio_getirq(unsigned int pin)
38{
39 if (pin < S3C2410_GPE0 || pin > S3C2400_GPE7_EINT7)
40 return -1; /* not valid interrupts */
41
42 return (pin - S3C2410_GPE0) + IRQ_EINT0;
43}
44
45EXPORT_SYMBOL(s3c2400_gpio_getirq);
diff --git a/arch/arm/mach-s3c2410/s3c2410-gpio.c b/arch/arm/mach-s3c2410/s3c2410-gpio.c
new file mode 100644
index 000000000000..d5e1caea1d23
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2410-gpio.c
@@ -0,0 +1,93 @@
1/* linux/arch/arm/mach-s3c2410/gpio.c
2 *
3 * Copyright (c) 2004-2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2410 GPIO support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * Changelog
23 * 15-Jan-2006 LCVR Splitted from gpio.c
24 */
25
26#include <linux/kernel.h>
27#include <linux/init.h>
28#include <linux/module.h>
29#include <linux/interrupt.h>
30#include <linux/ioport.h>
31
32#include <asm/hardware.h>
33#include <asm/irq.h>
34#include <asm/io.h>
35
36#include <asm/arch/regs-gpio.h>
37
38int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
39 unsigned int config)
40{
41 void __iomem *reg = S3C2410_EINFLT0;
42 unsigned long flags;
43 unsigned long val;
44
45 if (pin < S3C2410_GPG8 || pin > S3C2410_GPG15)
46 return -1;
47
48 config &= 0xff;
49
50 pin -= S3C2410_GPG8_EINT16;
51 reg += pin & ~3;
52
53 local_irq_save(flags);
54
55 /* update filter width and clock source */
56
57 val = __raw_readl(reg);
58 val &= ~(0xff << ((pin & 3) * 8));
59 val |= config << ((pin & 3) * 8);
60 __raw_writel(val, reg);
61
62 /* update filter enable */
63
64 val = __raw_readl(S3C2410_EXTINT2);
65 val &= ~(1 << ((pin * 4) + 3));
66 val |= on << ((pin * 4) + 3);
67 __raw_writel(val, S3C2410_EXTINT2);
68
69 local_irq_restore(flags);
70
71 return 0;
72}
73
74EXPORT_SYMBOL(s3c2410_gpio_irqfilter);
75
76int s3c2410_gpio_getirq(unsigned int pin)
77{
78 if (pin < S3C2410_GPF0 || pin > S3C2410_GPG15_EINT23)
79 return -1; /* not valid interrupts */
80
81 if (pin < S3C2410_GPG0 && pin > S3C2410_GPF7)
82 return -1; /* not valid pin */
83
84 if (pin < S3C2410_GPF4)
85 return (pin - S3C2410_GPF0) + IRQ_EINT0;
86
87 if (pin < S3C2410_GPG0)
88 return (pin - S3C2410_GPF4) + IRQ_EINT4;
89
90 return (pin - S3C2410_GPG0) + IRQ_EINT8;
91}
92
93EXPORT_SYMBOL(s3c2410_gpio_getirq);
diff --git a/arch/arm/mach-s3c2410/sleep.S b/arch/arm/mach-s3c2410/sleep.S
index 61768dac7fee..832fb86a03b4 100644
--- a/arch/arm/mach-s3c2410/sleep.S
+++ b/arch/arm/mach-s3c2410/sleep.S
@@ -72,7 +72,7 @@ ENTRY(s3c2410_cpu_suspend)
72 @@ prepare cpu to sleep 72 @@ prepare cpu to sleep
73 73
74 ldr r4, =S3C2410_REFRESH 74 ldr r4, =S3C2410_REFRESH
75 ldr r5, =S3C2410_MISCCR 75 ldr r5, =S3C24XX_MISCCR
76 ldr r6, =S3C2410_CLKCON 76 ldr r6, =S3C2410_CLKCON
77 ldr r7, [ r4 ] @ get REFRESH (and ensure in TLB) 77 ldr r7, [ r4 ] @ get REFRESH (and ensure in TLB)
78 ldr r8, [ r5 ] @ get MISCCR (and ensure in TLB) 78 ldr r8, [ r5 ] @ get MISCCR (and ensure in TLB)
@@ -133,12 +133,12 @@ ENTRY(s3c2410_cpu_resume)
133 @@ load UART to allow us to print the two characters for 133 @@ load UART to allow us to print the two characters for
134 @@ resume debug 134 @@ resume debug
135 135
136 mov r2, #S3C2410_PA_UART & 0xff000000 136 mov r2, #S3C24XX_PA_UART & 0xff000000
137 orr r2, r2, #S3C2410_PA_UART & 0xff000 137 orr r2, r2, #S3C24XX_PA_UART & 0xff000
138 138
139#if 0 139#if 0
140 /* SMDK2440 LED set */ 140 /* SMDK2440 LED set */
141 mov r14, #S3C2410_PA_GPIO 141 mov r14, #S3C24XX_PA_GPIO
142 ldr r12, [ r14, #0x54 ] 142 ldr r12, [ r14, #0x54 ]
143 bic r12, r12, #3<<4 143 bic r12, r12, #3<<4
144 orr r12, r12, #1<<7 144 orr r12, r12, #1<<7