Skip to contentSkip to conversation

moving gpio driver to drivers/gpio, how to initialize?

DISCUSSION Sascha Hauer 3 participants 4 messages May 11, 2011

lore
Share & tools
lore
#0 lore raw

I think we mostly agree on moving the gpio drivers from arch/arm to drivers/gpio. A question we have to answer is how we want to initialize these drivers. On nomadik these are platform drivers, but on i.MX and others platform drivers initialize too late, since the gpio functions are already used at init_machine time. PXA uses sysdev for their gpios, but is this the correct answer?

I have the impression that a platform device is the right answer to this, but it would require changes in many boards.

Any thoughts?

Signature · 4 lines
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 |
#1 lore raw
Quoted 6 lines · Sascha Hauer

I think we mostly agree on moving the gpio drivers from arch/arm to drivers/gpio. A question we have to answer is how we want to initialize these drivers. On nomadik these are platform drivers, but on i.MX and others platform drivers initialize too late, since the gpio functions are already used at init_machine time. PXA uses sysdev for their gpios, but is this the correct answer?

The omap gpio driver registers the platform_driver as a postcore_initcall so that it can use GPIO in the machine init for this reason. A platform_device/driver feels like the right way to do this IMHO.

Jamie

#2 lore raw
Quoted 8 lines · Jamie Iles
Quoted 6 lines · Sascha Hauer

I think we mostly agree on moving the gpio drivers from arch/arm to drivers/gpio. A question we have to answer is how we want to initialize these drivers. On nomadik these are platform drivers, but on i.MX and others platform drivers initialize too late, since the gpio functions are already used at init_machine time. PXA uses sysdev for their gpios, but is this the correct answer?

Quoted 4 lines

The omap gpio driver registers the platform_driver as a postcore_initcall so that it can use GPIO in the machine init for this reason. A platform_device/driver feels like the right way to do this IMHO.

Ah, I somehow missed that platform drivers can be up and running at init_machine time. Then this is not a problem at all.

Sascha

Signature · 4 lines
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 |
#3 lore raw
In reply to Jamie Iles
Quoted 8 lines · Jamie Iles
Quoted 6 lines · Sascha Hauer

I think we mostly agree on moving the gpio drivers from arch/arm to drivers/gpio. A question we have to answer is how we want to initialize these drivers. On nomadik these are platform drivers, but on i.MX and others platform drivers initialize too late, since the gpio functions are already used at init_machine time. PXA uses sysdev for their gpios, but is this the correct answer?

Quoted 5 lines

The omap gpio driver registers the platform_driver as a postcore_initcall so that it can use GPIO in the machine init for this reason. A platform_device/driver feels like the right way to do this IMHO.

An early_platform_device may be a better approach to avoid init level tweaking. This would be needed for timers if the SH timer approach is adopted.

Rob