All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] PCI: dwc: Perform host_init() before registering msi
@ 2021-08-23 15:49 Bjorn Andersson
  2021-08-23 15:49 ` [PATCH v2 2/2] PCI: qcom: Add sc8180x compatible Bjorn Andersson
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Bjorn Andersson @ 2021-08-23 15:49 UTC (permalink / raw)
  To: Bjorn Helgaas, Rob Herring, Jingoo Han, Gustavo Pimentel,
	Lorenzo Pieralisi, Krzysztof Wilczyński, Stanimir Varbanov
  Cc: linux-arm-msm, linux-pci, devicetree, linux-kernel

On the Qualcomm sc8180x platform the bootloader does something related
to PCI that leaves a pending "msi" interrupt, which with the current
ordering often fires before init has a chance to enable the clocks that
are necessary for the interrupt handler to access the hardware.

Move the host_init() call before the registration of the "msi" interrupt
handler to ensure the host driver has a chance to enable the clocks.

The assignment of the bridge's ops and child_ops is moved along, because
at least the TI Keystone driver overwrites these in its host_init
callback.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Changes since v1:
- New patch, instead of enabling resources in the qcom driver before jumping to
  dw_pcie_host_init(), per Rob Herring's suggestion.

 .../pci/controller/dwc/pcie-designware-host.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index d1d9b8344ec9..f4755f3a03be 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -335,6 +335,16 @@ int dw_pcie_host_init(struct pcie_port *pp)
 	if (pci->link_gen < 1)
 		pci->link_gen = of_pci_get_max_link_speed(np);
 
+	/* Set default bus ops */
+	bridge->ops = &dw_pcie_ops;
+	bridge->child_ops = &dw_child_pcie_ops;
+
+	if (pp->ops->host_init) {
+		ret = pp->ops->host_init(pp);
+		if (ret)
+			return ret;
+	}
+
 	if (pci_msi_enabled()) {
 		pp->has_msi_ctrl = !(pp->ops->msi_host_init ||
 				     of_property_read_bool(np, "msi-parent") ||
@@ -388,15 +398,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
 		}
 	}
 
-	/* Set default bus ops */
-	bridge->ops = &dw_pcie_ops;
-	bridge->child_ops = &dw_child_pcie_ops;
-
-	if (pp->ops->host_init) {
-		ret = pp->ops->host_init(pp);
-		if (ret)
-			goto err_free_msi;
-	}
 	dw_pcie_iatu_detect(pci);
 
 	dw_pcie_setup_rc(pp);
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-10-12 12:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 15:49 [PATCH v2 1/2] PCI: dwc: Perform host_init() before registering msi Bjorn Andersson
2021-08-23 15:49 ` [PATCH v2 2/2] PCI: qcom: Add sc8180x compatible Bjorn Andersson
2021-08-23 17:47   ` Rob Herring
2021-08-23 17:46 ` [PATCH v2 1/2] PCI: dwc: Perform host_init() before registering msi Rob Herring
2021-08-24 19:05 ` Bjorn Helgaas
2021-08-24 20:15   ` Bjorn Andersson
2021-08-24 20:29     ` Bjorn Helgaas
2021-08-24 21:23       ` Bjorn Andersson
2021-10-08 17:48         ` Lorenzo Pieralisi
2021-10-08 19:08           ` Bjorn Andersson
2021-10-12 12:47 ` Lorenzo Pieralisi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.