[PATCH] PCI: Add quirk to set class code for Qcom modems

Manivannan Sadhasivam posted 1 patch 1 month, 2 weeks ago
drivers/pci/quirks.c | 9 +++++++++
1 file changed, 9 insertions(+)
[PATCH] PCI: Add quirk to set class code for Qcom modems
Posted by Manivannan Sadhasivam 1 month, 2 weeks ago
Some Qcom PCIe modems do not set the class code. This leads to kernel
displaying the device class as 'Unassigned' as below:

01:00.0 Unassigned class [ff00]: Qualcomm Device 011a
            Subsystem: Qualcomm Device 011a

Hence, add a quirk to set the class code for some known broken devices.

Reported-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Closes: https://lore.kernel.org/mhi/4c552f50-a712-49e1-addf-7f0950495496@oss.qualcomm.com
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---

Note: I cannot confirm if prog-if is always 0x00. So to be on the safe side, I
just preserved it.

 drivers/pci/quirks.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 48946cca4be7..2e49d8a3ea52 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -6380,3 +6380,12 @@ static void pci_mask_replay_timer_timeout(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_GLI, 0x9750, pci_mask_replay_timer_timeout);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_GLI, 0x9755, pci_mask_replay_timer_timeout);
 #endif
+
+static void quirk_qcom_modem_class(struct pci_dev *pdev)
+{
+	pdev->class = (PCI_CLASS_COMMUNICATION_MODEM << 8) | pdev->class;
+}
+DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_QCOM, 0x011a, PCI_CLASS_NOT_DEFINED,
+			      8, quirk_qcom_modem_class);
+DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_QCOM, 0x0306, PCI_CLASS_NOT_DEFINED,
+			      8, quirk_qcom_modem_class);
-- 
2.51.0