SUPERH platform development
 help / color / mirror / Atom feed
* [PATCH 03/27] ARM: shmobile: shareing extra gpio setting functions
@ 2012-06-11  3:52 Kuninori Morimoto
  2012-06-11  3:59 ` Paul Mundt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2012-06-11  3:52 UTC (permalink / raw)
  To: linux-sh

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,
and some boards already have such functions on each code.

This patch shares extra gpio method, and reduced a waste of code on 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>
---
 arch/arm/mach-shmobile/board-ap4evb.c      |   19 +--------------
 arch/arm/mach-shmobile/board-g4evm.c       |   18 ---------------
 arch/arm/mach-shmobile/board-mackerel.c    |   30 +------------------------
 arch/arm/mach-shmobile/include/mach/gpio.h |   32 ++++++++++++++++++++++++++++
 4 files changed, 36 insertions(+), 63 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index ace6024..d7417f3 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -1138,21 +1138,6 @@ static void __init fsi_init_pm_clock(void)
 	clk_put(fsia_ick);
 }
 
-/*
- * FIXME !!
- *
- * gpio_no_direction
- * are quick_hack.
- *
- * 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 void __init gpio_no_direction(u32 addr)
-{
-	__raw_writeb(0x00, addr);
-}
-
 /* TouchScreen */
 #ifdef CONFIG_AP4EVB_QHD
 # define GPIO_TSC_IRQ	GPIO_FN_IRQ28_123
@@ -1302,8 +1287,8 @@ static void __init ap4evb_init(void)
 
 	gpio_request(GPIO_PORT9, NULL);
 	gpio_request(GPIO_PORT10, NULL);
-	gpio_no_direction(GPIO_PORT9CR);  /* FSIAOBT needs no direction */
-	gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
+	gpio_direction_none(GPIO_PORT9CR);  /* FSIAOBT needs no direction */
+	gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
 
 	/* card detect pin for MMC slot (CN7) */
 	gpio_request(GPIO_PORT41, NULL);
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index f125732..6b6f028 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.c
@@ -271,24 +271,6 @@ static struct platform_device *g4evm_devices[] __initdata = {
 #define GPIO_SDHID1_D3	0xe6052106
 #define GPIO_SDHICMD1	0xe6052107
 
-/*
- * FIXME !!
- *
- * gpio_pull_up is quick_hack.
- *
- * 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 void __init gpio_pull_up(u32 addr)
-{
-	u8 data = __raw_readb(addr);
-
-	data &= 0x0F;
-	data |= 0xC0;
-	__raw_writeb(data, addr);
-}
-
 static void __init g4evm_init(void)
 {
 	sh7377_pinmux_init();
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index b577f7c..798be2b 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -203,32 +203,6 @@
  * amixer set "HPOUTR Mixer DACH" on
  */
 
-/*
- * FIXME !!
- *
- * gpio_no_direction
- * gpio_pull_down
- * are quick_hack.
- *
- * 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 void __init gpio_no_direction(u32 addr)
-{
-	__raw_writeb(0x00, addr);
-}
-
-static void __init gpio_pull_down(u32 addr)
-{
-	u8 data = __raw_readb(addr);
-
-	data &= 0x0F;
-	data |= 0xA0;
-
-	__raw_writeb(data, addr);
-}
-
 /* MTD */
 static struct mtd_partition nor_flash_partitions[] = {
 	{
@@ -1475,8 +1449,8 @@ static void __init mackerel_init(void)
 
 	gpio_request(GPIO_PORT9,  NULL);
 	gpio_request(GPIO_PORT10, NULL);
-	gpio_no_direction(GPIO_PORT9CR);  /* FSIAOBT needs no direction */
-	gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
+	gpio_direction_none(GPIO_PORT9CR);  /* FSIAOBT needs no direction */
+	gpio_direction_none(GPIO_PORT10CR); /* FSIAOLR needs no direction */
 
 	intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */
 
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
index de795b4..7c1e4ab 100644
--- a/arch/arm/mach-shmobile/include/mach/gpio.h
+++ b/arch/arm/mach-shmobile/include/mach/gpio.h
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/sh_pfc.h>
+#include <asm/io.h>
 
 #ifdef CONFIG_GPIOLIB
 
@@ -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_pull_up(u32 addr)
+{
+	u8 data = __raw_readb(addr);
+
+	data &= 0x0F;
+	data |= 0xC0;
+	__raw_writeb(data, addr);
+}
+
+static inline void __init gpio_pull_down(u32 addr)
+{
+	u8 data = __raw_readb(addr);
+
+	data &= 0x0F;
+	data |= 0xA0;
+
+	__raw_writeb(data, addr);
+}
+
 #endif /* __ASM_ARCH_GPIO_H */
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 03/27] ARM: shmobile: shareing extra gpio setting functions
  2012-06-11  3:52 [PATCH 03/27] ARM: shmobile: shareing extra gpio setting functions Kuninori Morimoto
@ 2012-06-11  3:59 ` Paul Mundt
  2012-06-11  8:00 ` Simon Horman
  2012-06-11 10:00 ` Kuninori Morimoto
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Mundt @ 2012-06-11  3:59 UTC (permalink / raw)
  To: linux-sh

On Sun, Jun 10, 2012 at 08:52:03PM -0700, Kuninori Morimoto wrote:
> diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
> index de795b4..7c1e4ab 100644
> --- a/arch/arm/mach-shmobile/include/mach/gpio.h
> +++ b/arch/arm/mach-shmobile/include/mach/gpio.h
> @@ -13,6 +13,7 @@
>  #include <linux/kernel.h>
>  #include <linux/errno.h>
>  #include <linux/sh_pfc.h>
> +#include <asm/io.h>
>  
>  #ifdef CONFIG_GPIOLIB
>  
Minor nit, but please use linux/ headers when they are available.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 03/27] ARM: shmobile: shareing extra gpio setting functions
  2012-06-11  3:52 [PATCH 03/27] ARM: shmobile: shareing extra gpio setting functions Kuninori Morimoto
  2012-06-11  3:59 ` Paul Mundt
@ 2012-06-11  8:00 ` Simon Horman
  2012-06-11 10:00 ` Kuninori Morimoto
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2012-06-11  8:00 UTC (permalink / raw)
  To: linux-sh

On Sun, Jun 10, 2012 at 08:52:03PM -0700, Kuninori Morimoto wrote:
> 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,
> and some boards already have such functions on each code.
> 
> This patch shares extra gpio method, and reduced a waste of code on 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>

Tested-by: Simon Horman <horms@verge.net.au>

> ---
>  arch/arm/mach-shmobile/board-ap4evb.c      |   19 +--------------
>  arch/arm/mach-shmobile/board-g4evm.c       |   18 ---------------
>  arch/arm/mach-shmobile/board-mackerel.c    |   30 +------------------------
>  arch/arm/mach-shmobile/include/mach/gpio.h |   32 ++++++++++++++++++++++++++++
>  4 files changed, 36 insertions(+), 63 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 03/27] ARM: shmobile: shareing extra gpio setting functions
  2012-06-11  3:52 [PATCH 03/27] ARM: shmobile: shareing extra gpio setting functions Kuninori Morimoto
  2012-06-11  3:59 ` Paul Mundt
  2012-06-11  8:00 ` Simon Horman
@ 2012-06-11 10:00 ` Kuninori Morimoto
  2 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2012-06-11 10:00 UTC (permalink / raw)
  To: linux-sh


Hi Paul

Thank you for checking patch

> > diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
> > index de795b4..7c1e4ab 100644
> > --- a/arch/arm/mach-shmobile/include/mach/gpio.h
> > +++ b/arch/arm/mach-shmobile/include/mach/gpio.h
> > @@ -13,6 +13,7 @@
> >  #include <linux/kernel.h>
> >  #include <linux/errno.h>
> >  #include <linux/sh_pfc.h>
> > +#include <asm/io.h>
> >  
> >  #ifdef CONFIG_GPIOLIB
> >  
> Minor nit, but please use linux/ headers when they are available.

OK.
I will fix it on v2

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-11 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-11  3:52 [PATCH 03/27] ARM: shmobile: shareing extra gpio setting functions Kuninori Morimoto
2012-06-11  3:59 ` Paul Mundt
2012-06-11  8:00 ` Simon Horman
2012-06-11 10:00 ` Kuninori Morimoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox