From mboxrd@z Thu Jan 1 00:00:00 1970 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 620ADC3DA61 for ; Sun, 21 Jul 2024 08:08: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FY4DAi3VK4i6xb+rcQzINZyn3e567giP+EgpACj5DS0=; b=Jlvkw0noimHeQAo3b6+2IT8uLv Sx1XEUukw9ZaZYl9x6O+H7SNVrR9cD8bgNcFBbEzu4hw6JvWSvLsbQOmVfh8WD9YLiN3EGJcZw3by s6IprYhhT5ThyzVUS9DgzhBCsvVa0f3fW2hUDMsFAnmQNznqPgGS6zT5zEvc90RNXWiw7KXIxoiQf GDBDpmbjwqurpr/0UwraaLuxeKYQjWN51HFEkkaNnu0S1fXWTED7dq4TGrAia6vjwd55AGAXIS6U0 TUaEz4wJF0Vin6OlompOk+wO1Zk16OukEU2i/76TNgNFhNt1Ry4vuSliw89voJiZPs6A7RdfN6ype nbGH4oPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sVRbz-00000006RWx-0opn; Sun, 21 Jul 2024 08:08:07 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sVRbd-00000006RRn-1tVj for linux-arm-kernel@lists.infradead.org; Sun, 21 Jul 2024 08:07:46 +0000 Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1fb3b7d0d3aso18713745ad.2 for ; Sun, 21 Jul 2024 01:07:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721549264; x=1722154064; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=FY4DAi3VK4i6xb+rcQzINZyn3e567giP+EgpACj5DS0=; b=nHFRIiwkHbvkrrda2WURo299IX7TQxmNa/gT2InY4F2KceyPc/n6y+rMDieFMZ22xC iXkVZKj8ouf+lJMLmnoaKnP+DyJmA1PBGhA+XZdZNhE6zqe3e7tJ3Bfp/K0TQAYeMcS2 pURCrK+S8K9/V2QQUhNMrBeHgjGMIJ1JAKDtFML/L+yitBVJhztBQ8RnQXfQ8pO6v7fq qohpQ2rO/TibsWDed3Uw7vzYGYTvadDRzo7yF1oWvNhy4OK5MZe2dLjeeL+amkbmO2lb DClf7sdDtT85wySvg2FM7DWFJSs1vjIOOOkrvc9CuxXNWgiMORp5dekxzMT3ATySyMs1 ZJRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721549264; x=1722154064; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FY4DAi3VK4i6xb+rcQzINZyn3e567giP+EgpACj5DS0=; b=HCcAJRcMrqNYif+GGkrXlgkmUjn7TKcJ9Msf9SzalY0HuyVvZYk6JLrR9D1EQLPQSW zSlfWAUbBj3DMk/4J7n/jyoYa2g0F+AVF4gBq1nNg272vmHXuW+JFK6VmJ0n3T+8HuCT jGOiH967tt9Nm6R/Fv8xCA1YAnsHwsWyeYoyW73UUinCYS/q2zjGUoD7LyPeiwfxdrEP B5QQYATdOYZjYxLsT9TQSF75vzBwaNHqIGWchhsKcwrJLb0/CaEQ38zAkSboVFpb6dEf 2x7pM8T6UBAxuQ5xl1uv9AwyXzbiXvKOxhUbOCTM0doxhibiwRcxcZ4UTeVJ9nu8JZdS wybw== X-Forwarded-Encrypted: i=1; AJvYcCX0Sjp5IY3LXJSFUqoT316iXsoz12BGs8OIndxRtV8P29R/aERYU6YjJSZWe+S5neW9dCn4r4PgzasHHC96/c2xg5Ceog6rn9RjM7yNl2EHI79qxD8= X-Gm-Message-State: AOJu0YwNVSod58+emZHgl5al+qZWDRXEZrs54Jf216hHFDxMTrFyVH9M 4Jo7JQZdG45KV8WTL3oMDp8NCNmUNBaJ0rugQ3C1F+TrtoffoIr1+wExkOzRtw== X-Google-Smtp-Source: AGHT+IHLS+82V8WDv+DxOBruh31E1ZQpXfA1aKcSS2KRnMcW++Iewr3PJOotonJexwj4BwLKmdHEvA== X-Received: by 2002:a17:902:d48f:b0:1f7:3a4:f66f with SMTP id d9443c01a7336-1fd7462125cmr50457945ad.43.1721549263981; Sun, 21 Jul 2024 01:07:43 -0700 (PDT) Received: from thinkpad ([120.56.206.118]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fd6f42c879sm32576175ad.188.2024.07.21.01.07.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jul 2024 01:07:43 -0700 (PDT) Date: Sun, 21 Jul 2024 13:37:35 +0530 From: Manivannan Sadhasivam To: Frank Li Cc: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Krzysztof Kozlowski , Conor Dooley , linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v7 09/10] PCI: imx6: Call common PHY API to set mode, speed, and submode Message-ID: <20240721080735.GF1908@thinkpad> References: <20240708-pci2_upstream-v7-0-ac00b8174f89@nxp.com> <20240708-pci2_upstream-v7-9-ac00b8174f89@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240708-pci2_upstream-v7-9-ac00b8174f89@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240721_010745_517905_199B59F0 X-CRM114-Status: GOOD ( 23.07 ) 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 On Mon, Jul 08, 2024 at 01:08:13PM -0400, Frank Li wrote: > Invoke the common PHY API to configure mode, speed, and submode. While > these functions are optional in the PHY interface, they are necessary for > certain PHY drivers. Lack of support for these functions in a PHY driver > does not cause harm. > > Signed-off-by: Frank Li Reviewed-by: Manivannan Sadhasivam I've mentioned an issue below which is unrelated to this patch, but please do fix it (in a separate patch). > --- > drivers/pci/controller/dwc/pci-imx6.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 57814a0cfab8c..c72c7a0b0e02d 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -229,6 +230,10 @@ static void imx_pcie_configure_type(struct imx_pcie *imx_pcie) > > id = imx_pcie->controller_id; > > + /* If mode_mask is 0, then generic PHY driver is used to set the mode */ > + if (!drvdata->mode_mask[0]) > + return; > + > /* If mode_mask[id] is zero, means each controller have its individual gpr */ > if (!drvdata->mode_mask[id]) > id = 0; > @@ -807,7 +812,11 @@ static void imx_pcie_ltssm_enable(struct device *dev) > { > struct imx_pcie *imx_pcie = dev_get_drvdata(dev); > const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; > + u8 offset = dw_pcie_find_capability(imx_pcie->pci, PCI_CAP_ID_EXP); > + u32 tmp; > > + tmp = dw_pcie_readl_dbi(imx_pcie->pci, offset + PCI_EXP_LNKCAP); > + phy_set_speed(imx_pcie->phy, FIELD_GET(PCI_EXP_LNKCAP_SLS, tmp)); > if (drvdata->ltssm_mask) > regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, drvdata->ltssm_mask, > drvdata->ltssm_mask); > @@ -820,6 +829,7 @@ static void imx_pcie_ltssm_disable(struct device *dev) > struct imx_pcie *imx_pcie = dev_get_drvdata(dev); > const struct imx_pcie_drvdata *drvdata = imx_pcie->drvdata; > > + phy_set_speed(imx_pcie->phy, 0); > if (drvdata->ltssm_mask) > regmap_update_bits(imx_pcie->iomuxc_gpr, drvdata->ltssm_off, > drvdata->ltssm_mask, 0); > @@ -955,6 +965,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) > goto err_clk_disable; > } > > + ret = phy_set_mode_ext(imx_pcie->phy, PHY_MODE_PCIE, PHY_MODE_PCIE_RC); > + if (ret) { > + dev_err(dev, "unable to set PCIe PHY mode\n"); > + goto err_phy_off; 'err_phy_off' should power off the PHY, right? But this label is used to do phy_exit() which is wrong. Please rename this label to err_phy_exit and also use _this_ label to power off the PHY after the failures of phy_power_on(). Right now, PHY is never turned off in error path. - Mani -- மணிவண்ணன் சதாசிவம்