From nobody Tue Feb 10 00:58:20 2026 Received: from sender4-op-o16.zoho.com (sender4-op-o16.zoho.com [136.143.188.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A4F638B7B8; Wed, 21 Jan 2026 11:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.16 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768993464; cv=pass; b=eWf5vkcaS1GG9FSdJrnqBTideFtTb007fqDWBHlJBQxQLCKdmt+b+lrYInjgpfrHrEHgnPlvpIhkPv4ebDIQGEq05d55ouhk/0qJ/Bt26K/RukOTj7lpsYqmbX3po38/xvRBrfGG1tLgk1Rttj/5Ac2Qo+oMpGKo8AwwL94e7wY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768993464; c=relaxed/simple; bh=EaZwUZOL/6KRK5E3haLUyKQNLv0B7SELQtluH9yrJLU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=az07kmLIIF7WwLa+Y+sROg9t/6cybFSQfw5Rtryzi+HTG0KwMlb3iiS7WXEFAiWyBdNqvEZsajVRaOuSRCtkva+bwrbnWKTQDA2cWVvjXj4eyeVK2AIzfIJtrdP3W4Ecd1VZzfj1cacglMicXkDPu0lnLx8xPvYQMCvD+zPFGzo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pigmoral.tech; spf=pass smtp.mailfrom=pigmoral.tech; dkim=pass (1024-bit key) header.d=pigmoral.tech header.i=junhui.liu@pigmoral.tech header.b=TgZjJLE+; arc=pass smtp.client-ip=136.143.188.16 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) header.d=pigmoral.tech header.i=junhui.liu@pigmoral.tech header.b="TgZjJLE+" ARC-Seal: i=1; a=rsa-sha256; t=1768993443; cv=none; d=zohomail.com; s=zohoarc; b=iDTfN+GYmWGpF1sSZ11lnR14TiFZh3OC/Ih137nMp+2sefu85bBNBwzzDbiFNG8yoXOJoWAZSXyxlPIxpMCcfx7uloVHPnJwAruq2ltCeWN3Nz1KEjm1Z4k9MTKFDASaRf4dVQq5UdFNCAkcuWvM/BddIewSoGBcwI1vRLzkzCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1768993443; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Q9xJi6VAHCUEzm3dN054EmcisgXFfpIHGR5lwkOb/cw=; b=Ca78poVEBiD+NghCzY024n0Gv3UYAjMHSAWWfc/+i4W38Rpued1SsOqXx1Tl3w9J4pLuT46KQGvSN+i7gGkbm1hePKWX+NJKy24h+dsRvfFmAOPVmXquxqS/RHHDI3Rcy9R0sFKXQWR1kNDqCJ35XTjuAyrZ8IuDxfBTmJidy8E= 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: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1768993443; s=zmail; d=pigmoral.tech; i=junhui.liu@pigmoral.tech; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=Q9xJi6VAHCUEzm3dN054EmcisgXFfpIHGR5lwkOb/cw=; b=TgZjJLE+/3LfqohAS1g2WUBUaPANu6Boa3mjmtk1FrjvQlXjMxrB29QNHs3y+71N NEMROp13HrdHf9vnuQHEotkvK74UfKweRhU8uykp2y17Gf02Wq+x73sEP/hOB0PiK3l uSWtvZ/fK5vNBPWeur3uS8OkaKHaa2CSSwwoKnUI= Received: by mx.zohomail.com with SMTPS id 1768993442305964.352987418435; Wed, 21 Jan 2026 03:04:02 -0800 (PST) From: Junhui Liu Date: Wed, 21 Jan 2026 18:59:09 +0800 Subject: [PATCH 3/7] clk: sunxi-ng: sun6i-rtc: Add feature bit for IOSC calibration Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260121-a733-rtc-v1-3-d359437f23a7@pigmoral.tech> References: <20260121-a733-rtc-v1-0-d359437f23a7@pigmoral.tech> In-Reply-To: <20260121-a733-rtc-v1-0-d359437f23a7@pigmoral.tech> To: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Alexandre Belloni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Ripard Cc: linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, Junhui Liu X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1768993386; l=3422; i=junhui.liu@pigmoral.tech; s=20251228; h=from:subject:message-id; bh=EaZwUZOL/6KRK5E3haLUyKQNLv0B7SELQtluH9yrJLU=; b=UOl1J6qZ2N2m3kr+ssXubB+UY59HWZGQsOMSAIyLazGm1HLOdoP/dR/8xP4BC17QNEHm6JzQ6 NTr7syE0uSxBbQsuBFT80Y6HLE/5dwOBOzNIwmT0u96arwwE7OQLsKN X-Developer-Key: i=junhui.liu@pigmoral.tech; a=ed25519; pk=3vU0qIPJAH8blXmLyqBhKx+nLOjcLwwYhZXelEpw7h4= X-ZohoMailClient: External The sun6i-rtc CCU driver currently uses a global static variable to denote whether calibration is supported, which makes IOSC operations tightly coupled to this file. Convert this into a feature bit to decouple the logic. This allows the IOSC clock code to be moved into a shared module for reuse by other SoCs. Signed-off-by: Junhui Liu --- drivers/clk/sunxi-ng/ccu-sun6i-rtc.c | 17 +++++++++-------- drivers/clk/sunxi-ng/ccu_common.h | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-rtc.c b/drivers/clk/sunxi-ng/cc= u-sun6i-rtc.c index 3088f247d927..6f888169412c 100644 --- a/drivers/clk/sunxi-ng/ccu-sun6i-rtc.c +++ b/drivers/clk/sunxi-ng/ccu-sun6i-rtc.c @@ -53,8 +53,6 @@ struct sun6i_rtc_match_data { u8 osc32k_fanout_nparents; }; =20 -static bool have_iosc_calibration; - static int ccu_iosc_enable(struct clk_hw *hw) { struct ccu_common *cm =3D hw_to_ccu_common(hw); @@ -81,7 +79,7 @@ static unsigned long ccu_iosc_recalc_rate(struct clk_hw *= hw, { struct ccu_common *cm =3D hw_to_ccu_common(hw); =20 - if (have_iosc_calibration) { + if (cm->features & CCU_FEATURE_IOSC_CALIBRATION) { u32 reg =3D readl(cm->base + IOSC_CLK_CALI_REG); =20 /* @@ -120,7 +118,7 @@ static int ccu_iosc_32k_prepare(struct clk_hw *hw) struct ccu_common *cm =3D hw_to_ccu_common(hw); u32 val; =20 - if (!have_iosc_calibration) + if (!(cm->features & CCU_FEATURE_IOSC_CALIBRATION)) return 0; =20 val =3D readl(cm->base + IOSC_CLK_CALI_REG); @@ -135,7 +133,7 @@ static void ccu_iosc_32k_unprepare(struct clk_hw *hw) struct ccu_common *cm =3D hw_to_ccu_common(hw); u32 val; =20 - if (!have_iosc_calibration) + if (!(cm->features & CCU_FEATURE_IOSC_CALIBRATION)) return; =20 val =3D readl(cm->base + IOSC_CLK_CALI_REG); @@ -149,7 +147,7 @@ static unsigned long ccu_iosc_32k_recalc_rate(struct cl= k_hw *hw, struct ccu_common *cm =3D hw_to_ccu_common(hw); u32 val; =20 - if (have_iosc_calibration) { + if (cm->features & CCU_FEATURE_IOSC_CALIBRATION) { val =3D readl(cm->base + IOSC_CLK_CALI_REG); =20 /* Assume the calibrated 32k clock is accurate. */ @@ -168,7 +166,7 @@ static unsigned long ccu_iosc_32k_recalc_accuracy(struc= t clk_hw *hw, struct ccu_common *cm =3D hw_to_ccu_common(hw); u32 val; =20 - if (have_iosc_calibration) { + if (cm->features & CCU_FEATURE_IOSC_CALIBRATION) { val =3D readl(cm->base + IOSC_CLK_CALI_REG); =20 /* Assume the calibrated 32k clock is accurate. */ @@ -366,7 +364,10 @@ static int sun6i_rtc_ccu_probe(struct auxiliary_device= *adev, return 0; =20 data =3D match->data; - have_iosc_calibration =3D data->have_iosc_calibration; + if (data->have_iosc_calibration) { + iosc_clk.features |=3D CCU_FEATURE_IOSC_CALIBRATION; + iosc_32k_clk.features |=3D CCU_FEATURE_IOSC_CALIBRATION; + } =20 if (data->have_ext_osc32k) { const char *fw_name; diff --git a/drivers/clk/sunxi-ng/ccu_common.h b/drivers/clk/sunxi-ng/ccu_c= ommon.h index bbec283b9d99..d9dc24ad5503 100644 --- a/drivers/clk/sunxi-ng/ccu_common.h +++ b/drivers/clk/sunxi-ng/ccu_common.h @@ -21,6 +21,7 @@ #define CCU_FEATURE_CLOSEST_RATE BIT(9) #define CCU_FEATURE_DUAL_DIV BIT(10) #define CCU_FEATURE_UPDATE_BIT BIT(11) +#define CCU_FEATURE_IOSC_CALIBRATION BIT(12) =20 /* MMC timing mode switch bit */ #define CCU_MMC_NEW_TIMING_MODE BIT(30) --=20 2.52.0