Commit | Line | Data |
---|---|---|
ec976d6e BD |
1 | /* arch/arm/mach-s3c2410/include/mach/gpio-fns.h |
2 | * | |
ccae941e | 3 | * Copyright (c) 2003-2009 Simtec Electronics |
ec976d6e BD |
4 | * Ben Dooks <ben@simtec.co.uk> |
5 | * | |
6 | * S3C2410 - hardware | |
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 version 2 as | |
10 | * published by the Free Software Foundation. | |
11 | */ | |
12 | ||
13 | /* These functions are in the to-be-removed category and it is strongly | |
14 | * encouraged not to use these in new code. They will be marked deprecated | |
15 | * very soon. | |
16 | * | |
17 | * Most of the functionality can be either replaced by the gpiocfg calls | |
18 | * for the s3c platform or by the generic GPIOlib API. | |
19 | */ | |
20 | ||
21 | /* external functions for GPIO support | |
22 | * | |
23 | * These allow various different clients to access the same GPIO | |
24 | * registers without conflicting. If your driver only owns the entire | |
25 | * GPIO register, then it is safe to ioremap/__raw_{read|write} to it. | |
26 | */ | |
27 | ||
28 | /* s3c2410_gpio_cfgpin | |
29 | * | |
30 | * set the configuration of the given pin to the value passed. | |
31 | * | |
32 | * eg: | |
070276d5 BD |
33 | * s3c2410_gpio_cfgpin(S3C2410_GPA(0), S3C2410_GPA0_ADDR0); |
34 | * s3c2410_gpio_cfgpin(S3C2410_GPE(8), S3C2410_GPE8_SDDAT1); | |
ec976d6e BD |
35 | */ |
36 | ||
37 | extern void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function); | |
38 | ||
39 | extern unsigned int s3c2410_gpio_getcfg(unsigned int pin); | |
40 | ||
41 | /* s3c2410_gpio_getirq | |
42 | * | |
43 | * turn the given pin number into the corresponding IRQ number | |
44 | * | |
45 | * returns: | |
46 | * < 0 = no interrupt for this pin | |
47 | * >=0 = interrupt number for the pin | |
48 | */ | |
49 | ||
50 | extern int s3c2410_gpio_getirq(unsigned int pin); | |
51 | ||
52 | #ifdef CONFIG_CPU_S3C2400 | |
53 | ||
54 | extern int s3c2400_gpio_getirq(unsigned int pin); | |
55 | ||
56 | #endif /* CONFIG_CPU_S3C2400 */ | |
57 | ||
58 | /* s3c2410_gpio_irqfilter | |
59 | * | |
60 | * set the irq filtering on the given pin | |
61 | * | |
62 | * on = 0 => disable filtering | |
63 | * 1 => enable filtering | |
64 | * | |
65 | * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with | |
66 | * width of filter (0 through 63) | |
67 | * | |
68 | * | |
69 | */ | |
70 | ||
71 | extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, | |
72 | unsigned int config); | |
73 | ||
74 | /* s3c2410_gpio_pullup | |
75 | * | |
76 | * configure the pull-up control on the given pin | |
77 | * | |
78 | * to = 1 => disable the pull-up | |
79 | * 0 => enable the pull-up | |
80 | * | |
81 | * eg; | |
82 | * | |
070276d5 BD |
83 | * s3c2410_gpio_pullup(S3C2410_GPB(0), 0); |
84 | * s3c2410_gpio_pullup(S3C2410_GPE(8), 0); | |
ec976d6e BD |
85 | */ |
86 | ||
87 | extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); | |
88 | ||
89 | /* s3c2410_gpio_getpull | |
90 | * | |
91 | * Read the state of the pull-up on a given pin | |
92 | * | |
93 | * return: | |
94 | * < 0 => error code | |
95 | * 0 => enabled | |
96 | * 1 => disabled | |
97 | */ | |
98 | ||
99 | extern int s3c2410_gpio_getpull(unsigned int pin); | |
100 | ||
101 | extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); | |
102 | ||
103 | extern unsigned int s3c2410_gpio_getpin(unsigned int pin); |