From: Florian Fainelli <f.fainelli@gmail.com>
To: Luiz Angelo Daros de Luca <luizluca@gmail.com>, netdev@vger.kernel.org
Cc: linus.walleij@linaro.org, andrew@lunn.ch,
vivien.didelot@gmail.com, olteanv@gmail.com, davem@davemloft.net,
kuba@kernel.org, alsi@bang-olufsen.dk, arinc.unal@arinc9.com,
Frank Wunderlich <frank-w@public-files.de>
Subject: Re: [PATCH net-next] net: dsa: realtek: realtek-mdio: reset before setup
Date: Fri, 11 Feb 2022 13:01:53 -0800 [thread overview]
Message-ID: <ccf3f079-4567-7de6-46f2-7b8896b06d77@gmail.com> (raw)
In-Reply-To: <20220211051403.3952-1-luizluca@gmail.com>
On 2/10/22 9:14 PM, Luiz Angelo Daros de Luca wrote:
> Some devices, like the switch in Banana Pi BPI R64 only starts to answer
> after a HW reset. It is the same reset code from realtek-smi.
>
> Reported-by: Frank Wunderlich <frank-w@public-files.de>
> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
> ---
[snip]
> ret = priv->ops->detect(priv);
> if (ret) {
> dev_err(dev, "unable to detect switch\n");
> @@ -183,6 +198,10 @@ static void realtek_mdio_remove(struct mdio_device *mdiodev)
> if (!priv)
> return;
>
> + /* leave the device reset asserted */
> + if (priv->reset)
> + gpiod_set_value(priv->reset, 1);
> +
> dsa_unregister_switch(priv->ds);
>
> dev_set_drvdata(&mdiodev->dev, NULL);
> diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c
> index a849b5cbb4e4..cada5386f6a2 100644
> --- a/drivers/net/dsa/realtek/realtek-smi.c
> +++ b/drivers/net/dsa/realtek/realtek-smi.c
> @@ -43,8 +43,6 @@
> #include "realtek.h"
>
> #define REALTEK_SMI_ACK_RETRY_COUNT 5
> -#define REALTEK_SMI_HW_STOP_DELAY 25 /* msecs */
> -#define REALTEK_SMI_HW_START_DELAY 100 /* msecs */
>
> static inline void realtek_smi_clk_delay(struct realtek_priv *priv)
> {
> @@ -426,9 +424,9 @@ static int realtek_smi_probe(struct platform_device *pdev)
> dev_err(dev, "failed to get RESET GPIO\n");
> return PTR_ERR(priv->reset);
> }
> - msleep(REALTEK_SMI_HW_STOP_DELAY);
> + msleep(REALTEK_HW_STOP_DELAY);
> gpiod_set_value(priv->reset, 0);
> - msleep(REALTEK_SMI_HW_START_DELAY);
> + msleep(REALTEK_HW_START_DELAY);
> dev_info(dev, "deasserted RESET\n");
Maybe demote these to debug prints since they would show up every time
you load/unload the driver.
--
Florian
prev parent reply other threads:[~2022-02-11 21:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 5:14 [PATCH net-next] net: dsa: realtek: realtek-mdio: reset before setup Luiz Angelo Daros de Luca
2022-02-11 6:09 ` Frank Wunderlich
2022-02-11 9:54 ` Alvin Šipraga
2022-02-11 10:30 ` Linus Walleij
2022-02-11 23:12 ` Luiz Angelo Daros de Luca
2022-02-11 10:28 ` Linus Walleij
2022-02-11 19:44 ` Andrew Lunn
2022-02-11 21:01 ` Florian Fainelli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ccf3f079-4567-7de6-46f2-7b8896b06d77@gmail.com \
--to=f.fainelli@gmail.com \
--cc=alsi@bang-olufsen.dk \
--cc=andrew@lunn.ch \
--cc=arinc.unal@arinc9.com \
--cc=davem@davemloft.net \
--cc=frank-w@public-files.de \
--cc=kuba@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=luizluca@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.