diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2014-05-16 10:08:32 -0400 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2014-05-16 10:08:32 -0400 |
commit | 3f04e3d3eb77ac9df70619b9c87da71b0eeddc36 (patch) | |
tree | cf1cbadc390888d1910a81ffc40161f783363075 /drivers | |
parent | 8cffcb0ca33381e07cee4ebe1301d0794054fc97 (diff) | |
parent | 2779ac167b1a1bf8153dca9f3a141c6148c6b89f (diff) |
Merge remote-tracking branch 'tip/timers/core/timers/core' into clockevents/3.16
Diffstat (limited to 'drivers')
143 files changed, 1745 insertions, 799 deletions
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index c29c2c3ec0ad..b06f5f55ada9 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -170,6 +170,9 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr) | |||
170 | acpi_status status; | 170 | acpi_status status; |
171 | int ret; | 171 | int ret; |
172 | 172 | ||
173 | if (pr->apic_id == -1) | ||
174 | return -ENODEV; | ||
175 | |||
173 | status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta); | 176 | status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta); |
174 | if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT)) | 177 | if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT)) |
175 | return -ENODEV; | 178 | return -ENODEV; |
@@ -260,10 +263,8 @@ static int acpi_processor_get_info(struct acpi_device *device) | |||
260 | } | 263 | } |
261 | 264 | ||
262 | apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); | 265 | apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id); |
263 | if (apic_id < 0) { | 266 | if (apic_id < 0) |
264 | acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n"); | 267 | acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n"); |
265 | return -ENODEV; | ||
266 | } | ||
267 | pr->apic_id = apic_id; | 268 | pr->apic_id = apic_id; |
268 | 269 | ||
269 | cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); | 270 | cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id); |
diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 68d97441432c..12878e1982f7 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c | |||
@@ -45,10 +45,71 @@ | |||
45 | #include "accommon.h" | 45 | #include "accommon.h" |
46 | #include "acdispat.h" | 46 | #include "acdispat.h" |
47 | #include "acinterp.h" | 47 | #include "acinterp.h" |
48 | #include "amlcode.h" | ||
48 | 49 | ||
49 | #define _COMPONENT ACPI_EXECUTER | 50 | #define _COMPONENT ACPI_EXECUTER |
50 | ACPI_MODULE_NAME("exfield") | 51 | ACPI_MODULE_NAME("exfield") |
51 | 52 | ||
53 | /* Local prototypes */ | ||
54 | static u32 | ||
55 | acpi_ex_get_serial_access_length(u32 accessor_type, u32 access_length); | ||
56 | |||
57 | /******************************************************************************* | ||
58 | * | ||
59 | * FUNCTION: acpi_get_serial_access_bytes | ||
60 | * | ||
61 | * PARAMETERS: accessor_type - The type of the protocol indicated by region | ||
62 | * field access attributes | ||
63 | * access_length - The access length of the region field | ||
64 | * | ||
65 | * RETURN: Decoded access length | ||
66 | * | ||
67 | * DESCRIPTION: This routine returns the length of the generic_serial_bus | ||
68 | * protocol bytes | ||
69 | * | ||
70 | ******************************************************************************/ | ||
71 | |||
72 | static u32 | ||
73 | acpi_ex_get_serial_access_length(u32 accessor_type, u32 access_length) | ||
74 | { | ||
75 | u32 length; | ||
76 | |||
77 | switch (accessor_type) { | ||
78 | case AML_FIELD_ATTRIB_QUICK: | ||
79 | |||
80 | length = 0; | ||
81 | break; | ||
82 | |||
83 | case AML_FIELD_ATTRIB_SEND_RCV: | ||
84 | case AML_FIELD_ATTRIB_BYTE: | ||
85 | |||
86 | length = 1; | ||
87 | break; | ||
88 | |||
89 | case AML_FIELD_ATTRIB_WORD: | ||
90 | case AML_FIELD_ATTRIB_WORD_CALL: | ||
91 | |||
92 | length = 2; | ||
93 | break; | ||
94 | |||
95 | case AML_FIELD_ATTRIB_MULTIBYTE: | ||
96 | case AML_FIELD_ATTRIB_RAW_BYTES: | ||
97 | case AML_FIELD_ATTRIB_RAW_PROCESS: | ||
98 | |||
99 | length = access_length; | ||
100 | break; | ||
101 | |||
102 | case AML_FIELD_ATTRIB_BLOCK: | ||
103 | case AML_FIELD_ATTRIB_BLOCK_CALL: | ||
104 | default: | ||
105 | |||
106 | length = ACPI_GSBUS_BUFFER_SIZE; | ||
107 | break; | ||
108 | } | ||
109 | |||
110 | return (length); | ||
111 | } | ||
112 | |||
52 | /******************************************************************************* | 113 | /******************************************************************************* |
53 | * | 114 | * |
54 | * FUNCTION: acpi_ex_read_data_from_field | 115 | * FUNCTION: acpi_ex_read_data_from_field |
@@ -63,8 +124,9 @@ ACPI_MODULE_NAME("exfield") | |||
63 | * Buffer, depending on the size of the field. | 124 | * Buffer, depending on the size of the field. |
64 | * | 125 | * |
65 | ******************************************************************************/ | 126 | ******************************************************************************/ |
127 | |||
66 | acpi_status | 128 | acpi_status |
67 | acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | 129 | acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, |
68 | union acpi_operand_object *obj_desc, | 130 | union acpi_operand_object *obj_desc, |
69 | union acpi_operand_object **ret_buffer_desc) | 131 | union acpi_operand_object **ret_buffer_desc) |
70 | { | 132 | { |
@@ -73,6 +135,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
73 | acpi_size length; | 135 | acpi_size length; |
74 | void *buffer; | 136 | void *buffer; |
75 | u32 function; | 137 | u32 function; |
138 | u16 accessor_type; | ||
76 | 139 | ||
77 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); | 140 | ACPI_FUNCTION_TRACE_PTR(ex_read_data_from_field, obj_desc); |
78 | 141 | ||
@@ -116,9 +179,22 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, | |||
116 | ACPI_READ | (obj_desc->field.attribute << 16); | 179 | ACPI_READ | (obj_desc->field.attribute << 16); |
117 | } else if (obj_desc->field.region_obj->region.space_id == | 180 | } else if (obj_desc->field.region_obj->region.space_id == |
118 | ACPI_ADR_SPACE_GSBUS) { | 181 | ACPI_ADR_SPACE_GSBUS) { |
119 | length = ACPI_GSBUS_BUFFER_SIZE; | 182 | accessor_type = obj_desc->field.attribute; |
120 | function = | 183 | length = acpi_ex_get_serial_access_length(accessor_type, |
121 | ACPI_READ | (obj_desc->field.attribute << 16); | 184 | obj_desc-> |
185 | field. | ||
186 | access_length); | ||
187 | |||
188 | /* | ||
189 | * Add additional 2 bytes for modeled generic_serial_bus data buffer: | ||
190 | * typedef struct { | ||
191 | * BYTEStatus; // Byte 0 of the data buffer | ||
192 | * BYTELength; // Byte 1 of the data buffer | ||
193 | * BYTE[x-1]Data; // Bytes 2-x of the arbitrary length data buffer, | ||
194 | * } | ||
195 | */ | ||
196 | length += 2; | ||
197 | function = ACPI_READ | (accessor_type << 16); | ||
122 | } else { /* IPMI */ | 198 | } else { /* IPMI */ |
123 | 199 | ||
124 | length = ACPI_IPMI_BUFFER_SIZE; | 200 | length = ACPI_IPMI_BUFFER_SIZE; |
@@ -231,6 +307,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
231 | void *buffer; | 307 | void *buffer; |
232 | union acpi_operand_object *buffer_desc; | 308 | union acpi_operand_object *buffer_desc; |
233 | u32 function; | 309 | u32 function; |
310 | u16 accessor_type; | ||
234 | 311 | ||
235 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); | 312 | ACPI_FUNCTION_TRACE_PTR(ex_write_data_to_field, obj_desc); |
236 | 313 | ||
@@ -284,9 +361,22 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, | |||
284 | ACPI_WRITE | (obj_desc->field.attribute << 16); | 361 | ACPI_WRITE | (obj_desc->field.attribute << 16); |
285 | } else if (obj_desc->field.region_obj->region.space_id == | 362 | } else if (obj_desc->field.region_obj->region.space_id == |
286 | ACPI_ADR_SPACE_GSBUS) { | 363 | ACPI_ADR_SPACE_GSBUS) { |
287 | length = ACPI_GSBUS_BUFFER_SIZE; | 364 | accessor_type = obj_desc->field.attribute; |
288 | function = | 365 | length = acpi_ex_get_serial_access_length(accessor_type, |
289 | ACPI_WRITE | (obj_desc->field.attribute << 16); | 366 | obj_desc-> |
367 | field. | ||
368 | access_length); | ||
369 | |||
370 | /* | ||
371 | * Add additional 2 bytes for modeled generic_serial_bus data buffer: | ||
372 | * typedef struct { | ||
373 | * BYTEStatus; // Byte 0 of the data buffer | ||
374 | * BYTELength; // Byte 1 of the data buffer | ||
375 | * BYTE[x-1]Data; // Bytes 2-x of the arbitrary length data buffer, | ||
376 | * } | ||
377 | */ | ||
378 | length += 2; | ||
379 | function = ACPI_WRITE | (accessor_type << 16); | ||
290 | } else { /* IPMI */ | 380 | } else { /* IPMI */ |
291 | 381 | ||
292 | length = ACPI_IPMI_BUFFER_SIZE; | 382 | length = ACPI_IPMI_BUFFER_SIZE; |
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index e7e5844c87d0..cf925c4f36b7 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c | |||
@@ -380,9 +380,8 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) | |||
380 | break; | 380 | break; |
381 | 381 | ||
382 | default: | 382 | default: |
383 | acpi_handle_warn(handle, "Unsupported event type 0x%x\n", type); | 383 | acpi_handle_debug(handle, "Unknown event type 0x%x\n", type); |
384 | ost_code = ACPI_OST_SC_UNRECOGNIZED_NOTIFY; | 384 | break; |
385 | goto err; | ||
386 | } | 385 | } |
387 | 386 | ||
388 | adev = acpi_bus_get_acpi_device(handle); | 387 | adev = acpi_bus_get_acpi_device(handle); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d7d32c28829b..ad11ba4a412d 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -206,13 +206,13 @@ unlock: | |||
206 | spin_unlock_irqrestore(&ec->lock, flags); | 206 | spin_unlock_irqrestore(&ec->lock, flags); |
207 | } | 207 | } |
208 | 208 | ||
209 | static int acpi_ec_sync_query(struct acpi_ec *ec); | 209 | static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data); |
210 | 210 | ||
211 | static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) | 211 | static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) |
212 | { | 212 | { |
213 | if (state & ACPI_EC_FLAG_SCI) { | 213 | if (state & ACPI_EC_FLAG_SCI) { |
214 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) | 214 | if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) |
215 | return acpi_ec_sync_query(ec); | 215 | return acpi_ec_sync_query(ec, NULL); |
216 | } | 216 | } |
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
@@ -443,10 +443,8 @@ acpi_handle ec_get_handle(void) | |||
443 | 443 | ||
444 | EXPORT_SYMBOL(ec_get_handle); | 444 | EXPORT_SYMBOL(ec_get_handle); |
445 | 445 | ||
446 | static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 *data); | ||
447 | |||
448 | /* | 446 | /* |
449 | * Clears stale _Q events that might have accumulated in the EC. | 447 | * Process _Q events that might have accumulated in the EC. |
450 | * Run with locked ec mutex. | 448 | * Run with locked ec mutex. |
451 | */ | 449 | */ |
452 | static void acpi_ec_clear(struct acpi_ec *ec) | 450 | static void acpi_ec_clear(struct acpi_ec *ec) |
@@ -455,7 +453,7 @@ static void acpi_ec_clear(struct acpi_ec *ec) | |||
455 | u8 value = 0; | 453 | u8 value = 0; |
456 | 454 | ||
457 | for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) { | 455 | for (i = 0; i < ACPI_EC_CLEAR_MAX; i++) { |
458 | status = acpi_ec_query_unlocked(ec, &value); | 456 | status = acpi_ec_sync_query(ec, &value); |
459 | if (status || !value) | 457 | if (status || !value) |
460 | break; | 458 | break; |
461 | } | 459 | } |
@@ -582,13 +580,18 @@ static void acpi_ec_run(void *cxt) | |||
582 | kfree(handler); | 580 | kfree(handler); |
583 | } | 581 | } |
584 | 582 | ||
585 | static int acpi_ec_sync_query(struct acpi_ec *ec) | 583 | static int acpi_ec_sync_query(struct acpi_ec *ec, u8 *data) |
586 | { | 584 | { |
587 | u8 value = 0; | 585 | u8 value = 0; |
588 | int status; | 586 | int status; |
589 | struct acpi_ec_query_handler *handler, *copy; | 587 | struct acpi_ec_query_handler *handler, *copy; |
590 | if ((status = acpi_ec_query_unlocked(ec, &value))) | 588 | |
589 | status = acpi_ec_query_unlocked(ec, &value); | ||
590 | if (data) | ||
591 | *data = value; | ||
592 | if (status) | ||
591 | return status; | 593 | return status; |
594 | |||
592 | list_for_each_entry(handler, &ec->list, node) { | 595 | list_for_each_entry(handler, &ec->list, node) { |
593 | if (value == handler->query_bit) { | 596 | if (value == handler->query_bit) { |
594 | /* have custom handler for this bit */ | 597 | /* have custom handler for this bit */ |
@@ -612,7 +615,7 @@ static void acpi_ec_gpe_query(void *ec_cxt) | |||
612 | if (!ec) | 615 | if (!ec) |
613 | return; | 616 | return; |
614 | mutex_lock(&ec->mutex); | 617 | mutex_lock(&ec->mutex); |
615 | acpi_ec_sync_query(ec); | 618 | acpi_ec_sync_query(ec, NULL); |
616 | mutex_unlock(&ec->mutex); | 619 | mutex_unlock(&ec->mutex); |
617 | } | 620 | } |
618 | 621 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 20e03a7eb8b4..c2706047337f 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -116,7 +116,7 @@ config AHCI_ST | |||
116 | 116 | ||
117 | config AHCI_IMX | 117 | config AHCI_IMX |
118 | tristate "Freescale i.MX AHCI SATA support" | 118 | tristate "Freescale i.MX AHCI SATA support" |
119 | depends on MFD_SYSCON | 119 | depends on MFD_SYSCON && (ARCH_MXC || COMPILE_TEST) |
120 | help | 120 | help |
121 | This option enables support for the Freescale i.MX SoC's | 121 | This option enables support for the Freescale i.MX SoC's |
122 | onboard AHCI SATA. | 122 | onboard AHCI SATA. |
@@ -134,8 +134,7 @@ config AHCI_SUNXI | |||
134 | 134 | ||
135 | config AHCI_XGENE | 135 | config AHCI_XGENE |
136 | tristate "APM X-Gene 6.0Gbps AHCI SATA host controller support" | 136 | tristate "APM X-Gene 6.0Gbps AHCI SATA host controller support" |
137 | depends on ARM64 || COMPILE_TEST | 137 | depends on PHY_XGENE |
138 | select PHY_XGENE | ||
139 | help | 138 | help |
140 | This option enables support for APM X-Gene SoC SATA host controller. | 139 | This option enables support for APM X-Gene SoC SATA host controller. |
141 | 140 | ||
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5a0bf8ed649b..71e15b73513d 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -1164,9 +1164,9 @@ static inline void ahci_gtf_filter_workaround(struct ata_host *host) | |||
1164 | #endif | 1164 | #endif |
1165 | 1165 | ||
1166 | static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, | 1166 | static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, |
1167 | struct ahci_host_priv *hpriv) | 1167 | struct ahci_host_priv *hpriv) |
1168 | { | 1168 | { |
1169 | int nvec; | 1169 | int rc, nvec; |
1170 | 1170 | ||
1171 | if (hpriv->flags & AHCI_HFLAG_NO_MSI) | 1171 | if (hpriv->flags & AHCI_HFLAG_NO_MSI) |
1172 | goto intx; | 1172 | goto intx; |
@@ -1183,12 +1183,19 @@ static int ahci_init_interrupts(struct pci_dev *pdev, unsigned int n_ports, | |||
1183 | if (nvec < n_ports) | 1183 | if (nvec < n_ports) |
1184 | goto single_msi; | 1184 | goto single_msi; |
1185 | 1185 | ||
1186 | nvec = pci_enable_msi_range(pdev, nvec, nvec); | 1186 | rc = pci_enable_msi_exact(pdev, nvec); |
1187 | if (nvec == -ENOSPC) | 1187 | if (rc == -ENOSPC) |
1188 | goto single_msi; | 1188 | goto single_msi; |
1189 | else if (nvec < 0) | 1189 | else if (rc < 0) |
1190 | goto intx; | 1190 | goto intx; |
1191 | 1191 | ||
1192 | /* fallback to single MSI mode if the controller enforced MRSM mode */ | ||
1193 | if (readl(hpriv->mmio + HOST_CTL) & HOST_MRSM) { | ||
1194 | pci_disable_msi(pdev); | ||
1195 | printk(KERN_INFO "ahci: MRSM is on, fallback to single MSI\n"); | ||
1196 | goto single_msi; | ||
1197 | } | ||
1198 | |||
1192 | return nvec; | 1199 | return nvec; |
1193 | 1200 | ||
1194 | single_msi: | 1201 | single_msi: |
@@ -1232,18 +1239,18 @@ int ahci_host_activate(struct ata_host *host, int irq, unsigned int n_msis) | |||
1232 | return rc; | 1239 | return rc; |
1233 | 1240 | ||
1234 | for (i = 0; i < host->n_ports; i++) { | 1241 | for (i = 0; i < host->n_ports; i++) { |
1235 | const char* desc; | ||
1236 | struct ahci_port_priv *pp = host->ports[i]->private_data; | 1242 | struct ahci_port_priv *pp = host->ports[i]->private_data; |
1237 | 1243 | ||
1238 | /* pp is NULL for dummy ports */ | 1244 | /* Do not receive interrupts sent by dummy ports */ |
1239 | if (pp) | 1245 | if (!pp) { |
1240 | desc = pp->irq_desc; | 1246 | disable_irq(irq + i); |
1241 | else | 1247 | continue; |
1242 | desc = dev_driver_string(host->dev); | 1248 | } |
1243 | 1249 | ||
1244 | rc = devm_request_threaded_irq(host->dev, | 1250 | rc = devm_request_threaded_irq(host->dev, irq + i, |
1245 | irq + i, ahci_hw_interrupt, ahci_thread_fn, IRQF_SHARED, | 1251 | ahci_hw_interrupt, |
1246 | desc, host->ports[i]); | 1252 | ahci_thread_fn, IRQF_SHARED, |
1253 | pp->irq_desc, host->ports[i]); | ||
1247 | if (rc) | 1254 | if (rc) |
1248 | goto out_free_irqs; | 1255 | goto out_free_irqs; |
1249 | } | 1256 | } |
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 51af275b3388..b5eb886da226 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
@@ -94,6 +94,7 @@ enum { | |||
94 | /* HOST_CTL bits */ | 94 | /* HOST_CTL bits */ |
95 | HOST_RESET = (1 << 0), /* reset controller; self-clear */ | 95 | HOST_RESET = (1 << 0), /* reset controller; self-clear */ |
96 | HOST_IRQ_EN = (1 << 1), /* global IRQ enable */ | 96 | HOST_IRQ_EN = (1 << 1), /* global IRQ enable */ |
97 | HOST_MRSM = (1 << 2), /* MSI Revert to Single Message */ | ||
97 | HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ | 98 | HOST_AHCI_EN = (1 << 31), /* AHCI enabled */ |
98 | 99 | ||
99 | /* HOST_CAP bits */ | 100 | /* HOST_CAP bits */ |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c19734d96d7e..943cc8b83e59 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -4224,8 +4224,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
4224 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, | 4224 | { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, |
4225 | 4225 | ||
4226 | /* devices that don't properly handle queued TRIM commands */ | 4226 | /* devices that don't properly handle queued TRIM commands */ |
4227 | { "Micron_M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4227 | { "Micron_M500*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, |
4228 | { "Crucial_CT???M500SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | 4228 | { "Crucial_CT???M500SSD*", "MU0[1-4]*", ATA_HORKAGE_NO_NCQ_TRIM, }, |
4229 | { "Micron_M550*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
4230 | { "Crucial_CT???M550SSD*", NULL, ATA_HORKAGE_NO_NCQ_TRIM, }, | ||
4229 | 4231 | ||
4230 | /* | 4232 | /* |
4231 | * Some WD SATA-I drives spin up and down erratically when the link | 4233 | * Some WD SATA-I drives spin up and down erratically when the link |
@@ -4792,21 +4794,26 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words) | |||
4792 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) | 4794 | static struct ata_queued_cmd *ata_qc_new(struct ata_port *ap) |
4793 | { | 4795 | { |
4794 | struct ata_queued_cmd *qc = NULL; | 4796 | struct ata_queued_cmd *qc = NULL; |
4795 | unsigned int i; | 4797 | unsigned int i, tag; |
4796 | 4798 | ||
4797 | /* no command while frozen */ | 4799 | /* no command while frozen */ |
4798 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) | 4800 | if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) |
4799 | return NULL; | 4801 | return NULL; |
4800 | 4802 | ||
4801 | /* the last tag is reserved for internal command. */ | 4803 | for (i = 0; i < ATA_MAX_QUEUE; i++) { |
4802 | for (i = 0; i < ATA_MAX_QUEUE - 1; i++) | 4804 | tag = (i + ap->last_tag + 1) % ATA_MAX_QUEUE; |
4803 | if (!test_and_set_bit(i, &ap->qc_allocated)) { | 4805 | |
4804 | qc = __ata_qc_from_tag(ap, i); | 4806 | /* the last tag is reserved for internal command. */ |
4807 | if (tag == ATA_TAG_INTERNAL) | ||
4808 | continue; | ||
4809 | |||
4810 | if (!test_and_set_bit(tag, &ap->qc_allocated)) { | ||
4811 | qc = __ata_qc_from_tag(ap, tag); | ||
4812 | qc->tag = tag; | ||
4813 | ap->last_tag = tag; | ||
4805 | break; | 4814 | break; |
4806 | } | 4815 | } |
4807 | 4816 | } | |
4808 | if (qc) | ||
4809 | qc->tag = i; | ||
4810 | 4817 | ||
4811 | return qc; | 4818 | return qc; |
4812 | } | 4819 | } |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index 6fac524c2f50..4edb1a81f63f 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -898,9 +898,12 @@ static int arasan_cf_probe(struct platform_device *pdev) | |||
898 | 898 | ||
899 | cf_card_detect(acdev, 0); | 899 | cf_card_detect(acdev, 0); |
900 | 900 | ||
901 | return ata_host_activate(host, acdev->irq, irq_handler, 0, | 901 | ret = ata_host_activate(host, acdev->irq, irq_handler, 0, |
902 | &arasan_cf_sht); | 902 | &arasan_cf_sht); |
903 | if (!ret) | ||
904 | return 0; | ||
903 | 905 | ||
906 | cf_exit(acdev); | ||
904 | free_clk: | 907 | free_clk: |
905 | clk_put(acdev->clk); | 908 | clk_put(acdev->clk); |
906 | return ret; | 909 | return ret; |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index e9c87274a781..8a66f23af4c4 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
@@ -407,12 +407,13 @@ static int pata_at91_probe(struct platform_device *pdev) | |||
407 | 407 | ||
408 | host->private_data = info; | 408 | host->private_data = info; |
409 | 409 | ||
410 | return ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, | 410 | ret = ata_host_activate(host, gpio_is_valid(irq) ? gpio_to_irq(irq) : 0, |
411 | gpio_is_valid(irq) ? ata_sff_interrupt : NULL, | 411 | gpio_is_valid(irq) ? ata_sff_interrupt : NULL, |
412 | irq_flags, &pata_at91_sht); | 412 | irq_flags, &pata_at91_sht); |
413 | if (ret) | ||
414 | goto err_put; | ||
413 | 415 | ||
414 | if (!ret) | 416 | return 0; |
415 | return 0; | ||
416 | 417 | ||
417 | err_put: | 418 | err_put: |
418 | clk_put(info->mck); | 419 | clk_put(info->mck); |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index a79566d05666..0610e78c8a2a 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
@@ -594,9 +594,13 @@ static int __init pata_s3c_probe(struct platform_device *pdev) | |||
594 | 594 | ||
595 | platform_set_drvdata(pdev, host); | 595 | platform_set_drvdata(pdev, host); |
596 | 596 | ||
597 | return ata_host_activate(host, info->irq, | 597 | ret = ata_host_activate(host, info->irq, |
598 | info->irq ? pata_s3c_irq : NULL, | 598 | info->irq ? pata_s3c_irq : NULL, |
599 | 0, &pata_s3c_sht); | 599 | 0, &pata_s3c_sht); |
600 | if (ret) | ||
601 | goto stop_clk; | ||
602 | |||
603 | return 0; | ||
600 | 604 | ||
601 | stop_clk: | 605 | stop_clk: |
602 | clk_disable(info->clk); | 606 | clk_disable(info->clk); |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 8986b9f22781..62ec61e8f84a 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -52,6 +52,7 @@ static DEFINE_MUTEX(deferred_probe_mutex); | |||
52 | static LIST_HEAD(deferred_probe_pending_list); | 52 | static LIST_HEAD(deferred_probe_pending_list); |
53 | static LIST_HEAD(deferred_probe_active_list); | 53 | static LIST_HEAD(deferred_probe_active_list); |
54 | static struct workqueue_struct *deferred_wq; | 54 | static struct workqueue_struct *deferred_wq; |
55 | static atomic_t deferred_trigger_count = ATOMIC_INIT(0); | ||
55 | 56 | ||
56 | /** | 57 | /** |
57 | * deferred_probe_work_func() - Retry probing devices in the active list. | 58 | * deferred_probe_work_func() - Retry probing devices in the active list. |
@@ -135,6 +136,17 @@ static bool driver_deferred_probe_enable = false; | |||
135 | * This functions moves all devices from the pending list to the active | 136 | * This functions moves all devices from the pending list to the active |
136 | * list and schedules the deferred probe workqueue to process them. It | 137 | * list and schedules the deferred probe workqueue to process them. It |
137 | * should be called anytime a driver is successfully bound to a device. | 138 | * should be called anytime a driver is successfully bound to a device. |
139 | * | ||
140 | * Note, there is a race condition in multi-threaded probe. In the case where | ||
141 | * more than one device is probing at the same time, it is possible for one | ||
142 | * probe to complete successfully while another is about to defer. If the second | ||
143 | * depends on the first, then it will get put on the pending list after the | ||
144 | * trigger event has already occured and will be stuck there. | ||
145 | * | ||
146 | * The atomic 'deferred_trigger_count' is used to determine if a successful | ||
147 | * trigger has occurred in the midst of probing a driver. If the trigger count | ||
148 | * changes in the midst of a probe, then deferred processing should be triggered | ||
149 | * again. | ||
138 | */ | 150 | */ |
139 | static void driver_deferred_probe_trigger(void) | 151 | static void driver_deferred_probe_trigger(void) |
140 | { | 152 | { |
@@ -147,6 +159,7 @@ static void driver_deferred_probe_trigger(void) | |||
147 | * into the active list so they can be retried by the workqueue | 159 | * into the active list so they can be retried by the workqueue |
148 | */ | 160 | */ |
149 | mutex_lock(&deferred_probe_mutex); | 161 | mutex_lock(&deferred_probe_mutex); |
162 | atomic_inc(&deferred_trigger_count); | ||
150 | list_splice_tail_init(&deferred_probe_pending_list, | 163 | list_splice_tail_init(&deferred_probe_pending_list, |
151 | &deferred_probe_active_list); | 164 | &deferred_probe_active_list); |
152 | mutex_unlock(&deferred_probe_mutex); | 165 | mutex_unlock(&deferred_probe_mutex); |
@@ -265,6 +278,7 @@ static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue); | |||
265 | static int really_probe(struct device *dev, struct device_driver *drv) | 278 | static int really_probe(struct device *dev, struct device_driver *drv) |
266 | { | 279 | { |
267 | int ret = 0; | 280 | int ret = 0; |
281 | int local_trigger_count = atomic_read(&deferred_trigger_count); | ||
268 | 282 | ||
269 | atomic_inc(&probe_count); | 283 | atomic_inc(&probe_count); |
270 | pr_debug("bus: '%s': %s: probing driver %s with device %s\n", | 284 | pr_debug("bus: '%s': %s: probing driver %s with device %s\n", |
@@ -310,6 +324,9 @@ probe_failed: | |||
310 | /* Driver requested deferred probing */ | 324 | /* Driver requested deferred probing */ |
311 | dev_info(dev, "Driver %s requests probe deferral\n", drv->name); | 325 | dev_info(dev, "Driver %s requests probe deferral\n", drv->name); |
312 | driver_deferred_probe_add(dev); | 326 | driver_deferred_probe_add(dev); |
327 | /* Did a trigger occur while probing? Need to re-trigger if yes */ | ||
328 | if (local_trigger_count != atomic_read(&deferred_trigger_count)) | ||
329 | driver_deferred_probe_trigger(); | ||
313 | } else if (ret != -ENODEV && ret != -ENXIO) { | 330 | } else if (ret != -ENODEV && ret != -ENXIO) { |
314 | /* driver matched but the probe failed */ | 331 | /* driver matched but the probe failed */ |
315 | printk(KERN_WARNING | 332 | printk(KERN_WARNING |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index e714709704e4..5b47210889e0 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
16 | #include <linux/of_irq.h> | ||
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
18 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
@@ -87,7 +88,11 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) | |||
87 | return -ENXIO; | 88 | return -ENXIO; |
88 | return dev->archdata.irqs[num]; | 89 | return dev->archdata.irqs[num]; |
89 | #else | 90 | #else |
90 | struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num); | 91 | struct resource *r; |
92 | if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) | ||
93 | return of_irq_get(dev->dev.of_node, num); | ||
94 | |||
95 | r = platform_get_resource(dev, IORESOURCE_IRQ, num); | ||
91 | 96 | ||
92 | return r ? r->start : -ENXIO; | 97 | return r ? r->start : -ENXIO; |
93 | #endif | 98 | #endif |
diff --git a/drivers/clk/tegra/clk-tegra124.c b/drivers/clk/tegra/clk-tegra124.c index 166e02f16c8a..cc37c342c4cb 100644 --- a/drivers/clk/tegra/clk-tegra124.c +++ b/drivers/clk/tegra/clk-tegra124.c | |||
@@ -764,7 +764,6 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = { | |||
764 | [tegra_clk_sdmmc2_8] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true }, | 764 | [tegra_clk_sdmmc2_8] = { .dt_id = TEGRA124_CLK_SDMMC2, .present = true }, |
765 | [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true }, | 765 | [tegra_clk_i2s1] = { .dt_id = TEGRA124_CLK_I2S1, .present = true }, |
766 | [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true }, | 766 | [tegra_clk_i2c1] = { .dt_id = TEGRA124_CLK_I2C1, .present = true }, |
767 | [tegra_clk_ndflash] = { .dt_id = TEGRA124_CLK_NDFLASH, .present = true }, | ||
768 | [tegra_clk_sdmmc1_8] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true }, | 767 | [tegra_clk_sdmmc1_8] = { .dt_id = TEGRA124_CLK_SDMMC1, .present = true }, |
769 | [tegra_clk_sdmmc4_8] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true }, | 768 | [tegra_clk_sdmmc4_8] = { .dt_id = TEGRA124_CLK_SDMMC4, .present = true }, |
770 | [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true }, | 769 | [tegra_clk_pwm] = { .dt_id = TEGRA124_CLK_PWM, .present = true }, |
@@ -809,7 +808,6 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = { | |||
809 | [tegra_clk_trace] = { .dt_id = TEGRA124_CLK_TRACE, .present = true }, | 808 | [tegra_clk_trace] = { .dt_id = TEGRA124_CLK_TRACE, .present = true }, |
810 | [tegra_clk_soc_therm] = { .dt_id = TEGRA124_CLK_SOC_THERM, .present = true }, | 809 | [tegra_clk_soc_therm] = { .dt_id = TEGRA124_CLK_SOC_THERM, .present = true }, |
811 | [tegra_clk_dtv] = { .dt_id = TEGRA124_CLK_DTV, .present = true }, | 810 | [tegra_clk_dtv] = { .dt_id = TEGRA124_CLK_DTV, .present = true }, |
812 | [tegra_clk_ndspeed] = { .dt_id = TEGRA124_CLK_NDSPEED, .present = true }, | ||
813 | [tegra_clk_i2cslow] = { .dt_id = TEGRA124_CLK_I2CSLOW, .present = true }, | 811 | [tegra_clk_i2cslow] = { .dt_id = TEGRA124_CLK_I2CSLOW, .present = true }, |
814 | [tegra_clk_dsib] = { .dt_id = TEGRA124_CLK_DSIB, .present = true }, | 812 | [tegra_clk_dsib] = { .dt_id = TEGRA124_CLK_DSIB, .present = true }, |
815 | [tegra_clk_tsec] = { .dt_id = TEGRA124_CLK_TSEC, .present = true }, | 813 | [tegra_clk_tsec] = { .dt_id = TEGRA124_CLK_TSEC, .present = true }, |
@@ -952,7 +950,6 @@ static struct tegra_clk tegra124_clks[tegra_clk_max] __initdata = { | |||
952 | [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_3_MUX, .present = true }, | 950 | [tegra_clk_clk_out_3_mux] = { .dt_id = TEGRA124_CLK_CLK_OUT_3_MUX, .present = true }, |
953 | [tegra_clk_dsia_mux] = { .dt_id = TEGRA124_CLK_DSIA_MUX, .present = true }, | 951 | [tegra_clk_dsia_mux] = { .dt_id = TEGRA124_CLK_DSIA_MUX, .present = true }, |
954 | [tegra_clk_dsib_mux] = { .dt_id = TEGRA124_CLK_DSIB_MUX, .present = true }, | 952 | [tegra_clk_dsib_mux] = { .dt_id = TEGRA124_CLK_DSIB_MUX, .present = true }, |
955 | [tegra_clk_uarte] = { .dt_id = TEGRA124_CLK_UARTE, .present = true }, | ||
956 | }; | 953 | }; |
957 | 954 | ||
958 | static struct tegra_devclk devclks[] __initdata = { | 955 | static struct tegra_devclk devclks[] __initdata = { |
diff --git a/drivers/clk/versatile/clk-vexpress-osc.c b/drivers/clk/versatile/clk-vexpress-osc.c index 2dc8b41a339d..a535c7bf8574 100644 --- a/drivers/clk/versatile/clk-vexpress-osc.c +++ b/drivers/clk/versatile/clk-vexpress-osc.c | |||
@@ -102,7 +102,7 @@ void __init vexpress_osc_of_setup(struct device_node *node) | |||
102 | 102 | ||
103 | osc = kzalloc(sizeof(*osc), GFP_KERNEL); | 103 | osc = kzalloc(sizeof(*osc), GFP_KERNEL); |
104 | if (!osc) | 104 | if (!osc) |
105 | goto error; | 105 | return; |
106 | 106 | ||
107 | osc->func = vexpress_config_func_get_by_node(node); | 107 | osc->func = vexpress_config_func_get_by_node(node); |
108 | if (!osc->func) { | 108 | if (!osc->func) { |
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 57e823c44d2a..5163ec13429d 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
@@ -66,6 +66,7 @@ static int arch_timer_ppi[MAX_TIMER_PPI]; | |||
66 | static struct clock_event_device __percpu *arch_timer_evt; | 66 | static struct clock_event_device __percpu *arch_timer_evt; |
67 | 67 | ||
68 | static bool arch_timer_use_virtual = true; | 68 | static bool arch_timer_use_virtual = true; |
69 | static bool arch_timer_c3stop; | ||
69 | static bool arch_timer_mem_use_virtual; | 70 | static bool arch_timer_mem_use_virtual; |
70 | 71 | ||
71 | /* | 72 | /* |
@@ -263,7 +264,8 @@ static void __arch_timer_setup(unsigned type, | |||
263 | clk->features = CLOCK_EVT_FEAT_ONESHOT; | 264 | clk->features = CLOCK_EVT_FEAT_ONESHOT; |
264 | 265 | ||
265 | if (type == ARCH_CP15_TIMER) { | 266 | if (type == ARCH_CP15_TIMER) { |
266 | clk->features |= CLOCK_EVT_FEAT_C3STOP; | 267 | if (arch_timer_c3stop) |
268 | clk->features |= CLOCK_EVT_FEAT_C3STOP; | ||
267 | clk->name = "arch_sys_timer"; | 269 | clk->name = "arch_sys_timer"; |
268 | clk->rating = 450; | 270 | clk->rating = 450; |
269 | clk->cpumask = cpumask_of(smp_processor_id()); | 271 | clk->cpumask = cpumask_of(smp_processor_id()); |
@@ -665,6 +667,8 @@ static void __init arch_timer_init(struct device_node *np) | |||
665 | } | 667 | } |
666 | } | 668 | } |
667 | 669 | ||
670 | arch_timer_c3stop = !of_property_read_bool(np, "always-on"); | ||
671 | |||
668 | arch_timer_register(); | 672 | arch_timer_register(); |
669 | arch_timer_common_init(); | 673 | arch_timer_common_init(); |
670 | } | 674 | } |
diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c index a6ee6d7cd63f..acf5a329d538 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c | |||
@@ -416,8 +416,6 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt) | |||
416 | evt->set_mode = exynos4_tick_set_mode; | 416 | evt->set_mode = exynos4_tick_set_mode; |
417 | evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; | 417 | evt->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; |
418 | evt->rating = 450; | 418 | evt->rating = 450; |
419 | clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1), | ||
420 | 0xf, 0x7fffffff); | ||
421 | 419 | ||
422 | exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET); | 420 | exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET); |
423 | 421 | ||
@@ -430,9 +428,12 @@ static int exynos4_local_timer_setup(struct clock_event_device *evt) | |||
430 | evt->irq); | 428 | evt->irq); |
431 | return -EIO; | 429 | return -EIO; |
432 | } | 430 | } |
431 | irq_force_affinity(mct_irqs[MCT_L0_IRQ + cpu], cpumask_of(cpu)); | ||
433 | } else { | 432 | } else { |
434 | enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); | 433 | enable_percpu_irq(mct_irqs[MCT_L0_IRQ], 0); |
435 | } | 434 | } |
435 | clockevents_config_and_register(evt, clk_rate / (TICK_BASE_CNT + 1), | ||
436 | 0xf, 0x7fffffff); | ||
436 | 437 | ||
437 | return 0; | 438 | return 0; |
438 | } | 439 | } |
@@ -450,7 +451,6 @@ static int exynos4_mct_cpu_notify(struct notifier_block *self, | |||
450 | unsigned long action, void *hcpu) | 451 | unsigned long action, void *hcpu) |
451 | { | 452 | { |
452 | struct mct_clock_event_device *mevt; | 453 | struct mct_clock_event_device *mevt; |
453 | unsigned int cpu; | ||
454 | 454 | ||
455 | /* | 455 | /* |
456 | * Grab cpu pointer in each case to avoid spurious | 456 | * Grab cpu pointer in each case to avoid spurious |
@@ -461,12 +461,6 @@ static int exynos4_mct_cpu_notify(struct notifier_block *self, | |||
461 | mevt = this_cpu_ptr(&percpu_mct_tick); | 461 | mevt = this_cpu_ptr(&percpu_mct_tick); |
462 | exynos4_local_timer_setup(&mevt->evt); | 462 | exynos4_local_timer_setup(&mevt->evt); |
463 | break; | 463 | break; |
464 | case CPU_ONLINE: | ||
465 | cpu = (unsigned long)hcpu; | ||
466 | if (mct_int_type == MCT_INT_SPI) | ||
467 | irq_set_affinity(mct_irqs[MCT_L0_IRQ + cpu], | ||
468 | cpumask_of(cpu)); | ||
469 | break; | ||
470 | case CPU_DYING: | 464 | case CPU_DYING: |
471 | mevt = this_cpu_ptr(&percpu_mct_tick); | 465 | mevt = this_cpu_ptr(&percpu_mct_tick); |
472 | exynos4_local_timer_stop(&mevt->evt); | 466 | exynos4_local_timer_stop(&mevt->evt); |
diff --git a/drivers/clocksource/zevio-timer.c b/drivers/clocksource/zevio-timer.c index ca81809d159d..7ce442148c3f 100644 --- a/drivers/clocksource/zevio-timer.c +++ b/drivers/clocksource/zevio-timer.c | |||
@@ -212,4 +212,9 @@ error_free: | |||
212 | return ret; | 212 | return ret; |
213 | } | 213 | } |
214 | 214 | ||
215 | CLOCKSOURCE_OF_DECLARE(zevio_timer, "lsi,zevio-timer", zevio_timer_add); | 215 | static void __init zevio_timer_init(struct device_node *node) |
216 | { | ||
217 | BUG_ON(zevio_timer_add(node)); | ||
218 | } | ||
219 | |||
220 | CLOCKSOURCE_OF_DECLARE(zevio_timer, "lsi,zevio-timer", zevio_timer_init); | ||
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 0e9cce82844b..580503513f0f 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
@@ -92,11 +92,7 @@ config ARM_EXYNOS_CPU_FREQ_BOOST_SW | |||
92 | 92 | ||
93 | config ARM_HIGHBANK_CPUFREQ | 93 | config ARM_HIGHBANK_CPUFREQ |
94 | tristate "Calxeda Highbank-based" | 94 | tristate "Calxeda Highbank-based" |
95 | depends on ARCH_HIGHBANK | 95 | depends on ARCH_HIGHBANK && GENERIC_CPUFREQ_CPU0 && REGULATOR |
96 | select GENERIC_CPUFREQ_CPU0 | ||
97 | select PM_OPP | ||
98 | select REGULATOR | ||
99 | |||
100 | default m | 96 | default m |
101 | help | 97 | help |
102 | This adds the CPUFreq driver for Calxeda Highbank SoC | 98 | This adds the CPUFreq driver for Calxeda Highbank SoC |
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index d00e5d1abd25..5c4369b5d834 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c | |||
@@ -242,7 +242,7 @@ static void do_powersaver(int cx_address, unsigned int mults_index, | |||
242 | * Sets a new clock ratio. | 242 | * Sets a new clock ratio. |
243 | */ | 243 | */ |
244 | 244 | ||
245 | static void longhaul_setstate(struct cpufreq_policy *policy, | 245 | static int longhaul_setstate(struct cpufreq_policy *policy, |
246 | unsigned int table_index) | 246 | unsigned int table_index) |
247 | { | 247 | { |
248 | unsigned int mults_index; | 248 | unsigned int mults_index; |
@@ -258,10 +258,12 @@ static void longhaul_setstate(struct cpufreq_policy *policy, | |||
258 | /* Safety precautions */ | 258 | /* Safety precautions */ |
259 | mult = mults[mults_index & 0x1f]; | 259 | mult = mults[mults_index & 0x1f]; |
260 | if (mult == -1) | 260 | if (mult == -1) |
261 | return; | 261 | return -EINVAL; |
262 | |||
262 | speed = calc_speed(mult); | 263 | speed = calc_speed(mult); |
263 | if ((speed > highest_speed) || (speed < lowest_speed)) | 264 | if ((speed > highest_speed) || (speed < lowest_speed)) |
264 | return; | 265 | return -EINVAL; |
266 | |||
265 | /* Voltage transition before frequency transition? */ | 267 | /* Voltage transition before frequency transition? */ |
266 | if (can_scale_voltage && longhaul_index < table_index) | 268 | if (can_scale_voltage && longhaul_index < table_index) |
267 | dir = 1; | 269 | dir = 1; |
@@ -269,8 +271,6 @@ static void longhaul_setstate(struct cpufreq_policy *policy, | |||
269 | freqs.old = calc_speed(longhaul_get_cpu_mult()); | 271 | freqs.old = calc_speed(longhaul_get_cpu_mult()); |
270 | freqs.new = speed; | 272 | freqs.new = speed; |
271 | 273 | ||
272 | cpufreq_freq_transition_begin(policy, &freqs); | ||
273 | |||
274 | pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", | 274 | pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", |
275 | fsb, mult/10, mult%10, print_speed(speed/1000)); | 275 | fsb, mult/10, mult%10, print_speed(speed/1000)); |
276 | retry_loop: | 276 | retry_loop: |
@@ -385,12 +385,14 @@ retry_loop: | |||
385 | goto retry_loop; | 385 | goto retry_loop; |
386 | } | 386 | } |
387 | } | 387 | } |
388 | /* Report true CPU frequency */ | ||
389 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
390 | 388 | ||
391 | if (!bm_timeout) | 389 | if (!bm_timeout) { |
392 | printk(KERN_INFO PFX "Warning: Timeout while waiting for " | 390 | printk(KERN_INFO PFX "Warning: Timeout while waiting for " |
393 | "idle PCI bus.\n"); | 391 | "idle PCI bus.\n"); |
392 | return -EBUSY; | ||
393 | } | ||
394 | |||
395 | return 0; | ||
394 | } | 396 | } |
395 | 397 | ||
396 | /* | 398 | /* |
@@ -631,9 +633,10 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
631 | unsigned int i; | 633 | unsigned int i; |
632 | unsigned int dir = 0; | 634 | unsigned int dir = 0; |
633 | u8 vid, current_vid; | 635 | u8 vid, current_vid; |
636 | int retval = 0; | ||
634 | 637 | ||
635 | if (!can_scale_voltage) | 638 | if (!can_scale_voltage) |
636 | longhaul_setstate(policy, table_index); | 639 | retval = longhaul_setstate(policy, table_index); |
637 | else { | 640 | else { |
638 | /* On test system voltage transitions exceeding single | 641 | /* On test system voltage transitions exceeding single |
639 | * step up or down were turning motherboard off. Both | 642 | * step up or down were turning motherboard off. Both |
@@ -648,7 +651,7 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
648 | while (i != table_index) { | 651 | while (i != table_index) { |
649 | vid = (longhaul_table[i].driver_data >> 8) & 0x1f; | 652 | vid = (longhaul_table[i].driver_data >> 8) & 0x1f; |
650 | if (vid != current_vid) { | 653 | if (vid != current_vid) { |
651 | longhaul_setstate(policy, i); | 654 | retval = longhaul_setstate(policy, i); |
652 | current_vid = vid; | 655 | current_vid = vid; |
653 | msleep(200); | 656 | msleep(200); |
654 | } | 657 | } |
@@ -657,10 +660,11 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
657 | else | 660 | else |
658 | i--; | 661 | i--; |
659 | } | 662 | } |
660 | longhaul_setstate(policy, table_index); | 663 | retval = longhaul_setstate(policy, table_index); |
661 | } | 664 | } |
665 | |||
662 | longhaul_index = table_index; | 666 | longhaul_index = table_index; |
663 | return 0; | 667 | return retval; |
664 | } | 668 | } |
665 | 669 | ||
666 | 670 | ||
@@ -968,7 +972,15 @@ static void __exit longhaul_exit(void) | |||
968 | 972 | ||
969 | for (i = 0; i < numscales; i++) { | 973 | for (i = 0; i < numscales; i++) { |
970 | if (mults[i] == maxmult) { | 974 | if (mults[i] == maxmult) { |
975 | struct cpufreq_freqs freqs; | ||
976 | |||
977 | freqs.old = policy->cur; | ||
978 | freqs.new = longhaul_table[i].frequency; | ||
979 | freqs.flags = 0; | ||
980 | |||
981 | cpufreq_freq_transition_begin(policy, &freqs); | ||
971 | longhaul_setstate(policy, i); | 982 | longhaul_setstate(policy, i); |
983 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
972 | break; | 984 | break; |
973 | } | 985 | } |
974 | } | 986 | } |
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index 49f120e1bc7b..78904e6ca4a0 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c | |||
@@ -138,22 +138,14 @@ static void powernow_k6_set_cpu_multiplier(unsigned int best_i) | |||
138 | static int powernow_k6_target(struct cpufreq_policy *policy, | 138 | static int powernow_k6_target(struct cpufreq_policy *policy, |
139 | unsigned int best_i) | 139 | unsigned int best_i) |
140 | { | 140 | { |
141 | struct cpufreq_freqs freqs; | ||
142 | 141 | ||
143 | if (clock_ratio[best_i].driver_data > max_multiplier) { | 142 | if (clock_ratio[best_i].driver_data > max_multiplier) { |
144 | printk(KERN_ERR PFX "invalid target frequency\n"); | 143 | printk(KERN_ERR PFX "invalid target frequency\n"); |
145 | return -EINVAL; | 144 | return -EINVAL; |
146 | } | 145 | } |
147 | 146 | ||
148 | freqs.old = busfreq * powernow_k6_get_cpu_multiplier(); | ||
149 | freqs.new = busfreq * clock_ratio[best_i].driver_data; | ||
150 | |||
151 | cpufreq_freq_transition_begin(policy, &freqs); | ||
152 | |||
153 | powernow_k6_set_cpu_multiplier(best_i); | 147 | powernow_k6_set_cpu_multiplier(best_i); |
154 | 148 | ||
155 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
156 | |||
157 | return 0; | 149 | return 0; |
158 | } | 150 | } |
159 | 151 | ||
@@ -227,9 +219,20 @@ have_busfreq: | |||
227 | static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) | 219 | static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) |
228 | { | 220 | { |
229 | unsigned int i; | 221 | unsigned int i; |
230 | for (i = 0; i < 8; i++) { | 222 | |
231 | if (i == max_multiplier) | 223 | for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) { |
224 | if (clock_ratio[i].driver_data == max_multiplier) { | ||
225 | struct cpufreq_freqs freqs; | ||
226 | |||
227 | freqs.old = policy->cur; | ||
228 | freqs.new = clock_ratio[i].frequency; | ||
229 | freqs.flags = 0; | ||
230 | |||
231 | cpufreq_freq_transition_begin(policy, &freqs); | ||
232 | powernow_k6_target(policy, i); | 232 | powernow_k6_target(policy, i); |
233 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
234 | break; | ||
235 | } | ||
233 | } | 236 | } |
234 | return 0; | 237 | return 0; |
235 | } | 238 | } |
diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c index f911645c3f6d..e61e224475ad 100644 --- a/drivers/cpufreq/powernow-k7.c +++ b/drivers/cpufreq/powernow-k7.c | |||
@@ -269,8 +269,6 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) | |||
269 | 269 | ||
270 | freqs.new = powernow_table[index].frequency; | 270 | freqs.new = powernow_table[index].frequency; |
271 | 271 | ||
272 | cpufreq_freq_transition_begin(policy, &freqs); | ||
273 | |||
274 | /* Now do the magic poking into the MSRs. */ | 272 | /* Now do the magic poking into the MSRs. */ |
275 | 273 | ||
276 | if (have_a0 == 1) /* A0 errata 5 */ | 274 | if (have_a0 == 1) /* A0 errata 5 */ |
@@ -290,8 +288,6 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) | |||
290 | if (have_a0 == 1) | 288 | if (have_a0 == 1) |
291 | local_irq_enable(); | 289 | local_irq_enable(); |
292 | 290 | ||
293 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
294 | |||
295 | return 0; | 291 | return 0; |
296 | } | 292 | } |
297 | 293 | ||
diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index 9edccc63245d..af4968813e76 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <asm/cputhreads.h> | 30 | #include <asm/cputhreads.h> |
31 | #include <asm/reg.h> | 31 | #include <asm/reg.h> |
32 | #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */ | ||
32 | 33 | ||
33 | #define POWERNV_MAX_PSTATES 256 | 34 | #define POWERNV_MAX_PSTATES 256 |
34 | 35 | ||
diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index b7e677be1df0..0af618abebaf 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c | |||
@@ -138,6 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
138 | struct cpufreq_frequency_table *table; | 138 | struct cpufreq_frequency_table *table; |
139 | struct cpu_data *data; | 139 | struct cpu_data *data; |
140 | unsigned int cpu = policy->cpu; | 140 | unsigned int cpu = policy->cpu; |
141 | u64 transition_latency_hz; | ||
141 | 142 | ||
142 | np = of_get_cpu_node(cpu, NULL); | 143 | np = of_get_cpu_node(cpu, NULL); |
143 | if (!np) | 144 | if (!np) |
@@ -205,8 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
205 | for_each_cpu(i, per_cpu(cpu_mask, cpu)) | 206 | for_each_cpu(i, per_cpu(cpu_mask, cpu)) |
206 | per_cpu(cpu_data, i) = data; | 207 | per_cpu(cpu_data, i) = data; |
207 | 208 | ||
209 | transition_latency_hz = 12ULL * NSEC_PER_SEC; | ||
208 | policy->cpuinfo.transition_latency = | 210 | policy->cpuinfo.transition_latency = |
209 | (12 * NSEC_PER_SEC) / fsl_get_sys_freq(); | 211 | do_div(transition_latency_hz, fsl_get_sys_freq()); |
212 | |||
210 | of_node_put(np); | 213 | of_node_put(np); |
211 | 214 | ||
212 | return 0; | 215 | return 0; |
diff --git a/drivers/cpufreq/unicore2-cpufreq.c b/drivers/cpufreq/unicore2-cpufreq.c index 8d045afa7fb4..6f9dfa80563a 100644 --- a/drivers/cpufreq/unicore2-cpufreq.c +++ b/drivers/cpufreq/unicore2-cpufreq.c | |||
@@ -60,9 +60,7 @@ static int __init ucv2_cpu_init(struct cpufreq_policy *policy) | |||
60 | policy->max = policy->cpuinfo.max_freq = 1000000; | 60 | policy->max = policy->cpuinfo.max_freq = 1000000; |
61 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 61 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
62 | policy->clk = clk_get(NULL, "MAIN_CLK"); | 62 | policy->clk = clk_get(NULL, "MAIN_CLK"); |
63 | if (IS_ERR(policy->clk)) | 63 | return PTR_ERR_OR_ZERO(policy->clk); |
64 | return PTR_ERR(policy->clk); | ||
65 | return 0; | ||
66 | } | 64 | } |
67 | 65 | ||
68 | static struct cpufreq_driver ucv2_driver = { | 66 | static struct cpufreq_driver ucv2_driver = { |
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index bf0f8b476696..401add28933f 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
@@ -233,7 +233,7 @@ static void acpi_gpiochip_request_interrupts(struct acpi_gpio_chip *acpi_gpio) | |||
233 | { | 233 | { |
234 | struct gpio_chip *chip = acpi_gpio->chip; | 234 | struct gpio_chip *chip = acpi_gpio->chip; |
235 | 235 | ||
236 | if (!chip->dev || !chip->to_irq) | 236 | if (!chip->to_irq) |
237 | return; | 237 | return; |
238 | 238 | ||
239 | INIT_LIST_HEAD(&acpi_gpio->events); | 239 | INIT_LIST_HEAD(&acpi_gpio->events); |
@@ -253,7 +253,7 @@ static void acpi_gpiochip_free_interrupts(struct acpi_gpio_chip *acpi_gpio) | |||
253 | struct acpi_gpio_event *event, *ep; | 253 | struct acpi_gpio_event *event, *ep; |
254 | struct gpio_chip *chip = acpi_gpio->chip; | 254 | struct gpio_chip *chip = acpi_gpio->chip; |
255 | 255 | ||
256 | if (!chip->dev || !chip->to_irq) | 256 | if (!chip->to_irq) |
257 | return; | 257 | return; |
258 | 258 | ||
259 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { | 259 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { |
@@ -451,7 +451,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address, | |||
451 | if (function == ACPI_WRITE) | 451 | if (function == ACPI_WRITE) |
452 | gpiod_set_raw_value(desc, !!((1 << i) & *value)); | 452 | gpiod_set_raw_value(desc, !!((1 << i) & *value)); |
453 | else | 453 | else |
454 | *value |= gpiod_get_raw_value(desc) << i; | 454 | *value |= (u64)gpiod_get_raw_value(desc) << i; |
455 | } | 455 | } |
456 | 456 | ||
457 | out: | 457 | out: |
@@ -501,6 +501,9 @@ void acpi_gpiochip_add(struct gpio_chip *chip) | |||
501 | acpi_handle handle; | 501 | acpi_handle handle; |
502 | acpi_status status; | 502 | acpi_status status; |
503 | 503 | ||
504 | if (!chip || !chip->dev) | ||
505 | return; | ||
506 | |||
504 | handle = ACPI_HANDLE(chip->dev); | 507 | handle = ACPI_HANDLE(chip->dev); |
505 | if (!handle) | 508 | if (!handle) |
506 | return; | 509 | return; |
@@ -531,6 +534,9 @@ void acpi_gpiochip_remove(struct gpio_chip *chip) | |||
531 | acpi_handle handle; | 534 | acpi_handle handle; |
532 | acpi_status status; | 535 | acpi_status status; |
533 | 536 | ||
537 | if (!chip || !chip->dev) | ||
538 | return; | ||
539 | |||
534 | handle = ACPI_HANDLE(chip->dev); | 540 | handle = ACPI_HANDLE(chip->dev); |
535 | if (!handle) | 541 | if (!handle) |
536 | return; | 542 | return; |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 761013f8b82f..f48817d97480 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1387,8 +1387,8 @@ static int gpiochip_irq_map(struct irq_domain *d, unsigned int irq, | |||
1387 | { | 1387 | { |
1388 | struct gpio_chip *chip = d->host_data; | 1388 | struct gpio_chip *chip = d->host_data; |
1389 | 1389 | ||
1390 | irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); | ||
1391 | irq_set_chip_data(irq, chip); | 1390 | irq_set_chip_data(irq, chip); |
1391 | irq_set_chip_and_handler(irq, chip->irqchip, chip->irq_handler); | ||
1392 | #ifdef CONFIG_ARM | 1392 | #ifdef CONFIG_ARM |
1393 | set_irq_flags(irq, IRQF_VALID); | 1393 | set_irq_flags(irq, IRQF_VALID); |
1394 | #else | 1394 | #else |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index e930d4fe29c7..1ef5ab9c9d51 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -145,6 +145,7 @@ exynos_drm_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
145 | 145 | ||
146 | plane->crtc = crtc; | 146 | plane->crtc = crtc; |
147 | plane->fb = crtc->primary->fb; | 147 | plane->fb = crtc->primary->fb; |
148 | drm_framebuffer_reference(plane->fb); | ||
148 | 149 | ||
149 | return 0; | 150 | return 0; |
150 | } | 151 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c index c786cd4f457b..2a3ad24276f8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | |||
@@ -263,7 +263,7 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, | |||
263 | buffer->sgt = sgt; | 263 | buffer->sgt = sgt; |
264 | exynos_gem_obj->base.import_attach = attach; | 264 | exynos_gem_obj->base.import_attach = attach; |
265 | 265 | ||
266 | DRM_DEBUG_PRIME("dma_addr = 0x%x, size = 0x%lx\n", buffer->dma_addr, | 266 | DRM_DEBUG_PRIME("dma_addr = %pad, size = 0x%lx\n", &buffer->dma_addr, |
267 | buffer->size); | 267 | buffer->size); |
268 | 268 | ||
269 | return &exynos_gem_obj->base; | 269 | return &exynos_gem_obj->base; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index eb73e3bf2a0c..4ac438187568 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c | |||
@@ -1426,9 +1426,9 @@ static int exynos_dsi_probe(struct platform_device *pdev) | |||
1426 | 1426 | ||
1427 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1427 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1428 | dsi->reg_base = devm_ioremap_resource(&pdev->dev, res); | 1428 | dsi->reg_base = devm_ioremap_resource(&pdev->dev, res); |
1429 | if (!dsi->reg_base) { | 1429 | if (IS_ERR(dsi->reg_base)) { |
1430 | dev_err(&pdev->dev, "failed to remap io region\n"); | 1430 | dev_err(&pdev->dev, "failed to remap io region\n"); |
1431 | return -EADDRNOTAVAIL; | 1431 | return PTR_ERR(dsi->reg_base); |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | dsi->phy = devm_phy_get(&pdev->dev, "dsim"); | 1434 | dsi->phy = devm_phy_get(&pdev->dev, "dsim"); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 7afead9c3f30..852f2dadaebd 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -220,7 +220,7 @@ static void vidi_win_commit(struct exynos_drm_manager *mgr, int zpos) | |||
220 | 220 | ||
221 | win_data->enabled = true; | 221 | win_data->enabled = true; |
222 | 222 | ||
223 | DRM_DEBUG_KMS("dma_addr = 0x%x\n", win_data->dma_addr); | 223 | DRM_DEBUG_KMS("dma_addr = %pad\n", &win_data->dma_addr); |
224 | 224 | ||
225 | if (ctx->vblank_on) | 225 | if (ctx->vblank_on) |
226 | schedule_work(&ctx->work); | 226 | schedule_work(&ctx->work); |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index ab5e93c30aa2..62a5c3627b90 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -50,7 +50,7 @@ bool intel_enable_ppgtt(struct drm_device *dev, bool full) | |||
50 | 50 | ||
51 | /* Full ppgtt disabled by default for now due to issues. */ | 51 | /* Full ppgtt disabled by default for now due to issues. */ |
52 | if (full) | 52 | if (full) |
53 | return false; /* HAS_PPGTT(dev) */ | 53 | return HAS_PPGTT(dev) && (i915.enable_ppgtt == 2); |
54 | else | 54 | else |
55 | return HAS_ALIASING_PPGTT(dev); | 55 | return HAS_ALIASING_PPGTT(dev); |
56 | } | 56 | } |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 7753249b3a95..f98ba4e6e70b 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -1362,10 +1362,20 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev, | |||
1362 | spin_lock(&dev_priv->irq_lock); | 1362 | spin_lock(&dev_priv->irq_lock); |
1363 | for (i = 1; i < HPD_NUM_PINS; i++) { | 1363 | for (i = 1; i < HPD_NUM_PINS; i++) { |
1364 | 1364 | ||
1365 | WARN_ONCE(hpd[i] & hotplug_trigger && | 1365 | if (hpd[i] & hotplug_trigger && |
1366 | dev_priv->hpd_stats[i].hpd_mark == HPD_DISABLED, | 1366 | dev_priv->hpd_stats[i].hpd_mark == HPD_DISABLED) { |
1367 | "Received HPD interrupt (0x%08x) on pin %d (0x%08x) although disabled\n", | 1367 | /* |
1368 | hotplug_trigger, i, hpd[i]); | 1368 | * On GMCH platforms the interrupt mask bits only |
1369 | * prevent irq generation, not the setting of the | ||
1370 | * hotplug bits itself. So only WARN about unexpected | ||
1371 | * interrupts on saner platforms. | ||
1372 | */ | ||
1373 | WARN_ONCE(INTEL_INFO(dev)->gen >= 5 && !IS_VALLEYVIEW(dev), | ||
1374 | "Received HPD interrupt (0x%08x) on pin %d (0x%08x) although disabled\n", | ||
1375 | hotplug_trigger, i, hpd[i]); | ||
1376 | |||
1377 | continue; | ||
1378 | } | ||
1369 | 1379 | ||
1370 | if (!(hpd[i] & hotplug_trigger) || | 1380 | if (!(hpd[i] & hotplug_trigger) || |
1371 | dev_priv->hpd_stats[i].hpd_mark != HPD_ENABLED) | 1381 | dev_priv->hpd_stats[i].hpd_mark != HPD_ENABLED) |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 9f5b18d9d885..c77af69c2d8f 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -827,6 +827,7 @@ enum punit_power_well { | |||
827 | # define MI_FLUSH_ENABLE (1 << 12) | 827 | # define MI_FLUSH_ENABLE (1 << 12) |
828 | # define ASYNC_FLIP_PERF_DISABLE (1 << 14) | 828 | # define ASYNC_FLIP_PERF_DISABLE (1 << 14) |
829 | # define MODE_IDLE (1 << 9) | 829 | # define MODE_IDLE (1 << 9) |
830 | # define STOP_RING (1 << 8) | ||
830 | 831 | ||
831 | #define GEN6_GT_MODE 0x20d0 | 832 | #define GEN6_GT_MODE 0x20d0 |
832 | #define GEN7_GT_MODE 0x7008 | 833 | #define GEN7_GT_MODE 0x7008 |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dae976f51d83..69bcc42a0e44 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -9654,11 +9654,22 @@ intel_pipe_config_compare(struct drm_device *dev, | |||
9654 | PIPE_CONF_CHECK_I(pipe_src_w); | 9654 | PIPE_CONF_CHECK_I(pipe_src_w); |
9655 | PIPE_CONF_CHECK_I(pipe_src_h); | 9655 | PIPE_CONF_CHECK_I(pipe_src_h); |
9656 | 9656 | ||
9657 | PIPE_CONF_CHECK_I(gmch_pfit.control); | 9657 | /* |
9658 | /* pfit ratios are autocomputed by the hw on gen4+ */ | 9658 | * FIXME: BIOS likes to set up a cloned config with lvds+external |
9659 | if (INTEL_INFO(dev)->gen < 4) | 9659 | * screen. Since we don't yet re-compute the pipe config when moving |
9660 | PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); | 9660 | * just the lvds port away to another pipe the sw tracking won't match. |
9661 | PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); | 9661 | * |
9662 | * Proper atomic modesets with recomputed global state will fix this. | ||
9663 | * Until then just don't check gmch state for inherited modes. | ||
9664 | */ | ||
9665 | if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_INHERITED_MODE)) { | ||
9666 | PIPE_CONF_CHECK_I(gmch_pfit.control); | ||
9667 | /* pfit ratios are autocomputed by the hw on gen4+ */ | ||
9668 | if (INTEL_INFO(dev)->gen < 4) | ||
9669 | PIPE_CONF_CHECK_I(gmch_pfit.pgm_ratios); | ||
9670 | PIPE_CONF_CHECK_I(gmch_pfit.lvds_border_bits); | ||
9671 | } | ||
9672 | |||
9662 | PIPE_CONF_CHECK_I(pch_pfit.enabled); | 9673 | PIPE_CONF_CHECK_I(pch_pfit.enabled); |
9663 | if (current_config->pch_pfit.enabled) { | 9674 | if (current_config->pch_pfit.enabled) { |
9664 | PIPE_CONF_CHECK_I(pch_pfit.pos); | 9675 | PIPE_CONF_CHECK_I(pch_pfit.pos); |
@@ -11616,6 +11627,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) | |||
11616 | base.head) { | 11627 | base.head) { |
11617 | memset(&crtc->config, 0, sizeof(crtc->config)); | 11628 | memset(&crtc->config, 0, sizeof(crtc->config)); |
11618 | 11629 | ||
11630 | crtc->config.quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE; | ||
11631 | |||
11619 | crtc->active = dev_priv->display.get_pipe_config(crtc, | 11632 | crtc->active = dev_priv->display.get_pipe_config(crtc, |
11620 | &crtc->config); | 11633 | &crtc->config); |
11621 | 11634 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index d2a55884ad52..dfa85289f28f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -3619,7 +3619,8 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, | |||
3619 | { | 3619 | { |
3620 | struct drm_connector *connector = &intel_connector->base; | 3620 | struct drm_connector *connector = &intel_connector->base; |
3621 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); | 3621 | struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); |
3622 | struct drm_device *dev = intel_dig_port->base.base.dev; | 3622 | struct intel_encoder *intel_encoder = &intel_dig_port->base; |
3623 | struct drm_device *dev = intel_encoder->base.dev; | ||
3623 | struct drm_i915_private *dev_priv = dev->dev_private; | 3624 | struct drm_i915_private *dev_priv = dev->dev_private; |
3624 | struct drm_display_mode *fixed_mode = NULL; | 3625 | struct drm_display_mode *fixed_mode = NULL; |
3625 | bool has_dpcd; | 3626 | bool has_dpcd; |
@@ -3629,6 +3630,14 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, | |||
3629 | if (!is_edp(intel_dp)) | 3630 | if (!is_edp(intel_dp)) |
3630 | return true; | 3631 | return true; |
3631 | 3632 | ||
3633 | /* The VDD bit needs a power domain reference, so if the bit is already | ||
3634 | * enabled when we boot, grab this reference. */ | ||
3635 | if (edp_have_panel_vdd(intel_dp)) { | ||
3636 | enum intel_display_power_domain power_domain; | ||
3637 | power_domain = intel_display_port_power_domain(intel_encoder); | ||
3638 | intel_display_power_get(dev_priv, power_domain); | ||
3639 | } | ||
3640 | |||
3632 | /* Cache DPCD and EDID for edp. */ | 3641 | /* Cache DPCD and EDID for edp. */ |
3633 | intel_edp_panel_vdd_on(intel_dp); | 3642 | intel_edp_panel_vdd_on(intel_dp); |
3634 | has_dpcd = intel_dp_get_dpcd(intel_dp); | 3643 | has_dpcd = intel_dp_get_dpcd(intel_dp); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 0542de982260..328b1a70264b 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -236,7 +236,8 @@ struct intel_crtc_config { | |||
236 | * tracked with quirk flags so that fastboot and state checker can act | 236 | * tracked with quirk flags so that fastboot and state checker can act |
237 | * accordingly. | 237 | * accordingly. |
238 | */ | 238 | */ |
239 | #define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */ | 239 | #define PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS (1<<0) /* unreliable sync mode.flags */ |
240 | #define PIPE_CONFIG_QUIRK_INHERITED_MODE (1<<1) /* mode inherited from firmware */ | ||
240 | unsigned long quirks; | 241 | unsigned long quirks; |
241 | 242 | ||
242 | /* User requested mode, only valid as a starting point to | 243 | /* User requested mode, only valid as a starting point to |
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index b4d44e62f0c7..fce4a0d93c0b 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c | |||
@@ -132,6 +132,16 @@ static int intelfb_create(struct drm_fb_helper *helper, | |||
132 | 132 | ||
133 | mutex_lock(&dev->struct_mutex); | 133 | mutex_lock(&dev->struct_mutex); |
134 | 134 | ||
135 | if (intel_fb && | ||
136 | (sizes->fb_width > intel_fb->base.width || | ||
137 | sizes->fb_height > intel_fb->base.height)) { | ||
138 | DRM_DEBUG_KMS("BIOS fb too small (%dx%d), we require (%dx%d)," | ||
139 | " releasing it\n", | ||
140 | intel_fb->base.width, intel_fb->base.height, | ||
141 | sizes->fb_width, sizes->fb_height); | ||
142 | drm_framebuffer_unreference(&intel_fb->base); | ||
143 | intel_fb = ifbdev->fb = NULL; | ||
144 | } | ||
135 | if (!intel_fb || WARN_ON(!intel_fb->obj)) { | 145 | if (!intel_fb || WARN_ON(!intel_fb->obj)) { |
136 | DRM_DEBUG_KMS("no BIOS fb, allocating a new one\n"); | 146 | DRM_DEBUG_KMS("no BIOS fb, allocating a new one\n"); |
137 | ret = intelfb_alloc(helper, sizes); | 147 | ret = intelfb_alloc(helper, sizes); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index b0413e190625..157267aa3561 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -821,11 +821,11 @@ static void intel_disable_hdmi(struct intel_encoder *encoder) | |||
821 | } | 821 | } |
822 | } | 822 | } |
823 | 823 | ||
824 | static int hdmi_portclock_limit(struct intel_hdmi *hdmi) | 824 | static int hdmi_portclock_limit(struct intel_hdmi *hdmi, bool respect_dvi_limit) |
825 | { | 825 | { |
826 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); | 826 | struct drm_device *dev = intel_hdmi_to_dev(hdmi); |
827 | 827 | ||
828 | if (!hdmi->has_hdmi_sink || IS_G4X(dev)) | 828 | if ((respect_dvi_limit && !hdmi->has_hdmi_sink) || IS_G4X(dev)) |
829 | return 165000; | 829 | return 165000; |
830 | else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) | 830 | else if (IS_HASWELL(dev) || INTEL_INFO(dev)->gen >= 8) |
831 | return 300000; | 831 | return 300000; |
@@ -837,7 +837,8 @@ static enum drm_mode_status | |||
837 | intel_hdmi_mode_valid(struct drm_connector *connector, | 837 | intel_hdmi_mode_valid(struct drm_connector *connector, |
838 | struct drm_display_mode *mode) | 838 | struct drm_display_mode *mode) |
839 | { | 839 | { |
840 | if (mode->clock > hdmi_portclock_limit(intel_attached_hdmi(connector))) | 840 | if (mode->clock > hdmi_portclock_limit(intel_attached_hdmi(connector), |
841 | true)) | ||
841 | return MODE_CLOCK_HIGH; | 842 | return MODE_CLOCK_HIGH; |
842 | if (mode->clock < 20000) | 843 | if (mode->clock < 20000) |
843 | return MODE_CLOCK_LOW; | 844 | return MODE_CLOCK_LOW; |
@@ -879,7 +880,7 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, | |||
879 | struct drm_device *dev = encoder->base.dev; | 880 | struct drm_device *dev = encoder->base.dev; |
880 | struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; | 881 | struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; |
881 | int clock_12bpc = pipe_config->adjusted_mode.crtc_clock * 3 / 2; | 882 | int clock_12bpc = pipe_config->adjusted_mode.crtc_clock * 3 / 2; |
882 | int portclock_limit = hdmi_portclock_limit(intel_hdmi); | 883 | int portclock_limit = hdmi_portclock_limit(intel_hdmi, false); |
883 | int desired_bpp; | 884 | int desired_bpp; |
884 | 885 | ||
885 | if (intel_hdmi->color_range_auto) { | 886 | if (intel_hdmi->color_range_auto) { |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 6bc68bdcf433..79fb4cc2137c 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -437,32 +437,41 @@ static void ring_setup_phys_status_page(struct intel_ring_buffer *ring) | |||
437 | I915_WRITE(HWS_PGA, addr); | 437 | I915_WRITE(HWS_PGA, addr); |
438 | } | 438 | } |
439 | 439 | ||
440 | static int init_ring_common(struct intel_ring_buffer *ring) | 440 | static bool stop_ring(struct intel_ring_buffer *ring) |
441 | { | 441 | { |
442 | struct drm_device *dev = ring->dev; | 442 | struct drm_i915_private *dev_priv = to_i915(ring->dev); |
443 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
444 | struct drm_i915_gem_object *obj = ring->obj; | ||
445 | int ret = 0; | ||
446 | u32 head; | ||
447 | 443 | ||
448 | gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); | 444 | if (!IS_GEN2(ring->dev)) { |
445 | I915_WRITE_MODE(ring, _MASKED_BIT_ENABLE(STOP_RING)); | ||
446 | if (wait_for_atomic((I915_READ_MODE(ring) & MODE_IDLE) != 0, 1000)) { | ||
447 | DRM_ERROR("%s :timed out trying to stop ring\n", ring->name); | ||
448 | return false; | ||
449 | } | ||
450 | } | ||
449 | 451 | ||
450 | /* Stop the ring if it's running. */ | ||
451 | I915_WRITE_CTL(ring, 0); | 452 | I915_WRITE_CTL(ring, 0); |
452 | I915_WRITE_HEAD(ring, 0); | 453 | I915_WRITE_HEAD(ring, 0); |
453 | ring->write_tail(ring, 0); | 454 | ring->write_tail(ring, 0); |
454 | if (wait_for_atomic((I915_READ_MODE(ring) & MODE_IDLE) != 0, 1000)) | ||
455 | DRM_ERROR("%s :timed out trying to stop ring\n", ring->name); | ||
456 | 455 | ||
457 | if (I915_NEED_GFX_HWS(dev)) | 456 | if (!IS_GEN2(ring->dev)) { |
458 | intel_ring_setup_status_page(ring); | 457 | (void)I915_READ_CTL(ring); |
459 | else | 458 | I915_WRITE_MODE(ring, _MASKED_BIT_DISABLE(STOP_RING)); |
460 | ring_setup_phys_status_page(ring); | 459 | } |
461 | 460 | ||
462 | head = I915_READ_HEAD(ring) & HEAD_ADDR; | 461 | return (I915_READ_HEAD(ring) & HEAD_ADDR) == 0; |
462 | } | ||
463 | 463 | ||
464 | /* G45 ring initialization fails to reset head to zero */ | 464 | static int init_ring_common(struct intel_ring_buffer *ring) |
465 | if (head != 0) { | 465 | { |
466 | struct drm_device *dev = ring->dev; | ||
467 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
468 | struct drm_i915_gem_object *obj = ring->obj; | ||
469 | int ret = 0; | ||
470 | |||
471 | gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL); | ||
472 | |||
473 | if (!stop_ring(ring)) { | ||
474 | /* G45 ring initialization often fails to reset head to zero */ | ||
466 | DRM_DEBUG_KMS("%s head not reset to zero " | 475 | DRM_DEBUG_KMS("%s head not reset to zero " |
467 | "ctl %08x head %08x tail %08x start %08x\n", | 476 | "ctl %08x head %08x tail %08x start %08x\n", |
468 | ring->name, | 477 | ring->name, |
@@ -471,9 +480,7 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
471 | I915_READ_TAIL(ring), | 480 | I915_READ_TAIL(ring), |
472 | I915_READ_START(ring)); | 481 | I915_READ_START(ring)); |
473 | 482 | ||
474 | I915_WRITE_HEAD(ring, 0); | 483 | if (!stop_ring(ring)) { |
475 | |||
476 | if (I915_READ_HEAD(ring) & HEAD_ADDR) { | ||
477 | DRM_ERROR("failed to set %s head to zero " | 484 | DRM_ERROR("failed to set %s head to zero " |
478 | "ctl %08x head %08x tail %08x start %08x\n", | 485 | "ctl %08x head %08x tail %08x start %08x\n", |
479 | ring->name, | 486 | ring->name, |
@@ -481,9 +488,16 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
481 | I915_READ_HEAD(ring), | 488 | I915_READ_HEAD(ring), |
482 | I915_READ_TAIL(ring), | 489 | I915_READ_TAIL(ring), |
483 | I915_READ_START(ring)); | 490 | I915_READ_START(ring)); |
491 | ret = -EIO; | ||
492 | goto out; | ||
484 | } | 493 | } |
485 | } | 494 | } |
486 | 495 | ||
496 | if (I915_NEED_GFX_HWS(dev)) | ||
497 | intel_ring_setup_status_page(ring); | ||
498 | else | ||
499 | ring_setup_phys_status_page(ring); | ||
500 | |||
487 | /* Initialize the ring. This must happen _after_ we've cleared the ring | 501 | /* Initialize the ring. This must happen _after_ we've cleared the ring |
488 | * registers with the above sequence (the readback of the HEAD registers | 502 | * registers with the above sequence (the readback of the HEAD registers |
489 | * also enforces ordering), otherwise the hw might lose the new ring | 503 | * also enforces ordering), otherwise the hw might lose the new ring |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 270a6a973438..2b91c4b4d34b 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -34,6 +34,7 @@ struct intel_hw_status_page { | |||
34 | #define I915_WRITE_IMR(ring, val) I915_WRITE(RING_IMR((ring)->mmio_base), val) | 34 | #define I915_WRITE_IMR(ring, val) I915_WRITE(RING_IMR((ring)->mmio_base), val) |
35 | 35 | ||
36 | #define I915_READ_MODE(ring) I915_READ(RING_MI_MODE((ring)->mmio_base)) | 36 | #define I915_READ_MODE(ring) I915_READ(RING_MI_MODE((ring)->mmio_base)) |
37 | #define I915_WRITE_MODE(ring, val) I915_WRITE(RING_MI_MODE((ring)->mmio_base), val) | ||
37 | 38 | ||
38 | enum intel_ring_hangcheck_action { | 39 | enum intel_ring_hangcheck_action { |
39 | HANGCHECK_IDLE = 0, | 40 | HANGCHECK_IDLE = 0, |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c index 3e6c0f3ed592..ef9957dbac94 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c | |||
@@ -510,9 +510,8 @@ static void update_cursor(struct drm_crtc *crtc) | |||
510 | MDP4_DMA_CURSOR_BLEND_CONFIG_CURSOR_EN); | 510 | MDP4_DMA_CURSOR_BLEND_CONFIG_CURSOR_EN); |
511 | } else { | 511 | } else { |
512 | /* disable cursor: */ | 512 | /* disable cursor: */ |
513 | mdp4_write(mdp4_kms, REG_MDP4_DMA_CURSOR_BASE(dma), 0); | 513 | mdp4_write(mdp4_kms, REG_MDP4_DMA_CURSOR_BASE(dma), |
514 | mdp4_write(mdp4_kms, REG_MDP4_DMA_CURSOR_BLEND_CONFIG(dma), | 514 | mdp4_kms->blank_cursor_iova); |
515 | MDP4_DMA_CURSOR_BLEND_CONFIG_FORMAT(CURSOR_ARGB)); | ||
516 | } | 515 | } |
517 | 516 | ||
518 | /* and drop the iova ref + obj rev when done scanning out: */ | 517 | /* and drop the iova ref + obj rev when done scanning out: */ |
@@ -574,11 +573,9 @@ static int mdp4_crtc_cursor_set(struct drm_crtc *crtc, | |||
574 | 573 | ||
575 | if (old_bo) { | 574 | if (old_bo) { |
576 | /* drop our previous reference: */ | 575 | /* drop our previous reference: */ |
577 | msm_gem_put_iova(old_bo, mdp4_kms->id); | 576 | drm_flip_work_queue(&mdp4_crtc->unref_cursor_work, old_bo); |
578 | drm_gem_object_unreference_unlocked(old_bo); | ||
579 | } | 577 | } |
580 | 578 | ||
581 | crtc_flush(crtc); | ||
582 | request_pending(crtc, PENDING_CURSOR); | 579 | request_pending(crtc, PENDING_CURSOR); |
583 | 580 | ||
584 | return 0; | 581 | return 0; |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_irq.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_irq.c index c740ccd1cc67..8edd531cb621 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_irq.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_irq.c | |||
@@ -70,12 +70,12 @@ irqreturn_t mdp4_irq(struct msm_kms *kms) | |||
70 | 70 | ||
71 | VERB("status=%08x", status); | 71 | VERB("status=%08x", status); |
72 | 72 | ||
73 | mdp_dispatch_irqs(mdp_kms, status); | ||
74 | |||
73 | for (id = 0; id < priv->num_crtcs; id++) | 75 | for (id = 0; id < priv->num_crtcs; id++) |
74 | if (status & mdp4_crtc_vblank(priv->crtcs[id])) | 76 | if (status & mdp4_crtc_vblank(priv->crtcs[id])) |
75 | drm_handle_vblank(dev, id); | 77 | drm_handle_vblank(dev, id); |
76 | 78 | ||
77 | mdp_dispatch_irqs(mdp_kms, status); | ||
78 | |||
79 | return IRQ_HANDLED; | 79 | return IRQ_HANDLED; |
80 | } | 80 | } |
81 | 81 | ||
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c index 272e707c9487..0bb4faa17523 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | |||
@@ -144,6 +144,10 @@ static void mdp4_preclose(struct msm_kms *kms, struct drm_file *file) | |||
144 | static void mdp4_destroy(struct msm_kms *kms) | 144 | static void mdp4_destroy(struct msm_kms *kms) |
145 | { | 145 | { |
146 | struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); | 146 | struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); |
147 | if (mdp4_kms->blank_cursor_iova) | ||
148 | msm_gem_put_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id); | ||
149 | if (mdp4_kms->blank_cursor_bo) | ||
150 | drm_gem_object_unreference(mdp4_kms->blank_cursor_bo); | ||
147 | kfree(mdp4_kms); | 151 | kfree(mdp4_kms); |
148 | } | 152 | } |
149 | 153 | ||
@@ -372,6 +376,23 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev) | |||
372 | goto fail; | 376 | goto fail; |
373 | } | 377 | } |
374 | 378 | ||
379 | mutex_lock(&dev->struct_mutex); | ||
380 | mdp4_kms->blank_cursor_bo = msm_gem_new(dev, SZ_16K, MSM_BO_WC); | ||
381 | mutex_unlock(&dev->struct_mutex); | ||
382 | if (IS_ERR(mdp4_kms->blank_cursor_bo)) { | ||
383 | ret = PTR_ERR(mdp4_kms->blank_cursor_bo); | ||
384 | dev_err(dev->dev, "could not allocate blank-cursor bo: %d\n", ret); | ||
385 | mdp4_kms->blank_cursor_bo = NULL; | ||
386 | goto fail; | ||
387 | } | ||
388 | |||
389 | ret = msm_gem_get_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id, | ||
390 | &mdp4_kms->blank_cursor_iova); | ||
391 | if (ret) { | ||
392 | dev_err(dev->dev, "could not pin blank-cursor bo: %d\n", ret); | ||
393 | goto fail; | ||
394 | } | ||
395 | |||
375 | return kms; | 396 | return kms; |
376 | 397 | ||
377 | fail: | 398 | fail: |
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h index 66a4d31aec80..715520c54cde 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h | |||
@@ -44,6 +44,10 @@ struct mdp4_kms { | |||
44 | struct clk *lut_clk; | 44 | struct clk *lut_clk; |
45 | 45 | ||
46 | struct mdp_irq error_handler; | 46 | struct mdp_irq error_handler; |
47 | |||
48 | /* empty/blank cursor bo to use when cursor is "disabled" */ | ||
49 | struct drm_gem_object *blank_cursor_bo; | ||
50 | uint32_t blank_cursor_iova; | ||
47 | }; | 51 | }; |
48 | #define to_mdp4_kms(x) container_of(x, struct mdp4_kms, base) | 52 | #define to_mdp4_kms(x) container_of(x, struct mdp4_kms, base) |
49 | 53 | ||
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c index 353d494a497f..f2b985bc2adf 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_irq.c | |||
@@ -71,11 +71,11 @@ static void mdp5_irq_mdp(struct mdp_kms *mdp_kms) | |||
71 | 71 | ||
72 | VERB("status=%08x", status); | 72 | VERB("status=%08x", status); |
73 | 73 | ||
74 | mdp_dispatch_irqs(mdp_kms, status); | ||
75 | |||
74 | for (id = 0; id < priv->num_crtcs; id++) | 76 | for (id = 0; id < priv->num_crtcs; id++) |
75 | if (status & mdp5_crtc_vblank(priv->crtcs[id])) | 77 | if (status & mdp5_crtc_vblank(priv->crtcs[id])) |
76 | drm_handle_vblank(dev, id); | 78 | drm_handle_vblank(dev, id); |
77 | |||
78 | mdp_dispatch_irqs(mdp_kms, status); | ||
79 | } | 79 | } |
80 | 80 | ||
81 | irqreturn_t mdp5_irq(struct msm_kms *kms) | 81 | irqreturn_t mdp5_irq(struct msm_kms *kms) |
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index 6c6d7d4c9b4e..a752ab83b810 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c | |||
@@ -62,11 +62,8 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, | |||
62 | dma_addr_t paddr; | 62 | dma_addr_t paddr; |
63 | int ret, size; | 63 | int ret, size; |
64 | 64 | ||
65 | /* only doing ARGB32 since this is what is needed to alpha-blend | ||
66 | * with video overlays: | ||
67 | */ | ||
68 | sizes->surface_bpp = 32; | 65 | sizes->surface_bpp = 32; |
69 | sizes->surface_depth = 32; | 66 | sizes->surface_depth = 24; |
70 | 67 | ||
71 | DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width, | 68 | DBG("create fbdev: %dx%d@%d (%dx%d)", sizes->surface_width, |
72 | sizes->surface_height, sizes->surface_bpp, | 69 | sizes->surface_height, sizes->surface_bpp, |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 3da8264d3039..bb8026daebc9 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
@@ -118,8 +118,10 @@ static void put_pages(struct drm_gem_object *obj) | |||
118 | 118 | ||
119 | if (iommu_present(&platform_bus_type)) | 119 | if (iommu_present(&platform_bus_type)) |
120 | drm_gem_put_pages(obj, msm_obj->pages, true, false); | 120 | drm_gem_put_pages(obj, msm_obj->pages, true, false); |
121 | else | 121 | else { |
122 | drm_mm_remove_node(msm_obj->vram_node); | 122 | drm_mm_remove_node(msm_obj->vram_node); |
123 | drm_free_large(msm_obj->pages); | ||
124 | } | ||
123 | 125 | ||
124 | msm_obj->pages = NULL; | 126 | msm_obj->pages = NULL; |
125 | } | 127 | } |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 15936524f226..bc0119fb6c12 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -209,6 +209,7 @@ void radeon_dp_aux_init(struct radeon_connector *radeon_connector) | |||
209 | { | 209 | { |
210 | int ret; | 210 | int ret; |
211 | 211 | ||
212 | radeon_connector->ddc_bus->rec.hpd = radeon_connector->hpd.hpd; | ||
212 | radeon_connector->ddc_bus->aux.dev = radeon_connector->base.kdev; | 213 | radeon_connector->ddc_bus->aux.dev = radeon_connector->base.kdev; |
213 | radeon_connector->ddc_bus->aux.transfer = radeon_dp_aux_transfer; | 214 | radeon_connector->ddc_bus->aux.transfer = radeon_dp_aux_transfer; |
214 | ret = drm_dp_aux_register_i2c_bus(&radeon_connector->ddc_bus->aux); | 215 | ret = drm_dp_aux_register_i2c_bus(&radeon_connector->ddc_bus->aux); |
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index 89b4afa5041c..f7e46cf682af 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -597,7 +597,7 @@ int cik_sdma_ring_test(struct radeon_device *rdev, | |||
597 | tmp = 0xCAFEDEAD; | 597 | tmp = 0xCAFEDEAD; |
598 | writel(tmp, ptr); | 598 | writel(tmp, ptr); |
599 | 599 | ||
600 | r = radeon_ring_lock(rdev, ring, 4); | 600 | r = radeon_ring_lock(rdev, ring, 5); |
601 | if (r) { | 601 | if (r) { |
602 | DRM_ERROR("radeon: dma failed to lock ring %d (%d).\n", ring->idx, r); | 602 | DRM_ERROR("radeon: dma failed to lock ring %d (%d).\n", ring->idx, r); |
603 | return r; | 603 | return r; |
diff --git a/drivers/gpu/drm/radeon/r600_dpm.c b/drivers/gpu/drm/radeon/r600_dpm.c index cbf7e3269f84..9c61b74ef441 100644 --- a/drivers/gpu/drm/radeon/r600_dpm.c +++ b/drivers/gpu/drm/radeon/r600_dpm.c | |||
@@ -158,16 +158,18 @@ u32 r600_dpm_get_vblank_time(struct radeon_device *rdev) | |||
158 | u32 line_time_us, vblank_lines; | 158 | u32 line_time_us, vblank_lines; |
159 | u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ | 159 | u32 vblank_time_us = 0xffffffff; /* if the displays are off, vblank time is max */ |
160 | 160 | ||
161 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 161 | if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
162 | radeon_crtc = to_radeon_crtc(crtc); | 162 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
163 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { | 163 | radeon_crtc = to_radeon_crtc(crtc); |
164 | line_time_us = (radeon_crtc->hw_mode.crtc_htotal * 1000) / | 164 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { |
165 | radeon_crtc->hw_mode.clock; | 165 | line_time_us = (radeon_crtc->hw_mode.crtc_htotal * 1000) / |
166 | vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - | 166 | radeon_crtc->hw_mode.clock; |
167 | radeon_crtc->hw_mode.crtc_vdisplay + | 167 | vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - |
168 | (radeon_crtc->v_border * 2); | 168 | radeon_crtc->hw_mode.crtc_vdisplay + |
169 | vblank_time_us = vblank_lines * line_time_us; | 169 | (radeon_crtc->v_border * 2); |
170 | break; | 170 | vblank_time_us = vblank_lines * line_time_us; |
171 | break; | ||
172 | } | ||
171 | } | 173 | } |
172 | } | 174 | } |
173 | 175 | ||
@@ -181,14 +183,15 @@ u32 r600_dpm_get_vrefresh(struct radeon_device *rdev) | |||
181 | struct radeon_crtc *radeon_crtc; | 183 | struct radeon_crtc *radeon_crtc; |
182 | u32 vrefresh = 0; | 184 | u32 vrefresh = 0; |
183 | 185 | ||
184 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 186 | if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
185 | radeon_crtc = to_radeon_crtc(crtc); | 187 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
186 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { | 188 | radeon_crtc = to_radeon_crtc(crtc); |
187 | vrefresh = radeon_crtc->hw_mode.vrefresh; | 189 | if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { |
188 | break; | 190 | vrefresh = radeon_crtc->hw_mode.vrefresh; |
191 | break; | ||
192 | } | ||
189 | } | 193 | } |
190 | } | 194 | } |
191 | |||
192 | return vrefresh; | 195 | return vrefresh; |
193 | } | 196 | } |
194 | 197 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index dedea72f48c4..a9fb0d016d38 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -528,6 +528,13 @@ static bool radeon_atpx_detect(void) | |||
528 | has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true); | 528 | has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true); |
529 | } | 529 | } |
530 | 530 | ||
531 | /* some newer PX laptops mark the dGPU as a non-VGA display device */ | ||
532 | while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_OTHER << 8, pdev)) != NULL) { | ||
533 | vga_count++; | ||
534 | |||
535 | has_atpx |= (radeon_atpx_pci_probe_handle(pdev) == true); | ||
536 | } | ||
537 | |||
531 | if (has_atpx && vga_count == 2) { | 538 | if (has_atpx && vga_count == 2) { |
532 | acpi_get_name(radeon_atpx_priv.atpx.handle, ACPI_FULL_PATHNAME, &buffer); | 539 | acpi_get_name(radeon_atpx_priv.atpx.handle, ACPI_FULL_PATHNAME, &buffer); |
533 | printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", | 540 | printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 2f7cbb901fb1..8d99d5ee8014 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -840,6 +840,38 @@ static void avivo_reduce_ratio(unsigned *nom, unsigned *den, | |||
840 | } | 840 | } |
841 | 841 | ||
842 | /** | 842 | /** |
843 | * avivo_get_fb_ref_div - feedback and ref divider calculation | ||
844 | * | ||
845 | * @nom: nominator | ||
846 | * @den: denominator | ||
847 | * @post_div: post divider | ||
848 | * @fb_div_max: feedback divider maximum | ||
849 | * @ref_div_max: reference divider maximum | ||
850 | * @fb_div: resulting feedback divider | ||
851 | * @ref_div: resulting reference divider | ||
852 | * | ||
853 | * Calculate feedback and reference divider for a given post divider. Makes | ||
854 | * sure we stay within the limits. | ||
855 | */ | ||
856 | static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div, | ||
857 | unsigned fb_div_max, unsigned ref_div_max, | ||
858 | unsigned *fb_div, unsigned *ref_div) | ||
859 | { | ||
860 | /* limit reference * post divider to a maximum */ | ||
861 | ref_div_max = min(210 / post_div, ref_div_max); | ||
862 | |||
863 | /* get matching reference and feedback divider */ | ||
864 | *ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max); | ||
865 | *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den); | ||
866 | |||
867 | /* limit fb divider to its maximum */ | ||
868 | if (*fb_div > fb_div_max) { | ||
869 | *ref_div = DIV_ROUND_CLOSEST(*ref_div * fb_div_max, *fb_div); | ||
870 | *fb_div = fb_div_max; | ||
871 | } | ||
872 | } | ||
873 | |||
874 | /** | ||
843 | * radeon_compute_pll_avivo - compute PLL paramaters | 875 | * radeon_compute_pll_avivo - compute PLL paramaters |
844 | * | 876 | * |
845 | * @pll: information about the PLL | 877 | * @pll: information about the PLL |
@@ -860,6 +892,9 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
860 | u32 *ref_div_p, | 892 | u32 *ref_div_p, |
861 | u32 *post_div_p) | 893 | u32 *post_div_p) |
862 | { | 894 | { |
895 | unsigned target_clock = pll->flags & RADEON_PLL_USE_FRAC_FB_DIV ? | ||
896 | freq : freq / 10; | ||
897 | |||
863 | unsigned fb_div_min, fb_div_max, fb_div; | 898 | unsigned fb_div_min, fb_div_max, fb_div; |
864 | unsigned post_div_min, post_div_max, post_div; | 899 | unsigned post_div_min, post_div_max, post_div; |
865 | unsigned ref_div_min, ref_div_max, ref_div; | 900 | unsigned ref_div_min, ref_div_max, ref_div; |
@@ -880,14 +915,18 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
880 | ref_div_min = pll->reference_div; | 915 | ref_div_min = pll->reference_div; |
881 | else | 916 | else |
882 | ref_div_min = pll->min_ref_div; | 917 | ref_div_min = pll->min_ref_div; |
883 | ref_div_max = pll->max_ref_div; | 918 | |
919 | if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV && | ||
920 | pll->flags & RADEON_PLL_USE_REF_DIV) | ||
921 | ref_div_max = pll->reference_div; | ||
922 | else | ||
923 | ref_div_max = pll->max_ref_div; | ||
884 | 924 | ||
885 | /* determine allowed post divider range */ | 925 | /* determine allowed post divider range */ |
886 | if (pll->flags & RADEON_PLL_USE_POST_DIV) { | 926 | if (pll->flags & RADEON_PLL_USE_POST_DIV) { |
887 | post_div_min = pll->post_div; | 927 | post_div_min = pll->post_div; |
888 | post_div_max = pll->post_div; | 928 | post_div_max = pll->post_div; |
889 | } else { | 929 | } else { |
890 | unsigned target_clock = freq / 10; | ||
891 | unsigned vco_min, vco_max; | 930 | unsigned vco_min, vco_max; |
892 | 931 | ||
893 | if (pll->flags & RADEON_PLL_IS_LCD) { | 932 | if (pll->flags & RADEON_PLL_IS_LCD) { |
@@ -898,6 +937,11 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
898 | vco_max = pll->pll_out_max; | 937 | vco_max = pll->pll_out_max; |
899 | } | 938 | } |
900 | 939 | ||
940 | if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { | ||
941 | vco_min *= 10; | ||
942 | vco_max *= 10; | ||
943 | } | ||
944 | |||
901 | post_div_min = vco_min / target_clock; | 945 | post_div_min = vco_min / target_clock; |
902 | if ((target_clock * post_div_min) < vco_min) | 946 | if ((target_clock * post_div_min) < vco_min) |
903 | ++post_div_min; | 947 | ++post_div_min; |
@@ -912,7 +956,7 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
912 | } | 956 | } |
913 | 957 | ||
914 | /* represent the searched ratio as fractional number */ | 958 | /* represent the searched ratio as fractional number */ |
915 | nom = pll->flags & RADEON_PLL_USE_FRAC_FB_DIV ? freq : freq / 10; | 959 | nom = target_clock; |
916 | den = pll->reference_freq; | 960 | den = pll->reference_freq; |
917 | 961 | ||
918 | /* reduce the numbers to a simpler ratio */ | 962 | /* reduce the numbers to a simpler ratio */ |
@@ -926,7 +970,12 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
926 | diff_best = ~0; | 970 | diff_best = ~0; |
927 | 971 | ||
928 | for (post_div = post_div_min; post_div <= post_div_max; ++post_div) { | 972 | for (post_div = post_div_min; post_div <= post_div_max; ++post_div) { |
929 | unsigned diff = abs(den - den / post_div * post_div); | 973 | unsigned diff; |
974 | avivo_get_fb_ref_div(nom, den, post_div, fb_div_max, | ||
975 | ref_div_max, &fb_div, &ref_div); | ||
976 | diff = abs(target_clock - (pll->reference_freq * fb_div) / | ||
977 | (ref_div * post_div)); | ||
978 | |||
930 | if (diff < diff_best || (diff == diff_best && | 979 | if (diff < diff_best || (diff == diff_best && |
931 | !(pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP))) { | 980 | !(pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP))) { |
932 | 981 | ||
@@ -936,28 +985,9 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
936 | } | 985 | } |
937 | post_div = post_div_best; | 986 | post_div = post_div_best; |
938 | 987 | ||
939 | /* limit reference * post divider to a maximum */ | 988 | /* get the feedback and reference divider for the optimal value */ |
940 | ref_div_max = min(210 / post_div, ref_div_max); | 989 | avivo_get_fb_ref_div(nom, den, post_div, fb_div_max, ref_div_max, |
941 | 990 | &fb_div, &ref_div); | |
942 | /* get matching reference and feedback divider */ | ||
943 | ref_div = max(DIV_ROUND_CLOSEST(den, post_div), 1u); | ||
944 | fb_div = DIV_ROUND_CLOSEST(nom * ref_div * post_div, den); | ||
945 | |||
946 | /* we're almost done, but reference and feedback | ||
947 | divider might be to large now */ | ||
948 | |||
949 | nom = fb_div; | ||
950 | den = ref_div; | ||
951 | |||
952 | if (fb_div > fb_div_max) { | ||
953 | ref_div = DIV_ROUND_CLOSEST(den * fb_div_max, nom); | ||
954 | fb_div = fb_div_max; | ||
955 | } | ||
956 | |||
957 | if (ref_div > ref_div_max) { | ||
958 | ref_div = ref_div_max; | ||
959 | fb_div = DIV_ROUND_CLOSEST(nom * ref_div_max, den); | ||
960 | } | ||
961 | 991 | ||
962 | /* reduce the numbers to a simpler ratio once more */ | 992 | /* reduce the numbers to a simpler ratio once more */ |
963 | /* this also makes sure that the reference divider is large enough */ | 993 | /* this also makes sure that the reference divider is large enough */ |
@@ -979,7 +1009,7 @@ void radeon_compute_pll_avivo(struct radeon_pll *pll, | |||
979 | *post_div_p = post_div; | 1009 | *post_div_p = post_div; |
980 | 1010 | ||
981 | DRM_DEBUG_KMS("%d - %d, pll dividers - fb: %d.%d ref: %d, post %d\n", | 1011 | DRM_DEBUG_KMS("%d - %d, pll dividers - fb: %d.%d ref: %d, post %d\n", |
982 | freq, *dot_clock_p, *fb_div_p, *frac_fb_div_p, | 1012 | freq, *dot_clock_p * 10, *fb_div_p, *frac_fb_div_p, |
983 | ref_div, post_div); | 1013 | ref_div, post_div); |
984 | } | 1014 | } |
985 | 1015 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index fb3d13f693dd..0cc47f12d995 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -107,11 +107,9 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) | |||
107 | flags |= RADEON_IS_PCI; | 107 | flags |= RADEON_IS_PCI; |
108 | } | 108 | } |
109 | 109 | ||
110 | if (radeon_runtime_pm == 1) | 110 | if ((radeon_runtime_pm != 0) && |
111 | flags |= RADEON_IS_PX; | 111 | radeon_has_atpx() && |
112 | else if ((radeon_runtime_pm == -1) && | 112 | ((flags & RADEON_IS_IGP) == 0)) |
113 | radeon_has_atpx() && | ||
114 | ((flags & RADEON_IS_IGP) == 0)) | ||
115 | flags |= RADEON_IS_PX; | 113 | flags |= RADEON_IS_PX; |
116 | 114 | ||
117 | /* radeon_device_init should report only fatal error | 115 | /* radeon_device_init should report only fatal error |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index ee738a524639..6fac8efe8340 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -603,7 +603,6 @@ static const struct attribute_group *hwmon_groups[] = { | |||
603 | static int radeon_hwmon_init(struct radeon_device *rdev) | 603 | static int radeon_hwmon_init(struct radeon_device *rdev) |
604 | { | 604 | { |
605 | int err = 0; | 605 | int err = 0; |
606 | struct device *hwmon_dev; | ||
607 | 606 | ||
608 | switch (rdev->pm.int_thermal_type) { | 607 | switch (rdev->pm.int_thermal_type) { |
609 | case THERMAL_TYPE_RV6XX: | 608 | case THERMAL_TYPE_RV6XX: |
@@ -616,11 +615,11 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
616 | case THERMAL_TYPE_KV: | 615 | case THERMAL_TYPE_KV: |
617 | if (rdev->asic->pm.get_temperature == NULL) | 616 | if (rdev->asic->pm.get_temperature == NULL) |
618 | return err; | 617 | return err; |
619 | hwmon_dev = hwmon_device_register_with_groups(rdev->dev, | 618 | rdev->pm.int_hwmon_dev = hwmon_device_register_with_groups(rdev->dev, |
620 | "radeon", rdev, | 619 | "radeon", rdev, |
621 | hwmon_groups); | 620 | hwmon_groups); |
622 | if (IS_ERR(hwmon_dev)) { | 621 | if (IS_ERR(rdev->pm.int_hwmon_dev)) { |
623 | err = PTR_ERR(hwmon_dev); | 622 | err = PTR_ERR(rdev->pm.int_hwmon_dev); |
624 | dev_err(rdev->dev, | 623 | dev_err(rdev->dev, |
625 | "Unable to register hwmon device: %d\n", err); | 624 | "Unable to register hwmon device: %d\n", err); |
626 | } | 625 | } |
@@ -632,6 +631,12 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
632 | return err; | 631 | return err; |
633 | } | 632 | } |
634 | 633 | ||
634 | static void radeon_hwmon_fini(struct radeon_device *rdev) | ||
635 | { | ||
636 | if (rdev->pm.int_hwmon_dev) | ||
637 | hwmon_device_unregister(rdev->pm.int_hwmon_dev); | ||
638 | } | ||
639 | |||
635 | static void radeon_dpm_thermal_work_handler(struct work_struct *work) | 640 | static void radeon_dpm_thermal_work_handler(struct work_struct *work) |
636 | { | 641 | { |
637 | struct radeon_device *rdev = | 642 | struct radeon_device *rdev = |
@@ -1257,6 +1262,7 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1257 | case CHIP_RV670: | 1262 | case CHIP_RV670: |
1258 | case CHIP_RS780: | 1263 | case CHIP_RS780: |
1259 | case CHIP_RS880: | 1264 | case CHIP_RS880: |
1265 | case CHIP_RV770: | ||
1260 | case CHIP_BARTS: | 1266 | case CHIP_BARTS: |
1261 | case CHIP_TURKS: | 1267 | case CHIP_TURKS: |
1262 | case CHIP_CAICOS: | 1268 | case CHIP_CAICOS: |
@@ -1273,7 +1279,6 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1273 | else | 1279 | else |
1274 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 1280 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
1275 | break; | 1281 | break; |
1276 | case CHIP_RV770: | ||
1277 | case CHIP_RV730: | 1282 | case CHIP_RV730: |
1278 | case CHIP_RV710: | 1283 | case CHIP_RV710: |
1279 | case CHIP_RV740: | 1284 | case CHIP_RV740: |
@@ -1353,6 +1358,8 @@ static void radeon_pm_fini_old(struct radeon_device *rdev) | |||
1353 | device_remove_file(rdev->dev, &dev_attr_power_method); | 1358 | device_remove_file(rdev->dev, &dev_attr_power_method); |
1354 | } | 1359 | } |
1355 | 1360 | ||
1361 | radeon_hwmon_fini(rdev); | ||
1362 | |||
1356 | if (rdev->pm.power_state) | 1363 | if (rdev->pm.power_state) |
1357 | kfree(rdev->pm.power_state); | 1364 | kfree(rdev->pm.power_state); |
1358 | } | 1365 | } |
@@ -1372,6 +1379,8 @@ static void radeon_pm_fini_dpm(struct radeon_device *rdev) | |||
1372 | } | 1379 | } |
1373 | radeon_dpm_fini(rdev); | 1380 | radeon_dpm_fini(rdev); |
1374 | 1381 | ||
1382 | radeon_hwmon_fini(rdev); | ||
1383 | |||
1375 | if (rdev->pm.power_state) | 1384 | if (rdev->pm.power_state) |
1376 | kfree(rdev->pm.power_state); | 1385 | kfree(rdev->pm.power_state); |
1377 | } | 1386 | } |
@@ -1397,12 +1406,14 @@ static void radeon_pm_compute_clocks_old(struct radeon_device *rdev) | |||
1397 | 1406 | ||
1398 | rdev->pm.active_crtcs = 0; | 1407 | rdev->pm.active_crtcs = 0; |
1399 | rdev->pm.active_crtc_count = 0; | 1408 | rdev->pm.active_crtc_count = 0; |
1400 | list_for_each_entry(crtc, | 1409 | if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
1401 | &ddev->mode_config.crtc_list, head) { | 1410 | list_for_each_entry(crtc, |
1402 | radeon_crtc = to_radeon_crtc(crtc); | 1411 | &ddev->mode_config.crtc_list, head) { |
1403 | if (radeon_crtc->enabled) { | 1412 | radeon_crtc = to_radeon_crtc(crtc); |
1404 | rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id); | 1413 | if (radeon_crtc->enabled) { |
1405 | rdev->pm.active_crtc_count++; | 1414 | rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id); |
1415 | rdev->pm.active_crtc_count++; | ||
1416 | } | ||
1406 | } | 1417 | } |
1407 | } | 1418 | } |
1408 | 1419 | ||
@@ -1469,12 +1480,14 @@ static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev) | |||
1469 | /* update active crtc counts */ | 1480 | /* update active crtc counts */ |
1470 | rdev->pm.dpm.new_active_crtcs = 0; | 1481 | rdev->pm.dpm.new_active_crtcs = 0; |
1471 | rdev->pm.dpm.new_active_crtc_count = 0; | 1482 | rdev->pm.dpm.new_active_crtc_count = 0; |
1472 | list_for_each_entry(crtc, | 1483 | if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
1473 | &ddev->mode_config.crtc_list, head) { | 1484 | list_for_each_entry(crtc, |
1474 | radeon_crtc = to_radeon_crtc(crtc); | 1485 | &ddev->mode_config.crtc_list, head) { |
1475 | if (crtc->enabled) { | 1486 | radeon_crtc = to_radeon_crtc(crtc); |
1476 | rdev->pm.dpm.new_active_crtcs |= (1 << radeon_crtc->crtc_id); | 1487 | if (crtc->enabled) { |
1477 | rdev->pm.dpm.new_active_crtc_count++; | 1488 | rdev->pm.dpm.new_active_crtcs |= (1 << radeon_crtc->crtc_id); |
1489 | rdev->pm.dpm.new_active_crtc_count++; | ||
1490 | } | ||
1478 | } | 1491 | } |
1479 | } | 1492 | } |
1480 | 1493 | ||
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 36c717af6cf9..edb871d7d395 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -312,7 +312,7 @@ static void tegra_crtc_disable(struct drm_crtc *crtc) | |||
312 | struct drm_device *drm = crtc->dev; | 312 | struct drm_device *drm = crtc->dev; |
313 | struct drm_plane *plane; | 313 | struct drm_plane *plane; |
314 | 314 | ||
315 | list_for_each_entry(plane, &drm->mode_config.plane_list, head) { | 315 | drm_for_each_legacy_plane(plane, &drm->mode_config.plane_list) { |
316 | if (plane->crtc == crtc) { | 316 | if (plane->crtc == crtc) { |
317 | tegra_plane_disable(plane); | 317 | tegra_plane_disable(plane); |
318 | plane->crtc = NULL; | 318 | plane->crtc = NULL; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 931490b9cfed..87df0b3674fd 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | |||
@@ -1214,14 +1214,36 @@ static int vmw_cmd_dma(struct vmw_private *dev_priv, | |||
1214 | SVGA3dCmdSurfaceDMA dma; | 1214 | SVGA3dCmdSurfaceDMA dma; |
1215 | } *cmd; | 1215 | } *cmd; |
1216 | int ret; | 1216 | int ret; |
1217 | SVGA3dCmdSurfaceDMASuffix *suffix; | ||
1218 | uint32_t bo_size; | ||
1217 | 1219 | ||
1218 | cmd = container_of(header, struct vmw_dma_cmd, header); | 1220 | cmd = container_of(header, struct vmw_dma_cmd, header); |
1221 | suffix = (SVGA3dCmdSurfaceDMASuffix *)((unsigned long) &cmd->dma + | ||
1222 | header->size - sizeof(*suffix)); | ||
1223 | |||
1224 | /* Make sure device and verifier stays in sync. */ | ||
1225 | if (unlikely(suffix->suffixSize != sizeof(*suffix))) { | ||
1226 | DRM_ERROR("Invalid DMA suffix size.\n"); | ||
1227 | return -EINVAL; | ||
1228 | } | ||
1229 | |||
1219 | ret = vmw_translate_guest_ptr(dev_priv, sw_context, | 1230 | ret = vmw_translate_guest_ptr(dev_priv, sw_context, |
1220 | &cmd->dma.guest.ptr, | 1231 | &cmd->dma.guest.ptr, |
1221 | &vmw_bo); | 1232 | &vmw_bo); |
1222 | if (unlikely(ret != 0)) | 1233 | if (unlikely(ret != 0)) |
1223 | return ret; | 1234 | return ret; |
1224 | 1235 | ||
1236 | /* Make sure DMA doesn't cross BO boundaries. */ | ||
1237 | bo_size = vmw_bo->base.num_pages * PAGE_SIZE; | ||
1238 | if (unlikely(cmd->dma.guest.ptr.offset > bo_size)) { | ||
1239 | DRM_ERROR("Invalid DMA offset.\n"); | ||
1240 | return -EINVAL; | ||
1241 | } | ||
1242 | |||
1243 | bo_size -= cmd->dma.guest.ptr.offset; | ||
1244 | if (unlikely(suffix->maximumOffset > bo_size)) | ||
1245 | suffix->maximumOffset = bo_size; | ||
1246 | |||
1225 | ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, | 1247 | ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, |
1226 | user_surface_converter, &cmd->dma.host.sid, | 1248 | user_surface_converter, &cmd->dma.host.sid, |
1227 | NULL); | 1249 | NULL); |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 6d02e3b06375..d76f0b70c6e0 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -365,12 +365,12 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev) | |||
365 | if (cpu_has_tjmax(c)) | 365 | if (cpu_has_tjmax(c)) |
366 | dev_warn(dev, "Unable to read TjMax from CPU %u\n", id); | 366 | dev_warn(dev, "Unable to read TjMax from CPU %u\n", id); |
367 | } else { | 367 | } else { |
368 | val = (eax >> 16) & 0x7f; | 368 | val = (eax >> 16) & 0xff; |
369 | /* | 369 | /* |
370 | * If the TjMax is not plausible, an assumption | 370 | * If the TjMax is not plausible, an assumption |
371 | * will be used | 371 | * will be used |
372 | */ | 372 | */ |
373 | if (val >= 85) { | 373 | if (val) { |
374 | dev_dbg(dev, "TjMax is %d degrees C\n", val); | 374 | dev_dbg(dev, "TjMax is %d degrees C\n", val); |
375 | return val * 1000; | 375 | return val * 1000; |
376 | } | 376 | } |
diff --git a/drivers/hwmon/ltc2945.c b/drivers/hwmon/ltc2945.c index c104cc32989d..c9cddf5f056b 100644 --- a/drivers/hwmon/ltc2945.c +++ b/drivers/hwmon/ltc2945.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for Linear Technology LTC2945 I2C Power Monitor | 2 | * Driver for Linear Technology LTC2945 I2C Power Monitor |
3 | * | 3 | * |
4 | * Copyright (c) 2014 Guenter Roeck | 4 | * Copyright (c) 2014 Guenter Roeck |
@@ -314,8 +314,8 @@ static ssize_t ltc2945_reset_history(struct device *dev, | |||
314 | reg = LTC2945_MAX_ADIN_H; | 314 | reg = LTC2945_MAX_ADIN_H; |
315 | break; | 315 | break; |
316 | default: | 316 | default: |
317 | BUG(); | 317 | WARN_ONCE(1, "Bad register: 0x%x\n", reg); |
318 | break; | 318 | return -EINVAL; |
319 | } | 319 | } |
320 | /* Reset maximum */ | 320 | /* Reset maximum */ |
321 | ret = regmap_bulk_write(regmap, reg, buf_max, num_regs); | 321 | ret = regmap_bulk_write(regmap, reg, buf_max, num_regs); |
diff --git a/drivers/hwmon/vexpress.c b/drivers/hwmon/vexpress.c index d867e6bb2be1..8242b75d96c8 100644 --- a/drivers/hwmon/vexpress.c +++ b/drivers/hwmon/vexpress.c | |||
@@ -27,15 +27,15 @@ | |||
27 | struct vexpress_hwmon_data { | 27 | struct vexpress_hwmon_data { |
28 | struct device *hwmon_dev; | 28 | struct device *hwmon_dev; |
29 | struct vexpress_config_func *func; | 29 | struct vexpress_config_func *func; |
30 | const char *name; | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | static ssize_t vexpress_hwmon_name_show(struct device *dev, | 33 | static ssize_t vexpress_hwmon_name_show(struct device *dev, |
33 | struct device_attribute *dev_attr, char *buffer) | 34 | struct device_attribute *dev_attr, char *buffer) |
34 | { | 35 | { |
35 | const char *compatible = of_get_property(dev->of_node, "compatible", | 36 | struct vexpress_hwmon_data *data = dev_get_drvdata(dev); |
36 | NULL); | ||
37 | 37 | ||
38 | return sprintf(buffer, "%s\n", compatible); | 38 | return sprintf(buffer, "%s\n", data->name); |
39 | } | 39 | } |
40 | 40 | ||
41 | static ssize_t vexpress_hwmon_label_show(struct device *dev, | 41 | static ssize_t vexpress_hwmon_label_show(struct device *dev, |
@@ -43,9 +43,6 @@ static ssize_t vexpress_hwmon_label_show(struct device *dev, | |||
43 | { | 43 | { |
44 | const char *label = of_get_property(dev->of_node, "label", NULL); | 44 | const char *label = of_get_property(dev->of_node, "label", NULL); |
45 | 45 | ||
46 | if (!label) | ||
47 | return -ENOENT; | ||
48 | |||
49 | return snprintf(buffer, PAGE_SIZE, "%s\n", label); | 46 | return snprintf(buffer, PAGE_SIZE, "%s\n", label); |
50 | } | 47 | } |
51 | 48 | ||
@@ -84,6 +81,20 @@ static ssize_t vexpress_hwmon_u64_show(struct device *dev, | |||
84 | to_sensor_dev_attr(dev_attr)->index)); | 81 | to_sensor_dev_attr(dev_attr)->index)); |
85 | } | 82 | } |
86 | 83 | ||
84 | static umode_t vexpress_hwmon_attr_is_visible(struct kobject *kobj, | ||
85 | struct attribute *attr, int index) | ||
86 | { | ||
87 | struct device *dev = kobj_to_dev(kobj); | ||
88 | struct device_attribute *dev_attr = container_of(attr, | ||
89 | struct device_attribute, attr); | ||
90 | |||
91 | if (dev_attr->show == vexpress_hwmon_label_show && | ||
92 | !of_get_property(dev->of_node, "label", NULL)) | ||
93 | return 0; | ||
94 | |||
95 | return attr->mode; | ||
96 | } | ||
97 | |||
87 | static DEVICE_ATTR(name, S_IRUGO, vexpress_hwmon_name_show, NULL); | 98 | static DEVICE_ATTR(name, S_IRUGO, vexpress_hwmon_name_show, NULL); |
88 | 99 | ||
89 | #define VEXPRESS_HWMON_ATTRS(_name, _label_attr, _input_attr) \ | 100 | #define VEXPRESS_HWMON_ATTRS(_name, _label_attr, _input_attr) \ |
@@ -94,14 +105,27 @@ struct attribute *vexpress_hwmon_attrs_##_name[] = { \ | |||
94 | NULL \ | 105 | NULL \ |
95 | } | 106 | } |
96 | 107 | ||
108 | struct vexpress_hwmon_type { | ||
109 | const char *name; | ||
110 | const struct attribute_group **attr_groups; | ||
111 | }; | ||
112 | |||
97 | #if !defined(CONFIG_REGULATOR_VEXPRESS) | 113 | #if !defined(CONFIG_REGULATOR_VEXPRESS) |
98 | static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 114 | static DEVICE_ATTR(in1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); |
99 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show, | 115 | static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, vexpress_hwmon_u32_show, |
100 | NULL, 1000); | 116 | NULL, 1000); |
101 | static VEXPRESS_HWMON_ATTRS(volt, in1_label, in1_input); | 117 | static VEXPRESS_HWMON_ATTRS(volt, in1_label, in1_input); |
102 | static struct attribute_group vexpress_hwmon_group_volt = { | 118 | static struct attribute_group vexpress_hwmon_group_volt = { |
119 | .is_visible = vexpress_hwmon_attr_is_visible, | ||
103 | .attrs = vexpress_hwmon_attrs_volt, | 120 | .attrs = vexpress_hwmon_attrs_volt, |
104 | }; | 121 | }; |
122 | static struct vexpress_hwmon_type vexpress_hwmon_volt = { | ||
123 | .name = "vexpress_volt", | ||
124 | .attr_groups = (const struct attribute_group *[]) { | ||
125 | &vexpress_hwmon_group_volt, | ||
126 | NULL, | ||
127 | }, | ||
128 | }; | ||
105 | #endif | 129 | #endif |
106 | 130 | ||
107 | static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 131 | static DEVICE_ATTR(curr1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); |
@@ -109,52 +133,84 @@ static SENSOR_DEVICE_ATTR(curr1_input, S_IRUGO, vexpress_hwmon_u32_show, | |||
109 | NULL, 1000); | 133 | NULL, 1000); |
110 | static VEXPRESS_HWMON_ATTRS(amp, curr1_label, curr1_input); | 134 | static VEXPRESS_HWMON_ATTRS(amp, curr1_label, curr1_input); |
111 | static struct attribute_group vexpress_hwmon_group_amp = { | 135 | static struct attribute_group vexpress_hwmon_group_amp = { |
136 | .is_visible = vexpress_hwmon_attr_is_visible, | ||
112 | .attrs = vexpress_hwmon_attrs_amp, | 137 | .attrs = vexpress_hwmon_attrs_amp, |
113 | }; | 138 | }; |
139 | static struct vexpress_hwmon_type vexpress_hwmon_amp = { | ||
140 | .name = "vexpress_amp", | ||
141 | .attr_groups = (const struct attribute_group *[]) { | ||
142 | &vexpress_hwmon_group_amp, | ||
143 | NULL | ||
144 | }, | ||
145 | }; | ||
114 | 146 | ||
115 | static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 147 | static DEVICE_ATTR(temp1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); |
116 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show, | 148 | static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, vexpress_hwmon_u32_show, |
117 | NULL, 1000); | 149 | NULL, 1000); |
118 | static VEXPRESS_HWMON_ATTRS(temp, temp1_label, temp1_input); | 150 | static VEXPRESS_HWMON_ATTRS(temp, temp1_label, temp1_input); |
119 | static struct attribute_group vexpress_hwmon_group_temp = { | 151 | static struct attribute_group vexpress_hwmon_group_temp = { |
152 | .is_visible = vexpress_hwmon_attr_is_visible, | ||
120 | .attrs = vexpress_hwmon_attrs_temp, | 153 | .attrs = vexpress_hwmon_attrs_temp, |
121 | }; | 154 | }; |
155 | static struct vexpress_hwmon_type vexpress_hwmon_temp = { | ||
156 | .name = "vexpress_temp", | ||
157 | .attr_groups = (const struct attribute_group *[]) { | ||
158 | &vexpress_hwmon_group_temp, | ||
159 | NULL | ||
160 | }, | ||
161 | }; | ||
122 | 162 | ||
123 | static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 163 | static DEVICE_ATTR(power1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); |
124 | static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show, | 164 | static SENSOR_DEVICE_ATTR(power1_input, S_IRUGO, vexpress_hwmon_u32_show, |
125 | NULL, 1); | 165 | NULL, 1); |
126 | static VEXPRESS_HWMON_ATTRS(power, power1_label, power1_input); | 166 | static VEXPRESS_HWMON_ATTRS(power, power1_label, power1_input); |
127 | static struct attribute_group vexpress_hwmon_group_power = { | 167 | static struct attribute_group vexpress_hwmon_group_power = { |
168 | .is_visible = vexpress_hwmon_attr_is_visible, | ||
128 | .attrs = vexpress_hwmon_attrs_power, | 169 | .attrs = vexpress_hwmon_attrs_power, |
129 | }; | 170 | }; |
171 | static struct vexpress_hwmon_type vexpress_hwmon_power = { | ||
172 | .name = "vexpress_power", | ||
173 | .attr_groups = (const struct attribute_group *[]) { | ||
174 | &vexpress_hwmon_group_power, | ||
175 | NULL | ||
176 | }, | ||
177 | }; | ||
130 | 178 | ||
131 | static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); | 179 | static DEVICE_ATTR(energy1_label, S_IRUGO, vexpress_hwmon_label_show, NULL); |
132 | static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show, | 180 | static SENSOR_DEVICE_ATTR(energy1_input, S_IRUGO, vexpress_hwmon_u64_show, |
133 | NULL, 1); | 181 | NULL, 1); |
134 | static VEXPRESS_HWMON_ATTRS(energy, energy1_label, energy1_input); | 182 | static VEXPRESS_HWMON_ATTRS(energy, energy1_label, energy1_input); |
135 | static struct attribute_group vexpress_hwmon_group_energy = { | 183 | static struct attribute_group vexpress_hwmon_group_energy = { |
184 | .is_visible = vexpress_hwmon_attr_is_visible, | ||
136 | .attrs = vexpress_hwmon_attrs_energy, | 185 | .attrs = vexpress_hwmon_attrs_energy, |
137 | }; | 186 | }; |
187 | static struct vexpress_hwmon_type vexpress_hwmon_energy = { | ||
188 | .name = "vexpress_energy", | ||
189 | .attr_groups = (const struct attribute_group *[]) { | ||
190 | &vexpress_hwmon_group_energy, | ||
191 | NULL | ||
192 | }, | ||
193 | }; | ||
138 | 194 | ||
139 | static struct of_device_id vexpress_hwmon_of_match[] = { | 195 | static struct of_device_id vexpress_hwmon_of_match[] = { |
140 | #if !defined(CONFIG_REGULATOR_VEXPRESS) | 196 | #if !defined(CONFIG_REGULATOR_VEXPRESS) |
141 | { | 197 | { |
142 | .compatible = "arm,vexpress-volt", | 198 | .compatible = "arm,vexpress-volt", |
143 | .data = &vexpress_hwmon_group_volt, | 199 | .data = &vexpress_hwmon_volt, |
144 | }, | 200 | }, |
145 | #endif | 201 | #endif |
146 | { | 202 | { |
147 | .compatible = "arm,vexpress-amp", | 203 | .compatible = "arm,vexpress-amp", |
148 | .data = &vexpress_hwmon_group_amp, | 204 | .data = &vexpress_hwmon_amp, |
149 | }, { | 205 | }, { |
150 | .compatible = "arm,vexpress-temp", | 206 | .compatible = "arm,vexpress-temp", |
151 | .data = &vexpress_hwmon_group_temp, | 207 | .data = &vexpress_hwmon_temp, |
152 | }, { | 208 | }, { |
153 | .compatible = "arm,vexpress-power", | 209 | .compatible = "arm,vexpress-power", |
154 | .data = &vexpress_hwmon_group_power, | 210 | .data = &vexpress_hwmon_power, |
155 | }, { | 211 | }, { |
156 | .compatible = "arm,vexpress-energy", | 212 | .compatible = "arm,vexpress-energy", |
157 | .data = &vexpress_hwmon_group_energy, | 213 | .data = &vexpress_hwmon_energy, |
158 | }, | 214 | }, |
159 | {} | 215 | {} |
160 | }; | 216 | }; |
@@ -165,6 +221,7 @@ static int vexpress_hwmon_probe(struct platform_device *pdev) | |||
165 | int err; | 221 | int err; |
166 | const struct of_device_id *match; | 222 | const struct of_device_id *match; |
167 | struct vexpress_hwmon_data *data; | 223 | struct vexpress_hwmon_data *data; |
224 | const struct vexpress_hwmon_type *type; | ||
168 | 225 | ||
169 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | 226 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
170 | if (!data) | 227 | if (!data) |
@@ -174,12 +231,14 @@ static int vexpress_hwmon_probe(struct platform_device *pdev) | |||
174 | match = of_match_device(vexpress_hwmon_of_match, &pdev->dev); | 231 | match = of_match_device(vexpress_hwmon_of_match, &pdev->dev); |
175 | if (!match) | 232 | if (!match) |
176 | return -ENODEV; | 233 | return -ENODEV; |
234 | type = match->data; | ||
235 | data->name = type->name; | ||
177 | 236 | ||
178 | data->func = vexpress_config_func_get_by_dev(&pdev->dev); | 237 | data->func = vexpress_config_func_get_by_dev(&pdev->dev); |
179 | if (!data->func) | 238 | if (!data->func) |
180 | return -ENODEV; | 239 | return -ENODEV; |
181 | 240 | ||
182 | err = sysfs_create_group(&pdev->dev.kobj, match->data); | 241 | err = sysfs_create_groups(&pdev->dev.kobj, type->attr_groups); |
183 | if (err) | 242 | if (err) |
184 | goto error; | 243 | goto error; |
185 | 244 | ||
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index a43220c2e3d9..4d140bbbe100 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -750,9 +750,10 @@ void intel_idle_state_table_update(void) | |||
750 | if (package_num + 1 > num_sockets) { | 750 | if (package_num + 1 > num_sockets) { |
751 | num_sockets = package_num + 1; | 751 | num_sockets = package_num + 1; |
752 | 752 | ||
753 | if (num_sockets > 4) | 753 | if (num_sockets > 4) { |
754 | cpuidle_state_table = ivt_cstates_8s; | 754 | cpuidle_state_table = ivt_cstates_8s; |
755 | return; | 755 | return; |
756 | } | ||
756 | } | 757 | } |
757 | } | 758 | } |
758 | 759 | ||
diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 5b1aa027c034..89777ed9abd8 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c | |||
@@ -765,14 +765,17 @@ static int at91_adc_probe_pdata(struct at91_adc_state *st, | |||
765 | if (!pdata) | 765 | if (!pdata) |
766 | return -EINVAL; | 766 | return -EINVAL; |
767 | 767 | ||
768 | st->caps = (struct at91_adc_caps *) | ||
769 | platform_get_device_id(pdev)->driver_data; | ||
770 | |||
768 | st->use_external = pdata->use_external_triggers; | 771 | st->use_external = pdata->use_external_triggers; |
769 | st->vref_mv = pdata->vref; | 772 | st->vref_mv = pdata->vref; |
770 | st->channels_mask = pdata->channels_used; | 773 | st->channels_mask = pdata->channels_used; |
771 | st->num_channels = pdata->num_channels; | 774 | st->num_channels = st->caps->num_channels; |
772 | st->startup_time = pdata->startup_time; | 775 | st->startup_time = pdata->startup_time; |
773 | st->trigger_number = pdata->trigger_number; | 776 | st->trigger_number = pdata->trigger_number; |
774 | st->trigger_list = pdata->trigger_list; | 777 | st->trigger_list = pdata->trigger_list; |
775 | st->registers = pdata->registers; | 778 | st->registers = &st->caps->registers; |
776 | 779 | ||
777 | return 0; | 780 | return 0; |
778 | } | 781 | } |
@@ -1004,8 +1007,11 @@ static int at91_adc_probe(struct platform_device *pdev) | |||
1004 | * the best converted final value between two channels selection | 1007 | * the best converted final value between two channels selection |
1005 | * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock | 1008 | * The formula thus is : Sample and Hold Time = (shtim + 1) / ADCClock |
1006 | */ | 1009 | */ |
1007 | shtim = round_up((st->sample_hold_time * adc_clk_khz / | 1010 | if (st->sample_hold_time > 0) |
1008 | 1000) - 1, 1); | 1011 | shtim = round_up((st->sample_hold_time * adc_clk_khz / 1000) |
1012 | - 1, 1); | ||
1013 | else | ||
1014 | shtim = 0; | ||
1009 | 1015 | ||
1010 | reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; | 1016 | reg = AT91_ADC_PRESCAL_(prsc) & st->registers->mr_prescal_mask; |
1011 | reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; | 1017 | reg |= AT91_ADC_STARTUP_(ticks) & st->registers->mr_startup_mask; |
@@ -1101,7 +1107,6 @@ static int at91_adc_remove(struct platform_device *pdev) | |||
1101 | return 0; | 1107 | return 0; |
1102 | } | 1108 | } |
1103 | 1109 | ||
1104 | #ifdef CONFIG_OF | ||
1105 | static struct at91_adc_caps at91sam9260_caps = { | 1110 | static struct at91_adc_caps at91sam9260_caps = { |
1106 | .calc_startup_ticks = calc_startup_ticks_9260, | 1111 | .calc_startup_ticks = calc_startup_ticks_9260, |
1107 | .num_channels = 4, | 1112 | .num_channels = 4, |
@@ -1154,11 +1159,27 @@ static const struct of_device_id at91_adc_dt_ids[] = { | |||
1154 | {}, | 1159 | {}, |
1155 | }; | 1160 | }; |
1156 | MODULE_DEVICE_TABLE(of, at91_adc_dt_ids); | 1161 | MODULE_DEVICE_TABLE(of, at91_adc_dt_ids); |
1157 | #endif | 1162 | |
1163 | static const struct platform_device_id at91_adc_ids[] = { | ||
1164 | { | ||
1165 | .name = "at91sam9260-adc", | ||
1166 | .driver_data = (unsigned long)&at91sam9260_caps, | ||
1167 | }, { | ||
1168 | .name = "at91sam9g45-adc", | ||
1169 | .driver_data = (unsigned long)&at91sam9g45_caps, | ||
1170 | }, { | ||
1171 | .name = "at91sam9x5-adc", | ||
1172 | .driver_data = (unsigned long)&at91sam9x5_caps, | ||
1173 | }, { | ||
1174 | /* terminator */ | ||
1175 | } | ||
1176 | }; | ||
1177 | MODULE_DEVICE_TABLE(platform, at91_adc_ids); | ||
1158 | 1178 | ||
1159 | static struct platform_driver at91_adc_driver = { | 1179 | static struct platform_driver at91_adc_driver = { |
1160 | .probe = at91_adc_probe, | 1180 | .probe = at91_adc_probe, |
1161 | .remove = at91_adc_remove, | 1181 | .remove = at91_adc_remove, |
1182 | .id_table = at91_adc_ids, | ||
1162 | .driver = { | 1183 | .driver = { |
1163 | .name = DRIVER_NAME, | 1184 | .name = DRIVER_NAME, |
1164 | .of_match_table = of_match_ptr(at91_adc_dt_ids), | 1185 | .of_match_table = of_match_ptr(at91_adc_dt_ids), |
diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c index e108f2a9d827..e472cff6eeae 100644 --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c | |||
@@ -165,7 +165,8 @@ static ssize_t iio_scan_el_show(struct device *dev, | |||
165 | int ret; | 165 | int ret; |
166 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 166 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); |
167 | 167 | ||
168 | ret = test_bit(to_iio_dev_attr(attr)->address, | 168 | /* Ensure ret is 0 or 1. */ |
169 | ret = !!test_bit(to_iio_dev_attr(attr)->address, | ||
169 | indio_dev->buffer->scan_mask); | 170 | indio_dev->buffer->scan_mask); |
170 | 171 | ||
171 | return sprintf(buf, "%d\n", ret); | 172 | return sprintf(buf, "%d\n", ret); |
@@ -862,7 +863,8 @@ int iio_scan_mask_query(struct iio_dev *indio_dev, | |||
862 | if (!buffer->scan_mask) | 863 | if (!buffer->scan_mask) |
863 | return 0; | 864 | return 0; |
864 | 865 | ||
865 | return test_bit(bit, buffer->scan_mask); | 866 | /* Ensure return value is 0 or 1. */ |
867 | return !!test_bit(bit, buffer->scan_mask); | ||
866 | }; | 868 | }; |
867 | EXPORT_SYMBOL_GPL(iio_scan_mask_query); | 869 | EXPORT_SYMBOL_GPL(iio_scan_mask_query); |
868 | 870 | ||
diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c index 47a6dbac2d0c..d976e6ce60db 100644 --- a/drivers/iio/light/cm32181.c +++ b/drivers/iio/light/cm32181.c | |||
@@ -221,6 +221,7 @@ static int cm32181_read_raw(struct iio_dev *indio_dev, | |||
221 | *val = cm32181->calibscale; | 221 | *val = cm32181->calibscale; |
222 | return IIO_VAL_INT; | 222 | return IIO_VAL_INT; |
223 | case IIO_CHAN_INFO_INT_TIME: | 223 | case IIO_CHAN_INFO_INT_TIME: |
224 | *val = 0; | ||
224 | ret = cm32181_read_als_it(cm32181, val2); | 225 | ret = cm32181_read_als_it(cm32181, val2); |
225 | return ret; | 226 | return ret; |
226 | } | 227 | } |
diff --git a/drivers/iio/light/cm36651.c b/drivers/iio/light/cm36651.c index a45e07492db3..39fc67e82138 100644 --- a/drivers/iio/light/cm36651.c +++ b/drivers/iio/light/cm36651.c | |||
@@ -652,7 +652,19 @@ static int cm36651_probe(struct i2c_client *client, | |||
652 | cm36651->client = client; | 652 | cm36651->client = client; |
653 | cm36651->ps_client = i2c_new_dummy(client->adapter, | 653 | cm36651->ps_client = i2c_new_dummy(client->adapter, |
654 | CM36651_I2C_ADDR_PS); | 654 | CM36651_I2C_ADDR_PS); |
655 | if (!cm36651->ps_client) { | ||
656 | dev_err(&client->dev, "%s: new i2c device failed\n", __func__); | ||
657 | ret = -ENODEV; | ||
658 | goto error_disable_reg; | ||
659 | } | ||
660 | |||
655 | cm36651->ara_client = i2c_new_dummy(client->adapter, CM36651_ARA); | 661 | cm36651->ara_client = i2c_new_dummy(client->adapter, CM36651_ARA); |
662 | if (!cm36651->ara_client) { | ||
663 | dev_err(&client->dev, "%s: new i2c device failed\n", __func__); | ||
664 | ret = -ENODEV; | ||
665 | goto error_i2c_unregister_ps; | ||
666 | } | ||
667 | |||
656 | mutex_init(&cm36651->lock); | 668 | mutex_init(&cm36651->lock); |
657 | indio_dev->dev.parent = &client->dev; | 669 | indio_dev->dev.parent = &client->dev; |
658 | indio_dev->channels = cm36651_channels; | 670 | indio_dev->channels = cm36651_channels; |
@@ -664,7 +676,7 @@ static int cm36651_probe(struct i2c_client *client, | |||
664 | ret = cm36651_setup_reg(cm36651); | 676 | ret = cm36651_setup_reg(cm36651); |
665 | if (ret) { | 677 | if (ret) { |
666 | dev_err(&client->dev, "%s: register setup failed\n", __func__); | 678 | dev_err(&client->dev, "%s: register setup failed\n", __func__); |
667 | goto error_disable_reg; | 679 | goto error_i2c_unregister_ara; |
668 | } | 680 | } |
669 | 681 | ||
670 | ret = request_threaded_irq(client->irq, NULL, cm36651_irq_handler, | 682 | ret = request_threaded_irq(client->irq, NULL, cm36651_irq_handler, |
@@ -672,7 +684,7 @@ static int cm36651_probe(struct i2c_client *client, | |||
672 | "cm36651", indio_dev); | 684 | "cm36651", indio_dev); |
673 | if (ret) { | 685 | if (ret) { |
674 | dev_err(&client->dev, "%s: request irq failed\n", __func__); | 686 | dev_err(&client->dev, "%s: request irq failed\n", __func__); |
675 | goto error_disable_reg; | 687 | goto error_i2c_unregister_ara; |
676 | } | 688 | } |
677 | 689 | ||
678 | ret = iio_device_register(indio_dev); | 690 | ret = iio_device_register(indio_dev); |
@@ -685,6 +697,10 @@ static int cm36651_probe(struct i2c_client *client, | |||
685 | 697 | ||
686 | error_free_irq: | 698 | error_free_irq: |
687 | free_irq(client->irq, indio_dev); | 699 | free_irq(client->irq, indio_dev); |
700 | error_i2c_unregister_ara: | ||
701 | i2c_unregister_device(cm36651->ara_client); | ||
702 | error_i2c_unregister_ps: | ||
703 | i2c_unregister_device(cm36651->ps_client); | ||
688 | error_disable_reg: | 704 | error_disable_reg: |
689 | regulator_disable(cm36651->vled_reg); | 705 | regulator_disable(cm36651->vled_reg); |
690 | return ret; | 706 | return ret; |
@@ -698,6 +714,8 @@ static int cm36651_remove(struct i2c_client *client) | |||
698 | iio_device_unregister(indio_dev); | 714 | iio_device_unregister(indio_dev); |
699 | regulator_disable(cm36651->vled_reg); | 715 | regulator_disable(cm36651->vled_reg); |
700 | free_irq(client->irq, indio_dev); | 716 | free_irq(client->irq, indio_dev); |
717 | i2c_unregister_device(cm36651->ps_client); | ||
718 | i2c_unregister_device(cm36651->ara_client); | ||
701 | 719 | ||
702 | return 0; | 720 | return 0; |
703 | } | 721 | } |
diff --git a/drivers/infiniband/hw/cxgb4/Kconfig b/drivers/infiniband/hw/cxgb4/Kconfig index d4e8983fba53..23f38cf2c5cd 100644 --- a/drivers/infiniband/hw/cxgb4/Kconfig +++ b/drivers/infiniband/hw/cxgb4/Kconfig | |||
@@ -1,10 +1,10 @@ | |||
1 | config INFINIBAND_CXGB4 | 1 | config INFINIBAND_CXGB4 |
2 | tristate "Chelsio T4 RDMA Driver" | 2 | tristate "Chelsio T4/T5 RDMA Driver" |
3 | depends on CHELSIO_T4 && INET && (IPV6 || IPV6=n) | 3 | depends on CHELSIO_T4 && INET && (IPV6 || IPV6=n) |
4 | select GENERIC_ALLOCATOR | 4 | select GENERIC_ALLOCATOR |
5 | ---help--- | 5 | ---help--- |
6 | This is an iWARP/RDMA driver for the Chelsio T4 1GbE and | 6 | This is an iWARP/RDMA driver for the Chelsio T4 and T5 |
7 | 10GbE adapters. | 7 | 1GbE, 10GbE adapters and T5 40GbE adapter. |
8 | 8 | ||
9 | For general information about Chelsio and our products, visit | 9 | For general information about Chelsio and our products, visit |
10 | our website at <http://www.chelsio.com>. | 10 | our website at <http://www.chelsio.com>. |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 185452abf32c..1f863a96a480 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
@@ -587,6 +587,10 @@ static int send_connect(struct c4iw_ep *ep) | |||
587 | opt2 |= SACK_EN(1); | 587 | opt2 |= SACK_EN(1); |
588 | if (wscale && enable_tcp_window_scaling) | 588 | if (wscale && enable_tcp_window_scaling) |
589 | opt2 |= WND_SCALE_EN(1); | 589 | opt2 |= WND_SCALE_EN(1); |
590 | if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) { | ||
591 | opt2 |= T5_OPT_2_VALID; | ||
592 | opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); | ||
593 | } | ||
590 | t4_set_arp_err_handler(skb, NULL, act_open_req_arp_failure); | 594 | t4_set_arp_err_handler(skb, NULL, act_open_req_arp_failure); |
591 | 595 | ||
592 | if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) { | 596 | if (is_t4(ep->com.dev->rdev.lldi.adapter_type)) { |
@@ -996,7 +1000,7 @@ static void close_complete_upcall(struct c4iw_ep *ep, int status) | |||
996 | static int abort_connection(struct c4iw_ep *ep, struct sk_buff *skb, gfp_t gfp) | 1000 | static int abort_connection(struct c4iw_ep *ep, struct sk_buff *skb, gfp_t gfp) |
997 | { | 1001 | { |
998 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | 1002 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); |
999 | state_set(&ep->com, ABORTING); | 1003 | __state_set(&ep->com, ABORTING); |
1000 | set_bit(ABORT_CONN, &ep->com.history); | 1004 | set_bit(ABORT_CONN, &ep->com.history); |
1001 | return send_abort(ep, skb, gfp); | 1005 | return send_abort(ep, skb, gfp); |
1002 | } | 1006 | } |
@@ -1154,7 +1158,7 @@ static int update_rx_credits(struct c4iw_ep *ep, u32 credits) | |||
1154 | return credits; | 1158 | return credits; |
1155 | } | 1159 | } |
1156 | 1160 | ||
1157 | static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) | 1161 | static int process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) |
1158 | { | 1162 | { |
1159 | struct mpa_message *mpa; | 1163 | struct mpa_message *mpa; |
1160 | struct mpa_v2_conn_params *mpa_v2_params; | 1164 | struct mpa_v2_conn_params *mpa_v2_params; |
@@ -1164,6 +1168,7 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1164 | struct c4iw_qp_attributes attrs; | 1168 | struct c4iw_qp_attributes attrs; |
1165 | enum c4iw_qp_attr_mask mask; | 1169 | enum c4iw_qp_attr_mask mask; |
1166 | int err; | 1170 | int err; |
1171 | int disconnect = 0; | ||
1167 | 1172 | ||
1168 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); | 1173 | PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); |
1169 | 1174 | ||
@@ -1173,7 +1178,7 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1173 | * will abort the connection. | 1178 | * will abort the connection. |
1174 | */ | 1179 | */ |
1175 | if (stop_ep_timer(ep)) | 1180 | if (stop_ep_timer(ep)) |
1176 | return; | 1181 | return 0; |
1177 | 1182 | ||
1178 | /* | 1183 | /* |
1179 | * If we get more than the supported amount of private data | 1184 | * If we get more than the supported amount of private data |
@@ -1195,7 +1200,7 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1195 | * if we don't even have the mpa message, then bail. | 1200 | * if we don't even have the mpa message, then bail. |
1196 | */ | 1201 | */ |
1197 | if (ep->mpa_pkt_len < sizeof(*mpa)) | 1202 | if (ep->mpa_pkt_len < sizeof(*mpa)) |
1198 | return; | 1203 | return 0; |
1199 | mpa = (struct mpa_message *) ep->mpa_pkt; | 1204 | mpa = (struct mpa_message *) ep->mpa_pkt; |
1200 | 1205 | ||
1201 | /* Validate MPA header. */ | 1206 | /* Validate MPA header. */ |
@@ -1235,7 +1240,7 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1235 | * We'll continue process when more data arrives. | 1240 | * We'll continue process when more data arrives. |
1236 | */ | 1241 | */ |
1237 | if (ep->mpa_pkt_len < (sizeof(*mpa) + plen)) | 1242 | if (ep->mpa_pkt_len < (sizeof(*mpa) + plen)) |
1238 | return; | 1243 | return 0; |
1239 | 1244 | ||
1240 | if (mpa->flags & MPA_REJECT) { | 1245 | if (mpa->flags & MPA_REJECT) { |
1241 | err = -ECONNREFUSED; | 1246 | err = -ECONNREFUSED; |
@@ -1337,9 +1342,11 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1337 | attrs.layer_etype = LAYER_MPA | DDP_LLP; | 1342 | attrs.layer_etype = LAYER_MPA | DDP_LLP; |
1338 | attrs.ecode = MPA_NOMATCH_RTR; | 1343 | attrs.ecode = MPA_NOMATCH_RTR; |
1339 | attrs.next_state = C4IW_QP_STATE_TERMINATE; | 1344 | attrs.next_state = C4IW_QP_STATE_TERMINATE; |
1345 | attrs.send_term = 1; | ||
1340 | err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, | 1346 | err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, |
1341 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 0); | 1347 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); |
1342 | err = -ENOMEM; | 1348 | err = -ENOMEM; |
1349 | disconnect = 1; | ||
1343 | goto out; | 1350 | goto out; |
1344 | } | 1351 | } |
1345 | 1352 | ||
@@ -1355,9 +1362,11 @@ static void process_mpa_reply(struct c4iw_ep *ep, struct sk_buff *skb) | |||
1355 | attrs.layer_etype = LAYER_MPA | DDP_LLP; | 1362 | attrs.layer_etype = LAYER_MPA | DDP_LLP; |
1356 | attrs.ecode = MPA_INSUFF_IRD; | 1363 | attrs.ecode = MPA_INSUFF_IRD; |
1357 | attrs.next_state = C4IW_QP_STATE_TERMINATE; | 1364 | attrs.next_state = C4IW_QP_STATE_TERMINATE; |
1365 | attrs.send_term = 1; | ||
1358 | err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, | 1366 | err = c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, |
1359 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 0); | 1367 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); |
1360 | err = -ENOMEM; | 1368 | err = -ENOMEM; |
1369 | disconnect = 1; | ||
1361 | goto out; | 1370 | goto out; |
1362 | } | 1371 | } |
1363 | goto out; | 1372 | goto out; |
@@ -1366,7 +1375,7 @@ err: | |||
1366 | send_abort(ep, skb, GFP_KERNEL); | 1375 | send_abort(ep, skb, GFP_KERNEL); |
1367 | out: | 1376 | out: |
1368 | connect_reply_upcall(ep, err); | 1377 | connect_reply_upcall(ep, err); |
1369 | return; | 1378 | return disconnect; |
1370 | } | 1379 | } |
1371 | 1380 | ||
1372 | static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) | 1381 | static void process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb) |
@@ -1524,6 +1533,7 @@ static int rx_data(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1524 | unsigned int tid = GET_TID(hdr); | 1533 | unsigned int tid = GET_TID(hdr); |
1525 | struct tid_info *t = dev->rdev.lldi.tids; | 1534 | struct tid_info *t = dev->rdev.lldi.tids; |
1526 | __u8 status = hdr->status; | 1535 | __u8 status = hdr->status; |
1536 | int disconnect = 0; | ||
1527 | 1537 | ||
1528 | ep = lookup_tid(t, tid); | 1538 | ep = lookup_tid(t, tid); |
1529 | if (!ep) | 1539 | if (!ep) |
@@ -1539,7 +1549,7 @@ static int rx_data(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1539 | switch (ep->com.state) { | 1549 | switch (ep->com.state) { |
1540 | case MPA_REQ_SENT: | 1550 | case MPA_REQ_SENT: |
1541 | ep->rcv_seq += dlen; | 1551 | ep->rcv_seq += dlen; |
1542 | process_mpa_reply(ep, skb); | 1552 | disconnect = process_mpa_reply(ep, skb); |
1543 | break; | 1553 | break; |
1544 | case MPA_REQ_WAIT: | 1554 | case MPA_REQ_WAIT: |
1545 | ep->rcv_seq += dlen; | 1555 | ep->rcv_seq += dlen; |
@@ -1555,13 +1565,16 @@ static int rx_data(struct c4iw_dev *dev, struct sk_buff *skb) | |||
1555 | ep->com.state, ep->hwtid, status); | 1565 | ep->com.state, ep->hwtid, status); |
1556 | attrs.next_state = C4IW_QP_STATE_TERMINATE; | 1566 | attrs.next_state = C4IW_QP_STATE_TERMINATE; |
1557 | c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, | 1567 | c4iw_modify_qp(ep->com.qp->rhp, ep->com.qp, |
1558 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 0); | 1568 | C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); |
1569 | disconnect = 1; | ||
1559 | break; | 1570 | break; |
1560 | } | 1571 | } |
1561 | default: | 1572 | default: |
1562 | break; | 1573 | break; |
1563 | } | 1574 | } |
1564 | mutex_unlock(&ep->com.mutex); | 1575 | mutex_unlock(&ep->com.mutex); |
1576 | if (disconnect) | ||
1577 | c4iw_ep_disconnect(ep, 0, GFP_KERNEL); | ||
1565 | return 0; | 1578 | return 0; |
1566 | } | 1579 | } |
1567 | 1580 | ||
@@ -2009,6 +2022,10 @@ static void accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, | |||
2009 | if (tcph->ece && tcph->cwr) | 2022 | if (tcph->ece && tcph->cwr) |
2010 | opt2 |= CCTRL_ECN(1); | 2023 | opt2 |= CCTRL_ECN(1); |
2011 | } | 2024 | } |
2025 | if (is_t5(ep->com.dev->rdev.lldi.adapter_type)) { | ||
2026 | opt2 |= T5_OPT_2_VALID; | ||
2027 | opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); | ||
2028 | } | ||
2012 | 2029 | ||
2013 | rpl = cplhdr(skb); | 2030 | rpl = cplhdr(skb); |
2014 | INIT_TP_WR(rpl, ep->hwtid); | 2031 | INIT_TP_WR(rpl, ep->hwtid); |
@@ -3482,9 +3499,9 @@ static void process_timeout(struct c4iw_ep *ep) | |||
3482 | __func__, ep, ep->hwtid, ep->com.state); | 3499 | __func__, ep, ep->hwtid, ep->com.state); |
3483 | abort = 0; | 3500 | abort = 0; |
3484 | } | 3501 | } |
3485 | mutex_unlock(&ep->com.mutex); | ||
3486 | if (abort) | 3502 | if (abort) |
3487 | abort_connection(ep, NULL, GFP_KERNEL); | 3503 | abort_connection(ep, NULL, GFP_KERNEL); |
3504 | mutex_unlock(&ep->com.mutex); | ||
3488 | c4iw_put_ep(&ep->com); | 3505 | c4iw_put_ep(&ep->com); |
3489 | } | 3506 | } |
3490 | 3507 | ||
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index 7b8c5806a09d..7474b490760a 100644 --- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | |||
@@ -435,6 +435,7 @@ struct c4iw_qp_attributes { | |||
435 | u8 ecode; | 435 | u8 ecode; |
436 | u16 sq_db_inc; | 436 | u16 sq_db_inc; |
437 | u16 rq_db_inc; | 437 | u16 rq_db_inc; |
438 | u8 send_term; | ||
438 | }; | 439 | }; |
439 | 440 | ||
440 | struct c4iw_qp { | 441 | struct c4iw_qp { |
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index 7b5114cb486f..086f62f5dc9e 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
@@ -1388,11 +1388,12 @@ int c4iw_modify_qp(struct c4iw_dev *rhp, struct c4iw_qp *qhp, | |||
1388 | qhp->attr.layer_etype = attrs->layer_etype; | 1388 | qhp->attr.layer_etype = attrs->layer_etype; |
1389 | qhp->attr.ecode = attrs->ecode; | 1389 | qhp->attr.ecode = attrs->ecode; |
1390 | ep = qhp->ep; | 1390 | ep = qhp->ep; |
1391 | disconnect = 1; | 1391 | if (!internal) { |
1392 | c4iw_get_ep(&qhp->ep->com); | 1392 | c4iw_get_ep(&qhp->ep->com); |
1393 | if (!internal) | ||
1394 | terminate = 1; | 1393 | terminate = 1; |
1395 | else { | 1394 | disconnect = 1; |
1395 | } else { | ||
1396 | terminate = qhp->attr.send_term; | ||
1396 | ret = rdma_fini(rhp, qhp, ep); | 1397 | ret = rdma_fini(rhp, qhp, ep); |
1397 | if (ret) | 1398 | if (ret) |
1398 | goto err; | 1399 | goto err; |
@@ -1776,11 +1777,15 @@ int c4iw_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
1776 | /* | 1777 | /* |
1777 | * Use SQ_PSN and RQ_PSN to pass in IDX_INC values for | 1778 | * Use SQ_PSN and RQ_PSN to pass in IDX_INC values for |
1778 | * ringing the queue db when we're in DB_FULL mode. | 1779 | * ringing the queue db when we're in DB_FULL mode. |
1780 | * Only allow this on T4 devices. | ||
1779 | */ | 1781 | */ |
1780 | attrs.sq_db_inc = attr->sq_psn; | 1782 | attrs.sq_db_inc = attr->sq_psn; |
1781 | attrs.rq_db_inc = attr->rq_psn; | 1783 | attrs.rq_db_inc = attr->rq_psn; |
1782 | mask |= (attr_mask & IB_QP_SQ_PSN) ? C4IW_QP_ATTR_SQ_DB : 0; | 1784 | mask |= (attr_mask & IB_QP_SQ_PSN) ? C4IW_QP_ATTR_SQ_DB : 0; |
1783 | mask |= (attr_mask & IB_QP_RQ_PSN) ? C4IW_QP_ATTR_RQ_DB : 0; | 1785 | mask |= (attr_mask & IB_QP_RQ_PSN) ? C4IW_QP_ATTR_RQ_DB : 0; |
1786 | if (is_t5(to_c4iw_qp(ibqp)->rhp->rdev.lldi.adapter_type) && | ||
1787 | (mask & (C4IW_QP_ATTR_SQ_DB|C4IW_QP_ATTR_RQ_DB))) | ||
1788 | return -EINVAL; | ||
1784 | 1789 | ||
1785 | return c4iw_modify_qp(rhp, qhp, mask, &attrs, 0); | 1790 | return c4iw_modify_qp(rhp, qhp, mask, &attrs, 0); |
1786 | } | 1791 | } |
diff --git a/drivers/infiniband/hw/cxgb4/t4fw_ri_api.h b/drivers/infiniband/hw/cxgb4/t4fw_ri_api.h index dc193c292671..6121ca08fe58 100644 --- a/drivers/infiniband/hw/cxgb4/t4fw_ri_api.h +++ b/drivers/infiniband/hw/cxgb4/t4fw_ri_api.h | |||
@@ -836,4 +836,18 @@ struct ulptx_idata { | |||
836 | #define V_RX_DACK_CHANGE(x) ((x) << S_RX_DACK_CHANGE) | 836 | #define V_RX_DACK_CHANGE(x) ((x) << S_RX_DACK_CHANGE) |
837 | #define F_RX_DACK_CHANGE V_RX_DACK_CHANGE(1U) | 837 | #define F_RX_DACK_CHANGE V_RX_DACK_CHANGE(1U) |
838 | 838 | ||
839 | enum { /* TCP congestion control algorithms */ | ||
840 | CONG_ALG_RENO, | ||
841 | CONG_ALG_TAHOE, | ||
842 | CONG_ALG_NEWRENO, | ||
843 | CONG_ALG_HIGHSPEED | ||
844 | }; | ||
845 | |||
846 | #define S_CONG_CNTRL 14 | ||
847 | #define M_CONG_CNTRL 0x3 | ||
848 | #define V_CONG_CNTRL(x) ((x) << S_CONG_CNTRL) | ||
849 | #define G_CONG_CNTRL(x) (((x) >> S_CONG_CNTRL) & M_CONG_CNTRL) | ||
850 | |||
851 | #define T5_OPT_2_VALID (1 << 31) | ||
852 | |||
839 | #endif /* _T4FW_RI_API_H_ */ | 853 | #endif /* _T4FW_RI_API_H_ */ |
diff --git a/drivers/input/misc/da9055_onkey.c b/drivers/input/misc/da9055_onkey.c index 4b11ede34950..4765799fef74 100644 --- a/drivers/input/misc/da9055_onkey.c +++ b/drivers/input/misc/da9055_onkey.c | |||
@@ -109,7 +109,6 @@ static int da9055_onkey_probe(struct platform_device *pdev) | |||
109 | 109 | ||
110 | INIT_DELAYED_WORK(&onkey->work, da9055_onkey_work); | 110 | INIT_DELAYED_WORK(&onkey->work, da9055_onkey_work); |
111 | 111 | ||
112 | irq = regmap_irq_get_virq(da9055->irq_data, irq); | ||
113 | err = request_threaded_irq(irq, NULL, da9055_onkey_irq, | 112 | err = request_threaded_irq(irq, NULL, da9055_onkey_irq, |
114 | IRQF_TRIGGER_HIGH | IRQF_ONESHOT, | 113 | IRQF_TRIGGER_HIGH | IRQF_ONESHOT, |
115 | "ONKEY", onkey); | 114 | "ONKEY", onkey); |
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index 08ead2aaede5..20c80f543d5e 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c | |||
@@ -169,6 +169,7 @@ static int soc_button_pnp_probe(struct pnp_dev *pdev, | |||
169 | soc_button_remove(pdev); | 169 | soc_button_remove(pdev); |
170 | return error; | 170 | return error; |
171 | } | 171 | } |
172 | continue; | ||
172 | } | 173 | } |
173 | 174 | ||
174 | priv->children[i] = pd; | 175 | priv->children[i] = pd; |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index ef1cf52f8bb9..088d3541c7d3 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -1353,6 +1353,7 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1353 | case 6: | 1353 | case 6: |
1354 | case 7: | 1354 | case 7: |
1355 | case 8: | 1355 | case 8: |
1356 | case 9: | ||
1356 | etd->hw_version = 4; | 1357 | etd->hw_version = 4; |
1357 | break; | 1358 | break; |
1358 | default: | 1359 | default: |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index d8d49d10f9bb..ef9f4913450d 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -117,6 +117,44 @@ void synaptics_reset(struct psmouse *psmouse) | |||
117 | } | 117 | } |
118 | 118 | ||
119 | #ifdef CONFIG_MOUSE_PS2_SYNAPTICS | 119 | #ifdef CONFIG_MOUSE_PS2_SYNAPTICS |
120 | /* This list has been kindly provided by Synaptics. */ | ||
121 | static const char * const topbuttonpad_pnp_ids[] = { | ||
122 | "LEN0017", | ||
123 | "LEN0018", | ||
124 | "LEN0019", | ||
125 | "LEN0023", | ||
126 | "LEN002A", | ||
127 | "LEN002B", | ||
128 | "LEN002C", | ||
129 | "LEN002D", | ||
130 | "LEN002E", | ||
131 | "LEN0033", /* Helix */ | ||
132 | "LEN0034", /* T431s, T540, X1 Carbon 2nd */ | ||
133 | "LEN0035", /* X240 */ | ||
134 | "LEN0036", /* T440 */ | ||
135 | "LEN0037", | ||
136 | "LEN0038", | ||
137 | "LEN0041", | ||
138 | "LEN0042", /* Yoga */ | ||
139 | "LEN0045", | ||
140 | "LEN0046", | ||
141 | "LEN0047", | ||
142 | "LEN0048", | ||
143 | "LEN0049", | ||
144 | "LEN2000", | ||
145 | "LEN2001", | ||
146 | "LEN2002", | ||
147 | "LEN2003", | ||
148 | "LEN2004", /* L440 */ | ||
149 | "LEN2005", | ||
150 | "LEN2006", | ||
151 | "LEN2007", | ||
152 | "LEN2008", | ||
153 | "LEN2009", | ||
154 | "LEN200A", | ||
155 | "LEN200B", | ||
156 | NULL | ||
157 | }; | ||
120 | 158 | ||
121 | /***************************************************************************** | 159 | /***************************************************************************** |
122 | * Synaptics communications functions | 160 | * Synaptics communications functions |
@@ -1255,8 +1293,10 @@ static void set_abs_position_params(struct input_dev *dev, | |||
1255 | input_abs_set_res(dev, y_code, priv->y_res); | 1293 | input_abs_set_res(dev, y_code, priv->y_res); |
1256 | } | 1294 | } |
1257 | 1295 | ||
1258 | static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | 1296 | static void set_input_params(struct psmouse *psmouse, |
1297 | struct synaptics_data *priv) | ||
1259 | { | 1298 | { |
1299 | struct input_dev *dev = psmouse->dev; | ||
1260 | int i; | 1300 | int i; |
1261 | 1301 | ||
1262 | /* Things that apply to both modes */ | 1302 | /* Things that apply to both modes */ |
@@ -1325,6 +1365,17 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
1325 | 1365 | ||
1326 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | 1366 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { |
1327 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); | 1367 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); |
1368 | /* See if this buttonpad has a top button area */ | ||
1369 | if (!strncmp(psmouse->ps2dev.serio->firmware_id, "PNP:", 4)) { | ||
1370 | for (i = 0; topbuttonpad_pnp_ids[i]; i++) { | ||
1371 | if (strstr(psmouse->ps2dev.serio->firmware_id, | ||
1372 | topbuttonpad_pnp_ids[i])) { | ||
1373 | __set_bit(INPUT_PROP_TOPBUTTONPAD, | ||
1374 | dev->propbit); | ||
1375 | break; | ||
1376 | } | ||
1377 | } | ||
1378 | } | ||
1328 | /* Clickpads report only left button */ | 1379 | /* Clickpads report only left button */ |
1329 | __clear_bit(BTN_RIGHT, dev->keybit); | 1380 | __clear_bit(BTN_RIGHT, dev->keybit); |
1330 | __clear_bit(BTN_MIDDLE, dev->keybit); | 1381 | __clear_bit(BTN_MIDDLE, dev->keybit); |
@@ -1515,6 +1566,14 @@ static const struct dmi_system_id min_max_dmi_table[] __initconst = { | |||
1515 | .driver_data = (int []){1232, 5710, 1156, 4696}, | 1566 | .driver_data = (int []){1232, 5710, 1156, 4696}, |
1516 | }, | 1567 | }, |
1517 | { | 1568 | { |
1569 | /* Lenovo ThinkPad T431s */ | ||
1570 | .matches = { | ||
1571 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
1572 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"), | ||
1573 | }, | ||
1574 | .driver_data = (int []){1024, 5112, 2024, 4832}, | ||
1575 | }, | ||
1576 | { | ||
1518 | /* Lenovo ThinkPad T440s */ | 1577 | /* Lenovo ThinkPad T440s */ |
1519 | .matches = { | 1578 | .matches = { |
1520 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | 1579 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
@@ -1523,6 +1582,14 @@ static const struct dmi_system_id min_max_dmi_table[] __initconst = { | |||
1523 | .driver_data = (int []){1024, 5112, 2024, 4832}, | 1582 | .driver_data = (int []){1024, 5112, 2024, 4832}, |
1524 | }, | 1583 | }, |
1525 | { | 1584 | { |
1585 | /* Lenovo ThinkPad L440 */ | ||
1586 | .matches = { | ||
1587 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
1588 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"), | ||
1589 | }, | ||
1590 | .driver_data = (int []){1024, 5112, 2024, 4832}, | ||
1591 | }, | ||
1592 | { | ||
1526 | /* Lenovo ThinkPad T540p */ | 1593 | /* Lenovo ThinkPad T540p */ |
1527 | .matches = { | 1594 | .matches = { |
1528 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | 1595 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
@@ -1530,6 +1597,32 @@ static const struct dmi_system_id min_max_dmi_table[] __initconst = { | |||
1530 | }, | 1597 | }, |
1531 | .driver_data = (int []){1024, 5056, 2058, 4832}, | 1598 | .driver_data = (int []){1024, 5056, 2058, 4832}, |
1532 | }, | 1599 | }, |
1600 | { | ||
1601 | /* Lenovo ThinkPad L540 */ | ||
1602 | .matches = { | ||
1603 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
1604 | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"), | ||
1605 | }, | ||
1606 | .driver_data = (int []){1024, 5112, 2024, 4832}, | ||
1607 | }, | ||
1608 | { | ||
1609 | /* Lenovo Yoga S1 */ | ||
1610 | .matches = { | ||
1611 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
1612 | DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, | ||
1613 | "ThinkPad S1 Yoga"), | ||
1614 | }, | ||
1615 | .driver_data = (int []){1232, 5710, 1156, 4696}, | ||
1616 | }, | ||
1617 | { | ||
1618 | /* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */ | ||
1619 | .matches = { | ||
1620 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
1621 | DMI_MATCH(DMI_PRODUCT_VERSION, | ||
1622 | "ThinkPad X1 Carbon 2nd"), | ||
1623 | }, | ||
1624 | .driver_data = (int []){1024, 5112, 2024, 4832}, | ||
1625 | }, | ||
1533 | #endif | 1626 | #endif |
1534 | { } | 1627 | { } |
1535 | }; | 1628 | }; |
@@ -1593,7 +1686,7 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode) | |||
1593 | priv->capabilities, priv->ext_cap, priv->ext_cap_0c, | 1686 | priv->capabilities, priv->ext_cap, priv->ext_cap_0c, |
1594 | priv->board_id, priv->firmware_id); | 1687 | priv->board_id, priv->firmware_id); |
1595 | 1688 | ||
1596 | set_input_params(psmouse->dev, priv); | 1689 | set_input_params(psmouse, priv); |
1597 | 1690 | ||
1598 | /* | 1691 | /* |
1599 | * Encode touchpad model so that it can be used to set | 1692 | * Encode touchpad model so that it can be used to set |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 0ec9abbe31fe..381b20d4c561 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -702,6 +702,17 @@ static int i8042_pnp_aux_irq; | |||
702 | static char i8042_pnp_kbd_name[32]; | 702 | static char i8042_pnp_kbd_name[32]; |
703 | static char i8042_pnp_aux_name[32]; | 703 | static char i8042_pnp_aux_name[32]; |
704 | 704 | ||
705 | static void i8042_pnp_id_to_string(struct pnp_id *id, char *dst, int dst_size) | ||
706 | { | ||
707 | strlcpy(dst, "PNP:", dst_size); | ||
708 | |||
709 | while (id) { | ||
710 | strlcat(dst, " ", dst_size); | ||
711 | strlcat(dst, id->id, dst_size); | ||
712 | id = id->next; | ||
713 | } | ||
714 | } | ||
715 | |||
705 | static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did) | 716 | static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *did) |
706 | { | 717 | { |
707 | if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1) | 718 | if (pnp_port_valid(dev, 0) && pnp_port_len(dev, 0) == 1) |
@@ -718,6 +729,8 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id * | |||
718 | strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name)); | 729 | strlcat(i8042_pnp_kbd_name, ":", sizeof(i8042_pnp_kbd_name)); |
719 | strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name)); | 730 | strlcat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name)); |
720 | } | 731 | } |
732 | i8042_pnp_id_to_string(dev->id, i8042_kbd_firmware_id, | ||
733 | sizeof(i8042_kbd_firmware_id)); | ||
721 | 734 | ||
722 | /* Keyboard ports are always supposed to be wakeup-enabled */ | 735 | /* Keyboard ports are always supposed to be wakeup-enabled */ |
723 | device_set_wakeup_enable(&dev->dev, true); | 736 | device_set_wakeup_enable(&dev->dev, true); |
@@ -742,6 +755,8 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id * | |||
742 | strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name)); | 755 | strlcat(i8042_pnp_aux_name, ":", sizeof(i8042_pnp_aux_name)); |
743 | strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name)); | 756 | strlcat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name)); |
744 | } | 757 | } |
758 | i8042_pnp_id_to_string(dev->id, i8042_aux_firmware_id, | ||
759 | sizeof(i8042_aux_firmware_id)); | ||
745 | 760 | ||
746 | i8042_pnp_aux_devices++; | 761 | i8042_pnp_aux_devices++; |
747 | return 0; | 762 | return 0; |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 020053fa5aaa..3807c3e971cc 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -87,6 +87,8 @@ MODULE_PARM_DESC(debug, "Turn i8042 debugging mode on and off"); | |||
87 | #endif | 87 | #endif |
88 | 88 | ||
89 | static bool i8042_bypass_aux_irq_test; | 89 | static bool i8042_bypass_aux_irq_test; |
90 | static char i8042_kbd_firmware_id[128]; | ||
91 | static char i8042_aux_firmware_id[128]; | ||
90 | 92 | ||
91 | #include "i8042.h" | 93 | #include "i8042.h" |
92 | 94 | ||
@@ -1218,6 +1220,8 @@ static int __init i8042_create_kbd_port(void) | |||
1218 | serio->dev.parent = &i8042_platform_device->dev; | 1220 | serio->dev.parent = &i8042_platform_device->dev; |
1219 | strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name)); | 1221 | strlcpy(serio->name, "i8042 KBD port", sizeof(serio->name)); |
1220 | strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); | 1222 | strlcpy(serio->phys, I8042_KBD_PHYS_DESC, sizeof(serio->phys)); |
1223 | strlcpy(serio->firmware_id, i8042_kbd_firmware_id, | ||
1224 | sizeof(serio->firmware_id)); | ||
1221 | 1225 | ||
1222 | port->serio = serio; | 1226 | port->serio = serio; |
1223 | port->irq = I8042_KBD_IRQ; | 1227 | port->irq = I8042_KBD_IRQ; |
@@ -1244,6 +1248,8 @@ static int __init i8042_create_aux_port(int idx) | |||
1244 | if (idx < 0) { | 1248 | if (idx < 0) { |
1245 | strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name)); | 1249 | strlcpy(serio->name, "i8042 AUX port", sizeof(serio->name)); |
1246 | strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); | 1250 | strlcpy(serio->phys, I8042_AUX_PHYS_DESC, sizeof(serio->phys)); |
1251 | strlcpy(serio->firmware_id, i8042_aux_firmware_id, | ||
1252 | sizeof(serio->firmware_id)); | ||
1247 | serio->close = i8042_port_close; | 1253 | serio->close = i8042_port_close; |
1248 | } else { | 1254 | } else { |
1249 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); | 1255 | snprintf(serio->name, sizeof(serio->name), "i8042 AUX%d port", idx); |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 8f4c4ab04bc2..b29134de983b 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -451,6 +451,13 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute * | |||
451 | return retval; | 451 | return retval; |
452 | } | 452 | } |
453 | 453 | ||
454 | static ssize_t firmware_id_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
455 | { | ||
456 | struct serio *serio = to_serio_port(dev); | ||
457 | |||
458 | return sprintf(buf, "%s\n", serio->firmware_id); | ||
459 | } | ||
460 | |||
454 | static DEVICE_ATTR_RO(type); | 461 | static DEVICE_ATTR_RO(type); |
455 | static DEVICE_ATTR_RO(proto); | 462 | static DEVICE_ATTR_RO(proto); |
456 | static DEVICE_ATTR_RO(id); | 463 | static DEVICE_ATTR_RO(id); |
@@ -473,12 +480,14 @@ static DEVICE_ATTR_RO(modalias); | |||
473 | static DEVICE_ATTR_WO(drvctl); | 480 | static DEVICE_ATTR_WO(drvctl); |
474 | static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL); | 481 | static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL); |
475 | static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode); | 482 | static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode); |
483 | static DEVICE_ATTR_RO(firmware_id); | ||
476 | 484 | ||
477 | static struct attribute *serio_device_attrs[] = { | 485 | static struct attribute *serio_device_attrs[] = { |
478 | &dev_attr_modalias.attr, | 486 | &dev_attr_modalias.attr, |
479 | &dev_attr_description.attr, | 487 | &dev_attr_description.attr, |
480 | &dev_attr_drvctl.attr, | 488 | &dev_attr_drvctl.attr, |
481 | &dev_attr_bind_mode.attr, | 489 | &dev_attr_bind_mode.attr, |
490 | &dev_attr_firmware_id.attr, | ||
482 | NULL | 491 | NULL |
483 | }; | 492 | }; |
484 | 493 | ||
@@ -921,9 +930,14 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
921 | SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto); | 930 | SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto); |
922 | SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id); | 931 | SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id); |
923 | SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra); | 932 | SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra); |
933 | |||
924 | SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", | 934 | SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", |
925 | serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); | 935 | serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); |
926 | 936 | ||
937 | if (serio->firmware_id[0]) | ||
938 | SERIO_ADD_UEVENT_VAR("SERIO_FIRMWARE_ID=%s", | ||
939 | serio->firmware_id); | ||
940 | |||
927 | return 0; | 941 | return 0; |
928 | } | 942 | } |
929 | #undef SERIO_ADD_UEVENT_VAR | 943 | #undef SERIO_ADD_UEVENT_VAR |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index b16ebef5b911..611fc3905d00 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -22,23 +22,18 @@ | |||
22 | #define HID_USAGE_PAGE_DIGITIZER 0x0d | 22 | #define HID_USAGE_PAGE_DIGITIZER 0x0d |
23 | #define HID_USAGE_PAGE_DESKTOP 0x01 | 23 | #define HID_USAGE_PAGE_DESKTOP 0x01 |
24 | #define HID_USAGE 0x09 | 24 | #define HID_USAGE 0x09 |
25 | #define HID_USAGE_X 0x30 | 25 | #define HID_USAGE_X ((HID_USAGE_PAGE_DESKTOP << 16) | 0x30) |
26 | #define HID_USAGE_Y 0x31 | 26 | #define HID_USAGE_Y ((HID_USAGE_PAGE_DESKTOP << 16) | 0x31) |
27 | #define HID_USAGE_X_TILT 0x3d | 27 | #define HID_USAGE_PRESSURE ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x30) |
28 | #define HID_USAGE_Y_TILT 0x3e | 28 | #define HID_USAGE_X_TILT ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x3d) |
29 | #define HID_USAGE_FINGER 0x22 | 29 | #define HID_USAGE_Y_TILT ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x3e) |
30 | #define HID_USAGE_STYLUS 0x20 | 30 | #define HID_USAGE_FINGER ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x22) |
31 | #define HID_USAGE_CONTACTMAX 0x55 | 31 | #define HID_USAGE_STYLUS ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x20) |
32 | #define HID_USAGE_CONTACTMAX ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x55) | ||
32 | #define HID_COLLECTION 0xa1 | 33 | #define HID_COLLECTION 0xa1 |
33 | #define HID_COLLECTION_LOGICAL 0x02 | 34 | #define HID_COLLECTION_LOGICAL 0x02 |
34 | #define HID_COLLECTION_END 0xc0 | 35 | #define HID_COLLECTION_END 0xc0 |
35 | 36 | ||
36 | enum { | ||
37 | WCM_UNDEFINED = 0, | ||
38 | WCM_DESKTOP, | ||
39 | WCM_DIGITIZER, | ||
40 | }; | ||
41 | |||
42 | struct hid_descriptor { | 37 | struct hid_descriptor { |
43 | struct usb_descriptor_header header; | 38 | struct usb_descriptor_header header; |
44 | __le16 bcdHID; | 39 | __le16 bcdHID; |
@@ -305,7 +300,7 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
305 | char limit = 0; | 300 | char limit = 0; |
306 | /* result has to be defined as int for some devices */ | 301 | /* result has to be defined as int for some devices */ |
307 | int result = 0, touch_max = 0; | 302 | int result = 0, touch_max = 0; |
308 | int i = 0, usage = WCM_UNDEFINED, finger = 0, pen = 0; | 303 | int i = 0, page = 0, finger = 0, pen = 0; |
309 | unsigned char *report; | 304 | unsigned char *report; |
310 | 305 | ||
311 | report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL); | 306 | report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL); |
@@ -332,134 +327,121 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
332 | 327 | ||
333 | switch (report[i]) { | 328 | switch (report[i]) { |
334 | case HID_USAGE_PAGE: | 329 | case HID_USAGE_PAGE: |
335 | switch (report[i + 1]) { | 330 | page = report[i + 1]; |
336 | case HID_USAGE_PAGE_DIGITIZER: | 331 | i++; |
337 | usage = WCM_DIGITIZER; | ||
338 | i++; | ||
339 | break; | ||
340 | |||
341 | case HID_USAGE_PAGE_DESKTOP: | ||
342 | usage = WCM_DESKTOP; | ||
343 | i++; | ||
344 | break; | ||
345 | } | ||
346 | break; | 332 | break; |
347 | 333 | ||
348 | case HID_USAGE: | 334 | case HID_USAGE: |
349 | switch (report[i + 1]) { | 335 | switch (page << 16 | report[i + 1]) { |
350 | case HID_USAGE_X: | 336 | case HID_USAGE_X: |
351 | if (usage == WCM_DESKTOP) { | 337 | if (finger) { |
352 | if (finger) { | 338 | features->device_type = BTN_TOOL_FINGER; |
353 | features->device_type = BTN_TOOL_FINGER; | 339 | /* touch device at least supports one touch point */ |
354 | /* touch device at least supports one touch point */ | 340 | touch_max = 1; |
355 | touch_max = 1; | 341 | switch (features->type) { |
356 | switch (features->type) { | 342 | case TABLETPC2FG: |
357 | case TABLETPC2FG: | 343 | features->pktlen = WACOM_PKGLEN_TPC2FG; |
358 | features->pktlen = WACOM_PKGLEN_TPC2FG; | 344 | break; |
359 | break; | 345 | |
360 | 346 | case MTSCREEN: | |
361 | case MTSCREEN: | 347 | case WACOM_24HDT: |
362 | case WACOM_24HDT: | 348 | features->pktlen = WACOM_PKGLEN_MTOUCH; |
363 | features->pktlen = WACOM_PKGLEN_MTOUCH; | 349 | break; |
364 | break; | 350 | |
365 | 351 | case MTTPC: | |
366 | case MTTPC: | 352 | features->pktlen = WACOM_PKGLEN_MTTPC; |
367 | features->pktlen = WACOM_PKGLEN_MTTPC; | 353 | break; |
368 | break; | 354 | |
369 | 355 | case BAMBOO_PT: | |
370 | case BAMBOO_PT: | 356 | features->pktlen = WACOM_PKGLEN_BBTOUCH; |
371 | features->pktlen = WACOM_PKGLEN_BBTOUCH; | 357 | break; |
372 | break; | 358 | |
373 | 359 | default: | |
374 | default: | 360 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; |
375 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | 361 | break; |
376 | break; | 362 | } |
377 | } | 363 | |
378 | 364 | switch (features->type) { | |
379 | switch (features->type) { | 365 | case BAMBOO_PT: |
380 | case BAMBOO_PT: | 366 | features->x_phy = |
381 | features->x_phy = | 367 | get_unaligned_le16(&report[i + 5]); |
382 | get_unaligned_le16(&report[i + 5]); | 368 | features->x_max = |
383 | features->x_max = | 369 | get_unaligned_le16(&report[i + 8]); |
384 | get_unaligned_le16(&report[i + 8]); | 370 | i += 15; |
385 | i += 15; | 371 | break; |
386 | break; | 372 | |
387 | 373 | case WACOM_24HDT: | |
388 | case WACOM_24HDT: | ||
389 | features->x_max = | ||
390 | get_unaligned_le16(&report[i + 3]); | ||
391 | features->x_phy = | ||
392 | get_unaligned_le16(&report[i + 8]); | ||
393 | features->unit = report[i - 1]; | ||
394 | features->unitExpo = report[i - 3]; | ||
395 | i += 12; | ||
396 | break; | ||
397 | |||
398 | default: | ||
399 | features->x_max = | ||
400 | get_unaligned_le16(&report[i + 3]); | ||
401 | features->x_phy = | ||
402 | get_unaligned_le16(&report[i + 6]); | ||
403 | features->unit = report[i + 9]; | ||
404 | features->unitExpo = report[i + 11]; | ||
405 | i += 12; | ||
406 | break; | ||
407 | } | ||
408 | } else if (pen) { | ||
409 | /* penabled only accepts exact bytes of data */ | ||
410 | if (features->type >= TABLETPC) | ||
411 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | ||
412 | features->device_type = BTN_TOOL_PEN; | ||
413 | features->x_max = | 374 | features->x_max = |
414 | get_unaligned_le16(&report[i + 3]); | 375 | get_unaligned_le16(&report[i + 3]); |
415 | i += 4; | 376 | features->x_phy = |
377 | get_unaligned_le16(&report[i + 8]); | ||
378 | features->unit = report[i - 1]; | ||
379 | features->unitExpo = report[i - 3]; | ||
380 | i += 12; | ||
381 | break; | ||
382 | |||
383 | default: | ||
384 | features->x_max = | ||
385 | get_unaligned_le16(&report[i + 3]); | ||
386 | features->x_phy = | ||
387 | get_unaligned_le16(&report[i + 6]); | ||
388 | features->unit = report[i + 9]; | ||
389 | features->unitExpo = report[i + 11]; | ||
390 | i += 12; | ||
391 | break; | ||
416 | } | 392 | } |
393 | } else if (pen) { | ||
394 | /* penabled only accepts exact bytes of data */ | ||
395 | if (features->type >= TABLETPC) | ||
396 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | ||
397 | features->device_type = BTN_TOOL_PEN; | ||
398 | features->x_max = | ||
399 | get_unaligned_le16(&report[i + 3]); | ||
400 | i += 4; | ||
417 | } | 401 | } |
418 | break; | 402 | break; |
419 | 403 | ||
420 | case HID_USAGE_Y: | 404 | case HID_USAGE_Y: |
421 | if (usage == WCM_DESKTOP) { | 405 | if (finger) { |
422 | if (finger) { | 406 | switch (features->type) { |
423 | switch (features->type) { | 407 | case TABLETPC2FG: |
424 | case TABLETPC2FG: | 408 | case MTSCREEN: |
425 | case MTSCREEN: | 409 | case MTTPC: |
426 | case MTTPC: | 410 | features->y_max = |
427 | features->y_max = | 411 | get_unaligned_le16(&report[i + 3]); |
428 | get_unaligned_le16(&report[i + 3]); | 412 | features->y_phy = |
429 | features->y_phy = | 413 | get_unaligned_le16(&report[i + 6]); |
430 | get_unaligned_le16(&report[i + 6]); | 414 | i += 7; |
431 | i += 7; | 415 | break; |
432 | break; | 416 | |
433 | 417 | case WACOM_24HDT: | |
434 | case WACOM_24HDT: | 418 | features->y_max = |
435 | features->y_max = | 419 | get_unaligned_le16(&report[i + 3]); |
436 | get_unaligned_le16(&report[i + 3]); | 420 | features->y_phy = |
437 | features->y_phy = | 421 | get_unaligned_le16(&report[i - 2]); |
438 | get_unaligned_le16(&report[i - 2]); | 422 | i += 7; |
439 | i += 7; | 423 | break; |
440 | break; | 424 | |
441 | 425 | case BAMBOO_PT: | |
442 | case BAMBOO_PT: | 426 | features->y_phy = |
443 | features->y_phy = | 427 | get_unaligned_le16(&report[i + 3]); |
444 | get_unaligned_le16(&report[i + 3]); | 428 | features->y_max = |
445 | features->y_max = | 429 | get_unaligned_le16(&report[i + 6]); |
446 | get_unaligned_le16(&report[i + 6]); | 430 | i += 12; |
447 | i += 12; | 431 | break; |
448 | break; | 432 | |
449 | 433 | default: | |
450 | default: | ||
451 | features->y_max = | ||
452 | features->x_max; | ||
453 | features->y_phy = | ||
454 | get_unaligned_le16(&report[i + 3]); | ||
455 | i += 4; | ||
456 | break; | ||
457 | } | ||
458 | } else if (pen) { | ||
459 | features->y_max = | 434 | features->y_max = |
435 | features->x_max; | ||
436 | features->y_phy = | ||
460 | get_unaligned_le16(&report[i + 3]); | 437 | get_unaligned_le16(&report[i + 3]); |
461 | i += 4; | 438 | i += 4; |
439 | break; | ||
462 | } | 440 | } |
441 | } else if (pen) { | ||
442 | features->y_max = | ||
443 | get_unaligned_le16(&report[i + 3]); | ||
444 | i += 4; | ||
463 | } | 445 | } |
464 | break; | 446 | break; |
465 | 447 | ||
@@ -484,12 +466,20 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
484 | wacom_retrieve_report_data(intf, features); | 466 | wacom_retrieve_report_data(intf, features); |
485 | i++; | 467 | i++; |
486 | break; | 468 | break; |
469 | |||
470 | case HID_USAGE_PRESSURE: | ||
471 | if (pen) { | ||
472 | features->pressure_max = | ||
473 | get_unaligned_le16(&report[i + 3]); | ||
474 | i += 4; | ||
475 | } | ||
476 | break; | ||
487 | } | 477 | } |
488 | break; | 478 | break; |
489 | 479 | ||
490 | case HID_COLLECTION_END: | 480 | case HID_COLLECTION_END: |
491 | /* reset UsagePage and Finger */ | 481 | /* reset UsagePage and Finger */ |
492 | finger = usage = 0; | 482 | finger = page = 0; |
493 | break; | 483 | break; |
494 | 484 | ||
495 | case HID_COLLECTION: | 485 | case HID_COLLECTION: |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 05f371df6c40..4822c57a3756 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -178,10 +178,9 @@ static int wacom_ptu_irq(struct wacom_wac *wacom) | |||
178 | 178 | ||
179 | static int wacom_dtu_irq(struct wacom_wac *wacom) | 179 | static int wacom_dtu_irq(struct wacom_wac *wacom) |
180 | { | 180 | { |
181 | struct wacom_features *features = &wacom->features; | 181 | unsigned char *data = wacom->data; |
182 | char *data = wacom->data; | ||
183 | struct input_dev *input = wacom->input; | 182 | struct input_dev *input = wacom->input; |
184 | int prox = data[1] & 0x20, pressure; | 183 | int prox = data[1] & 0x20; |
185 | 184 | ||
186 | dev_dbg(input->dev.parent, | 185 | dev_dbg(input->dev.parent, |
187 | "%s: received report #%d", __func__, data[0]); | 186 | "%s: received report #%d", __func__, data[0]); |
@@ -198,10 +197,7 @@ static int wacom_dtu_irq(struct wacom_wac *wacom) | |||
198 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); | 197 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
199 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); | 198 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
200 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | 199 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
201 | pressure = ((data[7] & 0x01) << 8) | data[6]; | 200 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x01) << 8) | data[6]); |
202 | if (pressure < 0) | ||
203 | pressure = features->pressure_max + pressure + 1; | ||
204 | input_report_abs(input, ABS_PRESSURE, pressure); | ||
205 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); | 201 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); |
206 | if (!prox) /* out-prox */ | 202 | if (!prox) /* out-prox */ |
207 | wacom->id[0] = 0; | 203 | wacom->id[0] = 0; |
@@ -906,7 +902,7 @@ static int int_dist(int x1, int y1, int x2, int y2) | |||
906 | static int wacom_24hdt_irq(struct wacom_wac *wacom) | 902 | static int wacom_24hdt_irq(struct wacom_wac *wacom) |
907 | { | 903 | { |
908 | struct input_dev *input = wacom->input; | 904 | struct input_dev *input = wacom->input; |
909 | char *data = wacom->data; | 905 | unsigned char *data = wacom->data; |
910 | int i; | 906 | int i; |
911 | int current_num_contacts = data[61]; | 907 | int current_num_contacts = data[61]; |
912 | int contacts_to_send = 0; | 908 | int contacts_to_send = 0; |
@@ -959,7 +955,7 @@ static int wacom_24hdt_irq(struct wacom_wac *wacom) | |||
959 | static int wacom_mt_touch(struct wacom_wac *wacom) | 955 | static int wacom_mt_touch(struct wacom_wac *wacom) |
960 | { | 956 | { |
961 | struct input_dev *input = wacom->input; | 957 | struct input_dev *input = wacom->input; |
962 | char *data = wacom->data; | 958 | unsigned char *data = wacom->data; |
963 | int i; | 959 | int i; |
964 | int current_num_contacts = data[2]; | 960 | int current_num_contacts = data[2]; |
965 | int contacts_to_send = 0; | 961 | int contacts_to_send = 0; |
@@ -1038,7 +1034,7 @@ static int wacom_tpc_mt_touch(struct wacom_wac *wacom) | |||
1038 | 1034 | ||
1039 | static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) | 1035 | static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) |
1040 | { | 1036 | { |
1041 | char *data = wacom->data; | 1037 | unsigned char *data = wacom->data; |
1042 | struct input_dev *input = wacom->input; | 1038 | struct input_dev *input = wacom->input; |
1043 | bool prox; | 1039 | bool prox; |
1044 | int x = 0, y = 0; | 1040 | int x = 0, y = 0; |
@@ -1074,10 +1070,8 @@ static int wacom_tpc_single_touch(struct wacom_wac *wacom, size_t len) | |||
1074 | 1070 | ||
1075 | static int wacom_tpc_pen(struct wacom_wac *wacom) | 1071 | static int wacom_tpc_pen(struct wacom_wac *wacom) |
1076 | { | 1072 | { |
1077 | struct wacom_features *features = &wacom->features; | 1073 | unsigned char *data = wacom->data; |
1078 | char *data = wacom->data; | ||
1079 | struct input_dev *input = wacom->input; | 1074 | struct input_dev *input = wacom->input; |
1080 | int pressure; | ||
1081 | bool prox = data[1] & 0x20; | 1075 | bool prox = data[1] & 0x20; |
1082 | 1076 | ||
1083 | if (!wacom->shared->stylus_in_proximity) /* first in prox */ | 1077 | if (!wacom->shared->stylus_in_proximity) /* first in prox */ |
@@ -1093,10 +1087,7 @@ static int wacom_tpc_pen(struct wacom_wac *wacom) | |||
1093 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); | 1087 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
1094 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); | 1088 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
1095 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | 1089 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
1096 | pressure = ((data[7] & 0x01) << 8) | data[6]; | 1090 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x03) << 8) | data[6]); |
1097 | if (pressure < 0) | ||
1098 | pressure = features->pressure_max + pressure + 1; | ||
1099 | input_report_abs(input, ABS_PRESSURE, pressure); | ||
1100 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); | 1091 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); |
1101 | input_report_key(input, wacom->tool[0], prox); | 1092 | input_report_key(input, wacom->tool[0], prox); |
1102 | return 1; | 1093 | return 1; |
@@ -1107,7 +1098,7 @@ static int wacom_tpc_pen(struct wacom_wac *wacom) | |||
1107 | 1098 | ||
1108 | static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) | 1099 | static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len) |
1109 | { | 1100 | { |
1110 | char *data = wacom->data; | 1101 | unsigned char *data = wacom->data; |
1111 | 1102 | ||
1112 | dev_dbg(wacom->input->dev.parent, | 1103 | dev_dbg(wacom->input->dev.parent, |
1113 | "%s: received report #%d\n", __func__, data[0]); | 1104 | "%s: received report #%d\n", __func__, data[0]); |
@@ -1838,7 +1829,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1838 | case DTU: | 1829 | case DTU: |
1839 | if (features->type == DTUS) { | 1830 | if (features->type == DTUS) { |
1840 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); | 1831 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); |
1841 | for (i = 0; i < 3; i++) | 1832 | for (i = 0; i < 4; i++) |
1842 | __set_bit(BTN_0 + i, input_dev->keybit); | 1833 | __set_bit(BTN_0 + i, input_dev->keybit); |
1843 | } | 1834 | } |
1844 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | 1835 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 45a06e495ed2..7f8aa981500d 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -425,7 +425,7 @@ static int ads7845_read12_ser(struct device *dev, unsigned command) | |||
425 | name ## _show(struct device *dev, struct device_attribute *attr, char *buf) \ | 425 | name ## _show(struct device *dev, struct device_attribute *attr, char *buf) \ |
426 | { \ | 426 | { \ |
427 | struct ads7846 *ts = dev_get_drvdata(dev); \ | 427 | struct ads7846 *ts = dev_get_drvdata(dev); \ |
428 | ssize_t v = ads7846_read12_ser(dev, \ | 428 | ssize_t v = ads7846_read12_ser(&ts->spi->dev, \ |
429 | READ_12BIT_SER(var)); \ | 429 | READ_12BIT_SER(var)); \ |
430 | if (v < 0) \ | 430 | if (v < 0) \ |
431 | return v; \ | 431 | return v; \ |
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index 41be897df8d5..3899ba7821c5 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #define ARMADA_370_XP_INT_SET_ENABLE_OFFS (0x30) | 41 | #define ARMADA_370_XP_INT_SET_ENABLE_OFFS (0x30) |
42 | #define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34) | 42 | #define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34) |
43 | #define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4) | 43 | #define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4) |
44 | #define ARMADA_370_XP_INT_SOURCE_CPU_MASK 0xF | ||
44 | 45 | ||
45 | #define ARMADA_370_XP_CPU_INTACK_OFFS (0x44) | 46 | #define ARMADA_370_XP_CPU_INTACK_OFFS (0x44) |
46 | #define ARMADA_375_PPI_CAUSE (0x10) | 47 | #define ARMADA_375_PPI_CAUSE (0x10) |
@@ -132,8 +133,7 @@ static int armada_370_xp_setup_msi_irq(struct msi_chip *chip, | |||
132 | struct msi_desc *desc) | 133 | struct msi_desc *desc) |
133 | { | 134 | { |
134 | struct msi_msg msg; | 135 | struct msi_msg msg; |
135 | irq_hw_number_t hwirq; | 136 | int virq, hwirq; |
136 | int virq; | ||
137 | 137 | ||
138 | hwirq = armada_370_xp_alloc_msi(); | 138 | hwirq = armada_370_xp_alloc_msi(); |
139 | if (hwirq < 0) | 139 | if (hwirq < 0) |
@@ -159,8 +159,19 @@ static void armada_370_xp_teardown_msi_irq(struct msi_chip *chip, | |||
159 | unsigned int irq) | 159 | unsigned int irq) |
160 | { | 160 | { |
161 | struct irq_data *d = irq_get_irq_data(irq); | 161 | struct irq_data *d = irq_get_irq_data(irq); |
162 | unsigned long hwirq = d->hwirq; | ||
163 | |||
162 | irq_dispose_mapping(irq); | 164 | irq_dispose_mapping(irq); |
163 | armada_370_xp_free_msi(d->hwirq); | 165 | armada_370_xp_free_msi(hwirq); |
166 | } | ||
167 | |||
168 | static int armada_370_xp_check_msi_device(struct msi_chip *chip, struct pci_dev *dev, | ||
169 | int nvec, int type) | ||
170 | { | ||
171 | /* We support MSI, but not MSI-X */ | ||
172 | if (type == PCI_CAP_ID_MSI) | ||
173 | return 0; | ||
174 | return -EINVAL; | ||
164 | } | 175 | } |
165 | 176 | ||
166 | static struct irq_chip armada_370_xp_msi_irq_chip = { | 177 | static struct irq_chip armada_370_xp_msi_irq_chip = { |
@@ -201,6 +212,7 @@ static int armada_370_xp_msi_init(struct device_node *node, | |||
201 | 212 | ||
202 | msi_chip->setup_irq = armada_370_xp_setup_msi_irq; | 213 | msi_chip->setup_irq = armada_370_xp_setup_msi_irq; |
203 | msi_chip->teardown_irq = armada_370_xp_teardown_msi_irq; | 214 | msi_chip->teardown_irq = armada_370_xp_teardown_msi_irq; |
215 | msi_chip->check_device = armada_370_xp_check_msi_device; | ||
204 | msi_chip->of_node = node; | 216 | msi_chip->of_node = node; |
205 | 217 | ||
206 | armada_370_xp_msi_domain = | 218 | armada_370_xp_msi_domain = |
@@ -244,35 +256,18 @@ static DEFINE_RAW_SPINLOCK(irq_controller_lock); | |||
244 | static int armada_xp_set_affinity(struct irq_data *d, | 256 | static int armada_xp_set_affinity(struct irq_data *d, |
245 | const struct cpumask *mask_val, bool force) | 257 | const struct cpumask *mask_val, bool force) |
246 | { | 258 | { |
247 | unsigned long reg; | ||
248 | unsigned long new_mask = 0; | ||
249 | unsigned long online_mask = 0; | ||
250 | unsigned long count = 0; | ||
251 | irq_hw_number_t hwirq = irqd_to_hwirq(d); | 259 | irq_hw_number_t hwirq = irqd_to_hwirq(d); |
260 | unsigned long reg, mask; | ||
252 | int cpu; | 261 | int cpu; |
253 | 262 | ||
254 | for_each_cpu(cpu, mask_val) { | 263 | /* Select a single core from the affinity mask which is online */ |
255 | new_mask |= 1 << cpu_logical_map(cpu); | 264 | cpu = cpumask_any_and(mask_val, cpu_online_mask); |
256 | count++; | 265 | mask = 1UL << cpu_logical_map(cpu); |
257 | } | ||
258 | |||
259 | /* | ||
260 | * Forbid mutlicore interrupt affinity | ||
261 | * This is required since the MPIC HW doesn't limit | ||
262 | * several CPUs from acknowledging the same interrupt. | ||
263 | */ | ||
264 | if (count > 1) | ||
265 | return -EINVAL; | ||
266 | |||
267 | for_each_cpu(cpu, cpu_online_mask) | ||
268 | online_mask |= 1 << cpu_logical_map(cpu); | ||
269 | 266 | ||
270 | raw_spin_lock(&irq_controller_lock); | 267 | raw_spin_lock(&irq_controller_lock); |
271 | |||
272 | reg = readl(main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq)); | 268 | reg = readl(main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq)); |
273 | reg = (reg & (~online_mask)) | new_mask; | 269 | reg = (reg & (~ARMADA_370_XP_INT_SOURCE_CPU_MASK)) | mask; |
274 | writel(reg, main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq)); | 270 | writel(reg, main_int_base + ARMADA_370_XP_INT_SOURCE_CTL(hwirq)); |
275 | |||
276 | raw_spin_unlock(&irq_controller_lock); | 271 | raw_spin_unlock(&irq_controller_lock); |
277 | 272 | ||
278 | return 0; | 273 | return 0; |
@@ -494,15 +489,6 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, | |||
494 | 489 | ||
495 | #ifdef CONFIG_SMP | 490 | #ifdef CONFIG_SMP |
496 | armada_xp_mpic_smp_cpu_init(); | 491 | armada_xp_mpic_smp_cpu_init(); |
497 | |||
498 | /* | ||
499 | * Set the default affinity from all CPUs to the boot cpu. | ||
500 | * This is required since the MPIC doesn't limit several CPUs | ||
501 | * from acknowledging the same interrupt. | ||
502 | */ | ||
503 | cpumask_clear(irq_default_affinity); | ||
504 | cpumask_set_cpu(smp_processor_id(), irq_default_affinity); | ||
505 | |||
506 | #endif | 492 | #endif |
507 | 493 | ||
508 | armada_370_xp_msi_init(node, main_int_res.start); | 494 | armada_370_xp_msi_init(node, main_int_res.start); |
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index fc817d28d1fe..3d15d16a7088 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c | |||
@@ -107,7 +107,7 @@ static int __init crossbar_of_init(struct device_node *node) | |||
107 | int i, size, max, reserved = 0, entry; | 107 | int i, size, max, reserved = 0, entry; |
108 | const __be32 *irqsr; | 108 | const __be32 *irqsr; |
109 | 109 | ||
110 | cb = kzalloc(sizeof(struct cb_device *), GFP_KERNEL); | 110 | cb = kzalloc(sizeof(*cb), GFP_KERNEL); |
111 | 111 | ||
112 | if (!cb) | 112 | if (!cb) |
113 | return -ENOMEM; | 113 | return -ENOMEM; |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 4300b6606f5e..57d165e026f4 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -246,10 +246,14 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, | |||
246 | bool force) | 246 | bool force) |
247 | { | 247 | { |
248 | void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3); | 248 | void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3); |
249 | unsigned int shift = (gic_irq(d) % 4) * 8; | 249 | unsigned int cpu, shift = (gic_irq(d) % 4) * 8; |
250 | unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask); | ||
251 | u32 val, mask, bit; | 250 | u32 val, mask, bit; |
252 | 251 | ||
252 | if (!force) | ||
253 | cpu = cpumask_any_and(mask_val, cpu_online_mask); | ||
254 | else | ||
255 | cpu = cpumask_first(mask_val); | ||
256 | |||
253 | if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids) | 257 | if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids) |
254 | return -EINVAL; | 258 | return -EINVAL; |
255 | 259 | ||
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 1bf4a71919ec..9380be7b1895 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c | |||
@@ -2488,6 +2488,7 @@ static int cache_map(struct dm_target *ti, struct bio *bio) | |||
2488 | 2488 | ||
2489 | } else { | 2489 | } else { |
2490 | inc_hit_counter(cache, bio); | 2490 | inc_hit_counter(cache, bio); |
2491 | pb->all_io_entry = dm_deferred_entry_inc(cache->all_io_ds); | ||
2491 | 2492 | ||
2492 | if (bio_data_dir(bio) == WRITE && writethrough_mode(&cache->features) && | 2493 | if (bio_data_dir(bio) == WRITE && writethrough_mode(&cache->features) && |
2493 | !is_dirty(cache, lookup_result.cblock)) | 2494 | !is_dirty(cache, lookup_result.cblock)) |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 53728be84dee..13abade76ad9 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -232,6 +232,13 @@ struct thin_c { | |||
232 | struct bio_list deferred_bio_list; | 232 | struct bio_list deferred_bio_list; |
233 | struct bio_list retry_on_resume_list; | 233 | struct bio_list retry_on_resume_list; |
234 | struct rb_root sort_bio_list; /* sorted list of deferred bios */ | 234 | struct rb_root sort_bio_list; /* sorted list of deferred bios */ |
235 | |||
236 | /* | ||
237 | * Ensures the thin is not destroyed until the worker has finished | ||
238 | * iterating the active_thins list. | ||
239 | */ | ||
240 | atomic_t refcount; | ||
241 | struct completion can_destroy; | ||
235 | }; | 242 | }; |
236 | 243 | ||
237 | /*----------------------------------------------------------------*/ | 244 | /*----------------------------------------------------------------*/ |
@@ -1486,6 +1493,45 @@ static void process_thin_deferred_bios(struct thin_c *tc) | |||
1486 | blk_finish_plug(&plug); | 1493 | blk_finish_plug(&plug); |
1487 | } | 1494 | } |
1488 | 1495 | ||
1496 | static void thin_get(struct thin_c *tc); | ||
1497 | static void thin_put(struct thin_c *tc); | ||
1498 | |||
1499 | /* | ||
1500 | * We can't hold rcu_read_lock() around code that can block. So we | ||
1501 | * find a thin with the rcu lock held; bump a refcount; then drop | ||
1502 | * the lock. | ||
1503 | */ | ||
1504 | static struct thin_c *get_first_thin(struct pool *pool) | ||
1505 | { | ||
1506 | struct thin_c *tc = NULL; | ||
1507 | |||
1508 | rcu_read_lock(); | ||
1509 | if (!list_empty(&pool->active_thins)) { | ||
1510 | tc = list_entry_rcu(pool->active_thins.next, struct thin_c, list); | ||
1511 | thin_get(tc); | ||
1512 | } | ||
1513 | rcu_read_unlock(); | ||
1514 | |||
1515 | return tc; | ||
1516 | } | ||
1517 | |||
1518 | static struct thin_c *get_next_thin(struct pool *pool, struct thin_c *tc) | ||
1519 | { | ||
1520 | struct thin_c *old_tc = tc; | ||
1521 | |||
1522 | rcu_read_lock(); | ||
1523 | list_for_each_entry_continue_rcu(tc, &pool->active_thins, list) { | ||
1524 | thin_get(tc); | ||
1525 | thin_put(old_tc); | ||
1526 | rcu_read_unlock(); | ||
1527 | return tc; | ||
1528 | } | ||
1529 | thin_put(old_tc); | ||
1530 | rcu_read_unlock(); | ||
1531 | |||
1532 | return NULL; | ||
1533 | } | ||
1534 | |||
1489 | static void process_deferred_bios(struct pool *pool) | 1535 | static void process_deferred_bios(struct pool *pool) |
1490 | { | 1536 | { |
1491 | unsigned long flags; | 1537 | unsigned long flags; |
@@ -1493,10 +1539,11 @@ static void process_deferred_bios(struct pool *pool) | |||
1493 | struct bio_list bios; | 1539 | struct bio_list bios; |
1494 | struct thin_c *tc; | 1540 | struct thin_c *tc; |
1495 | 1541 | ||
1496 | rcu_read_lock(); | 1542 | tc = get_first_thin(pool); |
1497 | list_for_each_entry_rcu(tc, &pool->active_thins, list) | 1543 | while (tc) { |
1498 | process_thin_deferred_bios(tc); | 1544 | process_thin_deferred_bios(tc); |
1499 | rcu_read_unlock(); | 1545 | tc = get_next_thin(pool, tc); |
1546 | } | ||
1500 | 1547 | ||
1501 | /* | 1548 | /* |
1502 | * If there are any deferred flush bios, we must commit | 1549 | * If there are any deferred flush bios, we must commit |
@@ -1578,7 +1625,7 @@ static void noflush_work(struct thin_c *tc, void (*fn)(struct work_struct *)) | |||
1578 | { | 1625 | { |
1579 | struct noflush_work w; | 1626 | struct noflush_work w; |
1580 | 1627 | ||
1581 | INIT_WORK(&w.worker, fn); | 1628 | INIT_WORK_ONSTACK(&w.worker, fn); |
1582 | w.tc = tc; | 1629 | w.tc = tc; |
1583 | atomic_set(&w.complete, 0); | 1630 | atomic_set(&w.complete, 0); |
1584 | init_waitqueue_head(&w.wait); | 1631 | init_waitqueue_head(&w.wait); |
@@ -3061,11 +3108,25 @@ static struct target_type pool_target = { | |||
3061 | /*---------------------------------------------------------------- | 3108 | /*---------------------------------------------------------------- |
3062 | * Thin target methods | 3109 | * Thin target methods |
3063 | *--------------------------------------------------------------*/ | 3110 | *--------------------------------------------------------------*/ |
3111 | static void thin_get(struct thin_c *tc) | ||
3112 | { | ||
3113 | atomic_inc(&tc->refcount); | ||
3114 | } | ||
3115 | |||
3116 | static void thin_put(struct thin_c *tc) | ||
3117 | { | ||
3118 | if (atomic_dec_and_test(&tc->refcount)) | ||
3119 | complete(&tc->can_destroy); | ||
3120 | } | ||
3121 | |||
3064 | static void thin_dtr(struct dm_target *ti) | 3122 | static void thin_dtr(struct dm_target *ti) |
3065 | { | 3123 | { |
3066 | struct thin_c *tc = ti->private; | 3124 | struct thin_c *tc = ti->private; |
3067 | unsigned long flags; | 3125 | unsigned long flags; |
3068 | 3126 | ||
3127 | thin_put(tc); | ||
3128 | wait_for_completion(&tc->can_destroy); | ||
3129 | |||
3069 | spin_lock_irqsave(&tc->pool->lock, flags); | 3130 | spin_lock_irqsave(&tc->pool->lock, flags); |
3070 | list_del_rcu(&tc->list); | 3131 | list_del_rcu(&tc->list); |
3071 | spin_unlock_irqrestore(&tc->pool->lock, flags); | 3132 | spin_unlock_irqrestore(&tc->pool->lock, flags); |
@@ -3101,6 +3162,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
3101 | struct thin_c *tc; | 3162 | struct thin_c *tc; |
3102 | struct dm_dev *pool_dev, *origin_dev; | 3163 | struct dm_dev *pool_dev, *origin_dev; |
3103 | struct mapped_device *pool_md; | 3164 | struct mapped_device *pool_md; |
3165 | unsigned long flags; | ||
3104 | 3166 | ||
3105 | mutex_lock(&dm_thin_pool_table.mutex); | 3167 | mutex_lock(&dm_thin_pool_table.mutex); |
3106 | 3168 | ||
@@ -3191,9 +3253,12 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
3191 | 3253 | ||
3192 | mutex_unlock(&dm_thin_pool_table.mutex); | 3254 | mutex_unlock(&dm_thin_pool_table.mutex); |
3193 | 3255 | ||
3194 | spin_lock(&tc->pool->lock); | 3256 | atomic_set(&tc->refcount, 1); |
3257 | init_completion(&tc->can_destroy); | ||
3258 | |||
3259 | spin_lock_irqsave(&tc->pool->lock, flags); | ||
3195 | list_add_tail_rcu(&tc->list, &tc->pool->active_thins); | 3260 | list_add_tail_rcu(&tc->list, &tc->pool->active_thins); |
3196 | spin_unlock(&tc->pool->lock); | 3261 | spin_unlock_irqrestore(&tc->pool->lock, flags); |
3197 | /* | 3262 | /* |
3198 | * This synchronize_rcu() call is needed here otherwise we risk a | 3263 | * This synchronize_rcu() call is needed here otherwise we risk a |
3199 | * wake_worker() call finding no bios to process (because the newly | 3264 | * wake_worker() call finding no bios to process (because the newly |
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c index 796007a5e0e1..7a7bab8947ae 100644 --- a/drivers/md/dm-verity.c +++ b/drivers/md/dm-verity.c | |||
@@ -330,15 +330,17 @@ test_block_hash: | |||
330 | return r; | 330 | return r; |
331 | } | 331 | } |
332 | } | 332 | } |
333 | |||
334 | todo = 1 << v->data_dev_block_bits; | 333 | todo = 1 << v->data_dev_block_bits; |
335 | while (io->iter.bi_size) { | 334 | do { |
336 | u8 *page; | 335 | u8 *page; |
336 | unsigned len; | ||
337 | struct bio_vec bv = bio_iter_iovec(bio, io->iter); | 337 | struct bio_vec bv = bio_iter_iovec(bio, io->iter); |
338 | 338 | ||
339 | page = kmap_atomic(bv.bv_page); | 339 | page = kmap_atomic(bv.bv_page); |
340 | r = crypto_shash_update(desc, page + bv.bv_offset, | 340 | len = bv.bv_len; |
341 | bv.bv_len); | 341 | if (likely(len >= todo)) |
342 | len = todo; | ||
343 | r = crypto_shash_update(desc, page + bv.bv_offset, len); | ||
342 | kunmap_atomic(page); | 344 | kunmap_atomic(page); |
343 | 345 | ||
344 | if (r < 0) { | 346 | if (r < 0) { |
@@ -346,8 +348,9 @@ test_block_hash: | |||
346 | return r; | 348 | return r; |
347 | } | 349 | } |
348 | 350 | ||
349 | bio_advance_iter(bio, &io->iter, bv.bv_len); | 351 | bio_advance_iter(bio, &io->iter, len); |
350 | } | 352 | todo -= len; |
353 | } while (todo); | ||
351 | 354 | ||
352 | if (!v->version) { | 355 | if (!v->version) { |
353 | r = crypto_shash_update(desc, v->salt, v->salt_size); | 356 | r = crypto_shash_update(desc, v->salt, v->salt_size); |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 9bcf2cf19357..5aeb89411350 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
@@ -364,7 +364,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
364 | 364 | ||
365 | memset(r, 0, sizeof(*r)); | 365 | memset(r, 0, sizeof(*r)); |
366 | /* | 366 | /* |
367 | * Get optional "interrupts-names" property to add a name | 367 | * Get optional "interrupt-names" property to add a name |
368 | * to the resource. | 368 | * to the resource. |
369 | */ | 369 | */ |
370 | of_property_read_string_index(dev, "interrupt-names", index, | 370 | of_property_read_string_index(dev, "interrupt-names", index, |
@@ -380,6 +380,32 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
380 | EXPORT_SYMBOL_GPL(of_irq_to_resource); | 380 | EXPORT_SYMBOL_GPL(of_irq_to_resource); |
381 | 381 | ||
382 | /** | 382 | /** |
383 | * of_irq_get - Decode a node's IRQ and return it as a Linux irq number | ||
384 | * @dev: pointer to device tree node | ||
385 | * @index: zero-based index of the irq | ||
386 | * | ||
387 | * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain | ||
388 | * is not yet created. | ||
389 | * | ||
390 | */ | ||
391 | int of_irq_get(struct device_node *dev, int index) | ||
392 | { | ||
393 | int rc; | ||
394 | struct of_phandle_args oirq; | ||
395 | struct irq_domain *domain; | ||
396 | |||
397 | rc = of_irq_parse_one(dev, index, &oirq); | ||
398 | if (rc) | ||
399 | return rc; | ||
400 | |||
401 | domain = irq_find_host(oirq.np); | ||
402 | if (!domain) | ||
403 | return -EPROBE_DEFER; | ||
404 | |||
405 | return irq_create_of_mapping(&oirq); | ||
406 | } | ||
407 | |||
408 | /** | ||
383 | * of_irq_count - Count the number of IRQs a node uses | 409 | * of_irq_count - Count the number of IRQs a node uses |
384 | * @dev: pointer to device tree node | 410 | * @dev: pointer to device tree node |
385 | */ | 411 | */ |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 404d1daebefa..bd47fbc53dc9 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
@@ -168,7 +168,9 @@ struct platform_device *of_device_alloc(struct device_node *np, | |||
168 | rc = of_address_to_resource(np, i, res); | 168 | rc = of_address_to_resource(np, i, res); |
169 | WARN_ON(rc); | 169 | WARN_ON(rc); |
170 | } | 170 | } |
171 | WARN_ON(of_irq_to_resource_table(np, res, num_irq) != num_irq); | 171 | if (of_irq_to_resource_table(np, res, num_irq) != num_irq) |
172 | pr_debug("not all legacy IRQ resources mapped for %s\n", | ||
173 | np->name); | ||
172 | } | 174 | } |
173 | 175 | ||
174 | dev->dev.of_node = of_node_get(np); | 176 | dev->dev.of_node = of_node_get(np); |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index ae4450070503..fe70b86bcffb 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/of.h> | 11 | #include <linux/of.h> |
12 | #include <linux/of_irq.h> | 12 | #include <linux/of_irq.h> |
13 | #include <linux/of_platform.h> | ||
13 | #include <linux/list.h> | 14 | #include <linux/list.h> |
14 | #include <linux/mutex.h> | 15 | #include <linux/mutex.h> |
15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
@@ -427,6 +428,36 @@ static void __init of_selftest_match_node(void) | |||
427 | } | 428 | } |
428 | } | 429 | } |
429 | 430 | ||
431 | static void __init of_selftest_platform_populate(void) | ||
432 | { | ||
433 | int irq; | ||
434 | struct device_node *np; | ||
435 | struct platform_device *pdev; | ||
436 | |||
437 | np = of_find_node_by_path("/testcase-data"); | ||
438 | of_platform_populate(np, of_default_bus_match_table, NULL, NULL); | ||
439 | |||
440 | /* Test that a missing irq domain returns -EPROBE_DEFER */ | ||
441 | np = of_find_node_by_path("/testcase-data/testcase-device1"); | ||
442 | pdev = of_find_device_by_node(np); | ||
443 | if (!pdev) | ||
444 | selftest(0, "device 1 creation failed\n"); | ||
445 | irq = platform_get_irq(pdev, 0); | ||
446 | if (irq != -EPROBE_DEFER) | ||
447 | selftest(0, "device deferred probe failed - %d\n", irq); | ||
448 | |||
449 | /* Test that a parsing failure does not return -EPROBE_DEFER */ | ||
450 | np = of_find_node_by_path("/testcase-data/testcase-device2"); | ||
451 | pdev = of_find_device_by_node(np); | ||
452 | if (!pdev) | ||
453 | selftest(0, "device 2 creation failed\n"); | ||
454 | irq = platform_get_irq(pdev, 0); | ||
455 | if (irq >= 0 || irq == -EPROBE_DEFER) | ||
456 | selftest(0, "device parsing error failed - %d\n", irq); | ||
457 | |||
458 | selftest(1, "passed"); | ||
459 | } | ||
460 | |||
430 | static int __init of_selftest(void) | 461 | static int __init of_selftest(void) |
431 | { | 462 | { |
432 | struct device_node *np; | 463 | struct device_node *np; |
@@ -445,6 +476,7 @@ static int __init of_selftest(void) | |||
445 | of_selftest_parse_interrupts(); | 476 | of_selftest_parse_interrupts(); |
446 | of_selftest_parse_interrupts_extended(); | 477 | of_selftest_parse_interrupts_extended(); |
447 | of_selftest_match_node(); | 478 | of_selftest_match_node(); |
479 | of_selftest_platform_populate(); | ||
448 | pr_info("end of selftest - %i passed, %i failed\n", | 480 | pr_info("end of selftest - %i passed, %i failed\n", |
449 | selftest_results.passed, selftest_results.failed); | 481 | selftest_results.passed, selftest_results.failed); |
450 | return 0; | 482 | return 0; |
diff --git a/drivers/of/testcase-data/tests-interrupts.dtsi b/drivers/of/testcase-data/tests-interrupts.dtsi index c843720bd3e5..da4695f60351 100644 --- a/drivers/of/testcase-data/tests-interrupts.dtsi +++ b/drivers/of/testcase-data/tests-interrupts.dtsi | |||
@@ -54,5 +54,18 @@ | |||
54 | <&test_intmap1 1 2>; | 54 | <&test_intmap1 1 2>; |
55 | }; | 55 | }; |
56 | }; | 56 | }; |
57 | |||
58 | testcase-device1 { | ||
59 | compatible = "testcase-device"; | ||
60 | interrupt-parent = <&test_intc0>; | ||
61 | interrupts = <1>; | ||
62 | }; | ||
63 | |||
64 | testcase-device2 { | ||
65 | compatible = "testcase-device"; | ||
66 | interrupt-parent = <&test_intc2>; | ||
67 | interrupts = <1>; /* invalid specifier - too short */ | ||
68 | }; | ||
57 | }; | 69 | }; |
70 | |||
58 | }; | 71 | }; |
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 3bb05f17b9b4..4906c27fa3bd 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig | |||
@@ -33,6 +33,7 @@ config PHY_MVEBU_SATA | |||
33 | 33 | ||
34 | config OMAP_CONTROL_PHY | 34 | config OMAP_CONTROL_PHY |
35 | tristate "OMAP CONTROL PHY Driver" | 35 | tristate "OMAP CONTROL PHY Driver" |
36 | depends on ARCH_OMAP2PLUS || COMPILE_TEST | ||
36 | help | 37 | help |
37 | Enable this to add support for the PHY part present in the control | 38 | Enable this to add support for the PHY part present in the control |
38 | module. This driver has API to power on the USB2 PHY and to write to | 39 | module. This driver has API to power on the USB2 PHY and to write to |
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index 2faf78edc864..7728518572a4 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile | |||
@@ -13,8 +13,9 @@ obj-$(CONFIG_TI_PIPE3) += phy-ti-pipe3.o | |||
13 | obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o | 13 | obj-$(CONFIG_TWL4030_USB) += phy-twl4030-usb.o |
14 | obj-$(CONFIG_PHY_EXYNOS5250_SATA) += phy-exynos5250-sata.o | 14 | obj-$(CONFIG_PHY_EXYNOS5250_SATA) += phy-exynos5250-sata.o |
15 | obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o | 15 | obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o |
16 | obj-$(CONFIG_PHY_SAMSUNG_USB2) += phy-samsung-usb2.o | 16 | obj-$(CONFIG_PHY_SAMSUNG_USB2) += phy-exynos-usb2.o |
17 | obj-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o | 17 | phy-exynos-usb2-y += phy-samsung-usb2.o |
18 | obj-$(CONFIG_PHY_EXYNOS4X12_USB2) += phy-exynos4x12-usb2.o | 18 | phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4210_USB2) += phy-exynos4210-usb2.o |
19 | obj-$(CONFIG_PHY_EXYNOS5250_USB2) += phy-exynos5250-usb2.o | 19 | phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4X12_USB2) += phy-exynos4x12-usb2.o |
20 | phy-exynos-usb2-$(CONFIG_PHY_EXYNOS5250_USB2) += phy-exynos5250-usb2.o | ||
20 | obj-$(CONFIG_PHY_XGENE) += phy-xgene.o | 21 | obj-$(CONFIG_PHY_XGENE) += phy-xgene.o |
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 623b71c54b3e..c64a2f3b2d62 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c | |||
@@ -64,6 +64,9 @@ static struct phy *phy_lookup(struct device *device, const char *port) | |||
64 | class_dev_iter_init(&iter, phy_class, NULL, NULL); | 64 | class_dev_iter_init(&iter, phy_class, NULL, NULL); |
65 | while ((dev = class_dev_iter_next(&iter))) { | 65 | while ((dev = class_dev_iter_next(&iter))) { |
66 | phy = to_phy(dev); | 66 | phy = to_phy(dev); |
67 | |||
68 | if (!phy->init_data) | ||
69 | continue; | ||
67 | count = phy->init_data->num_consumers; | 70 | count = phy->init_data->num_consumers; |
68 | consumers = phy->init_data->consumers; | 71 | consumers = phy->init_data->consumers; |
69 | while (count--) { | 72 | while (count--) { |
diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c index 92ed4b2e3c07..c862f9c0e9ce 100644 --- a/drivers/pinctrl/pinctrl-as3722.c +++ b/drivers/pinctrl/pinctrl-as3722.c | |||
@@ -64,7 +64,6 @@ struct as3722_pin_function { | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | struct as3722_gpio_pin_control { | 66 | struct as3722_gpio_pin_control { |
67 | bool enable_gpio_invert; | ||
68 | unsigned mode_prop; | 67 | unsigned mode_prop; |
69 | int io_function; | 68 | int io_function; |
70 | }; | 69 | }; |
@@ -320,10 +319,8 @@ static int as3722_pinctrl_gpio_set_direction(struct pinctrl_dev *pctldev, | |||
320 | return mode; | 319 | return mode; |
321 | } | 320 | } |
322 | 321 | ||
323 | if (as_pci->gpio_control[offset].enable_gpio_invert) | 322 | return as3722_update_bits(as3722, AS3722_GPIOn_CONTROL_REG(offset), |
324 | mode |= AS3722_GPIO_INV; | 323 | AS3722_GPIO_MODE_MASK, mode); |
325 | |||
326 | return as3722_write(as3722, AS3722_GPIOn_CONTROL_REG(offset), mode); | ||
327 | } | 324 | } |
328 | 325 | ||
329 | static const struct pinmux_ops as3722_pinmux_ops = { | 326 | static const struct pinmux_ops as3722_pinmux_ops = { |
@@ -496,10 +493,18 @@ static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset, | |||
496 | { | 493 | { |
497 | struct as3722_pctrl_info *as_pci = to_as_pci(chip); | 494 | struct as3722_pctrl_info *as_pci = to_as_pci(chip); |
498 | struct as3722 *as3722 = as_pci->as3722; | 495 | struct as3722 *as3722 = as_pci->as3722; |
499 | int en_invert = as_pci->gpio_control[offset].enable_gpio_invert; | 496 | int en_invert; |
500 | u32 val; | 497 | u32 val; |
501 | int ret; | 498 | int ret; |
502 | 499 | ||
500 | ret = as3722_read(as3722, AS3722_GPIOn_CONTROL_REG(offset), &val); | ||
501 | if (ret < 0) { | ||
502 | dev_err(as_pci->dev, | ||
503 | "GPIO_CONTROL%d_REG read failed: %d\n", offset, ret); | ||
504 | return; | ||
505 | } | ||
506 | en_invert = !!(val & AS3722_GPIO_INV); | ||
507 | |||
503 | if (value) | 508 | if (value) |
504 | val = (en_invert) ? 0 : AS3722_GPIOn_SIGNAL(offset); | 509 | val = (en_invert) ? 0 : AS3722_GPIOn_SIGNAL(offset); |
505 | else | 510 | else |
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 81075f2a1d3f..2960557bfed9 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c | |||
@@ -810,6 +810,7 @@ static const struct pinconf_ops pcs_pinconf_ops = { | |||
810 | static int pcs_add_pin(struct pcs_device *pcs, unsigned offset, | 810 | static int pcs_add_pin(struct pcs_device *pcs, unsigned offset, |
811 | unsigned pin_pos) | 811 | unsigned pin_pos) |
812 | { | 812 | { |
813 | struct pcs_soc_data *pcs_soc = &pcs->socdata; | ||
813 | struct pinctrl_pin_desc *pin; | 814 | struct pinctrl_pin_desc *pin; |
814 | struct pcs_name *pn; | 815 | struct pcs_name *pn; |
815 | int i; | 816 | int i; |
@@ -821,6 +822,18 @@ static int pcs_add_pin(struct pcs_device *pcs, unsigned offset, | |||
821 | return -ENOMEM; | 822 | return -ENOMEM; |
822 | } | 823 | } |
823 | 824 | ||
825 | if (pcs_soc->irq_enable_mask) { | ||
826 | unsigned val; | ||
827 | |||
828 | val = pcs->read(pcs->base + offset); | ||
829 | if (val & pcs_soc->irq_enable_mask) { | ||
830 | dev_dbg(pcs->dev, "irq enabled at boot for pin at %lx (%x), clearing\n", | ||
831 | (unsigned long)pcs->res->start + offset, val); | ||
832 | val &= ~pcs_soc->irq_enable_mask; | ||
833 | pcs->write(val, pcs->base + offset); | ||
834 | } | ||
835 | } | ||
836 | |||
824 | pin = &pcs->pins.pa[i]; | 837 | pin = &pcs->pins.pa[i]; |
825 | pn = &pcs->names[i]; | 838 | pn = &pcs->names[i]; |
826 | sprintf(pn->name, "%lx.%d", | 839 | sprintf(pn->name, "%lx.%d", |
diff --git a/drivers/pinctrl/pinctrl-tb10x.c b/drivers/pinctrl/pinctrl-tb10x.c index c5e0f6973a3b..26ca6855f478 100644 --- a/drivers/pinctrl/pinctrl-tb10x.c +++ b/drivers/pinctrl/pinctrl-tb10x.c | |||
@@ -629,9 +629,8 @@ static int tb10x_gpio_request_enable(struct pinctrl_dev *pctl, | |||
629 | */ | 629 | */ |
630 | for (i = 0; i < state->pinfuncgrpcnt; i++) { | 630 | for (i = 0; i < state->pinfuncgrpcnt; i++) { |
631 | const struct tb10x_pinfuncgrp *pfg = &state->pingroups[i]; | 631 | const struct tb10x_pinfuncgrp *pfg = &state->pingroups[i]; |
632 | unsigned int port = pfg->port; | ||
633 | unsigned int mode = pfg->mode; | 632 | unsigned int mode = pfg->mode; |
634 | int j; | 633 | int j, port = pfg->port; |
635 | 634 | ||
636 | /* | 635 | /* |
637 | * Skip pin groups which are always mapped and don't need | 636 | * Skip pin groups which are always mapped and don't need |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c index 48093719167a..f5cd3f961808 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c | |||
@@ -4794,8 +4794,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { | |||
4794 | FN_MSIOF0_SCK_B, 0, | 4794 | FN_MSIOF0_SCK_B, 0, |
4795 | /* IP5_23_21 [3] */ | 4795 | /* IP5_23_21 [3] */ |
4796 | FN_WE1_N, FN_IERX, FN_CAN1_RX, FN_VI1_G4, | 4796 | FN_WE1_N, FN_IERX, FN_CAN1_RX, FN_VI1_G4, |
4797 | FN_VI1_G4_B, FN_VI2_R6, FN_SCIFA0_CTS_N_B, | 4797 | FN_VI1_G4_B, FN_VI2_R6, FN_SCIFA0_CTS_N_B, FN_IERX_C, |
4798 | FN_IERX_C, 0, | ||
4799 | /* IP5_20_18 [3] */ | 4798 | /* IP5_20_18 [3] */ |
4800 | FN_WE0_N, FN_IECLK, FN_CAN_CLK, | 4799 | FN_WE0_N, FN_IECLK, FN_CAN_CLK, |
4801 | FN_VI2_VSYNC_N, FN_SCIFA0_TXD_B, FN_VI2_VSYNC_N_B, 0, 0, | 4800 | FN_VI2_VSYNC_N, FN_SCIFA0_TXD_B, FN_VI2_VSYNC_N_B, 0, 0, |
diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c index 5186d70c49d4..7868bf3a0f91 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7791.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c | |||
@@ -5288,7 +5288,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = { | |||
5288 | /* SEL_SCIF3 [2] */ | 5288 | /* SEL_SCIF3 [2] */ |
5289 | FN_SEL_SCIF3_0, FN_SEL_SCIF3_1, FN_SEL_SCIF3_2, FN_SEL_SCIF3_3, | 5289 | FN_SEL_SCIF3_0, FN_SEL_SCIF3_1, FN_SEL_SCIF3_2, FN_SEL_SCIF3_3, |
5290 | /* SEL_IEB [2] */ | 5290 | /* SEL_IEB [2] */ |
5291 | FN_SEL_IEB_0, FN_SEL_IEB_1, FN_SEL_IEB_2, | 5291 | FN_SEL_IEB_0, FN_SEL_IEB_1, FN_SEL_IEB_2, 0, |
5292 | /* SEL_MMC [1] */ | 5292 | /* SEL_MMC [1] */ |
5293 | FN_SEL_MMC_0, FN_SEL_MMC_1, | 5293 | FN_SEL_MMC_0, FN_SEL_MMC_1, |
5294 | /* SEL_SCIF5 [1] */ | 5294 | /* SEL_SCIF5 [1] */ |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 9f611cbbc294..c31aa07b3ba5 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -83,8 +83,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) | |||
83 | { | 83 | { |
84 | struct acpi_device *acpi_dev; | 84 | struct acpi_device *acpi_dev; |
85 | acpi_handle handle; | 85 | acpi_handle handle; |
86 | struct acpi_buffer buffer; | 86 | int ret = 0; |
87 | int ret; | ||
88 | 87 | ||
89 | pnp_dbg(&dev->dev, "set resources\n"); | 88 | pnp_dbg(&dev->dev, "set resources\n"); |
90 | 89 | ||
@@ -97,19 +96,26 @@ static int pnpacpi_set_resources(struct pnp_dev *dev) | |||
97 | if (WARN_ON_ONCE(acpi_dev != dev->data)) | 96 | if (WARN_ON_ONCE(acpi_dev != dev->data)) |
98 | dev->data = acpi_dev; | 97 | dev->data = acpi_dev; |
99 | 98 | ||
100 | ret = pnpacpi_build_resource_template(dev, &buffer); | 99 | if (acpi_has_method(handle, METHOD_NAME__SRS)) { |
101 | if (ret) | 100 | struct acpi_buffer buffer; |
102 | return ret; | 101 | |
103 | ret = pnpacpi_encode_resources(dev, &buffer); | 102 | ret = pnpacpi_build_resource_template(dev, &buffer); |
104 | if (ret) { | 103 | if (ret) |
104 | return ret; | ||
105 | |||
106 | ret = pnpacpi_encode_resources(dev, &buffer); | ||
107 | if (!ret) { | ||
108 | acpi_status status; | ||
109 | |||
110 | status = acpi_set_current_resources(handle, &buffer); | ||
111 | if (ACPI_FAILURE(status)) | ||
112 | ret = -EIO; | ||
113 | } | ||
105 | kfree(buffer.pointer); | 114 | kfree(buffer.pointer); |
106 | return ret; | ||
107 | } | 115 | } |
108 | if (ACPI_FAILURE(acpi_set_current_resources(handle, &buffer))) | 116 | if (!ret && acpi_bus_power_manageable(handle)) |
109 | ret = -EINVAL; | ||
110 | else if (acpi_bus_power_manageable(handle)) | ||
111 | ret = acpi_bus_set_power(handle, ACPI_STATE_D0); | 117 | ret = acpi_bus_set_power(handle, ACPI_STATE_D0); |
112 | kfree(buffer.pointer); | 118 | |
113 | return ret; | 119 | return ret; |
114 | } | 120 | } |
115 | 121 | ||
@@ -117,7 +123,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) | |||
117 | { | 123 | { |
118 | struct acpi_device *acpi_dev; | 124 | struct acpi_device *acpi_dev; |
119 | acpi_handle handle; | 125 | acpi_handle handle; |
120 | int ret; | 126 | acpi_status status; |
121 | 127 | ||
122 | dev_dbg(&dev->dev, "disable resources\n"); | 128 | dev_dbg(&dev->dev, "disable resources\n"); |
123 | 129 | ||
@@ -128,13 +134,15 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) | |||
128 | } | 134 | } |
129 | 135 | ||
130 | /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ | 136 | /* acpi_unregister_gsi(pnp_irq(dev, 0)); */ |
131 | ret = 0; | ||
132 | if (acpi_bus_power_manageable(handle)) | 137 | if (acpi_bus_power_manageable(handle)) |
133 | acpi_bus_set_power(handle, ACPI_STATE_D3_COLD); | 138 | acpi_bus_set_power(handle, ACPI_STATE_D3_COLD); |
134 | /* continue even if acpi_bus_set_power() fails */ | 139 | |
135 | if (ACPI_FAILURE(acpi_evaluate_object(handle, "_DIS", NULL, NULL))) | 140 | /* continue even if acpi_bus_set_power() fails */ |
136 | ret = -ENODEV; | 141 | status = acpi_evaluate_object(handle, "_DIS", NULL, NULL); |
137 | return ret; | 142 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) |
143 | return -ENODEV; | ||
144 | |||
145 | return 0; | ||
138 | } | 146 | } |
139 | 147 | ||
140 | #ifdef CONFIG_ACPI_SLEEP | 148 | #ifdef CONFIG_ACPI_SLEEP |
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 258fef272ea7..ebf0d6710b5a 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/pci.h> | ||
18 | #include <linux/string.h> | 19 | #include <linux/string.h> |
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/pnp.h> | 21 | #include <linux/pnp.h> |
@@ -334,6 +335,81 @@ static void quirk_amd_mmconfig_area(struct pnp_dev *dev) | |||
334 | } | 335 | } |
335 | #endif | 336 | #endif |
336 | 337 | ||
338 | #ifdef CONFIG_PCI | ||
339 | /* Device IDs of parts that have 32KB MCH space */ | ||
340 | static const unsigned int mch_quirk_devices[] = { | ||
341 | 0x0154, /* Ivy Bridge */ | ||
342 | 0x0c00, /* Haswell */ | ||
343 | }; | ||
344 | |||
345 | static struct pci_dev *get_intel_host(void) | ||
346 | { | ||
347 | int i; | ||
348 | struct pci_dev *host; | ||
349 | |||
350 | for (i = 0; i < ARRAY_SIZE(mch_quirk_devices); i++) { | ||
351 | host = pci_get_device(PCI_VENDOR_ID_INTEL, mch_quirk_devices[i], | ||
352 | NULL); | ||
353 | if (host) | ||
354 | return host; | ||
355 | } | ||
356 | return NULL; | ||
357 | } | ||
358 | |||
359 | static void quirk_intel_mch(struct pnp_dev *dev) | ||
360 | { | ||
361 | struct pci_dev *host; | ||
362 | u32 addr_lo, addr_hi; | ||
363 | struct pci_bus_region region; | ||
364 | struct resource mch; | ||
365 | struct pnp_resource *pnp_res; | ||
366 | struct resource *res; | ||
367 | |||
368 | host = get_intel_host(); | ||
369 | if (!host) | ||
370 | return; | ||
371 | |||
372 | /* | ||
373 | * MCHBAR is not an architected PCI BAR, so MCH space is usually | ||
374 | * reported as a PNP0C02 resource. The MCH space was originally | ||
375 | * 16KB, but is 32KB in newer parts. Some BIOSes still report a | ||
376 | * PNP0C02 resource that is only 16KB, which means the rest of the | ||
377 | * MCH space is consumed but unreported. | ||
378 | */ | ||
379 | |||
380 | /* | ||
381 | * Read MCHBAR for Host Member Mapped Register Range Base | ||
382 | * https://www-ssl.intel.com/content/www/us/en/processors/core/4th-gen-core-family-desktop-vol-2-datasheet | ||
383 | * Sec 3.1.12. | ||
384 | */ | ||
385 | pci_read_config_dword(host, 0x48, &addr_lo); | ||
386 | region.start = addr_lo & ~0x7fff; | ||
387 | pci_read_config_dword(host, 0x4c, &addr_hi); | ||
388 | region.start |= (u64) addr_hi << 32; | ||
389 | region.end = region.start + 32*1024 - 1; | ||
390 | |||
391 | memset(&mch, 0, sizeof(mch)); | ||
392 | mch.flags = IORESOURCE_MEM; | ||
393 | pcibios_bus_to_resource(host->bus, &mch, ®ion); | ||
394 | |||
395 | list_for_each_entry(pnp_res, &dev->resources, list) { | ||
396 | res = &pnp_res->res; | ||
397 | if (res->end < mch.start || res->start > mch.end) | ||
398 | continue; /* no overlap */ | ||
399 | if (res->start == mch.start && res->end == mch.end) | ||
400 | continue; /* exact match */ | ||
401 | |||
402 | dev_info(&dev->dev, FW_BUG "PNP resource %pR covers only part of %s Intel MCH; extending to %pR\n", | ||
403 | res, pci_name(host), &mch); | ||
404 | res->start = mch.start; | ||
405 | res->end = mch.end; | ||
406 | break; | ||
407 | } | ||
408 | |||
409 | pci_dev_put(host); | ||
410 | } | ||
411 | #endif | ||
412 | |||
337 | /* | 413 | /* |
338 | * PnP Quirks | 414 | * PnP Quirks |
339 | * Cards or devices that need some tweaking due to incomplete resource info | 415 | * Cards or devices that need some tweaking due to incomplete resource info |
@@ -364,6 +440,9 @@ static struct pnp_fixup pnp_fixups[] = { | |||
364 | #ifdef CONFIG_AMD_NB | 440 | #ifdef CONFIG_AMD_NB |
365 | {"PNP0c01", quirk_amd_mmconfig_area}, | 441 | {"PNP0c01", quirk_amd_mmconfig_area}, |
366 | #endif | 442 | #endif |
443 | #ifdef CONFIG_PCI | ||
444 | {"PNP0c02", quirk_intel_mch}, | ||
445 | #endif | ||
367 | {""} | 446 | {""} |
368 | }; | 447 | }; |
369 | 448 | ||
diff --git a/drivers/power/reset/vexpress-poweroff.c b/drivers/power/reset/vexpress-poweroff.c index 476aa495c110..b95cf71ed695 100644 --- a/drivers/power/reset/vexpress-poweroff.c +++ b/drivers/power/reset/vexpress-poweroff.c | |||
@@ -11,7 +11,7 @@ | |||
11 | * Copyright (C) 2012 ARM Limited | 11 | * Copyright (C) 2012 ARM Limited |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/jiffies.h> | 14 | #include <linux/delay.h> |
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/of_device.h> | 16 | #include <linux/of_device.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
@@ -23,17 +23,12 @@ | |||
23 | static void vexpress_reset_do(struct device *dev, const char *what) | 23 | static void vexpress_reset_do(struct device *dev, const char *what) |
24 | { | 24 | { |
25 | int err = -ENOENT; | 25 | int err = -ENOENT; |
26 | struct vexpress_config_func *func = | 26 | struct vexpress_config_func *func = dev_get_drvdata(dev); |
27 | vexpress_config_func_get_by_dev(dev); | ||
28 | 27 | ||
29 | if (func) { | 28 | if (func) { |
30 | unsigned long timeout; | ||
31 | |||
32 | err = vexpress_config_write(func, 0, 0); | 29 | err = vexpress_config_write(func, 0, 0); |
33 | 30 | if (!err) | |
34 | timeout = jiffies + HZ; | 31 | mdelay(1000); |
35 | while (time_before(jiffies, timeout)) | ||
36 | cpu_relax(); | ||
37 | } | 32 | } |
38 | 33 | ||
39 | dev_emerg(dev, "Unable to %s (%d)\n", what, err); | 34 | dev_emerg(dev, "Unable to %s (%d)\n", what, err); |
@@ -96,12 +91,18 @@ static int vexpress_reset_probe(struct platform_device *pdev) | |||
96 | enum vexpress_reset_func func; | 91 | enum vexpress_reset_func func; |
97 | const struct of_device_id *match = | 92 | const struct of_device_id *match = |
98 | of_match_device(vexpress_reset_of_match, &pdev->dev); | 93 | of_match_device(vexpress_reset_of_match, &pdev->dev); |
94 | struct vexpress_config_func *config_func; | ||
99 | 95 | ||
100 | if (match) | 96 | if (match) |
101 | func = (enum vexpress_reset_func)match->data; | 97 | func = (enum vexpress_reset_func)match->data; |
102 | else | 98 | else |
103 | func = pdev->id_entry->driver_data; | 99 | func = pdev->id_entry->driver_data; |
104 | 100 | ||
101 | config_func = vexpress_config_func_get_by_dev(&pdev->dev); | ||
102 | if (!config_func) | ||
103 | return -EINVAL; | ||
104 | dev_set_drvdata(&pdev->dev, config_func); | ||
105 | |||
105 | switch (func) { | 106 | switch (func) { |
106 | case FUNC_SHUTDOWN: | 107 | case FUNC_SHUTDOWN: |
107 | vexpress_power_off_device = &pdev->dev; | 108 | vexpress_power_off_device = &pdev->dev; |
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c index ded3b3574209..6d38be3d970c 100644 --- a/drivers/regulator/pbias-regulator.c +++ b/drivers/regulator/pbias-regulator.c | |||
@@ -38,66 +38,24 @@ struct pbias_reg_info { | |||
38 | struct pbias_regulator_data { | 38 | struct pbias_regulator_data { |
39 | struct regulator_desc desc; | 39 | struct regulator_desc desc; |
40 | void __iomem *pbias_addr; | 40 | void __iomem *pbias_addr; |
41 | unsigned int pbias_reg; | ||
42 | struct regulator_dev *dev; | 41 | struct regulator_dev *dev; |
43 | struct regmap *syscon; | 42 | struct regmap *syscon; |
44 | const struct pbias_reg_info *info; | 43 | const struct pbias_reg_info *info; |
45 | int voltage; | 44 | int voltage; |
46 | }; | 45 | }; |
47 | 46 | ||
48 | static int pbias_regulator_set_voltage(struct regulator_dev *dev, | 47 | static const unsigned int pbias_volt_table[] = { |
49 | int min_uV, int max_uV, unsigned *selector) | 48 | 1800000, |
50 | { | 49 | 3000000 |
51 | struct pbias_regulator_data *data = rdev_get_drvdata(dev); | 50 | }; |
52 | const struct pbias_reg_info *info = data->info; | ||
53 | int ret, vmode; | ||
54 | |||
55 | if (min_uV <= 1800000) | ||
56 | vmode = 0; | ||
57 | else if (min_uV > 1800000) | ||
58 | vmode = info->vmode; | ||
59 | |||
60 | ret = regmap_update_bits(data->syscon, data->pbias_reg, | ||
61 | info->vmode, vmode); | ||
62 | |||
63 | return ret; | ||
64 | } | ||
65 | |||
66 | static int pbias_regulator_get_voltage(struct regulator_dev *rdev) | ||
67 | { | ||
68 | struct pbias_regulator_data *data = rdev_get_drvdata(rdev); | ||
69 | const struct pbias_reg_info *info = data->info; | ||
70 | int value, voltage; | ||
71 | |||
72 | regmap_read(data->syscon, data->pbias_reg, &value); | ||
73 | value &= info->vmode; | ||
74 | |||
75 | voltage = value ? 3000000 : 1800000; | ||
76 | |||
77 | return voltage; | ||
78 | } | ||
79 | 51 | ||
80 | static int pbias_regulator_enable(struct regulator_dev *rdev) | 52 | static int pbias_regulator_enable(struct regulator_dev *rdev) |
81 | { | 53 | { |
82 | struct pbias_regulator_data *data = rdev_get_drvdata(rdev); | 54 | struct pbias_regulator_data *data = rdev_get_drvdata(rdev); |
83 | const struct pbias_reg_info *info = data->info; | 55 | const struct pbias_reg_info *info = data->info; |
84 | int ret; | ||
85 | |||
86 | ret = regmap_update_bits(data->syscon, data->pbias_reg, | ||
87 | info->enable_mask, info->enable); | ||
88 | |||
89 | return ret; | ||
90 | } | ||
91 | |||
92 | static int pbias_regulator_disable(struct regulator_dev *rdev) | ||
93 | { | ||
94 | struct pbias_regulator_data *data = rdev_get_drvdata(rdev); | ||
95 | const struct pbias_reg_info *info = data->info; | ||
96 | int ret; | ||
97 | 56 | ||
98 | ret = regmap_update_bits(data->syscon, data->pbias_reg, | 57 | return regmap_update_bits(data->syscon, rdev->desc->enable_reg, |
99 | info->enable_mask, 0); | 58 | info->enable_mask, info->enable); |
100 | return ret; | ||
101 | } | 59 | } |
102 | 60 | ||
103 | static int pbias_regulator_is_enable(struct regulator_dev *rdev) | 61 | static int pbias_regulator_is_enable(struct regulator_dev *rdev) |
@@ -106,17 +64,18 @@ static int pbias_regulator_is_enable(struct regulator_dev *rdev) | |||
106 | const struct pbias_reg_info *info = data->info; | 64 | const struct pbias_reg_info *info = data->info; |
107 | int value; | 65 | int value; |
108 | 66 | ||
109 | regmap_read(data->syscon, data->pbias_reg, &value); | 67 | regmap_read(data->syscon, rdev->desc->enable_reg, &value); |
110 | 68 | ||
111 | return (value & info->enable_mask) == info->enable_mask; | 69 | return (value & info->enable_mask) == info->enable; |
112 | } | 70 | } |
113 | 71 | ||
114 | static struct regulator_ops pbias_regulator_voltage_ops = { | 72 | static struct regulator_ops pbias_regulator_voltage_ops = { |
115 | .set_voltage = pbias_regulator_set_voltage, | 73 | .list_voltage = regulator_list_voltage_table, |
116 | .get_voltage = pbias_regulator_get_voltage, | 74 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
117 | .enable = pbias_regulator_enable, | 75 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
118 | .disable = pbias_regulator_disable, | 76 | .enable = pbias_regulator_enable, |
119 | .is_enabled = pbias_regulator_is_enable, | 77 | .disable = regulator_disable_regmap, |
78 | .is_enabled = pbias_regulator_is_enable, | ||
120 | }; | 79 | }; |
121 | 80 | ||
122 | static const struct pbias_reg_info pbias_mmc_omap2430 = { | 81 | static const struct pbias_reg_info pbias_mmc_omap2430 = { |
@@ -192,6 +151,7 @@ static int pbias_regulator_probe(struct platform_device *pdev) | |||
192 | if (IS_ERR(syscon)) | 151 | if (IS_ERR(syscon)) |
193 | return PTR_ERR(syscon); | 152 | return PTR_ERR(syscon); |
194 | 153 | ||
154 | cfg.regmap = syscon; | ||
195 | cfg.dev = &pdev->dev; | 155 | cfg.dev = &pdev->dev; |
196 | 156 | ||
197 | for (idx = 0; idx < PBIAS_NUM_REGS && data_idx < count; idx++) { | 157 | for (idx = 0; idx < PBIAS_NUM_REGS && data_idx < count; idx++) { |
@@ -207,15 +167,19 @@ static int pbias_regulator_probe(struct platform_device *pdev) | |||
207 | if (!res) | 167 | if (!res) |
208 | return -EINVAL; | 168 | return -EINVAL; |
209 | 169 | ||
210 | drvdata[data_idx].pbias_reg = res->start; | ||
211 | drvdata[data_idx].syscon = syscon; | 170 | drvdata[data_idx].syscon = syscon; |
212 | drvdata[data_idx].info = info; | 171 | drvdata[data_idx].info = info; |
213 | drvdata[data_idx].desc.name = info->name; | 172 | drvdata[data_idx].desc.name = info->name; |
214 | drvdata[data_idx].desc.owner = THIS_MODULE; | 173 | drvdata[data_idx].desc.owner = THIS_MODULE; |
215 | drvdata[data_idx].desc.type = REGULATOR_VOLTAGE; | 174 | drvdata[data_idx].desc.type = REGULATOR_VOLTAGE; |
216 | drvdata[data_idx].desc.ops = &pbias_regulator_voltage_ops; | 175 | drvdata[data_idx].desc.ops = &pbias_regulator_voltage_ops; |
176 | drvdata[data_idx].desc.volt_table = pbias_volt_table; | ||
217 | drvdata[data_idx].desc.n_voltages = 2; | 177 | drvdata[data_idx].desc.n_voltages = 2; |
218 | drvdata[data_idx].desc.enable_time = info->enable_time; | 178 | drvdata[data_idx].desc.enable_time = info->enable_time; |
179 | drvdata[data_idx].desc.vsel_reg = res->start; | ||
180 | drvdata[data_idx].desc.vsel_mask = info->vmode; | ||
181 | drvdata[data_idx].desc.enable_reg = res->start; | ||
182 | drvdata[data_idx].desc.enable_mask = info->enable_mask; | ||
219 | 183 | ||
220 | cfg.init_data = pbias_matches[idx].init_data; | 184 | cfg.init_data = pbias_matches[idx].init_data; |
221 | cfg.driver_data = &drvdata[data_idx]; | 185 | cfg.driver_data = &drvdata[data_idx]; |
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c index 9f0ea6cb6922..e3bf885f4a6c 100644 --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c | |||
@@ -541,18 +541,27 @@ static void chsc_process_sei_nt0(struct chsc_sei_nt0_area *sei_area) | |||
541 | 541 | ||
542 | static void chsc_process_event_information(struct chsc_sei *sei, u64 ntsm) | 542 | static void chsc_process_event_information(struct chsc_sei *sei, u64 ntsm) |
543 | { | 543 | { |
544 | do { | 544 | static int ntsm_unsupported; |
545 | |||
546 | while (true) { | ||
545 | memset(sei, 0, sizeof(*sei)); | 547 | memset(sei, 0, sizeof(*sei)); |
546 | sei->request.length = 0x0010; | 548 | sei->request.length = 0x0010; |
547 | sei->request.code = 0x000e; | 549 | sei->request.code = 0x000e; |
548 | sei->ntsm = ntsm; | 550 | if (!ntsm_unsupported) |
551 | sei->ntsm = ntsm; | ||
549 | 552 | ||
550 | if (chsc(sei)) | 553 | if (chsc(sei)) |
551 | break; | 554 | break; |
552 | 555 | ||
553 | if (sei->response.code != 0x0001) { | 556 | if (sei->response.code != 0x0001) { |
554 | CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x)\n", | 557 | CIO_CRW_EVENT(2, "chsc: sei failed (rc=%04x, ntsm=%llx)\n", |
555 | sei->response.code); | 558 | sei->response.code, sei->ntsm); |
559 | |||
560 | if (sei->response.code == 3 && sei->ntsm) { | ||
561 | /* Fallback for old firmware. */ | ||
562 | ntsm_unsupported = 1; | ||
563 | continue; | ||
564 | } | ||
556 | break; | 565 | break; |
557 | } | 566 | } |
558 | 567 | ||
@@ -568,7 +577,10 @@ static void chsc_process_event_information(struct chsc_sei *sei, u64 ntsm) | |||
568 | CIO_CRW_EVENT(2, "chsc: unhandled nt: %d\n", sei->nt); | 577 | CIO_CRW_EVENT(2, "chsc: unhandled nt: %d\n", sei->nt); |
569 | break; | 578 | break; |
570 | } | 579 | } |
571 | } while (sei->u.nt0_area.flags & 0x80); | 580 | |
581 | if (!(sei->u.nt0_area.flags & 0x80)) | ||
582 | break; | ||
583 | } | ||
572 | } | 584 | } |
573 | 585 | ||
574 | /* | 586 | /* |
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 8cf4a0c69baf..9a6e4a2cd072 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -7463,6 +7463,10 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) | |||
7463 | if (hpsa_simple_mode) | 7463 | if (hpsa_simple_mode) |
7464 | return; | 7464 | return; |
7465 | 7465 | ||
7466 | trans_support = readl(&(h->cfgtable->TransportSupport)); | ||
7467 | if (!(trans_support & PERFORMANT_MODE)) | ||
7468 | return; | ||
7469 | |||
7466 | /* Check for I/O accelerator mode support */ | 7470 | /* Check for I/O accelerator mode support */ |
7467 | if (trans_support & CFGTBL_Trans_io_accel1) { | 7471 | if (trans_support & CFGTBL_Trans_io_accel1) { |
7468 | transMethod |= CFGTBL_Trans_io_accel1 | | 7472 | transMethod |= CFGTBL_Trans_io_accel1 | |
@@ -7479,10 +7483,6 @@ static void hpsa_put_ctlr_into_performant_mode(struct ctlr_info *h) | |||
7479 | } | 7483 | } |
7480 | 7484 | ||
7481 | /* TODO, check that this next line h->nreply_queues is correct */ | 7485 | /* TODO, check that this next line h->nreply_queues is correct */ |
7482 | trans_support = readl(&(h->cfgtable->TransportSupport)); | ||
7483 | if (!(trans_support & PERFORMANT_MODE)) | ||
7484 | return; | ||
7485 | |||
7486 | h->nreply_queues = h->msix_vector > 0 ? h->msix_vector : 1; | 7486 | h->nreply_queues = h->msix_vector > 0 ? h->msix_vector : 1; |
7487 | hpsa_get_max_perf_mode_cmds(h); | 7487 | hpsa_get_max_perf_mode_cmds(h); |
7488 | /* Performant mode ring buffer and supporting data structures */ | 7488 | /* Performant mode ring buffer and supporting data structures */ |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 771c16bfdbac..f17aa7aa7879 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -189,6 +189,7 @@ scsi_abort_command(struct scsi_cmnd *scmd) | |||
189 | /* | 189 | /* |
190 | * Retry after abort failed, escalate to next level. | 190 | * Retry after abort failed, escalate to next level. |
191 | */ | 191 | */ |
192 | scmd->eh_eflags &= ~SCSI_EH_ABORT_SCHEDULED; | ||
192 | SCSI_LOG_ERROR_RECOVERY(3, | 193 | SCSI_LOG_ERROR_RECOVERY(3, |
193 | scmd_printk(KERN_INFO, scmd, | 194 | scmd_printk(KERN_INFO, scmd, |
194 | "scmd %p previous abort failed\n", scmd)); | 195 | "scmd %p previous abort failed\n", scmd)); |
@@ -920,10 +921,12 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, | |||
920 | ses->prot_op = scmd->prot_op; | 921 | ses->prot_op = scmd->prot_op; |
921 | 922 | ||
922 | scmd->prot_op = SCSI_PROT_NORMAL; | 923 | scmd->prot_op = SCSI_PROT_NORMAL; |
924 | scmd->eh_eflags = 0; | ||
923 | scmd->cmnd = ses->eh_cmnd; | 925 | scmd->cmnd = ses->eh_cmnd; |
924 | memset(scmd->cmnd, 0, BLK_MAX_CDB); | 926 | memset(scmd->cmnd, 0, BLK_MAX_CDB); |
925 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); | 927 | memset(&scmd->sdb, 0, sizeof(scmd->sdb)); |
926 | scmd->request->next_rq = NULL; | 928 | scmd->request->next_rq = NULL; |
929 | scmd->result = 0; | ||
927 | 930 | ||
928 | if (sense_bytes) { | 931 | if (sense_bytes) { |
929 | scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE, | 932 | scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE, |
@@ -1157,6 +1160,15 @@ int scsi_eh_get_sense(struct list_head *work_q, | |||
1157 | __func__)); | 1160 | __func__)); |
1158 | break; | 1161 | break; |
1159 | } | 1162 | } |
1163 | if (status_byte(scmd->result) != CHECK_CONDITION) | ||
1164 | /* | ||
1165 | * don't request sense if there's no check condition | ||
1166 | * status because the error we're processing isn't one | ||
1167 | * that has a sense code (and some devices get | ||
1168 | * confused by sense requests out of the blue) | ||
1169 | */ | ||
1170 | continue; | ||
1171 | |||
1160 | SCSI_LOG_ERROR_RECOVERY(2, scmd_printk(KERN_INFO, scmd, | 1172 | SCSI_LOG_ERROR_RECOVERY(2, scmd_printk(KERN_INFO, scmd, |
1161 | "%s: requesting sense\n", | 1173 | "%s: requesting sense\n", |
1162 | current->comm)); | 1174 | current->comm)); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 65a123d9c676..9db097a28a74 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -137,6 +137,7 @@ static void __scsi_queue_insert(struct scsi_cmnd *cmd, int reason, int unbusy) | |||
137 | * lock such that the kblockd_schedule_work() call happens | 137 | * lock such that the kblockd_schedule_work() call happens |
138 | * before blk_cleanup_queue() finishes. | 138 | * before blk_cleanup_queue() finishes. |
139 | */ | 139 | */ |
140 | cmd->result = 0; | ||
140 | spin_lock_irqsave(q->queue_lock, flags); | 141 | spin_lock_irqsave(q->queue_lock, flags); |
141 | blk_requeue_request(q, cmd->request); | 142 | blk_requeue_request(q, cmd->request); |
142 | kblockd_schedule_work(q, &device->requeue_work); | 143 | kblockd_schedule_work(q, &device->requeue_work); |
@@ -1044,6 +1045,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | |||
1044 | */ | 1045 | */ |
1045 | int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask) | 1046 | int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask) |
1046 | { | 1047 | { |
1048 | struct scsi_device *sdev = cmd->device; | ||
1047 | struct request *rq = cmd->request; | 1049 | struct request *rq = cmd->request; |
1048 | 1050 | ||
1049 | int error = scsi_init_sgtable(rq, &cmd->sdb, gfp_mask); | 1051 | int error = scsi_init_sgtable(rq, &cmd->sdb, gfp_mask); |
@@ -1091,7 +1093,7 @@ err_exit: | |||
1091 | scsi_release_buffers(cmd); | 1093 | scsi_release_buffers(cmd); |
1092 | cmd->request->special = NULL; | 1094 | cmd->request->special = NULL; |
1093 | scsi_put_command(cmd); | 1095 | scsi_put_command(cmd); |
1094 | put_device(&cmd->device->sdev_gendev); | 1096 | put_device(&sdev->sdev_gendev); |
1095 | return error; | 1097 | return error; |
1096 | } | 1098 | } |
1097 | EXPORT_SYMBOL(scsi_init_io); | 1099 | EXPORT_SYMBOL(scsi_init_io); |
@@ -1273,7 +1275,7 @@ int scsi_prep_return(struct request_queue *q, struct request *req, int ret) | |||
1273 | struct scsi_cmnd *cmd = req->special; | 1275 | struct scsi_cmnd *cmd = req->special; |
1274 | scsi_release_buffers(cmd); | 1276 | scsi_release_buffers(cmd); |
1275 | scsi_put_command(cmd); | 1277 | scsi_put_command(cmd); |
1276 | put_device(&cmd->device->sdev_gendev); | 1278 | put_device(&sdev->sdev_gendev); |
1277 | req->special = NULL; | 1279 | req->special = NULL; |
1278 | } | 1280 | } |
1279 | break; | 1281 | break; |
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 8005f9869481..079e6b1b0cdb 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -1115,8 +1115,11 @@ static int atmel_spi_one_transfer(struct spi_master *master, | |||
1115 | atmel_spi_next_xfer_pio(master, xfer); | 1115 | atmel_spi_next_xfer_pio(master, xfer); |
1116 | } | 1116 | } |
1117 | 1117 | ||
1118 | /* interrupts are disabled, so free the lock for schedule */ | ||
1119 | atmel_spi_unlock(as); | ||
1118 | ret = wait_for_completion_timeout(&as->xfer_completion, | 1120 | ret = wait_for_completion_timeout(&as->xfer_completion, |
1119 | SPI_DMA_TIMEOUT); | 1121 | SPI_DMA_TIMEOUT); |
1122 | atmel_spi_lock(as); | ||
1120 | if (WARN_ON(ret == 0)) { | 1123 | if (WARN_ON(ret == 0)) { |
1121 | dev_err(&spi->dev, | 1124 | dev_err(&spi->dev, |
1122 | "spi trasfer timeout, err %d\n", ret); | 1125 | "spi trasfer timeout, err %d\n", ret); |
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index 55e57c3eb9bd..ebf720b88a2a 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/device.h> | 14 | #include <linux/device.h> |
15 | #include <linux/gpio.h> | ||
15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
16 | #include <linux/io.h> | 17 | #include <linux/io.h> |
17 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index 9009456bdf4d..c8e795ef2e13 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c | |||
@@ -244,9 +244,9 @@ static int hspi_probe(struct platform_device *pdev) | |||
244 | return -ENOMEM; | 244 | return -ENOMEM; |
245 | } | 245 | } |
246 | 246 | ||
247 | clk = clk_get(NULL, "shyway_clk"); | 247 | clk = clk_get(&pdev->dev, NULL); |
248 | if (IS_ERR(clk)) { | 248 | if (IS_ERR(clk)) { |
249 | dev_err(&pdev->dev, "shyway_clk is required\n"); | 249 | dev_err(&pdev->dev, "couldn't get clock\n"); |
250 | ret = -EINVAL; | 250 | ret = -EINVAL; |
251 | goto error0; | 251 | goto error0; |
252 | } | 252 | } |
diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index 1a77ad52812f..67d8909dcf39 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c | |||
@@ -287,8 +287,8 @@ static irqreturn_t spi_sirfsoc_irq(int irq, void *dev_id) | |||
287 | sspi->left_rx_word) | 287 | sspi->left_rx_word) |
288 | sspi->rx_word(sspi); | 288 | sspi->rx_word(sspi); |
289 | 289 | ||
290 | if (spi_stat & (SIRFSOC_SPI_FIFO_EMPTY | 290 | if (spi_stat & (SIRFSOC_SPI_TXFIFO_EMPTY | |
291 | | SIRFSOC_SPI_TXFIFO_THD_REACH)) | 291 | SIRFSOC_SPI_TXFIFO_THD_REACH)) |
292 | while (!((readl(sspi->base + SIRFSOC_SPI_TXFIFO_STATUS) | 292 | while (!((readl(sspi->base + SIRFSOC_SPI_TXFIFO_STATUS) |
293 | & SIRFSOC_SPI_FIFO_FULL)) && | 293 | & SIRFSOC_SPI_FIFO_FULL)) && |
294 | sspi->left_tx_word) | 294 | sspi->left_tx_word) |
@@ -470,7 +470,16 @@ static void spi_sirfsoc_chipselect(struct spi_device *spi, int value) | |||
470 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); | 470 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); |
471 | } else { | 471 | } else { |
472 | int gpio = sspi->chipselect[spi->chip_select]; | 472 | int gpio = sspi->chipselect[spi->chip_select]; |
473 | gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1); | 473 | switch (value) { |
474 | case BITBANG_CS_ACTIVE: | ||
475 | gpio_direction_output(gpio, | ||
476 | spi->mode & SPI_CS_HIGH ? 1 : 0); | ||
477 | break; | ||
478 | case BITBANG_CS_INACTIVE: | ||
479 | gpio_direction_output(gpio, | ||
480 | spi->mode & SPI_CS_HIGH ? 0 : 1); | ||
481 | break; | ||
482 | } | ||
474 | } | 483 | } |
475 | } | 484 | } |
476 | 485 | ||
@@ -559,6 +568,11 @@ spi_sirfsoc_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | |||
559 | regval &= ~SIRFSOC_SPI_CMD_MODE; | 568 | regval &= ~SIRFSOC_SPI_CMD_MODE; |
560 | sspi->tx_by_cmd = false; | 569 | sspi->tx_by_cmd = false; |
561 | } | 570 | } |
571 | /* | ||
572 | * set spi controller in RISC chipselect mode, we are controlling CS by | ||
573 | * software BITBANG_CS_ACTIVE and BITBANG_CS_INACTIVE. | ||
574 | */ | ||
575 | regval |= SIRFSOC_SPI_CS_IO_MODE; | ||
562 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); | 576 | writel(regval, sspi->base + SIRFSOC_SPI_CTRL); |
563 | 577 | ||
564 | if (IS_DMA_VALID(t)) { | 578 | if (IS_DMA_VALID(t)) { |
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 71db683098d6..b59af0303581 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c | |||
@@ -493,7 +493,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb) | |||
493 | /* pointer to the DA */ | 493 | /* pointer to the DA */ |
494 | *datap++ = val & 0xff; | 494 | *datap++ = val & 0xff; |
495 | *datap++ = (val >> 8) & 0xff; | 495 | *datap++ = (val >> 8) & 0xff; |
496 | *datap++ = chan; | 496 | *datap++ = chan << 6; |
497 | devpriv->ao_readback[chan] = val; | 497 | devpriv->ao_readback[chan] = val; |
498 | 498 | ||
499 | s->async->events |= COMEDI_CB_BLOCK; | 499 | s->async->events |= COMEDI_CB_BLOCK; |
@@ -1040,11 +1040,8 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) | |||
1040 | /* set current channel of the running acquisition to zero */ | 1040 | /* set current channel of the running acquisition to zero */ |
1041 | s->async->cur_chan = 0; | 1041 | s->async->cur_chan = 0; |
1042 | 1042 | ||
1043 | for (i = 0; i < cmd->chanlist_len; ++i) { | 1043 | for (i = 0; i < cmd->chanlist_len; ++i) |
1044 | unsigned int chan = CR_CHAN(cmd->chanlist[i]); | 1044 | devpriv->ao_chanlist[i] = CR_CHAN(cmd->chanlist[i]); |
1045 | |||
1046 | devpriv->ao_chanlist[i] = chan << 6; | ||
1047 | } | ||
1048 | 1045 | ||
1049 | /* we count in steps of 1ms (125us) */ | 1046 | /* we count in steps of 1ms (125us) */ |
1050 | /* 125us mode not used yet */ | 1047 | /* 125us mode not used yet */ |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 11fb95201545..dae8d1a9038e 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -1526,7 +1526,7 @@ static int mxs_lradc_probe(struct platform_device *pdev) | |||
1526 | struct resource *iores; | 1526 | struct resource *iores; |
1527 | int ret = 0, touch_ret; | 1527 | int ret = 0, touch_ret; |
1528 | int i, s; | 1528 | int i, s; |
1529 | unsigned int scale_uv; | 1529 | uint64_t scale_uv; |
1530 | 1530 | ||
1531 | /* Allocate the IIO device. */ | 1531 | /* Allocate the IIO device. */ |
1532 | iio = devm_iio_device_alloc(dev, sizeof(*lradc)); | 1532 | iio = devm_iio_device_alloc(dev, sizeof(*lradc)); |
diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c index 36eedd8a0ea9..e2b482045158 100644 --- a/drivers/staging/iio/resolver/ad2s1200.c +++ b/drivers/staging/iio/resolver/ad2s1200.c | |||
@@ -70,6 +70,7 @@ static int ad2s1200_read_raw(struct iio_dev *indio_dev, | |||
70 | vel = (((s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4); | 70 | vel = (((s16)(st->rx[0])) << 4) | ((st->rx[1] & 0xF0) >> 4); |
71 | vel = (vel << 4) >> 4; | 71 | vel = (vel << 4) >> 4; |
72 | *val = vel; | 72 | *val = vel; |
73 | break; | ||
73 | default: | 74 | default: |
74 | mutex_unlock(&st->lock); | 75 | mutex_unlock(&st->lock); |
75 | return -EINVAL; | 76 | return -EINVAL; |
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 81f909c2101f..0e1bf8858431 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -1520,7 +1520,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) | |||
1520 | status = serial8250_rx_chars(up, status); | 1520 | status = serial8250_rx_chars(up, status); |
1521 | } | 1521 | } |
1522 | serial8250_modem_status(up); | 1522 | serial8250_modem_status(up); |
1523 | if (status & UART_LSR_THRE) | 1523 | if (!up->dma && (status & UART_LSR_THRE)) |
1524 | serial8250_tx_chars(up); | 1524 | serial8250_tx_chars(up); |
1525 | 1525 | ||
1526 | spin_unlock_irqrestore(&port->lock, flags); | 1526 | spin_unlock_irqrestore(&port->lock, flags); |
diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c index 7046769608d4..ab9096dc3849 100644 --- a/drivers/tty/serial/8250/8250_dma.c +++ b/drivers/tty/serial/8250/8250_dma.c | |||
@@ -20,12 +20,15 @@ static void __dma_tx_complete(void *param) | |||
20 | struct uart_8250_port *p = param; | 20 | struct uart_8250_port *p = param; |
21 | struct uart_8250_dma *dma = p->dma; | 21 | struct uart_8250_dma *dma = p->dma; |
22 | struct circ_buf *xmit = &p->port.state->xmit; | 22 | struct circ_buf *xmit = &p->port.state->xmit; |
23 | 23 | unsigned long flags; | |
24 | dma->tx_running = 0; | ||
25 | 24 | ||
26 | dma_sync_single_for_cpu(dma->txchan->device->dev, dma->tx_addr, | 25 | dma_sync_single_for_cpu(dma->txchan->device->dev, dma->tx_addr, |
27 | UART_XMIT_SIZE, DMA_TO_DEVICE); | 26 | UART_XMIT_SIZE, DMA_TO_DEVICE); |
28 | 27 | ||
28 | spin_lock_irqsave(&p->port.lock, flags); | ||
29 | |||
30 | dma->tx_running = 0; | ||
31 | |||
29 | xmit->tail += dma->tx_size; | 32 | xmit->tail += dma->tx_size; |
30 | xmit->tail &= UART_XMIT_SIZE - 1; | 33 | xmit->tail &= UART_XMIT_SIZE - 1; |
31 | p->port.icount.tx += dma->tx_size; | 34 | p->port.icount.tx += dma->tx_size; |
@@ -35,6 +38,8 @@ static void __dma_tx_complete(void *param) | |||
35 | 38 | ||
36 | if (!uart_circ_empty(xmit) && !uart_tx_stopped(&p->port)) | 39 | if (!uart_circ_empty(xmit) && !uart_tx_stopped(&p->port)) |
37 | serial8250_tx_dma(p); | 40 | serial8250_tx_dma(p); |
41 | |||
42 | spin_unlock_irqrestore(&p->port.lock, flags); | ||
38 | } | 43 | } |
39 | 44 | ||
40 | static void __dma_rx_complete(void *param) | 45 | static void __dma_rx_complete(void *param) |
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index 23f459600738..1f5505e7f90d 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -1446,8 +1446,8 @@ static int s3c24xx_serial_get_poll_char(struct uart_port *port) | |||
1446 | static void s3c24xx_serial_put_poll_char(struct uart_port *port, | 1446 | static void s3c24xx_serial_put_poll_char(struct uart_port *port, |
1447 | unsigned char c) | 1447 | unsigned char c) |
1448 | { | 1448 | { |
1449 | unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON); | 1449 | unsigned int ufcon = rd_regl(port, S3C2410_UFCON); |
1450 | unsigned int ucon = rd_regl(cons_uart, S3C2410_UCON); | 1450 | unsigned int ucon = rd_regl(port, S3C2410_UCON); |
1451 | 1451 | ||
1452 | /* not possible to xmit on unconfigured port */ | 1452 | /* not possible to xmit on unconfigured port */ |
1453 | if (!s3c24xx_port_configured(ucon)) | 1453 | if (!s3c24xx_port_configured(ucon)) |
@@ -1455,7 +1455,7 @@ static void s3c24xx_serial_put_poll_char(struct uart_port *port, | |||
1455 | 1455 | ||
1456 | while (!s3c24xx_serial_console_txrdy(port, ufcon)) | 1456 | while (!s3c24xx_serial_console_txrdy(port, ufcon)) |
1457 | cpu_relax(); | 1457 | cpu_relax(); |
1458 | wr_regb(cons_uart, S3C2410_UTXH, c); | 1458 | wr_regb(port, S3C2410_UTXH, c); |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | #endif /* CONFIG_CONSOLE_POLL */ | 1461 | #endif /* CONFIG_CONSOLE_POLL */ |
@@ -1463,22 +1463,23 @@ static void s3c24xx_serial_put_poll_char(struct uart_port *port, | |||
1463 | static void | 1463 | static void |
1464 | s3c24xx_serial_console_putchar(struct uart_port *port, int ch) | 1464 | s3c24xx_serial_console_putchar(struct uart_port *port, int ch) |
1465 | { | 1465 | { |
1466 | unsigned int ufcon = rd_regl(cons_uart, S3C2410_UFCON); | 1466 | unsigned int ufcon = rd_regl(port, S3C2410_UFCON); |
1467 | unsigned int ucon = rd_regl(cons_uart, S3C2410_UCON); | ||
1468 | |||
1469 | /* not possible to xmit on unconfigured port */ | ||
1470 | if (!s3c24xx_port_configured(ucon)) | ||
1471 | return; | ||
1472 | 1467 | ||
1473 | while (!s3c24xx_serial_console_txrdy(port, ufcon)) | 1468 | while (!s3c24xx_serial_console_txrdy(port, ufcon)) |
1474 | barrier(); | 1469 | cpu_relax(); |
1475 | wr_regb(cons_uart, S3C2410_UTXH, ch); | 1470 | wr_regb(port, S3C2410_UTXH, ch); |
1476 | } | 1471 | } |
1477 | 1472 | ||
1478 | static void | 1473 | static void |
1479 | s3c24xx_serial_console_write(struct console *co, const char *s, | 1474 | s3c24xx_serial_console_write(struct console *co, const char *s, |
1480 | unsigned int count) | 1475 | unsigned int count) |
1481 | { | 1476 | { |
1477 | unsigned int ucon = rd_regl(cons_uart, S3C2410_UCON); | ||
1478 | |||
1479 | /* not possible to xmit on unconfigured port */ | ||
1480 | if (!s3c24xx_port_configured(ucon)) | ||
1481 | return; | ||
1482 | |||
1482 | uart_console_write(cons_uart, s, count, s3c24xx_serial_console_putchar); | 1483 | uart_console_write(cons_uart, s, count, s3c24xx_serial_console_putchar); |
1483 | } | 1484 | } |
1484 | 1485 | ||
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index f26834d262b3..b68550d95a40 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -137,6 +137,11 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, | |||
137 | return 1; | 137 | return 1; |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * Make sure the device is in D0 state. | ||
141 | */ | ||
142 | uart_change_pm(state, UART_PM_STATE_ON); | ||
143 | |||
144 | /* | ||
140 | * Initialise and allocate the transmit and temporary | 145 | * Initialise and allocate the transmit and temporary |
141 | * buffer. | 146 | * buffer. |
142 | */ | 147 | */ |
@@ -825,25 +830,29 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port, | |||
825 | * If we fail to request resources for the | 830 | * If we fail to request resources for the |
826 | * new port, try to restore the old settings. | 831 | * new port, try to restore the old settings. |
827 | */ | 832 | */ |
828 | if (retval && old_type != PORT_UNKNOWN) { | 833 | if (retval) { |
829 | uport->iobase = old_iobase; | 834 | uport->iobase = old_iobase; |
830 | uport->type = old_type; | 835 | uport->type = old_type; |
831 | uport->hub6 = old_hub6; | 836 | uport->hub6 = old_hub6; |
832 | uport->iotype = old_iotype; | 837 | uport->iotype = old_iotype; |
833 | uport->regshift = old_shift; | 838 | uport->regshift = old_shift; |
834 | uport->mapbase = old_mapbase; | 839 | uport->mapbase = old_mapbase; |
835 | retval = uport->ops->request_port(uport); | ||
836 | /* | ||
837 | * If we failed to restore the old settings, | ||
838 | * we fail like this. | ||
839 | */ | ||
840 | if (retval) | ||
841 | uport->type = PORT_UNKNOWN; | ||
842 | 840 | ||
843 | /* | 841 | if (old_type != PORT_UNKNOWN) { |
844 | * We failed anyway. | 842 | retval = uport->ops->request_port(uport); |
845 | */ | 843 | /* |
846 | retval = -EBUSY; | 844 | * If we failed to restore the old settings, |
845 | * we fail like this. | ||
846 | */ | ||
847 | if (retval) | ||
848 | uport->type = PORT_UNKNOWN; | ||
849 | |||
850 | /* | ||
851 | * We failed anyway. | ||
852 | */ | ||
853 | retval = -EBUSY; | ||
854 | } | ||
855 | |||
847 | /* Added to return the correct error -Ram Gupta */ | 856 | /* Added to return the correct error -Ram Gupta */ |
848 | goto exit; | 857 | goto exit; |
849 | } | 858 | } |
@@ -1571,12 +1580,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1571 | } | 1580 | } |
1572 | 1581 | ||
1573 | /* | 1582 | /* |
1574 | * Make sure the device is in D0 state. | ||
1575 | */ | ||
1576 | if (port->count == 1) | ||
1577 | uart_change_pm(state, UART_PM_STATE_ON); | ||
1578 | |||
1579 | /* | ||
1580 | * Start up the serial port. | 1583 | * Start up the serial port. |
1581 | */ | 1584 | */ |
1582 | retval = uart_startup(tty, state, 0); | 1585 | retval = uart_startup(tty, state, 0); |
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index 8ebd9f88a6f6..f1d30f6945af 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c | |||
@@ -255,11 +255,16 @@ static int __tty_buffer_request_room(struct tty_port *port, size_t size, | |||
255 | if (change || left < size) { | 255 | if (change || left < size) { |
256 | /* This is the slow path - looking for new buffers to use */ | 256 | /* This is the slow path - looking for new buffers to use */ |
257 | if ((n = tty_buffer_alloc(port, size)) != NULL) { | 257 | if ((n = tty_buffer_alloc(port, size)) != NULL) { |
258 | unsigned long iflags; | ||
259 | |||
258 | n->flags = flags; | 260 | n->flags = flags; |
259 | buf->tail = n; | 261 | buf->tail = n; |
262 | |||
263 | spin_lock_irqsave(&buf->flush_lock, iflags); | ||
260 | b->commit = b->used; | 264 | b->commit = b->used; |
261 | smp_mb(); | ||
262 | b->next = n; | 265 | b->next = n; |
266 | spin_unlock_irqrestore(&buf->flush_lock, iflags); | ||
267 | |||
263 | } else if (change) | 268 | } else if (change) |
264 | size = 0; | 269 | size = 0; |
265 | else | 270 | else |
@@ -443,6 +448,7 @@ static void flush_to_ldisc(struct work_struct *work) | |||
443 | mutex_lock(&buf->lock); | 448 | mutex_lock(&buf->lock); |
444 | 449 | ||
445 | while (1) { | 450 | while (1) { |
451 | unsigned long flags; | ||
446 | struct tty_buffer *head = buf->head; | 452 | struct tty_buffer *head = buf->head; |
447 | int count; | 453 | int count; |
448 | 454 | ||
@@ -450,14 +456,19 @@ static void flush_to_ldisc(struct work_struct *work) | |||
450 | if (atomic_read(&buf->priority)) | 456 | if (atomic_read(&buf->priority)) |
451 | break; | 457 | break; |
452 | 458 | ||
459 | spin_lock_irqsave(&buf->flush_lock, flags); | ||
453 | count = head->commit - head->read; | 460 | count = head->commit - head->read; |
454 | if (!count) { | 461 | if (!count) { |
455 | if (head->next == NULL) | 462 | if (head->next == NULL) { |
463 | spin_unlock_irqrestore(&buf->flush_lock, flags); | ||
456 | break; | 464 | break; |
465 | } | ||
457 | buf->head = head->next; | 466 | buf->head = head->next; |
467 | spin_unlock_irqrestore(&buf->flush_lock, flags); | ||
458 | tty_buffer_free(port, head); | 468 | tty_buffer_free(port, head); |
459 | continue; | 469 | continue; |
460 | } | 470 | } |
471 | spin_unlock_irqrestore(&buf->flush_lock, flags); | ||
461 | 472 | ||
462 | count = receive_buf(tty, head, count); | 473 | count = receive_buf(tty, head, count); |
463 | if (!count) | 474 | if (!count) |
@@ -512,6 +523,7 @@ void tty_buffer_init(struct tty_port *port) | |||
512 | struct tty_bufhead *buf = &port->buf; | 523 | struct tty_bufhead *buf = &port->buf; |
513 | 524 | ||
514 | mutex_init(&buf->lock); | 525 | mutex_init(&buf->lock); |
526 | spin_lock_init(&buf->flush_lock); | ||
515 | tty_buffer_reset(&buf->sentinel, 0); | 527 | tty_buffer_reset(&buf->sentinel, 0); |
516 | buf->head = &buf->sentinel; | 528 | buf->head = &buf->sentinel; |
517 | buf->tail = &buf->sentinel; | 529 | buf->tail = &buf->sentinel; |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ca6831c5b763..1cd5d0ba587c 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -277,6 +277,39 @@ static void hw_phymode_configure(struct ci_hdrc *ci) | |||
277 | } | 277 | } |
278 | 278 | ||
279 | /** | 279 | /** |
280 | * ci_usb_phy_init: initialize phy according to different phy type | ||
281 | * @ci: the controller | ||
282 | * | ||
283 | * This function returns an error code if usb_phy_init has failed | ||
284 | */ | ||
285 | static int ci_usb_phy_init(struct ci_hdrc *ci) | ||
286 | { | ||
287 | int ret; | ||
288 | |||
289 | switch (ci->platdata->phy_mode) { | ||
290 | case USBPHY_INTERFACE_MODE_UTMI: | ||
291 | case USBPHY_INTERFACE_MODE_UTMIW: | ||
292 | case USBPHY_INTERFACE_MODE_HSIC: | ||
293 | ret = usb_phy_init(ci->transceiver); | ||
294 | if (ret) | ||
295 | return ret; | ||
296 | hw_phymode_configure(ci); | ||
297 | break; | ||
298 | case USBPHY_INTERFACE_MODE_ULPI: | ||
299 | case USBPHY_INTERFACE_MODE_SERIAL: | ||
300 | hw_phymode_configure(ci); | ||
301 | ret = usb_phy_init(ci->transceiver); | ||
302 | if (ret) | ||
303 | return ret; | ||
304 | break; | ||
305 | default: | ||
306 | ret = usb_phy_init(ci->transceiver); | ||
307 | } | ||
308 | |||
309 | return ret; | ||
310 | } | ||
311 | |||
312 | /** | ||
280 | * hw_device_reset: resets chip (execute without interruption) | 313 | * hw_device_reset: resets chip (execute without interruption) |
281 | * @ci: the controller | 314 | * @ci: the controller |
282 | * | 315 | * |
@@ -543,8 +576,6 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
543 | return -ENODEV; | 576 | return -ENODEV; |
544 | } | 577 | } |
545 | 578 | ||
546 | hw_phymode_configure(ci); | ||
547 | |||
548 | if (ci->platdata->phy) | 579 | if (ci->platdata->phy) |
549 | ci->transceiver = ci->platdata->phy; | 580 | ci->transceiver = ci->platdata->phy; |
550 | else | 581 | else |
@@ -564,7 +595,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
564 | return -EPROBE_DEFER; | 595 | return -EPROBE_DEFER; |
565 | } | 596 | } |
566 | 597 | ||
567 | ret = usb_phy_init(ci->transceiver); | 598 | ret = ci_usb_phy_init(ci); |
568 | if (ret) { | 599 | if (ret) { |
569 | dev_err(dev, "unable to init phy: %d\n", ret); | 600 | dev_err(dev, "unable to init phy: %d\n", ret); |
570 | return ret; | 601 | return ret; |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index d001417e8e37..10aaaae9af25 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -821,6 +821,7 @@ static void dwc3_complete(struct device *dev) | |||
821 | 821 | ||
822 | spin_lock_irqsave(&dwc->lock, flags); | 822 | spin_lock_irqsave(&dwc->lock, flags); |
823 | 823 | ||
824 | dwc3_event_buffers_setup(dwc); | ||
824 | switch (dwc->dr_mode) { | 825 | switch (dwc->dr_mode) { |
825 | case USB_DR_MODE_PERIPHERAL: | 826 | case USB_DR_MODE_PERIPHERAL: |
826 | case USB_DR_MODE_OTG: | 827 | case USB_DR_MODE_OTG: |
@@ -828,7 +829,6 @@ static void dwc3_complete(struct device *dev) | |||
828 | /* FALLTHROUGH */ | 829 | /* FALLTHROUGH */ |
829 | case USB_DR_MODE_HOST: | 830 | case USB_DR_MODE_HOST: |
830 | default: | 831 | default: |
831 | dwc3_event_buffers_setup(dwc); | ||
832 | break; | 832 | break; |
833 | } | 833 | } |
834 | 834 | ||
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index a740eac74d56..70715eeededd 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -187,15 +187,12 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc) | |||
187 | * improve this algorithm so that we better use the internal | 187 | * improve this algorithm so that we better use the internal |
188 | * FIFO space | 188 | * FIFO space |
189 | */ | 189 | */ |
190 | for (num = 0; num < DWC3_ENDPOINTS_NUM; num++) { | 190 | for (num = 0; num < dwc->num_in_eps; num++) { |
191 | struct dwc3_ep *dep = dwc->eps[num]; | 191 | /* bit0 indicates direction; 1 means IN ep */ |
192 | int fifo_number = dep->number >> 1; | 192 | struct dwc3_ep *dep = dwc->eps[(num << 1) | 1]; |
193 | int mult = 1; | 193 | int mult = 1; |
194 | int tmp; | 194 | int tmp; |
195 | 195 | ||
196 | if (!(dep->number & 1)) | ||
197 | continue; | ||
198 | |||
199 | if (!(dep->flags & DWC3_EP_ENABLED)) | 196 | if (!(dep->flags & DWC3_EP_ENABLED)) |
200 | continue; | 197 | continue; |
201 | 198 | ||
@@ -224,8 +221,7 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc) | |||
224 | dev_vdbg(dwc->dev, "%s: Fifo Addr %04x Size %d\n", | 221 | dev_vdbg(dwc->dev, "%s: Fifo Addr %04x Size %d\n", |
225 | dep->name, last_fifo_depth, fifo_size & 0xffff); | 222 | dep->name, last_fifo_depth, fifo_size & 0xffff); |
226 | 223 | ||
227 | dwc3_writel(dwc->regs, DWC3_GTXFIFOSIZ(fifo_number), | 224 | dwc3_writel(dwc->regs, DWC3_GTXFIFOSIZ(num), fifo_size); |
228 | fifo_size); | ||
229 | 225 | ||
230 | last_fifo_depth += (fifo_size & 0xffff); | 226 | last_fifo_depth += (fifo_size & 0xffff); |
231 | } | 227 | } |
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 2e164dca08e8..1e12b3ee56fd 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -745,6 +745,12 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
745 | */ | 745 | */ |
746 | struct usb_gadget *gadget = epfile->ffs->gadget; | 746 | struct usb_gadget *gadget = epfile->ffs->gadget; |
747 | 747 | ||
748 | spin_lock_irq(&epfile->ffs->eps_lock); | ||
749 | /* In the meantime, endpoint got disabled or changed. */ | ||
750 | if (epfile->ep != ep) { | ||
751 | spin_unlock_irq(&epfile->ffs->eps_lock); | ||
752 | return -ESHUTDOWN; | ||
753 | } | ||
748 | /* | 754 | /* |
749 | * Controller may require buffer size to be aligned to | 755 | * Controller may require buffer size to be aligned to |
750 | * maxpacketsize of an out endpoint. | 756 | * maxpacketsize of an out endpoint. |
@@ -752,6 +758,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
752 | data_len = io_data->read ? | 758 | data_len = io_data->read ? |
753 | usb_ep_align_maybe(gadget, ep->ep, io_data->len) : | 759 | usb_ep_align_maybe(gadget, ep->ep, io_data->len) : |
754 | io_data->len; | 760 | io_data->len; |
761 | spin_unlock_irq(&epfile->ffs->eps_lock); | ||
755 | 762 | ||
756 | data = kmalloc(data_len, GFP_KERNEL); | 763 | data = kmalloc(data_len, GFP_KERNEL); |
757 | if (unlikely(!data)) | 764 | if (unlikely(!data)) |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index c11761ce5113..9a4f49dc6ac4 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -377,7 +377,7 @@ static struct sk_buff *rndis_add_header(struct gether *port, | |||
377 | if (skb2) | 377 | if (skb2) |
378 | rndis_add_hdr(skb2); | 378 | rndis_add_hdr(skb2); |
379 | 379 | ||
380 | dev_kfree_skb_any(skb); | 380 | dev_kfree_skb(skb); |
381 | return skb2; | 381 | return skb2; |
382 | } | 382 | } |
383 | 383 | ||
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 15960af0f67e..a2f26cdb56fe 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -1219,6 +1219,10 @@ static int fsl_pullup(struct usb_gadget *gadget, int is_on) | |||
1219 | struct fsl_udc *udc; | 1219 | struct fsl_udc *udc; |
1220 | 1220 | ||
1221 | udc = container_of(gadget, struct fsl_udc, gadget); | 1221 | udc = container_of(gadget, struct fsl_udc, gadget); |
1222 | |||
1223 | if (!udc->vbus_active) | ||
1224 | return -EOPNOTSUPP; | ||
1225 | |||
1222 | udc->softconnect = (is_on != 0); | 1226 | udc->softconnect = (is_on != 0); |
1223 | if (can_pullup(udc)) | 1227 | if (can_pullup(udc)) |
1224 | fsl_writel((fsl_readl(&dr_regs->usbcmd) | USB_CMD_RUN_STOP), | 1228 | fsl_writel((fsl_readl(&dr_regs->usbcmd) | USB_CMD_RUN_STOP), |
@@ -2532,8 +2536,8 @@ static int __exit fsl_udc_remove(struct platform_device *pdev) | |||
2532 | if (!udc_controller) | 2536 | if (!udc_controller) |
2533 | return -ENODEV; | 2537 | return -ENODEV; |
2534 | 2538 | ||
2535 | usb_del_gadget_udc(&udc_controller->gadget); | ||
2536 | udc_controller->done = &done; | 2539 | udc_controller->done = &done; |
2540 | usb_del_gadget_udc(&udc_controller->gadget); | ||
2537 | 2541 | ||
2538 | fsl_udc_clk_release(); | 2542 | fsl_udc_clk_release(); |
2539 | 2543 | ||
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index b5be6f0308c2..a925d0cbcd41 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -2043,6 +2043,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) | |||
2043 | return -ESRCH; | 2043 | return -ESRCH; |
2044 | 2044 | ||
2045 | /* fake probe to determine $CHIP */ | 2045 | /* fake probe to determine $CHIP */ |
2046 | CHIP = NULL; | ||
2046 | usb_gadget_probe_driver(&probe_driver); | 2047 | usb_gadget_probe_driver(&probe_driver); |
2047 | if (!CHIP) | 2048 | if (!CHIP) |
2048 | return -ENODEV; | 2049 | return -ENODEV; |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index d822d822efb3..7ed452d90f4d 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/byteorder.h> | 35 | #include <asm/byteorder.h> |
36 | #include <asm/unaligned.h> | 36 | #include <asm/unaligned.h> |
37 | 37 | ||
38 | #include "u_rndis.h" | ||
38 | 39 | ||
39 | #undef VERBOSE_DEBUG | 40 | #undef VERBOSE_DEBUG |
40 | 41 | ||
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 50d09c289137..b7d4f82872b7 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -48,8 +48,6 @@ | |||
48 | 48 | ||
49 | #define UETH__VERSION "29-May-2008" | 49 | #define UETH__VERSION "29-May-2008" |
50 | 50 | ||
51 | #define GETHER_NAPI_WEIGHT 32 | ||
52 | |||
53 | struct eth_dev { | 51 | struct eth_dev { |
54 | /* lock is held while accessing port_usb | 52 | /* lock is held while accessing port_usb |
55 | */ | 53 | */ |
@@ -74,7 +72,6 @@ struct eth_dev { | |||
74 | struct sk_buff_head *list); | 72 | struct sk_buff_head *list); |
75 | 73 | ||
76 | struct work_struct work; | 74 | struct work_struct work; |
77 | struct napi_struct rx_napi; | ||
78 | 75 | ||
79 | unsigned long todo; | 76 | unsigned long todo; |
80 | #define WORK_RX_MEMORY 0 | 77 | #define WORK_RX_MEMORY 0 |
@@ -256,16 +253,18 @@ enomem: | |||
256 | DBG(dev, "rx submit --> %d\n", retval); | 253 | DBG(dev, "rx submit --> %d\n", retval); |
257 | if (skb) | 254 | if (skb) |
258 | dev_kfree_skb_any(skb); | 255 | dev_kfree_skb_any(skb); |
256 | spin_lock_irqsave(&dev->req_lock, flags); | ||
257 | list_add(&req->list, &dev->rx_reqs); | ||
258 | spin_unlock_irqrestore(&dev->req_lock, flags); | ||
259 | } | 259 | } |
260 | return retval; | 260 | return retval; |
261 | } | 261 | } |
262 | 262 | ||
263 | static void rx_complete(struct usb_ep *ep, struct usb_request *req) | 263 | static void rx_complete(struct usb_ep *ep, struct usb_request *req) |
264 | { | 264 | { |
265 | struct sk_buff *skb = req->context; | 265 | struct sk_buff *skb = req->context, *skb2; |
266 | struct eth_dev *dev = ep->driver_data; | 266 | struct eth_dev *dev = ep->driver_data; |
267 | int status = req->status; | 267 | int status = req->status; |
268 | bool rx_queue = 0; | ||
269 | 268 | ||
270 | switch (status) { | 269 | switch (status) { |
271 | 270 | ||
@@ -289,8 +288,30 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req) | |||
289 | } else { | 288 | } else { |
290 | skb_queue_tail(&dev->rx_frames, skb); | 289 | skb_queue_tail(&dev->rx_frames, skb); |
291 | } | 290 | } |
292 | if (!status) | 291 | skb = NULL; |
293 | rx_queue = 1; | 292 | |
293 | skb2 = skb_dequeue(&dev->rx_frames); | ||
294 | while (skb2) { | ||
295 | if (status < 0 | ||
296 | || ETH_HLEN > skb2->len | ||
297 | || skb2->len > VLAN_ETH_FRAME_LEN) { | ||
298 | dev->net->stats.rx_errors++; | ||
299 | dev->net->stats.rx_length_errors++; | ||
300 | DBG(dev, "rx length %d\n", skb2->len); | ||
301 | dev_kfree_skb_any(skb2); | ||
302 | goto next_frame; | ||
303 | } | ||
304 | skb2->protocol = eth_type_trans(skb2, dev->net); | ||
305 | dev->net->stats.rx_packets++; | ||
306 | dev->net->stats.rx_bytes += skb2->len; | ||
307 | |||
308 | /* no buffer copies needed, unless hardware can't | ||
309 | * use skb buffers. | ||
310 | */ | ||
311 | status = netif_rx(skb2); | ||
312 | next_frame: | ||
313 | skb2 = skb_dequeue(&dev->rx_frames); | ||
314 | } | ||
294 | break; | 315 | break; |
295 | 316 | ||
296 | /* software-driven interface shutdown */ | 317 | /* software-driven interface shutdown */ |
@@ -313,20 +334,22 @@ quiesce: | |||
313 | /* FALLTHROUGH */ | 334 | /* FALLTHROUGH */ |
314 | 335 | ||
315 | default: | 336 | default: |
316 | rx_queue = 1; | ||
317 | dev_kfree_skb_any(skb); | ||
318 | dev->net->stats.rx_errors++; | 337 | dev->net->stats.rx_errors++; |
319 | DBG(dev, "rx status %d\n", status); | 338 | DBG(dev, "rx status %d\n", status); |
320 | break; | 339 | break; |
321 | } | 340 | } |
322 | 341 | ||
342 | if (skb) | ||
343 | dev_kfree_skb_any(skb); | ||
344 | if (!netif_running(dev->net)) { | ||
323 | clean: | 345 | clean: |
324 | spin_lock(&dev->req_lock); | 346 | spin_lock(&dev->req_lock); |
325 | list_add(&req->list, &dev->rx_reqs); | 347 | list_add(&req->list, &dev->rx_reqs); |
326 | spin_unlock(&dev->req_lock); | 348 | spin_unlock(&dev->req_lock); |
327 | 349 | req = NULL; | |
328 | if (rx_queue && likely(napi_schedule_prep(&dev->rx_napi))) | 350 | } |
329 | __napi_schedule(&dev->rx_napi); | 351 | if (req) |
352 | rx_submit(dev, req, GFP_ATOMIC); | ||
330 | } | 353 | } |
331 | 354 | ||
332 | static int prealloc(struct list_head *list, struct usb_ep *ep, unsigned n) | 355 | static int prealloc(struct list_head *list, struct usb_ep *ep, unsigned n) |
@@ -391,24 +414,16 @@ static void rx_fill(struct eth_dev *dev, gfp_t gfp_flags) | |||
391 | { | 414 | { |
392 | struct usb_request *req; | 415 | struct usb_request *req; |
393 | unsigned long flags; | 416 | unsigned long flags; |
394 | int rx_counts = 0; | ||
395 | 417 | ||
396 | /* fill unused rxq slots with some skb */ | 418 | /* fill unused rxq slots with some skb */ |
397 | spin_lock_irqsave(&dev->req_lock, flags); | 419 | spin_lock_irqsave(&dev->req_lock, flags); |
398 | while (!list_empty(&dev->rx_reqs)) { | 420 | while (!list_empty(&dev->rx_reqs)) { |
399 | |||
400 | if (++rx_counts > qlen(dev->gadget, dev->qmult)) | ||
401 | break; | ||
402 | |||
403 | req = container_of(dev->rx_reqs.next, | 421 | req = container_of(dev->rx_reqs.next, |
404 | struct usb_request, list); | 422 | struct usb_request, list); |
405 | list_del_init(&req->list); | 423 | list_del_init(&req->list); |
406 | spin_unlock_irqrestore(&dev->req_lock, flags); | 424 | spin_unlock_irqrestore(&dev->req_lock, flags); |
407 | 425 | ||
408 | if (rx_submit(dev, req, gfp_flags) < 0) { | 426 | if (rx_submit(dev, req, gfp_flags) < 0) { |
409 | spin_lock_irqsave(&dev->req_lock, flags); | ||
410 | list_add(&req->list, &dev->rx_reqs); | ||
411 | spin_unlock_irqrestore(&dev->req_lock, flags); | ||
412 | defer_kevent(dev, WORK_RX_MEMORY); | 427 | defer_kevent(dev, WORK_RX_MEMORY); |
413 | return; | 428 | return; |
414 | } | 429 | } |
@@ -418,41 +433,6 @@ static void rx_fill(struct eth_dev *dev, gfp_t gfp_flags) | |||
418 | spin_unlock_irqrestore(&dev->req_lock, flags); | 433 | spin_unlock_irqrestore(&dev->req_lock, flags); |
419 | } | 434 | } |
420 | 435 | ||
421 | static int gether_poll(struct napi_struct *napi, int budget) | ||
422 | { | ||
423 | struct eth_dev *dev = container_of(napi, struct eth_dev, rx_napi); | ||
424 | struct sk_buff *skb; | ||
425 | unsigned int work_done = 0; | ||
426 | int status = 0; | ||
427 | |||
428 | while ((skb = skb_dequeue(&dev->rx_frames))) { | ||
429 | if (status < 0 | ||
430 | || ETH_HLEN > skb->len | ||
431 | || skb->len > VLAN_ETH_FRAME_LEN) { | ||
432 | dev->net->stats.rx_errors++; | ||
433 | dev->net->stats.rx_length_errors++; | ||
434 | DBG(dev, "rx length %d\n", skb->len); | ||
435 | dev_kfree_skb_any(skb); | ||
436 | continue; | ||
437 | } | ||
438 | skb->protocol = eth_type_trans(skb, dev->net); | ||
439 | dev->net->stats.rx_packets++; | ||
440 | dev->net->stats.rx_bytes += skb->len; | ||
441 | |||
442 | status = netif_rx_ni(skb); | ||
443 | } | ||
444 | |||
445 | if (netif_running(dev->net)) { | ||
446 | rx_fill(dev, GFP_KERNEL); | ||
447 | work_done++; | ||
448 | } | ||
449 | |||
450 | if (work_done < budget) | ||
451 | napi_complete(&dev->rx_napi); | ||
452 | |||
453 | return work_done; | ||
454 | } | ||
455 | |||
456 | static void eth_work(struct work_struct *work) | 436 | static void eth_work(struct work_struct *work) |
457 | { | 437 | { |
458 | struct eth_dev *dev = container_of(work, struct eth_dev, work); | 438 | struct eth_dev *dev = container_of(work, struct eth_dev, work); |
@@ -645,7 +625,6 @@ static void eth_start(struct eth_dev *dev, gfp_t gfp_flags) | |||
645 | /* and open the tx floodgates */ | 625 | /* and open the tx floodgates */ |
646 | atomic_set(&dev->tx_qlen, 0); | 626 | atomic_set(&dev->tx_qlen, 0); |
647 | netif_wake_queue(dev->net); | 627 | netif_wake_queue(dev->net); |
648 | napi_enable(&dev->rx_napi); | ||
649 | } | 628 | } |
650 | 629 | ||
651 | static int eth_open(struct net_device *net) | 630 | static int eth_open(struct net_device *net) |
@@ -672,7 +651,6 @@ static int eth_stop(struct net_device *net) | |||
672 | unsigned long flags; | 651 | unsigned long flags; |
673 | 652 | ||
674 | VDBG(dev, "%s\n", __func__); | 653 | VDBG(dev, "%s\n", __func__); |
675 | napi_disable(&dev->rx_napi); | ||
676 | netif_stop_queue(net); | 654 | netif_stop_queue(net); |
677 | 655 | ||
678 | DBG(dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld\n", | 656 | DBG(dev, "stop stats: rx/tx %ld/%ld, errs %ld/%ld\n", |
@@ -790,7 +768,6 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g, | |||
790 | return ERR_PTR(-ENOMEM); | 768 | return ERR_PTR(-ENOMEM); |
791 | 769 | ||
792 | dev = netdev_priv(net); | 770 | dev = netdev_priv(net); |
793 | netif_napi_add(net, &dev->rx_napi, gether_poll, GETHER_NAPI_WEIGHT); | ||
794 | spin_lock_init(&dev->lock); | 771 | spin_lock_init(&dev->lock); |
795 | spin_lock_init(&dev->req_lock); | 772 | spin_lock_init(&dev->req_lock); |
796 | INIT_WORK(&dev->work, eth_work); | 773 | INIT_WORK(&dev->work, eth_work); |
@@ -853,7 +830,6 @@ struct net_device *gether_setup_name_default(const char *netname) | |||
853 | return ERR_PTR(-ENOMEM); | 830 | return ERR_PTR(-ENOMEM); |
854 | 831 | ||
855 | dev = netdev_priv(net); | 832 | dev = netdev_priv(net); |
856 | netif_napi_add(net, &dev->rx_napi, gether_poll, GETHER_NAPI_WEIGHT); | ||
857 | spin_lock_init(&dev->lock); | 833 | spin_lock_init(&dev->lock); |
858 | spin_lock_init(&dev->req_lock); | 834 | spin_lock_init(&dev->req_lock); |
859 | INIT_WORK(&dev->work, eth_work); | 835 | INIT_WORK(&dev->work, eth_work); |
@@ -1137,7 +1113,6 @@ void gether_disconnect(struct gether *link) | |||
1137 | { | 1113 | { |
1138 | struct eth_dev *dev = link->ioport; | 1114 | struct eth_dev *dev = link->ioport; |
1139 | struct usb_request *req; | 1115 | struct usb_request *req; |
1140 | struct sk_buff *skb; | ||
1141 | 1116 | ||
1142 | WARN_ON(!dev); | 1117 | WARN_ON(!dev); |
1143 | if (!dev) | 1118 | if (!dev) |
@@ -1164,12 +1139,6 @@ void gether_disconnect(struct gether *link) | |||
1164 | spin_lock(&dev->req_lock); | 1139 | spin_lock(&dev->req_lock); |
1165 | } | 1140 | } |
1166 | spin_unlock(&dev->req_lock); | 1141 | spin_unlock(&dev->req_lock); |
1167 | |||
1168 | spin_lock(&dev->rx_frames.lock); | ||
1169 | while ((skb = __skb_dequeue(&dev->rx_frames))) | ||
1170 | dev_kfree_skb_any(skb); | ||
1171 | spin_unlock(&dev->rx_frames.lock); | ||
1172 | |||
1173 | link->in_ep->driver_data = NULL; | 1142 | link->in_ep->driver_data = NULL; |
1174 | link->in_ep->desc = NULL; | 1143 | link->in_ep->desc = NULL; |
1175 | 1144 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 9f170c53e3d9..134f354ede62 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -300,7 +300,7 @@ static int __init zero_bind(struct usb_composite_dev *cdev) | |||
300 | ss_opts->isoc_interval = gzero_options.isoc_interval; | 300 | ss_opts->isoc_interval = gzero_options.isoc_interval; |
301 | ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket; | 301 | ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket; |
302 | ss_opts->isoc_mult = gzero_options.isoc_mult; | 302 | ss_opts->isoc_mult = gzero_options.isoc_mult; |
303 | ss_opts->isoc_maxburst = gzero_options.isoc_maxpacket; | 303 | ss_opts->isoc_maxburst = gzero_options.isoc_maxburst; |
304 | ss_opts->bulk_buflen = gzero_options.bulk_buflen; | 304 | ss_opts->bulk_buflen = gzero_options.bulk_buflen; |
305 | 305 | ||
306 | func_ss = usb_get_function(func_inst_ss); | 306 | func_ss = usb_get_function(func_inst_ss); |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 47390e369cd4..35d447780707 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -134,6 +134,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
134 | */ | 134 | */ |
135 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP) | 135 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP) |
136 | xhci->quirks |= XHCI_SPURIOUS_WAKEUP; | 136 | xhci->quirks |= XHCI_SPURIOUS_WAKEUP; |
137 | |||
138 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | ||
137 | } | 139 | } |
138 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && | 140 | if (pdev->vendor == PCI_VENDOR_ID_ETRON && |
139 | pdev->device == PCI_DEVICE_ID_ASROCK_P67) { | 141 | pdev->device == PCI_DEVICE_ID_ASROCK_P67) { |
@@ -143,9 +145,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
143 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; | 145 | xhci->quirks |= XHCI_TRUST_TX_LENGTH; |
144 | } | 146 | } |
145 | if (pdev->vendor == PCI_VENDOR_ID_RENESAS && | 147 | if (pdev->vendor == PCI_VENDOR_ID_RENESAS && |
146 | pdev->device == 0x0015 && | 148 | pdev->device == 0x0015) |
147 | pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG && | ||
148 | pdev->subsystem_device == 0xc0cd) | ||
149 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 149 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
150 | if (pdev->vendor == PCI_VENDOR_ID_VIA) | 150 | if (pdev->vendor == PCI_VENDOR_ID_VIA) |
151 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 151 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 5f926bea5ab1..7a0e3c720c00 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -550,6 +550,7 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
550 | struct xhci_ring *ep_ring; | 550 | struct xhci_ring *ep_ring; |
551 | struct xhci_generic_trb *trb; | 551 | struct xhci_generic_trb *trb; |
552 | dma_addr_t addr; | 552 | dma_addr_t addr; |
553 | u64 hw_dequeue; | ||
553 | 554 | ||
554 | ep_ring = xhci_triad_to_transfer_ring(xhci, slot_id, | 555 | ep_ring = xhci_triad_to_transfer_ring(xhci, slot_id, |
555 | ep_index, stream_id); | 556 | ep_index, stream_id); |
@@ -559,16 +560,6 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
559 | stream_id); | 560 | stream_id); |
560 | return; | 561 | return; |
561 | } | 562 | } |
562 | state->new_cycle_state = 0; | ||
563 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | ||
564 | "Finding segment containing stopped TRB."); | ||
565 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, | ||
566 | dev->eps[ep_index].stopped_trb, | ||
567 | &state->new_cycle_state); | ||
568 | if (!state->new_deq_seg) { | ||
569 | WARN_ON(1); | ||
570 | return; | ||
571 | } | ||
572 | 563 | ||
573 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ | 564 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ |
574 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 565 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
@@ -577,46 +568,57 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
577 | if (ep->ep_state & EP_HAS_STREAMS) { | 568 | if (ep->ep_state & EP_HAS_STREAMS) { |
578 | struct xhci_stream_ctx *ctx = | 569 | struct xhci_stream_ctx *ctx = |
579 | &ep->stream_info->stream_ctx_array[stream_id]; | 570 | &ep->stream_info->stream_ctx_array[stream_id]; |
580 | state->new_cycle_state = 0x1 & le64_to_cpu(ctx->stream_ring); | 571 | hw_dequeue = le64_to_cpu(ctx->stream_ring); |
581 | } else { | 572 | } else { |
582 | struct xhci_ep_ctx *ep_ctx | 573 | struct xhci_ep_ctx *ep_ctx |
583 | = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); | 574 | = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); |
584 | state->new_cycle_state = 0x1 & le64_to_cpu(ep_ctx->deq); | 575 | hw_dequeue = le64_to_cpu(ep_ctx->deq); |
585 | } | 576 | } |
586 | 577 | ||
578 | /* Find virtual address and segment of hardware dequeue pointer */ | ||
579 | state->new_deq_seg = ep_ring->deq_seg; | ||
580 | state->new_deq_ptr = ep_ring->dequeue; | ||
581 | while (xhci_trb_virt_to_dma(state->new_deq_seg, state->new_deq_ptr) | ||
582 | != (dma_addr_t)(hw_dequeue & ~0xf)) { | ||
583 | next_trb(xhci, ep_ring, &state->new_deq_seg, | ||
584 | &state->new_deq_ptr); | ||
585 | if (state->new_deq_ptr == ep_ring->dequeue) { | ||
586 | WARN_ON(1); | ||
587 | return; | ||
588 | } | ||
589 | } | ||
590 | /* | ||
591 | * Find cycle state for last_trb, starting at old cycle state of | ||
592 | * hw_dequeue. If there is only one segment ring, find_trb_seg() will | ||
593 | * return immediately and cannot toggle the cycle state if this search | ||
594 | * wraps around, so add one more toggle manually in that case. | ||
595 | */ | ||
596 | state->new_cycle_state = hw_dequeue & 0x1; | ||
597 | if (ep_ring->first_seg == ep_ring->first_seg->next && | ||
598 | cur_td->last_trb < state->new_deq_ptr) | ||
599 | state->new_cycle_state ^= 0x1; | ||
600 | |||
587 | state->new_deq_ptr = cur_td->last_trb; | 601 | state->new_deq_ptr = cur_td->last_trb; |
588 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 602 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
589 | "Finding segment containing last TRB in TD."); | 603 | "Finding segment containing last TRB in TD."); |
590 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, | 604 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, |
591 | state->new_deq_ptr, | 605 | state->new_deq_ptr, &state->new_cycle_state); |
592 | &state->new_cycle_state); | ||
593 | if (!state->new_deq_seg) { | 606 | if (!state->new_deq_seg) { |
594 | WARN_ON(1); | 607 | WARN_ON(1); |
595 | return; | 608 | return; |
596 | } | 609 | } |
597 | 610 | ||
611 | /* Increment to find next TRB after last_trb. Cycle if appropriate. */ | ||
598 | trb = &state->new_deq_ptr->generic; | 612 | trb = &state->new_deq_ptr->generic; |
599 | if (TRB_TYPE_LINK_LE32(trb->field[3]) && | 613 | if (TRB_TYPE_LINK_LE32(trb->field[3]) && |
600 | (trb->field[3] & cpu_to_le32(LINK_TOGGLE))) | 614 | (trb->field[3] & cpu_to_le32(LINK_TOGGLE))) |
601 | state->new_cycle_state ^= 0x1; | 615 | state->new_cycle_state ^= 0x1; |
602 | next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr); | 616 | next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr); |
603 | 617 | ||
604 | /* | 618 | /* Don't update the ring cycle state for the producer (us). */ |
605 | * If there is only one segment in a ring, find_trb_seg()'s while loop | ||
606 | * will not run, and it will return before it has a chance to see if it | ||
607 | * needs to toggle the cycle bit. It can't tell if the stalled transfer | ||
608 | * ended just before the link TRB on a one-segment ring, or if the TD | ||
609 | * wrapped around the top of the ring, because it doesn't have the TD in | ||
610 | * question. Look for the one-segment case where stalled TRB's address | ||
611 | * is greater than the new dequeue pointer address. | ||
612 | */ | ||
613 | if (ep_ring->first_seg == ep_ring->first_seg->next && | ||
614 | state->new_deq_ptr < dev->eps[ep_index].stopped_trb) | ||
615 | state->new_cycle_state ^= 0x1; | ||
616 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 619 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
617 | "Cycle state = 0x%x", state->new_cycle_state); | 620 | "Cycle state = 0x%x", state->new_cycle_state); |
618 | 621 | ||
619 | /* Don't update the ring cycle state for the producer (us). */ | ||
620 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, | 622 | xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb, |
621 | "New dequeue segment = %p (virtual)", | 623 | "New dequeue segment = %p (virtual)", |
622 | state->new_deq_seg); | 624 | state->new_deq_seg); |
@@ -799,7 +801,6 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, | |||
799 | if (list_empty(&ep->cancelled_td_list)) { | 801 | if (list_empty(&ep->cancelled_td_list)) { |
800 | xhci_stop_watchdog_timer_in_irq(xhci, ep); | 802 | xhci_stop_watchdog_timer_in_irq(xhci, ep); |
801 | ep->stopped_td = NULL; | 803 | ep->stopped_td = NULL; |
802 | ep->stopped_trb = NULL; | ||
803 | ring_doorbell_for_active_rings(xhci, slot_id, ep_index); | 804 | ring_doorbell_for_active_rings(xhci, slot_id, ep_index); |
804 | return; | 805 | return; |
805 | } | 806 | } |
@@ -867,11 +868,9 @@ remove_finished_td: | |||
867 | ring_doorbell_for_active_rings(xhci, slot_id, ep_index); | 868 | ring_doorbell_for_active_rings(xhci, slot_id, ep_index); |
868 | } | 869 | } |
869 | 870 | ||
870 | /* Clear stopped_td and stopped_trb if endpoint is not halted */ | 871 | /* Clear stopped_td if endpoint is not halted */ |
871 | if (!(ep->ep_state & EP_HALTED)) { | 872 | if (!(ep->ep_state & EP_HALTED)) |
872 | ep->stopped_td = NULL; | 873 | ep->stopped_td = NULL; |
873 | ep->stopped_trb = NULL; | ||
874 | } | ||
875 | 874 | ||
876 | /* | 875 | /* |
877 | * Drop the lock and complete the URBs in the cancelled TD list. | 876 | * Drop the lock and complete the URBs in the cancelled TD list. |
@@ -1941,14 +1940,12 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci, | |||
1941 | struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index]; | 1940 | struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index]; |
1942 | ep->ep_state |= EP_HALTED; | 1941 | ep->ep_state |= EP_HALTED; |
1943 | ep->stopped_td = td; | 1942 | ep->stopped_td = td; |
1944 | ep->stopped_trb = event_trb; | ||
1945 | ep->stopped_stream = stream_id; | 1943 | ep->stopped_stream = stream_id; |
1946 | 1944 | ||
1947 | xhci_queue_reset_ep(xhci, slot_id, ep_index); | 1945 | xhci_queue_reset_ep(xhci, slot_id, ep_index); |
1948 | xhci_cleanup_stalled_ring(xhci, td->urb->dev, ep_index); | 1946 | xhci_cleanup_stalled_ring(xhci, td->urb->dev, ep_index); |
1949 | 1947 | ||
1950 | ep->stopped_td = NULL; | 1948 | ep->stopped_td = NULL; |
1951 | ep->stopped_trb = NULL; | ||
1952 | ep->stopped_stream = 0; | 1949 | ep->stopped_stream = 0; |
1953 | 1950 | ||
1954 | xhci_ring_cmd_db(xhci); | 1951 | xhci_ring_cmd_db(xhci); |
@@ -2030,7 +2027,6 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2030 | * the ring dequeue pointer or take this TD off any lists yet. | 2027 | * the ring dequeue pointer or take this TD off any lists yet. |
2031 | */ | 2028 | */ |
2032 | ep->stopped_td = td; | 2029 | ep->stopped_td = td; |
2033 | ep->stopped_trb = event_trb; | ||
2034 | return 0; | 2030 | return 0; |
2035 | } else { | 2031 | } else { |
2036 | if (trb_comp_code == COMP_STALL) { | 2032 | if (trb_comp_code == COMP_STALL) { |
@@ -2042,7 +2038,6 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, | |||
2042 | * USB class driver clear the stall later. | 2038 | * USB class driver clear the stall later. |
2043 | */ | 2039 | */ |
2044 | ep->stopped_td = td; | 2040 | ep->stopped_td = td; |
2045 | ep->stopped_trb = event_trb; | ||
2046 | ep->stopped_stream = ep_ring->stream_id; | 2041 | ep->stopped_stream = ep_ring->stream_id; |
2047 | } else if (xhci_requires_manual_halt_cleanup(xhci, | 2042 | } else if (xhci_requires_manual_halt_cleanup(xhci, |
2048 | ep_ctx, trb_comp_code)) { | 2043 | ep_ctx, trb_comp_code)) { |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 8fe4e124ddd4..300836972faa 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -408,16 +408,16 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd) | |||
408 | 408 | ||
409 | #else | 409 | #else |
410 | 410 | ||
411 | static int xhci_try_enable_msi(struct usb_hcd *hcd) | 411 | static inline int xhci_try_enable_msi(struct usb_hcd *hcd) |
412 | { | 412 | { |
413 | return 0; | 413 | return 0; |
414 | } | 414 | } |
415 | 415 | ||
416 | static void xhci_cleanup_msix(struct xhci_hcd *xhci) | 416 | static inline void xhci_cleanup_msix(struct xhci_hcd *xhci) |
417 | { | 417 | { |
418 | } | 418 | } |
419 | 419 | ||
420 | static void xhci_msix_sync_irqs(struct xhci_hcd *xhci) | 420 | static inline void xhci_msix_sync_irqs(struct xhci_hcd *xhci) |
421 | { | 421 | { |
422 | } | 422 | } |
423 | 423 | ||
@@ -2954,7 +2954,6 @@ void xhci_endpoint_reset(struct usb_hcd *hcd, | |||
2954 | xhci_ring_cmd_db(xhci); | 2954 | xhci_ring_cmd_db(xhci); |
2955 | } | 2955 | } |
2956 | virt_ep->stopped_td = NULL; | 2956 | virt_ep->stopped_td = NULL; |
2957 | virt_ep->stopped_trb = NULL; | ||
2958 | virt_ep->stopped_stream = 0; | 2957 | virt_ep->stopped_stream = 0; |
2959 | spin_unlock_irqrestore(&xhci->lock, flags); | 2958 | spin_unlock_irqrestore(&xhci->lock, flags); |
2960 | 2959 | ||
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index d280e9213d08..4746816aed3e 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -865,8 +865,6 @@ struct xhci_virt_ep { | |||
865 | #define EP_GETTING_NO_STREAMS (1 << 5) | 865 | #define EP_GETTING_NO_STREAMS (1 << 5) |
866 | /* ---- Related to URB cancellation ---- */ | 866 | /* ---- Related to URB cancellation ---- */ |
867 | struct list_head cancelled_td_list; | 867 | struct list_head cancelled_td_list; |
868 | /* The TRB that was last reported in a stopped endpoint ring */ | ||
869 | union xhci_trb *stopped_trb; | ||
870 | struct xhci_td *stopped_td; | 868 | struct xhci_td *stopped_td; |
871 | unsigned int stopped_stream; | 869 | unsigned int stopped_stream; |
872 | /* Watchdog timer for stop endpoint command to cancel URBs */ | 870 | /* Watchdog timer for stop endpoint command to cancel URBs */ |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 3372ded5def7..e2fd263585de 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -470,8 +470,9 @@ static int dsps_musb_exit(struct musb *musb) | |||
470 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); | 470 | struct dsps_glue *glue = dev_get_drvdata(dev->parent); |
471 | 471 | ||
472 | del_timer_sync(&glue->timer); | 472 | del_timer_sync(&glue->timer); |
473 | |||
474 | usb_phy_shutdown(musb->xceiv); | 473 | usb_phy_shutdown(musb->xceiv); |
474 | debugfs_remove_recursive(glue->dbgfs_root); | ||
475 | |||
475 | return 0; | 476 | return 0; |
476 | } | 477 | } |
477 | 478 | ||
@@ -708,8 +709,6 @@ static int dsps_remove(struct platform_device *pdev) | |||
708 | pm_runtime_put(&pdev->dev); | 709 | pm_runtime_put(&pdev->dev); |
709 | pm_runtime_disable(&pdev->dev); | 710 | pm_runtime_disable(&pdev->dev); |
710 | 711 | ||
711 | debugfs_remove_recursive(glue->dbgfs_root); | ||
712 | |||
713 | return 0; | 712 | return 0; |
714 | } | 713 | } |
715 | 714 | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index d341c149a2f9..d369bf1f3936 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -316,7 +316,13 @@ static void omap_musb_mailbox_work(struct work_struct *mailbox_work) | |||
316 | { | 316 | { |
317 | struct omap2430_glue *glue = container_of(mailbox_work, | 317 | struct omap2430_glue *glue = container_of(mailbox_work, |
318 | struct omap2430_glue, omap_musb_mailbox_work); | 318 | struct omap2430_glue, omap_musb_mailbox_work); |
319 | struct musb *musb = glue_to_musb(glue); | ||
320 | struct device *dev = musb->controller; | ||
321 | |||
322 | pm_runtime_get_sync(dev); | ||
319 | omap_musb_set_mailbox(glue); | 323 | omap_musb_set_mailbox(glue); |
324 | pm_runtime_mark_last_busy(dev); | ||
325 | pm_runtime_put_autosuspend(dev); | ||
320 | } | 326 | } |
321 | 327 | ||
322 | static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci) | 328 | static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci) |
@@ -416,6 +422,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
416 | omap_musb_set_mailbox(glue); | 422 | omap_musb_set_mailbox(glue); |
417 | 423 | ||
418 | phy_init(musb->phy); | 424 | phy_init(musb->phy); |
425 | phy_power_on(musb->phy); | ||
419 | 426 | ||
420 | pm_runtime_put_noidle(musb->controller); | 427 | pm_runtime_put_noidle(musb->controller); |
421 | return 0; | 428 | return 0; |
@@ -478,6 +485,7 @@ static int omap2430_musb_exit(struct musb *musb) | |||
478 | del_timer_sync(&musb_idle_timer); | 485 | del_timer_sync(&musb_idle_timer); |
479 | 486 | ||
480 | omap2430_low_level_exit(musb); | 487 | omap2430_low_level_exit(musb); |
488 | phy_power_off(musb->phy); | ||
481 | phy_exit(musb->phy); | 489 | phy_exit(musb->phy); |
482 | 490 | ||
483 | return 0; | 491 | return 0; |
diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index d75196ad5f2f..35b6083b7999 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include <linux/err.h> | 3 | #include <linux/err.h> |
4 | #include <linux/of.h> | 4 | #include <linux/of.h> |
5 | #include <linux/io.h> | 5 | #include <linux/io.h> |
6 | #include <linux/delay.h> | ||
6 | #include "am35x-phy-control.h" | 7 | #include "am35x-phy-control.h" |
7 | 8 | ||
8 | struct am335x_control_usb { | 9 | struct am335x_control_usb { |
@@ -86,6 +87,14 @@ static void am335x_phy_power(struct phy_control *phy_ctrl, u32 id, bool on) | |||
86 | } | 87 | } |
87 | 88 | ||
88 | writel(val, usb_ctrl->phy_reg + reg); | 89 | writel(val, usb_ctrl->phy_reg + reg); |
90 | |||
91 | /* | ||
92 | * Give the PHY ~1ms to complete the power up operation. | ||
93 | * Tests have shown unstable behaviour if other USB PHY related | ||
94 | * registers are written too shortly after such a transition. | ||
95 | */ | ||
96 | if (on) | ||
97 | mdelay(1); | ||
89 | } | 98 | } |
90 | 99 | ||
91 | static const struct phy_control ctrl_am335x = { | 100 | static const struct phy_control ctrl_am335x = { |
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c index 8afa813d690b..36b6bce33b20 100644 --- a/drivers/usb/phy/phy.c +++ b/drivers/usb/phy/phy.c | |||
@@ -132,6 +132,9 @@ struct usb_phy *usb_get_phy(enum usb_phy_type type) | |||
132 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { | 132 | if (IS_ERR(phy) || !try_module_get(phy->dev->driver->owner)) { |
133 | pr_debug("PHY: unable to find transceiver of type %s\n", | 133 | pr_debug("PHY: unable to find transceiver of type %s\n", |
134 | usb_phy_type_string(type)); | 134 | usb_phy_type_string(type)); |
135 | if (!IS_ERR(phy)) | ||
136 | phy = ERR_PTR(-ENODEV); | ||
137 | |||
135 | goto err0; | 138 | goto err0; |
136 | } | 139 | } |
137 | 140 | ||
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index a2db5be9c305..df90dae53eb9 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
30 | #include <linux/serial.h> | 30 | #include <linux/serial.h> |
31 | #include <linux/swab.h> | ||
31 | #include <linux/kfifo.h> | 32 | #include <linux/kfifo.h> |
32 | #include <linux/ioctl.h> | 33 | #include <linux/ioctl.h> |
33 | #include <linux/firmware.h> | 34 | #include <linux/firmware.h> |
@@ -280,7 +281,7 @@ static int read_download_mem(struct usb_device *dev, int start_address, | |||
280 | { | 281 | { |
281 | int status = 0; | 282 | int status = 0; |
282 | __u8 read_length; | 283 | __u8 read_length; |
283 | __be16 be_start_address; | 284 | u16 be_start_address; |
284 | 285 | ||
285 | dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, length); | 286 | dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, length); |
286 | 287 | ||
@@ -296,10 +297,14 @@ static int read_download_mem(struct usb_device *dev, int start_address, | |||
296 | if (read_length > 1) { | 297 | if (read_length > 1) { |
297 | dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, read_length); | 298 | dev_dbg(&dev->dev, "%s - @ %x for %d\n", __func__, start_address, read_length); |
298 | } | 299 | } |
299 | be_start_address = cpu_to_be16(start_address); | 300 | /* |
301 | * NOTE: Must use swab as wIndex is sent in little-endian | ||
302 | * byte order regardless of host byte order. | ||
303 | */ | ||
304 | be_start_address = swab16((u16)start_address); | ||
300 | status = ti_vread_sync(dev, UMPC_MEMORY_READ, | 305 | status = ti_vread_sync(dev, UMPC_MEMORY_READ, |
301 | (__u16)address_type, | 306 | (__u16)address_type, |
302 | (__force __u16)be_start_address, | 307 | be_start_address, |
303 | buffer, read_length); | 308 | buffer, read_length); |
304 | 309 | ||
305 | if (status) { | 310 | if (status) { |
@@ -394,7 +399,7 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
394 | struct device *dev = &serial->serial->dev->dev; | 399 | struct device *dev = &serial->serial->dev->dev; |
395 | int status = 0; | 400 | int status = 0; |
396 | int write_length; | 401 | int write_length; |
397 | __be16 be_start_address; | 402 | u16 be_start_address; |
398 | 403 | ||
399 | /* We can only send a maximum of 1 aligned byte page at a time */ | 404 | /* We can only send a maximum of 1 aligned byte page at a time */ |
400 | 405 | ||
@@ -409,11 +414,16 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
409 | __func__, start_address, write_length); | 414 | __func__, start_address, write_length); |
410 | usb_serial_debug_data(dev, __func__, write_length, buffer); | 415 | usb_serial_debug_data(dev, __func__, write_length, buffer); |
411 | 416 | ||
412 | /* Write first page */ | 417 | /* |
413 | be_start_address = cpu_to_be16(start_address); | 418 | * Write first page. |
419 | * | ||
420 | * NOTE: Must use swab as wIndex is sent in little-endian byte order | ||
421 | * regardless of host byte order. | ||
422 | */ | ||
423 | be_start_address = swab16((u16)start_address); | ||
414 | status = ti_vsend_sync(serial->serial->dev, | 424 | status = ti_vsend_sync(serial->serial->dev, |
415 | UMPC_MEMORY_WRITE, (__u16)address_type, | 425 | UMPC_MEMORY_WRITE, (__u16)address_type, |
416 | (__force __u16)be_start_address, | 426 | be_start_address, |
417 | buffer, write_length); | 427 | buffer, write_length); |
418 | if (status) { | 428 | if (status) { |
419 | dev_dbg(dev, "%s - ERROR %d\n", __func__, status); | 429 | dev_dbg(dev, "%s - ERROR %d\n", __func__, status); |
@@ -436,11 +446,16 @@ static int write_i2c_mem(struct edgeport_serial *serial, | |||
436 | __func__, start_address, write_length); | 446 | __func__, start_address, write_length); |
437 | usb_serial_debug_data(dev, __func__, write_length, buffer); | 447 | usb_serial_debug_data(dev, __func__, write_length, buffer); |
438 | 448 | ||
439 | /* Write next page */ | 449 | /* |
440 | be_start_address = cpu_to_be16(start_address); | 450 | * Write next page. |
451 | * | ||
452 | * NOTE: Must use swab as wIndex is sent in little-endian byte | ||
453 | * order regardless of host byte order. | ||
454 | */ | ||
455 | be_start_address = swab16((u16)start_address); | ||
441 | status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, | 456 | status = ti_vsend_sync(serial->serial->dev, UMPC_MEMORY_WRITE, |
442 | (__u16)address_type, | 457 | (__u16)address_type, |
443 | (__force __u16)be_start_address, | 458 | be_start_address, |
444 | buffer, write_length); | 459 | buffer, write_length); |
445 | if (status) { | 460 | if (status) { |
446 | dev_err(dev, "%s - ERROR %d\n", __func__, status); | 461 | dev_err(dev, "%s - ERROR %d\n", __func__, status); |
@@ -585,8 +600,8 @@ static int get_descriptor_addr(struct edgeport_serial *serial, | |||
585 | if (rom_desc->Type == desc_type) | 600 | if (rom_desc->Type == desc_type) |
586 | return start_address; | 601 | return start_address; |
587 | 602 | ||
588 | start_address = start_address + sizeof(struct ti_i2c_desc) | 603 | start_address = start_address + sizeof(struct ti_i2c_desc) + |
589 | + rom_desc->Size; | 604 | le16_to_cpu(rom_desc->Size); |
590 | 605 | ||
591 | } while ((start_address < TI_MAX_I2C_SIZE) && rom_desc->Type); | 606 | } while ((start_address < TI_MAX_I2C_SIZE) && rom_desc->Type); |
592 | 607 | ||
@@ -599,7 +614,7 @@ static int valid_csum(struct ti_i2c_desc *rom_desc, __u8 *buffer) | |||
599 | __u16 i; | 614 | __u16 i; |
600 | __u8 cs = 0; | 615 | __u8 cs = 0; |
601 | 616 | ||
602 | for (i = 0; i < rom_desc->Size; i++) | 617 | for (i = 0; i < le16_to_cpu(rom_desc->Size); i++) |
603 | cs = (__u8)(cs + buffer[i]); | 618 | cs = (__u8)(cs + buffer[i]); |
604 | 619 | ||
605 | if (cs != rom_desc->CheckSum) { | 620 | if (cs != rom_desc->CheckSum) { |
@@ -650,7 +665,7 @@ static int check_i2c_image(struct edgeport_serial *serial) | |||
650 | break; | 665 | break; |
651 | 666 | ||
652 | if ((start_address + sizeof(struct ti_i2c_desc) + | 667 | if ((start_address + sizeof(struct ti_i2c_desc) + |
653 | rom_desc->Size) > TI_MAX_I2C_SIZE) { | 668 | le16_to_cpu(rom_desc->Size)) > TI_MAX_I2C_SIZE) { |
654 | status = -ENODEV; | 669 | status = -ENODEV; |
655 | dev_dbg(dev, "%s - structure too big, erroring out.\n", __func__); | 670 | dev_dbg(dev, "%s - structure too big, erroring out.\n", __func__); |
656 | break; | 671 | break; |
@@ -665,7 +680,8 @@ static int check_i2c_image(struct edgeport_serial *serial) | |||
665 | /* Read the descriptor data */ | 680 | /* Read the descriptor data */ |
666 | status = read_rom(serial, start_address + | 681 | status = read_rom(serial, start_address + |
667 | sizeof(struct ti_i2c_desc), | 682 | sizeof(struct ti_i2c_desc), |
668 | rom_desc->Size, buffer); | 683 | le16_to_cpu(rom_desc->Size), |
684 | buffer); | ||
669 | if (status) | 685 | if (status) |
670 | break; | 686 | break; |
671 | 687 | ||
@@ -674,7 +690,7 @@ static int check_i2c_image(struct edgeport_serial *serial) | |||
674 | break; | 690 | break; |
675 | } | 691 | } |
676 | start_address = start_address + sizeof(struct ti_i2c_desc) + | 692 | start_address = start_address + sizeof(struct ti_i2c_desc) + |
677 | rom_desc->Size; | 693 | le16_to_cpu(rom_desc->Size); |
678 | 694 | ||
679 | } while ((rom_desc->Type != I2C_DESC_TYPE_ION) && | 695 | } while ((rom_desc->Type != I2C_DESC_TYPE_ION) && |
680 | (start_address < TI_MAX_I2C_SIZE)); | 696 | (start_address < TI_MAX_I2C_SIZE)); |
@@ -712,7 +728,7 @@ static int get_manuf_info(struct edgeport_serial *serial, __u8 *buffer) | |||
712 | 728 | ||
713 | /* Read the descriptor data */ | 729 | /* Read the descriptor data */ |
714 | status = read_rom(serial, start_address+sizeof(struct ti_i2c_desc), | 730 | status = read_rom(serial, start_address+sizeof(struct ti_i2c_desc), |
715 | rom_desc->Size, buffer); | 731 | le16_to_cpu(rom_desc->Size), buffer); |
716 | if (status) | 732 | if (status) |
717 | goto exit; | 733 | goto exit; |
718 | 734 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 367c7f08b27c..f213ee978516 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -234,8 +234,31 @@ static void option_instat_callback(struct urb *urb); | |||
234 | #define QUALCOMM_VENDOR_ID 0x05C6 | 234 | #define QUALCOMM_VENDOR_ID 0x05C6 |
235 | 235 | ||
236 | #define CMOTECH_VENDOR_ID 0x16d8 | 236 | #define CMOTECH_VENDOR_ID 0x16d8 |
237 | #define CMOTECH_PRODUCT_6008 0x6008 | 237 | #define CMOTECH_PRODUCT_6001 0x6001 |
238 | #define CMOTECH_PRODUCT_6280 0x6280 | 238 | #define CMOTECH_PRODUCT_CMU_300 0x6002 |
239 | #define CMOTECH_PRODUCT_6003 0x6003 | ||
240 | #define CMOTECH_PRODUCT_6004 0x6004 | ||
241 | #define CMOTECH_PRODUCT_6005 0x6005 | ||
242 | #define CMOTECH_PRODUCT_CGU_628A 0x6006 | ||
243 | #define CMOTECH_PRODUCT_CHE_628S 0x6007 | ||
244 | #define CMOTECH_PRODUCT_CMU_301 0x6008 | ||
245 | #define CMOTECH_PRODUCT_CHU_628 0x6280 | ||
246 | #define CMOTECH_PRODUCT_CHU_628S 0x6281 | ||
247 | #define CMOTECH_PRODUCT_CDU_680 0x6803 | ||
248 | #define CMOTECH_PRODUCT_CDU_685A 0x6804 | ||
249 | #define CMOTECH_PRODUCT_CHU_720S 0x7001 | ||
250 | #define CMOTECH_PRODUCT_7002 0x7002 | ||
251 | #define CMOTECH_PRODUCT_CHU_629K 0x7003 | ||
252 | #define CMOTECH_PRODUCT_7004 0x7004 | ||
253 | #define CMOTECH_PRODUCT_7005 0x7005 | ||
254 | #define CMOTECH_PRODUCT_CGU_629 0x7006 | ||
255 | #define CMOTECH_PRODUCT_CHU_629S 0x700a | ||
256 | #define CMOTECH_PRODUCT_CHU_720I 0x7211 | ||
257 | #define CMOTECH_PRODUCT_7212 0x7212 | ||
258 | #define CMOTECH_PRODUCT_7213 0x7213 | ||
259 | #define CMOTECH_PRODUCT_7251 0x7251 | ||
260 | #define CMOTECH_PRODUCT_7252 0x7252 | ||
261 | #define CMOTECH_PRODUCT_7253 0x7253 | ||
239 | 262 | ||
240 | #define TELIT_VENDOR_ID 0x1bc7 | 263 | #define TELIT_VENDOR_ID 0x1bc7 |
241 | #define TELIT_PRODUCT_UC864E 0x1003 | 264 | #define TELIT_PRODUCT_UC864E 0x1003 |
@@ -287,6 +310,7 @@ static void option_instat_callback(struct urb *urb); | |||
287 | #define ALCATEL_PRODUCT_X060S_X200 0x0000 | 310 | #define ALCATEL_PRODUCT_X060S_X200 0x0000 |
288 | #define ALCATEL_PRODUCT_X220_X500D 0x0017 | 311 | #define ALCATEL_PRODUCT_X220_X500D 0x0017 |
289 | #define ALCATEL_PRODUCT_L100V 0x011e | 312 | #define ALCATEL_PRODUCT_L100V 0x011e |
313 | #define ALCATEL_PRODUCT_L800MA 0x0203 | ||
290 | 314 | ||
291 | #define PIRELLI_VENDOR_ID 0x1266 | 315 | #define PIRELLI_VENDOR_ID 0x1266 |
292 | #define PIRELLI_PRODUCT_C100_1 0x1002 | 316 | #define PIRELLI_PRODUCT_C100_1 0x1002 |
@@ -349,6 +373,7 @@ static void option_instat_callback(struct urb *urb); | |||
349 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 | 373 | #define OLIVETTI_PRODUCT_OLICARD100 0xc000 |
350 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 | 374 | #define OLIVETTI_PRODUCT_OLICARD145 0xc003 |
351 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 | 375 | #define OLIVETTI_PRODUCT_OLICARD200 0xc005 |
376 | #define OLIVETTI_PRODUCT_OLICARD500 0xc00b | ||
352 | 377 | ||
353 | /* Celot products */ | 378 | /* Celot products */ |
354 | #define CELOT_VENDOR_ID 0x211f | 379 | #define CELOT_VENDOR_ID 0x211f |
@@ -502,6 +527,10 @@ static const struct option_blacklist_info huawei_cdc12_blacklist = { | |||
502 | .reserved = BIT(1) | BIT(2), | 527 | .reserved = BIT(1) | BIT(2), |
503 | }; | 528 | }; |
504 | 529 | ||
530 | static const struct option_blacklist_info net_intf0_blacklist = { | ||
531 | .reserved = BIT(0), | ||
532 | }; | ||
533 | |||
505 | static const struct option_blacklist_info net_intf1_blacklist = { | 534 | static const struct option_blacklist_info net_intf1_blacklist = { |
506 | .reserved = BIT(1), | 535 | .reserved = BIT(1), |
507 | }; | 536 | }; |
@@ -1035,8 +1064,47 @@ static const struct usb_device_id option_ids[] = { | |||
1035 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ | 1064 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ |
1036 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ | 1065 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ |
1037 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ | 1066 | { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */ |
1038 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */ | 1067 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, |
1039 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, | 1068 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, |
1069 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), | ||
1070 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1071 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6004) }, | ||
1072 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6005) }, | ||
1073 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CGU_628A) }, | ||
1074 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHE_628S), | ||
1075 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1076 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_301), | ||
1077 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1078 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_628), | ||
1079 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1080 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_628S) }, | ||
1081 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU_680) }, | ||
1082 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CDU_685A) }, | ||
1083 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_720S), | ||
1084 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1085 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7002), | ||
1086 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1087 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_629K), | ||
1088 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
1089 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7004), | ||
1090 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, | ||
1091 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7005) }, | ||
1092 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CGU_629), | ||
1093 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | ||
1094 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_629S), | ||
1095 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
1096 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CHU_720I), | ||
1097 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1098 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7212), | ||
1099 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1100 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7213), | ||
1101 | .driver_info = (kernel_ulong_t)&net_intf0_blacklist }, | ||
1102 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7251), | ||
1103 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | ||
1104 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7252), | ||
1105 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | ||
1106 | { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_7253), | ||
1107 | .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, | ||
1040 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, | 1108 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, |
1041 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) }, | 1109 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) }, |
1042 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) }, | 1110 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) }, |
@@ -1500,6 +1568,8 @@ static const struct usb_device_id option_ids[] = { | |||
1500 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, | 1568 | .driver_info = (kernel_ulong_t)&net_intf5_blacklist }, |
1501 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V), | 1569 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V), |
1502 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | 1570 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
1571 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L800MA), | ||
1572 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
1503 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, | 1573 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, |
1504 | { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, | 1574 | { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, |
1505 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), | 1575 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), |
@@ -1545,6 +1615,9 @@ static const struct usb_device_id option_ids[] = { | |||
1545 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), | 1615 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200), |
1546 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist | 1616 | .driver_info = (kernel_ulong_t)&net_intf6_blacklist |
1547 | }, | 1617 | }, |
1618 | { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD500), | ||
1619 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist | ||
1620 | }, | ||
1548 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ | 1621 | { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */ |
1549 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ | 1622 | { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/ |
1550 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, | 1623 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) }, |
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 968a40201e5f..7ed681a714a5 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -136,9 +136,18 @@ static const struct usb_device_id id_table[] = { | |||
136 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 0)}, /* Sierra Wireless MC7710 Device Management */ | 136 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 0)}, /* Sierra Wireless MC7710 Device Management */ |
137 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 2)}, /* Sierra Wireless MC7710 NMEA */ | 137 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 2)}, /* Sierra Wireless MC7710 NMEA */ |
138 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 3)}, /* Sierra Wireless MC7710 Modem */ | 138 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68a2, 3)}, /* Sierra Wireless MC7710 Modem */ |
139 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68c0, 0)}, /* Sierra Wireless MC73xx Device Management */ | ||
140 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68c0, 2)}, /* Sierra Wireless MC73xx NMEA */ | ||
141 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x68c0, 3)}, /* Sierra Wireless MC73xx Modem */ | ||
139 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 0)}, /* Sierra Wireless EM7700 Device Management */ | 142 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 0)}, /* Sierra Wireless EM7700 Device Management */ |
140 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 2)}, /* Sierra Wireless EM7700 NMEA */ | 143 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 2)}, /* Sierra Wireless EM7700 NMEA */ |
141 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 3)}, /* Sierra Wireless EM7700 Modem */ | 144 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901c, 3)}, /* Sierra Wireless EM7700 Modem */ |
145 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901f, 0)}, /* Sierra Wireless EM7355 Device Management */ | ||
146 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901f, 2)}, /* Sierra Wireless EM7355 NMEA */ | ||
147 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x901f, 3)}, /* Sierra Wireless EM7355 Modem */ | ||
148 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9041, 0)}, /* Sierra Wireless MC7305/MC7355 Device Management */ | ||
149 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9041, 2)}, /* Sierra Wireless MC7305/MC7355 NMEA */ | ||
150 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9041, 3)}, /* Sierra Wireless MC7305/MC7355 Modem */ | ||
142 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 0)}, /* Netgear AirCard 340U Device Management */ | 151 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 0)}, /* Netgear AirCard 340U Device Management */ |
143 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 2)}, /* Netgear AirCard 340U NMEA */ | 152 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 2)}, /* Netgear AirCard 340U NMEA */ |
144 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 3)}, /* Netgear AirCard 340U Modem */ | 153 | {USB_DEVICE_INTERFACE_NUMBER(0x1199, 0x9051, 3)}, /* Netgear AirCard 340U Modem */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 81fc0dfcfdcf..6d40d56378d7 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1347,10 +1347,12 @@ static int usb_serial_register(struct usb_serial_driver *driver) | |||
1347 | static void usb_serial_deregister(struct usb_serial_driver *device) | 1347 | static void usb_serial_deregister(struct usb_serial_driver *device) |
1348 | { | 1348 | { |
1349 | pr_info("USB Serial deregistering driver %s\n", device->description); | 1349 | pr_info("USB Serial deregistering driver %s\n", device->description); |
1350 | |||
1350 | mutex_lock(&table_lock); | 1351 | mutex_lock(&table_lock); |
1351 | list_del(&device->driver_list); | 1352 | list_del(&device->driver_list); |
1352 | usb_serial_bus_deregister(device); | ||
1353 | mutex_unlock(&table_lock); | 1353 | mutex_unlock(&table_lock); |
1354 | |||
1355 | usb_serial_bus_deregister(device); | ||
1354 | } | 1356 | } |
1355 | 1357 | ||
1356 | /** | 1358 | /** |
diff --git a/drivers/usb/wusbcore/mmc.c b/drivers/usb/wusbcore/mmc.c index 44741267c917..3f485df96226 100644 --- a/drivers/usb/wusbcore/mmc.c +++ b/drivers/usb/wusbcore/mmc.c | |||
@@ -301,7 +301,7 @@ int wusbhc_chid_set(struct wusbhc *wusbhc, const struct wusb_ckhdid *chid) | |||
301 | 301 | ||
302 | if (chid) | 302 | if (chid) |
303 | result = uwb_radio_start(&wusbhc->pal); | 303 | result = uwb_radio_start(&wusbhc->pal); |
304 | else | 304 | else if (wusbhc->uwb_rc) |
305 | uwb_radio_stop(&wusbhc->pal); | 305 | uwb_radio_stop(&wusbhc->pal); |
306 | 306 | ||
307 | return result; | 307 | return result; |
diff --git a/drivers/usb/wusbcore/wa-xfer.c b/drivers/usb/wusbcore/wa-xfer.c index c8e2a47d62a7..3e2e4ed20157 100644 --- a/drivers/usb/wusbcore/wa-xfer.c +++ b/drivers/usb/wusbcore/wa-xfer.c | |||
@@ -2390,10 +2390,10 @@ error_complete: | |||
2390 | done) { | 2390 | done) { |
2391 | 2391 | ||
2392 | dev_info(dev, "Control EP stall. Queue delayed work.\n"); | 2392 | dev_info(dev, "Control EP stall. Queue delayed work.\n"); |
2393 | spin_lock_irq(&wa->xfer_list_lock); | 2393 | spin_lock(&wa->xfer_list_lock); |
2394 | /* move xfer from xfer_list to xfer_errored_list. */ | 2394 | /* move xfer from xfer_list to xfer_errored_list. */ |
2395 | list_move_tail(&xfer->list_node, &wa->xfer_errored_list); | 2395 | list_move_tail(&xfer->list_node, &wa->xfer_errored_list); |
2396 | spin_unlock_irq(&wa->xfer_list_lock); | 2396 | spin_unlock(&wa->xfer_list_lock); |
2397 | spin_unlock_irqrestore(&xfer->lock, flags); | 2397 | spin_unlock_irqrestore(&xfer->lock, flags); |
2398 | queue_work(wusbd, &wa->xfer_error_work); | 2398 | queue_work(wusbd, &wa->xfer_error_work); |
2399 | } else { | 2399 | } else { |
diff --git a/drivers/uwb/drp.c b/drivers/uwb/drp.c index 1a2fd9795367..468c89fb6a16 100644 --- a/drivers/uwb/drp.c +++ b/drivers/uwb/drp.c | |||
@@ -59,6 +59,7 @@ static void uwb_rc_set_drp_cmd_done(struct uwb_rc *rc, void *arg, | |||
59 | struct uwb_rceb *reply, ssize_t reply_size) | 59 | struct uwb_rceb *reply, ssize_t reply_size) |
60 | { | 60 | { |
61 | struct uwb_rc_evt_set_drp_ie *r = (struct uwb_rc_evt_set_drp_ie *)reply; | 61 | struct uwb_rc_evt_set_drp_ie *r = (struct uwb_rc_evt_set_drp_ie *)reply; |
62 | unsigned long flags; | ||
62 | 63 | ||
63 | if (r != NULL) { | 64 | if (r != NULL) { |
64 | if (r->bResultCode != UWB_RC_RES_SUCCESS) | 65 | if (r->bResultCode != UWB_RC_RES_SUCCESS) |
@@ -67,14 +68,14 @@ static void uwb_rc_set_drp_cmd_done(struct uwb_rc *rc, void *arg, | |||
67 | } else | 68 | } else |
68 | dev_err(&rc->uwb_dev.dev, "SET-DRP-IE: timeout\n"); | 69 | dev_err(&rc->uwb_dev.dev, "SET-DRP-IE: timeout\n"); |
69 | 70 | ||
70 | spin_lock_irq(&rc->rsvs_lock); | 71 | spin_lock_irqsave(&rc->rsvs_lock, flags); |
71 | if (rc->set_drp_ie_pending > 1) { | 72 | if (rc->set_drp_ie_pending > 1) { |
72 | rc->set_drp_ie_pending = 0; | 73 | rc->set_drp_ie_pending = 0; |
73 | uwb_rsv_queue_update(rc); | 74 | uwb_rsv_queue_update(rc); |
74 | } else { | 75 | } else { |
75 | rc->set_drp_ie_pending = 0; | 76 | rc->set_drp_ie_pending = 0; |
76 | } | 77 | } |
77 | spin_unlock_irq(&rc->rsvs_lock); | 78 | spin_unlock_irqrestore(&rc->rsvs_lock, flags); |
78 | } | 79 | } |
79 | 80 | ||
80 | /** | 81 | /** |