On Thu, Dec 03, 2026 at 01:47:28AM +0000, [email protected] wrote:
> [Severity: High]
> Does rk628_cru_set_cpll_rate() need to set CLK_CPLL_MODE_MASK (bit 0) in
> CRU_MODE_CON00 to switch CPLL from slow mode to normal mode?
>
> On RK628F, rk628_cru_init() returns early after setting bit 4 in
> CRU_MODE_CON00 without setting CLK_CPLL_MODE_MASK.  When
> rk628_hdmirx_enable() calls rk628_cru_set_cpll_rate(), CPLL locks but its
> mode bit in CRU_MODE_CON00 remains 0, so CPLL stays in 24 MHz reference
> clock bypass and rk628_cru_get_pll_rate() returns 24 MHz instead of the
> configured CPLL rate when rk628_cru_set_frac_clk() programs the
> CRU_CLKSEL_CON13 and CRU_CLKSEL_CON14 fractional dividers.

No, this matches the RK628F CRU hardware reset defaults and Rockchip's
reference driver (rk628_cru.c). Unlike RK628D (which resets with CPLL
and GPLL in 24 MHz slow mode and requires the software mode-switch
sequence), RK628F resets with CLK_CPLL_MODE (bit 0) and CLK_GPLL_MODE
(bit 2) already set to normal PLL mode (1), while only the newly added
APLL (bit 4) defaults to slow mode (0).

RK628_HIWORD_UPDATE(1, 4, 4) in rk628_cru_init() uses the high-word
write-enable mask (BIT(20)) to switch bit 4 (APLL) to normal mode
without clearing bits 0 and 2, so CPLL and GPLL remain in normal mode
and rk628_cru_get_pll_rate() reads back the locked PLL rate. (Note that
hardware testing for this series was done on RK628D; the RK628F paths
follow Rockchip's BSP sequence verbatim.)

I will add a comment in rk628_cru_init() in v2 to document this.

> [Severity: High]
> Should rate_khz be halved in dual-link LVDS mode?
>
> In dual-link LVDS mode, odd and even pixels are split across module A and
> module B so each link runs at dst_mode.clock / 2.  Computing rate_khz from
> the full dst_mode.clock doubles the per-link serial bit rate for modes at
> or above 71429 kHz (such as 1920x1080p60 at 148.5 MHz), selecting half the
> required rate_div in COMBTXPHY_CON5.

No, rate_khz intentionally uses the unhalved pixel clock in both single-
and dual-link LVDS modes (tested on RK628D hardware and matching
Rockchip's rk628_lvds.c / rk628_combtxphy.c reference).

In rk628_post_process_enable(), the COMBTXPHY reference clock (sclk_vop,
selected via SW_TXPHY_REFCLK_SEL(1)) is programmed to the full
dst_mode.clock, and COMBTXPHY_CON5 uses fixed SW_REF_DIV(0) (ref_div = 1)
and SW_PLL_FB_DIV(14) (fb_div = 14). Because the COMBTXPHY PLL VCO locks
against the unhalved sclk_vop input before the PHY splits odd/even
pixels across Module A and Module B (SW_LVDS_CON_CHASEL(1)), rate_div
must be selected against dst_mode.clock * 7; halving rate_khz while
sclk_vop is unhalved would double rate_div and push the VCO out of
range.

I will add a clarifying comment in rk628_lvds_enable() in v2 as well.

Best regards,
Gianfranco

Reply via email to