All of lore.kernel.org
 help / color / mirror / Atom feed
* i.MX27: gpio device tree problems.
@ 2012-07-18 13:03 javier Martin
  2012-07-18 14:00 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: javier Martin @ 2012-07-18 13:03 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* i.MX27: gpio device tree problems.
  2012-07-18 13:03 i.MX27: gpio device tree problems javier Martin
@ 2012-07-18 14:00 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2012-07-18 14:00 UTC (permalink / raw)
  To: linux-arm-kernel

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 |

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

end of thread, other threads:[~2012-07-18 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18 13:03 i.MX27: gpio device tree problems javier Martin
2012-07-18 14:00 ` Sascha Hauer

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.