* Re: [PATCH 1/3] pinctrl: pinctrl-single must be initialized early.
2012-09-19 16:07 ` [PATCH 1/3] pinctrl: pinctrl-single must be initialized early Pantelis Antoniou
@ 2012-09-18 18:21 ` Tony Lindgren
2012-09-18 19:10 ` Pantelis Antoniou
0 siblings, 1 reply; 21+ messages in thread
From: Tony Lindgren @ 2012-09-18 18:21 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Shubhrajyoti D
Hi,
* Pantelis Antoniou <panto@antoniou-consulting.com> [120918 11:13]:
> When using pinctrl-single to handle i2c initialization, it has
> to be done early.
> On the beaglebone the regulator is connected to the i2c0 bus,
> and for sure that's the case for many other am33xx boards.
Usually it's better to initialize things later than earlier as
that cuts down nasty dependencies and let's us have a proper
debug console before we start initializing things beyond
interrupts and drivers.
Maybe just fix up the i2c-omap.c not to use subsys_initcall()?
And then deferred probe should be able to sort out the dependencies
for other drivers depending on i2c?
Regards,
Tony
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> ---
> drivers/pinctrl/pinctrl-single.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index 76a4260..3acf7f9 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -980,7 +980,17 @@ static struct platform_driver pcs_driver = {
> },
> };
>
> -module_platform_driver(pcs_driver);
> +static int __init pcs_init(void)
> +{
> + return platform_driver_register(&pcs_driver);
> +}
> +postcore_initcall(pcs_init);
> +
> +static void __exit pcs_exit(void)
> +{
> + platform_driver_unregister(&pcs_driver);
> +}
> +module_exit(pcs_exit);
>
> MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
> MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver");
> --
> 1.7.12
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-19 16:07 ` [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
@ 2012-09-18 18:23 ` Tony Lindgren
2012-09-18 19:37 ` Pantelis Antoniou
2012-09-19 7:09 ` Shubhrajyoti
2012-09-21 7:29 ` [PATCH 2/3] " Peter Ujfalusi
2 siblings, 1 reply; 21+ messages in thread
From: Tony Lindgren @ 2012-09-18 18:23 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Shubhrajyoti D
* Pantelis Antoniou <panto@antoniou-consulting.com> [120918 11:13]:
> Add support for pinctrl mux settings in the OMAP I2C driver.
> If no such pinctl bindings are found a warning message is printed.
>
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>
> ---
> drivers/i2c/busses/i2c-omap.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index b149e32..f722478 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -43,6 +43,8 @@
> #include <linux/slab.h>
> #include <linux/i2c-omap.h>
> #include <linux/pm_runtime.h>
> +#include <linux/pinctrl/consumer.h>
> +#include <linux/err.h>
>
> /* I2C controller revisions */
> #define OMAP_I2C_OMAP1_REV_2 0x20
> @@ -1057,6 +1059,7 @@ omap_i2c_probe(struct platform_device *pdev)
> const struct of_device_id *match;
> int irq;
> int r;
> + struct pinctrl *pinctrl;
>
> /* NOTE: driver uses the static register mapping */
> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1197,6 +1200,10 @@ omap_i2c_probe(struct platform_device *pdev)
>
> of_i2c_register_devices(adap);
>
> + pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> + if (IS_ERR(pinctrl))
> + dev_warn(dev->dev, "pins are not configured from the driver\n");
> +
> pm_runtime_mark_last_busy(dev->dev);
> pm_runtime_put_autosuspend(dev->dev);
This must be just a warning here as otherwise things will break
badly for drivers doing pinmuxing in bootloader only. Other than
that:
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] i2c: OMAP fix driver initialization message
2012-09-19 16:07 ` [PATCH 3/3] i2c: OMAP fix driver initialization message Pantelis Antoniou
@ 2012-09-18 18:24 ` Tony Lindgren
2012-09-18 19:24 ` a0919096
1 sibling, 0 replies; 21+ messages in thread
From: Tony Lindgren @ 2012-09-18 18:24 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Shubhrajyoti D
* Pantelis Antoniou <panto@antoniou-consulting.com> [120918 11:13]:
> The message spit out when the i2c-omap driver load is printing
> the platform device's id as a bus number. However when booting
> from OF id is -1, which is not so nice.
>
> Fix it by printing the adapter number.
>
> [ 0.210467] omap_i2c 44e0b000.i2c: bus -1 rev2.4.0 at 400 kHz
> vs
> [ 0.210467] omap_i2c 44e0b000.i2c: bus 0 rev2.4.0 at 400 kHz
>
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 1/3] pinctrl: pinctrl-single must be initialized early.
2012-09-18 18:21 ` Tony Lindgren
@ 2012-09-18 19:10 ` Pantelis Antoniou
2012-09-21 0:09 ` Tony Lindgren
0 siblings, 1 reply; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-18 19:10 UTC (permalink / raw)
To: Tony Lindgren
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Shubhrajyoti D
Hi Tony,
On Sep 18, 2012, at 9:21 PM, Tony Lindgren wrote:
> Hi,
>
> * Pantelis Antoniou <panto@antoniou-consulting.com> [120918 11:13]:
>> When using pinctrl-single to handle i2c initialization, it has
>> to be done early.
>> On the beaglebone the regulator is connected to the i2c0 bus,
>> and for sure that's the case for many other am33xx boards.
>
> Usually it's better to initialize things later than earlier as
> that cuts down nasty dependencies and let's us have a proper
> debug console before we start initializing things beyond
> interrupts and drivers.
>
Agreed.
> Maybe just fix up the i2c-omap.c not to use subsys_initcall()?
> And then deferred probe should be able to sort out the dependencies
> for other drivers depending on i2c?
>
As long as we get the regulator to work early in the game no problem.
I don't know if deferring the probe will work in this case.
I could give it a shot and see if it works at all.
FWIW, the regulator is on I2C0 which doesn't need any pinmux setup.
So in theory I2C0 is ready to go without any pinctrl action, however
the other busses require it.
It's not clear how to do so without making the driver all hacky.
Perhaps a property that signals that no pinctrl binding is required.
> Regards,
>
> Tony
>
Regards
-- Pantelis
>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>> ---
>> drivers/pinctrl/pinctrl-single.c | 12 +++++++++++-
>> 1 file changed, 11 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
>> index 76a4260..3acf7f9 100644
>> --- a/drivers/pinctrl/pinctrl-single.c
>> +++ b/drivers/pinctrl/pinctrl-single.c
>> @@ -980,7 +980,17 @@ static struct platform_driver pcs_driver = {
>> },
>> };
>>
>> -module_platform_driver(pcs_driver);
>> +static int __init pcs_init(void)
>> +{
>> + return platform_driver_register(&pcs_driver);
>> +}
>> +postcore_initcall(pcs_init);
>> +
>> +static void __exit pcs_exit(void)
>> +{
>> + platform_driver_unregister(&pcs_driver);
>> +}
>> +module_exit(pcs_exit);
>>
>> MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
>> MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver");
>> --
>> 1.7.12
>>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] i2c: OMAP fix driver initialization message
2012-09-19 16:07 ` [PATCH 3/3] i2c: OMAP fix driver initialization message Pantelis Antoniou
2012-09-18 18:24 ` Tony Lindgren
@ 2012-09-18 19:24 ` a0919096
2012-09-19 9:57 ` Pantelis Antoniou
1 sibling, 1 reply; 21+ messages in thread
From: a0919096 @ 2012-09-18 19:24 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Shubhrajyoti D,
Tony Lindgren
Hi Panto,
That patch is good, but a similar one was already posted by Florian.
https://patchwork.kernel.org/patch/1392671/
Checking the email thread it seems that Wolfram pulled it.
Regards,
Benoit
On 9/19/2012 11:07 AM, Pantelis Antoniou wrote:
> The message spit out when the i2c-omap driver load is printing
> the platform device's id as a bus number. However when booting
> from OF id is -1, which is not so nice.
>
> Fix it by printing the adapter number.
>
> [ 0.210467] omap_i2c 44e0b000.i2c: bus -1 rev2.4.0 at 400 kHz
> vs
> [ 0.210467] omap_i2c 44e0b000.i2c: bus 0 rev2.4.0 at 400 kHz
>
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index f722478..87bb705 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1178,9 +1178,6 @@ omap_i2c_probe(struct platform_device *pdev)
> goto err_unuse_clocks;
> }
>
> - dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
> - dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
> -
> adap = &dev->adapter;
> i2c_set_adapdata(adap, dev);
> adap->owner = THIS_MODULE;
> @@ -1204,6 +1201,9 @@ omap_i2c_probe(struct platform_device *pdev)
> if (IS_ERR(pinctrl))
> dev_warn(dev->dev, "pins are not configured from the driver\n");
>
> + dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", adap->nr,
> + dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
> +
> pm_runtime_mark_last_busy(dev->dev);
> pm_runtime_put_autosuspend(dev->dev);
>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-18 18:23 ` Tony Lindgren
@ 2012-09-18 19:37 ` Pantelis Antoniou
0 siblings, 0 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-18 19:37 UTC (permalink / raw)
To: Tony Lindgren
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Shubhrajyoti D
Hi Tony,
On Sep 18, 2012, at 9:23 PM, Tony Lindgren wrote:
> * Pantelis Antoniou <panto@antoniou-consulting.com> [120918 11:13]:
>> Add support for pinctrl mux settings in the OMAP I2C driver.
>> If no such pinctl bindings are found a warning message is printed.
>>
>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>>
>> ---
>> drivers/i2c/busses/i2c-omap.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
>> index b149e32..f722478 100644
>> --- a/drivers/i2c/busses/i2c-omap.c
>> +++ b/drivers/i2c/busses/i2c-omap.c
>> @@ -43,6 +43,8 @@
>> #include <linux/slab.h>
>> #include <linux/i2c-omap.h>
>> #include <linux/pm_runtime.h>
>> +#include <linux/pinctrl/consumer.h>
>> +#include <linux/err.h>
>>
>> /* I2C controller revisions */
>> #define OMAP_I2C_OMAP1_REV_2 0x20
>> @@ -1057,6 +1059,7 @@ omap_i2c_probe(struct platform_device *pdev)
>> const struct of_device_id *match;
>> int irq;
>> int r;
>> + struct pinctrl *pinctrl;
>>
>> /* NOTE: driver uses the static register mapping */
>> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> @@ -1197,6 +1200,10 @@ omap_i2c_probe(struct platform_device *pdev)
>>
>> of_i2c_register_devices(adap);
>>
>> + pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
>> + if (IS_ERR(pinctrl))
>> + dev_warn(dev->dev, "pins are not configured from the driver\n");
>> +
>> pm_runtime_mark_last_busy(dev->dev);
>> pm_runtime_put_autosuspend(dev->dev);
>
> This must be just a warning here as otherwise things will break
> badly for drivers doing pinmuxing in bootloader only. Other than
> that:
>
It is just a warning indeed. Not many boards do the pinctrl dance yet.
> Acked-by: Tony Lindgren <tony@atomide.com>
Regards
-- Pantelis
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-19 16:07 ` [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
2012-09-18 18:23 ` Tony Lindgren
@ 2012-09-19 7:09 ` Shubhrajyoti
2012-09-19 8:34 ` Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 0/2] Pinctrl-fy OMAP I2C driver (V2) Pantelis Antoniou
2012-09-21 7:29 ` [PATCH 2/3] " Peter Ujfalusi
2 siblings, 2 replies; 21+ messages in thread
From: Shubhrajyoti @ 2012-09-19 7:09 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Tony Lindgren
On Wednesday 19 September 2012 09:37 PM, Pantelis Antoniou wrote:
> #include <linux/pm_runtime.h>
> +#include <linux/pinctrl/consumer.h>
> +#include <linux/err.h>
err.h include may be removed.
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-19 7:09 ` Shubhrajyoti
@ 2012-09-19 8:34 ` Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 0/2] Pinctrl-fy OMAP I2C driver (V2) Pantelis Antoniou
1 sibling, 0 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-19 8:34 UTC (permalink / raw)
To: Shubhrajyoti
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Tony Lindgren
Hi
On Sep 19, 2012, at 10:09 AM, Shubhrajyoti wrote:
> On Wednesday 19 September 2012 09:37 PM, Pantelis Antoniou wrote:
>> #include <linux/pm_runtime.h>
>> +#include <linux/pinctrl/consumer.h>
>> +#include <linux/err.h>
> err.h include may be removed.
Right, Updated patch series (without the message patch follows)...
Regards
-- Pantelis
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] i2c: OMAP fix driver initialization message
2012-09-18 19:24 ` a0919096
@ 2012-09-19 9:57 ` Pantelis Antoniou
0 siblings, 0 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-19 9:57 UTC (permalink / raw)
To: a0919096
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Shubhrajyoti D,
Tony Lindgren
Hi Benoit,
On Sep 18, 2012, at 10:24 PM, a0919096 wrote:
> Hi Panto,
>
> That patch is good, but a similar one was already posted by Florian.
> https://patchwork.kernel.org/patch/1392671/
>
> Checking the email thread it seems that Wolfram pulled it.
>
> Regards,
> Benoit
>
Great. One less thing to look after :)
Regards
-- Pantelis
> On 9/19/2012 11:07 AM, Pantelis Antoniou wrote:
>> The message spit out when the i2c-omap driver load is printing
>> the platform device's id as a bus number. However when booting
>> from OF id is -1, which is not so nice.
>>
>> Fix it by printing the adapter number.
>>
>> [ 0.210467] omap_i2c 44e0b000.i2c: bus -1 rev2.4.0 at 400 kHz
>> vs
>> [ 0.210467] omap_i2c 44e0b000.i2c: bus 0 rev2.4.0 at 400 kHz
>>
>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>> ---
>> drivers/i2c/busses/i2c-omap.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
>> index f722478..87bb705 100644
>> --- a/drivers/i2c/busses/i2c-omap.c
>> +++ b/drivers/i2c/busses/i2c-omap.c
>> @@ -1178,9 +1178,6 @@ omap_i2c_probe(struct platform_device *pdev)
>> goto err_unuse_clocks;
>> }
>>
>> - dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
>> - dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
>> -
>> adap = &dev->adapter;
>> i2c_set_adapdata(adap, dev);
>> adap->owner = THIS_MODULE;
>> @@ -1204,6 +1201,9 @@ omap_i2c_probe(struct platform_device *pdev)
>> if (IS_ERR(pinctrl))
>> dev_warn(dev->dev, "pins are not configured from the driver\n");
>>
>> + dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", adap->nr,
>> + dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
>> +
>> pm_runtime_mark_last_busy(dev->dev);
>> pm_runtime_put_autosuspend(dev->dev);
>>
>>
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-20 6:34 ` [PATCH 2/2] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
@ 2012-09-19 10:13 ` Shubhrajyoti Datta
2012-09-19 17:24 ` Tony Lindgren
1 sibling, 0 replies; 21+ messages in thread
From: Shubhrajyoti Datta @ 2012-09-19 10:13 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Shubhrajyoti D, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Benoit Cousson, Tony Lindgren
On Thu, Sep 20, 2012 at 12:04 PM, Pantelis Antoniou
<panto@antoniou-consulting.com> wrote:
> Add support for pinctrl mux settings in the OMAP I2C driver.
> If no such pinctl bindings are found a warning message is printed.
>
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> ---
looks good
Acked-by: Shubhrajyoti D <shubhrajyoti@ti.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 0/3] Pinctrl-fy OMAP I2C driver
@ 2012-09-19 16:07 Pantelis Antoniou
2012-09-19 16:07 ` [PATCH 1/3] pinctrl: pinctrl-single must be initialized early Pantelis Antoniou
` (2 more replies)
0 siblings, 3 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-19 16:07 UTC (permalink / raw)
To: Benoit Cousson
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Shubhrajyoti D,
Tony Lindgren, Pantelis Antoniou
Pinctrl-fy the OMAP I2C driver.
Due to the requirement of early usage of I2C for
regulators and such, earlier initialization of pinctrl
is required.
This patch series is against
git://gitorious.org/linus-tree/linus-tree.git for_3.7/i2c/big_cleanups
Note that the I2C DT bindings are against the linux-omap-dt tree
and that without https://patchwork.kernel.org/patch/1468531
queued for 3.7 scary messages will be printed on !DT platforms
Pantelis Antoniou (3):
pinctrl: pinctrl-single must be initialized early.
OMAP i2c: pinctrl-ify i2c-omap.c
i2c: OMAP fix driver initialization message
drivers/i2c/busses/i2c-omap.c | 13 ++++++++++---
drivers/pinctrl/pinctrl-single.c | 12 +++++++++++-
2 files changed, 21 insertions(+), 4 deletions(-)
--
1.7.12
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/3] pinctrl: pinctrl-single must be initialized early.
2012-09-19 16:07 [PATCH 0/3] Pinctrl-fy OMAP I2C driver Pantelis Antoniou
@ 2012-09-19 16:07 ` Pantelis Antoniou
2012-09-18 18:21 ` Tony Lindgren
2012-09-19 16:07 ` [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
2012-09-19 16:07 ` [PATCH 3/3] i2c: OMAP fix driver initialization message Pantelis Antoniou
2 siblings, 1 reply; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-19 16:07 UTC (permalink / raw)
To: Benoit Cousson
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Shubhrajyoti D,
Tony Lindgren, Pantelis Antoniou
When using pinctrl-single to handle i2c initialization, it has
to be done early.
On the beaglebone the regulator is connected to the i2c0 bus,
and for sure that's the case for many other am33xx boards.
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
drivers/pinctrl/pinctrl-single.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 76a4260..3acf7f9 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -980,7 +980,17 @@ static struct platform_driver pcs_driver = {
},
};
-module_platform_driver(pcs_driver);
+static int __init pcs_init(void)
+{
+ return platform_driver_register(&pcs_driver);
+}
+postcore_initcall(pcs_init);
+
+static void __exit pcs_exit(void)
+{
+ platform_driver_unregister(&pcs_driver);
+}
+module_exit(pcs_exit);
MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver");
--
1.7.12
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-19 16:07 [PATCH 0/3] Pinctrl-fy OMAP I2C driver Pantelis Antoniou
2012-09-19 16:07 ` [PATCH 1/3] pinctrl: pinctrl-single must be initialized early Pantelis Antoniou
@ 2012-09-19 16:07 ` Pantelis Antoniou
2012-09-18 18:23 ` Tony Lindgren
` (2 more replies)
2012-09-19 16:07 ` [PATCH 3/3] i2c: OMAP fix driver initialization message Pantelis Antoniou
2 siblings, 3 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-19 16:07 UTC (permalink / raw)
To: Benoit Cousson
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Shubhrajyoti D,
Tony Lindgren, Pantelis Antoniou
Add support for pinctrl mux settings in the OMAP I2C driver.
If no such pinctl bindings are found a warning message is printed.
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
drivers/i2c/busses/i2c-omap.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index b149e32..f722478 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -43,6 +43,8 @@
#include <linux/slab.h>
#include <linux/i2c-omap.h>
#include <linux/pm_runtime.h>
+#include <linux/pinctrl/consumer.h>
+#include <linux/err.h>
/* I2C controller revisions */
#define OMAP_I2C_OMAP1_REV_2 0x20
@@ -1057,6 +1059,7 @@ omap_i2c_probe(struct platform_device *pdev)
const struct of_device_id *match;
int irq;
int r;
+ struct pinctrl *pinctrl;
/* NOTE: driver uses the static register mapping */
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1197,6 +1200,10 @@ omap_i2c_probe(struct platform_device *pdev)
of_i2c_register_devices(adap);
+ pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+ if (IS_ERR(pinctrl))
+ dev_warn(dev->dev, "pins are not configured from the driver\n");
+
pm_runtime_mark_last_busy(dev->dev);
pm_runtime_put_autosuspend(dev->dev);
--
1.7.12
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 3/3] i2c: OMAP fix driver initialization message
2012-09-19 16:07 [PATCH 0/3] Pinctrl-fy OMAP I2C driver Pantelis Antoniou
2012-09-19 16:07 ` [PATCH 1/3] pinctrl: pinctrl-single must be initialized early Pantelis Antoniou
2012-09-19 16:07 ` [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
@ 2012-09-19 16:07 ` Pantelis Antoniou
2012-09-18 18:24 ` Tony Lindgren
2012-09-18 19:24 ` a0919096
2 siblings, 2 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-19 16:07 UTC (permalink / raw)
To: Benoit Cousson
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Shubhrajyoti D,
Tony Lindgren, Pantelis Antoniou
The message spit out when the i2c-omap driver load is printing
the platform device's id as a bus number. However when booting
from OF id is -1, which is not so nice.
Fix it by printing the adapter number.
[ 0.210467] omap_i2c 44e0b000.i2c: bus -1 rev2.4.0 at 400 kHz
vs
[ 0.210467] omap_i2c 44e0b000.i2c: bus 0 rev2.4.0 at 400 kHz
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
drivers/i2c/busses/i2c-omap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f722478..87bb705 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1178,9 +1178,6 @@ omap_i2c_probe(struct platform_device *pdev)
goto err_unuse_clocks;
}
- dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", pdev->id,
- dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
-
adap = &dev->adapter;
i2c_set_adapdata(adap, dev);
adap->owner = THIS_MODULE;
@@ -1204,6 +1201,9 @@ omap_i2c_probe(struct platform_device *pdev)
if (IS_ERR(pinctrl))
dev_warn(dev->dev, "pins are not configured from the driver\n");
+ dev_info(dev->dev, "bus %d rev%d.%d.%d at %d kHz\n", adap->nr,
+ dev->dtrev, dev->rev >> 4, dev->rev & 0xf, dev->speed);
+
pm_runtime_mark_last_busy(dev->dev);
pm_runtime_put_autosuspend(dev->dev);
--
1.7.12
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 2/2] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-20 6:34 ` [PATCH 2/2] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
2012-09-19 10:13 ` Shubhrajyoti Datta
@ 2012-09-19 17:24 ` Tony Lindgren
1 sibling, 0 replies; 21+ messages in thread
From: Tony Lindgren @ 2012-09-19 17:24 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Shubhrajyoti D, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Benoit Cousson
* Pantelis Antoniou <panto@antoniou-consulting.com> [120919 01:40]:
> Add support for pinctrl mux settings in the OMAP I2C driver.
> If no such pinctl bindings are found a warning message is printed.
>
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Acked-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index b149e32..d192614 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -43,6 +43,7 @@
> #include <linux/slab.h>
> #include <linux/i2c-omap.h>
> #include <linux/pm_runtime.h>
> +#include <linux/pinctrl/consumer.h>
>
> /* I2C controller revisions */
> #define OMAP_I2C_OMAP1_REV_2 0x20
> @@ -1057,6 +1058,7 @@ omap_i2c_probe(struct platform_device *pdev)
> const struct of_device_id *match;
> int irq;
> int r;
> + struct pinctrl *pinctrl;
>
> /* NOTE: driver uses the static register mapping */
> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1197,6 +1199,10 @@ omap_i2c_probe(struct platform_device *pdev)
>
> of_i2c_register_devices(adap);
>
> + pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> + if (IS_ERR(pinctrl))
> + dev_warn(dev->dev, "pins are not configured from the driver\n");
> +
> pm_runtime_mark_last_busy(dev->dev);
> pm_runtime_put_autosuspend(dev->dev);
>
> --
> 1.7.12
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 0/2] Pinctrl-fy OMAP I2C driver (V2)
2012-09-19 7:09 ` Shubhrajyoti
2012-09-19 8:34 ` Pantelis Antoniou
@ 2012-09-20 6:34 ` Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 1/2] pinctrl: pinctrl-single must be initialized early Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 2/2] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
1 sibling, 2 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-20 6:34 UTC (permalink / raw)
To: Shubhrajyoti D
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Benoit Cousson,
Tony Lindgren, Pantelis Antoniou
Pinctrl-fy the OMAP I2C driver.
Due to the requirement of early usage of I2C for
regulators and such, earlier initialization of pinctrl
is required.
This patch series is against
git://gitorious.org/linus-tree/linus-tree.git for_3.7/i2c/big_cleanups
Note that the I2C DT bindings are against the linux-omap-dt tree
and that without https://patchwork.kernel.org/patch/1468531
queued for 3.7 scary messages will be printed on !DT platforms
Pantelis Antoniou (2):
pinctrl: pinctrl-single must be initialized early.
OMAP i2c: pinctrl-ify i2c-omap.c
drivers/i2c/busses/i2c-omap.c | 6 ++++++
drivers/pinctrl/pinctrl-single.c | 12 +++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
--
1.7.12
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/2] pinctrl: pinctrl-single must be initialized early.
2012-09-20 6:34 ` [PATCH 0/2] Pinctrl-fy OMAP I2C driver (V2) Pantelis Antoniou
@ 2012-09-20 6:34 ` Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 2/2] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
1 sibling, 0 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-20 6:34 UTC (permalink / raw)
To: Shubhrajyoti D
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Benoit Cousson,
Tony Lindgren, Pantelis Antoniou
When using pinctrl-single to handle i2c initialization, it has
to be done early.
On the beaglebone the regulator is connected to the i2c0 bus,
and for sure that's the case for many other am33xx boards.
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
drivers/pinctrl/pinctrl-single.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 76a4260..3acf7f9 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -980,7 +980,17 @@ static struct platform_driver pcs_driver = {
},
};
-module_platform_driver(pcs_driver);
+static int __init pcs_init(void)
+{
+ return platform_driver_register(&pcs_driver);
+}
+postcore_initcall(pcs_init);
+
+static void __exit pcs_exit(void)
+{
+ platform_driver_unregister(&pcs_driver);
+}
+module_exit(pcs_exit);
MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver");
--
1.7.12
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 2/2] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-20 6:34 ` [PATCH 0/2] Pinctrl-fy OMAP I2C driver (V2) Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 1/2] pinctrl: pinctrl-single must be initialized early Pantelis Antoniou
@ 2012-09-20 6:34 ` Pantelis Antoniou
2012-09-19 10:13 ` Shubhrajyoti Datta
2012-09-19 17:24 ` Tony Lindgren
1 sibling, 2 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-20 6:34 UTC (permalink / raw)
To: Shubhrajyoti D
Cc: linux-omap, linux-kernel, Matt Porter, Koen Kooi, Benoit Cousson,
Tony Lindgren, Pantelis Antoniou
Add support for pinctrl mux settings in the OMAP I2C driver.
If no such pinctl bindings are found a warning message is printed.
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
drivers/i2c/busses/i2c-omap.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index b149e32..d192614 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -43,6 +43,7 @@
#include <linux/slab.h>
#include <linux/i2c-omap.h>
#include <linux/pm_runtime.h>
+#include <linux/pinctrl/consumer.h>
/* I2C controller revisions */
#define OMAP_I2C_OMAP1_REV_2 0x20
@@ -1057,6 +1058,7 @@ omap_i2c_probe(struct platform_device *pdev)
const struct of_device_id *match;
int irq;
int r;
+ struct pinctrl *pinctrl;
/* NOTE: driver uses the static register mapping */
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1197,6 +1199,10 @@ omap_i2c_probe(struct platform_device *pdev)
of_i2c_register_devices(adap);
+ pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+ if (IS_ERR(pinctrl))
+ dev_warn(dev->dev, "pins are not configured from the driver\n");
+
pm_runtime_mark_last_busy(dev->dev);
pm_runtime_put_autosuspend(dev->dev);
--
1.7.12
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 1/3] pinctrl: pinctrl-single must be initialized early.
2012-09-18 19:10 ` Pantelis Antoniou
@ 2012-09-21 0:09 ` Tony Lindgren
0 siblings, 0 replies; 21+ messages in thread
From: Tony Lindgren @ 2012-09-21 0:09 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Shubhrajyoti D
* Pantelis Antoniou <panto@antoniou-consulting.com> [120918 12:11]:
>
> As long as we get the regulator to work early in the game no problem.
> I don't know if deferring the probe will work in this case.
> I could give it a shot and see if it works at all.
Did you have any luck with deferred probe here?
Tony
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-19 16:07 ` [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
2012-09-18 18:23 ` Tony Lindgren
2012-09-19 7:09 ` Shubhrajyoti
@ 2012-09-21 7:29 ` Peter Ujfalusi
2012-09-21 7:34 ` Pantelis Antoniou
2 siblings, 1 reply; 21+ messages in thread
From: Peter Ujfalusi @ 2012-09-21 7:29 UTC (permalink / raw)
To: Pantelis Antoniou
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Shubhrajyoti D, Tony Lindgren
On 09/19/2012 07:07 PM, Pantelis Antoniou wrote:
> Add support for pinctrl mux settings in the OMAP I2C driver.
> If no such pinctl bindings are found a warning message is printed.
>
> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index b149e32..f722478 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -43,6 +43,8 @@
> #include <linux/slab.h>
> #include <linux/i2c-omap.h>
> #include <linux/pm_runtime.h>
> +#include <linux/pinctrl/consumer.h>
> +#include <linux/err.h>
>
> /* I2C controller revisions */
> #define OMAP_I2C_OMAP1_REV_2 0x20
> @@ -1057,6 +1059,7 @@ omap_i2c_probe(struct platform_device *pdev)
> const struct of_device_id *match;
> int irq;
> int r;
> + struct pinctrl *pinctrl;
>
> /* NOTE: driver uses the static register mapping */
> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1197,6 +1200,10 @@ omap_i2c_probe(struct platform_device *pdev)
>
> of_i2c_register_devices(adap);
>
> + pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
> + if (IS_ERR(pinctrl))
> + dev_warn(dev->dev, "pins are not configured from the driver\n");
Can you use &pdev->dev for the dev_warn() here?
the dev->dev is quite confusing especially since you used &pdev->dev for the
pinctrl call.
> +
> pm_runtime_mark_last_busy(dev->dev);
> pm_runtime_put_autosuspend(dev->dev);
>
>
--
Péter
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c
2012-09-21 7:29 ` [PATCH 2/3] " Peter Ujfalusi
@ 2012-09-21 7:34 ` Pantelis Antoniou
0 siblings, 0 replies; 21+ messages in thread
From: Pantelis Antoniou @ 2012-09-21 7:34 UTC (permalink / raw)
To: Peter Ujfalusi
Cc: Benoit Cousson, linux-omap, linux-kernel, Matt Porter, Koen Kooi,
Shubhrajyoti D, Tony Lindgren
On Sep 21, 2012, at 10:29 AM, Peter Ujfalusi wrote:
> On 09/19/2012 07:07 PM, Pantelis Antoniou wrote:
>> Add support for pinctrl mux settings in the OMAP I2C driver.
>> If no such pinctl bindings are found a warning message is printed.
>>
>> Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
>> ---
>> drivers/i2c/busses/i2c-omap.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
>> index b149e32..f722478 100644
>> --- a/drivers/i2c/busses/i2c-omap.c
>> +++ b/drivers/i2c/busses/i2c-omap.c
>> @@ -43,6 +43,8 @@
>> #include <linux/slab.h>
>> #include <linux/i2c-omap.h>
>> #include <linux/pm_runtime.h>
>> +#include <linux/pinctrl/consumer.h>
>> +#include <linux/err.h>
>>
>> /* I2C controller revisions */
>> #define OMAP_I2C_OMAP1_REV_2 0x20
>> @@ -1057,6 +1059,7 @@ omap_i2c_probe(struct platform_device *pdev)
>> const struct of_device_id *match;
>> int irq;
>> int r;
>> + struct pinctrl *pinctrl;
>>
>> /* NOTE: driver uses the static register mapping */
>> mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> @@ -1197,6 +1200,10 @@ omap_i2c_probe(struct platform_device *pdev)
>>
>> of_i2c_register_devices(adap);
>>
>> + pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
>> + if (IS_ERR(pinctrl))
>> + dev_warn(dev->dev, "pins are not configured from the driver\n");
>
> Can you use &pdev->dev for the dev_warn() here?
> the dev->dev is quite confusing especially since you used &pdev->dev for the
> pinctrl call.
Not really, since this is the device argument used in all dev_* calls in the function.
A few lines before you have:
> dev_err(dev->dev, "failure adding adapter\n");
And so on.
Using a different device argument there would be confusing.
>
>> +
>> pm_runtime_mark_last_busy(dev->dev);
>> pm_runtime_put_autosuspend(dev->dev);
>>
>>
>
>
> --
> Péter
Regards
-- Pantelis
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2012-09-21 7:34 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-19 16:07 [PATCH 0/3] Pinctrl-fy OMAP I2C driver Pantelis Antoniou
2012-09-19 16:07 ` [PATCH 1/3] pinctrl: pinctrl-single must be initialized early Pantelis Antoniou
2012-09-18 18:21 ` Tony Lindgren
2012-09-18 19:10 ` Pantelis Antoniou
2012-09-21 0:09 ` Tony Lindgren
2012-09-19 16:07 ` [PATCH 2/3] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
2012-09-18 18:23 ` Tony Lindgren
2012-09-18 19:37 ` Pantelis Antoniou
2012-09-19 7:09 ` Shubhrajyoti
2012-09-19 8:34 ` Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 0/2] Pinctrl-fy OMAP I2C driver (V2) Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 1/2] pinctrl: pinctrl-single must be initialized early Pantelis Antoniou
2012-09-20 6:34 ` [PATCH 2/2] OMAP i2c: pinctrl-ify i2c-omap.c Pantelis Antoniou
2012-09-19 10:13 ` Shubhrajyoti Datta
2012-09-19 17:24 ` Tony Lindgren
2012-09-21 7:29 ` [PATCH 2/3] " Peter Ujfalusi
2012-09-21 7:34 ` Pantelis Antoniou
2012-09-19 16:07 ` [PATCH 3/3] i2c: OMAP fix driver initialization message Pantelis Antoniou
2012-09-18 18:24 ` Tony Lindgren
2012-09-18 19:24 ` a0919096
2012-09-19 9:57 ` Pantelis Antoniou
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).