[PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx

Inochi Amaoto posted 3 patches 4 months ago
There is a newer version of this series
.../bindings/net/sophgo,cv1800b-dwmac.yaml    | 113 ++++++++++++++++++
arch/riscv/boot/dts/sophgo/cv180x.dtsi        |  70 +++++++++++
2 files changed, 183 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/sophgo,cv1800b-dwmac.yaml
[PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx
Posted by Inochi Amaoto 4 months ago
Add device binding and dts for CV18XX series SoC, this dts change series
require both the mdio patch [1] and the reset patch [2].

[1] https://lore.kernel.org/all/20250611080228.1166090-1-inochiama@gmail.com
[2] https://lore.kernel.org/all/20250611075321.1160973-1-inochiama@gmail.com

Inochi Amaoto (3):
  dt-bindings: net: Add support for Sophgo CV1800 dwmac
  riscv: dts: sophgo: Add ethernet device for cv18xx
  riscv: dts: sophgo: Add mdio multiplexer device for cv18xx

 .../bindings/net/sophgo,cv1800b-dwmac.yaml    | 113 ++++++++++++++++++
 arch/riscv/boot/dts/sophgo/cv180x.dtsi        |  70 +++++++++++
 2 files changed, 183 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/sophgo,cv1800b-dwmac.yaml


base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
prerequisite-patch-id: d5162144180458b11587ebd4ad24e5e3f62b0caf
prerequisite-patch-id: 9e1992d2ec3c81fbcc463ff7397168fc2acbbf1b
prerequisite-patch-id: ab3ca8c9cda888f429945fb0283145122975b734
prerequisite-patch-id: bd94f8bd3d4ce4f3b153cbb36a3896c5dc143c17
prerequisite-patch-id: 1b73196566058718471def62bc215d2f319513c3
prerequisite-patch-id: 54157303203826ccf91e985458c4ae7bcdd9b2ba
--
2.49.0
Re: [PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx
Posted by Alexander Sverdlin 3 months, 4 weeks ago
Hi Inochi!

On Wed, 2025-06-11 at 16:07 +0800, Inochi Amaoto wrote:
> Add device binding and dts for CV18XX series SoC, this dts change series
> require both the mdio patch [1] and the reset patch [2].
> 
> [1] https://lore.kernel.org/all/20250611080228.1166090-1-inochiama@gmail.com
> [2] https://lore.kernel.org/all/20250611075321.1160973-1-inochiama@gmail.com
> 
> Inochi Amaoto (3):
>   dt-bindings: net: Add support for Sophgo CV1800 dwmac
>   riscv: dts: sophgo: Add ethernet device for cv18xx
>   riscv: dts: sophgo: Add mdio multiplexer device for cv18xx

Have you noticed any problems on the board you are testing on?
I've added the patchset + pre-requisited + the following into my board DT
for Milk-V Duo Module 01 EVB:

&mdio {
       status = "okay";
};

&gmac0 {
       phy-mode = "internal";
       phy-handle = <&internal_ephy>;
       status = "okay";
};

And the PHY is being detected and the Ethernet controller is being instantiated,
but the PHY behaves really strange: LEDs blinking wildly, link status is bogus
100FULL UP even without cable insterted and the real traffic starts to travel
only roughly a minute after the cable has been plugged in.

I could look into it, if Sophgo has documented the internal PHY, just wanted to
sync with you for the case you've seen this already...

> 
>  .../bindings/net/sophgo,cv1800b-dwmac.yaml    | 113 ++++++++++++++++++
>  arch/riscv/boot/dts/sophgo/cv180x.dtsi        |  70 +++++++++++
>  2 files changed, 183 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/sophgo,cv1800b-dwmac.yaml

-- 
Alexander Sverdlin.
Re: [PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx
Posted by Inochi Amaoto 3 months, 3 weeks ago
On Sat, Jun 14, 2025 at 11:19:34PM +0200, Alexander Sverdlin wrote:
> Hi Inochi!
> 
> On Wed, 2025-06-11 at 16:07 +0800, Inochi Amaoto wrote:
> > Add device binding and dts for CV18XX series SoC, this dts change series
> > require both the mdio patch [1] and the reset patch [2].
> > 
> > [1] https://lore.kernel.org/all/20250611080228.1166090-1-inochiama@gmail.com
> > [2] https://lore.kernel.org/all/20250611075321.1160973-1-inochiama@gmail.com
> > 
> > Inochi Amaoto (3):
> >   dt-bindings: net: Add support for Sophgo CV1800 dwmac
> >   riscv: dts: sophgo: Add ethernet device for cv18xx
> >   riscv: dts: sophgo: Add mdio multiplexer device for cv18xx
> 
> Have you noticed any problems on the board you are testing on?
> I've added the patchset + pre-requisited + the following into my board DT
> for Milk-V Duo Module 01 EVB:
> 
> &mdio {
>        status = "okay";
> };
> 
> &gmac0 {
>        phy-mode = "internal";
>        phy-handle = <&internal_ephy>;
>        status = "okay";
> };
> 
> And the PHY is being detected and the Ethernet controller is being instantiated,
> but the PHY behaves really strange: LEDs blinking wildly, link status is bogus
> 100FULL UP even without cable insterted and the real traffic starts to travel
> only roughly a minute after the cable has been plugged in.
> 

This is true and may be related to a wrong pinctrl setting or the
phy setting. But I am not sure the right configuration is at now.
IIRC the phy is inited in the uboot and the kernel does not touch
its custom part.

Regards,
Inochi
Re: [PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx
Posted by Alexander Sverdlin 3 months, 4 weeks ago
Thanks for the series Inochi!

On Wed, 2025-06-11 at 16:07 +0800, Inochi Amaoto wrote:
> Add device binding and dts for CV18XX series SoC, this dts change series
> require both the mdio patch [1] and the reset patch [2].
> 
> [1] https://lore.kernel.org/all/20250611080228.1166090-1-inochiama@gmail.com
> [2] https://lore.kernel.org/all/20250611075321.1160973-1-inochiama@gmail.com
> 
> Inochi Amaoto (3):
>   dt-bindings: net: Add support for Sophgo CV1800 dwmac
>   riscv: dts: sophgo: Add ethernet device for cv18xx
>   riscv: dts: sophgo: Add mdio multiplexer device for cv18xx

Taking into account, whatever MII variation is implemented in the SoC
is always internal (and only MDIO part is multiplexed), can we add
	phy-mode = "internal";
and
	phy-handle = <&internal_ephy>;
right into cv180x.dtsi?

Boards can then enable the corresponding nodes if they wire RJ45 connector,
but I see no way how they could vary the MII connection.

> 
>  .../bindings/net/sophgo,cv1800b-dwmac.yaml    | 113 ++++++++++++++++++
>  arch/riscv/boot/dts/sophgo/cv180x.dtsi        |  70 +++++++++++
>  2 files changed, 183 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/sophgo,cv1800b-dwmac.yaml
> 
> 
> base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
> prerequisite-patch-id: d5162144180458b11587ebd4ad24e5e3f62b0caf
> prerequisite-patch-id: 9e1992d2ec3c81fbcc463ff7397168fc2acbbf1b
> prerequisite-patch-id: ab3ca8c9cda888f429945fb0283145122975b734
> prerequisite-patch-id: bd94f8bd3d4ce4f3b153cbb36a3896c5dc143c17
> prerequisite-patch-id: 1b73196566058718471def62bc215d2f319513c3
> prerequisite-patch-id: 54157303203826ccf91e985458c4ae7bcdd9b2ba
> --
> 2.49.0

-- 
Alexander Sverdlin.
Re: [PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx
Posted by Alexander Sverdlin 3 months, 4 weeks ago
On Sat, 2025-06-14 at 23:01 +0200, Alexander Sverdlin wrote:
> Thanks for the series Inochi!
> 
> On Wed, 2025-06-11 at 16:07 +0800, Inochi Amaoto wrote:
> > Add device binding and dts for CV18XX series SoC, this dts change series
> > require both the mdio patch [1] and the reset patch [2].
> > 
> > [1] https://lore.kernel.org/all/20250611080228.1166090-1-inochiama@gmail.com
> > [2] https://lore.kernel.org/all/20250611075321.1160973-1-inochiama@gmail.com
> > 
> > Inochi Amaoto (3):
> >   dt-bindings: net: Add support for Sophgo CV1800 dwmac
> >   riscv: dts: sophgo: Add ethernet device for cv18xx
> >   riscv: dts: sophgo: Add mdio multiplexer device for cv18xx
> 
> Taking into account, whatever MII variation is implemented in the SoC
> is always internal (and only MDIO part is multiplexed), can we add
> 	phy-mode = "internal";
> and
> 	phy-handle = <&internal_ephy>;
> right into cv180x.dtsi?
> 
> Boards can then enable the corresponding nodes if they wire RJ45 connector,
> but I see no way how they could vary the MII connection.

I suppose the above proposal was wrong, though undocumented, there seems
to be an external RMII interface (at least on SG2000 SoC).

Unfortunately the internal PHY is also barely documented...
Also ethtool seems to be incompatible with mdio muxes :(

> >  .../bindings/net/sophgo,cv1800b-dwmac.yaml    | 113 ++++++++++++++++++
> >  arch/riscv/boot/dts/sophgo/cv180x.dtsi        |  70 +++++++++++
> >  2 files changed, 183 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/net/sophgo,cv1800b-dwmac.yaml

-- 
Alexander Sverdlin.
Re: [PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx
Posted by Andrew Lunn 3 months, 4 weeks ago
> Also ethtool seems to be incompatible with mdio muxes :(

Please could you expand on that, because i don't know of a problem
with mdio muxes and ethtool.

	Andrew
Re: [PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx
Posted by Alexander Sverdlin 3 months, 4 weeks ago
Sorry for confusion Andrew,

On Sun, 2025-06-15 at 00:20 +0200, Andrew Lunn wrote:
> > Also ethtool seems to be incompatible with mdio muxes :(
> 
> Please could you expand on that, because i don't know of a problem
> with mdio muxes and ethtool.

everything seems to be fine with ethtool and mdio mux!
(I accidentally mixed up host and target consoles)

# ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full 
                                             100baseT/Half 100baseT/Full 
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: external
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x0000003f (63)
                               drv probe link timer ifdown ifup
        Link detected: yes

But we do have some troubles with the internal PHY with Inochi's patches
on SG2000, the above "Link detected: yes" is actually without cable
inserted.

-- 
Alexander Sverdlin.
Re: [PATCH net-next RFC 0/3] riscv: dts: sophgo: Add ethernet support for cv18xx
Posted by Inochi Amaoto 3 months, 4 weeks ago
On Sun, Jun 15, 2025 at 12:34:24AM +0200, Alexander Sverdlin wrote:
> Sorry for confusion Andrew,
> 
> On Sun, 2025-06-15 at 00:20 +0200, Andrew Lunn wrote:
> > > Also ethtool seems to be incompatible with mdio muxes :(
> > 
> > Please could you expand on that, because i don't know of a problem
> > with mdio muxes and ethtool.
> 
> everything seems to be fine with ethtool and mdio mux!
> (I accidentally mixed up host and target consoles)
> 
> # ethtool eth0
> Settings for eth0:
>         Supported ports: [ TP MII ]
>         Supported link modes:   10baseT/Half 10baseT/Full 
>                                 100baseT/Half 100baseT/Full 
>         Supported pause frame use: Symmetric Receive-only
>         Supports auto-negotiation: Yes
>         Supported FEC modes: Not reported
>         Advertised link modes:  10baseT/Half 10baseT/Full 
>                                 100baseT/Half 100baseT/Full 
>         Advertised pause frame use: Symmetric Receive-only
>         Advertised auto-negotiation: Yes
>         Advertised FEC modes: Not reported
>         Link partner advertised link modes:  10baseT/Half 10baseT/Full 
>                                              100baseT/Half 100baseT/Full 
>         Link partner advertised pause frame use: Symmetric Receive-only
>         Link partner advertised auto-negotiation: Yes
>         Link partner advertised FEC modes: Not reported
>         Speed: 100Mb/s
>         Duplex: Full
>         Port: MII
>         PHYAD: 0
>         Transceiver: external
>         Auto-negotiation: on
>         Supports Wake-on: d
>         Wake-on: d
>         Current message level: 0x0000003f (63)
>                                drv probe link timer ifdown ifup
>         Link detected: yes
> 
> But we do have some troubles with the internal PHY with Inochi's patches
> on SG2000, the above "Link detected: yes" is actually without cable
> inserted.
> 

Interesting, I have tested this on my Huashan Pi. The link detected
switch to "no" after I pull out the cable. I wonder the test step
on your board.

Regards,
Inochi