Upgrade to 4.4.50-rt62
[kvmfornfv.git] / kernel / arch / x86 / pci / intel_mid_pci.c
index 0d24e7c..ae97f24 100644 (file)
@@ -37,6 +37,7 @@
 
 /* Quirks for the listed devices */
 #define PCI_DEVICE_ID_INTEL_MRFL_MMC   0x1190
+#define PCI_DEVICE_ID_INTEL_MRFL_HSU   0x1191
 
 /* Fixed BAR fields */
 #define PCIE_VNDR_CAP_ID_FIXED_BAR 0x00        /* Fixed BAR (TBD) */
@@ -215,7 +216,7 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
        int polarity;
        int ret;
 
-       if (pci_has_managed_irq(dev))
+       if (dev->irq_managed && dev->irq > 0)
                return 0;
 
        switch (intel_mid_identify_cpu()) {
@@ -224,14 +225,21 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
 
                /* Special treatment for IRQ0 */
                if (dev->irq == 0) {
+                       /*
+                        * Skip HS UART common registers device since it has
+                        * IRQ0 assigned and not used by the kernel.
+                        */
+                       if (dev->device == PCI_DEVICE_ID_INTEL_MRFL_HSU)
+                               return -EBUSY;
                        /*
                         * TNG has IRQ0 assigned to eMMC controller. But there
                         * are also other devices with bogus PCI configuration
                         * that have IRQ0 assigned. This check ensures that
-                        * eMMC gets it.
+                        * eMMC gets it. The rest of devices still could be
+                        * enabled without interrupt line being allocated.
                         */
                        if (dev->device != PCI_DEVICE_ID_INTEL_MRFL_MMC)
-                               return -EBUSY;
+                               return 0;
                }
                break;
        default:
@@ -256,13 +264,10 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
 
 static void intel_mid_pci_irq_disable(struct pci_dev *dev)
 {
-       if (pci_has_managed_irq(dev)) {
+       if (!mp_should_keep_irq(&dev->dev) && dev->irq_managed &&
+           dev->irq > 0) {
                mp_unmap_irq(dev->irq);
                dev->irq_managed = 0;
-               /*
-                * Don't reset dev->irq here, otherwise
-                * intel_mid_pci_irq_enable() will fail on next call.
-                */
        }
 }