video: rockchip: VOP2 and HDMI output for RK3568
Subsystems (4)
cover video: rockchip: VOP2 and HDMI output for RK3568
U-Boot has no video output support for the RK3568/RK3566 family: the VOP2 display controller found in these SoCs (and newer Rockchip parts) is unsupported, so boards cannot show a boot menu, the UEFI console or any other firmware user interface on a locally attached display, while the vendor firmware and the Linux kernel have long been able to drive it.
This series brings up HDMI output on RK3568 in U-Boot proper so that a plain monitor plus USB keyboard is enough to interact with the firmware, using the NanoPi R5C as the reference board.
The VOP2 driver and the RK3568 HDMI glue were written by Dang Huynh, modelled on the existing VOP support and the Linux driver. On top of that, bring-up on real hardware showed that U-Boot must not rely on the state left behind by earlier boot stages: the probe path is fixed to map the right register base, and the HDMI controller clocks, the PHY reference clock and the PHY analog supplies are now enabled explicitly by the driver instead of assuming the BootROM, TPL or a previous firmware left them on. The final patch enables video output on the NanoPi R5C.
Dang Huynh (4):
video: rockchip: Add VOP2 support
arm: dts: rockchip: rk356x: Prerelocate VOP in U-Boot proper
video: rockchip: Add HDMI support for RK3568
clk: rockchip: rk3568: Use assigned VPLL clock when possible
Daniel Golle (5):
video: rockchip: vop2: fix NULL register base in rk3568 probe
video: rockchip: rk3568: ungate the HDMI controller clocks
video: rockchip: rk3568: bring up the HDMI PHY reference clock
video: rockchip: rk3568: power the HDMI PHY analog supplies
configs: nanopi-r5c: enable HDMI video output
arch/arm/dts/rk356x-u-boot.dtsi | 4 + .../include/asm/arch-rockchip/vop_rk3568.h | 280 ++++++++++ configs/nanopi-r5c-rk3568_defconfig | 4 + drivers/clk/rockchip/clk_rk3568.c | 18 +- drivers/video/rockchip/Makefile | 4 +- drivers/video/rockchip/rk3568_hdmi.c | 125 +++++ drivers/video/rockchip/rk3568_vop.c | 270 +++++++++ drivers/video/rockchip/rk_vop2.c | 520 ++++++++++++++++++ drivers/video/rockchip/rk_vop2.h | 76 +++ 9 files changed, 1299 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/asm/arch-rockchip/vop_rk3568.h create mode 100644 drivers/video/rockchip/rk3568_hdmi.c create mode 100644 drivers/video/rockchip/rk3568_vop.c create mode 100644 drivers/video/rockchip/rk_vop2.c create mode 100644 drivers/video/rockchip/rk_vop2.h
base-commit: ece349ade2973e220f524ce59e59711cc919263f
Signature · 1 line
2.55.0
PATCH 1/9 video: rockchip: Add VOP2 support
From: Dang Huynh <[email protected]>
VOP2 (Video Output Processor v2) is a display controller on Rockchip SoCs. It can be found on RK3566/8 and RK3588.
This commit currently only supports RK3566/8.
--- .../include/asm/arch-rockchip/vop_rk3568.h | 280 ++++++++++ drivers/video/rockchip/Makefile | 3 +- drivers/video/rockchip/rk3568_vop.c | 260 +++++++++ drivers/video/rockchip/rk_vop2.c | 520 ++++++++++++++++++ drivers/video/rockchip/rk_vop2.h | 76 +++ 5 files changed, 1138 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/arch-rockchip/vop_rk3568.h create mode 100644 drivers/video/rockchip/rk3568_vop.c create mode 100644 drivers/video/rockchip/rk_vop2.c create mode 100644 drivers/video/rockchip/rk_vop2.h
arch/arm/include/asm/arch-rockchip/vop_rk3568.h new file +280 -0
@@ -0,0 +1,280 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2024 - 2025 Dang Huynh <[email protected]> +* +* Based on vop_rk3288.h: +* Copyright (c) 2015 Google, Inc +* Copyright 2014 Rockchip Inc. +*/ + +#ifndef _ASM_ARCH_VOP_RK3568_H +#define _ASM_ARCH_VOP_RK3568_H + +struct rk3568_vop_sysctrl { +u32 reg_cfg_done; +u32 version_info; +u32 autogating_ctrl; +u32 win_reg_cfg_done; +u32 axi_ctrl0; +u32 axi_hurry_ctrl0; +u32 axi_hurry_ctrl1; +u32 axi_outstanding_ctrl0; +u32 axi_outstanding_ctrl1; +u32 axi_lut_ctrl; +u32 dsp_en; +u32 dsp_ctrl; +u32 dsp_pol; +u32 pwr_ctrl; +u32 var_freq_ctrl; +u32 mmu_raddr_range; +u32 wb_ctrl0; +u32 wb_xspd; +u32 wb_yrgb_mst; +u32 wb_cbr_mst; +u32 otp_win; +u32 otp_mirr_ctrl; +u32 lut_port_sel; +u32 pwr_stable_ctrl; +u32 status0; +u32 status1; +u32 status2; +u32 status3; +u32 line_flag0; +u32 line_flag1; +u32 line_flag2; +u32 line_flag3; +u32 sys0_intr_en; +u32 sys0_intr_clr; +u32 sys0_intr_status; +u32 sys0_intr_status_raw; +u32 sys1_intr_en; +u32 sys1_intr_clr; +u32 sys1_intr_status; +u32 sys1_intr_status_raw; +u32 port0_intr_en; +u32 port0_intr_clr; +u32 port0_intr_status; +u32 port0_intr_status_raw; +u32 port1_intr_en; +u32 port1_intr_clr; +u32 port1_intr_status; +u32 port1_intr_status_raw; +u32 port2_intr_en; +u32 port2_intr_clr; +u32 port2_intr_status; +u32 port2_intr_status_raw; +u32 port3_intr_en; +u32 port3_intr_clr; +u32 port3_intr_status; +u32 port3_intr_status_raw; +}; + +check_member (rk3568_vop_sysctrl, port3_intr_status_raw,0x00DC ); + +struct rk3568_vop_overlay { +u32 overlay_ctrl; +u32 layer_sel; +u32 port_sel; +}; + +check_member (rk3568_vop_overlay, port_sel,0x0008 ); + +struct rk3568_vop_post { +u32 dsp_ctrl; +u32 mipi_ctrl; +u32 color_ctrl; +u32 reserved2; +u32 lut_reserved[4 ]; +u32 reserved[3 ]; +u32 dsp_bg; +u32 prescan_htimings; +u32 dsp_hact_info; +u32 dsp_vact_info; +u32 scl_factor_yrgb; +u32 scl_ctrl; +u32 dsp_vact_info_f1; +u32 dsp_htotal_hs_end; +u32 dsp_hact_st_end; +u32 dsp_vtotal_vs_end; +u32 dsp_vact_st_end; +u32 dsp_vs_st_end_f1; +u32 dsp_vact_st_end_f1; +}; + +check_member (rk3568_vop_post, dsp_vact_st_end_f1,0x005C ); + +struct rk3568_vop_cluster { +u32 win0_ctrl0; +u32 win0_ctrl1; +u32 win0_ctrl2; +u32 reserved0; +u32 win0_mst_yrgb; +u32 win0_mst_cbcr; +u32 win0_vir; +u32 reserved1; +u32 win0_act_info; +u32 win0_dsp_info; +u32 win0_dsp_st; +u32 win0_dsp_bg; +u32 win0_scl_factor_yrgb; +u32 reserved2; +u32 win0_scl_offset; +u32 win0_transformed_offset; +u32 reserved3[4 ]; +u32 win0_afbcd_output_ctrl; +u32 win0_afbcd_mode; +u32 win0_afbcd_hdr_ptr; +u32 win0_afbcd_vir_width; +u32 win0_afbcd_size; +u32 win0_afbcd_pic_offset; +u32 win0_afbcd_dis_offset; +u32 win0_afbcd_ctrl; +}; + +check_member (rk3568_vop_cluster, win0_afbcd_ctrl,0x006C ); + +struct rk3568_vop_esmart { +u32 esmart_ctrl0; +u32 esmart_ctrl1; +u32 reserved0[2 ]; +u32 esmart_region0_mst_ctl; +u32 esmart_region0_mst_yrgb; +u32 esmart_region0_mst_cbcr; +u32 esmart_region0_vir; +u32 esmart_region0_act_info; +u32 esmart_region0_dsp_info; +u32 esmart_region0_dsp_offset; +u32 reserved1[1 ]; +u32 esmart_region0_scl_ctrl; +u32 esmart_region0_scl_factor_yrgb; +u32 esmart_region0_scl_factor_cbcr; +u32 esmart_region0_scl_offset; +}; + +check_member (rk3568_vop_esmart, esmart_region0_scl_offset,0x003C ); + +enum rockchip_fb_data_format_t { +ARGB8888 =0 , +RGB888 =1 , +RGB565 =2 , +}; + +enum vop_modes { +VOP_MODE_EDP =0 , +VOP_MODE_MIPI , +VOP_MODE_HDMI , +VOP_MODE_LVDS , +VOP_MODE_DP , +}; + +/* OFFSETS */ +#define VOP2_SYSREG_OFFSET 0x0 +#define VOP2_OVERLAY_OFFSET 0x0600 +#define VOP2_POST_OFFSET (n) 0x0c00 + ((n) * 0x100) +#define VOP2_CLUSTER_OFFSET (n) 0x1000 + ((n) * 0x200) +#define VOP2_ESMART_OFFSET (n) 0x1800 + ((n) * 0x200) + +/* System Registers */ +/* REG_CFG_DONE */ +#define M_GLOBAL_REGDONE (1 << 15) +#define M_LOAD_GLOBAL (x) (1 << ((x) & 3)) + +#define V_GLOBAL_REGDONE (x) (((x) & 1) << 15) +#define V_LOAD_GLOBAL (x, y) (((y) & 1) << ((x) & 3)) + +/* VERSION_INFO */ +#define M_FPGA_VERSION (0xffff << 16) +#define M_RTL_VERSION (0xffff) + +/* AUTO_GATING_CTRL */ +#define M_AUTO_GATING (1 << 31) +#define V_AUTO_GATING (x) (((x) & 1) << 31) + +/* DSP_INFACE_POL */ +#define M_DSP_INFACE_REGDONE (1 << 28) +#define V_DSP_INFACE_REGDONE (x) (((x) & 1) << 28) + +/* OTP_WIN_EN */ +#define M_OTP_WIN (1 << 0) +#define V_OTP_WIN (x) (((x) & 1) << 0) + +/* Overlay */ +/* OVERLAY_CTRL */ +#define M_LAYER_SEL_REGDONE_SEL (3 << 30) +#define M_LAYER_SEL_REGDONE_EN (1 << 28) +#define M_VP_OVERLAY_MODE (vp) (1 << ((vp) & 3)) + +#define V_LAYER_SEL_REGDONE_SEL (x) (((x) & 3) << 30) +#define V_LAYER_SEL_REGDONE_EN (x) (((x) & 1) << 28) +#define V_VP_OVERLAY_MODE (x, vp) (((x) & 1) << ((vp) & 3)) + +/* LAYER_SEL */ +#define V_LAYER_SEL (x, port) (((port) & 7) << 4 * ((x) & 7)) + +/* PORT_SEL */ +#define V_ESMART_SEL_PORT (x, vp) (((vp) & 3) << (24 + (2 * ((x) & 3)))) +#define V_CLUSTER_SEL_PORT (x, vp) (((vp) & 3) << (16 + (2 * ((x) & 3)))) +#define V_PORT_MUX (x, vp) (((x) & 0xf) << 4 * ((vp) & 3)) + +/* Post processing */ +/* DSP_CTRL */ +#define M_POST_STANDBY (1 << 31) +#define M_POST_FP_STANDBY (1 << 30) +#define M_POST_BLACK (1 << 27) +#define M_POST_OUT_ZERO (1 << 26) +#define M_POST_LB_MODE (1 << 23) +#define M_PRE_DITHER_DOWN (1 << 16) +#define M_DSP_OUT_MODE (0xf) + +#define V_POST_STANDBY (x) (((x) & 1) << 31) +#define V_POST_FP_STANDBY (x) (((x) & 1) << 30) +#define V_POST_BLACK (x) (((x) & 1) << 27) +#define V_POST_OUT_ZERO (x) (((x) & 1) << 26) +#define V_POST_LB_MODE (x) (((x) & 1) << 23) +#define V_PRE_DITHER_DOWN (x) (((x) & 1) << 16) +#define V_DSP_OUT_MODE (x) ((x) & 0xf) + +/* COLOR_CTRL */ +#define M_POST_COLORBAR_MODE (1 << 1) +#define M_POST_COLORBAR_EN (1 << 0) + +#define V_POST_COLORBAR_MODE (x) (((x) & 1) << 1) +#define V_POST_COLORBAR_EN (x) (((x) & 1) << 0) + +/* DSP_BG */ +#define M_DSP_BG_RED (0x3f << 20) +#define M_DSP_BG_GREEN (0x3f << 10) +#define M_DSP_BG_BLUE (0x3f << 0) + +#define V_DSP_BG_RED (x) (((x) & 0x3f) << 20) +#define V_DSP_BG_GREEN (x) (((x) & 0x3f) << 10) +#define V_DSP_BG_BLUE (x) (((x) & 0x3f) << 0) + +/* ESMART */ +#define M_ESMART_REGION0_MST_EN (1 << 0) +#define V_ESMART_REGION0_DATA_FMT (x) (((x) & 0x16) << 1) + +/* VOP2_ESMART_REGION0_VIR */ +#define V_ARGB888_VIRWIDTH (x) (((x) & 0xffff) << 0) +#define V_RGB888_VIRWIDTH (x) ((((((x) * 3) >> 2) + ((x) % 3)) & 0xffff) << 0) +#define V_RGB565_VIRWIDTH (x) ((((x) / 2) & 0xffff) << 0) +#define YUV_VIRWIDTH (x) ((((x) / 4) & 0xffff) << 0) + +#define V_ACT_HEIGHT (x) (((x) & 0x1fff) << 16) +#define V_ACT_WIDTH (x) ((x) & 0x1fff) +#define V_DSP_HEIGHT (x) (((x) & 0x1fff) << 16) +#define V_DSP_WIDTH (x) ((x) & 0x1fff) +#define V_DSP_YST (x) (((x) & 0x1fff) << 16) +#define V_DSP_XST (x) ((x) & 0x1fff) + +#define V_HSYNC (x) (((x) & 0x1fff) << 0)/* hsync pulse width */ +#define V_HORPRD (x) (((x) & 0x1fff) << 16)/* horizontal period */ +#define V_VSYNC (x) (((x) & 0x1fff) << 0) +#define V_VERPRD (x) (((x) & 0x1fff) << 16) + +#define V_HEAP (x) (((x) & 0x1fff) << 0)/* horizontal active end */ +#define V_HASP (x) (((x) & 0x1fff) << 16)/* horizontal active start */ +#define V_VAEP (x) (((x) & 0x1fff) << 0) +#define V_VASP (x) (((x) & 0x1fff) << 16) + +#endif
drivers/video/rockchip/Makefile +2 -1
@@ -4,10 +4,11 @@ # Wolfgang Denk, DENX Software Engineering, [email protected]. ifdef CONFIG_VIDEO_ROCKCHIP -obj-y += rk_vop.o +obj-y += rk_vop.o rk_vop2.o obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288_vop.o obj-$(CONFIG_ROCKCHIP_RK3328) += rk3328_vop.o obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399_vop.o +obj-$(CONFIG_ROCKCHIP_RK3568) += rk3568_vop.o obj-$(CONFIG_DISPLAY_ROCKCHIP_EDP) += rk_edp.o obj-$(CONFIG_DISPLAY_ROCKCHIP_LVDS) += rk_lvds.o obj-hdmi-$(CONFIG_ROCKCHIP_RK3288) += rk3288_hdmi.o
drivers/video/rockchip/rk3568_vop.c new file +260 -0
260 lines not on this page · raw message
drivers/video/rockchip/rk_vop2.c new file +520 -0
520 lines not on this page · raw message
drivers/video/rockchip/rk_vop2.h new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 2/9 arm: dts: rockchip: rk356x: Prerelocate VOP in U-Boot proper
In reply to Daniel GolleFrom: Dang Huynh <[email protected]>
We need to prerelocate VOP2 memory so the driver can work. This will only support U-Boot proper.
--- arch/arm/dts/rk356x-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/dts/rk356x-u-boot.dtsi +4 -0
@@ -170,6 +170,10 @@ bootph-all; }; +&vop { + bootph-some-ram; +}; + &xin24m { bootph-all; };
Signature · 1 line
2.55.0
PATCH 3/9 video: rockchip: Add HDMI support for RK3568
In reply to Daniel GolleFrom: Dang Huynh <[email protected]>
HDMI on RK3568 is mostly simplified, all this does is enabling DDC for display timings and HPD.
--- drivers/video/rockchip/Makefile | 1 + drivers/video/rockchip/rk3568_hdmi.c | 71 ++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 drivers/video/rockchip/rk3568_hdmi.c
drivers/video/rockchip/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_DISPLAY_ROCKCHIP_LVDS) += rk_lvds.o obj-hdmi-$(CONFIG_ROCKCHIP_RK3288) += rk3288_hdmi.o obj-hdmi-$(CONFIG_ROCKCHIP_RK3328) += rk3328_hdmi.o obj-hdmi-$(CONFIG_ROCKCHIP_RK3399) += rk3399_hdmi.o +obj-hdmi-$(CONFIG_ROCKCHIP_RK3568) += rk3568_hdmi.o obj-$(CONFIG_DISPLAY_ROCKCHIP_HDMI) += rk_hdmi.o $(obj-hdmi-y) obj-mipi-$(CONFIG_ROCKCHIP_RK3288) += rk3288_mipi.o obj-mipi-$(CONFIG_ROCKCHIP_RK3399) += rk3399_mipi.o
drivers/video/rockchip/rk3568_hdmi.c new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 6/9 video: rockchip: rk3568: ungate the HDMI controller clocks
In reply to Daniel GolleThe RK3568 HDMI probe polled the PHY hot-plug-detect status but always timed out ('hdmi can not get hpd signal', -ENODEV), so the controller never probed and HDMI output was dead even with a monitor attached.
The HDMI controller clocks are never enabled: neither the dw_hdmi glue nor the RK3568 clock driver manages the pclk_hdmi_host / clk_hdmi_sfr / clk_hdmi_cec gates (CLKGATE_CON21 bits 3-5). clk_hdmi_sfr feeds the controller/PHY logic that produces the HPD status and is parented off xin24m, independent of the pclk_vo domain that VOP2 bring-up enables, so it stayed gated: register reads returned a clean zero and the HPD bit never asserted. Mainline Linux enables isfr/iahb before reading the same HDMI_PHY_STAT0 HPD bit.
Ungate the three HDMI gates in rk3568_hdmi_probe() before probing the controller.
--- drivers/video/rockchip/rk3568_hdmi.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/video/rockchip/rk3568_hdmi.c +17 -0
@@ -7,12 +7,18 @@#include <dm.h> #include <dw_hdmi.h> #include <edid.h> +#include <asm/arch-rockchip/clock.h> +#include <asm/arch-rockchip/cru_rk3568.h> #include <asm/arch-rockchip/hardware.h> #include <asm/arch-rockchip/grf_rk3568.h> #include "rk_hdmi.h" #define RK3568_IO_DDC_IN_MSK ((3 << 14) | (3 << (14 + 16))) +/* CLKGATE_CON21: pclk_hdmi_host (b3), clk_hdmi_sfr (b4), clk_hdmi_cec (b5) */ +#define RK3568_HDMI_CLKGATE_CON 21 +#define RK3568_HDMI_CLKGATE_MSK (0x7 << 3) +static int rk3568_hdmi_enable (struct udevice *dev,int panel_bpp,const struct display_timing *edid) {
@@ -41,10 +47,21 @@ static int rk3568_hdmi_probe(struct udevice *dev) {struct rk_hdmi_priv *priv =dev_get_priv (dev);struct rk3568_grf *grf = priv->grf; +struct rk3568_cru *cru =rockchip_get_cru ();rk_hdmi_probe_regulators (dev, rk3568_hdmi_reg_names,ARRAY_SIZE (rk3568_hdmi_reg_names)); +/* +* Ungate the HDMI controller clocks. The RK3568 clock driver does +* not manage these gates, and clk_hdmi_sfr in particular must be +* running for the PHY hot-plug-detect status to be valid; without it +* the HPD poll times out and the controller is not probed. +*/ +if (cru) +rk_clrreg (&cru->clkgate_con[RK3568_HDMI_CLKGATE_CON ], +RK3568_HDMI_CLKGATE_MSK ); +writel (RK3568_IO_DDC_IN_MSK , &grf->vo_con1);return rk_hdmi_probe (dev);
Signature · 1 line
2.55.0
PATCH 8/9 video: rockchip: rk3568: power the HDMI PHY analog supplies
In reply to Daniel GolleOn a cold boot the RK3568 HDMI output stayed dead (no hot-plug detect), while after a warm reboot from Linux it worked, including graphical UEFI. The difference was the PHY analog supplies avdd-0v9 and avdd-1v8 (vdda0v9_image and vcca1v8_image on the R5C): Linux enables them and a warm reset leaves the PMIC LDOs on, but U-Boot left them disabled at their minimum voltage on cold boot, so the PHY had no analog power and never asserted HPD.
The driver did call rk_hdmi_probe_regulators() with "avdd-0v9"/"avdd-1v8", but that resolves regulators by their regulator-name via regulator_autoset_by_name(), which does not match the vdda0v9_image / vcca1v8_image names, so the lookup failed and the supplies were never enabled. regulator_autoset() would not have helped either: it returns early for regulators that are neither always-on nor boot-on.
Resolve the supplies through the avdd-0v9-supply / avdd-1v8-supply phandles, set the constrained voltage and enable them, matching the kernel's dw_hdmi-rockchip behaviour.
--- drivers/video/rockchip/rk3568_hdmi.c | 29 +++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/video/rockchip/rk3568_hdmi.c +24 -5
@@ -12,6 +12,7 @@#include <asm/arch-rockchip/cru_rk3568.h> #include <asm/arch-rockchip/hardware.h> #include <asm/arch-rockchip/grf_rk3568.h> +#include <power/regulator.h> #include "rk_hdmi.h" /* Default HDMI PHY reference rate to bring HPLL up for hot-plug detect */
@@ -47,11 +48,30 @@ static int rk3568_hdmi_of_to_plat(struct udevice *dev)return rk_hdmi_of_to_plat (dev); } -static const char *const rk3568_hdmi_reg_names[] = { -"avdd-0v9" , -"avdd-1v8" +static const char *const rk3568_hdmi_supplies[] = { +"avdd-0v9-supply" , +"avdd-1v8-supply" , }; +static void rk3568_hdmi_enable_supplies (struct udevice *dev) +{ +struct dm_regulator_uclass_plat *plat; +struct udevice *reg; +int i; + +for (i =0 ; i <ARRAY_SIZE (rk3568_hdmi_supplies); i++) { +if (device_get_supply_regulator (dev, rk3568_hdmi_supplies[i], + ®)) +continue ; + + plat =dev_get_uclass_plat (reg); +if (plat->min_uV) +regulator_set_value (reg, plat->min_uV); + +regulator_set_enable (reg, true); + } +} +static int rk3568_hdmi_probe (struct udevice *dev) {struct rk_hdmi_priv *priv =dev_get_priv (dev);
@@ -59,8 +79,7 @@ static int rk3568_hdmi_probe(struct udevice *dev)struct rk3568_cru *cru =rockchip_get_cru ();struct clk ref_clk; -rk_hdmi_probe_regulators (dev, rk3568_hdmi_reg_names, -ARRAY_SIZE (rk3568_hdmi_reg_names)); +rk3568_hdmi_enable_supplies (dev);/* * Ungate the HDMI controller clocks. The RK3568 clock driver does
Signature · 1 line
2.55.0
PATCH 9/9 configs: nanopi-r5c: enable HDMI video output
In reply to Daniel GolleEnable the VOP2 display controller and RK3568 DesignWare HDMI so U-Boot drives the HDMI port: vidconsole for the boot menu on a monitor, and EFI GOP (which registers automatically once a UCLASS_VIDEO device exists) for graphical UEFI payloads. Uses the in-tree dw_hdmi driver; no separate PHY driver is needed on RK3568.
--- configs/nanopi-r5c-rk3568_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
configs/nanopi-r5c-rk3568_defconfig +4 -0
@@ -68,4 +68,8 @@ CONFIG_USB_OHCI_HCD=y CONFIG_USB_OHCI_GENERIC=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GENERIC=y +CONFIG_VIDEO=y +CONFIG_DISPLAY=y +CONFIG_VIDEO_ROCKCHIP=y +CONFIG_DISPLAY_ROCKCHIP_HDMI=y CONFIG_ERRNO_STR=y
Signature · 1 line
2.55.0
PATCH 4/9 clk: rockchip: rk3568: Use assigned VPLL clock when possible
In reply to Daniel GolleFrom: Dang Huynh <[email protected]>
This matches how VPLL is configured under Linux and avoid weird behaviors when VPLL is reconfigured under Linux.
--- drivers/clk/rockchip/clk_rk3568.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk_rk3568.c +5 -1
@@ -1818,7 +1818,11 @@ static ulong rk3568_dclk_vop_set_clk(struct rk3568_clk_priv *priv, ((div - 1) << DCLK0_VOP_DIV_SHIFT));rk3568_pmu_pll_set_rate (priv,HPLL , div * rate); }else if (sel ==DCLK_VOP_SEL_VPLL ) { - div =DIV_ROUND_UP (RK3568_VOP_PLL_LIMIT_FREQ , rate); +if (priv->vpll_hz) + div =DIV_ROUND_UP (priv->vpll_hz, rate); +else + div =DIV_ROUND_UP (RK3568_VOP_PLL_LIMIT_FREQ , rate); + rk_clrsetreg(&cru->clksel_con[conid], DCLK0_VOP_DIV_MASK | DCLK0_VOP_SEL_MASK, (DCLK_VOP_SEL_VPLL << DCLK0_VOP_SEL_SHIFT) |
Signature · 1 line
2.55.0
PATCH 5/9 video: rockchip: vop2: fix NULL register base in rk3568 probe
In reply to Daniel Gollerk3568_vop_probe() calls rkvop2_initialize() before rk_vop2_probe(), but priv->regs (the VOP register base) was only resolved inside rk_vop2_probe() via dev_read_addr_ptr(). rkvop2_initialize() dereferences priv->regs (sysctrl = priv->regs + VOP2_SYSREG_OFFSET), so on probe it faulted on a NULL base:
Synchronous Abort, esr 0x96000010, far 0x50
... rk3568_vop_probe
Resolve the register base at the top of rk3568_vop_probe(), before rkvop2_initialize() runs; rk_vop2_probe() then sets it again to the same value.
--- drivers/video/rockchip/rk3568_vop.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/video/rockchip/rk3568_vop.c +10 -0
@@ -179,12 +179,22 @@ static int rk3568_vop_remove(struct udevice *dev)static int rk3568_vop_probe (struct udevice *dev) { +struct rk_vop2_priv *priv =dev_get_priv (dev);int ret;/* Before relocation we don't need to do anything */ if (!(gd->flags &GD_FLG_RELOC ))return 0 ; +/* +* rkvop2_initialize() touches the VOP registers, so the register +* base must be resolved before it runs; rk_vop2_probe() sets it +* again to the same value. +*/ + priv->regs =dev_read_addr_ptr (dev); +if (!priv->regs) +return -EINVAL ; + ret =rkvop2_initialize (dev);if (ret)return ret;
Signature · 1 line
2.55.0
PATCH 7/9 video: rockchip: rk3568: bring up the HDMI PHY reference clock
In reply to Daniel GolleAdd CLK_HDMI_REF support to the RK3568 PMU clock driver (route the mux to HPLL and set the HPLL rate) and enable it from the HDMI driver: at probe to a default rate, and at modeset to the pixel clock, matching mainline Linux. The RK3568 HDMI PHY needs its reference clock running for output.
Note: this alone does not make hot-plug-detect work in U-Boot; the PHY still reports no HPD (PHY_STAT0=0) with a monitor attached despite the controller being live. The remaining HDMI PHY bring-up gap is unresolved.
--- drivers/clk/rockchip/clk_rk3568.c | 12 ++++++++++++ drivers/video/rockchip/rk3568_hdmi.c | 24 +++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-)
drivers/clk/rockchip/clk_rk3568.c +12 -0
@@ -377,6 +377,10 @@ static ulong rk3568_pmuclk_get_rate(struct clk *clk)case PCLK_PMU : rate =rk3568_pmu_get_pmuclk (priv);break ; +case CLK_HDMI_REF : + rate =rockchip_pll_get_rate (&rk3568_pll_clks[HPLL ], + priv->pmucru,HPLL ); +break ;default :return -ENOENT ; }
@@ -408,6 +412,14 @@ static ulong rk3568_pmuclk_set_rate(struct clk *clk, ulong rate) priv->hpll_hz =rockchip_pll_get_rate (&rk3568_pll_clks[HPLL ], priv->pmucru,HPLL );break ; +case CLK_HDMI_REF : +/* clk_hdmi_ref is HPLL via PMU_CLKSEL_CON8 bit7 (0 = hpll) */ + ret =rockchip_pll_set_rate (&rk3568_pll_clks[HPLL ], + priv->pmucru,HPLL , rate); + priv->hpll_hz =rockchip_pll_get_rate (&rk3568_pll_clks[HPLL ], + priv->pmucru,HPLL ); +rk_clrsetreg (&priv->pmucru->pmu_clksel_con[8 ],BIT (7 ),0 ); +break ;case CLK_RTC_32K :case CLK_RTC32K_FRAC : ret =rk3568_rtc32k_set_pmuclk (priv, rate);
drivers/video/rockchip/rk3568_hdmi.c +21 -3
@@ -3,6 +3,7 @@* Copyright (c) 2024 - 2025 Dang Huynh <[email protected]> */ +#include <clk.h> #include <display.h> #include <dm.h> #include <dw_hdmi.h>
@@ -13,6 +14,9 @@#include <asm/arch-rockchip/grf_rk3568.h> #include "rk_hdmi.h" +/* Default HDMI PHY reference rate to bring HPLL up for hot-plug detect */ +#define RK3568_HDMI_REF_DEFAULT 148500000 +#define RK3568_IO_DDC_IN_MSK ((3 << 14) | (3 << (14 + 16)))/* CLKGATE_CON21: pclk_hdmi_host (b3), clk_hdmi_sfr (b4), clk_hdmi_cec (b5) */
@@ -23,6 +27,11 @@ static int rk3568_hdmi_enable(struct udevice *dev, int panel_bpp, const struct display_timing *edid) {struct rk_hdmi_priv *priv =dev_get_priv (dev); +struct clk ref_clk; + +/* Drive the PHY reference at the pixel clock for this mode */ +if (!clk_get_by_name (dev,"ref" , &ref_clk)) +clk_set_rate (&ref_clk, edid->pixelclock.typ);return dw_hdmi_enable (&priv->hdmi, edid); }
@@ -48,20 +57,29 @@ static int rk3568_hdmi_probe(struct udevice *dev)struct rk_hdmi_priv *priv =dev_get_priv (dev);struct rk3568_grf *grf = priv->grf;struct rk3568_cru *cru =rockchip_get_cru (); +struct clk ref_clk;rk_hdmi_probe_regulators (dev, rk3568_hdmi_reg_names,ARRAY_SIZE (rk3568_hdmi_reg_names));/* * Ungate the HDMI controller clocks. The RK3568 clock driver does -* not manage these gates, and clk_hdmi_sfr in particular must be -* running for the PHY hot-plug-detect status to be valid; without it -* the HPD poll times out and the controller is not probed. +* not manage these gates. */ if (cru)rk_clrreg (&cru->clkgate_con[RK3568_HDMI_CLKGATE_CON ],RK3568_HDMI_CLKGATE_MSK ); +/* +* Bring up the PHY reference clock (clk_hdmi_ref off HPLL) before +* probing: the internal HDMI PHY needs its reference running for the +* hot-plug-detect status to be valid, otherwise the HPD poll times +* out and the controller is not probed. Mainline Linux likewise +* enables this clock at probe. +*/ +if (!clk_get_by_name (dev,"ref" , &ref_clk)) +clk_set_rate (&ref_clk,RK3568_HDMI_REF_DEFAULT ); +writel (RK3568_IO_DDC_IN_MSK , &grf->vo_con1);return rk_hdmi_probe (dev);
Signature · 1 line
2.55.0
Quoted 6 lines · Daniel Golle [2026-07-19 02:58:43] wrote:
U-Boot has no video output support for the RK3568/RK3566 family: the VOP2 display controller found in these SoCs (and newer Rockchip parts) is unsupported, so boards cannot show a boot menu, the UEFI console or any other firmware user interface on a locally attached display, while the vendor firmware and the Linux kernel have long been able to drive it.
Indeed, and this is a PITA for some boards. Thank you for working on it.
I just tried your patch set on an Odroid-M1 by applying the patches in sequence, and then adding the following to it:
% git diff origin/master configs/odroid-m1-rk3568_defconfig
diff --git a/configs/odroid-m1-rk3568_defconfig b/configs/odroid-m1-rk3568_defconfig
index b00985b0405..00f47245529 100644
--- a/configs/odroid-m1-rk3568_defconfig
+++ b/configs/odroid-m1-rk3568_defconfig
@@ -70,6 +70,7 @@ CONFIG_DWC_ETH_QOS_ROCKCHIP=y
CONFIG_PHY_REALTEK=y
CONFIG_NVME_PCI=y
CONFIG_PCIE_DW_ROCKCHIP=y
+#CONFIG_PHY_ROCKCHIP_INNO_HDMI=y
CONFIG_PHY_ROCKCHIP_INNO_USB2=y
CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
CONFIG_SPL_PINCTRL=y
@@ -92,5 +93,13 @@ CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_GENERIC=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GENERIC=y
+CONFIG_USB_KEYBOARD=y
CONFIG_FS_CRAMFS=y
+CONFIG_VIDEO=y
+CONFIG_DISPLAY=y
+CONFIG_VIDEO_ROCKCHIP=y
+CONFIG_DISPLAY_ROCKCHIP_HDMI=y
+#CONFIG_VIDEO_DT_SIMPLEFB=y
+#CONFIG_VIDEO_BRIDGE=y
+#CONFIG_VIDEO_REMOVE=y
CONFIG_ERRNO_STR=y
% But I still can't see anything on my display (and hitting any key on the USB keyboard did not elicit any response, the timer kept going). The serial-port output is appended (tho I cut out the DDR initialization part).
Any idea what might be the problem?
=== Stefan
U-Boot SPL 2026.07-00012-gec560345eabb (Jul 19 2026 - 20:09:19 +0000) Trying to boot from MMC2
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK
## Checking hash(es) for Image fdt-1 ... sha256+ OK
## Checking hash(es) for Image atf-2 ... sha256+ OK
## Checking hash(es) for Image atf-3 ... sha256+ OK
## Checking hash(es) for Image atf-4 ... sha256+ OK
## Checking hash(es) for Image atf-5 ... sha256+ OK
## Checking hash(es) for Image atf-6 ... sha256+ OK
INFO: Preloader serial: 2 NOTICE: BL31: v2.3():v2.3-645-g8cea6ab0b:cl, fwver: v1.44 NOTICE: BL31: Built : 16:36:43, Sep 19 2023 INFO: GICv3 without legacy support detected. INFO: ARM GICv3 driver initialized in EL3 INFO: pmu v1 is valid 220114 INFO: l3 cache partition cfg-0 INFO: dfs DDR fsp_param[0].freq_mhz= 1560MHz INFO: dfs DDR fsp_param[1].freq_mhz= 324MHz INFO: dfs DDR fsp_param[2].freq_mhz= 528MHz INFO: dfs DDR fsp_param[3].freq_mhz= 780MHz INFO: Using opteed sec cpu_context! INFO: boot cpu mask: 0 INFO: BL31: Initializing runtime services WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK ERROR: Error initializing runtime service opteed_fast INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x800000 INFO: SPSR = 0x3c9
U-Boot 2026.07-00012-gec560345eabb (Jul 19 2026 - 20:09:19 +0000)
Model: Hardkernel ODROID-M1 SoC: RK3568B2 DRAM: 4 GiB PMIC: RK809 (on=0x40, off=0x00) Core: 629 devices, 35 uclasses, devicetree: separate MMC: mmc@fe2b0000: 1, mmc@fe310000: 0 Loading Environment from nowhere... OK In: serial Out: serial Err: serial Model: Hardkernel ODROID-M1 SoC: RK3568B2 Net: eth0: ethernet@fe2a0000
Hit any key to stop autoboot: 0
Quoted 5 lines
But I still can't see anything on my display (and hitting any key on the USB keyboard did not elicit any response, the timer kept going). The serial-port output is appended (tho I cut out the DDR initialization part).
Any idea what might be the problem?
I also tried it on a NanoPi R5S with the patch below:
diff --git a/configs/nanopi-r5s-rk3568_defconfig b/configs/nanopi-r5s-rk3568_defconfig
index c971f376b38..ed8d6187448 100644
--- a/configs/nanopi-r5s-rk3568_defconfig
+++ b/configs/nanopi-r5s-rk3568_defconfig
@@ -55,6 +55,7 @@ CONFIG_RTL8169=y
CONFIG_PHY_REALTEK=y
CONFIG_NVME_PCI=y
CONFIG_PCIE_DW_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_HDMI=y
CONFIG_PHY_ROCKCHIP_INNO_USB2=y
CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
CONFIG_SPL_PINCTRL=y
@@ -79,4 +80,12 @@ CONFIG_SPL_USB_DWC3_GENERIC=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_USB_FUNCTION_ROCKUSB=y
+CONFIG_USB_KEYBOARD=y
+CONFIG_VIDEO=y
+CONFIG_DISPLAY=y
+CONFIG_VIDEO_ROCKCHIP=y
+CONFIG_DISPLAY_ROCKCHIP_HDMI=y
+CONFIG_VIDEO_DT_SIMPLEFB=y
+CONFIG_VIDEO_BRIDGE=y
+CONFIG_VIDEO_REMOVE=y
CONFIG_ERRNO_STR=yand it 's partly successful but not quite:
- At boot, I get a U-Boot logo in the top-right corner of the screen. This apparently gets displayed during the whole time U-Boot is waiting for BOOTDELAY.
- Nothing else appears on screen (e.g. no text).
- Pressing keys on the keyboard seems to have no effect at all (including not stopping the boot after reaching BOOTDELAY).
I don't have a serial connection for that SBC, sadly, so I can't post any further details.
=== Stefan