From patchwork Wed Mar 5 14:43:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 14002918 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 9267DC19F32 for ; Wed, 5 Mar 2025 15:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=adw/wXG4xAXtVNNpVBpZ7rOz/ozzGq1WFDZ6AcGQFEg=; b=Ae8+WFZ9jx4yhPU4T3SXHrYVBE yFwpvNBlWCzodGqg35jCXGCGCY8r7EOAjuSgFJNrCfUCkzOpqMB7dFvl/DTpOoDdifO+O7vQNBHl2 oGPQyYeiVjJzRwf36ICQpORv2sYjD9UCtSNZjkI/PepbSgCHX+fIvcSAudXSqKtbQoE4MM8hwIB6C ZtXBe7tXj8CKqZvUVeDNNX3va1X8YLpilox1YZxzwccSFxait+mAtWCgIIqsQs1b3+yBg+iRajte9 Rz8Cu3BsL2PRdA8KWu84LzBr9DugvyE9IQXHVrmPjudoj8LhZbR0z/WbhvHkHQvcH2xglg0V/0C70 fHQMdieg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tpqzH-00000008Yg6-2RJT; Wed, 05 Mar 2025 15:48:47 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tppyl-00000008OUZ-0rGX; Wed, 05 Mar 2025 14:44:12 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-390f5556579so3070201f8f.1; Wed, 05 Mar 2025 06:44:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741185849; x=1741790649; 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=adw/wXG4xAXtVNNpVBpZ7rOz/ozzGq1WFDZ6AcGQFEg=; b=i3OWqoirVmifUsgzEbZLb9bVjMEZMY3woSydlOm4FqRGyTEQIh6bQ8DXmgJZUg+vwL hCS7IeQ873rFwmWnrKALPG4QSGUvdnC/lFgaUZIE7rivs21f9ImspGAu4bp2gpQgUF9c vIGtQxXKgZI0ev4M+J8vYuX25J/eIEmAKivUBJqka9ys/UnGqwPDJESj6wE8vj72OLvS pJzrEqZHeqndWO8kLzAmyoe2Wkqj5e9IGXAvvfb1O8+9KCcuglbTBfXqYVVXe3royhzp 4tb84GTz+2ybibbiXMFvboyxN6WFHPV1AYrcCpkspcu3w0j+WBHzRJZrDNt7jXDNEWlg R9ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741185849; x=1741790649; 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=adw/wXG4xAXtVNNpVBpZ7rOz/ozzGq1WFDZ6AcGQFEg=; b=jpc6W8UKmONStLbqQ/+VJyFkKPTx6A1BfI9wcfZ6hjg9x5Zmbkeh604LiI5sPqM01b IAy86gSumbUe+qSmS92qrxLCBV9iksc//S/vJKnGsLzIWdHRBeRYNBDhX6qpwr43zfC2 oXpn/b/aRhsTc1bPhcIdsJ6XDoon5XKfy/fZkSX8FgPM06iN0f0ldCfbI+oNt3XXBC3c cxS/SVuYbJoGOJtpNOHxrio5+QmfcDVH9wXN2BUM2B8qbcAF4HEt7+Uzn10m/FuO22IX jVOIxl1UJJnwLDruxpEheIWs1almjWJJ1XNyUD6XNZZaZc/mYxKn9G75Ft9CKbw4AMF/ SdWA== X-Forwarded-Encrypted: i=1; AJvYcCWNnAU23+xdVAEFNOfWE6QC0gmb/hJ3aGM5tgFwcoiwWrnYdIlxlZ9r6SNPDoFcRCSLa2rv7XU7DqJV1Sc6a7Pa@lists.infradead.org X-Gm-Message-State: AOJu0YytB8OnBTMWXtvymIyV/TUH+pH1BENBMsUrq4VIBrAJPeFH/2yV bPeEWQkIxL1cfG81fpWuyEymy8rY79uZTJQ6KoXYobl3AoQQa/d/TLQCmh+N X-Gm-Gg: ASbGncsmysD3ucNNm82xFn7L9qWf/NntR2LKbcdo4Leh1fAK/eLAFwcFza8ZYLOb565 2M5Cd0BdZleB963czzfn0akXUSvzB/CH8wGz4QLYjwQy8VkHlw5RB5ef0glLoejcJPmnoB1P/BB DyaIqVWi9mure8NEzEzYJPjAZiCn5Va+jKNUtybs39suczPszVQA4Vjg7SOQj8x7yIxgDUZ8xuw Y0wbD1xp2jCaFJ2s3tU6EdqucFiBAobHEMLQebklOnDj3KPGqNS7Lkd6AIfxsWaNTQgiaDuzbPD ned4Bj4vmsC/qPrJOdKhHlvez6dItrLbRMhIO0+cyodnpS9C X-Google-Smtp-Source: AGHT+IFbsaX9wmtUFug2h6kZAAYC0Hb0y6lxNl62FVu79knUqZWExgLI4s21uIXSphigDaJmEpgWiw== X-Received: by 2002:a05:6000:2cd:b0:390:ea34:7d83 with SMTP id ffacd0b85a97d-3911f76f519mr3393536f8f.31.1741185849295; Wed, 05 Mar 2025 06:44:09 -0800 (PST) Received: from eichest-laptop.. ([178.197.169.96]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bd435cd8csm19314375e9.40.2025.03.05.06.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 06:44:09 -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 v2 1/2] phy: freescale: imx8m-pcie: cleanup reset logic Date: Wed, 5 Mar 2025 15:43:15 +0100 Message-ID: <20250305144355.20364-2-eichest@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250305144355.20364-1-eichest@gmail.com> References: <20250305144355.20364-1-eichest@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250305_064411_246059_7B25DCA6 X-CRM114-Status: GOOD ( 12.10 ) 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 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, 3 insertions(+), 9 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c index e98361dcdeadf..5b505e34ca364 100644 --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c @@ -141,15 +141,9 @@ 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: - 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->perst); + 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 Wed Mar 5 14:43:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 14002865 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 26283C282DE for ; Wed, 5 Mar 2025 14:49:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gNwIlbvFX4QRldBXaIs5/RL9LSC9AEjKyZahDbOst8Q=; b=IdvOSLgAE1desyA43GzKOEa/xg zU56FwX95/FXajLpU87h9EbZ78wbD7+vTlE2Xi+N6rdvendssv+P+kxfnX9tCosEeR9zV1zfK0oBo QMY5PjGg8eexRLVoKPSgh0j+1v7sCQ1C421JRoI3AUowKVm+Ycuohdrt2v/0ry6NtGDsjxGisR0m8 nDdh56Qa4aqkgHktlTarUXu8oRdMEw7FGrS1Gy0ej2vzfO8KLl5rr8H6WupjDfTXQP9EoHDGrdhzD GLcfNF1YTdft+APIgeh3wb4NG58o/rp86hGO23vn9bJB3Gz6NN2VRhJAQWIT1ezKA80gp8J1z40re NVPHf78A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tpq3P-00000008PN6-38Dp; Wed, 05 Mar 2025 14:48:59 +0000 Received: from mail-wm1-f47.google.com ([209.85.128.47]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tppyn-00000008OV6-339Q; Wed, 05 Mar 2025 14:44:14 +0000 Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-43bd03ed604so11934355e9.2; Wed, 05 Mar 2025 06:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741185852; x=1741790652; 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=gNwIlbvFX4QRldBXaIs5/RL9LSC9AEjKyZahDbOst8Q=; b=KhC7SodpMU7bX/sVKnaYkeRkYEShET85Tm4LeFW0jGemMYbaDo2FUImQiVDs0KIuue SEoNvj3et7XdPcdUolWXsq1qwHFSnekkIoWvfrfJsMFl7JT0hJLfrfeoE8l7oXu4DMJ3 xy1+/hkvKRXTd61SoUuKgAYOeteezW40npjW7xFG19tIKfomXhBR8R+USD8XhtqI6CAM EhfjN/9Kx/kex1hVwYXG0NogpINF5rwTtgLN2Umn1GrNFmmD7gNW/QNEvR6OowvXvLjC hgX5zJf6rrPQOrjXo89evK/Fb5UUnEguUMtqapNzaIfutYn/Cka2CDlbt8Jew4m4E10/ nSIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741185852; x=1741790652; 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=gNwIlbvFX4QRldBXaIs5/RL9LSC9AEjKyZahDbOst8Q=; b=sykyrrG/ut2VoxSdc/gxeXrlRxbDixZM15rup0azRWBy46y9dxOkle3KoTAv9O8p0E gcFLPVPGtCBj+dttDu77OEa63hM1uh7FPOESSKaMOB91H5vS0Bm1CZYuouJcqtQNkV6R lhiADU/AdbELx6h+vcOpSjfiIdDLjZ2qQxS3G1kMiqJup6yj+8yby05+N7BHoC0Vne3B s0qsFwLuKF8IdLlW4Ko2y20sRuHWzyCXhUDhp6fLduprtW4yDe7T1MFPkgmE1fLdxqBM LgboPp5zvUsQ7hQH9Anl/GtwP+SGxDobZaID0dvdyXF3Uc/mbWOIc8cOCnTkDyPrQr/o KOAA== X-Forwarded-Encrypted: i=1; AJvYcCWQQJPwPhmNjVoSJJfioGcxrIm0JjmJD8RfcoGQOIldvF9mDOa+47JmcuaHp1FBWFPawof31CqFdU1Rlf0i+khx@lists.infradead.org X-Gm-Message-State: AOJu0YwChTC+a6CVEmmaol0JGVb+7tzfnOdxk+VF/6J8kMh5jq7gzKoQ Arr47v1HvHYw8kwnNfq/5y/5eZ0ZzqWvcz159pp5ZGBZsmph2za7 X-Gm-Gg: ASbGnctXe3uIXXIxtyqYVF11OkXFHyHpNtJ/C3OjfGuFYlcVxoxN1a6/A4dFXGqmy51 zUNJW0gl+93rPeKFAnYy+JS0cpKZzhgMdPRSrkE7Lgz9Ct7jXCDXt/1slGN1HL7o6Oea7YBTIls oH52TvHCA7Zyh92haYeqYcdaPjUWujuNkydH5kVF5EuPjZkKvbpF/UGCaXAL5LHM1vp3Zq2EQ7h TcIEe9bEiYIBkP0v3GD9fbWX9XduJPqg3iPlPaIvaCl3G7XzffMticO66wK2T9t1Ka4xQsNrDJ2 cblRJSl0c7gzh3umQ6vzmasypPun1duy2NB1P5zPPJ8HLuu7 X-Google-Smtp-Source: AGHT+IFJVniNBPju7U0+Zkvo7cT0yiY6E+Oe3yG3cuVYvnJhnTUke2U3Jt13V/c1QPsHTlV77FcZzw== X-Received: by 2002:a05:600c:1c94:b0:439:7c0b:13f6 with SMTP id 5b1f17b1804b1-43bd2ae52d7mr27450545e9.31.1741185851384; Wed, 05 Mar 2025 06:44:11 -0800 (PST) Received: from eichest-laptop.. ([178.197.169.96]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bd435cd8csm19314375e9.40.2025.03.05.06.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Mar 2025 06:44:11 -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 v2 2/2] phy: freescale: imx8m-pcie: assert phy reset and perst in power off Date: Wed, 5 Mar 2025 15:43:16 +0100 Message-ID: <20250305144355.20364-3-eichest@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250305144355.20364-1-eichest@gmail.com> References: <20250305144355.20364-1-eichest@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250305_064413_768126_0AD4F015 X-CRM114-Status: GOOD ( 11.45 ) 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 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 Reviewed-by: Frank Li --- drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c index 5b505e34ca364..7355d9921b646 100644 --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c @@ -156,6 +156,16 @@ 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); + 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); @@ -176,6 +186,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, };