Skip to contentSkip to conversation

PCI: imx6: Add CONFIG_PCIE_DW_HOST check for suspend/resume

PATCH In review Frank Li 2 participants 3 messages Jan 17, 2025

Subsystems (5)
lore
Share & tools
lore

Frank Li

author maintainer
#0 lore raw

PATCH 1/1 PCI: imx6: Add CONFIG_PCIE_DW_HOST check for suspend/resume

Add CONFIG_PCIE_DW_HOST check for suspend/resume to avoid build issue when CONFIG_PCIE_DW_HOST is not defined but CONFIG_PCIE_DW_EP defined.

Only host support suspend/resume at i.MX chips.

---
 drivers/pci/controller/dwc/pci-imx6.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +4 -2
index 129604025252d..e9fdf35d24821 100644
@@ -1390,7 +1390,8 @@ static int imx_pcie_suspend_noirq(struct device *dev)
 {
 	struct imx_pcie *imx_pcie = dev_get_drvdata(dev);
 
-	if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND))
+	if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND) ||
+	    !IS_ENABLED(CONFIG_PCIE_DW_HOST))
 		return 0;
 
 	imx_pcie_msi_save_restore(imx_pcie, true);
@@ -1414,7 +1415,8 @@ static int imx_pcie_resume_noirq(struct device *dev)
 	int ret;
 	struct imx_pcie *imx_pcie = dev_get_drvdata(dev);
 
-	if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND))
+	if (!(imx_pcie->drvdata->flags & IMX_PCIE_FLAG_SUPPORTS_SUSPEND) ||
+	    !IS_ENABLED(CONFIG_PCIE_DW_HOST))
 		return 0;
 
 	if (imx_check_flag(imx_pcie, IMX_PCIE_FLAG_BROKEN_SUSPEND)) {
Signature · 1 line
2.34.1
#1 lore raw
Quoted 4 lines · Frank Li

Add CONFIG_PCIE_DW_HOST check for suspend/resume to avoid build issue when CONFIG_PCIE_DW_HOST is not defined but CONFIG_PCIE_DW_EP defined.

Only host support suspend/resume at i.MX chips.

What would you think of inserting the following patch before "[PATCH v7 08/10] PCI: imx6: Use dwc common suspend resume method"?

Then we wouldn't need to add #ifdefs in every driver that supports both RC and EP mode and also supports power management for RC mode.

Bjorn

commit d3b04bf25988 ("PCI: dwc: Add dw_pcie_suspend_noirq(), dw_pcie_resume_noirq() stubs for !CONFIG_PCIE_DW_HOST")

Author: Bjorn Helgaas <[email protected]>
Date:   Fri Jan 17 15:03:04 2025 -0600

PCI: dwc: Add dw_pcie_suspend_noirq(), dw_pcie_resume_noirq() stubs for !CONFIG_PCIE_DW_HOST

Previously pcie-designware.h declared dw_pcie_suspend_noirq() and dw_pcie_resume_noirq() unconditionally, even though they were only implemented when CONFIG_PCIE_DW_HOST was defined.

Add no-op stubs for them when CONFIG_PCIE_DW_HOST is not defined so drivers that support both Root Complex and Endpoint modes don't need

drivers/pci/controller/dwc/pcie-designware.h +12 -3
index 8c0222f019d7..f400f562700e 100644
@@ -500,9 +500,6 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci);
 int dw_pcie_edma_detect(struct dw_pcie *pci);
 void dw_pcie_edma_remove(struct dw_pcie *pci);
 
-int dw_pcie_suspend_noirq(struct dw_pcie *pci);
-int dw_pcie_resume_noirq(struct dw_pcie *pci);
-
 static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val)
 {
 	dw_pcie_write_dbi(pci, reg, 0x4, val);
@@ -680,6 +677,8 @@ static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci)
 }
 
 #ifdef CONFIG_PCIE_DW_HOST
+int dw_pcie_suspend_noirq(struct dw_pcie *pci);
+int dw_pcie_resume_noirq(struct dw_pcie *pci);
 irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp);
 int dw_pcie_setup_rc(struct dw_pcie_rp *pp);
 int dw_pcie_host_init(struct dw_pcie_rp *pp);
@@ -688,6 +687,16 @@ int dw_pcie_allocate_domains(struct dw_pcie_rp *pp);
 void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn,
 				       int where);
 #else
+static inline int dw_pcie_suspend_noirq(struct dw_pcie *pci)
+{
+	return 0;
+}
+
+static inline int dw_pcie_resume_noirq(struct dw_pcie *pci)
+{
+	return 0;
+}
+
 static inline irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp)
 {
 	return IRQ_NONE;
author maintainer
#2 lore raw
Quoted 8 lines · Bjorn Helgaas
Quoted 4 lines · Frank Li

Add CONFIG_PCIE_DW_HOST check for suspend/resume to avoid build issue when CONFIG_PCIE_DW_HOST is not defined but CONFIG_PCIE_DW_EP defined.

Only host support suspend/resume at i.MX chips.

What would you think of inserting the following patch before "[PATCH v7 08/10] PCI: imx6: Use dwc common suspend resume method"?

Okay!

Quoted 63 lines

Then we wouldn't need to add #ifdefs in every driver that supports both RC and EP mode and also supports power management for RC mode.

Bjorn

commit d3b04bf25988 ("PCI: dwc: Add dw_pcie_suspend_noirq(), dw_pcie_resume_noirq() stubs for !CONFIG_PCIE_DW_HOST")

Author: Bjorn Helgaas <[email protected]>
Date:   Fri Jan 17 15:03:04 2025 -0600

PCI: dwc: Add dw_pcie_suspend_noirq(), dw_pcie_resume_noirq() stubs for !CONFIG_PCIE_DW_HOST

Previously pcie-designware.h declared dw_pcie_suspend_noirq() and dw_pcie_resume_noirq() unconditionally, even though they were only implemented when CONFIG_PCIE_DW_HOST was defined.

Add no-op stubs for them when CONFIG_PCIE_DW_HOST is not defined so drivers that support both Root Complex and Endpoint modes don't need

drivers/pci/controller/dwc/pcie-designware.h +12 -3
index 8c0222f019d7..f400f562700e 100644
@@ -500,9 +500,6 @@ void dw_pcie_iatu_detect(struct dw_pcie *pci);
 int dw_pcie_edma_detect(struct dw_pcie *pci);
 void dw_pcie_edma_remove(struct dw_pcie *pci);
 
-int dw_pcie_suspend_noirq(struct dw_pcie *pci);
-int dw_pcie_resume_noirq(struct dw_pcie *pci);
-
 static inline void dw_pcie_writel_dbi(struct dw_pcie *pci, u32 reg, u32 val)
 {
 	dw_pcie_write_dbi(pci, reg, 0x4, val);
@@ -680,6 +677,8 @@ static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci)
 }
 
 #ifdef CONFIG_PCIE_DW_HOST
+int dw_pcie_suspend_noirq(struct dw_pcie *pci);
+int dw_pcie_resume_noirq(struct dw_pcie *pci);
 irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp);
 int dw_pcie_setup_rc(struct dw_pcie_rp *pp);
 int dw_pcie_host_init(struct dw_pcie_rp *pp);
@@ -688,6 +687,16 @@ int dw_pcie_allocate_domains(struct dw_pcie_rp *pp);
 void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, unsigned int devfn,
 				       int where);
 #else
+static inline int dw_pcie_suspend_noirq(struct dw_pcie *pci)
+{
+	return 0;
+}
+
+static inline int dw_pcie_resume_noirq(struct dw_pcie *pci)
+{
+	return 0;
+}
+
 static inline irqreturn_t dw_handle_msi_irq(struct dw_pcie_rp *pp)
 {
 	return IRQ_NONE;