diff options
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/wil6210/interrupt.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/main.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/pcie_bus.c | 37 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wil6210.h | 11 |
4 files changed, 36 insertions, 56 deletions
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c index 5a0ea72d3710..384bb3171c45 100644 --- a/drivers/net/wireless/ath/wil6210/interrupt.c +++ b/drivers/net/wireless/ath/wil6210/interrupt.c | |||
@@ -194,18 +194,19 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie) | |||
194 | wil_dbg_irq(wil, "RX done\n"); | 194 | wil_dbg_irq(wil, "RX done\n"); |
195 | 195 | ||
196 | if (isr & BIT_DMA_EP_RX_ICR_RX_HTRSH) | 196 | if (isr & BIT_DMA_EP_RX_ICR_RX_HTRSH) |
197 | wil_err_ratelimited(wil, "Received \"Rx buffer is in risk " | 197 | wil_err_ratelimited(wil, |
198 | "of overflow\" interrupt\n"); | 198 | "Received \"Rx buffer is in risk of overflow\" interrupt\n"); |
199 | 199 | ||
200 | isr &= ~(BIT_DMA_EP_RX_ICR_RX_DONE | BIT_DMA_EP_RX_ICR_RX_HTRSH); | 200 | isr &= ~(BIT_DMA_EP_RX_ICR_RX_DONE | |
201 | BIT_DMA_EP_RX_ICR_RX_HTRSH); | ||
201 | if (test_bit(wil_status_reset_done, wil->status)) { | 202 | if (test_bit(wil_status_reset_done, wil->status)) { |
202 | if (test_bit(wil_status_napi_en, wil->status)) { | 203 | if (test_bit(wil_status_napi_en, wil->status)) { |
203 | wil_dbg_txrx(wil, "NAPI(Rx) schedule\n"); | 204 | wil_dbg_txrx(wil, "NAPI(Rx) schedule\n"); |
204 | need_unmask = false; | 205 | need_unmask = false; |
205 | napi_schedule(&wil->napi_rx); | 206 | napi_schedule(&wil->napi_rx); |
206 | } else { | 207 | } else { |
207 | wil_err(wil, "Got Rx interrupt while " | 208 | wil_err(wil, |
208 | "stopping interface\n"); | 209 | "Got Rx interrupt while stopping interface\n"); |
209 | } | 210 | } |
210 | } else { | 211 | } else { |
211 | wil_err(wil, "Got Rx interrupt while in reset\n"); | 212 | wil_err(wil, "Got Rx interrupt while in reset\n"); |
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index a17278f4090a..fb73ac5fa00e 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c | |||
@@ -502,13 +502,10 @@ static int wil_target_reset(struct wil6210_priv *wil) | |||
502 | { | 502 | { |
503 | int delay = 0; | 503 | int delay = 0; |
504 | u32 x; | 504 | u32 x; |
505 | u32 rev_id; | 505 | bool is_reset_v2 = test_bit(hw_capability_reset_v2, |
506 | bool is_sparrow = (wil->board->board == WIL_BOARD_SPARROW); | 506 | wil->hw_capabilities); |
507 | 507 | ||
508 | wil_dbg_misc(wil, "Resetting \"%s\"...\n", wil->board->name); | 508 | wil_dbg_misc(wil, "Resetting \"%s\"...\n", wil->hw_name); |
509 | |||
510 | wil->hw_version = R(RGF_USER_FW_REV_ID); | ||
511 | rev_id = wil->hw_version & 0xff; | ||
512 | 509 | ||
513 | /* Clear MAC link up */ | 510 | /* Clear MAC link up */ |
514 | S(RGF_HP_CTRL, BIT(15)); | 511 | S(RGF_HP_CTRL, BIT(15)); |
@@ -520,7 +517,7 @@ static int wil_target_reset(struct wil6210_priv *wil) | |||
520 | /* Clear Fw Download notification */ | 517 | /* Clear Fw Download notification */ |
521 | C(RGF_USER_USAGE_6, BIT(0)); | 518 | C(RGF_USER_USAGE_6, BIT(0)); |
522 | 519 | ||
523 | if (is_sparrow) { | 520 | if (is_reset_v2) { |
524 | S(RGF_CAF_OSC_CONTROL, BIT_CAF_OSC_XTAL_EN); | 521 | S(RGF_CAF_OSC_CONTROL, BIT_CAF_OSC_XTAL_EN); |
525 | /* XTAL stabilization should take about 3ms */ | 522 | /* XTAL stabilization should take about 3ms */ |
526 | usleep_range(5000, 7000); | 523 | usleep_range(5000, 7000); |
@@ -541,10 +538,11 @@ static int wil_target_reset(struct wil6210_priv *wil) | |||
541 | 538 | ||
542 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000); | 539 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000); |
543 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F); | 540 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F); |
544 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, is_sparrow ? 0x000000f0 : 0x00000170); | 541 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, |
542 | is_reset_v2 ? 0x000000f0 : 0x00000170); | ||
545 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FE00); | 543 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FE00); |
546 | 544 | ||
547 | if (is_sparrow) { | 545 | if (is_reset_v2) { |
548 | W(RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0, 0x0); | 546 | W(RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0, 0x0); |
549 | W(RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_1, 0x0); | 547 | W(RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_1, 0x0); |
550 | } | 548 | } |
@@ -554,19 +552,14 @@ static int wil_target_reset(struct wil6210_priv *wil) | |||
554 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0); | 552 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0); |
555 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); | 553 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); |
556 | 554 | ||
557 | if (is_sparrow) { | 555 | if (is_reset_v2) { |
558 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000003); | 556 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000003); |
559 | /* reset A2 PCIE AHB */ | 557 | /* reset A2 PCIE AHB */ |
560 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000); | 558 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000); |
561 | } else { | 559 | } else { |
562 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000001); | 560 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000001); |
563 | if (rev_id == 1) { | 561 | W(RGF_PCIE_LOS_COUNTER_CTL, BIT(6) | BIT(8)); |
564 | /* reset A1 BOTH PCIE AHB & PCIE RGF */ | 562 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000); |
565 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080); | ||
566 | } else { | ||
567 | W(RGF_PCIE_LOS_COUNTER_CTL, BIT(6) | BIT(8)); | ||
568 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000); | ||
569 | } | ||
570 | } | 563 | } |
571 | 564 | ||
572 | /* TODO: check order here!!! Erez code is different */ | 565 | /* TODO: check order here!!! Erez code is different */ |
@@ -583,8 +576,7 @@ static int wil_target_reset(struct wil6210_priv *wil) | |||
583 | } | 576 | } |
584 | } while (x != HW_MACHINE_BOOT_DONE); | 577 | } while (x != HW_MACHINE_BOOT_DONE); |
585 | 578 | ||
586 | /* TODO: Erez check rev_id != 1 */ | 579 | if (!is_reset_v2) |
587 | if (!is_sparrow && (rev_id != 1)) | ||
588 | W(RGF_PCIE_LOS_COUNTER_CTL, BIT(8)); | 580 | W(RGF_PCIE_LOS_COUNTER_CTL, BIT(8)); |
589 | 581 | ||
590 | C(RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD); | 582 | C(RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD); |
@@ -653,6 +645,9 @@ int wil_reset(struct wil6210_priv *wil) | |||
653 | 645 | ||
654 | wil_dbg_misc(wil, "%s()\n", __func__); | 646 | wil_dbg_misc(wil, "%s()\n", __func__); |
655 | 647 | ||
648 | if (wil->hw_version == HW_VER_UNKNOWN) | ||
649 | return -ENODEV; | ||
650 | |||
656 | WARN_ON(!mutex_is_locked(&wil->mutex)); | 651 | WARN_ON(!mutex_is_locked(&wil->mutex)); |
657 | WARN_ON(test_bit(wil_status_napi_en, wil->status)); | 652 | WARN_ON(test_bit(wil_status_napi_en, wil->status)); |
658 | 653 | ||
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index 371809dfca73..9b1a589cefbd 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c | |||
@@ -40,25 +40,31 @@ void wil_set_capabilities(struct wil6210_priv *wil) | |||
40 | 40 | ||
41 | switch (rev_id) { | 41 | switch (rev_id) { |
42 | case JTAG_DEV_ID_MARLON_B0: | 42 | case JTAG_DEV_ID_MARLON_B0: |
43 | wil_info(wil, "Board hardware is Marlon B0\n"); | 43 | wil->hw_name = "Marlon B0"; |
44 | wil->hw_version = HW_VER_MARLON_B0; | 44 | wil->hw_version = HW_VER_MARLON_B0; |
45 | break; | 45 | break; |
46 | case JTAG_DEV_ID_SPARROW_A0: | 46 | case JTAG_DEV_ID_SPARROW_A0: |
47 | wil_info(wil, "Board hardware is Sparrow A0\n"); | 47 | wil->hw_name = "Sparrow A0"; |
48 | wil->hw_version = HW_VER_SPARROW_A0; | 48 | wil->hw_version = HW_VER_SPARROW_A0; |
49 | break; | 49 | break; |
50 | case JTAG_DEV_ID_SPARROW_A1: | 50 | case JTAG_DEV_ID_SPARROW_A1: |
51 | wil_info(wil, "Board hardware is Sparrow A1\n"); | 51 | wil->hw_name = "Sparrow A1"; |
52 | wil->hw_version = HW_VER_SPARROW_A1; | 52 | wil->hw_version = HW_VER_SPARROW_A1; |
53 | break; | 53 | break; |
54 | case JTAG_DEV_ID_SPARROW_B0: | 54 | case JTAG_DEV_ID_SPARROW_B0: |
55 | wil_info(wil, "Board hardware is Sparrow B0\n"); | 55 | wil->hw_name = "Sparrow B0"; |
56 | wil->hw_version = HW_VER_SPARROW_B0; | 56 | wil->hw_version = HW_VER_SPARROW_B0; |
57 | break; | 57 | break; |
58 | default: | 58 | default: |
59 | wil_err(wil, "Unknown board hardware 0x%08x\n", rev_id); | 59 | wil_err(wil, "Unknown board hardware 0x%08x\n", rev_id); |
60 | wil->hw_name = "Unknown"; | ||
60 | wil->hw_version = HW_VER_UNKNOWN; | 61 | wil->hw_version = HW_VER_UNKNOWN; |
61 | } | 62 | } |
63 | |||
64 | wil_info(wil, "Board hardware is %s\n", wil->hw_name); | ||
65 | |||
66 | if (wil->hw_version >= HW_VER_SPARROW_A0) | ||
67 | set_bit(hw_capability_reset_v2, wil->hw_capabilities); | ||
62 | } | 68 | } |
63 | 69 | ||
64 | void wil_disable_irq(struct wil6210_priv *wil) | 70 | void wil_disable_irq(struct wil6210_priv *wil) |
@@ -179,12 +185,11 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
179 | struct wil6210_priv *wil; | 185 | struct wil6210_priv *wil; |
180 | struct device *dev = &pdev->dev; | 186 | struct device *dev = &pdev->dev; |
181 | void __iomem *csr; | 187 | void __iomem *csr; |
182 | struct wil_board *board = (struct wil_board *)id->driver_data; | ||
183 | int rc; | 188 | int rc; |
184 | 189 | ||
185 | /* check HW */ | 190 | /* check HW */ |
186 | dev_info(&pdev->dev, WIL_NAME | 191 | dev_info(&pdev->dev, WIL_NAME |
187 | " \"%s\" device found [%04x:%04x] (rev %x)\n", board->name, | 192 | " device found [%04x:%04x] (rev %x)\n", |
188 | (int)pdev->vendor, (int)pdev->device, (int)pdev->revision); | 193 | (int)pdev->vendor, (int)pdev->device, (int)pdev->revision); |
189 | 194 | ||
190 | if (pci_resource_len(pdev, 0) != WIL6210_MEM_SIZE) { | 195 | if (pci_resource_len(pdev, 0) != WIL6210_MEM_SIZE) { |
@@ -234,7 +239,6 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
234 | 239 | ||
235 | pci_set_drvdata(pdev, wil); | 240 | pci_set_drvdata(pdev, wil); |
236 | wil->pdev = pdev; | 241 | wil->pdev = pdev; |
237 | wil->board = board; | ||
238 | wil_set_capabilities(wil); | 242 | wil_set_capabilities(wil); |
239 | wil6210_clear_irq(wil); | 243 | wil6210_clear_irq(wil); |
240 | 244 | ||
@@ -296,23 +300,10 @@ static void wil_pcie_remove(struct pci_dev *pdev) | |||
296 | pci_disable_device(pdev); | 300 | pci_disable_device(pdev); |
297 | } | 301 | } |
298 | 302 | ||
299 | static const struct wil_board wil_board_marlon = { | ||
300 | .board = WIL_BOARD_MARLON, | ||
301 | .name = "marlon", | ||
302 | }; | ||
303 | |||
304 | static const struct wil_board wil_board_sparrow = { | ||
305 | .board = WIL_BOARD_SPARROW, | ||
306 | .name = "sparrow", | ||
307 | }; | ||
308 | |||
309 | static const struct pci_device_id wil6210_pcie_ids[] = { | 303 | static const struct pci_device_id wil6210_pcie_ids[] = { |
310 | { PCI_DEVICE(0x1ae9, 0x0301), | 304 | { PCI_DEVICE(0x1ae9, 0x0301) }, |
311 | .driver_data = (kernel_ulong_t)&wil_board_marlon }, | 305 | { PCI_DEVICE(0x1ae9, 0x0310) }, |
312 | { PCI_DEVICE(0x1ae9, 0x0310), | 306 | { PCI_DEVICE(0x1ae9, 0x0302) }, /* same as above, firmware broken */ |
313 | .driver_data = (kernel_ulong_t)&wil_board_sparrow }, | ||
314 | { PCI_DEVICE(0x1ae9, 0x0302), /* same as above, firmware broken */ | ||
315 | .driver_data = (kernel_ulong_t)&wil_board_sparrow }, | ||
316 | { /* end: all zeroes */ }, | 307 | { /* end: all zeroes */ }, |
317 | }; | 308 | }; |
318 | MODULE_DEVICE_TABLE(pci, wil6210_pcie_ids); | 309 | MODULE_DEVICE_TABLE(pci, wil6210_pcie_ids); |
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index d296f2e17e56..8a52a5ffd6b1 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h | |||
@@ -32,13 +32,6 @@ extern int agg_wsize; | |||
32 | 32 | ||
33 | #define WIL_MAX_BUS_REQUEST_KBPS 800000 /* ~6.1Gbps */ | 33 | #define WIL_MAX_BUS_REQUEST_KBPS 800000 /* ~6.1Gbps */ |
34 | 34 | ||
35 | struct wil_board { | ||
36 | int board; | ||
37 | #define WIL_BOARD_MARLON (1) | ||
38 | #define WIL_BOARD_SPARROW (2) | ||
39 | const char * const name; | ||
40 | }; | ||
41 | |||
42 | /** | 35 | /** |
43 | * extract bits [@b0:@b1] (inclusive) from the value @x | 36 | * extract bits [@b0:@b1] (inclusive) from the value @x |
44 | * it should be @b0 <= @b1, or result is incorrect | 37 | * it should be @b0 <= @b1, or result is incorrect |
@@ -441,7 +434,7 @@ enum { | |||
441 | }; | 434 | }; |
442 | 435 | ||
443 | enum { | 436 | enum { |
444 | hw_capability_dummy, /* to avoid zero array */ | 437 | hw_capability_reset_v2 = 0, |
445 | hw_capability_last | 438 | hw_capability_last |
446 | }; | 439 | }; |
447 | 440 | ||
@@ -471,8 +464,8 @@ struct wil6210_priv { | |||
471 | DECLARE_BITMAP(status, wil_status_last); | 464 | DECLARE_BITMAP(status, wil_status_last); |
472 | u32 fw_version; | 465 | u32 fw_version; |
473 | u32 hw_version; | 466 | u32 hw_version; |
467 | const char *hw_name; | ||
474 | DECLARE_BITMAP(hw_capabilities, hw_capability_last); | 468 | DECLARE_BITMAP(hw_capabilities, hw_capability_last); |
475 | struct wil_board *board; | ||
476 | u8 n_mids; /* number of additional MIDs as reported by FW */ | 469 | u8 n_mids; /* number of additional MIDs as reported by FW */ |
477 | u32 recovery_count; /* num of FW recovery attempts in a short time */ | 470 | u32 recovery_count; /* num of FW recovery attempts in a short time */ |
478 | u32 recovery_state; /* FW recovery state machine */ | 471 | u32 recovery_state; /* FW recovery state machine */ |