pinctrl: sh-pfc: core: only call pinctrl_provide_dummies() on SuperH
diff mbox

Message ID 14300712.5chtEzsjIN@wasted.cogentembedded.com
State New
Headers show

Commit Message

Sergei Shtylyov March 4, 2016, 10:58 p.m. UTC
The 'ravb' Ethernet driver couldn't connect to  the PHY as the MDIO bus
appeared empty on the Renesas R-Car boards. The bug hunt finally pointed
at  the commit adding the "init" pintcrl state: it tries to switch to non-
default state before the driver probe which should fail but doesn't as the
PFC pinctrl driver happens to call pinctrl_provide_dummies()  which makes
all state lookups succeed, even though the state doesn't really exist.
That feature is only relevant to non-DT systems and all the ARM boards
that use the PFC driver  have been converted to the DT boot, so limiting
it to the SuperH architecture seems The Right Thing...

Fixes: ef0eebc05130 ("drivers/pinctrl: Add the concept of an "init" state")
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
CC: stable@vger.kernel.org

---
The patch is against the 'fixes' branch of Linus W.'s 'linux-pinctrl.git' repo.
As  the bug only seems to happen  to the hardware that's not pre-configured by
U-Boot, this patch can wait till 4.6 in principle...

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


--
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

Comments

Linus Walleij March 9, 2016, 11:09 a.m. UTC | #1
On Sat, Mar 5, 2016 at 5:58 AM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:

> The 'ravb' Ethernet driver couldn't connect to  the PHY as the MDIO bus
> appeared empty on the Renesas R-Car boards. The bug hunt finally pointed
> at  the commit adding the "init" pintcrl state: it tries to switch to non-
> default state before the driver probe which should fail but doesn't as the
> PFC pinctrl driver happens to call pinctrl_provide_dummies()  which makes
> all state lookups succeed, even though the state doesn't really exist.
> That feature is only relevant to non-DT systems and all the ARM boards
> that use the PFC driver  have been converted to the DT boot, so limiting
> it to the SuperH architecture seems The Right Thing...
>
> Fixes: ef0eebc05130 ("drivers/pinctrl: Add the concept of an "init" state")
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> CC: stable@vger.kernel.org

Putting this on hold because another patch is being discussed as a
more proper fix.

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:25 p.m. UTC | #2
Hello.

On 3/9/2016 2:09 PM, Linus Walleij wrote:

>> The 'ravb' Ethernet driver couldn't connect to  the PHY as the MDIO bus
>> appeared empty on the Renesas R-Car boards. The bug hunt finally pointed
>> at  the commit adding the "init" pintcrl state: it tries to switch to non-
>> default state before the driver probe which should fail but doesn't as the
>> PFC pinctrl driver happens to call pinctrl_provide_dummies()  which makes
>> all state lookups succeed, even though the state doesn't really exist.
>> That feature is only relevant to non-DT systems and all the ARM boards
>> that use the PFC driver  have been converted to the DT boot, so limiting
>> it to the SuperH architecture seems The Right Thing...
>>
>> Fixes: ef0eebc05130 ("drivers/pinctrl: Add the concept of an "init" state")
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>> CC: stable@vger.kernel.org
>
> Putting this on hold because another patch is being discussed as a
> more proper fix.

    Sigh, I had that variant of the fix too but erroneously thought that 
of_have_populated_dt() could only be used with CONFIG_OF=y, so didn't publish 
that variant... Had no idea someone else's working on the same issue.

> 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

Patch
diff mbox

Index: linux-pinctrl/drivers/pinctrl/sh-pfc/core.c
===================================================================
--- linux-pinctrl.orig/drivers/pinctrl/sh-pfc/core.c
+++ linux-pinctrl/drivers/pinctrl/sh-pfc/core.c
@@ -545,7 +545,8 @@  static int sh_pfc_probe(struct platform_
 			return ret;
 	}
 
-	pinctrl_provide_dummies();
+	if (IS_ENABLED(CONFIG_SUPERH))
+		pinctrl_provide_dummies();
 
 	ret = sh_pfc_init_ranges(pfc);
 	if (ret < 0)