From patchwork Fri Feb 28 10:38:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 13996244 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 0E5BFC19776 for ; Fri, 28 Feb 2025 11:12:19 +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=yknmo7ueHlSijqRyoL4nWR1cLUDseEkkegIBmdpPGZM=; b=HC3iwrGBZjd8Pa lN0TSYiEoC/iIfWDusWG/aPaSIjMfedAVPgi2XSk5QVGnLhk1Ss5AZq//sV6sHKRyDotnlHxbb6AJ 7PmHbuzsHf3Uvi8pE2chAXmrpRtvykee7/fMQ9j9vlDJseTezthiZzDPk0Mn+XXTUQirzhvmVfQoV ANu/O1f87D5mysBqPlSe4zsq329ePNBnKY6dvFlNP6MgHToyyv7zY7bb12IKLLFzUF0jampbn8yXs pvCV05UFmJiPdoveA7IE/nIV6mVp8uEpJZYIIZn6ouQ3bsX6ZEDGJDDIyMCVxouOuXjLWQ1vbOmFQ cz8QRk0IygToS0h44T3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tnyHy-0000000Ai6X-3MTC; Fri, 28 Feb 2025 11:12:18 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tnxmq-0000000AdFk-11mp; Fri, 28 Feb 2025 10:40:09 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-439a4dec9d5so20418775e9.0; Fri, 28 Feb 2025 02:40:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740739206; x=1741344006; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=312sLNrqEv63+Mv44pzQbo4rdknipAPccCqJcSeXheU=; b=BrqwN7qu4C8mYO29ujguHWzShWAhIo525U2SQTyetDRERrBjCcQkh6ZppSEQ1pOsAK FhcTrDZmV2hA5AUeSIiMDsPN6tklJNldJXcPpIYj+5bmul9v1U7rYG+Q08AsTK5x0TXs V30eR99RohTHvNp7Yj3OuHbJPPaLLKFMMbtruwcQAu/LZIW1wbBL5Ljsr/8g2aBAiFhu 0qWI/qGE9Cidb5cU032ynHLzqIfLiQUFWrYlsj1jIY5/XAZaytxXS0QDdVWyKi5f487c o7CdfLLhm5PpG5TcwuKu24Bw0sxTMnmr3u0QwEGpJyzZNToeKLFBj4ysMtBd0d1Lr4xN 2+0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740739206; x=1741344006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=312sLNrqEv63+Mv44pzQbo4rdknipAPccCqJcSeXheU=; b=nFb89C1/uhYp5F8OEdKyQkOuEyPPZ7bBt8SQSnTvaqKcvQeeyeNqTj50irNXA5Ug/A 3RbmS8lnxZEl0WAqW1ubL/K0pQ+fmOw75vZ+nHV9hIc7s7yOvRkQ2jUWgEuZLS6zdlis Lb0Qb0sySs/+nGlvl7ZqhRNqc+T2ZzLX+s0J0mkxwHFxajpllRtGiR7UD37CYmjUwN5J 24TcBR78Kl9wPySrFzICfeTP6RAG8KqkjuK7N6NfWUPLjFK/iYuS7N/PZlSECm5FRW86 h9TCsB27Cp2qvj2x5BxMXxpDtAF3KS0YZNDSO85BPqU+ZCC6npkAJ+MrgJoVENPntYxe 2A5Q== X-Forwarded-Encrypted: i=1; AJvYcCXXGeCvpa51nIp3SNWVgVS9w2+w0vpqhX6VsvkKyPupEMTd+LSF7LQ2RhoQ7xE6xq9l3b/vmrkGRjvwb7v24AcX@lists.infradead.org X-Gm-Message-State: AOJu0YwpFYlc9ZsnXQDLS8v0VtqEbcSia4bVq7FENI8Fko9qaK2ERLw6 yh/xufJoqxHi/N8m9kTgGE0hivRGor9g7TqmsAdrKZRf+hmVIML4 X-Gm-Gg: ASbGncunTDzu6QHVYVAklcNhrXrLAEHbP9g5dsyOa/P4HCwEfSBhrzuDBmE2a6hWtVl 4I0cfm0pBuTDp4ID25AZcnlXecK0sESYWwVr+Yn8xGuSeBwlN5hLCbf+fqGG5GzpZKVx3bcS0Sl oqOLJeTFRbAtwhkgkigY5ftQXWDUHS9p7dkK2EpmB8IUv6Wldou7qujwR9+W/5dy74f/hwzSCc1 N08bw3U88oN/tua9NvbKznXOMcaeMDRHc0JDhnA7hCxiYB3siUFWksHIkOph2fj8s+fRoiH5L/T xOX4dz7V5rvVBJwWxyYzunzirEm/kFHfqGHWKATsag== X-Google-Smtp-Source: AGHT+IFncYfQLZzLO9PxJRHTbcQAlKTjUNCZ0jwHv2Xpg6+UDCdisti3XOyvr9rdDHjH0Z4kclaw5A== X-Received: by 2002:a05:600c:4685:b0:439:a0a3:a15 with SMTP id 5b1f17b1804b1-43ba67045camr27125335e9.14.1740739206381; Fri, 28 Feb 2025 02:40:06 -0800 (PST) Received: from eichest-laptop.toradex.int ([2a02:168:af72:0:31d5:4145:8035:cb68]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43b73703caesm52078855e9.12.2025.02.28.02.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 02:40:06 -0800 (PST) From: Stefan Eichenberger To: vkoul@kernel.org, kishon@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, p.zabel@pengutronix.de, tharvey@gateworks.com, hongxing.zhu@nxp.com, francesco.dolcini@toradex.com Cc: linux-phy@lists.infradead.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Eichenberger Subject: [PATCH v1 1/2] phy: freescale: imx8m-pcie: cleanup reset logic Date: Fri, 28 Feb 2025 11:38:33 +0100 Message-ID: <20250228103959.47419-2-eichest@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250228103959.47419-1-eichest@gmail.com> References: <20250228103959.47419-1-eichest@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250228_024008_282834_28B5DE72 X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Stefan Eichenberger Remove the switch statement and base perst release on whether it is found in the device tree. The probe function fails without the reset property, making it mandatory. Therefore, always release reset independent of the variant. This does not change the behavior of the driver but reduces driver complexity and allows for easier future modifications. Signed-off-by: Stefan Eichenberger --- drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c index e98361dcdeadf..00f957a42d9dc 100644 --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c @@ -141,15 +141,11 @@ static int imx8_pcie_phy_power_on(struct phy *phy) IMX8MM_GPR_PCIE_REF_CLK_PLL); usleep_range(100, 200); - switch (imx8_phy->drvdata->variant) { - case IMX8MP: + if (imx8_phy->perst) reset_control_deassert(imx8_phy->perst); - fallthrough; - case IMX8MM: - reset_control_deassert(imx8_phy->reset); - usleep_range(200, 500); - break; - } + + reset_control_deassert(imx8_phy->reset); + usleep_range(200, 500); /* Do the PHY common block reset */ regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, From patchwork Fri Feb 28 10:38:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 13996245 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 B61EBC282C5 for ; Fri, 28 Feb 2025 11:13:54 +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=WeELFkCBmciSp0iIf8fE5k9zt2cDGYdFQgll90u98dE=; b=OM+81A+P9ZIXEv YNGmocEHM8Oy4LfOOf5YjpP2vH3Cdwea4ol7PWelrX5BgxaM1mO5/oTIMfzFOeR3bRzNGGQ4F0cvG 8ZkUzlYVo6t05p0X4HpYVjleGjqEIGor0+WFCbiizUsMCtsNAOAMRMcjz01KfSsy9A92Ggc78MncF 2wG+fXuHfsDMnjVk1+HkAAki08sctavW1OEiicF78SY8e2DOFTRk/IxN82r8VmXTSIdFo0RCsbO+n mfxAmv/KMrdu4EgjQk6Omx1iTj1ZNgDTGuY9KXu8eXUIo3ufRiLlTKY5EWWbJ1wXg2UT5RvC91FcL hSS+MnLG5X8R/LrlhAUA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tnyJW-0000000AiSu-0sir; Fri, 28 Feb 2025 11:13:54 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tnxmr-0000000AdFq-0Ieo; Fri, 28 Feb 2025 10:40:10 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4394345e4d5so13731685e9.0; Fri, 28 Feb 2025 02:40:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740739207; x=1741344007; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kNQfrx2+Y7l3TBgRs2HYeEusAxTadJTrsHyF6Qzg2L4=; b=McpUWGKodfIz+M4v/kIA9zKFFB7FtgObKSjsKSd7+FWF0gOFUeHTggXrq/tCeblmj8 FQ3Uc/6TC4cw/DKa2ZOy9jHP7BvdDjDPNsXIVwfXoruycK8h6WHZAYDsMgPuV0Cpbd60 1/3zDHb2hpI0l8sxORol+L/enflQusbM+n+GD0wQSEl5xSMGYx92ilFTrmZdqaOFbLvs 13CNIz9O6aPEeHuUjXEP8o5xq6uhrz6f9yUrNqmKWWlY/l42jHsLGnNdhXghW3ESRDPu 7VYYI1/Tq5T8DKamUM/0F9bqbwcllrEw51D2NEdhXy8gNOpe+CtNphtQTNfMxcFtDlJb ONOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740739207; x=1741344007; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kNQfrx2+Y7l3TBgRs2HYeEusAxTadJTrsHyF6Qzg2L4=; b=ra/4ht1btfrFwyW3Rqgu3oSO63gceUSGJY3VOI5DYoGs/iSme1RKGMjg8YuiaI79lR yN+wthaz4yhSA3XLKrIqhO26yR4FsOJwYsYnSXT8BQuBFQZfOKzD+gbf1ubfBCNPsLn3 HRYLMsNf2lAHwHhNbgm0vG7/6IDE2yM7WtOxpUXrNZLRMqVuxCCe9dAmGyvuukks3+jV 4rfb3Tnf83eeQ7Aht7DHOdS5N1xsgoYuknGbJpY94tN+LRFXhxvrzjIdb0fDKEakBIK8 /1qX1EQnq0sycxzNk7VJO6ZBlJVPYi8FlYiRq34dZhCdv1UF4SeX9bhQTYqASfoCmjr0 Voeg== X-Forwarded-Encrypted: i=1; AJvYcCVGKlf4KcGsY+PwQMz5/XLRVsCG4e6LWLG/hQ8edqRL+SYnAjUtlV/7ATLnotI0GeeyPiOlr6D58BnOtRkeF6eh@lists.infradead.org X-Gm-Message-State: AOJu0YzopFW9Q+a4KOyraWI8iboM3OopvwKWHfzGwXw0PFmkBVvsuE/I 8T6AVk+t2+ApshTKK1f9O/3MqdihEd6oEJBz3TB3eZRu4x482hmP X-Gm-Gg: ASbGncuKjTIXddJ9nKJOlRcyV1l+rMT4wpdN49FGAMcnnuQaOWLh+p4l4vq08GE3TJn ZmEGSxMJDe1LPwKodS1jOdiBAoKUpIyfV1sUuF9eLMntnMKsCxCAsHFzLuuehE20eU7/bFodIJX Hr9JTecvQVB447lI0tXoJddTuqESSEp2o9SDpOvUEDkXY1cRn+UW72S48N2a+fWgGX9QOgZQSi8 MuumshgVvVTCygyTJtaJHQ04pnjTxyUIuDoGHcywrtcp2f5uNonXpo1Z6vOvzW/JKb3bL8jzVuw S84LZ6dBKHsM2BbB7fw63MYv6HYlINBYWnINBjJFgQ== X-Google-Smtp-Source: AGHT+IHwAKMkbQkKZji2hIl2kLJahCHtsGvhDRkHSsHi5xjEjBT4SBZNdGXhe19X/KZFU+W8IlL/xQ== X-Received: by 2002:a05:600c:1c95:b0:439:8bb3:cf8e with SMTP id 5b1f17b1804b1-43ba67606abmr21106225e9.20.1740739207395; Fri, 28 Feb 2025 02:40:07 -0800 (PST) Received: from eichest-laptop.toradex.int ([2a02:168:af72:0:31d5:4145:8035:cb68]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43b73703caesm52078855e9.12.2025.02.28.02.40.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2025 02:40:06 -0800 (PST) From: Stefan Eichenberger To: vkoul@kernel.org, kishon@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, p.zabel@pengutronix.de, tharvey@gateworks.com, hongxing.zhu@nxp.com, francesco.dolcini@toradex.com Cc: linux-phy@lists.infradead.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Eichenberger , stable@vger.kernel.org Subject: [PATCH v1 2/2] phy: freescale: imx8m-pcie: assert phy reset and perst in power off Date: Fri, 28 Feb 2025 11:38:34 +0100 Message-ID: <20250228103959.47419-3-eichest@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250228103959.47419-1-eichest@gmail.com> References: <20250228103959.47419-1-eichest@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250228_024009_109504_4DC40FC9 X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Stefan Eichenberger Ensure the PHY reset and perst is asserted during power-off to guarantee it is in a reset state upon repeated power-on calls. This resolves an issue where the PHY may not properly initialize during subsequent power-on cycles. Power-on will deassert the reset at the appropriate time after tuning the PHY parameters. During suspend/resume cycles, we observed that the PHY PLL failed to lock during resume when the CPU temperature increased from 65C to 75C. The observed errors were: phy phy-32f00000.pcie-phy.3: phy poweron failed --> -110 imx6q-pcie 33800000.pcie: waiting for PHY ready timeout! imx6q-pcie 33800000.pcie: PM: dpm_run_callback(): genpd_resume_noirq+0x0/0x80 returns -110 imx6q-pcie 33800000.pcie: PM: failed to resume noirq: error -110 This resulted in a complete CPU freeze, which is resolved by ensuring the PHY is in reset during power-on, thus preventing PHY PLL failures. Cc: stable@vger.kernel.org Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver") Signed-off-by: Stefan Eichenberger --- drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c index 00f957a42d9dc..36bef416618de 100644 --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c @@ -158,6 +158,17 @@ static int imx8_pcie_phy_power_on(struct phy *phy) return ret; } +static int imx8_pcie_phy_power_off(struct phy *phy) +{ + struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy); + + reset_control_assert(imx8_phy->reset); + if (imx8_phy->perst) + reset_control_assert(imx8_phy->perst); + + return 0; +} + static int imx8_pcie_phy_init(struct phy *phy) { struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy); @@ -178,6 +189,7 @@ static const struct phy_ops imx8_pcie_phy_ops = { .init = imx8_pcie_phy_init, .exit = imx8_pcie_phy_exit, .power_on = imx8_pcie_phy_power_on, + .power_off = imx8_pcie_phy_power_off, .owner = THIS_MODULE, };