[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <809d24bf-2c1b-469c-a906-c0b4298e56a0@gmail.com>
Date: Tue, 24 Oct 2023 14:09:18 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Luiz Angelo Daros de Luca <luizluca@...il.com>, netdev@...r.kernel.org
Cc: linus.walleij@...aro.org, alsi@...g-olufsen.dk, andrew@...n.ch,
vivien.didelot@...il.com, olteanv@...il.com, davem@...emloft.net,
kuba@...nel.org, pabeni@...hat.com, robh+dt@...nel.org, krzk+dt@...nel.org,
arinc.unal@...nc9.com
Subject: Re: [PATCH net-next 1/2] net: dsa: realtek: support reset controller
On 10/24/23 13:58, Luiz Angelo Daros de Luca wrote:
> The 'reset-gpios' will not work when the switch reset is controlled by a
> reset controller.
>
> Although the reset is optional and the driver performs a soft reset
> during setup, if the initial reset state was asserted, the driver will
> not detect it.
>
> This is an example of how to use the reset controller:
>
> switch {
> compatible = "realtek,rtl8366rb";
>
> resets = <&rst 8>;
> reset-names = "switch";
>
> ...
> }
>
> The reset controller will take precedence over the reset GPIO.
>
> Signed-off-by: Luiz Angelo Daros de Luca <luizluca@...il.com>
> ---
> drivers/net/dsa/realtek/realtek-mdio.c | 36 +++++++++++++++++++++-----
> drivers/net/dsa/realtek/realtek-smi.c | 34 +++++++++++++++++++-----
> drivers/net/dsa/realtek/realtek.h | 6 +++++
> 3 files changed, 63 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/dsa/realtek/realtek-mdio.c b/drivers/net/dsa/realtek/realtek-mdio.c
> index 292e6d087e8b..600124c58c00 100644
> --- a/drivers/net/dsa/realtek/realtek-mdio.c
> +++ b/drivers/net/dsa/realtek/realtek-mdio.c
> @@ -140,6 +140,23 @@ static const struct regmap_config realtek_mdio_nolock_regmap_config = {
> .disable_locking = true,
> };
>
> +static int realtek_mdio_hwreset(struct realtek_priv *priv, bool active)
> +{
> +#ifdef CONFIG_RESET_CONTROLLER
> + if (priv->reset_ctl) {
> + if (active)
> + return reset_control_assert(priv->reset_ctl);
> + else
> + return reset_control_deassert(priv->reset_ctl);
> + }
> +#endif
Empty stubs are provided when CONFIG_RESET_CONTROLLER is disabled, and
if you switch to using devm_reset_control_get() then you will get a NULL
reset_control reference which will be a no-op for all of those operations.
--
Florian
Powered by blists - more mailing lists