From 6679185909e79df85bd44fd964f80f36899d0880 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Tue, 28 Aug 2012 12:54:42 -0500 Subject: [PATCH] ARM: shmobile: move custom gpio functions to sh-gpio.h Move custom shmobile gpio code to a sh-gpio.h to remove the dependency on mach/gpio.h. shmobile always uses gpiolib, so we can remove __GPIOLIB_COMPLEX define from mach/gpio.h. Signed-off-by: Rob Herring Cc: Paul Mundt Cc: Magnus Damm --- arch/arm/mach-shmobile/board-ap4evb.c | 2 + .../arm/mach-shmobile/board-armadillo800eva.c | 2 + arch/arm/mach-shmobile/board-g4evm.c | 2 + arch/arm/mach-shmobile/board-mackerel.c | 2 + arch/arm/mach-shmobile/include/mach/gpio.h | 63 +------------------ arch/arm/mach-shmobile/pfc-r8a7740.c | 2 +- arch/arm/mach-shmobile/pfc-r8a7779.c | 2 +- arch/arm/mach-shmobile/pfc-sh7367.c | 2 +- arch/arm/mach-shmobile/pfc-sh7372.c | 2 +- arch/arm/mach-shmobile/pfc-sh7377.c | 2 +- arch/arm/mach-shmobile/pfc-sh73a0.c | 2 +- arch/arm/mach-shmobile/sh-gpio.h | 48 ++++++++++++++ drivers/sh/pfc/gpio.c | 1 + 13 files changed, 64 insertions(+), 68 deletions(-) create mode 100644 arch/arm/mach-shmobile/sh-gpio.h diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index f172ca85905c..c7f164e20661 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -66,6 +66,8 @@ #include #include +#include "sh-gpio.h" + /* * Address Interface BusWidth note * ------------------------------------------------------------------ diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c index cf10f92856dc..15ffb4cac424 100644 --- a/arch/arm/mach-shmobile/board-armadillo800eva.c +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c @@ -54,6 +54,8 @@ #include #include +#include "sh-gpio.h" + /* * CON1 Camera Module * CON2 Extension Bus diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c index fa5dfc5c8ed6..eeee12e4da62 100644 --- a/arch/arm/mach-shmobile/board-g4evm.c +++ b/arch/arm/mach-shmobile/board-g4evm.c @@ -42,6 +42,8 @@ #include #include +#include "sh-gpio.h" + /* * SDHI * diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 7ea2b31e3199..76544044bf6a 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -64,6 +64,8 @@ #include #include +#include "sh-gpio.h" + /* * Address Interface BusWidth note * ------------------------------------------------------------------ diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h index 844507d937cb..40a8c178f10d 100644 --- a/arch/arm/mach-shmobile/include/mach/gpio.h +++ b/arch/arm/mach-shmobile/include/mach/gpio.h @@ -1,62 +1 @@ -/* - * 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 -#include -#include -#include - -#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 */ +/* empty */ diff --git a/arch/arm/mach-shmobile/pfc-r8a7740.c b/arch/arm/mach-shmobile/pfc-r8a7740.c index ce9e7fa5cc8a..134d1b9a8821 100644 --- a/arch/arm/mach-shmobile/pfc-r8a7740.c +++ b/arch/arm/mach-shmobile/pfc-r8a7740.c @@ -20,7 +20,7 @@ */ #include #include -#include +#include #include #include diff --git a/arch/arm/mach-shmobile/pfc-r8a7779.c b/arch/arm/mach-shmobile/pfc-r8a7779.c index d14c9b048077..cbc26ba2a0a2 100644 --- a/arch/arm/mach-shmobile/pfc-r8a7779.c +++ b/arch/arm/mach-shmobile/pfc-r8a7779.c @@ -19,7 +19,7 @@ */ #include #include -#include +#include #include #include diff --git a/arch/arm/mach-shmobile/pfc-sh7367.c b/arch/arm/mach-shmobile/pfc-sh7367.c index e6e524654e67..c0c137f39052 100644 --- a/arch/arm/mach-shmobile/pfc-sh7367.c +++ b/arch/arm/mach-shmobile/pfc-sh7367.c @@ -18,7 +18,7 @@ */ #include #include -#include +#include #include #define CPU_ALL_PORT(fn, pfx, sfx) \ diff --git a/arch/arm/mach-shmobile/pfc-sh7372.c b/arch/arm/mach-shmobile/pfc-sh7372.c index 336093f9210a..7a1525fd6ada 100644 --- a/arch/arm/mach-shmobile/pfc-sh7372.c +++ b/arch/arm/mach-shmobile/pfc-sh7372.c @@ -22,7 +22,7 @@ */ #include #include -#include +#include #include #include diff --git a/arch/arm/mach-shmobile/pfc-sh7377.c b/arch/arm/mach-shmobile/pfc-sh7377.c index 2f10511946ad..f3117f67fa25 100644 --- a/arch/arm/mach-shmobile/pfc-sh7377.c +++ b/arch/arm/mach-shmobile/pfc-sh7377.c @@ -19,7 +19,7 @@ */ #include #include -#include +#include #include #define CPU_ALL_PORT(fn, pfx, sfx) \ diff --git a/arch/arm/mach-shmobile/pfc-sh73a0.c b/arch/arm/mach-shmobile/pfc-sh73a0.c index 4a547b803268..b442f9d8c716 100644 --- a/arch/arm/mach-shmobile/pfc-sh73a0.c +++ b/arch/arm/mach-shmobile/pfc-sh73a0.c @@ -20,7 +20,7 @@ */ #include #include -#include +#include #include #include diff --git a/arch/arm/mach-shmobile/sh-gpio.h b/arch/arm/mach-shmobile/sh-gpio.h new file mode 100644 index 000000000000..7ba1877fa97a --- /dev/null +++ b/arch/arm/mach-shmobile/sh-gpio.h @@ -0,0 +1,48 @@ +/* + * 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 +#include +#include + +/* + * 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 */ diff --git a/drivers/sh/pfc/gpio.c b/drivers/sh/pfc/gpio.c index 62bca98474a9..038fa071382a 100644 --- a/drivers/sh/pfc/gpio.c +++ b/drivers/sh/pfc/gpio.c @@ -17,6 +17,7 @@ #include #include #include +#include struct sh_pfc_chip { struct sh_pfc *pfc; -- 2.39.5