* gpio irqs broken on imx27 with dt
@ 2012-04-27 12:50 Uwe Kleine-König
2012-04-27 13:18 ` Dong Aisheng
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2012-04-27 12:50 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
I experience problems on using gpio irqs on an imx27 based machine
booting with dt.
I think one problem is:
if (mxc_gpio_hwtype == IMX21_GPIO) {
/* setup one handler for all GPIO interrupts */
if (pdev->id == 0)
irq_set_chained_handler(port->irq,
mx2_gpio_irq_handler);
} ...
because the inner if doesn't trigger as dt-created gpio devices have all
pdev->id == -1.
I havn't looked deeper into it yet, but I think another problem is that
gpios don't start at 0 and so the usual
#define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
doesn't work either (which might be expected, but doesn't necessarily
needs to fail?!). (You could argue I shouldn't hardcode gpio numbers any
more, but as not all device drivers are oftree aware yet I need to get
of the ground somehow.)
I'm leaving for the weekend now, so just wanted you to inform that there
is a problem. Shawn, maybe you have an idea?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 5+ messages in thread
* gpio irqs broken on imx27 with dt
2012-04-27 12:50 gpio irqs broken on imx27 with dt Uwe Kleine-König
@ 2012-04-27 13:18 ` Dong Aisheng
2012-04-27 21:16 ` Fabio Estevam
2012-04-27 21:50 ` Sascha Hauer
2 siblings, 0 replies; 5+ messages in thread
From: Dong Aisheng @ 2012-04-27 13:18 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 27, 2012 at 02:50:48PM +0200, Uwe Kleine-K?nig wrote:
> Hello,
>
> I experience problems on using gpio irqs on an imx27 based machine
> booting with dt.
>
> I think one problem is:
>
> if (mxc_gpio_hwtype == IMX21_GPIO) {
> /* setup one handler for all GPIO interrupts */
> if (pdev->id == 0)
> irq_set_chained_handler(port->irq,
> mx2_gpio_irq_handler);
> } ...
>
> because the inner if doesn't trigger as dt-created gpio devices have all
> pdev->id == -1.
>
> I havn't looked deeper into it yet, but I think another problem is that
> gpios don't start at 0 and so the usual
>
Yes, for dt, gpio base is allocated dynamically.
See gpiochip_find_base.
> #define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
>
> doesn't work either (which might be expected, but doesn't necessarily
> needs to fail?!). (You could argue I shouldn't hardcode gpio numbers any
> more, but as not all device drivers are oftree aware yet I need to get
> of the ground somehow.)
>
I guess dt user never know a pin's gpio number since they're allocated
dynamically. User should only parse it from device tree then it can be safe
to use.
Regards
Dong Aisheng
^ permalink raw reply [flat|nested] 5+ messages in thread
* gpio irqs broken on imx27 with dt
2012-04-27 12:50 gpio irqs broken on imx27 with dt Uwe Kleine-König
2012-04-27 13:18 ` Dong Aisheng
@ 2012-04-27 21:16 ` Fabio Estevam
2012-04-27 21:50 ` Sascha Hauer
2 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2012-04-27 21:16 UTC (permalink / raw)
To: linux-arm-kernel
Uwe,
2012/4/27 Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>:
> Hello,
>
> I experience problems on using gpio irqs on an imx27 based machine
> booting with dt.
Currently there is no pinctrl driver for mx27.
What you can do as a temporary workaround is to do the same as mx51 or mx53:
config MACH_IMX51_DT
bool "Support i.MX51 platforms from device tree"
select SOC_IMX51
select MACH_MX51_BABBAGE
select USE_OF
help
Include support for Freescale i.MX51 based platforms
using the device tree for discovery
MACH_IMX51_DT currently selects MACH_MX51_BABBAGE so that the IOMUX
infrastructure can be used.
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 5+ messages in thread
* gpio irqs broken on imx27 with dt
2012-04-27 12:50 gpio irqs broken on imx27 with dt Uwe Kleine-König
2012-04-27 13:18 ` Dong Aisheng
2012-04-27 21:16 ` Fabio Estevam
@ 2012-04-27 21:50 ` Sascha Hauer
2012-04-28 10:31 ` Uwe Kleine-König
2 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2012-04-27 21:50 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Apr 27, 2012 at 02:50:48PM +0200, Uwe Kleine-K?nig wrote:
> Hello,
>
> I experience problems on using gpio irqs on an imx27 based machine
> booting with dt.
>
> I think one problem is:
>
> if (mxc_gpio_hwtype == IMX21_GPIO) {
> /* setup one handler for all GPIO interrupts */
> if (pdev->id == 0)
> irq_set_chained_handler(port->irq,
> mx2_gpio_irq_handler);
> } ...
>
> because the inner if doesn't trigger as dt-created gpio devices have all
> pdev->id == -1.
How about
static int once = 0;
if (mxc_gpio_hwtype == IMX21_GPIO) {
/* setup one handler for all GPIO interrupts */
if (!once) {
irq_set_chained_handler(port->irq,
mx2_gpio_irq_handler);
once = 1;
}
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] 5+ messages in thread
* gpio irqs broken on imx27 with dt
2012-04-27 21:50 ` Sascha Hauer
@ 2012-04-28 10:31 ` Uwe Kleine-König
0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2012-04-28 10:31 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On Fri, Apr 27, 2012 at 11:50:45PM +0200, Sascha Hauer wrote:
> On Fri, Apr 27, 2012 at 02:50:48PM +0200, Uwe Kleine-K?nig wrote:
> > I experience problems on using gpio irqs on an imx27 based machine
> > booting with dt.
> >
> > I think one problem is:
> >
> > if (mxc_gpio_hwtype == IMX21_GPIO) {
> > /* setup one handler for all GPIO interrupts */
> > if (pdev->id == 0)
> > irq_set_chained_handler(port->irq,
> > mx2_gpio_irq_handler);
> > } ...
> >
> > because the inner if doesn't trigger as dt-created gpio devices have all
> > pdev->id == -1.
>
> How about
>
> static int once = 0;
>
> if (mxc_gpio_hwtype == IMX21_GPIO) {
> /* setup one handler for all GPIO interrupts */
> if (!once) {
> irq_set_chained_handler(port->irq,
> mx2_gpio_irq_handler);
> once = 1;
> }
I did exactly this, but it didn't cure all my problems. And it's ugly
(not much more than testing pdev->id == 0 though). I'm not sure it's
worth to clean that up. (e.g. use a single device for the imx21 type
handling all ports vs. one device per port for the latter types. This
way each device would handle one and only one irq.)
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-28 10:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27 12:50 gpio irqs broken on imx27 with dt Uwe Kleine-König
2012-04-27 13:18 ` Dong Aisheng
2012-04-27 21:16 ` Fabio Estevam
2012-04-27 21:50 ` Sascha Hauer
2012-04-28 10:31 ` Uwe Kleine-König
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).