Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 1 | /* arch/arm/mach-s3c2410/include/mach/gpio-fns.h |
| 2 | * |
Ben Dooks | ccae941 | 2009-11-13 22:54:14 +0000 | [diff] [blame] | 3 | * Copyright (c) 2003-2009 Simtec Electronics |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 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 | |
Ben Dooks | eee2b94 | 2010-05-04 15:01:44 +0900 | [diff] [blame] | 13 | #ifndef __MACH_GPIO_FNS_H |
| 14 | #define __MACH_GPIO_FNS_H __FILE__ |
| 15 | |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 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 |
| 18 | * very soon. |
| 19 | * |
| 20 | * Most of the functionality can be either replaced by the gpiocfg calls |
| 21 | * for the s3c platform or by the generic GPIOlib API. |
Ben Dooks | eee2b94 | 2010-05-04 15:01:44 +0900 | [diff] [blame] | 22 | * |
| 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. |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 25 | */ |
| 26 | |
Ben Dooks | eee2b94 | 2010-05-04 15:01:44 +0900 | [diff] [blame] | 27 | #include <plat/gpio-cfg.h> |
| 28 | |
| 29 | static inline void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int cfg) |
| 30 | { |
| 31 | /* 1:1 mapping between cfgpin and setcfg calls at the moment */ |
| 32 | s3c_gpio_cfgpin(pin, cfg); |
| 33 | } |
| 34 | |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 35 | /* external functions for GPIO support |
| 36 | * |
| 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. |
| 40 | */ |
| 41 | |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 42 | extern unsigned int s3c2410_gpio_getcfg(unsigned int pin); |
| 43 | |
| 44 | /* s3c2410_gpio_getirq |
| 45 | * |
| 46 | * turn the given pin number into the corresponding IRQ number |
| 47 | * |
| 48 | * returns: |
| 49 | * < 0 = no interrupt for this pin |
| 50 | * >=0 = interrupt number for the pin |
| 51 | */ |
| 52 | |
| 53 | extern int s3c2410_gpio_getirq(unsigned int pin); |
| 54 | |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 55 | /* s3c2410_gpio_irqfilter |
| 56 | * |
| 57 | * set the irq filtering on the given pin |
| 58 | * |
| 59 | * on = 0 => disable filtering |
| 60 | * 1 => enable filtering |
| 61 | * |
| 62 | * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with |
| 63 | * width of filter (0 through 63) |
| 64 | * |
| 65 | * |
| 66 | */ |
| 67 | |
| 68 | extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on, |
| 69 | unsigned int config); |
| 70 | |
| 71 | /* s3c2410_gpio_pullup |
| 72 | * |
Ben Dooks | eee2b94 | 2010-05-04 15:01:44 +0900 | [diff] [blame] | 73 | * This call should be replaced with s3c_gpio_setpull(). |
| 74 | * |
| 75 | * As a note, there is currently no distinction between pull-up and pull-down |
| 76 | * in the s3c24xx series devices with only an on/off configuration. |
| 77 | */ |
| 78 | |
| 79 | /* s3c2410_gpio_pullup |
| 80 | * |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 81 | * configure the pull-up control on the given pin |
| 82 | * |
| 83 | * to = 1 => disable the pull-up |
| 84 | * 0 => enable the pull-up |
| 85 | * |
| 86 | * eg; |
| 87 | * |
Ben Dooks | 070276d | 2009-05-17 22:32:23 +0100 | [diff] [blame] | 88 | * s3c2410_gpio_pullup(S3C2410_GPB(0), 0); |
| 89 | * s3c2410_gpio_pullup(S3C2410_GPE(8), 0); |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 90 | */ |
| 91 | |
| 92 | extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to); |
| 93 | |
Ben Dooks | ec976d6 | 2009-05-13 22:52:24 +0100 | [diff] [blame] | 94 | extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to); |
| 95 | |
| 96 | extern unsigned int s3c2410_gpio_getpin(unsigned int pin); |
Ben Dooks | eee2b94 | 2010-05-04 15:01:44 +0900 | [diff] [blame] | 97 | |
| 98 | #endif /* __MACH_GPIO_FNS_H */ |