aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-11-20 07:04:13 -0500
committerBen Dooks <ben-linux@fluff.org>2009-11-30 20:35:40 -0500
commit6a88e9838fdc9ede136e3bb76a5c19413bd6cddb (patch)
treed2cc683914b23841b6da2d17c041c2fe87f8f3e9 /arch/arm
parent23196a42a691012ac9710677f711bb6dca0a1cde (diff)
ARM: S3C64XX: add support for all group 0 external interrupts
Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/plat-s3c64xx/gpiolib.c12
-rw-r--r--arch/arm/plat-s3c64xx/irq-eint.c19
2 files changed, 26 insertions, 5 deletions
diff --git a/arch/arm/plat-s3c64xx/gpiolib.c b/arch/arm/plat-s3c64xx/gpiolib.c
index 92859290ea3..77856045727 100644
--- a/arch/arm/plat-s3c64xx/gpiolib.c
+++ b/arch/arm/plat-s3c64xx/gpiolib.c
@@ -213,6 +213,11 @@ static struct s3c_gpio_cfg gpio_4bit_cfg_eint0011 = {
213 .get_pull = s3c_gpio_getpull_updown, 213 .get_pull = s3c_gpio_getpull_updown,
214}; 214};
215 215
216int s3c64xx_gpio2int_gpm(struct gpio_chip *chip, unsigned pin)
217{
218 return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO;
219}
220
216static struct s3c_gpio_chip gpio_4bit[] = { 221static struct s3c_gpio_chip gpio_4bit[] = {
217 { 222 {
218 .base = S3C64XX_GPA_BASE, 223 .base = S3C64XX_GPA_BASE,
@@ -269,10 +274,16 @@ static struct s3c_gpio_chip gpio_4bit[] = {
269 .base = S3C64XX_GPM(0), 274 .base = S3C64XX_GPM(0),
270 .ngpio = S3C64XX_GPIO_M_NR, 275 .ngpio = S3C64XX_GPIO_M_NR,
271 .label = "GPM", 276 .label = "GPM",
277 .to_irq = s3c64xx_gpio2int_gpm,
272 }, 278 },
273 }, 279 },
274}; 280};
275 281
282int s3c64xx_gpio2int_gpl(struct gpio_chip *chip, unsigned pin)
283{
284 return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO;
285}
286
276static struct s3c_gpio_chip gpio_4bit2[] = { 287static struct s3c_gpio_chip gpio_4bit2[] = {
277 { 288 {
278 .base = S3C64XX_GPH_BASE + 0x4, 289 .base = S3C64XX_GPH_BASE + 0x4,
@@ -297,6 +308,7 @@ static struct s3c_gpio_chip gpio_4bit2[] = {
297 .base = S3C64XX_GPL(0), 308 .base = S3C64XX_GPL(0),
298 .ngpio = S3C64XX_GPIO_L_NR, 309 .ngpio = S3C64XX_GPIO_L_NR,
299 .label = "GPL", 310 .label = "GPL",
311 .to_irq = s3c64xx_gpio2int_gpl,
300 }, 312 },
301 }, 313 },
302}; 314};
diff --git a/arch/arm/plat-s3c64xx/irq-eint.c b/arch/arm/plat-s3c64xx/irq-eint.c
index f81b7b818ba..ebdf183a091 100644
--- a/arch/arm/plat-s3c64xx/irq-eint.c
+++ b/arch/arm/plat-s3c64xx/irq-eint.c
@@ -65,7 +65,7 @@ static void s3c_irq_eint_maskack(unsigned int irq)
65static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type) 65static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
66{ 66{
67 int offs = eint_offset(irq); 67 int offs = eint_offset(irq);
68 int pin; 68 int pin, pin_val;
69 int shift; 69 int shift;
70 u32 ctrl, mask; 70 u32 ctrl, mask;
71 u32 newvalue = 0; 71 u32 newvalue = 0;
@@ -109,7 +109,10 @@ static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
109 return -1; 109 return -1;
110 } 110 }
111 111
112 shift = (offs / 2) * 4; 112 if (offs <= 15)
113 shift = (offs / 2) * 4;
114 else
115 shift = ((offs - 16) / 2) * 4;
113 mask = 0x7 << shift; 116 mask = 0x7 << shift;
114 117
115 ctrl = __raw_readl(reg); 118 ctrl = __raw_readl(reg);
@@ -119,12 +122,18 @@ static int s3c_irq_eint_set_type(unsigned int irq, unsigned int type)
119 122
120 /* set the GPIO pin appropriately */ 123 /* set the GPIO pin appropriately */
121 124
122 if (offs < 23) 125 if (offs < 16) {
123 pin = S3C64XX_GPN(offs); 126 pin = S3C64XX_GPN(offs);
124 else 127 pin_val = S3C_GPIO_SFN(2);
128 } else if (offs < 23) {
129 pin = S3C64XX_GPL(offs + 8 - 16);
130 pin_val = S3C_GPIO_SFN(3);
131 } else {
125 pin = S3C64XX_GPM(offs - 23); 132 pin = S3C64XX_GPM(offs - 23);
133 pin_val = S3C_GPIO_SFN(3);
134 }
126 135
127 s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(2)); 136 s3c_gpio_cfgpin(pin, pin_val);
128 137
129 return 0; 138 return 0;
130} 139}