diff options
| author | Miri Korenblit <[email protected]> | 2025-07-09 05:16:25 +0000 |
|---|---|---|
| committer | Miri Korenblit <[email protected]> | 2025-07-09 08:39:28 +0000 |
| commit | e1dbd37f145af4e3ed39c0f2fea879f68c94e721 (patch) | |
| tree | f7df16e4a7ed93add0e7b3ed3bca484b134028f1 /drivers/net/wireless/intel/iwlwifi/pcie/drv.c | |
| parent | wifi: iwlwifi: bump FW API to 102 for BZ/SC/DR (diff) | |
| download | kernel-e1dbd37f145af4e3ed39c0f2fea879f68c94e721.tar.gz kernel-e1dbd37f145af4e3ed39c0f2fea879f68c94e721.zip | |
wifi: iwlwifi: pcie move common probe logic
Move the parts of the probe that are not gen specific to the common
probe function.
Signed-off-by: Miri Korenblit <[email protected]>
Link: https://patch.msgid.link/20250709081300.91aee0874e79.Ib762365933d4dd4fc0bf07833226cd7118dee0a1@changeid
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/pcie/drv.c')
| -rw-r--r-- | drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c index 2729e0890fc6..02a031433b23 100644 --- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c @@ -1127,8 +1127,44 @@ EXPORT_SYMBOL_IF_IWLWIFI_KUNIT(iwl_pci_find_dev_info); static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { const struct iwl_mac_cfg *mac_cfg = (void *)ent->driver_data; + u8 __iomem *hw_base; + u32 bar0, hw_rev; + int ret; + + /* reassign our BAR 0 if invalid due to possible runtime PM races */ + pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &bar0); + if (bar0 == PCI_BASE_ADDRESS_MEM_TYPE_64) { + ret = pci_assign_resource(pdev, 0); + if (ret) + return ret; + } + + ret = pcim_enable_device(pdev); + if (ret) + return ret; + + pci_set_master(pdev); + + ret = pcim_request_all_regions(pdev, DRV_NAME); + if (ret) { + dev_err(&pdev->dev, "Requesting all PCI BARs failed.\n"); + return ret; + } + + hw_base = pcim_iomap(pdev, 0, 0); + if (!hw_base) { + dev_err(&pdev->dev, "Failed to map BAR 0.\n"); + return -ENOMEM; + } + + /* We can't use iwl_read32 because trans wasn't allocated */ + hw_rev = readl(hw_base + CSR_HW_REV); + if (hw_rev == 0xffffffff) { + dev_err(&pdev->dev, "HW_REV=0xFFFFFFFF, PCI issues?\n"); + return -EIO; + } - return iwl_pci_gen1_2_probe(pdev, ent, mac_cfg); + return iwl_pci_gen1_2_probe(pdev, ent, mac_cfg, hw_base, hw_rev); } static void iwl_pci_remove(struct pci_dev *pdev) |
