Add Ethernet and PDMA support to OrangePi RV2 board
Subsystems (5)
cover Add Ethernet and PDMA support to OrangePi RV2 board
From: Michael Opdenacker <[email protected]>
Tested by booting the board through NFS with these additional kernel command line settings:
nfsroot=<server-ip>:<path-on-server>,nfsvers=3,tcp ip=<board-ip>:::::eth0
Michael Opdenacker (2):
riscv: dts: spacemit: add Ethernet and PDMA to OrangePi RV2
net: spacemit: compile k1_emac driver as built-in by default
.../boot/dts/spacemit/k1-orangepi-rv2.dts | 50 +++++++++++++++++++ drivers/net/ethernet/spacemit/Kconfig | 2 +- 2 files changed, 51 insertions(+), 1 deletion(-)
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
PATCH 1/2 riscv: dts: spacemit: add Ethernet and PDMA to OrangePi RV2
From: Michael Opdenacker <[email protected]>
Aligning with k1-bananapi-f3.dts
--- .../boot/dts/spacemit/k1-orangepi-rv2.dts | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+)
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +50 -0
@@ -33,6 +33,56 @@ led1 { }; }; +ð0 { + phy-handle = <&rgmii0>; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac0_cfg>; + rx-internal-delay-ps = <0>; + tx-internal-delay-ps = <0>; + status = "okay"; + + mdio-bus { + #address-cells = <0x1>; + #size-cells = <0x0>; + + reset-gpios = <&gpio K1_GPIO(110) GPIO_ACTIVE_LOW>; + reset-delay-us = <10000>; + reset-post-delay-us = <100000>; + + rgmii0: phy@1 { + reg = <0x1>; + }; + }; +}; + +ð1 { + phy-handle = <&rgmii1>; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac1_cfg>; + rx-internal-delay-ps = <0>; + tx-internal-delay-ps = <250>; + status = "okay"; + + mdio-bus { + #address-cells = <0x1>; + #size-cells = <0x0>; + + reset-gpios = <&gpio K1_GPIO(115) GPIO_ACTIVE_LOW>; + reset-delay-us = <10000>; + reset-post-delay-us = <100000>; + + rgmii1: phy@1 { + reg = <0x1>; + }; + }; +}; + +&pdma { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_2_cfg>;
Re: [PATCH 1/2] riscv: dts: spacemit: add Ethernet and PDMA to OrangePi RV2
Hi Michael,
Quoted 4 lines · On 10:02 Fri 17 Oct , [email protected] wrote:
From: Michael Opdenacker <[email protected]>
Aligning with
k1-bananapi-f3.dts
The DTS change looks good, but the commit message is kind of obscure and unclear, I'd like to have an explict brief description for what have done in the patch, without people looking at the actual DT code, although in this case the title already says about it, but we could still give slightly more info/context:
The OrangePi RV2 board ships two RGMII ethernet ports with each has an external Motorcomm YT8531C PHY attached, the PHY use gpio for the reset pin control.
Enable PDMA for OrangePi RV2 board which provided by SpacemiT K1-based SoC.
Quoted 1 line
Signed-off-by Michael Opdenacker <[email protected]>
Signature · 1 line
Yixun Lan (dlan)
Re: [PATCH 1/2] riscv: dts: spacemit: add Ethernet and PDMA to OrangePi RV2
In reply to [email protected]Hi Michael,
Thank you. I had meant to do this after v6.18-rc1 (which is now), but I didn't have this hardware to test.
Quoted 14 lines · On 10/17/25 18:02, [email protected] wrote:
From: Michael Opdenacker <[email protected]>
Aligning with
k1-bananapi-f3.dtsSigned-off-by Michael Opdenacker <[email protected]>--- .../boot/dts/spacemit/k1-orangepi-rv2.dts | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+)arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +0
-0
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts led1 { · line 36
Quoted 4 lines
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +1
-0@@ -33,6 +33,56 @@ led1 { }; }; +ð0 {
Please add eth0 and eth1 to /aliases so that U-Boot, udev, ... can recognize them. This is used by U-Boot to set the mac-address to the same value used in booting, and by (systemd) udev to set the interface name.
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts led1 { · line 42
Quoted 6 lines
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +6
-0+ phy-handle = <&rgmii0>; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac0_cfg>; + rx-internal-delay-ps = <0>; + tx-internal-delay-ps = <0>;
The hardware design of OPI-RV2 is not the same as BPI-F3, so the parameters here deserves some scruitiny. Same for eth1 below.
I would appreciate at least iperf TCP tests in both directions on both ethernet ports. The expected speed should be at least 940 Mbit/sec - if it's much lower than that something is wrong.
Thanks,
Vivian "dramforever" Wang
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Re: [PATCH 1/2] riscv: dts: spacemit: add Ethernet and PDMA to OrangePi RV2
Quoted 9 lines · Vivian Wang
[...]
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts led1 { · line 42
Quoted 6 lines
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +6
-0+ phy-handle = <&rgmii0>; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac0_cfg>; + rx-internal-delay-ps = <0>; + tx-internal-delay-ps = <0>;The hardware design of OPI-RV2 is not the same as BPI-F3, so the parameters here deserves some scruitiny. Same for eth1 below.
(Apparently my spelling deserves scrutiny as well. Oh well.)
Quoted 3 lines
I would appreciate at least iperf TCP tests in both directions on both ethernet ports. The expected speed should be at least 940 Mbit/sec - if it's much lower than that something is wrong.
Okay so this is not *necessarily* a problem, but just for context...
If you look at the DTS files provided by SpacemiT [1] you'd think the OPI-RV2 also uses RTL8211F Ethernet PHYs. It does not. The schematics (linked on the board main page [2]) says it uses Motorcomm YT8531C.
This doesn't mean that your DTS is wrong (because we don't write the id here when the PHY-sent one is correct), but I hope you understand that what I'm worried is that the electrical characteristics have been changed since they have changed the board design. This is why I think actually taking the time to check the delay parameters would be a good idea.
And yes, it would not be surprising if the parameters for BPI-F3 also works completely reliably for OPI-RV2. The delay tuning has quite a bit of margin for wiggle room.
Thanks,
Vivian "dramforever" Wang
[1]: https://github.com/spacemit-com/linux-k1x/blob/k1/arch/riscv/boot/dts/spacemit/k1-x_orangepi-rv2.dts
[2]: http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-Pi-RV2.html
Re: [PATCH 1/2] riscv: dts: spacemit: add Ethernet and PDMA to OrangePi RV2
In reply to Vivian WangHi Vivian
Thanks for the guidance and help!
Quoted 4 lines · Vivian Wang
Hi Michael,
Thank you. I had meant to do this after v6.18-rc1 (which is now), but I didn't have this hardware to test.
Happy to help testing, if you have code to share :)
Quoted 19 lines · On 10/17/25 18:02, [email protected] wrote:
Quoted 17 lines
From: Michael Opdenacker <[email protected]>
Aligning with
k1-bananapi-f3.dtsSigned-off-by Michael Opdenacker <[email protected]>--- .../boot/dts/spacemit/k1-orangepi-rv2.dts | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+)arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +0
-0@@ -33,6 +33,56 @@ led1 { }; };
Quoted 4 lines
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts led1 { · line 36
Quoted 1 line
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +1
-0+ð0 {Please add eth0 and eth1 to /aliases so that U-Boot, udev, ... can recognize them. This is used by U-Boot to set the mac-address to the same value used in booting, and by (systemd) udev to set the interface name.
Done. I'll submit a V2 soon.
Quoted 10 lines
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts led1 { · line 42
Quoted 7 lines
arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts +6
-0+ phy-handle = <&rgmii0>; + phy-mode = "rgmii-id"; + pinctrl-names = "default"; + pinctrl-0 = <&gmac0_cfg>; + rx-internal-delay-ps = <0>; + tx-internal-delay-ps = <0>;The hardware design of OPI-RV2 is not the same as BPI-F3, so the parameters here deserves some scruitiny. Same for eth1 below.
Quoted 3 lines
I would appreciate at least iperf TCP tests in both directions on both ethernet ports. The expected speed should be at least 940 Mbit/sec - if it's much lower than that something is wrong.
Fortunately, the results are good. They are even better than the ones from the vendor kernel in OrangePi OS 😂. I'll share the results in my V2 cover letter.
Thanks again
Michael.
Signature · 4 lines
Michael Opdenacker Root Commit Yocto Project and OpenEmbedded Training course - Learn by doing: https://rootcommit.com/training/yocto/
PATCH 2/2 net: spacemit: compile k1_emac driver as built-in by default
In reply to [email protected]From: Michael Opdenacker <[email protected]>
Supports booting boards on NFS filesystems, without going through an initramfs.
--- drivers/net/ethernet/spacemit/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/spacemit/Kconfig +1 -1
@@ -18,7 +18,7 @@ config SPACEMIT_K1_EMAC depends on ARCH_SPACEMIT || COMPILE_TEST depends on MFD_SYSCON depends on OF - default m if ARCH_SPACEMIT + default y if ARCH_SPACEMIT select PHYLIB help This driver supports the Ethernet MAC in the SpacemiT K1 SoC.
Re: [PATCH 2/2] net: spacemit: compile k1_emac driver as built-in by default
Quoted 5 lines · On Fri, 17 Oct 2025 at 12:03, <[email protected]> wrote:
From: Michael Opdenacker <[email protected]>
Supports booting boards on NFS filesystems, without going through an initramfs.
Please don't do this. If we build in every ethernet driver that might be used to boot from NFS we'll end up with almost every driver built-in and huge kernels. If you need this there is nothing preventing you from building the driver in, but please don't bloat defconfig kernels for everyone else.
/Emil
Re: [PATCH 2/2] net: spacemit: compile k1_emac driver as built-in by default
Hi Emil
Thanks for the review!
Quoted 10 lines · Emil Renner Berthing
Quoted 4 lines · On Fri, 17 Oct 2025 at 12:03, <[email protected]> wrote:
From: Michael Opdenacker <[email protected]>
Supports booting boards on NFS filesystems, without going through an initramfs.
Please don't do this. If we build in every ethernet driver that might be used to boot from NFS we'll end up with almost every driver built-in and huge kernels. If you need this there is nothing preventing you from building the driver in, but please don't bloat defconfig kernels for everyone else.
Understood. You have a point. It's not really a problem to customize kernel configuration for each board as you said. So, please forget this particular patch :)
Cheers
Michael.
Signature · 10 lines
Michael Opdenacker Root Commit Embedded Linux Training and Consulting https://rootcommit.com _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv