diff options
| author | Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> | 2014-07-14 02:49:37 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2014-07-18 13:45:23 -0400 |
| commit | 6508281b0b15c469a940ffa46bb9215c9e18eaf3 (patch) | |
| tree | 4209c79f4cb4a61568e08238548a826fecfe70d6 | |
| parent | 5235cd21212ca3701b678d7e93682999a772c995 (diff) | |
wil6210: support for "sparrow" hardware
New hardware release appears; it require some changes to properly support it.
Introduce struct wil_board and "board" attribute in wil6210_priv;
keep hardware variant information in this structure.
fill it on probe(). Used in the reset flow.
Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | drivers/net/wireless/ath/wil6210/main.c | 42 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/wil6210/pcie_bus.c | 22 | ||||
| -rw-r--r-- | drivers/net/wireless/ath/wil6210/wil6210.h | 10 |
3 files changed, 63 insertions, 11 deletions
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c index 53a689ed7c7d..3704d2a434f3 100644 --- a/drivers/net/wireless/ath/wil6210/main.c +++ b/drivers/net/wireless/ath/wil6210/main.c | |||
| @@ -314,8 +314,9 @@ static void wil_target_reset(struct wil6210_priv *wil) | |||
| 314 | int delay = 0; | 314 | int delay = 0; |
| 315 | u32 hw_state; | 315 | u32 hw_state; |
| 316 | u32 rev_id; | 316 | u32 rev_id; |
| 317 | bool is_sparrow = (wil->board->board == WIL_BOARD_SPARROW); | ||
| 317 | 318 | ||
| 318 | wil_dbg_misc(wil, "Resetting...\n"); | 319 | wil_dbg_misc(wil, "Resetting \"%s\"...\n", wil->board->name); |
| 319 | 320 | ||
| 320 | /* register read */ | 321 | /* register read */ |
| 321 | #define R(a) ioread32(wil->csr + HOSTADDR(a)) | 322 | #define R(a) ioread32(wil->csr + HOSTADDR(a)) |
| @@ -328,35 +329,59 @@ static void wil_target_reset(struct wil6210_priv *wil) | |||
| 328 | 329 | ||
| 329 | wil->hw_version = R(RGF_USER_FW_REV_ID); | 330 | wil->hw_version = R(RGF_USER_FW_REV_ID); |
| 330 | rev_id = wil->hw_version & 0xff; | 331 | rev_id = wil->hw_version & 0xff; |
| 332 | |||
| 333 | /* Clear MAC link up */ | ||
| 334 | S(RGF_HP_CTRL, BIT(15)); | ||
| 331 | /* hpal_perst_from_pad_src_n_mask */ | 335 | /* hpal_perst_from_pad_src_n_mask */ |
| 332 | S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(6)); | 336 | S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(6)); |
| 333 | /* car_perst_rst_src_n_mask */ | 337 | /* car_perst_rst_src_n_mask */ |
| 334 | S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(7)); | 338 | S(RGF_USER_CLKS_CTL_SW_RST_MASK_0, BIT(7)); |
| 335 | wmb(); /* order is important here */ | 339 | wmb(); /* order is important here */ |
| 336 | 340 | ||
| 341 | if (is_sparrow) { | ||
| 342 | W(RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0, 0x3ff81f); | ||
| 343 | wmb(); /* order is important here */ | ||
| 344 | } | ||
| 345 | |||
| 337 | W(RGF_USER_MAC_CPU_0, BIT(1)); /* mac_cpu_man_rst */ | 346 | W(RGF_USER_MAC_CPU_0, BIT(1)); /* mac_cpu_man_rst */ |
| 338 | W(RGF_USER_USER_CPU_0, BIT(1)); /* user_cpu_man_rst */ | 347 | W(RGF_USER_USER_CPU_0, BIT(1)); /* user_cpu_man_rst */ |
| 339 | wmb(); /* order is important here */ | 348 | wmb(); /* order is important here */ |
| 340 | 349 | ||
| 341 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000); | 350 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0xFE000000); |
| 342 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F); | 351 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0x0000003F); |
| 343 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000170); | 352 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, is_sparrow ? 0x000000B0 : 0x00000170); |
| 344 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FC00); | 353 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0xFFE7FC00); |
| 345 | wmb(); /* order is important here */ | 354 | wmb(); /* order is important here */ |
| 346 | 355 | ||
| 356 | if (is_sparrow) { | ||
| 357 | W(RGF_USER_CLKS_CTL_EXT_SW_RST_VEC_0, 0x0); | ||
| 358 | wmb(); /* order is important here */ | ||
| 359 | } | ||
| 360 | |||
| 347 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0); | 361 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0); |
| 348 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0); | 362 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0); |
| 349 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0); | 363 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_1, 0); |
| 350 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); | 364 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); |
| 351 | wmb(); /* order is important here */ | 365 | wmb(); /* order is important here */ |
| 352 | 366 | ||
| 353 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000001); | 367 | if (is_sparrow) { |
| 354 | if (rev_id == 1) { | 368 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000003); |
| 355 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080); | 369 | /* reset A2 PCIE AHB */ |
| 356 | } else { | ||
| 357 | W(RGF_PCIE_LOS_COUNTER_CTL, BIT(6) | BIT(8)); | ||
| 358 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000); | 370 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000); |
| 371 | |||
| 372 | } else { | ||
| 373 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_3, 0x00000001); | ||
| 374 | if (rev_id == 1) { | ||
| 375 | /* reset A1 BOTH PCIE AHB & PCIE RGF */ | ||
| 376 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00000080); | ||
| 377 | } else { | ||
| 378 | W(RGF_PCIE_LOS_COUNTER_CTL, BIT(6) | BIT(8)); | ||
| 379 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_2, 0x00008000); | ||
| 380 | } | ||
| 381 | |||
| 359 | } | 382 | } |
| 383 | |||
| 384 | /* TODO: check order here!!! Erez code is different */ | ||
| 360 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); | 385 | W(RGF_USER_CLKS_CTL_SW_RST_VEC_0, 0); |
| 361 | wmb(); /* order is important here */ | 386 | wmb(); /* order is important here */ |
| 362 | 387 | ||
| @@ -371,7 +396,8 @@ static void wil_target_reset(struct wil6210_priv *wil) | |||
| 371 | } | 396 | } |
| 372 | } while (hw_state != HW_MACHINE_BOOT_DONE); | 397 | } while (hw_state != HW_MACHINE_BOOT_DONE); |
| 373 | 398 | ||
| 374 | if (rev_id == 2) | 399 | /* TODO: Erez check rev_id != 1 */ |
| 400 | if (!is_sparrow && (rev_id != 1)) | ||
| 375 | W(RGF_PCIE_LOS_COUNTER_CTL, BIT(8)); | 401 | W(RGF_PCIE_LOS_COUNTER_CTL, BIT(8)); |
| 376 | 402 | ||
| 377 | C(RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD); | 403 | C(RGF_USER_CLKS_CTL_0, BIT_USER_CLKS_RST_PWGD); |
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index 77b6272d93fb..d3fbfa28db62 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c | |||
| @@ -122,10 +122,12 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 122 | struct wil6210_priv *wil; | 122 | struct wil6210_priv *wil; |
| 123 | struct device *dev = &pdev->dev; | 123 | struct device *dev = &pdev->dev; |
| 124 | void __iomem *csr; | 124 | void __iomem *csr; |
| 125 | struct wil_board *board = (struct wil_board *)id->driver_data; | ||
| 125 | int rc; | 126 | int rc; |
| 126 | 127 | ||
| 127 | /* check HW */ | 128 | /* check HW */ |
| 128 | dev_info(&pdev->dev, WIL_NAME " device found [%04x:%04x] (rev %x)\n", | 129 | dev_info(&pdev->dev, WIL_NAME |
| 130 | " \"%s\" device found [%04x:%04x] (rev %x)\n", board->name, | ||
| 129 | (int)pdev->vendor, (int)pdev->device, (int)pdev->revision); | 131 | (int)pdev->vendor, (int)pdev->device, (int)pdev->revision); |
| 130 | 132 | ||
| 131 | if (pci_resource_len(pdev, 0) != WIL6210_MEM_SIZE) { | 133 | if (pci_resource_len(pdev, 0) != WIL6210_MEM_SIZE) { |
| @@ -175,6 +177,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 175 | 177 | ||
| 176 | pci_set_drvdata(pdev, wil); | 178 | pci_set_drvdata(pdev, wil); |
| 177 | wil->pdev = pdev; | 179 | wil->pdev = pdev; |
| 180 | wil->board = board; | ||
| 178 | 181 | ||
| 179 | wil6210_clear_irq(wil); | 182 | wil6210_clear_irq(wil); |
| 180 | /* FW should raise IRQ when ready */ | 183 | /* FW should raise IRQ when ready */ |
| @@ -225,8 +228,21 @@ static void wil_pcie_remove(struct pci_dev *pdev) | |||
| 225 | pci_disable_device(pdev); | 228 | pci_disable_device(pdev); |
| 226 | } | 229 | } |
| 227 | 230 | ||
| 228 | static DEFINE_PCI_DEVICE_TABLE(wil6210_pcie_ids) = { | 231 | static const struct wil_board wil_board_marlon = { |
| 229 | { PCI_DEVICE(0x1ae9, 0x0301) }, | 232 | .board = WIL_BOARD_MARLON, |
| 233 | .name = "marlon", | ||
| 234 | }; | ||
| 235 | |||
| 236 | static const struct wil_board wil_board_sparrow = { | ||
| 237 | .board = WIL_BOARD_SPARROW, | ||
| 238 | .name = "sparrow", | ||
| 239 | }; | ||
| 240 | |||
| 241 | static const struct pci_device_id wil6210_pcie_ids[] = { | ||
| 242 | { PCI_DEVICE(0x1ae9, 0x0301), | ||
| 243 | .driver_data = (kernel_ulong_t)&wil_board_marlon }, | ||
| 244 | { PCI_DEVICE(0x1ae9, 0x0310), | ||
| 245 | .driver_data = (kernel_ulong_t)&wil_board_sparrow }, | ||
| 230 | { /* end: all zeroes */ }, | 246 | { /* end: all zeroes */ }, |
| 231 | }; | 247 | }; |
| 232 | MODULE_DEVICE_TABLE(pci, wil6210_pcie_ids); | 248 | 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 424906635f05..09c36a7a32e0 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h | |||
| @@ -24,6 +24,13 @@ | |||
| 24 | 24 | ||
| 25 | #define WIL_NAME "wil6210" | 25 | #define WIL_NAME "wil6210" |
| 26 | 26 | ||
| 27 | struct wil_board { | ||
| 28 | int board; | ||
| 29 | #define WIL_BOARD_MARLON (1) | ||
| 30 | #define WIL_BOARD_SPARROW (2) | ||
| 31 | const char * const name; | ||
| 32 | }; | ||
| 33 | |||
| 27 | /** | 34 | /** |
