Re: [PATCH v7 4/8] clk: sunxi-ng: a733: Add PLL clocks support
From: Alastair D'Silva
Date: Wed Nov 25 2026 - 07:25:16 EST
Hi Junhui,
On Thu, 12 Nov 2026, Junhui Liu wrote:
> static struct ccu_nkmp pll_ref_clk = {
> ...
> };
> ...
> static CLK_FIXED_FACTOR_HWS(sys_24M_clk, "sys-24M", pll_ref_hws, 1, 1, 0);
While testing this v7 series on the OrangePi 4 Pro (24 MHz HOSC), ttyS0
switches from earlycon to garbled output with:
2500000.serial: ttyS0 MMIO32:0x0000000002500000 (irq = 414, base_baud = 1384615) is a 16550A
Because the hardware bypasses pll-ref (0x02002000) when HOSC is 24 MHz,
sys-24M physically runs at 24 MHz from HOSC, while pll-ref remains
disabled with reset/unprogrammed N=12, M=13 fields. Since
ccu_nkmp_ops.recalc_rate() computes parent_rate * N / M regardless of
the enable bit, pll-ref reports 24000000 * 12 / 13 = 22153846 Hz.
sys-24M, apb-uart, and bus-uart0 inherit 22153846 Hz instead of
24000000 Hz, so 8250_dw calculates base_baud = 1384615 (instead of
1500000) and programs divisor 12 instead of 13 (+8.3% baud error).
If pll-ref is disabled/bypassed (or if sys-24M is physically fixed at
24 MHz as the comment describes), either pll_ref_clk needs a recalc_rate
that returns 24 MHz when disabled/bypassed, or sys_24M_clk should not
inherit an unenabled pll-ref N/M ratio.
Tested on OrangePi 4 Pro (Allwinner A733).
Thanks,
Alastair