Skip to content

Commit

Permalink
ARM: shmobile: add common extra gpio functions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kuninori Morimoto authored and Rafael J. Wysocki committed Jun 30, 2012
1 parent 485802a commit 4f3d7f6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions arch/arm/mach-shmobile/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/sh_pfc.h>
#include <linux/io.h>

#ifdef CONFIG_GPIOLIB

Expand All @@ -27,4 +28,35 @@ static inline int irq_to_gpio(unsigned int irq)

#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 */

0 comments on commit 4f3d7f6

Please sign in to comment.