Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1547110rwb; Fri, 12 Aug 2022 02:51:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR7nGXDraMVQVciHSqbRM0zeuqmrB2MLCO9vOHDKfi1PpDiGHZzpbSE+ftGtILPJzC+FzxsM X-Received: by 2002:a05:6a00:4304:b0:532:3c0f:3597 with SMTP id cb4-20020a056a00430400b005323c0f3597mr3104898pfb.44.1660297913451; Fri, 12 Aug 2022 02:51:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1660297913; cv=pass; d=google.com; s=arc-20160816; b=Fn/h3JT/4ReZHLdpg36rKTTOKVNaKcic1Nybd2MUlBtmu6RnRpQ6JPVYxeFb9ZpHRC V+ZQyhMIjTXhPva4a8FetjLeIKeao7xDBQVGyo0EN5+TWGCEsn9T4QGSV4iblM66kadf Ohx786k8iqv5rvknhTgmgnFROwr8RizXo8it22TCA44wVkI0MvIg1n8vsKo4CImKDKWl NdXyzQeJ7TTXt2BEsTSS5/d2TirbOPCkJclai2FwcUrizIneUpdxqcYxwFIfKyZ+IAAw JpSPdBtj4o5Y5m1hTP5eRxQxuKvQ+Ewtuw7qTnAT7I6t2lfrUg2nnEBsQsv6/oPUXYlf Sr0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=+zhpa3/Owwzeu2gpR2s0xFBmLa4HtwiQWKEuDcElNdU=; b=yQnUp7veWbDyZwDyL/J02j7+GqwqPE2StX3IX3qLpJ8GdYyuYo4J7nQp16vcvCI2oQ TDwJJtennxve+NnotwNTDwjYJLbMI48egZ+5xEPX7FBxcE7wxAjQa7bZUcFS4UbOO4t4 9bJpAGu8eOXSR2Qa8V5bGJ6fpHrQNV/k9EWe11dMTaUxO5he8qJz8yMdoKcuBCPIIghs jLnFk6TBJfFi1vYYWcSGv8mDdkZlKFH1opFs4HTOR1x9dsV4aOGhXlqmsB0N6RRNLdN9 SK7v68y1i7AOjrc1rsvvSUGW0rgYTi+mK4o4sXopCoHhLMopVIwAn5Xed3Ww/lf87fBw 4fWw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=eNfmFyug; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a63fa0b000000b0041c114955b6si1908757pgh.2.2022.08.12.02.51.40; Fri, 12 Aug 2022 02:51:53 -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=@nxp.com header.s=selector2 header.b=eNfmFyug; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237589AbiHLJnO (ORCPT + 99 others); Fri, 12 Aug 2022 05:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235949AbiHLJnL (ORCPT ); Fri, 12 Aug 2022 05:43:11 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80045.outbound.protection.outlook.com [40.107.8.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBBB7A4B10; Fri, 12 Aug 2022 02:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JFBYrdxvsOsnfecMJrTkqTz0e2UgCFhVUgOqST6en7xHbi8W5VMFepreIh95b+F8LSb0gp+TZMSDEwm/jCcDYHkiQHSU5TMgzTX9g9FT+11DtIrcngM5R/Iv4/e8ArFXXDUEA9pcPmT+yDZVTIXJAlABzzwSTmJjaK/N4NfEF2pvUrHcZjkBjBgRVkXGohctqjVNWBLDffMPjwVTLypIw6lWCPDkJC1I6MlwxsA1pzlpEegxXM7PxzHX+Lh2OioyqSp4yFQNI86MpyyvE9fg/gIhPz07FaUB6QTR7aUQCVTLZATkXbfOLkXjmrUpupLdbzkuu9h4cBre4Ayr16jMNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+zhpa3/Owwzeu2gpR2s0xFBmLa4HtwiQWKEuDcElNdU=; b=GcyHILg5u2AaxiT5lptJxLCnUAhvETdYUJWhEL0PtZZbNyXtlimx/uMa3BHd/TSUSJH5mHIJuR595zhJtnXeOs03my6sQaVnwnwqLMLHSyWKQBHb63jGCc+1NFG5B+LcS/jGXCu303NcqOCkOTrn3pobp11qIiUkKipjikXst3pN2isq4VPxrw9Ugd3WJKS2brZMV00J7qIT1+qi2cI60j+SR2O0SApZDeYo5HUbvkZ+pjFXcxR3eKAyjI3oIv93HzXwS+Kv5jtcHDZo9eLSoQz/D3t/91pKUclEelCtXyOM6f1tUv+XQmIB+Akpg5Kqo0tQUB4jDnr3ZVC/jX2KOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+zhpa3/Owwzeu2gpR2s0xFBmLa4HtwiQWKEuDcElNdU=; b=eNfmFyugx9MR1HqrcWP1CNrrZL38abRKtlNNowlZ9r3sWxWu3PjrGz7B/coSiRI5rqjs9voyTJ31kmAdzdcyoYfRk5IISwwVf83aqxeY2/OvSP+DgnNCErrpkmvt4wfKTNV/JCefGIn9hMOdzNicb6tjK/Wi2sEq1j0ZODRXbcg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AM5PR0402MB2897.eurprd04.prod.outlook.com (2603:10a6:203:95::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.10; Fri, 12 Aug 2022 09:43:07 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::2549:869e:d80b:3a1b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::2549:869e:d80b:3a1b%6]) with mapi id 15.20.5504.022; Fri, 12 Aug 2022 09:43:06 +0000 Message-ID: Subject: Re: [PATCH v3 2/3] drivers: bus: simple-pm-bus: Use clocks From: Liu Ying To: Geert Uytterhoeven Cc: "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , Linux Kernel Mailing List , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Sascha Hauer , Fabio Estevam , NXP Linux Team , Saravana Kannan , Greg KH , Krzysztof Kozlowski , Rob Herring Date: Fri, 12 Aug 2022 17:42:56 +0800 In-Reply-To: References: <20220804061133.4110734-1-victor.liu@nxp.com> <20220804061133.4110734-3-victor.liu@nxp.com> <9349e633a64a2275857b2c08731e40721e5af82b.camel@nxp.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SG2PR02CA0022.apcprd02.prod.outlook.com (2603:1096:3:17::34) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 446541f2-03cd-4e80-391b-08da7c470f4a X-MS-TrafficTypeDiagnostic: AM5PR0402MB2897:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H3NstdlyMnylgqtmGGi5u2aHo7F13c1Q30mjdMr+c3FAeBerODuaQvlJ+DFgJn0IcFIsi9jotdUrEkaOZbs9FhSNzELwMh5kxbzy37Jz7cRLATr6LIL/AjGFNIYoRL9Iu6z7x8ZuhWz6O5hfgmt6JZVEXwHLIObvzjQzTQun3Mtq/PgD9ZJ3ZQucPVyrDd9iRcR9foeAnE3OaeID9gC7Al1S8RjTv/RS7t6/32egZztpjytPsXc84fSYGwqz4YpVUa/S5/iRvZd1NacFEHqTvkWIxWKjJRQLqlDapuAScDA1DYVMP2hSqrnffrMG+Vswy3VtKi/uNutZLXJye+HrAqmGViT3jTXMcf+wBgmX8g+M2qq9kEE91DAsU/D+Yp3vl/IW8ftmQ4tbvtu1LCDrHKi/uDZdQknp9wk0xiOkwHeiRbJ70wZ5AdpcXbUZgIHrgXecKHElukOZQ95bIhvPO7tcDc3z6bTjLqrI2Yg+621KOatfrvddeTW0oLNGVvd8L6kO6IQSAESeLe7pTBZGuyqnNkwbKlZYcq0DtaIlfovt4XL2GQTy47UJZQ9PyXsU7aBE1EpzhHBVLGaa97MsA1NXXVU9AT8MioXaeoJz22VqqPtc0Ry1VYnMUZkaneeOC8YdHmHZloyL9LLCxmMdeVUzapWZQVVM5MqelffWqc8q1fuGS119hb65kO/MR25iYTeHP4bW0JVQwkXye31mHc5qZ1ebKNXd6JPW4r92dPK2G5bovj3b2gmS8YXJgh7yyYOPG7UUIUuPk89OMF/7P5IchRAZiqVrR8vLzfI0dWqzHQoRJM5yFrMKhSIOx6XCwZAWTtsabis2kEibTdZXZA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(376002)(396003)(39860400002)(366004)(136003)(54906003)(6916009)(41300700001)(6512007)(26005)(186003)(2616005)(2906002)(6666004)(66556008)(66476007)(4326008)(8676002)(38350700002)(66946007)(38100700002)(86362001)(316002)(6486002)(83380400001)(6506007)(53546011)(52116002)(478600001)(8936002)(5660300002)(7416002)(36756003)(99106002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QWk1SlhrMGhWNXI0SzBjQVRkcTRFYzJXZWJpcHVjaERrTmhnSUVuVFBMOEpO?= =?utf-8?B?NUdwOC9URURFMFFMZjBrSnUyUHQvdEt6dWRTWFpJbldVUXkvL2ZYZXlscW43?= =?utf-8?B?ZHJKeHVvb09tY3dOVGpLb0pCaUJPR3lLM1NSampJTzJldTdSUksydUlyZUZS?= =?utf-8?B?Nmp2SUcyeWpxMXBhdEpUUUdBdDJaejBpY3Z6NWw3d1k1QjAxSjd2SEFyenRE?= =?utf-8?B?ellWczlESEVYVnBZSW91RHRtNTFTMzBWRzdDOXgrQWJBeGlWZVorb2hZejVP?= =?utf-8?B?d3pWMHpGRjRGVmNJMnlsN2tjM01Fc0pOd1lPdjFUWi9xcE5FWlBTVEpsa2w5?= =?utf-8?B?dXBrZzlwb04wZ2h5RElneXR2VXJ6b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-CrossTenant-Network-Message-Id: 446541f2-03cd-4e80-391b-08da7c470f4a X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 09:43:06.8797 (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-CrossTenant-UserPrincipalName: MN6nLF0mZNC0ovyf0nPvMmAxAsACklILsNYYD87Tr0YfFlMPh8iZFdBgIPU0FNg1jU/kXQT4FF/7eeUKDN71fg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0402MB2897 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi Geert, On Fri, 2022-08-12 at 10:58 +0200, Geert Uytterhoeven wrote: > On Fri, Aug 12, 2022 at 10:13 AM Liu Ying wrote: > > On Thu, 2022-08-11 at 14:34 +0200, Geert Uytterhoeven wrote: > > > On Thu, Aug 4, 2022 at 8:10 AM Liu Ying > > > wrote: > > > > Simple Power-Managed bus controller may need functional > > > > clock(s) > > > > to be enabled before child devices connected to the bus can be > > > > accessed. Get the clock(s) as a bulk and enable/disable the > > > > clock(s) when the bus is being power managed. > > > > > > > > One example is that Freescale i.MX8qxp pixel link MSI bus > > > > controller > > > > needs MSI clock and AHB clock to be enabled before accessing > > > > child > > > > devices. > > > > > > > > Signed-off-by: Liu Ying > > > > > > Thanks for your patch! > > > > Thanks for the review. > > > > > > > > > --- a/drivers/bus/simple-pm-bus.c > > > > +++ b/drivers/bus/simple-pm-bus.c > > > > @@ -8,11 +8,17 @@ > > > > * for more details. > > > > */ > > > > > > > > +#include > > > > #include > > > > #include > > > > #include > > > > #include > > > > > > > > +struct simple_pm_bus { > > > > + struct clk_bulk_data *clks; > > > > + int num_clks; > > > > +}; > > > > + > > > > static const struct of_device_id simple_pm_bus_child_matches[] > > > > = { > > > > { .compatible = "simple-mfd", }, > > > > {} > > > > @@ -24,6 +30,7 @@ static int simple_pm_bus_probe(struct > > > > platform_device *pdev) > > > > const struct of_dev_auxdata *lookup = > > > > dev_get_platdata(dev); > > > > struct device_node *np = dev->of_node; > > > > const struct of_device_id *match; > > > > + struct simple_pm_bus *bus; > > > > > > > > /* > > > > * Allow user to use driver_override to bind this > > > > driver to > > > > a > > > > @@ -49,6 +56,16 @@ static int simple_pm_bus_probe(struct > > > > platform_device *pdev) > > > > return -ENODEV; > > > > } > > > > > > > > + bus = devm_kzalloc(&pdev->dev, sizeof(*bus), > > > > GFP_KERNEL); > > > > + if (!bus) > > > > + return -ENOMEM; > > > > + > > > > + bus->num_clks = devm_clk_bulk_get_all(&pdev->dev, &bus- > > > > > clks); > > > > > > > > + if (bus->num_clks < 0) > > > > + return dev_err_probe(&pdev->dev, bus->num_clks, > > > > "failed to get clocks\n"); > > > > + > > > > + dev_set_drvdata(&pdev->dev, bus); > > > > + > > > > dev_dbg(&pdev->dev, "%s\n", __func__); > > > > > > > > pm_runtime_enable(&pdev->dev); > > > > > > While I agree this patch has merits on its own[*], I am wondering > > > if you really need it for your use case. > > > > > > In "[PATCH v3 3/3] dt-bindings: bus: Add Freescale i.MX8qxp pixel > > > link MSI bus binding", I see your bus has both "clocks" and > > > "power-domains" properties. Perhaps your PM Domain can be a > > > clock > > > domain, too (i.e. setting GENPD_FLAG_PM_CLK and providing > > > generic_pm_domain.{at,de}tach_dev() callbacks), thus handing > > > clock > > > handling over to Runtime PM? > > > > It looks like most(if not all) PM domains can be clock domains with > > GENPD_FLAG_PM_CLK and generic_pm_domain.{at,de}tach_dev() callbacks > > set. So, technically, my PM domain(scu-pd.c) can be a clock domain > > with > > all those set and a special check for "simple-pm-bus" in the > > {at,de}tach_dev callbacks. But, I'm not sure if it is appropriate > > to > > do that. How do we determine clocks should be managed by PM domains > > or > > device drivers? Technically, both would work... > > It depends on the hardware topology: is there really a clock domain > (i.e. lots of consumer modules are clocked by a single clock > controller and can be power-managed that way), or is it just a > coincidence that your bus has clocks. It's just a coincidence that my bus has the two clocks. > > E.g. drivers/clk/renesas/renesas-cpg-mssr.c:cpg_mssr_attach_dev() > looks for clocks from the right clock provider and of the right type. Ok, I see the function. > > > > [*] The simple-pm-bus DT bindings state: > > > > > > clocks: true > > > # Functional clocks > > > # Required if power-domains is absent, optional otherwise > > > > > > power-domains: > > > # Required if clocks is absent, optional otherwise > > > minItems: 1 > > > > > > While "power-domains" (+ "clocks" in case of a clock domain) is > > > handled through Runtime PM, the current driver indeed does not > > > handle > > > "clocks" in the absence of the "power-domains" property. It > > > looks > > > > Right. > > > > > like all existing users that use "clocks" rely on the PM Domain > > > being > > > a clock domain. > > > > "renesas,bsc" seems to be one of the users. > > Yes it is. And it doesn't need a special driver, as it just relies > on Runtime PM controlling both the power area and the clocks through > the PM Domain. Yes, I see. > > > > With your patch, the clocks might be controlled twice: once > > > explicitly, > > > through clk_bulk_*(), and a second time implicitly, through > > > Runtime > > > PM. > > > While this works fine to do clock enable counters, it looks > > > suboptimal > > > to me. This could be avoided by making the new explicit clock > > > code > > > depend on the absence of the "power-domains" property, but that > > > would > > > break users that have both a PM Domain which is not a clock > > > domain, > > > and clocks. So we may have no other option. > > > > Hmm, I'm not sure if there are really users that have both a PM > > domain > > which is not a clock domain and clocks, given that a PM domain can > > sort > > of always be a clock domain by setting that GENPD flag and those > > callbacks. So, what do you suggest? Keep the patch as-is? Or, > > maybe, > > make my PM domain additionally be a clock domain? > > It depends. Is "dc0_disp_ctrl_link_mst0_lpcg" a clock controller that > controls the clock inputs to multiple modules? Based on the name, it > seems to be used only for display-related clocks, while "pd" controls > power to various modules, not limited to display? > Hence you may want to keep your patch as-is. "dc0_disp_ctrl_link_mst0_lpcg" only controls the clock inputs to my bus, not multiple modules. "<&pd IMX_SC_R_DC_0>" controls power to all modules in Display Controller Subsystem, including display controller engines, irq controller, clock controllers and this MSI bus. Hmm, based on your information, it looks like I need to keep the patch as-is, as the clocks are only for the bus. If that's the case, may I add your 'Reviewed-by' tag or sth like that on this patch that when I send v4? > > Renesas R-Car SoCs have separate power area and clock controllers, > too, but they apply to most/all devices. Hence we moduled this as > a single PM Domain (also because "power-domains" (used to) support > only a single provider), through a close integration of the power > area and clock drivers. Thanks for the information. Liu Ying