diff options
author | Kukjin Kim <kgene.kim@samsung.com> | 2011-08-25 22:03:03 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-09-20 21:52:22 -0400 |
commit | 536137bc9ff1738a7bee9b31047a7cd56860180e (patch) | |
tree | 17e130f1048ca1b5a558e81970a459a9dbadc0e4 | |
parent | b6fd41e29dea9c6753b1843a77e50433e6123bcb (diff) |
gpio/s3c24xx: move gpio driver into drivers/gpio/
Cc: Ben Dooks <ben-linux@fluff.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r-- | arch/arm/mach-s3c2410/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-s3c2412/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-s3c2412/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-s3c2440/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/gpio.c | 96 | ||||
-rw-r--r-- | drivers/gpio/Kconfig | 4 | ||||
-rw-r--r-- | drivers/gpio/Makefile | 1 | ||||
-rw-r--r-- | drivers/gpio/gpio-s3c24xx.c (renamed from arch/arm/plat-s3c24xx/gpiolib.c) | 70 |
10 files changed, 67 insertions, 117 deletions
diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig index 7245a55795dc..3700cf32af0f 100644 --- a/arch/arm/mach-s3c2410/Kconfig +++ b/arch/arm/mach-s3c2410/Kconfig | |||
@@ -8,7 +8,6 @@ config CPU_S3C2410 | |||
8 | select CPU_ARM920T | 8 | select CPU_ARM920T |
9 | select S3C_GPIO_PULL_UP | 9 | select S3C_GPIO_PULL_UP |
10 | select S3C2410_CLOCK | 10 | select S3C2410_CLOCK |
11 | select S3C2410_GPIO | ||
12 | select CPU_LLSERIAL_S3C2410 | 11 | select CPU_LLSERIAL_S3C2410 |
13 | select S3C2410_PM if PM | 12 | select S3C2410_PM if PM |
14 | select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX | 13 | select S3C2410_CPUFREQ if CPU_FREQ_S3C24XX |
@@ -28,11 +27,6 @@ config S3C2410_PM | |||
28 | help | 27 | help |
29 | Power Management code common to S3C2410 and better | 28 | Power Management code common to S3C2410 and better |
30 | 29 | ||
31 | config S3C2410_GPIO | ||
32 | bool | ||
33 | help | ||
34 | GPIO code for S3C2410 and similar processors | ||
35 | |||
36 | config SIMTEC_NOR | 30 | config SIMTEC_NOR |
37 | bool | 31 | bool |
38 | help | 32 | help |
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile index 81695353d8f4..782fd81144e9 100644 --- a/arch/arm/mach-s3c2410/Makefile +++ b/arch/arm/mach-s3c2410/Makefile | |||
@@ -13,7 +13,6 @@ obj-$(CONFIG_CPU_S3C2410) += s3c2410.o | |||
13 | obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o | 13 | obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o |
14 | obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o | 14 | obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o |
15 | obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o | 15 | obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o |
16 | obj-$(CONFIG_S3C2410_GPIO) += gpio.o | ||
17 | obj-$(CONFIG_S3C2410_CPUFREQ) += cpu-freq.o | 16 | obj-$(CONFIG_S3C2410_CPUFREQ) += cpu-freq.o |
18 | obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o | 17 | obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o |
19 | 18 | ||
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig index c2cf4e569989..b8b9029e9f2d 100644 --- a/arch/arm/mach-s3c2412/Kconfig +++ b/arch/arm/mach-s3c2412/Kconfig | |||
@@ -9,7 +9,6 @@ config CPU_S3C2412 | |||
9 | select CPU_LLSERIAL_S3C2440 | 9 | select CPU_LLSERIAL_S3C2440 |
10 | select S3C2412_PM if PM | 10 | select S3C2412_PM if PM |
11 | select S3C2412_DMA if S3C2410_DMA | 11 | select S3C2412_DMA if S3C2410_DMA |
12 | select S3C2410_GPIO | ||
13 | help | 12 | help |
14 | Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line | 13 | Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line |
15 | 14 | ||
diff --git a/arch/arm/mach-s3c2412/Makefile b/arch/arm/mach-s3c2412/Makefile index 6c48a91ea39e..7e4d95fa8a97 100644 --- a/arch/arm/mach-s3c2412/Makefile +++ b/arch/arm/mach-s3c2412/Makefile | |||
@@ -12,7 +12,6 @@ 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 | ||
16 | obj-$(CONFIG_S3C2412_DMA) += dma.o | 15 | obj-$(CONFIG_S3C2412_DMA) += dma.o |
17 | obj-$(CONFIG_S3C2412_PM) += pm.o | 16 | obj-$(CONFIG_S3C2412_PM) += pm.o |
18 | obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep.o | 17 | obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep.o |
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig index 50825a3f91cc..c461fb8e15c0 100644 --- a/arch/arm/mach-s3c2440/Kconfig +++ b/arch/arm/mach-s3c2440/Kconfig | |||
@@ -8,7 +8,6 @@ config CPU_S3C2440 | |||
8 | select S3C_GPIO_PULL_UP | 8 | select S3C_GPIO_PULL_UP |
9 | select S3C2410_CLOCK | 9 | select S3C2410_CLOCK |
10 | select S3C2410_PM if PM | 10 | select S3C2410_PM if PM |
11 | select S3C2410_GPIO | ||
12 | select S3C2440_DMA if S3C2410_DMA | 11 | select S3C2440_DMA if S3C2410_DMA |
13 | select CPU_S3C244X | 12 | select CPU_S3C244X |
14 | select CPU_LLSERIAL_S3C2440 | 13 | select CPU_LLSERIAL_S3C2440 |
@@ -20,7 +19,6 @@ config CPU_S3C2442 | |||
20 | select CPU_ARM920T | 19 | select CPU_ARM920T |
21 | select S3C_GPIO_PULL_DOWN | 20 | select S3C_GPIO_PULL_DOWN |
22 | select S3C2410_CLOCK | 21 | select S3C2410_CLOCK |
23 | select S3C2410_GPIO | ||
24 | select S3C2410_PM if PM | 22 | select S3C2410_PM if PM |
25 | select CPU_S3C244X | 23 | select CPU_S3C244X |
26 | select CPU_LLSERIAL_S3C2440 | 24 | select CPU_LLSERIAL_S3C2440 |
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile index 0291bd6e236e..e4f46495ed30 100644 --- a/arch/arm/plat-s3c24xx/Makefile +++ b/arch/arm/plat-s3c24xx/Makefile | |||
@@ -15,8 +15,6 @@ obj- := | |||
15 | obj-y += cpu.o | 15 | obj-y += cpu.o |
16 | obj-y += irq.o | 16 | obj-y += irq.o |
17 | obj-y += devs.o | 17 | obj-y += devs.o |
18 | obj-y += gpio.o | ||
19 | obj-y += gpiolib.o | ||
20 | obj-y += clock.o | 18 | obj-y += clock.o |
21 | obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o | 19 | obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o |
22 | 20 | ||
diff --git a/arch/arm/plat-s3c24xx/gpio.c b/arch/arm/plat-s3c24xx/gpio.c deleted file mode 100644 index 2f3d7c089dfa..000000000000 --- a/arch/arm/plat-s3c24xx/gpio.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/gpio.c | ||
2 | * | ||
3 | * Copyright (c) 2004-2010 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * S3C24XX 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 | |||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/ioport.h> | ||
28 | #include <linux/gpio.h> | ||
29 | #include <linux/io.h> | ||
30 | |||
31 | #include <mach/hardware.h> | ||
32 | #include <mach/gpio-fns.h> | ||
33 | #include <asm/irq.h> | ||
34 | |||
35 | #include <mach/regs-gpio.h> | ||
36 | |||
37 | #include <plat/gpio-core.h> | ||
38 | |||
39 | /* gpiolib wrappers until these are totally eliminated */ | ||
40 | |||
41 | void s3c2410_gpio_pullup(unsigned int pin, unsigned int to) | ||
42 | { | ||
43 | int ret; | ||
44 | |||
45 | WARN_ON(to); /* should be none of these left */ | ||
46 | |||
47 | if (!to) { | ||
48 | /* if pull is enabled, try first with up, and if that | ||
49 | * fails, try using down */ | ||
50 | |||
51 | ret = s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP); | ||
52 | if (ret) | ||
53 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_DOWN); | ||
54 | } else { | ||
55 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_NONE); | ||
56 | } | ||
57 | } | ||
58 | EXPORT_SYMBOL(s3c2410_gpio_pullup); | ||
59 | |||
60 | void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) | ||
61 | { | ||
62 | /* do this via gpiolib until all users removed */ | ||
63 | |||
64 | gpio_request(pin, "temporary"); | ||
65 | gpio_set_value(pin, to); | ||
66 | gpio_free(pin); | ||
67 | } | ||
68 | |||
69 | EXPORT_SYMBOL(s3c2410_gpio_setpin); | ||
70 | |||
71 | unsigned int s3c2410_gpio_getpin(unsigned int pin) | ||
72 | { | ||
73 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
74 | unsigned long offs = pin - chip->chip.base; | ||
75 | |||
76 | return __raw_readl(chip->base + 0x04) & (1<< offs); | ||
77 | } | ||
78 | |||
79 | EXPORT_SYMBOL(s3c2410_gpio_getpin); | ||
80 | |||
81 | unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change) | ||
82 | { | ||
83 | unsigned long flags; | ||
84 | unsigned long misccr; | ||
85 | |||
86 | local_irq_save(flags); | ||
87 | misccr = __raw_readl(S3C24XX_MISCCR); | ||
88 | misccr &= ~clear; | ||
89 | misccr ^= change; | ||
90 | __raw_writel(misccr, S3C24XX_MISCCR); | ||
91 | local_irq_restore(flags); | ||
92 | |||
93 | return misccr; | ||
94 | } | ||
95 | |||
96 | EXPORT_SYMBOL(s3c2410_modify_misccr); | ||
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index d539efd96d4b..5654e1b082af 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -135,6 +135,10 @@ config GPIO_PLAT_SAMSUNG | |||
135 | def_bool y | 135 | def_bool y |
136 | depends on SAMSUNG_GPIOLIB_4BIT | 136 | depends on SAMSUNG_GPIOLIB_4BIT |
137 | 137 | ||
138 | config GPIO_S3C24XX | ||
139 | def_bool y | ||
140 | depends on PLAT_S3C24XX | ||
141 | |||
138 | config GPIO_S5PC100 | 142 | config GPIO_S5PC100 |
139 | def_bool y | 143 | def_bool y |
140 | depends on CPU_S5PC100 | 144 | depends on CPU_S5PC100 |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 9588948c96f0..c7f1c00986c9 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -40,6 +40,7 @@ obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o | |||
40 | obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o | 40 | obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o |
41 | 41 | ||
42 | obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o | 42 | obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o |
43 | obj-$(CONFIG_GPIO_S3C24XX) += gpio-s3c24xx.o | ||
43 | obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o | 44 | obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o |
44 | obj-$(CONFIG_GPIO_S5PV210) += gpio-s5pv210.o | 45 | obj-$(CONFIG_GPIO_S5PV210) += gpio-s5pv210.o |
45 | 46 | ||
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/drivers/gpio/gpio-s3c24xx.c index 243b6411050d..ff6103130fe8 100644 --- a/arch/arm/plat-s3c24xx/gpiolib.c +++ b/drivers/gpio/gpio-s3c24xx.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/gpiolib.c | 1 | /* |
2 | * | ||
3 | * Copyright (c) 2008-2010 Simtec Electronics | 2 | * Copyright (c) 2008-2010 Simtec Electronics |
4 | * http://armlinux.simtec.co.uk/ | 3 | * http://armlinux.simtec.co.uk/ |
5 | * Ben Dooks <ben@simtec.co.uk> | 4 | * Ben Dooks <ben@simtec.co.uk> |
@@ -19,16 +18,17 @@ | |||
19 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
20 | #include <linux/io.h> | 19 | #include <linux/io.h> |
21 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <asm/irq.h> | ||
22 | |||
23 | #include <mach/hardware.h> | ||
24 | #include <mach/gpio-fns.h> | ||
25 | #include <mach/regs-gpio.h> | ||
22 | 26 | ||
23 | #include <plat/gpio-core.h> | 27 | #include <plat/gpio-core.h> |
24 | #include <plat/gpio-cfg.h> | 28 | #include <plat/gpio-cfg.h> |
25 | #include <plat/gpio-cfg-helpers.h> | 29 | #include <plat/gpio-cfg-helpers.h> |
26 | #include <mach/hardware.h> | ||
27 | #include <asm/irq.h> | ||
28 | #include <plat/pm.h> | 30 | #include <plat/pm.h> |
29 | 31 | ||
30 | #include <mach/regs-gpio.h> | ||
31 | |||
32 | static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) | 32 | static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) |
33 | { | 33 | { |
34 | return -EINVAL; | 34 | return -EINVAL; |
@@ -210,7 +210,6 @@ struct s3c_gpio_chip s3c24xx_gpios[] = { | |||
210 | }, | 210 | }, |
211 | }; | 211 | }; |
212 | 212 | ||
213 | |||
214 | static __init int s3c24xx_gpiolib_init(void) | 213 | static __init int s3c24xx_gpiolib_init(void) |
215 | { | 214 | { |
216 | struct s3c_gpio_chip *chip = s3c24xx_gpios; | 215 | struct s3c_gpio_chip *chip = s3c24xx_gpios; |
@@ -225,5 +224,60 @@ static __init int s3c24xx_gpiolib_init(void) | |||
225 | 224 | ||
226 | return 0; | 225 | return 0; |
227 | } | 226 | } |
228 | |||
229 | core_initcall(s3c24xx_gpiolib_init); | 227 | core_initcall(s3c24xx_gpiolib_init); |
228 | |||
229 | /* gpiolib wrappers until these are totally eliminated */ | ||
230 | |||
231 | void s3c2410_gpio_pullup(unsigned int pin, unsigned int to) | ||
232 | { | ||
233 | int ret; | ||
234 | |||
235 | WARN_ON(to); /* should be none of these left */ | ||
236 | |||
237 | if (!to) { | ||
238 | /* if pull is enabled, try first with up, and if that | ||
239 | * fails, try using down */ | ||
240 | |||
241 | ret = s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP); | ||
242 | if (ret) | ||
243 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_DOWN); | ||
244 | } else { | ||
245 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_NONE); | ||
246 | } | ||
247 | } | ||
248 | EXPORT_SYMBOL(s3c2410_gpio_pullup); | ||
249 | |||
250 | void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) | ||
251 | { | ||
252 | /* do this via gpiolib until all users removed */ | ||
253 | |||
254 | gpio_request(pin, "temporary"); | ||
255 | gpio_set_value(pin, to); | ||
256 | gpio_free(pin); | ||
257 | } | ||
258 | EXPORT_SYMBOL(s3c2410_gpio_setpin); | ||
259 | |||
260 | unsigned int s3c2410_gpio_getpin(unsigned int pin) | ||
261 | { | ||
262 | struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); | ||
263 | unsigned long offs = pin - chip->chip.base; | ||
264 | |||
265 | return __raw_readl(chip->base + 0x04) & (1<< offs); | ||
266 | } | ||
267 | EXPORT_SYMBOL(s3c2410_gpio_getpin); | ||
268 | |||
269 | unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change) | ||
270 | { | ||
271 | unsigned long flags; | ||
272 | unsigned long misccr; | ||
273 | |||
274 | local_irq_save(flags); | ||
275 | misccr = __raw_readl(S3C24XX_MISCCR); | ||
276 | misccr &= ~clear; | ||
277 | misccr ^= change; | ||
278 | __raw_writel(misccr, S3C24XX_MISCCR); | ||
279 | local_irq_restore(flags); | ||
280 | |||
281 | return misccr; | ||
282 | } | ||
283 | EXPORT_SYMBOL(s3c2410_modify_misccr); | ||