aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2019-04-14 20:46:31 -0400
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2019-05-01 06:35:47 -0400
commit76d6dc26331dfe3c275b16ac28f8b92f9614cd7e (patch)
tree7d7730e09c83d7d844e6773a81fe13df411cf547
parent37d5d32ae091c7acff23a080e3c179977fb943cd (diff)
PCI: imx6: Use flags to indicate support for suspend
Now that driver data has flags variable that can be used to indicate quirks/features supported we can switch the code to use it instead of having a special function that does so based on variant alone. No functional change intended. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Reviewed-by: Lucas Stach <l.stach@pengutronix.de> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Chris Healy <cphealy@gmail.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org
-rw-r--r--drivers/pci/controller/dwc/pci-imx6.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 30e764b6cbcc..3e45f49b8a4f 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -52,6 +52,7 @@ enum imx6_pcie_variants {
52 52
53#define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) 53#define IMX6_PCIE_FLAG_IMX6_PHY BIT(0)
54#define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) 54#define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1)
55#define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2)
55 56
56struct imx6_pcie_drvdata { 57struct imx6_pcie_drvdata {
57 enum imx6_pcie_variants variant; 58 enum imx6_pcie_variants variant;
@@ -965,17 +966,11 @@ static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie)
965 } 966 }
966} 967}
967 968
968static inline bool imx6_pcie_supports_suspend(struct imx6_pcie *imx6_pcie)
969{
970 return (imx6_pcie->drvdata->variant == IMX7D ||
971 imx6_pcie->drvdata->variant == IMX6SX);
972}
973
974static int imx6_pcie_suspend_noirq(struct device *dev) 969static int imx6_pcie_suspend_noirq(struct device *dev)
975{ 970{
976 struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); 971 struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev);
977 972
978 if (!imx6_pcie_supports_suspend(imx6_pcie)) 973 if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND))
979 return 0; 974 return 0;
980 975
981 imx6_pcie_pm_turnoff(imx6_pcie); 976 imx6_pcie_pm_turnoff(imx6_pcie);
@@ -991,7 +986,7 @@ static int imx6_pcie_resume_noirq(struct device *dev)
991 struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); 986 struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev);
992 struct pcie_port *pp = &imx6_pcie->pci->pp; 987 struct pcie_port *pp = &imx6_pcie->pci->pp;
993 988
994 if (!imx6_pcie_supports_suspend(imx6_pcie)) 989 if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND))
995 return 0; 990 return 0;
996 991
997 imx6_pcie_assert_core_reset(imx6_pcie); 992 imx6_pcie_assert_core_reset(imx6_pcie);
@@ -1221,7 +1216,8 @@ static const struct imx6_pcie_drvdata drvdata[] = {
1221 [IMX6SX] = { 1216 [IMX6SX] = {
1222 .variant = IMX6SX, 1217 .variant = IMX6SX,
1223 .flags = IMX6_PCIE_FLAG_IMX6_PHY | 1218 .flags = IMX6_PCIE_FLAG_IMX6_PHY |
1224 IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, 1219 IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE |
1220 IMX6_PCIE_FLAG_SUPPORTS_SUSPEND,
1225 }, 1221 },
1226 [IMX6QP] = { 1222 [IMX6QP] = {
1227 .variant = IMX6QP, 1223 .variant = IMX6QP,
@@ -1230,6 +1226,7 @@ static const struct imx6_pcie_drvdata drvdata[] = {
1230 }, 1226 },
1231 [IMX7D] = { 1227 [IMX7D] = {
1232 .variant = IMX7D, 1228 .variant = IMX7D,
1229 .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND,
1233 }, 1230 },
1234 [IMX8MQ] = { 1231 [IMX8MQ] = {
1235 .variant = IMX8MQ, 1232 .variant = IMX8MQ,