diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-10-06 08:01:11 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-06 08:01:11 -0400 |
commit | 8df22a4d6f5b81c9c1703579d4907b57002689ed (patch) | |
tree | 064e9662d427a82076e1151fcd9aa78a1066f9f4 /drivers | |
parent | 0cae90a96c15f2fd3bd139ba5505755c9c9ef2eb (diff) | |
parent | a5448c88b812390a3622e76d774e10c0da1fb970 (diff) |
Merge tag 'asoc-v3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v3.18
- More componentisation work from Lars-Peter, this time mainly
cleaning up the suspend and bias level transition callbacks.
- Real system support for the Intel drivers and a bunch of fixes and
enhancements for the associated CODEC drivers, this is going to need
a lot quirks over time due to the lack of any firmware description of
the boards.
- Jack detect support for simple card from Dylan Reid.
- A bunch of small fixes and enhancements for the Freescale drivers.
- New drivers for Analog Devices SSM4567, Cirrus Logic CS35L32, Everest
Semiconductor ES8328 and Freescale cards using the ASRC in newer i.MX
processors.
Diffstat (limited to 'drivers')
437 files changed, 5012 insertions, 2638 deletions
diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c index 2da8660262e5..81dc75033f15 100644 --- a/drivers/acpi/acpi_cmos_rtc.c +++ b/drivers/acpi/acpi_cmos_rtc.c | |||
@@ -33,7 +33,7 @@ acpi_cmos_rtc_space_handler(u32 function, acpi_physical_address address, | |||
33 | void *handler_context, void *region_context) | 33 | void *handler_context, void *region_context) |
34 | { | 34 | { |
35 | int i; | 35 | int i; |
36 | u8 *value = (u8 *)&value64; | 36 | u8 *value = (u8 *)value64; |
37 | 37 | ||
38 | if (address > 0xff || !value64) | 38 | if (address > 0xff || !value64) |
39 | return AE_BAD_PARAMETER; | 39 | return AE_BAD_PARAMETER; |
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 9dfec48dd4e5..b0ea767c8696 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c | |||
@@ -419,7 +419,6 @@ static int acpi_lpss_create_device(struct acpi_device *adev, | |||
419 | adev->driver_data = pdata; | 419 | adev->driver_data = pdata; |
420 | pdev = acpi_create_platform_device(adev); | 420 | pdev = acpi_create_platform_device(adev); |
421 | if (!IS_ERR_OR_NULL(pdev)) { | 421 | if (!IS_ERR_OR_NULL(pdev)) { |
422 | device_enable_async_suspend(&pdev->dev); | ||
423 | return 1; | 422 | return 1; |
424 | } | 423 | } |
425 | 424 | ||
@@ -610,7 +609,7 @@ static int acpi_lpss_suspend_late(struct device *dev) | |||
610 | return acpi_dev_suspend_late(dev); | 609 | return acpi_dev_suspend_late(dev); |
611 | } | 610 | } |
612 | 611 | ||
613 | static int acpi_lpss_restore_early(struct device *dev) | 612 | static int acpi_lpss_resume_early(struct device *dev) |
614 | { | 613 | { |
615 | int ret = acpi_dev_resume_early(dev); | 614 | int ret = acpi_dev_resume_early(dev); |
616 | 615 | ||
@@ -650,15 +649,15 @@ static int acpi_lpss_runtime_resume(struct device *dev) | |||
650 | static struct dev_pm_domain acpi_lpss_pm_domain = { | 649 | static struct dev_pm_domain acpi_lpss_pm_domain = { |
651 | .ops = { | 650 | .ops = { |
652 | #ifdef CONFIG_PM_SLEEP | 651 | #ifdef CONFIG_PM_SLEEP |
653 | .suspend_late = acpi_lpss_suspend_late, | ||
654 | .restore_early = acpi_lpss_restore_early, | ||
655 | .prepare = acpi_subsys_prepare, | 652 | .prepare = acpi_subsys_prepare, |
656 | .complete = acpi_subsys_complete, | 653 | .complete = acpi_subsys_complete, |
657 | .suspend = acpi_subsys_suspend, | 654 | .suspend = acpi_subsys_suspend, |
658 | .resume_early = acpi_subsys_resume_early, | 655 | .suspend_late = acpi_lpss_suspend_late, |
656 | .resume_early = acpi_lpss_resume_early, | ||
659 | .freeze = acpi_subsys_freeze, | 657 | .freeze = acpi_subsys_freeze, |
660 | .poweroff = acpi_subsys_suspend, | 658 | .poweroff = acpi_subsys_suspend, |
661 | .poweroff_late = acpi_subsys_suspend_late, | 659 | .poweroff_late = acpi_lpss_suspend_late, |
660 | .restore_early = acpi_lpss_resume_early, | ||
662 | #endif | 661 | #endif |
663 | #ifdef CONFIG_PM_RUNTIME | 662 | #ifdef CONFIG_PM_RUNTIME |
664 | .runtime_suspend = acpi_lpss_runtime_suspend, | 663 | .runtime_suspend = acpi_lpss_runtime_suspend, |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 1f9aba5fb81f..2747279fbe3c 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -254,6 +254,7 @@ struct acpi_create_field_info { | |||
254 | u32 field_bit_position; | 254 | u32 field_bit_position; |
255 | u32 field_bit_length; | 255 | u32 field_bit_length; |
256 | u16 resource_length; | 256 | u16 resource_length; |
257 | u16 pin_number_index; | ||
257 | u8 field_flags; | 258 | u8 field_flags; |
258 | u8 attribute; | 259 | u8 attribute; |
259 | u8 field_type; | 260 | u8 field_type; |
diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 22fb6449d3d6..8abb393dafab 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h | |||
@@ -264,6 +264,7 @@ struct acpi_object_region_field { | |||
264 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length; | 264 | ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length; |
265 | union acpi_operand_object *region_obj; /* Containing op_region object */ | 265 | union acpi_operand_object *region_obj; /* Containing op_region object */ |
266 | u8 *resource_buffer; /* resource_template for serial regions/fields */ | 266 | u8 *resource_buffer; /* resource_template for serial regions/fields */ |
267 | u16 pin_number_index; /* Index relative to previous Connection/Template */ | ||
267 | }; | 268 | }; |
268 | 269 | ||
269 | struct acpi_object_bank_field { | 270 | struct acpi_object_bank_field { |
diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 3661c8e90540..c57666196672 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c | |||
@@ -360,6 +360,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
360 | */ | 360 | */ |
361 | info->resource_buffer = NULL; | 361 | info->resource_buffer = NULL; |
362 | info->connection_node = NULL; | 362 | info->connection_node = NULL; |
363 | info->pin_number_index = 0; | ||
363 | 364 | ||
364 | /* | 365 | /* |
365 | * A Connection() is either an actual resource descriptor (buffer) | 366 | * A Connection() is either an actual resource descriptor (buffer) |
@@ -437,6 +438,7 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, | |||
437 | } | 438 | } |
438 | 439 | ||
439 | info->field_bit_position += info->field_bit_length; | 440 | info->field_bit_position += info->field_bit_length; |
441 | info->pin_number_index++; /* Index relative to previous Connection() */ | ||
440 | break; | 442 | break; |
441 | 443 | ||
442 | default: | 444 | default: |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 9957297d1580..8eb8575e8c16 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -142,6 +142,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
142 | union acpi_operand_object *region_obj2; | 142 | union acpi_operand_object *region_obj2; |
143 | void *region_context = NULL; | 143 | void *region_context = NULL; |
144 | struct acpi_connection_info *context; | 144 | struct acpi_connection_info *context; |
145 | acpi_physical_address address; | ||
145 | 146 | ||
146 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); | 147 | ACPI_FUNCTION_TRACE(ev_address_space_dispatch); |
147 | 148 | ||
@@ -231,25 +232,23 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
231 | /* We have everything we need, we can invoke the address space handler */ | 232 | /* We have everything we need, we can invoke the address space handler */ |
232 | 233 | ||
233 | handler = handler_desc->address_space.handler; | 234 | handler = handler_desc->address_space.handler; |
234 | 235 | address = (region_obj->region.address + region_offset); | |
235 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
236 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", | ||
237 | ®ion_obj->region.handler->address_space, handler, | ||
238 | ACPI_FORMAT_NATIVE_UINT(region_obj->region.address + | ||
239 | region_offset), | ||
240 | acpi_ut_get_region_name(region_obj->region. | ||
241 | space_id))); | ||
242 | 236 | ||
243 | /* | 237 | /* |
244 | * Special handling for generic_serial_bus and general_purpose_io: | 238 | * Special handling for generic_serial_bus and general_purpose_io: |
245 | * There are three extra parameters that must be passed to the | 239 | * There are three extra parameters that must be passed to the |
246 | * handler via the context: | 240 | * handler via the context: |
247 | * 1) Connection buffer, a resource template from Connection() op. | 241 | * 1) Connection buffer, a resource template from Connection() op |
248 | * 2) Length of the above buffer. | 242 | * 2) Length of the above buffer |
249 | * 3) Actual access length from the access_as() op. | 243 | * 3) Actual access length from the access_as() op |
244 | * | ||
245 | * In addition, for general_purpose_io, the Address and bit_width fields | ||
246 | * are defined as follows: | ||
247 | * 1) Address is the pin number index of the field (bit offset from | ||
248 | * the previous Connection) | ||
249 | * 2) bit_width is the actual bit length of the field (number of pins) | ||
250 | */ | 250 | */ |
251 | if (((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) || | 251 | if ((region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) && |
252 | (region_obj->region.space_id == ACPI_ADR_SPACE_GPIO)) && | ||
253 | context && field_obj) { | 252 | context && field_obj) { |
254 | 253 | ||
255 | /* Get the Connection (resource_template) buffer */ | 254 | /* Get the Connection (resource_template) buffer */ |
@@ -258,6 +257,24 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
258 | context->length = field_obj->field.resource_length; | 257 | context->length = field_obj->field.resource_length; |
259 | context->access_length = field_obj->field.access_length; | 258 | context->access_length = field_obj->field.access_length; |
260 | } | 259 | } |
260 | if ((region_obj->region.space_id == ACPI_ADR_SPACE_GPIO) && | ||
261 | context && field_obj) { | ||
262 | |||
263 | /* Get the Connection (resource_template) buffer */ | ||
264 | |||
265 | context->connection = field_obj->field.resource_buffer; | ||
266 | context->length = field_obj->field.resource_length; | ||
267 | context->access_length = field_obj->field.access_length; | ||
268 | address = field_obj->field.pin_number_index; | ||
269 | bit_width = field_obj->field.bit_length; | ||
270 | } | ||
271 | |||
272 | ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, | ||
273 | "Handler %p (@%p) Address %8.8X%8.8X [%s]\n", | ||
274 | ®ion_obj->region.handler->address_space, handler, | ||
275 | ACPI_FORMAT_NATIVE_UINT(address), | ||
276 | acpi_ut_get_region_name(region_obj->region. | ||
277 | space_id))); | ||
261 | 278 | ||
262 | if (!(handler_desc->address_space.handler_flags & | 279 | if (!(handler_desc->address_space.handler_flags & |
263 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { | 280 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) { |
@@ -271,9 +288,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, | |||
271 | 288 | ||
272 | /* Call the handler */ | 289 | /* Call the handler */ |
273 | 290 | ||
274 | status = handler(function, | 291 | status = handler(function, address, bit_width, value, context, |
275 | (region_obj->region.address + region_offset), | ||
276 | bit_width, value, context, | ||
277 | region_obj2->extra.region_context); | 292 | region_obj2->extra.region_context); |
278 | 293 | ||
279 | if (ACPI_FAILURE(status)) { | 294 | if (ACPI_FAILURE(status)) { |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 6907ce0c704c..b994845ed359 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
@@ -253,6 +253,37 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, | |||
253 | buffer = &buffer_desc->integer.value; | 253 | buffer = &buffer_desc->integer.value; |
254 | } | 254 | } |
255 | 255 | ||
256 | if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && | ||
257 | (obj_desc->field.region_obj->region.space_id == | ||
258 | ACPI_ADR_SPACE_GPIO)) { | ||
259 | /* | ||
260 | * For GPIO (general_purpose_io), the Address will be the bit offset | ||
261 | * from the previous Connection() operator, making it effectively a | ||
262 | * pin number index. The bit_length is the length of the field, which | ||
263 | * is thus the number of pins. | ||
264 | */ | ||
265 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
266 | "GPIO FieldRead [FROM]: Pin %u Bits %u\n", | ||
267 | obj_desc->field.pin_number_index, | ||
268 | obj_desc->field.bit_length)); | ||
269 | |||
270 | /* Lock entire transaction if requested */ | ||
271 | |||
272 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
273 | |||
274 | /* Perform the write */ | ||
275 | |||
276 | status = acpi_ex_access_region(obj_desc, 0, | ||
277 | (u64 *)buffer, ACPI_READ); | ||
278 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | ||
279 | if (ACPI_FAILURE(status)) { | ||
280 | acpi_ut_remove_reference(buffer_desc); | ||
281 | } else { | ||
282 | *ret_buffer_desc = buffer_desc; | ||
283 | } | ||
284 | return_ACPI_STATUS(status); | ||
285 | } | ||
286 | |||
256 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | 287 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, |
257 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", | 288 | "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", |
258 | obj_desc, obj_desc->common.type, buffer, | 289 | obj_desc, obj_desc->common.type, buffer, |
@@ -413,6 +444,42 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
413 | 444 | ||
414 | *result_desc = buffer_desc; | 445 | *result_desc = buffer_desc; |
415 | return_ACPI_STATUS(status); | 446 | return_ACPI_STATUS(status); |
447 | } else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) && | ||
448 | (obj_desc->field.region_obj->region.space_id == | ||
449 | ACPI_ADR_SPACE_GPIO)) { | ||
450 | /* | ||
451 | * For GPIO (general_purpose_io), we will bypass the entire field | ||
452 | * mechanism and handoff the bit address and bit width directly to | ||
453 | * the handler. The Address will be the bit offset | ||
454 | * from the previous Connection() operator, making it effectively a | ||
455 | * pin number index. The bit_length is the length of the field, which | ||
456 | * is thus the number of pins. | ||
457 | */ | ||
458 | if (source_desc->common.type != ACPI_TYPE_INTEGER) { | ||
459 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | ||
460 | } | ||
461 | |||
462 | ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, | ||
463 | "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", | ||
464 | acpi_ut_get_type_name(source_desc->common. | ||
465 | type), | ||
466 | source_desc->common.type, | ||
467 | (u32)source_desc->integer.value, | ||
468 | obj_desc->field.pin_number_index, | ||
469 | obj_desc->field.bit_length)); | ||
470 | |||
471 | buffer = &source_desc->integer.value; | ||
472 | |||
473 | /* Lock entire transaction if requested */ | ||
474 | |||
475 | acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags); | ||
476 | |||
477 | /* Perform the write */ | ||
478 | |||
479 | status = acpi_ex_access_region(obj_desc, 0, | ||
480 | (u64 *)buffer, ACPI_WRITE); | ||
481 | acpi_ex_release_global_lock(obj_desc->common_field.field_flags); | ||
482 | return_ACPI_STATUS(status); | ||
416 | } | 483 | } |
417 | 484 | ||
418 | /* Get a pointer to the data to be written */ | 485 | /* Get a pointer to the data to be written */ |
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index ee3f872870bc..118e942005e5 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c | |||
@@ -484,6 +484,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) | |||
484 | obj_desc->field.resource_length = info->resource_length; | 484 | obj_desc->field.resource_length = info->resource_length; |
485 | } | 485 | } |
486 | 486 | ||
487 | obj_desc->field.pin_number_index = info->pin_number_index; | ||
488 | |||
487 | /* Allow full data read from EC address space */ | 489 | /* Allow full data read from EC address space */ |
488 | 490 | ||
489 | if ((obj_desc->field.region_obj->region.space_id == | 491 | if ((obj_desc->field.region_obj->region.space_id == |
diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index 68f725839eb6..1b13b921dda9 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c | |||
@@ -316,6 +316,45 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, | |||
316 | acpi_ns_check_package_list(info, package, elements, count); | 316 | acpi_ns_check_package_list(info, package, elements, count); |
317 | break; | 317 | break; |
318 | 318 | ||
319 | case ACPI_PTYPE2_UUID_PAIR: | ||
320 | |||
321 | /* The package must contain pairs of (UUID + type) */ | ||
322 | |||
323 | if (count & 1) { | ||
324 | expected_count = count + 1; | ||
325 | goto package_too_small; | ||
326 | } | ||
327 | |||
328 | while (count > 0) { | ||
329 | status = acpi_ns_check_object_type(info, elements, | ||
330 | package->ret_info. | ||
331 | object_type1, 0); | ||
332 | if (ACPI_FAILURE(status)) { | ||
333 | return (status); | ||
334 | } | ||
335 | |||
336 | /* Validate length of the UUID buffer */ | ||
337 | |||
338 | if ((*elements)->buffer.length != 16) { | ||
339 | ACPI_WARN_PREDEFINED((AE_INFO, | ||
340 | info->full_pathname, | ||
341 | info->node_flags, | ||
342 | "Invalid length for UUID Buffer")); | ||
343 | return (AE_AML_OPERAND_VALUE); | ||
344 | } | ||
345 | |||
346 | status = acpi_ns_check_object_type(info, elements + 1, | ||
347 | package->ret_info. | ||
348 | object_type2, 0); | ||
349 | if (ACPI_FAILURE(status)) { | ||
350 | return (status); | ||
351 | } | ||
352 | |||
353 | elements += 2; | ||
354 | count -= 2; | ||
355 | } | ||
356 | break; | ||
357 | |||
319 | default: | 358 | default: |
320 | 359 | ||
321 | /* Should not get here if predefined info table is correct */ | 360 | /* Should not get here if predefined info table is correct */ |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 1c162e7be045..5fdfe65fe165 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -534,20 +534,6 @@ static int acpi_battery_get_state(struct acpi_battery *battery) | |||
534 | " invalid.\n"); | 534 | " invalid.\n"); |
535 | } | 535 | } |
536 | 536 | ||
537 | /* | ||
538 | * When fully charged, some batteries wrongly report | ||
539 | * capacity_now = design_capacity instead of = full_charge_capacity | ||
540 | */ | ||
541 | if (battery->capacity_now > battery->full_charge_capacity | ||
542 | && battery->full_charge_capacity != ACPI_BATTERY_VALUE_UNKNOWN) { | ||
543 | if (battery->capacity_now != battery->design_capacity) | ||
544 | printk_once(KERN_WARNING FW_BUG | ||
545 | "battery: reported current charge level (%d) " | ||
546 | "is higher than reported maximum charge level (%d).\n", | ||
547 | battery->capacity_now, battery->full_charge_capacity); | ||
548 | battery->capacity_now = battery->full_charge_capacity; | ||
549 | } | ||
550 | |||
551 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) | 537 | if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) |
552 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) | 538 | && battery->capacity_now >= 0 && battery->capacity_now <= 100) |
553 | battery->capacity_now = (battery->capacity_now * | 539 | battery->capacity_now = (battery->capacity_now * |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 8581f5b84f48..8b67bd0f6bb5 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -177,16 +177,6 @@ void acpi_bus_detach_private_data(acpi_handle handle) | |||
177 | } | 177 | } |
178 | EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); | 178 | EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); |
179 | 179 | ||
180 | void acpi_bus_no_hotplug(acpi_handle handle) | ||
181 | { | ||
182 | struct acpi_device *adev = NULL; | ||
183 | |||
184 | acpi_bus_get_device(handle, &adev); | ||
185 | if (adev) | ||
186 | adev->flags.no_hotplug = true; | ||
187 | } | ||
188 | EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug); | ||
189 | |||
190 | static void acpi_print_osc_error(acpi_handle handle, | 180 | static void acpi_print_osc_error(acpi_handle handle, |
191 | struct acpi_osc_context *context, char *error) | 181 | struct acpi_osc_context *context, char *error) |
192 | { | 182 | { |
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 76f7cff64594..c8ead9f97375 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -99,6 +99,13 @@ static void container_device_detach(struct acpi_device *adev) | |||
99 | device_unregister(dev); | 99 | device_unregister(dev); |
100 | } | 100 | } |
101 | 101 | ||
102 | static void container_device_online(struct acpi_device *adev) | ||
103 | { | ||
104 | struct device *dev = acpi_driver_data(adev); | ||
105 | |||
106 | kobject_uevent(&dev->kobj, KOBJ_ONLINE); | ||
107 | } | ||
108 | |||
102 | static struct acpi_scan_handler container_handler = { | 109 | static struct acpi_scan_handler container_handler = { |
103 | .ids = container_device_ids, | 110 | .ids = container_device_ids, |
104 | .attach = container_device_attach, | 111 | .attach = container_device_attach, |
@@ -106,6 +113,7 @@ static struct acpi_scan_handler container_handler = { | |||
106 | .hotplug = { | 113 | .hotplug = { |
107 | .enabled = true, | 114 | .enabled = true, |
108 | .demand_offline = true, | 115 | .demand_offline = true, |
116 | .notify_online = container_device_online, | ||
109 | }, | 117 | }, |
110 | }; | 118 | }; |
111 | 119 | ||
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 9922cc46b15c..cb6066c809ea 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -1030,6 +1030,10 @@ static struct dmi_system_id ec_dmi_table[] __initdata = { | |||
1030 | DMI_MATCH(DMI_SYS_VENDOR, "Quanta"), | 1030 | DMI_MATCH(DMI_SYS_VENDOR, "Quanta"), |
1031 | DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL}, | 1031 | DMI_MATCH(DMI_PRODUCT_NAME, "TW9/SW9"),}, NULL}, |
1032 | { | 1032 | { |
1033 | ec_flag_msi, "Clevo W350etq", { | ||
1034 | DMI_MATCH(DMI_SYS_VENDOR, "CLEVO CO."), | ||
1035 | DMI_MATCH(DMI_PRODUCT_NAME, "W35_37ET"),}, NULL}, | ||
1036 | { | ||
1033 | ec_validate_ecdt, "ASUS hardware", { | 1037 | ec_validate_ecdt, "ASUS hardware", { |
1034 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, | 1038 | DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, |
1035 | { | 1039 | { |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 3dca36d4ad26..17f9ec501972 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -1071,9 +1071,9 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1071 | 1071 | ||
1072 | if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { | 1072 | if (pr->id == 0 && cpuidle_get_driver() == &acpi_idle_driver) { |
1073 | 1073 | ||
1074 | cpuidle_pause_and_lock(); | ||
1075 | /* Protect against cpu-hotplug */ | 1074 | /* Protect against cpu-hotplug */ |
1076 | get_online_cpus(); | 1075 | get_online_cpus(); |
1076 | cpuidle_pause_and_lock(); | ||
1077 | 1077 | ||
1078 | /* Disable all cpuidle devices */ | 1078 | /* Disable all cpuidle devices */ |
1079 | for_each_online_cpu(cpu) { | 1079 | for_each_online_cpu(cpu) { |
@@ -1100,8 +1100,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | |||
1100 | cpuidle_enable_device(dev); | 1100 | cpuidle_enable_device(dev); |
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | put_online_cpus(); | ||
1104 | cpuidle_resume_and_unlock(); | 1103 | cpuidle_resume_and_unlock(); |
1104 | put_online_cpus(); | ||
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | return 0; | 1107 | return 0; |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 9a9298994e26..ae44d8654c82 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -130,7 +130,7 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { | 130 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { |
131 | count = snprintf(&modalias[len], size, "%s:", id->id); | 131 | count = snprintf(&modalias[len], size, "%s:", id->id); |
132 | if (count < 0) | 132 | if (count < 0) |
133 | return EINVAL; | 133 | return -EINVAL; |
134 | if (count >= size) | 134 | if (count >= size) |
135 | return -ENOMEM; | 135 | return -ENOMEM; |
136 | len += count; | 136 | len += count; |
@@ -667,8 +667,14 @@ static ssize_t | |||
667 | acpi_device_sun_show(struct device *dev, struct device_attribute *attr, | 667 | acpi_device_sun_show(struct device *dev, struct device_attribute *attr, |
668 | char *buf) { | 668 | char *buf) { |
669 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 669 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
670 | acpi_status status; | ||
671 | unsigned long long sun; | ||
672 | |||
673 | status = acpi_evaluate_integer(acpi_dev->handle, "_SUN", NULL, &sun); | ||
674 | if (ACPI_FAILURE(status)) | ||
675 | return -ENODEV; | ||
670 | 676 | ||
671 | return sprintf(buf, "%lu\n", acpi_dev->pnp.sun); | 677 | return sprintf(buf, "%llu\n", sun); |
672 | } | 678 | } |
673 | static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); | 679 | static DEVICE_ATTR(sun, 0444, acpi_device_sun_show, NULL); |
674 | 680 | ||
@@ -690,7 +696,6 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
690 | { | 696 | { |
691 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 697 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; |
692 | acpi_status status; | 698 | acpi_status status; |
693 | unsigned long long sun; | ||
694 | int result = 0; | 699 | int result = 0; |
695 | 700 | ||
696 | /* | 701 | /* |
@@ -731,14 +736,10 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
731 | if (dev->pnp.unique_id) | 736 | if (dev->pnp.unique_id) |
732 | result = device_create_file(&dev->dev, &dev_attr_uid); | 737 | result = device_create_file(&dev->dev, &dev_attr_uid); |
733 | 738 | ||
734 | status = acpi_evaluate_integer(dev->handle, "_SUN", NULL, &sun); | 739 | if (acpi_has_method(dev->handle, "_SUN")) { |
735 | if (ACPI_SUCCESS(status)) { | ||
736 | dev->pnp.sun = (unsigned long)sun; | ||
737 | result = device_create_file(&dev->dev, &dev_attr_sun); | 740 | result = device_create_file(&dev->dev, &dev_attr_sun); |
738 | if (result) | 741 | if (result) |
739 | goto end; | 742 | goto end; |
740 | } else { | ||
741 | dev->pnp.sun = (unsigned long)-1; | ||
742 | } | 743 | } |
743 | 744 | ||
744 | if (acpi_has_method(dev->handle, "_STA")) { | 745 | if (acpi_has_method(dev->handle, "_STA")) { |
@@ -2188,6 +2189,9 @@ static void acpi_bus_attach(struct acpi_device *device) | |||
2188 | ok: | 2189 | ok: |
2189 | list_for_each_entry(child, &device->children, node) | 2190 | list_for_each_entry(child, &device->children, node) |
2190 | acpi_bus_attach(child); | 2191 | acpi_bus_attach(child); |
2192 | |||
2193 | if (device->handler && device->handler->hotplug.notify_online) | ||
2194 | device->handler->hotplug.notify_online(device); | ||
2191 | } | 2195 | } |
2192 | 2196 | ||
2193 | /** | 2197 | /** |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 826884392e6b..8e7e18567ae6 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -82,9 +82,9 @@ module_param(allow_duplicates, bool, 0644); | |||
82 | * For Windows 8 systems: used to decide if video module | 82 | * For Windows 8 systems: used to decide if video module |
83 | * should skip registering backlight interface of its own. | 83 | * should skip registering backlight interface of its own. |
84 | */ | 84 | */ |
85 | static int use_native_backlight_param = 1; | 85 | static int use_native_backlight_param = -1; |
86 | module_param_named(use_native_backlight, use_native_backlight_param, int, 0444); | 86 | module_param_named(use_native_backlight, use_native_backlight_param, int, 0444); |
87 | static bool use_native_backlight_dmi = false; | 87 | static bool use_native_backlight_dmi = true; |
88 | 88 | ||
89 | static int register_count; | 89 | static int register_count; |
90 | static struct mutex video_list_lock; | 90 | static struct mutex video_list_lock; |
@@ -417,6 +417,12 @@ static int __init video_set_use_native_backlight(const struct dmi_system_id *d) | |||
417 | return 0; | 417 | return 0; |
418 | } | 418 | } |
419 | 419 | ||
420 | static int __init video_disable_native_backlight(const struct dmi_system_id *d) | ||
421 | { | ||
422 | use_native_backlight_dmi = false; | ||
423 | return 0; | ||
424 | } | ||
425 | |||
420 | static struct dmi_system_id video_dmi_table[] __initdata = { | 426 | static struct dmi_system_id video_dmi_table[] __initdata = { |
421 | /* | 427 | /* |
422 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 | 428 | * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 |
@@ -720,6 +726,49 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
720 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), | 726 | DMI_MATCH(DMI_PRODUCT_NAME, "HP EliteBook 8780w"), |
721 | }, | 727 | }, |
722 | }, | 728 | }, |
729 | |||
730 | /* | ||
731 | * These models have a working acpi_video backlight control, and using | ||
732 | * native backlight causes a regression where backlight does not work | ||
733 | * when userspace is not handling brightness key events. Disable | ||
734 | * native_backlight on these to fix this: | ||
735 | * https://bugzilla.kernel.org/show_bug.cgi?id=81691 | ||
736 | */ | ||
737 | { | ||
738 | .callback = video_disable_native_backlight, | ||
739 | .ident = "ThinkPad T420", | ||
740 | .matches = { | ||
741 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
742 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T420"), | ||
743 | }, | ||
744 | }, | ||
745 | { | ||
746 | .callback = video_disable_native_backlight, | ||
747 | .ident = "ThinkPad T520", | ||
748 | .matches = { | ||
749 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
750 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"), | ||
751 | }, | ||
752 | }, | ||
753 | { | ||
754 | .callback = video_disable_native_backlight, | ||
755 | .ident = "ThinkPad X201s", | ||
756 | .matches = { | ||
757 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
758 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X201s"), | ||
759 | }, | ||
760 | }, | ||
761 | |||
762 | /* The native backlight controls do not work on some older machines */ | ||
763 | { | ||
764 | /* https://bugs.freedesktop.org/show_bug.cgi?id=81515 */ | ||
765 | .callback = video_disable_native_backlight, | ||
766 | .ident = "HP ENVY 15 Notebook", | ||
767 | .matches = { | ||
768 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
769 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ENVY 15 Notebook PC"), | ||
770 | }, | ||
771 | }, | ||
723 | {} | 772 | {} |
724 | }; | 773 | }; |
725 | 774 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index a29f8012fb08..a0cc0edafc78 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -305,6 +305,14 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
305 | { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ | 305 | { PCI_VDEVICE(INTEL, 0x9c85), board_ahci }, /* Wildcat Point-LP RAID */ |
306 | { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ | 306 | { PCI_VDEVICE(INTEL, 0x9c87), board_ahci }, /* Wildcat Point-LP RAID */ |
307 | { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ | 307 | { PCI_VDEVICE(INTEL, 0x9c8f), board_ahci }, /* Wildcat Point-LP RAID */ |
308 | { PCI_VDEVICE(INTEL, 0x8c82), board_ahci }, /* 9 Series AHCI */ | ||
309 | { PCI_VDEVICE(INTEL, 0x8c83), board_ahci }, /* 9 Series AHCI */ | ||
310 | { PCI_VDEVICE(INTEL, 0x8c84), board_ahci }, /* 9 Series RAID */ | ||
311 | { PCI_VDEVICE(INTEL, 0x8c85), board_ahci }, /* 9 Series RAID */ | ||
312 | { PCI_VDEVICE(INTEL, 0x8c86), board_ahci }, /* 9 Series RAID */ | ||
313 | { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ | ||
314 | { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ | ||
315 | { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ | ||
308 | 316 | ||
309 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 317 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
310 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 318 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -442,6 +450,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
442 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), | 450 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x917a), |
443 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | 451 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ |
444 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172), | 452 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9172), |
453 | .driver_data = board_ahci_yes_fbs }, /* 88se9182 */ | ||
454 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9182), | ||
445 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | 455 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ |
446 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), | 456 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192), |
447 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ | 457 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */ |
@@ -1329,6 +1339,18 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1329 | else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) | 1339 | else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) |
1330 | ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; | 1340 | ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; |
1331 | 1341 | ||
1342 | /* | ||
1343 | * The JMicron chip 361/363 contains one SATA controller and one | ||
1344 | * PATA controller,for powering on these both controllers, we must | ||
1345 | * follow the sequence one by one, otherwise one of them can not be | ||
1346 | * powered on successfully, so here we disable the async suspend | ||
1347 | * method for these chips. | ||
1348 | */ | ||
1349 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && | ||
1350 | (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 || | ||
1351 | pdev->device == PCI_DEVICE_ID_JMICRON_JMB361)) | ||
1352 | device_disable_async_suspend(&pdev->dev); | ||
1353 | |||
1332 | /* acquire resources */ | 1354 | /* acquire resources */ |
1333 | rc = pcim_enable_device(pdev); | 1355 | rc = pcim_enable_device(pdev); |
1334 | if (rc) | 1356 | if (rc) |
diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c index f1fef74e503c..032904402c95 100644 --- a/drivers/ata/ahci_tegra.c +++ b/drivers/ata/ahci_tegra.c | |||
@@ -18,14 +18,17 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/ahci_platform.h> | 20 | #include <linux/ahci_platform.h> |
21 | #include <linux/reset.h> | ||
22 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
23 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
24 | #include <linux/module.h> | 23 | #include <linux/module.h> |
25 | #include <linux/of_device.h> | 24 | #include <linux/of_device.h> |
26 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
27 | #include <linux/regulator/consumer.h> | 26 | #include <linux/regulator/consumer.h> |
27 | #include <linux/reset.h> | ||
28 | |||
29 | #include <soc/tegra/fuse.h> | ||
28 | #include <soc/tegra/pmc.h> | 30 | #include <soc/tegra/pmc.h> |
31 | |||
29 | #include "ahci.h" | 32 | #include "ahci.h" |
30 | 33 | ||
31 | #define SATA_CONFIGURATION_0 0x180 | 34 | #define SATA_CONFIGURATION_0 0x180 |
@@ -180,9 +183,12 @@ static int tegra_ahci_controller_init(struct ahci_host_priv *hpriv) | |||
180 | 183 | ||
181 | /* Pad calibration */ | 184 | /* Pad calibration */ |
182 | 185 | ||
183 | /* FIXME Always use calibration 0. Change this to read the calibration | 186 | ret = tegra_fuse_readl(FUSE_SATA_CALIB, &val); |
184 | * fuse once the fuse driver has landed. */ | 187 | if (ret) { |
185 | val = 0; | 188 | dev_err(&tegra->pdev->dev, |
189 | "failed to read calibration fuse: %d\n", ret); | ||
190 | return ret; | ||
191 | } | ||
186 | 192 | ||
187 | calib = tegra124_pad_calibration[val & FUSE_SATA_CALIB_MASK]; | 193 | calib = tegra124_pad_calibration[val & FUSE_SATA_CALIB_MASK]; |
188 | 194 | ||
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index c6962300b93c..f03aab187f4d 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c | |||
@@ -78,6 +78,9 @@ | |||
78 | #define CFG_MEM_RAM_SHUTDOWN 0x00000070 | 78 | #define CFG_MEM_RAM_SHUTDOWN 0x00000070 |
79 | #define BLOCK_MEM_RDY 0x00000074 | 79 | #define BLOCK_MEM_RDY 0x00000074 |
80 | 80 | ||
81 | /* Max retry for link down */ | ||
82 | #define MAX_LINK_DOWN_RETRY 3 | ||
83 | |||
81 | struct xgene_ahci_context { | 84 | struct xgene_ahci_context { |
82 | struct ahci_host_priv *hpriv; | 85 | struct ahci_host_priv *hpriv; |
83 | struct device *dev; | 86 | struct device *dev; |
@@ -145,6 +148,14 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) | |||
145 | return rc; | 148 | return rc; |
146 | } | 149 | } |
147 | 150 | ||
151 | static bool xgene_ahci_is_memram_inited(struct xgene_ahci_context *ctx) | ||
152 | { | ||
153 | void __iomem *diagcsr = ctx->csr_diag; | ||
154 | |||
155 | return (readl(diagcsr + CFG_MEM_RAM_SHUTDOWN) == 0 && | ||
156 | readl(diagcsr + BLOCK_MEM_RDY) == 0xFFFFFFFF); | ||
157 | } | ||
158 | |||
148 | /** | 159 | /** |
149 | * xgene_ahci_read_id - Read ID data from the specified device | 160 | * xgene_ahci_read_id - Read ID data from the specified device |
150 | * @dev: device | 161 | * @dev: device |
@@ -229,8 +240,11 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel) | |||
229 | * and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will | 240 | * and Gen1 (1.5Gbps). Otherwise during long IO stress test, the PHY will |
230 | * report disparity error and etc. In addition, during COMRESET, there can | 241 | * report disparity error and etc. In addition, during COMRESET, there can |
231 | * be error reported in the register PORT_SCR_ERR. For SERR_DISPARITY and | 242 | * be error reported in the register PORT_SCR_ERR. For SERR_DISPARITY and |
232 | * SERR_10B_8B_ERR, the PHY receiver line must be reseted. The following | 243 | * SERR_10B_8B_ERR, the PHY receiver line must be reseted. Also during long |
233 | * algorithm is followed to proper configure the hardware PHY during COMRESET: | 244 | * reboot cycle regression, sometimes the PHY reports link down even if the |
245 | * device is present because of speed negotiation failure. so need to retry | ||
246 | * the COMRESET to get the link up. The following algorithm is followed to | ||
247 | * proper configure the hardware PHY during COMRESET: | ||
234 | * | 248 | * |
235 | * Alg Part 1: | 249 | * Alg Part 1: |
236 | * 1. Start the PHY at Gen3 speed (default setting) | 250 | * 1. Start the PHY at Gen3 speed (default setting) |
@@ -246,9 +260,15 @@ static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel) | |||
246 | * Alg Part 2: | 260 | * Alg Part 2: |
247 | * 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error | 261 | * 1. On link up, if there are any SERR_DISPARITY and SERR_10B_8B_ERR error |
248 | * reported in the register PORT_SCR_ERR, then reset the PHY receiver line | 262 | * reported in the register PORT_SCR_ERR, then reset the PHY receiver line |
249 | * 2. Go to Alg Part 3 | 263 | * 2. Go to Alg Part 4 |
250 | * | 264 | * |
251 | * Alg Part 3: | 265 | * Alg Part 3: |
266 | * 1. Check the PORT_SCR_STAT to see whether device presence detected but PHY | ||
267 | * communication establishment failed and maximum link down attempts are | ||
268 | * less than Max attempts 3 then goto Alg Part 1. | ||
269 | * 2. Go to Alg Part 4. | ||
270 | * | ||
271 | * Alg Part 4: | ||
252 | * 1. Clear any pending from register PORT_SCR_ERR. | 272 | * 1. Clear any pending from register PORT_SCR_ERR. |
253 | * | 273 | * |
254 | * NOTE: For the initial version, we will NOT support Gen1/Gen2. In addition | 274 | * NOTE: For the initial version, we will NOT support Gen1/Gen2. In addition |
@@ -267,19 +287,27 @@ static int xgene_ahci_do_hardreset(struct ata_link *link, | |||
267 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; | 287 | u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG; |
268 | void __iomem *port_mmio = ahci_port_base(ap); | 288 | void __iomem *port_mmio = ahci_port_base(ap); |
269 | struct ata_taskfile tf; | 289 | struct ata_taskfile tf; |
290 | int link_down_retry = 0; | ||
270 | int rc; | 291 | int rc; |
271 | u32 val; | 292 | u32 val, sstatus; |
272 | 293 | ||
273 | /* clear D2H reception area to properly wait for D2H FIS */ | 294 | do { |
274 | ata_tf_init(link->device, &tf); | 295 | /* clear D2H reception area to properly wait for D2H FIS */ |
275 | tf.command = ATA_BUSY; | 296 | ata_tf_init(link->device, &tf); |
276 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); | 297 | tf.command = ATA_BUSY; |
277 | rc = sata_link_hardreset(link, timing, deadline, online, | 298 | ata_tf_to_fis(&tf, 0, 0, d2h_fis); |
299 | rc = sata_link_hardreset(link, timing, deadline, online, | ||
278 | ahci_check_ready); | 300 | ahci_check_ready); |
301 | if (*online) { | ||
302 | val = readl(port_mmio + PORT_SCR_ERR); | ||
303 | if (val & (SERR_DISPARITY | SERR_10B_8B_ERR)) | ||
304 | dev_warn(ctx->dev, "link has error\n"); | ||
305 | break; | ||
306 | } | ||
279 | 307 | ||
280 | val = readl(port_mmio + PORT_SCR_ERR); | 308 | sata_scr_read(link, SCR_STATUS, &sstatus); |
281 | if (val & (SERR_DISPARITY | SERR_10B_8B_ERR)) | 309 | } while (link_down_retry++ < MAX_LINK_DOWN_RETRY && |
282 | dev_warn(ctx->dev, "link has error\n"); | 310 | (sstatus & 0xff) == 0x1); |
283 | 311 | ||
284 | /* clear all errors if any pending */ | 312 | /* clear all errors if any pending */ |
285 | val = readl(port_mmio + PORT_SCR_ERR); | 313 | val = readl(port_mmio + PORT_SCR_ERR); |
@@ -467,6 +495,11 @@ static int xgene_ahci_probe(struct platform_device *pdev) | |||
467 | return -ENODEV; | 495 | return -ENODEV; |
468 | } | 496 | } |
469 | 497 | ||
498 | if (xgene_ahci_is_memram_inited(ctx)) { | ||
499 | dev_info(dev, "skip clock and PHY initialization\n"); | ||
500 | goto skip_clk_phy; | ||
501 | } | ||
502 | |||
470 | /* Due to errata, HW requires full toggle transition */ | 503 | /* Due to errata, HW requires full toggle transition */ |
471 | rc = ahci_platform_enable_clks(hpriv); | 504 | rc = ahci_platform_enable_clks(hpriv); |
472 | if (rc) | 505 | if (rc) |
@@ -479,7 +512,7 @@ static int xgene_ahci_probe(struct platform_device *pdev) | |||
479 | 512 | ||
480 | /* Configure the host controller */ | 513 | /* Configure the host controller */ |
481 | xgene_ahci_hw_init(hpriv); | 514 | xgene_ahci_hw_init(hpriv); |
482 | 515 | skip_clk_phy: | |
483 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ; | 516 | hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ; |
484 | 517 | ||
485 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); | 518 | rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info); |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 893e30e9a9ef..ffbe625e6fd2 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -340,6 +340,14 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
340 | { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, | 340 | { 0x8086, 0x0F21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_byt }, |
341 | /* SATA Controller IDE (Coleto Creek) */ | 341 | /* SATA Controller IDE (Coleto Creek) */ |
342 | { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 342 | { 0x8086, 0x23a6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
343 | /* SATA Controller IDE (9 Series) */ | ||
344 | { 0x8086, 0x8c88, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, | ||
345 | /* SATA Controller IDE (9 Series) */ | ||
346 | { 0x8086, 0x8c89, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata_snb }, | ||
347 | /* SATA Controller IDE (9 Series) */ | ||
348 | { 0x8086, 0x8c80, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, | ||
349 | /* SATA Controller IDE (9 Series) */ | ||
350 | { 0x8086, 0x8c81, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb }, | ||
343 | 351 | ||
344 | { } /* terminate list */ | 352 | { } /* terminate list */ |
345 | }; | 353 | }; |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 4d1a5d2c4287..47e418b8c8ba 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -143,6 +143,18 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
143 | }; | 143 | }; |
144 | const struct ata_port_info *ppi[] = { &info, NULL }; | 144 | const struct ata_port_info *ppi[] = { &info, NULL }; |
145 | 145 | ||
146 | /* | ||
147 | * The JMicron chip 361/363 contains one SATA controller and one | ||
148 | * PATA controller,for powering on these both controllers, we must | ||
149 | * follow the sequence one by one, otherwise one of them can not be | ||
150 | * powered on successfully, so here we disable the async suspend | ||
151 | * method for these chips. | ||
152 | */ | ||
153 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && | ||
154 | (pdev->device == PCI_DEVICE_ID_JMICRON_JMB363 || | ||
155 | pdev->device == PCI_DEVICE_ID_JMICRON_JMB361)) | ||
156 | device_disable_async_suspend(&pdev->dev); | ||
157 | |||
146 | return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); | 158 | return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); |
147 | } | 159 | } |
148 | 160 | ||
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index 7d1326985bee..bfc90b8547f2 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h | |||
@@ -146,6 +146,9 @@ struct regcache_ops { | |||
146 | enum regcache_type type; | 146 | enum regcache_type type; |
147 | int (*init)(struct regmap *map); | 147 | int (*init)(struct regmap *map); |
148 | int (*exit)(struct regmap *map); | 148 | int (*exit)(struct regmap *map); |
149 | #ifdef CONFIG_DEBUG_FS | ||
150 | void (*debugfs_init)(struct regmap *map); | ||
151 | #endif | ||
149 | int (*read)(struct regmap *map, unsigned int reg, unsigned int *value); | 152 | int (*read)(struct regmap *map, unsigned int reg, unsigned int *value); |
150 | int (*write)(struct regmap *map, unsigned int reg, unsigned int value); | 153 | int (*write)(struct regmap *map, unsigned int reg, unsigned int value); |
151 | int (*sync)(struct regmap *map, unsigned int min, unsigned int max); | 154 | int (*sync)(struct regmap *map, unsigned int min, unsigned int max); |
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index 6a7e4fa12854..f3e8fe0cc650 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -194,10 +194,6 @@ static void rbtree_debugfs_init(struct regmap *map) | |||
194 | { | 194 | { |
195 | debugfs_create_file("rbtree", 0400, map->debugfs, map, &rbtree_fops); | 195 | debugfs_create_file("rbtree", 0400, map->debugfs, map, &rbtree_fops); |
196 | } | 196 | } |
197 | #else | ||
198 | static void rbtree_debugfs_init(struct regmap *map) | ||
199 | { | ||
200 | } | ||
201 | #endif | 197 | #endif |
202 | 198 | ||
203 | static int regcache_rbtree_init(struct regmap *map) | 199 | static int regcache_rbtree_init(struct regmap *map) |
@@ -222,8 +218,6 @@ static int regcache_rbtree_init(struct regmap *map) | |||
222 | goto err; | 218 | goto err; |
223 | } | 219 | } |
224 | 220 | ||
225 | rbtree_debugfs_init(map); | ||
226 | |||
227 | return 0; | 221 | return 0; |
228 | 222 | ||
229 | err: | 223 | err: |
@@ -532,6 +526,9 @@ struct regcache_ops regcache_rbtree_ops = { | |||
532 | .name = "rbtree", | 526 | .name = "rbtree", |
533 | .init = regcache_rbtree_init, | 527 | .init = regcache_rbtree_init, |
534 | .exit = regcache_rbtree_exit, | 528 | .exit = regcache_rbtree_exit, |
529 | #ifdef CONFIG_DEBUG_FS | ||
530 | .debugfs_init = rbtree_debugfs_init, | ||
531 | #endif | ||
535 | .read = regcache_rbtree_read, | 532 | .read = regcache_rbtree_read, |
536 | .write = regcache_rbtree_write, | 533 | .write = regcache_rbtree_write, |
537 | .sync = regcache_rbtree_sync, | 534 | .sync = regcache_rbtree_sync, |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 29b4128da0b0..5617da6dc898 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -698,7 +698,7 @@ int regcache_sync_block(struct regmap *map, void *block, | |||
698 | unsigned int block_base, unsigned int start, | 698 | unsigned int block_base, unsigned int start, |
699 | unsigned int end) | 699 | unsigned int end) |
700 | { | 700 | { |
701 | if (regmap_can_raw_write(map)) | 701 | if (regmap_can_raw_write(map) && !map->use_single_rw) |
702 | return regcache_sync_block_raw(map, block, cache_present, | 702 | return regcache_sync_block_raw(map, block, cache_present, |
703 | block_base, start, end); | 703 | block_base, start, end); |
704 | else | 704 | else |
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 45d812c0ea77..0c94b661c16f 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -512,7 +512,14 @@ void regmap_debugfs_init(struct regmap *map, const char *name) | |||
512 | map, ®map_reg_ranges_fops); | 512 | map, ®map_reg_ranges_fops); |
513 | 513 | ||
514 | if (map->max_register || regmap_readable(map, 0)) { | 514 | if (map->max_register || regmap_readable(map, 0)) { |
515 | debugfs_create_file("registers", 0400, map->debugfs, | 515 | umode_t registers_mode; |
516 | |||
517 | if (IS_ENABLED(REGMAP_ALLOW_WRITE_DEBUGFS)) | ||
518 | registers_mode = 0600; | ||
519 | else | ||
520 | registers_mode = 0400; | ||
521 | |||
522 | debugfs_create_file("registers", registers_mode, map->debugfs, | ||
516 | map, ®map_map_fops); | 523 | map, ®map_map_fops); |
517 | debugfs_create_file("access", 0400, map->debugfs, | 524 | debugfs_create_file("access", 0400, map->debugfs, |
518 | map, ®map_access_fops); | 525 | map, ®map_access_fops); |
@@ -538,6 +545,9 @@ void regmap_debugfs_init(struct regmap *map, const char *name) | |||
538 | 545 | ||
539 | next = rb_next(&range_node->node); | 546 | next = rb_next(&range_node->node); |
540 | } | 547 | } |
548 | |||
549 | if (map->cache_ops && map->cache_ops->debugfs_init) | ||
550 | map->cache_ops->debugfs_init(map); | ||
541 | } | 551 | } |
542 | 552 | ||
543 | void regmap_debugfs_exit(struct regmap *map) | 553 | void regmap_debugfs_exit(struct regmap *map) |
diff --git a/drivers/base/regmap/regmap-i2c.c b/drivers/base/regmap/regmap-i2c.c index ca193d1ef47c..053150a7f9f2 100644 --- a/drivers/base/regmap/regmap-i2c.c +++ b/drivers/base/regmap/regmap-i2c.c | |||
@@ -168,6 +168,8 @@ static struct regmap_bus regmap_i2c = { | |||
168 | .write = regmap_i2c_write, | 168 | .write = regmap_i2c_write, |
169 | .gather_write = regmap_i2c_gather_write, | 169 | .gather_write = regmap_i2c_gather_write, |
170 | .read = regmap_i2c_read, | 170 | .read = regmap_i2c_read, |
171 | .reg_format_endian_default = REGMAP_ENDIAN_BIG, | ||
172 | .val_format_endian_default = REGMAP_ENDIAN_BIG, | ||
171 | }; | 173 | }; |
172 | 174 | ||
173 | static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c, | 175 | static const struct regmap_bus *regmap_get_i2c_bus(struct i2c_client *i2c, |
diff --git a/drivers/base/regmap/regmap-spi.c b/drivers/base/regmap/regmap-spi.c index 0eb3097c0d76..53d1148e80a0 100644 --- a/drivers/base/regmap/regmap-spi.c +++ b/drivers/base/regmap/regmap-spi.c | |||
@@ -109,6 +109,8 @@ static struct regmap_bus regmap_spi = { | |||
109 | .async_alloc = regmap_spi_async_alloc, | 109 | .async_alloc = regmap_spi_async_alloc, |
110 | .read = regmap_spi_read, | 110 | .read = regmap_spi_read, |
111 | .read_flag_mask = 0x80, | 111 | .read_flag_mask = 0x80, |
112 | .reg_format_endian_default = REGMAP_ENDIAN_BIG, | ||
113 | .val_format_endian_default = REGMAP_ENDIAN_BIG, | ||
112 | }; | 114 | }; |
113 | 115 | ||
114 | /** | 116 | /** |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 78f43fb2fe84..f2281af24ec6 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/export.h> | 15 | #include <linux/export.h> |
16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/of.h> | ||
18 | #include <linux/rbtree.h> | 19 | #include <linux/rbtree.h> |
19 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
20 | 21 | ||
@@ -109,7 +110,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg) | |||
109 | 110 | ||
110 | bool regmap_volatile(struct regmap *map, unsigned int reg) | 111 | bool regmap_volatile(struct regmap *map, unsigned int reg) |
111 | { | 112 | { |
112 | if (!regmap_readable(map, reg)) | 113 | if (!map->format.format_write && !regmap_readable(map, reg)) |
113 | return false; | 114 | return false; |
114 | 115 | ||
115 | if (map->volatile_reg) | 116 | if (map->volatile_reg) |
@@ -448,6 +449,66 @@ int regmap_attach_dev(struct device *dev, struct regmap *map, | |||
448 | } | 449 | } |
449 | EXPORT_SYMBOL_GPL(regmap_attach_dev); | 450 | EXPORT_SYMBOL_GPL(regmap_attach_dev); |
450 | 451 | ||
452 | static enum regmap_endian regmap_get_reg_endian(const struct regmap_bus *bus, | ||
453 | const struct regmap_config *config) | ||
454 | { | ||
455 | enum regmap_endian endian; | ||
456 | |||
457 | /* Retrieve the endianness specification from the regmap config */ | ||
458 | endian = config->reg_format_endian; | ||
459 | |||
460 | /* If the regmap config specified a non-default value, use that */ | ||
461 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
462 | return endian; | ||
463 | |||
464 | /* Retrieve the endianness specification from the bus config */ | ||
465 | if (bus && bus->reg_format_endian_default) | ||
466 | endian = bus->reg_format_endian_default; | ||
467 | |||
468 | /* If the bus specified a non-default value, use that */ | ||
469 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
470 | return endian; | ||
471 | |||
472 | /* Use this if no other value was found */ | ||
473 | return REGMAP_ENDIAN_BIG; | ||
474 | } | ||
475 | |||
476 | static enum regmap_endian regmap_get_val_endian(struct device *dev, | ||
477 | const struct regmap_bus *bus, | ||
478 | const struct regmap_config *config) | ||
479 | { | ||
480 | struct device_node *np = dev->of_node; | ||
481 | enum regmap_endian endian; | ||
482 | |||
483 | /* Retrieve the endianness specification from the regmap config */ | ||
484 | endian = config->val_format_endian; | ||
485 | |||
486 | /* If the regmap config specified a non-default value, use that */ | ||
487 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
488 | return endian; | ||
489 | |||
490 | /* Parse the device's DT node for an endianness specification */ | ||
491 | if (of_property_read_bool(np, "big-endian")) | ||
492 | endian = REGMAP_ENDIAN_BIG; | ||
493 | else if (of_property_read_bool(np, "little-endian")) | ||
494 | endian = REGMAP_ENDIAN_LITTLE; | ||
495 | |||
496 | /* If the endianness was specified in DT, use that */ | ||
497 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
498 | return endian; | ||
499 | |||
500 | /* Retrieve the endianness specification from the bus config */ | ||
501 | if (bus && bus->val_format_endian_default) | ||
502 | endian = bus->val_format_endian_default; | ||
503 | |||
504 | /* If the bus specified a non-default value, use that */ | ||
505 | if (endian != REGMAP_ENDIAN_DEFAULT) | ||
506 | return endian; | ||
507 | |||
508 | /* Use this if no other value was found */ | ||
509 | return REGMAP_ENDIAN_BIG; | ||
510 | } | ||
511 | |||
451 | /** | 512 | /** |
452 | * regmap_init(): Initialise register map | 513 | * regmap_init(): Initialise register map |
453 | * | 514 | * |
@@ -551,17 +612,8 @@ struct regmap *regmap_init(struct device *dev, | |||
551 | map->reg_read = _regmap_bus_read; | 612 | map->reg_read = _regmap_bus_read; |
552 | } | 613 | } |
553 | 614 | ||
554 | reg_endian = config->reg_format_endian; | 615 | reg_endian = regmap_get_reg_endian(bus, config); |
555 | if (reg_endian == REGMAP_ENDIAN_DEFAULT) | 616 | val_endian = regmap_get_val_endian(dev, bus, config); |
556 | reg_endian = bus->reg_format_endian_default; | ||
557 | if (reg_endian == REGMAP_ENDIAN_DEFAULT) | ||
558 | reg_endian = REGMAP_ENDIAN_BIG; | ||
559 | |||
560 | val_endian = config->val_format_endian; | ||
561 | if (val_endian == REGMAP_ENDIAN_DEFAULT) | ||
562 | val_endian = bus->val_format_endian_default; | ||
563 | if (val_endian == REGMAP_ENDIAN_DEFAULT) | ||
564 | val_endian = REGMAP_ENDIAN_BIG; | ||
565 | 617 | ||
566 | switch (config->reg_bits + map->reg_shift) { | 618 | switch (config->reg_bits + map->reg_shift) { |
567 | case 2: | 619 | case 2: |
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c index 294a7dd25190..f032ed6dd459 100644 --- a/drivers/bcma/host_pci.c +++ b/drivers/bcma/host_pci.c | |||
@@ -282,6 +282,7 @@ static const struct pci_device_id bcma_pci_bridge_tbl[] = { | |||
282 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, | 282 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, |
283 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, | 283 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, |
284 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, | 284 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, |
285 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */ | ||
285 | { 0, }, | 286 | { 0, }, |
286 | }; | 287 | }; |
287 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); | 288 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index db1e9560d8a7..5c8e7fe07745 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -3918,7 +3918,6 @@ skip_create_disk: | |||
3918 | if (rv) { | 3918 | if (rv) { |
3919 | dev_err(&dd->pdev->dev, | 3919 | dev_err(&dd->pdev->dev, |
3920 | "Unable to allocate request queue\n"); | 3920 | "Unable to allocate request queue\n"); |
3921 | rv = -ENOMEM; | ||
3922 | goto block_queue_alloc_init_error; | 3921 | goto block_queue_alloc_init_error; |
3923 | } | 3922 | } |
3924 | 3923 | ||
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index a3b042c4d448..00d469c7f9f7 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -462,17 +462,21 @@ static int null_add_dev(void) | |||
462 | struct gendisk *disk; | 462 | struct gendisk *disk; |
463 | struct nullb *nullb; | 463 | struct nullb *nullb; |
464 | sector_t size; | 464 | sector_t size; |
465 | int rv; | ||
465 | 466 | ||
466 | nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, home_node); | 467 | nullb = kzalloc_node(sizeof(*nullb), GFP_KERNEL, home_node); |
467 | if (!nullb) | 468 | if (!nullb) { |
469 | rv = -ENOMEM; | ||
468 | goto out; | 470 | goto out; |
471 | } | ||
469 | 472 | ||
470 | spin_lock_init(&nullb->lock); | 473 | spin_lock_init(&nullb->lock); |
471 | 474 | ||
472 | if (queue_mode == NULL_Q_MQ && use_per_node_hctx) | 475 | if (queue_mode == NULL_Q_MQ && use_per_node_hctx) |
473 | submit_queues = nr_online_nodes; | 476 | submit_queues = nr_online_nodes; |
474 | 477 | ||
475 | if (setup_queues(nullb)) | 478 | rv = setup_queues(nullb); |
479 | if (rv) | ||
476 | goto out_free_nullb; | 480 | goto out_free_nullb; |
477 | 481 | ||
478 | if (queue_mode == NULL_Q_MQ) { | 482 | if (queue_mode == NULL_Q_MQ) { |
@@ -484,22 +488,29 @@ static int null_add_dev(void) | |||
484 | nullb->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; | 488 | nullb->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; |
485 | nullb->tag_set.driver_data = nullb; | 489 | nullb->tag_set.driver_data = nullb; |
486 | 490 | ||
487 | if (blk_mq_alloc_tag_set(&nullb->tag_set)) | 491 | rv = blk_mq_alloc_tag_set(&nullb->tag_set); |
492 | if (rv) | ||
488 | goto out_cleanup_queues; | 493 | goto out_cleanup_queues; |
489 | 494 | ||
490 | nullb->q = blk_mq_init_queue(&nullb->tag_set); | 495 | nullb->q = blk_mq_init_queue(&nullb->tag_set); |
491 | if (!nullb->q) | 496 | if (!nullb->q) { |
497 | rv = -ENOMEM; | ||
492 | goto out_cleanup_tags; | 498 | goto out_cleanup_tags; |
499 | } | ||
493 | } else if (queue_mode == NULL_Q_BIO) { | 500 | } else if (queue_mode == NULL_Q_BIO) { |
494 | nullb->q = blk_alloc_queue_node(GFP_KERNEL, home_node); | 501 | nullb->q = blk_alloc_queue_node(GFP_KERNEL, home_node); |
495 | if (!nullb->q) | 502 | if (!nullb->q) { |
503 | rv = -ENOMEM; | ||
496 | goto out_cleanup_queues; | 504 | goto out_cleanup_queues; |
505 | } | ||
497 | blk_queue_make_request(nullb->q, null_queue_bio); | 506 | blk_queue_make_request(nullb->q, null_queue_bio); |
498 | init_driver_queues(nullb); | 507 | init_driver_queues(nullb); |
499 | } else { | 508 | } else { |
500 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); | 509 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); |
501 | if (!nullb->q) | 510 | if (!nullb->q) { |
511 | rv = -ENOMEM; | ||
502 | goto out_cleanup_queues; | 512 | goto out_cleanup_queues; |
513 | } | ||
503 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); | 514 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); |
504 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); | 515 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); |
505 | init_driver_queues(nullb); | 516 | init_driver_queues(nullb); |
@@ -509,8 +520,10 @@ static int null_add_dev(void) | |||
509 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q); | 520 | queue_flag_set_unlocked(QUEUE_FLAG_NONROT, nullb->q); |
510 | 521 | ||
511 | disk = nullb->disk = alloc_disk_node(1, home_node); | 522 | disk = nullb->disk = alloc_disk_node(1, home_node); |
512 | if (!disk) | 523 | if (!disk) { |
524 | rv = -ENOMEM; | ||
513 | goto out_cleanup_blk_queue; | 525 | goto out_cleanup_blk_queue; |
526 | } | ||
514 | 527 | ||
515 | mutex_lock(&lock); | 528 | mutex_lock(&lock); |
516 | list_add_tail(&nullb->list, &nullb_list); | 529 | list_add_tail(&nullb->list, &nullb_list); |
@@ -544,7 +557,7 @@ out_cleanup_queues: | |||
544 | out_free_nullb: | 557 | out_free_nullb: |
545 | kfree(nullb); | 558 | kfree(nullb); |
546 | out: | 559 | out: |
547 | return -ENOMEM; | 560 | return rv; |
548 | } | 561 | } |
549 | 562 | ||
550 | static int __init null_init(void) | 563 | static int __init null_init(void) |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 623c84145b79..4b97baf8afa3 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -5087,9 +5087,11 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) | |||
5087 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); | 5087 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); |
5088 | set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); | 5088 | set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); |
5089 | 5089 | ||
5090 | rbd_dev->rq_wq = alloc_workqueue(rbd_dev->disk->disk_name, 0, 0); | 5090 | rbd_dev->rq_wq = alloc_workqueue("%s", 0, 0, rbd_dev->disk->disk_name); |
5091 | if (!rbd_dev->rq_wq) | 5091 | if (!rbd_dev->rq_wq) { |
5092 | ret = -ENOMEM; | ||
5092 | goto err_out_mapping; | 5093 | goto err_out_mapping; |
5094 | } | ||
5093 | 5095 | ||
5094 | ret = rbd_bus_add_dev(rbd_dev); | 5096 | ret = rbd_bus_add_dev(rbd_dev); |
5095 | if (ret) | 5097 | if (ret) |
diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c index 6f550d9e7a2d..a60f26400705 100644 --- a/drivers/bus/arm-ccn.c +++ b/drivers/bus/arm-ccn.c | |||
@@ -586,6 +586,30 @@ static int arm_ccn_pmu_type_eq(u32 a, u32 b) | |||
586 | return 0; | 586 | return 0; |
587 | } | 587 | } |
588 | 588 | ||
589 | static void arm_ccn_pmu_event_destroy(struct perf_event *event) | ||
590 | { | ||
591 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
592 | struct hw_perf_event *hw = &event->hw; | ||
593 | |||
594 | if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) { | ||
595 | clear_bit(CCN_IDX_PMU_CYCLE_COUNTER, ccn->dt.pmu_counters_mask); | ||
596 | } else { | ||
597 | struct arm_ccn_component *source = | ||
598 | ccn->dt.pmu_counters[hw->idx].source; | ||
599 | |||
600 | if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP && | ||
601 | CCN_CONFIG_EVENT(event->attr.config) == | ||
602 | CCN_EVENT_WATCHPOINT) | ||
603 | clear_bit(hw->config_base, source->xp.dt_cmp_mask); | ||
604 | else | ||
605 | clear_bit(hw->config_base, source->pmu_events_mask); | ||
606 | clear_bit(hw->idx, ccn->dt.pmu_counters_mask); | ||
607 | } | ||
608 | |||
609 | ccn->dt.pmu_counters[hw->idx].source = NULL; | ||
610 | ccn->dt.pmu_counters[hw->idx].event = NULL; | ||
611 | } | ||
612 | |||
589 | static int arm_ccn_pmu_event_init(struct perf_event *event) | 613 | static int arm_ccn_pmu_event_init(struct perf_event *event) |
590 | { | 614 | { |
591 | struct arm_ccn *ccn; | 615 | struct arm_ccn *ccn; |
@@ -599,6 +623,7 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) | |||
599 | return -ENOENT; | 623 | return -ENOENT; |
600 | 624 | ||
601 | ccn = pmu_to_arm_ccn(event->pmu); | 625 | ccn = pmu_to_arm_ccn(event->pmu); |
626 | event->destroy = arm_ccn_pmu_event_destroy; | ||
602 | 627 | ||
603 | if (hw->sample_period) { | 628 | if (hw->sample_period) { |
604 | dev_warn(ccn->dev, "Sampling not supported!\n"); | 629 | dev_warn(ccn->dev, "Sampling not supported!\n"); |
@@ -731,30 +756,6 @@ static int arm_ccn_pmu_event_init(struct perf_event *event) | |||
731 | return 0; | 756 | return 0; |
732 | } | 757 | } |
733 | 758 | ||
734 | static void arm_ccn_pmu_event_free(struct perf_event *event) | ||
735 | { | ||
736 | struct arm_ccn *ccn = pmu_to_arm_ccn(event->pmu); | ||
737 | struct hw_perf_event *hw = &event->hw; | ||
738 | |||
739 | if (hw->idx == CCN_IDX_PMU_CYCLE_COUNTER) { | ||
740 | clear_bit(CCN_IDX_PMU_CYCLE_COUNTER, ccn->dt.pmu_counters_mask); | ||
741 | } else { | ||
742 | struct arm_ccn_component *source = | ||
743 | ccn->dt.pmu_counters[hw->idx].source; | ||
744 | |||
745 | if (CCN_CONFIG_TYPE(event->attr.config) == CCN_TYPE_XP && | ||
746 | CCN_CONFIG_EVENT(event->attr.config) == | ||
747 | CCN_EVENT_WATCHPOINT) | ||
748 | clear_bit(hw->config_base, source->xp.dt_cmp_mask); | ||
749 | else | ||
750 | clear_bit(hw->config_base, source->pmu_events_mask); | ||
751 | clear_bit(hw->idx, ccn->dt.pmu_counters_mask); | ||
752 | } | ||
753 | |||
754 | ccn->dt.pmu_counters[hw->idx].source = NULL; | ||
755 | ccn->dt.pmu_counters[hw->idx].event = NULL; | ||
756 | } | ||
757 | |||
758 | static u64 arm_ccn_pmu_read_counter(struct arm_ccn *ccn, int idx) | 759 | static u64 arm_ccn_pmu_read_counter(struct arm_ccn *ccn, int idx) |
759 | { | 760 | { |
760 | u64 res; | 761 | u64 res; |
@@ -1027,8 +1028,6 @@ static int arm_ccn_pmu_event_add(struct perf_event *event, int flags) | |||
1027 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) | 1028 | static void arm_ccn_pmu_event_del(struct perf_event *event, int flags) |
1028 | { | 1029 | { |
1029 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); | 1030 | arm_ccn_pmu_event_stop(event, PERF_EF_UPDATE); |
1030 | |||
1031 | arm_ccn_pmu_event_free(event); | ||
1032 | } | 1031 | } |
1033 | 1032 | ||
1034 | static void arm_ccn_pmu_event_read(struct perf_event *event) | 1033 | static void arm_ccn_pmu_event_read(struct perf_event *event) |
diff --git a/drivers/bus/omap_l3_noc.h b/drivers/bus/omap_l3_noc.h index 551e01061434..95254585db86 100644 --- a/drivers/bus/omap_l3_noc.h +++ b/drivers/bus/omap_l3_noc.h | |||
@@ -188,31 +188,31 @@ static struct l3_flagmux_data omap_l3_flagmux_clk3 = { | |||
188 | }; | 188 | }; |
189 | 189 | ||
190 | static struct l3_masters_data omap_l3_masters[] = { | 190 | static struct l3_masters_data omap_l3_masters[] = { |
191 | { 0x0 , "MPU"}, | 191 | { 0x00, "MPU"}, |
192 | { 0x10, "CS_ADP"}, | 192 | { 0x04, "CS_ADP"}, |
193 | { 0x14, "xxx"}, | 193 | { 0x05, "xxx"}, |
194 | { 0x20, "DSP"}, | 194 | { 0x08, "DSP"}, |
195 | { 0x30, "IVAHD"}, | 195 | { 0x0C, "IVAHD"}, |
196 | { 0x40, "ISS"}, | 196 | { 0x10, "ISS"}, |
197 | { 0x44, "DucatiM3"}, | 197 | { 0x11, "DucatiM3"}, |
198 | { 0x48, "FaceDetect"}, | 198 | { 0x12, "FaceDetect"}, |
199 | { 0x50, "SDMA_Rd"}, | 199 | { 0x14, "SDMA_Rd"}, |
200 | { 0x54, "SDMA_Wr"}, | 200 | { 0x15, "SDMA_Wr"}, |
201 | { 0x58, "xxx"}, | 201 | { 0x16, "xxx"}, |
202 | { 0x5C, "xxx"}, | 202 | { 0x17, "xxx"}, |
203 | { 0x60, "SGX"}, | 203 | { 0x18, "SGX"}, |
204 | { 0x70, "DSS"}, | 204 | { 0x1C, "DSS"}, |
205 | { 0x80, "C2C"}, | 205 | { 0x20, "C2C"}, |
206 | { 0x88, "xxx"}, | 206 | { 0x22, "xxx"}, |
207 | { 0x8C, "xxx"}, | 207 | { 0x23, "xxx"}, |
208 | { 0x90, "HSI"}, | 208 | { 0x24, "HSI"}, |
209 | { 0xA0, "MMC1"}, | 209 | { 0x28, "MMC1"}, |
210 | { 0xA4, "MMC2"}, | 210 | { 0x29, "MMC2"}, |
211 | { 0xA8, "MMC6"}, | 211 | { 0x2A, "MMC6"}, |
212 | { 0xB0, "UNIPRO1"}, | 212 | { 0x2C, "UNIPRO1"}, |
213 | { 0xC0, "USBHOSTHS"}, | 213 | { 0x30, "USBHOSTHS"}, |
214 | { 0xC4, "USBOTGHS"}, | 214 | { 0x31, "USBOTGHS"}, |
215 | { 0xC8, "USBHOSTFS"} | 215 | { 0x32, "USBHOSTFS"} |
216 | }; | 216 | }; |
217 | 217 | ||
218 | static struct l3_flagmux_data *omap_l3_flagmux[] = { | 218 | static struct l3_flagmux_data *omap_l3_flagmux[] = { |
diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c index 2e3139eda93b..132c9ccfdc62 100644 --- a/drivers/char/hw_random/virtio-rng.c +++ b/drivers/char/hw_random/virtio-rng.c | |||
@@ -36,6 +36,7 @@ struct virtrng_info { | |||
36 | int index; | 36 | int index; |
37 | bool busy; | 37 | bool busy; |
38 | bool hwrng_register_done; | 38 | bool hwrng_register_done; |
39 | bool hwrng_removed; | ||
39 | }; | 40 | }; |
40 | 41 | ||
41 | 42 | ||
@@ -68,6 +69,9 @@ static int virtio_read(struct hwrng *rng, void *buf, size_t size, bool wait) | |||
68 | int ret; | 69 | int ret; |
69 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; | 70 | struct virtrng_info *vi = (struct virtrng_info *)rng->priv; |
70 | 71 | ||
72 | if (vi->hwrng_removed) | ||
73 | return -ENODEV; | ||
74 | |||
71 | if (!vi->busy) { | 75 | if (!vi->busy) { |
72 | vi->busy = true; | 76 | vi->busy = true; |
73 | init_completion(&vi->have_data); | 77 | init_completion(&vi->have_data); |
@@ -137,6 +141,9 @@ static void remove_common(struct virtio_device *vdev) | |||
137 | { | 141 | { |
138 | struct virtrng_info *vi = vdev->priv; | 142 | struct virtrng_info *vi = vdev->priv; |
139 | 143 | ||
144 | vi->hwrng_removed = true; | ||
145 | vi->data_avail = 0; | ||
146 | complete(&vi->have_data); | ||
140 | vdev->config->reset(vdev); | 147 | vdev->config->reset(vdev); |
141 | vi->busy = false; | 148 | vi->busy = false; |
142 | if (vi->hwrng_register_done) | 149 | if (vi->hwrng_register_done) |
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c index 0300c46ee247..32f7c1b36204 100644 --- a/drivers/clk/at91/clk-slow.c +++ b/drivers/clk/at91/clk-slow.c | |||
@@ -447,7 +447,7 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np, | |||
447 | int i; | 447 | int i; |
448 | 448 | ||
449 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); | 449 | num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); |
450 | if (num_parents <= 0 || num_parents > 1) | 450 | if (num_parents != 2) |
451 | return; | 451 | return; |
452 | 452 | ||
453 | for (i = 0; i < num_parents; ++i) { | 453 | for (i = 0; i < num_parents; ++i) { |
diff --git a/drivers/clk/clk-efm32gg.c b/drivers/clk/clk-efm32gg.c index bac2ddf49d02..73a8d0ff530c 100644 --- a/drivers/clk/clk-efm32gg.c +++ b/drivers/clk/clk-efm32gg.c | |||
@@ -22,7 +22,7 @@ static struct clk_onecell_data clk_data = { | |||
22 | .clk_num = ARRAY_SIZE(clk), | 22 | .clk_num = ARRAY_SIZE(clk), |
23 | }; | 23 | }; |
24 | 24 | ||
25 | static int __init efm32gg_cmu_init(struct device_node *np) | 25 | static void __init efm32gg_cmu_init(struct device_node *np) |
26 | { | 26 | { |
27 | int i; | 27 | int i; |
28 | void __iomem *base; | 28 | void __iomem *base; |
@@ -33,7 +33,7 @@ static int __init efm32gg_cmu_init(struct device_node *np) | |||
33 | base = of_iomap(np, 0); | 33 | base = of_iomap(np, 0); |
34 | if (!base) { | 34 | if (!base) { |
35 | pr_warn("Failed to map address range for efm32gg,cmu node\n"); | 35 | pr_warn("Failed to map address range for efm32gg,cmu node\n"); |
36 | return -EADDRNOTAVAIL; | 36 | return; |
37 | } | 37 | } |
38 | 38 | ||
39 | clk[clk_HFXO] = clk_register_fixed_rate(NULL, "HFXO", NULL, | 39 | clk[clk_HFXO] = clk_register_fixed_rate(NULL, "HFXO", NULL, |
@@ -76,6 +76,6 @@ static int __init efm32gg_cmu_init(struct device_node *np) | |||
76 | clk[clk_HFPERCLKDAC0] = clk_register_gate(NULL, "HFPERCLK.DAC0", | 76 | clk[clk_HFPERCLKDAC0] = clk_register_gate(NULL, "HFPERCLK.DAC0", |
77 | "HFXO", 0, base + CMU_HFPERCLKEN0, 17, 0, NULL); | 77 | "HFXO", 0, base + CMU_HFPERCLKEN0, 17, 0, NULL); |
78 | 78 | ||
79 | return of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); | 79 | of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); |
80 | } | 80 | } |
81 | CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); | 81 | CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index b76fa69b44cb..bacc06ff939b 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1467,6 +1467,7 @@ static struct clk *clk_propagate_rate_change(struct clk *clk, unsigned long even | |||
1467 | static void clk_change_rate(struct clk *clk) | 1467 | static void clk_change_rate(struct clk *clk) |
1468 | { | 1468 | { |
1469 | struct clk *child; | 1469 | struct clk *child; |
1470 | struct hlist_node *tmp; | ||
1470 | unsigned long old_rate; | 1471 | unsigned long old_rate; |
1471 | unsigned long best_parent_rate = 0; | 1472 | unsigned long best_parent_rate = 0; |
1472 | bool skip_set_rate = false; | 1473 | bool skip_set_rate = false; |
@@ -1502,7 +1503,11 @@ static void clk_change_rate(struct clk *clk) | |||
1502 | if (clk->notifier_count && old_rate != clk->rate) | 1503 | if (clk->notifier_count && old_rate != clk->rate) |
1503 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); | 1504 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); |
1504 | 1505 | ||
1505 | hlist_for_each_entry(child, &clk->children, child_node) { | 1506 | /* |
1507 | * Use safe iteration, as change_rate can actually swap parents | ||
1508 | * for certain clock types. | ||
1509 | */ | ||
1510 | hlist_for_each_entry_safe(child, tmp, &clk->children, child_node) { | ||
1506 | /* Skip children who will be reparented to another clock */ | 1511 | /* Skip children who will be reparented to another clock */ |
1507 | if (child->new_parent && child->new_parent != clk) | 1512 | if (child->new_parent && child->new_parent != clk) |
1508 | continue; | 1513 | continue; |
diff --git a/drivers/clk/qcom/gcc-ipq806x.c b/drivers/clk/qcom/gcc-ipq806x.c index 4032e510d9aa..3b83b7dd78c7 100644 --- a/drivers/clk/qcom/gcc-ipq806x.c +++ b/drivers/clk/qcom/gcc-ipq806x.c | |||
@@ -1095,7 +1095,7 @@ static struct clk_branch prng_clk = { | |||
1095 | }; | 1095 | }; |
1096 | 1096 | ||
1097 | static const struct freq_tbl clk_tbl_sdc[] = { | 1097 | static const struct freq_tbl clk_tbl_sdc[] = { |
1098 | { 144000, P_PXO, 5, 18,625 }, | 1098 | { 200000, P_PXO, 2, 2, 125 }, |
1099 | { 400000, P_PLL8, 4, 1, 240 }, | 1099 | { 400000, P_PLL8, 4, 1, 240 }, |
1100 | { 16000000, P_PLL8, 4, 1, 6 }, | 1100 | { 16000000, P_PLL8, 4, 1, 6 }, |
1101 | { 17070000, P_PLL8, 1, 2, 45 }, | 1101 | { 17070000, P_PLL8, 1, 2, 45 }, |
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c index 0d8c6c59a75e..b22a2d2f21e9 100644 --- a/drivers/clk/rockchip/clk-rk3288.c +++ b/drivers/clk/rockchip/clk-rk3288.c | |||
@@ -545,7 +545,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { | |||
545 | GATE(PCLK_PWM, "pclk_pwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 0, GFLAGS), | 545 | GATE(PCLK_PWM, "pclk_pwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 0, GFLAGS), |
546 | GATE(PCLK_TIMER, "pclk_timer", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 1, GFLAGS), | 546 | GATE(PCLK_TIMER, "pclk_timer", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 1, GFLAGS), |
547 | GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 2, GFLAGS), | 547 | GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 2, GFLAGS), |
548 | GATE(PCLK_I2C1, "pclk_i2c1", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 3, GFLAGS), | 548 | GATE(PCLK_I2C2, "pclk_i2c2", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 3, GFLAGS), |
549 | GATE(0, "pclk_ddrupctl0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 14, GFLAGS), | 549 | GATE(0, "pclk_ddrupctl0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 14, GFLAGS), |
550 | GATE(0, "pclk_publ0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 15, GFLAGS), | 550 | GATE(0, "pclk_publ0", "pclk_cpu", 0, RK3288_CLKGATE_CON(10), 15, GFLAGS), |
551 | GATE(0, "pclk_ddrupctl1", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 0, GFLAGS), | 551 | GATE(0, "pclk_ddrupctl1", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 0, GFLAGS), |
@@ -603,7 +603,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { | |||
603 | GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 15, GFLAGS), | 603 | GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 15, GFLAGS), |
604 | GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 11, GFLAGS), | 604 | GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 11, GFLAGS), |
605 | GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 12, GFLAGS), | 605 | GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 12, GFLAGS), |
606 | GATE(PCLK_I2C2, "pclk_i2c2", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 13, GFLAGS), | 606 | GATE(PCLK_I2C1, "pclk_i2c1", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 13, GFLAGS), |
607 | GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 14, GFLAGS), | 607 | GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 0, RK3288_CLKGATE_CON(6), 14, GFLAGS), |
608 | GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 1, GFLAGS), | 608 | GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 1, GFLAGS), |
609 | GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 2, GFLAGS), | 609 | GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 0, RK3288_CLKGATE_CON(7), 2, GFLAGS), |
diff --git a/drivers/clk/ti/clk-dra7-atl.c b/drivers/clk/ti/clk-dra7-atl.c index 4a65b410e4d5..af29359677da 100644 --- a/drivers/clk/ti/clk-dra7-atl.c +++ b/drivers/clk/ti/clk-dra7-atl.c | |||
@@ -139,9 +139,13 @@ static long atl_clk_round_rate(struct clk_hw *hw, unsigned long rate, | |||
139 | static int atl_clk_set_rate(struct clk_hw *hw, unsigned long rate, | 139 | static int atl_clk_set_rate(struct clk_hw *hw, unsigned long rate, |
140 | unsigned long parent_rate) | 140 | unsigned long parent_rate) |
141 | { | 141 | { |
142 | struct dra7_atl_desc *cdesc = to_atl_desc(hw); | 142 | struct dra7_atl_desc *cdesc; |
143 | u32 divider; | 143 | u32 divider; |
144 | 144 | ||
145 | if (!hw || !rate) | ||
146 | return -EINVAL; | ||
147 | |||
148 | cdesc = to_atl_desc(hw); | ||
145 | divider = ((parent_rate + rate / 2) / rate) - 1; | 149 | divider = ((parent_rate + rate / 2) / rate) - 1; |
146 | if (divider > DRA7_ATL_DIVIDER_MASK) | 150 | if (divider > DRA7_ATL_DIVIDER_MASK) |
147 | divider = DRA7_ATL_DIVIDER_MASK; | 151 | divider = DRA7_ATL_DIVIDER_MASK; |
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index e6aa10db7bba..a837f703be65 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c | |||
@@ -211,11 +211,16 @@ static long ti_clk_divider_round_rate(struct clk_hw *hw, unsigned long rate, | |||
211 | static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, | 211 | static int ti_clk_divider_set_rate(struct clk_hw *hw, unsigned long rate, |
212 | unsigned long parent_rate) | 212 | unsigned long parent_rate) |
213 | { | 213 | { |
214 | struct clk_divider *divider = to_clk_divider(hw); | 214 | struct clk_divider *divider; |
215 | unsigned int div, value; | 215 | unsigned int div, value; |
216 | unsigned long flags = 0; | 216 | unsigned long flags = 0; |
217 | u32 val; | 217 | u32 val; |
218 | 218 | ||
219 | if (!hw || !rate) | ||
220 | return -EINVAL; | ||
221 | |||
222 | divider = to_clk_divider(hw); | ||
223 | |||
219 | div = DIV_ROUND_UP(parent_rate, rate); | 224 | div = DIV_ROUND_UP(parent_rate, rate); |
220 | value = _get_val(divider, div); | 225 | value = _get_val(divider, div); |
221 | 226 | ||
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d9fdeddcef96..61190f6b4829 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1289,6 +1289,8 @@ err_get_freq: | |||
1289 | per_cpu(cpufreq_cpu_data, j) = NULL; | 1289 | per_cpu(cpufreq_cpu_data, j) = NULL; |
1290 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1290 | write_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1291 | 1291 | ||
1292 | up_write(&policy->rwsem); | ||
1293 | |||
1292 | if (cpufreq_driver->exit) | 1294 | if (cpufreq_driver->exit) |
1293 | cpufreq_driver->exit(policy); | 1295 | cpufreq_driver->exit(policy); |
1294 | err_set_policy_cpu: | 1296 | err_set_policy_cpu: |
@@ -1657,7 +1659,7 @@ void cpufreq_suspend(void) | |||
1657 | return; | 1659 | return; |
1658 | 1660 | ||
1659 | if (!has_target()) | 1661 | if (!has_target()) |
1660 | return; | 1662 | goto suspend; |
1661 | 1663 | ||
1662 | pr_debug("%s: Suspending Governors\n", __func__); | 1664 | pr_debug("%s: Suspending Governors\n", __func__); |
1663 | 1665 | ||
@@ -1671,6 +1673,7 @@ void cpufreq_suspend(void) | |||
1671 | policy); | 1673 | policy); |
1672 | } | 1674 | } |
1673 | 1675 | ||
1676 | suspend: | ||
1674 | cpufreq_suspended = true; | 1677 | cpufreq_suspended = true; |
1675 | } | 1678 | } |
1676 | 1679 | ||
@@ -1687,13 +1690,13 @@ void cpufreq_resume(void) | |||
1687 | if (!cpufreq_driver) | 1690 | if (!cpufreq_driver) |
1688 | return; | 1691 | return; |
1689 | 1692 | ||
1693 | cpufreq_suspended = false; | ||
1694 | |||
1690 | if (!has_target()) | 1695 | if (!has_target()) |
1691 | return; | 1696 | return; |
1692 | 1697 | ||
1693 | pr_debug("%s: Resuming Governors\n", __func__); | 1698 | pr_debug("%s: Resuming Governors\n", __func__); |
1694 | 1699 | ||
1695 | cpufreq_suspended = false; | ||
1696 | |||
1697 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { | 1700 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { |
1698 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) | 1701 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) |
1699 | pr_err("%s: Failed to resume driver: %p\n", __func__, | 1702 | pr_err("%s: Failed to resume driver: %p\n", __func__, |
diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index f7a32d2326c6..773bcde893c0 100644 --- a/drivers/cpufreq/cpufreq_opp.c +++ b/drivers/cpufreq/cpufreq_opp.c | |||
@@ -60,7 +60,7 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, | |||
60 | goto out; | 60 | goto out; |
61 | } | 61 | } |
62 | 62 | ||
63 | freq_table = kcalloc(sizeof(*freq_table), (max_opps + 1), GFP_ATOMIC); | 63 | freq_table = kcalloc((max_opps + 1), sizeof(*freq_table), GFP_ATOMIC); |
64 | if (!freq_table) { | 64 | if (!freq_table) { |
65 | ret = -ENOMEM; | 65 | ret = -ENOMEM; |
66 | goto out; | 66 | goto out; |
diff --git a/drivers/cpufreq/integrator-cpufreq.c b/drivers/cpufreq/integrator-cpufreq.c index c1320528b9d0..6bd69adc3c5e 100644 --- a/drivers/cpufreq/integrator-cpufreq.c +++ b/drivers/cpufreq/integrator-cpufreq.c | |||
@@ -213,9 +213,9 @@ static int __init integrator_cpufreq_probe(struct platform_device *pdev) | |||
213 | return cpufreq_register_driver(&integrator_driver); | 213 | return cpufreq_register_driver(&integrator_driver); |
214 | } | 214 | } |
215 | 215 | ||
216 | static void __exit integrator_cpufreq_remove(struct platform_device *pdev) | 216 | static int __exit integrator_cpufreq_remove(struct platform_device *pdev) |
217 | { | 217 | { |
218 | cpufreq_unregister_driver(&integrator_driver); | 218 | return cpufreq_unregister_driver(&integrator_driver); |
219 | } | 219 | } |
220 | 220 | ||
221 | static const struct of_device_id integrator_cpufreq_match[] = { | 221 | static const struct of_device_id integrator_cpufreq_match[] = { |
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index e396ad3f8f3f..0668b389c516 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c | |||
@@ -708,10 +708,6 @@ static unsigned int intel_pstate_get(unsigned int cpu_num) | |||
708 | 708 | ||
709 | static int intel_pstate_set_policy(struct cpufreq_policy *policy) | 709 | static int intel_pstate_set_policy(struct cpufreq_policy *policy) |
710 | { | 710 | { |
711 | struct cpudata *cpu; | ||
712 | |||
713 | cpu = all_cpu_data[policy->cpu]; | ||
714 | |||
715 | if (!policy->cpuinfo.max_freq) | 711 | if (!policy->cpuinfo.max_freq) |
716 | return -ENODEV; | 712 | return -ENODEV; |
717 | 713 | ||
diff --git a/drivers/cpufreq/pcc-cpufreq.c b/drivers/cpufreq/pcc-cpufreq.c index 728a2d879499..4d2c8e861089 100644 --- a/drivers/cpufreq/pcc-cpufreq.c +++ b/drivers/cpufreq/pcc-cpufreq.c | |||
@@ -204,7 +204,6 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy, | |||
204 | u32 input_buffer; | 204 | u32 input_buffer; |
205 | int cpu; | 205 | int cpu; |
206 | 206 | ||
207 | spin_lock(&pcc_lock); | ||
208 | cpu = policy->cpu; | 207 | cpu = policy->cpu; |
209 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); | 208 | pcc_cpu_data = per_cpu_ptr(pcc_cpu_info, cpu); |
210 | 209 | ||
@@ -216,6 +215,7 @@ static int pcc_cpufreq_target(struct cpufreq_policy *policy, | |||
216 | freqs.old = policy->cur; | 215 | freqs.old = policy->cur; |
217 | freqs.new = target_freq; | 216 | freqs.new = target_freq; |
218 | cpufreq_freq_transition_begin(policy, &freqs); | 217 | cpufreq_freq_transition_begin(policy, &freqs); |
218 | spin_lock(&pcc_lock); | ||
219 | 219 | ||
220 | input_buffer = 0x1 | (((target_freq * 100) | 220 | input_buffer = 0x1 | (((target_freq * 100) |
221 | / (ioread32(&pcch_hdr->nominal) * 1000)) << 8); | 221 | / (ioread32(&pcch_hdr->nominal) * 1000)) << 8); |
diff --git a/drivers/crypto/ccp/ccp-crypto-main.c b/drivers/crypto/ccp/ccp-crypto-main.c index 20dc848481e7..4d4e016d755b 100644 --- a/drivers/crypto/ccp/ccp-crypto-main.c +++ b/drivers/crypto/ccp/ccp-crypto-main.c | |||
@@ -367,6 +367,10 @@ static int ccp_crypto_init(void) | |||
367 | { | 367 | { |
368 | int ret; | 368 | int ret; |
369 | 369 | ||
370 | ret = ccp_present(); | ||
371 | if (ret) | ||
372 | return ret; | ||
373 | |||
370 | spin_lock_init(&req_queue_lock); | 374 | spin_lock_init(&req_queue_lock); |
371 | INIT_LIST_HEAD(&req_queue.cmds); | 375 | INIT_LIST_HEAD(&req_queue.cmds); |
372 | req_queue.backlog = &req_queue.cmds; | 376 | req_queue.backlog = &req_queue.cmds; |
diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c index a7d110652a74..c6e6171eb6d3 100644 --- a/drivers/crypto/ccp/ccp-dev.c +++ b/drivers/crypto/ccp/ccp-dev.c | |||
@@ -55,6 +55,20 @@ static inline void ccp_del_device(struct ccp_device *ccp) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * ccp_present - check if a CCP device is present | ||
59 | * | ||
60 | * Returns zero if a CCP device is present, -ENODEV otherwise. | ||
61 | */ | ||
62 | int ccp_present(void) | ||
63 | { | ||
64 | if (ccp_get_device()) | ||
65 | return 0; | ||
66 | |||
67 | return -ENODEV; | ||
68 | } | ||
69 | EXPORT_SYMBOL_GPL(ccp_present); | ||
70 | |||
71 | /** | ||
58 | * ccp_enqueue_cmd - queue an operation for processing by the CCP | 72 | * ccp_enqueue_cmd - queue an operation for processing by the CCP |
59 | * | 73 | * |
60 | * @cmd: ccp_cmd struct to be processed | 74 | * @cmd: ccp_cmd struct to be processed |
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h index b707f292b377..65dd1ff93d3b 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h +++ b/drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.h | |||
@@ -66,7 +66,7 @@ | |||
66 | #define ADF_DH895XCC_ETR_MAX_BANKS 32 | 66 | #define ADF_DH895XCC_ETR_MAX_BANKS 32 |
67 | #define ADF_DH895XCC_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28) | 67 | #define ADF_DH895XCC_SMIAPF0_MASK_OFFSET (0x3A000 + 0x28) |
68 | #define ADF_DH895XCC_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30) | 68 | #define ADF_DH895XCC_SMIAPF1_MASK_OFFSET (0x3A000 + 0x30) |
69 | #define ADF_DH895XCC_SMIA0_MASK 0xFFFF | 69 | #define ADF_DH895XCC_SMIA0_MASK 0xFFFFFFFF |
70 | #define ADF_DH895XCC_SMIA1_MASK 0x1 | 70 | #define ADF_DH895XCC_SMIA1_MASK 0x1 |
71 | /* Error detection and correction */ | 71 | /* Error detection and correction */ |
72 | #define ADF_DH895XCC_AE_CTX_ENABLES(i) (i * 0x1000 + 0x20818) | 72 | #define ADF_DH895XCC_AE_CTX_ENABLES(i) (i * 0x1000 + 0x20818) |
diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c index 6a9d89c93b1f..ae2ab14e64b3 100644 --- a/drivers/dma/dma-jz4740.c +++ b/drivers/dma/dma-jz4740.c | |||
@@ -362,8 +362,9 @@ static void jz4740_dma_chan_irq(struct jz4740_dmaengine_chan *chan) | |||
362 | vchan_cyclic_callback(&chan->desc->vdesc); | 362 | vchan_cyclic_callback(&chan->desc->vdesc); |
363 | } else { | 363 | } else { |
364 | if (chan->next_sg == chan->desc->num_sgs) { | 364 | if (chan->next_sg == chan->desc->num_sgs) { |
365 | chan->desc = NULL; | 365 | list_del(&chan->desc->vdesc.node); |
366 | vchan_cookie_complete(&chan->desc->vdesc); | 366 | vchan_cookie_complete(&chan->desc->vdesc); |
367 | chan->desc = NULL; | ||
367 | } | 368 | } |
368 | } | 369 | } |
369 | } | 370 | } |
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c index 4cf7d9a950d7..bbea8243f9e8 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c | |||
@@ -1017,6 +1017,11 @@ static int omap_dma_resume(struct omap_chan *c) | |||
1017 | return -EINVAL; | 1017 | return -EINVAL; |
1018 | 1018 | ||
1019 | if (c->paused) { | 1019 | if (c->paused) { |
1020 | mb(); | ||
1021 | |||
1022 | /* Restore channel link register */ | ||
1023 | omap_dma_chan_write(c, CLNK_CTRL, c->desc->clnk_ctrl); | ||
1024 | |||
1020 | omap_dma_start(c, c->desc); | 1025 | omap_dma_start(c, c->desc); |
1021 | c->paused = false; | 1026 | c->paused = false; |
1022 | } | 1027 | } |
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile index d8be608a9f3b..aef6a95adef5 100644 --- a/drivers/firmware/efi/Makefile +++ b/drivers/firmware/efi/Makefile | |||
@@ -7,4 +7,4 @@ obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o | |||
7 | obj-$(CONFIG_UEFI_CPER) += cper.o | 7 | obj-$(CONFIG_UEFI_CPER) += cper.o |
8 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o | 8 | obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o |
9 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o | 9 | obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o |
10 | obj-$(CONFIG_EFI_STUB) += libstub/ | 10 | obj-$(CONFIG_EFI_ARM_STUB) += libstub/ |
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index a56bb3528755..c846a9608cbd 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c | |||
@@ -22,7 +22,7 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
22 | unsigned long map_size, unsigned long desc_size, | 22 | unsigned long map_size, unsigned long desc_size, |
23 | u32 desc_ver) | 23 | u32 desc_ver) |
24 | { | 24 | { |
25 | int node, prev; | 25 | int node, prev, num_rsv; |
26 | int status; | 26 | int status; |
27 | u32 fdt_val32; | 27 | u32 fdt_val32; |
28 | u64 fdt_val64; | 28 | u64 fdt_val64; |
@@ -73,6 +73,14 @@ efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, | |||
73 | prev = node; | 73 | prev = node; |
74 | } | 74 | } |
75 | 75 | ||
76 | /* | ||
77 | * Delete all memory reserve map entries. When booting via UEFI, | ||
78 | * kernel will use the UEFI memory map to find reserved regions. | ||
79 | */ | ||
80 | num_rsv = fdt_num_mem_rsv(fdt); | ||
81 | while (num_rsv-- > 0) | ||
82 | fdt_del_mem_rsv(fdt, num_rsv); | ||
83 | |||
76 | node = fdt_subnode_offset(fdt, 0, "chosen"); | 84 | node = fdt_subnode_offset(fdt, 0, "chosen"); |
77 | if (node < 0) { | 85 | if (node < 0) { |
78 | node = fdt_add_subnode(fdt, 0, "chosen"); | 86 | node = fdt_add_subnode(fdt, 0, "chosen"); |
diff --git a/drivers/gpio/gpio-bt8xx.c b/drivers/gpio/gpio-bt8xx.c index 6557147d9331..7e4c43c18960 100644 --- a/drivers/gpio/gpio-bt8xx.c +++ b/drivers/gpio/gpio-bt8xx.c | |||
@@ -241,9 +241,6 @@ static void bt8xxgpio_remove(struct pci_dev *pdev) | |||
241 | bgwrite(~0x0, BT848_INT_STAT); | 241 | bgwrite(~0x0, BT848_INT_STAT); |
242 | bgwrite(0x0, BT848_GPIO_OUT_EN); | 242 | bgwrite(0x0, BT848_GPIO_OUT_EN); |
243 | 243 | ||
244 | iounmap(bg->mmio); | ||
245 | release_mem_region(pci_resource_start(pdev, 0), | ||
246 | pci_resource_len(pdev, 0)); | ||
247 | pci_disable_device(pdev); | 244 | pci_disable_device(pdev); |
248 | } | 245 | } |
249 | 246 | ||
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index d62eaaa75397..687476fb39e3 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -377,8 +377,10 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, | |||
377 | struct gpio_chip *chip = achip->chip; | 377 | struct gpio_chip *chip = achip->chip; |
378 | struct acpi_resource_gpio *agpio; | 378 | struct acpi_resource_gpio *agpio; |
379 | struct acpi_resource *ares; | 379 | struct acpi_resource *ares; |
380 | int pin_index = (int)address; | ||
380 | acpi_status status; | 381 | acpi_status status; |
381 | bool pull_up; | 382 | bool pull_up; |
383 | int length; | ||
382 | int i; | 384 | int i; |
383 | 385 | ||
384 | status = acpi_buffer_to_resource(achip->conn_info.connection, | 386 | status = acpi_buffer_to_resource(achip->conn_info.connection, |
@@ -400,7 +402,8 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, | |||
400 | return AE_BAD_PARAMETER; | 402 | return AE_BAD_PARAMETER; |
401 | } | 403 | } |
402 | 404 | ||
403 | for (i = 0; i < agpio->pin_table_length; i++) { | 405 | length = min(agpio->pin_table_length, (u16)(pin_index + bits)); |
406 | for (i = pin_index; i < length; ++i) { | ||
404 | unsigned pin = agpio->pin_table[i]; | 407 | unsigned pin = agpio->pin_table[i]; |
405 | struct acpi_gpio_connection *conn; | 408 | struct acpi_gpio_connection *conn; |
406 | struct gpio_desc *desc; | 409 | struct gpio_desc *desc; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 15cc0bb65dda..c68d037de656 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -413,12 +413,12 @@ void gpiochip_set_chained_irqchip(struct gpio_chip *gpiochip, | |||
413 | return; | 413 | return; |
414 | } | 414 | } |
415 | 415 | ||
416 | irq_set_chained_handler(parent_irq, parent_handler); | ||
417 | /* | 416 | /* |
418 | * The parent irqchip is already using the chip_data for this | 417 | * The parent irqchip is already using the chip_data for this |
419 | * irqchip, so our callbacks simply use the handler_data. | 418 | * irqchip, so our callbacks simply use the handler_data. |
420 | */ | 419 | */ |
421 | irq_set_handler_data(parent_irq, gpiochip); | 420 | irq_set_handler_data(parent_irq, gpiochip); |
421 | irq_set_chained_handler(parent_irq, parent_handler); | ||
422 | } | 422 | } |
423 | EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip); | 423 | EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip); |
424 | 424 | ||
@@ -1674,7 +1674,7 @@ struct gpio_desc *__must_check __gpiod_get_index(struct device *dev, | |||
1674 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); | 1674 | set_bit(FLAG_OPEN_SOURCE, &desc->flags); |
1675 | 1675 | ||
1676 | /* No particular flag request, return here... */ | 1676 | /* No particular flag request, return here... */ |
1677 | if (flags & GPIOD_FLAGS_BIT_DIR_SET) | 1677 | if (!(flags & GPIOD_FLAGS_BIT_DIR_SET)) |
1678 | return desc; | 1678 | return desc; |
1679 | 1679 | ||
1680 | /* Process flags */ | 1680 | /* Process flags */ |
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c index a2cc6be97983..b792194e0d9c 100644 --- a/drivers/gpu/drm/ast/ast_main.c +++ b/drivers/gpu/drm/ast/ast_main.c | |||
@@ -67,6 +67,7 @@ static int ast_detect_chip(struct drm_device *dev) | |||
67 | { | 67 | { |
68 | struct ast_private *ast = dev->dev_private; | 68 | struct ast_private *ast = dev->dev_private; |
69 | uint32_t data, jreg; | 69 | uint32_t data, jreg; |
70 | ast_open_key(ast); | ||
70 | 71 | ||
71 | if (dev->pdev->device == PCI_CHIP_AST1180) { | 72 | if (dev->pdev->device == PCI_CHIP_AST1180) { |
72 | ast->chip = AST1100; | 73 | ast->chip = AST1100; |
@@ -104,7 +105,7 @@ static int ast_detect_chip(struct drm_device *dev) | |||
104 | } | 105 | } |
105 | ast->vga2_clone = false; | 106 | ast->vga2_clone = false; |
106 | } else { | 107 | } else { |
107 | ast->chip = 2000; | 108 | ast->chip = AST2000; |
108 | DRM_INFO("AST 2000 detected\n"); | 109 | DRM_INFO("AST 2000 detected\n"); |
109 | } | 110 | } |
110 | } | 111 | } |
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index 9d7346b92653..6b7efcf363d6 100644 --- a/drivers/gpu/drm/bochs/bochs_kms.c +++ b/drivers/gpu/drm/bochs/bochs_kms.c | |||
@@ -250,6 +250,7 @@ static void bochs_connector_init(struct drm_device *dev) | |||
250 | DRM_MODE_CONNECTOR_VIRTUAL); | 250 | DRM_MODE_CONNECTOR_VIRTUAL); |
251 | drm_connector_helper_add(connector, | 251 | drm_connector_helper_add(connector, |
252 | &bochs_connector_connector_helper_funcs); | 252 | &bochs_connector_connector_helper_funcs); |
253 | drm_connector_register(connector); | ||
253 | } | 254 | } |
254 | 255 | ||
255 | 256 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index e1c5c3222129..c7c5a9d91fa0 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c | |||
@@ -555,6 +555,7 @@ static struct drm_connector *cirrus_vga_init(struct drm_device *dev) | |||
555 | 555 | ||
556 | drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs); | 556 | drm_connector_helper_add(connector, &cirrus_vga_connector_helper_funcs); |
557 | 557 | ||
558 | drm_connector_register(connector); | ||
558 | return connector; | 559 | return connector; |
559 | } | 560 | } |
560 | 561 | ||
diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index dea99d92fb4a..4b7ed5289217 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c | |||
@@ -709,11 +709,13 @@ int i915_cmd_parser_init_ring(struct intel_engine_cs *ring) | |||
709 | BUG_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count)); | 709 | BUG_ON(!validate_cmds_sorted(ring, cmd_tables, cmd_table_count)); |
710 | BUG_ON(!validate_regs_sorted(ring)); | 710 | BUG_ON(!validate_regs_sorted(ring)); |
711 | 711 | ||
712 | ret = init_hash_table(ring, cmd_tables, cmd_table_count); | 712 | if (hash_empty(ring->cmd_hash)) { |
713 | if (ret) { | 713 | ret = init_hash_table(ring, cmd_tables, cmd_table_count); |
714 | DRM_ERROR("CMD: cmd_parser_init failed!\n"); | 714 | if (ret) { |
715 | fini_hash_table(ring); | 715 | DRM_ERROR("CMD: cmd_parser_init failed!\n"); |
716 | return ret; | 716 | fini_hash_table(ring); |
717 | return ret; | ||
718 | } | ||
717 | } | 719 | } |
718 | 720 | ||
719 | ring->needs_cmd_parser = true; | 721 | ring->needs_cmd_parser = true; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 2e7f03ad5ee2..9933c26017ed 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1336,12 +1336,17 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1336 | 1336 | ||
1337 | intel_power_domains_init_hw(dev_priv); | 1337 | intel_power_domains_init_hw(dev_priv); |
1338 | 1338 | ||
1339 | /* | ||
1340 | * We enable some interrupt sources in our postinstall hooks, so mark | ||
1341 | * interrupts as enabled _before_ actually enabling them to avoid | ||
1342 | * special cases in our ordering checks. | ||
1343 | */ | ||
1344 | dev_priv->pm._irqs_disabled = false; | ||
1345 | |||
1339 | ret = drm_irq_install(dev, dev->pdev->irq); | 1346 | ret = drm_irq_install(dev, dev->pdev->irq); |
1340 | if (ret) | 1347 | if (ret) |
1341 | goto cleanup_gem_stolen; | 1348 | goto cleanup_gem_stolen; |
1342 | 1349 | ||
1343 | dev_priv->pm._irqs_disabled = false; | ||
1344 | |||
1345 | /* Important: The output setup functions called by modeset_init need | 1350 | /* Important: The output setup functions called by modeset_init need |
1346 | * working irqs for e.g. gmbus and dp aux transfers. */ | 1351 | * working irqs for e.g. gmbus and dp aux transfers. */ |
1347 | intel_modeset_init(dev); | 1352 | intel_modeset_init(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 7a830eac5ba3..3524306d8cfb 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -184,6 +184,7 @@ enum hpd_pin { | |||
184 | if ((1 << (domain)) & (mask)) | 184 | if ((1 << (domain)) & (mask)) |
185 | 185 | ||
186 | struct drm_i915_private; | 186 | struct drm_i915_private; |
187 | struct i915_mm_struct; | ||
187 | struct i915_mmu_object; | 188 | struct i915_mmu_object; |
188 | 189 | ||
189 | enum intel_dpll_id { | 190 | enum intel_dpll_id { |
@@ -1506,9 +1507,8 @@ struct drm_i915_private { | |||
1506 | struct i915_gtt gtt; /* VM representing the global address space */ | 1507 | struct i915_gtt gtt; /* VM representing the global address space */ |
1507 | 1508 | ||
1508 | struct i915_gem_mm mm; | 1509 | struct i915_gem_mm mm; |
1509 | #if defined(CONFIG_MMU_NOTIFIER) | 1510 | DECLARE_HASHTABLE(mm_structs, 7); |
1510 | DECLARE_HASHTABLE(mmu_notifiers, 7); | 1511 | struct mutex mm_lock; |
1511 | #endif | ||
1512 | 1512 | ||
1513 | /* Kernel Modesetting */ | 1513 | /* Kernel Modesetting */ |
1514 | 1514 | ||
@@ -1814,8 +1814,8 @@ struct drm_i915_gem_object { | |||
1814 | unsigned workers :4; | 1814 | unsigned workers :4; |
1815 | #define I915_GEM_USERPTR_MAX_WORKERS 15 | 1815 | #define I915_GEM_USERPTR_MAX_WORKERS 15 |
1816 | 1816 | ||
1817 | struct mm_struct *mm; | 1817 | struct i915_mm_struct *mm; |
1818 | struct i915_mmu_object *mn; | 1818 | struct i915_mmu_object *mmu_object; |
1819 | struct work_struct *work; | 1819 | struct work_struct *work; |
1820 | } userptr; | 1820 | } userptr; |
1821 | }; | 1821 | }; |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index ba7f5c6bb50d..ad55b06a3cb1 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1590,10 +1590,13 @@ unlock: | |||
1590 | out: | 1590 | out: |
1591 | switch (ret) { | 1591 | switch (ret) { |
1592 | case -EIO: | 1592 | case -EIO: |
1593 | /* If this -EIO is due to a gpu hang, give the reset code a | 1593 | /* |
1594 | * chance to clean up the mess. Otherwise return the proper | 1594 | * We eat errors when the gpu is terminally wedged to avoid |
1595 | * SIGBUS. */ | 1595 | * userspace unduly crashing (gl has no provisions for mmaps to |
1596 | if (i915_terminally_wedged(&dev_priv->gpu_error)) { | 1596 | * fail). But any other -EIO isn't ours (e.g. swap in failure) |
1597 | * and so needs to be reported. | ||
1598 | */ | ||
1599 | if (!i915_terminally_wedged(&dev_priv->gpu_error)) { | ||
1597 | ret = VM_FAULT_SIGBUS; | 1600 | ret = VM_FAULT_SIGBUS; |
1598 | break; | 1601 | break; |
1599 | } | 1602 | } |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 1411613f2174..e42925f76b4b 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1310,6 +1310,16 @@ void i915_check_and_clear_faults(struct drm_device *dev) | |||
1310 | POSTING_READ(RING_FAULT_REG(&dev_priv->ring[RCS])); | 1310 | POSTING_READ(RING_FAULT_REG(&dev_priv->ring[RCS])); |
1311 | } | 1311 | } |
1312 | 1312 | ||
1313 | static void i915_ggtt_flush(struct drm_i915_private *dev_priv) | ||
1314 | { | ||
1315 | if (INTEL_INFO(dev_priv->dev)->gen < 6) { | ||
1316 | intel_gtt_chipset_flush(); | ||
1317 | } else { | ||
1318 | I915_WRITE(GFX_FLSH_CNTL_GEN6, GFX_FLSH_CNTL_EN); | ||
1319 | POSTING_READ(GFX_FLSH_CNTL_GEN6); | ||
1320 | } | ||
1321 | } | ||
1322 | |||
1313 | void i915_gem_suspend_gtt_mappings(struct drm_device *dev) | 1323 | void i915_gem_suspend_gtt_mappings(struct drm_device *dev) |
1314 | { | 1324 | { |
1315 | struct drm_i915_private *dev_priv = dev->dev_private; | 1325 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -1326,6 +1336,8 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev) | |||
1326 | dev_priv->gtt.base.start, | 1336 | dev_priv->gtt.base.start, |
1327 | dev_priv->gtt.base.total, | 1337 | dev_priv->gtt.base.total, |
1328 | true); | 1338 | true); |
1339 | |||
1340 | i915_ggtt_flush(dev_priv); | ||
1329 | } | 1341 | } |
1330 | 1342 | ||
1331 | void i915_gem_restore_gtt_mappings(struct drm_device *dev) | 1343 | void i915_gem_restore_gtt_mappings(struct drm_device *dev) |
@@ -1378,7 +1390,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev) | |||
1378 | gen6_write_pdes(container_of(vm, struct i915_hw_ppgtt, base)); | 1390 | gen6_write_pdes(container_of(vm, struct i915_hw_ppgtt, base)); |
1379 | } | 1391 | } |
1380 | 1392 | ||
1381 | i915_gem_chipset_flush(dev); | 1393 | i915_ggtt_flush(dev_priv); |
1382 | } | 1394 | } |
1383 | 1395 | ||
1384 | int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj) | 1396 | int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj) |
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c index fe69fc837d9e..d38413997379 100644 --- a/drivers/gpu/drm/i915/i915_gem_userptr.c +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c | |||
@@ -32,6 +32,15 @@ | |||
32 | #include <linux/mempolicy.h> | 32 | #include <linux/mempolicy.h> |
33 | #include <linux/swap.h> | 33 | #include <linux/swap.h> |
34 | 34 | ||
35 | struct i915_mm_struct { | ||
36 | struct mm_struct *mm; | ||
37 | struct drm_device *dev; | ||
38 | struct i915_mmu_notifier *mn; | ||
39 | struct hlist_node node; | ||
40 | struct kref kref; | ||
41 | struct work_struct work; | ||
42 | }; | ||
43 | |||
35 | #if defined(CONFIG_MMU_NOTIFIER) | 44 | #if defined(CONFIG_MMU_NOTIFIER) |
36 | #include <linux/interval_tree.h> | 45 | #include <linux/interval_tree.h> |
37 | 46 | ||
@@ -41,16 +50,12 @@ struct i915_mmu_notifier { | |||
41 | struct mmu_notifier mn; | 50 | struct mmu_notifier mn; |
42 | struct rb_root objects; | 51 | struct rb_root objects; |
43 | struct list_head linear; | 52 | struct list_head linear; |
44 | struct drm_device *dev; | ||
45 | struct mm_struct *mm; | ||
46 | struct work_struct work; | ||
47 | unsigned long count; | ||
48 | unsigned long serial; | 53 | unsigned long serial; |
49 | bool has_linear; | 54 | bool has_linear; |
50 | }; | 55 | }; |
51 | 56 | ||
52 | struct i915_mmu_object { | 57 | struct i915_mmu_object { |
53 | struct i915_mmu_notifier *mmu; | 58 | struct i915_mmu_notifier *mn; |
54 | struct interval_tree_node it; | 59 | struct interval_tree_node it; |
55 | struct list_head link; | 60 | struct list_head link; |
56 | struct drm_i915_gem_object *obj; | 61 | struct drm_i915_gem_object *obj; |
@@ -96,18 +101,18 @@ static void *invalidate_range__linear(struct i915_mmu_notifier *mn, | |||
96 | unsigned long start, | 101 | unsigned long start, |
97 | unsigned long end) | 102 | unsigned long end) |
98 | { | 103 | { |
99 | struct i915_mmu_object *mmu; | 104 | struct i915_mmu_object *mo; |
100 | unsigned long serial; | 105 | unsigned long serial; |
101 | 106 | ||
102 | restart: | 107 | restart: |
103 | serial = mn->serial; | 108 | serial = mn->serial; |
104 | list_for_each_entry(mmu, &mn->linear, link) { | 109 | list_for_each_entry(mo, &mn->linear, link) { |
105 | struct drm_i915_gem_object *obj; | 110 | struct drm_i915_gem_object *obj; |
106 | 111 | ||
107 | if (mmu->it.last < start || mmu->it.start > end) | 112 | if (mo->it.last < start || mo->it.start > end) |
108 | continue; | 113 | continue; |
109 | 114 | ||
110 | obj = mmu->obj; | 115 | obj = mo->obj; |
111 | drm_gem_object_reference(&obj->base); | 116 | drm_gem_object_reference(&obj->base); |
112 | spin_unlock(&mn->lock); | 117 | spin_unlock(&mn->lock); |
113 | 118 | ||
@@ -160,130 +165,47 @@ static const struct mmu_notifier_ops i915_gem_userptr_notifier = { | |||
160 | }; | 165 | }; |
161 | 166 | ||
162 | static struct i915_mmu_notifier * | 167 | static struct i915_mmu_notifier * |
163 | __i915_mmu_notifier_lookup(struct drm_device *dev, struct mm_struct *mm) | 168 | i915_mmu_notifier_create(struct mm_struct *mm) |
164 | { | ||
165 | struct drm_i915_private *dev_priv = to_i915(dev); | ||
166 | struct i915_mmu_notifier *mmu; | ||
167 | |||
168 | /* Protected by dev->struct_mutex */ | ||
169 | hash_for_each_possible(dev_priv->mmu_notifiers, mmu, node, (unsigned long)mm) | ||
170 | if (mmu->mm == mm) | ||
171 | return mmu; | ||
172 | |||
173 | return NULL; | ||
174 | } | ||
175 | |||
176 | static struct i915_mmu_notifier * | ||
177 | i915_mmu_notifier_get(struct drm_device *dev, struct mm_struct *mm) | ||
178 | { | 169 | { |
179 | struct drm_i915_private *dev_priv = to_i915(dev); | 170 | struct i915_mmu_notifier *mn; |
180 | struct i915_mmu_notifier *mmu; | ||
181 | int ret; | 171 | int ret; |
182 | 172 | ||
183 | lockdep_assert_held(&dev->struct_mutex); | 173 | mn = kmalloc(sizeof(*mn), GFP_KERNEL); |
184 | 174 | if (mn == NULL) | |
185 | mmu = __i915_mmu_notifier_lookup(dev, mm); | ||
186 | if (mmu) | ||
187 | return mmu; | ||
188 | |||
189 | mmu = kmalloc(sizeof(*mmu), GFP_KERNEL); | ||
190 | if (mmu == NULL) | ||
191 | return ERR_PTR(-ENOMEM); | 175 | return ERR_PTR(-ENOMEM); |
192 | 176 | ||
193 | spin_lock_init(&mmu->lock); | 177 | spin_lock_init(&mn->lock); |
194 | mmu->dev = dev; | 178 | mn->mn.ops = &i915_gem_userptr_notifier; |
195 | mmu->mn.ops = &i915_gem_userptr_notifier; | 179 | mn->objects = RB_ROOT; |
196 | mmu->mm = mm; | 180 | mn->serial = 1; |
197 | mmu->objects = RB_ROOT; | 181 | INIT_LIST_HEAD(&mn->linear); |
198 | mmu->count = 0; | 182 | mn->has_linear = false; |
199 | mmu->serial = 1; | 183 | |
200 | INIT_LIST_HEAD(&mmu->linear); | 184 | /* Protected by mmap_sem (write-lock) */ |
201 | mmu->has_linear = false; | 185 | ret = __mmu_notifier_register(&mn->mn, mm); |
202 | |||
203 | /* Protected by mmap_sem (write-lock) */ | ||
204 | ret = __mmu_notifier_register(&mmu->mn, mm); | ||
205 | if (ret) { | 186 | if (ret) { |
206 | kfree(mmu); | 187 | kfree(mn); |
207 | return ERR_PTR(ret); | 188 | return ERR_PTR(ret); |
208 | } | 189 | } |
209 | 190 | ||
210 | /* Protected by dev->struct_mutex */ | 191 | return mn; |
211 | hash_add(dev_priv->mmu_notifiers, &mmu->node, (unsigned long)mm); | ||
212 | return mmu; | ||
213 | } | 192 | } |
214 | 193 | ||
215 | static void | 194 | static void __i915_mmu_notifier_update_serial(struct i915_mmu_notifier *mn) |
216 | __i915_mmu_notifier_destroy_worker(struct work_struct *work) | ||
217 | { | 195 | { |
218 | struct i915_mmu_notifier *mmu = container_of(work, typeof(*mmu), work); | 196 | if (++mn->serial == 0) |
219 | mmu_notifier_unregister(&mmu->mn, mmu->mm); | 197 | mn->serial = 1; |
220 | kfree(mmu); | ||
221 | } | ||
222 | |||
223 | static void | ||
224 | __i915_mmu_notifier_destroy(struct i915_mmu_notifier *mmu) | ||
225 | { | ||
226 | lockdep_assert_held(&mmu->dev->struct_mutex); | ||
227 | |||
228 | /* Protected by dev->struct_mutex */ | ||
229 | hash_del(&mmu->node); | ||
230 | |||
231 | /* Our lock ordering is: mmap_sem, mmu_notifier_scru, struct_mutex. | ||
232 | * We enter the function holding struct_mutex, therefore we need | ||
233 | * to drop our mutex prior to calling mmu_notifier_unregister in | ||
234 | * order to prevent lock inversion (and system-wide deadlock) | ||
235 | * between the mmap_sem and struct-mutex. Hence we defer the | ||
236 | * unregistration to a workqueue where we hold no locks. | ||
237 | */ | ||
238 | INIT_WORK(&mmu->work, __i915_mmu_notifier_destroy_worker); | ||
239 | schedule_work(&mmu->work); | ||
240 | } | ||
241 | |||
242 | static void __i915_mmu_notifier_update_serial(struct i915_mmu_notifier *mmu) | ||
243 | { | ||
244 | if (++mmu->serial == 0) | ||
245 | mmu->serial = 1; | ||
246 | } | ||
247 | |||
248 | static bool i915_mmu_notifier_has_linear(struct i915_mmu_notifier *mmu) | ||
249 | { | ||
250 | struct i915_mmu_object *mn; | ||
251 | |||
252 | list_for_each_entry(mn, &mmu->linear, link) | ||
253 | if (mn->is_linear) | ||
254 | return true; | ||
255 | |||
256 | return false; | ||
257 | } | ||
258 | |||
259 | static void | ||
260 | i915_mmu_notifier_del(struct i915_mmu_notifier *mmu, | ||
261 | struct i915_mmu_object *mn) | ||
262 | { | ||
263 | lockdep_assert_held(&mmu->dev->struct_mutex); | ||
264 | |||
265 | spin_lock(&mmu->lock); | ||
266 | list_del(&mn->link); | ||
267 | if (mn->is_linear) | ||
268 | mmu->has_linear = i915_mmu_notifier_has_linear(mmu); | ||
269 | else | ||
270 | interval_tree_remove(&mn->it, &mmu->objects); | ||
271 | __i915_mmu_notifier_update_serial(mmu); | ||
272 | spin_unlock(&mmu->lock); | ||
273 | |||
274 | /* Protected against _add() by dev->struct_mutex */ | ||
275 | if (--mmu->count == 0) | ||
276 | __i915_mmu_notifier_destroy(mmu); | ||
277 | } | 198 | } |
278 | 199 | ||
279 | static int | 200 | static int |
280 | i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | 201 | i915_mmu_notifier_add(struct drm_device *dev, |
281 | struct i915_mmu_object *mn) | 202 | struct i915_mmu_notifier *mn, |
203 | struct i915_mmu_object *mo) | ||
282 | { | 204 | { |
283 | struct interval_tree_node *it; | 205 | struct interval_tree_node *it; |
284 | int ret; | 206 | int ret; |
285 | 207 | ||
286 | ret = i915_mutex_lock_interruptible(mmu->dev); | 208 | ret = i915_mutex_lock_interruptible(dev); |
287 | if (ret) | 209 | if (ret) |
288 | return ret; | 210 | return ret; |
289 | 211 | ||
@@ -291,11 +213,11 @@ i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | |||
291 | * remove the objects from the interval tree) before we do | 213 | * remove the objects from the interval tree) before we do |
292 | * the check for overlapping objects. | 214 | * the check for overlapping objects. |
293 | */ | 215 | */ |
294 | i915_gem_retire_requests(mmu->dev); | 216 | i915_gem_retire_requests(dev); |
295 | 217 | ||
296 | spin_lock(&mmu->lock); | 218 | spin_lock(&mn->lock); |
297 | it = interval_tree_iter_first(&mmu->objects, | 219 | it = interval_tree_iter_first(&mn->objects, |
298 | mn->it.start, mn->it.last); | 220 | mo->it.start, mo->it.last); |
299 | if (it) { | 221 | if (it) { |
300 | struct drm_i915_gem_object *obj; | 222 | struct drm_i915_gem_object *obj; |
301 | 223 | ||
@@ -312,86 +234,122 @@ i915_mmu_notifier_add(struct i915_mmu_notifier *mmu, | |||
312 | 234 | ||
313 | obj = container_of(it, struct i915_mmu_object, it)->obj; | 235 | obj = container_of(it, struct i915_mmu_object, it)->obj; |
314 | if (!obj->userptr.workers) | 236 | if (!obj->userptr.workers) |
315 | mmu->has_linear = mn->is_linear = true; | 237 | mn->has_linear = mo->is_linear = true; |
316 | else | 238 | else |
317 | ret = -EAGAIN; | 239 | ret = -EAGAIN; |
318 | } else | 240 | } else |
319 | interval_tree_insert(&mn->it, &mmu->objects); | 241 | interval_tree_insert(&mo->it, &mn->objects); |
320 | 242 | ||
321 | if (ret == 0) { | 243 | if (ret == 0) { |
322 | list_add(&mn->link, &mmu->linear); | 244 | list_add(&mo->link, &mn->linear); |
323 | __i915_mmu_notifier_update_serial(mmu); | 245 | __i915_mmu_notifier_update_serial(mn); |
324 | } | 246 | } |
325 | spin_unlock(&mmu->lock); | 247 | spin_unlock(&mn->lock); |
326 | mutex_unlock(&mmu->dev->struct_mutex); | 248 | mutex_unlock(&dev->struct_mutex); |
327 | 249 | ||
328 | return ret; | 250 | return ret; |
329 | } | 251 | } |
330 | 252 | ||
253 | static bool i915_mmu_notifier_has_linear(struct i915_mmu_notifier *mn) | ||
254 | { | ||
255 | struct i915_mmu_object *mo; | ||
256 | |||
257 | list_for_each_entry(mo, &mn->linear, link) | ||
258 | if (mo->is_linear) | ||
259 | return true; | ||
260 | |||
261 | return false; | ||
262 | } | ||
263 | |||
264 | static void | ||
265 | i915_mmu_notifier_del(struct i915_mmu_notifier *mn, | ||
266 | struct i915_mmu_object *mo) | ||
267 | { | ||
268 | spin_lock(&mn->lock); | ||
269 | list_del(&mo->link); | ||
270 | if (mo->is_linear) | ||
271 | mn->has_linear = i915_mmu_notifier_has_linear(mn); | ||
272 | else | ||
273 | interval_tree_remove(&mo->it, &mn->objects); | ||
274 | __i915_mmu_notifier_update_serial(mn); | ||
275 | spin_unlock(&mn->lock); | ||
276 | } | ||
277 | |||
331 | static void | 278 | static void |
332 | i915_gem_userptr_release__mmu_notifier(struct drm_i915_gem_object *obj) | 279 | i915_gem_userptr_release__mmu_notifier(struct drm_i915_gem_object *obj) |
333 | { | 280 | { |
334 | struct i915_mmu_object *mn; | 281 | struct i915_mmu_object *mo; |
335 | 282 | ||
336 | mn = obj->userptr.mn; | 283 | mo = obj->userptr.mmu_object; |
337 | if (mn == NULL) | 284 | if (mo == NULL) |
338 | return; | 285 | return; |
339 | 286 | ||
340 | i915_mmu_notifier_del(mn->mmu, mn); | 287 | i915_mmu_notifier_del(mo->mn, mo); |
341 | obj->userptr.mn = NULL; | 288 | kfree(mo); |
289 | |||
290 | obj->userptr.mmu_object = NULL; | ||
291 | } | ||
292 | |||
293 | static struct i915_mmu_notifier * | ||
294 | i915_mmu_notifier_find(struct i915_mm_struct *mm) | ||
295 | { | ||
296 | if (mm->mn == NULL) { | ||
297 | down_write(&mm->mm->mmap_sem); | ||
298 | mutex_lock(&to_i915(mm->dev)->mm_lock); | ||
299 | if (mm->mn == NULL) | ||
300 | mm->mn = i915_mmu_notifier_create(mm->mm); | ||
301 | mutex_unlock(&to_i915(mm->dev)->mm_lock); | ||
302 | up_write(&mm->mm->mmap_sem); | ||
303 | } | ||
304 | return mm->mn; | ||
342 | } | 305 | } |
343 | 306 | ||
344 | static int | 307 | static int |
345 | i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, | 308 | i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, |
346 | unsigned flags) | 309 | unsigned flags) |
347 | { | 310 | { |
348 | struct i915_mmu_notifier *mmu; | 311 | struct i915_mmu_notifier *mn; |
349 | struct i915_mmu_object *mn; | 312 | struct i915_mmu_object *mo; |
350 | int ret; | 313 | int ret; |
351 | 314 | ||
352 | if (flags & I915_USERPTR_UNSYNCHRONIZED) | 315 | if (flags & I915_USERPTR_UNSYNCHRONIZED) |
353 | return capable(CAP_SYS_ADMIN) ? 0 : -EPERM; | 316 | return capable(CAP_SYS_ADMIN) ? 0 : -EPERM; |
354 | 317 | ||
355 | down_write(&obj->userptr.mm->mmap_sem); | 318 | if (WARN_ON(obj->userptr.mm == NULL)) |
356 | ret = i915_mutex_lock_interruptible(obj->base.dev); | 319 | return -EINVAL; |
357 | if (ret == 0) { | ||
358 | mmu = i915_mmu_notifier_get(obj->base.dev, obj->userptr.mm); | ||
359 | if (!IS_ERR(mmu)) | ||
360 | mmu->count++; /* preemptive add to act as a refcount */ | ||
361 | else | ||
362 | ret = PTR_ERR(mmu); | ||
363 | mutex_unlock(&obj->base.dev->struct_mutex); | ||
364 | } | ||
365 | up_write(&obj->userptr.mm->mmap_sem); | ||
366 | if (ret) | ||
367 | return ret; | ||
368 | 320 | ||
369 | mn = kzalloc(sizeof(*mn), GFP_KERNEL); | 321 | mn = i915_mmu_notifier_find(obj->userptr.mm); |
370 | if (mn == NULL) { | 322 | if (IS_ERR(mn)) |
371 | ret = -ENOMEM; | 323 | return PTR_ERR(mn); |
372 | goto destroy_mmu; | ||
373 | } | ||
374 | 324 | ||
375 | mn->mmu = mmu; | 325 | mo = kzalloc(sizeof(*mo), GFP_KERNEL); |
376 | mn->it.start = obj->userptr.ptr; | 326 | if (mo == NULL) |
377 | mn->it.last = mn->it.start + obj->base.size - 1; | 327 | return -ENOMEM; |
378 | mn->obj = obj; | ||
379 | 328 | ||
380 | ret = i915_mmu_notifier_add(mmu, mn); | 329 | mo->mn = mn; |
381 | if (ret) | 330 | mo->it.start = obj->userptr.ptr; |
382 | goto free_mn; | 331 | mo->it.last = mo->it.start + obj->base.size - 1; |
332 | mo->obj = obj; | ||
383 | 333 | ||
384 | obj->userptr.mn = mn; | 334 | ret = i915_mmu_notifier_add(obj->base.dev, mn, mo); |
335 | if (ret) { | ||
336 | kfree(mo); | ||
337 | return ret; | ||
338 | } | ||
339 | |||
340 | obj->userptr.mmu_object = mo; | ||
385 | return 0; | 341 | return 0; |
342 | } | ||
343 | |||
344 | static void | ||
345 | i915_mmu_notifier_free(struct i915_mmu_notifier *mn, | ||
346 | struct mm_struct *mm) | ||
347 | { | ||
348 | if (mn == NULL) | ||
349 | return; | ||
386 | 350 | ||
387 | free_mn: | 351 | mmu_notifier_unregister(&mn->mn, mm); |
388 | kfree(mn); | 352 | kfree(mn); |
389 | destroy_mmu: | ||
390 | mutex_lock(&obj->base.dev->struct_mutex); | ||
391 | if (--mmu->count == 0) | ||
392 | __i915_mmu_notifier_destroy(mmu); | ||
393 | mutex_unlock(&obj->base.dev->struct_mutex); | ||
394 | return ret; | ||
395 | } | 353 | } |
396 | 354 | ||
397 | #else | 355 | #else |
@@ -413,15 +371,114 @@ i915_gem_userptr_init__mmu_notifier(struct drm_i915_gem_object *obj, | |||
413 | 371 | ||
414 | return 0; | 372 | return 0; |
415 | } | 373 | } |
374 | |||
375 | static void | ||
376 | i915_mmu_notifier_free(struct i915_mmu_notifier *mn, | ||
377 | struct mm_struct *mm) | ||
378 | { | ||
379 | } | ||
380 | |||
416 | #endif | 381 | #endif |
417 | 382 | ||
383 | static struct i915_mm_struct * | ||
384 | __i915_mm_struct_find(struct drm_i915_private *dev_priv, struct mm_struct *real) | ||
385 | { | ||
386 | struct i915_mm_struct *mm; | ||
387 | |||
388 | /* Protected by dev_priv->mm_lock */ | ||
389 | hash_for_each_possible(dev_priv->mm_structs, mm, node, (unsigned long)real) | ||
390 | if (mm->mm == real) | ||
391 | return mm; | ||
392 | |||
393 | return NULL; | ||
394 | } | ||
395 | |||
396 | static int | ||
397 | i915_gem_userptr_init__mm_struct(struct drm_i915_gem_object *obj) | ||
398 | { | ||
399 | struct drm_i915_private *dev_priv = to_i915(obj->base.dev); | ||
400 | struct i915_mm_struct *mm; | ||
401 | int ret = 0; | ||
402 | |||
403 | /* During release of the GEM object we hold the struct_mutex. This | ||
404 | * precludes us from calling mmput() at that time as that may be | ||
405 | * the last reference and so call exit_mmap(). exit_mmap() will | ||
406 | * attempt to reap the vma, and if we were holding a GTT mmap | ||
407 | * would then call drm_gem_vm_close() and attempt to reacquire | ||
408 | * the struct mutex. So in order to avoid that recursion, we have | ||
409 | * to defer releasing the mm reference until after we drop the | ||
410 | * struct_mutex, i.e. we need to schedule a worker to do the clean | ||
411 | * up. | ||
412 | */ | ||
413 | mutex_lock(&dev_priv->mm_lock); | ||
414 | mm = __i915_mm_struct_find(dev_priv, current->mm); | ||
415 | if (mm == NULL) { | ||
416 | mm = kmalloc(sizeof(*mm), GFP_KERNEL); | ||
417 | if (mm == NULL) { | ||
418 | ret = -ENOMEM; | ||
419 | goto out; | ||
420 | } | ||
421 | |||
422 | kref_init(&mm->kref); | ||
423 | mm->dev = obj->base.dev; | ||
424 | |||
425 | mm->mm = current->mm; | ||
426 | atomic_inc(¤t->mm->mm_count); | ||
427 | |||
428 | mm->mn = NULL; | ||
429 | |||
430 | /* Protected by dev_priv->mm_lock */ | ||
431 | hash_add(dev_priv->mm_structs, | ||
432 | &mm->node, (unsigned long)mm->mm); | ||
433 | } else | ||
434 | kref_get(&mm->kref); | ||
435 | |||
436 | obj->userptr.mm = mm; | ||
437 | out: | ||
438 | mutex_unlock(&dev_priv->mm_lock); | ||
439 | return ret; | ||
440 | } | ||
441 | |||
442 | static void | ||
443 | __i915_mm_struct_free__worker(struct work_struct *work) | ||
444 | { | ||
445 | struct i915_mm_struct *mm = container_of(work, typeof(*mm), work); | ||
446 | i915_mmu_notifier_free(mm->mn, mm->mm); | ||
447 | mmdrop(mm->mm); | ||
448 | kfree(mm); | ||
449 | } | ||
450 | |||
451 | static void | ||
452 | __i915_mm_struct_free(struct kref *kref) | ||
453 | { | ||
454 | struct i915_mm_struct *mm = container_of(kref, typeof(*mm), kref); | ||
455 | |||
456 | /* Protected by dev_priv->mm_lock */ | ||
457 | hash_del(&mm->node); | ||
458 | mutex_unlock(&to_i915(mm->dev)->mm_lock); | ||
459 | |||
460 | INIT_WORK(&mm->work, __i915_mm_struct_free__worker); | ||
461 | schedule_work(&mm->work); | ||
462 | } | ||
463 | |||
464 | static void | ||
465 | i915_gem_userptr_release__mm_struct(struct drm_i915_gem_object *obj) | ||
466 | { | ||
467 | if (obj->userptr.mm == NULL) | ||
468 | return; | ||
469 | |||
470 | kref_put_mutex(&obj->userptr.mm->kref, | ||
471 | __i915_mm_struct_free, | ||
472 | &to_i915(obj->base.dev)->mm_lock); | ||
473 | obj->userptr.mm = NULL; | ||
474 | } | ||
475 | |||
418 | struct get_pages_work { | 476 | struct get_pages_work { |
419 | struct work_struct work; | 477 | struct work_struct work; |
420 | struct drm_i915_gem_object *obj; | 478 | struct drm_i915_gem_object *obj; |
421 | struct task_struct *task; | 479 | struct task_struct *task; |
422 | }; | 480 | }; |
423 | 481 | ||
424 | |||
425 | #if IS_ENABLED(CONFIG_SWIOTLB) | 482 | #if IS_ENABLED(CONFIG_SWIOTLB) |
426 | #define swiotlb_active() swiotlb_nr_tbl() | 483 | #define swiotlb_active() swiotlb_nr_tbl() |
427 | #else | 484 | #else |
@@ -479,7 +536,7 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work) | |||
479 | if (pvec == NULL) | 536 | if (pvec == NULL) |
480 | pvec = drm_malloc_ab(num_pages, sizeof(struct page *)); | 537 | pvec = drm_malloc_ab(num_pages, sizeof(struct page *)); |
481 | if (pvec != NULL) { | 538 | if (pvec != NULL) { |
482 | struct mm_struct *mm = obj->userptr.mm; | 539 | struct mm_struct *mm = obj->userptr.mm->mm; |
483 | 540 | ||
484 | down_read(&mm->mmap_sem); | 541 | down_read(&mm->mmap_sem); |
485 | while (pinned < num_pages) { | 542 | while (pinned < num_pages) { |
@@ -545,7 +602,7 @@ i915_gem_userptr_get_pages(struct drm_i915_gem_object *obj) | |||
545 | 602 | ||
546 | pvec = NULL; | 603 | pvec = NULL; |
547 | pinned = 0; | 604 | pinned = 0; |
548 | if (obj->userptr.mm == current->mm) { | 605 | if (obj->userptr.mm->mm == current->mm) { |
549 | pvec = kmalloc(num_pages*sizeof(struct page *), | 606 | pvec = kmalloc(num_pages*sizeof(struct page *), |
550 | GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY); | 607 | GFP_TEMPORARY | __GFP_NOWARN | __GFP_NORETRY); |
551 | if (pvec == NULL) { | 608 | if (pvec == NULL) { |
@@ -651,17 +708,13 @@ static void | |||
651 | i915_gem_userptr_release(struct drm_i915_gem_object *obj) | 708 | i915_gem_userptr_release(struct drm_i915_gem_object *obj) |
652 | { | 709 | { |
653 | i915_gem_userptr_release__mmu_notifier(obj); | 710 | i915_gem_userptr_release__mmu_notifier(obj); |
654 | 711 | i915_gem_userptr_release__mm_struct(obj); | |
655 | if (obj->userptr.mm) { | ||
656 | mmput(obj->userptr.mm); | ||
657 | obj->userptr.mm = NULL; | ||
658 | } | ||
659 | } | 712 | } |
660 | 713 | ||
661 | static int | 714 | static int |
662 | i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) | 715 | i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) |
663 | { | 716 | { |
664 | if (obj->userptr.mn) | 717 | if (obj->userptr.mmu_object) |
665 | return 0; | 718 | return 0; |
666 | 719 | ||
667 | return i915_gem_userptr_init__mmu_notifier(obj, 0); | 720 | return i915_gem_userptr_init__mmu_notifier(obj, 0); |
@@ -736,7 +789,6 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
736 | return -ENODEV; | 789 | return -ENODEV; |
737 | } | 790 | } |
738 | 791 | ||
739 | /* Allocate the new object */ | ||
740 | obj = i915_gem_object_alloc(dev); | 792 | obj = i915_gem_object_alloc(dev); |
741 | if (obj == NULL) | 793 | if (obj == NULL) |
742 | return -ENOMEM; | 794 | return -ENOMEM; |
@@ -754,8 +806,8 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
754 | * at binding. This means that we need to hook into the mmu_notifier | 806 | * at binding. This means that we need to hook into the mmu_notifier |
755 | * in order to detect if the mmu is destroyed. | 807 | * in order to detect if the mmu is destroyed. |
756 | */ | 808 | */ |
757 | ret = -ENOMEM; | 809 | ret = i915_gem_userptr_init__mm_struct(obj); |
758 | if ((obj->userptr.mm = get_task_mm(current))) | 810 | if (ret == 0) |
759 | ret = i915_gem_userptr_init__mmu_notifier(obj, args->flags); | 811 | ret = i915_gem_userptr_init__mmu_notifier(obj, args->flags); |
760 | if (ret == 0) | 812 | if (ret == 0) |
761 | ret = drm_gem_handle_create(file, &obj->base, &handle); | 813 | ret = drm_gem_handle_create(file, &obj->base, &handle); |
@@ -772,9 +824,8 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file | |||
772 | int | 824 | int |
773 | i915_gem_init_userptr(struct drm_device *dev) | 825 | i915_gem_init_userptr(struct drm_device *dev) |
774 | { | 826 | { |
775 | #if defined(CONFIG_MMU_NOTIFIER) | ||
776 | struct drm_i915_private *dev_priv = to_i915(dev); | 827 | struct drm_i915_private *dev_priv = to_i915(dev); |
777 | hash_init(dev_priv->mmu_notifiers); | 828 | mutex_init(&dev_priv->mm_lock); |
778 | #endif | 829 | hash_init(dev_priv->mm_structs); |
779 | return 0; | 830 | return 0; |
780 | } | 831 | } |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index e4d7607da2c4..f29b44c86a2f 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -334,16 +334,20 @@ | |||
334 | #define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) | 334 | #define GFX_OP_DESTBUFFER_INFO ((0x3<<29)|(0x1d<<24)|(0x8e<<16)|1) |
335 | #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) | 335 | #define GFX_OP_DRAWRECT_INFO ((0x3<<29)|(0x1d<<24)|(0x80<<16)|(0x3)) |
336 | #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2) | 336 | #define GFX_OP_DRAWRECT_INFO_I965 ((0x7900<<16)|0x2) |
337 | #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4) | 337 | |
338 | #define COLOR_BLT_CMD (2<<29 | 0x40<<22 | (5-2)) | ||
339 | #define SRC_COPY_BLT_CMD ((2<<29)|(0x43<<22)|4) | ||
338 | #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) | 340 | #define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) |
339 | #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5) | 341 | #define XY_MONO_SRC_COPY_IMM_BLT ((2<<29)|(0x71<<22)|5) |
340 | #define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) | 342 | #define BLT_WRITE_A (2<<20) |
341 | #define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) | 343 | #define BLT_WRITE_RGB (1<<20) |
344 | #define BLT_WRITE_RGBA (BLT_WRITE_RGB | BLT_WRITE_A) | ||
342 | #define BLT_DEPTH_8 (0<<24) | 345 | #define BLT_DEPTH_8 (0<<24) |
343 | #define BLT_DEPTH_16_565 (1<<24) | 346 | #define BLT_DEPTH_16_565 (1<<24) |
344 | #define BLT_DEPTH_16_1555 (2<<24) | 347 | #define BLT_DEPTH_16_1555 (2<<24) |
345 | #define BLT_DEPTH_32 (3<<24) | 348 | #define BLT_DEPTH_32 (3<<24) |
346 | #define BLT_ROP_GXCOPY (0xcc<<16) | 349 | #define BLT_ROP_SRC_COPY (0xcc<<16) |
350 | #define BLT_ROP_COLOR_COPY (0xf0<<16) | ||
347 | #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */ | 351 | #define XY_SRC_COPY_BLT_SRC_TILED (1<<15) /* 965+ only */ |
348 | #define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */ | 352 | #define XY_SRC_COPY_BLT_DST_TILED (1<<11) /* 965+ only */ |
349 | #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2) | 353 | #define CMD_OP_DISPLAYBUFFER_INFO ((0x0<<29)|(0x14<<23)|2) |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index a66955037e4e..eee79e1c3222 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -1123,7 +1123,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) | |||
1123 | } | 1123 | } |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id) | 1126 | static int intel_no_opregion_vbt_callback(const struct dmi_system_id *id) |
1127 | { | 1127 | { |
1128 | DRM_DEBUG_KMS("Falling back to manually reading VBT from " | 1128 | DRM_DEBUG_KMS("Falling back to manually reading VBT from " |
1129 | "VBIOS ROM for %s\n", | 1129 | "VBIOS ROM for %s\n", |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index e8abfce40976..9212e6504e0f 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -804,7 +804,7 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { | |||
804 | .destroy = intel_encoder_destroy, | 804 | .destroy = intel_encoder_destroy, |
805 | }; | 805 | }; |
806 | 806 | ||
807 | static int __init intel_no_crt_dmi_callback(const struct dmi_system_id *id) | 807 | static int intel_no_crt_dmi_callback(const struct dmi_system_id *id) |
808 | { | 808 | { |
809 | DRM_INFO("Skipping CRT initialization for %s\n", id->ident); | 809 | DRM_INFO("Skipping CRT initialization for %s\n", id->ident); |
810 | return 1; | 810 | return 1; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d074d704f458..d8324c69fa86 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2233,6 +2233,15 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, | |||
2233 | if (need_vtd_wa(dev) && alignment < 256 * 1024) | 2233 | if (need_vtd_wa(dev) && alignment < 256 * 1024) |
2234 | alignment = 256 * 1024; | 2234 | alignment = 256 * 1024; |
2235 | 2235 | ||
2236 | /* | ||
2237 | * Global gtt pte registers are special registers which actually forward | ||
2238 | * writes to a chunk of system memory. Which means that there is no risk | ||
2239 | * that the register values disappear as soon as we call | ||
2240 | * intel_runtime_pm_put(), so it is correct to wrap only the | ||
2241 | * pin/unpin/fence and not more. | ||
2242 | */ | ||
2243 | intel_runtime_pm_get(dev_priv); | ||
2244 | |||
2236 | dev_priv->mm.interruptible = false; | 2245 | dev_priv->mm.interruptible = false; |
2237 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined); | 2246 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, pipelined); |
2238 | if (ret) | 2247 | if (ret) |
@@ -2250,12 +2259,14 @@ intel_pin_and_fence_fb_obj(struct drm_device *dev, | |||
2250 | i915_gem_object_pin_fence(obj); | 2259 | i915_gem_object_pin_fence(obj); |
2251 | 2260 | ||
2252 | dev_priv->mm.interruptible = true; | 2261 | dev_priv->mm.interruptible = true; |
2262 | intel_runtime_pm_put(dev_priv); | ||
2253 | return 0; | 2263 | return 0; |
2254 | 2264 | ||
2255 | err_unpin: | 2265 | err_unpin: |
2256 | i915_gem_object_unpin_from_display_plane(obj); | 2266 | i915_gem_object_unpin_from_display_plane(obj); |
2257 | err_interruptible: | 2267 | err_interruptible: |
2258 | dev_priv->mm.interruptible = true; | 2268 | dev_priv->mm.interruptible = true; |
2269 | intel_runtime_pm_put(dev_priv); | ||
2259 | return ret; | 2270 | return ret; |
2260 | } | 2271 | } |
2261 | 2272 | ||
@@ -4188,10 +4199,6 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc) | |||
4188 | intel_set_pch_fifo_underrun_reporting(dev, pipe, false); | 4199 | intel_set_pch_fifo_underrun_reporting(dev, pipe, false); |
4189 | 4200 | ||
4190 | intel_disable_pipe(dev_priv, pipe); | 4201 | intel_disable_pipe(dev_priv, pipe); |
4191 | |||
4192 | if (intel_crtc->config.dp_encoder_is_mst) | ||
4193 | intel_ddi_set_vc_payload_alloc(crtc, false); | ||
4194 | |||
4195 | ironlake_pfit_disable(intel_crtc); | 4202 | ironlake_pfit_disable(intel_crtc); |
4196 | 4203 | ||
4197 | for_each_encoder_on_crtc(dev, crtc, encoder) | 4204 | for_each_encoder_on_crtc(dev, crtc, encoder) |
@@ -4256,6 +4263,9 @@ static void haswell_crtc_disable(struct drm_crtc *crtc) | |||
4256 | intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, false); | 4263 | intel_set_pch_fifo_underrun_reporting(dev, TRANSCODER_A, false); |
4257 | intel_disable_pipe(dev_priv, pipe); | 4264 | intel_disable_pipe(dev_priv, pipe); |
4258 | 4265 | ||
4266 | if (intel_crtc->config.dp_encoder_is_mst) | ||
4267 | intel_ddi_set_vc_payload_alloc(crtc, false); | ||
4268 | |||
4259 | intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder); | 4269 | intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder); |
4260 | 4270 | ||
4261 | ironlake_pfit_disable(intel_crtc); | 4271 | ironlake_pfit_disable(intel_crtc); |
@@ -8240,6 +8250,15 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc, | |||
8240 | goto fail_locked; | 8250 | goto fail_locked; |
8241 | } | 8251 | } |
8242 | 8252 | ||
8253 | /* | ||
8254 | * Global gtt pte registers are special registers which actually | ||
8255 | * forward writes to a chunk of system memory. Which means that | ||
8256 | * there is no risk that the register values disappear as soon | ||
8257 | * as we call intel_runtime_pm_put(), so it is correct to wrap | ||
8258 | * only the pin/unpin/fence and not more. | ||
8259 | */ | ||
8260 | intel_runtime_pm_get(dev_priv); | ||
8261 | |||
8243 | /* Note that the w/a also requires 2 PTE of padding following | 8262 | /* Note that the w/a also requires 2 PTE of padding following |
8244 | * the bo. We currently fill all unused PTE with the shadow | 8263 | * the bo. We currently fill all unused PTE with the shadow |
8245 | * page and so we should always have valid PTE following the | 8264 | * page and so we should always have valid PTE following the |
@@ -8252,16 +8271,20 @@ static int intel_crtc_cursor_set_obj(struct drm_crtc *crtc, | |||
8252 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, NULL); | 8271 | ret = i915_gem_object_pin_to_display_plane(obj, alignment, NULL); |
8253 | if (ret) { | 8272 | if (ret) { |
8254 | DRM_DEBUG_KMS("failed to move cursor bo into the GTT\n"); | 8273 | DRM_DEBUG_KMS("failed to move cursor bo into the GTT\n"); |
8274 | intel_runtime_pm_put(dev_priv); | ||
8255 | goto fail_locked; | 8275 | goto fail_locked; |
8256 | } | 8276 | } |
8257 | 8277 | ||
8258 | ret = i915_gem_object_put_fence(obj); | 8278 | ret = i915_gem_object_put_fence(obj); |
8259 | if (ret) { | 8279 | if (ret) { |
8260 | DRM_DEBUG_KMS("failed to release fence for cursor"); | 8280 | DRM_DEBUG_KMS("failed to release fence for cursor"); |
8281 | intel_runtime_pm_put(dev_priv); | ||
8261 | goto fail_unpin; | 8282 | goto fail_unpin; |
8262 | } | 8283 | } |
8263 | 8284 | ||
8264 | addr = i915_gem_obj_ggtt_offset(obj); | 8285 | addr = i915_gem_obj_ggtt_offset(obj); |
8286 | |||
8287 | intel_runtime_pm_put(dev_priv); | ||
8265 | } else { | 8288 | } else { |
8266 | int align = IS_I830(dev) ? 16 * 1024 : 256; | 8289 | int align = IS_I830(dev) ? 16 * 1024 : 256; |
8267 | ret = i915_gem_object_attach_phys(obj, align); | 8290 | ret = i915_gem_object_attach_phys(obj, align); |
@@ -12481,6 +12504,9 @@ static struct intel_quirk intel_quirks[] = { | |||
12481 | /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ | 12504 | /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */ |
12482 | { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, | 12505 | { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present }, |
12483 | 12506 | ||
12507 | /* Acer C720 Chromebook (Core i3 4005U) */ | ||
12508 | { 0x0a16, 0x1025, 0x0a11, quirk_backlight_present }, | ||
12509 | |||
12484 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ | 12510 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ |
12485 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, | 12511 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, |
12486 | 12512 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 67cfed6d911a..fdff1d420c14 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1631,6 +1631,10 @@ static void intel_dp_get_config(struct intel_encoder *encoder, | |||
1631 | 1631 | ||
1632 | pipe_config->adjusted_mode.flags |= flags; | 1632 | pipe_config->adjusted_mode.flags |= flags; |
1633 | 1633 | ||
1634 | if (!HAS_PCH_SPLIT(dev) && !IS_VALLEYVIEW(dev) && | ||
1635 | tmp & DP_COLOR_RANGE_16_235) | ||
1636 | pipe_config->limited_color_range = true; | ||
1637 | |||
1634 | pipe_config->has_dp_encoder = true; | 1638 | pipe_config->has_dp_encoder = true; |
1635 | 1639 | ||
1636 | intel_dp_get_m_n(crtc, pipe_config); | 1640 | intel_dp_get_m_n(crtc, pipe_config); |
@@ -3661,24 +3665,12 @@ ironlake_dp_detect(struct intel_dp *intel_dp) | |||
3661 | return intel_dp_detect_dpcd(intel_dp); | 3665 | return intel_dp_detect_dpcd(intel_dp); |
3662 | } | 3666 | } |
3663 | 3667 | ||
3664 | static enum drm_connector_status | 3668 | static int g4x_digital_port_connected(struct drm_device *dev, |
3665 | g4x_dp_detect(struct intel_dp *intel_dp) | 3669 | struct intel_digital_port *intel_dig_port) |
3666 | { | 3670 | { |
3667 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
3668 | struct drm_i915_private *dev_priv = dev->dev_private; | 3671 | struct drm_i915_private *dev_priv = dev->dev_private; |
3669 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
3670 | uint32_t bit; | 3672 | uint32_t bit; |
3671 | 3673 | ||
3672 | /* Can't disconnect eDP, but you can close the lid... */ | ||
3673 | if (is_edp(intel_dp)) { | ||
3674 | enum drm_connector_status status; | ||
3675 | |||
3676 | status = intel_panel_detect(dev); | ||
3677 | if (status == connector_status_unknown) | ||
3678 | status = connector_status_connected; | ||
3679 | return status; | ||
3680 | } | ||
3681 | |||
3682 | if (IS_VALLEYVIEW(dev)) { | 3674 | if (IS_VALLEYVIEW(dev)) { |
3683 | switch (intel_dig_port->port) { | 3675 | switch (intel_dig_port->port) { |
3684 | case PORT_B: | 3676 | case PORT_B: |
@@ -3691,7 +3683,7 @@ g4x_dp_detect(struct intel_dp *intel_dp) | |||
3691 | bit = PORTD_HOTPLUG_LIVE_STATUS_VLV; | 3683 | bit = PORTD_HOTPLUG_LIVE_STATUS_VLV; |
3692 | break; | 3684 | break; |
3693 | default: | 3685 | default: |
3694 | return connector_status_unknown; | 3686 | return -EINVAL; |
3695 | } | 3687 | } |
3696 | } else { | 3688 | } else { |
3697 | switch (intel_dig_port->port) { | 3689 | switch (intel_dig_port->port) { |
@@ -3705,11 +3697,36 @@ g4x_dp_detect(struct intel_dp *intel_dp) | |||
3705 | bit = PORTD_HOTPLUG_LIVE_STATUS_G4X; | 3697 | bit = PORTD_HOTPLUG_LIVE_STATUS_G4X; |
3706 | break; | 3698 | break; |
3707 | default: | 3699 | default: |
3708 | return connector_status_unknown; | 3700 | return -EINVAL; |
3709 | } | 3701 | } |
3710 | } | 3702 | } |
3711 | 3703 | ||
3712 | if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0) | 3704 | if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0) |
3705 | return 0; | ||
3706 | return 1; | ||
3707 | } | ||
3708 | |||
3709 | static enum drm_connector_status | ||
3710 | g4x_dp_detect(struct intel_dp *intel_dp) | ||
3711 | { | ||
3712 | struct drm_device *dev = intel_dp_to_dev(intel_dp); | ||
3713 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | ||
3714 | int ret; | ||
3715 | |||
3716 | /* Can't disconnect eDP, but you can close the lid... */ | ||
3717 | if (is_edp(intel_dp)) { | ||
3718 | enum drm_connector_status status; | ||
3719 | |||
3720 | status = intel_panel_detect(dev); | ||
3721 | if (status == connector_status_unknown) | ||
3722 | status = connector_status_connected; | ||
3723 | return status; | ||
3724 | } | ||
3725 | |||
3726 | ret = g4x_digital_port_connected(dev, intel_dig_port); | ||
3727 | if (ret == -EINVAL) | ||
3728 | return connector_status_unknown; | ||
3729 | else if (ret == 0) | ||
3713 | return connector_status_disconnected; | 3730 | return connector_status_disconnected; |
3714 | 3731 | ||
3715 | return intel_dp_detect_dpcd(intel_dp); | 3732 | return intel_dp_detect_dpcd(intel_dp); |
@@ -4066,8 +4083,14 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | |||
4066 | intel_display_power_get(dev_priv, power_domain); | 4083 | intel_display_power_get(dev_priv, power_domain); |
4067 | 4084 | ||
4068 | if (long_hpd) { | 4085 | if (long_hpd) { |
4069 | if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) | 4086 | |
4070 | goto mst_fail; | 4087 | if (HAS_PCH_SPLIT(dev)) { |
4088 | if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) | ||
4089 | goto mst_fail; | ||
4090 | } else { | ||
4091 | if (g4x_digital_port_connected(dev, intel_dig_port) != 1) | ||
4092 | goto mst_fail; | ||
4093 | } | ||
4071 | 4094 | ||
4072 | if (!intel_dp_get_dpcd(intel_dp)) { | 4095 | if (!intel_dp_get_dpcd(intel_dp)) { |
4073 | goto mst_fail; | 4096 | goto mst_fail; |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index f9151f6641d9..5a9de21637b7 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -712,7 +712,8 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, | |||
712 | struct intel_crtc_config *pipe_config) | 712 | struct intel_crtc_config *pipe_config) |
713 | { | 713 | { |
714 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); | 714 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base); |
715 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; | 715 | struct drm_device *dev = encoder->base.dev; |
716 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
716 | u32 tmp, flags = 0; | 717 | u32 tmp, flags = 0; |
717 | int dotclock; | 718 | int dotclock; |
718 | 719 | ||
@@ -731,9 +732,13 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, | |||
731 | if (tmp & HDMI_MODE_SELECT_HDMI) | 732 | if (tmp & HDMI_MODE_SELECT_HDMI) |
732 | pipe_config->has_hdmi_sink = true; | 733 | pipe_config->has_hdmi_sink = true; |
733 | 734 | ||
734 | if (tmp & HDMI_MODE_SELECT_HDMI) | 735 | if (tmp & SDVO_AUDIO_ENABLE) |
735 | pipe_config->has_audio = true; | 736 | pipe_config->has_audio = true; |
736 | 737 | ||
738 | if (!HAS_PCH_SPLIT(dev) && | ||
739 | tmp & HDMI_COLOR_RANGE_16_235) | ||
740 | pipe_config->limited_color_range = true; | ||
741 | |||
737 | pipe_config->adjusted_mode.flags |= flags; | 742 | pipe_config->adjusted_mode.flags |= flags; |
738 | 743 | ||
739 | if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) | 744 | if ((tmp & SDVO_COLOR_FORMAT_MASK) == HDMI_COLOR_FORMAT_12bpc) |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 881361c0f27e..fdf40267249c 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -538,7 +538,7 @@ static const struct drm_encoder_funcs intel_lvds_enc_funcs = { | |||
538 | .destroy = intel_encoder_destroy, | 538 | .destroy = intel_encoder_destroy, |
539 | }; | 539 | }; |
540 | 540 | ||
541 | static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id) | 541 | static int intel_no_lvds_dmi_callback(const struct dmi_system_id *id) |
542 | { | 542 | { |
543 | DRM_INFO("Skipping LVDS initialization for %s\n", id->ident); | 543 | DRM_INFO("Skipping LVDS initialization for %s\n", id->ident); |
544 | return 1; | 544 | return 1; |
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c index ca52ad2ae7d1..d8de1d5140a7 100644 --- a/drivers/gpu/drm/i915/intel_opregion.c +++ b/drivers/gpu/drm/i915/intel_opregion.c | |||
@@ -396,6 +396,16 @@ int intel_opregion_notify_adapter(struct drm_device *dev, pci_power_t state) | |||
396 | return -EINVAL; | 396 | return -EINVAL; |
397 | } | 397 | } |
398 | 398 | ||
399 | /* | ||
400 | * If the vendor backlight interface is not in use and ACPI backlight interface | ||
401 | * is broken, do not bother processing backlight change requests from firmware. | ||
402 | */ | ||
403 | static bool should_ignore_backlight_request(void) | ||
404 | { | ||
405 | return acpi_video_backlight_support() && | ||
406 | !acpi_video_verify_backlight_support(); | ||
407 | } | ||
408 | |||
399 | static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) | 409 | static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) |
400 | { | 410 | { |
401 | struct drm_i915_private *dev_priv = dev->dev_private; | 411 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -404,11 +414,7 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) | |||
404 | 414 | ||
405 | DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); | 415 | DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); |
406 | 416 | ||
407 | /* | 417 | if (should_ignore_backlight_request()) { |
408 | * If the acpi_video interface is not supposed to be used, don't | ||
409 | * bother processing backlight level change requests from firmware. | ||
410 | */ | ||
411 | if (!acpi_video_verify_backlight_support()) { | ||
412 | DRM_DEBUG_KMS("opregion backlight request ignored\n"); | 418 | DRM_DEBUG_KMS("opregion backlight request ignored\n"); |
413 | return 0; | 419 | return 0; |
414 | } | 420 | } |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 59b028f0b1e8..8e374449c6b5 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -801,7 +801,7 @@ static void pch_enable_backlight(struct intel_connector *connector) | |||
801 | 801 | ||
802 | cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2); | 802 | cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2); |
803 | if (cpu_ctl2 & BLM_PWM_ENABLE) { | 803 | if (cpu_ctl2 & BLM_PWM_ENABLE) { |
804 | WARN(1, "cpu backlight already enabled\n"); | 804 | DRM_DEBUG_KMS("cpu backlight already enabled\n"); |
805 | cpu_ctl2 &= ~BLM_PWM_ENABLE; | 805 | cpu_ctl2 &= ~BLM_PWM_ENABLE; |
806 | I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2); | 806 | I915_WRITE(BLC_PWM_CPU_CTL2, cpu_ctl2); |
807 | } | 807 | } |
@@ -845,7 +845,7 @@ static void i9xx_enable_backlight(struct intel_connector *connector) | |||
845 | 845 | ||
846 | ctl = I915_READ(BLC_PWM_CTL); | 846 | ctl = I915_READ(BLC_PWM_CTL); |
847 | if (ctl & BACKLIGHT_DUTY_CYCLE_MASK_PNV) { | 847 | if (ctl & BACKLIGHT_DUTY_CYCLE_MASK_PNV) { |
848 | WARN(1, "backlight already enabled\n"); | 848 | DRM_DEBUG_KMS("backlight already enabled\n"); |
849 | I915_WRITE(BLC_PWM_CTL, 0); | 849 | I915_WRITE(BLC_PWM_CTL, 0); |
850 | } | 850 | } |
851 | 851 | ||
@@ -876,7 +876,7 @@ static void i965_enable_backlight(struct intel_connector *connector) | |||
876 | 876 | ||
877 | ctl2 = I915_READ(BLC_PWM_CTL2); | 877 | ctl2 = I915_READ(BLC_PWM_CTL2); |
878 | if (ctl2 & BLM_PWM_ENABLE) { | 878 | if (ctl2 & BLM_PWM_ENABLE) { |
879 | WARN(1, "backlight already enabled\n"); | 879 | DRM_DEBUG_KMS("backlight already enabled\n"); |
880 | ctl2 &= ~BLM_PWM_ENABLE; | 880 | ctl2 &= ~BLM_PWM_ENABLE; |
881 | I915_WRITE(BLC_PWM_CTL2, ctl2); | 881 | I915_WRITE(BLC_PWM_CTL2, ctl2); |
882 | } | 882 | } |
@@ -910,7 +910,7 @@ static void vlv_enable_backlight(struct intel_connector *connector) | |||
910 | 910 | ||
911 | ctl2 = I915_READ(VLV_BLC_PWM_CTL2(pipe)); | 911 | ctl2 = I915_READ(VLV_BLC_PWM_CTL2(pipe)); |
912 | if (ctl2 & BLM_PWM_ENABLE) { | 912 | if (ctl2 & BLM_PWM_ENABLE) { |
913 | WARN(1, "backlight already enabled\n"); | 913 | DRM_DEBUG_KMS("backlight already enabled\n"); |
914 | ctl2 &= ~BLM_PWM_ENABLE; | 914 | ctl2 &= ~BLM_PWM_ENABLE; |
915 | I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2); | 915 | I915_WRITE(VLV_BLC_PWM_CTL2(pipe), ctl2); |
916 | } | 916 | } |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 16371a444426..47a126a0493f 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -1363,54 +1363,66 @@ i965_dispatch_execbuffer(struct intel_engine_cs *ring, | |||
1363 | 1363 | ||
1364 | /* Just userspace ABI convention to limit the wa batch bo to a resonable size */ | 1364 | /* Just userspace ABI convention to limit the wa batch bo to a resonable size */ |
1365 | #define I830_BATCH_LIMIT (256*1024) | 1365 | #define I830_BATCH_LIMIT (256*1024) |
1366 | #define I830_TLB_ENTRIES (2) | ||
1367 | #define I830_WA_SIZE max(I830_TLB_ENTRIES*4096, I830_BATCH_LIMIT) | ||
1366 | static int | 1368 | static int |
1367 | i830_dispatch_execbuffer(struct intel_engine_cs *ring, | 1369 | i830_dispatch_execbuffer(struct intel_engine_cs *ring, |
1368 | u64 offset, u32 len, | 1370 | u64 offset, u32 len, |
1369 | unsigned flags) | 1371 | unsigned flags) |
1370 | { | 1372 | { |
1373 | u32 cs_offset = ring->scratch.gtt_offset; | ||
1371 | int ret; | 1374 | int ret; |
1372 | 1375 | ||
1373 | if (flags & I915_DISPATCH_PINNED) { | 1376 | ret = intel_ring_begin(ring, 6); |
1374 | ret = intel_ring_begin(ring, 4); | 1377 | if (ret) |
1375 | if (ret) | 1378 | return ret; |
1376 | return ret; | ||
1377 | 1379 | ||
1378 | intel_ring_emit(ring, MI_BATCH_BUFFER); | 1380 | /* Evict the invalid PTE TLBs */ |
1379 | intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | 1381 | intel_ring_emit(ring, COLOR_BLT_CMD | BLT_WRITE_RGBA); |
1380 | intel_ring_emit(ring, offset + len - 8); | 1382 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_COLOR_COPY | 4096); |
1381 | intel_ring_emit(ring, MI_NOOP); | 1383 | intel_ring_emit(ring, I830_TLB_ENTRIES << 16 | 4); /* load each page */ |
1382 | intel_ring_advance(ring); | 1384 | intel_ring_emit(ring, cs_offset); |
1383 | } else { | 1385 | intel_ring_emit(ring, 0xdeadbeef); |
1384 | u32 cs_offset = ring->scratch.gtt_offset; | 1386 | intel_ring_emit(ring, MI_NOOP); |
1387 | intel_ring_advance(ring); | ||
1385 | 1388 | ||
1389 | if ((flags & I915_DISPATCH_PINNED) == 0) { | ||
1386 | if (len > I830_BATCH_LIMIT) | 1390 | if (len > I830_BATCH_LIMIT) |
1387 | return -ENOSPC; | 1391 | return -ENOSPC; |
1388 | 1392 | ||
1389 | ret = intel_ring_begin(ring, 9+3); | 1393 | ret = intel_ring_begin(ring, 6 + 2); |
1390 | if (ret) | 1394 | if (ret) |
1391 | return ret; | 1395 | return ret; |
1392 | /* Blit the batch (which has now all relocs applied) to the stable batch | 1396 | |
1393 | * scratch bo area (so that the CS never stumbles over its tlb | 1397 | /* Blit the batch (which has now all relocs applied) to the |
1394 | * invalidation bug) ... */ | 1398 | * stable batch scratch bo area (so that the CS never |
1395 | intel_ring_emit(ring, XY_SRC_COPY_BLT_CMD | | 1399 | * stumbles over its tlb invalidation bug) ... |
1396 | XY_SRC_COPY_BLT_WRITE_ALPHA | | 1400 | */ |
1397 | XY_SRC_COPY_BLT_WRITE_RGB); | 1401 | intel_ring_emit(ring, SRC_COPY_BLT_CMD | BLT_WRITE_RGBA); |
1398 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_GXCOPY | 4096); | 1402 | intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_SRC_COPY | 4096); |
1399 | intel_ring_emit(ring, 0); | 1403 | intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 4096); |
1400 | intel_ring_emit(ring, (DIV_ROUND_UP(len, 4096) << 16) | 1024); | ||
1401 | intel_ring_emit(ring, cs_offset); | 1404 | intel_ring_emit(ring, cs_offset); |
1402 | intel_ring_emit(ring, 0); | ||
1403 | intel_ring_emit(ring, 4096); | 1405 | intel_ring_emit(ring, 4096); |
1404 | intel_ring_emit(ring, offset); | 1406 | intel_ring_emit(ring, offset); |
1407 | |||
1405 | intel_ring_emit(ring, MI_FLUSH); | 1408 | intel_ring_emit(ring, MI_FLUSH); |
1409 | intel_ring_emit(ring, MI_NOOP); | ||
1410 | intel_ring_advance(ring); | ||
1406 | 1411 | ||
1407 | /* ... and execute it. */ | 1412 | /* ... and execute it. */ |
1408 | intel_ring_emit(ring, MI_BATCH_BUFFER); | 1413 | offset = cs_offset; |
1409 | intel_ring_emit(ring, cs_offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | ||
1410 | intel_ring_emit(ring, cs_offset + len - 8); | ||
1411 | intel_ring_advance(ring); | ||
1412 | } | 1414 | } |
1413 | 1415 | ||
1416 | ret = intel_ring_begin(ring, 4); | ||
1417 | if (ret) | ||
1418 | return ret; | ||
1419 | |||
1420 | intel_ring_emit(ring, MI_BATCH_BUFFER); | ||
1421 | intel_ring_emit(ring, offset | (flags & I915_DISPATCH_SECURE ? 0 : MI_BATCH_NON_SECURE)); | ||
1422 | intel_ring_emit(ring, offset + len - 8); | ||
1423 | intel_ring_emit(ring, MI_NOOP); | ||
1424 | intel_ring_advance(ring); | ||
1425 | |||
1414 | return 0; | 1426 | return 0; |
1415 | } | 1427 | } |
1416 | 1428 | ||
@@ -2200,7 +2212,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev) | |||
2200 | 2212 | ||
2201 | /* Workaround batchbuffer to combat CS tlb bug. */ | 2213 | /* Workaround batchbuffer to combat CS tlb bug. */ |
2202 | if (HAS_BROKEN_CS_TLB(dev)) { | 2214 | if (HAS_BROKEN_CS_TLB(dev)) { |
2203 | obj = i915_gem_alloc_object(dev, I830_BATCH_LIMIT); | 2215 | obj = i915_gem_alloc_object(dev, I830_WA_SIZE); |
2204 | if (obj == NULL) { | 2216 | if (obj == NULL) { |
2205 | DRM_ERROR("Failed to allocate batch bo\n"); | 2217 | DRM_ERROR("Failed to allocate batch bo\n"); |
2206 | return -ENOMEM; | 2218 | return -ENOMEM; |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 32186a656816..c14341ca3ef9 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -854,6 +854,10 @@ intel_enable_tv(struct intel_encoder *encoder) | |||
854 | struct drm_device *dev = encoder->base.dev; | 854 | struct drm_device *dev = encoder->base.dev; |
855 | struct drm_i915_private *dev_priv = dev->dev_private; | 855 | struct drm_i915_private *dev_priv = dev->dev_private; |
856 | 856 | ||
857 | /* Prevents vblank waits from timing out in intel_tv_detect_type() */ | ||
858 | intel_wait_for_vblank(encoder->base.dev, | ||
859 | to_intel_crtc(encoder->base.crtc)->pipe); | ||
860 | |||
857 | I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); | 861 | I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); |
858 | } | 862 | } |
859 | 863 | ||
@@ -1311,6 +1315,7 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
1311 | { | 1315 | { |
1312 | struct drm_display_mode mode; | 1316 | struct drm_display_mode mode; |
1313 | struct intel_tv *intel_tv = intel_attached_tv(connector); | 1317 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
1318 | enum drm_connector_status status; | ||
1314 | int type; | 1319 | int type; |
1315 | 1320 | ||
1316 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force=%d\n", | 1321 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s] force=%d\n", |
@@ -1328,16 +1333,19 @@ intel_tv_detect(struct drm_connector *connector, bool force) | |||
1328 | if (intel_get_load_detect_pipe(connector, &mode, &tmp, &ctx)) { | 1333 | if (intel_get_load_detect_pipe(connector, &mode, &tmp, &ctx)) { |
1329 | type = intel_tv_detect_type(intel_tv, connector); | 1334 | type = intel_tv_detect_type(intel_tv, connector); |
1330 | intel_release_load_detect_pipe(connector, &tmp); | 1335 | intel_release_load_detect_pipe(connector, &tmp); |
1336 | status = type < 0 ? | ||
1337 | connector_status_disconnected : | ||
1338 | connector_status_connected; | ||
1331 | } else | 1339 | } else |
1332 | return connector_status_unknown; | 1340 | status = connector_status_unknown; |
1333 | 1341 | ||
1334 | drm_modeset_drop_locks(&ctx); | 1342 | drm_modeset_drop_locks(&ctx); |
1335 | drm_modeset_acquire_fini(&ctx); | 1343 | drm_modeset_acquire_fini(&ctx); |
1336 | } else | 1344 | } else |
1337 | return connector->status; | 1345 | return connector->status; |
1338 | 1346 | ||
1339 | if (type < 0) | 1347 | if (status != connector_status_connected) |
1340 | return connector_status_disconnected; | 1348 | return status; |
1341 | 1349 | ||
1342 | intel_tv->type = type; | 1350 | intel_tv->type = type; |
1343 | intel_tv_find_better_format(connector); | 1351 | intel_tv_find_better_format(connector); |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index a125a7e32742..c6c9b02e0ada 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c | |||
@@ -258,28 +258,30 @@ static void set_hdmi_pdev(struct drm_device *dev, | |||
258 | priv->hdmi_pdev = pdev; | 258 | priv->hdmi_pdev = pdev; |
259 | } | 259 | } |
260 | 260 | ||
261 | #ifdef CONFIG_OF | ||
262 | static int get_gpio(struct device *dev, struct device_node *of_node, const char *name) | ||
263 | { | ||
264 | int gpio = of_get_named_gpio(of_node, name, 0); | ||
265 | if (gpio < 0) { | ||
266 | char name2[32]; | ||
267 | snprintf(name2, sizeof(name2), "%s-gpio", name); | ||
268 | gpio = of_get_named_gpio(of_node, name2, 0); | ||
269 | if (gpio < 0) { | ||
270 | dev_err(dev, "failed to get gpio: %s (%d)\n", | ||
271 | name, gpio); | ||
272 | gpio = -1; | ||
273 | } | ||
274 | } | ||
275 | return gpio; | ||
276 | } | ||
277 | #endif | ||
278 | |||
261 | static int hdmi_bind(struct device *dev, struct device *master, void *data) | 279 | static int hdmi_bind(struct device *dev, struct device *master, void *data) |
262 | { | 280 | { |
263 | static struct hdmi_platform_config config = {}; | 281 | static struct hdmi_platform_config config = {}; |
264 | #ifdef CONFIG_OF | 282 | #ifdef CONFIG_OF |
265 | struct device_node *of_node = dev->of_node; | 283 | struct device_node *of_node = dev->of_node; |
266 | 284 | ||
267 | int get_gpio(const char *name) | ||
268 | { | ||
269 | int gpio = of_get_named_gpio(of_node, name, 0); | ||
270 | if (gpio < 0) { | ||
271 | char name2[32]; | ||
272 | snprintf(name2, sizeof(name2), "%s-gpio", name); | ||
273 | gpio = of_get_named_gpio(of_node, name2, 0); | ||
274 | if (gpio < 0) { | ||
275 | dev_err(dev, "failed to get gpio: %s (%d)\n", | ||
276 | name, gpio); | ||
277 | gpio = -1; | ||
278 | } | ||
279 | } | ||
280 | return gpio; | ||
281 | } | ||
282 | |||
283 | if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) { | 285 | if (of_device_is_compatible(of_node, "qcom,hdmi-tx-8074")) { |
284 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; | 286 | static const char *hpd_reg_names[] = {"hpd-gdsc", "hpd-5v"}; |
285 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; | 287 | static const char *pwr_reg_names[] = {"core-vdda", "core-vcc"}; |
@@ -312,12 +314,12 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
312 | } | 314 | } |
313 | 315 | ||
314 | config.mmio_name = "core_physical"; | 316 | config.mmio_name = "core_physical"; |
315 | config.ddc_clk_gpio = get_gpio("qcom,hdmi-tx-ddc-clk"); | 317 | config.ddc_clk_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-clk"); |
316 | config.ddc_data_gpio = get_gpio("qcom,hdmi-tx-ddc-data"); | 318 | config.ddc_data_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-data"); |
317 | config.hpd_gpio = get_gpio("qcom,hdmi-tx-hpd"); | 319 | config.hpd_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-hpd"); |
318 | config.mux_en_gpio = get_gpio("qcom,hdmi-tx-mux-en"); | 320 | config.mux_en_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-en"); |
319 | config.mux_sel_gpio = get_gpio("qcom,hdmi-tx-mux-sel"); | 321 | config.mux_sel_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-sel"); |
320 | config.mux_lpm_gpio = get_gpio("qcom,hdmi-tx-mux-lpm"); | 322 | config.mux_lpm_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-lpm"); |
321 | 323 | ||
322 | #else | 324 | #else |
323 | static const char *hpd_clk_names[] = { | 325 | static const char *hpd_clk_names[] = { |
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c index 902d7685d441..f408b69486a8 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c | |||
@@ -15,19 +15,25 @@ | |||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * this program. If not, see <http://www.gnu.org/licenses/>. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifdef CONFIG_COMMON_CLK | ||
18 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
19 | #include <linux/clk-provider.h> | 20 | #include <linux/clk-provider.h> |
21 | #endif | ||
20 | 22 | ||
21 | #include "hdmi.h" | 23 | #include "hdmi.h" |
22 | 24 | ||
23 | struct hdmi_phy_8960 { | 25 | struct hdmi_phy_8960 { |
24 | struct hdmi_phy base; | 26 | struct hdmi_phy base; |
25 | struct hdmi *hdmi; | 27 | struct hdmi *hdmi; |
28 | #ifdef CONFIG_COMMON_CLK | ||
26 | struct clk_hw pll_hw; | 29 | struct clk_hw pll_hw; |
27 | struct clk *pll; | 30 | struct clk *pll; |
28 | unsigned long pixclk; | 31 | unsigned long pixclk; |
32 | #endif | ||
29 | }; | 33 | }; |
30 | #define to_hdmi_phy_8960(x) container_of(x, struct hdmi_phy_8960, base) | 34 | #define to_hdmi_phy_8960(x) container_of(x, struct hdmi_phy_8960, base) |
35 | |||
36 | #ifdef CONFIG_COMMON_CLK | ||
31 | #define clk_to_phy(x) container_of(x, struct hdmi_phy_8960, pll_hw) | 37 | #define clk_to_phy(x) container_of(x, struct hdmi_phy_8960, pll_hw) |
32 | 38 | ||
33 | /* | 39 | /* |
@@ -374,7 +380,7 @@ static struct clk_init_data pll_init = { | |||
374 | .parent_names = hdmi_pll_parents, | 380 | .parent_names = hdmi_pll_parents, |
375 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), | 381 | .num_parents = ARRAY_SIZE(hdmi_pll_parents), |
376 | }; | 382 | }; |
377 | 383 | #endif | |
378 | 384 | ||
379 | /* | 385 | /* |
380 | * HDMI Phy: | 386 | * HDMI Phy: |
@@ -480,12 +486,15 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
480 | { | 486 | { |
481 | struct hdmi_phy_8960 *phy_8960; | 487 | struct hdmi_phy_8960 *phy_8960; |
482 | struct hdmi_phy *phy = NULL; | 488 | struct hdmi_phy *phy = NULL; |
483 | int ret, i; | 489 | int ret; |
490 | #ifdef CONFIG_COMMON_CLK | ||
491 | int i; | ||
484 | 492 | ||
485 | /* sanity check: */ | 493 | /* sanity check: */ |
486 | for (i = 0; i < (ARRAY_SIZE(freqtbl) - 1); i++) | 494 | for (i = 0; i < (ARRAY_SIZE(freqtbl) - 1); i++) |
487 | if (WARN_ON(freqtbl[i].rate < freqtbl[i+1].rate)) | 495 | if (WARN_ON(freqtbl[i].rate < freqtbl[i+1].rate)) |
488 | return ERR_PTR(-EINVAL); | 496 | return ERR_PTR(-EINVAL); |
497 | #endif | ||
489 | 498 | ||
490 | phy_8960 = kzalloc(sizeof(*phy_8960), GFP_KERNEL); | 499 | phy_8960 = kzalloc(sizeof(*phy_8960), GFP_KERNEL); |
491 | if (!phy_8960) { | 500 | if (!phy_8960) { |
@@ -499,6 +508,7 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
499 | 508 | ||
500 | phy_8960->hdmi = hdmi; | 509 | phy_8960->hdmi = hdmi; |
501 | 510 | ||
511 | #ifdef CONFIG_COMMON_CLK | ||
502 | phy_8960->pll_hw.init = &pll_init; | 512 | phy_8960->pll_hw.init = &pll_init; |
503 | phy_8960->pll = devm_clk_register(hdmi->dev->dev, &phy_8960->pll_hw); | 513 | phy_8960->pll = devm_clk_register(hdmi->dev->dev, &phy_8960->pll_hw); |
504 | if (IS_ERR(phy_8960->pll)) { | 514 | if (IS_ERR(phy_8960->pll)) { |
@@ -506,6 +516,7 @@ struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) | |||
506 | phy_8960->pll = NULL; | 516 | phy_8960->pll = NULL; |
507 | goto fail; | 517 | goto fail; |
508 | } | 518 | } |
519 | #endif | ||
509 | 520 | ||
510 | return phy; | 521 | return phy; |
511 | 522 | ||
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 26ee80db17af..fcf95680413d 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -52,7 +52,7 @@ module_param(reglog, bool, 0600); | |||
52 | #define reglog 0 | 52 | #define reglog 0 |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | static char *vram; | 55 | static char *vram = "16m"; |
56 | MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU"); | 56 | MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU"); |
57 | module_param(vram, charp, 0); | 57 | module_param(vram, charp, 0); |
58 | 58 | ||
diff --git a/drivers/gpu/drm/nouveau/core/core/parent.c b/drivers/gpu/drm/nouveau/core/core/parent.c index 8701968a9743..30a2911878f8 100644 --- a/drivers/gpu/drm/nouveau/core/core/parent.c +++ b/drivers/gpu/drm/nouveau/core/core/parent.c | |||
@@ -86,7 +86,7 @@ nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) | |||
86 | sclass = nv_parent(parent)->sclass; | 86 | sclass = nv_parent(parent)->sclass; |
87 | while (sclass) { | 87 | while (sclass) { |
88 | if (++nr < size) | 88 | if (++nr < size) |
89 | lclass[nr] = sclass->oclass->handle; | 89 | lclass[nr] = sclass->oclass->handle & 0xffff; |
90 | sclass = sclass->sclass; | 90 | sclass = sclass->sclass; |
91 | } | 91 | } |
92 | 92 | ||
@@ -96,7 +96,7 @@ nouveau_parent_lclass(struct nouveau_object *parent, u32 *lclass, int size) | |||
96 | if (engine && (oclass = engine->sclass)) { | 96 | if (engine && (oclass = engine->sclass)) { |
97 | while (oclass->ofuncs) { | 97 | while (oclass->ofuncs) { |
98 | if (++nr < size) | 98 | if (++nr < size) |
99 | lclass[nr] = oclass->handle; | 99 | lclass[nr] = oclass->handle & 0xffff; |
100 | oclass++; | 100 | oclass++; |
101 | } | 101 | } |
102 | } | 102 | } |
diff --git a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c index 4b5bb5d58a54..f8cbb512132f 100644 --- a/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +++ b/drivers/gpu/drm/nouveau/core/engine/disp/nv50.c | |||
@@ -1763,9 +1763,10 @@ nv50_disp_intr_unk40_0_tmds(struct nv50_disp_priv *priv, struct dcb_output *outp | |||
1763 | const int or = ffs(outp->or) - 1; | 1763 | const int or = ffs(outp->or) - 1; |
1764 | const u32 loff = (or * 0x800) + (link * 0x80); | 1764 | const u32 loff = (or * 0x800) + (link * 0x80); |
1765 | const u16 mask = (outp->sorconf.link << 6) | outp->or; | 1765 | const u16 mask = (outp->sorconf.link << 6) | outp->or; |
1766 | struct dcb_output match; | ||
1766 | u8 ver, hdr; | 1767 | u8 ver, hdr; |
1767 | 1768 | ||
1768 | if (dcb_outp_match(bios, DCB_OUTPUT_DP, mask, &ver, &hdr, outp)) | 1769 | if (dcb_outp_match(bios, DCB_OUTPUT_DP, mask, &ver, &hdr, &match)) |
1769 | nv_mask(priv, 0x61c10c + loff, 0x00000001, 0x00000000); | 1770 | nv_mask(priv, 0x61c10c + loff, 0x00000001, 0x00000000); |
1770 | } | 1771 | } |
1771 | 1772 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c index 0a44459844e3..05a278bab247 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bar/nvc0.c | |||
@@ -200,7 +200,6 @@ nvc0_bar_init(struct nouveau_object *object) | |||
200 | 200 | ||
201 | nv_mask(priv, 0x000200, 0x00000100, 0x00000000); | 201 | nv_mask(priv, 0x000200, 0x00000100, 0x00000000); |
202 | nv_mask(priv, 0x000200, 0x00000100, 0x00000100); | 202 | nv_mask(priv, 0x000200, 0x00000100, 0x00000100); |
203 | nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); | ||
204 | 203 | ||
205 | nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12); | 204 | nv_wr32(priv, 0x001704, 0x80000000 | priv->bar[1].mem->addr >> 12); |
206 | if (priv->bar[0].mem) | 205 | if (priv->bar[0].mem) |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c index b19a2b3c1081..32f28dc73ef2 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nvc0.c | |||
@@ -60,6 +60,7 @@ nvc0_fb_init(struct nouveau_object *object) | |||
60 | 60 | ||
61 | if (priv->r100c10_page) | 61 | if (priv->r100c10_page) |
62 | nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); | 62 | nv_wr32(priv, 0x100c10, priv->r100c10 >> 8); |
63 | nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ | ||
63 | return 0; | 64 | return 0; |
64 | } | 65 | } |
65 | 66 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c index b54b582e72c4..d5d65285efe5 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gf100.c | |||
@@ -98,6 +98,7 @@ static int | |||
98 | gf100_ltc_init(struct nouveau_object *object) | 98 | gf100_ltc_init(struct nouveau_object *object) |
99 | { | 99 | { |
100 | struct nvkm_ltc_priv *priv = (void *)object; | 100 | struct nvkm_ltc_priv *priv = (void *)object; |
101 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
101 | int ret; | 102 | int ret; |
102 | 103 | ||
103 | ret = nvkm_ltc_init(priv); | 104 | ret = nvkm_ltc_init(priv); |
@@ -107,6 +108,7 @@ gf100_ltc_init(struct nouveau_object *object) | |||
107 | nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ | 108 | nv_mask(priv, 0x17e820, 0x00100000, 0x00000000); /* INTR_EN &= ~0x10 */ |
108 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); | 109 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); |
109 | nv_wr32(priv, 0x17e8d4, priv->tag_base); | 110 | nv_wr32(priv, 0x17e8d4, priv->tag_base); |
111 | nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
110 | return 0; | 112 | return 0; |
111 | } | 113 | } |
112 | 114 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c index ea716569745d..b39b5d0eb8f9 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gk104.c | |||
@@ -28,6 +28,7 @@ static int | |||
28 | gk104_ltc_init(struct nouveau_object *object) | 28 | gk104_ltc_init(struct nouveau_object *object) |
29 | { | 29 | { |
30 | struct nvkm_ltc_priv *priv = (void *)object; | 30 | struct nvkm_ltc_priv *priv = (void *)object; |
31 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
31 | int ret; | 32 | int ret; |
32 | 33 | ||
33 | ret = nvkm_ltc_init(priv); | 34 | ret = nvkm_ltc_init(priv); |
@@ -37,6 +38,7 @@ gk104_ltc_init(struct nouveau_object *object) | |||
37 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); | 38 | nv_wr32(priv, 0x17e8d8, priv->ltc_nr); |
38 | nv_wr32(priv, 0x17e000, priv->ltc_nr); | 39 | nv_wr32(priv, 0x17e000, priv->ltc_nr); |
39 | nv_wr32(priv, 0x17e8d4, priv->tag_base); | 40 | nv_wr32(priv, 0x17e8d4, priv->tag_base); |
41 | nv_mask(priv, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
40 | return 0; | 42 | return 0; |
41 | } | 43 | } |
42 | 44 | ||
diff --git a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c index 4761b2e9af00..a4de64289762 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c +++ b/drivers/gpu/drm/nouveau/core/subdev/ltc/gm107.c | |||
@@ -98,6 +98,7 @@ static int | |||
98 | gm107_ltc_init(struct nouveau_object *object) | 98 | gm107_ltc_init(struct nouveau_object *object) |
99 | { | 99 | { |
100 | struct nvkm_ltc_priv *priv = (void *)object; | 100 | struct nvkm_ltc_priv *priv = (void *)object; |
101 | u32 lpg128 = !(nv_rd32(priv, 0x100c80) & 0x00000001); | ||
101 | int ret; | 102 | int ret; |
102 | 103 | ||
103 | ret = nvkm_ltc_init(priv); | 104 | ret = nvkm_ltc_init(priv); |
@@ -106,6 +107,7 @@ gm107_ltc_init(struct nouveau_object *object) | |||
106 | 107 | ||
107 | nv_wr32(priv, 0x17e27c, priv->ltc_nr); | 108 | nv_wr32(priv, 0x17e27c, priv->ltc_nr); |
108 | nv_wr32(priv, 0x17e278, priv->tag_base); | 109 | nv_wr32(priv, 0x17e278, priv->tag_base); |
110 | nv_mask(priv, 0x17e264, 0x00000002, lpg128 ? 0x00000002 : 0x00000000); | ||
109 | return 0; | 111 | return 0; |
110 | } | 112 | } |
111 | 113 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 279206997e5c..622424692b3b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
@@ -46,7 +46,6 @@ static struct nouveau_dsm_priv { | |||
46 | bool dsm_detected; | 46 | bool dsm_detected; |
47 | bool optimus_detected; | 47 | bool optimus_detected; |
48 | acpi_handle dhandle; | 48 | acpi_handle dhandle; |
49 | acpi_handle other_handle; | ||
50 | acpi_handle rom_handle; | 49 | acpi_handle rom_handle; |
51 | } nouveau_dsm_priv; | 50 | } nouveau_dsm_priv; |
52 | 51 | ||
@@ -222,10 +221,9 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) | |||
222 | if (!dhandle) | 221 | if (!dhandle) |
223 | return false; | 222 | return false; |
224 | 223 | ||
225 | if (!acpi_has_method(dhandle, "_DSM")) { | 224 | if (!acpi_has_method(dhandle, "_DSM")) |
226 | nouveau_dsm_priv.other_handle = dhandle; | ||
227 | return false; | 225 | return false; |
228 | } | 226 | |
229 | if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, | 227 | if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, |
230 | 1 << NOUVEAU_DSM_POWER)) | 228 | 1 << NOUVEAU_DSM_POWER)) |
231 | retval |= NOUVEAU_DSM_HAS_MUX; | 229 | retval |= NOUVEAU_DSM_HAS_MUX; |
@@ -301,16 +299,6 @@ static bool nouveau_dsm_detect(void) | |||
301 | printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", | 299 | printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", |
302 | acpi_method_name); | 300 | acpi_method_name); |
303 | nouveau_dsm_priv.dsm_detected = true; | 301 | nouveau_dsm_priv.dsm_detected = true; |
304 | /* | ||
305 | * On some systems hotplug events are generated for the device | ||
306 | * being switched off when _DSM is executed. They cause ACPI | ||
307 | * hotplug to trigger and attempt to remove the device from | ||
308 | * the system, which causes it to break down. Prevent that from | ||
309 | * happening by setting the no_hotplug flag for the involved | ||
310 | * ACPI device objects. | ||
311 | */ | ||
312 | acpi_bus_no_hotplug(nouveau_dsm_priv.dhandle); | ||
313 | acpi_bus_no_hotplug(nouveau_dsm_priv.other_handle); | ||
314 | ret = true; | 302 | ret = true; |
315 | } | 303 | } |
316 | 304 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index 99cd9e4a2aa6..3440fc999f2f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c | |||
@@ -285,6 +285,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) | |||
285 | struct nouveau_software_chan *swch; | 285 | struct nouveau_software_chan *swch; |
286 | struct nv_dma_v0 args = {}; | 286 | struct nv_dma_v0 args = {}; |
287 | int ret, i; | 287 | int ret, i; |
288 | bool save; | ||
288 | 289 | ||
289 | nvif_object_map(chan->object); | 290 | nvif_object_map(chan->object); |
290 | 291 | ||
@@ -386,7 +387,11 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) | |||
386 | } | 387 | } |
387 | 388 | ||
388 | /* initialise synchronisation */ | 389 | /* initialise synchronisation */ |
389 | return nouveau_fence(chan->drm)->context_new(chan); | 390 | save = cli->base.super; |
391 | cli->base.super = true; /* hack until fencenv50 fixed */ | ||
392 | ret = nouveau_fence(chan->drm)->context_new(chan); | ||
393 | cli->base.super = save; | ||
394 | return ret; | ||
390 | } | 395 | } |
391 | 396 | ||
392 | int | 397 | int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index 65b4fd53dd4e..4a21b2b06ce2 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -550,14 +550,12 @@ nouveau_display_destroy(struct drm_device *dev) | |||
550 | } | 550 | } |
551 | 551 | ||
552 | int | 552 | int |
553 | nouveau_display_suspend(struct drm_device *dev) | 553 | nouveau_display_suspend(struct drm_device *dev, bool runtime) |
554 | { | 554 | { |
555 | struct nouveau_drm *drm = nouveau_drm(dev); | ||
556 | struct drm_crtc *crtc; | 555 | struct drm_crtc *crtc; |
557 | 556 | ||
558 | nouveau_display_fini(dev); | 557 | nouveau_display_fini(dev); |
559 | 558 | ||
560 | NV_INFO(drm, "unpinning framebuffer(s)...\n"); | ||
561 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 559 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
562 | struct nouveau_framebuffer *nouveau_fb; | 560 | struct nouveau_framebuffer *nouveau_fb; |
563 | 561 | ||
@@ -579,12 +577,13 @@ nouveau_display_suspend(struct drm_device *dev) | |||
579 | } | 577 | } |
580 | 578 | ||
581 | void | 579 | void |
582 | nouveau_display_repin(struct drm_device *dev) | 580 | nouveau_display_resume(struct drm_device *dev, bool runtime) |
583 | { | 581 | { |
584 | struct nouveau_drm *drm = nouveau_drm(dev); | 582 | struct nouveau_drm *drm = nouveau_drm(dev); |
585 | struct drm_crtc *crtc; | 583 | struct drm_crtc *crtc; |
586 | int ret; | 584 | int ret, head; |
587 | 585 | ||
586 | /* re-pin fb/cursors */ | ||
588 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 587 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
589 | struct nouveau_framebuffer *nouveau_fb; | 588 | struct nouveau_framebuffer *nouveau_fb; |
590 | 589 | ||
@@ -606,13 +605,6 @@ nouveau_display_repin(struct drm_device *dev) | |||
606 | if (ret) | 605 | if (ret) |
607 | NV_ERROR(drm, "Could not pin/map cursor.\n"); | 606 | NV_ERROR(drm, "Could not pin/map cursor.\n"); |
608 | } | 607 | } |
609 | } | ||
610 | |||
611 | void | ||
612 | nouveau_display_resume(struct drm_device *dev) | ||
613 | { | ||
614 | struct drm_crtc *crtc; | ||
615 | int head; | ||
616 | 608 | ||
617 | nouveau_display_init(dev); | 609 | nouveau_display_init(dev); |
618 | 610 | ||
@@ -627,6 +619,13 @@ nouveau_display_resume(struct drm_device *dev) | |||
627 | for (head = 0; head < dev->mode_config.num_crtc; head++) | 619 | for (head = 0; head < dev->mode_config.num_crtc; head++) |
628 | drm_vblank_on(dev, head); | 620 | drm_vblank_on(dev, head); |
629 | 621 | ||
622 | /* This should ensure we don't hit a locking problem when someone | ||
623 | * wakes us up via a connector. We should never go into suspend | ||
624 | * while the display is on anyways. | ||
625 | */ | ||
626 | if (runtime) | ||
627 | return; | ||
628 | |||
630 | drm_helper_resume_force_mode(dev); | 629 | drm_helper_resume_force_mode(dev); |
631 | 630 | ||
632 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 631 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h index 88ca177cb1c7..be3d5947c6be 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.h +++ b/drivers/gpu/drm/nouveau/nouveau_display.h | |||
@@ -63,9 +63,8 @@ int nouveau_display_create(struct drm_device *dev); | |||
63 | void nouveau_display_destroy(struct drm_device *dev); | 63 | void nouveau_display_destroy(struct drm_device *dev); |
64 | int nouveau_display_init(struct drm_device *dev); | 64 | int nouveau_display_init(struct drm_device *dev); |
65 | void nouveau_display_fini(struct drm_device *dev); | 65 | void nouveau_display_fini(struct drm_device *dev); |
66 | int nouveau_display_suspend(struct drm_device *dev); | 66 | int nouveau_display_suspend(struct drm_device *dev, bool runtime); |
67 | void nouveau_display_repin(struct drm_device *dev); | 67 | void nouveau_display_resume(struct drm_device *dev, bool runtime); |
68 | void nouveau_display_resume(struct drm_device *dev); | ||
69 | int nouveau_display_vblank_enable(struct drm_device *, int); | 68 | int nouveau_display_vblank_enable(struct drm_device *, int); |
70 | void nouveau_display_vblank_disable(struct drm_device *, int); | 69 | void nouveau_display_vblank_disable(struct drm_device *, int); |
71 | int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int, | 70 | int nouveau_display_scanoutpos(struct drm_device *, int, unsigned int, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 250a5e88c751..3ed32dd90303 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -547,9 +547,11 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime) | |||
547 | struct nouveau_cli *cli; | 547 | struct nouveau_cli *cli; |
548 | int ret; | 548 | int ret; |
549 | 549 | ||
550 | if (dev->mode_config.num_crtc && !runtime) { | 550 | if (dev->mode_config.num_crtc) { |
551 | NV_INFO(drm, "suspending console...\n"); | ||
552 | nouveau_fbcon_set_suspend(dev, 1); | ||
551 | NV_INFO(drm, "suspending display...\n"); | 553 | NV_INFO(drm, "suspending display...\n"); |
552 | ret = nouveau_display_suspend(dev); | 554 | ret = nouveau_display_suspend(dev, runtime); |
553 | if (ret) | 555 | if (ret) |
554 | return ret; | 556 | return ret; |
555 | } | 557 | } |
@@ -603,7 +605,7 @@ fail_client: | |||
603 | fail_display: | 605 | fail_display: |
604 | if (dev->mode_config.num_crtc) { | 606 | if (dev->mode_config.num_crtc) { |
605 | NV_INFO(drm, "resuming display...\n"); | 607 | NV_INFO(drm, "resuming display...\n"); |
606 | nouveau_display_resume(dev); | 608 | nouveau_display_resume(dev, runtime); |
607 | } | 609 | } |
608 | return ret; | 610 | return ret; |
609 | } | 611 | } |
@@ -618,21 +620,19 @@ int nouveau_pmops_suspend(struct device *dev) | |||
618 | drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF) | 620 | drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF) |
619 | return 0; | 621 | return 0; |
620 | 622 | ||
621 | if (drm_dev->mode_config.num_crtc) | ||
622 | nouveau_fbcon_set_suspend(drm_dev, 1); | ||
623 | |||
624 | ret = nouveau_do_suspend(drm_dev, false); | 623 | ret = nouveau_do_suspend(drm_dev, false); |
625 | if (ret) | 624 | if (ret) |
626 | return ret; | 625 | return ret; |
627 | 626 | ||
628 | pci_save_state(pdev); | 627 | pci_save_state(pdev); |
629 | pci_disable_device(pdev); | 628 | pci_disable_device(pdev); |
629 | pci_ignore_hotplug(pdev); | ||
630 | pci_set_power_state(pdev, PCI_D3hot); | 630 | pci_set_power_state(pdev, PCI_D3hot); |
631 | return 0; | 631 | return 0; |
632 | } | 632 | } |
633 | 633 | ||
634 | static int | 634 | static int |
635 | nouveau_do_resume(struct drm_device *dev) | 635 | nouveau_do_resume(struct drm_device *dev, bool runtime) |
636 | { | 636 | { |
637 | struct nouveau_drm *drm = nouveau_drm(dev); | 637 | struct nouveau_drm *drm = nouveau_drm(dev); |
638 | struct nouveau_cli *cli; | 638 | struct nouveau_cli *cli; |
@@ -657,7 +657,9 @@ nouveau_do_resume(struct drm_device *dev) | |||
657 | 657 | ||
658 | if (dev->mode_config.num_crtc) { | 658 | if (dev->mode_config.num_crtc) { |
659 | NV_INFO(drm, "resuming display...\n"); | 659 | NV_INFO(drm, "resuming display...\n"); |
660 | nouveau_display_repin(dev); | 660 | nouveau_display_resume(dev, runtime); |
661 | NV_INFO(drm, "resuming console...\n"); | ||
662 | nouveau_fbcon_set_suspend(dev, 0); | ||
661 | } | 663 | } |
662 | 664 | ||
663 | return 0; | 665 | return 0; |
@@ -680,47 +682,21 @@ int nouveau_pmops_resume(struct device *dev) | |||
680 | return ret; | 682 | return ret; |
681 | pci_set_master(pdev); | 683 | pci_set_master(pdev); |
682 | 684 | ||
683 | ret = nouveau_do_resume(drm_dev); | 685 | return nouveau_do_resume(drm_dev, false); |
684 | if (ret) | ||
685 | return ret; | ||
686 | |||
687 | if (drm_dev->mode_config.num_crtc) { | ||
688 | nouveau_display_resume(drm_dev); | ||
689 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
690 | } | ||
691 | |||
692 | return 0; | ||
693 | } | 686 | } |
694 | 687 | ||
695 | static int nouveau_pmops_freeze(struct device *dev) | 688 | static int nouveau_pmops_freeze(struct device *dev) |
696 | { | 689 | { |
697 | struct pci_dev *pdev = to_pci_dev(dev); | 690 | struct pci_dev *pdev = to_pci_dev(dev); |
698 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | 691 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
699 | int ret; | 692 | return nouveau_do_suspend(drm_dev, false); |
700 | |||
701 | if (drm_dev->mode_config.num_crtc) | ||
702 | nouveau_fbcon_set_suspend(drm_dev, 1); | ||
703 | |||
704 | ret = nouveau_do_suspend(drm_dev, false); | ||
705 | return ret; | ||
706 | } | 693 | } |
707 | 694 | ||
708 | static int nouveau_pmops_thaw(struct device *dev) | 695 | static int nouveau_pmops_thaw(struct device *dev) |
709 | { | 696 | { |
710 | struct pci_dev *pdev = to_pci_dev(dev); | 697 | struct pci_dev *pdev = to_pci_dev(dev); |
711 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | 698 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
712 | int ret; | 699 | return nouveau_do_resume(drm_dev, false); |
713 | |||
714 | ret = nouveau_do_resume(drm_dev); | ||
715 | if (ret) | ||
716 | return ret; | ||
717 | |||
718 | if (drm_dev->mode_config.num_crtc) { | ||
719 | nouveau_display_resume(drm_dev); | ||
720 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
721 | } | ||
722 | |||
723 | return 0; | ||
724 | } | 700 | } |
725 | 701 | ||
726 | 702 | ||
@@ -976,7 +952,7 @@ static int nouveau_pmops_runtime_resume(struct device *dev) | |||
976 | return ret; | 952 | return ret; |
977 | pci_set_master(pdev); | 953 | pci_set_master(pdev); |
978 | 954 | ||
979 | ret = nouveau_do_resume(drm_dev); | 955 | ret = nouveau_do_resume(drm_dev, true); |
980 | drm_kms_helper_poll_enable(drm_dev); | 956 | drm_kms_helper_poll_enable(drm_dev); |
981 | /* do magic */ | 957 | /* do magic */ |
982 | nvif_mask(device, 0x88488, (1 << 25), (1 << 25)); | 958 | nvif_mask(device, 0x88488, (1 << 25), (1 << 25)); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 8bdd27091db8..49fe6075cc7c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -486,6 +486,16 @@ static const struct drm_fb_helper_funcs nouveau_fbcon_helper_funcs = { | |||
486 | .fb_probe = nouveau_fbcon_create, | 486 | .fb_probe = nouveau_fbcon_create, |
487 | }; | 487 | }; |
488 | 488 | ||
489 | static void | ||
490 | nouveau_fbcon_set_suspend_work(struct work_struct *work) | ||
491 | { | ||
492 | struct nouveau_fbdev *fbcon = container_of(work, typeof(*fbcon), work); | ||
493 | console_lock(); | ||
494 | nouveau_fbcon_accel_restore(fbcon->dev); | ||
495 | nouveau_fbcon_zfill(fbcon->dev, fbcon); | ||
496 | fb_set_suspend(fbcon->helper.fbdev, FBINFO_STATE_RUNNING); | ||
497 | console_unlock(); | ||
498 | } | ||
489 | 499 | ||
490 | int | 500 | int |
491 | nouveau_fbcon_init(struct drm_device *dev) | 501 | nouveau_fbcon_init(struct drm_device *dev) |
@@ -503,6 +513,7 @@ nouveau_fbcon_init(struct drm_device *dev) | |||
503 | if (!fbcon) | 513 | if (!fbcon) |
504 | return -ENOMEM; | 514 | return -ENOMEM; |
505 | 515 | ||
516 | INIT_WORK(&fbcon->work, nouveau_fbcon_set_suspend_work); | ||
506 | fbcon->dev = dev; | 517 | fbcon->dev = dev; |
507 | drm->fbcon = fbcon; | 518 | drm->fbcon = fbcon; |
508 | 519 | ||
@@ -551,14 +562,14 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state) | |||
551 | { | 562 | { |
552 | struct nouveau_drm *drm = nouveau_drm(dev); | 563 | struct nouveau_drm *drm = nouveau_drm(dev); |
553 | if (drm->fbcon) { | 564 | if (drm->fbcon) { |
554 | console_lock(); | 565 | if (state == FBINFO_STATE_RUNNING) { |
555 | if (state == 0) { | 566 | schedule_work(&drm->fbcon->work); |
556 | nouveau_fbcon_accel_restore(dev); | 567 | return; |
557 | nouveau_fbcon_zfill(dev, drm->fbcon); | ||
558 | } | 568 | } |
569 | flush_work(&drm->fbcon->work); | ||
570 | console_lock(); | ||
559 | fb_set_suspend(drm->fbcon->helper.fbdev, state); | 571 | fb_set_suspend(drm->fbcon->helper.fbdev, state); |
560 | if (state == 1) | 572 | nouveau_fbcon_accel_save_disable(dev); |
561 | nouveau_fbcon_accel_save_disable(dev); | ||
562 | console_unlock(); | 573 | console_unlock(); |
563 | } | 574 | } |
564 | } | 575 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.h b/drivers/gpu/drm/nouveau/nouveau_fbcon.h index 34658cfa8f5d..0b465c7d3907 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.h +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.h | |||
@@ -36,6 +36,7 @@ struct nouveau_fbdev { | |||
36 | struct nouveau_framebuffer nouveau_fb; | 36 | struct nouveau_framebuffer nouveau_fb; |
37 | struct list_head fbdev_list; | 37 | struct list_head fbdev_list; |
38 | struct drm_device *dev; | 38 | struct drm_device *dev; |
39 | struct work_struct work; | ||
39 | unsigned int saved_flags; | 40 | unsigned int saved_flags; |
40 | struct nvif_object surf2d; | 41 | struct nvif_object surf2d; |
41 | struct nvif_object clip; | 42 | struct nvif_object clip; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c index 18d55d447248..c7592ec8ecb8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_vga.c +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c | |||
@@ -108,7 +108,16 @@ void | |||
108 | nouveau_vga_fini(struct nouveau_drm *drm) | 108 | nouveau_vga_fini(struct nouveau_drm *drm) |
109 | { | 109 | { |
110 | struct drm_device *dev = drm->dev; | 110 | struct drm_device *dev = drm->dev; |
111 | bool runtime = false; | ||
112 | |||
113 | if (nouveau_runtime_pm == 1) | ||
114 | runtime = true; | ||
115 | if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm())) | ||
116 | runtime = true; | ||
117 | |||
111 | vga_switcheroo_unregister_client(dev->pdev); | 118 | vga_switcheroo_unregister_client(dev->pdev); |
119 | if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus()) | ||
120 | vga_switcheroo_fini_domain_pm_ops(drm->dev->dev); | ||
112 | vga_client_register(dev->pdev, NULL, NULL, NULL); | 121 | vga_client_register(dev->pdev, NULL, NULL, NULL); |
113 | } | 122 | } |
114 | 123 | ||
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index b1e11f8434e2..ac14b67621d3 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -405,16 +405,13 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
405 | u8 msg[DP_DPCD_SIZE]; | 405 | u8 msg[DP_DPCD_SIZE]; |
406 | int ret; | 406 | int ret; |
407 | 407 | ||
408 | char dpcd_hex_dump[DP_DPCD_SIZE * 3]; | ||
409 | |||
410 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 408 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
411 | DP_DPCD_SIZE); | 409 | DP_DPCD_SIZE); |
412 | if (ret > 0) { | 410 | if (ret > 0) { |
413 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 411 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); |
414 | 412 | ||
415 | hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd), | 413 | DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), |
416 | 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); | 414 | dig_connector->dpcd); |
417 | DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump); | ||
418 | 415 | ||
419 | radeon_dp_probe_oui(radeon_connector); | 416 | radeon_dp_probe_oui(radeon_connector); |
420 | 417 | ||
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index fa9565957f9d..3d546c606b43 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -4803,7 +4803,7 @@ struct bonaire_mqd | |||
4803 | */ | 4803 | */ |
4804 | static int cik_cp_compute_resume(struct radeon_device *rdev) | 4804 | static int cik_cp_compute_resume(struct radeon_device *rdev) |
4805 | { | 4805 | { |
4806 | int r, i, idx; | 4806 | int r, i, j, idx; |
4807 | u32 tmp; | 4807 | u32 tmp; |
4808 | bool use_doorbell = true; | 4808 | bool use_doorbell = true; |
4809 | u64 hqd_gpu_addr; | 4809 | u64 hqd_gpu_addr; |
@@ -4922,7 +4922,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev) | |||
4922 | mqd->queue_state.cp_hqd_pq_wptr= 0; | 4922 | mqd->queue_state.cp_hqd_pq_wptr= 0; |
4923 | if (RREG32(CP_HQD_ACTIVE) & 1) { | 4923 | if (RREG32(CP_HQD_ACTIVE) & 1) { |
4924 | WREG32(CP_HQD_DEQUEUE_REQUEST, 1); | 4924 | WREG32(CP_HQD_DEQUEUE_REQUEST, 1); |
4925 | for (i = 0; i < rdev->usec_timeout; i++) { | 4925 | for (j = 0; j < rdev->usec_timeout; j++) { |
4926 | if (!(RREG32(CP_HQD_ACTIVE) & 1)) | 4926 | if (!(RREG32(CP_HQD_ACTIVE) & 1)) |
4927 | break; | 4927 | break; |
4928 | udelay(1); | 4928 | udelay(1); |
@@ -7751,17 +7751,17 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev) | |||
7751 | wptr = RREG32(IH_RB_WPTR); | 7751 | wptr = RREG32(IH_RB_WPTR); |
7752 | 7752 | ||
7753 | if (wptr & RB_OVERFLOW) { | 7753 | if (wptr & RB_OVERFLOW) { |
7754 | wptr &= ~RB_OVERFLOW; | ||
7754 | /* When a ring buffer overflow happen start parsing interrupt | 7755 | /* When a ring buffer overflow happen start parsing interrupt |
7755 | * from the last not overwritten vector (wptr + 16). Hopefully | 7756 | * from the last not overwritten vector (wptr + 16). Hopefully |
7756 | * this should allow us to catchup. | 7757 | * this should allow us to catchup. |
7757 | */ | 7758 | */ |
7758 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 7759 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
7759 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 7760 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
7760 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 7761 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
7761 | tmp = RREG32(IH_RB_CNTL); | 7762 | tmp = RREG32(IH_RB_CNTL); |
7762 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 7763 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
7763 | WREG32(IH_RB_CNTL, tmp); | 7764 | WREG32(IH_RB_CNTL, tmp); |
7764 | wptr &= ~RB_OVERFLOW; | ||
7765 | } | 7765 | } |
7766 | return (wptr & rdev->ih.ptr_mask); | 7766 | return (wptr & rdev->ih.ptr_mask); |
7767 | } | 7767 | } |
@@ -8251,6 +8251,7 @@ restart_ih: | |||
8251 | /* wptr/rptr are in bytes! */ | 8251 | /* wptr/rptr are in bytes! */ |
8252 | rptr += 16; | 8252 | rptr += 16; |
8253 | rptr &= rdev->ih.ptr_mask; | 8253 | rptr &= rdev->ih.ptr_mask; |
8254 | WREG32(IH_RB_RPTR, rptr); | ||
8254 | } | 8255 | } |
8255 | if (queue_hotplug) | 8256 | if (queue_hotplug) |
8256 | schedule_work(&rdev->hotplug_work); | 8257 | schedule_work(&rdev->hotplug_work); |
@@ -8259,7 +8260,6 @@ restart_ih: | |||
8259 | if (queue_thermal) | 8260 | if (queue_thermal) |
8260 | schedule_work(&rdev->pm.dpm.thermal.work); | 8261 | schedule_work(&rdev->pm.dpm.thermal.work); |
8261 | rdev->ih.rptr = rptr; | 8262 | rdev->ih.rptr = rptr; |
8262 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
8263 | atomic_set(&rdev->ih.lock, 0); | 8263 | atomic_set(&rdev->ih.lock, 0); |
8264 | 8264 | ||
8265 | /* make sure wptr hasn't changed while processing */ | 8265 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index 192278bc993c..c4ffa54b1e3d 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -489,13 +489,6 @@ int cik_sdma_resume(struct radeon_device *rdev) | |||
489 | { | 489 | { |
490 | int r; | 490 | int r; |
491 | 491 | ||
492 | /* Reset dma */ | ||
493 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_SDMA | SOFT_RESET_SDMA1); | ||
494 | RREG32(SRBM_SOFT_RESET); | ||
495 | udelay(50); | ||
496 | WREG32(SRBM_SOFT_RESET, 0); | ||
497 | RREG32(SRBM_SOFT_RESET); | ||
498 | |||
499 | r = cik_sdma_load_microcode(rdev); | 492 | r = cik_sdma_load_microcode(rdev); |
500 | if (r) | 493 | if (r) |
501 | return r; | 494 | return r; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index dbca60c7d097..e50807c29f69 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -4749,17 +4749,17 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev) | |||
4749 | wptr = RREG32(IH_RB_WPTR); | 4749 | wptr = RREG32(IH_RB_WPTR); |
4750 | 4750 | ||
4751 | if (wptr & RB_OVERFLOW) { | 4751 | if (wptr & RB_OVERFLOW) { |
4752 | wptr &= ~RB_OVERFLOW; | ||
4752 | /* When a ring buffer overflow happen start parsing interrupt | 4753 | /* When a ring buffer overflow happen start parsing interrupt |
4753 | * from the last not overwritten vector (wptr + 16). Hopefully | 4754 | * from the last not overwritten vector (wptr + 16). Hopefully |
4754 | * this should allow us to catchup. | 4755 | * this should allow us to catchup. |
4755 | */ | 4756 | */ |
4756 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 4757 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
4757 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 4758 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
4758 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 4759 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
4759 | tmp = RREG32(IH_RB_CNTL); | 4760 | tmp = RREG32(IH_RB_CNTL); |
4760 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 4761 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
4761 | WREG32(IH_RB_CNTL, tmp); | 4762 | WREG32(IH_RB_CNTL, tmp); |
4762 | wptr &= ~RB_OVERFLOW; | ||
4763 | } | 4763 | } |
4764 | return (wptr & rdev->ih.ptr_mask); | 4764 | return (wptr & rdev->ih.ptr_mask); |
4765 | } | 4765 | } |
@@ -5137,6 +5137,7 @@ restart_ih: | |||
5137 | /* wptr/rptr are in bytes! */ | 5137 | /* wptr/rptr are in bytes! */ |
5138 | rptr += 16; | 5138 | rptr += 16; |
5139 | rptr &= rdev->ih.ptr_mask; | 5139 | rptr &= rdev->ih.ptr_mask; |
5140 | WREG32(IH_RB_RPTR, rptr); | ||
5140 | } | 5141 | } |
5141 | if (queue_hotplug) | 5142 | if (queue_hotplug) |
5142 | schedule_work(&rdev->hotplug_work); | 5143 | schedule_work(&rdev->hotplug_work); |
@@ -5145,7 +5146,6 @@ restart_ih: | |||
5145 | if (queue_thermal && rdev->pm.dpm_enabled) | 5146 | if (queue_thermal && rdev->pm.dpm_enabled) |
5146 | schedule_work(&rdev->pm.dpm.thermal.work); | 5147 | schedule_work(&rdev->pm.dpm.thermal.work); |
5147 | rdev->ih.rptr = rptr; | 5148 | rdev->ih.rptr = rptr; |
5148 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
5149 | atomic_set(&rdev->ih.lock, 0); | 5149 | atomic_set(&rdev->ih.lock, 0); |
5150 | 5150 | ||
5151 | /* make sure wptr hasn't changed while processing */ | 5151 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 8b58e11b64fa..67cb472d188c 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #define KV_MINIMUM_ENGINE_CLOCK 800 | 33 | #define KV_MINIMUM_ENGINE_CLOCK 800 |
34 | #define SMC_RAM_END 0x40000 | 34 | #define SMC_RAM_END 0x40000 |
35 | 35 | ||
36 | static int kv_enable_nb_dpm(struct radeon_device *rdev, | ||
37 | bool enable); | ||
36 | static void kv_init_graphics_levels(struct radeon_device *rdev); | 38 | static void kv_init_graphics_levels(struct radeon_device *rdev); |
37 | static int kv_calculate_ds_divider(struct radeon_device *rdev); | 39 | static int kv_calculate_ds_divider(struct radeon_device *rdev); |
38 | static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); | 40 | static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); |
@@ -1295,6 +1297,9 @@ void kv_dpm_disable(struct radeon_device *rdev) | |||
1295 | { | 1297 | { |
1296 | kv_smc_bapm_enable(rdev, false); | 1298 | kv_smc_bapm_enable(rdev, false); |
1297 | 1299 | ||
1300 | if (rdev->family == CHIP_MULLINS) | ||
1301 | kv_enable_nb_dpm(rdev, false); | ||
1302 | |||
1298 | /* powerup blocks */ | 1303 | /* powerup blocks */ |
1299 | kv_dpm_powergate_acp(rdev, false); | 1304 | kv_dpm_powergate_acp(rdev, false); |
1300 | kv_dpm_powergate_samu(rdev, false); | 1305 | kv_dpm_powergate_samu(rdev, false); |
@@ -1769,15 +1774,24 @@ static int kv_update_dfs_bypass_settings(struct radeon_device *rdev, | |||
1769 | return ret; | 1774 | return ret; |
1770 | } | 1775 | } |
1771 | 1776 | ||
1772 | static int kv_enable_nb_dpm(struct radeon_device *rdev) | 1777 | static int kv_enable_nb_dpm(struct radeon_device *rdev, |
1778 | bool enable) | ||
1773 | { | 1779 | { |
1774 | struct kv_power_info *pi = kv_get_pi(rdev); | 1780 | struct kv_power_info *pi = kv_get_pi(rdev); |
1775 | int ret = 0; | 1781 | int ret = 0; |
1776 | 1782 | ||
1777 | if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { | 1783 | if (enable) { |
1778 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); | 1784 | if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { |
1779 | if (ret == 0) | 1785 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); |
1780 | pi->nb_dpm_enabled = true; | 1786 | if (ret == 0) |
1787 | pi->nb_dpm_enabled = true; | ||
1788 | } | ||
1789 | } else { | ||
1790 | if (pi->enable_nb_dpm && pi->nb_dpm_enabled) { | ||
1791 | ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Disable); | ||
1792 | if (ret == 0) | ||
1793 | pi->nb_dpm_enabled = false; | ||
1794 | } | ||
1781 | } | 1795 | } |
1782 | 1796 | ||
1783 | return ret; | 1797 | return ret; |
@@ -1864,7 +1878,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
1864 | } | 1878 | } |
1865 | kv_update_sclk_t(rdev); | 1879 | kv_update_sclk_t(rdev); |
1866 | if (rdev->family == CHIP_MULLINS) | 1880 | if (rdev->family == CHIP_MULLINS) |
1867 | kv_enable_nb_dpm(rdev); | 1881 | kv_enable_nb_dpm(rdev, true); |
1868 | } | 1882 | } |
1869 | } else { | 1883 | } else { |
1870 | if (pi->enable_dpm) { | 1884 | if (pi->enable_dpm) { |
@@ -1889,7 +1903,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev) | |||
1889 | } | 1903 | } |
1890 | kv_update_acp_boot_level(rdev); | 1904 | kv_update_acp_boot_level(rdev); |
1891 | kv_update_sclk_t(rdev); | 1905 | kv_update_sclk_t(rdev); |
1892 | kv_enable_nb_dpm(rdev); | 1906 | kv_enable_nb_dpm(rdev, true); |
1893 | } | 1907 | } |
1894 | } | 1908 | } |
1895 | 1909 | ||
diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c index 8a3e6221cece..f26f0a9fb522 100644 --- a/drivers/gpu/drm/radeon/ni_dma.c +++ b/drivers/gpu/drm/radeon/ni_dma.c | |||
@@ -191,12 +191,6 @@ int cayman_dma_resume(struct radeon_device *rdev) | |||
191 | u32 reg_offset, wb_offset; | 191 | u32 reg_offset, wb_offset; |
192 | int i, r; | 192 | int i, r; |
193 | 193 | ||
194 | /* Reset dma */ | ||
195 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1); | ||
196 | RREG32(SRBM_SOFT_RESET); | ||
197 | udelay(50); | ||
198 | WREG32(SRBM_SOFT_RESET, 0); | ||
199 | |||
200 | for (i = 0; i < 2; i++) { | 194 | for (i = 0; i < 2; i++) { |
201 | if (i == 0) { | 195 | if (i == 0) { |
202 | ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; | 196 | ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 4c5ec44ff328..b0098e792e62 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -821,6 +821,20 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc) | |||
821 | return RREG32(RADEON_CRTC2_CRNT_FRAME); | 821 | return RREG32(RADEON_CRTC2_CRNT_FRAME); |
822 | } | 822 | } |
823 | 823 | ||
824 | /** | ||
825 | * r100_ring_hdp_flush - flush Host Data Path via the ring buffer | ||
826 | * rdev: radeon device structure | ||
827 | * ring: ring buffer struct for emitting packets | ||
828 | */ | ||
829 | static void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring) | ||
830 | { | ||
831 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
832 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl | | ||
833 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
834 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
835 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl); | ||
836 | } | ||
837 | |||
824 | /* Who ever call radeon_fence_emit should call ring_lock and ask | 838 | /* Who ever call radeon_fence_emit should call ring_lock and ask |
825 | * for enough space (today caller are ib schedule and buffer move) */ | 839 | * for enough space (today caller are ib schedule and buffer move) */ |
826 | void r100_fence_ring_emit(struct radeon_device *rdev, | 840 | void r100_fence_ring_emit(struct radeon_device *rdev, |
@@ -1056,20 +1070,6 @@ void r100_gfx_set_wptr(struct radeon_device *rdev, | |||
1056 | (void)RREG32(RADEON_CP_RB_WPTR); | 1070 | (void)RREG32(RADEON_CP_RB_WPTR); |
1057 | } | 1071 | } |
1058 | 1072 | ||
1059 | /** | ||
1060 | * r100_ring_hdp_flush - flush Host Data Path via the ring buffer | ||
1061 | * rdev: radeon device structure | ||
1062 | * ring: ring buffer struct for emitting packets | ||
1063 | */ | ||
1064 | void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring) | ||
1065 | { | ||
1066 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
1067 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl | | ||
1068 | RADEON_HDP_READ_BUFFER_INVALIDATE); | ||
1069 | radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0)); | ||
1070 | radeon_ring_write(ring, rdev->config.r100.hdp_cntl); | ||
1071 | } | ||
1072 | |||
1073 | static void r100_cp_load_microcode(struct radeon_device *rdev) | 1073 | static void r100_cp_load_microcode(struct radeon_device *rdev) |
1074 | { | 1074 | { |
1075 | const __be32 *fw_data; | 1075 | const __be32 *fw_data; |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index e616eb5f6e7a..ea5c9af722ef 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2769,8 +2769,8 @@ bool r600_semaphore_ring_emit(struct radeon_device *rdev, | |||
2769 | radeon_ring_write(ring, lower_32_bits(addr)); | 2769 | radeon_ring_write(ring, lower_32_bits(addr)); |
2770 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); | 2770 | radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); |
2771 | 2771 | ||
2772 | /* PFP_SYNC_ME packet only exists on 7xx+ */ | 2772 | /* PFP_SYNC_ME packet only exists on 7xx+, only enable it on eg+ */ |
2773 | if (emit_wait && (rdev->family >= CHIP_RV770)) { | 2773 | if (emit_wait && (rdev->family >= CHIP_CEDAR)) { |
2774 | /* Prevent the PFP from running ahead of the semaphore wait */ | 2774 | /* Prevent the PFP from running ahead of the semaphore wait */ |
2775 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); | 2775 | radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); |
2776 | radeon_ring_write(ring, 0x0); | 2776 | radeon_ring_write(ring, 0x0); |
@@ -3792,17 +3792,17 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev) | |||
3792 | wptr = RREG32(IH_RB_WPTR); | 3792 | wptr = RREG32(IH_RB_WPTR); |
3793 | 3793 | ||
3794 | if (wptr & RB_OVERFLOW) { | 3794 | if (wptr & RB_OVERFLOW) { |
3795 | wptr &= ~RB_OVERFLOW; | ||
3795 | /* When a ring buffer overflow happen start parsing interrupt | 3796 | /* When a ring buffer overflow happen start parsing interrupt |
3796 | * from the last not overwritten vector (wptr + 16). Hopefully | 3797 | * from the last not overwritten vector (wptr + 16). Hopefully |
3797 | * this should allow us to catchup. | 3798 | * this should allow us to catchup. |
3798 | */ | 3799 | */ |
3799 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 3800 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
3800 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 3801 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
3801 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 3802 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
3802 | tmp = RREG32(IH_RB_CNTL); | 3803 | tmp = RREG32(IH_RB_CNTL); |
3803 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 3804 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
3804 | WREG32(IH_RB_CNTL, tmp); | 3805 | WREG32(IH_RB_CNTL, tmp); |
3805 | wptr &= ~RB_OVERFLOW; | ||
3806 | } | 3806 | } |
3807 | return (wptr & rdev->ih.ptr_mask); | 3807 | return (wptr & rdev->ih.ptr_mask); |
3808 | } | 3808 | } |
@@ -4048,6 +4048,7 @@ restart_ih: | |||
4048 | /* wptr/rptr are in bytes! */ | 4048 | /* wptr/rptr are in bytes! */ |
4049 | rptr += 16; | 4049 | rptr += 16; |
4050 | rptr &= rdev->ih.ptr_mask; | 4050 | rptr &= rdev->ih.ptr_mask; |
4051 | WREG32(IH_RB_RPTR, rptr); | ||
4051 | } | 4052 | } |
4052 | if (queue_hotplug) | 4053 | if (queue_hotplug) |
4053 | schedule_work(&rdev->hotplug_work); | 4054 | schedule_work(&rdev->hotplug_work); |
@@ -4056,7 +4057,6 @@ restart_ih: | |||
4056 | if (queue_thermal && rdev->pm.dpm_enabled) | 4057 | if (queue_thermal && rdev->pm.dpm_enabled) |
4057 | schedule_work(&rdev->pm.dpm.thermal.work); | 4058 | schedule_work(&rdev->pm.dpm.thermal.work); |
4058 | rdev->ih.rptr = rptr; | 4059 | rdev->ih.rptr = rptr; |
4059 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
4060 | atomic_set(&rdev->ih.lock, 0); | 4060 | atomic_set(&rdev->ih.lock, 0); |
4061 | 4061 | ||
4062 | /* make sure wptr hasn't changed while processing */ | 4062 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c index 51fd98553eaf..a908daa006d2 100644 --- a/drivers/gpu/drm/radeon/r600_dma.c +++ b/drivers/gpu/drm/radeon/r600_dma.c | |||
@@ -124,15 +124,6 @@ int r600_dma_resume(struct radeon_device *rdev) | |||
124 | u32 rb_bufsz; | 124 | u32 rb_bufsz; |
125 | int r; | 125 | int r; |
126 | 126 | ||
127 | /* Reset dma */ | ||
128 | if (rdev->family >= CHIP_RV770) | ||
129 | WREG32(SRBM_SOFT_RESET, RV770_SOFT_RESET_DMA); | ||
130 | else | ||
131 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA); | ||
132 | RREG32(SRBM_SOFT_RESET); | ||
133 | udelay(50); | ||
134 | WREG32(SRBM_SOFT_RESET, 0); | ||
135 | |||
136 | WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); | 127 | WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); |
137 | WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); | 128 | WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); |
138 | 129 | ||
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index 0c4a7d8d93e0..31e1052ad3e3 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
@@ -44,13 +44,6 @@ | |||
44 | #define R6XX_MAX_PIPES 8 | 44 | #define R6XX_MAX_PIPES 8 |
45 | #define R6XX_MAX_PIPES_MASK 0xff | 45 | #define R6XX_MAX_PIPES_MASK 0xff |
46 | 46 | ||
47 | /* PTE flags */ | ||
48 | #define PTE_VALID (1 << 0) | ||
49 | #define PTE_SYSTEM (1 << 1) | ||
50 | #define PTE_SNOOPED (1 << 2) | ||
51 | #define PTE_READABLE (1 << 5) | ||
52 | #define PTE_WRITEABLE (1 << 6) | ||
53 | |||
54 | /* tiling bits */ | 47 | /* tiling bits */ |
55 | #define ARRAY_LINEAR_GENERAL 0x00000000 | 48 | #define ARRAY_LINEAR_GENERAL 0x00000000 |
56 | #define ARRAY_LINEAR_ALIGNED 0x00000001 | 49 | #define ARRAY_LINEAR_ALIGNED 0x00000001 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 5f05b4c84338..3247bfd14410 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -106,6 +106,7 @@ extern int radeon_vm_block_size; | |||
106 | extern int radeon_deep_color; | 106 | extern int radeon_deep_color; |
107 | extern int radeon_use_pflipirq; | 107 | extern int radeon_use_pflipirq; |
108 | extern int radeon_bapm; | 108 | extern int radeon_bapm; |
109 | extern int radeon_backlight; | ||
109 | 110 | ||
110 | /* | 111 | /* |
111 | * Copy from radeon_drv.h so we don't have to include both and have conflicting | 112 | * Copy from radeon_drv.h so we don't have to include both and have conflicting |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index eeeeabe09758..2dd5847f9b98 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -185,7 +185,6 @@ static struct radeon_asic_ring r100_gfx_ring = { | |||
185 | .get_rptr = &r100_gfx_get_rptr, | 185 | .get_rptr = &r100_gfx_get_rptr, |
186 | .get_wptr = &r100_gfx_get_wptr, | 186 | .get_wptr = &r100_gfx_get_wptr, |
187 | .set_wptr = &r100_gfx_set_wptr, | 187 | .set_wptr = &r100_gfx_set_wptr, |
188 | .hdp_flush = &r100_ring_hdp_flush, | ||
189 | }; | 188 | }; |
190 | 189 | ||
191 | static struct radeon_asic r100_asic = { | 190 | static struct radeon_asic r100_asic = { |
@@ -332,7 +331,6 @@ static struct radeon_asic_ring r300_gfx_ring = { | |||
332 | .get_rptr = &r100_gfx_get_rptr, | 331 | .get_rptr = &r100_gfx_get_rptr, |
333 | .get_wptr = &r100_gfx_get_wptr, | 332 | .get_wptr = &r100_gfx_get_wptr, |
334 | .set_wptr = &r100_gfx_set_wptr, | 333 | .set_wptr = &r100_gfx_set_wptr, |
335 | .hdp_flush = &r100_ring_hdp_flush, | ||
336 | }; | 334 | }; |
337 | 335 | ||
338 | static struct radeon_asic r300_asic = { | 336 | static struct radeon_asic r300_asic = { |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index 275a5dc01780..7756bc1e1cd3 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -148,8 +148,7 @@ u32 r100_gfx_get_wptr(struct radeon_device *rdev, | |||
148 | struct radeon_ring *ring); | 148 | struct radeon_ring *ring); |
149 | void r100_gfx_set_wptr(struct radeon_device *rdev, | 149 | void r100_gfx_set_wptr(struct radeon_device *rdev, |
150 | struct radeon_ring *ring); | 150 | struct radeon_ring *ring); |
151 | void r100_ring_hdp_flush(struct radeon_device *rdev, | 151 | |
152 | struct radeon_ring *ring); | ||
153 | /* | 152 | /* |
154 | * r200,rv250,rs300,rv280 | 153 | * r200,rv250,rs300,rv280 |
155 | */ | 154 | */ |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 92b2d8dd4735..e74c7e387dde 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -447,6 +447,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, | |||
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | /* Fujitsu D3003-S2 board lists DVI-I as DVI-I and VGA */ | ||
451 | if ((dev->pdev->device == 0x9805) && | ||
452 | (dev->pdev->subsystem_vendor == 0x1734) && | ||
453 | (dev->pdev->subsystem_device == 0x11bd)) { | ||
454 | if (*connector_type == DRM_MODE_CONNECTOR_VGA) | ||
455 | return false; | ||
456 | } | ||
450 | 457 | ||
451 | return true; | 458 | return true; |
452 | } | 459 | } |
@@ -2281,19 +2288,31 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r | |||
2281 | (controller->ucFanParameters & | 2288 | (controller->ucFanParameters & |
2282 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | 2289 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2283 | rdev->pm.int_thermal_type = THERMAL_TYPE_KV; | 2290 | rdev->pm.int_thermal_type = THERMAL_TYPE_KV; |
2284 | } else if ((controller->ucType == | 2291 | } else if (controller->ucType == |
2285 | ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) || | 2292 | ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) { |
2286 | (controller->ucType == | 2293 | DRM_INFO("External GPIO thermal controller %s fan control\n", |
2287 | ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) || | 2294 | (controller->ucFanParameters & |
2288 | (controller->ucType == | 2295 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2289 | ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL)) { | 2296 | rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL_GPIO; |
2290 | DRM_INFO("Special thermal controller config\n"); | 2297 | } else if (controller->ucType == |
2298 | ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) { | ||
2299 | DRM_INFO("ADT7473 with internal thermal controller %s fan control\n", | ||
2300 | (controller->ucFanParameters & | ||
2301 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | ||
2302 | rdev->pm.int_thermal_type = THERMAL_TYPE_ADT7473_WITH_INTERNAL; | ||
2303 | } else if (controller->ucType == | ||
2304 | ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL) { | ||
2305 | DRM_INFO("EMC2103 with internal thermal controller %s fan control\n", | ||
2306 | (controller->ucFanParameters & | ||
2307 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | ||
2308 | rdev->pm.int_thermal_type = THERMAL_TYPE_EMC2103_WITH_INTERNAL; | ||
2291 | } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { | 2309 | } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { |
2292 | DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", | 2310 | DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", |
2293 | pp_lib_thermal_controller_names[controller->ucType], | 2311 | pp_lib_thermal_controller_names[controller->ucType], |
2294 | controller->ucI2cAddress >> 1, | 2312 | controller->ucI2cAddress >> 1, |
2295 | (controller->ucFanParameters & | 2313 | (controller->ucFanParameters & |
2296 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); | 2314 | ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); |
2315 | rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL; | ||
2297 | i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); | 2316 | i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); |
2298 | rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); | 2317 | rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
2299 | if (rdev->pm.i2c_bus) { | 2318 | if (rdev->pm.i2c_bus) { |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index a9fb0d016d38..8bc7d0bbd3c8 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -33,7 +33,6 @@ static struct radeon_atpx_priv { | |||
33 | bool atpx_detected; | 33 | bool atpx_detected; |
34 | /* handle for device - and atpx */ | 34 | /* handle for device - and atpx */ |
35 | acpi_handle dhandle; | 35 | acpi_handle dhandle; |
36 | acpi_handle other_handle; | ||
37 | struct radeon_atpx atpx; | 36 | struct radeon_atpx atpx; |
38 | } radeon_atpx_priv; | 37 | } radeon_atpx_priv; |
39 | 38 | ||
@@ -453,10 +452,9 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev) | |||
453 | return false; | 452 | return false; |
454 | 453 | ||
455 | status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); | 454 | status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); |
456 | if (ACPI_FAILURE(status)) { | 455 | if (ACPI_FAILURE(status)) |
457 | radeon_atpx_priv.other_handle = dhandle; | ||
458 | return false; | 456 | return false; |
459 | } | 457 | |
460 | radeon_atpx_priv.dhandle = dhandle; | 458 | radeon_atpx_priv.dhandle = dhandle; |
461 | radeon_atpx_priv.atpx.handle = atpx_handle; | 459 | radeon_atpx_priv.atpx.handle = atpx_handle; |
462 | return true; | 460 | return true; |
@@ -540,16 +538,6 @@ static bool radeon_atpx_detect(void) | |||
540 | printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", | 538 | printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", |
541 | acpi_method_name); | 539 | acpi_method_name); |
542 | radeon_atpx_priv.atpx_detected = true; | 540 | radeon_atpx_priv.atpx_detected = true; |
543 | /* | ||
544 | * On some systems hotplug events are generated for the device | ||
545 | * being switched off when ATPX is executed. They cause ACPI | ||
546 | * hotplug to trigger and attempt to remove the device from | ||
547 | * the system, which causes it to break down. Prevent that from | ||
548 | * happening by setting the no_hotplug flag for the involved | ||
549 | * ACPI device objects. | ||
550 | */ | ||
551 | acpi_bus_no_hotplug(radeon_atpx_priv.dhandle); | ||
552 | acpi_bus_no_hotplug(radeon_atpx_priv.other_handle); | ||
553 | return true; | 541 | return true; |
554 | } | 542 | } |
555 | return false; | 543 | return false; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 6a219bcee66d..12c8329644c4 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -123,6 +123,10 @@ static struct radeon_px_quirk radeon_px_quirk_list[] = { | |||
123 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 | 123 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 |
124 | */ | 124 | */ |
125 | { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX }, | 125 | { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX }, |
126 | /* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU | ||
127 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 | ||
128 | */ | ||
129 | { PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, | ||
126 | /* macbook pro 8.2 */ | 130 | /* macbook pro 8.2 */ |
127 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, | 131 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, |
128 | { 0, 0, 0, 0, 0 }, | 132 | { 0, 0, 0, 0, 0 }, |
@@ -1393,7 +1397,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1393 | 1397 | ||
1394 | r = radeon_init(rdev); | 1398 | r = radeon_init(rdev); |
1395 | if (r) | 1399 | if (r) |
1396 | return r; | 1400 | goto failed; |
1397 | 1401 | ||
1398 | r = radeon_ib_ring_tests(rdev); | 1402 | r = radeon_ib_ring_tests(rdev); |
1399 | if (r) | 1403 | if (r) |
@@ -1413,7 +1417,7 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1413 | radeon_agp_disable(rdev); | 1417 | radeon_agp_disable(rdev); |
1414 | r = radeon_init(rdev); | 1418 | r = radeon_init(rdev); |
1415 | if (r) | 1419 | if (r) |
1416 | return r; | 1420 | goto failed; |
1417 | } | 1421 | } |
1418 | 1422 | ||
1419 | if ((radeon_testing & 1)) { | 1423 | if ((radeon_testing & 1)) { |
@@ -1435,6 +1439,11 @@ int radeon_device_init(struct radeon_device *rdev, | |||
1435 | DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); | 1439 | DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); |
1436 | } | 1440 | } |
1437 | return 0; | 1441 | return 0; |
1442 | |||
1443 | failed: | ||
1444 | if (runtime) | ||
1445 | vga_switcheroo_fini_domain_pm_ops(rdev->dev); | ||
1446 | return r; | ||
1438 | } | 1447 | } |
1439 | 1448 | ||
1440 | static void radeon_debugfs_remove_files(struct radeon_device *rdev); | 1449 | static void radeon_debugfs_remove_files(struct radeon_device *rdev); |
@@ -1455,6 +1464,8 @@ void radeon_device_fini(struct radeon_device *rdev) | |||
1455 | radeon_bo_evict_vram(rdev); | 1464 | radeon_bo_evict_vram(rdev); |
1456 | radeon_fini(rdev); | 1465 | radeon_fini(rdev); |
1457 | vga_switcheroo_unregister_client(rdev->pdev); | 1466 | vga_switcheroo_unregister_client(rdev->pdev); |
1467 | if (rdev->flags & RADEON_IS_PX) | ||
1468 | vga_switcheroo_fini_domain_pm_ops(rdev->dev); | ||
1458 | vga_client_register(rdev->pdev, NULL, NULL, NULL); | 1469 | vga_client_register(rdev->pdev, NULL, NULL, NULL); |
1459 | if (rdev->rio_mem) | 1470 | if (rdev->rio_mem) |
1460 | pci_iounmap(rdev->pdev, rdev->rio_mem); | 1471 | pci_iounmap(rdev->pdev, rdev->rio_mem); |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 8df888908833..f9d17b29b343 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -83,7 +83,7 @@ | |||
83 | * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG | 83 | * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG |
84 | * 2.39.0 - Add INFO query for number of active CUs | 84 | * 2.39.0 - Add INFO query for number of active CUs |
85 | * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting | 85 | * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting |
86 | * CS to GPU | 86 | * CS to GPU on >= r600 |
87 | */ | 87 | */ |
88 | #define KMS_DRIVER_MAJOR 2 | 88 | #define KMS_DRIVER_MAJOR 2 |
89 | #define KMS_DRIVER_MINOR 40 | 89 | #define KMS_DRIVER_MINOR 40 |
@@ -181,6 +181,7 @@ int radeon_vm_block_size = -1; | |||
181 | int radeon_deep_color = 0; | 181 | int radeon_deep_color = 0; |
182 | int radeon_use_pflipirq = 2; | 182 | int radeon_use_pflipirq = 2; |
183 | int radeon_bapm = -1; | 183 | int radeon_bapm = -1; |
184 | int radeon_backlight = -1; | ||
184 | 185 | ||
185 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); | 186 | MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); |
186 | module_param_named(no_wb, radeon_no_wb, int, 0444); | 187 | module_param_named(no_wb, radeon_no_wb, int, 0444); |
@@ -263,6 +264,9 @@ module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444); | |||
263 | MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)"); | 264 | MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)"); |
264 | module_param_named(bapm, radeon_bapm, int, 0444); | 265 | module_param_named(bapm, radeon_bapm, int, 0444); |
265 | 266 | ||
267 | MODULE_PARM_DESC(backlight, "backlight support (1 = enable, 0 = disable, -1 = auto)"); | ||
268 | module_param_named(backlight, radeon_backlight, int, 0444); | ||
269 | |||
266 | static struct pci_device_id pciidlist[] = { | 270 | static struct pci_device_id pciidlist[] = { |
267 | radeon_PCI_IDS | 271 | radeon_PCI_IDS |
268 | }; | 272 | }; |
@@ -440,6 +444,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev) | |||
440 | ret = radeon_suspend_kms(drm_dev, false, false); | 444 | ret = radeon_suspend_kms(drm_dev, false, false); |
441 | pci_save_state(pdev); | 445 | pci_save_state(pdev); |
442 | pci_disable_device(pdev); | 446 | pci_disable_device(pdev); |
447 | pci_ignore_hotplug(pdev); | ||
443 | pci_set_power_state(pdev, PCI_D3cold); | 448 | pci_set_power_state(pdev, PCI_D3cold); |
444 | drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; | 449 | drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; |
445 | 450 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 3c2094c25b53..15edf23b465c 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -158,10 +158,43 @@ radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, uint8 | |||
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | 160 | ||
161 | static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder, | ||
162 | struct drm_connector *connector) | ||
163 | { | ||
164 | struct drm_device *dev = radeon_encoder->base.dev; | ||
165 | struct radeon_device *rdev = dev->dev_private; | ||
166 | bool use_bl = false; | ||
167 | |||
168 | if (!(radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))) | ||
169 | return; | ||
170 | |||
171 | if (radeon_backlight == 0) { | ||
172 | return; | ||
173 | } else if (radeon_backlight == 1) { | ||
174 | use_bl = true; | ||
175 | } else if (radeon_backlight == -1) { | ||
176 | /* Quirks */ | ||
177 | /* Amilo Xi 2550 only works with acpi bl */ | ||
178 | if ((rdev->pdev->device == 0x9583) && | ||
179 | (rdev->pdev->subsystem_vendor == 0x1734) && | ||
180 | (rdev->pdev->subsystem_device == 0x1107)) | ||
181 | use_bl = false; | ||
182 | else | ||
183 | use_bl = true; | ||
184 | } | ||
185 | |||
186 | if (use_bl) { | ||
187 | if (rdev->is_atom_bios) | ||
188 | radeon_atom_backlight_init(radeon_encoder, connector); | ||
189 | else | ||
190 | radeon_legacy_backlight_init(radeon_encoder, connector); | ||
191 | rdev->mode_info.bl_encoder = radeon_encoder; | ||
192 | } | ||
193 | } | ||
194 | |||
161 | void | 195 | void |
162 | radeon_link_encoder_connector(struct drm_device *dev) | 196 | radeon_link_encoder_connector(struct drm_device *dev) |
163 | { | 197 | { |
164 | struct radeon_device *rdev = dev->dev_private; | ||
165 | struct drm_connector *connector; | 198 | struct drm_connector *connector; |
166 | struct radeon_connector *radeon_connector; | 199 | struct radeon_connector *radeon_connector; |
167 | struct drm_encoder *encoder; | 200 | struct drm_encoder *encoder; |
@@ -174,13 +207,8 @@ radeon_link_encoder_connector(struct drm_device *dev) | |||
174 | radeon_encoder = to_radeon_encoder(encoder); | 207 | radeon_encoder = to_radeon_encoder(encoder); |
175 | if (radeon_encoder->devices & radeon_connector->devices) { | 208 | if (radeon_encoder->devices & radeon_connector->devices) { |
176 | drm_mode_connector_attach_encoder(connector, encoder); | 209 | drm_mode_connector_attach_encoder(connector, encoder); |
177 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 210 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) |
178 | if (rdev->is_atom_bios) | 211 | radeon_encoder_add_backlight(radeon_encoder, connector); |
179 | radeon_atom_backlight_init(radeon_encoder, connector); | ||
180 | else | ||
181 | radeon_legacy_backlight_init(radeon_encoder, connector); | ||
182 | rdev->mode_info.bl_encoder = radeon_encoder; | ||
183 | } | ||
184 | } | 212 | } |
185 | } | 213 | } |
186 | } | 214 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c index 56d9fd66d8ae..abd6753a570a 100644 --- a/drivers/gpu/drm/radeon/radeon_semaphore.c +++ b/drivers/gpu/drm/radeon/radeon_semaphore.c | |||
@@ -34,7 +34,7 @@ | |||
34 | int radeon_semaphore_create(struct radeon_device *rdev, | 34 | int radeon_semaphore_create(struct radeon_device *rdev, |
35 | struct radeon_semaphore **semaphore) | 35 | struct radeon_semaphore **semaphore) |
36 | { | 36 | { |
37 | uint32_t *cpu_addr; | 37 | uint64_t *cpu_addr; |
38 | int i, r; | 38 | int i, r; |
39 | 39 | ||
40 | *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); | 40 | *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); |
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c index 6c1fc339d228..c5799f16aa4b 100644 --- a/drivers/gpu/drm/radeon/rs400.c +++ b/drivers/gpu/drm/radeon/rs400.c | |||
@@ -221,9 +221,9 @@ void rs400_gart_set_page(struct radeon_device *rdev, unsigned i, | |||
221 | entry = (lower_32_bits(addr) & PAGE_MASK) | | 221 | entry = (lower_32_bits(addr) & PAGE_MASK) | |
222 | ((upper_32_bits(addr) & 0xff) << 4); | 222 | ((upper_32_bits(addr) & 0xff) << 4); |
223 | if (flags & RADEON_GART_PAGE_READ) | 223 | if (flags & RADEON_GART_PAGE_READ) |
224 | addr |= RS400_PTE_READABLE; | 224 | entry |= RS400_PTE_READABLE; |
225 | if (flags & RADEON_GART_PAGE_WRITE) | 225 | if (flags & RADEON_GART_PAGE_WRITE) |
226 | addr |= RS400_PTE_WRITEABLE; | 226 | entry |= RS400_PTE_WRITEABLE; |
227 | if (!(flags & RADEON_GART_PAGE_SNOOP)) | 227 | if (!(flags & RADEON_GART_PAGE_SNOOP)) |
228 | entry |= RS400_PTE_UNSNOOPED; | 228 | entry |= RS400_PTE_UNSNOOPED; |
229 | entry = cpu_to_le32(entry); | 229 | entry = cpu_to_le32(entry); |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 6bce40847753..3a0b973e8a96 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -6316,17 +6316,17 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev) | |||
6316 | wptr = RREG32(IH_RB_WPTR); | 6316 | wptr = RREG32(IH_RB_WPTR); |
6317 | 6317 | ||
6318 | if (wptr & RB_OVERFLOW) { | 6318 | if (wptr & RB_OVERFLOW) { |
6319 | wptr &= ~RB_OVERFLOW; | ||
6319 | /* When a ring buffer overflow happen start parsing interrupt | 6320 | /* When a ring buffer overflow happen start parsing interrupt |
6320 | * from the last not overwritten vector (wptr + 16). Hopefully | 6321 | * from the last not overwritten vector (wptr + 16). Hopefully |
6321 | * this should allow us to catchup. | 6322 | * this should allow us to catchup. |
6322 | */ | 6323 | */ |
6323 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", | 6324 | dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n", |
6324 | wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); | 6325 | wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask); |
6325 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; | 6326 | rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; |
6326 | tmp = RREG32(IH_RB_CNTL); | 6327 | tmp = RREG32(IH_RB_CNTL); |
6327 | tmp |= IH_WPTR_OVERFLOW_CLEAR; | 6328 | tmp |= IH_WPTR_OVERFLOW_CLEAR; |
6328 | WREG32(IH_RB_CNTL, tmp); | 6329 | WREG32(IH_RB_CNTL, tmp); |
6329 | wptr &= ~RB_OVERFLOW; | ||
6330 | } | 6330 | } |
6331 | return (wptr & rdev->ih.ptr_mask); | 6331 | return (wptr & rdev->ih.ptr_mask); |
6332 | } | 6332 | } |
@@ -6664,13 +6664,13 @@ restart_ih: | |||
6664 | /* wptr/rptr are in bytes! */ | 6664 | /* wptr/rptr are in bytes! */ |
6665 | rptr += 16; | 6665 | rptr += 16; |
6666 | rptr &= rdev->ih.ptr_mask; | 6666 | rptr &= rdev->ih.ptr_mask; |
6667 | WREG32(IH_RB_RPTR, rptr); | ||
6667 | } | 6668 | } |
6668 | if (queue_hotplug) | 6669 | if (queue_hotplug) |
6669 | schedule_work(&rdev->hotplug_work); | 6670 | schedule_work(&rdev->hotplug_work); |
6670 | if (queue_thermal && rdev->pm.dpm_enabled) | 6671 | if (queue_thermal && rdev->pm.dpm_enabled) |
6671 | schedule_work(&rdev->pm.dpm.thermal.work); | 6672 | schedule_work(&rdev->pm.dpm.thermal.work); |
6672 | rdev->ih.rptr = rptr; | 6673 | rdev->ih.rptr = rptr; |
6673 | WREG32(IH_RB_RPTR, rdev->ih.rptr); | ||
6674 | atomic_set(&rdev->ih.lock, 0); | 6674 | atomic_set(&rdev->ih.lock, 0); |
6675 | 6675 | ||
6676 | /* make sure wptr hasn't changed while processing */ | 6676 | /* make sure wptr hasn't changed while processing */ |
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index ef93156a69c6..b22968c08d1f 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c | |||
@@ -298,7 +298,6 @@ static int hdmi_avi_infoframe_config(struct sti_hdmi *hdmi) | |||
298 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI)); | 298 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD2(HDMI_IFRAME_SLOT_AVI)); |
299 | 299 | ||
300 | val = frame[0xC]; | 300 | val = frame[0xC]; |
301 | val |= frame[0xD] << 8; | ||
302 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI)); | 301 | hdmi_write(hdmi, val, HDMI_SW_DI_N_PKT_WORD3(HDMI_IFRAME_SLOT_AVI)); |
303 | 302 | ||
304 | /* Enable transmission slot for AVI infoframe | 303 | /* Enable transmission slot for AVI infoframe |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 7bfdaa163a33..36b871686d3c 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
@@ -450,11 +450,11 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, | |||
450 | res, | 450 | res, |
451 | id_loc - sw_context->buf_start); | 451 | id_loc - sw_context->buf_start); |
452 | if (unlikely(ret != 0)) | 452 | if (unlikely(ret != 0)) |
453 | goto out_err; | 453 | return ret; |
454 | 454 | ||
455 | ret = vmw_resource_val_add(sw_context, res, &node); | 455 | ret = vmw_resource_val_add(sw_context, res, &node); |
456 | if (unlikely(ret != 0)) | 456 | if (unlikely(ret != 0)) |
457 | goto out_err; | 457 | return ret; |
458 | 458 | ||
459 | if (res_type == vmw_res_context && dev_priv->has_mob && | 459 | if (res_type == vmw_res_context && dev_priv->has_mob && |
460 | node->first_usage) { | 460 | node->first_usage) { |
@@ -468,13 +468,13 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, | |||
468 | 468 | ||
469 | ret = vmw_resource_context_res_add(dev_priv, sw_context, res); | 469 | ret = vmw_resource_context_res_add(dev_priv, sw_context, res); |
470 | if (unlikely(ret != 0)) | 470 | if (unlikely(ret != 0)) |
471 | goto out_err; | 471 | return ret; |
472 | node->staged_bindings = | 472 | node->staged_bindings = |
473 | kzalloc(sizeof(*node->staged_bindings), GFP_KERNEL); | 473 | kzalloc(sizeof(*node->staged_bindings), GFP_KERNEL); |
474 | if (node->staged_bindings == NULL) { | 474 | if (node->staged_bindings == NULL) { |
475 | DRM_ERROR("Failed to allocate context binding " | 475 | DRM_ERROR("Failed to allocate context binding " |
476 | "information.\n"); | 476 | "information.\n"); |
477 | goto out_err; | 477 | return -ENOMEM; |
478 | } | 478 | } |
479 | INIT_LIST_HEAD(&node->staged_bindings->list); | 479 | INIT_LIST_HEAD(&node->staged_bindings->list); |
480 | } | 480 | } |
@@ -482,8 +482,7 @@ static int vmw_cmd_res_reloc_add(struct vmw_private *dev_priv, | |||
482 | if (p_val) | 482 | if (p_val) |
483 | *p_val = node; | 483 | *p_val = node; |
484 | 484 | ||
485 | out_err: | 485 | return 0; |
486 | return ret; | ||
487 | } | 486 | } |
488 | 487 | ||
489 | 488 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c index 6ccd993e26bf..6eae14d2a3f7 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | |||
@@ -180,8 +180,9 @@ void vmw_fifo_release(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo) | |||
180 | 180 | ||
181 | mutex_lock(&dev_priv->hw_mutex); | 181 | mutex_lock(&dev_priv->hw_mutex); |
182 | 182 | ||
183 | vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC); | ||
183 | while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0) | 184 | while (vmw_read(dev_priv, SVGA_REG_BUSY) != 0) |
184 | vmw_write(dev_priv, SVGA_REG_SYNC, SVGA_SYNC_GENERIC); | 185 | ; |
185 | 186 | ||
186 | dev_priv->last_read_seqno = ioread32(fifo_mem + SVGA_FIFO_FENCE); | 187 | dev_priv->last_read_seqno = ioread32(fifo_mem + SVGA_FIFO_FENCE); |
187 | 188 | ||
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index 6866448083b2..37ac7b5dbd06 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c | |||
@@ -660,6 +660,12 @@ int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain * | |||
660 | } | 660 | } |
661 | EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); | 661 | EXPORT_SYMBOL(vga_switcheroo_init_domain_pm_ops); |
662 | 662 | ||
663 | void vga_switcheroo_fini_domain_pm_ops(struct device *dev) | ||
664 | { | ||
665 | dev->pm_domain = NULL; | ||
666 | } | ||
667 | EXPORT_SYMBOL(vga_switcheroo_fini_domain_pm_ops); | ||
668 | |||
663 | static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) | 669 | static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev) |
664 | { | 670 | { |
665 | struct pci_dev *pdev = to_pci_dev(dev); | 671 | struct pci_dev *pdev = to_pci_dev(dev); |
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index d2077f040f3e..77711623b973 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/poll.h> | 41 | #include <linux/poll.h> |
42 | #include <linux/miscdevice.h> | 42 | #include <linux/miscdevice.h> |
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | #include <linux/screen_info.h> | ||
44 | 45 | ||
45 | #include <linux/uaccess.h> | 46 | #include <linux/uaccess.h> |
46 | 47 | ||
@@ -112,10 +113,8 @@ both: | |||
112 | return 1; | 113 | return 1; |
113 | } | 114 | } |
114 | 115 | ||
115 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
116 | /* this is only used a cookie - it should not be dereferenced */ | 116 | /* this is only used a cookie - it should not be dereferenced */ |
117 | static struct pci_dev *vga_default; | 117 | static struct pci_dev *vga_default; |
118 | #endif | ||
119 | 118 | ||
120 | static void vga_arb_device_card_gone(struct pci_dev *pdev); | 119 | static void vga_arb_device_card_gone(struct pci_dev *pdev); |
121 | 120 | ||
@@ -131,7 +130,6 @@ static struct vga_device *vgadev_find(struct pci_dev *pdev) | |||
131 | } | 130 | } |
132 | 131 | ||
133 | /* Returns the default VGA device (vgacon's babe) */ | 132 | /* Returns the default VGA device (vgacon's babe) */ |
134 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
135 | struct pci_dev *vga_default_device(void) | 133 | struct pci_dev *vga_default_device(void) |
136 | { | 134 | { |
137 | return vga_default; | 135 | return vga_default; |
@@ -147,7 +145,6 @@ void vga_set_default_device(struct pci_dev *pdev) | |||
147 | pci_dev_put(vga_default); | 145 | pci_dev_put(vga_default); |
148 | vga_default = pci_dev_get(pdev); | 146 | vga_default = pci_dev_get(pdev); |
149 | } | 147 | } |
150 | #endif | ||
151 | 148 | ||
152 | static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) | 149 | static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) |
153 | { | 150 | { |
@@ -583,11 +580,12 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) | |||
583 | /* Deal with VGA default device. Use first enabled one | 580 | /* Deal with VGA default device. Use first enabled one |
584 | * by default if arch doesn't have it's own hook | 581 | * by default if arch doesn't have it's own hook |
585 | */ | 582 | */ |
586 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
587 | if (vga_default == NULL && | 583 | if (vga_default == NULL && |
588 | ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) | 584 | ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) { |
585 | pr_info("vgaarb: setting as boot device: PCI:%s\n", | ||
586 | pci_name(pdev)); | ||
589 | vga_set_default_device(pdev); | 587 | vga_set_default_device(pdev); |
590 | #endif | 588 | } |
591 | 589 | ||
592 | vga_arbiter_check_bridge_sharing(vgadev); | 590 | vga_arbiter_check_bridge_sharing(vgadev); |
593 | 591 | ||
@@ -621,10 +619,8 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev) | |||
621 | goto bail; | 619 | goto bail; |
622 | } | 620 | } |
623 | 621 | ||
624 | #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE | ||
625 | if (vga_default == pdev) | 622 | if (vga_default == pdev) |
626 | vga_set_default_device(NULL); | 623 | vga_set_default_device(NULL); |
627 | #endif | ||
628 | 624 | ||
629 | if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) | 625 | if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) |
630 | vga_decode_count--; | 626 | vga_decode_count--; |
@@ -1320,6 +1316,38 @@ static int __init vga_arb_device_init(void) | |||
1320 | pr_info("vgaarb: loaded\n"); | 1316 | pr_info("vgaarb: loaded\n"); |
1321 | 1317 | ||
1322 | list_for_each_entry(vgadev, &vga_list, list) { | 1318 | list_for_each_entry(vgadev, &vga_list, list) { |
1319 | #if defined(CONFIG_X86) || defined(CONFIG_IA64) | ||
1320 | /* Override I/O based detection done by vga_arbiter_add_pci_device() | ||
1321 | * as it may take the wrong device (e.g. on Apple system under EFI). | ||
1322 | * | ||
1323 | * Select the device owning the boot framebuffer if there is one. | ||
1324 | */ | ||
1325 | resource_size_t start, end; | ||
1326 | int i; | ||
1327 | |||
1328 | /* Does firmware framebuffer belong to us? */ | ||
1329 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
1330 | if (!(pci_resource_flags(vgadev->pdev, i) & IORESOURCE_MEM)) | ||
1331 | continue; | ||
1332 | |||
1333 | start = pci_resource_start(vgadev->pdev, i); | ||
1334 | end = pci_resource_end(vgadev->pdev, i); | ||
1335 | |||
1336 | if (!start || !end) | ||
1337 | continue; | ||
1338 | |||
1339 | if (screen_info.lfb_base < start || | ||
1340 | (screen_info.lfb_base + screen_info.lfb_size) >= end) | ||
1341 | continue; | ||
1342 | if (!vga_default_device()) | ||
1343 | pr_info("vgaarb: setting as boot device: PCI:%s\n", | ||
1344 | pci_name(vgadev->pdev)); | ||
1345 | else if (vgadev->pdev != vga_default_device()) | ||
1346 | pr_info("vgaarb: overriding boot device: PCI:%s\n", | ||
1347 | pci_name(vgadev->pdev)); | ||
1348 | vga_set_default_device(vgadev->pdev); | ||
1349 | } | ||
1350 | #endif | ||
1323 | if (vgadev->bridge_has_one_vga) | 1351 | if (vgadev->bridge_has_one_vga) |
1324 | pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); | 1352 | pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); |
1325 | else | 1353 | else |
diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index fc6f5d54e7f7..8890870309e4 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c | |||
@@ -309,6 +309,7 @@ static ssize_t set_convrate(struct device *dev, struct device_attribute *da, | |||
309 | data->conf |= (resol << DS1621_REG_CONFIG_RESOL_SHIFT); | 309 | data->conf |= (resol << DS1621_REG_CONFIG_RESOL_SHIFT); |
310 | i2c_smbus_write_byte_data(client, DS1621_REG_CONF, data->conf); | 310 | i2c_smbus_write_byte_data(client, DS1621_REG_CONF, data->conf); |
311 | data->update_interval = ds1721_convrates[resol]; | 311 | data->update_interval = ds1721_convrates[resol]; |
312 | data->zbits = 7 - resol; | ||
312 | mutex_unlock(&data->update_lock); | 313 | mutex_unlock(&data->update_lock); |
313 | 314 | ||
314 | return count; | 315 | return count; |
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 4a7cbfad1d74..fcdbde4ec692 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -93,13 +93,29 @@ static ssize_t show_power_crit(struct device *dev, | |||
93 | } | 93 | } |
94 | static DEVICE_ATTR(power1_crit, S_IRUGO, show_power_crit, NULL); | 94 | static DEVICE_ATTR(power1_crit, S_IRUGO, show_power_crit, NULL); |
95 | 95 | ||
96 | static umode_t fam15h_power_is_visible(struct kobject *kobj, | ||
97 | struct attribute *attr, | ||
98 | int index) | ||
99 | { | ||
100 | /* power1_input is only reported for Fam15h, Models 00h-0fh */ | ||
101 | if (attr == &dev_attr_power1_input.attr && | ||
102 | (boot_cpu_data.x86 != 0x15 || boot_cpu_data.x86_model > 0xf)) | ||
103 | return 0; | ||
104 | |||
105 | return attr->mode; | ||
106 | } | ||
107 | |||
96 | static struct attribute *fam15h_power_attrs[] = { | 108 | static struct attribute *fam15h_power_attrs[] = { |
97 | &dev_attr_power1_input.attr, | 109 | &dev_attr_power1_input.attr, |
98 | &dev_attr_power1_crit.attr, | 110 | &dev_attr_power1_crit.attr, |
99 | NULL | 111 | NULL |
100 | }; | 112 | }; |
101 | 113 | ||
102 | ATTRIBUTE_GROUPS(fam15h_power); | 114 | static const struct attribute_group fam15h_power_group = { |
115 | .attrs = fam15h_power_attrs, | ||
116 | .is_visible = fam15h_power_is_visible, | ||
117 | }; | ||
118 | __ATTRIBUTE_GROUPS(fam15h_power); | ||
103 | 119 | ||
104 | static bool fam15h_power_is_internal_node0(struct pci_dev *f4) | 120 | static bool fam15h_power_is_internal_node0(struct pci_dev *f4) |
105 | { | 121 | { |
@@ -216,7 +232,9 @@ static int fam15h_power_probe(struct pci_dev *pdev, | |||
216 | 232 | ||
217 | static const struct pci_device_id fam15h_power_id_table[] = { | 233 | static const struct pci_device_id fam15h_power_id_table[] = { |
218 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 234 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
235 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, | ||
219 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, | 236 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, |
237 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, | ||
220 | {} | 238 | {} |
221 | }; | 239 | }; |
222 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); | 240 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); |
diff --git a/drivers/hwmon/tmp103.c b/drivers/hwmon/tmp103.c index e42964f07f67..ad571ec795a3 100644 --- a/drivers/hwmon/tmp103.c +++ b/drivers/hwmon/tmp103.c | |||
@@ -145,7 +145,7 @@ static int tmp103_probe(struct i2c_client *client, | |||
145 | } | 145 | } |
146 | 146 | ||
147 | i2c_set_clientdata(client, regmap); | 147 | i2c_set_clientdata(client, regmap); |
148 | hwmon_dev = hwmon_device_register_with_groups(dev, client->name, | 148 | hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, |
149 | regmap, tmp103_groups); | 149 | regmap, tmp103_groups); |
150 | return PTR_ERR_OR_ZERO(hwmon_dev); | 150 | return PTR_ERR_OR_ZERO(hwmon_dev); |
151 | } | 151 | } |
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index e0228b228256..1722f50f2473 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -2,11 +2,8 @@ | |||
2 | # Makefile for the i2c core. | 2 | # Makefile for the i2c core. |
3 | # | 3 | # |
4 | 4 | ||
5 | i2ccore-y := i2c-core.o | ||
6 | i2ccore-$(CONFIG_ACPI) += i2c-acpi.o | ||
7 | |||
8 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o | 5 | obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o |
9 | obj-$(CONFIG_I2C) += i2ccore.o | 6 | obj-$(CONFIG_I2C) += i2c-core.o |
10 | obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o | 7 | obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o |
11 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o | 8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o |
12 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o | 9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 79a68999a696..917d54588d95 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c | |||
@@ -101,6 +101,7 @@ struct at91_twi_dev { | |||
101 | unsigned twi_cwgr_reg; | 101 | unsigned twi_cwgr_reg; |
102 | struct at91_twi_pdata *pdata; | 102 | struct at91_twi_pdata *pdata; |
103 | bool use_dma; | 103 | bool use_dma; |
104 | bool recv_len_abort; | ||
104 | struct at91_twi_dma dma; | 105 | struct at91_twi_dma dma; |
105 | }; | 106 | }; |
106 | 107 | ||
@@ -267,12 +268,24 @@ static void at91_twi_read_next_byte(struct at91_twi_dev *dev) | |||
267 | *dev->buf = at91_twi_read(dev, AT91_TWI_RHR) & 0xff; | 268 | *dev->buf = at91_twi_read(dev, AT91_TWI_RHR) & 0xff; |
268 | --dev->buf_len; | 269 | --dev->buf_len; |
269 | 270 | ||
271 | /* return if aborting, we only needed to read RHR to clear RXRDY*/ | ||
272 | if (dev->recv_len_abort) | ||
273 | return; | ||
274 | |||
270 | /* handle I2C_SMBUS_BLOCK_DATA */ | 275 | /* handle I2C_SMBUS_BLOCK_DATA */ |
271 | if (unlikely(dev->msg->flags & I2C_M_RECV_LEN)) { | 276 | if (unlikely(dev->msg->flags & I2C_M_RECV_LEN)) { |
272 | dev->msg->flags &= ~I2C_M_RECV_LEN; | 277 | /* ensure length byte is a valid value */ |
273 | dev->buf_len += *dev->buf; | 278 | if (*dev->buf <= I2C_SMBUS_BLOCK_MAX && *dev->buf > 0) { |
274 | dev->msg->len = dev->buf_len + 1; | 279 | dev->msg->flags &= ~I2C_M_RECV_LEN; |
275 | dev_dbg(dev->dev, "received block length %d\n", dev->buf_len); | 280 | dev->buf_len += *dev->buf; |
281 | dev->msg->len = dev->buf_len + 1; | ||
282 | dev_dbg(dev->dev, "received block length %d\n", | ||
283 | dev->buf_len); | ||
284 | } else { | ||
285 | /* abort and send the stop by reading one more byte */ | ||
286 | dev->recv_len_abort = true; | ||
287 | dev->buf_len = 1; | ||
288 | } | ||
276 | } | 289 | } |
277 | 290 | ||
278 | /* send stop if second but last byte has been read */ | 291 | /* send stop if second but last byte has been read */ |
@@ -421,8 +434,8 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) | |||
421 | } | 434 | } |
422 | } | 435 | } |
423 | 436 | ||
424 | ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, | 437 | ret = wait_for_completion_io_timeout(&dev->cmd_complete, |
425 | dev->adapter.timeout); | 438 | dev->adapter.timeout); |
426 | if (ret == 0) { | 439 | if (ret == 0) { |
427 | dev_err(dev->dev, "controller timed out\n"); | 440 | dev_err(dev->dev, "controller timed out\n"); |
428 | at91_init_twi_bus(dev); | 441 | at91_init_twi_bus(dev); |
@@ -444,6 +457,12 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) | |||
444 | ret = -EIO; | 457 | ret = -EIO; |
445 | goto error; | 458 | goto error; |
446 | } | 459 | } |
460 | if (dev->recv_len_abort) { | ||
461 | dev_err(dev->dev, "invalid smbus block length recvd\n"); | ||
462 | ret = -EPROTO; | ||
463 | goto error; | ||
464 | } | ||
465 | |||
447 | dev_dbg(dev->dev, "transfer complete\n"); | 466 | dev_dbg(dev->dev, "transfer complete\n"); |
448 | 467 | ||
449 | return 0; | 468 | return 0; |
@@ -500,6 +519,7 @@ static int at91_twi_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, int num) | |||
500 | dev->buf_len = m_start->len; | 519 | dev->buf_len = m_start->len; |
501 | dev->buf = m_start->buf; | 520 | dev->buf = m_start->buf; |
502 | dev->msg = m_start; | 521 | dev->msg = m_start; |
522 | dev->recv_len_abort = false; | ||
503 | 523 | ||
504 | ret = at91_do_twi_transfer(dev); | 524 | ret = at91_do_twi_transfer(dev); |
505 | 525 | ||
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index 984492553e95..d9ee43c80cde 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c | |||
@@ -497,7 +497,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, | |||
497 | desc->wr_len_cmd = dma_size; | 497 | desc->wr_len_cmd = dma_size; |
498 | desc->control |= ISMT_DESC_BLK; | 498 | desc->control |= ISMT_DESC_BLK; |
499 | priv->dma_buffer[0] = command; | 499 | priv->dma_buffer[0] = command; |
500 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); | 500 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); |
501 | } else { | 501 | } else { |
502 | /* Block Read */ | 502 | /* Block Read */ |
503 | dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); | 503 | dev_dbg(dev, "I2C_SMBUS_BLOCK_DATA: READ\n"); |
@@ -525,7 +525,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, | |||
525 | desc->wr_len_cmd = dma_size; | 525 | desc->wr_len_cmd = dma_size; |
526 | desc->control |= ISMT_DESC_I2C; | 526 | desc->control |= ISMT_DESC_I2C; |
527 | priv->dma_buffer[0] = command; | 527 | priv->dma_buffer[0] = command; |
528 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size); | 528 | memcpy(&priv->dma_buffer[1], &data->block[1], dma_size - 1); |
529 | } else { | 529 | } else { |
530 | /* i2c Block Read */ | 530 | /* i2c Block Read */ |
531 | dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: READ\n"); | 531 | dev_dbg(dev, "I2C_SMBUS_I2C_BLOCK_DATA: READ\n"); |
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 6dc5ded86f62..2f64273d3f2b 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -746,8 +746,7 @@ mv64xxx_of_config(struct mv64xxx_i2c_data *drv_data, | |||
746 | } | 746 | } |
747 | tclk = clk_get_rate(drv_data->clk); | 747 | tclk = clk_get_rate(drv_data->clk); |
748 | 748 | ||
749 | rc = of_property_read_u32(np, "clock-frequency", &bus_freq); | 749 | if (of_property_read_u32(np, "clock-frequency", &bus_freq)) |
750 | if (rc) | ||
751 | bus_freq = 100000; /* 100kHz by default */ | 750 | bus_freq = 100000; /* 100kHz by default */ |
752 | 751 | ||
753 | if (!mv64xxx_find_baud_factors(bus_freq, tclk, | 752 | if (!mv64xxx_find_baud_factors(bus_freq, tclk, |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 7170fc892829..65a21fed08b5 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -429,7 +429,7 @@ static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap, | |||
429 | ret = mxs_i2c_pio_wait_xfer_end(i2c); | 429 | ret = mxs_i2c_pio_wait_xfer_end(i2c); |
430 | if (ret) { | 430 | if (ret) { |
431 | dev_err(i2c->dev, | 431 | dev_err(i2c->dev, |
432 | "PIO: Failed to send SELECT command!\n"); | 432 | "PIO: Failed to send READ command!\n"); |
433 | goto cleanup; | 433 | goto cleanup; |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 3a4d64e1dfb1..092d89bd3224 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c | |||
@@ -674,16 +674,20 @@ static int qup_i2c_probe(struct platform_device *pdev) | |||
674 | qup->adap.dev.of_node = pdev->dev.of_node; | 674 | qup->adap.dev.of_node = pdev->dev.of_node; |
675 | strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); | 675 | strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); |
676 | 676 | ||
677 | ret = i2c_add_adapter(&qup->adap); | ||
678 | if (ret) | ||
679 | goto fail; | ||
680 | |||
681 | pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC); | 677 | pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC); |
682 | pm_runtime_use_autosuspend(qup->dev); | 678 | pm_runtime_use_autosuspend(qup->dev); |
683 | pm_runtime_set_active(qup->dev); | 679 | pm_runtime_set_active(qup->dev); |
684 | pm_runtime_enable(qup->dev); | 680 | pm_runtime_enable(qup->dev); |
681 | |||
682 | ret = i2c_add_adapter(&qup->adap); | ||
683 | if (ret) | ||
684 | goto fail_runtime; | ||
685 | |||
685 | return 0; | 686 | return 0; |
686 | 687 | ||
688 | fail_runtime: | ||
689 | pm_runtime_disable(qup->dev); | ||
690 | pm_runtime_set_suspended(qup->dev); | ||
687 | fail: | 691 | fail: |
688 | qup_i2c_disable_clocks(qup); | 692 | qup_i2c_disable_clocks(qup); |
689 | return ret; | 693 | return ret; |
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index f3c7139dfa25..e506fcd3ca04 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | #include <linux/pm_runtime.h> | 35 | #include <linux/pm_runtime.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/spinlock.h> | ||
37 | 38 | ||
38 | /* register offsets */ | 39 | /* register offsets */ |
39 | #define ICSCR 0x00 /* slave ctrl */ | 40 | #define ICSCR 0x00 /* slave ctrl */ |
@@ -75,8 +76,8 @@ | |||
75 | #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR) | 76 | #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR) |
76 | #define RCAR_IRQ_STOP (MST) | 77 | #define RCAR_IRQ_STOP (MST) |
77 | 78 | ||
78 | #define RCAR_IRQ_ACK_SEND (~(MAT | MDE)) | 79 | #define RCAR_IRQ_ACK_SEND (~(MAT | MDE) & 0xFF) |
79 | #define RCAR_IRQ_ACK_RECV (~(MAT | MDR)) | 80 | #define RCAR_IRQ_ACK_RECV (~(MAT | MDR) & 0xFF) |
80 | 81 | ||
81 | #define ID_LAST_MSG (1 << 0) | 82 | #define ID_LAST_MSG (1 << 0) |
82 | #define ID_IOERROR (1 << 1) | 83 | #define ID_IOERROR (1 << 1) |
@@ -95,6 +96,7 @@ struct rcar_i2c_priv { | |||
95 | struct i2c_msg *msg; | 96 | struct i2c_msg *msg; |
96 | struct clk *clk; | 97 | struct clk *clk; |
97 | 98 | ||
99 | spinlock_t lock; | ||
98 | wait_queue_head_t wait; | 100 | wait_queue_head_t wait; |
99 | 101 | ||
100 | int pos; | 102 | int pos; |
@@ -365,20 +367,20 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) | |||
365 | struct rcar_i2c_priv *priv = ptr; | 367 | struct rcar_i2c_priv *priv = ptr; |
366 | u32 msr; | 368 | u32 msr; |
367 | 369 | ||
370 | /*-------------- spin lock -----------------*/ | ||
371 | spin_lock(&priv->lock); | ||
372 | |||
368 | msr = rcar_i2c_read(priv, ICMSR); | 373 | msr = rcar_i2c_read(priv, ICMSR); |
369 | 374 | ||
375 | /* Only handle interrupts that are currently enabled */ | ||
376 | msr &= rcar_i2c_read(priv, ICMIER); | ||
377 | |||
370 | /* Arbitration lost */ | 378 | /* Arbitration lost */ |
371 | if (msr & MAL) { | 379 | if (msr & MAL) { |
372 | rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST)); | 380 | rcar_i2c_flags_set(priv, (ID_DONE | ID_ARBLOST)); |
373 | goto out; | 381 | goto out; |
374 | } | 382 | } |
375 | 383 | ||
376 | /* Stop */ | ||
377 | if (msr & MST) { | ||
378 | rcar_i2c_flags_set(priv, ID_DONE); | ||
379 | goto out; | ||
380 | } | ||
381 | |||
382 | /* Nack */ | 384 | /* Nack */ |
383 | if (msr & MNR) { | 385 | if (msr & MNR) { |
384 | /* go to stop phase */ | 386 | /* go to stop phase */ |
@@ -388,6 +390,12 @@ static irqreturn_t rcar_i2c_irq(int irq, void *ptr) | |||
388 | goto out; | 390 | goto out; |
389 | } | 391 | } |
390 | 392 | ||
393 | /* Stop */ | ||
394 | if (msr & MST) { | ||
395 | rcar_i2c_flags_set(priv, ID_DONE); | ||
396 | goto out; | ||
397 | } | ||
398 | |||
391 | if (rcar_i2c_is_recv(priv)) | 399 | if (rcar_i2c_is_recv(priv)) |
392 | rcar_i2c_flags_set(priv, rcar_i2c_irq_recv(priv, msr)); | 400 | rcar_i2c_flags_set(priv, rcar_i2c_irq_recv(priv, msr)); |
393 | else | 401 | else |
@@ -400,6 +408,9 @@ out: | |||
400 | wake_up(&priv->wait); | 408 | wake_up(&priv->wait); |
401 | } | 409 | } |
402 | 410 | ||
411 | spin_unlock(&priv->lock); | ||
412 | /*-------------- spin unlock -----------------*/ | ||
413 | |||
403 | return IRQ_HANDLED; | 414 | return IRQ_HANDLED; |
404 | } | 415 | } |
405 | 416 | ||
@@ -409,14 +420,21 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, | |||
409 | { | 420 | { |
410 | struct rcar_i2c_priv *priv = i2c_get_adapdata(adap); | 421 | struct rcar_i2c_priv *priv = i2c_get_adapdata(adap); |
411 | struct device *dev = rcar_i2c_priv_to_dev(priv); | 422 | struct device *dev = rcar_i2c_priv_to_dev(priv); |
423 | unsigned long flags; | ||
412 | int i, ret, timeout; | 424 | int i, ret, timeout; |
413 | 425 | ||
414 | pm_runtime_get_sync(dev); | 426 | pm_runtime_get_sync(dev); |
415 | 427 | ||
428 | /*-------------- spin lock -----------------*/ | ||
429 | spin_lock_irqsave(&priv->lock, flags); | ||
430 | |||
416 | rcar_i2c_init(priv); | 431 | rcar_i2c_init(priv); |
417 | /* start clock */ | 432 | /* start clock */ |
418 | rcar_i2c_write(priv, ICCCR, priv->icccr); | 433 | rcar_i2c_write(priv, ICCCR, priv->icccr); |
419 | 434 | ||
435 | spin_unlock_irqrestore(&priv->lock, flags); | ||
436 | /*-------------- spin unlock -----------------*/ | ||
437 | |||
420 | ret = rcar_i2c_bus_barrier(priv); | 438 | ret = rcar_i2c_bus_barrier(priv); |
421 | if (ret < 0) | 439 | if (ret < 0) |
422 | goto out; | 440 | goto out; |
@@ -428,6 +446,9 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, | |||
428 | break; | 446 | break; |
429 | } | 447 | } |
430 | 448 | ||
449 | /*-------------- spin lock -----------------*/ | ||
450 | spin_lock_irqsave(&priv->lock, flags); | ||
451 | |||
431 | /* init each data */ | 452 | /* init each data */ |
432 | priv->msg = &msgs[i]; | 453 | priv->msg = &msgs[i]; |
433 | priv->pos = 0; | 454 | priv->pos = 0; |
@@ -437,6 +458,9 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, | |||
437 | 458 | ||
438 | ret = rcar_i2c_prepare_msg(priv); | 459 | ret = rcar_i2c_prepare_msg(priv); |
439 | 460 | ||
461 | spin_unlock_irqrestore(&priv->lock, flags); | ||
462 | /*-------------- spin unlock -----------------*/ | ||
463 | |||
440 | if (ret < 0) | 464 | if (ret < 0) |
441 | break; | 465 | break; |
442 | 466 | ||
@@ -540,6 +564,7 @@ static int rcar_i2c_probe(struct platform_device *pdev) | |||
540 | 564 | ||
541 | irq = platform_get_irq(pdev, 0); | 565 | irq = platform_get_irq(pdev, 0); |
542 | init_waitqueue_head(&priv->wait); | 566 | init_waitqueue_head(&priv->wait); |
567 | spin_lock_init(&priv->lock); | ||
543 | 568 | ||
544 | adap = &priv->adap; | 569 | adap = &priv->adap; |
545 | adap->nr = pdev->id; | 570 | adap->nr = pdev->id; |
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index 69e11853e8bf..b38b0529946a 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c | |||
@@ -238,7 +238,7 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c) | |||
238 | for (i = 0; i < 8; ++i) { | 238 | for (i = 0; i < 8; ++i) { |
239 | val = 0; | 239 | val = 0; |
240 | for (j = 0; j < 4; ++j) { | 240 | for (j = 0; j < 4; ++j) { |
241 | if (i2c->processed == i2c->msg->len) | 241 | if ((i2c->processed == i2c->msg->len) && (cnt != 0)) |
242 | break; | 242 | break; |
243 | 243 | ||
244 | if (i2c->processed == 0 && cnt == 0) | 244 | if (i2c->processed == 0 && cnt == 0) |
@@ -323,6 +323,10 @@ static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) | |||
323 | /* ack interrupt */ | 323 | /* ack interrupt */ |
324 | i2c_writel(i2c, REG_INT_MBRF, REG_IPD); | 324 | i2c_writel(i2c, REG_INT_MBRF, REG_IPD); |
325 | 325 | ||
326 | /* Can only handle a maximum of 32 bytes at a time */ | ||
327 | if (len > 32) | ||
328 | len = 32; | ||
329 | |||
326 | /* read the data from receive buffer */ | 330 | /* read the data from receive buffer */ |
327 | for (i = 0; i < len; ++i) { | 331 | for (i = 0; i < len; ++i) { |
328 | if (i % 4 == 0) | 332 | if (i % 4 == 0) |
@@ -429,12 +433,11 @@ static void rk3x_i2c_set_scl_rate(struct rk3x_i2c *i2c, unsigned long scl_rate) | |||
429 | unsigned long i2c_rate = clk_get_rate(i2c->clk); | 433 | unsigned long i2c_rate = clk_get_rate(i2c->clk); |
430 | unsigned int div; | 434 | unsigned int div; |
431 | 435 | ||
432 | /* SCL rate = (clk rate) / (8 * DIV) */ | 436 | /* set DIV = DIVH = DIVL |
433 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 8); | 437 | * SCL rate = (clk rate) / (8 * (DIVH + 1 + DIVL + 1)) |
434 | 438 | * = (clk rate) / (16 * (DIV + 1)) | |
435 | /* The lower and upper half of the CLKDIV reg describe the length of | 439 | */ |
436 | * SCL low & high periods. */ | 440 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 16) - 1; |
437 | div = DIV_ROUND_UP(div, 2); | ||
438 | 441 | ||
439 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); | 442 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); |
440 | } | 443 | } |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 87d0371cebb7..efba1ebe16ba 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -380,34 +380,33 @@ static inline int tegra_i2c_clock_enable(struct tegra_i2c_dev *i2c_dev) | |||
380 | { | 380 | { |
381 | int ret; | 381 | int ret; |
382 | if (!i2c_dev->hw->has_single_clk_source) { | 382 | if (!i2c_dev->hw->has_single_clk_source) { |
383 | ret = clk_prepare_enable(i2c_dev->fast_clk); | 383 | ret = clk_enable(i2c_dev->fast_clk); |
384 | if (ret < 0) { | 384 | if (ret < 0) { |
385 | dev_err(i2c_dev->dev, | 385 | dev_err(i2c_dev->dev, |
386 | "Enabling fast clk failed, err %d\n", ret); | 386 | "Enabling fast clk failed, err %d\n", ret); |
387 | return ret; | 387 | return ret; |
388 | } | 388 | } |
389 | } | 389 | } |
390 | ret = clk_prepare_enable(i2c_dev->div_clk); | 390 | ret = clk_enable(i2c_dev->div_clk); |
391 | if (ret < 0) { | 391 | if (ret < 0) { |
392 | dev_err(i2c_dev->dev, | 392 | dev_err(i2c_dev->dev, |
393 | "Enabling div clk failed, err %d\n", ret); | 393 | "Enabling div clk failed, err %d\n", ret); |
394 | clk_disable_unprepare(i2c_dev->fast_clk); | 394 | clk_disable(i2c_dev->fast_clk); |
395 | } | 395 | } |
396 | return ret; | 396 | return ret; |
397 | } | 397 | } |
398 | 398 | ||
399 | static inline void tegra_i2c_clock_disable(struct tegra_i2c_dev *i2c_dev) | 399 | static inline void tegra_i2c_clock_disable(struct tegra_i2c_dev *i2c_dev) |
400 | { | 400 | { |
401 | clk_disable_unprepare(i2c_dev->div_clk); | 401 | clk_disable(i2c_dev->div_clk); |
402 | if (!i2c_dev->hw->has_single_clk_source) | 402 | if (!i2c_dev->hw->has_single_clk_source) |
403 | clk_disable_unprepare(i2c_dev->fast_clk); | 403 | clk_disable(i2c_dev->fast_clk); |
404 | } | 404 | } |
405 | 405 | ||
406 | static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | 406 | static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) |
407 | { | 407 | { |
408 | u32 val; | 408 | u32 val; |
409 | int err = 0; | 409 | int err = 0; |
410 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | ||
411 | u32 clk_divisor; | 410 | u32 clk_divisor; |
412 | 411 | ||
413 | err = tegra_i2c_clock_enable(i2c_dev); | 412 | err = tegra_i2c_clock_enable(i2c_dev); |
@@ -428,9 +427,6 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) | |||
428 | i2c_writel(i2c_dev, val, I2C_CNFG); | 427 | i2c_writel(i2c_dev, val, I2C_CNFG); |
429 | i2c_writel(i2c_dev, 0, I2C_INT_MASK); | 428 | i2c_writel(i2c_dev, 0, I2C_INT_MASK); |
430 | 429 | ||
431 | clk_multiplier *= (i2c_dev->hw->clk_divisor_std_fast_mode + 1); | ||
432 | clk_set_rate(i2c_dev->div_clk, i2c_dev->bus_clk_rate * clk_multiplier); | ||
433 | |||
434 | /* Make sure clock divisor programmed correctly */ | 430 | /* Make sure clock divisor programmed correctly */ |
435 | clk_divisor = i2c_dev->hw->clk_divisor_hs_mode; | 431 | clk_divisor = i2c_dev->hw->clk_divisor_hs_mode; |
436 | clk_divisor |= i2c_dev->hw->clk_divisor_std_fast_mode << | 432 | clk_divisor |= i2c_dev->hw->clk_divisor_std_fast_mode << |
@@ -712,6 +708,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
712 | void __iomem *base; | 708 | void __iomem *base; |
713 | int irq; | 709 | int irq; |
714 | int ret = 0; | 710 | int ret = 0; |
711 | int clk_multiplier = I2C_CLK_MULTIPLIER_STD_FAST_MODE; | ||
715 | 712 | ||
716 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 713 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
717 | base = devm_ioremap_resource(&pdev->dev, res); | 714 | base = devm_ioremap_resource(&pdev->dev, res); |
@@ -777,17 +774,39 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
777 | 774 | ||
778 | platform_set_drvdata(pdev, i2c_dev); | 775 | platform_set_drvdata(pdev, i2c_dev); |
779 | 776 | ||
777 | if (!i2c_dev->hw->has_single_clk_source) { | ||
778 | ret = clk_prepare(i2c_dev->fast_clk); | ||
779 | if (ret < 0) { | ||
780 | dev_err(i2c_dev->dev, "Clock prepare failed %d\n", ret); | ||
781 | return ret; | ||
782 | } | ||
783 | } | ||
784 | |||
785 | clk_multiplier *= (i2c_dev->hw->clk_divisor_std_fast_mode + 1); | ||
786 | ret = clk_set_rate(i2c_dev->div_clk, | ||
787 | i2c_dev->bus_clk_rate * clk_multiplier); | ||
788 | if (ret) { | ||
789 | dev_err(i2c_dev->dev, "Clock rate change failed %d\n", ret); | ||
790 | goto unprepare_fast_clk; | ||
791 | } | ||
792 | |||
793 | ret = clk_prepare(i2c_dev->div_clk); | ||
794 | if (ret < 0) { | ||
795 | dev_err(i2c_dev->dev, "Clock prepare failed %d\n", ret); | ||
796 | goto unprepare_fast_clk; | ||
797 | } | ||
798 | |||
780 | ret = tegra_i2c_init(i2c_dev); | 799 | ret = tegra_i2c_init(i2c_dev); |
781 | if (ret) { | 800 | if (ret) { |
782 | dev_err(&pdev->dev, "Failed to initialize i2c controller"); | 801 | dev_err(&pdev->dev, "Failed to initialize i2c controller"); |
783 | return ret; | 802 | goto unprepare_div_clk; |
784 | } | 803 | } |
785 | 804 | ||
786 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, | 805 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, |
787 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); | 806 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); |
788 | if (ret) { | 807 | if (ret) { |
789 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); | 808 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); |
790 | return ret; | 809 | goto unprepare_div_clk; |
791 | } | 810 | } |
792 | 811 | ||
793 | i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); | 812 | i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); |
@@ -803,16 +822,30 @@ static int tegra_i2c_probe(struct platform_device *pdev) | |||
803 | ret = i2c_add_numbered_adapter(&i2c_dev->adapter); | 822 | ret = i2c_add_numbered_adapter(&i2c_dev->adapter); |
804 | if (ret) { | 823 | if (ret) { |
805 | dev_err(&pdev->dev, "Failed to add I2C adapter\n"); | 824 | dev_err(&pdev->dev, "Failed to add I2C adapter\n"); |
806 | return ret; | 825 | goto unprepare_div_clk; |
807 | } | 826 | } |
808 | 827 | ||
809 | return 0; | 828 | return 0; |
829 | |||
830 | unprepare_div_clk: | ||
831 | clk_unprepare(i2c_dev->div_clk); | ||
832 | |||
833 | unprepare_fast_clk: | ||
834 | if (!i2c_dev->hw->has_single_clk_source) | ||
835 | clk_unprepare(i2c_dev->fast_clk); | ||
836 | |||
837 | return ret; | ||
810 | } | 838 | } |
811 | 839 | ||
812 | static int tegra_i2c_remove(struct platform_device *pdev) | 840 | static int tegra_i2c_remove(struct platform_device *pdev) |
813 | { | 841 | { |
814 | struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); | 842 | struct tegra_i2c_dev *i2c_dev = platform_get_drvdata(pdev); |
815 | i2c_del_adapter(&i2c_dev->adapter); | 843 | i2c_del_adapter(&i2c_dev->adapter); |
844 | |||
845 | clk_unprepare(i2c_dev->div_clk); | ||
846 | if (!i2c_dev->hw->has_single_clk_source) | ||
847 | clk_unprepare(i2c_dev->fast_clk); | ||
848 | |||
816 | return 0; | 849 | return 0; |
817 | } | 850 | } |
818 | 851 | ||
diff --git a/drivers/i2c/i2c-acpi.c b/drivers/i2c/i2c-acpi.c deleted file mode 100644 index 0dbc18c15c43..000000000000 --- a/drivers/i2c/i2c-acpi.c +++ /dev/null | |||
@@ -1,364 +0,0 @@ | |||
1 | /* | ||
2 | * I2C ACPI code | ||
3 | * | ||
4 | * Copyright (C) 2014 Intel Corp | ||
5 | * | ||
6 | * Author: Lan Tianyu <tianyu.lan@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
15 | * for more details. | ||
16 | */ | ||
17 | #define pr_fmt(fmt) "I2C/ACPI : " fmt | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/errno.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/i2c.h> | ||
23 | #include <linux/acpi.h> | ||
24 | |||
25 | struct acpi_i2c_handler_data { | ||
26 | struct acpi_connection_info info; | ||
27 | struct i2c_adapter *adapter; | ||
28 | }; | ||
29 | |||
30 | struct gsb_buffer { | ||
31 | u8 status; | ||
32 | u8 len; | ||
33 | union { | ||
34 | u16 wdata; | ||
35 | u8 bdata; | ||
36 | u8 data[0]; | ||
37 | }; | ||
38 | } __packed; | ||
39 | |||
40 | static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data) | ||
41 | { | ||
42 | struct i2c_board_info *info = data; | ||
43 | |||
44 | if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
45 | struct acpi_resource_i2c_serialbus *sb; | ||
46 | |||
47 | sb = &ares->data.i2c_serial_bus; | ||
48 | if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
49 | info->addr = sb->slave_address; | ||
50 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
51 | info->flags |= I2C_CLIENT_TEN; | ||
52 | } | ||
53 | } else if (info->irq < 0) { | ||
54 | struct resource r; | ||
55 | |||
56 | if (acpi_dev_resource_interrupt(ares, 0, &r)) | ||
57 | info->irq = r.start; | ||
58 | } | ||
59 | |||
60 | /* Tell the ACPI core to skip this resource */ | ||
61 | return 1; | ||
62 | } | ||
63 | |||
64 | static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, | ||
65 | void *data, void **return_value) | ||
66 | { | ||
67 | struct i2c_adapter *adapter = data; | ||
68 | struct list_head resource_list; | ||
69 | struct i2c_board_info info; | ||
70 | struct acpi_device *adev; | ||
71 | int ret; | ||
72 | |||
73 | if (acpi_bus_get_device(handle, &adev)) | ||
74 | return AE_OK; | ||
75 | if (acpi_bus_get_status(adev) || !adev->status.present) | ||
76 | return AE_OK; | ||
77 | |||
78 | memset(&info, 0, sizeof(info)); | ||
79 | info.acpi_node.companion = adev; | ||
80 | info.irq = -1; | ||
81 | |||
82 | INIT_LIST_HEAD(&resource_list); | ||
83 | ret = acpi_dev_get_resources(adev, &resource_list, | ||
84 | acpi_i2c_add_resource, &info); | ||
85 | acpi_dev_free_resource_list(&resource_list); | ||
86 | |||
87 | if (ret < 0 || !info.addr) | ||
88 | return AE_OK; | ||
89 | |||
90 | adev->power.flags.ignore_parent = true; | ||
91 | strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type)); | ||
92 | if (!i2c_new_device(adapter, &info)) { | ||
93 | adev->power.flags.ignore_parent = false; | ||
94 | dev_err(&adapter->dev, | ||
95 | "failed to add I2C device %s from ACPI\n", | ||
96 | dev_name(&adev->dev)); | ||
97 | } | ||
98 | |||
99 | return AE_OK; | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * acpi_i2c_register_devices - enumerate I2C slave devices behind adapter | ||
104 | * @adap: pointer to adapter | ||
105 | * | ||
106 | * Enumerate all I2C slave devices behind this adapter by walking the ACPI | ||
107 | * namespace. When a device is found it will be added to the Linux device | ||
108 | * model and bound to the corresponding ACPI handle. | ||
109 | */ | ||
110 | void acpi_i2c_register_devices(struct i2c_adapter *adap) | ||
111 | { | ||
112 | acpi_handle handle; | ||
113 | acpi_status status; | ||
114 | |||
115 | if (!adap->dev.parent) | ||
116 | return; | ||
117 | |||
118 | handle = ACPI_HANDLE(adap->dev.parent); | ||
119 | if (!handle) | ||
120 | return; | ||
121 | |||
122 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
123 | acpi_i2c_add_device, NULL, | ||
124 | adap, NULL); | ||
125 | if (ACPI_FAILURE(status)) | ||
126 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | ||
127 | } | ||
128 | |||
129 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
130 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, | ||
131 | u8 cmd, u8 *data, u8 data_len) | ||
132 | { | ||
133 | |||
134 | struct i2c_msg msgs[2]; | ||
135 | int ret; | ||
136 | u8 *buffer; | ||
137 | |||
138 | buffer = kzalloc(data_len, GFP_KERNEL); | ||
139 | if (!buffer) | ||
140 | return AE_NO_MEMORY; | ||
141 | |||
142 | msgs[0].addr = client->addr; | ||
143 | msgs[0].flags = client->flags; | ||
144 | msgs[0].len = 1; | ||
145 | msgs[0].buf = &cmd; | ||
146 | |||
147 | msgs[1].addr = client->addr; | ||
148 | msgs[1].flags = client->flags | I2C_M_RD; | ||
149 | msgs[1].len = data_len; | ||
150 | msgs[1].buf = buffer; | ||
151 | |||
152 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
153 | if (ret < 0) | ||
154 | dev_err(&client->adapter->dev, "i2c read failed\n"); | ||
155 | else | ||
156 | memcpy(data, buffer, data_len); | ||
157 | |||
158 | kfree(buffer); | ||
159 | return ret; | ||
160 | } | ||
161 | |||
162 | static int acpi_gsb_i2c_write_bytes(struct i2c_client *client, | ||
163 | u8 cmd, u8 *data, u8 data_len) | ||
164 | { | ||
165 | |||
166 | struct i2c_msg msgs[1]; | ||
167 | u8 *buffer; | ||
168 | int ret = AE_OK; | ||
169 | |||
170 | buffer = kzalloc(data_len + 1, GFP_KERNEL); | ||
171 | if (!buffer) | ||
172 | return AE_NO_MEMORY; | ||
173 | |||
174 | buffer[0] = cmd; | ||
175 | memcpy(buffer + 1, data, data_len); | ||
176 | |||
177 | msgs[0].addr = client->addr; | ||
178 | msgs[0].flags = client->flags; | ||
179 | msgs[0].len = data_len + 1; | ||
180 | msgs[0].buf = buffer; | ||
181 | |||
182 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
183 | if (ret < 0) | ||
184 | dev_err(&client->adapter->dev, "i2c write failed\n"); | ||
185 | |||
186 | kfree(buffer); | ||
187 | return ret; | ||
188 | } | ||
189 | |||
190 | static acpi_status | ||
191 | acpi_i2c_space_handler(u32 function, acpi_physical_address command, | ||
192 | u32 bits, u64 *value64, | ||
193 | void *handler_context, void *region_context) | ||
194 | { | ||
195 | struct gsb_buffer *gsb = (struct gsb_buffer *)value64; | ||
196 | struct acpi_i2c_handler_data *data = handler_context; | ||
197 | struct acpi_connection_info *info = &data->info; | ||
198 | struct acpi_resource_i2c_serialbus *sb; | ||
199 | struct i2c_adapter *adapter = data->adapter; | ||
200 | struct i2c_client client; | ||
201 | struct acpi_resource *ares; | ||
202 | u32 accessor_type = function >> 16; | ||
203 | u8 action = function & ACPI_IO_MASK; | ||
204 | acpi_status ret = AE_OK; | ||
205 | int status; | ||
206 | |||
207 | ret = acpi_buffer_to_resource(info->connection, info->length, &ares); | ||
208 | if (ACPI_FAILURE(ret)) | ||
209 | return ret; | ||
210 | |||
211 | if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
212 | ret = AE_BAD_PARAMETER; | ||
213 | goto err; | ||
214 | } | ||
215 | |||
216 | sb = &ares->data.i2c_serial_bus; | ||
217 | if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
218 | ret = AE_BAD_PARAMETER; | ||
219 | goto err; | ||
220 | } | ||
221 | |||
222 | memset(&client, 0, sizeof(client)); | ||
223 | client.adapter = adapter; | ||
224 | client.addr = sb->slave_address; | ||
225 | client.flags = 0; | ||
226 | |||
227 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
228 | client.flags |= I2C_CLIENT_TEN; | ||
229 | |||
230 | switch (accessor_type) { | ||
231 | case ACPI_GSB_ACCESS_ATTRIB_SEND_RCV: | ||
232 | if (action == ACPI_READ) { | ||
233 | status = i2c_smbus_read_byte(&client); | ||
234 | if (status >= 0) { | ||
235 | gsb->bdata = status; | ||
236 | status = 0; | ||
237 | } | ||
238 | } else { | ||
239 | status = i2c_smbus_write_byte(&client, gsb->bdata); | ||
240 | } | ||
241 | break; | ||
242 | |||
243 | case ACPI_GSB_ACCESS_ATTRIB_BYTE: | ||
244 | if (action == ACPI_READ) { | ||
245 | status = i2c_smbus_read_byte_data(&client, command); | ||
246 | if (status >= 0) { | ||
247 | gsb->bdata = status; | ||
248 | status = 0; | ||
249 | } | ||
250 | } else { | ||
251 | status = i2c_smbus_write_byte_data(&client, command, | ||
252 | gsb->bdata); | ||
253 | } | ||
254 | break; | ||
255 | |||
256 | case ACPI_GSB_ACCESS_ATTRIB_WORD: | ||
257 | if (action == ACPI_READ) { | ||
258 | status = i2c_smbus_read_word_data(&client, command); | ||
259 | if (status >= 0) { | ||
260 | gsb->wdata = status; | ||
261 | status = 0; | ||
262 | } | ||
263 | } else { | ||
264 | status = i2c_smbus_write_word_data(&client, command, | ||
265 | gsb->wdata); | ||
266 | } | ||
267 | break; | ||
268 | |||
269 | case ACPI_GSB_ACCESS_ATTRIB_BLOCK: | ||
270 | if (action == ACPI_READ) { | ||
271 | status = i2c_smbus_read_block_data(&client, command, | ||
272 | gsb->data); | ||
273 | if (status >= 0) { | ||
274 | gsb->len = status; | ||
275 | status = 0; | ||
276 | } | ||
277 | } else { | ||
278 | status = i2c_smbus_write_block_data(&client, command, | ||
279 | gsb->len, gsb->data); | ||
280 | } | ||
281 | break; | ||
282 | |||
283 | case ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE: | ||
284 | if (action == ACPI_READ) { | ||
285 | status = acpi_gsb_i2c_read_bytes(&client, command, | ||
286 | gsb->data, info->access_length); | ||
287 | if (status > 0) | ||
288 | status = 0; | ||
289 | } else { | ||
290 | status = acpi_gsb_i2c_write_bytes(&client, command, | ||
291 | gsb->data, info->access_length); | ||
292 | } | ||
293 | break; | ||
294 | |||
295 | default: | ||
296 | pr_info("protocol(0x%02x) is not supported.\n", accessor_type); | ||
297 | ret = AE_BAD_PARAMETER; | ||
298 | goto err; | ||
299 | } | ||
300 | |||
301 | gsb->status = status; | ||
302 | |||
303 | err: | ||
304 | ACPI_FREE(ares); | ||
305 | return ret; | ||
306 | } | ||
307 | |||
308 | |||
309 | int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
310 | { | ||
311 | acpi_handle handle = ACPI_HANDLE(adapter->dev.parent); | ||
312 | struct acpi_i2c_handler_data *data; | ||
313 | acpi_status status; | ||
314 | |||
315 | if (!handle) | ||
316 | return -ENODEV; | ||
317 | |||
318 | data = kzalloc(sizeof(struct acpi_i2c_handler_data), | ||
319 | GFP_KERNEL); | ||
320 | if (!data) | ||
321 | return -ENOMEM; | ||
322 | |||
323 | data->adapter = adapter; | ||
324 | status = acpi_bus_attach_private_data(handle, (void *)data); | ||
325 | if (ACPI_FAILURE(status)) { | ||
326 | kfree(data); | ||
327 | return -ENOMEM; | ||
328 | } | ||
329 | |||
330 | status = acpi_install_address_space_handler(handle, | ||
331 | ACPI_ADR_SPACE_GSBUS, | ||
332 | &acpi_i2c_space_handler, | ||
333 | NULL, | ||
334 | data); | ||
335 | if (ACPI_FAILURE(status)) { | ||
336 | dev_err(&adapter->dev, "Error installing i2c space handler\n"); | ||
337 | acpi_bus_detach_private_data(handle); | ||
338 | kfree(data); | ||
339 | return -ENOMEM; | ||
340 | } | ||
341 | |||
342 | return 0; | ||
343 | } | ||
344 | |||
345 | void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
346 | { | ||
347 | acpi_handle handle = ACPI_HANDLE(adapter->dev.parent); | ||
348 | struct acpi_i2c_handler_data *data; | ||
349 | acpi_status status; | ||
350 | |||
351 | if (!handle) | ||
352 | return; | ||
353 | |||
354 | acpi_remove_address_space_handler(handle, | ||
355 | ACPI_ADR_SPACE_GSBUS, | ||
356 | &acpi_i2c_space_handler); | ||
357 | |||
358 | status = acpi_bus_get_private_data(handle, (void **)&data); | ||
359 | if (ACPI_SUCCESS(status)) | ||
360 | kfree(data); | ||
361 | |||
362 | acpi_bus_detach_private_data(handle); | ||
363 | } | ||
364 | #endif | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 632057a44615..ccfbbab82a15 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -27,6 +27,8 @@ | |||
27 | OF support is copyright (c) 2008 Jochen Friedrich <jochen@scram.de> | 27 | OF support is copyright (c) 2008 Jochen Friedrich <jochen@scram.de> |
28 | (based on a previous patch from Jon Smirl <jonsmirl@gmail.com>) and | 28 | (based on a previous patch from Jon Smirl <jonsmirl@gmail.com>) and |
29 | (c) 2013 Wolfram Sang <wsa@the-dreams.de> | 29 | (c) 2013 Wolfram Sang <wsa@the-dreams.de> |
30 | I2C ACPI code Copyright (C) 2014 Intel Corp | ||
31 | Author: Lan Tianyu <tianyu.lan@intel.com> | ||
30 | */ | 32 | */ |
31 | 33 | ||
32 | #include <linux/module.h> | 34 | #include <linux/module.h> |
@@ -78,6 +80,368 @@ void i2c_transfer_trace_unreg(void) | |||
78 | static_key_slow_dec(&i2c_trace_msg); | 80 | static_key_slow_dec(&i2c_trace_msg); |
79 | } | 81 | } |
80 | 82 | ||
83 | #if defined(CONFIG_ACPI) | ||
84 | struct acpi_i2c_handler_data { | ||
85 | struct acpi_connection_info info; | ||
86 | struct i2c_adapter *adapter; | ||
87 | }; | ||
88 | |||
89 | struct gsb_buffer { | ||
90 | u8 status; | ||
91 | u8 len; | ||
92 | union { | ||
93 | u16 wdata; | ||
94 | u8 bdata; | ||
95 | u8 data[0]; | ||
96 | }; | ||
97 | } __packed; | ||
98 | |||
99 | static int acpi_i2c_add_resource(struct acpi_resource *ares, void *data) | ||
100 | { | ||
101 | struct i2c_board_info *info = data; | ||
102 | |||
103 | if (ares->type == ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
104 | struct acpi_resource_i2c_serialbus *sb; | ||
105 | |||
106 | sb = &ares->data.i2c_serial_bus; | ||
107 | if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
108 | info->addr = sb->slave_address; | ||
109 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
110 | info->flags |= I2C_CLIENT_TEN; | ||
111 | } | ||
112 | } else if (info->irq < 0) { | ||
113 | struct resource r; | ||
114 | |||
115 | if (acpi_dev_resource_interrupt(ares, 0, &r)) | ||
116 | info->irq = r.start; | ||
117 | } | ||
118 | |||
119 | /* Tell the ACPI core to skip this resource */ | ||
120 | return 1; | ||
121 | } | ||
122 | |||
123 | static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level, | ||
124 | void *data, void **return_value) | ||
125 | { | ||
126 | struct i2c_adapter *adapter = data; | ||
127 | struct list_head resource_list; | ||
128 | struct i2c_board_info info; | ||
129 | struct acpi_device *adev; | ||
130 | int ret; | ||
131 | |||
132 | if (acpi_bus_get_device(handle, &adev)) | ||
133 | return AE_OK; | ||
134 | if (acpi_bus_get_status(adev) || !adev->status.present) | ||
135 | return AE_OK; | ||
136 | |||
137 | memset(&info, 0, sizeof(info)); | ||
138 | info.acpi_node.companion = adev; | ||
139 | info.irq = -1; | ||
140 | |||
141 | INIT_LIST_HEAD(&resource_list); | ||
142 | ret = acpi_dev_get_resources(adev, &resource_list, | ||
143 | acpi_i2c_add_resource, &info); | ||
144 | acpi_dev_free_resource_list(&resource_list); | ||
145 | |||
146 | if (ret < 0 || !info.addr) | ||
147 | return AE_OK; | ||
148 | |||
149 | adev->power.flags.ignore_parent = true; | ||
150 | strlcpy(info.type, dev_name(&adev->dev), sizeof(info.type)); | ||
151 | if (!i2c_new_device(adapter, &info)) { | ||
152 | adev->power.flags.ignore_parent = false; | ||
153 | dev_err(&adapter->dev, | ||
154 | "failed to add I2C device %s from ACPI\n", | ||
155 | dev_name(&adev->dev)); | ||
156 | } | ||
157 | |||
158 | return AE_OK; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * acpi_i2c_register_devices - enumerate I2C slave devices behind adapter | ||
163 | * @adap: pointer to adapter | ||
164 | * | ||
165 | * Enumerate all I2C slave devices behind this adapter by walking the ACPI | ||
166 | * namespace. When a device is found it will be added to the Linux device | ||
167 | * model and bound to the corresponding ACPI handle. | ||
168 | */ | ||
169 | static void acpi_i2c_register_devices(struct i2c_adapter *adap) | ||
170 | { | ||
171 | acpi_handle handle; | ||
172 | acpi_status status; | ||
173 | |||
174 | if (!adap->dev.parent) | ||
175 | return; | ||
176 | |||
177 | handle = ACPI_HANDLE(adap->dev.parent); | ||
178 | if (!handle) | ||
179 | return; | ||
180 | |||
181 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1, | ||
182 | acpi_i2c_add_device, NULL, | ||
183 | adap, NULL); | ||
184 | if (ACPI_FAILURE(status)) | ||
185 | dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); | ||
186 | } | ||
187 | |||
188 | #else /* CONFIG_ACPI */ | ||
189 | static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } | ||
190 | #endif /* CONFIG_ACPI */ | ||
191 | |||
192 | #ifdef CONFIG_ACPI_I2C_OPREGION | ||
193 | static int acpi_gsb_i2c_read_bytes(struct i2c_client *client, | ||
194 | u8 cmd, u8 *data, u8 data_len) | ||
195 | { | ||
196 | |||
197 | struct i2c_msg msgs[2]; | ||
198 | int ret; | ||
199 | u8 *buffer; | ||
200 | |||
201 | buffer = kzalloc(data_len, GFP_KERNEL); | ||
202 | if (!buffer) | ||
203 | return AE_NO_MEMORY; | ||
204 | |||
205 | msgs[0].addr = client->addr; | ||
206 | msgs[0].flags = client->flags; | ||
207 | msgs[0].len = 1; | ||
208 | msgs[0].buf = &cmd; | ||
209 | |||
210 | msgs[1].addr = client->addr; | ||
211 | msgs[1].flags = client->flags | I2C_M_RD; | ||
212 | msgs[1].len = data_len; | ||
213 | msgs[1].buf = buffer; | ||
214 | |||
215 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
216 | if (ret < 0) | ||
217 | dev_err(&client->adapter->dev, "i2c read failed\n"); | ||
218 | else | ||
219 | memcpy(data, buffer, data_len); | ||
220 | |||
221 | kfree(buffer); | ||
222 | return ret; | ||
223 | } | ||
224 | |||
225 | static int acpi_gsb_i2c_write_bytes(struct i2c_client *client, | ||
226 | u8 cmd, u8 *data, u8 data_len) | ||
227 | { | ||
228 | |||
229 | struct i2c_msg msgs[1]; | ||
230 | u8 *buffer; | ||
231 | int ret = AE_OK; | ||
232 | |||
233 | buffer = kzalloc(data_len + 1, GFP_KERNEL); | ||
234 | if (!buffer) | ||
235 | return AE_NO_MEMORY; | ||
236 | |||
237 | buffer[0] = cmd; | ||
238 | memcpy(buffer + 1, data, data_len); | ||
239 | |||
240 | msgs[0].addr = client->addr; | ||
241 | msgs[0].flags = client->flags; | ||
242 | msgs[0].len = data_len + 1; | ||
243 | msgs[0].buf = buffer; | ||
244 | |||
245 | ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); | ||
246 | if (ret < 0) | ||
247 | dev_err(&client->adapter->dev, "i2c write failed\n"); | ||
248 | |||
249 | kfree(buffer); | ||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | static acpi_status | ||
254 | acpi_i2c_space_handler(u32 function, acpi_physical_address command, | ||
255 | u32 bits, u64 *value64, | ||
256 | void *handler_context, void *region_context) | ||
257 | { | ||
258 | struct gsb_buffer *gsb = (struct gsb_buffer *)value64; | ||
259 | struct acpi_i2c_handler_data *data = handler_context; | ||
260 | struct acpi_connection_info *info = &data->info; | ||
261 | struct acpi_resource_i2c_serialbus *sb; | ||
262 | struct i2c_adapter *adapter = data->adapter; | ||
263 | struct i2c_client client; | ||
264 | struct acpi_resource *ares; | ||
265 | u32 accessor_type = function >> 16; | ||
266 | u8 action = function & ACPI_IO_MASK; | ||
267 | acpi_status ret = AE_OK; | ||
268 | int status; | ||
269 | |||
270 | ret = acpi_buffer_to_resource(info->connection, info->length, &ares); | ||
271 | if (ACPI_FAILURE(ret)) | ||
272 | return ret; | ||
273 | |||
274 | if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) { | ||
275 | ret = AE_BAD_PARAMETER; | ||
276 | goto err; | ||
277 | } | ||
278 | |||
279 | sb = &ares->data.i2c_serial_bus; | ||
280 | if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) { | ||
281 | ret = AE_BAD_PARAMETER; | ||
282 | goto err; | ||
283 | } | ||
284 | |||
285 | memset(&client, 0, sizeof(client)); | ||
286 | client.adapter = adapter; | ||
287 | client.addr = sb->slave_address; | ||
288 | client.flags = 0; | ||
289 | |||
290 | if (sb->access_mode == ACPI_I2C_10BIT_MODE) | ||
291 | client.flags |= I2C_CLIENT_TEN; | ||
292 | |||
293 | switch (accessor_type) { | ||
294 | case ACPI_GSB_ACCESS_ATTRIB_SEND_RCV: | ||
295 | if (action == ACPI_READ) { | ||
296 | status = i2c_smbus_read_byte(&client); | ||
297 | if (status >= 0) { | ||
298 | gsb->bdata = status; | ||
299 | status = 0; | ||
300 | } | ||
301 | } else { | ||
302 | status = i2c_smbus_write_byte(&client, gsb->bdata); | ||
303 | } | ||
304 | break; | ||
305 | |||
306 | case ACPI_GSB_ACCESS_ATTRIB_BYTE: | ||
307 | if (action == ACPI_READ) { | ||
308 | status = i2c_smbus_read_byte_data(&client, command); | ||
309 | if (status >= 0) { | ||
310 | gsb->bdata = status; | ||
311 | status = 0; | ||
312 | } | ||
313 | } else { | ||
314 | status = i2c_smbus_write_byte_data(&client, command, | ||
315 | gsb->bdata); | ||
316 | } | ||
317 | break; | ||
318 | |||
319 | case ACPI_GSB_ACCESS_ATTRIB_WORD: | ||
320 | if (action == ACPI_READ) { | ||
321 | status = i2c_smbus_read_word_data(&client, command); | ||
322 | if (status >= 0) { | ||
323 | gsb->wdata = status; | ||
324 | status = 0; | ||
325 | } | ||
326 | } else { | ||
327 | status = i2c_smbus_write_word_data(&client, command, | ||
328 | gsb->wdata); | ||
329 | } | ||
330 | break; | ||
331 | |||
332 | case ACPI_GSB_ACCESS_ATTRIB_BLOCK: | ||
333 | if (action == ACPI_READ) { | ||
334 | status = i2c_smbus_read_block_data(&client, command, | ||
335 | gsb->data); | ||
336 | if (status >= 0) { | ||
337 | gsb->len = status; | ||
338 | status = 0; | ||
339 | } | ||
340 | } else { | ||
341 | status = i2c_smbus_write_block_data(&client, command, | ||
342 | gsb->len, gsb->data); | ||
343 | } | ||
344 | break; | ||
345 | |||
346 | case ACPI_GSB_ACCESS_ATTRIB_MULTIBYTE: | ||
347 | if (action == ACPI_READ) { | ||
348 | status = acpi_gsb_i2c_read_bytes(&client, command, | ||
349 | gsb->data, info->access_length); | ||
350 | if (status > 0) | ||
351 | status = 0; | ||
352 | } else { | ||
353 | status = acpi_gsb_i2c_write_bytes(&client, command, | ||
354 | gsb->data, info->access_length); | ||
355 | } | ||
356 | break; | ||
357 | |||
358 | default: | ||
359 | pr_info("protocol(0x%02x) is not supported.\n", accessor_type); | ||
360 | ret = AE_BAD_PARAMETER; | ||
361 | goto err; | ||
362 | } | ||
363 | |||
364 | gsb->status = status; | ||
365 | |||
366 | err: | ||
367 | ACPI_FREE(ares); | ||
368 | return ret; | ||
369 | } | ||
370 | |||
371 | |||
372 | static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
373 | { | ||
374 | acpi_handle handle; | ||
375 | struct acpi_i2c_handler_data *data; | ||
376 | acpi_status status; | ||
377 | |||
378 | if (!adapter->dev.parent) | ||
379 | return -ENODEV; | ||
380 | |||
381 | handle = ACPI_HANDLE(adapter->dev.parent); | ||
382 | |||
383 | if (!handle) | ||
384 | return -ENODEV; | ||
385 | |||
386 | data = kzalloc(sizeof(struct acpi_i2c_handler_data), | ||
387 | GFP_KERNEL); | ||
388 | if (!data) | ||
389 | return -ENOMEM; | ||
390 | |||
391 | data->adapter = adapter; | ||
392 | status = acpi_bus_attach_private_data(handle, (void *)data); | ||
393 | if (ACPI_FAILURE(status)) { | ||
394 | kfree(data); | ||
395 | return -ENOMEM; | ||
396 | } | ||
397 | |||
398 | status = acpi_install_address_space_handler(handle, | ||
399 | ACPI_ADR_SPACE_GSBUS, | ||
400 | &acpi_i2c_space_handler, | ||
401 | NULL, | ||
402 | data); | ||
403 | if (ACPI_FAILURE(status)) { | ||
404 | dev_err(&adapter->dev, "Error installing i2c space handler\n"); | ||
405 | acpi_bus_detach_private_data(handle); | ||
406 | kfree(data); | ||
407 | return -ENOMEM; | ||
408 | } | ||
409 | |||
410 | return 0; | ||
411 | } | ||
412 | |||
413 | static void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
414 | { | ||
415 | acpi_handle handle; | ||
416 | struct acpi_i2c_handler_data *data; | ||
417 | acpi_status status; | ||
418 | |||
419 | if (!adapter->dev.parent) | ||
420 | return; | ||
421 | |||
422 | handle = ACPI_HANDLE(adapter->dev.parent); | ||
423 | |||
424 | if (!handle) | ||
425 | return; | ||
426 | |||
427 | acpi_remove_address_space_handler(handle, | ||
428 | ACPI_ADR_SPACE_GSBUS, | ||
429 | &acpi_i2c_space_handler); | ||
430 | |||
431 | status = acpi_bus_get_private_data(handle, (void **)&data); | ||
432 | if (ACPI_SUCCESS(status)) | ||
433 | kfree(data); | ||
434 | |||
435 | acpi_bus_detach_private_data(handle); | ||
436 | } | ||
437 | #else /* CONFIG_ACPI_I2C_OPREGION */ | ||
438 | static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter) | ||
439 | { } | ||
440 | |||
441 | static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter) | ||
442 | { return 0; } | ||
443 | #endif /* CONFIG_ACPI_I2C_OPREGION */ | ||
444 | |||
81 | /* ------------------------------------------------------------------------- */ | 445 | /* ------------------------------------------------------------------------- */ |
82 | 446 | ||
83 | static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, | 447 | static const struct i2c_device_id *i2c_match_id(const struct i2c_device_id *id, |
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index a077cc86421b..19100fddd2ed 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c | |||
@@ -571,7 +571,7 @@ static int bma180_probe(struct i2c_client *client, | |||
571 | trig->ops = &bma180_trigger_ops; | 571 | trig->ops = &bma180_trigger_ops; |
572 | iio_trigger_set_drvdata(trig, indio_dev); | 572 | iio_trigger_set_drvdata(trig, indio_dev); |
573 | data->trig = trig; | 573 | data->trig = trig; |
574 | indio_dev->trig = trig; | 574 | indio_dev->trig = iio_trigger_get(trig); |
575 | 575 | ||
576 | ret = iio_trigger_register(trig); | 576 | ret = iio_trigger_register(trig); |
577 | if (ret) | 577 | if (ret) |
diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c index c55b81f7f970..d10bd0c97233 100644 --- a/drivers/iio/adc/ad_sigma_delta.c +++ b/drivers/iio/adc/ad_sigma_delta.c | |||
@@ -472,7 +472,7 @@ static int ad_sd_probe_trigger(struct iio_dev *indio_dev) | |||
472 | goto error_free_irq; | 472 | goto error_free_irq; |
473 | 473 | ||
474 | /* select default trigger */ | 474 | /* select default trigger */ |
475 | indio_dev->trig = sigma_delta->trig; | 475 | indio_dev->trig = iio_trigger_get(sigma_delta->trig); |
476 | 476 | ||
477 | return 0; | 477 | return 0; |
478 | 478 | ||
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 772e869c280e..7eadaf16adc1 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -196,6 +196,7 @@ struct at91_adc_state { | |||
196 | bool done; | 196 | bool done; |
197 | int irq; | 197 | int irq; |
198 | u16 last_value; | 198 | u16 last_value; |
199 | int chnb; | ||
199 | struct mutex lock; | 200 | struct mutex lock; |
200 | u8 num_channels; | 201 | u8 num_channels; |
201 | void __iomem *reg_base; | 202 | void __iomem *reg_base; |
@@ -274,7 +275,7 @@ void handle_adc_eoc_trigger(int irq, struct iio_dev *idev) | |||
274 | disable_irq_nosync(irq); | 275 | disable_irq_nosync(irq); |
275 | iio_trigger_poll(idev->trig); | 276 | iio_trigger_poll(idev->trig); |
276 | } else { | 277 | } else { |
277 | st->last_value = at91_adc_readl(st, AT91_ADC_LCDR); | 278 | st->last_value = at91_adc_readl(st, AT91_ADC_CHAN(st, st->chnb)); |
278 | st->done = true; | 279 | st->done = true; |
279 | wake_up_interruptible(&st->wq_data_avail); | 280 | wake_up_interruptible(&st->wq_data_avail); |
280 | } | 281 | } |
@@ -351,7 +352,7 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private) | |||
351 | unsigned int reg; | 352 | unsigned int reg; |
352 | 353 | ||
353 | status &= at91_adc_readl(st, AT91_ADC_IMR); | 354 | status &= at91_adc_readl(st, AT91_ADC_IMR); |
354 | if (status & st->registers->drdy_mask) | 355 | if (status & GENMASK(st->num_channels - 1, 0)) |
355 | handle_adc_eoc_trigger(irq, idev); | 356 | handle_adc_eoc_trigger(irq, idev); |
356 | 357 | ||
357 | if (status & AT91RL_ADC_IER_PEN) { | 358 | if (status & AT91RL_ADC_IER_PEN) { |
@@ -418,7 +419,7 @@ static irqreturn_t at91_adc_9x5_interrupt(int irq, void *private) | |||
418 | AT91_ADC_IER_YRDY | | 419 | AT91_ADC_IER_YRDY | |
419 | AT91_ADC_IER_PRDY; | 420 | AT91_ADC_IER_PRDY; |
420 | 421 | ||
421 | if (status & st->registers->drdy_mask) | 422 | if (status & GENMASK(st->num_channels - 1, 0)) |
422 | handle_adc_eoc_trigger(irq, idev); | 423 | handle_adc_eoc_trigger(irq, idev); |
423 | 424 | ||
424 | if (status & AT91_ADC_IER_PEN) { | 425 | if (status & AT91_ADC_IER_PEN) { |
@@ -689,9 +690,10 @@ static int at91_adc_read_raw(struct iio_dev *idev, | |||
689 | case IIO_CHAN_INFO_RAW: | 690 | case IIO_CHAN_INFO_RAW: |
690 | mutex_lock(&st->lock); | 691 | mutex_lock(&st->lock); |
691 | 692 | ||
693 | st->chnb = chan->channel; | ||
692 | at91_adc_writel(st, AT91_ADC_CHER, | 694 | at91_adc_writel(st, AT91_ADC_CHER, |
693 | AT91_ADC_CH(chan->channel)); | 695 | AT91_ADC_CH(chan->channel)); |
694 | at91_adc_writel(st, AT91_ADC_IER, st->registers->drdy_mask); | 696 | at91_adc_writel(st, AT91_ADC_IER, BIT(chan->channel)); |
695 | at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_START); | 697 | at91_adc_writel(st, AT91_ADC_CR, AT91_ADC_START); |
696 | 698 | ||
697 | ret = wait_event_interruptible_timeout(st->wq_data_avail, | 699 | ret = wait_event_interruptible_timeout(st->wq_data_avail, |
@@ -708,7 +710,7 @@ static int at91_adc_read_raw(struct iio_dev *idev, | |||
708 | 710 | ||
709 | at91_adc_writel(st, AT91_ADC_CHDR, | 711 | at91_adc_writel(st, AT91_ADC_CHDR, |
710 | AT91_ADC_CH(chan->channel)); | 712 | AT91_ADC_CH(chan->channel)); |
711 | at91_adc_writel(st, AT91_ADC_IDR, st->registers->drdy_mask); | 713 | at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); |
712 | 714 | ||
713 | st->last_value = 0; | 715 | st->last_value = 0; |
714 | st->done = false; | 716 | st->done = false; |
diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c index fd2745c62943..626b39749767 100644 --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c | |||
@@ -1126,7 +1126,7 @@ static int xadc_parse_dt(struct iio_dev *indio_dev, struct device_node *np, | |||
1126 | chan->address = XADC_REG_VPVN; | 1126 | chan->address = XADC_REG_VPVN; |
1127 | } else { | 1127 | } else { |
1128 | chan->scan_index = 15 + reg; | 1128 | chan->scan_index = 15 + reg; |
1129 | chan->scan_index = XADC_REG_VAUX(reg - 1); | 1129 | chan->address = XADC_REG_VAUX(reg - 1); |
1130 | } | 1130 | } |
1131 | num_channels++; | 1131 | num_channels++; |
1132 | chan++; | 1132 | chan++; |
diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c index a3109a6f4d86..92068cdbf8c7 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c | |||
@@ -122,7 +122,8 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, | |||
122 | dev_err(&indio_dev->dev, "Trigger Register Failed\n"); | 122 | dev_err(&indio_dev->dev, "Trigger Register Failed\n"); |
123 | goto error_free_trig; | 123 | goto error_free_trig; |
124 | } | 124 | } |
125 | indio_dev->trig = attrb->trigger = trig; | 125 | attrb->trigger = trig; |
126 | indio_dev->trig = iio_trigger_get(trig); | ||
126 | 127 | ||
127 | return ret; | 128 | return ret; |
128 | 129 | ||
diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c index 8fc3a97eb266..8d8ca6f1e16a 100644 --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c | |||
@@ -49,7 +49,7 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
49 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); | 49 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); |
50 | goto iio_trigger_register_error; | 50 | goto iio_trigger_register_error; |
51 | } | 51 | } |
52 | indio_dev->trig = sdata->trig; | 52 | indio_dev->trig = iio_trigger_get(sdata->trig); |
53 | 53 | ||
54 | return 0; | 54 | return 0; |
55 | 55 | ||
diff --git a/drivers/iio/gyro/itg3200_buffer.c b/drivers/iio/gyro/itg3200_buffer.c index e3b3c5084070..eef50e91f17c 100644 --- a/drivers/iio/gyro/itg3200_buffer.c +++ b/drivers/iio/gyro/itg3200_buffer.c | |||
@@ -132,7 +132,7 @@ int itg3200_probe_trigger(struct iio_dev *indio_dev) | |||
132 | goto error_free_irq; | 132 | goto error_free_irq; |
133 | 133 | ||
134 | /* select default trigger */ | 134 | /* select default trigger */ |
135 | indio_dev->trig = st->trig; | 135 | indio_dev->trig = iio_trigger_get(st->trig); |
136 | 136 | ||
137 | return 0; | 137 | return 0; |
138 | 138 | ||
diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c index 03b9372c1212..926fccea8de0 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | |||
@@ -135,7 +135,7 @@ int inv_mpu6050_probe_trigger(struct iio_dev *indio_dev) | |||
135 | ret = iio_trigger_register(st->trig); | 135 | ret = iio_trigger_register(st->trig); |
136 | if (ret) | 136 | if (ret) |
137 | goto error_free_irq; | 137 | goto error_free_irq; |
138 | indio_dev->trig = st->trig; | 138 | indio_dev->trig = iio_trigger_get(st->trig); |
139 | 139 | ||
140 | return 0; | 140 | return 0; |
141 | 141 | ||
diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c index c7497009d60a..f0846108d006 100644 --- a/drivers/iio/inkern.c +++ b/drivers/iio/inkern.c | |||
@@ -178,7 +178,7 @@ static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np, | |||
178 | index = of_property_match_string(np, "io-channel-names", | 178 | index = of_property_match_string(np, "io-channel-names", |
179 | name); | 179 | name); |
180 | chan = of_iio_channel_get(np, index); | 180 | chan = of_iio_channel_get(np, index); |
181 | if (!IS_ERR(chan)) | 181 | if (!IS_ERR(chan) || PTR_ERR(chan) == -EPROBE_DEFER) |
182 | break; | 182 | break; |
183 | else if (name && index >= 0) { | 183 | else if (name && index >= 0) { |
184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", | 184 | pr_err("ERROR: could not get IIO channel %s:%s(%i)\n", |
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index a4b64130ac2f..68cae86dbd29 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c | |||
@@ -42,7 +42,8 @@ | |||
42 | #define ST_MAGN_FS_AVL_5600MG 5600 | 42 | #define ST_MAGN_FS_AVL_5600MG 5600 |
43 | #define ST_MAGN_FS_AVL_8000MG 8000 | 43 | #define ST_MAGN_FS_AVL_8000MG 8000 |
44 | #define ST_MAGN_FS_AVL_8100MG 8100 | 44 | #define ST_MAGN_FS_AVL_8100MG 8100 |
45 | #define ST_MAGN_FS_AVL_10000MG 10000 | 45 | #define ST_MAGN_FS_AVL_12000MG 12000 |
46 | #define ST_MAGN_FS_AVL_16000MG 16000 | ||
46 | 47 | ||
47 | /* CUSTOM VALUES FOR SENSOR 1 */ | 48 | /* CUSTOM VALUES FOR SENSOR 1 */ |
48 | #define ST_MAGN_1_WAI_EXP 0x3c | 49 | #define ST_MAGN_1_WAI_EXP 0x3c |
@@ -69,20 +70,20 @@ | |||
69 | #define ST_MAGN_1_FS_AVL_4700_VAL 0x05 | 70 | #define ST_MAGN_1_FS_AVL_4700_VAL 0x05 |
70 | #define ST_MAGN_1_FS_AVL_5600_VAL 0x06 | 71 | #define ST_MAGN_1_FS_AVL_5600_VAL 0x06 |
71 | #define ST_MAGN_1_FS_AVL_8100_VAL 0x07 | 72 | #define ST_MAGN_1_FS_AVL_8100_VAL 0x07 |
72 | #define ST_MAGN_1_FS_AVL_1300_GAIN_XY 1100 | 73 | #define ST_MAGN_1_FS_AVL_1300_GAIN_XY 909 |
73 | #define ST_MAGN_1_FS_AVL_1900_GAIN_XY 855 | 74 | #define ST_MAGN_1_FS_AVL_1900_GAIN_XY 1169 |
74 | #define ST_MAGN_1_FS_AVL_2500_GAIN_XY 670 | 75 | #define ST_MAGN_1_FS_AVL_2500_GAIN_XY 1492 |
75 | #define ST_MAGN_1_FS_AVL_4000_GAIN_XY 450 | 76 | #define ST_MAGN_1_FS_AVL_4000_GAIN_XY 2222 |
76 | #define ST_MAGN_1_FS_AVL_4700_GAIN_XY 400 | 77 | #define ST_MAGN_1_FS_AVL_4700_GAIN_XY 2500 |
77 | #define ST_MAGN_1_FS_AVL_5600_GAIN_XY 330 | 78 | #define ST_MAGN_1_FS_AVL_5600_GAIN_XY 3030 |
78 | #define ST_MAGN_1_FS_AVL_8100_GAIN_XY 230 | 79 | #define ST_MAGN_1_FS_AVL_8100_GAIN_XY 4347 |
79 | #define ST_MAGN_1_FS_AVL_1300_GAIN_Z 980 | 80 | #define ST_MAGN_1_FS_AVL_1300_GAIN_Z 1020 |
80 | #define ST_MAGN_1_FS_AVL_1900_GAIN_Z 760 | 81 | #define ST_MAGN_1_FS_AVL_1900_GAIN_Z 1315 |
81 | #define ST_MAGN_1_FS_AVL_2500_GAIN_Z 600 | 82 | #define ST_MAGN_1_FS_AVL_2500_GAIN_Z 1666 |
82 | #define ST_MAGN_1_FS_AVL_4000_GAIN_Z 400 | 83 | #define ST_MAGN_1_FS_AVL_4000_GAIN_Z 2500 |
83 | #define ST_MAGN_1_FS_AVL_4700_GAIN_Z 355 | 84 | #define ST_MAGN_1_FS_AVL_4700_GAIN_Z 2816 |
84 | #define ST_MAGN_1_FS_AVL_5600_GAIN_Z 295 | 85 | #define ST_MAGN_1_FS_AVL_5600_GAIN_Z 3389 |
85 | #define ST_MAGN_1_FS_AVL_8100_GAIN_Z 205 | 86 | #define ST_MAGN_1_FS_AVL_8100_GAIN_Z 4878 |
86 | #define ST_MAGN_1_MULTIREAD_BIT false | 87 | #define ST_MAGN_1_MULTIREAD_BIT false |
87 | 88 | ||
88 | /* CUSTOM VALUES FOR SENSOR 2 */ | 89 | /* CUSTOM VALUES FOR SENSOR 2 */ |
@@ -105,10 +106,12 @@ | |||
105 | #define ST_MAGN_2_FS_MASK 0x60 | 106 | #define ST_MAGN_2_FS_MASK 0x60 |
106 | #define ST_MAGN_2_FS_AVL_4000_VAL 0x00 | 107 | #define ST_MAGN_2_FS_AVL_4000_VAL 0x00 |
107 | #define ST_MAGN_2_FS_AVL_8000_VAL 0x01 | 108 | #define ST_MAGN_2_FS_AVL_8000_VAL 0x01 |
108 | #define ST_MAGN_2_FS_AVL_10000_VAL 0x02 | 109 | #define ST_MAGN_2_FS_AVL_12000_VAL 0x02 |
109 | #define ST_MAGN_2_FS_AVL_4000_GAIN 430 | 110 | #define ST_MAGN_2_FS_AVL_16000_VAL 0x03 |
110 | #define ST_MAGN_2_FS_AVL_8000_GAIN 230 | 111 | #define ST_MAGN_2_FS_AVL_4000_GAIN 146 |
111 | #define ST_MAGN_2_FS_AVL_10000_GAIN 230 | 112 | #define ST_MAGN_2_FS_AVL_8000_GAIN 292 |
113 | #define ST_MAGN_2_FS_AVL_12000_GAIN 438 | ||
114 | #define ST_MAGN_2_FS_AVL_16000_GAIN 584 | ||
112 | #define ST_MAGN_2_MULTIREAD_BIT false | 115 | #define ST_MAGN_2_MULTIREAD_BIT false |
113 | #define ST_MAGN_2_OUT_X_L_ADDR 0x28 | 116 | #define ST_MAGN_2_OUT_X_L_ADDR 0x28 |
114 | #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a | 117 | #define ST_MAGN_2_OUT_Y_L_ADDR 0x2a |
@@ -266,9 +269,14 @@ static const struct st_sensors st_magn_sensors[] = { | |||
266 | .gain = ST_MAGN_2_FS_AVL_8000_GAIN, | 269 | .gain = ST_MAGN_2_FS_AVL_8000_GAIN, |
267 | }, | 270 | }, |
268 | [2] = { | 271 | [2] = { |
269 | .num = ST_MAGN_FS_AVL_10000MG, | 272 | .num = ST_MAGN_FS_AVL_12000MG, |
270 | .value = ST_MAGN_2_FS_AVL_10000_VAL, | 273 | .value = ST_MAGN_2_FS_AVL_12000_VAL, |
271 | .gain = ST_MAGN_2_FS_AVL_10000_GAIN, | 274 | .gain = ST_MAGN_2_FS_AVL_12000_GAIN, |
275 | }, | ||
276 | [3] = { | ||
277 | .num = ST_MAGN_FS_AVL_16000MG, | ||
278 | .value = ST_MAGN_2_FS_AVL_16000_VAL, | ||
279 | .gain = ST_MAGN_2_FS_AVL_16000_GAIN, | ||
272 | }, | 280 | }, |
273 | }, | 281 | }, |
274 | }, | 282 | }, |
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index a3a2e9c1639b..df0c4f605a21 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c | |||
@@ -105,6 +105,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, | |||
105 | umem->length = size; | 105 | umem->length = size; |
106 | umem->offset = addr & ~PAGE_MASK; | 106 | umem->offset = addr & ~PAGE_MASK; |
107 | umem->page_size = PAGE_SIZE; | 107 | umem->page_size = PAGE_SIZE; |
108 | umem->pid = get_task_pid(current, PIDTYPE_PID); | ||
108 | /* | 109 | /* |
109 | * We ask for writable memory if any access flags other than | 110 | * We ask for writable memory if any access flags other than |
110 | * "remote read" are set. "Local write" and "remote write" | 111 | * "remote read" are set. "Local write" and "remote write" |
@@ -198,6 +199,7 @@ out: | |||
198 | if (ret < 0) { | 199 | if (ret < 0) { |
199 | if (need_release) | 200 | if (need_release) |
200 | __ib_umem_release(context->device, umem, 0); | 201 | __ib_umem_release(context->device, umem, 0); |
202 | put_pid(umem->pid); | ||
201 | kfree(umem); | 203 | kfree(umem); |
202 | } else | 204 | } else |
203 | current->mm->pinned_vm = locked; | 205 | current->mm->pinned_vm = locked; |
@@ -230,15 +232,19 @@ void ib_umem_release(struct ib_umem *umem) | |||
230 | { | 232 | { |
231 | struct ib_ucontext *context = umem->context; | 233 | struct ib_ucontext *context = umem->context; |
232 | struct mm_struct *mm; | 234 | struct mm_struct *mm; |
235 | struct task_struct *task; | ||
233 | unsigned long diff; | 236 | unsigned long diff; |
234 | 237 | ||
235 | __ib_umem_release(umem->context->device, umem, 1); | 238 | __ib_umem_release(umem->context->device, umem, 1); |
236 | 239 | ||
237 | mm = get_task_mm(current); | 240 | task = get_pid_task(umem->pid, PIDTYPE_PID); |
238 | if (!mm) { | 241 | put_pid(umem->pid); |
239 | kfree(umem); | 242 | if (!task) |
240 | return; | 243 | goto out; |
241 | } | 244 | mm = get_task_mm(task); |
245 | put_task_struct(task); | ||
246 | if (!mm) | ||
247 | goto out; | ||
242 | 248 | ||
243 | diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT; | 249 | diff = PAGE_ALIGN(umem->length + umem->offset) >> PAGE_SHIFT; |
244 | 250 | ||
@@ -262,9 +268,10 @@ void ib_umem_release(struct ib_umem *umem) | |||
262 | } else | 268 | } else |
263 | down_write(&mm->mmap_sem); | 269 | down_write(&mm->mmap_sem); |
264 | 270 | ||
265 | current->mm->pinned_vm -= diff; | 271 | mm->pinned_vm -= diff; |
266 | up_write(&mm->mmap_sem); | 272 | up_write(&mm->mmap_sem); |
267 | mmput(mm); | 273 | mmput(mm); |
274 | out: | ||
268 | kfree(umem); | 275 | kfree(umem); |
269 | } | 276 | } |
270 | EXPORT_SYMBOL(ib_umem_release); | 277 | EXPORT_SYMBOL(ib_umem_release); |
diff --git a/drivers/infiniband/core/uverbs_marshall.c b/drivers/infiniband/core/uverbs_marshall.c index e7bee46868d1..abd97247443e 100644 --- a/drivers/infiniband/core/uverbs_marshall.c +++ b/drivers/infiniband/core/uverbs_marshall.c | |||
@@ -140,5 +140,9 @@ void ib_copy_path_rec_from_user(struct ib_sa_path_rec *dst, | |||
140 | dst->packet_life_time = src->packet_life_time; | 140 | dst->packet_life_time = src->packet_life_time; |
141 | dst->preference = src->preference; | 141 | dst->preference = src->preference; |
142 | dst->packet_life_time_selector = src->packet_life_time_selector; | 142 | dst->packet_life_time_selector = src->packet_life_time_selector; |
143 | |||
144 | memset(dst->smac, 0, sizeof(dst->smac)); | ||
145 | memset(dst->dmac, 0, sizeof(dst->dmac)); | ||
146 | dst->vlan_id = 0xffff; | ||
143 | } | 147 | } |
144 | EXPORT_SYMBOL(ib_copy_path_rec_from_user); | 148 | EXPORT_SYMBOL(ib_copy_path_rec_from_user); |
diff --git a/drivers/infiniband/hw/ipath/ipath_user_pages.c b/drivers/infiniband/hw/ipath/ipath_user_pages.c index dc66c4506916..1da1252dcdb3 100644 --- a/drivers/infiniband/hw/ipath/ipath_user_pages.c +++ b/drivers/infiniband/hw/ipath/ipath_user_pages.c | |||
@@ -54,7 +54,7 @@ static void __ipath_release_user_pages(struct page **p, size_t num_pages, | |||
54 | 54 | ||
55 | /* call with current->mm->mmap_sem held */ | 55 | /* call with current->mm->mmap_sem held */ |
56 | static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages, | 56 | static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages, |
57 | struct page **p, struct vm_area_struct **vma) | 57 | struct page **p) |
58 | { | 58 | { |
59 | unsigned long lock_limit; | 59 | unsigned long lock_limit; |
60 | size_t got; | 60 | size_t got; |
@@ -74,7 +74,7 @@ static int __ipath_get_user_pages(unsigned long start_page, size_t num_pages, | |||
74 | ret = get_user_pages(current, current->mm, | 74 | ret = get_user_pages(current, current->mm, |
75 | start_page + got * PAGE_SIZE, | 75 | start_page + got * PAGE_SIZE, |
76 | num_pages - got, 1, 1, | 76 | num_pages - got, 1, 1, |
77 | p + got, vma); | 77 | p + got, NULL); |
78 | if (ret < 0) | 78 | if (ret < 0) |
79 | goto bail_release; | 79 | goto bail_release; |
80 | } | 80 | } |
@@ -165,7 +165,7 @@ int ipath_get_user_pages(unsigned long start_page, size_t num_pages, | |||
165 | 165 | ||
166 | down_write(¤t->mm->mmap_sem); | 166 | down_write(¤t->mm->mmap_sem); |
167 | 167 | ||
168 | ret = __ipath_get_user_pages(start_page, num_pages, p, NULL); | 168 | ret = __ipath_get_user_pages(start_page, num_pages, p); |
169 | 169 | ||
170 | up_write(¤t->mm->mmap_sem); | 170 | up_write(¤t->mm->mmap_sem); |
171 | 171 | ||
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index e1e558a3d692..bda5994ceb68 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -59,6 +59,7 @@ | |||
59 | 59 | ||
60 | #define MLX4_IB_FLOW_MAX_PRIO 0xFFF | 60 | #define MLX4_IB_FLOW_MAX_PRIO 0xFFF |
61 | #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF | 61 | #define MLX4_IB_FLOW_QPN_MASK 0xFFFFFF |
62 | #define MLX4_IB_CARD_REV_A0 0xA0 | ||
62 | 63 | ||
63 | MODULE_AUTHOR("Roland Dreier"); | 64 | MODULE_AUTHOR("Roland Dreier"); |
64 | MODULE_DESCRIPTION("Mellanox ConnectX HCA InfiniBand driver"); | 65 | MODULE_DESCRIPTION("Mellanox ConnectX HCA InfiniBand driver"); |
@@ -119,6 +120,17 @@ static int check_flow_steering_support(struct mlx4_dev *dev) | |||
119 | return dmfs; | 120 | return dmfs; |
120 | } | 121 | } |
121 | 122 | ||
123 | static int num_ib_ports(struct mlx4_dev *dev) | ||
124 | { | ||
125 | int ib_ports = 0; | ||
126 | int i; | ||
127 | |||
128 | mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB) | ||
129 | ib_ports++; | ||
130 | |||
131 | return ib_ports; | ||
132 | } | ||
133 | |||
122 | static int mlx4_ib_query_device(struct ib_device *ibdev, | 134 | static int mlx4_ib_query_device(struct ib_device *ibdev, |
123 | struct ib_device_attr *props) | 135 | struct ib_device_attr *props) |
124 | { | 136 | { |
@@ -126,6 +138,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
126 | struct ib_smp *in_mad = NULL; | 138 | struct ib_smp *in_mad = NULL; |
127 | struct ib_smp *out_mad = NULL; | 139 | struct ib_smp *out_mad = NULL; |
128 | int err = -ENOMEM; | 140 | int err = -ENOMEM; |
141 | int have_ib_ports; | ||
129 | 142 | ||
130 | in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); | 143 | in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); |
131 | out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); | 144 | out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); |
@@ -142,6 +155,8 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
142 | 155 | ||
143 | memset(props, 0, sizeof *props); | 156 | memset(props, 0, sizeof *props); |
144 | 157 | ||
158 | have_ib_ports = num_ib_ports(dev->dev); | ||
159 | |||
145 | props->fw_ver = dev->dev->caps.fw_ver; | 160 | props->fw_ver = dev->dev->caps.fw_ver; |
146 | props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | | 161 | props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | |
147 | IB_DEVICE_PORT_ACTIVE_EVENT | | 162 | IB_DEVICE_PORT_ACTIVE_EVENT | |
@@ -152,13 +167,15 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
152 | props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; | 167 | props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; |
153 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR) | 168 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR) |
154 | props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR; | 169 | props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR; |
155 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM) | 170 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM && have_ib_ports) |
156 | props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG; | 171 | props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG; |
157 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT) | 172 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT) |
158 | props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE; | 173 | props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE; |
159 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_IPOIB_CSUM) | 174 | if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_IPOIB_CSUM) |
160 | props->device_cap_flags |= IB_DEVICE_UD_IP_CSUM; | 175 | props->device_cap_flags |= IB_DEVICE_UD_IP_CSUM; |
161 | if (dev->dev->caps.max_gso_sz && dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BLH) | 176 | if (dev->dev->caps.max_gso_sz && |
177 | (dev->dev->rev_id != MLX4_IB_CARD_REV_A0) && | ||
178 | (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BLH)) | ||
162 | props->device_cap_flags |= IB_DEVICE_UD_TSO; | 179 | props->device_cap_flags |= IB_DEVICE_UD_TSO; |
163 | if (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_RESERVED_LKEY) | 180 | if (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_RESERVED_LKEY) |
164 | props->device_cap_flags |= IB_DEVICE_LOCAL_DMA_LKEY; | 181 | props->device_cap_flags |= IB_DEVICE_LOCAL_DMA_LKEY; |
@@ -357,7 +374,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, | |||
357 | props->state = IB_PORT_DOWN; | 374 | props->state = IB_PORT_DOWN; |
358 | props->phys_state = state_to_phys_state(props->state); | 375 | props->phys_state = state_to_phys_state(props->state); |
359 | props->active_mtu = IB_MTU_256; | 376 | props->active_mtu = IB_MTU_256; |
360 | spin_lock(&iboe->lock); | 377 | spin_lock_bh(&iboe->lock); |
361 | ndev = iboe->netdevs[port - 1]; | 378 | ndev = iboe->netdevs[port - 1]; |
362 | if (!ndev) | 379 | if (!ndev) |
363 | goto out_unlock; | 380 | goto out_unlock; |
@@ -369,7 +386,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port, | |||
369 | IB_PORT_ACTIVE : IB_PORT_DOWN; | 386 | IB_PORT_ACTIVE : IB_PORT_DOWN; |
370 | props->phys_state = state_to_phys_state(props->state); | 387 | props->phys_state = state_to_phys_state(props->state); |
371 | out_unlock: | 388 | out_unlock: |
372 | spin_unlock(&iboe->lock); | 389 | spin_unlock_bh(&iboe->lock); |
373 | out: | 390 | out: |
374 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); | 391 | mlx4_free_cmd_mailbox(mdev->dev, mailbox); |
375 | return err; | 392 | return err; |
@@ -811,11 +828,11 @@ int mlx4_ib_add_mc(struct mlx4_ib_dev *mdev, struct mlx4_ib_qp *mqp, | |||
811 | if (!mqp->port) | 828 | if (!mqp->port) |
812 | return 0; | 829 | return 0; |
813 | 830 | ||
814 | spin_lock(&mdev->iboe.lock); | 831 | spin_lock_bh(&mdev->iboe.lock); |
815 | ndev = mdev->iboe.netdevs[mqp->port - 1]; | 832 | ndev = mdev->iboe.netdevs[mqp->port - 1]; |
816 | if (ndev) | 833 | if (ndev) |
817 | dev_hold(ndev); | 834 | dev_hold(ndev); |
818 | spin_unlock(&mdev->iboe.lock); | 835 | spin_unlock_bh(&mdev->iboe.lock); |
819 | 836 | ||
820 | if (ndev) { | 837 | if (ndev) { |
821 | ret = 1; | 838 | ret = 1; |
@@ -1089,6 +1106,30 @@ static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id) | |||
1089 | return err; | 1106 | return err; |
1090 | } | 1107 | } |
1091 | 1108 | ||
1109 | static int mlx4_ib_tunnel_steer_add(struct ib_qp *qp, struct ib_flow_attr *flow_attr, | ||
1110 | u64 *reg_id) | ||
1111 | { | ||
1112 | void *ib_flow; | ||
1113 | union ib_flow_spec *ib_spec; | ||
1114 | struct mlx4_dev *dev = to_mdev(qp->device)->dev; | ||
1115 | int err = 0; | ||
1116 | |||
1117 | if (dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | ||
1118 | return 0; /* do nothing */ | ||
1119 | |||
1120 | ib_flow = flow_attr + 1; | ||
1121 | ib_spec = (union ib_flow_spec *)ib_flow; | ||
1122 | |||
1123 | if (ib_spec->type != IB_FLOW_SPEC_ETH || flow_attr->num_of_specs != 1) | ||
1124 | return 0; /* do nothing */ | ||
1125 | |||
1126 | err = mlx4_tunnel_steer_add(to_mdev(qp->device)->dev, ib_spec->eth.val.dst_mac, | ||
1127 | flow_attr->port, qp->qp_num, | ||
1128 | MLX4_DOMAIN_UVERBS | (flow_attr->priority & 0xff), | ||
1129 | reg_id); | ||
1130 | return err; | ||
1131 | } | ||
1132 | |||
1092 | static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, | 1133 | static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, |
1093 | struct ib_flow_attr *flow_attr, | 1134 | struct ib_flow_attr *flow_attr, |
1094 | int domain) | 1135 | int domain) |
@@ -1136,6 +1177,12 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, | |||
1136 | i++; | 1177 | i++; |
1137 | } | 1178 | } |
1138 | 1179 | ||
1180 | if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { | ||
1181 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]); | ||
1182 | if (err) | ||
1183 | goto err_free; | ||
1184 | } | ||
1185 | |||
1139 | return &mflow->ibflow; | 1186 | return &mflow->ibflow; |
1140 | 1187 | ||
1141 | err_free: | 1188 | err_free: |
@@ -1262,11 +1309,11 @@ static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid) | |||
1262 | mutex_lock(&mqp->mutex); | 1309 | mutex_lock(&mqp->mutex); |
1263 | ge = find_gid_entry(mqp, gid->raw); | 1310 | ge = find_gid_entry(mqp, gid->raw); |
1264 | if (ge) { | 1311 | if (ge) { |
1265 | spin_lock(&mdev->iboe.lock); | 1312 | spin_lock_bh(&mdev->iboe.lock); |
1266 | ndev = ge->added ? mdev->iboe.netdevs[ge->port - 1] : NULL; | 1313 | ndev = ge->added ? mdev->iboe.netdevs[ge->port - 1] : NULL; |
1267 | if (ndev) | 1314 | if (ndev) |
1268 | dev_hold(ndev); | 1315 | dev_hold(ndev); |
1269 | spin_unlock(&mdev->iboe.lock); | 1316 | spin_unlock_bh(&mdev->iboe.lock); |
1270 | if (ndev) | 1317 | if (ndev) |
1271 | dev_put(ndev); | 1318 | dev_put(ndev); |
1272 | list_del(&ge->list); | 1319 | list_del(&ge->list); |
@@ -1387,6 +1434,9 @@ static void update_gids_task(struct work_struct *work) | |||
1387 | int err; | 1434 | int err; |
1388 | struct mlx4_dev *dev = gw->dev->dev; | 1435 | struct mlx4_dev *dev = gw->dev->dev; |
1389 | 1436 | ||
1437 | if (!gw->dev->ib_active) | ||
1438 | return; | ||
1439 | |||
1390 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 1440 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
1391 | if (IS_ERR(mailbox)) { | 1441 | if (IS_ERR(mailbox)) { |
1392 | pr_warn("update gid table failed %ld\n", PTR_ERR(mailbox)); | 1442 | pr_warn("update gid table failed %ld\n", PTR_ERR(mailbox)); |
@@ -1417,6 +1467,9 @@ static void reset_gids_task(struct work_struct *work) | |||
1417 | int err; | 1467 | int err; |
1418 | struct mlx4_dev *dev = gw->dev->dev; | 1468 | struct mlx4_dev *dev = gw->dev->dev; |
1419 | 1469 | ||
1470 | if (!gw->dev->ib_active) | ||
1471 | return; | ||
1472 | |||
1420 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 1473 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
1421 | if (IS_ERR(mailbox)) { | 1474 | if (IS_ERR(mailbox)) { |
1422 | pr_warn("reset gid table failed\n"); | 1475 | pr_warn("reset gid table failed\n"); |
@@ -1551,7 +1604,7 @@ static int mlx4_ib_addr_event(int event, struct net_device *event_netdev, | |||
1551 | return 0; | 1604 | return 0; |
1552 | 1605 | ||
1553 | iboe = &ibdev->iboe; | 1606 | iboe = &ibdev->iboe; |
1554 | spin_lock(&iboe->lock); | 1607 | spin_lock_bh(&iboe->lock); |
1555 | 1608 | ||
1556 | for (port = 1; port <= ibdev->dev->caps.num_ports; ++port) | 1609 | for (port = 1; port <= ibdev->dev->caps.num_ports; ++port) |
1557 | if ((netif_is_bond_master(real_dev) && | 1610 | if ((netif_is_bond_master(real_dev) && |
@@ -1561,7 +1614,7 @@ static int mlx4_ib_addr_event(int event, struct net_device *event_netdev, | |||
1561 | update_gid_table(ibdev, port, gid, | 1614 | update_gid_table(ibdev, port, gid, |
1562 | event == NETDEV_DOWN, 0); | 1615 | event == NETDEV_DOWN, 0); |
1563 | 1616 | ||
1564 | spin_unlock(&iboe->lock); | 1617 | spin_unlock_bh(&iboe->lock); |
1565 | return 0; | 1618 | return 0; |
1566 | 1619 | ||
1567 | } | 1620 | } |
@@ -1634,13 +1687,21 @@ static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev, | |||
1634 | new_smac = mlx4_mac_to_u64(dev->dev_addr); | 1687 | new_smac = mlx4_mac_to_u64(dev->dev_addr); |
1635 | read_unlock(&dev_base_lock); | 1688 | read_unlock(&dev_base_lock); |
1636 | 1689 | ||
1690 | atomic64_set(&ibdev->iboe.mac[port - 1], new_smac); | ||
1691 | |||
1692 | /* no need for update QP1 and mac registration in non-SRIOV */ | ||
1693 | if (!mlx4_is_mfunc(ibdev->dev)) | ||
1694 | return; | ||
1695 | |||
1637 | mutex_lock(&ibdev->qp1_proxy_lock[port - 1]); | 1696 | mutex_lock(&ibdev->qp1_proxy_lock[port - 1]); |
1638 | qp = ibdev->qp1_proxy[port - 1]; | 1697 | qp = ibdev->qp1_proxy[port - 1]; |
1639 | if (qp) { | 1698 | if (qp) { |
1640 | int new_smac_index; | 1699 | int new_smac_index; |
1641 | u64 old_smac = qp->pri.smac; | 1700 | u64 old_smac; |
1642 | struct mlx4_update_qp_params update_params; | 1701 | struct mlx4_update_qp_params update_params; |
1643 | 1702 | ||
1703 | mutex_lock(&qp->mutex); | ||
1704 | old_smac = qp->pri.smac; | ||
1644 | if (new_smac == old_smac) | 1705 | if (new_smac == old_smac) |
1645 | goto unlock; | 1706 | goto unlock; |
1646 | 1707 | ||
@@ -1650,22 +1711,25 @@ static void mlx4_ib_update_qps(struct mlx4_ib_dev *ibdev, | |||
1650 | goto unlock; | 1711 | goto unlock; |
1651 | 1712 | ||
1652 | update_params.smac_index = new_smac_index; | 1713 | update_params.smac_index = new_smac_index; |
1653 | if (mlx4_update_qp(ibdev->dev, &qp->mqp, MLX4_UPDATE_QP_SMAC, | 1714 | if (mlx4_update_qp(ibdev->dev, qp->mqp.qpn, MLX4_UPDATE_QP_SMAC, |
1654 | &update_params)) { | 1715 | &update_params)) { |
1655 | release_mac = new_smac; | 1716 | release_mac = new_smac; |
1656 | goto unlock; | 1717 | goto unlock; |
1657 | } | 1718 | } |
1658 | 1719 | /* if old port was zero, no mac was yet registered for this QP */ | |
1720 | if (qp->pri.smac_port) | ||
1721 | release_mac = old_smac; | ||
1659 | qp->pri.smac = new_smac; | 1722 | qp->pri.smac = new_smac; |
1723 | qp->pri.smac_port = port; | ||
1660 | qp->pri.smac_index = new_smac_index; | 1724 | qp->pri.smac_index = new_smac_index; |
1661 | |||
1662 | release_mac = old_smac; | ||
1663 | } | 1725 | } |
1664 | 1726 | ||
1665 | unlock: | 1727 | unlock: |
1666 | mutex_unlock(&ibdev->qp1_proxy_lock[port - 1]); | ||
1667 | if (release_mac != MLX4_IB_INVALID_MAC) | 1728 | if (release_mac != MLX4_IB_INVALID_MAC) |
1668 | mlx4_unregister_mac(ibdev->dev, port, release_mac); | 1729 | mlx4_unregister_mac(ibdev->dev, port, release_mac); |
1730 | if (qp) | ||
1731 | mutex_unlock(&qp->mutex); | ||
1732 | mutex_unlock(&ibdev->qp1_proxy_lock[port - 1]); | ||
1669 | } | 1733 | } |
1670 | 1734 | ||
1671 | static void mlx4_ib_get_dev_addr(struct net_device *dev, | 1735 | static void mlx4_ib_get_dev_addr(struct net_device *dev, |
@@ -1676,6 +1740,7 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev, | |||
1676 | struct inet6_dev *in6_dev; | 1740 | struct inet6_dev *in6_dev; |
1677 | union ib_gid *pgid; | 1741 | union ib_gid *pgid; |
1678 | struct inet6_ifaddr *ifp; | 1742 | struct inet6_ifaddr *ifp; |
1743 | union ib_gid default_gid; | ||
1679 | #endif | 1744 | #endif |
1680 | union ib_gid gid; | 1745 | union ib_gid gid; |
1681 | 1746 | ||
@@ -1696,12 +1761,15 @@ static void mlx4_ib_get_dev_addr(struct net_device *dev, | |||
1696 | in_dev_put(in_dev); | 1761 | in_dev_put(in_dev); |
1697 | } | 1762 | } |
1698 | #if IS_ENABLED(CONFIG_IPV6) | 1763 | #if IS_ENABLED(CONFIG_IPV6) |
1764 | mlx4_make_default_gid(dev, &default_gid); | ||
1699 | /* IPv6 gids */ | 1765 | /* IPv6 gids */ |
1700 | in6_dev = in6_dev_get(dev); | 1766 | in6_dev = in6_dev_get(dev); |
1701 | if (in6_dev) { | 1767 | if (in6_dev) { |
1702 | read_lock_bh(&in6_dev->lock); | 1768 | read_lock_bh(&in6_dev->lock); |
1703 | list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { | 1769 | list_for_each_entry(ifp, &in6_dev->addr_list, if_list) { |
1704 | pgid = (union ib_gid *)&ifp->addr; | 1770 | pgid = (union ib_gid *)&ifp->addr; |
1771 | if (!memcmp(pgid, &default_gid, sizeof(*pgid))) | ||
1772 | continue; | ||
1705 | update_gid_table(ibdev, port, pgid, 0, 0); | 1773 | update_gid_table(ibdev, port, pgid, 0, 0); |
1706 | } | 1774 | } |
1707 | read_unlock_bh(&in6_dev->lock); | 1775 | read_unlock_bh(&in6_dev->lock); |
@@ -1723,24 +1791,33 @@ static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev) | |||
1723 | struct net_device *dev; | 1791 | struct net_device *dev; |
1724 | struct mlx4_ib_iboe *iboe = &ibdev->iboe; | 1792 | struct mlx4_ib_iboe *iboe = &ibdev->iboe; |
1725 | int i; | 1793 | int i; |
1794 | int err = 0; | ||
1726 | 1795 | ||
1727 | for (i = 1; i <= ibdev->num_ports; ++i) | 1796 | for (i = 1; i <= ibdev->num_ports; ++i) { |
1728 | if (reset_gid_table(ibdev, i)) | 1797 | if (rdma_port_get_link_layer(&ibdev->ib_dev, i) == |
1729 | return -1; | 1798 | IB_LINK_LAYER_ETHERNET) { |
1799 | err = reset_gid_table(ibdev, i); | ||
1800 | if (err) | ||
1801 | goto out; | ||
1802 | } | ||
1803 | } | ||
1730 | 1804 | ||
1731 | read_lock(&dev_base_lock); | 1805 | read_lock(&dev_base_lock); |
1732 | spin_lock(&iboe->lock); | 1806 | spin_lock_bh(&iboe->lock); |
1733 | 1807 | ||
1734 | for_each_netdev(&init_net, dev) { | 1808 | for_each_netdev(&init_net, dev) { |
1735 | u8 port = mlx4_ib_get_dev_port(dev, ibdev); | 1809 | u8 port = mlx4_ib_get_dev_port(dev, ibdev); |
1736 | if (port) | 1810 | /* port will be non-zero only for ETH ports */ |
1811 | if (port) { | ||
1812 | mlx4_ib_set_default_gid(ibdev, dev, port); | ||
1737 | mlx4_ib_get_dev_addr(dev, ibdev, port); | 1813 | mlx4_ib_get_dev_addr(dev, ibdev, port); |
1814 | } | ||
1738 | } | 1815 | } |
1739 | 1816 | ||
1740 | spin_unlock(&iboe->lock); | 1817 | spin_unlock_bh(&iboe->lock); |
1741 | read_unlock(&dev_base_lock); | 1818 | read_unlock(&dev_base_lock); |
1742 | 1819 | out: | |
1743 | return 0; | 1820 | return err; |
1744 | } | 1821 | } |
1745 | 1822 | ||
1746 | static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, | 1823 | static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, |
@@ -1754,7 +1831,7 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, | |||
1754 | 1831 | ||
1755 | iboe = &ibdev->iboe; | 1832 | iboe = &ibdev->iboe; |
1756 | 1833 | ||
1757 | spin_lock(&iboe->lock); | 1834 | spin_lock_bh(&iboe->lock); |
1758 | mlx4_foreach_ib_transport_port(port, ibdev->dev) { | 1835 | mlx4_foreach_ib_transport_port(port, ibdev->dev) { |
1759 | enum ib_port_state port_state = IB_PORT_NOP; | 1836 | enum ib_port_state port_state = IB_PORT_NOP; |
1760 | struct net_device *old_master = iboe->masters[port - 1]; | 1837 | struct net_device *old_master = iboe->masters[port - 1]; |
@@ -1786,35 +1863,47 @@ static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev, | |||
1786 | port_state = (netif_running(curr_netdev) && netif_carrier_ok(curr_netdev)) ? | 1863 | port_state = (netif_running(curr_netdev) && netif_carrier_ok(curr_netdev)) ? |
1787 | IB_PORT_ACTIVE : IB_PORT_DOWN; | 1864 | IB_PORT_ACTIVE : IB_PORT_DOWN; |
1788 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | 1865 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); |
1789 | } else { | 1866 | if (curr_master) { |
1790 | reset_gid_table(ibdev, port); | 1867 | /* if using bonding/team and a slave port is down, we |
1791 | } | 1868 | * don't want the bond IP based gids in the table since |
1792 | /* if using bonding/team and a slave port is down, we don't the bond IP | 1869 | * flows that select port by gid may get the down port. |
1793 | * based gids in the table since flows that select port by gid may get | 1870 | */ |
1794 | * the down port. | 1871 | if (port_state == IB_PORT_DOWN) { |
1795 | */ | 1872 | reset_gid_table(ibdev, port); |
1796 | if (curr_master && (port_state == IB_PORT_DOWN)) { | 1873 | mlx4_ib_set_default_gid(ibdev, |
1797 | reset_gid_table(ibdev, port); | 1874 | curr_netdev, |
1798 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | 1875 | port); |
1799 | } | 1876 | } else { |
1800 | /* if bonding is used it is possible that we add it to masters | 1877 | /* gids from the upper dev (bond/team) |
1801 | * only after IP address is assigned to the net bonding | 1878 | * should appear in port's gid table |
1802 | * interface. | 1879 | */ |
1803 | */ | 1880 | mlx4_ib_get_dev_addr(curr_master, |
1804 | if (curr_master && (old_master != curr_master)) { | 1881 | ibdev, port); |
1805 | reset_gid_table(ibdev, port); | 1882 | } |
1806 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | 1883 | } |
1807 | mlx4_ib_get_dev_addr(curr_master, ibdev, port); | 1884 | /* if bonding is used it is possible that we add it to |
1808 | } | 1885 | * masters only after IP address is assigned to the |
1886 | * net bonding interface. | ||
1887 | */ | ||
1888 | if (curr_master && (old_master != curr_master)) { | ||
1889 | reset_gid_table(ibdev, port); | ||
1890 | mlx4_ib_set_default_gid(ibdev, | ||
1891 | curr_netdev, port); | ||
1892 | mlx4_ib_get_dev_addr(curr_master, ibdev, port); | ||
1893 | } | ||
1809 | 1894 | ||
1810 | if (!curr_master && (old_master != curr_master)) { | 1895 | if (!curr_master && (old_master != curr_master)) { |
1896 | reset_gid_table(ibdev, port); | ||
1897 | mlx4_ib_set_default_gid(ibdev, | ||
1898 | curr_netdev, port); | ||
1899 | mlx4_ib_get_dev_addr(curr_netdev, ibdev, port); | ||
1900 | } | ||
1901 | } else { | ||
1811 | reset_gid_table(ibdev, port); | 1902 | reset_gid_table(ibdev, port); |
1812 | mlx4_ib_set_default_gid(ibdev, curr_netdev, port); | ||
1813 | mlx4_ib_get_dev_addr(curr_netdev, ibdev, port); | ||
1814 | } | 1903 | } |
1815 | } | 1904 | } |
1816 | 1905 | ||
1817 | spin_unlock(&iboe->lock); | 1906 | spin_unlock_bh(&iboe->lock); |
1818 | 1907 | ||
1819 | if (update_qps_port > 0) | 1908 | if (update_qps_port > 0) |
1820 | mlx4_ib_update_qps(ibdev, dev, update_qps_port); | 1909 | mlx4_ib_update_qps(ibdev, dev, update_qps_port); |
@@ -2156,6 +2245,9 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
2156 | goto err_steer_free_bitmap; | 2245 | goto err_steer_free_bitmap; |
2157 | } | 2246 | } |
2158 | 2247 | ||
2248 | for (j = 1; j <= ibdev->dev->caps.num_ports; j++) | ||
2249 | atomic64_set(&iboe->mac[j - 1], ibdev->dev->caps.def_mac[j]); | ||
2250 | |||
2159 | if (ib_register_device(&ibdev->ib_dev, NULL)) | 2251 | if (ib_register_device(&ibdev->ib_dev, NULL)) |
2160 | goto err_steer_free_bitmap; | 2252 | goto err_steer_free_bitmap; |
2161 | 2253 | ||
@@ -2192,12 +2284,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
2192 | } | 2284 | } |
2193 | } | 2285 | } |
2194 | #endif | 2286 | #endif |
2195 | for (i = 1 ; i <= ibdev->num_ports ; ++i) | 2287 | if (mlx4_ib_init_gid_table(ibdev)) |
2196 | reset_gid_table(ibdev, i); | 2288 | goto err_notif; |
2197 | rtnl_lock(); | ||
2198 | mlx4_ib_scan_netdevs(ibdev, NULL, 0); | ||
2199 | rtnl_unlock(); | ||
2200 | mlx4_ib_init_gid_table(ibdev); | ||
2201 | } | 2289 | } |
2202 | 2290 | ||
2203 | for (j = 0; j < ARRAY_SIZE(mlx4_class_attributes); ++j) { | 2291 | for (j = 0; j < ARRAY_SIZE(mlx4_class_attributes); ++j) { |
@@ -2345,6 +2433,9 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) | |||
2345 | struct mlx4_ib_dev *ibdev = ibdev_ptr; | 2433 | struct mlx4_ib_dev *ibdev = ibdev_ptr; |
2346 | int p; | 2434 | int p; |
2347 | 2435 | ||
2436 | ibdev->ib_active = false; | ||
2437 | flush_workqueue(wq); | ||
2438 | |||
2348 | mlx4_ib_close_sriov(ibdev); | 2439 | mlx4_ib_close_sriov(ibdev); |
2349 | mlx4_ib_mad_cleanup(ibdev); | 2440 | mlx4_ib_mad_cleanup(ibdev); |
2350 | ib_unregister_device(&ibdev->ib_dev); | 2441 | ib_unregister_device(&ibdev->ib_dev); |
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index e8cad3926bfc..6eb743f65f6f 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h | |||
@@ -451,6 +451,7 @@ struct mlx4_ib_iboe { | |||
451 | spinlock_t lock; | 451 | spinlock_t lock; |
452 | struct net_device *netdevs[MLX4_MAX_PORTS]; | 452 | struct net_device *netdevs[MLX4_MAX_PORTS]; |
453 | struct net_device *masters[MLX4_MAX_PORTS]; | 453 | struct net_device *masters[MLX4_MAX_PORTS]; |
454 | atomic64_t mac[MLX4_MAX_PORTS]; | ||
454 | struct notifier_block nb; | 455 | struct notifier_block nb; |
455 | struct notifier_block nb_inet; | 456 | struct notifier_block nb_inet; |
456 | struct notifier_block nb_inet6; | 457 | struct notifier_block nb_inet6; |
diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/mr.c index 9b0e80e59b08..8f9325cfc85d 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c | |||
@@ -234,14 +234,13 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags, | |||
234 | 0); | 234 | 0); |
235 | if (IS_ERR(mmr->umem)) { | 235 | if (IS_ERR(mmr->umem)) { |
236 | err = PTR_ERR(mmr->umem); | 236 | err = PTR_ERR(mmr->umem); |
237 | /* Prevent mlx4_ib_dereg_mr from free'ing invalid pointer */ | ||
237 | mmr->umem = NULL; | 238 | mmr->umem = NULL; |
238 | goto release_mpt_entry; | 239 | goto release_mpt_entry; |
239 | } | 240 | } |
240 | n = ib_umem_page_count(mmr->umem); | 241 | n = ib_umem_page_count(mmr->umem); |
241 | shift = ilog2(mmr->umem->page_size); | 242 | shift = ilog2(mmr->umem->page_size); |
242 | 243 | ||
243 | mmr->mmr.iova = virt_addr; | ||
244 | mmr->mmr.size = length; | ||
245 | err = mlx4_mr_rereg_mem_write(dev->dev, &mmr->mmr, | 244 | err = mlx4_mr_rereg_mem_write(dev->dev, &mmr->mmr, |
246 | virt_addr, length, n, shift, | 245 | virt_addr, length, n, shift, |
247 | *pmpt_entry); | 246 | *pmpt_entry); |
@@ -249,6 +248,8 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags, | |||
249 | ib_umem_release(mmr->umem); | 248 | ib_umem_release(mmr->umem); |
250 | goto release_mpt_entry; | 249 | goto release_mpt_entry; |
251 | } | 250 | } |
251 | mmr->mmr.iova = virt_addr; | ||
252 | mmr->mmr.size = length; | ||
252 | 253 | ||
253 | err = mlx4_ib_umem_write_mtt(dev, &mmr->mmr.mtt, mmr->umem); | 254 | err = mlx4_ib_umem_write_mtt(dev, &mmr->mmr.mtt, mmr->umem); |
254 | if (err) { | 255 | if (err) { |
@@ -262,6 +263,8 @@ int mlx4_ib_rereg_user_mr(struct ib_mr *mr, int flags, | |||
262 | * return a failure. But dereg_mr will free the resources. | 263 | * return a failure. But dereg_mr will free the resources. |
263 | */ | 264 | */ |
264 | err = mlx4_mr_hw_write_mpt(dev->dev, &mmr->mmr, pmpt_entry); | 265 | err = mlx4_mr_hw_write_mpt(dev->dev, &mmr->mmr, pmpt_entry); |
266 | if (!err && flags & IB_MR_REREG_ACCESS) | ||
267 | mmr->mmr.access = mr_access_flags; | ||
265 | 268 | ||
266 | release_mpt_entry: | 269 | release_mpt_entry: |
267 | mlx4_mr_hw_put_mpt(dev->dev, pmpt_entry); | 270 | mlx4_mr_hw_put_mpt(dev->dev, pmpt_entry); |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 67780452f0cf..9c5150c3cb31 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -964,9 +964,10 @@ static void destroy_qp_common(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, | |||
964 | MLX4_QP_STATE_RST, NULL, 0, 0, &qp->mqp)) | 964 | MLX4_QP_STATE_RST, NULL, 0, 0, &qp->mqp)) |
965 | pr_warn("modify QP %06x to RESET failed.\n", | 965 | pr_warn("modify QP %06x to RESET failed.\n", |
966 | qp->mqp.qpn); | 966 | qp->mqp.qpn); |
967 | if (qp->pri.smac) { | 967 | if (qp->pri.smac || (!qp->pri.smac && qp->pri.smac_port)) { |
968 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); | 968 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); |
969 | qp->pri.smac = 0; | 969 | qp->pri.smac = 0; |
970 | qp->pri.smac_port = 0; | ||
970 | } | 971 | } |
971 | if (qp->alt.smac) { | 972 | if (qp->alt.smac) { |
972 | mlx4_unregister_mac(dev->dev, qp->alt.smac_port, qp->alt.smac); | 973 | mlx4_unregister_mac(dev->dev, qp->alt.smac_port, qp->alt.smac); |
@@ -1325,7 +1326,8 @@ static int _mlx4_set_path(struct mlx4_ib_dev *dev, const struct ib_ah_attr *ah, | |||
1325 | * If one was already assigned, but the new mac differs, | 1326 | * If one was already assigned, but the new mac differs, |
1326 | * unregister the old one and register the new one. | 1327 | * unregister the old one and register the new one. |
1327 | */ | 1328 | */ |
1328 | if (!smac_info->smac || smac_info->smac != smac) { | 1329 | if ((!smac_info->smac && !smac_info->smac_port) || |
1330 | smac_info->smac != smac) { | ||
1329 | /* register candidate now, unreg if needed, after success */ | 1331 | /* register candidate now, unreg if needed, after success */ |
1330 | smac_index = mlx4_register_mac(dev->dev, port, smac); | 1332 | smac_index = mlx4_register_mac(dev->dev, port, smac); |
1331 | if (smac_index >= 0) { | 1333 | if (smac_index >= 0) { |
@@ -1390,21 +1392,13 @@ static void update_mcg_macs(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp) | |||
1390 | static int handle_eth_ud_smac_index(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, u8 *smac, | 1392 | static int handle_eth_ud_smac_index(struct mlx4_ib_dev *dev, struct mlx4_ib_qp *qp, u8 *smac, |
1391 | struct mlx4_qp_context *context) | 1393 | struct mlx4_qp_context *context) |
1392 | { | 1394 | { |
1393 | struct net_device *ndev; | ||
1394 | u64 u64_mac; | 1395 | u64 u64_mac; |
1395 | int smac_index; | 1396 | int smac_index; |
1396 | 1397 | ||
1397 | 1398 | u64_mac = atomic64_read(&dev->iboe.mac[qp->port - 1]); | |
1398 | ndev = dev->iboe.netdevs[qp->port - 1]; | ||
1399 | if (ndev) { | ||
1400 | smac = ndev->dev_addr; | ||
1401 | u64_mac = mlx4_mac_to_u64(smac); | ||
1402 | } else { | ||
1403 | u64_mac = dev->dev->caps.def_mac[qp->port]; | ||
1404 | } | ||
1405 | 1399 | ||
1406 | context->pri_path.sched_queue = MLX4_IB_DEFAULT_SCHED_QUEUE | ((qp->port - 1) << 6); | 1400 | context->pri_path.sched_queue = MLX4_IB_DEFAULT_SCHED_QUEUE | ((qp->port - 1) << 6); |
1407 | if (!qp->pri.smac) { | 1401 | if (!qp->pri.smac && !qp->pri.smac_port) { |
1408 | smac_index = mlx4_register_mac(dev->dev, qp->port, u64_mac); | 1402 | smac_index = mlx4_register_mac(dev->dev, qp->port, u64_mac); |
1409 | if (smac_index >= 0) { | 1403 | if (smac_index >= 0) { |
1410 | qp->pri.candidate_smac_index = smac_index; | 1404 | qp->pri.candidate_smac_index = smac_index; |
@@ -1432,6 +1426,12 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
1432 | int steer_qp = 0; | 1426 | int steer_qp = 0; |
1433 | int err = -EINVAL; | 1427 | int err = -EINVAL; |
1434 | 1428 | ||
1429 | /* APM is not supported under RoCE */ | ||
1430 | if (attr_mask & IB_QP_ALT_PATH && | ||
1431 | rdma_port_get_link_layer(&dev->ib_dev, qp->port) == | ||
1432 | IB_LINK_LAYER_ETHERNET) | ||
1433 | return -ENOTSUPP; | ||
1434 | |||
1435 | context = kzalloc(sizeof *context, GFP_KERNEL); | 1435 | context = kzalloc(sizeof *context, GFP_KERNEL); |
1436 | if (!context) | 1436 | if (!context) |
1437 | return -ENOMEM; | 1437 | return -ENOMEM; |
@@ -1677,9 +1677,15 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
1677 | } | 1677 | } |
1678 | } | 1678 | } |
1679 | 1679 | ||
1680 | if (qp->ibqp.qp_type == IB_QPT_RAW_PACKET) | 1680 | if (qp->ibqp.qp_type == IB_QPT_RAW_PACKET) { |
1681 | context->pri_path.ackto = (context->pri_path.ackto & 0xf8) | | 1681 | context->pri_path.ackto = (context->pri_path.ackto & 0xf8) | |
1682 | MLX4_IB_LINK_TYPE_ETH; | 1682 | MLX4_IB_LINK_TYPE_ETH; |
1683 | if (dev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { | ||
1684 | /* set QP to receive both tunneled & non-tunneled packets */ | ||
1685 | if (!(context->flags & cpu_to_be32(1 << MLX4_RSS_QPC_FLAG_OFFSET))) | ||
1686 | context->srqn = cpu_to_be32(7 << 28); | ||
1687 | } | ||
1688 | } | ||
1683 | 1689 | ||
1684 | if (ibqp->qp_type == IB_QPT_UD && (new_state == IB_QPS_RTR)) { | 1690 | if (ibqp->qp_type == IB_QPT_UD && (new_state == IB_QPS_RTR)) { |
1685 | int is_eth = rdma_port_get_link_layer( | 1691 | int is_eth = rdma_port_get_link_layer( |
@@ -1780,9 +1786,10 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, | |||
1780 | if (qp->flags & MLX4_IB_QP_NETIF) | 1786 | if (qp->flags & MLX4_IB_QP_NETIF) |
1781 | mlx4_ib_steer_qp_reg(dev, qp, 0); | 1787 | mlx4_ib_steer_qp_reg(dev, qp, 0); |
1782 | } | 1788 | } |
1783 | if (qp->pri.smac) { | 1789 | if (qp->pri.smac || (!qp->pri.smac && qp->pri.smac_port)) { |
1784 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); | 1790 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); |
1785 | qp->pri.smac = 0; | 1791 | qp->pri.smac = 0; |
1792 | qp->pri.smac_port = 0; | ||
1786 | } | 1793 | } |
1787 | if (qp->alt.smac) { | 1794 | if (qp->alt.smac) { |
1788 | mlx4_unregister_mac(dev->dev, qp->alt.smac_port, qp->alt.smac); | 1795 | mlx4_unregister_mac(dev->dev, qp->alt.smac_port, qp->alt.smac); |
@@ -1806,11 +1813,12 @@ out: | |||
1806 | if (err && steer_qp) | 1813 | if (err && steer_qp) |
1807 | mlx4_ib_steer_qp_reg(dev, qp, 0); | 1814 | mlx4_ib_steer_qp_reg(dev, qp, 0); |
1808 | kfree(context); | 1815 | kfree(context); |
1809 | if (qp->pri.candidate_smac) { | 1816 | if (qp->pri.candidate_smac || |
1817 | (!qp->pri.candidate_smac && qp->pri.candidate_smac_port)) { | ||
1810 | if (err) { | 1818 | if (err) { |
1811 | mlx4_unregister_mac(dev->dev, qp->pri.candidate_smac_port, qp->pri.candidate_smac); | 1819 | mlx4_unregister_mac(dev->dev, qp->pri.candidate_smac_port, qp->pri.candidate_smac); |
1812 | } else { | 1820 | } else { |
1813 | if (qp->pri.smac) | 1821 | if (qp->pri.smac || (!qp->pri.smac && qp->pri.smac_port)) |
1814 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); | 1822 | mlx4_unregister_mac(dev->dev, qp->pri.smac_port, qp->pri.smac); |
1815 | qp->pri.smac = qp->pri.candidate_smac; | 1823 | qp->pri.smac = qp->pri.candidate_smac; |
1816 | qp->pri.smac_index = qp->pri.candidate_smac_index; | 1824 | qp->pri.smac_index = qp->pri.candidate_smac_index; |
@@ -2083,6 +2091,16 @@ static int build_sriov_qp0_header(struct mlx4_ib_sqp *sqp, | |||
2083 | return 0; | 2091 | return 0; |
2084 | } | 2092 | } |
2085 | 2093 | ||
2094 | static void mlx4_u64_to_smac(u8 *dst_mac, u64 src_mac) | ||
2095 | { | ||
2096 | int i; | ||
2097 | |||
2098 | for (i = ETH_ALEN; i; i--) { | ||
2099 | dst_mac[i - 1] = src_mac & 0xff; | ||
2100 | src_mac >>= 8; | ||
2101 | } | ||
2102 | } | ||
2103 | |||
2086 | static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | 2104 | static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, |
2087 | void *wqe, unsigned *mlx_seg_len) | 2105 | void *wqe, unsigned *mlx_seg_len) |
2088 | { | 2106 | { |
@@ -2197,7 +2215,6 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | |||
2197 | } | 2215 | } |
2198 | 2216 | ||
2199 | if (is_eth) { | 2217 | if (is_eth) { |
2200 | u8 *smac; | ||
2201 | struct in6_addr in6; | 2218 | struct in6_addr in6; |
2202 | 2219 | ||
2203 | u16 pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 29) << 13; | 2220 | u16 pcp = (be32_to_cpu(ah->av.ib.sl_tclass_flowlabel) >> 29) << 13; |
@@ -2210,12 +2227,17 @@ static int build_mlx_header(struct mlx4_ib_sqp *sqp, struct ib_send_wr *wr, | |||
2210 | memcpy(&ctrl->imm, ah->av.eth.mac + 2, 4); | 2227 | memcpy(&ctrl->imm, ah->av.eth.mac + 2, 4); |
2211 | memcpy(&in6, sgid.raw, sizeof(in6)); | 2228 | memcpy(&in6, sgid.raw, sizeof(in6)); |
2212 | 2229 | ||
2213 | if (!mlx4_is_mfunc(to_mdev(ib_dev)->dev)) | 2230 | if (!mlx4_is_mfunc(to_mdev(ib_dev)->dev)) { |
2214 | smac = to_mdev(sqp->qp.ibqp.device)-> | 2231 | u64 mac = atomic64_read(&to_mdev(ib_dev)->iboe.mac[sqp->qp.port - 1]); |
2215 | iboe.netdevs[sqp->qp.port - 1]->dev_addr; | 2232 | u8 smac[ETH_ALEN]; |
2216 | else /* use the src mac of the tunnel */ | 2233 | |
2217 | smac = ah->av.eth.s_mac; | 2234 | mlx4_u64_to_smac(smac, mac); |
2218 | memcpy(sqp->ud_header.eth.smac_h, smac, 6); | 2235 | memcpy(sqp->ud_header.eth.smac_h, smac, ETH_ALEN); |
2236 | } else { | ||
2237 | /* use the src mac of the tunnel */ | ||
2238 | memcpy(sqp->ud_header.eth.smac_h, ah->av.eth.s_mac, ETH_ALEN); | ||
2239 | } | ||
2240 | |||
2219 | if (!memcmp(sqp->ud_header.eth.smac_h, sqp->ud_header.eth.dmac_h, 6)) | 2241 | if (!memcmp(sqp->ud_header.eth.smac_h, sqp->ud_header.eth.dmac_h, 6)) |
2220 | mlx->flags |= cpu_to_be32(MLX4_WQE_CTRL_FORCE_LOOPBACK); | 2242 | mlx->flags |= cpu_to_be32(MLX4_WQE_CTRL_FORCE_LOOPBACK); |
2221 | if (!is_vlan) { | 2243 | if (!is_vlan) { |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index 40f8536c10b0..ac02ce4e8040 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c | |||
@@ -38,7 +38,7 @@ | |||
38 | #define OCRDMA_VID_PCP_SHIFT 0xD | 38 | #define OCRDMA_VID_PCP_SHIFT 0xD |
39 | 39 | ||
40 | static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | 40 | static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, |
41 | struct ib_ah_attr *attr, int pdid) | 41 | struct ib_ah_attr *attr, union ib_gid *sgid, int pdid) |
42 | { | 42 | { |
43 | int status = 0; | 43 | int status = 0; |
44 | u16 vlan_tag; bool vlan_enabled = false; | 44 | u16 vlan_tag; bool vlan_enabled = false; |
@@ -49,8 +49,7 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
49 | memset(ð, 0, sizeof(eth)); | 49 | memset(ð, 0, sizeof(eth)); |
50 | memset(&grh, 0, sizeof(grh)); | 50 | memset(&grh, 0, sizeof(grh)); |
51 | 51 | ||
52 | ah->sgid_index = attr->grh.sgid_index; | 52 | /* VLAN */ |
53 | |||
54 | vlan_tag = attr->vlan_id; | 53 | vlan_tag = attr->vlan_id; |
55 | if (!vlan_tag || (vlan_tag > 0xFFF)) | 54 | if (!vlan_tag || (vlan_tag > 0xFFF)) |
56 | vlan_tag = dev->pvid; | 55 | vlan_tag = dev->pvid; |
@@ -65,15 +64,14 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
65 | eth.eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); | 64 | eth.eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); |
66 | eth_sz = sizeof(struct ocrdma_eth_basic); | 65 | eth_sz = sizeof(struct ocrdma_eth_basic); |
67 | } | 66 | } |
67 | /* MAC */ | ||
68 | memcpy(ð.smac[0], &dev->nic_info.mac_addr[0], ETH_ALEN); | 68 | memcpy(ð.smac[0], &dev->nic_info.mac_addr[0], ETH_ALEN); |
69 | memcpy(ð.dmac[0], attr->dmac, ETH_ALEN); | ||
70 | status = ocrdma_resolve_dmac(dev, attr, ð.dmac[0]); | 69 | status = ocrdma_resolve_dmac(dev, attr, ð.dmac[0]); |
71 | if (status) | 70 | if (status) |
72 | return status; | 71 | return status; |
73 | status = ocrdma_query_gid(&dev->ibdev, 1, attr->grh.sgid_index, | 72 | ah->sgid_index = attr->grh.sgid_index; |
74 | (union ib_gid *)&grh.sgid[0]); | 73 | memcpy(&grh.sgid[0], sgid->raw, sizeof(union ib_gid)); |
75 | if (status) | 74 | memcpy(&grh.dgid[0], attr->grh.dgid.raw, sizeof(attr->grh.dgid.raw)); |
76 | return status; | ||
77 | 75 | ||
78 | grh.tclass_flow = cpu_to_be32((6 << 28) | | 76 | grh.tclass_flow = cpu_to_be32((6 << 28) | |
79 | (attr->grh.traffic_class << 24) | | 77 | (attr->grh.traffic_class << 24) | |
@@ -81,8 +79,7 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
81 | /* 0x1b is next header value in GRH */ | 79 | /* 0x1b is next header value in GRH */ |
82 | grh.pdid_hoplimit = cpu_to_be32((pdid << 16) | | 80 | grh.pdid_hoplimit = cpu_to_be32((pdid << 16) | |
83 | (0x1b << 8) | attr->grh.hop_limit); | 81 | (0x1b << 8) | attr->grh.hop_limit); |
84 | 82 | /* Eth HDR */ | |
85 | memcpy(&grh.dgid[0], attr->grh.dgid.raw, sizeof(attr->grh.dgid.raw)); | ||
86 | memcpy(&ah->av->eth_hdr, ð, eth_sz); | 83 | memcpy(&ah->av->eth_hdr, ð, eth_sz); |
87 | memcpy((u8 *)ah->av + eth_sz, &grh, sizeof(struct ocrdma_grh)); | 84 | memcpy((u8 *)ah->av + eth_sz, &grh, sizeof(struct ocrdma_grh)); |
88 | if (vlan_enabled) | 85 | if (vlan_enabled) |
@@ -98,6 +95,8 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct ib_ah_attr *attr) | |||
98 | struct ocrdma_ah *ah; | 95 | struct ocrdma_ah *ah; |
99 | struct ocrdma_pd *pd = get_ocrdma_pd(ibpd); | 96 | struct ocrdma_pd *pd = get_ocrdma_pd(ibpd); |
100 | struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device); | 97 | struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device); |
98 | union ib_gid sgid; | ||
99 | u8 zmac[ETH_ALEN]; | ||
101 | 100 | ||
102 | if (!(attr->ah_flags & IB_AH_GRH)) | 101 | if (!(attr->ah_flags & IB_AH_GRH)) |
103 | return ERR_PTR(-EINVAL); | 102 | return ERR_PTR(-EINVAL); |
@@ -111,7 +110,27 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct ib_ah_attr *attr) | |||
111 | status = ocrdma_alloc_av(dev, ah); | 110 | status = ocrdma_alloc_av(dev, ah); |
112 | if (status) | 111 | if (status) |
113 | goto av_err; | 112 | goto av_err; |
114 | status = set_av_attr(dev, ah, attr, pd->id); | 113 | |
114 | status = ocrdma_query_gid(&dev->ibdev, 1, attr->grh.sgid_index, &sgid); | ||
115 | if (status) { | ||
116 | pr_err("%s(): Failed to query sgid, status = %d\n", | ||
117 | __func__, status); | ||
118 | goto av_conf_err; | ||
119 | } | ||
120 | |||
121 | memset(&zmac, 0, ETH_ALEN); | ||
122 | if (pd->uctx && | ||
123 | memcmp(attr->dmac, &zmac, ETH_ALEN)) { | ||
124 | status = rdma_addr_find_dmac_by_grh(&sgid, &attr->grh.dgid, | ||
125 | attr->dmac, &attr->vlan_id); | ||
126 | if (status) { | ||
127 | pr_err("%s(): Failed to resolve dmac from gid." | ||
128 | "status = %d\n", __func__, status); | ||
129 | goto av_conf_err; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | status = set_av_attr(dev, ah, attr, &sgid, pd->id); | ||
115 | if (status) | 134 | if (status) |
116 | goto av_conf_err; | 135 | goto av_conf_err; |
117 | 136 | ||
@@ -145,7 +164,7 @@ int ocrdma_query_ah(struct ib_ah *ibah, struct ib_ah_attr *attr) | |||
145 | struct ocrdma_av *av = ah->av; | 164 | struct ocrdma_av *av = ah->av; |
146 | struct ocrdma_grh *grh; | 165 | struct ocrdma_grh *grh; |
147 | attr->ah_flags |= IB_AH_GRH; | 166 | attr->ah_flags |= IB_AH_GRH; |
148 | if (ah->av->valid & Bit(1)) { | 167 | if (ah->av->valid & OCRDMA_AV_VALID) { |
149 | grh = (struct ocrdma_grh *)((u8 *)ah->av + | 168 | grh = (struct ocrdma_grh *)((u8 *)ah->av + |
150 | sizeof(struct ocrdma_eth_vlan)); | 169 | sizeof(struct ocrdma_eth_vlan)); |
151 | attr->sl = be16_to_cpu(av->eth_hdr.vlan_tag) >> 13; | 170 | attr->sl = be16_to_cpu(av->eth_hdr.vlan_tag) >> 13; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index acb434d16903..8f5f2577f288 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -101,7 +101,7 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr) | |||
101 | attr->max_srq_sge = dev->attr.max_srq_sge; | 101 | attr->max_srq_sge = dev->attr.max_srq_sge; |
102 | attr->max_srq_wr = dev->attr.max_rqe; | 102 | attr->max_srq_wr = dev->attr.max_rqe; |
103 | attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay; | 103 | attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay; |
104 | attr->max_fast_reg_page_list_len = 0; | 104 | attr->max_fast_reg_page_list_len = dev->attr.max_pages_per_frmr; |
105 | attr->max_pkeys = 1; | 105 | attr->max_pkeys = 1; |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
@@ -2846,11 +2846,9 @@ int ocrdma_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags cq_flags) | |||
2846 | if (cq->first_arm) { | 2846 | if (cq->first_arm) { |
2847 | ocrdma_ring_cq_db(dev, cq_id, arm_needed, sol_needed, 0); | 2847 | ocrdma_ring_cq_db(dev, cq_id, arm_needed, sol_needed, 0); |
2848 | cq->first_arm = false; | 2848 | cq->first_arm = false; |
2849 | goto skip_defer; | ||
2850 | } | 2849 | } |
2851 | cq->deferred_arm = true; | ||
2852 | 2850 | ||
2853 | skip_defer: | 2851 | cq->deferred_arm = true; |
2854 | cq->deferred_sol = sol_needed; | 2852 | cq->deferred_sol = sol_needed; |
2855 | spin_unlock_irqrestore(&cq->cq_lock, flags); | 2853 | spin_unlock_irqrestore(&cq->cq_lock, flags); |
2856 | 2854 | ||
diff --git a/drivers/infiniband/hw/qib/qib_debugfs.c b/drivers/infiniband/hw/qib/qib_debugfs.c index 799a0c3bffc4..6abd3ed3cd51 100644 --- a/drivers/infiniband/hw/qib/qib_debugfs.c +++ b/drivers/infiniband/hw/qib/qib_debugfs.c | |||
@@ -193,6 +193,7 @@ static void *_qp_stats_seq_start(struct seq_file *s, loff_t *pos) | |||
193 | struct qib_qp_iter *iter; | 193 | struct qib_qp_iter *iter; |
194 | loff_t n = *pos; | 194 | loff_t n = *pos; |
195 | 195 | ||
196 | rcu_read_lock(); | ||
196 | iter = qib_qp_iter_init(s->private); | 197 | iter = qib_qp_iter_init(s->private); |
197 | if (!iter) | 198 | if (!iter) |
198 | return NULL; | 199 | return NULL; |
@@ -224,7 +225,7 @@ static void *_qp_stats_seq_next(struct seq_file *s, void *iter_ptr, | |||
224 | 225 | ||
225 | static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) | 226 | static void _qp_stats_seq_stop(struct seq_file *s, void *iter_ptr) |
226 | { | 227 | { |
227 | /* nothing for now */ | 228 | rcu_read_unlock(); |
228 | } | 229 | } |
229 | 230 | ||
230 | static int _qp_stats_seq_show(struct seq_file *s, void *iter_ptr) | 231 | static int _qp_stats_seq_show(struct seq_file *s, void *iter_ptr) |
diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c index 7fcc150d603c..6ddc0264aad2 100644 --- a/drivers/infiniband/hw/qib/qib_qp.c +++ b/drivers/infiniband/hw/qib/qib_qp.c | |||
@@ -1325,7 +1325,6 @@ int qib_qp_iter_next(struct qib_qp_iter *iter) | |||
1325 | struct qib_qp *pqp = iter->qp; | 1325 | struct qib_qp *pqp = iter->qp; |
1326 | struct qib_qp *qp; | 1326 | struct qib_qp *qp; |
1327 | 1327 | ||
1328 | rcu_read_lock(); | ||
1329 | for (; n < dev->qp_table_size; n++) { | 1328 | for (; n < dev->qp_table_size; n++) { |
1330 | if (pqp) | 1329 | if (pqp) |
1331 | qp = rcu_dereference(pqp->next); | 1330 | qp = rcu_dereference(pqp->next); |
@@ -1333,18 +1332,11 @@ int qib_qp_iter_next(struct qib_qp_iter *iter) | |||
1333 | qp = rcu_dereference(dev->qp_table[n]); | 1332 | qp = rcu_dereference(dev->qp_table[n]); |
1334 | pqp = qp; | 1333 | pqp = qp; |
1335 | if (qp) { | 1334 | if (qp) { |
1336 | if (iter->qp) | ||
1337 | atomic_dec(&iter->qp->refcount); | ||
1338 | atomic_inc(&qp->refcount); | ||
1339 | rcu_read_unlock(); | ||
1340 | iter->qp = qp; | 1335 | iter->qp = qp; |
1341 | iter->n = n; | 1336 | iter->n = n; |
1342 | return 0; | 1337 | return 0; |
1343 | } | 1338 | } |
1344 | } | 1339 | } |
1345 | rcu_read_unlock(); | ||
1346 | if (iter->qp) | ||
1347 | atomic_dec(&iter->qp->refcount); | ||
1348 | return ret; | 1340 | return ret; |
1349 | } | 1341 | } |
1350 | 1342 | ||
diff --git a/drivers/infiniband/hw/qib/qib_user_pages.c b/drivers/infiniband/hw/qib/qib_user_pages.c index 2bc1d2b96298..74f90b2619f6 100644 --- a/drivers/infiniband/hw/qib/qib_user_pages.c +++ b/drivers/infiniband/hw/qib/qib_user_pages.c | |||
@@ -52,7 +52,7 @@ static void __qib_release_user_pages(struct page **p, size_t num_pages, | |||
52 | * Call with current->mm->mmap_sem held. | 52 | * Call with current->mm->mmap_sem held. |
53 | */ | 53 | */ |
54 | static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, | 54 | static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, |
55 | struct page **p, struct vm_area_struct **vma) | 55 | struct page **p) |
56 | { | 56 | { |
57 | unsigned long lock_limit; | 57 | unsigned long lock_limit; |
58 | size_t got; | 58 | size_t got; |
@@ -69,7 +69,7 @@ static int __qib_get_user_pages(unsigned long start_page, size_t num_pages, | |||
69 | ret = get_user_pages(current, current->mm, | 69 | ret = get_user_pages(current, current->mm, |
70 | start_page + got * PAGE_SIZE, | 70 | start_page + got * PAGE_SIZE, |
71 | num_pages - got, 1, 1, | 71 | num_pages - got, 1, 1, |
72 | p + got, vma); | 72 | p + got, NULL); |
73 | if (ret < 0) | 73 | if (ret < 0) |
74 | goto bail_release; | 74 | goto bail_release; |
75 | } | 75 | } |
@@ -136,7 +136,7 @@ int qib_get_user_pages(unsigned long start_page, size_t num_pages, | |||
136 | 136 | ||
137 | down_write(¤t->mm->mmap_sem); | 137 | down_write(¤t->mm->mmap_sem); |
138 | 138 | ||
139 | ret = __qib_get_user_pages(start_page, num_pages, p, NULL); | 139 | ret = __qib_get_user_pages(start_page, num_pages, p); |
140 | 140 | ||
141 | up_write(¤t->mm->mmap_sem); | 141 | up_write(¤t->mm->mmap_sem); |
142 | 142 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 3edce617c31b..d7562beb5423 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h | |||
@@ -131,6 +131,12 @@ struct ipoib_cb { | |||
131 | u8 hwaddr[INFINIBAND_ALEN]; | 131 | u8 hwaddr[INFINIBAND_ALEN]; |
132 | }; | 132 | }; |
133 | 133 | ||
134 | static inline struct ipoib_cb *ipoib_skb_cb(const struct sk_buff *skb) | ||
135 | { | ||
136 | BUILD_BUG_ON(sizeof(skb->cb) < sizeof(struct ipoib_cb)); | ||
137 | return (struct ipoib_cb *)skb->cb; | ||
138 | } | ||
139 | |||
134 | /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */ | 140 | /* Used for all multicast joins (broadcast, IPv4 mcast and IPv6 mcast) */ |
135 | struct ipoib_mcast { | 141 | struct ipoib_mcast { |
136 | struct ib_sa_mcmember_rec mcmember; | 142 | struct ib_sa_mcmember_rec mcmember; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 1310acf6bf92..13e6e0431592 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -716,7 +716,7 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
716 | { | 716 | { |
717 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 717 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
718 | struct ipoib_neigh *neigh; | 718 | struct ipoib_neigh *neigh; |
719 | struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb; | 719 | struct ipoib_cb *cb = ipoib_skb_cb(skb); |
720 | struct ipoib_header *header; | 720 | struct ipoib_header *header; |
721 | unsigned long flags; | 721 | unsigned long flags; |
722 | 722 | ||
@@ -813,7 +813,7 @@ static int ipoib_hard_header(struct sk_buff *skb, | |||
813 | const void *daddr, const void *saddr, unsigned len) | 813 | const void *daddr, const void *saddr, unsigned len) |
814 | { | 814 | { |
815 | struct ipoib_header *header; | 815 | struct ipoib_header *header; |
816 | struct ipoib_cb *cb = (struct ipoib_cb *) skb->cb; | 816 | struct ipoib_cb *cb = ipoib_skb_cb(skb); |
817 | 817 | ||
818 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); | 818 | header = (struct ipoib_header *) skb_push(skb, sizeof *header); |
819 | 819 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index d4e005720d01..ffb83b5f7e80 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -529,21 +529,13 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
529 | port_attr.state); | 529 | port_attr.state); |
530 | return; | 530 | return; |
531 | } | 531 | } |
532 | priv->local_lid = port_attr.lid; | ||
532 | 533 | ||
533 | if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid)) | 534 | if (ib_query_gid(priv->ca, priv->port, 0, &priv->local_gid)) |
534 | ipoib_warn(priv, "ib_query_gid() failed\n"); | 535 | ipoib_warn(priv, "ib_query_gid() failed\n"); |
535 | else | 536 | else |
536 | memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); | 537 | memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid)); |
537 | 538 | ||
538 | { | ||
539 | struct ib_port_attr attr; | ||
540 | |||
541 | if (!ib_query_port(priv->ca, priv->port, &attr)) | ||
542 | priv->local_lid = attr.lid; | ||
543 | else | ||
544 | ipoib_warn(priv, "ib_query_port failed\n"); | ||
545 | } | ||
546 | |||
547 | if (!priv->broadcast) { | 539 | if (!priv->broadcast) { |
548 | struct ipoib_mcast *broadcast; | 540 | struct ipoib_mcast *broadcast; |
549 | 541 | ||
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 61ee91d88380..93ce62fe1594 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -344,7 +344,6 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, | |||
344 | int is_leading) | 344 | int is_leading) |
345 | { | 345 | { |
346 | struct iscsi_conn *conn = cls_conn->dd_data; | 346 | struct iscsi_conn *conn = cls_conn->dd_data; |
347 | struct iscsi_session *session; | ||
348 | struct iser_conn *ib_conn; | 347 | struct iser_conn *ib_conn; |
349 | struct iscsi_endpoint *ep; | 348 | struct iscsi_endpoint *ep; |
350 | int error; | 349 | int error; |
@@ -363,9 +362,17 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, | |||
363 | } | 362 | } |
364 | ib_conn = ep->dd_data; | 363 | ib_conn = ep->dd_data; |
365 | 364 | ||
366 | session = conn->session; | 365 | mutex_lock(&ib_conn->state_mutex); |
367 | if (iser_alloc_rx_descriptors(ib_conn, session)) | 366 | if (ib_conn->state != ISER_CONN_UP) { |
368 | return -ENOMEM; | 367 | error = -EINVAL; |
368 | iser_err("iser_conn %p state is %d, teardown started\n", | ||
369 | ib_conn, ib_conn->state); | ||
370 | goto out; | ||
371 | } | ||
372 | |||
373 | error = iser_alloc_rx_descriptors(ib_conn, conn->session); | ||
374 | if (error) | ||
375 | goto out; | ||
369 | 376 | ||
370 | /* binds the iSER connection retrieved from the previously | 377 | /* binds the iSER connection retrieved from the previously |
371 | * connected ep_handle to the iSCSI layer connection. exchanges | 378 | * connected ep_handle to the iSCSI layer connection. exchanges |
@@ -375,7 +382,9 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, | |||
375 | conn->dd_data = ib_conn; | 382 | conn->dd_data = ib_conn; |
376 | ib_conn->iscsi_conn = conn; | 383 | ib_conn->iscsi_conn = conn; |
377 | 384 | ||
378 | return 0; | 385 | out: |
386 | mutex_unlock(&ib_conn->state_mutex); | ||
387 | return error; | ||
379 | } | 388 | } |
380 | 389 | ||
381 | static int | 390 | static int |
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h index c877dad381cb..9f0e0e34d6ca 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.h +++ b/drivers/infiniband/ulp/iser/iscsi_iser.h | |||
@@ -69,7 +69,7 @@ | |||
69 | 69 | ||
70 | #define DRV_NAME "iser" | 70 | #define DRV_NAME "iser" |
71 | #define PFX DRV_NAME ": " | 71 | #define PFX DRV_NAME ": " |
72 | #define DRV_VER "1.4" | 72 | #define DRV_VER "1.4.1" |
73 | 73 | ||
74 | #define iser_dbg(fmt, arg...) \ | 74 | #define iser_dbg(fmt, arg...) \ |
75 | do { \ | 75 | do { \ |
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c index 3ef167f97d6f..3bfec4bbda52 100644 --- a/drivers/infiniband/ulp/iser/iser_verbs.c +++ b/drivers/infiniband/ulp/iser/iser_verbs.c | |||
@@ -73,7 +73,7 @@ static int iser_create_device_ib_res(struct iser_device *device) | |||
73 | { | 73 | { |
74 | struct iser_cq_desc *cq_desc; | 74 | struct iser_cq_desc *cq_desc; |
75 | struct ib_device_attr *dev_attr = &device->dev_attr; | 75 | struct ib_device_attr *dev_attr = &device->dev_attr; |
76 | int ret, i, j; | 76 | int ret, i; |
77 | 77 | ||
78 | ret = ib_query_device(device->ib_device, dev_attr); | 78 | ret = ib_query_device(device->ib_device, dev_attr); |
79 | if (ret) { | 79 | if (ret) { |
@@ -125,16 +125,20 @@ static int iser_create_device_ib_res(struct iser_device *device) | |||
125 | iser_cq_event_callback, | 125 | iser_cq_event_callback, |
126 | (void *)&cq_desc[i], | 126 | (void *)&cq_desc[i], |
127 | ISER_MAX_RX_CQ_LEN, i); | 127 | ISER_MAX_RX_CQ_LEN, i); |
128 | if (IS_ERR(device->rx_cq[i])) | 128 | if (IS_ERR(device->rx_cq[i])) { |
129 | device->rx_cq[i] = NULL; | ||
129 | goto cq_err; | 130 | goto cq_err; |
131 | } | ||
130 | 132 | ||
131 | device->tx_cq[i] = ib_create_cq(device->ib_device, | 133 | device->tx_cq[i] = ib_create_cq(device->ib_device, |
132 | NULL, iser_cq_event_callback, | 134 | NULL, iser_cq_event_callback, |
133 | (void *)&cq_desc[i], | 135 | (void *)&cq_desc[i], |
134 | ISER_MAX_TX_CQ_LEN, i); | 136 | ISER_MAX_TX_CQ_LEN, i); |
135 | 137 | ||
136 | if (IS_ERR(device->tx_cq[i])) | 138 | if (IS_ERR(device->tx_cq[i])) { |
139 | device->tx_cq[i] = NULL; | ||
137 | goto cq_err; | 140 | goto cq_err; |
141 | } | ||
138 | 142 | ||
139 | if (ib_req_notify_cq(device->rx_cq[i], IB_CQ_NEXT_COMP)) | 143 | if (ib_req_notify_cq(device->rx_cq[i], IB_CQ_NEXT_COMP)) |
140 | goto cq_err; | 144 | goto cq_err; |
@@ -160,14 +164,14 @@ static int iser_create_device_ib_res(struct iser_device *device) | |||
160 | handler_err: | 164 | handler_err: |
161 | ib_dereg_mr(device->mr); | 165 | ib_dereg_mr(device->mr); |
162 | dma_mr_err: | 166 | dma_mr_err: |
163 | for (j = 0; j < device->cqs_used; j++) | 167 | for (i = 0; i < device->cqs_used; i++) |
164 | tasklet_kill(&device->cq_tasklet[j]); | 168 | tasklet_kill(&device->cq_tasklet[i]); |
165 | cq_err: | 169 | cq_err: |
166 | for (j = 0; j < i; j++) { | 170 | for (i = 0; i < device->cqs_used; i++) { |
167 | if (device->tx_cq[j]) | 171 | if (device->tx_cq[i]) |
168 | ib_destroy_cq(device->tx_cq[j]); | 172 | ib_destroy_cq(device->tx_cq[i]); |
169 | if (device->rx_cq[j]) | 173 | if (device->rx_cq[i]) |
170 | ib_destroy_cq(device->rx_cq[j]); | 174 | ib_destroy_cq(device->rx_cq[i]); |
171 | } | 175 | } |
172 | ib_dealloc_pd(device->pd); | 176 | ib_dealloc_pd(device->pd); |
173 | pd_err: | 177 | pd_err: |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index d4c7928a0f36..da8ff124762a 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -586,17 +586,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
586 | init_completion(&isert_conn->conn_wait); | 586 | init_completion(&isert_conn->conn_wait); |
587 | init_completion(&isert_conn->conn_wait_comp_err); | 587 | init_completion(&isert_conn->conn_wait_comp_err); |
588 | kref_init(&isert_conn->conn_kref); | 588 | kref_init(&isert_conn->conn_kref); |
589 | kref_get(&isert_conn->conn_kref); | ||
590 | mutex_init(&isert_conn->conn_mutex); | 589 | mutex_init(&isert_conn->conn_mutex); |
591 | spin_lock_init(&isert_conn->conn_lock); | 590 | spin_lock_init(&isert_conn->conn_lock); |
592 | INIT_LIST_HEAD(&isert_conn->conn_fr_pool); | 591 | INIT_LIST_HEAD(&isert_conn->conn_fr_pool); |
593 | 592 | ||
594 | cma_id->context = isert_conn; | 593 | cma_id->context = isert_conn; |
595 | isert_conn->conn_cm_id = cma_id; | 594 | isert_conn->conn_cm_id = cma_id; |
596 | isert_conn->responder_resources = event->param.conn.responder_resources; | ||
597 | isert_conn->initiator_depth = event->param.conn.initiator_depth; | ||
598 | pr_debug("Using responder_resources: %u initiator_depth: %u\n", | ||
599 | isert_conn->responder_resources, isert_conn->initiator_depth); | ||
600 | 595 | ||
601 | isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + | 596 | isert_conn->login_buf = kzalloc(ISCSI_DEF_MAX_RECV_SEG_LEN + |
602 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); | 597 | ISER_RX_LOGIN_SIZE, GFP_KERNEL); |
@@ -643,6 +638,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
643 | goto out_rsp_dma_map; | 638 | goto out_rsp_dma_map; |
644 | } | 639 | } |
645 | 640 | ||
641 | /* Set max inflight RDMA READ requests */ | ||
642 | isert_conn->initiator_depth = min_t(u8, | ||
643 | event->param.conn.initiator_depth, | ||
644 | device->dev_attr.max_qp_init_rd_atom); | ||
645 | pr_debug("Using initiator_depth: %u\n", isert_conn->initiator_depth); | ||
646 | |||
646 | isert_conn->conn_device = device; | 647 | isert_conn->conn_device = device; |
647 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); | 648 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); |
648 | if (IS_ERR(isert_conn->conn_pd)) { | 649 | if (IS_ERR(isert_conn->conn_pd)) { |
@@ -746,7 +747,9 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
746 | static void | 747 | static void |
747 | isert_connected_handler(struct rdma_cm_id *cma_id) | 748 | isert_connected_handler(struct rdma_cm_id *cma_id) |
748 | { | 749 | { |
749 | return; | 750 | struct isert_conn *isert_conn = cma_id->context; |
751 | |||
752 | kref_get(&isert_conn->conn_kref); | ||
750 | } | 753 | } |
751 | 754 | ||
752 | static void | 755 | static void |
@@ -798,7 +801,6 @@ isert_disconnect_work(struct work_struct *work) | |||
798 | 801 | ||
799 | wake_up: | 802 | wake_up: |
800 | complete(&isert_conn->conn_wait); | 803 | complete(&isert_conn->conn_wait); |
801 | isert_put_conn(isert_conn); | ||
802 | } | 804 | } |
803 | 805 | ||
804 | static void | 806 | static void |
@@ -3067,7 +3069,6 @@ isert_rdma_accept(struct isert_conn *isert_conn) | |||
3067 | int ret; | 3069 | int ret; |
3068 | 3070 | ||
3069 | memset(&cp, 0, sizeof(struct rdma_conn_param)); | 3071 | memset(&cp, 0, sizeof(struct rdma_conn_param)); |
3070 | cp.responder_resources = isert_conn->responder_resources; | ||
3071 | cp.initiator_depth = isert_conn->initiator_depth; | 3072 | cp.initiator_depth = isert_conn->initiator_depth; |
3072 | cp.retry_count = 7; | 3073 | cp.retry_count = 7; |
3073 | cp.rnr_retry_count = 7; | 3074 | cp.rnr_retry_count = 7; |
@@ -3215,7 +3216,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
3215 | pr_debug("isert_wait_conn: Starting \n"); | 3216 | pr_debug("isert_wait_conn: Starting \n"); |
3216 | 3217 | ||
3217 | mutex_lock(&isert_conn->conn_mutex); | 3218 | mutex_lock(&isert_conn->conn_mutex); |
3218 | if (isert_conn->conn_cm_id) { | 3219 | if (isert_conn->conn_cm_id && !isert_conn->disconnect) { |
3219 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); | 3220 | pr_debug("Calling rdma_disconnect from isert_wait_conn\n"); |
3220 | rdma_disconnect(isert_conn->conn_cm_id); | 3221 | rdma_disconnect(isert_conn->conn_cm_id); |
3221 | } | 3222 | } |
@@ -3234,6 +3235,7 @@ static void isert_wait_conn(struct iscsi_conn *conn) | |||
3234 | wait_for_completion(&isert_conn->conn_wait_comp_err); | 3235 | wait_for_completion(&isert_conn->conn_wait_comp_err); |
3235 | 3236 | ||
3236 | wait_for_completion(&isert_conn->conn_wait); | 3237 | wait_for_completion(&isert_conn->conn_wait); |
3238 | isert_put_conn(isert_conn); | ||
3237 | } | 3239 | } |
3238 | 3240 | ||
3239 | static void isert_free_conn(struct iscsi_conn *conn) | 3241 | static void isert_free_conn(struct iscsi_conn *conn) |
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index c30204f2fa30..fbe29fcb15c5 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c | |||
@@ -236,6 +236,18 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) | |||
236 | } | 236 | } |
237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); | 237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); |
238 | 238 | ||
239 | static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt) | ||
240 | { | ||
241 | int i; | ||
242 | |||
243 | for (i = 0; i < mt->num_slots; i++) { | ||
244 | if (!input_mt_is_used(mt, &mt->slots[i])) { | ||
245 | input_mt_slot(dev, i); | ||
246 | input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | |||
239 | /** | 251 | /** |
240 | * input_mt_drop_unused() - Inactivate slots not seen in this frame | 252 | * input_mt_drop_unused() - Inactivate slots not seen in this frame |
241 | * @dev: input device with allocated MT slots | 253 | * @dev: input device with allocated MT slots |
@@ -245,19 +257,11 @@ EXPORT_SYMBOL(input_mt_report_pointer_emulation); | |||
245 | void input_mt_drop_unused(struct input_dev *dev) | 257 | void input_mt_drop_unused(struct input_dev *dev) |
246 | { | 258 | { |
247 | struct input_mt *mt = dev->mt; | 259 | struct input_mt *mt = dev->mt; |
248 | int i; | ||
249 | 260 | ||
250 | if (!mt) | 261 | if (mt) { |
251 | return; | 262 | __input_mt_drop_unused(dev, mt); |
252 | 263 | mt->frame++; | |
253 | for (i = 0; i < mt->num_slots; i++) { | ||
254 | if (!input_mt_is_used(mt, &mt->slots[i])) { | ||
255 | input_mt_slot(dev, i); | ||
256 | input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | ||
257 | } | ||
258 | } | 264 | } |
259 | |||
260 | mt->frame++; | ||
261 | } | 265 | } |
262 | EXPORT_SYMBOL(input_mt_drop_unused); | 266 | EXPORT_SYMBOL(input_mt_drop_unused); |
263 | 267 | ||
@@ -278,12 +282,14 @@ void input_mt_sync_frame(struct input_dev *dev) | |||
278 | return; | 282 | return; |
279 | 283 | ||
280 | if (mt->flags & INPUT_MT_DROP_UNUSED) | 284 | if (mt->flags & INPUT_MT_DROP_UNUSED) |
281 | input_mt_drop_unused(dev); | 285 | __input_mt_drop_unused(dev, mt); |
282 | 286 | ||
283 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) | 287 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) |
284 | use_count = true; | 288 | use_count = true; |
285 | 289 | ||
286 | input_mt_report_pointer_emulation(dev, use_count); | 290 | input_mt_report_pointer_emulation(dev, use_count); |
291 | |||
292 | mt->frame++; | ||
287 | } | 293 | } |
288 | EXPORT_SYMBOL(input_mt_sync_frame); | 294 | EXPORT_SYMBOL(input_mt_sync_frame); |
289 | 295 | ||
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 2dd1d0dd4f7d..6f5d79569136 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -1791,14 +1791,6 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { | |||
1791 | { | 1791 | { |
1792 | .matches = { | 1792 | .matches = { |
1793 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), | 1793 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), |
1794 | DMI_MATCH(DMI_PRODUCT_NAME, "LW25-B7HV"), | ||
1795 | }, | ||
1796 | .callback = atkbd_deactivate_fixup, | ||
1797 | }, | ||
1798 | { | ||
1799 | .matches = { | ||
1800 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), | ||
1801 | DMI_MATCH(DMI_PRODUCT_NAME, "P1-J273B"), | ||
1802 | }, | 1794 | }, |
1803 | .callback = atkbd_deactivate_fixup, | 1795 | .callback = atkbd_deactivate_fixup, |
1804 | }, | 1796 | }, |
diff --git a/drivers/input/keyboard/cap1106.c b/drivers/input/keyboard/cap1106.c index 180b184ab90f..d70b65a14ced 100644 --- a/drivers/input/keyboard/cap1106.c +++ b/drivers/input/keyboard/cap1106.c | |||
@@ -33,8 +33,8 @@ | |||
33 | #define CAP1106_REG_SENSOR_CONFIG 0x22 | 33 | #define CAP1106_REG_SENSOR_CONFIG 0x22 |
34 | #define CAP1106_REG_SENSOR_CONFIG2 0x23 | 34 | #define CAP1106_REG_SENSOR_CONFIG2 0x23 |
35 | #define CAP1106_REG_SAMPLING_CONFIG 0x24 | 35 | #define CAP1106_REG_SAMPLING_CONFIG 0x24 |
36 | #define CAP1106_REG_CALIBRATION 0x25 | 36 | #define CAP1106_REG_CALIBRATION 0x26 |
37 | #define CAP1106_REG_INT_ENABLE 0x26 | 37 | #define CAP1106_REG_INT_ENABLE 0x27 |
38 | #define CAP1106_REG_REPEAT_RATE 0x28 | 38 | #define CAP1106_REG_REPEAT_RATE 0x28 |
39 | #define CAP1106_REG_MT_CONFIG 0x2a | 39 | #define CAP1106_REG_MT_CONFIG 0x2a |
40 | #define CAP1106_REG_MT_PATTERN_CONFIG 0x2b | 40 | #define CAP1106_REG_MT_PATTERN_CONFIG 0x2b |
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 8d2e19e81e1e..e651fa692afe 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -332,23 +332,24 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev, | |||
332 | } | 332 | } |
333 | 333 | ||
334 | if (pdata->clustered_irq > 0) { | 334 | if (pdata->clustered_irq > 0) { |
335 | err = request_irq(pdata->clustered_irq, | 335 | err = request_any_context_irq(pdata->clustered_irq, |
336 | matrix_keypad_interrupt, | 336 | matrix_keypad_interrupt, |
337 | pdata->clustered_irq_flags, | 337 | pdata->clustered_irq_flags, |
338 | "matrix-keypad", keypad); | 338 | "matrix-keypad", keypad); |
339 | if (err) { | 339 | if (err < 0) { |
340 | dev_err(&pdev->dev, | 340 | dev_err(&pdev->dev, |
341 | "Unable to acquire clustered interrupt\n"); | 341 | "Unable to acquire clustered interrupt\n"); |
342 | goto err_free_rows; | 342 | goto err_free_rows; |
343 | } | 343 | } |
344 | } else { | 344 | } else { |
345 | for (i = 0; i < pdata->num_row_gpios; i++) { | 345 | for (i = 0; i < pdata->num_row_gpios; i++) { |
346 | err = request_irq(gpio_to_irq(pdata->row_gpios[i]), | 346 | err = request_any_context_irq( |
347 | gpio_to_irq(pdata->row_gpios[i]), | ||
347 | matrix_keypad_interrupt, | 348 | matrix_keypad_interrupt, |
348 | IRQF_TRIGGER_RISING | | 349 | IRQF_TRIGGER_RISING | |
349 | IRQF_TRIGGER_FALLING, | 350 | IRQF_TRIGGER_FALLING, |
350 | "matrix-keypad", keypad); | 351 | "matrix-keypad", keypad); |
351 | if (err) { | 352 | if (err < 0) { |
352 | dev_err(&pdev->dev, | 353 | dev_err(&pdev->dev, |
353 | "Unable to acquire interrupt for GPIO line %i\n", | 354 | "Unable to acquire interrupt for GPIO line %i\n", |
354 | pdata->row_gpios[i]); | 355 | pdata->row_gpios[i]); |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index a59a1a64b674..35a49bf57227 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -2234,8 +2234,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv) | |||
2234 | return 0; | 2234 | return 0; |
2235 | } | 2235 | } |
2236 | 2236 | ||
2237 | psmouse_info(psmouse, | 2237 | psmouse_dbg(psmouse, |
2238 | "Unknown ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); | 2238 | "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec); |
2239 | 2239 | ||
2240 | return -EINVAL; | 2240 | return -EINVAL; |
2241 | } | 2241 | } |
@@ -2373,6 +2373,10 @@ int alps_init(struct psmouse *psmouse) | |||
2373 | dev2->keybit[BIT_WORD(BTN_LEFT)] = | 2373 | dev2->keybit[BIT_WORD(BTN_LEFT)] = |
2374 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 2374 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); |
2375 | 2375 | ||
2376 | __set_bit(INPUT_PROP_POINTER, dev2->propbit); | ||
2377 | if (priv->flags & ALPS_DUALPOINT) | ||
2378 | __set_bit(INPUT_PROP_POINTING_STICK, dev2->propbit); | ||
2379 | |||
2376 | if (input_register_device(priv->dev2)) | 2380 | if (input_register_device(priv->dev2)) |
2377 | goto init_fail; | 2381 | goto init_fail; |
2378 | 2382 | ||
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index ee2a04d90d20..06fc6e76ffbe 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/input/mt.h> | 18 | #include <linux/input/mt.h> |
19 | #include <linux/serio.h> | 19 | #include <linux/serio.h> |
20 | #include <linux/libps2.h> | 20 | #include <linux/libps2.h> |
21 | #include <asm/unaligned.h> | ||
21 | #include "psmouse.h" | 22 | #include "psmouse.h" |
22 | #include "elantech.h" | 23 | #include "elantech.h" |
23 | 24 | ||
@@ -403,6 +404,68 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse) | |||
403 | input_sync(dev); | 404 | input_sync(dev); |
404 | } | 405 | } |
405 | 406 | ||
407 | static void elantech_report_trackpoint(struct psmouse *psmouse, | ||
408 | int packet_type) | ||
409 | { | ||
410 | /* | ||
411 | * byte 0: 0 0 sx sy 0 M R L | ||
412 | * byte 1:~sx 0 0 0 0 0 0 0 | ||
413 | * byte 2:~sy 0 0 0 0 0 0 0 | ||
414 | * byte 3: 0 0 ~sy ~sx 0 1 1 0 | ||
415 | * byte 4: x7 x6 x5 x4 x3 x2 x1 x0 | ||
416 | * byte 5: y7 y6 y5 y4 y3 y2 y1 y0 | ||
417 | * | ||
418 | * x and y are written in two's complement spread | ||
419 | * over 9 bits with sx/sy the relative top bit and | ||
420 | * x7..x0 and y7..y0 the lower bits. | ||
421 | * The sign of y is opposite to what the input driver | ||
422 | * expects for a relative movement | ||
423 | */ | ||
424 | |||
425 | struct elantech_data *etd = psmouse->private; | ||
426 | struct input_dev *tp_dev = etd->tp_dev; | ||
427 | unsigned char *packet = psmouse->packet; | ||
428 | int x, y; | ||
429 | u32 t; | ||
430 | |||
431 | if (dev_WARN_ONCE(&psmouse->ps2dev.serio->dev, | ||
432 | !tp_dev, | ||
433 | psmouse_fmt("Unexpected trackpoint message\n"))) { | ||
434 | if (etd->debug == 1) | ||
435 | elantech_packet_dump(psmouse); | ||
436 | return; | ||
437 | } | ||
438 | |||
439 | t = get_unaligned_le32(&packet[0]); | ||
440 | |||
441 | switch (t & ~7U) { | ||
442 | case 0x06000030U: | ||
443 | case 0x16008020U: | ||
444 | case 0x26800010U: | ||
445 | case 0x36808000U: | ||
446 | x = packet[4] - (int)((packet[1]^0x80) << 1); | ||
447 | y = (int)((packet[2]^0x80) << 1) - packet[5]; | ||
448 | |||
449 | input_report_key(tp_dev, BTN_LEFT, packet[0] & 0x01); | ||
450 | input_report_key(tp_dev, BTN_RIGHT, packet[0] & 0x02); | ||
451 | input_report_key(tp_dev, BTN_MIDDLE, packet[0] & 0x04); | ||
452 | |||
453 | input_report_rel(tp_dev, REL_X, x); | ||
454 | input_report_rel(tp_dev, REL_Y, y); | ||
455 | |||
456 | input_sync(tp_dev); | ||
457 | |||
458 | break; | ||
459 | |||
460 | default: | ||
461 | /* Dump unexpected packet sequences if debug=1 (default) */ | ||
462 | if (etd->debug == 1) | ||
463 | elantech_packet_dump(psmouse); | ||
464 | |||
465 | break; | ||
466 | } | ||
467 | } | ||
468 | |||
406 | /* | 469 | /* |
407 | * Interpret complete data packets and report absolute mode input events for | 470 | * Interpret complete data packets and report absolute mode input events for |
408 | * hardware version 3. (12 byte packets for two fingers) | 471 | * hardware version 3. (12 byte packets for two fingers) |
@@ -715,6 +778,8 @@ static int elantech_packet_check_v3(struct psmouse *psmouse) | |||
715 | 778 | ||
716 | if ((packet[0] & 0x0c) == 0x0c && (packet[3] & 0xce) == 0x0c) | 779 | if ((packet[0] & 0x0c) == 0x0c && (packet[3] & 0xce) == 0x0c) |
717 | return PACKET_V3_TAIL; | 780 | return PACKET_V3_TAIL; |
781 | if ((packet[3] & 0x0f) == 0x06) | ||
782 | return PACKET_TRACKPOINT; | ||
718 | } | 783 | } |
719 | 784 | ||
720 | return PACKET_UNKNOWN; | 785 | return PACKET_UNKNOWN; |
@@ -791,14 +856,23 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse) | |||
791 | 856 | ||
792 | case 3: | 857 | case 3: |
793 | packet_type = elantech_packet_check_v3(psmouse); | 858 | packet_type = elantech_packet_check_v3(psmouse); |
794 | /* ignore debounce */ | 859 | switch (packet_type) { |
795 | if (packet_type == PACKET_DEBOUNCE) | 860 | case PACKET_UNKNOWN: |
796 | return PSMOUSE_FULL_PACKET; | ||
797 | |||
798 | if (packet_type == PACKET_UNKNOWN) | ||
799 | return PSMOUSE_BAD_DATA; | 861 | return PSMOUSE_BAD_DATA; |
800 | 862 | ||
801 | elantech_report_absolute_v3(psmouse, packet_type); | 863 | case PACKET_DEBOUNCE: |
864 | /* ignore debounce */ | ||
865 | break; | ||
866 | |||
867 | case PACKET_TRACKPOINT: | ||
868 | elantech_report_trackpoint(psmouse, packet_type); | ||
869 | break; | ||
870 | |||
871 | default: | ||
872 | elantech_report_absolute_v3(psmouse, packet_type); | ||
873 | break; | ||
874 | } | ||
875 | |||
802 | break; | 876 | break; |
803 | 877 | ||
804 | case 4: | 878 | case 4: |
@@ -1018,8 +1092,10 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, | |||
1018 | * Asus UX31 0x361f00 20, 15, 0e clickpad | 1092 | * Asus UX31 0x361f00 20, 15, 0e clickpad |
1019 | * Asus UX32VD 0x361f02 00, 15, 0e clickpad | 1093 | * Asus UX32VD 0x361f02 00, 15, 0e clickpad |
1020 | * Avatar AVIU-145A2 0x361f00 ? clickpad | 1094 | * Avatar AVIU-145A2 0x361f00 ? clickpad |
1095 | * Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**) | ||
1021 | * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons | 1096 | * Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons |
1022 | * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) | 1097 | * Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*) |
1098 | * Lenovo L530 0x350f02 b9, 15, 0c 2 hw buttons (*) | ||
1023 | * Samsung NF210 0x150b00 78, 14, 0a 2 hw buttons | 1099 | * Samsung NF210 0x150b00 78, 14, 0a 2 hw buttons |
1024 | * Samsung NP770Z5E 0x575f01 10, 15, 0f clickpad | 1100 | * Samsung NP770Z5E 0x575f01 10, 15, 0f clickpad |
1025 | * Samsung NP700Z5B 0x361f06 21, 15, 0f clickpad | 1101 | * Samsung NP700Z5B 0x361f06 21, 15, 0f clickpad |
@@ -1029,6 +1105,8 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse, | |||
1029 | * Samsung RF710 0x450f00 ? 2 hw buttons | 1105 | * Samsung RF710 0x450f00 ? 2 hw buttons |
1030 | * System76 Pangolin 0x250f01 ? 2 hw buttons | 1106 | * System76 Pangolin 0x250f01 ? 2 hw buttons |
1031 | * (*) + 3 trackpoint buttons | 1107 | * (*) + 3 trackpoint buttons |
1108 | * (**) + 0 trackpoint buttons | ||
1109 | * Note: Lenovo L430 and Lenovo L430 have the same fw_version/caps | ||
1032 | */ | 1110 | */ |
1033 | static void elantech_set_buttonpad_prop(struct psmouse *psmouse) | 1111 | static void elantech_set_buttonpad_prop(struct psmouse *psmouse) |
1034 | { | 1112 | { |
@@ -1253,6 +1331,13 @@ static bool elantech_is_signature_valid(const unsigned char *param) | |||
1253 | if (param[1] == 0) | 1331 | if (param[1] == 0) |
1254 | return true; | 1332 | return true; |
1255 | 1333 | ||
1334 | /* | ||
1335 | * Some models have a revision higher then 20. Meaning param[2] may | ||
1336 | * be 10 or 20, skip the rates check for these. | ||
1337 | */ | ||
1338 | if (param[0] == 0x46 && (param[1] & 0xef) == 0x0f && param[2] < 40) | ||
1339 | return true; | ||
1340 | |||
1256 | for (i = 0; i < ARRAY_SIZE(rates); i++) | 1341 | for (i = 0; i < ARRAY_SIZE(rates); i++) |
1257 | if (param[2] == rates[i]) | 1342 | if (param[2] == rates[i]) |
1258 | return false; | 1343 | return false; |
@@ -1324,6 +1409,10 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties) | |||
1324 | */ | 1409 | */ |
1325 | static void elantech_disconnect(struct psmouse *psmouse) | 1410 | static void elantech_disconnect(struct psmouse *psmouse) |
1326 | { | 1411 | { |
1412 | struct elantech_data *etd = psmouse->private; | ||
1413 | |||
1414 | if (etd->tp_dev) | ||
1415 | input_unregister_device(etd->tp_dev); | ||
1327 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, | 1416 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, |
1328 | &elantech_attr_group); | 1417 | &elantech_attr_group); |
1329 | kfree(psmouse->private); | 1418 | kfree(psmouse->private); |
@@ -1438,8 +1527,10 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1438 | int elantech_init(struct psmouse *psmouse) | 1527 | int elantech_init(struct psmouse *psmouse) |
1439 | { | 1528 | { |
1440 | struct elantech_data *etd; | 1529 | struct elantech_data *etd; |
1441 | int i, error; | 1530 | int i; |
1531 | int error = -EINVAL; | ||
1442 | unsigned char param[3]; | 1532 | unsigned char param[3]; |
1533 | struct input_dev *tp_dev; | ||
1443 | 1534 | ||
1444 | psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); | 1535 | psmouse->private = etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL); |
1445 | if (!etd) | 1536 | if (!etd) |
@@ -1498,14 +1589,53 @@ int elantech_init(struct psmouse *psmouse) | |||
1498 | goto init_fail; | 1589 | goto init_fail; |
1499 | } | 1590 | } |
1500 | 1591 | ||
1592 | /* The MSB indicates the presence of the trackpoint */ | ||
1593 | if ((etd->capabilities[0] & 0x80) == 0x80) { | ||
1594 | tp_dev = input_allocate_device(); | ||
1595 | |||
1596 | if (!tp_dev) { | ||
1597 | error = -ENOMEM; | ||
1598 | goto init_fail_tp_alloc; | ||
1599 | } | ||
1600 | |||
1601 | etd->tp_dev = tp_dev; | ||
1602 | snprintf(etd->tp_phys, sizeof(etd->tp_phys), "%s/input1", | ||
1603 | psmouse->ps2dev.serio->phys); | ||
1604 | tp_dev->phys = etd->tp_phys; | ||
1605 | tp_dev->name = "Elantech PS/2 TrackPoint"; | ||
1606 | tp_dev->id.bustype = BUS_I8042; | ||
1607 | tp_dev->id.vendor = 0x0002; | ||
1608 | tp_dev->id.product = PSMOUSE_ELANTECH; | ||
1609 | tp_dev->id.version = 0x0000; | ||
1610 | tp_dev->dev.parent = &psmouse->ps2dev.serio->dev; | ||
1611 | tp_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | ||
1612 | tp_dev->relbit[BIT_WORD(REL_X)] = | ||
1613 | BIT_MASK(REL_X) | BIT_MASK(REL_Y); | ||
1614 | tp_dev->keybit[BIT_WORD(BTN_LEFT)] = | ||
1615 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | | ||
1616 | BIT_MASK(BTN_RIGHT); | ||
1617 | |||
1618 | __set_bit(INPUT_PROP_POINTER, tp_dev->propbit); | ||
1619 | __set_bit(INPUT_PROP_POINTING_STICK, tp_dev->propbit); | ||
1620 | |||
1621 | error = input_register_device(etd->tp_dev); | ||
1622 | if (error < 0) | ||
1623 | goto init_fail_tp_reg; | ||
1624 | } | ||
1625 | |||
1501 | psmouse->protocol_handler = elantech_process_byte; | 1626 | psmouse->protocol_handler = elantech_process_byte; |
1502 | psmouse->disconnect = elantech_disconnect; | 1627 | psmouse->disconnect = elantech_disconnect; |
1503 | psmouse->reconnect = elantech_reconnect; | 1628 | psmouse->reconnect = elantech_reconnect; |
1504 | psmouse->pktsize = etd->hw_version > 1 ? 6 : 4; | 1629 | psmouse->pktsize = etd->hw_version > 1 ? 6 : 4; |
1505 | 1630 | ||
1506 | return 0; | 1631 | return 0; |
1507 | 1632 | init_fail_tp_reg: | |
1633 | input_free_device(tp_dev); | ||
1634 | init_fail_tp_alloc: | ||
1635 | sysfs_remove_group(&psmouse->ps2dev.serio->dev.kobj, | ||
1636 | &elantech_attr_group); | ||
1508 | init_fail: | 1637 | init_fail: |
1638 | psmouse_reset(psmouse); | ||
1509 | kfree(etd); | 1639 | kfree(etd); |
1510 | return -1; | 1640 | return error; |
1511 | } | 1641 | } |
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index 9e0e2a1f340d..6f3afec02f03 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h | |||
@@ -94,6 +94,7 @@ | |||
94 | #define PACKET_V4_HEAD 0x05 | 94 | #define PACKET_V4_HEAD 0x05 |
95 | #define PACKET_V4_MOTION 0x06 | 95 | #define PACKET_V4_MOTION 0x06 |
96 | #define PACKET_V4_STATUS 0x07 | 96 | #define PACKET_V4_STATUS 0x07 |
97 | #define PACKET_TRACKPOINT 0x08 | ||
97 | 98 | ||
98 | /* | 99 | /* |
99 | * track up to 5 fingers for v4 hardware | 100 | * track up to 5 fingers for v4 hardware |
@@ -114,6 +115,8 @@ struct finger_pos { | |||
114 | }; | 115 | }; |
115 | 116 | ||
116 | struct elantech_data { | 117 | struct elantech_data { |
118 | struct input_dev *tp_dev; /* Relative device for trackpoint */ | ||
119 | char tp_phys[32]; | ||
117 | unsigned char reg_07; | 120 | unsigned char reg_07; |
118 | unsigned char reg_10; | 121 | unsigned char reg_10; |
119 | unsigned char reg_11; | 122 | unsigned char reg_11; |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index cff065f6261c..b4e1f014ddc2 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -670,6 +670,8 @@ static void psmouse_apply_defaults(struct psmouse *psmouse) | |||
670 | __set_bit(REL_X, input_dev->relbit); | 670 | __set_bit(REL_X, input_dev->relbit); |
671 | __set_bit(REL_Y, input_dev->relbit); | 671 | __set_bit(REL_Y, input_dev->relbit); |
672 | 672 | ||
673 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
674 | |||
673 | psmouse->set_rate = psmouse_set_rate; | 675 | psmouse->set_rate = psmouse_set_rate; |
674 | psmouse->set_resolution = psmouse_set_resolution; | 676 | psmouse->set_resolution = psmouse_set_resolution; |
675 | psmouse->poll = psmouse_poll; | 677 | psmouse->poll = psmouse_poll; |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index e8573c68f77e..fd23181c1fb7 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -629,10 +629,61 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | |||
629 | ((buf[0] & 0x04) >> 1) | | 629 | ((buf[0] & 0x04) >> 1) | |
630 | ((buf[3] & 0x04) >> 2)); | 630 | ((buf[3] & 0x04) >> 2)); |
631 | 631 | ||
632 | if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || | ||
633 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && | ||
634 | hw->w == 2) { | ||
635 | synaptics_parse_agm(buf, priv, hw); | ||
636 | return 1; | ||
637 | } | ||
638 | |||
639 | hw->x = (((buf[3] & 0x10) << 8) | | ||
640 | ((buf[1] & 0x0f) << 8) | | ||
641 | buf[4]); | ||
642 | hw->y = (((buf[3] & 0x20) << 7) | | ||
643 | ((buf[1] & 0xf0) << 4) | | ||
644 | buf[5]); | ||
645 | hw->z = buf[2]; | ||
646 | |||
632 | hw->left = (buf[0] & 0x01) ? 1 : 0; | 647 | hw->left = (buf[0] & 0x01) ? 1 : 0; |
633 | hw->right = (buf[0] & 0x02) ? 1 : 0; | 648 | hw->right = (buf[0] & 0x02) ? 1 : 0; |
634 | 649 | ||
635 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | 650 | if (SYN_CAP_FORCEPAD(priv->ext_cap_0c)) { |
651 | /* | ||
652 | * ForcePads, like Clickpads, use middle button | ||
653 | * bits to report primary button clicks. | ||
654 | * Unfortunately they report primary button not | ||
655 | * only when user presses on the pad above certain | ||
656 | * threshold, but also when there are more than one | ||
657 | * finger on the touchpad, which interferes with | ||
658 | * out multi-finger gestures. | ||
659 | */ | ||
660 | if (hw->z == 0) { | ||
661 | /* No contacts */ | ||
662 | priv->press = priv->report_press = false; | ||
663 | } else if (hw->w >= 4 && ((buf[0] ^ buf[3]) & 0x01)) { | ||
664 | /* | ||
665 | * Single-finger touch with pressure above | ||
666 | * the threshold. If pressure stays long | ||
667 | * enough, we'll start reporting primary | ||
668 | * button. We rely on the device continuing | ||
669 | * sending data even if finger does not | ||
670 | * move. | ||
671 | */ | ||
672 | if (!priv->press) { | ||
673 | priv->press_start = jiffies; | ||
674 | priv->press = true; | ||
675 | } else if (time_after(jiffies, | ||
676 | priv->press_start + | ||
677 | msecs_to_jiffies(50))) { | ||
678 | priv->report_press = true; | ||
679 | } | ||
680 | } else { | ||
681 | priv->press = false; | ||
682 | } | ||
683 | |||
684 | hw->left = priv->report_press; | ||
685 | |||
686 | } else if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | ||
636 | /* | 687 | /* |
637 | * Clickpad's button is transmitted as middle button, | 688 | * Clickpad's button is transmitted as middle button, |
638 | * however, since it is primary button, we will report | 689 | * however, since it is primary button, we will report |
@@ -651,21 +702,6 @@ static int synaptics_parse_hw_state(const unsigned char buf[], | |||
651 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; | 702 | hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; |
652 | } | 703 | } |
653 | 704 | ||
654 | if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || | ||
655 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) && | ||
656 | hw->w == 2) { | ||
657 | synaptics_parse_agm(buf, priv, hw); | ||
658 | return 1; | ||
659 | } | ||
660 | |||
661 | hw->x = (((buf[3] & 0x10) << 8) | | ||
662 | ((buf[1] & 0x0f) << 8) | | ||
663 | buf[4]); | ||
664 | hw->y = (((buf[3] & 0x20) << 7) | | ||
665 | ((buf[1] & 0xf0) << 4) | | ||
666 | buf[5]); | ||
667 | hw->z = buf[2]; | ||
668 | |||
669 | if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && | 705 | if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && |
670 | ((buf[0] ^ buf[3]) & 0x02)) { | 706 | ((buf[0] ^ buf[3]) & 0x02)) { |
671 | switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { | 707 | switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { |
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index e594af0b264b..fb2e076738ae 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -78,6 +78,11 @@ | |||
78 | * 2 0x08 image sensor image sensor tracks 5 fingers, but only | 78 | * 2 0x08 image sensor image sensor tracks 5 fingers, but only |
79 | * reports 2. | 79 | * reports 2. |
80 | * 2 0x20 report min query 0x0f gives min coord reported | 80 | * 2 0x20 report min query 0x0f gives min coord reported |
81 | * 2 0x80 forcepad forcepad is a variant of clickpad that | ||
82 | * does not have physical buttons but rather | ||
83 | * uses pressure above certain threshold to | ||
84 | * report primary clicks. Forcepads also have | ||
85 | * clickpad bit set. | ||
81 | */ | 86 | */ |
82 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ | 87 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ |
83 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ | 88 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ |
@@ -86,6 +91,7 @@ | |||
86 | #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000) | 91 | #define SYN_CAP_ADV_GESTURE(ex0c) ((ex0c) & 0x080000) |
87 | #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) | 92 | #define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) |
88 | #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) | 93 | #define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) |
94 | #define SYN_CAP_FORCEPAD(ex0c) ((ex0c) & 0x008000) | ||
89 | 95 | ||
90 | /* synaptics modes query bits */ | 96 | /* synaptics modes query bits */ |
91 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) | 97 | #define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) |
@@ -177,6 +183,11 @@ struct synaptics_data { | |||
177 | */ | 183 | */ |
178 | struct synaptics_hw_state agm; | 184 | struct synaptics_hw_state agm; |
179 | bool agm_pending; /* new AGM packet received */ | 185 | bool agm_pending; /* new AGM packet received */ |
186 | |||
187 | /* ForcePad handling */ | ||
188 | unsigned long press_start; | ||
189 | bool press; | ||
190 | bool report_press; | ||
180 | }; | 191 | }; |
181 | 192 | ||
182 | void synaptics_module_init(void); | 193 | void synaptics_module_init(void); |
diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c index e122bda16aab..6bcc0189c1c9 100644 --- a/drivers/input/mouse/synaptics_usb.c +++ b/drivers/input/mouse/synaptics_usb.c | |||
@@ -387,6 +387,7 @@ static int synusb_probe(struct usb_interface *intf, | |||
387 | __set_bit(EV_REL, input_dev->evbit); | 387 | __set_bit(EV_REL, input_dev->evbit); |
388 | __set_bit(REL_X, input_dev->relbit); | 388 | __set_bit(REL_X, input_dev->relbit); |
389 | __set_bit(REL_Y, input_dev->relbit); | 389 | __set_bit(REL_Y, input_dev->relbit); |
390 | __set_bit(INPUT_PROP_POINTING_STICK, input_dev->propbit); | ||
390 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 127, 0, 0); | 391 | input_set_abs_params(input_dev, ABS_PRESSURE, 0, 127, 0, 0); |
391 | } else { | 392 | } else { |
392 | input_set_abs_params(input_dev, ABS_X, | 393 | input_set_abs_params(input_dev, ABS_X, |
@@ -401,6 +402,11 @@ static int synusb_probe(struct usb_interface *intf, | |||
401 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | 402 | __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); |
402 | } | 403 | } |
403 | 404 | ||
405 | if (synusb->flags & SYNUSB_TOUCHSCREEN) | ||
406 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
407 | else | ||
408 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
409 | |||
404 | __set_bit(BTN_LEFT, input_dev->keybit); | 410 | __set_bit(BTN_LEFT, input_dev->keybit); |
405 | __set_bit(BTN_RIGHT, input_dev->keybit); | 411 | __set_bit(BTN_RIGHT, input_dev->keybit); |
406 | __set_bit(BTN_MIDDLE, input_dev->keybit); | 412 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index ca843b6cf6bd..30c8b6998808 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -393,6 +393,9 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
393 | if ((button_info & 0x0f) >= 3) | 393 | if ((button_info & 0x0f) >= 3) |
394 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | 394 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
395 | 395 | ||
396 | __set_bit(INPUT_PROP_POINTER, psmouse->dev->propbit); | ||
397 | __set_bit(INPUT_PROP_POINTING_STICK, psmouse->dev->propbit); | ||
398 | |||
396 | trackpoint_defaults(psmouse->private); | 399 | trackpoint_defaults(psmouse->private); |
397 | 400 | ||
398 | error = trackpoint_power_on_reset(&psmouse->ps2dev); | 401 | error = trackpoint_power_on_reset(&psmouse->ps2dev); |
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index d6aa4c67dbb6..93cb7912703c 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h | |||
@@ -17,7 +17,6 @@ static int i8042_aux_irq = -1; | |||
17 | #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" | 17 | #define I8042_MUX_PHYS_DESC "sparcps2/serio%d" |
18 | 18 | ||
19 | static void __iomem *kbd_iobase; | 19 | static void __iomem *kbd_iobase; |
20 | static struct resource *kbd_res; | ||
21 | 20 | ||
22 | #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) | 21 | #define I8042_COMMAND_REG (kbd_iobase + 0x64UL) |
23 | #define I8042_DATA_REG (kbd_iobase + 0x60UL) | 22 | #define I8042_DATA_REG (kbd_iobase + 0x60UL) |
@@ -44,6 +43,8 @@ static inline void i8042_write_command(int val) | |||
44 | 43 | ||
45 | #ifdef CONFIG_PCI | 44 | #ifdef CONFIG_PCI |
46 | 45 | ||
46 | static struct resource *kbd_res; | ||
47 | |||
47 | #define OBP_PS2KBD_NAME1 "kb_ps2" | 48 | #define OBP_PS2KBD_NAME1 "kb_ps2" |
48 | #define OBP_PS2KBD_NAME2 "keyboard" | 49 | #define OBP_PS2KBD_NAME2 "keyboard" |
49 | #define OBP_PS2MS_NAME1 "kdmouse" | 50 | #define OBP_PS2MS_NAME1 "kdmouse" |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 136b7b204f56..40b7d6c0ff17 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -465,6 +465,20 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
465 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | 465 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), |
466 | }, | 466 | }, |
467 | }, | 467 | }, |
468 | { | ||
469 | /* Asus X450LCP */ | ||
470 | .matches = { | ||
471 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), | ||
472 | DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"), | ||
473 | }, | ||
474 | }, | ||
475 | { | ||
476 | /* Avatar AVIU-145A6 */ | ||
477 | .matches = { | ||
478 | DMI_MATCH(DMI_SYS_VENDOR, "Intel"), | ||
479 | DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"), | ||
480 | }, | ||
481 | }, | ||
468 | { } | 482 | { } |
469 | }; | 483 | }; |
470 | 484 | ||
@@ -608,6 +622,14 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { | |||
608 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | 622 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), |
609 | }, | 623 | }, |
610 | }, | 624 | }, |
625 | { | ||
626 | /* Fujitsu U574 laptop */ | ||
627 | /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ | ||
628 | .matches = { | ||
629 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
630 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U574"), | ||
631 | }, | ||
632 | }, | ||
611 | { } | 633 | { } |
612 | }; | 634 | }; |
613 | 635 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 3807c3e971cc..f5a98af3b325 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -1254,6 +1254,8 @@ static int __init i8042_create_aux_port(int idx) | |||
1254 | } else { | 1254 | } else { |
1255 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); | 1255 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); |
1256 | snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); | 1256 | snprintf(serio->phys, sizeof(serio->phys), I8042_MUX_PHYS_DESC, idx + 1); |
1257 | strlcpy(serio->firmware_id, i8042_aux_firmware_id, | ||
1258 | sizeof(serio->firmware_id)); | ||
1257 | } | 1259 | } |
1258 | 1260 | ||
1259 | port->serio = serio; | 1261 | port->serio = serio; |
diff --git a/drivers/input/serio/serport.c b/drivers/input/serio/serport.c index 0cb7ef59071b..69175b825346 100644 --- a/drivers/input/serio/serport.c +++ b/drivers/input/serio/serport.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/serio.h> | 22 | #include <linux/serio.h> |
23 | #include <linux/tty.h> | 23 | #include <linux/tty.h> |
24 | #include <linux/compat.h> | ||
24 | 25 | ||
25 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); | 26 | MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); |
26 | MODULE_DESCRIPTION("Input device TTY line discipline"); | 27 | MODULE_DESCRIPTION("Input device TTY line discipline"); |
@@ -198,28 +199,55 @@ static ssize_t serport_ldisc_read(struct tty_struct * tty, struct file * file, u | |||
198 | return 0; | 199 | return 0; |
199 | } | 200 | } |
200 | 201 | ||
202 | static void serport_set_type(struct tty_struct *tty, unsigned long type) | ||
203 | { | ||
204 | struct serport *serport = tty->disc_data; | ||
205 | |||
206 | serport->id.proto = type & 0x000000ff; | ||
207 | serport->id.id = (type & 0x0000ff00) >> 8; | ||
208 | serport->id.extra = (type & 0x00ff0000) >> 16; | ||
209 | } | ||
210 | |||
201 | /* | 211 | /* |
202 | * serport_ldisc_ioctl() allows to set the port protocol, and device ID | 212 | * serport_ldisc_ioctl() allows to set the port protocol, and device ID |
203 | */ | 213 | */ |
204 | 214 | ||
205 | static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsigned int cmd, unsigned long arg) | 215 | static int serport_ldisc_ioctl(struct tty_struct *tty, struct file *file, |
216 | unsigned int cmd, unsigned long arg) | ||
206 | { | 217 | { |
207 | struct serport *serport = (struct serport*) tty->disc_data; | ||
208 | unsigned long type; | ||
209 | |||
210 | if (cmd == SPIOCSTYPE) { | 218 | if (cmd == SPIOCSTYPE) { |
219 | unsigned long type; | ||
220 | |||
211 | if (get_user(type, (unsigned long __user *) arg)) | 221 | if (get_user(type, (unsigned long __user *) arg)) |
212 | return -EFAULT; | 222 | return -EFAULT; |
213 | 223 | ||
214 | serport->id.proto = type & 0x000000ff; | 224 | serport_set_type(tty, type); |
215 | serport->id.id = (type & 0x0000ff00) >> 8; | 225 | return 0; |
216 | serport->id.extra = (type & 0x00ff0000) >> 16; | 226 | } |
227 | |||
228 | return -EINVAL; | ||
229 | } | ||
230 | |||
231 | #ifdef CONFIG_COMPAT | ||
232 | #define COMPAT_SPIOCSTYPE _IOW('q', 0x01, compat_ulong_t) | ||
233 | static long serport_ldisc_compat_ioctl(struct tty_struct *tty, | ||
234 | struct file *file, | ||
235 | unsigned int cmd, unsigned long arg) | ||
236 | { | ||
237 | if (cmd == COMPAT_SPIOCSTYPE) { | ||
238 | void __user *uarg = compat_ptr(arg); | ||
239 | compat_ulong_t compat_type; | ||
240 | |||
241 | if (get_user(compat_type, (compat_ulong_t __user *)uarg)) | ||
242 | return -EFAULT; | ||
217 | 243 | ||
244 | serport_set_type(tty, compat_type); | ||
218 | return 0; | 245 | return 0; |
219 | } | 246 | } |
220 | 247 | ||
221 | return -EINVAL; | 248 | return -EINVAL; |
222 | } | 249 | } |
250 | #endif | ||
223 | 251 | ||
224 | static void serport_ldisc_write_wakeup(struct tty_struct * tty) | 252 | static void serport_ldisc_write_wakeup(struct tty_struct * tty) |
225 | { | 253 | { |
@@ -243,6 +271,9 @@ static struct tty_ldisc_ops serport_ldisc = { | |||
243 | .close = serport_ldisc_close, | 271 | .close = serport_ldisc_close, |
244 | .read = serport_ldisc_read, | 272 | .read = serport_ldisc_read, |
245 | .ioctl = serport_ldisc_ioctl, | 273 | .ioctl = serport_ldisc_ioctl, |
274 | #ifdef CONFIG_COMPAT | ||
275 | .compat_ioctl = serport_ldisc_compat_ioctl, | ||
276 | #endif | ||
246 | .receive_buf = serport_ldisc_receive, | 277 | .receive_buf = serport_ldisc_receive, |
247 | .write_wakeup = serport_ldisc_write_wakeup | 278 | .write_wakeup = serport_ldisc_write_wakeup |
248 | }; | 279 | }; |
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index db178ed2b47e..aaacf8bfa61f 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -837,7 +837,12 @@ static irqreturn_t mxt_process_messages_t44(struct mxt_data *data) | |||
837 | count = data->msg_buf[0]; | 837 | count = data->msg_buf[0]; |
838 | 838 | ||
839 | if (count == 0) { | 839 | if (count == 0) { |
840 | dev_warn(dev, "Interrupt triggered but zero messages\n"); | 840 | /* |
841 | * This condition is caused by the CHG line being configured | ||
842 | * in Mode 0. It results in unnecessary I2C operations but it | ||
843 | * is benign. | ||
844 | */ | ||
845 | dev_dbg(dev, "Interrupt triggered but zero messages\n"); | ||
841 | return IRQ_NONE; | 846 | return IRQ_NONE; |
842 | } else if (count > data->max_reportid) { | 847 | } else if (count > data->max_reportid) { |
843 | dev_err(dev, "T44 count %d exceeded max report id\n", count); | 848 | dev_err(dev, "T44 count %d exceeded max report id\n", count); |
@@ -1374,11 +1379,16 @@ static int mxt_get_info(struct mxt_data *data) | |||
1374 | return 0; | 1379 | return 0; |
1375 | } | 1380 | } |
1376 | 1381 | ||
1377 | static void mxt_free_object_table(struct mxt_data *data) | 1382 | static void mxt_free_input_device(struct mxt_data *data) |
1378 | { | 1383 | { |
1379 | input_unregister_device(data->input_dev); | 1384 | if (data->input_dev) { |
1380 | data->input_dev = NULL; | 1385 | input_unregister_device(data->input_dev); |
1386 | data->input_dev = NULL; | ||
1387 | } | ||
1388 | } | ||
1381 | 1389 | ||
1390 | static void mxt_free_object_table(struct mxt_data *data) | ||
1391 | { | ||
1382 | kfree(data->object_table); | 1392 | kfree(data->object_table); |
1383 | data->object_table = NULL; | 1393 | data->object_table = NULL; |
1384 | kfree(data->msg_buf); | 1394 | kfree(data->msg_buf); |
@@ -1957,11 +1967,13 @@ static int mxt_load_fw(struct device *dev, const char *fn) | |||
1957 | ret = mxt_lookup_bootloader_address(data, 0); | 1967 | ret = mxt_lookup_bootloader_address(data, 0); |
1958 | if (ret) | 1968 | if (ret) |
1959 | goto release_firmware; | 1969 | goto release_firmware; |
1970 | |||
1971 | mxt_free_input_device(data); | ||
1972 | mxt_free_object_table(data); | ||
1960 | } else { | 1973 | } else { |
1961 | enable_irq(data->irq); | 1974 | enable_irq(data->irq); |
1962 | } | 1975 | } |
1963 | 1976 | ||
1964 | mxt_free_object_table(data); | ||
1965 | reinit_completion(&data->bl_completion); | 1977 | reinit_completion(&data->bl_completion); |
1966 | 1978 | ||
1967 | ret = mxt_check_bootloader(data, MXT_WAITING_BOOTLOAD_CMD, false); | 1979 | ret = mxt_check_bootloader(data, MXT_WAITING_BOOTLOAD_CMD, false); |
@@ -2210,6 +2222,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) | |||
2210 | return 0; | 2222 | return 0; |
2211 | 2223 | ||
2212 | err_free_object: | 2224 | err_free_object: |
2225 | mxt_free_input_device(data); | ||
2213 | mxt_free_object_table(data); | 2226 | mxt_free_object_table(data); |
2214 | err_free_irq: | 2227 | err_free_irq: |
2215 | free_irq(client->irq, data); | 2228 | free_irq(client->irq, data); |
@@ -2224,7 +2237,7 @@ static int mxt_remove(struct i2c_client *client) | |||
2224 | 2237 | ||
2225 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); | 2238 | sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); |
2226 | free_irq(data->irq, data); | 2239 | free_irq(data->irq, data); |
2227 | input_unregister_device(data->input_dev); | 2240 | mxt_free_input_device(data); |
2228 | mxt_free_object_table(data); | 2241 | mxt_free_object_table(data); |
2229 | kfree(data); | 2242 | kfree(data); |
2230 | 2243 | ||
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c index 16b52115c27f..705ffa1e064a 100644 --- a/drivers/input/touchscreen/wm9712.c +++ b/drivers/input/touchscreen/wm9712.c | |||
@@ -41,7 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | static int rpu = 8; | 42 | static int rpu = 8; |
43 | module_param(rpu, int, 0); | 43 | module_param(rpu, int, 0); |
44 | MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect."); | 44 | MODULE_PARM_DESC(rpu, "Set internal pull up resistor for pen detect."); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Set current used for pressure measurement. | 47 | * Set current used for pressure measurement. |
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c index 7405353199d7..572a5a64face 100644 --- a/drivers/input/touchscreen/wm9713.c +++ b/drivers/input/touchscreen/wm9713.c | |||
@@ -41,7 +41,7 @@ | |||
41 | */ | 41 | */ |
42 | static int rpu = 8; | 42 | static int rpu = 8; |
43 | module_param(rpu, int, 0); | 43 | module_param(rpu, int, 0); |
44 | MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect."); | 44 | MODULE_PARM_DESC(rpu, "Set internal pull up resistor for pen detect."); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | * Set current used for pressure measurement. | 47 | * Set current used for pressure measurement. |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index ca18d6d42a9b..a83cc2a2a2ca 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
@@ -146,6 +146,8 @@ | |||
146 | #define ID0_CTTW (1 << 14) | 146 | #define ID0_CTTW (1 << 14) |
147 | #define ID0_NUMIRPT_SHIFT 16 | 147 | #define ID0_NUMIRPT_SHIFT 16 |
148 | #define ID0_NUMIRPT_MASK 0xff | 148 | #define ID0_NUMIRPT_MASK 0xff |
149 | #define ID0_NUMSIDB_SHIFT 9 | ||
150 | #define ID0_NUMSIDB_MASK 0xf | ||
149 | #define ID0_NUMSMRG_SHIFT 0 | 151 | #define ID0_NUMSMRG_SHIFT 0 |
150 | #define ID0_NUMSMRG_MASK 0xff | 152 | #define ID0_NUMSMRG_MASK 0xff |
151 | 153 | ||
@@ -524,9 +526,18 @@ static int register_smmu_master(struct arm_smmu_device *smmu, | |||
524 | master->of_node = masterspec->np; | 526 | master->of_node = masterspec->np; |
525 | master->cfg.num_streamids = masterspec->args_count; | 527 | master->cfg.num_streamids = masterspec->args_count; |
526 | 528 | ||
527 | for (i = 0; i < master->cfg.num_streamids; ++i) | 529 | for (i = 0; i < master->cfg.num_streamids; ++i) { |
528 | master->cfg.streamids[i] = masterspec->args[i]; | 530 | u16 streamid = masterspec->args[i]; |
529 | 531 | ||
532 | if (!(smmu->features & ARM_SMMU_FEAT_STREAM_MATCH) && | ||
533 | (streamid >= smmu->num_mapping_groups)) { | ||
534 | dev_err(dev, | ||
535 | "stream ID for master device %s greater than maximum allowed (%d)\n", | ||
536 | masterspec->np->name, smmu->num_mapping_groups); | ||
537 | return -ERANGE; | ||
538 | } | ||
539 | master->cfg.streamids[i] = streamid; | ||
540 | } | ||
530 | return insert_smmu_master(smmu, master); | 541 | return insert_smmu_master(smmu, master); |
531 | } | 542 | } |
532 | 543 | ||
@@ -623,7 +634,7 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) | |||
623 | 634 | ||
624 | if (fsr & FSR_IGN) | 635 | if (fsr & FSR_IGN) |
625 | dev_err_ratelimited(smmu->dev, | 636 | dev_err_ratelimited(smmu->dev, |
626 | "Unexpected context fault (fsr 0x%u)\n", | 637 | "Unexpected context fault (fsr 0x%x)\n", |
627 | fsr); | 638 | fsr); |
628 | 639 | ||
629 | fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); | 640 | fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); |
@@ -752,6 +763,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
752 | reg = (TTBCR2_ADDR_36 << TTBCR2_SEP_SHIFT); | 763 | reg = (TTBCR2_ADDR_36 << TTBCR2_SEP_SHIFT); |
753 | break; | 764 | break; |
754 | case 39: | 765 | case 39: |
766 | case 40: | ||
755 | reg = (TTBCR2_ADDR_40 << TTBCR2_SEP_SHIFT); | 767 | reg = (TTBCR2_ADDR_40 << TTBCR2_SEP_SHIFT); |
756 | break; | 768 | break; |
757 | case 42: | 769 | case 42: |
@@ -773,6 +785,7 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
773 | reg |= (TTBCR2_ADDR_36 << TTBCR2_PASIZE_SHIFT); | 785 | reg |= (TTBCR2_ADDR_36 << TTBCR2_PASIZE_SHIFT); |
774 | break; | 786 | break; |
775 | case 39: | 787 | case 39: |
788 | case 40: | ||
776 | reg |= (TTBCR2_ADDR_40 << TTBCR2_PASIZE_SHIFT); | 789 | reg |= (TTBCR2_ADDR_40 << TTBCR2_PASIZE_SHIFT); |
777 | break; | 790 | break; |
778 | case 42: | 791 | case 42: |
@@ -843,8 +856,11 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
843 | reg |= TTBCR_EAE | | 856 | reg |= TTBCR_EAE | |
844 | (TTBCR_SH_IS << TTBCR_SH0_SHIFT) | | 857 | (TTBCR_SH_IS << TTBCR_SH0_SHIFT) | |
845 | (TTBCR_RGN_WBWA << TTBCR_ORGN0_SHIFT) | | 858 | (TTBCR_RGN_WBWA << TTBCR_ORGN0_SHIFT) | |
846 | (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT) | | 859 | (TTBCR_RGN_WBWA << TTBCR_IRGN0_SHIFT); |
847 | (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT); | 860 | |
861 | if (!stage1) | ||
862 | reg |= (TTBCR_SL0_LVL_1 << TTBCR_SL0_SHIFT); | ||
863 | |||
848 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR); | 864 | writel_relaxed(reg, cb_base + ARM_SMMU_CB_TTBCR); |
849 | 865 | ||
850 | /* MAIR0 (stage-1 only) */ | 866 | /* MAIR0 (stage-1 only) */ |
@@ -868,10 +884,15 @@ static void arm_smmu_init_context_bank(struct arm_smmu_domain *smmu_domain) | |||
868 | static int arm_smmu_init_domain_context(struct iommu_domain *domain, | 884 | static int arm_smmu_init_domain_context(struct iommu_domain *domain, |
869 | struct arm_smmu_device *smmu) | 885 | struct arm_smmu_device *smmu) |
870 | { | 886 | { |
871 | int irq, ret, start; | 887 | int irq, start, ret = 0; |
888 | unsigned long flags; | ||
872 | struct arm_smmu_domain *smmu_domain = domain->priv; | 889 | struct arm_smmu_domain *smmu_domain = domain->priv; |
873 | struct arm_smmu_cfg *cfg = &smmu_domain->cfg; | 890 | struct arm_smmu_cfg *cfg = &smmu_domain->cfg; |
874 | 891 | ||
892 | spin_lock_irqsave(&smmu_domain->lock, flags); | ||
893 | if (smmu_domain->smmu) | ||
894 | goto out_unlock; | ||
895 | |||
875 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { | 896 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { |
876 | /* | 897 | /* |
877 | * We will likely want to change this if/when KVM gets | 898 | * We will likely want to change this if/when KVM gets |
@@ -890,7 +911,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
890 | ret = __arm_smmu_alloc_bitmap(smmu->context_map, start, | 911 | ret = __arm_smmu_alloc_bitmap(smmu->context_map, start, |
891 | smmu->num_context_banks); | 912 | smmu->num_context_banks); |
892 | if (IS_ERR_VALUE(ret)) | 913 | if (IS_ERR_VALUE(ret)) |
893 | return ret; | 914 | goto out_unlock; |
894 | 915 | ||
895 | cfg->cbndx = ret; | 916 | cfg->cbndx = ret; |
896 | if (smmu->version == 1) { | 917 | if (smmu->version == 1) { |
@@ -900,6 +921,10 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
900 | cfg->irptndx = cfg->cbndx; | 921 | cfg->irptndx = cfg->cbndx; |
901 | } | 922 | } |
902 | 923 | ||
924 | ACCESS_ONCE(smmu_domain->smmu) = smmu; | ||
925 | arm_smmu_init_context_bank(smmu_domain); | ||
926 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
927 | |||
903 | irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; | 928 | irq = smmu->irqs[smmu->num_global_irqs + cfg->irptndx]; |
904 | ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, | 929 | ret = request_irq(irq, arm_smmu_context_fault, IRQF_SHARED, |
905 | "arm-smmu-context-fault", domain); | 930 | "arm-smmu-context-fault", domain); |
@@ -907,15 +932,12 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, | |||
907 | dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", | 932 | dev_err(smmu->dev, "failed to request context IRQ %d (%u)\n", |
908 | cfg->irptndx, irq); | 933 | cfg->irptndx, irq); |
909 | cfg->irptndx = INVALID_IRPTNDX; | 934 | cfg->irptndx = INVALID_IRPTNDX; |
910 | goto out_free_context; | ||
911 | } | 935 | } |
912 | 936 | ||
913 | smmu_domain->smmu = smmu; | ||
914 | arm_smmu_init_context_bank(smmu_domain); | ||
915 | return 0; | 937 | return 0; |
916 | 938 | ||
917 | out_free_context: | 939 | out_unlock: |
918 | __arm_smmu_free_bitmap(smmu->context_map, cfg->cbndx); | 940 | spin_unlock_irqrestore(&smmu_domain->lock, flags); |
919 | return ret; | 941 | return ret; |
920 | } | 942 | } |
921 | 943 | ||
@@ -975,7 +997,6 @@ static void arm_smmu_free_ptes(pmd_t *pmd) | |||
975 | { | 997 | { |
976 | pgtable_t table = pmd_pgtable(*pmd); | 998 | pgtable_t table = pmd_pgtable(*pmd); |
977 | 999 | ||
978 | pgtable_page_dtor(table); | ||
979 | __free_page(table); | 1000 | __free_page(table); |
980 | } | 1001 | } |
981 | 1002 | ||
@@ -1108,6 +1129,9 @@ static void arm_smmu_master_free_smrs(struct arm_smmu_device *smmu, | |||
1108 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | 1129 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); |
1109 | struct arm_smmu_smr *smrs = cfg->smrs; | 1130 | struct arm_smmu_smr *smrs = cfg->smrs; |
1110 | 1131 | ||
1132 | if (!smrs) | ||
1133 | return; | ||
1134 | |||
1111 | /* Invalidate the SMRs before freeing back to the allocator */ | 1135 | /* Invalidate the SMRs before freeing back to the allocator */ |
1112 | for (i = 0; i < cfg->num_streamids; ++i) { | 1136 | for (i = 0; i < cfg->num_streamids; ++i) { |
1113 | u8 idx = smrs[i].idx; | 1137 | u8 idx = smrs[i].idx; |
@@ -1120,20 +1144,6 @@ static void arm_smmu_master_free_smrs(struct arm_smmu_device *smmu, | |||
1120 | kfree(smrs); | 1144 | kfree(smrs); |
1121 | } | 1145 | } |
1122 | 1146 | ||
1123 | static void arm_smmu_bypass_stream_mapping(struct arm_smmu_device *smmu, | ||
1124 | struct arm_smmu_master_cfg *cfg) | ||
1125 | { | ||
1126 | int i; | ||
1127 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | ||
1128 | |||
1129 | for (i = 0; i < cfg->num_streamids; ++i) { | ||
1130 | u16 sid = cfg->streamids[i]; | ||
1131 | |||
1132 | writel_relaxed(S2CR_TYPE_BYPASS, | ||
1133 | gr0_base + ARM_SMMU_GR0_S2CR(sid)); | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, | 1147 | static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, |
1138 | struct arm_smmu_master_cfg *cfg) | 1148 | struct arm_smmu_master_cfg *cfg) |
1139 | { | 1149 | { |
@@ -1160,23 +1170,30 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain, | |||
1160 | static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain, | 1170 | static void arm_smmu_domain_remove_master(struct arm_smmu_domain *smmu_domain, |
1161 | struct arm_smmu_master_cfg *cfg) | 1171 | struct arm_smmu_master_cfg *cfg) |
1162 | { | 1172 | { |
1173 | int i; | ||
1163 | struct arm_smmu_device *smmu = smmu_domain->smmu; | 1174 | struct arm_smmu_device *smmu = smmu_domain->smmu; |
1175 | void __iomem *gr0_base = ARM_SMMU_GR0(smmu); | ||
1164 | 1176 | ||
1165 | /* | 1177 | /* |
1166 | * We *must* clear the S2CR first, because freeing the SMR means | 1178 | * We *must* clear the S2CR first, because freeing the SMR means |
1167 | * that it can be re-allocated immediately. | 1179 | * that it can be re-allocated immediately. |
1168 | */ | 1180 | */ |
1169 | arm_smmu_bypass_stream_mapping(smmu, cfg); | 1181 | for (i = 0; i < cfg->num_streamids; ++i) { |
1182 | u32 idx = cfg->smrs ? cfg->smrs[i].idx : cfg->streamids[i]; | ||
1183 | |||
1184 | writel_relaxed(S2CR_TYPE_BYPASS, | ||
1185 | gr0_base + ARM_SMMU_GR0_S2CR(idx)); | ||
1186 | } | ||
1187 | |||
1170 | arm_smmu_master_free_smrs(smmu, cfg); | 1188 | arm_smmu_master_free_smrs(smmu, cfg); |
1171 | } | 1189 | } |
1172 | 1190 | ||
1173 | static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | 1191 | static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) |
1174 | { | 1192 | { |
1175 | int ret = -EINVAL; | 1193 | int ret; |
1176 | struct arm_smmu_domain *smmu_domain = domain->priv; | 1194 | struct arm_smmu_domain *smmu_domain = domain->priv; |
1177 | struct arm_smmu_device *smmu; | 1195 | struct arm_smmu_device *smmu, *dom_smmu; |
1178 | struct arm_smmu_master_cfg *cfg; | 1196 | struct arm_smmu_master_cfg *cfg; |
1179 | unsigned long flags; | ||
1180 | 1197 | ||
1181 | smmu = dev_get_master_dev(dev)->archdata.iommu; | 1198 | smmu = dev_get_master_dev(dev)->archdata.iommu; |
1182 | if (!smmu) { | 1199 | if (!smmu) { |
@@ -1188,20 +1205,22 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1188 | * Sanity check the domain. We don't support domains across | 1205 | * Sanity check the domain. We don't support domains across |
1189 | * different SMMUs. | 1206 | * different SMMUs. |
1190 | */ | 1207 | */ |
1191 | spin_lock_irqsave(&smmu_domain->lock, flags); | 1208 | dom_smmu = ACCESS_ONCE(smmu_domain->smmu); |
1192 | if (!smmu_domain->smmu) { | 1209 | if (!dom_smmu) { |
1193 | /* Now that we have a master, we can finalise the domain */ | 1210 | /* Now that we have a master, we can finalise the domain */ |
1194 | ret = arm_smmu_init_domain_context(domain, smmu); | 1211 | ret = arm_smmu_init_domain_context(domain, smmu); |
1195 | if (IS_ERR_VALUE(ret)) | 1212 | if (IS_ERR_VALUE(ret)) |
1196 | goto err_unlock; | 1213 | return ret; |
1197 | } else if (smmu_domain->smmu != smmu) { | 1214 | |
1215 | dom_smmu = smmu_domain->smmu; | ||
1216 | } | ||
1217 | |||
1218 | if (dom_smmu != smmu) { | ||
1198 | dev_err(dev, | 1219 | dev_err(dev, |
1199 | "cannot attach to SMMU %s whilst already attached to domain on SMMU %s\n", | 1220 | "cannot attach to SMMU %s whilst already attached to domain on SMMU %s\n", |
1200 | dev_name(smmu_domain->smmu->dev), | 1221 | dev_name(smmu_domain->smmu->dev), dev_name(smmu->dev)); |
1201 | dev_name(smmu->dev)); | 1222 | return -EINVAL; |
1202 | goto err_unlock; | ||
1203 | } | 1223 | } |
1204 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
1205 | 1224 | ||
1206 | /* Looks ok, so add the device to the domain */ | 1225 | /* Looks ok, so add the device to the domain */ |
1207 | cfg = find_smmu_master_cfg(smmu_domain->smmu, dev); | 1226 | cfg = find_smmu_master_cfg(smmu_domain->smmu, dev); |
@@ -1209,10 +1228,6 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1209 | return -ENODEV; | 1228 | return -ENODEV; |
1210 | 1229 | ||
1211 | return arm_smmu_domain_add_master(smmu_domain, cfg); | 1230 | return arm_smmu_domain_add_master(smmu_domain, cfg); |
1212 | |||
1213 | err_unlock: | ||
1214 | spin_unlock_irqrestore(&smmu_domain->lock, flags); | ||
1215 | return ret; | ||
1216 | } | 1231 | } |
1217 | 1232 | ||
1218 | static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) | 1233 | static void arm_smmu_detach_dev(struct iommu_domain *domain, struct device *dev) |
@@ -1247,10 +1262,6 @@ static int arm_smmu_alloc_init_pte(struct arm_smmu_device *smmu, pmd_t *pmd, | |||
1247 | return -ENOMEM; | 1262 | return -ENOMEM; |
1248 | 1263 | ||
1249 | arm_smmu_flush_pgtable(smmu, page_address(table), PAGE_SIZE); | 1264 | arm_smmu_flush_pgtable(smmu, page_address(table), PAGE_SIZE); |
1250 | if (!pgtable_page_ctor(table)) { | ||
1251 | __free_page(table); | ||
1252 | return -ENOMEM; | ||
1253 | } | ||
1254 | pmd_populate(NULL, pmd, table); | 1265 | pmd_populate(NULL, pmd, table); |
1255 | arm_smmu_flush_pgtable(smmu, pmd, sizeof(*pmd)); | 1266 | arm_smmu_flush_pgtable(smmu, pmd, sizeof(*pmd)); |
1256 | } | 1267 | } |
@@ -1626,7 +1637,7 @@ static void arm_smmu_device_reset(struct arm_smmu_device *smmu) | |||
1626 | 1637 | ||
1627 | /* Mark all SMRn as invalid and all S2CRn as bypass */ | 1638 | /* Mark all SMRn as invalid and all S2CRn as bypass */ |
1628 | for (i = 0; i < smmu->num_mapping_groups; ++i) { | 1639 | for (i = 0; i < smmu->num_mapping_groups; ++i) { |
1629 | writel_relaxed(~SMR_VALID, gr0_base + ARM_SMMU_GR0_SMR(i)); | 1640 | writel_relaxed(0, gr0_base + ARM_SMMU_GR0_SMR(i)); |
1630 | writel_relaxed(S2CR_TYPE_BYPASS, | 1641 | writel_relaxed(S2CR_TYPE_BYPASS, |
1631 | gr0_base + ARM_SMMU_GR0_S2CR(i)); | 1642 | gr0_base + ARM_SMMU_GR0_S2CR(i)); |
1632 | } | 1643 | } |
@@ -1761,6 +1772,9 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) | |||
1761 | dev_notice(smmu->dev, | 1772 | dev_notice(smmu->dev, |
1762 | "\tstream matching with %u register groups, mask 0x%x", | 1773 | "\tstream matching with %u register groups, mask 0x%x", |
1763 | smmu->num_mapping_groups, mask); | 1774 | smmu->num_mapping_groups, mask); |
1775 | } else { | ||
1776 | smmu->num_mapping_groups = (id >> ID0_NUMSIDB_SHIFT) & | ||
1777 | ID0_NUMSIDB_MASK; | ||
1764 | } | 1778 | } |
1765 | 1779 | ||
1766 | /* ID1 */ | 1780 | /* ID1 */ |
@@ -1794,11 +1808,16 @@ static int arm_smmu_device_cfg_probe(struct arm_smmu_device *smmu) | |||
1794 | * Stage-1 output limited by stage-2 input size due to pgd | 1808 | * Stage-1 output limited by stage-2 input size due to pgd |
1795 | * allocation (PTRS_PER_PGD). | 1809 | * allocation (PTRS_PER_PGD). |
1796 | */ | 1810 | */ |
1811 | if (smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) { | ||
1797 | #ifdef CONFIG_64BIT | 1812 | #ifdef CONFIG_64BIT |
1798 | smmu->s1_output_size = min_t(unsigned long, VA_BITS, size); | 1813 | smmu->s1_output_size = min_t(unsigned long, VA_BITS, size); |
1799 | #else | 1814 | #else |
1800 | smmu->s1_output_size = min(32UL, size); | 1815 | smmu->s1_output_size = min(32UL, size); |
1801 | #endif | 1816 | #endif |
1817 | } else { | ||
1818 | smmu->s1_output_size = min_t(unsigned long, PHYS_MASK_SHIFT, | ||
1819 | size); | ||
1820 | } | ||
1802 | 1821 | ||
1803 | /* The stage-2 output mask is also applied for bypass */ | 1822 | /* The stage-2 output mask is also applied for bypass */ |
1804 | size = arm_smmu_id_size_to_bits((id >> ID2_OAS_SHIFT) & ID2_OAS_MASK); | 1823 | size = arm_smmu_id_size_to_bits((id >> ID2_OAS_SHIFT) & ID2_OAS_MASK); |
@@ -1889,6 +1908,10 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1889 | smmu->irqs[i] = irq; | 1908 | smmu->irqs[i] = irq; |
1890 | } | 1909 | } |
1891 | 1910 | ||
1911 | err = arm_smmu_device_cfg_probe(smmu); | ||
1912 | if (err) | ||
1913 | return err; | ||
1914 | |||
1892 | i = 0; | 1915 | i = 0; |
1893 | smmu->masters = RB_ROOT; | 1916 | smmu->masters = RB_ROOT; |
1894 | while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters", | 1917 | while (!of_parse_phandle_with_args(dev->of_node, "mmu-masters", |
@@ -1905,10 +1928,6 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) | |||
1905 | } | 1928 | } |
1906 | dev_notice(dev, "registered %d master devices\n", i); | 1929 | dev_notice(dev, "registered %d master devices\n", i); |
1907 | 1930 | ||
1908 | err = arm_smmu_device_cfg_probe(smmu); | ||
1909 | if (err) | ||
1910 | goto out_put_masters; | ||
1911 | |||
1912 | parse_driver_options(smmu); | 1931 | parse_driver_options(smmu); |
1913 | 1932 | ||
1914 | if (smmu->version > 1 && | 1933 | if (smmu->version > 1 && |
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c index 60ab474bfff3..06d268abe951 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -678,8 +678,7 @@ static int __init dmar_acpi_dev_scope_init(void) | |||
678 | andd->device_name); | 678 | andd->device_name); |
679 | continue; | 679 | continue; |
680 | } | 680 | } |
681 | acpi_bus_get_device(h, &adev); | 681 | if (acpi_bus_get_device(h, &adev)) { |
682 | if (!adev) { | ||
683 | pr_err("Failed to get device for ACPI object %s\n", | 682 | pr_err("Failed to get device for ACPI object %s\n", |
684 | andd->device_name); | 683 | andd->device_name); |
685 | continue; | 684 | continue; |
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index 61d1dafa242d..56feed7cec15 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c | |||
@@ -984,7 +984,7 @@ static int fsl_pamu_add_device(struct device *dev) | |||
984 | struct iommu_group *group = ERR_PTR(-ENODEV); | 984 | struct iommu_group *group = ERR_PTR(-ENODEV); |
985 | struct pci_dev *pdev; | 985 | struct pci_dev *pdev; |
986 | const u32 *prop; | 986 | const u32 *prop; |
987 | int ret, len; | 987 | int ret = 0, len; |
988 | 988 | ||
989 | /* | 989 | /* |
990 | * For platform devices we allocate a separate group for | 990 | * For platform devices we allocate a separate group for |
@@ -1007,7 +1007,13 @@ static int fsl_pamu_add_device(struct device *dev) | |||
1007 | if (IS_ERR(group)) | 1007 | if (IS_ERR(group)) |
1008 | return PTR_ERR(group); | 1008 | return PTR_ERR(group); |
1009 | 1009 | ||
1010 | ret = iommu_group_add_device(group, dev); | 1010 | /* |
1011 | * Check if device has already been added to an iommu group. | ||
1012 | * Group could have already been created for a PCI device in | ||
1013 | * the iommu_group_get_for_dev path. | ||
1014 | */ | ||
1015 | if (!dev->iommu_group) | ||
1016 | ret = iommu_group_add_device(group, dev); | ||
1011 | 1017 | ||
1012 | iommu_group_put(group); | 1018 | iommu_group_put(group); |
1013 | return ret; | 1019 | return ret; |
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index ac4adb337038..0639b9274b11 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
@@ -678,15 +678,17 @@ static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev) | |||
678 | */ | 678 | */ |
679 | struct iommu_group *iommu_group_get_for_dev(struct device *dev) | 679 | struct iommu_group *iommu_group_get_for_dev(struct device *dev) |
680 | { | 680 | { |
681 | struct iommu_group *group = ERR_PTR(-EIO); | 681 | struct iommu_group *group; |
682 | int ret; | 682 | int ret; |
683 | 683 | ||
684 | group = iommu_group_get(dev); | 684 | group = iommu_group_get(dev); |
685 | if (group) | 685 | if (group) |
686 | return group; | 686 | return group; |
687 | 687 | ||
688 | if (dev_is_pci(dev)) | 688 | if (!dev_is_pci(dev)) |
689 | group = iommu_group_get_for_pci_dev(to_pci_dev(dev)); | 689 | return ERR_PTR(-EINVAL); |
690 | |||
691 | group = iommu_group_get_for_pci_dev(to_pci_dev(dev)); | ||
690 | 692 | ||
691 | if (IS_ERR(group)) | 693 | if (IS_ERR(group)) |
692 | return group; | 694 | return group; |
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c index f8636a650cf6..5945223b73fa 100644 --- a/drivers/irqchip/exynos-combiner.c +++ b/drivers/irqchip/exynos-combiner.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/irqdomain.h> | 16 | #include <linux/irqdomain.h> |
17 | #include <linux/irqchip/chained_irq.h> | 17 | #include <linux/irqchip/chained_irq.h> |
18 | #include <linux/interrupt.h> | ||
18 | #include <linux/of_address.h> | 19 | #include <linux/of_address.h> |
19 | #include <linux/of_irq.h> | 20 | #include <linux/of_irq.h> |
20 | 21 | ||
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index 85c2985d8bcb..bbbaf5de65d2 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c | |||
@@ -220,7 +220,7 @@ static int __init crossbar_of_init(struct device_node *node) | |||
220 | of_property_read_u32_index(node, | 220 | of_property_read_u32_index(node, |
221 | "ti,irqs-reserved", | 221 | "ti,irqs-reserved", |
222 | i, &entry); | 222 | i, &entry); |
223 | if (entry > max) { | 223 | if (entry >= max) { |
224 | pr_err("Invalid reserved entry\n"); | 224 | pr_err("Invalid reserved entry\n"); |
225 | ret = -EINVAL; | 225 | ret = -EINVAL; |
226 | goto err_irq_map; | 226 | goto err_irq_map; |
@@ -238,7 +238,7 @@ static int __init crossbar_of_init(struct device_node *node) | |||
238 | of_property_read_u32_index(node, | 238 | of_property_read_u32_index(node, |
239 | "ti,irqs-skip", | 239 | "ti,irqs-skip", |
240 | i, &entry); | 240 | i, &entry); |
241 | if (entry > max) { | 241 | if (entry >= max) { |
242 | pr_err("Invalid skip entry\n"); | 242 | pr_err("Invalid skip entry\n"); |
243 | ret = -EINVAL; | 243 | ret = -EINVAL; |
244 | goto err_irq_map; | 244 | goto err_irq_map; |
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 57eaa5a0b1e3..a0698b4f0303 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c | |||
@@ -36,7 +36,7 @@ | |||
36 | struct gic_chip_data { | 36 | struct gic_chip_data { |
37 | void __iomem *dist_base; | 37 | void __iomem *dist_base; |
38 | void __iomem **redist_base; | 38 | void __iomem **redist_base; |
39 | void __percpu __iomem **rdist; | 39 | void __iomem * __percpu *rdist; |
40 | struct irq_domain *domain; | 40 | struct irq_domain *domain; |
41 | u64 redist_stride; | 41 | u64 redist_stride; |
42 | u32 redist_regions; | 42 | u32 redist_regions; |
@@ -104,7 +104,7 @@ static void gic_redist_wait_for_rwp(void) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | /* Low level accessors */ | 106 | /* Low level accessors */ |
107 | static u64 gic_read_iar(void) | 107 | static u64 __maybe_unused gic_read_iar(void) |
108 | { | 108 | { |
109 | u64 irqstat; | 109 | u64 irqstat; |
110 | 110 | ||
@@ -112,24 +112,24 @@ static u64 gic_read_iar(void) | |||
112 | return irqstat; | 112 | return irqstat; |
113 | } | 113 | } |
114 | 114 | ||
115 | static void gic_write_pmr(u64 val) | 115 | static void __maybe_unused gic_write_pmr(u64 val) |
116 | { | 116 | { |
117 | asm volatile("msr_s " __stringify(ICC_PMR_EL1) ", %0" : : "r" (val)); | 117 | asm volatile("msr_s " __stringify(ICC_PMR_EL1) ", %0" : : "r" (val)); |
118 | } | 118 | } |
119 | 119 | ||
120 | static void gic_write_ctlr(u64 val) | 120 | static void __maybe_unused gic_write_ctlr(u64 val) |
121 | { | 121 | { |
122 | asm volatile("msr_s " __stringify(ICC_CTLR_EL1) ", %0" : : "r" (val)); | 122 | asm volatile("msr_s " __stringify(ICC_CTLR_EL1) ", %0" : : "r" (val)); |
123 | isb(); | 123 | isb(); |
124 | } | 124 | } |
125 | 125 | ||
126 | static void gic_write_grpen1(u64 val) | 126 | static void __maybe_unused gic_write_grpen1(u64 val) |
127 | { | 127 | { |
128 | asm volatile("msr_s " __stringify(ICC_GRPEN1_EL1) ", %0" : : "r" (val)); | 128 | asm volatile("msr_s " __stringify(ICC_GRPEN1_EL1) ", %0" : : "r" (val)); |
129 | isb(); | 129 | isb(); |
130 | } | 130 | } |
131 | 131 | ||
132 | static void gic_write_sgi1r(u64 val) | 132 | static void __maybe_unused gic_write_sgi1r(u64 val) |
133 | { | 133 | { |
134 | asm volatile("msr_s " __stringify(ICC_SGI1R_EL1) ", %0" : : "r" (val)); | 134 | asm volatile("msr_s " __stringify(ICC_SGI1R_EL1) ", %0" : : "r" (val)); |
135 | } | 135 | } |
@@ -200,19 +200,6 @@ static void gic_poke_irq(struct irq_data *d, u32 offset) | |||
200 | rwp_wait(); | 200 | rwp_wait(); |
201 | } | 201 | } |
202 | 202 | ||
203 | static int gic_peek_irq(struct irq_data *d, u32 offset) | ||
204 | { | ||
205 | u32 mask = 1 << (gic_irq(d) % 32); | ||
206 | void __iomem *base; | ||
207 | |||
208 | if (gic_irq_in_rdist(d)) | ||
209 | base = gic_data_rdist_sgi_base(); | ||
210 | else | ||
211 | base = gic_data.dist_base; | ||
212 | |||
213 | return !!(readl_relaxed(base + offset + (gic_irq(d) / 32) * 4) & mask); | ||
214 | } | ||
215 | |||
216 | static void gic_mask_irq(struct irq_data *d) | 203 | static void gic_mask_irq(struct irq_data *d) |
217 | { | 204 | { |
218 | gic_poke_irq(d, GICD_ICENABLER); | 205 | gic_poke_irq(d, GICD_ICENABLER); |
@@ -401,6 +388,19 @@ static void gic_cpu_init(void) | |||
401 | } | 388 | } |
402 | 389 | ||
403 | #ifdef CONFIG_SMP | 390 | #ifdef CONFIG_SMP |
391 | static int gic_peek_irq(struct irq_data *d, u32 offset) | ||
392 | { | ||
393 | u32 mask = 1 << (gic_irq(d) % 32); | ||
394 | void __iomem *base; | ||
395 | |||
396 | if (gic_irq_in_rdist(d)) | ||
397 | base = gic_data_rdist_sgi_base(); | ||
398 | else | ||
399 | base = gic_data.dist_base; | ||
400 | |||
401 | return !!(readl_relaxed(base + offset + (gic_irq(d) / 32) * 4) & mask); | ||
402 | } | ||
403 | |||
404 | static int gic_secondary_init(struct notifier_block *nfb, | 404 | static int gic_secondary_init(struct notifier_block *nfb, |
405 | unsigned long action, void *hcpu) | 405 | unsigned long action, void *hcpu) |
406 | { | 406 | { |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 4b959e606fe8..dda6dbc23565 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -867,7 +867,7 @@ static int gic_routable_irq_domain_xlate(struct irq_domain *d, | |||
867 | return 0; | 867 | return 0; |
868 | } | 868 | } |
869 | 869 | ||
870 | const struct irq_domain_ops gic_default_routable_irq_domain_ops = { | 870 | static const struct irq_domain_ops gic_default_routable_irq_domain_ops = { |
871 | .map = gic_routable_irq_domain_map, | 871 | .map = gic_routable_irq_domain_map, |
872 | .unmap = gic_routable_irq_domain_unmap, | 872 | .unmap = gic_routable_irq_domain_unmap, |
873 | .xlate = gic_routable_irq_domain_xlate, | 873 | .xlate = gic_routable_irq_domain_xlate, |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 129729d35478..aa29198fca3e 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -15,10 +15,10 @@ | |||
15 | #include <linux/list.h> | 15 | #include <linux/list.h> |
16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/timer.h> | ||
18 | #include <linux/err.h> | 19 | #include <linux/err.h> |
19 | #include <linux/ctype.h> | 20 | #include <linux/ctype.h> |
20 | #include <linux/leds.h> | 21 | #include <linux/leds.h> |
21 | #include <linux/workqueue.h> | ||
22 | #include "leds.h" | 22 | #include "leds.h" |
23 | 23 | ||
24 | static struct class *leds_class; | 24 | static struct class *leds_class; |
@@ -97,10 +97,9 @@ static const struct attribute_group *led_groups[] = { | |||
97 | NULL, | 97 | NULL, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | static void led_work_function(struct work_struct *ws) | 100 | static void led_timer_function(unsigned long data) |
101 | { | 101 | { |
102 | struct led_classdev *led_cdev = | 102 | struct led_classdev *led_cdev = (void *)data; |
103 | container_of(ws, struct led_classdev, blink_work.work); | ||
104 | unsigned long brightness; | 103 | unsigned long brightness; |
105 | unsigned long delay; | 104 | unsigned long delay; |
106 | 105 | ||
@@ -144,8 +143,7 @@ static void led_work_function(struct work_struct *ws) | |||
144 | } | 143 | } |
145 | } | 144 | } |
146 | 145 | ||
147 | queue_delayed_work(system_wq, &led_cdev->blink_work, | 146 | mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay)); |
148 | msecs_to_jiffies(delay)); | ||
149 | } | 147 | } |
150 | 148 | ||
151 | static void set_brightness_delayed(struct work_struct *ws) | 149 | static void set_brightness_delayed(struct work_struct *ws) |
@@ -233,7 +231,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) | |||
233 | 231 | ||
234 | INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed); | 232 | INIT_WORK(&led_cdev->set_brightness_work, set_brightness_delayed); |
235 | 233 | ||
236 | INIT_DELAYED_WORK(&led_cdev->blink_work, led_work_function); | 234 | init_timer(&led_cdev->blink_timer); |
235 | led_cdev->blink_timer.function = led_timer_function; | ||
236 | led_cdev->blink_timer.data = (unsigned long)led_cdev; | ||
237 | 237 | ||
238 | #ifdef CONFIG_LEDS_TRIGGERS | 238 | #ifdef CONFIG_LEDS_TRIGGERS |
239 | led_trigger_set_default(led_cdev); | 239 | led_trigger_set_default(led_cdev); |
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index 4bb116867b88..71b40d3bf776 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/rwsem.h> | 17 | #include <linux/rwsem.h> |
18 | #include <linux/leds.h> | 18 | #include <linux/leds.h> |
19 | #include <linux/workqueue.h> | ||
20 | #include "leds.h" | 19 | #include "leds.h" |
21 | 20 | ||
22 | DECLARE_RWSEM(leds_list_lock); | 21 | DECLARE_RWSEM(leds_list_lock); |
@@ -52,7 +51,7 @@ static void led_set_software_blink(struct led_classdev *led_cdev, | |||
52 | return; | 51 | return; |
53 | } | 52 | } |
54 | 53 | ||
55 | queue_delayed_work(system_wq, &led_cdev->blink_work, 1); | 54 | mod_timer(&led_cdev->blink_timer, jiffies + 1); |
56 | } | 55 | } |
57 | 56 | ||
58 | 57 | ||
@@ -76,7 +75,7 @@ void led_blink_set(struct led_classdev *led_cdev, | |||
76 | unsigned long *delay_on, | 75 | unsigned long *delay_on, |
77 | unsigned long *delay_off) | 76 | unsigned long *delay_off) |
78 | { | 77 | { |
79 | cancel_delayed_work_sync(&led_cdev->blink_work); | 78 | del_timer_sync(&led_cdev->blink_timer); |
80 | 79 | ||
81 | led_cdev->flags &= ~LED_BLINK_ONESHOT; | 80 | led_cdev->flags &= ~LED_BLINK_ONESHOT; |
82 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; | 81 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; |
@@ -91,7 +90,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev, | |||
91 | int invert) | 90 | int invert) |
92 | { | 91 | { |
93 | if ((led_cdev->flags & LED_BLINK_ONESHOT) && | 92 | if ((led_cdev->flags & LED_BLINK_ONESHOT) && |
94 | delayed_work_pending(&led_cdev->blink_work)) | 93 | timer_pending(&led_cdev->blink_timer)) |
95 | return; | 94 | return; |
96 | 95 | ||
97 | led_cdev->flags |= LED_BLINK_ONESHOT; | 96 | led_cdev->flags |= LED_BLINK_ONESHOT; |
@@ -108,7 +107,7 @@ EXPORT_SYMBOL(led_blink_set_oneshot); | |||
108 | 107 | ||
109 | void led_stop_software_blink(struct led_classdev *led_cdev) | 108 | void led_stop_software_blink(struct led_classdev *led_cdev) |
110 | { | 109 | { |
111 | cancel_delayed_work_sync(&led_cdev->blink_work); | 110 | del_timer_sync(&led_cdev->blink_timer); |
112 | led_cdev->blink_delay_on = 0; | 111 | led_cdev->blink_delay_on = 0; |
113 | led_cdev->blink_delay_off = 0; | 112 | led_cdev->blink_delay_off = 0; |
114 | } | 113 | } |
@@ -117,7 +116,7 @@ EXPORT_SYMBOL_GPL(led_stop_software_blink); | |||
117 | void led_set_brightness(struct led_classdev *led_cdev, | 116 | void led_set_brightness(struct led_classdev *led_cdev, |
118 | enum led_brightness brightness) | 117 | enum led_brightness brightness) |
119 | { | 118 | { |
120 | /* delay brightness setting if need to stop soft-blink work */ | 119 | /* delay brightness setting if need to stop soft-blink timer */ |
121 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { | 120 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { |
122 | led_cdev->delayed_set_value = brightness; | 121 | led_cdev->delayed_set_value = brightness; |
123 | schedule_work(&led_cdev->set_brightness_work); | 122 | schedule_work(&led_cdev->set_brightness_work); |
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1af40ee209e2..7130505c2425 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -895,8 +895,8 @@ static void migration_success_pre_commit(struct dm_cache_migration *mg) | |||
895 | struct cache *cache = mg->cache; | 895 | struct cache *cache = mg->cache; |
896 | 896 | ||
897 | if (mg->writeback) { | 897 | if (mg->writeback) { |
898 | cell_defer(cache, mg->old_ocell, false); | ||
899 | clear_dirty(cache, mg->old_oblock, mg->cblock); | 898 | clear_dirty(cache, mg->old_oblock, mg->cblock); |
899 | cell_defer(cache, mg->old_ocell, false); | ||
900 | cleanup_migration(mg); | 900 | cleanup_migration(mg); |
901 | return; | 901 | return; |
902 | 902 | ||
@@ -951,13 +951,13 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) | |||
951 | } | 951 | } |
952 | 952 | ||
953 | } else { | 953 | } else { |
954 | clear_dirty(cache, mg->new_oblock, mg->cblock); | ||
954 | if (mg->requeue_holder) | 955 | if (mg->requeue_holder) |
955 | cell_defer(cache, mg->new_ocell, true); | 956 | cell_defer(cache, mg->new_ocell, true); |
956 | else { | 957 | else { |
957 | bio_endio(mg->new_ocell->holder, 0); | 958 | bio_endio(mg->new_ocell->holder, 0); |
958 | cell_defer(cache, mg->new_ocell, false); | 959 | cell_defer(cache, mg->new_ocell, false); |
959 | } | 960 | } |
960 | clear_dirty(cache, mg->new_oblock, mg->cblock); | ||
961 | cleanup_migration(mg); | 961 | cleanup_migration(mg); |
962 | } | 962 | } |
963 | } | 963 | } |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d7690f86fdb9..55de4f6f7eaf 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -540,11 +540,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
540 | has_nonrot_disk = 0; | 540 | has_nonrot_disk = 0; |
541 | choose_next_idle = 0; | 541 | choose_next_idle = 0; |
542 | 542 | ||
543 | if (conf->mddev->recovery_cp < MaxSector && | 543 | choose_first = (conf->mddev->recovery_cp < this_sector + sectors); |
544 | (this_sector + sectors >= conf->next_resync)) | ||
545 | choose_first = 1; | ||
546 | else | ||
547 | choose_first = 0; | ||
548 | 544 | ||
549 | for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) { | 545 | for (disk = 0 ; disk < conf->raid_disks * 2 ; disk++) { |
550 | sector_t dist; | 546 | sector_t dist; |
@@ -831,7 +827,7 @@ static void flush_pending_writes(struct r1conf *conf) | |||
831 | * there is no normal IO happeing. It must arrange to call | 827 | * there is no normal IO happeing. It must arrange to call |
832 | * lower_barrier when the particular background IO completes. | 828 | * lower_barrier when the particular background IO completes. |
833 | */ | 829 | */ |
834 | static void raise_barrier(struct r1conf *conf) | 830 | static void raise_barrier(struct r1conf *conf, sector_t sector_nr) |
835 | { | 831 | { |
836 | spin_lock_irq(&conf->resync_lock); | 832 | spin_lock_irq(&conf->resync_lock); |
837 | 833 | ||
@@ -841,6 +837,7 @@ static void raise_barrier(struct r1conf *conf) | |||
841 | 837 | ||
842 | /* block any new IO from starting */ | 838 | /* block any new IO from starting */ |
843 | conf->barrier++; | 839 | conf->barrier++; |
840 | conf->next_resync = sector_nr; | ||
844 | 841 | ||
845 | /* For these conditions we must wait: | 842 | /* For these conditions we must wait: |
846 | * A: while the array is in frozen state | 843 | * A: while the array is in frozen state |
@@ -849,14 +846,17 @@ static void raise_barrier(struct r1conf *conf) | |||
849 | * C: next_resync + RESYNC_SECTORS > start_next_window, meaning | 846 | * C: next_resync + RESYNC_SECTORS > start_next_window, meaning |
850 | * next resync will reach to the window which normal bios are | 847 | * next resync will reach to the window which normal bios are |
851 | * handling. | 848 | * handling. |
849 | * D: while there are any active requests in the current window. | ||
852 | */ | 850 | */ |
853 | wait_event_lock_irq(conf->wait_barrier, | 851 | wait_event_lock_irq(conf->wait_barrier, |
854 | !conf->array_frozen && | 852 | !conf->array_frozen && |
855 | conf->barrier < RESYNC_DEPTH && | 853 | conf->barrier < RESYNC_DEPTH && |
854 | conf->current_window_requests == 0 && | ||
856 | (conf->start_next_window >= | 855 | (conf->start_next_window >= |
857 | conf->next_resync + RESYNC_SECTORS), | 856 | conf->next_resync + RESYNC_SECTORS), |
858 | conf->resync_lock); | 857 | conf->resync_lock); |
859 | 858 | ||
859 | conf->nr_pending++; | ||
860 | spin_unlock_irq(&conf->resync_lock); | 860 | spin_unlock_irq(&conf->resync_lock); |
861 | } | 861 | } |
862 | 862 | ||
@@ -866,6 +866,7 @@ static void lower_barrier(struct r1conf *conf) | |||
866 | BUG_ON(conf->barrier <= 0); | 866 | BUG_ON(conf->barrier <= 0); |
867 | spin_lock_irqsave(&conf->resync_lock, flags); | 867 | spin_lock_irqsave(&conf->resync_lock, flags); |
868 | conf->barrier--; | 868 | conf->barrier--; |
869 | conf->nr_pending--; | ||
869 | spin_unlock_irqrestore(&conf->resync_lock, flags); | 870 | spin_unlock_irqrestore(&conf->resync_lock, flags); |
870 | wake_up(&conf->wait_barrier); | 871 | wake_up(&conf->wait_barrier); |
871 | } | 872 | } |
@@ -877,12 +878,10 @@ static bool need_to_wait_for_sync(struct r1conf *conf, struct bio *bio) | |||
877 | if (conf->array_frozen || !bio) | 878 | if (conf->array_frozen || !bio) |
878 | wait = true; | 879 | wait = true; |
879 | else if (conf->barrier && bio_data_dir(bio) == WRITE) { | 880 | else if (conf->barrier && bio_data_dir(bio) == WRITE) { |
880 | if (conf->next_resync < RESYNC_WINDOW_SECTORS) | 881 | if ((conf->mddev->curr_resync_completed |
881 | wait = true; | 882 | >= bio_end_sector(bio)) || |
882 | else if ((conf->next_resync - RESYNC_WINDOW_SECTORS | 883 | (conf->next_resync + NEXT_NORMALIO_DISTANCE |
883 | >= bio_end_sector(bio)) || | 884 | <= bio->bi_iter.bi_sector)) |
884 | (conf->next_resync + NEXT_NORMALIO_DISTANCE | ||
885 | <= bio->bi_iter.bi_sector)) | ||
886 | wait = false; | 885 | wait = false; |
887 | else | 886 | else |
888 | wait = true; | 887 | wait = true; |
@@ -919,8 +918,8 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio) | |||
919 | } | 918 | } |
920 | 919 | ||
921 | if (bio && bio_data_dir(bio) == WRITE) { | 920 | if (bio && bio_data_dir(bio) == WRITE) { |
922 | if (conf->next_resync + NEXT_NORMALIO_DISTANCE | 921 | if (bio->bi_iter.bi_sector >= |
923 | <= bio->bi_iter.bi_sector) { | 922 | conf->mddev->curr_resync_completed) { |
924 | if (conf->start_next_window == MaxSector) | 923 | if (conf->start_next_window == MaxSector) |
925 | conf->start_next_window = | 924 | conf->start_next_window = |
926 | conf->next_resync + | 925 | conf->next_resync + |
@@ -1186,6 +1185,7 @@ read_again: | |||
1186 | atomic_read(&bitmap->behind_writes) == 0); | 1185 | atomic_read(&bitmap->behind_writes) == 0); |
1187 | } | 1186 | } |
1188 | r1_bio->read_disk = rdisk; | 1187 | r1_bio->read_disk = rdisk; |
1188 | r1_bio->start_next_window = 0; | ||
1189 | 1189 | ||
1190 | read_bio = bio_clone_mddev(bio, GFP_NOIO, mddev); | 1190 | read_bio = bio_clone_mddev(bio, GFP_NOIO, mddev); |
1191 | bio_trim(read_bio, r1_bio->sector - bio->bi_iter.bi_sector, | 1191 | bio_trim(read_bio, r1_bio->sector - bio->bi_iter.bi_sector, |
@@ -1548,8 +1548,13 @@ static void close_sync(struct r1conf *conf) | |||
1548 | mempool_destroy(conf->r1buf_pool); | 1548 | mempool_destroy(conf->r1buf_pool); |
1549 | conf->r1buf_pool = NULL; | 1549 | conf->r1buf_pool = NULL; |
1550 | 1550 | ||
1551 | spin_lock_irq(&conf->resync_lock); | ||
1551 | conf->next_resync = 0; | 1552 | conf->next_resync = 0; |
1552 | conf->start_next_window = MaxSector; | 1553 | conf->start_next_window = MaxSector; |
1554 | conf->current_window_requests += | ||
1555 | conf->next_window_requests; | ||
1556 | conf->next_window_requests = 0; | ||
1557 | spin_unlock_irq(&conf->resync_lock); | ||
1553 | } | 1558 | } |
1554 | 1559 | ||
1555 | static int raid1_spare_active(struct mddev *mddev) | 1560 | static int raid1_spare_active(struct mddev *mddev) |
@@ -2150,7 +2155,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk, | |||
2150 | d--; | 2155 | d--; |
2151 | rdev = conf->mirrors[d].rdev; | 2156 | rdev = conf->mirrors[d].rdev; |
2152 | if (rdev && | 2157 | if (rdev && |
2153 | test_bit(In_sync, &rdev->flags)) | 2158 | !test_bit(Faulty, &rdev->flags)) |
2154 | r1_sync_page_io(rdev, sect, s, | 2159 | r1_sync_page_io(rdev, sect, s, |
2155 | conf->tmppage, WRITE); | 2160 | conf->tmppage, WRITE); |
2156 | } | 2161 | } |
@@ -2162,7 +2167,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk, | |||
2162 | d--; | 2167 | d--; |
2163 | rdev = conf->mirrors[d].rdev; | 2168 | rdev = conf->mirrors[d].rdev; |
2164 | if (rdev && | 2169 | if (rdev && |
2165 | test_bit(In_sync, &rdev->flags)) { | 2170 | !test_bit(Faulty, &rdev->flags)) { |
2166 | if (r1_sync_page_io(rdev, sect, s, | 2171 | if (r1_sync_page_io(rdev, sect, s, |
2167 | conf->tmppage, READ)) { | 2172 | conf->tmppage, READ)) { |
2168 | atomic_add(s, &rdev->corrected_errors); | 2173 | atomic_add(s, &rdev->corrected_errors); |
@@ -2541,9 +2546,8 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp | |||
2541 | 2546 | ||
2542 | bitmap_cond_end_sync(mddev->bitmap, sector_nr); | 2547 | bitmap_cond_end_sync(mddev->bitmap, sector_nr); |
2543 | r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); | 2548 | r1_bio = mempool_alloc(conf->r1buf_pool, GFP_NOIO); |
2544 | raise_barrier(conf); | ||
2545 | 2549 | ||
2546 | conf->next_resync = sector_nr; | 2550 | raise_barrier(conf, sector_nr); |
2547 | 2551 | ||
2548 | rcu_read_lock(); | 2552 | rcu_read_lock(); |
2549 | /* | 2553 | /* |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 183588b11fc1..9f0fbecd1eb5 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -64,6 +64,10 @@ | |||
64 | #define cpu_to_group(cpu) cpu_to_node(cpu) | 64 | #define cpu_to_group(cpu) cpu_to_node(cpu) |
65 | #define ANY_GROUP NUMA_NO_NODE | 65 | #define ANY_GROUP NUMA_NO_NODE |
66 | 66 | ||
67 | static bool devices_handle_discard_safely = false; | ||
68 | module_param(devices_handle_discard_safely, bool, 0644); | ||
69 | MODULE_PARM_DESC(devices_handle_discard_safely, | ||
70 | "Set to Y if all devices in each array reliably return zeroes on reads from discarded regions"); | ||
67 | static struct workqueue_struct *raid5_wq; | 71 | static struct workqueue_struct *raid5_wq; |
68 | /* | 72 | /* |
69 | * Stripe cache | 73 | * Stripe cache |
@@ -6208,7 +6212,7 @@ static int run(struct mddev *mddev) | |||
6208 | mddev->queue->limits.discard_granularity = stripe; | 6212 | mddev->queue->limits.discard_granularity = stripe; |
6209 | /* | 6213 | /* |
6210 | * unaligned part of discard request will be ignored, so can't | 6214 | * unaligned part of discard request will be ignored, so can't |
6211 | * guarantee discard_zerors_data | 6215 | * guarantee discard_zeroes_data |
6212 | */ | 6216 | */ |
6213 | mddev->queue->limits.discard_zeroes_data = 0; | 6217 | mddev->queue->limits.discard_zeroes_data = 0; |
6214 | 6218 | ||
@@ -6233,6 +6237,18 @@ static int run(struct mddev *mddev) | |||
6233 | !bdev_get_queue(rdev->bdev)-> | 6237 | !bdev_get_queue(rdev->bdev)-> |
6234 | limits.discard_zeroes_data) | 6238 | limits.discard_zeroes_data) |
6235 | discard_supported = false; | 6239 | discard_supported = false; |
6240 | /* Unfortunately, discard_zeroes_data is not currently | ||
6241 | * a guarantee - just a hint. So we only allow DISCARD | ||
6242 | * if the sysadmin has confirmed that only safe devices | ||
6243 | * are in use by setting a module parameter. | ||
6244 | */ | ||
6245 | if (!devices_handle_discard_safely) { | ||
6246 | if (discard_supported) { | ||
6247 | pr_info("md/raid456: discard support disabled due to uncertainty.\n"); | ||
6248 | pr_info("Set raid456.devices_handle_discard_safely=Y to override.\n"); | ||
6249 | } | ||
6250 | discard_supported = false; | ||
6251 | } | ||
6236 | } | 6252 | } |
6237 | 6253 | ||
6238 | if (discard_supported && | 6254 | if (discard_supported && |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index f60bad491eb6..3c89fcbc621e 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -182,7 +182,6 @@ config MEDIA_SUBDRV_AUTOSELECT | |||
182 | depends on HAS_IOMEM | 182 | depends on HAS_IOMEM |
183 | select I2C | 183 | select I2C |
184 | select I2C_MUX | 184 | select I2C_MUX |
185 | select SPI | ||
186 | default y | 185 | default y |
187 | help | 186 | help |
188 | By default, a media driver auto-selects all possible ancillary | 187 | By default, a media driver auto-selects all possible ancillary |
diff --git a/drivers/media/common/cx2341x.c b/drivers/media/common/cx2341x.c index 103ef6bad2e2..be763150b8aa 100644 --- a/drivers/media/common/cx2341x.c +++ b/drivers/media/common/cx2341x.c | |||
@@ -1490,6 +1490,7 @@ static struct v4l2_ctrl *cx2341x_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, | |||
1490 | { | 1490 | { |
1491 | struct v4l2_ctrl_config cfg; | 1491 | struct v4l2_ctrl_config cfg; |
1492 | 1492 | ||
1493 | memset(&cfg, 0, sizeof(cfg)); | ||
1493 | cx2341x_ctrl_fill(id, &cfg.name, &cfg.type, &min, &max, &step, &def, &cfg.flags); | 1494 | cx2341x_ctrl_fill(id, &cfg.name, &cfg.type, &min, &max, &step, &def, &cfg.flags); |
1494 | cfg.ops = &cx2341x_ops; | 1495 | cfg.ops = &cx2341x_ops; |
1495 | cfg.id = id; | 1496 | cfg.id = id; |
diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h index 5135a096bfa6..12ce19c98ded 100644 --- a/drivers/media/dvb-core/dvb-usb-ids.h +++ b/drivers/media/dvb-core/dvb-usb-ids.h | |||
@@ -280,6 +280,8 @@ | |||
280 | #define USB_PID_PCTV_400E 0x020f | 280 | #define USB_PID_PCTV_400E 0x020f |
281 | #define USB_PID_PCTV_450E 0x0222 | 281 | #define USB_PID_PCTV_450E 0x0222 |
282 | #define USB_PID_PCTV_452E 0x021f | 282 | #define USB_PID_PCTV_452E 0x021f |
283 | #define USB_PID_PCTV_78E 0x025a | ||
284 | #define USB_PID_PCTV_79E 0x0262 | ||
283 | #define USB_PID_REALTEK_RTL2831U 0x2831 | 285 | #define USB_PID_REALTEK_RTL2831U 0x2831 |
284 | #define USB_PID_REALTEK_RTL2832U 0x2832 | 286 | #define USB_PID_REALTEK_RTL2832U 0x2832 |
285 | #define USB_PID_TECHNOTREND_CONNECT_S2_3600 0x3007 | 287 | #define USB_PID_TECHNOTREND_CONNECT_S2_3600 0x3007 |
diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index be4bec2a9640..5c90ea683a7e 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c | |||
@@ -314,6 +314,19 @@ static int af9033_init(struct dvb_frontend *fe) | |||
314 | goto err; | 314 | goto err; |
315 | } | 315 | } |
316 | 316 | ||
317 | /* feed clock to RF tuner */ | ||
318 | switch (state->cfg.tuner) { | ||
319 | case AF9033_TUNER_IT9135_38: | ||
320 | case AF9033_TUNER_IT9135_51: | ||
321 | case AF9033_TUNER_IT9135_52: | ||
322 | case AF9033_TUNER_IT9135_60: | ||
323 | case AF9033_TUNER_IT9135_61: | ||
324 | case AF9033_TUNER_IT9135_62: | ||
325 | ret = af9033_wr_reg(state, 0x80fba8, 0x00); | ||
326 | if (ret < 0) | ||
327 | goto err; | ||
328 | } | ||
329 | |||
317 | /* settings for TS interface */ | 330 | /* settings for TS interface */ |
318 | if (state->cfg.ts_mode == AF9033_TS_MODE_USB) { | 331 | if (state->cfg.ts_mode == AF9033_TS_MODE_USB) { |
319 | ret = af9033_wr_reg_mask(state, 0x80f9a5, 0x00, 0x01); | 332 | ret = af9033_wr_reg_mask(state, 0x80f9a5, 0x00, 0x01); |
diff --git a/drivers/media/dvb-frontends/af9033_priv.h b/drivers/media/dvb-frontends/af9033_priv.h index fc2ad581e302..ded7b67d7526 100644 --- a/drivers/media/dvb-frontends/af9033_priv.h +++ b/drivers/media/dvb-frontends/af9033_priv.h | |||
@@ -1418,7 +1418,7 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1418 | { 0x800068, 0x0a }, | 1418 | { 0x800068, 0x0a }, |
1419 | { 0x80006a, 0x03 }, | 1419 | { 0x80006a, 0x03 }, |
1420 | { 0x800070, 0x0a }, | 1420 | { 0x800070, 0x0a }, |
1421 | { 0x800071, 0x05 }, | 1421 | { 0x800071, 0x0a }, |
1422 | { 0x800072, 0x02 }, | 1422 | { 0x800072, 0x02 }, |
1423 | { 0x800075, 0x8c }, | 1423 | { 0x800075, 0x8c }, |
1424 | { 0x800076, 0x8c }, | 1424 | { 0x800076, 0x8c }, |
@@ -1484,7 +1484,6 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1484 | { 0x800104, 0x02 }, | 1484 | { 0x800104, 0x02 }, |
1485 | { 0x800105, 0xbe }, | 1485 | { 0x800105, 0xbe }, |
1486 | { 0x800106, 0x00 }, | 1486 | { 0x800106, 0x00 }, |
1487 | { 0x800109, 0x02 }, | ||
1488 | { 0x800115, 0x0a }, | 1487 | { 0x800115, 0x0a }, |
1489 | { 0x800116, 0x03 }, | 1488 | { 0x800116, 0x03 }, |
1490 | { 0x80011a, 0xbe }, | 1489 | { 0x80011a, 0xbe }, |
@@ -1510,7 +1509,6 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1510 | { 0x80014b, 0x8c }, | 1509 | { 0x80014b, 0x8c }, |
1511 | { 0x80014d, 0xac }, | 1510 | { 0x80014d, 0xac }, |
1512 | { 0x80014e, 0xc6 }, | 1511 | { 0x80014e, 0xc6 }, |
1513 | { 0x80014f, 0x03 }, | ||
1514 | { 0x800151, 0x1e }, | 1512 | { 0x800151, 0x1e }, |
1515 | { 0x800153, 0xbc }, | 1513 | { 0x800153, 0xbc }, |
1516 | { 0x800178, 0x09 }, | 1514 | { 0x800178, 0x09 }, |
@@ -1522,9 +1520,10 @@ static const struct reg_val tuner_init_it9135_60[] = { | |||
1522 | { 0x80018d, 0x5f }, | 1520 | { 0x80018d, 0x5f }, |
1523 | { 0x80018f, 0xa0 }, | 1521 | { 0x80018f, 0xa0 }, |
1524 | { 0x800190, 0x5a }, | 1522 | { 0x800190, 0x5a }, |
1525 | { 0x80ed02, 0xff }, | 1523 | { 0x800191, 0x00 }, |
1526 | { 0x80ee42, 0xff }, | 1524 | { 0x80ed02, 0x40 }, |
1527 | { 0x80ee82, 0xff }, | 1525 | { 0x80ee42, 0x40 }, |
1526 | { 0x80ee82, 0x40 }, | ||
1528 | { 0x80f000, 0x0f }, | 1527 | { 0x80f000, 0x0f }, |
1529 | { 0x80f01f, 0x8c }, | 1528 | { 0x80f01f, 0x8c }, |
1530 | { 0x80f020, 0x00 }, | 1529 | { 0x80f020, 0x00 }, |
@@ -1699,7 +1698,6 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1699 | { 0x800104, 0x02 }, | 1698 | { 0x800104, 0x02 }, |
1700 | { 0x800105, 0xc8 }, | 1699 | { 0x800105, 0xc8 }, |
1701 | { 0x800106, 0x00 }, | 1700 | { 0x800106, 0x00 }, |
1702 | { 0x800109, 0x02 }, | ||
1703 | { 0x800115, 0x0a }, | 1701 | { 0x800115, 0x0a }, |
1704 | { 0x800116, 0x03 }, | 1702 | { 0x800116, 0x03 }, |
1705 | { 0x80011a, 0xc6 }, | 1703 | { 0x80011a, 0xc6 }, |
@@ -1725,7 +1723,6 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1725 | { 0x80014b, 0x8c }, | 1723 | { 0x80014b, 0x8c }, |
1726 | { 0x80014d, 0xa8 }, | 1724 | { 0x80014d, 0xa8 }, |
1727 | { 0x80014e, 0xc6 }, | 1725 | { 0x80014e, 0xc6 }, |
1728 | { 0x80014f, 0x03 }, | ||
1729 | { 0x800151, 0x28 }, | 1726 | { 0x800151, 0x28 }, |
1730 | { 0x800153, 0xcc }, | 1727 | { 0x800153, 0xcc }, |
1731 | { 0x800178, 0x09 }, | 1728 | { 0x800178, 0x09 }, |
@@ -1737,9 +1734,10 @@ static const struct reg_val tuner_init_it9135_61[] = { | |||
1737 | { 0x80018d, 0x5f }, | 1734 | { 0x80018d, 0x5f }, |
1738 | { 0x80018f, 0xfb }, | 1735 | { 0x80018f, 0xfb }, |
1739 | { 0x800190, 0x5c }, | 1736 | { 0x800190, 0x5c }, |
1740 | { 0x80ed02, 0xff }, | 1737 | { 0x800191, 0x00 }, |
1741 | { 0x80ee42, 0xff }, | 1738 | { 0x80ed02, 0x40 }, |
1742 | { 0x80ee82, 0xff }, | 1739 | { 0x80ee42, 0x40 }, |
1740 | { 0x80ee82, 0x40 }, | ||
1743 | { 0x80f000, 0x0f }, | 1741 | { 0x80f000, 0x0f }, |
1744 | { 0x80f01f, 0x8c }, | 1742 | { 0x80f01f, 0x8c }, |
1745 | { 0x80f020, 0x00 }, | 1743 | { 0x80f020, 0x00 }, |
diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c index 72fb5838cae0..7975c6608e20 100644 --- a/drivers/media/dvb-frontends/cx24123.c +++ b/drivers/media/dvb-frontends/cx24123.c | |||
@@ -1095,6 +1095,7 @@ struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, | |||
1095 | sizeof(state->tuner_i2c_adapter.name)); | 1095 | sizeof(state->tuner_i2c_adapter.name)); |
1096 | state->tuner_i2c_adapter.algo = &cx24123_tuner_i2c_algo; | 1096 | state->tuner_i2c_adapter.algo = &cx24123_tuner_i2c_algo; |
1097 | state->tuner_i2c_adapter.algo_data = NULL; | 1097 | state->tuner_i2c_adapter.algo_data = NULL; |
1098 | state->tuner_i2c_adapter.dev.parent = i2c->dev.parent; | ||
1098 | i2c_set_adapdata(&state->tuner_i2c_adapter, state); | 1099 | i2c_set_adapdata(&state->tuner_i2c_adapter, state); |
1099 | if (i2c_add_adapter(&state->tuner_i2c_adapter) < 0) { | 1100 | if (i2c_add_adapter(&state->tuner_i2c_adapter) < 0) { |
1100 | err("tuner i2c bus could not be initialized\n"); | 1101 | err("tuner i2c bus could not be initialized\n"); |
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index d4fa213ba74a..de88b980a837 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c | |||
@@ -2325,7 +2325,7 @@ static int adv7604_log_status(struct v4l2_subdev *sd) | |||
2325 | v4l2_info(sd, "HDCP keys read: %s%s\n", | 2325 | v4l2_info(sd, "HDCP keys read: %s%s\n", |
2326 | (hdmi_read(sd, 0x04) & 0x20) ? "yes" : "no", | 2326 | (hdmi_read(sd, 0x04) & 0x20) ? "yes" : "no", |
2327 | (hdmi_read(sd, 0x04) & 0x10) ? "ERROR" : ""); | 2327 | (hdmi_read(sd, 0x04) & 0x10) ? "ERROR" : ""); |
2328 | if (!is_hdmi(sd)) { | 2328 | if (is_hdmi(sd)) { |
2329 | bool audio_pll_locked = hdmi_read(sd, 0x04) & 0x01; | 2329 | bool audio_pll_locked = hdmi_read(sd, 0x04) & 0x01; |
2330 | bool audio_sample_packet_detect = hdmi_read(sd, 0x18) & 0x01; | 2330 | bool audio_sample_packet_detect = hdmi_read(sd, 0x18) & 0x01; |
2331 | bool audio_mute = io_read(sd, 0x65) & 0x40; | 2331 | bool audio_mute = io_read(sd, 0x65) & 0x40; |
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 1eaf975d3612..62acb10630f9 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c | |||
@@ -1282,19 +1282,12 @@ static int smiapp_set_power(struct v4l2_subdev *subdev, int on) | |||
1282 | 1282 | ||
1283 | mutex_lock(&sensor->power_mutex); | 1283 | mutex_lock(&sensor->power_mutex); |
1284 | 1284 | ||
1285 | /* | 1285 | if (on && !sensor->power_count) { |
1286 | * If the power count is modified from 0 to != 0 or from != 0 | ||
1287 | * to 0, update the power state. | ||
1288 | */ | ||
1289 | if (!sensor->power_count == !on) | ||
1290 | goto out; | ||
1291 | |||
1292 | if (on) { | ||
1293 | /* Power on and perform initialisation. */ | 1286 | /* Power on and perform initialisation. */ |
1294 | ret = smiapp_power_on(sensor); | 1287 | ret = smiapp_power_on(sensor); |
1295 | if (ret < 0) | 1288 | if (ret < 0) |
1296 | goto out; | 1289 | goto out; |
1297 | } else { | 1290 | } else if (!on && sensor->power_count == 1) { |
1298 | smiapp_power_off(sensor); | 1291 | smiapp_power_off(sensor); |
1299 | } | 1292 | } |
1300 | 1293 | ||
@@ -2572,7 +2565,7 @@ static int smiapp_registered(struct v4l2_subdev *subdev) | |||
2572 | 2565 | ||
2573 | this->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; | 2566 | this->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; |
2574 | this->sd.internal_ops = &smiapp_internal_ops; | 2567 | this->sd.internal_ops = &smiapp_internal_ops; |
2575 | this->sd.owner = NULL; | 2568 | this->sd.owner = THIS_MODULE; |
2576 | v4l2_set_subdevdata(&this->sd, client); | 2569 | v4l2_set_subdevdata(&this->sd, client); |
2577 | 2570 | ||
2578 | rval = media_entity_init(&this->sd.entity, | 2571 | rval = media_entity_init(&this->sd.entity, |
diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index 716bdc57fac6..83f5074706f9 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c | |||
@@ -1091,6 +1091,7 @@ static int cx18_probe(struct pci_dev *pci_dev, | |||
1091 | setup.addr = ADDR_UNSET; | 1091 | setup.addr = ADDR_UNSET; |
1092 | setup.type = cx->options.tuner; | 1092 | setup.type = cx->options.tuner; |
1093 | setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */ | 1093 | setup.mode_mask = T_ANALOG_TV; /* matches TV tuners */ |
1094 | setup.config = NULL; | ||
1094 | if (cx->options.radio > 0) | 1095 | if (cx->options.radio > 0) |
1095 | setup.mode_mask |= T_RADIO; | 1096 | setup.mode_mask |= T_RADIO; |
1096 | setup.tuner_callback = (setup.type == TUNER_XC2028) ? | 1097 | setup.tuner_callback = (setup.type == TUNER_XC2028) ? |
diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c index 998919e97dfe..7b35e633118d 100644 --- a/drivers/media/radio/radio-miropcm20.c +++ b/drivers/media/radio/radio-miropcm20.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/io.h> | ||
30 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
31 | #include <linux/videodev2.h> | 32 | #include <linux/videodev2.h> |
32 | #include <linux/kthread.h> | 33 | #include <linux/kthread.h> |
diff --git a/drivers/media/tuners/tuner_it913x.c b/drivers/media/tuners/tuner_it913x.c index 6f30d7e535b8..3d83c425bccf 100644 --- a/drivers/media/tuners/tuner_it913x.c +++ b/drivers/media/tuners/tuner_it913x.c | |||
@@ -396,6 +396,7 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, | |||
396 | struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config) | 396 | struct i2c_adapter *i2c_adap, u8 i2c_addr, u8 config) |
397 | { | 397 | { |
398 | struct it913x_state *state = NULL; | 398 | struct it913x_state *state = NULL; |
399 | int ret; | ||
399 | 400 | ||
400 | /* allocate memory for the internal state */ | 401 | /* allocate memory for the internal state */ |
401 | state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL); | 402 | state = kzalloc(sizeof(struct it913x_state), GFP_KERNEL); |
@@ -425,6 +426,11 @@ struct dvb_frontend *it913x_attach(struct dvb_frontend *fe, | |||
425 | state->tuner_type = config; | 426 | state->tuner_type = config; |
426 | state->firmware_ver = 1; | 427 | state->firmware_ver = 1; |
427 | 428 | ||
429 | /* tuner RF initial */ | ||
430 | ret = it913x_wr_reg(state, PRO_DMOD, 0xec4c, 0x68); | ||
431 | if (ret < 0) | ||
432 | goto error; | ||
433 | |||
428 | fe->tuner_priv = state; | 434 | fe->tuner_priv = state; |
429 | memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops, | 435 | memcpy(&fe->ops.tuner_ops, &it913x_tuner_ops, |
430 | sizeof(struct dvb_tuner_ops)); | 436 | sizeof(struct dvb_tuner_ops)); |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 75ec1c659fdd..c82beac0e0cb 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -1575,6 +1575,10 @@ static const struct usb_device_id af9035_id_table[] = { | |||
1575 | &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, | 1575 | &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, |
1576 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900, | 1576 | { DVB_USB_DEVICE(USB_VID_HAUPPAUGE, 0xf900, |
1577 | &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) }, | 1577 | &af9035_props, "Hauppauge WinTV-MiniStick 2", NULL) }, |
1578 | { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_78E, | ||
1579 | &af9035_props, "PCTV 78e", RC_MAP_IT913X_V1) }, | ||
1580 | { DVB_USB_DEVICE(USB_VID_PCTV, USB_PID_PCTV_79E, | ||
1581 | &af9035_props, "PCTV 79e", RC_MAP_IT913X_V2) }, | ||
1578 | { } | 1582 | { } |
1579 | }; | 1583 | }; |
1580 | MODULE_DEVICE_TABLE(usb, af9035_id_table); | 1584 | MODULE_DEVICE_TABLE(usb, af9035_id_table); |
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index a7e24848f6c8..9da812b8a786 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c | |||
@@ -3524,6 +3524,7 @@ static struct usb_driver em28xx_usb_driver = { | |||
3524 | .disconnect = em28xx_usb_disconnect, | 3524 | .disconnect = em28xx_usb_disconnect, |
3525 | .suspend = em28xx_usb_suspend, | 3525 | .suspend = em28xx_usb_suspend, |
3526 | .resume = em28xx_usb_resume, | 3526 | .resume = em28xx_usb_resume, |
3527 | .reset_resume = em28xx_usb_resume, | ||
3527 | .id_table = em28xx_id_table, | 3528 | .id_table = em28xx_id_table, |
3528 | }; | 3529 | }; |
3529 | 3530 | ||
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 90dec2955f1c..29abc379551e 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c | |||
@@ -1342,7 +1342,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1342 | struct em28xx *dev = video_drvdata(file); | 1342 | struct em28xx *dev = video_drvdata(file); |
1343 | struct em28xx_v4l2 *v4l2 = dev->v4l2; | 1343 | struct em28xx_v4l2 *v4l2 = dev->v4l2; |
1344 | 1344 | ||
1345 | if (v4l2->streaming_users > 0) | 1345 | if (vb2_is_busy(&v4l2->vb_vidq)) |
1346 | return -EBUSY; | 1346 | return -EBUSY; |
1347 | 1347 | ||
1348 | vidioc_try_fmt_vid_cap(file, priv, f); | 1348 | vidioc_try_fmt_vid_cap(file, priv, f); |
@@ -1883,8 +1883,9 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1883 | return -EINVAL; | 1883 | return -EINVAL; |
1884 | } | 1884 | } |
1885 | 1885 | ||
1886 | em28xx_videodbg("open dev=%s type=%s\n", | 1886 | em28xx_videodbg("open dev=%s type=%s users=%d\n", |
1887 | video_device_node_name(vdev), v4l2_type_names[fh_type]); | 1887 | video_device_node_name(vdev), v4l2_type_names[fh_type], |
1888 | v4l2->users); | ||
1888 | 1889 | ||
1889 | if (mutex_lock_interruptible(&dev->lock)) | 1890 | if (mutex_lock_interruptible(&dev->lock)) |
1890 | return -ERESTARTSYS; | 1891 | return -ERESTARTSYS; |
@@ -1897,9 +1898,7 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1897 | return ret; | 1898 | return ret; |
1898 | } | 1899 | } |
1899 | 1900 | ||
1900 | if (v4l2_fh_is_singular_file(filp)) { | 1901 | if (v4l2->users == 0) { |
1901 | em28xx_videodbg("first opened filehandle, initializing device\n"); | ||
1902 | |||
1903 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); | 1902 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); |
1904 | 1903 | ||
1905 | if (vdev->vfl_type != VFL_TYPE_RADIO) | 1904 | if (vdev->vfl_type != VFL_TYPE_RADIO) |
@@ -1910,8 +1909,6 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1910 | * of some i2c devices | 1909 | * of some i2c devices |
1911 | */ | 1910 | */ |
1912 | em28xx_wake_i2c(dev); | 1911 | em28xx_wake_i2c(dev); |
1913 | } else { | ||
1914 | em28xx_videodbg("further filehandles are already opened\n"); | ||
1915 | } | 1912 | } |
1916 | 1913 | ||
1917 | if (vdev->vfl_type == VFL_TYPE_RADIO) { | 1914 | if (vdev->vfl_type == VFL_TYPE_RADIO) { |
@@ -1921,6 +1918,7 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1921 | 1918 | ||
1922 | kref_get(&dev->ref); | 1919 | kref_get(&dev->ref); |
1923 | kref_get(&v4l2->ref); | 1920 | kref_get(&v4l2->ref); |
1921 | v4l2->users++; | ||
1924 | 1922 | ||
1925 | mutex_unlock(&dev->lock); | 1923 | mutex_unlock(&dev->lock); |
1926 | 1924 | ||
@@ -2027,11 +2025,12 @@ static int em28xx_v4l2_close(struct file *filp) | |||
2027 | struct em28xx_v4l2 *v4l2 = dev->v4l2; | 2025 | struct em28xx_v4l2 *v4l2 = dev->v4l2; |
2028 | int errCode; | 2026 | int errCode; |
2029 | 2027 | ||
2030 | mutex_lock(&dev->lock); | 2028 | em28xx_videodbg("users=%d\n", v4l2->users); |
2031 | 2029 | ||
2032 | if (v4l2_fh_is_singular_file(filp)) { | 2030 | vb2_fop_release(filp); |
2033 | em28xx_videodbg("last opened filehandle, shutting down device\n"); | 2031 | mutex_lock(&dev->lock); |
2034 | 2032 | ||
2033 | if (v4l2->users == 1) { | ||
2035 | /* No sense to try to write to the device */ | 2034 | /* No sense to try to write to the device */ |
2036 | if (dev->disconnected) | 2035 | if (dev->disconnected) |
2037 | goto exit; | 2036 | goto exit; |
@@ -2050,12 +2049,10 @@ static int em28xx_v4l2_close(struct file *filp) | |||
2050 | em28xx_errdev("cannot change alternate number to " | 2049 | em28xx_errdev("cannot change alternate number to " |
2051 | "0 (error=%i)\n", errCode); | 2050 | "0 (error=%i)\n", errCode); |
2052 | } | 2051 | } |
2053 | } else { | ||
2054 | em28xx_videodbg("further opened filehandles left\n"); | ||
2055 | } | 2052 | } |
2056 | 2053 | ||
2057 | exit: | 2054 | exit: |
2058 | vb2_fop_release(filp); | 2055 | v4l2->users--; |
2059 | kref_put(&v4l2->ref, em28xx_free_v4l2); | 2056 | kref_put(&v4l2->ref, em28xx_free_v4l2); |
2060 | mutex_unlock(&dev->lock); | 2057 | mutex_unlock(&dev->lock); |
2061 | kref_put(&dev->ref, em28xx_free_device); | 2058 | kref_put(&dev->ref, em28xx_free_device); |
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h index 84ef8efdb148..4360338e7b31 100644 --- a/drivers/media/usb/em28xx/em28xx.h +++ b/drivers/media/usb/em28xx/em28xx.h | |||
@@ -524,6 +524,7 @@ struct em28xx_v4l2 { | |||
524 | int sensor_yres; | 524 | int sensor_yres; |
525 | int sensor_xtal; | 525 | int sensor_xtal; |
526 | 526 | ||
527 | int users; /* user count for exclusive use */ | ||
527 | int streaming_users; /* number of actively streaming users */ | 528 | int streaming_users; /* number of actively streaming users */ |
528 | 529 | ||
529 | u32 frequency; /* selected tuner frequency */ | 530 | u32 frequency; /* selected tuner frequency */ |
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index c359006074a8..25d3ae2188cb 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c | |||
@@ -971,6 +971,7 @@ static int __reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
971 | * to the userspace. | 971 | * to the userspace. |
972 | */ | 972 | */ |
973 | req->count = allocated_buffers; | 973 | req->count = allocated_buffers; |
974 | q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); | ||
974 | 975 | ||
975 | return 0; | 976 | return 0; |
976 | } | 977 | } |
@@ -1018,6 +1019,7 @@ static int __create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create | |||
1018 | memset(q->plane_sizes, 0, sizeof(q->plane_sizes)); | 1019 | memset(q->plane_sizes, 0, sizeof(q->plane_sizes)); |
1019 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); | 1020 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); |
1020 | q->memory = create->memory; | 1021 | q->memory = create->memory; |
1022 | q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); | ||
1021 | } | 1023 | } |
1022 | 1024 | ||
1023 | num_buffers = min(create->count, VIDEO_MAX_FRAME - q->num_buffers); | 1025 | num_buffers = min(create->count, VIDEO_MAX_FRAME - q->num_buffers); |
@@ -1130,7 +1132,7 @@ EXPORT_SYMBOL_GPL(vb2_plane_vaddr); | |||
1130 | */ | 1132 | */ |
1131 | void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) | 1133 | void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no) |
1132 | { | 1134 | { |
1133 | if (plane_no > vb->num_planes || !vb->planes[plane_no].mem_priv) | 1135 | if (plane_no >= vb->num_planes || !vb->planes[plane_no].mem_priv) |
1134 | return NULL; | 1136 | return NULL; |
1135 | 1137 | ||
1136 | return call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv); | 1138 | return call_ptr_memop(vb, cookie, vb->planes[plane_no].mem_priv); |
@@ -1165,13 +1167,10 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) | |||
1165 | if (WARN_ON(vb->state != VB2_BUF_STATE_ACTIVE)) | 1167 | if (WARN_ON(vb->state != VB2_BUF_STATE_ACTIVE)) |
1166 | return; | 1168 | return; |
1167 | 1169 | ||
1168 | if (!q->start_streaming_called) { | 1170 | if (WARN_ON(state != VB2_BUF_STATE_DONE && |
1169 | if (WARN_ON(state != VB2_BUF_STATE_QUEUED)) | 1171 | state != VB2_BUF_STATE_ERROR && |
1170 | state = VB2_BUF_STATE_QUEUED; | 1172 | state != VB2_BUF_STATE_QUEUED)) |
1171 | } else if (WARN_ON(state != VB2_BUF_STATE_DONE && | 1173 | state = VB2_BUF_STATE_ERROR; |
1172 | state != VB2_BUF_STATE_ERROR)) { | ||
1173 | state = VB2_BUF_STATE_ERROR; | ||
1174 | } | ||
1175 | 1174 | ||
1176 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1175 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1177 | /* | 1176 | /* |
@@ -1762,6 +1761,12 @@ static int vb2_start_streaming(struct vb2_queue *q) | |||
1762 | q->start_streaming_called = 0; | 1761 | q->start_streaming_called = 0; |
1763 | 1762 | ||
1764 | dprintk(1, "driver refused to start streaming\n"); | 1763 | dprintk(1, "driver refused to start streaming\n"); |
1764 | /* | ||
1765 | * If you see this warning, then the driver isn't cleaning up properly | ||
1766 | * after a failed start_streaming(). See the start_streaming() | ||
1767 | * documentation in videobuf2-core.h for more information how buffers | ||
1768 | * should be returned to vb2 in start_streaming(). | ||
1769 | */ | ||
1765 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { | 1770 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { |
1766 | unsigned i; | 1771 | unsigned i; |
1767 | 1772 | ||
@@ -1777,6 +1782,12 @@ static int vb2_start_streaming(struct vb2_queue *q) | |||
1777 | /* Must be zero now */ | 1782 | /* Must be zero now */ |
1778 | WARN_ON(atomic_read(&q->owned_by_drv_count)); | 1783 | WARN_ON(atomic_read(&q->owned_by_drv_count)); |
1779 | } | 1784 | } |
1785 | /* | ||
1786 | * If done_list is not empty, then start_streaming() didn't call | ||
1787 | * vb2_buffer_done(vb, VB2_BUF_STATE_QUEUED) but STATE_ERROR or | ||
1788 | * STATE_DONE. | ||
1789 | */ | ||
1790 | WARN_ON(!list_empty(&q->done_list)); | ||
1780 | return ret; | 1791 | return ret; |
1781 | } | 1792 | } |
1782 | 1793 | ||
@@ -1812,6 +1823,7 @@ static int vb2_internal_qbuf(struct vb2_queue *q, struct v4l2_buffer *b) | |||
1812 | */ | 1823 | */ |
1813 | list_add_tail(&vb->queued_entry, &q->queued_list); | 1824 | list_add_tail(&vb->queued_entry, &q->queued_list); |
1814 | q->queued_count++; | 1825 | q->queued_count++; |
1826 | q->waiting_for_buffers = false; | ||
1815 | vb->state = VB2_BUF_STATE_QUEUED; | 1827 | vb->state = VB2_BUF_STATE_QUEUED; |
1816 | if (V4L2_TYPE_IS_OUTPUT(q->type)) { | 1828 | if (V4L2_TYPE_IS_OUTPUT(q->type)) { |
1817 | /* | 1829 | /* |
@@ -2123,6 +2135,12 @@ static void __vb2_queue_cancel(struct vb2_queue *q) | |||
2123 | if (q->start_streaming_called) | 2135 | if (q->start_streaming_called) |
2124 | call_void_qop(q, stop_streaming, q); | 2136 | call_void_qop(q, stop_streaming, q); |
2125 | 2137 | ||
2138 | /* | ||
2139 | * If you see this warning, then the driver isn't cleaning up properly | ||
2140 | * in stop_streaming(). See the stop_streaming() documentation in | ||
2141 | * videobuf2-core.h for more information how buffers should be returned | ||
2142 | * to vb2 in stop_streaming(). | ||
2143 | */ | ||
2126 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { | 2144 | if (WARN_ON(atomic_read(&q->owned_by_drv_count))) { |
2127 | for (i = 0; i < q->num_buffers; ++i) | 2145 | for (i = 0; i < q->num_buffers; ++i) |
2128 | if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) | 2146 | if (q->bufs[i]->state == VB2_BUF_STATE_ACTIVE) |
@@ -2272,6 +2290,7 @@ static int vb2_internal_streamoff(struct vb2_queue *q, enum v4l2_buf_type type) | |||
2272 | * their normal dequeued state. | 2290 | * their normal dequeued state. |
2273 | */ | 2291 | */ |
2274 | __vb2_queue_cancel(q); | 2292 | __vb2_queue_cancel(q); |
2293 | q->waiting_for_buffers = !V4L2_TYPE_IS_OUTPUT(q->type); | ||
2275 | 2294 | ||
2276 | dprintk(3, "successful\n"); | 2295 | dprintk(3, "successful\n"); |
2277 | return 0; | 2296 | return 0; |
@@ -2590,10 +2609,17 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) | |||
2590 | } | 2609 | } |
2591 | 2610 | ||
2592 | /* | 2611 | /* |
2593 | * There is nothing to wait for if no buffer has been queued and the | 2612 | * There is nothing to wait for if the queue isn't streaming, or if the |
2594 | * queue isn't streaming, or if the error flag is set. | 2613 | * error flag is set. |
2614 | */ | ||
2615 | if (!vb2_is_streaming(q) || q->error) | ||
2616 | return res | POLLERR; | ||
2617 | /* | ||
2618 | * For compatibility with vb1: if QBUF hasn't been called yet, then | ||
2619 | * return POLLERR as well. This only affects capture queues, output | ||
2620 | * queues will always initialize waiting_for_buffers to false. | ||
2595 | */ | 2621 | */ |
2596 | if ((list_empty(&q->queued_list) && !vb2_is_streaming(q)) || q->error) | 2622 | if (q->waiting_for_buffers) |
2597 | return res | POLLERR; | 2623 | return res | POLLERR; |
2598 | 2624 | ||
2599 | /* | 2625 | /* |
diff --git a/drivers/media/v4l2-core/videobuf2-dma-sg.c b/drivers/media/v4l2-core/videobuf2-dma-sg.c index adefc31bb853..9b163a440f89 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-sg.c +++ b/drivers/media/v4l2-core/videobuf2-dma-sg.c | |||
@@ -113,7 +113,7 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size, gfp_t gfp_fla | |||
113 | goto fail_pages_alloc; | 113 | goto fail_pages_alloc; |
114 | 114 | ||
115 | ret = sg_alloc_table_from_pages(&buf->sg_table, buf->pages, | 115 | ret = sg_alloc_table_from_pages(&buf->sg_table, buf->pages, |
116 | buf->num_pages, 0, size, gfp_flags); | 116 | buf->num_pages, 0, size, GFP_KERNEL); |
117 | if (ret) | 117 | if (ret) |
118 | goto fail_table_alloc; | 118 | goto fail_table_alloc; |
119 | 119 | ||
diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig index a34a11d2fef2..63ca9841db10 100644 --- a/drivers/message/fusion/Kconfig +++ b/drivers/message/fusion/Kconfig | |||
@@ -29,7 +29,7 @@ config FUSION_SPI | |||
29 | config FUSION_FC | 29 | config FUSION_FC |
30 | tristate "Fusion MPT ScsiHost drivers for FC" | 30 | tristate "Fusion MPT ScsiHost drivers for FC" |
31 | depends on PCI && SCSI | 31 | depends on PCI && SCSI |
32 | select SCSI_FC_ATTRS | 32 | depends on SCSI_FC_ATTRS |
33 | ---help--- | 33 | ---help--- |
34 | SCSI HOST support for a Fiber Channel host adapters. | 34 | SCSI HOST support for a Fiber Channel host adapters. |
35 | 35 | ||
diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c index 7ffdb589841e..7e1efd5f58f0 100644 --- a/drivers/misc/lattice-ecp3-config.c +++ b/drivers/misc/lattice-ecp3-config.c | |||
@@ -79,6 +79,11 @@ static void firmware_load(const struct firmware *fw, void *context) | |||
79 | u32 jedec_id; | 79 | u32 jedec_id; |
80 | u32 status; | 80 | u32 status; |
81 | 81 | ||
82 | if (fw == NULL) { | ||
83 | dev_err(&spi->dev, "Cannot load firmware, aborting\n"); | ||
84 | return; | ||
85 | } | ||
86 | |||
82 | if (fw->size == 0) { | 87 | if (fw->size == 0) { |
83 | dev_err(&spi->dev, "Error: Firmware size is 0!\n"); | 88 | dev_err(&spi->dev, "Error: Firmware size is 0!\n"); |
84 | return; | 89 | return; |
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 5a4bfe33112a..46c4643b7a07 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c | |||
@@ -1434,6 +1434,10 @@ static int cfi_amdstd_otp_walk(struct mtd_info *mtd, loff_t from, size_t len, | |||
1434 | 1434 | ||
1435 | mutex_lock(&chip->mutex); | 1435 | mutex_lock(&chip->mutex); |
1436 | ret = get_chip(map, chip, base, FL_LOCKING); | 1436 | ret = get_chip(map, chip, base, FL_LOCKING); |
1437 | if (ret) { | ||
1438 | mutex_unlock(&chip->mutex); | ||
1439 | return ret; | ||
1440 | } | ||
1437 | 1441 | ||
1438 | /* Enter lock register command */ | 1442 | /* Enter lock register command */ |
1439 | cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, | 1443 | cfi_send_gen_cmd(0xAA, cfi->addr_unlock1, |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index f0f5eab0fab1..798ae69fb63c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -175,7 +175,7 @@ MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to " | |||
175 | "the same MAC; 0 for none (default), " | 175 | "the same MAC; 0 for none (default), " |
176 | "1 for active, 2 for follow"); | 176 | "1 for active, 2 for follow"); |
177 | module_param(all_slaves_active, int, 0); | 177 | module_param(all_slaves_active, int, 0); |
178 | MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface" | 178 | MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface " |
179 | "by setting active flag for all slaves; " | 179 | "by setting active flag for all slaves; " |
180 | "0 for never (default), 1 for always."); | 180 | "0 for never (default), 1 for always."); |
181 | module_param(resend_igmp, int, 0); | 181 | module_param(resend_igmp, int, 0); |
@@ -3659,8 +3659,14 @@ static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev | |||
3659 | else | 3659 | else |
3660 | bond_xmit_slave_id(bond, skb, 0); | 3660 | bond_xmit_slave_id(bond, skb, 0); |
3661 | } else { | 3661 | } else { |
3662 | slave_id = bond_rr_gen_slave_id(bond); | 3662 | int slave_cnt = ACCESS_ONCE(bond->slave_cnt); |
3663 | bond_xmit_slave_id(bond, skb, slave_id % bond->slave_cnt); | 3663 | |
3664 | if (likely(slave_cnt)) { | ||
3665 | slave_id = bond_rr_gen_slave_id(bond); | ||
3666 | bond_xmit_slave_id(bond, skb, slave_id % slave_cnt); | ||
3667 | } else { | ||
3668 | dev_kfree_skb_any(skb); | ||
3669 | } | ||
3664 | } | 3670 | } |
3665 | 3671 | ||
3666 | return NETDEV_TX_OK; | 3672 | return NETDEV_TX_OK; |
@@ -3691,8 +3697,13 @@ static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_d | |||
3691 | static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) | 3697 | static int bond_xmit_xor(struct sk_buff *skb, struct net_device *bond_dev) |
3692 | { | 3698 | { |
3693 | struct bonding *bond = netdev_priv(bond_dev); | 3699 | struct bonding *bond = netdev_priv(bond_dev); |
3700 | int slave_cnt = ACCESS_ONCE(bond->slave_cnt); | ||
3694 | 3701 | ||
3695 | bond_xmit_slave_id(bond, skb, bond_xmit_hash(bond, skb) % bond->slave_cnt); | 3702 | if (likely(slave_cnt)) |
3703 | bond_xmit_slave_id(bond, skb, | ||
3704 | bond_xmit_hash(bond, skb) % slave_cnt); | ||
3705 | else | ||
3706 | dev_kfree_skb_any(skb); | ||
3696 | 3707 | ||
3697 | return NETDEV_TX_OK; | 3708 | return NETDEV_TX_OK; |
3698 | } | 3709 | } |
diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index f07fa89b5fd5..05e1aa090add 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c | |||
@@ -1123,7 +1123,9 @@ static int at91_open(struct net_device *dev) | |||
1123 | struct at91_priv *priv = netdev_priv(dev); | 1123 | struct at91_priv *priv = netdev_priv(dev); |
1124 | int err; | 1124 | int err; |
1125 | 1125 | ||
1126 | clk_enable(priv->clk); | 1126 | err = clk_prepare_enable(priv->clk); |
1127 | if (err) | ||
1128 | return err; | ||
1127 | 1129 | ||
1128 | /* check or determine and set bittime */ | 1130 | /* check or determine and set bittime */ |
1129 | err = open_candev(dev); | 1131 | err = open_candev(dev); |
@@ -1149,7 +1151,7 @@ static int at91_open(struct net_device *dev) | |||
1149 | out_close: | 1151 | out_close: |
1150 | close_candev(dev); | 1152 | close_candev(dev); |
1151 | out: | 1153 | out: |
1152 | clk_disable(priv->clk); | 1154 | clk_disable_unprepare(priv->clk); |
1153 | 1155 | ||
1154 | return err; | 1156 | return err; |
1155 | } | 1157 | } |
@@ -1166,7 +1168,7 @@ static int at91_close(struct net_device *dev) | |||
1166 | at91_chip_stop(dev, CAN_STATE_STOPPED); | 1168 | at91_chip_stop(dev, CAN_STATE_STOPPED); |
1167 | 1169 | ||
1168 | free_irq(dev->irq, dev); | 1170 | free_irq(dev->irq, dev); |
1169 | clk_disable(priv->clk); | 1171 | clk_disable_unprepare(priv->clk); |
1170 | 1172 | ||
1171 | close_candev(dev); | 1173 | close_candev(dev); |
1172 | 1174 | ||
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c index 109cb44291f5..fb279d6ae484 100644 --- a/drivers/net/can/c_can/c_can_platform.c +++ b/drivers/net/can/c_can/c_can_platform.c | |||
@@ -97,14 +97,14 @@ static void c_can_hw_raminit_ti(const struct c_can_priv *priv, bool enable) | |||
97 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); | 97 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); |
98 | writel(ctrl, priv->raminit_ctrlreg); | 98 | writel(ctrl, priv->raminit_ctrlreg); |
99 | ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance); | 99 | ctrl &= ~CAN_RAMINIT_DONE_MASK(priv->instance); |
100 | c_can_hw_raminit_wait_ti(priv, ctrl, mask); | 100 | c_can_hw_raminit_wait_ti(priv, mask, ctrl); |
101 | 101 | ||
102 | if (enable) { | 102 | if (enable) { |
103 | /* Set start bit and wait for the done bit. */ | 103 | /* Set start bit and wait for the done bit. */ |
104 | ctrl |= CAN_RAMINIT_START_MASK(priv->instance); | 104 | ctrl |= CAN_RAMINIT_START_MASK(priv->instance); |
105 | writel(ctrl, priv->raminit_ctrlreg); | 105 | writel(ctrl, priv->raminit_ctrlreg); |
106 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); | 106 | ctrl |= CAN_RAMINIT_DONE_MASK(priv->instance); |
107 | c_can_hw_raminit_wait_ti(priv, ctrl, mask); | 107 | c_can_hw_raminit_wait_ti(priv, mask, ctrl); |
108 | } | 108 | } |
109 | spin_unlock(&raminit_lock); | 109 | spin_unlock(&raminit_lock); |
110 | } | 110 | } |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 944aa5d3af6e..6586309329e6 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
@@ -62,7 +62,7 @@ | |||
62 | #define FLEXCAN_MCR_BCC BIT(16) | 62 | #define FLEXCAN_MCR_BCC BIT(16) |
63 | #define FLEXCAN_MCR_LPRIO_EN BIT(13) | 63 | #define FLEXCAN_MCR_LPRIO_EN BIT(13) |
64 | #define FLEXCAN_MCR_AEN BIT(12) | 64 | #define FLEXCAN_MCR_AEN BIT(12) |
65 | #define FLEXCAN_MCR_MAXMB(x) ((x) & 0x1f) | 65 | #define FLEXCAN_MCR_MAXMB(x) ((x) & 0x7f) |
66 | #define FLEXCAN_MCR_IDAM_A (0 << 8) | 66 | #define FLEXCAN_MCR_IDAM_A (0 << 8) |
67 | #define FLEXCAN_MCR_IDAM_B (1 << 8) | 67 | #define FLEXCAN_MCR_IDAM_B (1 << 8) |
68 | #define FLEXCAN_MCR_IDAM_C (2 << 8) | 68 | #define FLEXCAN_MCR_IDAM_C (2 << 8) |
@@ -125,7 +125,9 @@ | |||
125 | FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) | 125 | FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT) |
126 | 126 | ||
127 | /* FLEXCAN interrupt flag register (IFLAG) bits */ | 127 | /* FLEXCAN interrupt flag register (IFLAG) bits */ |
128 | #define FLEXCAN_TX_BUF_ID 8 | 128 | /* Errata ERR005829 step7: Reserve first valid MB */ |
129 | #define FLEXCAN_TX_BUF_RESERVED 8 | ||
130 | #define FLEXCAN_TX_BUF_ID 9 | ||
129 | #define FLEXCAN_IFLAG_BUF(x) BIT(x) | 131 | #define FLEXCAN_IFLAG_BUF(x) BIT(x) |
130 | #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) | 132 | #define FLEXCAN_IFLAG_RX_FIFO_OVERFLOW BIT(7) |
131 | #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) | 133 | #define FLEXCAN_IFLAG_RX_FIFO_WARN BIT(6) |
@@ -136,6 +138,17 @@ | |||
136 | 138 | ||
137 | /* FLEXCAN message buffers */ | 139 | /* FLEXCAN message buffers */ |
138 | #define FLEXCAN_MB_CNT_CODE(x) (((x) & 0xf) << 24) | 140 | #define FLEXCAN_MB_CNT_CODE(x) (((x) & 0xf) << 24) |
141 | #define FLEXCAN_MB_CODE_RX_INACTIVE (0x0 << 24) | ||
142 | #define FLEXCAN_MB_CODE_RX_EMPTY (0x4 << 24) | ||
143 | #define FLEXCAN_MB_CODE_RX_FULL (0x2 << 24) | ||
144 | #define FLEXCAN_MB_CODE_RX_OVERRRUN (0x6 << 24) | ||
145 | #define FLEXCAN_MB_CODE_RX_RANSWER (0xa << 24) | ||
146 | |||
147 | #define FLEXCAN_MB_CODE_TX_INACTIVE (0x8 << 24) | ||
148 | #define FLEXCAN_MB_CODE_TX_ABORT (0x9 << 24) | ||
149 | #define FLEXCAN_MB_CODE_TX_DATA (0xc << 24) | ||
150 | #define FLEXCAN_MB_CODE_TX_TANSWER (0xe << 24) | ||
151 | |||
139 | #define FLEXCAN_MB_CNT_SRR BIT(22) | 152 | #define FLEXCAN_MB_CNT_SRR BIT(22) |
140 | #define FLEXCAN_MB_CNT_IDE BIT(21) | 153 | #define FLEXCAN_MB_CNT_IDE BIT(21) |
141 | #define FLEXCAN_MB_CNT_RTR BIT(20) | 154 | #define FLEXCAN_MB_CNT_RTR BIT(20) |
@@ -298,7 +311,7 @@ static int flexcan_chip_enable(struct flexcan_priv *priv) | |||
298 | flexcan_write(reg, ®s->mcr); | 311 | flexcan_write(reg, ®s->mcr); |
299 | 312 | ||
300 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 313 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
301 | usleep_range(10, 20); | 314 | udelay(10); |
302 | 315 | ||
303 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) | 316 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK) |
304 | return -ETIMEDOUT; | 317 | return -ETIMEDOUT; |
@@ -317,7 +330,7 @@ static int flexcan_chip_disable(struct flexcan_priv *priv) | |||
317 | flexcan_write(reg, ®s->mcr); | 330 | flexcan_write(reg, ®s->mcr); |
318 | 331 | ||
319 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 332 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
320 | usleep_range(10, 20); | 333 | udelay(10); |
321 | 334 | ||
322 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) | 335 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_LPM_ACK)) |
323 | return -ETIMEDOUT; | 336 | return -ETIMEDOUT; |
@@ -336,7 +349,7 @@ static int flexcan_chip_freeze(struct flexcan_priv *priv) | |||
336 | flexcan_write(reg, ®s->mcr); | 349 | flexcan_write(reg, ®s->mcr); |
337 | 350 | ||
338 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 351 | while (timeout-- && !(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
339 | usleep_range(100, 200); | 352 | udelay(100); |
340 | 353 | ||
341 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 354 | if (!(flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
342 | return -ETIMEDOUT; | 355 | return -ETIMEDOUT; |
@@ -355,7 +368,7 @@ static int flexcan_chip_unfreeze(struct flexcan_priv *priv) | |||
355 | flexcan_write(reg, ®s->mcr); | 368 | flexcan_write(reg, ®s->mcr); |
356 | 369 | ||
357 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) | 370 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK)) |
358 | usleep_range(10, 20); | 371 | udelay(10); |
359 | 372 | ||
360 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK) | 373 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_FRZ_ACK) |
361 | return -ETIMEDOUT; | 374 | return -ETIMEDOUT; |
@@ -370,7 +383,7 @@ static int flexcan_chip_softreset(struct flexcan_priv *priv) | |||
370 | 383 | ||
371 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); | 384 | flexcan_write(FLEXCAN_MCR_SOFTRST, ®s->mcr); |
372 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST)) | 385 | while (timeout-- && (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST)) |
373 | usleep_range(10, 20); | 386 | udelay(10); |
374 | 387 | ||
375 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST) | 388 | if (flexcan_read(®s->mcr) & FLEXCAN_MCR_SOFTRST) |
376 | return -ETIMEDOUT; | 389 | return -ETIMEDOUT; |
@@ -428,6 +441,14 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
428 | flexcan_write(can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_id); | 441 | flexcan_write(can_id, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_id); |
429 | flexcan_write(ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | 442 | flexcan_write(ctrl, ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); |
430 | 443 | ||
444 | /* Errata ERR005829 step8: | ||
445 | * Write twice INACTIVE(0x8) code to first MB. | ||
446 | */ | ||
447 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
448 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
449 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
450 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
451 | |||
431 | return NETDEV_TX_OK; | 452 | return NETDEV_TX_OK; |
432 | } | 453 | } |
433 | 454 | ||
@@ -744,6 +765,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) | |||
744 | stats->tx_bytes += can_get_echo_skb(dev, 0); | 765 | stats->tx_bytes += can_get_echo_skb(dev, 0); |
745 | stats->tx_packets++; | 766 | stats->tx_packets++; |
746 | can_led_event(dev, CAN_LED_EVENT_TX); | 767 | can_led_event(dev, CAN_LED_EVENT_TX); |
768 | /* after sending a RTR frame mailbox is in RX mode */ | ||
769 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
770 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | ||
747 | flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1); | 771 | flexcan_write((1 << FLEXCAN_TX_BUF_ID), ®s->iflag1); |
748 | netif_wake_queue(dev); | 772 | netif_wake_queue(dev); |
749 | } | 773 | } |
@@ -801,6 +825,7 @@ static int flexcan_chip_start(struct net_device *dev) | |||
801 | struct flexcan_regs __iomem *regs = priv->base; | 825 | struct flexcan_regs __iomem *regs = priv->base; |
802 | int err; | 826 | int err; |
803 | u32 reg_mcr, reg_ctrl; | 827 | u32 reg_mcr, reg_ctrl; |
828 | int i; | ||
804 | 829 | ||
805 | /* enable module */ | 830 | /* enable module */ |
806 | err = flexcan_chip_enable(priv); | 831 | err = flexcan_chip_enable(priv); |
@@ -867,8 +892,18 @@ static int flexcan_chip_start(struct net_device *dev) | |||
867 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); | 892 | netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); |
868 | flexcan_write(reg_ctrl, ®s->ctrl); | 893 | flexcan_write(reg_ctrl, ®s->ctrl); |
869 | 894 | ||
870 | /* Abort any pending TX, mark Mailbox as INACTIVE */ | 895 | /* clear and invalidate all mailboxes first */ |
871 | flexcan_write(FLEXCAN_MB_CNT_CODE(0x4), | 896 | for (i = FLEXCAN_TX_BUF_ID; i < ARRAY_SIZE(regs->cantxfg); i++) { |
897 | flexcan_write(FLEXCAN_MB_CODE_RX_INACTIVE, | ||
898 | ®s->cantxfg[i].can_ctrl); | ||
899 | } | ||
900 | |||
901 | /* Errata ERR005829: mark first TX mailbox as INACTIVE */ | ||
902 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
903 | ®s->cantxfg[FLEXCAN_TX_BUF_RESERVED].can_ctrl); | ||
904 | |||
905 | /* mark TX mailbox as INACTIVE */ | ||
906 | flexcan_write(FLEXCAN_MB_CODE_TX_INACTIVE, | ||
872 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); | 907 | ®s->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); |
873 | 908 | ||
874 | /* acceptance mask/acceptance code (accept everything) */ | 909 | /* acceptance mask/acceptance code (accept everything) */ |
diff --git a/drivers/net/can/sja1000/peak_pci.c b/drivers/net/can/sja1000/peak_pci.c index 7a85590fefb9..e5fac368068a 100644 --- a/drivers/net/can/sja1000/peak_pci.c +++ b/drivers/net/can/sja1000/peak_pci.c | |||
@@ -70,6 +70,8 @@ struct peak_pci_chan { | |||
70 | #define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ | 70 | #define PEAK_PC_104P_DEVICE_ID 0x0006 /* PCAN-PC/104+ cards */ |
71 | #define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ | 71 | #define PEAK_PCI_104E_DEVICE_ID 0x0007 /* PCAN-PCI/104 Express cards */ |
72 | #define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ | 72 | #define PEAK_MPCIE_DEVICE_ID 0x0008 /* The miniPCIe slot cards */ |
73 | #define PEAK_PCIE_OEM_ID 0x0009 /* PCAN-PCI Express OEM */ | ||
74 | #define PEAK_PCIEC34_DEVICE_ID 0x000A /* PCAN-PCI Express 34 (one channel) */ | ||
73 | 75 | ||
74 | #define PEAK_PCI_CHAN_MAX 4 | 76 | #define PEAK_PCI_CHAN_MAX 4 |
75 | 77 | ||
@@ -87,6 +89,7 @@ static const struct pci_device_id peak_pci_tbl[] = { | |||
87 | {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 89 | {PEAK_PCI_VENDOR_ID, PEAK_CPCI_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
88 | #ifdef CONFIG_CAN_PEAK_PCIEC | 90 | #ifdef CONFIG_CAN_PEAK_PCIEC |
89 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | 91 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, |
92 | {PEAK_PCI_VENDOR_ID, PEAK_PCIEC34_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID,}, | ||
90 | #endif | 93 | #endif |
91 | {0,} | 94 | {0,} |
92 | }; | 95 | }; |
@@ -653,7 +656,8 @@ static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
653 | * This must be done *before* register_sja1000dev() but | 656 | * This must be done *before* register_sja1000dev() but |
654 | * *after* devices linkage | 657 | * *after* devices linkage |
655 | */ | 658 | */ |
656 | if (pdev->device == PEAK_PCIEC_DEVICE_ID) { | 659 | if (pdev->device == PEAK_PCIEC_DEVICE_ID || |
660 | pdev->device == PEAK_PCIEC34_DEVICE_ID) { | ||
657 | err = peak_pciec_probe(pdev, dev); | 661 | err = peak_pciec_probe(pdev, dev); |
658 | if (err) { | 662 | if (err) { |
659 | dev_err(&pdev->dev, | 663 | dev_err(&pdev->dev, |
diff --git a/drivers/net/ethernet/3com/3c59x.c b/drivers/net/ethernet/3com/3c59x.c index 059c7414e303..8ca49f04acec 100644 --- a/drivers/net/ethernet/3com/3c59x.c +++ b/drivers/net/ethernet/3com/3c59x.c | |||
@@ -2129,6 +2129,7 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2129 | int entry = vp->cur_tx % TX_RING_SIZE; | 2129 | int entry = vp->cur_tx % TX_RING_SIZE; |
2130 | struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; | 2130 | struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; |
2131 | unsigned long flags; | 2131 | unsigned long flags; |
2132 | dma_addr_t dma_addr; | ||
2132 | 2133 | ||
2133 | if (vortex_debug > 6) { | 2134 | if (vortex_debug > 6) { |
2134 | pr_debug("boomerang_start_xmit()\n"); | 2135 | pr_debug("boomerang_start_xmit()\n"); |
@@ -2163,24 +2164,48 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2163 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); | 2164 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); |
2164 | 2165 | ||
2165 | if (!skb_shinfo(skb)->nr_frags) { | 2166 | if (!skb_shinfo(skb)->nr_frags) { |
2166 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, | 2167 | dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, |
2167 | skb->len, PCI_DMA_TODEVICE)); | 2168 | PCI_DMA_TODEVICE); |
2169 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2170 | goto out_dma_err; | ||
2171 | |||
2172 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); | ||
2168 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); | 2173 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); |
2169 | } else { | 2174 | } else { |
2170 | int i; | 2175 | int i; |
2171 | 2176 | ||
2172 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, | 2177 | dma_addr = pci_map_single(VORTEX_PCI(vp), skb->data, |
2173 | skb_headlen(skb), PCI_DMA_TODEVICE)); | 2178 | skb_headlen(skb), PCI_DMA_TODEVICE); |
2179 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2180 | goto out_dma_err; | ||
2181 | |||
2182 | vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); | ||
2174 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); | 2183 | vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); |
2175 | 2184 | ||
2176 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 2185 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
2177 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 2186 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
2178 | 2187 | ||
2188 | dma_addr = skb_frag_dma_map(&VORTEX_PCI(vp)->dev, frag, | ||
2189 | 0, | ||
2190 | frag->size, | ||
2191 | DMA_TO_DEVICE); | ||
2192 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) { | ||
2193 | for(i = i-1; i >= 0; i--) | ||
2194 | dma_unmap_page(&VORTEX_PCI(vp)->dev, | ||
2195 | le32_to_cpu(vp->tx_ring[entry].frag[i+1].addr), | ||
2196 | le32_to_cpu(vp->tx_ring[entry].frag[i+1].length), | ||
2197 | DMA_TO_DEVICE); | ||
2198 | |||
2199 | pci_unmap_single(VORTEX_PCI(vp), | ||
2200 | le32_to_cpu(vp->tx_ring[entry].frag[0].addr), | ||
2201 | le32_to_cpu(vp->tx_ring[entry].frag[0].length), | ||
2202 | PCI_DMA_TODEVICE); | ||
2203 | |||
2204 | goto out_dma_err; | ||
2205 | } | ||
2206 | |||
2179 | vp->tx_ring[entry].frag[i+1].addr = | 2207 | vp->tx_ring[entry].frag[i+1].addr = |
2180 | cpu_to_le32(pci_map_single( | 2208 | cpu_to_le32(dma_addr); |
2181 | VORTEX_PCI(vp), | ||
2182 | (void *)skb_frag_address(frag), | ||
2183 | skb_frag_size(frag), PCI_DMA_TODEVICE)); | ||
2184 | 2209 | ||
2185 | if (i == skb_shinfo(skb)->nr_frags-1) | 2210 | if (i == skb_shinfo(skb)->nr_frags-1) |
2186 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); | 2211 | vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); |
@@ -2189,7 +2214,10 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2189 | } | 2214 | } |
2190 | } | 2215 | } |
2191 | #else | 2216 | #else |
2192 | vp->tx_ring[entry].addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE)); | 2217 | dma_addr = cpu_to_le32(pci_map_single(VORTEX_PCI(vp), skb->data, skb->len, PCI_DMA_TODEVICE)); |
2218 | if (dma_mapping_error(&VORTEX_PCI(vp)->dev, dma_addr)) | ||
2219 | goto out_dma_err; | ||
2220 | vp->tx_ring[entry].addr = cpu_to_le32(dma_addr); | ||
2193 | vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); | 2221 | vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); |
2194 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); | 2222 | vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); |
2195 | #endif | 2223 | #endif |
@@ -2217,7 +2245,11 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2217 | skb_tx_timestamp(skb); | 2245 | skb_tx_timestamp(skb); |
2218 | iowrite16(DownUnstall, ioaddr + EL3_CMD); | 2246 | iowrite16(DownUnstall, ioaddr + EL3_CMD); |
2219 | spin_unlock_irqrestore(&vp->lock, flags); | 2247 | spin_unlock_irqrestore(&vp->lock, flags); |
2248 | out: | ||
2220 | return NETDEV_TX_OK; | 2249 | return NETDEV_TX_OK; |
2250 | out_dma_err: | ||
2251 | dev_err(&VORTEX_PCI(vp)->dev, "Error mapping dma buffer\n"); | ||
2252 | goto out; | ||
2221 | } | 2253 | } |
2222 | 2254 | ||
2223 | /* The interrupt handler does all of the Rx thread work and cleans up | 2255 | /* The interrupt handler does all of the Rx thread work and cleans up |
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index 23578dfee249..3005155e412b 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c | |||
@@ -123,6 +123,12 @@ static inline void greth_enable_tx(struct greth_private *greth) | |||
123 | GRETH_REGORIN(greth->regs->control, GRETH_TXEN); | 123 | GRETH_REGORIN(greth->regs->control, GRETH_TXEN); |
124 | } | 124 | } |
125 | 125 | ||
126 | static inline void greth_enable_tx_and_irq(struct greth_private *greth) | ||
127 | { | ||
128 | wmb(); /* BDs must been written to memory before enabling TX */ | ||
129 | GRETH_REGORIN(greth->regs->control, GRETH_TXEN | GRETH_TXI); | ||
130 | } | ||
131 | |||
126 | static inline void greth_disable_tx(struct greth_private *greth) | 132 | static inline void greth_disable_tx(struct greth_private *greth) |
127 | { | 133 | { |
128 | GRETH_REGANDIN(greth->regs->control, ~GRETH_TXEN); | 134 | GRETH_REGANDIN(greth->regs->control, ~GRETH_TXEN); |
@@ -447,29 +453,30 @@ out: | |||
447 | return err; | 453 | return err; |
448 | } | 454 | } |
449 | 455 | ||
456 | static inline u16 greth_num_free_bds(u16 tx_last, u16 tx_next) | ||
457 | { | ||
458 | if (tx_next < tx_last) | ||
459 | return (tx_last - tx_next) - 1; | ||
460 | else | ||
461 | return GRETH_TXBD_NUM - (tx_next - tx_last) - 1; | ||
462 | } | ||
450 | 463 | ||
451 | static netdev_tx_t | 464 | static netdev_tx_t |
452 | greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | 465 | greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) |
453 | { | 466 | { |
454 | struct greth_private *greth = netdev_priv(dev); | 467 | struct greth_private *greth = netdev_priv(dev); |
455 | struct greth_bd *bdp; | 468 | struct greth_bd *bdp; |
456 | u32 status = 0, dma_addr, ctrl; | 469 | u32 status, dma_addr; |
457 | int curr_tx, nr_frags, i, err = NETDEV_TX_OK; | 470 | int curr_tx, nr_frags, i, err = NETDEV_TX_OK; |
458 | unsigned long flags; | 471 | unsigned long flags; |
472 | u16 tx_last; | ||
459 | 473 | ||
460 | nr_frags = skb_shinfo(skb)->nr_frags; | 474 | nr_frags = skb_shinfo(skb)->nr_frags; |
475 | tx_last = greth->tx_last; | ||
476 | rmb(); /* tx_last is updated by the poll task */ | ||
461 | 477 | ||
462 | /* Clean TX Ring */ | 478 | if (greth_num_free_bds(tx_last, greth->tx_next) < nr_frags + 1) { |
463 | greth_clean_tx_gbit(dev); | ||
464 | |||
465 | if (greth->tx_free < nr_frags + 1) { | ||
466 | spin_lock_irqsave(&greth->devlock, flags);/*save from poll/irq*/ | ||
467 | ctrl = GRETH_REGLOAD(greth->regs->control); | ||
468 | /* Enable TX IRQ only if not already in poll() routine */ | ||
469 | if (ctrl & GRETH_RXI) | ||
470 | GRETH_REGSAVE(greth->regs->control, ctrl | GRETH_TXI); | ||
471 | netif_stop_queue(dev); | 479 | netif_stop_queue(dev); |
472 | spin_unlock_irqrestore(&greth->devlock, flags); | ||
473 | err = NETDEV_TX_BUSY; | 480 | err = NETDEV_TX_BUSY; |
474 | goto out; | 481 | goto out; |
475 | } | 482 | } |
@@ -488,6 +495,8 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
488 | /* Linear buf */ | 495 | /* Linear buf */ |
489 | if (nr_frags != 0) | 496 | if (nr_frags != 0) |
490 | status = GRETH_TXBD_MORE; | 497 | status = GRETH_TXBD_MORE; |
498 | else | ||
499 | status = GRETH_BD_IE; | ||
491 | 500 | ||
492 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 501 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
493 | status |= GRETH_TXBD_CSALL; | 502 | status |= GRETH_TXBD_CSALL; |
@@ -545,14 +554,12 @@ greth_start_xmit_gbit(struct sk_buff *skb, struct net_device *dev) | |||
545 | 554 | ||
546 | /* Enable the descriptor chain by enabling the first descriptor */ | 555 | /* Enable the descriptor chain by enabling the first descriptor */ |
547 | bdp = greth->tx_bd_base + greth->tx_next; | 556 | bdp = greth->tx_bd_base + greth->tx_next; |
548 | greth_write_bd(&bdp->stat, greth_read_bd(&bdp->stat) | GRETH_BD_EN); | 557 | greth_write_bd(&bdp->stat, |
549 | greth->tx_next = curr_tx; | 558 | greth_read_bd(&bdp->stat) | GRETH_BD_EN); |
550 | greth->tx_free -= nr_frags + 1; | ||
551 | |||
552 | wmb(); | ||
553 | 559 | ||
554 | spin_lock_irqsave(&greth->devlock, flags); /*save from poll/irq*/ | 560 | spin_lock_irqsave(&greth->devlock, flags); /*save from poll/irq*/ |
555 | greth_enable_tx(greth); | 561 | greth->tx_next = curr_tx; |
562 | greth_enable_tx_and_irq(greth); | ||
556 | spin_unlock_irqrestore(&greth->devlock, flags); | 563 | spin_unlock_irqrestore(&greth->devlock, flags); |
557 | 564 | ||
558 | return NETDEV_TX_OK; | 565 | return NETDEV_TX_OK; |
@@ -648,7 +655,6 @@ static void greth_clean_tx(struct net_device *dev) | |||
648 | if (greth->tx_free > 0) { | 655 | if (greth->tx_free > 0) { |
649 | netif_wake_queue(dev); | 656 | netif_wake_queue(dev); |
650 | } | 657 | } |
651 | |||
652 | } | 658 | } |
653 | 659 | ||
654 | static inline void greth_update_tx_stats(struct net_device *dev, u32 stat) | 660 | static inline void greth_update_tx_stats(struct net_device *dev, u32 stat) |
@@ -670,20 +676,22 @@ static void greth_clean_tx_gbit(struct net_device *dev) | |||
670 | { | 676 | { |
671 | struct greth_private *greth; | 677 | struct greth_private *greth; |
672 | struct greth_bd *bdp, *bdp_last_frag; | 678 | struct greth_bd *bdp, *bdp_last_frag; |
673 | struct sk_buff *skb; | 679 | struct sk_buff *skb = NULL; |
674 | u32 stat; | 680 | u32 stat; |
675 | int nr_frags, i; | 681 | int nr_frags, i; |
682 | u16 tx_last; | ||
676 | 683 | ||
677 | greth = netdev_priv(dev); | 684 | greth = netdev_priv(dev); |
685 | tx_last = greth->tx_last; | ||
678 | 686 | ||
679 | while (greth->tx_free < GRETH_TXBD_NUM) { | 687 | while (tx_last != greth->tx_next) { |
680 | 688 | ||
681 | skb = greth->tx_skbuff[greth->tx_last]; | 689 | skb = greth->tx_skbuff[tx_last]; |
682 | 690 | ||
683 | nr_frags = skb_shinfo(skb)->nr_frags; | 691 | nr_frags = skb_shinfo(skb)->nr_frags; |
684 | 692 | ||
685 | /* We only clean fully completed SKBs */ | 693 | /* We only clean fully completed SKBs */ |
686 | bdp_last_frag = greth->tx_bd_base + SKIP_TX(greth->tx_last, nr_frags); | 694 | bdp_last_frag = greth->tx_bd_base + SKIP_TX(tx_last, nr_frags); |
687 | 695 | ||
688 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_TE | GRETH_INT_TX); | 696 | GRETH_REGSAVE(greth->regs->status, GRETH_INT_TE | GRETH_INT_TX); |
689 | mb(); | 697 | mb(); |
@@ -692,14 +700,14 @@ static void greth_clean_tx_gbit(struct net_device *dev) | |||
692 | if (stat & GRETH_BD_EN) | 700 | if (stat & GRETH_BD_EN) |
693 | break; | 701 | break; |
694 | 702 | ||
695 | greth->tx_skbuff[greth->tx_last] = NULL; | 703 | greth->tx_skbuff[tx_last] = NULL; |
696 | 704 | ||
697 | greth_update_tx_stats(dev, stat); | 705 | greth_update_tx_stats(dev, stat); |
698 | dev->stats.tx_bytes += skb->len; | 706 | dev->stats.tx_bytes += skb->len; |
699 | 707 | ||
700 | bdp = greth->tx_bd_base + greth->tx_last; | 708 | bdp = greth->tx_bd_base + tx_last; |
701 | 709 | ||
702 | greth->tx_last = NEXT_TX(greth->tx_last); | 710 | tx_last = NEXT_TX(tx_last); |
703 | 711 | ||
704 | dma_unmap_single(greth->dev, | 712 | dma_unmap_single(greth->dev, |
705 | greth_read_bd(&bdp->addr), | 713 | greth_read_bd(&bdp->addr), |
@@ -708,21 +716,26 @@ static void greth_clean_tx_gbit(struct net_device *dev) | |||
708 | 716 | ||
709 | for (i = 0; i < nr_frags; i++) { | 717 | for (i = 0; i < nr_frags; i++) { |
710 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 718 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
711 | bdp = greth->tx_bd_base + greth->tx_last; | 719 | bdp = greth->tx_bd_base + tx_last; |
712 | 720 | ||
713 | dma_unmap_page(greth->dev, | 721 | dma_unmap_page(greth->dev, |
714 | greth_read_bd(&bdp->addr), | 722 | greth_read_bd(&bdp->addr), |
715 | skb_frag_size(frag), | 723 | skb_frag_size(frag), |
716 | DMA_TO_DEVICE); | 724 | DMA_TO_DEVICE); |
717 | 725 | ||
718 | greth->tx_last = NEXT_TX(greth->tx_last); | 726 | tx_last = NEXT_TX(tx_last); |
719 | } | 727 | } |
720 | greth->tx_free += nr_frags+1; | ||
721 | dev_kfree_skb(skb); | 728 | dev_kfree_skb(skb); |
722 | } | 729 | } |
730 | if (skb) { /* skb is set only if the above while loop was entered */ | ||
731 | wmb(); | ||
732 | greth->tx_last = tx_last; | ||
723 | 733 | ||
724 | if (netif_queue_stopped(dev) && (greth->tx_free > (MAX_SKB_FRAGS+1))) | 734 | if (netif_queue_stopped(dev) && |
725 | netif_wake_queue(dev); | 735 | (greth_num_free_bds(tx_last, greth->tx_next) > |
736 | (MAX_SKB_FRAGS+1))) | ||
737 | netif_wake_queue(dev); | ||
738 | } | ||
726 | } | 739 | } |
727 | 740 | ||
728 | static int greth_rx(struct net_device *dev, int limit) | 741 | static int greth_rx(struct net_device *dev, int limit) |
@@ -965,16 +978,12 @@ static int greth_poll(struct napi_struct *napi, int budget) | |||
965 | greth = container_of(napi, struct greth_private, napi); | 978 | greth = container_of(napi, struct greth_private, napi); |
966 | 979 | ||
967 | restart_txrx_poll: | 980 | restart_txrx_poll: |
968 | if (netif_queue_stopped(greth->netdev)) { | ||
969 | if (greth->gbit_mac) | ||
970 | greth_clean_tx_gbit(greth->netdev); | ||
971 | else | ||
972 | greth_clean_tx(greth->netdev); | ||
973 | } | ||
974 | |||
975 | if (greth->gbit_mac) { | 981 | if (greth->gbit_mac) { |
982 | greth_clean_tx_gbit(greth->netdev); | ||
976 | work_done += greth_rx_gbit(greth->netdev, budget - work_done); | 983 | work_done += greth_rx_gbit(greth->netdev, budget - work_done); |
977 | } else { | 984 | } else { |
985 | if (netif_queue_stopped(greth->netdev)) | ||
986 | greth_clean_tx(greth->netdev); | ||
978 | work_done += greth_rx(greth->netdev, budget - work_done); | 987 | work_done += greth_rx(greth->netdev, budget - work_done); |
979 | } | 988 | } |
980 | 989 | ||
@@ -983,7 +992,8 @@ restart_txrx_poll: | |||
983 | spin_lock_irqsave(&greth->devlock, flags); | 992 | spin_lock_irqsave(&greth->devlock, flags); |
984 | 993 | ||
985 | ctrl = GRETH_REGLOAD(greth->regs->control); | 994 | ctrl = GRETH_REGLOAD(greth->regs->control); |
986 | if (netif_queue_stopped(greth->netdev)) { | 995 | if ((greth->gbit_mac && (greth->tx_last != greth->tx_next)) || |
996 | (!greth->gbit_mac && netif_queue_stopped(greth->netdev))) { | ||
987 | GRETH_REGSAVE(greth->regs->control, | 997 | GRETH_REGSAVE(greth->regs->control, |
988 | ctrl | GRETH_TXI | GRETH_RXI); | 998 | ctrl | GRETH_TXI | GRETH_RXI); |
989 | mask = GRETH_INT_RX | GRETH_INT_RE | | 999 | mask = GRETH_INT_RX | GRETH_INT_RE | |
diff --git a/drivers/net/ethernet/aeroflex/greth.h b/drivers/net/ethernet/aeroflex/greth.h index 232a622a85b7..ae16ac94daf8 100644 --- a/drivers/net/ethernet/aeroflex/greth.h +++ b/drivers/net/ethernet/aeroflex/greth.h | |||
@@ -107,7 +107,7 @@ struct greth_private { | |||
107 | 107 | ||
108 | u16 tx_next; | 108 | u16 tx_next; |
109 | u16 tx_last; | 109 | u16 tx_last; |
110 | u16 tx_free; | 110 | u16 tx_free; /* only used on 10/100Mbit */ |
111 | u16 rx_cur; | 111 | u16 rx_cur; |
112 | 112 | ||
113 | struct greth_regs *regs; /* Address of controller registers. */ | 113 | struct greth_regs *regs; /* Address of controller registers. */ |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c index 346592dca33c..a3c11355a34d 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | |||
@@ -272,8 +272,8 @@ static ssize_t xpcs_reg_value_read(struct file *filp, char __user *buffer, | |||
272 | struct xgbe_prv_data *pdata = filp->private_data; | 272 | struct xgbe_prv_data *pdata = filp->private_data; |
273 | unsigned int value; | 273 | unsigned int value; |
274 | 274 | ||
275 | value = pdata->hw_if.read_mmd_regs(pdata, pdata->debugfs_xpcs_mmd, | 275 | value = XMDIO_READ(pdata, pdata->debugfs_xpcs_mmd, |
276 | pdata->debugfs_xpcs_reg); | 276 | pdata->debugfs_xpcs_reg); |
277 | 277 | ||
278 | return xgbe_common_read(buffer, count, ppos, value); | 278 | return xgbe_common_read(buffer, count, ppos, value); |
279 | } | 279 | } |
@@ -290,8 +290,8 @@ static ssize_t xpcs_reg_value_write(struct file *filp, | |||
290 | if (len < 0) | 290 | if (len < 0) |
291 | return len; | 291 | return len; |
292 | 292 | ||
293 | pdata->hw_if.write_mmd_regs(pdata, pdata->debugfs_xpcs_mmd, | 293 | XMDIO_WRITE(pdata, pdata->debugfs_xpcs_mmd, pdata->debugfs_xpcs_reg, |
294 | pdata->debugfs_xpcs_reg, value); | 294 | value); |
295 | 295 | ||
296 | return len; | 296 | return len; |
297 | } | 297 | } |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c index edaca4496264..ea273836d999 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c | |||
@@ -348,7 +348,7 @@ static int xgbe_disable_tx_flow_control(struct xgbe_prv_data *pdata) | |||
348 | 348 | ||
349 | /* Clear MAC flow control */ | 349 | /* Clear MAC flow control */ |
350 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; | 350 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
351 | q_count = min_t(unsigned int, pdata->rx_q_count, max_q_count); | 351 | q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); |
352 | reg = MAC_Q0TFCR; | 352 | reg = MAC_Q0TFCR; |
353 | for (i = 0; i < q_count; i++) { | 353 | for (i = 0; i < q_count; i++) { |
354 | reg_val = XGMAC_IOREAD(pdata, reg); | 354 | reg_val = XGMAC_IOREAD(pdata, reg); |
@@ -373,7 +373,7 @@ static int xgbe_enable_tx_flow_control(struct xgbe_prv_data *pdata) | |||
373 | 373 | ||
374 | /* Set MAC flow control */ | 374 | /* Set MAC flow control */ |
375 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; | 375 | max_q_count = XGMAC_MAX_FLOW_CONTROL_QUEUES; |
376 | q_count = min_t(unsigned int, pdata->rx_q_count, max_q_count); | 376 | q_count = min_t(unsigned int, pdata->tx_q_count, max_q_count); |
377 | reg = MAC_Q0TFCR; | 377 | reg = MAC_Q0TFCR; |
378 | for (i = 0; i < q_count; i++) { | 378 | for (i = 0; i < q_count; i++) { |
379 | reg_val = XGMAC_IOREAD(pdata, reg); | 379 | reg_val = XGMAC_IOREAD(pdata, reg); |
@@ -509,8 +509,8 @@ static void xgbe_enable_mac_interrupts(struct xgbe_prv_data *pdata) | |||
509 | XGMAC_IOWRITE(pdata, MAC_IER, mac_ier); | 509 | XGMAC_IOWRITE(pdata, MAC_IER, mac_ier); |
510 | 510 | ||
511 | /* Enable all counter interrupts */ | 511 | /* Enable all counter interrupts */ |
512 | XGMAC_IOWRITE_BITS(pdata, MMC_RIER, ALL_INTERRUPTS, 0xff); | 512 | XGMAC_IOWRITE_BITS(pdata, MMC_RIER, ALL_INTERRUPTS, 0xffffffff); |
513 | XGMAC_IOWRITE_BITS(pdata, MMC_TIER, ALL_INTERRUPTS, 0xff); | 513 | XGMAC_IOWRITE_BITS(pdata, MMC_TIER, ALL_INTERRUPTS, 0xffffffff); |
514 | } | 514 | } |
515 | 515 | ||
516 | static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) | 516 | static int xgbe_set_gmii_speed(struct xgbe_prv_data *pdata) |
@@ -1633,6 +1633,9 @@ static int xgbe_flush_tx_queues(struct xgbe_prv_data *pdata) | |||
1633 | { | 1633 | { |
1634 | unsigned int i, count; | 1634 | unsigned int i, count; |
1635 | 1635 | ||
1636 | if (XGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) < 0x21) | ||
1637 | return 0; | ||
1638 | |||
1636 | for (i = 0; i < pdata->tx_q_count; i++) | 1639 | for (i = 0; i < pdata->tx_q_count; i++) |
1637 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_TQOMR, FTQ, 1); | 1640 | XGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_TQOMR, FTQ, 1); |
1638 | 1641 | ||
@@ -1703,8 +1706,8 @@ static void xgbe_config_mtl_mode(struct xgbe_prv_data *pdata) | |||
1703 | XGMAC_IOWRITE_BITS(pdata, MTL_OMR, RAA, MTL_RAA_SP); | 1706 | XGMAC_IOWRITE_BITS(pdata, MTL_OMR, RAA, MTL_RAA_SP); |
1704 | } | 1707 | } |
1705 | 1708 | ||
1706 | static unsigned int xgbe_calculate_per_queue_fifo(unsigned long fifo_size, | 1709 | static unsigned int xgbe_calculate_per_queue_fifo(unsigned int fifo_size, |
1707 | unsigned char queue_count) | 1710 | unsigned int queue_count) |
1708 | { | 1711 | { |
1709 | unsigned int q_fifo_size = 0; | 1712 | unsigned int q_fifo_size = 0; |
1710 | enum xgbe_mtl_fifo_size p_fifo = XGMAC_MTL_FIFO_SIZE_256; | 1713 | enum xgbe_mtl_fifo_size p_fifo = XGMAC_MTL_FIFO_SIZE_256; |
@@ -1748,6 +1751,10 @@ static unsigned int xgbe_calculate_per_queue_fifo(unsigned long fifo_size, | |||
1748 | q_fifo_size = XGBE_FIFO_SIZE_KB(256); | 1751 | q_fifo_size = XGBE_FIFO_SIZE_KB(256); |
1749 | break; | 1752 | break; |
1750 | } | 1753 | } |
1754 | |||
1755 | /* The configured value is not the actual amount of fifo RAM */ | ||
1756 | q_fifo_size = min_t(unsigned int, XGBE_FIFO_MAX, q_fifo_size); | ||
1757 | |||
1751 | q_fifo_size = q_fifo_size / queue_count; | 1758 | q_fifo_size = q_fifo_size / queue_count; |
1752 | 1759 | ||
1753 | /* Set the queue fifo size programmable value */ | 1760 | /* Set the queue fifo size programmable value */ |
@@ -1947,6 +1954,32 @@ static void xgbe_config_vlan_support(struct xgbe_prv_data *pdata) | |||
1947 | xgbe_disable_rx_vlan_stripping(pdata); | 1954 | xgbe_disable_rx_vlan_stripping(pdata); |
1948 | } | 1955 | } |
1949 | 1956 | ||
1957 | static u64 xgbe_mmc_read(struct xgbe_prv_data *pdata, unsigned int reg_lo) | ||
1958 | { | ||
1959 | bool read_hi; | ||
1960 | u64 val; | ||
1961 | |||
1962 | switch (reg_lo) { | ||
1963 | /* These registers are always 64 bit */ | ||
1964 | case MMC_TXOCTETCOUNT_GB_LO: | ||
1965 | case MMC_TXOCTETCOUNT_G_LO: | ||
1966 | case MMC_RXOCTETCOUNT_GB_LO: | ||
1967 | case MMC_RXOCTETCOUNT_G_LO: | ||
1968 | read_hi = true; | ||
1969 | break; | ||
1970 | |||
1971 | default: | ||
1972 | read_hi = false; | ||
1973 | }; | ||
1974 | |||
1975 | val = XGMAC_IOREAD(pdata, reg_lo); | ||
1976 | |||
1977 | if (read_hi) | ||
1978 | val |= ((u64)XGMAC_IOREAD(pdata, reg_lo + 4) << 32); | ||
1979 | |||
1980 | return val; | ||
1981 | } | ||
1982 | |||
1950 | static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata) | 1983 | static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata) |
1951 | { | 1984 | { |
1952 | struct xgbe_mmc_stats *stats = &pdata->mmc_stats; | 1985 | struct xgbe_mmc_stats *stats = &pdata->mmc_stats; |
@@ -1954,75 +1987,75 @@ static void xgbe_tx_mmc_int(struct xgbe_prv_data *pdata) | |||
1954 | 1987 | ||
1955 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_GB)) | 1988 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_GB)) |
1956 | stats->txoctetcount_gb += | 1989 | stats->txoctetcount_gb += |
1957 | XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO); | 1990 | xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO); |
1958 | 1991 | ||
1959 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_GB)) | 1992 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_GB)) |
1960 | stats->txframecount_gb += | 1993 | stats->txframecount_gb += |
1961 | XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO); | 1994 | xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO); |
1962 | 1995 | ||
1963 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_G)) | 1996 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_G)) |
1964 | stats->txbroadcastframes_g += | 1997 | stats->txbroadcastframes_g += |
1965 | XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO); | 1998 | xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO); |
1966 | 1999 | ||
1967 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_G)) | 2000 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_G)) |
1968 | stats->txmulticastframes_g += | 2001 | stats->txmulticastframes_g += |
1969 | XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO); | 2002 | xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO); |
1970 | 2003 | ||
1971 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX64OCTETS_GB)) | 2004 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX64OCTETS_GB)) |
1972 | stats->tx64octets_gb += | 2005 | stats->tx64octets_gb += |
1973 | XGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO); | 2006 | xgbe_mmc_read(pdata, MMC_TX64OCTETS_GB_LO); |
1974 | 2007 | ||
1975 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX65TO127OCTETS_GB)) | 2008 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX65TO127OCTETS_GB)) |
1976 | stats->tx65to127octets_gb += | 2009 | stats->tx65to127octets_gb += |
1977 | XGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO); | 2010 | xgbe_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO); |
1978 | 2011 | ||
1979 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX128TO255OCTETS_GB)) | 2012 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX128TO255OCTETS_GB)) |
1980 | stats->tx128to255octets_gb += | 2013 | stats->tx128to255octets_gb += |
1981 | XGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO); | 2014 | xgbe_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO); |
1982 | 2015 | ||
1983 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX256TO511OCTETS_GB)) | 2016 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX256TO511OCTETS_GB)) |
1984 | stats->tx256to511octets_gb += | 2017 | stats->tx256to511octets_gb += |
1985 | XGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO); | 2018 | xgbe_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO); |
1986 | 2019 | ||
1987 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX512TO1023OCTETS_GB)) | 2020 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX512TO1023OCTETS_GB)) |
1988 | stats->tx512to1023octets_gb += | 2021 | stats->tx512to1023octets_gb += |
1989 | XGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO); | 2022 | xgbe_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO); |
1990 | 2023 | ||
1991 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX1024TOMAXOCTETS_GB)) | 2024 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TX1024TOMAXOCTETS_GB)) |
1992 | stats->tx1024tomaxoctets_gb += | 2025 | stats->tx1024tomaxoctets_gb += |
1993 | XGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); | 2026 | xgbe_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); |
1994 | 2027 | ||
1995 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNICASTFRAMES_GB)) | 2028 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNICASTFRAMES_GB)) |
1996 | stats->txunicastframes_gb += | 2029 | stats->txunicastframes_gb += |
1997 | XGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO); | 2030 | xgbe_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO); |
1998 | 2031 | ||
1999 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_GB)) | 2032 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXMULTICASTFRAMES_GB)) |
2000 | stats->txmulticastframes_gb += | 2033 | stats->txmulticastframes_gb += |
2001 | XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO); | 2034 | xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO); |
2002 | 2035 | ||
2003 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_GB)) | 2036 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXBROADCASTFRAMES_GB)) |
2004 | stats->txbroadcastframes_g += | 2037 | stats->txbroadcastframes_g += |
2005 | XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO); | 2038 | xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO); |
2006 | 2039 | ||
2007 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNDERFLOWERROR)) | 2040 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXUNDERFLOWERROR)) |
2008 | stats->txunderflowerror += | 2041 | stats->txunderflowerror += |
2009 | XGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO); | 2042 | xgbe_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO); |
2010 | 2043 | ||
2011 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_G)) | 2044 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXOCTETCOUNT_G)) |
2012 | stats->txoctetcount_g += | 2045 | stats->txoctetcount_g += |
2013 | XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO); | 2046 | xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO); |
2014 | 2047 | ||
2015 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_G)) | 2048 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXFRAMECOUNT_G)) |
2016 | stats->txframecount_g += | 2049 | stats->txframecount_g += |
2017 | XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO); | 2050 | xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO); |
2018 | 2051 | ||
2019 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXPAUSEFRAMES)) | 2052 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXPAUSEFRAMES)) |
2020 | stats->txpauseframes += | 2053 | stats->txpauseframes += |
2021 | XGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO); | 2054 | xgbe_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO); |
2022 | 2055 | ||
2023 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXVLANFRAMES_G)) | 2056 | if (XGMAC_GET_BITS(mmc_isr, MMC_TISR, TXVLANFRAMES_G)) |
2024 | stats->txvlanframes_g += | 2057 | stats->txvlanframes_g += |
2025 | XGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO); | 2058 | xgbe_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO); |
2026 | } | 2059 | } |
2027 | 2060 | ||
2028 | static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata) | 2061 | static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata) |
@@ -2032,95 +2065,95 @@ static void xgbe_rx_mmc_int(struct xgbe_prv_data *pdata) | |||
2032 | 2065 | ||
2033 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFRAMECOUNT_GB)) | 2066 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFRAMECOUNT_GB)) |
2034 | stats->rxframecount_gb += | 2067 | stats->rxframecount_gb += |
2035 | XGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO); | 2068 | xgbe_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO); |
2036 | 2069 | ||
2037 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_GB)) | 2070 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_GB)) |
2038 | stats->rxoctetcount_gb += | 2071 | stats->rxoctetcount_gb += |
2039 | XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO); | 2072 | xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO); |
2040 | 2073 | ||
2041 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_G)) | 2074 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOCTETCOUNT_G)) |
2042 | stats->rxoctetcount_g += | 2075 | stats->rxoctetcount_g += |
2043 | XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO); | 2076 | xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO); |
2044 | 2077 | ||
2045 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXBROADCASTFRAMES_G)) | 2078 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXBROADCASTFRAMES_G)) |
2046 | stats->rxbroadcastframes_g += | 2079 | stats->rxbroadcastframes_g += |
2047 | XGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO); | 2080 | xgbe_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO); |
2048 | 2081 | ||
2049 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXMULTICASTFRAMES_G)) | 2082 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXMULTICASTFRAMES_G)) |
2050 | stats->rxmulticastframes_g += | 2083 | stats->rxmulticastframes_g += |
2051 | XGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO); | 2084 | xgbe_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO); |
2052 | 2085 | ||
2053 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXCRCERROR)) | 2086 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXCRCERROR)) |
2054 | stats->rxcrcerror += | 2087 | stats->rxcrcerror += |
2055 | XGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO); | 2088 | xgbe_mmc_read(pdata, MMC_RXCRCERROR_LO); |
2056 | 2089 | ||
2057 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXRUNTERROR)) | 2090 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXRUNTERROR)) |
2058 | stats->rxrunterror += | 2091 | stats->rxrunterror += |
2059 | XGMAC_IOREAD(pdata, MMC_RXRUNTERROR); | 2092 | xgbe_mmc_read(pdata, MMC_RXRUNTERROR); |
2060 | 2093 | ||
2061 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXJABBERERROR)) | 2094 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXJABBERERROR)) |
2062 | stats->rxjabbererror += | 2095 | stats->rxjabbererror += |
2063 | XGMAC_IOREAD(pdata, MMC_RXJABBERERROR); | 2096 | xgbe_mmc_read(pdata, MMC_RXJABBERERROR); |
2064 | 2097 | ||
2065 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNDERSIZE_G)) | 2098 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNDERSIZE_G)) |
2066 | stats->rxundersize_g += | 2099 | stats->rxundersize_g += |
2067 | XGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G); | 2100 | xgbe_mmc_read(pdata, MMC_RXUNDERSIZE_G); |
2068 | 2101 | ||
2069 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOVERSIZE_G)) | 2102 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOVERSIZE_G)) |
2070 | stats->rxoversize_g += | 2103 | stats->rxoversize_g += |
2071 | XGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G); | 2104 | xgbe_mmc_read(pdata, MMC_RXOVERSIZE_G); |
2072 | 2105 | ||
2073 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX64OCTETS_GB)) | 2106 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX64OCTETS_GB)) |
2074 | stats->rx64octets_gb += | 2107 | stats->rx64octets_gb += |
2075 | XGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO); | 2108 | xgbe_mmc_read(pdata, MMC_RX64OCTETS_GB_LO); |
2076 | 2109 | ||
2077 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX65TO127OCTETS_GB)) | 2110 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX65TO127OCTETS_GB)) |
2078 | stats->rx65to127octets_gb += | 2111 | stats->rx65to127octets_gb += |
2079 | XGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO); | 2112 | xgbe_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO); |
2080 | 2113 | ||
2081 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX128TO255OCTETS_GB)) | 2114 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX128TO255OCTETS_GB)) |
2082 | stats->rx128to255octets_gb += | 2115 | stats->rx128to255octets_gb += |
2083 | XGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO); | 2116 | xgbe_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO); |
2084 | 2117 | ||
2085 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX256TO511OCTETS_GB)) | 2118 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX256TO511OCTETS_GB)) |
2086 | stats->rx256to511octets_gb += | 2119 | stats->rx256to511octets_gb += |
2087 | XGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO); | 2120 | xgbe_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO); |
2088 | 2121 | ||
2089 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX512TO1023OCTETS_GB)) | 2122 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX512TO1023OCTETS_GB)) |
2090 | stats->rx512to1023octets_gb += | 2123 | stats->rx512to1023octets_gb += |
2091 | XGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO); | 2124 | xgbe_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO); |
2092 | 2125 | ||
2093 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX1024TOMAXOCTETS_GB)) | 2126 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RX1024TOMAXOCTETS_GB)) |
2094 | stats->rx1024tomaxoctets_gb += | 2127 | stats->rx1024tomaxoctets_gb += |
2095 | XGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); | 2128 | xgbe_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); |
2096 | 2129 | ||
2097 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNICASTFRAMES_G)) | 2130 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXUNICASTFRAMES_G)) |
2098 | stats->rxunicastframes_g += | 2131 | stats->rxunicastframes_g += |
2099 | XGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO); | 2132 | xgbe_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO); |
2100 | 2133 | ||
2101 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXLENGTHERROR)) | 2134 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXLENGTHERROR)) |
2102 | stats->rxlengtherror += | 2135 | stats->rxlengtherror += |
2103 | XGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO); | 2136 | xgbe_mmc_read(pdata, MMC_RXLENGTHERROR_LO); |
2104 | 2137 | ||
2105 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOUTOFRANGETYPE)) | 2138 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXOUTOFRANGETYPE)) |
2106 | stats->rxoutofrangetype += | 2139 | stats->rxoutofrangetype += |
2107 | XGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO); | 2140 | xgbe_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO); |
2108 | 2141 | ||
2109 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXPAUSEFRAMES)) | 2142 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXPAUSEFRAMES)) |
2110 | stats->rxpauseframes += | 2143 | stats->rxpauseframes += |
2111 | XGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO); | 2144 | xgbe_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO); |
2112 | 2145 | ||
2113 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFIFOOVERFLOW)) | 2146 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXFIFOOVERFLOW)) |
2114 | stats->rxfifooverflow += | 2147 | stats->rxfifooverflow += |
2115 | XGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO); | 2148 | xgbe_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO); |
2116 | 2149 | ||
2117 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXVLANFRAMES_GB)) | 2150 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXVLANFRAMES_GB)) |
2118 | stats->rxvlanframes_gb += | 2151 | stats->rxvlanframes_gb += |
2119 | XGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO); | 2152 | xgbe_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO); |
2120 | 2153 | ||
2121 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXWATCHDOGERROR)) | 2154 | if (XGMAC_GET_BITS(mmc_isr, MMC_RISR, RXWATCHDOGERROR)) |
2122 | stats->rxwatchdogerror += | 2155 | stats->rxwatchdogerror += |
2123 | XGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR); | 2156 | xgbe_mmc_read(pdata, MMC_RXWATCHDOGERROR); |
2124 | } | 2157 | } |
2125 | 2158 | ||
2126 | static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata) | 2159 | static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata) |
@@ -2131,127 +2164,127 @@ static void xgbe_read_mmc_stats(struct xgbe_prv_data *pdata) | |||
2131 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 1); | 2164 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 1); |
2132 | 2165 | ||
2133 | stats->txoctetcount_gb += | 2166 | stats->txoctetcount_gb += |
2134 | XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_GB_LO); | 2167 | xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_GB_LO); |
2135 | 2168 | ||
2136 | stats->txframecount_gb += | 2169 | stats->txframecount_gb += |
2137 | XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_GB_LO); | 2170 | xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_GB_LO); |
2138 | 2171 | ||
2139 | stats->txbroadcastframes_g += | 2172 | stats->txbroadcastframes_g += |
2140 | XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_G_LO); | 2173 | xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_G_LO); |
2141 | 2174 | ||
2142 | stats->txmulticastframes_g += | 2175 | stats->txmulticastframes_g += |
2143 | XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_G_LO); | 2176 | xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_G_LO); |
2144 | 2177 | ||
2145 | stats->tx64octets_gb += | 2178 | stats->tx64octets_gb += |
2146 | XGMAC_IOREAD(pdata, MMC_TX64OCTETS_GB_LO); | 2179 | xgbe_mmc_read(pdata, MMC_TX64OCTETS_GB_LO); |
2147 | 2180 | ||
2148 | stats->tx65to127octets_gb += | 2181 | stats->tx65to127octets_gb += |
2149 | XGMAC_IOREAD(pdata, MMC_TX65TO127OCTETS_GB_LO); | 2182 | xgbe_mmc_read(pdata, MMC_TX65TO127OCTETS_GB_LO); |
2150 | 2183 | ||
2151 | stats->tx128to255octets_gb += | 2184 | stats->tx128to255octets_gb += |
2152 | XGMAC_IOREAD(pdata, MMC_TX128TO255OCTETS_GB_LO); | 2185 | xgbe_mmc_read(pdata, MMC_TX128TO255OCTETS_GB_LO); |
2153 | 2186 | ||
2154 | stats->tx256to511octets_gb += | 2187 | stats->tx256to511octets_gb += |
2155 | XGMAC_IOREAD(pdata, MMC_TX256TO511OCTETS_GB_LO); | 2188 | xgbe_mmc_read(pdata, MMC_TX256TO511OCTETS_GB_LO); |
2156 | 2189 | ||
2157 | stats->tx512to1023octets_gb += | 2190 | stats->tx512to1023octets_gb += |
2158 | XGMAC_IOREAD(pdata, MMC_TX512TO1023OCTETS_GB_LO); | 2191 | xgbe_mmc_read(pdata, MMC_TX512TO1023OCTETS_GB_LO); |
2159 | 2192 | ||
2160 | stats->tx1024tomaxoctets_gb += | 2193 | stats->tx1024tomaxoctets_gb += |
2161 | XGMAC_IOREAD(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); | 2194 | xgbe_mmc_read(pdata, MMC_TX1024TOMAXOCTETS_GB_LO); |
2162 | 2195 | ||
2163 | stats->txunicastframes_gb += | 2196 | stats->txunicastframes_gb += |
2164 | XGMAC_IOREAD(pdata, MMC_TXUNICASTFRAMES_GB_LO); | 2197 | xgbe_mmc_read(pdata, MMC_TXUNICASTFRAMES_GB_LO); |
2165 | 2198 | ||
2166 | stats->txmulticastframes_gb += | 2199 | stats->txmulticastframes_gb += |
2167 | XGMAC_IOREAD(pdata, MMC_TXMULTICASTFRAMES_GB_LO); | 2200 | xgbe_mmc_read(pdata, MMC_TXMULTICASTFRAMES_GB_LO); |
2168 | 2201 | ||
2169 | stats->txbroadcastframes_g += | 2202 | stats->txbroadcastframes_g += |
2170 | XGMAC_IOREAD(pdata, MMC_TXBROADCASTFRAMES_GB_LO); | 2203 | xgbe_mmc_read(pdata, MMC_TXBROADCASTFRAMES_GB_LO); |
2171 | 2204 | ||
2172 | stats->txunderflowerror += | 2205 | stats->txunderflowerror += |
2173 | XGMAC_IOREAD(pdata, MMC_TXUNDERFLOWERROR_LO); | 2206 | xgbe_mmc_read(pdata, MMC_TXUNDERFLOWERROR_LO); |
2174 | 2207 | ||
2175 | stats->txoctetcount_g += | 2208 | stats->txoctetcount_g += |
2176 | XGMAC_IOREAD(pdata, MMC_TXOCTETCOUNT_G_LO); | 2209 | xgbe_mmc_read(pdata, MMC_TXOCTETCOUNT_G_LO); |
2177 | 2210 | ||
2178 | stats->txframecount_g += | 2211 | stats->txframecount_g += |
2179 | XGMAC_IOREAD(pdata, MMC_TXFRAMECOUNT_G_LO); | 2212 | xgbe_mmc_read(pdata, MMC_TXFRAMECOUNT_G_LO); |
2180 | 2213 | ||
2181 | stats->txpauseframes += | 2214 | stats->txpauseframes += |
2182 | XGMAC_IOREAD(pdata, MMC_TXPAUSEFRAMES_LO); | 2215 | xgbe_mmc_read(pdata, MMC_TXPAUSEFRAMES_LO); |
2183 | 2216 | ||
2184 | stats->txvlanframes_g += | 2217 | stats->txvlanframes_g += |
2185 | XGMAC_IOREAD(pdata, MMC_TXVLANFRAMES_G_LO); | 2218 | xgbe_mmc_read(pdata, MMC_TXVLANFRAMES_G_LO); |
2186 | 2219 | ||
2187 | stats->rxframecount_gb += | 2220 | stats->rxframecount_gb += |
2188 | XGMAC_IOREAD(pdata, MMC_RXFRAMECOUNT_GB_LO); | 2221 | xgbe_mmc_read(pdata, MMC_RXFRAMECOUNT_GB_LO); |
2189 | 2222 | ||
2190 | stats->rxoctetcount_gb += | 2223 | stats->rxoctetcount_gb += |
2191 | XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_GB_LO); | 2224 | xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_GB_LO); |
2192 | 2225 | ||
2193 | stats->rxoctetcount_g += | 2226 | stats->rxoctetcount_g += |
2194 | XGMAC_IOREAD(pdata, MMC_RXOCTETCOUNT_G_LO); | 2227 | xgbe_mmc_read(pdata, MMC_RXOCTETCOUNT_G_LO); |
2195 | 2228 | ||
2196 | stats->rxbroadcastframes_g += | 2229 | stats->rxbroadcastframes_g += |
2197 | XGMAC_IOREAD(pdata, MMC_RXBROADCASTFRAMES_G_LO); | 2230 | xgbe_mmc_read(pdata, MMC_RXBROADCASTFRAMES_G_LO); |
2198 | 2231 | ||
2199 | stats->rxmulticastframes_g += | 2232 | stats->rxmulticastframes_g += |
2200 | XGMAC_IOREAD(pdata, MMC_RXMULTICASTFRAMES_G_LO); | 2233 | xgbe_mmc_read(pdata, MMC_RXMULTICASTFRAMES_G_LO); |
2201 | 2234 | ||
2202 | stats->rxcrcerror += | 2235 | stats->rxcrcerror += |
2203 | XGMAC_IOREAD(pdata, MMC_RXCRCERROR_LO); | 2236 | xgbe_mmc_read(pdata, MMC_RXCRCERROR_LO); |
2204 | 2237 | ||
2205 | stats->rxrunterror += | 2238 | stats->rxrunterror += |
2206 | XGMAC_IOREAD(pdata, MMC_RXRUNTERROR); | 2239 | xgbe_mmc_read(pdata, MMC_RXRUNTERROR); |
2207 | 2240 | ||
2208 | stats->rxjabbererror += | 2241 | stats->rxjabbererror += |
2209 | XGMAC_IOREAD(pdata, MMC_RXJABBERERROR); | 2242 | xgbe_mmc_read(pdata, MMC_RXJABBERERROR); |
2210 | 2243 | ||
2211 | stats->rxundersize_g += | 2244 | stats->rxundersize_g += |
2212 | XGMAC_IOREAD(pdata, MMC_RXUNDERSIZE_G); | 2245 | xgbe_mmc_read(pdata, MMC_RXUNDERSIZE_G); |
2213 | 2246 | ||
2214 | stats->rxoversize_g += | 2247 | stats->rxoversize_g += |
2215 | XGMAC_IOREAD(pdata, MMC_RXOVERSIZE_G); | 2248 | xgbe_mmc_read(pdata, MMC_RXOVERSIZE_G); |
2216 | 2249 | ||
2217 | stats->rx64octets_gb += | 2250 | stats->rx64octets_gb += |
2218 | XGMAC_IOREAD(pdata, MMC_RX64OCTETS_GB_LO); | 2251 | xgbe_mmc_read(pdata, MMC_RX64OCTETS_GB_LO); |
2219 | 2252 | ||
2220 | stats->rx65to127octets_gb += | 2253 | stats->rx65to127octets_gb += |
2221 | XGMAC_IOREAD(pdata, MMC_RX65TO127OCTETS_GB_LO); | 2254 | xgbe_mmc_read(pdata, MMC_RX65TO127OCTETS_GB_LO); |
2222 | 2255 | ||
2223 | stats->rx128to255octets_gb += | 2256 | stats->rx128to255octets_gb += |
2224 | XGMAC_IOREAD(pdata, MMC_RX128TO255OCTETS_GB_LO); | 2257 | xgbe_mmc_read(pdata, MMC_RX128TO255OCTETS_GB_LO); |
2225 | 2258 | ||
2226 | stats->rx256to511octets_gb += | 2259 | stats->rx256to511octets_gb += |
2227 | XGMAC_IOREAD(pdata, MMC_RX256TO511OCTETS_GB_LO); | 2260 | xgbe_mmc_read(pdata, MMC_RX256TO511OCTETS_GB_LO); |
2228 | 2261 | ||
2229 | stats->rx512to1023octets_gb += | 2262 | stats->rx512to1023octets_gb += |
2230 | XGMAC_IOREAD(pdata, MMC_RX512TO1023OCTETS_GB_LO); | 2263 | xgbe_mmc_read(pdata, MMC_RX512TO1023OCTETS_GB_LO); |
2231 | 2264 | ||
2232 | stats->rx1024tomaxoctets_gb += | 2265 | stats->rx1024tomaxoctets_gb += |
2233 | XGMAC_IOREAD(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); | 2266 | xgbe_mmc_read(pdata, MMC_RX1024TOMAXOCTETS_GB_LO); |
2234 | 2267 | ||
2235 | stats->rxunicastframes_g += | 2268 | stats->rxunicastframes_g += |
2236 | XGMAC_IOREAD(pdata, MMC_RXUNICASTFRAMES_G_LO); | 2269 | xgbe_mmc_read(pdata, MMC_RXUNICASTFRAMES_G_LO); |
2237 | 2270 | ||
2238 | stats->rxlengtherror += | 2271 | stats->rxlengtherror += |
2239 | XGMAC_IOREAD(pdata, MMC_RXLENGTHERROR_LO); | 2272 | xgbe_mmc_read(pdata, MMC_RXLENGTHERROR_LO); |
2240 | 2273 | ||
2241 | stats->rxoutofrangetype += | 2274 | stats->rxoutofrangetype += |
2242 | XGMAC_IOREAD(pdata, MMC_RXOUTOFRANGETYPE_LO); | 2275 | xgbe_mmc_read(pdata, MMC_RXOUTOFRANGETYPE_LO); |
2243 | 2276 | ||
2244 | stats->rxpauseframes += | 2277 | stats->rxpauseframes += |
2245 | XGMAC_IOREAD(pdata, MMC_RXPAUSEFRAMES_LO); | 2278 | xgbe_mmc_read(pdata, MMC_RXPAUSEFRAMES_LO); |
2246 | 2279 | ||
2247 | stats->rxfifooverflow += | 2280 | stats->rxfifooverflow += |
2248 | XGMAC_IOREAD(pdata, MMC_RXFIFOOVERFLOW_LO); | 2281 | xgbe_mmc_read(pdata, MMC_RXFIFOOVERFLOW_LO); |
2249 | 2282 | ||
2250 | stats->rxvlanframes_gb += | 2283 | stats->rxvlanframes_gb += |
2251 | XGMAC_IOREAD(pdata, MMC_RXVLANFRAMES_GB_LO); | 2284 | xgbe_mmc_read(pdata, MMC_RXVLANFRAMES_GB_LO); |
2252 | 2285 | ||
2253 | stats->rxwatchdogerror += | 2286 | stats->rxwatchdogerror += |
2254 | XGMAC_IOREAD(pdata, MMC_RXWATCHDOGERROR); | 2287 | xgbe_mmc_read(pdata, MMC_RXWATCHDOGERROR); |
2255 | 2288 | ||
2256 | /* Un-freeze counters */ | 2289 | /* Un-freeze counters */ |
2257 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 0); | 2290 | XGMAC_IOWRITE_BITS(pdata, MMC_CR, MCF, 0); |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index dc84f7193c2d..b26d75856553 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c | |||
@@ -361,6 +361,8 @@ void xgbe_get_all_hw_features(struct xgbe_prv_data *pdata) | |||
361 | 361 | ||
362 | memset(hw_feat, 0, sizeof(*hw_feat)); | 362 | memset(hw_feat, 0, sizeof(*hw_feat)); |
363 | 363 | ||
364 | hw_feat->version = XGMAC_IOREAD(pdata, MAC_VR); | ||
365 | |||
364 | /* Hardware feature register 0 */ | 366 | /* Hardware feature register 0 */ |
365 | hw_feat->gmii = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, GMIISEL); | 367 | hw_feat->gmii = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, GMIISEL); |
366 | hw_feat->vlhash = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, VLHASH); | 368 | hw_feat->vlhash = XGMAC_GET_BITS(mac_hfr0, MAC_HWF0R, VLHASH); |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c index a076aca138a1..46f613028e9c 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c | |||
@@ -361,15 +361,16 @@ static void xgbe_get_drvinfo(struct net_device *netdev, | |||
361 | struct ethtool_drvinfo *drvinfo) | 361 | struct ethtool_drvinfo *drvinfo) |
362 | { | 362 | { |
363 | struct xgbe_prv_data *pdata = netdev_priv(netdev); | 363 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
364 | struct xgbe_hw_features *hw_feat = &pdata->hw_feat; | ||
364 | 365 | ||
365 | strlcpy(drvinfo->driver, XGBE_DRV_NAME, sizeof(drvinfo->driver)); | 366 | strlcpy(drvinfo->driver, XGBE_DRV_NAME, sizeof(drvinfo->driver)); |
366 | strlcpy(drvinfo->version, XGBE_DRV_VERSION, sizeof(drvinfo->version)); | 367 | strlcpy(drvinfo->version, XGBE_DRV_VERSION, sizeof(drvinfo->version)); |
367 | strlcpy(drvinfo->bus_info, dev_name(pdata->dev), | 368 | strlcpy(drvinfo->bus_info, dev_name(pdata->dev), |
368 | sizeof(drvinfo->bus_info)); | 369 | sizeof(drvinfo->bus_info)); |
369 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d", | 370 | snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), "%d.%d.%d", |
370 | XGMAC_IOREAD_BITS(pdata, MAC_VR, USERVER), | 371 | XGMAC_GET_BITS(hw_feat->version, MAC_VR, USERVER), |
371 | XGMAC_IOREAD_BITS(pdata, MAC_VR, DEVID), | 372 | XGMAC_GET_BITS(hw_feat->version, MAC_VR, DEVID), |
372 | XGMAC_IOREAD_BITS(pdata, MAC_VR, SNPSVER)); | 373 | XGMAC_GET_BITS(hw_feat->version, MAC_VR, SNPSVER)); |
373 | drvinfo->n_stats = XGBE_STATS_COUNT; | 374 | drvinfo->n_stats = XGBE_STATS_COUNT; |
374 | } | 375 | } |
375 | 376 | ||
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c index 8aa6a9353f7b..bdf9cfa70e88 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c | |||
@@ -172,7 +172,7 @@ static struct xgbe_channel *xgbe_alloc_rings(struct xgbe_prv_data *pdata) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | if (i < pdata->rx_ring_count) { | 174 | if (i < pdata->rx_ring_count) { |
175 | spin_lock_init(&tx_ring->lock); | 175 | spin_lock_init(&rx_ring->lock); |
176 | channel->rx_ring = rx_ring++; | 176 | channel->rx_ring = rx_ring++; |
177 | } | 177 | } |
178 | 178 | ||
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h index 07bf70a82908..e9fe6e6ddcc3 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h | |||
@@ -183,6 +183,7 @@ | |||
183 | #define XGMAC_DRIVER_CONTEXT 1 | 183 | #define XGMAC_DRIVER_CONTEXT 1 |
184 | #define XGMAC_IOCTL_CONTEXT 2 | 184 | #define XGMAC_IOCTL_CONTEXT 2 |
185 | 185 | ||
186 | #define XGBE_FIFO_MAX 81920 | ||
186 | #define XGBE_FIFO_SIZE_B(x) (x) | 187 | #define XGBE_FIFO_SIZE_B(x) (x) |
187 | #define XGBE_FIFO_SIZE_KB(x) (x * 1024) | 188 | #define XGBE_FIFO_SIZE_KB(x) (x * 1024) |
188 | 189 | ||
@@ -526,6 +527,9 @@ struct xgbe_desc_if { | |||
526 | * or configurations are present in the device. | 527 | * or configurations are present in the device. |
527 | */ | 528 | */ |
528 | struct xgbe_hw_features { | 529 | struct xgbe_hw_features { |
530 | /* HW Version */ | ||
531 | unsigned int version; | ||
532 | |||
529 | /* HW Feature Register0 */ | 533 | /* HW Feature Register0 */ |
530 | unsigned int gmii; /* 1000 Mbps support */ | 534 | unsigned int gmii; /* 1000 Mbps support */ |
531 | unsigned int vlhash; /* VLAN Hash Filter */ | 535 | unsigned int vlhash; /* VLAN Hash Filter */ |
diff --git a/drivers/net/ethernet/apm/xgene/Kconfig b/drivers/net/ethernet/apm/xgene/Kconfig index 616dff6d3f5f..f4054d242f3c 100644 --- a/drivers/net/ethernet/apm/xgene/Kconfig +++ b/drivers/net/ethernet/apm/xgene/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config NET_XGENE | 1 | config NET_XGENE |
2 | tristate "APM X-Gene SoC Ethernet Driver" | 2 | tristate "APM X-Gene SoC Ethernet Driver" |
3 | depends on HAS_DMA | ||
3 | select PHYLIB | 4 | select PHYLIB |
4 | help | 5 | help |
5 | This is the Ethernet driver for the on-chip ethernet interface on the | 6 | This is the Ethernet driver for the on-chip ethernet interface on the |
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c index fe5cfeace6e3..5919394d9f58 100644 --- a/drivers/net/ethernet/arc/emac_main.c +++ b/drivers/net/ethernet/arc/emac_main.c | |||
@@ -30,6 +30,17 @@ | |||
30 | #define DRV_VERSION "1.0" | 30 | #define DRV_VERSION "1.0" |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * arc_emac_tx_avail - Return the number of available slots in the tx ring. | ||
34 | * @priv: Pointer to ARC EMAC private data structure. | ||
35 | * | ||
36 | * returns: the number of slots available for transmission in tx the ring. | ||
37 | */ | ||
38 | static inline int arc_emac_tx_avail(struct arc_emac_priv *priv) | ||
39 | { | ||
40 | return (priv->txbd_dirty + TX_BD_NUM - priv->txbd_curr - 1) % TX_BD_NUM; | ||
41 | } | ||
42 | |||
43 | /** | ||
33 | * arc_emac_adjust_link - Adjust the PHY link duplex. | 44 | * arc_emac_adjust_link - Adjust the PHY link duplex. |
34 | * @ndev: Pointer to the net_device structure. | 45 | * @ndev: Pointer to the net_device structure. |
35 | * | 46 | * |
@@ -180,10 +191,15 @@ static void arc_emac_tx_clean(struct net_device *ndev) | |||
180 | txbd->info = 0; | 191 | txbd->info = 0; |
181 | 192 | ||
182 | *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; | 193 | *txbd_dirty = (*txbd_dirty + 1) % TX_BD_NUM; |
183 | |||
184 | if (netif_queue_stopped(ndev)) | ||
185 | netif_wake_queue(ndev); | ||
186 | } | 194 | } |
195 | |||
196 | /* Ensure that txbd_dirty is visible to tx() before checking | ||
197 | * for queue stopped. | ||
198 | */ | ||
199 | smp_mb(); | ||
200 | |||
201 | if (netif_queue_stopped(ndev) && arc_emac_tx_avail(priv)) | ||
202 | netif_wake_queue(ndev); | ||
187 | } | 203 | } |
188 | 204 | ||
189 | /** | 205 | /** |
@@ -298,7 +314,7 @@ static int arc_emac_poll(struct napi_struct *napi, int budget) | |||
298 | work_done = arc_emac_rx(ndev, budget); | 314 | work_done = arc_emac_rx(ndev, budget); |
299 | if (work_done < budget) { | 315 | if (work_done < budget) { |
300 | napi_complete(napi); | 316 | napi_complete(napi); |
301 | arc_reg_or(priv, R_ENABLE, RXINT_MASK); | 317 | arc_reg_or(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); |
302 | } | 318 | } |
303 | 319 | ||
304 | return work_done; | 320 | return work_done; |
@@ -327,9 +343,9 @@ static irqreturn_t arc_emac_intr(int irq, void *dev_instance) | |||
327 | /* Reset all flags except "MDIO complete" */ | 343 | /* Reset all flags except "MDIO complete" */ |
328 | arc_reg_set(priv, R_STATUS, status); | 344 | arc_reg_set(priv, R_STATUS, status); |
329 | 345 | ||
330 | if (status & RXINT_MASK) { | 346 | if (status & (RXINT_MASK | TXINT_MASK)) { |
331 | if (likely(napi_schedule_prep(&priv->napi))) { | 347 | if (likely(napi_schedule_prep(&priv->napi))) { |
332 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK); | 348 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK); |
333 | __napi_schedule(&priv->napi); | 349 | __napi_schedule(&priv->napi); |
334 | } | 350 | } |
335 | } | 351 | } |
@@ -440,7 +456,7 @@ static int arc_emac_open(struct net_device *ndev) | |||
440 | arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma); | 456 | arc_reg_set(priv, R_TX_RING, (unsigned int)priv->txbd_dma); |
441 | 457 | ||
442 | /* Enable interrupts */ | 458 | /* Enable interrupts */ |
443 | arc_reg_set(priv, R_ENABLE, RXINT_MASK | ERR_MASK); | 459 | arc_reg_set(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK); |
444 | 460 | ||
445 | /* Set CONTROL */ | 461 | /* Set CONTROL */ |
446 | arc_reg_set(priv, R_CTRL, | 462 | arc_reg_set(priv, R_CTRL, |
@@ -511,7 +527,7 @@ static int arc_emac_stop(struct net_device *ndev) | |||
511 | netif_stop_queue(ndev); | 527 | netif_stop_queue(ndev); |
512 | 528 | ||
513 | /* Disable interrupts */ | 529 | /* Disable interrupts */ |
514 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | ERR_MASK); | 530 | arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK); |
515 | 531 | ||
516 | /* Disable EMAC */ | 532 | /* Disable EMAC */ |
517 | arc_reg_clr(priv, R_CTRL, EN_MASK); | 533 | arc_reg_clr(priv, R_CTRL, EN_MASK); |
@@ -574,11 +590,9 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) | |||
574 | 590 | ||
575 | len = max_t(unsigned int, ETH_ZLEN, skb->len); | 591 | len = max_t(unsigned int, ETH_ZLEN, skb->len); |
576 | 592 | ||
577 | /* EMAC still holds this buffer in its possession. | 593 | if (unlikely(!arc_emac_tx_avail(priv))) { |
578 | * CPU must not modify this buffer descriptor | ||
579 | */ | ||
580 | if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) { | ||
581 | netif_stop_queue(ndev); | 594 | netif_stop_queue(ndev); |
595 | netdev_err(ndev, "BUG! Tx Ring full when queue awake!\n"); | ||
582 | return NETDEV_TX_BUSY; | 596 | return NETDEV_TX_BUSY; |
583 | } | 597 | } |
584 | 598 | ||
@@ -607,12 +621,19 @@ static int arc_emac_tx(struct sk_buff *skb, struct net_device *ndev) | |||
607 | /* Increment index to point to the next BD */ | 621 | /* Increment index to point to the next BD */ |
608 | *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM; | 622 | *txbd_curr = (*txbd_curr + 1) % TX_BD_NUM; |
609 | 623 | ||
610 | /* Get "info" of the next BD */ | 624 | /* Ensure that tx_clean() sees the new txbd_curr before |
611 | info = &priv->txbd[*txbd_curr].info; | 625 | * checking the queue status. This prevents an unneeded wake |
626 | * of the queue in tx_clean(). | ||
627 | */ | ||
628 | smp_mb(); | ||
612 | 629 | ||
613 | /* Check if if Tx BD ring is full - next BD is still owned by EMAC */ | 630 | if (!arc_emac_tx_avail(priv)) { |
614 | if (unlikely((le32_to_cpu(*info) & OWN_MASK) == FOR_EMAC)) | ||
615 | netif_stop_queue(ndev); | 631 | netif_stop_queue(ndev); |
632 | /* Refresh tx_dirty */ | ||
633 | smp_mb(); | ||
634 | if (arc_emac_tx_avail(priv)) | ||
635 | netif_start_queue(ndev); | ||
636 | } | ||
616 | 637 | ||
617 | arc_reg_set(priv, R_STATUS, TXPL_MASK); | 638 | arc_reg_set(priv, R_STATUS, TXPL_MASK); |
618 | 639 | ||
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig index 7dcfb19a31c8..d8d07a818b89 100644 --- a/drivers/net/ethernet/broadcom/Kconfig +++ b/drivers/net/ethernet/broadcom/Kconfig | |||
@@ -84,7 +84,7 @@ config BNX2 | |||
84 | 84 | ||
85 | config CNIC | 85 | config CNIC |
86 | tristate "QLogic CNIC support" | 86 | tristate "QLogic CNIC support" |
87 | depends on PCI | 87 | depends on PCI && (IPV6 || IPV6=n) |
88 | select BNX2 | 88 | select BNX2 |
89 | select UIO | 89 | select UIO |
90 | ---help--- | 90 | ---help--- |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 4a7028d65912..d588136b23b9 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
@@ -1697,7 +1697,7 @@ static struct rtnl_link_stats64 *b44_get_stats64(struct net_device *dev, | |||
1697 | hwstat->tx_underruns + | 1697 | hwstat->tx_underruns + |
1698 | hwstat->tx_excessive_cols + | 1698 | hwstat->tx_excessive_cols + |
1699 | hwstat->tx_late_cols); | 1699 | hwstat->tx_late_cols); |
1700 | nstat->multicast = hwstat->tx_multicast_pkts; | 1700 | nstat->multicast = hwstat->rx_multicast_pkts; |
1701 | nstat->collisions = hwstat->tx_total_cols; | 1701 | nstat->collisions = hwstat->tx_total_cols; |
1702 | 1702 | ||
1703 | nstat->rx_length_errors = (hwstat->rx_oversize_pkts + | 1703 | nstat->rx_length_errors = (hwstat->rx_oversize_pkts + |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 6f4e18644bd4..d9b9170ed2fc 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -534,6 +534,25 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, | |||
534 | while ((processed < to_process) && (processed < budget)) { | 534 | while ((processed < to_process) && (processed < budget)) { |
535 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | 535 | cb = &priv->rx_cbs[priv->rx_read_ptr]; |
536 | skb = cb->skb; | 536 | skb = cb->skb; |
537 | |||
538 | processed++; | ||
539 | priv->rx_read_ptr++; | ||
540 | |||
541 | if (priv->rx_read_ptr == priv->num_rx_bds) | ||
542 | priv->rx_read_ptr = 0; | ||
543 | |||
544 | /* We do not have a backing SKB, so we do not a corresponding | ||
545 | * DMA mapping for this incoming packet since | ||
546 | * bcm_sysport_rx_refill always either has both skb and mapping | ||
547 | * or none. | ||
548 | */ | ||
549 | if (unlikely(!skb)) { | ||
550 | netif_err(priv, rx_err, ndev, "out of memory!\n"); | ||
551 | ndev->stats.rx_dropped++; | ||
552 | ndev->stats.rx_errors++; | ||
553 | goto refill; | ||
554 | } | ||
555 | |||
537 | dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr), | 556 | dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr), |
538 | RX_BUF_LENGTH, DMA_FROM_DEVICE); | 557 | RX_BUF_LENGTH, DMA_FROM_DEVICE); |
539 | 558 | ||
@@ -543,23 +562,11 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv, | |||
543 | status = (rsb->rx_status_len >> DESC_STATUS_SHIFT) & | 562 | status = (rsb->rx_status_len >> DESC_STATUS_SHIFT) & |
544 | DESC_STATUS_MASK; | 563 | DESC_STATUS_MASK; |
545 | 564 | ||
546 | processed++; | ||
547 | priv->rx_read_ptr++; | ||
548 | if (priv->rx_read_ptr == priv->num_rx_bds) | ||
549 | priv->rx_read_ptr = 0; | ||
550 | |||
551 | netif_dbg(priv, rx_status, ndev, | 565 | netif_dbg(priv, rx_status, ndev, |
552 | "p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n", | 566 | "p=%d, c=%d, rd_ptr=%d, len=%d, flag=0x%04x\n", |
553 | p_index, priv->rx_c_index, priv->rx_read_ptr, | 567 | p_index, priv->rx_c_index, priv->rx_read_ptr, |
554 | len, status); | 568 | len, status); |
555 | 569 | ||
556 | if (unlikely(!skb)) { | ||
557 | netif_err(priv, rx_err, ndev, "out of memory!\n"); | ||
558 | ndev->stats.rx_dropped++; | ||
559 | ndev->stats.rx_errors++; | ||
560 | goto refill; | ||
561 | } | ||
562 | |||
563 | if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { | 570 | if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) { |
564 | netif_err(priv, rx_status, ndev, "fragmented packet!\n"); | 571 | netif_err(priv, rx_status, ndev, "fragmented packet!\n"); |
565 | ndev->stats.rx_dropped++; | 572 | ndev->stats.rx_dropped++; |
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index 2fee73b878c2..823d01c5684c 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
@@ -3236,8 +3236,9 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) | |||
3236 | 3236 | ||
3237 | skb->protocol = eth_type_trans(skb, bp->dev); | 3237 | skb->protocol = eth_type_trans(skb, bp->dev); |
3238 | 3238 | ||
3239 | if ((len > (bp->dev->mtu + ETH_HLEN)) && | 3239 | if (len > (bp->dev->mtu + ETH_HLEN) && |
3240 | (ntohs(skb->protocol) != 0x8100)) { | 3240 | skb->protocol != htons(0x8100) && |
3241 | skb->protocol != htons(ETH_P_8021AD)) { | ||
3241 | 3242 | ||
3242 | dev_kfree_skb(skb); | 3243 | dev_kfree_skb(skb); |
3243 | goto next_rx; | 3244 | goto next_rx; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h index 5ba8af50c84f..c4daa068f1db 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | |||
@@ -2233,7 +2233,12 @@ struct shmem2_region { | |||
2233 | u32 reserved3; /* Offset 0x14C */ | 2233 | u32 reserved3; /* Offset 0x14C */ |
2234 | u32 reserved4; /* Offset 0x150 */ | 2234 | u32 reserved4; /* Offset 0x150 */ |
2235 | u32 link_attr_sync[PORT_MAX]; /* Offset 0x154 */ | 2235 | u32 link_attr_sync[PORT_MAX]; /* Offset 0x154 */ |
2236 | #define LINK_ATTR_SYNC_KR2_ENABLE (1<<0) | 2236 | #define LINK_ATTR_SYNC_KR2_ENABLE 0x00000001 |
2237 | #define LINK_SFP_EEPROM_COMP_CODE_MASK 0x0000ff00 | ||
2238 | #define LINK_SFP_EEPROM_COMP_CODE_SHIFT 8 | ||
2239 | #define LINK_SFP_EEPROM_COMP_CODE_SR 0x00001000 | ||
2240 | #define LINK_SFP_EEPROM_COMP_CODE_LR 0x00002000 | ||
2241 | #define LINK_SFP_EEPROM_COMP_CODE_LRM 0x00004000 | ||
2237 | 2242 | ||
2238 | u32 reserved5[2]; | 2243 | u32 reserved5[2]; |
2239 | u32 reserved6[PORT_MAX]; | 2244 | u32 reserved6[PORT_MAX]; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index 53fb4fa61b40..549549eaf580 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -154,15 +154,22 @@ typedef int (*read_sfp_module_eeprom_func_p)(struct bnx2x_phy *phy, | |||
154 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE) | 154 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE) |
155 | 155 | ||
156 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 | 156 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 |
157 | #define SFP_EEPROM_CON_TYPE_VAL_UNKNOWN 0x0 | ||
157 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 | 158 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 |
158 | #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21 | 159 | #define SFP_EEPROM_CON_TYPE_VAL_COPPER 0x21 |
159 | #define SFP_EEPROM_CON_TYPE_VAL_RJ45 0x22 | 160 | #define SFP_EEPROM_CON_TYPE_VAL_RJ45 0x22 |
160 | 161 | ||
161 | 162 | ||
162 | #define SFP_EEPROM_COMP_CODE_ADDR 0x3 | 163 | #define SFP_EEPROM_10G_COMP_CODE_ADDR 0x3 |
163 | #define SFP_EEPROM_COMP_CODE_SR_MASK (1<<4) | 164 | #define SFP_EEPROM_10G_COMP_CODE_SR_MASK (1<<4) |
164 | #define SFP_EEPROM_COMP_CODE_LR_MASK (1<<5) | 165 | #define SFP_EEPROM_10G_COMP_CODE_LR_MASK (1<<5) |
165 | #define SFP_EEPROM_COMP_CODE_LRM_MASK (1<<6) | 166 | #define SFP_EEPROM_10G_COMP_CODE_LRM_MASK (1<<6) |
167 | |||
168 | #define SFP_EEPROM_1G_COMP_CODE_ADDR 0x6 | ||
169 | #define SFP_EEPROM_1G_COMP_CODE_SX (1<<0) | ||
170 | #define SFP_EEPROM_1G_COMP_CODE_LX (1<<1) | ||
171 | #define SFP_EEPROM_1G_COMP_CODE_CX (1<<2) | ||
172 | #define SFP_EEPROM_1G_COMP_CODE_BASE_T (1<<3) | ||
166 | 173 | ||
167 | #define SFP_EEPROM_FC_TX_TECH_ADDR 0x8 | 174 | #define SFP_EEPROM_FC_TX_TECH_ADDR 0x8 |
168 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE 0x4 | 175 | #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE 0x4 |
@@ -3633,8 +3640,8 @@ static void bnx2x_warpcore_enable_AN_KR2(struct bnx2x_phy *phy, | |||
3633 | reg_set[i].val); | 3640 | reg_set[i].val); |
3634 | 3641 | ||
3635 | /* Start KR2 work-around timer which handles BCM8073 link-parner */ | 3642 | /* Start KR2 work-around timer which handles BCM8073 link-parner */ |
3636 | vars->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; | 3643 | params->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; |
3637 | bnx2x_update_link_attr(params, vars->link_attr_sync); | 3644 | bnx2x_update_link_attr(params, params->link_attr_sync); |
3638 | } | 3645 | } |
3639 | 3646 | ||
3640 | static void bnx2x_disable_kr2(struct link_params *params, | 3647 | static void bnx2x_disable_kr2(struct link_params *params, |
@@ -3666,8 +3673,8 @@ static void bnx2x_disable_kr2(struct link_params *params, | |||
3666 | for (i = 0; i < ARRAY_SIZE(reg_set); i++) | 3673 | for (i = 0; i < ARRAY_SIZE(reg_set); i++) |
3667 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | 3674 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
3668 | reg_set[i].val); | 3675 | reg_set[i].val); |
3669 | vars->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; | 3676 | params->link_attr_sync &= ~LINK_ATTR_SYNC_KR2_ENABLE; |
3670 | bnx2x_update_link_attr(params, vars->link_attr_sync); | 3677 | bnx2x_update_link_attr(params, params->link_attr_sync); |
3671 | 3678 | ||
3672 | vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; | 3679 | vars->check_kr2_recovery_cnt = CHECK_KR2_RECOVERY_CNT; |
3673 | } | 3680 | } |
@@ -4810,7 +4817,7 @@ void bnx2x_link_status_update(struct link_params *params, | |||
4810 | ~FEATURE_CONFIG_PFC_ENABLED; | 4817 | ~FEATURE_CONFIG_PFC_ENABLED; |
4811 | 4818 | ||
4812 | if (SHMEM2_HAS(bp, link_attr_sync)) | 4819 | if (SHMEM2_HAS(bp, link_attr_sync)) |
4813 | vars->link_attr_sync = SHMEM2_RD(bp, | 4820 | params->link_attr_sync = SHMEM2_RD(bp, |
4814 | link_attr_sync[params->port]); | 4821 | link_attr_sync[params->port]); |
4815 | 4822 | ||
4816 | DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", | 4823 | DP(NETIF_MSG_LINK, "link_status 0x%x phy_link_up %x int_mask 0x%x\n", |
@@ -8057,21 +8064,24 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8057 | { | 8064 | { |
8058 | struct bnx2x *bp = params->bp; | 8065 | struct bnx2x *bp = params->bp; |
8059 | u32 sync_offset = 0, phy_idx, media_types; | 8066 | u32 sync_offset = 0, phy_idx, media_types; |
8060 | u8 gport, val[2], check_limiting_mode = 0; | 8067 | u8 val[SFP_EEPROM_FC_TX_TECH_ADDR + 1], check_limiting_mode = 0; |
8061 | *edc_mode = EDC_MODE_LIMITING; | 8068 | *edc_mode = EDC_MODE_LIMITING; |
8062 | phy->media_type = ETH_PHY_UNSPECIFIED; | 8069 | phy->media_type = ETH_PHY_UNSPECIFIED; |
8063 | /* First check for copper cable */ | 8070 | /* First check for copper cable */ |
8064 | if (bnx2x_read_sfp_module_eeprom(phy, | 8071 | if (bnx2x_read_sfp_module_eeprom(phy, |
8065 | params, | 8072 | params, |
8066 | I2C_DEV_ADDR_A0, | 8073 | I2C_DEV_ADDR_A0, |
8067 | SFP_EEPROM_CON_TYPE_ADDR, | 8074 | 0, |
8068 | 2, | 8075 | SFP_EEPROM_FC_TX_TECH_ADDR + 1, |
8069 | (u8 *)val) != 0) { | 8076 | (u8 *)val) != 0) { |
8070 | DP(NETIF_MSG_LINK, "Failed to read from SFP+ module EEPROM\n"); | 8077 | DP(NETIF_MSG_LINK, "Failed to read from SFP+ module EEPROM\n"); |
8071 | return -EINVAL; | 8078 | return -EINVAL; |
8072 | } | 8079 | } |
8073 | 8080 | params->link_attr_sync &= ~LINK_SFP_EEPROM_COMP_CODE_MASK; | |
8074 | switch (val[0]) { | 8081 | params->link_attr_sync |= val[SFP_EEPROM_10G_COMP_CODE_ADDR] << |
8082 | LINK_SFP_EEPROM_COMP_CODE_SHIFT; | ||
8083 | bnx2x_update_link_attr(params, params->link_attr_sync); | ||
8084 | switch (val[SFP_EEPROM_CON_TYPE_ADDR]) { | ||
8075 | case SFP_EEPROM_CON_TYPE_VAL_COPPER: | 8085 | case SFP_EEPROM_CON_TYPE_VAL_COPPER: |
8076 | { | 8086 | { |
8077 | u8 copper_module_type; | 8087 | u8 copper_module_type; |
@@ -8079,17 +8089,7 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8079 | /* Check if its active cable (includes SFP+ module) | 8089 | /* Check if its active cable (includes SFP+ module) |
8080 | * of passive cable | 8090 | * of passive cable |
8081 | */ | 8091 | */ |
8082 | if (bnx2x_read_sfp_module_eeprom(phy, | 8092 | copper_module_type = val[SFP_EEPROM_FC_TX_TECH_ADDR]; |
8083 | params, | ||
8084 | I2C_DEV_ADDR_A0, | ||
8085 | SFP_EEPROM_FC_TX_TECH_ADDR, | ||
8086 | 1, | ||
8087 | &copper_module_type) != 0) { | ||
8088 | DP(NETIF_MSG_LINK, | ||
8089 | "Failed to read copper-cable-type" | ||
8090 | " from SFP+ EEPROM\n"); | ||
8091 | return -EINVAL; | ||
8092 | } | ||
8093 | 8093 | ||
8094 | if (copper_module_type & | 8094 | if (copper_module_type & |
8095 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE) { | 8095 | SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE) { |
@@ -8115,16 +8115,18 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8115 | } | 8115 | } |
8116 | break; | 8116 | break; |
8117 | } | 8117 | } |
8118 | case SFP_EEPROM_CON_TYPE_VAL_UNKNOWN: | ||
8118 | case SFP_EEPROM_CON_TYPE_VAL_LC: | 8119 | case SFP_EEPROM_CON_TYPE_VAL_LC: |
8119 | case SFP_EEPROM_CON_TYPE_VAL_RJ45: | 8120 | case SFP_EEPROM_CON_TYPE_VAL_RJ45: |
8120 | check_limiting_mode = 1; | 8121 | check_limiting_mode = 1; |
8121 | if ((val[1] & (SFP_EEPROM_COMP_CODE_SR_MASK | | 8122 | if ((val[SFP_EEPROM_10G_COMP_CODE_ADDR] & |
8122 | SFP_EEPROM_COMP_CODE_LR_MASK | | 8123 | (SFP_EEPROM_10G_COMP_CODE_SR_MASK | |
8123 | SFP_EEPROM_COMP_CODE_LRM_MASK)) == 0) { | 8124 | SFP_EEPROM_10G_COMP_CODE_LR_MASK | |
8125 | SFP_EEPROM_10G_COMP_CODE_LRM_MASK)) == 0) { | ||
8124 | DP(NETIF_MSG_LINK, "1G SFP module detected\n"); | 8126 | DP(NETIF_MSG_LINK, "1G SFP module detected\n"); |
8125 | gport = params->port; | ||
8126 | phy->media_type = ETH_PHY_SFP_1G_FIBER; | 8127 | phy->media_type = ETH_PHY_SFP_1G_FIBER; |
8127 | if (phy->req_line_speed != SPEED_1000) { | 8128 | if (phy->req_line_speed != SPEED_1000) { |
8129 | u8 gport = params->port; | ||
8128 | phy->req_line_speed = SPEED_1000; | 8130 | phy->req_line_speed = SPEED_1000; |
8129 | if (!CHIP_IS_E1x(bp)) { | 8131 | if (!CHIP_IS_E1x(bp)) { |
8130 | gport = BP_PATH(bp) + | 8132 | gport = BP_PATH(bp) + |
@@ -8134,6 +8136,12 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8134 | "Warning: Link speed was forced to 1000Mbps. Current SFP module in port %d is not compliant with 10G Ethernet\n", | 8136 | "Warning: Link speed was forced to 1000Mbps. Current SFP module in port %d is not compliant with 10G Ethernet\n", |
8135 | gport); | 8137 | gport); |
8136 | } | 8138 | } |
8139 | if (val[SFP_EEPROM_1G_COMP_CODE_ADDR] & | ||
8140 | SFP_EEPROM_1G_COMP_CODE_BASE_T) { | ||
8141 | bnx2x_sfp_set_transmitter(params, phy, 0); | ||
8142 | msleep(40); | ||
8143 | bnx2x_sfp_set_transmitter(params, phy, 1); | ||
8144 | } | ||
8137 | } else { | 8145 | } else { |
8138 | int idx, cfg_idx = 0; | 8146 | int idx, cfg_idx = 0; |
8139 | DP(NETIF_MSG_LINK, "10G Optic module detected\n"); | 8147 | DP(NETIF_MSG_LINK, "10G Optic module detected\n"); |
@@ -8149,7 +8157,7 @@ static int bnx2x_get_edc_mode(struct bnx2x_phy *phy, | |||
8149 | break; | 8157 | break; |
8150 | default: | 8158 | default: |
8151 | DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n", | 8159 | DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n", |
8152 | val[0]); | 8160 | val[SFP_EEPROM_CON_TYPE_ADDR]); |
8153 | return -EINVAL; | 8161 | return -EINVAL; |
8154 | } | 8162 | } |
8155 | sync_offset = params->shmem_base + | 8163 | sync_offset = params->shmem_base + |
@@ -13507,7 +13515,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13507 | 13515 | ||
13508 | sigdet = bnx2x_warpcore_get_sigdet(phy, params); | 13516 | sigdet = bnx2x_warpcore_get_sigdet(phy, params); |
13509 | if (!sigdet) { | 13517 | if (!sigdet) { |
13510 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | 13518 | if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { |
13511 | bnx2x_kr2_recovery(params, vars, phy); | 13519 | bnx2x_kr2_recovery(params, vars, phy); |
13512 | DP(NETIF_MSG_LINK, "No sigdet\n"); | 13520 | DP(NETIF_MSG_LINK, "No sigdet\n"); |
13513 | } | 13521 | } |
@@ -13525,7 +13533,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13525 | 13533 | ||
13526 | /* CL73 has not begun yet */ | 13534 | /* CL73 has not begun yet */ |
13527 | if (base_page == 0) { | 13535 | if (base_page == 0) { |
13528 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | 13536 | if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { |
13529 | bnx2x_kr2_recovery(params, vars, phy); | 13537 | bnx2x_kr2_recovery(params, vars, phy); |
13530 | DP(NETIF_MSG_LINK, "No BP\n"); | 13538 | DP(NETIF_MSG_LINK, "No BP\n"); |
13531 | } | 13539 | } |
@@ -13541,7 +13549,7 @@ static void bnx2x_check_kr2_wa(struct link_params *params, | |||
13541 | ((next_page & 0xe0) == 0x20)))); | 13549 | ((next_page & 0xe0) == 0x20)))); |
13542 | 13550 | ||
13543 | /* In case KR2 is already disabled, check if we need to re-enable it */ | 13551 | /* In case KR2 is already disabled, check if we need to re-enable it */ |
13544 | if (!(vars->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { | 13552 | if (!(params->link_attr_sync & LINK_ATTR_SYNC_KR2_ENABLE)) { |
13545 | if (!not_kr2_device) { | 13553 | if (!not_kr2_device) { |
13546 | DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, | 13554 | DP(NETIF_MSG_LINK, "BP=0x%x, NP=0x%x\n", base_page, |
13547 | next_page); | 13555 | next_page); |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h index 389f5f8cb0a3..d9cce4c3899b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h | |||
@@ -323,6 +323,9 @@ struct link_params { | |||
323 | #define LINK_FLAGS_INT_DISABLED (1<<0) | 323 | #define LINK_FLAGS_INT_DISABLED (1<<0) |
324 | #define PHY_INITIALIZED (1<<1) | 324 | #define PHY_INITIALIZED (1<<1) |
325 | u32 lfa_base; | 325 | u32 lfa_base; |
326 | |||
327 | /* The same definitions as the shmem2 parameter */ | ||
328 | u32 link_attr_sync; | ||
326 | }; | 329 | }; |
327 | 330 | ||
328 | /* Output parameters */ | 331 | /* Output parameters */ |
@@ -364,8 +367,6 @@ struct link_vars { | |||
364 | u8 rx_tx_asic_rst; | 367 | u8 rx_tx_asic_rst; |
365 | u8 turn_to_run_wc_rt; | 368 | u8 turn_to_run_wc_rt; |
366 | u16 rsrv2; | 369 | u16 rsrv2; |
367 | /* The same definitions as the shmem2 parameter */ | ||
368 | u32 link_attr_sync; | ||
369 | }; | 370 | }; |
370 | 371 | ||
371 | /***********************************************************/ | 372 | /***********************************************************/ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 900cab420810..d1c093dcb054 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -6849,6 +6849,37 @@ static void bnx2x__common_init_phy(struct bnx2x *bp) | |||
6849 | bnx2x_release_phy_lock(bp); | 6849 | bnx2x_release_phy_lock(bp); |
6850 | } | 6850 | } |
6851 | 6851 | ||
6852 | static void bnx2x_config_endianity(struct bnx2x *bp, u32 val) | ||
6853 | { | ||
6854 | REG_WR(bp, PXP2_REG_RQ_QM_ENDIAN_M, val); | ||
6855 | REG_WR(bp, PXP2_REG_RQ_TM_ENDIAN_M, val); | ||
6856 | REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, val); | ||
6857 | REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, val); | ||
6858 | REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, val); | ||
6859 | |||
6860 | /* make sure this value is 0 */ | ||
6861 | REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 0); | ||
6862 | |||
6863 | REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, val); | ||
6864 | REG_WR(bp, PXP2_REG_RD_TM_SWAP_MODE, val); | ||
6865 | REG_WR(bp, PXP2_REG_RD_SRC_SWAP_MODE, val); | ||
6866 | REG_WR(bp, PXP2_REG_RD_CDURD_SWAP_MODE, val); | ||
6867 | } | ||
6868 | |||
6869 | static void bnx2x_set_endianity(struct bnx2x *bp) | ||
6870 | { | ||
6871 | #ifdef __BIG_ENDIAN | ||
6872 | bnx2x_config_endianity(bp, 1); | ||
6873 | #else | ||
6874 | bnx2x_config_endianity(bp, 0); | ||
6875 | #endif | ||
6876 | } | ||
6877 | |||
6878 | static void bnx2x_reset_endianity(struct bnx2x *bp) | ||
6879 | { | ||
6880 | bnx2x_config_endianity(bp, 0); | ||
6881 | } | ||
6882 | |||
6852 | /** | 6883 | /** |
6853 | * bnx2x_init_hw_common - initialize the HW at the COMMON phase. | 6884 | * bnx2x_init_hw_common - initialize the HW at the COMMON phase. |
6854 | * | 6885 | * |
@@ -6915,23 +6946,7 @@ static int bnx2x_init_hw_common(struct bnx2x *bp) | |||
6915 | 6946 | ||
6916 | bnx2x_init_block(bp, BLOCK_PXP2, PHASE_COMMON); | 6947 | bnx2x_init_block(bp, BLOCK_PXP2, PHASE_COMMON); |
6917 | bnx2x_init_pxp(bp); | 6948 | bnx2x_init_pxp(bp); |
6918 | 6949 | bnx2x_set_endianity(bp); | |
6919 | #ifdef __BIG_ENDIAN | ||
6920 | REG_WR(bp, PXP2_REG_RQ_QM_ENDIAN_M, 1); | ||
6921 | REG_WR(bp, PXP2_REG_RQ_TM_ENDIAN_M, 1); | ||
6922 | REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1); | ||
6923 | REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1); | ||
6924 | REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1); | ||
6925 | /* make sure this value is 0 */ | ||
6926 | REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 0); | ||
6927 | |||
6928 | /* REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */ | ||
6929 | REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1); | ||
6930 | REG_WR(bp, PXP2_REG_RD_TM_SWAP_MODE, 1); | ||
6931 | REG_WR(bp, PXP2_REG_RD_SRC_SWAP_MODE, 1); | ||
6932 | REG_WR(bp, PXP2_REG_RD_CDURD_SWAP_MODE, 1); | ||
6933 | #endif | ||
6934 | |||
6935 | bnx2x_ilt_init_page_size(bp, INITOP_SET); | 6950 | bnx2x_ilt_init_page_size(bp, INITOP_SET); |
6936 | 6951 | ||
6937 | if (CHIP_REV_IS_FPGA(bp) && CHIP_IS_E1H(bp)) | 6952 | if (CHIP_REV_IS_FPGA(bp) && CHIP_IS_E1H(bp)) |
@@ -13169,9 +13184,15 @@ static void __bnx2x_remove(struct pci_dev *pdev, | |||
13169 | bnx2x_iov_remove_one(bp); | 13184 | bnx2x_iov_remove_one(bp); |
13170 | 13185 | ||
13171 | /* Power on: we can't let PCI layer write to us while we are in D3 */ | 13186 | /* Power on: we can't let PCI layer write to us while we are in D3 */ |
13172 | if (IS_PF(bp)) | 13187 | if (IS_PF(bp)) { |
13173 | bnx2x_set_power_state(bp, PCI_D0); | 13188 | bnx2x_set_power_state(bp, PCI_D0); |
13174 | 13189 | ||
13190 | /* Set endianity registers to reset values in case next driver | ||
13191 | * boots in different endianty environment. | ||
13192 | */ | ||
13193 | bnx2x_reset_endianity(bp); | ||
13194 | } | ||
13195 | |||
13175 | /* Disable MSI/MSI-X */ | 13196 | /* Disable MSI/MSI-X */ |
13176 | bnx2x_disable_msi(bp); | 13197 | bnx2x_disable_msi(bp); |
13177 | 13198 | ||
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 27861a6c7ca5..a6a9f284c8dd 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/if_vlan.h> | 31 | #include <linux/if_vlan.h> |
32 | #include <linux/prefetch.h> | 32 | #include <linux/prefetch.h> |
33 | #include <linux/random.h> | 33 | #include <linux/random.h> |
34 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 34 | #if IS_ENABLED(CONFIG_VLAN_8021Q) |
35 | #define BCM_VLAN 1 | 35 | #define BCM_VLAN 1 |
36 | #endif | 36 | #endif |
37 | #include <net/ip.h> | 37 | #include <net/ip.h> |
@@ -3685,7 +3685,7 @@ static int cnic_get_v4_route(struct sockaddr_in *dst_addr, | |||
3685 | static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr, | 3685 | static int cnic_get_v6_route(struct sockaddr_in6 *dst_addr, |
3686 | struct dst_entry **dst) | 3686 | struct dst_entry **dst) |
3687 | { | 3687 | { |
3688 | #if defined(CONFIG_IPV6) || (defined(CONFIG_IPV6_MODULE) && defined(MODULE)) | 3688 | #if IS_ENABLED(CONFIG_IPV6) |
3689 | struct flowi6 fl6; | 3689 | struct flowi6 fl6; |
3690 | 3690 | ||
3691 | memset(&fl6, 0, sizeof(fl6)); | 3691 | memset(&fl6, 0, sizeof(fl6)); |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index 3f9d4de8173c..5cc9cae21ed5 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -875,6 +875,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
875 | int last_tx_cn, last_c_index, num_tx_bds; | 875 | int last_tx_cn, last_c_index, num_tx_bds; |
876 | struct enet_cb *tx_cb_ptr; | 876 | struct enet_cb *tx_cb_ptr; |
877 | struct netdev_queue *txq; | 877 | struct netdev_queue *txq; |
878 | unsigned int bds_compl; | ||
878 | unsigned int c_index; | 879 | unsigned int c_index; |
879 | 880 | ||
880 | /* Compute how many buffers are transmitted since last xmit call */ | 881 | /* Compute how many buffers are transmitted since last xmit call */ |
@@ -899,7 +900,9 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
899 | /* Reclaim transmitted buffers */ | 900 | /* Reclaim transmitted buffers */ |
900 | while (last_tx_cn-- > 0) { | 901 | while (last_tx_cn-- > 0) { |
901 | tx_cb_ptr = ring->cbs + last_c_index; | 902 | tx_cb_ptr = ring->cbs + last_c_index; |
903 | bds_compl = 0; | ||
902 | if (tx_cb_ptr->skb) { | 904 | if (tx_cb_ptr->skb) { |
905 | bds_compl = skb_shinfo(tx_cb_ptr->skb)->nr_frags + 1; | ||
903 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; | 906 | dev->stats.tx_bytes += tx_cb_ptr->skb->len; |
904 | dma_unmap_single(&dev->dev, | 907 | dma_unmap_single(&dev->dev, |
905 | dma_unmap_addr(tx_cb_ptr, dma_addr), | 908 | dma_unmap_addr(tx_cb_ptr, dma_addr), |
@@ -916,7 +919,7 @@ static void __bcmgenet_tx_reclaim(struct net_device *dev, | |||
916 | dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0); | 919 | dma_unmap_addr_set(tx_cb_ptr, dma_addr, 0); |
917 | } | 920 | } |
918 | dev->stats.tx_packets++; | 921 | dev->stats.tx_packets++; |
919 | ring->free_bds += 1; | 922 | ring->free_bds += bds_compl; |
920 | 923 | ||
921 | last_c_index++; | 924 | last_c_index++; |
922 | last_c_index &= (num_tx_bds - 1); | 925 | last_c_index &= (num_tx_bds - 1); |
@@ -1274,12 +1277,29 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, | |||
1274 | 1277 | ||
1275 | while ((rxpktprocessed < rxpkttoprocess) && | 1278 | while ((rxpktprocessed < rxpkttoprocess) && |
1276 | (rxpktprocessed < budget)) { | 1279 | (rxpktprocessed < budget)) { |
1280 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | ||
1281 | skb = cb->skb; | ||
1282 | |||
1283 | rxpktprocessed++; | ||
1284 | |||
1285 | priv->rx_read_ptr++; | ||
1286 | priv->rx_read_ptr &= (priv->num_rx_bds - 1); | ||
1287 | |||
1288 | /* We do not have a backing SKB, so we do not have a | ||
1289 | * corresponding DMA mapping for this incoming packet since | ||
1290 | * bcmgenet_rx_refill always either has both skb and mapping or | ||
1291 | * none. | ||
1292 | */ | ||
1293 | if (unlikely(!skb)) { | ||
1294 | dev->stats.rx_dropped++; | ||
1295 | dev->stats.rx_errors++; | ||
1296 | goto refill; | ||
1297 | } | ||
1298 | |||
1277 | /* Unmap the packet contents such that we can use the | 1299 | /* Unmap the packet contents such that we can use the |
1278 | * RSV from the 64 bytes descriptor when enabled and save | 1300 | * RSV from the 64 bytes descriptor when enabled and save |
1279 | * a 32-bits register read | 1301 | * a 32-bits register read |
1280 | */ | 1302 | */ |
1281 | cb = &priv->rx_cbs[priv->rx_read_ptr]; | ||
1282 | skb = cb->skb; | ||
1283 | dma_unmap_single(&dev->dev, dma_unmap_addr(cb, dma_addr), | 1303 | dma_unmap_single(&dev->dev, dma_unmap_addr(cb, dma_addr), |
1284 | priv->rx_buf_len, DMA_FROM_DEVICE); | 1304 | priv->rx_buf_len, DMA_FROM_DEVICE); |
1285 | 1305 | ||
@@ -1307,18 +1327,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, | |||
1307 | __func__, p_index, priv->rx_c_index, | 1327 | __func__, p_index, priv->rx_c_index, |
1308 | priv->rx_read_ptr, dma_length_status); | 1328 | priv->rx_read_ptr, dma_length_status); |
1309 | 1329 | ||
1310 | rxpktprocessed++; | ||
1311 | |||
1312 | priv->rx_read_ptr++; | ||
1313 | priv->rx_read_ptr &= (priv->num_rx_bds - 1); | ||
1314 | |||
1315 | /* out of memory, just drop packets at the hardware level */ | ||
1316 | if (unlikely(!skb)) { | ||
1317 | dev->stats.rx_dropped++; | ||
1318 | dev->stats.rx_errors++; | ||
1319 | goto refill; | ||
1320 | } | ||
1321 | |||
1322 | if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { | 1330 | if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { |
1323 | netif_err(priv, rx_status, dev, | 1331 | netif_err(priv, rx_status, dev, |
1324 | "dropping fragmented packet!\n"); | 1332 | "dropping fragmented packet!\n"); |
@@ -1736,13 +1744,63 @@ static void bcmgenet_init_multiq(struct net_device *dev) | |||
1736 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | 1744 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); |
1737 | } | 1745 | } |
1738 | 1746 | ||
1747 | static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | ||
1748 | { | ||
1749 | int ret = 0; | ||
1750 | int timeout = 0; | ||
1751 | u32 reg; | ||
1752 | |||
1753 | /* Disable TDMA to stop add more frames in TX DMA */ | ||
1754 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); | ||
1755 | reg &= ~DMA_EN; | ||
1756 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | ||
1757 | |||
1758 | /* Check TDMA status register to confirm TDMA is disabled */ | ||
1759 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
1760 | reg = bcmgenet_tdma_readl(priv, DMA_STATUS); | ||
1761 | if (reg & DMA_DISABLED) | ||
1762 | break; | ||
1763 | |||
1764 | udelay(1); | ||
1765 | } | ||
1766 | |||
1767 | if (timeout == DMA_TIMEOUT_VAL) { | ||
1768 | netdev_warn(priv->dev, "Timed out while disabling TX DMA\n"); | ||
1769 | ret = -ETIMEDOUT; | ||
1770 | } | ||
1771 | |||
1772 | /* Wait 10ms for packet drain in both tx and rx dma */ | ||
1773 | usleep_range(10000, 20000); | ||
1774 | |||
1775 | /* Disable RDMA */ | ||
1776 | reg = bcmgenet_rdma_readl(priv, DMA_CTRL); | ||
1777 | reg &= ~DMA_EN; | ||
1778 | bcmgenet_rdma_writel(priv, reg, DMA_CTRL); | ||
1779 | |||
1780 | timeout = 0; | ||
1781 | /* Check RDMA status register to confirm RDMA is disabled */ | ||
1782 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
1783 | reg = bcmgenet_rdma_readl(priv, DMA_STATUS); | ||
1784 | if (reg & DMA_DISABLED) | ||
1785 | break; | ||
1786 | |||
1787 | udelay(1); | ||
1788 | } | ||
1789 | |||
1790 | if (timeout == DMA_TIMEOUT_VAL) { | ||
1791 | netdev_warn(priv->dev, "Timed out while disabling RX DMA\n"); | ||
1792 | ret = -ETIMEDOUT; | ||
1793 | } | ||
1794 | |||
1795 | return ret; | ||
1796 | } | ||
1797 | |||
1739 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) | 1798 | static void bcmgenet_fini_dma(struct bcmgenet_priv *priv) |
1740 | { | 1799 | { |
1741 | int i; | 1800 | int i; |
1742 | 1801 | ||
1743 | /* disable DMA */ | 1802 | /* disable DMA */ |
1744 | bcmgenet_rdma_writel(priv, 0, DMA_CTRL); | 1803 | bcmgenet_dma_teardown(priv); |
1745 | bcmgenet_tdma_writel(priv, 0, DMA_CTRL); | ||
1746 | 1804 | ||
1747 | for (i = 0; i < priv->num_tx_bds; i++) { | 1805 | for (i = 0; i < priv->num_tx_bds; i++) { |
1748 | if (priv->tx_cbs[i].skb != NULL) { | 1806 | if (priv->tx_cbs[i].skb != NULL) { |
@@ -2101,57 +2159,6 @@ err_clk_disable: | |||
2101 | return ret; | 2159 | return ret; |
2102 | } | 2160 | } |
2103 | 2161 | ||
2104 | static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) | ||
2105 | { | ||
2106 | int ret = 0; | ||
2107 | int timeout = 0; | ||
2108 | u32 reg; | ||
2109 | |||
2110 | /* Disable TDMA to stop add more frames in TX DMA */ | ||
2111 | reg = bcmgenet_tdma_readl(priv, DMA_CTRL); | ||
2112 | reg &= ~DMA_EN; | ||
2113 | bcmgenet_tdma_writel(priv, reg, DMA_CTRL); | ||
2114 | |||
2115 | /* Check TDMA status register to confirm TDMA is disabled */ | ||
2116 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
2117 | reg = bcmgenet_tdma_readl(priv, DMA_STATUS); | ||
2118 | if (reg & DMA_DISABLED) | ||
2119 | break; | ||
2120 | |||
2121 | udelay(1); | ||
2122 | } | ||
2123 | |||
2124 | if (timeout == DMA_TIMEOUT_VAL) { | ||
2125 | netdev_warn(priv->dev, "Timed out while disabling TX DMA\n"); | ||
2126 | ret = -ETIMEDOUT; | ||
2127 | } | ||
2128 | |||
2129 | /* Wait 10ms for packet drain in both tx and rx dma */ | ||
2130 | usleep_range(10000, 20000); | ||
2131 | |||
2132 | /* Disable RDMA */ | ||
2133 | reg = bcmgenet_rdma_readl(priv, DMA_CTRL); | ||
2134 | reg &= ~DMA_EN; | ||
2135 | bcmgenet_rdma_writel(priv, reg, DMA_CTRL); | ||
2136 | |||
2137 | timeout = 0; | ||
2138 | /* Check RDMA status register to confirm RDMA is disabled */ | ||
2139 | while (timeout++ < DMA_TIMEOUT_VAL) { | ||
2140 | reg = bcmgenet_rdma_readl(priv, DMA_STATUS); | ||
2141 | if (reg & DMA_DISABLED) | ||
2142 | break; | ||
2143 | |||
2144 | udelay(1); | ||
2145 | } | ||
2146 | |||
2147 | if (timeout == DMA_TIMEOUT_VAL) { | ||
2148 | netdev_warn(priv->dev, "Timed out while disabling RX DMA\n"); | ||
2149 | ret = -ETIMEDOUT; | ||
2150 | } | ||
2151 | |||
2152 | return ret; | ||
2153 | } | ||
2154 | |||
2155 | static void bcmgenet_netif_stop(struct net_device *dev) | 2162 | static void bcmgenet_netif_stop(struct net_device *dev) |
2156 | { | 2163 | { |
2157 | struct bcmgenet_priv *priv = netdev_priv(dev); | 2164 | struct bcmgenet_priv *priv = netdev_priv(dev); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 3ac5d23454a8..ba499489969a 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -6918,7 +6918,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
6918 | skb->protocol = eth_type_trans(skb, tp->dev); | 6918 | skb->protocol = eth_type_trans(skb, tp->dev); |
6919 | 6919 | ||
6920 | if (len > (tp->dev->mtu + ETH_HLEN) && | 6920 | if (len > (tp->dev->mtu + ETH_HLEN) && |
6921 | skb->protocol != htons(ETH_P_8021Q)) { | 6921 | skb->protocol != htons(ETH_P_8021Q) && |
6922 | skb->protocol != htons(ETH_P_8021AD)) { | ||
6922 | dev_kfree_skb_any(skb); | 6923 | dev_kfree_skb_any(skb); |
6923 | goto drop_it_no_recycle; | 6924 | goto drop_it_no_recycle; |
6924 | } | 6925 | } |
@@ -7914,8 +7915,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7914 | 7915 | ||
7915 | entry = tnapi->tx_prod; | 7916 | entry = tnapi->tx_prod; |
7916 | base_flags = 0; | 7917 | base_flags = 0; |
7917 | if (skb->ip_summed == CHECKSUM_PARTIAL) | ||
7918 | base_flags |= TXD_FLAG_TCPUDP_CSUM; | ||
7919 | 7918 | ||
7920 | mss = skb_shinfo(skb)->gso_size; | 7919 | mss = skb_shinfo(skb)->gso_size; |
7921 | if (mss) { | 7920 | if (mss) { |
@@ -7929,6 +7928,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7929 | 7928 | ||
7930 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; | 7929 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb) - ETH_HLEN; |
7931 | 7930 | ||
7931 | /* HW/FW can not correctly segment packets that have been | ||
7932 | * vlan encapsulated. | ||
7933 | */ | ||
7934 | if (skb->protocol == htons(ETH_P_8021Q) || | ||
7935 | skb->protocol == htons(ETH_P_8021AD)) | ||
7936 | return tg3_tso_bug(tp, tnapi, txq, skb); | ||
7937 | |||
7932 | if (!skb_is_gso_v6(skb)) { | 7938 | if (!skb_is_gso_v6(skb)) { |
7933 | if (unlikely((ETH_HLEN + hdr_len) > 80) && | 7939 | if (unlikely((ETH_HLEN + hdr_len) > 80) && |
7934 | tg3_flag(tp, TSO_BUG)) | 7940 | tg3_flag(tp, TSO_BUG)) |
@@ -7979,6 +7985,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
7979 | base_flags |= tsflags << 12; | 7985 | base_flags |= tsflags << 12; |
7980 | } | 7986 | } |
7981 | } | 7987 | } |
7988 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
7989 | /* HW/FW can not correctly checksum packets that have been | ||
7990 | * vlan encapsulated. | ||
7991 | */ | ||
7992 | if (skb->protocol == htons(ETH_P_8021Q) || | ||
7993 | skb->protocol == htons(ETH_P_8021AD)) { | ||
7994 | if (skb_checksum_help(skb)) | ||
7995 | goto drop; | ||
7996 | } else { | ||
7997 | base_flags |= TXD_FLAG_TCPUDP_CSUM; | ||
7998 | } | ||
7982 | } | 7999 | } |
7983 | 8000 | ||
7984 | if (tg3_flag(tp, USE_JUMBO_BDFLAG) && | 8001 | if (tg3_flag(tp, USE_JUMBO_BDFLAG) && |
@@ -11617,6 +11634,12 @@ static int tg3_open(struct net_device *dev) | |||
11617 | struct tg3 *tp = netdev_priv(dev); | 11634 | struct tg3 *tp = netdev_priv(dev); |
11618 | int err; | 11635 | int err; |
11619 | 11636 | ||
11637 | if (tp->pcierr_recovery) { | ||
11638 | netdev_err(dev, "Failed to open device. PCI error recovery " | ||
11639 | "in progress\n"); | ||
11640 | return -EAGAIN; | ||
11641 | } | ||
11642 | |||
11620 | if (tp->fw_needed) { | 11643 | if (tp->fw_needed) { |
11621 | err = tg3_request_firmware(tp); | 11644 | err = tg3_request_firmware(tp); |
11622 | if (tg3_asic_rev(tp) == ASIC_REV_57766) { | 11645 | if (tg3_asic_rev(tp) == ASIC_REV_57766) { |
@@ -11674,6 +11697,12 @@ static int tg3_close(struct net_device *dev) | |||
11674 | { | 11697 | { |
11675 | struct tg3 *tp = netdev_priv(dev); | 11698 | struct tg3 *tp = netdev_priv(dev); |
11676 | 11699 | ||
11700 | if (tp->pcierr_recovery) { | ||
11701 | netdev_err(dev, "Failed to close device. PCI error recovery " | ||
11702 | "in progress\n"); | ||
11703 | return -EAGAIN; | ||
11704 | } | ||
11705 | |||
11677 | tg3_ptp_fini(tp); | 11706 | tg3_ptp_fini(tp); |
11678 | 11707 | ||
11679 | tg3_stop(tp); | 11708 | tg3_stop(tp); |
@@ -17561,6 +17590,7 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
17561 | tp->rx_mode = TG3_DEF_RX_MODE; | 17590 | tp->rx_mode = TG3_DEF_RX_MODE; |
17562 | tp->tx_mode = TG3_DEF_TX_MODE; | 17591 | tp->tx_mode = TG3_DEF_TX_MODE; |
17563 | tp->irq_sync = 1; | 17592 | tp->irq_sync = 1; |
17593 | tp->pcierr_recovery = false; | ||
17564 | 17594 | ||
17565 | if (tg3_debug > 0) | 17595 | if (tg3_debug > 0) |
17566 | tp->msg_enable = tg3_debug; | 17596 | tp->msg_enable = tg3_debug; |
@@ -18071,6 +18101,8 @@ static pci_ers_result_t tg3_io_error_detected(struct pci_dev *pdev, | |||
18071 | 18101 | ||
18072 | rtnl_lock(); | 18102 | rtnl_lock(); |
18073 | 18103 | ||
18104 | tp->pcierr_recovery = true; | ||
18105 | |||
18074 | /* We probably don't have netdev yet */ | 18106 | /* We probably don't have netdev yet */ |
18075 | if (!netdev || !netif_running(netdev)) | 18107 | if (!netdev || !netif_running(netdev)) |
18076 | goto done; | 18108 | goto done; |
@@ -18195,6 +18227,7 @@ static void tg3_io_resume(struct pci_dev *pdev) | |||
18195 | tg3_phy_start(tp); | 18227 | tg3_phy_start(tp); |
18196 | 18228 | ||
18197 | done: | 18229 | done: |
18230 | tp->pcierr_recovery = false; | ||
18198 | rtnl_unlock(); | 18231 | rtnl_unlock(); |
18199 | } | 18232 | } |
18200 | 18233 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index 461accaf0aa4..31c9f8295953 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -3407,6 +3407,7 @@ struct tg3 { | |||
3407 | 3407 | ||
3408 | struct device *hwmon_dev; | 3408 | struct device *hwmon_dev; |
3409 | bool link_up; | 3409 | bool link_up; |
3410 | bool pcierr_recovery; | ||
3410 | }; | 3411 | }; |
3411 | 3412 | ||
3412 | /* Accessor macros for chip and asic attributes | 3413 | /* Accessor macros for chip and asic attributes |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index ff8cae5e2535..ffc92a41d75b 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -2506,7 +2506,7 @@ bnad_tso_prepare(struct bnad *bnad, struct sk_buff *skb) | |||
2506 | * For TSO, the TCP checksum field is seeded with pseudo-header sum | 2506 | * For TSO, the TCP checksum field is seeded with pseudo-header sum |
2507 | * excluding the length field. | 2507 | * excluding the length field. |
2508 | */ | 2508 | */ |
2509 | if (skb->protocol == htons(ETH_P_IP)) { | 2509 | if (vlan_get_protocol(skb) == htons(ETH_P_IP)) { |
2510 | struct iphdr *iph = ip_hdr(skb); | 2510 | struct iphdr *iph = ip_hdr(skb); |
2511 | 2511 | ||
2512 | /* Do we really need these? */ | 2512 | /* Do we really need these? */ |
@@ -2870,12 +2870,13 @@ bnad_txq_wi_prepare(struct bnad *bnad, struct bna_tcb *tcb, | |||
2870 | } | 2870 | } |
2871 | 2871 | ||
2872 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 2872 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
2873 | __be16 net_proto = vlan_get_protocol(skb); | ||
2873 | u8 proto = 0; | 2874 | u8 proto = 0; |
2874 | 2875 | ||
2875 | if (skb->protocol == htons(ETH_P_IP)) | 2876 | if (net_proto == htons(ETH_P_IP)) |
2876 | proto = ip_hdr(skb)->protocol; | 2877 | proto = ip_hdr(skb)->protocol; |
2877 | #ifdef NETIF_F_IPV6_CSUM | 2878 | #ifdef NETIF_F_IPV6_CSUM |
2878 | else if (skb->protocol == htons(ETH_P_IPV6)) { | 2879 | else if (net_proto == htons(ETH_P_IPV6)) { |
2879 | /* nexthdr may not be TCP immediately. */ | 2880 | /* nexthdr may not be TCP immediately. */ |
2880 | proto = ipv6_hdr(skb)->nexthdr; | 2881 | proto = ipv6_hdr(skb)->nexthdr; |
2881 | } | 2882 | } |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index ca5d7798b265..e1e02fba4fcc 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/of_device.h> | 30 | #include <linux/of_device.h> |
31 | #include <linux/of_mdio.h> | 31 | #include <linux/of_mdio.h> |
32 | #include <linux/of_net.h> | 32 | #include <linux/of_net.h> |
33 | #include <linux/pinctrl/consumer.h> | ||
34 | 33 | ||
35 | #include "macb.h" | 34 | #include "macb.h" |
36 | 35 | ||
@@ -2071,7 +2070,6 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2071 | struct phy_device *phydev; | 2070 | struct phy_device *phydev; |
2072 | u32 config; | 2071 | u32 config; |
2073 | int err = -ENXIO; | 2072 | int err = -ENXIO; |
2074 | struct pinctrl *pinctrl; | ||
2075 | const char *mac; | 2073 | const char *mac; |
2076 | 2074 | ||
2077 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2075 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -2080,15 +2078,6 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2080 | goto err_out; | 2078 | goto err_out; |
2081 | } | 2079 | } |
2082 | 2080 | ||
2083 | pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | ||
2084 | if (IS_ERR(pinctrl)) { | ||
2085 | err = PTR_ERR(pinctrl); | ||
2086 | if (err == -EPROBE_DEFER) | ||
2087 | goto err_out; | ||
2088 | |||
2089 | dev_warn(&pdev->dev, "No pinctrl provided\n"); | ||
2090 | } | ||
2091 | |||
2092 | err = -ENOMEM; | 2081 | err = -ENOMEM; |
2093 | dev = alloc_etherdev(sizeof(*bp)); | 2082 | dev = alloc_etherdev(sizeof(*bp)); |
2094 | if (!dev) | 2083 | if (!dev) |
diff --git a/drivers/net/ethernet/calxeda/Kconfig b/drivers/net/ethernet/calxeda/Kconfig index 184a063bed5f..07d2201530d2 100644 --- a/drivers/net/ethernet/calxeda/Kconfig +++ b/drivers/net/ethernet/calxeda/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | config NET_CALXEDA_XGMAC | 1 | config NET_CALXEDA_XGMAC |
2 | tristate "Calxeda 1G/10G XGMAC Ethernet driver" | 2 | tristate "Calxeda 1G/10G XGMAC Ethernet driver" |
3 | depends on HAS_IOMEM && HAS_DMA | 3 | depends on HAS_IOMEM && HAS_DMA |
4 | depends on ARCH_HIGHBANK || COMPILE_TEST | ||
4 | select CRC32 | 5 | select CRC32 |
5 | help | 6 | help |
6 | This is the driver for the XGMAC Ethernet IP block found on Calxeda | 7 | This is the driver for the XGMAC Ethernet IP block found on Calxeda |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 18fb9c61d7ba..e5be511a3c38 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -1253,7 +1253,9 @@ freeout: t4_free_sge_resources(adap); | |||
1253 | goto freeout; | 1253 | goto freeout; |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | t4_write_reg(adap, MPS_TRC_RSS_CONTROL, | 1256 | t4_write_reg(adap, is_t4(adap->params.chip) ? |
1257 | MPS_TRC_RSS_CONTROL : | ||
1258 | MPS_T5_TRC_RSS_CONTROL, | ||
1257 | RSSCONTROL(netdev2pinfo(adap->port[0])->tx_chan) | | 1259 | RSSCONTROL(netdev2pinfo(adap->port[0])->tx_chan) | |
1258 | QUEUENUMBER(s->ethrxq[0].rspq.abs_id)); | 1260 | QUEUENUMBER(s->ethrxq[0].rspq.abs_id)); |
1259 | return 0; | 1261 | return 0; |
@@ -1761,7 +1763,8 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
1761 | 0xd004, 0xd03c, | 1763 | 0xd004, 0xd03c, |
1762 | 0xdfc0, 0xdfe0, | 1764 | 0xdfc0, 0xdfe0, |
1763 | 0xe000, 0xea7c, | 1765 | 0xe000, 0xea7c, |
1764 | 0xf000, 0x11190, | 1766 | 0xf000, 0x11110, |
1767 | 0x11118, 0x11190, | ||
1765 | 0x19040, 0x1906c, | 1768 | 0x19040, 0x1906c, |
1766 | 0x19078, 0x19080, | 1769 | 0x19078, 0x19080, |
1767 | 0x1908c, 0x19124, | 1770 | 0x1908c, 0x19124, |
@@ -1968,7 +1971,8 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
1968 | 0xd004, 0xd03c, | 1971 | 0xd004, 0xd03c, |
1969 | 0xdfc0, 0xdfe0, | 1972 | 0xdfc0, 0xdfe0, |
1970 | 0xe000, 0x11088, | 1973 | 0xe000, 0x11088, |
1971 | 0x1109c, 0x1117c, | 1974 | 0x1109c, 0x11110, |
1975 | 0x11118, 0x1117c, | ||
1972 | 0x11190, 0x11204, | 1976 | 0x11190, 0x11204, |
1973 | 0x19040, 0x1906c, | 1977 | 0x19040, 0x1906c, |
1974 | 0x19078, 0x19080, | 1978 | 0x19078, 0x19080, |
@@ -5955,7 +5959,8 @@ static int adap_init0(struct adapter *adap) | |||
5955 | params[3] = FW_PARAM_PFVF(CQ_END); | 5959 | params[3] = FW_PARAM_PFVF(CQ_END); |
5956 | params[4] = FW_PARAM_PFVF(OCQ_START); | 5960 | params[4] = FW_PARAM_PFVF(OCQ_START); |
5957 | params[5] = FW_PARAM_PFVF(OCQ_END); | 5961 | params[5] = FW_PARAM_PFVF(OCQ_END); |
5958 | ret = t4_query_params(adap, 0, 0, 0, 6, params, val); | 5962 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 6, params, |
5963 | val); | ||
5959 | if (ret < 0) | 5964 | if (ret < 0) |
5960 | goto bye; | 5965 | goto bye; |
5961 | adap->vres.qp.start = val[0]; | 5966 | adap->vres.qp.start = val[0]; |
@@ -5967,7 +5972,8 @@ static int adap_init0(struct adapter *adap) | |||
5967 | 5972 | ||
5968 | params[0] = FW_PARAM_DEV(MAXORDIRD_QP); | 5973 | params[0] = FW_PARAM_DEV(MAXORDIRD_QP); |
5969 | params[1] = FW_PARAM_DEV(MAXIRD_ADAPTER); | 5974 | params[1] = FW_PARAM_DEV(MAXIRD_ADAPTER); |
5970 | ret = t4_query_params(adap, 0, 0, 0, 2, params, val); | 5975 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, params, |
5976 | val); | ||
5971 | if (ret < 0) { | 5977 | if (ret < 0) { |
5972 | adap->params.max_ordird_qp = 8; | 5978 | adap->params.max_ordird_qp = 8; |
5973 | adap->params.max_ird_adapter = 32 * adap->tids.ntids; | 5979 | adap->params.max_ird_adapter = 32 * adap->tids.ntids; |
@@ -6472,6 +6478,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6472 | struct port_info *pi; | 6478 | struct port_info *pi; |
6473 | bool highdma = false; | 6479 | bool highdma = false; |
6474 | struct adapter *adapter = NULL; | 6480 | struct adapter *adapter = NULL; |
6481 | void __iomem *regs; | ||
6475 | 6482 | ||
6476 | printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); | 6483 | printk_once(KERN_INFO "%s - version %s\n", DRV_DESC, DRV_VERSION); |
6477 | 6484 | ||
@@ -6488,19 +6495,35 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6488 | goto out_release_regions; | 6495 | goto out_release_regions; |
6489 | } | 6496 | } |
6490 | 6497 | ||
6498 | regs = pci_ioremap_bar(pdev, 0); | ||
6499 | if (!regs) { | ||
6500 | dev_err(&pdev->dev, "cannot map device registers\n"); | ||
6501 | err = -ENOMEM; | ||
6502 | goto out_disable_device; | ||
6503 | } | ||
6504 | |||
6505 | /* We control everything through one PF */ | ||
6506 | func = SOURCEPF_GET(readl(regs + PL_WHOAMI)); | ||
6507 | if (func != ent->driver_data) { | ||
6508 | iounmap(regs); | ||
6509 | pci_disable_device(pdev); | ||
6510 | pci_save_state(pdev); /* to restore SR-IOV later */ | ||
6511 | goto sriov; | ||
6512 | } | ||
6513 | |||
6491 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | 6514 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
6492 | highdma = true; | 6515 | highdma = true; |
6493 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | 6516 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); |
6494 | if (err) { | 6517 | if (err) { |
6495 | dev_err(&pdev->dev, "unable to obtain 64-bit DMA for " | 6518 | dev_err(&pdev->dev, "unable to obtain 64-bit DMA for " |
6496 | "coherent allocations\n"); | 6519 | "coherent allocations\n"); |
6497 | goto out_disable_device; | 6520 | goto out_unmap_bar0; |
6498 | } | 6521 | } |
6499 | } else { | 6522 | } else { |
6500 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); | 6523 | err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); |
6501 | if (err) { | 6524 | if (err) { |
6502 | dev_err(&pdev->dev, "no usable DMA configuration\n"); | 6525 | dev_err(&pdev->dev, "no usable DMA configuration\n"); |
6503 | goto out_disable_device; | 6526 | goto out_unmap_bar0; |
6504 | } | 6527 | } |
6505 | } | 6528 | } |
6506 | 6529 | ||
@@ -6512,7 +6535,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6512 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); | 6535 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); |
6513 | if (!adapter) { | 6536 | if (!adapter) { |
6514 | err = -ENOMEM; | 6537 | err = -ENOMEM; |
6515 | goto out_disable_device; | 6538 | goto out_unmap_bar0; |
6516 | } | 6539 | } |
6517 | 6540 | ||
6518 | adapter->workq = create_singlethread_workqueue("cxgb4"); | 6541 | adapter->workq = create_singlethread_workqueue("cxgb4"); |
@@ -6524,20 +6547,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6524 | /* PCI device has been enabled */ | 6547 | /* PCI device has been enabled */ |
6525 | adapter->flags |= DEV_ENABLED; | 6548 | adapter->flags |= DEV_ENABLED; |
6526 | 6549 | ||
6527 | adapter->regs = pci_ioremap_bar(pdev, 0); | 6550 | adapter->regs = regs; |
6528 | if (!adapter->regs) { | ||
6529 | dev_err(&pdev->dev, "cannot map device registers\n"); | ||
6530 | err = -ENOMEM; | ||
6531 | goto out_free_adapter; | ||
6532 | } | ||
6533 | |||
6534 | /* We control everything through one PF */ | ||
6535 | func = SOURCEPF_GET(readl(adapter->regs + PL_WHOAMI)); | ||
6536 | if (func != ent->driver_data) { | ||
6537 | pci_save_state(pdev); /* to restore SR-IOV later */ | ||
6538 | goto sriov; | ||
6539 | } | ||
6540 | |||
6541 | adapter->pdev = pdev; | 6551 | adapter->pdev = pdev; |
6542 | adapter->pdev_dev = &pdev->dev; | 6552 | adapter->pdev_dev = &pdev->dev; |
6543 | adapter->mbox = func; | 6553 | adapter->mbox = func; |
@@ -6554,7 +6564,8 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6554 | 6564 | ||
6555 | err = t4_prep_adapter(adapter); | 6565 | err = t4_prep_adapter(adapter); |
6556 | if (err) | 6566 | if (err) |
6557 | goto out_unmap_bar0; | 6567 | goto out_free_adapter; |
6568 | |||
6558 | 6569 | ||
6559 | if (!is_t4(adapter->params.chip)) { | 6570 | if (!is_t4(adapter->params.chip)) { |
6560 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; | 6571 | s_qpp = QUEUESPERPAGEPF1 * adapter->fn; |
@@ -6571,14 +6582,14 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6571 | dev_err(&pdev->dev, | 6582 | dev_err(&pdev->dev, |
6572 | "Incorrect number of egress queues per page\n"); | 6583 | "Incorrect number of egress queues per page\n"); |
6573 | err = -EINVAL; | 6584 | err = -EINVAL; |
6574 | goto out_unmap_bar0; | 6585 | goto out_free_adapter; |
6575 | } | 6586 | } |
6576 | adapter->bar2 = ioremap_wc(pci_resource_start(pdev, 2), | 6587 | adapter->bar2 = ioremap_wc(pci_resource_start(pdev, 2), |
6577 | pci_resource_len(pdev, 2)); | 6588 | pci_resource_len(pdev, 2)); |
6578 | if (!adapter->bar2) { | 6589 | if (!adapter->bar2) { |
6579 | dev_err(&pdev->dev, "cannot map device bar2 region\n"); | 6590 | dev_err(&pdev->dev, "cannot map device bar2 region\n"); |
6580 | err = -ENOMEM; | 6591 | err = -ENOMEM; |
6581 | goto out_unmap_bar0; | 6592 | goto out_free_adapter; |
6582 | } | 6593 | } |
6583 | } | 6594 | } |
6584 | 6595 | ||
@@ -6716,13 +6727,13 @@ sriov: | |||
6716 | out_unmap_bar: | 6727 | out_unmap_bar: |
6717 | if (!is_t4(adapter->params.chip)) | 6728 | if (!is_t4(adapter->params.chip)) |
6718 | iounmap(adapter->bar2); | 6729 | iounmap(adapter->bar2); |
6719 | out_unmap_bar0: | ||
6720 | iounmap(adapter->regs); | ||
6721 | out_free_adapter: | 6730 | out_free_adapter: |
6722 | if (adapter->workq) | 6731 | if (adapter->workq) |
6723 | destroy_workqueue(adapter->workq); | 6732 | destroy_workqueue(adapter->workq); |
6724 | 6733 | ||
6725 | kfree(adapter); | 6734 | kfree(adapter); |
6735 | out_unmap_bar0: | ||
6736 | iounmap(regs); | ||
6726 | out_disable_device: | 6737 | out_disable_device: |
6727 | pci_disable_pcie_error_reporting(pdev); | 6738 | pci_disable_pcie_error_reporting(pdev); |
6728 | pci_disable_device(pdev); | 6739 | pci_disable_device(pdev); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index a853133d8db8..41d04462b72e 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -168,6 +168,34 @@ void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * t4_report_fw_error - report firmware error | ||
172 | * @adap: the adapter | ||
173 | * | ||
174 | * The adapter firmware can indicate error conditions to the host. | ||
175 | * If the firmware has indicated an error, print out the reason for | ||
176 | * the firmware error. | ||
177 | */ | ||
178 | static void t4_report_fw_error(struct adapter *adap) | ||
179 | { | ||
180 | static const char *const reason[] = { | ||
181 | "Crash", /* PCIE_FW_EVAL_CRASH */ | ||
182 | "During Device Preparation", /* PCIE_FW_EVAL_PREP */ | ||
183 | "During Device Configuration", /* PCIE_FW_EVAL_CONF */ | ||
184 | "During Device Initialization", /* PCIE_FW_EVAL_INIT */ | ||
185 | "Unexpected Event", /* PCIE_FW_EVAL_UNEXPECTEDEVENT */ | ||
186 | "Insufficient Airflow", /* PCIE_FW_EVAL_OVERHEAT */ | ||
187 | "Device Shutdown", /* PCIE_FW_EVAL_DEVICESHUTDOWN */ | ||
188 | "Reserved", /* reserved */ | ||
189 | }; | ||
190 | u32 pcie_fw; | ||
191 | |||
192 | pcie_fw = t4_read_reg(adap, MA_PCIE_FW); | ||
193 | if (pcie_fw & FW_PCIE_FW_ERR) | ||
194 | dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n", | ||
195 | reason[FW_PCIE_FW_EVAL_GET(pcie_fw)]); | ||
196 | } | ||
197 | |||
198 | /* | ||
171 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. | 199 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. |
172 | */ | 200 | */ |
173 | static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, | 201 | static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, |
@@ -300,6 +328,7 @@ int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, | |||
300 | dump_mbox(adap, mbox, data_reg); | 328 | dump_mbox(adap, mbox, data_reg); |
301 | dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n", | 329 | dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n", |
302 | *(const u8 *)cmd, mbox); | 330 | *(const u8 *)cmd, mbox); |
331 | t4_report_fw_error(adap); | ||
303 | return -ETIMEDOUT; | 332 | return -ETIMEDOUT; |
304 | } | 333 | } |
305 | 334 | ||
@@ -566,6 +595,7 @@ int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, | |||
566 | #define VPD_BASE 0x400 | 595 | #define VPD_BASE 0x400 |
567 | #define VPD_BASE_OLD 0 | 596 | #define VPD_BASE_OLD 0 |
568 | #define VPD_LEN 1024 | 597 | #define VPD_LEN 1024 |
598 | #define CHELSIO_VPD_UNIQUE_ID 0x82 | ||
569 | 599 | ||
570 | /** | 600 | /** |
571 | * t4_seeprom_wp - enable/disable EEPROM write protection | 601 | * t4_seeprom_wp - enable/disable EEPROM write protection |
@@ -603,7 +633,14 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | |||
603 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); | 633 | ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(u32), vpd); |
604 | if (ret < 0) | 634 | if (ret < 0) |
605 | goto out; | 635 | goto out; |
606 | addr = *vpd == 0x82 ? VPD_BASE : VPD_BASE_OLD; | 636 | |
637 | /* The VPD shall have a unique identifier specified by the PCI SIG. | ||
638 | * For chelsio adapters, the identifier is 0x82. The first byte of a VPD | ||
639 | * shall be CHELSIO_VPD_UNIQUE_ID (0x82). The VPD programming software | ||
640 | * is expected to automatically put this entry at the | ||
641 | * beginning of the VPD. | ||
642 | */ | ||
643 | addr = *vpd == CHELSIO_VPD_UNIQUE_ID ? VPD_BASE : VPD_BASE_OLD; | ||
607 | 644 | ||
608 | ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); | 645 | ret = pci_read_vpd(adapter->pdev, addr, VPD_LEN, vpd); |
609 | if (ret < 0) | 646 | if (ret < 0) |
@@ -667,6 +704,7 @@ int get_vpd_params(struct adapter *adapter, struct vpd_params *p) | |||
667 | i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE); | 704 | i = pci_vpd_info_field_size(vpd + sn - PCI_VPD_INFO_FLD_HDR_SIZE); |
668 | memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); | 705 | memcpy(p->sn, vpd + sn, min(i, SERNUM_LEN)); |
669 | strim(p->sn); | 706 | strim(p->sn); |
707 | i = pci_vpd_info_field_size(vpd + pn - PCI_VPD_INFO_FLD_HDR_SIZE); | ||
670 | memcpy(p->pn, vpd + pn, min(i, PN_LEN)); | 708 | memcpy(p->pn, vpd + pn, min(i, PN_LEN)); |
671 | strim(p->pn); | 709 | strim(p->pn); |
672 | 710 | ||
@@ -1394,15 +1432,18 @@ static void pcie_intr_handler(struct adapter *adapter) | |||
1394 | 1432 | ||
1395 | int fat; | 1433 | int fat; |
1396 | 1434 | ||
1397 | fat = t4_handle_intr_status(adapter, | 1435 | if (is_t4(adapter->params.chip)) |
1398 | PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, | 1436 | fat = t4_handle_intr_status(adapter, |
1399 | sysbus_intr_info) + | 1437 | PCIE_CORE_UTL_SYSTEM_BUS_AGENT_STATUS, |
1400 | t4_handle_intr_status(adapter, | 1438 | sysbus_intr_info) + |
1401 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, | 1439 | t4_handle_intr_status(adapter, |
1402 | pcie_port_intr_info) + | 1440 | PCIE_CORE_UTL_PCI_EXPRESS_PORT_STATUS, |
1403 | t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | 1441 | pcie_port_intr_info) + |
1404 | is_t4(adapter->params.chip) ? | 1442 | t4_handle_intr_status(adapter, PCIE_INT_CAUSE, |
1405 | pcie_intr_info : t5_pcie_intr_info); | 1443 | pcie_intr_info); |
1444 | else | ||
1445 | fat = t4_handle_intr_status(adapter, PCIE_INT_CAUSE, | ||
1446 | t5_pcie_intr_info); | ||
1406 | 1447 | ||
1407 | if (fat) | 1448 | if (fat) |
1408 | t4_fatal_err(adapter); | 1449 | t4_fatal_err(adapter); |
@@ -1521,6 +1562,9 @@ static void cim_intr_handler(struct adapter *adapter) | |||
1521 | 1562 | ||
1522 | int fat; | 1563 | int fat; |
1523 | 1564 | ||
1565 | if (t4_read_reg(adapter, MA_PCIE_FW) & FW_PCIE_FW_ERR) | ||
1566 | t4_report_fw_error(adapter); | ||
1567 | |||
1524 | fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE, | 1568 | fat = t4_handle_intr_status(adapter, CIM_HOST_INT_CAUSE, |
1525 | cim_intr_info) + | 1569 | cim_intr_info) + |
1526 | t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE, | 1570 | t4_handle_intr_status(adapter, CIM_HOST_UPACC_INT_CAUSE, |
@@ -1768,10 +1812,16 @@ static void ma_intr_handler(struct adapter *adap) | |||
1768 | { | 1812 | { |
1769 | u32 v, status = t4_read_reg(adap, MA_INT_CAUSE); | 1813 | u32 v, status = t4_read_reg(adap, MA_INT_CAUSE); |
1770 | 1814 | ||
1771 | if (status & MEM_PERR_INT_CAUSE) | 1815 | if (status & MEM_PERR_INT_CAUSE) { |
1772 | dev_alert(adap->pdev_dev, | 1816 | dev_alert(adap->pdev_dev, |
1773 | "MA parity error, parity status %#x\n", | 1817 | "MA parity error, parity status %#x\n", |
1774 | t4_read_reg(adap, MA_PARITY_ERROR_STATUS)); | 1818 | t4_read_reg(adap, MA_PARITY_ERROR_STATUS)); |
1819 | if (is_t5(adap->params.chip)) | ||
1820 | dev_alert(adap->pdev_dev, | ||
1821 | "MA parity error, parity status %#x\n", | ||
1822 | t4_read_reg(adap, | ||
1823 | MA_PARITY_ERROR_STATUS2)); | ||
1824 | } | ||
1775 | if (status & MEM_WRAP_INT_CAUSE) { | 1825 | if (status & MEM_WRAP_INT_CAUSE) { |
1776 | v = t4_read_reg(adap, MA_INT_WRAP_STATUS); | 1826 | v = t4_read_reg(adap, MA_INT_WRAP_STATUS); |
1777 | dev_alert(adap->pdev_dev, "MA address wrap-around error by " | 1827 | dev_alert(adap->pdev_dev, "MA address wrap-around error by " |
@@ -2733,12 +2783,16 @@ retry: | |||
2733 | /* | 2783 | /* |
2734 | * Issue the HELLO command to the firmware. If it's not successful | 2784 | * Issue the HELLO command to the firmware. If it's not successful |
2735 | * but indicates that we got a "busy" or "timeout" condition, retry | 2785 | * but indicates that we got a "busy" or "timeout" condition, retry |
2736 | * the HELLO until we exhaust our retry limit. | 2786 | * the HELLO until we exhaust our retry limit. If we do exceed our |
2787 | * retry limit, check to see if the firmware left us any error | ||
2788 | * information and report that if so. | ||
2737 | */ | 2789 | */ |
2738 | ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); | 2790 | ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); |
2739 | if (ret < 0) { | 2791 | if (ret < 0) { |
2740 | if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0) | 2792 | if ((ret == -EBUSY || ret == -ETIMEDOUT) && retries-- > 0) |
2741 | goto retry; | 2793 | goto retry; |
2794 | if (t4_read_reg(adap, MA_PCIE_FW) & FW_PCIE_FW_ERR) | ||
2795 | t4_report_fw_error(adap); | ||
2742 | return ret; | 2796 | return ret; |
2743 | } | 2797 | } |
2744 | 2798 | ||
@@ -3742,6 +3796,7 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) | |||
3742 | lc->link_ok = link_ok; | 3796 | lc->link_ok = link_ok; |
3743 | lc->speed = speed; | 3797 | lc->speed = speed; |
3744 | lc->fc = fc; | 3798 | lc->fc = fc; |
3799 | lc->supported = be16_to_cpu(p->u.info.pcap); | ||
3745 | t4_os_link_changed(adap, port, link_ok); | 3800 | t4_os_link_changed(adap, port, link_ok); |
3746 | } | 3801 | } |
3747 | if (mod != pi->mod_type) { | 3802 | if (mod != pi->mod_type) { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index e3146e83df20..39fb325474f7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | |||
@@ -511,6 +511,7 @@ | |||
511 | #define MEM_WRAP_CLIENT_NUM_GET(x) (((x) & MEM_WRAP_CLIENT_NUM_MASK) >> MEM_WRAP_CLIENT_NUM_SHIFT) | 511 | #define MEM_WRAP_CLIENT_NUM_GET(x) (((x) & MEM_WRAP_CLIENT_NUM_MASK) >> MEM_WRAP_CLIENT_NUM_SHIFT) |
512 | #define MA_PCIE_FW 0x30b8 | 512 | #define MA_PCIE_FW 0x30b8 |
513 | #define MA_PARITY_ERROR_STATUS 0x77f4 | 513 | #define MA_PARITY_ERROR_STATUS 0x77f4 |
514 | #define MA_PARITY_ERROR_STATUS2 0x7804 | ||
514 | 515 | ||
515 | #define MA_EXT_MEMORY1_BAR 0x7808 | 516 | #define MA_EXT_MEMORY1_BAR 0x7808 |
516 | #define EDC_0_BASE_ADDR 0x7900 | 517 | #define EDC_0_BASE_ADDR 0x7900 |
@@ -959,6 +960,7 @@ | |||
959 | #define TRCMULTIFILTER 0x00000001U | 960 | #define TRCMULTIFILTER 0x00000001U |
960 | 961 | ||
961 | #define MPS_TRC_RSS_CONTROL 0x9808 | 962 | #define MPS_TRC_RSS_CONTROL 0x9808 |
963 | #define MPS_T5_TRC_RSS_CONTROL 0xa00c | ||
962 | #define RSSCONTROL_MASK 0x00ff0000U | 964 | #define RSSCONTROL_MASK 0x00ff0000U |
963 | #define RSSCONTROL_SHIFT 16 | 965 | #define RSSCONTROL_SHIFT 16 |
964 | #define RSSCONTROL(x) ((x) << RSSCONTROL_SHIFT) | 966 | #define RSSCONTROL(x) ((x) << RSSCONTROL_SHIFT) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h index 5f2729ebadbe..3409756a85b9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4fw_api.h | |||
@@ -2228,6 +2228,10 @@ struct fw_debug_cmd { | |||
2228 | #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT) | 2228 | #define FW_PCIE_FW_MASTER(x) ((x) << FW_PCIE_FW_MASTER_SHIFT) |
2229 | #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \ | 2229 | #define FW_PCIE_FW_MASTER_GET(x) (((x) >> FW_PCIE_FW_MASTER_SHIFT) & \ |
2230 | FW_PCIE_FW_MASTER_MASK) | 2230 | FW_PCIE_FW_MASTER_MASK) |
2231 | #define FW_PCIE_FW_EVAL_MASK 0x7 | ||
2232 | #define FW_PCIE_FW_EVAL_SHIFT 24 | ||
2233 | #define FW_PCIE_FW_EVAL_GET(x) (((x) >> FW_PCIE_FW_EVAL_SHIFT) & \ | ||
2234 | FW_PCIE_FW_EVAL_MASK) | ||
2231 | 2235 | ||
2232 | struct fw_hdr { | 2236 | struct fw_hdr { |
2233 | u8 ver; | 2237 | u8 ver; |
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c index 9b33057a9477..70089c29d307 100644 --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c | |||
@@ -1399,7 +1399,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev) | |||
1399 | const void *mac_addr; | 1399 | const void *mac_addr; |
1400 | 1400 | ||
1401 | if (!IS_ENABLED(CONFIG_OF) || !np) | 1401 | if (!IS_ENABLED(CONFIG_OF) || !np) |
1402 | return NULL; | 1402 | return ERR_PTR(-ENXIO); |
1403 | 1403 | ||
1404 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | 1404 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); |
1405 | if (!pdata) | 1405 | if (!pdata) |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index a0b418e007a0..566b17db135a 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
@@ -1994,7 +1994,7 @@ static void xmit_common(struct sk_buff *skb, struct ehea_swqe *swqe) | |||
1994 | { | 1994 | { |
1995 | swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT | EHEA_SWQE_CRC; | 1995 | swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT | EHEA_SWQE_CRC; |
1996 | 1996 | ||
1997 | if (skb->protocol != htons(ETH_P_IP)) | 1997 | if (vlan_get_protocol(skb) != htons(ETH_P_IP)) |
1998 | return; | 1998 | return; |
1999 | 1999 | ||
2000 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 2000 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index cbc330b301cd..ad3d5d12173f 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -2674,7 +2674,8 @@ set_itr_now: | |||
2674 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 | 2674 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
2675 | 2675 | ||
2676 | static int e1000_tso(struct e1000_adapter *adapter, | 2676 | static int e1000_tso(struct e1000_adapter *adapter, |
2677 | struct e1000_tx_ring *tx_ring, struct sk_buff *skb) | 2677 | struct e1000_tx_ring *tx_ring, struct sk_buff *skb, |
2678 | __be16 protocol) | ||
2678 | { | 2679 | { |
2679 | struct e1000_context_desc *context_desc; | 2680 | struct e1000_context_desc *context_desc; |
2680 | struct e1000_buffer *buffer_info; | 2681 | struct e1000_buffer *buffer_info; |
@@ -2692,7 +2693,7 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
2692 | 2693 | ||
2693 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 2694 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
2694 | mss = skb_shinfo(skb)->gso_size; | 2695 | mss = skb_shinfo(skb)->gso_size; |
2695 | if (skb->protocol == htons(ETH_P_IP)) { | 2696 | if (protocol == htons(ETH_P_IP)) { |
2696 | struct iphdr *iph = ip_hdr(skb); | 2697 | struct iphdr *iph = ip_hdr(skb); |
2697 | iph->tot_len = 0; | 2698 | iph->tot_len = 0; |
2698 | iph->check = 0; | 2699 | iph->check = 0; |
@@ -2702,7 +2703,7 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
2702 | 0); | 2703 | 0); |
2703 | cmd_length = E1000_TXD_CMD_IP; | 2704 | cmd_length = E1000_TXD_CMD_IP; |
2704 | ipcse = skb_transport_offset(skb) - 1; | 2705 | ipcse = skb_transport_offset(skb) - 1; |
2705 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 2706 | } else if (skb_is_gso_v6(skb)) { |
2706 | ipv6_hdr(skb)->payload_len = 0; | 2707 | ipv6_hdr(skb)->payload_len = 0; |
2707 | tcp_hdr(skb)->check = | 2708 | tcp_hdr(skb)->check = |
2708 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 2709 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
@@ -2745,7 +2746,8 @@ static int e1000_tso(struct e1000_adapter *adapter, | |||
2745 | } | 2746 | } |
2746 | 2747 | ||
2747 | static bool e1000_tx_csum(struct e1000_adapter *adapter, | 2748 | static bool e1000_tx_csum(struct e1000_adapter *adapter, |
2748 | struct e1000_tx_ring *tx_ring, struct sk_buff *skb) | 2749 | struct e1000_tx_ring *tx_ring, struct sk_buff *skb, |
2750 | __be16 protocol) | ||
2749 | { | 2751 | { |
2750 | struct e1000_context_desc *context_desc; | 2752 | struct e1000_context_desc *context_desc; |
2751 | struct e1000_buffer *buffer_info; | 2753 | struct e1000_buffer *buffer_info; |
@@ -2756,7 +2758,7 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, | |||
2756 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 2758 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
2757 | return false; | 2759 | return false; |
2758 | 2760 | ||
2759 | switch (skb->protocol) { | 2761 | switch (protocol) { |
2760 | case cpu_to_be16(ETH_P_IP): | 2762 | case cpu_to_be16(ETH_P_IP): |
2761 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | 2763 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
2762 | cmd_len |= E1000_TXD_CMD_TCP; | 2764 | cmd_len |= E1000_TXD_CMD_TCP; |
@@ -3097,6 +3099,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
3097 | int count = 0; | 3099 | int count = 0; |
3098 | int tso; | 3100 | int tso; |
3099 | unsigned int f; | 3101 | unsigned int f; |
3102 | __be16 protocol = vlan_get_protocol(skb); | ||
3100 | 3103 | ||
3101 | /* This goes back to the question of how to logically map a Tx queue | 3104 | /* This goes back to the question of how to logically map a Tx queue |
3102 | * to a flow. Right now, performance is impacted slightly negatively | 3105 | * to a flow. Right now, performance is impacted slightly negatively |
@@ -3210,7 +3213,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
3210 | 3213 | ||
3211 | first = tx_ring->next_to_use; | 3214 | first = tx_ring->next_to_use; |
3212 | 3215 | ||
3213 | tso = e1000_tso(adapter, tx_ring, skb); | 3216 | tso = e1000_tso(adapter, tx_ring, skb, protocol); |
3214 | if (tso < 0) { | 3217 | if (tso < 0) { |
3215 | dev_kfree_skb_any(skb); | 3218 | dev_kfree_skb_any(skb); |
3216 | return NETDEV_TX_OK; | 3219 | return NETDEV_TX_OK; |
@@ -3220,10 +3223,10 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
3220 | if (likely(hw->mac_type != e1000_82544)) | 3223 | if (likely(hw->mac_type != e1000_82544)) |
3221 | tx_ring->last_tx_tso = true; | 3224 | tx_ring->last_tx_tso = true; |
3222 | tx_flags |= E1000_TX_FLAGS_TSO; | 3225 | tx_flags |= E1000_TX_FLAGS_TSO; |
3223 | } else if (likely(e1000_tx_csum(adapter, tx_ring, skb))) | 3226 | } else if (likely(e1000_tx_csum(adapter, tx_ring, skb, protocol))) |
3224 | tx_flags |= E1000_TX_FLAGS_CSUM; | 3227 | tx_flags |= E1000_TX_FLAGS_CSUM; |
3225 | 3228 | ||
3226 | if (likely(skb->protocol == htons(ETH_P_IP))) | 3229 | if (protocol == htons(ETH_P_IP)) |
3227 | tx_flags |= E1000_TX_FLAGS_IPV4; | 3230 | tx_flags |= E1000_TX_FLAGS_IPV4; |
3228 | 3231 | ||
3229 | if (unlikely(skb->no_fcs)) | 3232 | if (unlikely(skb->no_fcs)) |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 65c3aef2bd36..247335d2c7ec 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -5164,7 +5164,8 @@ link_up: | |||
5164 | #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 | 5164 | #define E1000_TX_FLAGS_VLAN_MASK 0xffff0000 |
5165 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 | 5165 | #define E1000_TX_FLAGS_VLAN_SHIFT 16 |
5166 | 5166 | ||
5167 | static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) | 5167 | static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb, |
5168 | __be16 protocol) | ||
5168 | { | 5169 | { |
5169 | struct e1000_context_desc *context_desc; | 5170 | struct e1000_context_desc *context_desc; |
5170 | struct e1000_buffer *buffer_info; | 5171 | struct e1000_buffer *buffer_info; |
@@ -5183,7 +5184,7 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) | |||
5183 | 5184 | ||
5184 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | 5185 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
5185 | mss = skb_shinfo(skb)->gso_size; | 5186 | mss = skb_shinfo(skb)->gso_size; |
5186 | if (skb->protocol == htons(ETH_P_IP)) { | 5187 | if (protocol == htons(ETH_P_IP)) { |
5187 | struct iphdr *iph = ip_hdr(skb); | 5188 | struct iphdr *iph = ip_hdr(skb); |
5188 | iph->tot_len = 0; | 5189 | iph->tot_len = 0; |
5189 | iph->check = 0; | 5190 | iph->check = 0; |
@@ -5231,7 +5232,8 @@ static int e1000_tso(struct e1000_ring *tx_ring, struct sk_buff *skb) | |||
5231 | return 1; | 5232 | return 1; |
5232 | } | 5233 | } |
5233 | 5234 | ||
5234 | static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb) | 5235 | static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb, |
5236 | __be16 protocol) | ||
5235 | { | 5237 | { |
5236 | struct e1000_adapter *adapter = tx_ring->adapter; | 5238 | struct e1000_adapter *adapter = tx_ring->adapter; |
5237 | struct e1000_context_desc *context_desc; | 5239 | struct e1000_context_desc *context_desc; |
@@ -5239,16 +5241,10 @@ static bool e1000_tx_csum(struct e1000_ring *tx_ring, struct sk_buff *skb) | |||
5239 | unsigned int i; | 5241 | unsigned int i; |
5240 | u8 css; | 5242 | u8 css; |
5241 | u32 cmd_len = E1000_TXD_CMD_DEXT; | 5243 | u32 cmd_len = E1000_TXD_CMD_DEXT; |
5242 | __be16 protocol; | ||
5243 | 5244 | ||
5244 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 5245 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
5245 | return false; | 5246 | return false; |
5246 | 5247 | ||
5247 | if (skb->protocol == cpu_to_be16(ETH_P_8021Q)) | ||
5248 | protocol = vlan_eth_hdr(skb)->h_vlan_encapsulated_proto; | ||
5249 | else | ||
5250 | protocol = skb->protocol; | ||
5251 | |||
5252 | switch (protocol) { | 5248 | switch (protocol) { |
5253 | case cpu_to_be16(ETH_P_IP): | 5249 | case cpu_to_be16(ETH_P_IP): |
5254 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | 5250 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) |
@@ -5546,6 +5542,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
5546 | int count = 0; | 5542 | int count = 0; |
5547 | int tso; | 5543 | int tso; |
5548 | unsigned int f; | 5544 | unsigned int f; |
5545 | __be16 protocol = vlan_get_protocol(skb); | ||
5549 | 5546 | ||
5550 | if (test_bit(__E1000_DOWN, &adapter->state)) { | 5547 | if (test_bit(__E1000_DOWN, &adapter->state)) { |
5551 | dev_kfree_skb_any(skb); | 5548 | dev_kfree_skb_any(skb); |
@@ -5620,7 +5617,7 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
5620 | 5617 | ||
5621 | first = tx_ring->next_to_use; | 5618 | first = tx_ring->next_to_use; |
5622 | 5619 | ||
5623 | tso = e1000_tso(tx_ring, skb); | 5620 | tso = e1000_tso(tx_ring, skb, protocol); |
5624 | if (tso < 0) { | 5621 | if (tso < 0) { |
5625 | dev_kfree_skb_any(skb); | 5622 | dev_kfree_skb_any(skb); |
5626 | return NETDEV_TX_OK; | 5623 | return NETDEV_TX_OK; |
@@ -5628,14 +5625,14 @@ static netdev_tx_t e1000_xmit_frame(struct sk_buff *skb, | |||
5628 | 5625 | ||
5629 | if (tso) | 5626 | if (tso) |
5630 | tx_flags |= E1000_TX_FLAGS_TSO; | 5627 | tx_flags |= E1000_TX_FLAGS_TSO; |
5631 | else if (e1000_tx_csum(tx_ring, skb)) | 5628 | else if (e1000_tx_csum(tx_ring, skb, protocol)) |
5632 | tx_flags |= E1000_TX_FLAGS_CSUM; | 5629 | tx_flags |= E1000_TX_FLAGS_CSUM; |
5633 | 5630 | ||
5634 | /* Old method was to assume IPv4 packet by default if TSO was enabled. | 5631 | /* Old method was to assume IPv4 packet by default if TSO was enabled. |
5635 | * 82571 hardware supports TSO capabilities for IPv6 as well... | 5632 | * 82571 hardware supports TSO capabilities for IPv6 as well... |
5636 | * no longer assume, we must. | 5633 | * no longer assume, we must. |
5637 | */ | 5634 | */ |
5638 | if (skb->protocol == htons(ETH_P_IP)) | 5635 | if (protocol == htons(ETH_P_IP)) |
5639 | tx_flags |= E1000_TX_FLAGS_IPV4; | 5636 | tx_flags |= E1000_TX_FLAGS_IPV4; |
5640 | 5637 | ||
5641 | if (unlikely(skb->no_fcs)) | 5638 | if (unlikely(skb->no_fcs)) |
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c index a51aa37b7b5a..369848e107f8 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c | |||
@@ -2295,7 +2295,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, | |||
2295 | goto out_drop; | 2295 | goto out_drop; |
2296 | 2296 | ||
2297 | /* obtain protocol of skb */ | 2297 | /* obtain protocol of skb */ |
2298 | protocol = skb->protocol; | 2298 | protocol = vlan_get_protocol(skb); |
2299 | 2299 | ||
2300 | /* record the location of the first descriptor for this packet */ | 2300 | /* record the location of the first descriptor for this packet */ |
2301 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; | 2301 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; |
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c index 79bf96ca6489..95a3ec236b49 100644 --- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c +++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c | |||
@@ -1597,7 +1597,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb, | |||
1597 | goto out_drop; | 1597 | goto out_drop; |
1598 | 1598 | ||
1599 | /* obtain protocol of skb */ | 1599 | /* obtain protocol of skb */ |
1600 | protocol = skb->protocol; | 1600 | protocol = vlan_get_protocol(skb); |
1601 | 1601 | ||
1602 | /* record the location of the first descriptor for this packet */ | 1602 | /* record the location of the first descriptor for this packet */ |
1603 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; | 1603 | first = &tx_ring->tx_bi[tx_ring->next_to_use]; |
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index c9f1d1b7ef37..ade067de1689 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/mbus.h> | 20 | #include <linux/mbus.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/if_vlan.h> | ||
23 | #include <net/ip.h> | 24 | #include <net/ip.h> |
24 | #include <net/ipv6.h> | 25 | #include <net/ipv6.h> |
25 | #include <linux/io.h> | 26 | #include <linux/io.h> |
@@ -1371,15 +1372,16 @@ static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb) | |||
1371 | { | 1372 | { |
1372 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1373 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1373 | int ip_hdr_len = 0; | 1374 | int ip_hdr_len = 0; |
1375 | __be16 l3_proto = vlan_get_protocol(skb); | ||
1374 | u8 l4_proto; | 1376 | u8 l4_proto; |
1375 | 1377 | ||
1376 | if (skb->protocol == htons(ETH_P_IP)) { | 1378 | if (l3_proto == htons(ETH_P_IP)) { |
1377 | struct iphdr *ip4h = ip_hdr(skb); | 1379 | struct iphdr *ip4h = ip_hdr(skb); |
1378 | 1380 | ||
1379 | /* Calculate IPv4 checksum and L4 checksum */ | 1381 | /* Calculate IPv4 checksum and L4 checksum */ |
1380 | ip_hdr_len = ip4h->ihl; | 1382 | ip_hdr_len = ip4h->ihl; |
1381 | l4_proto = ip4h->protocol; | 1383 | l4_proto = ip4h->protocol; |
1382 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 1384 | } else if (l3_proto == htons(ETH_P_IPV6)) { |
1383 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | 1385 | struct ipv6hdr *ip6h = ipv6_hdr(skb); |
1384 | 1386 | ||
1385 | /* Read l4_protocol from one of IPv6 extra headers */ | 1387 | /* Read l4_protocol from one of IPv6 extra headers */ |
@@ -1390,7 +1392,7 @@ static u32 mvneta_skb_tx_csum(struct mvneta_port *pp, struct sk_buff *skb) | |||
1390 | return MVNETA_TX_L4_CSUM_NOT; | 1392 | return MVNETA_TX_L4_CSUM_NOT; |
1391 | 1393 | ||
1392 | return mvneta_txq_desc_csum(skb_network_offset(skb), | 1394 | return mvneta_txq_desc_csum(skb_network_offset(skb), |
1393 | skb->protocol, ip_hdr_len, l4_proto); | 1395 | l3_proto, ip_hdr_len, l4_proto); |
1394 | } | 1396 | } |
1395 | 1397 | ||
1396 | return MVNETA_TX_L4_CSUM_NOT; | 1398 | return MVNETA_TX_L4_CSUM_NOT; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 65a4a0f88ea0..02a2e90d581a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -2389,6 +2389,22 @@ struct mlx4_slaves_pport mlx4_phys_to_slaves_pport_actv( | |||
2389 | } | 2389 | } |
2390 | EXPORT_SYMBOL_GPL(mlx4_phys_to_slaves_pport_actv); | 2390 | EXPORT_SYMBOL_GPL(mlx4_phys_to_slaves_pport_actv); |
2391 | 2391 | ||
2392 | static int mlx4_slaves_closest_port(struct mlx4_dev *dev, int slave, int port) | ||
2393 | { | ||
2394 | struct mlx4_active_ports actv_ports = mlx4_get_active_ports(dev, slave); | ||
2395 | int min_port = find_first_bit(actv_ports.ports, dev->caps.num_ports) | ||
2396 | + 1; | ||
2397 | int max_port = min_port + | ||
2398 | bitmap_weight(actv_ports.ports, dev->caps.num_ports); | ||
2399 | |||
2400 | if (port < min_port) | ||
2401 | port = min_port; | ||
2402 | else if (port >= max_port) | ||
2403 | port = max_port - 1; | ||
2404 | |||
2405 | return port; | ||
2406 | } | ||
2407 | |||
2392 | int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) | 2408 | int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) |
2393 | { | 2409 | { |
2394 | struct mlx4_priv *priv = mlx4_priv(dev); | 2410 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -2402,6 +2418,7 @@ int mlx4_set_vf_mac(struct mlx4_dev *dev, int port, int vf, u64 mac) | |||
2402 | if (slave < 0) | 2418 | if (slave < 0) |
2403 | return -EINVAL; | 2419 | return -EINVAL; |
2404 | 2420 | ||
2421 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2405 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2422 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2406 | s_info->mac = mac; | 2423 | s_info->mac = mac; |
2407 | mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n", | 2424 | mlx4_info(dev, "default mac on vf %d port %d to %llX will take afect only after vf restart\n", |
@@ -2428,6 +2445,7 @@ int mlx4_set_vf_vlan(struct mlx4_dev *dev, int port, int vf, u16 vlan, u8 qos) | |||
2428 | if (slave < 0) | 2445 | if (slave < 0) |
2429 | return -EINVAL; | 2446 | return -EINVAL; |
2430 | 2447 | ||
2448 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2431 | vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2449 | vf_admin = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2432 | 2450 | ||
2433 | if ((0 == vlan) && (0 == qos)) | 2451 | if ((0 == vlan) && (0 == qos)) |
@@ -2455,6 +2473,7 @@ bool mlx4_get_slave_default_vlan(struct mlx4_dev *dev, int port, int slave, | |||
2455 | struct mlx4_priv *priv; | 2473 | struct mlx4_priv *priv; |
2456 | 2474 | ||
2457 | priv = mlx4_priv(dev); | 2475 | priv = mlx4_priv(dev); |
2476 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2458 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; | 2477 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; |
2459 | 2478 | ||
2460 | if (MLX4_VGT != vp_oper->state.default_vlan) { | 2479 | if (MLX4_VGT != vp_oper->state.default_vlan) { |
@@ -2482,6 +2501,7 @@ int mlx4_set_vf_spoofchk(struct mlx4_dev *dev, int port, int vf, bool setting) | |||
2482 | if (slave < 0) | 2501 | if (slave < 0) |
2483 | return -EINVAL; | 2502 | return -EINVAL; |
2484 | 2503 | ||
2504 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2485 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; | 2505 | s_info = &priv->mfunc.master.vf_admin[slave].vport[port]; |
2486 | s_info->spoofchk = setting; | 2506 | s_info->spoofchk = setting; |
2487 | 2507 | ||
@@ -2535,6 +2555,7 @@ int mlx4_set_vf_link_state(struct mlx4_dev *dev, int port, int vf, int link_stat | |||
2535 | if (slave < 0) | 2555 | if (slave < 0) |
2536 | return -EINVAL; | 2556 | return -EINVAL; |
2537 | 2557 | ||
2558 | port = mlx4_slaves_closest_port(dev, slave, port); | ||
2538 | switch (link_state) { | 2559 | switch (link_state) { |
2539 | case IFLA_VF_LINK_STATE_AUTO: | 2560 | case IFLA_VF_LINK_STATE_AUTO: |
2540 | /* get current link state */ | 2561 | /* get current link state */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index e22f24f784fc..35ff2925110a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -487,6 +487,9 @@ static int mlx4_en_set_pauseparam(struct net_device *dev, | |||
487 | struct mlx4_en_dev *mdev = priv->mdev; | 487 | struct mlx4_en_dev *mdev = priv->mdev; |
488 | int err; | 488 | int err; |
489 | 489 | ||
490 | if (pause->autoneg) | ||
491 | return -EINVAL; | ||
492 | |||
490 | priv->prof->tx_pause = pause->tx_pause != 0; | 493 | priv->prof->tx_pause = pause->tx_pause != 0; |
491 | priv->prof->rx_pause = pause->rx_pause != 0; | 494 | priv->prof->rx_pause = pause->rx_pause != 0; |
492 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 495 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index bb536aa613f4..abddcf8c40aa 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -474,39 +474,12 @@ static int mlx4_en_tunnel_steer_add(struct mlx4_en_priv *priv, unsigned char *ad | |||
474 | int qpn, u64 *reg_id) | 474 | int qpn, u64 *reg_id) |
475 | { | 475 | { |
476 | int err; | 476 | int err; |
477 | struct mlx4_spec_list spec_eth_outer = { {NULL} }; | ||
478 | struct mlx4_spec_list spec_vxlan = { {NULL} }; | ||
479 | struct mlx4_spec_list spec_eth_inner = { {NULL} }; | ||
480 | |||
481 | struct mlx4_net_trans_rule rule = { | ||
482 | .queue_mode = MLX4_NET_TRANS_Q_FIFO, | ||
483 | .exclusive = 0, | ||
484 | .allow_loopback = 1, | ||
485 | .promisc_mode = MLX4_FS_REGULAR, | ||
486 | .priority = MLX4_DOMAIN_NIC, | ||
487 | }; | ||
488 | |||
489 | __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); | ||
490 | 477 | ||
491 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) | 478 | if (priv->mdev->dev->caps.tunnel_offload_mode != MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) |
492 | return 0; /* do nothing */ | 479 | return 0; /* do nothing */ |
493 | 480 | ||
494 | rule.port = priv->port; | 481 | err = mlx4_tunnel_steer_add(priv->mdev->dev, addr, priv->port, qpn, |
495 | rule.qpn = qpn; | 482 | MLX4_DOMAIN_NIC, reg_id); |
496 | INIT_LIST_HEAD(&rule.list); | ||
497 | |||
498 | spec_eth_outer.id = MLX4_NET_TRANS_RULE_ID_ETH; | ||
499 | memcpy(spec_eth_outer.eth.dst_mac, addr, ETH_ALEN); | ||
500 | memcpy(spec_eth_outer.eth.dst_mac_msk, &mac_mask, ETH_ALEN); | ||
501 | |||
502 | spec_vxlan.id = MLX4_NET_TRANS_RULE_ID_VXLAN; /* any vxlan header */ | ||
503 | spec_eth_inner.id = MLX4_NET_TRANS_RULE_ID_ETH; /* any inner eth header */ | ||
504 | |||
505 | list_add_tail(&spec_eth_outer.list, &rule.list); | ||
506 | list_add_tail(&spec_vxlan.list, &rule.list); | ||
507 | list_add_tail(&spec_eth_inner.list, &rule.list); | ||
508 | |||
509 | err = mlx4_flow_attach(priv->mdev->dev, &rule, reg_id); | ||
510 | if (err) { | 483 | if (err) { |
511 | en_err(priv, "failed to add vxlan steering rule, err %d\n", err); | 484 | en_err(priv, "failed to add vxlan steering rule, err %d\n", err); |
512 | return err; | 485 | return err; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 7e2d5d57c598..871e3a5bda38 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -78,13 +78,13 @@ MODULE_PARM_DESC(msi_x, "attempt to use MSI-X if nonzero"); | |||
78 | #endif /* CONFIG_PCI_MSI */ | 78 | #endif /* CONFIG_PCI_MSI */ |
79 | 79 | ||
80 | static uint8_t num_vfs[3] = {0, 0, 0}; | 80 | static uint8_t num_vfs[3] = {0, 0, 0}; |
81 | static int num_vfs_argc = 3; | 81 | static int num_vfs_argc; |
82 | module_param_array(num_vfs, byte , &num_vfs_argc, 0444); | 82 | module_param_array(num_vfs, byte , &num_vfs_argc, 0444); |
83 | MODULE_PARM_DESC(num_vfs, "enable #num_vfs functions if num_vfs > 0\n" | 83 | MODULE_PARM_DESC(num_vfs, "enable #num_vfs functions if num_vfs > 0\n" |
84 | "num_vfs=port1,port2,port1+2"); | 84 | "num_vfs=port1,port2,port1+2"); |
85 | 85 | ||
86 | static uint8_t probe_vf[3] = {0, 0, 0}; | 86 | static uint8_t probe_vf[3] = {0, 0, 0}; |
87 | static int probe_vfs_argc = 3; | 87 | static int probe_vfs_argc; |
88 | module_param_array(probe_vf, byte, &probe_vfs_argc, 0444); | 88 | module_param_array(probe_vf, byte, &probe_vfs_argc, 0444); |
89 | MODULE_PARM_DESC(probe_vf, "number of vfs to probe by pf driver (num_vfs > 0)\n" | 89 | MODULE_PARM_DESC(probe_vf, "number of vfs to probe by pf driver (num_vfs > 0)\n" |
90 | "probe_vf=port1,port2,port1+2"); | 90 | "probe_vf=port1,port2,port1+2"); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index d80e7a6fac74..ca0f98c95105 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -1020,6 +1020,44 @@ int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id) | |||
1020 | } | 1020 | } |
1021 | EXPORT_SYMBOL_GPL(mlx4_flow_detach); | 1021 | EXPORT_SYMBOL_GPL(mlx4_flow_detach); |
1022 | 1022 | ||
1023 | int mlx4_tunnel_steer_add(struct mlx4_dev *dev, unsigned char *addr, | ||
1024 | int port, int qpn, u16 prio, u64 *reg_id) | ||
1025 | { | ||
1026 | int err; | ||
1027 | struct mlx4_spec_list spec_eth_outer = { {NULL} }; | ||
1028 | struct mlx4_spec_list spec_vxlan = { {NULL} }; | ||
1029 | struct mlx4_spec_list spec_eth_inner = { {NULL} }; | ||
1030 | |||
1031 | struct mlx4_net_trans_rule rule = { | ||
1032 | .queue_mode = MLX4_NET_TRANS_Q_FIFO, | ||
1033 | .exclusive = 0, | ||
1034 | .allow_loopback = 1, | ||
1035 | .promisc_mode = MLX4_FS_REGULAR, | ||
1036 | }; | ||
1037 | |||
1038 | __be64 mac_mask = cpu_to_be64(MLX4_MAC_MASK << 16); | ||
1039 | |||
1040 | rule.port = port; | ||
1041 | rule.qpn = qpn; | ||
1042 | rule.priority = prio; | ||
1043 | INIT_LIST_HEAD(&rule.list); | ||
1044 | |||
1045 | spec_eth_outer.id = MLX4_NET_TRANS_RULE_ID_ETH; | ||
1046 | memcpy(spec_eth_outer.eth.dst_mac, addr, ETH_ALEN); | ||
1047 | memcpy(spec_eth_outer.eth.dst_mac_msk, &mac_mask, ETH_ALEN); | ||
1048 | |||
1049 | spec_vxlan.id = MLX4_NET_TRANS_RULE_ID_VXLAN; /* any vxlan header */ | ||
1050 | spec_eth_inner.id = MLX4_NET_TRANS_RULE_ID_ETH; /* any inner eth header */ | ||
1051 | |||
1052 | list_add_tail(&spec_eth_outer.list, &rule.list); | ||
1053 | list_add_tail(&spec_vxlan.list, &rule.list); | ||
1054 | list_add_tail(&spec_eth_inner.list, &rule.list); | ||
1055 | |||
1056 | err = mlx4_flow_attach(dev, &rule, reg_id); | ||
1057 | return err; | ||
1058 | } | ||
1059 | EXPORT_SYMBOL(mlx4_tunnel_steer_add); | ||
1060 | |||
1023 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, | 1061 | int mlx4_FLOW_STEERING_IB_UC_QP_RANGE(struct mlx4_dev *dev, u32 min_range_qpn, |
1024 | u32 max_range_qpn) | 1062 | u32 max_range_qpn) |
1025 | { | 1063 | { |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c index 7d717eccb7b0..193a6adb5d04 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mr.c +++ b/drivers/net/ethernet/mellanox/mlx4/mr.c | |||
@@ -298,6 +298,7 @@ static int mlx4_HW2SW_MPT(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox | |||
298 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); | 298 | MLX4_CMD_TIME_CLASS_B, MLX4_CMD_WRAPPED); |
299 | } | 299 | } |
300 | 300 | ||
301 | /* Must protect against concurrent access */ | ||
301 | int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, | 302 | int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, |
302 | struct mlx4_mpt_entry ***mpt_entry) | 303 | struct mlx4_mpt_entry ***mpt_entry) |
303 | { | 304 | { |
@@ -305,13 +306,10 @@ int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, | |||
305 | int key = key_to_hw_index(mmr->key) & (dev->caps.num_mpts - 1); | 306 | int key = key_to_hw_index(mmr->key) & (dev->caps.num_mpts - 1); |
306 | struct mlx4_cmd_mailbox *mailbox = NULL; | 307 | struct mlx4_cmd_mailbox *mailbox = NULL; |
307 | 308 | ||
308 | /* Make sure that at this point we have single-threaded access only */ | ||
309 | |||
310 | if (mmr->enabled != MLX4_MPT_EN_HW) | 309 | if (mmr->enabled != MLX4_MPT_EN_HW) |
311 | return -EINVAL; | 310 | return -EINVAL; |
312 | 311 | ||
313 | err = mlx4_HW2SW_MPT(dev, NULL, key); | 312 | err = mlx4_HW2SW_MPT(dev, NULL, key); |
314 | |||
315 | if (err) { | 313 | if (err) { |
316 | mlx4_warn(dev, "HW2SW_MPT failed (%d).", err); | 314 | mlx4_warn(dev, "HW2SW_MPT failed (%d).", err); |
317 | mlx4_warn(dev, "Most likely the MR has MWs bound to it.\n"); | 315 | mlx4_warn(dev, "Most likely the MR has MWs bound to it.\n"); |
@@ -333,7 +331,6 @@ int mlx4_mr_hw_get_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, | |||
333 | 0, MLX4_CMD_QUERY_MPT, | 331 | 0, MLX4_CMD_QUERY_MPT, |
334 | MLX4_CMD_TIME_CLASS_B, | 332 | MLX4_CMD_TIME_CLASS_B, |
335 | MLX4_CMD_WRAPPED); | 333 | MLX4_CMD_WRAPPED); |
336 | |||
337 | if (err) | 334 | if (err) |
338 | goto free_mailbox; | 335 | goto free_mailbox; |
339 | 336 | ||
@@ -378,9 +375,10 @@ int mlx4_mr_hw_write_mpt(struct mlx4_dev *dev, struct mlx4_mr *mmr, | |||
378 | err = mlx4_SW2HW_MPT(dev, mailbox, key); | 375 | err = mlx4_SW2HW_MPT(dev, mailbox, key); |
379 | } | 376 | } |
380 | 377 | ||
381 | mmr->pd = be32_to_cpu((*mpt_entry)->pd_flags) & MLX4_MPT_PD_MASK; | 378 | if (!err) { |
382 | if (!err) | 379 | mmr->pd = be32_to_cpu((*mpt_entry)->pd_flags) & MLX4_MPT_PD_MASK; |
383 | mmr->enabled = MLX4_MPT_EN_HW; | 380 | mmr->enabled = MLX4_MPT_EN_HW; |
381 | } | ||
384 | return err; | 382 | return err; |
385 | } | 383 | } |
386 | EXPORT_SYMBOL_GPL(mlx4_mr_hw_write_mpt); | 384 | EXPORT_SYMBOL_GPL(mlx4_mr_hw_write_mpt); |
@@ -400,11 +398,12 @@ EXPORT_SYMBOL_GPL(mlx4_mr_hw_put_mpt); | |||
400 | int mlx4_mr_hw_change_pd(struct mlx4_dev *dev, struct mlx4_mpt_entry *mpt_entry, | 398 | int mlx4_mr_hw_change_pd(struct mlx4_dev *dev, struct mlx4_mpt_entry *mpt_entry, |
401 | u32 pdn) | 399 | u32 pdn) |
402 | { | 400 | { |
403 | u32 pd_flags = be32_to_cpu(mpt_entry->pd_flags); | 401 | u32 pd_flags = be32_to_cpu(mpt_entry->pd_flags) & ~MLX4_MPT_PD_MASK; |
404 | /* The wrapper function will put the slave's id here */ | 402 | /* The wrapper function will put the slave's id here */ |
405 | if (mlx4_is_mfunc(dev)) | 403 | if (mlx4_is_mfunc(dev)) |
406 | pd_flags &= ~MLX4_MPT_PD_VF_MASK; | 404 | pd_flags &= ~MLX4_MPT_PD_VF_MASK; |
407 | mpt_entry->pd_flags = cpu_to_be32((pd_flags & ~MLX4_MPT_PD_MASK) | | 405 | |
406 | mpt_entry->pd_flags = cpu_to_be32(pd_flags | | ||
408 | (pdn & MLX4_MPT_PD_MASK) | 407 | (pdn & MLX4_MPT_PD_MASK) |
409 | | MLX4_MPT_PD_FLAG_EN_INV); | 408 | | MLX4_MPT_PD_FLAG_EN_INV); |
410 | return 0; | 409 | return 0; |
@@ -600,14 +599,18 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr, | |||
600 | { | 599 | { |
601 | int err; | 600 | int err; |
602 | 601 | ||
603 | mpt_entry->start = cpu_to_be64(mr->iova); | 602 | mpt_entry->start = cpu_to_be64(iova); |
604 | mpt_entry->length = cpu_to_be64(mr->size); | 603 | mpt_entry->length = cpu_to_be64(size); |
605 | mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); | 604 | mpt_entry->entity_size = cpu_to_be32(page_shift); |
606 | 605 | ||
607 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); | 606 | err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt); |
608 | if (err) | 607 | if (err) |
609 | return err; | 608 | return err; |
610 | 609 | ||
610 | mpt_entry->pd_flags &= cpu_to_be32(MLX4_MPT_PD_MASK | | ||
611 | MLX4_MPT_PD_FLAG_EN_INV); | ||
612 | mpt_entry->flags &= cpu_to_be32(MLX4_MPT_FLAG_FREE | | ||
613 | MLX4_MPT_FLAG_SW_OWNS); | ||
611 | if (mr->mtt.order < 0) { | 614 | if (mr->mtt.order < 0) { |
612 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL); | 615 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL); |
613 | mpt_entry->mtt_addr = 0; | 616 | mpt_entry->mtt_addr = 0; |
@@ -617,6 +620,14 @@ int mlx4_mr_rereg_mem_write(struct mlx4_dev *dev, struct mlx4_mr *mr, | |||
617 | if (mr->mtt.page_shift == 0) | 620 | if (mr->mtt.page_shift == 0) |
618 | mpt_entry->mtt_sz = cpu_to_be32(1 << mr->mtt.order); | 621 | mpt_entry->mtt_sz = cpu_to_be32(1 << mr->mtt.order); |
619 | } | 622 | } |
623 | if (mr->mtt.order >= 0 && mr->mtt.page_shift == 0) { | ||
624 | /* fast register MR in free state */ | ||
625 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_FREE); | ||
626 | mpt_entry->pd_flags |= cpu_to_be32(MLX4_MPT_PD_FLAG_FAST_REG | | ||
627 | MLX4_MPT_PD_FLAG_RAE); | ||
628 | } else { | ||
629 | mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_SW_OWNS); | ||
630 | } | ||
620 | mr->enabled = MLX4_MPT_EN_SW; | 631 | mr->enabled = MLX4_MPT_EN_SW; |
621 | 632 | ||
622 | return 0; | 633 | return 0; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 9ba0c1ca10d5..94eeb2c7d7e4 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
@@ -103,7 +103,8 @@ static int find_index(struct mlx4_dev *dev, | |||
103 | int i; | 103 | int i; |
104 | 104 | ||
105 | for (i = 0; i < MLX4_MAX_MAC_NUM; i++) { | 105 | for (i = 0; i < MLX4_MAX_MAC_NUM; i++) { |
106 | if ((mac & MLX4_MAC_MASK) == | 106 | if (table->refs[i] && |
107 | (MLX4_MAC_MASK & mac) == | ||
107 | (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) | 108 | (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) |
108 | return i; | 109 | return i; |
109 | } | 110 | } |
@@ -165,12 +166,14 @@ int __mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac) | |||
165 | 166 | ||
166 | mutex_lock(&table->mutex); | 167 | mutex_lock(&table->mutex); |
167 | for (i = 0; i < MLX4_MAX_MAC_NUM; i++) { | 168 | for (i = 0; i < MLX4_MAX_MAC_NUM; i++) { |
168 | if (free < 0 && !table->entries[i]) { | 169 | if (!table->refs[i]) { |
169 | free = i; | 170 | if (free < 0) |
171 | free = i; | ||
170 | continue; | 172 | continue; |
171 | } | 173 | } |
172 | 174 | ||
173 | if (mac == (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) { | 175 | if ((MLX4_MAC_MASK & mac) == |
176 | (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) { | ||
174 | /* MAC already registered, increment ref count */ | 177 | /* MAC already registered, increment ref count */ |
175 | err = i; | 178 | err = i; |
176 | ++table->refs[i]; | 179 | ++table->refs[i]; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c index 0dc31d85fc3b..2301365c79c7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/qp.c +++ b/drivers/net/ethernet/mellanox/mlx4/qp.c | |||
@@ -390,13 +390,14 @@ err_icm: | |||
390 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); | 390 | EXPORT_SYMBOL_GPL(mlx4_qp_alloc); |
391 | 391 | ||
392 | #define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC | 392 | #define MLX4_UPDATE_QP_SUPPORTED_ATTRS MLX4_UPDATE_QP_SMAC |
393 | int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, | 393 | int mlx4_update_qp(struct mlx4_dev *dev, u32 qpn, |
394 | enum mlx4_update_qp_attr attr, | 394 | enum mlx4_update_qp_attr attr, |
395 | struct mlx4_update_qp_params *params) | 395 | struct mlx4_update_qp_params *params) |
396 | { | 396 | { |
397 | struct mlx4_cmd_mailbox *mailbox; | 397 | struct mlx4_cmd_mailbox *mailbox; |
398 | struct mlx4_update_qp_context *cmd; | 398 | struct mlx4_update_qp_context *cmd; |
399 | u64 pri_addr_path_mask = 0; | 399 | u64 pri_addr_path_mask = 0; |
400 | u64 qp_mask = 0; | ||
400 | int err = 0; | 401 | int err = 0; |
401 | 402 | ||
402 | mailbox = mlx4_alloc_cmd_mailbox(dev); | 403 | mailbox = mlx4_alloc_cmd_mailbox(dev); |
@@ -413,9 +414,16 @@ int mlx4_update_qp(struct mlx4_dev *dev, struct mlx4_qp *qp, | |||
413 | cmd->qp_context.pri_path.grh_mylmc = params->smac_index; | 414 | cmd->qp_context.pri_path.grh_mylmc = params->smac_index; |
414 | } | 415 | } |
415 | 416 | ||
417 | if (attr & MLX4_UPDATE_QP_VSD) { | ||
418 | qp_mask |= 1ULL << MLX4_UPD_QP_MASK_VSD; | ||
419 | if (params->flags & MLX4_UPDATE_QP_PARAMS_FLAGS_VSD_ENABLE) | ||
420 | cmd->qp_context.param3 |= cpu_to_be32(MLX4_STRIP_VLAN); | ||
421 | } | ||
422 | |||
416 | cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask); | 423 | cmd->primary_addr_path_mask = cpu_to_be64(pri_addr_path_mask); |
424 | cmd->qp_mask = cpu_to_be64(qp_mask); | ||
417 | 425 | ||
418 | err = mlx4_cmd(dev, mailbox->dma, qp->qpn & 0xffffff, 0, | 426 | err = mlx4_cmd(dev, mailbox->dma, qpn & 0xffffff, 0, |
419 | MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A, | 427 | MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A, |
420 | MLX4_CMD_NATIVE); | 428 | MLX4_CMD_NATIVE); |
421 | 429 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 1089367fed22..5d2498dcf536 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -702,11 +702,13 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
702 | struct mlx4_qp_context *qpc = inbox->buf + 8; | 702 | struct mlx4_qp_context *qpc = inbox->buf + 8; |
703 | struct mlx4_vport_oper_state *vp_oper; | 703 | struct mlx4_vport_oper_state *vp_oper; |
704 | struct mlx4_priv *priv; | 704 | struct mlx4_priv *priv; |
705 | u32 qp_type; | ||
705 | int port; | 706 | int port; |
706 | 707 | ||
707 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; | 708 | port = (qpc->pri_path.sched_queue & 0x40) ? 2 : 1; |
708 | priv = mlx4_priv(dev); | 709 | priv = mlx4_priv(dev); |
709 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; | 710 | vp_oper = &priv->mfunc.master.vf_oper[slave].vport[port]; |
711 | qp_type = (be32_to_cpu(qpc->flags) >> 16) & 0xff; | ||
710 | 712 | ||
711 | if (MLX4_VGT != vp_oper->state.default_vlan) { | 713 | if (MLX4_VGT != vp_oper->state.default_vlan) { |
712 | /* the reserved QPs (special, proxy, tunnel) | 714 | /* the reserved QPs (special, proxy, tunnel) |
@@ -715,8 +717,20 @@ static int update_vport_qp_param(struct mlx4_dev *dev, | |||
715 | if (mlx4_is_qp_reserved(dev, qpn)) | 717 | if (mlx4_is_qp_reserved(dev, qpn)) |
716 | return 0; | 718 | return 0; |
717 | 719 | ||
718 | /* force strip vlan by clear vsd */ | 720 | /* force strip vlan by clear vsd, MLX QP refers to Raw Ethernet */ |
719 | qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); | 721 | if (qp_type == MLX4_QP_ST_UD || |
722 | (qp_type == MLX4_QP_ST_MLX && mlx4_is_eth(dev, port))) { | ||
723 | if (dev->caps.bmme_flags & MLX4_BMME_FLAG_VSD_INIT2RTR) { | ||
724 | *(__be32 *)inbox->buf = | ||
725 | cpu_to_be32(be32_to_cpu(*(__be32 *)inbox->buf) | | ||
726 | MLX4_QP_OPTPAR_VLAN_STRIPPING); | ||
727 | qpc->param3 &= ~cpu_to_be32(MLX4_STRIP_VLAN); | ||
728 | } else { | ||
729 | struct mlx4_update_qp_params params = {.flags = 0}; | ||
730 | |||
731 | mlx4_update_qp(dev, qpn, MLX4_UPDATE_QP_VSD, ¶ms); | ||
732 | } | ||
733 | } | ||
720 | 734 | ||
721 | if (vp_oper->state.link_state == IFLA_VF_LINK_STATE_DISABLE && | 735 | if (vp_oper->state.link_state == IFLA_VF_LINK_STATE_DISABLE && |
722 | dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_UPDATE_QP) { | 736 | dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_UPDATE_QP) { |
@@ -3998,13 +4012,17 @@ int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave, | |||
3998 | } | 4012 | } |
3999 | 4013 | ||
4000 | port = (rqp->sched_queue >> 6 & 1) + 1; | 4014 | port = (rqp->sched_queue >> 6 & 1) + 1; |
4001 | smac_index = cmd->qp_context.pri_path.grh_mylmc; | 4015 | |
4002 | err = mac_find_smac_ix_in_slave(dev, slave, port, | 4016 | if (pri_addr_path_mask & (1ULL << MLX4_UPD_QP_PATH_MASK_MAC_INDEX)) { |
4003 | smac_index, &mac); | 4017 | smac_index = cmd->qp_context.pri_path.grh_mylmc; |
4004 | if (err) { | 4018 | err = mac_find_smac_ix_in_slave(dev, slave, port, |
4005 | mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n", | 4019 | smac_index, &mac); |
4006 | qpn, smac_index); | 4020 | |
4007 | goto err_mac; | 4021 | if (err) { |
4022 | mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n", | ||
4023 | qpn, smac_index); | ||
4024 | goto err_mac; | ||
4025 | } | ||
4008 | } | 4026 | } |
4009 | 4027 | ||
4010 | err = mlx4_cmd(dev, inbox->dma, | 4028 | err = mlx4_cmd(dev, inbox->dma, |
@@ -4818,7 +4836,7 @@ void mlx4_vf_immed_vlan_work_handler(struct work_struct *_work) | |||
4818 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; | 4836 | MLX4_VLAN_CTRL_ETH_RX_BLOCK_UNTAGGED; |
4819 | 4837 | ||
4820 | upd_context = mailbox->buf; | 4838 | upd_context = mailbox->buf; |
4821 | upd_context->qp_mask = cpu_to_be64(MLX4_UPD_QP_MASK_VSD); | 4839 | upd_context->qp_mask = cpu_to_be64(1ULL << MLX4_UPD_QP_MASK_VSD); |
4822 | 4840 | ||
4823 | spin_lock_irq(mlx4_tlock(dev)); | 4841 | spin_lock_irq(mlx4_tlock(dev)); |
4824 | list_for_each_entry_safe(qp, tmp, qp_list, com.list) { | 4842 | list_for_each_entry_safe(qp, tmp, qp_list, com.list) { |
diff --git a/drivers/net/ethernet/moxa/moxart_ether.c b/drivers/net/ethernet/moxa/moxart_ether.c index 5020fd47825d..2f12c88c66ab 100644 --- a/drivers/net/ethernet/moxa/moxart_ether.c +++ b/drivers/net/ethernet/moxa/moxart_ether.c | |||
@@ -206,7 +206,7 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) | |||
206 | int rx_head = priv->rx_head; | 206 | int rx_head = priv->rx_head; |
207 | int rx = 0; | 207 | int rx = 0; |
208 | 208 | ||
209 | while (1) { | 209 | while (rx < budget) { |
210 | desc = priv->rx_desc_base + (RX_REG_DESC_SIZE * rx_head); | 210 | desc = priv->rx_desc_base + (RX_REG_DESC_SIZE * rx_head); |
211 | desc0 = readl(desc + RX_REG_OFFSET_DESC0); | 211 | desc0 = readl(desc + RX_REG_OFFSET_DESC0); |
212 | 212 | ||
@@ -218,7 +218,7 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) | |||
218 | net_dbg_ratelimited("packet error\n"); | 218 | net_dbg_ratelimited("packet error\n"); |
219 | priv->stats.rx_dropped++; | 219 | priv->stats.rx_dropped++; |
220 | priv->stats.rx_errors++; | 220 | priv->stats.rx_errors++; |
221 | continue; | 221 | goto rx_next; |
222 | } | 222 | } |
223 | 223 | ||
224 | len = desc0 & RX_DESC0_FRAME_LEN_MASK; | 224 | len = desc0 & RX_DESC0_FRAME_LEN_MASK; |
@@ -226,13 +226,19 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) | |||
226 | if (len > RX_BUF_SIZE) | 226 | if (len > RX_BUF_SIZE) |
227 | len = RX_BUF_SIZE; | 227 | len = RX_BUF_SIZE; |
228 | 228 | ||
229 | skb = build_skb(priv->rx_buf[rx_head], priv->rx_buf_size); | 229 | dma_sync_single_for_cpu(&ndev->dev, |
230 | priv->rx_mapping[rx_head], | ||
231 | priv->rx_buf_size, DMA_FROM_DEVICE); | ||
232 | skb = netdev_alloc_skb_ip_align(ndev, len); | ||
233 | |||
230 | if (unlikely(!skb)) { | 234 | if (unlikely(!skb)) { |
231 | net_dbg_ratelimited("build_skb failed\n"); | 235 | net_dbg_ratelimited("netdev_alloc_skb_ip_align failed\n"); |
232 | priv->stats.rx_dropped++; | 236 | priv->stats.rx_dropped++; |
233 | priv->stats.rx_errors++; | 237 | priv->stats.rx_errors++; |
238 | goto rx_next; | ||
234 | } | 239 | } |
235 | 240 | ||
241 | memcpy(skb->data, priv->rx_buf[rx_head], len); | ||
236 | skb_put(skb, len); | 242 | skb_put(skb, len); |
237 | skb->protocol = eth_type_trans(skb, ndev); | 243 | skb->protocol = eth_type_trans(skb, ndev); |
238 | napi_gro_receive(&priv->napi, skb); | 244 | napi_gro_receive(&priv->napi, skb); |
@@ -244,18 +250,15 @@ static int moxart_rx_poll(struct napi_struct *napi, int budget) | |||
244 | if (desc0 & RX_DESC0_MULTICAST) | 250 | if (desc0 & RX_DESC0_MULTICAST) |
245 | priv->stats.multicast++; | 251 | priv->stats.multicast++; |
246 | 252 | ||
253 | rx_next: | ||
247 | writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); | 254 | writel(RX_DESC0_DMA_OWN, desc + RX_REG_OFFSET_DESC0); |
248 | 255 | ||
249 | rx_head = RX_NEXT(rx_head); | 256 | rx_head = RX_NEXT(rx_head); |
250 | priv->rx_head = rx_head; | 257 | priv->rx_head = rx_head; |
251 | |||
252 | if (rx >= budget) | ||
253 | break; | ||
254 | } | 258 | } |
255 | 259 | ||
256 | if (rx < budget) { | 260 | if (rx < budget) { |
257 | napi_gro_flush(napi, false); | 261 | napi_complete(napi); |
258 | __napi_complete(napi); | ||
259 | } | 262 | } |
260 | 263 | ||
261 | priv->reg_imr |= RPKT_FINISH_M; | 264 | priv->reg_imr |= RPKT_FINISH_M; |
@@ -346,10 +349,12 @@ static int moxart_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
346 | len = ETH_ZLEN; | 349 | len = ETH_ZLEN; |
347 | } | 350 | } |
348 | 351 | ||
349 | txdes1 = readl(desc + TX_REG_OFFSET_DESC1); | 352 | dma_sync_single_for_device(&ndev->dev, priv->tx_mapping[tx_head], |
350 | txdes1 |= TX_DESC1_LTS | TX_DESC1_FTS; | 353 | priv->tx_buf_size, DMA_TO_DEVICE); |
351 | txdes1 &= ~(TX_DESC1_FIFO_COMPLETE | TX_DESC1_INTR_COMPLETE); | 354 | |
352 | txdes1 |= (len & TX_DESC1_BUF_SIZE_MASK); | 355 | txdes1 = TX_DESC1_LTS | TX_DESC1_FTS | (len & TX_DESC1_BUF_SIZE_MASK); |
356 | if (tx_head == TX_DESC_NUM_MASK) | ||
357 | txdes1 |= TX_DESC1_END; | ||
353 | writel(txdes1, desc + TX_REG_OFFSET_DESC1); | 358 | writel(txdes1, desc + TX_REG_OFFSET_DESC1); |
354 | writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); | 359 | writel(TX_DESC0_DMA_OWN, desc + TX_REG_OFFSET_DESC0); |
355 | 360 | ||
@@ -465,8 +470,7 @@ static int moxart_mac_probe(struct platform_device *pdev) | |||
465 | spin_lock_init(&priv->txlock); | 470 | spin_lock_init(&priv->txlock); |
466 | 471 | ||
467 | priv->tx_buf_size = TX_BUF_SIZE; | 472 | priv->tx_buf_size = TX_BUF_SIZE; |
468 | priv->rx_buf_size = RX_BUF_SIZE + | 473 | priv->rx_buf_size = RX_BUF_SIZE; |
469 | SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | ||
470 | 474 | ||
471 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * | 475 | priv->tx_desc_base = dma_alloc_coherent(NULL, TX_REG_DESC_SIZE * |
472 | TX_DESC_NUM, &priv->tx_base, | 476 | TX_DESC_NUM, &priv->tx_base, |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 8706c0dbd0c3..a44a03c45014 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1220,6 +1220,9 @@ static int lpc_eth_open(struct net_device *ndev) | |||
1220 | 1220 | ||
1221 | __lpc_eth_clock_enable(pldat, true); | 1221 | __lpc_eth_clock_enable(pldat, true); |
1222 | 1222 | ||
1223 | /* Suspended PHY makes LPC ethernet core block, so resume now */ | ||
1224 | phy_resume(pldat->phy_dev); | ||
1225 | |||
1223 | /* Reset and initialize */ | 1226 | /* Reset and initialize */ |
1224 | __lpc_eth_reset(pldat); | 1227 | __lpc_eth_reset(pldat); |
1225 | __lpc_eth_init(pldat); | 1228 | __lpc_eth_init(pldat); |
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c index 979c6980639f..a42293092ea4 100644 --- a/drivers/net/ethernet/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c | |||
@@ -290,9 +290,11 @@ static void octeon_mgmt_clean_tx_buffers(struct octeon_mgmt *p) | |||
290 | /* Read the hardware TX timestamp if one was recorded */ | 290 | /* Read the hardware TX timestamp if one was recorded */ |
291 | if (unlikely(re.s.tstamp)) { | 291 | if (unlikely(re.s.tstamp)) { |
292 | struct skb_shared_hwtstamps ts; | 292 | struct skb_shared_hwtstamps ts; |
293 | u64 ns; | ||
294 | |||
293 | memset(&ts, 0, sizeof(ts)); | 295 | memset(&ts, 0, sizeof(ts)); |
294 | /* Read the timestamp */ | 296 | /* Read the timestamp */ |
295 | u64 ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port)); | 297 | ns = cvmx_read_csr(CVMX_MIXX_TSTAMP(p->port)); |
296 | /* Remove the timestamp from the FIFO */ | 298 | /* Remove the timestamp from the FIFO */ |
297 | cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0); | 299 | cvmx_write_csr(CVMX_MIXX_TSCTL(p->port), 0); |
298 | /* Tell the kernel about the timestamp */ | 300 | /* Tell the kernel about the timestamp */ |
diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig index 44c8be1c6805..5f7a35212796 100644 --- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig +++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig | |||
@@ -7,6 +7,7 @@ config PCH_GBE | |||
7 | depends on PCI && (X86_32 || COMPILE_TEST) | 7 | depends on PCI && (X86_32 || COMPILE_TEST) |
8 | select MII | 8 | select MII |
9 | select PTP_1588_CLOCK_PCH | 9 | select PTP_1588_CLOCK_PCH |
10 | select NET_PTP_CLASSIFY | ||
10 | ---help--- | 11 | ---help--- |
11 | This is a gigabit ethernet driver for EG20T PCH. | 12 | This is a gigabit ethernet driver for EG20T PCH. |
12 | EG20T PCH is the platform controller hub that is used in Intel's | 13 | EG20T PCH is the platform controller hub that is used in Intel's |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c index 32058614151a..5c4068353f66 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | |||
@@ -135,6 +135,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter) | |||
135 | int i, j; | 135 | int i, j; |
136 | struct nx_host_tx_ring *tx_ring = adapter->tx_ring; | 136 | struct nx_host_tx_ring *tx_ring = adapter->tx_ring; |
137 | 137 | ||
138 | spin_lock(&adapter->tx_clean_lock); | ||
138 | cmd_buf = tx_ring->cmd_buf_arr; | 139 | cmd_buf = tx_ring->cmd_buf_arr; |
139 | for (i = 0; i < tx_ring->num_desc; i++) { | 140 | for (i = 0; i < tx_ring->num_desc; i++) { |
140 | buffrag = cmd_buf->frag_array; | 141 | buffrag = cmd_buf->frag_array; |
@@ -158,6 +159,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter) | |||
158 | } | 159 | } |
159 | cmd_buf++; | 160 | cmd_buf++; |
160 | } | 161 | } |
162 | spin_unlock(&adapter->tx_clean_lock); | ||
161 | } | 163 | } |
162 | 164 | ||
163 | void netxen_free_sw_resources(struct netxen_adapter *adapter) | 165 | void netxen_free_sw_resources(struct netxen_adapter *adapter) |
@@ -1792,9 +1794,9 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter) | |||
1792 | break; | 1794 | break; |
1793 | } | 1795 | } |
1794 | 1796 | ||
1795 | if (count && netif_running(netdev)) { | 1797 | tx_ring->sw_consumer = sw_consumer; |
1796 | tx_ring->sw_consumer = sw_consumer; | ||
1797 | 1798 | ||
1799 | if (count && netif_running(netdev)) { | ||
1798 | smp_mb(); | 1800 | smp_mb(); |
1799 | 1801 | ||
1800 | if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) | 1802 | if (netif_queue_stopped(netdev) && netif_carrier_ok(netdev)) |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 1159031f885b..5ec5a2b0e989 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -1186,7 +1186,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
1186 | return; | 1186 | return; |
1187 | 1187 | ||
1188 | smp_mb(); | 1188 | smp_mb(); |
1189 | spin_lock(&adapter->tx_clean_lock); | ||
1190 | netif_carrier_off(netdev); | 1189 | netif_carrier_off(netdev); |
1191 | netif_tx_disable(netdev); | 1190 | netif_tx_disable(netdev); |
1192 | 1191 | ||
@@ -1204,7 +1203,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) | |||
1204 | netxen_napi_disable(adapter); | 1203 | netxen_napi_disable(adapter); |
1205 | 1204 | ||
1206 | netxen_release_tx_buffers(adapter); | 1205 | netxen_release_tx_buffers(adapter); |
1207 | spin_unlock(&adapter->tx_clean_lock); | ||
1208 | } | 1206 | } |
1209 | 1207 | ||
1210 | /* Usage: During suspend and firmware recovery module */ | 1208 | /* Usage: During suspend and firmware recovery module */ |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c index 86783e1afcf7..3172cdf591fe 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c | |||
@@ -1177,9 +1177,8 @@ static void qlcnic_83xx_setup_idc_parameters(struct qlcnic_adapter *adapter) | |||
1177 | { | 1177 | { |
1178 | u32 idc_params, val; | 1178 | u32 idc_params, val; |
1179 | 1179 | ||
1180 | if (qlcnic_83xx_lockless_flash_read32(adapter, | 1180 | if (qlcnic_83xx_flash_read32(adapter, QLC_83XX_IDC_FLASH_PARAM_ADDR, |
1181 | QLC_83XX_IDC_FLASH_PARAM_ADDR, | 1181 | (u8 *)&idc_params, 1)) { |
1182 | (u8 *)&idc_params, 1)) { | ||
1183 | dev_info(&adapter->pdev->dev, | 1182 | dev_info(&adapter->pdev->dev, |
1184 | "%s:failed to get IDC params from flash\n", __func__); | 1183 | "%s:failed to get IDC params from flash\n", __func__); |
1185 | adapter->dev_init_timeo = QLC_83XX_IDC_INIT_TIMEOUT_SECS; | 1184 | adapter->dev_init_timeo = QLC_83XX_IDC_INIT_TIMEOUT_SECS; |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c index 141f116eb868..494e8105adee 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c | |||
@@ -1333,21 +1333,21 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev, | |||
1333 | struct qlcnic_host_tx_ring *tx_ring; | 1333 | struct qlcnic_host_tx_ring *tx_ring; |
1334 | struct qlcnic_esw_statistics port_stats; | 1334 | struct qlcnic_esw_statistics port_stats; |
1335 | struct qlcnic_mac_statistics mac_stats; | 1335 | struct qlcnic_mac_statistics mac_stats; |
1336 | int index, ret, length, size, tx_size, ring; | 1336 | int index, ret, length, size, ring; |
1337 | char *p; | 1337 | char *p; |
1338 | 1338 | ||
1339 | tx_size = adapter->drv_tx_rings * QLCNIC_TX_STATS_LEN; | 1339 | memset(data, 0, stats->n_stats * sizeof(u64)); |
1340 | 1340 | ||
1341 | memset(data, 0, tx_size * sizeof(u64)); | ||
1342 | for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) { | 1341 | for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) { |
1343 | if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) { | 1342 | if (adapter->is_up == QLCNIC_ADAPTER_UP_MAGIC) { |
1344 | tx_ring = &adapter->tx_ring[ring]; | 1343 | tx_ring = &adapter->tx_ring[ring]; |
1345 | data = qlcnic_fill_tx_queue_stats(data, tx_ring); | 1344 | data = qlcnic_fill_tx_queue_stats(data, tx_ring); |
1346 | qlcnic_update_stats(adapter); | 1345 | qlcnic_update_stats(adapter); |
1346 | } else { | ||
1347 | data += QLCNIC_TX_STATS_LEN; | ||
1347 | } | 1348 | } |
1348 | } | 1349 | } |
1349 | 1350 | ||
1350 | memset(data, 0, stats->n_stats * sizeof(u64)); | ||
1351 | length = QLCNIC_STATS_LEN; | 1351 | length = QLCNIC_STATS_LEN; |
1352 | for (index = 0; index < length; index++) { | 1352 | for (index = 0; index < length; index++) { |
1353 | p = (char *)adapter + qlcnic_gstrings_stats[index].stat_offset; | 1353 | p = (char *)adapter + qlcnic_gstrings_stats[index].stat_offset; |
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c index 188626e2a861..3e96f269150d 100644 --- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c +++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c | |||
@@ -2556,6 +2556,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) | |||
2556 | 2556 | ||
2557 | if (skb_is_gso(skb)) { | 2557 | if (skb_is_gso(skb)) { |
2558 | int err; | 2558 | int err; |
2559 | __be16 l3_proto = vlan_get_protocol(skb); | ||
2559 | 2560 | ||
2560 | err = skb_cow_head(skb, 0); | 2561 | err = skb_cow_head(skb, 0); |
2561 | if (err < 0) | 2562 | if (err < 0) |
@@ -2572,7 +2573,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) | |||
2572 | << OB_MAC_TRANSPORT_HDR_SHIFT); | 2573 | << OB_MAC_TRANSPORT_HDR_SHIFT); |
2573 | mac_iocb_ptr->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | 2574 | mac_iocb_ptr->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
2574 | mac_iocb_ptr->flags2 |= OB_MAC_TSO_IOCB_LSO; | 2575 | mac_iocb_ptr->flags2 |= OB_MAC_TSO_IOCB_LSO; |
2575 | if (likely(skb->protocol == htons(ETH_P_IP))) { | 2576 | if (likely(l3_proto == htons(ETH_P_IP))) { |
2576 | struct iphdr *iph = ip_hdr(skb); | 2577 | struct iphdr *iph = ip_hdr(skb); |
2577 | iph->check = 0; | 2578 | iph->check = 0; |
2578 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP4; | 2579 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP4; |
@@ -2580,7 +2581,7 @@ static int ql_tso(struct sk_buff *skb, struct ob_mac_tso_iocb_req *mac_iocb_ptr) | |||
2580 | iph->daddr, 0, | 2581 | iph->daddr, 0, |
2581 | IPPROTO_TCP, | 2582 | IPPROTO_TCP, |
2582 | 0); | 2583 | 0); |
2583 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | 2584 | } else if (l3_proto == htons(ETH_P_IPV6)) { |
2584 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP6; | 2585 | mac_iocb_ptr->flags1 |= OB_MAC_TSO_IOCB_IP6; |
2585 | tcp_hdr(skb)->check = | 2586 | tcp_hdr(skb)->check = |
2586 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, | 2587 | ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 91652e7235e4..0921302553c6 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -1783,33 +1783,31 @@ static void __rtl8169_set_features(struct net_device *dev, | |||
1783 | netdev_features_t features) | 1783 | netdev_features_t features) |
1784 | { | 1784 | { |
1785 | struct rtl8169_private *tp = netdev_priv(dev); | 1785 | struct rtl8169_private *tp = netdev_priv(dev); |
1786 | netdev_features_t changed = features ^ dev->features; | ||
1787 | void __iomem *ioaddr = tp->mmio_addr; | 1786 | void __iomem *ioaddr = tp->mmio_addr; |
1787 | u32 rx_config; | ||
1788 | 1788 | ||
1789 | if (!(changed & (NETIF_F_RXALL | NETIF_F_RXCSUM | | 1789 | rx_config = RTL_R32(RxConfig); |
1790 | NETIF_F_HW_VLAN_CTAG_RX))) | 1790 | if (features & NETIF_F_RXALL) |
1791 | return; | 1791 | rx_config |= (AcceptErr | AcceptRunt); |
1792 | else | ||
1793 | rx_config &= ~(AcceptErr | AcceptRunt); | ||
1792 | 1794 | ||
1793 | if (changed & (NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX)) { | 1795 | RTL_W32(RxConfig, rx_config); |
1794 | if (features & NETIF_F_RXCSUM) | ||
1795 | tp->cp_cmd |= RxChkSum; | ||
1796 | else | ||
1797 | tp->cp_cmd &= ~RxChkSum; | ||
1798 | 1796 | ||
1799 | if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) | 1797 | if (features & NETIF_F_RXCSUM) |
1800 | tp->cp_cmd |= RxVlan; | 1798 | tp->cp_cmd |= RxChkSum; |
1801 | else | 1799 | else |
1802 | tp->cp_cmd &= ~RxVlan; | 1800 | tp->cp_cmd &= ~RxChkSum; |
1803 | 1801 | ||
1804 | RTL_W16(CPlusCmd, tp->cp_cmd); | 1802 | if (features & NETIF_F_HW_VLAN_CTAG_RX) |
1805 | RTL_R16(CPlusCmd); | 1803 | tp->cp_cmd |= RxVlan; |
1806 | } | 1804 | else |
1807 | if (changed & NETIF_F_RXALL) { | 1805 | tp->cp_cmd &= ~RxVlan; |
1808 | int tmp = (RTL_R32(RxConfig) & ~(AcceptErr | AcceptRunt)); | 1806 | |
1809 | if (features & NETIF_F_RXALL) | 1807 | tp->cp_cmd |= RTL_R16(CPlusCmd) & ~(RxVlan | RxChkSum); |
1810 | tmp |= (AcceptErr | AcceptRunt); | 1808 | |
1811 | RTL_W32(RxConfig, tmp); | 1809 | RTL_W16(CPlusCmd, tp->cp_cmd); |
1812 | } | 1810 | RTL_R16(CPlusCmd); |
1813 | } | 1811 | } |
1814 | 1812 | ||
1815 | static int rtl8169_set_features(struct net_device *dev, | 1813 | static int rtl8169_set_features(struct net_device *dev, |
@@ -1817,8 +1815,11 @@ static int rtl8169_set_features(struct net_device *dev, | |||
1817 | { | 1815 | { |
1818 | struct rtl8169_private *tp = netdev_priv(dev); | 1816 | struct rtl8169_private *tp = netdev_priv(dev); |
1819 | 1817 | ||
1818 | features &= NETIF_F_RXALL | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_CTAG_RX; | ||
1819 | |||
1820 | rtl_lock_work(tp); | 1820 | rtl_lock_work(tp); |
1821 | __rtl8169_set_features(dev, features); | 1821 | if (features ^ dev->features) |
1822 | __rtl8169_set_features(dev, features); | ||
1822 | rtl_unlock_work(tp); | 1823 | rtl_unlock_work(tp); |
1823 | 1824 | ||
1824 | return 0; | 1825 | return 0; |
@@ -7118,8 +7119,7 @@ static void rtl_hw_initialize(struct rtl8169_private *tp) | |||
7118 | } | 7119 | } |
7119 | } | 7120 | } |
7120 | 7121 | ||
7121 | static int | 7122 | static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
7122 | rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
7123 | { | 7123 | { |
7124 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; | 7124 | const struct rtl_cfg_info *cfg = rtl_cfg_infos + ent->driver_data; |
7125 | const unsigned int region = cfg->region; | 7125 | const unsigned int region = cfg->region; |
@@ -7194,7 +7194,7 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7194 | goto err_out_mwi_2; | 7194 | goto err_out_mwi_2; |
7195 | } | 7195 | } |
7196 | 7196 | ||
7197 | tp->cp_cmd = RxChkSum; | 7197 | tp->cp_cmd = 0; |
7198 | 7198 | ||
7199 | if ((sizeof(dma_addr_t) > 4) && | 7199 | if ((sizeof(dma_addr_t) > 4) && |
7200 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { | 7200 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { |
@@ -7235,13 +7235,6 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7235 | 7235 | ||
7236 | pci_set_master(pdev); | 7236 | pci_set_master(pdev); |
7237 | 7237 | ||
7238 | /* | ||
7239 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
7240 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
7241 | */ | ||
7242 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | ||
7243 | tp->cp_cmd |= RxVlan; | ||
7244 | |||
7245 | rtl_init_mdio_ops(tp); | 7238 | rtl_init_mdio_ops(tp); |
7246 | rtl_init_pll_power_ops(tp); | 7239 | rtl_init_pll_power_ops(tp); |
7247 | rtl_init_jumbo_ops(tp); | 7240 | rtl_init_jumbo_ops(tp); |
@@ -7302,8 +7295,14 @@ rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
7302 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | | 7295 | dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO | |
7303 | NETIF_F_HIGHDMA; | 7296 | NETIF_F_HIGHDMA; |
7304 | 7297 | ||
7298 | tp->cp_cmd |= RxChkSum | RxVlan; | ||
7299 | |||
7300 | /* | ||
7301 | * Pretend we are using VLANs; This bypasses a nasty bug where | ||
7302 | * Interrupts stop flowing on high load on 8110SCd controllers. | ||
7303 | */ | ||
7305 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) | 7304 | if (tp->mac_version == RTL_GIGA_MAC_VER_05) |
7306 | /* 8110SCd requires hardware Rx VLAN - disallow toggling */ | 7305 | /* Disallow toggling */ |
7307 | dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; | 7306 | dev->hw_features &= ~NETIF_F_HW_VLAN_CTAG_RX; |
7308 | 7307 | ||
7309 | if (tp->txd_version == RTL_TD_0) | 7308 | if (tp->txd_version == RTL_TD_0) |
diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig index 9e757c792d84..196e98a2d93b 100644 --- a/drivers/net/ethernet/renesas/Kconfig +++ b/drivers/net/ethernet/renesas/Kconfig | |||
@@ -5,6 +5,7 @@ | |||
5 | config SH_ETH | 5 | config SH_ETH |
6 | tristate "Renesas SuperH Ethernet support" | 6 | tristate "Renesas SuperH Ethernet support" |
7 | depends on HAS_DMA | 7 | depends on HAS_DMA |
8 | depends on ARCH_SHMOBILE || SUPERH || COMPILE_TEST | ||
8 | select CRC32 | 9 | select CRC32 |
9 | select MII | 10 | select MII |
10 | select MDIO_BITBANG | 11 | select MDIO_BITBANG |
diff --git a/drivers/net/ethernet/sfc/farch.c b/drivers/net/ethernet/sfc/farch.c index 0537381cd2f6..6859437b59fb 100644 --- a/drivers/net/ethernet/sfc/farch.c +++ b/drivers/net/ethernet/sfc/farch.c | |||
@@ -2933,6 +2933,9 @@ void efx_farch_filter_sync_rx_mode(struct efx_nic *efx) | |||
2933 | u32 crc; | 2933 | u32 crc; |
2934 | int bit; | 2934 | int bit; |
2935 | 2935 | ||
2936 | if (!efx_dev_registered(efx)) | ||
2937 | return; | ||
2938 | |||
2936 | netif_addr_lock_bh(net_dev); | 2939 | netif_addr_lock_bh(net_dev); |
2937 | 2940 | ||
2938 | efx->unicast_filter = !(net_dev->flags & IFF_PROMISC); | 2941 | efx->unicast_filter = !(net_dev->flags & IFF_PROMISC); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c index c553f6b5a913..cf28daba4346 100644 --- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include "stmmac.h" | 29 | #include "stmmac.h" |
30 | 30 | ||
31 | static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | 31 | static int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) |
32 | { | 32 | { |
33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; | 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; |
34 | unsigned int txsize = priv->dma_tx_size; | 34 | unsigned int txsize = priv->dma_tx_size; |
@@ -47,7 +47,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
47 | 47 | ||
48 | desc->des2 = dma_map_single(priv->device, skb->data, | 48 | desc->des2 = dma_map_single(priv->device, skb->data, |
49 | bmax, DMA_TO_DEVICE); | 49 | bmax, DMA_TO_DEVICE); |
50 | priv->tx_skbuff_dma[entry] = desc->des2; | 50 | if (dma_mapping_error(priv->device, desc->des2)) |
51 | return -1; | ||
52 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
51 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, STMMAC_CHAIN_MODE); | 53 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, STMMAC_CHAIN_MODE); |
52 | 54 | ||
53 | while (len != 0) { | 55 | while (len != 0) { |
@@ -59,7 +61,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
59 | desc->des2 = dma_map_single(priv->device, | 61 | desc->des2 = dma_map_single(priv->device, |
60 | (skb->data + bmax * i), | 62 | (skb->data + bmax * i), |
61 | bmax, DMA_TO_DEVICE); | 63 | bmax, DMA_TO_DEVICE); |
62 | priv->tx_skbuff_dma[entry] = desc->des2; | 64 | if (dma_mapping_error(priv->device, desc->des2)) |
65 | return -1; | ||
66 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
63 | priv->hw->desc->prepare_tx_desc(desc, 0, bmax, csum, | 67 | priv->hw->desc->prepare_tx_desc(desc, 0, bmax, csum, |
64 | STMMAC_CHAIN_MODE); | 68 | STMMAC_CHAIN_MODE); |
65 | priv->hw->desc->set_tx_owner(desc); | 69 | priv->hw->desc->set_tx_owner(desc); |
@@ -69,7 +73,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
69 | desc->des2 = dma_map_single(priv->device, | 73 | desc->des2 = dma_map_single(priv->device, |
70 | (skb->data + bmax * i), len, | 74 | (skb->data + bmax * i), len, |
71 | DMA_TO_DEVICE); | 75 | DMA_TO_DEVICE); |
72 | priv->tx_skbuff_dma[entry] = desc->des2; | 76 | if (dma_mapping_error(priv->device, desc->des2)) |
77 | return -1; | ||
78 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
73 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, | 79 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, |
74 | STMMAC_CHAIN_MODE); | 80 | STMMAC_CHAIN_MODE); |
75 | priv->hw->desc->set_tx_owner(desc); | 81 | priv->hw->desc->set_tx_owner(desc); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index de507c32036c..593e6c4144a7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h | |||
@@ -220,10 +220,10 @@ enum dma_irq_status { | |||
220 | handle_tx = 0x8, | 220 | handle_tx = 0x8, |
221 | }; | 221 | }; |
222 | 222 | ||
223 | #define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 1) | 223 | #define CORE_IRQ_TX_PATH_IN_LPI_MODE (1 << 0) |
224 | #define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 2) | 224 | #define CORE_IRQ_TX_PATH_EXIT_LPI_MODE (1 << 1) |
225 | #define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 3) | 225 | #define CORE_IRQ_RX_PATH_IN_LPI_MODE (1 << 2) |
226 | #define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 4) | 226 | #define CORE_IRQ_RX_PATH_EXIT_LPI_MODE (1 << 3) |
227 | 227 | ||
228 | #define CORE_PCS_ANE_COMPLETE (1 << 5) | 228 | #define CORE_PCS_ANE_COMPLETE (1 << 5) |
229 | #define CORE_PCS_LINK_STATUS (1 << 6) | 229 | #define CORE_PCS_LINK_STATUS (1 << 6) |
@@ -287,7 +287,7 @@ struct dma_features { | |||
287 | 287 | ||
288 | /* Default LPI timers */ | 288 | /* Default LPI timers */ |
289 | #define STMMAC_DEFAULT_LIT_LS 0x3E8 | 289 | #define STMMAC_DEFAULT_LIT_LS 0x3E8 |
290 | #define STMMAC_DEFAULT_TWT_LS 0x0 | 290 | #define STMMAC_DEFAULT_TWT_LS 0x1E |
291 | 291 | ||
292 | #define STMMAC_CHAIN_MODE 0x1 | 292 | #define STMMAC_CHAIN_MODE 0x1 |
293 | #define STMMAC_RING_MODE 0x2 | 293 | #define STMMAC_RING_MODE 0x2 |
@@ -425,7 +425,7 @@ struct stmmac_mode_ops { | |||
425 | void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, | 425 | void (*init) (void *des, dma_addr_t phy_addr, unsigned int size, |
426 | unsigned int extend_desc); | 426 | unsigned int extend_desc); |
427 | unsigned int (*is_jumbo_frm) (int len, int ehn_desc); | 427 | unsigned int (*is_jumbo_frm) (int len, int ehn_desc); |
428 | unsigned int (*jumbo_frm) (void *priv, struct sk_buff *skb, int csum); | 428 | int (*jumbo_frm)(void *priv, struct sk_buff *skb, int csum); |
429 | int (*set_16kib_bfsize)(int mtu); | 429 | int (*set_16kib_bfsize)(int mtu); |
430 | void (*init_desc3)(struct dma_desc *p); | 430 | void (*init_desc3)(struct dma_desc *p); |
431 | void (*refill_desc3) (void *priv, struct dma_desc *p); | 431 | void (*refill_desc3) (void *priv, struct dma_desc *p); |
@@ -445,6 +445,7 @@ struct mac_device_info { | |||
445 | int multicast_filter_bins; | 445 | int multicast_filter_bins; |
446 | int unicast_filter_entries; | 446 | int unicast_filter_entries; |
447 | int mcast_bits_log2; | 447 | int mcast_bits_log2; |
448 | unsigned int rx_csum; | ||
448 | }; | 449 | }; |
449 | 450 | ||
450 | struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins, | 451 | struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins, |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h index 71b5419256c1..64d8f56a9c17 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | |||
@@ -153,7 +153,7 @@ enum inter_frame_gap { | |||
153 | #define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */ | 153 | #define GMAC_CONTROL_RE 0x00000004 /* Receiver Enable */ |
154 | 154 | ||
155 | #define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \ | 155 | #define GMAC_CORE_INIT (GMAC_CONTROL_JD | GMAC_CONTROL_PS | GMAC_CONTROL_ACS | \ |
156 | GMAC_CONTROL_BE) | 156 | GMAC_CONTROL_BE | GMAC_CONTROL_DCRS) |
157 | 157 | ||
158 | /* GMAC Frame Filter defines */ | 158 | /* GMAC Frame Filter defines */ |
159 | #define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */ | 159 | #define GMAC_FRAME_FILTER_PR 0x00000001 /* Promiscuous Mode */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c index d8ef18786a1c..5efe60ea6526 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | |||
@@ -58,7 +58,11 @@ static int dwmac1000_rx_ipc_enable(struct mac_device_info *hw) | |||
58 | void __iomem *ioaddr = hw->pcsr; | 58 | void __iomem *ioaddr = hw->pcsr; |
59 | u32 value = readl(ioaddr + GMAC_CONTROL); | 59 | u32 value = readl(ioaddr + GMAC_CONTROL); |
60 | 60 | ||
61 | value |= GMAC_CONTROL_IPC; | 61 | if (hw->rx_csum) |
62 | value |= GMAC_CONTROL_IPC; | ||
63 | else | ||
64 | value &= ~GMAC_CONTROL_IPC; | ||
65 | |||
62 | writel(value, ioaddr + GMAC_CONTROL); | 66 | writel(value, ioaddr + GMAC_CONTROL); |
63 | 67 | ||
64 | value = readl(ioaddr + GMAC_CONTROL); | 68 | value = readl(ioaddr + GMAC_CONTROL); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc.h b/drivers/net/ethernet/stmicro/stmmac/mmc.h index 8607488cbcfc..192c2491330b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/mmc.h +++ b/drivers/net/ethernet/stmicro/stmmac/mmc.h | |||
@@ -68,7 +68,7 @@ struct stmmac_counters { | |||
68 | unsigned int mmc_rx_octetcount_g; | 68 | unsigned int mmc_rx_octetcount_g; |
69 | unsigned int mmc_rx_broadcastframe_g; | 69 | unsigned int mmc_rx_broadcastframe_g; |
70 | unsigned int mmc_rx_multicastframe_g; | 70 | unsigned int mmc_rx_multicastframe_g; |
71 | unsigned int mmc_rx_crc_errror; | 71 | unsigned int mmc_rx_crc_error; |
72 | unsigned int mmc_rx_align_error; | 72 | unsigned int mmc_rx_align_error; |
73 | unsigned int mmc_rx_run_error; | 73 | unsigned int mmc_rx_run_error; |
74 | unsigned int mmc_rx_jabber_error; | 74 | unsigned int mmc_rx_jabber_error; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c index 50617c5a0bdb..08c483bd2ec7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c | |||
@@ -196,7 +196,7 @@ void dwmac_mmc_read(void __iomem *ioaddr, struct stmmac_counters *mmc) | |||
196 | mmc->mmc_rx_octetcount_g += readl(ioaddr + MMC_RX_OCTETCOUNT_G); | 196 | mmc->mmc_rx_octetcount_g += readl(ioaddr + MMC_RX_OCTETCOUNT_G); |
197 | mmc->mmc_rx_broadcastframe_g += readl(ioaddr + MMC_RX_BROADCASTFRAME_G); | 197 | mmc->mmc_rx_broadcastframe_g += readl(ioaddr + MMC_RX_BROADCASTFRAME_G); |
198 | mmc->mmc_rx_multicastframe_g += readl(ioaddr + MMC_RX_MULTICASTFRAME_G); | 198 | mmc->mmc_rx_multicastframe_g += readl(ioaddr + MMC_RX_MULTICASTFRAME_G); |
199 | mmc->mmc_rx_crc_errror += readl(ioaddr + MMC_RX_CRC_ERRROR); | 199 | mmc->mmc_rx_crc_error += readl(ioaddr + MMC_RX_CRC_ERRROR); |
200 | mmc->mmc_rx_align_error += readl(ioaddr + MMC_RX_ALIGN_ERROR); | 200 | mmc->mmc_rx_align_error += readl(ioaddr + MMC_RX_ALIGN_ERROR); |
201 | mmc->mmc_rx_run_error += readl(ioaddr + MMC_RX_RUN_ERROR); | 201 | mmc->mmc_rx_run_error += readl(ioaddr + MMC_RX_RUN_ERROR); |
202 | mmc->mmc_rx_jabber_error += readl(ioaddr + MMC_RX_JABBER_ERROR); | 202 | mmc->mmc_rx_jabber_error += readl(ioaddr + MMC_RX_JABBER_ERROR); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index 650a4be6bce5..5dd50c6cda5b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #include "stmmac.h" | 29 | #include "stmmac.h" |
30 | 30 | ||
31 | static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | 31 | static int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) |
32 | { | 32 | { |
33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; | 33 | struct stmmac_priv *priv = (struct stmmac_priv *)p; |
34 | unsigned int txsize = priv->dma_tx_size; | 34 | unsigned int txsize = priv->dma_tx_size; |
@@ -53,7 +53,10 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
53 | 53 | ||
54 | desc->des2 = dma_map_single(priv->device, skb->data, | 54 | desc->des2 = dma_map_single(priv->device, skb->data, |
55 | bmax, DMA_TO_DEVICE); | 55 | bmax, DMA_TO_DEVICE); |
56 | priv->tx_skbuff_dma[entry] = desc->des2; | 56 | if (dma_mapping_error(priv->device, desc->des2)) |
57 | return -1; | ||
58 | |||
59 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
57 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 60 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
58 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, | 61 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, csum, |
59 | STMMAC_RING_MODE); | 62 | STMMAC_RING_MODE); |
@@ -68,7 +71,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
68 | 71 | ||
69 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, | 72 | desc->des2 = dma_map_single(priv->device, skb->data + bmax, |
70 | len, DMA_TO_DEVICE); | 73 | len, DMA_TO_DEVICE); |
71 | priv->tx_skbuff_dma[entry] = desc->des2; | 74 | if (dma_mapping_error(priv->device, desc->des2)) |
75 | return -1; | ||
76 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
72 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 77 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
73 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, | 78 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum, |
74 | STMMAC_RING_MODE); | 79 | STMMAC_RING_MODE); |
@@ -77,7 +82,9 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
77 | } else { | 82 | } else { |
78 | desc->des2 = dma_map_single(priv->device, skb->data, | 83 | desc->des2 = dma_map_single(priv->device, skb->data, |
79 | nopaged_len, DMA_TO_DEVICE); | 84 | nopaged_len, DMA_TO_DEVICE); |
80 | priv->tx_skbuff_dma[entry] = desc->des2; | 85 | if (dma_mapping_error(priv->device, desc->des2)) |
86 | return -1; | ||
87 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
81 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 88 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
82 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, csum, | 89 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, csum, |
83 | STMMAC_RING_MODE); | 90 | STMMAC_RING_MODE); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index ca01035634a7..58097c0e2ad5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
@@ -34,6 +34,11 @@ | |||
34 | #include <linux/ptp_clock_kernel.h> | 34 | #include <linux/ptp_clock_kernel.h> |
35 | #include <linux/reset.h> | 35 | #include <linux/reset.h> |
36 | 36 | ||
37 | struct stmmac_tx_info { | ||
38 | dma_addr_t buf; | ||
39 | bool map_as_page; | ||
40 | }; | ||
41 | |||
37 | struct stmmac_priv { | 42 | struct stmmac_priv { |
38 | /* Frequently used values are kept adjacent for cache effect */ | 43 | /* Frequently used values are kept adjacent for cache effect */ |
39 | struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; | 44 | struct dma_extended_desc *dma_etx ____cacheline_aligned_in_smp; |
@@ -45,7 +50,7 @@ struct stmmac_priv { | |||
45 | u32 tx_count_frames; | 50 | u32 tx_count_frames; |
46 | u32 tx_coal_frames; | 51 | u32 tx_coal_frames; |
47 | u32 tx_coal_timer; | 52 | u32 tx_coal_timer; |
48 | dma_addr_t *tx_skbuff_dma; | 53 | struct stmmac_tx_info *tx_skbuff_dma; |
49 | dma_addr_t dma_tx_phy; | 54 | dma_addr_t dma_tx_phy; |
50 | int tx_coalesce; | 55 | int tx_coalesce; |
51 | int hwts_tx_en; | 56 | int hwts_tx_en; |
@@ -105,6 +110,8 @@ struct stmmac_priv { | |||
105 | struct ptp_clock *ptp_clock; | 110 | struct ptp_clock *ptp_clock; |
106 | struct ptp_clock_info ptp_clock_ops; | 111 | struct ptp_clock_info ptp_clock_ops; |
107 | unsigned int default_addend; | 112 | unsigned int default_addend; |
113 | struct clk *clk_ptp_ref; | ||
114 | unsigned int clk_ptp_rate; | ||
108 | u32 adv_ts; | 115 | u32 adv_ts; |
109 | int use_riwt; | 116 | int use_riwt; |
110 | int irq_wake; | 117 | int irq_wake; |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 9af50bae4dde..cf4f38db1c0a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | |||
@@ -175,7 +175,7 @@ static const struct stmmac_stats stmmac_mmc[] = { | |||
175 | STMMAC_MMC_STAT(mmc_rx_octetcount_g), | 175 | STMMAC_MMC_STAT(mmc_rx_octetcount_g), |
176 | STMMAC_MMC_STAT(mmc_rx_broadcastframe_g), | 176 | STMMAC_MMC_STAT(mmc_rx_broadcastframe_g), |
177 | STMMAC_MMC_STAT(mmc_rx_multicastframe_g), | 177 | STMMAC_MMC_STAT(mmc_rx_multicastframe_g), |
178 | STMMAC_MMC_STAT(mmc_rx_crc_errror), | 178 | STMMAC_MMC_STAT(mmc_rx_crc_error), |
179 | STMMAC_MMC_STAT(mmc_rx_align_error), | 179 | STMMAC_MMC_STAT(mmc_rx_align_error), |
180 | STMMAC_MMC_STAT(mmc_rx_run_error), | 180 | STMMAC_MMC_STAT(mmc_rx_run_error), |
181 | STMMAC_MMC_STAT(mmc_rx_jabber_error), | 181 | STMMAC_MMC_STAT(mmc_rx_jabber_error), |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 08addd653728..b0c1521e08a3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -275,6 +275,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) | |||
275 | */ | 275 | */ |
276 | bool stmmac_eee_init(struct stmmac_priv *priv) | 276 | bool stmmac_eee_init(struct stmmac_priv *priv) |
277 | { | 277 | { |
278 | char *phy_bus_name = priv->plat->phy_bus_name; | ||
278 | bool ret = false; | 279 | bool ret = false; |
279 | 280 | ||
280 | /* Using PCS we cannot dial with the phy registers at this stage | 281 | /* Using PCS we cannot dial with the phy registers at this stage |
@@ -284,6 +285,10 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
284 | (priv->pcs == STMMAC_PCS_RTBI)) | 285 | (priv->pcs == STMMAC_PCS_RTBI)) |
285 | goto out; | 286 | goto out; |
286 | 287 | ||
288 | /* Never init EEE in case of a switch is attached */ | ||
289 | if (phy_bus_name && (!strcmp(phy_bus_name, "fixed"))) | ||
290 | goto out; | ||
291 | |||
287 | /* MAC core supports the EEE feature. */ | 292 | /* MAC core supports the EEE feature. */ |
288 | if (priv->dma_cap.eee) { | 293 | if (priv->dma_cap.eee) { |
289 | int tx_lpi_timer = priv->tx_lpi_timer; | 294 | int tx_lpi_timer = priv->tx_lpi_timer; |
@@ -316,10 +321,9 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
316 | priv->hw->mac->set_eee_timer(priv->hw, | 321 | priv->hw->mac->set_eee_timer(priv->hw, |
317 | STMMAC_DEFAULT_LIT_LS, | 322 | STMMAC_DEFAULT_LIT_LS, |
318 | tx_lpi_timer); | 323 | tx_lpi_timer); |
319 | } else | 324 | } |
320 | /* Set HW EEE according to the speed */ | 325 | /* Set HW EEE according to the speed */ |
321 | priv->hw->mac->set_eee_pls(priv->hw, | 326 | priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); |
322 | priv->phydev->link); | ||
323 | 327 | ||
324 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); | 328 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); |
325 | 329 | ||
@@ -603,16 +607,16 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) | |||
603 | /* calculate default added value: | 607 | /* calculate default added value: |
604 | * formula is : | 608 | * formula is : |
605 | * addend = (2^32)/freq_div_ratio; | 609 | * addend = (2^32)/freq_div_ratio; |
606 | * where, freq_div_ratio = STMMAC_SYSCLOCK/50MHz | 610 | * where, freq_div_ratio = clk_ptp_ref_i/50MHz |
607 | * hence, addend = ((2^32) * 50MHz)/STMMAC_SYSCLOCK; | 611 | * hence, addend = ((2^32) * 50MHz)/clk_ptp_ref_i; |
608 | * NOTE: STMMAC_SYSCLOCK should be >= 50MHz to | 612 | * NOTE: clk_ptp_ref_i should be >= 50MHz to |
609 | * achive 20ns accuracy. | 613 | * achive 20ns accuracy. |
610 | * | 614 | * |
611 | * 2^x * y == (y << x), hence | 615 | * 2^x * y == (y << x), hence |
612 | * 2^32 * 50000000 ==> (50000000 << 32) | 616 | * 2^32 * 50000000 ==> (50000000 << 32) |
613 | */ | 617 | */ |
614 | temp = (u64) (50000000ULL << 32); | 618 | temp = (u64) (50000000ULL << 32); |
615 | priv->default_addend = div_u64(temp, STMMAC_SYSCLOCK); | 619 | priv->default_addend = div_u64(temp, priv->clk_ptp_rate); |
616 | priv->hw->ptp->config_addend(priv->ioaddr, | 620 | priv->hw->ptp->config_addend(priv->ioaddr, |
617 | priv->default_addend); | 621 | priv->default_addend); |
618 | 622 | ||
@@ -638,6 +642,16 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) | |||
638 | if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) | 642 | if (!(priv->dma_cap.time_stamp || priv->dma_cap.atime_stamp)) |
639 | return -EOPNOTSUPP; | 643 | return -EOPNOTSUPP; |
640 | 644 | ||
645 | /* Fall-back to main clock in case of no PTP ref is passed */ | ||
646 | priv->clk_ptp_ref = devm_clk_get(priv->device, "clk_ptp_ref"); | ||
647 | if (IS_ERR(priv->clk_ptp_ref)) { | ||
648 | priv->clk_ptp_rate = clk_get_rate(priv->stmmac_clk); | ||
649 | priv->clk_ptp_ref = NULL; | ||
650 | } else { | ||
651 | clk_prepare_enable(priv->clk_ptp_ref); | ||
652 | priv->clk_ptp_rate = clk_get_rate(priv->clk_ptp_ref); | ||
653 | } | ||
654 | |||
641 | priv->adv_ts = 0; | 655 | priv->adv_ts = 0; |
642 | if (priv->dma_cap.atime_stamp && priv->extend_desc) | 656 | if (priv->dma_cap.atime_stamp && priv->extend_desc) |
643 | priv->adv_ts = 1; | 657 | priv->adv_ts = 1; |
@@ -657,6 +671,8 @@ static int stmmac_init_ptp(struct stmmac_priv *priv) | |||
657 | 671 | ||
658 | static void stmmac_release_ptp(struct stmmac_priv *priv) | 672 | static void stmmac_release_ptp(struct stmmac_priv *priv) |
659 | { | 673 | { |
674 | if (priv->clk_ptp_ref) | ||
675 | clk_disable_unprepare(priv->clk_ptp_ref); | ||
660 | stmmac_ptp_unregister(priv); | 676 | stmmac_ptp_unregister(priv); |
661 | } | 677 | } |
662 | 678 | ||
@@ -1061,7 +1077,8 @@ static int init_dma_desc_rings(struct net_device *dev) | |||
1061 | else | 1077 | else |
1062 | p = priv->dma_tx + i; | 1078 | p = priv->dma_tx + i; |
1063 | p->des2 = 0; | 1079 | p->des2 = 0; |
1064 | priv->tx_skbuff_dma[i] = 0; | 1080 | priv->tx_skbuff_dma[i].buf = 0; |
1081 | priv->tx_skbuff_dma[i].map_as_page = false; | ||
1065 | priv->tx_skbuff[i] = NULL; | 1082 | priv->tx_skbuff[i] = NULL; |
1066 | } | 1083 | } |
1067 | 1084 | ||
@@ -1100,17 +1117,24 @@ static void dma_free_tx_skbufs(struct stmmac_priv *priv) | |||
1100 | else | 1117 | else |
1101 | p = priv->dma_tx + i; | 1118 | p = priv->dma_tx + i; |
1102 | 1119 | ||
1103 | if (priv->tx_skbuff_dma[i]) { | 1120 | if (priv->tx_skbuff_dma[i].buf) { |
1104 | dma_unmap_single(priv->device, | 1121 | if (priv->tx_skbuff_dma[i].map_as_page) |
1105 | priv->tx_skbuff_dma[i], | 1122 | dma_unmap_page(priv->device, |
1106 | priv->hw->desc->get_tx_len(p), | 1123 | priv->tx_skbuff_dma[i].buf, |
1107 | DMA_TO_DEVICE); | 1124 | priv->hw->desc->get_tx_len(p), |
1108 | priv->tx_skbuff_dma[i] = 0; | 1125 | DMA_TO_DEVICE); |
1126 | else | ||
1127 | dma_unmap_single(priv->device, | ||
1128 | priv->tx_skbuff_dma[i].buf, | ||
1129 | priv->hw->desc->get_tx_len(p), | ||
1130 | DMA_TO_DEVICE); | ||
1109 | } | 1131 | } |
1110 | 1132 | ||
1111 | if (priv->tx_skbuff[i] != NULL) { | 1133 | if (priv->tx_skbuff[i] != NULL) { |
1112 | dev_kfree_skb_any(priv->tx_skbuff[i]); | 1134 | dev_kfree_skb_any(priv->tx_skbuff[i]); |
1113 | priv->tx_skbuff[i] = NULL; | 1135 | priv->tx_skbuff[i] = NULL; |
1136 | priv->tx_skbuff_dma[i].buf = 0; | ||
1137 | priv->tx_skbuff_dma[i].map_as_page = false; | ||
1114 | } | 1138 | } |
1115 | } | 1139 | } |
1116 | } | 1140 | } |
@@ -1131,7 +1155,8 @@ static int alloc_dma_desc_resources(struct stmmac_priv *priv) | |||
1131 | if (!priv->rx_skbuff) | 1155 | if (!priv->rx_skbuff) |
1132 | goto err_rx_skbuff; | 1156 | goto err_rx_skbuff; |
1133 | 1157 | ||
1134 | priv->tx_skbuff_dma = kmalloc_array(txsize, sizeof(dma_addr_t), | 1158 | priv->tx_skbuff_dma = kmalloc_array(txsize, |
1159 | sizeof(*priv->tx_skbuff_dma), | ||
1135 | GFP_KERNEL); | 1160 | GFP_KERNEL); |
1136 | if (!priv->tx_skbuff_dma) | 1161 | if (!priv->tx_skbuff_dma) |
1137 | goto err_tx_skbuff_dma; | 1162 | goto err_tx_skbuff_dma; |
@@ -1293,12 +1318,19 @@ static void stmmac_tx_clean(struct stmmac_priv *priv) | |||
1293 | pr_debug("%s: curr %d, dirty %d\n", __func__, | 1318 | pr_debug("%s: curr %d, dirty %d\n", __func__, |
1294 | priv->cur_tx, priv->dirty_tx); | 1319 | priv->cur_tx, priv->dirty_tx); |
1295 | 1320 | ||
1296 | if (likely(priv->tx_skbuff_dma[entry])) { | 1321 | if (likely(priv->tx_skbuff_dma[entry].buf)) { |
1297 | dma_unmap_single(priv->device, | 1322 | if (priv->tx_skbuff_dma[entry].map_as_page) |
1298 | priv->tx_skbuff_dma[entry], | 1323 | dma_unmap_page(priv->device, |
1299 | priv->hw->desc->get_tx_len(p), | 1324 | priv->tx_skbuff_dma[entry].buf, |
1300 | DMA_TO_DEVICE); | 1325 | priv->hw->desc->get_tx_len(p), |
1301 | priv->tx_skbuff_dma[entry] = 0; | 1326 | DMA_TO_DEVICE); |
1327 | else | ||
1328 | dma_unmap_single(priv->device, | ||
1329 | priv->tx_skbuff_dma[entry].buf, | ||
1330 | priv->hw->desc->get_tx_len(p), | ||
1331 | DMA_TO_DEVICE); | ||
1332 | priv->tx_skbuff_dma[entry].buf = 0; | ||
1333 | priv->tx_skbuff_dma[entry].map_as_page = false; | ||
1302 | } | 1334 | } |
1303 | priv->hw->mode->clean_desc3(priv, p); | 1335 | priv->hw->mode->clean_desc3(priv, p); |
1304 | 1336 | ||
@@ -1637,6 +1669,13 @@ static int stmmac_hw_setup(struct net_device *dev) | |||
1637 | /* Initialize the MAC Core */ | 1669 | /* Initialize the MAC Core */ |
1638 | priv->hw->mac->core_init(priv->hw, dev->mtu); | 1670 | priv->hw->mac->core_init(priv->hw, dev->mtu); |
1639 | 1671 | ||
1672 | ret = priv->hw->mac->rx_ipc(priv->hw); | ||
1673 | if (!ret) { | ||
1674 | pr_warn(" RX IPC Checksum Offload disabled\n"); | ||
1675 | priv->plat->rx_coe = STMMAC_RX_COE_NONE; | ||
1676 | priv->hw->rx_csum = 0; | ||
1677 | } | ||
1678 | |||
1640 | /* Enable the MAC Rx/Tx */ | 1679 | /* Enable the MAC Rx/Tx */ |
1641 | stmmac_set_mac(priv->ioaddr, true); | 1680 | stmmac_set_mac(priv->ioaddr, true); |
1642 | 1681 | ||
@@ -1887,12 +1926,16 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1887 | if (likely(!is_jumbo)) { | 1926 | if (likely(!is_jumbo)) { |
1888 | desc->des2 = dma_map_single(priv->device, skb->data, | 1927 | desc->des2 = dma_map_single(priv->device, skb->data, |
1889 | nopaged_len, DMA_TO_DEVICE); | 1928 | nopaged_len, DMA_TO_DEVICE); |
1890 | priv->tx_skbuff_dma[entry] = desc->des2; | 1929 | if (dma_mapping_error(priv->device, desc->des2)) |
1930 | goto dma_map_err; | ||
1931 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
1891 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, | 1932 | priv->hw->desc->prepare_tx_desc(desc, 1, nopaged_len, |
1892 | csum_insertion, priv->mode); | 1933 | csum_insertion, priv->mode); |
1893 | } else { | 1934 | } else { |
1894 | desc = first; | 1935 | desc = first; |
1895 | entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion); | 1936 | entry = priv->hw->mode->jumbo_frm(priv, skb, csum_insertion); |
1937 | if (unlikely(entry < 0)) | ||
1938 | goto dma_map_err; | ||
1896 | } | 1939 | } |
1897 | 1940 | ||
1898 | for (i = 0; i < nfrags; i++) { | 1941 | for (i = 0; i < nfrags; i++) { |
@@ -1908,7 +1951,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1908 | 1951 | ||
1909 | desc->des2 = skb_frag_dma_map(priv->device, frag, 0, len, | 1952 | desc->des2 = skb_frag_dma_map(priv->device, frag, 0, len, |
1910 | DMA_TO_DEVICE); | 1953 | DMA_TO_DEVICE); |
1911 | priv->tx_skbuff_dma[entry] = desc->des2; | 1954 | if (dma_mapping_error(priv->device, desc->des2)) |
1955 | goto dma_map_err; /* should reuse desc w/o issues */ | ||
1956 | |||
1957 | priv->tx_skbuff_dma[entry].buf = desc->des2; | ||
1958 | priv->tx_skbuff_dma[entry].map_as_page = true; | ||
1912 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion, | 1959 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion, |
1913 | priv->mode); | 1960 | priv->mode); |
1914 | wmb(); | 1961 | wmb(); |
@@ -1975,7 +2022,12 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1975 | priv->hw->dma->enable_dma_transmission(priv->ioaddr); | 2022 | priv->hw->dma->enable_dma_transmission(priv->ioaddr); |
1976 | 2023 | ||
1977 | spin_unlock(&priv->tx_lock); | 2024 | spin_unlock(&priv->tx_lock); |
2025 | return NETDEV_TX_OK; | ||
1978 | 2026 | ||
2027 | dma_map_err: | ||
2028 | dev_err(priv->device, "Tx dma map failed\n"); | ||
2029 | dev_kfree_skb(skb); | ||
2030 | priv->dev->stats.tx_dropped++; | ||
1979 | return NETDEV_TX_OK; | 2031 | return NETDEV_TX_OK; |
1980 | } | 2032 | } |
1981 | 2033 | ||
@@ -2028,7 +2080,12 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) | |||
2028 | priv->rx_skbuff_dma[entry] = | 2080 | priv->rx_skbuff_dma[entry] = |
2029 | dma_map_single(priv->device, skb->data, bfsize, | 2081 | dma_map_single(priv->device, skb->data, bfsize, |
2030 | DMA_FROM_DEVICE); | 2082 | DMA_FROM_DEVICE); |
2031 | 2083 | if (dma_mapping_error(priv->device, | |
2084 | priv->rx_skbuff_dma[entry])) { | ||
2085 | dev_err(priv->device, "Rx dma map failed\n"); | ||
2086 | dev_kfree_skb(skb); | ||
2087 | break; | ||
2088 | } | ||
2032 | p->des2 = priv->rx_skbuff_dma[entry]; | 2089 | p->des2 = priv->rx_skbuff_dma[entry]; |
2033 | 2090 | ||
2034 | priv->hw->mode->refill_desc3(priv, p); | 2091 | priv->hw->mode->refill_desc3(priv, p); |
@@ -2055,7 +2112,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit) | |||
2055 | unsigned int entry = priv->cur_rx % rxsize; | 2112 | unsigned int entry = priv->cur_rx % rxsize; |
2056 | unsigned int next_entry; | 2113 | unsigned int next_entry; |
2057 | unsigned int count = 0; | 2114 | unsigned int count = 0; |
2058 | int coe = priv->plat->rx_coe; | 2115 | int coe = priv->hw->rx_csum; |
2059 | 2116 | ||
2060 | if (netif_msg_rx_status(priv)) { | 2117 | if (netif_msg_rx_status(priv)) { |
2061 | pr_debug("%s: descriptor ring:\n", __func__); | 2118 | pr_debug("%s: descriptor ring:\n", __func__); |
@@ -2276,8 +2333,7 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, | |||
2276 | 2333 | ||
2277 | if (priv->plat->rx_coe == STMMAC_RX_COE_NONE) | 2334 | if (priv->plat->rx_coe == STMMAC_RX_COE_NONE) |
2278 | features &= ~NETIF_F_RXCSUM; | 2335 | features &= ~NETIF_F_RXCSUM; |
2279 | else if (priv->plat->rx_coe == STMMAC_RX_COE_TYPE1) | 2336 | |
2280 | features &= ~NETIF_F_IPV6_CSUM; | ||
2281 | if (!priv->plat->tx_coe) | 2337 | if (!priv->plat->tx_coe) |
2282 | features &= ~NETIF_F_ALL_CSUM; | 2338 | features &= ~NETIF_F_ALL_CSUM; |
2283 | 2339 | ||
@@ -2292,6 +2348,24 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, | |||
2292 | return features; | 2348 | return features; |
2293 | } | 2349 | } |
2294 | 2350 | ||
2351 | static int stmmac_set_features(struct net_device *netdev, | ||
2352 | netdev_features_t features) | ||
2353 | { | ||
2354 | struct stmmac_priv *priv = netdev_priv(netdev); | ||
2355 | |||
2356 | /* Keep the COE Type in case of csum is supporting */ | ||
2357 | if (features & NETIF_F_RXCSUM) | ||
2358 | priv->hw->rx_csum = priv->plat->rx_coe; | ||
2359 | else | ||
2360 | priv->hw->rx_csum = 0; | ||
2361 | /* No check needed because rx_coe has been set before and it will be | ||
2362 | * fixed in case of issue. | ||
2363 | */ | ||
2364 | priv->hw->mac->rx_ipc(priv->hw); | ||
2365 | |||
2366 | return 0; | ||
2367 | } | ||
2368 | |||
2295 | /** | 2369 | /** |
2296 | * stmmac_interrupt - main ISR | 2370 | * stmmac_interrupt - main ISR |
2297 | * @irq: interrupt number. | 2371 | * @irq: interrupt number. |
@@ -2572,6 +2646,7 @@ static const struct net_device_ops stmmac_netdev_ops = { | |||
2572 | .ndo_stop = stmmac_release, | 2646 | .ndo_stop = stmmac_release, |
2573 | .ndo_change_mtu = stmmac_change_mtu, | 2647 | .ndo_change_mtu = stmmac_change_mtu, |
2574 | .ndo_fix_features = stmmac_fix_features, | 2648 | .ndo_fix_features = stmmac_fix_features, |
2649 | .ndo_set_features = stmmac_set_features, | ||
2575 | .ndo_set_rx_mode = stmmac_set_rx_mode, | 2650 | .ndo_set_rx_mode = stmmac_set_rx_mode, |
2576 | .ndo_tx_timeout = stmmac_tx_timeout, | 2651 | .ndo_tx_timeout = stmmac_tx_timeout, |
2577 | .ndo_do_ioctl = stmmac_ioctl, | 2652 | .ndo_do_ioctl = stmmac_ioctl, |
@@ -2592,7 +2667,6 @@ static const struct net_device_ops stmmac_netdev_ops = { | |||
2592 | */ | 2667 | */ |
2593 | static int stmmac_hw_init(struct stmmac_priv *priv) | 2668 | static int stmmac_hw_init(struct stmmac_priv *priv) |
2594 | { | 2669 | { |
2595 | int ret; | ||
2596 | struct mac_device_info *mac; | 2670 | struct mac_device_info *mac; |
2597 | 2671 | ||
2598 | /* Identify the MAC HW device */ | 2672 | /* Identify the MAC HW device */ |
@@ -2649,15 +2723,11 @@ static int stmmac_hw_init(struct stmmac_priv *priv) | |||
2649 | /* To use alternate (extended) or normal descriptor structures */ | 2723 | /* To use alternate (extended) or normal descriptor structures */ |
2650 | stmmac_selec_desc_mode(priv); | 2724 | stmmac_selec_desc_mode(priv); |
2651 | 2725 | ||
2652 | ret = priv->hw->mac->rx_ipc(priv->hw); | 2726 | if (priv->plat->rx_coe) { |
2653 | if (!ret) { | 2727 | priv->hw->rx_csum = priv->plat->rx_coe; |
2654 | pr_warn(" RX IPC Checksum Offload not configured.\n"); | ||
2655 | priv->plat->rx_coe = STMMAC_RX_COE_NONE; | ||
2656 | } | ||
2657 | |||
2658 | if (priv->plat->rx_coe) | ||
2659 | pr_info(" RX Checksum Offload Engine supported (type %d)\n", | 2728 | pr_info(" RX Checksum Offload Engine supported (type %d)\n", |
2660 | priv->plat->rx_coe); | 2729 | priv->plat->rx_coe); |
2730 | } | ||
2661 | if (priv->plat->tx_coe) | 2731 | if (priv->plat->tx_coe) |
2662 | pr_info(" TX Checksum insertion supported\n"); | 2732 | pr_info(" TX Checksum insertion supported\n"); |
2663 | 2733 | ||
@@ -2716,8 +2786,15 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
2716 | if (IS_ERR(priv->stmmac_clk)) { | 2786 | if (IS_ERR(priv->stmmac_clk)) { |
2717 | dev_warn(priv->device, "%s: warning: cannot get CSR clock\n", | 2787 | dev_warn(priv->device, "%s: warning: cannot get CSR clock\n", |
2718 | __func__); | 2788 | __func__); |
2719 | ret = PTR_ERR(priv->stmmac_clk); | 2789 | /* If failed to obtain stmmac_clk and specific clk_csr value |
2720 | goto error_clk_get; | 2790 | * is NOT passed from the platform, probe fail. |
2791 | */ | ||
2792 | if (!priv->plat->clk_csr) { | ||
2793 | ret = PTR_ERR(priv->stmmac_clk); | ||
2794 | goto error_clk_get; | ||
2795 | } else { | ||
2796 | priv->stmmac_clk = NULL; | ||
2797 | } | ||
2721 | } | 2798 | } |
2722 | clk_prepare_enable(priv->stmmac_clk); | 2799 | clk_prepare_enable(priv->stmmac_clk); |
2723 | 2800 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index b7ad3565566c..c5ee79d8a8c5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | |||
@@ -206,6 +206,7 @@ void stmmac_ptp_unregister(struct stmmac_priv *priv) | |||
206 | { | 206 | { |
207 | if (priv->ptp_clock) { | 207 | if (priv->ptp_clock) { |
208 | ptp_clock_unregister(priv->ptp_clock); | 208 | ptp_clock_unregister(priv->ptp_clock); |
209 | priv->ptp_clock = NULL; | ||
209 | pr_debug("Removed PTP HW clock successfully on %s\n", | 210 | pr_debug("Removed PTP HW clock successfully on %s\n", |
210 | priv->dev->name); | 211 | priv->dev->name); |
211 | } | 212 | } |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h index 3dbc047622fa..4535df37c227 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h | |||
@@ -25,8 +25,6 @@ | |||
25 | #ifndef __STMMAC_PTP_H__ | 25 | #ifndef __STMMAC_PTP_H__ |
26 | #define __STMMAC_PTP_H__ | 26 | #define __STMMAC_PTP_H__ |
27 | 27 | ||
28 | #define STMMAC_SYSCLOCK 62500000 | ||
29 | |||
30 | /* IEEE 1588 PTP register offsets */ | 28 | /* IEEE 1588 PTP register offsets */ |
31 | #define PTP_TCR 0x0700 /* Timestamp Control Reg */ | 29 | #define PTP_TCR 0x0700 /* Timestamp Control Reg */ |
32 | #define PTP_SSIR 0x0704 /* Sub-Second Increment Reg */ | 30 | #define PTP_SSIR 0x0704 /* Sub-Second Increment Reg */ |
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 23c89ab5a6ad..f67539650c38 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c | |||
@@ -350,14 +350,17 @@ static int vnet_walk_rx_one(struct vnet_port *port, | |||
350 | if (IS_ERR(desc)) | 350 | if (IS_ERR(desc)) |
351 | return PTR_ERR(desc); | 351 | return PTR_ERR(desc); |
352 | 352 | ||
353 | if (desc->hdr.state != VIO_DESC_READY) | ||
354 | return 1; | ||
355 | |||
356 | rmb(); | ||
357 | |||
353 | viodbg(DATA, "vio_walk_rx_one desc[%02x:%02x:%08x:%08x:%llx:%llx]\n", | 358 | viodbg(DATA, "vio_walk_rx_one desc[%02x:%02x:%08x:%08x:%llx:%llx]\n", |
354 | desc->hdr.state, desc->hdr.ack, | 359 | desc->hdr.state, desc->hdr.ack, |
355 | desc->size, desc->ncookies, | 360 | desc->size, desc->ncookies, |
356 | desc->cookies[0].cookie_addr, | 361 | desc->cookies[0].cookie_addr, |
357 | desc->cookies[0].cookie_size); | 362 | desc->cookies[0].cookie_size); |
358 | 363 | ||
359 | if (desc->hdr.state != VIO_DESC_READY) | ||
360 | return 1; | ||
361 | err = vnet_rx_one(port, desc->size, desc->cookies, desc->ncookies); | 364 | err = vnet_rx_one(port, desc->size, desc->cookies, desc->ncookies); |
362 | if (err == -ECONNRESET) | 365 | if (err == -ECONNRESET) |
363 | return err; | 366 | return err; |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 999fb72688d2..e2a00287f8eb 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -699,6 +699,28 @@ static void cpsw_rx_handler(void *token, int len, int status) | |||
699 | cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); | 699 | cpsw_dual_emac_src_port_detect(status, priv, ndev, skb); |
700 | 700 | ||
701 | if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { | 701 | if (unlikely(status < 0) || unlikely(!netif_running(ndev))) { |
702 | bool ndev_status = false; | ||
703 | struct cpsw_slave *slave = priv->slaves; | ||
704 | int n; | ||
705 | |||
706 | if (priv->data.dual_emac) { | ||
707 | /* In dual emac mode check for all interfaces */ | ||
708 | for (n = priv->data.slaves; n; n--, slave++) | ||
709 | if (netif_running(slave->ndev)) | ||
710 | ndev_status = true; | ||
711 | } | ||
712 | |||
713 | if (ndev_status && (status >= 0)) { | ||
714 | /* The packet received is for the interface which | ||
715 | * is already down and the other interface is up | ||
716 | * and running, intead of freeing which results | ||
717 | * in reducing of the number of rx descriptor in | ||
718 | * DMA engine, requeue skb back to cpdma. | ||
719 | */ | ||
720 | new_skb = skb; | ||
721 | goto requeue; | ||
722 | } | ||
723 | |||
702 | /* the interface is going down, skbs are purged */ | 724 | /* the interface is going down, skbs are purged */ |
703 | dev_kfree_skb_any(skb); | 725 | dev_kfree_skb_any(skb); |
704 | return; | 726 | return; |
@@ -717,6 +739,7 @@ static void cpsw_rx_handler(void *token, int len, int status) | |||
717 | new_skb = skb; | 739 | new_skb = skb; |
718 | } | 740 | } |
719 | 741 | ||
742 | requeue: | ||
720 | ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data, | 743 | ret = cpdma_chan_submit(priv->rxch, new_skb, new_skb->data, |
721 | skb_tailroom(new_skb), 0); | 744 | skb_tailroom(new_skb), 0); |
722 | if (WARN_ON(ret < 0)) | 745 | if (WARN_ON(ret < 0)) |
@@ -2311,10 +2334,19 @@ static int cpsw_suspend(struct device *dev) | |||
2311 | struct net_device *ndev = platform_get_drvdata(pdev); | 2334 | struct net_device *ndev = platform_get_drvdata(pdev); |
2312 | struct cpsw_priv *priv = netdev_priv(ndev); | 2335 | struct cpsw_priv *priv = netdev_priv(ndev); |
2313 | 2336 | ||
2314 | if (netif_running(ndev)) | 2337 | if (priv->data.dual_emac) { |
2315 | cpsw_ndo_stop(ndev); | 2338 | int i; |
2316 | 2339 | ||
2317 | for_each_slave(priv, soft_reset_slave); | 2340 | for (i = 0; i < priv->data.slaves; i++) { |
2341 | if (netif_running(priv->slaves[i].ndev)) | ||
2342 | cpsw_ndo_stop(priv->slaves[i].ndev); | ||
2343 | soft_reset_slave(priv->slaves + i); | ||
2344 | } | ||
2345 | } else { | ||
2346 | if (netif_running(ndev)) | ||
2347 | cpsw_ndo_stop(ndev); | ||
2348 | for_each_slave(priv, soft_reset_slave); | ||
2349 | } | ||
2318 | 2350 | ||
2319 | pm_runtime_put_sync(&pdev->dev); | 2351 | pm_runtime_put_sync(&pdev->dev); |
2320 | 2352 | ||
@@ -2328,14 +2360,24 @@ static int cpsw_resume(struct device *dev) | |||
2328 | { | 2360 | { |
2329 | struct platform_device *pdev = to_platform_device(dev); | 2361 | struct platform_device *pdev = to_platform_device(dev); |
2330 | struct net_device *ndev = platform_get_drvdata(pdev); | 2362 | struct net_device *ndev = platform_get_drvdata(pdev); |
2363 | struct cpsw_priv *priv = netdev_priv(ndev); | ||
2331 | 2364 | ||
2332 | pm_runtime_get_sync(&pdev->dev); | 2365 | pm_runtime_get_sync(&pdev->dev); |
2333 | 2366 | ||
2334 | /* Select default pin state */ | 2367 | /* Select default pin state */ |
2335 | pinctrl_pm_select_default_state(&pdev->dev); | 2368 | pinctrl_pm_select_default_state(&pdev->dev); |
2336 | 2369 | ||
2337 | if (netif_running(ndev)) | 2370 | if (priv->data.dual_emac) { |
2338 | cpsw_ndo_open(ndev); | 2371 | int i; |
2372 | |||
2373 | for (i = 0; i < priv->data.slaves; i++) { | ||
2374 | if (netif_running(priv->slaves[i].ndev)) | ||
2375 | cpsw_ndo_open(priv->slaves[i].ndev); | ||
2376 | } | ||
2377 | } else { | ||
2378 | if (netif_running(ndev)) | ||
2379 | cpsw_ndo_open(ndev); | ||
2380 | } | ||
2339 | return 0; | 2381 | return 0; |
2340 | } | 2382 | } |
2341 | 2383 | ||
diff --git a/drivers/net/fddi/skfp/h/skfbi.h b/drivers/net/fddi/skfp/h/skfbi.h index c1ba26c06d73..3de2f0d15fe2 100644 --- a/drivers/net/fddi/skfp/h/skfbi.h +++ b/drivers/net/fddi/skfp/h/skfbi.h | |||
@@ -147,11 +147,6 @@ | |||
147 | #define PCI_MEM64BIT (2<<1) /* Base addr anywhere in 64 Bit range */ | 147 | #define PCI_MEM64BIT (2<<1) /* Base addr anywhere in 64 Bit range */ |
148 | #define PCI_MEMSPACE 0x00000001L /* Bit 0: Memory Space Indic. */ | 148 | #define PCI_MEMSPACE 0x00000001L /* Bit 0: Memory Space Indic. */ |
149 | 149 | ||
150 | /* PCI_BASE_2ND 32 bit 2nd Base address */ | ||
151 | #define PCI_IOBASE 0xffffff00L /* Bit 31..8: I/O Base address */ | ||
152 | #define PCI_IOSIZE 0x000000fcL /* Bit 7..2: I/O Size Requirements */ | ||
153 | #define PCI_IOSPACE 0x00000001L /* Bit 0: I/O Space Indicator */ | ||
154 | |||
155 | /* PCI_SUB_VID 16 bit Subsystem Vendor ID */ | 150 | /* PCI_SUB_VID 16 bit Subsystem Vendor ID */ |
156 | /* PCI_SUB_ID 16 bit Subsystem ID */ | 151 | /* PCI_SUB_ID 16 bit Subsystem ID */ |
157 | 152 | ||
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index a9c5eaadc426..0fcb5e7eb073 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -387,6 +387,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
387 | int hdr_offset; | 387 | int hdr_offset; |
388 | u32 net_trans_info; | 388 | u32 net_trans_info; |
389 | u32 hash; | 389 | u32 hash; |
390 | u32 skb_length = skb->len; | ||
390 | 391 | ||
391 | 392 | ||
392 | /* We will atmost need two pages to describe the rndis | 393 | /* We will atmost need two pages to describe the rndis |
@@ -562,7 +563,7 @@ do_send: | |||
562 | 563 | ||
563 | drop: | 564 | drop: |
564 | if (ret == 0) { | 565 | if (ret == 0) { |
565 | net->stats.tx_bytes += skb->len; | 566 | net->stats.tx_bytes += skb_length; |
566 | net->stats.tx_packets++; | 567 | net->stats.tx_packets++; |
567 | } else { | 568 | } else { |
568 | kfree(packet); | 569 | kfree(packet); |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index a96955597755..726edabff26b 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/netpoll.h> | 36 | #include <linux/netpoll.h> |
37 | 37 | ||
38 | #define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE) | 38 | #define MACVLAN_HASH_SIZE (1 << BITS_PER_BYTE) |
39 | #define MACVLAN_BC_QUEUE_LEN 1000 | ||
39 | 40 | ||
40 | struct macvlan_port { | 41 | struct macvlan_port { |
41 | struct net_device *dev; | 42 | struct net_device *dev; |
@@ -248,7 +249,7 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port, | |||
248 | goto err; | 249 | goto err; |
249 | 250 | ||
250 | spin_lock(&port->bc_queue.lock); | 251 | spin_lock(&port->bc_queue.lock); |
251 | if (skb_queue_len(&port->bc_queue) < skb->dev->tx_queue_len) { | 252 | if (skb_queue_len(&port->bc_queue) < MACVLAN_BC_QUEUE_LEN) { |
252 | __skb_queue_tail(&port->bc_queue, nskb); | 253 | __skb_queue_tail(&port->bc_queue, nskb); |
253 | err = 0; | 254 | err = 0; |
254 | } | 255 | } |
@@ -806,6 +807,7 @@ static netdev_features_t macvlan_fix_features(struct net_device *dev, | |||
806 | features, | 807 | features, |
807 | mask); | 808 | mask); |
808 | features |= ALWAYS_ON_FEATURES; | 809 | features |= ALWAYS_ON_FEATURES; |
810 | features &= ~NETIF_F_NETNS_LOCAL; | ||
809 | 811 | ||
810 | return features; | 812 | return features; |
811 | } | 813 | } |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 3381c4f91a8c..0c6adaaf898c 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -112,17 +112,15 @@ out: | |||
112 | return err; | 112 | return err; |
113 | } | 113 | } |
114 | 114 | ||
115 | /* Requires RTNL */ | ||
115 | static int macvtap_set_queue(struct net_device *dev, struct file *file, | 116 | static int macvtap_set_queue(struct net_device *dev, struct file *file, |
116 | struct macvtap_queue *q) | 117 | struct macvtap_queue *q) |
117 | { | 118 | { |
118 | struct macvlan_dev *vlan = netdev_priv(dev); | 119 | struct macvlan_dev *vlan = netdev_priv(dev); |
119 | int err = -EBUSY; | ||
120 | 120 | ||
121 | rtnl_lock(); | ||
122 | if (vlan->numqueues == MAX_MACVTAP_QUEUES) | 121 | if (vlan->numqueues == MAX_MACVTAP_QUEUES) |
123 | goto out; | 122 | return -EBUSY; |
124 | 123 | ||
125 | err = 0; | ||
126 | rcu_assign_pointer(q->vlan, vlan); | 124 | rcu_assign_pointer(q->vlan, vlan); |
127 | rcu_assign_pointer(vlan->taps[vlan->numvtaps], q); | 125 | rcu_assign_pointer(vlan->taps[vlan->numvtaps], q); |
128 | sock_hold(&q->sk); | 126 | sock_hold(&q->sk); |
@@ -136,9 +134,7 @@ static int macvtap_set_queue(struct net_device *dev, struct file *file, | |||
136 | vlan->numvtaps++; | 134 | vlan->numvtaps++; |
137 | vlan->numqueues++; | 135 | vlan->numqueues++; |
138 | 136 | ||
139 | out: | 137 | return 0; |
140 | rtnl_unlock(); | ||
141 | return err; | ||
142 | } | 138 | } |
143 | 139 | ||
144 | static int macvtap_disable_queue(struct macvtap_queue *q) | 140 | static int macvtap_disable_queue(struct macvtap_queue *q) |
@@ -454,11 +450,12 @@ static void macvtap_sock_destruct(struct sock *sk) | |||
454 | static int macvtap_open(struct inode *inode, struct file *file) | 450 | static int macvtap_open(struct inode *inode, struct file *file) |
455 | { | 451 | { |
456 | struct net *net = current->nsproxy->net_ns; | 452 | struct net *net = current->nsproxy->net_ns; |
457 | struct net_device *dev = dev_get_by_macvtap_minor(iminor(inode)); | 453 | struct net_device *dev; |
458 | struct macvtap_queue *q; | 454 | struct macvtap_queue *q; |
459 | int err; | 455 | int err = -ENODEV; |
460 | 456 | ||
461 | err = -ENODEV; | 457 | rtnl_lock(); |
458 | dev = dev_get_by_macvtap_minor(iminor(inode)); | ||
462 | if (!dev) | 459 | if (!dev) |
463 | goto out; | 460 | goto out; |
464 | 461 | ||
@@ -498,6 +495,7 @@ out: | |||
498 | if (dev) | 495 | if (dev) |
499 | dev_put(dev); | 496 | dev_put(dev); |
500 | 497 | ||
498 | rtnl_unlock(); | ||
501 | return err; | 499 | return err; |
502 | } | 500 | } |
503 | 501 | ||
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index fd0ea7c50ee6..011dbda2b2f1 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
@@ -592,8 +592,7 @@ static struct phy_driver ksphy_driver[] = { | |||
592 | .phy_id = PHY_ID_KSZ9031, | 592 | .phy_id = PHY_ID_KSZ9031, |
593 | .phy_id_mask = 0x00fffff0, | 593 | .phy_id_mask = 0x00fffff0, |
594 | .name = "Micrel KSZ9031 Gigabit PHY", | 594 | .name = "Micrel KSZ9031 Gigabit PHY", |
595 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | 595 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause), |
596 | | SUPPORTED_Asym_Pause), | ||
597 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 596 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
598 | .config_init = ksz9031_config_init, | 597 | .config_init = ksz9031_config_init, |
599 | .config_aneg = genphy_config_aneg, | 598 | .config_aneg = genphy_config_aneg, |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c94e2a27446a..a854d38c231d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -1036,31 +1036,31 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1036 | /* First check if the EEE ability is supported */ | 1036 | /* First check if the EEE ability is supported */ |
1037 | eee_cap = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE, | 1037 | eee_cap = phy_read_mmd_indirect(phydev, MDIO_PCS_EEE_ABLE, |
1038 | MDIO_MMD_PCS, phydev->addr); | 1038 | MDIO_MMD_PCS, phydev->addr); |
1039 | if (eee_cap < 0) | 1039 | if (eee_cap <= 0) |
1040 | return eee_cap; | 1040 | goto eee_exit_err; |
1041 | 1041 | ||
1042 | cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); | 1042 | cap = mmd_eee_cap_to_ethtool_sup_t(eee_cap); |
1043 | if (!cap) | 1043 | if (!cap) |
1044 | return -EPROTONOSUPPORT; | 1044 | goto eee_exit_err; |
1045 | 1045 | ||
1046 | /* Check which link settings negotiated and verify it in | 1046 | /* Check which link settings negotiated and verify it in |
1047 | * the EEE advertising registers. | 1047 | * the EEE advertising registers. |
1048 | */ | 1048 | */ |
1049 | eee_lp = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_LPABLE, | 1049 | eee_lp = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_LPABLE, |
1050 | MDIO_MMD_AN, phydev->addr); | 1050 | MDIO_MMD_AN, phydev->addr); |
1051 | if (eee_lp < 0) | 1051 | if (eee_lp <= 0) |
1052 | return eee_lp; | 1052 | goto eee_exit_err; |
1053 | 1053 | ||
1054 | eee_adv = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_ADV, | 1054 | eee_adv = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_ADV, |
1055 | MDIO_MMD_AN, phydev->addr); | 1055 | MDIO_MMD_AN, phydev->addr); |
1056 | if (eee_adv < 0) | 1056 | if (eee_adv <= 0) |
1057 | return eee_adv; | 1057 | goto eee_exit_err; |
1058 | 1058 | ||
1059 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); | 1059 | adv = mmd_eee_adv_to_ethtool_adv_t(eee_adv); |
1060 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); | 1060 | lp = mmd_eee_adv_to_ethtool_adv_t(eee_lp); |
1061 | idx = phy_find_setting(phydev->speed, phydev->duplex); | 1061 | idx = phy_find_setting(phydev->speed, phydev->duplex); |
1062 | if (!(lp & adv & settings[idx].setting)) | 1062 | if (!(lp & adv & settings[idx].setting)) |
1063 | return -EPROTONOSUPPORT; | 1063 | goto eee_exit_err; |
1064 | 1064 | ||
1065 | if (clk_stop_enable) { | 1065 | if (clk_stop_enable) { |
1066 | /* Configure the PHY to stop receiving xMII | 1066 | /* Configure the PHY to stop receiving xMII |
@@ -1080,7 +1080,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1080 | 1080 | ||
1081 | return 0; /* EEE supported */ | 1081 | return 0; /* EEE supported */ |
1082 | } | 1082 | } |
1083 | 1083 | eee_exit_err: | |
1084 | return -EPROTONOSUPPORT; | 1084 | return -EPROTONOSUPPORT; |
1085 | } | 1085 | } |
1086 | EXPORT_SYMBOL(phy_init_eee); | 1086 | EXPORT_SYMBOL(phy_init_eee); |
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 87f710476217..604ef210a4de 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <net/ip6_checksum.h> | 24 | #include <net/ip6_checksum.h> |
25 | 25 | ||
26 | /* Version Information */ | 26 | /* Version Information */ |
27 | #define DRIVER_VERSION "v1.06.0 (2014/03/03)" | 27 | #define DRIVER_VERSION "v1.06.1 (2014/10/01)" |
28 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" | 28 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" |
29 | #define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" | 29 | #define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" |
30 | #define MODULENAME "r8152" | 30 | #define MODULENAME "r8152" |
@@ -1949,10 +1949,34 @@ static void rxdy_gated_en(struct r8152 *tp, bool enable) | |||
1949 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data); | 1949 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data); |
1950 | } | 1950 | } |
1951 | 1951 | ||
1952 | static int rtl_start_rx(struct r8152 *tp) | ||
1953 | { | ||
1954 | int i, ret = 0; | ||
1955 | |||
1956 | INIT_LIST_HEAD(&tp->rx_done); | ||
1957 | for (i = 0; i < RTL8152_MAX_RX; i++) { | ||
1958 | INIT_LIST_HEAD(&tp->rx_info[i].list); | ||
1959 | ret = r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); | ||
1960 | if (ret) | ||
1961 | break; | ||
1962 | } | ||
1963 | |||
1964 | return ret; | ||
1965 | } | ||
1966 | |||
1967 | static int rtl_stop_rx(struct r8152 *tp) | ||
1968 | { | ||
1969 | int i; | ||
1970 | |||
1971 | for (i = 0; i < RTL8152_MAX_RX; i++) | ||
1972 | usb_kill_urb(tp->rx_info[i].urb); | ||
1973 | |||
1974 | return 0; | ||
1975 | } | ||
1976 | |||
1952 | static int rtl_enable(struct r8152 *tp) | 1977 | static int rtl_enable(struct r8152 *tp) |
1953 | { | 1978 | { |
1954 | u32 ocp_data; | 1979 | u32 ocp_data; |
1955 | int i, ret; | ||
1956 | 1980 | ||
1957 | r8152b_reset_packet_filter(tp); | 1981 | r8152b_reset_packet_filter(tp); |
1958 | 1982 | ||
@@ -1962,14 +1986,7 @@ static int rtl_enable(struct r8152 *tp) | |||
1962 | 1986 | ||
1963 | rxdy_gated_en(tp, false); | 1987 | rxdy_gated_en(tp, false); |
1964 | 1988 | ||
1965 | INIT_LIST_HEAD(&tp->rx_done); | 1989 | return rtl_start_rx(tp); |
1966 | ret = 0; | ||
1967 | for (i = 0; i < RTL8152_MAX_RX; i++) { | ||
1968 | INIT_LIST_HEAD(&tp->rx_info[i].list); | ||
1969 | ret |= r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); | ||
1970 | } | ||
1971 | |||
1972 | return ret; | ||
1973 | } | 1990 | } |
1974 | 1991 | ||
1975 | static int rtl8152_enable(struct r8152 *tp) | 1992 | static int rtl8152_enable(struct r8152 *tp) |
@@ -2019,7 +2036,7 @@ static int rtl8153_enable(struct r8152 *tp) | |||
2019 | return rtl_enable(tp); | 2036 | return rtl_enable(tp); |
2020 | } | 2037 | } |
2021 | 2038 | ||
2022 | static void rtl8152_disable(struct r8152 *tp) | 2039 | static void rtl_disable(struct r8152 *tp) |
2023 | { | 2040 | { |
2024 | u32 ocp_data; | 2041 | u32 ocp_data; |
2025 | int i; | 2042 | int i; |
@@ -2053,8 +2070,7 @@ static void rtl8152_disable(struct r8152 *tp) | |||
2053 | mdelay(1); | 2070 | mdelay(1); |
2054 | } | 2071 | } |
2055 | 2072 | ||
2056 | for (i = 0; i < RTL8152_MAX_RX; i++) | 2073 | rtl_stop_rx(tp); |
2057 | usb_kill_urb(tp->rx_info[i].urb); | ||
2058 | 2074 | ||
2059 | rtl8152_nic_reset(tp); | 2075 | rtl8152_nic_reset(tp); |
2060 | } | 2076 | } |
@@ -2185,28 +2201,6 @@ static void rtl_phy_reset(struct r8152 *tp) | |||
2185 | } | 2201 | } |
2186 | } | 2202 | } |
2187 | 2203 | ||
2188 | static void rtl_clear_bp(struct r8152 *tp) | ||
2189 | { | ||
2190 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_0, 0); | ||
2191 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_2, 0); | ||
2192 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_4, 0); | ||
2193 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_6, 0); | ||
2194 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_0, 0); | ||
2195 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0); | ||
2196 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0); | ||
2197 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0); | ||
2198 | mdelay(3); | ||
2199 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0); | ||
2200 | ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0); | ||
2201 | } | ||
2202 | |||
2203 | static void r8153_clear_bp(struct r8152 *tp) | ||
2204 | { | ||
2205 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_BP_EN, 0); | ||
2206 | ocp_write_byte(tp, MCU_TYPE_USB, USB_BP_EN, 0); | ||
2207 | rtl_clear_bp(tp); | ||
2208 | } | ||
2209 | |||
2210 | static void r8153_teredo_off(struct r8152 *tp) | 2204 | static void r8153_teredo_off(struct r8152 *tp) |
2211 | { | 2205 | { |
2212 | u32 ocp_data; | 2206 | u32 ocp_data; |
@@ -2232,6 +2226,13 @@ static inline void r8152b_enable_aldps(struct r8152 *tp) | |||
2232 | LINKENA | DIS_SDSAVE); | 2226 | LINKENA | DIS_SDSAVE); |
2233 | } | 2227 | } |
2234 | 2228 | ||
2229 | static void rtl8152_disable(struct r8152 *tp) | ||
2230 | { | ||
2231 | r8152b_disable_aldps(tp); | ||
2232 | rtl_disable(tp); | ||
2233 | r8152b_enable_aldps(tp); | ||
2234 | } | ||
2235 | |||
2235 | static void r8152b_hw_phy_cfg(struct r8152 *tp) | 2236 | static void r8152b_hw_phy_cfg(struct r8152 *tp) |
2236 | { | 2237 | { |
2237 | u16 data; | 2238 | u16 data; |
@@ -2242,11 +2243,6 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp) | |||
2242 | r8152_mdio_write(tp, MII_BMCR, data); | 2243 | r8152_mdio_write(tp, MII_BMCR, data); |
2243 | } | 2244 | } |
2244 | 2245 | ||
2245 | r8152b_disable_aldps(tp); | ||
2246 | |||
2247 | rtl_clear_bp(tp); | ||
2248 | |||
2249 | r8152b_enable_aldps(tp); | ||
2250 | set_bit(PHY_RESET, &tp->flags); | 2246 | set_bit(PHY_RESET, &tp->flags); |
2251 | } | 2247 | } |
2252 | 2248 | ||
@@ -2255,9 +2251,6 @@ static void r8152b_exit_oob(struct r8152 *tp) | |||
2255 | u32 ocp_data; | 2251 | u32 ocp_data; |
2256 | int i; | 2252 | int i; |
2257 | 2253 | ||
2258 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2259 | return; | ||
2260 | |||
2261 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); | 2254 | ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR); |
2262 | ocp_data &= ~RCR_ACPT_ALL; | 2255 | ocp_data &= ~RCR_ACPT_ALL; |
2263 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); | 2256 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RCR, ocp_data); |
@@ -2347,7 +2340,7 @@ static void r8152b_enter_oob(struct r8152 *tp) | |||
2347 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB); | 2340 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL1, RXFIFO_THR2_OOB); |
2348 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB); | 2341 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_RXFIFO_CTRL2, RXFIFO_THR3_OOB); |
2349 | 2342 | ||
2350 | rtl8152_disable(tp); | 2343 | rtl_disable(tp); |
2351 | 2344 | ||
2352 | for (i = 0; i < 1000; i++) { | 2345 | for (i = 0; i < 1000; i++) { |
2353 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2346 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
@@ -2400,8 +2393,6 @@ static void r8153_hw_phy_cfg(struct r8152 *tp) | |||
2400 | r8152_mdio_write(tp, MII_BMCR, data); | 2393 | r8152_mdio_write(tp, MII_BMCR, data); |
2401 | } | 2394 | } |
2402 | 2395 | ||
2403 | r8153_clear_bp(tp); | ||
2404 | |||
2405 | if (tp->version == RTL_VER_03) { | 2396 | if (tp->version == RTL_VER_03) { |
2406 | data = ocp_reg_read(tp, OCP_EEE_CFG); | 2397 | data = ocp_reg_read(tp, OCP_EEE_CFG); |
2407 | data &= ~CTAP_SHORT_EN; | 2398 | data &= ~CTAP_SHORT_EN; |
@@ -2485,9 +2476,6 @@ static void r8153_first_init(struct r8152 *tp) | |||
2485 | u32 ocp_data; | 2476 | u32 ocp_data; |
2486 | int i; | 2477 | int i; |
2487 | 2478 | ||
2488 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2489 | return; | ||
2490 | |||
2491 | rxdy_gated_en(tp, true); | 2479 | rxdy_gated_en(tp, true); |
2492 | r8153_teredo_off(tp); | 2480 | r8153_teredo_off(tp); |
2493 | 2481 | ||
@@ -2560,7 +2548,7 @@ static void r8153_enter_oob(struct r8152 *tp) | |||
2560 | ocp_data &= ~NOW_IS_OOB; | 2548 | ocp_data &= ~NOW_IS_OOB; |
2561 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); | 2549 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data); |
2562 | 2550 | ||
2563 | rtl8152_disable(tp); | 2551 | rtl_disable(tp); |
2564 | 2552 | ||
2565 | for (i = 0; i < 1000; i++) { | 2553 | for (i = 0; i < 1000; i++) { |
2566 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2554 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
@@ -2624,6 +2612,13 @@ static void r8153_enable_aldps(struct r8152 *tp) | |||
2624 | ocp_reg_write(tp, OCP_POWER_CFG, data); | 2612 | ocp_reg_write(tp, OCP_POWER_CFG, data); |
2625 | } | 2613 | } |
2626 | 2614 | ||
2615 | static void rtl8153_disable(struct r8152 *tp) | ||
2616 | { | ||
2617 | r8153_disable_aldps(tp); | ||
2618 | rtl_disable(tp); | ||
2619 | r8153_enable_aldps(tp); | ||
2620 | } | ||
2621 | |||
2627 | static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex) | 2622 | static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex) |
2628 | { | 2623 | { |
2629 | u16 bmcr, anar, gbcr; | 2624 | u16 bmcr, anar, gbcr; |
@@ -2714,6 +2709,16 @@ out: | |||
2714 | return ret; | 2709 | return ret; |
2715 | } | 2710 | } |
2716 | 2711 | ||
2712 | static void rtl8152_up(struct r8152 *tp) | ||
2713 | { | ||
2714 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2715 | return; | ||
2716 | |||
2717 | r8152b_disable_aldps(tp); | ||
2718 | r8152b_exit_oob(tp); | ||
2719 | r8152b_enable_aldps(tp); | ||
2720 | } | ||
2721 | |||
2717 | static void rtl8152_down(struct r8152 *tp) | 2722 | static void rtl8152_down(struct r8152 *tp) |
2718 | { | 2723 | { |
2719 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { | 2724 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { |
@@ -2727,6 +2732,16 @@ static void rtl8152_down(struct r8152 *tp) | |||
2727 | r8152b_enable_aldps(tp); | 2732 | r8152b_enable_aldps(tp); |
2728 | } | 2733 | } |
2729 | 2734 | ||
2735 | static void rtl8153_up(struct r8152 *tp) | ||
2736 | { | ||
2737 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | ||
2738 | return; | ||
2739 | |||
2740 | r8153_disable_aldps(tp); | ||
2741 | r8153_first_init(tp); | ||
2742 | r8153_enable_aldps(tp); | ||
2743 | } | ||
2744 | |||
2730 | static void rtl8153_down(struct r8152 *tp) | 2745 | static void rtl8153_down(struct r8152 *tp) |
2731 | { | 2746 | { |
2732 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { | 2747 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) { |
@@ -2946,6 +2961,8 @@ static void r8152b_init(struct r8152 *tp) | |||
2946 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 2961 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
2947 | return; | 2962 | return; |
2948 | 2963 | ||
2964 | r8152b_disable_aldps(tp); | ||
2965 | |||
2949 | if (tp->version == RTL_VER_01) { | 2966 | if (tp->version == RTL_VER_01) { |
2950 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE); | 2967 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_LED_FEATURE); |
2951 | ocp_data &= ~LED_MODE_MASK; | 2968 | ocp_data &= ~LED_MODE_MASK; |
@@ -2984,6 +3001,7 @@ static void r8153_init(struct r8152 *tp) | |||
2984 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3001 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
2985 | return; | 3002 | return; |
2986 | 3003 | ||
3004 | r8153_disable_aldps(tp); | ||
2987 | r8153_u1u2en(tp, false); | 3005 | r8153_u1u2en(tp, false); |
2988 | 3006 | ||
2989 | for (i = 0; i < 500; i++) { | 3007 | for (i = 0; i < 500; i++) { |
@@ -3055,13 +3073,14 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) | |||
3055 | clear_bit(WORK_ENABLE, &tp->flags); | 3073 | clear_bit(WORK_ENABLE, &tp->flags); |
3056 | usb_kill_urb(tp->intr_urb); | 3074 | usb_kill_urb(tp->intr_urb); |
3057 | cancel_delayed_work_sync(&tp->schedule); | 3075 | cancel_delayed_work_sync(&tp->schedule); |
3076 | tasklet_disable(&tp->tl); | ||
3058 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3077 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3078 | rtl_stop_rx(tp); | ||
3059 | rtl_runtime_suspend_enable(tp, true); | 3079 | rtl_runtime_suspend_enable(tp, true); |
3060 | } else { | 3080 | } else { |
3061 | tasklet_disable(&tp->tl); | ||
3062 | tp->rtl_ops.down(tp); | 3081 | tp->rtl_ops.down(tp); |
3063 | tasklet_enable(&tp->tl); | ||
3064 | } | 3082 | } |
3083 | tasklet_enable(&tp->tl); | ||
3065 | } | 3084 | } |
3066 | 3085 | ||
3067 | return 0; | 3086 | return 0; |
@@ -3080,17 +3099,18 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
3080 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3099 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3081 | rtl_runtime_suspend_enable(tp, false); | 3100 | rtl_runtime_suspend_enable(tp, false); |
3082 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3101 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
3102 | set_bit(WORK_ENABLE, &tp->flags); | ||
3083 | if (tp->speed & LINK_STATUS) | 3103 | if (tp->speed & LINK_STATUS) |
3084 | tp->rtl_ops.disable(tp); | 3104 | rtl_start_rx(tp); |
3085 | } else { | 3105 | } else { |
3086 | tp->rtl_ops.up(tp); | 3106 | tp->rtl_ops.up(tp); |
3087 | rtl8152_set_speed(tp, AUTONEG_ENABLE, | 3107 | rtl8152_set_speed(tp, AUTONEG_ENABLE, |
3088 | tp->mii.supports_gmii ? SPEED_1000 : SPEED_100, | 3108 | tp->mii.supports_gmii ? SPEED_1000 : SPEED_100, |
3089 | DUPLEX_FULL); | 3109 | DUPLEX_FULL); |
3110 | tp->speed = 0; | ||
3111 | netif_carrier_off(tp->netdev); | ||
3112 | set_bit(WORK_ENABLE, &tp->flags); | ||
3090 | } | 3113 | } |
3091 | tp->speed = 0; | ||
3092 | netif_carrier_off(tp->netdev); | ||
3093 | set_bit(WORK_ENABLE, &tp->flags); | ||
3094 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3114 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
3095 | } | 3115 | } |
3096 | 3116 | ||
@@ -3377,7 +3397,7 @@ static void rtl8153_unload(struct r8152 *tp) | |||
3377 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3397 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
3378 | return; | 3398 | return; |
3379 | 3399 | ||
3380 | r8153_power_cut_en(tp, true); | 3400 | r8153_power_cut_en(tp, false); |
3381 | } | 3401 | } |
3382 | 3402 | ||
3383 | static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | 3403 | static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) |
@@ -3392,7 +3412,7 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3392 | ops->init = r8152b_init; | 3412 | ops->init = r8152b_init; |
3393 | ops->enable = rtl8152_enable; | 3413 | ops->enable = rtl8152_enable; |
3394 | ops->disable = rtl8152_disable; | 3414 | ops->disable = rtl8152_disable; |
3395 | ops->up = r8152b_exit_oob; | 3415 | ops->up = rtl8152_up; |
3396 | ops->down = rtl8152_down; | 3416 | ops->down = rtl8152_down; |
3397 | ops->unload = rtl8152_unload; | 3417 | ops->unload = rtl8152_unload; |
3398 | ret = 0; | 3418 | ret = 0; |
@@ -3400,8 +3420,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3400 | case PRODUCT_ID_RTL8153: | 3420 | case PRODUCT_ID_RTL8153: |
3401 | ops->init = r8153_init; | 3421 | ops->init = r8153_init; |
3402 | ops->enable = rtl8153_enable; | 3422 | ops->enable = rtl8153_enable; |
3403 | ops->disable = rtl8152_disable; | 3423 | ops->disable = rtl8153_disable; |
3404 | ops->up = r8153_first_init; | 3424 | ops->up = rtl8153_up; |
3405 | ops->down = rtl8153_down; | 3425 | ops->down = rtl8153_down; |
3406 | ops->unload = rtl8153_unload; | 3426 | ops->unload = rtl8153_unload; |
3407 | ret = 0; | 3427 | ret = 0; |
@@ -3416,8 +3436,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
3416 | case PRODUCT_ID_SAMSUNG: | 3436 | case PRODUCT_ID_SAMSUNG: |
3417 | ops->init = r8153_init; | 3437 | ops->init = r8153_init; |
3418 | ops->enable = rtl8153_enable; | 3438 | ops->enable = rtl8153_enable; |
3419 | ops->disable = rtl8152_disable; | 3439 | ops->disable = rtl8153_disable; |
3420 | ops->up = r8153_first_init; | 3440 | ops->up = rtl8153_up; |
3421 | ops->down = rtl8153_down; | 3441 | ops->down = rtl8153_down; |
3422 | ops->unload = rtl8153_unload; | 3442 | ops->unload = rtl8153_unload; |
3423 | ret = 0; | 3443 | ret = 0; |
@@ -3530,7 +3550,11 @@ static void rtl8152_disconnect(struct usb_interface *intf) | |||
3530 | 3550 | ||
3531 | usb_set_intfdata(intf, NULL); | 3551 | usb_set_intfdata(intf, NULL); |
3532 | if (tp) { | 3552 | if (tp) { |
3533 | set_bit(RTL8152_UNPLUG, &tp->flags); | 3553 | struct usb_device *udev = tp->udev; |
3554 | |||
3555 | if (udev->state == USB_STATE_NOTATTACHED) | ||
3556 | set_bit(RTL8152_UNPLUG, &tp->flags); | ||
3557 | |||
3534 | tasklet_kill(&tp->tl); | 3558 | tasklet_kill(&tp->tl); |
3535 | unregister_netdev(tp->netdev); | 3559 | unregister_netdev(tp->netdev); |
3536 | tp->rtl_ops.unload(tp); | 3560 | tp->rtl_ops.unload(tp); |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index d6e90c72c257..6dfcbf523936 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -2056,7 +2056,6 @@ vmxnet3_set_mc(struct net_device *netdev) | |||
2056 | if (!netdev_mc_empty(netdev)) { | 2056 | if (!netdev_mc_empty(netdev)) { |
2057 | new_table = vmxnet3_copy_mc(netdev); | 2057 | new_table = vmxnet3_copy_mc(netdev); |
2058 | if (new_table) { | 2058 | if (new_table) { |
2059 | new_mode |= VMXNET3_RXM_MCAST; | ||
2060 | rxConf->mfTableLen = cpu_to_le16( | 2059 | rxConf->mfTableLen = cpu_to_le16( |
2061 | netdev_mc_count(netdev) * ETH_ALEN); | 2060 | netdev_mc_count(netdev) * ETH_ALEN); |
2062 | new_table_pa = dma_map_single( | 2061 | new_table_pa = dma_map_single( |
@@ -2064,15 +2063,18 @@ vmxnet3_set_mc(struct net_device *netdev) | |||
2064 | new_table, | 2063 | new_table, |
2065 | rxConf->mfTableLen, | 2064 | rxConf->mfTableLen, |
2066 | PCI_DMA_TODEVICE); | 2065 | PCI_DMA_TODEVICE); |
2066 | } | ||
2067 | |||
2068 | if (new_table_pa) { | ||
2069 | new_mode |= VMXNET3_RXM_MCAST; | ||
2067 | rxConf->mfTablePA = cpu_to_le64(new_table_pa); | 2070 | rxConf->mfTablePA = cpu_to_le64(new_table_pa); |
2068 | } else { | 2071 | } else { |
2069 | netdev_info(netdev, "failed to copy mcast list" | 2072 | netdev_info(netdev, |
2070 | ", setting ALL_MULTI\n"); | 2073 | "failed to copy mcast list, setting ALL_MULTI\n"); |
2071 | new_mode |= VMXNET3_RXM_ALL_MULTI; | 2074 | new_mode |= VMXNET3_RXM_ALL_MULTI; |
2072 | } | 2075 | } |
2073 | } | 2076 | } |
2074 | 2077 | ||
2075 | |||
2076 | if (!(new_mode & VMXNET3_RXM_MCAST)) { | 2078 | if (!(new_mode & VMXNET3_RXM_MCAST)) { |
2077 | rxConf->mfTableLen = 0; | 2079 | rxConf->mfTableLen = 0; |
2078 | rxConf->mfTablePA = 0; | 2080 | rxConf->mfTablePA = 0; |
@@ -2091,11 +2093,10 @@ vmxnet3_set_mc(struct net_device *netdev) | |||
2091 | VMXNET3_CMD_UPDATE_MAC_FILTERS); | 2093 | VMXNET3_CMD_UPDATE_MAC_FILTERS); |
2092 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); | 2094 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
2093 | 2095 | ||
2094 | if (new_table) { | 2096 | if (new_table_pa) |
2095 | dma_unmap_single(&adapter->pdev->dev, new_table_pa, | 2097 | dma_unmap_single(&adapter->pdev->dev, new_table_pa, |
2096 | rxConf->mfTableLen, PCI_DMA_TODEVICE); | 2098 | rxConf->mfTableLen, PCI_DMA_TODEVICE); |
2097 | kfree(new_table); | 2099 | kfree(new_table); |
2098 | } | ||
2099 | } | 2100 | } |
2100 | 2101 | ||
2101 | void | 2102 | void |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 29ee77f2c97f..3759479f959a 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -69,10 +69,10 @@ | |||
69 | /* | 69 | /* |
70 | * Version numbers | 70 | * Version numbers |
71 | */ | 71 | */ |
72 | #define VMXNET3_DRIVER_VERSION_STRING "1.2.0.0-k" | 72 | #define VMXNET3_DRIVER_VERSION_STRING "1.2.1.0-k" |
73 | 73 | ||
74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ | 74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ |
75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01020000 | 75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01020100 |
76 | 76 | ||
77 | #if defined(CONFIG_PCI_MSI) | 77 | #if defined(CONFIG_PCI_MSI) |
78 | /* RSS only makes sense if MSI-X is supported. */ | 78 | /* RSS only makes sense if MSI-X is supported. */ |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 1fb7b37d1402..beb377b2d4b7 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -1327,7 +1327,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb) | |||
1327 | } else if (vxlan->flags & VXLAN_F_L3MISS) { | 1327 | } else if (vxlan->flags & VXLAN_F_L3MISS) { |
1328 | union vxlan_addr ipa = { | 1328 | union vxlan_addr ipa = { |
1329 | .sin.sin_addr.s_addr = tip, | 1329 | .sin.sin_addr.s_addr = tip, |
1330 | .sa.sa_family = AF_INET, | 1330 | .sin.sin_family = AF_INET, |
1331 | }; | 1331 | }; |
1332 | 1332 | ||
1333 | vxlan_ip_miss(dev, &ipa); | 1333 | vxlan_ip_miss(dev, &ipa); |
@@ -1488,7 +1488,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb) | |||
1488 | } else if (vxlan->flags & VXLAN_F_L3MISS) { | 1488 | } else if (vxlan->flags & VXLAN_F_L3MISS) { |
1489 | union vxlan_addr ipa = { | 1489 | union vxlan_addr ipa = { |
1490 | .sin6.sin6_addr = msg->target, | 1490 | .sin6.sin6_addr = msg->target, |
1491 | .sa.sa_family = AF_INET6, | 1491 | .sin6.sin6_family = AF_INET6, |
1492 | }; | 1492 | }; |
1493 | 1493 | ||
1494 | vxlan_ip_miss(dev, &ipa); | 1494 | vxlan_ip_miss(dev, &ipa); |
@@ -1521,7 +1521,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) | |||
1521 | if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { | 1521 | if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { |
1522 | union vxlan_addr ipa = { | 1522 | union vxlan_addr ipa = { |
1523 | .sin.sin_addr.s_addr = pip->daddr, | 1523 | .sin.sin_addr.s_addr = pip->daddr, |
1524 | .sa.sa_family = AF_INET, | 1524 | .sin.sin_family = AF_INET, |
1525 | }; | 1525 | }; |
1526 | 1526 | ||
1527 | vxlan_ip_miss(dev, &ipa); | 1527 | vxlan_ip_miss(dev, &ipa); |
@@ -1542,7 +1542,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) | |||
1542 | if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { | 1542 | if (!n && (vxlan->flags & VXLAN_F_L3MISS)) { |
1543 | union vxlan_addr ipa = { | 1543 | union vxlan_addr ipa = { |
1544 | .sin6.sin6_addr = pip6->daddr, | 1544 | .sin6.sin6_addr = pip6->daddr, |
1545 | .sa.sa_family = AF_INET6, | 1545 | .sin6.sin6_family = AF_INET6, |
1546 | }; | 1546 | }; |
1547 | 1547 | ||
1548 | vxlan_ip_miss(dev, &ipa); | 1548 | vxlan_ip_miss(dev, &ipa); |
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index 334c2ece855a..da92bfa76b7c 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -2423,8 +2423,6 @@ static void at76_delete_device(struct at76_priv *priv) | |||
2423 | 2423 | ||
2424 | kfree_skb(priv->rx_skb); | 2424 | kfree_skb(priv->rx_skb); |
2425 | 2425 | ||
2426 | usb_put_dev(priv->udev); | ||
2427 | |||
2428 | at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw", | 2426 | at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw", |
2429 | __func__); | 2427 | __func__); |
2430 | ieee80211_free_hw(priv->hw); | 2428 | ieee80211_free_hw(priv->hw); |
@@ -2558,6 +2556,7 @@ static void at76_disconnect(struct usb_interface *interface) | |||
2558 | 2556 | ||
2559 | wiphy_info(priv->hw->wiphy, "disconnecting\n"); | 2557 | wiphy_info(priv->hw->wiphy, "disconnecting\n"); |
2560 | at76_delete_device(priv); | 2558 | at76_delete_device(priv); |
2559 | usb_put_dev(priv->udev); | ||
2561 | dev_info(&interface->dev, "disconnected\n"); | 2560 | dev_info(&interface->dev, "disconnected\n"); |
2562 | } | 2561 | } |
2563 | 2562 | ||
diff --git a/drivers/net/wireless/ath/ath9k/common-beacon.c b/drivers/net/wireless/ath/ath9k/common-beacon.c index 733be5178481..6ad44470d0f2 100644 --- a/drivers/net/wireless/ath/ath9k/common-beacon.c +++ b/drivers/net/wireless/ath/ath9k/common-beacon.c | |||
@@ -57,7 +57,7 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
57 | struct ath9k_beacon_state *bs) | 57 | struct ath9k_beacon_state *bs) |
58 | { | 58 | { |
59 | struct ath_common *common = ath9k_hw_common(ah); | 59 | struct ath_common *common = ath9k_hw_common(ah); |
60 | int dtim_intval, sleepduration; | 60 | int dtim_intval; |
61 | u64 tsf; | 61 | u64 tsf; |
62 | 62 | ||
63 | /* No need to configure beacon if we are not associated */ | 63 | /* No need to configure beacon if we are not associated */ |
@@ -75,7 +75,6 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
75 | * last beacon we received (which may be none). | 75 | * last beacon we received (which may be none). |
76 | */ | 76 | */ |
77 | dtim_intval = conf->intval * conf->dtim_period; | 77 | dtim_intval = conf->intval * conf->dtim_period; |
78 | sleepduration = ah->hw->conf.listen_interval * conf->intval; | ||
79 | 78 | ||
80 | /* | 79 | /* |
81 | * Pull nexttbtt forward to reflect the current | 80 | * Pull nexttbtt forward to reflect the current |
@@ -113,7 +112,7 @@ int ath9k_cmn_beacon_config_sta(struct ath_hw *ah, | |||
113 | */ | 112 | */ |
114 | 113 | ||
115 | bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100), | 114 | bs->bs_sleepduration = TU_TO_USEC(roundup(IEEE80211_MS_TO_TU(100), |
116 | sleepduration)); | 115 | conf->intval)); |
117 | if (bs->bs_sleepduration > bs->bs_dtimperiod) | 116 | if (bs->bs_sleepduration > bs->bs_dtimperiod) |
118 | bs->bs_sleepduration = bs->bs_dtimperiod; | 117 | bs->bs_sleepduration = bs->bs_dtimperiod; |
119 | 118 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c index bb86eb2ffc95..f0484b1b617e 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | |||
@@ -978,7 +978,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, | |||
978 | struct ath_hw *ah = common->ah; | 978 | struct ath_hw *ah = common->ah; |
979 | struct ath_htc_rx_status *rxstatus; | 979 | struct ath_htc_rx_status *rxstatus; |
980 | struct ath_rx_status rx_stats; | 980 | struct ath_rx_status rx_stats; |
981 | bool decrypt_error; | 981 | bool decrypt_error = false; |
982 | 982 | ||
983 | if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { | 983 | if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { |
984 | ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", | 984 | ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index e6ac8d2e610c..4b148bbb2bf6 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -513,7 +513,7 @@ irqreturn_t ath_isr(int irq, void *dev) | |||
513 | * touch anything. Note this can happen early | 513 | * touch anything. Note this can happen early |
514 | * on if the IRQ is shared. | 514 | * on if the IRQ is shared. |
515 | */ | 515 | */ |
516 | if (test_bit(ATH_OP_INVALID, &common->op_flags)) | 516 | if (!ah || test_bit(ATH_OP_INVALID, &common->op_flags)) |
517 | return IRQ_NONE; | 517 | return IRQ_NONE; |
518 | 518 | ||
519 | /* shared irq, not for us */ | 519 | /* shared irq, not for us */ |
diff --git a/drivers/net/wireless/ath/ath9k/spectral.c b/drivers/net/wireless/ath/ath9k/spectral.c index 5fe29b9f8fa2..8f68426ca653 100644 --- a/drivers/net/wireless/ath/ath9k/spectral.c +++ b/drivers/net/wireless/ath/ath9k/spectral.c | |||
@@ -253,7 +253,7 @@ static ssize_t write_file_spec_scan_ctl(struct file *file, | |||
253 | 253 | ||
254 | if (strncmp("trigger", buf, 7) == 0) { | 254 | if (strncmp("trigger", buf, 7) == 0) { |
255 | ath9k_spectral_scan_trigger(sc->hw); | 255 | ath9k_spectral_scan_trigger(sc->hw); |
256 | } else if (strncmp("background", buf, 9) == 0) { | 256 | } else if (strncmp("background", buf, 10) == 0) { |
257 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_BACKGROUND); | 257 | ath9k_spectral_scan_config(sc->hw, SPECTRAL_BACKGROUND); |
258 | ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); | 258 | ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n"); |
259 | } else if (strncmp("chanscan", buf, 8) == 0) { | 259 | } else if (strncmp("chanscan", buf, 8) == 0) { |
diff --git a/drivers/net/wireless/brcm80211/Kconfig b/drivers/net/wireless/brcm80211/Kconfig index b8e2561ea645..fe3dc126b149 100644 --- a/drivers/net/wireless/brcm80211/Kconfig +++ b/drivers/net/wireless/brcm80211/Kconfig | |||
@@ -27,10 +27,17 @@ config BRCMFMAC | |||
27 | one of the bus interface support. If you choose to build a module, | 27 | one of the bus interface support. If you choose to build a module, |
28 | it'll be called brcmfmac.ko. | 28 | it'll be called brcmfmac.ko. |
29 | 29 | ||
30 | config BRCMFMAC_PROTO_BCDC | ||
31 | bool | ||
32 | |||
33 | config BRCMFMAC_PROTO_MSGBUF | ||
34 | bool | ||
35 | |||
30 | config BRCMFMAC_SDIO | 36 | config BRCMFMAC_SDIO |
31 | bool "SDIO bus interface support for FullMAC driver" | 37 | bool "SDIO bus interface support for FullMAC driver" |
32 | depends on (MMC = y || MMC = BRCMFMAC) | 38 | depends on (MMC = y || MMC = BRCMFMAC) |
33 | depends on BRCMFMAC | 39 | depends on BRCMFMAC |
40 | select BRCMFMAC_PROTO_BCDC | ||
34 | select FW_LOADER | 41 | select FW_LOADER |
35 | default y | 42 | default y |
36 | ---help--- | 43 | ---help--- |
@@ -42,6 +49,7 @@ config BRCMFMAC_USB | |||
42 | bool "USB bus interface support for FullMAC driver" | 49 | bool "USB bus interface support for FullMAC driver" |
43 | depends on (USB = y || USB = BRCMFMAC) | 50 | depends on (USB = y || USB = BRCMFMAC) |
44 | depends on BRCMFMAC | 51 | depends on BRCMFMAC |
52 | select BRCMFMAC_PROTO_BCDC | ||
45 | select FW_LOADER | 53 | select FW_LOADER |
46 | ---help--- | 54 | ---help--- |
47 | This option enables the USB bus interface support for Broadcom | 55 | This option enables the USB bus interface support for Broadcom |
@@ -52,6 +60,8 @@ config BRCMFMAC_PCIE | |||
52 | bool "PCIE bus interface support for FullMAC driver" | 60 | bool "PCIE bus interface support for FullMAC driver" |
53 | depends on BRCMFMAC | 61 | depends on BRCMFMAC |
54 | depends on PCI | 62 | depends on PCI |
63 | depends on HAS_DMA | ||
64 | select BRCMFMAC_PROTO_MSGBUF | ||
55 | select FW_LOADER | 65 | select FW_LOADER |
56 | ---help--- | 66 | ---help--- |
57 | This option enables the PCIE bus interface support for Broadcom | 67 | This option enables the PCIE bus interface support for Broadcom |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/brcm80211/brcmfmac/Makefile index c35adf4bc70b..90a977fe9a64 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/Makefile +++ b/drivers/net/wireless/brcm80211/brcmfmac/Makefile | |||
@@ -30,16 +30,18 @@ brcmfmac-objs += \ | |||
30 | fwsignal.o \ | 30 | fwsignal.o \ |
31 | p2p.o \ | 31 | p2p.o \ |
32 | proto.o \ | 32 | proto.o \ |
33 | bcdc.o \ | ||
34 | commonring.o \ | ||
35 | flowring.o \ | ||
36 | msgbuf.o \ | ||
37 | dhd_common.o \ | 33 | dhd_common.o \ |
38 | dhd_linux.o \ | 34 | dhd_linux.o \ |
39 | firmware.o \ | 35 | firmware.o \ |
40 | feature.o \ | 36 | feature.o \ |
41 | btcoex.o \ | 37 | btcoex.o \ |
42 | vendor.o | 38 | vendor.o |
39 | brcmfmac-$(CONFIG_BRCMFMAC_PROTO_BCDC) += \ | ||
40 | bcdc.o | ||
41 | brcmfmac-$(CONFIG_BRCMFMAC_PROTO_MSGBUF) += \ | ||
42 | commonring.o \ | ||
43 | flowring.o \ | ||
44 | msgbuf.o | ||
43 | brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ | 45 | brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ |
44 | dhd_sdio.o \ | 46 | dhd_sdio.o \ |
45 | bcmsdh.o | 47 | bcmsdh.o |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h index 17e8c039ff32..6003179c0ceb 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcdc.h | |||
@@ -16,9 +16,12 @@ | |||
16 | #ifndef BRCMFMAC_BCDC_H | 16 | #ifndef BRCMFMAC_BCDC_H |
17 | #define BRCMFMAC_BCDC_H | 17 | #define BRCMFMAC_BCDC_H |
18 | 18 | ||
19 | 19 | #ifdef CONFIG_BRCMFMAC_PROTO_BCDC | |
20 | int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); | 20 | int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr); |
21 | void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); | 21 | void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr); |
22 | 22 | #else | |
23 | static inline int brcmf_proto_bcdc_attach(struct brcmf_pub *drvr) { return 0; } | ||
24 | static inline void brcmf_proto_bcdc_detach(struct brcmf_pub *drvr) {} | ||
25 | #endif | ||
23 | 26 | ||
24 | #endif /* BRCMFMAC_BCDC_H */ | 27 | #endif /* BRCMFMAC_BCDC_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index 4f1daabc551b..44fc85f68f7a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c | |||
@@ -185,7 +185,13 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
185 | ifevent->action, ifevent->ifidx, ifevent->bssidx, | 185 | ifevent->action, ifevent->ifidx, ifevent->bssidx, |
186 | ifevent->flags, ifevent->role); | 186 | ifevent->flags, ifevent->role); |
187 | 187 | ||
188 | if (ifevent->flags & BRCMF_E_IF_FLAG_NOIF) { | 188 | /* The P2P Device interface event must not be ignored |
189 | * contrary to what firmware tells us. The only way to | ||
190 | * distinguish the P2P Device is by looking at the ifidx | ||
191 | * and bssidx received. | ||
192 | */ | ||
193 | if (!(ifevent->ifidx == 0 && ifevent->bssidx == 1) && | ||
194 | (ifevent->flags & BRCMF_E_IF_FLAG_NOIF)) { | ||
189 | brcmf_dbg(EVENT, "event can be ignored\n"); | 195 | brcmf_dbg(EVENT, "event can be ignored\n"); |
190 | return; | 196 | return; |
191 | } | 197 | } |
@@ -210,12 +216,12 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, | |||
210 | return; | 216 | return; |
211 | } | 217 | } |
212 | 218 | ||
213 | if (ifevent->action == BRCMF_E_IF_CHANGE) | 219 | if (ifp && ifevent->action == BRCMF_E_IF_CHANGE) |
214 | brcmf_fws_reset_interface(ifp); | 220 | brcmf_fws_reset_interface(ifp); |
215 | 221 | ||
216 | err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); | 222 | err = brcmf_fweh_call_event_handler(ifp, emsg->event_code, emsg, data); |
217 | 223 | ||
218 | if (ifevent->action == BRCMF_E_IF_DEL) { | 224 | if (ifp && ifevent->action == BRCMF_E_IF_DEL) { |
219 | brcmf_fws_del_interface(ifp); | 225 | brcmf_fws_del_interface(ifp); |
220 | brcmf_del_if(drvr, ifevent->bssidx); | 226 | brcmf_del_if(drvr, ifevent->bssidx); |
221 | } | 227 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h index dd20b1862d44..cbf033f59109 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.h | |||
@@ -172,6 +172,8 @@ enum brcmf_fweh_event_code { | |||
172 | #define BRCMF_E_IF_ROLE_STA 0 | 172 | #define BRCMF_E_IF_ROLE_STA 0 |
173 | #define BRCMF_E_IF_ROLE_AP 1 | 173 | #define BRCMF_E_IF_ROLE_AP 1 |
174 | #define BRCMF_E_IF_ROLE_WDS 2 | 174 | #define BRCMF_E_IF_ROLE_WDS 2 |
175 | #define BRCMF_E_IF_ROLE_P2P_GO 3 | ||
176 | #define BRCMF_E_IF_ROLE_P2P_CLIENT 4 | ||
175 | 177 | ||
176 | /** | 178 | /** |
177 | * definitions for event packet validation. | 179 | * definitions for event packet validation. |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h index f901ae52bf2b..77a51b8c1e12 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h +++ b/drivers/net/wireless/brcm80211/brcmfmac/msgbuf.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #ifndef BRCMFMAC_MSGBUF_H | 15 | #ifndef BRCMFMAC_MSGBUF_H |
16 | #define BRCMFMAC_MSGBUF_H | 16 | #define BRCMFMAC_MSGBUF_H |
17 | 17 | ||
18 | #ifdef CONFIG_BRCMFMAC_PROTO_MSGBUF | ||
18 | 19 | ||
19 | #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20 | 20 | #define BRCMF_H2D_MSGRING_CONTROL_SUBMIT_MAX_ITEM 20 |
20 | #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256 | 21 | #define BRCMF_H2D_MSGRING_RXPOST_SUBMIT_MAX_ITEM 256 |
@@ -32,9 +33,15 @@ | |||
32 | 33 | ||
33 | 34 | ||
34 | int brcmf_proto_msgbuf_rx_trigger(struct device *dev); | 35 | int brcmf_proto_msgbuf_rx_trigger(struct device *dev); |
36 | void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid); | ||
35 | int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr); | 37 | int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr); |
36 | void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr); | 38 | void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr); |
37 | void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u8 flowid); | 39 | #else |
38 | 40 | static inline int brcmf_proto_msgbuf_attach(struct brcmf_pub *drvr) | |
41 | { | ||
42 | return 0; | ||
43 | } | ||
44 | static inline void brcmf_proto_msgbuf_detach(struct brcmf_pub *drvr) {} | ||
45 | #endif | ||
39 | 46 | ||
40 | #endif /* BRCMFMAC_MSGBUF_H */ | 47 | #endif /* BRCMFMAC_MSGBUF_H */ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index 02fe706fc9ec..16a246bfc343 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -497,8 +497,11 @@ brcmf_configure_arp_offload(struct brcmf_if *ifp, bool enable) | |||
497 | static void | 497 | static void |
498 | brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) | 498 | brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) |
499 | { | 499 | { |
500 | struct net_device *ndev = wdev->netdev; | 500 | struct brcmf_cfg80211_vif *vif; |
501 | struct brcmf_if *ifp = netdev_priv(ndev); | 501 | struct brcmf_if *ifp; |
502 | |||
503 | vif = container_of(wdev, struct brcmf_cfg80211_vif, wdev); | ||
504 | ifp = vif->ifp; | ||
502 | 505 | ||
503 | if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || | 506 | if ((wdev->iftype == NL80211_IFTYPE_ADHOC) || |
504 | (wdev->iftype == NL80211_IFTYPE_AP) || | 507 | (wdev->iftype == NL80211_IFTYPE_AP) || |
@@ -4918,7 +4921,7 @@ static void brcmf_count_20mhz_channels(struct brcmf_cfg80211_info *cfg, | |||
4918 | struct brcmu_chan ch; | 4921 | struct brcmu_chan ch; |
4919 | int i; | 4922 | int i; |
4920 | 4923 | ||
4921 | for (i = 0; i <= total; i++) { | 4924 | for (i = 0; i < total; i++) { |
4922 | ch.chspec = (u16)le32_to_cpu(chlist->element[i]); | 4925 | ch.chspec = (u16)le32_to_cpu(chlist->element[i]); |
4923 | cfg->d11inf.decchspec(&ch); | 4926 | cfg->d11inf.decchspec(&ch); |
4924 | 4927 | ||
@@ -5143,6 +5146,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) | |||
5143 | 5146 | ||
5144 | ch.band = BRCMU_CHAN_BAND_2G; | 5147 | ch.band = BRCMU_CHAN_BAND_2G; |
5145 | ch.bw = BRCMU_CHAN_BW_40; | 5148 | ch.bw = BRCMU_CHAN_BW_40; |
5149 | ch.sb = BRCMU_CHAN_SB_NONE; | ||
5146 | ch.chnum = 0; | 5150 | ch.chnum = 0; |
5147 | cfg->d11inf.encchspec(&ch); | 5151 | cfg->d11inf.encchspec(&ch); |
5148 | 5152 | ||
@@ -5176,6 +5180,7 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg) | |||
5176 | 5180 | ||
5177 | brcmf_update_bw40_channel_flag(&band->channels[j], &ch); | 5181 | brcmf_update_bw40_channel_flag(&band->channels[j], &ch); |
5178 | } | 5182 | } |
5183 | kfree(pbuf); | ||
5179 | } | 5184 | } |
5180 | return err; | 5185 | return err; |
5181 | } | 5186 | } |
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index 6451d2b6abcf..824f5e287783 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
@@ -51,7 +51,6 @@ config IWLWIFI_LEDS | |||
51 | 51 | ||
52 | config IWLDVM | 52 | config IWLDVM |
53 | tristate "Intel Wireless WiFi DVM Firmware support" | 53 | tristate "Intel Wireless WiFi DVM Firmware support" |
54 | depends on m | ||
55 | default IWLWIFI | 54 | default IWLWIFI |
56 | help | 55 | help |
57 | This is the driver that supports the DVM firmware which is | 56 | This is the driver that supports the DVM firmware which is |
@@ -60,7 +59,6 @@ config IWLDVM | |||
60 | 59 | ||
61 | config IWLMVM | 60 | config IWLMVM |
62 | tristate "Intel Wireless WiFi MVM Firmware support" | 61 | tristate "Intel Wireless WiFi MVM Firmware support" |
63 | depends on m | ||
64 | help | 62 | help |
65 | This is the driver that supports the MVM firmware which is | 63 | This is the driver that supports the MVM firmware which is |
66 | currently only available for 7260 and 3160 devices. | 64 | currently only available for 7260 and 3160 devices. |
diff --git a/drivers/net/wireless/iwlwifi/dvm/power.c b/drivers/net/wireless/iwlwifi/dvm/power.c index 760c45c34ef3..1513dbc79c14 100644 --- a/drivers/net/wireless/iwlwifi/dvm/power.c +++ b/drivers/net/wireless/iwlwifi/dvm/power.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "commands.h" | 40 | #include "commands.h" |
41 | #include "power.h" | 41 | #include "power.h" |
42 | 42 | ||
43 | static bool force_cam; | 43 | static bool force_cam = true; |
44 | module_param(force_cam, bool, 0644); | 44 | module_param(force_cam, bool, 0644); |
45 | MODULE_PARM_DESC(force_cam, "force continuously aware mode (no power saving at all)"); | 45 | MODULE_PARM_DESC(force_cam, "force continuously aware mode (no power saving at all)"); |
46 | 46 | ||
diff --git a/drivers/net/wireless/iwlwifi/dvm/rxon.c b/drivers/net/wireless/iwlwifi/dvm/rxon.c index 6dc5dd3ced44..ed50de6362ed 100644 --- a/drivers/net/wireless/iwlwifi/dvm/rxon.c +++ b/drivers/net/wireless/iwlwifi/dvm/rxon.c | |||
@@ -1068,6 +1068,13 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx) | |||
1068 | /* recalculate basic rates */ | 1068 | /* recalculate basic rates */ |
1069 | iwl_calc_basic_rates(priv, ctx); | 1069 | iwl_calc_basic_rates(priv, ctx); |
1070 | 1070 | ||
1071 | /* | ||
1072 | * force CTS-to-self frames protection if RTS-CTS is not preferred | ||
1073 | * one aggregation protection method | ||
1074 | */ | ||
1075 | if (!priv->hw_params.use_rts_for_aggregation) | ||
1076 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
1077 | |||
1071 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || | 1078 | if ((ctx->vif && ctx->vif->bss_conf.use_short_slot) || |
1072 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) | 1079 | !(ctx->staging.flags & RXON_FLG_BAND_24G_MSK)) |
1073 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; | 1080 | ctx->staging.flags |= RXON_FLG_SHORT_SLOT_MSK; |
@@ -1473,6 +1480,11 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw, | |||
1473 | else | 1480 | else |
1474 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; | 1481 | ctx->staging.flags &= ~RXON_FLG_TGG_PROTECT_MSK; |
1475 | 1482 | ||
1483 | if (bss_conf->use_cts_prot) | ||
1484 | ctx->staging.flags |= RXON_FLG_SELF_CTS_EN; | ||
1485 | else | ||
1486 | ctx->staging.flags &= ~RXON_FLG_SELF_CTS_EN; | ||
1487 | |||
1476 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); | 1488 | memcpy(ctx->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); |
1477 | 1489 | ||
1478 | if (vif->type == NL80211_IFTYPE_AP || | 1490 | if (vif->type == NL80211_IFTYPE_AP || |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index 48730064da73..d53adc245497 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
@@ -67,8 +67,8 @@ | |||
67 | #include "iwl-agn-hw.h" | 67 | #include "iwl-agn-hw.h" |
68 | 68 | ||
69 | /* Highest firmware API version supported */ | 69 | /* Highest firmware API version supported */ |
70 | #define IWL7260_UCODE_API_MAX 9 | 70 | #define IWL7260_UCODE_API_MAX 10 |
71 | #define IWL3160_UCODE_API_MAX 9 | 71 | #define IWL3160_UCODE_API_MAX 10 |
72 | 72 | ||
73 | /* Oldest version we won't warn about */ | 73 | /* Oldest version we won't warn about */ |
74 | #define IWL7260_UCODE_API_OK 9 | 74 | #define IWL7260_UCODE_API_OK 9 |
@@ -83,6 +83,8 @@ | |||
83 | #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ | 83 | #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ |
84 | #define IWL3160_NVM_VERSION 0x709 | 84 | #define IWL3160_NVM_VERSION 0x709 |
85 | #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ | 85 | #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ |
86 | #define IWL3165_NVM_VERSION 0x709 | ||
87 | #define IWL3165_TX_POWER_VERSION 0xffff /* meaningless */ | ||
86 | #define IWL7265_NVM_VERSION 0x0a1d | 88 | #define IWL7265_NVM_VERSION 0x0a1d |
87 | #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ | 89 | #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ |
88 | 90 | ||
@@ -92,6 +94,9 @@ | |||
92 | #define IWL3160_FW_PRE "iwlwifi-3160-" | 94 | #define IWL3160_FW_PRE "iwlwifi-3160-" |
93 | #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" | 95 | #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" |
94 | 96 | ||
97 | #define IWL3165_FW_PRE "iwlwifi-3165-" | ||
98 | #define IWL3165_MODULE_FIRMWARE(api) IWL3165_FW_PRE __stringify(api) ".ucode" | ||
99 | |||
95 | #define IWL7265_FW_PRE "iwlwifi-7265-" | 100 | #define IWL7265_FW_PRE "iwlwifi-7265-" |
96 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" | 101 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" |
97 | 102 | ||
@@ -213,6 +218,16 @@ static const struct iwl_pwr_tx_backoff iwl7265_pwr_tx_backoffs[] = { | |||
213 | {0}, | 218 | {0}, |
214 | }; | 219 | }; |
215 | 220 | ||
221 | const struct iwl_cfg iwl3165_2ac_cfg = { | ||
222 | .name = "Intel(R) Dual Band Wireless AC 3165", | ||
223 | .fw_name_pre = IWL3165_FW_PRE, | ||
224 | IWL_DEVICE_7000, | ||
225 | .ht_params = &iwl7000_ht_params, | ||
226 | .nvm_ver = IWL3165_NVM_VERSION, | ||
227 | .nvm_calib_ver = IWL3165_TX_POWER_VERSION, | ||
228 | .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, | ||
229 | }; | ||
230 | |||
216 | const struct iwl_cfg iwl7265_2ac_cfg = { | 231 | const struct iwl_cfg iwl7265_2ac_cfg = { |
217 | .name = "Intel(R) Dual Band Wireless AC 7265", | 232 | .name = "Intel(R) Dual Band Wireless AC 7265", |
218 | .fw_name_pre = IWL7265_FW_PRE, | 233 | .fw_name_pre = IWL7265_FW_PRE, |
@@ -245,4 +260,5 @@ const struct iwl_cfg iwl7265_n_cfg = { | |||
245 | 260 | ||
246 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 261 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
247 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | 262 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); |
263 | MODULE_FIRMWARE(IWL3165_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | ||
248 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 264 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c index 44b19e015102..e93c6972290b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-8000.c +++ b/drivers/net/wireless/iwlwifi/iwl-8000.c | |||
@@ -67,7 +67,7 @@ | |||
67 | #include "iwl-agn-hw.h" | 67 | #include "iwl-agn-hw.h" |
68 | 68 | ||
69 | /* Highest firmware API version supported */ | 69 | /* Highest firmware API version supported */ |
70 | #define IWL8000_UCODE_API_MAX 9 | 70 | #define IWL8000_UCODE_API_MAX 10 |
71 | 71 | ||
72 | /* Oldest version we won't warn about */ | 72 | /* Oldest version we won't warn about */ |
73 | #define IWL8000_UCODE_API_OK 8 | 73 | #define IWL8000_UCODE_API_OK 8 |
diff --git a/drivers/net/wireless/iwlwifi/iwl-config.h b/drivers/net/wireless/iwlwifi/iwl-config.h index 8da596db9abe..3d7cc37420ae 100644 --- a/drivers/net/wireless/iwlwifi/iwl-config.h +++ b/drivers/net/wireless/iwlwifi/iwl-config.h | |||
@@ -120,6 +120,8 @@ enum iwl_led_mode { | |||
120 | #define IWL_LONG_WD_TIMEOUT 10000 | 120 | #define IWL_LONG_WD_TIMEOUT 10000 |
121 | #define IWL_MAX_WD_TIMEOUT 120000 | 121 | #define IWL_MAX_WD_TIMEOUT 120000 |
122 | 122 | ||
123 | #define IWL_DEFAULT_MAX_TX_POWER 22 | ||
124 | |||
123 | /* Antenna presence definitions */ | 125 | /* Antenna presence definitions */ |
124 | #define ANT_NONE 0x0 | 126 | #define ANT_NONE 0x0 |
125 | #define ANT_A BIT(0) | 127 | #define ANT_A BIT(0) |
@@ -335,6 +337,7 @@ extern const struct iwl_cfg iwl7260_n_cfg; | |||
335 | extern const struct iwl_cfg iwl3160_2ac_cfg; | 337 | extern const struct iwl_cfg iwl3160_2ac_cfg; |
336 | extern const struct iwl_cfg iwl3160_2n_cfg; | 338 | extern const struct iwl_cfg iwl3160_2n_cfg; |
337 | extern const struct iwl_cfg iwl3160_n_cfg; | 339 | extern const struct iwl_cfg iwl3160_n_cfg; |
340 | extern const struct iwl_cfg iwl3165_2ac_cfg; | ||
338 | extern const struct iwl_cfg iwl7265_2ac_cfg; | 341 | extern const struct iwl_cfg iwl7265_2ac_cfg; |
339 | extern const struct iwl_cfg iwl7265_2n_cfg; | 342 | extern const struct iwl_cfg iwl7265_2n_cfg; |
340 | extern const struct iwl_cfg iwl7265_n_cfg; | 343 | extern const struct iwl_cfg iwl7265_n_cfg; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c index 018af2957d3b..354255f08754 100644 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | |||
@@ -146,8 +146,6 @@ static const u8 iwl_nvm_channels_family_8000[] = { | |||
146 | #define LAST_2GHZ_HT_PLUS 9 | 146 | #define LAST_2GHZ_HT_PLUS 9 |
147 | #define LAST_5GHZ_HT 161 | 147 | #define LAST_5GHZ_HT 161 |
148 | 148 | ||
149 | #define DEFAULT_MAX_TX_POWER 16 | ||
150 | |||
151 | /* rate data (static) */ | 149 | /* rate data (static) */ |
152 | static struct ieee80211_rate iwl_cfg80211_rates[] = { | 150 | static struct ieee80211_rate iwl_cfg80211_rates[] = { |
153 | { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, | 151 | { .bitrate = 1 * 10, .hw_value = 0, .hw_value_short = 0, }, |
@@ -295,7 +293,7 @@ static int iwl_init_channel_map(struct device *dev, const struct iwl_cfg *cfg, | |||
295 | * Default value - highest tx power value. max_power | 293 | * Default value - highest tx power value. max_power |
296 | * is not used in mvm, and is used for backwards compatibility | 294 | * is not used in mvm, and is used for backwards compatibility |
297 | */ | 295 | */ |
298 | channel->max_power = DEFAULT_MAX_TX_POWER; | 296 | channel->max_power = IWL_DEFAULT_MAX_TX_POWER; |
299 | is_5ghz = channel->band == IEEE80211_BAND_5GHZ; | 297 | is_5ghz = channel->band == IEEE80211_BAND_5GHZ; |
300 | IWL_DEBUG_EEPROM(dev, | 298 | IWL_DEBUG_EEPROM(dev, |
301 | "Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", | 299 | "Ch. %d [%sGHz] %s%s%s%s%s%s%s(0x%02x %ddBm): Ad-Hoc %ssupported\n", |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 2291bbcaaeab..ce71625f497f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
@@ -585,8 +585,6 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
585 | lockdep_assert_held(&mvm->mutex); | 585 | lockdep_assert_held(&mvm->mutex); |
586 | 586 | ||
587 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { | 587 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { |
588 | u32 mode; | ||
589 | |||
590 | switch (mvm->bt_force_ant_mode) { | 588 | switch (mvm->bt_force_ant_mode) { |
591 | case BT_FORCE_ANT_BT: | 589 | case BT_FORCE_ANT_BT: |
592 | mode = BT_COEX_BT; | 590 | mode = BT_COEX_BT; |
@@ -756,7 +754,8 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
756 | struct iwl_bt_iterator_data *data = _data; | 754 | struct iwl_bt_iterator_data *data = _data; |
757 | struct iwl_mvm *mvm = data->mvm; | 755 | struct iwl_mvm *mvm = data->mvm; |
758 | struct ieee80211_chanctx_conf *chanctx_conf; | 756 | struct ieee80211_chanctx_conf *chanctx_conf; |
759 | enum ieee80211_smps_mode smps_mode; | 757 | /* default smps_mode is AUTOMATIC - only used for client modes */ |
758 | enum ieee80211_smps_mode smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
760 | u32 bt_activity_grading; | 759 | u32 bt_activity_grading; |
761 | int ave_rssi; | 760 | int ave_rssi; |
762 | 761 | ||
@@ -764,8 +763,6 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
764 | 763 | ||
765 | switch (vif->type) { | 764 | switch (vif->type) { |
766 | case NL80211_IFTYPE_STATION: | 765 | case NL80211_IFTYPE_STATION: |
767 | /* default smps_mode for BSS / P2P client is AUTOMATIC */ | ||
768 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | ||
769 | break; | 766 | break; |
770 | case NL80211_IFTYPE_AP: | 767 | case NL80211_IFTYPE_AP: |
771 | if (!mvmvif->ap_ibss_active) | 768 | if (!mvmvif->ap_ibss_active) |
@@ -797,7 +794,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac, | |||
797 | else if (bt_activity_grading >= BT_LOW_TRAFFIC) | 794 | else if (bt_activity_grading >= BT_LOW_TRAFFIC) |
798 | smps_mode = IEEE80211_SMPS_DYNAMIC; | 795 | smps_mode = IEEE80211_SMPS_DYNAMIC; |
799 | 796 | ||
800 | /* relax SMPS contraints for next association */ | 797 | /* relax SMPS constraints for next association */ |
801 | if (!vif->bss_conf.assoc) | 798 | if (!vif->bss_conf.assoc) |
802 | smps_mode = IEEE80211_SMPS_AUTOMATIC; | 799 | smps_mode = IEEE80211_SMPS_AUTOMATIC; |
803 | 800 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c index 2e90ff795c13..87e517bffedc 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c | |||
@@ -74,8 +74,7 @@ static void iwl_dbgfs_update_pm(struct iwl_mvm *mvm, | |||
74 | 74 | ||
75 | switch (param) { | 75 | switch (param) { |
76 | case MVM_DEBUGFS_PM_KEEP_ALIVE: { | 76 | case MVM_DEBUGFS_PM_KEEP_ALIVE: { |
77 | struct ieee80211_hw *hw = mvm->hw; | 77 | int dtimper = vif->bss_conf.dtim_period ?: 1; |
78 | int dtimper = hw->conf.ps_dtim_period ?: 1; | ||
79 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; | 78 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; |
80 | 79 | ||
81 | IWL_DEBUG_POWER(mvm, "debugfs: set keep_alive= %d sec\n", val); | 80 | IWL_DEBUG_POWER(mvm, "debugfs: set keep_alive= %d sec\n", val); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 95f5b3274efb..9a922f3bd16b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -1563,14 +1563,14 @@ enum iwl_sf_scenario { | |||
1563 | 1563 | ||
1564 | /** | 1564 | /** |
1565 | * Smart Fifo configuration command. | 1565 | * Smart Fifo configuration command. |
1566 | * @state: smart fifo state, types listed in iwl_sf_sate. | 1566 | * @state: smart fifo state, types listed in enum %iwl_sf_sate. |
1567 | * @watermark: Minimum allowed availabe free space in RXF for transient state. | 1567 | * @watermark: Minimum allowed availabe free space in RXF for transient state. |
1568 | * @long_delay_timeouts: aging and idle timer values for each scenario | 1568 | * @long_delay_timeouts: aging and idle timer values for each scenario |
1569 | * in long delay state. | 1569 | * in long delay state. |
1570 | * @full_on_timeouts: timer values for each scenario in full on state. | 1570 | * @full_on_timeouts: timer values for each scenario in full on state. |
1571 | */ | 1571 | */ |
1572 | struct iwl_sf_cfg_cmd { | 1572 | struct iwl_sf_cfg_cmd { |
1573 | enum iwl_sf_state state; | 1573 | __le32 state; |
1574 | __le32 watermark[SF_TRANSIENT_STATES_NUMBER]; | 1574 | __le32 watermark[SF_TRANSIENT_STATES_NUMBER]; |
1575 | __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; | 1575 | __le32 long_delay_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; |
1576 | __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; | 1576 | __le32 full_on_timeouts[SF_NUM_SCENARIO][SF_NUM_TIMEOUT_TYPES]; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c index 0e523e28cabf..8242e689ddb1 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac-ctxt.c | |||
@@ -721,11 +721,6 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, | |||
721 | !force_assoc_off) { | 721 | !force_assoc_off) { |
722 | u32 dtim_offs; | 722 | u32 dtim_offs; |
723 | 723 | ||
724 | /* Allow beacons to pass through as long as we are not | ||
725 | * associated, or we do not have dtim period information. | ||
726 | */ | ||
727 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
728 | |||
729 | /* | 724 | /* |
730 | * The DTIM count counts down, so when it is N that means N | 725 | * The DTIM count counts down, so when it is N that means N |
731 | * more beacon intervals happen until the DTIM TBTT. Therefore | 726 | * more beacon intervals happen until the DTIM TBTT. Therefore |
@@ -759,6 +754,11 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm, | |||
759 | ctxt_sta->is_assoc = cpu_to_le32(1); | 754 | ctxt_sta->is_assoc = cpu_to_le32(1); |
760 | } else { | 755 | } else { |
761 | ctxt_sta->is_assoc = cpu_to_le32(0); | 756 | ctxt_sta->is_assoc = cpu_to_le32(0); |
757 | |||
758 | /* Allow beacons to pass through as long as we are not | ||
759 | * associated, or we do not have dtim period information. | ||
760 | */ | ||
761 | cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON); | ||
762 | } | 762 | } |
763 | 763 | ||
764 | ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); | 764 | ctxt_sta->bi = cpu_to_le32(vif->bss_conf.beacon_int); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 7c8796584c25..cdc272d776e7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -396,12 +396,14 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
396 | else | 396 | else |
397 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 397 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
398 | 398 | ||
399 | /* TODO: enable that only for firmwares that don't crash */ | 399 | if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 10) { |
400 | /* hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; */ | 400 | hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
401 | hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; | 401 | hw->wiphy->max_sched_scan_ssids = PROBE_OPTION_MAX; |
402 | hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; | 402 | hw->wiphy->max_match_sets = IWL_SCAN_MAX_PROFILES; |
403 | /* we create the 802.11 header and zero length SSID IE. */ | 403 | /* we create the 802.11 header and zero length SSID IE. */ |
404 | hw->wiphy->max_sched_scan_ie_len = SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; | 404 | hw->wiphy->max_sched_scan_ie_len = |
405 | SCAN_OFFLOAD_PROBE_REQ_SIZE - 24 - 2; | ||
406 | } | ||
405 | 407 | ||
406 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | | 408 | hw->wiphy->features |= NL80211_FEATURE_P2P_GO_CTWIN | |
407 | NL80211_FEATURE_LOW_PRIORITY_SCAN | | 409 | NL80211_FEATURE_LOW_PRIORITY_SCAN | |
@@ -1524,11 +1526,6 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1524 | */ | 1526 | */ |
1525 | iwl_mvm_remove_time_event(mvm, mvmvif, | 1527 | iwl_mvm_remove_time_event(mvm, mvmvif, |
1526 | &mvmvif->time_event_data); | 1528 | &mvmvif->time_event_data); |
1527 | } else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | | ||
1528 | BSS_CHANGED_QOS)) { | ||
1529 | ret = iwl_mvm_power_update_mac(mvm); | ||
1530 | if (ret) | ||
1531 | IWL_ERR(mvm, "failed to update power mode\n"); | ||
1532 | } | 1529 | } |
1533 | 1530 | ||
1534 | if (changes & BSS_CHANGED_BEACON_INFO) { | 1531 | if (changes & BSS_CHANGED_BEACON_INFO) { |
@@ -1536,6 +1533,12 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, | |||
1536 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); | 1533 | WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0)); |
1537 | } | 1534 | } |
1538 | 1535 | ||
1536 | if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS | BSS_CHANGED_QOS)) { | ||
1537 | ret = iwl_mvm_power_update_mac(mvm); | ||
1538 | if (ret) | ||
1539 | IWL_ERR(mvm, "failed to update power mode\n"); | ||
1540 | } | ||
1541 | |||
1539 | if (changes & BSS_CHANGED_TXPOWER) { | 1542 | if (changes & BSS_CHANGED_TXPOWER) { |
1540 | IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", | 1543 | IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", |
1541 | bss_conf->txpower); | 1544 | bss_conf->txpower); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c index 2b2d10800a55..d9769a23c68b 100644 --- a/drivers/net/wireless/iwlwifi/mvm/power.c +++ b/drivers/net/wireless/iwlwifi/mvm/power.c | |||
@@ -281,7 +281,6 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
281 | struct ieee80211_vif *vif, | 281 | struct ieee80211_vif *vif, |
282 | struct iwl_mac_power_cmd *cmd) | 282 | struct iwl_mac_power_cmd *cmd) |
283 | { | 283 | { |
284 | struct ieee80211_hw *hw = mvm->hw; | ||
285 | struct ieee80211_chanctx_conf *chanctx_conf; | 284 | struct ieee80211_chanctx_conf *chanctx_conf; |
286 | struct ieee80211_channel *chan; | 285 | struct ieee80211_channel *chan; |
287 | int dtimper, dtimper_msec; | 286 | int dtimper, dtimper_msec; |
@@ -292,7 +291,7 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm, | |||
292 | 291 | ||
293 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, | 292 | cmd->id_and_color = cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, |
294 | mvmvif->color)); | 293 | mvmvif->color)); |
295 | dtimper = hw->conf.ps_dtim_period ?: 1; | 294 | dtimper = vif->bss_conf.dtim_period; |
296 | 295 | ||
297 | /* | 296 | /* |
298 | * Regardless of power management state the driver must set | 297 | * Regardless of power management state the driver must set |
@@ -885,7 +884,7 @@ int iwl_mvm_update_d0i3_power_mode(struct iwl_mvm *mvm, | |||
885 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); | 884 | iwl_mvm_power_build_cmd(mvm, vif, &cmd); |
886 | if (enable) { | 885 | if (enable) { |
887 | /* configure skip over dtim up to 300 msec */ | 886 | /* configure skip over dtim up to 300 msec */ |
888 | int dtimper = mvm->hw->conf.ps_dtim_period ?: 1; | 887 | int dtimper = vif->bss_conf.dtim_period ?: 1; |
889 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; | 888 | int dtimper_msec = dtimper * vif->bss_conf.beacon_int; |
890 | 889 | ||
891 | if (WARN_ON(!dtimper_msec)) | 890 | if (WARN_ON(!dtimper_msec)) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c index 4b98987fc413..bf5cd8c8b0f7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rx.c +++ b/drivers/net/wireless/iwlwifi/mvm/rx.c | |||
@@ -149,13 +149,13 @@ static void iwl_mvm_get_signal_strength(struct iwl_mvm *mvm, | |||
149 | le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_ENERGY_ANT_ABC_IDX]); | 149 | le32_to_cpu(phy_info->non_cfg_phy[IWL_RX_INFO_ENERGY_ANT_ABC_IDX]); |
150 | energy_a = (val & IWL_RX_INFO_ENERGY_ANT_A_MSK) >> | 150 | energy_a = (val & IWL_RX_INFO_ENERGY_ANT_A_MSK) >> |
151 | IWL_RX_INFO_ENERGY_ANT_A_POS; | 151 | IWL_RX_INFO_ENERGY_ANT_A_POS; |
152 | energy_a = energy_a ? -energy_a : -256; | 152 | energy_a = energy_a ? -energy_a : S8_MIN; |
153 | energy_b = (val & IWL_RX_INFO_ENERGY_ANT_B_MSK) >> | 153 | energy_b = (val & IWL_RX_INFO_ENERGY_ANT_B_MSK) >> |
154 | IWL_RX_INFO_ENERGY_ANT_B_POS; | 154 | IWL_RX_INFO_ENERGY_ANT_B_POS; |
155 | energy_b = energy_b ? -energy_b : -256; | 155 | energy_b = energy_b ? -energy_b : S8_MIN; |
156 | energy_c = (val & IWL_RX_INFO_ENERGY_ANT_C_MSK) >> | 156 | energy_c = (val & IWL_RX_INFO_ENERGY_ANT_C_MSK) >> |
157 | IWL_RX_INFO_ENERGY_ANT_C_POS; | 157 | IWL_RX_INFO_ENERGY_ANT_C_POS; |
158 | energy_c = energy_c ? -energy_c : -256; | 158 | energy_c = energy_c ? -energy_c : S8_MIN; |
159 | max_energy = max(energy_a, energy_b); | 159 | max_energy = max(energy_a, energy_b); |
160 | max_energy = max(max_energy, energy_c); | 160 | max_energy = max(max_energy, energy_c); |
161 | 161 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/sf.c b/drivers/net/wireless/iwlwifi/mvm/sf.c index 7edfd15efc9d..e843b67f2201 100644 --- a/drivers/net/wireless/iwlwifi/mvm/sf.c +++ b/drivers/net/wireless/iwlwifi/mvm/sf.c | |||
@@ -172,7 +172,7 @@ static int iwl_mvm_sf_config(struct iwl_mvm *mvm, u8 sta_id, | |||
172 | enum iwl_sf_state new_state) | 172 | enum iwl_sf_state new_state) |
173 | { | 173 | { |
174 | struct iwl_sf_cfg_cmd sf_cmd = { | 174 | struct iwl_sf_cfg_cmd sf_cmd = { |
175 | .state = new_state, | 175 | .state = cpu_to_le32(new_state), |
176 | }; | 176 | }; |
177 | struct ieee80211_sta *sta; | 177 | struct ieee80211_sta *sta; |
178 | int ret = 0; | 178 | int ret = 0; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index dbc870713882..9ee410bf6da2 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -168,10 +168,14 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, | |||
168 | 168 | ||
169 | /* | 169 | /* |
170 | * for data packets, rate info comes from the table inside the fw. This | 170 | * for data packets, rate info comes from the table inside the fw. This |
171 | * table is controlled by LINK_QUALITY commands | 171 | * table is controlled by LINK_QUALITY commands. Exclude ctrl port |
172 | * frames like EAPOLs which should be treated as mgmt frames. This | ||
173 | * avoids them being sent initially in high rates which increases the | ||
174 | * chances for completion of the 4-Way handshake. | ||
172 | */ | 175 | */ |
173 | 176 | ||
174 | if (ieee80211_is_data(fc) && sta) { | 177 | if (ieee80211_is_data(fc) && sta && |
178 | !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) { | ||
175 | tx_cmd->initial_rate_index = 0; | 179 | tx_cmd->initial_rate_index = 0; |
176 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); | 180 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); |
177 | return; | 181 | return; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/drv.c b/drivers/net/wireless/iwlwifi/pcie/drv.c index f0e722ced080..073a68b97a72 100644 --- a/drivers/net/wireless/iwlwifi/pcie/drv.c +++ b/drivers/net/wireless/iwlwifi/pcie/drv.c | |||
@@ -352,11 +352,17 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
352 | {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, | 352 | {IWL_PCI_DEVICE(0x08B3, 0x8060, iwl3160_2n_cfg)}, |
353 | {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, | 353 | {IWL_PCI_DEVICE(0x08B3, 0x8062, iwl3160_n_cfg)}, |
354 | {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, | 354 | {IWL_PCI_DEVICE(0x08B4, 0x8270, iwl3160_2ac_cfg)}, |
355 | {IWL_PCI_DEVICE(0x08B4, 0x8370, iwl3160_2ac_cfg)}, | ||
356 | {IWL_PCI_DEVICE(0x08B4, 0x8272, iwl3160_2ac_cfg)}, | ||
355 | {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, | 357 | {IWL_PCI_DEVICE(0x08B3, 0x8470, iwl3160_2ac_cfg)}, |
356 | {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, | 358 | {IWL_PCI_DEVICE(0x08B3, 0x8570, iwl3160_2ac_cfg)}, |
357 | {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, | 359 | {IWL_PCI_DEVICE(0x08B3, 0x1070, iwl3160_2ac_cfg)}, |
358 | {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, | 360 | {IWL_PCI_DEVICE(0x08B3, 0x1170, iwl3160_2ac_cfg)}, |
359 | 361 | ||
362 | /* 3165 Series */ | ||
363 | {IWL_PCI_DEVICE(0x3165, 0x4010, iwl3165_2ac_cfg)}, | ||
364 | {IWL_PCI_DEVICE(0x3165, 0x4210, iwl3165_2ac_cfg)}, | ||
365 | |||
360 | /* 7265 Series */ | 366 | /* 7265 Series */ |
361 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, | 367 | {IWL_PCI_DEVICE(0x095A, 0x5010, iwl7265_2ac_cfg)}, |
362 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, | 368 | {IWL_PCI_DEVICE(0x095A, 0x5110, iwl7265_2ac_cfg)}, |
@@ -378,6 +384,7 @@ static const struct pci_device_id iwl_hw_card_ids[] = { | |||
378 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, | 384 | {IWL_PCI_DEVICE(0x095B, 0x5202, iwl7265_n_cfg)}, |
379 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, | 385 | {IWL_PCI_DEVICE(0x095A, 0x9010, iwl7265_2ac_cfg)}, |
380 | {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, | 386 | {IWL_PCI_DEVICE(0x095A, 0x9012, iwl7265_2ac_cfg)}, |
387 | {IWL_PCI_DEVICE(0x095A, 0x900A, iwl7265_2ac_cfg)}, | ||
381 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, | 388 | {IWL_PCI_DEVICE(0x095A, 0x9110, iwl7265_2ac_cfg)}, |
382 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, | 389 | {IWL_PCI_DEVICE(0x095A, 0x9112, iwl7265_2ac_cfg)}, |
383 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, | 390 | {IWL_PCI_DEVICE(0x095A, 0x9210, iwl7265_2ac_cfg)}, |
diff --git a/drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.c b/drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.c index 33da3dfcfa4f..d4bd550f505c 100644 --- a/drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.c +++ b/drivers/net/wireless/rtlwifi/btcoexist/halbtcoutsrc.c | |||
@@ -101,7 +101,7 @@ static bool halbtc_legacy(struct rtl_priv *adapter) | |||
101 | 101 | ||
102 | bool is_legacy = false; | 102 | bool is_legacy = false; |
103 | 103 | ||
104 | if ((mac->mode == WIRELESS_MODE_B) || (mac->mode == WIRELESS_MODE_B)) | 104 | if ((mac->mode == WIRELESS_MODE_B) || (mac->mode == WIRELESS_MODE_G)) |
105 | is_legacy = true; | 105 | is_legacy = true; |
106 | 106 | ||
107 | return is_legacy; | 107 | return is_legacy; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index 361435f8608a..1ac6383e7947 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
@@ -317,6 +317,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { | |||
317 | {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ | 317 | {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ |
318 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | 318 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
319 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | 319 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
320 | {RTL_USB_DEVICE(0x0df6, 0x0070, rtl92cu_hal_cfg)}, /*Sitecom - 150N */ | ||
320 | {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ | 321 | {RTL_USB_DEVICE(0x0df6, 0x0077, rtl92cu_hal_cfg)}, /*Sitecom-WLA2100V2*/ |
321 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ | 322 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ |
322 | {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ | 323 | {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index e29e15dca86e..f379689dde30 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -576,6 +576,9 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, | |||
576 | init_waitqueue_head(&queue->dealloc_wq); | 576 | init_waitqueue_head(&queue->dealloc_wq); |
577 | atomic_set(&queue->inflight_packets, 0); | 577 | atomic_set(&queue->inflight_packets, 0); |
578 | 578 | ||
579 | netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, | ||
580 | XENVIF_NAPI_WEIGHT); | ||
581 | |||
579 | if (tx_evtchn == rx_evtchn) { | 582 | if (tx_evtchn == rx_evtchn) { |
580 | /* feature-split-event-channels == 0 */ | 583 | /* feature-split-event-channels == 0 */ |
581 | err = bind_interdomain_evtchn_to_irqhandler( | 584 | err = bind_interdomain_evtchn_to_irqhandler( |
@@ -629,9 +632,6 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, | |||
629 | wake_up_process(queue->task); | 632 | wake_up_process(queue->task); |
630 | wake_up_process(queue->dealloc_task); | 633 | wake_up_process(queue->dealloc_task); |
631 | 634 | ||
632 | netif_napi_add(queue->vif->dev, &queue->napi, xenvif_poll, | ||
633 | XENVIF_NAPI_WEIGHT); | ||
634 | |||
635 | return 0; | 635 | return 0; |
636 | 636 | ||
637 | err_rx_unbind: | 637 | err_rx_unbind: |
diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c index f868333271aa..963a4a5dc88e 100644 --- a/drivers/nfc/microread/microread.c +++ b/drivers/nfc/microread/microread.c | |||
@@ -501,9 +501,13 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, | |||
501 | targets->sens_res = | 501 | targets->sens_res = |
502 | be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA]); | 502 | be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA]); |
503 | targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK]; | 503 | targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK]; |
504 | memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A_UID], | ||
505 | skb->data[MICROREAD_EMCF_A_LEN]); | ||
506 | targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN]; | 504 | targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN]; |
505 | if (targets->nfcid1_len > sizeof(targets->nfcid1)) { | ||
506 | r = -EINVAL; | ||
507 | goto exit_free; | ||
508 | } | ||
509 | memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A_UID], | ||
510 | targets->nfcid1_len); | ||
507 | break; | 511 | break; |
508 | case MICROREAD_GATE_ID_MREAD_ISO_A_3: | 512 | case MICROREAD_GATE_ID_MREAD_ISO_A_3: |
509 | targets->supported_protocols = | 513 | targets->supported_protocols = |
@@ -511,9 +515,13 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate, | |||
511 | targets->sens_res = | 515 | targets->sens_res = |
512 | be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]); | 516 | be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]); |
513 | targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK]; | 517 | targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK]; |
514 | memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A3_UID], | ||
515 | skb->data[MICROREAD_EMCF_A3_LEN]); | ||
516 | targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN]; | 518 | targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN]; |
519 | if (targets->nfcid1_len > sizeof(targets->nfcid1)) { | ||
520 | r = -EINVAL; | ||
521 | goto exit_free; | ||
522 | } | ||
523 | memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_A3_UID], | ||
524 | targets->nfcid1_len); | ||
517 | break; | 525 | break; |
518 | case MICROREAD_GATE_ID_MREAD_ISO_B: | 526 | case MICROREAD_GATE_ID_MREAD_ISO_B: |
519 | targets->supported_protocols = NFC_PROTO_ISO14443_B_MASK; | 527 | targets->supported_protocols = NFC_PROTO_ISO14443_B_MASK; |
diff --git a/drivers/nfc/st21nfca/Makefile b/drivers/nfc/st21nfca/Makefile index db7a38ae05f7..7d688f97aa27 100644 --- a/drivers/nfc/st21nfca/Makefile +++ b/drivers/nfc/st21nfca/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Makefile for ST21NFCA HCI based NFC driver | 2 | # Makefile for ST21NFCA HCI based NFC driver |
3 | # | 3 | # |
4 | 4 | ||
5 | st21nfca_i2c-objs = i2c.o | 5 | st21nfca_hci-objs = st21nfca.o st21nfca_dep.o |
6 | obj-$(CONFIG_NFC_ST21NFCA) += st21nfca_hci.o | ||
6 | 7 | ||
7 | obj-$(CONFIG_NFC_ST21NFCA) += st21nfca.o st21nfca_dep.o | 8 | st21nfca_i2c-objs = i2c.o |
8 | obj-$(CONFIG_NFC_ST21NFCA_I2C) += st21nfca_i2c.o | 9 | obj-$(CONFIG_NFC_ST21NFCA_I2C) += st21nfca_i2c.o |
diff --git a/drivers/nfc/st21nfcb/Makefile b/drivers/nfc/st21nfcb/Makefile index 13d9f03b2fea..f4d835dd15f2 100644 --- a/drivers/nfc/st21nfcb/Makefile +++ b/drivers/nfc/st21nfcb/Makefile | |||
@@ -2,7 +2,8 @@ | |||
2 | # Makefile for ST21NFCB NCI based NFC driver | 2 | # Makefile for ST21NFCB NCI based NFC driver |
3 | # | 3 | # |
4 | 4 | ||
5 | st21nfcb_i2c-objs = i2c.o | 5 | st21nfcb_nci-objs = ndlc.o st21nfcb.o |
6 | obj-$(CONFIG_NFC_ST21NFCB) += st21nfcb_nci.o | ||
6 | 7 | ||
7 | obj-$(CONFIG_NFC_ST21NFCB) += st21nfcb.o ndlc.o | 8 | st21nfcb_i2c-objs = i2c.o |
8 | obj-$(CONFIG_NFC_ST21NFCB_I2C) += st21nfcb_i2c.o | 9 | obj-$(CONFIG_NFC_ST21NFCB_I2C) += st21nfcb_i2c.o |
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c index 9dd63b822025..e9bf2f47b61a 100644 --- a/drivers/ntb/ntb_transport.c +++ b/drivers/ntb/ntb_transport.c | |||
@@ -510,7 +510,7 @@ static void ntb_transport_setup_qp_mw(struct ntb_transport *nt, | |||
510 | 510 | ||
511 | WARN_ON(nt->mw[mw_num].virt_addr == NULL); | 511 | WARN_ON(nt->mw[mw_num].virt_addr == NULL); |
512 | 512 | ||
513 | if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max) | 513 | if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max) |
514 | num_qps_mw = nt->max_qps / mw_max + 1; | 514 | num_qps_mw = nt->max_qps / mw_max + 1; |
515 | else | 515 | else |
516 | num_qps_mw = nt->max_qps / mw_max; | 516 | num_qps_mw = nt->max_qps / mw_max; |
@@ -576,6 +576,19 @@ static int ntb_set_mw(struct ntb_transport *nt, int num_mw, unsigned int size) | |||
576 | return -ENOMEM; | 576 | return -ENOMEM; |
577 | } | 577 | } |
578 | 578 | ||
579 | /* | ||
580 | * we must ensure that the memory address allocated is BAR size | ||
581 | * aligned in order for the XLAT register to take the value. This | ||
582 | * is a requirement of the hardware. It is recommended to setup CMA | ||
583 | * for BAR sizes equal or greater than 4MB. | ||
584 | */ | ||
585 | if (!IS_ALIGNED(mw->dma_addr, mw->size)) { | ||
586 | dev_err(&pdev->dev, "DMA memory %pad not aligned to BAR size\n", | ||
587 | &mw->dma_addr); | ||
588 | ntb_free_mw(nt, num_mw); | ||
589 | return -ENOMEM; | ||
590 | } | ||
591 | |||
579 | /* Notify HW the memory location of the receive buffer */ | 592 | /* Notify HW the memory location of the receive buffer */ |
580 | ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr); | 593 | ntb_set_mw_addr(nt->ndev, num_mw, mw->dma_addr); |
581 | 594 | ||
@@ -856,7 +869,7 @@ static int ntb_transport_init_queue(struct ntb_transport *nt, | |||
856 | qp->client_ready = NTB_LINK_DOWN; | 869 | qp->client_ready = NTB_LINK_DOWN; |
857 | qp->event_handler = NULL; | 870 | qp->event_handler = NULL; |
858 | 871 | ||
859 | if (nt->max_qps % mw_max && mw_num < nt->max_qps % mw_max) | 872 | if (nt->max_qps % mw_max && mw_num + 1 < nt->max_qps / mw_max) |
860 | num_qps_mw = nt->max_qps / mw_max + 1; | 873 | num_qps_mw = nt->max_qps / mw_max + 1; |
861 | else | 874 | else |
862 | num_qps_mw = nt->max_qps / mw_max; | 875 | num_qps_mw = nt->max_qps / mw_max; |
diff --git a/drivers/of/base.c b/drivers/of/base.c index d8574adf0d62..293ed4b687ba 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -138,6 +138,9 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp) | |||
138 | /* Important: Don't leak passwords */ | 138 | /* Important: Don't leak passwords */ |
139 | bool secure = strncmp(pp->name, "security-", 9) == 0; | 139 | bool secure = strncmp(pp->name, "security-", 9) == 0; |
140 | 140 | ||
141 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
142 | return 0; | ||
143 | |||
141 | if (!of_kset || !of_node_is_attached(np)) | 144 | if (!of_kset || !of_node_is_attached(np)) |
142 | return 0; | 145 | return 0; |
143 | 146 | ||
@@ -158,6 +161,9 @@ int __of_attach_node_sysfs(struct device_node *np) | |||
158 | struct property *pp; | 161 | struct property *pp; |
159 | int rc; | 162 | int rc; |
160 | 163 | ||
164 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
165 | return 0; | ||
166 | |||
161 | if (!of_kset) | 167 | if (!of_kset) |
162 | return 0; | 168 | return 0; |
163 | 169 | ||
@@ -1713,6 +1719,9 @@ int __of_remove_property(struct device_node *np, struct property *prop) | |||
1713 | 1719 | ||
1714 | void __of_remove_property_sysfs(struct device_node *np, struct property *prop) | 1720 | void __of_remove_property_sysfs(struct device_node *np, struct property *prop) |
1715 | { | 1721 | { |
1722 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
1723 | return; | ||
1724 | |||
1716 | /* at early boot, bail here and defer setup to of_init() */ | 1725 | /* at early boot, bail here and defer setup to of_init() */ |
1717 | if (of_kset && of_node_is_attached(np)) | 1726 | if (of_kset && of_node_is_attached(np)) |
1718 | sysfs_remove_bin_file(&np->kobj, &prop->attr); | 1727 | sysfs_remove_bin_file(&np->kobj, &prop->attr); |
@@ -1777,6 +1786,9 @@ int __of_update_property(struct device_node *np, struct property *newprop, | |||
1777 | void __of_update_property_sysfs(struct device_node *np, struct property *newprop, | 1786 | void __of_update_property_sysfs(struct device_node *np, struct property *newprop, |
1778 | struct property *oldprop) | 1787 | struct property *oldprop) |
1779 | { | 1788 | { |
1789 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
1790 | return; | ||
1791 | |||
1780 | /* At early boot, bail out and defer setup to of_init() */ | 1792 | /* At early boot, bail out and defer setup to of_init() */ |
1781 | if (!of_kset) | 1793 | if (!of_kset) |
1782 | return; | 1794 | return; |
@@ -1847,6 +1859,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
1847 | { | 1859 | { |
1848 | struct property *pp; | 1860 | struct property *pp; |
1849 | 1861 | ||
1862 | of_aliases = of_find_node_by_path("/aliases"); | ||
1850 | of_chosen = of_find_node_by_path("/chosen"); | 1863 | of_chosen = of_find_node_by_path("/chosen"); |
1851 | if (of_chosen == NULL) | 1864 | if (of_chosen == NULL) |
1852 | of_chosen = of_find_node_by_path("/chosen@0"); | 1865 | of_chosen = of_find_node_by_path("/chosen@0"); |
@@ -1862,7 +1875,6 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) | |||
1862 | of_stdout = of_find_node_by_path(name); | 1875 | of_stdout = of_find_node_by_path(name); |
1863 | } | 1876 | } |
1864 | 1877 | ||
1865 | of_aliases = of_find_node_by_path("/aliases"); | ||
1866 | if (!of_aliases) | 1878 | if (!of_aliases) |
1867 | return; | 1879 | return; |
1868 | 1880 | ||
@@ -1986,7 +1998,7 @@ bool of_console_check(struct device_node *dn, char *name, int index) | |||
1986 | { | 1998 | { |
1987 | if (!dn || dn != of_stdout || console_set_on_cmdline) | 1999 | if (!dn || dn != of_stdout || console_set_on_cmdline) |
1988 | return false; | 2000 | return false; |
1989 | return add_preferred_console(name, index, NULL); | 2001 | return !add_preferred_console(name, index, NULL); |
1990 | } | 2002 | } |
1991 | EXPORT_SYMBOL_GPL(of_console_check); | 2003 | EXPORT_SYMBOL_GPL(of_console_check); |
1992 | 2004 | ||
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c index 54fecc49a1fe..f297891d8529 100644 --- a/drivers/of/dynamic.c +++ b/drivers/of/dynamic.c | |||
@@ -45,6 +45,9 @@ void __of_detach_node_sysfs(struct device_node *np) | |||
45 | { | 45 | { |
46 | struct property *pp; | 46 | struct property *pp; |
47 | 47 | ||
48 | if (!IS_ENABLED(CONFIG_SYSFS)) | ||
49 | return; | ||
50 | |||
48 | BUG_ON(!of_node_is_initialized(np)); | 51 | BUG_ON(!of_node_is_initialized(np)); |
49 | if (!of_kset) | 52 | if (!of_kset) |
50 | return; | 53 | return; |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 79cb8313c7d8..d1ffca8b34ea 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -928,7 +928,11 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, | |||
928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | 928 | void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) |
929 | { | 929 | { |
930 | const u64 phys_offset = __pa(PAGE_OFFSET); | 930 | const u64 phys_offset = __pa(PAGE_OFFSET); |
931 | base &= PAGE_MASK; | 931 | |
932 | if (!PAGE_ALIGNED(base)) { | ||
933 | size -= PAGE_SIZE - (base & ~PAGE_MASK); | ||
934 | base = PAGE_ALIGN(base); | ||
935 | } | ||
932 | size &= PAGE_MASK; | 936 | size &= PAGE_MASK; |
933 | 937 | ||
934 | if (base > MAX_PHYS_ADDR) { | 938 | if (base > MAX_PHYS_ADDR) { |
@@ -937,10 +941,10 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) | |||
937 | return; | 941 | return; |
938 | } | 942 | } |
939 | 943 | ||
940 | if (base + size > MAX_PHYS_ADDR) { | 944 | if (base + size - 1 > MAX_PHYS_ADDR) { |
941 | pr_warning("Ignoring memory range 0x%lx - 0x%llx\n", | 945 | pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", |
942 | ULONG_MAX, base + size); | 946 | ((u64)MAX_PHYS_ADDR) + 1, base + size); |
943 | size = MAX_PHYS_ADDR - base; | 947 | size = MAX_PHYS_ADDR - base + 1; |
944 | } | 948 | } |
945 | 949 | ||
946 | if (base + size < phys_offset) { | 950 | if (base + size < phys_offset) { |
diff --git a/drivers/parisc/dino.c b/drivers/parisc/dino.c index 9eae9834bcc7..a0580afe1713 100644 --- a/drivers/parisc/dino.c +++ b/drivers/parisc/dino.c | |||
@@ -913,7 +913,7 @@ static int __init dino_probe(struct parisc_device *dev) | |||
913 | printk("%s version %s found at 0x%lx\n", name, version, hpa); | 913 | printk("%s version %s found at 0x%lx\n", name, version, hpa); |
914 | 914 | ||
915 | if (!request_mem_region(hpa, PAGE_SIZE, name)) { | 915 | if (!request_mem_region(hpa, PAGE_SIZE, name)) { |
916 | printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%ld)!\n", | 916 | printk(KERN_ERR "DINO: Hey! Someone took my MMIO space (0x%lx)!\n", |
917 | hpa); | 917 | hpa); |
918 | return 1; | 918 | return 1; |
919 | } | 919 | } |
diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 0f54ab6260df..3651c3871d5b 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c | |||
@@ -278,7 +278,7 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun | |||
278 | { | 278 | { |
279 | struct hardware_path hwpath; | 279 | struct hardware_path hwpath; |
280 | unsigned short i; | 280 | unsigned short i; |
281 | char in[count+1], *temp; | 281 | char in[64], *temp; |
282 | struct device *dev; | 282 | struct device *dev; |
283 | int ret; | 283 | int ret; |
284 | 284 | ||
@@ -286,8 +286,9 @@ pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t coun | |||
286 | return -EINVAL; | 286 | return -EINVAL; |
287 | 287 | ||
288 | /* We'll use a local copy of buf */ | 288 | /* We'll use a local copy of buf */ |
289 | memset(in, 0, count+1); | 289 | count = min_t(size_t, count, sizeof(in)-1); |
290 | strncpy(in, buf, count); | 290 | strncpy(in, buf, count); |
291 | in[count] = '\0'; | ||
291 | 292 | ||
292 | /* Let's clean up the target. 0xff is a blank pattern */ | 293 | /* Let's clean up the target. 0xff is a blank pattern */ |
293 | memset(&hwpath, 0xff, sizeof(hwpath)); | 294 | memset(&hwpath, 0xff, sizeof(hwpath)); |
@@ -393,14 +394,15 @@ pdcspath_layer_write(struct pdcspath_entry *entry, const char *buf, size_t count | |||
393 | { | 394 | { |
394 | unsigned int layers[6]; /* device-specific info (ctlr#, unit#, ...) */ | 395 | unsigned int layers[6]; /* device-specific info (ctlr#, unit#, ...) */ |
395 | unsigned short i; | 396 | unsigned short i; |
396 | char in[count+1], *temp; | 397 | char in[64], *temp; |
397 | 398 | ||
398 | if (!entry || !buf || !count) | 399 | if (!entry || !buf || !count) |
399 | return -EINVAL; | 400 | return -EINVAL; |
400 | 401 | ||
401 | /* We'll use a local copy of buf */ | 402 | /* We'll use a local copy of buf */ |
402 | memset(in, 0, count+1); | 403 | count = min_t(size_t, count, sizeof(in)-1); |
403 | strncpy(in, buf, count); | 404 | strncpy(in, buf, count); |
405 | in[count] = '\0'; | ||
404 | 406 | ||
405 | /* Let's clean up the target. 0 is a blank pattern */ | 407 | /* Let's clean up the target. 0 is a blank pattern */ |
406 | memset(&layers, 0, sizeof(layers)); | 408 | memset(&layers, 0, sizeof(layers)); |
@@ -755,7 +757,7 @@ static ssize_t pdcs_auto_write(struct kobject *kobj, | |||
755 | { | 757 | { |
756 | struct pdcspath_entry *pathentry; | 758 | struct pdcspath_entry *pathentry; |
757 | unsigned char flags; | 759 | unsigned char flags; |
758 | char in[count+1], *temp; | 760 | char in[8], *temp; |
759 | char c; | 761 | char c; |
760 | 762 | ||
761 | if (!capable(CAP_SYS_ADMIN)) | 763 | if (!capable(CAP_SYS_ADMIN)) |
@@ -765,8 +767,9 @@ static ssize_t pdcs_auto_write(struct kobject *kobj, | |||
765 | return -EINVAL; | 767 | return -EINVAL; |
766 | 768 | ||
767 | /* We'll use a local copy of buf */ | 769 | /* We'll use a local copy of buf */ |
768 | memset(in, 0, count+1); | 770 | count = min_t(size_t, count, sizeof(in)-1); |
769 | strncpy(in, buf, count); | 771 | strncpy(in, buf, count); |
772 | in[count] = '\0'; | ||
770 | 773 | ||
771 | /* Current flags are stored in primary boot path entry */ | 774 | /* Current flags are stored in primary boot path entry */ |
772 | pathentry = &pdcspath_entry_primary; | 775 | pathentry = &pdcspath_entry_primary; |
diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index a042d065a0c7..8be2096c8423 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c | |||
@@ -395,7 +395,8 @@ static void __init superio_serial_init(void) | |||
395 | serial_port.iotype = UPIO_PORT; | 395 | serial_port.iotype = UPIO_PORT; |
396 | serial_port.type = PORT_16550A; | 396 | serial_port.type = PORT_16550A; |
397 | serial_port.uartclk = 115200*16; | 397 | serial_port.uartclk = 115200*16; |
398 | serial_port.fifosize = 16; | 398 | serial_port.flags = UPF_FIXED_PORT | UPF_FIXED_TYPE | |
399 | UPF_BOOT_AUTOCONF; | ||
399 | 400 | ||
400 | /* serial port #1 */ | 401 | /* serial port #1 */ |
401 | serial_port.iobase = sio_dev.sp1_base; | 402 | serial_port.iobase = sio_dev.sp1_base; |
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig index 8922c376456a..90f5ccacce4b 100644 --- a/drivers/pci/host/Kconfig +++ b/drivers/pci/host/Kconfig | |||
@@ -56,7 +56,7 @@ config PCI_HOST_GENERIC | |||
56 | controller, such as the one emulated by kvmtool. | 56 | controller, such as the one emulated by kvmtool. |
57 | 57 | ||
58 | config PCIE_SPEAR13XX | 58 | config PCIE_SPEAR13XX |
59 | tristate "STMicroelectronics SPEAr PCIe controller" | 59 | bool "STMicroelectronics SPEAr PCIe controller" |
60 | depends on ARCH_SPEAR13XX | 60 | depends on ARCH_SPEAR13XX |
61 | select PCIEPORTBUS | 61 | select PCIEPORTBUS |
62 | select PCIE_DW | 62 | select PCIE_DW |
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index a568efaa331c..35fc73a8d0b3 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
@@ -49,6 +49,9 @@ struct imx6_pcie { | |||
49 | 49 | ||
50 | /* PCIe Port Logic registers (memory-mapped) */ | 50 | /* PCIe Port Logic registers (memory-mapped) */ |
51 | #define PL_OFFSET 0x700 | 51 | #define PL_OFFSET 0x700 |
52 | #define PCIE_PL_PFLR (PL_OFFSET + 0x08) | ||
53 | #define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16) | ||
54 | #define PCIE_PL_PFLR_FORCE_LINK (1 << 15) | ||
52 | #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) | 55 | #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) |
53 | #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) | 56 | #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) |
54 | #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) | 57 | #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) |
@@ -214,6 +217,32 @@ static int imx6q_pcie_abort_handler(unsigned long addr, | |||
214 | static int imx6_pcie_assert_core_reset(struct pcie_port *pp) | 217 | static int imx6_pcie_assert_core_reset(struct pcie_port *pp) |
215 | { | 218 | { |
216 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); | 219 | struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); |
220 | u32 val, gpr1, gpr12; | ||
221 | |||
222 | /* | ||
223 | * If the bootloader already enabled the link we need some special | ||
224 | * handling to get the core back into a state where it is safe to | ||
225 | * touch it for configuration. As there is no dedicated reset signal | ||
226 | * wired up for MX6QDL, we need to manually force LTSSM into "detect" | ||
227 | * state before completely disabling LTSSM, which is a prerequisite | ||
228 | * for core configuration. | ||
229 | * | ||
230 | * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong | ||
231 | * indication that the bootloader activated the link. | ||
232 | */ | ||
233 | regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, &gpr1); | ||
234 | regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, &gpr12); | ||
235 | |||
236 | if ((gpr1 & IMX6Q_GPR1_PCIE_REF_CLK_EN) && | ||
237 | (gpr12 & IMX6Q_GPR12_PCIE_CTL_2)) { | ||
238 | val = readl(pp->dbi_base + PCIE_PL_PFLR); | ||
239 | val &= ~PCIE_PL_PFLR_LINK_STATE_MASK; | ||
240 | val |= PCIE_PL_PFLR_FORCE_LINK; | ||
241 | writel(val, pp->dbi_base + PCIE_PL_PFLR); | ||
242 | |||
243 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, | ||
244 | IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); | ||
245 | } | ||
217 | 246 | ||
218 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | 247 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, |
219 | IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); | 248 | IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); |
@@ -589,6 +618,14 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) | |||
589 | return 0; | 618 | return 0; |
590 | } | 619 | } |
591 | 620 | ||
621 | static void imx6_pcie_shutdown(struct platform_device *pdev) | ||
622 | { | ||
623 | struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev); | ||
624 | |||
625 | /* bring down link, so bootloader gets clean state in case of reboot */ | ||
626 | imx6_pcie_assert_core_reset(&imx6_pcie->pp); | ||
627 | } | ||
628 | |||
592 | static const struct of_device_id imx6_pcie_of_match[] = { | 629 | static const struct of_device_id imx6_pcie_of_match[] = { |
593 | { .compatible = "fsl,imx6q-pcie", }, | 630 | { .compatible = "fsl,imx6q-pcie", }, |
594 | {}, | 631 | {}, |
@@ -601,6 +638,7 @@ static struct platform_driver imx6_pcie_driver = { | |||
601 | .owner = THIS_MODULE, | 638 | .owner = THIS_MODULE, |
602 | .of_match_table = imx6_pcie_of_match, | 639 | .of_match_table = imx6_pcie_of_match, |
603 | }, | 640 | }, |
641 | .shutdown = imx6_pcie_shutdown, | ||
604 | }; | 642 | }; |
605 | 643 | ||
606 | /* Freescale PCIe driver does not allow module unload */ | 644 | /* Freescale PCIe driver does not allow module unload */ |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 70741c8c46a0..6cd5160fc057 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -560,19 +560,15 @@ static void disable_slot(struct acpiphp_slot *slot) | |||
560 | slot->flags &= (~SLOT_ENABLED); | 560 | slot->flags &= (~SLOT_ENABLED); |
561 | } | 561 | } |
562 | 562 | ||
563 | static bool acpiphp_no_hotplug(struct acpi_device *adev) | ||
564 | { | ||
565 | return adev && adev->flags.no_hotplug; | ||
566 | } | ||
567 | |||
568 | static bool slot_no_hotplug(struct acpiphp_slot *slot) | 563 | static bool slot_no_hotplug(struct acpiphp_slot *slot) |
569 | { | 564 | { |
570 | struct acpiphp_func *func; | 565 | struct pci_bus *bus = slot->bus; |
566 | struct pci_dev *dev; | ||
571 | 567 | ||
572 | list_for_each_entry(func, &slot->funcs, sibling) | 568 | list_for_each_entry(dev, &bus->devices, bus_list) { |
573 | if (acpiphp_no_hotplug(func_to_acpi_device(func))) | 569 | if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug) |
574 | return true; | 570 | return true; |
575 | 571 | } | |
576 | return false; | 572 | return false; |
577 | } | 573 | } |
578 | 574 | ||
@@ -645,7 +641,7 @@ static void trim_stale_devices(struct pci_dev *dev) | |||
645 | 641 | ||
646 | status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); | 642 | status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); |
647 | alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) | 643 | alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) |
648 | || acpiphp_no_hotplug(adev); | 644 | || dev->ignore_hotplug; |
649 | } | 645 | } |
650 | if (!alive) | 646 | if (!alive) |
651 | alive = pci_device_is_present(dev); | 647 | alive = pci_device_is_present(dev); |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 9da84b8b27d8..2a412fa3b338 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -160,7 +160,7 @@ static void pcie_wait_cmd(struct controller *ctrl) | |||
160 | ctrl->slot_ctrl & PCI_EXP_SLTCTL_CCIE) | 160 | ctrl->slot_ctrl & PCI_EXP_SLTCTL_CCIE) |
161 | rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout); | 161 | rc = wait_event_timeout(ctrl->queue, !ctrl->cmd_busy, timeout); |
162 | else | 162 | else |
163 | rc = pcie_poll_cmd(ctrl, timeout); | 163 | rc = pcie_poll_cmd(ctrl, jiffies_to_msecs(timeout)); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * Controllers with errata like Intel CF118 don't generate | 166 | * Controllers with errata like Intel CF118 don't generate |
@@ -506,6 +506,8 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
506 | { | 506 | { |
507 | struct controller *ctrl = (struct controller *)dev_id; | 507 | struct controller *ctrl = (struct controller *)dev_id; |
508 | struct pci_dev *pdev = ctrl_dev(ctrl); | 508 | struct pci_dev *pdev = ctrl_dev(ctrl); |
509 | struct pci_bus *subordinate = pdev->subordinate; | ||
510 | struct pci_dev *dev; | ||
509 | struct slot *slot = ctrl->slot; | 511 | struct slot *slot = ctrl->slot; |
510 | u16 detected, intr_loc; | 512 | u16 detected, intr_loc; |
511 | 513 | ||
@@ -539,6 +541,16 @@ static irqreturn_t pcie_isr(int irq, void *dev_id) | |||
539 | wake_up(&ctrl->queue); | 541 | wake_up(&ctrl->queue); |
540 | } | 542 | } |
541 | 543 | ||
544 | if (subordinate) { | ||
545 | list_for_each_entry(dev, &subordinate->devices, bus_list) { | ||
546 | if (dev->ignore_hotplug) { | ||
547 | ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n", | ||
548 | intr_loc, pci_name(dev)); | ||
549 | return IRQ_HANDLED; | ||
550 | } | ||
551 | } | ||
552 | } | ||
553 | |||
542 | if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) | 554 | if (!(intr_loc & ~PCI_EXP_SLTSTA_CC)) |
543 | return IRQ_HANDLED; | 555 | return IRQ_HANDLED; |
544 | 556 | ||
diff --git a/drivers/pci/hotplug/pcihp_slot.c b/drivers/pci/hotplug/pcihp_slot.c index e246a10a0d2c..3e36ec8d708a 100644 --- a/drivers/pci/hotplug/pcihp_slot.c +++ b/drivers/pci/hotplug/pcihp_slot.c | |||
@@ -46,7 +46,6 @@ static void program_hpp_type0(struct pci_dev *dev, struct hpp_type0 *hpp) | |||
46 | */ | 46 | */ |
47 | if (pci_is_pcie(dev)) | 47 | if (pci_is_pcie(dev)) |
48 | return; | 48 | return; |
49 | dev_info(&dev->dev, "using default PCI settings\n"); | ||
50 | hpp = &pci_default_type0; | 49 | hpp = &pci_default_type0; |
51 | } | 50 | } |
52 | 51 | ||
@@ -153,7 +152,6 @@ void pci_configure_slot(struct pci_dev *dev) | |||
153 | { | 152 | { |
154 | struct pci_dev *cdev; | 153 | struct pci_dev *cdev; |
155 | struct hotplug_params hpp; | 154 | struct hotplug_params hpp; |
156 | int ret; | ||
157 | 155 | ||
158 | if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || | 156 | if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || |
159 | (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && | 157 | (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && |
@@ -163,9 +161,7 @@ void pci_configure_slot(struct pci_dev *dev) | |||
163 | pcie_bus_configure_settings(dev->bus); | 161 | pcie_bus_configure_settings(dev->bus); |
164 | 162 | ||
165 | memset(&hpp, 0, sizeof(hpp)); | 163 | memset(&hpp, 0, sizeof(hpp)); |
166 | ret = pci_get_hp_params(dev, &hpp); | 164 | pci_get_hp_params(dev, &hpp); |
167 | if (ret) | ||
168 | dev_warn(&dev->dev, "no hotplug settings from platform\n"); | ||
169 | 165 | ||
170 | program_hpp_type2(dev, hpp.t2); | 166 | program_hpp_type2(dev, hpp.t2); |
171 | program_hpp_type1(dev, hpp.t1); | 167 | program_hpp_type1(dev, hpp.t1); |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index e3cf8a2e6292..4170113cde61 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -775,7 +775,7 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
775 | /* Check if setup is sensible at all */ | 775 | /* Check if setup is sensible at all */ |
776 | if (!pass && | 776 | if (!pass && |
777 | (primary != bus->number || secondary <= bus->number || | 777 | (primary != bus->number || secondary <= bus->number || |
778 | secondary > subordinate || subordinate > bus->busn_res.end)) { | 778 | secondary > subordinate)) { |
779 | dev_info(&dev->dev, "bridge configuration invalid ([bus %02x-%02x]), reconfiguring\n", | 779 | dev_info(&dev->dev, "bridge configuration invalid ([bus %02x-%02x]), reconfiguring\n", |
780 | secondary, subordinate); | 780 | secondary, subordinate); |
781 | broken = 1; | 781 | broken = 1; |
@@ -838,23 +838,18 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
838 | goto out; | 838 | goto out; |
839 | } | 839 | } |
840 | 840 | ||
841 | if (max >= bus->busn_res.end) { | ||
842 | dev_warn(&dev->dev, "can't allocate child bus %02x from %pR\n", | ||
843 | max, &bus->busn_res); | ||
844 | goto out; | ||
845 | } | ||
846 | |||
847 | /* Clear errors */ | 841 | /* Clear errors */ |
848 | pci_write_config_word(dev, PCI_STATUS, 0xffff); | 842 | pci_write_config_word(dev, PCI_STATUS, 0xffff); |
849 | 843 | ||
850 | /* The bus will already exist if we are rescanning */ | 844 | /* Prevent assigning a bus number that already exists. |
845 | * This can happen when a bridge is hot-plugged, so in | ||
846 | * this case we only re-scan this bus. */ | ||
851 | child = pci_find_bus(pci_domain_nr(bus), max+1); | 847 | child = pci_find_bus(pci_domain_nr(bus), max+1); |
852 | if (!child) { | 848 | if (!child) { |
853 | child = pci_add_new_bus(bus, dev, max+1); | 849 | child = pci_add_new_bus(bus, dev, max+1); |
854 | if (!child) | 850 | if (!child) |
855 | goto out; | 851 | goto out; |
856 | pci_bus_insert_busn_res(child, max+1, | 852 | pci_bus_insert_busn_res(child, max+1, 0xff); |
857 | bus->busn_res.end); | ||
858 | } | 853 | } |
859 | max++; | 854 | max++; |
860 | buses = (buses & 0xff000000) | 855 | buses = (buses & 0xff000000) |
@@ -913,11 +908,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) | |||
913 | /* | 908 | /* |
914 | * Set the subordinate bus number to its real value. | 909 | * Set the subordinate bus number to its real value. |
915 | */ | 910 | */ |
916 | if (max > bus->busn_res.end) { | ||
917 | dev_warn(&dev->dev, "max busn %02x is outside %pR\n", | ||
918 | max, &bus->busn_res); | ||
919 | max = bus->busn_res.end; | ||
920 | } | ||
921 | pci_bus_update_busn_res_end(child, max); | 911 | pci_bus_update_busn_res_end(child, max); |
922 | pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); | 912 | pci_write_config_byte(dev, PCI_SUBORDINATE_BUS, max); |
923 | } | 913 | } |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 0dd742719154..f833aa271a2e 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -41,9 +41,9 @@ config PHY_MVEBU_SATA | |||
41 | config PHY_MIPHY365X | 41 | config PHY_MIPHY365X |
42 | tristate "STMicroelectronics MIPHY365X PHY driver for STiH41x series" | 42 | tristate "STMicroelectronics MIPHY365X PHY driver for STiH41x series" |
43 | depends on ARCH_STI | 43 | depends on ARCH_STI |
44 | depends on GENERIC_PHY | ||
45 | depends on HAS_IOMEM | 44 | depends on HAS_IOMEM |
46 | depends on OF | 45 | depends on OF |
46 | select GENERIC_PHY | ||
47 | help | 47 | help |
48 | Enable this to support the miphy transceiver (for SATA/PCIE) | 48 | Enable this to support the miphy transceiver (for SATA/PCIE) |
49 | that is part of STMicroelectronics STiH41x SoC series. | 49 | that is part of STMicroelectronics STiH41x SoC series. |
@@ -214,12 +214,14 @@ config PHY_QCOM_IPQ806X_SATA | |||
214 | config PHY_ST_SPEAR1310_MIPHY | 214 | config PHY_ST_SPEAR1310_MIPHY |
215 | tristate "ST SPEAR1310-MIPHY driver" | 215 | tristate "ST SPEAR1310-MIPHY driver" |
216 | select GENERIC_PHY | 216 | select GENERIC_PHY |
217 | depends on MACH_SPEAR1310 || COMPILE_TEST | ||
217 | help | 218 | help |
218 | Support for ST SPEAr1310 MIPHY which can be used for PCIe and SATA. | 219 | Support for ST SPEAr1310 MIPHY which can be used for PCIe and SATA. |
219 | 220 | ||
220 | config PHY_ST_SPEAR1340_MIPHY | 221 | config PHY_ST_SPEAR1340_MIPHY |
221 | tristate "ST SPEAR1340-MIPHY driver" | 222 | tristate "ST SPEAR1340-MIPHY driver" |
222 | select GENERIC_PHY | 223 | select GENERIC_PHY |
224 | depends on MACH_SPEAR1340 || COMPILE_TEST | ||
223 | help | 225 | help |
224 | Support for ST SPEAr1340 MIPHY which can be used for PCIe and SATA. | 226 | Support for ST SPEAr1340 MIPHY which can be used for PCIe and SATA. |
225 | 227 | ||
diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index b05302b09c9f..392101c8d6b0 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c | |||
@@ -542,6 +542,7 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = { | |||
542 | }, | 542 | }, |
543 | { }, | 543 | { }, |
544 | }; | 544 | }; |
545 | MODULE_DEVICE_TABLE(of, exynos5_usbdrd_phy_of_match); | ||
545 | 546 | ||
546 | static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) | 547 | static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) |
547 | { | 548 | { |
diff --git a/drivers/phy/phy-miphy365x.c b/drivers/phy/phy-miphy365x.c index e111baf187ce..e0fb7a1e5a5a 100644 --- a/drivers/phy/phy-miphy365x.c +++ b/drivers/phy/phy-miphy365x.c | |||
@@ -163,6 +163,7 @@ enum miphy_sata_gen { | |||
163 | }; | 163 | }; |
164 | 164 | ||
165 | static u8 rx_tx_spd[] = { | 165 | static u8 rx_tx_spd[] = { |
166 | 0, /* GEN0 doesn't exist. */ | ||
166 | TX_SPDSEL_GEN1_VAL | RX_SPDSEL_GEN1_VAL, | 167 | TX_SPDSEL_GEN1_VAL | RX_SPDSEL_GEN1_VAL, |
167 | TX_SPDSEL_GEN2_VAL | RX_SPDSEL_GEN2_VAL, | 168 | TX_SPDSEL_GEN2_VAL | RX_SPDSEL_GEN2_VAL, |
168 | TX_SPDSEL_GEN3_VAL | RX_SPDSEL_GEN3_VAL | 169 | TX_SPDSEL_GEN3_VAL | RX_SPDSEL_GEN3_VAL |
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c index e1a6623d4696..9cd33a4bcfb1 100644 --- a/drivers/phy/phy-twl4030-usb.c +++ b/drivers/phy/phy-twl4030-usb.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/usb/otg.h> | 35 | #include <linux/usb/otg.h> |
36 | #include <linux/phy/phy.h> | 36 | #include <linux/phy/phy.h> |
37 | #include <linux/pm_runtime.h> | ||
37 | #include <linux/usb/musb-omap.h> | 38 | #include <linux/usb/musb-omap.h> |
38 | #include <linux/usb/ulpi.h> | 39 | #include <linux/usb/ulpi.h> |
39 | #include <linux/i2c/twl.h> | 40 | #include <linux/i2c/twl.h> |
@@ -422,37 +423,55 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on) | |||
422 | } | 423 | } |
423 | } | 424 | } |
424 | 425 | ||
425 | static int twl4030_phy_power_off(struct phy *phy) | 426 | static int twl4030_usb_runtime_suspend(struct device *dev) |
426 | { | 427 | { |
427 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 428 | struct twl4030_usb *twl = dev_get_drvdata(dev); |
428 | 429 | ||
430 | dev_dbg(twl->dev, "%s\n", __func__); | ||
429 | if (twl->asleep) | 431 | if (twl->asleep) |
430 | return 0; | 432 | return 0; |
431 | 433 | ||
432 | twl4030_phy_power(twl, 0); | 434 | twl4030_phy_power(twl, 0); |
433 | twl->asleep = 1; | 435 | twl->asleep = 1; |
434 | dev_dbg(twl->dev, "%s\n", __func__); | 436 | |
435 | return 0; | 437 | return 0; |
436 | } | 438 | } |
437 | 439 | ||
438 | static void __twl4030_phy_power_on(struct twl4030_usb *twl) | 440 | static int twl4030_usb_runtime_resume(struct device *dev) |
439 | { | 441 | { |
442 | struct twl4030_usb *twl = dev_get_drvdata(dev); | ||
443 | |||
444 | dev_dbg(twl->dev, "%s\n", __func__); | ||
445 | if (!twl->asleep) | ||
446 | return 0; | ||
447 | |||
440 | twl4030_phy_power(twl, 1); | 448 | twl4030_phy_power(twl, 1); |
441 | twl4030_i2c_access(twl, 1); | 449 | twl->asleep = 0; |
442 | twl4030_usb_set_mode(twl, twl->usb_mode); | 450 | |
443 | if (twl->usb_mode == T2_USB_MODE_ULPI) | 451 | return 0; |
444 | twl4030_i2c_access(twl, 0); | 452 | } |
453 | |||
454 | static int twl4030_phy_power_off(struct phy *phy) | ||
455 | { | ||
456 | struct twl4030_usb *twl = phy_get_drvdata(phy); | ||
457 | |||
458 | dev_dbg(twl->dev, "%s\n", __func__); | ||
459 | pm_runtime_mark_last_busy(twl->dev); | ||
460 | pm_runtime_put_autosuspend(twl->dev); | ||
461 | |||
462 | return 0; | ||
445 | } | 463 | } |
446 | 464 | ||
447 | static int twl4030_phy_power_on(struct phy *phy) | 465 | static int twl4030_phy_power_on(struct phy *phy) |
448 | { | 466 | { |
449 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 467 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
450 | 468 | ||
451 | if (!twl->asleep) | ||
452 | return 0; | ||
453 | __twl4030_phy_power_on(twl); | ||
454 | twl->asleep = 0; | ||
455 | dev_dbg(twl->dev, "%s\n", __func__); | 469 | dev_dbg(twl->dev, "%s\n", __func__); |
470 | pm_runtime_get_sync(twl->dev); | ||
471 | twl4030_i2c_access(twl, 1); | ||
472 | twl4030_usb_set_mode(twl, twl->usb_mode); | ||
473 | if (twl->usb_mode == T2_USB_MODE_ULPI) | ||
474 | twl4030_i2c_access(twl, 0); | ||
456 | 475 | ||
457 | /* | 476 | /* |
458 | * XXX When VBUS gets driven after musb goes to A mode, | 477 | * XXX When VBUS gets driven after musb goes to A mode, |
@@ -558,9 +577,27 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
558 | * USB_LINK_VBUS state. musb_hdrc won't care until it | 577 | * USB_LINK_VBUS state. musb_hdrc won't care until it |
559 | * starts to handle softconnect right. | 578 | * starts to handle softconnect right. |
560 | */ | 579 | */ |
580 | if ((status == OMAP_MUSB_VBUS_VALID) || | ||
581 | (status == OMAP_MUSB_ID_GROUND)) { | ||
582 | if (twl->asleep) | ||
583 | pm_runtime_get_sync(twl->dev); | ||
584 | } else { | ||
585 | if (!twl->asleep) { | ||
586 | pm_runtime_mark_last_busy(twl->dev); | ||
587 | pm_runtime_put_autosuspend(twl->dev); | ||
588 | } | ||
589 | } | ||
561 | omap_musb_mailbox(status); | 590 | omap_musb_mailbox(status); |
562 | } | 591 | } |
563 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | 592 | |
593 | /* don't schedule during sleep - irq works right then */ | ||
594 | if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { | ||
595 | cancel_delayed_work(&twl->id_workaround_work); | ||
596 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
597 | } | ||
598 | |||
599 | if (irq) | ||
600 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | ||
564 | 601 | ||
565 | return IRQ_HANDLED; | 602 | return IRQ_HANDLED; |
566 | } | 603 | } |
@@ -569,29 +606,8 @@ static void twl4030_id_workaround_work(struct work_struct *work) | |||
569 | { | 606 | { |
570 | struct twl4030_usb *twl = container_of(work, struct twl4030_usb, | 607 | struct twl4030_usb *twl = container_of(work, struct twl4030_usb, |
571 | id_workaround_work.work); | 608 | id_workaround_work.work); |
572 | enum omap_musb_vbus_id_status status; | ||
573 | bool status_changed = false; | ||
574 | |||
575 | status = twl4030_usb_linkstat(twl); | ||
576 | |||
577 | spin_lock_irq(&twl->lock); | ||
578 | if (status >= 0 && status != twl->linkstat) { | ||
579 | twl->linkstat = status; | ||
580 | status_changed = true; | ||
581 | } | ||
582 | spin_unlock_irq(&twl->lock); | ||
583 | |||
584 | if (status_changed) { | ||
585 | dev_dbg(twl->dev, "handle missing status change to %d\n", | ||
586 | status); | ||
587 | omap_musb_mailbox(status); | ||
588 | } | ||
589 | 609 | ||
590 | /* don't schedule during sleep - irq works right then */ | 610 | twl4030_usb_irq(0, twl); |
591 | if (status == OMAP_MUSB_ID_GROUND && !twl->asleep) { | ||
592 | cancel_delayed_work(&twl->id_workaround_work); | ||
593 | schedule_delayed_work(&twl->id_workaround_work, HZ); | ||
594 | } | ||
595 | } | 611 | } |
596 | 612 | ||
597 | static int twl4030_phy_init(struct phy *phy) | 613 | static int twl4030_phy_init(struct phy *phy) |
@@ -599,22 +615,17 @@ static int twl4030_phy_init(struct phy *phy) | |||
599 | struct twl4030_usb *twl = phy_get_drvdata(phy); | 615 | struct twl4030_usb *twl = phy_get_drvdata(phy); |
600 | enum omap_musb_vbus_id_status status; | 616 | enum omap_musb_vbus_id_status status; |
601 | 617 | ||
602 | /* | 618 | pm_runtime_get_sync(twl->dev); |
603 | * Start in sleep state, we'll get called through set_suspend() | ||
604 | * callback when musb is runtime resumed and it's time to start. | ||
605 | */ | ||
606 | __twl4030_phy_power(twl, 0); | ||
607 | twl->asleep = 1; | ||
608 | |||
609 | status = twl4030_usb_linkstat(twl); | 619 | status = twl4030_usb_linkstat(twl); |
610 | twl->linkstat = status; | 620 | twl->linkstat = status; |
611 | 621 | ||
612 | if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) { | 622 | if (status == OMAP_MUSB_ID_GROUND || status == OMAP_MUSB_VBUS_VALID) |
613 | omap_musb_mailbox(twl->linkstat); | 623 | omap_musb_mailbox(twl->linkstat); |
614 | twl4030_phy_power_on(phy); | ||
615 | } | ||
616 | 624 | ||
617 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | 625 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); |
626 | pm_runtime_mark_last_busy(twl->dev); | ||
627 | pm_runtime_put_autosuspend(twl->dev); | ||
628 | |||
618 | return 0; | 629 | return 0; |
619 | } | 630 | } |
620 | 631 | ||
@@ -650,6 +661,11 @@ static const struct phy_ops ops = { | |||
650 | .owner = THIS_MODULE, | 661 | .owner = THIS_MODULE, |
651 | }; | 662 | }; |
652 | 663 | ||
664 | static const struct dev_pm_ops twl4030_usb_pm_ops = { | ||
665 | SET_RUNTIME_PM_OPS(twl4030_usb_runtime_suspend, | ||
666 | twl4030_usb_runtime_resume, NULL) | ||
667 | }; | ||
668 | |||
653 | static int twl4030_usb_probe(struct platform_device *pdev) | 669 | static int twl4030_usb_probe(struct platform_device *pdev) |
654 | { | 670 | { |
655 | struct twl4030_usb_data *pdata = dev_get_platdata(&pdev->dev); | 671 | struct twl4030_usb_data *pdata = dev_get_platdata(&pdev->dev); |
@@ -726,6 +742,11 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
726 | 742 | ||
727 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); | 743 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); |
728 | 744 | ||
745 | pm_runtime_use_autosuspend(&pdev->dev); | ||
746 | pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); | ||
747 | pm_runtime_enable(&pdev->dev); | ||
748 | pm_runtime_get_sync(&pdev->dev); | ||
749 | |||
729 | /* Our job is to use irqs and status from the power module | 750 | /* Our job is to use irqs and status from the power module |
730 | * to keep the transceiver disabled when nothing's connected. | 751 | * to keep the transceiver disabled when nothing's connected. |
731 | * | 752 | * |
@@ -744,6 +765,9 @@ static int twl4030_usb_probe(struct platform_device *pdev) | |||
744 | return status; | 765 | return status; |
745 | } | 766 | } |
746 | 767 | ||
768 | pm_runtime_mark_last_busy(&pdev->dev); | ||
769 | pm_runtime_put_autosuspend(twl->dev); | ||
770 | |||
747 | dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); | 771 | dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); |
748 | return 0; | 772 | return 0; |
749 | } | 773 | } |
@@ -753,6 +777,7 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
753 | struct twl4030_usb *twl = platform_get_drvdata(pdev); | 777 | struct twl4030_usb *twl = platform_get_drvdata(pdev); |
754 | int val; | 778 | int val; |
755 | 779 | ||
780 | pm_runtime_get_sync(twl->dev); | ||
756 | cancel_delayed_work(&twl->id_workaround_work); | 781 | cancel_delayed_work(&twl->id_workaround_work); |
757 | device_remove_file(twl->dev, &dev_attr_vbus); | 782 | device_remove_file(twl->dev, &dev_attr_vbus); |
758 | 783 | ||
@@ -772,9 +797,8 @@ static int twl4030_usb_remove(struct platform_device *pdev) | |||
772 | 797 | ||
773 | /* disable complete OTG block */ | 798 | /* disable complete OTG block */ |
774 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); | 799 | twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB); |
775 | 800 | pm_runtime_mark_last_busy(twl->dev); | |
776 | if (!twl->asleep) | 801 | pm_runtime_put(twl->dev); |
777 | twl4030_phy_power(twl, 0); | ||
778 | 802 | ||
779 | return 0; | 803 | return 0; |
780 | } | 804 | } |
@@ -792,6 +816,7 @@ static struct platform_driver twl4030_usb_driver = { | |||
792 | .remove = twl4030_usb_remove, | 816 | .remove = twl4030_usb_remove, |
793 | .driver = { | 817 | .driver = { |
794 | .name = "twl4030_usb", | 818 | .name = "twl4030_usb", |
819 | .pm = &twl4030_usb_pm_ops, | ||
795 | .owner = THIS_MODULE, | 820 | .owner = THIS_MODULE, |
796 | .of_match_table = of_match_ptr(twl4030_usb_id_table), | 821 | .of_match_table = of_match_ptr(twl4030_usb_id_table), |
797 | }, | 822 | }, |
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index 9ca59a018743..e12e5b07f6d7 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c | |||
@@ -461,6 +461,7 @@ static struct irq_chip byt_irqchip = { | |||
461 | .irq_mask = byt_irq_mask, | 461 | .irq_mask = byt_irq_mask, |
462 | .irq_unmask = byt_irq_unmask, | 462 | .irq_unmask = byt_irq_unmask, |
463 | .irq_set_type = byt_irq_type, | 463 | .irq_set_type = byt_irq_type, |
464 | .flags = IRQCHIP_SKIP_SET_WAKE, | ||
464 | }; | 465 | }; |
465 | 466 | ||
466 | static void byt_gpio_irq_init_hw(struct byt_gpio *vg) | 467 | static void byt_gpio_irq_init_hw(struct byt_gpio *vg) |
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index fc468a3d95ce..02152de135b5 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
@@ -88,7 +88,6 @@ struct ideapad_private { | |||
88 | struct dentry *debug; | 88 | struct dentry *debug; |
89 | unsigned long cfg; | 89 | unsigned long cfg; |
90 | bool has_hw_rfkill_switch; | 90 | bool has_hw_rfkill_switch; |
91 | bool has_touchpad_control; | ||
92 | }; | 91 | }; |
93 | 92 | ||
94 | static bool no_bt_rfkill; | 93 | static bool no_bt_rfkill; |
@@ -456,7 +455,7 @@ struct ideapad_rfk_data { | |||
456 | int type; | 455 | int type; |
457 | }; | 456 | }; |
458 | 457 | ||
459 | const const struct ideapad_rfk_data ideapad_rfk_data[] = { | 458 | static const struct ideapad_rfk_data ideapad_rfk_data[] = { |
460 | { "ideapad_wlan", CFG_WIFI_BIT, VPCCMD_W_WIFI, RFKILL_TYPE_WLAN }, | 459 | { "ideapad_wlan", CFG_WIFI_BIT, VPCCMD_W_WIFI, RFKILL_TYPE_WLAN }, |
461 | { "ideapad_bluetooth", CFG_BT_BIT, VPCCMD_W_BT, RFKILL_TYPE_BLUETOOTH }, | 460 | { "ideapad_bluetooth", CFG_BT_BIT, VPCCMD_W_BT, RFKILL_TYPE_BLUETOOTH }, |
462 | { "ideapad_3g", CFG_3G_BIT, VPCCMD_W_3G, RFKILL_TYPE_WWAN }, | 461 | { "ideapad_3g", CFG_3G_BIT, VPCCMD_W_3G, RFKILL_TYPE_WWAN }, |
@@ -767,9 +766,6 @@ static void ideapad_sync_touchpad_state(struct ideapad_private *priv) | |||
767 | { | 766 | { |
768 | unsigned long value; | 767 | unsigned long value; |
769 | 768 | ||
770 | if (!priv->has_touchpad_control) | ||
771 | return; | ||
772 | |||
773 | /* Without reading from EC touchpad LED doesn't switch state */ | 769 | /* Without reading from EC touchpad LED doesn't switch state */ |
774 | if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { | 770 | if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) { |
775 | /* Some IdeaPads don't really turn off touchpad - they only | 771 | /* Some IdeaPads don't really turn off touchpad - they only |
@@ -833,29 +829,7 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data) | |||
833 | * always results in 0 on these models, causing ideapad_laptop to wrongly | 829 | * always results in 0 on these models, causing ideapad_laptop to wrongly |
834 | * report all radios as hardware-blocked. | 830 | * report all radios as hardware-blocked. |
835 | */ | 831 | */ |
836 | static struct dmi_system_id no_hw_rfkill_list[] = { | 832 | static const struct dmi_system_id no_hw_rfkill_list[] = { |
837 | { | ||
838 | .ident = "Lenovo Yoga 2 11 / 13 / Pro", | ||
839 | .matches = { | ||
840 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
841 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"), | ||
842 | }, | ||
843 | }, | ||
844 | {} | ||
845 | }; | ||
846 | |||
847 | /* | ||
848 | * Some models don't offer touchpad ctrl through the ideapad interface, causing | ||
849 | * ideapad_sync_touchpad_state to send wrong touchpad enable/disable events. | ||
850 | */ | ||
851 | static struct dmi_system_id no_touchpad_ctrl_list[] = { | ||
852 | { | ||
853 | .ident = "Lenovo Yoga 1 series", | ||
854 | .matches = { | ||
855 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
856 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Yoga"), | ||
857 | }, | ||
858 | }, | ||
859 | { | 833 | { |
860 | .ident = "Lenovo Yoga 2 11 / 13 / Pro", | 834 | .ident = "Lenovo Yoga 2 11 / 13 / Pro", |
861 | .matches = { | 835 | .matches = { |
@@ -889,7 +863,6 @@ static int ideapad_acpi_add(struct platform_device *pdev) | |||
889 | priv->adev = adev; | 863 | priv->adev = adev; |
890 | priv->platform_device = pdev; | 864 | priv->platform_device = pdev; |
891 | priv->has_hw_rfkill_switch = !dmi_check_system(no_hw_rfkill_list); | 865 | priv->has_hw_rfkill_switch = !dmi_check_system(no_hw_rfkill_list); |
892 | priv->has_touchpad_control = !dmi_check_system(no_touchpad_ctrl_list); | ||
893 | 866 | ||
894 | ret = ideapad_sysfs_init(priv); | 867 | ret = ideapad_sysfs_init(priv); |
895 | if (ret) | 868 | if (ret) |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index b062d3d7b373..d0dce734b2ed 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -1255,10 +1255,15 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | |||
1255 | const char *buf, size_t count) | 1255 | const char *buf, size_t count) |
1256 | { | 1256 | { |
1257 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); | 1257 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); |
1258 | int mode = -1; | 1258 | int mode; |
1259 | int time = -1; | 1259 | int time; |
1260 | int ret; | ||
1260 | 1261 | ||
1261 | if (sscanf(buf, "%i", &mode) != 1 && (mode != 2 || mode != 1)) | 1262 | |
1263 | ret = kstrtoint(buf, 0, &mode); | ||
1264 | if (ret) | ||
1265 | return ret; | ||
1266 | if (mode != SCI_KBD_MODE_FNZ && mode != SCI_KBD_MODE_AUTO) | ||
1262 | return -EINVAL; | 1267 | return -EINVAL; |
1263 | 1268 | ||
1264 | /* Set the Keyboard Backlight Mode where: | 1269 | /* Set the Keyboard Backlight Mode where: |
@@ -1266,11 +1271,12 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | |||
1266 | * Auto - KBD backlight turns off automatically in given time | 1271 | * Auto - KBD backlight turns off automatically in given time |
1267 | * FN-Z - KBD backlight "toggles" when hotkey pressed | 1272 | * FN-Z - KBD backlight "toggles" when hotkey pressed |
1268 | */ | 1273 | */ |
1269 | if (mode != -1 && toshiba->kbd_mode != mode) { | 1274 | if (toshiba->kbd_mode != mode) { |
1270 | time = toshiba->kbd_time << HCI_MISC_SHIFT; | 1275 | time = toshiba->kbd_time << HCI_MISC_SHIFT; |
1271 | time = time + toshiba->kbd_mode; | 1276 | time = time + toshiba->kbd_mode; |
1272 | if (toshiba_kbd_illum_status_set(toshiba, time) < 0) | 1277 | ret = toshiba_kbd_illum_status_set(toshiba, time); |
1273 | return -EIO; | 1278 | if (ret) |
1279 | return ret; | ||
1274 | toshiba->kbd_mode = mode; | 1280 | toshiba->kbd_mode = mode; |
1275 | } | 1281 | } |
1276 | 1282 | ||
@@ -1857,9 +1863,16 @@ static int toshiba_acpi_resume(struct device *device) | |||
1857 | { | 1863 | { |
1858 | struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device)); | 1864 | struct toshiba_acpi_dev *dev = acpi_driver_data(to_acpi_device(device)); |
1859 | u32 result; | 1865 | u32 result; |
1866 | acpi_status status; | ||
1867 | |||
1868 | if (dev->hotkey_dev) { | ||
1869 | status = acpi_evaluate_object(dev->acpi_dev->handle, "ENAB", | ||
1870 | NULL, NULL); | ||
1871 | if (ACPI_FAILURE(status)) | ||
1872 | pr_info("Unable to re-enable hotkeys\n"); | ||
1860 | 1873 | ||
1861 | if (dev->hotkey_dev) | ||
1862 | hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &result); | 1874 | hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &result); |
1875 | } | ||
1863 | 1876 | ||
1864 | return 0; | 1877 | return 0; |
1865 | } | 1878 | } |
diff --git a/drivers/powercap/intel_rapl.c b/drivers/powercap/intel_rapl.c index b1cda6ffdbcc..45e05b32f9b6 100644 --- a/drivers/powercap/intel_rapl.c +++ b/drivers/powercap/intel_rapl.c | |||
@@ -953,6 +953,7 @@ static const struct x86_cpu_id rapl_ids[] = { | |||
953 | { X86_VENDOR_INTEL, 6, 0x3a},/* Ivy Bridge */ | 953 | { X86_VENDOR_INTEL, 6, 0x3a},/* Ivy Bridge */ |
954 | { X86_VENDOR_INTEL, 6, 0x3c},/* Haswell */ | 954 | { X86_VENDOR_INTEL, 6, 0x3c},/* Haswell */ |
955 | { X86_VENDOR_INTEL, 6, 0x3d},/* Broadwell */ | 955 | { X86_VENDOR_INTEL, 6, 0x3d},/* Broadwell */ |
956 | { X86_VENDOR_INTEL, 6, 0x3f},/* Haswell */ | ||
956 | { X86_VENDOR_INTEL, 6, 0x45},/* Haswell ULT */ | 957 | { X86_VENDOR_INTEL, 6, 0x45},/* Haswell ULT */ |
957 | /* TODO: Add more CPU IDs after testing */ | 958 | /* TODO: Add more CPU IDs after testing */ |
958 | {} | 959 | {} |
@@ -1166,11 +1167,10 @@ static int rapl_detect_domains(struct rapl_package *rp, int cpu) | |||
1166 | 1167 | ||
1167 | for (i = 0; i < RAPL_DOMAIN_MAX; i++) { | 1168 | for (i = 0; i < RAPL_DOMAIN_MAX; i++) { |
1168 | /* use physical package id to read counters */ | 1169 | /* use physical package id to read counters */ |
1169 | if (!rapl_check_domain(cpu, i)) | 1170 | if (!rapl_check_domain(cpu, i)) { |
1170 | rp->domain_map |= 1 << i; | 1171 | rp->domain_map |= 1 << i; |
1171 | else | 1172 | pr_info("Found RAPL domain %s\n", rapl_domain_names[i]); |
1172 | pr_warn("RAPL domain %s detection failed\n", | 1173 | } |
1173 | rapl_domain_names[i]); | ||
1174 | } | 1174 | } |
1175 | rp->nr_domains = bitmap_weight(&rp->domain_map, RAPL_DOMAIN_MAX); | 1175 | rp->nr_domains = bitmap_weight(&rp->domain_map, RAPL_DOMAIN_MAX); |
1176 | if (!rp->nr_domains) { | 1176 | if (!rp->nr_domains) { |
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 337634ad0562..6d77dcd7dcf6 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -319,7 +319,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, | |||
319 | struct regulator_config *config) | 319 | struct regulator_config *config) |
320 | { | 320 | { |
321 | struct device_node *nproot, *np; | 321 | struct device_node *nproot, *np; |
322 | nproot = of_node_get(pdev->dev.parent->of_node); | 322 | nproot = pdev->dev.parent->of_node; |
323 | if (!nproot) | 323 | if (!nproot) |
324 | return -ENODEV; | 324 | return -ENODEV; |
325 | nproot = of_get_child_by_name(nproot, "regulators"); | 325 | nproot = of_get_child_by_name(nproot, "regulators"); |
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index fdb6ea8ae7e6..00033625a09c 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
@@ -422,9 +422,9 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
422 | config.init_data = pdata->regulators[pdev->id]; | 422 | config.init_data = pdata->regulators[pdev->id]; |
423 | } else { | 423 | } else { |
424 | #ifdef CONFIG_OF | 424 | #ifdef CONFIG_OF |
425 | struct device_node *nproot, *np; | 425 | struct device_node *nproot = da9052->dev->of_node; |
426 | struct device_node *np; | ||
426 | 427 | ||
427 | nproot = of_node_get(da9052->dev->of_node); | ||
428 | if (!nproot) | 428 | if (!nproot) |
429 | return -ENODEV; | 429 | return -ENODEV; |
430 | 430 | ||
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index 9623e9e290bf..3426be89c9f6 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
@@ -226,7 +226,7 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) | |||
226 | struct device_node *np, *regulators; | 226 | struct device_node *np, *regulators; |
227 | int ret; | 227 | int ret; |
228 | 228 | ||
229 | np = of_node_get(pdev->dev.parent->of_node); | 229 | np = pdev->dev.parent->of_node; |
230 | if (!np) | 230 | if (!np) |
231 | return 0; | 231 | return 0; |
232 | 232 | ||
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index dad2bcd14e96..7770777befc4 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
@@ -250,7 +250,7 @@ static int max8925_regulator_dt_init(struct platform_device *pdev, | |||
250 | struct device_node *nproot, *np; | 250 | struct device_node *nproot, *np; |
251 | int rcount; | 251 | int rcount; |
252 | 252 | ||
253 | nproot = of_node_get(pdev->dev.parent->of_node); | 253 | nproot = pdev->dev.parent->of_node; |
254 | if (!nproot) | 254 | if (!nproot) |
255 | return -ENODEV; | 255 | return -ENODEV; |
256 | np = of_get_child_by_name(nproot, "regulators"); | 256 | np = of_get_child_by_name(nproot, "regulators"); |
diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c index 90b4c530dee5..9c31e215a521 100644 --- a/drivers/regulator/max8997.c +++ b/drivers/regulator/max8997.c | |||
@@ -917,7 +917,7 @@ static int max8997_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
917 | struct max8997_regulator_data *rdata; | 917 | struct max8997_regulator_data *rdata; |
918 | unsigned int i, dvs_voltage_nr = 1, ret; | 918 | unsigned int i, dvs_voltage_nr = 1, ret; |
919 | 919 | ||
920 | pmic_np = of_node_get(iodev->dev->of_node); | 920 | pmic_np = iodev->dev->of_node; |
921 | if (!pmic_np) { | 921 | if (!pmic_np) { |
922 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); | 922 | dev_err(&pdev->dev, "could not find pmic sub-node\n"); |
923 | return -ENODEV; | 923 | return -ENODEV; |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index a7ce34d1b5f2..1878e5b567ef 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -1427,7 +1427,6 @@ static void palmas_dt_to_pdata(struct device *dev, | |||
1427 | u32 prop; | 1427 | u32 prop; |
1428 | int idx, ret; | 1428 | int idx, ret; |
1429 | 1429 | ||
1430 | node = of_node_get(node); | ||
1431 | regulators = of_get_child_by_name(node, "regulators"); | 1430 | regulators = of_get_child_by_name(node, "regulators"); |
1432 | if (!regulators) { | 1431 | if (!regulators) { |
1433 | dev_info(dev, "regulator node not found\n"); | 1432 | dev_info(dev, "regulator node not found\n"); |
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index fa7db8847578..e584c998b55f 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c | |||
@@ -1014,7 +1014,7 @@ static struct tps65910_board *tps65910_parse_dt_reg_data( | |||
1014 | if (!pmic_plat_data) | 1014 | if (!pmic_plat_data) |
1015 | return NULL; | 1015 | return NULL; |
1016 | 1016 | ||
1017 | np = of_node_get(pdev->dev.parent->of_node); | 1017 | np = pdev->dev.parent->of_node; |
1018 | regulators = of_get_child_by_name(np, "regulators"); | 1018 | regulators = of_get_child_by_name(np, "regulators"); |
1019 | if (!regulators) { | 1019 | if (!regulators) { |
1020 | dev_err(&pdev->dev, "regulator node not found\n"); | 1020 | dev_err(&pdev->dev, "regulator node not found\n"); |
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 8225b89de810..c384fec6d173 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c | |||
@@ -232,6 +232,7 @@ static struct platform_driver efi_rtc_driver = { | |||
232 | 232 | ||
233 | module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); | 233 | module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe); |
234 | 234 | ||
235 | MODULE_ALIAS("platform:rtc-efi"); | ||
235 | MODULE_AUTHOR("dann frazier <dannf@hp.com>"); | 236 | MODULE_AUTHOR("dann frazier <dannf@hp.com>"); |
236 | MODULE_LICENSE("GPL"); | 237 | MODULE_LICENSE("GPL"); |
237 | MODULE_DESCRIPTION("EFI RTC driver"); | 238 | MODULE_DESCRIPTION("EFI RTC driver"); |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 2ead7e78c456..14ba80bfa571 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -77,7 +77,7 @@ EXPORT_SYMBOL_GPL(dasd_nofcx); | |||
77 | * strings when running as a module. | 77 | * strings when running as a module. |
78 | */ | 78 | */ |
79 | static char *dasd[256]; | 79 | static char *dasd[256]; |
80 | module_param_array(dasd, charp, NULL, 0); | 80 | module_param_array(dasd, charp, NULL, S_IRUGO); |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Single spinlock to protect devmap and servermap structures and lists. | 83 | * Single spinlock to protect devmap and servermap structures and lists. |
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 97ef37b51068..e7646ce3d659 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h | |||
@@ -889,6 +889,7 @@ extern const struct attribute_group *qeth_generic_attr_groups[]; | |||
889 | extern const struct attribute_group *qeth_osn_attr_groups[]; | 889 | extern const struct attribute_group *qeth_osn_attr_groups[]; |
890 | extern struct workqueue_struct *qeth_wq; | 890 | extern struct workqueue_struct *qeth_wq; |
891 | 891 | ||
892 | int qeth_card_hw_is_reachable(struct qeth_card *); | ||
892 | const char *qeth_get_cardname_short(struct qeth_card *); | 893 | const char *qeth_get_cardname_short(struct qeth_card *); |
893 | int qeth_realloc_buffer_pool(struct qeth_card *, int); | 894 | int qeth_realloc_buffer_pool(struct qeth_card *, int); |
894 | int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id); | 895 | int qeth_core_load_discipline(struct qeth_card *, enum qeth_discipline_id); |
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index c0d6ba8655c7..fd22c811cbe1 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -73,6 +73,13 @@ static int qeth_init_qdio_out_buf(struct qeth_qdio_out_q *, int); | |||
73 | struct workqueue_struct *qeth_wq; | 73 | struct workqueue_struct *qeth_wq; |
74 | EXPORT_SYMBOL_GPL(qeth_wq); | 74 | EXPORT_SYMBOL_GPL(qeth_wq); |
75 | 75 | ||
76 | int qeth_card_hw_is_reachable(struct qeth_card *card) | ||
77 | { | ||
78 | return (card->state == CARD_STATE_SOFTSETUP) || | ||
79 | (card->state == CARD_STATE_UP); | ||
80 | } | ||
81 | EXPORT_SYMBOL_GPL(qeth_card_hw_is_reachable); | ||
82 | |||
76 | static void qeth_close_dev_handler(struct work_struct *work) | 83 | static void qeth_close_dev_handler(struct work_struct *work) |
77 | { | 84 | { |
78 | struct qeth_card *card; | 85 | struct qeth_card *card; |
@@ -5790,6 +5797,7 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, | |||
5790 | struct qeth_card *card = netdev->ml_priv; | 5797 | struct qeth_card *card = netdev->ml_priv; |
5791 | enum qeth_link_types link_type; | 5798 | enum qeth_link_types link_type; |
5792 | struct carrier_info carrier_info; | 5799 | struct carrier_info carrier_info; |
5800 | int rc; | ||
5793 | u32 speed; | 5801 | u32 speed; |
5794 | 5802 | ||
5795 | if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) | 5803 | if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) |
@@ -5832,8 +5840,14 @@ int qeth_core_ethtool_get_settings(struct net_device *netdev, | |||
5832 | /* Check if we can obtain more accurate information. */ | 5840 | /* Check if we can obtain more accurate information. */ |
5833 | /* If QUERY_CARD_INFO command is not supported or fails, */ | 5841 | /* If QUERY_CARD_INFO command is not supported or fails, */ |
5834 | /* just return the heuristics that was filled above. */ | 5842 | /* just return the heuristics that was filled above. */ |
5835 | if (qeth_query_card_info(card, &carrier_info) != 0) | 5843 | if (!qeth_card_hw_is_reachable(card)) |
5844 | return -ENODEV; | ||
5845 | rc = qeth_query_card_info(card, &carrier_info); | ||
5846 | if (rc == -EOPNOTSUPP) /* for old hardware, return heuristic */ | ||
5836 | return 0; | 5847 | return 0; |
5848 | if (rc) /* report error from the hardware operation */ | ||
5849 | return rc; | ||
5850 | /* on success, fill in the information got from the hardware */ | ||
5837 | 5851 | ||
5838 | netdev_dbg(netdev, | 5852 | netdev_dbg(netdev, |
5839 | "card info: card_type=0x%02x, port_mode=0x%04x, port_speed=0x%08x\n", | 5853 | "card info: card_type=0x%02x, port_mode=0x%04x, port_speed=0x%08x\n", |
diff --git a/drivers/s390/net/qeth_l2_sys.c b/drivers/s390/net/qeth_l2_sys.c index ae1bc04b8653..59e3aa538b4d 100644 --- a/drivers/s390/net/qeth_l2_sys.c +++ b/drivers/s390/net/qeth_l2_sys.c | |||
@@ -5,17 +5,12 @@ | |||
5 | 5 | ||
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
7 | #include <asm/ebcdic.h> | 7 | #include <asm/ebcdic.h> |
8 | #include "qeth_core.h" | ||
8 | #include "qeth_l2.h" | 9 | #include "qeth_l2.h" |
9 | 10 | ||
10 | #define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \ | 11 | #define QETH_DEVICE_ATTR(_id, _name, _mode, _show, _store) \ |
11 | struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store) | 12 | struct device_attribute dev_attr_##_id = __ATTR(_name, _mode, _show, _store) |
12 | 13 | ||
13 | static int qeth_card_hw_is_reachable(struct qeth_card *card) | ||
14 | { | ||
15 | return (card->state == CARD_STATE_SOFTSETUP) || | ||
16 | (card->state == CARD_STATE_UP); | ||
17 | } | ||
18 | |||
19 | static ssize_t qeth_bridge_port_role_state_show(struct device *dev, | 14 | static ssize_t qeth_bridge_port_role_state_show(struct device *dev, |
20 | struct device_attribute *attr, char *buf, | 15 | struct device_attribute *attr, char *buf, |
21 | int show_state) | 16 | int show_state) |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 18a3358eb1d4..bd85fb4978e0 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -43,7 +43,7 @@ config SCSI_DMA | |||
43 | config SCSI_NETLINK | 43 | config SCSI_NETLINK |
44 | bool | 44 | bool |
45 | default n | 45 | default n |
46 | select NET | 46 | depends on NET |
47 | 47 | ||
48 | config SCSI_PROC_FS | 48 | config SCSI_PROC_FS |
49 | bool "legacy /proc/scsi/ support" | 49 | bool "legacy /proc/scsi/ support" |
@@ -257,7 +257,7 @@ config SCSI_SPI_ATTRS | |||
257 | 257 | ||
258 | config SCSI_FC_ATTRS | 258 | config SCSI_FC_ATTRS |
259 | tristate "FiberChannel Transport Attributes" | 259 | tristate "FiberChannel Transport Attributes" |
260 | depends on SCSI | 260 | depends on SCSI && NET |
261 | select SCSI_NETLINK | 261 | select SCSI_NETLINK |
262 | help | 262 | help |
263 | If you wish to export transport-specific information about | 263 | If you wish to export transport-specific information about |
@@ -585,28 +585,28 @@ config HYPERV_STORAGE | |||
585 | 585 | ||
586 | config LIBFC | 586 | config LIBFC |
587 | tristate "LibFC module" | 587 | tristate "LibFC module" |
588 | select SCSI_FC_ATTRS | 588 | depends on SCSI_FC_ATTRS |
589 | select CRC32 | 589 | select CRC32 |
590 | ---help--- | 590 | ---help--- |
591 | Fibre Channel library module | 591 | Fibre Channel library module |
592 | 592 | ||
593 | config LIBFCOE | 593 | config LIBFCOE |
594 | tristate "LibFCoE module" | 594 | tristate "LibFCoE module" |
595 | select LIBFC | 595 | depends on LIBFC |
596 | ---help--- | 596 | ---help--- |
597 | Library for Fibre Channel over Ethernet module | 597 | Library for Fibre Channel over Ethernet module |
598 | 598 | ||
599 | config FCOE | 599 | config FCOE |
600 | tristate "FCoE module" | 600 | tristate "FCoE module" |
601 | depends on PCI | 601 | depends on PCI |
602 | select LIBFCOE | 602 | depends on LIBFCOE |
603 | ---help--- | 603 | ---help--- |
604 | Fibre Channel over Ethernet module | 604 | Fibre Channel over Ethernet module |
605 | 605 | ||
606 | config FCOE_FNIC | 606 | config FCOE_FNIC |
607 | tristate "Cisco FNIC Driver" | 607 | tristate "Cisco FNIC Driver" |
608 | depends on PCI && X86 | 608 | depends on PCI && X86 |
609 | select LIBFCOE | 609 | depends on LIBFCOE |
610 | help | 610 | help |
611 | This is support for the Cisco PCI-Express FCoE HBA. | 611 | This is support for the Cisco PCI-Express FCoE HBA. |
612 | 612 | ||
@@ -816,7 +816,7 @@ config SCSI_IBMVSCSI | |||
816 | config SCSI_IBMVFC | 816 | config SCSI_IBMVFC |
817 | tristate "IBM Virtual FC support" | 817 | tristate "IBM Virtual FC support" |
818 | depends on PPC_PSERIES && SCSI | 818 | depends on PPC_PSERIES && SCSI |
819 | select SCSI_FC_ATTRS | 819 | depends on SCSI_FC_ATTRS |
820 | help | 820 | help |
821 | This is the IBM POWER Virtual FC Client | 821 | This is the IBM POWER Virtual FC Client |
822 | 822 | ||
@@ -1266,7 +1266,7 @@ source "drivers/scsi/qla4xxx/Kconfig" | |||
1266 | config SCSI_LPFC | 1266 | config SCSI_LPFC |
1267 | tristate "Emulex LightPulse Fibre Channel Support" | 1267 | tristate "Emulex LightPulse Fibre Channel Support" |
1268 | depends on PCI && SCSI | 1268 | depends on PCI && SCSI |
1269 | select SCSI_FC_ATTRS | 1269 | depends on SCSI_FC_ATTRS |
1270 | select CRC_T10DIF | 1270 | select CRC_T10DIF |
1271 | help | 1271 | help |
1272 | This lpfc driver supports the Emulex LightPulse | 1272 | This lpfc driver supports the Emulex LightPulse |
@@ -1676,7 +1676,7 @@ config SCSI_SUNESP | |||
1676 | config ZFCP | 1676 | config ZFCP |
1677 | tristate "FCP host bus adapter driver for IBM eServer zSeries" | 1677 | tristate "FCP host bus adapter driver for IBM eServer zSeries" |
1678 | depends on S390 && QDIO && SCSI | 1678 | depends on S390 && QDIO && SCSI |
1679 | select SCSI_FC_ATTRS | 1679 | depends on SCSI_FC_ATTRS |
1680 | help | 1680 | help |
1681 | If you want to access SCSI devices attached to your IBM eServer | 1681 | If you want to access SCSI devices attached to your IBM eServer |
1682 | zSeries by means of Fibre Channel interfaces say Y. | 1682 | zSeries by means of Fibre Channel interfaces say Y. |
@@ -1704,7 +1704,7 @@ config SCSI_PM8001 | |||
1704 | config SCSI_BFA_FC | 1704 | config SCSI_BFA_FC |
1705 | tristate "Brocade BFA Fibre Channel Support" | 1705 | tristate "Brocade BFA Fibre Channel Support" |
1706 | depends on PCI && SCSI | 1706 | depends on PCI && SCSI |
1707 | select SCSI_FC_ATTRS | 1707 | depends on SCSI_FC_ATTRS |
1708 | help | 1708 | help |
1709 | This bfa driver supports all Brocade PCIe FC/FCOE host adapters. | 1709 | This bfa driver supports all Brocade PCIe FC/FCOE host adapters. |
1710 | 1710 | ||
diff --git a/drivers/scsi/bnx2fc/Kconfig b/drivers/scsi/bnx2fc/Kconfig index f245d543d7b1..097882882649 100644 --- a/drivers/scsi/bnx2fc/Kconfig +++ b/drivers/scsi/bnx2fc/Kconfig | |||
@@ -1,11 +1,12 @@ | |||
1 | config SCSI_BNX2X_FCOE | 1 | config SCSI_BNX2X_FCOE |
2 | tristate "QLogic NetXtreme II FCoE support" | 2 | tristate "QLogic NetXtreme II FCoE support" |
3 | depends on PCI | 3 | depends on PCI |
4 | depends on (IPV6 || IPV6=n) | ||
5 | depends on LIBFC | ||
6 | depends on LIBFCOE | ||
4 | select NETDEVICES | 7 | select NETDEVICES |
5 | select ETHERNET | 8 | select ETHERNET |
6 | select NET_VENDOR_BROADCOM | 9 | select NET_VENDOR_BROADCOM |
7 | select LIBFC | ||
8 | select LIBFCOE | ||
9 | select CNIC | 10 | select CNIC |
10 | ---help--- | 11 | ---help--- |
11 | This driver supports FCoE offload for the QLogic NetXtreme II | 12 | This driver supports FCoE offload for the QLogic NetXtreme II |
diff --git a/drivers/scsi/bnx2i/Kconfig b/drivers/scsi/bnx2i/Kconfig index 44ce54e536e5..ba30ff86d581 100644 --- a/drivers/scsi/bnx2i/Kconfig +++ b/drivers/scsi/bnx2i/Kconfig | |||
@@ -2,6 +2,7 @@ config SCSI_BNX2_ISCSI | |||
2 | tristate "QLogic NetXtreme II iSCSI support" | 2 | tristate "QLogic NetXtreme II iSCSI support" |
3 | depends on NET | 3 | depends on NET |
4 | depends on PCI | 4 | depends on PCI |
5 | depends on (IPV6 || IPV6=n) | ||
5 | select SCSI_ISCSI_ATTRS | 6 | select SCSI_ISCSI_ATTRS |
6 | select NETDEVICES | 7 | select NETDEVICES |
7 | select ETHERNET | 8 | select ETHERNET |
diff --git a/drivers/scsi/csiostor/Kconfig b/drivers/scsi/csiostor/Kconfig index 4d03b032aa10..7c7e5085968b 100644 --- a/drivers/scsi/csiostor/Kconfig +++ b/drivers/scsi/csiostor/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config SCSI_CHELSIO_FCOE | 1 | config SCSI_CHELSIO_FCOE |
2 | tristate "Chelsio Communications FCoE support" | 2 | tristate "Chelsio Communications FCoE support" |
3 | depends on PCI && SCSI | 3 | depends on PCI && SCSI |
4 | select SCSI_FC_ATTRS | 4 | depends on SCSI_FC_ATTRS |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | help | 6 | help |
7 | This driver supports FCoE Offload functionality over | 7 | This driver supports FCoE Offload functionality over |
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 79788a12712d..02e69e7ee4a3 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -1647,7 +1647,7 @@ static int cxgbi_inet6addr_handler(struct notifier_block *this, | |||
1647 | if (event_dev->priv_flags & IFF_802_1Q_VLAN) | 1647 | if (event_dev->priv_flags & IFF_802_1Q_VLAN) |
1648 | event_dev = vlan_dev_real_dev(event_dev); | 1648 | event_dev = vlan_dev_real_dev(event_dev); |
1649 | 1649 | ||
1650 | cdev = cxgbi_device_find_by_netdev(event_dev, NULL); | 1650 | cdev = cxgbi_device_find_by_netdev_rcu(event_dev, NULL); |
1651 | 1651 | ||
1652 | if (!cdev) | 1652 | if (!cdev) |
1653 | return ret; | 1653 | return ret; |
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index d65df6dc106f..addd1dddce14 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
@@ -57,6 +57,9 @@ MODULE_PARM_DESC(dbg_level, "libiscsi debug level (default=0)"); | |||
57 | static LIST_HEAD(cdev_list); | 57 | static LIST_HEAD(cdev_list); |
58 | static DEFINE_MUTEX(cdev_mutex); | 58 | static DEFINE_MUTEX(cdev_mutex); |
59 | 59 | ||
60 | static LIST_HEAD(cdev_rcu_list); | ||
61 | static DEFINE_SPINLOCK(cdev_rcu_lock); | ||
62 | |||
60 | int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base, | 63 | int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base, |
61 | unsigned int max_conn) | 64 | unsigned int max_conn) |
62 | { | 65 | { |
@@ -142,6 +145,10 @@ struct cxgbi_device *cxgbi_device_register(unsigned int extra, | |||
142 | list_add_tail(&cdev->list_head, &cdev_list); | 145 | list_add_tail(&cdev->list_head, &cdev_list); |
143 | mutex_unlock(&cdev_mutex); | 146 | mutex_unlock(&cdev_mutex); |
144 | 147 | ||
148 | spin_lock(&cdev_rcu_lock); | ||
149 | list_add_tail_rcu(&cdev->rcu_node, &cdev_rcu_list); | ||
150 | spin_unlock(&cdev_rcu_lock); | ||
151 | |||
145 | log_debug(1 << CXGBI_DBG_DEV, | 152 | log_debug(1 << CXGBI_DBG_DEV, |
146 | "cdev 0x%p, p# %u.\n", cdev, nports); | 153 | "cdev 0x%p, p# %u.\n", cdev, nports); |
147 | return cdev; | 154 | return cdev; |
@@ -153,9 +160,16 @@ void cxgbi_device_unregister(struct cxgbi_device *cdev) | |||
153 | log_debug(1 << CXGBI_DBG_DEV, | 160 | log_debug(1 << CXGBI_DBG_DEV, |
154 | "cdev 0x%p, p# %u,%s.\n", | 161 | "cdev 0x%p, p# %u,%s.\n", |
155 | cdev, cdev->nports, cdev->nports ? cdev->ports[0]->name : ""); | 162 | cdev, cdev->nports, cdev->nports ? cdev->ports[0]->name : ""); |
163 | |||
156 | mutex_lock(&cdev_mutex); | 164 | mutex_lock(&cdev_mutex); |
157 | list_del(&cdev->list_head); | 165 | list_del(&cdev->list_head); |
158 | mutex_unlock(&cdev_mutex); | 166 | mutex_unlock(&cdev_mutex); |
167 | |||
168 | spin_lock(&cdev_rcu_lock); | ||
169 | list_del_rcu(&cdev->rcu_node); | ||
170 | spin_unlock(&cdev_rcu_lock); | ||
171 | synchronize_rcu(); | ||
172 | |||
159 | cxgbi_device_destroy(cdev); | 173 | cxgbi_device_destroy(cdev); |
160 | } | 174 | } |
161 | EXPORT_SYMBOL_GPL(cxgbi_device_unregister); | 175 | EXPORT_SYMBOL_GPL(cxgbi_device_unregister); |
@@ -167,12 +181,9 @@ void cxgbi_device_unregister_all(unsigned int flag) | |||
167 | mutex_lock(&cdev_mutex); | 181 | mutex_lock(&cdev_mutex); |
168 | list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { | 182 | list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) { |
169 | if ((cdev->flags & flag) == flag) { | 183 | if ((cdev->flags & flag) == flag) { |
170 | log_debug(1 << CXGBI_DBG_DEV, | 184 | mutex_unlock(&cdev_mutex); |
171 | "cdev 0x%p, p# %u,%s.\n", | 185 | cxgbi_device_unregister(cdev); |
172 | cdev, cdev->nports, cdev->nports ? | 186 | mutex_lock(&cdev_mutex); |
173 | cdev->ports[0]->name : ""); | ||
174 | list_del(&cdev->list_head); | ||
175 | cxgbi_device_destroy(cdev); | ||
176 | } | 187 | } |
177 | } | 188 | } |
178 | mutex_unlock(&cdev_mutex); | 189 | mutex_unlock(&cdev_mutex); |
@@ -191,6 +202,7 @@ struct cxgbi_device *cxgbi_device_find_by_lldev(void *lldev) | |||
191 | } | 202 | } |
192 | } | 203 | } |
193 | mutex_unlock(&cdev_mutex); | 204 | mutex_unlock(&cdev_mutex); |
205 | |||
194 | log_debug(1 << CXGBI_DBG_DEV, | 206 | log_debug(1 << CXGBI_DBG_DEV, |
195 | "lldev 0x%p, NO match found.\n", lldev); | 207 | "lldev 0x%p, NO match found.\n", lldev); |
196 | return NULL; | 208 | return NULL; |
@@ -230,6 +242,39 @@ struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *ndev, | |||
230 | } | 242 | } |
231 | EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev); | 243 | EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev); |
232 | 244 | ||
245 | struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *ndev, | ||
246 | int *port) | ||
247 | { | ||
248 | struct net_device *vdev = NULL; | ||
249 | struct cxgbi_device *cdev; | ||
250 | int i; | ||
251 | |||
252 | if (ndev->priv_flags & IFF_802_1Q_VLAN) { | ||
253 | vdev = ndev; | ||
254 | ndev = vlan_dev_real_dev(ndev); | ||
255 | pr_info("vlan dev %s -> %s.\n", vdev->name, ndev->name); | ||
256 | } | ||
257 | |||
258 | rcu_read_lock(); | ||
259 | list_for_each_entry_rcu(cdev, &cdev_rcu_list, rcu_node) { | ||
260 | for (i = 0; i < cdev->nports; i++) { | ||
261 | if (ndev == cdev->ports[i]) { | ||
262 | cdev->hbas[i]->vdev = vdev; | ||
263 | rcu_read_unlock(); | ||
264 | if (port) | ||
265 | *port = i; | ||
266 | return cdev; | ||
267 | } | ||
268 | } | ||
269 | } | ||
270 | rcu_read_unlock(); | ||
271 | |||
272 | log_debug(1 << CXGBI_DBG_DEV, | ||
273 | "ndev 0x%p, %s, NO match found.\n", ndev, ndev->name); | ||
274 | return NULL; | ||
275 | } | ||
276 | EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev_rcu); | ||
277 | |||
233 | static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev, | 278 | static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev, |
234 | int *port) | 279 | int *port) |
235 | { | 280 | { |
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index b3e6e7541cc5..1d98fad6a0ab 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h | |||
@@ -527,6 +527,7 @@ struct cxgbi_ports_map { | |||
527 | #define CXGBI_FLAG_IPV4_SET 0x10 | 527 | #define CXGBI_FLAG_IPV4_SET 0x10 |
528 | struct cxgbi_device { | 528 | struct cxgbi_device { |
529 | struct list_head list_head; | 529 | struct list_head list_head; |
530 | struct list_head rcu_node; | ||
530 | unsigned int flags; | 531 | unsigned int flags; |
531 | struct net_device **ports; | 532 | struct net_device **ports; |
532 | void *lldev; | 533 | void *lldev; |
@@ -709,6 +710,8 @@ void cxgbi_device_unregister(struct cxgbi_device *); | |||
709 | void cxgbi_device_unregister_all(unsigned int flag); | 710 | void cxgbi_device_unregister_all(unsigned int flag); |
710 | struct cxgbi_device *cxgbi_device_find_by_lldev(void *); | 711 | struct cxgbi_device *cxgbi_device_find_by_lldev(void *); |
711 | struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *); | 712 | struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *); |
713 | struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *, | ||
714 | int *); | ||
712 | int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int, | 715 | int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int, |
713 | struct scsi_host_template *, | 716 | struct scsi_host_template *, |
714 | struct scsi_transport_template *); | 717 | struct scsi_transport_template *); |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index ea025e4806b6..191b59793519 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -717,11 +717,21 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, | |||
717 | return NULL; | 717 | return NULL; |
718 | } | 718 | } |
719 | 719 | ||
720 | if (data_size > ISCSI_DEF_MAX_RECV_SEG_LEN) { | ||
721 | iscsi_conn_printk(KERN_ERR, conn, "Invalid buffer len of %u for login task. Max len is %u\n", data_size, ISCSI_DEF_MAX_RECV_SEG_LEN); | ||
722 | return NULL; | ||
723 | } | ||
724 | |||
720 | task = conn->login_task; | 725 | task = conn->login_task; |
721 | } else { | 726 | } else { |
722 | if (session->state != ISCSI_STATE_LOGGED_IN) | 727 | if (session->state != ISCSI_STATE_LOGGED_IN) |
723 | return NULL; | 728 | return NULL; |
724 | 729 | ||
730 | if (data_size != 0) { | ||
731 | iscsi_conn_printk(KERN_ERR, conn, "Can not send data buffer of len %u for op 0x%x\n", data_size, opcode); | ||
732 | return NULL; | ||
733 | } | ||
734 | |||
725 | BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); | 735 | BUG_ON(conn->c_stage == ISCSI_CONN_INITIAL_STAGE); |
726 | BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); | 736 | BUG_ON(conn->c_stage == ISCSI_CONN_STOPPED); |
727 | 737 | ||
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig index 23d607218ae8..113e6c9826a1 100644 --- a/drivers/scsi/qla2xxx/Kconfig +++ b/drivers/scsi/qla2xxx/Kconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | config SCSI_QLA_FC | 1 | config SCSI_QLA_FC |
2 | tristate "QLogic QLA2XXX Fibre Channel Support" | 2 | tristate "QLogic QLA2XXX Fibre Channel Support" |
3 | depends on PCI && SCSI | 3 | depends on PCI && SCSI |
4 | select SCSI_FC_ATTRS | 4 | depends on SCSI_FC_ATTRS |
5 | select FW_LOADER | 5 | select FW_LOADER |
6 | ---help--- | 6 | ---help--- |
7 | This qla2xxx driver supports all QLogic Fibre Channel | 7 | This qla2xxx driver supports all QLogic Fibre Channel |
@@ -31,7 +31,7 @@ config SCSI_QLA_FC | |||
31 | config TCM_QLA2XXX | 31 | config TCM_QLA2XXX |
32 | tristate "TCM_QLA2XXX fabric module for Qlogic 2xxx series target mode HBAs" | 32 | tristate "TCM_QLA2XXX fabric module for Qlogic 2xxx series target mode HBAs" |
33 | depends on SCSI_QLA_FC && TARGET_CORE | 33 | depends on SCSI_QLA_FC && TARGET_CORE |
34 | select LIBFC | 34 | depends on LIBFC |
35 | select BTREE | 35 | select BTREE |
36 | default n | 36 | default n |
37 | ---help--- | 37 | ---help--- |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index d837dc180522..aaea4b98af16 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -733,12 +733,13 @@ static bool scsi_end_request(struct request *req, int error, | |||
733 | } else { | 733 | } else { |
734 | unsigned long flags; | 734 | unsigned long flags; |
735 | 735 | ||
736 | if (bidi_bytes) | ||
737 | scsi_release_bidi_buffers(cmd); | ||
738 | |||
736 | spin_lock_irqsave(q->queue_lock, flags); | 739 | spin_lock_irqsave(q->queue_lock, flags); |
737 | blk_finish_request(req, error); | 740 | blk_finish_request(req, error); |
738 | spin_unlock_irqrestore(q->queue_lock, flags); | 741 | spin_unlock_irqrestore(q->queue_lock, flags); |
739 | 742 | ||
740 | if (bidi_bytes) | ||
741 | scsi_release_bidi_buffers(cmd); | ||
742 | scsi_release_buffers(cmd); | 743 | scsi_release_buffers(cmd); |
743 | scsi_next_command(cmd); | 744 | scsi_next_command(cmd); |
744 | } | 745 | } |
diff --git a/drivers/soc/qcom/qcom_gsbi.c b/drivers/soc/qcom/qcom_gsbi.c index 447458e696a9..7e1f120f2b32 100644 --- a/drivers/soc/qcom/qcom_gsbi.c +++ b/drivers/soc/qcom/qcom_gsbi.c | |||
@@ -22,44 +22,63 @@ | |||
22 | #define GSBI_CTRL_REG 0x0000 | 22 | #define GSBI_CTRL_REG 0x0000 |
23 | #define GSBI_PROTOCOL_SHIFT 4 | 23 | #define GSBI_PROTOCOL_SHIFT 4 |
24 | 24 | ||
25 | struct gsbi_info { | ||
26 | struct clk *hclk; | ||
27 | u32 mode; | ||
28 | u32 crci; | ||
29 | }; | ||
30 | |||
25 | static int gsbi_probe(struct platform_device *pdev) | 31 | static int gsbi_probe(struct platform_device *pdev) |
26 | { | 32 | { |
27 | struct device_node *node = pdev->dev.of_node; | 33 | struct device_node *node = pdev->dev.of_node; |
28 | struct resource *res; | 34 | struct resource *res; |
29 | void __iomem *base; | 35 | void __iomem *base; |
30 | struct clk *hclk; | 36 | struct gsbi_info *gsbi; |
31 | u32 mode, crci = 0; | 37 | |
38 | gsbi = devm_kzalloc(&pdev->dev, sizeof(*gsbi), GFP_KERNEL); | ||
39 | |||
40 | if (!gsbi) | ||
41 | return -ENOMEM; | ||
32 | 42 | ||
33 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 43 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
34 | base = devm_ioremap_resource(&pdev->dev, res); | 44 | base = devm_ioremap_resource(&pdev->dev, res); |
35 | if (IS_ERR(base)) | 45 | if (IS_ERR(base)) |
36 | return PTR_ERR(base); | 46 | return PTR_ERR(base); |
37 | 47 | ||
38 | if (of_property_read_u32(node, "qcom,mode", &mode)) { | 48 | if (of_property_read_u32(node, "qcom,mode", &gsbi->mode)) { |
39 | dev_err(&pdev->dev, "missing mode configuration\n"); | 49 | dev_err(&pdev->dev, "missing mode configuration\n"); |
40 | return -EINVAL; | 50 | return -EINVAL; |
41 | } | 51 | } |
42 | 52 | ||
43 | /* not required, so default to 0 if not present */ | 53 | /* not required, so default to 0 if not present */ |
44 | of_property_read_u32(node, "qcom,crci", &crci); | 54 | of_property_read_u32(node, "qcom,crci", &gsbi->crci); |
45 | 55 | ||
46 | dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", mode, crci); | 56 | dev_info(&pdev->dev, "GSBI port protocol: %d crci: %d\n", |
57 | gsbi->mode, gsbi->crci); | ||
58 | gsbi->hclk = devm_clk_get(&pdev->dev, "iface"); | ||
59 | if (IS_ERR(gsbi->hclk)) | ||
60 | return PTR_ERR(gsbi->hclk); | ||
47 | 61 | ||
48 | hclk = devm_clk_get(&pdev->dev, "iface"); | 62 | clk_prepare_enable(gsbi->hclk); |
49 | if (IS_ERR(hclk)) | ||
50 | return PTR_ERR(hclk); | ||
51 | 63 | ||
52 | clk_prepare_enable(hclk); | 64 | writel_relaxed((gsbi->mode << GSBI_PROTOCOL_SHIFT) | gsbi->crci, |
53 | |||
54 | writel_relaxed((mode << GSBI_PROTOCOL_SHIFT) | crci, | ||
55 | base + GSBI_CTRL_REG); | 65 | base + GSBI_CTRL_REG); |
56 | 66 | ||
57 | /* make sure the gsbi control write is not reordered */ | 67 | /* make sure the gsbi control write is not reordered */ |
58 | wmb(); | 68 | wmb(); |
59 | 69 | ||
60 | clk_disable_unprepare(hclk); | 70 | platform_set_drvdata(pdev, gsbi); |
71 | |||
72 | return of_platform_populate(node, NULL, NULL, &pdev->dev); | ||
73 | } | ||
74 | |||
75 | static int gsbi_remove(struct platform_device *pdev) | ||
76 | { | ||
77 | struct gsbi_info *gsbi = platform_get_drvdata(pdev); | ||
78 | |||
79 | clk_disable_unprepare(gsbi->hclk); | ||
61 | 80 | ||
62 | return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); | 81 | return 0; |
63 | } | 82 | } |
64 | 83 | ||
65 | static const struct of_device_id gsbi_dt_match[] = { | 84 | static const struct of_device_id gsbi_dt_match[] = { |
@@ -76,6 +95,7 @@ static struct platform_driver gsbi_driver = { | |||
76 | .of_match_table = gsbi_dt_match, | 95 | .of_match_table = gsbi_dt_match, |
77 | }, | 96 | }, |
78 | .probe = gsbi_probe, | 97 | .probe = gsbi_probe, |
98 | .remove = gsbi_remove, | ||
79 | }; | 99 | }; |
80 | 100 | ||
81 | module_platform_driver(gsbi_driver); | 101 | module_platform_driver(gsbi_driver); |
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 48f1d26e6ad9..134fb6eb7b19 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -397,24 +397,21 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
397 | struct spi_master *master = spi->master; | 397 | struct spi_master *master = spi->master; |
398 | struct device_node *np = spi->dev.of_node; | 398 | struct device_node *np = spi->dev.of_node; |
399 | bool internal_cs = true; | 399 | bool internal_cs = true; |
400 | unsigned long flags = GPIOF_DIR_OUT; | ||
401 | 400 | ||
402 | dspi = spi_master_get_devdata(spi->master); | 401 | dspi = spi_master_get_devdata(spi->master); |
403 | pdata = &dspi->pdata; | 402 | pdata = &dspi->pdata; |
404 | 403 | ||
405 | flags |= (spi->mode & SPI_CS_HIGH) ? GPIOF_INIT_LOW : GPIOF_INIT_HIGH; | ||
406 | |||
407 | if (!(spi->mode & SPI_NO_CS)) { | 404 | if (!(spi->mode & SPI_NO_CS)) { |
408 | if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { | 405 | if (np && (master->cs_gpios != NULL) && (spi->cs_gpio >= 0)) { |
409 | retval = gpio_request_one(spi->cs_gpio, | 406 | retval = gpio_direction_output( |
410 | flags, dev_name(&spi->dev)); | 407 | spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); |
411 | internal_cs = false; | 408 | internal_cs = false; |
412 | } else if (pdata->chip_sel && | 409 | } else if (pdata->chip_sel && |
413 | spi->chip_select < pdata->num_chipselect && | 410 | spi->chip_select < pdata->num_chipselect && |
414 | pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { | 411 | pdata->chip_sel[spi->chip_select] != SPI_INTERN_CS) { |
415 | spi->cs_gpio = pdata->chip_sel[spi->chip_select]; | 412 | spi->cs_gpio = pdata->chip_sel[spi->chip_select]; |
416 | retval = gpio_request_one(spi->cs_gpio, | 413 | retval = gpio_direction_output( |
417 | flags, dev_name(&spi->dev)); | 414 | spi->cs_gpio, !(spi->mode & SPI_CS_HIGH)); |
418 | internal_cs = false; | 415 | internal_cs = false; |
419 | } | 416 | } |
420 | 417 | ||
@@ -439,12 +436,6 @@ static int davinci_spi_setup(struct spi_device *spi) | |||
439 | return retval; | 436 | return retval; |
440 | } | 437 | } |
441 | 438 | ||
442 | static void davinci_spi_cleanup(struct spi_device *spi) | ||
443 | { | ||
444 | if (spi->cs_gpio >= 0) | ||
445 | gpio_free(spi->cs_gpio); | ||
446 | } | ||
447 | |||
448 | static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) | 439 | static int davinci_spi_check_error(struct davinci_spi *dspi, int int_status) |
449 | { | 440 | { |
450 | struct device *sdev = dspi->bitbang.master->dev.parent; | 441 | struct device *sdev = dspi->bitbang.master->dev.parent; |
@@ -956,7 +947,6 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
956 | master->num_chipselect = pdata->num_chipselect; | 947 | master->num_chipselect = pdata->num_chipselect; |
957 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); | 948 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16); |
958 | master->setup = davinci_spi_setup; | 949 | master->setup = davinci_spi_setup; |
959 | master->cleanup = davinci_spi_cleanup; | ||
960 | 950 | ||
961 | dspi->bitbang.chipselect = davinci_spi_chipselect; | 951 | dspi->bitbang.chipselect = davinci_spi_chipselect; |
962 | dspi->bitbang.setup_transfer = davinci_spi_setup_transfer; | 952 | dspi->bitbang.setup_transfer = davinci_spi_setup_transfer; |
@@ -967,6 +957,27 @@ static int davinci_spi_probe(struct platform_device *pdev) | |||
967 | if (dspi->version == SPI_VERSION_2) | 957 | if (dspi->version == SPI_VERSION_2) |
968 | dspi->bitbang.flags |= SPI_READY; | 958 | dspi->bitbang.flags |= SPI_READY; |
969 | 959 | ||
960 | if (pdev->dev.of_node) { | ||
961 | int i; | ||
962 | |||
963 | for (i = 0; i < pdata->num_chipselect; i++) { | ||
964 | int cs_gpio = of_get_named_gpio(pdev->dev.of_node, | ||
965 | "cs-gpios", i); | ||
966 | |||
967 | if (cs_gpio == -EPROBE_DEFER) { | ||
968 | ret = cs_gpio; | ||
969 | goto free_clk; | ||
970 | } | ||
971 | |||
972 | if (gpio_is_valid(cs_gpio)) { | ||
973 | ret = devm_gpio_request(&pdev->dev, cs_gpio, | ||
974 | dev_name(&pdev->dev)); | ||
975 | if (ret) | ||
976 | goto free_clk; | ||
977 | } | ||
978 | } | ||
979 | } | ||
980 | |||
970 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 981 | r = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
971 | if (r) | 982 | if (r) |
972 | dma_rx_chan = r->start; | 983 | dma_rx_chan = r->start; |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 670f0627f3bf..0dd0623319b0 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -547,8 +547,7 @@ static int dw_spi_setup(struct spi_device *spi) | |||
547 | /* Only alloc on first setup */ | 547 | /* Only alloc on first setup */ |
548 | chip = spi_get_ctldata(spi); | 548 | chip = spi_get_ctldata(spi); |
549 | if (!chip) { | 549 | if (!chip) { |
550 | chip = devm_kzalloc(&spi->dev, sizeof(struct chip_data), | 550 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); |
551 | GFP_KERNEL); | ||
552 | if (!chip) | 551 | if (!chip) |
553 | return -ENOMEM; | 552 | return -ENOMEM; |
554 | spi_set_ctldata(spi, chip); | 553 | spi_set_ctldata(spi, chip); |
@@ -606,6 +605,14 @@ static int dw_spi_setup(struct spi_device *spi) | |||
606 | return 0; | 605 | return 0; |
607 | } | 606 | } |
608 | 607 | ||
608 | static void dw_spi_cleanup(struct spi_device *spi) | ||
609 | { | ||
610 | struct chip_data *chip = spi_get_ctldata(spi); | ||
611 | |||
612 | kfree(chip); | ||
613 | spi_set_ctldata(spi, NULL); | ||
614 | } | ||
615 | |||
609 | /* Restart the controller, disable all interrupts, clean rx fifo */ | 616 | /* Restart the controller, disable all interrupts, clean rx fifo */ |
610 | static void spi_hw_init(struct dw_spi *dws) | 617 | static void spi_hw_init(struct dw_spi *dws) |
611 | { | 618 | { |
@@ -661,6 +668,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | |||
661 | master->bus_num = dws->bus_num; | 668 | master->bus_num = dws->bus_num; |
662 | master->num_chipselect = dws->num_cs; | 669 | master->num_chipselect = dws->num_cs; |
663 | master->setup = dw_spi_setup; | 670 | master->setup = dw_spi_setup; |
671 | master->cleanup = dw_spi_cleanup; | ||
664 | master->transfer_one_message = dw_spi_transfer_one_message; | 672 | master->transfer_one_message = dw_spi_transfer_one_message; |
665 | master->max_speed_hz = dws->max_freq; | 673 | master->max_speed_hz = dws->max_freq; |
666 | 674 | ||
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 8ebd724e4c59..429e11190265 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -452,16 +452,16 @@ static int fsl_espi_setup(struct spi_device *spi) | |||
452 | int retval; | 452 | int retval; |
453 | u32 hw_mode; | 453 | u32 hw_mode; |
454 | u32 loop_mode; | 454 | u32 loop_mode; |
455 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 455 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); |
456 | 456 | ||
457 | if (!spi->max_speed_hz) | 457 | if (!spi->max_speed_hz) |
458 | return -EINVAL; | 458 | return -EINVAL; |
459 | 459 | ||
460 | if (!cs) { | 460 | if (!cs) { |
461 | cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); | 461 | cs = kzalloc(sizeof(*cs), GFP_KERNEL); |
462 | if (!cs) | 462 | if (!cs) |
463 | return -ENOMEM; | 463 | return -ENOMEM; |
464 | spi->controller_state = cs; | 464 | spi_set_ctldata(spi, cs); |
465 | } | 465 | } |
466 | 466 | ||
467 | mpc8xxx_spi = spi_master_get_devdata(spi->master); | 467 | mpc8xxx_spi = spi_master_get_devdata(spi->master); |
@@ -496,6 +496,14 @@ static int fsl_espi_setup(struct spi_device *spi) | |||
496 | return 0; | 496 | return 0; |
497 | } | 497 | } |
498 | 498 | ||
499 | static void fsl_espi_cleanup(struct spi_device *spi) | ||
500 | { | ||
501 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); | ||
502 | |||
503 | kfree(cs); | ||
504 | spi_set_ctldata(spi, NULL); | ||
505 | } | ||
506 | |||
499 | void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) | 507 | void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) |
500 | { | 508 | { |
501 | struct fsl_espi_reg *reg_base = mspi->reg_base; | 509 | struct fsl_espi_reg *reg_base = mspi->reg_base; |
@@ -605,6 +613,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev, | |||
605 | 613 | ||
606 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); | 614 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); |
607 | master->setup = fsl_espi_setup; | 615 | master->setup = fsl_espi_setup; |
616 | master->cleanup = fsl_espi_cleanup; | ||
608 | 617 | ||
609 | mpc8xxx_spi = spi_master_get_devdata(master); | 618 | mpc8xxx_spi = spi_master_get_devdata(master); |
610 | mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg; | 619 | mpc8xxx_spi->spi_do_one_msg = fsl_espi_do_one_msg; |
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 9452f6740997..590f31bc0aba 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -425,16 +425,16 @@ static int fsl_spi_setup(struct spi_device *spi) | |||
425 | struct fsl_spi_reg *reg_base; | 425 | struct fsl_spi_reg *reg_base; |
426 | int retval; | 426 | int retval; |
427 | u32 hw_mode; | 427 | u32 hw_mode; |
428 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 428 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); |
429 | 429 | ||
430 | if (!spi->max_speed_hz) | 430 | if (!spi->max_speed_hz) |
431 | return -EINVAL; | 431 | return -EINVAL; |
432 | 432 | ||
433 | if (!cs) { | 433 | if (!cs) { |
434 | cs = devm_kzalloc(&spi->dev, sizeof(*cs), GFP_KERNEL); | 434 | cs = kzalloc(sizeof(*cs), GFP_KERNEL); |
435 | if (!cs) | 435 | if (!cs) |
436 | return -ENOMEM; | 436 | return -ENOMEM; |
437 | spi->controller_state = cs; | 437 | spi_set_ctldata(spi, cs); |
438 | } | 438 | } |
439 | mpc8xxx_spi = spi_master_get_devdata(spi->master); | 439 | mpc8xxx_spi = spi_master_get_devdata(spi->master); |
440 | 440 | ||
@@ -496,9 +496,13 @@ static int fsl_spi_setup(struct spi_device *spi) | |||
496 | static void fsl_spi_cleanup(struct spi_device *spi) | 496 | static void fsl_spi_cleanup(struct spi_device *spi) |
497 | { | 497 | { |
498 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 498 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); |
499 | struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi); | ||
499 | 500 | ||
500 | if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) | 501 | if (mpc8xxx_spi->type == TYPE_GRLIB && gpio_is_valid(spi->cs_gpio)) |
501 | gpio_free(spi->cs_gpio); | 502 | gpio_free(spi->cs_gpio); |
503 | |||
504 | kfree(cs); | ||
505 | spi_set_ctldata(spi, NULL); | ||
502 | } | 506 | } |
503 | 507 | ||
504 | static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) | 508 | static void fsl_spi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 1189cfd96477..f1f0a587e4fc 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -2136,7 +2136,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2136 | cs_gpio); | 2136 | cs_gpio); |
2137 | else if (gpio_direction_output(cs_gpio, 1)) | 2137 | else if (gpio_direction_output(cs_gpio, 1)) |
2138 | dev_err(&adev->dev, | 2138 | dev_err(&adev->dev, |
2139 | "could set gpio %d as output\n", | 2139 | "could not set gpio %d as output\n", |
2140 | cs_gpio); | 2140 | cs_gpio); |
2141 | } | 2141 | } |
2142 | } | 2142 | } |
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index cd0e08b0c9f6..3afc266b666d 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
@@ -220,7 +220,7 @@ static inline void wait_for_idle(struct rockchip_spi *rs) | |||
220 | do { | 220 | do { |
221 | if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) | 221 | if (!(readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)) |
222 | return; | 222 | return; |
223 | } while (time_before(jiffies, timeout)); | 223 | } while (!time_after(jiffies, timeout)); |
224 | 224 | ||
225 | dev_warn(rs->dev, "spi controller is in busy state!\n"); | 225 | dev_warn(rs->dev, "spi controller is in busy state!\n"); |
226 | } | 226 | } |
@@ -529,7 +529,8 @@ static int rockchip_spi_transfer_one( | |||
529 | int ret = 0; | 529 | int ret = 0; |
530 | struct rockchip_spi *rs = spi_master_get_devdata(master); | 530 | struct rockchip_spi *rs = spi_master_get_devdata(master); |
531 | 531 | ||
532 | WARN_ON((readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); | 532 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && |
533 | (readl_relaxed(rs->regs + ROCKCHIP_SPI_SR) & SR_BUSY)); | ||
533 | 534 | ||
534 | if (!xfer->tx_buf && !xfer->rx_buf) { | 535 | if (!xfer->tx_buf && !xfer->rx_buf) { |
535 | dev_err(rs->dev, "No buffer for transfer\n"); | 536 | dev_err(rs->dev, "No buffer for transfer\n"); |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 95ac276eaafe..6f0602fd7401 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -312,6 +312,8 @@ static int spi_sirfsoc_cmd_transfer(struct spi_device *spi, | |||
312 | u32 cmd; | 312 | u32 cmd; |
313 | 313 | ||
314 | sspi = spi_master_get_devdata(spi->master); | 314 | sspi = spi_master_get_devdata(spi->master); |
315 | writel(SIRFSOC_SPI_FIFO_RESET, sspi->base + SIRFSOC_SPI_TXFIFO_OP); | ||
316 | writel(SIRFSOC_SPI_FIFO_START, sspi->base + SIRFSOC_SPI_TXFIFO_OP); | ||
315 | memcpy(&cmd, sspi->tx, t->len); | 317 | memcpy(&cmd, sspi->tx, t->len); |
316 | if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST)) | 318 | if (sspi->word_width == 1 && !(spi->mode & SPI_LSB_FIRST)) |
317 | cmd = cpu_to_be32(cmd) >> | 319 | cmd = cpu_to_be32(cmd) >> |
@@ -438,7 +440,8 @@ static void spi_sirfsoc_pio_transfer(struct spi_device *spi, | |||
438 | sspi->tx_word(sspi); | 440 | sspi->tx_word(sspi); |
439 | writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN | | 441 | writel(SIRFSOC_SPI_TXFIFO_EMPTY_INT_EN | |
440 | SIRFSOC_SPI_TX_UFLOW_INT_EN | | 442 | SIRFSOC_SPI_TX_UFLOW_INT_EN | |
441 | SIRFSOC_SPI_RX_OFLOW_INT_EN, | 443 | SIRFSOC_SPI_RX_OFLOW_INT_EN | |
444 | SIRFSOC_SPI_RX_IO_DMA_INT_EN, | ||
442 | sspi->base + SIRFSOC_SPI_INT_EN); | 445 | sspi->base + SIRFSOC_SPI_INT_EN); |
443 | writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN, | 446 | writel(SIRFSOC_SPI_RX_EN | SIRFSOC_SPI_TX_EN, |
444 | sspi->base + SIRFSOC_SPI_TX_RX_EN); | 447 | sspi->base + SIRFSOC_SPI_TX_RX_EN); |
diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c index 19396dc4ee47..bed2fedeb057 100644 --- a/drivers/ssb/b43_pci_bridge.c +++ b/drivers/ssb/b43_pci_bridge.c | |||
@@ -38,6 +38,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = { | |||
38 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432b) }, | 38 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432b) }, |
39 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432c) }, | 39 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432c) }, |
40 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4350) }, | 40 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4350) }, |
41 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4351) }, | ||
41 | { 0, }, | 42 | { 0, }, |
42 | }; | 43 | }; |
43 | MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl); | 44 | MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl); |
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index e7b2e0234196..69139ce7420d 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c | |||
@@ -199,7 +199,6 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) | |||
199 | fence->num_fences = 1; | 199 | fence->num_fences = 1; |
200 | atomic_set(&fence->status, 1); | 200 | atomic_set(&fence->status, 1); |
201 | 201 | ||
202 | fence_get(&pt->base); | ||
203 | fence->cbs[0].sync_pt = &pt->base; | 202 | fence->cbs[0].sync_pt = &pt->base; |
204 | fence->cbs[0].fence = fence; | 203 | fence->cbs[0].fence = fence; |
205 | if (fence_add_callback(&pt->base, &fence->cbs[0].cb, | 204 | if (fence_add_callback(&pt->base, &fence->cbs[0].cb, |
diff --git a/drivers/staging/iio/meter/ade7758_trigger.c b/drivers/staging/iio/meter/ade7758_trigger.c index ea01b8f7a2c3..6f45ce0478d7 100644 --- a/drivers/staging/iio/meter/ade7758_trigger.c +++ b/drivers/staging/iio/meter/ade7758_trigger.c | |||
@@ -85,7 +85,7 @@ int ade7758_probe_trigger(struct iio_dev *indio_dev) | |||
85 | ret = iio_trigger_register(st->trig); | 85 | ret = iio_trigger_register(st->trig); |
86 | 86 | ||
87 | /* select default trigger */ | 87 | /* select default trigger */ |
88 | indio_dev->trig = st->trig; | 88 | indio_dev->trig = iio_trigger_get(st->trig); |
89 | if (ret) | 89 | if (ret) |
90 | goto error_free_irq; | 90 | goto error_free_irq; |
91 | 91 | ||
diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index 7e3f019d7e72..4662e00b456a 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c | |||
@@ -574,6 +574,9 @@ static void imx_ldb_unbind(struct device *dev, struct device *master, | |||
574 | for (i = 0; i < 2; i++) { | 574 | for (i = 0; i < 2; i++) { |
575 | struct imx_ldb_channel *channel = &imx_ldb->channel[i]; | 575 | struct imx_ldb_channel *channel = &imx_ldb->channel[i]; |
576 | 576 | ||
577 | if (!channel->connector.funcs) | ||
578 | continue; | ||
579 | |||
577 | channel->connector.funcs->destroy(&channel->connector); | 580 | channel->connector.funcs->destroy(&channel->connector); |
578 | channel->encoder.funcs->destroy(&channel->encoder); | 581 | channel->encoder.funcs->destroy(&channel->encoder); |
579 | } | 582 | } |
diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c index 6f393a11f44d..50de10a550e9 100644 --- a/drivers/staging/imx-drm/ipuv3-plane.c +++ b/drivers/staging/imx-drm/ipuv3-plane.c | |||
@@ -281,7 +281,8 @@ static void ipu_plane_dpms(struct ipu_plane *ipu_plane, int mode) | |||
281 | 281 | ||
282 | ipu_idmac_put(ipu_plane->ipu_ch); | 282 | ipu_idmac_put(ipu_plane->ipu_ch); |
283 | ipu_dmfc_put(ipu_plane->dmfc); | 283 | ipu_dmfc_put(ipu_plane->dmfc); |
284 | ipu_dp_put(ipu_plane->dp); | 284 | if (ipu_plane->dp) |
285 | ipu_dp_put(ipu_plane->dp); | ||
285 | } | 286 | } |
286 | } | 287 | } |
287 | 288 | ||
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 0367f5a2cfe4..0c59e26c0805 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c | |||
@@ -568,7 +568,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, | |||
568 | if (sb->s_root == NULL) { | 568 | if (sb->s_root == NULL) { |
569 | CERROR("%s: can't make root dentry\n", | 569 | CERROR("%s: can't make root dentry\n", |
570 | ll_get_fsname(sb, NULL, 0)); | 570 | ll_get_fsname(sb, NULL, 0)); |
571 | GOTO(out_root, err = -ENOMEM); | 571 | GOTO(out_lock_cn_cb, err = -ENOMEM); |
572 | } | 572 | } |
573 | 573 | ||
574 | sbi->ll_sdev_orig = sb->s_dev; | 574 | sbi->ll_sdev_orig = sb->s_dev; |
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c index f105c2ac091b..164136b07a68 100644 --- a/drivers/staging/vt6655/hostap.c +++ b/drivers/staging/vt6655/hostap.c | |||
@@ -350,6 +350,9 @@ static int hostap_set_generic_element(PSDevice pDevice, | |||
350 | { | 350 | { |
351 | PSMgmtObject pMgmt = pDevice->pMgmt; | 351 | PSMgmtObject pMgmt = pDevice->pMgmt; |
352 | 352 | ||
353 | if (param->u.generic_elem.len > sizeof(pMgmt->abyWPAIE)) | ||
354 | return -EINVAL; | ||
355 | |||
353 | memcpy(pMgmt->abyWPAIE, | 356 | memcpy(pMgmt->abyWPAIE, |
354 | param->u.generic_elem.data, | 357 | param->u.generic_elem.data, |
355 | param->u.generic_elem.len | 358 | param->u.generic_elem.len |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 1f4c794f5fcc..260c3e1e312c 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -4540,6 +4540,7 @@ static void iscsit_logout_post_handler_diffcid( | |||
4540 | { | 4540 | { |
4541 | struct iscsi_conn *l_conn; | 4541 | struct iscsi_conn *l_conn; |
4542 | struct iscsi_session *sess = conn->sess; | 4542 | struct iscsi_session *sess = conn->sess; |
4543 | bool conn_found = false; | ||
4543 | 4544 | ||
4544 | if (!sess) | 4545 | if (!sess) |
4545 | return; | 4546 | return; |
@@ -4548,12 +4549,13 @@ static void iscsit_logout_post_handler_diffcid( | |||
4548 | list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { | 4549 | list_for_each_entry(l_conn, &sess->sess_conn_list, conn_list) { |
4549 | if (l_conn->cid == cid) { | 4550 | if (l_conn->cid == cid) { |
4550 | iscsit_inc_conn_usage_count(l_conn); | 4551 | iscsit_inc_conn_usage_count(l_conn); |
4552 | conn_found = true; | ||
4551 | break; | 4553 | break; |
4552 | } | 4554 | } |
4553 | } | 4555 | } |
4554 | spin_unlock_bh(&sess->conn_lock); | 4556 | spin_unlock_bh(&sess->conn_lock); |
4555 | 4557 | ||
4556 | if (!l_conn) | 4558 | if (!conn_found) |
4557 | return; | 4559 | return; |
4558 | 4560 | ||
4559 | if (l_conn->sock) | 4561 | if (l_conn->sock) |
diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 02f9de26f38a..18c29260b4a2 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c | |||
@@ -601,7 +601,7 @@ int iscsi_copy_param_list( | |||
601 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); | 601 | param_list = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); |
602 | if (!param_list) { | 602 | if (!param_list) { |
603 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); | 603 | pr_err("Unable to allocate memory for struct iscsi_param_list.\n"); |
604 | goto err_out; | 604 | return -1; |
605 | } | 605 | } |
606 | INIT_LIST_HEAD(¶m_list->param_list); | 606 | INIT_LIST_HEAD(¶m_list->param_list); |
607 | INIT_LIST_HEAD(¶m_list->extra_response_list); | 607 | INIT_LIST_HEAD(¶m_list->extra_response_list); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index fd90b28f1d94..73355f4fca74 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -400,6 +400,8 @@ struct iscsi_cmd *iscsit_find_cmd_from_itt_or_dump( | |||
400 | 400 | ||
401 | spin_lock_bh(&conn->cmd_lock); | 401 | spin_lock_bh(&conn->cmd_lock); |
402 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { | 402 | list_for_each_entry(cmd, &conn->conn_cmd_list, i_conn_node) { |
403 | if (cmd->cmd_flags & ICF_GOT_LAST_DATAOUT) | ||
404 | continue; | ||
403 | if (cmd->init_task_tag == init_task_tag) { | 405 | if (cmd->init_task_tag == init_task_tag) { |
404 | spin_unlock_bh(&conn->cmd_lock); | 406 | spin_unlock_bh(&conn->cmd_lock); |
405 | return cmd; | 407 | return cmd; |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index bf55c5a04cfa..756def38c77a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -2363,7 +2363,7 @@ static ssize_t target_core_alua_tg_pt_gp_store_attr_alua_support_##_name(\ | |||
2363 | pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ | 2363 | pr_err("Invalid value '%ld', must be '0' or '1'\n", tmp); \ |
2364 | return -EINVAL; \ | 2364 | return -EINVAL; \ |
2365 | } \ | 2365 | } \ |
2366 | if (!tmp) \ | 2366 | if (tmp) \ |
2367 | t->_var |= _bit; \ | 2367 | t->_var |= _bit; \ |
2368 | else \ | 2368 | else \ |
2369 | t->_var &= ~_bit; \ | 2369 | t->_var &= ~_bit; \ |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 6cd7222738fc..bc286a67af7c 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -664,7 +664,7 @@ spc_emulate_evpd_b3(struct se_cmd *cmd, unsigned char *buf) | |||
664 | buf[0] = dev->transport->get_device_type(dev); | 664 | buf[0] = dev->transport->get_device_type(dev); |
665 | buf[3] = 0x0c; | 665 | buf[3] = 0x0c; |
666 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]); | 666 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[8]); |
667 | put_unaligned_be32(dev->t10_alua.lba_map_segment_size, &buf[12]); | 667 | put_unaligned_be32(dev->t10_alua.lba_map_segment_multiplier, &buf[12]); |
668 | 668 | ||
669 | return 0; | 669 | return 0; |
670 | } | 670 | } |
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index 4db7987ec225..57d9df84ce5d 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c | |||
@@ -540,6 +540,7 @@ static const struct acpi_device_id dw8250_acpi_match[] = { | |||
540 | { "INT3434", 0 }, | 540 | { "INT3434", 0 }, |
541 | { "INT3435", 0 }, | 541 | { "INT3435", 0 }, |
542 | { "80860F0A", 0 }, | 542 | { "80860F0A", 0 }, |
543 | { "8086228A", 0 }, | ||
543 | { }, | 544 | { }, |
544 | }; | 545 | }; |
545 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); | 546 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 7b63677475c1..d7d4584549a5 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -527,6 +527,45 @@ static void atmel_enable_ms(struct uart_port *port) | |||
527 | } | 527 | } |
528 | 528 | ||
529 | /* | 529 | /* |
530 | * Disable modem status interrupts | ||
531 | */ | ||
532 | static void atmel_disable_ms(struct uart_port *port) | ||
533 | { | ||
534 | struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); | ||
535 | uint32_t idr = 0; | ||
536 | |||
537 | /* | ||
538 | * Interrupt should not be disabled twice | ||
539 | */ | ||
540 | if (!atmel_port->ms_irq_enabled) | ||
541 | return; | ||
542 | |||
543 | atmel_port->ms_irq_enabled = false; | ||
544 | |||
545 | if (atmel_port->gpio_irq[UART_GPIO_CTS] >= 0) | ||
546 | disable_irq(atmel_port->gpio_irq[UART_GPIO_CTS]); | ||
547 | else | ||
548 | idr |= ATMEL_US_CTSIC; | ||
549 | |||
550 | if (atmel_port->gpio_irq[UART_GPIO_DSR] >= 0) | ||
551 | disable_irq(atmel_port->gpio_irq[UART_GPIO_DSR]); | ||
552 | else | ||
553 | idr |= ATMEL_US_DSRIC; | ||
554 | |||
555 | if (atmel_port->gpio_irq[UART_GPIO_RI] >= 0) | ||
556 | disable_irq(atmel_port->gpio_irq[UART_GPIO_RI]); | ||
557 | else | ||
558 | idr |= ATMEL_US_RIIC; | ||
559 | |||
560 | if (atmel_port->gpio_irq[UART_GPIO_DCD] >= 0) | ||
561 | disable_irq(atmel_port->gpio_irq[UART_GPIO_DCD]); | ||
562 | else | ||
563 | idr |= ATMEL_US_DCDIC; | ||
564 | |||
565 | UART_PUT_IDR(port, idr); | ||
566 | } | ||
567 | |||
568 | /* | ||
530 | * Control the transmission of a break signal | 569 | * Control the transmission of a break signal |
531 | */ | 570 | */ |
532 | static void atmel_break_ctl(struct uart_port *port, int break_state) | 571 | static void atmel_break_ctl(struct uart_port *port, int break_state) |
@@ -1993,7 +2032,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1993 | 2032 | ||
1994 | /* CTS flow-control and modem-status interrupts */ | 2033 | /* CTS flow-control and modem-status interrupts */ |
1995 | if (UART_ENABLE_MS(port, termios->c_cflag)) | 2034 | if (UART_ENABLE_MS(port, termios->c_cflag)) |
1996 | port->ops->enable_ms(port); | 2035 | atmel_enable_ms(port); |
2036 | else | ||
2037 | atmel_disable_ms(port); | ||
1997 | 2038 | ||
1998 | spin_unlock_irqrestore(&port->lock, flags); | 2039 | spin_unlock_irqrestore(&port->lock, flags); |
1999 | } | 2040 | } |
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 01951d27cc03..806e4bcadbd7 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -581,7 +581,7 @@ static unsigned int cdns_uart_tx_empty(struct uart_port *port) | |||
581 | { | 581 | { |
582 | unsigned int status; | 582 | unsigned int status; |
583 | 583 | ||
584 | status = cdns_uart_readl(CDNS_UART_ISR_OFFSET) & CDNS_UART_IXR_TXEMPTY; | 584 | status = cdns_uart_readl(CDNS_UART_SR_OFFSET) & CDNS_UART_SR_TXEMPTY; |
585 | return status ? TIOCSER_TEMT : 0; | 585 | return status ? TIOCSER_TEMT : 0; |
586 | } | 586 | } |
587 | 587 | ||
diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c b/drivers/usb/chipidea/ci_hdrc_msm.c index d72b9d2de2c5..4935ac38fd00 100644 --- a/drivers/usb/chipidea/ci_hdrc_msm.c +++ b/drivers/usb/chipidea/ci_hdrc_msm.c | |||
@@ -20,13 +20,13 @@ | |||
20 | static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) | 20 | static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) |
21 | { | 21 | { |
22 | struct device *dev = ci->gadget.dev.parent; | 22 | struct device *dev = ci->gadget.dev.parent; |
23 | int val; | ||
24 | 23 | ||
25 | switch (event) { | 24 | switch (event) { |
26 | case CI_HDRC_CONTROLLER_RESET_EVENT: | 25 | case CI_HDRC_CONTROLLER_RESET_EVENT: |
27 | dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); | 26 | dev_dbg(dev, "CI_HDRC_CONTROLLER_RESET_EVENT received\n"); |
28 | writel(0, USB_AHBBURST); | 27 | writel(0, USB_AHBBURST); |
29 | writel(0, USB_AHBMODE); | 28 | writel(0, USB_AHBMODE); |
29 | usb_phy_init(ci->transceiver); | ||
30 | break; | 30 | break; |
31 | case CI_HDRC_CONTROLLER_STOPPED_EVENT: | 31 | case CI_HDRC_CONTROLLER_STOPPED_EVENT: |
32 | dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); | 32 | dev_dbg(dev, "CI_HDRC_CONTROLLER_STOPPED_EVENT received\n"); |
@@ -34,10 +34,7 @@ static void ci_hdrc_msm_notify_event(struct ci_hdrc *ci, unsigned event) | |||
34 | * Put the transceiver in non-driving mode. Otherwise host | 34 | * Put the transceiver in non-driving mode. Otherwise host |
35 | * may not detect soft-disconnection. | 35 | * may not detect soft-disconnection. |
36 | */ | 36 | */ |
37 | val = usb_phy_io_read(ci->transceiver, ULPI_FUNC_CTRL); | 37 | usb_phy_notify_disconnect(ci->transceiver, USB_SPEED_UNKNOWN); |
38 | val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | ||
39 | val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | ||
40 | usb_phy_io_write(ci->transceiver, val, ULPI_FUNC_CTRL); | ||
41 | break; | 38 | break; |
42 | default: | 39 | default: |
43 | dev_dbg(dev, "unknown ci_hdrc event\n"); | 40 | dev_dbg(dev, "unknown ci_hdrc event\n"); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 46f5161c7891..d481c99a20d7 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -5024,9 +5024,10 @@ static void hub_events(void) | |||
5024 | 5024 | ||
5025 | hub = list_entry(tmp, struct usb_hub, event_list); | 5025 | hub = list_entry(tmp, struct usb_hub, event_list); |
5026 | kref_get(&hub->kref); | 5026 | kref_get(&hub->kref); |
5027 | hdev = hub->hdev; | ||
5028 | usb_get_dev(hdev); | ||
5027 | spin_unlock_irq(&hub_event_lock); | 5029 | spin_unlock_irq(&hub_event_lock); |
5028 | 5030 | ||
5029 | hdev = hub->hdev; | ||
5030 | hub_dev = hub->intfdev; | 5031 | hub_dev = hub->intfdev; |
5031 | intf = to_usb_interface(hub_dev); | 5032 | intf = to_usb_interface(hub_dev); |
5032 | dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", | 5033 | dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n", |
@@ -5139,6 +5140,7 @@ static void hub_events(void) | |||
5139 | usb_autopm_put_interface(intf); | 5140 | usb_autopm_put_interface(intf); |
5140 | loop_disconnected: | 5141 | loop_disconnected: |
5141 | usb_unlock_device(hdev); | 5142 | usb_unlock_device(hdev); |
5143 | usb_put_dev(hdev); | ||
5142 | kref_put(&hub->kref, hub_release); | 5144 | kref_put(&hub->kref, hub_release); |
5143 | 5145 | ||
5144 | } /* end while (1) */ | 5146 | } /* end while (1) */ |
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7c9618e916e2..ce6071d65d51 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -1649,6 +1649,7 @@ static void s3c_hsotg_txfifo_flush(struct s3c_hsotg *hsotg, unsigned int idx) | |||
1649 | dev_err(hsotg->dev, | 1649 | dev_err(hsotg->dev, |
1650 | "%s: timeout flushing fifo (GRSTCTL=%08x)\n", | 1650 | "%s: timeout flushing fifo (GRSTCTL=%08x)\n", |
1651 | __func__, val); | 1651 | __func__, val); |
1652 | break; | ||
1652 | } | 1653 | } |
1653 | 1654 | ||
1654 | udelay(1); | 1655 | udelay(1); |
@@ -2747,13 +2748,14 @@ static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) | |||
2747 | 2748 | ||
2748 | dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); | 2749 | dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev); |
2749 | 2750 | ||
2750 | if (hsotg->phy) { | 2751 | if (hsotg->uphy) |
2751 | phy_init(hsotg->phy); | ||
2752 | phy_power_on(hsotg->phy); | ||
2753 | } else if (hsotg->uphy) | ||
2754 | usb_phy_init(hsotg->uphy); | 2752 | usb_phy_init(hsotg->uphy); |
2755 | else if (hsotg->plat->phy_init) | 2753 | else if (hsotg->plat && hsotg->plat->phy_init) |
2756 | hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); | 2754 | hsotg->plat->phy_init(pdev, hsotg->plat->phy_type); |
2755 | else { | ||
2756 | phy_init(hsotg->phy); | ||
2757 | phy_power_on(hsotg->phy); | ||
2758 | } | ||
2757 | } | 2759 | } |
2758 | 2760 | ||
2759 | /** | 2761 | /** |
@@ -2767,13 +2769,14 @@ static void s3c_hsotg_phy_disable(struct s3c_hsotg *hsotg) | |||
2767 | { | 2769 | { |
2768 | struct platform_device *pdev = to_platform_device(hsotg->dev); | 2770 | struct platform_device *pdev = to_platform_device(hsotg->dev); |
2769 | 2771 | ||
2770 | if (hsotg->phy) { | 2772 | if (hsotg->uphy) |
2771 | phy_power_off(hsotg->phy); | ||
2772 | phy_exit(hsotg->phy); | ||
2773 | } else if (hsotg->uphy) | ||
2774 | usb_phy_shutdown(hsotg->uphy); | 2773 | usb_phy_shutdown(hsotg->uphy); |
2775 | else if (hsotg->plat->phy_exit) | 2774 | else if (hsotg->plat && hsotg->plat->phy_exit) |
2776 | hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); | 2775 | hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type); |
2776 | else { | ||
2777 | phy_power_off(hsotg->phy); | ||
2778 | phy_exit(hsotg->phy); | ||
2779 | } | ||
2777 | } | 2780 | } |
2778 | 2781 | ||
2779 | /** | 2782 | /** |
@@ -2892,13 +2895,11 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
2892 | return -ENODEV; | 2895 | return -ENODEV; |
2893 | 2896 | ||
2894 | /* all endpoints should be shutdown */ | 2897 | /* all endpoints should be shutdown */ |
2895 | for (ep = 0; ep < hsotg->num_of_eps; ep++) | 2898 | for (ep = 1; ep < hsotg->num_of_eps; ep++) |
2896 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); | 2899 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); |
2897 | 2900 | ||
2898 | spin_lock_irqsave(&hsotg->lock, flags); | 2901 | spin_lock_irqsave(&hsotg->lock, flags); |
2899 | 2902 | ||
2900 | s3c_hsotg_phy_disable(hsotg); | ||
2901 | |||
2902 | if (!driver) | 2903 | if (!driver) |
2903 | hsotg->driver = NULL; | 2904 | hsotg->driver = NULL; |
2904 | 2905 | ||
@@ -2941,7 +2942,6 @@ static int s3c_hsotg_pullup(struct usb_gadget *gadget, int is_on) | |||
2941 | s3c_hsotg_phy_enable(hsotg); | 2942 | s3c_hsotg_phy_enable(hsotg); |
2942 | s3c_hsotg_core_init(hsotg); | 2943 | s3c_hsotg_core_init(hsotg); |
2943 | } else { | 2944 | } else { |
2944 | s3c_hsotg_disconnect(hsotg); | ||
2945 | s3c_hsotg_phy_disable(hsotg); | 2945 | s3c_hsotg_phy_disable(hsotg); |
2946 | } | 2946 | } |
2947 | 2947 | ||
@@ -3441,13 +3441,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3441 | 3441 | ||
3442 | hsotg->irq = ret; | 3442 | hsotg->irq = ret; |
3443 | 3443 | ||
3444 | ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0, | ||
3445 | dev_name(dev), hsotg); | ||
3446 | if (ret < 0) { | ||
3447 | dev_err(dev, "cannot claim IRQ\n"); | ||
3448 | goto err_clk; | ||
3449 | } | ||
3450 | |||
3451 | dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq); | 3444 | dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq); |
3452 | 3445 | ||
3453 | hsotg->gadget.max_speed = USB_SPEED_HIGH; | 3446 | hsotg->gadget.max_speed = USB_SPEED_HIGH; |
@@ -3488,9 +3481,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3488 | if (hsotg->phy && (phy_get_bus_width(phy) == 8)) | 3481 | if (hsotg->phy && (phy_get_bus_width(phy) == 8)) |
3489 | hsotg->phyif = GUSBCFG_PHYIF8; | 3482 | hsotg->phyif = GUSBCFG_PHYIF8; |
3490 | 3483 | ||
3491 | if (hsotg->phy) | ||
3492 | phy_init(hsotg->phy); | ||
3493 | |||
3494 | /* usb phy enable */ | 3484 | /* usb phy enable */ |
3495 | s3c_hsotg_phy_enable(hsotg); | 3485 | s3c_hsotg_phy_enable(hsotg); |
3496 | 3486 | ||
@@ -3498,6 +3488,17 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3498 | s3c_hsotg_init(hsotg); | 3488 | s3c_hsotg_init(hsotg); |
3499 | s3c_hsotg_hw_cfg(hsotg); | 3489 | s3c_hsotg_hw_cfg(hsotg); |
3500 | 3490 | ||
3491 | ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0, | ||
3492 | dev_name(dev), hsotg); | ||
3493 | if (ret < 0) { | ||
3494 | s3c_hsotg_phy_disable(hsotg); | ||
3495 | clk_disable_unprepare(hsotg->clk); | ||
3496 | regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), | ||
3497 | hsotg->supplies); | ||
3498 | dev_err(dev, "cannot claim IRQ\n"); | ||
3499 | goto err_clk; | ||
3500 | } | ||
3501 | |||
3501 | /* hsotg->num_of_eps holds number of EPs other than ep0 */ | 3502 | /* hsotg->num_of_eps holds number of EPs other than ep0 */ |
3502 | 3503 | ||
3503 | if (hsotg->num_of_eps == 0) { | 3504 | if (hsotg->num_of_eps == 0) { |
@@ -3582,9 +3583,6 @@ static int s3c_hsotg_remove(struct platform_device *pdev) | |||
3582 | usb_gadget_unregister_driver(hsotg->driver); | 3583 | usb_gadget_unregister_driver(hsotg->driver); |
3583 | } | 3584 | } |
3584 | 3585 | ||
3585 | s3c_hsotg_phy_disable(hsotg); | ||
3586 | if (hsotg->phy) | ||
3587 | phy_exit(hsotg->phy); | ||
3588 | clk_disable_unprepare(hsotg->clk); | 3586 | clk_disable_unprepare(hsotg->clk); |
3589 | 3587 | ||
3590 | return 0; | 3588 | return 0; |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b769c1faaf03..9069984fe5cf 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -799,20 +799,21 @@ static int dwc3_remove(struct platform_device *pdev) | |||
799 | { | 799 | { |
800 | struct dwc3 *dwc = platform_get_drvdata(pdev); | 800 | struct dwc3 *dwc = platform_get_drvdata(pdev); |
801 | 801 | ||
802 | dwc3_debugfs_exit(dwc); | ||
803 | dwc3_core_exit_mode(dwc); | ||
804 | dwc3_event_buffers_cleanup(dwc); | ||
805 | dwc3_free_event_buffers(dwc); | ||
806 | |||
802 | usb_phy_set_suspend(dwc->usb2_phy, 1); | 807 | usb_phy_set_suspend(dwc->usb2_phy, 1); |
803 | usb_phy_set_suspend(dwc->usb3_phy, 1); | 808 | usb_phy_set_suspend(dwc->usb3_phy, 1); |
804 | phy_power_off(dwc->usb2_generic_phy); | 809 | phy_power_off(dwc->usb2_generic_phy); |
805 | phy_power_off(dwc->usb3_generic_phy); | 810 | phy_power_off(dwc->usb3_generic_phy); |
806 | 811 | ||
812 | dwc3_core_exit(dwc); | ||
813 | |||
807 | pm_runtime_put_sync(&pdev->dev); | 814 | pm_runtime_put_sync(&pdev->dev); |
808 | pm_runtime_disable(&pdev->dev); | 815 | pm_runtime_disable(&pdev->dev); |
809 | 816 | ||
810 | dwc3_debugfs_exit(dwc); | ||
811 | dwc3_core_exit_mode(dwc); | ||
812 | dwc3_event_buffers_cleanup(dwc); | ||
813 | dwc3_free_event_buffers(dwc); | ||
814 | dwc3_core_exit(dwc); | ||
815 | |||
816 | return 0; | 817 | return 0; |
817 | } | 818 | } |
818 | 819 | ||
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 9dcfbe7cd5f5..fc0de3753648 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -576,9 +576,9 @@ static int dwc3_omap_remove(struct platform_device *pdev) | |||
576 | if (omap->extcon_id_dev.edev) | 576 | if (omap->extcon_id_dev.edev) |
577 | extcon_unregister_interest(&omap->extcon_id_dev); | 577 | extcon_unregister_interest(&omap->extcon_id_dev); |
578 | dwc3_omap_disable_irqs(omap); | 578 | dwc3_omap_disable_irqs(omap); |
579 | device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); | ||
579 | pm_runtime_put_sync(&pdev->dev); | 580 | pm_runtime_put_sync(&pdev->dev); |
580 | pm_runtime_disable(&pdev->dev); | 581 | pm_runtime_disable(&pdev->dev); |
581 | device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core); | ||
582 | 582 | ||
583 | return 0; | 583 | return 0; |
584 | } | 584 | } |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 349cacc577d8..490a6ca00733 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -527,7 +527,7 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep, | |||
527 | dep->stream_capable = true; | 527 | dep->stream_capable = true; |
528 | } | 528 | } |
529 | 529 | ||
530 | if (usb_endpoint_xfer_isoc(desc)) | 530 | if (!usb_endpoint_xfer_control(desc)) |
531 | params.param1 |= DWC3_DEPCFG_XFER_IN_PROGRESS_EN; | 531 | params.param1 |= DWC3_DEPCFG_XFER_IN_PROGRESS_EN; |
532 | 532 | ||
533 | /* | 533 | /* |
@@ -1225,16 +1225,17 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request, | |||
1225 | 1225 | ||
1226 | int ret; | 1226 | int ret; |
1227 | 1227 | ||
1228 | spin_lock_irqsave(&dwc->lock, flags); | ||
1228 | if (!dep->endpoint.desc) { | 1229 | if (!dep->endpoint.desc) { |
1229 | dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", | 1230 | dev_dbg(dwc->dev, "trying to queue request %p to disabled %s\n", |
1230 | request, ep->name); | 1231 | request, ep->name); |
1232 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
1231 | return -ESHUTDOWN; | 1233 | return -ESHUTDOWN; |
1232 | } | 1234 | } |
1233 | 1235 | ||
1234 | dev_vdbg(dwc->dev, "queing request %p to %s length %d\n", | 1236 | dev_vdbg(dwc->dev, "queing request %p to %s length %d\n", |
1235 | request, ep->name, request->length); | 1237 | request, ep->name, request->length); |
1236 | 1238 | ||
1237 | spin_lock_irqsave(&dwc->lock, flags); | ||
1238 | ret = __dwc3_gadget_ep_queue(dep, req); | 1239 | ret = __dwc3_gadget_ep_queue(dep, req); |
1239 | spin_unlock_irqrestore(&dwc->lock, flags); | 1240 | spin_unlock_irqrestore(&dwc->lock, flags); |
1240 | 1241 | ||
@@ -2041,12 +2042,6 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, | |||
2041 | dwc3_endpoint_transfer_complete(dwc, dep, event); | 2042 | dwc3_endpoint_transfer_complete(dwc, dep, event); |
2042 | break; | 2043 | break; |
2043 | case DWC3_DEPEVT_XFERINPROGRESS: | 2044 | case DWC3_DEPEVT_XFERINPROGRESS: |
2044 | if (!usb_endpoint_xfer_isoc(dep->endpoint.desc)) { | ||
2045 | dev_dbg(dwc->dev, "%s is not an Isochronous endpoint\n", | ||
2046 | dep->name); | ||
2047 | return; | ||
2048 | } | ||
2049 | |||
2050 | dwc3_endpoint_transfer_complete(dwc, dep, event); | 2045 | dwc3_endpoint_transfer_complete(dwc, dep, event); |
2051 | break; | 2046 | break; |
2052 | case DWC3_DEPEVT_XFERNOTREADY: | 2047 | case DWC3_DEPEVT_XFERNOTREADY: |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index dc30adf15a01..0dc3552d1360 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -155,6 +155,12 @@ struct ffs_io_data { | |||
155 | struct usb_request *req; | 155 | struct usb_request *req; |
156 | }; | 156 | }; |
157 | 157 | ||
158 | struct ffs_desc_helper { | ||
159 | struct ffs_data *ffs; | ||
160 | unsigned interfaces_count; | ||
161 | unsigned eps_count; | ||
162 | }; | ||
163 | |||
158 | static int __must_check ffs_epfiles_create(struct ffs_data *ffs); | 164 | static int __must_check ffs_epfiles_create(struct ffs_data *ffs); |
159 | static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count); | 165 | static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count); |
160 | 166 | ||
@@ -1830,7 +1836,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1830 | u8 *valuep, struct usb_descriptor_header *desc, | 1836 | u8 *valuep, struct usb_descriptor_header *desc, |
1831 | void *priv) | 1837 | void *priv) |
1832 | { | 1838 | { |
1833 | struct ffs_data *ffs = priv; | 1839 | struct ffs_desc_helper *helper = priv; |
1840 | struct usb_endpoint_descriptor *d; | ||
1834 | 1841 | ||
1835 | ENTER(); | 1842 | ENTER(); |
1836 | 1843 | ||
@@ -1844,8 +1851,8 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1844 | * encountered interface "n" then there are at least | 1851 | * encountered interface "n" then there are at least |
1845 | * "n+1" interfaces. | 1852 | * "n+1" interfaces. |
1846 | */ | 1853 | */ |
1847 | if (*valuep >= ffs->interfaces_count) | 1854 | if (*valuep >= helper->interfaces_count) |
1848 | ffs->interfaces_count = *valuep + 1; | 1855 | helper->interfaces_count = *valuep + 1; |
1849 | break; | 1856 | break; |
1850 | 1857 | ||
1851 | case FFS_STRING: | 1858 | case FFS_STRING: |
@@ -1853,14 +1860,22 @@ static int __ffs_data_do_entity(enum ffs_entity_type type, | |||
1853 | * Strings are indexed from 1 (0 is magic ;) reserved | 1860 | * Strings are indexed from 1 (0 is magic ;) reserved |
1854 | * for languages list or some such) | 1861 | * for languages list or some such) |
1855 | */ | 1862 | */ |
1856 | if (*valuep > ffs->strings_count) | 1863 | if (*valuep > helper->ffs->strings_count) |
1857 | ffs->strings_count = *valuep; | 1864 | helper->ffs->strings_count = *valuep; |
1858 | break; | 1865 | break; |
1859 | 1866 | ||
1860 | case FFS_ENDPOINT: | 1867 | case FFS_ENDPOINT: |
1861 | /* Endpoints are indexed from 1 as well. */ | 1868 | d = (void *)desc; |
1862 | if ((*valuep & USB_ENDPOINT_NUMBER_MASK) > ffs->eps_count) | 1869 | helper->eps_count++; |
1863 | ffs->eps_count = (*valuep & USB_ENDPOINT_NUMBER_MASK); | 1870 | if (helper->eps_count >= 15) |
1871 | return -EINVAL; | ||
1872 | /* Check if descriptors for any speed were already parsed */ | ||
1873 | if (!helper->ffs->eps_count && !helper->ffs->interfaces_count) | ||
1874 | helper->ffs->eps_addrmap[helper->eps_count] = | ||
1875 | d->bEndpointAddress; | ||
1876 | else if (helper->ffs->eps_addrmap[helper->eps_count] != | ||
1877 | d->bEndpointAddress) | ||
1878 | return -EINVAL; | ||
1864 | break; | 1879 | break; |
1865 | } | 1880 | } |
1866 | 1881 | ||
@@ -2053,6 +2068,7 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, | |||
2053 | char *data = _data, *raw_descs; | 2068 | char *data = _data, *raw_descs; |
2054 | unsigned os_descs_count = 0, counts[3], flags; | 2069 | unsigned os_descs_count = 0, counts[3], flags; |
2055 | int ret = -EINVAL, i; | 2070 | int ret = -EINVAL, i; |
2071 | struct ffs_desc_helper helper; | ||
2056 | 2072 | ||
2057 | ENTER(); | 2073 | ENTER(); |
2058 | 2074 | ||
@@ -2101,13 +2117,29 @@ static int __ffs_data_got_descs(struct ffs_data *ffs, | |||
2101 | 2117 | ||
2102 | /* Read descriptors */ | 2118 | /* Read descriptors */ |
2103 | raw_descs = data; | 2119 | raw_descs = data; |
2120 | helper.ffs = ffs; | ||
2104 | for (i = 0; i < 3; ++i) { | 2121 | for (i = 0; i < 3; ++i) { |
2105 | if (!counts[i]) | 2122 | if (!counts[i]) |
2106 | continue; | 2123 | continue; |
2124 | helper.interfaces_count = 0; | ||
2125 | helper.eps_count = 0; | ||
2107 | ret = ffs_do_descs(counts[i], data, len, | 2126 | ret = ffs_do_descs(counts[i], data, len, |
2108 | __ffs_data_do_entity, ffs); | 2127 | __ffs_data_do_entity, &helper); |
2109 | if (ret < 0) | 2128 | if (ret < 0) |
2110 | goto error; | 2129 | goto error; |
2130 | if (!ffs->eps_count && !ffs->interfaces_count) { | ||
2131 | ffs->eps_count = helper.eps_count; | ||
2132 | ffs->interfaces_count = helper.interfaces_count; | ||
2133 | } else { | ||
2134 | if (ffs->eps_count != helper.eps_count) { | ||
2135 | ret = -EINVAL; | ||
2136 | goto error; | ||
2137 | } | ||
2138 | if (ffs->interfaces_count != helper.interfaces_count) { | ||
2139 | ret = -EINVAL; | ||
2140 | goto error; | ||
2141 | } | ||
2142 | } | ||
2111 | data += ret; | 2143 | data += ret; |
2112 | len -= ret; | 2144 | len -= ret; |
2113 | } | 2145 | } |
@@ -2342,9 +2374,18 @@ static void ffs_event_add(struct ffs_data *ffs, | |||
2342 | spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); | 2374 | spin_unlock_irqrestore(&ffs->ev.waitq.lock, flags); |
2343 | } | 2375 | } |
2344 | 2376 | ||
2345 | |||
2346 | /* Bind/unbind USB function hooks *******************************************/ | 2377 | /* Bind/unbind USB function hooks *******************************************/ |
2347 | 2378 | ||
2379 | static int ffs_ep_addr2idx(struct ffs_data *ffs, u8 endpoint_address) | ||
2380 | { | ||
2381 | int i; | ||
2382 | |||
2383 | for (i = 1; i < ARRAY_SIZE(ffs->eps_addrmap); ++i) | ||
2384 | if (ffs->eps_addrmap[i] == endpoint_address) | ||
2385 | return i; | ||
2386 | return -ENOENT; | ||
2387 | } | ||
2388 | |||
2348 | static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | 2389 | static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, |
2349 | struct usb_descriptor_header *desc, | 2390 | struct usb_descriptor_header *desc, |
2350 | void *priv) | 2391 | void *priv) |
@@ -2378,7 +2419,10 @@ static int __ffs_func_bind_do_descs(enum ffs_entity_type type, u8 *valuep, | |||
2378 | if (!desc || desc->bDescriptorType != USB_DT_ENDPOINT) | 2419 | if (!desc || desc->bDescriptorType != USB_DT_ENDPOINT) |
2379 | return 0; | 2420 | return 0; |
2380 | 2421 | ||
2381 | idx = (ds->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK) - 1; | 2422 | idx = ffs_ep_addr2idx(func->ffs, ds->bEndpointAddress) - 1; |
2423 | if (idx < 0) | ||
2424 | return idx; | ||
2425 | |||
2382 | ffs_ep = func->eps + idx; | 2426 | ffs_ep = func->eps + idx; |
2383 | 2427 | ||
2384 | if (unlikely(ffs_ep->descs[ep_desc_id])) { | 2428 | if (unlikely(ffs_ep->descs[ep_desc_id])) { |
diff --git a/drivers/usb/gadget/function/u_fs.h b/drivers/usb/gadget/function/u_fs.h index 63d6e71569c1..d48897e8ffeb 100644 --- a/drivers/usb/gadget/function/u_fs.h +++ b/drivers/usb/gadget/function/u_fs.h | |||
@@ -224,6 +224,8 @@ struct ffs_data { | |||
224 | void *ms_os_descs_ext_prop_name_avail; | 224 | void *ms_os_descs_ext_prop_name_avail; |
225 | void *ms_os_descs_ext_prop_data_avail; | 225 | void *ms_os_descs_ext_prop_data_avail; |
226 | 226 | ||
227 | u8 eps_addrmap[15]; | ||
228 | |||
227 | unsigned short strings_count; | 229 | unsigned short strings_count; |
228 | unsigned short interfaces_count; | 230 | unsigned short interfaces_count; |
229 | unsigned short eps_count; | 231 | unsigned short eps_count; |
diff --git a/drivers/usb/gadget/udc/fusb300_udc.h b/drivers/usb/gadget/udc/fusb300_udc.h index ae811d8d38b4..ad39f892d200 100644 --- a/drivers/usb/gadget/udc/fusb300_udc.h +++ b/drivers/usb/gadget/udc/fusb300_udc.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | 13 | ||
14 | #ifndef __FUSB300_UDC_H__ | 14 | #ifndef __FUSB300_UDC_H__ |
15 | #define __FUSB300_UDC_H_ | 15 | #define __FUSB300_UDC_H__ |
16 | 16 | ||
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | 18 | ||
diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c index f4eac113690e..2e95715b50c0 100644 --- a/drivers/usb/gadget/udc/net2280.c +++ b/drivers/usb/gadget/udc/net2280.c | |||
@@ -3320,7 +3320,7 @@ static void handle_stat1_irqs(struct net2280 *dev, u32 stat) | |||
3320 | if (stat & tmp) { | 3320 | if (stat & tmp) { |
3321 | writel(tmp, &dev->regs->irqstat1); | 3321 | writel(tmp, &dev->regs->irqstat1); |
3322 | if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) && | 3322 | if ((((stat & BIT(ROOT_PORT_RESET_INTERRUPT)) && |
3323 | (readl(&dev->usb->usbstat) & mask)) || | 3323 | ((readl(&dev->usb->usbstat) & mask) == 0)) || |
3324 | ((readl(&dev->usb->usbctl) & | 3324 | ((readl(&dev->usb->usbctl) & |
3325 | BIT(VBUS_PIN)) == 0)) && | 3325 | BIT(VBUS_PIN)) == 0)) && |
3326 | (dev->gadget.speed != USB_SPEED_UNKNOWN)) { | 3326 | (dev->gadget.speed != USB_SPEED_UNKNOWN)) { |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 81cda09b47e3..488a30836c36 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -965,8 +965,6 @@ rescan: | |||
965 | } | 965 | } |
966 | 966 | ||
967 | qh->exception = 1; | 967 | qh->exception = 1; |
968 | if (ehci->rh_state < EHCI_RH_RUNNING) | ||
969 | qh->qh_state = QH_STATE_IDLE; | ||
970 | switch (qh->qh_state) { | 968 | switch (qh->qh_state) { |
971 | case QH_STATE_LINKED: | 969 | case QH_STATE_LINKED: |
972 | WARN_ON(!list_empty(&qh->qtd_list)); | 970 | WARN_ON(!list_empty(&qh->qtd_list)); |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index aa79e8749040..69aece31143a 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
@@ -468,7 +468,8 @@ static void xhci_hub_report_usb2_link_state(u32 *status, u32 status_reg) | |||
468 | } | 468 | } |
469 | 469 | ||
470 | /* Updates Link Status for super Speed port */ | 470 | /* Updates Link Status for super Speed port */ |
471 | static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) | 471 | static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci, |
472 | u32 *status, u32 status_reg) | ||
472 | { | 473 | { |
473 | u32 pls = status_reg & PORT_PLS_MASK; | 474 | u32 pls = status_reg & PORT_PLS_MASK; |
474 | 475 | ||
@@ -507,7 +508,8 @@ static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg) | |||
507 | * in which sometimes the port enters compliance mode | 508 | * in which sometimes the port enters compliance mode |
508 | * caused by a delay on the host-device negotiation. | 509 | * caused by a delay on the host-device negotiation. |
509 | */ | 510 | */ |
510 | if (pls == USB_SS_PORT_LS_COMP_MOD) | 511 | if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
512 | (pls == USB_SS_PORT_LS_COMP_MOD)) | ||
511 | pls |= USB_PORT_STAT_CONNECTION; | 513 | pls |= USB_PORT_STAT_CONNECTION; |
512 | } | 514 | } |
513 | 515 | ||
@@ -666,7 +668,7 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd, | |||
666 | } | 668 | } |
667 | /* Update Port Link State */ | 669 | /* Update Port Link State */ |
668 | if (hcd->speed == HCD_USB3) { | 670 | if (hcd->speed == HCD_USB3) { |
669 | xhci_hub_report_usb3_link_state(&status, raw_port_status); | 671 | xhci_hub_report_usb3_link_state(xhci, &status, raw_port_status); |
670 | /* | 672 | /* |
671 | * Verify if all USB3 Ports Have entered U0 already. | 673 | * Verify if all USB3 Ports Have entered U0 already. |
672 | * Delete Compliance Mode Timer if so. | 674 | * Delete Compliance Mode Timer if so. |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 8056d90690ee..8936211b161d 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1812,6 +1812,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1812 | 1812 | ||
1813 | if (xhci->lpm_command) | 1813 | if (xhci->lpm_command) |
1814 | xhci_free_command(xhci, xhci->lpm_command); | 1814 | xhci_free_command(xhci, xhci->lpm_command); |
1815 | xhci->lpm_command = NULL; | ||
1815 | if (xhci->cmd_ring) | 1816 | if (xhci->cmd_ring) |
1816 | xhci_ring_free(xhci, xhci->cmd_ring); | 1817 | xhci_ring_free(xhci, xhci->cmd_ring); |
1817 | xhci->cmd_ring = NULL; | 1818 | xhci->cmd_ring = NULL; |
@@ -1819,7 +1820,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1819 | xhci_cleanup_command_queue(xhci); | 1820 | xhci_cleanup_command_queue(xhci); |
1820 | 1821 | ||
1821 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); | 1822 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
1822 | for (i = 0; i < num_ports; i++) { | 1823 | for (i = 0; i < num_ports && xhci->rh_bw; i++) { |
1823 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; | 1824 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; |
1824 | for (j = 0; j < XHCI_MAX_INTERVAL; j++) { | 1825 | for (j = 0; j < XHCI_MAX_INTERVAL; j++) { |
1825 | struct list_head *ep = &bwt->interval_bw[j].endpoints; | 1826 | struct list_head *ep = &bwt->interval_bw[j].endpoints; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index c020b094fe7d..c4a8fca8ae93 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -3971,13 +3971,21 @@ static int __maybe_unused xhci_change_max_exit_latency(struct xhci_hcd *xhci, | |||
3971 | int ret; | 3971 | int ret; |
3972 | 3972 | ||
3973 | spin_lock_irqsave(&xhci->lock, flags); | 3973 | spin_lock_irqsave(&xhci->lock, flags); |
3974 | if (max_exit_latency == xhci->devs[udev->slot_id]->current_mel) { | 3974 | |
3975 | virt_dev = xhci->devs[udev->slot_id]; | ||
3976 | |||
3977 | /* | ||
3978 | * virt_dev might not exists yet if xHC resumed from hibernate (S4) and | ||
3979 | * xHC was re-initialized. Exit latency will be set later after | ||
3980 | * hub_port_finish_reset() is done and xhci->devs[] are re-allocated | ||
3981 | */ | ||
3982 | |||
3983 | if (!virt_dev || max_exit_latency == virt_dev->current_mel) { | ||
3975 | spin_unlock_irqrestore(&xhci->lock, flags); | 3984 | spin_unlock_irqrestore(&xhci->lock, flags); |
3976 | return 0; | 3985 | return 0; |
3977 | } | 3986 | } |
3978 | 3987 | ||
3979 | /* Attempt to issue an Evaluate Context command to change the MEL. */ | 3988 | /* Attempt to issue an Evaluate Context command to change the MEL. */ |
3980 | virt_dev = xhci->devs[udev->slot_id]; | ||
3981 | command = xhci->lpm_command; | 3989 | command = xhci->lpm_command; |
3982 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); | 3990 | ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx); |
3983 | if (!ctrl_ctx) { | 3991 | if (!ctrl_ctx) { |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index 47ae6455d073..3ee133f675ab 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -39,6 +39,7 @@ struct cppi41_dma_channel { | |||
39 | u32 transferred; | 39 | u32 transferred; |
40 | u32 packet_sz; | 40 | u32 packet_sz; |
41 | struct list_head tx_check; | 41 | struct list_head tx_check; |
42 | int tx_zlp; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | #define MUSB_DMA_NUM_CHANNELS 15 | 45 | #define MUSB_DMA_NUM_CHANNELS 15 |
@@ -122,6 +123,8 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) | |||
122 | { | 123 | { |
123 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; | 124 | struct musb_hw_ep *hw_ep = cppi41_channel->hw_ep; |
124 | struct musb *musb = hw_ep->musb; | 125 | struct musb *musb = hw_ep->musb; |
126 | void __iomem *epio = hw_ep->regs; | ||
127 | u16 csr; | ||
125 | 128 | ||
126 | if (!cppi41_channel->prog_len || | 129 | if (!cppi41_channel->prog_len || |
127 | (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE)) { | 130 | (cppi41_channel->channel.status == MUSB_DMA_STATUS_FREE)) { |
@@ -131,15 +134,24 @@ static void cppi41_trans_done(struct cppi41_dma_channel *cppi41_channel) | |||
131 | cppi41_channel->transferred; | 134 | cppi41_channel->transferred; |
132 | cppi41_channel->channel.status = MUSB_DMA_STATUS_FREE; | 135 | cppi41_channel->channel.status = MUSB_DMA_STATUS_FREE; |
133 | cppi41_channel->channel.rx_packet_done = true; | 136 | cppi41_channel->channel.rx_packet_done = true; |
137 | |||
138 | /* | ||
139 | * transmit ZLP using PIO mode for transfers which size is | ||
140 | * multiple of EP packet size. | ||
141 | */ | ||
142 | if (cppi41_channel->tx_zlp && (cppi41_channel->transferred % | ||
143 | cppi41_channel->packet_sz) == 0) { | ||
144 | musb_ep_select(musb->mregs, hw_ep->epnum); | ||
145 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_TXPKTRDY; | ||
146 | musb_writew(epio, MUSB_TXCSR, csr); | ||
147 | } | ||
134 | musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); | 148 | musb_dma_completion(musb, hw_ep->epnum, cppi41_channel->is_tx); |
135 | } else { | 149 | } else { |
136 | /* next iteration, reload */ | 150 | /* next iteration, reload */ |
137 | struct dma_chan *dc = cppi41_channel->dc; | 151 | struct dma_chan *dc = cppi41_channel->dc; |
138 | struct dma_async_tx_descriptor *dma_desc; | 152 | struct dma_async_tx_descriptor *dma_desc; |
139 | enum dma_transfer_direction direction; | 153 | enum dma_transfer_direction direction; |
140 | u16 csr; | ||
141 | u32 remain_bytes; | 154 | u32 remain_bytes; |
142 | void __iomem *epio = cppi41_channel->hw_ep->regs; | ||
143 | 155 | ||
144 | cppi41_channel->buf_addr += cppi41_channel->packet_sz; | 156 | cppi41_channel->buf_addr += cppi41_channel->packet_sz; |
145 | 157 | ||
@@ -363,6 +375,7 @@ static bool cppi41_configure_channel(struct dma_channel *channel, | |||
363 | cppi41_channel->total_len = len; | 375 | cppi41_channel->total_len = len; |
364 | cppi41_channel->transferred = 0; | 376 | cppi41_channel->transferred = 0; |
365 | cppi41_channel->packet_sz = packet_sz; | 377 | cppi41_channel->packet_sz = packet_sz; |
378 | cppi41_channel->tx_zlp = (cppi41_channel->is_tx && mode) ? 1 : 0; | ||
366 | 379 | ||
367 | /* | 380 | /* |
368 | * Due to AM335x' Advisory 1.0.13 we are not allowed to transfer more | 381 | * Due to AM335x' Advisory 1.0.13 we are not allowed to transfer more |
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index c42bdf0c4a1f..00972eca04e7 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2012-2013 Freescale Semiconductor, Inc. | 2 | * Copyright 2012-2014 Freescale Semiconductor, Inc. |
3 | * Copyright (C) 2012 Marek Vasut <marex@denx.de> | 3 | * Copyright (C) 2012 Marek Vasut <marex@denx.de> |
4 | * on behalf of DENX Software Engineering GmbH | 4 | * on behalf of DENX Software Engineering GmbH |
5 | * | 5 | * |
@@ -125,7 +125,13 @@ static const struct mxs_phy_data imx6sl_phy_data = { | |||
125 | MXS_PHY_NEED_IP_FIX, | 125 | MXS_PHY_NEED_IP_FIX, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static const struct mxs_phy_data imx6sx_phy_data = { | ||
129 | .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS | | ||
130 | MXS_PHY_NEED_IP_FIX, | ||
131 | }; | ||
132 | |||
128 | static const struct of_device_id mxs_phy_dt_ids[] = { | 133 | static const struct of_device_id mxs_phy_dt_ids[] = { |
134 | { .compatible = "fsl,imx6sx-usbphy", .data = &imx6sx_phy_data, }, | ||
129 | { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, | 135 | { .compatible = "fsl,imx6sl-usbphy", .data = &imx6sl_phy_data, }, |
130 | { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, | 136 | { .compatible = "fsl,imx6q-usbphy", .data = &imx6q_phy_data, }, |
131 | { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, | 137 | { .compatible = "fsl,imx23-usbphy", .data = &imx23_phy_data, }, |
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c index 13b4fa287da8..886f1807a67b 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c | |||
@@ -878,8 +878,8 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy, | |||
878 | return -ENOMEM; | 878 | return -ENOMEM; |
879 | } | 879 | } |
880 | 880 | ||
881 | tegra_phy->config = devm_kzalloc(&pdev->dev, | 881 | tegra_phy->config = devm_kzalloc(&pdev->dev, sizeof(*config), |
882 | sizeof(*tegra_phy->config), GFP_KERNEL); | 882 | GFP_KERNEL); |
883 | if (!tegra_phy->config) { | 883 | if (!tegra_phy->config) { |
884 | dev_err(&pdev->dev, | 884 | dev_err(&pdev->dev, |
885 | "unable to allocate memory for USB UTMIP config\n"); | 885 | "unable to allocate memory for USB UTMIP config\n"); |
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 4fd36530bfa3..b0c97a3f1bfe 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -108,19 +108,45 @@ static struct usbhs_pkt *__usbhsf_pkt_get(struct usbhs_pipe *pipe) | |||
108 | return list_first_entry(&pipe->list, struct usbhs_pkt, node); | 108 | return list_first_entry(&pipe->list, struct usbhs_pkt, node); |
109 | } | 109 | } |
110 | 110 | ||
111 | static void usbhsf_fifo_clear(struct usbhs_pipe *pipe, | ||
112 | struct usbhs_fifo *fifo); | ||
113 | static void usbhsf_fifo_unselect(struct usbhs_pipe *pipe, | ||
114 | struct usbhs_fifo *fifo); | ||
115 | static struct dma_chan *usbhsf_dma_chan_get(struct usbhs_fifo *fifo, | ||
116 | struct usbhs_pkt *pkt); | ||
117 | #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) | ||
118 | #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) | ||
119 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map); | ||
111 | struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) | 120 | struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt) |
112 | { | 121 | { |
113 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); | 122 | struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); |
123 | struct usbhs_fifo *fifo = usbhs_pipe_to_fifo(pipe); | ||
114 | unsigned long flags; | 124 | unsigned long flags; |
115 | 125 | ||
116 | /******************** spin lock ********************/ | 126 | /******************** spin lock ********************/ |
117 | usbhs_lock(priv, flags); | 127 | usbhs_lock(priv, flags); |
118 | 128 | ||
129 | usbhs_pipe_disable(pipe); | ||
130 | |||
119 | if (!pkt) | 131 | if (!pkt) |
120 | pkt = __usbhsf_pkt_get(pipe); | 132 | pkt = __usbhsf_pkt_get(pipe); |
121 | 133 | ||
122 | if (pkt) | 134 | if (pkt) { |
135 | struct dma_chan *chan = NULL; | ||
136 | |||
137 | if (fifo) | ||
138 | chan = usbhsf_dma_chan_get(fifo, pkt); | ||
139 | if (chan) { | ||
140 | dmaengine_terminate_all(chan); | ||
141 | usbhsf_fifo_clear(pipe, fifo); | ||
142 | usbhsf_dma_unmap(pkt); | ||
143 | } | ||
144 | |||
123 | __usbhsf_pkt_del(pkt); | 145 | __usbhsf_pkt_del(pkt); |
146 | } | ||
147 | |||
148 | if (fifo) | ||
149 | usbhsf_fifo_unselect(pipe, fifo); | ||
124 | 150 | ||
125 | usbhs_unlock(priv, flags); | 151 | usbhs_unlock(priv, flags); |
126 | /******************** spin unlock ******************/ | 152 | /******************** spin unlock ******************/ |
@@ -544,6 +570,7 @@ static int usbhsf_pio_try_push(struct usbhs_pkt *pkt, int *is_done) | |||
544 | usbhsf_send_terminator(pipe, fifo); | 570 | usbhsf_send_terminator(pipe, fifo); |
545 | 571 | ||
546 | usbhsf_tx_irq_ctrl(pipe, !*is_done); | 572 | usbhsf_tx_irq_ctrl(pipe, !*is_done); |
573 | usbhs_pipe_running(pipe, !*is_done); | ||
547 | usbhs_pipe_enable(pipe); | 574 | usbhs_pipe_enable(pipe); |
548 | 575 | ||
549 | dev_dbg(dev, " send %d (%d/ %d/ %d/ %d)\n", | 576 | dev_dbg(dev, " send %d (%d/ %d/ %d/ %d)\n", |
@@ -570,12 +597,21 @@ usbhs_fifo_write_busy: | |||
570 | * retry in interrupt | 597 | * retry in interrupt |
571 | */ | 598 | */ |
572 | usbhsf_tx_irq_ctrl(pipe, 1); | 599 | usbhsf_tx_irq_ctrl(pipe, 1); |
600 | usbhs_pipe_running(pipe, 1); | ||
573 | 601 | ||
574 | return ret; | 602 | return ret; |
575 | } | 603 | } |
576 | 604 | ||
605 | static int usbhsf_pio_prepare_push(struct usbhs_pkt *pkt, int *is_done) | ||
606 | { | ||
607 | if (usbhs_pipe_is_running(pkt->pipe)) | ||
608 | return 0; | ||
609 | |||
610 | return usbhsf_pio_try_push(pkt, is_done); | ||
611 | } | ||
612 | |||
577 | struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = { | 613 | struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = { |
578 | .prepare = usbhsf_pio_try_push, | 614 | .prepare = usbhsf_pio_prepare_push, |
579 | .try_run = usbhsf_pio_try_push, | 615 | .try_run = usbhsf_pio_try_push, |
580 | }; | 616 | }; |
581 | 617 | ||
@@ -589,6 +625,9 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) | |||
589 | if (usbhs_pipe_is_busy(pipe)) | 625 | if (usbhs_pipe_is_busy(pipe)) |
590 | return 0; | 626 | return 0; |
591 | 627 | ||
628 | if (usbhs_pipe_is_running(pipe)) | ||
629 | return 0; | ||
630 | |||
592 | /* | 631 | /* |
593 | * pipe enable to prepare packet receive | 632 | * pipe enable to prepare packet receive |
594 | */ | 633 | */ |
@@ -597,6 +636,7 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) | |||
597 | 636 | ||
598 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); | 637 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); |
599 | usbhs_pipe_enable(pipe); | 638 | usbhs_pipe_enable(pipe); |
639 | usbhs_pipe_running(pipe, 1); | ||
600 | usbhsf_rx_irq_ctrl(pipe, 1); | 640 | usbhsf_rx_irq_ctrl(pipe, 1); |
601 | 641 | ||
602 | return 0; | 642 | return 0; |
@@ -642,6 +682,7 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done) | |||
642 | (total_len < maxp)) { /* short packet */ | 682 | (total_len < maxp)) { /* short packet */ |
643 | *is_done = 1; | 683 | *is_done = 1; |
644 | usbhsf_rx_irq_ctrl(pipe, 0); | 684 | usbhsf_rx_irq_ctrl(pipe, 0); |
685 | usbhs_pipe_running(pipe, 0); | ||
645 | usbhs_pipe_disable(pipe); /* disable pipe first */ | 686 | usbhs_pipe_disable(pipe); /* disable pipe first */ |
646 | } | 687 | } |
647 | 688 | ||
@@ -763,8 +804,6 @@ static void __usbhsf_dma_ctrl(struct usbhs_pipe *pipe, | |||
763 | usbhs_bset(priv, fifo->sel, DREQE, dreqe); | 804 | usbhs_bset(priv, fifo->sel, DREQE, dreqe); |
764 | } | 805 | } |
765 | 806 | ||
766 | #define usbhsf_dma_map(p) __usbhsf_dma_map_ctrl(p, 1) | ||
767 | #define usbhsf_dma_unmap(p) __usbhsf_dma_map_ctrl(p, 0) | ||
768 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map) | 807 | static int __usbhsf_dma_map_ctrl(struct usbhs_pkt *pkt, int map) |
769 | { | 808 | { |
770 | struct usbhs_pipe *pipe = pkt->pipe; | 809 | struct usbhs_pipe *pipe = pkt->pipe; |
@@ -805,6 +844,7 @@ static void xfer_work(struct work_struct *work) | |||
805 | dev_dbg(dev, " %s %d (%d/ %d)\n", | 844 | dev_dbg(dev, " %s %d (%d/ %d)\n", |
806 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); | 845 | fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero); |
807 | 846 | ||
847 | usbhs_pipe_running(pipe, 1); | ||
808 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); | 848 | usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans); |
809 | usbhs_pipe_enable(pipe); | 849 | usbhs_pipe_enable(pipe); |
810 | usbhsf_dma_start(pipe, fifo); | 850 | usbhsf_dma_start(pipe, fifo); |
@@ -836,6 +876,10 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done) | |||
836 | if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ | 876 | if ((uintptr_t)(pkt->buf + pkt->actual) & 0x7) /* 8byte alignment */ |
837 | goto usbhsf_pio_prepare_push; | 877 | goto usbhsf_pio_prepare_push; |
838 | 878 | ||
879 | /* return at this time if the pipe is running */ | ||
880 | if (usbhs_pipe_is_running(pipe)) | ||
881 | return 0; | ||
882 | |||
839 | /* get enable DMA fifo */ | 883 | /* get enable DMA fifo */ |
840 | fifo = usbhsf_get_dma_fifo(priv, pkt); | 884 | fifo = usbhsf_get_dma_fifo(priv, pkt); |
841 | if (!fifo) | 885 | if (!fifo) |
@@ -869,15 +913,29 @@ usbhsf_pio_prepare_push: | |||
869 | static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done) | 913 | static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done) |
870 | { | 914 | { |
871 | struct usbhs_pipe *pipe = pkt->pipe; | 915 | struct usbhs_pipe *pipe = pkt->pipe; |
916 | int is_short = pkt->trans % usbhs_pipe_get_maxpacket(pipe); | ||
917 | |||
918 | pkt->actual += pkt->trans; | ||
872 | 919 | ||
873 | pkt->actual = pkt->trans; | 920 | if (pkt->actual < pkt->length) |
921 | *is_done = 0; /* there are remainder data */ | ||
922 | else if (is_short) | ||
923 | *is_done = 1; /* short packet */ | ||
924 | else | ||
925 | *is_done = !pkt->zero; /* send zero packet? */ | ||
874 | 926 | ||
875 | *is_done = !pkt->zero; /* send zero packet ? */ | 927 | usbhs_pipe_running(pipe, !*is_done); |
876 | 928 | ||
877 | usbhsf_dma_stop(pipe, pipe->fifo); | 929 | usbhsf_dma_stop(pipe, pipe->fifo); |
878 | usbhsf_dma_unmap(pkt); | 930 | usbhsf_dma_unmap(pkt); |
879 | usbhsf_fifo_unselect(pipe, pipe->fifo); | 931 | usbhsf_fifo_unselect(pipe, pipe->fifo); |
880 | 932 | ||
933 | if (!*is_done) { | ||
934 | /* change handler to PIO */ | ||
935 | pkt->handler = &usbhs_fifo_pio_push_handler; | ||
936 | return pkt->handler->try_run(pkt, is_done); | ||
937 | } | ||
938 | |||
881 | return 0; | 939 | return 0; |
882 | } | 940 | } |
883 | 941 | ||
@@ -972,8 +1030,10 @@ static int usbhsf_dma_pop_done(struct usbhs_pkt *pkt, int *is_done) | |||
972 | if ((pkt->actual == pkt->length) || /* receive all data */ | 1030 | if ((pkt->actual == pkt->length) || /* receive all data */ |
973 | (pkt->trans < maxp)) { /* short packet */ | 1031 | (pkt->trans < maxp)) { /* short packet */ |
974 | *is_done = 1; | 1032 | *is_done = 1; |
1033 | usbhs_pipe_running(pipe, 0); | ||
975 | } else { | 1034 | } else { |
976 | /* re-enable */ | 1035 | /* re-enable */ |
1036 | usbhs_pipe_running(pipe, 0); | ||
977 | usbhsf_prepare_pop(pkt, is_done); | 1037 | usbhsf_prepare_pop(pkt, is_done); |
978 | } | 1038 | } |
979 | 1039 | ||
diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index 6a030b931a3b..9a705b15b3a1 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c | |||
@@ -213,7 +213,10 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv, | |||
213 | { | 213 | { |
214 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); | 214 | struct usbhs_mod *mod = usbhs_mod_get_current(priv); |
215 | u16 intenb0, intenb1; | 215 | u16 intenb0, intenb1; |
216 | unsigned long flags; | ||
216 | 217 | ||
218 | /******************** spin lock ********************/ | ||
219 | usbhs_lock(priv, flags); | ||
217 | state->intsts0 = usbhs_read(priv, INTSTS0); | 220 | state->intsts0 = usbhs_read(priv, INTSTS0); |
218 | state->intsts1 = usbhs_read(priv, INTSTS1); | 221 | state->intsts1 = usbhs_read(priv, INTSTS1); |
219 | 222 | ||
@@ -229,6 +232,8 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv, | |||
229 | state->bempsts &= mod->irq_bempsts; | 232 | state->bempsts &= mod->irq_bempsts; |
230 | state->brdysts &= mod->irq_brdysts; | 233 | state->brdysts &= mod->irq_brdysts; |
231 | } | 234 | } |
235 | usbhs_unlock(priv, flags); | ||
236 | /******************** spin unlock ******************/ | ||
232 | 237 | ||
233 | /* | 238 | /* |
234 | * Check whether the irq enable registers and the irq status are set | 239 | * Check whether the irq enable registers and the irq status are set |
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c index 75fbcf6b102e..040bcefcb040 100644 --- a/drivers/usb/renesas_usbhs/pipe.c +++ b/drivers/usb/renesas_usbhs/pipe.c | |||
@@ -578,6 +578,19 @@ int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe) | |||
578 | return usbhsp_flags_has(pipe, IS_DIR_HOST); | 578 | return usbhsp_flags_has(pipe, IS_DIR_HOST); |
579 | } | 579 | } |
580 | 580 | ||
581 | int usbhs_pipe_is_running(struct usbhs_pipe *pipe) | ||
582 | { | ||
583 | return usbhsp_flags_has(pipe, IS_RUNNING); | ||
584 | } | ||
585 | |||
586 | void usbhs_pipe_running(struct usbhs_pipe *pipe, int running) | ||
587 | { | ||
588 | if (running) | ||
589 | usbhsp_flags_set(pipe, IS_RUNNING); | ||
590 | else | ||
591 | usbhsp_flags_clr(pipe, IS_RUNNING); | ||
592 | } | ||
593 | |||
581 | void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) | 594 | void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) |
582 | { | 595 | { |
583 | u16 mask = (SQCLR | SQSET); | 596 | u16 mask = (SQCLR | SQSET); |
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h index 406f36d050e4..d24a05972370 100644 --- a/drivers/usb/renesas_usbhs/pipe.h +++ b/drivers/usb/renesas_usbhs/pipe.h | |||
@@ -36,6 +36,7 @@ struct usbhs_pipe { | |||
36 | #define USBHS_PIPE_FLAGS_IS_USED (1 << 0) | 36 | #define USBHS_PIPE_FLAGS_IS_USED (1 << 0) |
37 | #define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1) | 37 | #define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1) |
38 | #define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2) | 38 | #define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2) |
39 | #define USBHS_PIPE_FLAGS_IS_RUNNING (1 << 3) | ||
39 | 40 | ||
40 | struct usbhs_pkt_handle *handler; | 41 | struct usbhs_pkt_handle *handler; |
41 | 42 | ||
@@ -80,6 +81,9 @@ int usbhs_pipe_probe(struct usbhs_priv *priv); | |||
80 | void usbhs_pipe_remove(struct usbhs_priv *priv); | 81 | void usbhs_pipe_remove(struct usbhs_priv *priv); |
81 | int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe); | 82 | int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe); |
82 | int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe); | 83 | int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe); |
84 | int usbhs_pipe_is_running(struct usbhs_pipe *pipe); | ||
85 | void usbhs_pipe_running(struct usbhs_pipe *pipe, int running); | ||
86 | |||
83 | void usbhs_pipe_init(struct usbhs_priv *priv, | 87 | void usbhs_pipe_init(struct usbhs_priv *priv, |
84 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map)); | 88 | int (*dma_map_ctrl)(struct usbhs_pkt *pkt, int map)); |
85 | int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe); | 89 | int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 824ea5e7ec8b..dc72b924c399 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -728,6 +728,7 @@ static const struct usb_device_id id_table_combined[] = { | |||
728 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | 728 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), |
729 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | 729 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
730 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 730 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
731 | { USB_DEVICE(NOVITUS_VID, NOVITUS_BONO_E_PID) }, | ||
731 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, | 732 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_S03_PID) }, |
732 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, | 733 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_59_PID) }, |
733 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, | 734 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_USB_57A_PID) }, |
@@ -939,6 +940,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
939 | { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, | 940 | { USB_DEVICE(FTDI_VID, FTDI_EKEY_CONV_USB_PID) }, |
940 | /* Infineon Devices */ | 941 | /* Infineon Devices */ |
941 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, | 942 | { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) }, |
943 | /* GE Healthcare devices */ | ||
944 | { USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) }, | ||
942 | { } /* Terminating entry */ | 945 | { } /* Terminating entry */ |
943 | }; | 946 | }; |
944 | 947 | ||
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 70b0b1d88ae9..5937b2d242f2 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -837,6 +837,12 @@ | |||
837 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ | 837 | #define TELLDUS_TELLSTICK_PID 0x0C30 /* RF control dongle 433 MHz using FT232RL */ |
838 | 838 | ||
839 | /* | 839 | /* |
840 | * NOVITUS printers | ||
841 | */ | ||
842 | #define NOVITUS_VID 0x1a28 | ||
843 | #define NOVITUS_BONO_E_PID 0x6010 | ||
844 | |||
845 | /* | ||
840 | * RT Systems programming cables for various ham radios | 846 | * RT Systems programming cables for various ham radios |
841 | */ | 847 | */ |
842 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | 848 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
@@ -1385,3 +1391,9 @@ | |||
1385 | * ekey biometric systems GmbH (http://ekey.net/) | 1391 | * ekey biometric systems GmbH (http://ekey.net/) |
1386 | */ | 1392 | */ |
1387 | #define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ | 1393 | #define FTDI_EKEY_CONV_USB_PID 0xCB08 /* Converter USB */ |
1394 | |||
1395 | /* | ||
1396 | * GE Healthcare devices | ||
1397 | */ | ||
1398 | #define GE_HEALTHCARE_VID 0x1901 | ||
1399 | #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015 | ||
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 6f7f01eb556a..46179a0828eb 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -282,14 +282,19 @@ static const struct usb_device_id id_table[] = { | |||
282 | /* Sierra Wireless HSPA Non-Composite Device */ | 282 | /* Sierra Wireless HSPA Non-Composite Device */ |
283 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 283 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
284 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | 284 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ |
285 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 285 | /* Sierra Wireless Direct IP modems */ |
286 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68A3, 0xFF, 0xFF, 0xFF), | ||
287 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
288 | }, | ||
289 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x68AA, 0xFF, 0xFF, 0xFF), | ||
286 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 290 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
287 | }, | 291 | }, |
288 | /* AT&T Direct IP LTE modems */ | 292 | /* AT&T Direct IP LTE modems */ |
289 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), | 293 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), |
290 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 294 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
291 | }, | 295 | }, |
292 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ | 296 | /* Airprime/Sierra Wireless Direct IP modems */ |
297 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68A3, 0xFF, 0xFF, 0xFF), | ||
293 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 298 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
294 | }, | 299 | }, |
295 | 300 | ||
diff --git a/drivers/usb/serial/zte_ev.c b/drivers/usb/serial/zte_ev.c index 1a132e9e947a..c9bb107d5e5c 100644 --- a/drivers/usb/serial/zte_ev.c +++ b/drivers/usb/serial/zte_ev.c | |||
@@ -272,6 +272,14 @@ static void zte_ev_usb_serial_close(struct usb_serial_port *port) | |||
272 | } | 272 | } |
273 | 273 | ||
274 | static const struct usb_device_id id_table[] = { | 274 | static const struct usb_device_id id_table[] = { |
275 | { USB_DEVICE(0x19d2, 0xffec) }, | ||
276 | { USB_DEVICE(0x19d2, 0xffee) }, | ||
277 | { USB_DEVICE(0x19d2, 0xfff6) }, | ||
278 | { USB_DEVICE(0x19d2, 0xfff7) }, | ||
279 | { USB_DEVICE(0x19d2, 0xfff8) }, | ||
280 | { USB_DEVICE(0x19d2, 0xfff9) }, | ||
281 | { USB_DEVICE(0x19d2, 0xfffb) }, | ||
282 | { USB_DEVICE(0x19d2, 0xfffc) }, | ||
275 | /* MG880 */ | 283 | /* MG880 */ |
276 | { USB_DEVICE(0x19d2, 0xfffd) }, | 284 | { USB_DEVICE(0x19d2, 0xfffd) }, |
277 | { }, | 285 | { }, |
diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h index 503ac5c8d80f..8a6f371ed6e7 100644 --- a/drivers/usb/storage/uas-detect.h +++ b/drivers/usb/storage/uas-detect.h | |||
@@ -59,10 +59,6 @@ static int uas_use_uas_driver(struct usb_interface *intf, | |||
59 | unsigned long flags = id->driver_info; | 59 | unsigned long flags = id->driver_info; |
60 | int r, alt; | 60 | int r, alt; |
61 | 61 | ||
62 | usb_stor_adjust_quirks(udev, &flags); | ||
63 | |||
64 | if (flags & US_FL_IGNORE_UAS) | ||
65 | return 0; | ||
66 | 62 | ||
67 | alt = uas_find_uas_alt_setting(intf); | 63 | alt = uas_find_uas_alt_setting(intf); |
68 | if (alt < 0) | 64 | if (alt < 0) |
@@ -72,6 +68,29 @@ static int uas_use_uas_driver(struct usb_interface *intf, | |||
72 | if (r < 0) | 68 | if (r < 0) |
73 | return 0; | 69 | return 0; |
74 | 70 | ||
71 | /* | ||
72 | * ASM1051 and older ASM1053 devices have the same usb-id, and UAS is | ||
73 | * broken on the ASM1051, use the number of streams to differentiate. | ||
74 | * New ASM1053-s also support 32 streams, but have a different prod-id. | ||
75 | */ | ||
76 | if (le16_to_cpu(udev->descriptor.idVendor) == 0x174c && | ||
77 | le16_to_cpu(udev->descriptor.idProduct) == 0x55aa) { | ||
78 | if (udev->speed < USB_SPEED_SUPER) { | ||
79 | /* No streams info, assume ASM1051 */ | ||
80 | flags |= US_FL_IGNORE_UAS; | ||
81 | } else if (usb_ss_max_streams(&eps[1]->ss_ep_comp) == 32) { | ||
82 | flags |= US_FL_IGNORE_UAS; | ||
83 | } | ||
84 | } | ||
85 | |||
86 | usb_stor_adjust_quirks(udev, &flags); | ||
87 | |||
88 | if (flags & US_FL_IGNORE_UAS) { | ||
89 | dev_warn(&udev->dev, | ||
90 | "UAS is blacklisted for this device, using usb-storage instead\n"); | ||
91 | return 0; | ||
92 | } | ||
93 | |||
75 | if (udev->bus->sg_tablesize == 0) { | 94 | if (udev->bus->sg_tablesize == 0) { |
76 | dev_warn(&udev->dev, | 95 | dev_warn(&udev->dev, |
77 | "The driver for the USB controller %s does not support scatter-gather which is\n", | 96 | "The driver for the USB controller %s does not support scatter-gather which is\n", |
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 3f42785f653c..9bfa7252f7f9 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c | |||
@@ -970,6 +970,13 @@ static struct scsi_host_template uas_host_template = { | |||
970 | .cmd_per_lun = 1, /* until we override it */ | 970 | .cmd_per_lun = 1, /* until we override it */ |
971 | .skip_settle_delay = 1, | 971 | .skip_settle_delay = 1, |
972 | .ordered_tag = 1, | 972 | .ordered_tag = 1, |
973 | |||
974 | /* | ||
975 | * The uas drivers expects tags not to be bigger than the maximum | ||
976 | * per-device queue depth, which is not true with the blk-mq tag | ||
977 | * allocator. | ||
978 | */ | ||
979 | .disable_blk_mq = true, | ||
973 | }; | 980 | }; |
974 | 981 | ||
975 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ | 982 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 7ef99b2f3aaf..4a5c68a47e46 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -101,6 +101,12 @@ UNUSUAL_DEV( 0x03f0, 0x4002, 0x0001, 0x0001, | |||
101 | "PhotoSmart R707", | 101 | "PhotoSmart R707", |
102 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), | 102 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY), |
103 | 103 | ||
104 | UNUSUAL_DEV( 0x03f3, 0x0001, 0x0000, 0x9999, | ||
105 | "Adaptec", | ||
106 | "USBConnect 2000", | ||
107 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
108 | US_FL_SCM_MULT_TARG ), | ||
109 | |||
104 | /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net> | 110 | /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net> |
105 | * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product) | 111 | * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product) |
106 | * for USB floppies that need the SINGLE_LUN enforcement. | 112 | * for USB floppies that need the SINGLE_LUN enforcement. |
@@ -741,6 +747,12 @@ UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x0100, | |||
741 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 747 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
742 | US_FL_SINGLE_LUN ), | 748 | US_FL_SINGLE_LUN ), |
743 | 749 | ||
750 | UNUSUAL_DEV( 0x059b, 0x0040, 0x0100, 0x0100, | ||
751 | "Iomega", | ||
752 | "Jaz USB Adapter", | ||
753 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
754 | US_FL_SINGLE_LUN ), | ||
755 | |||
744 | /* Reported by <Hendryk.Pfeiffer@gmx.de> */ | 756 | /* Reported by <Hendryk.Pfeiffer@gmx.de> */ |
745 | UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, | 757 | UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000, |
746 | "LaCie", | 758 | "LaCie", |
@@ -1119,6 +1131,18 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x0200, | |||
1119 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1131 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1120 | US_FL_NOT_LOCKABLE), | 1132 | US_FL_NOT_LOCKABLE), |
1121 | 1133 | ||
1134 | UNUSUAL_DEV( 0x085a, 0x0026, 0x0100, 0x0133, | ||
1135 | "Xircom", | ||
1136 | "PortGear USB-SCSI (Mac USB Dock)", | ||
1137 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1138 | US_FL_SCM_MULT_TARG ), | ||
1139 | |||
1140 | UNUSUAL_DEV( 0x085a, 0x0028, 0x0100, 0x0133, | ||
1141 | "Xircom", | ||
1142 | "PortGear USB to SCSI Converter", | ||
1143 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1144 | US_FL_SCM_MULT_TARG ), | ||
1145 | |||
1122 | /* Submitted by Jan De Luyck <lkml@kcore.org> */ | 1146 | /* Submitted by Jan De Luyck <lkml@kcore.org> */ |
1123 | UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, | 1147 | UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000, |
1124 | "CITIZEN", | 1148 | "CITIZEN", |
@@ -1958,6 +1982,14 @@ UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x0100, | |||
1958 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 1982 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1959 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), | 1983 | US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ), |
1960 | 1984 | ||
1985 | /* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI) | ||
1986 | * and Mac USB Dock USB-SCSI */ | ||
1987 | UNUSUAL_DEV( 0x1645, 0x0007, 0x0100, 0x0133, | ||
1988 | "Entrega Technologies", | ||
1989 | "USB to SCSI Converter", | ||
1990 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
1991 | US_FL_SCM_MULT_TARG ), | ||
1992 | |||
1961 | /* Reported by Robert Schedel <r.schedel@yahoo.de> | 1993 | /* Reported by Robert Schedel <r.schedel@yahoo.de> |
1962 | * Note: this is a 'super top' device like the above 14cd/6600 device */ | 1994 | * Note: this is a 'super top' device like the above 14cd/6600 device */ |
1963 | UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, | 1995 | UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201, |
@@ -1980,6 +2012,12 @@ UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x0000, | |||
1980 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 2012 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
1981 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), | 2013 | US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ), |
1982 | 2014 | ||
2015 | UNUSUAL_DEV( 0x1822, 0x0001, 0x0000, 0x9999, | ||
2016 | "Ariston Technologies", | ||
2017 | "iConnect USB to SCSI adapter", | ||
2018 | USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init, | ||
2019 | US_FL_SCM_MULT_TARG ), | ||
2020 | |||
1983 | /* Reported by Hans de Goede <hdegoede@redhat.com> | 2021 | /* Reported by Hans de Goede <hdegoede@redhat.com> |
1984 | * These Appotech controllers are found in Picture Frames, they provide a | 2022 | * These Appotech controllers are found in Picture Frames, they provide a |
1985 | * (buggy) emulation of a cdrom drive which contains the windows software | 2023 | * (buggy) emulation of a cdrom drive which contains the windows software |
diff --git a/drivers/uwb/lc-dev.c b/drivers/uwb/lc-dev.c index 80079b8fed15..d0303f0dbe15 100644 --- a/drivers/uwb/lc-dev.c +++ b/drivers/uwb/lc-dev.c | |||
@@ -431,16 +431,19 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) | |||
431 | uwb_dev->mac_addr = *bce->mac_addr; | 431 | uwb_dev->mac_addr = *bce->mac_addr; |
432 | uwb_dev->dev_addr = bce->dev_addr; | 432 | uwb_dev->dev_addr = bce->dev_addr; |
433 | dev_set_name(&uwb_dev->dev, "%s", macbuf); | 433 | dev_set_name(&uwb_dev->dev, "%s", macbuf); |
434 | |||
435 | /* plug the beacon cache */ | ||
436 | bce->uwb_dev = uwb_dev; | ||
437 | uwb_dev->bce = bce; | ||
438 | uwb_bce_get(bce); /* released in uwb_dev_sys_release() */ | ||
439 | |||
434 | result = uwb_dev_add(uwb_dev, &rc->uwb_dev.dev, rc); | 440 | result = uwb_dev_add(uwb_dev, &rc->uwb_dev.dev, rc); |
435 | if (result < 0) { | 441 | if (result < 0) { |
436 | dev_err(dev, "new device %s: cannot instantiate device\n", | 442 | dev_err(dev, "new device %s: cannot instantiate device\n", |
437 | macbuf); | 443 | macbuf); |
438 | goto error_dev_add; | 444 | goto error_dev_add; |
439 | } | 445 | } |
440 | /* plug the beacon cache */ | 446 | |
441 | bce->uwb_dev = uwb_dev; | ||
442 | uwb_dev->bce = bce; | ||
443 | uwb_bce_get(bce); /* released in uwb_dev_sys_release() */ | ||
444 | dev_info(dev, "uwb device (mac %s dev %s) connected to %s %s\n", | 447 | dev_info(dev, "uwb device (mac %s dev %s) connected to %s %s\n", |
445 | macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name, | 448 | macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name, |
446 | dev_name(rc->uwb_dev.dev.parent)); | 449 | dev_name(rc->uwb_dev.dev.parent)); |
@@ -448,6 +451,8 @@ void uwbd_dev_onair(struct uwb_rc *rc, struct uwb_beca_e *bce) | |||
448 | return; | 451 | return; |
449 | 452 | ||
450 | error_dev_add: | 453 | error_dev_add: |
454 | bce->uwb_dev = NULL; | ||
455 | uwb_bce_put(bce); | ||
451 | kfree(uwb_dev); | 456 | kfree(uwb_dev); |
452 | return; | 457 | return; |
453 | } | 458 | } |
diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index a7b6217ac87b..6ad23bd3523a 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c | |||
@@ -639,9 +639,7 @@ static int clcdfb_of_init_tft_panel(struct clcd_fb *fb, u32 r0, u32 g0, u32 b0) | |||
639 | if (g0 != panels[i].g0) | 639 | if (g0 != panels[i].g0) |
640 | continue; | 640 | continue; |
641 | if (r0 == panels[i].r0 && b0 == panels[i].b0) | 641 | if (r0 == panels[i].r0 && b0 == panels[i].b0) |
642 | fb->panel->caps = panels[i].caps & CLCD_CAP_RGB; | 642 | fb->panel->caps = panels[i].caps; |
643 | if (r0 == panels[i].b0 && b0 == panels[i].r0) | ||
644 | fb->panel->caps = panels[i].caps & CLCD_CAP_BGR; | ||
645 | } | 643 | } |
646 | 644 | ||
647 | return fb->panel->caps ? 0 : -EINVAL; | 645 | return fb->panel->caps ? 0 : -EINVAL; |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 5c660c77f03b..1e0a317d3dcd 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -230,8 +230,8 @@ static enum bp_state reserve_additional_memory(long credit) | |||
230 | rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); | 230 | rc = add_memory(nid, hotplug_start_paddr, balloon_hotplug << PAGE_SHIFT); |
231 | 231 | ||
232 | if (rc) { | 232 | if (rc) { |
233 | pr_info("%s: add_memory() failed: %i\n", __func__, rc); | 233 | pr_warn("Cannot add additional memory (%i)\n", rc); |
234 | return BP_EAGAIN; | 234 | return BP_ECANCELED; |
235 | } | 235 | } |
236 | 236 | ||
237 | balloon_hotplug -= credit; | 237 | balloon_hotplug -= credit; |
diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index 787d17945418..e53fe191738c 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c | |||
@@ -124,7 +124,7 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op, | |||
124 | int i, rc, readonly; | 124 | int i, rc, readonly; |
125 | LIST_HEAD(queue_gref); | 125 | LIST_HEAD(queue_gref); |
126 | LIST_HEAD(queue_file); | 126 | LIST_HEAD(queue_file); |
127 | struct gntalloc_gref *gref; | 127 | struct gntalloc_gref *gref, *next; |
128 | 128 | ||
129 | readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE); | 129 | readonly = !(op->flags & GNTALLOC_FLAG_WRITABLE); |
130 | rc = -ENOMEM; | 130 | rc = -ENOMEM; |
@@ -141,13 +141,11 @@ static int add_grefs(struct ioctl_gntalloc_alloc_gref *op, | |||
141 | goto undo; | 141 | goto undo; |
142 | 142 | ||
143 | /* Grant foreign access to the page. */ | 143 | /* Grant foreign access to the page. */ |
144 | gref->gref_id = gnttab_grant_foreign_access(op->domid, | 144 | rc = gnttab_grant_foreign_access(op->domid, |
145 | pfn_to_mfn(page_to_pfn(gref->page)), readonly); | 145 | pfn_to_mfn(page_to_pfn(gref->page)), readonly); |
146 | if ((int)gref->gref_id < 0) { | 146 | if (rc < 0) |
147 | rc = gref->gref_id; | ||
148 | goto undo; | 147 | goto undo; |
149 | } | 148 | gref_ids[i] = gref->gref_id = rc; |
150 | gref_ids[i] = gref->gref_id; | ||
151 | } | 149 | } |
152 | 150 | ||
153 | /* Add to gref lists. */ | 151 | /* Add to gref lists. */ |
@@ -162,8 +160,8 @@ undo: | |||
162 | mutex_lock(&gref_mutex); | 160 | mutex_lock(&gref_mutex); |
163 | gref_size -= (op->count - i); | 161 | gref_size -= (op->count - i); |
164 | 162 | ||
165 | list_for_each_entry(gref, &queue_file, next_file) { | 163 | list_for_each_entry_safe(gref, next, &queue_file, next_file) { |
166 | /* __del_gref does not remove from queue_file */ | 164 | list_del(&gref->next_file); |
167 | __del_gref(gref); | 165 | __del_gref(gref); |
168 | } | 166 | } |
169 | 167 | ||
@@ -193,7 +191,7 @@ static void __del_gref(struct gntalloc_gref *gref) | |||
193 | 191 | ||
194 | gref->notify.flags = 0; | 192 | gref->notify.flags = 0; |
195 | 193 | ||
196 | if (gref->gref_id > 0) { | 194 | if (gref->gref_id) { |
197 | if (gnttab_query_foreign_access(gref->gref_id)) | 195 | if (gnttab_query_foreign_access(gref->gref_id)) |
198 | return; | 196 | return; |
199 | 197 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 5f1e1f3cd186..f8bb36f9d9ce 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -103,16 +103,11 @@ static void do_suspend(void) | |||
103 | 103 | ||
104 | shutting_down = SHUTDOWN_SUSPEND; | 104 | shutting_down = SHUTDOWN_SUSPEND; |
105 | 105 | ||
106 | #ifdef CONFIG_PREEMPT | ||
107 | /* If the kernel is preemptible, we need to freeze all the processes | ||
108 | to prevent them from being in the middle of a pagetable update | ||
109 | during suspend. */ | ||
110 | err = freeze_processes(); | 106 | err = freeze_processes(); |
111 | if (err) { | 107 | if (err) { |
112 | pr_err("%s: freeze failed %d\n", __func__, err); | 108 | pr_err("%s: freeze failed %d\n", __func__, err); |
113 | goto out; | 109 | goto out; |
114 | } | 110 | } |
115 | #endif | ||
116 | 111 | ||
117 | err = dpm_suspend_start(PMSG_FREEZE); | 112 | err = dpm_suspend_start(PMSG_FREEZE); |
118 | if (err) { | 113 | if (err) { |
@@ -157,10 +152,8 @@ out_resume: | |||
157 | dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); | 152 | dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); |
158 | 153 | ||
159 | out_thaw: | 154 | out_thaw: |
160 | #ifdef CONFIG_PREEMPT | ||
161 | thaw_processes(); | 155 | thaw_processes(); |
162 | out: | 156 | out: |
163 | #endif | ||
164 | shutting_down = SHUTDOWN_INVALID; | 157 | shutting_down = SHUTDOWN_INVALID; |
165 | } | 158 | } |
166 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ | 159 | #endif /* CONFIG_HIBERNATE_CALLBACKS */ |