Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1456571rwb; Mon, 7 Nov 2022 01:42:27 -0800 (PST) X-Google-Smtp-Source: AMsMyM7ymHusqWcmCzL93sJBvk0vlcUkuvRSFQbCXuALBMplRbuc54/UdxiAO0tTzviq7s66NmP2 X-Received: by 2002:a17:906:7621:b0:750:c4a3:8fcd with SMTP id c1-20020a170906762100b00750c4a38fcdmr49267466ejn.180.1667814147722; Mon, 07 Nov 2022 01:42:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667814147; cv=none; d=google.com; s=arc-20160816; b=vokGGoCKmMSYuNU6tFWuP6XMAcs5NNbsDg4cg8Sv1jCKzBcj3gNBusHXkEpCXFQBuP qGU59aKx1fMDL0AnidWBOz9xwZL6uiws1mMILiCoTH3NLkVFMOYghpgEjoo2DRW2cCHQ AiJu+vJdEdx+FZayDqPFbRrHAUuXyYLnIE5HQz/IYzXp61IxShP2iJ/eJJ+I7G3qvfzO kJXof/5ytWFN+t/MB60nKTu0+h0NC2uVX9migq8OV13CF9PJJNlfDr+t2jO36wHrpGMq 0rMM+IDqRwq3/ey3f97XmPaF8UAFg879+FsUVIOMVIXH1cGjSn4GVhJhTogHXJ/W81ok bQRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pDyuAd3zhRAKgJS1te8vIfPTnhTp70JZQyUgML+QA4Q=; b=xADB1CUH0iqNsTTRF53+MvmTMx8SqQknEGcx9rZv38wzMr7buKyuqPjRGsBVyB+M8E TkVbVvEkGEqWUsLUtlEgiTjvml8R15w/mCaPP+wBPv3w8Pc1wNdJRv8L9xb6Bc7uSrVJ BZ2nmxlL0CxaETkBe72WyaMp4AxPH7QP6Nfk1Ax/V9UjYmbViItqERWxvU2TryOu4BHo 2YkPA5iG0oQM7NoM88XroUrphRuJhqOayT9Fkol0bQMqO2ItT/XDbwYLjFZ5vMaRiSw7 Iu6JCY4v0s9axxCvqExuvenLo5tWkZjQu3oowrGtviBl6wWNb6oOUFRp4DbydvsucZ2u LTcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jspR5KW7; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020a05640226d000b0045a5bd66302si10262452edd.571.2022.11.07.01.42.04; Mon, 07 Nov 2022 01:42:27 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=jspR5KW7; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230466AbiKGJFS (ORCPT + 95 others); Mon, 7 Nov 2022 04:05:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbiKGJFQ (ORCPT ); Mon, 7 Nov 2022 04:05:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1451120AD for ; Mon, 7 Nov 2022 01:05:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 343C660F1C for ; Mon, 7 Nov 2022 09:05:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88B5FC43148; Mon, 7 Nov 2022 09:05:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667811914; bh=dQUl7/g2deHQHg56f4HOG512Ok3mw3uMyxBnPD5nMGQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jspR5KW7AKgSMQTAtag8X2CW6uXYboNG2QGtwY0fLz9dPQ1XMNhJMSQOgM/S8DFRm cre6eWAzcPOIJRFzy5S4mv7mEzUyaC5H5nPeOpJafn522zgwNYwbTaCblwmERvVFvY 6I8D4xuelfUGBH8Gz5OcSaCMlNhMhF2fiLh5+qSQHsR9pw59R3+ejsjr5pvfEODYZw UtorxcVB+qAHX1lATGruS98uqU8Z1tCFlKirAAZaGSlqHTQJ4JYR3ZG4jSB7gRGmCp TQw4lhOvTmgv131tgBYT1UKeEVcDjcWBTr826IqhaN4mhwdZvE3giGqeiCEX8Dd8ub c9aTEjuMYkqvg== Date: Mon, 7 Nov 2022 09:05:09 +0000 From: Lee Jones To: Liu Ying Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com Subject: Re: [PATCH RESEND] mfd: Add Freescale i.MX8qxp Control and Status Registers (CSR) module driver Message-ID: References: <20221017075702.4182846-1-victor.liu@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Wed, 02 Nov 2022, Liu Ying wrote: > Hi Lee, > > On Tue, 2022-11-01 at 13:53 +0800, Liu Ying wrote: > > Hi Lee, > > > > On Mon, 2022-10-31 at 15:40 +0000, Lee Jones wrote: > > > On Mon, 17 Oct 2022, Liu Ying wrote: > > > > > > > Freescale i.MX8qxp Control and Status Registers (CSR) module is a > > > > system > > > > controller. It represents a set of miscellaneous registers of a > > > > specific > > > > subsystem. It may provide control and/or status report interfaces > > > > to a > > > > mix of standalone hardware devices within that subsystem. > > > > > > > > The CSR module in i.MX8qm/qxp SoCs is a child node of a simple > > > > power-managed > > > > bus(i.MX8qxp pixel link MSI bus). To propagate power management > > > > operations > > > > of the CSR module's child devices to that simple power-managed > > > > bus, add a > > > > dedicated driver for the CSR module. Also, the driver would > > > > populate the CSR > > > > module's child devices. > > > > > > > > Signed-off-by: Liu Ying > > > > --- > > > > The Freescale i.MX8qxp CSR DT bindings is at > > > > Documentation/devicetree/bindings/mfd/fsl,imx8qxp-csr.yaml. > > > > > > > > Resend the patch based on v6.1-rc1. > > > > > > > > drivers/mfd/Kconfig | 10 +++++++ > > > > drivers/mfd/Makefile | 1 + > > > > drivers/mfd/fsl-imx8qxp-csr.c | 53 > > > > +++++++++++++++++++++++++++++++++++ > > > > 3 files changed, 64 insertions(+) > > > > create mode 100644 drivers/mfd/fsl-imx8qxp-csr.c > > > > [...] > > > > > > diff --git a/drivers/mfd/fsl-imx8qxp-csr.c b/drivers/mfd/fsl- > > > > imx8qxp-csr.c > > > > new file mode 100644 > > > > index 000000000000..3915d3d6ca65 > > > > --- /dev/null > > > > +++ b/drivers/mfd/fsl-imx8qxp-csr.c > > > > @@ -0,0 +1,53 @@ > > > > +// SPDX-License-Identifier: GPL-2.0+ > > > > + > > > > +/* > > > > + * Copyright 2022 NXP > > > > + */ > > > > + > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > + > > > > +static int imx8qxp_csr_probe(struct platform_device *pdev) > > > > +{ > > > > + int ret; > > > > + > > > > + pm_runtime_enable(&pdev->dev); > > > > + > > > > + ret = devm_of_platform_populate(&pdev->dev); > > > > > > The use of this API does not constitute a MFD. > > > > > > Please use "simple-mfd" instead. > > > > simple-mfd devices have "ONLY_BUS" set in simple-pm-bus.c, so the > > simple-pm-bus driver would not populate child devices of simple-mfd > > devices. Right, simple-pm-bus will not populate child devices, because: /* * These are transparent bus devices (not simple-pm-bus matches) that * have their child nodes populated automatically. So, don't need to * do anything more. We only match with the device if this driver is * the most specific match because we don't want to incorrectly bind to * a device that has a more specific driver. */ So "simple-mfd" must be populated elsewhere i.e. drivers/of/platform.c. > > Also, the simple-pm-bus driver would not enable runtime > > power management for simple-mfd devices due to "ONLY_BUS", which > > means it would not propagate power management operations from child > > devices of simple-mfd devices to parent devices of simple-mfd > > devices. That's why a dedicated fsl-imx8qxp-csr driver is needed. This is more of an issue. Why can't this device use "simple-pm-bus" to have support for both auto-registration AND Runtime PM? > One more point which might be overlooked - as mentioned in commit > message, the CSR module is a child node of a simple power-managed > bus(i.MX8qxp pixel link MSI bus), which means the child devices of the > CSR module(as a simple-mfd device) won't be populated by > of_platform_default_populate() from of_platform_default_populate_init() > because "simple-pm-bus" is not listed in of_default_bus_match_table[] > and hence recursion of of_platform_bus_create() will stop at the > simple-pm-bus. This is also a reason why a dedicated fsl-imx8qxp-csr > driver is needed to populated those child devices of the CSR module. Not sure I know the semantics well enough (anymore) to get a meaningful picture of what you're trying to explain, and I do not have any suitable H/W here to mock-up a real-world test-bed / concept demonstrator to debug this for you. The long and the short of it is; we have a bunch of automatic child-device-registering helpers in the kernel. One of the mechanisms is bound to work for you if you structure your code appropriately. Introducing an empty, meaningless driver, simply to call a single function it not acceptable. Please make the infrastructure already offered specifically to solve this category of issue work for your use-case. -- Lee Jones [李琼斯]