From patchwork Mon Oct 21 15:52:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13844372 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 6CF38D15DB6 for ; Mon, 21 Oct 2024 16:00: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding: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=TxJ7QA8KaqJkauTfjxsCNmO4G/MQwnFXkQnmdpx9NVY=; b=lUlyy4hD4Q1TzMQb+2dihPA8Ql OGO7bd8S7yo6Rw77oxXiCBnz4C+4QBVq7vNkJ5RAos01eR6CJ8qi7v43SKGk8I+F6sJyhenkJX0as n92VBYMAWDYOg4ecQGMWlwVe4cikmafhqPMVWfwlowXw5RjUzFZclFo1rv7U+r6d86V4x7KpV/U3V J8a8qRHxYpR3zepIYS/COwfKwynr6guVPhNDanIw7YIWFQJzErfqu7pm1iziOr53ZeDtOsmeZHLaH N6ykKSnprknQy/zQLtuqXgB1IvyiTmn4JBjpaMFzbmSQPLIjKrrE78u25gPdZYS9nnc8fYbrSJFTn rh7aOyfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2up5-00000007tH7-0k2G; Mon, 21 Oct 2024 15:59:59 +0000 Received: from mail-db8eur05on20612.outbound.protection.outlook.com ([2a01:111:f403:2614::612] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2uiL-00000007ryQ-1R2A; Mon, 21 Oct 2024 15:53:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dNrkULC5fdenJM8iaY9OFC0r2K+TU6T+cp4BTQpq8bt18M9ULghoFQXlI8C+ii1g/dfA2K8WFiXR6649/y9ODr7XSNBtslk3aUWn7JPOi60+ScdW9i5n+SyaCqpDLZ15+j4lV5Qa5iJrkRe62xUXyCjyPFJoE/Bl+qUM+8snZQof97SQ9q8NhEDpdw//Bl5UyFrSzAvqk3EOC6m/sWromFd6Uew8Bq7xtoSabK/JbFIqmKKXvOOuASkPDRmrWUnhiFYcmUyP0y7xzpJA/Nq2/lFrH+Zcau/usG3OGM1TQQ7KfAU+pvZ4PSEEzRKKaSejLTNKed8OEiFzRJeiVsqi9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TxJ7QA8KaqJkauTfjxsCNmO4G/MQwnFXkQnmdpx9NVY=; b=rjGc1+SaFbVK+oBydHc44zfEjojnbpaOKvh91UeJbCq9VqQ/DKS4ROEJj+x32j4x1xlzdshg0+fKU8JwHdwTCuRA+fdPU9V4aUE8j4Kt+ImZvn1K54lvZ8ls+7BuTN0nJ/bruH7nIxITEFN3stBXaU1+45cR0CB4zD2DRPTEO+8wXsgDS5BddpDIGjtaGvnQV5Z0AnO03ReoXXxH8ZzGa3dqaaCyGn6Olpp2Z7MWo6gJmgcG26lApYVnZGU4xfZmrzL/LcllbLH5mNkp3JvhF2ayKKdOE6SjHuwe88kF7dXFZasYHis99UZ58LOdJHvUEhcQMLGTjMixba1/R1FIZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TxJ7QA8KaqJkauTfjxsCNmO4G/MQwnFXkQnmdpx9NVY=; b=F4h8eZwkFRvMEM+KP4Ft4vFZtFoAAzrjh24hbOMFLXd/uPDBXDFqml0btYJeyKgLgOsws9V31mmZIiDH+r6pixk1SbeIRxS0YvpxaPRXmbomHMRnLGJl5d/3SSsvq35qJutVyo/JZHFXG05RVidhCnoGVJnhS6wqhhZ4CQJBt1vRMeHsi5L10qx2VzK43lGVpUnR0r08+A8LlZKq5fH4KjWSH0cjmedle4gXtf02+YvlbwZIT+JQxwya3dWHy4mB4znpn7zS+YP/rvucBqYTUPBkyR4Lw4fqut5HWOjd8beQvyhCv7uG5lfztOXHInPta2/UNUw9RRwmhiWt7yXBcg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) by AM7PR04MB6790.eurprd04.prod.outlook.com (2603:10a6:20b:dd::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 15:52:56 +0000 Received: from DB9PR04MB9626.eurprd04.prod.outlook.com ([fe80::e81:b393:ebc5:bc3d]) by DB9PR04MB9626.eurprd04.prod.outlook.com ([fe80::e81:b393:ebc5:bc3d%3]) with mapi id 15.20.8069.018; Mon, 21 Oct 2024 15:52:56 +0000 From: Frank Li To: vkoul@kernel.org Cc: Frank.Li@nxp.com, festevam@gmail.com, hongxing.zhu@nxp.com, imx@lists.linux.dev, kernel@pengutronix.de, kishon@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, marcel.ziswiler@toradex.com, s.hauer@pengutronix.de, shawnguo@kernel.org, stable@vger.kernel.org Subject: [PATCH v2 1/1] phy: freescale: imx8m-pcie: Do CMN_RST just before PHY PLL lock check Date: Mon, 21 Oct 2024 11:52:41 -0400 Message-Id: <20241021155241.943665-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: BYAPR04CA0019.namprd04.prod.outlook.com (2603:10b6:a03:40::32) To DB9PR04MB9626.eurprd04.prod.outlook.com (2603:10a6:10:309::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB9PR04MB9626:EE_|AM7PR04MB6790:EE_ X-MS-Office365-Filtering-Correlation-Id: 82fe5cf0-fd06-46fc-148c-08dcf1e86e23 X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|52116014|7416014|38350700014; X-Microsoft-Antispam-Message-Info: spicvokFsSKZQOUTfcu6qFVSXaTOI29f1xFR1dGAKdzQ23xXc4tscjPzj09/CEBOhvMglvITNw9vgMhixfPkfN1UXDEHu9LHuQa/RoiedA5+fltYINeyeje2pYZsv9gJWEPqnSyLR1+4D6Ko8NjxIAN6Opa9FsDRldnu6JFdiMAV1+bC75QxgCs9IbV/YPW203mEr3Xn0h7ZBBLS8uDN+lyzfSx1Absmmc6x1e4w4shgOo6ZVPftM8YDszf8SDpOHfD8d2br4sBvsMxq0wOKExUOfPa2j3VLRnSSPxu08sCsUhqeCJCCT6xqh0S9uW0+kN9IpgFdWA9/WkKvCZVSQ/Y1rogut4dOrrwW6DcF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SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB9626.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(52116014)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Zsq1rng2huf9CseiyzJFRz9w6NEDJjSfALGqWG+ggtEjHeNRCFt8j9ULcj5iT5i4X6EXkZ62to0eZmvKCJu/KfaZ38jalzSaQOYWaVtLfa8rzwSbA5ID+l4axlQ09Fs4nElXnZcLe0F3lk1L1OBT8aUs095PPErtc+dD1QQFxATyvUODcwC0zfrs4vro9SqwtYBxyfWcrjW8ZjkBEpniZ1pJoxTn2PVUP+KnylODlTVABBaUdNTF5cBAOr1FeIWV9SWT6JbukKELbkSh2EIOsL5YjBwvbEwDj0GBdz8tmkxYoPubOPavQkoh3txC+HfgdWVq1xRp2/Q5HuF+DmxzI4oK7QhDKvdKwCW/kBrfGmV/wceAumzuDY0W4F9Ifu2h+QQvJIZ5anLvWO+UAtNzGsW9jBqPO/cXmqE0ZEoyLZMM3U9nYG7FW/ogXjOpM5r3NcmktfwqGEqdRrFjeCLD8Oq5IpMkrlAraK956ZCSIKokXeaJFQkQ/O/F49ycKdMMxm6VJym401n4/ezBOHansSC3TaAhG9sR5LgYdqRUa7AtyVxaIy/XxPOJWyBxbaqswhCKxSU+lUQzw0buQYAsFqrSIPLYpLoURki/sM9rANBbMCdRsA5yo9Se1NCoEKd/N6JVttbNtSRUZyM3uxuo8kCo8+LzRFYWERJoci+pO+qmnjNoZEX63x2zFVtYlt0P6X3V8IDkVVttN9dwtFQ3CR36KJVIQ5ZXxbcWBwycP4aQrivKYYImMw8MvyqrA5JbEVdMka6/Qi4L76w+IrdWkX3KFbZO6v0unZWYgvCCWkJ5dAmV6C+Zwg2Vw38FJmbtvywnD+et3fhrundXwCIE16K0AaWGaWTIj5aIpiHzY/TOSCt+VFpGZpzbSf1pyIP6aIYhzeA9wtopE8XgeLQpdtsyoOTMgWgOcb1cHFBUu2Rqw0DcbjVIV8X7Ec6VF1wjy62sS7aShNyF7PWVFhkRKYF1aBAuQmsgzK+jNjZslcu3KMRitBpmkvC+/hQaLcqnZvnyvWXlD+IOJ/68t7xlCi2QZADRxqxiBlOhWXgCew7BmpyVNNmi2pOqqGNxfS5/QS9qWsebDmMV5HA1AEupsijME0F4pM9+98RQM7oKzNLZ5XEdu0LM5pRVvrdjoLzrqSMzw/kD+mcpKwmf87qr7BIrJmHaU7WtMXgUyg/4fl5hWDmZmLVkZArNjst4HL9hhLupxTIt0VFaFsEjcm41hJF6xY2rRXplr+K0IBQ8jbNY08YF04wb3zbl2lw4g0SVxifsBUV4rmbP5qX6ST239O+P8vFaVI/tmLitDVYbH6XnmJYOnjPPv55eriDkHHjgtWNRztbcPdn7dDAjyQB45syRwgRUDNKxtJU9PYbsiUFI4W/AHCfPjiTpv8ws1Z5G4pG5snV6aRq31p0BYZ16ZZdkTIgMLpULh7ohi4SUdjqpQcKl1h5mz32XU1HfaDoqHSm2mo0KMuaUyQRATf5Hvks6ShXmU0ZSteOY7UDiWgAgLH7eXp0Rn41IV0fJvQaxEdsxmhuT1XaTOP1Ul3BVhkD5DVRiaa3RzSGqk8d7PPU= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82fe5cf0-fd06-46fc-148c-08dcf1e86e23 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9626.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 15:52:56.3837 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iUT32ERjbkbgJCsbl2dntYeP22XETYFZCv0nDaGbfBQnCDQmcsQvjL3GiwBZTgVn2rspNEcb96p+NJQKN+nVcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6790 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_085301_432717_F459DC53 X-CRM114-Status: GOOD ( 13.35 ) 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: Richard Zhu When enable initcall_debug together with higher debug level below. CONFIG_CONSOLE_LOGLEVEL_DEFAULT=9 CONFIG_CONSOLE_LOGLEVEL_QUIET=9 CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7 The initialization of i.MX8MP PCIe PHY might be timeout failed randomly. To fix this issue, adjust the sequence of the resets refer to the power up sequence listed below. i.MX8MP PCIe PHY power up sequence: /--------------------------------------------- 1.8v supply ---------/ /--------------------------------------------------- 0.8v supply ---/ ---\ /-------------------------------------------------- X REFCLK Valid Reference Clock ---/ \-------------------------------------------------- ------------------------------------------- | i_init_restn -------------- ------------------------------------ | i_cmn_rstn --------------------- ------------------------------- | o_pll_lock_done -------------------------- Logs: imx6q-pcie 33800000.pcie: host bridge /soc@0/pcie@33800000 ranges: imx6q-pcie 33800000.pcie: IO 0x001ff80000..0x001ff8ffff -> 0x0000000000 imx6q-pcie 33800000.pcie: MEM 0x0018000000..0x001fefffff -> 0x0018000000 probe of clk_imx8mp_audiomix.reset.0 returned 0 after 1052 usecs probe of 30e20000.clock-controller returned 0 after 32971 usecs phy phy-32f00000.pcie-phy.4: phy poweron failed --> -110 probe of 30e10000.dma-controller returned 0 after 10235 usecs imx6q-pcie 33800000.pcie: waiting for PHY ready timeout! dwhdmi-imx 32fd8000.hdmi: Detected HDMI TX controller v2.13a with HDCP (samsung_dw_hdmi_phy2) imx6q-pcie 33800000.pcie: probe with driver imx6q-pcie failed with error -110 Fixes: dce9edff16ee ("phy: freescale: imx8m-pcie: Add i.MX8MP PCIe PHY support") Cc: stable@vger.kernel.org Signed-off-by: Richard Zhu Signed-off-by: Frank Li v2 changes: - Rebase to latest fixes branch of linux-phy git repo. - Richard's environment have problem and can't sent out patch. So I help post this fix patch. --- drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c index 11fcb1867118c..e98361dcdeadf 100644 --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c @@ -141,11 +141,6 @@ static int imx8_pcie_phy_power_on(struct phy *phy) IMX8MM_GPR_PCIE_REF_CLK_PLL); usleep_range(100, 200); - /* Do the PHY common block reset */ - regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, - IMX8MM_GPR_PCIE_CMN_RST, - IMX8MM_GPR_PCIE_CMN_RST); - switch (imx8_phy->drvdata->variant) { case IMX8MP: reset_control_deassert(imx8_phy->perst); @@ -156,6 +151,11 @@ static int imx8_pcie_phy_power_on(struct phy *phy) break; } + /* Do the PHY common block reset */ + regmap_update_bits(imx8_phy->iomuxc_gpr, IOMUXC_GPR14, + IMX8MM_GPR_PCIE_CMN_RST, + IMX8MM_GPR_PCIE_CMN_RST); + /* Polling to check the phy is ready or not. */ ret = readl_poll_timeout(imx8_phy->base + IMX8MM_PCIE_PHY_CMN_REG075, val, val == ANA_PLL_DONE, 10, 20000);