Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp187501rwe; Wed, 31 Aug 2022 00:31:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7k7JDLG7/hQ0ozczrMPIAJ+g5b8lC3HLHtkOoU0N0UQL5dqHLiaCPI548gVWb8hEgET1Go X-Received: by 2002:a17:903:2349:b0:174:cef1:69ad with SMTP id c9-20020a170903234900b00174cef169admr12176402plh.138.1661931081045; Wed, 31 Aug 2022 00:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661931081; cv=none; d=google.com; s=arc-20160816; b=UKEiVDPraauGTP+/ToQjrqrhArzaBJ8u0tPIRIgONJd6tu9lFNJ2mL7LQXAdGL0rE2 ddgO0tiwvOSryp8t5mkAscB1POsWDVUt5WcKBpyBu43kEjCff3dzLkJWeXrxea4Cu4aC PIl825RWdQ55gSh5pTxYxE9eyHsiAWJ3e5LfPwzp0bYbk5SMOOxFjXRyxf3E4F6mT/SF AaC2bsZdwB806Tf1Vi5k5TEZlHVCgYXllZOKBBuDnwtHLbwl/iUZOuuYqHioOGLog6C9 DPOcbZf/+sYf7CXLCzqCEnuumYz6BG3wqKx1/tnovp1hP5kTHDu0YCzmiO2/HP1YBWCg K2tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=ByfWm6x6slRFKmWijWgoYtQgNH2zoJQcMGPcqe2HF4k=; b=suFSryLb/SRFs77op7usc4v70hB3JHV5liDoD71BGfL0mDIdX8bzoNPGuI8Yrkw3RP J+dHVWiWl4kX2oMvBIf41QymiKiHTXYfs4lZPVLFHLAachWXWmkBEyW/TxHo/x53rzxi UUB+oDMX+53jMbspQoHE8UJwchxnDMcPTlZjZDlUo5emQbPdn4ggO06UMwjQ2dvLcyEa AGL2HGuFDIlLdz8nLP7TblHuGboR3Yo3P83FLh/yiqINxJL7je/cwc6gjfprVANb9tOd B7DbvJVBWE5ZVYYwt8DvesCxZDoJej5XIjRswGpbiDgbM8YQaxI/jzA5tjnFsPmK9pw2 E6YA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e1-20020a635001000000b0042c7045b592si4227337pgb.200.2022.08.31.00.31.02; Wed, 31 Aug 2022 00:31: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230022AbiHaHR6 (ORCPT + 99 others); Wed, 31 Aug 2022 03:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbiHaHRS (ORCPT ); Wed, 31 Aug 2022 03:17:18 -0400 Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E516F8C014; Wed, 31 Aug 2022 00:13:45 -0700 (PDT) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 34E12202067; Wed, 31 Aug 2022 09:13:39 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id F030A20203E; Wed, 31 Aug 2022 09:13:38 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 478E8180222C; Wed, 31 Aug 2022 15:13:37 +0800 (+08) From: Richard Zhu To: a.fatoum@pengutronix.de, l.stach@pengutronix.de, bhelgaas@google.com, lorenzo.pieralisi@arm.com, vkoul@kernel.org, marcel.ziswiler@toradex.com, kishon@ti.com Cc: hongxing.zhu@nxp.com, linux-phy@lists.infradead.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com Subject: [PATCH v2] phy: freescale: imx8m-pcie: Fix the wrong order of phy_init() and phy_power_on() Date: Wed, 31 Aug 2022 14:55:56 +0800 Message-Id: <1661928956-12727-1-git-send-email-hongxing.zhu@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP 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 Refer to phy_core driver, phy_init() must be called before phy_power_on(). Fix the wrong order of phy_init() and phy_power_on() here. Squash the changes into one patch to avoid the possible bi-section hole. Fixes: 1aa97b002258 ("phy: freescale: pcie: Initialize the imx8 pcie standalone phy driver") Signed-off-by: Richard Zhu Tested-by: Alexander Stein --- drivers/pci/controller/dwc/pci-imx6.c | 6 +++--- drivers/phy/freescale/phy-fsl-imx8m-pcie.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 6e5debdbc55b..b5f0de455a7b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -935,7 +935,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) } if (imx6_pcie->phy) { - ret = phy_power_on(imx6_pcie->phy); + ret = phy_init(imx6_pcie->phy); if (ret) { dev_err(dev, "pcie PHY power up failed\n"); goto err_clk_disable; @@ -949,7 +949,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) } if (imx6_pcie->phy) { - ret = phy_init(imx6_pcie->phy); + ret = phy_power_on(imx6_pcie->phy); if (ret) { dev_err(dev, "waiting for PHY ready timeout!\n"); goto err_phy_off; @@ -961,7 +961,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) err_phy_off: if (imx6_pcie->phy) - phy_power_off(imx6_pcie->phy); + phy_exit(imx6_pcie->phy); err_clk_disable: imx6_pcie_clk_disable(imx6_pcie); err_reg_disable: diff --git a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c index ad7d2edfc414..c93286483b42 100644 --- a/drivers/phy/freescale/phy-fsl-imx8m-pcie.c +++ b/drivers/phy/freescale/phy-fsl-imx8m-pcie.c @@ -59,7 +59,7 @@ struct imx8_pcie_phy { bool clkreq_unused; }; -static int imx8_pcie_phy_init(struct phy *phy) +static int imx8_pcie_phy_power_on(struct phy *phy) { int ret; u32 val, pad_mode; @@ -137,14 +137,14 @@ static int imx8_pcie_phy_init(struct phy *phy) return ret; } -static int imx8_pcie_phy_power_on(struct phy *phy) +static int imx8_pcie_phy_init(struct phy *phy) { struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy); return clk_prepare_enable(imx8_phy->clk); } -static int imx8_pcie_phy_power_off(struct phy *phy) +static int imx8_pcie_phy_exit(struct phy *phy) { struct imx8_pcie_phy *imx8_phy = phy_get_drvdata(phy); @@ -155,8 +155,8 @@ static int imx8_pcie_phy_power_off(struct phy *phy) 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, }; -- 2.25.1