Need help running FreeBSD aarch64 on Nanopi R2S-Plus

well in the more current u-boot of 2025-04 and dtb for rk3328-nanopi-r2s-plus
the 2nd NIC is disabled (scroll down)
Code:
    ethernet@ff540000 {
        compatible = "rockchip,rk3328-gmac";
        reg = <0x00 0xff540000 0x00 0x10000>;
        interrupts = <0x00 0x18 0x04>;
        interrupt-names = "macirq";
        clocks = <0x02 0x64 0x02 0x57 0x02 0x58 0x02 0x5a 0x02 0x59 0x02 0x96 0x02 0xdf>;
        clock-names = "stmmaceth\0mac_clk_rx\0mac_clk_tx\0clk_mac_ref\0clk_mac_refout\0aclk_mac\0pclk_mac";
        resets = <0x02 0x63>;
        reset-names = "stmmaceth";
        rockchip,grf = <0x3a>;
        tx-fifo-depth = <0x800>;
        rx-fifo-depth = <0x1000>;
        snps,txpbl = <0x04>;
        status = "okay";
        assigned-clocks = <0x02 0x64 0x02 0x66>;
        assigned-clock-parents = <0x50 0x50>;
        clock_in_out = "input";
        phy-mode = "rgmii";
        phy-supply = <0x1c>;
        pinctrl-0 = <0x51>;
        pinctrl-names = "default";
        snps,aal;
        phy-handle = <0x52>;
        tx_delay = <0x24>;
        rx_delay = <0x18>;

        mdio {
            compatible = "snps,dwmac-mdio";
            #address-cells = <0x01>;
            #size-cells = <0x00>;

            ethernet-phy@1 {
                reg = <0x01>;
                pinctrl-0 = <0x53>;
                pinctrl-names = "default";
                reset-assert-us = <0x2710>;
                reset-deassert-us = <0xc350>;
                reset-gpios = <0x29 0x12 0x01>;
                phandle = <0x52>;
            };
        };
    };

    ethernet@ff550000 {
        compatible = "rockchip,rk3328-gmac";
        reg = <0x00 0xff550000 0x00 0x10000>;
        rockchip,grf = <0x3a>;
        interrupts = <0x00 0x15 0x04>;
        interrupt-names = "macirq";
        clocks = <0x02 0x54 0x02 0x53 0x02 0x53 0x02 0x55 0x02 0x95 0x02 0xde 0x02 0x56>;
        clock-names = "stmmaceth\0mac_clk_rx\0mac_clk_tx\0clk_mac_ref\0aclk_mac\0pclk_mac\0clk_macphy";
        resets = <0x02 0x62>;
        reset-names = "stmmaceth";
        phy-mode = "rmii";
        phy-handle = <0x54>;
        tx-fifo-depth = <0x800>;
        rx-fifo-depth = <0x1000>;
        snps,txpbl = <0x04>;
        clock_in_out = "output";
        status = "disabled";

        mdio {
            compatible = "snps,dwmac-mdio";
            #address-cells = <0x01>;
            #size-cells = <0x00>;

            ethernet-phy@0 {
                compatible = "ethernet-phy-id1234.d400\0ethernet-phy-ieee802.3-c22";
                reg = <0x00>;
                clocks = <0x02 0x56>;
                resets = <0x02 0x64>;
                pinctrl-names = "default";
                pinctrl-0 = <0x55 0x56>;
                phy-is-integrated;
                phandle = <0x54>;
            };
        };
    };
 
well in the more current u-boot of 2025-04 and dtb for rk3328-nanopi-r2s-plus
the 2nd NIC is disabled (scroll down)
Code:
    ethernet@ff540000 {
        compatible = "rockchip,rk3328-gmac";
        reg = <0x00 0xff540000 0x00 0x10000>;
        interrupts = <0x00 0x18 0x04>;
        interrupt-names = "macirq";
        clocks = <0x02 0x64 0x02 0x57 0x02 0x58 0x02 0x5a 0x02 0x59 0x02 0x96 0x02 0xdf>;
        clock-names = "stmmaceth\0mac_clk_rx\0mac_clk_tx\0clk_mac_ref\0clk_mac_refout\0aclk_mac\0pclk_mac";
        resets = <0x02 0x63>;
        reset-names = "stmmaceth";
        rockchip,grf = <0x3a>;
        tx-fifo-depth = <0x800>;
        rx-fifo-depth = <0x1000>;
        snps,txpbl = <0x04>;
        status = "okay";
        assigned-clocks = <0x02 0x64 0x02 0x66>;
        assigned-clock-parents = <0x50 0x50>;
        clock_in_out = "input";
        phy-mode = "rgmii";
        phy-supply = <0x1c>;
        pinctrl-0 = <0x51>;
        pinctrl-names = "default";
        snps,aal;
        phy-handle = <0x52>;
        tx_delay = <0x24>;
        rx_delay = <0x18>;

        mdio {
            compatible = "snps,dwmac-mdio";
            #address-cells = <0x01>;
            #size-cells = <0x00>;

            ethernet-phy@1 {
                reg = <0x01>;
                pinctrl-0 = <0x53>;
                pinctrl-names = "default";
                reset-assert-us = <0x2710>;
                reset-deassert-us = <0xc350>;
                reset-gpios = <0x29 0x12 0x01>;
                phandle = <0x52>;
            };
        };
    };

    ethernet@ff550000 {
        compatible = "rockchip,rk3328-gmac";
        reg = <0x00 0xff550000 0x00 0x10000>;
        rockchip,grf = <0x3a>;
        interrupts = <0x00 0x15 0x04>;
        interrupt-names = "macirq";
        clocks = <0x02 0x54 0x02 0x53 0x02 0x53 0x02 0x55 0x02 0x95 0x02 0xde 0x02 0x56>;
        clock-names = "stmmaceth\0mac_clk_rx\0mac_clk_tx\0clk_mac_ref\0aclk_mac\0pclk_mac\0clk_macphy";
        resets = <0x02 0x62>;
        reset-names = "stmmaceth";
        phy-mode = "rmii";
        phy-handle = <0x54>;
        tx-fifo-depth = <0x800>;
        rx-fifo-depth = <0x1000>;
        snps,txpbl = <0x04>;
        clock_in_out = "output";
        status = "disabled";

        mdio {
            compatible = "snps,dwmac-mdio";
            #address-cells = <0x01>;
            #size-cells = <0x00>;

            ethernet-phy@0 {
                compatible = "ethernet-phy-id1234.d400\0ethernet-phy-ieee802.3-c22";
                reg = <0x00>;
                clocks = <0x02 0x56>;
                resets = <0x02 0x64>;
                pinctrl-names = "default";
                pinctrl-0 = <0x55 0x56>;
                phy-is-integrated;
                phandle = <0x54>;
            };
        };
    };
aaah, the one I have compiled from friendlyelec source only has ethernet@ff540000. definitely missing ethernet@ff550000
 
here is a dts file pulled from u-boot (2025-04)
compile it to dtb and put it in /boot/dtb/rockchip/test.dtb
then in loader.conf put this

mydtb_name="/boot/dtb/rockchip/test.dtb"
mydtb_load="YES"
mydtb_type="dtb"

reboot
see what you get

LE. enable the second gmac first cause it's disabled now
 

Attachments

here is a dts file pulled from u-boot (2025-04)
compile it to dtb and put it in /boot/dtb/rockchip/test.dtb
then in loader.conf put this

mydtb_name="/boot/dtb/rockchip/test.dtb"
mydtb_load="YES"
mydtb_type="dtb"

reboot
see what you get

LE. enable the second gmac first cause it's disabled now
thank you for helping me modifying the dts file. I will report back once I tested the dtb
 
do
dtc -I dtb file.dtb >file.dts
edit it with your fav text editor
dtc -I dts file.dts >file.dtb
copy it over the original and you are done
This is how I do a temp fix too.

Use DTC compiler to decompile active dtb file to a dts file (backup original first). Then use editor to fixup dts file and save out. Then recompile to dtb. Reboot.

Little primer on another platform.

After verifying my temp fix works I build a desktop overlay for the fix.
That way you can upgrade without worrying about original dtb being overwrote during upgrade.
 
here is a dts file pulled from u-boot (2025-04)
compile it to dtb and put it in /boot/dtb/rockchip/test.dtb
then in loader.conf put this

mydtb_name="/boot/dtb/rockchip/test.dtb"
mydtb_load="YES"
mydtb_type="dtb"

reboot
see what you get

LE. enable the second gmac first cause it's disabled now
this file behave similar with official u-boot. it is stuck at clock problem.
 

Attachments

  • 1760664682291.png
    1760664682291.png
    346 KB · Views: 15
Good news! I am almost there, just need correcting syscon and grf driver handle. Bad news, I do not posses full knowledge about this. I just copying what make sense in armbian.dts.
 

Attachments

  • 1760666644960.png
    1760666644960.png
    64.1 KB · Views: 17
i think i have an idea
somehow the simple-mfd driver loads instead the rk-grf driver
edit the dts and at syscon@ff100000
change compatible = "rockchip,rk3328-grf\0syscon\0simple-mfd";
to compatible = "rockchip,rk3328-grf";
rebuild the dtb and reboot
 
can you attach the whole dmesg / kernel boot messages ?
both gmacs use the same grf node so its weird the first gets it an 2nd doesnt
I forgot to bring it with me this weekend.
i think i have an idea
somehow the simple-mfd driver loads instead the rk-grf driver
edit the dts and at syscon@ff100000
change compatible = "rockchip,rk3328-grf\0syscon\0simple-mfd";
to compatible = "rockchip,rk3328-grf";
rebuild the dtb and reboot
I will try this solution tomorrow, and report back with complete dmesg
 
After updating the dts file, FreeBSD turned into panic mode. patched-v1 contains syscon and grf problem, and patched v2 constains kernel panel after changing compatible = "rockchip,rk3328-grf";
 

Attachments

i think i have an idea
somehow the simple-mfd driver loads instead the rk-grf driver
edit the dts and at syscon@ff100000
change compatible = "rockchip,rk3328-grf\0syscon\0simple-mfd";
to compatible = "rockchip,rk3328-grf";
rebuild the dtb and reboot
Actually I just need to replace incorrect grf to 0x22 (this address refer to syscon@ff110), and Voila!
The last thing that I need to fix is uboot and speed test ofc. How to prevent this sdcard detected as mmc1 (this will lead to undetectable rootfs) and supposed to be mmc2?

EDIT: the port's led is turned on, but the information remained no carrier. There is some warning about ure0: ure0: timeout waiting for phy to stabilize. A few second later, FreeBSD give up the phy.

usbconfig report:

1760853668633.png
 

Attachments

  • 1760843990213.png
    1760843990213.png
    88.3 KB · Views: 16
why to you load the dtb as an overlay ?
just use the method
mydtb_name="/boot/dtb/rockchip/rk3328-nanopi-r2s-new.dtb"
mydtb_load="YES"
mydtb_type="dtb"
and get rid of the overlays
assuming this rk3328-nanopi-r2s-new.dtb is what i posted
probably the overlay causes phandle mismatches (they should not happen normaly) like grf pointing to the wrong stuff
 
why to you load the dtb as an overlay ?
just use the method
mydtb_name="/boot/dtb/rockchip/rk3328-nanopi-r2s-new.dtb"
mydtb_load="YES"
mydtb_type="dtb"
and get rid of the overlays
assuming this rk3328-nanopi-r2s-new.dtb is what i posted
probably the overlay causes phandle mismatches (they should not happen normaly) like grf pointing to the wrong stuff
adding overlay to loader.conf did not change anything since u-boot already handle it.
also does ure0 work in a normal pc ?
these ports work normally in original firmware. my current guess is incorrect dts somewhere nearby ethernet@ff550
 
Back
Top