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=-3.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 3E7CCC10F14 for ; Wed, 10 Apr 2019 17:35:40 +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 137CD2077C for ; Wed, 10 Apr 2019 17:35:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KrRZ4Zyi"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="m2F5a90E" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 137CD2077C 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=tbObTt5xvNX0NSuCw9tfv3MA+6HSv2aNef64WbaV9Ng=; b=KrRZ4Zyi/YQPbH mCXbrn9I/RhINaCJlVnamdLlIg9/VyyHH7GjqgicYvDt4RdPo1C+BlecEG/U1cor8xcahfpq+qos1 rcLz0KUn8JXtEQgGaUSs6XU9p9H3vtV9qN3s4Syj6NPUsqaz5dcz8j6fLIcnPP+rQNRrLmCcmt+wy rUB80v5vt5+YTW5tUQHGjBEKtz90DllmSyzaunzPt4T6eRxlXopcf1MABAAp2I+dndCJb3548bN/j Nez0+BsBNyNiWitQVPPIt4pFU0Rsrn6PNE4Bno4y2s6pakFczBOBe1WHJnxEIGRx9lEwb3XO7WRJ+ LHiGD9lvnAigytCI06/A==; 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 1hEH8M-0004cw-O7; Wed, 10 Apr 2019 17:35:38 +0000 Received: from mail-eopbgr10064.outbound.protection.outlook.com ([40.107.1.64] helo=EUR02-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hEH8H-0004c9-VY for linux-arm-kernel@lists.infradead.org; Wed, 10 Apr 2019 17:35:36 +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=7f7+PWGmxrboDWeJIWZHU8YgqNJj3fE74R22NeEd9RE=; b=m2F5a90E/e6dCvpvYl/FWcvbHipjHJfwdiVFU8nNNNJVB8z0z/+7ndzUWOhfiz0z7deTykHgKx31MVN4WLOVpdaYt5L+xUPXFOePa9+z6y4QiHXJIa2blra4AuNbH+QZIUGf9Vlyy6IbAIufFMZUZHuuqnk/yXgPeArSQY7kn6Q= Received: from AM0PR04MB4211.eurprd04.prod.outlook.com (52.134.92.158) by AM0PR04MB6642.eurprd04.prod.outlook.com (20.179.255.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.16; Wed, 10 Apr 2019 17:35:24 +0000 Received: from AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::8cda:4e52:8e87:8f0e]) by AM0PR04MB4211.eurprd04.prod.outlook.com ([fe80::8cda:4e52:8e87:8f0e%2]) with mapi id 15.20.1792.009; Wed, 10 Apr 2019 17:35:24 +0000 From: Aisheng Dong To: Rob Herring Subject: RE: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: imx-scu: new binding to parse clocks from device tree Thread-Topic: [EXT] Re: [PATCH 1/4] dt-bindings: firmware: imx-scu: new binding to parse clocks from device tree Thread-Index: AQHUyg/ILVDNycVxtkiL1Tyb3hPiwaYeILeAgAEa7/CAFpVVAIAAA8MA Date: Wed, 10 Apr 2019 17:35:24 +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: 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: 4a0bcd88-9414-46bf-f822-08d6bddae9ed x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR04MB6642; x-ms-traffictypediagnostic: AM0PR04MB6642: x-ms-exchange-purlcount: 2 x-microsoft-antispam-prvs: x-forefront-prvs: 00032065B2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(376002)(346002)(396003)(39860400002)(366004)(199004)(189003)(52314003)(51914003)(93886005)(74316002)(52536014)(9686003)(7736002)(30864003)(6246003)(6306002)(6916009)(81156014)(81166006)(99286004)(3846002)(97736004)(6116002)(305945005)(2906002)(86362001)(54906003)(8936002)(68736007)(316002)(55016002)(53936002)(8676002)(26005)(14454004)(14444005)(256004)(6436002)(486006)(5660300002)(476003)(33656002)(229853002)(966005)(11346002)(25786009)(71190400001)(446003)(508600001)(106356001)(53546011)(6506007)(186003)(66066001)(76176011)(7696005)(102836004)(44832011)(105586002)(4326008)(71200400001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB6642; 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: xBYpQXqxci2NQ96sMNziWHu7Bska1PJmLHvOtV6K5Ap4SOBHkDSKmrTy8yTPq12c/y0fOZgj6A8TOhK/lYsvM44uublVyseVkzaSlK+ynv1rGz9MqlXHZHDsappBadpR6q+oMFpxm1pdsO0QDg2nAluHjGFocHYWdOFoAeOmfcNtvEK8mEDZtxdiZCLcGpv3WtsNny20mK2uAvTRRK7tl9ZWjFqi5wsMaKdwC34jatWA4NWrpEZ2sdUXCxmVU0mcB5s/XQFwKstytnuaMtmnplYLZinIxb/FfRHfFE/RuW6gdE0gpNNxkS3LYSmG1N/s+DBeIry9WvgubCPDKxlhP+6YbZAoLKPqXt5ZJ2dOzwyQkP8dqhf5s7Iu/s7hyR1IXfXryoQtb5EIECpnzLMk/WTddZbZXGNELfWqptLajWE= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a0bcd88-9414-46bf-f822-08d6bddae9ed X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Apr 2019 17:35:24.3420 (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: AM0PR04MB6642 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190410_103534_303612_FBE61AEE X-CRM114-Status: GOOD ( 39.24 ) 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: Wednesday, April 10, 2019 11:32 PM > On Wed, Mar 27, 2019 at 9:35 AM Aisheng Dong > wrote: > > > > > 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: > > Why's that? You can walk the DT and extract the 2 cells for each clock present. > That's not any different than walking child nodes here and getting the resource > ids and type. That's not really fast, but if speed is really an issue we can > consider addressing that in ways that extend rather than change the binding. > Yes, it will be much slower. And there may be duplicated parsing for the same SCU clocks in device nodes. e.g. LPCG inputs for each outputs may be the same SCU clock and possible other devices. It's a bit kind of lower efficiency. Furthermore, for unused clocks by device, it then can't be visible by driver, also can't use clock framework auto disable unused function. And it creates a lot complexities in driver implementation to dynamically parse and register clocks to the same controller. So IMHO we'd still like the current simple 0 cells binding. Anyway, if you think 2 cells bindings should be the right direction we have to go, Just please let me know. Then we will go that way rather than stop at here. > > 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. > > Do you have an example? I'd assume you assign peripherals to different > partitions and resource assignment simply follows that. Can clocks not be > available when a peripheral still is? > Yes, resources goes with peripherals assignment. For the real example on MX8QXP MEK board, we assign flexcan to M4 partition, then all flexcan related clocks and power domains can't be access anymore by A core partition. > > 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? > > Can you provide an example that shows the whole hierarchy for a peripheral. > Here you have FSPI, PWM, and MMC. Reviewing SCU clocks and LPCG clocks > separately is not helpful. > Below is an example of sdhc0 in connectivity SS which can show the full hierarchy. /* CONN SS */ conn_subsys: bus@5b000000 { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges = <0x5b000000 0x0 0x5b000000 0x1000000>; /* SCU clocks */ conn_scu_clk: conn-scu-clock-controller { compatible = "fsl,imx8qxp-clock", "fsl,scu-clk"; sdhc0_clk: clock-sdhc0 { #clock-cells = <0>; rsrc-id = ; clk-type = ; clock-output-names = "sdhc0_clk"; power-domains = <&pd IMX_SC_R_SDHC_0>; }; /* other SCU clocks in this SS */ ... } /* LPCG clocks */ conn_lpcg_clk: conn-lpcg-clock-controller { compatible = "fsl,imx8qxp-lpcg"; #address-cells = <1>; #size-cells = <1>; ranges; sdhc0_lpcg: clock-controller@5b200000 { reg = <0x5b200000 0x10000>; #clock-cells = <1>; clocks = <&sdhc0_clk>, <&conn_ipg_clk>, <&conn_axi_clk>; bit-offset = <0 16 20>; clock-output-names = "sdhc0_lpcg_per_clk", "sdhc0_lpcg_ipg_clk", "sdhc0_lpcg_ahb_clk"; power-domains = <&pd IMX_SC_R_SDHC_0>; }; /* other LPCG clocks in this SS */ ... }; usdhc1: mmc@5b010000 { interrupt-parent = <&gic>; interrupts = ; reg = <0x5b010000 0x10000>; clocks = <&sdhc0_lpcg 1>, <&sdhc0_lpcg 0>, <&sdhc0_lpcg 2>; clock-names = "ipg", "per", "ahb"; assigned-clocks = <&sdhc0_clk>; assigned-clock-rates = <200000000>; power-domains = <&pd IMX_SC_R_SDHC_0>; status = "disabled"; }; .... }; > > > > //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>; > > Are the power domain ID and rsrc-id always the same for a clock? So far, yes. I'm still not aware of any clocks use multi power domains. > > > }; > > > > fspi1_clk: clock-fspi1{ > > ... > > }; > > ... > > }; > > > > /* LPCG clocks */ > > lsio_lpcg_clk: lsio-lpcg-clock-controller { > > compatible = "fsl,imx8qxp-lpcg"; > > I think this wrapper node should be removed and the compatible moved into > the child nodes. > Yes, I originally did exactly like that. One benefit of the wrapper is it can save many same compatible strings of the Same type of clocks in the Soc SS dtsi file which is used to handle SoC compatible string difference. e.g https://patchwork.kernel.org/patch/10824563/ imx8qxp-ss-adma.dtsi &uart0_lpcg { compatible = "fsl,imx8qxp-lpcg"; }; &uart1_lpcg { compatible = "fsl,imx8qxp-lpcg"; }; &uart2_lpcg { compatible = "fsl,imx8qxp-lpcg"; }; &uart3_lpcg { compatible = "fsl,imx8qxp-lpcg"; }; ... Just let me know if you think having too many repeat compatible strings Is not problem, then we can remove it. > > 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>; > > Are all LPCG instances the same, but some clocks are missing if the child > peripheral doesn't use certain clocks? IOW, bit 0 is always ipg_clk, bit 24 is > always ipg_mstr_clk? No, It varies on different LPCG clocks. You can refer to sdhc&enet for an example at here: https://patchwork.kernel.org/patch/10824561/ > > Assuming so, 'bit-offset' should be removed and you should either have a fixed > number of clock entries with 0 entries for non-connected clocks or use > clock-names to define which clocks are present (with the same set of defined > names for all LPCG instances). > > > 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"; > > IMO, this is wrong as the names should be relative to the module. So 'ipg_clk', > 'ipg_hf_clk', etc. For one certain LPCG, the output clocks is strictly bound to device. That is how it's named in the HW reference manual. For example: PWM0 pwm0_ipg_clk SC_R_PWM_0/SC_PM_CLK_PER SLSLICE5 LPCG_LSIO_IPS_SYNC_PWM0_REGS So it looks to me better to name to align with the HW doc. Please let me know if you still think it's not okay. Regards Dong Aisheng > > > 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>; > > .... > > }; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel