Root/
1 | /* linux/arch/arm/mach-s3c2410/gpio.c |
2 | * |
3 | * Copyright (c) 2004-2006 Simtec Electronics |
4 | * Ben Dooks <ben@simtec.co.uk> |
5 | * |
6 | * S3C2410 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/io.h> |
29 | |
30 | #include <mach/hardware.h> |
31 | #include <mach/gpio-fns.h> |
32 | #include <asm/irq.h> |
33 | |
34 | #include <mach/regs-gpio.h> |
35 | |
36 | int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, |
37 | unsigned int config) |
38 | { |
39 | void __iomem *reg = S3C24XX_EINFLT0; |
40 | unsigned long flags; |
41 | unsigned long val; |
42 | |
43 | if (pin < S3C2410_GPG(8) || pin > S3C2410_GPG(15)) |
44 | return -EINVAL; |
45 | |
46 | config &= 0xff; |
47 | |
48 | pin -= S3C2410_GPG(8); |
49 | reg += pin & ~3; |
50 | |
51 | local_irq_save(flags); |
52 | |
53 | /* update filter width and clock source */ |
54 | |
55 | val = __raw_readl(reg); |
56 | val &= ~(0xff << ((pin & 3) * 8)); |
57 | val |= config << ((pin & 3) * 8); |
58 | __raw_writel(val, reg); |
59 | |
60 | /* update filter enable */ |
61 | |
62 | val = __raw_readl(S3C24XX_EXTINT2); |
63 | val &= ~(1 << ((pin * 4) + 3)); |
64 | val |= on << ((pin * 4) + 3); |
65 | __raw_writel(val, S3C24XX_EXTINT2); |
66 | |
67 | local_irq_restore(flags); |
68 | |
69 | return 0; |
70 | } |
71 | |
72 | EXPORT_SYMBOL(s3c2410_gpio_irqfilter); |
73 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9