* [PATCH v2] mfd: tps65010: fix init when the driver is built-in
@ 2016-01-11 19:46 Aaro Koskinen
2016-01-12 7:42 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Aaro Koskinen @ 2016-01-11 19:46 UTC (permalink / raw)
To: Lee Jones, linux-kernel, linux-omap; +Cc: Tony Lindgren, Aaro Koskinen
tps65010 driver's initcall cannot succeed when the driver is built-in,
because it expects that the I2C probe is completed at initcall time;
this cannot happen as MFD is initialized before I2C. Also on systems
where the chip is not present there is unnecessary 30 ms delay during
the boot.
Instead of waiting for probe to finish, just register the I2C device.
If some boards need retry mechanism for startup glitches, that should be
done in the actual probe function. Also delete the driver banner message.
The patch allows to use tps65010 again with OMAP1 (where it's required
to be built-in) and enables e.g. USB and LED functionality on OMAP5912 OSK.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
v2: Delete the banner message.
v1: http://marc.info/?t=145220586400001&r=1&w=2
drivers/mfd/tps65010.c | 21 +--------------------
1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
index 448f0a1..e40f8e6 100644
--- a/drivers/mfd/tps65010.c
+++ b/drivers/mfd/tps65010.c
@@ -1059,26 +1059,7 @@ EXPORT_SYMBOL(tps65013_set_low_pwr);
static int __init tps_init(void)
{
- u32 tries = 3;
- int status = -ENODEV;
-
- printk(KERN_INFO "%s: version %s\n", DRIVER_NAME, DRIVER_VERSION);
-
- /* some boards have startup glitches */
- while (tries--) {
- status = i2c_add_driver(&tps65010_driver);
- if (the_tps)
- break;
- i2c_del_driver(&tps65010_driver);
- if (!tries) {
- printk(KERN_ERR "%s: no chip?\n", DRIVER_NAME);
- return -ENODEV;
- }
- pr_debug("%s: re-probe ...\n", DRIVER_NAME);
- msleep(10);
- }
-
- return status;
+ return i2c_add_driver(&tps65010_driver);
}
/* NOTE: this MUST be initialized before the other parts of the system
* that rely on it ... but after the i2c bus on which this relies.
--
2.4.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mfd: tps65010: fix init when the driver is built-in
2016-01-11 19:46 [PATCH v2] mfd: tps65010: fix init when the driver is built-in Aaro Koskinen
@ 2016-01-12 7:42 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2016-01-12 7:42 UTC (permalink / raw)
To: Aaro Koskinen; +Cc: linux-kernel, linux-omap, Tony Lindgren
On Mon, 11 Jan 2016, Aaro Koskinen wrote:
> tps65010 driver's initcall cannot succeed when the driver is built-in,
> because it expects that the I2C probe is completed at initcall time;
> this cannot happen as MFD is initialized before I2C. Also on systems
> where the chip is not present there is unnecessary 30 ms delay during
> the boot.
>
> Instead of waiting for probe to finish, just register the I2C device.
> If some boards need retry mechanism for startup glitches, that should be
> done in the actual probe function. Also delete the driver banner message.
>
> The patch allows to use tps65010 again with OMAP1 (where it's required
> to be built-in) and enables e.g. USB and LED functionality on OMAP5912 OSK.
>
> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> ---
>
> v2: Delete the banner message.
>
> v1: http://marc.info/?t=145220586400001&r=1&w=2
>
> drivers/mfd/tps65010.c | 21 +--------------------
> 1 file changed, 1 insertion(+), 20 deletions(-)
Corrected the subject line and applied.
> diff --git a/drivers/mfd/tps65010.c b/drivers/mfd/tps65010.c
> index 448f0a1..e40f8e6 100644
> --- a/drivers/mfd/tps65010.c
> +++ b/drivers/mfd/tps65010.c
> @@ -1059,26 +1059,7 @@ EXPORT_SYMBOL(tps65013_set_low_pwr);
>
> static int __init tps_init(void)
> {
> - u32 tries = 3;
> - int status = -ENODEV;
> -
> - printk(KERN_INFO "%s: version %s\n", DRIVER_NAME, DRIVER_VERSION);
> -
> - /* some boards have startup glitches */
> - while (tries--) {
> - status = i2c_add_driver(&tps65010_driver);
> - if (the_tps)
> - break;
> - i2c_del_driver(&tps65010_driver);
> - if (!tries) {
> - printk(KERN_ERR "%s: no chip?\n", DRIVER_NAME);
> - return -ENODEV;
> - }
> - pr_debug("%s: re-probe ...\n", DRIVER_NAME);
> - msleep(10);
> - }
> -
> - return status;
> + return i2c_add_driver(&tps65010_driver);
> }
> /* NOTE: this MUST be initialized before the other parts of the system
> * that rely on it ... but after the i2c bus on which this relies.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-12 7:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 19:46 [PATCH v2] mfd: tps65010: fix init when the driver is built-in Aaro Koskinen
2016-01-12 7:42 ` Lee Jones
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).