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 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 8F4D7C7EE24 for ; Mon, 5 Jun 2023 08:07:20 +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:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/zJuhLOCMfLs5B3C+tuNiHjRqUhzgysr6uOpHgH5qoM=; b=gNHld+dEBFYJ/C Ges4qYWj1m/l2KmkRQGZGLhsu11RakUthCZdqTdHKeh9gtEC5UprT/akWJHr+y+eKI/JubdncEqtF BjdoxpSZ3CZjCyPJMM5R9xyCXLo6DmOy3h0oV/j7j39BU9COhD3XSA1NbpA+XP9/RA1vhHdhqPfg8 33syyWrHquBcUNhaPfA19aKE8dRl0l3zIJpQryO9XEbF3+QpM35KcjIBrrQPUwJGEbQ+h6nX/JbY/ 8M1llGA0zG5vbB2S272M72v0NkWjaz3kTLQoHlBMkTzegT3FWTkRte95DgsNGlu32yr3AM99zsH7K 4YlvVA1HzQfLmpW/Dx4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q65Eq-00EfBO-1m; Mon, 05 Jun 2023 08:06:52 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q65En-00EfAE-0r for linux-arm-kernel@lists.infradead.org; Mon, 05 Jun 2023 08:06:51 +0000 X-GND-Sasl: luca.ceresoli@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1685952402; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4YQFe4JRPxLiW1JpXbYOa5/4VdyG/FodqDrlNYufxrA=; b=d+Pd+1n/RRKBsSEzBJ2dIW3imyOa2OERPYBdSthwwF6xb5swiMwbuVdB12/8U35e3jlIhf CdCN46oPUVfVjWCSloz7RbRYXiQ5yOzMv8b5ZL8gFhHVQeqwnqphkvKPe4brFqPPvdSIEA tAMUFBORppXInBktKMG9dL/9v2AyqxFmP4LyiHkt8yd9Lq4lsl1zOhIlmvWbdzM9XA/I8R NEAsVLR1z7XwWxxIJJrpHLy0npYKfC55yxrIH9G61XfH/htYW7sWZdyC4NNWGsW9kIEXKg yQnIW0Xo8qwDfSrvWDXDnH+VZF1tL4bB3NUnmLaMdX6gwc93RKhxOOgoNMKG6g== X-GND-Sasl: luca.ceresoli@bootlin.com X-GND-Sasl: luca.ceresoli@bootlin.com X-GND-Sasl: luca.ceresoli@bootlin.com X-GND-Sasl: luca.ceresoli@bootlin.com X-GND-Sasl: luca.ceresoli@bootlin.com X-GND-Sasl: luca.ceresoli@bootlin.com X-GND-Sasl: luca.ceresoli@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 810131C0011; Mon, 5 Jun 2023 08:06:40 +0000 (UTC) Date: Mon, 5 Jun 2023 10:06:39 +0200 From: Luca Ceresoli To: Lucas Stach Cc: Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Marek Vasut , patchwork-lst@pengutronix.de, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/2] soc: imx: gpcv2: prepare bus clocks early Message-ID: <20230605100639.54d77ac5@booty> In-Reply-To: <20230602185417.4098937-2-l.stach@pengutronix.de> References: <20230602185417.4098937-1-l.stach@pengutronix.de> <20230602185417.4098937-2-l.stach@pengutronix.de> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230605_010649_477520_5EFF2EDB X-CRM114-Status: GOOD ( 18.34 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Lucas, On Fri, 2 Jun 2023 20:54:17 +0200 Lucas Stach wrote: > Prepare the bus clocks during PGC domain driver probe. This avoids a > potential deadlock when there a clock providers inside the domain, > as this might end up trying to take the CCF prepare_lock from two > different contexts, when runtime PM is trying to resume the PGC domain > for the clock provider. By keeping the bus clocks prepared as long as > there is a PGC domain driver attached, we don't need to take the > prepare_lock in the domain power up/down paths. > > We don't want to do this for regular reset clocks, as this might lead > to some PLLs being kept prepared that could otherwise be shut down. > For the bus clocks this isn't a concern, as all the bus clocks are > derived from always-on system PLLs. > > Signed-off-by: Lucas Stach ... > @@ -1343,10 +1355,19 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) > regmap_update_bits(domain->regmap, domain->regs->map, > domain->bits.map, domain->bits.map); > > + if (domain->bus_clocks) { > + ret = clk_bulk_prepare(domain->num_clks, domain->clks); > + if (ret) { > + dev_err(domain->dev, > + "Failed to prepare domain's clocks\n"); > + goto out_domain_unmap; > + } > + } > + > ret = pm_genpd_init(&domain->genpd, NULL, true); > if (ret) { > dev_err(domain->dev, "Failed to init power domain\n"); > - goto out_domain_unmap; > + goto out_disable_clocks; > } > > if (IS_ENABLED(CONFIG_LOCKDEP) && > @@ -1364,6 +1385,9 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) > > out_genpd_remove: > pm_genpd_remove(&domain->genpd); > +out_disable_clocks: > + if (domain->bus_clocks) > + clk_bulk_unprepare(domain->num_clks, domain->clks); Shouldn't the label be "out_unprepare_clocks"? Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel