gpio/mxc: remove redundant shadow variables initialization
Subsystems (3)
PATCH 1/4 gpio/mxc: remove redundant shadow variables initialization
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.
--- drivers/gpio/gpio-mxc.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/gpio/gpio-mxc.c +0 -2
@@ -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)
Signature · 1 line
1.7.5.4
PATCH 2/4 gpio/mxc: specify gpio base for device tree probe
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.
--- drivers/gpio/gpio-mxc.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpio/gpio-mxc.c +2 -1
@@ -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)
Signature · 1 line
1.7.5.4
Linus Walleij
AppliedPATCH 2/4 gpio/mxc: specify gpio base for device tree probe
Quoted 5 lines · Shawn Guo
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
PATCH 2/4 gpio/mxc: specify gpio base for device tree probe
In reply to Shawn GuoQuoted 12 lines · Shawn Guo
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.
Quoted 6 lines
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 <[email protected]>
I applied patches 1, 2 and 4 to my imx35 dt tree and they work like a charm.
for these three.
Thanks
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH 3/4 gpio/mxs: specify gpio base for device tree probe
In reply to Shawn GuoCurrently, 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.
--- drivers/gpio/gpio-mxs.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpio/gpio-mxs.c +2 -1
@@ -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) {
Signature · 1 line
1.7.5.4
Linus Walleij
AppliedPATCH 3/4 gpio/mxs: specify gpio base for device tree probe
Quoted 5 lines · Shawn Guo
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
PATCH 3/4 gpio/mxs: specify gpio base for device tree probe
Quoted 10 lines · Linus Walleij
Quoted 5 lines · Shawn Guo
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.
Signature · 2 lines
Regards, Shawn
PATCH 3/4 gpio/mxs: specify gpio base for device tree probe
Quoted 9 lines · Shawn Guo
Quoted 8 lines · Linus Walleij
Quoted 5 lines · Shawn Guo
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.
Quoted 6 lines
Quoted 2 lines
Applied.
Sorry, Linus. I just recall gpio-mxs driver already reads alias to assign
port->idfor 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
PATCH 4/4 ARM: dts: imx: add alias for gpio
In reply to Shawn GuoAdd 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.
--- 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(-)
arch/arm/boot/dts/imx27.dtsi +6 -0
@@ -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 {
arch/arm/boot/dts/imx51.dtsi +4 -0
@@ -17,6 +17,10 @@ serial0 = &uart1; serial1 = &uart2; serial2 = &uart3; + gpio0 = &gpio1; + gpio1 = &gpio2; + gpio2 = &gpio3; + gpio3 = &gpio4; }; tzic: tz-interrupt-controller at e0000000 {
arch/arm/boot/dts/imx53.dtsi +7 -0
@@ -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 {
arch/arm/boot/dts/imx6q.dtsi +7 -0
@@ -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 {
Signature · 1 line
1.7.5.4
Linus Walleij
AppliedPATCH 4/4 ARM: dts: imx: add alias for gpio
Quoted 5 lines · Shawn Guo
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 <[email protected]>
Applied.
Thanks,
Linus Walleij
Linus Walleij
AppliedPATCH 1/4 gpio/mxc: remove redundant shadow variables initialization
In reply to Shawn GuoQuoted 8 lines · Shawn Guo
With commit 3e11f7b (gpio/generic: initialize
basic_mmio_gpioshadow variables properly) in place, the shadow variables initialization is being done in generic driverbgpio_initcall.Remove the redundant shadow variables initialization from gpio-mxc driver.
Signed-off-by Shawn Guo <[email protected]>
Applied.
Thanks,
Linus Walleij
PATCH 1/4 gpio/mxc: remove redundant shadow variables initialization
In reply to Shawn GuoQuoted 8 lines · Shawn Guo
With commit 3e11f7b (gpio/generic: initialize
basic_mmio_gpioshadow variables properly) in place, the shadow variables initialization is being done in generic driverbgpio_initcall.Remove the redundant shadow variables initialization from gpio-mxc driver.
Signed-off-by Shawn Guo <[email protected]>
Whole series:
Looks good :)
Many thanks
Dirk
Quoted 17 lines
--- drivers/gpio/gpio-mxc.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)drivers/gpio/gpio-mxc.c +0
-2@@ -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)