diff options
author | Ben Dooks <ben-linux@fluff.org> | 2010-05-05 22:21:05 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-05-05 22:21:05 -0400 |
commit | 31da46d9f11ccdb11d7f2f07421f5cccb64fbbd6 (patch) | |
tree | df0c64b072f21376ccf6c0102fc8d0078f19e993 /arch/arm/plat-s3c24xx/gpio.c | |
parent | fb3787470ee6fee5900026170c05261c8c090a06 (diff) |
ARM: S3C24XX: Wrapper s3c2410_gpio_setpin and s3c2410_gpio_pullup()
Change s3c2410_gpio_setpin() and s3c2410_gpio_pullup() to use
the new s3c_ gpio configuration calls until all their users
are converted.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s3c24xx/gpio.c')
-rw-r--r-- | arch/arm/plat-s3c24xx/gpio.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/arch/arm/plat-s3c24xx/gpio.c b/arch/arm/plat-s3c24xx/gpio.c index c7c0cd73b946..45126d3aafc6 100644 --- a/arch/arm/plat-s3c24xx/gpio.c +++ b/arch/arm/plat-s3c24xx/gpio.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/gpio.c | 1 | /* linux/arch/arm/plat-s3c24xx/gpio.c |
2 | * | 2 | * |
3 | * Copyright (c) 2004-2005 Simtec Electronics | 3 | * Copyright (c) 2004-2010 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> | 4 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | 5 | * |
6 | * S3C24XX GPIO support | 6 | * S3C24XX GPIO support |
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/ioport.h> | 27 | #include <linux/ioport.h> |
28 | #include <linux/gpio.h> | ||
28 | #include <linux/io.h> | 29 | #include <linux/io.h> |
29 | 30 | ||
30 | #include <mach/hardware.h> | 31 | #include <mach/hardware.h> |
@@ -33,44 +34,34 @@ | |||
33 | 34 | ||
34 | #include <mach/regs-gpio.h> | 35 | #include <mach/regs-gpio.h> |
35 | 36 | ||
37 | /* gpiolib wrappers until these are totally eliminated */ | ||
38 | |||
36 | void s3c2410_gpio_pullup(unsigned int pin, unsigned int to) | 39 | void s3c2410_gpio_pullup(unsigned int pin, unsigned int to) |
37 | { | 40 | { |
38 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | 41 | int ret; |
39 | unsigned long offs = S3C2410_GPIO_OFFSET(pin); | ||
40 | unsigned long flags; | ||
41 | unsigned long up; | ||
42 | 42 | ||
43 | if (pin < S3C2410_GPIO_BANKB) | 43 | WARN_ON(to); /* should be none of these left */ |
44 | return; | ||
45 | 44 | ||
46 | local_irq_save(flags); | 45 | if (!to) { |
47 | 46 | /* if pull is enabled, try first with up, and if that | |
48 | up = __raw_readl(base + 0x08); | 47 | * fails, try using down */ |
49 | up &= ~(1L << offs); | ||
50 | up |= to << offs; | ||
51 | __raw_writel(up, base + 0x08); | ||
52 | 48 | ||
53 | local_irq_restore(flags); | 49 | ret = s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP); |
50 | if (ret) | ||
51 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_DOWN); | ||
52 | } else { | ||
53 | s3c_gpio_setpull(pin, S3C_GPIO_PULL_NONE); | ||
54 | } | ||
54 | } | 55 | } |
55 | |||
56 | EXPORT_SYMBOL(s3c2410_gpio_pullup); | 56 | EXPORT_SYMBOL(s3c2410_gpio_pullup); |
57 | 57 | ||
58 | |||
59 | void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) | 58 | void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) |
60 | { | 59 | { |
61 | void __iomem *base = S3C24XX_GPIO_BASE(pin); | 60 | /* do this via gpiolib until all users removed */ |
62 | unsigned long offs = S3C2410_GPIO_OFFSET(pin); | ||
63 | unsigned long flags; | ||
64 | unsigned long dat; | ||
65 | 61 | ||
66 | local_irq_save(flags); | 62 | gpio_request(pin, "temporary"); |
67 | 63 | gpio_set_value(pin, to); | |
68 | dat = __raw_readl(base + 0x04); | 64 | gpio_free(pin); |
69 | dat &= ~(1 << offs); | ||
70 | dat |= to << offs; | ||
71 | __raw_writel(dat, base + 0x04); | ||
72 | |||
73 | local_irq_restore(flags); | ||
74 | } | 65 | } |
75 | 66 | ||
76 | EXPORT_SYMBOL(s3c2410_gpio_setpin); | 67 | EXPORT_SYMBOL(s3c2410_gpio_setpin); |