From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F193CCA472 for ; Tue, 30 Sep 2025 09:38:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References: Message-Id:MIME-Version:Subject:Date:From:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5WdwG1KS4ecx4o3uGRXaqT6jA1cgW6ZwW4rqKW7hRxM=; b=VlgMxxJd9gVWCn y/H6J3W5OC8a/iY5EgSNdTtvHRAv3809SC0u426HKPQebOocG0pnBtUlOI4nFuANqBpGmapzWnitq /emYJIcMYYAw2bInU6/XBI15y1FKM2O15lMwEI5X2730ckfbM6H+egcTeZIW8SKyQW/sQrB19wiA6 NrORdUQcF+j6TzXrF1ZgchqQ5t7gIb3p2yXP62JB/lYAu50RUo/11vBZhvjl6G5fKCKqEhXvaAxLv kH/8GICw081y/w5rPKqaZpB3ly/sETQSVND43CgwhVBBKsgmM5LtC4fKN7RfLV2Sdswb/h8RkiUuH kTliqiiPszclUQVrDbdw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v3WoL-00000004qZc-3qFP; Tue, 30 Sep 2025 09:38:17 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v3Wnd-00000004q1d-2yRB; Tue, 30 Sep 2025 09:37:35 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id BEC464827B; Tue, 30 Sep 2025 09:37:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 8CAB8C19425; Tue, 30 Sep 2025 09:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1759225051; bh=Bo1CFOtg4gIIbGHHtViZt9t2cUZjQ5keBMKPre0nFbA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=GPfn31fgjG1WCcX9ALUQsxP89/Qfck26jzsNY9XnrKfhV/yXKeAws1Kq0O0201Z9v ow5TtEoDEEBUzqsEj+aYjQXG82ZQuj/eL+9xm3SFkHMTyNIEH50U0c+ZYEXEpneXHL xQHXu238GR8JPzZANR0ut1CMTGVmhMC27j5oIUZYZIK2bAgGAw0ymO7fgBf4dfcWB7 9KLroX1CzB8Jh2ETP/ApgqgaP1ax9kwXjggy+SU1uWNHV0QApfbshMFdsBX3fvdwmf m9t4AXxa37ZVXsbcV7yjUj5Lz5SirXrKfbfTFSlRXt6rDPmKaHUnIXyYjGa7Lowe5k 8vK6roUnLCA8Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 801B5CAC5BC; Tue, 30 Sep 2025 09:37:31 +0000 (UTC) From: Chuan Liu via B4 Relay Date: Tue, 30 Sep 2025 17:37:18 +0800 Subject: [PATCH 05/19] clk: amlogic: Correct l_detect bit control MIME-Version: 1.0 Message-Id: <20250930-a4_a5_add_clock_driver-v1-5-a9acf7951589@amlogic.com> References: <20250930-a4_a5_add_clock_driver-v1-0-a9acf7951589@amlogic.com> In-Reply-To: <20250930-a4_a5_add_clock_driver-v1-0-a9acf7951589@amlogic.com> To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Neil Armstrong , Jerome Brunet , Kevin Hilman , Martin Blumenstingl Cc: linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Xianwei Zhao , Chuan Liu X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1759225047; l=2616; i=chuan.liu@amlogic.com; s=20240902; h=from:subject:message-id; bh=LtshPz5QhFtZiWYcR/aI7iIkvqDd3NT0MWjkTbs07gA=; b=pVc8LO0dn09seJBcSmtce0lp3bWlsFa5f3MvlD1HYbzetWEr7JIaBPn2THXXkqz1OKnWyZ1jX Y9vw3nm/3PHDfiH5MrxfhloJIvhwZ3Nfkx8qYHld3DZY+smlimqbrKU X-Developer-Key: i=chuan.liu@amlogic.com; a=ed25519; pk=fnKDB+81SoWGKW2GJNFkKy/ULvsDmJZRGBE7pR5Xcpo= X-Endpoint-Received: by B4 Relay for chuan.liu@amlogic.com/20240902 with auth_id=203 X-Original-From: Chuan Liu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250930_023733_880317_DCDA2E70 X-CRM114-Status: GOOD ( 13.67 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: chuan.liu@amlogic.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: Chuan Liu l_detect controls the enable/disable of the PLL lock-detect module. For A1, the l_detect signal is active-low: 0 -> Enable lock-detect module; 1 -> Disable lock-detect module. Signed-off-by: Chuan Liu --- drivers/clk/meson/a1-pll.c | 1 + drivers/clk/meson/clk-pll.c | 16 ++++++++++++---- drivers/clk/meson/clk-pll.h | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/clk/meson/a1-pll.c b/drivers/clk/meson/a1-pll.c index 1f82e9c7c14e..bfe559c71402 100644 --- a/drivers/clk/meson/a1-pll.c +++ b/drivers/clk/meson/a1-pll.c @@ -137,6 +137,7 @@ static struct clk_regmap a1_hifi_pll = { .range = &a1_hifi_pll_range, .init_regs = a1_hifi_pll_init_regs, .init_count = ARRAY_SIZE(a1_hifi_pll_init_regs), + .flags = CLK_MESON_PLL_L_DETECT_N }, .hw.init = &(struct clk_init_data){ .name = "hifi_pll", diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c index 8bddd44d4738..c1e4c5710015 100644 --- a/drivers/clk/meson/clk-pll.c +++ b/drivers/clk/meson/clk-pll.c @@ -384,8 +384,12 @@ static int meson_clk_pll_enable(struct clk_hw *hw) meson_parm_write(clk->map, &pll->rst, 1); /* Disable the PLL lock-detect module */ - if (MESON_PARM_APPLICABLE(&pll->l_detect)) - meson_parm_write(clk->map, &pll->l_detect, 1); + if (MESON_PARM_APPLICABLE(&pll->l_detect)) { + if (pll->flags & CLK_MESON_PLL_L_DETECT_N) + meson_parm_write(clk->map, &pll->l_detect, 1); + else + meson_parm_write(clk->map, &pll->l_detect, 0); + } /* Enable the pll */ meson_parm_write(clk->map, &pll->en, 1); @@ -413,8 +417,12 @@ static int meson_clk_pll_enable(struct clk_hw *hw) udelay(20); /* Enable the lock-detect module */ - if (MESON_PARM_APPLICABLE(&pll->l_detect)) - meson_parm_write(clk->map, &pll->l_detect, 0); + if (MESON_PARM_APPLICABLE(&pll->l_detect)) { + if (pll->flags & CLK_MESON_PLL_L_DETECT_N) + meson_parm_write(clk->map, &pll->l_detect, 0); + else + meson_parm_write(clk->map, &pll->l_detect, 1); + } if (meson_clk_pll_wait_lock(hw)) { /* disable PLL when PLL lock failed. */ diff --git a/drivers/clk/meson/clk-pll.h b/drivers/clk/meson/clk-pll.h index 949157fb7bf5..83295a24721f 100644 --- a/drivers/clk/meson/clk-pll.h +++ b/drivers/clk/meson/clk-pll.h @@ -29,6 +29,8 @@ struct pll_mult_range { #define CLK_MESON_PLL_ROUND_CLOSEST BIT(0) #define CLK_MESON_PLL_NOINIT_ENABLED BIT(1) +/* l_detect signal is active-low */ +#define CLK_MESON_PLL_L_DETECT_N BIT(2) struct meson_clk_pll_data { struct parm en; -- 2.42.0 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic