Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3341209rwl; Mon, 27 Mar 2023 12:35:33 -0700 (PDT) X-Google-Smtp-Source: AKy350ZbLSEPtg81bYVdq72iaHSorXmCQCSDBooecA2TeC9Yf+NyuK7aeQyAte3rWoS2UFsWfWZV X-Received: by 2002:a17:90a:191c:b0:240:973d:b436 with SMTP id 28-20020a17090a191c00b00240973db436mr1051828pjg.49.1679945733053; Mon, 27 Mar 2023 12:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679945733; cv=none; d=google.com; s=arc-20160816; b=BUn5PO5WTxbpa/kxmPilksZhYP4Sd9mm9lkRBf8/MgO4/alUDhEI0lSCQorPL8OawB CoIIsjT9ln0UB4cgisJ4R58oOrksoAObRK0CSN5fBu24qmq4DXWu7QxBf+XvEofQoWzw mN6YRZa8ezgS3ukXDTG3TOwe+1qb0P2YEiD1dfKHOkGJDNZIT3Ck69AL5GRPexF85Ty/ 93n1dVgZ2UAjvlzVHkaLNbgItZDWMDvKAc9HKZRYpNA5AegIq1wmyuwj5QQA3GQZaqyQ tr/zVrgYhpejqM6NX5XC2zahpsgIFr1i1KBy29i/IRycpAIcZZaED6DOw6J4TolJySId KmjA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature:dkim-signature; bh=rUuK9HXT1QKP+JaV2sHZBw1jLvvNj/LeTVlVzz2mgnE=; b=l1QxzQx066PoJeYvCJVJH9IU+pRbVBfR+62XJQFqmK0kEs7GWQmSOs5n5+EgNtHmHR c2WPivuwZTq8nBx1wdOSxR7vV2i3SEx8x2ZSRnPf7SbejTaitzymjCVewwI1WahUngQ9 SNofWpbwdRKIpk4FvY/jP0xz4x58xwuaJW1JLTEb5+IMvd2WkPPubnK5qVzGTiMo8fWu sVsuan3axsmpXhktYYsyp0SefYbLLQq+orTGCsSxSCaYo5FUUaJoBbXMJ/xaZhwbRJVW AIQpgdlCKuEjv7bsKoRWw//qwRZKtTnaYmiSKS4l0MVvhzZQKoQTcZ5OOZe72ER5lBYB Vbuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=Gbu8P4ud; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=SHHB4k7b; 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 lb13-20020a170902fa4d00b001a05a17d067si20682601plb.468.2023.03.27.12.35.21; Mon, 27 Mar 2023 12:35:33 -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=fm3 header.b=Gbu8P4ud; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=SHHB4k7b; 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 S232013AbjC0Tay (ORCPT + 99 others); Mon, 27 Mar 2023 15:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjC0Taw (ORCPT ); Mon, 27 Mar 2023 15:30:52 -0400 X-Greylist: delayed 372 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 27 Mar 2023 12:30:51 PDT Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5657A2D48; Mon, 27 Mar 2023 12:30:51 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id A10135821C9; Mon, 27 Mar 2023 15:24:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 27 Mar 2023 15:24:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding: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=fm3; t= 1679945075; x=1679952275; bh=rUuK9HXT1QKP+JaV2sHZBw1jLvvNj/LeTVl Vzz2mgnE=; b=Gbu8P4udsMzoUHOjBbc5vfZkP8tmap7dDKr2UbNlg1rixDocDy1 FxnzMOf4IOE2QfpQC16ztGYJPxILJkIxjIgvAYZvE6YKh8ByrZaG/DwGgBebbWeR u897wwvNEQblafmWFWlheo89ARPXU3Y8oogaRB7FitYdT+Ut11wADq6gdu2WovDh Xkmp8I7I9FIQMArX6acMwEXaNFUqd2HKMXcH43MHmPOzshN26/iirV1eH6W3dVXI 8/qFTx4K/XYsgt3TO6s0Awb2KVJUO/QYpQYZyPru8lsOFL1AaMAGCylG/7RBI5k9 jN2zsyhGhjzCZHGorsCFbB/6Ikisoduw5rw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :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=fm2; t= 1679945075; x=1679952275; bh=rUuK9HXT1QKP+JaV2sHZBw1jLvvNj/LeTVl Vzz2mgnE=; b=SHHB4k7bT/dpA/WpBJ4y6Me/WnLbpnFXIndTiaB8/gRhPh84gMh BWWBeQ2XwYOIN72SfXrmMvw1Fp7uf/LOu2PSFypexIyJHggZzMGs7l6ee1zSHLSh oDdQ+vdPBe9KNPXErhfHevDOs1nDqM2OVelCWFp97TAwMIVY0/2/h3xlmXqOtiYf EVwH2yJfjFhnXvgqDRNyzHjPstZZOaYq3QFTE2qxYXpu0A46u0Mm1LUIMjT71nea MN2+d/lsVf8chYLWOQNX2owgkOwLov/Ep9ne8iDdinid6yyrileqeAyQzZn48c9N Q0qZYiL21tuinlqT4OtghVeAeGKaikoV2ow== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdehvddgudefkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtugfgjgesthhqredttddtvdenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeetgfelgefggeekkefggfeludeiudffjeffgeevveekjedukedtudeu teefteefgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 Mar 2023 15:24:32 -0400 (EDT) Date: Mon, 27 Mar 2023 21:24:30 +0200 From: Maxime Ripard To: Aidan MacDonald Cc: Stephen Boyd , Paul Cercueil , Maxime Coquelin , Chen-Yu Tsai , Daniel Vetter , Nicolas Ferre , Thierry Reding , Jaroslav Kysela , Shawn Guo , Fabio Estevam , Ulf Hansson , Claudiu Beznea , Michael Turquette , Dinh Nguyen , Chunyan Zhang , Manivannan Sadhasivam , Andreas =?utf-8?Q?F=C3=A4rber?= , Jonathan Hunter , Abel Vesa , Charles Keepax , Alessandro Zummo , Peter De Schrijver , Orson Zhai , Alexandre Torgue , Prashant Gaikwad , Liam Girdwood , Alexandre Belloni , Samuel Holland , Matthias Brugger , Richard Fitzgerald , Vinod Koul , NXP Linux Team , Sekhar Nori , Kishon Vijay Abraham I , Linus Walleij , Takashi Iwai , David Airlie , Luca Ceresoli , Jernej Skrabec , Pengutronix Kernel Team , Baolin Wang , David Lechner , Sascha Hauer , Mark Brown , Max Filippov , Geert Uytterhoeven , linux-stm32@st-md-mailman.stormreply.com, alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org, linux-mips@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-actions@lists.infradead.org, linux-clk@vger.kernel.org, AngeloGioacchino Del Regno , patches@opensource.cirrus.com, linux-tegra@vger.kernel.org, linux-rtc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH v2 56/65] clk: ingenic: cgu: Switch to determine_rate Message-ID: <20230327192430.b2cp3yyrkzy4g4vw@penduick> References: <80VTKR.CE8RVN8M3ZYK3@crapouillou.net> <20221104145946.orsyrhiqvypisl5j@houat> <20221107085417.xrsh6xy3ouwdkp4z@houat> <20221109110045.j24vwkaq3s4yzoy3@houat> <06a293adc75990ed3e297b076fc38d8a.sboyd@kernel.org> <20230324111959.frjf4neopbs67ugd@houat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 On Fri, Mar 24, 2023 at 08:58:48PM +0000, Aidan MacDonald wrote: > >> My suggestion: add a per-clock bitmap to keep track of which parents > >> are allowed. Any operation that would select a parent clock not on the > >> whitelist should fail. Automatic reparenting should only select from > >> clocks on the whitelist. And we need new DT bindings for controlling > >> the whitelist, for example: > >> > >> clock-parents-0 =3D <&clk1>, <&pll_c>; > >> clock-parents-1 =3D <&clk2>, <&pll_a>, <&pll_b>; > >> > >> This means that clk1 can only have pll_c as a parent, while clk2 can > >> have pll_a or pll_b as parents. By default every clock will be able > >> to use any parent, so a list is only needed if the machine needs a > >> more restrictive policy. > >> > >> assigned-clock-parents should disable automatic reparenting, but allow > >> explicit clk_set_parent(). This will allow clock drivers to start doing > >> reparenting without breaking old DTs. > > > > I'm generally not a fan of putting all these policies in the device > > tree. Do you have an example where it wouldn't be possible to do exactly > > this from the driver itself? >=20 > I'm confused. What's implicit in the example is clk1 and clk2 might > have *other* possible choices of parent clock and the device tree is > limiting what the OS is allowed to choose. > > Why would you put such arbitrary limitations into the driver? Why would we put such arbitrary limitations in the firmware? As this entire thread can attest, people are already using the device tree to work around the limitations of the Linux driver, or reduce the features of Linux because they can rely on the device tree. Either way, it's linked to the state of the Linux driver, and any other OS or Linux version could very well implement something more dynamic. > They would be different from machine to machine, unless the clock > tree is so simple there is only *one* meaningful way to configure > it. If we look at the device trees we have in-tree, most of the users of assigned-clocks are the same from one board to another. > Most SoCs are complicated enough that there will be tradeoffs > depending on what peripherals you are using (typically a single > machine will not use *every* peripheral device provided by the SoC). We already have APIs to lock parents or rates on a given clock from the consumer. It's far superior (feature-wise) than what the device tree will ever offer because it's code, and it depends on the usage already since an unused driver won't probe. Maxime