netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Corentin Labbe <clabbe@baylibre.com>
Cc: alexandre.torgue@foss.st.com, andrew@lunn.ch, broonie@kernel.org,
	calvin.johnson@oss.nxp.com, davem@davemloft.net,
	edumazet@google.com, hkallweit1@gmail.com,
	jernej.skrabec@gmail.com, joabreu@synopsys.com,
	krzysztof.kozlowski+dt@linaro.org, kuba@kernel.org,
	lgirdwood@gmail.com, linux@armlinux.org.uk, pabeni@redhat.com,
	peppe.cavallaro@st.com, robh+dt@kernel.org, samuel@sholland.org,
	wens@csie.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 2/6] net: stmmac: dwmac-sun8i: remove regulator
Date: Mon, 9 May 2022 15:09:07 +0100	[thread overview]
Message-ID: <20220509150907.6cf9c4d1@donnerap.cambridge.arm.com> (raw)
In-Reply-To: <20220509074857.195302-3-clabbe@baylibre.com>

On Mon,  9 May 2022 07:48:53 +0000
Corentin Labbe <clabbe@baylibre.com> wrote:

Hi,

> Now regulator is handled by phy core, there is no need to handle it in
> stmmac driver.

I don't think you can do that, since we definitely need to maintain
compatibility with *older* DTs.
Is there a real need for this patch, or is it just a cleanup?
I mean we should be able to keep both approaches in, and the respective
board and DT version selects which it is using.

Cheers,
Andre

> Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
> ---
>  .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 37 +------------------
>  1 file changed, 2 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index f834472599f7..17888813c707 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> @@ -17,7 +17,6 @@
>  #include <linux/phy.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
> -#include <linux/regulator/consumer.h>
>  #include <linux/regmap.h>
>  #include <linux/stmmac.h>
>  
> @@ -59,7 +58,6 @@ struct emac_variant {
>  
>  /* struct sunxi_priv_data - hold all sunxi private data
>   * @ephy_clk:	reference to the optional EPHY clock for the internal PHY
> - * @regulator:	reference to the optional regulator
>   * @rst_ephy:	reference to the optional EPHY reset for the internal PHY
>   * @variant:	reference to the current board variant
>   * @regmap:	regmap for using the syscon
> @@ -69,7 +67,6 @@ struct emac_variant {
>   */
>  struct sunxi_priv_data {
>  	struct clk *ephy_clk;
> -	struct regulator *regulator;
>  	struct reset_control *rst_ephy;
>  	const struct emac_variant *variant;
>  	struct regmap_field *regmap_field;
> @@ -568,29 +565,11 @@ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)
>  {
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct sunxi_priv_data *gmac = priv;
> -	int ret;
>  
> -	if (gmac->regulator) {
> -		ret = regulator_enable(gmac->regulator);
> -		if (ret) {
> -			dev_err(&pdev->dev, "Fail to enable regulator\n");
> -			return ret;
> -		}
> -	}
> -
> -	if (gmac->use_internal_phy) {
> -		ret = sun8i_dwmac_power_internal_phy(netdev_priv(ndev));
> -		if (ret)
> -			goto err_disable_regulator;
> -	}
> +	if (gmac->use_internal_phy)
> +		return sun8i_dwmac_power_internal_phy(netdev_priv(ndev));
>  
>  	return 0;
> -
> -err_disable_regulator:
> -	if (gmac->regulator)
> -		regulator_disable(gmac->regulator);
> -
> -	return ret;
>  }
>  
>  static void sun8i_dwmac_core_init(struct mac_device_info *hw,
> @@ -1034,9 +1013,6 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv)
>  
>  	if (gmac->variant->soc_has_internal_phy)
>  		sun8i_dwmac_unpower_internal_phy(gmac);
> -
> -	if (gmac->regulator)
> -		regulator_disable(gmac->regulator);
>  }
>  
>  static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable)
> @@ -1157,15 +1133,6 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> -	/* Optional regulator for PHY */
> -	gmac->regulator = devm_regulator_get_optional(dev, "phy");
> -	if (IS_ERR(gmac->regulator)) {
> -		if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER)
> -			return -EPROBE_DEFER;
> -		dev_info(dev, "No regulator found\n");
> -		gmac->regulator = NULL;
> -	}
> -
>  	/* The "GMAC clock control" register might be located in the
>  	 * CCU address range (on the R40), or the system control address
>  	 * range (on most other sun8i and later SoCs).


  reply	other threads:[~2022-05-09 14:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09  7:48 [PATCH 0/6] arm64: add ethernet to orange pi 3 Corentin Labbe
2022-05-09  7:48 ` [PATCH 1/6] phy: handle optional regulator for PHY Corentin Labbe
2022-05-09  7:48 ` [PATCH 2/6] net: stmmac: dwmac-sun8i: remove regulator Corentin Labbe
2022-05-09 14:09   ` Andre Przywara [this message]
2022-05-09 14:38     ` LABBE Corentin
2022-05-09  7:48 ` [PATCH 3/6] dt-bindings: net: Add documentation for phy-supply Corentin Labbe
2022-05-09 12:17   ` Andrew Lunn
2022-05-09 13:26     ` LABBE Corentin
2022-05-09 16:02       ` Andrew Lunn
2022-05-09 16:12         ` Mark Brown
2022-05-09 16:38           ` Andrew Lunn
2022-05-09 16:56             ` Mark Brown
2022-05-11  8:02               ` LABBE Corentin
2022-05-11 12:50                 ` Mark Brown
2022-05-17  0:47             ` Rob Herring
2022-05-09  7:48 ` [PATCH 4/6] ARM: dts: sunxi: move phy regulator in PHY node Corentin Labbe
2022-05-09 10:55   ` Andre Przywara
2022-05-09 11:16     ` LABBE Corentin
2022-05-09  7:48 ` [PATCH 5/6] arm64: dts: allwinner: " Corentin Labbe
2022-05-09  7:48 ` [PATCH 6/6] arm64: dts: allwinner: orange-pi-3: Enable ethernet Corentin Labbe
2022-05-09 12:20 ` [PATCH 0/6] arm64: add ethernet to orange pi 3 Andrew Lunn
2022-05-09 13:27   ` LABBE Corentin
2022-05-09 15:19     ` Andrew Lunn
2022-05-09 15:24       ` LABBE Corentin
2022-05-09 15:56         ` Mark Brown

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=20220509150907.6cf9c4d1@donnerap.cambridge.arm.com \
    --to=andre.przywara@arm.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew@lunn.ch \
    --cc=broonie@kernel.org \
    --cc=calvin.johnson@oss.nxp.com \
    --cc=clabbe@baylibre.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=robh+dt@kernel.org \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).