From patchwork Tue Aug 2 23:37:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 12935098 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 EC8A0C00140 for ; Tue, 2 Aug 2022 23:39:12 +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: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:In-Reply-To:References: List-Owner; bh=4h/hILMhUn4Re4ymBSSJ8JfjpCQ4CoKZNFXZkLsjKl4=; b=y4g6wijUxardN/ wNwz1Lkihib1MlsN0+9TrsHvy4ceh8lWUKp/B3Bf/cecIVe+RNElKeD4ifew5/oHtErRoy4gkHGlI WkTDSWU/JHajZcTowgsXkKxk2hQd+VWoAYnPzau3amy0bLhBBatZ5NGfqqEiLJuSHwpJVZsGbu31o DEwxpIl/74G6gZLI5xTNRLOzzLOQNJVEiFjlJ1ogYBQMsaVwSJlvJR0/hGcqsxJICijBCTejB1Ulw 1xXd0Ukw/slY8F23zT21vbBt84V01dEW1IBY3eJbj02rd1LrEvvUL/FL1KcQJGbgohbzUiD0Ewjls vV7u6Sbayl6Dp4cneoAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJ1SJ-000heq-2f; Tue, 02 Aug 2022 23:37:43 +0000 Received: from phobos.denx.de ([85.214.62.61]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJ1SD-000haQ-Ez for linux-arm-kernel@lists.infradead.org; Tue, 02 Aug 2022 23:37:40 +0000 Received: from tr.lan (ip-86-49-12-201.bb.vodafone.cz [86.49.12.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id CF2E68214E; Wed, 3 Aug 2022 01:37:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1659483454; bh=7iLN7tT2jqydQ2H6giTTF8j6xvFXgWUv9gvdkIr2AdM=; h=From:To:Cc:Subject:Date:From; b=O2QoBZCx5KgO0F7Mw8gzo/c5Tofc/MdDddRp061HFgSsA2O3zAqLlokxNWf7oX/ni zthg4FUC7COU3phNOkO4JEIWzzMY9gxbxVxlD0FcQN0xho77/V0J5P8g2vo+jrS3qc UGqvu/Yl1v96/BsU9addQAIvv/0XPqyMoPDqJHqy7rg2GKoTNisLGiZSOBuHD/GwWg B45QtdcJ60/9AKDx329CWJfjufAFizwlrAYogomxZOc2bLNILjEupE0BK3uutfRjld 2sOSgcvC0gK8jsDajc4lQJfHzbsu1A057abD50o1WQLagOsNLcwq+E08ThjhpPdJKO 03mnn5qJDxI5Q== From: Marek Vasut To: linux-arm-kernel@lists.infradead.org Cc: Marek Vasut , Fabio Estevam , Frieder Schrempf , Lucas Stach , NXP Linux Team , Peng Fan , Shawn Guo Subject: [PATCH v2] soc: imx: gpcv2: Assert reset before ungating clock Date: Wed, 3 Aug 2022 01:37:23 +0200 Message-Id: <20220802233723.100288-1-marex@denx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220802_163737_787996_165A0BFB X-CRM114-Status: GOOD ( 12.16 ) 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 In case the power domain clock are ungated before the reset is asserted, the system might freeze completely. This is likely due to a device is an undefined state being attached to bus, which sporadically leads to a bus hang. Assert the reset before the clock are enabled to assure the device is in defined state before being attached to bus. Fixes: fe58c887fb8ca ("soc: imx: gpcv2: add support for optional resets") Signed-off-by: Marek Vasut Cc: Fabio Estevam Cc: Frieder Schrempf Cc: Lucas Stach Cc: NXP Linux Team Cc: Peng Fan Cc: Shawn Guo To: linux-arm-kernel@lists.infradead.org --- V2: - Always assert the reset before enabling clock - Update commit message - Add Fixes tag --- drivers/soc/imx/gpcv2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c index 85aa86e1338af..f38a4420e94a6 100644 --- a/drivers/soc/imx/gpcv2.c +++ b/drivers/soc/imx/gpcv2.c @@ -333,6 +333,11 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd) } } + reset_control_assert(domain->reset); + + /* delays for reset to propagate */ + udelay(5); + /* Enable reset clocks for all devices in the domain */ ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks); if (ret) { @@ -340,8 +345,6 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd) goto out_regulator_disable; } - reset_control_assert(domain->reset); - if (domain->bits.pxx) { /* request the domain to power up */ regmap_update_bits(domain->regmap, domain->regs->pup,