diff options
-rw-r--r-- | drivers/net/wireless/ath/wil6210/interrupt.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/pcie_bus.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wil6210.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wil_crash_dump.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wil_platform.c | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/wil6210/wil_platform.h | 38 |
6 files changed, 73 insertions, 10 deletions
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c index 50c136e843c4..4f2ffa5c6e17 100644 --- a/drivers/net/wireless/ath/wil6210/interrupt.c +++ b/drivers/net/wireless/ath/wil6210/interrupt.c | |||
@@ -394,9 +394,13 @@ static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie) | |||
394 | wil_fw_core_dump(wil); | 394 | wil_fw_core_dump(wil); |
395 | wil_notify_fw_error(wil); | 395 | wil_notify_fw_error(wil); |
396 | isr &= ~ISR_MISC_FW_ERROR; | 396 | isr &= ~ISR_MISC_FW_ERROR; |
397 | wil_fw_error_recovery(wil); | 397 | if (wil->platform_ops.notify_crash) { |
398 | wil_err(wil, "notify platform driver about FW crash"); | ||
399 | wil->platform_ops.notify_crash(wil->platform_handle); | ||
400 | } else { | ||
401 | wil_fw_error_recovery(wil); | ||
402 | } | ||
398 | } | 403 | } |
399 | |||
400 | if (isr & ISR_MISC_MBOX_EVT) { | 404 | if (isr & ISR_MISC_MBOX_EVT) { |
401 | wil_dbg_irq(wil, "MBOX event\n"); | 405 | wil_dbg_irq(wil, "MBOX event\n"); |
402 | wmi_recv_cmd(wil); | 406 | wmi_recv_cmd(wil); |
diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index 1a3142c332e1..e36f2a0c8cb6 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2012-2014 Qualcomm Atheros, Inc. | 2 | * Copyright (c) 2012-2015 Qualcomm Atheros, Inc. |
3 | * | 3 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 4 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 5 | * purpose with or without fee is hereby granted, provided that the above |
@@ -125,11 +125,37 @@ static int wil_if_pcie_disable(struct wil6210_priv *wil) | |||
125 | return 0; | 125 | return 0; |
126 | } | 126 | } |
127 | 127 | ||
128 | static int wil_platform_rop_ramdump(void *wil_handle, void *buf, uint32_t size) | ||
129 | { | ||
130 | struct wil6210_priv *wil = wil_handle; | ||
131 | |||
132 | if (!wil) | ||
133 | return -EINVAL; | ||
134 | |||
135 | return wil_fw_copy_crash_dump(wil, buf, size); | ||
136 | } | ||
137 | |||
138 | static int wil_platform_rop_fw_recovery(void *wil_handle) | ||
139 | { | ||
140 | struct wil6210_priv *wil = wil_handle; | ||
141 | |||
142 | if (!wil) | ||
143 | return -EINVAL; | ||
144 | |||
145 | wil_fw_error_recovery(wil); | ||
146 | |||
147 | return 0; | ||
148 | } | ||
149 | |||
128 | static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) | 150 | static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
129 | { | 151 | { |
130 | struct wil6210_priv *wil; | 152 | struct wil6210_priv *wil; |
131 | struct device *dev = &pdev->dev; | 153 | struct device *dev = &pdev->dev; |
132 | int rc; | 154 | int rc; |
155 | const struct wil_platform_rops rops = { | ||
156 | .ramdump = wil_platform_rop_ramdump, | ||
157 | .fw_recovery = wil_platform_rop_fw_recovery, | ||
158 | }; | ||
133 | 159 | ||
134 | /* check HW */ | 160 | /* check HW */ |
135 | dev_info(&pdev->dev, WIL_NAME | 161 | dev_info(&pdev->dev, WIL_NAME |
@@ -154,7 +180,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
154 | /* rollback to if_free */ | 180 | /* rollback to if_free */ |
155 | 181 | ||
156 | wil->platform_handle = | 182 | wil->platform_handle = |
157 | wil_platform_init(&pdev->dev, &wil->platform_ops); | 183 | wil_platform_init(&pdev->dev, &wil->platform_ops, &rops, wil); |
158 | if (!wil->platform_handle) { | 184 | if (!wil->platform_handle) { |
159 | rc = -ENODEV; | 185 | rc = -ENODEV; |
160 | wil_err(wil, "wil_platform_init failed\n"); | 186 | wil_err(wil, "wil_platform_init failed\n"); |
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index ade5f3b8274b..235e205ce2bc 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h | |||
@@ -828,6 +828,7 @@ int wil_can_suspend(struct wil6210_priv *wil, bool is_runtime); | |||
828 | int wil_suspend(struct wil6210_priv *wil, bool is_runtime); | 828 | int wil_suspend(struct wil6210_priv *wil, bool is_runtime); |
829 | int wil_resume(struct wil6210_priv *wil, bool is_runtime); | 829 | int wil_resume(struct wil6210_priv *wil, bool is_runtime); |
830 | 830 | ||
831 | int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size); | ||
831 | void wil_fw_core_dump(struct wil6210_priv *wil); | 832 | void wil_fw_core_dump(struct wil6210_priv *wil); |
832 | 833 | ||
833 | #endif /* __WIL6210_H__ */ | 834 | #endif /* __WIL6210_H__ */ |
diff --git a/drivers/net/wireless/ath/wil6210/wil_crash_dump.c b/drivers/net/wireless/ath/wil6210/wil_crash_dump.c index 7e70934990ae..b57d280946e0 100644 --- a/drivers/net/wireless/ath/wil6210/wil_crash_dump.c +++ b/drivers/net/wireless/ath/wil6210/wil_crash_dump.c | |||
@@ -51,8 +51,7 @@ static int wil_fw_get_crash_dump_bounds(struct wil6210_priv *wil, | |||
51 | return 0; | 51 | return 0; |
52 | } | 52 | } |
53 | 53 | ||
54 | static int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, | 54 | int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size) |
55 | u32 size) | ||
56 | { | 55 | { |
57 | int i; | 56 | int i; |
58 | const struct fw_map *map; | 57 | const struct fw_map *map; |
diff --git a/drivers/net/wireless/ath/wil6210/wil_platform.c b/drivers/net/wireless/ath/wil6210/wil_platform.c index 2e831bf20117..4eed05bddb60 100644 --- a/drivers/net/wireless/ath/wil6210/wil_platform.c +++ b/drivers/net/wireless/ath/wil6210/wil_platform.c | |||
@@ -33,7 +33,8 @@ void wil_platform_modexit(void) | |||
33 | * It returns a handle which is used with the rest of the API | 33 | * It returns a handle which is used with the rest of the API |
34 | * | 34 | * |
35 | */ | 35 | */ |
36 | void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops) | 36 | void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops, |
37 | const struct wil_platform_rops *rops, void *wil_handle) | ||
37 | { | 38 | { |
38 | void *handle = ops; /* to return some non-NULL for 'void' impl. */ | 39 | void *handle = ops; /* to return some non-NULL for 'void' impl. */ |
39 | 40 | ||
diff --git a/drivers/net/wireless/ath/wil6210/wil_platform.h b/drivers/net/wireless/ath/wil6210/wil_platform.h index d7fa19b7886d..9a949d910343 100644 --- a/drivers/net/wireless/ath/wil6210/wil_platform.h +++ b/drivers/net/wireless/ath/wil6210/wil_platform.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2014 Qualcomm Atheros, Inc. | 2 | * Copyright (c) 2014-2015 Qualcomm Atheros, Inc. |
3 | * | 3 | * |
4 | * Permission to use, copy, modify, and/or distribute this software for any | 4 | * Permission to use, copy, modify, and/or distribute this software for any |
5 | * purpose with or without fee is hereby granted, provided that the above | 5 | * purpose with or without fee is hereby granted, provided that the above |
@@ -20,16 +20,48 @@ | |||
20 | struct device; | 20 | struct device; |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * struct wil_platform_ops - wil platform module callbacks | 23 | * struct wil_platform_ops - wil platform module calls from this |
24 | * driver to platform driver | ||
24 | */ | 25 | */ |
25 | struct wil_platform_ops { | 26 | struct wil_platform_ops { |
26 | int (*bus_request)(void *handle, uint32_t kbps /* KBytes/Sec */); | 27 | int (*bus_request)(void *handle, uint32_t kbps /* KBytes/Sec */); |
27 | int (*suspend)(void *handle); | 28 | int (*suspend)(void *handle); |
28 | int (*resume)(void *handle); | 29 | int (*resume)(void *handle); |
29 | void (*uninit)(void *handle); | 30 | void (*uninit)(void *handle); |
31 | int (*notify_crash)(void *handle); | ||
30 | }; | 32 | }; |
31 | 33 | ||
32 | void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops); | 34 | /** |
35 | * struct wil_platform_rops - wil platform module callbacks from | ||
36 | * platform driver to this driver | ||
37 | * @ramdump: store a ramdump from the wil firmware. The platform | ||
38 | * driver may add additional data to the ramdump to | ||
39 | * generate the final crash dump. | ||
40 | * @fw_recovery: start a firmware recovery process. Called as | ||
41 | * part of a crash recovery process which may include other | ||
42 | * related platform subsystems. | ||
43 | */ | ||
44 | struct wil_platform_rops { | ||
45 | int (*ramdump)(void *wil_handle, void *buf, uint32_t size); | ||
46 | int (*fw_recovery)(void *wil_handle); | ||
47 | }; | ||
48 | |||
49 | /** | ||
50 | * wil_platform_init - initialize the platform driver | ||
51 | * | ||
52 | * @dev - pointer to the wil6210 device | ||
53 | * @ops - structure with platform driver operations. Platform | ||
54 | * driver will fill this structure with function pointers. | ||
55 | * @rops - structure with callbacks from platform driver to | ||
56 | * this driver. The platform driver copies the structure to | ||
57 | * its own storage. Can be NULL if this driver does not | ||
58 | * support crash recovery. | ||
59 | * @wil_handle - context for this driver that will be passed | ||
60 | * when platform driver invokes one of the callbacks in | ||
61 | * rops. May be NULL if rops is NULL. | ||
62 | */ | ||
63 | void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops, | ||
64 | const struct wil_platform_rops *rops, void *wil_handle); | ||
33 | 65 | ||
34 | int __init wil_platform_modinit(void); | 66 | int __init wil_platform_modinit(void); |
35 | void wil_platform_modexit(void); | 67 | void wil_platform_modexit(void); |