diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/pci.c')
| -rw-r--r-- | drivers/net/wireless/ath/ath9k/pci.c | 74 | 
1 files changed, 16 insertions, 58 deletions
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index f088f4bf9a2..0e0d3958383 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c @@ -96,17 +96,6 @@ static bool ath_pci_eeprom_read(struct ath_common *common, u32 off, u16 *data)  	return true;  } -static void ath_pci_extn_synch_enable(struct ath_common *common) -{ -	struct ath_softc *sc = (struct ath_softc *) common->priv; -	struct pci_dev *pdev = to_pci_dev(sc->dev); -	u8 lnkctl; - -	pci_read_config_byte(pdev, sc->sc_ah->caps.pcie_lcr_offset, &lnkctl); -	lnkctl |= PCI_EXP_LNKCTL_ES; -	pci_write_config_byte(pdev, sc->sc_ah->caps.pcie_lcr_offset, lnkctl); -} -  /* Need to be called after we discover btcoex capabilities */  static void ath_pci_aspm_init(struct ath_common *common)  { @@ -125,23 +114,23 @@ static void ath_pci_aspm_init(struct ath_common *common)  	if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) &&  	    (AR_SREV_9285(ah))) { -		/* Bluetooth coexistance requires disabling ASPM. */ +		/* Bluetooth coexistence requires disabling ASPM. */  		pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, -			PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); +			PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1);  		/*  		 * Both upstream and downstream PCIe components should  		 * have the same ASPM settings.  		 */  		pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, -			PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); +			PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1);  		ath_info(common, "Disabling ASPM since BTCOEX is enabled\n");  		return;  	}  	pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm); -	if (aspm & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) { +	if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) {  		ah->aspm_enabled = true;  		/* Initialize PCIe PM and SERDES registers. */  		ath9k_hw_configpcipowersave(ah, false); @@ -153,13 +142,11 @@ static const struct ath_bus_ops ath_pci_bus_ops = {  	.ath_bus_type = ATH_PCI,  	.read_cachesize = ath_pci_read_cachesize,  	.eeprom_read = ath_pci_eeprom_read, -	.extn_synch_en = ath_pci_extn_synch_enable,  	.aspm_init = ath_pci_aspm_init,  };  static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)  { -	void __iomem *mem;  	struct ath_softc *sc;  	struct ieee80211_hw *hw;  	u8 csz; @@ -167,19 +154,19 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)  	int ret = 0;  	char hw_name[64]; -	if (pci_enable_device(pdev)) +	if (pcim_enable_device(pdev))  		return -EIO;  	ret =  pci_set_dma_mask(pdev, DMA_BIT_MASK(32));  	if (ret) {  		pr_err("32-bit DMA not available\n"); -		goto err_dma; +		return ret;  	}  	ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));  	if (ret) {  		pr_err("32-bit DMA consistent DMA enable failed\n"); -		goto err_dma; +		return ret;  	}  	/* @@ -215,25 +202,16 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)  	if ((val & 0x0000ff00) != 0)  		pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); -	ret = pci_request_region(pdev, 0, "ath9k"); +	ret = pcim_iomap_regions(pdev, BIT(0), "ath9k");  	if (ret) {  		dev_err(&pdev->dev, "PCI memory region reserve error\n"); -		ret = -ENODEV; -		goto err_region; -	} - -	mem = pci_iomap(pdev, 0, 0); -	if (!mem) { -		pr_err("PCI memory map error\n") ; -		ret = -EIO; -		goto err_iomap; +		return -ENODEV;  	}  	hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops);  	if (!hw) {  		dev_err(&pdev->dev, "No memory for ieee80211_hw\n"); -		ret = -ENOMEM; -		goto err_alloc_hw; +		return -ENOMEM;  	}  	SET_IEEE80211_DEV(hw, &pdev->dev); @@ -242,7 +220,7 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)  	sc = hw->priv;  	sc->hw = hw;  	sc->dev = &pdev->dev; -	sc->mem = mem; +	sc->mem = pcim_iomap_table(pdev)[0];  	/* Will be cleared in ath9k_start() */  	set_bit(SC_OP_INVALID, &sc->sc_flags); @@ -263,7 +241,7 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)  	ath9k_hw_name(sc->sc_ah, hw_name, sizeof(hw_name));  	wiphy_info(hw->wiphy, "%s mem=0x%lx, irq=%d\n", -		   hw_name, (unsigned long)mem, pdev->irq); +		   hw_name, (unsigned long)sc->mem, pdev->irq);  	return 0; @@ -271,14 +249,6 @@ err_init:  	free_irq(sc->irq, sc);  err_irq:  	ieee80211_free_hw(hw); -err_alloc_hw: -	pci_iounmap(pdev, mem); -err_iomap: -	pci_release_region(pdev, 0); -err_region: -	/* Nothing */ -err_dma: -	pci_disable_device(pdev);  	return ret;  } @@ -286,20 +256,15 @@ static void ath_pci_remove(struct pci_dev *pdev)  {  	struct ieee80211_hw *hw = pci_get_drvdata(pdev);  	struct ath_softc *sc = hw->priv; -	void __iomem *mem = sc->mem;  	if (!is_ath9k_unloaded)  		sc->sc_ah->ah_flags |= AH_UNPLUGGED;  	ath9k_deinit_device(sc);  	free_irq(sc->irq, sc);  	ieee80211_free_hw(sc->hw); - -	pci_iounmap(pdev, mem); -	pci_disable_device(pdev); -	pci_release_region(pdev, 0);  } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP  static int ath_pci_suspend(struct device *device)  { @@ -345,22 +310,15 @@ static int ath_pci_resume(struct device *device)  	return 0;  } -static const struct dev_pm_ops ath9k_pm_ops = { -	.suspend = ath_pci_suspend, -	.resume = ath_pci_resume, -	.freeze = ath_pci_suspend, -	.thaw = ath_pci_resume, -	.poweroff = ath_pci_suspend, -	.restore = ath_pci_resume, -}; +static SIMPLE_DEV_PM_OPS(ath9k_pm_ops, ath_pci_suspend, ath_pci_resume);  #define ATH9K_PM_OPS	(&ath9k_pm_ops) -#else /* !CONFIG_PM */ +#else /* !CONFIG_PM_SLEEP */  #define ATH9K_PM_OPS	NULL -#endif /* !CONFIG_PM */ +#endif /* !CONFIG_PM_SLEEP */  MODULE_DEVICE_TABLE(pci, ath_pci_id_table);  |