Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1707388rwb; Fri, 12 Aug 2022 05:43:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR6LF+PT6+DEMHR026UIRnvlfghp59NbSQel9mQvhXhrNxC/duDt+XUK42a3/CO65lU6jqp4 X-Received: by 2002:a63:5359:0:b0:41d:b5a6:23c5 with SMTP id t25-20020a635359000000b0041db5a623c5mr2978626pgl.128.1660308215859; Fri, 12 Aug 2022 05:43:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1660308215; cv=pass; d=google.com; s=arc-20160816; b=FHPz79v2kRxOJgl1wJhpzFUFUoCm5VPMeTpG7ML8RnxaiYh2l6kpx1JHvfC5yWiOpA fq9MT28i/6VAI56IPBKJ21qqrrWtmEwA/5K3gfEdI4LN7ol4Cav1CZzYbN/PPFAN26Cv O+xx8S8oxKYc3qozaUMUwNiK+U8ZYFwwVVefHrUGuMsJVtqBDuZQpgRv0V07iVvV/2Mf 3GehVDHYs0yd0JE5A+rTUs6hZAGWw1X2sR2LXgtYiceTySsQLbhowyIk+HjdhDTQ4ZyT Hr/Ugkktc3GICBh11w0+kPcc9l7bMLXyeU2jYW8ytep13rIDgk0wL8K8mJL5KwargHgY nCPA== 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=4r6EmfJUPPLyDst99tB1kiLYfDnw/3KSlFEjYYrBzrA=; b=WFkUhPGbQIwKXqALuk+2dYGw6ccLeLO8nX1RRuYeaKRpKIcn/G7leR5W1QgXNB46rh zyFJsCLAeKCiWTsf6p9IggAYSbDtLmiZsHbyKZpIxxLZj79dzmSL/kPNwhJbbdbeNb4K L6q402BQ9IarJ/fq6FbEuFYLuAdWGlHGkmuw6z+emEyQQn/IP1+kjukM/F5KPBHaSrvh jrGMzQaW0+iNMZPlYGZzM5yA7cM0D0z8gUEYGIHGNlwkiIQ9vixFy3I+Crjh1qXuwoU7 F2alhhqvIWhrscJJ3Blc7uiY3AqrFdfI1bDsXbdLuS9mZyLMJwGla+V7JSfYVtJPVtm6 iUxA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="NBrnGJ/N"; 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 me11-20020a17090b17cb00b001f4f259febesi2916623pjb.163.2022.08.12.05.43.22; Fri, 12 Aug 2022 05:43:35 -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="NBrnGJ/N"; 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 S233250AbiHLMZi (ORCPT + 99 others); Fri, 12 Aug 2022 08:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbiHLMZg (ORCPT ); Fri, 12 Aug 2022 08:25:36 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60063.outbound.protection.outlook.com [40.107.6.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 860BE1F2C2; Fri, 12 Aug 2022 05:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ze3+9p9+ZWXX/wUAyTM9QZvfXd+Q/uYflBLmtaHp5vFTdD4dXcxATq8aRd6IQCwuONjQPFQvVwN4YK5AuT/cWPFk4wsJWTWIch+TJpzQ4iFUe+5JpZuee1SffZs/bu/5d8o37Syl4NCmASCPgzmGKzBNoQwfnnVhwc7UiYxMjh0mU/cBZaa/oAkGaPsNjis9HJNbW9CF42p5LMka+9cEF5AKG4RIuthsH6gktSXZU7HnEWmSAY7vDHr5j4sAdUZ9kYk6afLq40trf8wuy6DcTpnYcFbEGIteRKy5zUD9hqPgxDjk5OKraumlvhDzBd2rI4zGSCgRdOcZadHml9RVQA== 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=4r6EmfJUPPLyDst99tB1kiLYfDnw/3KSlFEjYYrBzrA=; b=DAFWSXIQ/JdDfG8Mm3V0JxJt+TozEE/iknievk2/PkITL8RMdRwBvgoRfZoCrCkz9qkI+CL9Vxvq0DjmGKVVhWHQNUpTVbjjmCt5Yc2n7WLgn+O4Xbu2R93eaFjARChxKyZ72oO5CFVwwRaiIUeGVHqVerE8qrfjkuE/asduEcJ0MeZPpwsp8tHZBcrLurlXnKdXe6oIYu4FUPNQSxWz+NsOofDDKHzl7P8SV9ZePH0GZBgbnI/+Xptf7tYNrMjboK3vqpAR50e2XpA122PiqqLn3oHTVKc3/SGQQbTG+Nbo9CcCFoDGcYa3mQrrF3DZl5+RbfbrHisswaNIgmQ/ug== 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=4r6EmfJUPPLyDst99tB1kiLYfDnw/3KSlFEjYYrBzrA=; b=NBrnGJ/N27Pv6iSjN1lsdaSYFj9H4IEHaSZZ2wqNE8b+Fjn7lJX76Eyqd0JhNUYKcBlXOZLhQaoVOBTrx2U6bt/jwnJ7EjXzvPlkjkycoNIK0asyqVowtUs2/rAuER9JRsnHv9KHC0bP2AS9f0xZAkkLd1hyLR+sHouXZT3yunE= 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 HE1PR0401MB2665.eurprd04.prod.outlook.com (2603:10a6:3:7f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.25; Fri, 12 Aug 2022 12:25:32 +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 12:25:31 +0000 Message-ID: <16d50def88afcde1b7323d83e5c9a84d7df0c666.camel@nxp.com> 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 , Geert Uytterhoeven , Krzysztof Kozlowski , Rob Herring Date: Fri, 12 Aug 2022 20:25:20 +0800 In-Reply-To: References: <20220804061133.4110734-1-victor.liu@nxp.com> <20220804061133.4110734-3-victor.liu@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: SG2PR02CA0101.apcprd02.prod.outlook.com (2603:1096:4:92::17) 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: b1fb1f5b-e609-4120-ed29-08da7c5dbf77 X-MS-TrafficTypeDiagnostic: HE1PR0401MB2665:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R2C9oWJ9k6lgvbrTU2bu+OVlsrg7r5XBukkuDDpPXTzrT4rMUmS+B+iVvVcjocm+r4kToZ2WexWKGP3TIXf2BLMN1/1h4GdsN6yILj1yfu4wfQLTa6D4T0FwGkqI/aPqKQa0LV9k61zWkSZ3vhylXg8fOVRiUkU4NP0SajIIBmwMFgE+QSHa7rMaFq5PogIFFba7UgWdUQfd+ZoSVw/IQvJF4YzILjwM7GAl969+py+qFO0dYBnk7zAG49pINUQUxdJOc6HeSYb3M4aQlb68efEBTbY7Xy6HS+vc/D8ww9uJxu59yPT/ABLJdoWzq/w+tKY936RtY91mtegKZMGJ2xybFTKpeXWURfAb/NBgDkN0DaMLMyGr04+KNd41sOaH7naPoYHK9Srjd7rDlP520X5kIcdNJo/DdxYyvMBVwhVASYWXRBc3kqoN7E1FWYzoKnwMNH6wad4hh0fwNAya5bD0zqsaCcifcRWD/RnFos2ju6O0jwRlanFFfb9rtbV4lDbbSxKAXSpBNZZFJ6tB4Wul0cEyr29DfenjvFmME2NUh81sOiTs/umarYFRTsPZY7qT9jRWzGHHuAYDfeU3WVythB6DpVQjHIMtpCk6tXi1P85Uk/RUZZut0lTQ72Yfgg8JRKxpVte8gK+VVXDQNwOXP4OQlt9fAwfh1U0a2aAZXTLaLK0/OfsfJ6N8sstqxCeHEsFEYhISqtURW5iruDxtPQXA5xW9YRD6HsNhMZpBaoU4Rbfa4IcKFG5zO1hgVru+xTI7LmEcTmbCajPlw1MhIqhF/4MwXT7ihQ+5JonbbusVqGSdyhopGxNArvzU7HvrAF3QZWH32kDPQ0QnEA== 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)(396003)(376002)(136003)(366004)(346002)(39860400002)(66946007)(5660300002)(7416002)(8936002)(66556008)(4326008)(66476007)(8676002)(2906002)(86362001)(54906003)(6916009)(36756003)(316002)(6486002)(38100700002)(38350700002)(478600001)(41300700001)(26005)(6666004)(6512007)(52116002)(6506007)(2616005)(186003)(53546011)(83380400001)(99106002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SjI1UUJHaW5LME03TWJPK050dk9KbkV1SUhpNlk3K2JoZFRzd0lyK25xL29t?= =?utf-8?B?V0ZSQmNSNzl6NXdiN3o3ZGwzYlh3OHVvTE5EYlZhTE1VYWxpYXY4OGZHWlA0?= =?utf-8?B?WkpKTEQ3SXFwL2JTanBmMVY0ay9VQ1R6WDNiMHVJK3hWV0V0aE5oOGtMWVZl?= =?utf-8?B?UERYVXJOdXpKR296c2owL2VqOUJRcGluOVBoaHZzd3lPMGtKVmp0OXdJOVJV?= =?utf-8?B?aHZlKzVVYWRxbkI3ellMcDl5TXZla0M2Z0dHYU9lTmNLTndLKzVCL1pRT29v?= =?utf-8?B?UktKQjZ0UE01Y1dDZkhady9hUGV2MjVyZEhzYkRReGYrWFBvSi9vOVJmOThv?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OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1fb1f5b-e609-4120-ed29-08da7c5dbf77 X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2022 12:25:31.7456 (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: 1sIO01JEi+HkZm0Opdd7HYehSBG+yfbNxA7iDJFXCHDzdwsqiSW/cwU9URrWHPfEHvcXAC97D7ogBu9l6xSpFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0401MB2665 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 11:49 +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 > > --- > > v1->v3: > > * No change. > > Thanks for your patch! > > > --- a/drivers/bus/simple-pm-bus.c > > +++ b/drivers/bus/simple-pm-bus.c > > @@ -72,6 +89,42 @@ static int simple_pm_bus_remove(struct > > platform_device *pdev) > > return 0; > > } > > > > +static int simple_pm_bus_runtime_suspend(struct device *dev) > > +{ > > + struct simple_pm_bus *bus = dev_get_drvdata(dev); > > + > > + if (!bus) > > + return 0; > > Can this really happen? Good question. Should not happen in any cases. pm_runtime_init() sets runtime_status to RPM_SUSPENDED and needs_force_resume to 0, so simple_pm_bus_runtime_{suspend,resume} are only called for simple-pm-bus, not the others. Unless I miss something, I would remove the check here and ... > > > + > > + clk_bulk_disable_unprepare(bus->num_clks, bus->clks); > > + > > + return 0; > > +} > > + > > +static int simple_pm_bus_runtime_resume(struct device *dev) > > +{ > > + struct simple_pm_bus *bus = dev_get_drvdata(dev); > > + int ret; > > + > > + if (!bus) > > + return 0; > > Likewise. ... here. > > > + > > + ret = clk_bulk_prepare_enable(bus->num_clks, bus->clks); > > + if (ret) { > > + dev_err(dev, "failed to enable clocks: %d\n", ret); > > + return ret; > > + } > > + > > + return 0; > > +} > > The rest LGTM, so > Reviewed-by: Geert Uytterhoeven Thanks, Liu Ying