From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.12 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795663230; b=3jhE7SGLUplVOEamszq4JhbpJR1SJZNb2d79Bse6QQNjOmkFGO1YfmrTKb9iPJwwSftq nJx2wUz0ZXwM/mfs3WEmBJvMNsLrLNkZwb8I6eRX4KA9CYVSYT3kBZqggfcRr2xq/cYU1 flp8TOorTuCIt6FjYHM1AO68um3tmV0X9rktNHCpxJUEA+rRYQCj04xjYHymnRT8Ul/21 1KeG5Q8Tn2WK5JCK7yKoP5KAhSuFraym9wD/MTwQOUndnkdWqUbukFLFAIn6LJeIkcN2l x9+I8dLiV+l0ppHb+wEPOyF+dQ5YtUyOfJl6wAGGB5Lwv0ONAl9+J717RrhAy09074Q== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795663230; h=DMARC-Filter:DKIM-Signature:Received:Mime-Version: Content-Transfer-Encoding:Content-Type:Date:Message-Id:Cc:Subject: From:To:X-Mailer:References:In-Reply-To:X-ZohoMailClient; bh=wl1zFrlH173HoV75rMT0wWjqW6vBAlxFdSbEFwWvJuI=; b=vnUgsTBiElSLiiuBJNDE8FVs67UMQWx0QpCjPFAVEQKW62jQbY5f0TSUX63jbIfZ4ZHN fdOkdB7Cmb+nKe/yqzEQG4ssFnyRp8k8vvkt2HXt8QsSrU5mPkeT5hEVzlEMihJeMXWn7 yVuTyxC/28jfeUfHM76QtS5LQrpghyGssAG2HCcRxsygy/w+T8NL4I0u0+/V/llKSu+t9 4+jvUyVX/rQF2/MdBrZEyPEZPqmvzrD24YZlXI4Ta76Ao364wWUx7JV7p+NINXhdcMJIA RbpBCoof0p3kLFz3TK3VY7LW9ceMlT8U6/Nlr3TfJZvnzn/etFEnDEhjJzy+qP54PRQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=pigmoral.tech; spf=pass smtp.mailfrom=pigmoral.tech; dkim=pass header.d=pigmoral.tech header.i=@pigmoral.tech header.a=rsa-sha256 header.s=zmail header.b=FAvk0CBL; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.180.12 Received: from sender6-op-o12.zoho.com (sender6-op-o12.zoho.com [165.173.180.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9F1B606A321 for ; Thu, 26 Nov 2026 03:20:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B9F1B606A321 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pigmoral.tech Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pigmoral.tech Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=pigmoral.tech header.i=@pigmoral.tech header.a=rsa-sha256 header.s=zmail header.b=FAvk0CBL ARC-Seal: i=1; a=rsa-sha256; t=1795663192; cv=none; d=zohomail.com; s=zohoarc; b=e4FII9bZdXIdBe8LYq4IGbMGRvCRAqDjcHw9c8PyTsCwtiVOHVX5/o5BFvRZq0JzdHw4je5tOQNaP8jVIjuVYUPUqGGHM2gbGyvBK9FyNT8Kycg4BOOHwfPE7RnxlVPqV/ZCxlxkMgRkxdSOsnV7mkREAb/knXDALPMCKk0t7ks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1795663192; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=wl1zFrlH173HoV75rMT0wWjqW6vBAlxFdSbEFwWvJuI=; b=UUDe5cwvt/PXWuIAvUf7gV10dD720xJ276dIrDwnydvX0vcdz39b+TOiVIzKwtv0rWTBNc/hcSoszBNxJ9fhCrI6J3p/WVjxBu6hbPq+8o10JwFbnn0+/tb2RocfO8quJzYOua2SEEyGmP2fsWdF29PJKqhh0Ky4UKSiB+zECkA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=pigmoral.tech; spf=pass smtp.mailfrom=junhui.liu@pigmoral.tech; dmarc=pass header.from= DKIM-Signature: a=rsa-sha256; b=FAvk0CBLjnz+CVdmsl7/q3o4Fp2VSiuJJI4sTMUqqnfWurQhA1S0J/y6uFnL1wO8PJypOYhxEbmZYB28yoWSeEefIUxMG+jv39r2SBJ8lcFiQVUpBH0wno0yeu97zQDXIRopUT3Fgb/Kqtzd5SFHi9F9OFc6dMwE2FASRbwLjHQ=; c=relaxed/relaxed; s=zmail; d=pigmoral.tech; v=1; bh=wl1zFrlH173HoV75rMT0wWjqW6vBAlxFdSbEFwWvJuI=; h=Content-Description:Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Resent-Sender:Resent-Cc:Resent-Date:Resent-To:Reply-To:Resent-Message-ID:Resent-From:Sender:Subject:To:Date:From:Message-Id:Reply-To:Subject:To:Cc; Received: by smtp.zohomail.com with SMTPS id 1795663189418348.39520229037566; Wed, 25 Nov 2026 19:19:49 -0800 (PST) X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 26 Nov 2026 11:19:39 +0800 Message-Id: Cc: , , , , "Andre Przywara" , , , , "Jerome Brunet" , "Enzo Adriano" , "Norman Herms" , "Vinicius Pedrosa" Subject: Re: [PATCH v7 4/8] clk: sunxi-ng: a733: Add PLL clocks support From: "Junhui Liu" To: "Alastair D'Silva" , "Junhui Liu" , "Stephen Boyd" , "Brian Masney" , "Jerome Brunet" , "Chen-Yu Tsai" , "Jernej Skrabec" , "Samuel Holland" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Philipp Zabel" , "Paul Walmsley" , "Palmer Dabbelt" , "Albert Ou" , "Alexandre Ghiti" , "Richard Cochran" X-Mailer: aerc 0.22.0 References: <20261112-a733-clk-v7-4-db7c5451ffa2@pigmoral.tech> <20261125122452.3966873-1-alastair@d-silva.org> In-Reply-To: <20261125122452.3966873-1-alastair@d-silva.org> X-ZohoMailClient: External Hi Alastair, On Wed Nov 25, 2026 at 8:24 PM CST, Alastair D'Silva wrote: > Hi Junhui, > > On Thu, 12 Nov 2026, Junhui Liu wrote: >> static struct ccu_nkmp pll_ref_clk =3D { >> ... >> }; >> ... >> 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 =3D 414, base_baud= =3D 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=3D12, M=3D13 fields. Since > ccu_nkmp_ops.recalc_rate() computes parent_rate * N / M regardless of > the enable bit, pll-ref reports 24000000 * 12 / 13 =3D 22153846 Hz. > > sys-24M, apb-uart, and bus-uart0 inherit 22153846 Hz instead of > 24000000 Hz, so 8250_dw calculates base_baud =3D 1384615 (instead of > 1500000) and programs divisor 12 instead of 13 (+8.3% baud error). Thanks for testing and reporting this. This is indeed a problem. I had assumed that PLL_REF would be used on all boards. I also tried manually disabling or bypassing PLL_REF on my Radxa Cubie A7A, but have not yet managed to establish a working bypass configuration... I currently suspect that the selection is handled automatically by the hardware, but this needs further confirm. > > 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. The issue may affect not just sys-24M, but also the downstream PLLs. According to the vendor SDK, their control registers have a PLL_FREF_SEL mux at bit 24, selecting between HOSC and REFPLL. The driver currently models these PLLs as having PLL_REF as their only parent, so their rates could also be calculated incorrectly when they actually use HOSC. We should model those muxes as well. However, my A7A, A7S and A7Z boards all use 26 MHz crystals, so I cannot properly validate the 24 MHz case until I get a board with a 24 MHz crystal. In the meantime, if you have a fix in mind, please feel free to send a separate patch. > > Tested on OrangePi 4 Pro (Allwinner A733). > > Thanks, > Alastair --=20 Best regards, Junhui Liu