Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3970605iob; Mon, 2 May 2022 09:52:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7Tfabx92KQ/N7L40EZlQrnjynwL9hKYbt7F+ryjWqPxsLHSb72m5PQcZJGhJQruFHjkpk X-Received: by 2002:a05:6512:1112:b0:473:a15b:fdf3 with SMTP id l18-20020a056512111200b00473a15bfdf3mr2743628lfg.155.1651510341824; Mon, 02 May 2022 09:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651510341; cv=none; d=google.com; s=arc-20160816; b=D9VPdq3DudoOySUL63MQ12HxEdn/aXvUsjw5t5/6zSJdOHVTkeXWIIo87jtPEZWrNd dFUdMhZabZDfmj76TGpRVsOpp5W31C/wJttUXGFRTkC6t8o2rmrTubBGWkosQjD6juL3 IcFRyQ3ieyTmyEBwh2ccIZ8Q94EgXAzeIPLphECZnoLyVmKhxjaxzT528Q/BGUy3lqCG 3v8ZUk9wkxHuh+tpACVuaCeYcMYVsnjIR3RFRuJTqmAWx8f59nct2pcDMe18m9dx63l1 CWp9jPNBrHp9aAxXCEBLDmgBJLKerN8fGyIIA0WrBFssS21QlkK7wgupRoO9Nqf21OhD k2ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=kgAApmMS/oAaEP3ODJYrnJ2v7ZCOZcnU/qyhnuOFTP8=; b=p46oLtogPcnxw1GGKAoXMqxdIpxdoDdSKTNZTnOPnjeFS9NGrI4P6lcw11a3pI75oZ 6gmSGiQ4PqCWweNNoEwzS0WMdcvZxz9Sa+bzow+PZxXKn01bhXXm/2tG6G0ymJgFUcsV 1oqfMYiyWEZq2+JBrINw+MS9NxDfxAJTWgc6ZrtLB5cwmwrrw1Mi1dg9AIk9fassJToO BEbvTS4TeWbYsecq5zlJfhp9GYTx80dCxe9umpO6EKJB9nDiEjGri/Sj5UerOVD9E52O UJIICdApbYmk4kN+32bIRR8IiG6Exv1YhCNr2lwv0vf3yhVn6zveqwBoZCakNE3HKhiT IiMg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a2e90c1000000b0024df0502945si13848193ljg.520.2022.05.02.09.51.49; Mon, 02 May 2022 09:52:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384494AbiEBKPd (ORCPT + 99 others); Mon, 2 May 2022 06:15:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384418AbiEBKP0 (ORCPT ); Mon, 2 May 2022 06:15:26 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6BA31A832 for ; Mon, 2 May 2022 03:11:42 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlT1e-0005h4-1P; Mon, 02 May 2022 12:11:30 +0200 Message-ID: <3679d0b1171a9c097e496cb325c8898d6c6e5902.camel@pengutronix.de> Subject: Re: [PATCH v1 1/4] soc: imx8mm: gpcv2: Power sequence for DISP From: Lucas Stach To: Viraj Shah , shawnguo@kernel.org, s.hauer@pengutronix.de Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Peng Fan , Frieder Schrempf , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 02 May 2022 12:11:28 +0200 In-Reply-To: <20220502100233.6023-2-viraj.shah@linutronix.de> References: <20220502100233.6023-1-viraj.shah@linutronix.de> <20220502100233.6023-2-viraj.shah@linutronix.de> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb 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-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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 Viraj, Am Montag, dem 02.05.2022 um 12:02 +0200 schrieb Viraj Shah: > As per the imx8mm reference manual, read bit 25(GPC_DISPMIX_ > PWRDNACKN) of the power handshake register and wait for ack during > power on/off. > > Signed-off-by: Viraj Shah > --- > drivers/soc/imx/gpcv2.c | 36 +++++++++++++++++++++++++++++++----- > 1 file changed, 31 insertions(+), 5 deletions(-) > > diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c > index 3cb123016b3e..8ee70c30964f 100644 > --- a/drivers/soc/imx/gpcv2.c > +++ b/drivers/soc/imx/gpcv2.c > @@ -254,11 +254,24 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd) > /* > * As per "5.5.9.4 Example Code 4" in IMX7DRM.pdf wait > * for PUP_REQ/PDN_REQ bit to be cleared > + * > + * As per "5.2.9.5 Example Code 5" in i.MX-8MMini-yhsc.pdf > + * Display power on section checks for bit 25 of > + * Power handshake register to be cleared. > */ > - ret = regmap_read_poll_timeout(domain->regmap, > - GPC_PU_PGC_SW_PUP_REQ, reg_val, > - !(reg_val & domain->bits.pxx), > - 0, USEC_PER_MSEC); > + if (domain->bits.pxx == IMX8MM_DISPMIX_SW_Pxx_REQ) { > + regmap_update_bits(domain->regmap, GPC_PU_PWRHSK, > + BIT(7), BIT(7)); > + ret = regmap_read_poll_timeout(domain->regmap, > + GPC_PU_PWRHSK, reg_val, > + !(reg_val & IMX8MM_DISPMIX_HSK_PWRDNACKN), > + 0, USEC_PER_MSEC); > + } else > + ret = regmap_read_poll_timeout(domain->regmap, > + GPC_PU_PGC_SW_PUP_REQ, reg_val, > + !(reg_val & domain->bits.pxx), > + 0, USEC_PER_MSEC); > + The driver already handles the PWRHSK bits at the appropriate places. Please do not hack in random sequences from the reference manual for specific domains. Also you can not wait for the handshake ack in the power up sequence, as the blk-ctrl driver only enables the ADB clock, _after_ the GPC power domain has been powered up, so there is no way for it to so the handshake here. See the comments in the blk-ctrl driver. Regards, Lucas > if (ret) { > dev_err(domain->dev, "failed to command PGC\n"); > goto out_clk_disable; > @@ -355,11 +368,24 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd) > /* > * As per "5.5.9.4 Example Code 4" in IMX7DRM.pdf wait > * for PUP_REQ/PDN_REQ bit to be cleared > + * > + * As per "5.2.9.5 Example Code 5" in i.MX-8MMini-yhsc.pdf > + * Display power on section checks for bit 25 of > + * Power handshake register to be set. > */ > - ret = regmap_read_poll_timeout(domain->regmap, > + if (domain->bits.pxx == IMX8MM_DISPMIX_SW_Pxx_REQ) { > + regmap_clear_bits(domain->regmap, GPC_PU_PWRHSK, > + BIT(7)); > + ret = regmap_read_poll_timeout(domain->regmap, > + GPC_PU_PWRHSK, reg_val, > + !(reg_val & IMX8MM_DISPMIX_HSK_PWRDNACKN), > + 0, USEC_PER_MSEC); > + } else { > + ret = regmap_read_poll_timeout(domain->regmap, > GPC_PU_PGC_SW_PDN_REQ, reg_val, > !(reg_val & domain->bits.pxx), > 0, USEC_PER_MSEC); > + } > if (ret) { > dev_err(domain->dev, "failed to command PGC\n"); > goto out_clk_disable;