diff options
author | Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> | 2014-12-23 02:47:17 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2015-01-15 07:31:34 -0500 |
commit | d8cfb80cb70711412a0b43d1a325fda8747d9b57 (patch) | |
tree | 93af2821659211ce15f6f21192174dd2d368061d | |
parent | 49cb5dfb5d358c9b5810c69197bdde1d3570d5cc (diff) |
wil6210: detect HW capabilities
Read relevant information (HW ID for now) once on init
and set capabilities accordingly.
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/ath/wil6210/pcie_bus.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wil6210.h | 20 |
2 files changed, 51 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index 66626a8ee728..371809dfca73 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c | |||
@@ -31,6 +31,36 @@ static bool debug_fw; /* = false; */ | |||
31 | module_param(debug_fw, bool, S_IRUGO); | 31 | module_param(debug_fw, bool, S_IRUGO); |
32 | MODULE_PARM_DESC(debug_fw, " load driver if FW not ready. For FW debug"); | 32 | MODULE_PARM_DESC(debug_fw, " load driver if FW not ready. For FW debug"); |
33 | 33 | ||
34 | static | ||
35 | void wil_set_capabilities(struct wil6210_priv *wil) | ||
36 | { | ||
37 | u32 rev_id = ioread32(wil->csr + HOSTADDR(RGF_USER_JTAG_DEV_ID)); | ||
38 | |||
39 | bitmap_zero(wil->hw_capabilities, hw_capability_last); | ||
40 | |||
41 | switch (rev_id) { | ||
42 | case JTAG_DEV_ID_MARLON_B0: | ||
43 | wil_info(wil, "Board hardware is Marlon B0\n"); | ||
44 | wil->hw_version = HW_VER_MARLON_B0; | ||
45 | break; | ||
46 | case JTAG_DEV_ID_SPARROW_A0: | ||
47 | wil_info(wil, "Board hardware is Sparrow A0\n"); | ||
48 | wil->hw_version = HW_VER_SPARROW_A0; | ||
49 | break; | ||
50 | case JTAG_DEV_ID_SPARROW_A1: | ||
51 | wil_info(wil, "Board hardware is Sparrow A1\n"); | ||
52 | wil->hw_version = HW_VER_SPARROW_A1; | ||
53 | break; | ||
54 | case JTAG_DEV_ID_SPARROW_B0: | ||
55 | wil_info(wil, "Board hardware is Sparrow B0\n"); | ||
56 | wil->hw_version = HW_VER_SPARROW_B0; | ||
57 | break; | ||
58 | default: | ||
59 | wil_err(wil, "Unknown board hardware 0x%08x\n", rev_id); | ||
60 | wil->hw_version = HW_VER_UNKNOWN; | ||
61 | } | ||
62 | } | ||
63 | |||
34 | void wil_disable_irq(struct wil6210_priv *wil) | 64 | void wil_disable_irq(struct wil6210_priv *wil) |
35 | { | 65 | { |
36 | int irq = wil->pdev->irq; | 66 | int irq = wil->pdev->irq; |
@@ -205,7 +235,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
205 | pci_set_drvdata(pdev, wil); | 235 | pci_set_drvdata(pdev, wil); |
206 | wil->pdev = pdev; | 236 | wil->pdev = pdev; |
207 | wil->board = board; | 237 | wil->board = board; |
208 | 238 | wil_set_capabilities(wil); | |
209 | wil6210_clear_irq(wil); | 239 | wil6210_clear_irq(wil); |
210 | 240 | ||
211 | wil->platform_handle = | 241 | wil->platform_handle = |
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 64a6d49a3001..d296f2e17e56 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h | |||
@@ -188,6 +188,20 @@ struct RGF_ICR { | |||
188 | #define RGF_CAF_PLL_LOCK_STATUS (0x88afec) | 188 | #define RGF_CAF_PLL_LOCK_STATUS (0x88afec) |
189 | #define BIT_CAF_OSC_DIG_XTAL_STABLE BIT(0) | 189 | #define BIT_CAF_OSC_DIG_XTAL_STABLE BIT(0) |
190 | 190 | ||
191 | #define RGF_USER_JTAG_DEV_ID (0x880b34) /* device ID */ | ||
192 | #define JTAG_DEV_ID_MARLON_B0 (0x0612072f) | ||
193 | #define JTAG_DEV_ID_SPARROW_A0 (0x0632072f) | ||
194 | #define JTAG_DEV_ID_SPARROW_A1 (0x1632072f) | ||
195 | #define JTAG_DEV_ID_SPARROW_B0 (0x2632072f) | ||
196 | |||
197 | enum { | ||
198 | HW_VER_UNKNOWN, | ||
199 | HW_VER_MARLON_B0, /* JTAG_DEV_ID_MARLON_B0 */ | ||
200 | HW_VER_SPARROW_A0, /* JTAG_DEV_ID_SPARROW_A0 */ | ||
201 | HW_VER_SPARROW_A1, /* JTAG_DEV_ID_SPARROW_A1 */ | ||
202 | HW_VER_SPARROW_B0, /* JTAG_DEV_ID_SPARROW_B0 */ | ||
203 | }; | ||
204 | |||
191 | /* popular locations */ | 205 | /* popular locations */ |
192 | #define HOST_MBOX HOSTADDR(RGF_USER_USER_SCRATCH_PAD) | 206 | #define HOST_MBOX HOSTADDR(RGF_USER_USER_SCRATCH_PAD) |
193 | #define HOST_SW_INT (HOSTADDR(RGF_USER_USER_ICR) + \ | 207 | #define HOST_SW_INT (HOSTADDR(RGF_USER_USER_ICR) + \ |
@@ -426,6 +440,11 @@ enum { | |||
426 | fw_recovery_running = 2, | 440 | fw_recovery_running = 2, |
427 | }; | 441 | }; |
428 | 442 | ||
443 | enum { | ||
444 | hw_capability_dummy, /* to avoid zero array */ | ||
445 | hw_capability_last | ||
446 | }; | ||
447 | |||
429 | struct wil_back_rx { | 448 | struct wil_back_rx { |
430 | struct list_head list; | 449 | struct list_head list; |
431 | /* request params, converted to CPU byte order - what we asked for */ | 450 | /* request params, converted to CPU byte order - what we asked for */ |
@@ -452,6 +471,7 @@ struct wil6210_priv { | |||
452 | DECLARE_BITMAP(status, wil_status_last); | 471 | DECLARE_BITMAP(status, wil_status_last); |
453 | u32 fw_version; | 472 | u32 fw_version; |
454 | u32 hw_version; | 473 | u32 hw_version; |
474 | DECLARE_BITMAP(hw_capabilities, hw_capability_last); | ||
455 | struct wil_board *board; | 475 | struct wil_board *board; |
456 | u8 n_mids; /* number of additional MIDs as reported by FW */ | 476 | u8 n_mids; /* number of additional MIDs as reported by FW */ |
457 | u32 recovery_count; /* num of FW recovery attempts in a short time */ | 477 | u32 recovery_count; /* num of FW recovery attempts in a short time */ |