Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d09f5f4c authored by Sujith Manoharan's avatar Sujith Manoharan Committed by John W. Linville
Browse files

ath9k: Handle ASPM properly



ASPM has to be disabled when BTCOEX is in use, do this properly
by calling the bus-specific ASPM init routine after the
BTCOEX scheme has been determined.

Signed-off-by: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent aaa1ec46
Loading
Loading
Loading
Loading
+0 −11
Original line number Original line Diff line number Diff line
@@ -390,14 +390,6 @@ static void ath9k_hw_disablepcie(struct ath_hw *ah)
	REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
	REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
}
}


static void ath9k_hw_aspm_init(struct ath_hw *ah)
{
	struct ath_common *common = ath9k_hw_common(ah);

	if (common->bus_ops->aspm_init)
		common->bus_ops->aspm_init(common);
}

/* This should work for all families including legacy */
/* This should work for all families including legacy */
static bool ath9k_hw_chip_test(struct ath_hw *ah)
static bool ath9k_hw_chip_test(struct ath_hw *ah)
{
{
@@ -693,9 +685,6 @@ static int __ath9k_hw_init(struct ath_hw *ah)
	if (r)
	if (r)
		return r;
		return r;


	if (ah->is_pciexpress)
		ath9k_hw_aspm_init(ah);

	r = ath9k_hw_init_macaddr(ah);
	r = ath9k_hw_init_macaddr(ah);
	if (r) {
	if (r) {
		ath_err(common, "Failed to initialize MAC address\n");
		ath_err(common, "Failed to initialize MAC address\n");
+3 −0
Original line number Original line Diff line number Diff line
@@ -597,6 +597,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
	ath9k_cmn_init_crypto(sc->sc_ah);
	ath9k_cmn_init_crypto(sc->sc_ah);
	ath9k_init_misc(sc);
	ath9k_init_misc(sc);


	if (common->bus_ops->aspm_init)
		common->bus_ops->aspm_init(common);

	return 0;
	return 0;


err_btcoex:
err_btcoex:
+5 −0
Original line number Original line Diff line number Diff line
@@ -115,6 +115,9 @@ static void ath_pci_aspm_init(struct ath_common *common)
	int pos;
	int pos;
	u8 aspm;
	u8 aspm;


	if (!ah->is_pciexpress)
		return;

	pos = pci_pcie_cap(pdev);
	pos = pci_pcie_cap(pdev);
	if (!pos)
	if (!pos)
		return;
		return;
@@ -138,6 +141,7 @@ static void ath_pci_aspm_init(struct ath_common *common)
		aspm &= ~(PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
		aspm &= ~(PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
		pci_write_config_byte(parent, pos + PCI_EXP_LNKCTL, aspm);
		pci_write_config_byte(parent, pos + PCI_EXP_LNKCTL, aspm);


		ath_info(common, "Disabling ASPM since BTCOEX is enabled\n");
		return;
		return;
	}
	}


@@ -147,6 +151,7 @@ static void ath_pci_aspm_init(struct ath_common *common)
		ah->aspm_enabled = true;
		ah->aspm_enabled = true;
		/* Initialize PCIe PM and SERDES registers. */
		/* Initialize PCIe PM and SERDES registers. */
		ath9k_hw_configpcipowersave(ah, false);
		ath9k_hw_configpcipowersave(ah, false);
		ath_info(common, "ASPM enabled: 0x%x\n", aspm);
	}
	}
}
}