All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v1] PCI: qcom: Use quirk to override incorrect device class
@ 2019-03-11 14:56 Marc Gonzalez
  2019-03-12 12:42 ` Stanimir Varbanov
  0 siblings, 1 reply; 26+ messages in thread
From: Marc Gonzalez @ 2019-03-11 14:56 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Andy Gross, David Brown, Bjorn Andersson, Stanimir Varbanov, PCI,
	MSM, LKML, Jeffrey Hugo

Some chips report an incorrect device class. Override the incorrect
value using a quirk, instead of code in the read function.

Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
---
FWIW, this quirk is no longer required on recent chips:
msm8996 (tested by Stanimir), msm8998 (tested by me), sdm845 (untested) are unaffected
apq/ipq8064 is affected => what is the device ID for these chips?
others?

Stanimir added: "this will become a real problem (now we use the driver as RC)
when someone decide to use it as an endpoint"
---
 drivers/pci/controller/dwc/pcie-qcom.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 3de5510fd3d5..94da2c9c2ad5 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1136,17 +1136,15 @@ static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,
 {
 	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
 
-	/* the device class is not reported correctly from the register */
-	if (where == PCI_CLASS_REVISION && size == 4) {
-		*val = readl(pci->dbi_base + PCI_CLASS_REVISION);
-		*val &= 0xff;	/* keep revision id */
-		*val |= PCI_CLASS_BRIDGE_PCI << 16;
-		return PCIBIOS_SUCCESSFUL;
-	}
-
 	return dw_pcie_read(pci->dbi_base + where, size, val);
 }
 
+static void qcom_fixup_class(struct pci_dev *dev)
+{
+	dev->class = PCI_CLASS_BRIDGE_PCI << 8;
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, PCI_ANY_ID, qcom_fixup_class);
+
 static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
 	.host_init = qcom_pcie_host_init,
 	.rd_own_conf = qcom_pcie_rd_own_conf,
-- 
2.17.1

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

end of thread, other threads:[~2019-05-02  9:42 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11 14:56 [RFC PATCH v1] PCI: qcom: Use quirk to override incorrect device class Marc Gonzalez
2019-03-12 12:42 ` Stanimir Varbanov
2019-03-12 17:18   ` Marc Gonzalez
2019-03-12 17:34     ` Marc Gonzalez
2019-03-13 11:45       ` [PATCH v2] PCI: qcom: Use default config space read function Marc Gonzalez
2019-03-13 13:13         ` Marc Gonzalez
2019-03-13 18:29         ` Srinivas Kandagatla
2019-03-13 20:39           ` Marc Gonzalez
2019-03-13 21:52             ` Srinivas Kandagatla
2019-03-13 22:26               ` Marc Gonzalez
2019-03-14 11:10                 ` Srinivas Kandagatla
2019-03-14 13:18                   ` Marc Gonzalez
2019-03-18 14:28                     ` [PATCH v3] " Marc Gonzalez
2019-03-18 14:39                       ` Srinivas Kandagatla
2019-03-18 16:35                       ` Stanimir Varbanov
2019-03-18 17:14                         ` [PATCH v4] " Marc Gonzalez
2019-03-25 12:11                           ` Marc Gonzalez
2019-03-25 13:32                             ` Stanimir Varbanov
2019-03-25 15:42                               ` [PATCH v5] " Marc Gonzalez
2019-03-29 13:48                                 ` Marc Gonzalez
2019-03-29 15:55                                 ` Stanimir Varbanov
2019-03-29 16:38                                 ` Lorenzo Pieralisi
2019-04-01 10:39                                   ` Marc Gonzalez
2019-04-01 11:12                                     ` Lorenzo Pieralisi
2019-04-30 14:06       ` [RFC PATCH v1] PCI: qcom: Use quirk to override incorrect device class Lorenzo Pieralisi
2019-05-02  9:42         ` Marc Gonzalez

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.