linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next 0/5] net: stmmac: socfpga: fix init ordering and cleanups
Date: Wed, 16 Apr 2025 10:32:53 +0200	[thread overview]
Message-ID: <20250416103253.629db3de@fedora.home> (raw)
In-Reply-To: <Z_9oVrAOnInrhb6z@shell.armlinux.org.uk>

On Wed, 16 Apr 2025 09:20:38 +0100
"Russell King (Oracle)" <linux@armlinux.org.uk> wrote:

> On Wed, Apr 16, 2025 at 09:53:43AM +0200, Maxime Chevallier wrote:
> > I've given this a try and unfortunately :  
> 
> Great, someone with hardware, and who responds to patches! :)
> 
> > This is only to get the phymode, maybe we should do like dwmac_imx
> > and store a pointer to plat_dat into struct dwmac_socfpga, so that we
> > can get it back in dwmac_init ? I've tried with the patch below and it
> > does solve the issue, but maybe you have a better approach.  
> 
> Yes, but I don't think we need such a big patch:
> 
>  drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> index 8e6d780669b9..59f90b123c5b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> @@ -50,6 +50,7 @@ struct socfpga_dwmac {
>  	u32	reg_offset;
>  	u32	reg_shift;
>  	struct	device *dev;
> +	struct plat_stmmacenet_data *plat_dat;
>  	struct regmap *sys_mgr_base_addr;
>  	struct reset_control *stmmac_rst;
>  	struct reset_control *stmmac_ocp_rst;
> @@ -233,10 +234,7 @@ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *
>  
>  static int socfpga_get_plat_phymode(struct socfpga_dwmac *dwmac)
>  {
> -	struct net_device *ndev = dev_get_drvdata(dwmac->dev);
> -	struct stmmac_priv *priv = netdev_priv(ndev);
> -
> -	return priv->plat->mac_interface;
> +	return dwmac->plat_dat->mac_interface;
>  }
>  
>  static void socfpga_sgmii_config(struct socfpga_dwmac *dwmac, bool enable)
> @@ -490,6 +488,7 @@ static int socfpga_dwmac_probe(struct platform_device *pdev)
>  	 */
>  	dwmac->stmmac_rst = plat_dat->stmmac_rst;
>  	dwmac->ops = ops;
> +	dwmac->plat_dat = plat_dat;
>  
>  	plat_dat->bsp_priv = dwmac;
>  	plat_dat->fix_mac_speed = socfpga_dwmac_fix_mac_speed;
> 

Even better indeed ! I've tested it and it works.

I'll be happy to test any followup :)

Maxime


      reply	other threads:[~2025-04-16 10:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 16:29 [PATCH net-next 0/5] net: stmmac: socfpga: fix init ordering and cleanups Russell King (Oracle)
2025-04-15 16:29 ` [PATCH net-next 1/5] net: stmmac: socfpga: init dwmac->stmmac_rst before registration Russell King (Oracle)
2025-04-15 16:29 ` [PATCH net-next 2/5] net: stmmac: socfpga: provide init function Russell King (Oracle)
2025-04-15 16:29 ` [PATCH net-next 3/5] net: stmmac: socfpga: convert to stmmac_pltfr_pm_ops Russell King (Oracle)
2025-04-15 16:29 ` [PATCH net-next 4/5] net: stmmac: socfpga: call set_phy_mode() before registration Russell King (Oracle)
2025-04-15 16:29 ` [PATCH net-next 5/5] net: stmmac: socfpga: convert to devm_stmmac_pltfr_probe() Russell King (Oracle)
2025-04-16  7:53 ` [PATCH net-next 0/5] net: stmmac: socfpga: fix init ordering and cleanups Maxime Chevallier
2025-04-16  8:20   ` Russell King (Oracle)
2025-04-16  8:32     ` Maxime Chevallier [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=20250416103253.629db3de@fedora.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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 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).