Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6015201imb; Fri, 8 Mar 2019 07:30:03 -0800 (PST) X-Google-Smtp-Source: APXvYqymtTpbaZ5zNWXeS2N6myB89me6nBG4iYjiv+qMW9z/FUgMmBKPchSZ5J0eZXMkDSZ7w+HB X-Received: by 2002:a17:902:ab8e:: with SMTP id f14mr19213169plr.84.1552059003878; Fri, 08 Mar 2019 07:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552059003; cv=none; d=google.com; s=arc-20160816; b=rAvDMaXMSNw2IMLGZJ1fLgH+29gE/9gLmeZd06/QzJ339fB8noDd4r9lDbIo2j4PRK 1ASs2DCVwX2QyRy79XRcGy6wMzDS1fVBxheKz1kWruMoQHrSraWVuhSOpizsDPa09YN0 sa8vSTJv7FsrLFG7trkLEdUJ7nuKXdvfpttSM30k1N3zMwRJdv5LUxM8zHweQqLpljut tfeb48XupTDjNu9Mss4GKl0F+Wj1sBQzbO5FckS9YN0MjTy8NEFznULMVWrxpQlzRCfx 4gZEJVDIHdOO6KGqwji0WtOE65N5VCbkwI4jq4sMFPaa+Q8JmviVTSwZ6ImokNEUxTPd OHFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:user-agent:message-id:to:cc:subject :from:references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=wSfZtx63q1PUr7WrOqnTGAEu8OzgeKG+x07R7YH2K5w=; b=dhGT4J8GfExNkhRR8rjyyMSxQkIse/QUiTJSUQHtMt1UAirujTO7yIjeJXGg7qLRYi rQ9ExLj9ZLgrRKSFeHFYG2iOGoM8qIDjr02NXqXiBzWDzWgLNJJ3IvWhxviqVvxPLqu+ CQYSTV+BwJcOIHChaGqBpmhBqadYf3zO4HLaBygAnnXiHHJE9E9tA3AU2BDZ20A99Mfv 4XXqtYcOAykR+dhPUraAs8GUOIaW50kesRkwBDHPehEhwKEB42KsCQ9cjVdtGC1thXYC YkVL8o26Yn2sg+f8lDsC2Y+Ba0wHZ4arbW7amEScXWtwUIOC0pJl/Mq6Dt0B2FaemRma wuFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H9SaaHdD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si7061286pgn.481.2019.03.08.07.29.48; Fri, 08 Mar 2019 07:30:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H9SaaHdD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726550AbfCHP3I (ORCPT + 99 others); Fri, 8 Mar 2019 10:29:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:35702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbfCHP3I (ORCPT ); Fri, 8 Mar 2019 10:29:08 -0500 Received: from localhost (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 88B35208E4; Fri, 8 Mar 2019 15:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552058946; bh=Cq7V0LT/yRgABFq3DFUFSfbbt9chhLfrnKULUxGommo=; h=In-Reply-To:References:From:Subject:Cc:To:Date:From; b=H9SaaHdDVIz4Un1/QSob90griwlhnRIQLBpzlm8fl5U+/a260UQWO4VRPAoCod/zx ZfNS7P1RR0iSxOfmaooGwlCW6AoUXDE59YuVhp3fPVtbNeyW8hLzp1FWk1Xv9MXXd3 Vpb5NbnaYro2aQFnnvzQSYk4XU/N6d1uC5tdggR0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20190306130941.dqf3swx66bchm5k2@fsr-ub1664-175> References: <1551779342-2640-1-git-send-email-abel.vesa@nxp.com> <155181110921.20095.1641360339603928947@swboyd.mtv.corp.google.com> <20190306130941.dqf3swx66bchm5k2@fsr-ub1664-175> From: Stephen Boyd Subject: Re: [PATCH] dt-bindings: clock: imx8mq: Fix numbering overlaps and gaps Cc: Fabio Estevam , Lucas Stach , Mark Rutland , Patrick Wildt , Rob Herring , Sascha Hauer , Shawn Guo , dl-linux-imx , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Linux Kernel Mailing List To: Abel Vesa Message-ID: <155205894567.20095.2782332899458282059@swboyd.mtv.corp.google.com> User-Agent: alot/0.8 Date: Fri, 08 Mar 2019 07:29:05 -0800 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Abel Vesa (2019-03-06 05:09:42) > On 19-03-05 10:38:29, Stephen Boyd wrote: > > Quoting Abel Vesa (2019-03-05 01:49:16) > > > IMX8MQ_CLK_USB_PHY_REF changes from 163 to 153, this way removing the= gap. > > > All the following clock ids are now decreased by 10 to keep the numbe= ring > > > right. Doing this, the IMX8MQ_CLK_CSI2_CORE is not overlapped with > > > IMX8MQ_CLK_GPT1 anymore. IMX8MQ_CLK_GPT1_ROOT changes from 193 to 183= and > > > all the following ids are updated accordingly. > >=20 > > Why do the numbers need to be consecutive? This looks difficult to merge > > given that the commit that's being "fixed" is in v5.0 and thus the > > integer value of these defines is pretty much an ABI. So if there are > > holes in the space, I suggest we leave them there unless something is > > really wrong or unworkable with that solution. > >=20 >=20 > I would've ignored it but there are a few overlaps. >=20 > #define IMX8MQ_CLK_GPT1 170 > overlaps with: > #define IMX8MQ_CLK_CSI2_CORE 170 >=20 > #define IMX8MQ_CLK_CSI2_PHY_REF 181 > overlaps with: > #define IMX8MQ_CLK_ECSPI3_ROOT 181 >=20 > #define IMX8MQ_CLK_CSI2_ESC 182 > overlaps with: > #define IMX8MQ_CLK_ENET1_ROOT 182 Ok. Are any of the overlaps in use by dtbs right now? >=20 > By removing the gaps, some of the overlaps are also removed. >=20 > I can just get rid of the overlaps and keep the gaps if that makes it mor= e ok > for the stability of the ABI. It's mostly about making sure that any existing dtbs don't have their numbers shifted around. So hopefully any overlapping identifiers aren't in use yet and then those ids can be changed while leaving the ones that are in use how they are. >=20 > > BTW, it would be great if the binding header was generated once and then > > never changed again so that we don't have to spend time on these sorts > > of patches in the future. Please try to fully describe each possible clk > > that might be used with a particular binding instead of adding new clk > > ids over time, especially if you have access to the silicon manufacturer > > documentation and can easily figure out all the clks that are there > > beforehand. > >=20 >=20 > Here is an example of why this is not really doable: clk-sccg-pll.c. > The original design was adding the intermediary clocks like: >=20 > IMX8MQ_SYS1_PLL1_OUT =20 > IMX8MQ_SYS1_PLL1_OUT_DIV =20 > IMX8MQ_SYS1_PLL1_REF_DIV =20 > IMX8MQ_SYS1_PLL2 > IMX8MQ_SYS1_PLL2_DIV =20 > IMX8MQ_SYS1_PLL2_OUT =20 >=20 > And these were just for SYS1_PLL. There are 2 more SYSx_PLL. > Plus the DRAM_PLL, the VIDEO2_PLL and the AUDIO_PLL. >=20 > Since the refactoring of clk-sccg-pll.c, these are not used anymore (or s= hould > not be used). So I would have to remove them, but as you said, it would b= reak > the ABI. Why do you need to remove them? Why can't they just return an error if some driver tries to get those clks after they shouldn't be use anymore? > And this example goes even further with the fact that the PHY_27M > and the mux between the PHY_27M and the OSC_27 are to be controlled by the > display controller driver itself (at this point the PHY_27M is not yet up= stream > and I can't say for sure it will ever be). Basically, what this means is = that=20 > the PHY_27M will have to be exposed as a standalone clock even if it is h= idden > behind a mux which has another clock that can provide the same rate. That > is only because there is some difference in phase (AFAIU) between the OSC= _27M > and the PHY_27M, at the same rate. And this is just one example. It sounds like these are two independent clks that could or couldn't be exposed into the DT numberspace? >=20 > Point being, there is no way of knowing beforehand what intermediary cloc= ks > are needed, even with the silicon manufacturer documentation, until the > driver that makes use of a specific clock actually works. I agree that we don't know what clks are needed beforehand, predicting the future is hard, but that doesn't mean they can't be exposed into the header file if they exist. It doesn't really matter if there are numbers in there or not for clks that shouldn't be used. The provider and the driver implementation need to make the decision to provide them or not to the consumer drivers when they ask for them. It's perfectly valid for new code to start failing those requests because "they shouldn't be used". The header file (really the DT bindings) is the place that decides what the numbers are and what they correspond to.