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 15CF5C48BF6 for ; Wed, 21 Feb 2024 10:39:20 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date: In-reply-to:Subject:Cc:To:From:References:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=lkfF+Hufg41apse+tq9qDkcy3qz5jCmE+UU3Ej3Q18o=; b=TH3XWSj+tyrBR3lqS80HA3PLFM nQLHLTqfq0uXxZJbdDo8N0L0LCeMDaxAwZwwfj7+7YReZkRk/XtxUslYi5mLsLufXlr0M/EmJEUwj W3Q2I/9QXgw01OylpE0EG6sWNOcg7w8dR34YtVOdHimNu9Cnp5iyEjpoN8zTeI4e2xKATYuLWxyet eXrBVuk9k3ioJKba1HhgZBs1+bKhPY4zhMIz4YI4+JL5pdoMg/9jPR0z6wc/GsFKDlqpZUfsEqSpo u1SXKf+BbGPF8/BBFhCSFai4C+MggiNN8P73braoE6LeyBXfQUSkPI+eYyebqBR+gTBWfJfAotzI7 qtvHcUww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rck0F-00000000XpN-1glQ; Wed, 21 Feb 2024 10:39:03 +0000 Received: from mout-p-102.mailbox.org ([2001:67c:2050:0:465::102]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rck0D-00000000Xlg-0WHD for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 10:39:02 +0000 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4Tft6g64Lkz9tln; Wed, 21 Feb 2024 11:38:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oltmanns.dev; s=MBO0001; t=1708511931; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VOqX0GOQZZOiGD9BoiPl4P99i5/2V8G3vmiVhpwmjpo=; b=NVUrtqwknw/O3TZyiGfvfpG0IBx7JJpeIshlUGI/ALrW+famIowinN8F9Ti3bU4Kb+DskP y775xaFPKAqf07Z9jufvCZ/AuUTAM4pXCgmXlgUugQZxZI4mmfx/4UJIb3CWj7JIytAhQg l3cMMRBSKwmkaUjCkZVPwc9QSZ0W96DsujRbPvrZTUclXWsJ2NVejTPx9Ud7DDCgLM69Gb 4oAYCyVx0a/ZfDI7wBynT1H/fvIHe24aB5hJFSRro6uKd6bhUTPnwEiiZrZqz68LsxqWry p64VobbPssd93ohFph+mesCr7BNyXCE5h4LrsNcuswhXvQdIQyv57qnfdnQpWw== References: <20240205-pinephone-pll-fixes-v2-0-96a46a2d8c9b@oltmanns.dev> <20240205-pinephone-pll-fixes-v2-3-96a46a2d8c9b@oltmanns.dev> From: Frank Oltmanns To: Jernej Skrabec , Maxime Ripard , Diego Roversi Cc: Michael Turquette , Stephen Boyd , Chen-Yu Tsai , Samuel Holland , Guido =?utf-8?Q?G=C3=BCnther?= , Purism Kernel Team , Ondrej Jirman , Neil Armstrong , Jessica Zhang , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org Subject: Re: [PATCH v2 3/6] clk: sunxi-ng: nkm: Support minimum and maximum rate In-reply-to: <20240205-pinephone-pll-fixes-v2-3-96a46a2d8c9b@oltmanns.dev> Date: Wed, 21 Feb 2024 11:38:39 +0100 Message-ID: <8734tmhzkg.fsf@oltmanns.dev> MIME-Version: 1.0 X-Rspamd-Queue-Id: 4Tft6g64Lkz9tln X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240221_023901_340103_D582E860 X-CRM114-Status: GOOD ( 20.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Jernej, hi Maxime, On 2024-02-05 at 16:22:26 +0100, Frank Oltmanns wrote: > According to the Allwinner User Manual, the Allwinner A64 requires > PLL-MIPI to run at 500MHz-1.4GHz. Add support for that to ccu_nkm. I should point out that limiting PLL-MIPI also fixes a regression that was introduced in 6.5, specifically ca1170b69968233b34d26432245eddf7d265186b "clk: sunxi-ng: a64: force select PLL_MIPI in TCON0 mux". This has been bisected and reported by Diego [1]. I don't know the procedure (yet), but probably the fix (if and when accepted) should be backported at least to 6.6 (first broken LTS), 6.7 (stable), and 6.8 (next stable). My suggestion: - In V3 of this series, I will reorder the patches, so that what is now PATCH 3 and 4 becomes 1 and 2 respectively, so that they can be applied to 6.6 more easily. - Maxime, IIUC you requested some refactoring for handling the rate limits [2]. I propose, we use my current proposal as-is, and I will do a follow-up series for the refactoring. Please let me know how you would like me to proceed. Thanks, Frank [1]: https://groups.google.com/g/linux-sunxi/c/Rh-Uqqa66bw [2]: https://lore.kernel.org/all/exb2lvjcozak5fayrgyenrd3ntii4jfxgvqork4klyz5pky2aq@dj2zyw5su6pv/ > > Signed-off-by: Frank Oltmanns > --- > drivers/clk/sunxi-ng/ccu_nkm.c | 13 +++++++++++++ > drivers/clk/sunxi-ng/ccu_nkm.h | 2 ++ > 2 files changed, 15 insertions(+) > > diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c > index 1168d894d636..7d135908d6e0 100644 > --- a/drivers/clk/sunxi-ng/ccu_nkm.c > +++ b/drivers/clk/sunxi-ng/ccu_nkm.c > @@ -181,6 +181,12 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux, > if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV) > rate *= nkm->fixed_post_div; > > + if (nkm->min_rate && rate < nkm->min_rate) > + rate = nkm->min_rate; > + > + if (nkm->max_rate && rate > nkm->max_rate) > + rate = nkm->max_rate; > + > if (!clk_hw_can_set_rate_parent(&nkm->common.hw)) > rate = ccu_nkm_find_best(*parent_rate, rate, &_nkm, &nkm->common); > else > @@ -220,6 +226,13 @@ static int ccu_nkm_set_rate(struct clk_hw *hw, unsigned long rate, > _nkm.min_m = 1; > _nkm.max_m = nkm->m.max ?: 1 << nkm->m.width; > > + > + if (nkm->min_rate && rate < nkm->min_rate) > + rate = nkm->min_rate; > + > + if (nkm->max_rate && rate > nkm->max_rate) > + rate = nkm->max_rate; > + > ccu_nkm_find_best(parent_rate, rate, &_nkm, &nkm->common); > > spin_lock_irqsave(nkm->common.lock, flags); > diff --git a/drivers/clk/sunxi-ng/ccu_nkm.h b/drivers/clk/sunxi-ng/ccu_nkm.h > index c409212ee40e..358a9df6b6a0 100644 > --- a/drivers/clk/sunxi-ng/ccu_nkm.h > +++ b/drivers/clk/sunxi-ng/ccu_nkm.h > @@ -27,6 +27,8 @@ struct ccu_nkm { > struct ccu_mux_internal mux; > > unsigned int fixed_post_div; > + unsigned long min_rate; > + unsigned long max_rate; > unsigned long max_m_n_ratio; > unsigned long min_parent_m_ratio; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel