diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-12 13:22:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-12 13:22:49 -0400 |
commit | fbf8d7106c926d375c76e65cc878f4fa7b91cbc3 (patch) | |
tree | e9faf7f8a9ce8da9ad2e2a3f1768a4af414670d4 /drivers | |
parent | 98f62b7a082e1e9eb762c7329a704316f6e07698 (diff) | |
parent | d4e4ab86bcba5a72779c43dc1459f71fea3d89c8 (diff) |
Merge 3.11-rc5 into staging-next
We want the staging fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
281 files changed, 2973 insertions, 1723 deletions
diff --git a/drivers/accessibility/braille/braille_console.c b/drivers/accessibility/braille/braille_console.c index d21167bfc865..dc34a5b8bcee 100644 --- a/drivers/accessibility/braille/braille_console.c +++ b/drivers/accessibility/braille/braille_console.c | |||
@@ -359,6 +359,9 @@ int braille_register_console(struct console *console, int index, | |||
359 | char *console_options, char *braille_options) | 359 | char *console_options, char *braille_options) |
360 | { | 360 | { |
361 | int ret; | 361 | int ret; |
362 | |||
363 | if (!(console->flags & CON_BRL)) | ||
364 | return 0; | ||
362 | if (!console_options) | 365 | if (!console_options) |
363 | /* Only support VisioBraille for now */ | 366 | /* Only support VisioBraille for now */ |
364 | console_options = "57600o8"; | 367 | console_options = "57600o8"; |
@@ -374,15 +377,17 @@ int braille_register_console(struct console *console, int index, | |||
374 | braille_co = console; | 377 | braille_co = console; |
375 | register_keyboard_notifier(&keyboard_notifier_block); | 378 | register_keyboard_notifier(&keyboard_notifier_block); |
376 | register_vt_notifier(&vt_notifier_block); | 379 | register_vt_notifier(&vt_notifier_block); |
377 | return 0; | 380 | return 1; |
378 | } | 381 | } |
379 | 382 | ||
380 | int braille_unregister_console(struct console *console) | 383 | int braille_unregister_console(struct console *console) |
381 | { | 384 | { |
382 | if (braille_co != console) | 385 | if (braille_co != console) |
383 | return -EINVAL; | 386 | return -EINVAL; |
387 | if (!(console->flags & CON_BRL)) | ||
388 | return 0; | ||
384 | unregister_keyboard_notifier(&keyboard_notifier_block); | 389 | unregister_keyboard_notifier(&keyboard_notifier_block); |
385 | unregister_vt_notifier(&vt_notifier_block); | 390 | unregister_vt_notifier(&vt_notifier_block); |
386 | braille_co = NULL; | 391 | braille_co = NULL; |
387 | return 0; | 392 | return 1; |
388 | } | 393 | } |
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index fd6c51cc3acb..5a74a9c1e42c 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -451,7 +451,6 @@ static void acpi_processor_remove(struct acpi_device *device) | |||
451 | /* Clean up. */ | 451 | /* Clean up. */ |
452 | per_cpu(processor_device_array, pr->id) = NULL; | 452 | per_cpu(processor_device_array, pr->id) = NULL; |
453 | per_cpu(processors, pr->id) = NULL; | 453 | per_cpu(processors, pr->id) = NULL; |
454 | try_offline_node(cpu_to_node(pr->id)); | ||
455 | 454 | ||
456 | /* Remove the CPU. */ | 455 | /* Remove the CPU. */ |
457 | get_online_cpus(); | 456 | get_online_cpus(); |
@@ -459,6 +458,8 @@ static void acpi_processor_remove(struct acpi_device *device) | |||
459 | acpi_unmap_lsapic(pr->id); | 458 | acpi_unmap_lsapic(pr->id); |
460 | put_online_cpus(); | 459 | put_online_cpus(); |
461 | 460 | ||
461 | try_offline_node(cpu_to_node(pr->id)); | ||
462 | |||
462 | out: | 463 | out: |
463 | free_cpumask_var(pr->throttling.shared_cpu_map); | 464 | free_cpumask_var(pr->throttling.shared_cpu_map); |
464 | kfree(pr); | 465 | kfree(pr); |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 082b4dd252a8..d405fbad406a 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -117,6 +117,7 @@ struct acpi_battery { | |||
117 | struct acpi_device *device; | 117 | struct acpi_device *device; |
118 | struct notifier_block pm_nb; | 118 | struct notifier_block pm_nb; |
119 | unsigned long update_time; | 119 | unsigned long update_time; |
120 | int revision; | ||
120 | int rate_now; | 121 | int rate_now; |
121 | int capacity_now; | 122 | int capacity_now; |
122 | int voltage_now; | 123 | int voltage_now; |
@@ -359,6 +360,7 @@ static struct acpi_offsets info_offsets[] = { | |||
359 | }; | 360 | }; |
360 | 361 | ||
361 | static struct acpi_offsets extended_info_offsets[] = { | 362 | static struct acpi_offsets extended_info_offsets[] = { |
363 | {offsetof(struct acpi_battery, revision), 0}, | ||
362 | {offsetof(struct acpi_battery, power_unit), 0}, | 364 | {offsetof(struct acpi_battery, power_unit), 0}, |
363 | {offsetof(struct acpi_battery, design_capacity), 0}, | 365 | {offsetof(struct acpi_battery, design_capacity), 0}, |
364 | {offsetof(struct acpi_battery, full_charge_capacity), 0}, | 366 | {offsetof(struct acpi_battery, full_charge_capacity), 0}, |
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index f68095756fb7..408f6b2a5fa8 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -31,6 +31,7 @@ static LIST_HEAD(bus_type_list); | |||
31 | static DECLARE_RWSEM(bus_type_sem); | 31 | static DECLARE_RWSEM(bus_type_sem); |
32 | 32 | ||
33 | #define PHYSICAL_NODE_STRING "physical_node" | 33 | #define PHYSICAL_NODE_STRING "physical_node" |
34 | #define PHYSICAL_NODE_NAME_SIZE (sizeof(PHYSICAL_NODE_STRING) + 10) | ||
34 | 35 | ||
35 | int register_acpi_bus_type(struct acpi_bus_type *type) | 36 | int register_acpi_bus_type(struct acpi_bus_type *type) |
36 | { | 37 | { |
@@ -78,41 +79,108 @@ static struct acpi_bus_type *acpi_get_bus_type(struct device *dev) | |||
78 | return ret; | 79 | return ret; |
79 | } | 80 | } |
80 | 81 | ||
81 | static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, | 82 | static acpi_status acpi_dev_present(acpi_handle handle, u32 lvl_not_used, |
82 | void *addr_p, void **ret_p) | 83 | void *not_used, void **ret_p) |
83 | { | 84 | { |
84 | unsigned long long addr, sta; | 85 | struct acpi_device *adev = NULL; |
85 | acpi_status status; | ||
86 | 86 | ||
87 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); | 87 | acpi_bus_get_device(handle, &adev); |
88 | if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { | 88 | if (adev) { |
89 | *ret_p = handle; | 89 | *ret_p = handle; |
90 | status = acpi_bus_get_status_handle(handle, &sta); | 90 | return AE_CTRL_TERMINATE; |
91 | if (ACPI_SUCCESS(status) && (sta & ACPI_STA_DEVICE_ENABLED)) | ||
92 | return AE_CTRL_TERMINATE; | ||
93 | } | 91 | } |
94 | return AE_OK; | 92 | return AE_OK; |
95 | } | 93 | } |
96 | 94 | ||
97 | acpi_handle acpi_get_child(acpi_handle parent, u64 address) | 95 | static bool acpi_extra_checks_passed(acpi_handle handle, bool is_bridge) |
98 | { | 96 | { |
99 | void *ret = NULL; | 97 | unsigned long long sta; |
98 | acpi_status status; | ||
99 | |||
100 | status = acpi_bus_get_status_handle(handle, &sta); | ||
101 | if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_ENABLED)) | ||
102 | return false; | ||
103 | |||
104 | if (is_bridge) { | ||
105 | void *test = NULL; | ||
106 | |||
107 | /* Check if this object has at least one child device. */ | ||
108 | acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
109 | acpi_dev_present, NULL, NULL, &test); | ||
110 | return !!test; | ||
111 | } | ||
112 | return true; | ||
113 | } | ||
114 | |||
115 | struct find_child_context { | ||
116 | u64 addr; | ||
117 | bool is_bridge; | ||
118 | acpi_handle ret; | ||
119 | bool ret_checked; | ||
120 | }; | ||
121 | |||
122 | static acpi_status do_find_child(acpi_handle handle, u32 lvl_not_used, | ||
123 | void *data, void **not_used) | ||
124 | { | ||
125 | struct find_child_context *context = data; | ||
126 | unsigned long long addr; | ||
127 | acpi_status status; | ||
100 | 128 | ||
101 | if (!parent) | 129 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); |
102 | return NULL; | 130 | if (ACPI_FAILURE(status) || addr != context->addr) |
131 | return AE_OK; | ||
103 | 132 | ||
104 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, | 133 | if (!context->ret) { |
105 | do_acpi_find_child, &address, &ret); | 134 | /* This is the first matching object. Save its handle. */ |
106 | return (acpi_handle)ret; | 135 | context->ret = handle; |
136 | return AE_OK; | ||
137 | } | ||
138 | /* | ||
139 | * There is more than one matching object with the same _ADR value. | ||
140 | * That really is unexpected, so we are kind of beyond the scope of the | ||
141 | * spec here. We have to choose which one to return, though. | ||
142 | * | ||
143 | * First, check if the previously found object is good enough and return | ||
144 | * its handle if so. Second, check the same for the object that we've | ||
145 | * just found. | ||
146 | */ | ||
147 | if (!context->ret_checked) { | ||
148 | if (acpi_extra_checks_passed(context->ret, context->is_bridge)) | ||
149 | return AE_CTRL_TERMINATE; | ||
150 | else | ||
151 | context->ret_checked = true; | ||
152 | } | ||
153 | if (acpi_extra_checks_passed(handle, context->is_bridge)) { | ||
154 | context->ret = handle; | ||
155 | return AE_CTRL_TERMINATE; | ||
156 | } | ||
157 | return AE_OK; | ||
107 | } | 158 | } |
108 | EXPORT_SYMBOL(acpi_get_child); | 159 | |
160 | acpi_handle acpi_find_child(acpi_handle parent, u64 addr, bool is_bridge) | ||
161 | { | ||
162 | if (parent) { | ||
163 | struct find_child_context context = { | ||
164 | .addr = addr, | ||
165 | .is_bridge = is_bridge, | ||
166 | }; | ||
167 | |||
168 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, do_find_child, | ||
169 | NULL, &context, NULL); | ||
170 | return context.ret; | ||
171 | } | ||
172 | return NULL; | ||
173 | } | ||
174 | EXPORT_SYMBOL_GPL(acpi_find_child); | ||
109 | 175 | ||
110 | int acpi_bind_one(struct device *dev, acpi_handle handle) | 176 | int acpi_bind_one(struct device *dev, acpi_handle handle) |
111 | { | 177 | { |
112 | struct acpi_device *acpi_dev; | 178 | struct acpi_device *acpi_dev; |
113 | acpi_status status; | 179 | acpi_status status; |
114 | struct acpi_device_physical_node *physical_node, *pn; | 180 | struct acpi_device_physical_node *physical_node, *pn; |
115 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; | 181 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; |
182 | struct list_head *physnode_list; | ||
183 | unsigned int node_id; | ||
116 | int retval = -EINVAL; | 184 | int retval = -EINVAL; |
117 | 185 | ||
118 | if (ACPI_HANDLE(dev)) { | 186 | if (ACPI_HANDLE(dev)) { |
@@ -139,25 +207,27 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
139 | 207 | ||
140 | mutex_lock(&acpi_dev->physical_node_lock); | 208 | mutex_lock(&acpi_dev->physical_node_lock); |
141 | 209 | ||
142 | /* Sanity check. */ | 210 | /* |
143 | list_for_each_entry(pn, &acpi_dev->physical_node_list, node) | 211 | * Keep the list sorted by node_id so that the IDs of removed nodes can |
212 | * be recycled easily. | ||
213 | */ | ||
214 | physnode_list = &acpi_dev->physical_node_list; | ||
215 | node_id = 0; | ||
216 | list_for_each_entry(pn, &acpi_dev->physical_node_list, node) { | ||
217 | /* Sanity check. */ | ||
144 | if (pn->dev == dev) { | 218 | if (pn->dev == dev) { |
145 | dev_warn(dev, "Already associated with ACPI node\n"); | 219 | dev_warn(dev, "Already associated with ACPI node\n"); |
146 | goto err_free; | 220 | goto err_free; |
147 | } | 221 | } |
148 | 222 | if (pn->node_id == node_id) { | |
149 | /* allocate physical node id according to physical_node_id_bitmap */ | 223 | physnode_list = &pn->node; |
150 | physical_node->node_id = | 224 | node_id++; |
151 | find_first_zero_bit(acpi_dev->physical_node_id_bitmap, | 225 | } |
152 | ACPI_MAX_PHYSICAL_NODE); | ||
153 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { | ||
154 | retval = -ENOSPC; | ||
155 | goto err_free; | ||
156 | } | 226 | } |
157 | 227 | ||
158 | set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); | 228 | physical_node->node_id = node_id; |
159 | physical_node->dev = dev; | 229 | physical_node->dev = dev; |
160 | list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); | 230 | list_add(&physical_node->node, physnode_list); |
161 | acpi_dev->physical_node_count++; | 231 | acpi_dev->physical_node_count++; |
162 | 232 | ||
163 | mutex_unlock(&acpi_dev->physical_node_lock); | 233 | mutex_unlock(&acpi_dev->physical_node_lock); |
@@ -208,7 +278,7 @@ int acpi_unbind_one(struct device *dev) | |||
208 | 278 | ||
209 | mutex_lock(&acpi_dev->physical_node_lock); | 279 | mutex_lock(&acpi_dev->physical_node_lock); |
210 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { | 280 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { |
211 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; | 281 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; |
212 | 282 | ||
213 | entry = list_entry(node, struct acpi_device_physical_node, | 283 | entry = list_entry(node, struct acpi_device_physical_node, |
214 | node); | 284 | node); |
@@ -216,7 +286,6 @@ int acpi_unbind_one(struct device *dev) | |||
216 | continue; | 286 | continue; |
217 | 287 | ||
218 | list_del(node); | 288 | list_del(node); |
219 | clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap); | ||
220 | 289 | ||
221 | acpi_dev->physical_node_count--; | 290 | acpi_dev->physical_node_count--; |
222 | 291 | ||
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c index aa1227a7e3f2..04a13784dd20 100644 --- a/drivers/acpi/proc.c +++ b/drivers/acpi/proc.c | |||
@@ -311,6 +311,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
311 | dev->pnp.bus_id, | 311 | dev->pnp.bus_id, |
312 | (u32) dev->wakeup.sleep_state); | 312 | (u32) dev->wakeup.sleep_state); |
313 | 313 | ||
314 | mutex_lock(&dev->physical_node_lock); | ||
315 | |||
314 | if (!dev->physical_node_count) { | 316 | if (!dev->physical_node_count) { |
315 | seq_printf(seq, "%c%-8s\n", | 317 | seq_printf(seq, "%c%-8s\n", |
316 | dev->wakeup.flags.run_wake ? '*' : ' ', | 318 | dev->wakeup.flags.run_wake ? '*' : ' ', |
@@ -338,6 +340,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) | |||
338 | put_device(ldev); | 340 | put_device(ldev); |
339 | } | 341 | } |
340 | } | 342 | } |
343 | |||
344 | mutex_unlock(&dev->physical_node_lock); | ||
341 | } | 345 | } |
342 | mutex_unlock(&acpi_device_lock); | 346 | mutex_unlock(&acpi_device_lock); |
343 | return 0; | 347 | return 0; |
@@ -347,12 +351,16 @@ static void physical_device_enable_wakeup(struct acpi_device *adev) | |||
347 | { | 351 | { |
348 | struct acpi_device_physical_node *entry; | 352 | struct acpi_device_physical_node *entry; |
349 | 353 | ||
354 | mutex_lock(&adev->physical_node_lock); | ||
355 | |||
350 | list_for_each_entry(entry, | 356 | list_for_each_entry(entry, |
351 | &adev->physical_node_list, node) | 357 | &adev->physical_node_list, node) |
352 | if (entry->dev && device_can_wakeup(entry->dev)) { | 358 | if (entry->dev && device_can_wakeup(entry->dev)) { |
353 | bool enable = !device_may_wakeup(entry->dev); | 359 | bool enable = !device_may_wakeup(entry->dev); |
354 | device_set_wakeup_enable(entry->dev, enable); | 360 | device_set_wakeup_enable(entry->dev, enable); |
355 | } | 361 | } |
362 | |||
363 | mutex_unlock(&adev->physical_node_lock); | ||
356 | } | 364 | } |
357 | 365 | ||
358 | static ssize_t | 366 | static ssize_t |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 0ec434d2586d..e1284b8dc6ee 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -689,7 +689,7 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device, | |||
689 | * Some systems always report current brightness level as maximum | 689 | * Some systems always report current brightness level as maximum |
690 | * through _BQC, we need to test another value for them. | 690 | * through _BQC, we need to test another value for them. |
691 | */ | 691 | */ |
692 | test_level = current_level == max_level ? br->levels[2] : max_level; | 692 | test_level = current_level == max_level ? br->levels[3] : max_level; |
693 | 693 | ||
694 | result = acpi_video_device_lcd_set_level(device, test_level); | 694 | result = acpi_video_device_lcd_set_level(device, test_level); |
695 | if (result) | 695 | if (result) |
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c index 4ec7c04b3f82..26386f0b89a8 100644 --- a/drivers/ata/pata_imx.c +++ b/drivers/ata/pata_imx.c | |||
@@ -237,6 +237,7 @@ static const struct of_device_id imx_pata_dt_ids[] = { | |||
237 | /* sentinel */ | 237 | /* sentinel */ |
238 | } | 238 | } |
239 | }; | 239 | }; |
240 | MODULE_DEVICE_TABLE(of, imx_pata_dt_ids); | ||
240 | 241 | ||
241 | static struct platform_driver pata_imx_driver = { | 242 | static struct platform_driver pata_imx_driver = { |
242 | .probe = pata_imx_probe, | 243 | .probe = pata_imx_probe, |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index e69102696533..3455f833e473 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -719,7 +719,8 @@ static int regcache_sync_block_raw(struct regmap *map, void *block, | |||
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | return regcache_sync_block_raw_flush(map, &data, base, regtmp); | 722 | return regcache_sync_block_raw_flush(map, &data, base, regtmp + |
723 | map->reg_stride); | ||
723 | } | 724 | } |
724 | 725 | ||
725 | int regcache_sync_block(struct regmap *map, void *block, | 726 | int regcache_sync_block(struct regmap *map, void *block, |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 11f467c00d0a..a12b923bbaca 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -91,6 +91,10 @@ static struct usb_device_id ath3k_table[] = { | |||
91 | { USB_DEVICE(0x0489, 0xe04e) }, | 91 | { USB_DEVICE(0x0489, 0xe04e) }, |
92 | { USB_DEVICE(0x0489, 0xe056) }, | 92 | { USB_DEVICE(0x0489, 0xe056) }, |
93 | { USB_DEVICE(0x0489, 0xe04d) }, | 93 | { USB_DEVICE(0x0489, 0xe04d) }, |
94 | { USB_DEVICE(0x04c5, 0x1330) }, | ||
95 | { USB_DEVICE(0x13d3, 0x3402) }, | ||
96 | { USB_DEVICE(0x0cf3, 0x3121) }, | ||
97 | { USB_DEVICE(0x0cf3, 0xe003) }, | ||
94 | 98 | ||
95 | /* Atheros AR5BBU12 with sflash firmware */ | 99 | /* Atheros AR5BBU12 with sflash firmware */ |
96 | { USB_DEVICE(0x0489, 0xE02C) }, | 100 | { USB_DEVICE(0x0489, 0xE02C) }, |
@@ -128,6 +132,10 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
128 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, | 132 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, |
129 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, | 133 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, |
130 | { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, | 134 | { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, | ||
136 | { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, | ||
137 | { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, | ||
138 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, | ||
131 | 139 | ||
132 | /* Atheros AR5BBU22 with sflash firmware */ | 140 | /* Atheros AR5BBU22 with sflash firmware */ |
133 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, |
@@ -193,24 +201,44 @@ error: | |||
193 | 201 | ||
194 | static int ath3k_get_state(struct usb_device *udev, unsigned char *state) | 202 | static int ath3k_get_state(struct usb_device *udev, unsigned char *state) |
195 | { | 203 | { |
196 | int pipe = 0; | 204 | int ret, pipe = 0; |
205 | char *buf; | ||
206 | |||
207 | buf = kmalloc(sizeof(*buf), GFP_KERNEL); | ||
208 | if (!buf) | ||
209 | return -ENOMEM; | ||
197 | 210 | ||
198 | pipe = usb_rcvctrlpipe(udev, 0); | 211 | pipe = usb_rcvctrlpipe(udev, 0); |
199 | return usb_control_msg(udev, pipe, ATH3K_GETSTATE, | 212 | ret = usb_control_msg(udev, pipe, ATH3K_GETSTATE, |
200 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, | 213 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, |
201 | state, 0x01, USB_CTRL_SET_TIMEOUT); | 214 | buf, sizeof(*buf), USB_CTRL_SET_TIMEOUT); |
215 | |||
216 | *state = *buf; | ||
217 | kfree(buf); | ||
218 | |||
219 | return ret; | ||
202 | } | 220 | } |
203 | 221 | ||
204 | static int ath3k_get_version(struct usb_device *udev, | 222 | static int ath3k_get_version(struct usb_device *udev, |
205 | struct ath3k_version *version) | 223 | struct ath3k_version *version) |
206 | { | 224 | { |
207 | int pipe = 0; | 225 | int ret, pipe = 0; |
226 | struct ath3k_version *buf; | ||
227 | const int size = sizeof(*buf); | ||
228 | |||
229 | buf = kmalloc(size, GFP_KERNEL); | ||
230 | if (!buf) | ||
231 | return -ENOMEM; | ||
208 | 232 | ||
209 | pipe = usb_rcvctrlpipe(udev, 0); | 233 | pipe = usb_rcvctrlpipe(udev, 0); |
210 | return usb_control_msg(udev, pipe, ATH3K_GETVERSION, | 234 | ret = usb_control_msg(udev, pipe, ATH3K_GETVERSION, |
211 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, version, | 235 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, |
212 | sizeof(struct ath3k_version), | 236 | buf, size, USB_CTRL_SET_TIMEOUT); |
213 | USB_CTRL_SET_TIMEOUT); | 237 | |
238 | memcpy(version, buf, size); | ||
239 | kfree(buf); | ||
240 | |||
241 | return ret; | ||
214 | } | 242 | } |
215 | 243 | ||
216 | static int ath3k_load_fwfile(struct usb_device *udev, | 244 | static int ath3k_load_fwfile(struct usb_device *udev, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index de4cf4daa2f4..8e16f0af6358 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -154,6 +154,10 @@ static struct usb_device_id blacklist_table[] = { | |||
154 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, | 154 | { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, |
155 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, | 155 | { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, |
156 | { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, | 156 | { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, |
157 | { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 }, | ||
158 | { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 }, | ||
159 | { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 }, | ||
160 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, | ||
157 | 161 | ||
158 | /* Atheros AR5BBU12 with sflash firmware */ | 162 | /* Atheros AR5BBU12 with sflash firmware */ |
159 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 163 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
@@ -1095,7 +1099,7 @@ static int btusb_setup_intel_patching(struct hci_dev *hdev, | |||
1095 | if (IS_ERR(skb)) { | 1099 | if (IS_ERR(skb)) { |
1096 | BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", | 1100 | BT_ERR("%s sending Intel patch command (0x%4.4x) failed (%ld)", |
1097 | hdev->name, cmd->opcode, PTR_ERR(skb)); | 1101 | hdev->name, cmd->opcode, PTR_ERR(skb)); |
1098 | return -PTR_ERR(skb); | 1102 | return PTR_ERR(skb); |
1099 | } | 1103 | } |
1100 | 1104 | ||
1101 | /* It ensures that the returned event matches the event data read from | 1105 | /* It ensures that the returned event matches the event data read from |
@@ -1147,7 +1151,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) | |||
1147 | if (IS_ERR(skb)) { | 1151 | if (IS_ERR(skb)) { |
1148 | BT_ERR("%s sending initial HCI reset command failed (%ld)", | 1152 | BT_ERR("%s sending initial HCI reset command failed (%ld)", |
1149 | hdev->name, PTR_ERR(skb)); | 1153 | hdev->name, PTR_ERR(skb)); |
1150 | return -PTR_ERR(skb); | 1154 | return PTR_ERR(skb); |
1151 | } | 1155 | } |
1152 | kfree_skb(skb); | 1156 | kfree_skb(skb); |
1153 | 1157 | ||
@@ -1161,7 +1165,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) | |||
1161 | if (IS_ERR(skb)) { | 1165 | if (IS_ERR(skb)) { |
1162 | BT_ERR("%s reading Intel fw version command failed (%ld)", | 1166 | BT_ERR("%s reading Intel fw version command failed (%ld)", |
1163 | hdev->name, PTR_ERR(skb)); | 1167 | hdev->name, PTR_ERR(skb)); |
1164 | return -PTR_ERR(skb); | 1168 | return PTR_ERR(skb); |
1165 | } | 1169 | } |
1166 | 1170 | ||
1167 | if (skb->len != sizeof(*ver)) { | 1171 | if (skb->len != sizeof(*ver)) { |
@@ -1219,7 +1223,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) | |||
1219 | BT_ERR("%s entering Intel manufacturer mode failed (%ld)", | 1223 | BT_ERR("%s entering Intel manufacturer mode failed (%ld)", |
1220 | hdev->name, PTR_ERR(skb)); | 1224 | hdev->name, PTR_ERR(skb)); |
1221 | release_firmware(fw); | 1225 | release_firmware(fw); |
1222 | return -PTR_ERR(skb); | 1226 | return PTR_ERR(skb); |
1223 | } | 1227 | } |
1224 | 1228 | ||
1225 | if (skb->data[0]) { | 1229 | if (skb->data[0]) { |
@@ -1276,7 +1280,7 @@ static int btusb_setup_intel(struct hci_dev *hdev) | |||
1276 | if (IS_ERR(skb)) { | 1280 | if (IS_ERR(skb)) { |
1277 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", | 1281 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", |
1278 | hdev->name, PTR_ERR(skb)); | 1282 | hdev->name, PTR_ERR(skb)); |
1279 | return -PTR_ERR(skb); | 1283 | return PTR_ERR(skb); |
1280 | } | 1284 | } |
1281 | kfree_skb(skb); | 1285 | kfree_skb(skb); |
1282 | 1286 | ||
@@ -1292,7 +1296,7 @@ exit_mfg_disable: | |||
1292 | if (IS_ERR(skb)) { | 1296 | if (IS_ERR(skb)) { |
1293 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", | 1297 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", |
1294 | hdev->name, PTR_ERR(skb)); | 1298 | hdev->name, PTR_ERR(skb)); |
1295 | return -PTR_ERR(skb); | 1299 | return PTR_ERR(skb); |
1296 | } | 1300 | } |
1297 | kfree_skb(skb); | 1301 | kfree_skb(skb); |
1298 | 1302 | ||
@@ -1310,7 +1314,7 @@ exit_mfg_deactivate: | |||
1310 | if (IS_ERR(skb)) { | 1314 | if (IS_ERR(skb)) { |
1311 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", | 1315 | BT_ERR("%s exiting Intel manufacturer mode failed (%ld)", |
1312 | hdev->name, PTR_ERR(skb)); | 1316 | hdev->name, PTR_ERR(skb)); |
1313 | return -PTR_ERR(skb); | 1317 | return PTR_ERR(skb); |
1314 | } | 1318 | } |
1315 | kfree_skb(skb); | 1319 | kfree_skb(skb); |
1316 | 1320 | ||
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index bf5d2477cb77..15f2e7025b78 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c | |||
@@ -129,7 +129,8 @@ parisc_agp_insert_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
129 | off_t j, io_pg_start; | 129 | off_t j, io_pg_start; |
130 | int io_pg_count; | 130 | int io_pg_count; |
131 | 131 | ||
132 | if (type != 0 || mem->type != 0) { | 132 | if (type != mem->type || |
133 | agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) { | ||
133 | return -EINVAL; | 134 | return -EINVAL; |
134 | } | 135 | } |
135 | 136 | ||
@@ -175,7 +176,8 @@ parisc_agp_remove_memory(struct agp_memory *mem, off_t pg_start, int type) | |||
175 | struct _parisc_agp_info *info = &parisc_agp_info; | 176 | struct _parisc_agp_info *info = &parisc_agp_info; |
176 | int i, io_pg_start, io_pg_count; | 177 | int i, io_pg_start, io_pg_count; |
177 | 178 | ||
178 | if (type != 0 || mem->type != 0) { | 179 | if (type != mem->type || |
180 | agp_bridge->driver->agp_type_to_mask_type(agp_bridge, type)) { | ||
179 | return -EINVAL; | 181 | return -EINVAL; |
180 | } | 182 | } |
181 | 183 | ||
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 1b456fe9b87a..fc45567ad3ac 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -272,9 +272,12 @@ static struct port *find_port_by_devt_in_portdev(struct ports_device *portdev, | |||
272 | unsigned long flags; | 272 | unsigned long flags; |
273 | 273 | ||
274 | spin_lock_irqsave(&portdev->ports_lock, flags); | 274 | spin_lock_irqsave(&portdev->ports_lock, flags); |
275 | list_for_each_entry(port, &portdev->ports, list) | 275 | list_for_each_entry(port, &portdev->ports, list) { |
276 | if (port->cdev->dev == dev) | 276 | if (port->cdev->dev == dev) { |
277 | kref_get(&port->kref); | ||
277 | goto out; | 278 | goto out; |
279 | } | ||
280 | } | ||
278 | port = NULL; | 281 | port = NULL; |
279 | out: | 282 | out: |
280 | spin_unlock_irqrestore(&portdev->ports_lock, flags); | 283 | spin_unlock_irqrestore(&portdev->ports_lock, flags); |
@@ -746,6 +749,10 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, | |||
746 | 749 | ||
747 | port = filp->private_data; | 750 | port = filp->private_data; |
748 | 751 | ||
752 | /* Port is hot-unplugged. */ | ||
753 | if (!port->guest_connected) | ||
754 | return -ENODEV; | ||
755 | |||
749 | if (!port_has_data(port)) { | 756 | if (!port_has_data(port)) { |
750 | /* | 757 | /* |
751 | * If nothing's connected on the host just return 0 in | 758 | * If nothing's connected on the host just return 0 in |
@@ -762,7 +769,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf, | |||
762 | if (ret < 0) | 769 | if (ret < 0) |
763 | return ret; | 770 | return ret; |
764 | } | 771 | } |
765 | /* Port got hot-unplugged. */ | 772 | /* Port got hot-unplugged while we were waiting above. */ |
766 | if (!port->guest_connected) | 773 | if (!port->guest_connected) |
767 | return -ENODEV; | 774 | return -ENODEV; |
768 | /* | 775 | /* |
@@ -932,13 +939,25 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
932 | if (is_rproc_serial(port->out_vq->vdev)) | 939 | if (is_rproc_serial(port->out_vq->vdev)) |
933 | return -EINVAL; | 940 | return -EINVAL; |
934 | 941 | ||
942 | /* | ||
943 | * pipe->nrbufs == 0 means there are no data to transfer, | ||
944 | * so this returns just 0 for no data. | ||
945 | */ | ||
946 | pipe_lock(pipe); | ||
947 | if (!pipe->nrbufs) { | ||
948 | ret = 0; | ||
949 | goto error_out; | ||
950 | } | ||
951 | |||
935 | ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); | 952 | ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK); |
936 | if (ret < 0) | 953 | if (ret < 0) |
937 | return ret; | 954 | goto error_out; |
938 | 955 | ||
939 | buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); | 956 | buf = alloc_buf(port->out_vq, 0, pipe->nrbufs); |
940 | if (!buf) | 957 | if (!buf) { |
941 | return -ENOMEM; | 958 | ret = -ENOMEM; |
959 | goto error_out; | ||
960 | } | ||
942 | 961 | ||
943 | sgl.n = 0; | 962 | sgl.n = 0; |
944 | sgl.len = 0; | 963 | sgl.len = 0; |
@@ -946,12 +965,17 @@ static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe, | |||
946 | sgl.sg = buf->sg; | 965 | sgl.sg = buf->sg; |
947 | sg_init_table(sgl.sg, sgl.size); | 966 | sg_init_table(sgl.sg, sgl.size); |
948 | ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); | 967 | ret = __splice_from_pipe(pipe, &sd, pipe_to_sg); |
968 | pipe_unlock(pipe); | ||
949 | if (likely(ret > 0)) | 969 | if (likely(ret > 0)) |
950 | ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); | 970 | ret = __send_to_port(port, buf->sg, sgl.n, sgl.len, buf, true); |
951 | 971 | ||
952 | if (unlikely(ret <= 0)) | 972 | if (unlikely(ret <= 0)) |
953 | free_buf(buf, true); | 973 | free_buf(buf, true); |
954 | return ret; | 974 | return ret; |
975 | |||
976 | error_out: | ||
977 | pipe_unlock(pipe); | ||
978 | return ret; | ||
955 | } | 979 | } |
956 | 980 | ||
957 | static unsigned int port_fops_poll(struct file *filp, poll_table *wait) | 981 | static unsigned int port_fops_poll(struct file *filp, poll_table *wait) |
@@ -1019,14 +1043,14 @@ static int port_fops_open(struct inode *inode, struct file *filp) | |||
1019 | struct port *port; | 1043 | struct port *port; |
1020 | int ret; | 1044 | int ret; |
1021 | 1045 | ||
1046 | /* We get the port with a kref here */ | ||
1022 | port = find_port_by_devt(cdev->dev); | 1047 | port = find_port_by_devt(cdev->dev); |
1048 | if (!port) { | ||
1049 | /* Port was unplugged before we could proceed */ | ||
1050 | return -ENXIO; | ||
1051 | } | ||
1023 | filp->private_data = port; | 1052 | filp->private_data = port; |
1024 | 1053 | ||
1025 | /* Prevent against a port getting hot-unplugged at the same time */ | ||
1026 | spin_lock_irq(&port->portdev->ports_lock); | ||
1027 | kref_get(&port->kref); | ||
1028 | spin_unlock_irq(&port->portdev->ports_lock); | ||
1029 | |||
1030 | /* | 1054 | /* |
1031 | * Don't allow opening of console port devices -- that's done | 1055 | * Don't allow opening of console port devices -- that's done |
1032 | * via /dev/hvc | 1056 | * via /dev/hvc |
@@ -1498,14 +1522,6 @@ static void remove_port(struct kref *kref) | |||
1498 | 1522 | ||
1499 | port = container_of(kref, struct port, kref); | 1523 | port = container_of(kref, struct port, kref); |
1500 | 1524 | ||
1501 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); | ||
1502 | device_destroy(pdrvdata.class, port->dev->devt); | ||
1503 | cdev_del(port->cdev); | ||
1504 | |||
1505 | kfree(port->name); | ||
1506 | |||
1507 | debugfs_remove(port->debugfs_file); | ||
1508 | |||
1509 | kfree(port); | 1525 | kfree(port); |
1510 | } | 1526 | } |
1511 | 1527 | ||
@@ -1539,12 +1555,14 @@ static void unplug_port(struct port *port) | |||
1539 | spin_unlock_irq(&port->portdev->ports_lock); | 1555 | spin_unlock_irq(&port->portdev->ports_lock); |
1540 | 1556 | ||
1541 | if (port->guest_connected) { | 1557 | if (port->guest_connected) { |
1558 | /* Let the app know the port is going down. */ | ||
1559 | send_sigio_to_port(port); | ||
1560 | |||
1561 | /* Do this after sigio is actually sent */ | ||
1542 | port->guest_connected = false; | 1562 | port->guest_connected = false; |
1543 | port->host_connected = false; | 1563 | port->host_connected = false; |
1544 | wake_up_interruptible(&port->waitqueue); | ||
1545 | 1564 | ||
1546 | /* Let the app know the port is going down. */ | 1565 | wake_up_interruptible(&port->waitqueue); |
1547 | send_sigio_to_port(port); | ||
1548 | } | 1566 | } |
1549 | 1567 | ||
1550 | if (is_console_port(port)) { | 1568 | if (is_console_port(port)) { |
@@ -1563,6 +1581,14 @@ static void unplug_port(struct port *port) | |||
1563 | */ | 1581 | */ |
1564 | port->portdev = NULL; | 1582 | port->portdev = NULL; |
1565 | 1583 | ||
1584 | sysfs_remove_group(&port->dev->kobj, &port_attribute_group); | ||
1585 | device_destroy(pdrvdata.class, port->dev->devt); | ||
1586 | cdev_del(port->cdev); | ||
1587 | |||
1588 | kfree(port->name); | ||
1589 | |||
1590 | debugfs_remove(port->debugfs_file); | ||
1591 | |||
1566 | /* | 1592 | /* |
1567 | * Locks around here are not necessary - a port can't be | 1593 | * Locks around here are not necessary - a port can't be |
1568 | * opened after we removed the port struct from ports_list | 1594 | * opened after we removed the port struct from ports_list |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index a4ad7339588d..f0a5e2b0eb8a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1177,14 +1177,11 @@ static int __cpufreq_remove_dev(struct device *dev, | |||
1177 | __func__, cpu_dev->id, cpu); | 1177 | __func__, cpu_dev->id, cpu); |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | if ((cpus == 1) && (cpufreq_driver->target)) | ||
1181 | __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); | ||
1182 | |||
1183 | pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); | ||
1184 | cpufreq_cpu_put(data); | ||
1185 | |||
1186 | /* If cpu is last user of policy, free policy */ | 1180 | /* If cpu is last user of policy, free policy */ |
1187 | if (cpus == 1) { | 1181 | if (cpus == 1) { |
1182 | if (cpufreq_driver->target) | ||
1183 | __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT); | ||
1184 | |||
1188 | lock_policy_rwsem_read(cpu); | 1185 | lock_policy_rwsem_read(cpu); |
1189 | kobj = &data->kobj; | 1186 | kobj = &data->kobj; |
1190 | cmp = &data->kobj_unregister; | 1187 | cmp = &data->kobj_unregister; |
@@ -1205,9 +1202,13 @@ static int __cpufreq_remove_dev(struct device *dev, | |||
1205 | free_cpumask_var(data->related_cpus); | 1202 | free_cpumask_var(data->related_cpus); |
1206 | free_cpumask_var(data->cpus); | 1203 | free_cpumask_var(data->cpus); |
1207 | kfree(data); | 1204 | kfree(data); |
1208 | } else if (cpufreq_driver->target) { | 1205 | } else { |
1209 | __cpufreq_governor(data, CPUFREQ_GOV_START); | 1206 | pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); |
1210 | __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); | 1207 | cpufreq_cpu_put(data); |
1208 | if (cpufreq_driver->target) { | ||
1209 | __cpufreq_governor(data, CPUFREQ_GOV_START); | ||
1210 | __cpufreq_governor(data, CPUFREQ_GOV_LIMITS); | ||
1211 | } | ||
1211 | } | 1212 | } |
1212 | 1213 | ||
1213 | per_cpu(cpufreq_policy_cpu, cpu) = -1; | 1214 | per_cpu(cpufreq_policy_cpu, cpu) = -1; |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 0ceb2eff5a7e..f97cb3d8c5a2 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -221,8 +221,8 @@ static ssize_t store_down_threshold(struct dbs_data *dbs_data, const char *buf, | |||
221 | return count; | 221 | return count; |
222 | } | 222 | } |
223 | 223 | ||
224 | static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | 224 | static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, |
225 | size_t count) | 225 | const char *buf, size_t count) |
226 | { | 226 | { |
227 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | 227 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; |
228 | unsigned int input, j; | 228 | unsigned int input, j; |
@@ -235,10 +235,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
235 | if (input > 1) | 235 | if (input > 1) |
236 | input = 1; | 236 | input = 1; |
237 | 237 | ||
238 | if (input == cs_tuners->ignore_nice) /* nothing to do */ | 238 | if (input == cs_tuners->ignore_nice_load) /* nothing to do */ |
239 | return count; | 239 | return count; |
240 | 240 | ||
241 | cs_tuners->ignore_nice = input; | 241 | cs_tuners->ignore_nice_load = input; |
242 | 242 | ||
243 | /* we need to re-evaluate prev_cpu_idle */ | 243 | /* we need to re-evaluate prev_cpu_idle */ |
244 | for_each_online_cpu(j) { | 244 | for_each_online_cpu(j) { |
@@ -246,7 +246,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
246 | dbs_info = &per_cpu(cs_cpu_dbs_info, j); | 246 | dbs_info = &per_cpu(cs_cpu_dbs_info, j); |
247 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, | 247 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, |
248 | &dbs_info->cdbs.prev_cpu_wall, 0); | 248 | &dbs_info->cdbs.prev_cpu_wall, 0); |
249 | if (cs_tuners->ignore_nice) | 249 | if (cs_tuners->ignore_nice_load) |
250 | dbs_info->cdbs.prev_cpu_nice = | 250 | dbs_info->cdbs.prev_cpu_nice = |
251 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 251 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
252 | } | 252 | } |
@@ -279,7 +279,7 @@ show_store_one(cs, sampling_rate); | |||
279 | show_store_one(cs, sampling_down_factor); | 279 | show_store_one(cs, sampling_down_factor); |
280 | show_store_one(cs, up_threshold); | 280 | show_store_one(cs, up_threshold); |
281 | show_store_one(cs, down_threshold); | 281 | show_store_one(cs, down_threshold); |
282 | show_store_one(cs, ignore_nice); | 282 | show_store_one(cs, ignore_nice_load); |
283 | show_store_one(cs, freq_step); | 283 | show_store_one(cs, freq_step); |
284 | declare_show_sampling_rate_min(cs); | 284 | declare_show_sampling_rate_min(cs); |
285 | 285 | ||
@@ -287,7 +287,7 @@ gov_sys_pol_attr_rw(sampling_rate); | |||
287 | gov_sys_pol_attr_rw(sampling_down_factor); | 287 | gov_sys_pol_attr_rw(sampling_down_factor); |
288 | gov_sys_pol_attr_rw(up_threshold); | 288 | gov_sys_pol_attr_rw(up_threshold); |
289 | gov_sys_pol_attr_rw(down_threshold); | 289 | gov_sys_pol_attr_rw(down_threshold); |
290 | gov_sys_pol_attr_rw(ignore_nice); | 290 | gov_sys_pol_attr_rw(ignore_nice_load); |
291 | gov_sys_pol_attr_rw(freq_step); | 291 | gov_sys_pol_attr_rw(freq_step); |
292 | gov_sys_pol_attr_ro(sampling_rate_min); | 292 | gov_sys_pol_attr_ro(sampling_rate_min); |
293 | 293 | ||
@@ -297,7 +297,7 @@ static struct attribute *dbs_attributes_gov_sys[] = { | |||
297 | &sampling_down_factor_gov_sys.attr, | 297 | &sampling_down_factor_gov_sys.attr, |
298 | &up_threshold_gov_sys.attr, | 298 | &up_threshold_gov_sys.attr, |
299 | &down_threshold_gov_sys.attr, | 299 | &down_threshold_gov_sys.attr, |
300 | &ignore_nice_gov_sys.attr, | 300 | &ignore_nice_load_gov_sys.attr, |
301 | &freq_step_gov_sys.attr, | 301 | &freq_step_gov_sys.attr, |
302 | NULL | 302 | NULL |
303 | }; | 303 | }; |
@@ -313,7 +313,7 @@ static struct attribute *dbs_attributes_gov_pol[] = { | |||
313 | &sampling_down_factor_gov_pol.attr, | 313 | &sampling_down_factor_gov_pol.attr, |
314 | &up_threshold_gov_pol.attr, | 314 | &up_threshold_gov_pol.attr, |
315 | &down_threshold_gov_pol.attr, | 315 | &down_threshold_gov_pol.attr, |
316 | &ignore_nice_gov_pol.attr, | 316 | &ignore_nice_load_gov_pol.attr, |
317 | &freq_step_gov_pol.attr, | 317 | &freq_step_gov_pol.attr, |
318 | NULL | 318 | NULL |
319 | }; | 319 | }; |
@@ -338,7 +338,7 @@ static int cs_init(struct dbs_data *dbs_data) | |||
338 | tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; | 338 | tuners->up_threshold = DEF_FREQUENCY_UP_THRESHOLD; |
339 | tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; | 339 | tuners->down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD; |
340 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; | 340 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; |
341 | tuners->ignore_nice = 0; | 341 | tuners->ignore_nice_load = 0; |
342 | tuners->freq_step = DEF_FREQUENCY_STEP; | 342 | tuners->freq_step = DEF_FREQUENCY_STEP; |
343 | 343 | ||
344 | dbs_data->tuners = tuners; | 344 | dbs_data->tuners = tuners; |
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 7b839a8db2a7..e59afaa9da23 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -47,9 +47,9 @@ void dbs_check_cpu(struct dbs_data *dbs_data, int cpu) | |||
47 | unsigned int j; | 47 | unsigned int j; |
48 | 48 | ||
49 | if (dbs_data->cdata->governor == GOV_ONDEMAND) | 49 | if (dbs_data->cdata->governor == GOV_ONDEMAND) |
50 | ignore_nice = od_tuners->ignore_nice; | 50 | ignore_nice = od_tuners->ignore_nice_load; |
51 | else | 51 | else |
52 | ignore_nice = cs_tuners->ignore_nice; | 52 | ignore_nice = cs_tuners->ignore_nice_load; |
53 | 53 | ||
54 | policy = cdbs->cur_policy; | 54 | policy = cdbs->cur_policy; |
55 | 55 | ||
@@ -298,12 +298,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
298 | cs_tuners = dbs_data->tuners; | 298 | cs_tuners = dbs_data->tuners; |
299 | cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); | 299 | cs_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); |
300 | sampling_rate = cs_tuners->sampling_rate; | 300 | sampling_rate = cs_tuners->sampling_rate; |
301 | ignore_nice = cs_tuners->ignore_nice; | 301 | ignore_nice = cs_tuners->ignore_nice_load; |
302 | } else { | 302 | } else { |
303 | od_tuners = dbs_data->tuners; | 303 | od_tuners = dbs_data->tuners; |
304 | od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); | 304 | od_dbs_info = dbs_data->cdata->get_cpu_dbs_info_s(cpu); |
305 | sampling_rate = od_tuners->sampling_rate; | 305 | sampling_rate = od_tuners->sampling_rate; |
306 | ignore_nice = od_tuners->ignore_nice; | 306 | ignore_nice = od_tuners->ignore_nice_load; |
307 | od_ops = dbs_data->cdata->gov_ops; | 307 | od_ops = dbs_data->cdata->gov_ops; |
308 | io_busy = od_tuners->io_is_busy; | 308 | io_busy = od_tuners->io_is_busy; |
309 | } | 309 | } |
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index 6663ec3b3056..d5f12b4b11b8 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
@@ -165,7 +165,7 @@ struct cs_cpu_dbs_info_s { | |||
165 | 165 | ||
166 | /* Per policy Governers sysfs tunables */ | 166 | /* Per policy Governers sysfs tunables */ |
167 | struct od_dbs_tuners { | 167 | struct od_dbs_tuners { |
168 | unsigned int ignore_nice; | 168 | unsigned int ignore_nice_load; |
169 | unsigned int sampling_rate; | 169 | unsigned int sampling_rate; |
170 | unsigned int sampling_down_factor; | 170 | unsigned int sampling_down_factor; |
171 | unsigned int up_threshold; | 171 | unsigned int up_threshold; |
@@ -175,7 +175,7 @@ struct od_dbs_tuners { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | struct cs_dbs_tuners { | 177 | struct cs_dbs_tuners { |
178 | unsigned int ignore_nice; | 178 | unsigned int ignore_nice_load; |
179 | unsigned int sampling_rate; | 179 | unsigned int sampling_rate; |
180 | unsigned int sampling_down_factor; | 180 | unsigned int sampling_down_factor; |
181 | unsigned int up_threshold; | 181 | unsigned int up_threshold; |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 93eb5cbcc1f6..c087347d6688 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -403,8 +403,8 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data, | |||
403 | return count; | 403 | return count; |
404 | } | 404 | } |
405 | 405 | ||
406 | static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | 406 | static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, |
407 | size_t count) | 407 | const char *buf, size_t count) |
408 | { | 408 | { |
409 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | 409 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; |
410 | unsigned int input; | 410 | unsigned int input; |
@@ -419,10 +419,10 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
419 | if (input > 1) | 419 | if (input > 1) |
420 | input = 1; | 420 | input = 1; |
421 | 421 | ||
422 | if (input == od_tuners->ignore_nice) { /* nothing to do */ | 422 | if (input == od_tuners->ignore_nice_load) { /* nothing to do */ |
423 | return count; | 423 | return count; |
424 | } | 424 | } |
425 | od_tuners->ignore_nice = input; | 425 | od_tuners->ignore_nice_load = input; |
426 | 426 | ||
427 | /* we need to re-evaluate prev_cpu_idle */ | 427 | /* we need to re-evaluate prev_cpu_idle */ |
428 | for_each_online_cpu(j) { | 428 | for_each_online_cpu(j) { |
@@ -430,7 +430,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
430 | dbs_info = &per_cpu(od_cpu_dbs_info, j); | 430 | dbs_info = &per_cpu(od_cpu_dbs_info, j); |
431 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, | 431 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, |
432 | &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); | 432 | &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); |
433 | if (od_tuners->ignore_nice) | 433 | if (od_tuners->ignore_nice_load) |
434 | dbs_info->cdbs.prev_cpu_nice = | 434 | dbs_info->cdbs.prev_cpu_nice = |
435 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 435 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |
436 | 436 | ||
@@ -461,7 +461,7 @@ show_store_one(od, sampling_rate); | |||
461 | show_store_one(od, io_is_busy); | 461 | show_store_one(od, io_is_busy); |
462 | show_store_one(od, up_threshold); | 462 | show_store_one(od, up_threshold); |
463 | show_store_one(od, sampling_down_factor); | 463 | show_store_one(od, sampling_down_factor); |
464 | show_store_one(od, ignore_nice); | 464 | show_store_one(od, ignore_nice_load); |
465 | show_store_one(od, powersave_bias); | 465 | show_store_one(od, powersave_bias); |
466 | declare_show_sampling_rate_min(od); | 466 | declare_show_sampling_rate_min(od); |
467 | 467 | ||
@@ -469,7 +469,7 @@ gov_sys_pol_attr_rw(sampling_rate); | |||
469 | gov_sys_pol_attr_rw(io_is_busy); | 469 | gov_sys_pol_attr_rw(io_is_busy); |
470 | gov_sys_pol_attr_rw(up_threshold); | 470 | gov_sys_pol_attr_rw(up_threshold); |
471 | gov_sys_pol_attr_rw(sampling_down_factor); | 471 | gov_sys_pol_attr_rw(sampling_down_factor); |
472 | gov_sys_pol_attr_rw(ignore_nice); | 472 | gov_sys_pol_attr_rw(ignore_nice_load); |
473 | gov_sys_pol_attr_rw(powersave_bias); | 473 | gov_sys_pol_attr_rw(powersave_bias); |
474 | gov_sys_pol_attr_ro(sampling_rate_min); | 474 | gov_sys_pol_attr_ro(sampling_rate_min); |
475 | 475 | ||
@@ -478,7 +478,7 @@ static struct attribute *dbs_attributes_gov_sys[] = { | |||
478 | &sampling_rate_gov_sys.attr, | 478 | &sampling_rate_gov_sys.attr, |
479 | &up_threshold_gov_sys.attr, | 479 | &up_threshold_gov_sys.attr, |
480 | &sampling_down_factor_gov_sys.attr, | 480 | &sampling_down_factor_gov_sys.attr, |
481 | &ignore_nice_gov_sys.attr, | 481 | &ignore_nice_load_gov_sys.attr, |
482 | &powersave_bias_gov_sys.attr, | 482 | &powersave_bias_gov_sys.attr, |
483 | &io_is_busy_gov_sys.attr, | 483 | &io_is_busy_gov_sys.attr, |
484 | NULL | 484 | NULL |
@@ -494,7 +494,7 @@ static struct attribute *dbs_attributes_gov_pol[] = { | |||
494 | &sampling_rate_gov_pol.attr, | 494 | &sampling_rate_gov_pol.attr, |
495 | &up_threshold_gov_pol.attr, | 495 | &up_threshold_gov_pol.attr, |
496 | &sampling_down_factor_gov_pol.attr, | 496 | &sampling_down_factor_gov_pol.attr, |
497 | &ignore_nice_gov_pol.attr, | 497 | &ignore_nice_load_gov_pol.attr, |
498 | &powersave_bias_gov_pol.attr, | 498 | &powersave_bias_gov_pol.attr, |
499 | &io_is_busy_gov_pol.attr, | 499 | &io_is_busy_gov_pol.attr, |
500 | NULL | 500 | NULL |
@@ -544,7 +544,7 @@ static int od_init(struct dbs_data *dbs_data) | |||
544 | } | 544 | } |
545 | 545 | ||
546 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; | 546 | tuners->sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR; |
547 | tuners->ignore_nice = 0; | 547 | tuners->ignore_nice_load = 0; |
548 | tuners->powersave_bias = default_powersave_bias; | 548 | tuners->powersave_bias = default_powersave_bias; |
549 | tuners->io_is_busy = should_io_be_busy(); | 549 | tuners->io_is_busy = should_io_be_busy(); |
550 | 550 | ||
diff --git a/drivers/cpufreq/loongson2_cpufreq.c b/drivers/cpufreq/loongson2_cpufreq.c index bb838b985077..9536852c504a 100644 --- a/drivers/cpufreq/loongson2_cpufreq.c +++ b/drivers/cpufreq/loongson2_cpufreq.c | |||
@@ -118,11 +118,6 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
118 | clk_put(cpuclk); | 118 | clk_put(cpuclk); |
119 | return -EINVAL; | 119 | return -EINVAL; |
120 | } | 120 | } |
121 | ret = clk_set_rate(cpuclk, rate); | ||
122 | if (ret) { | ||
123 | clk_put(cpuclk); | ||
124 | return ret; | ||
125 | } | ||
126 | 121 | ||
127 | /* clock table init */ | 122 | /* clock table init */ |
128 | for (i = 2; | 123 | for (i = 2; |
@@ -130,6 +125,12 @@ static int loongson2_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
130 | i++) | 125 | i++) |
131 | loongson2_clockmod_table[i].frequency = (rate * i) / 8; | 126 | loongson2_clockmod_table[i].frequency = (rate * i) / 8; |
132 | 127 | ||
128 | ret = clk_set_rate(cpuclk, rate); | ||
129 | if (ret) { | ||
130 | clk_put(cpuclk); | ||
131 | return ret; | ||
132 | } | ||
133 | |||
133 | policy->cur = loongson2_cpufreq_get(policy->cpu); | 134 | policy->cur = loongson2_cpufreq_get(policy->cpu); |
134 | 135 | ||
135 | cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], | 136 | cpufreq_frequency_table_get_attr(&loongson2_clockmod_table[0], |
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index fe343a06b7da..bc580b67a652 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -28,13 +28,6 @@ | |||
28 | #define MAX_INTERESTING 50000 | 28 | #define MAX_INTERESTING 50000 |
29 | #define STDDEV_THRESH 400 | 29 | #define STDDEV_THRESH 400 |
30 | 30 | ||
31 | /* 60 * 60 > STDDEV_THRESH * INTERVALS = 400 * 8 */ | ||
32 | #define MAX_DEVIATION 60 | ||
33 | |||
34 | static DEFINE_PER_CPU(struct hrtimer, menu_hrtimer); | ||
35 | static DEFINE_PER_CPU(int, hrtimer_status); | ||
36 | /* menu hrtimer mode */ | ||
37 | enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT, MENU_HRTIMER_GENERAL}; | ||
38 | 31 | ||
39 | /* | 32 | /* |
40 | * Concepts and ideas behind the menu governor | 33 | * Concepts and ideas behind the menu governor |
@@ -116,13 +109,6 @@ enum {MENU_HRTIMER_STOP, MENU_HRTIMER_REPEAT, MENU_HRTIMER_GENERAL}; | |||
116 | * | 109 | * |
117 | */ | 110 | */ |
118 | 111 | ||
119 | /* | ||
120 | * The C-state residency is so long that is is worthwhile to exit | ||
121 | * from the shallow C-state and re-enter into a deeper C-state. | ||
122 | */ | ||
123 | static unsigned int perfect_cstate_ms __read_mostly = 30; | ||
124 | module_param(perfect_cstate_ms, uint, 0000); | ||
125 | |||
126 | struct menu_device { | 112 | struct menu_device { |
127 | int last_state_idx; | 113 | int last_state_idx; |
128 | int needs_update; | 114 | int needs_update; |
@@ -205,52 +191,17 @@ static u64 div_round64(u64 dividend, u32 divisor) | |||
205 | return div_u64(dividend + (divisor / 2), divisor); | 191 | return div_u64(dividend + (divisor / 2), divisor); |
206 | } | 192 | } |
207 | 193 | ||
208 | /* Cancel the hrtimer if it is not triggered yet */ | ||
209 | void menu_hrtimer_cancel(void) | ||
210 | { | ||
211 | int cpu = smp_processor_id(); | ||
212 | struct hrtimer *hrtmr = &per_cpu(menu_hrtimer, cpu); | ||
213 | |||
214 | /* The timer is still not time out*/ | ||
215 | if (per_cpu(hrtimer_status, cpu)) { | ||
216 | hrtimer_cancel(hrtmr); | ||
217 | per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP; | ||
218 | } | ||
219 | } | ||
220 | EXPORT_SYMBOL_GPL(menu_hrtimer_cancel); | ||
221 | |||
222 | /* Call back for hrtimer is triggered */ | ||
223 | static enum hrtimer_restart menu_hrtimer_notify(struct hrtimer *hrtimer) | ||
224 | { | ||
225 | int cpu = smp_processor_id(); | ||
226 | struct menu_device *data = &per_cpu(menu_devices, cpu); | ||
227 | |||
228 | /* In general case, the expected residency is much larger than | ||
229 | * deepest C-state target residency, but prediction logic still | ||
230 | * predicts a small predicted residency, so the prediction | ||
231 | * history is totally broken if the timer is triggered. | ||
232 | * So reset the correction factor. | ||
233 | */ | ||
234 | if (per_cpu(hrtimer_status, cpu) == MENU_HRTIMER_GENERAL) | ||
235 | data->correction_factor[data->bucket] = RESOLUTION * DECAY; | ||
236 | |||
237 | per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_STOP; | ||
238 | |||
239 | return HRTIMER_NORESTART; | ||
240 | } | ||
241 | |||
242 | /* | 194 | /* |
243 | * Try detecting repeating patterns by keeping track of the last 8 | 195 | * Try detecting repeating patterns by keeping track of the last 8 |
244 | * intervals, and checking if the standard deviation of that set | 196 | * intervals, and checking if the standard deviation of that set |
245 | * of points is below a threshold. If it is... then use the | 197 | * of points is below a threshold. If it is... then use the |
246 | * average of these 8 points as the estimated value. | 198 | * average of these 8 points as the estimated value. |
247 | */ | 199 | */ |
248 | static u32 get_typical_interval(struct menu_device *data) | 200 | static void get_typical_interval(struct menu_device *data) |
249 | { | 201 | { |
250 | int i = 0, divisor = 0; | 202 | int i = 0, divisor = 0; |
251 | uint64_t max = 0, avg = 0, stddev = 0; | 203 | uint64_t max = 0, avg = 0, stddev = 0; |
252 | int64_t thresh = LLONG_MAX; /* Discard outliers above this value. */ | 204 | int64_t thresh = LLONG_MAX; /* Discard outliers above this value. */ |
253 | unsigned int ret = 0; | ||
254 | 205 | ||
255 | again: | 206 | again: |
256 | 207 | ||
@@ -291,16 +242,13 @@ again: | |||
291 | if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) | 242 | if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) |
292 | || stddev <= 20) { | 243 | || stddev <= 20) { |
293 | data->predicted_us = avg; | 244 | data->predicted_us = avg; |
294 | ret = 1; | 245 | return; |
295 | return ret; | ||
296 | 246 | ||
297 | } else if ((divisor * 4) > INTERVALS * 3) { | 247 | } else if ((divisor * 4) > INTERVALS * 3) { |
298 | /* Exclude the max interval */ | 248 | /* Exclude the max interval */ |
299 | thresh = max - 1; | 249 | thresh = max - 1; |
300 | goto again; | 250 | goto again; |
301 | } | 251 | } |
302 | |||
303 | return ret; | ||
304 | } | 252 | } |
305 | 253 | ||
306 | /** | 254 | /** |
@@ -315,9 +263,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
315 | int i; | 263 | int i; |
316 | int multiplier; | 264 | int multiplier; |
317 | struct timespec t; | 265 | struct timespec t; |
318 | int repeat = 0, low_predicted = 0; | ||
319 | int cpu = smp_processor_id(); | ||
320 | struct hrtimer *hrtmr = &per_cpu(menu_hrtimer, cpu); | ||
321 | 266 | ||
322 | if (data->needs_update) { | 267 | if (data->needs_update) { |
323 | menu_update(drv, dev); | 268 | menu_update(drv, dev); |
@@ -352,7 +297,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
352 | data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket], | 297 | data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket], |
353 | RESOLUTION * DECAY); | 298 | RESOLUTION * DECAY); |
354 | 299 | ||
355 | repeat = get_typical_interval(data); | 300 | get_typical_interval(data); |
356 | 301 | ||
357 | /* | 302 | /* |
358 | * We want to default to C1 (hlt), not to busy polling | 303 | * We want to default to C1 (hlt), not to busy polling |
@@ -373,10 +318,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
373 | 318 | ||
374 | if (s->disabled || su->disable) | 319 | if (s->disabled || su->disable) |
375 | continue; | 320 | continue; |
376 | if (s->target_residency > data->predicted_us) { | 321 | if (s->target_residency > data->predicted_us) |
377 | low_predicted = 1; | ||
378 | continue; | 322 | continue; |
379 | } | ||
380 | if (s->exit_latency > latency_req) | 323 | if (s->exit_latency > latency_req) |
381 | continue; | 324 | continue; |
382 | if (s->exit_latency * multiplier > data->predicted_us) | 325 | if (s->exit_latency * multiplier > data->predicted_us) |
@@ -386,44 +329,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
386 | data->exit_us = s->exit_latency; | 329 | data->exit_us = s->exit_latency; |
387 | } | 330 | } |
388 | 331 | ||
389 | /* not deepest C-state chosen for low predicted residency */ | ||
390 | if (low_predicted) { | ||
391 | unsigned int timer_us = 0; | ||
392 | unsigned int perfect_us = 0; | ||
393 | |||
394 | /* | ||
395 | * Set a timer to detect whether this sleep is much | ||
396 | * longer than repeat mode predicted. If the timer | ||
397 | * triggers, the code will evaluate whether to put | ||
398 | * the CPU into a deeper C-state. | ||
399 | * The timer is cancelled on CPU wakeup. | ||
400 | */ | ||
401 | timer_us = 2 * (data->predicted_us + MAX_DEVIATION); | ||
402 | |||
403 | perfect_us = perfect_cstate_ms * 1000; | ||
404 | |||
405 | if (repeat && (4 * timer_us < data->expected_us)) { | ||
406 | RCU_NONIDLE(hrtimer_start(hrtmr, | ||
407 | ns_to_ktime(1000 * timer_us), | ||
408 | HRTIMER_MODE_REL_PINNED)); | ||
409 | /* In repeat case, menu hrtimer is started */ | ||
410 | per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_REPEAT; | ||
411 | } else if (perfect_us < data->expected_us) { | ||
412 | /* | ||
413 | * The next timer is long. This could be because | ||
414 | * we did not make a useful prediction. | ||
415 | * In that case, it makes sense to re-enter | ||
416 | * into a deeper C-state after some time. | ||
417 | */ | ||
418 | RCU_NONIDLE(hrtimer_start(hrtmr, | ||
419 | ns_to_ktime(1000 * timer_us), | ||
420 | HRTIMER_MODE_REL_PINNED)); | ||
421 | /* In general case, menu hrtimer is started */ | ||
422 | per_cpu(hrtimer_status, cpu) = MENU_HRTIMER_GENERAL; | ||
423 | } | ||
424 | |||
425 | } | ||
426 | |||
427 | return data->last_state_idx; | 332 | return data->last_state_idx; |
428 | } | 333 | } |
429 | 334 | ||
@@ -514,9 +419,6 @@ static int menu_enable_device(struct cpuidle_driver *drv, | |||
514 | struct cpuidle_device *dev) | 419 | struct cpuidle_device *dev) |
515 | { | 420 | { |
516 | struct menu_device *data = &per_cpu(menu_devices, dev->cpu); | 421 | struct menu_device *data = &per_cpu(menu_devices, dev->cpu); |
517 | struct hrtimer *t = &per_cpu(menu_hrtimer, dev->cpu); | ||
518 | hrtimer_init(t, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
519 | t->function = menu_hrtimer_notify; | ||
520 | 422 | ||
521 | memset(data, 0, sizeof(struct menu_device)); | 423 | memset(data, 0, sizeof(struct menu_device)); |
522 | 424 | ||
diff --git a/drivers/dma/pch_dma.c b/drivers/dma/pch_dma.c index ce3dc3e9688c..0bbdea5059f3 100644 --- a/drivers/dma/pch_dma.c +++ b/drivers/dma/pch_dma.c | |||
@@ -867,6 +867,7 @@ static int pch_dma_probe(struct pci_dev *pdev, | |||
867 | 867 | ||
868 | if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { | 868 | if (!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { |
869 | dev_err(&pdev->dev, "Cannot find proper base address\n"); | 869 | dev_err(&pdev->dev, "Cannot find proper base address\n"); |
870 | err = -ENODEV; | ||
870 | goto err_disable_pdev; | 871 | goto err_disable_pdev; |
871 | } | 872 | } |
872 | 873 | ||
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 593827b3fdd4..fa645d825009 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -2505,6 +2505,10 @@ static dma_cookie_t pl330_tx_submit(struct dma_async_tx_descriptor *tx) | |||
2505 | /* Assign cookies to all nodes */ | 2505 | /* Assign cookies to all nodes */ |
2506 | while (!list_empty(&last->node)) { | 2506 | while (!list_empty(&last->node)) { |
2507 | desc = list_entry(last->node.next, struct dma_pl330_desc, node); | 2507 | desc = list_entry(last->node.next, struct dma_pl330_desc, node); |
2508 | if (pch->cyclic) { | ||
2509 | desc->txd.callback = last->txd.callback; | ||
2510 | desc->txd.callback_param = last->txd.callback_param; | ||
2511 | } | ||
2508 | 2512 | ||
2509 | dma_cookie_assign(&desc->txd); | 2513 | dma_cookie_assign(&desc->txd); |
2510 | 2514 | ||
@@ -2688,45 +2692,82 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( | |||
2688 | size_t period_len, enum dma_transfer_direction direction, | 2692 | size_t period_len, enum dma_transfer_direction direction, |
2689 | unsigned long flags, void *context) | 2693 | unsigned long flags, void *context) |
2690 | { | 2694 | { |
2691 | struct dma_pl330_desc *desc; | 2695 | struct dma_pl330_desc *desc = NULL, *first = NULL; |
2692 | struct dma_pl330_chan *pch = to_pchan(chan); | 2696 | struct dma_pl330_chan *pch = to_pchan(chan); |
2697 | struct dma_pl330_dmac *pdmac = pch->dmac; | ||
2698 | unsigned int i; | ||
2693 | dma_addr_t dst; | 2699 | dma_addr_t dst; |
2694 | dma_addr_t src; | 2700 | dma_addr_t src; |
2695 | 2701 | ||
2696 | desc = pl330_get_desc(pch); | 2702 | if (len % period_len != 0) |
2697 | if (!desc) { | ||
2698 | dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", | ||
2699 | __func__, __LINE__); | ||
2700 | return NULL; | 2703 | return NULL; |
2701 | } | ||
2702 | 2704 | ||
2703 | switch (direction) { | 2705 | if (!is_slave_direction(direction)) { |
2704 | case DMA_MEM_TO_DEV: | ||
2705 | desc->rqcfg.src_inc = 1; | ||
2706 | desc->rqcfg.dst_inc = 0; | ||
2707 | desc->req.rqtype = MEMTODEV; | ||
2708 | src = dma_addr; | ||
2709 | dst = pch->fifo_addr; | ||
2710 | break; | ||
2711 | case DMA_DEV_TO_MEM: | ||
2712 | desc->rqcfg.src_inc = 0; | ||
2713 | desc->rqcfg.dst_inc = 1; | ||
2714 | desc->req.rqtype = DEVTOMEM; | ||
2715 | src = pch->fifo_addr; | ||
2716 | dst = dma_addr; | ||
2717 | break; | ||
2718 | default: | ||
2719 | dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n", | 2706 | dev_err(pch->dmac->pif.dev, "%s:%d Invalid dma direction\n", |
2720 | __func__, __LINE__); | 2707 | __func__, __LINE__); |
2721 | return NULL; | 2708 | return NULL; |
2722 | } | 2709 | } |
2723 | 2710 | ||
2724 | desc->rqcfg.brst_size = pch->burst_sz; | 2711 | for (i = 0; i < len / period_len; i++) { |
2725 | desc->rqcfg.brst_len = 1; | 2712 | desc = pl330_get_desc(pch); |
2713 | if (!desc) { | ||
2714 | dev_err(pch->dmac->pif.dev, "%s:%d Unable to fetch desc\n", | ||
2715 | __func__, __LINE__); | ||
2726 | 2716 | ||
2727 | pch->cyclic = true; | 2717 | if (!first) |
2718 | return NULL; | ||
2719 | |||
2720 | spin_lock_irqsave(&pdmac->pool_lock, flags); | ||
2721 | |||
2722 | while (!list_empty(&first->node)) { | ||
2723 | desc = list_entry(first->node.next, | ||
2724 | struct dma_pl330_desc, node); | ||
2725 | list_move_tail(&desc->node, &pdmac->desc_pool); | ||
2726 | } | ||
2727 | |||
2728 | list_move_tail(&first->node, &pdmac->desc_pool); | ||
2728 | 2729 | ||
2729 | fill_px(&desc->px, dst, src, period_len); | 2730 | spin_unlock_irqrestore(&pdmac->pool_lock, flags); |
2731 | |||
2732 | return NULL; | ||
2733 | } | ||
2734 | |||
2735 | switch (direction) { | ||
2736 | case DMA_MEM_TO_DEV: | ||
2737 | desc->rqcfg.src_inc = 1; | ||
2738 | desc->rqcfg.dst_inc = 0; | ||
2739 | desc->req.rqtype = MEMTODEV; | ||
2740 | src = dma_addr; | ||
2741 | dst = pch->fifo_addr; | ||
2742 | break; | ||
2743 | case DMA_DEV_TO_MEM: | ||
2744 | desc->rqcfg.src_inc = 0; | ||
2745 | desc->rqcfg.dst_inc = 1; | ||
2746 | desc->req.rqtype = DEVTOMEM; | ||
2747 | src = pch->fifo_addr; | ||
2748 | dst = dma_addr; | ||
2749 | break; | ||
2750 | default: | ||
2751 | break; | ||
2752 | } | ||
2753 | |||
2754 | desc->rqcfg.brst_size = pch->burst_sz; | ||
2755 | desc->rqcfg.brst_len = 1; | ||
2756 | fill_px(&desc->px, dst, src, period_len); | ||
2757 | |||
2758 | if (!first) | ||
2759 | first = desc; | ||
2760 | else | ||
2761 | list_add_tail(&desc->node, &first->node); | ||
2762 | |||
2763 | dma_addr += period_len; | ||
2764 | } | ||
2765 | |||
2766 | if (!desc) | ||
2767 | return NULL; | ||
2768 | |||
2769 | pch->cyclic = true; | ||
2770 | desc->txd.flags = flags; | ||
2730 | 2771 | ||
2731 | return &desc->txd; | 2772 | return &desc->txd; |
2732 | } | 2773 | } |
diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c index b67f45f5c271..5039fbc88254 100644 --- a/drivers/dma/sh/shdma.c +++ b/drivers/dma/sh/shdma.c | |||
@@ -400,8 +400,8 @@ static size_t sh_dmae_get_partial(struct shdma_chan *schan, | |||
400 | shdma_chan); | 400 | shdma_chan); |
401 | struct sh_dmae_desc *sh_desc = container_of(sdesc, | 401 | struct sh_dmae_desc *sh_desc = container_of(sdesc, |
402 | struct sh_dmae_desc, shdma_desc); | 402 | struct sh_dmae_desc, shdma_desc); |
403 | return (sh_desc->hw.tcr - sh_dmae_readl(sh_chan, TCR)) << | 403 | return sh_desc->hw.tcr - |
404 | sh_chan->xmit_shift; | 404 | (sh_dmae_readl(sh_chan, TCR) << sh_chan->xmit_shift); |
405 | } | 405 | } |
406 | 406 | ||
407 | /* Called from error IRQ or NMI */ | 407 | /* Called from error IRQ or NMI */ |
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 7ef316fdc4d9..ac1b43a04285 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #define FW_CDEV_KERNEL_VERSION 5 | 54 | #define FW_CDEV_KERNEL_VERSION 5 |
55 | #define FW_CDEV_VERSION_EVENT_REQUEST2 4 | 55 | #define FW_CDEV_VERSION_EVENT_REQUEST2 4 |
56 | #define FW_CDEV_VERSION_ALLOCATE_REGION_END 4 | 56 | #define FW_CDEV_VERSION_ALLOCATE_REGION_END 4 |
57 | #define FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW 5 | ||
57 | 58 | ||
58 | struct client { | 59 | struct client { |
59 | u32 version; | 60 | u32 version; |
@@ -1005,6 +1006,8 @@ static int ioctl_create_iso_context(struct client *client, union ioctl_arg *arg) | |||
1005 | a->channel, a->speed, a->header_size, cb, client); | 1006 | a->channel, a->speed, a->header_size, cb, client); |
1006 | if (IS_ERR(context)) | 1007 | if (IS_ERR(context)) |
1007 | return PTR_ERR(context); | 1008 | return PTR_ERR(context); |
1009 | if (client->version < FW_CDEV_VERSION_AUTO_FLUSH_ISO_OVERFLOW) | ||
1010 | context->drop_overflow_headers = true; | ||
1008 | 1011 | ||
1009 | /* We only support one context at this time. */ | 1012 | /* We only support one context at this time. */ |
1010 | spin_lock_irq(&client->lock); | 1013 | spin_lock_irq(&client->lock); |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index 9e1db6490b9a..afb701ec90ca 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -2749,8 +2749,11 @@ static void copy_iso_headers(struct iso_context *ctx, const u32 *dma_hdr) | |||
2749 | { | 2749 | { |
2750 | u32 *ctx_hdr; | 2750 | u32 *ctx_hdr; |
2751 | 2751 | ||
2752 | if (ctx->header_length + ctx->base.header_size > PAGE_SIZE) | 2752 | if (ctx->header_length + ctx->base.header_size > PAGE_SIZE) { |
2753 | if (ctx->base.drop_overflow_headers) | ||
2754 | return; | ||
2753 | flush_iso_completions(ctx); | 2755 | flush_iso_completions(ctx); |
2756 | } | ||
2754 | 2757 | ||
2755 | ctx_hdr = ctx->header + ctx->header_length; | 2758 | ctx_hdr = ctx->header + ctx->header_length; |
2756 | ctx->last_timestamp = (u16)le32_to_cpu((__force __le32)dma_hdr[0]); | 2759 | ctx->last_timestamp = (u16)le32_to_cpu((__force __le32)dma_hdr[0]); |
@@ -2910,8 +2913,11 @@ static int handle_it_packet(struct context *context, | |||
2910 | 2913 | ||
2911 | sync_it_packet_for_cpu(context, d); | 2914 | sync_it_packet_for_cpu(context, d); |
2912 | 2915 | ||
2913 | if (ctx->header_length + 4 > PAGE_SIZE) | 2916 | if (ctx->header_length + 4 > PAGE_SIZE) { |
2917 | if (ctx->base.drop_overflow_headers) | ||
2918 | return 1; | ||
2914 | flush_iso_completions(ctx); | 2919 | flush_iso_completions(ctx); |
2920 | } | ||
2915 | 2921 | ||
2916 | ctx_hdr = ctx->header + ctx->header_length; | 2922 | ctx_hdr = ctx->header + ctx->header_length; |
2917 | ctx->last_timestamp = le16_to_cpu(last->res_count); | 2923 | ctx->last_timestamp = le16_to_cpu(last->res_count); |
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index eb760a218da4..232fa8fce26a 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -419,6 +419,13 @@ static void __init dmi_format_ids(char *buf, size_t len) | |||
419 | dmi_get_system_info(DMI_BIOS_DATE)); | 419 | dmi_get_system_info(DMI_BIOS_DATE)); |
420 | } | 420 | } |
421 | 421 | ||
422 | /* | ||
423 | * Check for DMI/SMBIOS headers in the system firmware image. Any | ||
424 | * SMBIOS header must start 16 bytes before the DMI header, so take a | ||
425 | * 32 byte buffer and check for DMI at offset 16 and SMBIOS at offset | ||
426 | * 0. If the DMI header is present, set dmi_ver accordingly (SMBIOS | ||
427 | * takes precedence) and return 0. Otherwise return 1. | ||
428 | */ | ||
422 | static int __init dmi_present(const u8 *buf) | 429 | static int __init dmi_present(const u8 *buf) |
423 | { | 430 | { |
424 | int smbios_ver; | 431 | int smbios_ver; |
@@ -506,6 +513,13 @@ void __init dmi_scan_machine(void) | |||
506 | if (p == NULL) | 513 | if (p == NULL) |
507 | goto error; | 514 | goto error; |
508 | 515 | ||
516 | /* | ||
517 | * Iterate over all possible DMI header addresses q. | ||
518 | * Maintain the 32 bytes around q in buf. On the | ||
519 | * first iteration, substitute zero for the | ||
520 | * out-of-range bytes so there is no chance of falsely | ||
521 | * detecting an SMBIOS header. | ||
522 | */ | ||
509 | memset(buf, 0, 16); | 523 | memset(buf, 0, 16); |
510 | for (q = p; q < p + 0x10000; q += 16) { | 524 | for (q = p; q < p + 0x10000; q += 16) { |
511 | memcpy_fromio(buf + 16, q, 16); | 525 | memcpy_fromio(buf + 16, q, 16); |
diff --git a/drivers/gpio/gpio-msm-v1.c b/drivers/gpio/gpio-msm-v1.c index e3ceaacde45c..73b73969d361 100644 --- a/drivers/gpio/gpio-msm-v1.c +++ b/drivers/gpio/gpio-msm-v1.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/device.h> | 22 | #include <linux/device.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/err.h> | ||
24 | 25 | ||
25 | #include <mach/msm_gpiomux.h> | 26 | #include <mach/msm_gpiomux.h> |
26 | 27 | ||
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c57244ef428b..dfeb3a3a8f20 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -1037,18 +1037,6 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start, | |||
1037 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); | 1037 | IRQ_NOREQUEST | IRQ_NOPROBE, 0); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | #if defined(CONFIG_OF_GPIO) | ||
1041 | static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip) | ||
1042 | { | ||
1043 | return chip->of_node != NULL; | ||
1044 | } | ||
1045 | #else | ||
1046 | static inline bool omap_gpio_chip_boot_dt(struct gpio_chip *chip) | ||
1047 | { | ||
1048 | return false; | ||
1049 | } | ||
1050 | #endif | ||
1051 | |||
1052 | static void omap_gpio_chip_init(struct gpio_bank *bank) | 1040 | static void omap_gpio_chip_init(struct gpio_bank *bank) |
1053 | { | 1041 | { |
1054 | int j; | 1042 | int j; |
@@ -1080,68 +1068,24 @@ static void omap_gpio_chip_init(struct gpio_bank *bank) | |||
1080 | 1068 | ||
1081 | gpiochip_add(&bank->chip); | 1069 | gpiochip_add(&bank->chip); |
1082 | 1070 | ||
1083 | /* | 1071 | for (j = 0; j < bank->width; j++) { |
1084 | * REVISIT these explicit calls to irq_create_mapping() | 1072 | int irq = irq_create_mapping(bank->domain, j); |
1085 | * to do the GPIO to IRQ domain mapping for each GPIO in | 1073 | irq_set_lockdep_class(irq, &gpio_lock_class); |
1086 | * the bank can be removed once all OMAP platforms have | 1074 | irq_set_chip_data(irq, bank); |
1087 | * been migrated to Device Tree boot only. | 1075 | if (bank->is_mpuio) { |
1088 | * Since in DT boot irq_create_mapping() is called from | 1076 | omap_mpuio_alloc_gc(bank, irq, bank->width); |
1089 | * irq_create_of_mapping() only for the GPIO lines that | 1077 | } else { |
1090 | * are used as interrupts. | 1078 | irq_set_chip_and_handler(irq, &gpio_irq_chip, |
1091 | */ | 1079 | handle_simple_irq); |
1092 | if (!omap_gpio_chip_boot_dt(&bank->chip)) | 1080 | set_irq_flags(irq, IRQF_VALID); |
1093 | for (j = 0; j < bank->width; j++) | 1081 | } |
1094 | irq_create_mapping(bank->domain, j); | 1082 | } |
1095 | irq_set_chained_handler(bank->irq, gpio_irq_handler); | 1083 | irq_set_chained_handler(bank->irq, gpio_irq_handler); |
1096 | irq_set_handler_data(bank->irq, bank); | 1084 | irq_set_handler_data(bank->irq, bank); |
1097 | } | 1085 | } |
1098 | 1086 | ||
1099 | static const struct of_device_id omap_gpio_match[]; | 1087 | static const struct of_device_id omap_gpio_match[]; |
1100 | 1088 | ||
1101 | static int omap_gpio_irq_map(struct irq_domain *d, unsigned int virq, | ||
1102 | irq_hw_number_t hwirq) | ||
1103 | { | ||
1104 | struct gpio_bank *bank = d->host_data; | ||
1105 | int gpio; | ||
1106 | int ret; | ||
1107 | |||
1108 | if (!bank) | ||
1109 | return -EINVAL; | ||
1110 | |||
1111 | irq_set_lockdep_class(virq, &gpio_lock_class); | ||
1112 | irq_set_chip_data(virq, bank); | ||
1113 | if (bank->is_mpuio) { | ||
1114 | omap_mpuio_alloc_gc(bank, virq, bank->width); | ||
1115 | } else { | ||
1116 | irq_set_chip_and_handler(virq, &gpio_irq_chip, | ||
1117 | handle_simple_irq); | ||
1118 | set_irq_flags(virq, IRQF_VALID); | ||
1119 | } | ||
1120 | |||
1121 | /* | ||
1122 | * REVISIT most GPIO IRQ chip drivers need to call | ||
1123 | * gpio_request() before a GPIO line can be used as an | ||
1124 | * IRQ. Ideally this should be handled by the IRQ core | ||
1125 | * but until then this has to be done on a per driver | ||
1126 | * basis. Remove this once this is managed by the core. | ||
1127 | */ | ||
1128 | if (omap_gpio_chip_boot_dt(&bank->chip)) { | ||
1129 | gpio = irq_to_gpio(bank, hwirq); | ||
1130 | ret = gpio_request_one(gpio, GPIOF_IN, NULL); | ||
1131 | if (ret) { | ||
1132 | dev_err(bank->dev, "Could not request GPIO%d\n", gpio); | ||
1133 | return ret; | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | return 0; | ||
1138 | } | ||
1139 | |||
1140 | static struct irq_domain_ops omap_gpio_irq_ops = { | ||
1141 | .xlate = irq_domain_xlate_onetwocell, | ||
1142 | .map = omap_gpio_irq_map, | ||
1143 | }; | ||
1144 | |||
1145 | static int omap_gpio_probe(struct platform_device *pdev) | 1089 | static int omap_gpio_probe(struct platform_device *pdev) |
1146 | { | 1090 | { |
1147 | struct device *dev = &pdev->dev; | 1091 | struct device *dev = &pdev->dev; |
@@ -1207,10 +1151,10 @@ static int omap_gpio_probe(struct platform_device *pdev) | |||
1207 | } | 1151 | } |
1208 | 1152 | ||
1209 | bank->domain = irq_domain_add_legacy(node, bank->width, irq_base, | 1153 | bank->domain = irq_domain_add_legacy(node, bank->width, irq_base, |
1210 | 0, &omap_gpio_irq_ops, bank); | 1154 | 0, &irq_domain_simple_ops, NULL); |
1211 | #else | 1155 | #else |
1212 | bank->domain = irq_domain_add_linear(node, bank->width, | 1156 | bank->domain = irq_domain_add_linear(node, bank->width, |
1213 | &omap_gpio_irq_ops, bank); | 1157 | &irq_domain_simple_ops, NULL); |
1214 | #endif | 1158 | #endif |
1215 | if (!bank->domain) { | 1159 | if (!bank->domain) { |
1216 | dev_err(dev, "Couldn't register an IRQ domain\n"); | 1160 | dev_err(dev, "Couldn't register an IRQ domain\n"); |
diff --git a/drivers/gpu/drm/ast/ast_ttm.c b/drivers/gpu/drm/ast/ast_ttm.c index 98d670825a1a..6e8887fe6c1b 100644 --- a/drivers/gpu/drm/ast/ast_ttm.c +++ b/drivers/gpu/drm/ast/ast_ttm.c | |||
@@ -323,6 +323,7 @@ int ast_bo_create(struct drm_device *dev, int size, int align, | |||
323 | 323 | ||
324 | astbo->gem.driver_private = NULL; | 324 | astbo->gem.driver_private = NULL; |
325 | astbo->bo.bdev = &ast->ttm.bdev; | 325 | astbo->bo.bdev = &ast->ttm.bdev; |
326 | astbo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
326 | 327 | ||
327 | ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 328 | ast_ttm_placement(astbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
328 | 329 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_ttm.c b/drivers/gpu/drm/cirrus/cirrus_ttm.c index 0047012045c2..69fd8f1ac8df 100644 --- a/drivers/gpu/drm/cirrus/cirrus_ttm.c +++ b/drivers/gpu/drm/cirrus/cirrus_ttm.c | |||
@@ -328,6 +328,7 @@ int cirrus_bo_create(struct drm_device *dev, int size, int align, | |||
328 | 328 | ||
329 | cirrusbo->gem.driver_private = NULL; | 329 | cirrusbo->gem.driver_private = NULL; |
330 | cirrusbo->bo.bdev = &cirrus->ttm.bdev; | 330 | cirrusbo->bo.bdev = &cirrus->ttm.bdev; |
331 | cirrusbo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
331 | 332 | ||
332 | cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 333 | cirrus_ttm_placement(cirrusbo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
333 | 334 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 8bcce7866d36..f92da0a32f0d 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -708,7 +708,10 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, | |||
708 | /* Subtract time delta from raw timestamp to get final | 708 | /* Subtract time delta from raw timestamp to get final |
709 | * vblank_time timestamp for end of vblank. | 709 | * vblank_time timestamp for end of vblank. |
710 | */ | 710 | */ |
711 | etime = ktime_sub_ns(etime, delta_ns); | 711 | if (delta_ns < 0) |
712 | etime = ktime_add_ns(etime, -delta_ns); | ||
713 | else | ||
714 | etime = ktime_sub_ns(etime, delta_ns); | ||
712 | *vblank_time = ktime_to_timeval(etime); | 715 | *vblank_time = ktime_to_timeval(etime); |
713 | 716 | ||
714 | DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", | 717 | DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %ld.%ld -> %ld.%ld [e %d us, %d rep]\n", |
diff --git a/drivers/gpu/drm/exynos/exynos_ddc.c b/drivers/gpu/drm/exynos/exynos_ddc.c index 95c75edef01a..30ef41bcd7b8 100644 --- a/drivers/gpu/drm/exynos/exynos_ddc.c +++ b/drivers/gpu/drm/exynos/exynos_ddc.c | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
18 | #include <linux/module.h> | ||
19 | 18 | ||
20 | 19 | ||
21 | #include "exynos_drm_drv.h" | 20 | #include "exynos_drm_drv.h" |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index 61b094f689a7..6e047bd53e2f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
17 | #include <linux/mfd/syscon.h> | 16 | #include <linux/mfd/syscon.h> |
18 | #include <linux/regmap.h> | 17 | #include <linux/regmap.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 3e106beca5b6..1c263dac3c1c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <drm/drmP.h> | 14 | #include <drm/drmP.h> |
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | ||
18 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
19 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
20 | #include <linux/of_device.h> | 19 | #include <linux/of_device.h> |
@@ -130,7 +129,6 @@ static const struct of_device_id fimd_driver_dt_match[] = { | |||
130 | .data = &exynos5_fimd_driver_data }, | 129 | .data = &exynos5_fimd_driver_data }, |
131 | {}, | 130 | {}, |
132 | }; | 131 | }; |
133 | MODULE_DEVICE_TABLE(of, fimd_driver_dt_match); | ||
134 | #endif | 132 | #endif |
135 | 133 | ||
136 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( | 134 | static inline struct fimd_driver_data *drm_fimd_get_driver_data( |
@@ -1082,7 +1080,6 @@ static struct platform_device_id fimd_driver_ids[] = { | |||
1082 | }, | 1080 | }, |
1083 | {}, | 1081 | {}, |
1084 | }; | 1082 | }; |
1085 | MODULE_DEVICE_TABLE(platform, fimd_driver_ids); | ||
1086 | 1083 | ||
1087 | static const struct dev_pm_ops fimd_pm_ops = { | 1084 | static const struct dev_pm_ops fimd_pm_ops = { |
1088 | SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) | 1085 | SET_SYSTEM_SLEEP_PM_OPS(fimd_suspend, fimd_resume) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 42a5a5466075..eddea4941483 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -8,7 +8,6 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/module.h> | ||
12 | #include <linux/clk.h> | 11 | #include <linux/clk.h> |
13 | #include <linux/err.h> | 12 | #include <linux/err.h> |
14 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
@@ -806,9 +805,20 @@ static void g2d_dma_start(struct g2d_data *g2d, | |||
806 | struct g2d_cmdlist_node *node = | 805 | struct g2d_cmdlist_node *node = |
807 | list_first_entry(&runqueue_node->run_cmdlist, | 806 | list_first_entry(&runqueue_node->run_cmdlist, |
808 | struct g2d_cmdlist_node, list); | 807 | struct g2d_cmdlist_node, list); |
808 | int ret; | ||
809 | |||
810 | ret = pm_runtime_get_sync(g2d->dev); | ||
811 | if (ret < 0) { | ||
812 | dev_warn(g2d->dev, "failed pm power on.\n"); | ||
813 | return; | ||
814 | } | ||
809 | 815 | ||
810 | pm_runtime_get_sync(g2d->dev); | 816 | ret = clk_prepare_enable(g2d->gate_clk); |
811 | clk_enable(g2d->gate_clk); | 817 | if (ret < 0) { |
818 | dev_warn(g2d->dev, "failed to enable clock.\n"); | ||
819 | pm_runtime_put_sync(g2d->dev); | ||
820 | return; | ||
821 | } | ||
812 | 822 | ||
813 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); | 823 | writel_relaxed(node->dma_addr, g2d->regs + G2D_DMA_SFR_BASE_ADDR); |
814 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); | 824 | writel_relaxed(G2D_DMA_START, g2d->regs + G2D_DMA_COMMAND); |
@@ -861,7 +871,7 @@ static void g2d_runqueue_worker(struct work_struct *work) | |||
861 | runqueue_work); | 871 | runqueue_work); |
862 | 872 | ||
863 | mutex_lock(&g2d->runqueue_mutex); | 873 | mutex_lock(&g2d->runqueue_mutex); |
864 | clk_disable(g2d->gate_clk); | 874 | clk_disable_unprepare(g2d->gate_clk); |
865 | pm_runtime_put_sync(g2d->dev); | 875 | pm_runtime_put_sync(g2d->dev); |
866 | 876 | ||
867 | complete(&g2d->runqueue_node->complete); | 877 | complete(&g2d->runqueue_node->complete); |
@@ -1521,7 +1531,6 @@ static const struct of_device_id exynos_g2d_match[] = { | |||
1521 | { .compatible = "samsung,exynos5250-g2d" }, | 1531 | { .compatible = "samsung,exynos5250-g2d" }, |
1522 | {}, | 1532 | {}, |
1523 | }; | 1533 | }; |
1524 | MODULE_DEVICE_TABLE(of, exynos_g2d_match); | ||
1525 | #endif | 1534 | #endif |
1526 | 1535 | ||
1527 | struct platform_driver g2d_driver = { | 1536 | struct platform_driver g2d_driver = { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gsc.c b/drivers/gpu/drm/exynos/exynos_drm_gsc.c index 472e3b25e7f2..90b8a1a5344c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gsc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gsc.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
17 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
18 | #include <linux/pm_runtime.h> | 17 | #include <linux/pm_runtime.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index aaa550d622f0..8d3bc01d6834 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/wait.h> | 17 | #include <linux/wait.h> |
18 | #include <linux/module.h> | ||
19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
20 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
21 | 20 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index b1ef8e7ff9c9..d2b6ab4def93 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
17 | #include <linux/types.h> | 16 | #include <linux/types.h> |
18 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
@@ -342,10 +341,10 @@ int exynos_drm_ipp_get_property(struct drm_device *drm_dev, void *data, | |||
342 | */ | 341 | */ |
343 | ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, | 342 | ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, |
344 | prop_list->ipp_id); | 343 | prop_list->ipp_id); |
345 | if (!ippdrv) { | 344 | if (IS_ERR(ippdrv)) { |
346 | DRM_ERROR("not found ipp%d driver.\n", | 345 | DRM_ERROR("not found ipp%d driver.\n", |
347 | prop_list->ipp_id); | 346 | prop_list->ipp_id); |
348 | return -EINVAL; | 347 | return PTR_ERR(ippdrv); |
349 | } | 348 | } |
350 | 349 | ||
351 | prop_list = ippdrv->prop_list; | 350 | prop_list = ippdrv->prop_list; |
@@ -970,9 +969,9 @@ int exynos_drm_ipp_queue_buf(struct drm_device *drm_dev, void *data, | |||
970 | /* find command node */ | 969 | /* find command node */ |
971 | c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, | 970 | c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, |
972 | qbuf->prop_id); | 971 | qbuf->prop_id); |
973 | if (!c_node) { | 972 | if (IS_ERR(c_node)) { |
974 | DRM_ERROR("failed to get command node.\n"); | 973 | DRM_ERROR("failed to get command node.\n"); |
975 | return -EFAULT; | 974 | return PTR_ERR(c_node); |
976 | } | 975 | } |
977 | 976 | ||
978 | /* buffer control */ | 977 | /* buffer control */ |
@@ -1106,9 +1105,9 @@ int exynos_drm_ipp_cmd_ctrl(struct drm_device *drm_dev, void *data, | |||
1106 | 1105 | ||
1107 | c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, | 1106 | c_node = ipp_find_obj(&ctx->prop_idr, &ctx->prop_lock, |
1108 | cmd_ctrl->prop_id); | 1107 | cmd_ctrl->prop_id); |
1109 | if (!c_node) { | 1108 | if (IS_ERR(c_node)) { |
1110 | DRM_ERROR("invalid command node list.\n"); | 1109 | DRM_ERROR("invalid command node list.\n"); |
1111 | return -EINVAL; | 1110 | return PTR_ERR(c_node); |
1112 | } | 1111 | } |
1113 | 1112 | ||
1114 | if (!exynos_drm_ipp_check_valid(ippdrv->dev, cmd_ctrl->ctrl, | 1113 | if (!exynos_drm_ipp_check_valid(ippdrv->dev, cmd_ctrl->ctrl, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_rotator.c b/drivers/gpu/drm/exynos/exynos_drm_rotator.c index 427640aa5148..49669aa24c45 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_rotator.c +++ b/drivers/gpu/drm/exynos/exynos_drm_rotator.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | ||
14 | #include <linux/err.h> | 13 | #include <linux/err.h> |
15 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
16 | #include <linux/io.h> | 15 | #include <linux/io.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 41cc74d83e4e..c57c56519add 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <drm/drmP.h> | 13 | #include <drm/drmP.h> |
14 | 14 | ||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/module.h> | ||
17 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
18 | 17 | ||
19 | #include <drm/exynos_drm.h> | 18 | #include <drm/exynos_drm.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 62ef5971ac3c..2f5c6942c968 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
25 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/module.h> | ||
28 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
29 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
30 | #include <linux/irq.h> | 29 | #include <linux/irq.h> |
diff --git a/drivers/gpu/drm/exynos/exynos_hdmiphy.c b/drivers/gpu/drm/exynos/exynos_hdmiphy.c index ef04255076c7..6e320ae9afed 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmiphy.c +++ b/drivers/gpu/drm/exynos/exynos_hdmiphy.c | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
18 | #include <linux/module.h> | ||
19 | 18 | ||
20 | #include "exynos_drm_drv.h" | 19 | #include "exynos_drm_drv.h" |
21 | #include "exynos_hdmi.h" | 20 | #include "exynos_hdmi.h" |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 42ffb71c63bc..c9a137caea41 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
24 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/module.h> | ||
27 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
28 | #include <linux/interrupt.h> | 27 | #include <linux/interrupt.h> |
29 | #include <linux/irq.h> | 28 | #include <linux/irq.h> |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 66c63808fa35..f4669802a0fb 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1594,6 +1594,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1594 | intel_detect_pch(dev); | 1594 | intel_detect_pch(dev); |
1595 | 1595 | ||
1596 | intel_irq_init(dev); | 1596 | intel_irq_init(dev); |
1597 | intel_pm_init(dev); | ||
1597 | intel_gt_sanitize(dev); | 1598 | intel_gt_sanitize(dev); |
1598 | intel_gt_init(dev); | 1599 | intel_gt_init(dev); |
1599 | 1600 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index d2ee3343c943..1929bffc1c77 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1582,6 +1582,7 @@ void i915_hangcheck_elapsed(unsigned long data); | |||
1582 | void i915_handle_error(struct drm_device *dev, bool wedged); | 1582 | void i915_handle_error(struct drm_device *dev, bool wedged); |
1583 | 1583 | ||
1584 | extern void intel_irq_init(struct drm_device *dev); | 1584 | extern void intel_irq_init(struct drm_device *dev); |
1585 | extern void intel_pm_init(struct drm_device *dev); | ||
1585 | extern void intel_hpd_init(struct drm_device *dev); | 1586 | extern void intel_hpd_init(struct drm_device *dev); |
1586 | extern void intel_gt_init(struct drm_device *dev); | 1587 | extern void intel_gt_init(struct drm_device *dev); |
1587 | extern void intel_gt_sanitize(struct drm_device *dev); | 1588 | extern void intel_gt_sanitize(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index f2326fc60ac9..6f514297c483 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -1856,10 +1856,16 @@ | |||
1856 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) | 1856 | #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2) |
1857 | 1857 | ||
1858 | #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) | 1858 | #define PORT_HOTPLUG_STAT (dev_priv->info->display_mmio_offset + 0x61114) |
1859 | /* HDMI/DP bits are gen4+ */ | 1859 | /* |
1860 | #define PORTB_HOTPLUG_LIVE_STATUS (1 << 29) | 1860 | * HDMI/DP bits are gen4+ |
1861 | * | ||
1862 | * WARNING: Bspec for hpd status bits on gen4 seems to be completely confused. | ||
1863 | * Please check the detailed lore in the commit message for for experimental | ||
1864 | * evidence. | ||
1865 | */ | ||
1866 | #define PORTD_HOTPLUG_LIVE_STATUS (1 << 29) | ||
1861 | #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) | 1867 | #define PORTC_HOTPLUG_LIVE_STATUS (1 << 28) |
1862 | #define PORTD_HOTPLUG_LIVE_STATUS (1 << 27) | 1868 | #define PORTB_HOTPLUG_LIVE_STATUS (1 << 27) |
1863 | #define PORTD_HOTPLUG_INT_STATUS (3 << 21) | 1869 | #define PORTD_HOTPLUG_INT_STATUS (3 << 21) |
1864 | #define PORTC_HOTPLUG_INT_STATUS (3 << 19) | 1870 | #define PORTC_HOTPLUG_INT_STATUS (3 << 19) |
1865 | #define PORTB_HOTPLUG_INT_STATUS (3 << 17) | 1871 | #define PORTB_HOTPLUG_INT_STATUS (3 << 17) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5fb305840db8..e38b45786653 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -8269,9 +8269,11 @@ check_crtc_state(struct drm_device *dev) | |||
8269 | 8269 | ||
8270 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, | 8270 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, |
8271 | base.head) { | 8271 | base.head) { |
8272 | enum pipe pipe; | ||
8272 | if (encoder->base.crtc != &crtc->base) | 8273 | if (encoder->base.crtc != &crtc->base) |
8273 | continue; | 8274 | continue; |
8274 | if (encoder->get_config) | 8275 | if (encoder->get_config && |
8276 | encoder->get_hw_state(encoder, &pipe)) | ||
8275 | encoder->get_config(encoder, &pipe_config); | 8277 | encoder->get_config(encoder, &pipe_config); |
8276 | } | 8278 | } |
8277 | 8279 | ||
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 67e2c1f1c9a8..5950888ae1d0 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -497,8 +497,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level, u32 max) | |||
497 | goto out; | 497 | goto out; |
498 | } | 498 | } |
499 | 499 | ||
500 | /* scale to hardware */ | 500 | /* scale to hardware, but be careful to not overflow */ |
501 | level = level * freq / max; | 501 | if (freq < max) |
502 | level = level * freq / max; | ||
503 | else | ||
504 | level = freq / max * level; | ||
502 | 505 | ||
503 | dev_priv->backlight.level = level; | 506 | dev_priv->backlight.level = level; |
504 | if (dev_priv->backlight.device) | 507 | if (dev_priv->backlight.device) |
@@ -515,6 +518,17 @@ void intel_panel_disable_backlight(struct drm_device *dev) | |||
515 | struct drm_i915_private *dev_priv = dev->dev_private; | 518 | struct drm_i915_private *dev_priv = dev->dev_private; |
516 | unsigned long flags; | 519 | unsigned long flags; |
517 | 520 | ||
521 | /* | ||
522 | * Do not disable backlight on the vgaswitcheroo path. When switching | ||
523 | * away from i915, the other client may depend on i915 to handle the | ||
524 | * backlight. This will leave the backlight on unnecessarily when | ||
525 | * another client is not activated. | ||
526 | */ | ||
527 | if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) { | ||
528 | DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n"); | ||
529 | return; | ||
530 | } | ||
531 | |||
518 | spin_lock_irqsave(&dev_priv->backlight.lock, flags); | 532 | spin_lock_irqsave(&dev_priv->backlight.lock, flags); |
519 | 533 | ||
520 | dev_priv->backlight.enabled = false; | 534 | dev_priv->backlight.enabled = false; |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 51a2a60f5bfc..b0e4a0bd1313 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -5063,8 +5063,26 @@ static void __intel_set_power_well(struct drm_device *dev, bool enable) | |||
5063 | } | 5063 | } |
5064 | } else { | 5064 | } else { |
5065 | if (enable_requested) { | 5065 | if (enable_requested) { |
5066 | unsigned long irqflags; | ||
5067 | enum pipe p; | ||
5068 | |||
5066 | I915_WRITE(HSW_PWR_WELL_DRIVER, 0); | 5069 | I915_WRITE(HSW_PWR_WELL_DRIVER, 0); |
5070 | POSTING_READ(HSW_PWR_WELL_DRIVER); | ||
5067 | DRM_DEBUG_KMS("Requesting to disable the power well\n"); | 5071 | DRM_DEBUG_KMS("Requesting to disable the power well\n"); |
5072 | |||
5073 | /* | ||
5074 | * After this, the registers on the pipes that are part | ||
5075 | * of the power well will become zero, so we have to | ||
5076 | * adjust our counters according to that. | ||
5077 | * | ||
5078 | * FIXME: Should we do this in general in | ||
5079 | * drm_vblank_post_modeset? | ||
5080 | */ | ||
5081 | spin_lock_irqsave(&dev->vbl_lock, irqflags); | ||
5082 | for_each_pipe(p) | ||
5083 | if (p != PIPE_A) | ||
5084 | dev->last_vblank[p] = 0; | ||
5085 | spin_unlock_irqrestore(&dev->vbl_lock, irqflags); | ||
5068 | } | 5086 | } |
5069 | } | 5087 | } |
5070 | } | 5088 | } |
@@ -5536,6 +5554,12 @@ void intel_gt_init(struct drm_device *dev) | |||
5536 | dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; | 5554 | dev_priv->gt.force_wake_get = __gen6_gt_force_wake_get; |
5537 | dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put; | 5555 | dev_priv->gt.force_wake_put = __gen6_gt_force_wake_put; |
5538 | } | 5556 | } |
5557 | } | ||
5558 | |||
5559 | void intel_pm_init(struct drm_device *dev) | ||
5560 | { | ||
5561 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
5562 | |||
5539 | INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, | 5563 | INIT_DELAYED_WORK(&dev_priv->rps.delayed_resume_work, |
5540 | intel_gen6_powersave_work); | 5564 | intel_gen6_powersave_work); |
5541 | } | 5565 | } |
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 251784aa2225..503a414cbdad 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c | |||
@@ -29,6 +29,7 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc) | |||
29 | struct mga_crtc *mga_crtc = to_mga_crtc(crtc); | 29 | struct mga_crtc *mga_crtc = to_mga_crtc(crtc); |
30 | struct drm_device *dev = crtc->dev; | 30 | struct drm_device *dev = crtc->dev; |
31 | struct mga_device *mdev = dev->dev_private; | 31 | struct mga_device *mdev = dev->dev_private; |
32 | struct drm_framebuffer *fb = crtc->fb; | ||
32 | int i; | 33 | int i; |
33 | 34 | ||
34 | if (!crtc->enabled) | 35 | if (!crtc->enabled) |
@@ -36,6 +37,28 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc) | |||
36 | 37 | ||
37 | WREG8(DAC_INDEX + MGA1064_INDEX, 0); | 38 | WREG8(DAC_INDEX + MGA1064_INDEX, 0); |
38 | 39 | ||
40 | if (fb && fb->bits_per_pixel == 16) { | ||
41 | int inc = (fb->depth == 15) ? 8 : 4; | ||
42 | u8 r, b; | ||
43 | for (i = 0; i < MGAG200_LUT_SIZE; i += inc) { | ||
44 | if (fb->depth == 16) { | ||
45 | if (i > (MGAG200_LUT_SIZE >> 1)) { | ||
46 | r = b = 0; | ||
47 | } else { | ||
48 | r = mga_crtc->lut_r[i << 1]; | ||
49 | b = mga_crtc->lut_b[i << 1]; | ||
50 | } | ||
51 | } else { | ||
52 | r = mga_crtc->lut_r[i]; | ||
53 | b = mga_crtc->lut_b[i]; | ||
54 | } | ||
55 | /* VGA registers */ | ||
56 | WREG8(DAC_INDEX + MGA1064_COL_PAL, r); | ||
57 | WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_g[i]); | ||
58 | WREG8(DAC_INDEX + MGA1064_COL_PAL, b); | ||
59 | } | ||
60 | return; | ||
61 | } | ||
39 | for (i = 0; i < MGAG200_LUT_SIZE; i++) { | 62 | for (i = 0; i < MGAG200_LUT_SIZE; i++) { |
40 | /* VGA registers */ | 63 | /* VGA registers */ |
41 | WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_r[i]); | 64 | WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_r[i]); |
@@ -877,7 +900,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, | |||
877 | 900 | ||
878 | pitch = crtc->fb->pitches[0] / (crtc->fb->bits_per_pixel / 8); | 901 | pitch = crtc->fb->pitches[0] / (crtc->fb->bits_per_pixel / 8); |
879 | if (crtc->fb->bits_per_pixel == 24) | 902 | if (crtc->fb->bits_per_pixel == 24) |
880 | pitch = pitch >> (4 - bppshift); | 903 | pitch = (pitch * 3) >> (4 - bppshift); |
881 | else | 904 | else |
882 | pitch = pitch >> (4 - bppshift); | 905 | pitch = pitch >> (4 - bppshift); |
883 | 906 | ||
@@ -1251,6 +1274,24 @@ static void mga_crtc_destroy(struct drm_crtc *crtc) | |||
1251 | kfree(mga_crtc); | 1274 | kfree(mga_crtc); |
1252 | } | 1275 | } |
1253 | 1276 | ||
1277 | static void mga_crtc_disable(struct drm_crtc *crtc) | ||
1278 | { | ||
1279 | int ret; | ||
1280 | DRM_DEBUG_KMS("\n"); | ||
1281 | mga_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); | ||
1282 | if (crtc->fb) { | ||
1283 | struct mga_framebuffer *mga_fb = to_mga_framebuffer(crtc->fb); | ||
1284 | struct drm_gem_object *obj = mga_fb->obj; | ||
1285 | struct mgag200_bo *bo = gem_to_mga_bo(obj); | ||
1286 | ret = mgag200_bo_reserve(bo, false); | ||
1287 | if (ret) | ||
1288 | return; | ||
1289 | mgag200_bo_push_sysram(bo); | ||
1290 | mgag200_bo_unreserve(bo); | ||
1291 | } | ||
1292 | crtc->fb = NULL; | ||
1293 | } | ||
1294 | |||
1254 | /* These provide the minimum set of functions required to handle a CRTC */ | 1295 | /* These provide the minimum set of functions required to handle a CRTC */ |
1255 | static const struct drm_crtc_funcs mga_crtc_funcs = { | 1296 | static const struct drm_crtc_funcs mga_crtc_funcs = { |
1256 | .cursor_set = mga_crtc_cursor_set, | 1297 | .cursor_set = mga_crtc_cursor_set, |
@@ -1261,6 +1302,7 @@ static const struct drm_crtc_funcs mga_crtc_funcs = { | |||
1261 | }; | 1302 | }; |
1262 | 1303 | ||
1263 | static const struct drm_crtc_helper_funcs mga_helper_funcs = { | 1304 | static const struct drm_crtc_helper_funcs mga_helper_funcs = { |
1305 | .disable = mga_crtc_disable, | ||
1264 | .dpms = mga_crtc_dpms, | 1306 | .dpms = mga_crtc_dpms, |
1265 | .mode_fixup = mga_crtc_mode_fixup, | 1307 | .mode_fixup = mga_crtc_mode_fixup, |
1266 | .mode_set = mga_crtc_mode_set, | 1308 | .mode_set = mga_crtc_mode_set, |
@@ -1581,6 +1623,8 @@ static struct drm_connector *mga_vga_init(struct drm_device *dev) | |||
1581 | 1623 | ||
1582 | drm_connector_helper_add(connector, &mga_vga_connector_helper_funcs); | 1624 | drm_connector_helper_add(connector, &mga_vga_connector_helper_funcs); |
1583 | 1625 | ||
1626 | drm_sysfs_connector_add(connector); | ||
1627 | |||
1584 | mga_connector->i2c = mgag200_i2c_create(dev); | 1628 | mga_connector->i2c = mgag200_i2c_create(dev); |
1585 | if (!mga_connector->i2c) | 1629 | if (!mga_connector->i2c) |
1586 | DRM_ERROR("failed to add ddc bus\n"); | 1630 | DRM_ERROR("failed to add ddc bus\n"); |
diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index 3acb2b044c7b..d70e4a92773b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c | |||
@@ -323,6 +323,7 @@ int mgag200_bo_create(struct drm_device *dev, int size, int align, | |||
323 | 323 | ||
324 | mgabo->gem.driver_private = NULL; | 324 | mgabo->gem.driver_private = NULL; |
325 | mgabo->bo.bdev = &mdev->ttm.bdev; | 325 | mgabo->bo.bdev = &mdev->ttm.bdev; |
326 | mgabo->bo.bdev->dev_mapping = dev->dev_mapping; | ||
326 | 327 | ||
327 | mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); | 328 | mgag200_ttm_placement(mgabo, TTM_PL_FLAG_VRAM | TTM_PL_FLAG_SYSTEM); |
328 | 329 | ||
@@ -353,6 +354,7 @@ int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr) | |||
353 | bo->pin_count++; | 354 | bo->pin_count++; |
354 | if (gpu_addr) | 355 | if (gpu_addr) |
355 | *gpu_addr = mgag200_bo_gpu_offset(bo); | 356 | *gpu_addr = mgag200_bo_gpu_offset(bo); |
357 | return 0; | ||
356 | } | 358 | } |
357 | 359 | ||
358 | mgag200_ttm_placement(bo, pl_flag); | 360 | mgag200_ttm_placement(bo, pl_flag); |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c index 373dbcc523b2..a19e7d79b847 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanva3.c | |||
@@ -36,6 +36,8 @@ nva3_hda_eld(struct nv50_disp_priv *priv, int or, u8 *data, u32 size) | |||
36 | if (data && data[0]) { | 36 | if (data && data[0]) { |
37 | for (i = 0; i < size; i++) | 37 | for (i = 0; i < size; i++) |
38 | nv_wr32(priv, 0x61c440 + soff, (i << 8) | data[i]); | 38 | nv_wr32(priv, 0x61c440 + soff, (i << 8) | data[i]); |
39 | for (; i < 0x60; i++) | ||
40 | nv_wr32(priv, 0x61c440 + soff, (i << 8)); | ||
39 | nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000003); | 41 | nv_mask(priv, 0x61c448 + soff, 0x80000003, 0x80000003); |
40 | } else | 42 | } else |
41 | if (data) { | 43 | if (data) { |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c index dc57e24fc1df..717639386ced 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/hdanvd0.c | |||
@@ -41,6 +41,8 @@ nvd0_hda_eld(struct nv50_disp_priv *priv, int or, u8 *data, u32 size) | |||
41 | if (data && data[0]) { | 41 | if (data && data[0]) { |
42 | for (i = 0; i < size; i++) | 42 | for (i = 0; i < size; i++) |
43 | nv_wr32(priv, 0x10ec00 + soff, (i << 8) | data[i]); | 43 | nv_wr32(priv, 0x10ec00 + soff, (i << 8) | data[i]); |
44 | for (; i < 0x60; i++) | ||
45 | nv_wr32(priv, 0x10ec00 + soff, (i << 8)); | ||
44 | nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000003); | 46 | nv_mask(priv, 0x10ec10 + soff, 0x80000003, 0x80000003); |
45 | } else | 47 | } else |
46 | if (data) { | 48 | if (data) { |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c index ab1e918469a8..526b75242899 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/sornv50.c | |||
@@ -47,14 +47,8 @@ int | |||
47 | nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) | 47 | nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) |
48 | { | 48 | { |
49 | struct nv50_disp_priv *priv = (void *)object->engine; | 49 | struct nv50_disp_priv *priv = (void *)object->engine; |
50 | struct nouveau_bios *bios = nouveau_bios(priv); | ||
51 | const u16 type = (mthd & NV50_DISP_SOR_MTHD_TYPE) >> 12; | ||
52 | const u8 head = (mthd & NV50_DISP_SOR_MTHD_HEAD) >> 3; | 50 | const u8 head = (mthd & NV50_DISP_SOR_MTHD_HEAD) >> 3; |
53 | const u8 link = (mthd & NV50_DISP_SOR_MTHD_LINK) >> 2; | ||
54 | const u8 or = (mthd & NV50_DISP_SOR_MTHD_OR); | 51 | const u8 or = (mthd & NV50_DISP_SOR_MTHD_OR); |
55 | const u16 mask = (0x0100 << head) | (0x0040 << link) | (0x0001 << or); | ||
56 | struct dcb_output outp; | ||
57 | u8 ver, hdr; | ||
58 | u32 data; | 52 | u32 data; |
59 | int ret = -EINVAL; | 53 | int ret = -EINVAL; |
60 | 54 | ||
@@ -62,8 +56,6 @@ nv50_sor_mthd(struct nouveau_object *object, u32 mthd, void *args, u32 size) | |||
62 | return -EINVAL; | 56 | return -EINVAL; |
63 | data = *(u32 *)args; | 57 | data = *(u32 *)args; |
64 | 58 | ||
65 | if (type && !dcb_outp_match(bios, type, mask, &ver, &hdr, &outp)) | ||
66 | return -ENODEV; | ||
67 | 59 | ||
68 | switch (mthd & ~0x3f) { | 60 | switch (mthd & ~0x3f) { |
69 | case NV50_DISP_SOR_PWR: | 61 | case NV50_DISP_SOR_PWR: |
diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c index 49ecbb859b25..c19004301309 100644 --- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c +++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv31.c | |||
@@ -265,8 +265,8 @@ nv31_mpeg_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
265 | int | 265 | int |
266 | nv31_mpeg_init(struct nouveau_object *object) | 266 | nv31_mpeg_init(struct nouveau_object *object) |
267 | { | 267 | { |
268 | struct nouveau_engine *engine = nv_engine(object->engine); | 268 | struct nouveau_engine *engine = nv_engine(object); |
269 | struct nv31_mpeg_priv *priv = (void *)engine; | 269 | struct nv31_mpeg_priv *priv = (void *)object; |
270 | struct nouveau_fb *pfb = nouveau_fb(object); | 270 | struct nouveau_fb *pfb = nouveau_fb(object); |
271 | int ret, i; | 271 | int ret, i; |
272 | 272 | ||
@@ -284,7 +284,10 @@ nv31_mpeg_init(struct nouveau_object *object) | |||
284 | /* PMPEG init */ | 284 | /* PMPEG init */ |
285 | nv_wr32(priv, 0x00b32c, 0x00000000); | 285 | nv_wr32(priv, 0x00b32c, 0x00000000); |
286 | nv_wr32(priv, 0x00b314, 0x00000100); | 286 | nv_wr32(priv, 0x00b314, 0x00000100); |
287 | nv_wr32(priv, 0x00b220, nv44_graph_class(priv) ? 0x00000044 : 0x00000031); | 287 | if (nv_device(priv)->chipset >= 0x40 && nv44_graph_class(priv)) |
288 | nv_wr32(priv, 0x00b220, 0x00000044); | ||
289 | else | ||
290 | nv_wr32(priv, 0x00b220, 0x00000031); | ||
288 | nv_wr32(priv, 0x00b300, 0x02001ec1); | 291 | nv_wr32(priv, 0x00b300, 0x02001ec1); |
289 | nv_mask(priv, 0x00b32c, 0x00000001, 0x00000001); | 292 | nv_mask(priv, 0x00b32c, 0x00000001, 0x00000001); |
290 | 293 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c index f7c581ad1991..dd6196072e9c 100644 --- a/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c +++ b/drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c | |||
@@ -61,6 +61,7 @@ nv40_mpeg_context_ctor(struct nouveau_object *parent, | |||
61 | if (ret) | 61 | if (ret) |
62 | return ret; | 62 | return ret; |
63 | 63 | ||
64 | nv_wo32(&chan->base.base, 0x78, 0x02001ec1); | ||
64 | return 0; | 65 | return 0; |
65 | } | 66 | } |
66 | 67 | ||
diff --git a/drivers/gpu/drm/nouveau/core/engine/xtensa.c b/drivers/gpu/drm/nouveau/core/engine/xtensa.c index 0639bc59d0a5..5f6ede7c4892 100644 --- a/drivers/gpu/drm/nouveau/core/engine/xtensa.c +++ b/drivers/gpu/drm/nouveau/core/engine/xtensa.c | |||
@@ -118,7 +118,13 @@ _nouveau_xtensa_init(struct nouveau_object *object) | |||
118 | return ret; | 118 | return ret; |
119 | } | 119 | } |
120 | 120 | ||
121 | ret = nouveau_gpuobj_new(object, NULL, fw->size, 0x1000, 0, | 121 | if (fw->size > 0x40000) { |
122 | nv_warn(xtensa, "firmware %s too large\n", name); | ||
123 | release_firmware(fw); | ||
124 | return -EINVAL; | ||
125 | } | ||
126 | |||
127 | ret = nouveau_gpuobj_new(object, NULL, 0x40000, 0x1000, 0, | ||
122 | &xtensa->gpu_fw); | 128 | &xtensa->gpu_fw); |
123 | if (ret) { | 129 | if (ret) { |
124 | release_firmware(fw); | 130 | release_firmware(fw); |
diff --git a/drivers/gpu/drm/nouveau/core/include/subdev/vm.h b/drivers/gpu/drm/nouveau/core/include/subdev/vm.h index f2e87b105666..fcf57fa309bf 100644 --- a/drivers/gpu/drm/nouveau/core/include/subdev/vm.h +++ b/drivers/gpu/drm/nouveau/core/include/subdev/vm.h | |||
@@ -55,7 +55,7 @@ struct nouveau_vma { | |||
55 | struct nouveau_vm { | 55 | struct nouveau_vm { |
56 | struct nouveau_vmmgr *vmm; | 56 | struct nouveau_vmmgr *vmm; |
57 | struct nouveau_mm mm; | 57 | struct nouveau_mm mm; |
58 | int refcount; | 58 | struct kref refcount; |
59 | 59 | ||
60 | struct list_head pgd_list; | 60 | struct list_head pgd_list; |
61 | atomic_t engref[NVDEV_SUBDEV_NR]; | 61 | atomic_t engref[NVDEV_SUBDEV_NR]; |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h index 6c974dd83e8b..db9d6ddde52c 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/priv.h | |||
@@ -81,7 +81,7 @@ void nv44_fb_tile_prog(struct nouveau_fb *, int, struct nouveau_fb_tile *); | |||
81 | void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, | 81 | void nv46_fb_tile_init(struct nouveau_fb *, int i, u32 addr, u32 size, |
82 | u32 pitch, u32 flags, struct nouveau_fb_tile *); | 82 | u32 pitch, u32 flags, struct nouveau_fb_tile *); |
83 | 83 | ||
84 | void nv50_ram_put(struct nouveau_fb *, struct nouveau_mem **); | 84 | void __nv50_ram_put(struct nouveau_fb *, struct nouveau_mem *); |
85 | extern int nv50_fb_memtype[0x80]; | 85 | extern int nv50_fb_memtype[0x80]; |
86 | 86 | ||
87 | #endif | 87 | #endif |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c index af5aa7ee8ad9..903baff77fdd 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnv50.c | |||
@@ -27,17 +27,10 @@ | |||
27 | #include "priv.h" | 27 | #include "priv.h" |
28 | 28 | ||
29 | void | 29 | void |
30 | nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) | 30 | __nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem *mem) |
31 | { | 31 | { |
32 | struct nouveau_mm_node *this; | 32 | struct nouveau_mm_node *this; |
33 | struct nouveau_mem *mem; | ||
34 | 33 | ||
35 | mem = *pmem; | ||
36 | *pmem = NULL; | ||
37 | if (unlikely(mem == NULL)) | ||
38 | return; | ||
39 | |||
40 | mutex_lock(&pfb->base.mutex); | ||
41 | while (!list_empty(&mem->regions)) { | 34 | while (!list_empty(&mem->regions)) { |
42 | this = list_first_entry(&mem->regions, typeof(*this), rl_entry); | 35 | this = list_first_entry(&mem->regions, typeof(*this), rl_entry); |
43 | 36 | ||
@@ -46,6 +39,19 @@ nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) | |||
46 | } | 39 | } |
47 | 40 | ||
48 | nouveau_mm_free(&pfb->tags, &mem->tag); | 41 | nouveau_mm_free(&pfb->tags, &mem->tag); |
42 | } | ||
43 | |||
44 | void | ||
45 | nv50_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) | ||
46 | { | ||
47 | struct nouveau_mem *mem = *pmem; | ||
48 | |||
49 | *pmem = NULL; | ||
50 | if (unlikely(mem == NULL)) | ||
51 | return; | ||
52 | |||
53 | mutex_lock(&pfb->base.mutex); | ||
54 | __nv50_ram_put(pfb, mem); | ||
49 | mutex_unlock(&pfb->base.mutex); | 55 | mutex_unlock(&pfb->base.mutex); |
50 | 56 | ||
51 | kfree(mem); | 57 | kfree(mem); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c index 9c3634acbb9d..cf97c4de4a6b 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/ramnvc0.c | |||
@@ -33,11 +33,19 @@ void | |||
33 | nvc0_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) | 33 | nvc0_ram_put(struct nouveau_fb *pfb, struct nouveau_mem **pmem) |
34 | { | 34 | { |
35 | struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb); | 35 | struct nouveau_ltcg *ltcg = nouveau_ltcg(pfb); |
36 | struct nouveau_mem *mem = *pmem; | ||
36 | 37 | ||
37 | if ((*pmem)->tag) | 38 | *pmem = NULL; |
38 | ltcg->tags_free(ltcg, &(*pmem)->tag); | 39 | if (unlikely(mem == NULL)) |
40 | return; | ||
39 | 41 | ||
40 | nv50_ram_put(pfb, pmem); | 42 | mutex_lock(&pfb->base.mutex); |
43 | if (mem->tag) | ||
44 | ltcg->tags_free(ltcg, &mem->tag); | ||
45 | __nv50_ram_put(pfb, mem); | ||
46 | mutex_unlock(&pfb->base.mutex); | ||
47 | |||
48 | kfree(mem); | ||
41 | } | 49 | } |
42 | 50 | ||
43 | int | 51 | int |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c index bf489dcf46e2..c4c1d415e7fe 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c | |||
@@ -103,7 +103,7 @@ nv50_gpio_intr(struct nouveau_subdev *subdev) | |||
103 | int i; | 103 | int i; |
104 | 104 | ||
105 | intr0 = nv_rd32(priv, 0xe054) & nv_rd32(priv, 0xe050); | 105 | intr0 = nv_rd32(priv, 0xe054) & nv_rd32(priv, 0xe050); |
106 | if (nv_device(priv)->chipset >= 0x90) | 106 | if (nv_device(priv)->chipset > 0x92) |
107 | intr1 = nv_rd32(priv, 0xe074) & nv_rd32(priv, 0xe070); | 107 | intr1 = nv_rd32(priv, 0xe074) & nv_rd32(priv, 0xe070); |
108 | 108 | ||
109 | hi = (intr0 & 0x0000ffff) | (intr1 << 16); | 109 | hi = (intr0 & 0x0000ffff) | (intr1 << 16); |
@@ -115,7 +115,7 @@ nv50_gpio_intr(struct nouveau_subdev *subdev) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | nv_wr32(priv, 0xe054, intr0); | 117 | nv_wr32(priv, 0xe054, intr0); |
118 | if (nv_device(priv)->chipset >= 0x90) | 118 | if (nv_device(priv)->chipset > 0x92) |
119 | nv_wr32(priv, 0xe074, intr1); | 119 | nv_wr32(priv, 0xe074, intr1); |
120 | } | 120 | } |
121 | 121 | ||
@@ -146,7 +146,7 @@ nv50_gpio_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
146 | int ret; | 146 | int ret; |
147 | 147 | ||
148 | ret = nouveau_gpio_create(parent, engine, oclass, | 148 | ret = nouveau_gpio_create(parent, engine, oclass, |
149 | nv_device(parent)->chipset >= 0x90 ? 32 : 16, | 149 | nv_device(parent)->chipset > 0x92 ? 32 : 16, |
150 | &priv); | 150 | &priv); |
151 | *pobject = nv_object(priv); | 151 | *pobject = nv_object(priv); |
152 | if (ret) | 152 | if (ret) |
@@ -182,7 +182,7 @@ nv50_gpio_init(struct nouveau_object *object) | |||
182 | /* disable, and ack any pending gpio interrupts */ | 182 | /* disable, and ack any pending gpio interrupts */ |
183 | nv_wr32(priv, 0xe050, 0x00000000); | 183 | nv_wr32(priv, 0xe050, 0x00000000); |
184 | nv_wr32(priv, 0xe054, 0xffffffff); | 184 | nv_wr32(priv, 0xe054, 0xffffffff); |
185 | if (nv_device(priv)->chipset >= 0x90) { | 185 | if (nv_device(priv)->chipset > 0x92) { |
186 | nv_wr32(priv, 0xe070, 0x00000000); | 186 | nv_wr32(priv, 0xe070, 0x00000000); |
187 | nv_wr32(priv, 0xe074, 0xffffffff); | 187 | nv_wr32(priv, 0xe074, 0xffffffff); |
188 | } | 188 | } |
@@ -195,7 +195,7 @@ nv50_gpio_fini(struct nouveau_object *object, bool suspend) | |||
195 | { | 195 | { |
196 | struct nv50_gpio_priv *priv = (void *)object; | 196 | struct nv50_gpio_priv *priv = (void *)object; |
197 | nv_wr32(priv, 0xe050, 0x00000000); | 197 | nv_wr32(priv, 0xe050, 0x00000000); |
198 | if (nv_device(priv)->chipset >= 0x90) | 198 | if (nv_device(priv)->chipset > 0x92) |
199 | nv_wr32(priv, 0xe070, 0x00000000); | 199 | nv_wr32(priv, 0xe070, 0x00000000); |
200 | return nouveau_gpio_fini(&priv->base, suspend); | 200 | return nouveau_gpio_fini(&priv->base, suspend); |
201 | } | 201 | } |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c index 0cb322a5e72c..f25fc5fc7dd1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/mc/nv50.c | |||
@@ -41,7 +41,7 @@ nv50_mc_intr[] = { | |||
41 | { 0x04000000, NVDEV_ENGINE_DISP }, | 41 | { 0x04000000, NVDEV_ENGINE_DISP }, |
42 | { 0x10000000, NVDEV_SUBDEV_BUS }, | 42 | { 0x10000000, NVDEV_SUBDEV_BUS }, |
43 | { 0x80000000, NVDEV_ENGINE_SW }, | 43 | { 0x80000000, NVDEV_ENGINE_SW }, |
44 | { 0x0000d101, NVDEV_SUBDEV_FB }, | 44 | { 0x0002d101, NVDEV_SUBDEV_FB }, |
45 | {}, | 45 | {}, |
46 | }; | 46 | }; |
47 | 47 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c index 67fcb6c852ac..ef3133e7575c 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c | |||
@@ -361,7 +361,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, | |||
361 | 361 | ||
362 | INIT_LIST_HEAD(&vm->pgd_list); | 362 | INIT_LIST_HEAD(&vm->pgd_list); |
363 | vm->vmm = vmm; | 363 | vm->vmm = vmm; |
364 | vm->refcount = 1; | 364 | kref_init(&vm->refcount); |
365 | vm->fpde = offset >> (vmm->pgt_bits + 12); | 365 | vm->fpde = offset >> (vmm->pgt_bits + 12); |
366 | vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); | 366 | vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); |
367 | 367 | ||
@@ -441,8 +441,9 @@ nouveau_vm_unlink(struct nouveau_vm *vm, struct nouveau_gpuobj *mpgd) | |||
441 | } | 441 | } |
442 | 442 | ||
443 | static void | 443 | static void |
444 | nouveau_vm_del(struct nouveau_vm *vm) | 444 | nouveau_vm_del(struct kref *kref) |
445 | { | 445 | { |
446 | struct nouveau_vm *vm = container_of(kref, typeof(*vm), refcount); | ||
446 | struct nouveau_vm_pgd *vpgd, *tmp; | 447 | struct nouveau_vm_pgd *vpgd, *tmp; |
447 | 448 | ||
448 | list_for_each_entry_safe(vpgd, tmp, &vm->pgd_list, head) { | 449 | list_for_each_entry_safe(vpgd, tmp, &vm->pgd_list, head) { |
@@ -458,27 +459,19 @@ int | |||
458 | nouveau_vm_ref(struct nouveau_vm *ref, struct nouveau_vm **ptr, | 459 | nouveau_vm_ref(struct nouveau_vm *ref, struct nouveau_vm **ptr, |
459 | struct nouveau_gpuobj *pgd) | 460 | struct nouveau_gpuobj *pgd) |
460 | { | 461 | { |
461 | struct nouveau_vm *vm; | 462 | if (ref) { |
462 | int ret; | 463 | int ret = nouveau_vm_link(ref, pgd); |
463 | |||
464 | vm = ref; | ||
465 | if (vm) { | ||
466 | ret = nouveau_vm_link(vm, pgd); | ||
467 | if (ret) | 464 | if (ret) |
468 | return ret; | 465 | return ret; |
469 | 466 | ||
470 | vm->refcount++; | 467 | kref_get(&ref->refcount); |
471 | } | 468 | } |
472 | 469 | ||
473 | vm = *ptr; | 470 | if (*ptr) { |
474 | *ptr = ref; | 471 | nouveau_vm_unlink(*ptr, pgd); |
475 | 472 | kref_put(&(*ptr)->refcount, nouveau_vm_del); | |
476 | if (vm) { | ||
477 | nouveau_vm_unlink(vm, pgd); | ||
478 | |||
479 | if (--vm->refcount == 0) | ||
480 | nouveau_vm_del(vm); | ||
481 | } | 473 | } |
482 | 474 | ||
475 | *ptr = ref; | ||
483 | return 0; | 476 | return 0; |
484 | } | 477 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 4e7ee5f4155c..af20fba3a1a4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -198,7 +198,12 @@ nouveau_bo_new(struct drm_device *dev, int size, int align, | |||
198 | size_t acc_size; | 198 | size_t acc_size; |
199 | int ret; | 199 | int ret; |
200 | int type = ttm_bo_type_device; | 200 | int type = ttm_bo_type_device; |
201 | int max_size = INT_MAX & ~((1 << drm->client.base.vm->vmm->lpg_shift) - 1); | 201 | int lpg_shift = 12; |
202 | int max_size; | ||
203 | |||
204 | if (drm->client.base.vm) | ||
205 | lpg_shift = drm->client.base.vm->vmm->lpg_shift; | ||
206 | max_size = INT_MAX & ~((1 << lpg_shift) - 1); | ||
202 | 207 | ||
203 | if (size <= 0 || size > max_size) { | 208 | if (size <= 0 || size > max_size) { |
204 | nv_warn(drm, "skipped size %x\n", (u32)size); | 209 | nv_warn(drm, "skipped size %x\n", (u32)size); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 4c1bc061fae2..8f6d63d7edd3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -398,7 +398,8 @@ void | |||
398 | nouveau_fbcon_output_poll_changed(struct drm_device *dev) | 398 | nouveau_fbcon_output_poll_changed(struct drm_device *dev) |
399 | { | 399 | { |
400 | struct nouveau_drm *drm = nouveau_drm(dev); | 400 | struct nouveau_drm *drm = nouveau_drm(dev); |
401 | drm_fb_helper_hotplug_event(&drm->fbcon->helper); | 401 | if (drm->fbcon) |
402 | drm_fb_helper_hotplug_event(&drm->fbcon->helper); | ||
402 | } | 403 | } |
403 | 404 | ||
404 | static int | 405 | static int |
diff --git a/drivers/gpu/drm/nouveau/nv17_fence.c b/drivers/gpu/drm/nouveau/nv17_fence.c index 8e47a9bae8c3..22aa9963ea6f 100644 --- a/drivers/gpu/drm/nouveau/nv17_fence.c +++ b/drivers/gpu/drm/nouveau/nv17_fence.c | |||
@@ -76,7 +76,7 @@ nv17_fence_context_new(struct nouveau_channel *chan) | |||
76 | struct ttm_mem_reg *mem = &priv->bo->bo.mem; | 76 | struct ttm_mem_reg *mem = &priv->bo->bo.mem; |
77 | struct nouveau_object *object; | 77 | struct nouveau_object *object; |
78 | u32 start = mem->start * PAGE_SIZE; | 78 | u32 start = mem->start * PAGE_SIZE; |
79 | u32 limit = mem->start + mem->size - 1; | 79 | u32 limit = start + mem->size - 1; |
80 | int ret = 0; | 80 | int ret = 0; |
81 | 81 | ||
82 | fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); | 82 | fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/nouveau/nv50_fence.c b/drivers/gpu/drm/nouveau/nv50_fence.c index f9701e567db8..0ee363840035 100644 --- a/drivers/gpu/drm/nouveau/nv50_fence.c +++ b/drivers/gpu/drm/nouveau/nv50_fence.c | |||
@@ -39,6 +39,8 @@ nv50_fence_context_new(struct nouveau_channel *chan) | |||
39 | struct nv10_fence_chan *fctx; | 39 | struct nv10_fence_chan *fctx; |
40 | struct ttm_mem_reg *mem = &priv->bo->bo.mem; | 40 | struct ttm_mem_reg *mem = &priv->bo->bo.mem; |
41 | struct nouveau_object *object; | 41 | struct nouveau_object *object; |
42 | u32 start = mem->start * PAGE_SIZE; | ||
43 | u32 limit = start + mem->size - 1; | ||
42 | int ret, i; | 44 | int ret, i; |
43 | 45 | ||
44 | fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); | 46 | fctx = chan->fence = kzalloc(sizeof(*fctx), GFP_KERNEL); |
@@ -51,26 +53,28 @@ nv50_fence_context_new(struct nouveau_channel *chan) | |||
51 | fctx->base.sync = nv17_fence_sync; | 53 | fctx->base.sync = nv17_fence_sync; |
52 | 54 | ||
53 | ret = nouveau_object_new(nv_object(chan->cli), chan->handle, | 55 | ret = nouveau_object_new(nv_object(chan->cli), chan->handle, |
54 | NvSema, 0x0002, | 56 | NvSema, 0x003d, |
55 | &(struct nv_dma_class) { | 57 | &(struct nv_dma_class) { |
56 | .flags = NV_DMA_TARGET_VRAM | | 58 | .flags = NV_DMA_TARGET_VRAM | |
57 | NV_DMA_ACCESS_RDWR, | 59 | NV_DMA_ACCESS_RDWR, |
58 | .start = mem->start * PAGE_SIZE, | 60 | .start = start, |
59 | .limit = mem->size - 1, | 61 | .limit = limit, |
60 | }, sizeof(struct nv_dma_class), | 62 | }, sizeof(struct nv_dma_class), |
61 | &object); | 63 | &object); |
62 | 64 | ||
63 | /* dma objects for display sync channel semaphore blocks */ | 65 | /* dma objects for display sync channel semaphore blocks */ |
64 | for (i = 0; !ret && i < dev->mode_config.num_crtc; i++) { | 66 | for (i = 0; !ret && i < dev->mode_config.num_crtc; i++) { |
65 | struct nouveau_bo *bo = nv50_display_crtc_sema(dev, i); | 67 | struct nouveau_bo *bo = nv50_display_crtc_sema(dev, i); |
68 | u32 start = bo->bo.mem.start * PAGE_SIZE; | ||
69 | u32 limit = start + bo->bo.mem.size - 1; | ||
66 | 70 | ||
67 | ret = nouveau_object_new(nv_object(chan->cli), chan->handle, | 71 | ret = nouveau_object_new(nv_object(chan->cli), chan->handle, |
68 | NvEvoSema0 + i, 0x003d, | 72 | NvEvoSema0 + i, 0x003d, |
69 | &(struct nv_dma_class) { | 73 | &(struct nv_dma_class) { |
70 | .flags = NV_DMA_TARGET_VRAM | | 74 | .flags = NV_DMA_TARGET_VRAM | |
71 | NV_DMA_ACCESS_RDWR, | 75 | NV_DMA_ACCESS_RDWR, |
72 | .start = bo->bo.offset, | 76 | .start = start, |
73 | .limit = bo->bo.offset + 0xfff, | 77 | .limit = limit, |
74 | }, sizeof(struct nv_dma_class), | 78 | }, sizeof(struct nv_dma_class), |
75 | &object); | 79 | &object); |
76 | } | 80 | } |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index fb441a790f3d..15da7ef344a4 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -1222,12 +1222,17 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | |||
1222 | int r; | 1222 | int r; |
1223 | 1223 | ||
1224 | mutex_lock(&ctx->mutex); | 1224 | mutex_lock(&ctx->mutex); |
1225 | /* reset data block */ | ||
1226 | ctx->data_block = 0; | ||
1225 | /* reset reg block */ | 1227 | /* reset reg block */ |
1226 | ctx->reg_block = 0; | 1228 | ctx->reg_block = 0; |
1227 | /* reset fb window */ | 1229 | /* reset fb window */ |
1228 | ctx->fb_base = 0; | 1230 | ctx->fb_base = 0; |
1229 | /* reset io mode */ | 1231 | /* reset io mode */ |
1230 | ctx->io_mode = ATOM_IO_MM; | 1232 | ctx->io_mode = ATOM_IO_MM; |
1233 | /* reset divmul */ | ||
1234 | ctx->divmul[0] = 0; | ||
1235 | ctx->divmul[1] = 0; | ||
1231 | r = atom_execute_table_locked(ctx, index, params); | 1236 | r = atom_execute_table_locked(ctx, index, params); |
1232 | mutex_unlock(&ctx->mutex); | 1237 | mutex_unlock(&ctx->mutex); |
1233 | return r; | 1238 | return r; |
diff --git a/drivers/gpu/drm/radeon/btc_dpm.c b/drivers/gpu/drm/radeon/btc_dpm.c index 0bfd55e08820..9953e1fbc46d 100644 --- a/drivers/gpu/drm/radeon/btc_dpm.c +++ b/drivers/gpu/drm/radeon/btc_dpm.c | |||
@@ -2548,9 +2548,6 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2548 | { | 2548 | { |
2549 | struct rv7xx_power_info *pi; | 2549 | struct rv7xx_power_info *pi; |
2550 | struct evergreen_power_info *eg_pi; | 2550 | struct evergreen_power_info *eg_pi; |
2551 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2552 | u16 data_offset, size; | ||
2553 | u8 frev, crev; | ||
2554 | struct atom_clock_dividers dividers; | 2551 | struct atom_clock_dividers dividers; |
2555 | int ret; | 2552 | int ret; |
2556 | 2553 | ||
@@ -2633,16 +2630,7 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2633 | eg_pi->vddci_control = | 2630 | eg_pi->vddci_control = |
2634 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 2631 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
2635 | 2632 | ||
2636 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2633 | rv770_get_engine_memory_ss(rdev); |
2637 | &frev, &crev, &data_offset)) { | ||
2638 | pi->sclk_ss = true; | ||
2639 | pi->mclk_ss = true; | ||
2640 | pi->dynamic_ss = true; | ||
2641 | } else { | ||
2642 | pi->sclk_ss = false; | ||
2643 | pi->mclk_ss = false; | ||
2644 | pi->dynamic_ss = true; | ||
2645 | } | ||
2646 | 2634 | ||
2647 | pi->asi = RV770_ASI_DFLT; | 2635 | pi->asi = RV770_ASI_DFLT; |
2648 | pi->pasi = CYPRESS_HASI_DFLT; | 2636 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -2659,8 +2647,7 @@ int btc_dpm_init(struct radeon_device *rdev) | |||
2659 | 2647 | ||
2660 | pi->dynamic_pcie_gen2 = true; | 2648 | pi->dynamic_pcie_gen2 = true; |
2661 | 2649 | ||
2662 | if (pi->gfx_clock_gating && | 2650 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2663 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2664 | pi->thermal_protection = true; | 2651 | pi->thermal_protection = true; |
2665 | else | 2652 | else |
2666 | pi->thermal_protection = false; | 2653 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 6dacec4e2090..8928bd109c16 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -2587,9 +2587,11 @@ u32 cik_compute_ring_get_rptr(struct radeon_device *rdev, | |||
2587 | if (rdev->wb.enabled) { | 2587 | if (rdev->wb.enabled) { |
2588 | rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); | 2588 | rptr = le32_to_cpu(rdev->wb.wb[ring->rptr_offs/4]); |
2589 | } else { | 2589 | } else { |
2590 | mutex_lock(&rdev->srbm_mutex); | ||
2590 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); | 2591 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); |
2591 | rptr = RREG32(CP_HQD_PQ_RPTR); | 2592 | rptr = RREG32(CP_HQD_PQ_RPTR); |
2592 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2593 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2594 | mutex_unlock(&rdev->srbm_mutex); | ||
2593 | } | 2595 | } |
2594 | rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; | 2596 | rptr = (rptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; |
2595 | 2597 | ||
@@ -2604,9 +2606,11 @@ u32 cik_compute_ring_get_wptr(struct radeon_device *rdev, | |||
2604 | if (rdev->wb.enabled) { | 2606 | if (rdev->wb.enabled) { |
2605 | wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); | 2607 | wptr = le32_to_cpu(rdev->wb.wb[ring->wptr_offs/4]); |
2606 | } else { | 2608 | } else { |
2609 | mutex_lock(&rdev->srbm_mutex); | ||
2607 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); | 2610 | cik_srbm_select(rdev, ring->me, ring->pipe, ring->queue, 0); |
2608 | wptr = RREG32(CP_HQD_PQ_WPTR); | 2611 | wptr = RREG32(CP_HQD_PQ_WPTR); |
2609 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2612 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2613 | mutex_unlock(&rdev->srbm_mutex); | ||
2610 | } | 2614 | } |
2611 | wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; | 2615 | wptr = (wptr & ring->ptr_reg_mask) >> ring->ptr_reg_shift; |
2612 | 2616 | ||
@@ -2897,6 +2901,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2897 | WREG32(CP_CPF_DEBUG, tmp); | 2901 | WREG32(CP_CPF_DEBUG, tmp); |
2898 | 2902 | ||
2899 | /* init the pipes */ | 2903 | /* init the pipes */ |
2904 | mutex_lock(&rdev->srbm_mutex); | ||
2900 | for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { | 2905 | for (i = 0; i < (rdev->mec.num_pipe * rdev->mec.num_mec); i++) { |
2901 | int me = (i < 4) ? 1 : 2; | 2906 | int me = (i < 4) ? 1 : 2; |
2902 | int pipe = (i < 4) ? i : (i - 4); | 2907 | int pipe = (i < 4) ? i : (i - 4); |
@@ -2919,6 +2924,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2919 | WREG32(CP_HPD_EOP_CONTROL, tmp); | 2924 | WREG32(CP_HPD_EOP_CONTROL, tmp); |
2920 | } | 2925 | } |
2921 | cik_srbm_select(rdev, 0, 0, 0, 0); | 2926 | cik_srbm_select(rdev, 0, 0, 0, 0); |
2927 | mutex_unlock(&rdev->srbm_mutex); | ||
2922 | 2928 | ||
2923 | /* init the queues. Just two for now. */ | 2929 | /* init the queues. Just two for now. */ |
2924 | for (i = 0; i < 2; i++) { | 2930 | for (i = 0; i < 2; i++) { |
@@ -2972,6 +2978,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
2972 | mqd->static_thread_mgmt23[0] = 0xffffffff; | 2978 | mqd->static_thread_mgmt23[0] = 0xffffffff; |
2973 | mqd->static_thread_mgmt23[1] = 0xffffffff; | 2979 | mqd->static_thread_mgmt23[1] = 0xffffffff; |
2974 | 2980 | ||
2981 | mutex_lock(&rdev->srbm_mutex); | ||
2975 | cik_srbm_select(rdev, rdev->ring[idx].me, | 2982 | cik_srbm_select(rdev, rdev->ring[idx].me, |
2976 | rdev->ring[idx].pipe, | 2983 | rdev->ring[idx].pipe, |
2977 | rdev->ring[idx].queue, 0); | 2984 | rdev->ring[idx].queue, 0); |
@@ -3099,6 +3106,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
3099 | WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); | 3106 | WREG32(CP_HQD_ACTIVE, mqd->queue_state.cp_hqd_active); |
3100 | 3107 | ||
3101 | cik_srbm_select(rdev, 0, 0, 0, 0); | 3108 | cik_srbm_select(rdev, 0, 0, 0, 0); |
3109 | mutex_unlock(&rdev->srbm_mutex); | ||
3102 | 3110 | ||
3103 | radeon_bo_kunmap(rdev->ring[idx].mqd_obj); | 3111 | radeon_bo_kunmap(rdev->ring[idx].mqd_obj); |
3104 | radeon_bo_unreserve(rdev->ring[idx].mqd_obj); | 3112 | radeon_bo_unreserve(rdev->ring[idx].mqd_obj); |
@@ -4320,6 +4328,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
4320 | 4328 | ||
4321 | /* XXX SH_MEM regs */ | 4329 | /* XXX SH_MEM regs */ |
4322 | /* where to put LDS, scratch, GPUVM in FSA64 space */ | 4330 | /* where to put LDS, scratch, GPUVM in FSA64 space */ |
4331 | mutex_lock(&rdev->srbm_mutex); | ||
4323 | for (i = 0; i < 16; i++) { | 4332 | for (i = 0; i < 16; i++) { |
4324 | cik_srbm_select(rdev, 0, 0, 0, i); | 4333 | cik_srbm_select(rdev, 0, 0, 0, i); |
4325 | /* CP and shaders */ | 4334 | /* CP and shaders */ |
@@ -4335,6 +4344,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
4335 | /* XXX SDMA RLC - todo */ | 4344 | /* XXX SDMA RLC - todo */ |
4336 | } | 4345 | } |
4337 | cik_srbm_select(rdev, 0, 0, 0, 0); | 4346 | cik_srbm_select(rdev, 0, 0, 0, 0); |
4347 | mutex_unlock(&rdev->srbm_mutex); | ||
4338 | 4348 | ||
4339 | cik_pcie_gart_tlb_flush(rdev); | 4349 | cik_pcie_gart_tlb_flush(rdev); |
4340 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", | 4350 | DRM_INFO("PCIE GART of %uM enabled (table at 0x%016llX).\n", |
@@ -5954,6 +5964,8 @@ static int cik_startup(struct radeon_device *rdev) | |||
5954 | struct radeon_ring *ring; | 5964 | struct radeon_ring *ring; |
5955 | int r; | 5965 | int r; |
5956 | 5966 | ||
5967 | cik_mc_program(rdev); | ||
5968 | |||
5957 | if (rdev->flags & RADEON_IS_IGP) { | 5969 | if (rdev->flags & RADEON_IS_IGP) { |
5958 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || | 5970 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || |
5959 | !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { | 5971 | !rdev->mec_fw || !rdev->sdma_fw || !rdev->rlc_fw) { |
@@ -5985,7 +5997,6 @@ static int cik_startup(struct radeon_device *rdev) | |||
5985 | if (r) | 5997 | if (r) |
5986 | return r; | 5998 | return r; |
5987 | 5999 | ||
5988 | cik_mc_program(rdev); | ||
5989 | r = cik_pcie_gart_enable(rdev); | 6000 | r = cik_pcie_gart_enable(rdev); |
5990 | if (r) | 6001 | if (r) |
5991 | return r; | 6002 | return r; |
@@ -6194,7 +6205,7 @@ int cik_suspend(struct radeon_device *rdev) | |||
6194 | radeon_vm_manager_fini(rdev); | 6205 | radeon_vm_manager_fini(rdev); |
6195 | cik_cp_enable(rdev, false); | 6206 | cik_cp_enable(rdev, false); |
6196 | cik_sdma_enable(rdev, false); | 6207 | cik_sdma_enable(rdev, false); |
6197 | r600_uvd_rbc_stop(rdev); | 6208 | r600_uvd_stop(rdev); |
6198 | radeon_uvd_suspend(rdev); | 6209 | radeon_uvd_suspend(rdev); |
6199 | cik_irq_suspend(rdev); | 6210 | cik_irq_suspend(rdev); |
6200 | radeon_wb_disable(rdev); | 6211 | radeon_wb_disable(rdev); |
@@ -6358,6 +6369,7 @@ void cik_fini(struct radeon_device *rdev) | |||
6358 | radeon_vm_manager_fini(rdev); | 6369 | radeon_vm_manager_fini(rdev); |
6359 | radeon_ib_pool_fini(rdev); | 6370 | radeon_ib_pool_fini(rdev); |
6360 | radeon_irq_kms_fini(rdev); | 6371 | radeon_irq_kms_fini(rdev); |
6372 | r600_uvd_stop(rdev); | ||
6361 | radeon_uvd_fini(rdev); | 6373 | radeon_uvd_fini(rdev); |
6362 | cik_pcie_gart_fini(rdev); | 6374 | cik_pcie_gart_fini(rdev); |
6363 | r600_vram_scratch_fini(rdev); | 6375 | r600_vram_scratch_fini(rdev); |
@@ -6978,7 +6990,7 @@ int cik_uvd_resume(struct radeon_device *rdev) | |||
6978 | 6990 | ||
6979 | /* programm the VCPU memory controller bits 0-27 */ | 6991 | /* programm the VCPU memory controller bits 0-27 */ |
6980 | addr = rdev->uvd.gpu_addr >> 3; | 6992 | addr = rdev->uvd.gpu_addr >> 3; |
6981 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; | 6993 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; |
6982 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); | 6994 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); |
6983 | WREG32(UVD_VCPU_CACHE_SIZE0, size); | 6995 | WREG32(UVD_VCPU_CACHE_SIZE0, size); |
6984 | 6996 | ||
diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c index 9bcdd174780f..7e5d0b570a30 100644 --- a/drivers/gpu/drm/radeon/cypress_dpm.c +++ b/drivers/gpu/drm/radeon/cypress_dpm.c | |||
@@ -2038,9 +2038,6 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2038 | { | 2038 | { |
2039 | struct rv7xx_power_info *pi; | 2039 | struct rv7xx_power_info *pi; |
2040 | struct evergreen_power_info *eg_pi; | 2040 | struct evergreen_power_info *eg_pi; |
2041 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2042 | uint16_t data_offset, size; | ||
2043 | uint8_t frev, crev; | ||
2044 | struct atom_clock_dividers dividers; | 2041 | struct atom_clock_dividers dividers; |
2045 | int ret; | 2042 | int ret; |
2046 | 2043 | ||
@@ -2092,16 +2089,7 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2092 | eg_pi->vddci_control = | 2089 | eg_pi->vddci_control = |
2093 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 2090 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
2094 | 2091 | ||
2095 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2092 | rv770_get_engine_memory_ss(rdev); |
2096 | &frev, &crev, &data_offset)) { | ||
2097 | pi->sclk_ss = true; | ||
2098 | pi->mclk_ss = true; | ||
2099 | pi->dynamic_ss = true; | ||
2100 | } else { | ||
2101 | pi->sclk_ss = false; | ||
2102 | pi->mclk_ss = false; | ||
2103 | pi->dynamic_ss = true; | ||
2104 | } | ||
2105 | 2093 | ||
2106 | pi->asi = RV770_ASI_DFLT; | 2094 | pi->asi = RV770_ASI_DFLT; |
2107 | pi->pasi = CYPRESS_HASI_DFLT; | 2095 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -2122,8 +2110,7 @@ int cypress_dpm_init(struct radeon_device *rdev) | |||
2122 | 2110 | ||
2123 | pi->dynamic_pcie_gen2 = true; | 2111 | pi->dynamic_pcie_gen2 = true; |
2124 | 2112 | ||
2125 | if (pi->gfx_clock_gating && | 2113 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2126 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2127 | pi->thermal_protection = true; | 2114 | pi->thermal_protection = true; |
2128 | else | 2115 | else |
2129 | pi->thermal_protection = false; | 2116 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 038dcac7670c..d5b49e33315e 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -5106,6 +5106,8 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
5106 | /* enable aspm */ | 5106 | /* enable aspm */ |
5107 | evergreen_program_aspm(rdev); | 5107 | evergreen_program_aspm(rdev); |
5108 | 5108 | ||
5109 | evergreen_mc_program(rdev); | ||
5110 | |||
5109 | if (ASIC_IS_DCE5(rdev)) { | 5111 | if (ASIC_IS_DCE5(rdev)) { |
5110 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { | 5112 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw || !rdev->mc_fw) { |
5111 | r = ni_init_microcode(rdev); | 5113 | r = ni_init_microcode(rdev); |
@@ -5133,7 +5135,6 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
5133 | if (r) | 5135 | if (r) |
5134 | return r; | 5136 | return r; |
5135 | 5137 | ||
5136 | evergreen_mc_program(rdev); | ||
5137 | if (rdev->flags & RADEON_IS_AGP) { | 5138 | if (rdev->flags & RADEON_IS_AGP) { |
5138 | evergreen_agp_enable(rdev); | 5139 | evergreen_agp_enable(rdev); |
5139 | } else { | 5140 | } else { |
@@ -5291,10 +5292,10 @@ int evergreen_resume(struct radeon_device *rdev) | |||
5291 | int evergreen_suspend(struct radeon_device *rdev) | 5292 | int evergreen_suspend(struct radeon_device *rdev) |
5292 | { | 5293 | { |
5293 | r600_audio_fini(rdev); | 5294 | r600_audio_fini(rdev); |
5295 | r600_uvd_stop(rdev); | ||
5294 | radeon_uvd_suspend(rdev); | 5296 | radeon_uvd_suspend(rdev); |
5295 | r700_cp_stop(rdev); | 5297 | r700_cp_stop(rdev); |
5296 | r600_dma_stop(rdev); | 5298 | r600_dma_stop(rdev); |
5297 | r600_uvd_rbc_stop(rdev); | ||
5298 | evergreen_irq_suspend(rdev); | 5299 | evergreen_irq_suspend(rdev); |
5299 | radeon_wb_disable(rdev); | 5300 | radeon_wb_disable(rdev); |
5300 | evergreen_pcie_gart_disable(rdev); | 5301 | evergreen_pcie_gart_disable(rdev); |
@@ -5429,6 +5430,7 @@ void evergreen_fini(struct radeon_device *rdev) | |||
5429 | radeon_ib_pool_fini(rdev); | 5430 | radeon_ib_pool_fini(rdev); |
5430 | radeon_irq_kms_fini(rdev); | 5431 | radeon_irq_kms_fini(rdev); |
5431 | evergreen_pcie_gart_fini(rdev); | 5432 | evergreen_pcie_gart_fini(rdev); |
5433 | r600_uvd_stop(rdev); | ||
5432 | radeon_uvd_fini(rdev); | 5434 | radeon_uvd_fini(rdev); |
5433 | r600_vram_scratch_fini(rdev); | 5435 | r600_vram_scratch_fini(rdev); |
5434 | radeon_gem_fini(rdev); | 5436 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index b0d3fb341417..b0e280058b9b 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
@@ -148,18 +148,40 @@ static void evergreen_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
148 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 148 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
149 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); | 149 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); |
150 | u32 base_rate = 24000; | 150 | u32 base_rate = 24000; |
151 | u32 max_ratio = clock / base_rate; | ||
152 | u32 dto_phase; | ||
153 | u32 dto_modulo = clock; | ||
154 | u32 wallclock_ratio; | ||
155 | u32 dto_cntl; | ||
151 | 156 | ||
152 | if (!dig || !dig->afmt) | 157 | if (!dig || !dig->afmt) |
153 | return; | 158 | return; |
154 | 159 | ||
160 | if (max_ratio >= 8) { | ||
161 | dto_phase = 192 * 1000; | ||
162 | wallclock_ratio = 3; | ||
163 | } else if (max_ratio >= 4) { | ||
164 | dto_phase = 96 * 1000; | ||
165 | wallclock_ratio = 2; | ||
166 | } else if (max_ratio >= 2) { | ||
167 | dto_phase = 48 * 1000; | ||
168 | wallclock_ratio = 1; | ||
169 | } else { | ||
170 | dto_phase = 24 * 1000; | ||
171 | wallclock_ratio = 0; | ||
172 | } | ||
173 | dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; | ||
174 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); | ||
175 | WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); | ||
176 | |||
155 | /* XXX two dtos; generally use dto0 for hdmi */ | 177 | /* XXX two dtos; generally use dto0 for hdmi */ |
156 | /* Express [24MHz / target pixel clock] as an exact rational | 178 | /* Express [24MHz / target pixel clock] as an exact rational |
157 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE | 179 | * number (coefficient of two integer numbers. DCCG_AUDIO_DTOx_PHASE |
158 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator | 180 | * is the numerator, DCCG_AUDIO_DTOx_MODULE is the denominator |
159 | */ | 181 | */ |
160 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); | ||
161 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); | ||
162 | WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); | 182 | WREG32(DCCG_AUDIO_DTO_SOURCE, DCCG_AUDIO_DTO0_SOURCE_SEL(radeon_crtc->crtc_id)); |
183 | WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); | ||
184 | WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); | ||
163 | } | 185 | } |
164 | 186 | ||
165 | 187 | ||
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index a7baf67aef6c..0d582ac1dc31 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -497,6 +497,9 @@ | |||
497 | #define DCCG_AUDIO_DTO0_MODULE 0x05b4 | 497 | #define DCCG_AUDIO_DTO0_MODULE 0x05b4 |
498 | #define DCCG_AUDIO_DTO0_LOAD 0x05b8 | 498 | #define DCCG_AUDIO_DTO0_LOAD 0x05b8 |
499 | #define DCCG_AUDIO_DTO0_CNTL 0x05bc | 499 | #define DCCG_AUDIO_DTO0_CNTL 0x05bc |
500 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) | ||
501 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 | ||
502 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 | ||
500 | 503 | ||
501 | #define DCCG_AUDIO_DTO1_PHASE 0x05c0 | 504 | #define DCCG_AUDIO_DTO1_PHASE 0x05c0 |
502 | #define DCCG_AUDIO_DTO1_MODULE 0x05c4 | 505 | #define DCCG_AUDIO_DTO1_MODULE 0x05c4 |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 56bd4f3be4fe..ccb4f8b54852 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -794,9 +794,13 @@ int ni_init_microcode(struct radeon_device *rdev) | |||
794 | if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { | 794 | if ((rdev->family >= CHIP_BARTS) && (rdev->family <= CHIP_CAYMAN)) { |
795 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | 795 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
796 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 796 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
797 | if (err) | 797 | if (err) { |
798 | goto out; | 798 | printk(KERN_ERR |
799 | if (rdev->smc_fw->size != smc_req_size) { | 799 | "smc: error loading firmware \"%s\"\n", |
800 | fw_name); | ||
801 | release_firmware(rdev->smc_fw); | ||
802 | rdev->smc_fw = NULL; | ||
803 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
800 | printk(KERN_ERR | 804 | printk(KERN_ERR |
801 | "ni_mc: Bogus length %zu in firmware \"%s\"\n", | 805 | "ni_mc: Bogus length %zu in firmware \"%s\"\n", |
802 | rdev->mc_fw->size, fw_name); | 806 | rdev->mc_fw->size, fw_name); |
@@ -2079,6 +2083,8 @@ static int cayman_startup(struct radeon_device *rdev) | |||
2079 | /* enable aspm */ | 2083 | /* enable aspm */ |
2080 | evergreen_program_aspm(rdev); | 2084 | evergreen_program_aspm(rdev); |
2081 | 2085 | ||
2086 | evergreen_mc_program(rdev); | ||
2087 | |||
2082 | if (rdev->flags & RADEON_IS_IGP) { | 2088 | if (rdev->flags & RADEON_IS_IGP) { |
2083 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 2089 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
2084 | r = ni_init_microcode(rdev); | 2090 | r = ni_init_microcode(rdev); |
@@ -2107,7 +2113,6 @@ static int cayman_startup(struct radeon_device *rdev) | |||
2107 | if (r) | 2113 | if (r) |
2108 | return r; | 2114 | return r; |
2109 | 2115 | ||
2110 | evergreen_mc_program(rdev); | ||
2111 | r = cayman_pcie_gart_enable(rdev); | 2116 | r = cayman_pcie_gart_enable(rdev); |
2112 | if (r) | 2117 | if (r) |
2113 | return r; | 2118 | return r; |
@@ -2286,7 +2291,7 @@ int cayman_suspend(struct radeon_device *rdev) | |||
2286 | radeon_vm_manager_fini(rdev); | 2291 | radeon_vm_manager_fini(rdev); |
2287 | cayman_cp_enable(rdev, false); | 2292 | cayman_cp_enable(rdev, false); |
2288 | cayman_dma_stop(rdev); | 2293 | cayman_dma_stop(rdev); |
2289 | r600_uvd_rbc_stop(rdev); | 2294 | r600_uvd_stop(rdev); |
2290 | radeon_uvd_suspend(rdev); | 2295 | radeon_uvd_suspend(rdev); |
2291 | evergreen_irq_suspend(rdev); | 2296 | evergreen_irq_suspend(rdev); |
2292 | radeon_wb_disable(rdev); | 2297 | radeon_wb_disable(rdev); |
@@ -2418,6 +2423,7 @@ void cayman_fini(struct radeon_device *rdev) | |||
2418 | radeon_vm_manager_fini(rdev); | 2423 | radeon_vm_manager_fini(rdev); |
2419 | radeon_ib_pool_fini(rdev); | 2424 | radeon_ib_pool_fini(rdev); |
2420 | radeon_irq_kms_fini(rdev); | 2425 | radeon_irq_kms_fini(rdev); |
2426 | r600_uvd_stop(rdev); | ||
2421 | radeon_uvd_fini(rdev); | 2427 | radeon_uvd_fini(rdev); |
2422 | cayman_pcie_gart_fini(rdev); | 2428 | cayman_pcie_gart_fini(rdev); |
2423 | r600_vram_scratch_fini(rdev); | 2429 | r600_vram_scratch_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c index 559cf24d51af..f0f5f748938a 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c | |||
@@ -1054,10 +1054,6 @@ static int ni_restrict_performance_levels_before_switch(struct radeon_device *rd | |||
1054 | int ni_dpm_force_performance_level(struct radeon_device *rdev, | 1054 | int ni_dpm_force_performance_level(struct radeon_device *rdev, |
1055 | enum radeon_dpm_forced_level level) | 1055 | enum radeon_dpm_forced_level level) |
1056 | { | 1056 | { |
1057 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; | ||
1058 | struct ni_ps *ps = ni_get_ps(rps); | ||
1059 | u32 levels; | ||
1060 | |||
1061 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { | 1057 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { |
1062 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) | 1058 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) |
1063 | return -EINVAL; | 1059 | return -EINVAL; |
@@ -1068,8 +1064,7 @@ int ni_dpm_force_performance_level(struct radeon_device *rdev, | |||
1068 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 1064 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
1069 | return -EINVAL; | 1065 | return -EINVAL; |
1070 | 1066 | ||
1071 | levels = ps->performance_level_count - 1; | 1067 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) != PPSMC_Result_OK) |
1072 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) | ||
1073 | return -EINVAL; | 1068 | return -EINVAL; |
1074 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { | 1069 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { |
1075 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 1070 | if (ni_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
@@ -4072,9 +4067,6 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4072 | struct rv7xx_power_info *pi; | 4067 | struct rv7xx_power_info *pi; |
4073 | struct evergreen_power_info *eg_pi; | 4068 | struct evergreen_power_info *eg_pi; |
4074 | struct ni_power_info *ni_pi; | 4069 | struct ni_power_info *ni_pi; |
4075 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
4076 | u16 data_offset, size; | ||
4077 | u8 frev, crev; | ||
4078 | struct atom_clock_dividers dividers; | 4070 | struct atom_clock_dividers dividers; |
4079 | int ret; | 4071 | int ret; |
4080 | 4072 | ||
@@ -4167,16 +4159,7 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4167 | eg_pi->vddci_control = | 4159 | eg_pi->vddci_control = |
4168 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); | 4160 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); |
4169 | 4161 | ||
4170 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 4162 | rv770_get_engine_memory_ss(rdev); |
4171 | &frev, &crev, &data_offset)) { | ||
4172 | pi->sclk_ss = true; | ||
4173 | pi->mclk_ss = true; | ||
4174 | pi->dynamic_ss = true; | ||
4175 | } else { | ||
4176 | pi->sclk_ss = false; | ||
4177 | pi->mclk_ss = false; | ||
4178 | pi->dynamic_ss = true; | ||
4179 | } | ||
4180 | 4163 | ||
4181 | pi->asi = RV770_ASI_DFLT; | 4164 | pi->asi = RV770_ASI_DFLT; |
4182 | pi->pasi = CYPRESS_HASI_DFLT; | 4165 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -4193,8 +4176,7 @@ int ni_dpm_init(struct radeon_device *rdev) | |||
4193 | 4176 | ||
4194 | pi->dynamic_pcie_gen2 = true; | 4177 | pi->dynamic_pcie_gen2 = true; |
4195 | 4178 | ||
4196 | if (pi->gfx_clock_gating && | 4179 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
4197 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
4198 | pi->thermal_protection = true; | 4180 | pi->thermal_protection = true; |
4199 | else | 4181 | else |
4200 | pi->thermal_protection = false; | 4182 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 10f712e37003..e66e72077350 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2299,9 +2299,13 @@ int r600_init_microcode(struct radeon_device *rdev) | |||
2299 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { | 2299 | if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_HEMLOCK)) { |
2300 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); | 2300 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", smc_chip_name); |
2301 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 2301 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
2302 | if (err) | 2302 | if (err) { |
2303 | goto out; | 2303 | printk(KERN_ERR |
2304 | if (rdev->smc_fw->size != smc_req_size) { | 2304 | "smc: error loading firmware \"%s\"\n", |
2305 | fw_name); | ||
2306 | release_firmware(rdev->smc_fw); | ||
2307 | rdev->smc_fw = NULL; | ||
2308 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
2305 | printk(KERN_ERR | 2309 | printk(KERN_ERR |
2306 | "smc: Bogus length %zu in firmware \"%s\"\n", | 2310 | "smc: Bogus length %zu in firmware \"%s\"\n", |
2307 | rdev->smc_fw->size, fw_name); | 2311 | rdev->smc_fw->size, fw_name); |
@@ -2697,12 +2701,29 @@ int r600_uvd_rbc_start(struct radeon_device *rdev) | |||
2697 | return 0; | 2701 | return 0; |
2698 | } | 2702 | } |
2699 | 2703 | ||
2700 | void r600_uvd_rbc_stop(struct radeon_device *rdev) | 2704 | void r600_uvd_stop(struct radeon_device *rdev) |
2701 | { | 2705 | { |
2702 | struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; | 2706 | struct radeon_ring *ring = &rdev->ring[R600_RING_TYPE_UVD_INDEX]; |
2703 | 2707 | ||
2704 | /* force RBC into idle state */ | 2708 | /* force RBC into idle state */ |
2705 | WREG32(UVD_RBC_RB_CNTL, 0x11010101); | 2709 | WREG32(UVD_RBC_RB_CNTL, 0x11010101); |
2710 | |||
2711 | /* Stall UMC and register bus before resetting VCPU */ | ||
2712 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2713 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2714 | mdelay(1); | ||
2715 | |||
2716 | /* put VCPU into reset */ | ||
2717 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); | ||
2718 | mdelay(5); | ||
2719 | |||
2720 | /* disable VCPU clock */ | ||
2721 | WREG32(UVD_VCPU_CNTL, 0x0); | ||
2722 | |||
2723 | /* Unstall UMC and register bus */ | ||
2724 | WREG32_P(UVD_LMI_CTRL2, 0, ~(1 << 8)); | ||
2725 | WREG32_P(UVD_RB_ARB_CTRL, 0, ~(1 << 3)); | ||
2726 | |||
2706 | ring->ready = false; | 2727 | ring->ready = false; |
2707 | } | 2728 | } |
2708 | 2729 | ||
@@ -2722,6 +2743,11 @@ int r600_uvd_init(struct radeon_device *rdev) | |||
2722 | /* disable interupt */ | 2743 | /* disable interupt */ |
2723 | WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); | 2744 | WREG32_P(UVD_MASTINT_EN, 0, ~(1 << 1)); |
2724 | 2745 | ||
2746 | /* Stall UMC and register bus before resetting VCPU */ | ||
2747 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2748 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2749 | mdelay(1); | ||
2750 | |||
2725 | /* put LMI, VCPU, RBC etc... into reset */ | 2751 | /* put LMI, VCPU, RBC etc... into reset */ |
2726 | WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | | 2752 | WREG32(UVD_SOFT_RESET, LMI_SOFT_RESET | VCPU_SOFT_RESET | |
2727 | LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET | | 2753 | LBSI_SOFT_RESET | RBC_SOFT_RESET | CSM_SOFT_RESET | |
@@ -2751,10 +2777,6 @@ int r600_uvd_init(struct radeon_device *rdev) | |||
2751 | WREG32(UVD_MPC_SET_ALU, 0); | 2777 | WREG32(UVD_MPC_SET_ALU, 0); |
2752 | WREG32(UVD_MPC_SET_MUX, 0x88); | 2778 | WREG32(UVD_MPC_SET_MUX, 0x88); |
2753 | 2779 | ||
2754 | /* Stall UMC */ | ||
2755 | WREG32_P(UVD_LMI_CTRL2, 1 << 8, ~(1 << 8)); | ||
2756 | WREG32_P(UVD_RB_ARB_CTRL, 1 << 3, ~(1 << 3)); | ||
2757 | |||
2758 | /* take all subblocks out of reset, except VCPU */ | 2780 | /* take all subblocks out of reset, except VCPU */ |
2759 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); | 2781 | WREG32(UVD_SOFT_RESET, VCPU_SOFT_RESET); |
2760 | mdelay(5); | 2782 | mdelay(5); |
@@ -3312,6 +3334,8 @@ static int r600_startup(struct radeon_device *rdev) | |||
3312 | /* enable pcie gen2 link */ | 3334 | /* enable pcie gen2 link */ |
3313 | r600_pcie_gen2_enable(rdev); | 3335 | r600_pcie_gen2_enable(rdev); |
3314 | 3336 | ||
3337 | r600_mc_program(rdev); | ||
3338 | |||
3315 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 3339 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
3316 | r = r600_init_microcode(rdev); | 3340 | r = r600_init_microcode(rdev); |
3317 | if (r) { | 3341 | if (r) { |
@@ -3324,7 +3348,6 @@ static int r600_startup(struct radeon_device *rdev) | |||
3324 | if (r) | 3348 | if (r) |
3325 | return r; | 3349 | return r; |
3326 | 3350 | ||
3327 | r600_mc_program(rdev); | ||
3328 | if (rdev->flags & RADEON_IS_AGP) { | 3351 | if (rdev->flags & RADEON_IS_AGP) { |
3329 | r600_agp_enable(rdev); | 3352 | r600_agp_enable(rdev); |
3330 | } else { | 3353 | } else { |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index f48240bb8c56..f264df5470f7 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -226,10 +226,29 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
226 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 226 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
227 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 227 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
228 | u32 base_rate = 24000; | 228 | u32 base_rate = 24000; |
229 | u32 max_ratio = clock / base_rate; | ||
230 | u32 dto_phase; | ||
231 | u32 dto_modulo = clock; | ||
232 | u32 wallclock_ratio; | ||
233 | u32 dto_cntl; | ||
229 | 234 | ||
230 | if (!dig || !dig->afmt) | 235 | if (!dig || !dig->afmt) |
231 | return; | 236 | return; |
232 | 237 | ||
238 | if (max_ratio >= 8) { | ||
239 | dto_phase = 192 * 1000; | ||
240 | wallclock_ratio = 3; | ||
241 | } else if (max_ratio >= 4) { | ||
242 | dto_phase = 96 * 1000; | ||
243 | wallclock_ratio = 2; | ||
244 | } else if (max_ratio >= 2) { | ||
245 | dto_phase = 48 * 1000; | ||
246 | wallclock_ratio = 1; | ||
247 | } else { | ||
248 | dto_phase = 24 * 1000; | ||
249 | wallclock_ratio = 0; | ||
250 | } | ||
251 | |||
233 | /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. | 252 | /* there are two DTOs selected by DCCG_AUDIO_DTO_SELECT. |
234 | * doesn't matter which one you use. Just use the first one. | 253 | * doesn't matter which one you use. Just use the first one. |
235 | */ | 254 | */ |
@@ -242,9 +261,21 @@ void r600_audio_set_dto(struct drm_encoder *encoder, u32 clock) | |||
242 | /* according to the reg specs, this should DCE3.2 only, but in | 261 | /* according to the reg specs, this should DCE3.2 only, but in |
243 | * practice it seems to cover DCE3.0 as well. | 262 | * practice it seems to cover DCE3.0 as well. |
244 | */ | 263 | */ |
245 | WREG32(DCCG_AUDIO_DTO0_PHASE, base_rate * 100); | 264 | if (dig->dig_encoder == 0) { |
246 | WREG32(DCCG_AUDIO_DTO0_MODULE, clock * 100); | 265 | dto_cntl = RREG32(DCCG_AUDIO_DTO0_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; |
247 | WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ | 266 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); |
267 | WREG32(DCCG_AUDIO_DTO0_CNTL, dto_cntl); | ||
268 | WREG32(DCCG_AUDIO_DTO0_PHASE, dto_phase); | ||
269 | WREG32(DCCG_AUDIO_DTO0_MODULE, dto_modulo); | ||
270 | WREG32(DCCG_AUDIO_DTO_SELECT, 0); /* select DTO0 */ | ||
271 | } else { | ||
272 | dto_cntl = RREG32(DCCG_AUDIO_DTO1_CNTL) & ~DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK; | ||
273 | dto_cntl |= DCCG_AUDIO_DTO_WALLCLOCK_RATIO(wallclock_ratio); | ||
274 | WREG32(DCCG_AUDIO_DTO1_CNTL, dto_cntl); | ||
275 | WREG32(DCCG_AUDIO_DTO1_PHASE, dto_phase); | ||
276 | WREG32(DCCG_AUDIO_DTO1_MODULE, dto_modulo); | ||
277 | WREG32(DCCG_AUDIO_DTO_SELECT, 1); /* select DTO1 */ | ||
278 | } | ||
248 | } else { | 279 | } else { |
249 | /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ | 280 | /* according to the reg specs, this should be DCE2.0 and DCE3.0 */ |
250 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | | 281 | WREG32(AUDIO_DTO, AUDIO_DTO_PHASE(base_rate / 10) | |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 8e3fe815edab..7c780839a7f4 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -933,6 +933,9 @@ | |||
933 | #define DCCG_AUDIO_DTO0_LOAD 0x051c | 933 | #define DCCG_AUDIO_DTO0_LOAD 0x051c |
934 | # define DTO_LOAD (1 << 31) | 934 | # define DTO_LOAD (1 << 31) |
935 | #define DCCG_AUDIO_DTO0_CNTL 0x0520 | 935 | #define DCCG_AUDIO_DTO0_CNTL 0x0520 |
936 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO(x) (((x) & 7) << 0) | ||
937 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_MASK 7 | ||
938 | # define DCCG_AUDIO_DTO_WALLCLOCK_RATIO_SHIFT 0 | ||
936 | 939 | ||
937 | #define DCCG_AUDIO_DTO1_PHASE 0x0524 | 940 | #define DCCG_AUDIO_DTO1_PHASE 0x0524 |
938 | #define DCCG_AUDIO_DTO1_MODULE 0x0528 | 941 | #define DCCG_AUDIO_DTO1_MODULE 0x0528 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 2f08219c39b6..274b8e1b889f 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1468,7 +1468,6 @@ struct radeon_uvd { | |||
1468 | void *cpu_addr; | 1468 | void *cpu_addr; |
1469 | uint64_t gpu_addr; | 1469 | uint64_t gpu_addr; |
1470 | void *saved_bo; | 1470 | void *saved_bo; |
1471 | unsigned fw_size; | ||
1472 | atomic_t handles[RADEON_MAX_UVD_HANDLES]; | 1471 | atomic_t handles[RADEON_MAX_UVD_HANDLES]; |
1473 | struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; | 1472 | struct drm_file *filp[RADEON_MAX_UVD_HANDLES]; |
1474 | struct delayed_work idle_work; | 1473 | struct delayed_work idle_work; |
@@ -2066,6 +2065,7 @@ struct radeon_device { | |||
2066 | const struct firmware *mec_fw; /* CIK MEC firmware */ | 2065 | const struct firmware *mec_fw; /* CIK MEC firmware */ |
2067 | const struct firmware *sdma_fw; /* CIK SDMA firmware */ | 2066 | const struct firmware *sdma_fw; /* CIK SDMA firmware */ |
2068 | const struct firmware *smc_fw; /* SMC firmware */ | 2067 | const struct firmware *smc_fw; /* SMC firmware */ |
2068 | const struct firmware *uvd_fw; /* UVD firmware */ | ||
2069 | struct r600_blit r600_blit; | 2069 | struct r600_blit r600_blit; |
2070 | struct r600_vram_scratch vram_scratch; | 2070 | struct r600_vram_scratch vram_scratch; |
2071 | int msi_enabled; /* msi enabled */ | 2071 | int msi_enabled; /* msi enabled */ |
@@ -2095,6 +2095,8 @@ struct radeon_device { | |||
2095 | /* ACPI interface */ | 2095 | /* ACPI interface */ |
2096 | struct radeon_atif atif; | 2096 | struct radeon_atif atif; |
2097 | struct radeon_atcs atcs; | 2097 | struct radeon_atcs atcs; |
2098 | /* srbm instance registers */ | ||
2099 | struct mutex srbm_mutex; | ||
2098 | }; | 2100 | }; |
2099 | 2101 | ||
2100 | int radeon_device_init(struct radeon_device *rdev, | 2102 | int radeon_device_init(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 902479fa737f..3d61d5aac18f 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -441,7 +441,7 @@ void rs780_dpm_debugfs_print_current_performance_level(struct radeon_device *rde | |||
441 | /* uvd */ | 441 | /* uvd */ |
442 | int r600_uvd_init(struct radeon_device *rdev); | 442 | int r600_uvd_init(struct radeon_device *rdev); |
443 | int r600_uvd_rbc_start(struct radeon_device *rdev); | 443 | int r600_uvd_rbc_start(struct radeon_device *rdev); |
444 | void r600_uvd_rbc_stop(struct radeon_device *rdev); | 444 | void r600_uvd_stop(struct radeon_device *rdev); |
445 | int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); | 445 | int r600_uvd_ib_test(struct radeon_device *rdev, struct radeon_ring *ring); |
446 | void r600_uvd_fence_emit(struct radeon_device *rdev, | 446 | void r600_uvd_fence_emit(struct radeon_device *rdev, |
447 | struct radeon_fence *fence); | 447 | struct radeon_fence *fence); |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index e3f3e8841789..4ccd61f60eb6 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -2782,7 +2782,7 @@ int radeon_atom_get_clock_dividers(struct radeon_device *rdev, | |||
2782 | ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN) ? true : false; | 2782 | ATOM_PLL_CNTL_FLAG_PLL_POST_DIV_EN) ? true : false; |
2783 | dividers->enable_dithen = (args.v3.ucCntlFlag & | 2783 | dividers->enable_dithen = (args.v3.ucCntlFlag & |
2784 | ATOM_PLL_CNTL_FLAG_FRACTION_DISABLE) ? false : true; | 2784 | ATOM_PLL_CNTL_FLAG_FRACTION_DISABLE) ? false : true; |
2785 | dividers->fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDiv); | 2785 | dividers->whole_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDiv); |
2786 | dividers->frac_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDivFrac); | 2786 | dividers->frac_fb_div = le16_to_cpu(args.v3.ulFbDiv.usFbDivFrac); |
2787 | dividers->ref_div = args.v3.ucRefDiv; | 2787 | dividers->ref_div = args.v3.ucRefDiv; |
2788 | dividers->vco_mode = (args.v3.ucCntlFlag & | 2788 | dividers->vco_mode = (args.v3.ucCntlFlag & |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 82335e38ec4f..63398ae1dbf5 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -1163,6 +1163,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1163 | mutex_init(&rdev->gem.mutex); | 1163 | mutex_init(&rdev->gem.mutex); |
1164 | mutex_init(&rdev->pm.mutex); | 1164 | mutex_init(&rdev->pm.mutex); |
1165 | mutex_init(&rdev->gpu_clock_mutex); | 1165 | mutex_init(&rdev->gpu_clock_mutex); |
1166 | mutex_init(&rdev->srbm_mutex); | ||
1166 | init_rwsem(&rdev->pm.mclk_lock); | 1167 | init_rwsem(&rdev->pm.mclk_lock); |
1167 | init_rwsem(&rdev->exclusive_lock); | 1168 | init_rwsem(&rdev->exclusive_lock); |
1168 | init_waitqueue_head(&rdev->irq.vblank_queue); | 1169 | init_waitqueue_head(&rdev->irq.vblank_queue); |
@@ -1519,6 +1520,7 @@ int radeon_gpu_reset(struct radeon_device *rdev) | |||
1519 | radeon_save_bios_scratch_regs(rdev); | 1520 | radeon_save_bios_scratch_regs(rdev); |
1520 | /* block TTM */ | 1521 | /* block TTM */ |
1521 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); | 1522 | resched = ttm_bo_lock_delayed_workqueue(&rdev->mman.bdev); |
1523 | radeon_pm_suspend(rdev); | ||
1522 | radeon_suspend(rdev); | 1524 | radeon_suspend(rdev); |
1523 | 1525 | ||
1524 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 1526 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
@@ -1564,6 +1566,7 @@ retry: | |||
1564 | } | 1566 | } |
1565 | } | 1567 | } |
1566 | 1568 | ||
1569 | radeon_pm_resume(rdev); | ||
1567 | drm_helper_resume_force_mode(rdev->ddev); | 1570 | drm_helper_resume_force_mode(rdev->ddev); |
1568 | 1571 | ||
1569 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); | 1572 | ttm_bo_unlock_delayed_workqueue(&rdev->mman.bdev, resched); |
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 7ddb0efe2408..ddb8f8e04eb5 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c | |||
@@ -782,7 +782,7 @@ int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring) | |||
782 | 782 | ||
783 | } else { | 783 | } else { |
784 | /* put fence directly behind firmware */ | 784 | /* put fence directly behind firmware */ |
785 | index = ALIGN(rdev->uvd.fw_size, 8); | 785 | index = ALIGN(rdev->uvd_fw->size, 8); |
786 | rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; | 786 | rdev->fence_drv[ring].cpu_addr = rdev->uvd.cpu_addr + index; |
787 | rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; | 787 | rdev->fence_drv[ring].gpu_addr = rdev->uvd.gpu_addr + index; |
788 | } | 788 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 6a51d943ccf4..b990b1a2bd50 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
@@ -207,7 +207,6 @@ void radeon_gart_table_vram_free(struct radeon_device *rdev) | |||
207 | if (rdev->gart.robj == NULL) { | 207 | if (rdev->gart.robj == NULL) { |
208 | return; | 208 | return; |
209 | } | 209 | } |
210 | radeon_gart_table_vram_unpin(rdev); | ||
211 | radeon_bo_unref(&rdev->gart.robj); | 210 | radeon_bo_unref(&rdev->gart.robj); |
212 | } | 211 | } |
213 | 212 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index f374c467aaca..c557850cd345 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -1176,7 +1176,14 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1176 | case CHIP_VERDE: | 1176 | case CHIP_VERDE: |
1177 | case CHIP_OLAND: | 1177 | case CHIP_OLAND: |
1178 | case CHIP_HAINAN: | 1178 | case CHIP_HAINAN: |
1179 | if (radeon_dpm == 1) | 1179 | /* DPM requires the RLC, RV770+ dGPU requires SMC */ |
1180 | if (!rdev->rlc_fw) | ||
1181 | rdev->pm.pm_method = PM_METHOD_PROFILE; | ||
1182 | else if ((rdev->family >= CHIP_RV770) && | ||
1183 | (!(rdev->flags & RADEON_IS_IGP)) && | ||
1184 | (!rdev->smc_fw)) | ||
1185 | rdev->pm.pm_method = PM_METHOD_PROFILE; | ||
1186 | else if (radeon_dpm == 1) | ||
1180 | rdev->pm.pm_method = PM_METHOD_DPM; | 1187 | rdev->pm.pm_method = PM_METHOD_DPM; |
1181 | else | 1188 | else |
1182 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 1189 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c index 414fd145d20e..f1c15754e73c 100644 --- a/drivers/gpu/drm/radeon/radeon_uvd.c +++ b/drivers/gpu/drm/radeon/radeon_uvd.c | |||
@@ -56,7 +56,6 @@ static void radeon_uvd_idle_work_handler(struct work_struct *work); | |||
56 | 56 | ||
57 | int radeon_uvd_init(struct radeon_device *rdev) | 57 | int radeon_uvd_init(struct radeon_device *rdev) |
58 | { | 58 | { |
59 | const struct firmware *fw; | ||
60 | unsigned long bo_size; | 59 | unsigned long bo_size; |
61 | const char *fw_name; | 60 | const char *fw_name; |
62 | int i, r; | 61 | int i, r; |
@@ -105,14 +104,14 @@ int radeon_uvd_init(struct radeon_device *rdev) | |||
105 | return -EINVAL; | 104 | return -EINVAL; |
106 | } | 105 | } |
107 | 106 | ||
108 | r = request_firmware(&fw, fw_name, rdev->dev); | 107 | r = request_firmware(&rdev->uvd_fw, fw_name, rdev->dev); |
109 | if (r) { | 108 | if (r) { |
110 | dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", | 109 | dev_err(rdev->dev, "radeon_uvd: Can't load firmware \"%s\"\n", |
111 | fw_name); | 110 | fw_name); |
112 | return r; | 111 | return r; |
113 | } | 112 | } |
114 | 113 | ||
115 | bo_size = RADEON_GPU_PAGE_ALIGN(fw->size + 8) + | 114 | bo_size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 8) + |
116 | RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; | 115 | RADEON_UVD_STACK_SIZE + RADEON_UVD_HEAP_SIZE; |
117 | r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, | 116 | r = radeon_bo_create(rdev, bo_size, PAGE_SIZE, true, |
118 | RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); | 117 | RADEON_GEM_DOMAIN_VRAM, NULL, &rdev->uvd.vcpu_bo); |
@@ -145,12 +144,6 @@ int radeon_uvd_init(struct radeon_device *rdev) | |||
145 | 144 | ||
146 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); | 145 | radeon_bo_unreserve(rdev->uvd.vcpu_bo); |
147 | 146 | ||
148 | rdev->uvd.fw_size = fw->size; | ||
149 | memset(rdev->uvd.cpu_addr, 0, bo_size); | ||
150 | memcpy(rdev->uvd.cpu_addr, fw->data, fw->size); | ||
151 | |||
152 | release_firmware(fw); | ||
153 | |||
154 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { | 147 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { |
155 | atomic_set(&rdev->uvd.handles[i], 0); | 148 | atomic_set(&rdev->uvd.handles[i], 0); |
156 | rdev->uvd.filp[i] = NULL; | 149 | rdev->uvd.filp[i] = NULL; |
@@ -174,33 +167,60 @@ void radeon_uvd_fini(struct radeon_device *rdev) | |||
174 | } | 167 | } |
175 | 168 | ||
176 | radeon_bo_unref(&rdev->uvd.vcpu_bo); | 169 | radeon_bo_unref(&rdev->uvd.vcpu_bo); |
170 | |||
171 | release_firmware(rdev->uvd_fw); | ||
177 | } | 172 | } |
178 | 173 | ||
179 | int radeon_uvd_suspend(struct radeon_device *rdev) | 174 | int radeon_uvd_suspend(struct radeon_device *rdev) |
180 | { | 175 | { |
181 | unsigned size; | 176 | unsigned size; |
177 | void *ptr; | ||
178 | int i; | ||
182 | 179 | ||
183 | if (rdev->uvd.vcpu_bo == NULL) | 180 | if (rdev->uvd.vcpu_bo == NULL) |
184 | return 0; | 181 | return 0; |
185 | 182 | ||
183 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) | ||
184 | if (atomic_read(&rdev->uvd.handles[i])) | ||
185 | break; | ||
186 | |||
187 | if (i == RADEON_MAX_UVD_HANDLES) | ||
188 | return 0; | ||
189 | |||
186 | size = radeon_bo_size(rdev->uvd.vcpu_bo); | 190 | size = radeon_bo_size(rdev->uvd.vcpu_bo); |
191 | size -= rdev->uvd_fw->size; | ||
192 | |||
193 | ptr = rdev->uvd.cpu_addr; | ||
194 | ptr += rdev->uvd_fw->size; | ||
195 | |||
187 | rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); | 196 | rdev->uvd.saved_bo = kmalloc(size, GFP_KERNEL); |
188 | memcpy(rdev->uvd.saved_bo, rdev->uvd.cpu_addr, size); | 197 | memcpy(rdev->uvd.saved_bo, ptr, size); |
189 | 198 | ||
190 | return 0; | 199 | return 0; |
191 | } | 200 | } |
192 | 201 | ||
193 | int radeon_uvd_resume(struct radeon_device *rdev) | 202 | int radeon_uvd_resume(struct radeon_device *rdev) |
194 | { | 203 | { |
204 | unsigned size; | ||
205 | void *ptr; | ||
206 | |||
195 | if (rdev->uvd.vcpu_bo == NULL) | 207 | if (rdev->uvd.vcpu_bo == NULL) |
196 | return -EINVAL; | 208 | return -EINVAL; |
197 | 209 | ||
210 | memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size); | ||
211 | |||
212 | size = radeon_bo_size(rdev->uvd.vcpu_bo); | ||
213 | size -= rdev->uvd_fw->size; | ||
214 | |||
215 | ptr = rdev->uvd.cpu_addr; | ||
216 | ptr += rdev->uvd_fw->size; | ||
217 | |||
198 | if (rdev->uvd.saved_bo != NULL) { | 218 | if (rdev->uvd.saved_bo != NULL) { |
199 | unsigned size = radeon_bo_size(rdev->uvd.vcpu_bo); | 219 | memcpy(ptr, rdev->uvd.saved_bo, size); |
200 | memcpy(rdev->uvd.cpu_addr, rdev->uvd.saved_bo, size); | ||
201 | kfree(rdev->uvd.saved_bo); | 220 | kfree(rdev->uvd.saved_bo); |
202 | rdev->uvd.saved_bo = NULL; | 221 | rdev->uvd.saved_bo = NULL; |
203 | } | 222 | } else |
223 | memset(ptr, 0, size); | ||
204 | 224 | ||
205 | return 0; | 225 | return 0; |
206 | } | 226 | } |
@@ -215,8 +235,8 @@ void radeon_uvd_free_handles(struct radeon_device *rdev, struct drm_file *filp) | |||
215 | { | 235 | { |
216 | int i, r; | 236 | int i, r; |
217 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { | 237 | for (i = 0; i < RADEON_MAX_UVD_HANDLES; ++i) { |
218 | if (rdev->uvd.filp[i] == filp) { | 238 | uint32_t handle = atomic_read(&rdev->uvd.handles[i]); |
219 | uint32_t handle = atomic_read(&rdev->uvd.handles[i]); | 239 | if (handle != 0 && rdev->uvd.filp[i] == filp) { |
220 | struct radeon_fence *fence; | 240 | struct radeon_fence *fence; |
221 | 241 | ||
222 | r = radeon_uvd_get_destroy_msg(rdev, | 242 | r = radeon_uvd_get_destroy_msg(rdev, |
@@ -337,8 +357,10 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
337 | } | 357 | } |
338 | 358 | ||
339 | r = radeon_bo_kmap(bo, &ptr); | 359 | r = radeon_bo_kmap(bo, &ptr); |
340 | if (r) | 360 | if (r) { |
361 | DRM_ERROR("Failed mapping the UVD message (%d)!\n", r); | ||
341 | return r; | 362 | return r; |
363 | } | ||
342 | 364 | ||
343 | msg = ptr + offset; | 365 | msg = ptr + offset; |
344 | 366 | ||
@@ -364,8 +386,14 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
364 | radeon_bo_kunmap(bo); | 386 | radeon_bo_kunmap(bo); |
365 | return 0; | 387 | return 0; |
366 | } else { | 388 | } else { |
367 | /* it's a create msg, no special handling needed */ | ||
368 | radeon_bo_kunmap(bo); | 389 | radeon_bo_kunmap(bo); |
390 | |||
391 | if (msg_type != 0) { | ||
392 | DRM_ERROR("Illegal UVD message type (%d)!\n", msg_type); | ||
393 | return -EINVAL; | ||
394 | } | ||
395 | |||
396 | /* it's a create msg, no special handling needed */ | ||
369 | } | 397 | } |
370 | 398 | ||
371 | /* create or decode, validate the handle */ | 399 | /* create or decode, validate the handle */ |
@@ -388,7 +416,7 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, | |||
388 | 416 | ||
389 | static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | 417 | static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, |
390 | int data0, int data1, | 418 | int data0, int data1, |
391 | unsigned buf_sizes[]) | 419 | unsigned buf_sizes[], bool *has_msg_cmd) |
392 | { | 420 | { |
393 | struct radeon_cs_chunk *relocs_chunk; | 421 | struct radeon_cs_chunk *relocs_chunk; |
394 | struct radeon_cs_reloc *reloc; | 422 | struct radeon_cs_reloc *reloc; |
@@ -417,7 +445,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
417 | 445 | ||
418 | if (cmd < 0x4) { | 446 | if (cmd < 0x4) { |
419 | if ((end - start) < buf_sizes[cmd]) { | 447 | if ((end - start) < buf_sizes[cmd]) { |
420 | DRM_ERROR("buffer to small (%d / %d)!\n", | 448 | DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd, |
421 | (unsigned)(end - start), buf_sizes[cmd]); | 449 | (unsigned)(end - start), buf_sizes[cmd]); |
422 | return -EINVAL; | 450 | return -EINVAL; |
423 | } | 451 | } |
@@ -442,9 +470,17 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
442 | } | 470 | } |
443 | 471 | ||
444 | if (cmd == 0) { | 472 | if (cmd == 0) { |
473 | if (*has_msg_cmd) { | ||
474 | DRM_ERROR("More than one message in a UVD-IB!\n"); | ||
475 | return -EINVAL; | ||
476 | } | ||
477 | *has_msg_cmd = true; | ||
445 | r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); | 478 | r = radeon_uvd_cs_msg(p, reloc->robj, offset, buf_sizes); |
446 | if (r) | 479 | if (r) |
447 | return r; | 480 | return r; |
481 | } else if (!*has_msg_cmd) { | ||
482 | DRM_ERROR("Message needed before other commands are send!\n"); | ||
483 | return -EINVAL; | ||
448 | } | 484 | } |
449 | 485 | ||
450 | return 0; | 486 | return 0; |
@@ -453,7 +489,8 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p, | |||
453 | static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, | 489 | static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, |
454 | struct radeon_cs_packet *pkt, | 490 | struct radeon_cs_packet *pkt, |
455 | int *data0, int *data1, | 491 | int *data0, int *data1, |
456 | unsigned buf_sizes[]) | 492 | unsigned buf_sizes[], |
493 | bool *has_msg_cmd) | ||
457 | { | 494 | { |
458 | int i, r; | 495 | int i, r; |
459 | 496 | ||
@@ -467,7 +504,8 @@ static int radeon_uvd_cs_reg(struct radeon_cs_parser *p, | |||
467 | *data1 = p->idx; | 504 | *data1 = p->idx; |
468 | break; | 505 | break; |
469 | case UVD_GPCOM_VCPU_CMD: | 506 | case UVD_GPCOM_VCPU_CMD: |
470 | r = radeon_uvd_cs_reloc(p, *data0, *data1, buf_sizes); | 507 | r = radeon_uvd_cs_reloc(p, *data0, *data1, |
508 | buf_sizes, has_msg_cmd); | ||
471 | if (r) | 509 | if (r) |
472 | return r; | 510 | return r; |
473 | break; | 511 | break; |
@@ -488,6 +526,9 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
488 | struct radeon_cs_packet pkt; | 526 | struct radeon_cs_packet pkt; |
489 | int r, data0 = 0, data1 = 0; | 527 | int r, data0 = 0, data1 = 0; |
490 | 528 | ||
529 | /* does the IB has a msg command */ | ||
530 | bool has_msg_cmd = false; | ||
531 | |||
491 | /* minimum buffer sizes */ | 532 | /* minimum buffer sizes */ |
492 | unsigned buf_sizes[] = { | 533 | unsigned buf_sizes[] = { |
493 | [0x00000000] = 2048, | 534 | [0x00000000] = 2048, |
@@ -514,8 +555,8 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
514 | return r; | 555 | return r; |
515 | switch (pkt.type) { | 556 | switch (pkt.type) { |
516 | case RADEON_PACKET_TYPE0: | 557 | case RADEON_PACKET_TYPE0: |
517 | r = radeon_uvd_cs_reg(p, &pkt, &data0, | 558 | r = radeon_uvd_cs_reg(p, &pkt, &data0, &data1, |
518 | &data1, buf_sizes); | 559 | buf_sizes, &has_msg_cmd); |
519 | if (r) | 560 | if (r) |
520 | return r; | 561 | return r; |
521 | break; | 562 | break; |
@@ -527,6 +568,12 @@ int radeon_uvd_cs_parse(struct radeon_cs_parser *p) | |||
527 | return -EINVAL; | 568 | return -EINVAL; |
528 | } | 569 | } |
529 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 570 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); |
571 | |||
572 | if (!has_msg_cmd) { | ||
573 | DRM_ERROR("UVD-IBs need a msg command!\n"); | ||
574 | return -EINVAL; | ||
575 | } | ||
576 | |||
530 | return 0; | 577 | return 0; |
531 | } | 578 | } |
532 | 579 | ||
diff --git a/drivers/gpu/drm/radeon/rv6xx_dpm.c b/drivers/gpu/drm/radeon/rv6xx_dpm.c index 363018c60412..bdd888b4db2b 100644 --- a/drivers/gpu/drm/radeon/rv6xx_dpm.c +++ b/drivers/gpu/drm/radeon/rv6xx_dpm.c | |||
@@ -1944,9 +1944,7 @@ static int rv6xx_parse_power_table(struct radeon_device *rdev) | |||
1944 | 1944 | ||
1945 | int rv6xx_dpm_init(struct radeon_device *rdev) | 1945 | int rv6xx_dpm_init(struct radeon_device *rdev) |
1946 | { | 1946 | { |
1947 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | 1947 | struct radeon_atom_ss ss; |
1948 | uint16_t data_offset, size; | ||
1949 | uint8_t frev, crev; | ||
1950 | struct atom_clock_dividers dividers; | 1948 | struct atom_clock_dividers dividers; |
1951 | struct rv6xx_power_info *pi; | 1949 | struct rv6xx_power_info *pi; |
1952 | int ret; | 1950 | int ret; |
@@ -1989,16 +1987,18 @@ int rv6xx_dpm_init(struct radeon_device *rdev) | |||
1989 | 1987 | ||
1990 | pi->gfx_clock_gating = true; | 1988 | pi->gfx_clock_gating = true; |
1991 | 1989 | ||
1992 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 1990 | pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, |
1993 | &frev, &crev, &data_offset)) { | 1991 | ASIC_INTERNAL_ENGINE_SS, 0); |
1994 | pi->sclk_ss = true; | 1992 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, |
1995 | pi->mclk_ss = true; | 1993 | ASIC_INTERNAL_MEMORY_SS, 0); |
1994 | |||
1995 | /* Disable sclk ss, causes hangs on a lot of systems */ | ||
1996 | pi->sclk_ss = false; | ||
1997 | |||
1998 | if (pi->sclk_ss || pi->mclk_ss) | ||
1996 | pi->dynamic_ss = true; | 1999 | pi->dynamic_ss = true; |
1997 | } else { | 2000 | else |
1998 | pi->sclk_ss = false; | ||
1999 | pi->mclk_ss = false; | ||
2000 | pi->dynamic_ss = false; | 2001 | pi->dynamic_ss = false; |
2001 | } | ||
2002 | 2002 | ||
2003 | pi->dynamic_pcie_gen2 = true; | 2003 | pi->dynamic_pcie_gen2 = true; |
2004 | 2004 | ||
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 30ea14e8854c..bcc68ec204ad 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -813,7 +813,7 @@ int rv770_uvd_resume(struct radeon_device *rdev) | |||
813 | 813 | ||
814 | /* programm the VCPU memory controller bits 0-27 */ | 814 | /* programm the VCPU memory controller bits 0-27 */ |
815 | addr = rdev->uvd.gpu_addr >> 3; | 815 | addr = rdev->uvd.gpu_addr >> 3; |
816 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd.fw_size + 4) >> 3; | 816 | size = RADEON_GPU_PAGE_ALIGN(rdev->uvd_fw->size + 4) >> 3; |
817 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); | 817 | WREG32(UVD_VCPU_CACHE_OFFSET0, addr); |
818 | WREG32(UVD_VCPU_CACHE_SIZE0, size); | 818 | WREG32(UVD_VCPU_CACHE_SIZE0, size); |
819 | 819 | ||
@@ -1829,6 +1829,8 @@ static int rv770_startup(struct radeon_device *rdev) | |||
1829 | /* enable pcie gen2 link */ | 1829 | /* enable pcie gen2 link */ |
1830 | rv770_pcie_gen2_enable(rdev); | 1830 | rv770_pcie_gen2_enable(rdev); |
1831 | 1831 | ||
1832 | rv770_mc_program(rdev); | ||
1833 | |||
1832 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { | 1834 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) { |
1833 | r = r600_init_microcode(rdev); | 1835 | r = r600_init_microcode(rdev); |
1834 | if (r) { | 1836 | if (r) { |
@@ -1841,7 +1843,6 @@ static int rv770_startup(struct radeon_device *rdev) | |||
1841 | if (r) | 1843 | if (r) |
1842 | return r; | 1844 | return r; |
1843 | 1845 | ||
1844 | rv770_mc_program(rdev); | ||
1845 | if (rdev->flags & RADEON_IS_AGP) { | 1846 | if (rdev->flags & RADEON_IS_AGP) { |
1846 | rv770_agp_enable(rdev); | 1847 | rv770_agp_enable(rdev); |
1847 | } else { | 1848 | } else { |
@@ -1983,6 +1984,7 @@ int rv770_resume(struct radeon_device *rdev) | |||
1983 | int rv770_suspend(struct radeon_device *rdev) | 1984 | int rv770_suspend(struct radeon_device *rdev) |
1984 | { | 1985 | { |
1985 | r600_audio_fini(rdev); | 1986 | r600_audio_fini(rdev); |
1987 | r600_uvd_stop(rdev); | ||
1986 | radeon_uvd_suspend(rdev); | 1988 | radeon_uvd_suspend(rdev); |
1987 | r700_cp_stop(rdev); | 1989 | r700_cp_stop(rdev); |
1988 | r600_dma_stop(rdev); | 1990 | r600_dma_stop(rdev); |
@@ -2098,6 +2100,7 @@ void rv770_fini(struct radeon_device *rdev) | |||
2098 | radeon_ib_pool_fini(rdev); | 2100 | radeon_ib_pool_fini(rdev); |
2099 | radeon_irq_kms_fini(rdev); | 2101 | radeon_irq_kms_fini(rdev); |
2100 | rv770_pcie_gart_fini(rdev); | 2102 | rv770_pcie_gart_fini(rdev); |
2103 | r600_uvd_stop(rdev); | ||
2101 | radeon_uvd_fini(rdev); | 2104 | radeon_uvd_fini(rdev); |
2102 | r600_vram_scratch_fini(rdev); | 2105 | r600_vram_scratch_fini(rdev); |
2103 | radeon_gem_fini(rdev); | 2106 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.c b/drivers/gpu/drm/radeon/rv770_dpm.c index 2d347925f77d..094c67a29d0d 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.c +++ b/drivers/gpu/drm/radeon/rv770_dpm.c | |||
@@ -2319,12 +2319,25 @@ int rv7xx_parse_power_table(struct radeon_device *rdev) | |||
2319 | return 0; | 2319 | return 0; |
2320 | } | 2320 | } |
2321 | 2321 | ||
2322 | void rv770_get_engine_memory_ss(struct radeon_device *rdev) | ||
2323 | { | ||
2324 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | ||
2325 | struct radeon_atom_ss ss; | ||
2326 | |||
2327 | pi->sclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
2328 | ASIC_INTERNAL_ENGINE_SS, 0); | ||
2329 | pi->mclk_ss = radeon_atombios_get_asic_ss_info(rdev, &ss, | ||
2330 | ASIC_INTERNAL_MEMORY_SS, 0); | ||
2331 | |||
2332 | if (pi->sclk_ss || pi->mclk_ss) | ||
2333 | pi->dynamic_ss = true; | ||
2334 | else | ||
2335 | pi->dynamic_ss = false; | ||
2336 | } | ||
2337 | |||
2322 | int rv770_dpm_init(struct radeon_device *rdev) | 2338 | int rv770_dpm_init(struct radeon_device *rdev) |
2323 | { | 2339 | { |
2324 | struct rv7xx_power_info *pi; | 2340 | struct rv7xx_power_info *pi; |
2325 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
2326 | uint16_t data_offset, size; | ||
2327 | uint8_t frev, crev; | ||
2328 | struct atom_clock_dividers dividers; | 2341 | struct atom_clock_dividers dividers; |
2329 | int ret; | 2342 | int ret; |
2330 | 2343 | ||
@@ -2369,16 +2382,7 @@ int rv770_dpm_init(struct radeon_device *rdev) | |||
2369 | pi->mvdd_control = | 2382 | pi->mvdd_control = |
2370 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); | 2383 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); |
2371 | 2384 | ||
2372 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 2385 | rv770_get_engine_memory_ss(rdev); |
2373 | &frev, &crev, &data_offset)) { | ||
2374 | pi->sclk_ss = true; | ||
2375 | pi->mclk_ss = true; | ||
2376 | pi->dynamic_ss = true; | ||
2377 | } else { | ||
2378 | pi->sclk_ss = false; | ||
2379 | pi->mclk_ss = false; | ||
2380 | pi->dynamic_ss = false; | ||
2381 | } | ||
2382 | 2386 | ||
2383 | pi->asi = RV770_ASI_DFLT; | 2387 | pi->asi = RV770_ASI_DFLT; |
2384 | pi->pasi = RV770_HASI_DFLT; | 2388 | pi->pasi = RV770_HASI_DFLT; |
@@ -2393,8 +2397,7 @@ int rv770_dpm_init(struct radeon_device *rdev) | |||
2393 | 2397 | ||
2394 | pi->dynamic_pcie_gen2 = true; | 2398 | pi->dynamic_pcie_gen2 = true; |
2395 | 2399 | ||
2396 | if (pi->gfx_clock_gating && | 2400 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
2397 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
2398 | pi->thermal_protection = true; | 2401 | pi->thermal_protection = true; |
2399 | else | 2402 | else |
2400 | pi->thermal_protection = false; | 2403 | pi->thermal_protection = false; |
diff --git a/drivers/gpu/drm/radeon/rv770_dpm.h b/drivers/gpu/drm/radeon/rv770_dpm.h index 96b1b2a62a8a..9244effc6b59 100644 --- a/drivers/gpu/drm/radeon/rv770_dpm.h +++ b/drivers/gpu/drm/radeon/rv770_dpm.h | |||
@@ -275,6 +275,7 @@ void rv770_set_uvd_clock_before_set_eng_clock(struct radeon_device *rdev, | |||
275 | void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, | 275 | void rv770_set_uvd_clock_after_set_eng_clock(struct radeon_device *rdev, |
276 | struct radeon_ps *new_ps, | 276 | struct radeon_ps *new_ps, |
277 | struct radeon_ps *old_ps); | 277 | struct radeon_ps *old_ps); |
278 | void rv770_get_engine_memory_ss(struct radeon_device *rdev); | ||
278 | 279 | ||
279 | /* smc */ | 280 | /* smc */ |
280 | int rv770_read_smc_soft_register(struct radeon_device *rdev, | 281 | int rv770_read_smc_soft_register(struct radeon_device *rdev, |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index d325280e2f9f..daa8d2df8ec5 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -1663,9 +1663,13 @@ static int si_init_microcode(struct radeon_device *rdev) | |||
1663 | 1663 | ||
1664 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); | 1664 | snprintf(fw_name, sizeof(fw_name), "radeon/%s_smc.bin", chip_name); |
1665 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); | 1665 | err = request_firmware(&rdev->smc_fw, fw_name, rdev->dev); |
1666 | if (err) | 1666 | if (err) { |
1667 | goto out; | 1667 | printk(KERN_ERR |
1668 | if (rdev->smc_fw->size != smc_req_size) { | 1668 | "smc: error loading firmware \"%s\"\n", |
1669 | fw_name); | ||
1670 | release_firmware(rdev->smc_fw); | ||
1671 | rdev->smc_fw = NULL; | ||
1672 | } else if (rdev->smc_fw->size != smc_req_size) { | ||
1669 | printk(KERN_ERR | 1673 | printk(KERN_ERR |
1670 | "si_smc: Bogus length %zu in firmware \"%s\"\n", | 1674 | "si_smc: Bogus length %zu in firmware \"%s\"\n", |
1671 | rdev->smc_fw->size, fw_name); | 1675 | rdev->smc_fw->size, fw_name); |
@@ -5215,14 +5219,12 @@ static void si_enable_mc_ls(struct radeon_device *rdev, | |||
5215 | 5219 | ||
5216 | static void si_init_cg(struct radeon_device *rdev) | 5220 | static void si_init_cg(struct radeon_device *rdev) |
5217 | { | 5221 | { |
5218 | bool has_uvd = true; | ||
5219 | |||
5220 | si_enable_mgcg(rdev, true); | 5222 | si_enable_mgcg(rdev, true); |
5221 | si_enable_cgcg(rdev, true); | 5223 | si_enable_cgcg(rdev, false); |
5222 | /* disable MC LS on Tahiti */ | 5224 | /* disable MC LS on Tahiti */ |
5223 | if (rdev->family == CHIP_TAHITI) | 5225 | if (rdev->family == CHIP_TAHITI) |
5224 | si_enable_mc_ls(rdev, false); | 5226 | si_enable_mc_ls(rdev, false); |
5225 | if (has_uvd) { | 5227 | if (rdev->has_uvd) { |
5226 | si_enable_uvd_mgcg(rdev, true); | 5228 | si_enable_uvd_mgcg(rdev, true); |
5227 | si_init_uvd_internal_cg(rdev); | 5229 | si_init_uvd_internal_cg(rdev); |
5228 | } | 5230 | } |
@@ -5230,9 +5232,7 @@ static void si_init_cg(struct radeon_device *rdev) | |||
5230 | 5232 | ||
5231 | static void si_fini_cg(struct radeon_device *rdev) | 5233 | static void si_fini_cg(struct radeon_device *rdev) |
5232 | { | 5234 | { |
5233 | bool has_uvd = true; | 5235 | if (rdev->has_uvd) |
5234 | |||
5235 | if (has_uvd) | ||
5236 | si_enable_uvd_mgcg(rdev, false); | 5236 | si_enable_uvd_mgcg(rdev, false); |
5237 | si_enable_cgcg(rdev, false); | 5237 | si_enable_cgcg(rdev, false); |
5238 | si_enable_mgcg(rdev, false); | 5238 | si_enable_mgcg(rdev, false); |
@@ -5241,11 +5241,11 @@ static void si_fini_cg(struct radeon_device *rdev) | |||
5241 | static void si_init_pg(struct radeon_device *rdev) | 5241 | static void si_init_pg(struct radeon_device *rdev) |
5242 | { | 5242 | { |
5243 | bool has_pg = false; | 5243 | bool has_pg = false; |
5244 | 5244 | #if 0 | |
5245 | /* only cape verde supports PG */ | 5245 | /* only cape verde supports PG */ |
5246 | if (rdev->family == CHIP_VERDE) | 5246 | if (rdev->family == CHIP_VERDE) |
5247 | has_pg = true; | 5247 | has_pg = true; |
5248 | 5248 | #endif | |
5249 | if (has_pg) { | 5249 | if (has_pg) { |
5250 | si_init_ao_cu_mask(rdev); | 5250 | si_init_ao_cu_mask(rdev); |
5251 | si_init_dma_pg(rdev); | 5251 | si_init_dma_pg(rdev); |
@@ -6422,6 +6422,8 @@ static int si_startup(struct radeon_device *rdev) | |||
6422 | /* enable aspm */ | 6422 | /* enable aspm */ |
6423 | si_program_aspm(rdev); | 6423 | si_program_aspm(rdev); |
6424 | 6424 | ||
6425 | si_mc_program(rdev); | ||
6426 | |||
6425 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || | 6427 | if (!rdev->me_fw || !rdev->pfp_fw || !rdev->ce_fw || |
6426 | !rdev->rlc_fw || !rdev->mc_fw) { | 6428 | !rdev->rlc_fw || !rdev->mc_fw) { |
6427 | r = si_init_microcode(rdev); | 6429 | r = si_init_microcode(rdev); |
@@ -6441,7 +6443,6 @@ static int si_startup(struct radeon_device *rdev) | |||
6441 | if (r) | 6443 | if (r) |
6442 | return r; | 6444 | return r; |
6443 | 6445 | ||
6444 | si_mc_program(rdev); | ||
6445 | r = si_pcie_gart_enable(rdev); | 6446 | r = si_pcie_gart_enable(rdev); |
6446 | if (r) | 6447 | if (r) |
6447 | return r; | 6448 | return r; |
@@ -6625,7 +6626,7 @@ int si_suspend(struct radeon_device *rdev) | |||
6625 | si_cp_enable(rdev, false); | 6626 | si_cp_enable(rdev, false); |
6626 | cayman_dma_stop(rdev); | 6627 | cayman_dma_stop(rdev); |
6627 | if (rdev->has_uvd) { | 6628 | if (rdev->has_uvd) { |
6628 | r600_uvd_rbc_stop(rdev); | 6629 | r600_uvd_stop(rdev); |
6629 | radeon_uvd_suspend(rdev); | 6630 | radeon_uvd_suspend(rdev); |
6630 | } | 6631 | } |
6631 | si_irq_suspend(rdev); | 6632 | si_irq_suspend(rdev); |
@@ -6767,8 +6768,10 @@ void si_fini(struct radeon_device *rdev) | |||
6767 | radeon_vm_manager_fini(rdev); | 6768 | radeon_vm_manager_fini(rdev); |
6768 | radeon_ib_pool_fini(rdev); | 6769 | radeon_ib_pool_fini(rdev); |
6769 | radeon_irq_kms_fini(rdev); | 6770 | radeon_irq_kms_fini(rdev); |
6770 | if (rdev->has_uvd) | 6771 | if (rdev->has_uvd) { |
6772 | r600_uvd_stop(rdev); | ||
6771 | radeon_uvd_fini(rdev); | 6773 | radeon_uvd_fini(rdev); |
6774 | } | ||
6772 | si_pcie_gart_fini(rdev); | 6775 | si_pcie_gart_fini(rdev); |
6773 | r600_vram_scratch_fini(rdev); | 6776 | r600_vram_scratch_fini(rdev); |
6774 | radeon_gem_fini(rdev); | 6777 | radeon_gem_fini(rdev); |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index 73aaa2e4c312..88699e3cd868 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -37,8 +37,6 @@ | |||
37 | 37 | ||
38 | #define SMC_RAM_END 0x20000 | 38 | #define SMC_RAM_END 0x20000 |
39 | 39 | ||
40 | #define DDR3_DRAM_ROWS 0x2000 | ||
41 | |||
42 | #define SCLK_MIN_DEEPSLEEP_FREQ 1350 | 40 | #define SCLK_MIN_DEEPSLEEP_FREQ 1350 |
43 | 41 | ||
44 | static const struct si_cac_config_reg cac_weights_tahiti[] = | 42 | static const struct si_cac_config_reg cac_weights_tahiti[] = |
@@ -1767,8 +1765,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe | |||
1767 | { | 1765 | { |
1768 | s64 kt, kv, leakage_w, i_leakage, vddc; | 1766 | s64 kt, kv, leakage_w, i_leakage, vddc; |
1769 | s64 temperature, t_slope, t_intercept, av, bv, t_ref; | 1767 | s64 temperature, t_slope, t_intercept, av, bv, t_ref; |
1768 | s64 tmp; | ||
1770 | 1769 | ||
1771 | i_leakage = drm_int2fixp(ileakage / 100); | 1770 | i_leakage = div64_s64(drm_int2fixp(ileakage), 100); |
1772 | vddc = div64_s64(drm_int2fixp(v), 1000); | 1771 | vddc = div64_s64(drm_int2fixp(v), 1000); |
1773 | temperature = div64_s64(drm_int2fixp(t), 1000); | 1772 | temperature = div64_s64(drm_int2fixp(t), 1000); |
1774 | 1773 | ||
@@ -1778,8 +1777,9 @@ static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coe | |||
1778 | bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); | 1777 | bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); |
1779 | t_ref = drm_int2fixp(coeff->t_ref); | 1778 | t_ref = drm_int2fixp(coeff->t_ref); |
1780 | 1779 | ||
1781 | kt = drm_fixp_div(drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, temperature)), | 1780 | tmp = drm_fixp_mul(t_slope, vddc) + t_intercept; |
1782 | drm_fixp_exp(drm_fixp_mul(drm_fixp_mul(t_slope, vddc) + t_intercept, t_ref))); | 1781 | kt = drm_fixp_exp(drm_fixp_mul(tmp, temperature)); |
1782 | kt = drm_fixp_div(kt, drm_fixp_exp(drm_fixp_mul(tmp, t_ref))); | ||
1783 | kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); | 1783 | kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); |
1784 | 1784 | ||
1785 | leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); | 1785 | leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); |
@@ -1931,6 +1931,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) | |||
1931 | si_pi->cac_override = cac_override_pitcairn; | 1931 | si_pi->cac_override = cac_override_pitcairn; |
1932 | si_pi->powertune_data = &powertune_data_pitcairn; | 1932 | si_pi->powertune_data = &powertune_data_pitcairn; |
1933 | si_pi->dte_data = dte_data_pitcairn; | 1933 | si_pi->dte_data = dte_data_pitcairn; |
1934 | break; | ||
1934 | } | 1935 | } |
1935 | } else if (rdev->family == CHIP_VERDE) { | 1936 | } else if (rdev->family == CHIP_VERDE) { |
1936 | si_pi->lcac_config = lcac_cape_verde; | 1937 | si_pi->lcac_config = lcac_cape_verde; |
@@ -1941,6 +1942,7 @@ static void si_initialize_powertune_defaults(struct radeon_device *rdev) | |||
1941 | case 0x683B: | 1942 | case 0x683B: |
1942 | case 0x683F: | 1943 | case 0x683F: |
1943 | case 0x6829: | 1944 | case 0x6829: |
1945 | case 0x6835: | ||
1944 | si_pi->cac_weights = cac_weights_cape_verde_pro; | 1946 | si_pi->cac_weights = cac_weights_cape_verde_pro; |
1945 | si_pi->dte_data = dte_data_cape_verde; | 1947 | si_pi->dte_data = dte_data_cape_verde; |
1946 | break; | 1948 | break; |
@@ -2901,7 +2903,8 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2901 | { | 2903 | { |
2902 | struct ni_ps *ps = ni_get_ps(rps); | 2904 | struct ni_ps *ps = ni_get_ps(rps); |
2903 | struct radeon_clock_and_voltage_limits *max_limits; | 2905 | struct radeon_clock_and_voltage_limits *max_limits; |
2904 | bool disable_mclk_switching; | 2906 | bool disable_mclk_switching = false; |
2907 | bool disable_sclk_switching = false; | ||
2905 | u32 mclk, sclk; | 2908 | u32 mclk, sclk; |
2906 | u16 vddc, vddci; | 2909 | u16 vddc, vddci; |
2907 | int i; | 2910 | int i; |
@@ -2909,8 +2912,11 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2909 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || | 2912 | if ((rdev->pm.dpm.new_active_crtc_count > 1) || |
2910 | ni_dpm_vblank_too_short(rdev)) | 2913 | ni_dpm_vblank_too_short(rdev)) |
2911 | disable_mclk_switching = true; | 2914 | disable_mclk_switching = true; |
2912 | else | 2915 | |
2913 | disable_mclk_switching = false; | 2916 | if (rps->vclk || rps->dclk) { |
2917 | disable_mclk_switching = true; | ||
2918 | disable_sclk_switching = true; | ||
2919 | } | ||
2914 | 2920 | ||
2915 | if (rdev->pm.dpm.ac_power) | 2921 | if (rdev->pm.dpm.ac_power) |
2916 | max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; | 2922 | max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; |
@@ -2938,27 +2944,43 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev, | |||
2938 | 2944 | ||
2939 | if (disable_mclk_switching) { | 2945 | if (disable_mclk_switching) { |
2940 | mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; | 2946 | mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; |
2941 | sclk = ps->performance_levels[0].sclk; | ||
2942 | vddc = ps->performance_levels[0].vddc; | ||
2943 | vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; | 2947 | vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; |
2944 | } else { | 2948 | } else { |
2945 | sclk = ps->performance_levels[0].sclk; | ||
2946 | mclk = ps->performance_levels[0].mclk; | 2949 | mclk = ps->performance_levels[0].mclk; |
2947 | vddc = ps->performance_levels[0].vddc; | ||
2948 | vddci = ps->performance_levels[0].vddci; | 2950 | vddci = ps->performance_levels[0].vddci; |
2949 | } | 2951 | } |
2950 | 2952 | ||
2953 | if (disable_sclk_switching) { | ||
2954 | sclk = ps->performance_levels[ps->performance_level_count - 1].sclk; | ||
2955 | vddc = ps->performance_levels[ps->performance_level_count - 1].vddc; | ||
2956 | } else { | ||
2957 | sclk = ps->performance_levels[0].sclk; | ||
2958 | vddc = ps->performance_levels[0].vddc; | ||
2959 | } | ||
2960 | |||
2951 | /* adjusted low state */ | 2961 | /* adjusted low state */ |
2952 | ps->performance_levels[0].sclk = sclk; | 2962 | ps->performance_levels[0].sclk = sclk; |
2953 | ps->performance_levels[0].mclk = mclk; | 2963 | ps->performance_levels[0].mclk = mclk; |
2954 | ps->performance_levels[0].vddc = vddc; | 2964 | ps->performance_levels[0].vddc = vddc; |
2955 | ps->performance_levels[0].vddci = vddci; | 2965 | ps->performance_levels[0].vddci = vddci; |
2956 | 2966 | ||
2957 | for (i = 1; i < ps->performance_level_count; i++) { | 2967 | if (disable_sclk_switching) { |
2958 | if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) | 2968 | sclk = ps->performance_levels[0].sclk; |
2959 | ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; | 2969 | for (i = 1; i < ps->performance_level_count; i++) { |
2960 | if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) | 2970 | if (sclk < ps->performance_levels[i].sclk) |
2961 | ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; | 2971 | sclk = ps->performance_levels[i].sclk; |
2972 | } | ||
2973 | for (i = 0; i < ps->performance_level_count; i++) { | ||
2974 | ps->performance_levels[i].sclk = sclk; | ||
2975 | ps->performance_levels[i].vddc = vddc; | ||
2976 | } | ||
2977 | } else { | ||
2978 | for (i = 1; i < ps->performance_level_count; i++) { | ||
2979 | if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) | ||
2980 | ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; | ||
2981 | if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) | ||
2982 | ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; | ||
2983 | } | ||
2962 | } | 2984 | } |
2963 | 2985 | ||
2964 | if (disable_mclk_switching) { | 2986 | if (disable_mclk_switching) { |
@@ -3237,10 +3259,10 @@ int si_dpm_force_performance_level(struct radeon_device *rdev, | |||
3237 | { | 3259 | { |
3238 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; | 3260 | struct radeon_ps *rps = rdev->pm.dpm.current_ps; |
3239 | struct ni_ps *ps = ni_get_ps(rps); | 3261 | struct ni_ps *ps = ni_get_ps(rps); |
3240 | u32 levels; | 3262 | u32 levels = ps->performance_level_count; |
3241 | 3263 | ||
3242 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { | 3264 | if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { |
3243 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) | 3265 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) |
3244 | return -EINVAL; | 3266 | return -EINVAL; |
3245 | 3267 | ||
3246 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK) | 3268 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK) |
@@ -3249,14 +3271,13 @@ int si_dpm_force_performance_level(struct radeon_device *rdev, | |||
3249 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 3271 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
3250 | return -EINVAL; | 3272 | return -EINVAL; |
3251 | 3273 | ||
3252 | levels = ps->performance_level_count - 1; | 3274 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) != PPSMC_Result_OK) |
3253 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) | ||
3254 | return -EINVAL; | 3275 | return -EINVAL; |
3255 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { | 3276 | } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { |
3256 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) | 3277 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) |
3257 | return -EINVAL; | 3278 | return -EINVAL; |
3258 | 3279 | ||
3259 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 0) != PPSMC_Result_OK) | 3280 | if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) |
3260 | return -EINVAL; | 3281 | return -EINVAL; |
3261 | } | 3282 | } |
3262 | 3283 | ||
@@ -3620,8 +3641,12 @@ static void si_enable_display_gap(struct radeon_device *rdev) | |||
3620 | { | 3641 | { |
3621 | u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); | 3642 | u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); |
3622 | 3643 | ||
3644 | tmp &= ~(DISP1_GAP_MASK | DISP2_GAP_MASK); | ||
3645 | tmp |= (DISP1_GAP(R600_PM_DISPLAY_GAP_IGNORE) | | ||
3646 | DISP2_GAP(R600_PM_DISPLAY_GAP_IGNORE)); | ||
3647 | |||
3623 | tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); | 3648 | tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); |
3624 | tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE) | | 3649 | tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK) | |
3625 | DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE)); | 3650 | DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE)); |
3626 | WREG32(CG_DISPLAY_GAP_CNTL, tmp); | 3651 | WREG32(CG_DISPLAY_GAP_CNTL, tmp); |
3627 | } | 3652 | } |
@@ -4036,16 +4061,15 @@ static int si_force_switch_to_arb_f0(struct radeon_device *rdev) | |||
4036 | static u32 si_calculate_memory_refresh_rate(struct radeon_device *rdev, | 4061 | static u32 si_calculate_memory_refresh_rate(struct radeon_device *rdev, |
4037 | u32 engine_clock) | 4062 | u32 engine_clock) |
4038 | { | 4063 | { |
4039 | struct rv7xx_power_info *pi = rv770_get_pi(rdev); | ||
4040 | u32 dram_rows; | 4064 | u32 dram_rows; |
4041 | u32 dram_refresh_rate; | 4065 | u32 dram_refresh_rate; |
4042 | u32 mc_arb_rfsh_rate; | 4066 | u32 mc_arb_rfsh_rate; |
4043 | u32 tmp = (RREG32(MC_ARB_RAMCFG) & NOOFROWS_MASK) >> NOOFROWS_SHIFT; | 4067 | u32 tmp = (RREG32(MC_ARB_RAMCFG) & NOOFROWS_MASK) >> NOOFROWS_SHIFT; |
4044 | 4068 | ||
4045 | if (pi->mem_gddr5) | 4069 | if (tmp >= 4) |
4046 | dram_rows = 1 << (tmp + 10); | 4070 | dram_rows = 16384; |
4047 | else | 4071 | else |
4048 | dram_rows = DDR3_DRAM_ROWS; | 4072 | dram_rows = 1 << (tmp + 10); |
4049 | 4073 | ||
4050 | dram_refresh_rate = 1 << ((RREG32(MC_SEQ_MISC0) & 0x3) + 3); | 4074 | dram_refresh_rate = 1 << ((RREG32(MC_SEQ_MISC0) & 0x3) + 3); |
4051 | mc_arb_rfsh_rate = ((engine_clock * 10) * dram_refresh_rate / dram_rows - 32) / 64; | 4075 | mc_arb_rfsh_rate = ((engine_clock * 10) * dram_refresh_rate / dram_rows - 32) / 64; |
@@ -6013,16 +6037,11 @@ int si_dpm_set_power_state(struct radeon_device *rdev) | |||
6013 | return ret; | 6037 | return ret; |
6014 | } | 6038 | } |
6015 | 6039 | ||
6016 | #if 0 | ||
6017 | /* XXX */ | ||
6018 | ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); | 6040 | ret = si_dpm_force_performance_level(rdev, RADEON_DPM_FORCED_LEVEL_AUTO); |
6019 | if (ret) { | 6041 | if (ret) { |
6020 | DRM_ERROR("si_dpm_force_performance_level failed\n"); | 6042 | DRM_ERROR("si_dpm_force_performance_level failed\n"); |
6021 | return ret; | 6043 | return ret; |
6022 | } | 6044 | } |
6023 | #else | ||
6024 | rdev->pm.dpm.forced_level = RADEON_DPM_FORCED_LEVEL_AUTO; | ||
6025 | #endif | ||
6026 | 6045 | ||
6027 | return 0; | 6046 | return 0; |
6028 | } | 6047 | } |
@@ -6254,9 +6273,6 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6254 | struct evergreen_power_info *eg_pi; | 6273 | struct evergreen_power_info *eg_pi; |
6255 | struct ni_power_info *ni_pi; | 6274 | struct ni_power_info *ni_pi; |
6256 | struct si_power_info *si_pi; | 6275 | struct si_power_info *si_pi; |
6257 | int index = GetIndexIntoMasterTable(DATA, ASIC_InternalSS_Info); | ||
6258 | u16 data_offset, size; | ||
6259 | u8 frev, crev; | ||
6260 | struct atom_clock_dividers dividers; | 6276 | struct atom_clock_dividers dividers; |
6261 | int ret; | 6277 | int ret; |
6262 | u32 mask; | 6278 | u32 mask; |
@@ -6347,16 +6363,7 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6347 | si_pi->vddc_phase_shed_control = | 6363 | si_pi->vddc_phase_shed_control = |
6348 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); | 6364 | radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, VOLTAGE_OBJ_PHASE_LUT); |
6349 | 6365 | ||
6350 | if (atom_parse_data_header(rdev->mode_info.atom_context, index, &size, | 6366 | rv770_get_engine_memory_ss(rdev); |
6351 | &frev, &crev, &data_offset)) { | ||
6352 | pi->sclk_ss = true; | ||
6353 | pi->mclk_ss = true; | ||
6354 | pi->dynamic_ss = true; | ||
6355 | } else { | ||
6356 | pi->sclk_ss = false; | ||
6357 | pi->mclk_ss = false; | ||
6358 | pi->dynamic_ss = true; | ||
6359 | } | ||
6360 | 6367 | ||
6361 | pi->asi = RV770_ASI_DFLT; | 6368 | pi->asi = RV770_ASI_DFLT; |
6362 | pi->pasi = CYPRESS_HASI_DFLT; | 6369 | pi->pasi = CYPRESS_HASI_DFLT; |
@@ -6367,8 +6374,7 @@ int si_dpm_init(struct radeon_device *rdev) | |||
6367 | eg_pi->sclk_deep_sleep = true; | 6374 | eg_pi->sclk_deep_sleep = true; |
6368 | si_pi->sclk_deep_sleep_above_low = false; | 6375 | si_pi->sclk_deep_sleep_above_low = false; |
6369 | 6376 | ||
6370 | if (pi->gfx_clock_gating && | 6377 | if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) |
6371 | (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE)) | ||
6372 | pi->thermal_protection = true; | 6378 | pi->thermal_protection = true; |
6373 | else | 6379 | else |
6374 | pi->thermal_protection = false; | 6380 | pi->thermal_protection = false; |
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 5207591a598c..cd33084c7860 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
@@ -192,6 +192,7 @@ static struct hid_ll_driver logi_dj_ll_driver; | |||
192 | static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, | 192 | static int logi_dj_output_hidraw_report(struct hid_device *hid, u8 * buf, |
193 | size_t count, | 193 | size_t count, |
194 | unsigned char report_type); | 194 | unsigned char report_type); |
195 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev); | ||
195 | 196 | ||
196 | static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, | 197 | static void logi_dj_recv_destroy_djhid_device(struct dj_receiver_dev *djrcv_dev, |
197 | struct dj_report *dj_report) | 198 | struct dj_report *dj_report) |
@@ -232,6 +233,7 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | |||
232 | if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & | 233 | if (dj_report->report_params[DEVICE_PAIRED_PARAM_SPFUNCTION] & |
233 | SPFUNCTION_DEVICE_LIST_EMPTY) { | 234 | SPFUNCTION_DEVICE_LIST_EMPTY) { |
234 | dbg_hid("%s: device list is empty\n", __func__); | 235 | dbg_hid("%s: device list is empty\n", __func__); |
236 | djrcv_dev->querying_devices = false; | ||
235 | return; | 237 | return; |
236 | } | 238 | } |
237 | 239 | ||
@@ -242,6 +244,12 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev, | |||
242 | return; | 244 | return; |
243 | } | 245 | } |
244 | 246 | ||
247 | if (djrcv_dev->paired_dj_devices[dj_report->device_index]) { | ||
248 | /* The device is already known. No need to reallocate it. */ | ||
249 | dbg_hid("%s: device is already known\n", __func__); | ||
250 | return; | ||
251 | } | ||
252 | |||
245 | dj_hiddev = hid_allocate_device(); | 253 | dj_hiddev = hid_allocate_device(); |
246 | if (IS_ERR(dj_hiddev)) { | 254 | if (IS_ERR(dj_hiddev)) { |
247 | dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", | 255 | dev_err(&djrcv_hdev->dev, "%s: hid_allocate_device failed\n", |
@@ -305,6 +313,7 @@ static void delayedwork_callback(struct work_struct *work) | |||
305 | struct dj_report dj_report; | 313 | struct dj_report dj_report; |
306 | unsigned long flags; | 314 | unsigned long flags; |
307 | int count; | 315 | int count; |
316 | int retval; | ||
308 | 317 | ||
309 | dbg_hid("%s\n", __func__); | 318 | dbg_hid("%s\n", __func__); |
310 | 319 | ||
@@ -337,6 +346,25 @@ static void delayedwork_callback(struct work_struct *work) | |||
337 | logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); | 346 | logi_dj_recv_destroy_djhid_device(djrcv_dev, &dj_report); |
338 | break; | 347 | break; |
339 | default: | 348 | default: |
349 | /* A normal report (i. e. not belonging to a pair/unpair notification) | ||
350 | * arriving here, means that the report arrived but we did not have a | ||
351 | * paired dj_device associated to the report's device_index, this | ||
352 | * means that the original "device paired" notification corresponding | ||
353 | * to this dj_device never arrived to this driver. The reason is that | ||
354 | * hid-core discards all packets coming from a device while probe() is | ||
355 | * executing. */ | ||
356 | if (!djrcv_dev->paired_dj_devices[dj_report.device_index]) { | ||
357 | /* ok, we don't know the device, just re-ask the | ||
358 | * receiver for the list of connected devices. */ | ||
359 | retval = logi_dj_recv_query_paired_devices(djrcv_dev); | ||
360 | if (!retval) { | ||
361 | /* everything went fine, so just leave */ | ||
362 | break; | ||
363 | } | ||
364 | dev_err(&djrcv_dev->hdev->dev, | ||
365 | "%s:logi_dj_recv_query_paired_devices " | ||
366 | "error:%d\n", __func__, retval); | ||
367 | } | ||
340 | dbg_hid("%s: unexpected report type\n", __func__); | 368 | dbg_hid("%s: unexpected report type\n", __func__); |
341 | } | 369 | } |
342 | } | 370 | } |
@@ -367,6 +395,12 @@ static void logi_dj_recv_forward_null_report(struct dj_receiver_dev *djrcv_dev, | |||
367 | if (!djdev) { | 395 | if (!djdev) { |
368 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" | 396 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" |
369 | " is NULL, index %d\n", dj_report->device_index); | 397 | " is NULL, index %d\n", dj_report->device_index); |
398 | kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); | ||
399 | |||
400 | if (schedule_work(&djrcv_dev->work) == 0) { | ||
401 | dbg_hid("%s: did not schedule the work item, was already " | ||
402 | "queued\n", __func__); | ||
403 | } | ||
370 | return; | 404 | return; |
371 | } | 405 | } |
372 | 406 | ||
@@ -397,6 +431,12 @@ static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev, | |||
397 | if (dj_device == NULL) { | 431 | if (dj_device == NULL) { |
398 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" | 432 | dbg_hid("djrcv_dev->paired_dj_devices[dj_report->device_index]" |
399 | " is NULL, index %d\n", dj_report->device_index); | 433 | " is NULL, index %d\n", dj_report->device_index); |
434 | kfifo_in(&djrcv_dev->notif_fifo, dj_report, sizeof(struct dj_report)); | ||
435 | |||
436 | if (schedule_work(&djrcv_dev->work) == 0) { | ||
437 | dbg_hid("%s: did not schedule the work item, was already " | ||
438 | "queued\n", __func__); | ||
439 | } | ||
400 | return; | 440 | return; |
401 | } | 441 | } |
402 | 442 | ||
@@ -444,6 +484,10 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | |||
444 | struct dj_report *dj_report; | 484 | struct dj_report *dj_report; |
445 | int retval; | 485 | int retval; |
446 | 486 | ||
487 | /* no need to protect djrcv_dev->querying_devices */ | ||
488 | if (djrcv_dev->querying_devices) | ||
489 | return 0; | ||
490 | |||
447 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); | 491 | dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); |
448 | if (!dj_report) | 492 | if (!dj_report) |
449 | return -ENOMEM; | 493 | return -ENOMEM; |
@@ -455,6 +499,7 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | |||
455 | return retval; | 499 | return retval; |
456 | } | 500 | } |
457 | 501 | ||
502 | |||
458 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, | 503 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, |
459 | unsigned timeout) | 504 | unsigned timeout) |
460 | { | 505 | { |
diff --git a/drivers/hid/hid-logitech-dj.h b/drivers/hid/hid-logitech-dj.h index fd28a5e0ca3b..4a4000340ce1 100644 --- a/drivers/hid/hid-logitech-dj.h +++ b/drivers/hid/hid-logitech-dj.h | |||
@@ -101,6 +101,7 @@ struct dj_receiver_dev { | |||
101 | struct work_struct work; | 101 | struct work_struct work; |
102 | struct kfifo notif_fifo; | 102 | struct kfifo notif_fifo; |
103 | spinlock_t lock; | 103 | spinlock_t lock; |
104 | bool querying_devices; | ||
104 | }; | 105 | }; |
105 | 106 | ||
106 | struct dj_device { | 107 | struct dj_device { |
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index ecbc74923d06..87fbe2924cfa 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c | |||
@@ -369,7 +369,8 @@ static int sony_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
369 | if (sc->quirks & PS3REMOTE) | 369 | if (sc->quirks & PS3REMOTE) |
370 | return ps3remote_mapping(hdev, hi, field, usage, bit, max); | 370 | return ps3remote_mapping(hdev, hi, field, usage, bit, max); |
371 | 371 | ||
372 | return -1; | 372 | /* Let hid-core decide for the others */ |
373 | return 0; | ||
373 | } | 374 | } |
374 | 375 | ||
375 | /* | 376 | /* |
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index a7451632ceb4..6f1feb2c2e97 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -518,7 +518,6 @@ int hidraw_connect(struct hid_device *hid) | |||
518 | goto out; | 518 | goto out; |
519 | } | 519 | } |
520 | 520 | ||
521 | mutex_unlock(&minors_lock); | ||
522 | init_waitqueue_head(&dev->wait); | 521 | init_waitqueue_head(&dev->wait); |
523 | INIT_LIST_HEAD(&dev->list); | 522 | INIT_LIST_HEAD(&dev->list); |
524 | 523 | ||
@@ -528,6 +527,7 @@ int hidraw_connect(struct hid_device *hid) | |||
528 | dev->exist = 1; | 527 | dev->exist = 1; |
529 | hid->hidraw = dev; | 528 | hid->hidraw = dev; |
530 | 529 | ||
530 | mutex_unlock(&minors_lock); | ||
531 | out: | 531 | out: |
532 | return result; | 532 | return result; |
533 | 533 | ||
diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c index 0f34bca9f5e5..6099f50b28aa 100644 --- a/drivers/hwmon/adt7470.c +++ b/drivers/hwmon/adt7470.c | |||
@@ -215,7 +215,7 @@ static inline int adt7470_write_word_data(struct i2c_client *client, u8 reg, | |||
215 | u16 value) | 215 | u16 value) |
216 | { | 216 | { |
217 | return i2c_smbus_write_byte_data(client, reg, value & 0xFF) | 217 | return i2c_smbus_write_byte_data(client, reg, value & 0xFF) |
218 | && i2c_smbus_write_byte_data(client, reg + 1, value >> 8); | 218 | || i2c_smbus_write_byte_data(client, reg + 1, value >> 8); |
219 | } | 219 | } |
220 | 220 | ||
221 | static void adt7470_init_client(struct i2c_client *client) | 221 | static void adt7470_init_client(struct i2c_client *client) |
diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c index 328fb0353c17..a41b5f3fc506 100644 --- a/drivers/hwmon/max6697.c +++ b/drivers/hwmon/max6697.c | |||
@@ -605,12 +605,12 @@ static int max6697_init_chip(struct i2c_client *client) | |||
605 | if (ret < 0) | 605 | if (ret < 0) |
606 | return ret; | 606 | return ret; |
607 | ret = i2c_smbus_write_byte_data(client, MAX6581_REG_IDEALITY, | 607 | ret = i2c_smbus_write_byte_data(client, MAX6581_REG_IDEALITY, |
608 | pdata->ideality_mask >> 1); | 608 | pdata->ideality_value); |
609 | if (ret < 0) | 609 | if (ret < 0) |
610 | return ret; | 610 | return ret; |
611 | ret = i2c_smbus_write_byte_data(client, | 611 | ret = i2c_smbus_write_byte_data(client, |
612 | MAX6581_REG_IDEALITY_SELECT, | 612 | MAX6581_REG_IDEALITY_SELECT, |
613 | pdata->ideality_value); | 613 | pdata->ideality_mask >> 1); |
614 | if (ret < 0) | 614 | if (ret < 0) |
615 | return ret; | 615 | return ret; |
616 | } | 616 | } |
diff --git a/drivers/i2c/busses/i2c-kempld.c b/drivers/i2c/busses/i2c-kempld.c index ccec916bc3eb..af8f65fb1c05 100644 --- a/drivers/i2c/busses/i2c-kempld.c +++ b/drivers/i2c/busses/i2c-kempld.c | |||
@@ -246,9 +246,9 @@ static void kempld_i2c_device_init(struct kempld_i2c_data *i2c) | |||
246 | bus_frequency = KEMPLD_I2C_FREQ_MAX; | 246 | bus_frequency = KEMPLD_I2C_FREQ_MAX; |
247 | 247 | ||
248 | if (pld->info.spec_major == 1) | 248 | if (pld->info.spec_major == 1) |
249 | prescale = pld->pld_clock / bus_frequency * 5 - 1000; | 249 | prescale = pld->pld_clock / (bus_frequency * 5) - 1000; |
250 | else | 250 | else |
251 | prescale = pld->pld_clock / bus_frequency * 4 - 3000; | 251 | prescale = pld->pld_clock / (bus_frequency * 4) - 3000; |
252 | 252 | ||
253 | if (prescale < 0) | 253 | if (prescale < 0) |
254 | prescale = 0; | 254 | prescale = 0; |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index df8ff5aea5b5..e2e9a0dade96 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -493,7 +493,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
493 | * based on this empirical measurement and a lot of previous frobbing. | 493 | * based on this empirical measurement and a lot of previous frobbing. |
494 | */ | 494 | */ |
495 | i2c->cmd_err = 0; | 495 | i2c->cmd_err = 0; |
496 | if (msg->len < 8) { | 496 | if (0) { /* disable PIO mode until a proper fix is made */ |
497 | ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); | 497 | ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); |
498 | if (ret) | 498 | if (ret) |
499 | mxs_i2c_reset(i2c); | 499 | mxs_i2c_reset(i2c); |
diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index b53867cb9cdc..a952538a1a8b 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c | |||
@@ -60,7 +60,6 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) | |||
60 | { | 60 | { |
61 | unsigned int stepconfig; | 61 | unsigned int stepconfig; |
62 | int i, steps; | 62 | int i, steps; |
63 | u32 step_en; | ||
64 | 63 | ||
65 | /* | 64 | /* |
66 | * There are 16 configurable steps and 8 analog input | 65 | * There are 16 configurable steps and 8 analog input |
@@ -86,8 +85,7 @@ static void tiadc_step_config(struct tiadc_device *adc_dev) | |||
86 | adc_dev->channel_step[i] = steps; | 85 | adc_dev->channel_step[i] = steps; |
87 | steps++; | 86 | steps++; |
88 | } | 87 | } |
89 | step_en = get_adc_step_mask(adc_dev); | 88 | |
90 | am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); | ||
91 | } | 89 | } |
92 | 90 | ||
93 | static const char * const chan_name_ain[] = { | 91 | static const char * const chan_name_ain[] = { |
@@ -142,10 +140,22 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
142 | int *val, int *val2, long mask) | 140 | int *val, int *val2, long mask) |
143 | { | 141 | { |
144 | struct tiadc_device *adc_dev = iio_priv(indio_dev); | 142 | struct tiadc_device *adc_dev = iio_priv(indio_dev); |
145 | int i; | 143 | int i, map_val; |
146 | unsigned int fifo1count, read; | 144 | unsigned int fifo1count, read, stepid; |
147 | u32 step = UINT_MAX; | 145 | u32 step = UINT_MAX; |
148 | bool found = false; | 146 | bool found = false; |
147 | u32 step_en; | ||
148 | unsigned long timeout = jiffies + usecs_to_jiffies | ||
149 | (IDLE_TIMEOUT * adc_dev->channels); | ||
150 | step_en = get_adc_step_mask(adc_dev); | ||
151 | am335x_tsc_se_set(adc_dev->mfd_tscadc, step_en); | ||
152 | |||
153 | /* Wait for ADC sequencer to complete sampling */ | ||
154 | while (tiadc_readl(adc_dev, REG_ADCFSM) & SEQ_STATUS) { | ||
155 | if (time_after(jiffies, timeout)) | ||
156 | return -EAGAIN; | ||
157 | } | ||
158 | map_val = chan->channel + TOTAL_CHANNELS; | ||
149 | 159 | ||
150 | /* | 160 | /* |
151 | * When the sub-system is first enabled, | 161 | * When the sub-system is first enabled, |
@@ -170,12 +180,16 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, | |||
170 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); | 180 | fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT); |
171 | for (i = 0; i < fifo1count; i++) { | 181 | for (i = 0; i < fifo1count; i++) { |
172 | read = tiadc_readl(adc_dev, REG_FIFO1); | 182 | read = tiadc_readl(adc_dev, REG_FIFO1); |
173 | if (read >> 16 == step) { | 183 | stepid = read & FIFOREAD_CHNLID_MASK; |
174 | *val = read & 0xfff; | 184 | stepid = stepid >> 0x10; |
185 | |||
186 | if (stepid == map_val) { | ||
187 | read = read & FIFOREAD_DATA_MASK; | ||
175 | found = true; | 188 | found = true; |
189 | *val = read; | ||
176 | } | 190 | } |
177 | } | 191 | } |
178 | am335x_tsc_se_update(adc_dev->mfd_tscadc); | 192 | |
179 | if (found == false) | 193 | if (found == false) |
180 | return -EBUSY; | 194 | return -EBUSY; |
181 | return IIO_VAL_INT; | 195 | return IIO_VAL_INT; |
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ea8a4146620d..0dd9bb873130 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c | |||
@@ -127,12 +127,17 @@ static struct iio_trigger *iio_trigger_find_by_name(const char *name, | |||
127 | void iio_trigger_poll(struct iio_trigger *trig, s64 time) | 127 | void iio_trigger_poll(struct iio_trigger *trig, s64 time) |
128 | { | 128 | { |
129 | int i; | 129 | int i; |
130 | if (!trig->use_count) | 130 | |
131 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) | 131 | if (!atomic_read(&trig->use_count)) { |
132 | if (trig->subirqs[i].enabled) { | 132 | atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); |
133 | trig->use_count++; | 133 | |
134 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { | ||
135 | if (trig->subirqs[i].enabled) | ||
134 | generic_handle_irq(trig->subirq_base + i); | 136 | generic_handle_irq(trig->subirq_base + i); |
135 | } | 137 | else |
138 | iio_trigger_notify_done(trig); | ||
139 | } | ||
140 | } | ||
136 | } | 141 | } |
137 | EXPORT_SYMBOL(iio_trigger_poll); | 142 | EXPORT_SYMBOL(iio_trigger_poll); |
138 | 143 | ||
@@ -146,19 +151,24 @@ EXPORT_SYMBOL(iio_trigger_generic_data_rdy_poll); | |||
146 | void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) | 151 | void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time) |
147 | { | 152 | { |
148 | int i; | 153 | int i; |
149 | if (!trig->use_count) | 154 | |
150 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) | 155 | if (!atomic_read(&trig->use_count)) { |
151 | if (trig->subirqs[i].enabled) { | 156 | atomic_set(&trig->use_count, CONFIG_IIO_CONSUMERS_PER_TRIGGER); |
152 | trig->use_count++; | 157 | |
158 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { | ||
159 | if (trig->subirqs[i].enabled) | ||
153 | handle_nested_irq(trig->subirq_base + i); | 160 | handle_nested_irq(trig->subirq_base + i); |
154 | } | 161 | else |
162 | iio_trigger_notify_done(trig); | ||
163 | } | ||
164 | } | ||
155 | } | 165 | } |
156 | EXPORT_SYMBOL(iio_trigger_poll_chained); | 166 | EXPORT_SYMBOL(iio_trigger_poll_chained); |
157 | 167 | ||
158 | void iio_trigger_notify_done(struct iio_trigger *trig) | 168 | void iio_trigger_notify_done(struct iio_trigger *trig) |
159 | { | 169 | { |
160 | trig->use_count--; | 170 | if (atomic_dec_and_test(&trig->use_count) && trig->ops && |
161 | if (trig->use_count == 0 && trig->ops && trig->ops->try_reenable) | 171 | trig->ops->try_reenable) |
162 | if (trig->ops->try_reenable(trig)) | 172 | if (trig->ops->try_reenable(trig)) |
163 | /* Missed an interrupt so launch new poll now */ | 173 | /* Missed an interrupt so launch new poll now */ |
164 | iio_trigger_poll(trig, 0); | 174 | iio_trigger_poll(trig, 0); |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index f1c279fabe64..7c0f9535fb7d 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -423,7 +423,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
423 | struct sockaddr_ib *addr; | 423 | struct sockaddr_ib *addr; |
424 | union ib_gid gid, sgid, *dgid; | 424 | union ib_gid gid, sgid, *dgid; |
425 | u16 pkey, index; | 425 | u16 pkey, index; |
426 | u8 port, p; | 426 | u8 p; |
427 | int i; | 427 | int i; |
428 | 428 | ||
429 | cma_dev = NULL; | 429 | cma_dev = NULL; |
@@ -443,7 +443,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
443 | if (!memcmp(&gid, dgid, sizeof(gid))) { | 443 | if (!memcmp(&gid, dgid, sizeof(gid))) { |
444 | cma_dev = cur_dev; | 444 | cma_dev = cur_dev; |
445 | sgid = gid; | 445 | sgid = gid; |
446 | port = p; | 446 | id_priv->id.port_num = p; |
447 | goto found; | 447 | goto found; |
448 | } | 448 | } |
449 | 449 | ||
@@ -451,7 +451,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
451 | dgid->global.subnet_prefix)) { | 451 | dgid->global.subnet_prefix)) { |
452 | cma_dev = cur_dev; | 452 | cma_dev = cur_dev; |
453 | sgid = gid; | 453 | sgid = gid; |
454 | port = p; | 454 | id_priv->id.port_num = p; |
455 | } | 455 | } |
456 | } | 456 | } |
457 | } | 457 | } |
@@ -462,7 +462,6 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv) | |||
462 | 462 | ||
463 | found: | 463 | found: |
464 | cma_attach_to_dev(id_priv, cma_dev); | 464 | cma_attach_to_dev(id_priv, cma_dev); |
465 | id_priv->id.port_num = port; | ||
466 | addr = (struct sockaddr_ib *) cma_src_addr(id_priv); | 465 | addr = (struct sockaddr_ib *) cma_src_addr(id_priv); |
467 | memcpy(&addr->sib_addr, &sgid, sizeof sgid); | 466 | memcpy(&addr->sib_addr, &sgid, sizeof sgid); |
468 | cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); | 467 | cma_translate_ib(addr, &id_priv->id.route.addr.dev_addr); |
@@ -880,7 +879,8 @@ static int cma_save_net_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id | |||
880 | { | 879 | { |
881 | struct cma_hdr *hdr; | 880 | struct cma_hdr *hdr; |
882 | 881 | ||
883 | if (listen_id->route.addr.src_addr.ss_family == AF_IB) { | 882 | if ((listen_id->route.addr.src_addr.ss_family == AF_IB) && |
883 | (ib_event->event == IB_CM_REQ_RECEIVED)) { | ||
884 | cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); | 884 | cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); |
885 | return 0; | 885 | return 0; |
886 | } | 886 | } |
@@ -2677,29 +2677,32 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | |||
2677 | { | 2677 | { |
2678 | struct ib_cm_sidr_req_param req; | 2678 | struct ib_cm_sidr_req_param req; |
2679 | struct ib_cm_id *id; | 2679 | struct ib_cm_id *id; |
2680 | void *private_data; | ||
2680 | int offset, ret; | 2681 | int offset, ret; |
2681 | 2682 | ||
2683 | memset(&req, 0, sizeof req); | ||
2682 | offset = cma_user_data_offset(id_priv); | 2684 | offset = cma_user_data_offset(id_priv); |
2683 | req.private_data_len = offset + conn_param->private_data_len; | 2685 | req.private_data_len = offset + conn_param->private_data_len; |
2684 | if (req.private_data_len < conn_param->private_data_len) | 2686 | if (req.private_data_len < conn_param->private_data_len) |
2685 | return -EINVAL; | 2687 | return -EINVAL; |
2686 | 2688 | ||
2687 | if (req.private_data_len) { | 2689 | if (req.private_data_len) { |
2688 | req.private_data = kzalloc(req.private_data_len, GFP_ATOMIC); | 2690 | private_data = kzalloc(req.private_data_len, GFP_ATOMIC); |
2689 | if (!req.private_data) | 2691 | if (!private_data) |
2690 | return -ENOMEM; | 2692 | return -ENOMEM; |
2691 | } else { | 2693 | } else { |
2692 | req.private_data = NULL; | 2694 | private_data = NULL; |
2693 | } | 2695 | } |
2694 | 2696 | ||
2695 | if (conn_param->private_data && conn_param->private_data_len) | 2697 | if (conn_param->private_data && conn_param->private_data_len) |
2696 | memcpy((void *) req.private_data + offset, | 2698 | memcpy(private_data + offset, conn_param->private_data, |
2697 | conn_param->private_data, conn_param->private_data_len); | 2699 | conn_param->private_data_len); |
2698 | 2700 | ||
2699 | if (req.private_data) { | 2701 | if (private_data) { |
2700 | ret = cma_format_hdr((void *) req.private_data, id_priv); | 2702 | ret = cma_format_hdr(private_data, id_priv); |
2701 | if (ret) | 2703 | if (ret) |
2702 | goto out; | 2704 | goto out; |
2705 | req.private_data = private_data; | ||
2703 | } | 2706 | } |
2704 | 2707 | ||
2705 | id = ib_create_cm_id(id_priv->id.device, cma_sidr_rep_handler, | 2708 | id = ib_create_cm_id(id_priv->id.device, cma_sidr_rep_handler, |
@@ -2721,7 +2724,7 @@ static int cma_resolve_ib_udp(struct rdma_id_private *id_priv, | |||
2721 | id_priv->cm_id.ib = NULL; | 2724 | id_priv->cm_id.ib = NULL; |
2722 | } | 2725 | } |
2723 | out: | 2726 | out: |
2724 | kfree(req.private_data); | 2727 | kfree(private_data); |
2725 | return ret; | 2728 | return ret; |
2726 | } | 2729 | } |
2727 | 2730 | ||
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index dc3fd1e8af07..4c837e66516b 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -2663,6 +2663,7 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) | |||
2663 | int ret, i; | 2663 | int ret, i; |
2664 | struct ib_qp_attr *attr; | 2664 | struct ib_qp_attr *attr; |
2665 | struct ib_qp *qp; | 2665 | struct ib_qp *qp; |
2666 | u16 pkey_index; | ||
2666 | 2667 | ||
2667 | attr = kmalloc(sizeof *attr, GFP_KERNEL); | 2668 | attr = kmalloc(sizeof *attr, GFP_KERNEL); |
2668 | if (!attr) { | 2669 | if (!attr) { |
@@ -2670,6 +2671,11 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) | |||
2670 | return -ENOMEM; | 2671 | return -ENOMEM; |
2671 | } | 2672 | } |
2672 | 2673 | ||
2674 | ret = ib_find_pkey(port_priv->device, port_priv->port_num, | ||
2675 | IB_DEFAULT_PKEY_FULL, &pkey_index); | ||
2676 | if (ret) | ||
2677 | pkey_index = 0; | ||
2678 | |||
2673 | for (i = 0; i < IB_MAD_QPS_CORE; i++) { | 2679 | for (i = 0; i < IB_MAD_QPS_CORE; i++) { |
2674 | qp = port_priv->qp_info[i].qp; | 2680 | qp = port_priv->qp_info[i].qp; |
2675 | if (!qp) | 2681 | if (!qp) |
@@ -2680,7 +2686,7 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv) | |||
2680 | * one is needed for the Reset to Init transition | 2686 | * one is needed for the Reset to Init transition |
2681 | */ | 2687 | */ |
2682 | attr->qp_state = IB_QPS_INIT; | 2688 | attr->qp_state = IB_QPS_INIT; |
2683 | attr->pkey_index = 0; | 2689 | attr->pkey_index = pkey_index; |
2684 | attr->qkey = (qp->qp_num == 0) ? 0 : IB_QP1_QKEY; | 2690 | attr->qkey = (qp->qp_num == 0) ? 0 : IB_QP1_QKEY; |
2685 | ret = ib_modify_qp(qp, attr, IB_QP_STATE | | 2691 | ret = ib_modify_qp(qp, attr, IB_QP_STATE | |
2686 | IB_QP_PKEY_INDEX | IB_QP_QKEY); | 2692 | IB_QP_PKEY_INDEX | IB_QP_QKEY); |
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index e87f2201b220..d2283837d451 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -226,6 +226,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve | |||
226 | mm->len = PAGE_ALIGN(((1UL << uresp.size_log2) + 1) * | 226 | mm->len = PAGE_ALIGN(((1UL << uresp.size_log2) + 1) * |
227 | sizeof(struct t3_cqe)); | 227 | sizeof(struct t3_cqe)); |
228 | uresp.memsize = mm->len; | 228 | uresp.memsize = mm->len; |
229 | uresp.reserved = 0; | ||
229 | resplen = sizeof uresp; | 230 | resplen = sizeof uresp; |
230 | } | 231 | } |
231 | if (ib_copy_to_udata(udata, &uresp, resplen)) { | 232 | if (ib_copy_to_udata(udata, &uresp, resplen)) { |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 232040447e8a..a4975e1654a6 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -1657,6 +1657,8 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, | |||
1657 | if (mm5) { | 1657 | if (mm5) { |
1658 | uresp.ma_sync_key = ucontext->key; | 1658 | uresp.ma_sync_key = ucontext->key; |
1659 | ucontext->key += PAGE_SIZE; | 1659 | ucontext->key += PAGE_SIZE; |
1660 | } else { | ||
1661 | uresp.ma_sync_key = 0; | ||
1660 | } | 1662 | } |
1661 | uresp.sq_key = ucontext->key; | 1663 | uresp.sq_key = ucontext->key; |
1662 | ucontext->key += PAGE_SIZE; | 1664 | ucontext->key += PAGE_SIZE; |
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c index 4d599cedbb0b..f2a3f48107e7 100644 --- a/drivers/infiniband/hw/mlx4/mad.c +++ b/drivers/infiniband/hw/mlx4/mad.c | |||
@@ -1511,8 +1511,14 @@ static int create_pv_sqp(struct mlx4_ib_demux_pv_ctx *ctx, | |||
1511 | 1511 | ||
1512 | memset(&attr, 0, sizeof attr); | 1512 | memset(&attr, 0, sizeof attr); |
1513 | attr.qp_state = IB_QPS_INIT; | 1513 | attr.qp_state = IB_QPS_INIT; |
1514 | attr.pkey_index = | 1514 | ret = 0; |
1515 | to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; | 1515 | if (create_tun) |
1516 | ret = find_slave_port_pkey_ix(to_mdev(ctx->ib_dev), ctx->slave, | ||
1517 | ctx->port, IB_DEFAULT_PKEY_FULL, | ||
1518 | &attr.pkey_index); | ||
1519 | if (ret || !create_tun) | ||
1520 | attr.pkey_index = | ||
1521 | to_mdev(ctx->ib_dev)->pkeys.virt2phys_pkey[ctx->slave][ctx->port - 1][0]; | ||
1516 | attr.qkey = IB_QP1_QKEY; | 1522 | attr.qkey = IB_QP1_QKEY; |
1517 | attr.port_num = ctx->port; | 1523 | attr.port_num = ctx->port; |
1518 | ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); | 1524 | ret = ib_modify_qp(tun_qp->qp, &attr, qp_attr_mask_INIT); |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 8000fff4d444..3f831de9a4d8 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
@@ -619,7 +619,8 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
619 | 619 | ||
620 | resp.tot_uuars = req.total_num_uuars; | 620 | resp.tot_uuars = req.total_num_uuars; |
621 | resp.num_ports = dev->mdev.caps.num_ports; | 621 | resp.num_ports = dev->mdev.caps.num_ports; |
622 | err = ib_copy_to_udata(udata, &resp, sizeof(resp)); | 622 | err = ib_copy_to_udata(udata, &resp, |
623 | sizeof(resp) - sizeof(resp.reserved)); | ||
623 | if (err) | 624 | if (err) |
624 | goto out_uars; | 625 | goto out_uars; |
625 | 626 | ||
@@ -1426,7 +1427,8 @@ static int init_one(struct pci_dev *pdev, | |||
1426 | if (err) | 1427 | if (err) |
1427 | goto err_eqs; | 1428 | goto err_eqs; |
1428 | 1429 | ||
1429 | if (ib_register_device(&dev->ib_dev, NULL)) | 1430 | err = ib_register_device(&dev->ib_dev, NULL); |
1431 | if (err) | ||
1430 | goto err_rsrc; | 1432 | goto err_rsrc; |
1431 | 1433 | ||
1432 | err = create_umr_res(dev); | 1434 | err = create_umr_res(dev); |
@@ -1434,8 +1436,9 @@ static int init_one(struct pci_dev *pdev, | |||
1434 | goto err_dev; | 1436 | goto err_dev; |
1435 | 1437 | ||
1436 | for (i = 0; i < ARRAY_SIZE(mlx5_class_attributes); i++) { | 1438 | for (i = 0; i < ARRAY_SIZE(mlx5_class_attributes); i++) { |
1437 | if (device_create_file(&dev->ib_dev.dev, | 1439 | err = device_create_file(&dev->ib_dev.dev, |
1438 | mlx5_class_attributes[i])) | 1440 | mlx5_class_attributes[i]); |
1441 | if (err) | ||
1439 | goto err_umrc; | 1442 | goto err_umrc; |
1440 | } | 1443 | } |
1441 | 1444 | ||
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index 16ac54c9819f..045f8cdbd303 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
@@ -199,7 +199,7 @@ static int set_rq_size(struct mlx5_ib_dev *dev, struct ib_qp_cap *cap, | |||
199 | 199 | ||
200 | static int sq_overhead(enum ib_qp_type qp_type) | 200 | static int sq_overhead(enum ib_qp_type qp_type) |
201 | { | 201 | { |
202 | int size; | 202 | int size = 0; |
203 | 203 | ||
204 | switch (qp_type) { | 204 | switch (qp_type) { |
205 | case IB_QPT_XRC_INI: | 205 | case IB_QPT_XRC_INI: |
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 418004c93feb..90200245c5eb 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -3570,10 +3570,10 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | |||
3570 | tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; | 3570 | tcp_state = (aeq_info & NES_AEQE_TCP_STATE_MASK) >> NES_AEQE_TCP_STATE_SHIFT; |
3571 | iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; | 3571 | iwarp_state = (aeq_info & NES_AEQE_IWARP_STATE_MASK) >> NES_AEQE_IWARP_STATE_SHIFT; |
3572 | nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p," | 3572 | nes_debug(NES_DBG_AEQ, "aeid = 0x%04X, qp-cq id = %d, aeqe = %p," |
3573 | " Tcp state = %d, iWARP state = %d\n", | 3573 | " Tcp state = %s, iWARP state = %s\n", |
3574 | async_event_id, | 3574 | async_event_id, |
3575 | le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe, | 3575 | le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]), aeqe, |
3576 | tcp_state, iwarp_state); | 3576 | nes_tcp_state_str[tcp_state], nes_iwarp_state_str[iwarp_state]); |
3577 | 3577 | ||
3578 | aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]); | 3578 | aeqe_cq_id = le32_to_cpu(aeqe->aeqe_words[NES_AEQE_COMP_QP_CQ_ID_IDX]); |
3579 | if (aeq_info & NES_AEQE_QP) { | 3579 | if (aeq_info & NES_AEQE_QP) { |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 8f67fe2e91e6..5b53ca5a2284 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -1384,6 +1384,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, | |||
1384 | 1384 | ||
1385 | if (ibpd->uobject) { | 1385 | if (ibpd->uobject) { |
1386 | uresp.mmap_sq_db_index = nesqp->mmap_sq_db_index; | 1386 | uresp.mmap_sq_db_index = nesqp->mmap_sq_db_index; |
1387 | uresp.mmap_rq_db_index = 0; | ||
1387 | uresp.actual_sq_size = sq_size; | 1388 | uresp.actual_sq_size = sq_size; |
1388 | uresp.actual_rq_size = rq_size; | 1389 | uresp.actual_rq_size = rq_size; |
1389 | uresp.qp_id = nesqp->hwqp.qp_id; | 1390 | uresp.qp_id = nesqp->hwqp.qp_id; |
@@ -1767,7 +1768,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1767 | resp.cq_id = nescq->hw_cq.cq_number; | 1768 | resp.cq_id = nescq->hw_cq.cq_number; |
1768 | resp.cq_size = nescq->hw_cq.cq_size; | 1769 | resp.cq_size = nescq->hw_cq.cq_size; |
1769 | resp.mmap_db_index = 0; | 1770 | resp.mmap_db_index = 0; |
1770 | if (ib_copy_to_udata(udata, &resp, sizeof resp)) { | 1771 | if (ib_copy_to_udata(udata, &resp, sizeof resp - sizeof resp.reserved)) { |
1771 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); | 1772 | nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); |
1772 | kfree(nescq); | 1773 | kfree(nescq); |
1773 | return ERR_PTR(-EFAULT); | 1774 | return ERR_PTR(-EFAULT); |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index a877a8ed7907..f4c587c68f64 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <net/netevent.h> | 29 | #include <net/netevent.h> |
30 | 30 | ||
31 | #include <rdma/ib_addr.h> | 31 | #include <rdma/ib_addr.h> |
32 | #include <rdma/ib_cache.h> | ||
33 | 32 | ||
34 | #include "ocrdma.h" | 33 | #include "ocrdma.h" |
35 | #include "ocrdma_verbs.h" | 34 | #include "ocrdma_verbs.h" |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index dcfbab177faa..f36630e4b6be 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -242,6 +242,7 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev, | |||
242 | memset(ctx->ah_tbl.va, 0, map_len); | 242 | memset(ctx->ah_tbl.va, 0, map_len); |
243 | ctx->ah_tbl.len = map_len; | 243 | ctx->ah_tbl.len = map_len; |
244 | 244 | ||
245 | memset(&resp, 0, sizeof(resp)); | ||
245 | resp.ah_tbl_len = ctx->ah_tbl.len; | 246 | resp.ah_tbl_len = ctx->ah_tbl.len; |
246 | resp.ah_tbl_page = ctx->ah_tbl.pa; | 247 | resp.ah_tbl_page = ctx->ah_tbl.pa; |
247 | 248 | ||
@@ -253,7 +254,6 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev, | |||
253 | resp.wqe_size = dev->attr.wqe_size; | 254 | resp.wqe_size = dev->attr.wqe_size; |
254 | resp.rqe_size = dev->attr.rqe_size; | 255 | resp.rqe_size = dev->attr.rqe_size; |
255 | resp.dpp_wqe_size = dev->attr.wqe_size; | 256 | resp.dpp_wqe_size = dev->attr.wqe_size; |
256 | resp.rsvd = 0; | ||
257 | 257 | ||
258 | memcpy(resp.fw_ver, dev->attr.fw_ver, sizeof(resp.fw_ver)); | 258 | memcpy(resp.fw_ver, dev->attr.fw_ver, sizeof(resp.fw_ver)); |
259 | status = ib_copy_to_udata(udata, &resp, sizeof(resp)); | 259 | status = ib_copy_to_udata(udata, &resp, sizeof(resp)); |
@@ -338,6 +338,7 @@ static int ocrdma_copy_pd_uresp(struct ocrdma_pd *pd, | |||
338 | struct ocrdma_alloc_pd_uresp rsp; | 338 | struct ocrdma_alloc_pd_uresp rsp; |
339 | struct ocrdma_ucontext *uctx = get_ocrdma_ucontext(ib_ctx); | 339 | struct ocrdma_ucontext *uctx = get_ocrdma_ucontext(ib_ctx); |
340 | 340 | ||
341 | memset(&rsp, 0, sizeof(rsp)); | ||
341 | rsp.id = pd->id; | 342 | rsp.id = pd->id; |
342 | rsp.dpp_enabled = pd->dpp_enabled; | 343 | rsp.dpp_enabled = pd->dpp_enabled; |
343 | db_page_addr = pd->dev->nic_info.unmapped_db + | 344 | db_page_addr = pd->dev->nic_info.unmapped_db + |
@@ -692,6 +693,7 @@ static int ocrdma_copy_cq_uresp(struct ocrdma_cq *cq, struct ib_udata *udata, | |||
692 | struct ocrdma_ucontext *uctx; | 693 | struct ocrdma_ucontext *uctx; |
693 | struct ocrdma_create_cq_uresp uresp; | 694 | struct ocrdma_create_cq_uresp uresp; |
694 | 695 | ||
696 | memset(&uresp, 0, sizeof(uresp)); | ||
695 | uresp.cq_id = cq->id; | 697 | uresp.cq_id = cq->id; |
696 | uresp.page_size = cq->len; | 698 | uresp.page_size = cq->len; |
697 | uresp.num_pages = 1; | 699 | uresp.num_pages = 1; |
@@ -1460,6 +1462,7 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_srq *srq, struct ib_udata *udata) | |||
1460 | int status; | 1462 | int status; |
1461 | struct ocrdma_create_srq_uresp uresp; | 1463 | struct ocrdma_create_srq_uresp uresp; |
1462 | 1464 | ||
1465 | memset(&uresp, 0, sizeof(uresp)); | ||
1463 | uresp.rq_dbid = srq->rq.dbid; | 1466 | uresp.rq_dbid = srq->rq.dbid; |
1464 | uresp.num_rq_pages = 1; | 1467 | uresp.num_rq_pages = 1; |
1465 | uresp.rq_page_addr[0] = srq->rq.pa; | 1468 | uresp.rq_page_addr[0] = srq->rq.pa; |
diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c index 21e8b09d4bf8..016e7429adf6 100644 --- a/drivers/infiniband/hw/qib/qib_iba7322.c +++ b/drivers/infiniband/hw/qib/qib_iba7322.c | |||
@@ -1596,6 +1596,8 @@ static void sdma_7322_p_errors(struct qib_pportdata *ppd, u64 errs) | |||
1596 | struct qib_devdata *dd = ppd->dd; | 1596 | struct qib_devdata *dd = ppd->dd; |
1597 | 1597 | ||
1598 | errs &= QIB_E_P_SDMAERRS; | 1598 | errs &= QIB_E_P_SDMAERRS; |
1599 | err_decode(ppd->cpspec->sdmamsgbuf, sizeof(ppd->cpspec->sdmamsgbuf), | ||
1600 | errs, qib_7322p_error_msgs); | ||
1599 | 1601 | ||
1600 | if (errs & QIB_E_P_SDMAUNEXPDATA) | 1602 | if (errs & QIB_E_P_SDMAUNEXPDATA) |
1601 | qib_dev_err(dd, "IB%u:%u SDmaUnexpData\n", dd->unit, | 1603 | qib_dev_err(dd, "IB%u:%u SDmaUnexpData\n", dd->unit, |
diff --git a/drivers/infiniband/hw/qib/qib_sdma.c b/drivers/infiniband/hw/qib/qib_sdma.c index 32162d355370..9b5322d8cd5a 100644 --- a/drivers/infiniband/hw/qib/qib_sdma.c +++ b/drivers/infiniband/hw/qib/qib_sdma.c | |||
@@ -717,7 +717,7 @@ void dump_sdma_state(struct qib_pportdata *ppd) | |||
717 | struct qib_sdma_txreq *txp, *txpnext; | 717 | struct qib_sdma_txreq *txp, *txpnext; |
718 | __le64 *descqp; | 718 | __le64 *descqp; |
719 | u64 desc[2]; | 719 | u64 desc[2]; |
720 | dma_addr_t addr; | 720 | u64 addr; |
721 | u16 gen, dwlen, dwoffset; | 721 | u16 gen, dwlen, dwoffset; |
722 | u16 head, tail, cnt; | 722 | u16 head, tail, cnt; |
723 | 723 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 2cfa76f5d99e..196b1d13cbcb 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
@@ -932,12 +932,47 @@ int ipoib_ib_dev_init(struct net_device *dev, struct ib_device *ca, int port) | |||
932 | return 0; | 932 | return 0; |
933 | } | 933 | } |
934 | 934 | ||
935 | /* | ||
936 | * Takes whatever value which is in pkey index 0 and updates priv->pkey | ||
937 | * returns 0 if the pkey value was changed. | ||
938 | */ | ||
939 | static inline int update_parent_pkey(struct ipoib_dev_priv *priv) | ||
940 | { | ||
941 | int result; | ||
942 | u16 prev_pkey; | ||
943 | |||
944 | prev_pkey = priv->pkey; | ||
945 | result = ib_query_pkey(priv->ca, priv->port, 0, &priv->pkey); | ||
946 | if (result) { | ||
947 | ipoib_warn(priv, "ib_query_pkey port %d failed (ret = %d)\n", | ||
948 | priv->port, result); | ||
949 | return result; | ||
950 | } | ||
951 | |||
952 | priv->pkey |= 0x8000; | ||
953 | |||
954 | if (prev_pkey != priv->pkey) { | ||
955 | ipoib_dbg(priv, "pkey changed from 0x%x to 0x%x\n", | ||
956 | prev_pkey, priv->pkey); | ||
957 | /* | ||
958 | * Update the pkey in the broadcast address, while making sure to set | ||
959 | * the full membership bit, so that we join the right broadcast group. | ||
960 | */ | ||
961 | priv->dev->broadcast[8] = priv->pkey >> 8; | ||
962 | priv->dev->broadcast[9] = priv->pkey & 0xff; | ||
963 | return 0; | ||
964 | } | ||
965 | |||
966 | return 1; | ||
967 | } | ||
968 | |||
935 | static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | 969 | static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, |
936 | enum ipoib_flush_level level) | 970 | enum ipoib_flush_level level) |
937 | { | 971 | { |
938 | struct ipoib_dev_priv *cpriv; | 972 | struct ipoib_dev_priv *cpriv; |
939 | struct net_device *dev = priv->dev; | 973 | struct net_device *dev = priv->dev; |
940 | u16 new_index; | 974 | u16 new_index; |
975 | int result; | ||
941 | 976 | ||
942 | mutex_lock(&priv->vlan_mutex); | 977 | mutex_lock(&priv->vlan_mutex); |
943 | 978 | ||
@@ -951,6 +986,10 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
951 | mutex_unlock(&priv->vlan_mutex); | 986 | mutex_unlock(&priv->vlan_mutex); |
952 | 987 | ||
953 | if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) { | 988 | if (!test_bit(IPOIB_FLAG_INITIALIZED, &priv->flags)) { |
989 | /* for non-child devices must check/update the pkey value here */ | ||
990 | if (level == IPOIB_FLUSH_HEAVY && | ||
991 | !test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) | ||
992 | update_parent_pkey(priv); | ||
954 | ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); | 993 | ipoib_dbg(priv, "Not flushing - IPOIB_FLAG_INITIALIZED not set.\n"); |
955 | return; | 994 | return; |
956 | } | 995 | } |
@@ -961,21 +1000,32 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
961 | } | 1000 | } |
962 | 1001 | ||
963 | if (level == IPOIB_FLUSH_HEAVY) { | 1002 | if (level == IPOIB_FLUSH_HEAVY) { |
964 | if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { | 1003 | /* child devices chase their origin pkey value, while non-child |
965 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | 1004 | * (parent) devices should always takes what present in pkey index 0 |
966 | ipoib_ib_dev_down(dev, 0); | 1005 | */ |
967 | ipoib_ib_dev_stop(dev, 0); | 1006 | if (test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) { |
968 | if (ipoib_pkey_dev_delay_open(dev)) | 1007 | if (ib_find_pkey(priv->ca, priv->port, priv->pkey, &new_index)) { |
1008 | clear_bit(IPOIB_PKEY_ASSIGNED, &priv->flags); | ||
1009 | ipoib_ib_dev_down(dev, 0); | ||
1010 | ipoib_ib_dev_stop(dev, 0); | ||
1011 | if (ipoib_pkey_dev_delay_open(dev)) | ||
1012 | return; | ||
1013 | } | ||
1014 | /* restart QP only if P_Key index is changed */ | ||
1015 | if (test_and_set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags) && | ||
1016 | new_index == priv->pkey_index) { | ||
1017 | ipoib_dbg(priv, "Not flushing - P_Key index not changed.\n"); | ||
969 | return; | 1018 | return; |
1019 | } | ||
1020 | priv->pkey_index = new_index; | ||
1021 | } else { | ||
1022 | result = update_parent_pkey(priv); | ||
1023 | /* restart QP only if P_Key value changed */ | ||
1024 | if (result) { | ||
1025 | ipoib_dbg(priv, "Not flushing - P_Key value not changed.\n"); | ||
1026 | return; | ||
1027 | } | ||
970 | } | 1028 | } |
971 | |||
972 | /* restart QP only if P_Key index is changed */ | ||
973 | if (test_and_set_bit(IPOIB_PKEY_ASSIGNED, &priv->flags) && | ||
974 | new_index == priv->pkey_index) { | ||
975 | ipoib_dbg(priv, "Not flushing - P_Key index not changed.\n"); | ||
976 | return; | ||
977 | } | ||
978 | priv->pkey_index = new_index; | ||
979 | } | 1029 | } |
980 | 1030 | ||
981 | if (level == IPOIB_FLUSH_LIGHT) { | 1031 | if (level == IPOIB_FLUSH_LIGHT) { |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index b6e049a3c7a8..c6f71a88c55c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -1461,7 +1461,7 @@ static ssize_t create_child(struct device *dev, | |||
1461 | if (sscanf(buf, "%i", &pkey) != 1) | 1461 | if (sscanf(buf, "%i", &pkey) != 1) |
1462 | return -EINVAL; | 1462 | return -EINVAL; |
1463 | 1463 | ||
1464 | if (pkey < 0 || pkey > 0xffff) | 1464 | if (pkey <= 0 || pkey > 0xffff || pkey == 0x8000) |
1465 | return -EINVAL; | 1465 | return -EINVAL; |
1466 | 1466 | ||
1467 | /* | 1467 | /* |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c index 74685936c948..f81abe16cf09 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_netlink.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_netlink.c | |||
@@ -119,6 +119,15 @@ static int ipoib_new_child_link(struct net *src_net, struct net_device *dev, | |||
119 | } else | 119 | } else |
120 | child_pkey = nla_get_u16(data[IFLA_IPOIB_PKEY]); | 120 | child_pkey = nla_get_u16(data[IFLA_IPOIB_PKEY]); |
121 | 121 | ||
122 | if (child_pkey == 0 || child_pkey == 0x8000) | ||
123 | return -EINVAL; | ||
124 | |||
125 | /* | ||
126 | * Set the full membership bit, so that we join the right | ||
127 | * broadcast group, etc. | ||
128 | */ | ||
129 | child_pkey |= 0x8000; | ||
130 | |||
122 | err = __ipoib_vlan_add(ppriv, netdev_priv(dev), child_pkey, IPOIB_RTNL_CHILD); | 131 | err = __ipoib_vlan_add(ppriv, netdev_priv(dev), child_pkey, IPOIB_RTNL_CHILD); |
123 | 132 | ||
124 | if (!err && data) | 133 | if (!err && data) |
diff --git a/drivers/macintosh/windfarm_rm31.c b/drivers/macintosh/windfarm_rm31.c index 0b9a79b2f48a..82fc86a90c1a 100644 --- a/drivers/macintosh/windfarm_rm31.c +++ b/drivers/macintosh/windfarm_rm31.c | |||
@@ -439,15 +439,15 @@ static void backside_setup_pid(void) | |||
439 | 439 | ||
440 | /* Slots fan */ | 440 | /* Slots fan */ |
441 | static const struct wf_pid_param slots_param = { | 441 | static const struct wf_pid_param slots_param = { |
442 | .interval = 5, | 442 | .interval = 1, |
443 | .history_len = 2, | 443 | .history_len = 20, |
444 | .gd = 30 << 20, | 444 | .gd = 0, |
445 | .gp = 5 << 20, | 445 | .gp = 0, |
446 | .gr = 0, | 446 | .gr = 0x00100000, |
447 | .itarget = 40 << 16, | 447 | .itarget = 3200000, |
448 | .additive = 1, | 448 | .additive = 0, |
449 | .min = 300, | 449 | .min = 20, |
450 | .max = 4000, | 450 | .max = 100, |
451 | }; | 451 | }; |
452 | 452 | ||
453 | static void slots_fan_tick(void) | 453 | static void slots_fan_tick(void) |
diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c index efdc873e58d1..a9857022f71d 100644 --- a/drivers/media/i2c/ml86v7667.c +++ b/drivers/media/i2c/ml86v7667.c | |||
@@ -117,7 +117,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl) | |||
117 | { | 117 | { |
118 | struct v4l2_subdev *sd = to_sd(ctrl); | 118 | struct v4l2_subdev *sd = to_sd(ctrl); |
119 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 119 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
120 | int ret; | 120 | int ret = -EINVAL; |
121 | 121 | ||
122 | switch (ctrl->id) { | 122 | switch (ctrl->id) { |
123 | case V4L2_CID_BRIGHTNESS: | 123 | case V4L2_CID_BRIGHTNESS: |
@@ -157,7 +157,7 @@ static int ml86v7667_s_ctrl(struct v4l2_ctrl *ctrl) | |||
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | 159 | ||
160 | return 0; | 160 | return ret; |
161 | } | 161 | } |
162 | 162 | ||
163 | static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) | 163 | static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) |
diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index df4ada880e42..bd9405df1bd6 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c | |||
@@ -1987,7 +1987,7 @@ MODULE_DEVICE_TABLE(platform, coda_platform_ids); | |||
1987 | 1987 | ||
1988 | #ifdef CONFIG_OF | 1988 | #ifdef CONFIG_OF |
1989 | static const struct of_device_id coda_dt_ids[] = { | 1989 | static const struct of_device_id coda_dt_ids[] = { |
1990 | { .compatible = "fsl,imx27-vpu", .data = &coda_platform_ids[CODA_IMX27] }, | 1990 | { .compatible = "fsl,imx27-vpu", .data = &coda_devdata[CODA_IMX27] }, |
1991 | { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, | 1991 | { .compatible = "fsl,imx53-vpu", .data = &coda_devdata[CODA_IMX53] }, |
1992 | { /* sentinel */ } | 1992 | { /* sentinel */ } |
1993 | }; | 1993 | }; |
diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index 553d87e5ceab..fd6289d60cde 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c | |||
@@ -784,6 +784,7 @@ static int g2d_probe(struct platform_device *pdev) | |||
784 | } | 784 | } |
785 | *vfd = g2d_videodev; | 785 | *vfd = g2d_videodev; |
786 | vfd->lock = &dev->mutex; | 786 | vfd->lock = &dev->mutex; |
787 | vfd->v4l2_dev = &dev->v4l2_dev; | ||
787 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); | 788 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); |
788 | if (ret) { | 789 | if (ret) { |
789 | v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); | 790 | v4l2_err(&dev->v4l2_dev, "Failed to register video device\n"); |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 5296385153d5..4f6dd42c9adb 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | |||
@@ -344,7 +344,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
344 | pix_mp->num_planes = 2; | 344 | pix_mp->num_planes = 2; |
345 | /* Set pixelformat to the format in which MFC | 345 | /* Set pixelformat to the format in which MFC |
346 | outputs the decoded frame */ | 346 | outputs the decoded frame */ |
347 | pix_mp->pixelformat = V4L2_PIX_FMT_NV12MT; | 347 | pix_mp->pixelformat = ctx->dst_fmt->fourcc; |
348 | pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; | 348 | pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; |
349 | pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; | 349 | pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; |
350 | pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; | 350 | pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; |
@@ -382,10 +382,16 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
382 | mfc_err("Unsupported format for source.\n"); | 382 | mfc_err("Unsupported format for source.\n"); |
383 | return -EINVAL; | 383 | return -EINVAL; |
384 | } | 384 | } |
385 | if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { | 385 | if (fmt->codec_mode == S5P_FIMV_CODEC_NONE) { |
386 | mfc_err("Not supported format.\n"); | 386 | mfc_err("Unknown codec\n"); |
387 | return -EINVAL; | 387 | return -EINVAL; |
388 | } | 388 | } |
389 | if (!IS_MFCV6(dev)) { | ||
390 | if (fmt->fourcc == V4L2_PIX_FMT_VP8) { | ||
391 | mfc_err("Not supported format.\n"); | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | } | ||
389 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 395 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
390 | fmt = find_format(f, MFC_FMT_RAW); | 396 | fmt = find_format(f, MFC_FMT_RAW); |
391 | if (!fmt) { | 397 | if (!fmt) { |
@@ -411,7 +417,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
411 | struct s5p_mfc_dev *dev = video_drvdata(file); | 417 | struct s5p_mfc_dev *dev = video_drvdata(file); |
412 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | 418 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); |
413 | int ret = 0; | 419 | int ret = 0; |
414 | struct s5p_mfc_fmt *fmt; | ||
415 | struct v4l2_pix_format_mplane *pix_mp; | 420 | struct v4l2_pix_format_mplane *pix_mp; |
416 | 421 | ||
417 | mfc_debug_enter(); | 422 | mfc_debug_enter(); |
@@ -425,54 +430,32 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
425 | goto out; | 430 | goto out; |
426 | } | 431 | } |
427 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 432 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
428 | fmt = find_format(f, MFC_FMT_RAW); | 433 | /* dst_fmt is validated by call to vidioc_try_fmt */ |
429 | if (!fmt) { | 434 | ctx->dst_fmt = find_format(f, MFC_FMT_RAW); |
430 | mfc_err("Unsupported format for source.\n"); | 435 | ret = 0; |
431 | return -EINVAL; | ||
432 | } | ||
433 | if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) { | ||
434 | mfc_err("Not supported format.\n"); | ||
435 | return -EINVAL; | ||
436 | } else if (IS_MFCV6(dev) && | ||
437 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { | ||
438 | mfc_err("Not supported format.\n"); | ||
439 | return -EINVAL; | ||
440 | } | ||
441 | ctx->dst_fmt = fmt; | ||
442 | mfc_debug_leave(); | ||
443 | return ret; | ||
444 | } else if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | ||
445 | mfc_err("Wrong type error for S_FMT : %d", f->type); | ||
446 | return -EINVAL; | ||
447 | } | ||
448 | fmt = find_format(f, MFC_FMT_DEC); | ||
449 | if (!fmt || fmt->codec_mode == S5P_MFC_CODEC_NONE) { | ||
450 | mfc_err("Unknown codec\n"); | ||
451 | ret = -EINVAL; | ||
452 | goto out; | 436 | goto out; |
453 | } | 437 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
454 | if (fmt->type != MFC_FMT_DEC) { | 438 | /* src_fmt is validated by call to vidioc_try_fmt */ |
455 | mfc_err("Wrong format selected, you should choose " | 439 | ctx->src_fmt = find_format(f, MFC_FMT_DEC); |
456 | "format for decoding\n"); | 440 | ctx->codec_mode = ctx->src_fmt->codec_mode; |
441 | mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); | ||
442 | pix_mp->height = 0; | ||
443 | pix_mp->width = 0; | ||
444 | if (pix_mp->plane_fmt[0].sizeimage) | ||
445 | ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; | ||
446 | else | ||
447 | pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = | ||
448 | DEF_CPB_SIZE; | ||
449 | pix_mp->plane_fmt[0].bytesperline = 0; | ||
450 | ctx->state = MFCINST_INIT; | ||
451 | ret = 0; | ||
452 | goto out; | ||
453 | } else { | ||
454 | mfc_err("Wrong type error for S_FMT : %d", f->type); | ||
457 | ret = -EINVAL; | 455 | ret = -EINVAL; |
458 | goto out; | 456 | goto out; |
459 | } | 457 | } |
460 | if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) { | 458 | |
461 | mfc_err("Not supported format.\n"); | ||
462 | return -EINVAL; | ||
463 | } | ||
464 | ctx->src_fmt = fmt; | ||
465 | ctx->codec_mode = fmt->codec_mode; | ||
466 | mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); | ||
467 | pix_mp->height = 0; | ||
468 | pix_mp->width = 0; | ||
469 | if (pix_mp->plane_fmt[0].sizeimage) | ||
470 | ctx->dec_src_buf_size = pix_mp->plane_fmt[0].sizeimage; | ||
471 | else | ||
472 | pix_mp->plane_fmt[0].sizeimage = ctx->dec_src_buf_size = | ||
473 | DEF_CPB_SIZE; | ||
474 | pix_mp->plane_fmt[0].bytesperline = 0; | ||
475 | ctx->state = MFCINST_INIT; | ||
476 | out: | 459 | out: |
477 | mfc_debug_leave(); | 460 | mfc_debug_leave(); |
478 | return ret; | 461 | return ret; |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 2549967b2f85..59e56f4c8ce3 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -906,6 +906,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
906 | 906 | ||
907 | static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | 907 | static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) |
908 | { | 908 | { |
909 | struct s5p_mfc_dev *dev = video_drvdata(file); | ||
909 | struct s5p_mfc_fmt *fmt; | 910 | struct s5p_mfc_fmt *fmt; |
910 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; | 911 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; |
911 | 912 | ||
@@ -930,6 +931,18 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
930 | return -EINVAL; | 931 | return -EINVAL; |
931 | } | 932 | } |
932 | 933 | ||
934 | if (!IS_MFCV6(dev)) { | ||
935 | if (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16) { | ||
936 | mfc_err("Not supported format.\n"); | ||
937 | return -EINVAL; | ||
938 | } | ||
939 | } else if (IS_MFCV6(dev)) { | ||
940 | if (fmt->fourcc == V4L2_PIX_FMT_NV12MT) { | ||
941 | mfc_err("Not supported format.\n"); | ||
942 | return -EINVAL; | ||
943 | } | ||
944 | } | ||
945 | |||
933 | if (fmt->num_planes != pix_fmt_mp->num_planes) { | 946 | if (fmt->num_planes != pix_fmt_mp->num_planes) { |
934 | mfc_err("failed to try output format\n"); | 947 | mfc_err("failed to try output format\n"); |
935 | return -EINVAL; | 948 | return -EINVAL; |
@@ -947,7 +960,6 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
947 | { | 960 | { |
948 | struct s5p_mfc_dev *dev = video_drvdata(file); | 961 | struct s5p_mfc_dev *dev = video_drvdata(file); |
949 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); | 962 | struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); |
950 | struct s5p_mfc_fmt *fmt; | ||
951 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; | 963 | struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; |
952 | int ret = 0; | 964 | int ret = 0; |
953 | 965 | ||
@@ -960,13 +972,9 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
960 | goto out; | 972 | goto out; |
961 | } | 973 | } |
962 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { | 974 | if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { |
963 | fmt = find_format(f, MFC_FMT_ENC); | 975 | /* dst_fmt is validated by call to vidioc_try_fmt */ |
964 | if (!fmt) { | 976 | ctx->dst_fmt = find_format(f, MFC_FMT_ENC); |
965 | mfc_err("failed to set capture format\n"); | ||
966 | return -EINVAL; | ||
967 | } | ||
968 | ctx->state = MFCINST_INIT; | 977 | ctx->state = MFCINST_INIT; |
969 | ctx->dst_fmt = fmt; | ||
970 | ctx->codec_mode = ctx->dst_fmt->codec_mode; | 978 | ctx->codec_mode = ctx->dst_fmt->codec_mode; |
971 | ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; | 979 | ctx->enc_dst_buf_size = pix_fmt_mp->plane_fmt[0].sizeimage; |
972 | pix_fmt_mp->plane_fmt[0].bytesperline = 0; | 980 | pix_fmt_mp->plane_fmt[0].bytesperline = 0; |
@@ -987,28 +995,8 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
987 | } | 995 | } |
988 | mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); | 996 | mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); |
989 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | 997 | } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
990 | fmt = find_format(f, MFC_FMT_RAW); | 998 | /* src_fmt is validated by call to vidioc_try_fmt */ |
991 | if (!fmt) { | 999 | ctx->src_fmt = find_format(f, MFC_FMT_RAW); |
992 | mfc_err("failed to set output format\n"); | ||
993 | return -EINVAL; | ||
994 | } | ||
995 | |||
996 | if (!IS_MFCV6(dev) && | ||
997 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT_16X16)) { | ||
998 | mfc_err("Not supported format.\n"); | ||
999 | return -EINVAL; | ||
1000 | } else if (IS_MFCV6(dev) && | ||
1001 | (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) { | ||
1002 | mfc_err("Not supported format.\n"); | ||
1003 | return -EINVAL; | ||
1004 | } | ||
1005 | |||
1006 | if (fmt->num_planes != pix_fmt_mp->num_planes) { | ||
1007 | mfc_err("failed to set output format\n"); | ||
1008 | ret = -EINVAL; | ||
1009 | goto out; | ||
1010 | } | ||
1011 | ctx->src_fmt = fmt; | ||
1012 | ctx->img_width = pix_fmt_mp->width; | 1000 | ctx->img_width = pix_fmt_mp->width; |
1013 | ctx->img_height = pix_fmt_mp->height; | 1001 | ctx->img_height = pix_fmt_mp->height; |
1014 | mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode); | 1002 | mfc_debug(2, "codec number: %d\n", ctx->src_fmt->codec_mode); |
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index 4851cc2e4a4d..c4ff9739a7ae 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c | |||
@@ -726,7 +726,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus, | |||
726 | 726 | ||
727 | *eedata = data; | 727 | *eedata = data; |
728 | *eedata_len = len; | 728 | *eedata_len = len; |
729 | dev_config = (void *)eedata; | 729 | dev_config = (void *)*eedata; |
730 | 730 | ||
731 | switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { | 731 | switch (le16_to_cpu(dev_config->chip_conf) >> 4 & 0x3) { |
732 | case 0: | 732 | case 0: |
diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index cb694055ba7d..6e5070774dc2 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c | |||
@@ -303,6 +303,11 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
303 | 303 | ||
304 | dev->workqueue = 0; | 304 | dev->workqueue = 0; |
305 | 305 | ||
306 | /* init video transfer queues first of all */ | ||
307 | /* to prevent oops in hdpvr_delete() on error paths */ | ||
308 | INIT_LIST_HEAD(&dev->free_buff_list); | ||
309 | INIT_LIST_HEAD(&dev->rec_buff_list); | ||
310 | |||
306 | /* register v4l2_device early so it can be used for printks */ | 311 | /* register v4l2_device early so it can be used for printks */ |
307 | if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { | 312 | if (v4l2_device_register(&interface->dev, &dev->v4l2_dev)) { |
308 | dev_err(&interface->dev, "v4l2_device_register failed\n"); | 313 | dev_err(&interface->dev, "v4l2_device_register failed\n"); |
@@ -325,10 +330,6 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
325 | if (!dev->workqueue) | 330 | if (!dev->workqueue) |
326 | goto error; | 331 | goto error; |
327 | 332 | ||
328 | /* init video transfer queues */ | ||
329 | INIT_LIST_HEAD(&dev->free_buff_list); | ||
330 | INIT_LIST_HEAD(&dev->rec_buff_list); | ||
331 | |||
332 | dev->options = hdpvr_default_options; | 333 | dev->options = hdpvr_default_options; |
333 | 334 | ||
334 | if (default_video_input < HDPVR_VIDEO_INPUTS) | 335 | if (default_video_input < HDPVR_VIDEO_INPUTS) |
@@ -405,7 +406,7 @@ static int hdpvr_probe(struct usb_interface *interface, | |||
405 | video_nr[atomic_inc_return(&dev_nr)]); | 406 | video_nr[atomic_inc_return(&dev_nr)]); |
406 | if (retval < 0) { | 407 | if (retval < 0) { |
407 | v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); | 408 | v4l2_err(&dev->v4l2_dev, "registering videodev failed\n"); |
408 | goto error; | 409 | goto reg_fail; |
409 | } | 410 | } |
410 | 411 | ||
411 | /* let the user know what node this device is now attached to */ | 412 | /* let the user know what node this device is now attached to */ |
diff --git a/drivers/media/usb/usbtv/Kconfig b/drivers/media/usb/usbtv/Kconfig index 8864436464bf..7c5b86006ee6 100644 --- a/drivers/media/usb/usbtv/Kconfig +++ b/drivers/media/usb/usbtv/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VIDEO_USBTV | 1 | config VIDEO_USBTV |
2 | tristate "USBTV007 video capture support" | 2 | tristate "USBTV007 video capture support" |
3 | depends on VIDEO_DEV | 3 | depends on VIDEO_V4L2 |
4 | select VIDEOBUF2_VMALLOC | 4 | select VIDEOBUF2_VMALLOC |
5 | 5 | ||
6 | ---help--- | 6 | ---help--- |
diff --git a/drivers/media/usb/usbtv/usbtv.c b/drivers/media/usb/usbtv/usbtv.c index bf43f874685e..91650173941a 100644 --- a/drivers/media/usb/usbtv/usbtv.c +++ b/drivers/media/usb/usbtv/usbtv.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #define USBTV_CHUNK_SIZE 256 | 57 | #define USBTV_CHUNK_SIZE 256 |
58 | #define USBTV_CHUNK 240 | 58 | #define USBTV_CHUNK 240 |
59 | #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ | 59 | #define USBTV_CHUNKS (USBTV_WIDTH * USBTV_HEIGHT \ |
60 | / 2 / USBTV_CHUNK) | 60 | / 4 / USBTV_CHUNK) |
61 | 61 | ||
62 | /* Chunk header. */ | 62 | /* Chunk header. */ |
63 | #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ | 63 | #define USBTV_MAGIC_OK(chunk) ((be32_to_cpu(chunk[0]) & 0xff000000) \ |
@@ -89,6 +89,7 @@ struct usbtv { | |||
89 | /* Number of currently processed frame, useful find | 89 | /* Number of currently processed frame, useful find |
90 | * out when a new one begins. */ | 90 | * out when a new one begins. */ |
91 | u32 frame_id; | 91 | u32 frame_id; |
92 | int chunks_done; | ||
92 | 93 | ||
93 | int iso_size; | 94 | int iso_size; |
94 | unsigned int sequence; | 95 | unsigned int sequence; |
@@ -202,6 +203,26 @@ static int usbtv_setup_capture(struct usbtv *usbtv) | |||
202 | return 0; | 203 | return 0; |
203 | } | 204 | } |
204 | 205 | ||
206 | /* Copy data from chunk into a frame buffer, deinterlacing the data | ||
207 | * into every second line. Unfortunately, they don't align nicely into | ||
208 | * 720 pixel lines, as the chunk is 240 words long, which is 480 pixels. | ||
209 | * Therefore, we break down the chunk into two halves before copyting, | ||
210 | * so that we can interleave a line if needed. */ | ||
211 | static void usbtv_chunk_to_vbuf(u32 *frame, u32 *src, int chunk_no, int odd) | ||
212 | { | ||
213 | int half; | ||
214 | |||
215 | for (half = 0; half < 2; half++) { | ||
216 | int part_no = chunk_no * 2 + half; | ||
217 | int line = part_no / 3; | ||
218 | int part_index = (line * 2 + !odd) * 3 + (part_no % 3); | ||
219 | |||
220 | u32 *dst = &frame[part_index * USBTV_CHUNK/2]; | ||
221 | memcpy(dst, src, USBTV_CHUNK/2 * sizeof(*src)); | ||
222 | src += USBTV_CHUNK/2; | ||
223 | } | ||
224 | } | ||
225 | |||
205 | /* Called for each 256-byte image chunk. | 226 | /* Called for each 256-byte image chunk. |
206 | * First word identifies the chunk, followed by 240 words of image | 227 | * First word identifies the chunk, followed by 240 words of image |
207 | * data and padding. */ | 228 | * data and padding. */ |
@@ -218,17 +239,17 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) | |||
218 | frame_id = USBTV_FRAME_ID(chunk); | 239 | frame_id = USBTV_FRAME_ID(chunk); |
219 | odd = USBTV_ODD(chunk); | 240 | odd = USBTV_ODD(chunk); |
220 | chunk_no = USBTV_CHUNK_NO(chunk); | 241 | chunk_no = USBTV_CHUNK_NO(chunk); |
221 | |||
222 | /* Deinterlace. TODO: Use interlaced frame format. */ | ||
223 | chunk_no = (chunk_no - chunk_no % 3) * 2 + chunk_no % 3; | ||
224 | chunk_no += !odd * 3; | ||
225 | |||
226 | if (chunk_no >= USBTV_CHUNKS) | 242 | if (chunk_no >= USBTV_CHUNKS) |
227 | return; | 243 | return; |
228 | 244 | ||
229 | /* Beginning of a frame. */ | 245 | /* Beginning of a frame. */ |
230 | if (chunk_no == 0) | 246 | if (chunk_no == 0) { |
231 | usbtv->frame_id = frame_id; | 247 | usbtv->frame_id = frame_id; |
248 | usbtv->chunks_done = 0; | ||
249 | } | ||
250 | |||
251 | if (usbtv->frame_id != frame_id) | ||
252 | return; | ||
232 | 253 | ||
233 | spin_lock_irqsave(&usbtv->buflock, flags); | 254 | spin_lock_irqsave(&usbtv->buflock, flags); |
234 | if (list_empty(&usbtv->bufs)) { | 255 | if (list_empty(&usbtv->bufs)) { |
@@ -241,19 +262,23 @@ static void usbtv_image_chunk(struct usbtv *usbtv, u32 *chunk) | |||
241 | buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); | 262 | buf = list_first_entry(&usbtv->bufs, struct usbtv_buf, list); |
242 | frame = vb2_plane_vaddr(&buf->vb, 0); | 263 | frame = vb2_plane_vaddr(&buf->vb, 0); |
243 | 264 | ||
244 | /* Copy the chunk. */ | 265 | /* Copy the chunk data. */ |
245 | memcpy(&frame[chunk_no * USBTV_CHUNK], &chunk[1], | 266 | usbtv_chunk_to_vbuf(frame, &chunk[1], chunk_no, odd); |
246 | USBTV_CHUNK * sizeof(chunk[1])); | 267 | usbtv->chunks_done++; |
247 | 268 | ||
248 | /* Last chunk in a frame, signalling an end */ | 269 | /* Last chunk in a frame, signalling an end */ |
249 | if (usbtv->frame_id && chunk_no == USBTV_CHUNKS-1) { | 270 | if (odd && chunk_no == USBTV_CHUNKS-1) { |
250 | int size = vb2_plane_size(&buf->vb, 0); | 271 | int size = vb2_plane_size(&buf->vb, 0); |
272 | enum vb2_buffer_state state = usbtv->chunks_done == | ||
273 | USBTV_CHUNKS ? | ||
274 | VB2_BUF_STATE_DONE : | ||
275 | VB2_BUF_STATE_ERROR; | ||
251 | 276 | ||
252 | buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; | 277 | buf->vb.v4l2_buf.field = V4L2_FIELD_INTERLACED; |
253 | buf->vb.v4l2_buf.sequence = usbtv->sequence++; | 278 | buf->vb.v4l2_buf.sequence = usbtv->sequence++; |
254 | v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); | 279 | v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); |
255 | vb2_set_plane_payload(&buf->vb, 0, size); | 280 | vb2_set_plane_payload(&buf->vb, 0, size); |
256 | vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); | 281 | vb2_buffer_done(&buf->vb, state); |
257 | list_del(&buf->list); | 282 | list_del(&buf->list); |
258 | } | 283 | } |
259 | 284 | ||
@@ -518,7 +543,7 @@ static int usbtv_queue_setup(struct vb2_queue *vq, | |||
518 | if (*nbuffers < 2) | 543 | if (*nbuffers < 2) |
519 | *nbuffers = 2; | 544 | *nbuffers = 2; |
520 | *nplanes = 1; | 545 | *nplanes = 1; |
521 | sizes[0] = USBTV_CHUNK * USBTV_CHUNKS * sizeof(u32); | 546 | sizes[0] = USBTV_WIDTH * USBTV_HEIGHT / 2 * sizeof(u32); |
522 | 547 | ||
523 | return 0; | 548 | return 0; |
524 | } | 549 | } |
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index a746ba272f04..a956053608f9 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -1007,7 +1007,7 @@ static void arcnet_rx(struct net_device *dev, int bufnum) | |||
1007 | 1007 | ||
1008 | soft = &pkt.soft.rfc1201; | 1008 | soft = &pkt.soft.rfc1201; |
1009 | 1009 | ||
1010 | lp->hw.copy_from_card(dev, bufnum, 0, &pkt, sizeof(ARC_HDR_SIZE)); | 1010 | lp->hw.copy_from_card(dev, bufnum, 0, &pkt, ARC_HDR_SIZE); |
1011 | if (pkt.hard.offset[0]) { | 1011 | if (pkt.hard.offset[0]) { |
1012 | ofs = pkt.hard.offset[0]; | 1012 | ofs = pkt.hard.offset[0]; |
1013 | length = 256 - ofs; | 1013 | length = 256 - ofs; |
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c index 6aa7b3266c80..ac6177d3befc 100644 --- a/drivers/net/can/usb/esd_usb2.c +++ b/drivers/net/can/usb/esd_usb2.c | |||
@@ -412,10 +412,20 @@ static void esd_usb2_read_bulk_callback(struct urb *urb) | |||
412 | 412 | ||
413 | switch (msg->msg.hdr.cmd) { | 413 | switch (msg->msg.hdr.cmd) { |
414 | case CMD_CAN_RX: | 414 | case CMD_CAN_RX: |
415 | if (msg->msg.rx.net >= dev->net_count) { | ||
416 | dev_err(dev->udev->dev.parent, "format error\n"); | ||
417 | break; | ||
418 | } | ||
419 | |||
415 | esd_usb2_rx_can_msg(dev->nets[msg->msg.rx.net], msg); | 420 | esd_usb2_rx_can_msg(dev->nets[msg->msg.rx.net], msg); |
416 | break; | 421 | break; |
417 | 422 | ||
418 | case CMD_CAN_TX: | 423 | case CMD_CAN_TX: |
424 | if (msg->msg.txdone.net >= dev->net_count) { | ||
425 | dev_err(dev->udev->dev.parent, "format error\n"); | ||
426 | break; | ||
427 | } | ||
428 | |||
419 | esd_usb2_tx_done_msg(dev->nets[msg->msg.txdone.net], | 429 | esd_usb2_tx_done_msg(dev->nets[msg->msg.txdone.net], |
420 | msg); | 430 | msg); |
421 | break; | 431 | break; |
diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index cbd388eea682..8becd3d838b5 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c | |||
@@ -779,6 +779,7 @@ static int usb_8dev_start(struct usb_8dev_priv *priv) | |||
779 | usb_unanchor_urb(urb); | 779 | usb_unanchor_urb(urb); |
780 | usb_free_coherent(priv->udev, RX_BUFFER_SIZE, buf, | 780 | usb_free_coherent(priv->udev, RX_BUFFER_SIZE, buf, |
781 | urb->transfer_dma); | 781 | urb->transfer_dma); |
782 | usb_free_urb(urb); | ||
782 | break; | 783 | break; |
783 | } | 784 | } |
784 | 785 | ||
diff --git a/drivers/net/ethernet/allwinner/Kconfig b/drivers/net/ethernet/allwinner/Kconfig index 53ad213e865b..d8d95d4cd45a 100644 --- a/drivers/net/ethernet/allwinner/Kconfig +++ b/drivers/net/ethernet/allwinner/Kconfig | |||
@@ -3,19 +3,20 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | config NET_VENDOR_ALLWINNER | 5 | config NET_VENDOR_ALLWINNER |
6 | bool "Allwinner devices" | 6 | bool "Allwinner devices" |
7 | default y | 7 | default y |
8 | depends on ARCH_SUNXI | ||
9 | ---help--- | ||
10 | If you have a network (Ethernet) card belonging to this | ||
11 | class, say Y and read the Ethernet-HOWTO, available from | ||
12 | <http://www.tldp.org/docs.html#howto>. | ||
13 | 8 | ||
14 | Note that the answer to this question doesn't directly | 9 | depends on ARCH_SUNXI |
15 | affect the kernel: saying N will just cause the configurator | 10 | ---help--- |
16 | to skip all the questions about Allwinner cards. If you say Y, | 11 | If you have a network (Ethernet) card belonging to this |
17 | you will be asked for your specific card in the following | 12 | class, say Y and read the Ethernet-HOWTO, available from |
18 | questions. | 13 | <http://www.tldp.org/docs.html#howto>. |
14 | |||
15 | Note that the answer to this question doesn't directly | ||
16 | affect the kernel: saying N will just cause the configurator | ||
17 | to skip all the questions about Allwinner cards. If you say Y, | ||
18 | you will be asked for your specific card in the following | ||
19 | questions. | ||
19 | 20 | ||
20 | if NET_VENDOR_ALLWINNER | 21 | if NET_VENDOR_ALLWINNER |
21 | 22 | ||
@@ -26,6 +27,7 @@ config SUN4I_EMAC | |||
26 | select CRC32 | 27 | select CRC32 |
27 | select MII | 28 | select MII |
28 | select PHYLIB | 29 | select PHYLIB |
30 | select MDIO_SUN4I | ||
29 | ---help--- | 31 | ---help--- |
30 | Support for Allwinner A10 EMAC ethernet driver. | 32 | Support for Allwinner A10 EMAC ethernet driver. |
31 | 33 | ||
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h index b2bf324631dc..0f0556526ba9 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c.h +++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h | |||
@@ -520,6 +520,9 @@ struct atl1c_adapter { | |||
520 | struct net_device *netdev; | 520 | struct net_device *netdev; |
521 | struct pci_dev *pdev; | 521 | struct pci_dev *pdev; |
522 | struct napi_struct napi; | 522 | struct napi_struct napi; |
523 | struct page *rx_page; | ||
524 | unsigned int rx_page_offset; | ||
525 | unsigned int rx_frag_size; | ||
523 | struct atl1c_hw hw; | 526 | struct atl1c_hw hw; |
524 | struct atl1c_hw_stats hw_stats; | 527 | struct atl1c_hw_stats hw_stats; |
525 | struct mii_if_info mii; /* MII interface info */ | 528 | struct mii_if_info mii; /* MII interface info */ |
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 786a87483298..a36a760ada28 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -481,10 +481,15 @@ static int atl1c_set_mac_addr(struct net_device *netdev, void *p) | |||
481 | static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, | 481 | static void atl1c_set_rxbufsize(struct atl1c_adapter *adapter, |
482 | struct net_device *dev) | 482 | struct net_device *dev) |
483 | { | 483 | { |
484 | unsigned int head_size; | ||
484 | int mtu = dev->mtu; | 485 | int mtu = dev->mtu; |
485 | 486 | ||
486 | adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? | 487 | adapter->rx_buffer_len = mtu > AT_RX_BUF_SIZE ? |
487 | roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; | 488 | roundup(mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN, 8) : AT_RX_BUF_SIZE; |
489 | |||
490 | head_size = SKB_DATA_ALIGN(adapter->rx_buffer_len + NET_SKB_PAD) + | ||
491 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | ||
492 | adapter->rx_frag_size = roundup_pow_of_two(head_size); | ||
488 | } | 493 | } |
489 | 494 | ||
490 | static netdev_features_t atl1c_fix_features(struct net_device *netdev, | 495 | static netdev_features_t atl1c_fix_features(struct net_device *netdev, |
@@ -952,6 +957,10 @@ static void atl1c_free_ring_resources(struct atl1c_adapter *adapter) | |||
952 | kfree(adapter->tpd_ring[0].buffer_info); | 957 | kfree(adapter->tpd_ring[0].buffer_info); |
953 | adapter->tpd_ring[0].buffer_info = NULL; | 958 | adapter->tpd_ring[0].buffer_info = NULL; |
954 | } | 959 | } |
960 | if (adapter->rx_page) { | ||
961 | put_page(adapter->rx_page); | ||
962 | adapter->rx_page = NULL; | ||
963 | } | ||
955 | } | 964 | } |
956 | 965 | ||
957 | /** | 966 | /** |
@@ -1639,6 +1648,35 @@ static inline void atl1c_rx_checksum(struct atl1c_adapter *adapter, | |||
1639 | skb_checksum_none_assert(skb); | 1648 | skb_checksum_none_assert(skb); |
1640 | } | 1649 | } |
1641 | 1650 | ||
1651 | static struct sk_buff *atl1c_alloc_skb(struct atl1c_adapter *adapter) | ||
1652 | { | ||
1653 | struct sk_buff *skb; | ||
1654 | struct page *page; | ||
1655 | |||
1656 | if (adapter->rx_frag_size > PAGE_SIZE) | ||
1657 | return netdev_alloc_skb(adapter->netdev, | ||
1658 | adapter->rx_buffer_len); | ||
1659 | |||
1660 | page = adapter->rx_page; | ||
1661 | if (!page) { | ||
1662 | adapter->rx_page = page = alloc_page(GFP_ATOMIC); | ||
1663 | if (unlikely(!page)) | ||
1664 | return NULL; | ||
1665 | adapter->rx_page_offset = 0; | ||
1666 | } | ||
1667 | |||
1668 | skb = build_skb(page_address(page) + adapter->rx_page_offset, | ||
1669 | adapter->rx_frag_size); | ||
1670 | if (likely(skb)) { | ||
1671 | adapter->rx_page_offset += adapter->rx_frag_size; | ||
1672 | if (adapter->rx_page_offset >= PAGE_SIZE) | ||
1673 | adapter->rx_page = NULL; | ||
1674 | else | ||
1675 | get_page(page); | ||
1676 | } | ||
1677 | return skb; | ||
1678 | } | ||
1679 | |||
1642 | static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) | 1680 | static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) |
1643 | { | 1681 | { |
1644 | struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring; | 1682 | struct atl1c_rfd_ring *rfd_ring = &adapter->rfd_ring; |
@@ -1660,7 +1698,7 @@ static int atl1c_alloc_rx_buffer(struct atl1c_adapter *adapter) | |||
1660 | while (next_info->flags & ATL1C_BUFFER_FREE) { | 1698 | while (next_info->flags & ATL1C_BUFFER_FREE) { |
1661 | rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use); | 1699 | rfd_desc = ATL1C_RFD_DESC(rfd_ring, rfd_next_to_use); |
1662 | 1700 | ||
1663 | skb = netdev_alloc_skb(adapter->netdev, adapter->rx_buffer_len); | 1701 | skb = atl1c_alloc_skb(adapter); |
1664 | if (unlikely(!skb)) { | 1702 | if (unlikely(!skb)) { |
1665 | if (netif_msg_rx_err(adapter)) | 1703 | if (netif_msg_rx_err(adapter)) |
1666 | dev_warn(&pdev->dev, "alloc rx buffer failed\n"); | 1704 | dev_warn(&pdev->dev, "alloc rx buffer failed\n"); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index dedbd76c033e..d80e34b8285f 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -486,7 +486,7 @@ struct bnx2x_fastpath { | |||
486 | 486 | ||
487 | struct napi_struct napi; | 487 | struct napi_struct napi; |
488 | 488 | ||
489 | #ifdef CONFIG_NET_LL_RX_POLL | 489 | #ifdef CONFIG_NET_RX_BUSY_POLL |
490 | unsigned int state; | 490 | unsigned int state; |
491 | #define BNX2X_FP_STATE_IDLE 0 | 491 | #define BNX2X_FP_STATE_IDLE 0 |
492 | #define BNX2X_FP_STATE_NAPI (1 << 0) /* NAPI owns this FP */ | 492 | #define BNX2X_FP_STATE_NAPI (1 << 0) /* NAPI owns this FP */ |
@@ -498,7 +498,7 @@ struct bnx2x_fastpath { | |||
498 | #define BNX2X_FP_USER_PEND (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_POLL_YIELD) | 498 | #define BNX2X_FP_USER_PEND (BNX2X_FP_STATE_POLL | BNX2X_FP_STATE_POLL_YIELD) |
499 | /* protect state */ | 499 | /* protect state */ |
500 | spinlock_t lock; | 500 | spinlock_t lock; |
501 | #endif /* CONFIG_NET_LL_RX_POLL */ | 501 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
502 | 502 | ||
503 | union host_hc_status_block status_blk; | 503 | union host_hc_status_block status_blk; |
504 | /* chip independent shortcuts into sb structure */ | 504 | /* chip independent shortcuts into sb structure */ |
@@ -572,7 +572,7 @@ struct bnx2x_fastpath { | |||
572 | #define bnx2x_fp_stats(bp, fp) (&((bp)->fp_stats[(fp)->index])) | 572 | #define bnx2x_fp_stats(bp, fp) (&((bp)->fp_stats[(fp)->index])) |
573 | #define bnx2x_fp_qstats(bp, fp) (&((bp)->fp_stats[(fp)->index].eth_q_stats)) | 573 | #define bnx2x_fp_qstats(bp, fp) (&((bp)->fp_stats[(fp)->index].eth_q_stats)) |
574 | 574 | ||
575 | #ifdef CONFIG_NET_LL_RX_POLL | 575 | #ifdef CONFIG_NET_RX_BUSY_POLL |
576 | static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp) | 576 | static inline void bnx2x_fp_init_lock(struct bnx2x_fastpath *fp) |
577 | { | 577 | { |
578 | spin_lock_init(&fp->lock); | 578 | spin_lock_init(&fp->lock); |
@@ -680,7 +680,7 @@ static inline bool bnx2x_fp_ll_polling(struct bnx2x_fastpath *fp) | |||
680 | { | 680 | { |
681 | return false; | 681 | return false; |
682 | } | 682 | } |
683 | #endif /* CONFIG_NET_LL_RX_POLL */ | 683 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
684 | 684 | ||
685 | /* Use 2500 as a mini-jumbo MTU for FCoE */ | 685 | /* Use 2500 as a mini-jumbo MTU for FCoE */ |
686 | #define BNX2X_FCOE_MINI_JUMBO_MTU 2500 | 686 | #define BNX2X_FCOE_MINI_JUMBO_MTU 2500 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index ee350bde1818..f2d1ff10054b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -3117,7 +3117,7 @@ int bnx2x_poll(struct napi_struct *napi, int budget) | |||
3117 | return work_done; | 3117 | return work_done; |
3118 | } | 3118 | } |
3119 | 3119 | ||
3120 | #ifdef CONFIG_NET_LL_RX_POLL | 3120 | #ifdef CONFIG_NET_RX_BUSY_POLL |
3121 | /* must be called with local_bh_disable()d */ | 3121 | /* must be called with local_bh_disable()d */ |
3122 | int bnx2x_low_latency_recv(struct napi_struct *napi) | 3122 | int bnx2x_low_latency_recv(struct napi_struct *napi) |
3123 | { | 3123 | { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index e5da07858a2f..e06186c305d8 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -12026,7 +12026,7 @@ static const struct net_device_ops bnx2x_netdev_ops = { | |||
12026 | .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn, | 12026 | .ndo_fcoe_get_wwn = bnx2x_fcoe_get_wwn, |
12027 | #endif | 12027 | #endif |
12028 | 12028 | ||
12029 | #ifdef CONFIG_NET_LL_RX_POLL | 12029 | #ifdef CONFIG_NET_RX_BUSY_POLL |
12030 | .ndo_busy_poll = bnx2x_low_latency_recv, | 12030 | .ndo_busy_poll = bnx2x_low_latency_recv, |
12031 | #endif | 12031 | #endif |
12032 | }; | 12032 | }; |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index d964f302ac94..ddebc7a5dda0 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -17625,7 +17625,8 @@ err_out_free_res: | |||
17625 | pci_release_regions(pdev); | 17625 | pci_release_regions(pdev); |
17626 | 17626 | ||
17627 | err_out_disable_pdev: | 17627 | err_out_disable_pdev: |
17628 | pci_disable_device(pdev); | 17628 | if (pci_is_enabled(pdev)) |
17629 | pci_disable_device(pdev); | ||
17629 | pci_set_drvdata(pdev, NULL); | 17630 | pci_set_drvdata(pdev, NULL); |
17630 | return err; | 17631 | return err; |
17631 | } | 17632 | } |
@@ -17773,7 +17774,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, | |||
17773 | 17774 | ||
17774 | rtnl_lock(); | 17775 | rtnl_lock(); |
17775 | 17776 | ||
17776 | if (!netif_running(netdev)) | 17777 | /* We probably don't have netdev yet */ |
17778 | if (!netdev || !netif_running(netdev)) | ||
17777 | goto done; | 17779 | goto done; |
17778 | 17780 | ||
17779 | tg3_phy_stop(tp); | 17781 | tg3_phy_stop(tp); |
diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 2b0a0ea4f8e7..ae236009f1a8 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h | |||
@@ -259,6 +259,7 @@ struct bufdesc_ex { | |||
259 | struct fec_enet_delayed_work { | 259 | struct fec_enet_delayed_work { |
260 | struct delayed_work delay_work; | 260 | struct delayed_work delay_work; |
261 | bool timeout; | 261 | bool timeout; |
262 | bool trig_tx; | ||
262 | }; | 263 | }; |
263 | 264 | ||
264 | /* The FEC buffer descriptors track the ring buffers. The rx_bd_base and | 265 | /* The FEC buffer descriptors track the ring buffers. The rx_bd_base and |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index d3ad5ea711d3..77ea0db0bbfc 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -93,6 +93,20 @@ static void set_multicast_list(struct net_device *ndev); | |||
93 | #define FEC_QUIRK_HAS_CSUM (1 << 5) | 93 | #define FEC_QUIRK_HAS_CSUM (1 << 5) |
94 | /* Controller has hardware vlan support */ | 94 | /* Controller has hardware vlan support */ |
95 | #define FEC_QUIRK_HAS_VLAN (1 << 6) | 95 | #define FEC_QUIRK_HAS_VLAN (1 << 6) |
96 | /* ENET IP errata ERR006358 | ||
97 | * | ||
98 | * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously | ||
99 | * detected as not set during a prior frame transmission, then the | ||
100 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs | ||
101 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in | ||
102 | * If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously | ||
103 | * detected as not set during a prior frame transmission, then the | ||
104 | * ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs | ||
105 | * were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in | ||
106 | * frames not being transmitted until there is a 0-to-1 transition on | ||
107 | * ENET_TDAR[TDAR]. | ||
108 | */ | ||
109 | #define FEC_QUIRK_ERR006358 (1 << 7) | ||
96 | 110 | ||
97 | static struct platform_device_id fec_devtype[] = { | 111 | static struct platform_device_id fec_devtype[] = { |
98 | { | 112 | { |
@@ -112,7 +126,7 @@ static struct platform_device_id fec_devtype[] = { | |||
112 | .name = "imx6q-fec", | 126 | .name = "imx6q-fec", |
113 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | | 127 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT | |
114 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | | 128 | FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | |
115 | FEC_QUIRK_HAS_VLAN, | 129 | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358, |
116 | }, { | 130 | }, { |
117 | .name = "mvf600-fec", | 131 | .name = "mvf600-fec", |
118 | .driver_data = FEC_QUIRK_ENET_MAC, | 132 | .driver_data = FEC_QUIRK_ENET_MAC, |
@@ -275,16 +289,11 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
275 | struct fec_enet_private *fep = netdev_priv(ndev); | 289 | struct fec_enet_private *fep = netdev_priv(ndev); |
276 | const struct platform_device_id *id_entry = | 290 | const struct platform_device_id *id_entry = |
277 | platform_get_device_id(fep->pdev); | 291 | platform_get_device_id(fep->pdev); |
278 | struct bufdesc *bdp; | 292 | struct bufdesc *bdp, *bdp_pre; |
279 | void *bufaddr; | 293 | void *bufaddr; |
280 | unsigned short status; | 294 | unsigned short status; |
281 | unsigned int index; | 295 | unsigned int index; |
282 | 296 | ||
283 | if (!fep->link) { | ||
284 | /* Link is down or auto-negotiation is in progress. */ | ||
285 | return NETDEV_TX_BUSY; | ||
286 | } | ||
287 | |||
288 | /* Fill in a Tx ring entry */ | 297 | /* Fill in a Tx ring entry */ |
289 | bdp = fep->cur_tx; | 298 | bdp = fep->cur_tx; |
290 | 299 | ||
@@ -370,6 +379,15 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
370 | ebdp->cbd_esc |= BD_ENET_TX_PINS; | 379 | ebdp->cbd_esc |= BD_ENET_TX_PINS; |
371 | } | 380 | } |
372 | } | 381 | } |
382 | |||
383 | bdp_pre = fec_enet_get_prevdesc(bdp, fep->bufdesc_ex); | ||
384 | if ((id_entry->driver_data & FEC_QUIRK_ERR006358) && | ||
385 | !(bdp_pre->cbd_sc & BD_ENET_TX_READY)) { | ||
386 | fep->delay_work.trig_tx = true; | ||
387 | schedule_delayed_work(&(fep->delay_work.delay_work), | ||
388 | msecs_to_jiffies(1)); | ||
389 | } | ||
390 | |||
373 | /* If this was the last BD in the ring, start at the beginning again. */ | 391 | /* If this was the last BD in the ring, start at the beginning again. */ |
374 | if (status & BD_ENET_TX_WRAP) | 392 | if (status & BD_ENET_TX_WRAP) |
375 | bdp = fep->tx_bd_base; | 393 | bdp = fep->tx_bd_base; |
@@ -689,6 +707,11 @@ static void fec_enet_work(struct work_struct *work) | |||
689 | fec_restart(fep->netdev, fep->full_duplex); | 707 | fec_restart(fep->netdev, fep->full_duplex); |
690 | netif_wake_queue(fep->netdev); | 708 | netif_wake_queue(fep->netdev); |
691 | } | 709 | } |
710 | |||
711 | if (fep->delay_work.trig_tx) { | ||
712 | fep->delay_work.trig_tx = false; | ||
713 | writel(0, fep->hwp + FEC_X_DES_ACTIVE); | ||
714 | } | ||
692 | } | 715 | } |
693 | 716 | ||
694 | static void | 717 | static void |
@@ -2279,4 +2302,5 @@ static struct platform_driver fec_driver = { | |||
2279 | 2302 | ||
2280 | module_platform_driver(fec_driver); | 2303 | module_platform_driver(fec_driver); |
2281 | 2304 | ||
2305 | MODULE_ALIAS("platform:"DRIVER_NAME); | ||
2282 | MODULE_LICENSE("GPL"); | 2306 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 6a0c1b66ce54..c1d72c03cb59 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -3739,9 +3739,8 @@ static void igb_set_rx_mode(struct net_device *netdev) | |||
3739 | rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE | E1000_RCTL_VFE); | 3739 | rctl &= ~(E1000_RCTL_UPE | E1000_RCTL_MPE | E1000_RCTL_VFE); |
3740 | 3740 | ||
3741 | if (netdev->flags & IFF_PROMISC) { | 3741 | if (netdev->flags & IFF_PROMISC) { |
3742 | u32 mrqc = rd32(E1000_MRQC); | ||
3743 | /* retain VLAN HW filtering if in VT mode */ | 3742 | /* retain VLAN HW filtering if in VT mode */ |
3744 | if (mrqc & E1000_MRQC_ENABLE_VMDQ) | 3743 | if (adapter->vfs_allocated_count) |
3745 | rctl |= E1000_RCTL_VFE; | 3744 | rctl |= E1000_RCTL_VFE; |
3746 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); | 3745 | rctl |= (E1000_RCTL_UPE | E1000_RCTL_MPE); |
3747 | vmolr |= (E1000_VMOLR_ROPE | E1000_VMOLR_MPME); | 3746 | vmolr |= (E1000_VMOLR_ROPE | E1000_VMOLR_MPME); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 7be725cdfea8..a6494e5daffe 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -54,7 +54,7 @@ | |||
54 | 54 | ||
55 | #include <net/busy_poll.h> | 55 | #include <net/busy_poll.h> |
56 | 56 | ||
57 | #ifdef CONFIG_NET_LL_RX_POLL | 57 | #ifdef CONFIG_NET_RX_BUSY_POLL |
58 | #define LL_EXTENDED_STATS | 58 | #define LL_EXTENDED_STATS |
59 | #endif | 59 | #endif |
60 | /* common prefix used by pr_<> macros */ | 60 | /* common prefix used by pr_<> macros */ |
@@ -366,7 +366,7 @@ struct ixgbe_q_vector { | |||
366 | struct rcu_head rcu; /* to avoid race with update stats on free */ | 366 | struct rcu_head rcu; /* to avoid race with update stats on free */ |
367 | char name[IFNAMSIZ + 9]; | 367 | char name[IFNAMSIZ + 9]; |
368 | 368 | ||
369 | #ifdef CONFIG_NET_LL_RX_POLL | 369 | #ifdef CONFIG_NET_RX_BUSY_POLL |
370 | unsigned int state; | 370 | unsigned int state; |
371 | #define IXGBE_QV_STATE_IDLE 0 | 371 | #define IXGBE_QV_STATE_IDLE 0 |
372 | #define IXGBE_QV_STATE_NAPI 1 /* NAPI owns this QV */ | 372 | #define IXGBE_QV_STATE_NAPI 1 /* NAPI owns this QV */ |
@@ -377,12 +377,12 @@ struct ixgbe_q_vector { | |||
377 | #define IXGBE_QV_YIELD (IXGBE_QV_STATE_NAPI_YIELD | IXGBE_QV_STATE_POLL_YIELD) | 377 | #define IXGBE_QV_YIELD (IXGBE_QV_STATE_NAPI_YIELD | IXGBE_QV_STATE_POLL_YIELD) |
378 | #define IXGBE_QV_USER_PEND (IXGBE_QV_STATE_POLL | IXGBE_QV_STATE_POLL_YIELD) | 378 | #define IXGBE_QV_USER_PEND (IXGBE_QV_STATE_POLL | IXGBE_QV_STATE_POLL_YIELD) |
379 | spinlock_t lock; | 379 | spinlock_t lock; |
380 | #endif /* CONFIG_NET_LL_RX_POLL */ | 380 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
381 | 381 | ||
382 | /* for dynamic allocation of rings associated with this q_vector */ | 382 | /* for dynamic allocation of rings associated with this q_vector */ |
383 | struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp; | 383 | struct ixgbe_ring ring[0] ____cacheline_internodealigned_in_smp; |
384 | }; | 384 | }; |
385 | #ifdef CONFIG_NET_LL_RX_POLL | 385 | #ifdef CONFIG_NET_RX_BUSY_POLL |
386 | static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) | 386 | static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) |
387 | { | 387 | { |
388 | 388 | ||
@@ -462,7 +462,7 @@ static inline bool ixgbe_qv_ll_polling(struct ixgbe_q_vector *q_vector) | |||
462 | WARN_ON(!(q_vector->state & IXGBE_QV_LOCKED)); | 462 | WARN_ON(!(q_vector->state & IXGBE_QV_LOCKED)); |
463 | return q_vector->state & IXGBE_QV_USER_PEND; | 463 | return q_vector->state & IXGBE_QV_USER_PEND; |
464 | } | 464 | } |
465 | #else /* CONFIG_NET_LL_RX_POLL */ | 465 | #else /* CONFIG_NET_RX_BUSY_POLL */ |
466 | static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) | 466 | static inline void ixgbe_qv_init_lock(struct ixgbe_q_vector *q_vector) |
467 | { | 467 | { |
468 | } | 468 | } |
@@ -491,7 +491,7 @@ static inline bool ixgbe_qv_ll_polling(struct ixgbe_q_vector *q_vector) | |||
491 | { | 491 | { |
492 | return false; | 492 | return false; |
493 | } | 493 | } |
494 | #endif /* CONFIG_NET_LL_RX_POLL */ | 494 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
495 | 495 | ||
496 | #ifdef CONFIG_IXGBE_HWMON | 496 | #ifdef CONFIG_IXGBE_HWMON |
497 | 497 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c index ac780770863d..7a77f37a7cbc 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_82598.c | |||
@@ -108,9 +108,8 @@ s32 ixgbe_dcb_config_tx_desc_arbiter_82598(struct ixgbe_hw *hw, | |||
108 | 108 | ||
109 | /* Enable arbiter */ | 109 | /* Enable arbiter */ |
110 | reg &= ~IXGBE_DPMCS_ARBDIS; | 110 | reg &= ~IXGBE_DPMCS_ARBDIS; |
111 | /* Enable DFP and Recycle mode */ | ||
112 | reg |= (IXGBE_DPMCS_TDPAC | IXGBE_DPMCS_TRM); | ||
113 | reg |= IXGBE_DPMCS_TSOEF; | 111 | reg |= IXGBE_DPMCS_TSOEF; |
112 | |||
114 | /* Configure Max TSO packet size 34KB including payload and headers */ | 113 | /* Configure Max TSO packet size 34KB including payload and headers */ |
115 | reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT); | 114 | reg |= (0x4 << IXGBE_DPMCS_MTSOS_SHIFT); |
116 | 115 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index bad8f14b1941..be4b1fb3d0d2 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -1998,7 +1998,7 @@ static int ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
1998 | return total_rx_packets; | 1998 | return total_rx_packets; |
1999 | } | 1999 | } |
2000 | 2000 | ||
2001 | #ifdef CONFIG_NET_LL_RX_POLL | 2001 | #ifdef CONFIG_NET_RX_BUSY_POLL |
2002 | /* must be called with local_bh_disable()d */ | 2002 | /* must be called with local_bh_disable()d */ |
2003 | static int ixgbe_low_latency_recv(struct napi_struct *napi) | 2003 | static int ixgbe_low_latency_recv(struct napi_struct *napi) |
2004 | { | 2004 | { |
@@ -2030,7 +2030,7 @@ static int ixgbe_low_latency_recv(struct napi_struct *napi) | |||
2030 | 2030 | ||
2031 | return found; | 2031 | return found; |
2032 | } | 2032 | } |
2033 | #endif /* CONFIG_NET_LL_RX_POLL */ | 2033 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
2034 | 2034 | ||
2035 | /** | 2035 | /** |
2036 | * ixgbe_configure_msix - Configure MSI-X hardware | 2036 | * ixgbe_configure_msix - Configure MSI-X hardware |
@@ -7227,7 +7227,7 @@ static const struct net_device_ops ixgbe_netdev_ops = { | |||
7227 | #ifdef CONFIG_NET_POLL_CONTROLLER | 7227 | #ifdef CONFIG_NET_POLL_CONTROLLER |
7228 | .ndo_poll_controller = ixgbe_netpoll, | 7228 | .ndo_poll_controller = ixgbe_netpoll, |
7229 | #endif | 7229 | #endif |
7230 | #ifdef CONFIG_NET_LL_RX_POLL | 7230 | #ifdef CONFIG_NET_RX_BUSY_POLL |
7231 | .ndo_busy_poll = ixgbe_low_latency_recv, | 7231 | .ndo_busy_poll = ixgbe_low_latency_recv, |
7232 | #endif | 7232 | #endif |
7233 | #ifdef IXGBE_FCOE | 7233 | #ifdef IXGBE_FCOE |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 712779fb12b7..b017818bccae 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -88,6 +88,8 @@ | |||
88 | #define MVNETA_TX_IN_PRGRS BIT(1) | 88 | #define MVNETA_TX_IN_PRGRS BIT(1) |
89 | #define MVNETA_TX_FIFO_EMPTY BIT(8) | 89 | #define MVNETA_TX_FIFO_EMPTY BIT(8) |
90 | #define MVNETA_RX_MIN_FRAME_SIZE 0x247c | 90 | #define MVNETA_RX_MIN_FRAME_SIZE 0x247c |
91 | #define MVNETA_SGMII_SERDES_CFG 0x24A0 | ||
92 | #define MVNETA_SGMII_SERDES_PROTO 0x0cc7 | ||
91 | #define MVNETA_TYPE_PRIO 0x24bc | 93 | #define MVNETA_TYPE_PRIO 0x24bc |
92 | #define MVNETA_FORCE_UNI BIT(21) | 94 | #define MVNETA_FORCE_UNI BIT(21) |
93 | #define MVNETA_TXQ_CMD_1 0x24e4 | 95 | #define MVNETA_TXQ_CMD_1 0x24e4 |
@@ -655,6 +657,8 @@ static void mvneta_port_sgmii_config(struct mvneta_port *pp) | |||
655 | val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); | 657 | val = mvreg_read(pp, MVNETA_GMAC_CTRL_2); |
656 | val |= MVNETA_GMAC2_PSC_ENABLE; | 658 | val |= MVNETA_GMAC2_PSC_ENABLE; |
657 | mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); | 659 | mvreg_write(pp, MVNETA_GMAC_CTRL_2, val); |
660 | |||
661 | mvreg_write(pp, MVNETA_SGMII_SERDES_CFG, MVNETA_SGMII_SERDES_PROTO); | ||
658 | } | 662 | } |
659 | 663 | ||
660 | /* Start the Ethernet port RX and TX activity */ | 664 | /* Start the Ethernet port RX and TX activity */ |
@@ -2728,28 +2732,24 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2728 | 2732 | ||
2729 | pp = netdev_priv(dev); | 2733 | pp = netdev_priv(dev); |
2730 | 2734 | ||
2731 | pp->tx_done_timer.function = mvneta_tx_done_timer_callback; | ||
2732 | init_timer(&pp->tx_done_timer); | ||
2733 | clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags); | ||
2734 | |||
2735 | pp->weight = MVNETA_RX_POLL_WEIGHT; | 2735 | pp->weight = MVNETA_RX_POLL_WEIGHT; |
2736 | pp->phy_node = phy_node; | 2736 | pp->phy_node = phy_node; |
2737 | pp->phy_interface = phy_mode; | 2737 | pp->phy_interface = phy_mode; |
2738 | 2738 | ||
2739 | pp->base = of_iomap(dn, 0); | ||
2740 | if (pp->base == NULL) { | ||
2741 | err = -ENOMEM; | ||
2742 | goto err_free_irq; | ||
2743 | } | ||
2744 | |||
2745 | pp->clk = devm_clk_get(&pdev->dev, NULL); | 2739 | pp->clk = devm_clk_get(&pdev->dev, NULL); |
2746 | if (IS_ERR(pp->clk)) { | 2740 | if (IS_ERR(pp->clk)) { |
2747 | err = PTR_ERR(pp->clk); | 2741 | err = PTR_ERR(pp->clk); |
2748 | goto err_unmap; | 2742 | goto err_free_irq; |
2749 | } | 2743 | } |
2750 | 2744 | ||
2751 | clk_prepare_enable(pp->clk); | 2745 | clk_prepare_enable(pp->clk); |
2752 | 2746 | ||
2747 | pp->base = of_iomap(dn, 0); | ||
2748 | if (pp->base == NULL) { | ||
2749 | err = -ENOMEM; | ||
2750 | goto err_clk; | ||
2751 | } | ||
2752 | |||
2753 | dt_mac_addr = of_get_mac_address(dn); | 2753 | dt_mac_addr = of_get_mac_address(dn); |
2754 | if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) { | 2754 | if (dt_mac_addr && is_valid_ether_addr(dt_mac_addr)) { |
2755 | mac_from = "device tree"; | 2755 | mac_from = "device tree"; |
@@ -2766,6 +2766,9 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2766 | } | 2766 | } |
2767 | 2767 | ||
2768 | pp->tx_done_timer.data = (unsigned long)dev; | 2768 | pp->tx_done_timer.data = (unsigned long)dev; |
2769 | pp->tx_done_timer.function = mvneta_tx_done_timer_callback; | ||
2770 | init_timer(&pp->tx_done_timer); | ||
2771 | clear_bit(MVNETA_F_TX_DONE_TIMER_BIT, &pp->flags); | ||
2769 | 2772 | ||
2770 | pp->tx_ring_size = MVNETA_MAX_TXD; | 2773 | pp->tx_ring_size = MVNETA_MAX_TXD; |
2771 | pp->rx_ring_size = MVNETA_MAX_RXD; | 2774 | pp->rx_ring_size = MVNETA_MAX_RXD; |
@@ -2776,7 +2779,7 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2776 | err = mvneta_init(pp, phy_addr); | 2779 | err = mvneta_init(pp, phy_addr); |
2777 | if (err < 0) { | 2780 | if (err < 0) { |
2778 | dev_err(&pdev->dev, "can't init eth hal\n"); | 2781 | dev_err(&pdev->dev, "can't init eth hal\n"); |
2779 | goto err_clk; | 2782 | goto err_unmap; |
2780 | } | 2783 | } |
2781 | mvneta_port_power_up(pp, phy_mode); | 2784 | mvneta_port_power_up(pp, phy_mode); |
2782 | 2785 | ||
@@ -2806,10 +2809,10 @@ static int mvneta_probe(struct platform_device *pdev) | |||
2806 | 2809 | ||
2807 | err_deinit: | 2810 | err_deinit: |
2808 | mvneta_deinit(pp); | 2811 | mvneta_deinit(pp); |
2809 | err_clk: | ||
2810 | clk_disable_unprepare(pp->clk); | ||
2811 | err_unmap: | 2812 | err_unmap: |
2812 | iounmap(pp->base); | 2813 | iounmap(pp->base); |
2814 | err_clk: | ||
2815 | clk_disable_unprepare(pp->clk); | ||
2813 | err_free_irq: | 2816 | err_free_irq: |
2814 | irq_dispose_mapping(dev->irq); | 2817 | irq_dispose_mapping(dev->irq); |
2815 | err_free_netdev: | 2818 | err_free_netdev: |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 727874f575ce..a28cd801a236 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -223,7 +223,7 @@ static int mlx4_en_get_sset_count(struct net_device *dev, int sset) | |||
223 | case ETH_SS_STATS: | 223 | case ETH_SS_STATS: |
224 | return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) + | 224 | return (priv->stats_bitmap ? bit_count : NUM_ALL_STATS) + |
225 | (priv->tx_ring_num * 2) + | 225 | (priv->tx_ring_num * 2) + |
226 | #ifdef CONFIG_NET_LL_RX_POLL | 226 | #ifdef CONFIG_NET_RX_BUSY_POLL |
227 | (priv->rx_ring_num * 5); | 227 | (priv->rx_ring_num * 5); |
228 | #else | 228 | #else |
229 | (priv->rx_ring_num * 2); | 229 | (priv->rx_ring_num * 2); |
@@ -276,7 +276,7 @@ static void mlx4_en_get_ethtool_stats(struct net_device *dev, | |||
276 | for (i = 0; i < priv->rx_ring_num; i++) { | 276 | for (i = 0; i < priv->rx_ring_num; i++) { |
277 | data[index++] = priv->rx_ring[i].packets; | 277 | data[index++] = priv->rx_ring[i].packets; |
278 | data[index++] = priv->rx_ring[i].bytes; | 278 | data[index++] = priv->rx_ring[i].bytes; |
279 | #ifdef CONFIG_NET_LL_RX_POLL | 279 | #ifdef CONFIG_NET_RX_BUSY_POLL |
280 | data[index++] = priv->rx_ring[i].yields; | 280 | data[index++] = priv->rx_ring[i].yields; |
281 | data[index++] = priv->rx_ring[i].misses; | 281 | data[index++] = priv->rx_ring[i].misses; |
282 | data[index++] = priv->rx_ring[i].cleaned; | 282 | data[index++] = priv->rx_ring[i].cleaned; |
@@ -344,7 +344,7 @@ static void mlx4_en_get_strings(struct net_device *dev, | |||
344 | "rx%d_packets", i); | 344 | "rx%d_packets", i); |
345 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 345 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
346 | "rx%d_bytes", i); | 346 | "rx%d_bytes", i); |
347 | #ifdef CONFIG_NET_LL_RX_POLL | 347 | #ifdef CONFIG_NET_RX_BUSY_POLL |
348 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 348 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
349 | "rx%d_napi_yield", i); | 349 | "rx%d_napi_yield", i); |
350 | sprintf(data + (index++) * ETH_GSTRING_LEN, | 350 | sprintf(data + (index++) * ETH_GSTRING_LEN, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 5eac871399d8..fa37b7a61213 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -68,7 +68,7 @@ int mlx4_en_setup_tc(struct net_device *dev, u8 up) | |||
68 | return 0; | 68 | return 0; |
69 | } | 69 | } |
70 | 70 | ||
71 | #ifdef CONFIG_NET_LL_RX_POLL | 71 | #ifdef CONFIG_NET_RX_BUSY_POLL |
72 | /* must be called with local_bh_disable()d */ | 72 | /* must be called with local_bh_disable()d */ |
73 | static int mlx4_en_low_latency_recv(struct napi_struct *napi) | 73 | static int mlx4_en_low_latency_recv(struct napi_struct *napi) |
74 | { | 74 | { |
@@ -94,7 +94,7 @@ static int mlx4_en_low_latency_recv(struct napi_struct *napi) | |||
94 | 94 | ||
95 | return done; | 95 | return done; |
96 | } | 96 | } |
97 | #endif /* CONFIG_NET_LL_RX_POLL */ | 97 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
98 | 98 | ||
99 | #ifdef CONFIG_RFS_ACCEL | 99 | #ifdef CONFIG_RFS_ACCEL |
100 | 100 | ||
@@ -2140,7 +2140,7 @@ static const struct net_device_ops mlx4_netdev_ops = { | |||
2140 | #ifdef CONFIG_RFS_ACCEL | 2140 | #ifdef CONFIG_RFS_ACCEL |
2141 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, | 2141 | .ndo_rx_flow_steer = mlx4_en_filter_rfs, |
2142 | #endif | 2142 | #endif |
2143 | #ifdef CONFIG_NET_LL_RX_POLL | 2143 | #ifdef CONFIG_NET_RX_BUSY_POLL |
2144 | .ndo_busy_poll = mlx4_en_low_latency_recv, | 2144 | .ndo_busy_poll = mlx4_en_low_latency_recv, |
2145 | #endif | 2145 | #endif |
2146 | }; | 2146 | }; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 8873d6802c80..6fc6dabc78d5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -845,16 +845,7 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, | |||
845 | MLX4_CMD_NATIVE); | 845 | MLX4_CMD_NATIVE); |
846 | 846 | ||
847 | if (!err && dev->caps.function != slave) { | 847 | if (!err && dev->caps.function != slave) { |
848 | /* if config MAC in DB use it */ | 848 | def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; |
849 | if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac) | ||
850 | def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac; | ||
851 | else { | ||
852 | /* set slave default_mac address */ | ||
853 | MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET); | ||
854 | def_mac += slave << 8; | ||
855 | priv->mfunc.master.vf_admin[slave].vport[vhcr->in_modifier].mac = def_mac; | ||
856 | } | ||
857 | |||
858 | MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); | 849 | MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET); |
859 | 850 | ||
860 | /* get port type - currently only eth is enabled */ | 851 | /* get port type - currently only eth is enabled */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index e85af922dcdc..36be3208786a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -371,7 +371,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
371 | 371 | ||
372 | dev->caps.sqp_demux = (mlx4_is_master(dev)) ? MLX4_MAX_NUM_SLAVES : 0; | 372 | dev->caps.sqp_demux = (mlx4_is_master(dev)) ? MLX4_MAX_NUM_SLAVES : 0; |
373 | 373 | ||
374 | if (!enable_64b_cqe_eqe) { | 374 | if (!enable_64b_cqe_eqe && !mlx4_is_slave(dev)) { |
375 | if (dev_cap->flags & | 375 | if (dev_cap->flags & |
376 | (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) { | 376 | (MLX4_DEV_CAP_FLAG_64B_CQE | MLX4_DEV_CAP_FLAG_64B_EQE)) { |
377 | mlx4_warn(dev, "64B EQEs/CQEs supported by the device but not enabled\n"); | 377 | mlx4_warn(dev, "64B EQEs/CQEs supported by the device but not enabled\n"); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 35fb60e2320c..5e0aa569306a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -292,7 +292,7 @@ struct mlx4_en_rx_ring { | |||
292 | void *rx_info; | 292 | void *rx_info; |
293 | unsigned long bytes; | 293 | unsigned long bytes; |
294 | unsigned long packets; | 294 | unsigned long packets; |
295 | #ifdef CONFIG_NET_LL_RX_POLL | 295 | #ifdef CONFIG_NET_RX_BUSY_POLL |
296 | unsigned long yields; | 296 | unsigned long yields; |
297 | unsigned long misses; | 297 | unsigned long misses; |
298 | unsigned long cleaned; | 298 | unsigned long cleaned; |
@@ -318,7 +318,7 @@ struct mlx4_en_cq { | |||
318 | struct mlx4_cqe *buf; | 318 | struct mlx4_cqe *buf; |
319 | #define MLX4_EN_OPCODE_ERROR 0x1e | 319 | #define MLX4_EN_OPCODE_ERROR 0x1e |
320 | 320 | ||
321 | #ifdef CONFIG_NET_LL_RX_POLL | 321 | #ifdef CONFIG_NET_RX_BUSY_POLL |
322 | unsigned int state; | 322 | unsigned int state; |
323 | #define MLX4_EN_CQ_STATE_IDLE 0 | 323 | #define MLX4_EN_CQ_STATE_IDLE 0 |
324 | #define MLX4_EN_CQ_STATE_NAPI 1 /* NAPI owns this CQ */ | 324 | #define MLX4_EN_CQ_STATE_NAPI 1 /* NAPI owns this CQ */ |
@@ -329,7 +329,7 @@ struct mlx4_en_cq { | |||
329 | #define CQ_YIELD (MLX4_EN_CQ_STATE_NAPI_YIELD | MLX4_EN_CQ_STATE_POLL_YIELD) | 329 | #define CQ_YIELD (MLX4_EN_CQ_STATE_NAPI_YIELD | MLX4_EN_CQ_STATE_POLL_YIELD) |
330 | #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) | 330 | #define CQ_USER_PEND (MLX4_EN_CQ_STATE_POLL | MLX4_EN_CQ_STATE_POLL_YIELD) |
331 | spinlock_t poll_lock; /* protects from LLS/napi conflicts */ | 331 | spinlock_t poll_lock; /* protects from LLS/napi conflicts */ |
332 | #endif /* CONFIG_NET_LL_RX_POLL */ | 332 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
333 | }; | 333 | }; |
334 | 334 | ||
335 | struct mlx4_en_port_profile { | 335 | struct mlx4_en_port_profile { |
@@ -580,7 +580,7 @@ struct mlx4_mac_entry { | |||
580 | struct rcu_head rcu; | 580 | struct rcu_head rcu; |
581 | }; | 581 | }; |
582 | 582 | ||
583 | #ifdef CONFIG_NET_LL_RX_POLL | 583 | #ifdef CONFIG_NET_RX_BUSY_POLL |
584 | static inline void mlx4_en_cq_init_lock(struct mlx4_en_cq *cq) | 584 | static inline void mlx4_en_cq_init_lock(struct mlx4_en_cq *cq) |
585 | { | 585 | { |
586 | spin_lock_init(&cq->poll_lock); | 586 | spin_lock_init(&cq->poll_lock); |
@@ -687,7 +687,7 @@ static inline bool mlx4_en_cq_ll_polling(struct mlx4_en_cq *cq) | |||
687 | { | 687 | { |
688 | return false; | 688 | return false; |
689 | } | 689 | } |
690 | #endif /* CONFIG_NET_LL_RX_POLL */ | 690 | #endif /* CONFIG_NET_RX_BUSY_POLL */ |
691 | 691 | ||
692 | #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63) | 692 | #define MLX4_EN_WOL_DO_MODIFY (1ULL << 63) |
693 | 693 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c index 205753a04cfc..c571de85d0f9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include "mlx5_core.h" | 46 | #include "mlx5_core.h" |
47 | 47 | ||
48 | enum { | 48 | enum { |
49 | CMD_IF_REV = 3, | 49 | CMD_IF_REV = 4, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | enum { | 52 | enum { |
@@ -282,6 +282,12 @@ const char *mlx5_command_str(int command) | |||
282 | case MLX5_CMD_OP_TEARDOWN_HCA: | 282 | case MLX5_CMD_OP_TEARDOWN_HCA: |
283 | return "TEARDOWN_HCA"; | 283 | return "TEARDOWN_HCA"; |
284 | 284 | ||
285 | case MLX5_CMD_OP_ENABLE_HCA: | ||
286 | return "MLX5_CMD_OP_ENABLE_HCA"; | ||
287 | |||
288 | case MLX5_CMD_OP_DISABLE_HCA: | ||
289 | return "MLX5_CMD_OP_DISABLE_HCA"; | ||
290 | |||
285 | case MLX5_CMD_OP_QUERY_PAGES: | 291 | case MLX5_CMD_OP_QUERY_PAGES: |
286 | return "QUERY_PAGES"; | 292 | return "QUERY_PAGES"; |
287 | 293 | ||
@@ -1113,7 +1119,13 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) | |||
1113 | 1119 | ||
1114 | for (i = 0; i < (1 << cmd->log_sz); i++) { | 1120 | for (i = 0; i < (1 << cmd->log_sz); i++) { |
1115 | if (test_bit(i, &vector)) { | 1121 | if (test_bit(i, &vector)) { |
1122 | struct semaphore *sem; | ||
1123 | |||
1116 | ent = cmd->ent_arr[i]; | 1124 | ent = cmd->ent_arr[i]; |
1125 | if (ent->page_queue) | ||
1126 | sem = &cmd->pages_sem; | ||
1127 | else | ||
1128 | sem = &cmd->sem; | ||
1117 | ktime_get_ts(&ent->ts2); | 1129 | ktime_get_ts(&ent->ts2); |
1118 | memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); | 1130 | memcpy(ent->out->first.data, ent->lay->out, sizeof(ent->lay->out)); |
1119 | dump_command(dev, ent, 0); | 1131 | dump_command(dev, ent, 0); |
@@ -1136,10 +1148,7 @@ void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, unsigned long vector) | |||
1136 | } else { | 1148 | } else { |
1137 | complete(&ent->done); | 1149 | complete(&ent->done); |
1138 | } | 1150 | } |
1139 | if (ent->page_queue) | 1151 | up(sem); |
1140 | up(&cmd->pages_sem); | ||
1141 | else | ||
1142 | up(&cmd->sem); | ||
1143 | } | 1152 | } |
1144 | } | 1153 | } |
1145 | } | 1154 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 12242de2b0e3..b47739b0b5f6 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -249,6 +249,44 @@ static int set_hca_ctrl(struct mlx5_core_dev *dev) | |||
249 | return err; | 249 | return err; |
250 | } | 250 | } |
251 | 251 | ||
252 | static int mlx5_core_enable_hca(struct mlx5_core_dev *dev) | ||
253 | { | ||
254 | int err; | ||
255 | struct mlx5_enable_hca_mbox_in in; | ||
256 | struct mlx5_enable_hca_mbox_out out; | ||
257 | |||
258 | memset(&in, 0, sizeof(in)); | ||
259 | memset(&out, 0, sizeof(out)); | ||
260 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_ENABLE_HCA); | ||
261 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | ||
262 | if (err) | ||
263 | return err; | ||
264 | |||
265 | if (out.hdr.status) | ||
266 | return mlx5_cmd_status_to_err(&out.hdr); | ||
267 | |||
268 | return 0; | ||
269 | } | ||
270 | |||
271 | static int mlx5_core_disable_hca(struct mlx5_core_dev *dev) | ||
272 | { | ||
273 | int err; | ||
274 | struct mlx5_disable_hca_mbox_in in; | ||
275 | struct mlx5_disable_hca_mbox_out out; | ||
276 | |||
277 | memset(&in, 0, sizeof(in)); | ||
278 | memset(&out, 0, sizeof(out)); | ||
279 | in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DISABLE_HCA); | ||
280 | err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out)); | ||
281 | if (err) | ||
282 | return err; | ||
283 | |||
284 | if (out.hdr.status) | ||
285 | return mlx5_cmd_status_to_err(&out.hdr); | ||
286 | |||
287 | return 0; | ||
288 | } | ||
289 | |||
252 | int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) | 290 | int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) |
253 | { | 291 | { |
254 | struct mlx5_priv *priv = &dev->priv; | 292 | struct mlx5_priv *priv = &dev->priv; |
@@ -304,28 +342,41 @@ int mlx5_dev_init(struct mlx5_core_dev *dev, struct pci_dev *pdev) | |||
304 | } | 342 | } |
305 | 343 | ||
306 | mlx5_pagealloc_init(dev); | 344 | mlx5_pagealloc_init(dev); |
345 | |||
346 | err = mlx5_core_enable_hca(dev); | ||
347 | if (err) { | ||
348 | dev_err(&pdev->dev, "enable hca failed\n"); | ||
349 | goto err_pagealloc_cleanup; | ||
350 | } | ||
351 | |||
352 | err = mlx5_satisfy_startup_pages(dev, 1); | ||
353 | if (err) { | ||
354 | dev_err(&pdev->dev, "failed to allocate boot pages\n"); | ||
355 | goto err_disable_hca; | ||
356 | } | ||
357 | |||
307 | err = set_hca_ctrl(dev); | 358 | err = set_hca_ctrl(dev); |
308 | if (err) { | 359 | if (err) { |
309 | dev_err(&pdev->dev, "set_hca_ctrl failed\n"); | 360 | dev_err(&pdev->dev, "set_hca_ctrl failed\n"); |
310 | goto err_pagealloc_cleanup; | 361 | goto reclaim_boot_pages; |
311 | } | 362 | } |
312 | 363 | ||
313 | err = handle_hca_cap(dev); | 364 | err = handle_hca_cap(dev); |
314 | if (err) { | 365 | if (err) { |
315 | dev_err(&pdev->dev, "handle_hca_cap failed\n"); | 366 | dev_err(&pdev->dev, "handle_hca_cap failed\n"); |
316 | goto err_pagealloc_cleanup; | 367 | goto reclaim_boot_pages; |
317 | } | 368 | } |
318 | 369 | ||
319 | err = mlx5_satisfy_startup_pages(dev); | 370 | err = mlx5_satisfy_startup_pages(dev, 0); |
320 | if (err) { | 371 | if (err) { |
321 | dev_err(&pdev->dev, "failed to allocate startup pages\n"); | 372 | dev_err(&pdev->dev, "failed to allocate init pages\n"); |
322 | goto err_pagealloc_cleanup; | 373 | goto reclaim_boot_pages; |
323 | } | 374 | } |
324 | 375 | ||
325 | err = mlx5_pagealloc_start(dev); | 376 | err = mlx5_pagealloc_start(dev); |
326 | if (err) { | 377 | if (err) { |
327 | dev_err(&pdev->dev, "mlx5_pagealloc_start failed\n"); | 378 | dev_err(&pdev->dev, "mlx5_pagealloc_start failed\n"); |
328 | goto err_reclaim_pages; | 379 | goto reclaim_boot_pages; |
329 | } | 380 | } |
330 | 381 | ||
331 | err = mlx5_cmd_init_hca(dev); | 382 | err = mlx5_cmd_init_hca(dev); |
@@ -396,9 +447,12 @@ err_stop_poll: | |||
396 | err_pagealloc_stop: | 447 | err_pagealloc_stop: |
397 | mlx5_pagealloc_stop(dev); | 448 | mlx5_pagealloc_stop(dev); |
398 | 449 | ||
399 | err_reclaim_pages: | 450 | reclaim_boot_pages: |
400 | mlx5_reclaim_startup_pages(dev); | 451 | mlx5_reclaim_startup_pages(dev); |
401 | 452 | ||
453 | err_disable_hca: | ||
454 | mlx5_core_disable_hca(dev); | ||
455 | |||
402 | err_pagealloc_cleanup: | 456 | err_pagealloc_cleanup: |
403 | mlx5_pagealloc_cleanup(dev); | 457 | mlx5_pagealloc_cleanup(dev); |
404 | mlx5_cmd_cleanup(dev); | 458 | mlx5_cmd_cleanup(dev); |
@@ -434,6 +488,7 @@ void mlx5_dev_cleanup(struct mlx5_core_dev *dev) | |||
434 | mlx5_cmd_teardown_hca(dev); | 488 | mlx5_cmd_teardown_hca(dev); |
435 | mlx5_pagealloc_stop(dev); | 489 | mlx5_pagealloc_stop(dev); |
436 | mlx5_reclaim_startup_pages(dev); | 490 | mlx5_reclaim_startup_pages(dev); |
491 | mlx5_core_disable_hca(dev); | ||
437 | mlx5_pagealloc_cleanup(dev); | 492 | mlx5_pagealloc_cleanup(dev); |
438 | mlx5_cmd_cleanup(dev); | 493 | mlx5_cmd_cleanup(dev); |
439 | iounmap(dev->iseg); | 494 | iounmap(dev->iseg); |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c index f0bf46339b28..4a3e137931a3 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | |||
@@ -64,7 +64,7 @@ struct mlx5_query_pages_inbox { | |||
64 | 64 | ||
65 | struct mlx5_query_pages_outbox { | 65 | struct mlx5_query_pages_outbox { |
66 | struct mlx5_outbox_hdr hdr; | 66 | struct mlx5_outbox_hdr hdr; |
67 | u8 reserved[2]; | 67 | __be16 num_boot_pages; |
68 | __be16 func_id; | 68 | __be16 func_id; |
69 | __be16 init_pages; | 69 | __be16 init_pages; |
70 | __be16 num_pages; | 70 | __be16 num_pages; |
@@ -146,7 +146,7 @@ static struct page *remove_page(struct mlx5_core_dev *dev, u64 addr) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | 148 | static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, |
149 | s16 *pages, s16 *init_pages) | 149 | s16 *pages, s16 *init_pages, u16 *boot_pages) |
150 | { | 150 | { |
151 | struct mlx5_query_pages_inbox in; | 151 | struct mlx5_query_pages_inbox in; |
152 | struct mlx5_query_pages_outbox out; | 152 | struct mlx5_query_pages_outbox out; |
@@ -164,8 +164,13 @@ static int mlx5_cmd_query_pages(struct mlx5_core_dev *dev, u16 *func_id, | |||
164 | 164 | ||
165 | if (pages) | 165 | if (pages) |
166 | *pages = be16_to_cpu(out.num_pages); | 166 | *pages = be16_to_cpu(out.num_pages); |
167 | |||
167 | if (init_pages) | 168 | if (init_pages) |
168 | *init_pages = be16_to_cpu(out.init_pages); | 169 | *init_pages = be16_to_cpu(out.init_pages); |
170 | |||
171 | if (boot_pages) | ||
172 | *boot_pages = be16_to_cpu(out.num_boot_pages); | ||
173 | |||
169 | *func_id = be16_to_cpu(out.func_id); | 174 | *func_id = be16_to_cpu(out.func_id); |
170 | 175 | ||
171 | return err; | 176 | return err; |
@@ -357,19 +362,22 @@ void mlx5_core_req_pages_handler(struct mlx5_core_dev *dev, u16 func_id, | |||
357 | queue_work(dev->priv.pg_wq, &req->work); | 362 | queue_work(dev->priv.pg_wq, &req->work); |
358 | } | 363 | } |
359 | 364 | ||
360 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev) | 365 | int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot) |
361 | { | 366 | { |
367 | u16 uninitialized_var(boot_pages); | ||
362 | s16 uninitialized_var(init_pages); | 368 | s16 uninitialized_var(init_pages); |
363 | u16 uninitialized_var(func_id); | 369 | u16 uninitialized_var(func_id); |
364 | int err; | 370 | int err; |
365 | 371 | ||
366 | err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages); | 372 | err = mlx5_cmd_query_pages(dev, &func_id, NULL, &init_pages, |
373 | &boot_pages); | ||
367 | if (err) | 374 | if (err) |
368 | return err; | 375 | return err; |
369 | 376 | ||
370 | mlx5_core_dbg(dev, "requested %d init pages for func_id 0x%x\n", init_pages, func_id); | ||
371 | 377 | ||
372 | return give_pages(dev, func_id, init_pages, 0); | 378 | mlx5_core_dbg(dev, "requested %d init pages and %d boot pages for func_id 0x%x\n", |
379 | init_pages, boot_pages, func_id); | ||
380 | return give_pages(dev, func_id, boot ? boot_pages : init_pages, 0); | ||
373 | } | 381 | } |
374 | 382 | ||
375 | static int optimal_reclaimed_pages(void) | 383 | static int optimal_reclaimed_pages(void) |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c index 71d4a3937200..68f5d9c77c7b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c | |||
@@ -164,6 +164,7 @@ int mlx5_alloc_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari) | |||
164 | uuari->uars[i].map = ioremap(addr, PAGE_SIZE); | 164 | uuari->uars[i].map = ioremap(addr, PAGE_SIZE); |
165 | if (!uuari->uars[i].map) { | 165 | if (!uuari->uars[i].map) { |
166 | mlx5_cmd_free_uar(dev, uuari->uars[i].index); | 166 | mlx5_cmd_free_uar(dev, uuari->uars[i].index); |
167 | err = -ENOMEM; | ||
167 | goto out_count; | 168 | goto out_count; |
168 | } | 169 | } |
169 | mlx5_core_dbg(dev, "allocated uar index 0x%x, mmaped at %p\n", | 170 | mlx5_core_dbg(dev, "allocated uar index 0x%x, mmaped at %p\n", |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig index cb22341a14a8..a588ffde9700 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig +++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | config PCH_GBE | 5 | config PCH_GBE |
6 | tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE" | 6 | tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE" |
7 | depends on PCI | 7 | depends on PCI && (X86 || COMPILE_TEST) |
8 | select MII | 8 | select MII |
9 | select PTP_1588_CLOCK_PCH | 9 | select PTP_1588_CLOCK_PCH |
10 | ---help--- | 10 | ---help--- |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h index b00cf5665eab..221645e9f182 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic.h | |||
@@ -1400,8 +1400,8 @@ void qlcnic_pci_camqm_write_2M(struct qlcnic_adapter *, u64, u64); | |||
1400 | #define ADDR_IN_RANGE(addr, low, high) \ | 1400 | #define ADDR_IN_RANGE(addr, low, high) \ |
1401 | (((addr) < (high)) && ((addr) >= (low))) | 1401 | (((addr) < (high)) && ((addr) >= (low))) |
1402 | 1402 | ||
1403 | #define QLCRD32(adapter, off) \ | 1403 | #define QLCRD32(adapter, off, err) \ |
1404 | (adapter->ahw->hw_ops->read_reg)(adapter, off) | 1404 | (adapter->ahw->hw_ops->read_reg)(adapter, off, err) |
1405 | 1405 | ||
1406 | #define QLCWR32(adapter, off, val) \ | 1406 | #define QLCWR32(adapter, off, val) \ |
1407 | adapter->ahw->hw_ops->write_reg(adapter, off, val) | 1407 | adapter->ahw->hw_ops->write_reg(adapter, off, val) |
@@ -1604,7 +1604,7 @@ struct qlcnic_nic_template { | |||
1604 | struct qlcnic_hardware_ops { | 1604 | struct qlcnic_hardware_ops { |
1605 | void (*read_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); | 1605 | void (*read_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); |
1606 | void (*write_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); | 1606 | void (*write_crb) (struct qlcnic_adapter *, char *, loff_t, size_t); |
1607 | int (*read_reg) (struct qlcnic_adapter *, ulong); | 1607 | int (*read_reg) (struct qlcnic_adapter *, ulong, int *); |
1608 | int (*write_reg) (struct qlcnic_adapter *, ulong, u32); | 1608 | int (*write_reg) (struct qlcnic_adapter *, ulong, u32); |
1609 | void (*get_ocm_win) (struct qlcnic_hardware_context *); | 1609 | void (*get_ocm_win) (struct qlcnic_hardware_context *); |
1610 | int (*get_mac_address) (struct qlcnic_adapter *, u8 *); | 1610 | int (*get_mac_address) (struct qlcnic_adapter *, u8 *); |
@@ -1662,12 +1662,6 @@ static inline void qlcnic_write_crb(struct qlcnic_adapter *adapter, char *buf, | |||
1662 | adapter->ahw->hw_ops->write_crb(adapter, buf, offset, size); | 1662 | adapter->ahw->hw_ops->write_crb(adapter, buf, offset, size); |
1663 | } | 1663 | } |
1664 | 1664 | ||
1665 | static inline int qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, | ||
1666 | ulong off) | ||
1667 | { | ||
1668 | return adapter->ahw->hw_ops->read_reg(adapter, off); | ||
1669 | } | ||
1670 | |||
1671 | static inline int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter, | 1665 | static inline int qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter, |
1672 | ulong off, u32 data) | 1666 | ulong off, u32 data) |
1673 | { | 1667 | { |
@@ -1869,7 +1863,8 @@ static inline void qlcnic_free_mac_list(struct qlcnic_adapter *adapter) | |||
1869 | 1863 | ||
1870 | static inline void qlcnic_set_mac_filter_count(struct qlcnic_adapter *adapter) | 1864 | static inline void qlcnic_set_mac_filter_count(struct qlcnic_adapter *adapter) |
1871 | { | 1865 | { |
1872 | adapter->ahw->hw_ops->set_mac_filter_count(adapter); | 1866 | if (adapter->ahw->hw_ops->set_mac_filter_count) |
1867 | adapter->ahw->hw_ops->set_mac_filter_count(adapter); | ||
1873 | } | 1868 | } |
1874 | 1869 | ||
1875 | static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter, | 1870 | static inline void qlcnic_dev_request_reset(struct qlcnic_adapter *adapter, |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c index 0913c623a67e..92da9980a0a0 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c | |||
@@ -228,17 +228,17 @@ static int __qlcnic_set_win_base(struct qlcnic_adapter *adapter, u32 addr) | |||
228 | return 0; | 228 | return 0; |
229 | } | 229 | } |
230 | 230 | ||
231 | int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *adapter, ulong addr) | 231 | int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *adapter, ulong addr, |
232 | int *err) | ||
232 | { | 233 | { |
233 | int ret; | ||
234 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 234 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
235 | 235 | ||
236 | ret = __qlcnic_set_win_base(adapter, (u32) addr); | 236 | *err = __qlcnic_set_win_base(adapter, (u32) addr); |
237 | if (!ret) { | 237 | if (!*err) { |
238 | return QLCRDX(ahw, QLCNIC_WILDCARD); | 238 | return QLCRDX(ahw, QLCNIC_WILDCARD); |
239 | } else { | 239 | } else { |
240 | dev_err(&adapter->pdev->dev, | 240 | dev_err(&adapter->pdev->dev, |
241 | "%s failed, addr = 0x%x\n", __func__, (int)addr); | 241 | "%s failed, addr = 0x%lx\n", __func__, addr); |
242 | return -EIO; | 242 | return -EIO; |
243 | } | 243 | } |
244 | } | 244 | } |
@@ -561,7 +561,7 @@ void qlcnic_83xx_cam_unlock(struct qlcnic_adapter *adapter) | |||
561 | void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | 561 | void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, |
562 | loff_t offset, size_t size) | 562 | loff_t offset, size_t size) |
563 | { | 563 | { |
564 | int ret; | 564 | int ret = 0; |
565 | u32 data; | 565 | u32 data; |
566 | 566 | ||
567 | if (qlcnic_api_lock(adapter)) { | 567 | if (qlcnic_api_lock(adapter)) { |
@@ -571,7 +571,7 @@ void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | |||
571 | return; | 571 | return; |
572 | } | 572 | } |
573 | 573 | ||
574 | ret = qlcnic_83xx_rd_reg_indirect(adapter, (u32) offset); | 574 | data = QLCRD32(adapter, (u32) offset, &ret); |
575 | qlcnic_api_unlock(adapter); | 575 | qlcnic_api_unlock(adapter); |
576 | 576 | ||
577 | if (ret == -EIO) { | 577 | if (ret == -EIO) { |
@@ -580,7 +580,6 @@ void qlcnic_83xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | |||
580 | __func__, (u32)offset); | 580 | __func__, (u32)offset); |
581 | return; | 581 | return; |
582 | } | 582 | } |
583 | data = ret; | ||
584 | memcpy(buf, &data, size); | 583 | memcpy(buf, &data, size); |
585 | } | 584 | } |
586 | 585 | ||
@@ -2075,18 +2074,25 @@ void qlcnic_83xx_config_intr_coal(struct qlcnic_adapter *adapter) | |||
2075 | static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter, | 2074 | static void qlcnic_83xx_handle_link_aen(struct qlcnic_adapter *adapter, |
2076 | u32 data[]) | 2075 | u32 data[]) |
2077 | { | 2076 | { |
2077 | struct qlcnic_hardware_context *ahw = adapter->ahw; | ||
2078 | u8 link_status, duplex; | 2078 | u8 link_status, duplex; |
2079 | /* link speed */ | 2079 | /* link speed */ |
2080 | link_status = LSB(data[3]) & 1; | 2080 | link_status = LSB(data[3]) & 1; |
2081 | adapter->ahw->link_speed = MSW(data[2]); | 2081 | if (link_status) { |
2082 | adapter->ahw->link_autoneg = MSB(MSW(data[3])); | 2082 | ahw->link_speed = MSW(data[2]); |
2083 | adapter->ahw->module_type = MSB(LSW(data[3])); | 2083 | duplex = LSB(MSW(data[3])); |
2084 | duplex = LSB(MSW(data[3])); | 2084 | if (duplex) |
2085 | if (duplex) | 2085 | ahw->link_duplex = DUPLEX_FULL; |
2086 | adapter->ahw->link_duplex = DUPLEX_FULL; | 2086 | else |
2087 | else | 2087 | ahw->link_duplex = DUPLEX_HALF; |
2088 | adapter->ahw->link_duplex = DUPLEX_HALF; | 2088 | } else { |
2089 | adapter->ahw->has_link_events = 1; | 2089 | ahw->link_speed = SPEED_UNKNOWN; |
2090 | ahw->link_duplex = DUPLEX_UNKNOWN; | ||
2091 | } | ||
2092 | |||
2093 | ahw->link_autoneg = MSB(MSW(data[3])); | ||
2094 | ahw->module_type = MSB(LSW(data[3])); | ||
2095 | ahw->has_link_events = 1; | ||
2090 | qlcnic_advert_link_change(adapter, link_status); | 2096 | qlcnic_advert_link_change(adapter, link_status); |
2091 | } | 2097 | } |
2092 | 2098 | ||
@@ -2384,9 +2390,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, | |||
2384 | u32 flash_addr, u8 *p_data, | 2390 | u32 flash_addr, u8 *p_data, |
2385 | int count) | 2391 | int count) |
2386 | { | 2392 | { |
2387 | int i, ret; | 2393 | u32 word, range, flash_offset, addr = flash_addr, ret; |
2388 | u32 word, range, flash_offset, addr = flash_addr; | ||
2389 | ulong indirect_add, direct_window; | 2394 | ulong indirect_add, direct_window; |
2395 | int i, err = 0; | ||
2390 | 2396 | ||
2391 | flash_offset = addr & (QLCNIC_FLASH_SECTOR_SIZE - 1); | 2397 | flash_offset = addr & (QLCNIC_FLASH_SECTOR_SIZE - 1); |
2392 | if (addr & 0x3) { | 2398 | if (addr & 0x3) { |
@@ -2404,10 +2410,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, | |||
2404 | /* Multi sector read */ | 2410 | /* Multi sector read */ |
2405 | for (i = 0; i < count; i++) { | 2411 | for (i = 0; i < count; i++) { |
2406 | indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); | 2412 | indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); |
2407 | ret = qlcnic_83xx_rd_reg_indirect(adapter, | 2413 | ret = QLCRD32(adapter, indirect_add, &err); |
2408 | indirect_add); | 2414 | if (err == -EIO) |
2409 | if (ret == -EIO) | 2415 | return err; |
2410 | return -EIO; | ||
2411 | 2416 | ||
2412 | word = ret; | 2417 | word = ret; |
2413 | *(u32 *)p_data = word; | 2418 | *(u32 *)p_data = word; |
@@ -2428,10 +2433,9 @@ int qlcnic_83xx_lockless_flash_read32(struct qlcnic_adapter *adapter, | |||
2428 | /* Single sector read */ | 2433 | /* Single sector read */ |
2429 | for (i = 0; i < count; i++) { | 2434 | for (i = 0; i < count; i++) { |
2430 | indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); | 2435 | indirect_add = QLC_83XX_FLASH_DIRECT_DATA(addr); |
2431 | ret = qlcnic_83xx_rd_reg_indirect(adapter, | 2436 | ret = QLCRD32(adapter, indirect_add, &err); |
2432 | indirect_add); | 2437 | if (err == -EIO) |
2433 | if (ret == -EIO) | 2438 | return err; |
2434 | return -EIO; | ||
2435 | 2439 | ||
2436 | word = ret; | 2440 | word = ret; |
2437 | *(u32 *)p_data = word; | 2441 | *(u32 *)p_data = word; |
@@ -2447,10 +2451,13 @@ static int qlcnic_83xx_poll_flash_status_reg(struct qlcnic_adapter *adapter) | |||
2447 | { | 2451 | { |
2448 | u32 status; | 2452 | u32 status; |
2449 | int retries = QLC_83XX_FLASH_READ_RETRY_COUNT; | 2453 | int retries = QLC_83XX_FLASH_READ_RETRY_COUNT; |
2454 | int err = 0; | ||
2450 | 2455 | ||
2451 | do { | 2456 | do { |
2452 | status = qlcnic_83xx_rd_reg_indirect(adapter, | 2457 | status = QLCRD32(adapter, QLC_83XX_FLASH_STATUS, &err); |
2453 | QLC_83XX_FLASH_STATUS); | 2458 | if (err == -EIO) |
2459 | return err; | ||
2460 | |||
2454 | if ((status & QLC_83XX_FLASH_STATUS_READY) == | 2461 | if ((status & QLC_83XX_FLASH_STATUS_READY) == |
2455 | QLC_83XX_FLASH_STATUS_READY) | 2462 | QLC_83XX_FLASH_STATUS_READY) |
2456 | break; | 2463 | break; |
@@ -2502,7 +2509,8 @@ int qlcnic_83xx_disable_flash_write(struct qlcnic_adapter *adapter) | |||
2502 | 2509 | ||
2503 | int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) | 2510 | int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) |
2504 | { | 2511 | { |
2505 | int ret, mfg_id; | 2512 | int ret, err = 0; |
2513 | u32 mfg_id; | ||
2506 | 2514 | ||
2507 | if (qlcnic_83xx_lock_flash(adapter)) | 2515 | if (qlcnic_83xx_lock_flash(adapter)) |
2508 | return -EIO; | 2516 | return -EIO; |
@@ -2517,9 +2525,11 @@ int qlcnic_83xx_read_flash_mfg_id(struct qlcnic_adapter *adapter) | |||
2517 | return -EIO; | 2525 | return -EIO; |
2518 | } | 2526 | } |
2519 | 2527 | ||
2520 | mfg_id = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_RDDATA); | 2528 | mfg_id = QLCRD32(adapter, QLC_83XX_FLASH_RDDATA, &err); |
2521 | if (mfg_id == -EIO) | 2529 | if (err == -EIO) { |
2522 | return -EIO; | 2530 | qlcnic_83xx_unlock_flash(adapter); |
2531 | return err; | ||
2532 | } | ||
2523 | 2533 | ||
2524 | adapter->flash_mfg_id = (mfg_id & 0xFF); | 2534 | adapter->flash_mfg_id = (mfg_id & 0xFF); |
2525 | qlcnic_83xx_unlock_flash(adapter); | 2535 | qlcnic_83xx_unlock_flash(adapter); |
@@ -2636,7 +2646,7 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, | |||
2636 | u32 *p_data, int count) | 2646 | u32 *p_data, int count) |
2637 | { | 2647 | { |
2638 | u32 temp; | 2648 | u32 temp; |
2639 | int ret = -EIO; | 2649 | int ret = -EIO, err = 0; |
2640 | 2650 | ||
2641 | if ((count < QLC_83XX_FLASH_WRITE_MIN) || | 2651 | if ((count < QLC_83XX_FLASH_WRITE_MIN) || |
2642 | (count > QLC_83XX_FLASH_WRITE_MAX)) { | 2652 | (count > QLC_83XX_FLASH_WRITE_MAX)) { |
@@ -2645,8 +2655,10 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, | |||
2645 | return -EIO; | 2655 | return -EIO; |
2646 | } | 2656 | } |
2647 | 2657 | ||
2648 | temp = qlcnic_83xx_rd_reg_indirect(adapter, | 2658 | temp = QLCRD32(adapter, QLC_83XX_FLASH_SPI_CONTROL, &err); |
2649 | QLC_83XX_FLASH_SPI_CONTROL); | 2659 | if (err == -EIO) |
2660 | return err; | ||
2661 | |||
2650 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_SPI_CONTROL, | 2662 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_SPI_CONTROL, |
2651 | (temp | QLC_83XX_FLASH_SPI_CTRL)); | 2663 | (temp | QLC_83XX_FLASH_SPI_CTRL)); |
2652 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, | 2664 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, |
@@ -2695,13 +2707,18 @@ int qlcnic_83xx_flash_bulk_write(struct qlcnic_adapter *adapter, u32 addr, | |||
2695 | return -EIO; | 2707 | return -EIO; |
2696 | } | 2708 | } |
2697 | 2709 | ||
2698 | ret = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_SPI_STATUS); | 2710 | ret = QLCRD32(adapter, QLC_83XX_FLASH_SPI_STATUS, &err); |
2711 | if (err == -EIO) | ||
2712 | return err; | ||
2713 | |||
2699 | if ((ret & QLC_83XX_FLASH_SPI_CTRL) == QLC_83XX_FLASH_SPI_CTRL) { | 2714 | if ((ret & QLC_83XX_FLASH_SPI_CTRL) == QLC_83XX_FLASH_SPI_CTRL) { |
2700 | dev_err(&adapter->pdev->dev, "%s: failed at %d\n", | 2715 | dev_err(&adapter->pdev->dev, "%s: failed at %d\n", |
2701 | __func__, __LINE__); | 2716 | __func__, __LINE__); |
2702 | /* Operation failed, clear error bit */ | 2717 | /* Operation failed, clear error bit */ |
2703 | temp = qlcnic_83xx_rd_reg_indirect(adapter, | 2718 | temp = QLCRD32(adapter, QLC_83XX_FLASH_SPI_CONTROL, &err); |
2704 | QLC_83XX_FLASH_SPI_CONTROL); | 2719 | if (err == -EIO) |
2720 | return err; | ||
2721 | |||
2705 | qlcnic_83xx_wrt_reg_indirect(adapter, | 2722 | qlcnic_83xx_wrt_reg_indirect(adapter, |
2706 | QLC_83XX_FLASH_SPI_CONTROL, | 2723 | QLC_83XX_FLASH_SPI_CONTROL, |
2707 | (temp | QLC_83XX_FLASH_SPI_CTRL)); | 2724 | (temp | QLC_83XX_FLASH_SPI_CTRL)); |
@@ -2823,6 +2840,7 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, | |||
2823 | { | 2840 | { |
2824 | int i, j, ret = 0; | 2841 | int i, j, ret = 0; |
2825 | u32 temp; | 2842 | u32 temp; |
2843 | int err = 0; | ||
2826 | 2844 | ||
2827 | /* Check alignment */ | 2845 | /* Check alignment */ |
2828 | if (addr & 0xF) | 2846 | if (addr & 0xF) |
@@ -2855,8 +2873,12 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, | |||
2855 | QLCNIC_TA_WRITE_START); | 2873 | QLCNIC_TA_WRITE_START); |
2856 | 2874 | ||
2857 | for (j = 0; j < MAX_CTL_CHECK; j++) { | 2875 | for (j = 0; j < MAX_CTL_CHECK; j++) { |
2858 | temp = qlcnic_83xx_rd_reg_indirect(adapter, | 2876 | temp = QLCRD32(adapter, QLCNIC_MS_CTRL, &err); |
2859 | QLCNIC_MS_CTRL); | 2877 | if (err == -EIO) { |
2878 | mutex_unlock(&adapter->ahw->mem_lock); | ||
2879 | return err; | ||
2880 | } | ||
2881 | |||
2860 | if ((temp & TA_CTL_BUSY) == 0) | 2882 | if ((temp & TA_CTL_BUSY) == 0) |
2861 | break; | 2883 | break; |
2862 | } | 2884 | } |
@@ -2878,9 +2900,9 @@ int qlcnic_83xx_ms_mem_write128(struct qlcnic_adapter *adapter, u64 addr, | |||
2878 | int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, | 2900 | int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, |
2879 | u8 *p_data, int count) | 2901 | u8 *p_data, int count) |
2880 | { | 2902 | { |
2881 | int i, ret; | 2903 | u32 word, addr = flash_addr, ret; |
2882 | u32 word, addr = flash_addr; | ||
2883 | ulong indirect_addr; | 2904 | ulong indirect_addr; |
2905 | int i, err = 0; | ||
2884 | 2906 | ||
2885 | if (qlcnic_83xx_lock_flash(adapter) != 0) | 2907 | if (qlcnic_83xx_lock_flash(adapter) != 0) |
2886 | return -EIO; | 2908 | return -EIO; |
@@ -2900,10 +2922,10 @@ int qlcnic_83xx_flash_read32(struct qlcnic_adapter *adapter, u32 flash_addr, | |||
2900 | } | 2922 | } |
2901 | 2923 | ||
2902 | indirect_addr = QLC_83XX_FLASH_DIRECT_DATA(addr); | 2924 | indirect_addr = QLC_83XX_FLASH_DIRECT_DATA(addr); |
2903 | ret = qlcnic_83xx_rd_reg_indirect(adapter, | 2925 | ret = QLCRD32(adapter, indirect_addr, &err); |
2904 | indirect_addr); | 2926 | if (err == -EIO) |
2905 | if (ret == -EIO) | 2927 | return err; |
2906 | return -EIO; | 2928 | |
2907 | word = ret; | 2929 | word = ret; |
2908 | *(u32 *)p_data = word; | 2930 | *(u32 *)p_data = word; |
2909 | p_data = p_data + 4; | 2931 | p_data = p_data + 4; |
@@ -3014,8 +3036,8 @@ int qlcnic_83xx_get_settings(struct qlcnic_adapter *adapter, | |||
3014 | } | 3036 | } |
3015 | 3037 | ||
3016 | if (ahw->port_type == QLCNIC_XGBE) { | 3038 | if (ahw->port_type == QLCNIC_XGBE) { |
3017 | ecmd->supported = SUPPORTED_1000baseT_Full; | 3039 | ecmd->supported = SUPPORTED_10000baseT_Full; |
3018 | ecmd->advertising = ADVERTISED_1000baseT_Full; | 3040 | ecmd->advertising = ADVERTISED_10000baseT_Full; |
3019 | } else { | 3041 | } else { |
3020 | ecmd->supported = (SUPPORTED_10baseT_Half | | 3042 | ecmd->supported = (SUPPORTED_10baseT_Half | |
3021 | SUPPORTED_10baseT_Full | | 3043 | SUPPORTED_10baseT_Full | |
@@ -3369,7 +3391,8 @@ int qlcnic_83xx_set_pauseparam(struct qlcnic_adapter *adapter, | |||
3369 | 3391 | ||
3370 | static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) | 3392 | static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) |
3371 | { | 3393 | { |
3372 | int ret; | 3394 | int ret, err = 0; |
3395 | u32 temp; | ||
3373 | 3396 | ||
3374 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, | 3397 | qlcnic_83xx_wrt_reg_indirect(adapter, QLC_83XX_FLASH_ADDR, |
3375 | QLC_83XX_FLASH_OEM_READ_SIG); | 3398 | QLC_83XX_FLASH_OEM_READ_SIG); |
@@ -3379,8 +3402,11 @@ static int qlcnic_83xx_read_flash_status_reg(struct qlcnic_adapter *adapter) | |||
3379 | if (ret) | 3402 | if (ret) |
3380 | return -EIO; | 3403 | return -EIO; |
3381 | 3404 | ||
3382 | ret = qlcnic_83xx_rd_reg_indirect(adapter, QLC_83XX_FLASH_RDDATA); | 3405 | temp = QLCRD32(adapter, QLC_83XX_FLASH_RDDATA, &err); |
3383 | return ret & 0xFF; | 3406 | if (err == -EIO) |
3407 | return err; | ||
3408 | |||
3409 | return temp & 0xFF; | ||
3384 | } | 3410 | } |
3385 | 3411 | ||
3386 | int qlcnic_83xx_flash_test(struct qlcnic_adapter *adapter) | 3412 | int qlcnic_83xx_flash_test(struct qlcnic_adapter *adapter) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h index 2548d1403d75..272f56a2e14b 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h | |||
@@ -508,7 +508,7 @@ void qlcnic_83xx_add_sysfs(struct qlcnic_adapter *); | |||
508 | void qlcnic_83xx_remove_sysfs(struct qlcnic_adapter *); | 508 | void qlcnic_83xx_remove_sysfs(struct qlcnic_adapter *); |
509 | void qlcnic_83xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t); | 509 | void qlcnic_83xx_write_crb(struct qlcnic_adapter *, char *, loff_t, size_t); |
510 | void qlcnic_83xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t); | 510 | void qlcnic_83xx_read_crb(struct qlcnic_adapter *, char *, loff_t, size_t); |
511 | int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *, ulong); | 511 | int qlcnic_83xx_rd_reg_indirect(struct qlcnic_adapter *, ulong, int *); |
512 | int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *, ulong, u32); | 512 | int qlcnic_83xx_wrt_reg_indirect(struct qlcnic_adapter *, ulong, u32); |
513 | void qlcnic_83xx_process_rcv_diag(struct qlcnic_adapter *, int, u64 []); | 513 | void qlcnic_83xx_process_rcv_diag(struct qlcnic_adapter *, int, u64 []); |
514 | int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32); | 514 | int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index f41dfab1e9a3..9f4b8d5f0865 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -1303,8 +1303,11 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | |||
1303 | { | 1303 | { |
1304 | int i, j; | 1304 | int i, j; |
1305 | u32 val = 0, val1 = 0, reg = 0; | 1305 | u32 val = 0, val1 = 0, reg = 0; |
1306 | int err = 0; | ||
1306 | 1307 | ||
1307 | val = QLCRD32(adapter, QLC_83XX_SRE_SHIM_REG); | 1308 | val = QLCRD32(adapter, QLC_83XX_SRE_SHIM_REG, &err); |
1309 | if (err == -EIO) | ||
1310 | return; | ||
1308 | dev_info(&adapter->pdev->dev, "SRE-Shim Ctrl:0x%x\n", val); | 1311 | dev_info(&adapter->pdev->dev, "SRE-Shim Ctrl:0x%x\n", val); |
1309 | 1312 | ||
1310 | for (j = 0; j < 2; j++) { | 1313 | for (j = 0; j < 2; j++) { |
@@ -1318,7 +1321,9 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | |||
1318 | reg = QLC_83XX_PORT1_THRESHOLD; | 1321 | reg = QLC_83XX_PORT1_THRESHOLD; |
1319 | } | 1322 | } |
1320 | for (i = 0; i < 8; i++) { | 1323 | for (i = 0; i < 8; i++) { |
1321 | val = QLCRD32(adapter, reg + (i * 0x4)); | 1324 | val = QLCRD32(adapter, reg + (i * 0x4), &err); |
1325 | if (err == -EIO) | ||
1326 | return; | ||
1322 | dev_info(&adapter->pdev->dev, "0x%x ", val); | 1327 | dev_info(&adapter->pdev->dev, "0x%x ", val); |
1323 | } | 1328 | } |
1324 | dev_info(&adapter->pdev->dev, "\n"); | 1329 | dev_info(&adapter->pdev->dev, "\n"); |
@@ -1335,8 +1340,10 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | |||
1335 | reg = QLC_83XX_PORT1_TC_MC_REG; | 1340 | reg = QLC_83XX_PORT1_TC_MC_REG; |
1336 | } | 1341 | } |
1337 | for (i = 0; i < 4; i++) { | 1342 | for (i = 0; i < 4; i++) { |
1338 | val = QLCRD32(adapter, reg + (i * 0x4)); | 1343 | val = QLCRD32(adapter, reg + (i * 0x4), &err); |
1339 | dev_info(&adapter->pdev->dev, "0x%x ", val); | 1344 | if (err == -EIO) |
1345 | return; | ||
1346 | dev_info(&adapter->pdev->dev, "0x%x ", val); | ||
1340 | } | 1347 | } |
1341 | dev_info(&adapter->pdev->dev, "\n"); | 1348 | dev_info(&adapter->pdev->dev, "\n"); |
1342 | } | 1349 | } |
@@ -1352,17 +1359,25 @@ static void qlcnic_83xx_dump_pause_control_regs(struct qlcnic_adapter *adapter) | |||
1352 | reg = QLC_83XX_PORT1_TC_STATS; | 1359 | reg = QLC_83XX_PORT1_TC_STATS; |
1353 | } | 1360 | } |
1354 | for (i = 7; i >= 0; i--) { | 1361 | for (i = 7; i >= 0; i--) { |
1355 | val = QLCRD32(adapter, reg); | 1362 | val = QLCRD32(adapter, reg, &err); |
1363 | if (err == -EIO) | ||
1364 | return; | ||
1356 | val &= ~(0x7 << 29); /* Reset bits 29 to 31 */ | 1365 | val &= ~(0x7 << 29); /* Reset bits 29 to 31 */ |
1357 | QLCWR32(adapter, reg, (val | (i << 29))); | 1366 | QLCWR32(adapter, reg, (val | (i << 29))); |
1358 | val = QLCRD32(adapter, reg); | 1367 | val = QLCRD32(adapter, reg, &err); |
1368 | if (err == -EIO) | ||
1369 | return; | ||
1359 | dev_info(&adapter->pdev->dev, "0x%x ", val); | 1370 | dev_info(&adapter->pdev->dev, "0x%x ", val); |
1360 | } | 1371 | } |
1361 | dev_info(&adapter->pdev->dev, "\n"); | 1372 | dev_info(&adapter->pdev->dev, "\n"); |
1362 | } | 1373 | } |
1363 | 1374 | ||
1364 | val = QLCRD32(adapter, QLC_83XX_PORT2_IFB_THRESHOLD); | 1375 | val = QLCRD32(adapter, QLC_83XX_PORT2_IFB_THRESHOLD, &err); |
1365 | val1 = QLCRD32(adapter, QLC_83XX_PORT3_IFB_THRESHOLD); | 1376 | if (err == -EIO) |
1377 | return; | ||
1378 | val1 = QLCRD32(adapter, QLC_83XX_PORT3_IFB_THRESHOLD, &err); | ||
1379 | if (err == -EIO) | ||
1380 | return; | ||
1366 | dev_info(&adapter->pdev->dev, | 1381 | dev_info(&adapter->pdev->dev, |
1367 | "IFB-Pause Thresholds: Port 2:0x%x, Port 3:0x%x\n", | 1382 | "IFB-Pause Thresholds: Port 2:0x%x, Port 3:0x%x\n", |
1368 | val, val1); | 1383 | val, val1); |
@@ -1425,7 +1440,7 @@ static void qlcnic_83xx_take_eport_out_of_reset(struct qlcnic_adapter *adapter) | |||
1425 | static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev) | 1440 | static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev) |
1426 | { | 1441 | { |
1427 | u32 heartbeat, peg_status; | 1442 | u32 heartbeat, peg_status; |
1428 | int retries, ret = -EIO; | 1443 | int retries, ret = -EIO, err = 0; |
1429 | 1444 | ||
1430 | retries = QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT; | 1445 | retries = QLCNIC_HEARTBEAT_CHECK_RETRY_COUNT; |
1431 | p_dev->heartbeat = QLC_SHARED_REG_RD32(p_dev, | 1446 | p_dev->heartbeat = QLC_SHARED_REG_RD32(p_dev, |
@@ -1453,11 +1468,11 @@ static int qlcnic_83xx_check_heartbeat(struct qlcnic_adapter *p_dev) | |||
1453 | "PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n" | 1468 | "PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n" |
1454 | "PEG_NET_4_PC: 0x%x\n", peg_status, | 1469 | "PEG_NET_4_PC: 0x%x\n", peg_status, |
1455 | QLC_SHARED_REG_RD32(p_dev, QLCNIC_PEG_HALT_STATUS2), | 1470 | QLC_SHARED_REG_RD32(p_dev, QLCNIC_PEG_HALT_STATUS2), |
1456 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_0), | 1471 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_0, &err), |
1457 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_1), | 1472 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_1, &err), |
1458 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_2), | 1473 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_2, &err), |
1459 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_3), | 1474 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_3, &err), |
1460 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_4)); | 1475 | QLCRD32(p_dev, QLC_83XX_CRB_PEG_NET_4, &err)); |
1461 | 1476 | ||
1462 | if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) | 1477 | if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) |
1463 | dev_err(&p_dev->pdev->dev, | 1478 | dev_err(&p_dev->pdev->dev, |
@@ -1501,18 +1516,22 @@ int qlcnic_83xx_check_hw_status(struct qlcnic_adapter *p_dev) | |||
1501 | static int qlcnic_83xx_poll_reg(struct qlcnic_adapter *p_dev, u32 addr, | 1516 | static int qlcnic_83xx_poll_reg(struct qlcnic_adapter *p_dev, u32 addr, |
1502 | int duration, u32 mask, u32 status) | 1517 | int duration, u32 mask, u32 status) |
1503 | { | 1518 | { |
1519 | int timeout_error, err = 0; | ||
1504 | u32 value; | 1520 | u32 value; |
1505 | int timeout_error; | ||
1506 | u8 retries; | 1521 | u8 retries; |
1507 | 1522 | ||
1508 | value = qlcnic_83xx_rd_reg_indirect(p_dev, addr); | 1523 | value = QLCRD32(p_dev, addr, &err); |
1524 | if (err == -EIO) | ||
1525 | return err; | ||
1509 | retries = duration / 10; | 1526 | retries = duration / 10; |
1510 | 1527 | ||
1511 | do { | 1528 | do { |
1512 | if ((value & mask) != status) { | 1529 | if ((value & mask) != status) { |
1513 | timeout_error = 1; | 1530 | timeout_error = 1; |
1514 | msleep(duration / 10); | 1531 | msleep(duration / 10); |
1515 | value = qlcnic_83xx_rd_reg_indirect(p_dev, addr); | 1532 | value = QLCRD32(p_dev, addr, &err); |
1533 | if (err == -EIO) | ||
1534 | return err; | ||
1516 | } else { | 1535 | } else { |
1517 | timeout_error = 0; | 1536 | timeout_error = 0; |
1518 | break; | 1537 | break; |
@@ -1606,9 +1625,12 @@ int qlcnic_83xx_get_reset_instruction_template(struct qlcnic_adapter *p_dev) | |||
1606 | static void qlcnic_83xx_read_write_crb_reg(struct qlcnic_adapter *p_dev, | 1625 | static void qlcnic_83xx_read_write_crb_reg(struct qlcnic_adapter *p_dev, |
1607 | u32 raddr, u32 waddr) | 1626 | u32 raddr, u32 waddr) |
1608 | { | 1627 | { |
1609 | int value; | 1628 | int err = 0; |
1629 | u32 value; | ||
1610 | 1630 | ||
1611 | value = qlcnic_83xx_rd_reg_indirect(p_dev, raddr); | 1631 | value = QLCRD32(p_dev, raddr, &err); |
1632 | if (err == -EIO) | ||
1633 | return; | ||
1612 | qlcnic_83xx_wrt_reg_indirect(p_dev, waddr, value); | 1634 | qlcnic_83xx_wrt_reg_indirect(p_dev, waddr, value); |
1613 | } | 1635 | } |
1614 | 1636 | ||
@@ -1617,12 +1639,16 @@ static void qlcnic_83xx_rmw_crb_reg(struct qlcnic_adapter *p_dev, | |||
1617 | u32 raddr, u32 waddr, | 1639 | u32 raddr, u32 waddr, |
1618 | struct qlc_83xx_rmw *p_rmw_hdr) | 1640 | struct qlc_83xx_rmw *p_rmw_hdr) |
1619 | { | 1641 | { |
1620 | int value; | 1642 | int err = 0; |
1643 | u32 value; | ||
1621 | 1644 | ||
1622 | if (p_rmw_hdr->index_a) | 1645 | if (p_rmw_hdr->index_a) { |
1623 | value = p_dev->ahw->reset.array[p_rmw_hdr->index_a]; | 1646 | value = p_dev->ahw->reset.array[p_rmw_hdr->index_a]; |
1624 | else | 1647 | } else { |
1625 | value = qlcnic_83xx_rd_reg_indirect(p_dev, raddr); | 1648 | value = QLCRD32(p_dev, raddr, &err); |
1649 | if (err == -EIO) | ||
1650 | return; | ||
1651 | } | ||
1626 | 1652 | ||
1627 | value &= p_rmw_hdr->mask; | 1653 | value &= p_rmw_hdr->mask; |
1628 | value <<= p_rmw_hdr->shl; | 1654 | value <<= p_rmw_hdr->shl; |
@@ -1675,7 +1701,7 @@ static void qlcnic_83xx_poll_list(struct qlcnic_adapter *p_dev, | |||
1675 | long delay; | 1701 | long delay; |
1676 | struct qlc_83xx_entry *entry; | 1702 | struct qlc_83xx_entry *entry; |
1677 | struct qlc_83xx_poll *poll; | 1703 | struct qlc_83xx_poll *poll; |
1678 | int i; | 1704 | int i, err = 0; |
1679 | unsigned long arg1, arg2; | 1705 | unsigned long arg1, arg2; |
1680 | 1706 | ||
1681 | poll = (struct qlc_83xx_poll *)((char *)p_hdr + | 1707 | poll = (struct qlc_83xx_poll *)((char *)p_hdr + |
@@ -1699,10 +1725,12 @@ static void qlcnic_83xx_poll_list(struct qlcnic_adapter *p_dev, | |||
1699 | arg1, delay, | 1725 | arg1, delay, |
1700 | poll->mask, | 1726 | poll->mask, |
1701 | poll->status)){ | 1727 | poll->status)){ |
1702 | qlcnic_83xx_rd_reg_indirect(p_dev, | 1728 | QLCRD32(p_dev, arg1, &err); |
1703 | arg1); | 1729 | if (err == -EIO) |
1704 | qlcnic_83xx_rd_reg_indirect(p_dev, | 1730 | return; |
1705 | arg2); | 1731 | QLCRD32(p_dev, arg2, &err); |
1732 | if (err == -EIO) | ||
1733 | return; | ||
1706 | } | 1734 | } |
1707 | } | 1735 | } |
1708 | } | 1736 | } |
@@ -1768,7 +1796,7 @@ static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, | |||
1768 | struct qlc_83xx_entry_hdr *p_hdr) | 1796 | struct qlc_83xx_entry_hdr *p_hdr) |
1769 | { | 1797 | { |
1770 | long delay; | 1798 | long delay; |
1771 | int index, i, j; | 1799 | int index, i, j, err; |
1772 | struct qlc_83xx_quad_entry *entry; | 1800 | struct qlc_83xx_quad_entry *entry; |
1773 | struct qlc_83xx_poll *poll; | 1801 | struct qlc_83xx_poll *poll; |
1774 | unsigned long addr; | 1802 | unsigned long addr; |
@@ -1788,7 +1816,10 @@ static void qlcnic_83xx_poll_read_list(struct qlcnic_adapter *p_dev, | |||
1788 | poll->mask, poll->status)){ | 1816 | poll->mask, poll->status)){ |
1789 | index = p_dev->ahw->reset.array_index; | 1817 | index = p_dev->ahw->reset.array_index; |
1790 | addr = entry->dr_addr; | 1818 | addr = entry->dr_addr; |
1791 | j = qlcnic_83xx_rd_reg_indirect(p_dev, addr); | 1819 | j = QLCRD32(p_dev, addr, &err); |
1820 | if (err == -EIO) | ||
1821 | return; | ||
1822 | |||
1792 | p_dev->ahw->reset.array[index++] = j; | 1823 | p_dev->ahw->reset.array[index++] = j; |
1793 | 1824 | ||
1794 | if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) | 1825 | if (index == QLC_83XX_MAX_RESET_SEQ_ENTRIES) |
@@ -2123,6 +2154,8 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | |||
2123 | set_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status); | 2154 | set_bit(QLC_83XX_MBX_READY, &adapter->ahw->idc.status); |
2124 | qlcnic_83xx_clear_function_resources(adapter); | 2155 | qlcnic_83xx_clear_function_resources(adapter); |
2125 | 2156 | ||
2157 | INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); | ||
2158 | |||
2126 | /* register for NIC IDC AEN Events */ | 2159 | /* register for NIC IDC AEN Events */ |
2127 | qlcnic_83xx_register_nic_idc_func(adapter, 1); | 2160 | qlcnic_83xx_register_nic_idc_func(adapter, 1); |
2128 | 2161 | ||
@@ -2140,8 +2173,6 @@ int qlcnic_83xx_init(struct qlcnic_adapter *adapter, int pci_using_dac) | |||
2140 | if (adapter->nic_ops->init_driver(adapter)) | 2173 | if (adapter->nic_ops->init_driver(adapter)) |
2141 | return -EIO; | 2174 | return -EIO; |
2142 | 2175 | ||
2143 | INIT_DELAYED_WORK(&adapter->idc_aen_work, qlcnic_83xx_idc_aen_work); | ||
2144 | |||
2145 | /* Periodically monitor device status */ | 2176 | /* Periodically monitor device status */ |
2146 | qlcnic_83xx_idc_poll_dev_state(&adapter->fw_work.work); | 2177 | qlcnic_83xx_idc_poll_dev_state(&adapter->fw_work.work); |
2147 | 2178 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c index 0581a484ceb5..d09389b33474 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c | |||
@@ -104,7 +104,7 @@ static u32 | |||
104 | qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | 104 | qlcnic_poll_rsp(struct qlcnic_adapter *adapter) |
105 | { | 105 | { |
106 | u32 rsp; | 106 | u32 rsp; |
107 | int timeout = 0; | 107 | int timeout = 0, err = 0; |
108 | 108 | ||
109 | do { | 109 | do { |
110 | /* give atleast 1ms for firmware to respond */ | 110 | /* give atleast 1ms for firmware to respond */ |
@@ -113,7 +113,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | |||
113 | if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) | 113 | if (++timeout > QLCNIC_OS_CRB_RETRY_COUNT) |
114 | return QLCNIC_CDRP_RSP_TIMEOUT; | 114 | return QLCNIC_CDRP_RSP_TIMEOUT; |
115 | 115 | ||
116 | rsp = QLCRD32(adapter, QLCNIC_CDRP_CRB_OFFSET); | 116 | rsp = QLCRD32(adapter, QLCNIC_CDRP_CRB_OFFSET, &err); |
117 | } while (!QLCNIC_CDRP_IS_RSP(rsp)); | 117 | } while (!QLCNIC_CDRP_IS_RSP(rsp)); |
118 | 118 | ||
119 | return rsp; | 119 | return rsp; |
@@ -122,7 +122,7 @@ qlcnic_poll_rsp(struct qlcnic_adapter *adapter) | |||
122 | int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, | 122 | int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, |
123 | struct qlcnic_cmd_args *cmd) | 123 | struct qlcnic_cmd_args *cmd) |
124 | { | 124 | { |
125 | int i; | 125 | int i, err = 0; |
126 | u32 rsp; | 126 | u32 rsp; |
127 | u32 signature; | 127 | u32 signature; |
128 | struct pci_dev *pdev = adapter->pdev; | 128 | struct pci_dev *pdev = adapter->pdev; |
@@ -148,7 +148,7 @@ int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, | |||
148 | dev_err(&pdev->dev, "card response timeout.\n"); | 148 | dev_err(&pdev->dev, "card response timeout.\n"); |
149 | cmd->rsp.arg[0] = QLCNIC_RCODE_TIMEOUT; | 149 | cmd->rsp.arg[0] = QLCNIC_RCODE_TIMEOUT; |
150 | } else if (rsp == QLCNIC_CDRP_RSP_FAIL) { | 150 | } else if (rsp == QLCNIC_CDRP_RSP_FAIL) { |
151 | cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1)); | 151 | cmd->rsp.arg[0] = QLCRD32(adapter, QLCNIC_CDRP_ARG(1), &err); |
152 | switch (cmd->rsp.arg[0]) { | 152 | switch (cmd->rsp.arg[0]) { |
153 | case QLCNIC_RCODE_INVALID_ARGS: | 153 | case QLCNIC_RCODE_INVALID_ARGS: |
154 | fmt = "CDRP invalid args: [%d]\n"; | 154 | fmt = "CDRP invalid args: [%d]\n"; |
@@ -175,7 +175,7 @@ int qlcnic_82xx_issue_cmd(struct qlcnic_adapter *adapter, | |||
175 | cmd->rsp.arg[0] = QLCNIC_RCODE_SUCCESS; | 175 | cmd->rsp.arg[0] = QLCNIC_RCODE_SUCCESS; |
176 | 176 | ||
177 | for (i = 1; i < cmd->rsp.num; i++) | 177 | for (i = 1; i < cmd->rsp.num; i++) |
178 | cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i)); | 178 | cmd->rsp.arg[i] = QLCRD32(adapter, QLCNIC_CDRP_ARG(i), &err); |
179 | 179 | ||
180 | /* Release semaphore */ | 180 | /* Release semaphore */ |
181 | qlcnic_api_unlock(adapter); | 181 | qlcnic_api_unlock(adapter); |
@@ -210,10 +210,10 @@ int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *adapter, u32 fw_cmd) | |||
210 | if (err) { | 210 | if (err) { |
211 | dev_info(&adapter->pdev->dev, | 211 | dev_info(&adapter->pdev->dev, |
212 | "Failed to set driver version in firmware\n"); | 212 | "Failed to set driver version in firmware\n"); |
213 | return -EIO; | 213 | err = -EIO; |
214 | } | 214 | } |
215 | 215 | qlcnic_free_mbx_args(&cmd); | |
216 | return 0; | 216 | return err; |
217 | } | 217 | } |
218 | 218 | ||
219 | int | 219 | int |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 700a46324d09..7aac23ab31d1 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -150,6 +150,7 @@ static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { | |||
150 | "Link_Test_on_offline", | 150 | "Link_Test_on_offline", |
151 | "Interrupt_Test_offline", | 151 | "Interrupt_Test_offline", |
152 | "Internal_Loopback_offline", | 152 | "Internal_Loopback_offline", |
153 | "External_Loopback_offline", | ||
153 | "EEPROM_Test_offline" | 154 | "EEPROM_Test_offline" |
154 | }; | 155 | }; |
155 | 156 | ||
@@ -266,7 +267,7 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, | |||
266 | { | 267 | { |
267 | struct qlcnic_hardware_context *ahw = adapter->ahw; | 268 | struct qlcnic_hardware_context *ahw = adapter->ahw; |
268 | u32 speed, reg; | 269 | u32 speed, reg; |
269 | int check_sfp_module = 0; | 270 | int check_sfp_module = 0, err = 0; |
270 | u16 pcifn = ahw->pci_func; | 271 | u16 pcifn = ahw->pci_func; |
271 | 272 | ||
272 | /* read which mode */ | 273 | /* read which mode */ |
@@ -289,7 +290,7 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, | |||
289 | 290 | ||
290 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { | 291 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { |
291 | u32 val = 0; | 292 | u32 val = 0; |
292 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); | 293 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR, &err); |
293 | 294 | ||
294 | if (val == QLCNIC_PORT_MODE_802_3_AP) { | 295 | if (val == QLCNIC_PORT_MODE_802_3_AP) { |
295 | ecmd->supported = SUPPORTED_1000baseT_Full; | 296 | ecmd->supported = SUPPORTED_1000baseT_Full; |
@@ -300,9 +301,13 @@ int qlcnic_82xx_get_settings(struct qlcnic_adapter *adapter, | |||
300 | } | 301 | } |
301 | 302 | ||
302 | if (netif_running(adapter->netdev) && ahw->has_link_events) { | 303 | if (netif_running(adapter->netdev) && ahw->has_link_events) { |
303 | reg = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn)); | 304 | if (ahw->linkup) { |
304 | speed = P3P_LINK_SPEED_VAL(pcifn, reg); | 305 | reg = QLCRD32(adapter, |
305 | ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; | 306 | P3P_LINK_SPEED_REG(pcifn), &err); |
307 | speed = P3P_LINK_SPEED_VAL(pcifn, reg); | ||
308 | ahw->link_speed = speed * P3P_LINK_SPEED_MHZ; | ||
309 | } | ||
310 | |||
306 | ethtool_cmd_speed_set(ecmd, ahw->link_speed); | 311 | ethtool_cmd_speed_set(ecmd, ahw->link_speed); |
307 | ecmd->autoneg = ahw->link_autoneg; | 312 | ecmd->autoneg = ahw->link_autoneg; |
308 | ecmd->duplex = ahw->link_duplex; | 313 | ecmd->duplex = ahw->link_duplex; |
@@ -463,13 +468,14 @@ static int qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
463 | static int qlcnic_82xx_get_registers(struct qlcnic_adapter *adapter, | 468 | static int qlcnic_82xx_get_registers(struct qlcnic_adapter *adapter, |
464 | u32 *regs_buff) | 469 | u32 *regs_buff) |
465 | { | 470 | { |
466 | int i, j = 0; | 471 | int i, j = 0, err = 0; |
467 | 472 | ||
468 | for (i = QLCNIC_DEV_INFO_SIZE + 1; diag_registers[j] != -1; j++, i++) | 473 | for (i = QLCNIC_DEV_INFO_SIZE + 1; diag_registers[j] != -1; j++, i++) |
469 | regs_buff[i] = QLC_SHARED_REG_RD32(adapter, diag_registers[j]); | 474 | regs_buff[i] = QLC_SHARED_REG_RD32(adapter, diag_registers[j]); |
470 | j = 0; | 475 | j = 0; |
471 | while (ext_diag_registers[j] != -1) | 476 | while (ext_diag_registers[j] != -1) |
472 | regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++]); | 477 | regs_buff[i++] = QLCRD32(adapter, ext_diag_registers[j++], |
478 | &err); | ||
473 | return i; | 479 | return i; |
474 | } | 480 | } |
475 | 481 | ||
@@ -519,13 +525,16 @@ qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
519 | static u32 qlcnic_test_link(struct net_device *dev) | 525 | static u32 qlcnic_test_link(struct net_device *dev) |
520 | { | 526 | { |
521 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 527 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
528 | int err = 0; | ||
522 | u32 val; | 529 | u32 val; |
523 | 530 | ||
524 | if (qlcnic_83xx_check(adapter)) { | 531 | if (qlcnic_83xx_check(adapter)) { |
525 | val = qlcnic_83xx_test_link(adapter); | 532 | val = qlcnic_83xx_test_link(adapter); |
526 | return (val & 1) ? 0 : 1; | 533 | return (val & 1) ? 0 : 1; |
527 | } | 534 | } |
528 | val = QLCRD32(adapter, CRB_XG_STATE_P3P); | 535 | val = QLCRD32(adapter, CRB_XG_STATE_P3P, &err); |
536 | if (err == -EIO) | ||
537 | return err; | ||
529 | val = XG_LINK_STATE_P3P(adapter->ahw->pci_func, val); | 538 | val = XG_LINK_STATE_P3P(adapter->ahw->pci_func, val); |
530 | return (val == XG_LINK_UP_P3P) ? 0 : 1; | 539 | return (val == XG_LINK_UP_P3P) ? 0 : 1; |
531 | } | 540 | } |
@@ -658,6 +667,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
658 | { | 667 | { |
659 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 668 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
660 | int port = adapter->ahw->physical_port; | 669 | int port = adapter->ahw->physical_port; |
670 | int err = 0; | ||
661 | __u32 val; | 671 | __u32 val; |
662 | 672 | ||
663 | if (qlcnic_83xx_check(adapter)) { | 673 | if (qlcnic_83xx_check(adapter)) { |
@@ -668,9 +678,13 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
668 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) | 678 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) |
669 | return; | 679 | return; |
670 | /* get flow control settings */ | 680 | /* get flow control settings */ |
671 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port)); | 681 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), &err); |
682 | if (err == -EIO) | ||
683 | return; | ||
672 | pause->rx_pause = qlcnic_gb_get_rx_flowctl(val); | 684 | pause->rx_pause = qlcnic_gb_get_rx_flowctl(val); |
673 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL); | 685 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, &err); |
686 | if (err == -EIO) | ||
687 | return; | ||
674 | switch (port) { | 688 | switch (port) { |
675 | case 0: | 689 | case 0: |
676 | pause->tx_pause = !(qlcnic_gb_get_gb0_mask(val)); | 690 | pause->tx_pause = !(qlcnic_gb_get_gb0_mask(val)); |
@@ -690,7 +704,9 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
690 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) | 704 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) |
691 | return; | 705 | return; |
692 | pause->rx_pause = 1; | 706 | pause->rx_pause = 1; |
693 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL); | 707 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, &err); |
708 | if (err == -EIO) | ||
709 | return; | ||
694 | if (port == 0) | 710 | if (port == 0) |
695 | pause->tx_pause = !(qlcnic_xg_get_xg0_mask(val)); | 711 | pause->tx_pause = !(qlcnic_xg_get_xg0_mask(val)); |
696 | else | 712 | else |
@@ -707,6 +723,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
707 | { | 723 | { |
708 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 724 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
709 | int port = adapter->ahw->physical_port; | 725 | int port = adapter->ahw->physical_port; |
726 | int err = 0; | ||
710 | __u32 val; | 727 | __u32 val; |
711 | 728 | ||
712 | if (qlcnic_83xx_check(adapter)) | 729 | if (qlcnic_83xx_check(adapter)) |
@@ -717,7 +734,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
717 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) | 734 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) |
718 | return -EIO; | 735 | return -EIO; |
719 | /* set flow control */ | 736 | /* set flow control */ |
720 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port)); | 737 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), &err); |
738 | if (err == -EIO) | ||
739 | return err; | ||
721 | 740 | ||
722 | if (pause->rx_pause) | 741 | if (pause->rx_pause) |
723 | qlcnic_gb_rx_flowctl(val); | 742 | qlcnic_gb_rx_flowctl(val); |
@@ -728,7 +747,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
728 | val); | 747 | val); |
729 | QLCWR32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), val); | 748 | QLCWR32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), val); |
730 | /* set autoneg */ | 749 | /* set autoneg */ |
731 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL); | 750 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, &err); |
751 | if (err == -EIO) | ||
752 | return err; | ||
732 | switch (port) { | 753 | switch (port) { |
733 | case 0: | 754 | case 0: |
734 | if (pause->tx_pause) | 755 | if (pause->tx_pause) |
@@ -764,7 +785,9 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
764 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) | 785 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) |
765 | return -EIO; | 786 | return -EIO; |
766 | 787 | ||
767 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL); | 788 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, &err); |
789 | if (err == -EIO) | ||
790 | return err; | ||
768 | if (port == 0) { | 791 | if (port == 0) { |
769 | if (pause->tx_pause) | 792 | if (pause->tx_pause) |
770 | qlcnic_xg_unset_xg0_mask(val); | 793 | qlcnic_xg_unset_xg0_mask(val); |
@@ -788,11 +811,14 @@ static int qlcnic_reg_test(struct net_device *dev) | |||
788 | { | 811 | { |
789 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 812 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
790 | u32 data_read; | 813 | u32 data_read; |
814 | int err = 0; | ||
791 | 815 | ||
792 | if (qlcnic_83xx_check(adapter)) | 816 | if (qlcnic_83xx_check(adapter)) |
793 | return qlcnic_83xx_reg_test(adapter); | 817 | return qlcnic_83xx_reg_test(adapter); |
794 | 818 | ||
795 | data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0)); | 819 | data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0), &err); |
820 | if (err == -EIO) | ||
821 | return err; | ||
796 | if ((data_read & 0xffff) != adapter->pdev->vendor) | 822 | if ((data_read & 0xffff) != adapter->pdev->vendor) |
797 | return 1; | 823 | return 1; |
798 | 824 | ||
@@ -1026,8 +1052,15 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test, | |||
1026 | if (data[3]) | 1052 | if (data[3]) |
1027 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1053 | eth_test->flags |= ETH_TEST_FL_FAILED; |
1028 | 1054 | ||
1029 | data[4] = qlcnic_eeprom_test(dev); | 1055 | if (eth_test->flags & ETH_TEST_FL_EXTERNAL_LB) { |
1030 | if (data[4]) | 1056 | data[4] = qlcnic_loopback_test(dev, QLCNIC_ELB_MODE); |
1057 | if (data[4]) | ||
1058 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
1059 | eth_test->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE; | ||
1060 | } | ||
1061 | |||
1062 | data[5] = qlcnic_eeprom_test(dev); | ||
1063 | if (data[5]) | ||
1031 | eth_test->flags |= ETH_TEST_FL_FAILED; | 1064 | eth_test->flags |= ETH_TEST_FL_FAILED; |
1032 | } | 1065 | } |
1033 | } | 1066 | } |
@@ -1257,17 +1290,20 @@ qlcnic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
1257 | { | 1290 | { |
1258 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 1291 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
1259 | u32 wol_cfg; | 1292 | u32 wol_cfg; |
1293 | int err = 0; | ||
1260 | 1294 | ||
1261 | if (qlcnic_83xx_check(adapter)) | 1295 | if (qlcnic_83xx_check(adapter)) |
1262 | return; | 1296 | return; |
1263 | wol->supported = 0; | 1297 | wol->supported = 0; |
1264 | wol->wolopts = 0; | 1298 | wol->wolopts = 0; |
1265 | 1299 | ||
1266 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); | 1300 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); |
1301 | if (err == -EIO) | ||
1302 | return; | ||
1267 | if (wol_cfg & (1UL << adapter->portnum)) | 1303 | if (wol_cfg & (1UL << adapter->portnum)) |
1268 | wol->supported |= WAKE_MAGIC; | 1304 | wol->supported |= WAKE_MAGIC; |
1269 | 1305 | ||
1270 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); | 1306 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); |
1271 | if (wol_cfg & (1UL << adapter->portnum)) | 1307 | if (wol_cfg & (1UL << adapter->portnum)) |
1272 | wol->wolopts |= WAKE_MAGIC; | 1308 | wol->wolopts |= WAKE_MAGIC; |
1273 | } | 1309 | } |
@@ -1277,17 +1313,22 @@ qlcnic_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
1277 | { | 1313 | { |
1278 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 1314 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
1279 | u32 wol_cfg; | 1315 | u32 wol_cfg; |
1316 | int err = 0; | ||
1280 | 1317 | ||
1281 | if (qlcnic_83xx_check(adapter)) | 1318 | if (qlcnic_83xx_check(adapter)) |
1282 | return -EOPNOTSUPP; | 1319 | return -EOPNOTSUPP; |
1283 | if (wol->wolopts & ~WAKE_MAGIC) | 1320 | if (wol->wolopts & ~WAKE_MAGIC) |
1284 | return -EINVAL; | 1321 | return -EINVAL; |
1285 | 1322 | ||
1286 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); | 1323 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); |
1324 | if (err == -EIO) | ||
1325 | return err; | ||
1287 | if (!(wol_cfg & (1 << adapter->portnum))) | 1326 | if (!(wol_cfg & (1 << adapter->portnum))) |
1288 | return -EOPNOTSUPP; | 1327 | return -EOPNOTSUPP; |
1289 | 1328 | ||
1290 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); | 1329 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); |
1330 | if (err == -EIO) | ||
1331 | return err; | ||
1291 | if (wol->wolopts & WAKE_MAGIC) | 1332 | if (wol->wolopts & WAKE_MAGIC) |
1292 | wol_cfg |= 1UL << adapter->portnum; | 1333 | wol_cfg |= 1UL << adapter->portnum; |
1293 | else | 1334 | else |
@@ -1540,7 +1581,7 @@ qlcnic_set_dump(struct net_device *netdev, struct ethtool_dump *val) | |||
1540 | return 0; | 1581 | return 0; |
1541 | case QLCNIC_SET_QUIESCENT: | 1582 | case QLCNIC_SET_QUIESCENT: |
1542 | case QLCNIC_RESET_QUIESCENT: | 1583 | case QLCNIC_RESET_QUIESCENT: |
1543 | state = QLCRD32(adapter, QLCNIC_CRB_DEV_STATE); | 1584 | state = QLC_SHARED_REG_RD32(adapter, QLCNIC_CRB_DEV_STATE); |
1544 | if (state == QLCNIC_DEV_FAILED || (state == QLCNIC_DEV_BADBAD)) | 1585 | if (state == QLCNIC_DEV_FAILED || (state == QLCNIC_DEV_BADBAD)) |
1545 | netdev_info(netdev, "Device in FAILED state\n"); | 1586 | netdev_info(netdev, "Device in FAILED state\n"); |
1546 | return 0; | 1587 | return 0; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c index 5b5d2edf125d..4d5f59b2d153 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.c | |||
@@ -317,16 +317,20 @@ static void qlcnic_write_window_reg(u32 addr, void __iomem *bar0, u32 data) | |||
317 | int | 317 | int |
318 | qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) | 318 | qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) |
319 | { | 319 | { |
320 | int done = 0, timeout = 0; | 320 | int timeout = 0; |
321 | int err = 0; | ||
322 | u32 done = 0; | ||
321 | 323 | ||
322 | while (!done) { | 324 | while (!done) { |
323 | done = QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_LOCK(sem))); | 325 | done = QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_LOCK(sem)), |
326 | &err); | ||
324 | if (done == 1) | 327 | if (done == 1) |
325 | break; | 328 | break; |
326 | if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) { | 329 | if (++timeout >= QLCNIC_PCIE_SEM_TIMEOUT) { |
327 | dev_err(&adapter->pdev->dev, | 330 | dev_err(&adapter->pdev->dev, |
328 | "Failed to acquire sem=%d lock; holdby=%d\n", | 331 | "Failed to acquire sem=%d lock; holdby=%d\n", |
329 | sem, id_reg ? QLCRD32(adapter, id_reg) : -1); | 332 | sem, |
333 | id_reg ? QLCRD32(adapter, id_reg, &err) : -1); | ||
330 | return -EIO; | 334 | return -EIO; |
331 | } | 335 | } |
332 | msleep(1); | 336 | msleep(1); |
@@ -341,19 +345,22 @@ qlcnic_pcie_sem_lock(struct qlcnic_adapter *adapter, int sem, u32 id_reg) | |||
341 | void | 345 | void |
342 | qlcnic_pcie_sem_unlock(struct qlcnic_adapter *adapter, int sem) | 346 | qlcnic_pcie_sem_unlock(struct qlcnic_adapter *adapter, int sem) |
343 | { | 347 | { |
344 | QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_UNLOCK(sem))); | 348 | int err = 0; |
349 | |||
350 | QLCRD32(adapter, QLCNIC_PCIE_REG(PCIE_SEM_UNLOCK(sem)), &err); | ||
345 | } | 351 | } |
346 | 352 | ||
347 | int qlcnic_ind_rd(struct qlcnic_adapter *adapter, u32 addr) | 353 | int qlcnic_ind_rd(struct qlcnic_adapter *adapter, u32 addr) |
348 | { | 354 | { |
355 | int err = 0; | ||
349 | u32 data; | 356 | u32 data; |
350 | 357 | ||
351 | if (qlcnic_82xx_check(adapter)) | 358 | if (qlcnic_82xx_check(adapter)) |
352 | qlcnic_read_window_reg(addr, adapter->ahw->pci_base0, &data); | 359 | qlcnic_read_window_reg(addr, adapter->ahw->pci_base0, &data); |
353 | else { | 360 | else { |
354 | data = qlcnic_83xx_rd_reg_indirect(adapter, addr); | 361 | data = QLCRD32(adapter, addr, &err); |
355 | if (data == -EIO) | 362 | if (err == -EIO) |
356 | return -EIO; | 363 | return err; |
357 | } | 364 | } |
358 | return data; | 365 | return data; |
359 | } | 366 | } |
@@ -516,20 +523,18 @@ void __qlcnic_set_multi(struct net_device *netdev, u16 vlan) | |||
516 | if (netdev->flags & IFF_PROMISC) { | 523 | if (netdev->flags & IFF_PROMISC) { |
517 | if (!(adapter->flags & QLCNIC_PROMISC_DISABLED)) | 524 | if (!(adapter->flags & QLCNIC_PROMISC_DISABLED)) |
518 | mode = VPORT_MISS_MODE_ACCEPT_ALL; | 525 | mode = VPORT_MISS_MODE_ACCEPT_ALL; |
519 | } else if (netdev->flags & IFF_ALLMULTI) { | 526 | } else if ((netdev->flags & IFF_ALLMULTI) || |
520 | if (netdev_mc_count(netdev) > ahw->max_mc_count) { | 527 | (netdev_mc_count(netdev) > ahw->max_mc_count)) { |
521 | mode = VPORT_MISS_MODE_ACCEPT_MULTI; | 528 | mode = VPORT_MISS_MODE_ACCEPT_MULTI; |
522 | } else if (!netdev_mc_empty(netdev) && | 529 | } else if (!netdev_mc_empty(netdev) && |
523 | !qlcnic_sriov_vf_check(adapter)) { | 530 | !qlcnic_sriov_vf_check(adapter)) { |
524 | netdev_for_each_mc_addr(ha, netdev) | 531 | netdev_for_each_mc_addr(ha, netdev) |
525 | qlcnic_nic_add_mac(adapter, ha->addr, | 532 | qlcnic_nic_add_mac(adapter, ha->addr, vlan); |
526 | vlan); | ||
527 | } | ||
528 | if (mode != VPORT_MISS_MODE_ACCEPT_MULTI && | ||
529 | qlcnic_sriov_vf_check(adapter)) | ||
530 | qlcnic_vf_add_mc_list(netdev, vlan); | ||
531 | } | 533 | } |
532 | 534 | ||
535 | if (qlcnic_sriov_vf_check(adapter)) | ||
536 | qlcnic_vf_add_mc_list(netdev, vlan); | ||
537 | |||
533 | /* configure unicast MAC address, if there is not sufficient space | 538 | /* configure unicast MAC address, if there is not sufficient space |
534 | * to store all the unicast addresses then enable promiscuous mode | 539 | * to store all the unicast addresses then enable promiscuous mode |
535 | */ | 540 | */ |
@@ -1161,7 +1166,8 @@ int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *adapter, ulong off, | |||
1161 | return -EIO; | 1166 | return -EIO; |
1162 | } | 1167 | } |
1163 | 1168 | ||
1164 | int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off) | 1169 | int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off, |
1170 | int *err) | ||
1165 | { | 1171 | { |
1166 | unsigned long flags; | 1172 | unsigned long flags; |
1167 | int rv; | 1173 | int rv; |
@@ -1417,7 +1423,7 @@ int qlcnic_pci_mem_read_2M(struct qlcnic_adapter *adapter, u64 off, u64 *data) | |||
1417 | 1423 | ||
1418 | int qlcnic_82xx_get_board_info(struct qlcnic_adapter *adapter) | 1424 | int qlcnic_82xx_get_board_info(struct qlcnic_adapter *adapter) |
1419 | { | 1425 | { |
1420 | int offset, board_type, magic; | 1426 | int offset, board_type, magic, err = 0; |
1421 | struct pci_dev *pdev = adapter->pdev; | 1427 | struct pci_dev *pdev = adapter->pdev; |
1422 | 1428 | ||
1423 | offset = QLCNIC_FW_MAGIC_OFFSET; | 1429 | offset = QLCNIC_FW_MAGIC_OFFSET; |
@@ -1437,7 +1443,9 @@ int qlcnic_82xx_get_board_info(struct qlcnic_adapter *adapter) | |||
1437 | adapter->ahw->board_type = board_type; | 1443 | adapter->ahw->board_type = board_type; |
1438 | 1444 | ||
1439 | if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) { | 1445 | if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) { |
1440 | u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I); | 1446 | u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I, &err); |
1447 | if (err == -EIO) | ||
1448 | return err; | ||
1441 | if ((gpio & 0x8000) == 0) | 1449 | if ((gpio & 0x8000) == 0) |
1442 | board_type = QLCNIC_BRDTYPE_P3P_10G_TP; | 1450 | board_type = QLCNIC_BRDTYPE_P3P_10G_TP; |
1443 | } | 1451 | } |
@@ -1477,10 +1485,13 @@ int | |||
1477 | qlcnic_wol_supported(struct qlcnic_adapter *adapter) | 1485 | qlcnic_wol_supported(struct qlcnic_adapter *adapter) |
1478 | { | 1486 | { |
1479 | u32 wol_cfg; | 1487 | u32 wol_cfg; |
1488 | int err = 0; | ||
1480 | 1489 | ||
1481 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); | 1490 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV, &err); |
1482 | if (wol_cfg & (1UL << adapter->portnum)) { | 1491 | if (wol_cfg & (1UL << adapter->portnum)) { |
1483 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); | 1492 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG, &err); |
1493 | if (err == -EIO) | ||
1494 | return err; | ||
1484 | if (wol_cfg & (1 << adapter->portnum)) | 1495 | if (wol_cfg & (1 << adapter->portnum)) |
1485 | return 1; | 1496 | return 1; |
1486 | } | 1497 | } |
@@ -1541,6 +1552,7 @@ void qlcnic_82xx_get_func_no(struct qlcnic_adapter *adapter) | |||
1541 | void qlcnic_82xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | 1552 | void qlcnic_82xx_read_crb(struct qlcnic_adapter *adapter, char *buf, |
1542 | loff_t offset, size_t size) | 1553 | loff_t offset, size_t size) |
1543 | { | 1554 | { |
1555 | int err = 0; | ||
1544 | u32 data; | 1556 | u32 data; |
1545 | u64 qmdata; | 1557 | u64 qmdata; |
1546 | 1558 | ||
@@ -1548,7 +1560,7 @@ void qlcnic_82xx_read_crb(struct qlcnic_adapter *adapter, char *buf, | |||
1548 | qlcnic_pci_camqm_read_2M(adapter, offset, &qmdata); | 1560 | qlcnic_pci_camqm_read_2M(adapter, offset, &qmdata); |
1549 | memcpy(buf, &qmdata, size); | 1561 | memcpy(buf, &qmdata, size); |
1550 | } else { | 1562 | } else { |
1551 | data = QLCRD32(adapter, offset); | 1563 | data = QLCRD32(adapter, offset, &err); |
1552 | memcpy(buf, &data, size); | 1564 | memcpy(buf, &data, size); |
1553 | } | 1565 | } |
1554 | } | 1566 | } |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h index 2c22504f57aa..4a71b28effcb 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h | |||
@@ -154,7 +154,7 @@ struct qlcnic_hardware_context; | |||
154 | struct qlcnic_adapter; | 154 | struct qlcnic_adapter; |
155 | 155 | ||
156 | int qlcnic_82xx_start_firmware(struct qlcnic_adapter *); | 156 | int qlcnic_82xx_start_firmware(struct qlcnic_adapter *); |
157 | int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong); | 157 | int qlcnic_82xx_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong, int *); |
158 | int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32); | 158 | int qlcnic_82xx_hw_write_wx_2M(struct qlcnic_adapter *, ulong, u32); |
159 | int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int); | 159 | int qlcnic_82xx_config_hw_lro(struct qlcnic_adapter *adapter, int); |
160 | int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32); | 160 | int qlcnic_82xx_nic_set_promisc(struct qlcnic_adapter *adapter, u32); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c index d28336fc65ab..974d62607e13 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c | |||
@@ -142,7 +142,7 @@ void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter) | |||
142 | buffrag->length, PCI_DMA_TODEVICE); | 142 | buffrag->length, PCI_DMA_TODEVICE); |
143 | buffrag->dma = 0ULL; | 143 | buffrag->dma = 0ULL; |
144 | } | 144 | } |
145 | for (j = 0; j < cmd_buf->frag_count; j++) { | 145 | for (j = 1; j < cmd_buf->frag_count; j++) { |
146 | buffrag++; | 146 | buffrag++; |
147 | if (buffrag->dma) { | 147 | if (buffrag->dma) { |
148 | pci_unmap_page(adapter->pdev, buffrag->dma, | 148 | pci_unmap_page(adapter->pdev, buffrag->dma, |
@@ -286,10 +286,11 @@ static int qlcnic_wait_rom_done(struct qlcnic_adapter *adapter) | |||
286 | { | 286 | { |
287 | long timeout = 0; | 287 | long timeout = 0; |
288 | long done = 0; | 288 | long done = 0; |
289 | int err = 0; | ||
289 | 290 | ||
290 | cond_resched(); | 291 | cond_resched(); |
291 | while (done == 0) { | 292 | while (done == 0) { |
292 | done = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_STATUS); | 293 | done = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_STATUS, &err); |
293 | done &= 2; | 294 | done &= 2; |
294 | if (++timeout >= QLCNIC_MAX_ROM_WAIT_USEC) { | 295 | if (++timeout >= QLCNIC_MAX_ROM_WAIT_USEC) { |
295 | dev_err(&adapter->pdev->dev, | 296 | dev_err(&adapter->pdev->dev, |
@@ -304,6 +305,8 @@ static int qlcnic_wait_rom_done(struct qlcnic_adapter *adapter) | |||
304 | static int do_rom_fast_read(struct qlcnic_adapter *adapter, | 305 | static int do_rom_fast_read(struct qlcnic_adapter *adapter, |
305 | u32 addr, u32 *valp) | 306 | u32 addr, u32 *valp) |
306 | { | 307 | { |
308 | int err = 0; | ||
309 | |||
307 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ADDRESS, addr); | 310 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ADDRESS, addr); |
308 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 311 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
309 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ABYTE_CNT, 3); | 312 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_ABYTE_CNT, 3); |
@@ -317,7 +320,9 @@ static int do_rom_fast_read(struct qlcnic_adapter *adapter, | |||
317 | udelay(10); | 320 | udelay(10); |
318 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 321 | QLCWR32(adapter, QLCNIC_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
319 | 322 | ||
320 | *valp = QLCRD32(adapter, QLCNIC_ROMUSB_ROM_RDATA); | 323 | *valp = QLCRD32(adapter, QLCNIC_ROMUSB_ROM_RDATA, &err); |
324 | if (err == -EIO) | ||
325 | return err; | ||
321 | return 0; | 326 | return 0; |
322 | } | 327 | } |
323 | 328 | ||
@@ -369,11 +374,11 @@ int qlcnic_rom_fast_read(struct qlcnic_adapter *adapter, u32 addr, u32 *valp) | |||
369 | 374 | ||
370 | int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) | 375 | int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) |
371 | { | 376 | { |
372 | int addr, val; | 377 | int addr, err = 0; |
373 | int i, n, init_delay; | 378 | int i, n, init_delay; |
374 | struct crb_addr_pair *buf; | 379 | struct crb_addr_pair *buf; |
375 | unsigned offset; | 380 | unsigned offset; |
376 | u32 off; | 381 | u32 off, val; |
377 | struct pci_dev *pdev = adapter->pdev; | 382 | struct pci_dev *pdev = adapter->pdev; |
378 | 383 | ||
379 | QLC_SHARED_REG_WR32(adapter, QLCNIC_CMDPEG_STATE, 0); | 384 | QLC_SHARED_REG_WR32(adapter, QLCNIC_CMDPEG_STATE, 0); |
@@ -402,7 +407,9 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) | |||
402 | QLCWR32(adapter, QLCNIC_CRB_NIU + 0xb0000, 0x00); | 407 | QLCWR32(adapter, QLCNIC_CRB_NIU + 0xb0000, 0x00); |
403 | 408 | ||
404 | /* halt sre */ | 409 | /* halt sre */ |
405 | val = QLCRD32(adapter, QLCNIC_CRB_SRE + 0x1000); | 410 | val = QLCRD32(adapter, QLCNIC_CRB_SRE + 0x1000, &err); |
411 | if (err == -EIO) | ||
412 | return err; | ||
406 | QLCWR32(adapter, QLCNIC_CRB_SRE + 0x1000, val & (~(0x1))); | 413 | QLCWR32(adapter, QLCNIC_CRB_SRE + 0x1000, val & (~(0x1))); |
407 | 414 | ||
408 | /* halt epg */ | 415 | /* halt epg */ |
@@ -719,10 +726,12 @@ qlcnic_check_flash_fw_ver(struct qlcnic_adapter *adapter) | |||
719 | static int | 726 | static int |
720 | qlcnic_has_mn(struct qlcnic_adapter *adapter) | 727 | qlcnic_has_mn(struct qlcnic_adapter *adapter) |
721 | { | 728 | { |
722 | u32 capability; | 729 | u32 capability = 0; |
723 | capability = 0; | 730 | int err = 0; |
724 | 731 | ||
725 | capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY); | 732 | capability = QLCRD32(adapter, QLCNIC_PEG_TUNE_CAPABILITY, &err); |
733 | if (err == -EIO) | ||
734 | return err; | ||
726 | if (capability & QLCNIC_PEG_TUNE_MN_PRESENT) | 735 | if (capability & QLCNIC_PEG_TUNE_MN_PRESENT) |
727 | return 1; | 736 | return 1; |
728 | 737 | ||
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c index d3f8797efcc3..6946d354f44f 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c | |||
@@ -161,36 +161,68 @@ static inline int qlcnic_82xx_is_lb_pkt(u64 sts_data) | |||
161 | return (qlcnic_get_sts_status(sts_data) == STATUS_CKSUM_LOOP) ? 1 : 0; | 161 | return (qlcnic_get_sts_status(sts_data) == STATUS_CKSUM_LOOP) ? 1 : 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | static void qlcnic_delete_rx_list_mac(struct qlcnic_adapter *adapter, | ||
165 | struct qlcnic_filter *fil, | ||
166 | void *addr, u16 vlan_id) | ||
167 | { | ||
168 | int ret; | ||
169 | u8 op; | ||
170 | |||
171 | op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; | ||
172 | ret = qlcnic_sre_macaddr_change(adapter, addr, vlan_id, op); | ||
173 | if (ret) | ||
174 | return; | ||
175 | |||
176 | op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL; | ||
177 | ret = qlcnic_sre_macaddr_change(adapter, addr, vlan_id, op); | ||
178 | if (!ret) { | ||
179 | hlist_del(&fil->fnode); | ||
180 | adapter->rx_fhash.fnum--; | ||
181 | } | ||
182 | } | ||
183 | |||
184 | static struct qlcnic_filter *qlcnic_find_mac_filter(struct hlist_head *head, | ||
185 | void *addr, u16 vlan_id) | ||
186 | { | ||
187 | struct qlcnic_filter *tmp_fil = NULL; | ||
188 | struct hlist_node *n; | ||
189 | |||
190 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { | ||
191 | if (!memcmp(tmp_fil->faddr, addr, ETH_ALEN) && | ||
192 | tmp_fil->vlan_id == vlan_id) | ||
193 | return tmp_fil; | ||
194 | } | ||
195 | |||
196 | return NULL; | ||
197 | } | ||
198 | |||
164 | void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, | 199 | void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, |
165 | int loopback_pkt, u16 vlan_id) | 200 | int loopback_pkt, u16 vlan_id) |
166 | { | 201 | { |
167 | struct ethhdr *phdr = (struct ethhdr *)(skb->data); | 202 | struct ethhdr *phdr = (struct ethhdr *)(skb->data); |
168 | struct qlcnic_filter *fil, *tmp_fil; | 203 | struct qlcnic_filter *fil, *tmp_fil; |
169 | struct hlist_node *n; | ||
170 | struct hlist_head *head; | 204 | struct hlist_head *head; |
171 | unsigned long time; | 205 | unsigned long time; |
172 | u64 src_addr = 0; | 206 | u64 src_addr = 0; |
173 | u8 hindex, found = 0, op; | 207 | u8 hindex, op; |
174 | int ret; | 208 | int ret; |
175 | 209 | ||
176 | memcpy(&src_addr, phdr->h_source, ETH_ALEN); | 210 | memcpy(&src_addr, phdr->h_source, ETH_ALEN); |
211 | hindex = qlcnic_mac_hash(src_addr) & | ||
212 | (adapter->fhash.fbucket_size - 1); | ||
177 | 213 | ||
178 | if (loopback_pkt) { | 214 | if (loopback_pkt) { |
179 | if (adapter->rx_fhash.fnum >= adapter->rx_fhash.fmax) | 215 | if (adapter->rx_fhash.fnum >= adapter->rx_fhash.fmax) |
180 | return; | 216 | return; |
181 | 217 | ||
182 | hindex = qlcnic_mac_hash(src_addr) & | ||
183 | (adapter->fhash.fbucket_size - 1); | ||
184 | head = &(adapter->rx_fhash.fhead[hindex]); | 218 | head = &(adapter->rx_fhash.fhead[hindex]); |
185 | 219 | ||
186 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { | 220 | tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); |
187 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && | 221 | if (tmp_fil) { |
188 | tmp_fil->vlan_id == vlan_id) { | 222 | time = tmp_fil->ftime; |
189 | time = tmp_fil->ftime; | 223 | if (time_after(jiffies, QLCNIC_READD_AGE * HZ + time)) |
190 | if (jiffies > (QLCNIC_READD_AGE * HZ + time)) | 224 | tmp_fil->ftime = jiffies; |
191 | tmp_fil->ftime = jiffies; | 225 | return; |
192 | return; | ||
193 | } | ||
194 | } | 226 | } |
195 | 227 | ||
196 | fil = kzalloc(sizeof(struct qlcnic_filter), GFP_ATOMIC); | 228 | fil = kzalloc(sizeof(struct qlcnic_filter), GFP_ATOMIC); |
@@ -205,36 +237,37 @@ void qlcnic_add_lb_filter(struct qlcnic_adapter *adapter, struct sk_buff *skb, | |||
205 | adapter->rx_fhash.fnum++; | 237 | adapter->rx_fhash.fnum++; |
206 | spin_unlock(&adapter->rx_mac_learn_lock); | 238 | spin_unlock(&adapter->rx_mac_learn_lock); |
207 | } else { | 239 | } else { |
208 | hindex = qlcnic_mac_hash(src_addr) & | 240 | head = &adapter->fhash.fhead[hindex]; |
209 | (adapter->fhash.fbucket_size - 1); | ||
210 | head = &(adapter->rx_fhash.fhead[hindex]); | ||
211 | spin_lock(&adapter->rx_mac_learn_lock); | ||
212 | hlist_for_each_entry_safe(tmp_fil, n, head, fnode) { | ||
213 | if (!memcmp(tmp_fil->faddr, &src_addr, ETH_ALEN) && | ||
214 | tmp_fil->vlan_id == vlan_id) { | ||
215 | found = 1; | ||
216 | break; | ||
217 | } | ||
218 | } | ||
219 | 241 | ||
220 | if (!found) { | 242 | spin_lock(&adapter->mac_learn_lock); |
221 | spin_unlock(&adapter->rx_mac_learn_lock); | ||
222 | return; | ||
223 | } | ||
224 | 243 | ||
225 | op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; | 244 | tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); |
226 | ret = qlcnic_sre_macaddr_change(adapter, (u8 *)&src_addr, | 245 | if (tmp_fil) { |
227 | vlan_id, op); | ||
228 | if (!ret) { | ||
229 | op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL; | 246 | op = vlan_id ? QLCNIC_MAC_VLAN_DEL : QLCNIC_MAC_DEL; |
230 | ret = qlcnic_sre_macaddr_change(adapter, | 247 | ret = qlcnic_sre_macaddr_change(adapter, |
231 | (u8 *)&src_addr, | 248 | (u8 *)&src_addr, |
232 | vlan_id, op); | 249 | vlan_id, op); |
233 | if (!ret) { | 250 | if (!ret) { |
234 | hlist_del(&(tmp_fil->fnode)); | 251 | hlist_del(&tmp_fil->fnode); |
235 | adapter->rx_fhash.fnum--; | 252 | adapter->fhash.fnum--; |
236 | } | 253 | } |
254 | |||
255 | spin_unlock(&adapter->mac_learn_lock); | ||
256 | |||
257 | return; | ||
237 | } | 258 | } |
259 | |||
260 | spin_unlock(&adapter->mac_learn_lock); | ||
261 | |||
262 | head = &adapter->rx_fhash.fhead[hindex]; | ||
263 | |||
264 | spin_lock(&adapter->rx_mac_learn_lock); | ||
265 | |||
266 | tmp_fil = qlcnic_find_mac_filter(head, &src_addr, vlan_id); | ||
267 | if (tmp_fil) | ||
268 | qlcnic_delete_rx_list_mac(adapter, tmp_fil, &src_addr, | ||
269 | vlan_id); | ||
270 | |||
238 | spin_unlock(&adapter->rx_mac_learn_lock); | 271 | spin_unlock(&adapter->rx_mac_learn_lock); |
239 | } | 272 | } |
240 | } | 273 | } |
@@ -262,7 +295,7 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, | |||
262 | 295 | ||
263 | mac_req = (struct qlcnic_mac_req *)&(req->words[0]); | 296 | mac_req = (struct qlcnic_mac_req *)&(req->words[0]); |
264 | mac_req->op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; | 297 | mac_req->op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD; |
265 | memcpy(mac_req->mac_addr, &uaddr, ETH_ALEN); | 298 | memcpy(mac_req->mac_addr, uaddr, ETH_ALEN); |
266 | 299 | ||
267 | vlan_req = (struct qlcnic_vlan_req *)&req->words[1]; | 300 | vlan_req = (struct qlcnic_vlan_req *)&req->words[1]; |
268 | vlan_req->vlan_id = cpu_to_le16(vlan_id); | 301 | vlan_req->vlan_id = cpu_to_le16(vlan_id); |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 4528f8ec333b..ee013fcc3322 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
@@ -977,8 +977,8 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) | |||
977 | static int | 977 | static int |
978 | qlcnic_initialize_nic(struct qlcnic_adapter *adapter) | 978 | qlcnic_initialize_nic(struct qlcnic_adapter *adapter) |
979 | { | 979 | { |
980 | int err; | ||
981 | struct qlcnic_info nic_info; | 980 | struct qlcnic_info nic_info; |
981 | int err = 0; | ||
982 | 982 | ||
983 | memset(&nic_info, 0, sizeof(struct qlcnic_info)); | 983 | memset(&nic_info, 0, sizeof(struct qlcnic_info)); |
984 | err = qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw->pci_func); | 984 | err = qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw->pci_func); |
@@ -993,7 +993,9 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) | |||
993 | 993 | ||
994 | if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_MORE_CAPS) { | 994 | if (adapter->ahw->capabilities & QLCNIC_FW_CAPABILITY_MORE_CAPS) { |
995 | u32 temp; | 995 | u32 temp; |
996 | temp = QLCRD32(adapter, CRB_FW_CAPABILITIES_2); | 996 | temp = QLCRD32(adapter, CRB_FW_CAPABILITIES_2, &err); |
997 | if (err == -EIO) | ||
998 | return err; | ||
997 | adapter->ahw->extra_capability[0] = temp; | 999 | adapter->ahw->extra_capability[0] = temp; |
998 | } | 1000 | } |
999 | adapter->ahw->max_mac_filters = nic_info.max_mac_filters; | 1001 | adapter->ahw->max_mac_filters = nic_info.max_mac_filters; |
@@ -1383,6 +1385,8 @@ qlcnic_request_irq(struct qlcnic_adapter *adapter) | |||
1383 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { | 1385 | if (adapter->ahw->diag_test == QLCNIC_INTERRUPT_TEST) { |
1384 | if (qlcnic_82xx_check(adapter)) | 1386 | if (qlcnic_82xx_check(adapter)) |
1385 | handler = qlcnic_tmp_intr; | 1387 | handler = qlcnic_tmp_intr; |
1388 | else | ||
1389 | handler = qlcnic_83xx_tmp_intr; | ||
1386 | if (!QLCNIC_IS_MSI_FAMILY(adapter)) | 1390 | if (!QLCNIC_IS_MSI_FAMILY(adapter)) |
1387 | flags |= IRQF_SHARED; | 1391 | flags |= IRQF_SHARED; |
1388 | 1392 | ||
@@ -1531,12 +1535,12 @@ int __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) | |||
1531 | if (netdev->features & NETIF_F_LRO) | 1535 | if (netdev->features & NETIF_F_LRO) |
1532 | qlcnic_config_hw_lro(adapter, QLCNIC_LRO_ENABLED); | 1536 | qlcnic_config_hw_lro(adapter, QLCNIC_LRO_ENABLED); |
1533 | 1537 | ||
1538 | set_bit(__QLCNIC_DEV_UP, &adapter->state); | ||
1534 | qlcnic_napi_enable(adapter); | 1539 | qlcnic_napi_enable(adapter); |
1535 | 1540 | ||
1536 | qlcnic_linkevent_request(adapter, 1); | 1541 | qlcnic_linkevent_request(adapter, 1); |
1537 | 1542 | ||
1538 | adapter->ahw->reset_context = 0; | 1543 | adapter->ahw->reset_context = 0; |
1539 | set_bit(__QLCNIC_DEV_UP, &adapter->state); | ||
1540 | return 0; | 1544 | return 0; |
1541 | } | 1545 | } |
1542 | 1546 | ||
@@ -2139,7 +2143,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2139 | if (qlcnic_83xx_check(adapter) && !qlcnic_use_msi_x && | 2143 | if (qlcnic_83xx_check(adapter) && !qlcnic_use_msi_x && |
2140 | !!qlcnic_use_msi) | 2144 | !!qlcnic_use_msi) |
2141 | dev_warn(&pdev->dev, | 2145 | dev_warn(&pdev->dev, |
2142 | "83xx adapter do not support MSI interrupts\n"); | 2146 | "Device does not support MSI interrupts\n"); |
2143 | 2147 | ||
2144 | err = qlcnic_setup_intr(adapter, 0); | 2148 | err = qlcnic_setup_intr(adapter, 0); |
2145 | if (err) { | 2149 | if (err) { |
@@ -3093,6 +3097,7 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) | |||
3093 | { | 3097 | { |
3094 | u32 state = 0, heartbeat; | 3098 | u32 state = 0, heartbeat; |
3095 | u32 peg_status; | 3099 | u32 peg_status; |
3100 | int err = 0; | ||
3096 | 3101 | ||
3097 | if (qlcnic_check_temp(adapter)) | 3102 | if (qlcnic_check_temp(adapter)) |
3098 | goto detach; | 3103 | goto detach; |
@@ -3139,11 +3144,11 @@ qlcnic_check_health(struct qlcnic_adapter *adapter) | |||
3139 | "PEG_NET_4_PC: 0x%x\n", | 3144 | "PEG_NET_4_PC: 0x%x\n", |
3140 | peg_status, | 3145 | peg_status, |
3141 | QLC_SHARED_REG_RD32(adapter, QLCNIC_PEG_HALT_STATUS2), | 3146 | QLC_SHARED_REG_RD32(adapter, QLCNIC_PEG_HALT_STATUS2), |
3142 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_0 + 0x3c), | 3147 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_0 + 0x3c, &err), |
3143 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_1 + 0x3c), | 3148 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_1 + 0x3c, &err), |
3144 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_2 + 0x3c), | 3149 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_2 + 0x3c, &err), |
3145 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_3 + 0x3c), | 3150 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_3 + 0x3c, &err), |
3146 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c)); | 3151 | QLCRD32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c, &err)); |
3147 | if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) | 3152 | if (QLCNIC_FWERROR_CODE(peg_status) == 0x67) |
3148 | dev_err(&adapter->pdev->dev, | 3153 | dev_err(&adapter->pdev->dev, |
3149 | "Firmware aborted with error code 0x00006700. " | 3154 | "Firmware aborted with error code 0x00006700. " |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c index ab8a6744d402..79e54efe07b9 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c | |||
@@ -1084,7 +1084,7 @@ flash_temp: | |||
1084 | tmpl_hdr = ahw->fw_dump.tmpl_hdr; | 1084 | tmpl_hdr = ahw->fw_dump.tmpl_hdr; |
1085 | tmpl_hdr->drv_cap_mask = QLCNIC_DUMP_MASK_DEF; | 1085 | tmpl_hdr->drv_cap_mask = QLCNIC_DUMP_MASK_DEF; |
1086 | 1086 | ||
1087 | if ((tmpl_hdr->version & 0xffffff) >= 0x20001) | 1087 | if ((tmpl_hdr->version & 0xfffff) >= 0x20001) |
1088 | ahw->fw_dump.use_pex_dma = true; | 1088 | ahw->fw_dump.use_pex_dma = true; |
1089 | else | 1089 | else |
1090 | ahw->fw_dump.use_pex_dma = false; | 1090 | ahw->fw_dump.use_pex_dma = false; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c index 62380ce89905..5d40045b3cea 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c | |||
@@ -562,7 +562,7 @@ static int qlcnic_sriov_setup_vf(struct qlcnic_adapter *adapter, | |||
562 | INIT_LIST_HEAD(&adapter->vf_mc_list); | 562 | INIT_LIST_HEAD(&adapter->vf_mc_list); |
563 | if (!qlcnic_use_msi_x && !!qlcnic_use_msi) | 563 | if (!qlcnic_use_msi_x && !!qlcnic_use_msi) |
564 | dev_warn(&adapter->pdev->dev, | 564 | dev_warn(&adapter->pdev->dev, |
565 | "83xx adapter do not support MSI interrupts\n"); | 565 | "Device does not support MSI interrupts\n"); |
566 | 566 | ||
567 | err = qlcnic_setup_intr(adapter, 1); | 567 | err = qlcnic_setup_intr(adapter, 1); |
568 | if (err) { | 568 | if (err) { |
@@ -762,6 +762,7 @@ static int qlcnic_sriov_alloc_bc_mbx_args(struct qlcnic_cmd_args *mbx, u32 type) | |||
762 | memset(mbx->rsp.arg, 0, sizeof(u32) * mbx->rsp.num); | 762 | memset(mbx->rsp.arg, 0, sizeof(u32) * mbx->rsp.num); |
763 | mbx->req.arg[0] = (type | (mbx->req.num << 16) | | 763 | mbx->req.arg[0] = (type | (mbx->req.num << 16) | |
764 | (3 << 29)); | 764 | (3 << 29)); |
765 | mbx->rsp.arg[0] = (type & 0xffff) | mbx->rsp.num << 16; | ||
765 | return 0; | 766 | return 0; |
766 | } | 767 | } |
767 | } | 768 | } |
@@ -813,6 +814,7 @@ static int qlcnic_sriov_prepare_bc_hdr(struct qlcnic_bc_trans *trans, | |||
813 | cmd->req.num = trans->req_pay_size / 4; | 814 | cmd->req.num = trans->req_pay_size / 4; |
814 | cmd->rsp.num = trans->rsp_pay_size / 4; | 815 | cmd->rsp.num = trans->rsp_pay_size / 4; |
815 | hdr = trans->rsp_hdr; | 816 | hdr = trans->rsp_hdr; |
817 | cmd->op_type = trans->req_hdr->op_type; | ||
816 | } | 818 | } |
817 | 819 | ||
818 | trans->trans_id = seq; | 820 | trans->trans_id = seq; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c index ee0c1d307966..eb49cd65378c 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c | |||
@@ -635,12 +635,12 @@ static int qlcnic_sriov_pf_channel_cfg_cmd(struct qlcnic_bc_trans *trans, | |||
635 | struct qlcnic_cmd_args *cmd) | 635 | struct qlcnic_cmd_args *cmd) |
636 | { | 636 | { |
637 | struct qlcnic_vf_info *vf = trans->vf; | 637 | struct qlcnic_vf_info *vf = trans->vf; |
638 | struct qlcnic_adapter *adapter = vf->adapter; | 638 | struct qlcnic_vport *vp = vf->vp; |
639 | int err; | 639 | struct qlcnic_adapter *adapter; |
640 | u16 func = vf->pci_func; | 640 | u16 func = vf->pci_func; |
641 | int err; | ||
641 | 642 | ||
642 | cmd->rsp.arg[0] = trans->req_hdr->cmd_op; | 643 | adapter = vf->adapter; |
643 | cmd->rsp.arg[0] |= (1 << 16); | ||
644 | 644 | ||
645 | if (trans->req_hdr->cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT) { | 645 | if (trans->req_hdr->cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT) { |
646 | err = qlcnic_sriov_pf_config_vport(adapter, 1, func); | 646 | err = qlcnic_sriov_pf_config_vport(adapter, 1, func); |
@@ -650,6 +650,8 @@ static int qlcnic_sriov_pf_channel_cfg_cmd(struct qlcnic_bc_trans *trans, | |||
650 | qlcnic_sriov_pf_config_vport(adapter, 0, func); | 650 | qlcnic_sriov_pf_config_vport(adapter, 0, func); |
651 | } | 651 | } |
652 | } else { | 652 | } else { |
653 | if (vp->vlan_mode == QLC_GUEST_VLAN_MODE) | ||
654 | vp->vlan = 0; | ||
653 | err = qlcnic_sriov_pf_config_vport(adapter, 0, func); | 655 | err = qlcnic_sriov_pf_config_vport(adapter, 0, func); |
654 | } | 656 | } |
655 | 657 | ||
@@ -1183,7 +1185,7 @@ static int qlcnic_sriov_pf_get_acl_cmd(struct qlcnic_bc_trans *trans, | |||
1183 | u8 cmd_op, mode = vp->vlan_mode; | 1185 | u8 cmd_op, mode = vp->vlan_mode; |
1184 | 1186 | ||
1185 | cmd_op = trans->req_hdr->cmd_op; | 1187 | cmd_op = trans->req_hdr->cmd_op; |
1186 | cmd->rsp.arg[0] = (cmd_op & 0xffff) | 14 << 16 | 1 << 25; | 1188 | cmd->rsp.arg[0] |= 1 << 25; |
1187 | 1189 | ||
1188 | switch (mode) { | 1190 | switch (mode) { |
1189 | case QLC_GUEST_VLAN_MODE: | 1191 | case QLC_GUEST_VLAN_MODE: |
@@ -1561,6 +1563,7 @@ void qlcnic_sriov_pf_handle_flr(struct qlcnic_sriov *sriov, | |||
1561 | struct qlcnic_vf_info *vf) | 1563 | struct qlcnic_vf_info *vf) |
1562 | { | 1564 | { |
1563 | struct net_device *dev = vf->adapter->netdev; | 1565 | struct net_device *dev = vf->adapter->netdev; |
1566 | struct qlcnic_vport *vp = vf->vp; | ||
1564 | 1567 | ||
1565 | if (!test_and_clear_bit(QLC_BC_VF_STATE, &vf->state)) { | 1568 | if (!test_and_clear_bit(QLC_BC_VF_STATE, &vf->state)) { |
1566 | clear_bit(QLC_BC_VF_FLR, &vf->state); | 1569 | clear_bit(QLC_BC_VF_FLR, &vf->state); |
@@ -1573,6 +1576,9 @@ void qlcnic_sriov_pf_handle_flr(struct qlcnic_sriov *sriov, | |||
1573 | return; | 1576 | return; |
1574 | } | 1577 | } |
1575 | 1578 | ||
1579 | if (vp->vlan_mode == QLC_GUEST_VLAN_MODE) | ||
1580 | vp->vlan = 0; | ||
1581 | |||
1576 | qlcnic_sriov_schedule_flr(sriov, vf, qlcnic_sriov_pf_process_flr); | 1582 | qlcnic_sriov_schedule_flr(sriov, vf, qlcnic_sriov_pf_process_flr); |
1577 | netdev_info(dev, "FLR received for PCI func %d\n", vf->pci_func); | 1583 | netdev_info(dev, "FLR received for PCI func %d\n", vf->pci_func); |
1578 | } | 1584 | } |
@@ -1621,13 +1627,15 @@ int qlcnic_sriov_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) | |||
1621 | { | 1627 | { |
1622 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1628 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1623 | struct qlcnic_sriov *sriov = adapter->ahw->sriov; | 1629 | struct qlcnic_sriov *sriov = adapter->ahw->sriov; |
1624 | int i, num_vfs = sriov->num_vfs; | 1630 | int i, num_vfs; |
1625 | struct qlcnic_vf_info *vf_info; | 1631 | struct qlcnic_vf_info *vf_info; |
1626 | u8 *curr_mac; | 1632 | u8 *curr_mac; |
1627 | 1633 | ||
1628 | if (!qlcnic_sriov_pf_check(adapter)) | 1634 | if (!qlcnic_sriov_pf_check(adapter)) |
1629 | return -EOPNOTSUPP; | 1635 | return -EOPNOTSUPP; |
1630 | 1636 | ||
1637 | num_vfs = sriov->num_vfs; | ||
1638 | |||
1631 | if (!is_valid_ether_addr(mac) || vf >= num_vfs) | 1639 | if (!is_valid_ether_addr(mac) || vf >= num_vfs) |
1632 | return -EINVAL; | 1640 | return -EINVAL; |
1633 | 1641 | ||
@@ -1741,6 +1749,7 @@ int qlcnic_sriov_set_vf_vlan(struct net_device *netdev, int vf, | |||
1741 | 1749 | ||
1742 | switch (vlan) { | 1750 | switch (vlan) { |
1743 | case 4095: | 1751 | case 4095: |
1752 | vp->vlan = 0; | ||
1744 | vp->vlan_mode = QLC_GUEST_VLAN_MODE; | 1753 | vp->vlan_mode = QLC_GUEST_VLAN_MODE; |
1745 | break; | 1754 | break; |
1746 | case 0: | 1755 | case 0: |
@@ -1759,6 +1768,29 @@ int qlcnic_sriov_set_vf_vlan(struct net_device *netdev, int vf, | |||
1759 | return 0; | 1768 | return 0; |
1760 | } | 1769 | } |
1761 | 1770 | ||
1771 | static inline __u32 qlcnic_sriov_get_vf_vlan(struct qlcnic_adapter *adapter, | ||
1772 | struct qlcnic_vport *vp, int vf) | ||
1773 | { | ||
1774 | __u32 vlan = 0; | ||
1775 | |||
1776 | switch (vp->vlan_mode) { | ||
1777 | case QLC_PVID_MODE: | ||
1778 | vlan = vp->vlan; | ||
1779 | break; | ||
1780 | case QLC_GUEST_VLAN_MODE: | ||
1781 | vlan = MAX_VLAN_ID; | ||
1782 | break; | ||
1783 | case QLC_NO_VLAN_MODE: | ||
1784 | vlan = 0; | ||
1785 | break; | ||
1786 | default: | ||
1787 | netdev_info(adapter->netdev, "Invalid VLAN mode = %d for VF %d\n", | ||
1788 | vp->vlan_mode, vf); | ||
1789 | } | ||
1790 | |||
1791 | return vlan; | ||
1792 | } | ||
1793 | |||
1762 | int qlcnic_sriov_get_vf_config(struct net_device *netdev, | 1794 | int qlcnic_sriov_get_vf_config(struct net_device *netdev, |
1763 | int vf, struct ifla_vf_info *ivi) | 1795 | int vf, struct ifla_vf_info *ivi) |
1764 | { | 1796 | { |
@@ -1774,7 +1806,7 @@ int qlcnic_sriov_get_vf_config(struct net_device *netdev, | |||
1774 | 1806 | ||
1775 | vp = sriov->vf_info[vf].vp; | 1807 | vp = sriov->vf_info[vf].vp; |
1776 | memcpy(&ivi->mac, vp->mac, ETH_ALEN); | 1808 | memcpy(&ivi->mac, vp->mac, ETH_ALEN); |
1777 | ivi->vlan = vp->vlan; | 1809 | ivi->vlan = qlcnic_sriov_get_vf_vlan(adapter, vp, vf); |
1778 | ivi->qos = vp->qos; | 1810 | ivi->qos = vp->qos; |
1779 | ivi->spoofchk = vp->spoofchk; | 1811 | ivi->spoofchk = vp->spoofchk; |
1780 | if (vp->max_tx_bw == MAX_BW) | 1812 | if (vp->max_tx_bw == MAX_BW) |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index e6acb9fa5767..6f35f8404d68 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -478,7 +478,7 @@ rx_status_loop: | |||
478 | 478 | ||
479 | while (1) { | 479 | while (1) { |
480 | u32 status, len; | 480 | u32 status, len; |
481 | dma_addr_t mapping; | 481 | dma_addr_t mapping, new_mapping; |
482 | struct sk_buff *skb, *new_skb; | 482 | struct sk_buff *skb, *new_skb; |
483 | struct cp_desc *desc; | 483 | struct cp_desc *desc; |
484 | const unsigned buflen = cp->rx_buf_sz; | 484 | const unsigned buflen = cp->rx_buf_sz; |
@@ -520,6 +520,13 @@ rx_status_loop: | |||
520 | goto rx_next; | 520 | goto rx_next; |
521 | } | 521 | } |
522 | 522 | ||
523 | new_mapping = dma_map_single(&cp->pdev->dev, new_skb->data, buflen, | ||
524 | PCI_DMA_FROMDEVICE); | ||
525 | if (dma_mapping_error(&cp->pdev->dev, new_mapping)) { | ||
526 | dev->stats.rx_dropped++; | ||
527 | goto rx_next; | ||
528 | } | ||
529 | |||
523 | dma_unmap_single(&cp->pdev->dev, mapping, | 530 | dma_unmap_single(&cp->pdev->dev, mapping, |
524 | buflen, PCI_DMA_FROMDEVICE); | 531 | buflen, PCI_DMA_FROMDEVICE); |
525 | 532 | ||
@@ -531,12 +538,11 @@ rx_status_loop: | |||
531 | 538 | ||
532 | skb_put(skb, len); | 539 | skb_put(skb, len); |
533 | 540 | ||
534 | mapping = dma_map_single(&cp->pdev->dev, new_skb->data, buflen, | ||
535 | PCI_DMA_FROMDEVICE); | ||
536 | cp->rx_skb[rx_tail] = new_skb; | 541 | cp->rx_skb[rx_tail] = new_skb; |
537 | 542 | ||
538 | cp_rx_skb(cp, skb, desc); | 543 | cp_rx_skb(cp, skb, desc); |
539 | rx++; | 544 | rx++; |
545 | mapping = new_mapping; | ||
540 | 546 | ||
541 | rx_next: | 547 | rx_next: |
542 | cp->rx_ring[rx_tail].opts2 = 0; | 548 | cp->rx_ring[rx_tail].opts2 = 0; |
@@ -716,6 +722,22 @@ static inline u32 cp_tx_vlan_tag(struct sk_buff *skb) | |||
716 | TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; | 722 | TxVlanTag | swab16(vlan_tx_tag_get(skb)) : 0x00; |
717 | } | 723 | } |
718 | 724 | ||
725 | static void unwind_tx_frag_mapping(struct cp_private *cp, struct sk_buff *skb, | ||
726 | int first, int entry_last) | ||
727 | { | ||
728 | int frag, index; | ||
729 | struct cp_desc *txd; | ||
730 | skb_frag_t *this_frag; | ||
731 | for (frag = 0; frag+first < entry_last; frag++) { | ||
732 | index = first+frag; | ||
733 | cp->tx_skb[index] = NULL; | ||
734 | txd = &cp->tx_ring[index]; | ||
735 | this_frag = &skb_shinfo(skb)->frags[frag]; | ||
736 | dma_unmap_single(&cp->pdev->dev, le64_to_cpu(txd->addr), | ||
737 | skb_frag_size(this_frag), PCI_DMA_TODEVICE); | ||
738 | } | ||
739 | } | ||
740 | |||
719 | static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | 741 | static netdev_tx_t cp_start_xmit (struct sk_buff *skb, |
720 | struct net_device *dev) | 742 | struct net_device *dev) |
721 | { | 743 | { |
@@ -749,6 +771,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
749 | 771 | ||
750 | len = skb->len; | 772 | len = skb->len; |
751 | mapping = dma_map_single(&cp->pdev->dev, skb->data, len, PCI_DMA_TODEVICE); | 773 | mapping = dma_map_single(&cp->pdev->dev, skb->data, len, PCI_DMA_TODEVICE); |
774 | if (dma_mapping_error(&cp->pdev->dev, mapping)) | ||
775 | goto out_dma_error; | ||
776 | |||
752 | txd->opts2 = opts2; | 777 | txd->opts2 = opts2; |
753 | txd->addr = cpu_to_le64(mapping); | 778 | txd->addr = cpu_to_le64(mapping); |
754 | wmb(); | 779 | wmb(); |
@@ -786,6 +811,9 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
786 | first_len = skb_headlen(skb); | 811 | first_len = skb_headlen(skb); |
787 | first_mapping = dma_map_single(&cp->pdev->dev, skb->data, | 812 | first_mapping = dma_map_single(&cp->pdev->dev, skb->data, |
788 | first_len, PCI_DMA_TODEVICE); | 813 | first_len, PCI_DMA_TODEVICE); |
814 | if (dma_mapping_error(&cp->pdev->dev, first_mapping)) | ||
815 | goto out_dma_error; | ||
816 | |||
789 | cp->tx_skb[entry] = skb; | 817 | cp->tx_skb[entry] = skb; |
790 | entry = NEXT_TX(entry); | 818 | entry = NEXT_TX(entry); |
791 | 819 | ||
@@ -799,6 +827,11 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
799 | mapping = dma_map_single(&cp->pdev->dev, | 827 | mapping = dma_map_single(&cp->pdev->dev, |
800 | skb_frag_address(this_frag), | 828 | skb_frag_address(this_frag), |
801 | len, PCI_DMA_TODEVICE); | 829 | len, PCI_DMA_TODEVICE); |
830 | if (dma_mapping_error(&cp->pdev->dev, mapping)) { | ||
831 | unwind_tx_frag_mapping(cp, skb, first_entry, entry); | ||
832 | goto out_dma_error; | ||
833 | } | ||
834 | |||
802 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; | 835 | eor = (entry == (CP_TX_RING_SIZE - 1)) ? RingEnd : 0; |
803 | 836 | ||
804 | ctrl = eor | len | DescOwn; | 837 | ctrl = eor | len | DescOwn; |
@@ -859,11 +892,16 @@ static netdev_tx_t cp_start_xmit (struct sk_buff *skb, | |||
859 | if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) | 892 | if (TX_BUFFS_AVAIL(cp) <= (MAX_SKB_FRAGS + 1)) |
860 | netif_stop_queue(dev); | 893 | netif_stop_queue(dev); |
861 | 894 | ||
895 | out_unlock: | ||
862 | spin_unlock_irqrestore(&cp->lock, intr_flags); | 896 | spin_unlock_irqrestore(&cp->lock, intr_flags); |
863 | 897 | ||
864 | cpw8(TxPoll, NormalTxPoll); | 898 | cpw8(TxPoll, NormalTxPoll); |
865 | 899 | ||
866 | return NETDEV_TX_OK; | 900 | return NETDEV_TX_OK; |
901 | out_dma_error: | ||
902 | kfree_skb(skb); | ||
903 | cp->dev->stats.tx_dropped++; | ||
904 | goto out_unlock; | ||
867 | } | 905 | } |
868 | 906 | ||
869 | /* Set or clear the multicast filter for this adaptor. | 907 | /* Set or clear the multicast filter for this adaptor. |
@@ -1054,6 +1092,10 @@ static int cp_refill_rx(struct cp_private *cp) | |||
1054 | 1092 | ||
1055 | mapping = dma_map_single(&cp->pdev->dev, skb->data, | 1093 | mapping = dma_map_single(&cp->pdev->dev, skb->data, |
1056 | cp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1094 | cp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1095 | if (dma_mapping_error(&cp->pdev->dev, mapping)) { | ||
1096 | kfree_skb(skb); | ||
1097 | goto err_out; | ||
1098 | } | ||
1057 | cp->rx_skb[i] = skb; | 1099 | cp->rx_skb[i] = skb; |
1058 | 1100 | ||
1059 | cp->rx_ring[i].opts2 = 0; | 1101 | cp->rx_ring[i].opts2 = 0; |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 4106a743ca74..b5eb4195fc99 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -3689,7 +3689,7 @@ static void rtl_phy_work(struct rtl8169_private *tp) | |||
3689 | if (tp->link_ok(ioaddr)) | 3689 | if (tp->link_ok(ioaddr)) |
3690 | return; | 3690 | return; |
3691 | 3691 | ||
3692 | netif_warn(tp, link, tp->dev, "PHY reset until link up\n"); | 3692 | netif_dbg(tp, link, tp->dev, "PHY reset until link up\n"); |
3693 | 3693 | ||
3694 | tp->phy_reset_enable(tp); | 3694 | tp->phy_reset_enable(tp); |
3695 | 3695 | ||
@@ -6468,6 +6468,8 @@ static int rtl8169_close(struct net_device *dev) | |||
6468 | rtl8169_down(dev); | 6468 | rtl8169_down(dev); |
6469 | rtl_unlock_work(tp); | 6469 | rtl_unlock_work(tp); |
6470 | 6470 | ||
6471 | cancel_work_sync(&tp->wk.work); | ||
6472 | |||
6471 | free_irq(pdev->irq, dev); | 6473 | free_irq(pdev->irq, dev); |
6472 | 6474 | ||
6473 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, | 6475 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
@@ -6793,8 +6795,6 @@ static void rtl_remove_one(struct pci_dev *pdev) | |||
6793 | rtl8168_driver_stop(tp); | 6795 | rtl8168_driver_stop(tp); |
6794 | } | 6796 | } |
6795 | 6797 | ||
6796 | cancel_work_sync(&tp->wk.work); | ||
6797 | |||
6798 | netif_napi_del(&tp->napi); | 6798 | netif_napi_del(&tp->napi); |
6799 | 6799 | ||
6800 | unregister_netdev(dev); | 6800 | unregister_netdev(dev); |
diff --git a/drivers/net/ethernet/sfc/filter.c b/drivers/net/ethernet/sfc/filter.c index b74a60ab9ac7..2a469b27a506 100644 --- a/drivers/net/ethernet/sfc/filter.c +++ b/drivers/net/ethernet/sfc/filter.c | |||
@@ -1209,7 +1209,9 @@ int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, | |||
1209 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4); | 1209 | EFX_BUG_ON_PARANOID(skb_headlen(skb) < nhoff + 4 * ip->ihl + 4); |
1210 | ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); | 1210 | ports = (const __be16 *)(skb->data + nhoff + 4 * ip->ihl); |
1211 | 1211 | ||
1212 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, 0, rxq_index); | 1212 | efx_filter_init_rx(&spec, EFX_FILTER_PRI_HINT, |
1213 | efx->rx_scatter ? EFX_FILTER_FLAG_RX_SCATTER : 0, | ||
1214 | rxq_index); | ||
1213 | rc = efx_filter_set_ipv4_full(&spec, ip->protocol, | 1215 | rc = efx_filter_set_ipv4_full(&spec, ip->protocol, |
1214 | ip->daddr, ports[1], ip->saddr, ports[0]); | 1216 | ip->daddr, ports[1], ip->saddr, ports[0]); |
1215 | if (rc) | 1217 | if (rc) |
diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c index eb4aea3fe793..f5d7ad75e479 100644 --- a/drivers/net/ethernet/sis/sis900.c +++ b/drivers/net/ethernet/sis/sis900.c | |||
@@ -1318,7 +1318,7 @@ static void sis900_timer(unsigned long data) | |||
1318 | if (duplex){ | 1318 | if (duplex){ |
1319 | sis900_set_mode(sis_priv, speed, duplex); | 1319 | sis900_set_mode(sis_priv, speed, duplex); |
1320 | sis630_set_eq(net_dev, sis_priv->chipset_rev); | 1320 | sis630_set_eq(net_dev, sis_priv->chipset_rev); |
1321 | netif_start_queue(net_dev); | 1321 | netif_carrier_on(net_dev); |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | sis_priv->timer.expires = jiffies + HZ; | 1324 | sis_priv->timer.expires = jiffies + HZ; |
@@ -1336,10 +1336,8 @@ static void sis900_timer(unsigned long data) | |||
1336 | status = sis900_default_phy(net_dev); | 1336 | status = sis900_default_phy(net_dev); |
1337 | mii_phy = sis_priv->mii; | 1337 | mii_phy = sis_priv->mii; |
1338 | 1338 | ||
1339 | if (status & MII_STAT_LINK){ | 1339 | if (status & MII_STAT_LINK) |
1340 | sis900_check_mode(net_dev, mii_phy); | 1340 | sis900_check_mode(net_dev, mii_phy); |
1341 | netif_carrier_on(net_dev); | ||
1342 | } | ||
1343 | } else { | 1341 | } else { |
1344 | /* Link ON -> OFF */ | 1342 | /* Link ON -> OFF */ |
1345 | if (!(status & MII_STAT_LINK)){ | 1343 | if (!(status & MII_STAT_LINK)){ |
@@ -1612,12 +1610,6 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) | |||
1612 | unsigned int index_cur_tx, index_dirty_tx; | 1610 | unsigned int index_cur_tx, index_dirty_tx; |
1613 | unsigned int count_dirty_tx; | 1611 | unsigned int count_dirty_tx; |
1614 | 1612 | ||
1615 | /* Don't transmit data before the complete of auto-negotiation */ | ||
1616 | if(!sis_priv->autong_complete){ | ||
1617 | netif_stop_queue(net_dev); | ||
1618 | return NETDEV_TX_BUSY; | ||
1619 | } | ||
1620 | |||
1621 | spin_lock_irqsave(&sis_priv->lock, flags); | 1613 | spin_lock_irqsave(&sis_priv->lock, flags); |
1622 | 1614 | ||
1623 | /* Calculate the next Tx descriptor entry. */ | 1615 | /* Calculate the next Tx descriptor entry. */ |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 05a1674e204f..22a7a4336211 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -1867,7 +1867,7 @@ static int cpsw_probe(struct platform_device *pdev) | |||
1867 | 1867 | ||
1868 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { | 1868 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { |
1869 | for (i = res->start; i <= res->end; i++) { | 1869 | for (i = res->start; i <= res->end; i++) { |
1870 | if (request_irq(i, cpsw_interrupt, IRQF_DISABLED, | 1870 | if (request_irq(i, cpsw_interrupt, 0, |
1871 | dev_name(&pdev->dev), priv)) { | 1871 | dev_name(&pdev->dev), priv)) { |
1872 | dev_err(priv->dev, "error attaching irq\n"); | 1872 | dev_err(priv->dev, "error attaching irq\n"); |
1873 | goto clean_ale_ret; | 1873 | goto clean_ale_ret; |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 07b176bcf929..1a222bce4bd7 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1568,8 +1568,7 @@ static int emac_dev_open(struct net_device *ndev) | |||
1568 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { | 1568 | while ((res = platform_get_resource(priv->pdev, IORESOURCE_IRQ, k))) { |
1569 | for (i = res->start; i <= res->end; i++) { | 1569 | for (i = res->start; i <= res->end; i++) { |
1570 | if (devm_request_irq(&priv->pdev->dev, i, emac_irq, | 1570 | if (devm_request_irq(&priv->pdev->dev, i, emac_irq, |
1571 | IRQF_DISABLED, | 1571 | 0, ndev->name, ndev)) |
1572 | ndev->name, ndev)) | ||
1573 | goto rollback; | 1572 | goto rollback; |
1574 | } | 1573 | } |
1575 | k++; | 1574 | k++; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 18373b6ae37d..d0f9c2fd1d4f 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -337,8 +337,11 @@ static int macvlan_open(struct net_device *dev) | |||
337 | int err; | 337 | int err; |
338 | 338 | ||
339 | if (vlan->port->passthru) { | 339 | if (vlan->port->passthru) { |
340 | if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC)) | 340 | if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC)) { |
341 | dev_set_promiscuity(lowerdev, 1); | 341 | err = dev_set_promiscuity(lowerdev, 1); |
342 | if (err < 0) | ||
343 | goto out; | ||
344 | } | ||
342 | goto hash_add; | 345 | goto hash_add; |
343 | } | 346 | } |
344 | 347 | ||
@@ -863,6 +866,18 @@ static int macvlan_changelink(struct net_device *dev, | |||
863 | struct nlattr *tb[], struct nlattr *data[]) | 866 | struct nlattr *tb[], struct nlattr *data[]) |
864 | { | 867 | { |
865 | struct macvlan_dev *vlan = netdev_priv(dev); | 868 | struct macvlan_dev *vlan = netdev_priv(dev); |
869 | enum macvlan_mode mode; | ||
870 | bool set_mode = false; | ||
871 | |||
872 | /* Validate mode, but don't set yet: setting flags may fail. */ | ||
873 | if (data && data[IFLA_MACVLAN_MODE]) { | ||
874 | set_mode = true; | ||
875 | mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); | ||
876 | /* Passthrough mode can't be set or cleared dynamically */ | ||
877 | if ((mode == MACVLAN_MODE_PASSTHRU) != | ||
878 | (vlan->mode == MACVLAN_MODE_PASSTHRU)) | ||
879 | return -EINVAL; | ||
880 | } | ||
866 | 881 | ||
867 | if (data && data[IFLA_MACVLAN_FLAGS]) { | 882 | if (data && data[IFLA_MACVLAN_FLAGS]) { |
868 | __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); | 883 | __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]); |
@@ -879,8 +894,8 @@ static int macvlan_changelink(struct net_device *dev, | |||
879 | } | 894 | } |
880 | vlan->flags = flags; | 895 | vlan->flags = flags; |
881 | } | 896 | } |
882 | if (data && data[IFLA_MACVLAN_MODE]) | 897 | if (set_mode) |
883 | vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]); | 898 | vlan->mode = mode; |
884 | return 0; | 899 | return 0; |
885 | } | 900 | } |
886 | 901 | ||
diff --git a/drivers/net/phy/mdio-sun4i.c b/drivers/net/phy/mdio-sun4i.c index 61d3f4ebf52e..7f25e49ae37f 100644 --- a/drivers/net/phy/mdio-sun4i.c +++ b/drivers/net/phy/mdio-sun4i.c | |||
@@ -40,7 +40,7 @@ struct sun4i_mdio_data { | |||
40 | static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | 40 | static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) |
41 | { | 41 | { |
42 | struct sun4i_mdio_data *data = bus->priv; | 42 | struct sun4i_mdio_data *data = bus->priv; |
43 | unsigned long start_jiffies; | 43 | unsigned long timeout_jiffies; |
44 | int value; | 44 | int value; |
45 | 45 | ||
46 | /* issue the phy address and reg */ | 46 | /* issue the phy address and reg */ |
@@ -49,10 +49,9 @@ static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) | |||
49 | writel(0x1, data->membase + EMAC_MAC_MCMD_REG); | 49 | writel(0x1, data->membase + EMAC_MAC_MCMD_REG); |
50 | 50 | ||
51 | /* Wait read complete */ | 51 | /* Wait read complete */ |
52 | start_jiffies = jiffies; | 52 | timeout_jiffies = jiffies + MDIO_TIMEOUT; |
53 | while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { | 53 | while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { |
54 | if (time_after(start_jiffies, | 54 | if (time_is_before_jiffies(timeout_jiffies)) |
55 | start_jiffies + MDIO_TIMEOUT)) | ||
56 | return -ETIMEDOUT; | 55 | return -ETIMEDOUT; |
57 | msleep(1); | 56 | msleep(1); |
58 | } | 57 | } |
@@ -69,7 +68,7 @@ static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, | |||
69 | u16 value) | 68 | u16 value) |
70 | { | 69 | { |
71 | struct sun4i_mdio_data *data = bus->priv; | 70 | struct sun4i_mdio_data *data = bus->priv; |
72 | unsigned long start_jiffies; | 71 | unsigned long timeout_jiffies; |
73 | 72 | ||
74 | /* issue the phy address and reg */ | 73 | /* issue the phy address and reg */ |
75 | writel((mii_id << 8) | regnum, data->membase + EMAC_MAC_MADR_REG); | 74 | writel((mii_id << 8) | regnum, data->membase + EMAC_MAC_MADR_REG); |
@@ -77,10 +76,9 @@ static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, | |||
77 | writel(0x1, data->membase + EMAC_MAC_MCMD_REG); | 76 | writel(0x1, data->membase + EMAC_MAC_MCMD_REG); |
78 | 77 | ||
79 | /* Wait read complete */ | 78 | /* Wait read complete */ |
80 | start_jiffies = jiffies; | 79 | timeout_jiffies = jiffies + MDIO_TIMEOUT; |
81 | while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { | 80 | while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) { |
82 | if (time_after(start_jiffies, | 81 | if (time_is_before_jiffies(timeout_jiffies)) |
83 | start_jiffies + MDIO_TIMEOUT)) | ||
84 | return -ETIMEDOUT; | 82 | return -ETIMEDOUT; |
85 | msleep(1); | 83 | msleep(1); |
86 | } | 84 | } |
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 1e3c302d94fe..2bc87e3a8141 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c | |||
@@ -1029,10 +1029,10 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1029 | dev->mii.supports_gmii = 1; | 1029 | dev->mii.supports_gmii = 1; |
1030 | 1030 | ||
1031 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1031 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1032 | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; | 1032 | NETIF_F_RXCSUM; |
1033 | 1033 | ||
1034 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1034 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1035 | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; | 1035 | NETIF_F_RXCSUM; |
1036 | 1036 | ||
1037 | /* Enable checksum offload */ | 1037 | /* Enable checksum offload */ |
1038 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | | 1038 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | |
@@ -1173,7 +1173,6 @@ ax88179_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) | |||
1173 | if (((skb->len + 8) % frame_size) == 0) | 1173 | if (((skb->len + 8) % frame_size) == 0) |
1174 | tx_hdr2 |= 0x80008000; /* Enable padding */ | 1174 | tx_hdr2 |= 0x80008000; /* Enable padding */ |
1175 | 1175 | ||
1176 | skb_linearize(skb); | ||
1177 | headroom = skb_headroom(skb); | 1176 | headroom = skb_headroom(skb); |
1178 | tailroom = skb_tailroom(skb); | 1177 | tailroom = skb_tailroom(skb); |
1179 | 1178 | ||
@@ -1317,10 +1316,10 @@ static int ax88179_reset(struct usbnet *dev) | |||
1317 | 1, 1, tmp); | 1316 | 1, 1, tmp); |
1318 | 1317 | ||
1319 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1318 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1320 | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; | 1319 | NETIF_F_RXCSUM; |
1321 | 1320 | ||
1322 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1321 | dev->net->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1323 | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_TSO; | 1322 | NETIF_F_RXCSUM; |
1324 | 1323 | ||
1325 | /* Enable checksum offload */ | 1324 | /* Enable checksum offload */ |
1326 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | | 1325 | *tmp = AX_RXCOE_IP | AX_RXCOE_TCP | AX_RXCOE_UDP | |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index ee13f9eb740c..11c51f275366 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -344,17 +344,41 @@ static const int multicast_filter_limit = 32; | |||
344 | static | 344 | static |
345 | int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) | 345 | int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) |
346 | { | 346 | { |
347 | return usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0), | 347 | int ret; |
348 | void *tmp; | ||
349 | |||
350 | tmp = kmalloc(size, GFP_KERNEL); | ||
351 | if (!tmp) | ||
352 | return -ENOMEM; | ||
353 | |||
354 | ret = usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0), | ||
348 | RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, | 355 | RTL8152_REQ_GET_REGS, RTL8152_REQT_READ, |
349 | value, index, data, size, 500); | 356 | value, index, tmp, size, 500); |
357 | |||
358 | memcpy(data, tmp, size); | ||
359 | kfree(tmp); | ||
360 | |||
361 | return ret; | ||
350 | } | 362 | } |
351 | 363 | ||
352 | static | 364 | static |
353 | int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) | 365 | int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) |
354 | { | 366 | { |
355 | return usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0), | 367 | int ret; |
368 | void *tmp; | ||
369 | |||
370 | tmp = kmalloc(size, GFP_KERNEL); | ||
371 | if (!tmp) | ||
372 | return -ENOMEM; | ||
373 | |||
374 | memcpy(tmp, data, size); | ||
375 | |||
376 | ret = usb_control_msg(tp->udev, usb_sndctrlpipe(tp->udev, 0), | ||
356 | RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, | 377 | RTL8152_REQ_SET_REGS, RTL8152_REQT_WRITE, |
357 | value, index, data, size, 500); | 378 | value, index, tmp, size, 500); |
379 | |||
380 | kfree(tmp); | ||
381 | return ret; | ||
358 | } | 382 | } |
359 | 383 | ||
360 | static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, | 384 | static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, |
@@ -490,37 +514,31 @@ int usb_ocp_write(struct r8152 *tp, u16 index, u16 byteen, u16 size, void *data) | |||
490 | 514 | ||
491 | static u32 ocp_read_dword(struct r8152 *tp, u16 type, u16 index) | 515 | static u32 ocp_read_dword(struct r8152 *tp, u16 type, u16 index) |
492 | { | 516 | { |
493 | u32 data; | 517 | __le32 data; |
494 | 518 | ||
495 | if (type == MCU_TYPE_PLA) | 519 | generic_ocp_read(tp, index, sizeof(data), &data, type); |
496 | pla_ocp_read(tp, index, sizeof(data), &data); | ||
497 | else | ||
498 | usb_ocp_read(tp, index, sizeof(data), &data); | ||
499 | 520 | ||
500 | return __le32_to_cpu(data); | 521 | return __le32_to_cpu(data); |
501 | } | 522 | } |
502 | 523 | ||
503 | static void ocp_write_dword(struct r8152 *tp, u16 type, u16 index, u32 data) | 524 | static void ocp_write_dword(struct r8152 *tp, u16 type, u16 index, u32 data) |
504 | { | 525 | { |
505 | if (type == MCU_TYPE_PLA) | 526 | __le32 tmp = __cpu_to_le32(data); |
506 | pla_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(data), &data); | 527 | |
507 | else | 528 | generic_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(tmp), &tmp, type); |
508 | usb_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(data), &data); | ||
509 | } | 529 | } |
510 | 530 | ||
511 | static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) | 531 | static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) |
512 | { | 532 | { |
513 | u32 data; | 533 | u32 data; |
534 | __le32 tmp; | ||
514 | u8 shift = index & 2; | 535 | u8 shift = index & 2; |
515 | 536 | ||
516 | index &= ~3; | 537 | index &= ~3; |
517 | 538 | ||
518 | if (type == MCU_TYPE_PLA) | 539 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); |
519 | pla_ocp_read(tp, index, sizeof(data), &data); | ||
520 | else | ||
521 | usb_ocp_read(tp, index, sizeof(data), &data); | ||
522 | 540 | ||
523 | data = __le32_to_cpu(data); | 541 | data = __le32_to_cpu(tmp); |
524 | data >>= (shift * 8); | 542 | data >>= (shift * 8); |
525 | data &= 0xffff; | 543 | data &= 0xffff; |
526 | 544 | ||
@@ -529,7 +547,8 @@ static u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index) | |||
529 | 547 | ||
530 | static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) | 548 | static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) |
531 | { | 549 | { |
532 | u32 tmp, mask = 0xffff; | 550 | u32 mask = 0xffff; |
551 | __le32 tmp; | ||
533 | u16 byen = BYTE_EN_WORD; | 552 | u16 byen = BYTE_EN_WORD; |
534 | u8 shift = index & 2; | 553 | u8 shift = index & 2; |
535 | 554 | ||
@@ -542,34 +561,25 @@ static void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data) | |||
542 | index &= ~3; | 561 | index &= ~3; |
543 | } | 562 | } |
544 | 563 | ||
545 | if (type == MCU_TYPE_PLA) | 564 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); |
546 | pla_ocp_read(tp, index, sizeof(tmp), &tmp); | ||
547 | else | ||
548 | usb_ocp_read(tp, index, sizeof(tmp), &tmp); | ||
549 | 565 | ||
550 | tmp = __le32_to_cpu(tmp) & ~mask; | 566 | data |= __le32_to_cpu(tmp) & ~mask; |
551 | tmp |= data; | 567 | tmp = __cpu_to_le32(data); |
552 | tmp = __cpu_to_le32(tmp); | ||
553 | 568 | ||
554 | if (type == MCU_TYPE_PLA) | 569 | generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); |
555 | pla_ocp_write(tp, index, byen, sizeof(tmp), &tmp); | ||
556 | else | ||
557 | usb_ocp_write(tp, index, byen, sizeof(tmp), &tmp); | ||
558 | } | 570 | } |
559 | 571 | ||
560 | static u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index) | 572 | static u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index) |
561 | { | 573 | { |
562 | u32 data; | 574 | u32 data; |
575 | __le32 tmp; | ||
563 | u8 shift = index & 3; | 576 | u8 shift = index & 3; |
564 | 577 | ||
565 | index &= ~3; | 578 | index &= ~3; |
566 | 579 | ||
567 | if (type == MCU_TYPE_PLA) | 580 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); |
568 | pla_ocp_read(tp, index, sizeof(data), &data); | ||
569 | else | ||
570 | usb_ocp_read(tp, index, sizeof(data), &data); | ||
571 | 581 | ||
572 | data = __le32_to_cpu(data); | 582 | data = __le32_to_cpu(tmp); |
573 | data >>= (shift * 8); | 583 | data >>= (shift * 8); |
574 | data &= 0xff; | 584 | data &= 0xff; |
575 | 585 | ||
@@ -578,7 +588,8 @@ static u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index) | |||
578 | 588 | ||
579 | static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) | 589 | static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) |
580 | { | 590 | { |
581 | u32 tmp, mask = 0xff; | 591 | u32 mask = 0xff; |
592 | __le32 tmp; | ||
582 | u16 byen = BYTE_EN_BYTE; | 593 | u16 byen = BYTE_EN_BYTE; |
583 | u8 shift = index & 3; | 594 | u8 shift = index & 3; |
584 | 595 | ||
@@ -591,19 +602,12 @@ static void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data) | |||
591 | index &= ~3; | 602 | index &= ~3; |
592 | } | 603 | } |
593 | 604 | ||
594 | if (type == MCU_TYPE_PLA) | 605 | generic_ocp_read(tp, index, sizeof(tmp), &tmp, type); |
595 | pla_ocp_read(tp, index, sizeof(tmp), &tmp); | ||
596 | else | ||
597 | usb_ocp_read(tp, index, sizeof(tmp), &tmp); | ||
598 | 606 | ||
599 | tmp = __le32_to_cpu(tmp) & ~mask; | 607 | data |= __le32_to_cpu(tmp) & ~mask; |
600 | tmp |= data; | 608 | tmp = __cpu_to_le32(data); |
601 | tmp = __cpu_to_le32(tmp); | ||
602 | 609 | ||
603 | if (type == MCU_TYPE_PLA) | 610 | generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type); |
604 | pla_ocp_write(tp, index, byen, sizeof(tmp), &tmp); | ||
605 | else | ||
606 | usb_ocp_write(tp, index, byen, sizeof(tmp), &tmp); | ||
607 | } | 611 | } |
608 | 612 | ||
609 | static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value) | 613 | static void r8152_mdio_write(struct r8152 *tp, u32 reg_addr, u32 value) |
@@ -685,21 +689,14 @@ static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data) | |||
685 | static inline void set_ethernet_addr(struct r8152 *tp) | 689 | static inline void set_ethernet_addr(struct r8152 *tp) |
686 | { | 690 | { |
687 | struct net_device *dev = tp->netdev; | 691 | struct net_device *dev = tp->netdev; |
688 | u8 *node_id; | 692 | u8 node_id[8] = {0}; |
689 | |||
690 | node_id = kmalloc(sizeof(u8) * 8, GFP_KERNEL); | ||
691 | if (!node_id) { | ||
692 | netif_err(tp, probe, dev, "out of memory"); | ||
693 | return; | ||
694 | } | ||
695 | 693 | ||
696 | if (pla_ocp_read(tp, PLA_IDR, sizeof(u8) * 8, node_id) < 0) | 694 | if (pla_ocp_read(tp, PLA_IDR, sizeof(node_id), node_id) < 0) |
697 | netif_notice(tp, probe, dev, "inet addr fail\n"); | 695 | netif_notice(tp, probe, dev, "inet addr fail\n"); |
698 | else { | 696 | else { |
699 | memcpy(dev->dev_addr, node_id, dev->addr_len); | 697 | memcpy(dev->dev_addr, node_id, dev->addr_len); |
700 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | 698 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
701 | } | 699 | } |
702 | kfree(node_id); | ||
703 | } | 700 | } |
704 | 701 | ||
705 | static int rtl8152_set_mac_address(struct net_device *netdev, void *p) | 702 | static int rtl8152_set_mac_address(struct net_device *netdev, void *p) |
@@ -882,15 +879,10 @@ static void rtl8152_set_rx_mode(struct net_device *netdev) | |||
882 | static void _rtl8152_set_rx_mode(struct net_device *netdev) | 879 | static void _rtl8152_set_rx_mode(struct net_device *netdev) |
883 | { | 880 | { |
884 | struct r8152 *tp = netdev_priv(netdev); | 881 | struct r8152 *tp = netdev_priv(netdev); |
885 | u32 tmp, *mc_filter; /* Multicast hash filter */ | 882 | u32 mc_filter[2]; /* Multicast hash filter */ |
883 | __le32 tmp[2]; | ||
886 | u32 ocp_data; | 884 | u32 ocp_data; |
887 | 885 | ||
888 | mc_filter = kmalloc(sizeof(u32) * 2, GFP_KERNEL); | ||
889 | if (!mc_filter) { | ||
890 | netif_err(tp, link, netdev, "out of memory"); | ||
891 | return; | ||
892 | } | ||
893 | |||
894 | clear_bit(RTL8152_SET_RX_MODE, &tp->flags); | 886 | clear_bit(RTL8152_SET_RX_MODE, &tp->flags); |
895 | netif_stop_queue(netdev); | 887 | netif_stop_queue(netdev); |
896 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); | 888 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); |
@@ -918,14 +910,12 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev) | |||
918 | } | 910 | } |
919 | } | 911 | } |
920 | 912 | ||
921 | tmp = mc_filter[0]; | 913 | tmp[0] = __cpu_to_le32(swab32(mc_filter[1])); |
922 | mc_filter[0] = __cpu_to_le32(swab32(mc_filter[1])); | 914 | tmp[1] = __cpu_to_le32(swab32(mc_filter[0])); |
923 | mc_filter[1] = __cpu_to_le32(swab32(tmp)); | ||
924 | 915 | ||
925 | pla_ocp_write(tp, PLA_MAR, BYTE_EN_DWORD, sizeof(u32) * 2, mc_filter); | 916 | pla_ocp_write(tp, PLA_MAR, BYTE_EN_DWORD, sizeof(tmp), tmp); |
926 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); | 917 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); |
927 | netif_wake_queue(netdev); | 918 | netif_wake_queue(netdev); |
928 | kfree(mc_filter); | ||
929 | } | 919 | } |
930 | 920 | ||
931 | static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, | 921 | static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb, |
diff --git a/drivers/net/usb/r815x.c b/drivers/net/usb/r815x.c index 852392269718..2df2f4fb42a7 100644 --- a/drivers/net/usb/r815x.c +++ b/drivers/net/usb/r815x.c | |||
@@ -24,34 +24,43 @@ | |||
24 | 24 | ||
25 | static int pla_read_word(struct usb_device *udev, u16 index) | 25 | static int pla_read_word(struct usb_device *udev, u16 index) |
26 | { | 26 | { |
27 | int data, ret; | 27 | int ret; |
28 | u8 shift = index & 2; | 28 | u8 shift = index & 2; |
29 | __le32 ocp_data; | 29 | __le32 *tmp; |
30 | |||
31 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | ||
32 | if (!tmp) | ||
33 | return -ENOMEM; | ||
30 | 34 | ||
31 | index &= ~3; | 35 | index &= ~3; |
32 | 36 | ||
33 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 37 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
34 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, | 38 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, |
35 | index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data), | 39 | index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); |
36 | 500); | ||
37 | if (ret < 0) | 40 | if (ret < 0) |
38 | return ret; | 41 | goto out2; |
39 | 42 | ||
40 | data = __le32_to_cpu(ocp_data); | 43 | ret = __le32_to_cpu(*tmp); |
41 | data >>= (shift * 8); | 44 | ret >>= (shift * 8); |
42 | data &= 0xffff; | 45 | ret &= 0xffff; |
43 | 46 | ||
44 | return data; | 47 | out2: |
48 | kfree(tmp); | ||
49 | return ret; | ||
45 | } | 50 | } |
46 | 51 | ||
47 | static int pla_write_word(struct usb_device *udev, u16 index, u32 data) | 52 | static int pla_write_word(struct usb_device *udev, u16 index, u32 data) |
48 | { | 53 | { |
49 | __le32 ocp_data; | 54 | __le32 *tmp; |
50 | u32 mask = 0xffff; | 55 | u32 mask = 0xffff; |
51 | u16 byen = BYTE_EN_WORD; | 56 | u16 byen = BYTE_EN_WORD; |
52 | u8 shift = index & 2; | 57 | u8 shift = index & 2; |
53 | int ret; | 58 | int ret; |
54 | 59 | ||
60 | tmp = kmalloc(sizeof(*tmp), GFP_KERNEL); | ||
61 | if (!tmp) | ||
62 | return -ENOMEM; | ||
63 | |||
55 | data &= mask; | 64 | data &= mask; |
56 | 65 | ||
57 | if (shift) { | 66 | if (shift) { |
@@ -63,19 +72,20 @@ static int pla_write_word(struct usb_device *udev, u16 index, u32 data) | |||
63 | 72 | ||
64 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 73 | ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
65 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, | 74 | RTL815x_REQ_GET_REGS, RTL815x_REQT_READ, |
66 | index, MCU_TYPE_PLA, &ocp_data, sizeof(ocp_data), | 75 | index, MCU_TYPE_PLA, tmp, sizeof(*tmp), 500); |
67 | 500); | ||
68 | if (ret < 0) | 76 | if (ret < 0) |
69 | return ret; | 77 | goto out3; |
70 | 78 | ||
71 | data |= __le32_to_cpu(ocp_data) & ~mask; | 79 | data |= __le32_to_cpu(*tmp) & ~mask; |
72 | ocp_data = __cpu_to_le32(data); | 80 | *tmp = __cpu_to_le32(data); |
73 | 81 | ||
74 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 82 | ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
75 | RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, | 83 | RTL815x_REQ_SET_REGS, RTL815x_REQT_WRITE, |
76 | index, MCU_TYPE_PLA | byen, &ocp_data, | 84 | index, MCU_TYPE_PLA | byen, tmp, sizeof(*tmp), |
77 | sizeof(ocp_data), 500); | 85 | 500); |
78 | 86 | ||
87 | out3: | ||
88 | kfree(tmp); | ||
79 | return ret; | 89 | return ret; |
80 | } | 90 | } |
81 | 91 | ||
@@ -116,11 +126,18 @@ out1: | |||
116 | static int r815x_mdio_read(struct net_device *netdev, int phy_id, int reg) | 126 | static int r815x_mdio_read(struct net_device *netdev, int phy_id, int reg) |
117 | { | 127 | { |
118 | struct usbnet *dev = netdev_priv(netdev); | 128 | struct usbnet *dev = netdev_priv(netdev); |
129 | int ret; | ||
119 | 130 | ||
120 | if (phy_id != R815x_PHY_ID) | 131 | if (phy_id != R815x_PHY_ID) |
121 | return -EINVAL; | 132 | return -EINVAL; |
122 | 133 | ||
123 | return ocp_reg_read(dev, BASE_MII + reg * 2); | 134 | if (usb_autopm_get_interface(dev->intf) < 0) |
135 | return -ENODEV; | ||
136 | |||
137 | ret = ocp_reg_read(dev, BASE_MII + reg * 2); | ||
138 | |||
139 | usb_autopm_put_interface(dev->intf); | ||
140 | return ret; | ||
124 | } | 141 | } |
125 | 142 | ||
126 | static | 143 | static |
@@ -131,7 +148,12 @@ void r815x_mdio_write(struct net_device *netdev, int phy_id, int reg, int val) | |||
131 | if (phy_id != R815x_PHY_ID) | 148 | if (phy_id != R815x_PHY_ID) |
132 | return; | 149 | return; |
133 | 150 | ||
151 | if (usb_autopm_get_interface(dev->intf) < 0) | ||
152 | return; | ||
153 | |||
134 | ocp_reg_write(dev, BASE_MII + reg * 2, val); | 154 | ocp_reg_write(dev, BASE_MII + reg * 2, val); |
155 | |||
156 | usb_autopm_put_interface(dev->intf); | ||
135 | } | 157 | } |
136 | 158 | ||
137 | static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) | 159 | static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) |
@@ -150,7 +172,7 @@ static int r8153_bind(struct usbnet *dev, struct usb_interface *intf) | |||
150 | dev->mii.phy_id = R815x_PHY_ID; | 172 | dev->mii.phy_id = R815x_PHY_ID; |
151 | dev->mii.supports_gmii = 1; | 173 | dev->mii.supports_gmii = 1; |
152 | 174 | ||
153 | return 0; | 175 | return status; |
154 | } | 176 | } |
155 | 177 | ||
156 | static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) | 178 | static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) |
@@ -169,7 +191,7 @@ static int r8152_bind(struct usbnet *dev, struct usb_interface *intf) | |||
169 | dev->mii.phy_id = R815x_PHY_ID; | 191 | dev->mii.phy_id = R815x_PHY_ID; |
170 | dev->mii.supports_gmii = 0; | 192 | dev->mii.supports_gmii = 0; |
171 | 193 | ||
172 | return 0; | 194 | return status; |
173 | } | 195 | } |
174 | 196 | ||
175 | static const struct driver_info r8152_info = { | 197 | static const struct driver_info r8152_info = { |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 75409748c774..66ebbacf066f 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #define EEPROM_MAC_OFFSET (0x01) | 45 | #define EEPROM_MAC_OFFSET (0x01) |
46 | #define DEFAULT_TX_CSUM_ENABLE (true) | 46 | #define DEFAULT_TX_CSUM_ENABLE (true) |
47 | #define DEFAULT_RX_CSUM_ENABLE (true) | 47 | #define DEFAULT_RX_CSUM_ENABLE (true) |
48 | #define DEFAULT_TSO_ENABLE (true) | ||
49 | #define SMSC75XX_INTERNAL_PHY_ID (1) | 48 | #define SMSC75XX_INTERNAL_PHY_ID (1) |
50 | #define SMSC75XX_TX_OVERHEAD (8) | 49 | #define SMSC75XX_TX_OVERHEAD (8) |
51 | #define MAX_RX_FIFO_SIZE (20 * 1024) | 50 | #define MAX_RX_FIFO_SIZE (20 * 1024) |
@@ -1410,17 +1409,14 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1410 | 1409 | ||
1411 | INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write); | 1410 | INIT_WORK(&pdata->set_multicast, smsc75xx_deferred_multicast_write); |
1412 | 1411 | ||
1413 | if (DEFAULT_TX_CSUM_ENABLE) { | 1412 | if (DEFAULT_TX_CSUM_ENABLE) |
1414 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; | 1413 | dev->net->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM; |
1415 | if (DEFAULT_TSO_ENABLE) | 1414 | |
1416 | dev->net->features |= NETIF_F_SG | | ||
1417 | NETIF_F_TSO | NETIF_F_TSO6; | ||
1418 | } | ||
1419 | if (DEFAULT_RX_CSUM_ENABLE) | 1415 | if (DEFAULT_RX_CSUM_ENABLE) |
1420 | dev->net->features |= NETIF_F_RXCSUM; | 1416 | dev->net->features |= NETIF_F_RXCSUM; |
1421 | 1417 | ||
1422 | dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 1418 | dev->net->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1423 | NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_RXCSUM; | 1419 | NETIF_F_RXCSUM; |
1424 | 1420 | ||
1425 | ret = smsc75xx_wait_ready(dev, 0); | 1421 | ret = smsc75xx_wait_ready(dev, 0); |
1426 | if (ret < 0) { | 1422 | if (ret < 0) { |
@@ -2200,8 +2196,6 @@ static struct sk_buff *smsc75xx_tx_fixup(struct usbnet *dev, | |||
2200 | { | 2196 | { |
2201 | u32 tx_cmd_a, tx_cmd_b; | 2197 | u32 tx_cmd_a, tx_cmd_b; |
2202 | 2198 | ||
2203 | skb_linearize(skb); | ||
2204 | |||
2205 | if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) { | 2199 | if (skb_headroom(skb) < SMSC75XX_TX_OVERHEAD) { |
2206 | struct sk_buff *skb2 = | 2200 | struct sk_buff *skb2 = |
2207 | skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags); | 2201 | skb_copy_expand(skb, SMSC75XX_TX_OVERHEAD, 0, flags); |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index da866523cf20..eee1f19ef1e9 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -269,6 +269,7 @@ static void veth_setup(struct net_device *dev) | |||
269 | dev->ethtool_ops = &veth_ethtool_ops; | 269 | dev->ethtool_ops = &veth_ethtool_ops; |
270 | dev->features |= NETIF_F_LLTX; | 270 | dev->features |= NETIF_F_LLTX; |
271 | dev->features |= VETH_FEATURES; | 271 | dev->features |= VETH_FEATURES; |
272 | dev->vlan_features = dev->features; | ||
272 | dev->destructor = veth_dev_free; | 273 | dev->destructor = veth_dev_free; |
273 | 274 | ||
274 | dev->hw_features = VETH_FEATURES; | 275 | dev->hw_features = VETH_FEATURES; |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index a5ba8dd7e6be..f4c6db419ddb 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -136,7 +136,8 @@ struct vxlan_dev { | |||
136 | u32 flags; /* VXLAN_F_* below */ | 136 | u32 flags; /* VXLAN_F_* below */ |
137 | 137 | ||
138 | struct work_struct sock_work; | 138 | struct work_struct sock_work; |
139 | struct work_struct igmp_work; | 139 | struct work_struct igmp_join; |
140 | struct work_struct igmp_leave; | ||
140 | 141 | ||
141 | unsigned long age_interval; | 142 | unsigned long age_interval; |
142 | struct timer_list age_timer; | 143 | struct timer_list age_timer; |
@@ -736,7 +737,6 @@ static bool vxlan_snoop(struct net_device *dev, | |||
736 | return false; | 737 | return false; |
737 | } | 738 | } |
738 | 739 | ||
739 | |||
740 | /* See if multicast group is already in use by other ID */ | 740 | /* See if multicast group is already in use by other ID */ |
741 | static bool vxlan_group_used(struct vxlan_net *vn, __be32 remote_ip) | 741 | static bool vxlan_group_used(struct vxlan_net *vn, __be32 remote_ip) |
742 | { | 742 | { |
@@ -770,12 +770,13 @@ static void vxlan_sock_release(struct vxlan_net *vn, struct vxlan_sock *vs) | |||
770 | queue_work(vxlan_wq, &vs->del_work); | 770 | queue_work(vxlan_wq, &vs->del_work); |
771 | } | 771 | } |
772 | 772 | ||
773 | /* Callback to update multicast group membership. | 773 | /* Callback to update multicast group membership when first VNI on |
774 | * Scheduled when vxlan goes up/down. | 774 | * multicast asddress is brought up |
775 | * Done as workqueue because ip_mc_join_group acquires RTNL. | ||
775 | */ | 776 | */ |
776 | static void vxlan_igmp_work(struct work_struct *work) | 777 | static void vxlan_igmp_join(struct work_struct *work) |
777 | { | 778 | { |
778 | struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_work); | 779 | struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_join); |
779 | struct vxlan_net *vn = net_generic(dev_net(vxlan->dev), vxlan_net_id); | 780 | struct vxlan_net *vn = net_generic(dev_net(vxlan->dev), vxlan_net_id); |
780 | struct vxlan_sock *vs = vxlan->vn_sock; | 781 | struct vxlan_sock *vs = vxlan->vn_sock; |
781 | struct sock *sk = vs->sock->sk; | 782 | struct sock *sk = vs->sock->sk; |
@@ -785,10 +786,27 @@ static void vxlan_igmp_work(struct work_struct *work) | |||
785 | }; | 786 | }; |
786 | 787 | ||
787 | lock_sock(sk); | 788 | lock_sock(sk); |
788 | if (vxlan_group_used(vn, vxlan->default_dst.remote_ip)) | 789 | ip_mc_join_group(sk, &mreq); |
789 | ip_mc_join_group(sk, &mreq); | 790 | release_sock(sk); |
790 | else | 791 | |
791 | ip_mc_leave_group(sk, &mreq); | 792 | vxlan_sock_release(vn, vs); |
793 | dev_put(vxlan->dev); | ||
794 | } | ||
795 | |||
796 | /* Inverse of vxlan_igmp_join when last VNI is brought down */ | ||
797 | static void vxlan_igmp_leave(struct work_struct *work) | ||
798 | { | ||
799 | struct vxlan_dev *vxlan = container_of(work, struct vxlan_dev, igmp_leave); | ||
800 | struct vxlan_net *vn = net_generic(dev_net(vxlan->dev), vxlan_net_id); | ||
801 | struct vxlan_sock *vs = vxlan->vn_sock; | ||
802 | struct sock *sk = vs->sock->sk; | ||
803 | struct ip_mreqn mreq = { | ||
804 | .imr_multiaddr.s_addr = vxlan->default_dst.remote_ip, | ||
805 | .imr_ifindex = vxlan->default_dst.remote_ifindex, | ||
806 | }; | ||
807 | |||
808 | lock_sock(sk); | ||
809 | ip_mc_leave_group(sk, &mreq); | ||
792 | release_sock(sk); | 810 | release_sock(sk); |
793 | 811 | ||
794 | vxlan_sock_release(vn, vs); | 812 | vxlan_sock_release(vn, vs); |
@@ -1359,6 +1377,7 @@ static void vxlan_uninit(struct net_device *dev) | |||
1359 | /* Start ageing timer and join group when device is brought up */ | 1377 | /* Start ageing timer and join group when device is brought up */ |
1360 | static int vxlan_open(struct net_device *dev) | 1378 | static int vxlan_open(struct net_device *dev) |
1361 | { | 1379 | { |
1380 | struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); | ||
1362 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1381 | struct vxlan_dev *vxlan = netdev_priv(dev); |
1363 | struct vxlan_sock *vs = vxlan->vn_sock; | 1382 | struct vxlan_sock *vs = vxlan->vn_sock; |
1364 | 1383 | ||
@@ -1366,10 +1385,11 @@ static int vxlan_open(struct net_device *dev) | |||
1366 | if (!vs) | 1385 | if (!vs) |
1367 | return -ENOTCONN; | 1386 | return -ENOTCONN; |
1368 | 1387 | ||
1369 | if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip))) { | 1388 | if (IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && |
1389 | ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { | ||
1370 | vxlan_sock_hold(vs); | 1390 | vxlan_sock_hold(vs); |
1371 | dev_hold(dev); | 1391 | dev_hold(dev); |
1372 | queue_work(vxlan_wq, &vxlan->igmp_work); | 1392 | queue_work(vxlan_wq, &vxlan->igmp_join); |
1373 | } | 1393 | } |
1374 | 1394 | ||
1375 | if (vxlan->age_interval) | 1395 | if (vxlan->age_interval) |
@@ -1400,13 +1420,15 @@ static void vxlan_flush(struct vxlan_dev *vxlan) | |||
1400 | /* Cleanup timer and forwarding table on shutdown */ | 1420 | /* Cleanup timer and forwarding table on shutdown */ |
1401 | static int vxlan_stop(struct net_device *dev) | 1421 | static int vxlan_stop(struct net_device *dev) |
1402 | { | 1422 | { |
1423 | struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id); | ||
1403 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1424 | struct vxlan_dev *vxlan = netdev_priv(dev); |
1404 | struct vxlan_sock *vs = vxlan->vn_sock; | 1425 | struct vxlan_sock *vs = vxlan->vn_sock; |
1405 | 1426 | ||
1406 | if (vs && IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip))) { | 1427 | if (vs && IN_MULTICAST(ntohl(vxlan->default_dst.remote_ip)) && |
1428 | ! vxlan_group_used(vn, vxlan->default_dst.remote_ip)) { | ||
1407 | vxlan_sock_hold(vs); | 1429 | vxlan_sock_hold(vs); |
1408 | dev_hold(dev); | 1430 | dev_hold(dev); |
1409 | queue_work(vxlan_wq, &vxlan->igmp_work); | 1431 | queue_work(vxlan_wq, &vxlan->igmp_leave); |
1410 | } | 1432 | } |
1411 | 1433 | ||
1412 | del_timer_sync(&vxlan->age_timer); | 1434 | del_timer_sync(&vxlan->age_timer); |
@@ -1471,7 +1493,8 @@ static void vxlan_setup(struct net_device *dev) | |||
1471 | 1493 | ||
1472 | INIT_LIST_HEAD(&vxlan->next); | 1494 | INIT_LIST_HEAD(&vxlan->next); |
1473 | spin_lock_init(&vxlan->hash_lock); | 1495 | spin_lock_init(&vxlan->hash_lock); |
1474 | INIT_WORK(&vxlan->igmp_work, vxlan_igmp_work); | 1496 | INIT_WORK(&vxlan->igmp_join, vxlan_igmp_join); |
1497 | INIT_WORK(&vxlan->igmp_leave, vxlan_igmp_leave); | ||
1475 | INIT_WORK(&vxlan->sock_work, vxlan_sock_work); | 1498 | INIT_WORK(&vxlan->sock_work, vxlan_sock_work); |
1476 | 1499 | ||
1477 | init_timer_deferrable(&vxlan->age_timer); | 1500 | init_timer_deferrable(&vxlan->age_timer); |
@@ -1878,10 +1901,12 @@ static __net_exit void vxlan_exit_net(struct net *net) | |||
1878 | { | 1901 | { |
1879 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); | 1902 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); |
1880 | struct vxlan_dev *vxlan; | 1903 | struct vxlan_dev *vxlan; |
1904 | LIST_HEAD(list); | ||
1881 | 1905 | ||
1882 | rtnl_lock(); | 1906 | rtnl_lock(); |
1883 | list_for_each_entry(vxlan, &vn->vxlan_list, next) | 1907 | list_for_each_entry(vxlan, &vn->vxlan_list, next) |
1884 | dev_close(vxlan->dev); | 1908 | unregister_netdevice_queue(vxlan->dev, &list); |
1909 | unregister_netdevice_many(&list); | ||
1885 | rtnl_unlock(); | 1910 | rtnl_unlock(); |
1886 | } | 1911 | } |
1887 | 1912 | ||
diff --git a/drivers/net/wireless/ath/ath10k/Kconfig b/drivers/net/wireless/ath/ath10k/Kconfig index cde58fe96254..82e8088ca9b4 100644 --- a/drivers/net/wireless/ath/ath10k/Kconfig +++ b/drivers/net/wireless/ath/ath10k/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config ATH10K | 1 | config ATH10K |
2 | tristate "Atheros 802.11ac wireless cards support" | 2 | tristate "Atheros 802.11ac wireless cards support" |
3 | depends on MAC80211 | 3 | depends on MAC80211 && HAS_DMA |
4 | select ATH_COMMON | 4 | select ATH_COMMON |
5 | ---help--- | 5 | ---help--- |
6 | This module adds support for wireless adapters based on | 6 | This module adds support for wireless adapters based on |
diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c index 81b686c6a376..40825d43322e 100644 --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | |||
@@ -325,7 +325,7 @@ ath5k_prepare_multicast(struct ieee80211_hw *hw, | |||
325 | struct netdev_hw_addr *ha; | 325 | struct netdev_hw_addr *ha; |
326 | 326 | ||
327 | mfilt[0] = 0; | 327 | mfilt[0] = 0; |
328 | mfilt[1] = 1; | 328 | mfilt[1] = 0; |
329 | 329 | ||
330 | netdev_hw_addr_list_for_each(ha, mc_list) { | 330 | netdev_hw_addr_list_for_each(ha, mc_list) { |
331 | /* calculate XOR of eight 6-bit values */ | 331 | /* calculate XOR of eight 6-bit values */ |
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index d1acfe98918a..1576d58291d4 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -610,7 +610,15 @@ static void ar5008_hw_override_ini(struct ath_hw *ah, | |||
610 | REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); | 610 | REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); |
611 | 611 | ||
612 | if (AR_SREV_9280_20_OR_LATER(ah)) { | 612 | if (AR_SREV_9280_20_OR_LATER(ah)) { |
613 | val = REG_READ(ah, AR_PCU_MISC_MODE2); | 613 | /* |
614 | * For AR9280 and above, there is a new feature that allows | ||
615 | * Multicast search based on both MAC Address and Key ID. | ||
616 | * By default, this feature is enabled. But since the driver | ||
617 | * is not using this feature, we switch it off; otherwise | ||
618 | * multicast search based on MAC addr only will fail. | ||
619 | */ | ||
620 | val = REG_READ(ah, AR_PCU_MISC_MODE2) & | ||
621 | (~AR_ADHOC_MCAST_KEYID_ENABLE); | ||
614 | 622 | ||
615 | if (!AR_SREV_9271(ah)) | 623 | if (!AR_SREV_9271(ah)) |
616 | val &= ~AR_PCU_MISC_MODE2_HWWAR1; | 624 | val &= ~AR_PCU_MISC_MODE2_HWWAR1; |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 9e582e14da74..5205a3625e84 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -1082,7 +1082,7 @@ static void ath9k_hif_usb_firmware_fail(struct hif_device_usb *hif_dev) | |||
1082 | struct device *dev = &hif_dev->udev->dev; | 1082 | struct device *dev = &hif_dev->udev->dev; |
1083 | struct device *parent = dev->parent; | 1083 | struct device *parent = dev->parent; |
1084 | 1084 | ||
1085 | complete(&hif_dev->fw_done); | 1085 | complete_all(&hif_dev->fw_done); |
1086 | 1086 | ||
1087 | if (parent) | 1087 | if (parent) |
1088 | device_lock(parent); | 1088 | device_lock(parent); |
@@ -1131,7 +1131,7 @@ static void ath9k_hif_usb_firmware_cb(const struct firmware *fw, void *context) | |||
1131 | 1131 | ||
1132 | release_firmware(fw); | 1132 | release_firmware(fw); |
1133 | hif_dev->flags |= HIF_USB_READY; | 1133 | hif_dev->flags |= HIF_USB_READY; |
1134 | complete(&hif_dev->fw_done); | 1134 | complete_all(&hif_dev->fw_done); |
1135 | 1135 | ||
1136 | return; | 1136 | return; |
1137 | 1137 | ||
@@ -1295,7 +1295,9 @@ static void ath9k_hif_usb_disconnect(struct usb_interface *interface) | |||
1295 | 1295 | ||
1296 | usb_set_intfdata(interface, NULL); | 1296 | usb_set_intfdata(interface, NULL); |
1297 | 1297 | ||
1298 | if (!unplugged && (hif_dev->flags & HIF_USB_START)) | 1298 | /* If firmware was loaded we should drop it |
1299 | * go back to first stage bootloader. */ | ||
1300 | if (!unplugged && (hif_dev->flags & HIF_USB_READY)) | ||
1299 | ath9k_hif_usb_reboot(udev); | 1301 | ath9k_hif_usb_reboot(udev); |
1300 | 1302 | ||
1301 | kfree(hif_dev); | 1303 | kfree(hif_dev); |
@@ -1316,7 +1318,10 @@ static int ath9k_hif_usb_suspend(struct usb_interface *interface, | |||
1316 | if (!(hif_dev->flags & HIF_USB_START)) | 1318 | if (!(hif_dev->flags & HIF_USB_START)) |
1317 | ath9k_htc_suspend(hif_dev->htc_handle); | 1319 | ath9k_htc_suspend(hif_dev->htc_handle); |
1318 | 1320 | ||
1319 | ath9k_hif_usb_dealloc_urbs(hif_dev); | 1321 | wait_for_completion(&hif_dev->fw_done); |
1322 | |||
1323 | if (hif_dev->flags & HIF_USB_READY) | ||
1324 | ath9k_hif_usb_dealloc_urbs(hif_dev); | ||
1320 | 1325 | ||
1321 | return 0; | 1326 | return 0; |
1322 | } | 1327 | } |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 71a183ffc77f..c3676bf1d6c4 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c | |||
@@ -861,6 +861,7 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv, | |||
861 | if (error != 0) | 861 | if (error != 0) |
862 | goto err_rx; | 862 | goto err_rx; |
863 | 863 | ||
864 | ath9k_hw_disable(priv->ah); | ||
864 | #ifdef CONFIG_MAC80211_LEDS | 865 | #ifdef CONFIG_MAC80211_LEDS |
865 | /* must be initialized before ieee80211_register_hw */ | 866 | /* must be initialized before ieee80211_register_hw */ |
866 | priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw, | 867 | priv->led_cdev.default_trigger = ieee80211_create_tpt_led_trigger(priv->hw, |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index c59ae43b9b35..927992732620 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -146,6 +146,28 @@ static void ath_set_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, | |||
146 | ARRAY_SIZE(bf->rates)); | 146 | ARRAY_SIZE(bf->rates)); |
147 | } | 147 | } |
148 | 148 | ||
149 | static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, | ||
150 | struct sk_buff *skb) | ||
151 | { | ||
152 | int q; | ||
153 | |||
154 | q = skb_get_queue_mapping(skb); | ||
155 | if (txq == sc->tx.uapsdq) | ||
156 | txq = sc->tx.txq_map[q]; | ||
157 | |||
158 | if (txq != sc->tx.txq_map[q]) | ||
159 | return; | ||
160 | |||
161 | if (WARN_ON(--txq->pending_frames < 0)) | ||
162 | txq->pending_frames = 0; | ||
163 | |||
164 | if (txq->stopped && | ||
165 | txq->pending_frames < sc->tx.txq_max_pending[q]) { | ||
166 | ieee80211_wake_queue(sc->hw, q); | ||
167 | txq->stopped = false; | ||
168 | } | ||
169 | } | ||
170 | |||
149 | static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | 171 | static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) |
150 | { | 172 | { |
151 | struct ath_txq *txq = tid->ac->txq; | 173 | struct ath_txq *txq = tid->ac->txq; |
@@ -167,6 +189,7 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) | |||
167 | if (!bf) { | 189 | if (!bf) { |
168 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); | 190 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
169 | if (!bf) { | 191 | if (!bf) { |
192 | ath_txq_skb_done(sc, txq, skb); | ||
170 | ieee80211_free_txskb(sc->hw, skb); | 193 | ieee80211_free_txskb(sc->hw, skb); |
171 | continue; | 194 | continue; |
172 | } | 195 | } |
@@ -811,6 +834,7 @@ ath_tx_get_tid_subframe(struct ath_softc *sc, struct ath_txq *txq, | |||
811 | 834 | ||
812 | if (!bf) { | 835 | if (!bf) { |
813 | __skb_unlink(skb, &tid->buf_q); | 836 | __skb_unlink(skb, &tid->buf_q); |
837 | ath_txq_skb_done(sc, txq, skb); | ||
814 | ieee80211_free_txskb(sc->hw, skb); | 838 | ieee80211_free_txskb(sc->hw, skb); |
815 | continue; | 839 | continue; |
816 | } | 840 | } |
@@ -1824,6 +1848,7 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_txq *txq, | |||
1824 | 1848 | ||
1825 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); | 1849 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
1826 | if (!bf) { | 1850 | if (!bf) { |
1851 | ath_txq_skb_done(sc, txq, skb); | ||
1827 | ieee80211_free_txskb(sc->hw, skb); | 1852 | ieee80211_free_txskb(sc->hw, skb); |
1828 | return; | 1853 | return; |
1829 | } | 1854 | } |
@@ -2090,6 +2115,7 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2090 | 2115 | ||
2091 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); | 2116 | bf = ath_tx_setup_buffer(sc, txq, tid, skb); |
2092 | if (!bf) { | 2117 | if (!bf) { |
2118 | ath_txq_skb_done(sc, txq, skb); | ||
2093 | if (txctl->paprd) | 2119 | if (txctl->paprd) |
2094 | dev_kfree_skb_any(skb); | 2120 | dev_kfree_skb_any(skb); |
2095 | else | 2121 | else |
@@ -2189,7 +2215,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
2189 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 2215 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
2190 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 2216 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
2191 | struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; | 2217 | struct ieee80211_hdr * hdr = (struct ieee80211_hdr *)skb->data; |
2192 | int q, padpos, padsize; | 2218 | int padpos, padsize; |
2193 | unsigned long flags; | 2219 | unsigned long flags; |
2194 | 2220 | ||
2195 | ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb); | 2221 | ath_dbg(common, XMIT, "TX complete: skb: %p\n", skb); |
@@ -2225,21 +2251,7 @@ static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb, | |||
2225 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); | 2251 | spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
2226 | 2252 | ||
2227 | __skb_queue_tail(&txq->complete_q, skb); | 2253 | __skb_queue_tail(&txq->complete_q, skb); |
2228 | 2254 | ath_txq_skb_done(sc, txq, skb); | |
2229 | q = skb_get_queue_mapping(skb); | ||
2230 | if (txq == sc->tx.uapsdq) | ||
2231 | txq = sc->tx.txq_map[q]; | ||
2232 | |||
2233 | if (txq == sc->tx.txq_map[q]) { | ||
2234 | if (WARN_ON(--txq->pending_frames < 0)) | ||
2235 | txq->pending_frames = 0; | ||
2236 | |||
2237 | if (txq->stopped && | ||
2238 | txq->pending_frames < sc->tx.txq_max_pending[q]) { | ||
2239 | ieee80211_wake_queue(sc->hw, q); | ||
2240 | txq->stopped = false; | ||
2241 | } | ||
2242 | } | ||
2243 | } | 2255 | } |
2244 | 2256 | ||
2245 | static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, | 2257 | static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf, |
diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wireless/ath/wil6210/debugfs.c index e8308ec30970..ab636767fbde 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c | |||
@@ -145,7 +145,7 @@ static void wil_print_ring(struct seq_file *s, const char *prefix, | |||
145 | le16_to_cpu(hdr.type), hdr.flags); | 145 | le16_to_cpu(hdr.type), hdr.flags); |
146 | if (len <= MAX_MBOXITEM_SIZE) { | 146 | if (len <= MAX_MBOXITEM_SIZE) { |
147 | int n = 0; | 147 | int n = 0; |
148 | unsigned char printbuf[16 * 3 + 2]; | 148 | char printbuf[16 * 3 + 2]; |
149 | unsigned char databuf[MAX_MBOXITEM_SIZE]; | 149 | unsigned char databuf[MAX_MBOXITEM_SIZE]; |
150 | void __iomem *src = wmi_buffer(wil, d.addr) + | 150 | void __iomem *src = wmi_buffer(wil, d.addr) + |
151 | sizeof(struct wil6210_mbox_hdr); | 151 | sizeof(struct wil6210_mbox_hdr); |
@@ -416,7 +416,7 @@ static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) | |||
416 | seq_printf(s, " SKB = %p\n", skb); | 416 | seq_printf(s, " SKB = %p\n", skb); |
417 | 417 | ||
418 | if (skb) { | 418 | if (skb) { |
419 | unsigned char printbuf[16 * 3 + 2]; | 419 | char printbuf[16 * 3 + 2]; |
420 | int i = 0; | 420 | int i = 0; |
421 | int len = le16_to_cpu(d->dma.length); | 421 | int len = le16_to_cpu(d->dma.length); |
422 | void *p = skb->data; | 422 | void *p = skb->data; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c index 8e8975562ec3..80099016d21f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_linux.c | |||
@@ -242,7 +242,7 @@ void brcmf_txflowblock_if(struct brcmf_if *ifp, | |||
242 | { | 242 | { |
243 | unsigned long flags; | 243 | unsigned long flags; |
244 | 244 | ||
245 | if (!ifp) | 245 | if (!ifp || !ifp->ndev) |
246 | return; | 246 | return; |
247 | 247 | ||
248 | brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n", | 248 | brcmf_dbg(TRACE, "enter: idx=%d stop=0x%X reason=%d state=%d\n", |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c index f0d9f7f6c83d..29b1f24c2d0f 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | |||
@@ -1744,13 +1744,14 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1744 | ulong flags; | 1744 | ulong flags; |
1745 | int fifo = BRCMF_FWS_FIFO_BCMC; | 1745 | int fifo = BRCMF_FWS_FIFO_BCMC; |
1746 | bool multicast = is_multicast_ether_addr(eh->h_dest); | 1746 | bool multicast = is_multicast_ether_addr(eh->h_dest); |
1747 | bool pae = eh->h_proto == htons(ETH_P_PAE); | ||
1747 | 1748 | ||
1748 | /* determine the priority */ | 1749 | /* determine the priority */ |
1749 | if (!skb->priority) | 1750 | if (!skb->priority) |
1750 | skb->priority = cfg80211_classify8021d(skb); | 1751 | skb->priority = cfg80211_classify8021d(skb); |
1751 | 1752 | ||
1752 | drvr->tx_multicast += !!multicast; | 1753 | drvr->tx_multicast += !!multicast; |
1753 | if (ntohs(eh->h_proto) == ETH_P_PAE) | 1754 | if (pae) |
1754 | atomic_inc(&ifp->pend_8021x_cnt); | 1755 | atomic_inc(&ifp->pend_8021x_cnt); |
1755 | 1756 | ||
1756 | if (!brcmf_fws_fc_active(fws)) { | 1757 | if (!brcmf_fws_fc_active(fws)) { |
@@ -1781,6 +1782,11 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb) | |||
1781 | brcmf_fws_schedule_deq(fws); | 1782 | brcmf_fws_schedule_deq(fws); |
1782 | } else { | 1783 | } else { |
1783 | brcmf_err("drop skb: no hanger slot\n"); | 1784 | brcmf_err("drop skb: no hanger slot\n"); |
1785 | if (pae) { | ||
1786 | atomic_dec(&ifp->pend_8021x_cnt); | ||
1787 | if (waitqueue_active(&ifp->pend_8021x_wait)) | ||
1788 | wake_up(&ifp->pend_8021x_wait); | ||
1789 | } | ||
1784 | brcmu_pkt_buf_free_skb(skb); | 1790 | brcmu_pkt_buf_free_skb(skb); |
1785 | } | 1791 | } |
1786 | brcmf_fws_unlock(drvr, flags); | 1792 | brcmf_fws_unlock(drvr, flags); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 277b37ae7126..7fa71f73cfe8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -1093,8 +1093,11 @@ static void brcmf_link_down(struct brcmf_cfg80211_vif *vif) | |||
1093 | brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n "); | 1093 | brcmf_dbg(INFO, "Call WLC_DISASSOC to stop excess roaming\n "); |
1094 | err = brcmf_fil_cmd_data_set(vif->ifp, | 1094 | err = brcmf_fil_cmd_data_set(vif->ifp, |
1095 | BRCMF_C_DISASSOC, NULL, 0); | 1095 | BRCMF_C_DISASSOC, NULL, 0); |
1096 | if (err) | 1096 | if (err) { |
1097 | brcmf_err("WLC_DISASSOC failed (%d)\n", err); | 1097 | brcmf_err("WLC_DISASSOC failed (%d)\n", err); |
1098 | cfg80211_disconnected(vif->wdev.netdev, 0, | ||
1099 | NULL, 0, GFP_KERNEL); | ||
1100 | } | ||
1098 | clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); | 1101 | clear_bit(BRCMF_VIF_STATUS_CONNECTED, &vif->sme_state); |
1099 | } | 1102 | } |
1100 | clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); | 1103 | clear_bit(BRCMF_VIF_STATUS_CONNECTING, &vif->sme_state); |
diff --git a/drivers/net/wireless/cw1200/txrx.c b/drivers/net/wireless/cw1200/txrx.c index 5862c373d714..e824d4d4a18d 100644 --- a/drivers/net/wireless/cw1200/txrx.c +++ b/drivers/net/wireless/cw1200/txrx.c | |||
@@ -1165,7 +1165,7 @@ void cw1200_rx_cb(struct cw1200_common *priv, | |||
1165 | if (cw1200_handle_action_rx(priv, skb)) | 1165 | if (cw1200_handle_action_rx(priv, skb)) |
1166 | return; | 1166 | return; |
1167 | } else if (ieee80211_is_beacon(frame->frame_control) && | 1167 | } else if (ieee80211_is_beacon(frame->frame_control) && |
1168 | !arg->status && | 1168 | !arg->status && priv->vif && |
1169 | !memcmp(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid, | 1169 | !memcmp(ieee80211_get_SA(frame), priv->vif->bss_conf.bssid, |
1170 | ETH_ALEN)) { | 1170 | ETH_ALEN)) { |
1171 | const u8 *tim_ie; | 1171 | const u8 *tim_ie; |
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c index 3952ddf2ddb2..1531a4fc0960 100644 --- a/drivers/net/wireless/iwlwifi/dvm/main.c +++ b/drivers/net/wireless/iwlwifi/dvm/main.c | |||
@@ -758,7 +758,7 @@ int iwl_alive_start(struct iwl_priv *priv) | |||
758 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); | 758 | BT_COEX_PRIO_TBL_EVT_INIT_CALIB2); |
759 | if (ret) | 759 | if (ret) |
760 | return ret; | 760 | return ret; |
761 | } else { | 761 | } else if (priv->lib->bt_params) { |
762 | /* | 762 | /* |
763 | * default is 2-wire BT coexexistence support | 763 | * default is 2-wire BT coexexistence support |
764 | */ | 764 | */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index ff8cc75c189d..a70c7b9d9bad 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -97,6 +97,8 @@ | |||
97 | 97 | ||
98 | #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) | 98 | #define APMG_PCIDEV_STT_VAL_L1_ACT_DIS (0x00000800) |
99 | 99 | ||
100 | #define APMG_RTC_INT_STT_RFKILL (0x10000000) | ||
101 | |||
100 | /* Device system time */ | 102 | /* Device system time */ |
101 | #define DEVICE_SYSTEM_TIME_REG 0xA0206C | 103 | #define DEVICE_SYSTEM_TIME_REG 0xA0206C |
102 | 104 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index 7e5e5c2f9f87..83da884cf303 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c | |||
@@ -134,7 +134,7 @@ struct wowlan_key_data { | |||
134 | struct iwl_wowlan_rsc_tsc_params_cmd *rsc_tsc; | 134 | struct iwl_wowlan_rsc_tsc_params_cmd *rsc_tsc; |
135 | struct iwl_wowlan_tkip_params_cmd *tkip; | 135 | struct iwl_wowlan_tkip_params_cmd *tkip; |
136 | bool error, use_rsc_tsc, use_tkip; | 136 | bool error, use_rsc_tsc, use_tkip; |
137 | int gtk_key_idx; | 137 | int wep_key_idx; |
138 | }; | 138 | }; |
139 | 139 | ||
140 | static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, | 140 | static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, |
@@ -188,8 +188,8 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, | |||
188 | wkc.wep_key.key_offset = 0; | 188 | wkc.wep_key.key_offset = 0; |
189 | } else { | 189 | } else { |
190 | /* others start at 1 */ | 190 | /* others start at 1 */ |
191 | data->gtk_key_idx++; | 191 | data->wep_key_idx++; |
192 | wkc.wep_key.key_offset = data->gtk_key_idx; | 192 | wkc.wep_key.key_offset = data->wep_key_idx; |
193 | } | 193 | } |
194 | 194 | ||
195 | ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, | 195 | ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, CMD_SYNC, |
@@ -316,8 +316,13 @@ static void iwl_mvm_wowlan_program_keys(struct ieee80211_hw *hw, | |||
316 | mvm->ptk_ivlen = key->iv_len; | 316 | mvm->ptk_ivlen = key->iv_len; |
317 | mvm->ptk_icvlen = key->icv_len; | 317 | mvm->ptk_icvlen = key->icv_len; |
318 | } else { | 318 | } else { |
319 | data->gtk_key_idx++; | 319 | /* |
320 | key->hw_key_idx = data->gtk_key_idx; | 320 | * firmware only supports TSC/RSC for a single key, |
321 | * so if there are multiple keep overwriting them | ||
322 | * with new ones -- this relies on mac80211 doing | ||
323 | * list_add_tail(). | ||
324 | */ | ||
325 | key->hw_key_idx = 1; | ||
321 | mvm->gtk_ivlen = key->iv_len; | 326 | mvm->gtk_ivlen = key->iv_len; |
322 | mvm->gtk_icvlen = key->icv_len; | 327 | mvm->gtk_icvlen = key->icv_len; |
323 | } | 328 | } |
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index e56ed2a84888..c24a744910ac 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
@@ -988,7 +988,11 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif) | |||
988 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); | 988 | struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); |
989 | char buf[100]; | 989 | char buf[100]; |
990 | 990 | ||
991 | if (!dbgfs_dir) | 991 | /* |
992 | * Check if debugfs directory already exist before creating it. | ||
993 | * This may happen when, for example, resetting hw or suspend-resume | ||
994 | */ | ||
995 | if (!dbgfs_dir || mvmvif->dbgfs_dir) | ||
992 | return; | 996 | return; |
993 | 997 | ||
994 | mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); | 998 | mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h index b60d14151721..365095a0c3b3 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-scan.h | |||
@@ -69,7 +69,6 @@ | |||
69 | /* Scan Commands, Responses, Notifications */ | 69 | /* Scan Commands, Responses, Notifications */ |
70 | 70 | ||
71 | /* Masks for iwl_scan_channel.type flags */ | 71 | /* Masks for iwl_scan_channel.type flags */ |
72 | #define SCAN_CHANNEL_TYPE_PASSIVE 0 | ||
73 | #define SCAN_CHANNEL_TYPE_ACTIVE BIT(0) | 72 | #define SCAN_CHANNEL_TYPE_ACTIVE BIT(0) |
74 | #define SCAN_CHANNEL_NARROW_BAND BIT(22) | 73 | #define SCAN_CHANNEL_NARROW_BAND BIT(22) |
75 | 74 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index e08683b20531..f19baf0dea6b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -257,7 +257,11 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
257 | if (ret) | 257 | if (ret) |
258 | return ret; | 258 | return ret; |
259 | 259 | ||
260 | return ieee80211_register_hw(mvm->hw); | 260 | ret = ieee80211_register_hw(mvm->hw); |
261 | if (ret) | ||
262 | iwl_mvm_leds_exit(mvm); | ||
263 | |||
264 | return ret; | ||
261 | } | 265 | } |
262 | 266 | ||
263 | static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, | 267 | static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, |
@@ -385,6 +389,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) | |||
385 | ieee80211_wake_queues(mvm->hw); | 389 | ieee80211_wake_queues(mvm->hw); |
386 | 390 | ||
387 | mvm->vif_count = 0; | 391 | mvm->vif_count = 0; |
392 | mvm->rx_ba_sessions = 0; | ||
388 | } | 393 | } |
389 | 394 | ||
390 | static int iwl_mvm_mac_start(struct ieee80211_hw *hw) | 395 | static int iwl_mvm_mac_start(struct ieee80211_hw *hw) |
@@ -507,6 +512,27 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, | |||
507 | goto out_unlock; | 512 | goto out_unlock; |
508 | 513 | ||
509 | /* | 514 | /* |
515 | * TODO: remove this temporary code. | ||
516 | * Currently MVM FW supports power management only on single MAC. | ||
517 | * If new interface added, disable PM on existing interface. | ||
518 | * P2P device is a special case, since it is handled by FW similary to | ||
519 | * scan. If P2P deviced is added, PM remains enabled on existing | ||
520 | * interface. | ||
521 | * Note: the method below does not count the new interface being added | ||
522 | * at this moment. | ||
523 | */ | ||
524 | if (vif->type != NL80211_IFTYPE_P2P_DEVICE) | ||
525 | mvm->vif_count++; | ||
526 | if (mvm->vif_count > 1) { | ||
527 | IWL_DEBUG_MAC80211(mvm, | ||
528 | "Disable power on existing interfaces\n"); | ||
529 | ieee80211_iterate_active_interfaces_atomic( | ||
530 | mvm->hw, | ||
531 | IEEE80211_IFACE_ITER_NORMAL, | ||
532 | iwl_mvm_pm_disable_iterator, mvm); | ||
533 | } | ||
534 | |||
535 | /* | ||
510 | * The AP binding flow can be done only after the beacon | 536 | * The AP binding flow can be done only after the beacon |
511 | * template is configured (which happens only in the mac80211 | 537 | * template is configured (which happens only in the mac80211 |
512 | * start_ap() flow), and adding the broadcast station can happen | 538 | * start_ap() flow), and adding the broadcast station can happen |
@@ -529,27 +555,6 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw, | |||
529 | goto out_unlock; | 555 | goto out_unlock; |
530 | } | 556 | } |
531 | 557 | ||
532 | /* | ||
533 | * TODO: remove this temporary code. | ||
534 | * Currently MVM FW supports power management only on single MAC. | ||
535 | * If new interface added, disable PM on existing interface. | ||
536 | * P2P device is a special case, since it is handled by FW similary to | ||
537 | * scan. If P2P deviced is added, PM remains enabled on existing | ||
538 | * interface. | ||
539 | * Note: the method below does not count the new interface being added | ||
540 | * at this moment. | ||
541 | */ | ||
542 | if (vif->type != NL80211_IFTYPE_P2P_DEVICE) | ||
543 | mvm->vif_count++; | ||
544 | if (mvm->vif_count > 1) { | ||
545 | IWL_DEBUG_MAC80211(mvm, | ||
546 | "Disable power on existing interfaces\n"); | ||
547 | ieee80211_iterate_active_interfaces_atomic( | ||
548 | mvm->hw, | ||
549 | IEEE80211_IFACE_ITER_NORMAL, | ||
550 | iwl_mvm_pm_disable_iterator, mvm); | ||
551 | } | ||
552 | |||
553 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); | 558 | ret = iwl_mvm_mac_ctxt_add(mvm, vif); |
554 | if (ret) | 559 | if (ret) |
555 | goto out_release; | 560 | goto out_release; |
@@ -1006,6 +1011,21 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |||
1006 | mutex_lock(&mvm->mutex); | 1011 | mutex_lock(&mvm->mutex); |
1007 | if (old_state == IEEE80211_STA_NOTEXIST && | 1012 | if (old_state == IEEE80211_STA_NOTEXIST && |
1008 | new_state == IEEE80211_STA_NONE) { | 1013 | new_state == IEEE80211_STA_NONE) { |
1014 | /* | ||
1015 | * Firmware bug - it'll crash if the beacon interval is less | ||
1016 | * than 16. We can't avoid connecting at all, so refuse the | ||
1017 | * station state change, this will cause mac80211 to abandon | ||
1018 | * attempts to connect to this AP, and eventually wpa_s will | ||
1019 | * blacklist the AP... | ||
1020 | */ | ||
1021 | if (vif->type == NL80211_IFTYPE_STATION && | ||
1022 | vif->bss_conf.beacon_int < 16) { | ||
1023 | IWL_ERR(mvm, | ||
1024 | "AP %pM beacon interval is %d, refusing due to firmware bug!\n", | ||
1025 | sta->addr, vif->bss_conf.beacon_int); | ||
1026 | ret = -EINVAL; | ||
1027 | goto out_unlock; | ||
1028 | } | ||
1009 | ret = iwl_mvm_add_sta(mvm, vif, sta); | 1029 | ret = iwl_mvm_add_sta(mvm, vif, sta); |
1010 | } else if (old_state == IEEE80211_STA_NONE && | 1030 | } else if (old_state == IEEE80211_STA_NONE && |
1011 | new_state == IEEE80211_STA_AUTH) { | 1031 | new_state == IEEE80211_STA_AUTH) { |
@@ -1038,6 +1058,7 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw, | |||
1038 | } else { | 1058 | } else { |
1039 | ret = -EIO; | 1059 | ret = -EIO; |
1040 | } | 1060 | } |
1061 | out_unlock: | ||
1041 | mutex_unlock(&mvm->mutex); | 1062 | mutex_unlock(&mvm->mutex); |
1042 | 1063 | ||
1043 | return ret; | 1064 | return ret; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index d40d7db185d6..420e82d379d9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -419,6 +419,7 @@ struct iwl_mvm { | |||
419 | struct work_struct sta_drained_wk; | 419 | struct work_struct sta_drained_wk; |
420 | unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; | 420 | unsigned long sta_drained[BITS_TO_LONGS(IWL_MVM_STATION_COUNT)]; |
421 | atomic_t pending_frames[IWL_MVM_STATION_COUNT]; | 421 | atomic_t pending_frames[IWL_MVM_STATION_COUNT]; |
422 | u8 rx_ba_sessions; | ||
422 | 423 | ||
423 | /* configured by mac80211 */ | 424 | /* configured by mac80211 */ |
424 | u32 rts_threshold; | 425 | u32 rts_threshold; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 2157b0f8ced5..acdff6b67e04 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -137,8 +137,8 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd, | |||
137 | { | 137 | { |
138 | int fw_idx, req_idx; | 138 | int fw_idx, req_idx; |
139 | 139 | ||
140 | fw_idx = 0; | 140 | for (req_idx = req->n_ssids - 1, fw_idx = 0; req_idx > 0; |
141 | for (req_idx = req->n_ssids - 1; req_idx > 0; req_idx--) { | 141 | req_idx--, fw_idx++) { |
142 | cmd->direct_scan[fw_idx].id = WLAN_EID_SSID; | 142 | cmd->direct_scan[fw_idx].id = WLAN_EID_SSID; |
143 | cmd->direct_scan[fw_idx].len = req->ssids[req_idx].ssid_len; | 143 | cmd->direct_scan[fw_idx].len = req->ssids[req_idx].ssid_len; |
144 | memcpy(cmd->direct_scan[fw_idx].ssid, | 144 | memcpy(cmd->direct_scan[fw_idx].ssid, |
@@ -153,7 +153,9 @@ static void iwl_mvm_scan_fill_ssids(struct iwl_scan_cmd *cmd, | |||
153 | * just to notify that this scan is active and not passive. | 153 | * just to notify that this scan is active and not passive. |
154 | * In order to notify the FW of the number of SSIDs we wish to scan (including | 154 | * In order to notify the FW of the number of SSIDs we wish to scan (including |
155 | * the zero-length one), we need to set the corresponding bits in chan->type, | 155 | * the zero-length one), we need to set the corresponding bits in chan->type, |
156 | * one for each SSID, and set the active bit (first). | 156 | * one for each SSID, and set the active bit (first). The first SSID is already |
157 | * included in the probe template, so we need to set only req->n_ssids - 1 bits | ||
158 | * in addition to the first bit. | ||
157 | */ | 159 | */ |
158 | static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids) | 160 | static u16 iwl_mvm_get_active_dwell(enum ieee80211_band band, int n_ssids) |
159 | { | 161 | { |
@@ -176,19 +178,12 @@ static void iwl_mvm_scan_fill_channels(struct iwl_scan_cmd *cmd, | |||
176 | struct iwl_scan_channel *chan = (struct iwl_scan_channel *) | 178 | struct iwl_scan_channel *chan = (struct iwl_scan_channel *) |
177 | (cmd->data + le16_to_cpu(cmd->tx_cmd.len)); | 179 | (cmd->data + le16_to_cpu(cmd->tx_cmd.len)); |
178 | int i; | 180 | int i; |
179 | __le32 chan_type_value; | ||
180 | |||
181 | if (req->n_ssids > 0) | ||
182 | chan_type_value = cpu_to_le32(BIT(req->n_ssids + 1) - 1); | ||
183 | else | ||
184 | chan_type_value = SCAN_CHANNEL_TYPE_PASSIVE; | ||
185 | 181 | ||
186 | for (i = 0; i < cmd->channel_count; i++) { | 182 | for (i = 0; i < cmd->channel_count; i++) { |
187 | chan->channel = cpu_to_le16(req->channels[i]->hw_value); | 183 | chan->channel = cpu_to_le16(req->channels[i]->hw_value); |
184 | chan->type = cpu_to_le32(BIT(req->n_ssids) - 1); | ||
188 | if (req->channels[i]->flags & IEEE80211_CHAN_PASSIVE_SCAN) | 185 | if (req->channels[i]->flags & IEEE80211_CHAN_PASSIVE_SCAN) |
189 | chan->type = SCAN_CHANNEL_TYPE_PASSIVE; | 186 | chan->type &= cpu_to_le32(~SCAN_CHANNEL_TYPE_ACTIVE); |
190 | else | ||
191 | chan->type = chan_type_value; | ||
192 | chan->active_dwell = cpu_to_le16(active_dwell); | 187 | chan->active_dwell = cpu_to_le16(active_dwell); |
193 | chan->passive_dwell = cpu_to_le16(passive_dwell); | 188 | chan->passive_dwell = cpu_to_le16(passive_dwell); |
194 | chan->iteration_count = cpu_to_le16(1); | 189 | chan->iteration_count = cpu_to_le16(1); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c index 62fe5209093b..563f559b902d 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/iwlwifi/mvm/sta.c | |||
@@ -608,6 +608,8 @@ int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *bsta) | |||
608 | return ret; | 608 | return ret; |
609 | } | 609 | } |
610 | 610 | ||
611 | #define IWL_MAX_RX_BA_SESSIONS 16 | ||
612 | |||
611 | int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | 613 | int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, |
612 | int tid, u16 ssn, bool start) | 614 | int tid, u16 ssn, bool start) |
613 | { | 615 | { |
@@ -618,11 +620,20 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
618 | 620 | ||
619 | lockdep_assert_held(&mvm->mutex); | 621 | lockdep_assert_held(&mvm->mutex); |
620 | 622 | ||
623 | if (start && mvm->rx_ba_sessions >= IWL_MAX_RX_BA_SESSIONS) { | ||
624 | IWL_WARN(mvm, "Not enough RX BA SESSIONS\n"); | ||
625 | return -ENOSPC; | ||
626 | } | ||
627 | |||
621 | cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); | 628 | cmd.mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color); |
622 | cmd.sta_id = mvm_sta->sta_id; | 629 | cmd.sta_id = mvm_sta->sta_id; |
623 | cmd.add_modify = STA_MODE_MODIFY; | 630 | cmd.add_modify = STA_MODE_MODIFY; |
624 | cmd.add_immediate_ba_tid = (u8) tid; | 631 | if (start) { |
625 | cmd.add_immediate_ba_ssn = cpu_to_le16(ssn); | 632 | cmd.add_immediate_ba_tid = (u8) tid; |
633 | cmd.add_immediate_ba_ssn = cpu_to_le16(ssn); | ||
634 | } else { | ||
635 | cmd.remove_immediate_ba_tid = (u8) tid; | ||
636 | } | ||
626 | cmd.modify_mask = start ? STA_MODIFY_ADD_BA_TID : | 637 | cmd.modify_mask = start ? STA_MODIFY_ADD_BA_TID : |
627 | STA_MODIFY_REMOVE_BA_TID; | 638 | STA_MODIFY_REMOVE_BA_TID; |
628 | 639 | ||
@@ -648,6 +659,14 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
648 | break; | 659 | break; |
649 | } | 660 | } |
650 | 661 | ||
662 | if (!ret) { | ||
663 | if (start) | ||
664 | mvm->rx_ba_sessions++; | ||
665 | else if (mvm->rx_ba_sessions > 0) | ||
666 | /* check that restart flow didn't zero the counter */ | ||
667 | mvm->rx_ba_sessions--; | ||
668 | } | ||
669 | |||
651 | return ret; | 670 | return ret; |
652 | } | 671 | } |
653 | 672 | ||
@@ -896,6 +915,7 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
896 | struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; | 915 | struct iwl_mvm_sta *mvmsta = (void *)sta->drv_priv; |
897 | struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; | 916 | struct iwl_mvm_tid_data *tid_data = &mvmsta->tid_data[tid]; |
898 | u16 txq_id; | 917 | u16 txq_id; |
918 | enum iwl_mvm_agg_state old_state; | ||
899 | 919 | ||
900 | /* | 920 | /* |
901 | * First set the agg state to OFF to avoid calling | 921 | * First set the agg state to OFF to avoid calling |
@@ -905,13 +925,17 @@ int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
905 | txq_id = tid_data->txq_id; | 925 | txq_id = tid_data->txq_id; |
906 | IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n", | 926 | IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n", |
907 | mvmsta->sta_id, tid, txq_id, tid_data->state); | 927 | mvmsta->sta_id, tid, txq_id, tid_data->state); |
928 | old_state = tid_data->state; | ||
908 | tid_data->state = IWL_AGG_OFF; | 929 | tid_data->state = IWL_AGG_OFF; |
909 | spin_unlock_bh(&mvmsta->lock); | 930 | spin_unlock_bh(&mvmsta->lock); |
910 | 931 | ||
911 | if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true)) | 932 | if (old_state >= IWL_AGG_ON) { |
912 | IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); | 933 | if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), true)) |
934 | IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); | ||
935 | |||
936 | iwl_trans_txq_disable(mvm->trans, tid_data->txq_id); | ||
937 | } | ||
913 | 938 | ||
914 | iwl_trans_txq_disable(mvm->trans, tid_data->txq_id); | ||
915 | mvm->queue_to_mac80211[tid_data->txq_id] = | 939 | mvm->queue_to_mac80211[tid_data->txq_id] = |
916 | IWL_INVALID_MAC80211_QUEUE; | 940 | IWL_INVALID_MAC80211_QUEUE; |
917 | 941 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index 81f3ea5b09a4..ff13458efc27 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -130,6 +130,7 @@ static DEFINE_PCI_DEVICE_TABLE(iwl_hw_card_ids) = { | |||
130 | {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ | 130 | {IWL_PCI_DEVICE(0x423C, 0x1306, iwl5150_abg_cfg)}, /* Half Mini Card */ |
131 | {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ | 131 | {IWL_PCI_DEVICE(0x423C, 0x1221, iwl5150_agn_cfg)}, /* Mini Card */ |
132 | {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ | 132 | {IWL_PCI_DEVICE(0x423C, 0x1321, iwl5150_agn_cfg)}, /* Half Mini Card */ |
133 | {IWL_PCI_DEVICE(0x423C, 0x1326, iwl5150_abg_cfg)}, /* Half Mini Card */ | ||
133 | 134 | ||
134 | {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ | 135 | {IWL_PCI_DEVICE(0x423D, 0x1211, iwl5150_agn_cfg)}, /* Mini Card */ |
135 | {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ | 136 | {IWL_PCI_DEVICE(0x423D, 0x1311, iwl5150_agn_cfg)}, /* Half Mini Card */ |
diff --git a/drivers/net/wireless/iwlwifi/pcie/rx.c b/drivers/net/wireless/iwlwifi/pcie/rx.c index fd848cd1583e..f600e68a410a 100644 --- a/drivers/net/wireless/iwlwifi/pcie/rx.c +++ b/drivers/net/wireless/iwlwifi/pcie/rx.c | |||
@@ -888,6 +888,14 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id) | |||
888 | 888 | ||
889 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); | 889 | iwl_op_mode_hw_rf_kill(trans->op_mode, hw_rfkill); |
890 | if (hw_rfkill) { | 890 | if (hw_rfkill) { |
891 | /* | ||
892 | * Clear the interrupt in APMG if the NIC is going down. | ||
893 | * Note that when the NIC exits RFkill (else branch), we | ||
894 | * can't access prph and the NIC will be reset in | ||
895 | * start_hw anyway. | ||
896 | */ | ||
897 | iwl_write_prph(trans, APMG_RTC_INT_STT_REG, | ||
898 | APMG_RTC_INT_STT_RFKILL); | ||
891 | set_bit(STATUS_RFKILL, &trans_pcie->status); | 899 | set_bit(STATUS_RFKILL, &trans_pcie->status); |
892 | if (test_and_clear_bit(STATUS_HCMD_ACTIVE, | 900 | if (test_and_clear_bit(STATUS_HCMD_ACTIVE, |
893 | &trans_pcie->status)) | 901 | &trans_pcie->status)) |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 826c15602c46..96cfcdd39079 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -670,6 +670,11 @@ static int iwl_trans_pcie_start_hw(struct iwl_trans *trans) | |||
670 | return err; | 670 | return err; |
671 | } | 671 | } |
672 | 672 | ||
673 | /* Reset the entire device */ | ||
674 | iwl_set_bit(trans, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET); | ||
675 | |||
676 | usleep_range(10, 15); | ||
677 | |||
673 | iwl_pcie_apm_init(trans); | 678 | iwl_pcie_apm_init(trans); |
674 | 679 | ||
675 | /* From now on, the op_mode will be kept updated about RF kill state */ | 680 | /* From now on, the op_mode will be kept updated about RF kill state */ |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index ef5fa890a286..89459db4c53b 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -1716,9 +1716,9 @@ mwifiex_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1716 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | 1716 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); |
1717 | int ret; | 1717 | int ret; |
1718 | 1718 | ||
1719 | if (priv->bss_mode != NL80211_IFTYPE_STATION) { | 1719 | if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) { |
1720 | wiphy_err(wiphy, | 1720 | wiphy_err(wiphy, |
1721 | "%s: reject infra assoc request in non-STA mode\n", | 1721 | "%s: reject infra assoc request in non-STA role\n", |
1722 | dev->name); | 1722 | dev->name); |
1723 | return -EINVAL; | 1723 | return -EINVAL; |
1724 | } | 1724 | } |
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c index 988552dece75..5178c4630d89 100644 --- a/drivers/net/wireless/mwifiex/cfp.c +++ b/drivers/net/wireless/mwifiex/cfp.c | |||
@@ -415,7 +415,8 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) | |||
415 | u32 k = 0; | 415 | u32 k = 0; |
416 | struct mwifiex_adapter *adapter = priv->adapter; | 416 | struct mwifiex_adapter *adapter = priv->adapter; |
417 | 417 | ||
418 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 418 | if (priv->bss_mode == NL80211_IFTYPE_STATION || |
419 | priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { | ||
419 | switch (adapter->config_bands) { | 420 | switch (adapter->config_bands) { |
420 | case BAND_B: | 421 | case BAND_B: |
421 | dev_dbg(adapter->dev, "info: infra band=%d " | 422 | dev_dbg(adapter->dev, "info: infra band=%d " |
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c index caaf4bd56b30..2cf8b964e966 100644 --- a/drivers/net/wireless/mwifiex/init.c +++ b/drivers/net/wireless/mwifiex/init.c | |||
@@ -693,7 +693,7 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, | |||
693 | if (!ret) { | 693 | if (!ret) { |
694 | dev_notice(adapter->dev, | 694 | dev_notice(adapter->dev, |
695 | "WLAN FW already running! Skip FW dnld\n"); | 695 | "WLAN FW already running! Skip FW dnld\n"); |
696 | goto done; | 696 | return 0; |
697 | } | 697 | } |
698 | 698 | ||
699 | poll_num = MAX_FIRMWARE_POLL_TRIES; | 699 | poll_num = MAX_FIRMWARE_POLL_TRIES; |
@@ -719,14 +719,8 @@ int mwifiex_dnld_fw(struct mwifiex_adapter *adapter, | |||
719 | poll_fw: | 719 | poll_fw: |
720 | /* Check if the firmware is downloaded successfully or not */ | 720 | /* Check if the firmware is downloaded successfully or not */ |
721 | ret = adapter->if_ops.check_fw_status(adapter, poll_num); | 721 | ret = adapter->if_ops.check_fw_status(adapter, poll_num); |
722 | if (ret) { | 722 | if (ret) |
723 | dev_err(adapter->dev, "FW failed to be active in time\n"); | 723 | dev_err(adapter->dev, "FW failed to be active in time\n"); |
724 | return -1; | ||
725 | } | ||
726 | done: | ||
727 | /* re-enable host interrupt for mwifiex after fw dnld is successful */ | ||
728 | if (adapter->if_ops.enable_int) | ||
729 | adapter->if_ops.enable_int(adapter); | ||
730 | 724 | ||
731 | return ret; | 725 | return ret; |
732 | } | 726 | } |
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index 1c8a771e8e81..12e778159ec5 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -1291,8 +1291,10 @@ int mwifiex_associate(struct mwifiex_private *priv, | |||
1291 | { | 1291 | { |
1292 | u8 current_bssid[ETH_ALEN]; | 1292 | u8 current_bssid[ETH_ALEN]; |
1293 | 1293 | ||
1294 | /* Return error if the adapter or table entry is not marked as infra */ | 1294 | /* Return error if the adapter is not STA role or table entry |
1295 | if ((priv->bss_mode != NL80211_IFTYPE_STATION) || | 1295 | * is not marked as infra. |
1296 | */ | ||
1297 | if ((GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) || | ||
1296 | (bss_desc->bss_mode != NL80211_IFTYPE_STATION)) | 1298 | (bss_desc->bss_mode != NL80211_IFTYPE_STATION)) |
1297 | return -1; | 1299 | return -1; |
1298 | 1300 | ||
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c index e15ab72fb03d..1753431de361 100644 --- a/drivers/net/wireless/mwifiex/main.c +++ b/drivers/net/wireless/mwifiex/main.c | |||
@@ -427,6 +427,10 @@ static void mwifiex_fw_dpc(const struct firmware *firmware, void *context) | |||
427 | "Cal data request_firmware() failed\n"); | 427 | "Cal data request_firmware() failed\n"); |
428 | } | 428 | } |
429 | 429 | ||
430 | /* enable host interrupt after fw dnld is successful */ | ||
431 | if (adapter->if_ops.enable_int) | ||
432 | adapter->if_ops.enable_int(adapter); | ||
433 | |||
430 | adapter->init_wait_q_woken = false; | 434 | adapter->init_wait_q_woken = false; |
431 | ret = mwifiex_init_fw(adapter); | 435 | ret = mwifiex_init_fw(adapter); |
432 | if (ret == -1) { | 436 | if (ret == -1) { |
@@ -478,6 +482,8 @@ err_add_intf: | |||
478 | mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); | 482 | mwifiex_del_virtual_intf(adapter->wiphy, priv->wdev); |
479 | rtnl_unlock(); | 483 | rtnl_unlock(); |
480 | err_init_fw: | 484 | err_init_fw: |
485 | if (adapter->if_ops.disable_int) | ||
486 | adapter->if_ops.disable_int(adapter); | ||
481 | pr_debug("info: %s: unregister device\n", __func__); | 487 | pr_debug("info: %s: unregister device\n", __func__); |
482 | adapter->if_ops.unregister_dev(adapter); | 488 | adapter->if_ops.unregister_dev(adapter); |
483 | done: | 489 | done: |
@@ -855,7 +861,7 @@ mwifiex_add_card(void *card, struct semaphore *sem, | |||
855 | INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); | 861 | INIT_WORK(&adapter->main_work, mwifiex_main_work_queue); |
856 | 862 | ||
857 | /* Register the device. Fill up the private data structure with relevant | 863 | /* Register the device. Fill up the private data structure with relevant |
858 | information from the card and request for the required IRQ. */ | 864 | information from the card. */ |
859 | if (adapter->if_ops.register_dev(adapter)) { | 865 | if (adapter->if_ops.register_dev(adapter)) { |
860 | pr_err("%s: failed to register mwifiex device\n", __func__); | 866 | pr_err("%s: failed to register mwifiex device\n", __func__); |
861 | goto err_registerdev; | 867 | goto err_registerdev; |
@@ -919,6 +925,11 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) | |||
919 | if (!adapter) | 925 | if (!adapter) |
920 | goto exit_remove; | 926 | goto exit_remove; |
921 | 927 | ||
928 | /* We can no longer handle interrupts once we start doing the teardown | ||
929 | * below. */ | ||
930 | if (adapter->if_ops.disable_int) | ||
931 | adapter->if_ops.disable_int(adapter); | ||
932 | |||
922 | adapter->surprise_removed = true; | 933 | adapter->surprise_removed = true; |
923 | 934 | ||
924 | /* Stop data */ | 935 | /* Stop data */ |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 3da73d36acdf..253e0bd38e25 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -601,6 +601,7 @@ struct mwifiex_if_ops { | |||
601 | int (*register_dev) (struct mwifiex_adapter *); | 601 | int (*register_dev) (struct mwifiex_adapter *); |
602 | void (*unregister_dev) (struct mwifiex_adapter *); | 602 | void (*unregister_dev) (struct mwifiex_adapter *); |
603 | int (*enable_int) (struct mwifiex_adapter *); | 603 | int (*enable_int) (struct mwifiex_adapter *); |
604 | void (*disable_int) (struct mwifiex_adapter *); | ||
604 | int (*process_int_status) (struct mwifiex_adapter *); | 605 | int (*process_int_status) (struct mwifiex_adapter *); |
605 | int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *, | 606 | int (*host_to_card) (struct mwifiex_adapter *, u8, struct sk_buff *, |
606 | struct mwifiex_tx_param *); | 607 | struct mwifiex_tx_param *); |
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index 5ee5ed02eccd..09185c963248 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c | |||
@@ -51,6 +51,7 @@ static struct mwifiex_if_ops sdio_ops; | |||
51 | static struct semaphore add_remove_card_sem; | 51 | static struct semaphore add_remove_card_sem; |
52 | 52 | ||
53 | static int mwifiex_sdio_resume(struct device *dev); | 53 | static int mwifiex_sdio_resume(struct device *dev); |
54 | static void mwifiex_sdio_interrupt(struct sdio_func *func); | ||
54 | 55 | ||
55 | /* | 56 | /* |
56 | * SDIO probe. | 57 | * SDIO probe. |
@@ -296,6 +297,15 @@ static struct sdio_driver mwifiex_sdio = { | |||
296 | } | 297 | } |
297 | }; | 298 | }; |
298 | 299 | ||
300 | /* Write data into SDIO card register. Caller claims SDIO device. */ | ||
301 | static int | ||
302 | mwifiex_write_reg_locked(struct sdio_func *func, u32 reg, u8 data) | ||
303 | { | ||
304 | int ret = -1; | ||
305 | sdio_writeb(func, data, reg, &ret); | ||
306 | return ret; | ||
307 | } | ||
308 | |||
299 | /* | 309 | /* |
300 | * This function writes data into SDIO card register. | 310 | * This function writes data into SDIO card register. |
301 | */ | 311 | */ |
@@ -303,10 +313,10 @@ static int | |||
303 | mwifiex_write_reg(struct mwifiex_adapter *adapter, u32 reg, u8 data) | 313 | mwifiex_write_reg(struct mwifiex_adapter *adapter, u32 reg, u8 data) |
304 | { | 314 | { |
305 | struct sdio_mmc_card *card = adapter->card; | 315 | struct sdio_mmc_card *card = adapter->card; |
306 | int ret = -1; | 316 | int ret; |
307 | 317 | ||
308 | sdio_claim_host(card->func); | 318 | sdio_claim_host(card->func); |
309 | sdio_writeb(card->func, data, reg, &ret); | 319 | ret = mwifiex_write_reg_locked(card->func, reg, data); |
310 | sdio_release_host(card->func); | 320 | sdio_release_host(card->func); |
311 | 321 | ||
312 | return ret; | 322 | return ret; |
@@ -685,23 +695,15 @@ mwifiex_sdio_read_fw_status(struct mwifiex_adapter *adapter, u16 *dat) | |||
685 | * The host interrupt mask is read, the disable bit is reset and | 695 | * The host interrupt mask is read, the disable bit is reset and |
686 | * written back to the card host interrupt mask register. | 696 | * written back to the card host interrupt mask register. |
687 | */ | 697 | */ |
688 | static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) | 698 | static void mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) |
689 | { | 699 | { |
690 | u8 host_int_mask, host_int_disable = HOST_INT_DISABLE; | 700 | struct sdio_mmc_card *card = adapter->card; |
691 | 701 | struct sdio_func *func = card->func; | |
692 | /* Read back the host_int_mask register */ | ||
693 | if (mwifiex_read_reg(adapter, HOST_INT_MASK_REG, &host_int_mask)) | ||
694 | return -1; | ||
695 | |||
696 | /* Update with the mask and write back to the register */ | ||
697 | host_int_mask &= ~host_int_disable; | ||
698 | |||
699 | if (mwifiex_write_reg(adapter, HOST_INT_MASK_REG, host_int_mask)) { | ||
700 | dev_err(adapter->dev, "disable host interrupt failed\n"); | ||
701 | return -1; | ||
702 | } | ||
703 | 702 | ||
704 | return 0; | 703 | sdio_claim_host(func); |
704 | mwifiex_write_reg_locked(func, HOST_INT_MASK_REG, 0); | ||
705 | sdio_release_irq(func); | ||
706 | sdio_release_host(func); | ||
705 | } | 707 | } |
706 | 708 | ||
707 | /* | 709 | /* |
@@ -713,14 +715,29 @@ static int mwifiex_sdio_disable_host_int(struct mwifiex_adapter *adapter) | |||
713 | static int mwifiex_sdio_enable_host_int(struct mwifiex_adapter *adapter) | 715 | static int mwifiex_sdio_enable_host_int(struct mwifiex_adapter *adapter) |
714 | { | 716 | { |
715 | struct sdio_mmc_card *card = adapter->card; | 717 | struct sdio_mmc_card *card = adapter->card; |
718 | struct sdio_func *func = card->func; | ||
719 | int ret; | ||
720 | |||
721 | sdio_claim_host(func); | ||
722 | |||
723 | /* Request the SDIO IRQ */ | ||
724 | ret = sdio_claim_irq(func, mwifiex_sdio_interrupt); | ||
725 | if (ret) { | ||
726 | dev_err(adapter->dev, "claim irq failed: ret=%d\n", ret); | ||
727 | goto out; | ||
728 | } | ||
716 | 729 | ||
717 | /* Simply write the mask to the register */ | 730 | /* Simply write the mask to the register */ |
718 | if (mwifiex_write_reg(adapter, HOST_INT_MASK_REG, | 731 | ret = mwifiex_write_reg_locked(func, HOST_INT_MASK_REG, |
719 | card->reg->host_int_enable)) { | 732 | card->reg->host_int_enable); |
733 | if (ret) { | ||
720 | dev_err(adapter->dev, "enable host interrupt failed\n"); | 734 | dev_err(adapter->dev, "enable host interrupt failed\n"); |
721 | return -1; | 735 | sdio_release_irq(func); |
722 | } | 736 | } |
723 | return 0; | 737 | |
738 | out: | ||
739 | sdio_release_host(func); | ||
740 | return ret; | ||
724 | } | 741 | } |
725 | 742 | ||
726 | /* | 743 | /* |
@@ -997,9 +1014,6 @@ mwifiex_sdio_interrupt(struct sdio_func *func) | |||
997 | } | 1014 | } |
998 | adapter = card->adapter; | 1015 | adapter = card->adapter; |
999 | 1016 | ||
1000 | if (adapter->surprise_removed) | ||
1001 | return; | ||
1002 | |||
1003 | if (!adapter->pps_uapsd_mode && adapter->ps_state == PS_STATE_SLEEP) | 1017 | if (!adapter->pps_uapsd_mode && adapter->ps_state == PS_STATE_SLEEP) |
1004 | adapter->ps_state = PS_STATE_AWAKE; | 1018 | adapter->ps_state = PS_STATE_AWAKE; |
1005 | 1019 | ||
@@ -1625,8 +1639,8 @@ static int mwifiex_sdio_host_to_card(struct mwifiex_adapter *adapter, | |||
1625 | /* Allocate buffer and copy payload */ | 1639 | /* Allocate buffer and copy payload */ |
1626 | blk_size = MWIFIEX_SDIO_BLOCK_SIZE; | 1640 | blk_size = MWIFIEX_SDIO_BLOCK_SIZE; |
1627 | buf_block_len = (pkt_len + blk_size - 1) / blk_size; | 1641 | buf_block_len = (pkt_len + blk_size - 1) / blk_size; |
1628 | *(u16 *) &payload[0] = (u16) pkt_len; | 1642 | *(__le16 *)&payload[0] = cpu_to_le16((u16)pkt_len); |
1629 | *(u16 *) &payload[2] = type; | 1643 | *(__le16 *)&payload[2] = cpu_to_le16(type); |
1630 | 1644 | ||
1631 | /* | 1645 | /* |
1632 | * This is SDIO specific header | 1646 | * This is SDIO specific header |
@@ -1728,9 +1742,7 @@ mwifiex_unregister_dev(struct mwifiex_adapter *adapter) | |||
1728 | struct sdio_mmc_card *card = adapter->card; | 1742 | struct sdio_mmc_card *card = adapter->card; |
1729 | 1743 | ||
1730 | if (adapter->card) { | 1744 | if (adapter->card) { |
1731 | /* Release the SDIO IRQ */ | ||
1732 | sdio_claim_host(card->func); | 1745 | sdio_claim_host(card->func); |
1733 | sdio_release_irq(card->func); | ||
1734 | sdio_disable_func(card->func); | 1746 | sdio_disable_func(card->func); |
1735 | sdio_release_host(card->func); | 1747 | sdio_release_host(card->func); |
1736 | sdio_set_drvdata(card->func, NULL); | 1748 | sdio_set_drvdata(card->func, NULL); |
@@ -1744,7 +1756,7 @@ mwifiex_unregister_dev(struct mwifiex_adapter *adapter) | |||
1744 | */ | 1756 | */ |
1745 | static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | 1757 | static int mwifiex_register_dev(struct mwifiex_adapter *adapter) |
1746 | { | 1758 | { |
1747 | int ret = 0; | 1759 | int ret; |
1748 | struct sdio_mmc_card *card = adapter->card; | 1760 | struct sdio_mmc_card *card = adapter->card; |
1749 | struct sdio_func *func = card->func; | 1761 | struct sdio_func *func = card->func; |
1750 | 1762 | ||
@@ -1753,22 +1765,14 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | |||
1753 | 1765 | ||
1754 | sdio_claim_host(func); | 1766 | sdio_claim_host(func); |
1755 | 1767 | ||
1756 | /* Request the SDIO IRQ */ | ||
1757 | ret = sdio_claim_irq(func, mwifiex_sdio_interrupt); | ||
1758 | if (ret) { | ||
1759 | pr_err("claim irq failed: ret=%d\n", ret); | ||
1760 | goto disable_func; | ||
1761 | } | ||
1762 | |||
1763 | /* Set block size */ | 1768 | /* Set block size */ |
1764 | ret = sdio_set_block_size(card->func, MWIFIEX_SDIO_BLOCK_SIZE); | 1769 | ret = sdio_set_block_size(card->func, MWIFIEX_SDIO_BLOCK_SIZE); |
1770 | sdio_release_host(func); | ||
1765 | if (ret) { | 1771 | if (ret) { |
1766 | pr_err("cannot set SDIO block size\n"); | 1772 | pr_err("cannot set SDIO block size\n"); |
1767 | ret = -1; | 1773 | return ret; |
1768 | goto release_irq; | ||
1769 | } | 1774 | } |
1770 | 1775 | ||
1771 | sdio_release_host(func); | ||
1772 | sdio_set_drvdata(func, card); | 1776 | sdio_set_drvdata(func, card); |
1773 | 1777 | ||
1774 | adapter->dev = &func->dev; | 1778 | adapter->dev = &func->dev; |
@@ -1776,15 +1780,6 @@ static int mwifiex_register_dev(struct mwifiex_adapter *adapter) | |||
1776 | strcpy(adapter->fw_name, card->firmware); | 1780 | strcpy(adapter->fw_name, card->firmware); |
1777 | 1781 | ||
1778 | return 0; | 1782 | return 0; |
1779 | |||
1780 | release_irq: | ||
1781 | sdio_release_irq(func); | ||
1782 | disable_func: | ||
1783 | sdio_disable_func(func); | ||
1784 | sdio_release_host(func); | ||
1785 | adapter->card = NULL; | ||
1786 | |||
1787 | return -1; | ||
1788 | } | 1783 | } |
1789 | 1784 | ||
1790 | /* | 1785 | /* |
@@ -1813,9 +1808,6 @@ static int mwifiex_init_sdio(struct mwifiex_adapter *adapter) | |||
1813 | */ | 1808 | */ |
1814 | mwifiex_read_reg(adapter, HOST_INTSTATUS_REG, &sdio_ireg); | 1809 | mwifiex_read_reg(adapter, HOST_INTSTATUS_REG, &sdio_ireg); |
1815 | 1810 | ||
1816 | /* Disable host interrupt mask register for SDIO */ | ||
1817 | mwifiex_sdio_disable_host_int(adapter); | ||
1818 | |||
1819 | /* Get SDIO ioport */ | 1811 | /* Get SDIO ioport */ |
1820 | mwifiex_init_sdio_ioport(adapter); | 1812 | mwifiex_init_sdio_ioport(adapter); |
1821 | 1813 | ||
@@ -1957,6 +1949,7 @@ static struct mwifiex_if_ops sdio_ops = { | |||
1957 | .register_dev = mwifiex_register_dev, | 1949 | .register_dev = mwifiex_register_dev, |
1958 | .unregister_dev = mwifiex_unregister_dev, | 1950 | .unregister_dev = mwifiex_unregister_dev, |
1959 | .enable_int = mwifiex_sdio_enable_host_int, | 1951 | .enable_int = mwifiex_sdio_enable_host_int, |
1952 | .disable_int = mwifiex_sdio_disable_host_int, | ||
1960 | .process_int_status = mwifiex_process_int_status, | 1953 | .process_int_status = mwifiex_process_int_status, |
1961 | .host_to_card = mwifiex_sdio_host_to_card, | 1954 | .host_to_card = mwifiex_sdio_host_to_card, |
1962 | .wakeup = mwifiex_pm_wakeup_card, | 1955 | .wakeup = mwifiex_pm_wakeup_card, |
diff --git a/drivers/net/wireless/mwifiex/sdio.h b/drivers/net/wireless/mwifiex/sdio.h index 6d51dfdd8251..532ae0ac4dfb 100644 --- a/drivers/net/wireless/mwifiex/sdio.h +++ b/drivers/net/wireless/mwifiex/sdio.h | |||
@@ -92,9 +92,6 @@ | |||
92 | /* Host Control Registers : Download host interrupt mask */ | 92 | /* Host Control Registers : Download host interrupt mask */ |
93 | #define DN_LD_HOST_INT_MASK (0x2U) | 93 | #define DN_LD_HOST_INT_MASK (0x2U) |
94 | 94 | ||
95 | /* Disable Host interrupt mask */ | ||
96 | #define HOST_INT_DISABLE 0xff | ||
97 | |||
98 | /* Host Control Registers : Host interrupt status */ | 95 | /* Host Control Registers : Host interrupt status */ |
99 | #define HOST_INTSTATUS_REG 0x03 | 96 | #define HOST_INTSTATUS_REG 0x03 |
100 | /* Host Control Registers : Upload host interrupt status */ | 97 | /* Host Control Registers : Upload host interrupt status */ |
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 206c3e038072..8af97abf7108 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -257,10 +257,10 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss, | |||
257 | goto done; | 257 | goto done; |
258 | } | 258 | } |
259 | 259 | ||
260 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 260 | if (priv->bss_mode == NL80211_IFTYPE_STATION || |
261 | priv->bss_mode == NL80211_IFTYPE_P2P_CLIENT) { | ||
261 | u8 config_bands; | 262 | u8 config_bands; |
262 | 263 | ||
263 | /* Infra mode */ | ||
264 | ret = mwifiex_deauthenticate(priv, NULL); | 264 | ret = mwifiex_deauthenticate(priv, NULL); |
265 | if (ret) | 265 | if (ret) |
266 | goto done; | 266 | goto done; |
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index 9b915d3a44be..3e60a31582f8 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | menuconfig RT2X00 | 1 | menuconfig RT2X00 |
2 | tristate "Ralink driver support" | 2 | tristate "Ralink driver support" |
3 | depends on MAC80211 | 3 | depends on MAC80211 && HAS_DMA |
4 | ---help--- | 4 | ---help--- |
5 | This will enable the support for the Ralink drivers, | 5 | This will enable the support for the Ralink drivers, |
6 | developed in the rt2x00 project <http://rt2x00.serialmonkey.com>. | 6 | developed in the rt2x00 project <http://rt2x00.serialmonkey.com>. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 6c0a91ff963c..aa95c6cf3545 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -936,13 +936,8 @@ void rt2x00queue_index_inc(struct queue_entry *entry, enum queue_index index) | |||
936 | spin_unlock_irqrestore(&queue->index_lock, irqflags); | 936 | spin_unlock_irqrestore(&queue->index_lock, irqflags); |
937 | } | 937 | } |
938 | 938 | ||
939 | void rt2x00queue_pause_queue(struct data_queue *queue) | 939 | void rt2x00queue_pause_queue_nocheck(struct data_queue *queue) |
940 | { | 940 | { |
941 | if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || | ||
942 | !test_bit(QUEUE_STARTED, &queue->flags) || | ||
943 | test_and_set_bit(QUEUE_PAUSED, &queue->flags)) | ||
944 | return; | ||
945 | |||
946 | switch (queue->qid) { | 941 | switch (queue->qid) { |
947 | case QID_AC_VO: | 942 | case QID_AC_VO: |
948 | case QID_AC_VI: | 943 | case QID_AC_VI: |
@@ -958,6 +953,15 @@ void rt2x00queue_pause_queue(struct data_queue *queue) | |||
958 | break; | 953 | break; |
959 | } | 954 | } |
960 | } | 955 | } |
956 | void rt2x00queue_pause_queue(struct data_queue *queue) | ||
957 | { | ||
958 | if (!test_bit(DEVICE_STATE_PRESENT, &queue->rt2x00dev->flags) || | ||
959 | !test_bit(QUEUE_STARTED, &queue->flags) || | ||
960 | test_and_set_bit(QUEUE_PAUSED, &queue->flags)) | ||
961 | return; | ||
962 | |||
963 | rt2x00queue_pause_queue_nocheck(queue); | ||
964 | } | ||
961 | EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue); | 965 | EXPORT_SYMBOL_GPL(rt2x00queue_pause_queue); |
962 | 966 | ||
963 | void rt2x00queue_unpause_queue(struct data_queue *queue) | 967 | void rt2x00queue_unpause_queue(struct data_queue *queue) |
@@ -1019,7 +1023,7 @@ void rt2x00queue_stop_queue(struct data_queue *queue) | |||
1019 | return; | 1023 | return; |
1020 | } | 1024 | } |
1021 | 1025 | ||
1022 | rt2x00queue_pause_queue(queue); | 1026 | rt2x00queue_pause_queue_nocheck(queue); |
1023 | 1027 | ||
1024 | queue->rt2x00dev->ops->lib->stop_queue(queue); | 1028 | queue->rt2x00dev->ops->lib->stop_queue(queue); |
1025 | 1029 | ||
diff --git a/drivers/net/wireless/rtlwifi/Kconfig b/drivers/net/wireless/rtlwifi/Kconfig index 7253de3d8c66..c2ffce7a907c 100644 --- a/drivers/net/wireless/rtlwifi/Kconfig +++ b/drivers/net/wireless/rtlwifi/Kconfig | |||
@@ -1,27 +1,20 @@ | |||
1 | config RTLWIFI | 1 | menuconfig RTL_CARDS |
2 | tristate "Realtek wireless card support" | 2 | tristate "Realtek rtlwifi family of devices" |
3 | depends on MAC80211 | 3 | depends on MAC80211 && (PCI || USB) |
4 | select FW_LOADER | ||
5 | ---help--- | ||
6 | This is common code for RTL8192CE/RTL8192CU/RTL8192SE/RTL8723AE | ||
7 | drivers. This module does nothing by itself - the various front-end | ||
8 | drivers need to be enabled to support any desired devices. | ||
9 | |||
10 | If you choose to build as a module, it'll be called rtlwifi. | ||
11 | |||
12 | config RTLWIFI_DEBUG | ||
13 | bool "Debugging output for rtlwifi driver family" | ||
14 | depends on RTLWIFI | ||
15 | default y | 4 | default y |
16 | ---help--- | 5 | ---help--- |
17 | To use the module option that sets the dynamic-debugging level for, | 6 | This option will enable support for the Realtek mac80211-based |
18 | the front-end driver, this parameter must be "Y". For memory-limited | 7 | wireless drivers. Drivers rtl8192ce, rtl8192cu, rtl8192se, rtl8192de, |
19 | systems, choose "N". If in doubt, choose "Y". | 8 | rtl8723eu, and rtl8188eu share some common code. |
9 | |||
10 | if RTL_CARDS | ||
20 | 11 | ||
21 | config RTL8192CE | 12 | config RTL8192CE |
22 | tristate "Realtek RTL8192CE/RTL8188CE Wireless Network Adapter" | 13 | tristate "Realtek RTL8192CE/RTL8188CE Wireless Network Adapter" |
23 | depends on RTLWIFI && PCI | 14 | depends on PCI |
24 | select RTL8192C_COMMON | 15 | select RTL8192C_COMMON |
16 | select RTLWIFI | ||
17 | select RTLWIFI_PCI | ||
25 | ---help--- | 18 | ---help--- |
26 | This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe | 19 | This is the driver for Realtek RTL8192CE/RTL8188CE 802.11n PCIe |
27 | wireless network adapters. | 20 | wireless network adapters. |
@@ -30,7 +23,9 @@ config RTL8192CE | |||
30 | 23 | ||
31 | config RTL8192SE | 24 | config RTL8192SE |
32 | tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter" | 25 | tristate "Realtek RTL8192SE/RTL8191SE PCIe Wireless Network Adapter" |
33 | depends on RTLWIFI && PCI | 26 | depends on PCI |
27 | select RTLWIFI | ||
28 | select RTLWIFI_PCI | ||
34 | ---help--- | 29 | ---help--- |
35 | This is the driver for Realtek RTL8192SE/RTL8191SE 802.11n PCIe | 30 | This is the driver for Realtek RTL8192SE/RTL8191SE 802.11n PCIe |
36 | wireless network adapters. | 31 | wireless network adapters. |
@@ -39,7 +34,9 @@ config RTL8192SE | |||
39 | 34 | ||
40 | config RTL8192DE | 35 | config RTL8192DE |
41 | tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter" | 36 | tristate "Realtek RTL8192DE/RTL8188DE PCIe Wireless Network Adapter" |
42 | depends on RTLWIFI && PCI | 37 | depends on PCI |
38 | select RTLWIFI | ||
39 | select RTLWIFI_PCI | ||
43 | ---help--- | 40 | ---help--- |
44 | This is the driver for Realtek RTL8192DE/RTL8188DE 802.11n PCIe | 41 | This is the driver for Realtek RTL8192DE/RTL8188DE 802.11n PCIe |
45 | wireless network adapters. | 42 | wireless network adapters. |
@@ -48,7 +45,9 @@ config RTL8192DE | |||
48 | 45 | ||
49 | config RTL8723AE | 46 | config RTL8723AE |
50 | tristate "Realtek RTL8723AE PCIe Wireless Network Adapter" | 47 | tristate "Realtek RTL8723AE PCIe Wireless Network Adapter" |
51 | depends on RTLWIFI && PCI | 48 | depends on PCI |
49 | select RTLWIFI | ||
50 | select RTLWIFI_PCI | ||
52 | ---help--- | 51 | ---help--- |
53 | This is the driver for Realtek RTL8723AE 802.11n PCIe | 52 | This is the driver for Realtek RTL8723AE 802.11n PCIe |
54 | wireless network adapters. | 53 | wireless network adapters. |
@@ -57,7 +56,9 @@ config RTL8723AE | |||
57 | 56 | ||
58 | config RTL8188EE | 57 | config RTL8188EE |
59 | tristate "Realtek RTL8188EE Wireless Network Adapter" | 58 | tristate "Realtek RTL8188EE Wireless Network Adapter" |
60 | depends on RTLWIFI && PCI | 59 | depends on PCI |
60 | select RTLWIFI | ||
61 | select RTLWIFI_PCI | ||
61 | ---help--- | 62 | ---help--- |
62 | This is the driver for Realtek RTL8188EE 802.11n PCIe | 63 | This is the driver for Realtek RTL8188EE 802.11n PCIe |
63 | wireless network adapters. | 64 | wireless network adapters. |
@@ -66,7 +67,9 @@ config RTL8188EE | |||
66 | 67 | ||
67 | config RTL8192CU | 68 | config RTL8192CU |
68 | tristate "Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter" | 69 | tristate "Realtek RTL8192CU/RTL8188CU USB Wireless Network Adapter" |
69 | depends on RTLWIFI && USB | 70 | depends on USB |
71 | select RTLWIFI | ||
72 | select RTLWIFI_USB | ||
70 | select RTL8192C_COMMON | 73 | select RTL8192C_COMMON |
71 | ---help--- | 74 | ---help--- |
72 | This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB | 75 | This is the driver for Realtek RTL8192CU/RTL8188CU 802.11n USB |
@@ -74,7 +77,28 @@ config RTL8192CU | |||
74 | 77 | ||
75 | If you choose to build it as a module, it will be called rtl8192cu | 78 | If you choose to build it as a module, it will be called rtl8192cu |
76 | 79 | ||
80 | config RTLWIFI | ||
81 | tristate | ||
82 | select FW_LOADER | ||
83 | |||
84 | config RTLWIFI_PCI | ||
85 | tristate | ||
86 | |||
87 | config RTLWIFI_USB | ||
88 | tristate | ||
89 | |||
90 | config RTLWIFI_DEBUG | ||
91 | bool "Debugging output for rtlwifi driver family" | ||
92 | depends on RTLWIFI | ||
93 | default y | ||
94 | ---help--- | ||
95 | To use the module option that sets the dynamic-debugging level for, | ||
96 | the front-end driver, this parameter must be "Y". For memory-limited | ||
97 | systems, choose "N". If in doubt, choose "Y". | ||
98 | |||
77 | config RTL8192C_COMMON | 99 | config RTL8192C_COMMON |
78 | tristate | 100 | tristate |
79 | depends on RTL8192CE || RTL8192CU | 101 | depends on RTL8192CE || RTL8192CU |
80 | default m | 102 | default y |
103 | |||
104 | endif | ||
diff --git a/drivers/net/wireless/rtlwifi/Makefile b/drivers/net/wireless/rtlwifi/Makefile index ff02b874f8d8..d56f023a4b90 100644 --- a/drivers/net/wireless/rtlwifi/Makefile +++ b/drivers/net/wireless/rtlwifi/Makefile | |||
@@ -12,13 +12,11 @@ rtlwifi-objs := \ | |||
12 | 12 | ||
13 | rtl8192c_common-objs += \ | 13 | rtl8192c_common-objs += \ |
14 | 14 | ||
15 | ifneq ($(CONFIG_PCI),) | 15 | obj-$(CONFIG_RTLWIFI_PCI) += rtl_pci.o |
16 | rtlwifi-objs += pci.o | 16 | rtl_pci-objs := pci.o |
17 | endif | ||
18 | 17 | ||
19 | ifneq ($(CONFIG_USB),) | 18 | obj-$(CONFIG_RTLWIFI_USB) += rtl_usb.o |
20 | rtlwifi-objs += usb.o | 19 | rtl_usb-objs := usb.o |
21 | endif | ||
22 | 20 | ||
23 | obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c/ | 21 | obj-$(CONFIG_RTL8192C_COMMON) += rtl8192c/ |
24 | obj-$(CONFIG_RTL8192CE) += rtl8192ce/ | 22 | obj-$(CONFIG_RTL8192CE) += rtl8192ce/ |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 9d558ac77b0c..7651f5acc14b 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -172,6 +172,7 @@ u8 rtl_tid_to_ac(u8 tid) | |||
172 | { | 172 | { |
173 | return tid_to_ac[tid]; | 173 | return tid_to_ac[tid]; |
174 | } | 174 | } |
175 | EXPORT_SYMBOL_GPL(rtl_tid_to_ac); | ||
175 | 176 | ||
176 | static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw, | 177 | static void _rtl_init_hw_ht_capab(struct ieee80211_hw *hw, |
177 | struct ieee80211_sta_ht_cap *ht_cap) | 178 | struct ieee80211_sta_ht_cap *ht_cap) |
@@ -406,6 +407,7 @@ void rtl_deinit_deferred_work(struct ieee80211_hw *hw) | |||
406 | cancel_delayed_work(&rtlpriv->works.ps_rfon_wq); | 407 | cancel_delayed_work(&rtlpriv->works.ps_rfon_wq); |
407 | cancel_delayed_work(&rtlpriv->works.fwevt_wq); | 408 | cancel_delayed_work(&rtlpriv->works.fwevt_wq); |
408 | } | 409 | } |
410 | EXPORT_SYMBOL_GPL(rtl_deinit_deferred_work); | ||
409 | 411 | ||
410 | void rtl_init_rfkill(struct ieee80211_hw *hw) | 412 | void rtl_init_rfkill(struct ieee80211_hw *hw) |
411 | { | 413 | { |
@@ -439,6 +441,7 @@ void rtl_deinit_rfkill(struct ieee80211_hw *hw) | |||
439 | { | 441 | { |
440 | wiphy_rfkill_stop_polling(hw->wiphy); | 442 | wiphy_rfkill_stop_polling(hw->wiphy); |
441 | } | 443 | } |
444 | EXPORT_SYMBOL_GPL(rtl_deinit_rfkill); | ||
442 | 445 | ||
443 | int rtl_init_core(struct ieee80211_hw *hw) | 446 | int rtl_init_core(struct ieee80211_hw *hw) |
444 | { | 447 | { |
@@ -489,10 +492,12 @@ int rtl_init_core(struct ieee80211_hw *hw) | |||
489 | 492 | ||
490 | return 0; | 493 | return 0; |
491 | } | 494 | } |
495 | EXPORT_SYMBOL_GPL(rtl_init_core); | ||
492 | 496 | ||
493 | void rtl_deinit_core(struct ieee80211_hw *hw) | 497 | void rtl_deinit_core(struct ieee80211_hw *hw) |
494 | { | 498 | { |
495 | } | 499 | } |
500 | EXPORT_SYMBOL_GPL(rtl_deinit_core); | ||
496 | 501 | ||
497 | void rtl_init_rx_config(struct ieee80211_hw *hw) | 502 | void rtl_init_rx_config(struct ieee80211_hw *hw) |
498 | { | 503 | { |
@@ -501,6 +506,7 @@ void rtl_init_rx_config(struct ieee80211_hw *hw) | |||
501 | 506 | ||
502 | rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *) (&mac->rx_conf)); | 507 | rtlpriv->cfg->ops->get_hw_reg(hw, HW_VAR_RCR, (u8 *) (&mac->rx_conf)); |
503 | } | 508 | } |
509 | EXPORT_SYMBOL_GPL(rtl_init_rx_config); | ||
504 | 510 | ||
505 | /********************************************************* | 511 | /********************************************************* |
506 | * | 512 | * |
@@ -879,6 +885,7 @@ bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
879 | 885 | ||
880 | return true; | 886 | return true; |
881 | } | 887 | } |
888 | EXPORT_SYMBOL_GPL(rtl_tx_mgmt_proc); | ||
882 | 889 | ||
883 | void rtl_get_tcb_desc(struct ieee80211_hw *hw, | 890 | void rtl_get_tcb_desc(struct ieee80211_hw *hw, |
884 | struct ieee80211_tx_info *info, | 891 | struct ieee80211_tx_info *info, |
@@ -1052,6 +1059,7 @@ bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
1052 | 1059 | ||
1053 | return true; | 1060 | return true; |
1054 | } | 1061 | } |
1062 | EXPORT_SYMBOL_GPL(rtl_action_proc); | ||
1055 | 1063 | ||
1056 | /*should call before software enc*/ | 1064 | /*should call before software enc*/ |
1057 | u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | 1065 | u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) |
@@ -1125,6 +1133,7 @@ u8 rtl_is_special_data(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx) | |||
1125 | 1133 | ||
1126 | return false; | 1134 | return false; |
1127 | } | 1135 | } |
1136 | EXPORT_SYMBOL_GPL(rtl_is_special_data); | ||
1128 | 1137 | ||
1129 | /********************************************************* | 1138 | /********************************************************* |
1130 | * | 1139 | * |
@@ -1300,6 +1309,7 @@ void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1300 | 1309 | ||
1301 | rtlpriv->link_info.bcn_rx_inperiod++; | 1310 | rtlpriv->link_info.bcn_rx_inperiod++; |
1302 | } | 1311 | } |
1312 | EXPORT_SYMBOL_GPL(rtl_beacon_statistic); | ||
1303 | 1313 | ||
1304 | void rtl_watchdog_wq_callback(void *data) | 1314 | void rtl_watchdog_wq_callback(void *data) |
1305 | { | 1315 | { |
@@ -1793,6 +1803,7 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len) | |||
1793 | 1803 | ||
1794 | mac->vendor = vendor; | 1804 | mac->vendor = vendor; |
1795 | } | 1805 | } |
1806 | EXPORT_SYMBOL_GPL(rtl_recognize_peer); | ||
1796 | 1807 | ||
1797 | /********************************************************* | 1808 | /********************************************************* |
1798 | * | 1809 | * |
@@ -1849,6 +1860,7 @@ struct attribute_group rtl_attribute_group = { | |||
1849 | .name = "rtlsysfs", | 1860 | .name = "rtlsysfs", |
1850 | .attrs = rtl_sysfs_entries, | 1861 | .attrs = rtl_sysfs_entries, |
1851 | }; | 1862 | }; |
1863 | EXPORT_SYMBOL_GPL(rtl_attribute_group); | ||
1852 | 1864 | ||
1853 | MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); | 1865 | MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); |
1854 | MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); | 1866 | MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); |
@@ -1856,7 +1868,8 @@ MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); | |||
1856 | MODULE_LICENSE("GPL"); | 1868 | MODULE_LICENSE("GPL"); |
1857 | MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core"); | 1869 | MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core"); |
1858 | 1870 | ||
1859 | struct rtl_global_var global_var = {}; | 1871 | struct rtl_global_var rtl_global_var = {}; |
1872 | EXPORT_SYMBOL_GPL(rtl_global_var); | ||
1860 | 1873 | ||
1861 | static int __init rtl_core_module_init(void) | 1874 | static int __init rtl_core_module_init(void) |
1862 | { | 1875 | { |
@@ -1864,8 +1877,8 @@ static int __init rtl_core_module_init(void) | |||
1864 | pr_err("Unable to register rtl_rc, use default RC !!\n"); | 1877 | pr_err("Unable to register rtl_rc, use default RC !!\n"); |
1865 | 1878 | ||
1866 | /* init some global vars */ | 1879 | /* init some global vars */ |
1867 | INIT_LIST_HEAD(&global_var.glb_priv_list); | 1880 | INIT_LIST_HEAD(&rtl_global_var.glb_priv_list); |
1868 | spin_lock_init(&global_var.glb_list_lock); | 1881 | spin_lock_init(&rtl_global_var.glb_list_lock); |
1869 | 1882 | ||
1870 | return 0; | 1883 | return 0; |
1871 | } | 1884 | } |
diff --git a/drivers/net/wireless/rtlwifi/base.h b/drivers/net/wireless/rtlwifi/base.h index 8576bc34b032..0e5fe0902daf 100644 --- a/drivers/net/wireless/rtlwifi/base.h +++ b/drivers/net/wireless/rtlwifi/base.h | |||
@@ -147,7 +147,7 @@ void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len); | |||
147 | u8 rtl_tid_to_ac(u8 tid); | 147 | u8 rtl_tid_to_ac(u8 tid); |
148 | extern struct attribute_group rtl_attribute_group; | 148 | extern struct attribute_group rtl_attribute_group; |
149 | void rtl_easy_concurrent_retrytimer_callback(unsigned long data); | 149 | void rtl_easy_concurrent_retrytimer_callback(unsigned long data); |
150 | extern struct rtl_global_var global_var; | 150 | extern struct rtl_global_var rtl_global_var; |
151 | int rtlwifi_rate_mapping(struct ieee80211_hw *hw, | 151 | int rtlwifi_rate_mapping(struct ieee80211_hw *hw, |
152 | bool isht, u8 desc_rate, bool first_ampdu); | 152 | bool isht, u8 desc_rate, bool first_ampdu); |
153 | bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); | 153 | bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index ee84844be008..733b7ce7f0e2 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
@@ -1330,3 +1330,4 @@ const struct ieee80211_ops rtl_ops = { | |||
1330 | .rfkill_poll = rtl_op_rfkill_poll, | 1330 | .rfkill_poll = rtl_op_rfkill_poll, |
1331 | .flush = rtl_op_flush, | 1331 | .flush = rtl_op_flush, |
1332 | }; | 1332 | }; |
1333 | EXPORT_SYMBOL_GPL(rtl_ops); | ||
diff --git a/drivers/net/wireless/rtlwifi/debug.c b/drivers/net/wireless/rtlwifi/debug.c index 7d52d3d7769f..76e2086e137e 100644 --- a/drivers/net/wireless/rtlwifi/debug.c +++ b/drivers/net/wireless/rtlwifi/debug.c | |||
@@ -51,3 +51,4 @@ void rtl_dbgp_flag_init(struct ieee80211_hw *hw) | |||
51 | 51 | ||
52 | /*Init Debug flag enable condition */ | 52 | /*Init Debug flag enable condition */ |
53 | } | 53 | } |
54 | EXPORT_SYMBOL_GPL(rtl_dbgp_flag_init); | ||
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c index 9e3894178e77..838a1ed3f194 100644 --- a/drivers/net/wireless/rtlwifi/efuse.c +++ b/drivers/net/wireless/rtlwifi/efuse.c | |||
@@ -229,6 +229,7 @@ void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf) | |||
229 | 229 | ||
230 | *pbuf = (u8) (value32 & 0xff); | 230 | *pbuf = (u8) (value32 & 0xff); |
231 | } | 231 | } |
232 | EXPORT_SYMBOL_GPL(read_efuse_byte); | ||
232 | 233 | ||
233 | void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) | 234 | void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf) |
234 | { | 235 | { |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index c97e9d327331..703f839af6ca 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -35,6 +35,13 @@ | |||
35 | #include "efuse.h" | 35 | #include "efuse.h" |
36 | #include <linux/export.h> | 36 | #include <linux/export.h> |
37 | #include <linux/kmemleak.h> | 37 | #include <linux/kmemleak.h> |
38 | #include <linux/module.h> | ||
39 | |||
40 | MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); | ||
41 | MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); | ||
42 | MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); | ||
43 | MODULE_LICENSE("GPL"); | ||
44 | MODULE_DESCRIPTION("PCI basic driver for rtlwifi"); | ||
38 | 45 | ||
39 | static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = { | 46 | static const u16 pcibridge_vendors[PCI_BRIDGE_VENDOR_MAX] = { |
40 | PCI_VENDOR_ID_INTEL, | 47 | PCI_VENDOR_ID_INTEL, |
@@ -1008,19 +1015,6 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
1008 | return; | 1015 | return; |
1009 | } | 1016 | } |
1010 | 1017 | ||
1011 | static void rtl_lps_change_work_callback(struct work_struct *work) | ||
1012 | { | ||
1013 | struct rtl_works *rtlworks = | ||
1014 | container_of(work, struct rtl_works, lps_change_work); | ||
1015 | struct ieee80211_hw *hw = rtlworks->hw; | ||
1016 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
1017 | |||
1018 | if (rtlpriv->enter_ps) | ||
1019 | rtl_lps_enter(hw); | ||
1020 | else | ||
1021 | rtl_lps_leave(hw); | ||
1022 | } | ||
1023 | |||
1024 | static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) | 1018 | static void _rtl_pci_init_trx_var(struct ieee80211_hw *hw) |
1025 | { | 1019 | { |
1026 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 1020 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
@@ -1899,7 +1893,7 @@ int rtl_pci_probe(struct pci_dev *pdev, | |||
1899 | rtlpriv->rtlhal.interface = INTF_PCI; | 1893 | rtlpriv->rtlhal.interface = INTF_PCI; |
1900 | rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); | 1894 | rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); |
1901 | rtlpriv->intf_ops = &rtl_pci_ops; | 1895 | rtlpriv->intf_ops = &rtl_pci_ops; |
1902 | rtlpriv->glb_var = &global_var; | 1896 | rtlpriv->glb_var = &rtl_global_var; |
1903 | 1897 | ||
1904 | /* | 1898 | /* |
1905 | *init dbgp flags before all | 1899 | *init dbgp flags before all |
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c index 884bceae38a9..298b615964e8 100644 --- a/drivers/net/wireless/rtlwifi/ps.c +++ b/drivers/net/wireless/rtlwifi/ps.c | |||
@@ -269,6 +269,7 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw) | |||
269 | 269 | ||
270 | spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags); | 270 | spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags); |
271 | } | 271 | } |
272 | EXPORT_SYMBOL_GPL(rtl_ips_nic_on); | ||
272 | 273 | ||
273 | /*for FW LPS*/ | 274 | /*for FW LPS*/ |
274 | 275 | ||
@@ -518,6 +519,7 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len) | |||
518 | "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed); | 519 | "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed); |
519 | } | 520 | } |
520 | } | 521 | } |
522 | EXPORT_SYMBOL_GPL(rtl_swlps_beacon); | ||
521 | 523 | ||
522 | void rtl_swlps_rf_awake(struct ieee80211_hw *hw) | 524 | void rtl_swlps_rf_awake(struct ieee80211_hw *hw) |
523 | { | 525 | { |
@@ -611,6 +613,19 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw) | |||
611 | MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40)); | 613 | MSECS(sleep_intv * mac->vif->bss_conf.beacon_int - 40)); |
612 | } | 614 | } |
613 | 615 | ||
616 | void rtl_lps_change_work_callback(struct work_struct *work) | ||
617 | { | ||
618 | struct rtl_works *rtlworks = | ||
619 | container_of(work, struct rtl_works, lps_change_work); | ||
620 | struct ieee80211_hw *hw = rtlworks->hw; | ||
621 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
622 | |||
623 | if (rtlpriv->enter_ps) | ||
624 | rtl_lps_enter(hw); | ||
625 | else | ||
626 | rtl_lps_leave(hw); | ||
627 | } | ||
628 | EXPORT_SYMBOL_GPL(rtl_lps_change_work_callback); | ||
614 | 629 | ||
615 | void rtl_swlps_wq_callback(void *data) | 630 | void rtl_swlps_wq_callback(void *data) |
616 | { | 631 | { |
@@ -922,3 +937,4 @@ void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len) | |||
922 | else | 937 | else |
923 | rtl_p2p_noa_ie(hw, data, len - FCS_LEN); | 938 | rtl_p2p_noa_ie(hw, data, len - FCS_LEN); |
924 | } | 939 | } |
940 | EXPORT_SYMBOL_GPL(rtl_p2p_info); | ||
diff --git a/drivers/net/wireless/rtlwifi/ps.h b/drivers/net/wireless/rtlwifi/ps.h index 4d682b753f50..88bd76ea88f7 100644 --- a/drivers/net/wireless/rtlwifi/ps.h +++ b/drivers/net/wireless/rtlwifi/ps.h | |||
@@ -49,5 +49,6 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw); | |||
49 | void rtl_swlps_rf_sleep(struct ieee80211_hw *hw); | 49 | void rtl_swlps_rf_sleep(struct ieee80211_hw *hw); |
50 | void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); | 50 | void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); |
51 | void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len); | 51 | void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len); |
52 | void rtl_lps_change_work_callback(struct work_struct *work); | ||
52 | 53 | ||
53 | #endif | 54 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index a3532e077871..e56778cac9bf 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -32,6 +32,13 @@ | |||
32 | #include "ps.h" | 32 | #include "ps.h" |
33 | #include "rtl8192c/fw_common.h" | 33 | #include "rtl8192c/fw_common.h" |
34 | #include <linux/export.h> | 34 | #include <linux/export.h> |
35 | #include <linux/module.h> | ||
36 | |||
37 | MODULE_AUTHOR("lizhaoming <chaoming_li@realsil.com.cn>"); | ||
38 | MODULE_AUTHOR("Realtek WlanFAE <wlanfae@realtek.com>"); | ||
39 | MODULE_AUTHOR("Larry Finger <Larry.FInger@lwfinger.net>"); | ||
40 | MODULE_LICENSE("GPL"); | ||
41 | MODULE_DESCRIPTION("USB basic driver for rtlwifi"); | ||
35 | 42 | ||
36 | #define REALTEK_USB_VENQT_READ 0xC0 | 43 | #define REALTEK_USB_VENQT_READ 0xC0 |
37 | #define REALTEK_USB_VENQT_WRITE 0x40 | 44 | #define REALTEK_USB_VENQT_WRITE 0x40 |
@@ -1070,6 +1077,8 @@ int rtl_usb_probe(struct usb_interface *intf, | |||
1070 | spin_lock_init(&rtlpriv->locks.usb_lock); | 1077 | spin_lock_init(&rtlpriv->locks.usb_lock); |
1071 | INIT_WORK(&rtlpriv->works.fill_h2c_cmd, | 1078 | INIT_WORK(&rtlpriv->works.fill_h2c_cmd, |
1072 | rtl_fill_h2c_cmd_work_callback); | 1079 | rtl_fill_h2c_cmd_work_callback); |
1080 | INIT_WORK(&rtlpriv->works.lps_change_work, | ||
1081 | rtl_lps_change_work_callback); | ||
1073 | 1082 | ||
1074 | rtlpriv->usb_data_index = 0; | 1083 | rtlpriv->usb_data_index = 0; |
1075 | init_completion(&rtlpriv->firmware_loading_complete); | 1084 | init_completion(&rtlpriv->firmware_loading_complete); |
diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index e79e006eb9ab..9ee04b4b68bf 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c | |||
@@ -811,18 +811,28 @@ int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) | |||
811 | return pcidev->irq; | 811 | return pcidev->irq; |
812 | } | 812 | } |
813 | 813 | ||
814 | static struct iosapic_info *first_isi = NULL; | 814 | static struct iosapic_info *iosapic_list; |
815 | 815 | ||
816 | #ifdef CONFIG_64BIT | 816 | #ifdef CONFIG_64BIT |
817 | int iosapic_serial_irq(int num) | 817 | int iosapic_serial_irq(struct parisc_device *dev) |
818 | { | 818 | { |
819 | struct iosapic_info *isi = first_isi; | 819 | struct iosapic_info *isi; |
820 | struct irt_entry *irte = NULL; /* only used if PAT PDC */ | 820 | struct irt_entry *irte; |
821 | struct vector_info *vi; | 821 | struct vector_info *vi; |
822 | int isi_line; /* line used by device */ | 822 | int cnt; |
823 | int intin; | ||
824 | |||
825 | intin = (dev->mod_info >> 24) & 15; | ||
823 | 826 | ||
824 | /* lookup IRT entry for isi/slot/pin set */ | 827 | /* lookup IRT entry for isi/slot/pin set */ |
825 | irte = &irt_cell[num]; | 828 | for (cnt = 0; cnt < irt_num_entry; cnt++) { |
829 | irte = &irt_cell[cnt]; | ||
830 | if (COMPARE_IRTE_ADDR(irte, dev->mod0) && | ||
831 | irte->dest_iosapic_intin == intin) | ||
832 | break; | ||
833 | } | ||
834 | if (cnt >= irt_num_entry) | ||
835 | return 0; /* no irq found, force polling */ | ||
826 | 836 | ||
827 | DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n", | 837 | DBG_IRT("iosapic_serial_irq(): irte %p %x %x %x %x %x %x %x %x\n", |
828 | irte, | 838 | irte, |
@@ -834,11 +844,17 @@ int iosapic_serial_irq(int num) | |||
834 | irte->src_seg_id, | 844 | irte->src_seg_id, |
835 | irte->dest_iosapic_intin, | 845 | irte->dest_iosapic_intin, |
836 | (u32) irte->dest_iosapic_addr); | 846 | (u32) irte->dest_iosapic_addr); |
837 | isi_line = irte->dest_iosapic_intin; | 847 | |
848 | /* search for iosapic */ | ||
849 | for (isi = iosapic_list; isi; isi = isi->isi_next) | ||
850 | if (isi->isi_hpa == dev->mod0) | ||
851 | break; | ||
852 | if (!isi) | ||
853 | return 0; /* no iosapic found, force polling */ | ||
838 | 854 | ||
839 | /* get vector info for this input line */ | 855 | /* get vector info for this input line */ |
840 | vi = isi->isi_vector + isi_line; | 856 | vi = isi->isi_vector + intin; |
841 | DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", isi_line, vi); | 857 | DBG_IRT("iosapic_serial_irq: line %d vi 0x%p\n", iosapic_intin, vi); |
842 | 858 | ||
843 | /* If this IRQ line has already been setup, skip it */ | 859 | /* If this IRQ line has already been setup, skip it */ |
844 | if (vi->irte) | 860 | if (vi->irte) |
@@ -941,8 +957,8 @@ void *iosapic_register(unsigned long hpa) | |||
941 | vip->irqline = (unsigned char) cnt; | 957 | vip->irqline = (unsigned char) cnt; |
942 | vip->iosapic = isi; | 958 | vip->iosapic = isi; |
943 | } | 959 | } |
944 | if (!first_isi) | 960 | isi->isi_next = iosapic_list; |
945 | first_isi = isi; | 961 | iosapic_list = isi; |
946 | return isi; | 962 | return isi; |
947 | } | 963 | } |
948 | 964 | ||
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 13a633b1612e..7bf3926aecc0 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -86,10 +86,6 @@ struct mvebu_sw_pci_bridge { | |||
86 | u16 secondary_status; | 86 | u16 secondary_status; |
87 | u16 membase; | 87 | u16 membase; |
88 | u16 memlimit; | 88 | u16 memlimit; |
89 | u16 prefmembase; | ||
90 | u16 prefmemlimit; | ||
91 | u32 prefbaseupper; | ||
92 | u32 preflimitupper; | ||
93 | u16 iobaseupper; | 89 | u16 iobaseupper; |
94 | u16 iolimitupper; | 90 | u16 iolimitupper; |
95 | u8 cappointer; | 91 | u8 cappointer; |
@@ -419,15 +415,7 @@ static int mvebu_sw_pci_bridge_read(struct mvebu_pcie_port *port, | |||
419 | break; | 415 | break; |
420 | 416 | ||
421 | case PCI_PREF_MEMORY_BASE: | 417 | case PCI_PREF_MEMORY_BASE: |
422 | *value = (bridge->prefmemlimit << 16 | bridge->prefmembase); | 418 | *value = 0; |
423 | break; | ||
424 | |||
425 | case PCI_PREF_BASE_UPPER32: | ||
426 | *value = bridge->prefbaseupper; | ||
427 | break; | ||
428 | |||
429 | case PCI_PREF_LIMIT_UPPER32: | ||
430 | *value = bridge->preflimitupper; | ||
431 | break; | 419 | break; |
432 | 420 | ||
433 | case PCI_IO_BASE_UPPER16: | 421 | case PCI_IO_BASE_UPPER16: |
@@ -501,19 +489,6 @@ static int mvebu_sw_pci_bridge_write(struct mvebu_pcie_port *port, | |||
501 | mvebu_pcie_handle_membase_change(port); | 489 | mvebu_pcie_handle_membase_change(port); |
502 | break; | 490 | break; |
503 | 491 | ||
504 | case PCI_PREF_MEMORY_BASE: | ||
505 | bridge->prefmembase = value & 0xffff; | ||
506 | bridge->prefmemlimit = value >> 16; | ||
507 | break; | ||
508 | |||
509 | case PCI_PREF_BASE_UPPER32: | ||
510 | bridge->prefbaseupper = value; | ||
511 | break; | ||
512 | |||
513 | case PCI_PREF_LIMIT_UPPER32: | ||
514 | bridge->preflimitupper = value; | ||
515 | break; | ||
516 | |||
517 | case PCI_IO_BASE_UPPER16: | 492 | case PCI_IO_BASE_UPPER16: |
518 | bridge->iobaseupper = value & 0xffff; | 493 | bridge->iobaseupper = value & 0xffff; |
519 | bridge->iolimitupper = value >> 16; | 494 | bridge->iolimitupper = value >> 16; |
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig index bb7ebb22db01..d85009de713d 100644 --- a/drivers/pci/hotplug/Kconfig +++ b/drivers/pci/hotplug/Kconfig | |||
@@ -3,16 +3,13 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig HOTPLUG_PCI | 5 | menuconfig HOTPLUG_PCI |
6 | tristate "Support for PCI Hotplug" | 6 | bool "Support for PCI Hotplug" |
7 | depends on PCI && SYSFS | 7 | depends on PCI && SYSFS |
8 | ---help--- | 8 | ---help--- |
9 | Say Y here if you have a motherboard with a PCI Hotplug controller. | 9 | Say Y here if you have a motherboard with a PCI Hotplug controller. |
10 | This allows you to add and remove PCI cards while the machine is | 10 | This allows you to add and remove PCI cards while the machine is |
11 | powered up and running. | 11 | powered up and running. |
12 | 12 | ||
13 | To compile this driver as a module, choose M here: the | ||
14 | module will be called pci_hotplug. | ||
15 | |||
16 | When in doubt, say N. | 13 | When in doubt, say N. |
17 | 14 | ||
18 | if HOTPLUG_PCI | 15 | if HOTPLUG_PCI |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index aac7a40e4a4a..0e0d0f7f63fd 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -92,7 +92,14 @@ int pciehp_unconfigure_device(struct slot *p_slot) | |||
92 | if (ret) | 92 | if (ret) |
93 | presence = 0; | 93 | presence = 0; |
94 | 94 | ||
95 | list_for_each_entry_safe(dev, temp, &parent->devices, bus_list) { | 95 | /* |
96 | * Stopping an SR-IOV PF device removes all the associated VFs, | ||
97 | * which will update the bus->devices list and confuse the | ||
98 | * iterator. Therefore, iterate in reverse so we remove the VFs | ||
99 | * first, then the PF. We do the same in pci_stop_bus_device(). | ||
100 | */ | ||
101 | list_for_each_entry_safe_reverse(dev, temp, &parent->devices, | ||
102 | bus_list) { | ||
96 | pci_dev_get(dev); | 103 | pci_dev_get(dev); |
97 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { | 104 | if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { |
98 | pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl); | 105 | pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index dbdc5f7e2b29..01e264fb50e0 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -317,13 +317,20 @@ void acpi_pci_remove_bus(struct pci_bus *bus) | |||
317 | /* ACPI bus type */ | 317 | /* ACPI bus type */ |
318 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) | 318 | static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) |
319 | { | 319 | { |
320 | struct pci_dev * pci_dev; | 320 | struct pci_dev *pci_dev = to_pci_dev(dev); |
321 | u64 addr; | 321 | bool is_bridge; |
322 | u64 addr; | ||
322 | 323 | ||
323 | pci_dev = to_pci_dev(dev); | 324 | /* |
325 | * pci_is_bridge() is not suitable here, because pci_dev->subordinate | ||
326 | * is set only after acpi_pci_find_device() has been called for the | ||
327 | * given device. | ||
328 | */ | ||
329 | is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE | ||
330 | || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; | ||
324 | /* Please ref to ACPI spec for the syntax of _ADR */ | 331 | /* Please ref to ACPI spec for the syntax of _ADR */ |
325 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); | 332 | addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); |
326 | *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); | 333 | *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge); |
327 | if (!*handle) | 334 | if (!*handle) |
328 | return -ENODEV; | 335 | return -ENODEV; |
329 | return 0; | 336 | return 0; |
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 569f82fc9e22..3b94cfcfa03b 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig | |||
@@ -14,15 +14,12 @@ config PCIEPORTBUS | |||
14 | # Include service Kconfig here | 14 | # Include service Kconfig here |
15 | # | 15 | # |
16 | config HOTPLUG_PCI_PCIE | 16 | config HOTPLUG_PCI_PCIE |
17 | tristate "PCI Express Hotplug driver" | 17 | bool "PCI Express Hotplug driver" |
18 | depends on HOTPLUG_PCI && PCIEPORTBUS | 18 | depends on HOTPLUG_PCI && PCIEPORTBUS |
19 | help | 19 | help |
20 | Say Y here if you have a motherboard that supports PCI Express Native | 20 | Say Y here if you have a motherboard that supports PCI Express Native |
21 | Hotplug | 21 | Hotplug |
22 | 22 | ||
23 | To compile this driver as a module, choose M here: the | ||
24 | module will be called pciehp. | ||
25 | |||
26 | When in doubt, say N. | 23 | When in doubt, say N. |
27 | 24 | ||
28 | source "drivers/pci/pcie/aer/Kconfig" | 25 | source "drivers/pci/pcie/aer/Kconfig" |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index d254e2379533..64a7de22d9af 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -300,6 +300,47 @@ static void assign_requested_resources_sorted(struct list_head *head, | |||
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | static unsigned long pci_fail_res_type_mask(struct list_head *fail_head) | ||
304 | { | ||
305 | struct pci_dev_resource *fail_res; | ||
306 | unsigned long mask = 0; | ||
307 | |||
308 | /* check failed type */ | ||
309 | list_for_each_entry(fail_res, fail_head, list) | ||
310 | mask |= fail_res->flags; | ||
311 | |||
312 | /* | ||
313 | * one pref failed resource will set IORESOURCE_MEM, | ||
314 | * as we can allocate pref in non-pref range. | ||
315 | * Will release all assigned non-pref sibling resources | ||
316 | * according to that bit. | ||
317 | */ | ||
318 | return mask & (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH); | ||
319 | } | ||
320 | |||
321 | static bool pci_need_to_release(unsigned long mask, struct resource *res) | ||
322 | { | ||
323 | if (res->flags & IORESOURCE_IO) | ||
324 | return !!(mask & IORESOURCE_IO); | ||
325 | |||
326 | /* check pref at first */ | ||
327 | if (res->flags & IORESOURCE_PREFETCH) { | ||
328 | if (mask & IORESOURCE_PREFETCH) | ||
329 | return true; | ||
330 | /* count pref if its parent is non-pref */ | ||
331 | else if ((mask & IORESOURCE_MEM) && | ||
332 | !(res->parent->flags & IORESOURCE_PREFETCH)) | ||
333 | return true; | ||
334 | else | ||
335 | return false; | ||
336 | } | ||
337 | |||
338 | if (res->flags & IORESOURCE_MEM) | ||
339 | return !!(mask & IORESOURCE_MEM); | ||
340 | |||
341 | return false; /* should not get here */ | ||
342 | } | ||
343 | |||
303 | static void __assign_resources_sorted(struct list_head *head, | 344 | static void __assign_resources_sorted(struct list_head *head, |
304 | struct list_head *realloc_head, | 345 | struct list_head *realloc_head, |
305 | struct list_head *fail_head) | 346 | struct list_head *fail_head) |
@@ -312,11 +353,24 @@ static void __assign_resources_sorted(struct list_head *head, | |||
312 | * if could do that, could get out early. | 353 | * if could do that, could get out early. |
313 | * if could not do that, we still try to assign requested at first, | 354 | * if could not do that, we still try to assign requested at first, |
314 | * then try to reassign add_size for some resources. | 355 | * then try to reassign add_size for some resources. |
356 | * | ||
357 | * Separate three resource type checking if we need to release | ||
358 | * assigned resource after requested + add_size try. | ||
359 | * 1. if there is io port assign fail, will release assigned | ||
360 | * io port. | ||
361 | * 2. if there is pref mmio assign fail, release assigned | ||
362 | * pref mmio. | ||
363 | * if assigned pref mmio's parent is non-pref mmio and there | ||
364 | * is non-pref mmio assign fail, will release that assigned | ||
365 | * pref mmio. | ||
366 | * 3. if there is non-pref mmio assign fail or pref mmio | ||
367 | * assigned fail, will release assigned non-pref mmio. | ||
315 | */ | 368 | */ |
316 | LIST_HEAD(save_head); | 369 | LIST_HEAD(save_head); |
317 | LIST_HEAD(local_fail_head); | 370 | LIST_HEAD(local_fail_head); |
318 | struct pci_dev_resource *save_res; | 371 | struct pci_dev_resource *save_res; |
319 | struct pci_dev_resource *dev_res; | 372 | struct pci_dev_resource *dev_res, *tmp_res; |
373 | unsigned long fail_type; | ||
320 | 374 | ||
321 | /* Check if optional add_size is there */ | 375 | /* Check if optional add_size is there */ |
322 | if (!realloc_head || list_empty(realloc_head)) | 376 | if (!realloc_head || list_empty(realloc_head)) |
@@ -348,6 +402,19 @@ static void __assign_resources_sorted(struct list_head *head, | |||
348 | return; | 402 | return; |
349 | } | 403 | } |
350 | 404 | ||
405 | /* check failed type */ | ||
406 | fail_type = pci_fail_res_type_mask(&local_fail_head); | ||
407 | /* remove not need to be released assigned res from head list etc */ | ||
408 | list_for_each_entry_safe(dev_res, tmp_res, head, list) | ||
409 | if (dev_res->res->parent && | ||
410 | !pci_need_to_release(fail_type, dev_res->res)) { | ||
411 | /* remove it from realloc_head list */ | ||
412 | remove_from_list(realloc_head, dev_res->res); | ||
413 | remove_from_list(&save_head, dev_res->res); | ||
414 | list_del(&dev_res->list); | ||
415 | kfree(dev_res); | ||
416 | } | ||
417 | |||
351 | free_list(&local_fail_head); | 418 | free_list(&local_fail_head); |
352 | /* Release assigned resource */ | 419 | /* Release assigned resource */ |
353 | list_for_each_entry(dev_res, head, list) | 420 | list_for_each_entry(dev_res, head, list) |
diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c index f4f30af2df68..2e8a20cac588 100644 --- a/drivers/rapidio/rio.c +++ b/drivers/rapidio/rio.c | |||
@@ -1715,11 +1715,13 @@ int rio_unregister_scan(int mport_id, struct rio_scan *scan_ops) | |||
1715 | (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) | 1715 | (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops)) |
1716 | port->nscan = NULL; | 1716 | port->nscan = NULL; |
1717 | 1717 | ||
1718 | list_for_each_entry(scan, &rio_scans, node) | 1718 | list_for_each_entry(scan, &rio_scans, node) { |
1719 | if (scan->mport_id == mport_id) { | 1719 | if (scan->mport_id == mport_id) { |
1720 | list_del(&scan->node); | 1720 | list_del(&scan->node); |
1721 | kfree(scan); | 1721 | kfree(scan); |
1722 | break; | ||
1722 | } | 1723 | } |
1724 | } | ||
1723 | 1725 | ||
1724 | mutex_unlock(&rio_mport_list_lock); | 1726 | mutex_unlock(&rio_mport_list_lock); |
1725 | 1727 | ||
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 02faf3c4e0d5..c2e80d7ca5e2 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -524,6 +524,8 @@ static int twl_rtc_probe(struct platform_device *pdev) | |||
524 | if (ret < 0) | 524 | if (ret < 0) |
525 | goto out1; | 525 | goto out1; |
526 | 526 | ||
527 | device_init_wakeup(&pdev->dev, 1); | ||
528 | |||
527 | rtc = rtc_device_register(pdev->name, | 529 | rtc = rtc_device_register(pdev->name, |
528 | &pdev->dev, &twl_rtc_ops, THIS_MODULE); | 530 | &pdev->dev, &twl_rtc_ops, THIS_MODULE); |
529 | if (IS_ERR(rtc)) { | 531 | if (IS_ERR(rtc)) { |
@@ -542,7 +544,6 @@ static int twl_rtc_probe(struct platform_device *pdev) | |||
542 | } | 544 | } |
543 | 545 | ||
544 | platform_set_drvdata(pdev, rtc); | 546 | platform_set_drvdata(pdev, rtc); |
545 | device_init_wakeup(&pdev->dev, 1); | ||
546 | return 0; | 547 | return 0; |
547 | 548 | ||
548 | out2: | 549 | out2: |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 17150a778984..451bf99582ff 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2392,6 +2392,12 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr) | |||
2392 | rc = cqr->intrc; | 2392 | rc = cqr->intrc; |
2393 | else | 2393 | else |
2394 | rc = -EIO; | 2394 | rc = -EIO; |
2395 | |||
2396 | /* kick tasklets */ | ||
2397 | dasd_schedule_device_bh(device); | ||
2398 | if (device->block) | ||
2399 | dasd_schedule_block_bh(device->block); | ||
2400 | |||
2395 | return rc; | 2401 | return rc; |
2396 | } | 2402 | } |
2397 | 2403 | ||
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index b6d1f92ed33c..c18c68150e9f 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #define DRV_NAME "fnic" | 39 | #define DRV_NAME "fnic" |
40 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" | 40 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" |
41 | #define DRV_VERSION "1.5.0.22" | 41 | #define DRV_VERSION "1.5.0.23" |
42 | #define PFX DRV_NAME ": " | 42 | #define PFX DRV_NAME ": " |
43 | #define DFX DRV_NAME "%d: " | 43 | #define DFX DRV_NAME "%d: " |
44 | 44 | ||
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index 5f09d1814d26..42e15ee6e1bb 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c | |||
@@ -642,19 +642,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
642 | INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); | 642 | INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); |
643 | INIT_WORK(&fnic->event_work, fnic_handle_event); | 643 | INIT_WORK(&fnic->event_work, fnic_handle_event); |
644 | skb_queue_head_init(&fnic->fip_frame_queue); | 644 | skb_queue_head_init(&fnic->fip_frame_queue); |
645 | spin_lock_irqsave(&fnic_list_lock, flags); | ||
646 | if (!fnic_fip_queue) { | ||
647 | fnic_fip_queue = | ||
648 | create_singlethread_workqueue("fnic_fip_q"); | ||
649 | if (!fnic_fip_queue) { | ||
650 | spin_unlock_irqrestore(&fnic_list_lock, flags); | ||
651 | printk(KERN_ERR PFX "fnic FIP work queue " | ||
652 | "create failed\n"); | ||
653 | err = -ENOMEM; | ||
654 | goto err_out_free_max_pool; | ||
655 | } | ||
656 | } | ||
657 | spin_unlock_irqrestore(&fnic_list_lock, flags); | ||
658 | INIT_LIST_HEAD(&fnic->evlist); | 645 | INIT_LIST_HEAD(&fnic->evlist); |
659 | INIT_LIST_HEAD(&fnic->vlans); | 646 | INIT_LIST_HEAD(&fnic->vlans); |
660 | } else { | 647 | } else { |
@@ -960,6 +947,13 @@ static int __init fnic_init_module(void) | |||
960 | spin_lock_init(&fnic_list_lock); | 947 | spin_lock_init(&fnic_list_lock); |
961 | INIT_LIST_HEAD(&fnic_list); | 948 | INIT_LIST_HEAD(&fnic_list); |
962 | 949 | ||
950 | fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q"); | ||
951 | if (!fnic_fip_queue) { | ||
952 | printk(KERN_ERR PFX "fnic FIP work queue create failed\n"); | ||
953 | err = -ENOMEM; | ||
954 | goto err_create_fip_workq; | ||
955 | } | ||
956 | |||
963 | fnic_fc_transport = fc_attach_transport(&fnic_fc_functions); | 957 | fnic_fc_transport = fc_attach_transport(&fnic_fc_functions); |
964 | if (!fnic_fc_transport) { | 958 | if (!fnic_fc_transport) { |
965 | printk(KERN_ERR PFX "fc_attach_transport error\n"); | 959 | printk(KERN_ERR PFX "fc_attach_transport error\n"); |
@@ -978,6 +972,8 @@ static int __init fnic_init_module(void) | |||
978 | err_pci_register: | 972 | err_pci_register: |
979 | fc_release_transport(fnic_fc_transport); | 973 | fc_release_transport(fnic_fc_transport); |
980 | err_fc_transport: | 974 | err_fc_transport: |
975 | destroy_workqueue(fnic_fip_queue); | ||
976 | err_create_fip_workq: | ||
981 | destroy_workqueue(fnic_event_queue); | 977 | destroy_workqueue(fnic_event_queue); |
982 | err_create_fnic_workq: | 978 | err_create_fnic_workq: |
983 | kmem_cache_destroy(fnic_io_req_cache); | 979 | kmem_cache_destroy(fnic_io_req_cache); |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 0177295599e0..1f0ca68409d4 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -3547,11 +3547,21 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
3547 | break; | 3547 | break; |
3548 | } | 3548 | } |
3549 | 3549 | ||
3550 | /* | 3550 | if (megasas_transition_to_ready(instance, 0)) { |
3551 | * We expect the FW state to be READY | 3551 | atomic_set(&instance->fw_reset_no_pci_access, 1); |
3552 | */ | 3552 | instance->instancet->adp_reset |
3553 | if (megasas_transition_to_ready(instance, 0)) | 3553 | (instance, instance->reg_set); |
3554 | goto fail_ready_state; | 3554 | atomic_set(&instance->fw_reset_no_pci_access, 0); |
3555 | dev_info(&instance->pdev->dev, | ||
3556 | "megasas: FW restarted successfully from %s!\n", | ||
3557 | __func__); | ||
3558 | |||
3559 | /*waitting for about 30 second before retry*/ | ||
3560 | ssleep(30); | ||
3561 | |||
3562 | if (megasas_transition_to_ready(instance, 0)) | ||
3563 | goto fail_ready_state; | ||
3564 | } | ||
3555 | 3565 | ||
3556 | /* | 3566 | /* |
3557 | * MSI-X host index 0 is common for all adapter. | 3567 | * MSI-X host index 0 is common for all adapter. |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 3b1ea34e1f5a..eaa808e6ba91 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -1031,6 +1031,9 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf, | |||
1031 | { | 1031 | { |
1032 | int i, result; | 1032 | int i, result; |
1033 | 1033 | ||
1034 | if (sdev->skip_vpd_pages) | ||
1035 | goto fail; | ||
1036 | |||
1034 | /* Ask for all the pages supported by this device */ | 1037 | /* Ask for all the pages supported by this device */ |
1035 | result = scsi_vpd_inquiry(sdev, buf, 0, buf_len); | 1038 | result = scsi_vpd_inquiry(sdev, buf, 0, buf_len); |
1036 | if (result) | 1039 | if (result) |
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 2168258fb2c3..74b88efde6ad 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -751,7 +751,7 @@ static void __virtscsi_set_affinity(struct virtio_scsi *vscsi, bool affinity) | |||
751 | 751 | ||
752 | vscsi->affinity_hint_set = true; | 752 | vscsi->affinity_hint_set = true; |
753 | } else { | 753 | } else { |
754 | for (i = 0; i < vscsi->num_queues - VIRTIO_SCSI_VQ_BASE; i++) | 754 | for (i = 0; i < vscsi->num_queues; i++) |
755 | virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); | 755 | virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1); |
756 | 756 | ||
757 | vscsi->affinity_hint_set = false; | 757 | vscsi->affinity_hint_set = false; |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 222d3e37fc28..707966bd5610 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -609,7 +609,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
609 | else | 609 | else |
610 | buf = (void *)t->tx_buf; | 610 | buf = (void *)t->tx_buf; |
611 | t->tx_dma = dma_map_single(&spi->dev, buf, | 611 | t->tx_dma = dma_map_single(&spi->dev, buf, |
612 | t->len, DMA_FROM_DEVICE); | 612 | t->len, DMA_TO_DEVICE); |
613 | if (!t->tx_dma) { | 613 | if (!t->tx_dma) { |
614 | ret = -EFAULT; | 614 | ret = -EFAULT; |
615 | goto err_tx_map; | 615 | goto err_tx_map; |
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index dcceed29d31a..81972fa47beb 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c | |||
@@ -1811,10 +1811,12 @@ static int zcache_comp_init(void) | |||
1811 | #else | 1811 | #else |
1812 | if (*zcache_comp_name != '\0') { | 1812 | if (*zcache_comp_name != '\0') { |
1813 | ret = crypto_has_comp(zcache_comp_name, 0, 0); | 1813 | ret = crypto_has_comp(zcache_comp_name, 0, 0); |
1814 | if (!ret) | 1814 | if (!ret) { |
1815 | pr_info("zcache: %s not supported\n", | 1815 | pr_info("zcache: %s not supported\n", |
1816 | zcache_comp_name); | 1816 | zcache_comp_name); |
1817 | goto out; | 1817 | ret = 1; |
1818 | goto out; | ||
1819 | } | ||
1818 | } | 1820 | } |
1819 | if (!ret) | 1821 | if (!ret) |
1820 | strcpy(zcache_comp_name, "lzo"); | 1822 | strcpy(zcache_comp_name, "lzo"); |
diff --git a/drivers/tty/serial/8250/8250_gsc.c b/drivers/tty/serial/8250/8250_gsc.c index bb91b4713ebd..2e3ea1a70d7b 100644 --- a/drivers/tty/serial/8250/8250_gsc.c +++ b/drivers/tty/serial/8250/8250_gsc.c | |||
@@ -31,9 +31,8 @@ static int __init serial_init_chip(struct parisc_device *dev) | |||
31 | int err; | 31 | int err; |
32 | 32 | ||
33 | #ifdef CONFIG_64BIT | 33 | #ifdef CONFIG_64BIT |
34 | extern int iosapic_serial_irq(int cellnum); | ||
35 | if (!dev->irq && (dev->id.sversion == 0xad)) | 34 | if (!dev->irq && (dev->id.sversion == 0xad)) |
36 | dev->irq = iosapic_serial_irq(dev->mod_index-1); | 35 | dev->irq = iosapic_serial_irq(dev); |
37 | #endif | 36 | #endif |
38 | 37 | ||
39 | if (!dev->irq) { | 38 | if (!dev->irq) { |
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index cbf1d155b7b2..22f280aa4f2c 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c | |||
@@ -773,6 +773,6 @@ module_init(arc_serial_init); | |||
773 | module_exit(arc_serial_exit); | 773 | module_exit(arc_serial_exit); |
774 | 774 | ||
775 | MODULE_LICENSE("GPL"); | 775 | MODULE_LICENSE("GPL"); |
776 | MODULE_ALIAS("plat-arcfpga/uart"); | 776 | MODULE_ALIAS("platform:" DRIVER_NAME); |
777 | MODULE_AUTHOR("Vineet Gupta"); | 777 | MODULE_AUTHOR("Vineet Gupta"); |
778 | MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver"); | 778 | MODULE_DESCRIPTION("ARC(Synopsys) On-Chip(fpga) serial driver"); |
diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c index 4f5f161896a1..f85b8e6d0346 100644 --- a/drivers/tty/serial/mxs-auart.c +++ b/drivers/tty/serial/mxs-auart.c | |||
@@ -678,11 +678,18 @@ static void mxs_auart_settermios(struct uart_port *u, | |||
678 | 678 | ||
679 | static irqreturn_t mxs_auart_irq_handle(int irq, void *context) | 679 | static irqreturn_t mxs_auart_irq_handle(int irq, void *context) |
680 | { | 680 | { |
681 | u32 istatus, istat; | 681 | u32 istat; |
682 | struct mxs_auart_port *s = context; | 682 | struct mxs_auart_port *s = context; |
683 | u32 stat = readl(s->port.membase + AUART_STAT); | 683 | u32 stat = readl(s->port.membase + AUART_STAT); |
684 | 684 | ||
685 | istatus = istat = readl(s->port.membase + AUART_INTR); | 685 | istat = readl(s->port.membase + AUART_INTR); |
686 | |||
687 | /* ack irq */ | ||
688 | writel(istat & (AUART_INTR_RTIS | ||
689 | | AUART_INTR_TXIS | ||
690 | | AUART_INTR_RXIS | ||
691 | | AUART_INTR_CTSMIS), | ||
692 | s->port.membase + AUART_INTR_CLR); | ||
686 | 693 | ||
687 | if (istat & AUART_INTR_CTSMIS) { | 694 | if (istat & AUART_INTR_CTSMIS) { |
688 | uart_handle_cts_change(&s->port, stat & AUART_STAT_CTS); | 695 | uart_handle_cts_change(&s->port, stat & AUART_STAT_CTS); |
@@ -702,12 +709,6 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context) | |||
702 | istat &= ~AUART_INTR_TXIS; | 709 | istat &= ~AUART_INTR_TXIS; |
703 | } | 710 | } |
704 | 711 | ||
705 | writel(istatus & (AUART_INTR_RTIS | ||
706 | | AUART_INTR_TXIS | ||
707 | | AUART_INTR_RXIS | ||
708 | | AUART_INTR_CTSMIS), | ||
709 | s->port.membase + AUART_INTR_CLR); | ||
710 | |||
711 | return IRQ_HANDLED; | 712 | return IRQ_HANDLED; |
712 | } | 713 | } |
713 | 714 | ||
@@ -850,7 +851,7 @@ auart_console_write(struct console *co, const char *str, unsigned int count) | |||
850 | struct mxs_auart_port *s; | 851 | struct mxs_auart_port *s; |
851 | struct uart_port *port; | 852 | struct uart_port *port; |
852 | unsigned int old_ctrl0, old_ctrl2; | 853 | unsigned int old_ctrl0, old_ctrl2; |
853 | unsigned int to = 1000; | 854 | unsigned int to = 20000; |
854 | 855 | ||
855 | if (co->index >= MXS_AUART_PORTS || co->index < 0) | 856 | if (co->index >= MXS_AUART_PORTS || co->index < 0) |
856 | return; | 857 | return; |
@@ -871,18 +872,23 @@ auart_console_write(struct console *co, const char *str, unsigned int count) | |||
871 | 872 | ||
872 | uart_console_write(port, str, count, mxs_auart_console_putchar); | 873 | uart_console_write(port, str, count, mxs_auart_console_putchar); |
873 | 874 | ||
874 | /* | 875 | /* Finally, wait for transmitter to become empty ... */ |
875 | * Finally, wait for transmitter to become empty | ||
876 | * and restore the TCR | ||
877 | */ | ||
878 | while (readl(port->membase + AUART_STAT) & AUART_STAT_BUSY) { | 876 | while (readl(port->membase + AUART_STAT) & AUART_STAT_BUSY) { |
877 | udelay(1); | ||
879 | if (!to--) | 878 | if (!to--) |
880 | break; | 879 | break; |
881 | udelay(1); | ||
882 | } | 880 | } |
883 | 881 | ||
884 | writel(old_ctrl0, port->membase + AUART_CTRL0); | 882 | /* |
885 | writel(old_ctrl2, port->membase + AUART_CTRL2); | 883 | * ... and restore the TCR if we waited long enough for the transmitter |
884 | * to be idle. This might keep the transmitter enabled although it is | ||
885 | * unused, but that is better than to disable it while it is still | ||
886 | * transmitting. | ||
887 | */ | ||
888 | if (!(readl(port->membase + AUART_STAT) & AUART_STAT_BUSY)) { | ||
889 | writel(old_ctrl0, port->membase + AUART_CTRL0); | ||
890 | writel(old_ctrl2, port->membase + AUART_CTRL2); | ||
891 | } | ||
886 | 892 | ||
887 | clk_disable(s->clk); | 893 | clk_disable(s->clk); |
888 | } | 894 | } |
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 121aeb9393e1..f597e88a705d 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c | |||
@@ -256,10 +256,9 @@ void tty_port_tty_hangup(struct tty_port *port, bool check_clocal) | |||
256 | { | 256 | { |
257 | struct tty_struct *tty = tty_port_tty_get(port); | 257 | struct tty_struct *tty = tty_port_tty_get(port); |
258 | 258 | ||
259 | if (tty && (!check_clocal || !C_CLOCAL(tty))) { | 259 | if (tty && (!check_clocal || !C_CLOCAL(tty))) |
260 | tty_hangup(tty); | 260 | tty_hangup(tty); |
261 | tty_kref_put(tty); | 261 | tty_kref_put(tty); |
262 | } | ||
263 | } | 262 | } |
264 | EXPORT_SYMBOL_GPL(tty_port_tty_hangup); | 263 | EXPORT_SYMBOL_GPL(tty_port_tty_hangup); |
265 | 264 | ||
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig index eb2aa2e5a842..d1bd8ef1f9c1 100644 --- a/drivers/usb/chipidea/Kconfig +++ b/drivers/usb/chipidea/Kconfig | |||
@@ -12,7 +12,7 @@ if USB_CHIPIDEA | |||
12 | 12 | ||
13 | config USB_CHIPIDEA_UDC | 13 | config USB_CHIPIDEA_UDC |
14 | bool "ChipIdea device controller" | 14 | bool "ChipIdea device controller" |
15 | depends on USB_GADGET=y || USB_CHIPIDEA=m | 15 | depends on USB_GADGET=y || (USB_CHIPIDEA=m && USB_GADGET=m) |
16 | help | 16 | help |
17 | Say Y here to enable device controller functionality of the | 17 | Say Y here to enable device controller functionality of the |
18 | ChipIdea driver. | 18 | ChipIdea driver. |
@@ -20,7 +20,7 @@ config USB_CHIPIDEA_UDC | |||
20 | config USB_CHIPIDEA_HOST | 20 | config USB_CHIPIDEA_HOST |
21 | bool "ChipIdea host controller" | 21 | bool "ChipIdea host controller" |
22 | depends on USB=y | 22 | depends on USB=y |
23 | depends on USB_EHCI_HCD=y || USB_CHIPIDEA=m | 23 | depends on USB_EHCI_HCD=y || (USB_CHIPIDEA=m && USB_EHCI_HCD=m) |
24 | select USB_EHCI_ROOT_HUB_TT | 24 | select USB_EHCI_ROOT_HUB_TT |
25 | help | 25 | help |
26 | Say Y here to enable host controller functionality of the | 26 | Say Y here to enable host controller functionality of the |
diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index aefa0261220c..1b23e354f9fb 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h | |||
@@ -50,7 +50,7 @@ | |||
50 | #define PORTSC_PTC (0x0FUL << 16) | 50 | #define PORTSC_PTC (0x0FUL << 16) |
51 | /* PTS and PTW for non lpm version only */ | 51 | /* PTS and PTW for non lpm version only */ |
52 | #define PORTSC_PTS(d) \ | 52 | #define PORTSC_PTS(d) \ |
53 | ((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) | 53 | (u32)((((d) & 0x3) << 30) | (((d) & 0x4) ? BIT(25) : 0)) |
54 | #define PORTSC_PTW BIT(28) | 54 | #define PORTSC_PTW BIT(28) |
55 | #define PORTSC_STS BIT(29) | 55 | #define PORTSC_STS BIT(29) |
56 | 56 | ||
@@ -59,7 +59,7 @@ | |||
59 | #define DEVLC_PSPD_HS (0x02UL << 25) | 59 | #define DEVLC_PSPD_HS (0x02UL << 25) |
60 | #define DEVLC_PTW BIT(27) | 60 | #define DEVLC_PTW BIT(27) |
61 | #define DEVLC_STS BIT(28) | 61 | #define DEVLC_STS BIT(28) |
62 | #define DEVLC_PTS(d) (((d) & 0x7) << 29) | 62 | #define DEVLC_PTS(d) (u32)(((d) & 0x7) << 29) |
63 | 63 | ||
64 | /* Encoding for DEVLC_PTS and PORTSC_PTS */ | 64 | /* Encoding for DEVLC_PTS and PORTSC_PTS */ |
65 | #define PTS_UTMI 0 | 65 | #define PTS_UTMI 0 |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 4a8a1d68002c..558313de4911 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -4798,7 +4798,8 @@ static void hub_events(void) | |||
4798 | hub->ports[i - 1]->child; | 4798 | hub->ports[i - 1]->child; |
4799 | 4799 | ||
4800 | dev_dbg(hub_dev, "warm reset port %d\n", i); | 4800 | dev_dbg(hub_dev, "warm reset port %d\n", i); |
4801 | if (!udev) { | 4801 | if (!udev || !(portstatus & |
4802 | USB_PORT_STAT_CONNECTION)) { | ||
4802 | status = hub_port_reset(hub, i, | 4803 | status = hub_port_reset(hub, i, |
4803 | NULL, HUB_BH_RESET_TIME, | 4804 | NULL, HUB_BH_RESET_TIME, |
4804 | true); | 4805 | true); |
@@ -4808,8 +4809,8 @@ static void hub_events(void) | |||
4808 | usb_lock_device(udev); | 4809 | usb_lock_device(udev); |
4809 | status = usb_reset_device(udev); | 4810 | status = usb_reset_device(udev); |
4810 | usb_unlock_device(udev); | 4811 | usb_unlock_device(udev); |
4812 | connect_change = 0; | ||
4811 | } | 4813 | } |
4812 | connect_change = 0; | ||
4813 | } | 4814 | } |
4814 | 4815 | ||
4815 | if (connect_change) | 4816 | if (connect_change) |
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index f48712ffe261..c1c113ef950c 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -449,14 +449,20 @@ fail: | |||
449 | 449 | ||
450 | static int __exit eth_unbind(struct usb_composite_dev *cdev) | 450 | static int __exit eth_unbind(struct usb_composite_dev *cdev) |
451 | { | 451 | { |
452 | if (has_rndis()) | 452 | if (has_rndis()) { |
453 | usb_put_function(f_rndis); | ||
453 | usb_put_function_instance(fi_rndis); | 454 | usb_put_function_instance(fi_rndis); |
454 | if (use_eem) | 455 | } |
456 | if (use_eem) { | ||
457 | usb_put_function(f_eem); | ||
455 | usb_put_function_instance(fi_eem); | 458 | usb_put_function_instance(fi_eem); |
456 | else if (can_support_ecm(cdev->gadget)) | 459 | } else if (can_support_ecm(cdev->gadget)) { |
460 | usb_put_function(f_ecm); | ||
457 | usb_put_function_instance(fi_ecm); | 461 | usb_put_function_instance(fi_ecm); |
458 | else | 462 | } else { |
463 | usb_put_function(f_geth); | ||
459 | usb_put_function_instance(fi_geth); | 464 | usb_put_function_instance(fi_geth); |
465 | } | ||
460 | return 0; | 466 | return 0; |
461 | } | 467 | } |
462 | 468 | ||
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 1bf26e9f38cd..eb3aa817a662 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -488,7 +488,6 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) | |||
488 | struct usb_ep *ep; | 488 | struct usb_ep *ep; |
489 | int status, i; | 489 | int status, i; |
490 | 490 | ||
491 | #ifndef USBF_PHONET_INCLUDED | ||
492 | struct f_phonet_opts *phonet_opts; | 491 | struct f_phonet_opts *phonet_opts; |
493 | 492 | ||
494 | phonet_opts = container_of(f->fi, struct f_phonet_opts, func_inst); | 493 | phonet_opts = container_of(f->fi, struct f_phonet_opts, func_inst); |
@@ -507,7 +506,6 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) | |||
507 | return status; | 506 | return status; |
508 | phonet_opts->bound = true; | 507 | phonet_opts->bound = true; |
509 | } | 508 | } |
510 | #endif | ||
511 | 509 | ||
512 | /* Reserve interface IDs */ | 510 | /* Reserve interface IDs */ |
513 | status = usb_interface_id(c, f); | 511 | status = usb_interface_id(c, f); |
diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c index 032b96a51ce4..2a1ebefd8f9e 100644 --- a/drivers/usb/gadget/multi.c +++ b/drivers/usb/gadget/multi.c | |||
@@ -160,10 +160,8 @@ static __init int rndis_do_config(struct usb_configuration *c) | |||
160 | return ret; | 160 | return ret; |
161 | 161 | ||
162 | f_acm_rndis = usb_get_function(fi_acm); | 162 | f_acm_rndis = usb_get_function(fi_acm); |
163 | if (IS_ERR(f_acm_rndis)) { | 163 | if (IS_ERR(f_acm_rndis)) |
164 | ret = PTR_ERR(f_acm_rndis); | 164 | return PTR_ERR(f_acm_rndis); |
165 | goto err_func_acm; | ||
166 | } | ||
167 | 165 | ||
168 | ret = usb_add_function(c, f_acm_rndis); | 166 | ret = usb_add_function(c, f_acm_rndis); |
169 | if (ret) | 167 | if (ret) |
@@ -178,7 +176,6 @@ err_fsg: | |||
178 | usb_remove_function(c, f_acm_rndis); | 176 | usb_remove_function(c, f_acm_rndis); |
179 | err_conf: | 177 | err_conf: |
180 | usb_put_function(f_acm_rndis); | 178 | usb_put_function(f_acm_rndis); |
181 | err_func_acm: | ||
182 | return ret; | 179 | return ret; |
183 | } | 180 | } |
184 | 181 | ||
@@ -226,7 +223,7 @@ static __init int cdc_do_config(struct usb_configuration *c) | |||
226 | /* implicit port_num is zero */ | 223 | /* implicit port_num is zero */ |
227 | f_acm_multi = usb_get_function(fi_acm); | 224 | f_acm_multi = usb_get_function(fi_acm); |
228 | if (IS_ERR(f_acm_multi)) | 225 | if (IS_ERR(f_acm_multi)) |
229 | goto err_func_acm; | 226 | return PTR_ERR(f_acm_multi); |
230 | 227 | ||
231 | ret = usb_add_function(c, f_acm_multi); | 228 | ret = usb_add_function(c, f_acm_multi); |
232 | if (ret) | 229 | if (ret) |
@@ -241,7 +238,6 @@ err_fsg: | |||
241 | usb_remove_function(c, f_acm_multi); | 238 | usb_remove_function(c, f_acm_multi); |
242 | err_conf: | 239 | err_conf: |
243 | usb_put_function(f_acm_multi); | 240 | usb_put_function(f_acm_multi); |
244 | err_func_acm: | ||
245 | return ret; | 241 | return ret; |
246 | } | 242 | } |
247 | 243 | ||
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index c28ac9872030..13e25f80fc20 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -109,7 +109,7 @@ void usb_gadget_set_state(struct usb_gadget *gadget, | |||
109 | enum usb_device_state state) | 109 | enum usb_device_state state) |
110 | { | 110 | { |
111 | gadget->state = state; | 111 | gadget->state = state; |
112 | sysfs_notify(&gadget->dev.kobj, NULL, "status"); | 112 | sysfs_notify(&gadget->dev.kobj, NULL, "state"); |
113 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(usb_gadget_set_state); | 114 | EXPORT_SYMBOL_GPL(usb_gadget_set_state); |
115 | 115 | ||
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index df6978abd7e6..6f8c2fd47675 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/dmapool.h> | 26 | #include <linux/dmapool.h> |
27 | #include <linux/dma-mapping.h> | ||
27 | 28 | ||
28 | #include "xhci.h" | 29 | #include "xhci.h" |
29 | 30 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 41eb4fc33453..9478caa2f71f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/moduleparam.h> | 27 | #include <linux/moduleparam.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/dmi.h> | 29 | #include <linux/dmi.h> |
30 | #include <linux/dma-mapping.h> | ||
30 | 31 | ||
31 | #include "xhci.h" | 32 | #include "xhci.h" |
32 | 33 | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 6708a3b78ad8..f44e8b5e00c9 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -481,7 +481,7 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32); | |||
481 | 481 | ||
482 | static int omap2430_probe(struct platform_device *pdev) | 482 | static int omap2430_probe(struct platform_device *pdev) |
483 | { | 483 | { |
484 | struct resource musb_resources[2]; | 484 | struct resource musb_resources[3]; |
485 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; | 485 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; |
486 | struct omap_musb_board_data *data; | 486 | struct omap_musb_board_data *data; |
487 | struct platform_device *musb; | 487 | struct platform_device *musb; |
@@ -581,6 +581,11 @@ static int omap2430_probe(struct platform_device *pdev) | |||
581 | musb_resources[1].end = pdev->resource[1].end; | 581 | musb_resources[1].end = pdev->resource[1].end; |
582 | musb_resources[1].flags = pdev->resource[1].flags; | 582 | musb_resources[1].flags = pdev->resource[1].flags; |
583 | 583 | ||
584 | musb_resources[2].name = pdev->resource[2].name; | ||
585 | musb_resources[2].start = pdev->resource[2].start; | ||
586 | musb_resources[2].end = pdev->resource[2].end; | ||
587 | musb_resources[2].flags = pdev->resource[2].flags; | ||
588 | |||
584 | ret = platform_device_add_resources(musb, musb_resources, | 589 | ret = platform_device_add_resources(musb, musb_resources, |
585 | ARRAY_SIZE(musb_resources)); | 590 | ARRAY_SIZE(musb_resources)); |
586 | if (ret) { | 591 | if (ret) { |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 2c06a8969a9f..6f8a9ca96ae7 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -1156,7 +1156,7 @@ static u64 tusb_dmamask = DMA_BIT_MASK(32); | |||
1156 | 1156 | ||
1157 | static int tusb_probe(struct platform_device *pdev) | 1157 | static int tusb_probe(struct platform_device *pdev) |
1158 | { | 1158 | { |
1159 | struct resource musb_resources[2]; | 1159 | struct resource musb_resources[3]; |
1160 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; | 1160 | struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data; |
1161 | struct platform_device *musb; | 1161 | struct platform_device *musb; |
1162 | struct tusb6010_glue *glue; | 1162 | struct tusb6010_glue *glue; |
@@ -1199,6 +1199,11 @@ static int tusb_probe(struct platform_device *pdev) | |||
1199 | musb_resources[1].end = pdev->resource[1].end; | 1199 | musb_resources[1].end = pdev->resource[1].end; |
1200 | musb_resources[1].flags = pdev->resource[1].flags; | 1200 | musb_resources[1].flags = pdev->resource[1].flags; |
1201 | 1201 | ||
1202 | musb_resources[2].name = pdev->resource[2].name; | ||
1203 | musb_resources[2].start = pdev->resource[2].start; | ||
1204 | musb_resources[2].end = pdev->resource[2].end; | ||
1205 | musb_resources[2].flags = pdev->resource[2].flags; | ||
1206 | |||
1202 | ret = platform_device_add_resources(musb, musb_resources, | 1207 | ret = platform_device_add_resources(musb, musb_resources, |
1203 | ARRAY_SIZE(musb_resources)); | 1208 | ARRAY_SIZE(musb_resources)); |
1204 | if (ret) { | 1209 | if (ret) { |
diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 8c3a42ea910c..7eef9b33fde6 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig | |||
@@ -719,6 +719,13 @@ config USB_SERIAL_FLASHLOADER | |||
719 | To compile this driver as a module, choose M here: the | 719 | To compile this driver as a module, choose M here: the |
720 | module will be called flashloader. | 720 | module will be called flashloader. |
721 | 721 | ||
722 | config USB_SERIAL_SUUNTO | ||
723 | tristate "USB Suunto ANT+ driver" | ||
724 | help | ||
725 | Say Y here if you want to use the Suunto ANT+ USB device. | ||
726 | |||
727 | To compile this driver as a module, choose M here: the | ||
728 | module will be called suunto. | ||
722 | 729 | ||
723 | config USB_SERIAL_DEBUG | 730 | config USB_SERIAL_DEBUG |
724 | tristate "USB Debugging Device" | 731 | tristate "USB Debugging Device" |
diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index f7130114488f..a14a870d993f 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile | |||
@@ -54,6 +54,7 @@ obj-$(CONFIG_USB_SERIAL_SIEMENS_MPI) += siemens_mpi.o | |||
54 | obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o | 54 | obj-$(CONFIG_USB_SERIAL_SIERRAWIRELESS) += sierra.o |
55 | obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o | 55 | obj-$(CONFIG_USB_SERIAL_SPCP8X5) += spcp8x5.o |
56 | obj-$(CONFIG_USB_SERIAL_SSU100) += ssu100.o | 56 | obj-$(CONFIG_USB_SERIAL_SSU100) += ssu100.o |
57 | obj-$(CONFIG_USB_SERIAL_SUUNTO) += suunto.o | ||
57 | obj-$(CONFIG_USB_SERIAL_SYMBOL) += symbolserial.o | 58 | obj-$(CONFIG_USB_SERIAL_SYMBOL) += symbolserial.o |
58 | obj-$(CONFIG_USB_SERIAL_WWAN) += usb_wwan.o | 59 | obj-$(CONFIG_USB_SERIAL_WWAN) += usb_wwan.o |
59 | obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o | 60 | obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 7260ec660347..b65e657c641d 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -735,9 +735,34 @@ static struct usb_device_id id_table_combined [] = { | |||
735 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | 735 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), |
736 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 736 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
737 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 737 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
738 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, | 738 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, |
739 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, | 739 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, |
740 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) }, | 740 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, |
741 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57B_PID) }, | ||
742 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29A_PID) }, | ||
743 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29B_PID) }, | ||
744 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29F_PID) }, | ||
745 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62B_PID) }, | ||
746 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S01_PID) }, | ||
747 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63_PID) }, | ||
748 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_29C_PID) }, | ||
749 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_81B_PID) }, | ||
750 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_82B_PID) }, | ||
751 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5D_PID) }, | ||
752 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K4Y_PID) }, | ||
753 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_K5G_PID) }, | ||
754 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S05_PID) }, | ||
755 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_60_PID) }, | ||
756 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_61_PID) }, | ||
757 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_62_PID) }, | ||
758 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_63B_PID) }, | ||
759 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_64_PID) }, | ||
760 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_65_PID) }, | ||
761 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92_PID) }, | ||
762 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_92D_PID) }, | ||
763 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_W5R_PID) }, | ||
764 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_A5R_PID) }, | ||
765 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_PW1_PID) }, | ||
741 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 766 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
742 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 767 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
743 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 768 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 6dd79253205d..1b8af461b522 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -815,11 +815,35 @@ | |||
815 | /* | 815 | /* |
816 | * RT Systems programming cables for various ham radios | 816 | * RT Systems programming cables for various ham radios |
817 | */ | 817 | */ |
818 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | 818 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
819 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ | 819 | #define RTSYSTEMS_USB_S03_PID 0x9001 /* RTS-03 USB to Serial Adapter */ |
820 | #define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */ | 820 | #define RTSYSTEMS_USB_59_PID 0x9e50 /* USB-59 USB to 8 pin plug */ |
821 | #define RTSYSTEMS_RTS01_PID 0x9e57 /* USB-RTS01 Radio Cable */ | 821 | #define RTSYSTEMS_USB_57A_PID 0x9e51 /* USB-57A USB to 4pin 3.5mm plug */ |
822 | 822 | #define RTSYSTEMS_USB_57B_PID 0x9e52 /* USB-57B USB to extended 4pin 3.5mm plug */ | |
823 | #define RTSYSTEMS_USB_29A_PID 0x9e53 /* USB-29A USB to 3.5mm stereo plug */ | ||
824 | #define RTSYSTEMS_USB_29B_PID 0x9e54 /* USB-29B USB to 6 pin mini din */ | ||
825 | #define RTSYSTEMS_USB_29F_PID 0x9e55 /* USB-29F USB to 6 pin modular plug */ | ||
826 | #define RTSYSTEMS_USB_62B_PID 0x9e56 /* USB-62B USB to 8 pin mini din plug*/ | ||
827 | #define RTSYSTEMS_USB_S01_PID 0x9e57 /* USB-RTS01 USB to 3.5 mm stereo plug*/ | ||
828 | #define RTSYSTEMS_USB_63_PID 0x9e58 /* USB-63 USB to 9 pin female*/ | ||
829 | #define RTSYSTEMS_USB_29C_PID 0x9e59 /* USB-29C USB to 4 pin modular plug*/ | ||
830 | #define RTSYSTEMS_USB_81B_PID 0x9e5A /* USB-81 USB to 8 pin mini din plug*/ | ||
831 | #define RTSYSTEMS_USB_82B_PID 0x9e5B /* USB-82 USB to 2.5 mm stereo plug*/ | ||
832 | #define RTSYSTEMS_USB_K5D_PID 0x9e5C /* USB-K5D USB to 8 pin modular plug*/ | ||
833 | #define RTSYSTEMS_USB_K4Y_PID 0x9e5D /* USB-K4Y USB to 2.5/3.5 mm plugs*/ | ||
834 | #define RTSYSTEMS_USB_K5G_PID 0x9e5E /* USB-K5G USB to 8 pin modular plug*/ | ||
835 | #define RTSYSTEMS_USB_S05_PID 0x9e5F /* USB-RTS05 USB to 2.5 mm stereo plug*/ | ||
836 | #define RTSYSTEMS_USB_60_PID 0x9e60 /* USB-60 USB to 6 pin din*/ | ||
837 | #define RTSYSTEMS_USB_61_PID 0x9e61 /* USB-61 USB to 6 pin mini din*/ | ||
838 | #define RTSYSTEMS_USB_62_PID 0x9e62 /* USB-62 USB to 8 pin mini din*/ | ||
839 | #define RTSYSTEMS_USB_63B_PID 0x9e63 /* USB-63 USB to 9 pin female*/ | ||
840 | #define RTSYSTEMS_USB_64_PID 0x9e64 /* USB-64 USB to 9 pin male*/ | ||
841 | #define RTSYSTEMS_USB_65_PID 0x9e65 /* USB-65 USB to 9 pin female null modem*/ | ||
842 | #define RTSYSTEMS_USB_92_PID 0x9e66 /* USB-92 USB to 12 pin plug*/ | ||
843 | #define RTSYSTEMS_USB_92D_PID 0x9e67 /* USB-92D USB to 12 pin plug data*/ | ||
844 | #define RTSYSTEMS_USB_W5R_PID 0x9e68 /* USB-W5R USB to 8 pin modular plug*/ | ||
845 | #define RTSYSTEMS_USB_A5R_PID 0x9e69 /* USB-A5R USB to 8 pin modular plug*/ | ||
846 | #define RTSYSTEMS_USB_PW1_PID 0x9e6A /* USB-PW1 USB to 8 pin modular plug*/ | ||
823 | 847 | ||
824 | /* | 848 | /* |
825 | * Physik Instrumente | 849 | * Physik Instrumente |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 603fb70dde80..d953d674f222 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -183,7 +183,10 @@ | |||
183 | #define LED_ON_MS 500 | 183 | #define LED_ON_MS 500 |
184 | #define LED_OFF_MS 500 | 184 | #define LED_OFF_MS 500 |
185 | 185 | ||
186 | static int device_type; | 186 | enum mos7840_flag { |
187 | MOS7840_FLAG_CTRL_BUSY, | ||
188 | MOS7840_FLAG_LED_BUSY, | ||
189 | }; | ||
187 | 190 | ||
188 | static const struct usb_device_id id_table[] = { | 191 | static const struct usb_device_id id_table[] = { |
189 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, | 192 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, |
@@ -238,9 +241,12 @@ struct moschip_port { | |||
238 | 241 | ||
239 | /* For device(s) with LED indicator */ | 242 | /* For device(s) with LED indicator */ |
240 | bool has_led; | 243 | bool has_led; |
241 | bool led_flag; | ||
242 | struct timer_list led_timer1; /* Timer for LED on */ | 244 | struct timer_list led_timer1; /* Timer for LED on */ |
243 | struct timer_list led_timer2; /* Timer for LED off */ | 245 | struct timer_list led_timer2; /* Timer for LED off */ |
246 | struct urb *led_urb; | ||
247 | struct usb_ctrlrequest *led_dr; | ||
248 | |||
249 | unsigned long flags; | ||
244 | }; | 250 | }; |
245 | 251 | ||
246 | /* | 252 | /* |
@@ -460,10 +466,10 @@ static void mos7840_control_callback(struct urb *urb) | |||
460 | case -ESHUTDOWN: | 466 | case -ESHUTDOWN: |
461 | /* this urb is terminated, clean up */ | 467 | /* this urb is terminated, clean up */ |
462 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); | 468 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); |
463 | return; | 469 | goto out; |
464 | default: | 470 | default: |
465 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); | 471 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); |
466 | return; | 472 | goto out; |
467 | } | 473 | } |
468 | 474 | ||
469 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); | 475 | dev_dbg(dev, "%s urb buffer size is %d\n", __func__, urb->actual_length); |
@@ -476,6 +482,8 @@ static void mos7840_control_callback(struct urb *urb) | |||
476 | mos7840_handle_new_msr(mos7840_port, regval); | 482 | mos7840_handle_new_msr(mos7840_port, regval); |
477 | else if (mos7840_port->MsrLsr == 1) | 483 | else if (mos7840_port->MsrLsr == 1) |
478 | mos7840_handle_new_lsr(mos7840_port, regval); | 484 | mos7840_handle_new_lsr(mos7840_port, regval); |
485 | out: | ||
486 | clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mos7840_port->flags); | ||
479 | } | 487 | } |
480 | 488 | ||
481 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | 489 | static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, |
@@ -486,6 +494,9 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | |||
486 | unsigned char *buffer = mcs->ctrl_buf; | 494 | unsigned char *buffer = mcs->ctrl_buf; |
487 | int ret; | 495 | int ret; |
488 | 496 | ||
497 | if (test_and_set_bit_lock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags)) | ||
498 | return -EBUSY; | ||
499 | |||
489 | dr->bRequestType = MCS_RD_RTYPE; | 500 | dr->bRequestType = MCS_RD_RTYPE; |
490 | dr->bRequest = MCS_RDREQ; | 501 | dr->bRequest = MCS_RDREQ; |
491 | dr->wValue = cpu_to_le16(Wval); /* 0 */ | 502 | dr->wValue = cpu_to_le16(Wval); /* 0 */ |
@@ -497,6 +508,9 @@ static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg, | |||
497 | mos7840_control_callback, mcs); | 508 | mos7840_control_callback, mcs); |
498 | mcs->control_urb->transfer_buffer_length = 2; | 509 | mcs->control_urb->transfer_buffer_length = 2; |
499 | ret = usb_submit_urb(mcs->control_urb, GFP_ATOMIC); | 510 | ret = usb_submit_urb(mcs->control_urb, GFP_ATOMIC); |
511 | if (ret) | ||
512 | clear_bit_unlock(MOS7840_FLAG_CTRL_BUSY, &mcs->flags); | ||
513 | |||
500 | return ret; | 514 | return ret; |
501 | } | 515 | } |
502 | 516 | ||
@@ -523,7 +537,7 @@ static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval, | |||
523 | __u16 reg) | 537 | __u16 reg) |
524 | { | 538 | { |
525 | struct usb_device *dev = mcs->port->serial->dev; | 539 | struct usb_device *dev = mcs->port->serial->dev; |
526 | struct usb_ctrlrequest *dr = mcs->dr; | 540 | struct usb_ctrlrequest *dr = mcs->led_dr; |
527 | 541 | ||
528 | dr->bRequestType = MCS_WR_RTYPE; | 542 | dr->bRequestType = MCS_WR_RTYPE; |
529 | dr->bRequest = MCS_WRREQ; | 543 | dr->bRequest = MCS_WRREQ; |
@@ -531,10 +545,10 @@ static void mos7840_set_led_async(struct moschip_port *mcs, __u16 wval, | |||
531 | dr->wIndex = cpu_to_le16(reg); | 545 | dr->wIndex = cpu_to_le16(reg); |
532 | dr->wLength = cpu_to_le16(0); | 546 | dr->wLength = cpu_to_le16(0); |
533 | 547 | ||
534 | usb_fill_control_urb(mcs->control_urb, dev, usb_sndctrlpipe(dev, 0), | 548 | usb_fill_control_urb(mcs->led_urb, dev, usb_sndctrlpipe(dev, 0), |
535 | (unsigned char *)dr, NULL, 0, mos7840_set_led_callback, NULL); | 549 | (unsigned char *)dr, NULL, 0, mos7840_set_led_callback, NULL); |
536 | 550 | ||
537 | usb_submit_urb(mcs->control_urb, GFP_ATOMIC); | 551 | usb_submit_urb(mcs->led_urb, GFP_ATOMIC); |
538 | } | 552 | } |
539 | 553 | ||
540 | static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg, | 554 | static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg, |
@@ -560,7 +574,19 @@ static void mos7840_led_flag_off(unsigned long arg) | |||
560 | { | 574 | { |
561 | struct moschip_port *mcs = (struct moschip_port *) arg; | 575 | struct moschip_port *mcs = (struct moschip_port *) arg; |
562 | 576 | ||
563 | mcs->led_flag = false; | 577 | clear_bit_unlock(MOS7840_FLAG_LED_BUSY, &mcs->flags); |
578 | } | ||
579 | |||
580 | static void mos7840_led_activity(struct usb_serial_port *port) | ||
581 | { | ||
582 | struct moschip_port *mos7840_port = usb_get_serial_port_data(port); | ||
583 | |||
584 | if (test_and_set_bit_lock(MOS7840_FLAG_LED_BUSY, &mos7840_port->flags)) | ||
585 | return; | ||
586 | |||
587 | mos7840_set_led_async(mos7840_port, 0x0301, MODEM_CONTROL_REGISTER); | ||
588 | mod_timer(&mos7840_port->led_timer1, | ||
589 | jiffies + msecs_to_jiffies(LED_ON_MS)); | ||
564 | } | 590 | } |
565 | 591 | ||
566 | /***************************************************************************** | 592 | /***************************************************************************** |
@@ -758,14 +784,8 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
758 | return; | 784 | return; |
759 | } | 785 | } |
760 | 786 | ||
761 | /* Turn on LED */ | 787 | if (mos7840_port->has_led) |
762 | if (mos7840_port->has_led && !mos7840_port->led_flag) { | 788 | mos7840_led_activity(port); |
763 | mos7840_port->led_flag = true; | ||
764 | mos7840_set_led_async(mos7840_port, 0x0301, | ||
765 | MODEM_CONTROL_REGISTER); | ||
766 | mod_timer(&mos7840_port->led_timer1, | ||
767 | jiffies + msecs_to_jiffies(LED_ON_MS)); | ||
768 | } | ||
769 | 789 | ||
770 | mos7840_port->read_urb_busy = true; | 790 | mos7840_port->read_urb_busy = true; |
771 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 791 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
@@ -816,18 +836,6 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) | |||
816 | /************************************************************************/ | 836 | /************************************************************************/ |
817 | /* D R I V E R T T Y I N T E R F A C E F U N C T I O N S */ | 837 | /* D R I V E R T T Y I N T E R F A C E F U N C T I O N S */ |
818 | /************************************************************************/ | 838 | /************************************************************************/ |
819 | #ifdef MCSSerialProbe | ||
820 | static int mos7840_serial_probe(struct usb_serial *serial, | ||
821 | const struct usb_device_id *id) | ||
822 | { | ||
823 | |||
824 | /*need to implement the mode_reg reading and updating\ | ||
825 | structures usb_serial_ device_type\ | ||
826 | (i.e num_ports, num_bulkin,bulkout etc) */ | ||
827 | /* Also we can update the changes attach */ | ||
828 | return 1; | ||
829 | } | ||
830 | #endif | ||
831 | 839 | ||
832 | /***************************************************************************** | 840 | /***************************************************************************** |
833 | * mos7840_open | 841 | * mos7840_open |
@@ -1454,13 +1462,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
1454 | data1 = urb->transfer_buffer; | 1462 | data1 = urb->transfer_buffer; |
1455 | dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress); | 1463 | dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress); |
1456 | 1464 | ||
1457 | /* Turn on LED */ | 1465 | if (mos7840_port->has_led) |
1458 | if (mos7840_port->has_led && !mos7840_port->led_flag) { | 1466 | mos7840_led_activity(port); |
1459 | mos7840_port->led_flag = true; | ||
1460 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0301); | ||
1461 | mod_timer(&mos7840_port->led_timer1, | ||
1462 | jiffies + msecs_to_jiffies(LED_ON_MS)); | ||
1463 | } | ||
1464 | 1467 | ||
1465 | /* send it down the pipe */ | 1468 | /* send it down the pipe */ |
1466 | status = usb_submit_urb(urb, GFP_ATOMIC); | 1469 | status = usb_submit_urb(urb, GFP_ATOMIC); |
@@ -2187,38 +2190,48 @@ static int mos7810_check(struct usb_serial *serial) | |||
2187 | return 0; | 2190 | return 0; |
2188 | } | 2191 | } |
2189 | 2192 | ||
2190 | static int mos7840_calc_num_ports(struct usb_serial *serial) | 2193 | static int mos7840_probe(struct usb_serial *serial, |
2194 | const struct usb_device_id *id) | ||
2191 | { | 2195 | { |
2192 | __u16 data = 0x00; | 2196 | u16 product = serial->dev->descriptor.idProduct; |
2193 | u8 *buf; | 2197 | u8 *buf; |
2194 | int mos7840_num_ports; | 2198 | int device_type; |
2199 | |||
2200 | if (product == MOSCHIP_DEVICE_ID_7810 || | ||
2201 | product == MOSCHIP_DEVICE_ID_7820) { | ||
2202 | device_type = product; | ||
2203 | goto out; | ||
2204 | } | ||
2195 | 2205 | ||
2196 | buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL); | 2206 | buf = kzalloc(VENDOR_READ_LENGTH, GFP_KERNEL); |
2197 | if (buf) { | 2207 | if (!buf) |
2198 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 2208 | return -ENOMEM; |
2209 | |||
2210 | usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | ||
2199 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, | 2211 | MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, |
2200 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); | 2212 | VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
2201 | data = *buf; | ||
2202 | kfree(buf); | ||
2203 | } | ||
2204 | 2213 | ||
2205 | if (serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7810 || | 2214 | /* For a MCS7840 device GPIO0 must be set to 1 */ |
2206 | serial->dev->descriptor.idProduct == MOSCHIP_DEVICE_ID_7820) { | 2215 | if (buf[0] & 0x01) |
2207 | device_type = serial->dev->descriptor.idProduct; | 2216 | device_type = MOSCHIP_DEVICE_ID_7840; |
2208 | } else { | 2217 | else if (mos7810_check(serial)) |
2209 | /* For a MCS7840 device GPIO0 must be set to 1 */ | 2218 | device_type = MOSCHIP_DEVICE_ID_7810; |
2210 | if ((data & 0x01) == 1) | 2219 | else |
2211 | device_type = MOSCHIP_DEVICE_ID_7840; | 2220 | device_type = MOSCHIP_DEVICE_ID_7820; |
2212 | else if (mos7810_check(serial)) | 2221 | |
2213 | device_type = MOSCHIP_DEVICE_ID_7810; | 2222 | kfree(buf); |
2214 | else | 2223 | out: |
2215 | device_type = MOSCHIP_DEVICE_ID_7820; | 2224 | usb_set_serial_data(serial, (void *)(unsigned long)device_type); |
2216 | } | 2225 | |
2226 | return 0; | ||
2227 | } | ||
2228 | |||
2229 | static int mos7840_calc_num_ports(struct usb_serial *serial) | ||
2230 | { | ||
2231 | int device_type = (unsigned long)usb_get_serial_data(serial); | ||
2232 | int mos7840_num_ports; | ||
2217 | 2233 | ||
2218 | mos7840_num_ports = (device_type >> 4) & 0x000F; | 2234 | mos7840_num_ports = (device_type >> 4) & 0x000F; |
2219 | serial->num_bulk_in = mos7840_num_ports; | ||
2220 | serial->num_bulk_out = mos7840_num_ports; | ||
2221 | serial->num_ports = mos7840_num_ports; | ||
2222 | 2235 | ||
2223 | return mos7840_num_ports; | 2236 | return mos7840_num_ports; |
2224 | } | 2237 | } |
@@ -2226,6 +2239,7 @@ static int mos7840_calc_num_ports(struct usb_serial *serial) | |||
2226 | static int mos7840_port_probe(struct usb_serial_port *port) | 2239 | static int mos7840_port_probe(struct usb_serial_port *port) |
2227 | { | 2240 | { |
2228 | struct usb_serial *serial = port->serial; | 2241 | struct usb_serial *serial = port->serial; |
2242 | int device_type = (unsigned long)usb_get_serial_data(serial); | ||
2229 | struct moschip_port *mos7840_port; | 2243 | struct moschip_port *mos7840_port; |
2230 | int status; | 2244 | int status; |
2231 | int pnum; | 2245 | int pnum; |
@@ -2401,6 +2415,14 @@ static int mos7840_port_probe(struct usb_serial_port *port) | |||
2401 | if (device_type == MOSCHIP_DEVICE_ID_7810) { | 2415 | if (device_type == MOSCHIP_DEVICE_ID_7810) { |
2402 | mos7840_port->has_led = true; | 2416 | mos7840_port->has_led = true; |
2403 | 2417 | ||
2418 | mos7840_port->led_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
2419 | mos7840_port->led_dr = kmalloc(sizeof(*mos7840_port->led_dr), | ||
2420 | GFP_KERNEL); | ||
2421 | if (!mos7840_port->led_urb || !mos7840_port->led_dr) { | ||
2422 | status = -ENOMEM; | ||
2423 | goto error; | ||
2424 | } | ||
2425 | |||
2404 | init_timer(&mos7840_port->led_timer1); | 2426 | init_timer(&mos7840_port->led_timer1); |
2405 | mos7840_port->led_timer1.function = mos7840_led_off; | 2427 | mos7840_port->led_timer1.function = mos7840_led_off; |
2406 | mos7840_port->led_timer1.expires = | 2428 | mos7840_port->led_timer1.expires = |
@@ -2413,8 +2435,6 @@ static int mos7840_port_probe(struct usb_serial_port *port) | |||
2413 | jiffies + msecs_to_jiffies(LED_OFF_MS); | 2435 | jiffies + msecs_to_jiffies(LED_OFF_MS); |
2414 | mos7840_port->led_timer2.data = (unsigned long)mos7840_port; | 2436 | mos7840_port->led_timer2.data = (unsigned long)mos7840_port; |
2415 | 2437 | ||
2416 | mos7840_port->led_flag = false; | ||
2417 | |||
2418 | /* Turn off LED */ | 2438 | /* Turn off LED */ |
2419 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); | 2439 | mos7840_set_led_sync(port, MODEM_CONTROL_REGISTER, 0x0300); |
2420 | } | 2440 | } |
@@ -2436,6 +2456,8 @@ out: | |||
2436 | } | 2456 | } |
2437 | return 0; | 2457 | return 0; |
2438 | error: | 2458 | error: |
2459 | kfree(mos7840_port->led_dr); | ||
2460 | usb_free_urb(mos7840_port->led_urb); | ||
2439 | kfree(mos7840_port->dr); | 2461 | kfree(mos7840_port->dr); |
2440 | kfree(mos7840_port->ctrl_buf); | 2462 | kfree(mos7840_port->ctrl_buf); |
2441 | usb_free_urb(mos7840_port->control_urb); | 2463 | usb_free_urb(mos7840_port->control_urb); |
@@ -2456,6 +2478,10 @@ static int mos7840_port_remove(struct usb_serial_port *port) | |||
2456 | 2478 | ||
2457 | del_timer_sync(&mos7840_port->led_timer1); | 2479 | del_timer_sync(&mos7840_port->led_timer1); |
2458 | del_timer_sync(&mos7840_port->led_timer2); | 2480 | del_timer_sync(&mos7840_port->led_timer2); |
2481 | |||
2482 | usb_kill_urb(mos7840_port->led_urb); | ||
2483 | usb_free_urb(mos7840_port->led_urb); | ||
2484 | kfree(mos7840_port->led_dr); | ||
2459 | } | 2485 | } |
2460 | usb_kill_urb(mos7840_port->control_urb); | 2486 | usb_kill_urb(mos7840_port->control_urb); |
2461 | usb_free_urb(mos7840_port->control_urb); | 2487 | usb_free_urb(mos7840_port->control_urb); |
@@ -2482,9 +2508,7 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
2482 | .throttle = mos7840_throttle, | 2508 | .throttle = mos7840_throttle, |
2483 | .unthrottle = mos7840_unthrottle, | 2509 | .unthrottle = mos7840_unthrottle, |
2484 | .calc_num_ports = mos7840_calc_num_ports, | 2510 | .calc_num_ports = mos7840_calc_num_ports, |
2485 | #ifdef MCSSerialProbe | 2511 | .probe = mos7840_probe, |
2486 | .probe = mos7840_serial_probe, | ||
2487 | #endif | ||
2488 | .ioctl = mos7840_ioctl, | 2512 | .ioctl = mos7840_ioctl, |
2489 | .set_termios = mos7840_set_termios, | 2513 | .set_termios = mos7840_set_termios, |
2490 | .break_ctl = mos7840_break, | 2514 | .break_ctl = mos7840_break, |
diff --git a/drivers/usb/serial/suunto.c b/drivers/usb/serial/suunto.c new file mode 100644 index 000000000000..2248e7a7d5ad --- /dev/null +++ b/drivers/usb/serial/suunto.c | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Suunto ANT+ USB Driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
5 | * Copyright (C) 2013 Linux Foundation | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation only. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/tty.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/usb.h> | ||
17 | #include <linux/usb/serial.h> | ||
18 | #include <linux/uaccess.h> | ||
19 | |||
20 | static const struct usb_device_id id_table[] = { | ||
21 | { USB_DEVICE(0x0fcf, 0x1008) }, | ||
22 | { }, | ||
23 | }; | ||
24 | MODULE_DEVICE_TABLE(usb, id_table); | ||
25 | |||
26 | static struct usb_serial_driver suunto_device = { | ||
27 | .driver = { | ||
28 | .owner = THIS_MODULE, | ||
29 | .name = KBUILD_MODNAME, | ||
30 | }, | ||
31 | .id_table = id_table, | ||
32 | .num_ports = 1, | ||
33 | }; | ||
34 | |||
35 | static struct usb_serial_driver * const serial_drivers[] = { | ||
36 | &suunto_device, | ||
37 | NULL, | ||
38 | }; | ||
39 | |||
40 | module_usb_serial_driver(serial_drivers, id_table); | ||
41 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index c5179e269df6..cef6002acbd4 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -137,8 +137,27 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) | |||
137 | */ | 137 | */ |
138 | pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE); | 138 | pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE); |
139 | 139 | ||
140 | if (vdev->reset_works) | 140 | /* |
141 | __pci_reset_function(pdev); | 141 | * Careful, device_lock may already be held. This is the case if |
142 | * a driver unbind is blocked. Try to get the locks ourselves to | ||
143 | * prevent a deadlock. | ||
144 | */ | ||
145 | if (vdev->reset_works) { | ||
146 | bool reset_done = false; | ||
147 | |||
148 | if (pci_cfg_access_trylock(pdev)) { | ||
149 | if (device_trylock(&pdev->dev)) { | ||
150 | __pci_reset_function_locked(pdev); | ||
151 | reset_done = true; | ||
152 | device_unlock(&pdev->dev); | ||
153 | } | ||
154 | pci_cfg_access_unlock(pdev); | ||
155 | } | ||
156 | |||
157 | if (!reset_done) | ||
158 | pr_warn("%s: Unable to acquire locks for reset of %s\n", | ||
159 | __func__, dev_name(&pdev->dev)); | ||
160 | } | ||
142 | 161 | ||
143 | pci_restore_state(pdev); | 162 | pci_restore_state(pdev); |
144 | } | 163 | } |
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c index c488da5db7c7..842f4507883e 100644 --- a/drivers/vfio/vfio.c +++ b/drivers/vfio/vfio.c | |||
@@ -494,27 +494,6 @@ static int vfio_group_nb_add_dev(struct vfio_group *group, struct device *dev) | |||
494 | return 0; | 494 | return 0; |
495 | } | 495 | } |
496 | 496 | ||
497 | static int vfio_group_nb_del_dev(struct vfio_group *group, struct device *dev) | ||
498 | { | ||
499 | struct vfio_device *device; | ||
500 | |||
501 | /* | ||
502 | * Expect to fall out here. If a device was in use, it would | ||
503 | * have been bound to a vfio sub-driver, which would have blocked | ||
504 | * in .remove at vfio_del_group_dev. Sanity check that we no | ||
505 | * longer track the device, so it's safe to remove. | ||
506 | */ | ||
507 | device = vfio_group_get_device(group, dev); | ||
508 | if (likely(!device)) | ||
509 | return 0; | ||
510 | |||
511 | WARN("Device %s removed from live group %d!\n", dev_name(dev), | ||
512 | iommu_group_id(group->iommu_group)); | ||
513 | |||
514 | vfio_device_put(device); | ||
515 | return 0; | ||
516 | } | ||
517 | |||
518 | static int vfio_group_nb_verify(struct vfio_group *group, struct device *dev) | 497 | static int vfio_group_nb_verify(struct vfio_group *group, struct device *dev) |
519 | { | 498 | { |
520 | /* We don't care what happens when the group isn't in use */ | 499 | /* We don't care what happens when the group isn't in use */ |
@@ -531,13 +510,11 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb, | |||
531 | struct device *dev = data; | 510 | struct device *dev = data; |
532 | 511 | ||
533 | /* | 512 | /* |
534 | * Need to go through a group_lock lookup to get a reference or | 513 | * Need to go through a group_lock lookup to get a reference or we |
535 | * we risk racing a group being removed. Leave a WARN_ON for | 514 | * risk racing a group being removed. Ignore spurious notifies. |
536 | * debuging, but if the group no longer exists, a spurious notify | ||
537 | * is harmless. | ||
538 | */ | 515 | */ |
539 | group = vfio_group_try_get(group); | 516 | group = vfio_group_try_get(group); |
540 | if (WARN_ON(!group)) | 517 | if (!group) |
541 | return NOTIFY_OK; | 518 | return NOTIFY_OK; |
542 | 519 | ||
543 | switch (action) { | 520 | switch (action) { |
@@ -545,7 +522,13 @@ static int vfio_iommu_group_notifier(struct notifier_block *nb, | |||
545 | vfio_group_nb_add_dev(group, dev); | 522 | vfio_group_nb_add_dev(group, dev); |
546 | break; | 523 | break; |
547 | case IOMMU_GROUP_NOTIFY_DEL_DEVICE: | 524 | case IOMMU_GROUP_NOTIFY_DEL_DEVICE: |
548 | vfio_group_nb_del_dev(group, dev); | 525 | /* |
526 | * Nothing to do here. If the device is in use, then the | ||
527 | * vfio sub-driver should block the remove callback until | ||
528 | * it is unused. If the device is unused or attached to a | ||
529 | * stub driver, then it should be released and we don't | ||
530 | * care that it will be going away. | ||
531 | */ | ||
549 | break; | 532 | break; |
550 | case IOMMU_GROUP_NOTIFY_BIND_DRIVER: | 533 | case IOMMU_GROUP_NOTIFY_BIND_DRIVER: |
551 | pr_debug("%s: Device %s, group %d binding to driver\n", | 534 | pr_debug("%s: Device %s, group %d binding to driver\n", |
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index a89c15de9f45..9b0f12c5c284 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c | |||
@@ -435,8 +435,8 @@ static int correct_chipset(struct atyfb_par *par) | |||
435 | const char *name; | 435 | const char *name; |
436 | int i; | 436 | int i; |
437 | 437 | ||
438 | for (i = ARRAY_SIZE(aty_chips); i > 0; i--) | 438 | for (i = (int)ARRAY_SIZE(aty_chips) - 1; i >= 0; i--) |
439 | if (par->pci_id == aty_chips[i - 1].pci_id) | 439 | if (par->pci_id == aty_chips[i].pci_id) |
440 | break; | 440 | break; |
441 | 441 | ||
442 | if (i < 0) | 442 | if (i < 0) |
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 3ba37713b1f9..dc09ebe4aba5 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c | |||
@@ -239,24 +239,6 @@ static const struct fb_bitfield def_rgb565[] = { | |||
239 | } | 239 | } |
240 | }; | 240 | }; |
241 | 241 | ||
242 | static const struct fb_bitfield def_rgb666[] = { | ||
243 | [RED] = { | ||
244 | .offset = 16, | ||
245 | .length = 6, | ||
246 | }, | ||
247 | [GREEN] = { | ||
248 | .offset = 8, | ||
249 | .length = 6, | ||
250 | }, | ||
251 | [BLUE] = { | ||
252 | .offset = 0, | ||
253 | .length = 6, | ||
254 | }, | ||
255 | [TRANSP] = { /* no support for transparency */ | ||
256 | .length = 0, | ||
257 | } | ||
258 | }; | ||
259 | |||
260 | static const struct fb_bitfield def_rgb888[] = { | 242 | static const struct fb_bitfield def_rgb888[] = { |
261 | [RED] = { | 243 | [RED] = { |
262 | .offset = 16, | 244 | .offset = 16, |
@@ -309,9 +291,6 @@ static int mxsfb_check_var(struct fb_var_screeninfo *var, | |||
309 | break; | 291 | break; |
310 | case STMLCDIF_16BIT: | 292 | case STMLCDIF_16BIT: |
311 | case STMLCDIF_18BIT: | 293 | case STMLCDIF_18BIT: |
312 | /* 24 bit to 18 bit mapping */ | ||
313 | rgb = def_rgb666; | ||
314 | break; | ||
315 | case STMLCDIF_24BIT: | 294 | case STMLCDIF_24BIT: |
316 | /* real 24 bit */ | 295 | /* real 24 bit */ |
317 | rgb = def_rgb888; | 296 | rgb = def_rgb888; |
@@ -453,11 +432,6 @@ static int mxsfb_set_par(struct fb_info *fb_info) | |||
453 | return -EINVAL; | 432 | return -EINVAL; |
454 | case STMLCDIF_16BIT: | 433 | case STMLCDIF_16BIT: |
455 | case STMLCDIF_18BIT: | 434 | case STMLCDIF_18BIT: |
456 | /* 24 bit to 18 bit mapping */ | ||
457 | ctrl |= CTRL_DF24; /* ignore the upper 2 bits in | ||
458 | * each colour component | ||
459 | */ | ||
460 | break; | ||
461 | case STMLCDIF_24BIT: | 435 | case STMLCDIF_24BIT: |
462 | /* real 24 bit */ | 436 | /* real 24 bit */ |
463 | break; | 437 | break; |
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c index 8c527e5b293c..796e5112ceee 100644 --- a/drivers/video/nuc900fb.c +++ b/drivers/video/nuc900fb.c | |||
@@ -587,8 +587,7 @@ static int nuc900fb_probe(struct platform_device *pdev) | |||
587 | fbinfo->flags = FBINFO_FLAG_DEFAULT; | 587 | fbinfo->flags = FBINFO_FLAG_DEFAULT; |
588 | fbinfo->pseudo_palette = &fbi->pseudo_pal; | 588 | fbinfo->pseudo_palette = &fbi->pseudo_pal; |
589 | 589 | ||
590 | ret = request_irq(irq, nuc900fb_irqhandler, 0, | 590 | ret = request_irq(irq, nuc900fb_irqhandler, 0, pdev->name, fbi); |
591 | pdev->name, fbinfo); | ||
592 | if (ret) { | 591 | if (ret) { |
593 | dev_err(&pdev->dev, "cannot register irq handler %d -err %d\n", | 592 | dev_err(&pdev->dev, "cannot register irq handler %d -err %d\n", |
594 | irq, ret); | 593 | irq, ret); |
diff --git a/drivers/video/omap2/displays-new/connector-analog-tv.c b/drivers/video/omap2/displays-new/connector-analog-tv.c index 5338f362293b..1b60698f141e 100644 --- a/drivers/video/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/omap2/displays-new/connector-analog-tv.c | |||
@@ -28,6 +28,20 @@ struct panel_drv_data { | |||
28 | bool invert_polarity; | 28 | bool invert_polarity; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static const struct omap_video_timings tvc_pal_timings = { | ||
32 | .x_res = 720, | ||
33 | .y_res = 574, | ||
34 | .pixel_clock = 13500, | ||
35 | .hsw = 64, | ||
36 | .hfp = 12, | ||
37 | .hbp = 68, | ||
38 | .vsw = 5, | ||
39 | .vfp = 5, | ||
40 | .vbp = 41, | ||
41 | |||
42 | .interlace = true, | ||
43 | }; | ||
44 | |||
31 | #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) | 45 | #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) |
32 | 46 | ||
33 | static int tvc_connect(struct omap_dss_device *dssdev) | 47 | static int tvc_connect(struct omap_dss_device *dssdev) |
@@ -212,14 +226,14 @@ static int tvc_probe(struct platform_device *pdev) | |||
212 | return -ENODEV; | 226 | return -ENODEV; |
213 | } | 227 | } |
214 | 228 | ||
215 | ddata->timings = omap_dss_pal_timings; | 229 | ddata->timings = tvc_pal_timings; |
216 | 230 | ||
217 | dssdev = &ddata->dssdev; | 231 | dssdev = &ddata->dssdev; |
218 | dssdev->driver = &tvc_driver; | 232 | dssdev->driver = &tvc_driver; |
219 | dssdev->dev = &pdev->dev; | 233 | dssdev->dev = &pdev->dev; |
220 | dssdev->type = OMAP_DISPLAY_TYPE_VENC; | 234 | dssdev->type = OMAP_DISPLAY_TYPE_VENC; |
221 | dssdev->owner = THIS_MODULE; | 235 | dssdev->owner = THIS_MODULE; |
222 | dssdev->panel.timings = omap_dss_pal_timings; | 236 | dssdev->panel.timings = tvc_pal_timings; |
223 | 237 | ||
224 | r = omapdss_register_display(dssdev); | 238 | r = omapdss_register_display(dssdev); |
225 | if (r) { | 239 | if (r) { |
diff --git a/drivers/video/sgivwfb.c b/drivers/video/sgivwfb.c index b2a8912f6435..a9ac3ce2d0e9 100644 --- a/drivers/video/sgivwfb.c +++ b/drivers/video/sgivwfb.c | |||
@@ -713,7 +713,7 @@ static int sgivwfb_mmap(struct fb_info *info, | |||
713 | r = vm_iomap_memory(vma, sgivwfb_mem_phys, sgivwfb_mem_size); | 713 | r = vm_iomap_memory(vma, sgivwfb_mem_phys, sgivwfb_mem_size); |
714 | 714 | ||
715 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", | 715 | printk(KERN_DEBUG "sgivwfb: mmap framebuffer P(%lx)->V(%lx)\n", |
716 | offset, vma->vm_start); | 716 | sgivwfb_mem_phys + (vma->vm_pgoff << PAGE_SHIFT), vma->vm_start); |
717 | 717 | ||
718 | return r; | 718 | return r; |
719 | } | 719 | } |
diff --git a/drivers/video/sh7760fb.c b/drivers/video/sh7760fb.c index a8c6c43a4658..1265b25f9f99 100644 --- a/drivers/video/sh7760fb.c +++ b/drivers/video/sh7760fb.c | |||
@@ -567,7 +567,7 @@ static int sh7760fb_remove(struct platform_device *dev) | |||
567 | fb_dealloc_cmap(&info->cmap); | 567 | fb_dealloc_cmap(&info->cmap); |
568 | sh7760fb_free_mem(info); | 568 | sh7760fb_free_mem(info); |
569 | if (par->irq >= 0) | 569 | if (par->irq >= 0) |
570 | free_irq(par->irq, par); | 570 | free_irq(par->irq, &par->vsync); |
571 | iounmap(par->base); | 571 | iounmap(par->base); |
572 | release_mem_region(par->ioarea->start, resource_size(par->ioarea)); | 572 | release_mem_region(par->ioarea->start, resource_size(par->ioarea)); |
573 | framebuffer_release(info); | 573 | framebuffer_release(info); |
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 830ded45fd47..2827333703d9 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c | |||
@@ -1265,7 +1265,6 @@ static void vga16fb_imageblit(struct fb_info *info, const struct fb_image *image | |||
1265 | 1265 | ||
1266 | static void vga16fb_destroy(struct fb_info *info) | 1266 | static void vga16fb_destroy(struct fb_info *info) |
1267 | { | 1267 | { |
1268 | struct platform_device *dev = container_of(info->device, struct platform_device, dev); | ||
1269 | iounmap(info->screen_base); | 1268 | iounmap(info->screen_base); |
1270 | fb_dealloc_cmap(&info->cmap); | 1269 | fb_dealloc_cmap(&info->cmap); |
1271 | /* XXX unshare VGA regions */ | 1270 | /* XXX unshare VGA regions */ |
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index f3d4a69e1e4e..6629b29a8202 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c | |||
@@ -341,8 +341,8 @@ static int xilinxfb_assign(struct platform_device *pdev, | |||
341 | 341 | ||
342 | if (drvdata->flags & BUS_ACCESS_FLAG) { | 342 | if (drvdata->flags & BUS_ACCESS_FLAG) { |
343 | /* Put a banner in the log (for DEBUG) */ | 343 | /* Put a banner in the log (for DEBUG) */ |
344 | dev_dbg(dev, "regs: phys=%x, virt=%p\n", drvdata->regs_phys, | 344 | dev_dbg(dev, "regs: phys=%pa, virt=%p\n", |
345 | drvdata->regs); | 345 | &drvdata->regs_phys, drvdata->regs); |
346 | } | 346 | } |
347 | /* Put a banner in the log (for DEBUG) */ | 347 | /* Put a banner in the log (for DEBUG) */ |
348 | dev_dbg(dev, "fb: phys=%llx, virt=%p, size=%x\n", | 348 | dev_dbg(dev, "fb: phys=%llx, virt=%p, size=%x\n", |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 9e02d60a364b..23eae5cb69c2 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -145,7 +145,7 @@ config SWIOTLB_XEN | |||
145 | 145 | ||
146 | config XEN_TMEM | 146 | config XEN_TMEM |
147 | tristate | 147 | tristate |
148 | depends on !ARM | 148 | depends on !ARM && !ARM64 |
149 | default m if (CLEANCACHE || FRONTSWAP) | 149 | default m if (CLEANCACHE || FRONTSWAP) |
150 | help | 150 | help |
151 | Shim to interface in-kernel Transcendent Memory hooks | 151 | Shim to interface in-kernel Transcendent Memory hooks |
diff --git a/drivers/xen/Makefile b/drivers/xen/Makefile index eabd0ee1c2bc..14fe79d8634a 100644 --- a/drivers/xen/Makefile +++ b/drivers/xen/Makefile | |||
@@ -1,9 +1,8 @@ | |||
1 | ifneq ($(CONFIG_ARM),y) | 1 | ifeq ($(filter y, $(CONFIG_ARM) $(CONFIG_ARM64)),) |
2 | obj-y += manage.o | ||
3 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o | 2 | obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o |
4 | endif | 3 | endif |
5 | obj-$(CONFIG_X86) += fallback.o | 4 | obj-$(CONFIG_X86) += fallback.o |
6 | obj-y += grant-table.o features.o events.o balloon.o | 5 | obj-y += grant-table.o features.o events.o balloon.o manage.o |
7 | obj-y += xenbus/ | 6 | obj-y += xenbus/ |
8 | 7 | ||
9 | nostackp := $(call cc-option, -fno-stack-protector) | 8 | nostackp := $(call cc-option, -fno-stack-protector) |
diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c index 8feecf01d55c..b6165e047f48 100644 --- a/drivers/xen/evtchn.c +++ b/drivers/xen/evtchn.c | |||
@@ -379,18 +379,12 @@ static long evtchn_ioctl(struct file *file, | |||
379 | if (unbind.port >= NR_EVENT_CHANNELS) | 379 | if (unbind.port >= NR_EVENT_CHANNELS) |
380 | break; | 380 | break; |
381 | 381 | ||
382 | spin_lock_irq(&port_user_lock); | ||
383 | |||
384 | rc = -ENOTCONN; | 382 | rc = -ENOTCONN; |
385 | if (get_port_user(unbind.port) != u) { | 383 | if (get_port_user(unbind.port) != u) |
386 | spin_unlock_irq(&port_user_lock); | ||
387 | break; | 384 | break; |
388 | } | ||
389 | 385 | ||
390 | disable_irq(irq_from_evtchn(unbind.port)); | 386 | disable_irq(irq_from_evtchn(unbind.port)); |
391 | 387 | ||
392 | spin_unlock_irq(&port_user_lock); | ||
393 | |||
394 | evtchn_unbind_from_user(u, unbind.port); | 388 | evtchn_unbind_from_user(u, unbind.port); |
395 | 389 | ||
396 | rc = 0; | 390 | rc = 0; |
@@ -490,26 +484,15 @@ static int evtchn_release(struct inode *inode, struct file *filp) | |||
490 | int i; | 484 | int i; |
491 | struct per_user_data *u = filp->private_data; | 485 | struct per_user_data *u = filp->private_data; |
492 | 486 | ||
493 | spin_lock_irq(&port_user_lock); | ||
494 | |||
495 | free_page((unsigned long)u->ring); | ||
496 | |||
497 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { | 487 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { |
498 | if (get_port_user(i) != u) | 488 | if (get_port_user(i) != u) |
499 | continue; | 489 | continue; |
500 | 490 | ||
501 | disable_irq(irq_from_evtchn(i)); | 491 | disable_irq(irq_from_evtchn(i)); |
502 | } | ||
503 | |||
504 | spin_unlock_irq(&port_user_lock); | ||
505 | |||
506 | for (i = 0; i < NR_EVENT_CHANNELS; i++) { | ||
507 | if (get_port_user(i) != u) | ||
508 | continue; | ||
509 | |||
510 | evtchn_unbind_from_user(get_port_user(i), i); | 492 | evtchn_unbind_from_user(get_port_user(i), i); |
511 | } | 493 | } |
512 | 494 | ||
495 | free_page((unsigned long)u->ring); | ||
513 | kfree(u->name); | 496 | kfree(u->name); |
514 | kfree(u); | 497 | kfree(u); |
515 | 498 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index 6ed8a9df4472..34b20bfa4e8c 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -115,7 +115,6 @@ static int xenbus_frontend_dev_resume(struct device *dev) | |||
115 | return -EFAULT; | 115 | return -EFAULT; |
116 | } | 116 | } |
117 | 117 | ||
118 | INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); | ||
119 | queue_work(xenbus_frontend_wq, &xdev->work); | 118 | queue_work(xenbus_frontend_wq, &xdev->work); |
120 | 119 | ||
121 | return 0; | 120 | return 0; |
@@ -124,6 +123,16 @@ static int xenbus_frontend_dev_resume(struct device *dev) | |||
124 | return xenbus_dev_resume(dev); | 123 | return xenbus_dev_resume(dev); |
125 | } | 124 | } |
126 | 125 | ||
126 | static int xenbus_frontend_dev_probe(struct device *dev) | ||
127 | { | ||
128 | if (xen_store_domain_type == XS_LOCAL) { | ||
129 | struct xenbus_device *xdev = to_xenbus_device(dev); | ||
130 | INIT_WORK(&xdev->work, xenbus_frontend_delayed_resume); | ||
131 | } | ||
132 | |||
133 | return xenbus_dev_probe(dev); | ||
134 | } | ||
135 | |||
127 | static const struct dev_pm_ops xenbus_pm_ops = { | 136 | static const struct dev_pm_ops xenbus_pm_ops = { |
128 | .suspend = xenbus_dev_suspend, | 137 | .suspend = xenbus_dev_suspend, |
129 | .resume = xenbus_frontend_dev_resume, | 138 | .resume = xenbus_frontend_dev_resume, |
@@ -142,7 +151,7 @@ static struct xen_bus_type xenbus_frontend = { | |||
142 | .name = "xen", | 151 | .name = "xen", |
143 | .match = xenbus_match, | 152 | .match = xenbus_match, |
144 | .uevent = xenbus_uevent_frontend, | 153 | .uevent = xenbus_uevent_frontend, |
145 | .probe = xenbus_dev_probe, | 154 | .probe = xenbus_frontend_dev_probe, |
146 | .remove = xenbus_dev_remove, | 155 | .remove = xenbus_dev_remove, |
147 | .shutdown = xenbus_dev_shutdown, | 156 | .shutdown = xenbus_dev_shutdown, |
148 | .dev_attrs = xenbus_dev_attrs, | 157 | .dev_attrs = xenbus_dev_attrs, |
@@ -474,7 +483,11 @@ static int __init xenbus_probe_frontend_init(void) | |||
474 | 483 | ||
475 | register_xenstore_notifier(&xenstore_notifier); | 484 | register_xenstore_notifier(&xenstore_notifier); |
476 | 485 | ||
477 | xenbus_frontend_wq = create_workqueue("xenbus_frontend"); | 486 | if (xen_store_domain_type == XS_LOCAL) { |
487 | xenbus_frontend_wq = create_workqueue("xenbus_frontend"); | ||
488 | if (!xenbus_frontend_wq) | ||
489 | pr_warn("create xenbus frontend workqueue failed, S3 resume is likely to fail\n"); | ||
490 | } | ||
478 | 491 | ||
479 | return 0; | 492 | return 0; |
480 | } | 493 | } |