Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7080198rwr; Tue, 25 Apr 2023 07:53:22 -0700 (PDT) X-Google-Smtp-Source: AKy350YmXEQ3XoVN4nU2JgB3BnVw/n7eKsh5fhO3d9FdE+govQXIzMHZJYkwUg9UUqxuoilGC81I X-Received: by 2002:a17:902:f28d:b0:1a5:2993:8aa6 with SMTP id k13-20020a170902f28d00b001a529938aa6mr16283802plc.63.1682434401901; Tue, 25 Apr 2023 07:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682434401; cv=none; d=google.com; s=arc-20160816; b=r7ZLxXxII+ZvVs0L3EzTjUAE6kW+nibjzRKttgJXNIub6EIZoJaCGx7i/mZMHs9G2i PUeVKV05P6G+gBqB6aejtvi7WAThCT+NaX83GpK1gUtKsK1DzYSOhXXkGDdtG7/Qqh94 m4Dxqm3gu+qi0mJ+bOo8c/UqpmiJgEulTBhQDilkzPSnUrzVSC42FvS3U9Ifo0ZKaXIN Pl7U5s+8L2QGe1XfN1qvul6urkMK1WdasJpbi3T/NpaBM9d7q2+Uv6q5LVy7OJ+DrcgF N0mO+K22BrGrumzQLrC5TgZPTcG4zQrxzE44li33oIsXsVgDgtyU7j+y39MVyc/HtEu7 G0zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=2Z9xscxrsAsgngjIzMB6+vzGDqIX8rHhJnudaSYumkM=; b=dToGxSp+AsXqD9UvbKZhbfL0ppWkhIYjF0KVtyi9IrY359EhqPOG9F6LS5kvHvD3Bg 5oRwmsA6BedVTL+jspwwfaemkugW32P3JFNdetdW/m1MNLgETlCQ4TaWuyhhaLlb9mMl Q9ZXpNgBnNbZIpf+leB2tMhW+aHIj7tfWX1OZB8rSsV+S529fjk1dvbuDr2DGC1sAvgc 1Cr1iCwayKiM0+x6wA+qkOMEWUDH4vOdORbnsxwUsodetfg4GBsmRsHuH+sZHK0LPDAb fQ40pnBmkSQl0Ft2mMT+GhIYIpTeaw2w2pfyyU5ddZ3U4Wa/34J7dXKaHCYKi3vOXVOX CBwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=qBJOkoVe; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ZbXzsek9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h6-20020a170902680600b001a69eff58f9si13865861plk.235.2023.04.25.07.52.54; Tue, 25 Apr 2023 07:53:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=qBJOkoVe; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ZbXzsek9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234231AbjDYOsy (ORCPT + 99 others); Tue, 25 Apr 2023 10:48:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231912AbjDYOsg (ORCPT ); Tue, 25 Apr 2023 10:48:36 -0400 Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74634268F; Tue, 25 Apr 2023 07:48:31 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id B9A47582063; Tue, 25 Apr 2023 10:48:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 25 Apr 2023 10:48:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1682434110; x=1682441310; bh=2Z 9xscxrsAsgngjIzMB6+vzGDqIX8rHhJnudaSYumkM=; b=qBJOkoVe+VNibxNNQO VK2js4W7TzTuIpkDDa3BLdnOC7eWX0KgROExYuxUdEFqCJsGyLbF+D2tvbjjep3U bAgos8DrJ/Hjkb2ZGyXZzyFpvNCDW+gofoAROAJGv7CQnlCLqe6ATS1J4MJRcmwg 4Q4K2ZOUhpVU1cAQnmuGP1cxN/fjHKicRyETbAXCNO2Qviwt8gxnXoRRWuv/7jMb lpg2wS+gSdjofHEnqblqp4x8V5wAiRkLnum/Bj+m5Ab2mWfdXh50k0IcR2nmhcwk FuFT4cztt9au15O9HposWQfpC/GQXa6ocvA7cTgvabmtqhnoORgHy7MV3BJ+J4+o madw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1682434110; x=1682441310; bh=2Z9xscxrsAsgn gjIzMB6+vzGDqIX8rHhJnudaSYumkM=; b=ZbXzsek9V7jy7FBZZjfe3bm2cOnrh g8hTeK6Fhh/HecH47BxVkmvQT4XP9+M+x5KplHQbt5qHnZNNXyfRp06v//jCH0RC DUCYVonbAkK2V/lr/TciWCARVwImuF5DwfEBVrzgz0SHl4MSBuyPKdc91oYeLqSY pE8IfifJ7qSu7D2RWCrnrGGBDOMDaHkY8R6kvjVE+3WFWd4tRjO7Xt6yE3jhSCc/ Aij9bWtJ1nykUzu0l0UP7BqeLIIqSMgUzPkplevnEdX0QwHjeP3gh+71Je/iz0dF +ymAW48RTZj+2K+0DcXQ9oCXzPQ8kyrHTzGj8aWYJ9U2KnGQiFEba+s3w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeduvddgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtsfertddtvdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeeuveduheeutdekvefgudevjeeufedvvdevhfejgfelgfdtkeevueegteek gfelfeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 25 Apr 2023 10:48:28 -0400 (EDT) Date: Tue, 25 Apr 2023 16:48:27 +0200 From: Maxime Ripard To: Dinh Nguyen Cc: Michael Turquette , Stephen Boyd , Andreas =?utf-8?Q?F=C3=A4rber?= , Manivannan Sadhasivam , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Max Filippov , Charles Keepax , Richard Fitzgerald , Maxime Coquelin , Alexandre Torgue , Luca Ceresoli , David Lechner , Sekhar Nori , Abel Vesa , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Matthias Brugger , Geert Uytterhoeven , Peter De Schrijver , Prashant Gaikwad , Thierry Reding , Jonathan Hunter , Ulf Hansson , Linus Walleij , David Airlie , Daniel Vetter , Vinod Koul , Kishon Vijay Abraham I , Alessandro Zummo , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Paul Cercueil , Orson Zhai , Baolin Wang , Chunyan Zhang , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno , linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, patches@opensource.cirrus.com, linux-stm32@st-md-mailman.stormreply.com, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-phy@lists.infradead.org, linux-rtc@vger.kernel.org, linux-sunxi@lists.linux.dev, alsa-devel@alsa-project.org, linux-mips@vger.kernel.org Subject: Re: [PATCH v3 29/65] clk: socfpga: gate: Add a determine_rate hook Message-ID: References: <20221018-clk-range-checks-fixes-v3-0-9a1358472d52@cerno.tech> <20221018-clk-range-checks-fixes-v3-29-9a1358472d52@cerno.tech> <679921ee-98d4-d6ef-5934-e009fd4b31fc@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="635dxoh2qhipywob" Content-Disposition: inline In-Reply-To: <679921ee-98d4-d6ef-5934-e009fd4b31fc@kernel.org> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --635dxoh2qhipywob Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Dinh, On Mon, Apr 24, 2023 at 01:32:28PM -0500, Dinh Nguyen wrote: > On 4/4/23 05:11, Maxime Ripard wrote: > > The SoCFGPA gate clock implements a mux with a set_parent hook, but > > doesn't provide a determine_rate implementation. > >=20 > > This is a bit odd, since set_parent() is there to, as its name implies, > > change the parent of a clock. However, the most likely candidate to > > trigger that parent change is a call to clk_set_rate(), with > > determine_rate() figuring out which parent is the best suited for a > > given rate. > >=20 > > The other trigger would be a call to clk_set_parent(), but it's far less > > used, and it doesn't look like there's any obvious user for that clock. > >=20 > > So, the set_parent hook is effectively unused, possibly because of an > > oversight. However, it could also be an explicit decision by the > > original author to avoid any reparenting but through an explicit call to > > clk_set_parent(). > >=20 > > The latter case would be equivalent to setting the flag > > CLK_SET_RATE_NO_REPARENT, together with setting our determine_rate hook > > to __clk_mux_determine_rate(). Indeed, if no determine_rate > > implementation is provided, clk_round_rate() (through > > clk_core_round_rate_nolock()) will call itself on the parent if > > CLK_SET_RATE_PARENT is set, and will not change the clock rate > > otherwise. __clk_mux_determine_rate() has the exact same behavior when > > CLK_SET_RATE_NO_REPARENT is set. > >=20 > > And if it was an oversight, then we are at least explicit about our > > behavior now and it can be further refined down the line. > >=20 > > Signed-off-by: Maxime Ripard > > --- > > drivers/clk/socfpga/clk-gate.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > >=20 > > diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-g= ate.c > > index 32ccda960f28..cbba8462a09e 100644 > > --- a/drivers/clk/socfpga/clk-gate.c > > +++ b/drivers/clk/socfpga/clk-gate.c > > @@ -110,6 +110,7 @@ static unsigned long socfpga_clk_recalc_rate(struct= clk_hw *hwclk, > > static struct clk_ops gateclk_ops =3D { > > .recalc_rate =3D socfpga_clk_recalc_rate, > > + .determine_rate =3D __clk_mux_determine_rate, > > .get_parent =3D socfpga_clk_get_parent, > > .set_parent =3D socfpga_clk_set_parent, > > }; > > @@ -166,7 +167,7 @@ void __init socfpga_gate_init(struct device_node *n= ode) > > init.name =3D clk_name; > > init.ops =3D ops; > > - init.flags =3D 0; > > + init.flags =3D CLK_SET_RATE_NO_REPARENT; > > init.num_parents =3D of_clk_parent_fill(node, parent_name, SOCFPGA_M= AX_PARENTS); > > if (init.num_parents < 2) { > >=20 >=20 > This patch broke SoCFPGA boot serial port. The characters are mangled. Do you have any other access to that board? If so, could you dump clk_summary in debugfs with and without that patch? Maxime --635dxoh2qhipywob Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCZEfoOwAKCRDj7w1vZxhR xavIAP9NdWOgKUDjN4zLo7wwwqFUwBI6vcLYDH178vQMtvLupgD9GDdlERsfJpng mzdl0IfdqknQqk5qHgVllUa6sstbpgY= =0zSO -----END PGP SIGNATURE----- --635dxoh2qhipywob--