diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..af1527a --- /dev/null +++ b/docs/index.md @@ -0,0 +1,7 @@ +# Rockchip bare metal reference +This is a resource for bare-metal bringup on RK3399 and RK3588-based devices. + +I learned all this and make all this documentation during my time working for FUTO doing bringup for our unreleased FUBS project. + +For RK3399 bringup, I initially wrote everything in C before porting it to our own language, as I was still learning and figuring things out. +For RK3588 bringup, our system was robust enough to to bringup without a separate C implementation. diff --git a/docs/ref.md b/docs/ref.md new file mode 100644 index 0000000..7a87419 --- /dev/null +++ b/docs/ref.md @@ -0,0 +1,19 @@ +# RK3588 +- edk2 uefi monorepo: https://gitlab.com/rk3588_linux/rk/uefi-monorepo +Lots of early bare-metal rk3588 code written by rockchip employees, good reference for when the TRM is missing info +- rkdocs: https://github.com/axlrose/rkdocs +- TRM/Datasheet: https://github.com/FanX-Tek/rk3588-TRM-and-Datasheet +- RK3588 Base: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3588-base.dtsi pinctrl https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi + +## RK3399 +- RK3399 TRM v1.4: https://opensource.rock-chips.com/images/e/ee/Rockchip_RK3399TRM_V1.4_Part1-20170408.pdf +- RK3399 TRM V1.3 Part2: https://rockchip.fr/Rockchip%20RK3399%20TRM%20V1.3%20Part2.pdf +- 2022 Pinebook Pro main board schematic: https://files.pine64.org/doc/PinebookPro/pinebookpro_schematic_v21a_20220419.pdf +- Tool to decode exception syndrome register: https://esr.arm64.dev/ +- Intro to eDP: https://www.vesa.org/wp-content/uploads/2010/12/DisplayPort-DevCon-Presentation-eDP-Dec-2010-v3.pdf +- eDP technical overview: https://www.vesa.org/wp-content/uploads/2011/01/ICCE-Presentation-on-VESA-DisplayPort.pdf +- DisplayPort Specification (covers DPCD): https://glenwing.github.io/docs/DP-1.1.pdf +- rk3399 bootrom analysis: https://github.com/trebisky/Rockchip/blob/4c4623e3df37f01d1d1ae0131fec5bc75f9e8463/bootrom/bootrom.txt +- arm-trusted-firmware: https://github.com/ARM-software/arm-trusted-firmware +- Dynamic Memory Controller: https://www.kernel.org/doc/Documentation/devicetree/bindings/devfreq/rk3399_dmc.txt +- ARM GIC architecture specification: https://developer.arm.com/documentation/ihi0069/latest/ diff --git a/docs/rk3399-disp.md b/docs/rk3399-disp.md new file mode 100644 index 0000000..4a741f2 --- /dev/null +++ b/docs/rk3399-disp.md @@ -0,0 +1,47 @@ +# VOP +- 6 layers supported +- Background color +- 4 Window Layers +- Hardware Cursor Layer +- Hardware alpha blending + +## VOP Setup process +- Select reference clock +- Set VOP to L or B (`grf.edp_lcdc_sel`) +- Setup and lock PLL +- Set to standby mode +- Enable desired interface (such as eDP) and disable unneeded interfaces +- Configure display settings +- Configure window layers settings + - Width, height + - Porch offsets + - Enable the window(s) + - Set format (eg, ARGB888) + - Set framebuffer address (win0_yrgb_mst) +- Set reg_cfg_done to `0b1`. +- The framebuffer is fetched over AXI from DDR. + +## eDP TX Setup process +- Setup reference clock +- Wait for HDP +- Set SW_FUNC_EN_N to normal operation +- dp_pd = 0 +- Reset PLL +- Wait until PLL is locked +- Setup AUX channel + - Enable AUX AUX_FUNC_EN_N + - Clear AUX interrupts + - Disable AUX, set aux defer setting, enable AUX + - Set AUX channel module to normal func_en_2 +- Enable all function and video modes (func_en_1) +- Perform a AUX DPCD transfer to get display info (`aux_` registers) + - Get the display resolution + - Get the lane count and link rate + - Set `link_bw_set` and `lane_count_set` + - You can hardcode these values rather than implementing AUX DPCD transfers +- Link training + - Link rates, clock recovery, etc + - This can be skipped +- Make sure eDP clock is on +- Disable video mute +- Enable video output