Running FreeBSD on Radxa Rock 3C RK3566 board

It's funny but it works.

I built Pantheon DE from Elementary OS thanks to this tutorial
https://codeberg.org/olivierd/freebsd-ports-elementary/wiki ,
But I did it on ARM RockChip 3588 OrangePi 5 Plus on FreeBSD 14.0-RELEASE


photo_2023-11-15_12-05-57.jpg
 
eqos
it still not very well tested and it has at least one bug
ifconfig eqos0 down
ifconfig eqos0 up wont work again, interface stops transmitting and you get lots of watchdog timeouts

LE: added patch for ifconfig up/down fsckup (clean dma descriptors)
uploaded single zip with more fixes (broke dma burst length :( )
 

Attachments

Last edited:
hacked an ahci driver for the opi3b
ahci0: <DesignWare AHCI controller> mem 0xfc800000-0xfc800fff irq 9 on ofwbus0
ahci0: AHCI v1.30 with 1 6Gbps ports, Port Multiplier supported with FBS

will try a sata nvme disk tomorrow
i have a 16GB one that i pulled out of an old hp thin client
i bought 2 128GB 2nd hand nvme ssds for $10 each
one pcie (sk hynix), one sata (sandisk) both tlc
both have roughly 3500 hours of running
wonder if it works (probably not) :)
 
both have roughly 3500 hours of running
wonder if it works (probably not)
That is only 145 days of running. They will be fine.

What I see is small sized NVMe are cheap as people upgrade.
256GB NVMe 'Open box' for $20.
Dell/HP ect charge so much for bigger drives many upgrade zero hour drives..

I hope to start Rock3A testing tomorrow...Expect many stupid questions.
 
ok, after a bit of fighting
Code:
[root@generic ~]# dmesg|grep ahci
ahci0: <DesignWare AHCI controller> mem 0xfc800000-0xfc800fff irq 9 on ofwbus0
ahci0: Forcing PI to 1 ports (mask = 1)
ahci0: AHCI v1.30 with 1 6Gbps ports, Port Multiplier supported with FBS
ahci0: quirks=0xc0000<FORCE_PI,RESTORE_CAP>
ahcich0: <AHCI channel> at channel 0 on ahci0
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
[root@generic ~]# dmesg|grep ada0
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <SanDisk SDSA6MM-016G-1006 U221006> ACS-2 ATA SATA 3.x device
ada0: Serial Number 144154404207
ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 512bytes)
ada0: Command Queueing enabled
ada0: 15272MB (31277232 512 byte sectors)
the magic
ahci->quirks = AHCI_Q_FORCE_PI|AHCI_Q_RESTORE_CAP;
this quirks are default on linux ?#@#!
 
honestly i don't use these boards for anything (except for hacking)
i have one (nano pi h3) which i used as a print server because the built in network server in one of my printers died and i could power it from the printer's usb port (has one to put jobs/fonts thru a usb stick) but in the end the priner got other problems and was retired
the other ones i just hack.
i also have 2 amlogic boards which i want to add support to but that will be a lot of work because there is nothing to start from
s905x and s805cc i think
 
i need to merge the changes i made to ahci_generic.c because my "driver" has nothing specific to rk/dw just a broader implementation of a generic fdt ahci
enable all clocks, phys, de-assert resets

/sys/conf/files.arm64:dev/ahci/ahci_dw_fdt.c optional fdt soc_rockchip_rk3568
 

Attachments

no idea about WOL, eqos has no support in the driver for it or other kind of power management
SleepWalker I'll post the eqos patches later today
Hi, guys!
I have a few thoughts on WOL, for eqos.

1) This should be implemented at a fairly low level.
At the UEFI level, approximately the same as in the BIOS of such vendors as HP or DELL for AMD64.
It’s just that in UEFI a checkbox may appear to enable or disable WOL support.

2) There is at least one TianoCore EDKII UEFI repository on github in which there is an implementation
of GMAC 4.2 and you can study it. In my opinion, this is some kind of board on SoC from Qualcomm,
but I could be wrong,

I came across a link to this repo in the telegram group https://t.me/UEFIonRockchip
 
i need to merge the changes i made to ahci_generic.c because my "driver" has nothing specific to rk/dw just a broader implementation of a generic fdt ahci
enable all clocks, phys, de-assert resets

/sys/conf/files.arm64:dev/ahci/ahci_dw_fdt.c optional fdt soc_rockchip_rk3568

Hi covacat !

Thanks for your work.

It's good that sata(ahci) support has appeared in FDT mode on RK356x.
Previously, SATA worked only in ACPI mode and only on those devices for which there is support for SATA in UEFI.
I have two RK3568 devices on which I can test: Radxa E25 and FriendlyELEC P2.
I started with E25 and I had to search for a very long time why nothing was working for me.
I was only able to figure out yesterday that the reason was an insufficiently powerful power supply.
Should I use usb-c docking station to have both power supply and USB UART TTL console.
But now I have assembled a reliably working stand and everything works in the vendor’s Linux.
The problem now is the correct DTB.
The vendor's Linux uses a non-Mainline kernel and the PCIe description rules are old, I cannot use them.
With DTS FreeBSD 14.0-RELEASE, SATA works for me, but both Ethernet RTL8125 2.5 Gbps do not work. In my old DTS from 13.2 with corrections
PCIe and both Ethernet work but SATA does not work.
I need to analyze the difference and look at the DTS in 14.0-STABLE. All this just takes time.

Thanks for your work.

It opens up many possibilities for FreeBSD users and enthusiasts. I really want to increase their number.
And contribute. I want to attract the attention of new users and show them all the power, stability and beauty FreeBSD,
and systems built on its basis such as OPNsense and FreeNAS/TrueNAS.
But I want to make this available to hundreds of thousands of very small and cheap devices based on the AARCH64 architecture.

Therefore, I am studying FreeBSD for ARM architecture and looking for any opportunity to increase the number of devices
on this architecture on which FreeBSD can be run with minimal patches.

I want to save novice users from making mistakes when they first try to install,
which is why we use Tianocore UEFI where possible.

Thanks again for your work.
 
on quartz64 and orangepi3b the sata phy is shared with the pcie phy so you have to disable the pcie from dtb before
otherwise probably wont work
also i see that linux support for generic ofw/fdt ahci has support for regulators which i didnt add yet (mine has no additional regulator needs in the dtb) but will add and repost the patch
also ill split current ahci_generic.c in 2 files ahci_gen_acpi.c and ahci_gen_fdt.c otherwise the code will get to ugly
 
Yes thank you, this is what I need.

It's good that the basic code works.
This has already been tested on three devices.
It remains to ensure that PCIe and SATA work together.
I'll try to look at the code for the latest version of Linux.
I also have the opportunity to check on FriendlyELEC.

I need to understand if changes are needed in DTS, but I don't see what changes are missing.
The description of sata1 in my case is simple - ok. (for E25).
On FriendlyELEC in ACPI and SATA and PCIe M.2 NVMe mode work simultaneously.

This gives me hope.
 
look at the sata node and check its phy
if that phy handle is used for another node (pcie) you should disable that node
see also this https://www.forlinx.net/industrial-news/pcie-to-sata-441.html
also from what ive seen in the code a specific combphy can be in usb/sata/pcie modes but only one at a time
on my board one is for usb3 and the other shared sata/pcie

im not 100% sure about this
manual says (bold is mine)
 Multi-PHY0 support one of the following interfaces
 USB3.0 OTG
 SATA0
 Multi-PHY1 support one of the following interfaces
 USB3.0 Host
 SATA1
 QSGMII/SGMII
 Multi-PHY2 support one of the following interfaces
 PCIe2.1
 SATA2
 QSGMII/SGMII

my board rk3566 seem to have only 2 combphys
 
So eqos is DesignWare ethernet interface for both RK3566/68 and RK3588
This will not work on original FreeBSD since RK3588 FreeBSD can only be run in ACPI mode.

Therefore, patches (glue drivers) are needed for some devices.

Needed for eqos and USB2.0. I applied the patches
and it works on Radxa Rock-5A with some limitations (only 1Gbps works so far)

But on NanoPi-R6C,
this does not work and it is not clear where the error is in the eqos driver or in UEFI.

I did the UEFI modification for NanoPi-R6C
(and of course I could have made a mistake somewhere),
and I don’t know who else in the FreeBSD community has this board.

If you are a NanoPi-R6C owner and want to run FreeBSD on NanoPi-R6C,
I'm interested in sharing experiences.
 
it works on Radxa Rock-5A with some limitations
I am really interested in this platform. Basically >ROCK4A>ROCK3A.
I wonder if the Rock3/4 NVMe adapter board works too.
My only concern is price. $100 at min.
We have seen exponential price growth on these three generations of rockchip.
 
I am really interested in this platform. Basically >ROCK4A>ROCK3A.
I wonder if the Rock3/4 NVMe adapter board works too.
My only concern is price. $100 at min.
We have seen exponential price growth on these three generations of rockchip.
you need a special adapter
 
Wow so a different adapter than Rock3/4 and that is the only expansion slot on the whole board.

I will not be paying $100 for that.
Rock3A has more expansion options.
 
It looks like Rock5B has more expansion capabilities.
No adapter needed for NVMe.

Creeping into the Intel Mini-Box price range on that though....
 
Well its been a year and I finally have FreeBSD running on Rock3C with an NVMe for rootdev and microSD for booting.

I used FreeBSD ports tree and made a custom u-boot port for Rock 3C and its defcong.
From that u-boot build I scraped the DTB and used that along with its u-boot.

/usr/ports/sysutils/u-boot-rock-3c/Makefile
Code:
MASTERDIR=    ${.CURDIR}/../u-boot-master

MODEL=        rock-3c
BOARD_CONFIG=    rock-3c-rk3566_defconfig
FAMILY=        rk356X

.include "${MASTERDIR}/Makefile"


I have a problem booting from NVMe and have to run a simple u-boot script on bootup.
boot.scr
sleep 3
pci enum
sleep 2
nvme scan


With u-boot flashed to same microSD. Made MBR scheme/partition just for the file.
EFI scheme works too. I kept ESP/EFI on NVMe and chose MBR for the scipt on card along with u-boot.

With that I have unattended FreeBSD 15-CURRENT booting.

Thank goodness I have some Rock3 working nice. So Rock3e for zero sized board and Rock3c for full sized.
Rock3e with its simplicity works OOB. No PCIe busses to support. Wish it had eMMC socket.

Maybe one day we will see rkdrm for a possible desktop. HDMI for now would be nice.
 
Back
Top