2009-05-13 17:52:24 -04:00
|
|
|
/* arch/arm/mach-s3c2410/include/mach/gpio-fns.h
|
|
|
|
*
|
2009-11-13 17:54:14 -05:00
|
|
|
* Copyright (c) 2003-2009 Simtec Electronics
|
2009-05-13 17:52:24 -04:00
|
|
|
* Ben Dooks <ben@simtec.co.uk>
|
|
|
|
*
|
|
|
|
* S3C2410 - hardware
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
2010-05-04 02:01:44 -04:00
|
|
|
#ifndef __MACH_GPIO_FNS_H
|
|
|
|
#define __MACH_GPIO_FNS_H __FILE__
|
|
|
|
|
2009-05-13 17:52:24 -04:00
|
|
|
/* These functions are in the to-be-removed category and it is strongly
|
|
|
|
* encouraged not to use these in new code. They will be marked deprecated
|
|
|
|
* very soon.
|
|
|
|
*
|
|
|
|
* Most of the functionality can be either replaced by the gpiocfg calls
|
|
|
|
* for the s3c platform or by the generic GPIOlib API.
|
2010-05-04 02:01:44 -04:00
|
|
|
*
|
|
|
|
* As of 2.6.35-rc, these will be removed, with the few drivers using them
|
|
|
|
* either replaced or given a wrapper until the calls can be removed.
|
2009-05-13 17:52:24 -04:00
|
|
|
*/
|
|
|
|
|
2010-05-04 02:01:44 -04:00
|
|
|
#include <plat/gpio-cfg.h>
|
|
|
|
|
|
|
|
static inline void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int cfg)
|
|
|
|
{
|
|
|
|
/* 1:1 mapping between cfgpin and setcfg calls at the moment */
|
|
|
|
s3c_gpio_cfgpin(pin, cfg);
|
|
|
|
}
|
|
|
|
|
2009-05-13 17:52:24 -04:00
|
|
|
/* external functions for GPIO support
|
|
|
|
*
|
|
|
|
* These allow various different clients to access the same GPIO
|
|
|
|
* registers without conflicting. If your driver only owns the entire
|
|
|
|
* GPIO register, then it is safe to ioremap/__raw_{read|write} to it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
|
|
|
|
|
|
|
|
/* s3c2410_gpio_getirq
|
|
|
|
*
|
|
|
|
* turn the given pin number into the corresponding IRQ number
|
|
|
|
*
|
|
|
|
* returns:
|
|
|
|
* < 0 = no interrupt for this pin
|
|
|
|
* >=0 = interrupt number for the pin
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern int s3c2410_gpio_getirq(unsigned int pin);
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_S3C2400
|
|
|
|
|
|
|
|
extern int s3c2400_gpio_getirq(unsigned int pin);
|
|
|
|
|
|
|
|
#endif /* CONFIG_CPU_S3C2400 */
|
|
|
|
|
|
|
|
/* s3c2410_gpio_irqfilter
|
|
|
|
*
|
|
|
|
* set the irq filtering on the given pin
|
|
|
|
*
|
|
|
|
* on = 0 => disable filtering
|
|
|
|
* 1 => enable filtering
|
|
|
|
*
|
|
|
|
* config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
|
|
|
|
* width of filter (0 through 63)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
|
|
|
|
unsigned int config);
|
|
|
|
|
2010-05-04 02:01:44 -04:00
|
|
|
/* s3c2410_gpio_pullup
|
|
|
|
*
|
|
|
|
* This call should be replaced with s3c_gpio_setpull().
|
|
|
|
*
|
|
|
|
* As a note, there is currently no distinction between pull-up and pull-down
|
|
|
|
* in the s3c24xx series devices with only an on/off configuration.
|
|
|
|
*/
|
|
|
|
|
2009-05-13 17:52:24 -04:00
|
|
|
/* s3c2410_gpio_pullup
|
|
|
|
*
|
|
|
|
* configure the pull-up control on the given pin
|
|
|
|
*
|
|
|
|
* to = 1 => disable the pull-up
|
|
|
|
* 0 => enable the pull-up
|
|
|
|
*
|
|
|
|
* eg;
|
|
|
|
*
|
2009-05-17 17:32:23 -04:00
|
|
|
* s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
|
|
|
|
* s3c2410_gpio_pullup(S3C2410_GPE(8), 0);
|
2009-05-13 17:52:24 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
|
|
|
|
|
|
|
|
extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
|
|
|
|
|
|
|
|
extern unsigned int s3c2410_gpio_getpin(unsigned int pin);
|
2010-05-04 02:01:44 -04:00
|
|
|
|
|
|
|
#endif /* __MACH_GPIO_FNS_H */
|