[RFC] pinctrl: sh-pfc: only use dummy states for non-DT platforms
diff mbox

Message ID 1457376072-755-1-git-send-email-wsa@the-dreams.de
State New
Headers show

Commit Message

Wolfram Sang March 7, 2016, 6:40 p.m. UTC
From: Wolfram Sang <wsa+renesas@sang-engineering.com>

If pinctrl_provide_dummies() is used unconditionally, then the dummy
state will be used even on DT platforms when the "init" state was
intentionally left out. Instead of "default", the dummy "init" state
will then be used during probe. Thus, when probing an I2C controller on
cold boot, communication triggered by bus notifiers broke because the
pins were not initialized.

Do it like OMAP2: use the dummy state only for non-DT platforms.

Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Geert recently pointed out the problem, that the IRQ2 fixup for the
DA9xxx PMICs failed on Lager on cold boot. I could verify this iff IIC3
was used and not I2C3. IIC3 is the default, however I mostly used I2C3
recently, because it has the slave capabilities.

The original pinctrl_provide_dummies() is there since the beginning of the
file, so in order to avoid regressions, the below solution looks plausible to
me. I do not have much experience with hardware older than Gen2, though, so
comments are much appreciated!


 drivers/pinctrl/sh-pfc/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Geert Uytterhoeven March 7, 2016, 7:56 p.m. UTC | #1
Hi Wolfram,

On Mon, Mar 7, 2016 at 7:40 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> If pinctrl_provide_dummies() is used unconditionally, then the dummy
> state will be used even on DT platforms when the "init" state was
> intentionally left out. Instead of "default", the dummy "init" state
> will then be used during probe. Thus, when probing an I2C controller on
> cold boot, communication triggered by bus notifiers broke because the
> pins were not initialized.
>
> Do it like OMAP2: use the dummy state only for non-DT platforms.

Thanks!

Interestingly, Sergei submitted a similar patch a few days ago
"pinctrl: sh-pfc: core: only call pinctrl_provide_dummies"
(https://patchwork.ozlabs.org/patch/592245/)

>
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>
> Geert recently pointed out the problem, that the IRQ2 fixup for the
> DA9xxx PMICs failed on Lager on cold boot. I could verify this iff IIC3
> was used and not I2C3. IIC3 is the default, however I mostly used I2C3
> recently, because it has the slave capabilities.
>
> The original pinctrl_provide_dummies() is there since the beginning of the
> file, so in order to avoid regressions, the below solution looks plausible to
> me. I do not have much experience with hardware older than Gen2, though, so
> comments are much appreciated!
>
>
>  drivers/pinctrl/sh-pfc/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
> index 0c2d14c504aa1d..db53d7bbc16e18 100644
> --- a/drivers/pinctrl/sh-pfc/core.c
> +++ b/drivers/pinctrl/sh-pfc/core.c
> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device *pdev)
>                         return ret;
>         }
>
> -       pinctrl_provide_dummies();
> +       /* Enable dummy states for those platforms without pinctrl support */
> +       if (!of_have_populated_dt())
> +               pinctrl_provide_dummies();
>
>         ret = sh_pfc_init_ranges(pfc);
>         if (ret < 0)
> --
> 2.7.0

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov March 7, 2016, 8:02 p.m. UTC | #2
Hello.

On 03/07/2016 10:56 PM, Geert Uytterhoeven wrote:

>> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>
>> If pinctrl_provide_dummies() is used unconditionally, then the dummy
>> state will be used even on DT platforms when the "init" state was
>> intentionally left out. Instead of "default", the dummy "init" state
>> will then be used during probe. Thus, when probing an I2C controller on
>> cold boot, communication triggered by bus notifiers broke because the
>> pins were not initialized.
>>
>> Do it like OMAP2: use the dummy state only for non-DT platforms.
>
> Thanks!
>
> Interestingly, Sergei submitted a similar patch a few days ago
> "pinctrl: sh-pfc: core: only call pinctrl_provide_dummies"
> (https://patchwork.ozlabs.org/patch/592245/)

    I shot first! :-)

>> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> ---
>>
>> Geert recently pointed out the problem, that the IRQ2 fixup for the
>> DA9xxx PMICs failed on Lager on cold boot. I could verify this iff IIC3
>> was used and not I2C3. IIC3 is the default, however I mostly used I2C3
>> recently, because it has the slave capabilities.
>>
>> The original pinctrl_provide_dummies() is there since the beginning of the
>> file, so in order to avoid regressions, the below solution looks plausible to
>> me. I do not have much experience with hardware older than Gen2, though, so
>> comments are much appreciated!
>>
>>
>>   drivers/pinctrl/sh-pfc/core.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
>> index 0c2d14c504aa1d..db53d7bbc16e18 100644
>> --- a/drivers/pinctrl/sh-pfc/core.c
>> +++ b/drivers/pinctrl/sh-pfc/core.c
>> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device *pdev)
>>                          return ret;
>>          }
>>
>> -       pinctrl_provide_dummies();
>> +       /* Enable dummy states for those platforms without pinctrl support */
>> +       if (!of_have_populated_dt())

    I'd considered this condition -- it won't fly on SH where CONFIG_OF=n, the 
kernel just won't build IIUC...

>> +               pinctrl_provide_dummies();
>>
>>          ret = sh_pfc_init_ranges(pfc);
>>          if (ret < 0)
>> --
>> 2.7.0
>
> Gr{oetje,eeting}s,
>
>                          Geert

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven March 7, 2016, 8:29 p.m. UTC | #3
On Mon, Mar 7, 2016 at 9:02 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
>>> --- a/drivers/pinctrl/sh-pfc/core.c
>>> +++ b/drivers/pinctrl/sh-pfc/core.c
>>> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device *pdev)
>>>                          return ret;
>>>          }
>>>
>>> -       pinctrl_provide_dummies();
>>> +       /* Enable dummy states for those platforms without pinctrl
>>> support */
>>> +       if (!of_have_populated_dt())
>
>    I'd considered this condition -- it won't fly on SH where CONFIG_OF=n,
> the kernel just won't build IIUC...

I haven't tried to compile it yet, but <linux/of.h> does provide a dummy that
returns false.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov March 7, 2016, 8:34 p.m. UTC | #4
On 03/07/2016 11:29 PM, Geert Uytterhoeven wrote:

>>>> --- a/drivers/pinctrl/sh-pfc/core.c
>>>> +++ b/drivers/pinctrl/sh-pfc/core.c
>>>> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device *pdev)
>>>>                           return ret;
>>>>           }
>>>>
>>>> -       pinctrl_provide_dummies();
>>>> +       /* Enable dummy states for those platforms without pinctrl
>>>> support */
>>>> +       if (!of_have_populated_dt())
>>
>>     I'd considered this condition -- it won't fly on SH where CONFIG_OF=n,
>> the kernel just won't build IIUC...
>
> I haven't tried to compile it yet, but <linux/of.h> does provide a dummy that
> returns false.

    Oops, indeed. I missed it. :-(
    This approach is better then, won't have to fix again whenever SH gets DT 
support.

> Gr{oetje,eeting}s,
>
>                          Geert

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven March 7, 2016, 9 p.m. UTC | #5
CC Shawn, Sascha for imx1

On Mon, Mar 7, 2016 at 9:34 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> On 03/07/2016 11:29 PM, Geert Uytterhoeven wrote:
>
>>>>> --- a/drivers/pinctrl/sh-pfc/core.c
>>>>> +++ b/drivers/pinctrl/sh-pfc/core.c
>>>>> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device
>>>>> *pdev)
>>>>>                           return ret;
>>>>>           }
>>>>>
>>>>> -       pinctrl_provide_dummies();
>>>>> +       /* Enable dummy states for those platforms without pinctrl
>>>>> support */
>>>>> +       if (!of_have_populated_dt())
>>>
>>>
>>>     I'd considered this condition -- it won't fly on SH where
>>> CONFIG_OF=n,
>>> the kernel just won't build IIUC...
>>
>>
>> I haven't tried to compile it yet, but <linux/of.h> does provide a dummy
>> that
>> returns false.
>
>
>    Oops, indeed. I missed it. :-(
>    This approach is better then, won't have to fix again whenever SH gets DT
> support.

Perhaps the of_have_populated_dt() check should be moved inside
pinctrl_provide_dummies()?

Besides omap2, which has its own check, the only other user is imx1.
Does imx1 (still) needs this on DT-based platforms?

(Context for Shawn and Sascha:
 http://article.gmane.org/gmane.linux.kernel.renesas-soc/1639)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov March 7, 2016, 9:19 p.m. UTC | #6
On 03/08/2016 12:00 AM, Geert Uytterhoeven wrote:

>>>>>> --- a/drivers/pinctrl/sh-pfc/core.c
>>>>>> +++ b/drivers/pinctrl/sh-pfc/core.c
>>>>>> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device
>>>>>> *pdev)
>>>>>>                            return ret;
>>>>>>            }
>>>>>>
>>>>>> -       pinctrl_provide_dummies();
>>>>>> +       /* Enable dummy states for those platforms without pinctrl
>>>>>> support */
>>>>>> +       if (!of_have_populated_dt())
>>>>
>>>>
>>>>      I'd considered this condition -- it won't fly on SH where
>>>> CONFIG_OF=n,
>>>> the kernel just won't build IIUC...
>>>
>>>
>>> I haven't tried to compile it yet, but <linux/of.h> does provide a dummy
>>> that
>>> returns false.
>>
>>
>>     Oops, indeed. I missed it. :-(
>>     This approach is better then, won't have to fix again whenever SH gets DT
>> support.

> Perhaps the of_have_populated_dt() check should be moved inside
> pinctrl_provide_dummies()?

    That's probably a good idea...

> Besides omap2, which has its own check, the only other user is imx1.

    i.MX2x/3x as well, no?

[...]

> Gr{oetje,eeting}s,
>
>                          Geert

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang March 7, 2016, 10:21 p.m. UTC | #7
> Perhaps the of_have_populated_dt() check should be moved inside
> pinctrl_provide_dummies()?

Hmm, the kernel-doc for pinctrl_provide_dummies() says "Usually this
function is called by platforms without pinctrl driver support...".
Is "without pintctrl" == "no DT"? Linus?
Geert Uytterhoeven March 8, 2016, 8:15 a.m. UTC | #8
Hi Sergei,

On Mon, Mar 7, 2016 at 10:19 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> On 03/08/2016 12:00 AM, Geert Uytterhoeven wrote:
>>>>>>> --- a/drivers/pinctrl/sh-pfc/core.c
>>>>>>> +++ b/drivers/pinctrl/sh-pfc/core.c
>>>>>>> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device
>>>>>>> *pdev)
>>>>>>>                            return ret;
>>>>>>>            }
>>>>>>>
>>>>>>> -       pinctrl_provide_dummies();
>>>>>>> +       /* Enable dummy states for those platforms without pinctrl
>>>>>>> support */
>>>>>>> +       if (!of_have_populated_dt())
>>>>>
>>>>>
>>>>>
>>>>>      I'd considered this condition -- it won't fly on SH where
>>>>> CONFIG_OF=n,
>>>>> the kernel just won't build IIUC...
>>>>
>>>> I haven't tried to compile it yet, but <linux/of.h> does provide a dummy
>>>> that
>>>> returns false.
>>>
>>>     Oops, indeed. I missed it. :-(
>>>     This approach is better then, won't have to fix again whenever SH
>>> gets DT
>>> support.
>
>> Perhaps the of_have_populated_dt() check should be moved inside
>> pinctrl_provide_dummies()?
>
>    That's probably a good idea...
>
>> Besides omap2, which has its own check, the only other user is imx1.
>
>    i.MX2x/3x as well, no?

Yeah sorry, several i.MX. I accidentally typed a trailing "1".

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang March 9, 2016, 9:58 a.m. UTC | #9
On Mon, Mar 07, 2016 at 10:00:37PM +0100, Geert Uytterhoeven wrote:
> CC Shawn, Sascha for imx1
> 
> On Mon, Mar 7, 2016 at 9:34 PM, Sergei Shtylyov
> <sergei.shtylyov@cogentembedded.com> wrote:
> > On 03/07/2016 11:29 PM, Geert Uytterhoeven wrote:
> >
> >>>>> --- a/drivers/pinctrl/sh-pfc/core.c
> >>>>> +++ b/drivers/pinctrl/sh-pfc/core.c
> >>>>> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device
> >>>>> *pdev)
> >>>>>                           return ret;
> >>>>>           }
> >>>>>
> >>>>> -       pinctrl_provide_dummies();
> >>>>> +       /* Enable dummy states for those platforms without pinctrl
> >>>>> support */
> >>>>> +       if (!of_have_populated_dt())
> >>>
> >>>
> >>>     I'd considered this condition -- it won't fly on SH where
> >>> CONFIG_OF=n,
> >>> the kernel just won't build IIUC...
> >>
> >>
> >> I haven't tried to compile it yet, but <linux/of.h> does provide a dummy
> >> that
> >> returns false.
> >
> >
> >    Oops, indeed. I missed it. :-(
> >    This approach is better then, won't have to fix again whenever SH gets DT
> > support.
> 
> Perhaps the of_have_populated_dt() check should be moved inside
> pinctrl_provide_dummies()?

I suggest we pick up this patch now even with stable tag (the irq storm
fixup doesn't work correctly because of this) and consider the
refactoring as a second step?
Linus Walleij March 9, 2016, 10:30 a.m. UTC | #10
On Tue, Mar 8, 2016 at 5:21 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
>
>> Perhaps the of_have_populated_dt() check should be moved inside
>> pinctrl_provide_dummies()?
>
> Hmm, the kernel-doc for pinctrl_provide_dummies() says "Usually this
> function is called by platforms without pinctrl driver support...".
> Is "without pintctrl" == "no DT"? Linus?

The primary example is a platform with one pin controller and
two identical GPIO controllers, one of the GPIO controllers
is using a pin control backend.

Since the GPIO driver has to call pinctrl_request_gpio() etc,
it needs something to hold on to if there is no backing pin
controller for one of them.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij March 9, 2016, 10:32 a.m. UTC | #11
On Wed, Mar 9, 2016 at 4:58 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
> On Mon, Mar 07, 2016 at 10:00:37PM +0100, Geert Uytterhoeven wrote:

>> >    This approach is better then, won't have to fix again whenever SH gets DT
>> > support.
>>
>> Perhaps the of_have_populated_dt() check should be moved inside
>> pinctrl_provide_dummies()?
>
> I suggest we pick up this patch now even with stable tag (the irq storm
> fixup doesn't work correctly because of this) and consider the
> refactoring as a second step?

Sergei, Geert, do you ACK this?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov March 9, 2016, 12:51 p.m. UTC | #12
Hello.

On 3/9/2016 1:32 PM, Linus Walleij wrote:

>>>>     This approach is better then, won't have to fix again whenever SH gets DT
>>>> support.
>>>
>>> Perhaps the of_have_populated_dt() check should be moved inside
>>> pinctrl_provide_dummies()?
>>
>> I suggest we pick up this patch now even with stable tag (the irq storm
>> fixup doesn't work correctly because of this) and consider the
>> refactoring as a second step?
>
> Sergei, Geert, do you ACK this?

    Since this patch fixes the real issue in mainline (which I wasn't aware of 
-- my patch only describes an issue with the 'ravb' driver the patches for 
using which in gen2 were never sent upstream):

Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

    I'd only like that the "Fixes:" and "Cc:" tags were added to it.

> Yours,
> Linus Walleij

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven March 9, 2016, 1:17 p.m. UTC | #13
Hi Linus,

On Wed, Mar 9, 2016 at 11:32 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Wed, Mar 9, 2016 at 4:58 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
>> On Mon, Mar 07, 2016 at 10:00:37PM +0100, Geert Uytterhoeven wrote:
>
>>> >    This approach is better then, won't have to fix again whenever SH gets DT
>>> > support.
>>>
>>> Perhaps the of_have_populated_dt() check should be moved inside
>>> pinctrl_provide_dummies()?
>>
>> I suggest we pick up this patch now even with stable tag (the irq storm
>> fixup doesn't work correctly because of this) and consider the
>> refactoring as a second step?
>
> Sergei, Geert, do you ACK this?

I gave this a try on all my boards, plus the remote r8a7790/lager that
exhibited the problem.

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Please pick it up. Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang March 9, 2016, 3:37 p.m. UTC | #14
>    I'd only like that the "Fixes:" and "Cc:" tags were added to it.

To make it easier for you, Linus:

Fixes: ef0eebc05130 ("drivers/pinctrl: Add the concept of an "init" state")
CC: stable@vger.kernel.org
Linus Walleij March 15, 2016, 8:29 a.m. UTC | #15
On Mon, Mar 7, 2016 at 7:40 PM, Wolfram Sang <wsa@the-dreams.de> wrote:

> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> If pinctrl_provide_dummies() is used unconditionally, then the dummy
> state will be used even on DT platforms when the "init" state was
> intentionally left out. Instead of "default", the dummy "init" state
> will then be used during probe. Thus, when probing an I2C controller on
> cold boot, communication triggered by bus notifiers broke because the
> pins were not initialized.
>
> Do it like OMAP2: use the dummy state only for non-DT platforms.
>
> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Patch applied for fixes with all the ACKs etc.

This unfortiunately coincide with the merge window so was slow
to pick it up, but it will be in the first round of fixes to Torvalds,
possibly at -rc1 possibly earlier.

> -       pinctrl_provide_dummies();
> +       /* Enable dummy states for those platforms without pinctrl support */
> +       if (!of_have_populated_dt())
> +               pinctrl_provide_dummies();

So remind we: what Renesas platforms are still not using DT?
arch/sh?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven March 15, 2016, 9:08 a.m. UTC | #16
Hi Linus,

On Tue, Mar 15, 2016 at 9:29 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Mon, Mar 7, 2016 at 7:40 PM, Wolfram Sang <wsa@the-dreams.de> wrote:
>
>> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>
>> If pinctrl_provide_dummies() is used unconditionally, then the dummy
>> state will be used even on DT platforms when the "init" state was
>> intentionally left out. Instead of "default", the dummy "init" state
>> will then be used during probe. Thus, when probing an I2C controller on
>> cold boot, communication triggered by bus notifiers broke because the
>> pins were not initialized.
>>
>> Do it like OMAP2: use the dummy state only for non-DT platforms.
>>
>> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> Patch applied for fixes with all the ACKs etc.
>
> This unfortiunately coincide with the merge window so was slow
> to pick it up, but it will be in the first round of fixes to Torvalds,
> possibly at -rc1 possibly earlier.

Thanks, I understand.

>> -       pinctrl_provide_dummies();
>> +       /* Enable dummy states for those platforms without pinctrl support */
>> +       if (!of_have_populated_dt())
>> +               pinctrl_provide_dummies();
>
> So remind we: what Renesas platforms are still not using DT?
> arch/sh?

Yep, the mighty SuperH. Old H8 and new ARM are DT-only.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov March 15, 2016, 12:31 p.m. UTC | #17
On 3/15/2016 11:29 AM, Linus Walleij wrote:

>> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
>>
>> If pinctrl_provide_dummies() is used unconditionally, then the dummy
>> state will be used even on DT platforms when the "init" state was
>> intentionally left out. Instead of "default", the dummy "init" state
>> will then be used during probe. Thus, when probing an I2C controller on
>> cold boot, communication triggered by bus notifiers broke because the
>> pins were not initialized.
>>
>> Do it like OMAP2: use the dummy state only for non-DT platforms.
>>
>> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>
> Patch applied for fixes with all the ACKs etc.
>
> This unfortiunately coincide with the merge window so was slow
> to pick it up, but it will be in the first round of fixes to Torvalds,
> possibly at -rc1 possibly earlier.

    TIA!

>> -       pinctrl_provide_dummies();
>> +       /* Enable dummy states for those platforms without pinctrl support */
>> +       if (!of_have_populated_dt())
>> +               pinctrl_provide_dummies();
>
> So remind we: what Renesas platforms are still not using DT?
> arch/sh?

    Yes, only those are left.

> Yours,
> Linus Walleij

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Guo March 29, 2016, 5:48 a.m. UTC | #18
On Mon, Mar 07, 2016 at 10:00:37PM +0100, Geert Uytterhoeven wrote:
> CC Shawn, Sascha for imx1

Sorry for the late response.

> 
> On Mon, Mar 7, 2016 at 9:34 PM, Sergei Shtylyov
> <sergei.shtylyov@cogentembedded.com> wrote:
> > On 03/07/2016 11:29 PM, Geert Uytterhoeven wrote:
> >
> >>>>> --- a/drivers/pinctrl/sh-pfc/core.c
> >>>>> +++ b/drivers/pinctrl/sh-pfc/core.c
> >>>>> @@ -545,7 +545,9 @@ static int sh_pfc_probe(struct platform_device
> >>>>> *pdev)
> >>>>>                           return ret;
> >>>>>           }
> >>>>>
> >>>>> -       pinctrl_provide_dummies();
> >>>>> +       /* Enable dummy states for those platforms without pinctrl
> >>>>> support */
> >>>>> +       if (!of_have_populated_dt())
> >>>
> >>>
> >>>     I'd considered this condition -- it won't fly on SH where
> >>> CONFIG_OF=n,
> >>> the kernel just won't build IIUC...
> >>
> >>
> >> I haven't tried to compile it yet, but <linux/of.h> does provide a dummy
> >> that
> >> returns false.
> >
> >
> >    Oops, indeed. I missed it. :-(
> >    This approach is better then, won't have to fix again whenever SH gets DT
> > support.
> 
> Perhaps the of_have_populated_dt() check should be moved inside
> pinctrl_provide_dummies()?
> 
> Besides omap2, which has its own check, the only other user is imx1.
> Does imx1 (still) needs this on DT-based platforms?
> 
> (Context for Shawn and Sascha:
>  http://article.gmane.org/gmane.linux.kernel.renesas-soc/1639)

pinctrl_provide_dummies() is only used on a few legacy i.MX platforms
for non-DT boot, so it should be safe to move the check inside the
function from i.MX view.

Shawn
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/pinctrl/sh-pfc/core.c b/drivers/pinctrl/sh-pfc/core.c
index 0c2d14c504aa1d..db53d7bbc16e18 100644
--- a/drivers/pinctrl/sh-pfc/core.c
+++ b/drivers/pinctrl/sh-pfc/core.c
@@ -545,7 +545,9 @@  static int sh_pfc_probe(struct platform_device *pdev)
 			return ret;
 	}
 
-	pinctrl_provide_dummies();
+	/* Enable dummy states for those platforms without pinctrl support */
+	if (!of_have_populated_dt())
+		pinctrl_provide_dummies();
 
 	ret = sh_pfc_init_ranges(pfc);
 	if (ret < 0)