wil6210: work around for platforms with broken INTx
There are platforms where INTx can't be routed by ACPI, this leads to pci_enable_device failure. Re-try pretending we have MSI already configured; in this case pci_enable_device do not try to configure INTx. However, MSI could still work. Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
95266dc07d
commit
2bdc070026
|
@ -35,6 +35,13 @@ static int wil_if_pcie_enable(struct wil6210_priv *wil)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = wil->pdev;
|
struct pci_dev *pdev = wil->pdev;
|
||||||
int rc;
|
int rc;
|
||||||
|
/* on platforms with buggy ACPI, pdev->msi_enabled may be set to
|
||||||
|
* allow pci_enable_device to work. This indicates INTx was not routed
|
||||||
|
* and only MSI should be used
|
||||||
|
*/
|
||||||
|
int msi_only = pdev->msi_enabled;
|
||||||
|
|
||||||
|
pdev->msi_enabled = 0;
|
||||||
|
|
||||||
pci_set_master(pdev);
|
pci_set_master(pdev);
|
||||||
|
|
||||||
|
@ -66,6 +73,12 @@ static int wil_if_pcie_enable(struct wil6210_priv *wil)
|
||||||
|
|
||||||
wil->n_msi = use_msi;
|
wil->n_msi = use_msi;
|
||||||
|
|
||||||
|
if ((wil->n_msi == 0) && msi_only) {
|
||||||
|
wil_err(wil, "Interrupt pin not routed, unable to use INTx\n");
|
||||||
|
rc = -ENODEV;
|
||||||
|
goto stop_master;
|
||||||
|
}
|
||||||
|
|
||||||
rc = wil6210_init_irq(wil, pdev->irq);
|
rc = wil6210_init_irq(wil, pdev->irq);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto stop_master;
|
goto stop_master;
|
||||||
|
@ -124,9 +137,16 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
|
|
||||||
rc = pci_enable_device(pdev);
|
rc = pci_enable_device(pdev);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
dev_err(&pdev->dev, "pci_enable_device failed\n");
|
dev_err(&pdev->dev,
|
||||||
return -ENODEV;
|
"pci_enable_device failed, retry with MSI only\n");
|
||||||
|
/* Work around for platforms that can't allocate IRQ:
|
||||||
|
* retry with MSI only
|
||||||
|
*/
|
||||||
|
pdev->msi_enabled = 1;
|
||||||
|
rc = pci_enable_device(pdev);
|
||||||
}
|
}
|
||||||
|
if (rc)
|
||||||
|
return -ENODEV;
|
||||||
/* rollback to err_disable_pdev */
|
/* rollback to err_disable_pdev */
|
||||||
|
|
||||||
rc = pci_request_region(pdev, 0, WIL_NAME);
|
rc = pci_request_region(pdev, 0, WIL_NAME);
|
||||||
|
|
Loading…
Reference in New Issue