aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2011-08-25 22:03:03 -0400
committerKukjin Kim <kgene.kim@samsung.com>2011-09-20 21:52:22 -0400
commit536137bc9ff1738a7bee9b31047a7cd56860180e (patch)
tree17e130f1048ca1b5a558e81970a459a9dbadc0e4
parentb6fd41e29dea9c6753b1843a77e50433e6123bcb (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/Kconfig6
-rw-r--r--arch/arm/mach-s3c2410/Makefile1
-rw-r--r--arch/arm/mach-s3c2412/Kconfig1
-rw-r--r--arch/arm/mach-s3c2412/Makefile1
-rw-r--r--arch/arm/mach-s3c2440/Kconfig2
-rw-r--r--arch/arm/plat-s3c24xx/Makefile2
-rw-r--r--arch/arm/plat-s3c24xx/gpio.c96
-rw-r--r--drivers/gpio/Kconfig4
-rw-r--r--drivers/gpio/Makefile1
-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
31config S3C2410_GPIO
32 bool
33 help
34 GPIO code for S3C2410 and similar processors
35
36config SIMTEC_NOR 30config 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
13obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o 13obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o
14obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o 14obj-$(CONFIG_CPU_S3C2410_DMA) += dma.o
15obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o 15obj-$(CONFIG_S3C2410_PM) += pm.o sleep.o
16obj-$(CONFIG_S3C2410_GPIO) += gpio.o
17obj-$(CONFIG_S3C2410_CPUFREQ) += cpu-freq.o 16obj-$(CONFIG_S3C2410_CPUFREQ) += cpu-freq.o
18obj-$(CONFIG_S3C2410_PLLTABLE) += pll.o 17obj-$(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- :=
12obj-$(CONFIG_CPU_S3C2412) += s3c2412.o 12obj-$(CONFIG_CPU_S3C2412) += s3c2412.o
13obj-$(CONFIG_CPU_S3C2412) += irq.o 13obj-$(CONFIG_CPU_S3C2412) += irq.o
14obj-$(CONFIG_CPU_S3C2412) += clock.o 14obj-$(CONFIG_CPU_S3C2412) += clock.o
15obj-$(CONFIG_CPU_S3C2412) += gpio.o
16obj-$(CONFIG_S3C2412_DMA) += dma.o 15obj-$(CONFIG_S3C2412_DMA) += dma.o
17obj-$(CONFIG_S3C2412_PM) += pm.o 16obj-$(CONFIG_S3C2412_PM) += pm.o
18obj-$(CONFIG_S3C2412_PM_SLEEP) += sleep.o 17obj-$(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- :=
15obj-y += cpu.o 15obj-y += cpu.o
16obj-y += irq.o 16obj-y += irq.o
17obj-y += devs.o 17obj-y += devs.o
18obj-y += gpio.o
19obj-y += gpiolib.o
20obj-y += clock.o 18obj-y += clock.o
21obj-$(CONFIG_S3C24XX_DCLK) += clock-dclk.o 19obj-$(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
41void 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}
58EXPORT_SYMBOL(s3c2410_gpio_pullup);
59
60void 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
69EXPORT_SYMBOL(s3c2410_gpio_setpin);
70
71unsigned 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
79EXPORT_SYMBOL(s3c2410_gpio_getpin);
80
81unsigned 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
96EXPORT_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
138config GPIO_S3C24XX
139 def_bool y
140 depends on PLAT_S3C24XX
141
138config GPIO_S5PC100 142config 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
40obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o 40obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
41 41
42obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o 42obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o
43obj-$(CONFIG_GPIO_S3C24XX) += gpio-s3c24xx.o
43obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o 44obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o
44obj-$(CONFIG_GPIO_S5PV210) += gpio-s5pv210.o 45obj-$(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
32static int s3c24xx_gpiolib_banka_input(struct gpio_chip *chip, unsigned offset) 32static 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
214static __init int s3c24xx_gpiolib_init(void) 213static __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
229core_initcall(s3c24xx_gpiolib_init); 227core_initcall(s3c24xx_gpiolib_init);
228
229/* gpiolib wrappers until these are totally eliminated */
230
231void 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}
248EXPORT_SYMBOL(s3c2410_gpio_pullup);
249
250void 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}
258EXPORT_SYMBOL(s3c2410_gpio_setpin);
259
260unsigned 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}
267EXPORT_SYMBOL(s3c2410_gpio_getpin);
268
269unsigned 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}
283EXPORT_SYMBOL(s3c2410_modify_misccr);