All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
       [not found] ` <1298315206-8887-1-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
@ 2011-02-21 19:06   ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-21 19:06 UTC (permalink / raw
  To: linux-tegra-u79uwXL29TY76Z2rM5mHXA
  Cc: ccross-z5hGa2qSFaRBDgjK7y7TUQ, konkers-z5hGa2qSFaRBDgjK7y7TUQ,
	Olof Johansson

To give one place to setup the pins that are used as GPIOs instead
of as their pinmuxed functions. Specifying enabled as false explicitly
disables the gpio mode of that pin (if left on by firmware).

This should remove the need for calling these from specific drivers and
thus reduce tegra-specific code from them.

Signed-off-by: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
---
 arch/arm/mach-tegra/board-harmony-pinmux.c |   13 +++++++++++++
 arch/arm/mach-tegra/gpio.c                 |   16 +++++++++++++++-
 arch/arm/mach-tegra/include/mach/gpio.h    |    7 +++++++
 3 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
index 50b15d5..98b9ab2 100644
--- a/arch/arm/mach-tegra/board-harmony-pinmux.c
+++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
@@ -16,7 +16,9 @@
 
 #include <linux/kernel.h>
 #include <mach/pinmux.h>
+#include <mach/gpio.h>
 
+#include "gpio-names.h"
 #include "board-harmony.h"
 
 static struct tegra_pingroup_config harmony_pinmux[] = {
@@ -138,7 +140,18 @@ static struct tegra_pingroup_config harmony_pinmux[] = {
 	{TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 };
 
+static struct tegra_gpio_table gpio_table[] = {
+	{ .gpio = TEGRA_GPIO_PI5,	.enable = true	}, /* mmc2 cd	*/
+	{ .gpio = TEGRA_GPIO_PH1,	.enable = true	}, /* mmc2 wp	*/
+	{ .gpio = TEGRA_GPIO_PT3,	.enable = true	}, /* mmc2 pwr	*/
+	{ .gpio = TEGRA_GPIO_PH2,	.enable = true	}, /* mmc4 cd	*/
+	{ .gpio = TEGRA_GPIO_PH3,	.enable = true	}, /* mmc4 wp	*/
+	{ .gpio = TEGRA_GPIO_PI6,	.enable = true	}, /* mmc4 pwr	*/
+};
+
 void harmony_pinmux_init(void)
 {
 	tegra_pinmux_config_table(harmony_pinmux, ARRAY_SIZE(harmony_pinmux));
+
+	tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table));
 }
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
index 132dcd6..3fe9e1c 100644
--- a/arch/arm/mach-tegra/gpio.c
+++ b/arch/arm/mach-tegra/gpio.c
@@ -379,7 +379,21 @@ static int __init tegra_gpio_init(void)
 	return 0;
 }
 
-postcore_initcall(tegra_gpio_init);
+void __init tegra_gpio_config(struct tegra_gpio_table *table, int num)
+{
+	int i;
+
+	tegra_gpio_init();
+
+	for (i = 0; i < num; i++) {
+		int gpio = table[i].gpio;
+
+		if (table[i].enable)
+			tegra_gpio_enable(gpio);
+		else
+			tegra_gpio_disable(gpio);
+	}
+}
 
 #ifdef	CONFIG_DEBUG_FS
 
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
index e31f486..2369fba 100644
--- a/arch/arm/mach-tegra/include/mach/gpio.h
+++ b/arch/arm/mach-tegra/include/mach/gpio.h
@@ -20,6 +20,7 @@
 #ifndef __MACH_TEGRA_GPIO_H
 #define __MACH_TEGRA_GPIO_H
 
+#include <linux/init.h>
 #include <mach/irqs.h>
 
 #define TEGRA_NR_GPIOS		INT_GPIO_NR
@@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)
 	return -EINVAL;
 }
 
+struct tegra_gpio_table {
+	int	gpio;	/* GPIO number */
+	bool	enable;	/* Enable for GPIO at init? */
+};
+
+void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);
 void tegra_gpio_enable(int gpio);
 void tegra_gpio_disable(int gpio);
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
       [not found] ` <AANLkTikauaANKBpfNHXF5PgCRS4vdbq+eNDF6itU6yHS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-02-21 20:44   ` Olof Johansson
       [not found]     ` <AANLkTi=Mg7-hM69EMVSOkS8goU+H53KnDC5q2KASHOtz-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 20+ messages in thread
From: Olof Johansson @ 2011-02-21 20:44 UTC (permalink / raw
  To: Erik Gilling
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, ccross-z5hGa2qSFaRBDgjK7y7TUQ

Hi,

On Mon, Feb 21, 2011 at 11:40 AM, Erik Gilling <konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:

>> This should remove the need for calling these from specific drivers and
>> thus reduce tegra-specific code from them.
>
> It was never my intention that drives call gpio_enable/disable, just board
> files.

True, but it seems even then that it ends up in various parts of the
per-board files. Having it in one central location (for the base
config) seems like a good idea.



>> @@ -138,7 +140,18 @@ static struct tegra_pingroup_config harmony_pinmux[]
>> = {
>>        {TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,
>>    TEGRA_TRI_NORMAL},
>>  };
>
> An aside: you may want to fully specify the pingroup table here.  This keeps
> new bootloaders from leaving you nasty susurprises.  To make this easier the
> debugfs file outputs a file you can cut and paste here.

Good point, and something i had missed myself. I'll update the harmony
file separately (make the 'enable sdmmc2' patch an 'update pinmux
table'), and refresh the seaboard patch.


> Gpio subsystem init and configurations should be left separate.

I.e. not part of the pinmux file? Sure, can do.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
       [not found]     ` <AANLkTi=Mg7-hM69EMVSOkS8goU+H53KnDC5q2KASHOtz-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-02-21 22:58       ` Erik Gilling
  2011-02-22  5:24         ` Olof Johansson
  0 siblings, 1 reply; 20+ messages in thread
From: Erik Gilling @ 2011-02-21 22:58 UTC (permalink / raw
  To: Olof Johansson
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, ccross-z5hGa2qSFaRBDgjK7y7TUQ

On Mon, Feb 21, 2011 at 12:44 PM, Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org> wrote:
> Hi,
>
> On Mon, Feb 21, 2011 at 11:40 AM, Erik Gilling <konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
>
>>> This should remove the need for calling these from specific drivers and
>>> thus reduce tegra-specific code from them.
>>
>> It was never my intention that drives call gpio_enable/disable, just board
>> files.
>
> True, but it seems even then that it ends up in various parts of the
> per-board files. Having it in one central location (for the base
> config) seems like a good idea.

sounds good to me.

>> Gpio subsystem init and configurations should be left separate.
>
> I.e. not part of the pinmux file? Sure, can do.

I meant that tegra_gpio_init should still be a postcore_initcall.
That way GPIOs work even if you don't use the tegra_gpio_config
helper.  Also, I'd take the __init off tegra_gpio_config.  The
function could be useful in some suspend/resume chains where the board
designer hates you.

-Erik
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
  2011-02-21 22:58       ` Erik Gilling
@ 2011-02-22  5:24         ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22  5:24 UTC (permalink / raw
  To: Erik Gilling
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, ccross-z5hGa2qSFaRBDgjK7y7TUQ

On Mon, Feb 21, 2011 at 2:58 PM, Erik Gilling <konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
> On Mon, Feb 21, 2011 at 12:44 PM, Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org> wrote:
>> Hi,
>>
>> On Mon, Feb 21, 2011 at 11:40 AM, Erik Gilling <konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
>>
>>>> This should remove the need for calling these from specific drivers and
>>>> thus reduce tegra-specific code from them.
>>>
>>> It was never my intention that drives call gpio_enable/disable, just board
>>> files.
>>
>> True, but it seems even then that it ends up in various parts of the
>> per-board files. Having it in one central location (for the base
>> config) seems like a good idea.
>
> sounds good to me.
>
>>> Gpio subsystem init and configurations should be left separate.
>>
>> I.e. not part of the pinmux file? Sure, can do.
>
> I meant that tegra_gpio_init should still be a postcore_initcall.
> That way GPIOs work even if you don't use the tegra_gpio_config
> helper.

Ok, brought that back.

> Also, I'd take the __init off tegra_gpio_config.  The
> function could be useful in some suspend/resume chains where the board
> designer hates you.

While I agree that it'd be useful, I'd prefer dropping it when the
first in-tree user comes along for it. Otherwise, chances is some
janitor coming across it and adding it back for extra churn. :)


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22  5:55   ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22  5:55 UTC (permalink / raw
  To: linux-arm-kernel

To give one place to setup the pins that are used as GPIOs instead
of as their pinmuxed functions. Specifying enabled as false explicitly
disables the gpio mode of that pin (if left on by firmware).

This should remove the need for calling these from specific drivers and
thus reduce tegra-specific code from them.

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-tegra/board-harmony-pinmux.c |   13 +++++++++++++
 arch/arm/mach-tegra/gpio.c                 |   15 ++++++++++++++-
 arch/arm/mach-tegra/include/mach/gpio.h    |    7 +++++++
 3 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
index 50b15d5..98b9ab2 100644
--- a/arch/arm/mach-tegra/board-harmony-pinmux.c
+++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
@@ -16,7 +16,9 @@
 
 #include <linux/kernel.h>
 #include <mach/pinmux.h>
+#include <mach/gpio.h>
 
+#include "gpio-names.h"
 #include "board-harmony.h"
 
 static struct tegra_pingroup_config harmony_pinmux[] = {
@@ -138,7 +140,18 @@ static struct tegra_pingroup_config harmony_pinmux[] = {
 	{TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 };
 
+static struct tegra_gpio_table gpio_table[] = {
+	{ .gpio = TEGRA_GPIO_PI5,	.enable = true	}, /* mmc2 cd	*/
+	{ .gpio = TEGRA_GPIO_PH1,	.enable = true	}, /* mmc2 wp	*/
+	{ .gpio = TEGRA_GPIO_PT3,	.enable = true	}, /* mmc2 pwr	*/
+	{ .gpio = TEGRA_GPIO_PH2,	.enable = true	}, /* mmc4 cd	*/
+	{ .gpio = TEGRA_GPIO_PH3,	.enable = true	}, /* mmc4 wp	*/
+	{ .gpio = TEGRA_GPIO_PI6,	.enable = true	}, /* mmc4 pwr	*/
+};
+
 void harmony_pinmux_init(void)
 {
 	tegra_pinmux_config_table(harmony_pinmux, ARRAY_SIZE(harmony_pinmux));
+
+	tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table));
 }
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
index 132dcd6..ffc146d 100644
--- a/arch/arm/mach-tegra/gpio.c
+++ b/arch/arm/mach-tegra/gpio.c
@@ -378,9 +378,22 @@ static int __init tegra_gpio_init(void)
 
 	return 0;
 }
-
 postcore_initcall(tegra_gpio_init);
 
+void __init tegra_gpio_config(struct tegra_gpio_table *table, int num)
+{
+	int i;
+
+	for (i = 0; i < num; i++) {
+		int gpio = table[i].gpio;
+
+		if (table[i].enable)
+			tegra_gpio_enable(gpio);
+		else
+			tegra_gpio_disable(gpio);
+	}
+}
+
 #ifdef	CONFIG_DEBUG_FS
 
 #include <linux/debugfs.h>
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
index e31f486..2369fba 100644
--- a/arch/arm/mach-tegra/include/mach/gpio.h
+++ b/arch/arm/mach-tegra/include/mach/gpio.h
@@ -20,6 +20,7 @@
 #ifndef __MACH_TEGRA_GPIO_H
 #define __MACH_TEGRA_GPIO_H
 
+#include <linux/init.h>
 #include <mach/irqs.h>
 
 #define TEGRA_NR_GPIOS		INT_GPIO_NR
@@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)
 	return -EINVAL;
 }
 
+struct tegra_gpio_table {
+	int	gpio;	/* GPIO number */
+	bool	enable;	/* Enable for GPIO at init? */
+};
+
+void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);
 void tegra_gpio_enable(int gpio);
 void tegra_gpio_disable(int gpio);
 
-- 
1.7.0.4

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22  5:55   ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22  5:55 UTC (permalink / raw
  To: linux-tegra-u79uwXL29TY76Z2rM5mHXA
  Cc: ccross-z5hGa2qSFaRBDgjK7y7TUQ, konkers-z5hGa2qSFaRBDgjK7y7TUQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Olof Johansson

To give one place to setup the pins that are used as GPIOs instead
of as their pinmuxed functions. Specifying enabled as false explicitly
disables the gpio mode of that pin (if left on by firmware).

This should remove the need for calling these from specific drivers and
thus reduce tegra-specific code from them.

Signed-off-by: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
---
 arch/arm/mach-tegra/board-harmony-pinmux.c |   13 +++++++++++++
 arch/arm/mach-tegra/gpio.c                 |   15 ++++++++++++++-
 arch/arm/mach-tegra/include/mach/gpio.h    |    7 +++++++
 3 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
index 50b15d5..98b9ab2 100644
--- a/arch/arm/mach-tegra/board-harmony-pinmux.c
+++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
@@ -16,7 +16,9 @@
 
 #include <linux/kernel.h>
 #include <mach/pinmux.h>
+#include <mach/gpio.h>
 
+#include "gpio-names.h"
 #include "board-harmony.h"
 
 static struct tegra_pingroup_config harmony_pinmux[] = {
@@ -138,7 +140,18 @@ static struct tegra_pingroup_config harmony_pinmux[] = {
 	{TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 };
 
+static struct tegra_gpio_table gpio_table[] = {
+	{ .gpio = TEGRA_GPIO_PI5,	.enable = true	}, /* mmc2 cd	*/
+	{ .gpio = TEGRA_GPIO_PH1,	.enable = true	}, /* mmc2 wp	*/
+	{ .gpio = TEGRA_GPIO_PT3,	.enable = true	}, /* mmc2 pwr	*/
+	{ .gpio = TEGRA_GPIO_PH2,	.enable = true	}, /* mmc4 cd	*/
+	{ .gpio = TEGRA_GPIO_PH3,	.enable = true	}, /* mmc4 wp	*/
+	{ .gpio = TEGRA_GPIO_PI6,	.enable = true	}, /* mmc4 pwr	*/
+};
+
 void harmony_pinmux_init(void)
 {
 	tegra_pinmux_config_table(harmony_pinmux, ARRAY_SIZE(harmony_pinmux));
+
+	tegra_gpio_config(gpio_table, ARRAY_SIZE(gpio_table));
 }
diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
index 132dcd6..ffc146d 100644
--- a/arch/arm/mach-tegra/gpio.c
+++ b/arch/arm/mach-tegra/gpio.c
@@ -378,9 +378,22 @@ static int __init tegra_gpio_init(void)
 
 	return 0;
 }
-
 postcore_initcall(tegra_gpio_init);
 
+void __init tegra_gpio_config(struct tegra_gpio_table *table, int num)
+{
+	int i;
+
+	for (i = 0; i < num; i++) {
+		int gpio = table[i].gpio;
+
+		if (table[i].enable)
+			tegra_gpio_enable(gpio);
+		else
+			tegra_gpio_disable(gpio);
+	}
+}
+
 #ifdef	CONFIG_DEBUG_FS
 
 #include <linux/debugfs.h>
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
index e31f486..2369fba 100644
--- a/arch/arm/mach-tegra/include/mach/gpio.h
+++ b/arch/arm/mach-tegra/include/mach/gpio.h
@@ -20,6 +20,7 @@
 #ifndef __MACH_TEGRA_GPIO_H
 #define __MACH_TEGRA_GPIO_H
 
+#include <linux/init.h>
 #include <mach/irqs.h>
 
 #define TEGRA_NR_GPIOS		INT_GPIO_NR
@@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)
 	return -EINVAL;
 }
 
+struct tegra_gpio_table {
+	int	gpio;	/* GPIO number */
+	bool	enable;	/* Enable for GPIO at init? */
+};
+
+void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);
 void tegra_gpio_enable(int gpio);
 void tegra_gpio_disable(int gpio);
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 13:13     ` Sergei Shtylyov
  0 siblings, 0 replies; 20+ messages in thread
From: Sergei Shtylyov @ 2011-02-22 13:13 UTC (permalink / raw
  To: linux-arm-kernel

Hello.

On 22-02-2011 8:55, Olof Johansson wrote:

> To give one place to setup the pins that are used as GPIOs instead
> of as their pinmuxed functions. Specifying enabled as false explicitly
> disables the gpio mode of that pin (if left on by firmware).

> This should remove the need for calling these from specific drivers and
> thus reduce tegra-specific code from them.

> Signed-off-by: Olof Johansson<olof@lixom.net>
[...]

> diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
> index e31f486..2369fba 100644
> --- a/arch/arm/mach-tegra/include/mach/gpio.h
> +++ b/arch/arm/mach-tegra/include/mach/gpio.h
> @@ -20,6 +20,7 @@
>   #ifndef __MACH_TEGRA_GPIO_H
>   #define __MACH_TEGRA_GPIO_H
>
> +#include<linux/init.h>
>   #include<mach/irqs.h>
>
>   #define TEGRA_NR_GPIOS		INT_GPIO_NR
> @@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)
>   	return -EINVAL;
>   }
>
> +struct tegra_gpio_table {
> +	int	gpio;	/* GPIO number */
> +	bool	enable;	/* Enable for GPIO at init? */
> +};
> +
> +void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);

    You don't need to annotate the declaration as __init.

WBR, Sergei

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 13:13     ` Sergei Shtylyov
  0 siblings, 0 replies; 20+ messages in thread
From: Sergei Shtylyov @ 2011-02-22 13:13 UTC (permalink / raw
  To: Olof Johansson
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	konkers-z5hGa2qSFaRBDgjK7y7TUQ, ccross-z5hGa2qSFaRBDgjK7y7TUQ

Hello.

On 22-02-2011 8:55, Olof Johansson wrote:

> To give one place to setup the pins that are used as GPIOs instead
> of as their pinmuxed functions. Specifying enabled as false explicitly
> disables the gpio mode of that pin (if left on by firmware).

> This should remove the need for calling these from specific drivers and
> thus reduce tegra-specific code from them.

> Signed-off-by: Olof Johansson<olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
[...]

> diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
> index e31f486..2369fba 100644
> --- a/arch/arm/mach-tegra/include/mach/gpio.h
> +++ b/arch/arm/mach-tegra/include/mach/gpio.h
> @@ -20,6 +20,7 @@
>   #ifndef __MACH_TEGRA_GPIO_H
>   #define __MACH_TEGRA_GPIO_H
>
> +#include<linux/init.h>
>   #include<mach/irqs.h>
>
>   #define TEGRA_NR_GPIOS		INT_GPIO_NR
> @@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)
>   	return -EINVAL;
>   }
>
> +struct tegra_gpio_table {
> +	int	gpio;	/* GPIO number */
> +	bool	enable;	/* Enable for GPIO at init? */
> +};
> +
> +void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);

    You don't need to annotate the declaration as __init.

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 15:31       ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22 15:31 UTC (permalink / raw
  To: linux-arm-kernel

Hi,

On Tue, Feb 22, 2011 at 5:13 AM, Sergei Shtylyov <sshtylyov@mvista.com> wrote:

>> +void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);
>
> ? You don't need to annotate the declaration as __init.

D'oh. Fixed. Thanks.


-Olof

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 15:31       ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22 15:31 UTC (permalink / raw
  To: Sergei Shtylyov
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	konkers-z5hGa2qSFaRBDgjK7y7TUQ, ccross-z5hGa2qSFaRBDgjK7y7TUQ

Hi,

On Tue, Feb 22, 2011 at 5:13 AM, Sergei Shtylyov <sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org> wrote:

>> +void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);
>
>   You don't need to annotate the declaration as __init.

D'oh. Fixed. Thanks.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 19:18     ` Erik Gilling
  0 siblings, 0 replies; 20+ messages in thread
From: Erik Gilling @ 2011-02-22 19:18 UTC (permalink / raw
  To: linux-arm-kernel

Can you split the boardfile changes into their own patch?  Also see
the below whitespace only change.  Other than that, looks good.

On Mon, Feb 21, 2011 at 9:55 PM, Olof Johansson <olof@lixom.net> wrote:
snip
> diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
> index 132dcd6..ffc146d 100644
> --- a/arch/arm/mach-tegra/gpio.c
> +++ b/arch/arm/mach-tegra/gpio.c
> @@ -378,9 +378,22 @@ static int __init tegra_gpio_init(void)
>
> ? ? ? ?return 0;
> ?}
> -
> ?postcore_initcall(tegra_gpio_init);

whitespace only change

>
> +void __init tegra_gpio_config(struct tegra_gpio_table *table, int num)
> +{
> + ? ? ? int i;
> +
> + ? ? ? for (i = 0; i < num; i++) {
> + ? ? ? ? ? ? ? int gpio = table[i].gpio;
> +
> + ? ? ? ? ? ? ? if (table[i].enable)
> + ? ? ? ? ? ? ? ? ? ? ? tegra_gpio_enable(gpio);
> + ? ? ? ? ? ? ? else
> + ? ? ? ? ? ? ? ? ? ? ? tegra_gpio_disable(gpio);
> + ? ? ? }
> +}
> +
> ?#ifdef CONFIG_DEBUG_FS
>
> ?#include <linux/debugfs.h>
> diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
> index e31f486..2369fba 100644
> --- a/arch/arm/mach-tegra/include/mach/gpio.h
> +++ b/arch/arm/mach-tegra/include/mach/gpio.h
> @@ -20,6 +20,7 @@
> ?#ifndef __MACH_TEGRA_GPIO_H
> ?#define __MACH_TEGRA_GPIO_H
>
> +#include <linux/init.h>
> ?#include <mach/irqs.h>
>
> ?#define TEGRA_NR_GPIOS ? ? ? ? INT_GPIO_NR
> @@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)
> ? ? ? ?return -EINVAL;
> ?}
>
> +struct tegra_gpio_table {
> + ? ? ? int ? ? gpio; ? /* GPIO number */
> + ? ? ? bool ? ?enable; /* Enable for GPIO at init? */
> +};
> +
> +void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);
> ?void tegra_gpio_enable(int gpio);
> ?void tegra_gpio_disable(int gpio);
>
> --
> 1.7.0.4
>
>

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 19:18     ` Erik Gilling
  0 siblings, 0 replies; 20+ messages in thread
From: Erik Gilling @ 2011-02-22 19:18 UTC (permalink / raw
  To: Olof Johansson
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, ccross-z5hGa2qSFaRBDgjK7y7TUQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Can you split the boardfile changes into their own patch?  Also see
the below whitespace only change.  Other than that, looks good.

On Mon, Feb 21, 2011 at 9:55 PM, Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org> wrote:
snip
> diff --git a/arch/arm/mach-tegra/gpio.c b/arch/arm/mach-tegra/gpio.c
> index 132dcd6..ffc146d 100644
> --- a/arch/arm/mach-tegra/gpio.c
> +++ b/arch/arm/mach-tegra/gpio.c
> @@ -378,9 +378,22 @@ static int __init tegra_gpio_init(void)
>
>        return 0;
>  }
> -
>  postcore_initcall(tegra_gpio_init);

whitespace only change

>
> +void __init tegra_gpio_config(struct tegra_gpio_table *table, int num)
> +{
> +       int i;
> +
> +       for (i = 0; i < num; i++) {
> +               int gpio = table[i].gpio;
> +
> +               if (table[i].enable)
> +                       tegra_gpio_enable(gpio);
> +               else
> +                       tegra_gpio_disable(gpio);
> +       }
> +}
> +
>  #ifdef CONFIG_DEBUG_FS
>
>  #include <linux/debugfs.h>
> diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
> index e31f486..2369fba 100644
> --- a/arch/arm/mach-tegra/include/mach/gpio.h
> +++ b/arch/arm/mach-tegra/include/mach/gpio.h
> @@ -20,6 +20,7 @@
>  #ifndef __MACH_TEGRA_GPIO_H
>  #define __MACH_TEGRA_GPIO_H
>
> +#include <linux/init.h>
>  #include <mach/irqs.h>
>
>  #define TEGRA_NR_GPIOS         INT_GPIO_NR
> @@ -47,6 +48,12 @@ static inline int irq_to_gpio(unsigned int irq)
>        return -EINVAL;
>  }
>
> +struct tegra_gpio_table {
> +       int     gpio;   /* GPIO number */
> +       bool    enable; /* Enable for GPIO at init? */
> +};
> +
> +void __init tegra_gpio_config(struct tegra_gpio_table *table, int num);
>  void tegra_gpio_enable(int gpio);
>  void tegra_gpio_disable(int gpio);
>
> --
> 1.7.0.4
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 19:35       ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22 19:35 UTC (permalink / raw
  To: linux-arm-kernel

Hi

On Tue, Feb 22, 2011 at 11:18 AM, Erik Gilling <konkers@android.com> wrote:
> Can you split the boardfile changes into their own patch? ?Also see
> the below whitespace only change. ?Other than that, looks good.

Ok, done (will push separately, no need to repost just with the split though).

Thanks.


>> ?}
>> -
>> ?postcore_initcall(tegra_gpio_init);
>
> whitespace only change

D'oh, sloppy of me. Fixed.


-Olof

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 19:35       ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22 19:35 UTC (permalink / raw
  To: Erik Gilling
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, ccross-z5hGa2qSFaRBDgjK7y7TUQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi

On Tue, Feb 22, 2011 at 11:18 AM, Erik Gilling <konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
> Can you split the boardfile changes into their own patch?  Also see
> the below whitespace only change.  Other than that, looks good.

Ok, done (will push separately, no need to repost just with the split though).

Thanks.


>>  }
>> -
>>  postcore_initcall(tegra_gpio_init);
>
> whitespace only change

D'oh, sloppy of me. Fixed.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 20:46     ` Russell King - ARM Linux
  0 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2011-02-22 20:46 UTC (permalink / raw
  To: linux-arm-kernel

On Mon, Feb 21, 2011 at 11:55:12PM -0600, Olof Johansson wrote:
>  #include <linux/kernel.h>
>  #include <mach/pinmux.h>
> +#include <mach/gpio.h>

linux/gpio.h please

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 20:46     ` Russell King - ARM Linux
  0 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2011-02-22 20:46 UTC (permalink / raw
  To: Olof Johansson
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	konkers-z5hGa2qSFaRBDgjK7y7TUQ, ccross-z5hGa2qSFaRBDgjK7y7TUQ

On Mon, Feb 21, 2011 at 11:55:12PM -0600, Olof Johansson wrote:
>  #include <linux/kernel.h>
>  #include <mach/pinmux.h>
> +#include <mach/gpio.h>

linux/gpio.h please
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 21:00       ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22 21:00 UTC (permalink / raw
  To: linux-arm-kernel

On Tue, Feb 22, 2011 at 12:46 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Mon, Feb 21, 2011 at 11:55:12PM -0600, Olof Johansson wrote:
>> ?#include <linux/kernel.h>
>> ?#include <mach/pinmux.h>
>> +#include <mach/gpio.h>
>
> linux/gpio.h please

Thanks, fixed.


-Olof

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 21:00       ` Olof Johansson
  0 siblings, 0 replies; 20+ messages in thread
From: Olof Johansson @ 2011-02-22 21:00 UTC (permalink / raw
  To: Russell King - ARM Linux
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	konkers-z5hGa2qSFaRBDgjK7y7TUQ, ccross-z5hGa2qSFaRBDgjK7y7TUQ

On Tue, Feb 22, 2011 at 12:46 PM, Russell King - ARM Linux
<linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org> wrote:
> On Mon, Feb 21, 2011 at 11:55:12PM -0600, Olof Johansson wrote:
>>  #include <linux/kernel.h>
>>  #include <mach/pinmux.h>
>> +#include <mach/gpio.h>
>
> linux/gpio.h please

Thanks, fixed.


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 23:14         ` Erik Gilling
  0 siblings, 0 replies; 20+ messages in thread
From: Erik Gilling @ 2011-02-22 23:14 UTC (permalink / raw
  To: linux-arm-kernel

Cool

Acked-by: Erik Gilling <konkers@android.com>

On Tue, Feb 22, 2011 at 11:35 AM, Olof Johansson <olof@lixom.net> wrote:
> Hi
>
> On Tue, Feb 22, 2011 at 11:18 AM, Erik Gilling <konkers@android.com> wrote:
>> Can you split the boardfile changes into their own patch? ?Also see
>> the below whitespace only change. ?Other than that, looks good.
>
> Ok, done (will push separately, no need to repost just with the split though).
>
> Thanks.
>
>
>>> ?}
>>> -
>>> ?postcore_initcall(tegra_gpio_init);
>>
>> whitespace only change
>
> D'oh, sloppy of me. Fixed.
>
>
> -Olof
>

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

* Re: [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config
@ 2011-02-22 23:14         ` Erik Gilling
  0 siblings, 0 replies; 20+ messages in thread
From: Erik Gilling @ 2011-02-22 23:14 UTC (permalink / raw
  To: Olof Johansson
  Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA, ccross-z5hGa2qSFaRBDgjK7y7TUQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Cool

Acked-by: Erik Gilling <konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>

On Tue, Feb 22, 2011 at 11:35 AM, Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org> wrote:
> Hi
>
> On Tue, Feb 22, 2011 at 11:18 AM, Erik Gilling <konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org> wrote:
>> Can you split the boardfile changes into their own patch?  Also see
>> the below whitespace only change.  Other than that, looks good.
>
> Ok, done (will push separately, no need to repost just with the split though).
>
> Thanks.
>
>
>>>  }
>>> -
>>>  postcore_initcall(tegra_gpio_init);
>>
>> whitespace only change
>
> D'oh, sloppy of me. Fixed.
>
>
> -Olof
>
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-02-22 23:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <AANLkTikauaANKBpfNHXF5PgCRS4vdbq+eNDF6itU6yHS@mail.gmail.com>
     [not found] ` <AANLkTikauaANKBpfNHXF5PgCRS4vdbq+eNDF6itU6yHS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-21 20:44   ` [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config Olof Johansson
     [not found]     ` <AANLkTi=Mg7-hM69EMVSOkS8goU+H53KnDC5q2KASHOtz-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-21 22:58       ` Erik Gilling
2011-02-22  5:24         ` Olof Johansson
2011-02-22  5:55 [PATCH v3 0/6] Tegra board patches Olof Johansson
2011-02-22  5:55 ` [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config Olof Johansson
2011-02-22  5:55   ` Olof Johansson
2011-02-22 13:13   ` Sergei Shtylyov
2011-02-22 13:13     ` Sergei Shtylyov
2011-02-22 15:31     ` Olof Johansson
2011-02-22 15:31       ` Olof Johansson
2011-02-22 19:18   ` Erik Gilling
2011-02-22 19:18     ` Erik Gilling
2011-02-22 19:35     ` Olof Johansson
2011-02-22 19:35       ` Olof Johansson
2011-02-22 23:14       ` Erik Gilling
2011-02-22 23:14         ` Erik Gilling
2011-02-22 20:46   ` Russell King - ARM Linux
2011-02-22 20:46     ` Russell King - ARM Linux
2011-02-22 21:00     ` Olof Johansson
2011-02-22 21:00       ` Olof Johansson
  -- strict thread matches above, loose matches on Subject: below --
2011-02-21 19:06 [PATCH 0/6] Tegra board patches Olof Johansson
     [not found] ` <1298315206-8887-1-git-send-email-olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
2011-02-21 19:06   ` [PATCH 1/6] ARM: tegra: add tegra_gpio_table and tegra_gpio_config Olof Johansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.