diff options
author | Shengzhen Li <szli@marvell.com> | 2016-04-05 04:04:36 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2016-04-07 12:42:19 -0400 |
commit | a362e16b83e1823746874485710c7515eb5ee369 (patch) | |
tree | ca7052cb8b7fa1c422c4d04d3017d0f41ec359a4 | |
parent | 8fa0a0dc634ba1bcf7678db296902d9c4e5025e0 (diff) |
mwifiex: check revision id while choosing PCIe firmware
Some of the chipsets have two revisions. This patch
selects appropriate firmware by checking revision id.
Signed-off-by: Shengzhen Li <szli@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/pcie.c | 56 | ||||
-rw-r--r-- | drivers/net/wireless/marvell/mwifiex/pcie.h | 16 |
2 files changed, 61 insertions, 11 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index de364381fe7b..6a06ca5c3eb1 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c | |||
@@ -190,7 +190,6 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev, | |||
190 | 190 | ||
191 | if (ent->driver_data) { | 191 | if (ent->driver_data) { |
192 | struct mwifiex_pcie_device *data = (void *)ent->driver_data; | 192 | struct mwifiex_pcie_device *data = (void *)ent->driver_data; |
193 | card->pcie.firmware = data->firmware; | ||
194 | card->pcie.reg = data->reg; | 193 | card->pcie.reg = data->reg; |
195 | card->pcie.blksz_fw_dl = data->blksz_fw_dl; | 194 | card->pcie.blksz_fw_dl = data->blksz_fw_dl; |
196 | card->pcie.tx_buf_size = data->tx_buf_size; | 195 | card->pcie.tx_buf_size = data->tx_buf_size; |
@@ -269,6 +268,11 @@ static const struct pci_device_id mwifiex_ids[] = { | |||
269 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 268 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, |
270 | .driver_data = (unsigned long)&mwifiex_pcie8997, | 269 | .driver_data = (unsigned long)&mwifiex_pcie8997, |
271 | }, | 270 | }, |
271 | { | ||
272 | PCIE_VENDOR_ID_V2_MARVELL, PCIE_DEVICE_ID_MARVELL_88W8997, | ||
273 | PCI_ANY_ID, PCI_ANY_ID, 0, 0, | ||
274 | .driver_data = (unsigned long)&mwifiex_pcie8997, | ||
275 | }, | ||
272 | {}, | 276 | {}, |
273 | }; | 277 | }; |
274 | 278 | ||
@@ -2759,6 +2763,51 @@ static int mwifiex_pcie_request_irq(struct mwifiex_adapter *adapter) | |||
2759 | } | 2763 | } |
2760 | 2764 | ||
2761 | /* | 2765 | /* |
2766 | * This function get firmare name for downloading by revision id | ||
2767 | * | ||
2768 | * Read revision id register to get revision id | ||
2769 | */ | ||
2770 | static void mwifiex_pcie_get_fw_name(struct mwifiex_adapter *adapter) | ||
2771 | { | ||
2772 | int revision_id = 0; | ||
2773 | struct pcie_service_card *card = adapter->card; | ||
2774 | |||
2775 | switch (card->dev->device) { | ||
2776 | case PCIE_DEVICE_ID_MARVELL_88W8766P: | ||
2777 | strcpy(adapter->fw_name, PCIE8766_DEFAULT_FW_NAME); | ||
2778 | break; | ||
2779 | case PCIE_DEVICE_ID_MARVELL_88W8897: | ||
2780 | mwifiex_write_reg(adapter, 0x0c58, 0x80c00000); | ||
2781 | mwifiex_read_reg(adapter, 0x0c58, &revision_id); | ||
2782 | revision_id &= 0xff00; | ||
2783 | switch (revision_id) { | ||
2784 | case PCIE8897_A0: | ||
2785 | strcpy(adapter->fw_name, PCIE8897_A0_FW_NAME); | ||
2786 | break; | ||
2787 | case PCIE8897_B0: | ||
2788 | strcpy(adapter->fw_name, PCIE8897_B0_FW_NAME); | ||
2789 | break; | ||
2790 | default: | ||
2791 | break; | ||
2792 | } | ||
2793 | case PCIE_DEVICE_ID_MARVELL_88W8997: | ||
2794 | mwifiex_read_reg(adapter, 0x0c48, &revision_id); | ||
2795 | switch (revision_id) { | ||
2796 | case PCIE8997_V2: | ||
2797 | strcpy(adapter->fw_name, PCIE8997_FW_NAME_V2); | ||
2798 | break; | ||
2799 | case PCIE8997_Z: | ||
2800 | strcpy(adapter->fw_name, PCIE8997_FW_NAME_Z); | ||
2801 | break; | ||
2802 | default: | ||
2803 | break; | ||
2804 | } | ||
2805 | default: | ||
2806 | break; | ||
2807 | } | ||
2808 | } | ||
2809 | |||
2810 | /* | ||
2762 | * This function registers the PCIE device. | 2811 | * This function registers the PCIE device. |
2763 | * | 2812 | * |
2764 | * PCIE IRQ is claimed, block size is set and driver data is initialized. | 2813 | * PCIE IRQ is claimed, block size is set and driver data is initialized. |
@@ -2778,8 +2827,8 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | |||
2778 | adapter->tx_buf_size = card->pcie.tx_buf_size; | 2827 | adapter->tx_buf_size = card->pcie.tx_buf_size; |
2779 | adapter->mem_type_mapping_tbl = card->pcie.mem_type_mapping_tbl; | 2828 | adapter->mem_type_mapping_tbl = card->pcie.mem_type_mapping_tbl; |
2780 | adapter->num_mem_types = card->pcie.num_mem_types; | 2829 | adapter->num_mem_types = card->pcie.num_mem_types; |
2781 | strcpy(adapter->fw_name, card->pcie.firmware); | ||
2782 | adapter->ext_scan = card->pcie.can_ext_scan; | 2830 | adapter->ext_scan = card->pcie.can_ext_scan; |
2831 | mwifiex_pcie_get_fw_name(adapter); | ||
2783 | 2832 | ||
2784 | return 0; | 2833 | return 0; |
2785 | } | 2834 | } |
@@ -2907,6 +2956,3 @@ MODULE_AUTHOR("Marvell International Ltd."); | |||
2907 | MODULE_DESCRIPTION("Marvell WiFi-Ex PCI-Express Driver version " PCIE_VERSION); | 2956 | MODULE_DESCRIPTION("Marvell WiFi-Ex PCI-Express Driver version " PCIE_VERSION); |
2908 | MODULE_VERSION(PCIE_VERSION); | 2957 | MODULE_VERSION(PCIE_VERSION); |
2909 | MODULE_LICENSE("GPL v2"); | 2958 | MODULE_LICENSE("GPL v2"); |
2910 | MODULE_FIRMWARE(PCIE8766_DEFAULT_FW_NAME); | ||
2911 | MODULE_FIRMWARE(PCIE8897_DEFAULT_FW_NAME); | ||
2912 | MODULE_FIRMWARE(PCIE8997_DEFAULT_FW_NAME); | ||
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.h b/drivers/net/wireless/marvell/mwifiex/pcie.h index 29e58ce877e3..4455d1905d94 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.h +++ b/drivers/net/wireless/marvell/mwifiex/pcie.h | |||
@@ -30,14 +30,22 @@ | |||
30 | #include "main.h" | 30 | #include "main.h" |
31 | 31 | ||
32 | #define PCIE8766_DEFAULT_FW_NAME "mrvl/pcie8766_uapsta.bin" | 32 | #define PCIE8766_DEFAULT_FW_NAME "mrvl/pcie8766_uapsta.bin" |
33 | #define PCIE8897_DEFAULT_FW_NAME "mrvl/pcie8897_uapsta.bin" | 33 | #define PCIE8897_A0_FW_NAME "mrvl/pcie8897_uapsta_a0.bin" |
34 | #define PCIE8997_DEFAULT_FW_NAME "mrvl/pcie8997_uapsta.bin" | 34 | #define PCIE8897_B0_FW_NAME "mrvl/pcie8897_uapsta.bin" |
35 | #define PCIE8997_FW_NAME_Z "mrvl/pcieusb8997_combo.bin" | ||
36 | #define PCIE8997_FW_NAME_V2 "mrvl/pcieusb8997_combo_v2.bin" | ||
35 | 37 | ||
36 | #define PCIE_VENDOR_ID_MARVELL (0x11ab) | 38 | #define PCIE_VENDOR_ID_MARVELL (0x11ab) |
39 | #define PCIE_VENDOR_ID_V2_MARVELL (0x1b4b) | ||
37 | #define PCIE_DEVICE_ID_MARVELL_88W8766P (0x2b30) | 40 | #define PCIE_DEVICE_ID_MARVELL_88W8766P (0x2b30) |
38 | #define PCIE_DEVICE_ID_MARVELL_88W8897 (0x2b38) | 41 | #define PCIE_DEVICE_ID_MARVELL_88W8897 (0x2b38) |
39 | #define PCIE_DEVICE_ID_MARVELL_88W8997 (0x2b42) | 42 | #define PCIE_DEVICE_ID_MARVELL_88W8997 (0x2b42) |
40 | 43 | ||
44 | #define PCIE8897_A0 0x1100 | ||
45 | #define PCIE8897_B0 0x1200 | ||
46 | #define PCIE8997_Z 0x0 | ||
47 | #define PCIE8997_V2 0x471 | ||
48 | |||
41 | /* Constants for Buffer Descriptor (BD) rings */ | 49 | /* Constants for Buffer Descriptor (BD) rings */ |
42 | #define MWIFIEX_MAX_TXRX_BD 0x20 | 50 | #define MWIFIEX_MAX_TXRX_BD 0x20 |
43 | #define MWIFIEX_TXBD_MASK 0x3F | 51 | #define MWIFIEX_TXBD_MASK 0x3F |
@@ -263,7 +271,6 @@ static struct memory_type_mapping mem_type_mapping_tbl_w8997[] = { | |||
263 | }; | 271 | }; |
264 | 272 | ||
265 | struct mwifiex_pcie_device { | 273 | struct mwifiex_pcie_device { |
266 | const char *firmware; | ||
267 | const struct mwifiex_pcie_card_reg *reg; | 274 | const struct mwifiex_pcie_card_reg *reg; |
268 | u16 blksz_fw_dl; | 275 | u16 blksz_fw_dl; |
269 | u16 tx_buf_size; | 276 | u16 tx_buf_size; |
@@ -274,7 +281,6 @@ struct mwifiex_pcie_device { | |||
274 | }; | 281 | }; |
275 | 282 | ||
276 | static const struct mwifiex_pcie_device mwifiex_pcie8766 = { | 283 | static const struct mwifiex_pcie_device mwifiex_pcie8766 = { |
277 | .firmware = PCIE8766_DEFAULT_FW_NAME, | ||
278 | .reg = &mwifiex_reg_8766, | 284 | .reg = &mwifiex_reg_8766, |
279 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, | 285 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, |
280 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, | 286 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_2K, |
@@ -283,7 +289,6 @@ static const struct mwifiex_pcie_device mwifiex_pcie8766 = { | |||
283 | }; | 289 | }; |
284 | 290 | ||
285 | static const struct mwifiex_pcie_device mwifiex_pcie8897 = { | 291 | static const struct mwifiex_pcie_device mwifiex_pcie8897 = { |
286 | .firmware = PCIE8897_DEFAULT_FW_NAME, | ||
287 | .reg = &mwifiex_reg_8897, | 292 | .reg = &mwifiex_reg_8897, |
288 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, | 293 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, |
289 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, | 294 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, |
@@ -294,7 +299,6 @@ static const struct mwifiex_pcie_device mwifiex_pcie8897 = { | |||
294 | }; | 299 | }; |
295 | 300 | ||
296 | static const struct mwifiex_pcie_device mwifiex_pcie8997 = { | 301 | static const struct mwifiex_pcie_device mwifiex_pcie8997 = { |
297 | .firmware = PCIE8997_DEFAULT_FW_NAME, | ||
298 | .reg = &mwifiex_reg_8997, | 302 | .reg = &mwifiex_reg_8997, |
299 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, | 303 | .blksz_fw_dl = MWIFIEX_PCIE_BLOCK_SIZE_FW_DNLD, |
300 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, | 304 | .tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K, |