Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3853646iob; Mon, 2 May 2022 07:15:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxj4Wib8ocN3ciLYqkJUepVdj/T/3rMKJMRQql+M5fVWqqxLlinYzKL/FTMpGKyCxiqSEWS X-Received: by 2002:a17:90b:2241:b0:1d2:54b2:64b2 with SMTP id hk1-20020a17090b224100b001d254b264b2mr18396134pjb.225.1651500942589; Mon, 02 May 2022 07:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651500942; cv=none; d=google.com; s=arc-20160816; b=AzFIEs4plxvR1cmxDFxtciEetB91p39IFn7NjfW7ckibsfFM/0BJPazSk0SOBdlbjM Mp5HHp36HVpMjY6cxMc1VqCAQSjPH9ZJQ6xOx6nJhKtiq5AJ66pJIqj/T+io5sxpICy9 1gcP2syWNFLKblVjNwbvBFxXdPRQxOPDmtOCPqdAdWr+rYZvi9aoffTW8pAvqGv3FxP/ gw4FTp8E1jzf6DtZeqsgh2cMxJlEF4IsCKWlwRzcqbGYdEb84bjJlMDMTRuNNdeUJydz +1EqumNt6LWjmet5TaoKbuibe0SU7WD3jWWxes4QNE2xFa/1Voz0PwuY9YSv67ImSQG6 EyMg== 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 :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=kFbaTBJ6AL/X2QNd2kSlQdvhpj3h8osfwHT7cP5luao=; b=DmSszNQSMK2Y/UgB8gIKPEPcwR5a5aax2IFYPufNuEhYBho4pzvk635bYbe+SaOyar GB3Fe2assD/weommVkAh3a8NQoqtaB6C9OnGb6enNIzJxb+787pPqMz7UShQYCaroAyL 5U7uKjDSfV+VaXMnhr6v7d2Gq22MEfwLfVGDj/H+Vfju9DlmGbw29o58UTuw/JoK4KuT BZV9QkoC5INLhM9zBP1jW65aeq0p+qIo+UFzOn1i5iDI3F+ARN89KgUd4jG4ezbPU+2P sPgBuEWINhMYSjUJrroLHrd9NBjzO34vZRO1lKj+lRnZ2idV+F5T+GknEvemrvgElpJN pjpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ecFdqLEb; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a1709027e8900b00158f8093113si13299577pla.284.2022.05.02.07.15.25; Mon, 02 May 2022 07:15:42 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ecFdqLEb; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384497AbiEBKGe (ORCPT + 99 others); Mon, 2 May 2022 06:06:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384366AbiEBKG1 (ORCPT ); Mon, 2 May 2022 06:06:27 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D8111A04 for ; Mon, 2 May 2022 03:02:47 -0700 (PDT) From: Viraj Shah DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1651485766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kFbaTBJ6AL/X2QNd2kSlQdvhpj3h8osfwHT7cP5luao=; b=ecFdqLEbt2QBAgdMnwZIVO7M+kTY7MbFKwl7xJ3yUbcdGbGorZIyle5SffnfrUD7cgXFAU R7b+U/oUhfa3afDtTx6gAzGyeQqULJMQlj3kz6/UgKavTrBIyMBo2BOWqliW7jLGRbiIBS zWESVymhNpNJ05klQrkf/F5i+BqVEHYF723hJLi763SjZgQk+dHu4zvHMq0mD1PVKW4tFt 5iMemher/eZ2IdZFSDUV37NOJr0bONtIjooRQ8Mgy5Qbnr6C6Enq9gObhtfT+zTfig2MCg m2C6+0C//Qwq8U/hdO1JedktHKwb9M61FLt66Puin7BsNpqFzDgREvlVuavqSg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1651485766; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kFbaTBJ6AL/X2QNd2kSlQdvhpj3h8osfwHT7cP5luao=; b=Zsz0j7wTyu86KZrkCFDG/37bshIgmR0pr0gPWky8FVTaAJhAKSe/9m0OcJXeExTFQRA4nm UNziTDS+LijQq+Bw== To: shawnguo@kernel.org, s.hauer@pengutronix.de Cc: Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Lucas Stach , Peng Fan , Frieder Schrempf , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/4] soc: imx8mm: gpcv2: Power sequence for DISP Date: Mon, 2 May 2022 12:02:30 +0200 Message-Id: <20220502100233.6023-2-viraj.shah@linutronix.de> In-Reply-To: <20220502100233.6023-1-viraj.shah@linutronix.de> References: <20220502100233.6023-1-viraj.shah@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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); + 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; -- 2.20.1