mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 12:52:30 +00:00
4f3d7f65e9
Current gpio frame work doesn't have the method to control just pull up/down/free, but some SH-ARM boards need such kind of operation. This patch adds common extra gpio functions for SH-ARM. But these functions should be replaced by correct gpio function in the future. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Magnus Damm <damm@opensource.se> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
63 lines
1.1 KiB
C
63 lines
1.1 KiB
C
/*
|
|
* Generic GPIO API and pinmux table support
|
|
*
|
|
* Copyright (c) 2008 Magnus Damm
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*/
|
|
#ifndef __ASM_ARCH_GPIO_H
|
|
#define __ASM_ARCH_GPIO_H
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/sh_pfc.h>
|
|
#include <linux/io.h>
|
|
|
|
#ifdef CONFIG_GPIOLIB
|
|
|
|
static inline int irq_to_gpio(unsigned int irq)
|
|
{
|
|
return -ENOSYS;
|
|
}
|
|
|
|
#else
|
|
|
|
#define __ARM_GPIOLIB_COMPLEX
|
|
|
|
#endif /* CONFIG_GPIOLIB */
|
|
|
|
/*
|
|
* FIXME !!
|
|
*
|
|
* current gpio frame work doesn't have
|
|
* the method to control only pull up/down/free.
|
|
* this function should be replaced by correct gpio function
|
|
*/
|
|
static inline void __init gpio_direction_none(u32 addr)
|
|
{
|
|
__raw_writeb(0x00, addr);
|
|
}
|
|
|
|
static inline void __init gpio_request_pullup(u32 addr)
|
|
{
|
|
u8 data = __raw_readb(addr);
|
|
|
|
data &= 0x0F;
|
|
data |= 0xC0;
|
|
__raw_writeb(data, addr);
|
|
}
|
|
|
|
static inline void __init gpio_request_pulldown(u32 addr)
|
|
{
|
|
u8 data = __raw_readb(addr);
|
|
|
|
data &= 0x0F;
|
|
data |= 0xA0;
|
|
|
|
__raw_writeb(data, addr);
|
|
}
|
|
|
|
#endif /* __ASM_ARCH_GPIO_H */
|