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)
Tue, Jun 11, 5:35 AM
Unknown Object (File)
Sun, Jun 9, 11:48 AM
Unknown Object (File)
Apr 9 2024, 9:40 PM
Unknown Object (File)
Dec 25 2023, 5:16 PM
Unknown Object (File)
Dec 20 2023, 7:52 AM
Unknown Object (File)
Dec 14 2023, 11:04 AM
Unknown Object (File)
Dec 13 2023, 4:07 AM
Unknown Object (File)
Nov 28 2023, 5:59 PM

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.