wil6210: support devices with different PCIe bar size
wil6210 devices can have different PCIe bar size, hence get the bar size from PCIe device instead of using a constant bar size. Change-Id: I02fe3f05e184b141c9a5519dd97c3f2d2eb99baf Signed-off-by: Maya Erez <qca_merez@qca.qualcomm.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> Git-commit: d86d47164b227f01c3ec34c3f5a1613977d563eb Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git Signed-off-by: Maya Erez <merez@codeaurora.org>
This commit is contained in:
parent
3f08f268ce
commit
02e1658224
4 changed files with 16 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 Qualcomm Atheros, Inc.
|
* Copyright (c) 2014,2017 Qualcomm Atheros, Inc.
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -54,7 +54,7 @@ static void __iomem *wil_ioc_addr(struct wil6210_priv *wil, uint32_t addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
off = a - wil->csr;
|
off = a - wil->csr;
|
||||||
if (size >= WIL6210_MEM_SIZE - off) {
|
if (size >= wil->bar_size - off) {
|
||||||
wil_err(wil, "Requested block does not fit into memory: "
|
wil_err(wil, "Requested block does not fit into memory: "
|
||||||
"off = 0x%08x size = 0x%08x\n", off, size);
|
"off = 0x%08x size = 0x%08x\n", off, size);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -198,16 +198,18 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
.ramdump = wil_platform_rop_ramdump,
|
.ramdump = wil_platform_rop_ramdump,
|
||||||
.fw_recovery = wil_platform_rop_fw_recovery,
|
.fw_recovery = wil_platform_rop_fw_recovery,
|
||||||
};
|
};
|
||||||
|
u32 bar_size = pci_resource_len(pdev, 0);
|
||||||
|
|
||||||
/* check HW */
|
/* check HW */
|
||||||
dev_info(&pdev->dev, WIL_NAME
|
dev_info(&pdev->dev, WIL_NAME
|
||||||
" device found [%04x:%04x] (rev %x)\n",
|
" device found [%04x:%04x] (rev %x) bar size 0x%x\n",
|
||||||
(int)pdev->vendor, (int)pdev->device, (int)pdev->revision);
|
(int)pdev->vendor, (int)pdev->device, (int)pdev->revision,
|
||||||
|
bar_size);
|
||||||
|
|
||||||
if (pci_resource_len(pdev, 0) != WIL6210_MEM_SIZE) {
|
if ((bar_size < WIL6210_MIN_MEM_SIZE) ||
|
||||||
dev_err(&pdev->dev, "Not " WIL_NAME "? "
|
(bar_size > WIL6210_MAX_MEM_SIZE)) {
|
||||||
"BAR0 size is %lu while expecting %lu\n",
|
dev_err(&pdev->dev, "Unexpected BAR0 size 0x%x\n",
|
||||||
(ulong)pci_resource_len(pdev, 0), WIL6210_MEM_SIZE);
|
bar_size);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,6 +222,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||||
|
|
||||||
wil->pdev = pdev;
|
wil->pdev = pdev;
|
||||||
pci_set_drvdata(pdev, wil);
|
pci_set_drvdata(pdev, wil);
|
||||||
|
wil->bar_size = bar_size;
|
||||||
/* rollback to if_free */
|
/* rollback to if_free */
|
||||||
|
|
||||||
wil->platform_handle =
|
wil->platform_handle =
|
||||||
|
|
|
@ -59,7 +59,8 @@ static inline u32 WIL_GET_BITS(u32 x, int b0, int b1)
|
||||||
return (x >> b0) & ((1 << (b1 - b0 + 1)) - 1);
|
return (x >> b0) & ((1 << (b1 - b0 + 1)) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define WIL6210_MEM_SIZE (2*1024*1024UL)
|
#define WIL6210_MIN_MEM_SIZE (2 * 1024 * 1024UL)
|
||||||
|
#define WIL6210_MAX_MEM_SIZE (4 * 1024 * 1024UL)
|
||||||
|
|
||||||
#define WIL_TX_Q_LEN_DEFAULT (4000)
|
#define WIL_TX_Q_LEN_DEFAULT (4000)
|
||||||
#define WIL_RX_RING_SIZE_ORDER_DEFAULT (10)
|
#define WIL_RX_RING_SIZE_ORDER_DEFAULT (10)
|
||||||
|
@ -620,6 +621,7 @@ extern u8 led_polarity;
|
||||||
|
|
||||||
struct wil6210_priv {
|
struct wil6210_priv {
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
|
u32 bar_size;
|
||||||
struct wireless_dev *wdev;
|
struct wireless_dev *wdev;
|
||||||
void __iomem *csr;
|
void __iomem *csr;
|
||||||
DECLARE_BITMAP(status, wil_status_last);
|
DECLARE_BITMAP(status, wil_status_last);
|
||||||
|
|
|
@ -160,7 +160,7 @@ void __iomem *wmi_buffer(struct wil6210_priv *wil, __le32 ptr_)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
off = HOSTADDR(ptr);
|
off = HOSTADDR(ptr);
|
||||||
if (off > WIL6210_MEM_SIZE - 4)
|
if (off > wil->bar_size - 4)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return wil->csr + off;
|
return wil->csr + off;
|
||||||
|
@ -180,7 +180,7 @@ void __iomem *wmi_addr(struct wil6210_priv *wil, u32 ptr)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
off = HOSTADDR(ptr);
|
off = HOSTADDR(ptr);
|
||||||
if (off > WIL6210_MEM_SIZE - 4)
|
if (off > wil->bar_size - 4)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return wil->csr + off;
|
return wil->csr + off;
|
||||||
|
|
Loading…
Add table
Reference in a new issue