linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
@ 2025-10-17  1:18 Inochi Amaoto
  2025-10-17 18:16 ` Andrew Lunn
  2025-10-18  0:05 ` Yixun Lan
  0 siblings, 2 replies; 9+ messages in thread
From: Inochi Amaoto @ 2025-10-17  1:18 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Chen Wang, Inochi Amaoto, Maxime Coquelin,
	Alexandre Torgue, Russell King (Oracle), Han Gao, Icenowy Zheng,
	Vivian Wang, Yao Zi
  Cc: netdev, sophgo, linux-stm32, linux-arm-kernel, linux-kernel,
	Yixun Lan, Longbin Li

As the SG2042 has an internal rx delay, the delay should be remove
when init the mac, otherwise the phy will be misconfigurated.

Fixes: 543009e2d4cd ("net: stmmac: dwmac-sophgo: Add support for Sophgo SG2042 SoC")
Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
Tested-by: Han Gao <rabenda.cn@gmail.com>
---
 .../ethernet/stmicro/stmmac/dwmac-sophgo.c    | 25 ++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
index 3b7947a7a7ba..b2dee1399eb0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
@@ -7,6 +7,7 @@

 #include <linux/clk.h>
 #include <linux/module.h>
+#include <linux/property.h>
 #include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>

@@ -29,8 +30,23 @@ static int sophgo_sg2044_dwmac_init(struct platform_device *pdev,
 	return 0;
 }

+static int sophgo_sg2042_set_mode(struct plat_stmmacenet_data *plat_dat)
+{
+	switch (plat_dat->phy_interface) {
+	case PHY_INTERFACE_MODE_RGMII_ID:
+		plat_dat->phy_interface = PHY_INTERFACE_MODE_RGMII_TXID;
+		return 0;
+	case PHY_INTERFACE_MODE_RGMII_RXID:
+		plat_dat->phy_interface = PHY_INTERFACE_MODE_RGMII;
+		return 0;
+	default:
+		return -EINVAL;
+	}
+}
+
 static int sophgo_dwmac_probe(struct platform_device *pdev)
 {
+	int (*plat_set_mode)(struct plat_stmmacenet_data *plat_dat);
 	struct plat_stmmacenet_data *plat_dat;
 	struct stmmac_resources stmmac_res;
 	struct device *dev = &pdev->dev;
@@ -50,11 +66,18 @@ static int sophgo_dwmac_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;

+	plat_set_mode = device_get_match_data(&pdev->dev);
+	if (plat_set_mode) {
+		ret = plat_set_mode(plat_dat);
+		if (ret)
+			return ret;
+	}
+
 	return stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
 }

 static const struct of_device_id sophgo_dwmac_match[] = {
-	{ .compatible = "sophgo,sg2042-dwmac" },
+	{ .compatible = "sophgo,sg2042-dwmac", .data = sophgo_sg2042_set_mode },
 	{ .compatible = "sophgo,sg2044-dwmac" },
 	{ /* sentinel */ }
 };
--
2.51.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
  2025-10-17  1:18 [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter Inochi Amaoto
@ 2025-10-17 18:16 ` Andrew Lunn
  2025-10-18  0:42   ` Inochi Amaoto
  2025-10-18  0:05 ` Yixun Lan
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2025-10-17 18:16 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Chen Wang, Maxime Coquelin, Alexandre Torgue,
	Russell King (Oracle), Han Gao, Icenowy Zheng, Vivian Wang,
	Yao Zi, netdev, sophgo, linux-stm32, linux-arm-kernel,
	linux-kernel, Yixun Lan, Longbin Li

On Fri, Oct 17, 2025 at 09:18:01AM +0800, Inochi Amaoto wrote:
> As the SG2042 has an internal rx delay, the delay should be remove
> when init the mac, otherwise the phy will be misconfigurated.

Are there any in tree DT blobs using invalid phy-modes? In theory,
they should not work, but sometimes there is other magic going on. I
just want to make sure this is not going to cause a regression.

Also, does the DT binding document list the valid phy-modes?

      Andrew


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
  2025-10-17  1:18 [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter Inochi Amaoto
  2025-10-17 18:16 ` Andrew Lunn
@ 2025-10-18  0:05 ` Yixun Lan
  2025-10-18  0:43   ` Inochi Amaoto
  1 sibling, 1 reply; 9+ messages in thread
From: Yixun Lan @ 2025-10-18  0:05 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Chen Wang, Maxime Coquelin, Alexandre Torgue,
	Russell King (Oracle), Han Gao, Icenowy Zheng, Vivian Wang,
	Yao Zi, netdev, sophgo, linux-stm32, linux-arm-kernel,
	linux-kernel, Longbin Li

Hi Inochi,

On 09:18 Fri 17 Oct     , Inochi Amaoto wrote:
> As the SG2042 has an internal rx delay, the delay should be remove
                                                     s/remove/removed/
> when init the mac, otherwise the phy will be misconfigurated.
s/init/initialize/
> 
> Fixes: 543009e2d4cd ("net: stmmac: dwmac-sophgo: Add support for Sophgo SG2042 SoC")
> Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> Tested-by: Han Gao <rabenda.cn@gmail.com>
> ---
>  .../ethernet/stmicro/stmmac/dwmac-sophgo.c    | 25 ++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
> index 3b7947a7a7ba..b2dee1399eb0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
> @@ -7,6 +7,7 @@
> 
>  #include <linux/clk.h>
>  #include <linux/module.h>
> +#include <linux/property.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/platform_device.h>
> 
> @@ -29,8 +30,23 @@ static int sophgo_sg2044_dwmac_init(struct platform_device *pdev,
>  	return 0;
>  }
> 
> +static int sophgo_sg2042_set_mode(struct plat_stmmacenet_data *plat_dat)
> +{
> +	switch (plat_dat->phy_interface) {
> +	case PHY_INTERFACE_MODE_RGMII_ID:
> +		plat_dat->phy_interface = PHY_INTERFACE_MODE_RGMII_TXID;
> +		return 0;
> +	case PHY_INTERFACE_MODE_RGMII_RXID:
> +		plat_dat->phy_interface = PHY_INTERFACE_MODE_RGMII;
> +		return 0;
> +	default:
> +		return -EINVAL;
> +	}
> +}
> +
>  static int sophgo_dwmac_probe(struct platform_device *pdev)
>  {
> +	int (*plat_set_mode)(struct plat_stmmacenet_data *plat_dat);
>  	struct plat_stmmacenet_data *plat_dat;
>  	struct stmmac_resources stmmac_res;
>  	struct device *dev = &pdev->dev;
> @@ -50,11 +66,18 @@ static int sophgo_dwmac_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
> 
> +	plat_set_mode = device_get_match_data(&pdev->dev);
> +	if (plat_set_mode) {
> +		ret = plat_set_mode(plat_dat);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	return stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
>  }
> 
>  static const struct of_device_id sophgo_dwmac_match[] = {
> -	{ .compatible = "sophgo,sg2042-dwmac" },
> +	{ .compatible = "sophgo,sg2042-dwmac", .data = sophgo_sg2042_set_mode },
I'd personally prefer to introduce a flag for this, it would be more readable and
maintainable, something like
struct sophgo_dwmac_compitable_data {
	bool has_internal_rx_delay;
}

then.
	if (data->has_internal_rx_delay)
		sophgo_sg2042_set_mode(..)


>  	{ .compatible = "sophgo,sg2044-dwmac" },
>  	{ /* sentinel */ }
>  };
> --
> 2.51.0
> 

-- 
Yixun Lan (dlan)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
  2025-10-17 18:16 ` Andrew Lunn
@ 2025-10-18  0:42   ` Inochi Amaoto
  2025-10-18 20:38     ` Andrew Lunn
  0 siblings, 1 reply; 9+ messages in thread
From: Inochi Amaoto @ 2025-10-18  0:42 UTC (permalink / raw)
  To: Andrew Lunn, Inochi Amaoto
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Chen Wang, Maxime Coquelin, Alexandre Torgue,
	Russell King (Oracle), Han Gao, Icenowy Zheng, Vivian Wang,
	Yao Zi, netdev, sophgo, linux-stm32, linux-arm-kernel,
	linux-kernel, Yixun Lan, Longbin Li

On Fri, Oct 17, 2025 at 08:16:17PM +0200, Andrew Lunn wrote:
> On Fri, Oct 17, 2025 at 09:18:01AM +0800, Inochi Amaoto wrote:
> > As the SG2042 has an internal rx delay, the delay should be remove
> > when init the mac, otherwise the phy will be misconfigurated.
> 
> Are there any in tree DT blobs using invalid phy-modes? In theory,
> they should not work, but sometimes there is other magic going on. I
> just want to make sure this is not going to cause a regression.
> 

I see no SG2042 board using invalid phy-modes. Only rgmii-id is used,
which is vaild.

> Also, does the DT binding document list the valid phy-modes?
> 

It does not list. Is it better for me to add a list for it?

Regards,
Inochi


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
  2025-10-18  0:05 ` Yixun Lan
@ 2025-10-18  0:43   ` Inochi Amaoto
  0 siblings, 0 replies; 9+ messages in thread
From: Inochi Amaoto @ 2025-10-18  0:43 UTC (permalink / raw)
  To: Yixun Lan, Inochi Amaoto
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Chen Wang, Maxime Coquelin, Alexandre Torgue,
	Russell King (Oracle), Han Gao, Icenowy Zheng, Vivian Wang,
	Yao Zi, netdev, sophgo, linux-stm32, linux-arm-kernel,
	linux-kernel, Longbin Li

On Sat, Oct 18, 2025 at 08:05:48AM +0800, Yixun Lan wrote:
> Hi Inochi,
> 
> On 09:18 Fri 17 Oct     , Inochi Amaoto wrote:
> > As the SG2042 has an internal rx delay, the delay should be remove
>                                                      s/remove/removed/
> > when init the mac, otherwise the phy will be misconfigurated.
> s/init/initialize/
> > 
> > Fixes: 543009e2d4cd ("net: stmmac: dwmac-sophgo: Add support for Sophgo SG2042 SoC")
> > Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> > Tested-by: Han Gao <rabenda.cn@gmail.com>
> > ---
> >  .../ethernet/stmicro/stmmac/dwmac-sophgo.c    | 25 ++++++++++++++++++-
> >  1 file changed, 24 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
> > index 3b7947a7a7ba..b2dee1399eb0 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c
> > @@ -7,6 +7,7 @@
> > 
> >  #include <linux/clk.h>
> >  #include <linux/module.h>
> > +#include <linux/property.h>
> >  #include <linux/mod_devicetable.h>
> >  #include <linux/platform_device.h>
> > 
> > @@ -29,8 +30,23 @@ static int sophgo_sg2044_dwmac_init(struct platform_device *pdev,
> >  	return 0;
> >  }
> > 
> > +static int sophgo_sg2042_set_mode(struct plat_stmmacenet_data *plat_dat)
> > +{
> > +	switch (plat_dat->phy_interface) {
> > +	case PHY_INTERFACE_MODE_RGMII_ID:
> > +		plat_dat->phy_interface = PHY_INTERFACE_MODE_RGMII_TXID;
> > +		return 0;
> > +	case PHY_INTERFACE_MODE_RGMII_RXID:
> > +		plat_dat->phy_interface = PHY_INTERFACE_MODE_RGMII;
> > +		return 0;
> > +	default:
> > +		return -EINVAL;
> > +	}
> > +}
> > +
> >  static int sophgo_dwmac_probe(struct platform_device *pdev)
> >  {
> > +	int (*plat_set_mode)(struct plat_stmmacenet_data *plat_dat);
> >  	struct plat_stmmacenet_data *plat_dat;
> >  	struct stmmac_resources stmmac_res;
> >  	struct device *dev = &pdev->dev;
> > @@ -50,11 +66,18 @@ static int sophgo_dwmac_probe(struct platform_device *pdev)
> >  	if (ret)
> >  		return ret;
> > 
> > +	plat_set_mode = device_get_match_data(&pdev->dev);
> > +	if (plat_set_mode) {
> > +		ret = plat_set_mode(plat_dat);
> > +		if (ret)
> > +			return ret;
> > +	}
> > +
> >  	return stmmac_dvr_probe(dev, plat_dat, &stmmac_res);
> >  }
> > 

> >  static const struct of_device_id sophgo_dwmac_match[] = {
> > -	{ .compatible = "sophgo,sg2042-dwmac" },
> > +	{ .compatible = "sophgo,sg2042-dwmac", .data = sophgo_sg2042_set_mode },
> I'd personally prefer to introduce a flag for this, it would be more readable and
> maintainable, something like
> struct sophgo_dwmac_compitable_data {
> 	bool has_internal_rx_delay;
> }
> 
> then.
> 	if (data->has_internal_rx_delay)
> 		sophgo_sg2042_set_mode(..)
> 
> 
> >  	{ .compatible = "sophgo,sg2044-dwmac" },
> >  	{ /* sentinel */ }
> >  };

Yeah, I think this is a good idea, thanks.

Regards,
Inochi



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
  2025-10-18  0:42   ` Inochi Amaoto
@ 2025-10-18 20:38     ` Andrew Lunn
  2025-10-18 20:49       ` Russell King (Oracle)
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2025-10-18 20:38 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Chen Wang, Maxime Coquelin, Alexandre Torgue,
	Russell King (Oracle), Han Gao, Icenowy Zheng, Vivian Wang,
	Yao Zi, netdev, sophgo, linux-stm32, linux-arm-kernel,
	linux-kernel, Yixun Lan, Longbin Li

On Sat, Oct 18, 2025 at 08:42:07AM +0800, Inochi Amaoto wrote:
> On Fri, Oct 17, 2025 at 08:16:17PM +0200, Andrew Lunn wrote:
> > On Fri, Oct 17, 2025 at 09:18:01AM +0800, Inochi Amaoto wrote:
> > > As the SG2042 has an internal rx delay, the delay should be remove
> > > when init the mac, otherwise the phy will be misconfigurated.
> > 
> > Are there any in tree DT blobs using invalid phy-modes? In theory,
> > they should not work, but sometimes there is other magic going on. I
> > just want to make sure this is not going to cause a regression.
> > 
> 
> I see no SG2042 board using invalid phy-modes. Only rgmii-id is used,
> which is vaild.

Great, thanks for checking.

> 
> > Also, does the DT binding document list the valid phy-modes?
> > 
> 
> It does not list. Is it better for me to add a list for it?

It would be nice to list the valid modes, to match the code.

   Andrew


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
  2025-10-18 20:38     ` Andrew Lunn
@ 2025-10-18 20:49       ` Russell King (Oracle)
  2025-10-19  0:04         ` Andrew Lunn
  0 siblings, 1 reply; 9+ messages in thread
From: Russell King (Oracle) @ 2025-10-18 20:49 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Inochi Amaoto, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Chen Wang, Maxime Coquelin,
	Alexandre Torgue, Han Gao, Icenowy Zheng, Vivian Wang, Yao Zi,
	netdev, sophgo, linux-stm32, linux-arm-kernel, linux-kernel,
	Yixun Lan, Longbin Li

On Sat, Oct 18, 2025 at 10:38:17PM +0200, Andrew Lunn wrote:
> On Sat, Oct 18, 2025 at 08:42:07AM +0800, Inochi Amaoto wrote:
> > On Fri, Oct 17, 2025 at 08:16:17PM +0200, Andrew Lunn wrote:
> > > On Fri, Oct 17, 2025 at 09:18:01AM +0800, Inochi Amaoto wrote:
> > > > As the SG2042 has an internal rx delay, the delay should be remove
> > > > when init the mac, otherwise the phy will be misconfigurated.
> > > 
> > > Are there any in tree DT blobs using invalid phy-modes? In theory,
> > > they should not work, but sometimes there is other magic going on. I
> > > just want to make sure this is not going to cause a regression.
> > > 
> > 
> > I see no SG2042 board using invalid phy-modes. Only rgmii-id is used,
> > which is vaild.
> 
> Great, thanks for checking.

Hang on. Is this right?

The commit says that SG2042 has an internal receive delay. This is
presumably the MAC side.

To work around that, you map rgmii-id to rgmii-txid for the PHY, to
prevent the PHY from enabling its receive-side clock delay.

It seems to me that you're saying that rgmii-rxid and rgmii-id
should not be used with these MACs, and you're fixing up to remove
the receive-side delay.

"rgmii-id" doesn't mean "there is a delay _somewhere_ in the system".
It's supposed to mean that the PHY should add delays on both tx and
rx paths.

Confused.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
  2025-10-18 20:49       ` Russell King (Oracle)
@ 2025-10-19  0:04         ` Andrew Lunn
  2025-10-19  9:25           ` Russell King (Oracle)
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2025-10-19  0:04 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Inochi Amaoto, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Chen Wang, Maxime Coquelin,
	Alexandre Torgue, Han Gao, Icenowy Zheng, Vivian Wang, Yao Zi,
	netdev, sophgo, linux-stm32, linux-arm-kernel, linux-kernel,
	Yixun Lan, Longbin Li

> "rgmii-id" doesn't mean "there is a delay _somewhere_ in the system".
> It's supposed to mean that the PHY should add delays on both tx and
> rx paths.

When passed to the PHY it means that.

However, DT describes the hardware, the PCB. "rgmii-id" means the PCB
does not provide the delays. So the MAC/PHY combination needs to add
the delays. We normally have the PHY provide the delays, so the
phy-mode is normally passed straight to the PHY. However, if the MAC
is adding a delay, which it is in this case, in one direction and
cannot be turned off, the value passed to the PHY needs to reflect
this, to avoid double delays.

And because the MAC delay cannot be turned off, it means there are PCB
designs which don't work, double delays. So it would be nice not to
list them in the binding.

	Andrew


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter
  2025-10-19  0:04         ` Andrew Lunn
@ 2025-10-19  9:25           ` Russell King (Oracle)
  0 siblings, 0 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2025-10-19  9:25 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Inochi Amaoto, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Chen Wang, Maxime Coquelin,
	Alexandre Torgue, Han Gao, Icenowy Zheng, Vivian Wang, Yao Zi,
	netdev, sophgo, linux-stm32, linux-arm-kernel, linux-kernel,
	Yixun Lan, Longbin Li

On Sun, Oct 19, 2025 at 02:04:02AM +0200, Andrew Lunn wrote:
> > "rgmii-id" doesn't mean "there is a delay _somewhere_ in the system".
> > It's supposed to mean that the PHY should add delays on both tx and
> > rx paths.
> 
> When passed to the PHY it means that.
> 
> However, DT describes the hardware, the PCB. "rgmii-id" means the PCB
> does not provide the delays. So the MAC/PHY combination needs to add
> the delays. We normally have the PHY provide the delays, so the
> phy-mode is normally passed straight to the PHY. However, if the MAC
> is adding a delay, which it is in this case, in one direction and
> cannot be turned off, the value passed to the PHY needs to reflect
> this, to avoid double delays.
> 
> And because the MAC delay cannot be turned off, it means there are PCB
> designs which don't work, double delays. So it would be nice not to
> list them in the binding.

Well, I find this confusing. I'd suggest there needs to be common code
to deal with it so we can stop thinking about it, and just push everyone
towards using the common code.

phy_interface_t phy_fix_phy_mode_for_mac_delays(phy_interface_t interface,
						bool mac_txid, bool mac_rxid)
{
	if (!phy_interface_mode_is_rgmii(interface))
		return interface;

	if (mac_txid && mac_rxid) {
		if (interface == PHY_INTERFACE_MODE_RGMII_ID)
			return PHY_INTERFACE_MODE_RGMII;
		return PHY_INTERFACE_MODE_NA;
	}

	if (mac_txid) {
		if (interface == PHY_INTERFACE_MODE_RGMII_ID)
			return PHY_INTERFACE_MODE_RGMII_RXID;
		if (interface == PHY_INTERFACE_MODE_RGMII_TXID)
			return PHY_INTERFACE_MODE_RGMII;
		return PHY_INTERFACE_MODE_NA;
	}

	if (mac_rxid) {
		if (interface == PHY_INTERFACE_MODE_RGMII_ID)
			return PHY_INTERFACE_MODE_RGMII_TXID;
		if (interface == PHY_INTERFACE_MODE_RGMII_RXID)
			return PHY_INTERFACE_MODE_RGMII;
		return PHY_INTERFACE_MODE_NA;
	}

	return interface;
}

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-19 21:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17  1:18 [PATCH] net: stmmac: dwmac-sophgo: Add phy interface filter Inochi Amaoto
2025-10-17 18:16 ` Andrew Lunn
2025-10-18  0:42   ` Inochi Amaoto
2025-10-18 20:38     ` Andrew Lunn
2025-10-18 20:49       ` Russell King (Oracle)
2025-10-19  0:04         ` Andrew Lunn
2025-10-19  9:25           ` Russell King (Oracle)
2025-10-18  0:05 ` Yixun Lan
2025-10-18  0:43   ` Inochi Amaoto

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).