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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00CE7C4360F for ; Wed, 27 Mar 2019 14:35:22 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id B88AB2087C for ; Wed, 27 Mar 2019 14:35:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="G8PRr7fS"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="w/J5/56q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B88AB2087C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GforFHaB1fbBBKhtZjvmkRVkmEsFpJ/pJr+Viqoqit0=; b=G8PRr7fSJ+BknU z3dE05LJvtgFVnsPqr6yO1Bqm5N4RD60Cp3h9NJeXkOXMYqG4ya9XFiHi3ulhcWnGqRcE5QqFlOxh rQIlzihf54B65qZRHANQkcw0wwzjylqyuIBtOiPNzs31zObevaYPVoaHwC6z4omVHONB6LLaEgeT3 u6iFFl9HXsR0kRQUsfEVfH7QcBT7+BZN8jF4YqOuf4i2xTykj1vIbbhgEr/+bP2Bzz8VroLMZzgKW 9MOwXw4Rhqfl0Tg2gmmDUNyLpwd6Uj/Ryrf0KSFQjuvgS8aYnNXmGG7Ht63HWlsm5Wt7GtnihjU4X xAD50GLfF8Ibvci04F8g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h99e6-0003Za-Ro; Wed, 27 Mar 2019 14:35:14 +0000 Received: from mail-eopbgr30069.outbound.protection.outlook.com ([40.107.3.69] helo=EUR03-AM5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h99e0-0002mM-2t for linux-arm-kernel@lists.infradead.org; Wed, 27 Mar 2019 14:35:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DpUdGggPATbbTdartJZ155MZXeTbvR4oabMwke5C1v4=; b=w/J5/56qtN2RnAAXmeLY4SFCtCORocpasEtRXVjjl9RIF/nmlDgO6vRnkOGSJ8EU4L/VpGNv23zUD4S2jyRqDlidCKwzhh/sjMj4vVv/DE0jYTf/AuXGtpucYcqYpO+0PL3Dut6EErdlmjHyvuEdBKJrdYhy+4zWcqHrbCw2SB8= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.92.158) by AM0PR04MB4097.eurprd04.prod.outlook.com (52.134.95.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Wed, 27 Mar 2019 14:35:02 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::4514:91e2:16b7:ee2b]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::4514:91e2:16b7:ee2b%4]) with mapi id 15.20.1750.014; Wed, 27 Mar 2019 14:35:02 +0000 From: Aisheng Dong To: Rob Herring Subject: RE: [PATCH 1/4] dt-bindings: firmware: imx-scu: new binding to parse clocks from device tree Thread-Topic: [PATCH 1/4] dt-bindings: firmware: imx-scu: new binding to parse clocks from device tree Thread-Index: AQHUyg/ILVDNycVxtkiL1Tyb3hPiwaYeILeAgAEa7/A= Date: Wed, 27 Mar 2019 14:35:02 +0000 Message-ID: References: <1550771836-10014-1-git-send-email-aisheng.dong@nxp.com> <1550771836-10014-2-git-send-email-aisheng.dong@nxp.com> <20190326134715.GA4055@bogus> In-Reply-To: <20190326134715.GA4055@bogus> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisheng.dong@nxp.com; x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d10f4f5d-37cf-4b60-8e6d-08d6b2c165c8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR04MB4097; x-ms-traffictypediagnostic: AM0PR04MB4097: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(396003)(346002)(39860400002)(366004)(199004)(189003)(51914003)(14454004)(3846002)(99286004)(6116002)(11346002)(446003)(476003)(7736002)(186003)(33656002)(8936002)(9686003)(74316002)(25786009)(52536014)(102836004)(6246003)(305945005)(66066001)(4326008)(6916009)(81156014)(53936002)(81166006)(8676002)(68736007)(97736004)(26005)(55016002)(7696005)(478600001)(5660300002)(76176011)(106356001)(6506007)(6436002)(71190400001)(54906003)(71200400001)(486006)(44832011)(2906002)(14444005)(256004)(316002)(86362001)(229853002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4097; H:AM0PR04MB4211.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: gbuvlq2K5R2DhMFACCEmbZcOg5mn06RLi7ls/bPlVx+f5NKZ44tbq1FVRt5p7yw0BqsbwvB13129PZvj/e8g3Q9VoD0z1T5fV2V0P+wxYrLN30PhoCpRkPL+LCoVmWRaj6rk14bRhSRfnr5kOMzdO3UG+ALmdNHJWjAahStelgqMIEYW0mTitRzZjZsPQyUd7ngSkdih/8jvtkmnoKI3y7+ZU5u3v8ShAgexvvIER9LnNyCpLdWjwBKkkmzBisgV4rC69R2pU2/Vpp2ZSvMqbnhk4uK5F1f9Esn5Yh3GLX6wzmWmWNcGhNwhAR1ehtOS1JPUkHmk4bkUgBzLMbc48IC6T+Z9Tmg/ct0cIvJ/ungR7v1ZRcV9R0VE+vhUcbDmSeAi65Q37fActnt/3btF2zouRlnsGgvrGy57CawIG8w= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d10f4f5d-37cf-4b60-8e6d-08d6b2c165c8 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 14:35:02.4057 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4097 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190327_073508_222655_332C0DEF X-CRM114-Status: GOOD ( 30.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "devicetree@vger.kernel.org" , "sboyd@kernel.org" , "mturquette@baylibre.com" , dl-linux-imx , "kernel@pengutronix.de" , Fabio Estevam , "shawnguo@kernel.org" , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org > From: Rob Herring [mailto:robh@kernel.org] > Sent: Tuesday, March 26, 2019 9:47 PM > On Thu, Feb 21, 2019 at 06:03:43PM +0000, Aisheng Dong wrote: > > There's a few limitations on one cell clock binding (#clock-cells = > > <1>) that we have to define all clock IDs for device tree to reference. > > This may cause troubles if we want to use common clock IDs for multi > > platforms support when the clock of those platforms are mostly the same. > > e.g. Current clock IDs name are defined with SS prefix. However the > > device may reside in different SS across CPUs, that means the SS > > prefix may not valid anymore for a new SoC. Furthermore, the device > > availability of those clocks may also vary a bit. > > > > For such situation, We formerly planned to add all new IDs for each SS > > and dynamically check availability for different SoC in driver. That > > can be done but that may involve a lot effort and may result in more > > changes and duplicated code in driver, also make device tree > > upstreaming hard which depends on Clock IDs. > > > > To relief this situation, we want to move the clock definition into > > device tree which can fully decouple the dependency of Clock ID > > definition from device tree. And no frequent changes required in clock driver > any more. > > > > Then we can use the existence of clock nodes in device tree to address > > the device and clock availability differences across different SoCs. > > > > For SCU clocks, only two params required, thus two new property created: > > rsrc-id = ; > > clk-type = ; > > > > And as we want to support clock set parent function, 'clocks' property > > is also used to pass all the possible input parents. > > > > Cc: Rob Herring > > Cc: Stephen Boyd > > Cc: Shawn Guo > > Cc: Sascha Hauer > > Cc: Michael Turquette > > Cc: devicetree@vger.kernel.org > > Signed-off-by: Dong Aisheng > > --- > > .../devicetree/bindings/arm/freescale/fsl,scu.txt | 29 > ++++++++++++++++------ > > include/dt-bindings/firmware/imx/rsrc.h | 17 > +++++++++++++ > > 2 files changed, 38 insertions(+), 8 deletions(-) > > > > diff --git > > a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt > > b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt > > index 72d481c..2816789 100644 > > --- a/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt > > +++ b/Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt > > @@ -78,6 +78,19 @@ Required properties: > > "fsl,imx8qm-clock" > > "fsl,imx8qxp-clock" > > followed by "fsl,scu-clk" > > +- #clock-cells: Should be 0. > > +- rsrc-id: Resource ID associated with this clock > > +- clk-type: Type of this clock. > > + Refer to for > > + available clock types supported by SCU. > > Can't you just make these 2 values clock cells? I'm all for getting rid of made > up clock numbers. > Thanks for the agreement to remove clock IDs. The 2 values clock cell seems not the best approach for i.MX because it still needs to define all clocks in the driver which is exactly we want to avoid now due to some special HW characteristic: 1. clock resources may be allocated to different SW execution partition by firmware and A core may not have access rights for those clocks not belong to its partition. So we want to describe them in DT according to the partition configuration. 2. Each clock is associated with a different power domain which is better to be described in device tree. And clock state will be lost and need restore after power cycle of the domain. Based on above requirements, do you think we can do as below? //LSIO SS lsio_scu_clk: lsio-scu-clock-controller { compatible = "fsl,imx8qxp-clock", "fsl,scu-clk"; fspi0_clk: clock-fspi0{ #clock-cells = <0>; rsrc-id = ; clk-type = ; power-domains = <&pd IMX_SC_R_FSPI_0>; }; fspi1_clk: clock-fspi1{ ... }; ... }; /* LPCG clocks */ lsio_lpcg_clk: lsio-lpcg-clock-controller { compatible = "fsl,imx8qxp-lpcg"; pwm0_lpcg: clock-controller@5d400000 { reg = <0x5d400000 0x10000>; #clock-cells = <1>; clocks = <&pwm0_clk>, <&pwm0_clk>, <&pwm0_clk>, <&lsio_bus_clk>, <&pwm0_clk>; bit-offset = <0 4 16 20 24>; clock-output-names = "pwm0_lpcg_ipg_clk", "pwm0_lpcg_ipg_hf_clk", "pwm0_lpcg_ipg_s_clk", "pwm0_lpcg_ipg_slv_clk", "pwm0_lpcg_ipg_mstr_clk"; power-domains = <&pd IMX_SC_R_PWM_0>; status = "disabled"; }; pwm1_lpcg: clock-controller@5d410000 { ... } ... }; And for users, it could simply be: usdhc1: mmc@5b010000 { clocks = <&sdhc0_lpcg 1>, <&sdhc0_lpcg 0>, <&sdhc0_lpcg 2>; clock-names = "ipg", "per", "ahb"; assigned-clocks = <&sdhc0_clk>; assigned-clock-rates = <200000000>; .... }; Regards Dong Aisheng > > +- clock-output-names: Shall be the corresponding names of the outputs. > > + > > +Optional properties: > > +- clocks: Shall be the input parent clock(s) phandle for the clock. > > + For multiplexed clocks, the list order must match the hardware > > + programming order. > > + > > +Legacy Clock binding (DEPRECATED): > > - #clock-cells: Should be 1. Contains the Clock ID value. > > - clocks: List of clock specifiers, must contain an entry for > > each required entry in clock-names @@ -129,6 +142,13 @@ > lsio_mu1: > > mailbox@5d1c0000 { > > #mbox-cells = <2>; > > }; > > > > +uart0_clk: uart0-clock-controller { > > + compatible = "fsl,imx8qxp-scu-pd", "fsl,scu-clk"; > > + #clock-cells = <0>; > > + rsrc-id = ; > > + clk-type = ; > > +}; > > + > > firmware { > > scu { > > compatible = "fsl,imx-scu"; > > @@ -143,11 +163,6 @@ firmware { > > &lsio_mu1 1 2 > > &lsio_mu1 1 3>; > > > > - clk: clk { > > - compatible = "fsl,imx8qxp-clk", "fsl,scu-clk"; > > - #clock-cells = <1>; > > - }; > > - > > iomuxc { > > compatible = "fsl,imx8qxp-iomuxc"; > > > > @@ -175,8 +190,6 @@ serial@5a060000 { > > ... > > pinctrl-names = "default"; > > pinctrl-0 = <&pinctrl_lpuart0>; > > - clocks = <&clk IMX8QXP_UART0_CLK>, > > - <&clk IMX8QXP_UART0_IPG_CLK>; > > - clock-names = "per", "ipg"; > > + clocks = <&uart0_clk>; > > power-domains = <&pd IMX_SC_R_UART_0>; }; diff --git > > a/include/dt-bindings/firmware/imx/rsrc.h > > b/include/dt-bindings/firmware/imx/rsrc.h > > index 4481f2d..f650fc3 100644 > > --- a/include/dt-bindings/firmware/imx/rsrc.h > > +++ b/include/dt-bindings/firmware/imx/rsrc.h > > @@ -556,4 +556,21 @@ > > #define IMX_SC_R_VPU 540 > > #define IMX_SC_R_LAST 541 > > > > +/* > > + * Defines for SC PM CLK > > + */ > > +#define IMX_SC_PM_CLK_SLV_BUS 0 /* Slave bus clock */ > > +#define IMX_SC_PM_CLK_MST_BUS 1 /* Master bus clock */ > > +#define IMX_SC_PM_CLK_PER 2 /* Peripheral clock */ > > +#define IMX_SC_PM_CLK_PHY 3 /* Phy clock */ > > +#define IMX_SC_PM_CLK_MISC 4 /* Misc clock */ > > +#define IMX_SC_PM_CLK_MISC0 0 /* Misc 0 clock */ > > +#define IMX_SC_PM_CLK_MISC1 1 /* Misc 1 clock */ > > +#define IMX_SC_PM_CLK_MISC2 2 /* Misc 2 clock */ > > +#define IMX_SC_PM_CLK_MISC3 3 /* Misc 3 clock */ > > +#define IMX_SC_PM_CLK_MISC4 4 /* Misc 4 clock */ > > +#define IMX_SC_PM_CLK_CPU 2 /* CPU clock */ > > +#define IMX_SC_PM_CLK_PLL 4 /* PLL */ > > +#define IMX_SC_PM_CLK_BYPASS 4 /* Bypass clock */ > > + > > #endif /* __DT_BINDINGS_RSCRC_IMX_H */ > > -- > > 2.7.4 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel