From patchwork Fri Aug 26 19:13:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 12956560 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 45DEBECAAA3 for ; Fri, 26 Aug 2022 19:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BVnws06OMn/c9NWydevxd0WuB4gqv1GuGmjf9bKotHg=; b=lpI7QOpVu9J8LE k5qH5CPPMEHoMDaJX8nnOJalaUvEfZzUFaYlKn55HVCA5b2FXgVU7f1c0JfDIlToRgLdzepgKF8DM V+V86lVBzfocg9FYa0+nVCrvmDyxMA40DiYZtELTKKzwuhHN5yEc8WVGyyxTG22Hx1WWuaK+Ag+w5 O/zgHYLpwaOVuyjLIFfq+MLwSHYJg+cTnpgDKfKUwmZ4CmWrmz62781/OH/3vUDKQgZM4R/f/SkZU 5V/ycJUmeIRL2iMDkhyv4Ax9l1hLBhaspXJS1B+yt3TOusb7Y7WIdqzyrw65u19lLHsk5Hupcw18f q+RuQVhO9cJn/rB4wPbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRf2g-00Ah6m-Vm; Fri, 26 Aug 2022 19:30:59 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRelT-00ATdT-TT for linux-arm-kernel@lists.infradead.org; Fri, 26 Aug 2022 19:13:14 +0000 Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oRelP-0006jh-4R; Fri, 26 Aug 2022 21:13:07 +0200 From: Lucas Stach To: Shawn Guo Cc: Fabio Estevam , NXP Linux Team , Peng Fan , Kieran Bingham , linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de, kernel@pengutronix.de Subject: [PATCH 3/3] soc: imx: gpcv2: split PGC domain probe in two passes Date: Fri, 26 Aug 2022 21:13:05 +0200 Message-Id: <20220826191305.3215706-3-l.stach@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220826191305.3215706-1-l.stach@pengutronix.de> References: <20220826191305.3215706-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220826_121312_006431_DE439F2A X-CRM114-Status: GOOD ( 17.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since 5a46079a9645 ("PM: domains: Delete usage of driver_deferred_probe_check_state()") power domain consumers attached by the driver core do not support probe deferral anymore, as it is assumed that they are only probed after the provider is present, as a devlink should have been established between the two. With the GPCv2 and its slightly unusual mix between platform devices and DT description for the PGC domains, devlink fails to add the neccessary probe dependency. Now that probe deferral is not an option anymore, the domain drivers for nested GPC domains simply fail to probe, leaving parts of the SoC unusable. Rather than trying to teach devlink about our one-off usage of DT and platform devices, just split the registration of the nested power domains into a second pass, so that we never need any dependency handling. Fixes: 5a46079a9645 ("PM: domains: Delete usage of driver_deferred_probe_check_state()") Signed-off-by: Lucas Stach --- drivers/soc/imx/gpcv2.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c index 6383a4edc360..d1bbadbcb034 100644 --- a/drivers/soc/imx/gpcv2.c +++ b/drivers/soc/imx/gpcv2.c @@ -1446,7 +1446,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev) struct device_node *pgc_np, *np; struct regmap *regmap; void __iomem *base; - int ret; + int ret, pass = 0; pgc_np = of_get_child_by_name(dev->of_node, "pgc"); if (!pgc_np) { @@ -1465,7 +1465,16 @@ static int imx_gpcv2_probe(struct platform_device *pdev) return ret; } + /* + * Run two passes for the registration of the PGC domain platform + * devices: first all devices that are not part of a power-domain + * themselves, then all the others. This avoids -EPROBE_DEFER being + * returned for nested domains, that need their parent PGC domains + * to be present on probe. + */ +again: for_each_child_of_node(pgc_np, np) { + bool child_domain = of_property_read_bool(np, "power-domains"); struct platform_device *pd_pdev; struct imx_pgc_domain *domain; u32 domain_index; @@ -1473,6 +1482,9 @@ static int imx_gpcv2_probe(struct platform_device *pdev) if (!of_device_is_available(np)) continue; + if ((pass == 0 && child_domain) || (pass == 1 && !child_domain)) + continue; + ret = of_property_read_u32(np, "reg", &domain_index); if (ret) { dev_err(dev, "Failed to read 'reg' property\n"); @@ -1522,6 +1534,11 @@ static int imx_gpcv2_probe(struct platform_device *pdev) } } + if (pass == 0) { + pass++; + goto again; + } + return 0; }