Page MenuHomeFreeBSD

support for rockchip rk3308
Needs RevisionPublic

Authored by titus_edc.ro on Jun 21 2023, 9:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 13 2025, 10:20 AM
Unknown Object (File)
Oct 23 2025, 7:59 AM
Unknown Object (File)
Oct 23 2025, 7:59 AM
Unknown Object (File)
Oct 22 2025, 11:41 PM
Unknown Object (File)
Oct 15 2025, 10:33 PM
Unknown Object (File)
Sep 18 2025, 12:31 PM
Unknown Object (File)
Sep 10 2025, 5:54 PM
Unknown Object (File)
Sep 10 2025, 3:29 AM

Details

Reviewers
andrew
manu
Group Reviewers
arm64
Summary

rockchip-s is probably the cheapest arm64 board
usb, sdcard, ethernet, uart work
most of the changes are ported from linux and openbsd
the rk3308_cru.c file is basically generated with a set of conversion cpp macros (convert linux macros to freebsd macros)
the regulator-pwm is crude and only supports continuous mode
setting cpu frequency works
temperature reading works
ethernet media autoselect does not work
with older u-boot 2017 ethernet does not work (phy regulator seems down)

Test Plan

you need to build u-boot from git with rock-pi-s-rk3308_defconfig + EFI support
preloader and trust.img are from rockchip (there is no public source code for bl31), then use rk-loaderimage (ports) to convert u-boot-dtb.bin into u-boot.img
i built a 13.x kernel and it works (all the files in the diff are from -CURRENT but they are mostly the same as 13.2 )
u-boot binaries available here link
disk layout is similar to other rockchip sbcs, you need 16MB of empty space before the first/efi partition

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

lwhsu added inline comments.
sys/arm64/conf/std.rockchip
10

Sort this list and remove the extra white line?

sys/arm64/rockchip/clk/rk3308_cru.c
1

Add a copyright header?

sys/arm64/rockchip/if_dwc_rk.c
2

we don't use BSD-2-Clause-FreeBSD anymore, just BSD-2-Clause is fine.

sys/arm64/rockchip/rk_pwm.c
2

BSD-2-Clause

sys/arm64/rockchip/rk_spi.c
2

BSD-2-Clause

sys/conf/files.arm64
693

sort the list.

sys/dev/extres/regulator/regulator_pwm.c
1

Please add a copyright header.

sys/dev/extres/regulator/regulator_pwm.h
1

Please add a copyright header.

manu requested changes to this revision.Jun 22 2023, 7:41 AM

I've added a few comment but please split this in multiple commits and reviews (one per device, one for the clocks, on for pwm regulators etc ...).

sys/arm64/rockchip/if_dwc_rk.c
163

Remove this empty line.

186

Can't find any reference to the "rockchip,rk3308-mac" binding. Whhy is this needed ?

358

Missed a empty line before function starts.

470

Debug leftover ?

528

Please revert this change

678

Why ?

sys/arm64/rockchip/rk_pwm.c
402

Why ?

sys/arm64/rockchip/rk_spi.c
95

Add the new compat data without removing some existing ones please.

478

Why ?

sys/arm64/rockchip/rk_tsadc.c
265

Extra line.

405

Extra compat data.

This revision now requires changes to proceed.Jun 22 2023, 7:41 AM
sys/arm64/rockchip/if_dwc_rk.c
186

It looks like it's in the u-boot dts

sys/arm64/rockchip/rk_spi.c
95

It looks like there is white space at the end of the line.

sys/dev/extres/regulator/regulator_pwm.c
1–2

New files shouldn't add $FreeBSD$.
It should probably also be a separate review as it's not rk3308 specific.