2022-02-09 19:12:47

by Måns Rullgård

[permalink] [raw]
Subject: [PATCH] net: dsa: lan9303: fix reset on probe

The reset input to the LAN9303 chip is active low, and devicetree
gpio handles reflect this. Therefore, the gpio should be requested
with an initial state of high in order for the reset signal to be
asserted. Other uses of the gpio already use the correct polarity.

Signed-off-by: Mans Rullgard <[email protected]>
---
drivers/net/dsa/lan9303-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index aa1142d6a9f5..2de67708bbd2 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -1301,7 +1301,7 @@ static int lan9303_probe_reset_gpio(struct lan9303 *chip,
struct device_node *np)
{
chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset",
- GPIOD_OUT_LOW);
+ GPIOD_OUT_HIGH);
if (IS_ERR(chip->reset_gpio))
return PTR_ERR(chip->reset_gpio);

--
2.35.1



2022-02-09 20:01:59

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH] net: dsa: lan9303: fix reset on probe

On Wed, Feb 09, 2022 at 02:54:54PM +0000, Mans Rullgard wrote:
> The reset input to the LAN9303 chip is active low, and devicetree
> gpio handles reflect this. Therefore, the gpio should be requested
> with an initial state of high in order for the reset signal to be
> asserted. Other uses of the gpio already use the correct polarity.
>
> Signed-off-by: Mans Rullgard <[email protected]>
> ---
> drivers/net/dsa/lan9303-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
> index aa1142d6a9f5..2de67708bbd2 100644
> --- a/drivers/net/dsa/lan9303-core.c
> +++ b/drivers/net/dsa/lan9303-core.c
> @@ -1301,7 +1301,7 @@ static int lan9303_probe_reset_gpio(struct lan9303 *chip,
> struct device_node *np)
> {
> chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset",
> - GPIOD_OUT_LOW);
> + GPIOD_OUT_HIGH);
> if (IS_ERR(chip->reset_gpio))
> return PTR_ERR(chip->reset_gpio);

lan9303_handle_reset() does a sleep and then releases the reset. I
don't see anywhere in the driver which asserts the reset first. So is
it actually asserted as part of this getting the GPIO? And if so, does
not this change actually break the reset?

Andrew

2022-02-10 03:42:43

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH] net: dsa: lan9303: fix reset on probe

On Wed, 9 Feb 2022 14:54:54 +0000 Mans Rullgard wrote:
> The reset input to the LAN9303 chip is active low, and devicetree
> gpio handles reflect this. Therefore, the gpio should be requested
> with an initial state of high in order for the reset signal to be
> asserted. Other uses of the gpio already use the correct polarity.
>
> Signed-off-by: Mans Rullgard <[email protected]>

Pending Andrew's review, this is the correct fixes tag, right?

Fixes: a1292595e006 ("net: dsa: add new DSA switch driver for the SMSC-LAN9303")

2022-02-10 14:48:19

by Måns Rullgård

[permalink] [raw]
Subject: Re: [PATCH] net: dsa: lan9303: fix reset on probe

Jakub Kicinski <[email protected]> writes:

> On Wed, 9 Feb 2022 14:54:54 +0000 Mans Rullgard wrote:
>> The reset input to the LAN9303 chip is active low, and devicetree
>> gpio handles reflect this. Therefore, the gpio should be requested
>> with an initial state of high in order for the reset signal to be
>> asserted. Other uses of the gpio already use the correct polarity.
>>
>> Signed-off-by: Mans Rullgard <[email protected]>
>
> Pending Andrew's review, this is the correct fixes tag, right?
>
> Fixes: a1292595e006 ("net: dsa: add new DSA switch driver for the SMSC-LAN9303")

Yes, the error has been there since the driver was first added.

--
M?ns Rullg?rd

2022-02-11 21:45:40

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH] net: dsa: lan9303: fix reset on probe

On 2/9/22 6:54 AM, Mans Rullgard wrote:
> The reset input to the LAN9303 chip is active low, and devicetree
> gpio handles reflect this. Therefore, the gpio should be requested
> with an initial state of high in order for the reset signal to be
> asserted. Other uses of the gpio already use the correct polarity.
>
> Signed-off-by: Mans Rullgard <[email protected]>

Reviewed-by: Florian Fianelil <[email protected]>
--
Florian

2022-02-13 11:19:29

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH] net: dsa: lan9303: fix reset on probe

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

On Wed, 9 Feb 2022 14:54:54 +0000 you wrote:
> The reset input to the LAN9303 chip is active low, and devicetree
> gpio handles reflect this. Therefore, the gpio should be requested
> with an initial state of high in order for the reset signal to be
> asserted. Other uses of the gpio already use the correct polarity.
>
> Signed-off-by: Mans Rullgard <[email protected]>
>
> [...]

Here is the summary with links:
- net: dsa: lan9303: fix reset on probe
https://git.kernel.org/netdev/net/c/6bb9681a43f3

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html