* [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization
@ 2012-08-05 6:01 Shawn Guo
2012-08-05 6:01 ` [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe Shawn Guo
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Shawn Guo @ 2012-08-05 6:01 UTC (permalink / raw)
To: linux-arm-kernel
With commit 3e11f7b (gpio/generic: initialize basic_mmio_gpio shadow
variables properly) in place, the shadow variables initialization is
being done in generic driver bgpio_init call.
Remove the redundant shadow variables initialization from gpio-mxc
driver.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
drivers/gpio/gpio-mxc.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 4db460b..76e8cda 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -466,8 +466,6 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
port->bgc.gc.to_irq = mxc_gpio_to_irq;
port->bgc.gc.base = pdev->id * 32;
- port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir);
- port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);
err = gpiochip_add(&port->bgc.gc);
if (err)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe
2012-08-05 6:01 [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Shawn Guo
@ 2012-08-05 6:01 ` Shawn Guo
2012-08-05 9:47 ` Linus Walleij
2012-08-06 14:12 ` Uwe Kleine-König
2012-08-05 6:01 ` [PATCH 3/4] gpio/mxs: " Shawn Guo
` (3 subsequent siblings)
4 siblings, 2 replies; 12+ messages in thread
From: Shawn Guo @ 2012-08-05 6:01 UTC (permalink / raw)
To: linux-arm-kernel
Currently, unlike the non-DT probe where the gpio base is specified
with pdev->id, the DT probe uses the base dynamically allocated by
gpio core, which uses a completely different numbering scheme. This
causes two issues to user space applications which access sysfs entry
/sys/class/gpio/gpioN.
* It breaks the compatibility with user space applications between
non-DT and DT kernels.
* It's not intuitive and sometimes hard for users to map the Linux
gpio number to the actual hardware pin.
Use alias to identify the gpio port/bank, and then the gpio base
can be specified with port id to solve above issues. If alias is not
defined in device tree, the base number dynamically allocated by gpio
core will be used.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
drivers/gpio/gpio-mxc.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 76e8cda..80f44bb 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -465,7 +465,8 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
goto out_iounmap;
port->bgc.gc.to_irq = mxc_gpio_to_irq;
- port->bgc.gc.base = pdev->id * 32;
+ port->bgc.gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
+ pdev->id * 32;
err = gpiochip_add(&port->bgc.gc);
if (err)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/4] gpio/mxs: specify gpio base for device tree probe
2012-08-05 6:01 [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Shawn Guo
2012-08-05 6:01 ` [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe Shawn Guo
@ 2012-08-05 6:01 ` Shawn Guo
2012-08-05 9:48 ` Linus Walleij
2012-08-05 6:01 ` [PATCH 4/4] ARM: dts: imx: add alias for gpio Shawn Guo
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Shawn Guo @ 2012-08-05 6:01 UTC (permalink / raw)
To: linux-arm-kernel
Currently, unlike the non-DT probe where the gpio base is specified
with pdev->id, the DT probe uses the base dynamically allocated by
gpio core, which uses a completely different numbering scheme. This
causes two issues to user space applications which access sysfs entry
/sys/class/gpio/gpioN.
* It breaks the compatibility with user space applications between
non-DT and DT kernels.
* It's not intuitive and sometimes hard for users to map the Linux
gpio number to the actual hardware pin.
Use alias to identify the gpio port/bank, and then the gpio base
can be specified with port id to solve above issues. If alias is not
defined in device tree, the base number dynamically allocated by gpio
core will be used.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
drivers/gpio/gpio-mxs.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 39e4956..09687ce 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -290,7 +290,8 @@ static int __devinit mxs_gpio_probe(struct platform_device *pdev)
return err;
port->bgc.gc.to_irq = mxs_gpio_to_irq;
- port->bgc.gc.base = port->id * 32;
+ port->bgc.gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 :
+ pdev->id * 32;
err = gpiochip_add(&port->bgc.gc);
if (err) {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/4] ARM: dts: imx: add alias for gpio
2012-08-05 6:01 [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Shawn Guo
2012-08-05 6:01 ` [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe Shawn Guo
2012-08-05 6:01 ` [PATCH 3/4] gpio/mxs: " Shawn Guo
@ 2012-08-05 6:01 ` Shawn Guo
2012-08-05 9:49 ` Linus Walleij
2012-08-05 9:45 ` [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Linus Walleij
2012-08-06 11:38 ` Dirk Behme
4 siblings, 1 reply; 12+ messages in thread
From: Shawn Guo @ 2012-08-05 6:01 UTC (permalink / raw)
To: linux-arm-kernel
Add alias for gpio nodes, so that gpio driver can identify the port
number and then specify a sensible gpio base rather than using the
one dynamically allocated by gpio core.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/boot/dts/imx27.dtsi | 6 ++++++
arch/arm/boot/dts/imx51.dtsi | 4 ++++
arch/arm/boot/dts/imx53.dtsi | 7 +++++++
arch/arm/boot/dts/imx6q.dtsi | 7 +++++++
4 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi
index 00bae3a..5303ab6 100644
--- a/arch/arm/boot/dts/imx27.dtsi
+++ b/arch/arm/boot/dts/imx27.dtsi
@@ -19,6 +19,12 @@
serial3 = &uart4;
serial4 = &uart5;
serial5 = &uart6;
+ gpio0 = &gpio1;
+ gpio1 = &gpio2;
+ gpio2 = &gpio3;
+ gpio3 = &gpio4;
+ gpio4 = &gpio5;
+ gpio5 = &gpio6;
};
avic: avic-interrupt-controller at e0000000 {
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 53cbaa3..aba28dc 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -17,6 +17,10 @@
serial0 = &uart1;
serial1 = &uart2;
serial2 = &uart3;
+ gpio0 = &gpio1;
+ gpio1 = &gpio2;
+ gpio2 = &gpio3;
+ gpio3 = &gpio4;
};
tzic: tz-interrupt-controller at e0000000 {
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index fc79cdc..cd37165 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -19,6 +19,13 @@
serial2 = &uart3;
serial3 = &uart4;
serial4 = &uart5;
+ gpio0 = &gpio1;
+ gpio1 = &gpio2;
+ gpio2 = &gpio3;
+ gpio3 = &gpio4;
+ gpio4 = &gpio5;
+ gpio5 = &gpio6;
+ gpio6 = &gpio7;
};
tzic: tz-interrupt-controller at 0fffc000 {
diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 3d3c64b..fd57079 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -19,6 +19,13 @@
serial2 = &uart3;
serial3 = &uart4;
serial4 = &uart5;
+ gpio0 = &gpio1;
+ gpio1 = &gpio2;
+ gpio2 = &gpio3;
+ gpio3 = &gpio4;
+ gpio4 = &gpio5;
+ gpio5 = &gpio6;
+ gpio6 = &gpio7;
};
cpus {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization
2012-08-05 6:01 [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Shawn Guo
` (2 preceding siblings ...)
2012-08-05 6:01 ` [PATCH 4/4] ARM: dts: imx: add alias for gpio Shawn Guo
@ 2012-08-05 9:45 ` Linus Walleij
2012-08-06 11:38 ` Dirk Behme
4 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2012-08-05 9:45 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Aug 5, 2012 at 8:01 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> With commit 3e11f7b (gpio/generic: initialize basic_mmio_gpio shadow
> variables properly) in place, the shadow variables initialization is
> being done in generic driver bgpio_init call.
>
> Remove the redundant shadow variables initialization from gpio-mxc
> driver.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Applied.
Thanks,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe
2012-08-05 6:01 ` [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe Shawn Guo
@ 2012-08-05 9:47 ` Linus Walleij
2012-08-06 14:12 ` Uwe Kleine-König
1 sibling, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2012-08-05 9:47 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Aug 5, 2012 at 8:01 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> Currently, unlike the non-DT probe where the gpio base is specified
> with pdev->id, the DT probe uses the base dynamically allocated by
> gpio core, which uses a completely different numbering scheme. This
> causes two issues to user space applications which access sysfs entry
> /sys/class/gpio/gpioN.
Applied.
Thanks,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] gpio/mxs: specify gpio base for device tree probe
2012-08-05 6:01 ` [PATCH 3/4] gpio/mxs: " Shawn Guo
@ 2012-08-05 9:48 ` Linus Walleij
2012-08-06 13:51 ` Shawn Guo
0 siblings, 1 reply; 12+ messages in thread
From: Linus Walleij @ 2012-08-05 9:48 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Aug 5, 2012 at 8:01 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> Currently, unlike the non-DT probe where the gpio base is specified
> with pdev->id, the DT probe uses the base dynamically allocated by
> gpio core, which uses a completely different numbering scheme. This
> causes two issues to user space applications which access sysfs entry
> /sys/class/gpio/gpioN.
Applied.
Thanks,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/4] ARM: dts: imx: add alias for gpio
2012-08-05 6:01 ` [PATCH 4/4] ARM: dts: imx: add alias for gpio Shawn Guo
@ 2012-08-05 9:49 ` Linus Walleij
0 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2012-08-05 9:49 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Aug 5, 2012 at 8:01 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> Add alias for gpio nodes, so that gpio driver can identify the port
> number and then specify a sensible gpio base rather than using the
> one dynamically allocated by gpio core.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Applied.
Thanks,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization
2012-08-05 6:01 [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Shawn Guo
` (3 preceding siblings ...)
2012-08-05 9:45 ` [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Linus Walleij
@ 2012-08-06 11:38 ` Dirk Behme
4 siblings, 0 replies; 12+ messages in thread
From: Dirk Behme @ 2012-08-06 11:38 UTC (permalink / raw)
To: linux-arm-kernel
On 05.08.2012 08:01, Shawn Guo wrote:
> With commit 3e11f7b (gpio/generic: initialize basic_mmio_gpio shadow
> variables properly) in place, the shadow variables initialization is
> being done in generic driver bgpio_init call.
>
> Remove the redundant shadow variables initialization from gpio-mxc
> driver.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Whole series:
Tested-by: Dirk Behme <dirk.behme@de.bosch.com>
Looks good :)
Many thanks
Dirk
> ---
> drivers/gpio/gpio-mxc.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 4db460b..76e8cda 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -466,8 +466,6 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
>
> port->bgc.gc.to_irq = mxc_gpio_to_irq;
> port->bgc.gc.base = pdev->id * 32;
> - port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir);
> - port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);
>
> err = gpiochip_add(&port->bgc.gc);
> if (err)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] gpio/mxs: specify gpio base for device tree probe
2012-08-05 9:48 ` Linus Walleij
@ 2012-08-06 13:51 ` Shawn Guo
2012-08-07 6:56 ` Linus Walleij
0 siblings, 1 reply; 12+ messages in thread
From: Shawn Guo @ 2012-08-06 13:51 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Aug 05, 2012 at 11:48:24AM +0200, Linus Walleij wrote:
> On Sun, Aug 5, 2012 at 8:01 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
>
> > Currently, unlike the non-DT probe where the gpio base is specified
> > with pdev->id, the DT probe uses the base dynamically allocated by
> > gpio core, which uses a completely different numbering scheme. This
> > causes two issues to user space applications which access sysfs entry
> > /sys/class/gpio/gpioN.
>
> Applied.
>
Sorry, Linus. I just recall gpio-mxs driver already reads alias to
assign port->id for DT boot at the beginning of probe function, and
this patch is completely a noise therefore. So can you please drop
the patch from you branch? Sorry again.
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe
2012-08-05 6:01 ` [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe Shawn Guo
2012-08-05 9:47 ` Linus Walleij
@ 2012-08-06 14:12 ` Uwe Kleine-König
1 sibling, 0 replies; 12+ messages in thread
From: Uwe Kleine-König @ 2012-08-06 14:12 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Aug 05, 2012 at 02:01:26PM +0800, Shawn Guo wrote:
> Currently, unlike the non-DT probe where the gpio base is specified
> with pdev->id, the DT probe uses the base dynamically allocated by
> gpio core, which uses a completely different numbering scheme. This
> causes two issues to user space applications which access sysfs entry
> /sys/class/gpio/gpioN.
>
> * It breaks the compatibility with user space applications between
> non-DT and DT kernels.
>
> * It's not intuitive and sometimes hard for users to map the Linux
> gpio number to the actual hardware pin.
>
> Use alias to identify the gpio port/bank, and then the gpio base
> can be specified with port id to solve above issues. If alias is not
> defined in device tree, the base number dynamically allocated by gpio
> core will be used.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
I applied patches 1, 2 and 4 to my imx35 dt tree and they work like a
charm.
Tested-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
for these three.
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 3/4] gpio/mxs: specify gpio base for device tree probe
2012-08-06 13:51 ` Shawn Guo
@ 2012-08-07 6:56 ` Linus Walleij
0 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2012-08-07 6:56 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 6, 2012 at 3:51 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Sun, Aug 05, 2012 at 11:48:24AM +0200, Linus Walleij wrote:
>> On Sun, Aug 5, 2012 at 8:01 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
>>
>> > Currently, unlike the non-DT probe where the gpio base is specified
>> > with pdev->id, the DT probe uses the base dynamically allocated by
>> > gpio core, which uses a completely different numbering scheme. This
>> > causes two issues to user space applications which access sysfs entry
>> > /sys/class/gpio/gpioN.
>>
>> Applied.
>>
> Sorry, Linus. I just recall gpio-mxs driver already reads alias to
> assign port->id for DT boot at the beginning of probe function, and
> this patch is completely a noise therefore. So can you please drop
> the patch from you branch? Sorry again.
OK dropped this patch...
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2012-08-07 6:56 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-05 6:01 [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Shawn Guo
2012-08-05 6:01 ` [PATCH 2/4] gpio/mxc: specify gpio base for device tree probe Shawn Guo
2012-08-05 9:47 ` Linus Walleij
2012-08-06 14:12 ` Uwe Kleine-König
2012-08-05 6:01 ` [PATCH 3/4] gpio/mxs: " Shawn Guo
2012-08-05 9:48 ` Linus Walleij
2012-08-06 13:51 ` Shawn Guo
2012-08-07 6:56 ` Linus Walleij
2012-08-05 6:01 ` [PATCH 4/4] ARM: dts: imx: add alias for gpio Shawn Guo
2012-08-05 9:49 ` Linus Walleij
2012-08-05 9:45 ` [PATCH 1/4] gpio/mxc: remove redundant shadow variables initialization Linus Walleij
2012-08-06 11:38 ` Dirk Behme
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).