[Differential] D40712: support for rockchip rk3308

From: titus_edc.ro (Titus Manea) <phabric-noreply_at_FreeBSD.org>
Date: Wed, 21 Jun 2023 21:48:04 UTC
titus_edc.ro created this revision.
titus_edc.ro added a reviewer: arm64.
Herald added a reviewer: andrew.
Herald added a reviewer: andrew.
Herald added subscribers: andrew, emaste.
Herald added a reviewer: manu.
Herald added a reviewer: manu.
titus_edc.ro requested review of this revision.

REVISION 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 <https://drive.google.com/file/d/16jwXtRo7bmHexh-VTz6OdjV2fkH4IHgX/view>
  disk layout is similar to other rockchip sbcs, you need  16MB of empty space before the first/efi partition

REVISION DETAIL
  https://reviews.freebsd.org/D40712

AFFECTED FILES
  sys/arm64/conf/std.rockchip
  sys/arm64/rockchip/clk/rk3308_cru.c
  sys/arm64/rockchip/if_dwc_rk.c
  sys/arm64/rockchip/rk_grf.c
  sys/arm64/rockchip/rk_pinctrl.c
  sys/arm64/rockchip/rk_pwm.c
  sys/arm64/rockchip/rk_spi.c
  sys/arm64/rockchip/rk_tsadc.c
  sys/arm64/rockchip/rk_usb2phy.c
  sys/conf/files
  sys/conf/files.arm64
  sys/dev/extres/regulator/regulator_pwm.c
  sys/dev/extres/regulator/regulator_pwm.h

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: titus_edc.ro, #arm64, andrew, manu
Cc: emaste, freebsd-arm-list, andrew