diff options
Diffstat (limited to 'drivers')
52 files changed, 804 insertions, 581 deletions
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index fddc1e86f9d0..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 | ||
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/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/scan.c b/drivers/acpi/scan.c index 3bf7764659a4..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; |
@@ -2189,6 +2189,9 @@ static void acpi_bus_attach(struct acpi_device *device) | |||
2189 | ok: | 2189 | ok: |
2190 | list_for_each_entry(child, &device->children, node) | 2190 | list_for_each_entry(child, &device->children, node) |
2191 | 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); | ||
2192 | } | 2195 | } |
2193 | 2196 | ||
2194 | /** | 2197 | /** |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index fcbda105616e..8e7e18567ae6 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -750,6 +750,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { | |||
750 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"), | 750 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T520"), |
751 | }, | 751 | }, |
752 | }, | 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 | }, | ||
753 | 761 | ||
754 | /* The native backlight controls do not work on some older machines */ | 762 | /* The native backlight controls do not work on some older machines */ |
755 | { | 763 | { |
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/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index d9fdeddcef96..6e93e7f98358 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: |
@@ -1656,6 +1658,8 @@ void cpufreq_suspend(void) | |||
1656 | if (!cpufreq_driver) | 1658 | if (!cpufreq_driver) |
1657 | return; | 1659 | return; |
1658 | 1660 | ||
1661 | cpufreq_suspended = true; | ||
1662 | |||
1659 | if (!has_target()) | 1663 | if (!has_target()) |
1660 | return; | 1664 | return; |
1661 | 1665 | ||
@@ -1670,8 +1674,6 @@ void cpufreq_suspend(void) | |||
1670 | pr_err("%s: Failed to suspend driver: %p\n", __func__, | 1674 | pr_err("%s: Failed to suspend driver: %p\n", __func__, |
1671 | policy); | 1675 | policy); |
1672 | } | 1676 | } |
1673 | |||
1674 | cpufreq_suspended = true; | ||
1675 | } | 1677 | } |
1676 | 1678 | ||
1677 | /** | 1679 | /** |
@@ -1687,13 +1689,13 @@ void cpufreq_resume(void) | |||
1687 | if (!cpufreq_driver) | 1689 | if (!cpufreq_driver) |
1688 | return; | 1690 | return; |
1689 | 1691 | ||
1692 | cpufreq_suspended = false; | ||
1693 | |||
1690 | if (!has_target()) | 1694 | if (!has_target()) |
1691 | return; | 1695 | return; |
1692 | 1696 | ||
1693 | pr_debug("%s: Resuming Governors\n", __func__); | 1697 | pr_debug("%s: Resuming Governors\n", __func__); |
1694 | 1698 | ||
1695 | cpufreq_suspended = false; | ||
1696 | |||
1697 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { | 1699 | list_for_each_entry(policy, &cpufreq_policy_list, policy_list) { |
1698 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) | 1700 | if (cpufreq_driver->resume && cpufreq_driver->resume(policy)) |
1699 | pr_err("%s: Failed to resume driver: %p\n", __func__, | 1701 | pr_err("%s: Failed to resume driver: %p\n", __func__, |
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/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/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/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index ca34de7f6a7b..5a9de21637b7 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -732,7 +732,7 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder, | |||
732 | if (tmp & HDMI_MODE_SELECT_HDMI) | 732 | if (tmp & HDMI_MODE_SELECT_HDMI) |
733 | pipe_config->has_hdmi_sink = true; | 733 | pipe_config->has_hdmi_sink = true; |
734 | 734 | ||
735 | if (tmp & HDMI_MODE_SELECT_HDMI) | 735 | if (tmp & SDVO_AUDIO_ENABLE) |
736 | pipe_config->has_audio = true; | 736 | pipe_config->has_audio = true; |
737 | 737 | ||
738 | if (!HAS_PCH_SPLIT(dev) && | 738 | if (!HAS_PCH_SPLIT(dev) && |
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/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/r600.c b/drivers/gpu/drm/radeon/r600.c index 3cfb50056f7a..ea5c9af722ef 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -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/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_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 75223dd3a8a3..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 }, |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 4126fd0937a2..f9d17b29b343 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -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 | }; |
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/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/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-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-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-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 1cc146cfc1f3..e506fcd3ca04 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c | |||
@@ -76,8 +76,8 @@ | |||
76 | #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR) | 76 | #define RCAR_IRQ_RECV (MNR | MAL | MST | MAT | MDR) |
77 | #define RCAR_IRQ_STOP (MST) | 77 | #define RCAR_IRQ_STOP (MST) |
78 | 78 | ||
79 | #define RCAR_IRQ_ACK_SEND (~(MAT | MDE)) | 79 | #define RCAR_IRQ_ACK_SEND (~(MAT | MDE) & 0xFF) |
80 | #define RCAR_IRQ_ACK_RECV (~(MAT | MDR)) | 80 | #define RCAR_IRQ_ACK_RECV (~(MAT | MDR) & 0xFF) |
81 | 81 | ||
82 | #define ID_LAST_MSG (1 << 0) | 82 | #define ID_LAST_MSG (1 << 0) |
83 | #define ID_IOERROR (1 << 1) | 83 | #define ID_IOERROR (1 << 1) |
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index e637c32ae517..93cfc837200b 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c | |||
@@ -433,12 +433,11 @@ static void rk3x_i2c_set_scl_rate(struct rk3x_i2c *i2c, unsigned long scl_rate) | |||
433 | unsigned long i2c_rate = clk_get_rate(i2c->clk); | 433 | unsigned long i2c_rate = clk_get_rate(i2c->clk); |
434 | unsigned int div; | 434 | unsigned int div; |
435 | 435 | ||
436 | /* SCL rate = (clk rate) / (8 * DIV) */ | 436 | /* set DIV = DIVH = DIVL |
437 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 8); | 437 | * SCL rate = (clk rate) / (8 * (DIVH + 1 + DIVL + 1)) |
438 | 438 | * = (clk rate) / (16 * (DIV + 1)) | |
439 | /* The lower and upper half of the CLKDIV reg describe the length of | 439 | */ |
440 | * SCL low & high periods. */ | 440 | div = DIV_ROUND_UP(i2c_rate, scl_rate * 16) - 1; |
441 | div = DIV_ROUND_UP(div, 2); | ||
442 | 441 | ||
443 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); | 442 | i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV); |
444 | } | 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/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 713e3ddb43bd..40b7d6c0ff17 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -466,6 +466,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { | |||
466 | }, | 466 | }, |
467 | }, | 467 | }, |
468 | { | 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 | { | ||
469 | /* Avatar AVIU-145A6 */ | 476 | /* Avatar AVIU-145A6 */ |
470 | .matches = { | 477 | .matches = { |
471 | DMI_MATCH(DMI_SYS_VENDOR, "Intel"), | 478 | DMI_MATCH(DMI_SYS_VENDOR, "Intel"), |
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/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index e7d3a620d96a..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 | } |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index d9b8e94b805f..4d9fc0509af6 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/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index f6c32a947185..90de6e1ad06e 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/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 32456c79cc73..0b2a1ccd276d 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 9a2cfe4efac6..2bb48d57e7a5 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/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9dbb02d9d9c2..9979f67de3aa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -2786,8 +2786,15 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
2786 | if (IS_ERR(priv->stmmac_clk)) { | 2786 | if (IS_ERR(priv->stmmac_clk)) { |
2787 | dev_warn(priv->device, "%s: warning: cannot get CSR clock\n", | 2787 | dev_warn(priv->device, "%s: warning: cannot get CSR clock\n", |
2788 | __func__); | 2788 | __func__); |
2789 | ret = PTR_ERR(priv->stmmac_clk); | 2789 | /* If failed to obtain stmmac_clk and specific clk_csr value |
2790 | 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 | } | ||
2791 | } | 2798 | } |
2792 | clk_prepare_enable(priv->stmmac_clk); | 2799 | clk_prepare_enable(priv->stmmac_clk); |
2793 | 2800 | ||
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/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/usb/r8152.c b/drivers/net/usb/r8152.c index a4d4c4a1354f..b9a98152815b 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <linux/mdio.h> | 26 | #include <linux/mdio.h> |
27 | 27 | ||
28 | /* Version Information */ | 28 | /* Version Information */ |
29 | #define DRIVER_VERSION "v1.06.0 (2014/03/03)" | 29 | #define DRIVER_VERSION "v1.06.1 (2014/10/01)" |
30 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" | 30 | #define DRIVER_AUTHOR "Realtek linux nic maintainers <nic_swsd@realtek.com>" |
31 | #define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" | 31 | #define DRIVER_DESC "Realtek RTL8152/RTL8153 Based USB Ethernet Adapters" |
32 | #define MODULENAME "r8152" | 32 | #define MODULENAME "r8152" |
@@ -1979,10 +1979,34 @@ static void rxdy_gated_en(struct r8152 *tp, bool enable) | |||
1979 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data); | 1979 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_MISC_1, ocp_data); |
1980 | } | 1980 | } |
1981 | 1981 | ||
1982 | static int rtl_start_rx(struct r8152 *tp) | ||
1983 | { | ||
1984 | int i, ret = 0; | ||
1985 | |||
1986 | INIT_LIST_HEAD(&tp->rx_done); | ||
1987 | for (i = 0; i < RTL8152_MAX_RX; i++) { | ||
1988 | INIT_LIST_HEAD(&tp->rx_info[i].list); | ||
1989 | ret = r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); | ||
1990 | if (ret) | ||
1991 | break; | ||
1992 | } | ||
1993 | |||
1994 | return ret; | ||
1995 | } | ||
1996 | |||
1997 | static int rtl_stop_rx(struct r8152 *tp) | ||
1998 | { | ||
1999 | int i; | ||
2000 | |||
2001 | for (i = 0; i < RTL8152_MAX_RX; i++) | ||
2002 | usb_kill_urb(tp->rx_info[i].urb); | ||
2003 | |||
2004 | return 0; | ||
2005 | } | ||
2006 | |||
1982 | static int rtl_enable(struct r8152 *tp) | 2007 | static int rtl_enable(struct r8152 *tp) |
1983 | { | 2008 | { |
1984 | u32 ocp_data; | 2009 | u32 ocp_data; |
1985 | int i, ret; | ||
1986 | 2010 | ||
1987 | r8152b_reset_packet_filter(tp); | 2011 | r8152b_reset_packet_filter(tp); |
1988 | 2012 | ||
@@ -1992,14 +2016,7 @@ static int rtl_enable(struct r8152 *tp) | |||
1992 | 2016 | ||
1993 | rxdy_gated_en(tp, false); | 2017 | rxdy_gated_en(tp, false); |
1994 | 2018 | ||
1995 | INIT_LIST_HEAD(&tp->rx_done); | 2019 | return rtl_start_rx(tp); |
1996 | ret = 0; | ||
1997 | for (i = 0; i < RTL8152_MAX_RX; i++) { | ||
1998 | INIT_LIST_HEAD(&tp->rx_info[i].list); | ||
1999 | ret |= r8152_submit_rx(tp, &tp->rx_info[i], GFP_KERNEL); | ||
2000 | } | ||
2001 | |||
2002 | return ret; | ||
2003 | } | 2020 | } |
2004 | 2021 | ||
2005 | static int rtl8152_enable(struct r8152 *tp) | 2022 | static int rtl8152_enable(struct r8152 *tp) |
@@ -2083,8 +2100,7 @@ static void rtl_disable(struct r8152 *tp) | |||
2083 | usleep_range(1000, 2000); | 2100 | usleep_range(1000, 2000); |
2084 | } | 2101 | } |
2085 | 2102 | ||
2086 | for (i = 0; i < RTL8152_MAX_RX; i++) | 2103 | rtl_stop_rx(tp); |
2087 | usb_kill_urb(tp->rx_info[i].urb); | ||
2088 | 2104 | ||
2089 | rtl8152_nic_reset(tp); | 2105 | rtl8152_nic_reset(tp); |
2090 | } | 2106 | } |
@@ -2243,28 +2259,6 @@ static void rtl_phy_reset(struct r8152 *tp) | |||
2243 | } | 2259 | } |
2244 | } | 2260 | } |
2245 | 2261 | ||
2246 | static void rtl_clear_bp(struct r8152 *tp) | ||
2247 | { | ||
2248 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_0, 0); | ||
2249 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_2, 0); | ||
2250 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_4, 0); | ||
2251 | ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_6, 0); | ||
2252 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_0, 0); | ||
2253 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0); | ||
2254 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0); | ||
2255 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0); | ||
2256 | usleep_range(3000, 6000); | ||
2257 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0); | ||
2258 | ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0); | ||
2259 | } | ||
2260 | |||
2261 | static void r8153_clear_bp(struct r8152 *tp) | ||
2262 | { | ||
2263 | ocp_write_byte(tp, MCU_TYPE_PLA, PLA_BP_EN, 0); | ||
2264 | ocp_write_byte(tp, MCU_TYPE_USB, USB_BP_EN, 0); | ||
2265 | rtl_clear_bp(tp); | ||
2266 | } | ||
2267 | |||
2268 | static void r8153_teredo_off(struct r8152 *tp) | 2262 | static void r8153_teredo_off(struct r8152 *tp) |
2269 | { | 2263 | { |
2270 | u32 ocp_data; | 2264 | u32 ocp_data; |
@@ -2307,8 +2301,6 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp) | |||
2307 | r8152_mdio_write(tp, MII_BMCR, data); | 2301 | r8152_mdio_write(tp, MII_BMCR, data); |
2308 | } | 2302 | } |
2309 | 2303 | ||
2310 | rtl_clear_bp(tp); | ||
2311 | |||
2312 | set_bit(PHY_RESET, &tp->flags); | 2304 | set_bit(PHY_RESET, &tp->flags); |
2313 | } | 2305 | } |
2314 | 2306 | ||
@@ -2455,8 +2447,6 @@ static void r8153_hw_phy_cfg(struct r8152 *tp) | |||
2455 | r8152_mdio_write(tp, MII_BMCR, data); | 2447 | r8152_mdio_write(tp, MII_BMCR, data); |
2456 | } | 2448 | } |
2457 | 2449 | ||
2458 | r8153_clear_bp(tp); | ||
2459 | |||
2460 | if (tp->version == RTL_VER_03) { | 2450 | if (tp->version == RTL_VER_03) { |
2461 | data = ocp_reg_read(tp, OCP_EEE_CFG); | 2451 | data = ocp_reg_read(tp, OCP_EEE_CFG); |
2462 | data &= ~CTAP_SHORT_EN; | 2452 | data &= ~CTAP_SHORT_EN; |
@@ -3181,13 +3171,14 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) | |||
3181 | clear_bit(WORK_ENABLE, &tp->flags); | 3171 | clear_bit(WORK_ENABLE, &tp->flags); |
3182 | usb_kill_urb(tp->intr_urb); | 3172 | usb_kill_urb(tp->intr_urb); |
3183 | cancel_delayed_work_sync(&tp->schedule); | 3173 | cancel_delayed_work_sync(&tp->schedule); |
3174 | tasklet_disable(&tp->tl); | ||
3184 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3175 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3176 | rtl_stop_rx(tp); | ||
3185 | rtl_runtime_suspend_enable(tp, true); | 3177 | rtl_runtime_suspend_enable(tp, true); |
3186 | } else { | 3178 | } else { |
3187 | tasklet_disable(&tp->tl); | ||
3188 | tp->rtl_ops.down(tp); | 3179 | tp->rtl_ops.down(tp); |
3189 | tasklet_enable(&tp->tl); | ||
3190 | } | 3180 | } |
3181 | tasklet_enable(&tp->tl); | ||
3191 | } | 3182 | } |
3192 | 3183 | ||
3193 | return 0; | 3184 | return 0; |
@@ -3206,18 +3197,19 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
3206 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 3197 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { |
3207 | rtl_runtime_suspend_enable(tp, false); | 3198 | rtl_runtime_suspend_enable(tp, false); |
3208 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | 3199 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); |
3200 | set_bit(WORK_ENABLE, &tp->flags); | ||
3209 | if (tp->speed & LINK_STATUS) | 3201 | if (tp->speed & LINK_STATUS) |
3210 | tp->rtl_ops.disable(tp); | 3202 | rtl_start_rx(tp); |
3211 | } else { | 3203 | } else { |
3212 | tp->rtl_ops.up(tp); | 3204 | tp->rtl_ops.up(tp); |
3213 | rtl8152_set_speed(tp, AUTONEG_ENABLE, | 3205 | rtl8152_set_speed(tp, AUTONEG_ENABLE, |
3214 | tp->mii.supports_gmii ? | 3206 | tp->mii.supports_gmii ? |
3215 | SPEED_1000 : SPEED_100, | 3207 | SPEED_1000 : SPEED_100, |
3216 | DUPLEX_FULL); | 3208 | DUPLEX_FULL); |
3209 | tp->speed = 0; | ||
3210 | netif_carrier_off(tp->netdev); | ||
3211 | set_bit(WORK_ENABLE, &tp->flags); | ||
3217 | } | 3212 | } |
3218 | tp->speed = 0; | ||
3219 | netif_carrier_off(tp->netdev); | ||
3220 | set_bit(WORK_ENABLE, &tp->flags); | ||
3221 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3213 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
3222 | } | 3214 | } |
3223 | 3215 | ||
@@ -3623,7 +3615,7 @@ static void rtl8153_unload(struct r8152 *tp) | |||
3623 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) | 3615 | if (test_bit(RTL8152_UNPLUG, &tp->flags)) |
3624 | return; | 3616 | return; |
3625 | 3617 | ||
3626 | r8153_power_cut_en(tp, true); | 3618 | r8153_power_cut_en(tp, false); |
3627 | } | 3619 | } |
3628 | 3620 | ||
3629 | static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | 3621 | static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) |
@@ -3788,7 +3780,11 @@ static void rtl8152_disconnect(struct usb_interface *intf) | |||
3788 | 3780 | ||
3789 | usb_set_intfdata(intf, NULL); | 3781 | usb_set_intfdata(intf, NULL); |
3790 | if (tp) { | 3782 | if (tp) { |
3791 | set_bit(RTL8152_UNPLUG, &tp->flags); | 3783 | struct usb_device *udev = tp->udev; |
3784 | |||
3785 | if (udev->state == USB_STATE_NOTATTACHED) | ||
3786 | set_bit(RTL8152_UNPLUG, &tp->flags); | ||
3787 | |||
3792 | tasklet_kill(&tp->tl); | 3788 | tasklet_kill(&tp->tl); |
3793 | unregister_netdev(tp->netdev); | 3789 | unregister_netdev(tp->netdev); |
3794 | tp->rtl_ops.unload(tp); | 3790 | tp->rtl_ops.unload(tp); |
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/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/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); |