1 /* arch/arm/mach-s3c2410/include/mach/gpio-fns.h
3 * Copyright (c) 2003-2009 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
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.
13 #ifndef __MACH_GPIO_FNS_H
14 #define __MACH_GPIO_FNS_H __FILE__
16 /* These functions are in the to-be-removed category and it is strongly
17 * encouraged not to use these in new code. They will be marked deprecated
20 * Most of the functionality can be either replaced by the gpiocfg calls
21 * for the s3c platform or by the generic GPIOlib API.
23 * As of 2.6.35-rc, these will be removed, with the few drivers using them
24 * either replaced or given a wrapper until the calls can be removed.
27 #include <plat/gpio-cfg.h>
29 static inline void s3c2410_gpio_cfgpin(unsigned int pin
, unsigned int cfg
)
31 /* 1:1 mapping between cfgpin and setcfg calls at the moment */
32 s3c_gpio_cfgpin(pin
, cfg
);
35 /* external functions for GPIO support
37 * These allow various different clients to access the same GPIO
38 * registers without conflicting. If your driver only owns the entire
39 * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.
42 extern unsigned int s3c2410_gpio_getcfg(unsigned int pin
);
44 /* s3c2410_gpio_getirq
46 * turn the given pin number into the corresponding IRQ number
49 * < 0 = no interrupt for this pin
50 * >=0 = interrupt number for the pin
53 extern int s3c2410_gpio_getirq(unsigned int pin
);
55 #ifdef CONFIG_CPU_S3C2400
57 extern int s3c2400_gpio_getirq(unsigned int pin
);
59 #endif /* CONFIG_CPU_S3C2400 */
61 /* s3c2410_gpio_irqfilter
63 * set the irq filtering on the given pin
65 * on = 0 => disable filtering
66 * 1 => enable filtering
68 * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
69 * width of filter (0 through 63)
74 extern int s3c2410_gpio_irqfilter(unsigned int pin
, unsigned int on
,
77 /* s3c2410_gpio_pullup
79 * This call should be replaced with s3c_gpio_setpull().
81 * As a note, there is currently no distinction between pull-up and pull-down
82 * in the s3c24xx series devices with only an on/off configuration.
85 /* s3c2410_gpio_pullup
87 * configure the pull-up control on the given pin
89 * to = 1 => disable the pull-up
90 * 0 => enable the pull-up
94 * s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
95 * s3c2410_gpio_pullup(S3C2410_GPE(8), 0);
98 extern void s3c2410_gpio_pullup(unsigned int pin
, unsigned int to
);
100 extern void s3c2410_gpio_setpin(unsigned int pin
, unsigned int to
);
102 extern unsigned int s3c2410_gpio_getpin(unsigned int pin
);
104 #endif /* __MACH_GPIO_FNS_H */