[PATCH net-next 0/4] riscv: sophgo: Add ethernet support for SG2042

Inochi Amaoto posted 4 patches 7 months, 1 week ago
There is a newer version of this series
.../devicetree/bindings/net/snps,dwmac.yaml   |  4 ++
.../bindings/net/sophgo,sg2044-dwmac.yaml     | 11 +++-
arch/riscv/boot/dts/sophgo/sg2042.dtsi        | 62 +++++++++++++++++++
.../ethernet/stmicro/stmmac/dwmac-sophgo.c    |  1 +
.../ethernet/stmicro/stmmac/stmmac_platform.c |  1 +
5 files changed, 76 insertions(+), 3 deletions(-)
[PATCH net-next 0/4] riscv: sophgo: Add ethernet support for SG2042
Posted by Inochi Amaoto 7 months, 1 week ago
The ethernet controller of SG2042 is Synopsys DesignWare IP with
tx clock. Add device id for it.

This patch can only be tested on a SG2042 x4 evb board, as pioneer
does not expose this device.

Inochi Amaoto (4):
  dt-bindings: net: sophgo,sg2044-dwmac: Add support for Sophgo SG2042
    dwmac
  net: stmmac: dwmac-sophgo: Add support for Sophgo SG2042 SoC
  net: stmmac: platform: Add snps,dwmac-5.00a IP compatible string
  riscv: dts: sophgo: add ethernet GMAC device for sg2042

 .../devicetree/bindings/net/snps,dwmac.yaml   |  4 ++
 .../bindings/net/sophgo,sg2044-dwmac.yaml     | 11 +++-
 arch/riscv/boot/dts/sophgo/sg2042.dtsi        | 62 +++++++++++++++++++
 .../ethernet/stmicro/stmmac/dwmac-sophgo.c    |  1 +
 .../ethernet/stmicro/stmmac/stmmac_platform.c |  1 +
 5 files changed, 76 insertions(+), 3 deletions(-)

--
2.49.0
Re: [PATCH net-next 0/4] riscv: sophgo: Add ethernet support for SG2042
Posted by Andrew Lunn 7 months, 1 week ago
On Tue, May 06, 2025 at 05:32:50PM +0800, Inochi Amaoto wrote:
> The ethernet controller of SG2042 is Synopsys DesignWare IP with
> tx clock. Add device id for it.
> 
> This patch can only be tested on a SG2042 x4 evb board, as pioneer
> does not expose this device.

Do you have a patch for this EVB board? Ideally there should be a user
added at the same time as support for a device.

	Andrew
Re: [PATCH net-next 0/4] riscv: sophgo: Add ethernet support for SG2042
Posted by Inochi Amaoto 7 months, 1 week ago
On Tue, May 06, 2025 at 02:03:18PM +0200, Andrew Lunn wrote:
> On Tue, May 06, 2025 at 05:32:50PM +0800, Inochi Amaoto wrote:
> > The ethernet controller of SG2042 is Synopsys DesignWare IP with
> > tx clock. Add device id for it.
> > 
> > This patch can only be tested on a SG2042 x4 evb board, as pioneer
> > does not expose this device.
> 
> Do you have a patch for this EVB board? Ideally there should be a user
> added at the same time as support for a device.
> 
> 	Andrew

Yes, I have one for this device. And Han Gao told me that he will send
the board patch for the evb board. So I only send the driver.
And the fragment for the evb board is likes below, I think it is kind
of trivial:

&gmac0 {
	phy-handle = <&phy0>;
	phy-mode = "rgmii-txid";
	status = "okay";

	mdio {
		phy0: phy@0 {
			compatible = "ethernet-phy-ieee802.3-c22";
			reg = <0>;
			reset-gpios = <&port0a 27 GPIO_ACTIVE_LOW>;
			reset-assert-us = <100000>;
			reset-deassert-us = <100000>;
		};
	};
};
 
Regards,
Inochi
Re: [PATCH net-next 0/4] riscv: sophgo: Add ethernet support for SG2042
Posted by Andrew Lunn 7 months, 1 week ago
On Wed, May 07, 2025 at 06:24:29AM +0800, Inochi Amaoto wrote:
> On Tue, May 06, 2025 at 02:03:18PM +0200, Andrew Lunn wrote:
> > On Tue, May 06, 2025 at 05:32:50PM +0800, Inochi Amaoto wrote:
> > > The ethernet controller of SG2042 is Synopsys DesignWare IP with
> > > tx clock. Add device id for it.
> > > 
> > > This patch can only be tested on a SG2042 x4 evb board, as pioneer
> > > does not expose this device.
> > 
> > Do you have a patch for this EVB board? Ideally there should be a user
> > added at the same time as support for a device.
> > 
> > 	Andrew
> 
> Yes, I have one for this device. And Han Gao told me that he will send
> the board patch for the evb board. So I only send the driver.
> And the fragment for the evb board is likes below, I think it is kind
> of trivial:
> 
> &gmac0 {
> 	phy-handle = <&phy0>;
> 	phy-mode = "rgmii-txid";

And this is why i ask, because this is broken. For more information,
please see:

https://patchwork.kernel.org/project/netdevbpf/patch/20250430-v6-15-rc3-net-rgmii-delays-v2-1-099ae651d5e5@lunn.ch/

	Andrew
Re: [PATCH net-next 0/4] riscv: sophgo: Add ethernet support for SG2042
Posted by Inochi Amaoto 7 months, 1 week ago
On Wed, May 07, 2025 at 02:10:48AM +0200, Andrew Lunn wrote:
> On Wed, May 07, 2025 at 06:24:29AM +0800, Inochi Amaoto wrote:
> > On Tue, May 06, 2025 at 02:03:18PM +0200, Andrew Lunn wrote:
> > > On Tue, May 06, 2025 at 05:32:50PM +0800, Inochi Amaoto wrote:
> > > > The ethernet controller of SG2042 is Synopsys DesignWare IP with
> > > > tx clock. Add device id for it.
> > > > 
> > > > This patch can only be tested on a SG2042 x4 evb board, as pioneer
> > > > does not expose this device.
> > > 
> > > Do you have a patch for this EVB board? Ideally there should be a user
> > > added at the same time as support for a device.
> > > 
> > > 	Andrew
> > 
> > Yes, I have one for this device. And Han Gao told me that he will send
> > the board patch for the evb board. So I only send the driver.
> > And the fragment for the evb board is likes below, I think it is kind
> > of trivial:
> > 
> > &gmac0 {
> > 	phy-handle = <&phy0>;
> > 	phy-mode = "rgmii-txid";
> 
> And this is why i ask, because this is broken. For more information,
> please see:
> 
> https://patchwork.kernel.org/project/netdevbpf/patch/20250430-v6-15-rc3-net-rgmii-delays-v2-1-099ae651d5e5@lunn.ch/
> 
> 	Andrew

You are right, the right phy-mode is "rgmii-id", the delay is not
added by the PCB. It seems to be better to ask for the vendor about
the hardware design before copying params for vendor dts. Anyway,
thanks for reviewing this.

Regards,
Inochi
Re: [PATCH net-next 0/4] riscv: sophgo: Add ethernet support for SG2042
Posted by Andrew Lunn 7 months, 1 week ago
On Wed, May 07, 2025 at 08:01:29PM +0800, Inochi Amaoto wrote:
> On Wed, May 07, 2025 at 02:10:48AM +0200, Andrew Lunn wrote:
> > On Wed, May 07, 2025 at 06:24:29AM +0800, Inochi Amaoto wrote:
> > > On Tue, May 06, 2025 at 02:03:18PM +0200, Andrew Lunn wrote:
> > > > On Tue, May 06, 2025 at 05:32:50PM +0800, Inochi Amaoto wrote:
> > > > > The ethernet controller of SG2042 is Synopsys DesignWare IP with
> > > > > tx clock. Add device id for it.
> > > > > 
> > > > > This patch can only be tested on a SG2042 x4 evb board, as pioneer
> > > > > does not expose this device.
> > > > 
> > > > Do you have a patch for this EVB board? Ideally there should be a user
> > > > added at the same time as support for a device.
> > > > 
> > > > 	Andrew
> > > 
> > > Yes, I have one for this device. And Han Gao told me that he will send
> > > the board patch for the evb board. So I only send the driver.
> > > And the fragment for the evb board is likes below, I think it is kind
> > > of trivial:
> > > 
> > > &gmac0 {
> > > 	phy-handle = <&phy0>;
> > > 	phy-mode = "rgmii-txid";
> > 
> > And this is why i ask, because this is broken. For more information,
> > please see:
> > 
> > https://patchwork.kernel.org/project/netdevbpf/patch/20250430-v6-15-rc3-net-rgmii-delays-v2-1-099ae651d5e5@lunn.ch/
> > 
> > 	Andrew
> 
> You are right, the right phy-mode is "rgmii-id", the delay is not
> added by the PCB. It seems to be better to ask for the vendor about
> the hardware design before copying params for vendor dts. Anyway,
> thanks for reviewing this.

Please do figure this out. Since you are adding a new compatible, you
have a bit more flexibility. If the MAC driver is doing something
wrong, you can change its behaviour based on this new compatible
without breaking other users of the driver using other compatibles.

	Andrew
Re: [PATCH net-next 0/4] riscv: sophgo: Add ethernet support for SG2042
Posted by Inochi Amaoto 7 months, 1 week ago
On Wed, May 07, 2025 at 02:37:15PM +0200, Andrew Lunn wrote:
> On Wed, May 07, 2025 at 08:01:29PM +0800, Inochi Amaoto wrote:
> > On Wed, May 07, 2025 at 02:10:48AM +0200, Andrew Lunn wrote:
> > > On Wed, May 07, 2025 at 06:24:29AM +0800, Inochi Amaoto wrote:
> > > > On Tue, May 06, 2025 at 02:03:18PM +0200, Andrew Lunn wrote:
> > > > > On Tue, May 06, 2025 at 05:32:50PM +0800, Inochi Amaoto wrote:
> > > > > > The ethernet controller of SG2042 is Synopsys DesignWare IP with
> > > > > > tx clock. Add device id for it.
> > > > > > 
> > > > > > This patch can only be tested on a SG2042 x4 evb board, as pioneer
> > > > > > does not expose this device.
> > > > > 
> > > > > Do you have a patch for this EVB board? Ideally there should be a user
> > > > > added at the same time as support for a device.
> > > > > 
> > > > > 	Andrew
> > > > 
> > > > Yes, I have one for this device. And Han Gao told me that he will send
> > > > the board patch for the evb board. So I only send the driver.
> > > > And the fragment for the evb board is likes below, I think it is kind
> > > > of trivial:
> > > > 
> > > > &gmac0 {
> > > > 	phy-handle = <&phy0>;
> > > > 	phy-mode = "rgmii-txid";
> > > 
> > > And this is why i ask, because this is broken. For more information,
> > > please see:
> > > 
> > > https://patchwork.kernel.org/project/netdevbpf/patch/20250430-v6-15-rc3-net-rgmii-delays-v2-1-099ae651d5e5@lunn.ch/
> > > 
> > > 	Andrew
> > 
> > You are right, the right phy-mode is "rgmii-id", the delay is not
> > added by the PCB. It seems to be better to ask for the vendor about
> > the hardware design before copying params for vendor dts. Anyway,
> > thanks for reviewing this.
> 
> Please do figure this out. Since you are adding a new compatible, you
> have a bit more flexibility. If the MAC driver is doing something
> wrong, you can change its behaviour based on this new compatible
> without breaking other users of the driver using other compatibles.
> 

Thanks, I will check it out. And adapt the driver if needed.

Regards,
Inochi