i.MX27: gpio device tree problems.

2 messages, 2 authors, 2012-07-18 · open the first message on its own page

i.MX27: gpio device tree problems.

From: javier Martin <hidden>
Date: 2012-07-18 13:03:41

Hi,
we are trying to port our Visstrim SM10 [1] to device tree and we've
found some problems related to gpios in the process:

1.- IRQs don't work properly since the value of 'pdev->id' when using
device tree is -1, so 'irq_set_chained_handler()' never gets called
[2]
2.- When using device tree GPIO numbers are allocated dynamically
using gpiolib [3]. This leads to different GPIO numbers being used
compared to the version without device tree. Since GPIOs are exposed
to the user space by gpilib using sysfs this breaks compatibility with
current user applications.

Here is an example:

Version without device tree:
gpiochip_add: registered GPIOs 0 to 31 on device: imx21-gpio.0
gpiochip_add: registered GPIOs 32 to 63 on device: imx21-gpio.1
gpiochip_add: registered GPIOs 64 to 95 on device: imx21-gpio.2
gpiochip_add: registered GPIOs 96 to 127 on device: imx21-gpio.3
gpiochip_add: registered GPIOs 128 to 159 on device: imx21-gpio.4
gpiochip_add: registered GPIOs 160 to 191 on device: imx21-gpio.5

Version with device tree:
gpiochip_add: registered GPIOs 224 to 255 on device: 10015000.gpio
gpiochip_add: registered GPIOs 192 to 223 on device: 10015100.gpio
gpiochip_add: registered GPIOs 160 to 191 on device: 10015200.gpio
gpiochip_add: registered GPIOs 128 to 159 on device: 10015300.gpio
gpiochip_add: registered GPIOs 96 to 127 on device: 10015400.gpio
gpiochip_add: registered GPIOs 64 to 95 on device: 10015500.gpio


I'm sure that problem 1 is an bug that must be fixed but I'm not so
confident about 2. Can we allow a change in the base number of the
GPIOs?

Regards.

[1] http://lxr.linux.no/#linux+v3.4.5/arch/arm/mach-imx/mach-imx27_visstrim_m10.c
[2] http://lxr.linux.no/#linux+v3.4.5/drivers/gpio/gpio-mxc.c#L400


-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com

i.MX27: gpio device tree problems.

From: s.hauer@pengutronix.de (Sascha Hauer)
Date: 2012-07-18 14:00:22

On Wed, Jul 18, 2012 at 03:03:41PM +0200, javier Martin wrote:
Hi,
we are trying to port our Visstrim SM10 [1] to device tree and we've
found some problems related to gpios in the process:

1.- IRQs don't work properly since the value of 'pdev->id' when using
device tree is -1, so 'irq_set_chained_handler()' never gets called
[2]
This should work since:

33a4e98 gpio/mxc: make irqs work for fsl,imx21-gpio devices
2.- When using device tree GPIO numbers are allocated dynamically
using gpiolib [3]. This leads to different GPIO numbers being used
compared to the version without device tree. Since GPIOs are exposed
to the user space by gpilib using sysfs this breaks compatibility with
current user applications.

Here is an example:

Version without device tree:
gpiochip_add: registered GPIOs 0 to 31 on device: imx21-gpio.0
gpiochip_add: registered GPIOs 32 to 63 on device: imx21-gpio.1
gpiochip_add: registered GPIOs 64 to 95 on device: imx21-gpio.2
gpiochip_add: registered GPIOs 96 to 127 on device: imx21-gpio.3
gpiochip_add: registered GPIOs 128 to 159 on device: imx21-gpio.4
gpiochip_add: registered GPIOs 160 to 191 on device: imx21-gpio.5

Version with device tree:
gpiochip_add: registered GPIOs 224 to 255 on device: 10015000.gpio
gpiochip_add: registered GPIOs 192 to 223 on device: 10015100.gpio
gpiochip_add: registered GPIOs 160 to 191 on device: 10015200.gpio
gpiochip_add: registered GPIOs 128 to 159 on device: 10015300.gpio
gpiochip_add: registered GPIOs 96 to 127 on device: 10015400.gpio
gpiochip_add: registered GPIOs 64 to 95 on device: 10015500.gpio
Known problem, I have no idea how to solve this.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help