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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44BB0C43334 for ; Wed, 13 Jul 2022 09:04:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235134AbiGMJEi (ORCPT ); Wed, 13 Jul 2022 05:04:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236043AbiGMJEg (ORCPT ); Wed, 13 Jul 2022 05:04:36 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26694E7AF2 for ; Wed, 13 Jul 2022 02:04:33 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBYIC-0008Su-7I; Wed, 13 Jul 2022 11:04:24 +0200 Message-ID: Subject: Re: [PATCH v14 16/17] PCI: imx6: Move the imx6_pcie_ltssm_disable() earlier From: Lucas Stach To: Richard Zhu , bhelgaas@google.com, robh+dt@kernel.org, broonie@kernel.org, lorenzo.pieralisi@arm.com, festevam@gmail.com, francesco.dolcini@toradex.com Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com Date: Wed, 13 Jul 2022 11:04:22 +0200 In-Reply-To: <1656645935-1370-17-git-send-email-hongxing.zhu@nxp.com> References: <1656645935-1370-1-git-send-email-hongxing.zhu@nxp.com> <1656645935-1370-17-git-send-email-hongxing.zhu@nxp.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-pci@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Am Freitag, dem 01.07.2022 um 11:25 +0800 schrieb Richard Zhu: > Move the imx6_pcie_ltssm_disable() earlier and place it just behind the > imx6_pcie_ltssm_enable(), since it might not be only used by suspend > callback directly. > To be symmetric with imx6_pcie_ltssm_enable(), add the IMX6Q switch > case in the imx6_pcie_ltssm_disable(). > > Signed-off-by: Richard Zhu > --- > drivers/pci/controller/dwc/pci-imx6.c | 39 ++++++++++++++------------- > 1 file changed, 20 insertions(+), 19 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 79a05e190016..1cf8bf9035f2 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -805,6 +805,26 @@ static void imx6_pcie_ltssm_enable(struct device *dev) > } > } > > +static void imx6_pcie_ltssm_disable(struct device *dev) > +{ > + struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); > + > + switch (imx6_pcie->drvdata->variant) { > + case IMX6Q: > + case IMX6SX: > + case IMX6QP: > + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, > + IMX6Q_GPR12_PCIE_CTL_2, 0); > + break; > + case IMX7D: > + case IMX8MM: > + reset_control_assert(imx6_pcie->apps_reset); > + break; This is missing the IMX8MQ case. > + default: > + dev_err(dev, "ltssm_disable not supported\n"); Drop the default, we want a compile time warning if a variant isn't covered by this switch statement. Regards, Lucas > + } > +} > + > static int imx6_pcie_start_link(struct dw_pcie *pci) > { > struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); > @@ -947,25 +967,6 @@ static const struct dw_pcie_ops dw_pcie_ops = { > }; > > #ifdef CONFIG_PM_SLEEP > -static void imx6_pcie_ltssm_disable(struct device *dev) > -{ > - struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); > - > - switch (imx6_pcie->drvdata->variant) { > - case IMX6SX: > - case IMX6QP: > - regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, > - IMX6Q_GPR12_PCIE_CTL_2, 0); > - break; > - case IMX7D: > - case IMX8MM: > - reset_control_assert(imx6_pcie->apps_reset); > - break; > - default: > - dev_err(dev, "ltssm_disable not supported\n"); > - } > -} > - > static void imx6_pcie_pm_turnoff(struct imx6_pcie *imx6_pcie) > { > struct device *dev = imx6_pcie->pci->dev;