diff options
-rw-r--r-- | arch/arm/mach-s3c2412/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-s3c2412/gpio.c | 60 | ||||
-rw-r--r-- | include/asm-arm/arch-s3c2410/hardware.h | 5 | ||||
-rw-r--r-- | include/asm-arm/arch-s3c2410/regs-gpio.h | 5 |
4 files changed, 71 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c2412/Makefile b/arch/arm/mach-s3c2412/Makefile index 7b782c7df7b4..267f3348301e 100644 --- a/arch/arm/mach-s3c2412/Makefile +++ b/arch/arm/mach-s3c2412/Makefile | |||
@@ -12,6 +12,7 @@ obj- := | |||
12 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o | 12 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o |
13 | obj-$(CONFIG_CPU_S3C2412) += irq.o | 13 | obj-$(CONFIG_CPU_S3C2412) += irq.o |
14 | obj-$(CONFIG_CPU_S3C2412) += clock.o | 14 | obj-$(CONFIG_CPU_S3C2412) += clock.o |
15 | obj-$(CONFIG_CPU_S3C2412) += gpio.o | ||
15 | obj-$(CONFIG_S3C2412_DMA) += dma.o | 16 | obj-$(CONFIG_S3C2412_DMA) += dma.o |
16 | obj-$(CONFIG_S3C2412_PM) += pm.o sleep.o | 17 | obj-$(CONFIG_S3C2412_PM) += pm.o sleep.o |
17 | 18 | ||
diff --git a/arch/arm/mach-s3c2412/gpio.c b/arch/arm/mach-s3c2412/gpio.c new file mode 100644 index 000000000000..8e55c3a2eab8 --- /dev/null +++ b/arch/arm/mach-s3c2412/gpio.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/gpio.c | ||
2 | * | ||
3 | * Copyright (c) 2007 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * http://armlinux.simtec.co.uk/. | ||
7 | * | ||
8 | * S3C2412/S3C2413 specific GPIO support | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/types.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | |||
20 | #include <asm/mach/arch.h> | ||
21 | #include <asm/mach/map.h> | ||
22 | |||
23 | #include <asm/arch/regs-gpio.h> | ||
24 | |||
25 | #include <asm/hardware.h> | ||
26 | |||
27 | int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state) | ||
28 | { | ||
29 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | ||
30 | unsigned long offs = S3C2410_GPIO_OFFSET(pin); | ||
31 | unsigned long flags; | ||
32 | unsigned long slpcon; | ||
33 | |||
34 | offs *= 2; | ||
35 | |||
36 | if (pin < S3C2410_GPIO_BANKB) | ||
37 | return -EINVAL; | ||
38 | |||
39 | if (pin >= S3C2410_GPIO_BANKF && | ||
40 | pin <= S3C2410_GPIO_BANKG) | ||
41 | return -EINVAL; | ||
42 | |||
43 | if (pin > (S3C2410_GPIO_BANKH + 32)) | ||
44 | return -EINVAL; | ||
45 | |||
46 | local_irq_save(flags); | ||
47 | |||
48 | slpcon = __raw_readl(base + 0x0C); | ||
49 | |||
50 | slpcon &= ~(3 << offs); | ||
51 | slpcon |= state << offs; | ||
52 | |||
53 | __raw_writel(slpcon, base + 0x0C); | ||
54 | |||
55 | local_irq_restore(flags); | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | EXPORT_SYMBOL(s3c2412_gpio_set_sleepcfg); | ||
diff --git a/include/asm-arm/arch-s3c2410/hardware.h b/include/asm-arm/arch-s3c2410/hardware.h index 6dadf58ff984..faeaba514ffe 100644 --- a/include/asm-arm/arch-s3c2410/hardware.h +++ b/include/asm-arm/arch-s3c2410/hardware.h | |||
@@ -99,6 +99,11 @@ extern int s3c2440_set_dsc(unsigned int pin, unsigned int value); | |||
99 | 99 | ||
100 | #endif /* CONFIG_CPU_S3C2440 */ | 100 | #endif /* CONFIG_CPU_S3C2440 */ |
101 | 101 | ||
102 | #ifdef CONFIG_CPU_S3C2412 | ||
103 | |||
104 | extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state); | ||
105 | |||
106 | #endif /* CONFIG_CPU_S3C2412 */ | ||
102 | 107 | ||
103 | #endif /* __ASSEMBLY__ */ | 108 | #endif /* __ASSEMBLY__ */ |
104 | 109 | ||
diff --git a/include/asm-arm/arch-s3c2410/regs-gpio.h b/include/asm-arm/arch-s3c2410/regs-gpio.h index 1f089fb71a80..0ad75d716ded 100644 --- a/include/asm-arm/arch-s3c2410/regs-gpio.h +++ b/include/asm-arm/arch-s3c2410/regs-gpio.h | |||
@@ -1138,6 +1138,11 @@ | |||
1138 | #define S3C2412_GPHSLPCON S3C2410_GPIOREG(0x7C) | 1138 | #define S3C2412_GPHSLPCON S3C2410_GPIOREG(0x7C) |
1139 | 1139 | ||
1140 | /* definitions for each pin bit */ | 1140 | /* definitions for each pin bit */ |
1141 | #define S3C2412_GPIO_SLPCON_LOW ( 0x00 ) | ||
1142 | #define S3C2412_GPIO_SLPCON_HIGH ( 0x01 ) | ||
1143 | #define S3C2412_GPIO_SLPCON_IN ( 0x02 ) | ||
1144 | #define S3C2412_GPIO_SLPCON_PULL ( 0x03 ) | ||
1145 | |||
1141 | #define S3C2412_SLPCON_LOW(x) ( 0x00 << ((x) * 2)) | 1146 | #define S3C2412_SLPCON_LOW(x) ( 0x00 << ((x) * 2)) |
1142 | #define S3C2412_SLPCON_HIGH(x) ( 0x01 << ((x) * 2)) | 1147 | #define S3C2412_SLPCON_HIGH(x) ( 0x01 << ((x) * 2)) |
1143 | #define S3C2412_SLPCON_IN(x) ( 0x02 << ((x) * 2)) | 1148 | #define S3C2412_SLPCON_IN(x) ( 0x02 << ((x) * 2)) |