diff options
Diffstat (limited to 'drivers')
573 files changed, 7764 insertions, 3468 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 47768ff87343..80998958cf45 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -208,7 +208,7 @@ config ACPI_IPMI | |||
| 208 | 208 | ||
| 209 | config ACPI_HOTPLUG_CPU | 209 | config ACPI_HOTPLUG_CPU |
| 210 | bool | 210 | bool |
| 211 | depends on ACPI_PROCESSOR && HOTPLUG_CPU | 211 | depends on EXPERIMENTAL && ACPI_PROCESSOR && HOTPLUG_CPU |
| 212 | select ACPI_CONTAINER | 212 | select ACPI_CONTAINER |
| 213 | default y | 213 | default y |
| 214 | 214 | ||
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index a43fa1a57d57..1502c50273b5 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" | 36 | #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" |
| 37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 | 37 | #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 |
| 38 | static DEFINE_MUTEX(isolated_cpus_lock); | 38 | static DEFINE_MUTEX(isolated_cpus_lock); |
| 39 | static DEFINE_MUTEX(round_robin_lock); | ||
| 39 | 40 | ||
| 40 | static unsigned long power_saving_mwait_eax; | 41 | static unsigned long power_saving_mwait_eax; |
| 41 | 42 | ||
| @@ -107,7 +108,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
| 107 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) | 108 | if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) |
| 108 | return; | 109 | return; |
| 109 | 110 | ||
| 110 | mutex_lock(&isolated_cpus_lock); | 111 | mutex_lock(&round_robin_lock); |
| 111 | cpumask_clear(tmp); | 112 | cpumask_clear(tmp); |
| 112 | for_each_cpu(cpu, pad_busy_cpus) | 113 | for_each_cpu(cpu, pad_busy_cpus) |
| 113 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); | 114 | cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); |
| @@ -116,7 +117,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
| 116 | if (cpumask_empty(tmp)) | 117 | if (cpumask_empty(tmp)) |
| 117 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); | 118 | cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); |
| 118 | if (cpumask_empty(tmp)) { | 119 | if (cpumask_empty(tmp)) { |
| 119 | mutex_unlock(&isolated_cpus_lock); | 120 | mutex_unlock(&round_robin_lock); |
| 120 | return; | 121 | return; |
| 121 | } | 122 | } |
| 122 | for_each_cpu(cpu, tmp) { | 123 | for_each_cpu(cpu, tmp) { |
| @@ -131,7 +132,7 @@ static void round_robin_cpu(unsigned int tsk_index) | |||
| 131 | tsk_in_cpu[tsk_index] = preferred_cpu; | 132 | tsk_in_cpu[tsk_index] = preferred_cpu; |
| 132 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); | 133 | cpumask_set_cpu(preferred_cpu, pad_busy_cpus); |
| 133 | cpu_weight[preferred_cpu]++; | 134 | cpu_weight[preferred_cpu]++; |
| 134 | mutex_unlock(&isolated_cpus_lock); | 135 | mutex_unlock(&round_robin_lock); |
| 135 | 136 | ||
| 136 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); | 137 | set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); |
| 137 | } | 138 | } |
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 0ed85cac3231..615996a36bed 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c | |||
| @@ -95,18 +95,6 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags) | |||
| 95 | return_ACPI_STATUS(status); | 95 | return_ACPI_STATUS(status); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | if (sleep_state != ACPI_STATE_S5) { | ||
| 99 | /* | ||
| 100 | * Disable BM arbitration. This feature is contained within an | ||
| 101 | * optional register (PM2 Control), so ignore a BAD_ADDRESS | ||
| 102 | * exception. | ||
| 103 | */ | ||
| 104 | status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1); | ||
| 105 | if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) { | ||
| 106 | return_ACPI_STATUS(status); | ||
| 107 | } | ||
| 108 | } | ||
| 109 | |||
| 110 | /* | 98 | /* |
| 111 | * 1) Disable/Clear all GPEs | 99 | * 1) Disable/Clear all GPEs |
| 112 | * 2) Enable all wakeup GPEs | 100 | * 2) Enable all wakeup GPEs |
| @@ -364,16 +352,6 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state, u8 flags) | |||
| 364 | [ACPI_EVENT_POWER_BUTTON]. | 352 | [ACPI_EVENT_POWER_BUTTON]. |
| 365 | status_register_id, ACPI_CLEAR_STATUS); | 353 | status_register_id, ACPI_CLEAR_STATUS); |
| 366 | 354 | ||
| 367 | /* | ||
| 368 | * Enable BM arbitration. This feature is contained within an | ||
| 369 | * optional register (PM2 Control), so ignore a BAD_ADDRESS | ||
| 370 | * exception. | ||
| 371 | */ | ||
| 372 | status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0); | ||
| 373 | if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) { | ||
| 374 | return_ACPI_STATUS(status); | ||
| 375 | } | ||
| 376 | |||
| 377 | acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING); | 355 | acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING); |
| 378 | return_ACPI_STATUS(status); | 356 | return_ACPI_STATUS(status); |
| 379 | } | 357 | } |
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index 23ce09686418..fe6626035495 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c | |||
| @@ -638,7 +638,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data, | |||
| 638 | /* Create the new outer package and populate it */ | 638 | /* Create the new outer package and populate it */ |
| 639 | 639 | ||
| 640 | status = | 640 | status = |
| 641 | acpi_ns_wrap_with_package(data, *elements, | 641 | acpi_ns_wrap_with_package(data, return_object, |
| 642 | return_object_ptr); | 642 | return_object_ptr); |
| 643 | if (ACPI_FAILURE(status)) { | 643 | if (ACPI_FAILURE(status)) { |
| 644 | return (status); | 644 | return (status); |
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index 5577762daee1..6686b1eaf13e 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c | |||
| @@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct apei_exec_context *ctx, | |||
| 243 | u8 ins = entry->instruction; | 243 | u8 ins = entry->instruction; |
| 244 | 244 | ||
| 245 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) | 245 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) |
| 246 | return acpi_os_map_generic_address(&entry->register_region); | 246 | return apei_map_generic_address(&entry->register_region); |
| 247 | 247 | ||
| 248 | return 0; | 248 | return 0; |
| 249 | } | 249 | } |
| @@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struct apei_exec_context *ctx, | |||
| 276 | u8 ins = entry->instruction; | 276 | u8 ins = entry->instruction; |
| 277 | 277 | ||
| 278 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) | 278 | if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) |
| 279 | acpi_os_unmap_generic_address(&entry->register_region); | 279 | apei_unmap_generic_address(&entry->register_region); |
| 280 | 280 | ||
| 281 | return 0; | 281 | return 0; |
| 282 | } | 282 | } |
| @@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr, | |||
| 606 | return 0; | 606 | return 0; |
| 607 | } | 607 | } |
| 608 | 608 | ||
| 609 | int apei_map_generic_address(struct acpi_generic_address *reg) | ||
| 610 | { | ||
| 611 | int rc; | ||
| 612 | u32 access_bit_width; | ||
| 613 | u64 address; | ||
| 614 | |||
| 615 | rc = apei_check_gar(reg, &address, &access_bit_width); | ||
| 616 | if (rc) | ||
| 617 | return rc; | ||
| 618 | return acpi_os_map_generic_address(reg); | ||
| 619 | } | ||
| 620 | EXPORT_SYMBOL_GPL(apei_map_generic_address); | ||
| 621 | |||
| 609 | /* read GAR in interrupt (including NMI) or process context */ | 622 | /* read GAR in interrupt (including NMI) or process context */ |
| 610 | int apei_read(u64 *val, struct acpi_generic_address *reg) | 623 | int apei_read(u64 *val, struct acpi_generic_address *reg) |
| 611 | { | 624 | { |
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h index cca240a33038..f220d642136e 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h | |||
| @@ -7,6 +7,8 @@ | |||
| 7 | #define APEI_INTERNAL_H | 7 | #define APEI_INTERNAL_H |
| 8 | 8 | ||
| 9 | #include <linux/cper.h> | 9 | #include <linux/cper.h> |
| 10 | #include <linux/acpi.h> | ||
| 11 | #include <linux/acpi_io.h> | ||
| 10 | 12 | ||
| 11 | struct apei_exec_context; | 13 | struct apei_exec_context; |
| 12 | 14 | ||
| @@ -68,6 +70,13 @@ static inline int apei_exec_run_optional(struct apei_exec_context *ctx, u8 actio | |||
| 68 | /* IP has been set in instruction function */ | 70 | /* IP has been set in instruction function */ |
| 69 | #define APEI_EXEC_SET_IP 1 | 71 | #define APEI_EXEC_SET_IP 1 |
| 70 | 72 | ||
| 73 | int apei_map_generic_address(struct acpi_generic_address *reg); | ||
| 74 | |||
| 75 | static inline void apei_unmap_generic_address(struct acpi_generic_address *reg) | ||
| 76 | { | ||
| 77 | acpi_os_unmap_generic_address(reg); | ||
| 78 | } | ||
| 79 | |||
| 71 | int apei_read(u64 *val, struct acpi_generic_address *reg); | 80 | int apei_read(u64 *val, struct acpi_generic_address *reg); |
| 72 | int apei_write(u64 val, struct acpi_generic_address *reg); | 81 | int apei_write(u64 val, struct acpi_generic_address *reg); |
| 73 | 82 | ||
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 9b3cac0abecc..1599566ed1fe 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
| @@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic) | |||
| 301 | if (!ghes) | 301 | if (!ghes) |
| 302 | return ERR_PTR(-ENOMEM); | 302 | return ERR_PTR(-ENOMEM); |
| 303 | ghes->generic = generic; | 303 | ghes->generic = generic; |
| 304 | rc = acpi_os_map_generic_address(&generic->error_status_address); | 304 | rc = apei_map_generic_address(&generic->error_status_address); |
| 305 | if (rc) | 305 | if (rc) |
| 306 | goto err_free; | 306 | goto err_free; |
| 307 | error_block_length = generic->error_block_length; | 307 | error_block_length = generic->error_block_length; |
| @@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic) | |||
| 321 | return ghes; | 321 | return ghes; |
| 322 | 322 | ||
| 323 | err_unmap: | 323 | err_unmap: |
| 324 | acpi_os_unmap_generic_address(&generic->error_status_address); | 324 | apei_unmap_generic_address(&generic->error_status_address); |
| 325 | err_free: | 325 | err_free: |
| 326 | kfree(ghes); | 326 | kfree(ghes); |
| 327 | return ERR_PTR(rc); | 327 | return ERR_PTR(rc); |
| @@ -330,7 +330,7 @@ err_free: | |||
| 330 | static void ghes_fini(struct ghes *ghes) | 330 | static void ghes_fini(struct ghes *ghes) |
| 331 | { | 331 | { |
| 332 | kfree(ghes->estatus); | 332 | kfree(ghes->estatus); |
| 333 | acpi_os_unmap_generic_address(&ghes->generic->error_status_address); | 333 | apei_unmap_generic_address(&ghes->generic->error_status_address); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | enum { | 336 | enum { |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 86933ca8b472..7dd3f9fb9f3f 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -643,11 +643,19 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
| 643 | 643 | ||
| 644 | static void acpi_battery_refresh(struct acpi_battery *battery) | 644 | static void acpi_battery_refresh(struct acpi_battery *battery) |
| 645 | { | 645 | { |
| 646 | int power_unit; | ||
| 647 | |||
| 646 | if (!battery->bat.dev) | 648 | if (!battery->bat.dev) |
| 647 | return; | 649 | return; |
| 648 | 650 | ||
| 651 | power_unit = battery->power_unit; | ||
| 652 | |||
| 649 | acpi_battery_get_info(battery); | 653 | acpi_battery_get_info(battery); |
| 650 | /* The battery may have changed its reporting units. */ | 654 | |
| 655 | if (power_unit == battery->power_unit) | ||
| 656 | return; | ||
| 657 | |||
| 658 | /* The battery has changed its reporting units. */ | ||
| 651 | sysfs_remove_battery(battery); | 659 | sysfs_remove_battery(battery); |
| 652 | sysfs_add_battery(battery); | 660 | sysfs_add_battery(battery); |
| 653 | } | 661 | } |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index c850de4c9a14..eff722278ff5 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -189,10 +189,12 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id) | |||
| 189 | * Processor (CPU3, 0x03, 0x00000410, 0x06) {} | 189 | * Processor (CPU3, 0x03, 0x00000410, 0x06) {} |
| 190 | * } | 190 | * } |
| 191 | * | 191 | * |
| 192 | * Ignores apic_id and always return 0 for CPU0's handle. | 192 | * Ignores apic_id and always returns 0 for the processor |
| 193 | * handle with acpi id 0 if nr_cpu_ids is 1. | ||
| 194 | * This should be the case if SMP tables are not found. | ||
| 193 | * Return -1 for other CPU's handle. | 195 | * Return -1 for other CPU's handle. |
| 194 | */ | 196 | */ |
| 195 | if (acpi_id == 0) | 197 | if (nr_cpu_ids <= 1 && acpi_id == 0) |
| 196 | return acpi_id; | 198 | return acpi_id; |
| 197 | else | 199 | else |
| 198 | return apic_id; | 200 | return apic_id; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f3decb30223f..47a8caa89dbe 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -224,6 +224,7 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr, | |||
| 224 | /* | 224 | /* |
| 225 | * Suspend / resume control | 225 | * Suspend / resume control |
| 226 | */ | 226 | */ |
| 227 | static int acpi_idle_suspend; | ||
| 227 | static u32 saved_bm_rld; | 228 | static u32 saved_bm_rld; |
| 228 | 229 | ||
| 229 | static void acpi_idle_bm_rld_save(void) | 230 | static void acpi_idle_bm_rld_save(void) |
| @@ -242,13 +243,21 @@ static void acpi_idle_bm_rld_restore(void) | |||
| 242 | 243 | ||
| 243 | int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) | 244 | int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) |
| 244 | { | 245 | { |
| 246 | if (acpi_idle_suspend == 1) | ||
| 247 | return 0; | ||
| 248 | |||
| 245 | acpi_idle_bm_rld_save(); | 249 | acpi_idle_bm_rld_save(); |
| 250 | acpi_idle_suspend = 1; | ||
| 246 | return 0; | 251 | return 0; |
| 247 | } | 252 | } |
| 248 | 253 | ||
| 249 | int acpi_processor_resume(struct acpi_device * device) | 254 | int acpi_processor_resume(struct acpi_device * device) |
| 250 | { | 255 | { |
| 256 | if (acpi_idle_suspend == 0) | ||
| 257 | return 0; | ||
| 258 | |||
| 251 | acpi_idle_bm_rld_restore(); | 259 | acpi_idle_bm_rld_restore(); |
| 260 | acpi_idle_suspend = 0; | ||
| 252 | return 0; | 261 | return 0; |
| 253 | } | 262 | } |
| 254 | 263 | ||
| @@ -754,6 +763,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
| 754 | 763 | ||
| 755 | local_irq_disable(); | 764 | local_irq_disable(); |
| 756 | 765 | ||
| 766 | if (acpi_idle_suspend) { | ||
| 767 | local_irq_enable(); | ||
| 768 | cpu_relax(); | ||
| 769 | return -EBUSY; | ||
| 770 | } | ||
| 771 | |||
| 757 | lapic_timer_state_broadcast(pr, cx, 1); | 772 | lapic_timer_state_broadcast(pr, cx, 1); |
| 758 | kt1 = ktime_get_real(); | 773 | kt1 = ktime_get_real(); |
| 759 | acpi_idle_do_entry(cx); | 774 | acpi_idle_do_entry(cx); |
| @@ -823,6 +838,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
| 823 | 838 | ||
| 824 | local_irq_disable(); | 839 | local_irq_disable(); |
| 825 | 840 | ||
| 841 | if (acpi_idle_suspend) { | ||
| 842 | local_irq_enable(); | ||
| 843 | cpu_relax(); | ||
| 844 | return -EBUSY; | ||
| 845 | } | ||
| 846 | |||
| 826 | if (cx->entry_method != ACPI_CSTATE_FFH) { | 847 | if (cx->entry_method != ACPI_CSTATE_FFH) { |
| 827 | current_thread_info()->status &= ~TS_POLLING; | 848 | current_thread_info()->status &= ~TS_POLLING; |
| 828 | /* | 849 | /* |
| @@ -907,14 +928,21 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
| 907 | drv, drv->safe_state_index); | 928 | drv, drv->safe_state_index); |
| 908 | } else { | 929 | } else { |
| 909 | local_irq_disable(); | 930 | local_irq_disable(); |
| 910 | acpi_safe_halt(); | 931 | if (!acpi_idle_suspend) |
| 932 | acpi_safe_halt(); | ||
| 911 | local_irq_enable(); | 933 | local_irq_enable(); |
| 912 | return -EINVAL; | 934 | return -EBUSY; |
| 913 | } | 935 | } |
| 914 | } | 936 | } |
| 915 | 937 | ||
| 916 | local_irq_disable(); | 938 | local_irq_disable(); |
| 917 | 939 | ||
| 940 | if (acpi_idle_suspend) { | ||
| 941 | local_irq_enable(); | ||
| 942 | cpu_relax(); | ||
| 943 | return -EBUSY; | ||
| 944 | } | ||
| 945 | |||
| 918 | if (cx->entry_method != ACPI_CSTATE_FFH) { | 946 | if (cx->entry_method != ACPI_CSTATE_FFH) { |
| 919 | current_thread_info()->status &= ~TS_POLLING; | 947 | current_thread_info()->status &= ~TS_POLLING; |
| 920 | /* | 948 | /* |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 0af48a8554cd..a093dc163a42 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
| @@ -333,6 +333,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |||
| 333 | struct acpi_buffer state = { 0, NULL }; | 333 | struct acpi_buffer state = { 0, NULL }; |
| 334 | union acpi_object *pss = NULL; | 334 | union acpi_object *pss = NULL; |
| 335 | int i; | 335 | int i; |
| 336 | int last_invalid = -1; | ||
| 336 | 337 | ||
| 337 | 338 | ||
| 338 | status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); | 339 | status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); |
| @@ -394,14 +395,33 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |||
| 394 | ((u32)(px->core_frequency * 1000) != | 395 | ((u32)(px->core_frequency * 1000) != |
| 395 | (px->core_frequency * 1000))) { | 396 | (px->core_frequency * 1000))) { |
| 396 | printk(KERN_ERR FW_BUG PREFIX | 397 | printk(KERN_ERR FW_BUG PREFIX |
| 397 | "Invalid BIOS _PSS frequency: 0x%llx MHz\n", | 398 | "Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n", |
| 398 | px->core_frequency); | 399 | pr->id, px->core_frequency); |
| 399 | result = -EFAULT; | 400 | if (last_invalid == -1) |
| 400 | kfree(pr->performance->states); | 401 | last_invalid = i; |
| 401 | goto end; | 402 | } else { |
| 403 | if (last_invalid != -1) { | ||
| 404 | /* | ||
| 405 | * Copy this valid entry over last_invalid entry | ||
| 406 | */ | ||
| 407 | memcpy(&(pr->performance->states[last_invalid]), | ||
| 408 | px, sizeof(struct acpi_processor_px)); | ||
| 409 | ++last_invalid; | ||
| 410 | } | ||
| 402 | } | 411 | } |
| 403 | } | 412 | } |
| 404 | 413 | ||
| 414 | if (last_invalid == 0) { | ||
| 415 | printk(KERN_ERR FW_BUG PREFIX | ||
| 416 | "No valid BIOS _PSS frequency found for processor %d\n", pr->id); | ||
| 417 | result = -EFAULT; | ||
| 418 | kfree(pr->performance->states); | ||
| 419 | pr->performance->states = NULL; | ||
| 420 | } | ||
| 421 | |||
| 422 | if (last_invalid > 0) | ||
| 423 | pr->performance->state_count = last_invalid; | ||
| 424 | |||
| 405 | end: | 425 | end: |
| 406 | kfree(buffer.pointer); | 426 | kfree(buffer.pointer); |
| 407 | 427 | ||
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 9f66181c814e..240a24400976 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c | |||
| @@ -173,7 +173,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp) | |||
| 173 | { | 173 | { |
| 174 | int result = 0; | 174 | int result = 0; |
| 175 | 175 | ||
| 176 | if (!strncmp(val, "enable", strlen("enable") - 1)) { | 176 | if (!strncmp(val, "enable", strlen("enable"))) { |
| 177 | result = acpi_debug_trace(trace_method_name, trace_debug_level, | 177 | result = acpi_debug_trace(trace_method_name, trace_debug_level, |
| 178 | trace_debug_layer, 0); | 178 | trace_debug_layer, 0); |
| 179 | if (result) | 179 | if (result) |
| @@ -181,7 +181,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp) | |||
| 181 | goto exit; | 181 | goto exit; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | if (!strncmp(val, "disable", strlen("disable") - 1)) { | 184 | if (!strncmp(val, "disable", strlen("disable"))) { |
| 185 | int name = 0; | 185 | int name = 0; |
| 186 | result = acpi_debug_trace((char *)&name, trace_debug_level, | 186 | result = acpi_debug_trace((char *)&name, trace_debug_level, |
| 187 | trace_debug_layer, 0); | 187 | trace_debug_layer, 0); |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 9577b6fa2650..1e0a9e17c31d 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -558,6 +558,8 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
| 558 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; | 558 | union acpi_object arg0 = { ACPI_TYPE_INTEGER }; |
| 559 | struct acpi_object_list args = { 1, &arg0 }; | 559 | struct acpi_object_list args = { 1, &arg0 }; |
| 560 | 560 | ||
| 561 | if (!video->cap._DOS) | ||
| 562 | return 0; | ||
| 561 | 563 | ||
| 562 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) | 564 | if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) |
| 563 | return -EINVAL; | 565 | return -EINVAL; |
| @@ -1687,10 +1689,6 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1687 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | 1689 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); |
| 1688 | set_bit(KEY_DISPLAY_OFF, input->keybit); | 1690 | set_bit(KEY_DISPLAY_OFF, input->keybit); |
| 1689 | 1691 | ||
| 1690 | error = input_register_device(input); | ||
| 1691 | if (error) | ||
| 1692 | goto err_stop_video; | ||
| 1693 | |||
| 1694 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", | 1692 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", |
| 1695 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), | 1693 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), |
| 1696 | video->flags.multihead ? "yes" : "no", | 1694 | video->flags.multihead ? "yes" : "no", |
| @@ -1701,12 +1699,16 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1701 | video->pm_nb.priority = 0; | 1699 | video->pm_nb.priority = 0; |
| 1702 | error = register_pm_notifier(&video->pm_nb); | 1700 | error = register_pm_notifier(&video->pm_nb); |
| 1703 | if (error) | 1701 | if (error) |
| 1704 | goto err_unregister_input_dev; | 1702 | goto err_stop_video; |
| 1703 | |||
| 1704 | error = input_register_device(input); | ||
| 1705 | if (error) | ||
| 1706 | goto err_unregister_pm_notifier; | ||
| 1705 | 1707 | ||
| 1706 | return 0; | 1708 | return 0; |
| 1707 | 1709 | ||
| 1708 | err_unregister_input_dev: | 1710 | err_unregister_pm_notifier: |
| 1709 | input_unregister_device(input); | 1711 | unregister_pm_notifier(&video->pm_nb); |
| 1710 | err_stop_video: | 1712 | err_stop_video: |
| 1711 | acpi_video_bus_stop_devices(video); | 1713 | acpi_video_bus_stop_devices(video); |
| 1712 | err_free_input_dev: | 1714 | err_free_input_dev: |
| @@ -1743,9 +1745,18 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type) | |||
| 1743 | return 0; | 1745 | return 0; |
| 1744 | } | 1746 | } |
| 1745 | 1747 | ||
| 1748 | static int __init is_i740(struct pci_dev *dev) | ||
| 1749 | { | ||
| 1750 | if (dev->device == 0x00D1) | ||
| 1751 | return 1; | ||
| 1752 | if (dev->device == 0x7000) | ||
| 1753 | return 1; | ||
| 1754 | return 0; | ||
| 1755 | } | ||
| 1756 | |||
| 1746 | static int __init intel_opregion_present(void) | 1757 | static int __init intel_opregion_present(void) |
| 1747 | { | 1758 | { |
| 1748 | #if defined(CONFIG_DRM_I915) || defined(CONFIG_DRM_I915_MODULE) | 1759 | int opregion = 0; |
| 1749 | struct pci_dev *dev = NULL; | 1760 | struct pci_dev *dev = NULL; |
| 1750 | u32 address; | 1761 | u32 address; |
| 1751 | 1762 | ||
| @@ -1754,13 +1765,15 @@ static int __init intel_opregion_present(void) | |||
| 1754 | continue; | 1765 | continue; |
| 1755 | if (dev->vendor != PCI_VENDOR_ID_INTEL) | 1766 | if (dev->vendor != PCI_VENDOR_ID_INTEL) |
| 1756 | continue; | 1767 | continue; |
| 1768 | /* We don't want to poke around undefined i740 registers */ | ||
| 1769 | if (is_i740(dev)) | ||
| 1770 | continue; | ||
| 1757 | pci_read_config_dword(dev, 0xfc, &address); | 1771 | pci_read_config_dword(dev, 0xfc, &address); |
| 1758 | if (!address) | 1772 | if (!address) |
| 1759 | continue; | 1773 | continue; |
| 1760 | return 1; | 1774 | opregion = 1; |
| 1761 | } | 1775 | } |
| 1762 | #endif | 1776 | return opregion; |
| 1763 | return 0; | ||
| 1764 | } | 1777 | } |
| 1765 | 1778 | ||
| 1766 | int acpi_video_register(void) | 1779 | int acpi_video_register(void) |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index 3239517f4d90..ac6a5beb28f3 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Arasan Compact Flash host controller source file | 4 | * Arasan Compact Flash host controller source file |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2011 ST Microelectronics | 6 | * Copyright (C) 2011 ST Microelectronics |
| 7 | * Viresh Kumar <viresh.kumar@st.com> | 7 | * Viresh Kumar <viresh.linux@gmail.com> |
| 8 | * | 8 | * |
| 9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
| 10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
| @@ -959,7 +959,7 @@ static struct platform_driver arasan_cf_driver = { | |||
| 959 | 959 | ||
| 960 | module_platform_driver(arasan_cf_driver); | 960 | module_platform_driver(arasan_cf_driver); |
| 961 | 961 | ||
| 962 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 962 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
| 963 | MODULE_DESCRIPTION("Arasan ATA Compact Flash driver"); | 963 | MODULE_DESCRIPTION("Arasan ATA Compact Flash driver"); |
| 964 | MODULE_LICENSE("GPL"); | 964 | MODULE_LICENSE("GPL"); |
| 965 | MODULE_ALIAS("platform:" DRIVER_NAME); | 965 | MODULE_ALIAS("platform:" DRIVER_NAME); |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 1b1cbb571d38..4b01ab3d2c24 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
| 25 | #include <linux/async.h> | 25 | #include <linux/async.h> |
| 26 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
| 27 | #include <scsi/scsi_scan.h> | ||
| 27 | 28 | ||
| 28 | #include "base.h" | 29 | #include "base.h" |
| 29 | #include "power/power.h" | 30 | #include "power/power.h" |
| @@ -100,7 +101,7 @@ static void driver_deferred_probe_add(struct device *dev) | |||
| 100 | mutex_lock(&deferred_probe_mutex); | 101 | mutex_lock(&deferred_probe_mutex); |
| 101 | if (list_empty(&dev->p->deferred_probe)) { | 102 | if (list_empty(&dev->p->deferred_probe)) { |
| 102 | dev_dbg(dev, "Added to deferred list\n"); | 103 | dev_dbg(dev, "Added to deferred list\n"); |
| 103 | list_add(&dev->p->deferred_probe, &deferred_probe_pending_list); | 104 | list_add_tail(&dev->p->deferred_probe, &deferred_probe_pending_list); |
| 104 | } | 105 | } |
| 105 | mutex_unlock(&deferred_probe_mutex); | 106 | mutex_unlock(&deferred_probe_mutex); |
| 106 | } | 107 | } |
| @@ -332,6 +333,7 @@ void wait_for_device_probe(void) | |||
| 332 | /* wait for the known devices to complete their probing */ | 333 | /* wait for the known devices to complete their probing */ |
| 333 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); | 334 | wait_event(probe_waitqueue, atomic_read(&probe_count) == 0); |
| 334 | async_synchronize_full(); | 335 | async_synchronize_full(); |
| 336 | scsi_complete_async_scans(); | ||
| 335 | } | 337 | } |
| 336 | EXPORT_SYMBOL_GPL(wait_for_device_probe); | 338 | EXPORT_SYMBOL_GPL(wait_for_device_probe); |
| 337 | 339 | ||
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index e0fb5b0435a3..9cb845e49334 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
| 1031 | dpm_wait_for_children(dev, async); | 1031 | dpm_wait_for_children(dev, async); |
| 1032 | 1032 | ||
| 1033 | if (async_error) | 1033 | if (async_error) |
| 1034 | return 0; | 1034 | goto Complete; |
| 1035 | 1035 | ||
| 1036 | pm_runtime_get_noresume(dev); | 1036 | pm_runtime_get_noresume(dev); |
| 1037 | if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) | 1037 | if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) |
| @@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
| 1040 | if (pm_wakeup_pending()) { | 1040 | if (pm_wakeup_pending()) { |
| 1041 | pm_runtime_put_sync(dev); | 1041 | pm_runtime_put_sync(dev); |
| 1042 | async_error = -EBUSY; | 1042 | async_error = -EBUSY; |
| 1043 | return 0; | 1043 | goto Complete; |
| 1044 | } | 1044 | } |
| 1045 | 1045 | ||
| 1046 | device_lock(dev); | 1046 | device_lock(dev); |
| @@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) | |||
| 1097 | } | 1097 | } |
| 1098 | 1098 | ||
| 1099 | device_unlock(dev); | 1099 | device_unlock(dev); |
| 1100 | |||
| 1101 | Complete: | ||
| 1100 | complete_all(&dev->power.completion); | 1102 | complete_all(&dev->power.completion); |
| 1101 | 1103 | ||
| 1102 | if (error) { | 1104 | if (error) { |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 0bcda488f11c..c89aa01fb1de 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
| @@ -246,11 +246,11 @@ struct regmap *regmap_init(struct device *dev, | |||
| 246 | map->lock = regmap_lock_mutex; | 246 | map->lock = regmap_lock_mutex; |
| 247 | map->unlock = regmap_unlock_mutex; | 247 | map->unlock = regmap_unlock_mutex; |
| 248 | } | 248 | } |
| 249 | map->format.buf_size = (config->reg_bits + config->val_bits) / 8; | ||
| 250 | map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8); | 249 | map->format.reg_bytes = DIV_ROUND_UP(config->reg_bits, 8); |
| 251 | map->format.pad_bytes = config->pad_bits / 8; | 250 | map->format.pad_bytes = config->pad_bits / 8; |
| 252 | map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8); | 251 | map->format.val_bytes = DIV_ROUND_UP(config->val_bits, 8); |
| 253 | map->format.buf_size += map->format.pad_bytes; | 252 | map->format.buf_size = DIV_ROUND_UP(config->reg_bits + |
| 253 | config->val_bits + config->pad_bits, 8); | ||
| 254 | map->reg_shift = config->pad_bits % 8; | 254 | map->reg_shift = config->pad_bits % 8; |
| 255 | if (config->reg_stride) | 255 | if (config->reg_stride) |
| 256 | map->reg_stride = config->reg_stride; | 256 | map->reg_stride = config->reg_stride; |
| @@ -368,7 +368,7 @@ struct regmap *regmap_init(struct device *dev, | |||
| 368 | 368 | ||
| 369 | ret = regcache_init(map, config); | 369 | ret = regcache_init(map, config); |
| 370 | if (ret < 0) | 370 | if (ret < 0) |
| 371 | goto err_free_workbuf; | 371 | goto err_debugfs; |
| 372 | 372 | ||
| 373 | /* Add a devres resource for dev_get_regmap() */ | 373 | /* Add a devres resource for dev_get_regmap() */ |
| 374 | m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL); | 374 | m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL); |
| @@ -383,7 +383,8 @@ struct regmap *regmap_init(struct device *dev, | |||
| 383 | 383 | ||
| 384 | err_cache: | 384 | err_cache: |
| 385 | regcache_exit(map); | 385 | regcache_exit(map); |
| 386 | err_free_workbuf: | 386 | err_debugfs: |
| 387 | regmap_debugfs_exit(map); | ||
| 387 | kfree(map->work_buf); | 388 | kfree(map->work_buf); |
| 388 | err_map: | 389 | err_map: |
| 389 | kfree(map); | 390 | kfree(map); |
| @@ -471,6 +472,7 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config) | |||
| 471 | 472 | ||
| 472 | return ret; | 473 | return ret; |
| 473 | } | 474 | } |
| 475 | EXPORT_SYMBOL_GPL(regmap_reinit_cache); | ||
| 474 | 476 | ||
| 475 | /** | 477 | /** |
| 476 | * regmap_exit(): Free a previously allocated register map | 478 | * regmap_exit(): Free a previously allocated register map |
diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c index a058842f14fd..61ce4054b3c3 100644 --- a/drivers/bcma/driver_chipcommon_pmu.c +++ b/drivers/bcma/driver_chipcommon_pmu.c | |||
| @@ -139,7 +139,9 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc) | |||
| 139 | bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x7); | 139 | bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x7); |
| 140 | break; | 140 | break; |
| 141 | case 0x4331: | 141 | case 0x4331: |
| 142 | /* BCM4331 workaround is SPROM-related, we put it in sprom.c */ | 142 | case 43431: |
| 143 | /* Ext PA lines must be enabled for tx on BCM4331 */ | ||
| 144 | bcma_chipco_bcm4331_ext_pa_lines_ctl(cc, true); | ||
| 143 | break; | 145 | break; |
| 144 | case 43224: | 146 | case 43224: |
| 145 | if (bus->chipinfo.rev == 0) { | 147 | if (bus->chipinfo.rev == 0) { |
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c index 9a96f14c8f47..c32ebd537abe 100644 --- a/drivers/bcma/driver_pci.c +++ b/drivers/bcma/driver_pci.c | |||
| @@ -232,17 +232,19 @@ void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc) | |||
| 232 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, | 232 | int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc, struct bcma_device *core, |
| 233 | bool enable) | 233 | bool enable) |
| 234 | { | 234 | { |
| 235 | struct pci_dev *pdev = pc->core->bus->host_pci; | 235 | struct pci_dev *pdev; |
| 236 | u32 coremask, tmp; | 236 | u32 coremask, tmp; |
| 237 | int err = 0; | 237 | int err = 0; |
| 238 | 238 | ||
| 239 | if (core->bus->hosttype != BCMA_HOSTTYPE_PCI) { | 239 | if (!pc || core->bus->hosttype != BCMA_HOSTTYPE_PCI) { |
| 240 | /* This bcma device is not on a PCI host-bus. So the IRQs are | 240 | /* This bcma device is not on a PCI host-bus. So the IRQs are |
| 241 | * not routed through the PCI core. | 241 | * not routed through the PCI core. |
| 242 | * So we must not enable routing through the PCI core. */ | 242 | * So we must not enable routing through the PCI core. */ |
| 243 | goto out; | 243 | goto out; |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | pdev = pc->core->bus->host_pci; | ||
| 247 | |||
| 246 | err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); | 248 | err = pci_read_config_dword(pdev, BCMA_PCI_IRQMASK, &tmp); |
| 247 | if (err) | 249 | if (err) |
| 248 | goto out; | 250 | goto out; |
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index c7f93359acb0..f16f42d36071 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c | |||
| @@ -579,13 +579,13 @@ int bcma_sprom_get(struct bcma_bus *bus) | |||
| 579 | if (!sprom) | 579 | if (!sprom) |
| 580 | return -ENOMEM; | 580 | return -ENOMEM; |
| 581 | 581 | ||
| 582 | if (bus->chipinfo.id == 0x4331) | 582 | if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431) |
| 583 | bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false); | 583 | bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false); |
| 584 | 584 | ||
| 585 | pr_debug("SPROM offset 0x%x\n", offset); | 585 | pr_debug("SPROM offset 0x%x\n", offset); |
| 586 | bcma_sprom_read(bus, offset, sprom); | 586 | bcma_sprom_read(bus, offset, sprom); |
| 587 | 587 | ||
| 588 | if (bus->chipinfo.id == 0x4331) | 588 | if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431) |
| 589 | bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true); | 589 | bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true); |
| 590 | 590 | ||
| 591 | err = bcma_sprom_valid(sprom); | 591 | err = bcma_sprom_valid(sprom); |
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c index e54e31b02b88..3fbef018ce55 100644 --- a/drivers/block/drbd/drbd_actlog.c +++ b/drivers/block/drbd/drbd_actlog.c | |||
| @@ -411,7 +411,7 @@ w_al_write_transaction(struct drbd_conf *mdev, struct drbd_work *w, int unused) | |||
| 411 | + mdev->ldev->md.al_offset + mdev->al_tr_pos; | 411 | + mdev->ldev->md.al_offset + mdev->al_tr_pos; |
| 412 | 412 | ||
| 413 | if (!drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) | 413 | if (!drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) |
| 414 | drbd_chk_io_error(mdev, 1, true); | 414 | drbd_chk_io_error(mdev, 1, DRBD_META_IO_ERROR); |
| 415 | 415 | ||
| 416 | if (++mdev->al_tr_pos > | 416 | if (++mdev->al_tr_pos > |
| 417 | div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT)) | 417 | div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT)) |
| @@ -876,7 +876,11 @@ int __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, int size, | |||
| 876 | unsigned int enr, count = 0; | 876 | unsigned int enr, count = 0; |
| 877 | struct lc_element *e; | 877 | struct lc_element *e; |
| 878 | 878 | ||
| 879 | if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_BIO_SIZE) { | 879 | /* this should be an empty REQ_FLUSH */ |
| 880 | if (size == 0) | ||
| 881 | return 0; | ||
| 882 | |||
| 883 | if (size < 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_BIO_SIZE) { | ||
| 880 | dev_err(DEV, "sector: %llus, size: %d\n", | 884 | dev_err(DEV, "sector: %llus, size: %d\n", |
| 881 | (unsigned long long)sector, size); | 885 | (unsigned long long)sector, size); |
| 882 | return 0; | 886 | return 0; |
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index fcb956bb4b4c..ba91b408abad 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c | |||
| @@ -1096,7 +1096,7 @@ static int bm_rw(struct drbd_conf *mdev, int rw, unsigned flags, unsigned lazy_w | |||
| 1096 | 1096 | ||
| 1097 | if (ctx->error) { | 1097 | if (ctx->error) { |
| 1098 | dev_alert(DEV, "we had at least one MD IO ERROR during bitmap IO\n"); | 1098 | dev_alert(DEV, "we had at least one MD IO ERROR during bitmap IO\n"); |
| 1099 | drbd_chk_io_error(mdev, 1, true); | 1099 | drbd_chk_io_error(mdev, 1, DRBD_META_IO_ERROR); |
| 1100 | err = -EIO; /* ctx->error ? */ | 1100 | err = -EIO; /* ctx->error ? */ |
| 1101 | } | 1101 | } |
| 1102 | 1102 | ||
| @@ -1212,7 +1212,7 @@ int drbd_bm_write_page(struct drbd_conf *mdev, unsigned int idx) __must_hold(loc | |||
| 1212 | wait_until_done_or_disk_failure(mdev, mdev->ldev, &ctx->done); | 1212 | wait_until_done_or_disk_failure(mdev, mdev->ldev, &ctx->done); |
| 1213 | 1213 | ||
| 1214 | if (ctx->error) | 1214 | if (ctx->error) |
| 1215 | drbd_chk_io_error(mdev, 1, true); | 1215 | drbd_chk_io_error(mdev, 1, DRBD_META_IO_ERROR); |
| 1216 | /* that should force detach, so the in memory bitmap will be | 1216 | /* that should force detach, so the in memory bitmap will be |
| 1217 | * gone in a moment as well. */ | 1217 | * gone in a moment as well. */ |
| 1218 | 1218 | ||
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h index 02f013a073a7..b2ca143d0053 100644 --- a/drivers/block/drbd/drbd_int.h +++ b/drivers/block/drbd/drbd_int.h | |||
| @@ -813,7 +813,6 @@ enum { | |||
| 813 | SIGNAL_ASENDER, /* whether asender wants to be interrupted */ | 813 | SIGNAL_ASENDER, /* whether asender wants to be interrupted */ |
| 814 | SEND_PING, /* whether asender should send a ping asap */ | 814 | SEND_PING, /* whether asender should send a ping asap */ |
| 815 | 815 | ||
| 816 | UNPLUG_QUEUED, /* only relevant with kernel 2.4 */ | ||
| 817 | UNPLUG_REMOTE, /* sending a "UnplugRemote" could help */ | 816 | UNPLUG_REMOTE, /* sending a "UnplugRemote" could help */ |
| 818 | MD_DIRTY, /* current uuids and flags not yet on disk */ | 817 | MD_DIRTY, /* current uuids and flags not yet on disk */ |
| 819 | DISCARD_CONCURRENT, /* Set on one node, cleared on the peer! */ | 818 | DISCARD_CONCURRENT, /* Set on one node, cleared on the peer! */ |
| @@ -824,7 +823,6 @@ enum { | |||
| 824 | CRASHED_PRIMARY, /* This node was a crashed primary. | 823 | CRASHED_PRIMARY, /* This node was a crashed primary. |
| 825 | * Gets cleared when the state.conn | 824 | * Gets cleared when the state.conn |
| 826 | * goes into C_CONNECTED state. */ | 825 | * goes into C_CONNECTED state. */ |
| 827 | NO_BARRIER_SUPP, /* underlying block device doesn't implement barriers */ | ||
| 828 | CONSIDER_RESYNC, | 826 | CONSIDER_RESYNC, |
| 829 | 827 | ||
| 830 | MD_NO_FUA, /* Users wants us to not use FUA/FLUSH on meta data dev */ | 828 | MD_NO_FUA, /* Users wants us to not use FUA/FLUSH on meta data dev */ |
| @@ -834,6 +832,7 @@ enum { | |||
| 834 | BITMAP_IO_QUEUED, /* Started bitmap IO */ | 832 | BITMAP_IO_QUEUED, /* Started bitmap IO */ |
| 835 | GO_DISKLESS, /* Disk is being detached, on io-error or admin request. */ | 833 | GO_DISKLESS, /* Disk is being detached, on io-error or admin request. */ |
| 836 | WAS_IO_ERROR, /* Local disk failed returned IO error */ | 834 | WAS_IO_ERROR, /* Local disk failed returned IO error */ |
| 835 | FORCE_DETACH, /* Force-detach from local disk, aborting any pending local IO */ | ||
| 837 | RESYNC_AFTER_NEG, /* Resync after online grow after the attach&negotiate finished. */ | 836 | RESYNC_AFTER_NEG, /* Resync after online grow after the attach&negotiate finished. */ |
| 838 | NET_CONGESTED, /* The data socket is congested */ | 837 | NET_CONGESTED, /* The data socket is congested */ |
| 839 | 838 | ||
| @@ -851,6 +850,13 @@ enum { | |||
| 851 | AL_SUSPENDED, /* Activity logging is currently suspended. */ | 850 | AL_SUSPENDED, /* Activity logging is currently suspended. */ |
| 852 | AHEAD_TO_SYNC_SOURCE, /* Ahead -> SyncSource queued */ | 851 | AHEAD_TO_SYNC_SOURCE, /* Ahead -> SyncSource queued */ |
| 853 | STATE_SENT, /* Do not change state/UUIDs while this is set */ | 852 | STATE_SENT, /* Do not change state/UUIDs while this is set */ |
| 853 | |||
| 854 | CALLBACK_PENDING, /* Whether we have a call_usermodehelper(, UMH_WAIT_PROC) | ||
| 855 | * pending, from drbd worker context. | ||
| 856 | * If set, bdi_write_congested() returns true, | ||
| 857 | * so shrink_page_list() would not recurse into, | ||
| 858 | * and potentially deadlock on, this drbd worker. | ||
| 859 | */ | ||
| 854 | }; | 860 | }; |
| 855 | 861 | ||
| 856 | struct drbd_bitmap; /* opaque for drbd_conf */ | 862 | struct drbd_bitmap; /* opaque for drbd_conf */ |
| @@ -1130,8 +1136,8 @@ struct drbd_conf { | |||
| 1130 | int rs_in_flight; /* resync sectors in flight (to proxy, in proxy and from proxy) */ | 1136 | int rs_in_flight; /* resync sectors in flight (to proxy, in proxy and from proxy) */ |
| 1131 | int rs_planed; /* resync sectors already planned */ | 1137 | int rs_planed; /* resync sectors already planned */ |
| 1132 | atomic_t ap_in_flight; /* App sectors in flight (waiting for ack) */ | 1138 | atomic_t ap_in_flight; /* App sectors in flight (waiting for ack) */ |
| 1133 | int peer_max_bio_size; | 1139 | unsigned int peer_max_bio_size; |
| 1134 | int local_max_bio_size; | 1140 | unsigned int local_max_bio_size; |
| 1135 | }; | 1141 | }; |
| 1136 | 1142 | ||
| 1137 | static inline struct drbd_conf *minor_to_mdev(unsigned int minor) | 1143 | static inline struct drbd_conf *minor_to_mdev(unsigned int minor) |
| @@ -1435,9 +1441,9 @@ struct bm_extent { | |||
| 1435 | * hash table. */ | 1441 | * hash table. */ |
| 1436 | #define HT_SHIFT 8 | 1442 | #define HT_SHIFT 8 |
| 1437 | #define DRBD_MAX_BIO_SIZE (1U<<(9+HT_SHIFT)) | 1443 | #define DRBD_MAX_BIO_SIZE (1U<<(9+HT_SHIFT)) |
| 1438 | #define DRBD_MAX_BIO_SIZE_SAFE (1 << 12) /* Works always = 4k */ | 1444 | #define DRBD_MAX_BIO_SIZE_SAFE (1U << 12) /* Works always = 4k */ |
| 1439 | 1445 | ||
| 1440 | #define DRBD_MAX_SIZE_H80_PACKET (1 << 15) /* The old header only allows packets up to 32Kib data */ | 1446 | #define DRBD_MAX_SIZE_H80_PACKET (1U << 15) /* The old header only allows packets up to 32Kib data */ |
| 1441 | 1447 | ||
| 1442 | /* Number of elements in the app_reads_hash */ | 1448 | /* Number of elements in the app_reads_hash */ |
| 1443 | #define APP_R_HSIZE 15 | 1449 | #define APP_R_HSIZE 15 |
| @@ -1840,12 +1846,20 @@ static inline int drbd_request_state(struct drbd_conf *mdev, | |||
| 1840 | return _drbd_request_state(mdev, mask, val, CS_VERBOSE + CS_ORDERED); | 1846 | return _drbd_request_state(mdev, mask, val, CS_VERBOSE + CS_ORDERED); |
| 1841 | } | 1847 | } |
| 1842 | 1848 | ||
| 1849 | enum drbd_force_detach_flags { | ||
| 1850 | DRBD_IO_ERROR, | ||
| 1851 | DRBD_META_IO_ERROR, | ||
| 1852 | DRBD_FORCE_DETACH, | ||
| 1853 | }; | ||
| 1854 | |||
| 1843 | #define __drbd_chk_io_error(m,f) __drbd_chk_io_error_(m,f, __func__) | 1855 | #define __drbd_chk_io_error(m,f) __drbd_chk_io_error_(m,f, __func__) |
| 1844 | static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach, const char *where) | 1856 | static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, |
| 1857 | enum drbd_force_detach_flags forcedetach, | ||
| 1858 | const char *where) | ||
| 1845 | { | 1859 | { |
| 1846 | switch (mdev->ldev->dc.on_io_error) { | 1860 | switch (mdev->ldev->dc.on_io_error) { |
| 1847 | case EP_PASS_ON: | 1861 | case EP_PASS_ON: |
| 1848 | if (!forcedetach) { | 1862 | if (forcedetach == DRBD_IO_ERROR) { |
| 1849 | if (__ratelimit(&drbd_ratelimit_state)) | 1863 | if (__ratelimit(&drbd_ratelimit_state)) |
| 1850 | dev_err(DEV, "Local IO failed in %s.\n", where); | 1864 | dev_err(DEV, "Local IO failed in %s.\n", where); |
| 1851 | if (mdev->state.disk > D_INCONSISTENT) | 1865 | if (mdev->state.disk > D_INCONSISTENT) |
| @@ -1856,6 +1870,8 @@ static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach, | |||
| 1856 | case EP_DETACH: | 1870 | case EP_DETACH: |
| 1857 | case EP_CALL_HELPER: | 1871 | case EP_CALL_HELPER: |
| 1858 | set_bit(WAS_IO_ERROR, &mdev->flags); | 1872 | set_bit(WAS_IO_ERROR, &mdev->flags); |
| 1873 | if (forcedetach == DRBD_FORCE_DETACH) | ||
| 1874 | set_bit(FORCE_DETACH, &mdev->flags); | ||
| 1859 | if (mdev->state.disk > D_FAILED) { | 1875 | if (mdev->state.disk > D_FAILED) { |
| 1860 | _drbd_set_state(_NS(mdev, disk, D_FAILED), CS_HARD, NULL); | 1876 | _drbd_set_state(_NS(mdev, disk, D_FAILED), CS_HARD, NULL); |
| 1861 | dev_err(DEV, | 1877 | dev_err(DEV, |
| @@ -1875,7 +1891,7 @@ static inline void __drbd_chk_io_error_(struct drbd_conf *mdev, int forcedetach, | |||
| 1875 | */ | 1891 | */ |
| 1876 | #define drbd_chk_io_error(m,e,f) drbd_chk_io_error_(m,e,f, __func__) | 1892 | #define drbd_chk_io_error(m,e,f) drbd_chk_io_error_(m,e,f, __func__) |
| 1877 | static inline void drbd_chk_io_error_(struct drbd_conf *mdev, | 1893 | static inline void drbd_chk_io_error_(struct drbd_conf *mdev, |
| 1878 | int error, int forcedetach, const char *where) | 1894 | int error, enum drbd_force_detach_flags forcedetach, const char *where) |
| 1879 | { | 1895 | { |
| 1880 | if (error) { | 1896 | if (error) { |
| 1881 | unsigned long flags; | 1897 | unsigned long flags; |
| @@ -2405,15 +2421,17 @@ static inline void dec_ap_bio(struct drbd_conf *mdev) | |||
| 2405 | int ap_bio = atomic_dec_return(&mdev->ap_bio_cnt); | 2421 | int ap_bio = atomic_dec_return(&mdev->ap_bio_cnt); |
| 2406 | 2422 | ||
| 2407 | D_ASSERT(ap_bio >= 0); | 2423 | D_ASSERT(ap_bio >= 0); |
| 2424 | |||
| 2425 | if (ap_bio == 0 && test_bit(BITMAP_IO, &mdev->flags)) { | ||
| 2426 | if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags)) | ||
| 2427 | drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w); | ||
| 2428 | } | ||
| 2429 | |||
| 2408 | /* this currently does wake_up for every dec_ap_bio! | 2430 | /* this currently does wake_up for every dec_ap_bio! |
| 2409 | * maybe rather introduce some type of hysteresis? | 2431 | * maybe rather introduce some type of hysteresis? |
| 2410 | * e.g. (ap_bio == mxb/2 || ap_bio == 0) ? */ | 2432 | * e.g. (ap_bio == mxb/2 || ap_bio == 0) ? */ |
| 2411 | if (ap_bio < mxb) | 2433 | if (ap_bio < mxb) |
| 2412 | wake_up(&mdev->misc_wait); | 2434 | wake_up(&mdev->misc_wait); |
| 2413 | if (ap_bio == 0 && test_bit(BITMAP_IO, &mdev->flags)) { | ||
| 2414 | if (!test_and_set_bit(BITMAP_IO_QUEUED, &mdev->flags)) | ||
| 2415 | drbd_queue_work(&mdev->data.work, &mdev->bm_io_work.w); | ||
| 2416 | } | ||
| 2417 | } | 2435 | } |
| 2418 | 2436 | ||
| 2419 | static inline int drbd_set_ed_uuid(struct drbd_conf *mdev, u64 val) | 2437 | static inline int drbd_set_ed_uuid(struct drbd_conf *mdev, u64 val) |
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 920ede2829d6..2e0e7fc1dbba 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
| @@ -1514,6 +1514,13 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
| 1514 | 1514 | ||
| 1515 | /* Do not change the order of the if above and the two below... */ | 1515 | /* Do not change the order of the if above and the two below... */ |
| 1516 | if (os.pdsk == D_DISKLESS && ns.pdsk > D_DISKLESS) { /* attach on the peer */ | 1516 | if (os.pdsk == D_DISKLESS && ns.pdsk > D_DISKLESS) { /* attach on the peer */ |
| 1517 | /* we probably will start a resync soon. | ||
| 1518 | * make sure those things are properly reset. */ | ||
| 1519 | mdev->rs_total = 0; | ||
| 1520 | mdev->rs_failed = 0; | ||
| 1521 | atomic_set(&mdev->rs_pending_cnt, 0); | ||
| 1522 | drbd_rs_cancel_all(mdev); | ||
| 1523 | |||
| 1517 | drbd_send_uuids(mdev); | 1524 | drbd_send_uuids(mdev); |
| 1518 | drbd_send_state(mdev, ns); | 1525 | drbd_send_state(mdev, ns); |
| 1519 | } | 1526 | } |
| @@ -1630,9 +1637,24 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
| 1630 | eh = mdev->ldev->dc.on_io_error; | 1637 | eh = mdev->ldev->dc.on_io_error; |
| 1631 | was_io_error = test_and_clear_bit(WAS_IO_ERROR, &mdev->flags); | 1638 | was_io_error = test_and_clear_bit(WAS_IO_ERROR, &mdev->flags); |
| 1632 | 1639 | ||
| 1633 | /* Immediately allow completion of all application IO, that waits | 1640 | if (was_io_error && eh == EP_CALL_HELPER) |
| 1634 | for completion from the local disk. */ | 1641 | drbd_khelper(mdev, "local-io-error"); |
| 1635 | tl_abort_disk_io(mdev); | 1642 | |
| 1643 | /* Immediately allow completion of all application IO, | ||
| 1644 | * that waits for completion from the local disk, | ||
| 1645 | * if this was a force-detach due to disk_timeout | ||
| 1646 | * or administrator request (drbdsetup detach --force). | ||
| 1647 | * Do NOT abort otherwise. | ||
| 1648 | * Aborting local requests may cause serious problems, | ||
| 1649 | * if requests are completed to upper layers already, | ||
| 1650 | * and then later the already submitted local bio completes. | ||
| 1651 | * This can cause DMA into former bio pages that meanwhile | ||
| 1652 | * have been re-used for other things. | ||
| 1653 | * So aborting local requests may cause crashes, | ||
| 1654 | * or even worse, silent data corruption. | ||
| 1655 | */ | ||
| 1656 | if (test_and_clear_bit(FORCE_DETACH, &mdev->flags)) | ||
| 1657 | tl_abort_disk_io(mdev); | ||
| 1636 | 1658 | ||
| 1637 | /* current state still has to be D_FAILED, | 1659 | /* current state still has to be D_FAILED, |
| 1638 | * there is only one way out: to D_DISKLESS, | 1660 | * there is only one way out: to D_DISKLESS, |
| @@ -1653,9 +1675,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
| 1653 | drbd_md_sync(mdev); | 1675 | drbd_md_sync(mdev); |
| 1654 | } | 1676 | } |
| 1655 | put_ldev(mdev); | 1677 | put_ldev(mdev); |
| 1656 | |||
| 1657 | if (was_io_error && eh == EP_CALL_HELPER) | ||
| 1658 | drbd_khelper(mdev, "local-io-error"); | ||
| 1659 | } | 1678 | } |
| 1660 | 1679 | ||
| 1661 | /* second half of local IO error, failure to attach, | 1680 | /* second half of local IO error, failure to attach, |
| @@ -1669,10 +1688,6 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
| 1669 | "ASSERT FAILED: disk is %s while going diskless\n", | 1688 | "ASSERT FAILED: disk is %s while going diskless\n", |
| 1670 | drbd_disk_str(mdev->state.disk)); | 1689 | drbd_disk_str(mdev->state.disk)); |
| 1671 | 1690 | ||
| 1672 | mdev->rs_total = 0; | ||
| 1673 | mdev->rs_failed = 0; | ||
| 1674 | atomic_set(&mdev->rs_pending_cnt, 0); | ||
| 1675 | |||
| 1676 | if (ns.conn >= C_CONNECTED) | 1691 | if (ns.conn >= C_CONNECTED) |
| 1677 | drbd_send_state(mdev, ns); | 1692 | drbd_send_state(mdev, ns); |
| 1678 | 1693 | ||
| @@ -2194,7 +2209,8 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
| 2194 | { | 2209 | { |
| 2195 | struct p_sizes p; | 2210 | struct p_sizes p; |
| 2196 | sector_t d_size, u_size; | 2211 | sector_t d_size, u_size; |
| 2197 | int q_order_type, max_bio_size; | 2212 | int q_order_type; |
| 2213 | unsigned int max_bio_size; | ||
| 2198 | int ok; | 2214 | int ok; |
| 2199 | 2215 | ||
| 2200 | if (get_ldev_if_state(mdev, D_NEGOTIATING)) { | 2216 | if (get_ldev_if_state(mdev, D_NEGOTIATING)) { |
| @@ -2203,7 +2219,7 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
| 2203 | u_size = mdev->ldev->dc.disk_size; | 2219 | u_size = mdev->ldev->dc.disk_size; |
| 2204 | q_order_type = drbd_queue_order_type(mdev); | 2220 | q_order_type = drbd_queue_order_type(mdev); |
| 2205 | max_bio_size = queue_max_hw_sectors(mdev->ldev->backing_bdev->bd_disk->queue) << 9; | 2221 | max_bio_size = queue_max_hw_sectors(mdev->ldev->backing_bdev->bd_disk->queue) << 9; |
| 2206 | max_bio_size = min_t(int, max_bio_size, DRBD_MAX_BIO_SIZE); | 2222 | max_bio_size = min(max_bio_size, DRBD_MAX_BIO_SIZE); |
| 2207 | put_ldev(mdev); | 2223 | put_ldev(mdev); |
| 2208 | } else { | 2224 | } else { |
| 2209 | d_size = 0; | 2225 | d_size = 0; |
| @@ -2214,7 +2230,7 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl | |||
| 2214 | 2230 | ||
| 2215 | /* Never allow old drbd (up to 8.3.7) to see more than 32KiB */ | 2231 | /* Never allow old drbd (up to 8.3.7) to see more than 32KiB */ |
| 2216 | if (mdev->agreed_pro_version <= 94) | 2232 | if (mdev->agreed_pro_version <= 94) |
| 2217 | max_bio_size = min_t(int, max_bio_size, DRBD_MAX_SIZE_H80_PACKET); | 2233 | max_bio_size = min(max_bio_size, DRBD_MAX_SIZE_H80_PACKET); |
| 2218 | 2234 | ||
| 2219 | p.d_size = cpu_to_be64(d_size); | 2235 | p.d_size = cpu_to_be64(d_size); |
| 2220 | p.u_size = cpu_to_be64(u_size); | 2236 | p.u_size = cpu_to_be64(u_size); |
| @@ -3541,6 +3557,22 @@ static int drbd_congested(void *congested_data, int bdi_bits) | |||
| 3541 | goto out; | 3557 | goto out; |
| 3542 | } | 3558 | } |
| 3543 | 3559 | ||
| 3560 | if (test_bit(CALLBACK_PENDING, &mdev->flags)) { | ||
| 3561 | r |= (1 << BDI_async_congested); | ||
| 3562 | /* Without good local data, we would need to read from remote, | ||
| 3563 | * and that would need the worker thread as well, which is | ||
| 3564 | * currently blocked waiting for that usermode helper to | ||
| 3565 | * finish. | ||
| 3566 | */ | ||
| 3567 | if (!get_ldev_if_state(mdev, D_UP_TO_DATE)) | ||
| 3568 | r |= (1 << BDI_sync_congested); | ||
| 3569 | else | ||
| 3570 | put_ldev(mdev); | ||
| 3571 | r &= bdi_bits; | ||
| 3572 | reason = 'c'; | ||
| 3573 | goto out; | ||
| 3574 | } | ||
| 3575 | |||
| 3544 | if (get_ldev(mdev)) { | 3576 | if (get_ldev(mdev)) { |
| 3545 | q = bdev_get_queue(mdev->ldev->backing_bdev); | 3577 | q = bdev_get_queue(mdev->ldev->backing_bdev); |
| 3546 | r = bdi_congested(&q->backing_dev_info, bdi_bits); | 3578 | r = bdi_congested(&q->backing_dev_info, bdi_bits); |
| @@ -3604,6 +3636,7 @@ struct drbd_conf *drbd_new_device(unsigned int minor) | |||
| 3604 | q->backing_dev_info.congested_data = mdev; | 3636 | q->backing_dev_info.congested_data = mdev; |
| 3605 | 3637 | ||
| 3606 | blk_queue_make_request(q, drbd_make_request); | 3638 | blk_queue_make_request(q, drbd_make_request); |
| 3639 | blk_queue_flush(q, REQ_FLUSH | REQ_FUA); | ||
| 3607 | /* Setting the max_hw_sectors to an odd value of 8kibyte here | 3640 | /* Setting the max_hw_sectors to an odd value of 8kibyte here |
| 3608 | This triggers a max_bio_size message upon first attach or connect */ | 3641 | This triggers a max_bio_size message upon first attach or connect */ |
| 3609 | blk_queue_max_hw_sectors(q, DRBD_MAX_BIO_SIZE_SAFE >> 8); | 3642 | blk_queue_max_hw_sectors(q, DRBD_MAX_BIO_SIZE_SAFE >> 8); |
| @@ -3870,7 +3903,7 @@ void drbd_md_sync(struct drbd_conf *mdev) | |||
| 3870 | if (!drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) { | 3903 | if (!drbd_md_sync_page_io(mdev, mdev->ldev, sector, WRITE)) { |
| 3871 | /* this was a try anyways ... */ | 3904 | /* this was a try anyways ... */ |
| 3872 | dev_err(DEV, "meta data update failed!\n"); | 3905 | dev_err(DEV, "meta data update failed!\n"); |
| 3873 | drbd_chk_io_error(mdev, 1, true); | 3906 | drbd_chk_io_error(mdev, 1, DRBD_META_IO_ERROR); |
| 3874 | } | 3907 | } |
| 3875 | 3908 | ||
| 3876 | /* Update mdev->ldev->md.la_size_sect, | 3909 | /* Update mdev->ldev->md.la_size_sect, |
| @@ -3950,9 +3983,9 @@ int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev) | |||
| 3950 | 3983 | ||
| 3951 | spin_lock_irq(&mdev->req_lock); | 3984 | spin_lock_irq(&mdev->req_lock); |
| 3952 | if (mdev->state.conn < C_CONNECTED) { | 3985 | if (mdev->state.conn < C_CONNECTED) { |
| 3953 | int peer; | 3986 | unsigned int peer; |
| 3954 | peer = be32_to_cpu(buffer->la_peer_max_bio_size); | 3987 | peer = be32_to_cpu(buffer->la_peer_max_bio_size); |
| 3955 | peer = max_t(int, peer, DRBD_MAX_BIO_SIZE_SAFE); | 3988 | peer = max(peer, DRBD_MAX_BIO_SIZE_SAFE); |
| 3956 | mdev->peer_max_bio_size = peer; | 3989 | mdev->peer_max_bio_size = peer; |
| 3957 | } | 3990 | } |
| 3958 | spin_unlock_irq(&mdev->req_lock); | 3991 | spin_unlock_irq(&mdev->req_lock); |
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 6d4de6a72e80..fb9dce8daa24 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c | |||
| @@ -147,6 +147,9 @@ int drbd_khelper(struct drbd_conf *mdev, char *cmd) | |||
| 147 | char *argv[] = {usermode_helper, cmd, mb, NULL }; | 147 | char *argv[] = {usermode_helper, cmd, mb, NULL }; |
| 148 | int ret; | 148 | int ret; |
| 149 | 149 | ||
| 150 | if (current == mdev->worker.task) | ||
| 151 | set_bit(CALLBACK_PENDING, &mdev->flags); | ||
| 152 | |||
| 150 | snprintf(mb, 12, "minor-%d", mdev_to_minor(mdev)); | 153 | snprintf(mb, 12, "minor-%d", mdev_to_minor(mdev)); |
| 151 | 154 | ||
| 152 | if (get_net_conf(mdev)) { | 155 | if (get_net_conf(mdev)) { |
| @@ -189,6 +192,9 @@ int drbd_khelper(struct drbd_conf *mdev, char *cmd) | |||
| 189 | usermode_helper, cmd, mb, | 192 | usermode_helper, cmd, mb, |
| 190 | (ret >> 8) & 0xff, ret); | 193 | (ret >> 8) & 0xff, ret); |
| 191 | 194 | ||
| 195 | if (current == mdev->worker.task) | ||
| 196 | clear_bit(CALLBACK_PENDING, &mdev->flags); | ||
| 197 | |||
| 192 | if (ret < 0) /* Ignore any ERRNOs we got. */ | 198 | if (ret < 0) /* Ignore any ERRNOs we got. */ |
| 193 | ret = 0; | 199 | ret = 0; |
| 194 | 200 | ||
| @@ -795,8 +801,8 @@ static int drbd_check_al_size(struct drbd_conf *mdev) | |||
| 795 | static void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int max_bio_size) | 801 | static void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int max_bio_size) |
| 796 | { | 802 | { |
| 797 | struct request_queue * const q = mdev->rq_queue; | 803 | struct request_queue * const q = mdev->rq_queue; |
| 798 | int max_hw_sectors = max_bio_size >> 9; | 804 | unsigned int max_hw_sectors = max_bio_size >> 9; |
| 799 | int max_segments = 0; | 805 | unsigned int max_segments = 0; |
| 800 | 806 | ||
| 801 | if (get_ldev_if_state(mdev, D_ATTACHING)) { | 807 | if (get_ldev_if_state(mdev, D_ATTACHING)) { |
| 802 | struct request_queue * const b = mdev->ldev->backing_bdev->bd_disk->queue; | 808 | struct request_queue * const b = mdev->ldev->backing_bdev->bd_disk->queue; |
| @@ -829,7 +835,7 @@ static void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int max_bio_ | |||
| 829 | 835 | ||
| 830 | void drbd_reconsider_max_bio_size(struct drbd_conf *mdev) | 836 | void drbd_reconsider_max_bio_size(struct drbd_conf *mdev) |
| 831 | { | 837 | { |
| 832 | int now, new, local, peer; | 838 | unsigned int now, new, local, peer; |
| 833 | 839 | ||
| 834 | now = queue_max_hw_sectors(mdev->rq_queue) << 9; | 840 | now = queue_max_hw_sectors(mdev->rq_queue) << 9; |
| 835 | local = mdev->local_max_bio_size; /* Eventually last known value, from volatile memory */ | 841 | local = mdev->local_max_bio_size; /* Eventually last known value, from volatile memory */ |
| @@ -840,13 +846,14 @@ void drbd_reconsider_max_bio_size(struct drbd_conf *mdev) | |||
| 840 | mdev->local_max_bio_size = local; | 846 | mdev->local_max_bio_size = local; |
| 841 | put_ldev(mdev); | 847 | put_ldev(mdev); |
| 842 | } | 848 | } |
| 849 | local = min(local, DRBD_MAX_BIO_SIZE); | ||
| 843 | 850 | ||
| 844 | /* We may ignore peer limits if the peer is modern enough. | 851 | /* We may ignore peer limits if the peer is modern enough. |
| 845 | Because new from 8.3.8 onwards the peer can use multiple | 852 | Because new from 8.3.8 onwards the peer can use multiple |
| 846 | BIOs for a single peer_request */ | 853 | BIOs for a single peer_request */ |
| 847 | if (mdev->state.conn >= C_CONNECTED) { | 854 | if (mdev->state.conn >= C_CONNECTED) { |
| 848 | if (mdev->agreed_pro_version < 94) { | 855 | if (mdev->agreed_pro_version < 94) { |
| 849 | peer = min_t(int, mdev->peer_max_bio_size, DRBD_MAX_SIZE_H80_PACKET); | 856 | peer = min(mdev->peer_max_bio_size, DRBD_MAX_SIZE_H80_PACKET); |
| 850 | /* Correct old drbd (up to 8.3.7) if it believes it can do more than 32KiB */ | 857 | /* Correct old drbd (up to 8.3.7) if it believes it can do more than 32KiB */ |
| 851 | } else if (mdev->agreed_pro_version == 94) | 858 | } else if (mdev->agreed_pro_version == 94) |
| 852 | peer = DRBD_MAX_SIZE_H80_PACKET; | 859 | peer = DRBD_MAX_SIZE_H80_PACKET; |
| @@ -854,10 +861,10 @@ void drbd_reconsider_max_bio_size(struct drbd_conf *mdev) | |||
| 854 | peer = DRBD_MAX_BIO_SIZE; | 861 | peer = DRBD_MAX_BIO_SIZE; |
| 855 | } | 862 | } |
| 856 | 863 | ||
| 857 | new = min_t(int, local, peer); | 864 | new = min(local, peer); |
| 858 | 865 | ||
| 859 | if (mdev->state.role == R_PRIMARY && new < now) | 866 | if (mdev->state.role == R_PRIMARY && new < now) |
| 860 | dev_err(DEV, "ASSERT FAILED new < now; (%d < %d)\n", new, now); | 867 | dev_err(DEV, "ASSERT FAILED new < now; (%u < %u)\n", new, now); |
| 861 | 868 | ||
| 862 | if (new != now) | 869 | if (new != now) |
| 863 | dev_info(DEV, "max BIO size = %u\n", new); | 870 | dev_info(DEV, "max BIO size = %u\n", new); |
| @@ -950,6 +957,14 @@ static int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp | |||
| 950 | * to realize a "hot spare" feature (not that I'd recommend that) */ | 957 | * to realize a "hot spare" feature (not that I'd recommend that) */ |
| 951 | wait_event(mdev->misc_wait, !atomic_read(&mdev->local_cnt)); | 958 | wait_event(mdev->misc_wait, !atomic_read(&mdev->local_cnt)); |
| 952 | 959 | ||
| 960 | /* make sure there is no leftover from previous force-detach attempts */ | ||
| 961 | clear_bit(FORCE_DETACH, &mdev->flags); | ||
| 962 | |||
| 963 | /* and no leftover from previously aborted resync or verify, either */ | ||
| 964 | mdev->rs_total = 0; | ||
| 965 | mdev->rs_failed = 0; | ||
| 966 | atomic_set(&mdev->rs_pending_cnt, 0); | ||
| 967 | |||
| 953 | /* allocation not in the IO path, cqueue thread context */ | 968 | /* allocation not in the IO path, cqueue thread context */ |
| 954 | nbc = kzalloc(sizeof(struct drbd_backing_dev), GFP_KERNEL); | 969 | nbc = kzalloc(sizeof(struct drbd_backing_dev), GFP_KERNEL); |
| 955 | if (!nbc) { | 970 | if (!nbc) { |
| @@ -1345,6 +1360,7 @@ static int drbd_nl_detach(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp, | |||
| 1345 | } | 1360 | } |
| 1346 | 1361 | ||
| 1347 | if (dt.detach_force) { | 1362 | if (dt.detach_force) { |
| 1363 | set_bit(FORCE_DETACH, &mdev->flags); | ||
| 1348 | drbd_force_state(mdev, NS(disk, D_FAILED)); | 1364 | drbd_force_state(mdev, NS(disk, D_FAILED)); |
| 1349 | reply->ret_code = SS_SUCCESS; | 1365 | reply->ret_code = SS_SUCCESS; |
| 1350 | goto out; | 1366 | goto out; |
| @@ -1962,9 +1978,11 @@ static int drbd_nl_invalidate(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nl | |||
| 1962 | int retcode; | 1978 | int retcode; |
| 1963 | 1979 | ||
| 1964 | /* If there is still bitmap IO pending, probably because of a previous | 1980 | /* If there is still bitmap IO pending, probably because of a previous |
| 1965 | * resync just being finished, wait for it before requesting a new resync. */ | 1981 | * resync just being finished, wait for it before requesting a new resync. |
| 1982 | * Also wait for it's after_state_ch(). */ | ||
| 1966 | drbd_suspend_io(mdev); | 1983 | drbd_suspend_io(mdev); |
| 1967 | wait_event(mdev->misc_wait, !test_bit(BITMAP_IO, &mdev->flags)); | 1984 | wait_event(mdev->misc_wait, !test_bit(BITMAP_IO, &mdev->flags)); |
| 1985 | drbd_flush_workqueue(mdev); | ||
| 1968 | 1986 | ||
| 1969 | retcode = _drbd_request_state(mdev, NS(conn, C_STARTING_SYNC_T), CS_ORDERED); | 1987 | retcode = _drbd_request_state(mdev, NS(conn, C_STARTING_SYNC_T), CS_ORDERED); |
| 1970 | 1988 | ||
| @@ -2003,9 +2021,11 @@ static int drbd_nl_invalidate_peer(struct drbd_conf *mdev, struct drbd_nl_cfg_re | |||
| 2003 | int retcode; | 2021 | int retcode; |
| 2004 | 2022 | ||
| 2005 | /* If there is still bitmap IO pending, probably because of a previous | 2023 | /* If there is still bitmap IO pending, probably because of a previous |
| 2006 | * resync just being finished, wait for it before requesting a new resync. */ | 2024 | * resync just being finished, wait for it before requesting a new resync. |
| 2025 | * Also wait for it's after_state_ch(). */ | ||
| 2007 | drbd_suspend_io(mdev); | 2026 | drbd_suspend_io(mdev); |
| 2008 | wait_event(mdev->misc_wait, !test_bit(BITMAP_IO, &mdev->flags)); | 2027 | wait_event(mdev->misc_wait, !test_bit(BITMAP_IO, &mdev->flags)); |
| 2028 | drbd_flush_workqueue(mdev); | ||
| 2009 | 2029 | ||
| 2010 | retcode = _drbd_request_state(mdev, NS(conn, C_STARTING_SYNC_S), CS_ORDERED); | 2030 | retcode = _drbd_request_state(mdev, NS(conn, C_STARTING_SYNC_S), CS_ORDERED); |
| 2011 | 2031 | ||
diff --git a/drivers/block/drbd/drbd_proc.c b/drivers/block/drbd/drbd_proc.c index 869bada2ed06..5496104f90b9 100644 --- a/drivers/block/drbd/drbd_proc.c +++ b/drivers/block/drbd/drbd_proc.c | |||
| @@ -245,6 +245,9 @@ static int drbd_seq_show(struct seq_file *seq, void *v) | |||
| 245 | mdev->state.role == R_SECONDARY) { | 245 | mdev->state.role == R_SECONDARY) { |
| 246 | seq_printf(seq, "%2d: cs:Unconfigured\n", i); | 246 | seq_printf(seq, "%2d: cs:Unconfigured\n", i); |
| 247 | } else { | 247 | } else { |
| 248 | /* reset mdev->congestion_reason */ | ||
| 249 | bdi_rw_congested(&mdev->rq_queue->backing_dev_info); | ||
| 250 | |||
| 248 | seq_printf(seq, | 251 | seq_printf(seq, |
| 249 | "%2d: cs:%s ro:%s/%s ds:%s/%s %c %c%c%c%c%c%c\n" | 252 | "%2d: cs:%s ro:%s/%s ds:%s/%s %c %c%c%c%c%c%c\n" |
| 250 | " ns:%u nr:%u dw:%u dr:%u al:%u bm:%u " | 253 | " ns:%u nr:%u dw:%u dr:%u al:%u bm:%u " |
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index ea4836e0ae98..c74ca2df7431 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c | |||
| @@ -277,6 +277,9 @@ static void drbd_pp_free(struct drbd_conf *mdev, struct page *page, int is_net) | |||
| 277 | atomic_t *a = is_net ? &mdev->pp_in_use_by_net : &mdev->pp_in_use; | 277 | atomic_t *a = is_net ? &mdev->pp_in_use_by_net : &mdev->pp_in_use; |
| 278 | int i; | 278 | int i; |
| 279 | 279 | ||
| 280 | if (page == NULL) | ||
| 281 | return; | ||
| 282 | |||
| 280 | if (drbd_pp_vacant > (DRBD_MAX_BIO_SIZE/PAGE_SIZE)*minor_count) | 283 | if (drbd_pp_vacant > (DRBD_MAX_BIO_SIZE/PAGE_SIZE)*minor_count) |
| 281 | i = page_chain_free(page); | 284 | i = page_chain_free(page); |
| 282 | else { | 285 | else { |
| @@ -316,7 +319,7 @@ struct drbd_epoch_entry *drbd_alloc_ee(struct drbd_conf *mdev, | |||
| 316 | gfp_t gfp_mask) __must_hold(local) | 319 | gfp_t gfp_mask) __must_hold(local) |
| 317 | { | 320 | { |
| 318 | struct drbd_epoch_entry *e; | 321 | struct drbd_epoch_entry *e; |
| 319 | struct page *page; | 322 | struct page *page = NULL; |
| 320 | unsigned nr_pages = (data_size + PAGE_SIZE -1) >> PAGE_SHIFT; | 323 | unsigned nr_pages = (data_size + PAGE_SIZE -1) >> PAGE_SHIFT; |
| 321 | 324 | ||
| 322 | if (drbd_insert_fault(mdev, DRBD_FAULT_AL_EE)) | 325 | if (drbd_insert_fault(mdev, DRBD_FAULT_AL_EE)) |
| @@ -329,9 +332,11 @@ struct drbd_epoch_entry *drbd_alloc_ee(struct drbd_conf *mdev, | |||
| 329 | return NULL; | 332 | return NULL; |
| 330 | } | 333 | } |
| 331 | 334 | ||
| 332 | page = drbd_pp_alloc(mdev, nr_pages, (gfp_mask & __GFP_WAIT)); | 335 | if (data_size) { |
| 333 | if (!page) | 336 | page = drbd_pp_alloc(mdev, nr_pages, (gfp_mask & __GFP_WAIT)); |
| 334 | goto fail; | 337 | if (!page) |
| 338 | goto fail; | ||
| 339 | } | ||
| 335 | 340 | ||
| 336 | INIT_HLIST_NODE(&e->collision); | 341 | INIT_HLIST_NODE(&e->collision); |
| 337 | e->epoch = NULL; | 342 | e->epoch = NULL; |
| @@ -1270,7 +1275,6 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector, int data_size) __ | |||
| 1270 | 1275 | ||
| 1271 | data_size -= dgs; | 1276 | data_size -= dgs; |
| 1272 | 1277 | ||
| 1273 | ERR_IF(data_size == 0) return NULL; | ||
| 1274 | ERR_IF(data_size & 0x1ff) return NULL; | 1278 | ERR_IF(data_size & 0x1ff) return NULL; |
| 1275 | ERR_IF(data_size > DRBD_MAX_BIO_SIZE) return NULL; | 1279 | ERR_IF(data_size > DRBD_MAX_BIO_SIZE) return NULL; |
| 1276 | 1280 | ||
| @@ -1291,6 +1295,9 @@ read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector, int data_size) __ | |||
| 1291 | if (!e) | 1295 | if (!e) |
| 1292 | return NULL; | 1296 | return NULL; |
| 1293 | 1297 | ||
| 1298 | if (!data_size) | ||
| 1299 | return e; | ||
| 1300 | |||
| 1294 | ds = data_size; | 1301 | ds = data_size; |
| 1295 | page = e->pages; | 1302 | page = e->pages; |
| 1296 | page_chain_for_each(page) { | 1303 | page_chain_for_each(page) { |
| @@ -1715,6 +1722,10 @@ static int receive_Data(struct drbd_conf *mdev, enum drbd_packets cmd, unsigned | |||
| 1715 | 1722 | ||
| 1716 | dp_flags = be32_to_cpu(p->dp_flags); | 1723 | dp_flags = be32_to_cpu(p->dp_flags); |
| 1717 | rw |= wire_flags_to_bio(mdev, dp_flags); | 1724 | rw |= wire_flags_to_bio(mdev, dp_flags); |
| 1725 | if (e->pages == NULL) { | ||
| 1726 | D_ASSERT(e->size == 0); | ||
| 1727 | D_ASSERT(dp_flags & DP_FLUSH); | ||
| 1728 | } | ||
| 1718 | 1729 | ||
| 1719 | if (dp_flags & DP_MAY_SET_IN_SYNC) | 1730 | if (dp_flags & DP_MAY_SET_IN_SYNC) |
| 1720 | e->flags |= EE_MAY_SET_IN_SYNC; | 1731 | e->flags |= EE_MAY_SET_IN_SYNC; |
| @@ -3801,11 +3812,18 @@ void drbd_free_tl_hash(struct drbd_conf *mdev) | |||
| 3801 | mdev->ee_hash = NULL; | 3812 | mdev->ee_hash = NULL; |
| 3802 | mdev->ee_hash_s = 0; | 3813 | mdev->ee_hash_s = 0; |
| 3803 | 3814 | ||
| 3804 | /* paranoia code */ | 3815 | /* We may not have had the chance to wait for all locally pending |
| 3805 | for (h = mdev->tl_hash; h < mdev->tl_hash + mdev->tl_hash_s; h++) | 3816 | * application requests. The hlist_add_fake() prevents access after |
| 3806 | if (h->first) | 3817 | * free on master bio completion. */ |
| 3807 | dev_err(DEV, "ASSERT FAILED tl_hash[%u] == %p, expected NULL\n", | 3818 | for (h = mdev->tl_hash; h < mdev->tl_hash + mdev->tl_hash_s; h++) { |
| 3808 | (int)(h - mdev->tl_hash), h->first); | 3819 | struct drbd_request *req; |
| 3820 | struct hlist_node *pos, *n; | ||
| 3821 | hlist_for_each_entry_safe(req, pos, n, h, collision) { | ||
| 3822 | hlist_del_init(&req->collision); | ||
| 3823 | hlist_add_fake(&req->collision); | ||
| 3824 | } | ||
| 3825 | } | ||
| 3826 | |||
| 3809 | kfree(mdev->tl_hash); | 3827 | kfree(mdev->tl_hash); |
| 3810 | mdev->tl_hash = NULL; | 3828 | mdev->tl_hash = NULL; |
| 3811 | mdev->tl_hash_s = 0; | 3829 | mdev->tl_hash_s = 0; |
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c index 8e93a6ac9bb6..910335c30927 100644 --- a/drivers/block/drbd/drbd_req.c +++ b/drivers/block/drbd/drbd_req.c | |||
| @@ -455,7 +455,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
| 455 | req->rq_state |= RQ_LOCAL_COMPLETED; | 455 | req->rq_state |= RQ_LOCAL_COMPLETED; |
| 456 | req->rq_state &= ~RQ_LOCAL_PENDING; | 456 | req->rq_state &= ~RQ_LOCAL_PENDING; |
| 457 | 457 | ||
| 458 | __drbd_chk_io_error(mdev, false); | 458 | __drbd_chk_io_error(mdev, DRBD_IO_ERROR); |
| 459 | _req_may_be_done_not_susp(req, m); | 459 | _req_may_be_done_not_susp(req, m); |
| 460 | break; | 460 | break; |
| 461 | 461 | ||
| @@ -477,7 +477,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what, | |||
| 477 | break; | 477 | break; |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | __drbd_chk_io_error(mdev, false); | 480 | __drbd_chk_io_error(mdev, DRBD_IO_ERROR); |
| 481 | 481 | ||
| 482 | goto_queue_for_net_read: | 482 | goto_queue_for_net_read: |
| 483 | 483 | ||
| @@ -1111,13 +1111,12 @@ void drbd_make_request(struct request_queue *q, struct bio *bio) | |||
| 1111 | /* | 1111 | /* |
| 1112 | * what we "blindly" assume: | 1112 | * what we "blindly" assume: |
| 1113 | */ | 1113 | */ |
| 1114 | D_ASSERT(bio->bi_size > 0); | ||
| 1115 | D_ASSERT((bio->bi_size & 0x1ff) == 0); | 1114 | D_ASSERT((bio->bi_size & 0x1ff) == 0); |
| 1116 | 1115 | ||
| 1117 | /* to make some things easier, force alignment of requests within the | 1116 | /* to make some things easier, force alignment of requests within the |
| 1118 | * granularity of our hash tables */ | 1117 | * granularity of our hash tables */ |
| 1119 | s_enr = bio->bi_sector >> HT_SHIFT; | 1118 | s_enr = bio->bi_sector >> HT_SHIFT; |
| 1120 | e_enr = (bio->bi_sector+(bio->bi_size>>9)-1) >> HT_SHIFT; | 1119 | e_enr = bio->bi_size ? (bio->bi_sector+(bio->bi_size>>9)-1) >> HT_SHIFT : s_enr; |
| 1121 | 1120 | ||
| 1122 | if (likely(s_enr == e_enr)) { | 1121 | if (likely(s_enr == e_enr)) { |
| 1123 | do { | 1122 | do { |
| @@ -1275,7 +1274,7 @@ void request_timer_fn(unsigned long data) | |||
| 1275 | time_after(now, req->start_time + dt) && | 1274 | time_after(now, req->start_time + dt) && |
| 1276 | !time_in_range(now, mdev->last_reattach_jif, mdev->last_reattach_jif + dt)) { | 1275 | !time_in_range(now, mdev->last_reattach_jif, mdev->last_reattach_jif + dt)) { |
| 1277 | dev_warn(DEV, "Local backing device failed to meet the disk-timeout\n"); | 1276 | dev_warn(DEV, "Local backing device failed to meet the disk-timeout\n"); |
| 1278 | __drbd_chk_io_error(mdev, 1); | 1277 | __drbd_chk_io_error(mdev, DRBD_FORCE_DETACH); |
| 1279 | } | 1278 | } |
| 1280 | nt = (time_after(now, req->start_time + et) ? now : req->start_time) + et; | 1279 | nt = (time_after(now, req->start_time + et) ? now : req->start_time) + et; |
| 1281 | spin_unlock_irq(&mdev->req_lock); | 1280 | spin_unlock_irq(&mdev->req_lock); |
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c index 620c70ff2231..6bce2cc179d4 100644 --- a/drivers/block/drbd/drbd_worker.c +++ b/drivers/block/drbd/drbd_worker.c | |||
| @@ -111,7 +111,7 @@ void drbd_endio_read_sec_final(struct drbd_epoch_entry *e) __releases(local) | |||
| 111 | if (list_empty(&mdev->read_ee)) | 111 | if (list_empty(&mdev->read_ee)) |
| 112 | wake_up(&mdev->ee_wait); | 112 | wake_up(&mdev->ee_wait); |
| 113 | if (test_bit(__EE_WAS_ERROR, &e->flags)) | 113 | if (test_bit(__EE_WAS_ERROR, &e->flags)) |
| 114 | __drbd_chk_io_error(mdev, false); | 114 | __drbd_chk_io_error(mdev, DRBD_IO_ERROR); |
| 115 | spin_unlock_irqrestore(&mdev->req_lock, flags); | 115 | spin_unlock_irqrestore(&mdev->req_lock, flags); |
| 116 | 116 | ||
| 117 | drbd_queue_work(&mdev->data.work, &e->w); | 117 | drbd_queue_work(&mdev->data.work, &e->w); |
| @@ -154,7 +154,7 @@ static void drbd_endio_write_sec_final(struct drbd_epoch_entry *e) __releases(lo | |||
| 154 | : list_empty(&mdev->active_ee); | 154 | : list_empty(&mdev->active_ee); |
| 155 | 155 | ||
| 156 | if (test_bit(__EE_WAS_ERROR, &e->flags)) | 156 | if (test_bit(__EE_WAS_ERROR, &e->flags)) |
| 157 | __drbd_chk_io_error(mdev, false); | 157 | __drbd_chk_io_error(mdev, DRBD_IO_ERROR); |
| 158 | spin_unlock_irqrestore(&mdev->req_lock, flags); | 158 | spin_unlock_irqrestore(&mdev->req_lock, flags); |
| 159 | 159 | ||
| 160 | if (is_syncer_req) | 160 | if (is_syncer_req) |
| @@ -1501,14 +1501,6 @@ void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side) | |||
| 1501 | return; | 1501 | return; |
| 1502 | } | 1502 | } |
| 1503 | 1503 | ||
| 1504 | if (mdev->state.conn < C_AHEAD) { | ||
| 1505 | /* In case a previous resync run was aborted by an IO error/detach on the peer. */ | ||
| 1506 | drbd_rs_cancel_all(mdev); | ||
| 1507 | /* This should be done when we abort the resync. We definitely do not | ||
| 1508 | want to have this for connections going back and forth between | ||
| 1509 | Ahead/Behind and SyncSource/SyncTarget */ | ||
| 1510 | } | ||
| 1511 | |||
| 1512 | if (side == C_SYNC_TARGET) { | 1504 | if (side == C_SYNC_TARGET) { |
| 1513 | /* Since application IO was locked out during C_WF_BITMAP_T and | 1505 | /* Since application IO was locked out during C_WF_BITMAP_T and |
| 1514 | C_WF_SYNC_UUID we are still unmodified. Before going to C_SYNC_TARGET | 1506 | C_WF_SYNC_UUID we are still unmodified. Before going to C_SYNC_TARGET |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 1347ba8b8377..8d4afc83e05f 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
| @@ -672,6 +672,7 @@ static void __reschedule_timeout(int drive, const char *message) | |||
| 672 | 672 | ||
| 673 | if (drive == current_reqD) | 673 | if (drive == current_reqD) |
| 674 | drive = current_drive; | 674 | drive = current_drive; |
| 675 | __cancel_delayed_work(&fd_timeout); | ||
| 675 | 676 | ||
| 676 | if (drive < 0 || drive >= N_DRIVE) { | 677 | if (drive < 0 || drive >= N_DRIVE) { |
| 677 | delay = 20UL * HZ; | 678 | delay = 20UL * HZ; |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index bbca966f8f66..3bba65510d23 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
| @@ -1597,14 +1597,12 @@ static int loop_add(struct loop_device **l, int i) | |||
| 1597 | struct gendisk *disk; | 1597 | struct gendisk *disk; |
| 1598 | int err; | 1598 | int err; |
| 1599 | 1599 | ||
| 1600 | err = -ENOMEM; | ||
| 1600 | lo = kzalloc(sizeof(*lo), GFP_KERNEL); | 1601 | lo = kzalloc(sizeof(*lo), GFP_KERNEL); |
| 1601 | if (!lo) { | 1602 | if (!lo) |
| 1602 | err = -ENOMEM; | ||
| 1603 | goto out; | 1603 | goto out; |
| 1604 | } | ||
| 1605 | 1604 | ||
| 1606 | err = idr_pre_get(&loop_index_idr, GFP_KERNEL); | 1605 | if (!idr_pre_get(&loop_index_idr, GFP_KERNEL)) |
| 1607 | if (err < 0) | ||
| 1608 | goto out_free_dev; | 1606 | goto out_free_dev; |
| 1609 | 1607 | ||
| 1610 | if (i >= 0) { | 1608 | if (i >= 0) { |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 65665c9c42c6..8f428a8ab003 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
| @@ -499,7 +499,7 @@ static int rbd_header_from_disk(struct rbd_image_header *header, | |||
| 499 | / sizeof (*ondisk)) | 499 | / sizeof (*ondisk)) |
| 500 | return -EINVAL; | 500 | return -EINVAL; |
| 501 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + | 501 | header->snapc = kmalloc(sizeof(struct ceph_snap_context) + |
| 502 | snap_count * sizeof (*ondisk), | 502 | snap_count * sizeof(u64), |
| 503 | gfp_flags); | 503 | gfp_flags); |
| 504 | if (!header->snapc) | 504 | if (!header->snapc) |
| 505 | return -ENOMEM; | 505 | return -ENOMEM; |
| @@ -977,7 +977,7 @@ static void rbd_req_cb(struct ceph_osd_request *req, struct ceph_msg *msg) | |||
| 977 | op = (void *)(replyhead + 1); | 977 | op = (void *)(replyhead + 1); |
| 978 | rc = le32_to_cpu(replyhead->result); | 978 | rc = le32_to_cpu(replyhead->result); |
| 979 | bytes = le64_to_cpu(op->extent.length); | 979 | bytes = le64_to_cpu(op->extent.length); |
| 980 | read_op = (le32_to_cpu(op->op) == CEPH_OSD_OP_READ); | 980 | read_op = (le16_to_cpu(op->op) == CEPH_OSD_OP_READ); |
| 981 | 981 | ||
| 982 | dout("rbd_req_cb bytes=%lld readop=%d rc=%d\n", bytes, read_op, rc); | 982 | dout("rbd_req_cb bytes=%lld readop=%d rc=%d\n", bytes, read_op, rc); |
| 983 | 983 | ||
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index ad591bd240ec..10308cd8a7ed 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
| @@ -63,6 +63,7 @@ static struct usb_device_id ath3k_table[] = { | |||
| 63 | 63 | ||
| 64 | /* Atheros AR3011 with sflash firmware*/ | 64 | /* Atheros AR3011 with sflash firmware*/ |
| 65 | { USB_DEVICE(0x0CF3, 0x3002) }, | 65 | { USB_DEVICE(0x0CF3, 0x3002) }, |
| 66 | { USB_DEVICE(0x0CF3, 0xE019) }, | ||
| 66 | { USB_DEVICE(0x13d3, 0x3304) }, | 67 | { USB_DEVICE(0x13d3, 0x3304) }, |
| 67 | { USB_DEVICE(0x0930, 0x0215) }, | 68 | { USB_DEVICE(0x0930, 0x0215) }, |
| 68 | { USB_DEVICE(0x0489, 0xE03D) }, | 69 | { USB_DEVICE(0x0489, 0xE03D) }, |
| @@ -77,6 +78,7 @@ static struct usb_device_id ath3k_table[] = { | |||
| 77 | { USB_DEVICE(0x04CA, 0x3005) }, | 78 | { USB_DEVICE(0x04CA, 0x3005) }, |
| 78 | { USB_DEVICE(0x13d3, 0x3362) }, | 79 | { USB_DEVICE(0x13d3, 0x3362) }, |
| 79 | { USB_DEVICE(0x0CF3, 0xE004) }, | 80 | { USB_DEVICE(0x0CF3, 0xE004) }, |
| 81 | { USB_DEVICE(0x0930, 0x0219) }, | ||
| 80 | 82 | ||
| 81 | /* Atheros AR5BBU12 with sflash firmware */ | 83 | /* Atheros AR5BBU12 with sflash firmware */ |
| 82 | { USB_DEVICE(0x0489, 0xE02C) }, | 84 | { USB_DEVICE(0x0489, 0xE02C) }, |
| @@ -101,6 +103,7 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
| 101 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 103 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 102 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 104 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
| 103 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 105 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
| 106 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | ||
| 104 | 107 | ||
| 105 | /* Atheros AR5BBU22 with sflash firmware */ | 108 | /* Atheros AR5BBU22 with sflash firmware */ |
| 106 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, | 109 | { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btmrvl_drv.h b/drivers/bluetooth/btmrvl_drv.h index 94f2d65131c4..27068d149380 100644 --- a/drivers/bluetooth/btmrvl_drv.h +++ b/drivers/bluetooth/btmrvl_drv.h | |||
| @@ -136,7 +136,7 @@ int btmrvl_remove_card(struct btmrvl_private *priv); | |||
| 136 | 136 | ||
| 137 | void btmrvl_interrupt(struct btmrvl_private *priv); | 137 | void btmrvl_interrupt(struct btmrvl_private *priv); |
| 138 | 138 | ||
| 139 | void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); | 139 | bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb); |
| 140 | int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); | 140 | int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb); |
| 141 | 141 | ||
| 142 | int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd); | 142 | int btmrvl_send_module_cfg_cmd(struct btmrvl_private *priv, int subcmd); |
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 681ca9d18e12..dc304def8400 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
| @@ -44,23 +44,33 @@ void btmrvl_interrupt(struct btmrvl_private *priv) | |||
| 44 | } | 44 | } |
| 45 | EXPORT_SYMBOL_GPL(btmrvl_interrupt); | 45 | EXPORT_SYMBOL_GPL(btmrvl_interrupt); |
| 46 | 46 | ||
| 47 | void btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb) | 47 | bool btmrvl_check_evtpkt(struct btmrvl_private *priv, struct sk_buff *skb) |
| 48 | { | 48 | { |
| 49 | struct hci_event_hdr *hdr = (void *) skb->data; | 49 | struct hci_event_hdr *hdr = (void *) skb->data; |
| 50 | struct hci_ev_cmd_complete *ec; | 50 | struct hci_ev_cmd_complete *ec; |
| 51 | u16 opcode, ocf; | 51 | u16 opcode, ocf, ogf; |
| 52 | 52 | ||
| 53 | if (hdr->evt == HCI_EV_CMD_COMPLETE) { | 53 | if (hdr->evt == HCI_EV_CMD_COMPLETE) { |
| 54 | ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE); | 54 | ec = (void *) (skb->data + HCI_EVENT_HDR_SIZE); |
| 55 | opcode = __le16_to_cpu(ec->opcode); | 55 | opcode = __le16_to_cpu(ec->opcode); |
| 56 | ocf = hci_opcode_ocf(opcode); | 56 | ocf = hci_opcode_ocf(opcode); |
| 57 | ogf = hci_opcode_ogf(opcode); | ||
| 58 | |||
| 57 | if (ocf == BT_CMD_MODULE_CFG_REQ && | 59 | if (ocf == BT_CMD_MODULE_CFG_REQ && |
| 58 | priv->btmrvl_dev.sendcmdflag) { | 60 | priv->btmrvl_dev.sendcmdflag) { |
| 59 | priv->btmrvl_dev.sendcmdflag = false; | 61 | priv->btmrvl_dev.sendcmdflag = false; |
| 60 | priv->adapter->cmd_complete = true; | 62 | priv->adapter->cmd_complete = true; |
| 61 | wake_up_interruptible(&priv->adapter->cmd_wait_q); | 63 | wake_up_interruptible(&priv->adapter->cmd_wait_q); |
| 62 | } | 64 | } |
| 65 | |||
| 66 | if (ogf == OGF) { | ||
| 67 | BT_DBG("vendor event skipped: ogf 0x%4.4x", ogf); | ||
| 68 | kfree_skb(skb); | ||
| 69 | return false; | ||
| 70 | } | ||
| 63 | } | 71 | } |
| 72 | |||
| 73 | return true; | ||
| 64 | } | 74 | } |
| 65 | EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt); | 75 | EXPORT_SYMBOL_GPL(btmrvl_check_evtpkt); |
| 66 | 76 | ||
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c index a853244e7fd7..0cd61d9f07cd 100644 --- a/drivers/bluetooth/btmrvl_sdio.c +++ b/drivers/bluetooth/btmrvl_sdio.c | |||
| @@ -562,10 +562,12 @@ static int btmrvl_sdio_card_to_host(struct btmrvl_private *priv) | |||
| 562 | skb_put(skb, buf_len); | 562 | skb_put(skb, buf_len); |
| 563 | skb_pull(skb, SDIO_HEADER_LEN); | 563 | skb_pull(skb, SDIO_HEADER_LEN); |
| 564 | 564 | ||
| 565 | if (type == HCI_EVENT_PKT) | 565 | if (type == HCI_EVENT_PKT) { |
| 566 | btmrvl_check_evtpkt(priv, skb); | 566 | if (btmrvl_check_evtpkt(priv, skb)) |
| 567 | hci_recv_frame(skb); | ||
| 568 | } else | ||
| 569 | hci_recv_frame(skb); | ||
| 567 | 570 | ||
| 568 | hci_recv_frame(skb); | ||
| 569 | hdev->stat.byte_rx += buf_len; | 571 | hdev->stat.byte_rx += buf_len; |
| 570 | break; | 572 | break; |
| 571 | 573 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c9463af8e564..83ebb241bfcc 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
| @@ -125,6 +125,7 @@ static struct usb_device_id blacklist_table[] = { | |||
| 125 | 125 | ||
| 126 | /* Atheros 3011 with sflash firmware */ | 126 | /* Atheros 3011 with sflash firmware */ |
| 127 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, | 127 | { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, |
| 128 | { USB_DEVICE(0x0cf3, 0xe019), .driver_info = BTUSB_IGNORE }, | ||
| 128 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, | 129 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, |
| 129 | { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, | 130 | { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, |
| 130 | { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, | 131 | { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, |
| @@ -139,6 +140,7 @@ static struct usb_device_id blacklist_table[] = { | |||
| 139 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 140 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
| 140 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 141 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
| 141 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 142 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
| 143 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | ||
| 142 | 144 | ||
| 143 | /* Atheros AR5BBU12 with sflash firmware */ | 145 | /* Atheros AR5BBU12 with sflash firmware */ |
| 144 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 146 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 764f70c5e690..0a4185279417 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
| @@ -898,6 +898,7 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
| 898 | ID(PCI_DEVICE_ID_INTEL_B43_HB), | 898 | ID(PCI_DEVICE_ID_INTEL_B43_HB), |
| 899 | ID(PCI_DEVICE_ID_INTEL_B43_1_HB), | 899 | ID(PCI_DEVICE_ID_INTEL_B43_1_HB), |
| 900 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB), | 900 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB), |
| 901 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB), | ||
| 901 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB), | 902 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB), |
| 902 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB), | 903 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB), |
| 903 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB), | 904 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB), |
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h index c0091753a0d1..8e2d9140f300 100644 --- a/drivers/char/agp/intel-agp.h +++ b/drivers/char/agp/intel-agp.h | |||
| @@ -212,6 +212,7 @@ | |||
| 212 | #define PCI_DEVICE_ID_INTEL_G41_HB 0x2E30 | 212 | #define PCI_DEVICE_ID_INTEL_G41_HB 0x2E30 |
| 213 | #define PCI_DEVICE_ID_INTEL_G41_IG 0x2E32 | 213 | #define PCI_DEVICE_ID_INTEL_G41_IG 0x2E32 |
| 214 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB 0x0040 | 214 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB 0x0040 |
| 215 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB 0x0069 | ||
| 215 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG 0x0042 | 216 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG 0x0042 |
| 216 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB 0x0044 | 217 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB 0x0044 |
| 217 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB 0x0062 | 218 | #define PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB 0x0062 |
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c index f518b99f53f5..731c9046cf7b 100644 --- a/drivers/char/hw_random/atmel-rng.c +++ b/drivers/char/hw_random/atmel-rng.c | |||
| @@ -34,8 +34,15 @@ static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max, | |||
| 34 | u32 *data = buf; | 34 | u32 *data = buf; |
| 35 | 35 | ||
| 36 | /* data ready? */ | 36 | /* data ready? */ |
| 37 | if (readl(trng->base + TRNG_ODATA) & 1) { | 37 | if (readl(trng->base + TRNG_ISR) & 1) { |
| 38 | *data = readl(trng->base + TRNG_ODATA); | 38 | *data = readl(trng->base + TRNG_ODATA); |
| 39 | /* | ||
| 40 | ensure data ready is only set again AFTER the next data | ||
| 41 | word is ready in case it got set between checking ISR | ||
| 42 | and reading ODATA, so we don't risk re-reading the | ||
| 43 | same word | ||
| 44 | */ | ||
| 45 | readl(trng->base + TRNG_ISR); | ||
| 39 | return 4; | 46 | return 4; |
| 40 | } else | 47 | } else |
| 41 | return 0; | 48 | return 0; |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 687b00d67c8a..9a1eb0cfa95f 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
| @@ -850,18 +850,21 @@ static void clk_change_rate(struct clk *clk) | |||
| 850 | { | 850 | { |
| 851 | struct clk *child; | 851 | struct clk *child; |
| 852 | unsigned long old_rate; | 852 | unsigned long old_rate; |
| 853 | unsigned long best_parent_rate = 0; | ||
| 853 | struct hlist_node *tmp; | 854 | struct hlist_node *tmp; |
| 854 | 855 | ||
| 855 | old_rate = clk->rate; | 856 | old_rate = clk->rate; |
| 856 | 857 | ||
| 858 | if (clk->parent) | ||
| 859 | best_parent_rate = clk->parent->rate; | ||
| 860 | |||
| 857 | if (clk->ops->set_rate) | 861 | if (clk->ops->set_rate) |
| 858 | clk->ops->set_rate(clk->hw, clk->new_rate, clk->parent->rate); | 862 | clk->ops->set_rate(clk->hw, clk->new_rate, best_parent_rate); |
| 859 | 863 | ||
| 860 | if (clk->ops->recalc_rate) | 864 | if (clk->ops->recalc_rate) |
| 861 | clk->rate = clk->ops->recalc_rate(clk->hw, | 865 | clk->rate = clk->ops->recalc_rate(clk->hw, best_parent_rate); |
| 862 | clk->parent->rate); | ||
| 863 | else | 866 | else |
| 864 | clk->rate = clk->parent->rate; | 867 | clk->rate = best_parent_rate; |
| 865 | 868 | ||
| 866 | if (clk->notifier_count && old_rate != clk->rate) | 869 | if (clk->notifier_count && old_rate != clk->rate) |
| 867 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); | 870 | __clk_notify(clk, POST_RATE_CHANGE, old_rate, clk->rate); |
| @@ -999,7 +1002,7 @@ static struct clk *__clk_init_parent(struct clk *clk) | |||
| 999 | 1002 | ||
| 1000 | if (!clk->parents) | 1003 | if (!clk->parents) |
| 1001 | clk->parents = | 1004 | clk->parents = |
| 1002 | kmalloc((sizeof(struct clk*) * clk->num_parents), | 1005 | kzalloc((sizeof(struct clk*) * clk->num_parents), |
| 1003 | GFP_KERNEL); | 1006 | GFP_KERNEL); |
| 1004 | 1007 | ||
| 1005 | if (!clk->parents) | 1008 | if (!clk->parents) |
| @@ -1064,21 +1067,24 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent) | |||
| 1064 | 1067 | ||
| 1065 | old_parent = clk->parent; | 1068 | old_parent = clk->parent; |
| 1066 | 1069 | ||
| 1067 | /* find index of new parent clock using cached parent ptrs */ | 1070 | if (!clk->parents) |
| 1068 | for (i = 0; i < clk->num_parents; i++) | 1071 | clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), |
| 1069 | if (clk->parents[i] == parent) | 1072 | GFP_KERNEL); |
| 1070 | break; | ||
| 1071 | 1073 | ||
| 1072 | /* | 1074 | /* |
| 1073 | * find index of new parent clock using string name comparison | 1075 | * find index of new parent clock using cached parent ptrs, |
| 1074 | * also try to cache the parent to avoid future calls to __clk_lookup | 1076 | * or if not yet cached, use string name comparison and cache |
| 1077 | * them now to avoid future calls to __clk_lookup. | ||
| 1075 | */ | 1078 | */ |
| 1076 | if (i == clk->num_parents) | 1079 | for (i = 0; i < clk->num_parents; i++) { |
| 1077 | for (i = 0; i < clk->num_parents; i++) | 1080 | if (clk->parents && clk->parents[i] == parent) |
| 1078 | if (!strcmp(clk->parent_names[i], parent->name)) { | 1081 | break; |
| 1082 | else if (!strcmp(clk->parent_names[i], parent->name)) { | ||
| 1083 | if (clk->parents) | ||
| 1079 | clk->parents[i] = __clk_lookup(parent->name); | 1084 | clk->parents[i] = __clk_lookup(parent->name); |
| 1080 | break; | 1085 | break; |
| 1081 | } | 1086 | } |
| 1087 | } | ||
| 1082 | 1088 | ||
| 1083 | if (i == clk->num_parents) { | 1089 | if (i == clk->num_parents) { |
| 1084 | pr_debug("%s: clock %s is not a possible parent of clock %s\n", | 1090 | pr_debug("%s: clock %s is not a possible parent of clock %s\n", |
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c index f7be225f544c..db2391c054ee 100644 --- a/drivers/clk/mxs/clk-imx23.c +++ b/drivers/clk/mxs/clk-imx23.c | |||
| @@ -71,7 +71,7 @@ static void __init clk_misc_init(void) | |||
| 71 | __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); | 71 | __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | static struct clk_lookup uart_lookups[] __initdata = { | 74 | static struct clk_lookup uart_lookups[] = { |
| 75 | { .dev_id = "duart", }, | 75 | { .dev_id = "duart", }, |
| 76 | { .dev_id = "mxs-auart.0", }, | 76 | { .dev_id = "mxs-auart.0", }, |
| 77 | { .dev_id = "mxs-auart.1", }, | 77 | { .dev_id = "mxs-auart.1", }, |
| @@ -80,31 +80,31 @@ static struct clk_lookup uart_lookups[] __initdata = { | |||
| 80 | { .dev_id = "80070000.serial", }, | 80 | { .dev_id = "80070000.serial", }, |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | static struct clk_lookup hbus_lookups[] __initdata = { | 83 | static struct clk_lookup hbus_lookups[] = { |
| 84 | { .dev_id = "imx23-dma-apbh", }, | 84 | { .dev_id = "imx23-dma-apbh", }, |
| 85 | { .dev_id = "80004000.dma-apbh", }, | 85 | { .dev_id = "80004000.dma-apbh", }, |
| 86 | }; | 86 | }; |
| 87 | 87 | ||
| 88 | static struct clk_lookup xbus_lookups[] __initdata = { | 88 | static struct clk_lookup xbus_lookups[] = { |
| 89 | { .dev_id = "duart", .con_id = "apb_pclk"}, | 89 | { .dev_id = "duart", .con_id = "apb_pclk"}, |
| 90 | { .dev_id = "80070000.serial", .con_id = "apb_pclk"}, | 90 | { .dev_id = "80070000.serial", .con_id = "apb_pclk"}, |
| 91 | { .dev_id = "imx23-dma-apbx", }, | 91 | { .dev_id = "imx23-dma-apbx", }, |
| 92 | { .dev_id = "80024000.dma-apbx", }, | 92 | { .dev_id = "80024000.dma-apbx", }, |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | static struct clk_lookup ssp_lookups[] __initdata = { | 95 | static struct clk_lookup ssp_lookups[] = { |
| 96 | { .dev_id = "imx23-mmc.0", }, | 96 | { .dev_id = "imx23-mmc.0", }, |
| 97 | { .dev_id = "imx23-mmc.1", }, | 97 | { .dev_id = "imx23-mmc.1", }, |
| 98 | { .dev_id = "80010000.ssp", }, | 98 | { .dev_id = "80010000.ssp", }, |
| 99 | { .dev_id = "80034000.ssp", }, | 99 | { .dev_id = "80034000.ssp", }, |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| 102 | static struct clk_lookup lcdif_lookups[] __initdata = { | 102 | static struct clk_lookup lcdif_lookups[] = { |
| 103 | { .dev_id = "imx23-fb", }, | 103 | { .dev_id = "imx23-fb", }, |
| 104 | { .dev_id = "80030000.lcdif", }, | 104 | { .dev_id = "80030000.lcdif", }, |
| 105 | }; | 105 | }; |
| 106 | 106 | ||
| 107 | static struct clk_lookup gpmi_lookups[] __initdata = { | 107 | static struct clk_lookup gpmi_lookups[] = { |
| 108 | { .dev_id = "imx23-gpmi-nand", }, | 108 | { .dev_id = "imx23-gpmi-nand", }, |
| 109 | { .dev_id = "8000c000.gpmi", }, | 109 | { .dev_id = "8000c000.gpmi", }, |
| 110 | }; | 110 | }; |
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c index 2826a2606a29..7fad6c8c13d2 100644 --- a/drivers/clk/mxs/clk-imx28.c +++ b/drivers/clk/mxs/clk-imx28.c | |||
| @@ -120,7 +120,7 @@ static void __init clk_misc_init(void) | |||
| 120 | writel_relaxed(val, FRAC0); | 120 | writel_relaxed(val, FRAC0); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | static struct clk_lookup uart_lookups[] __initdata = { | 123 | static struct clk_lookup uart_lookups[] = { |
| 124 | { .dev_id = "duart", }, | 124 | { .dev_id = "duart", }, |
| 125 | { .dev_id = "mxs-auart.0", }, | 125 | { .dev_id = "mxs-auart.0", }, |
| 126 | { .dev_id = "mxs-auart.1", }, | 126 | { .dev_id = "mxs-auart.1", }, |
| @@ -135,71 +135,71 @@ static struct clk_lookup uart_lookups[] __initdata = { | |||
| 135 | { .dev_id = "80074000.serial", }, | 135 | { .dev_id = "80074000.serial", }, |
| 136 | }; | 136 | }; |
| 137 | 137 | ||
| 138 | static struct clk_lookup hbus_lookups[] __initdata = { | 138 | static struct clk_lookup hbus_lookups[] = { |
| 139 | { .dev_id = "imx28-dma-apbh", }, | 139 | { .dev_id = "imx28-dma-apbh", }, |
| 140 | { .dev_id = "80004000.dma-apbh", }, | 140 | { .dev_id = "80004000.dma-apbh", }, |
| 141 | }; | 141 | }; |
| 142 | 142 | ||
| 143 | static struct clk_lookup xbus_lookups[] __initdata = { | 143 | static struct clk_lookup xbus_lookups[] = { |
| 144 | { .dev_id = "duart", .con_id = "apb_pclk"}, | 144 | { .dev_id = "duart", .con_id = "apb_pclk"}, |
| 145 | { .dev_id = "80074000.serial", .con_id = "apb_pclk"}, | 145 | { .dev_id = "80074000.serial", .con_id = "apb_pclk"}, |
| 146 | { .dev_id = "imx28-dma-apbx", }, | 146 | { .dev_id = "imx28-dma-apbx", }, |
| 147 | { .dev_id = "80024000.dma-apbx", }, | 147 | { .dev_id = "80024000.dma-apbx", }, |
| 148 | }; | 148 | }; |
| 149 | 149 | ||
| 150 | static struct clk_lookup ssp0_lookups[] __initdata = { | 150 | static struct clk_lookup ssp0_lookups[] = { |
| 151 | { .dev_id = "imx28-mmc.0", }, | 151 | { .dev_id = "imx28-mmc.0", }, |
| 152 | { .dev_id = "80010000.ssp", }, | 152 | { .dev_id = "80010000.ssp", }, |
| 153 | }; | 153 | }; |
| 154 | 154 | ||
| 155 | static struct clk_lookup ssp1_lookups[] __initdata = { | 155 | static struct clk_lookup ssp1_lookups[] = { |
| 156 | { .dev_id = "imx28-mmc.1", }, | 156 | { .dev_id = "imx28-mmc.1", }, |
| 157 | { .dev_id = "80012000.ssp", }, | 157 | { .dev_id = "80012000.ssp", }, |
| 158 | }; | 158 | }; |
| 159 | 159 | ||
| 160 | static struct clk_lookup ssp2_lookups[] __initdata = { | 160 | static struct clk_lookup ssp2_lookups[] = { |
| 161 | { .dev_id = "imx28-mmc.2", }, | 161 | { .dev_id = "imx28-mmc.2", }, |
| 162 | { .dev_id = "80014000.ssp", }, | 162 | { .dev_id = "80014000.ssp", }, |
| 163 | }; | 163 | }; |
| 164 | 164 | ||
| 165 | static struct clk_lookup ssp3_lookups[] __initdata = { | 165 | static struct clk_lookup ssp3_lookups[] = { |
| 166 | { .dev_id = "imx28-mmc.3", }, | 166 | { .dev_id = "imx28-mmc.3", }, |
| 167 | { .dev_id = "80016000.ssp", }, | 167 | { .dev_id = "80016000.ssp", }, |
| 168 | }; | 168 | }; |
| 169 | 169 | ||
| 170 | static struct clk_lookup lcdif_lookups[] __initdata = { | 170 | static struct clk_lookup lcdif_lookups[] = { |
| 171 | { .dev_id = "imx28-fb", }, | 171 | { .dev_id = "imx28-fb", }, |
| 172 | { .dev_id = "80030000.lcdif", }, | 172 | { .dev_id = "80030000.lcdif", }, |
| 173 | }; | 173 | }; |
| 174 | 174 | ||
| 175 | static struct clk_lookup gpmi_lookups[] __initdata = { | 175 | static struct clk_lookup gpmi_lookups[] = { |
| 176 | { .dev_id = "imx28-gpmi-nand", }, | 176 | { .dev_id = "imx28-gpmi-nand", }, |
| 177 | { .dev_id = "8000c000.gpmi", }, | 177 | { .dev_id = "8000c000.gpmi", }, |
| 178 | }; | 178 | }; |
| 179 | 179 | ||
| 180 | static struct clk_lookup fec_lookups[] __initdata = { | 180 | static struct clk_lookup fec_lookups[] = { |
| 181 | { .dev_id = "imx28-fec.0", }, | 181 | { .dev_id = "imx28-fec.0", }, |
| 182 | { .dev_id = "imx28-fec.1", }, | 182 | { .dev_id = "imx28-fec.1", }, |
| 183 | { .dev_id = "800f0000.ethernet", }, | 183 | { .dev_id = "800f0000.ethernet", }, |
| 184 | { .dev_id = "800f4000.ethernet", }, | 184 | { .dev_id = "800f4000.ethernet", }, |
| 185 | }; | 185 | }; |
| 186 | 186 | ||
| 187 | static struct clk_lookup can0_lookups[] __initdata = { | 187 | static struct clk_lookup can0_lookups[] = { |
| 188 | { .dev_id = "flexcan.0", }, | 188 | { .dev_id = "flexcan.0", }, |
| 189 | { .dev_id = "80032000.can", }, | 189 | { .dev_id = "80032000.can", }, |
| 190 | }; | 190 | }; |
| 191 | 191 | ||
| 192 | static struct clk_lookup can1_lookups[] __initdata = { | 192 | static struct clk_lookup can1_lookups[] = { |
| 193 | { .dev_id = "flexcan.1", }, | 193 | { .dev_id = "flexcan.1", }, |
| 194 | { .dev_id = "80034000.can", }, | 194 | { .dev_id = "80034000.can", }, |
| 195 | }; | 195 | }; |
| 196 | 196 | ||
| 197 | static struct clk_lookup saif0_lookups[] __initdata = { | 197 | static struct clk_lookup saif0_lookups[] = { |
| 198 | { .dev_id = "mxs-saif.0", }, | 198 | { .dev_id = "mxs-saif.0", }, |
| 199 | { .dev_id = "80042000.saif", }, | 199 | { .dev_id = "80042000.saif", }, |
| 200 | }; | 200 | }; |
| 201 | 201 | ||
| 202 | static struct clk_lookup saif1_lookups[] __initdata = { | 202 | static struct clk_lookup saif1_lookups[] = { |
| 203 | { .dev_id = "mxs-saif.1", }, | 203 | { .dev_id = "mxs-saif.1", }, |
| 204 | { .dev_id = "80046000.saif", }, | 204 | { .dev_id = "80046000.saif", }, |
| 205 | }; | 205 | }; |
| @@ -245,8 +245,8 @@ int __init mx28_clocks_init(void) | |||
| 245 | clks[pll2] = mxs_clk_pll("pll2", "ref_xtal", PLL2CTRL0, 23, 50000000); | 245 | clks[pll2] = mxs_clk_pll("pll2", "ref_xtal", PLL2CTRL0, 23, 50000000); |
| 246 | clks[ref_cpu] = mxs_clk_ref("ref_cpu", "pll0", FRAC0, 0); | 246 | clks[ref_cpu] = mxs_clk_ref("ref_cpu", "pll0", FRAC0, 0); |
| 247 | clks[ref_emi] = mxs_clk_ref("ref_emi", "pll0", FRAC0, 1); | 247 | clks[ref_emi] = mxs_clk_ref("ref_emi", "pll0", FRAC0, 1); |
| 248 | clks[ref_io0] = mxs_clk_ref("ref_io0", "pll0", FRAC0, 2); | 248 | clks[ref_io1] = mxs_clk_ref("ref_io1", "pll0", FRAC0, 2); |
| 249 | clks[ref_io1] = mxs_clk_ref("ref_io1", "pll0", FRAC0, 3); | 249 | clks[ref_io0] = mxs_clk_ref("ref_io0", "pll0", FRAC0, 3); |
| 250 | clks[ref_pix] = mxs_clk_ref("ref_pix", "pll0", FRAC1, 0); | 250 | clks[ref_pix] = mxs_clk_ref("ref_pix", "pll0", FRAC1, 0); |
| 251 | clks[ref_hsadc] = mxs_clk_ref("ref_hsadc", "pll0", FRAC1, 1); | 251 | clks[ref_hsadc] = mxs_clk_ref("ref_hsadc", "pll0", FRAC1, 1); |
| 252 | clks[ref_gpmi] = mxs_clk_ref("ref_gpmi", "pll0", FRAC1, 2); | 252 | clks[ref_gpmi] = mxs_clk_ref("ref_gpmi", "pll0", FRAC1, 2); |
diff --git a/drivers/clk/spear/clk-aux-synth.c b/drivers/clk/spear/clk-aux-synth.c index af34074e702b..6756e7c3bc07 100644 --- a/drivers/clk/spear/clk-aux-synth.c +++ b/drivers/clk/spear/clk-aux-synth.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
| 3 | * Viresh Kumar <viresh.kumar@st.com> | 3 | * Viresh Kumar <viresh.linux@gmail.com> |
| 4 | * | 4 | * |
| 5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
| 6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk-frac-synth.c b/drivers/clk/spear/clk-frac-synth.c index 4dbdb3fe18e0..958aa3ad1d60 100644 --- a/drivers/clk/spear/clk-frac-synth.c +++ b/drivers/clk/spear/clk-frac-synth.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
| 3 | * Viresh Kumar <viresh.kumar@st.com> | 3 | * Viresh Kumar <viresh.linux@gmail.com> |
| 4 | * | 4 | * |
| 5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
| 6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk-gpt-synth.c b/drivers/clk/spear/clk-gpt-synth.c index b471c9762a97..1afc18c4effc 100644 --- a/drivers/clk/spear/clk-gpt-synth.c +++ b/drivers/clk/spear/clk-gpt-synth.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
| 3 | * Viresh Kumar <viresh.kumar@st.com> | 3 | * Viresh Kumar <viresh.linux@gmail.com> |
| 4 | * | 4 | * |
| 5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
| 6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk-vco-pll.c b/drivers/clk/spear/clk-vco-pll.c index dcd4bdf4b0d9..5f1b6badeb15 100644 --- a/drivers/clk/spear/clk-vco-pll.c +++ b/drivers/clk/spear/clk-vco-pll.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
| 3 | * Viresh Kumar <viresh.kumar@st.com> | 3 | * Viresh Kumar <viresh.linux@gmail.com> |
| 4 | * | 4 | * |
| 5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
| 6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk.c b/drivers/clk/spear/clk.c index 376d4e5ff326..7cd63788d546 100644 --- a/drivers/clk/spear/clk.c +++ b/drivers/clk/spear/clk.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2012 ST Microelectronics | 2 | * Copyright (C) 2012 ST Microelectronics |
| 3 | * Viresh Kumar <viresh.kumar@st.com> | 3 | * Viresh Kumar <viresh.linux@gmail.com> |
| 4 | * | 4 | * |
| 5 | * This file is licensed under the terms of the GNU General Public | 5 | * This file is licensed under the terms of the GNU General Public |
| 6 | * License version 2. This program is licensed "as is" without any | 6 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/clk.h b/drivers/clk/spear/clk.h index 3321c46a071c..931737677dfa 100644 --- a/drivers/clk/spear/clk.h +++ b/drivers/clk/spear/clk.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Clock framework definitions for SPEAr platform | 2 | * Clock framework definitions for SPEAr platform |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/clk/spear/spear1310_clock.c b/drivers/clk/spear/spear1310_clock.c index 42b68df9aeef..0fcec2aae19c 100644 --- a/drivers/clk/spear/spear1310_clock.c +++ b/drivers/clk/spear/spear1310_clock.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * SPEAr1310 machine clock framework source file | 4 | * SPEAr1310 machine clock framework source file |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
| 7 | * Viresh Kumar <viresh.kumar@st.com> | 7 | * Viresh Kumar <viresh.linux@gmail.com> |
| 8 | * | 8 | * |
| 9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
| 10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
| @@ -345,31 +345,30 @@ static struct frac_rate_tbl gen_rtbl[] = { | |||
| 345 | /* clock parents */ | 345 | /* clock parents */ |
| 346 | static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", }; | 346 | static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", }; |
| 347 | static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", }; | 347 | static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", }; |
| 348 | static const char *uart0_parents[] = { "pll5_clk", "uart_synth_gate_clk", }; | 348 | static const char *uart0_parents[] = { "pll5_clk", "uart_syn_gclk", }; |
| 349 | static const char *c3_parents[] = { "pll5_clk", "c3_synth_gate_clk", }; | 349 | static const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", }; |
| 350 | static const char *gmac_phy_input_parents[] = { "gmii_125m_pad_clk", "pll2_clk", | 350 | static const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk", |
| 351 | "osc_25m_clk", }; | 351 | "osc_25m_clk", }; |
| 352 | static const char *gmac_phy_parents[] = { "gmac_phy_input_mux_clk", | 352 | static const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", }; |
| 353 | "gmac_phy_synth_gate_clk", }; | ||
| 354 | static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", }; | 353 | static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", }; |
| 355 | static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_synth_clk", }; | 354 | static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", }; |
| 356 | static const char *i2s_src_parents[] = { "vco1div2_clk", "none", "pll3_clk", | 355 | static const char *i2s_src_parents[] = { "vco1div2_clk", "none", "pll3_clk", |
| 357 | "i2s_src_pad_clk", }; | 356 | "i2s_src_pad_clk", }; |
| 358 | static const char *i2s_ref_parents[] = { "i2s_src_mux_clk", "i2s_prs1_clk", }; | 357 | static const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", }; |
| 359 | static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", | 358 | static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", |
| 360 | "pll3_clk", }; | 359 | "pll3_clk", }; |
| 361 | static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco3div2_clk", | 360 | static const char *gen_synth2_3_parents[] = { "vco1div4_clk", "vco3div2_clk", |
| 362 | "pll2_clk", }; | 361 | "pll2_clk", }; |
| 363 | static const char *rmii_phy_parents[] = { "ras_tx50_clk", "none", | 362 | static const char *rmii_phy_parents[] = { "ras_tx50_clk", "none", |
| 364 | "ras_pll2_clk", "ras_synth0_clk", }; | 363 | "ras_pll2_clk", "ras_syn0_clk", }; |
| 365 | static const char *smii_rgmii_phy_parents[] = { "none", "ras_tx125_clk", | 364 | static const char *smii_rgmii_phy_parents[] = { "none", "ras_tx125_clk", |
| 366 | "ras_pll2_clk", "ras_synth0_clk", }; | 365 | "ras_pll2_clk", "ras_syn0_clk", }; |
| 367 | static const char *uart_parents[] = { "ras_apb_clk", "gen_synth3_clk", }; | 366 | static const char *uart_parents[] = { "ras_apb_clk", "gen_syn3_clk", }; |
| 368 | static const char *i2c_parents[] = { "ras_apb_clk", "gen_synth1_clk", }; | 367 | static const char *i2c_parents[] = { "ras_apb_clk", "gen_syn1_clk", }; |
| 369 | static const char *ssp1_parents[] = { "ras_apb_clk", "gen_synth1_clk", | 368 | static const char *ssp1_parents[] = { "ras_apb_clk", "gen_syn1_clk", |
| 370 | "ras_plclk0_clk", }; | 369 | "ras_plclk0_clk", }; |
| 371 | static const char *pci_parents[] = { "ras_pll3_clk", "gen_synth2_clk", }; | 370 | static const char *pci_parents[] = { "ras_pll3_clk", "gen_syn2_clk", }; |
| 372 | static const char *tdm_parents[] = { "ras_pll3_clk", "gen_synth1_clk", }; | 371 | static const char *tdm_parents[] = { "ras_pll3_clk", "gen_syn1_clk", }; |
| 373 | 372 | ||
| 374 | void __init spear1310_clk_init(void) | 373 | void __init spear1310_clk_init(void) |
| 375 | { | 374 | { |
| @@ -390,9 +389,9 @@ void __init spear1310_clk_init(void) | |||
| 390 | 25000000); | 389 | 25000000); |
| 391 | clk_register_clkdev(clk, "osc_25m_clk", NULL); | 390 | clk_register_clkdev(clk, "osc_25m_clk", NULL); |
| 392 | 391 | ||
| 393 | clk = clk_register_fixed_rate(NULL, "gmii_125m_pad_clk", NULL, | 392 | clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, CLK_IS_ROOT, |
| 394 | CLK_IS_ROOT, 125000000); | 393 | 125000000); |
| 395 | clk_register_clkdev(clk, "gmii_125m_pad_clk", NULL); | 394 | clk_register_clkdev(clk, "gmii_pad_clk", NULL); |
| 396 | 395 | ||
| 397 | clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, | 396 | clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, |
| 398 | CLK_IS_ROOT, 12288000); | 397 | CLK_IS_ROOT, 12288000); |
| @@ -406,34 +405,34 @@ void __init spear1310_clk_init(void) | |||
| 406 | 405 | ||
| 407 | /* clock derived from 24 or 25 MHz osc clk */ | 406 | /* clock derived from 24 or 25 MHz osc clk */ |
| 408 | /* vco-pll */ | 407 | /* vco-pll */ |
| 409 | clk = clk_register_mux(NULL, "vco1_mux_clk", vco_parents, | 408 | clk = clk_register_mux(NULL, "vco1_mclk", vco_parents, |
| 410 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, | 409 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, |
| 411 | SPEAR1310_PLL1_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, | 410 | SPEAR1310_PLL1_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, |
| 412 | &_lock); | 411 | &_lock); |
| 413 | clk_register_clkdev(clk, "vco1_mux_clk", NULL); | 412 | clk_register_clkdev(clk, "vco1_mclk", NULL); |
| 414 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mux_clk", | 413 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk", |
| 415 | 0, SPEAR1310_PLL1_CTR, SPEAR1310_PLL1_FRQ, pll_rtbl, | 414 | 0, SPEAR1310_PLL1_CTR, SPEAR1310_PLL1_FRQ, pll_rtbl, |
| 416 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 415 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
| 417 | clk_register_clkdev(clk, "vco1_clk", NULL); | 416 | clk_register_clkdev(clk, "vco1_clk", NULL); |
| 418 | clk_register_clkdev(clk1, "pll1_clk", NULL); | 417 | clk_register_clkdev(clk1, "pll1_clk", NULL); |
| 419 | 418 | ||
| 420 | clk = clk_register_mux(NULL, "vco2_mux_clk", vco_parents, | 419 | clk = clk_register_mux(NULL, "vco2_mclk", vco_parents, |
| 421 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, | 420 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, |
| 422 | SPEAR1310_PLL2_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, | 421 | SPEAR1310_PLL2_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, |
| 423 | &_lock); | 422 | &_lock); |
| 424 | clk_register_clkdev(clk, "vco2_mux_clk", NULL); | 423 | clk_register_clkdev(clk, "vco2_mclk", NULL); |
| 425 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mux_clk", | 424 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk", |
| 426 | 0, SPEAR1310_PLL2_CTR, SPEAR1310_PLL2_FRQ, pll_rtbl, | 425 | 0, SPEAR1310_PLL2_CTR, SPEAR1310_PLL2_FRQ, pll_rtbl, |
| 427 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 426 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
| 428 | clk_register_clkdev(clk, "vco2_clk", NULL); | 427 | clk_register_clkdev(clk, "vco2_clk", NULL); |
| 429 | clk_register_clkdev(clk1, "pll2_clk", NULL); | 428 | clk_register_clkdev(clk1, "pll2_clk", NULL); |
| 430 | 429 | ||
| 431 | clk = clk_register_mux(NULL, "vco3_mux_clk", vco_parents, | 430 | clk = clk_register_mux(NULL, "vco3_mclk", vco_parents, |
| 432 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, | 431 | ARRAY_SIZE(vco_parents), 0, SPEAR1310_PLL_CFG, |
| 433 | SPEAR1310_PLL3_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, | 432 | SPEAR1310_PLL3_CLK_SHIFT, SPEAR1310_PLL_CLK_MASK, 0, |
| 434 | &_lock); | 433 | &_lock); |
| 435 | clk_register_clkdev(clk, "vco3_mux_clk", NULL); | 434 | clk_register_clkdev(clk, "vco3_mclk", NULL); |
| 436 | clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mux_clk", | 435 | clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk", |
| 437 | 0, SPEAR1310_PLL3_CTR, SPEAR1310_PLL3_FRQ, pll_rtbl, | 436 | 0, SPEAR1310_PLL3_CTR, SPEAR1310_PLL3_FRQ, pll_rtbl, |
| 438 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 437 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
| 439 | clk_register_clkdev(clk, "vco3_clk", NULL); | 438 | clk_register_clkdev(clk, "vco3_clk", NULL); |
| @@ -473,7 +472,7 @@ void __init spear1310_clk_init(void) | |||
| 473 | /* peripherals */ | 472 | /* peripherals */ |
| 474 | clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1, | 473 | clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1, |
| 475 | 128); | 474 | 128); |
| 476 | clk = clk_register_gate(NULL, "thermal_gate_clk", "thermal_clk", 0, | 475 | clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0, |
| 477 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_THSENS_CLK_ENB, 0, | 476 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_THSENS_CLK_ENB, 0, |
| 478 | &_lock); | 477 | &_lock); |
| 479 | clk_register_clkdev(clk, NULL, "spear_thermal"); | 478 | clk_register_clkdev(clk, NULL, "spear_thermal"); |
| @@ -500,177 +499,176 @@ void __init spear1310_clk_init(void) | |||
| 500 | clk_register_clkdev(clk, "apb_clk", NULL); | 499 | clk_register_clkdev(clk, "apb_clk", NULL); |
| 501 | 500 | ||
| 502 | /* gpt clocks */ | 501 | /* gpt clocks */ |
| 503 | clk = clk_register_mux(NULL, "gpt0_mux_clk", gpt_parents, | 502 | clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents, |
| 504 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 503 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
| 505 | SPEAR1310_GPT0_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, | 504 | SPEAR1310_GPT0_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, |
| 506 | &_lock); | 505 | &_lock); |
| 507 | clk_register_clkdev(clk, "gpt0_mux_clk", NULL); | 506 | clk_register_clkdev(clk, "gpt0_mclk", NULL); |
| 508 | clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mux_clk", 0, | 507 | clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0, |
| 509 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT0_CLK_ENB, 0, | 508 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT0_CLK_ENB, 0, |
| 510 | &_lock); | 509 | &_lock); |
| 511 | clk_register_clkdev(clk, NULL, "gpt0"); | 510 | clk_register_clkdev(clk, NULL, "gpt0"); |
| 512 | 511 | ||
| 513 | clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt_parents, | 512 | clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents, |
| 514 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 513 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
| 515 | SPEAR1310_GPT1_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, | 514 | SPEAR1310_GPT1_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, |
| 516 | &_lock); | 515 | &_lock); |
| 517 | clk_register_clkdev(clk, "gpt1_mux_clk", NULL); | 516 | clk_register_clkdev(clk, "gpt1_mclk", NULL); |
| 518 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0, | 517 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0, |
| 519 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT1_CLK_ENB, 0, | 518 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_GPT1_CLK_ENB, 0, |
| 520 | &_lock); | 519 | &_lock); |
| 521 | clk_register_clkdev(clk, NULL, "gpt1"); | 520 | clk_register_clkdev(clk, NULL, "gpt1"); |
| 522 | 521 | ||
| 523 | clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt_parents, | 522 | clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents, |
| 524 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 523 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
| 525 | SPEAR1310_GPT2_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, | 524 | SPEAR1310_GPT2_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, |
| 526 | &_lock); | 525 | &_lock); |
| 527 | clk_register_clkdev(clk, "gpt2_mux_clk", NULL); | 526 | clk_register_clkdev(clk, "gpt2_mclk", NULL); |
| 528 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0, | 527 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0, |
| 529 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT2_CLK_ENB, 0, | 528 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT2_CLK_ENB, 0, |
| 530 | &_lock); | 529 | &_lock); |
| 531 | clk_register_clkdev(clk, NULL, "gpt2"); | 530 | clk_register_clkdev(clk, NULL, "gpt2"); |
| 532 | 531 | ||
| 533 | clk = clk_register_mux(NULL, "gpt3_mux_clk", gpt_parents, | 532 | clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents, |
| 534 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 533 | ARRAY_SIZE(gpt_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
| 535 | SPEAR1310_GPT3_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, | 534 | SPEAR1310_GPT3_CLK_SHIFT, SPEAR1310_GPT_CLK_MASK, 0, |
| 536 | &_lock); | 535 | &_lock); |
| 537 | clk_register_clkdev(clk, "gpt3_mux_clk", NULL); | 536 | clk_register_clkdev(clk, "gpt3_mclk", NULL); |
| 538 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mux_clk", 0, | 537 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0, |
| 539 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT3_CLK_ENB, 0, | 538 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_GPT3_CLK_ENB, 0, |
| 540 | &_lock); | 539 | &_lock); |
| 541 | clk_register_clkdev(clk, NULL, "gpt3"); | 540 | clk_register_clkdev(clk, NULL, "gpt3"); |
| 542 | 541 | ||
| 543 | /* others */ | 542 | /* others */ |
| 544 | clk = clk_register_aux("uart_synth_clk", "uart_synth_gate_clk", | 543 | clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "vco1div2_clk", |
| 545 | "vco1div2_clk", 0, SPEAR1310_UART_CLK_SYNT, NULL, | 544 | 0, SPEAR1310_UART_CLK_SYNT, NULL, aux_rtbl, |
| 546 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 545 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 547 | clk_register_clkdev(clk, "uart_synth_clk", NULL); | 546 | clk_register_clkdev(clk, "uart_syn_clk", NULL); |
| 548 | clk_register_clkdev(clk1, "uart_synth_gate_clk", NULL); | 547 | clk_register_clkdev(clk1, "uart_syn_gclk", NULL); |
| 549 | 548 | ||
| 550 | clk = clk_register_mux(NULL, "uart0_mux_clk", uart0_parents, | 549 | clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents, |
| 551 | ARRAY_SIZE(uart0_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 550 | ARRAY_SIZE(uart0_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
| 552 | SPEAR1310_UART_CLK_SHIFT, SPEAR1310_UART_CLK_MASK, 0, | 551 | SPEAR1310_UART_CLK_SHIFT, SPEAR1310_UART_CLK_MASK, 0, |
| 553 | &_lock); | 552 | &_lock); |
| 554 | clk_register_clkdev(clk, "uart0_mux_clk", NULL); | 553 | clk_register_clkdev(clk, "uart0_mclk", NULL); |
| 555 | 554 | ||
| 556 | clk = clk_register_gate(NULL, "uart0_clk", "uart0_mux_clk", 0, | 555 | clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk", 0, |
| 557 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UART_CLK_ENB, 0, | 556 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_UART_CLK_ENB, 0, |
| 558 | &_lock); | 557 | &_lock); |
| 559 | clk_register_clkdev(clk, NULL, "e0000000.serial"); | 558 | clk_register_clkdev(clk, NULL, "e0000000.serial"); |
| 560 | 559 | ||
| 561 | clk = clk_register_aux("sdhci_synth_clk", "sdhci_synth_gate_clk", | 560 | clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk", |
| 562 | "vco1div2_clk", 0, SPEAR1310_SDHCI_CLK_SYNT, NULL, | 561 | "vco1div2_clk", 0, SPEAR1310_SDHCI_CLK_SYNT, NULL, |
| 563 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 562 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 564 | clk_register_clkdev(clk, "sdhci_synth_clk", NULL); | 563 | clk_register_clkdev(clk, "sdhci_syn_clk", NULL); |
| 565 | clk_register_clkdev(clk1, "sdhci_synth_gate_clk", NULL); | 564 | clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL); |
| 566 | 565 | ||
| 567 | clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_synth_gate_clk", 0, | 566 | clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk", 0, |
| 568 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SDHCI_CLK_ENB, 0, | 567 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_SDHCI_CLK_ENB, 0, |
| 569 | &_lock); | 568 | &_lock); |
| 570 | clk_register_clkdev(clk, NULL, "b3000000.sdhci"); | 569 | clk_register_clkdev(clk, NULL, "b3000000.sdhci"); |
| 571 | 570 | ||
| 572 | clk = clk_register_aux("cfxd_synth_clk", "cfxd_synth_gate_clk", | 571 | clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk", |
| 573 | "vco1div2_clk", 0, SPEAR1310_CFXD_CLK_SYNT, NULL, | 572 | 0, SPEAR1310_CFXD_CLK_SYNT, NULL, aux_rtbl, |
| 574 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 573 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 575 | clk_register_clkdev(clk, "cfxd_synth_clk", NULL); | 574 | clk_register_clkdev(clk, "cfxd_syn_clk", NULL); |
| 576 | clk_register_clkdev(clk1, "cfxd_synth_gate_clk", NULL); | 575 | clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL); |
| 577 | 576 | ||
| 578 | clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_synth_gate_clk", 0, | 577 | clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk", 0, |
| 579 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CFXD_CLK_ENB, 0, | 578 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CFXD_CLK_ENB, 0, |
| 580 | &_lock); | 579 | &_lock); |
| 581 | clk_register_clkdev(clk, NULL, "b2800000.cf"); | 580 | clk_register_clkdev(clk, NULL, "b2800000.cf"); |
| 582 | clk_register_clkdev(clk, NULL, "arasan_xd"); | 581 | clk_register_clkdev(clk, NULL, "arasan_xd"); |
| 583 | 582 | ||
| 584 | clk = clk_register_aux("c3_synth_clk", "c3_synth_gate_clk", | 583 | clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk", |
| 585 | "vco1div2_clk", 0, SPEAR1310_C3_CLK_SYNT, NULL, | 584 | 0, SPEAR1310_C3_CLK_SYNT, NULL, aux_rtbl, |
| 586 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 585 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 587 | clk_register_clkdev(clk, "c3_synth_clk", NULL); | 586 | clk_register_clkdev(clk, "c3_syn_clk", NULL); |
| 588 | clk_register_clkdev(clk1, "c3_synth_gate_clk", NULL); | 587 | clk_register_clkdev(clk1, "c3_syn_gclk", NULL); |
| 589 | 588 | ||
| 590 | clk = clk_register_mux(NULL, "c3_mux_clk", c3_parents, | 589 | clk = clk_register_mux(NULL, "c3_mclk", c3_parents, |
| 591 | ARRAY_SIZE(c3_parents), 0, SPEAR1310_PERIP_CLK_CFG, | 590 | ARRAY_SIZE(c3_parents), 0, SPEAR1310_PERIP_CLK_CFG, |
| 592 | SPEAR1310_C3_CLK_SHIFT, SPEAR1310_C3_CLK_MASK, 0, | 591 | SPEAR1310_C3_CLK_SHIFT, SPEAR1310_C3_CLK_MASK, 0, |
| 593 | &_lock); | 592 | &_lock); |
| 594 | clk_register_clkdev(clk, "c3_mux_clk", NULL); | 593 | clk_register_clkdev(clk, "c3_mclk", NULL); |
| 595 | 594 | ||
| 596 | clk = clk_register_gate(NULL, "c3_clk", "c3_mux_clk", 0, | 595 | clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", 0, |
| 597 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_C3_CLK_ENB, 0, | 596 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_C3_CLK_ENB, 0, |
| 598 | &_lock); | 597 | &_lock); |
| 599 | clk_register_clkdev(clk, NULL, "c3"); | 598 | clk_register_clkdev(clk, NULL, "c3"); |
| 600 | 599 | ||
| 601 | /* gmac */ | 600 | /* gmac */ |
| 602 | clk = clk_register_mux(NULL, "gmac_phy_input_mux_clk", | 601 | clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents, |
| 603 | gmac_phy_input_parents, | ||
| 604 | ARRAY_SIZE(gmac_phy_input_parents), 0, | 602 | ARRAY_SIZE(gmac_phy_input_parents), 0, |
| 605 | SPEAR1310_GMAC_CLK_CFG, | 603 | SPEAR1310_GMAC_CLK_CFG, |
| 606 | SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT, | 604 | SPEAR1310_GMAC_PHY_INPUT_CLK_SHIFT, |
| 607 | SPEAR1310_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock); | 605 | SPEAR1310_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock); |
| 608 | clk_register_clkdev(clk, "gmac_phy_input_mux_clk", NULL); | 606 | clk_register_clkdev(clk, "phy_input_mclk", NULL); |
| 609 | 607 | ||
| 610 | clk = clk_register_aux("gmac_phy_synth_clk", "gmac_phy_synth_gate_clk", | 608 | clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk", |
| 611 | "gmac_phy_input_mux_clk", 0, SPEAR1310_GMAC_CLK_SYNT, | 609 | 0, SPEAR1310_GMAC_CLK_SYNT, NULL, gmac_rtbl, |
| 612 | NULL, gmac_rtbl, ARRAY_SIZE(gmac_rtbl), &_lock, &clk1); | 610 | ARRAY_SIZE(gmac_rtbl), &_lock, &clk1); |
| 613 | clk_register_clkdev(clk, "gmac_phy_synth_clk", NULL); | 611 | clk_register_clkdev(clk, "phy_syn_clk", NULL); |
| 614 | clk_register_clkdev(clk1, "gmac_phy_synth_gate_clk", NULL); | 612 | clk_register_clkdev(clk1, "phy_syn_gclk", NULL); |
| 615 | 613 | ||
| 616 | clk = clk_register_mux(NULL, "gmac_phy_mux_clk", gmac_phy_parents, | 614 | clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents, |
| 617 | ARRAY_SIZE(gmac_phy_parents), 0, | 615 | ARRAY_SIZE(gmac_phy_parents), 0, |
| 618 | SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GMAC_PHY_CLK_SHIFT, | 616 | SPEAR1310_PERIP_CLK_CFG, SPEAR1310_GMAC_PHY_CLK_SHIFT, |
| 619 | SPEAR1310_GMAC_PHY_CLK_MASK, 0, &_lock); | 617 | SPEAR1310_GMAC_PHY_CLK_MASK, 0, &_lock); |
| 620 | clk_register_clkdev(clk, NULL, "stmmacphy.0"); | 618 | clk_register_clkdev(clk, NULL, "stmmacphy.0"); |
| 621 | 619 | ||
| 622 | /* clcd */ | 620 | /* clcd */ |
| 623 | clk = clk_register_mux(NULL, "clcd_synth_mux_clk", clcd_synth_parents, | 621 | clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents, |
| 624 | ARRAY_SIZE(clcd_synth_parents), 0, | 622 | ARRAY_SIZE(clcd_synth_parents), 0, |
| 625 | SPEAR1310_CLCD_CLK_SYNT, SPEAR1310_CLCD_SYNT_CLK_SHIFT, | 623 | SPEAR1310_CLCD_CLK_SYNT, SPEAR1310_CLCD_SYNT_CLK_SHIFT, |
| 626 | SPEAR1310_CLCD_SYNT_CLK_MASK, 0, &_lock); | 624 | SPEAR1310_CLCD_SYNT_CLK_MASK, 0, &_lock); |
| 627 | clk_register_clkdev(clk, "clcd_synth_mux_clk", NULL); | 625 | clk_register_clkdev(clk, "clcd_syn_mclk", NULL); |
| 628 | 626 | ||
| 629 | clk = clk_register_frac("clcd_synth_clk", "clcd_synth_mux_clk", 0, | 627 | clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0, |
| 630 | SPEAR1310_CLCD_CLK_SYNT, clcd_rtbl, | 628 | SPEAR1310_CLCD_CLK_SYNT, clcd_rtbl, |
| 631 | ARRAY_SIZE(clcd_rtbl), &_lock); | 629 | ARRAY_SIZE(clcd_rtbl), &_lock); |
| 632 | clk_register_clkdev(clk, "clcd_synth_clk", NULL); | 630 | clk_register_clkdev(clk, "clcd_syn_clk", NULL); |
| 633 | 631 | ||
| 634 | clk = clk_register_mux(NULL, "clcd_pixel_mux_clk", clcd_pixel_parents, | 632 | clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents, |
| 635 | ARRAY_SIZE(clcd_pixel_parents), 0, | 633 | ARRAY_SIZE(clcd_pixel_parents), 0, |
| 636 | SPEAR1310_PERIP_CLK_CFG, SPEAR1310_CLCD_CLK_SHIFT, | 634 | SPEAR1310_PERIP_CLK_CFG, SPEAR1310_CLCD_CLK_SHIFT, |
| 637 | SPEAR1310_CLCD_CLK_MASK, 0, &_lock); | 635 | SPEAR1310_CLCD_CLK_MASK, 0, &_lock); |
| 638 | clk_register_clkdev(clk, "clcd_pixel_clk", NULL); | 636 | clk_register_clkdev(clk, "clcd_pixel_clk", NULL); |
| 639 | 637 | ||
| 640 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mux_clk", 0, | 638 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0, |
| 641 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CLCD_CLK_ENB, 0, | 639 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_CLCD_CLK_ENB, 0, |
| 642 | &_lock); | 640 | &_lock); |
| 643 | clk_register_clkdev(clk, "clcd_clk", NULL); | 641 | clk_register_clkdev(clk, "clcd_clk", NULL); |
| 644 | 642 | ||
| 645 | /* i2s */ | 643 | /* i2s */ |
| 646 | clk = clk_register_mux(NULL, "i2s_src_mux_clk", i2s_src_parents, | 644 | clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents, |
| 647 | ARRAY_SIZE(i2s_src_parents), 0, SPEAR1310_I2S_CLK_CFG, | 645 | ARRAY_SIZE(i2s_src_parents), 0, SPEAR1310_I2S_CLK_CFG, |
| 648 | SPEAR1310_I2S_SRC_CLK_SHIFT, SPEAR1310_I2S_SRC_CLK_MASK, | 646 | SPEAR1310_I2S_SRC_CLK_SHIFT, SPEAR1310_I2S_SRC_CLK_MASK, |
| 649 | 0, &_lock); | 647 | 0, &_lock); |
| 650 | clk_register_clkdev(clk, "i2s_src_clk", NULL); | 648 | clk_register_clkdev(clk, "i2s_src_clk", NULL); |
| 651 | 649 | ||
| 652 | clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mux_clk", 0, | 650 | clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk", 0, |
| 653 | SPEAR1310_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl, | 651 | SPEAR1310_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl, |
| 654 | ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL); | 652 | ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL); |
| 655 | clk_register_clkdev(clk, "i2s_prs1_clk", NULL); | 653 | clk_register_clkdev(clk, "i2s_prs1_clk", NULL); |
| 656 | 654 | ||
| 657 | clk = clk_register_mux(NULL, "i2s_ref_mux_clk", i2s_ref_parents, | 655 | clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents, |
| 658 | ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1310_I2S_CLK_CFG, | 656 | ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1310_I2S_CLK_CFG, |
| 659 | SPEAR1310_I2S_REF_SHIFT, SPEAR1310_I2S_REF_SEL_MASK, 0, | 657 | SPEAR1310_I2S_REF_SHIFT, SPEAR1310_I2S_REF_SEL_MASK, 0, |
| 660 | &_lock); | 658 | &_lock); |
| 661 | clk_register_clkdev(clk, "i2s_ref_clk", NULL); | 659 | clk_register_clkdev(clk, "i2s_ref_clk", NULL); |
| 662 | 660 | ||
| 663 | clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mux_clk", 0, | 661 | clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0, |
| 664 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_I2S_REF_PAD_CLK_ENB, | 662 | SPEAR1310_PERIP2_CLK_ENB, SPEAR1310_I2S_REF_PAD_CLK_ENB, |
| 665 | 0, &_lock); | 663 | 0, &_lock); |
| 666 | clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL); | 664 | clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL); |
| 667 | 665 | ||
| 668 | clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gate_clk", | 666 | clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk", |
| 669 | "i2s_ref_pad_clk", 0, SPEAR1310_I2S_CLK_CFG, | 667 | "i2s_ref_pad_clk", 0, SPEAR1310_I2S_CLK_CFG, |
| 670 | &i2s_sclk_masks, i2s_sclk_rtbl, | 668 | &i2s_sclk_masks, i2s_sclk_rtbl, |
| 671 | ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1); | 669 | ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1); |
| 672 | clk_register_clkdev(clk, "i2s_sclk_clk", NULL); | 670 | clk_register_clkdev(clk, "i2s_sclk_clk", NULL); |
| 673 | clk_register_clkdev(clk1, "i2s_sclk_gate_clk", NULL); | 671 | clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL); |
| 674 | 672 | ||
| 675 | /* clock derived from ahb clk */ | 673 | /* clock derived from ahb clk */ |
| 676 | clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0, | 674 | clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0, |
| @@ -747,13 +745,13 @@ void __init spear1310_clk_init(void) | |||
| 747 | &_lock); | 745 | &_lock); |
| 748 | clk_register_clkdev(clk, "sysram1_clk", NULL); | 746 | clk_register_clkdev(clk, "sysram1_clk", NULL); |
| 749 | 747 | ||
| 750 | clk = clk_register_aux("adc_synth_clk", "adc_synth_gate_clk", "ahb_clk", | 748 | clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk", |
| 751 | 0, SPEAR1310_ADC_CLK_SYNT, NULL, adc_rtbl, | 749 | 0, SPEAR1310_ADC_CLK_SYNT, NULL, adc_rtbl, |
| 752 | ARRAY_SIZE(adc_rtbl), &_lock, &clk1); | 750 | ARRAY_SIZE(adc_rtbl), &_lock, &clk1); |
| 753 | clk_register_clkdev(clk, "adc_synth_clk", NULL); | 751 | clk_register_clkdev(clk, "adc_syn_clk", NULL); |
| 754 | clk_register_clkdev(clk1, "adc_synth_gate_clk", NULL); | 752 | clk_register_clkdev(clk1, "adc_syn_gclk", NULL); |
| 755 | 753 | ||
| 756 | clk = clk_register_gate(NULL, "adc_clk", "adc_synth_gate_clk", 0, | 754 | clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk", 0, |
| 757 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_ADC_CLK_ENB, 0, | 755 | SPEAR1310_PERIP1_CLK_ENB, SPEAR1310_ADC_CLK_ENB, 0, |
| 758 | &_lock); | 756 | &_lock); |
| 759 | clk_register_clkdev(clk, NULL, "adc_clk"); | 757 | clk_register_clkdev(clk, NULL, "adc_clk"); |
| @@ -790,37 +788,37 @@ void __init spear1310_clk_init(void) | |||
| 790 | clk_register_clkdev(clk, NULL, "e0300000.kbd"); | 788 | clk_register_clkdev(clk, NULL, "e0300000.kbd"); |
| 791 | 789 | ||
| 792 | /* RAS clks */ | 790 | /* RAS clks */ |
| 793 | clk = clk_register_mux(NULL, "gen_synth0_1_mux_clk", | 791 | clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents, |
| 794 | gen_synth0_1_parents, ARRAY_SIZE(gen_synth0_1_parents), | 792 | ARRAY_SIZE(gen_synth0_1_parents), 0, SPEAR1310_PLL_CFG, |
| 795 | 0, SPEAR1310_PLL_CFG, SPEAR1310_RAS_SYNT0_1_CLK_SHIFT, | 793 | SPEAR1310_RAS_SYNT0_1_CLK_SHIFT, |
| 796 | SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock); | 794 | SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock); |
| 797 | clk_register_clkdev(clk, "gen_synth0_1_clk", NULL); | 795 | clk_register_clkdev(clk, "gen_syn0_1_clk", NULL); |
| 798 | 796 | ||
| 799 | clk = clk_register_mux(NULL, "gen_synth2_3_mux_clk", | 797 | clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents, |
| 800 | gen_synth2_3_parents, ARRAY_SIZE(gen_synth2_3_parents), | 798 | ARRAY_SIZE(gen_synth2_3_parents), 0, SPEAR1310_PLL_CFG, |
| 801 | 0, SPEAR1310_PLL_CFG, SPEAR1310_RAS_SYNT2_3_CLK_SHIFT, | 799 | SPEAR1310_RAS_SYNT2_3_CLK_SHIFT, |
| 802 | SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock); | 800 | SPEAR1310_RAS_SYNT_CLK_MASK, 0, &_lock); |
| 803 | clk_register_clkdev(clk, "gen_synth2_3_clk", NULL); | 801 | clk_register_clkdev(clk, "gen_syn2_3_clk", NULL); |
| 804 | 802 | ||
| 805 | clk = clk_register_frac("gen_synth0_clk", "gen_synth0_1_clk", 0, | 803 | clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_clk", 0, |
| 806 | SPEAR1310_RAS_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 804 | SPEAR1310_RAS_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
| 807 | &_lock); | 805 | &_lock); |
| 808 | clk_register_clkdev(clk, "gen_synth0_clk", NULL); | 806 | clk_register_clkdev(clk, "gen_syn0_clk", NULL); |
| 809 | 807 | ||
| 810 | clk = clk_register_frac("gen_synth1_clk", "gen_synth0_1_clk", 0, | 808 | clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_clk", 0, |
| 811 | SPEAR1310_RAS_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 809 | SPEAR1310_RAS_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
| 812 | &_lock); | 810 | &_lock); |
| 813 | clk_register_clkdev(clk, "gen_synth1_clk", NULL); | 811 | clk_register_clkdev(clk, "gen_syn1_clk", NULL); |
| 814 | 812 | ||
| 815 | clk = clk_register_frac("gen_synth2_clk", "gen_synth2_3_clk", 0, | 813 | clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_clk", 0, |
| 816 | SPEAR1310_RAS_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 814 | SPEAR1310_RAS_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
| 817 | &_lock); | 815 | &_lock); |
| 818 | clk_register_clkdev(clk, "gen_synth2_clk", NULL); | 816 | clk_register_clkdev(clk, "gen_syn2_clk", NULL); |
| 819 | 817 | ||
| 820 | clk = clk_register_frac("gen_synth3_clk", "gen_synth2_3_clk", 0, | 818 | clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_clk", 0, |
| 821 | SPEAR1310_RAS_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 819 | SPEAR1310_RAS_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
| 822 | &_lock); | 820 | &_lock); |
| 823 | clk_register_clkdev(clk, "gen_synth3_clk", NULL); | 821 | clk_register_clkdev(clk, "gen_syn3_clk", NULL); |
| 824 | 822 | ||
| 825 | clk = clk_register_gate(NULL, "ras_osc_24m_clk", "osc_24m_clk", 0, | 823 | clk = clk_register_gate(NULL, "ras_osc_24m_clk", "osc_24m_clk", 0, |
| 826 | SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_24M_CLK_ENB, 0, | 824 | SPEAR1310_RAS_CLK_ENB, SPEAR1310_OSC_24M_CLK_ENB, 0, |
| @@ -847,7 +845,7 @@ void __init spear1310_clk_init(void) | |||
| 847 | &_lock); | 845 | &_lock); |
| 848 | clk_register_clkdev(clk, "ras_pll3_clk", NULL); | 846 | clk_register_clkdev(clk, "ras_pll3_clk", NULL); |
| 849 | 847 | ||
| 850 | clk = clk_register_gate(NULL, "ras_tx125_clk", "gmii_125m_pad_clk", 0, | 848 | clk = clk_register_gate(NULL, "ras_tx125_clk", "gmii_pad_clk", 0, |
| 851 | SPEAR1310_RAS_CLK_ENB, SPEAR1310_C125M_PAD_CLK_ENB, 0, | 849 | SPEAR1310_RAS_CLK_ENB, SPEAR1310_C125M_PAD_CLK_ENB, 0, |
| 852 | &_lock); | 850 | &_lock); |
| 853 | clk_register_clkdev(clk, "ras_tx125_clk", NULL); | 851 | clk_register_clkdev(clk, "ras_tx125_clk", NULL); |
| @@ -912,7 +910,7 @@ void __init spear1310_clk_init(void) | |||
| 912 | &_lock); | 910 | &_lock); |
| 913 | clk_register_clkdev(clk, NULL, "5c700000.eth"); | 911 | clk_register_clkdev(clk, NULL, "5c700000.eth"); |
| 914 | 912 | ||
| 915 | clk = clk_register_mux(NULL, "smii_rgmii_phy_mux_clk", | 913 | clk = clk_register_mux(NULL, "smii_rgmii_phy_mclk", |
| 916 | smii_rgmii_phy_parents, | 914 | smii_rgmii_phy_parents, |
| 917 | ARRAY_SIZE(smii_rgmii_phy_parents), 0, | 915 | ARRAY_SIZE(smii_rgmii_phy_parents), 0, |
| 918 | SPEAR1310_RAS_CTRL_REG1, | 916 | SPEAR1310_RAS_CTRL_REG1, |
| @@ -922,184 +920,184 @@ void __init spear1310_clk_init(void) | |||
| 922 | clk_register_clkdev(clk, NULL, "stmmacphy.2"); | 920 | clk_register_clkdev(clk, NULL, "stmmacphy.2"); |
| 923 | clk_register_clkdev(clk, NULL, "stmmacphy.4"); | 921 | clk_register_clkdev(clk, NULL, "stmmacphy.4"); |
| 924 | 922 | ||
| 925 | clk = clk_register_mux(NULL, "rmii_phy_mux_clk", rmii_phy_parents, | 923 | clk = clk_register_mux(NULL, "rmii_phy_mclk", rmii_phy_parents, |
| 926 | ARRAY_SIZE(rmii_phy_parents), 0, | 924 | ARRAY_SIZE(rmii_phy_parents), 0, |
| 927 | SPEAR1310_RAS_CTRL_REG1, SPEAR1310_RMII_PHY_CLK_SHIFT, | 925 | SPEAR1310_RAS_CTRL_REG1, SPEAR1310_RMII_PHY_CLK_SHIFT, |
| 928 | SPEAR1310_PHY_CLK_MASK, 0, &_lock); | 926 | SPEAR1310_PHY_CLK_MASK, 0, &_lock); |
| 929 | clk_register_clkdev(clk, NULL, "stmmacphy.3"); | 927 | clk_register_clkdev(clk, NULL, "stmmacphy.3"); |
| 930 | 928 | ||
| 931 | clk = clk_register_mux(NULL, "uart1_mux_clk", uart_parents, | 929 | clk = clk_register_mux(NULL, "uart1_mclk", uart_parents, |
| 932 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 930 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 933 | SPEAR1310_UART1_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 931 | SPEAR1310_UART1_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
| 934 | 0, &_lock); | 932 | 0, &_lock); |
| 935 | clk_register_clkdev(clk, "uart1_mux_clk", NULL); | 933 | clk_register_clkdev(clk, "uart1_mclk", NULL); |
| 936 | 934 | ||
| 937 | clk = clk_register_gate(NULL, "uart1_clk", "uart1_mux_clk", 0, | 935 | clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0, |
| 938 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART1_CLK_ENB, 0, | 936 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART1_CLK_ENB, 0, |
| 939 | &_lock); | 937 | &_lock); |
| 940 | clk_register_clkdev(clk, NULL, "5c800000.serial"); | 938 | clk_register_clkdev(clk, NULL, "5c800000.serial"); |
| 941 | 939 | ||
| 942 | clk = clk_register_mux(NULL, "uart2_mux_clk", uart_parents, | 940 | clk = clk_register_mux(NULL, "uart2_mclk", uart_parents, |
| 943 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 941 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 944 | SPEAR1310_UART2_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 942 | SPEAR1310_UART2_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
| 945 | 0, &_lock); | 943 | 0, &_lock); |
| 946 | clk_register_clkdev(clk, "uart2_mux_clk", NULL); | 944 | clk_register_clkdev(clk, "uart2_mclk", NULL); |
| 947 | 945 | ||
| 948 | clk = clk_register_gate(NULL, "uart2_clk", "uart2_mux_clk", 0, | 946 | clk = clk_register_gate(NULL, "uart2_clk", "uart2_mclk", 0, |
| 949 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART2_CLK_ENB, 0, | 947 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART2_CLK_ENB, 0, |
| 950 | &_lock); | 948 | &_lock); |
| 951 | clk_register_clkdev(clk, NULL, "5c900000.serial"); | 949 | clk_register_clkdev(clk, NULL, "5c900000.serial"); |
| 952 | 950 | ||
| 953 | clk = clk_register_mux(NULL, "uart3_mux_clk", uart_parents, | 951 | clk = clk_register_mux(NULL, "uart3_mclk", uart_parents, |
| 954 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 952 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 955 | SPEAR1310_UART3_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 953 | SPEAR1310_UART3_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
| 956 | 0, &_lock); | 954 | 0, &_lock); |
| 957 | clk_register_clkdev(clk, "uart3_mux_clk", NULL); | 955 | clk_register_clkdev(clk, "uart3_mclk", NULL); |
| 958 | 956 | ||
| 959 | clk = clk_register_gate(NULL, "uart3_clk", "uart3_mux_clk", 0, | 957 | clk = clk_register_gate(NULL, "uart3_clk", "uart3_mclk", 0, |
| 960 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART3_CLK_ENB, 0, | 958 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART3_CLK_ENB, 0, |
| 961 | &_lock); | 959 | &_lock); |
| 962 | clk_register_clkdev(clk, NULL, "5ca00000.serial"); | 960 | clk_register_clkdev(clk, NULL, "5ca00000.serial"); |
| 963 | 961 | ||
| 964 | clk = clk_register_mux(NULL, "uart4_mux_clk", uart_parents, | 962 | clk = clk_register_mux(NULL, "uart4_mclk", uart_parents, |
| 965 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 963 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 966 | SPEAR1310_UART4_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 964 | SPEAR1310_UART4_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
| 967 | 0, &_lock); | 965 | 0, &_lock); |
| 968 | clk_register_clkdev(clk, "uart4_mux_clk", NULL); | 966 | clk_register_clkdev(clk, "uart4_mclk", NULL); |
| 969 | 967 | ||
| 970 | clk = clk_register_gate(NULL, "uart4_clk", "uart4_mux_clk", 0, | 968 | clk = clk_register_gate(NULL, "uart4_clk", "uart4_mclk", 0, |
| 971 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART4_CLK_ENB, 0, | 969 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART4_CLK_ENB, 0, |
| 972 | &_lock); | 970 | &_lock); |
| 973 | clk_register_clkdev(clk, NULL, "5cb00000.serial"); | 971 | clk_register_clkdev(clk, NULL, "5cb00000.serial"); |
| 974 | 972 | ||
| 975 | clk = clk_register_mux(NULL, "uart5_mux_clk", uart_parents, | 973 | clk = clk_register_mux(NULL, "uart5_mclk", uart_parents, |
| 976 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 974 | ARRAY_SIZE(uart_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 977 | SPEAR1310_UART5_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, | 975 | SPEAR1310_UART5_CLK_SHIFT, SPEAR1310_RAS_UART_CLK_MASK, |
| 978 | 0, &_lock); | 976 | 0, &_lock); |
| 979 | clk_register_clkdev(clk, "uart5_mux_clk", NULL); | 977 | clk_register_clkdev(clk, "uart5_mclk", NULL); |
| 980 | 978 | ||
| 981 | clk = clk_register_gate(NULL, "uart5_clk", "uart5_mux_clk", 0, | 979 | clk = clk_register_gate(NULL, "uart5_clk", "uart5_mclk", 0, |
| 982 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART5_CLK_ENB, 0, | 980 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_UART5_CLK_ENB, 0, |
| 983 | &_lock); | 981 | &_lock); |
| 984 | clk_register_clkdev(clk, NULL, "5cc00000.serial"); | 982 | clk_register_clkdev(clk, NULL, "5cc00000.serial"); |
| 985 | 983 | ||
| 986 | clk = clk_register_mux(NULL, "i2c1_mux_clk", i2c_parents, | 984 | clk = clk_register_mux(NULL, "i2c1_mclk", i2c_parents, |
| 987 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 985 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 988 | SPEAR1310_I2C1_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 986 | SPEAR1310_I2C1_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
| 989 | &_lock); | 987 | &_lock); |
| 990 | clk_register_clkdev(clk, "i2c1_mux_clk", NULL); | 988 | clk_register_clkdev(clk, "i2c1_mclk", NULL); |
| 991 | 989 | ||
| 992 | clk = clk_register_gate(NULL, "i2c1_clk", "i2c1_mux_clk", 0, | 990 | clk = clk_register_gate(NULL, "i2c1_clk", "i2c1_mclk", 0, |
| 993 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C1_CLK_ENB, 0, | 991 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C1_CLK_ENB, 0, |
| 994 | &_lock); | 992 | &_lock); |
| 995 | clk_register_clkdev(clk, NULL, "5cd00000.i2c"); | 993 | clk_register_clkdev(clk, NULL, "5cd00000.i2c"); |
| 996 | 994 | ||
| 997 | clk = clk_register_mux(NULL, "i2c2_mux_clk", i2c_parents, | 995 | clk = clk_register_mux(NULL, "i2c2_mclk", i2c_parents, |
| 998 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 996 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 999 | SPEAR1310_I2C2_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 997 | SPEAR1310_I2C2_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
| 1000 | &_lock); | 998 | &_lock); |
| 1001 | clk_register_clkdev(clk, "i2c2_mux_clk", NULL); | 999 | clk_register_clkdev(clk, "i2c2_mclk", NULL); |
| 1002 | 1000 | ||
| 1003 | clk = clk_register_gate(NULL, "i2c2_clk", "i2c2_mux_clk", 0, | 1001 | clk = clk_register_gate(NULL, "i2c2_clk", "i2c2_mclk", 0, |
| 1004 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C2_CLK_ENB, 0, | 1002 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C2_CLK_ENB, 0, |
| 1005 | &_lock); | 1003 | &_lock); |
| 1006 | clk_register_clkdev(clk, NULL, "5ce00000.i2c"); | 1004 | clk_register_clkdev(clk, NULL, "5ce00000.i2c"); |
| 1007 | 1005 | ||
| 1008 | clk = clk_register_mux(NULL, "i2c3_mux_clk", i2c_parents, | 1006 | clk = clk_register_mux(NULL, "i2c3_mclk", i2c_parents, |
| 1009 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1007 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1010 | SPEAR1310_I2C3_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1008 | SPEAR1310_I2C3_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
| 1011 | &_lock); | 1009 | &_lock); |
| 1012 | clk_register_clkdev(clk, "i2c3_mux_clk", NULL); | 1010 | clk_register_clkdev(clk, "i2c3_mclk", NULL); |
| 1013 | 1011 | ||
| 1014 | clk = clk_register_gate(NULL, "i2c3_clk", "i2c3_mux_clk", 0, | 1012 | clk = clk_register_gate(NULL, "i2c3_clk", "i2c3_mclk", 0, |
| 1015 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C3_CLK_ENB, 0, | 1013 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C3_CLK_ENB, 0, |
| 1016 | &_lock); | 1014 | &_lock); |
| 1017 | clk_register_clkdev(clk, NULL, "5cf00000.i2c"); | 1015 | clk_register_clkdev(clk, NULL, "5cf00000.i2c"); |
| 1018 | 1016 | ||
| 1019 | clk = clk_register_mux(NULL, "i2c4_mux_clk", i2c_parents, | 1017 | clk = clk_register_mux(NULL, "i2c4_mclk", i2c_parents, |
| 1020 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1018 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1021 | SPEAR1310_I2C4_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1019 | SPEAR1310_I2C4_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
| 1022 | &_lock); | 1020 | &_lock); |
| 1023 | clk_register_clkdev(clk, "i2c4_mux_clk", NULL); | 1021 | clk_register_clkdev(clk, "i2c4_mclk", NULL); |
| 1024 | 1022 | ||
| 1025 | clk = clk_register_gate(NULL, "i2c4_clk", "i2c4_mux_clk", 0, | 1023 | clk = clk_register_gate(NULL, "i2c4_clk", "i2c4_mclk", 0, |
| 1026 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C4_CLK_ENB, 0, | 1024 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C4_CLK_ENB, 0, |
| 1027 | &_lock); | 1025 | &_lock); |
| 1028 | clk_register_clkdev(clk, NULL, "5d000000.i2c"); | 1026 | clk_register_clkdev(clk, NULL, "5d000000.i2c"); |
| 1029 | 1027 | ||
| 1030 | clk = clk_register_mux(NULL, "i2c5_mux_clk", i2c_parents, | 1028 | clk = clk_register_mux(NULL, "i2c5_mclk", i2c_parents, |
| 1031 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1029 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1032 | SPEAR1310_I2C5_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1030 | SPEAR1310_I2C5_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
| 1033 | &_lock); | 1031 | &_lock); |
| 1034 | clk_register_clkdev(clk, "i2c5_mux_clk", NULL); | 1032 | clk_register_clkdev(clk, "i2c5_mclk", NULL); |
| 1035 | 1033 | ||
| 1036 | clk = clk_register_gate(NULL, "i2c5_clk", "i2c5_mux_clk", 0, | 1034 | clk = clk_register_gate(NULL, "i2c5_clk", "i2c5_mclk", 0, |
| 1037 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C5_CLK_ENB, 0, | 1035 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C5_CLK_ENB, 0, |
| 1038 | &_lock); | 1036 | &_lock); |
| 1039 | clk_register_clkdev(clk, NULL, "5d100000.i2c"); | 1037 | clk_register_clkdev(clk, NULL, "5d100000.i2c"); |
| 1040 | 1038 | ||
| 1041 | clk = clk_register_mux(NULL, "i2c6_mux_clk", i2c_parents, | 1039 | clk = clk_register_mux(NULL, "i2c6_mclk", i2c_parents, |
| 1042 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1040 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1043 | SPEAR1310_I2C6_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1041 | SPEAR1310_I2C6_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
| 1044 | &_lock); | 1042 | &_lock); |
| 1045 | clk_register_clkdev(clk, "i2c6_mux_clk", NULL); | 1043 | clk_register_clkdev(clk, "i2c6_mclk", NULL); |
| 1046 | 1044 | ||
| 1047 | clk = clk_register_gate(NULL, "i2c6_clk", "i2c6_mux_clk", 0, | 1045 | clk = clk_register_gate(NULL, "i2c6_clk", "i2c6_mclk", 0, |
| 1048 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C6_CLK_ENB, 0, | 1046 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C6_CLK_ENB, 0, |
| 1049 | &_lock); | 1047 | &_lock); |
| 1050 | clk_register_clkdev(clk, NULL, "5d200000.i2c"); | 1048 | clk_register_clkdev(clk, NULL, "5d200000.i2c"); |
| 1051 | 1049 | ||
| 1052 | clk = clk_register_mux(NULL, "i2c7_mux_clk", i2c_parents, | 1050 | clk = clk_register_mux(NULL, "i2c7_mclk", i2c_parents, |
| 1053 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1051 | ARRAY_SIZE(i2c_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1054 | SPEAR1310_I2C7_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, | 1052 | SPEAR1310_I2C7_CLK_SHIFT, SPEAR1310_I2C_CLK_MASK, 0, |
| 1055 | &_lock); | 1053 | &_lock); |
| 1056 | clk_register_clkdev(clk, "i2c7_mux_clk", NULL); | 1054 | clk_register_clkdev(clk, "i2c7_mclk", NULL); |
| 1057 | 1055 | ||
| 1058 | clk = clk_register_gate(NULL, "i2c7_clk", "i2c7_mux_clk", 0, | 1056 | clk = clk_register_gate(NULL, "i2c7_clk", "i2c7_mclk", 0, |
| 1059 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C7_CLK_ENB, 0, | 1057 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_I2C7_CLK_ENB, 0, |
| 1060 | &_lock); | 1058 | &_lock); |
| 1061 | clk_register_clkdev(clk, NULL, "5d300000.i2c"); | 1059 | clk_register_clkdev(clk, NULL, "5d300000.i2c"); |
| 1062 | 1060 | ||
| 1063 | clk = clk_register_mux(NULL, "ssp1_mux_clk", ssp1_parents, | 1061 | clk = clk_register_mux(NULL, "ssp1_mclk", ssp1_parents, |
| 1064 | ARRAY_SIZE(ssp1_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1062 | ARRAY_SIZE(ssp1_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1065 | SPEAR1310_SSP1_CLK_SHIFT, SPEAR1310_SSP1_CLK_MASK, 0, | 1063 | SPEAR1310_SSP1_CLK_SHIFT, SPEAR1310_SSP1_CLK_MASK, 0, |
| 1066 | &_lock); | 1064 | &_lock); |
| 1067 | clk_register_clkdev(clk, "ssp1_mux_clk", NULL); | 1065 | clk_register_clkdev(clk, "ssp1_mclk", NULL); |
| 1068 | 1066 | ||
| 1069 | clk = clk_register_gate(NULL, "ssp1_clk", "ssp1_mux_clk", 0, | 1067 | clk = clk_register_gate(NULL, "ssp1_clk", "ssp1_mclk", 0, |
| 1070 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_SSP1_CLK_ENB, 0, | 1068 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_SSP1_CLK_ENB, 0, |
| 1071 | &_lock); | 1069 | &_lock); |
| 1072 | clk_register_clkdev(clk, NULL, "5d400000.spi"); | 1070 | clk_register_clkdev(clk, NULL, "5d400000.spi"); |
| 1073 | 1071 | ||
| 1074 | clk = clk_register_mux(NULL, "pci_mux_clk", pci_parents, | 1072 | clk = clk_register_mux(NULL, "pci_mclk", pci_parents, |
| 1075 | ARRAY_SIZE(pci_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1073 | ARRAY_SIZE(pci_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1076 | SPEAR1310_PCI_CLK_SHIFT, SPEAR1310_PCI_CLK_MASK, 0, | 1074 | SPEAR1310_PCI_CLK_SHIFT, SPEAR1310_PCI_CLK_MASK, 0, |
| 1077 | &_lock); | 1075 | &_lock); |
| 1078 | clk_register_clkdev(clk, "pci_mux_clk", NULL); | 1076 | clk_register_clkdev(clk, "pci_mclk", NULL); |
| 1079 | 1077 | ||
| 1080 | clk = clk_register_gate(NULL, "pci_clk", "pci_mux_clk", 0, | 1078 | clk = clk_register_gate(NULL, "pci_clk", "pci_mclk", 0, |
| 1081 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_PCI_CLK_ENB, 0, | 1079 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_PCI_CLK_ENB, 0, |
| 1082 | &_lock); | 1080 | &_lock); |
| 1083 | clk_register_clkdev(clk, NULL, "pci"); | 1081 | clk_register_clkdev(clk, NULL, "pci"); |
| 1084 | 1082 | ||
| 1085 | clk = clk_register_mux(NULL, "tdm1_mux_clk", tdm_parents, | 1083 | clk = clk_register_mux(NULL, "tdm1_mclk", tdm_parents, |
| 1086 | ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1084 | ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1087 | SPEAR1310_TDM1_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0, | 1085 | SPEAR1310_TDM1_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0, |
| 1088 | &_lock); | 1086 | &_lock); |
| 1089 | clk_register_clkdev(clk, "tdm1_mux_clk", NULL); | 1087 | clk_register_clkdev(clk, "tdm1_mclk", NULL); |
| 1090 | 1088 | ||
| 1091 | clk = clk_register_gate(NULL, "tdm1_clk", "tdm1_mux_clk", 0, | 1089 | clk = clk_register_gate(NULL, "tdm1_clk", "tdm1_mclk", 0, |
| 1092 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM1_CLK_ENB, 0, | 1090 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM1_CLK_ENB, 0, |
| 1093 | &_lock); | 1091 | &_lock); |
| 1094 | clk_register_clkdev(clk, NULL, "tdm_hdlc.0"); | 1092 | clk_register_clkdev(clk, NULL, "tdm_hdlc.0"); |
| 1095 | 1093 | ||
| 1096 | clk = clk_register_mux(NULL, "tdm2_mux_clk", tdm_parents, | 1094 | clk = clk_register_mux(NULL, "tdm2_mclk", tdm_parents, |
| 1097 | ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0, | 1095 | ARRAY_SIZE(tdm_parents), 0, SPEAR1310_RAS_CTRL_REG0, |
| 1098 | SPEAR1310_TDM2_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0, | 1096 | SPEAR1310_TDM2_CLK_SHIFT, SPEAR1310_TDM_CLK_MASK, 0, |
| 1099 | &_lock); | 1097 | &_lock); |
| 1100 | clk_register_clkdev(clk, "tdm2_mux_clk", NULL); | 1098 | clk_register_clkdev(clk, "tdm2_mclk", NULL); |
| 1101 | 1099 | ||
| 1102 | clk = clk_register_gate(NULL, "tdm2_clk", "tdm2_mux_clk", 0, | 1100 | clk = clk_register_gate(NULL, "tdm2_clk", "tdm2_mclk", 0, |
| 1103 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM2_CLK_ENB, 0, | 1101 | SPEAR1310_RAS_SW_CLK_CTRL, SPEAR1310_TDM2_CLK_ENB, 0, |
| 1104 | &_lock); | 1102 | &_lock); |
| 1105 | clk_register_clkdev(clk, NULL, "tdm_hdlc.1"); | 1103 | clk_register_clkdev(clk, NULL, "tdm_hdlc.1"); |
diff --git a/drivers/clk/spear/spear1340_clock.c b/drivers/clk/spear/spear1340_clock.c index f130919d5bf8..2352cee7f645 100644 --- a/drivers/clk/spear/spear1340_clock.c +++ b/drivers/clk/spear/spear1340_clock.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * SPEAr1340 machine clock framework source file | 4 | * SPEAr1340 machine clock framework source file |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2012 ST Microelectronics | 6 | * Copyright (C) 2012 ST Microelectronics |
| 7 | * Viresh Kumar <viresh.kumar@st.com> | 7 | * Viresh Kumar <viresh.linux@gmail.com> |
| 8 | * | 8 | * |
| 9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
| 10 | * License version 2. This program is licensed "as is" without any | 10 | * License version 2. This program is licensed "as is" without any |
| @@ -369,27 +369,25 @@ static struct frac_rate_tbl gen_rtbl[] = { | |||
| 369 | 369 | ||
| 370 | /* clock parents */ | 370 | /* clock parents */ |
| 371 | static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", }; | 371 | static const char *vco_parents[] = { "osc_24m_clk", "osc_25m_clk", }; |
| 372 | static const char *sys_parents[] = { "none", "pll1_clk", "none", "none", | 372 | static const char *sys_parents[] = { "pll1_clk", "pll1_clk", "pll1_clk", |
| 373 | "sys_synth_clk", "none", "pll2_clk", "pll3_clk", }; | 373 | "pll1_clk", "sys_synth_clk", "sys_synth_clk", "pll2_clk", "pll3_clk", }; |
| 374 | static const char *ahb_parents[] = { "cpu_div3_clk", "amba_synth_clk", }; | 374 | static const char *ahb_parents[] = { "cpu_div3_clk", "amba_syn_clk", }; |
| 375 | static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", }; | 375 | static const char *gpt_parents[] = { "osc_24m_clk", "apb_clk", }; |
| 376 | static const char *uart0_parents[] = { "pll5_clk", "osc_24m_clk", | 376 | static const char *uart0_parents[] = { "pll5_clk", "osc_24m_clk", |
| 377 | "uart0_synth_gate_clk", }; | 377 | "uart0_syn_gclk", }; |
| 378 | static const char *uart1_parents[] = { "pll5_clk", "osc_24m_clk", | 378 | static const char *uart1_parents[] = { "pll5_clk", "osc_24m_clk", |
| 379 | "uart1_synth_gate_clk", }; | 379 | "uart1_syn_gclk", }; |
| 380 | static const char *c3_parents[] = { "pll5_clk", "c3_synth_gate_clk", }; | 380 | static const char *c3_parents[] = { "pll5_clk", "c3_syn_gclk", }; |
| 381 | static const char *gmac_phy_input_parents[] = { "gmii_125m_pad_clk", "pll2_clk", | 381 | static const char *gmac_phy_input_parents[] = { "gmii_pad_clk", "pll2_clk", |
| 382 | "osc_25m_clk", }; | 382 | "osc_25m_clk", }; |
| 383 | static const char *gmac_phy_parents[] = { "gmac_phy_input_mux_clk", | 383 | static const char *gmac_phy_parents[] = { "phy_input_mclk", "phy_syn_gclk", }; |
| 384 | "gmac_phy_synth_gate_clk", }; | ||
| 385 | static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", }; | 384 | static const char *clcd_synth_parents[] = { "vco1div4_clk", "pll2_clk", }; |
| 386 | static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_synth_clk", }; | 385 | static const char *clcd_pixel_parents[] = { "pll5_clk", "clcd_syn_clk", }; |
| 387 | static const char *i2s_src_parents[] = { "vco1div2_clk", "pll2_clk", "pll3_clk", | 386 | static const char *i2s_src_parents[] = { "vco1div2_clk", "pll2_clk", "pll3_clk", |
| 388 | "i2s_src_pad_clk", }; | 387 | "i2s_src_pad_clk", }; |
| 389 | static const char *i2s_ref_parents[] = { "i2s_src_mux_clk", "i2s_prs1_clk", }; | 388 | static const char *i2s_ref_parents[] = { "i2s_src_mclk", "i2s_prs1_clk", }; |
| 390 | static const char *spdif_out_parents[] = { "i2s_src_pad_clk", "gen_synth2_clk", | 389 | static const char *spdif_out_parents[] = { "i2s_src_pad_clk", "gen_syn2_clk", }; |
| 391 | }; | 390 | static const char *spdif_in_parents[] = { "pll2_clk", "gen_syn3_clk", }; |
| 392 | static const char *spdif_in_parents[] = { "pll2_clk", "gen_synth3_clk", }; | ||
| 393 | 391 | ||
| 394 | static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", | 392 | static const char *gen_synth0_1_parents[] = { "vco1div4_clk", "vco3div2_clk", |
| 395 | "pll3_clk", }; | 393 | "pll3_clk", }; |
| @@ -415,9 +413,9 @@ void __init spear1340_clk_init(void) | |||
| 415 | 25000000); | 413 | 25000000); |
| 416 | clk_register_clkdev(clk, "osc_25m_clk", NULL); | 414 | clk_register_clkdev(clk, "osc_25m_clk", NULL); |
| 417 | 415 | ||
| 418 | clk = clk_register_fixed_rate(NULL, "gmii_125m_pad_clk", NULL, | 416 | clk = clk_register_fixed_rate(NULL, "gmii_pad_clk", NULL, CLK_IS_ROOT, |
| 419 | CLK_IS_ROOT, 125000000); | 417 | 125000000); |
| 420 | clk_register_clkdev(clk, "gmii_125m_pad_clk", NULL); | 418 | clk_register_clkdev(clk, "gmii_pad_clk", NULL); |
| 421 | 419 | ||
| 422 | clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, | 420 | clk = clk_register_fixed_rate(NULL, "i2s_src_pad_clk", NULL, |
| 423 | CLK_IS_ROOT, 12288000); | 421 | CLK_IS_ROOT, 12288000); |
| @@ -431,35 +429,35 @@ void __init spear1340_clk_init(void) | |||
| 431 | 429 | ||
| 432 | /* clock derived from 24 or 25 MHz osc clk */ | 430 | /* clock derived from 24 or 25 MHz osc clk */ |
| 433 | /* vco-pll */ | 431 | /* vco-pll */ |
| 434 | clk = clk_register_mux(NULL, "vco1_mux_clk", vco_parents, | 432 | clk = clk_register_mux(NULL, "vco1_mclk", vco_parents, |
| 435 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, | 433 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, |
| 436 | SPEAR1340_PLL1_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, | 434 | SPEAR1340_PLL1_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, |
| 437 | &_lock); | 435 | &_lock); |
| 438 | clk_register_clkdev(clk, "vco1_mux_clk", NULL); | 436 | clk_register_clkdev(clk, "vco1_mclk", NULL); |
| 439 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mux_clk", | 437 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "vco1_mclk", 0, |
| 440 | 0, SPEAR1340_PLL1_CTR, SPEAR1340_PLL1_FRQ, pll_rtbl, | 438 | SPEAR1340_PLL1_CTR, SPEAR1340_PLL1_FRQ, pll_rtbl, |
| 441 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 439 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
| 442 | clk_register_clkdev(clk, "vco1_clk", NULL); | 440 | clk_register_clkdev(clk, "vco1_clk", NULL); |
| 443 | clk_register_clkdev(clk1, "pll1_clk", NULL); | 441 | clk_register_clkdev(clk1, "pll1_clk", NULL); |
| 444 | 442 | ||
| 445 | clk = clk_register_mux(NULL, "vco2_mux_clk", vco_parents, | 443 | clk = clk_register_mux(NULL, "vco2_mclk", vco_parents, |
| 446 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, | 444 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, |
| 447 | SPEAR1340_PLL2_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, | 445 | SPEAR1340_PLL2_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, |
| 448 | &_lock); | 446 | &_lock); |
| 449 | clk_register_clkdev(clk, "vco2_mux_clk", NULL); | 447 | clk_register_clkdev(clk, "vco2_mclk", NULL); |
| 450 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mux_clk", | 448 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "vco2_mclk", 0, |
| 451 | 0, SPEAR1340_PLL2_CTR, SPEAR1340_PLL2_FRQ, pll_rtbl, | 449 | SPEAR1340_PLL2_CTR, SPEAR1340_PLL2_FRQ, pll_rtbl, |
| 452 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 450 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
| 453 | clk_register_clkdev(clk, "vco2_clk", NULL); | 451 | clk_register_clkdev(clk, "vco2_clk", NULL); |
| 454 | clk_register_clkdev(clk1, "pll2_clk", NULL); | 452 | clk_register_clkdev(clk1, "pll2_clk", NULL); |
| 455 | 453 | ||
| 456 | clk = clk_register_mux(NULL, "vco3_mux_clk", vco_parents, | 454 | clk = clk_register_mux(NULL, "vco3_mclk", vco_parents, |
| 457 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, | 455 | ARRAY_SIZE(vco_parents), 0, SPEAR1340_PLL_CFG, |
| 458 | SPEAR1340_PLL3_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, | 456 | SPEAR1340_PLL3_CLK_SHIFT, SPEAR1340_PLL_CLK_MASK, 0, |
| 459 | &_lock); | 457 | &_lock); |
| 460 | clk_register_clkdev(clk, "vco3_mux_clk", NULL); | 458 | clk_register_clkdev(clk, "vco3_mclk", NULL); |
| 461 | clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mux_clk", | 459 | clk = clk_register_vco_pll("vco3_clk", "pll3_clk", NULL, "vco3_mclk", 0, |
| 462 | 0, SPEAR1340_PLL3_CTR, SPEAR1340_PLL3_FRQ, pll_rtbl, | 460 | SPEAR1340_PLL3_CTR, SPEAR1340_PLL3_FRQ, pll_rtbl, |
| 463 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 461 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); |
| 464 | clk_register_clkdev(clk, "vco3_clk", NULL); | 462 | clk_register_clkdev(clk, "vco3_clk", NULL); |
| 465 | clk_register_clkdev(clk1, "pll3_clk", NULL); | 463 | clk_register_clkdev(clk1, "pll3_clk", NULL); |
| @@ -498,7 +496,7 @@ void __init spear1340_clk_init(void) | |||
| 498 | /* peripherals */ | 496 | /* peripherals */ |
| 499 | clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1, | 497 | clk_register_fixed_factor(NULL, "thermal_clk", "osc_24m_clk", 0, 1, |
| 500 | 128); | 498 | 128); |
| 501 | clk = clk_register_gate(NULL, "thermal_gate_clk", "thermal_clk", 0, | 499 | clk = clk_register_gate(NULL, "thermal_gclk", "thermal_clk", 0, |
| 502 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_THSENS_CLK_ENB, 0, | 500 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_THSENS_CLK_ENB, 0, |
| 503 | &_lock); | 501 | &_lock); |
| 504 | clk_register_clkdev(clk, NULL, "spear_thermal"); | 502 | clk_register_clkdev(clk, NULL, "spear_thermal"); |
| @@ -509,23 +507,23 @@ void __init spear1340_clk_init(void) | |||
| 509 | clk_register_clkdev(clk, "ddr_clk", NULL); | 507 | clk_register_clkdev(clk, "ddr_clk", NULL); |
| 510 | 508 | ||
| 511 | /* clock derived from pll1 clk */ | 509 | /* clock derived from pll1 clk */ |
| 512 | clk = clk_register_frac("sys_synth_clk", "vco1div2_clk", 0, | 510 | clk = clk_register_frac("sys_syn_clk", "vco1div2_clk", 0, |
| 513 | SPEAR1340_SYS_CLK_SYNT, sys_synth_rtbl, | 511 | SPEAR1340_SYS_CLK_SYNT, sys_synth_rtbl, |
| 514 | ARRAY_SIZE(sys_synth_rtbl), &_lock); | 512 | ARRAY_SIZE(sys_synth_rtbl), &_lock); |
| 515 | clk_register_clkdev(clk, "sys_synth_clk", NULL); | 513 | clk_register_clkdev(clk, "sys_syn_clk", NULL); |
| 516 | 514 | ||
| 517 | clk = clk_register_frac("amba_synth_clk", "vco1div2_clk", 0, | 515 | clk = clk_register_frac("amba_syn_clk", "vco1div2_clk", 0, |
| 518 | SPEAR1340_AMBA_CLK_SYNT, amba_synth_rtbl, | 516 | SPEAR1340_AMBA_CLK_SYNT, amba_synth_rtbl, |
| 519 | ARRAY_SIZE(amba_synth_rtbl), &_lock); | 517 | ARRAY_SIZE(amba_synth_rtbl), &_lock); |
| 520 | clk_register_clkdev(clk, "amba_synth_clk", NULL); | 518 | clk_register_clkdev(clk, "amba_syn_clk", NULL); |
| 521 | 519 | ||
| 522 | clk = clk_register_mux(NULL, "sys_mux_clk", sys_parents, | 520 | clk = clk_register_mux(NULL, "sys_mclk", sys_parents, |
| 523 | ARRAY_SIZE(sys_parents), 0, SPEAR1340_SYS_CLK_CTRL, | 521 | ARRAY_SIZE(sys_parents), 0, SPEAR1340_SYS_CLK_CTRL, |
| 524 | SPEAR1340_SCLK_SRC_SEL_SHIFT, | 522 | SPEAR1340_SCLK_SRC_SEL_SHIFT, |
| 525 | SPEAR1340_SCLK_SRC_SEL_MASK, 0, &_lock); | 523 | SPEAR1340_SCLK_SRC_SEL_MASK, 0, &_lock); |
| 526 | clk_register_clkdev(clk, "sys_clk", NULL); | 524 | clk_register_clkdev(clk, "sys_clk", NULL); |
| 527 | 525 | ||
| 528 | clk = clk_register_fixed_factor(NULL, "cpu_clk", "sys_mux_clk", 0, 1, | 526 | clk = clk_register_fixed_factor(NULL, "cpu_clk", "sys_mclk", 0, 1, |
| 529 | 2); | 527 | 2); |
| 530 | clk_register_clkdev(clk, "cpu_clk", NULL); | 528 | clk_register_clkdev(clk, "cpu_clk", NULL); |
| 531 | 529 | ||
| @@ -548,194 +546,193 @@ void __init spear1340_clk_init(void) | |||
| 548 | clk_register_clkdev(clk, "apb_clk", NULL); | 546 | clk_register_clkdev(clk, "apb_clk", NULL); |
| 549 | 547 | ||
| 550 | /* gpt clocks */ | 548 | /* gpt clocks */ |
| 551 | clk = clk_register_mux(NULL, "gpt0_mux_clk", gpt_parents, | 549 | clk = clk_register_mux(NULL, "gpt0_mclk", gpt_parents, |
| 552 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 550 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
| 553 | SPEAR1340_GPT0_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, | 551 | SPEAR1340_GPT0_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, |
| 554 | &_lock); | 552 | &_lock); |
| 555 | clk_register_clkdev(clk, "gpt0_mux_clk", NULL); | 553 | clk_register_clkdev(clk, "gpt0_mclk", NULL); |
| 556 | clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mux_clk", 0, | 554 | clk = clk_register_gate(NULL, "gpt0_clk", "gpt0_mclk", 0, |
| 557 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT0_CLK_ENB, 0, | 555 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT0_CLK_ENB, 0, |
| 558 | &_lock); | 556 | &_lock); |
| 559 | clk_register_clkdev(clk, NULL, "gpt0"); | 557 | clk_register_clkdev(clk, NULL, "gpt0"); |
| 560 | 558 | ||
| 561 | clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt_parents, | 559 | clk = clk_register_mux(NULL, "gpt1_mclk", gpt_parents, |
| 562 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 560 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
| 563 | SPEAR1340_GPT1_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, | 561 | SPEAR1340_GPT1_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, |
| 564 | &_lock); | 562 | &_lock); |
| 565 | clk_register_clkdev(clk, "gpt1_mux_clk", NULL); | 563 | clk_register_clkdev(clk, "gpt1_mclk", NULL); |
| 566 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0, | 564 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0, |
| 567 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT1_CLK_ENB, 0, | 565 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_GPT1_CLK_ENB, 0, |
| 568 | &_lock); | 566 | &_lock); |
| 569 | clk_register_clkdev(clk, NULL, "gpt1"); | 567 | clk_register_clkdev(clk, NULL, "gpt1"); |
| 570 | 568 | ||
| 571 | clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt_parents, | 569 | clk = clk_register_mux(NULL, "gpt2_mclk", gpt_parents, |
| 572 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 570 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
| 573 | SPEAR1340_GPT2_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, | 571 | SPEAR1340_GPT2_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, |
| 574 | &_lock); | 572 | &_lock); |
| 575 | clk_register_clkdev(clk, "gpt2_mux_clk", NULL); | 573 | clk_register_clkdev(clk, "gpt2_mclk", NULL); |
| 576 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0, | 574 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0, |
| 577 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT2_CLK_ENB, 0, | 575 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT2_CLK_ENB, 0, |
| 578 | &_lock); | 576 | &_lock); |
| 579 | clk_register_clkdev(clk, NULL, "gpt2"); | 577 | clk_register_clkdev(clk, NULL, "gpt2"); |
| 580 | 578 | ||
| 581 | clk = clk_register_mux(NULL, "gpt3_mux_clk", gpt_parents, | 579 | clk = clk_register_mux(NULL, "gpt3_mclk", gpt_parents, |
| 582 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 580 | ARRAY_SIZE(gpt_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
| 583 | SPEAR1340_GPT3_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, | 581 | SPEAR1340_GPT3_CLK_SHIFT, SPEAR1340_GPT_CLK_MASK, 0, |
| 584 | &_lock); | 582 | &_lock); |
| 585 | clk_register_clkdev(clk, "gpt3_mux_clk", NULL); | 583 | clk_register_clkdev(clk, "gpt3_mclk", NULL); |
| 586 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mux_clk", 0, | 584 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0, |
| 587 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT3_CLK_ENB, 0, | 585 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_GPT3_CLK_ENB, 0, |
| 588 | &_lock); | 586 | &_lock); |
| 589 | clk_register_clkdev(clk, NULL, "gpt3"); | 587 | clk_register_clkdev(clk, NULL, "gpt3"); |
| 590 | 588 | ||
| 591 | /* others */ | 589 | /* others */ |
| 592 | clk = clk_register_aux("uart0_synth_clk", "uart0_synth_gate_clk", | 590 | clk = clk_register_aux("uart0_syn_clk", "uart0_syn_gclk", |
| 593 | "vco1div2_clk", 0, SPEAR1340_UART0_CLK_SYNT, NULL, | 591 | "vco1div2_clk", 0, SPEAR1340_UART0_CLK_SYNT, NULL, |
| 594 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 592 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 595 | clk_register_clkdev(clk, "uart0_synth_clk", NULL); | 593 | clk_register_clkdev(clk, "uart0_syn_clk", NULL); |
| 596 | clk_register_clkdev(clk1, "uart0_synth_gate_clk", NULL); | 594 | clk_register_clkdev(clk1, "uart0_syn_gclk", NULL); |
| 597 | 595 | ||
| 598 | clk = clk_register_mux(NULL, "uart0_mux_clk", uart0_parents, | 596 | clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents, |
| 599 | ARRAY_SIZE(uart0_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 597 | ARRAY_SIZE(uart0_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
| 600 | SPEAR1340_UART0_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0, | 598 | SPEAR1340_UART0_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0, |
| 601 | &_lock); | 599 | &_lock); |
| 602 | clk_register_clkdev(clk, "uart0_mux_clk", NULL); | 600 | clk_register_clkdev(clk, "uart0_mclk", NULL); |
| 603 | 601 | ||
| 604 | clk = clk_register_gate(NULL, "uart0_clk", "uart0_mux_clk", 0, | 602 | clk = clk_register_gate(NULL, "uart0_clk", "uart0_mclk", 0, |
| 605 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UART0_CLK_ENB, 0, | 603 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UART0_CLK_ENB, 0, |
| 606 | &_lock); | 604 | &_lock); |
| 607 | clk_register_clkdev(clk, NULL, "e0000000.serial"); | 605 | clk_register_clkdev(clk, NULL, "e0000000.serial"); |
| 608 | 606 | ||
| 609 | clk = clk_register_aux("uart1_synth_clk", "uart1_synth_gate_clk", | 607 | clk = clk_register_aux("uart1_syn_clk", "uart1_syn_gclk", |
| 610 | "vco1div2_clk", 0, SPEAR1340_UART1_CLK_SYNT, NULL, | 608 | "vco1div2_clk", 0, SPEAR1340_UART1_CLK_SYNT, NULL, |
| 611 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 609 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 612 | clk_register_clkdev(clk, "uart1_synth_clk", NULL); | 610 | clk_register_clkdev(clk, "uart1_syn_clk", NULL); |
| 613 | clk_register_clkdev(clk1, "uart1_synth_gate_clk", NULL); | 611 | clk_register_clkdev(clk1, "uart1_syn_gclk", NULL); |
| 614 | 612 | ||
| 615 | clk = clk_register_mux(NULL, "uart1_mux_clk", uart1_parents, | 613 | clk = clk_register_mux(NULL, "uart1_mclk", uart1_parents, |
| 616 | ARRAY_SIZE(uart1_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 614 | ARRAY_SIZE(uart1_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
| 617 | SPEAR1340_UART1_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0, | 615 | SPEAR1340_UART1_CLK_SHIFT, SPEAR1340_UART_CLK_MASK, 0, |
| 618 | &_lock); | 616 | &_lock); |
| 619 | clk_register_clkdev(clk, "uart1_mux_clk", NULL); | 617 | clk_register_clkdev(clk, "uart1_mclk", NULL); |
| 620 | 618 | ||
| 621 | clk = clk_register_gate(NULL, "uart1_clk", "uart1_mux_clk", 0, | 619 | clk = clk_register_gate(NULL, "uart1_clk", "uart1_mclk", 0, |
| 622 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_UART1_CLK_ENB, 0, | 620 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_UART1_CLK_ENB, 0, |
| 623 | &_lock); | 621 | &_lock); |
| 624 | clk_register_clkdev(clk, NULL, "b4100000.serial"); | 622 | clk_register_clkdev(clk, NULL, "b4100000.serial"); |
| 625 | 623 | ||
| 626 | clk = clk_register_aux("sdhci_synth_clk", "sdhci_synth_gate_clk", | 624 | clk = clk_register_aux("sdhci_syn_clk", "sdhci_syn_gclk", |
| 627 | "vco1div2_clk", 0, SPEAR1340_SDHCI_CLK_SYNT, NULL, | 625 | "vco1div2_clk", 0, SPEAR1340_SDHCI_CLK_SYNT, NULL, |
| 628 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 626 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 629 | clk_register_clkdev(clk, "sdhci_synth_clk", NULL); | 627 | clk_register_clkdev(clk, "sdhci_syn_clk", NULL); |
| 630 | clk_register_clkdev(clk1, "sdhci_synth_gate_clk", NULL); | 628 | clk_register_clkdev(clk1, "sdhci_syn_gclk", NULL); |
| 631 | 629 | ||
| 632 | clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_synth_gate_clk", 0, | 630 | clk = clk_register_gate(NULL, "sdhci_clk", "sdhci_syn_gclk", 0, |
| 633 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SDHCI_CLK_ENB, 0, | 631 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_SDHCI_CLK_ENB, 0, |
| 634 | &_lock); | 632 | &_lock); |
| 635 | clk_register_clkdev(clk, NULL, "b3000000.sdhci"); | 633 | clk_register_clkdev(clk, NULL, "b3000000.sdhci"); |
| 636 | 634 | ||
| 637 | clk = clk_register_aux("cfxd_synth_clk", "cfxd_synth_gate_clk", | 635 | clk = clk_register_aux("cfxd_syn_clk", "cfxd_syn_gclk", "vco1div2_clk", |
| 638 | "vco1div2_clk", 0, SPEAR1340_CFXD_CLK_SYNT, NULL, | 636 | 0, SPEAR1340_CFXD_CLK_SYNT, NULL, aux_rtbl, |
| 639 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 637 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 640 | clk_register_clkdev(clk, "cfxd_synth_clk", NULL); | 638 | clk_register_clkdev(clk, "cfxd_syn_clk", NULL); |
| 641 | clk_register_clkdev(clk1, "cfxd_synth_gate_clk", NULL); | 639 | clk_register_clkdev(clk1, "cfxd_syn_gclk", NULL); |
| 642 | 640 | ||
| 643 | clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_synth_gate_clk", 0, | 641 | clk = clk_register_gate(NULL, "cfxd_clk", "cfxd_syn_gclk", 0, |
| 644 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CFXD_CLK_ENB, 0, | 642 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CFXD_CLK_ENB, 0, |
| 645 | &_lock); | 643 | &_lock); |
| 646 | clk_register_clkdev(clk, NULL, "b2800000.cf"); | 644 | clk_register_clkdev(clk, NULL, "b2800000.cf"); |
| 647 | clk_register_clkdev(clk, NULL, "arasan_xd"); | 645 | clk_register_clkdev(clk, NULL, "arasan_xd"); |
| 648 | 646 | ||
| 649 | clk = clk_register_aux("c3_synth_clk", "c3_synth_gate_clk", | 647 | clk = clk_register_aux("c3_syn_clk", "c3_syn_gclk", "vco1div2_clk", 0, |
| 650 | "vco1div2_clk", 0, SPEAR1340_C3_CLK_SYNT, NULL, | 648 | SPEAR1340_C3_CLK_SYNT, NULL, aux_rtbl, |
| 651 | aux_rtbl, ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 649 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 652 | clk_register_clkdev(clk, "c3_synth_clk", NULL); | 650 | clk_register_clkdev(clk, "c3_syn_clk", NULL); |
| 653 | clk_register_clkdev(clk1, "c3_synth_gate_clk", NULL); | 651 | clk_register_clkdev(clk1, "c3_syn_gclk", NULL); |
| 654 | 652 | ||
| 655 | clk = clk_register_mux(NULL, "c3_mux_clk", c3_parents, | 653 | clk = clk_register_mux(NULL, "c3_mclk", c3_parents, |
| 656 | ARRAY_SIZE(c3_parents), 0, SPEAR1340_PERIP_CLK_CFG, | 654 | ARRAY_SIZE(c3_parents), 0, SPEAR1340_PERIP_CLK_CFG, |
| 657 | SPEAR1340_C3_CLK_SHIFT, SPEAR1340_C3_CLK_MASK, 0, | 655 | SPEAR1340_C3_CLK_SHIFT, SPEAR1340_C3_CLK_MASK, 0, |
| 658 | &_lock); | 656 | &_lock); |
| 659 | clk_register_clkdev(clk, "c3_mux_clk", NULL); | 657 | clk_register_clkdev(clk, "c3_mclk", NULL); |
| 660 | 658 | ||
| 661 | clk = clk_register_gate(NULL, "c3_clk", "c3_mux_clk", 0, | 659 | clk = clk_register_gate(NULL, "c3_clk", "c3_mclk", 0, |
| 662 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_C3_CLK_ENB, 0, | 660 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_C3_CLK_ENB, 0, |
| 663 | &_lock); | 661 | &_lock); |
| 664 | clk_register_clkdev(clk, NULL, "c3"); | 662 | clk_register_clkdev(clk, NULL, "c3"); |
| 665 | 663 | ||
| 666 | /* gmac */ | 664 | /* gmac */ |
| 667 | clk = clk_register_mux(NULL, "gmac_phy_input_mux_clk", | 665 | clk = clk_register_mux(NULL, "phy_input_mclk", gmac_phy_input_parents, |
| 668 | gmac_phy_input_parents, | ||
| 669 | ARRAY_SIZE(gmac_phy_input_parents), 0, | 666 | ARRAY_SIZE(gmac_phy_input_parents), 0, |
| 670 | SPEAR1340_GMAC_CLK_CFG, | 667 | SPEAR1340_GMAC_CLK_CFG, |
| 671 | SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT, | 668 | SPEAR1340_GMAC_PHY_INPUT_CLK_SHIFT, |
| 672 | SPEAR1340_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock); | 669 | SPEAR1340_GMAC_PHY_INPUT_CLK_MASK, 0, &_lock); |
| 673 | clk_register_clkdev(clk, "gmac_phy_input_mux_clk", NULL); | 670 | clk_register_clkdev(clk, "phy_input_mclk", NULL); |
| 674 | 671 | ||
| 675 | clk = clk_register_aux("gmac_phy_synth_clk", "gmac_phy_synth_gate_clk", | 672 | clk = clk_register_aux("phy_syn_clk", "phy_syn_gclk", "phy_input_mclk", |
| 676 | "gmac_phy_input_mux_clk", 0, SPEAR1340_GMAC_CLK_SYNT, | 673 | 0, SPEAR1340_GMAC_CLK_SYNT, NULL, gmac_rtbl, |
| 677 | NULL, gmac_rtbl, ARRAY_SIZE(gmac_rtbl), &_lock, &clk1); | 674 | ARRAY_SIZE(gmac_rtbl), &_lock, &clk1); |
| 678 | clk_register_clkdev(clk, "gmac_phy_synth_clk", NULL); | 675 | clk_register_clkdev(clk, "phy_syn_clk", NULL); |
| 679 | clk_register_clkdev(clk1, "gmac_phy_synth_gate_clk", NULL); | 676 | clk_register_clkdev(clk1, "phy_syn_gclk", NULL); |
| 680 | 677 | ||
| 681 | clk = clk_register_mux(NULL, "gmac_phy_mux_clk", gmac_phy_parents, | 678 | clk = clk_register_mux(NULL, "phy_mclk", gmac_phy_parents, |
| 682 | ARRAY_SIZE(gmac_phy_parents), 0, | 679 | ARRAY_SIZE(gmac_phy_parents), 0, |
| 683 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GMAC_PHY_CLK_SHIFT, | 680 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_GMAC_PHY_CLK_SHIFT, |
| 684 | SPEAR1340_GMAC_PHY_CLK_MASK, 0, &_lock); | 681 | SPEAR1340_GMAC_PHY_CLK_MASK, 0, &_lock); |
| 685 | clk_register_clkdev(clk, NULL, "stmmacphy.0"); | 682 | clk_register_clkdev(clk, NULL, "stmmacphy.0"); |
| 686 | 683 | ||
| 687 | /* clcd */ | 684 | /* clcd */ |
| 688 | clk = clk_register_mux(NULL, "clcd_synth_mux_clk", clcd_synth_parents, | 685 | clk = clk_register_mux(NULL, "clcd_syn_mclk", clcd_synth_parents, |
| 689 | ARRAY_SIZE(clcd_synth_parents), 0, | 686 | ARRAY_SIZE(clcd_synth_parents), 0, |
| 690 | SPEAR1340_CLCD_CLK_SYNT, SPEAR1340_CLCD_SYNT_CLK_SHIFT, | 687 | SPEAR1340_CLCD_CLK_SYNT, SPEAR1340_CLCD_SYNT_CLK_SHIFT, |
| 691 | SPEAR1340_CLCD_SYNT_CLK_MASK, 0, &_lock); | 688 | SPEAR1340_CLCD_SYNT_CLK_MASK, 0, &_lock); |
| 692 | clk_register_clkdev(clk, "clcd_synth_mux_clk", NULL); | 689 | clk_register_clkdev(clk, "clcd_syn_mclk", NULL); |
| 693 | 690 | ||
| 694 | clk = clk_register_frac("clcd_synth_clk", "clcd_synth_mux_clk", 0, | 691 | clk = clk_register_frac("clcd_syn_clk", "clcd_syn_mclk", 0, |
| 695 | SPEAR1340_CLCD_CLK_SYNT, clcd_rtbl, | 692 | SPEAR1340_CLCD_CLK_SYNT, clcd_rtbl, |
| 696 | ARRAY_SIZE(clcd_rtbl), &_lock); | 693 | ARRAY_SIZE(clcd_rtbl), &_lock); |
| 697 | clk_register_clkdev(clk, "clcd_synth_clk", NULL); | 694 | clk_register_clkdev(clk, "clcd_syn_clk", NULL); |
| 698 | 695 | ||
| 699 | clk = clk_register_mux(NULL, "clcd_pixel_mux_clk", clcd_pixel_parents, | 696 | clk = clk_register_mux(NULL, "clcd_pixel_mclk", clcd_pixel_parents, |
| 700 | ARRAY_SIZE(clcd_pixel_parents), 0, | 697 | ARRAY_SIZE(clcd_pixel_parents), 0, |
| 701 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_CLCD_CLK_SHIFT, | 698 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_CLCD_CLK_SHIFT, |
| 702 | SPEAR1340_CLCD_CLK_MASK, 0, &_lock); | 699 | SPEAR1340_CLCD_CLK_MASK, 0, &_lock); |
| 703 | clk_register_clkdev(clk, "clcd_pixel_clk", NULL); | 700 | clk_register_clkdev(clk, "clcd_pixel_clk", NULL); |
| 704 | 701 | ||
| 705 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mux_clk", 0, | 702 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_pixel_mclk", 0, |
| 706 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CLCD_CLK_ENB, 0, | 703 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_CLCD_CLK_ENB, 0, |
| 707 | &_lock); | 704 | &_lock); |
| 708 | clk_register_clkdev(clk, "clcd_clk", NULL); | 705 | clk_register_clkdev(clk, "clcd_clk", NULL); |
| 709 | 706 | ||
| 710 | /* i2s */ | 707 | /* i2s */ |
| 711 | clk = clk_register_mux(NULL, "i2s_src_mux_clk", i2s_src_parents, | 708 | clk = clk_register_mux(NULL, "i2s_src_mclk", i2s_src_parents, |
| 712 | ARRAY_SIZE(i2s_src_parents), 0, SPEAR1340_I2S_CLK_CFG, | 709 | ARRAY_SIZE(i2s_src_parents), 0, SPEAR1340_I2S_CLK_CFG, |
| 713 | SPEAR1340_I2S_SRC_CLK_SHIFT, SPEAR1340_I2S_SRC_CLK_MASK, | 710 | SPEAR1340_I2S_SRC_CLK_SHIFT, SPEAR1340_I2S_SRC_CLK_MASK, |
| 714 | 0, &_lock); | 711 | 0, &_lock); |
| 715 | clk_register_clkdev(clk, "i2s_src_clk", NULL); | 712 | clk_register_clkdev(clk, "i2s_src_clk", NULL); |
| 716 | 713 | ||
| 717 | clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mux_clk", 0, | 714 | clk = clk_register_aux("i2s_prs1_clk", NULL, "i2s_src_mclk", 0, |
| 718 | SPEAR1340_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl, | 715 | SPEAR1340_I2S_CLK_CFG, &i2s_prs1_masks, i2s_prs1_rtbl, |
| 719 | ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL); | 716 | ARRAY_SIZE(i2s_prs1_rtbl), &_lock, NULL); |
| 720 | clk_register_clkdev(clk, "i2s_prs1_clk", NULL); | 717 | clk_register_clkdev(clk, "i2s_prs1_clk", NULL); |
| 721 | 718 | ||
| 722 | clk = clk_register_mux(NULL, "i2s_ref_mux_clk", i2s_ref_parents, | 719 | clk = clk_register_mux(NULL, "i2s_ref_mclk", i2s_ref_parents, |
| 723 | ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1340_I2S_CLK_CFG, | 720 | ARRAY_SIZE(i2s_ref_parents), 0, SPEAR1340_I2S_CLK_CFG, |
| 724 | SPEAR1340_I2S_REF_SHIFT, SPEAR1340_I2S_REF_SEL_MASK, 0, | 721 | SPEAR1340_I2S_REF_SHIFT, SPEAR1340_I2S_REF_SEL_MASK, 0, |
| 725 | &_lock); | 722 | &_lock); |
| 726 | clk_register_clkdev(clk, "i2s_ref_clk", NULL); | 723 | clk_register_clkdev(clk, "i2s_ref_clk", NULL); |
| 727 | 724 | ||
| 728 | clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mux_clk", 0, | 725 | clk = clk_register_gate(NULL, "i2s_ref_pad_clk", "i2s_ref_mclk", 0, |
| 729 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_I2S_REF_PAD_CLK_ENB, | 726 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_I2S_REF_PAD_CLK_ENB, |
| 730 | 0, &_lock); | 727 | 0, &_lock); |
| 731 | clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL); | 728 | clk_register_clkdev(clk, "i2s_ref_pad_clk", NULL); |
| 732 | 729 | ||
| 733 | clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gate_clk", | 730 | clk = clk_register_aux("i2s_sclk_clk", "i2s_sclk_gclk", "i2s_ref_mclk", |
| 734 | "i2s_ref_mux_clk", 0, SPEAR1340_I2S_CLK_CFG, | 731 | 0, SPEAR1340_I2S_CLK_CFG, &i2s_sclk_masks, |
| 735 | &i2s_sclk_masks, i2s_sclk_rtbl, | 732 | i2s_sclk_rtbl, ARRAY_SIZE(i2s_sclk_rtbl), &_lock, |
| 736 | ARRAY_SIZE(i2s_sclk_rtbl), &_lock, &clk1); | 733 | &clk1); |
| 737 | clk_register_clkdev(clk, "i2s_sclk_clk", NULL); | 734 | clk_register_clkdev(clk, "i2s_sclk_clk", NULL); |
| 738 | clk_register_clkdev(clk1, "i2s_sclk_gate_clk", NULL); | 735 | clk_register_clkdev(clk1, "i2s_sclk_gclk", NULL); |
| 739 | 736 | ||
| 740 | /* clock derived from ahb clk */ | 737 | /* clock derived from ahb clk */ |
| 741 | clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0, | 738 | clk = clk_register_gate(NULL, "i2c0_clk", "ahb_clk", 0, |
| @@ -744,7 +741,7 @@ void __init spear1340_clk_init(void) | |||
| 744 | clk_register_clkdev(clk, NULL, "e0280000.i2c"); | 741 | clk_register_clkdev(clk, NULL, "e0280000.i2c"); |
| 745 | 742 | ||
| 746 | clk = clk_register_gate(NULL, "i2c1_clk", "ahb_clk", 0, | 743 | clk = clk_register_gate(NULL, "i2c1_clk", "ahb_clk", 0, |
| 747 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_I2C1_CLK_ENB, 0, | 744 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_I2C1_CLK_ENB, 0, |
| 748 | &_lock); | 745 | &_lock); |
| 749 | clk_register_clkdev(clk, NULL, "b4000000.i2c"); | 746 | clk_register_clkdev(clk, NULL, "b4000000.i2c"); |
| 750 | 747 | ||
| @@ -800,13 +797,13 @@ void __init spear1340_clk_init(void) | |||
| 800 | &_lock); | 797 | &_lock); |
| 801 | clk_register_clkdev(clk, "sysram1_clk", NULL); | 798 | clk_register_clkdev(clk, "sysram1_clk", NULL); |
| 802 | 799 | ||
| 803 | clk = clk_register_aux("adc_synth_clk", "adc_synth_gate_clk", "ahb_clk", | 800 | clk = clk_register_aux("adc_syn_clk", "adc_syn_gclk", "ahb_clk", |
| 804 | 0, SPEAR1340_ADC_CLK_SYNT, NULL, adc_rtbl, | 801 | 0, SPEAR1340_ADC_CLK_SYNT, NULL, adc_rtbl, |
| 805 | ARRAY_SIZE(adc_rtbl), &_lock, &clk1); | 802 | ARRAY_SIZE(adc_rtbl), &_lock, &clk1); |
| 806 | clk_register_clkdev(clk, "adc_synth_clk", NULL); | 803 | clk_register_clkdev(clk, "adc_syn_clk", NULL); |
| 807 | clk_register_clkdev(clk1, "adc_synth_gate_clk", NULL); | 804 | clk_register_clkdev(clk1, "adc_syn_gclk", NULL); |
| 808 | 805 | ||
| 809 | clk = clk_register_gate(NULL, "adc_clk", "adc_synth_gate_clk", 0, | 806 | clk = clk_register_gate(NULL, "adc_clk", "adc_syn_gclk", 0, |
| 810 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_ADC_CLK_ENB, 0, | 807 | SPEAR1340_PERIP1_CLK_ENB, SPEAR1340_ADC_CLK_ENB, 0, |
| 811 | &_lock); | 808 | &_lock); |
| 812 | clk_register_clkdev(clk, NULL, "adc_clk"); | 809 | clk_register_clkdev(clk, NULL, "adc_clk"); |
| @@ -843,39 +840,39 @@ void __init spear1340_clk_init(void) | |||
| 843 | clk_register_clkdev(clk, NULL, "e0300000.kbd"); | 840 | clk_register_clkdev(clk, NULL, "e0300000.kbd"); |
| 844 | 841 | ||
| 845 | /* RAS clks */ | 842 | /* RAS clks */ |
| 846 | clk = clk_register_mux(NULL, "gen_synth0_1_mux_clk", | 843 | clk = clk_register_mux(NULL, "gen_syn0_1_mclk", gen_synth0_1_parents, |
| 847 | gen_synth0_1_parents, ARRAY_SIZE(gen_synth0_1_parents), | 844 | ARRAY_SIZE(gen_synth0_1_parents), 0, SPEAR1340_PLL_CFG, |
| 848 | 0, SPEAR1340_PLL_CFG, SPEAR1340_GEN_SYNT0_1_CLK_SHIFT, | 845 | SPEAR1340_GEN_SYNT0_1_CLK_SHIFT, |
| 849 | SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock); | 846 | SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock); |
| 850 | clk_register_clkdev(clk, "gen_synth0_1_clk", NULL); | 847 | clk_register_clkdev(clk, "gen_syn0_1_clk", NULL); |
| 851 | 848 | ||
| 852 | clk = clk_register_mux(NULL, "gen_synth2_3_mux_clk", | 849 | clk = clk_register_mux(NULL, "gen_syn2_3_mclk", gen_synth2_3_parents, |
| 853 | gen_synth2_3_parents, ARRAY_SIZE(gen_synth2_3_parents), | 850 | ARRAY_SIZE(gen_synth2_3_parents), 0, SPEAR1340_PLL_CFG, |
| 854 | 0, SPEAR1340_PLL_CFG, SPEAR1340_GEN_SYNT2_3_CLK_SHIFT, | 851 | SPEAR1340_GEN_SYNT2_3_CLK_SHIFT, |
| 855 | SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock); | 852 | SPEAR1340_GEN_SYNT_CLK_MASK, 0, &_lock); |
| 856 | clk_register_clkdev(clk, "gen_synth2_3_clk", NULL); | 853 | clk_register_clkdev(clk, "gen_syn2_3_clk", NULL); |
| 857 | 854 | ||
| 858 | clk = clk_register_frac("gen_synth0_clk", "gen_synth0_1_clk", 0, | 855 | clk = clk_register_frac("gen_syn0_clk", "gen_syn0_1_clk", 0, |
| 859 | SPEAR1340_GEN_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 856 | SPEAR1340_GEN_CLK_SYNT0, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
| 860 | &_lock); | 857 | &_lock); |
| 861 | clk_register_clkdev(clk, "gen_synth0_clk", NULL); | 858 | clk_register_clkdev(clk, "gen_syn0_clk", NULL); |
| 862 | 859 | ||
| 863 | clk = clk_register_frac("gen_synth1_clk", "gen_synth0_1_clk", 0, | 860 | clk = clk_register_frac("gen_syn1_clk", "gen_syn0_1_clk", 0, |
| 864 | SPEAR1340_GEN_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 861 | SPEAR1340_GEN_CLK_SYNT1, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
| 865 | &_lock); | 862 | &_lock); |
| 866 | clk_register_clkdev(clk, "gen_synth1_clk", NULL); | 863 | clk_register_clkdev(clk, "gen_syn1_clk", NULL); |
| 867 | 864 | ||
| 868 | clk = clk_register_frac("gen_synth2_clk", "gen_synth2_3_clk", 0, | 865 | clk = clk_register_frac("gen_syn2_clk", "gen_syn2_3_clk", 0, |
| 869 | SPEAR1340_GEN_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 866 | SPEAR1340_GEN_CLK_SYNT2, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
| 870 | &_lock); | 867 | &_lock); |
| 871 | clk_register_clkdev(clk, "gen_synth2_clk", NULL); | 868 | clk_register_clkdev(clk, "gen_syn2_clk", NULL); |
| 872 | 869 | ||
| 873 | clk = clk_register_frac("gen_synth3_clk", "gen_synth2_3_clk", 0, | 870 | clk = clk_register_frac("gen_syn3_clk", "gen_syn2_3_clk", 0, |
| 874 | SPEAR1340_GEN_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl), | 871 | SPEAR1340_GEN_CLK_SYNT3, gen_rtbl, ARRAY_SIZE(gen_rtbl), |
| 875 | &_lock); | 872 | &_lock); |
| 876 | clk_register_clkdev(clk, "gen_synth3_clk", NULL); | 873 | clk_register_clkdev(clk, "gen_syn3_clk", NULL); |
| 877 | 874 | ||
| 878 | clk = clk_register_gate(NULL, "mali_clk", "gen_synth3_clk", 0, | 875 | clk = clk_register_gate(NULL, "mali_clk", "gen_syn3_clk", 0, |
| 879 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_MALI_CLK_ENB, 0, | 876 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_MALI_CLK_ENB, 0, |
| 880 | &_lock); | 877 | &_lock); |
| 881 | clk_register_clkdev(clk, NULL, "mali"); | 878 | clk_register_clkdev(clk, NULL, "mali"); |
| @@ -890,74 +887,74 @@ void __init spear1340_clk_init(void) | |||
| 890 | &_lock); | 887 | &_lock); |
| 891 | clk_register_clkdev(clk, NULL, "spear_cec.1"); | 888 | clk_register_clkdev(clk, NULL, "spear_cec.1"); |
| 892 | 889 | ||
| 893 | clk = clk_register_mux(NULL, "spdif_out_mux_clk", spdif_out_parents, | 890 | clk = clk_register_mux(NULL, "spdif_out_mclk", spdif_out_parents, |
| 894 | ARRAY_SIZE(spdif_out_parents), 0, | 891 | ARRAY_SIZE(spdif_out_parents), 0, |
| 895 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_OUT_CLK_SHIFT, | 892 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_OUT_CLK_SHIFT, |
| 896 | SPEAR1340_SPDIF_CLK_MASK, 0, &_lock); | 893 | SPEAR1340_SPDIF_CLK_MASK, 0, &_lock); |
| 897 | clk_register_clkdev(clk, "spdif_out_mux_clk", NULL); | 894 | clk_register_clkdev(clk, "spdif_out_mclk", NULL); |
| 898 | 895 | ||
| 899 | clk = clk_register_gate(NULL, "spdif_out_clk", "spdif_out_mux_clk", 0, | 896 | clk = clk_register_gate(NULL, "spdif_out_clk", "spdif_out_mclk", 0, |
| 900 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_SPDIF_OUT_CLK_ENB, | 897 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_SPDIF_OUT_CLK_ENB, |
| 901 | 0, &_lock); | 898 | 0, &_lock); |
| 902 | clk_register_clkdev(clk, NULL, "spdif-out"); | 899 | clk_register_clkdev(clk, NULL, "spdif-out"); |
| 903 | 900 | ||
| 904 | clk = clk_register_mux(NULL, "spdif_in_mux_clk", spdif_in_parents, | 901 | clk = clk_register_mux(NULL, "spdif_in_mclk", spdif_in_parents, |
| 905 | ARRAY_SIZE(spdif_in_parents), 0, | 902 | ARRAY_SIZE(spdif_in_parents), 0, |
| 906 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_IN_CLK_SHIFT, | 903 | SPEAR1340_PERIP_CLK_CFG, SPEAR1340_SPDIF_IN_CLK_SHIFT, |
| 907 | SPEAR1340_SPDIF_CLK_MASK, 0, &_lock); | 904 | SPEAR1340_SPDIF_CLK_MASK, 0, &_lock); |
| 908 | clk_register_clkdev(clk, "spdif_in_mux_clk", NULL); | 905 | clk_register_clkdev(clk, "spdif_in_mclk", NULL); |
| 909 | 906 | ||
| 910 | clk = clk_register_gate(NULL, "spdif_in_clk", "spdif_in_mux_clk", 0, | 907 | clk = clk_register_gate(NULL, "spdif_in_clk", "spdif_in_mclk", 0, |
| 911 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_SPDIF_IN_CLK_ENB, 0, | 908 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_SPDIF_IN_CLK_ENB, 0, |
| 912 | &_lock); | 909 | &_lock); |
| 913 | clk_register_clkdev(clk, NULL, "spdif-in"); | 910 | clk_register_clkdev(clk, NULL, "spdif-in"); |
| 914 | 911 | ||
| 915 | clk = clk_register_gate(NULL, "acp_clk", "acp_mux_clk", 0, | 912 | clk = clk_register_gate(NULL, "acp_clk", "acp_mclk", 0, |
| 916 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0, | 913 | SPEAR1340_PERIP2_CLK_ENB, SPEAR1340_ACP_CLK_ENB, 0, |
| 917 | &_lock); | 914 | &_lock); |
| 918 | clk_register_clkdev(clk, NULL, "acp_clk"); | 915 | clk_register_clkdev(clk, NULL, "acp_clk"); |
| 919 | 916 | ||
| 920 | clk = clk_register_gate(NULL, "plgpio_clk", "plgpio_mux_clk", 0, | 917 | clk = clk_register_gate(NULL, "plgpio_clk", "plgpio_mclk", 0, |
| 921 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0, | 918 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PLGPIO_CLK_ENB, 0, |
| 922 | &_lock); | 919 | &_lock); |
| 923 | clk_register_clkdev(clk, NULL, "plgpio"); | 920 | clk_register_clkdev(clk, NULL, "plgpio"); |
| 924 | 921 | ||
| 925 | clk = clk_register_gate(NULL, "video_dec_clk", "video_dec_mux_clk", 0, | 922 | clk = clk_register_gate(NULL, "video_dec_clk", "video_dec_mclk", 0, |
| 926 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB, | 923 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_DEC_CLK_ENB, |
| 927 | 0, &_lock); | 924 | 0, &_lock); |
| 928 | clk_register_clkdev(clk, NULL, "video_dec"); | 925 | clk_register_clkdev(clk, NULL, "video_dec"); |
| 929 | 926 | ||
| 930 | clk = clk_register_gate(NULL, "video_enc_clk", "video_enc_mux_clk", 0, | 927 | clk = clk_register_gate(NULL, "video_enc_clk", "video_enc_mclk", 0, |
| 931 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB, | 928 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_ENC_CLK_ENB, |
| 932 | 0, &_lock); | 929 | 0, &_lock); |
| 933 | clk_register_clkdev(clk, NULL, "video_enc"); | 930 | clk_register_clkdev(clk, NULL, "video_enc"); |
| 934 | 931 | ||
| 935 | clk = clk_register_gate(NULL, "video_in_clk", "video_in_mux_clk", 0, | 932 | clk = clk_register_gate(NULL, "video_in_clk", "video_in_mclk", 0, |
| 936 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0, | 933 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_VIDEO_IN_CLK_ENB, 0, |
| 937 | &_lock); | 934 | &_lock); |
| 938 | clk_register_clkdev(clk, NULL, "spear_vip"); | 935 | clk_register_clkdev(clk, NULL, "spear_vip"); |
| 939 | 936 | ||
| 940 | clk = clk_register_gate(NULL, "cam0_clk", "cam0_mux_clk", 0, | 937 | clk = clk_register_gate(NULL, "cam0_clk", "cam0_mclk", 0, |
| 941 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0, | 938 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM0_CLK_ENB, 0, |
| 942 | &_lock); | 939 | &_lock); |
| 943 | clk_register_clkdev(clk, NULL, "spear_camif.0"); | 940 | clk_register_clkdev(clk, NULL, "spear_camif.0"); |
| 944 | 941 | ||
| 945 | clk = clk_register_gate(NULL, "cam1_clk", "cam1_mux_clk", 0, | 942 | clk = clk_register_gate(NULL, "cam1_clk", "cam1_mclk", 0, |
| 946 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0, | 943 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM1_CLK_ENB, 0, |
| 947 | &_lock); | 944 | &_lock); |
| 948 | clk_register_clkdev(clk, NULL, "spear_camif.1"); | 945 | clk_register_clkdev(clk, NULL, "spear_camif.1"); |
| 949 | 946 | ||
| 950 | clk = clk_register_gate(NULL, "cam2_clk", "cam2_mux_clk", 0, | 947 | clk = clk_register_gate(NULL, "cam2_clk", "cam2_mclk", 0, |
| 951 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0, | 948 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM2_CLK_ENB, 0, |
| 952 | &_lock); | 949 | &_lock); |
| 953 | clk_register_clkdev(clk, NULL, "spear_camif.2"); | 950 | clk_register_clkdev(clk, NULL, "spear_camif.2"); |
| 954 | 951 | ||
| 955 | clk = clk_register_gate(NULL, "cam3_clk", "cam3_mux_clk", 0, | 952 | clk = clk_register_gate(NULL, "cam3_clk", "cam3_mclk", 0, |
| 956 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0, | 953 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_CAM3_CLK_ENB, 0, |
| 957 | &_lock); | 954 | &_lock); |
| 958 | clk_register_clkdev(clk, NULL, "spear_camif.3"); | 955 | clk_register_clkdev(clk, NULL, "spear_camif.3"); |
| 959 | 956 | ||
| 960 | clk = clk_register_gate(NULL, "pwm_clk", "pwm_mux_clk", 0, | 957 | clk = clk_register_gate(NULL, "pwm_clk", "pwm_mclk", 0, |
| 961 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PWM_CLK_ENB, 0, | 958 | SPEAR1340_PERIP3_CLK_ENB, SPEAR1340_PWM_CLK_ENB, 0, |
| 962 | &_lock); | 959 | &_lock); |
| 963 | clk_register_clkdev(clk, NULL, "pwm"); | 960 | clk_register_clkdev(clk, NULL, "pwm"); |
diff --git a/drivers/clk/spear/spear3xx_clock.c b/drivers/clk/spear/spear3xx_clock.c index 440bb3e4c971..c3157454bb3f 100644 --- a/drivers/clk/spear/spear3xx_clock.c +++ b/drivers/clk/spear/spear3xx_clock.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * SPEAr3xx machines clock framework source file | 2 | * SPEAr3xx machines clock framework source file |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
| @@ -122,12 +122,12 @@ static struct gpt_rate_tbl gpt_rtbl[] = { | |||
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | /* clock parents */ | 124 | /* clock parents */ |
| 125 | static const char *uart0_parents[] = { "pll3_48m_clk", "uart_synth_gate_clk", }; | 125 | static const char *uart0_parents[] = { "pll3_clk", "uart_syn_gclk", }; |
| 126 | static const char *firda_parents[] = { "pll3_48m_clk", "firda_synth_gate_clk", | 126 | static const char *firda_parents[] = { "pll3_clk", "firda_syn_gclk", |
| 127 | }; | 127 | }; |
| 128 | static const char *gpt0_parents[] = { "pll3_48m_clk", "gpt0_synth_clk", }; | 128 | static const char *gpt0_parents[] = { "pll3_clk", "gpt0_syn_clk", }; |
| 129 | static const char *gpt1_parents[] = { "pll3_48m_clk", "gpt1_synth_clk", }; | 129 | static const char *gpt1_parents[] = { "pll3_clk", "gpt1_syn_clk", }; |
| 130 | static const char *gpt2_parents[] = { "pll3_48m_clk", "gpt2_synth_clk", }; | 130 | static const char *gpt2_parents[] = { "pll3_clk", "gpt2_syn_clk", }; |
| 131 | static const char *gen2_3_parents[] = { "pll1_clk", "pll2_clk", }; | 131 | static const char *gen2_3_parents[] = { "pll1_clk", "pll2_clk", }; |
| 132 | static const char *ddr_parents[] = { "ahb_clk", "ahbmult2_clk", "none", | 132 | static const char *ddr_parents[] = { "ahb_clk", "ahbmult2_clk", "none", |
| 133 | "pll2_clk", }; | 133 | "pll2_clk", }; |
| @@ -137,7 +137,7 @@ static void __init spear300_clk_init(void) | |||
| 137 | { | 137 | { |
| 138 | struct clk *clk; | 138 | struct clk *clk; |
| 139 | 139 | ||
| 140 | clk = clk_register_fixed_factor(NULL, "clcd_clk", "ras_pll3_48m_clk", 0, | 140 | clk = clk_register_fixed_factor(NULL, "clcd_clk", "ras_pll3_clk", 0, |
| 141 | 1, 1); | 141 | 1, 1); |
| 142 | clk_register_clkdev(clk, NULL, "60000000.clcd"); | 142 | clk_register_clkdev(clk, NULL, "60000000.clcd"); |
| 143 | 143 | ||
| @@ -219,15 +219,11 @@ static void __init spear310_clk_init(void) | |||
| 219 | #define SPEAR320_UARTX_PCLK_VAL_SYNTH1 0x0 | 219 | #define SPEAR320_UARTX_PCLK_VAL_SYNTH1 0x0 |
| 220 | #define SPEAR320_UARTX_PCLK_VAL_APB 0x1 | 220 | #define SPEAR320_UARTX_PCLK_VAL_APB 0x1 |
| 221 | 221 | ||
| 222 | static const char *i2s_ref_parents[] = { "ras_pll2_clk", | 222 | static const char *i2s_ref_parents[] = { "ras_pll2_clk", "ras_syn2_gclk", }; |
| 223 | "ras_gen2_synth_gate_clk", }; | 223 | static const char *sdhci_parents[] = { "ras_pll3_clk", "ras_syn3_gclk", }; |
| 224 | static const char *sdhci_parents[] = { "ras_pll3_48m_clk", | ||
| 225 | "ras_gen3_synth_gate_clk", | ||
| 226 | }; | ||
| 227 | static const char *smii0_parents[] = { "smii_125m_pad", "ras_pll2_clk", | 224 | static const char *smii0_parents[] = { "smii_125m_pad", "ras_pll2_clk", |
| 228 | "ras_gen0_synth_gate_clk", }; | 225 | "ras_syn0_gclk", }; |
| 229 | static const char *uartx_parents[] = { "ras_gen1_synth_gate_clk", "ras_apb_clk", | 226 | static const char *uartx_parents[] = { "ras_syn1_gclk", "ras_apb_clk", }; |
| 230 | }; | ||
| 231 | 227 | ||
| 232 | static void __init spear320_clk_init(void) | 228 | static void __init spear320_clk_init(void) |
| 233 | { | 229 | { |
| @@ -237,7 +233,7 @@ static void __init spear320_clk_init(void) | |||
| 237 | CLK_IS_ROOT, 125000000); | 233 | CLK_IS_ROOT, 125000000); |
| 238 | clk_register_clkdev(clk, "smii_125m_pad", NULL); | 234 | clk_register_clkdev(clk, "smii_125m_pad", NULL); |
| 239 | 235 | ||
| 240 | clk = clk_register_fixed_factor(NULL, "clcd_clk", "ras_pll3_48m_clk", 0, | 236 | clk = clk_register_fixed_factor(NULL, "clcd_clk", "ras_pll3_clk", 0, |
| 241 | 1, 1); | 237 | 1, 1); |
| 242 | clk_register_clkdev(clk, NULL, "90000000.clcd"); | 238 | clk_register_clkdev(clk, NULL, "90000000.clcd"); |
| 243 | 239 | ||
| @@ -363,9 +359,9 @@ void __init spear3xx_clk_init(void) | |||
| 363 | clk_register_clkdev(clk, NULL, "fc900000.rtc"); | 359 | clk_register_clkdev(clk, NULL, "fc900000.rtc"); |
| 364 | 360 | ||
| 365 | /* clock derived from 24 MHz osc clk */ | 361 | /* clock derived from 24 MHz osc clk */ |
| 366 | clk = clk_register_fixed_rate(NULL, "pll3_48m_clk", "osc_24m_clk", 0, | 362 | clk = clk_register_fixed_rate(NULL, "pll3_clk", "osc_24m_clk", 0, |
| 367 | 48000000); | 363 | 48000000); |
| 368 | clk_register_clkdev(clk, "pll3_48m_clk", NULL); | 364 | clk_register_clkdev(clk, "pll3_clk", NULL); |
| 369 | 365 | ||
| 370 | clk = clk_register_fixed_factor(NULL, "wdt_clk", "osc_24m_clk", 0, 1, | 366 | clk = clk_register_fixed_factor(NULL, "wdt_clk", "osc_24m_clk", 0, 1, |
| 371 | 1); | 367 | 1); |
| @@ -392,98 +388,98 @@ void __init spear3xx_clk_init(void) | |||
| 392 | HCLK_RATIO_MASK, 0, &_lock); | 388 | HCLK_RATIO_MASK, 0, &_lock); |
| 393 | clk_register_clkdev(clk, "ahb_clk", NULL); | 389 | clk_register_clkdev(clk, "ahb_clk", NULL); |
| 394 | 390 | ||
| 395 | clk = clk_register_aux("uart_synth_clk", "uart_synth_gate_clk", | 391 | clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "pll1_clk", 0, |
| 396 | "pll1_clk", 0, UART_CLK_SYNT, NULL, aux_rtbl, | 392 | UART_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
| 397 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 393 | &_lock, &clk1); |
| 398 | clk_register_clkdev(clk, "uart_synth_clk", NULL); | 394 | clk_register_clkdev(clk, "uart_syn_clk", NULL); |
| 399 | clk_register_clkdev(clk1, "uart_synth_gate_clk", NULL); | 395 | clk_register_clkdev(clk1, "uart_syn_gclk", NULL); |
| 400 | 396 | ||
| 401 | clk = clk_register_mux(NULL, "uart0_mux_clk", uart0_parents, | 397 | clk = clk_register_mux(NULL, "uart0_mclk", uart0_parents, |
| 402 | ARRAY_SIZE(uart0_parents), 0, PERIP_CLK_CFG, | 398 | ARRAY_SIZE(uart0_parents), 0, PERIP_CLK_CFG, |
| 403 | UART_CLK_SHIFT, UART_CLK_MASK, 0, &_lock); | 399 | UART_CLK_SHIFT, UART_CLK_MASK, 0, &_lock); |
| 404 | clk_register_clkdev(clk, "uart0_mux_clk", NULL); | 400 | clk_register_clkdev(clk, "uart0_mclk", NULL); |
| 405 | 401 | ||
| 406 | clk = clk_register_gate(NULL, "uart0", "uart0_mux_clk", 0, | 402 | clk = clk_register_gate(NULL, "uart0", "uart0_mclk", 0, PERIP1_CLK_ENB, |
| 407 | PERIP1_CLK_ENB, UART_CLK_ENB, 0, &_lock); | 403 | UART_CLK_ENB, 0, &_lock); |
| 408 | clk_register_clkdev(clk, NULL, "d0000000.serial"); | 404 | clk_register_clkdev(clk, NULL, "d0000000.serial"); |
| 409 | 405 | ||
| 410 | clk = clk_register_aux("firda_synth_clk", "firda_synth_gate_clk", | 406 | clk = clk_register_aux("firda_syn_clk", "firda_syn_gclk", "pll1_clk", 0, |
| 411 | "pll1_clk", 0, FIRDA_CLK_SYNT, NULL, aux_rtbl, | 407 | FIRDA_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
| 412 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 408 | &_lock, &clk1); |
| 413 | clk_register_clkdev(clk, "firda_synth_clk", NULL); | 409 | clk_register_clkdev(clk, "firda_syn_clk", NULL); |
| 414 | clk_register_clkdev(clk1, "firda_synth_gate_clk", NULL); | 410 | clk_register_clkdev(clk1, "firda_syn_gclk", NULL); |
| 415 | 411 | ||
| 416 | clk = clk_register_mux(NULL, "firda_mux_clk", firda_parents, | 412 | clk = clk_register_mux(NULL, "firda_mclk", firda_parents, |
| 417 | ARRAY_SIZE(firda_parents), 0, PERIP_CLK_CFG, | 413 | ARRAY_SIZE(firda_parents), 0, PERIP_CLK_CFG, |
| 418 | FIRDA_CLK_SHIFT, FIRDA_CLK_MASK, 0, &_lock); | 414 | FIRDA_CLK_SHIFT, FIRDA_CLK_MASK, 0, &_lock); |
| 419 | clk_register_clkdev(clk, "firda_mux_clk", NULL); | 415 | clk_register_clkdev(clk, "firda_mclk", NULL); |
| 420 | 416 | ||
| 421 | clk = clk_register_gate(NULL, "firda_clk", "firda_mux_clk", 0, | 417 | clk = clk_register_gate(NULL, "firda_clk", "firda_mclk", 0, |
| 422 | PERIP1_CLK_ENB, FIRDA_CLK_ENB, 0, &_lock); | 418 | PERIP1_CLK_ENB, FIRDA_CLK_ENB, 0, &_lock); |
| 423 | clk_register_clkdev(clk, NULL, "firda"); | 419 | clk_register_clkdev(clk, NULL, "firda"); |
| 424 | 420 | ||
| 425 | /* gpt clocks */ | 421 | /* gpt clocks */ |
| 426 | clk_register_gpt("gpt0_synth_clk", "pll1_clk", 0, PRSC0_CLK_CFG, | 422 | clk_register_gpt("gpt0_syn_clk", "pll1_clk", 0, PRSC0_CLK_CFG, gpt_rtbl, |
| 427 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 423 | ARRAY_SIZE(gpt_rtbl), &_lock); |
| 428 | clk = clk_register_mux(NULL, "gpt0_clk", gpt0_parents, | 424 | clk = clk_register_mux(NULL, "gpt0_clk", gpt0_parents, |
| 429 | ARRAY_SIZE(gpt0_parents), 0, PERIP_CLK_CFG, | 425 | ARRAY_SIZE(gpt0_parents), 0, PERIP_CLK_CFG, |
| 430 | GPT0_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 426 | GPT0_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
| 431 | clk_register_clkdev(clk, NULL, "gpt0"); | 427 | clk_register_clkdev(clk, NULL, "gpt0"); |
| 432 | 428 | ||
| 433 | clk_register_gpt("gpt1_synth_clk", "pll1_clk", 0, PRSC1_CLK_CFG, | 429 | clk_register_gpt("gpt1_syn_clk", "pll1_clk", 0, PRSC1_CLK_CFG, gpt_rtbl, |
| 434 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 430 | ARRAY_SIZE(gpt_rtbl), &_lock); |
| 435 | clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt1_parents, | 431 | clk = clk_register_mux(NULL, "gpt1_mclk", gpt1_parents, |
| 436 | ARRAY_SIZE(gpt1_parents), 0, PERIP_CLK_CFG, | 432 | ARRAY_SIZE(gpt1_parents), 0, PERIP_CLK_CFG, |
| 437 | GPT1_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 433 | GPT1_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
| 438 | clk_register_clkdev(clk, "gpt1_mux_clk", NULL); | 434 | clk_register_clkdev(clk, "gpt1_mclk", NULL); |
| 439 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0, | 435 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0, |
| 440 | PERIP1_CLK_ENB, GPT1_CLK_ENB, 0, &_lock); | 436 | PERIP1_CLK_ENB, GPT1_CLK_ENB, 0, &_lock); |
| 441 | clk_register_clkdev(clk, NULL, "gpt1"); | 437 | clk_register_clkdev(clk, NULL, "gpt1"); |
| 442 | 438 | ||
| 443 | clk_register_gpt("gpt2_synth_clk", "pll1_clk", 0, PRSC2_CLK_CFG, | 439 | clk_register_gpt("gpt2_syn_clk", "pll1_clk", 0, PRSC2_CLK_CFG, gpt_rtbl, |
| 444 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 440 | ARRAY_SIZE(gpt_rtbl), &_lock); |
| 445 | clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt2_parents, | 441 | clk = clk_register_mux(NULL, "gpt2_mclk", gpt2_parents, |
| 446 | ARRAY_SIZE(gpt2_parents), 0, PERIP_CLK_CFG, | 442 | ARRAY_SIZE(gpt2_parents), 0, PERIP_CLK_CFG, |
| 447 | GPT2_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 443 | GPT2_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
| 448 | clk_register_clkdev(clk, "gpt2_mux_clk", NULL); | 444 | clk_register_clkdev(clk, "gpt2_mclk", NULL); |
| 449 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0, | 445 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0, |
| 450 | PERIP1_CLK_ENB, GPT2_CLK_ENB, 0, &_lock); | 446 | PERIP1_CLK_ENB, GPT2_CLK_ENB, 0, &_lock); |
| 451 | clk_register_clkdev(clk, NULL, "gpt2"); | 447 | clk_register_clkdev(clk, NULL, "gpt2"); |
| 452 | 448 | ||
| 453 | /* general synths clocks */ | 449 | /* general synths clocks */ |
| 454 | clk = clk_register_aux("gen0_synth_clk", "gen0_synth_gate_clk", | 450 | clk = clk_register_aux("gen0_syn_clk", "gen0_syn_gclk", "pll1_clk", |
| 455 | "pll1_clk", 0, GEN0_CLK_SYNT, NULL, aux_rtbl, | 451 | 0, GEN0_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
| 456 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 452 | &_lock, &clk1); |
| 457 | clk_register_clkdev(clk, "gen0_synth_clk", NULL); | 453 | clk_register_clkdev(clk, "gen0_syn_clk", NULL); |
| 458 | clk_register_clkdev(clk1, "gen0_synth_gate_clk", NULL); | 454 | clk_register_clkdev(clk1, "gen0_syn_gclk", NULL); |
| 459 | 455 | ||
| 460 | clk = clk_register_aux("gen1_synth_clk", "gen1_synth_gate_clk", | 456 | clk = clk_register_aux("gen1_syn_clk", "gen1_syn_gclk", "pll1_clk", |
| 461 | "pll1_clk", 0, GEN1_CLK_SYNT, NULL, aux_rtbl, | 457 | 0, GEN1_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
| 462 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 458 | &_lock, &clk1); |
| 463 | clk_register_clkdev(clk, "gen1_synth_clk", NULL); | 459 | clk_register_clkdev(clk, "gen1_syn_clk", NULL); |
| 464 | clk_register_clkdev(clk1, "gen1_synth_gate_clk", NULL); | 460 | clk_register_clkdev(clk1, "gen1_syn_gclk", NULL); |
| 465 | 461 | ||
| 466 | clk = clk_register_mux(NULL, "gen2_3_parent_clk", gen2_3_parents, | 462 | clk = clk_register_mux(NULL, "gen2_3_par_clk", gen2_3_parents, |
| 467 | ARRAY_SIZE(gen2_3_parents), 0, CORE_CLK_CFG, | 463 | ARRAY_SIZE(gen2_3_parents), 0, CORE_CLK_CFG, |
| 468 | GEN_SYNTH2_3_CLK_SHIFT, GEN_SYNTH2_3_CLK_MASK, 0, | 464 | GEN_SYNTH2_3_CLK_SHIFT, GEN_SYNTH2_3_CLK_MASK, 0, |
| 469 | &_lock); | 465 | &_lock); |
| 470 | clk_register_clkdev(clk, "gen2_3_parent_clk", NULL); | 466 | clk_register_clkdev(clk, "gen2_3_par_clk", NULL); |
| 471 | 467 | ||
| 472 | clk = clk_register_aux("gen2_synth_clk", "gen2_synth_gate_clk", | 468 | clk = clk_register_aux("gen2_syn_clk", "gen2_syn_gclk", |
| 473 | "gen2_3_parent_clk", 0, GEN2_CLK_SYNT, NULL, aux_rtbl, | 469 | "gen2_3_par_clk", 0, GEN2_CLK_SYNT, NULL, aux_rtbl, |
| 474 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 470 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 475 | clk_register_clkdev(clk, "gen2_synth_clk", NULL); | 471 | clk_register_clkdev(clk, "gen2_syn_clk", NULL); |
| 476 | clk_register_clkdev(clk1, "gen2_synth_gate_clk", NULL); | 472 | clk_register_clkdev(clk1, "gen2_syn_gclk", NULL); |
| 477 | 473 | ||
| 478 | clk = clk_register_aux("gen3_synth_clk", "gen3_synth_gate_clk", | 474 | clk = clk_register_aux("gen3_syn_clk", "gen3_syn_gclk", |
| 479 | "gen2_3_parent_clk", 0, GEN3_CLK_SYNT, NULL, aux_rtbl, | 475 | "gen2_3_par_clk", 0, GEN3_CLK_SYNT, NULL, aux_rtbl, |
| 480 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 476 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); |
| 481 | clk_register_clkdev(clk, "gen3_synth_clk", NULL); | 477 | clk_register_clkdev(clk, "gen3_syn_clk", NULL); |
| 482 | clk_register_clkdev(clk1, "gen3_synth_gate_clk", NULL); | 478 | clk_register_clkdev(clk1, "gen3_syn_gclk", NULL); |
| 483 | 479 | ||
| 484 | /* clock derived from pll3 clk */ | 480 | /* clock derived from pll3 clk */ |
| 485 | clk = clk_register_gate(NULL, "usbh_clk", "pll3_48m_clk", 0, | 481 | clk = clk_register_gate(NULL, "usbh_clk", "pll3_clk", 0, PERIP1_CLK_ENB, |
| 486 | PERIP1_CLK_ENB, USBH_CLK_ENB, 0, &_lock); | 482 | USBH_CLK_ENB, 0, &_lock); |
| 487 | clk_register_clkdev(clk, "usbh_clk", NULL); | 483 | clk_register_clkdev(clk, "usbh_clk", NULL); |
| 488 | 484 | ||
| 489 | clk = clk_register_fixed_factor(NULL, "usbh.0_clk", "usbh_clk", 0, 1, | 485 | clk = clk_register_fixed_factor(NULL, "usbh.0_clk", "usbh_clk", 0, 1, |
| @@ -494,8 +490,8 @@ void __init spear3xx_clk_init(void) | |||
| 494 | 1); | 490 | 1); |
| 495 | clk_register_clkdev(clk, "usbh.1_clk", NULL); | 491 | clk_register_clkdev(clk, "usbh.1_clk", NULL); |
| 496 | 492 | ||
| 497 | clk = clk_register_gate(NULL, "usbd_clk", "pll3_48m_clk", 0, | 493 | clk = clk_register_gate(NULL, "usbd_clk", "pll3_clk", 0, PERIP1_CLK_ENB, |
| 498 | PERIP1_CLK_ENB, USBD_CLK_ENB, 0, &_lock); | 494 | USBD_CLK_ENB, 0, &_lock); |
| 499 | clk_register_clkdev(clk, NULL, "designware_udc"); | 495 | clk_register_clkdev(clk, NULL, "designware_udc"); |
| 500 | 496 | ||
| 501 | /* clock derived from ahb clk */ | 497 | /* clock derived from ahb clk */ |
| @@ -579,29 +575,25 @@ void __init spear3xx_clk_init(void) | |||
| 579 | RAS_CLK_ENB, RAS_PLL2_CLK_ENB, 0, &_lock); | 575 | RAS_CLK_ENB, RAS_PLL2_CLK_ENB, 0, &_lock); |
| 580 | clk_register_clkdev(clk, "ras_pll2_clk", NULL); | 576 | clk_register_clkdev(clk, "ras_pll2_clk", NULL); |
| 581 | 577 | ||
| 582 | clk = clk_register_gate(NULL, "ras_pll3_48m_clk", "pll3_48m_clk", 0, | 578 | clk = clk_register_gate(NULL, "ras_pll3_clk", "pll3_clk", 0, |
| 583 | RAS_CLK_ENB, RAS_48M_CLK_ENB, 0, &_lock); | 579 | RAS_CLK_ENB, RAS_48M_CLK_ENB, 0, &_lock); |
| 584 | clk_register_clkdev(clk, "ras_pll3_48m_clk", NULL); | 580 | clk_register_clkdev(clk, "ras_pll3_clk", NULL); |
| 585 | 581 | ||
| 586 | clk = clk_register_gate(NULL, "ras_gen0_synth_gate_clk", | 582 | clk = clk_register_gate(NULL, "ras_syn0_gclk", "gen0_syn_gclk", 0, |
| 587 | "gen0_synth_gate_clk", 0, RAS_CLK_ENB, | 583 | RAS_CLK_ENB, RAS_SYNT0_CLK_ENB, 0, &_lock); |
| 588 | RAS_SYNT0_CLK_ENB, 0, &_lock); | 584 | clk_register_clkdev(clk, "ras_syn0_gclk", NULL); |
| 589 | clk_register_clkdev(clk, "ras_gen0_synth_gate_clk", NULL); | 585 | |
| 590 | 586 | clk = clk_register_gate(NULL, "ras_syn1_gclk", "gen1_syn_gclk", 0, | |
| 591 | clk = clk_register_gate(NULL, "ras_gen1_synth_gate_clk", | 587 | RAS_CLK_ENB, RAS_SYNT1_CLK_ENB, 0, &_lock); |
| 592 | "gen1_synth_gate_clk", 0, RAS_CLK_ENB, | 588 | clk_register_clkdev(clk, "ras_syn1_gclk", NULL); |
| 593 | RAS_SYNT1_CLK_ENB, 0, &_lock); | 589 | |
| 594 | clk_register_clkdev(clk, "ras_gen1_synth_gate_clk", NULL); | 590 | clk = clk_register_gate(NULL, "ras_syn2_gclk", "gen2_syn_gclk", 0, |
| 595 | 591 | RAS_CLK_ENB, RAS_SYNT2_CLK_ENB, 0, &_lock); | |
| 596 | clk = clk_register_gate(NULL, "ras_gen2_synth_gate_clk", | 592 | clk_register_clkdev(clk, "ras_syn2_gclk", NULL); |
| 597 | "gen2_synth_gate_clk", 0, RAS_CLK_ENB, | 593 | |
| 598 | RAS_SYNT2_CLK_ENB, 0, &_lock); | 594 | clk = clk_register_gate(NULL, "ras_syn3_gclk", "gen3_syn_gclk", 0, |
| 599 | clk_register_clkdev(clk, "ras_gen2_synth_gate_clk", NULL); | 595 | RAS_CLK_ENB, RAS_SYNT3_CLK_ENB, 0, &_lock); |
| 600 | 596 | clk_register_clkdev(clk, "ras_syn3_gclk", NULL); | |
| 601 | clk = clk_register_gate(NULL, "ras_gen3_synth_gate_clk", | ||
| 602 | "gen3_synth_gate_clk", 0, RAS_CLK_ENB, | ||
| 603 | RAS_SYNT3_CLK_ENB, 0, &_lock); | ||
| 604 | clk_register_clkdev(clk, "ras_gen3_synth_gate_clk", NULL); | ||
| 605 | 597 | ||
| 606 | if (of_machine_is_compatible("st,spear300")) | 598 | if (of_machine_is_compatible("st,spear300")) |
| 607 | spear300_clk_init(); | 599 | spear300_clk_init(); |
diff --git a/drivers/clk/spear/spear6xx_clock.c b/drivers/clk/spear/spear6xx_clock.c index f9a20b382304..a98d0866f541 100644 --- a/drivers/clk/spear/spear6xx_clock.c +++ b/drivers/clk/spear/spear6xx_clock.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * SPEAr6xx machines clock framework source file | 2 | * SPEAr6xx machines clock framework source file |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
| @@ -97,13 +97,12 @@ static struct aux_rate_tbl aux_rtbl[] = { | |||
| 97 | {.xscale = 1, .yscale = 2, .eq = 1}, /* 166 MHz */ | 97 | {.xscale = 1, .yscale = 2, .eq = 1}, /* 166 MHz */ |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | static const char *clcd_parents[] = { "pll3_48m_clk", "clcd_synth_gate_clk", }; | 100 | static const char *clcd_parents[] = { "pll3_clk", "clcd_syn_gclk", }; |
| 101 | static const char *firda_parents[] = { "pll3_48m_clk", "firda_synth_gate_clk", | 101 | static const char *firda_parents[] = { "pll3_clk", "firda_syn_gclk", }; |
| 102 | }; | 102 | static const char *uart_parents[] = { "pll3_clk", "uart_syn_gclk", }; |
| 103 | static const char *uart_parents[] = { "pll3_48m_clk", "uart_synth_gate_clk", }; | 103 | static const char *gpt0_1_parents[] = { "pll3_clk", "gpt0_1_syn_clk", }; |
| 104 | static const char *gpt0_1_parents[] = { "pll3_48m_clk", "gpt0_1_synth_clk", }; | 104 | static const char *gpt2_parents[] = { "pll3_clk", "gpt2_syn_clk", }; |
| 105 | static const char *gpt2_parents[] = { "pll3_48m_clk", "gpt2_synth_clk", }; | 105 | static const char *gpt3_parents[] = { "pll3_clk", "gpt3_syn_clk", }; |
| 106 | static const char *gpt3_parents[] = { "pll3_48m_clk", "gpt3_synth_clk", }; | ||
| 107 | static const char *ddr_parents[] = { "ahb_clk", "ahbmult2_clk", "none", | 106 | static const char *ddr_parents[] = { "ahb_clk", "ahbmult2_clk", "none", |
| 108 | "pll2_clk", }; | 107 | "pll2_clk", }; |
| 109 | 108 | ||
| @@ -136,9 +135,9 @@ void __init spear6xx_clk_init(void) | |||
| 136 | clk_register_clkdev(clk, NULL, "rtc-spear"); | 135 | clk_register_clkdev(clk, NULL, "rtc-spear"); |
| 137 | 136 | ||
| 138 | /* clock derived from 30 MHz osc clk */ | 137 | /* clock derived from 30 MHz osc clk */ |
| 139 | clk = clk_register_fixed_rate(NULL, "pll3_48m_clk", "osc_24m_clk", 0, | 138 | clk = clk_register_fixed_rate(NULL, "pll3_clk", "osc_24m_clk", 0, |
| 140 | 48000000); | 139 | 48000000); |
| 141 | clk_register_clkdev(clk, "pll3_48m_clk", NULL); | 140 | clk_register_clkdev(clk, "pll3_clk", NULL); |
| 142 | 141 | ||
| 143 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "osc_30m_clk", | 142 | clk = clk_register_vco_pll("vco1_clk", "pll1_clk", NULL, "osc_30m_clk", |
| 144 | 0, PLL1_CTR, PLL1_FRQ, pll_rtbl, ARRAY_SIZE(pll_rtbl), | 143 | 0, PLL1_CTR, PLL1_FRQ, pll_rtbl, ARRAY_SIZE(pll_rtbl), |
| @@ -146,9 +145,9 @@ void __init spear6xx_clk_init(void) | |||
| 146 | clk_register_clkdev(clk, "vco1_clk", NULL); | 145 | clk_register_clkdev(clk, "vco1_clk", NULL); |
| 147 | clk_register_clkdev(clk1, "pll1_clk", NULL); | 146 | clk_register_clkdev(clk1, "pll1_clk", NULL); |
| 148 | 147 | ||
| 149 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, | 148 | clk = clk_register_vco_pll("vco2_clk", "pll2_clk", NULL, "osc_30m_clk", |
| 150 | "osc_30m_clk", 0, PLL2_CTR, PLL2_FRQ, pll_rtbl, | 149 | 0, PLL2_CTR, PLL2_FRQ, pll_rtbl, ARRAY_SIZE(pll_rtbl), |
| 151 | ARRAY_SIZE(pll_rtbl), &_lock, &clk1, NULL); | 150 | &_lock, &clk1, NULL); |
| 152 | clk_register_clkdev(clk, "vco2_clk", NULL); | 151 | clk_register_clkdev(clk, "vco2_clk", NULL); |
| 153 | clk_register_clkdev(clk1, "pll2_clk", NULL); | 152 | clk_register_clkdev(clk1, "pll2_clk", NULL); |
| 154 | 153 | ||
| @@ -165,111 +164,111 @@ void __init spear6xx_clk_init(void) | |||
| 165 | HCLK_RATIO_MASK, 0, &_lock); | 164 | HCLK_RATIO_MASK, 0, &_lock); |
| 166 | clk_register_clkdev(clk, "ahb_clk", NULL); | 165 | clk_register_clkdev(clk, "ahb_clk", NULL); |
| 167 | 166 | ||
| 168 | clk = clk_register_aux("uart_synth_clk", "uart_synth_gate_clk", | 167 | clk = clk_register_aux("uart_syn_clk", "uart_syn_gclk", "pll1_clk", 0, |
| 169 | "pll1_clk", 0, UART_CLK_SYNT, NULL, aux_rtbl, | 168 | UART_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
| 170 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 169 | &_lock, &clk1); |
| 171 | clk_register_clkdev(clk, "uart_synth_clk", NULL); | 170 | clk_register_clkdev(clk, "uart_syn_clk", NULL); |
| 172 | clk_register_clkdev(clk1, "uart_synth_gate_clk", NULL); | 171 | clk_register_clkdev(clk1, "uart_syn_gclk", NULL); |
| 173 | 172 | ||
| 174 | clk = clk_register_mux(NULL, "uart_mux_clk", uart_parents, | 173 | clk = clk_register_mux(NULL, "uart_mclk", uart_parents, |
| 175 | ARRAY_SIZE(uart_parents), 0, PERIP_CLK_CFG, | 174 | ARRAY_SIZE(uart_parents), 0, PERIP_CLK_CFG, |
| 176 | UART_CLK_SHIFT, UART_CLK_MASK, 0, &_lock); | 175 | UART_CLK_SHIFT, UART_CLK_MASK, 0, &_lock); |
| 177 | clk_register_clkdev(clk, "uart_mux_clk", NULL); | 176 | clk_register_clkdev(clk, "uart_mclk", NULL); |
| 178 | 177 | ||
| 179 | clk = clk_register_gate(NULL, "uart0", "uart_mux_clk", 0, | 178 | clk = clk_register_gate(NULL, "uart0", "uart_mclk", 0, PERIP1_CLK_ENB, |
| 180 | PERIP1_CLK_ENB, UART0_CLK_ENB, 0, &_lock); | 179 | UART0_CLK_ENB, 0, &_lock); |
| 181 | clk_register_clkdev(clk, NULL, "d0000000.serial"); | 180 | clk_register_clkdev(clk, NULL, "d0000000.serial"); |
| 182 | 181 | ||
| 183 | clk = clk_register_gate(NULL, "uart1", "uart_mux_clk", 0, | 182 | clk = clk_register_gate(NULL, "uart1", "uart_mclk", 0, PERIP1_CLK_ENB, |
| 184 | PERIP1_CLK_ENB, UART1_CLK_ENB, 0, &_lock); | 183 | UART1_CLK_ENB, 0, &_lock); |
| 185 | clk_register_clkdev(clk, NULL, "d0080000.serial"); | 184 | clk_register_clkdev(clk, NULL, "d0080000.serial"); |
| 186 | 185 | ||
| 187 | clk = clk_register_aux("firda_synth_clk", "firda_synth_gate_clk", | 186 | clk = clk_register_aux("firda_syn_clk", "firda_syn_gclk", "pll1_clk", |
| 188 | "pll1_clk", 0, FIRDA_CLK_SYNT, NULL, aux_rtbl, | 187 | 0, FIRDA_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
| 189 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 188 | &_lock, &clk1); |
| 190 | clk_register_clkdev(clk, "firda_synth_clk", NULL); | 189 | clk_register_clkdev(clk, "firda_syn_clk", NULL); |
| 191 | clk_register_clkdev(clk1, "firda_synth_gate_clk", NULL); | 190 | clk_register_clkdev(clk1, "firda_syn_gclk", NULL); |
| 192 | 191 | ||
| 193 | clk = clk_register_mux(NULL, "firda_mux_clk", firda_parents, | 192 | clk = clk_register_mux(NULL, "firda_mclk", firda_parents, |
| 194 | ARRAY_SIZE(firda_parents), 0, PERIP_CLK_CFG, | 193 | ARRAY_SIZE(firda_parents), 0, PERIP_CLK_CFG, |
| 195 | FIRDA_CLK_SHIFT, FIRDA_CLK_MASK, 0, &_lock); | 194 | FIRDA_CLK_SHIFT, FIRDA_CLK_MASK, 0, &_lock); |
| 196 | clk_register_clkdev(clk, "firda_mux_clk", NULL); | 195 | clk_register_clkdev(clk, "firda_mclk", NULL); |
| 197 | 196 | ||
| 198 | clk = clk_register_gate(NULL, "firda_clk", "firda_mux_clk", 0, | 197 | clk = clk_register_gate(NULL, "firda_clk", "firda_mclk", 0, |
| 199 | PERIP1_CLK_ENB, FIRDA_CLK_ENB, 0, &_lock); | 198 | PERIP1_CLK_ENB, FIRDA_CLK_ENB, 0, &_lock); |
| 200 | clk_register_clkdev(clk, NULL, "firda"); | 199 | clk_register_clkdev(clk, NULL, "firda"); |
| 201 | 200 | ||
| 202 | clk = clk_register_aux("clcd_synth_clk", "clcd_synth_gate_clk", | 201 | clk = clk_register_aux("clcd_syn_clk", "clcd_syn_gclk", "pll1_clk", |
| 203 | "pll1_clk", 0, CLCD_CLK_SYNT, NULL, aux_rtbl, | 202 | 0, CLCD_CLK_SYNT, NULL, aux_rtbl, ARRAY_SIZE(aux_rtbl), |
| 204 | ARRAY_SIZE(aux_rtbl), &_lock, &clk1); | 203 | &_lock, &clk1); |
| 205 | clk_register_clkdev(clk, "clcd_synth_clk", NULL); | 204 | clk_register_clkdev(clk, "clcd_syn_clk", NULL); |
| 206 | clk_register_clkdev(clk1, "clcd_synth_gate_clk", NULL); | 205 | clk_register_clkdev(clk1, "clcd_syn_gclk", NULL); |
| 207 | 206 | ||
| 208 | clk = clk_register_mux(NULL, "clcd_mux_clk", clcd_parents, | 207 | clk = clk_register_mux(NULL, "clcd_mclk", clcd_parents, |
| 209 | ARRAY_SIZE(clcd_parents), 0, PERIP_CLK_CFG, | 208 | ARRAY_SIZE(clcd_parents), 0, PERIP_CLK_CFG, |
| 210 | CLCD_CLK_SHIFT, CLCD_CLK_MASK, 0, &_lock); | 209 | CLCD_CLK_SHIFT, CLCD_CLK_MASK, 0, &_lock); |
| 211 | clk_register_clkdev(clk, "clcd_mux_clk", NULL); | 210 | clk_register_clkdev(clk, "clcd_mclk", NULL); |
| 212 | 211 | ||
| 213 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_mux_clk", 0, | 212 | clk = clk_register_gate(NULL, "clcd_clk", "clcd_mclk", 0, |
| 214 | PERIP1_CLK_ENB, CLCD_CLK_ENB, 0, &_lock); | 213 | PERIP1_CLK_ENB, CLCD_CLK_ENB, 0, &_lock); |
| 215 | clk_register_clkdev(clk, NULL, "clcd"); | 214 | clk_register_clkdev(clk, NULL, "clcd"); |
| 216 | 215 | ||
| 217 | /* gpt clocks */ | 216 | /* gpt clocks */ |
| 218 | clk = clk_register_gpt("gpt0_1_synth_clk", "pll1_clk", 0, PRSC0_CLK_CFG, | 217 | clk = clk_register_gpt("gpt0_1_syn_clk", "pll1_clk", 0, PRSC0_CLK_CFG, |
| 219 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 218 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); |
| 220 | clk_register_clkdev(clk, "gpt0_1_synth_clk", NULL); | 219 | clk_register_clkdev(clk, "gpt0_1_syn_clk", NULL); |
| 221 | 220 | ||
| 222 | clk = clk_register_mux(NULL, "gpt0_mux_clk", gpt0_1_parents, | 221 | clk = clk_register_mux(NULL, "gpt0_mclk", gpt0_1_parents, |
| 223 | ARRAY_SIZE(gpt0_1_parents), 0, PERIP_CLK_CFG, | 222 | ARRAY_SIZE(gpt0_1_parents), 0, PERIP_CLK_CFG, |
| 224 | GPT0_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 223 | GPT0_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
| 225 | clk_register_clkdev(clk, NULL, "gpt0"); | 224 | clk_register_clkdev(clk, NULL, "gpt0"); |
| 226 | 225 | ||
| 227 | clk = clk_register_mux(NULL, "gpt1_mux_clk", gpt0_1_parents, | 226 | clk = clk_register_mux(NULL, "gpt1_mclk", gpt0_1_parents, |
| 228 | ARRAY_SIZE(gpt0_1_parents), 0, PERIP_CLK_CFG, | 227 | ARRAY_SIZE(gpt0_1_parents), 0, PERIP_CLK_CFG, |
| 229 | GPT1_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 228 | GPT1_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
| 230 | clk_register_clkdev(clk, "gpt1_mux_clk", NULL); | 229 | clk_register_clkdev(clk, "gpt1_mclk", NULL); |
| 231 | 230 | ||
| 232 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mux_clk", 0, | 231 | clk = clk_register_gate(NULL, "gpt1_clk", "gpt1_mclk", 0, |
| 233 | PERIP1_CLK_ENB, GPT1_CLK_ENB, 0, &_lock); | 232 | PERIP1_CLK_ENB, GPT1_CLK_ENB, 0, &_lock); |
| 234 | clk_register_clkdev(clk, NULL, "gpt1"); | 233 | clk_register_clkdev(clk, NULL, "gpt1"); |
| 235 | 234 | ||
| 236 | clk = clk_register_gpt("gpt2_synth_clk", "pll1_clk", 0, PRSC1_CLK_CFG, | 235 | clk = clk_register_gpt("gpt2_syn_clk", "pll1_clk", 0, PRSC1_CLK_CFG, |
| 237 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 236 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); |
| 238 | clk_register_clkdev(clk, "gpt2_synth_clk", NULL); | 237 | clk_register_clkdev(clk, "gpt2_syn_clk", NULL); |
| 239 | 238 | ||
| 240 | clk = clk_register_mux(NULL, "gpt2_mux_clk", gpt2_parents, | 239 | clk = clk_register_mux(NULL, "gpt2_mclk", gpt2_parents, |
| 241 | ARRAY_SIZE(gpt2_parents), 0, PERIP_CLK_CFG, | 240 | ARRAY_SIZE(gpt2_parents), 0, PERIP_CLK_CFG, |
| 242 | GPT2_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 241 | GPT2_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
| 243 | clk_register_clkdev(clk, "gpt2_mux_clk", NULL); | 242 | clk_register_clkdev(clk, "gpt2_mclk", NULL); |
| 244 | 243 | ||
| 245 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mux_clk", 0, | 244 | clk = clk_register_gate(NULL, "gpt2_clk", "gpt2_mclk", 0, |
| 246 | PERIP1_CLK_ENB, GPT2_CLK_ENB, 0, &_lock); | 245 | PERIP1_CLK_ENB, GPT2_CLK_ENB, 0, &_lock); |
| 247 | clk_register_clkdev(clk, NULL, "gpt2"); | 246 | clk_register_clkdev(clk, NULL, "gpt2"); |
| 248 | 247 | ||
| 249 | clk = clk_register_gpt("gpt3_synth_clk", "pll1_clk", 0, PRSC2_CLK_CFG, | 248 | clk = clk_register_gpt("gpt3_syn_clk", "pll1_clk", 0, PRSC2_CLK_CFG, |
| 250 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); | 249 | gpt_rtbl, ARRAY_SIZE(gpt_rtbl), &_lock); |
| 251 | clk_register_clkdev(clk, "gpt3_synth_clk", NULL); | 250 | clk_register_clkdev(clk, "gpt3_syn_clk", NULL); |
| 252 | 251 | ||
| 253 | clk = clk_register_mux(NULL, "gpt3_mux_clk", gpt3_parents, | 252 | clk = clk_register_mux(NULL, "gpt3_mclk", gpt3_parents, |
| 254 | ARRAY_SIZE(gpt3_parents), 0, PERIP_CLK_CFG, | 253 | ARRAY_SIZE(gpt3_parents), 0, PERIP_CLK_CFG, |
| 255 | GPT3_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); | 254 | GPT3_CLK_SHIFT, GPT_CLK_MASK, 0, &_lock); |
| 256 | clk_register_clkdev(clk, "gpt3_mux_clk", NULL); | 255 | clk_register_clkdev(clk, "gpt3_mclk", NULL); |
| 257 | 256 | ||
| 258 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mux_clk", 0, | 257 | clk = clk_register_gate(NULL, "gpt3_clk", "gpt3_mclk", 0, |
| 259 | PERIP1_CLK_ENB, GPT3_CLK_ENB, 0, &_lock); | 258 | PERIP1_CLK_ENB, GPT3_CLK_ENB, 0, &_lock); |
| 260 | clk_register_clkdev(clk, NULL, "gpt3"); | 259 | clk_register_clkdev(clk, NULL, "gpt3"); |
| 261 | 260 | ||
| 262 | /* clock derived from pll3 clk */ | 261 | /* clock derived from pll3 clk */ |
| 263 | clk = clk_register_gate(NULL, "usbh0_clk", "pll3_48m_clk", 0, | 262 | clk = clk_register_gate(NULL, "usbh0_clk", "pll3_clk", 0, |
| 264 | PERIP1_CLK_ENB, USBH0_CLK_ENB, 0, &_lock); | 263 | PERIP1_CLK_ENB, USBH0_CLK_ENB, 0, &_lock); |
| 265 | clk_register_clkdev(clk, NULL, "usbh.0_clk"); | 264 | clk_register_clkdev(clk, NULL, "usbh.0_clk"); |
| 266 | 265 | ||
| 267 | clk = clk_register_gate(NULL, "usbh1_clk", "pll3_48m_clk", 0, | 266 | clk = clk_register_gate(NULL, "usbh1_clk", "pll3_clk", 0, |
| 268 | PERIP1_CLK_ENB, USBH1_CLK_ENB, 0, &_lock); | 267 | PERIP1_CLK_ENB, USBH1_CLK_ENB, 0, &_lock); |
| 269 | clk_register_clkdev(clk, NULL, "usbh.1_clk"); | 268 | clk_register_clkdev(clk, NULL, "usbh.1_clk"); |
| 270 | 269 | ||
| 271 | clk = clk_register_gate(NULL, "usbd_clk", "pll3_48m_clk", 0, | 270 | clk = clk_register_gate(NULL, "usbd_clk", "pll3_clk", 0, PERIP1_CLK_ENB, |
| 272 | PERIP1_CLK_ENB, USBD_CLK_ENB, 0, &_lock); | 271 | USBD_CLK_ENB, 0, &_lock); |
| 273 | clk_register_clkdev(clk, NULL, "designware_udc"); | 272 | clk_register_clkdev(clk, NULL, "designware_udc"); |
| 274 | 273 | ||
| 275 | /* clock derived from ahb clk */ | 274 | /* clock derived from ahb clk */ |
| @@ -278,9 +277,8 @@ void __init spear6xx_clk_init(void) | |||
| 278 | clk_register_clkdev(clk, "ahbmult2_clk", NULL); | 277 | clk_register_clkdev(clk, "ahbmult2_clk", NULL); |
| 279 | 278 | ||
| 280 | clk = clk_register_mux(NULL, "ddr_clk", ddr_parents, | 279 | clk = clk_register_mux(NULL, "ddr_clk", ddr_parents, |
| 281 | ARRAY_SIZE(ddr_parents), | 280 | ARRAY_SIZE(ddr_parents), 0, PLL_CLK_CFG, MCTR_CLK_SHIFT, |
| 282 | 0, PLL_CLK_CFG, MCTR_CLK_SHIFT, MCTR_CLK_MASK, 0, | 281 | MCTR_CLK_MASK, 0, &_lock); |
| 283 | &_lock); | ||
| 284 | clk_register_clkdev(clk, "ddr_clk", NULL); | 282 | clk_register_clkdev(clk, "ddr_clk", NULL); |
| 285 | 283 | ||
| 286 | clk = clk_register_divider(NULL, "apb_clk", "ahb_clk", | 284 | clk = clk_register_divider(NULL, "apb_clk", "ahb_clk", |
| @@ -298,7 +296,7 @@ void __init spear6xx_clk_init(void) | |||
| 298 | 296 | ||
| 299 | clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0, PERIP1_CLK_ENB, | 297 | clk = clk_register_gate(NULL, "gmac_clk", "ahb_clk", 0, PERIP1_CLK_ENB, |
| 300 | GMAC_CLK_ENB, 0, &_lock); | 298 | GMAC_CLK_ENB, 0, &_lock); |
| 301 | clk_register_clkdev(clk, NULL, "gmac"); | 299 | clk_register_clkdev(clk, NULL, "e0800000.ethernet"); |
| 302 | 300 | ||
| 303 | clk = clk_register_gate(NULL, "i2c_clk", "ahb_clk", 0, PERIP1_CLK_ENB, | 301 | clk = clk_register_gate(NULL, "i2c_clk", "ahb_clk", 0, PERIP1_CLK_ENB, |
| 304 | I2C_CLK_ENB, 0, &_lock); | 302 | I2C_CLK_ENB, 0, &_lock); |
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index 8d81a1d32653..dd3e661a124d 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile | |||
| @@ -6,6 +6,7 @@ obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC) += cs5535-clockevt.o | |||
| 6 | obj-$(CONFIG_SH_TIMER_CMT) += sh_cmt.o | 6 | obj-$(CONFIG_SH_TIMER_CMT) += sh_cmt.o |
| 7 | obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o | 7 | obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o |
| 8 | obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o | 8 | obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o |
| 9 | obj-$(CONFIG_EM_TIMER_STI) += em_sti.o | ||
| 9 | obj-$(CONFIG_CLKBLD_I8253) += i8253.o | 10 | obj-$(CONFIG_CLKBLD_I8253) += i8253.o |
| 10 | obj-$(CONFIG_CLKSRC_MMIO) += mmio.o | 11 | obj-$(CONFIG_CLKSRC_MMIO) += mmio.o |
| 11 | obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o | 12 | obj-$(CONFIG_DW_APB_TIMER) += dw_apb_timer.o |
diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c new file mode 100644 index 000000000000..372051d1bba8 --- /dev/null +++ b/drivers/clocksource/em_sti.c | |||
| @@ -0,0 +1,406 @@ | |||
| 1 | /* | ||
| 2 | * Emma Mobile Timer Support - STI | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Magnus Damm | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/init.h> | ||
| 21 | #include <linux/platform_device.h> | ||
| 22 | #include <linux/spinlock.h> | ||
| 23 | #include <linux/interrupt.h> | ||
| 24 | #include <linux/ioport.h> | ||
| 25 | #include <linux/io.h> | ||
| 26 | #include <linux/clk.h> | ||
| 27 | #include <linux/irq.h> | ||
| 28 | #include <linux/err.h> | ||
| 29 | #include <linux/delay.h> | ||
| 30 | #include <linux/clocksource.h> | ||
| 31 | #include <linux/clockchips.h> | ||
| 32 | #include <linux/slab.h> | ||
| 33 | #include <linux/module.h> | ||
| 34 | |||
| 35 | enum { USER_CLOCKSOURCE, USER_CLOCKEVENT, USER_NR }; | ||
| 36 | |||
| 37 | struct em_sti_priv { | ||
| 38 | void __iomem *base; | ||
| 39 | struct clk *clk; | ||
| 40 | struct platform_device *pdev; | ||
| 41 | unsigned int active[USER_NR]; | ||
| 42 | unsigned long rate; | ||
| 43 | raw_spinlock_t lock; | ||
| 44 | struct clock_event_device ced; | ||
| 45 | struct clocksource cs; | ||
| 46 | }; | ||
| 47 | |||
| 48 | #define STI_CONTROL 0x00 | ||
| 49 | #define STI_COMPA_H 0x10 | ||
| 50 | #define STI_COMPA_L 0x14 | ||
| 51 | #define STI_COMPB_H 0x18 | ||
| 52 | #define STI_COMPB_L 0x1c | ||
| 53 | #define STI_COUNT_H 0x20 | ||
| 54 | #define STI_COUNT_L 0x24 | ||
| 55 | #define STI_COUNT_RAW_H 0x28 | ||
| 56 | #define STI_COUNT_RAW_L 0x2c | ||
| 57 | #define STI_SET_H 0x30 | ||
| 58 | #define STI_SET_L 0x34 | ||
| 59 | #define STI_INTSTATUS 0x40 | ||
| 60 | #define STI_INTRAWSTATUS 0x44 | ||
| 61 | #define STI_INTENSET 0x48 | ||
| 62 | #define STI_INTENCLR 0x4c | ||
| 63 | #define STI_INTFFCLR 0x50 | ||
| 64 | |||
| 65 | static inline unsigned long em_sti_read(struct em_sti_priv *p, int offs) | ||
| 66 | { | ||
| 67 | return ioread32(p->base + offs); | ||
| 68 | } | ||
| 69 | |||
| 70 | static inline void em_sti_write(struct em_sti_priv *p, int offs, | ||
| 71 | unsigned long value) | ||
| 72 | { | ||
| 73 | iowrite32(value, p->base + offs); | ||
| 74 | } | ||
| 75 | |||
| 76 | static int em_sti_enable(struct em_sti_priv *p) | ||
| 77 | { | ||
| 78 | int ret; | ||
| 79 | |||
| 80 | /* enable clock */ | ||
| 81 | ret = clk_enable(p->clk); | ||
| 82 | if (ret) { | ||
| 83 | dev_err(&p->pdev->dev, "cannot enable clock\n"); | ||
| 84 | return ret; | ||
| 85 | } | ||
| 86 | |||
| 87 | /* configure channel, periodic mode and maximum timeout */ | ||
| 88 | p->rate = clk_get_rate(p->clk); | ||
| 89 | |||
| 90 | /* reset the counter */ | ||
| 91 | em_sti_write(p, STI_SET_H, 0x40000000); | ||
| 92 | em_sti_write(p, STI_SET_L, 0x00000000); | ||
| 93 | |||
| 94 | /* mask and clear pending interrupts */ | ||
| 95 | em_sti_write(p, STI_INTENCLR, 3); | ||
| 96 | em_sti_write(p, STI_INTFFCLR, 3); | ||
| 97 | |||
| 98 | /* enable updates of counter registers */ | ||
| 99 | em_sti_write(p, STI_CONTROL, 1); | ||
| 100 | |||
| 101 | return 0; | ||
| 102 | } | ||
| 103 | |||
| 104 | static void em_sti_disable(struct em_sti_priv *p) | ||
| 105 | { | ||
| 106 | /* mask interrupts */ | ||
| 107 | em_sti_write(p, STI_INTENCLR, 3); | ||
| 108 | |||
| 109 | /* stop clock */ | ||
| 110 | clk_disable(p->clk); | ||
| 111 | } | ||
| 112 | |||
| 113 | static cycle_t em_sti_count(struct em_sti_priv *p) | ||
| 114 | { | ||
| 115 | cycle_t ticks; | ||
| 116 | unsigned long flags; | ||
| 117 | |||
| 118 | /* the STI hardware buffers the 48-bit count, but to | ||
| 119 | * break it out into two 32-bit access the registers | ||
| 120 | * must be accessed in a certain order. | ||
| 121 | * Always read STI_COUNT_H before STI_COUNT_L. | ||
| 122 | */ | ||
| 123 | raw_spin_lock_irqsave(&p->lock, flags); | ||
| 124 | ticks = (cycle_t)(em_sti_read(p, STI_COUNT_H) & 0xffff) << 32; | ||
| 125 | ticks |= em_sti_read(p, STI_COUNT_L); | ||
| 126 | raw_spin_unlock_irqrestore(&p->lock, flags); | ||
| 127 | |||
| 128 | return ticks; | ||
| 129 | } | ||
| 130 | |||
| 131 | static cycle_t em_sti_set_next(struct em_sti_priv *p, cycle_t next) | ||
| 132 | { | ||
| 133 | unsigned long flags; | ||
| 134 | |||
| 135 | raw_spin_lock_irqsave(&p->lock, flags); | ||
| 136 | |||
| 137 | /* mask compare A interrupt */ | ||
| 138 | em_sti_write(p, STI_INTENCLR, 1); | ||
| 139 | |||
| 140 | /* update compare A value */ | ||
| 141 | em_sti_write(p, STI_COMPA_H, next >> 32); | ||
| 142 | em_sti_write(p, STI_COMPA_L, next & 0xffffffff); | ||
| 143 | |||
| 144 | /* clear compare A interrupt source */ | ||
| 145 | em_sti_write(p, STI_INTFFCLR, 1); | ||
| 146 | |||
| 147 | /* unmask compare A interrupt */ | ||
| 148 | em_sti_write(p, STI_INTENSET, 1); | ||
| 149 | |||
| 150 | raw_spin_unlock_irqrestore(&p->lock, flags); | ||
| 151 | |||
| 152 | return next; | ||
| 153 | } | ||
| 154 | |||
| 155 | static irqreturn_t em_sti_interrupt(int irq, void *dev_id) | ||
| 156 | { | ||
| 157 | struct em_sti_priv *p = dev_id; | ||
| 158 | |||
| 159 | p->ced.event_handler(&p->ced); | ||
| 160 | return IRQ_HANDLED; | ||
| 161 | } | ||
| 162 | |||
| 163 | static int em_sti_start(struct em_sti_priv *p, unsigned int user) | ||
| 164 | { | ||
| 165 | unsigned long flags; | ||
| 166 | int used_before; | ||
| 167 | int ret = 0; | ||
| 168 | |||
| 169 | raw_spin_lock_irqsave(&p->lock, flags); | ||
| 170 | used_before = p->active[USER_CLOCKSOURCE] | p->active[USER_CLOCKEVENT]; | ||
| 171 | if (!used_before) | ||
| 172 | ret = em_sti_enable(p); | ||
| 173 | |||
| 174 | if (!ret) | ||
| 175 | p->active[user] = 1; | ||
| 176 | raw_spin_unlock_irqrestore(&p->lock, flags); | ||
| 177 | |||
| 178 | return ret; | ||
| 179 | } | ||
| 180 | |||
| 181 | static void em_sti_stop(struct em_sti_priv *p, unsigned int user) | ||
| 182 | { | ||
| 183 | unsigned long flags; | ||
| 184 | int used_before, used_after; | ||
| 185 | |||
| 186 | raw_spin_lock_irqsave(&p->lock, flags); | ||
| 187 | used_before = p->active[USER_CLOCKSOURCE] | p->active[USER_CLOCKEVENT]; | ||
| 188 | p->active[user] = 0; | ||
| 189 | used_after = p->active[USER_CLOCKSOURCE] | p->active[USER_CLOCKEVENT]; | ||
| 190 | |||
| 191 | if (used_before && !used_after) | ||
| 192 | em_sti_disable(p); | ||
| 193 | raw_spin_unlock_irqrestore(&p->lock, flags); | ||
| 194 | } | ||
| 195 | |||
| 196 | static struct em_sti_priv *cs_to_em_sti(struct clocksource *cs) | ||
| 197 | { | ||
| 198 | return container_of(cs, struct em_sti_priv, cs); | ||
| 199 | } | ||
| 200 | |||
| 201 | static cycle_t em_sti_clocksource_read(struct clocksource *cs) | ||
| 202 | { | ||
| 203 | return em_sti_count(cs_to_em_sti(cs)); | ||
| 204 | } | ||
| 205 | |||
| 206 | static int em_sti_clocksource_enable(struct clocksource *cs) | ||
| 207 | { | ||
| 208 | int ret; | ||
| 209 | struct em_sti_priv *p = cs_to_em_sti(cs); | ||
| 210 | |||
| 211 | ret = em_sti_start(p, USER_CLOCKSOURCE); | ||
| 212 | if (!ret) | ||
| 213 | __clocksource_updatefreq_hz(cs, p->rate); | ||
| 214 | return ret; | ||
| 215 | } | ||
| 216 | |||
| 217 | static void em_sti_clocksource_disable(struct clocksource *cs) | ||
| 218 | { | ||
| 219 | em_sti_stop(cs_to_em_sti(cs), USER_CLOCKSOURCE); | ||
| 220 | } | ||
| 221 | |||
| 222 | static void em_sti_clocksource_resume(struct clocksource *cs) | ||
| 223 | { | ||
| 224 | em_sti_clocksource_enable(cs); | ||
| 225 | } | ||
| 226 | |||
| 227 | static int em_sti_register_clocksource(struct em_sti_priv *p) | ||
| 228 | { | ||
| 229 | struct clocksource *cs = &p->cs; | ||
| 230 | |||
| 231 | memset(cs, 0, sizeof(*cs)); | ||
| 232 | cs->name = dev_name(&p->pdev->dev); | ||
| 233 | cs->rating = 200; | ||
| 234 | cs->read = em_sti_clocksource_read; | ||
| 235 | cs->enable = em_sti_clocksource_enable; | ||
| 236 | cs->disable = em_sti_clocksource_disable; | ||
| 237 | cs->suspend = em_sti_clocksource_disable; | ||
| 238 | cs->resume = em_sti_clocksource_resume; | ||
| 239 | cs->mask = CLOCKSOURCE_MASK(48); | ||
| 240 | cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; | ||
| 241 | |||
| 242 | dev_info(&p->pdev->dev, "used as clock source\n"); | ||
| 243 | |||
| 244 | /* Register with dummy 1 Hz value, gets updated in ->enable() */ | ||
| 245 | clocksource_register_hz(cs, 1); | ||
| 246 | return 0; | ||
| 247 | } | ||
| 248 | |||
| 249 | static struct em_sti_priv *ced_to_em_sti(struct clock_event_device *ced) | ||
| 250 | { | ||
| 251 | return container_of(ced, struct em_sti_priv, ced); | ||
| 252 | } | ||
| 253 | |||
| 254 | static void em_sti_clock_event_mode(enum clock_event_mode mode, | ||
| 255 | struct clock_event_device *ced) | ||
| 256 | { | ||
| 257 | struct em_sti_priv *p = ced_to_em_sti(ced); | ||
| 258 | |||
| 259 | /* deal with old setting first */ | ||
| 260 | switch (ced->mode) { | ||
| 261 | case CLOCK_EVT_MODE_ONESHOT: | ||
| 262 | em_sti_stop(p, USER_CLOCKEVENT); | ||
| 263 | break; | ||
| 264 | default: | ||
| 265 | break; | ||
| 266 | } | ||
| 267 | |||
| 268 | switch (mode) { | ||
| 269 | case CLOCK_EVT_MODE_ONESHOT: | ||
| 270 | dev_info(&p->pdev->dev, "used for oneshot clock events\n"); | ||
| 271 | em_sti_start(p, USER_CLOCKEVENT); | ||
| 272 | clockevents_config(&p->ced, p->rate); | ||
| 273 | break; | ||
| 274 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
| 275 | case CLOCK_EVT_MODE_UNUSED: | ||
| 276 | em_sti_stop(p, USER_CLOCKEVENT); | ||
| 277 | break; | ||
| 278 | default: | ||
| 279 | break; | ||
| 280 | } | ||
| 281 | } | ||
| 282 | |||
| 283 | static int em_sti_clock_event_next(unsigned long delta, | ||
| 284 | struct clock_event_device *ced) | ||
| 285 | { | ||
| 286 | struct em_sti_priv *p = ced_to_em_sti(ced); | ||
| 287 | cycle_t next; | ||
| 288 | int safe; | ||
| 289 | |||
| 290 | next = em_sti_set_next(p, em_sti_count(p) + delta); | ||
| 291 | safe = em_sti_count(p) < (next - 1); | ||
| 292 | |||
| 293 | return !safe; | ||
| 294 | } | ||
| 295 | |||
| 296 | static void em_sti_register_clockevent(struct em_sti_priv *p) | ||
| 297 | { | ||
| 298 | struct clock_event_device *ced = &p->ced; | ||
| 299 | |||
| 300 | memset(ced, 0, sizeof(*ced)); | ||
| 301 | ced->name = dev_name(&p->pdev->dev); | ||
| 302 | ced->features = CLOCK_EVT_FEAT_ONESHOT; | ||
| 303 | ced->rating = 200; | ||
| 304 | ced->cpumask = cpumask_of(0); | ||
| 305 | ced->set_next_event = em_sti_clock_event_next; | ||
| 306 | ced->set_mode = em_sti_clock_event_mode; | ||
| 307 | |||
| 308 | dev_info(&p->pdev->dev, "used for clock events\n"); | ||
| 309 | |||
| 310 | /* Register with dummy 1 Hz value, gets updated in ->set_mode() */ | ||
| 311 | clockevents_config_and_register(ced, 1, 2, 0xffffffff); | ||
| 312 | } | ||
| 313 | |||
| 314 | static int __devinit em_sti_probe(struct platform_device *pdev) | ||
| 315 | { | ||
| 316 | struct em_sti_priv *p; | ||
| 317 | struct resource *res; | ||
| 318 | int irq, ret; | ||
| 319 | |||
| 320 | p = kzalloc(sizeof(*p), GFP_KERNEL); | ||
| 321 | if (p == NULL) { | ||
| 322 | dev_err(&pdev->dev, "failed to allocate driver data\n"); | ||
| 323 | ret = -ENOMEM; | ||
| 324 | goto err0; | ||
| 325 | } | ||
| 326 | |||
| 327 | p->pdev = pdev; | ||
| 328 | platform_set_drvdata(pdev, p); | ||
| 329 | |||
| 330 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 331 | if (!res) { | ||
| 332 | dev_err(&pdev->dev, "failed to get I/O memory\n"); | ||
| 333 | ret = -EINVAL; | ||
| 334 | goto err0; | ||
| 335 | } | ||
| 336 | |||
| 337 | irq = platform_get_irq(pdev, 0); | ||
| 338 | if (irq < 0) { | ||
| 339 | dev_err(&pdev->dev, "failed to get irq\n"); | ||
| 340 | ret = -EINVAL; | ||
| 341 | goto err0; | ||
| 342 | } | ||
| 343 | |||
| 344 | /* map memory, let base point to the STI instance */ | ||
| 345 | p->base = ioremap_nocache(res->start, resource_size(res)); | ||
| 346 | if (p->base == NULL) { | ||
| 347 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | ||
| 348 | ret = -ENXIO; | ||
| 349 | goto err0; | ||
| 350 | } | ||
| 351 | |||
| 352 | /* get hold of clock */ | ||
| 353 | p->clk = clk_get(&pdev->dev, "sclk"); | ||
| 354 | if (IS_ERR(p->clk)) { | ||
| 355 | dev_err(&pdev->dev, "cannot get clock\n"); | ||
| 356 | ret = PTR_ERR(p->clk); | ||
| 357 | goto err1; | ||
| 358 | } | ||
| 359 | |||
| 360 | if (request_irq(irq, em_sti_interrupt, | ||
| 361 | IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING, | ||
| 362 | dev_name(&pdev->dev), p)) { | ||
| 363 | dev_err(&pdev->dev, "failed to request low IRQ\n"); | ||
| 364 | ret = -ENOENT; | ||
| 365 | goto err2; | ||
| 366 | } | ||
| 367 | |||
| 368 | raw_spin_lock_init(&p->lock); | ||
| 369 | em_sti_register_clockevent(p); | ||
| 370 | em_sti_register_clocksource(p); | ||
| 371 | return 0; | ||
| 372 | |||
| 373 | err2: | ||
| 374 | clk_put(p->clk); | ||
| 375 | err1: | ||
| 376 | iounmap(p->base); | ||
| 377 | err0: | ||
| 378 | kfree(p); | ||
| 379 | return ret; | ||
| 380 | } | ||
| 381 | |||
| 382 | static int __devexit em_sti_remove(struct platform_device *pdev) | ||
| 383 | { | ||
| 384 | return -EBUSY; /* cannot unregister clockevent and clocksource */ | ||
| 385 | } | ||
| 386 | |||
| 387 | static const struct of_device_id em_sti_dt_ids[] __devinitconst = { | ||
| 388 | { .compatible = "renesas,em-sti", }, | ||
| 389 | {}, | ||
| 390 | }; | ||
| 391 | MODULE_DEVICE_TABLE(of, em_sti_dt_ids); | ||
| 392 | |||
| 393 | static struct platform_driver em_sti_device_driver = { | ||
| 394 | .probe = em_sti_probe, | ||
| 395 | .remove = __devexit_p(em_sti_remove), | ||
| 396 | .driver = { | ||
| 397 | .name = "em_sti", | ||
| 398 | .of_match_table = em_sti_dt_ids, | ||
| 399 | } | ||
| 400 | }; | ||
| 401 | |||
| 402 | module_platform_driver(em_sti_device_driver); | ||
| 403 | |||
| 404 | MODULE_AUTHOR("Magnus Damm"); | ||
| 405 | MODULE_DESCRIPTION("Renesas Emma Mobile STI Timer Driver"); | ||
| 406 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 32fe9ef5cc5c..98b06baafcc6 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
| @@ -48,13 +48,13 @@ struct sh_cmt_priv { | |||
| 48 | unsigned long next_match_value; | 48 | unsigned long next_match_value; |
| 49 | unsigned long max_match_value; | 49 | unsigned long max_match_value; |
| 50 | unsigned long rate; | 50 | unsigned long rate; |
| 51 | spinlock_t lock; | 51 | raw_spinlock_t lock; |
| 52 | struct clock_event_device ced; | 52 | struct clock_event_device ced; |
| 53 | struct clocksource cs; | 53 | struct clocksource cs; |
| 54 | unsigned long total_cycles; | 54 | unsigned long total_cycles; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | static DEFINE_SPINLOCK(sh_cmt_lock); | 57 | static DEFINE_RAW_SPINLOCK(sh_cmt_lock); |
| 58 | 58 | ||
| 59 | #define CMSTR -1 /* shared register */ | 59 | #define CMSTR -1 /* shared register */ |
| 60 | #define CMCSR 0 /* channel register */ | 60 | #define CMCSR 0 /* channel register */ |
| @@ -139,7 +139,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
| 139 | unsigned long flags, value; | 139 | unsigned long flags, value; |
| 140 | 140 | ||
| 141 | /* start stop register shared by multiple timer channels */ | 141 | /* start stop register shared by multiple timer channels */ |
| 142 | spin_lock_irqsave(&sh_cmt_lock, flags); | 142 | raw_spin_lock_irqsave(&sh_cmt_lock, flags); |
| 143 | value = sh_cmt_read(p, CMSTR); | 143 | value = sh_cmt_read(p, CMSTR); |
| 144 | 144 | ||
| 145 | if (start) | 145 | if (start) |
| @@ -148,7 +148,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start) | |||
| 148 | value &= ~(1 << cfg->timer_bit); | 148 | value &= ~(1 << cfg->timer_bit); |
| 149 | 149 | ||
| 150 | sh_cmt_write(p, CMSTR, value); | 150 | sh_cmt_write(p, CMSTR, value); |
| 151 | spin_unlock_irqrestore(&sh_cmt_lock, flags); | 151 | raw_spin_unlock_irqrestore(&sh_cmt_lock, flags); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) | 154 | static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate) |
| @@ -328,9 +328,9 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta) | |||
| 328 | { | 328 | { |
| 329 | unsigned long flags; | 329 | unsigned long flags; |
| 330 | 330 | ||
| 331 | spin_lock_irqsave(&p->lock, flags); | 331 | raw_spin_lock_irqsave(&p->lock, flags); |
| 332 | __sh_cmt_set_next(p, delta); | 332 | __sh_cmt_set_next(p, delta); |
| 333 | spin_unlock_irqrestore(&p->lock, flags); | 333 | raw_spin_unlock_irqrestore(&p->lock, flags); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) | 336 | static irqreturn_t sh_cmt_interrupt(int irq, void *dev_id) |
| @@ -385,7 +385,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag) | |||
| 385 | int ret = 0; | 385 | int ret = 0; |
| 386 | unsigned long flags; | 386 | unsigned long flags; |
| 387 | 387 | ||
| 388 | spin_lock_irqsave(&p->lock, flags); | 388 | raw_spin_lock_irqsave(&p->lock, flags); |
| 389 | 389 | ||
| 390 | if (!(p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE))) | 390 | if (!(p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE))) |
| 391 | ret = sh_cmt_enable(p, &p->rate); | 391 | ret = sh_cmt_enable(p, &p->rate); |
| @@ -398,7 +398,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag) | |||
| 398 | if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT))) | 398 | if ((flag == FLAG_CLOCKSOURCE) && (!(p->flags & FLAG_CLOCKEVENT))) |
| 399 | __sh_cmt_set_next(p, p->max_match_value); | 399 | __sh_cmt_set_next(p, p->max_match_value); |
| 400 | out: | 400 | out: |
| 401 | spin_unlock_irqrestore(&p->lock, flags); | 401 | raw_spin_unlock_irqrestore(&p->lock, flags); |
| 402 | 402 | ||
| 403 | return ret; | 403 | return ret; |
| 404 | } | 404 | } |
| @@ -408,7 +408,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag) | |||
| 408 | unsigned long flags; | 408 | unsigned long flags; |
| 409 | unsigned long f; | 409 | unsigned long f; |
| 410 | 410 | ||
| 411 | spin_lock_irqsave(&p->lock, flags); | 411 | raw_spin_lock_irqsave(&p->lock, flags); |
| 412 | 412 | ||
| 413 | f = p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE); | 413 | f = p->flags & (FLAG_CLOCKEVENT | FLAG_CLOCKSOURCE); |
| 414 | p->flags &= ~flag; | 414 | p->flags &= ~flag; |
| @@ -420,7 +420,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag) | |||
| 420 | if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE)) | 420 | if ((flag == FLAG_CLOCKEVENT) && (p->flags & FLAG_CLOCKSOURCE)) |
| 421 | __sh_cmt_set_next(p, p->max_match_value); | 421 | __sh_cmt_set_next(p, p->max_match_value); |
| 422 | 422 | ||
| 423 | spin_unlock_irqrestore(&p->lock, flags); | 423 | raw_spin_unlock_irqrestore(&p->lock, flags); |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | static struct sh_cmt_priv *cs_to_sh_cmt(struct clocksource *cs) | 426 | static struct sh_cmt_priv *cs_to_sh_cmt(struct clocksource *cs) |
| @@ -435,13 +435,13 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs) | |||
| 435 | unsigned long value; | 435 | unsigned long value; |
| 436 | int has_wrapped; | 436 | int has_wrapped; |
| 437 | 437 | ||
| 438 | spin_lock_irqsave(&p->lock, flags); | 438 | raw_spin_lock_irqsave(&p->lock, flags); |
| 439 | value = p->total_cycles; | 439 | value = p->total_cycles; |
| 440 | raw = sh_cmt_get_counter(p, &has_wrapped); | 440 | raw = sh_cmt_get_counter(p, &has_wrapped); |
| 441 | 441 | ||
| 442 | if (unlikely(has_wrapped)) | 442 | if (unlikely(has_wrapped)) |
| 443 | raw += p->match_value + 1; | 443 | raw += p->match_value + 1; |
| 444 | spin_unlock_irqrestore(&p->lock, flags); | 444 | raw_spin_unlock_irqrestore(&p->lock, flags); |
| 445 | 445 | ||
| 446 | return value + raw; | 446 | return value + raw; |
| 447 | } | 447 | } |
| @@ -591,7 +591,7 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name, | |||
| 591 | p->max_match_value = (1 << p->width) - 1; | 591 | p->max_match_value = (1 << p->width) - 1; |
| 592 | 592 | ||
| 593 | p->match_value = p->max_match_value; | 593 | p->match_value = p->max_match_value; |
| 594 | spin_lock_init(&p->lock); | 594 | raw_spin_lock_init(&p->lock); |
| 595 | 595 | ||
| 596 | if (clockevent_rating) | 596 | if (clockevent_rating) |
| 597 | sh_cmt_register_clockevent(p, name, clockevent_rating); | 597 | sh_cmt_register_clockevent(p, name, clockevent_rating); |
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c index a2172f690418..d9b76ca64a61 100644 --- a/drivers/clocksource/sh_mtu2.c +++ b/drivers/clocksource/sh_mtu2.c | |||
| @@ -43,7 +43,7 @@ struct sh_mtu2_priv { | |||
| 43 | struct clock_event_device ced; | 43 | struct clock_event_device ced; |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | static DEFINE_SPINLOCK(sh_mtu2_lock); | 46 | static DEFINE_RAW_SPINLOCK(sh_mtu2_lock); |
| 47 | 47 | ||
| 48 | #define TSTR -1 /* shared register */ | 48 | #define TSTR -1 /* shared register */ |
| 49 | #define TCR 0 /* channel register */ | 49 | #define TCR 0 /* channel register */ |
| @@ -107,7 +107,7 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start) | |||
| 107 | unsigned long flags, value; | 107 | unsigned long flags, value; |
| 108 | 108 | ||
| 109 | /* start stop register shared by multiple timer channels */ | 109 | /* start stop register shared by multiple timer channels */ |
| 110 | spin_lock_irqsave(&sh_mtu2_lock, flags); | 110 | raw_spin_lock_irqsave(&sh_mtu2_lock, flags); |
| 111 | value = sh_mtu2_read(p, TSTR); | 111 | value = sh_mtu2_read(p, TSTR); |
| 112 | 112 | ||
| 113 | if (start) | 113 | if (start) |
| @@ -116,7 +116,7 @@ static void sh_mtu2_start_stop_ch(struct sh_mtu2_priv *p, int start) | |||
| 116 | value &= ~(1 << cfg->timer_bit); | 116 | value &= ~(1 << cfg->timer_bit); |
| 117 | 117 | ||
| 118 | sh_mtu2_write(p, TSTR, value); | 118 | sh_mtu2_write(p, TSTR, value); |
| 119 | spin_unlock_irqrestore(&sh_mtu2_lock, flags); | 119 | raw_spin_unlock_irqrestore(&sh_mtu2_lock, flags); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | static int sh_mtu2_enable(struct sh_mtu2_priv *p) | 122 | static int sh_mtu2_enable(struct sh_mtu2_priv *p) |
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c index 97f54b634be4..c1b51d49d106 100644 --- a/drivers/clocksource/sh_tmu.c +++ b/drivers/clocksource/sh_tmu.c | |||
| @@ -45,7 +45,7 @@ struct sh_tmu_priv { | |||
| 45 | struct clocksource cs; | 45 | struct clocksource cs; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | static DEFINE_SPINLOCK(sh_tmu_lock); | 48 | static DEFINE_RAW_SPINLOCK(sh_tmu_lock); |
| 49 | 49 | ||
| 50 | #define TSTR -1 /* shared register */ | 50 | #define TSTR -1 /* shared register */ |
| 51 | #define TCOR 0 /* channel register */ | 51 | #define TCOR 0 /* channel register */ |
| @@ -95,7 +95,7 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start) | |||
| 95 | unsigned long flags, value; | 95 | unsigned long flags, value; |
| 96 | 96 | ||
| 97 | /* start stop register shared by multiple timer channels */ | 97 | /* start stop register shared by multiple timer channels */ |
| 98 | spin_lock_irqsave(&sh_tmu_lock, flags); | 98 | raw_spin_lock_irqsave(&sh_tmu_lock, flags); |
| 99 | value = sh_tmu_read(p, TSTR); | 99 | value = sh_tmu_read(p, TSTR); |
| 100 | 100 | ||
| 101 | if (start) | 101 | if (start) |
| @@ -104,7 +104,7 @@ static void sh_tmu_start_stop_ch(struct sh_tmu_priv *p, int start) | |||
| 104 | value &= ~(1 << cfg->timer_bit); | 104 | value &= ~(1 << cfg->timer_bit); |
| 105 | 105 | ||
| 106 | sh_tmu_write(p, TSTR, value); | 106 | sh_tmu_write(p, TSTR, value); |
| 107 | spin_unlock_irqrestore(&sh_tmu_lock, flags); | 107 | raw_spin_unlock_irqrestore(&sh_tmu_lock, flags); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | static int sh_tmu_enable(struct sh_tmu_priv *p) | 110 | static int sh_tmu_enable(struct sh_tmu_priv *p) |
| @@ -245,12 +245,7 @@ static void sh_tmu_clock_event_start(struct sh_tmu_priv *p, int periodic) | |||
| 245 | 245 | ||
| 246 | sh_tmu_enable(p); | 246 | sh_tmu_enable(p); |
| 247 | 247 | ||
| 248 | /* TODO: calculate good shift from rate and counter bit width */ | 248 | clockevents_config(ced, p->rate); |
| 249 | |||
| 250 | ced->shift = 32; | ||
| 251 | ced->mult = div_sc(p->rate, NSEC_PER_SEC, ced->shift); | ||
| 252 | ced->max_delta_ns = clockevent_delta2ns(0xffffffff, ced); | ||
| 253 | ced->min_delta_ns = 5000; | ||
| 254 | 249 | ||
| 255 | if (periodic) { | 250 | if (periodic) { |
| 256 | p->periodic = (p->rate + HZ/2) / HZ; | 251 | p->periodic = (p->rate + HZ/2) / HZ; |
| @@ -323,7 +318,8 @@ static void sh_tmu_register_clockevent(struct sh_tmu_priv *p, | |||
| 323 | ced->set_mode = sh_tmu_clock_event_mode; | 318 | ced->set_mode = sh_tmu_clock_event_mode; |
| 324 | 319 | ||
| 325 | dev_info(&p->pdev->dev, "used for clock events\n"); | 320 | dev_info(&p->pdev->dev, "used for clock events\n"); |
| 326 | clockevents_register_device(ced); | 321 | |
| 322 | clockevents_config_and_register(ced, 1, 0x300, 0xffffffff); | ||
| 327 | 323 | ||
| 328 | ret = setup_irq(p->irqaction.irq, &p->irqaction); | 324 | ret = setup_irq(p->irqaction.irq, &p->irqaction); |
| 329 | if (ret) { | 325 | if (ret) { |
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c index e23dc82d43ac..721296157577 100644 --- a/drivers/dma/dw_dmac.c +++ b/drivers/dma/dw_dmac.c | |||
| @@ -1626,4 +1626,4 @@ module_exit(dw_exit); | |||
| 1626 | MODULE_LICENSE("GPL v2"); | 1626 | MODULE_LICENSE("GPL v2"); |
| 1627 | MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller driver"); | 1627 | MODULE_DESCRIPTION("Synopsys DesignWare DMA Controller driver"); |
| 1628 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); | 1628 | MODULE_AUTHOR("Haavard Skinnemoen (Atmel)"); |
| 1629 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 1629 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index fb4f4990f5eb..1dc2a4ad0026 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
| @@ -815,8 +815,6 @@ static int sdma_request_channel(struct sdma_channel *sdmac) | |||
| 815 | 815 | ||
| 816 | init_completion(&sdmac->done); | 816 | init_completion(&sdmac->done); |
| 817 | 817 | ||
| 818 | sdmac->buf_tail = 0; | ||
| 819 | |||
| 820 | return 0; | 818 | return 0; |
| 821 | out: | 819 | out: |
| 822 | 820 | ||
| @@ -927,6 +925,8 @@ static struct dma_async_tx_descriptor *sdma_prep_slave_sg( | |||
| 927 | 925 | ||
| 928 | sdmac->flags = 0; | 926 | sdmac->flags = 0; |
| 929 | 927 | ||
| 928 | sdmac->buf_tail = 0; | ||
| 929 | |||
| 930 | dev_dbg(sdma->dev, "setting up %d entries for channel %d.\n", | 930 | dev_dbg(sdma->dev, "setting up %d entries for channel %d.\n", |
| 931 | sg_len, channel); | 931 | sg_len, channel); |
| 932 | 932 | ||
| @@ -1027,6 +1027,8 @@ static struct dma_async_tx_descriptor *sdma_prep_dma_cyclic( | |||
| 1027 | 1027 | ||
| 1028 | sdmac->status = DMA_IN_PROGRESS; | 1028 | sdmac->status = DMA_IN_PROGRESS; |
| 1029 | 1029 | ||
| 1030 | sdmac->buf_tail = 0; | ||
| 1031 | |||
| 1030 | sdmac->flags |= IMX_DMA_SG_LOOP; | 1032 | sdmac->flags |= IMX_DMA_SG_LOOP; |
| 1031 | sdmac->direction = direction; | 1033 | sdmac->direction = direction; |
| 1032 | ret = sdma_load_context(sdmac); | 1034 | ret = sdma_load_context(sdmac); |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index cbcc28e79be6..e4feba6b03c0 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
| @@ -392,6 +392,8 @@ struct pl330_req { | |||
| 392 | struct pl330_reqcfg *cfg; | 392 | struct pl330_reqcfg *cfg; |
| 393 | /* Pointer to first xfer in the request. */ | 393 | /* Pointer to first xfer in the request. */ |
| 394 | struct pl330_xfer *x; | 394 | struct pl330_xfer *x; |
| 395 | /* Hook to attach to DMAC's list of reqs with due callback */ | ||
| 396 | struct list_head rqd; | ||
| 395 | }; | 397 | }; |
| 396 | 398 | ||
| 397 | /* | 399 | /* |
| @@ -461,8 +463,6 @@ struct _pl330_req { | |||
| 461 | /* Number of bytes taken to setup MC for the req */ | 463 | /* Number of bytes taken to setup MC for the req */ |
| 462 | u32 mc_len; | 464 | u32 mc_len; |
| 463 | struct pl330_req *r; | 465 | struct pl330_req *r; |
| 464 | /* Hook to attach to DMAC's list of reqs with due callback */ | ||
| 465 | struct list_head rqd; | ||
| 466 | }; | 466 | }; |
| 467 | 467 | ||
| 468 | /* ToBeDone for tasklet */ | 468 | /* ToBeDone for tasklet */ |
| @@ -1683,7 +1683,7 @@ static void pl330_dotask(unsigned long data) | |||
| 1683 | /* Returns 1 if state was updated, 0 otherwise */ | 1683 | /* Returns 1 if state was updated, 0 otherwise */ |
| 1684 | static int pl330_update(const struct pl330_info *pi) | 1684 | static int pl330_update(const struct pl330_info *pi) |
| 1685 | { | 1685 | { |
| 1686 | struct _pl330_req *rqdone; | 1686 | struct pl330_req *rqdone, *tmp; |
| 1687 | struct pl330_dmac *pl330; | 1687 | struct pl330_dmac *pl330; |
| 1688 | unsigned long flags; | 1688 | unsigned long flags; |
| 1689 | void __iomem *regs; | 1689 | void __iomem *regs; |
| @@ -1750,7 +1750,10 @@ static int pl330_update(const struct pl330_info *pi) | |||
| 1750 | if (active == -1) /* Aborted */ | 1750 | if (active == -1) /* Aborted */ |
| 1751 | continue; | 1751 | continue; |
| 1752 | 1752 | ||
| 1753 | rqdone = &thrd->req[active]; | 1753 | /* Detach the req */ |
| 1754 | rqdone = thrd->req[active].r; | ||
| 1755 | thrd->req[active].r = NULL; | ||
| 1756 | |||
| 1754 | mark_free(thrd, active); | 1757 | mark_free(thrd, active); |
| 1755 | 1758 | ||
| 1756 | /* Get going again ASAP */ | 1759 | /* Get going again ASAP */ |
| @@ -1762,20 +1765,11 @@ static int pl330_update(const struct pl330_info *pi) | |||
| 1762 | } | 1765 | } |
| 1763 | 1766 | ||
| 1764 | /* Now that we are in no hurry, do the callbacks */ | 1767 | /* Now that we are in no hurry, do the callbacks */ |
| 1765 | while (!list_empty(&pl330->req_done)) { | 1768 | list_for_each_entry_safe(rqdone, tmp, &pl330->req_done, rqd) { |
| 1766 | struct pl330_req *r; | 1769 | list_del(&rqdone->rqd); |
| 1767 | |||
| 1768 | rqdone = container_of(pl330->req_done.next, | ||
| 1769 | struct _pl330_req, rqd); | ||
| 1770 | |||
| 1771 | list_del_init(&rqdone->rqd); | ||
| 1772 | |||
| 1773 | /* Detach the req */ | ||
| 1774 | r = rqdone->r; | ||
| 1775 | rqdone->r = NULL; | ||
| 1776 | 1770 | ||
| 1777 | spin_unlock_irqrestore(&pl330->lock, flags); | 1771 | spin_unlock_irqrestore(&pl330->lock, flags); |
| 1778 | _callback(r, PL330_ERR_NONE); | 1772 | _callback(rqdone, PL330_ERR_NONE); |
| 1779 | spin_lock_irqsave(&pl330->lock, flags); | 1773 | spin_lock_irqsave(&pl330->lock, flags); |
| 1780 | } | 1774 | } |
| 1781 | 1775 | ||
| @@ -2321,7 +2315,7 @@ static void pl330_tasklet(unsigned long data) | |||
| 2321 | /* Pick up ripe tomatoes */ | 2315 | /* Pick up ripe tomatoes */ |
| 2322 | list_for_each_entry_safe(desc, _dt, &pch->work_list, node) | 2316 | list_for_each_entry_safe(desc, _dt, &pch->work_list, node) |
| 2323 | if (desc->status == DONE) { | 2317 | if (desc->status == DONE) { |
| 2324 | if (pch->cyclic) | 2318 | if (!pch->cyclic) |
| 2325 | dma_cookie_complete(&desc->txd); | 2319 | dma_cookie_complete(&desc->txd); |
| 2326 | list_move_tail(&desc->node, &list); | 2320 | list_move_tail(&desc->node, &list); |
| 2327 | } | 2321 | } |
| @@ -2539,7 +2533,7 @@ static inline void _init_desc(struct dma_pl330_desc *desc) | |||
| 2539 | } | 2533 | } |
| 2540 | 2534 | ||
| 2541 | /* Returns the number of descriptors added to the DMAC pool */ | 2535 | /* Returns the number of descriptors added to the DMAC pool */ |
| 2542 | int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count) | 2536 | static int add_desc(struct dma_pl330_dmac *pdmac, gfp_t flg, int count) |
| 2543 | { | 2537 | { |
| 2544 | struct dma_pl330_desc *desc; | 2538 | struct dma_pl330_desc *desc; |
| 2545 | unsigned long flags; | 2539 | unsigned long flags; |
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c index 10f375032e96..de5ba86e8b89 100644 --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c | |||
| @@ -164,7 +164,7 @@ void *edac_align_ptr(void **p, unsigned size, int n_elems) | |||
| 164 | else | 164 | else |
| 165 | return (char *)ptr; | 165 | return (char *)ptr; |
| 166 | 166 | ||
| 167 | r = size % align; | 167 | r = (unsigned long)p % align; |
| 168 | 168 | ||
| 169 | if (r == 0) | 169 | if (r == 0) |
| 170 | return (char *)ptr; | 170 | return (char *)ptr; |
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index d27778f65a5d..a499c7ed820a 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c | |||
| @@ -1814,12 +1814,6 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val, | |||
| 1814 | if (mce->bank != 8) | 1814 | if (mce->bank != 8) |
| 1815 | return NOTIFY_DONE; | 1815 | return NOTIFY_DONE; |
| 1816 | 1816 | ||
| 1817 | #ifdef CONFIG_SMP | ||
| 1818 | /* Only handle if it is the right mc controller */ | ||
| 1819 | if (mce->socketid != pvt->i7core_dev->socket) | ||
| 1820 | return NOTIFY_DONE; | ||
| 1821 | #endif | ||
| 1822 | |||
| 1823 | smp_rmb(); | 1817 | smp_rmb(); |
| 1824 | if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) { | 1818 | if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) { |
| 1825 | smp_wmb(); | 1819 | smp_wmb(); |
| @@ -2116,8 +2110,6 @@ static void i7core_unregister_mci(struct i7core_dev *i7core_dev) | |||
| 2116 | if (pvt->enable_scrub) | 2110 | if (pvt->enable_scrub) |
| 2117 | disable_sdram_scrub_setting(mci); | 2111 | disable_sdram_scrub_setting(mci); |
| 2118 | 2112 | ||
| 2119 | mce_unregister_decode_chain(&i7_mce_dec); | ||
| 2120 | |||
| 2121 | /* Disable EDAC polling */ | 2113 | /* Disable EDAC polling */ |
| 2122 | i7core_pci_ctl_release(pvt); | 2114 | i7core_pci_ctl_release(pvt); |
| 2123 | 2115 | ||
| @@ -2222,8 +2214,6 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev) | |||
| 2222 | /* DCLK for scrub rate setting */ | 2214 | /* DCLK for scrub rate setting */ |
| 2223 | pvt->dclk_freq = get_dclk_freq(); | 2215 | pvt->dclk_freq = get_dclk_freq(); |
| 2224 | 2216 | ||
| 2225 | mce_register_decode_chain(&i7_mce_dec); | ||
| 2226 | |||
| 2227 | return 0; | 2217 | return 0; |
| 2228 | 2218 | ||
| 2229 | fail0: | 2219 | fail0: |
| @@ -2367,8 +2357,10 @@ static int __init i7core_init(void) | |||
| 2367 | 2357 | ||
| 2368 | pci_rc = pci_register_driver(&i7core_driver); | 2358 | pci_rc = pci_register_driver(&i7core_driver); |
| 2369 | 2359 | ||
| 2370 | if (pci_rc >= 0) | 2360 | if (pci_rc >= 0) { |
| 2361 | mce_register_decode_chain(&i7_mce_dec); | ||
| 2371 | return 0; | 2362 | return 0; |
| 2363 | } | ||
| 2372 | 2364 | ||
| 2373 | i7core_printk(KERN_ERR, "Failed to register device with error %d.\n", | 2365 | i7core_printk(KERN_ERR, "Failed to register device with error %d.\n", |
| 2374 | pci_rc); | 2366 | pci_rc); |
| @@ -2384,6 +2376,7 @@ static void __exit i7core_exit(void) | |||
| 2384 | { | 2376 | { |
| 2385 | debugf2("MC: " __FILE__ ": %s()\n", __func__); | 2377 | debugf2("MC: " __FILE__ ": %s()\n", __func__); |
| 2386 | pci_unregister_driver(&i7core_driver); | 2378 | pci_unregister_driver(&i7core_driver); |
| 2379 | mce_unregister_decode_chain(&i7_mce_dec); | ||
| 2387 | } | 2380 | } |
| 2388 | 2381 | ||
| 2389 | module_init(i7core_init); | 2382 | module_init(i7core_init); |
diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c index 4c402353ba98..0e374625f6f8 100644 --- a/drivers/edac/mpc85xx_edac.c +++ b/drivers/edac/mpc85xx_edac.c | |||
| @@ -980,7 +980,8 @@ static int __devinit mpc85xx_mc_err_probe(struct platform_device *op) | |||
| 980 | layers[1].type = EDAC_MC_LAYER_CHANNEL; | 980 | layers[1].type = EDAC_MC_LAYER_CHANNEL; |
| 981 | layers[1].size = 1; | 981 | layers[1].size = 1; |
| 982 | layers[1].is_virt_csrow = false; | 982 | layers[1].is_virt_csrow = false; |
| 983 | mci = edac_mc_alloc(edac_mc_idx, ARRAY_SIZE(layers), sizeof(*pdata)); | 983 | mci = edac_mc_alloc(edac_mc_idx, ARRAY_SIZE(layers), layers, |
| 984 | sizeof(*pdata)); | ||
| 984 | if (!mci) { | 985 | if (!mci) { |
| 985 | devres_release_group(&op->dev, mpc85xx_mc_err_probe); | 986 | devres_release_group(&op->dev, mpc85xx_mc_err_probe); |
| 986 | return -ENOMEM; | 987 | return -ENOMEM; |
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c index 4adaf4b7da99..36ad17e79d61 100644 --- a/drivers/edac/sb_edac.c +++ b/drivers/edac/sb_edac.c | |||
| @@ -555,7 +555,7 @@ static int get_dimm_config(struct mem_ctl_info *mci) | |||
| 555 | pvt->is_close_pg = false; | 555 | pvt->is_close_pg = false; |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | pci_read_config_dword(pvt->pci_ta, RANK_CFG_A, ®); | 558 | pci_read_config_dword(pvt->pci_ddrio, RANK_CFG_A, ®); |
| 559 | if (IS_RDIMM_ENABLED(reg)) { | 559 | if (IS_RDIMM_ENABLED(reg)) { |
| 560 | /* FIXME: Can also be LRDIMM */ | 560 | /* FIXME: Can also be LRDIMM */ |
| 561 | debugf0("Memory is registered\n"); | 561 | debugf0("Memory is registered\n"); |
| @@ -1604,8 +1604,6 @@ static void sbridge_unregister_mci(struct sbridge_dev *sbridge_dev) | |||
| 1604 | debugf0("MC: " __FILE__ ": %s(): mci = %p, dev = %p\n", | 1604 | debugf0("MC: " __FILE__ ": %s(): mci = %p, dev = %p\n", |
| 1605 | __func__, mci, &sbridge_dev->pdev[0]->dev); | 1605 | __func__, mci, &sbridge_dev->pdev[0]->dev); |
| 1606 | 1606 | ||
| 1607 | mce_unregister_decode_chain(&sbridge_mce_dec); | ||
| 1608 | |||
| 1609 | /* Remove MC sysfs nodes */ | 1607 | /* Remove MC sysfs nodes */ |
| 1610 | edac_mc_del_mc(mci->dev); | 1608 | edac_mc_del_mc(mci->dev); |
| 1611 | 1609 | ||
| @@ -1682,7 +1680,6 @@ static int sbridge_register_mci(struct sbridge_dev *sbridge_dev) | |||
| 1682 | goto fail0; | 1680 | goto fail0; |
| 1683 | } | 1681 | } |
| 1684 | 1682 | ||
| 1685 | mce_register_decode_chain(&sbridge_mce_dec); | ||
| 1686 | return 0; | 1683 | return 0; |
| 1687 | 1684 | ||
| 1688 | fail0: | 1685 | fail0: |
| @@ -1811,8 +1808,10 @@ static int __init sbridge_init(void) | |||
| 1811 | 1808 | ||
| 1812 | pci_rc = pci_register_driver(&sbridge_driver); | 1809 | pci_rc = pci_register_driver(&sbridge_driver); |
| 1813 | 1810 | ||
| 1814 | if (pci_rc >= 0) | 1811 | if (pci_rc >= 0) { |
| 1812 | mce_register_decode_chain(&sbridge_mce_dec); | ||
| 1815 | return 0; | 1813 | return 0; |
| 1814 | } | ||
| 1816 | 1815 | ||
| 1817 | sbridge_printk(KERN_ERR, "Failed to register device with error %d.\n", | 1816 | sbridge_printk(KERN_ERR, "Failed to register device with error %d.\n", |
| 1818 | pci_rc); | 1817 | pci_rc); |
| @@ -1828,6 +1827,7 @@ static void __exit sbridge_exit(void) | |||
| 1828 | { | 1827 | { |
| 1829 | debugf2("MC: " __FILE__ ": %s()\n", __func__); | 1828 | debugf2("MC: " __FILE__ ": %s()\n", __func__); |
| 1830 | pci_unregister_driver(&sbridge_driver); | 1829 | pci_unregister_driver(&sbridge_driver); |
| 1830 | mce_unregister_decode_chain(&sbridge_mce_dec); | ||
| 1831 | } | 1831 | } |
| 1832 | 1832 | ||
| 1833 | module_init(sbridge_init); | 1833 | module_init(sbridge_init); |
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index 23416e443765..a4ed30bd9a41 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c | |||
| @@ -116,8 +116,8 @@ const char *max8997_extcon_cable[] = { | |||
| 116 | [5] = "Charge-downstream", | 116 | [5] = "Charge-downstream", |
| 117 | [6] = "MHL", | 117 | [6] = "MHL", |
| 118 | [7] = "Dock-desk", | 118 | [7] = "Dock-desk", |
| 119 | [7] = "Dock-card", | 119 | [8] = "Dock-card", |
| 120 | [8] = "JIG", | 120 | [9] = "JIG", |
| 121 | 121 | ||
| 122 | NULL, | 122 | NULL, |
| 123 | }; | 123 | }; |
| @@ -514,6 +514,7 @@ static int __devexit max8997_muic_remove(struct platform_device *pdev) | |||
| 514 | 514 | ||
| 515 | extcon_dev_unregister(info->edev); | 515 | extcon_dev_unregister(info->edev); |
| 516 | 516 | ||
| 517 | kfree(info->edev); | ||
| 517 | kfree(info); | 518 | kfree(info); |
| 518 | 519 | ||
| 519 | return 0; | 520 | return 0; |
diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c index f598a700ec15..159aeb07b3ba 100644 --- a/drivers/extcon/extcon_class.c +++ b/drivers/extcon/extcon_class.c | |||
| @@ -762,7 +762,7 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev) | |||
| 762 | #if defined(CONFIG_ANDROID) | 762 | #if defined(CONFIG_ANDROID) |
| 763 | if (switch_class) | 763 | if (switch_class) |
| 764 | ret = class_compat_create_link(switch_class, edev->dev, | 764 | ret = class_compat_create_link(switch_class, edev->dev, |
| 765 | dev); | 765 | NULL); |
| 766 | #endif /* CONFIG_ANDROID */ | 766 | #endif /* CONFIG_ANDROID */ |
| 767 | 767 | ||
| 768 | spin_lock_init(&edev->lock); | 768 | spin_lock_init(&edev->lock); |
diff --git a/drivers/extcon/extcon_gpio.c b/drivers/extcon/extcon_gpio.c index fe7a07b47336..8a0dcc11c7c7 100644 --- a/drivers/extcon/extcon_gpio.c +++ b/drivers/extcon/extcon_gpio.c | |||
| @@ -125,6 +125,7 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev) | |||
| 125 | if (ret < 0) | 125 | if (ret < 0) |
| 126 | goto err_request_irq; | 126 | goto err_request_irq; |
| 127 | 127 | ||
| 128 | platform_set_drvdata(pdev, extcon_data); | ||
| 128 | /* Perform initial detection */ | 129 | /* Perform initial detection */ |
| 129 | gpio_extcon_work(&extcon_data->work.work); | 130 | gpio_extcon_work(&extcon_data->work.work); |
| 130 | 131 | ||
| @@ -146,6 +147,7 @@ static int __devexit gpio_extcon_remove(struct platform_device *pdev) | |||
| 146 | struct gpio_extcon_data *extcon_data = platform_get_drvdata(pdev); | 147 | struct gpio_extcon_data *extcon_data = platform_get_drvdata(pdev); |
| 147 | 148 | ||
| 148 | cancel_delayed_work_sync(&extcon_data->work); | 149 | cancel_delayed_work_sync(&extcon_data->work); |
| 150 | free_irq(extcon_data->irq, extcon_data); | ||
| 149 | gpio_free(extcon_data->gpio); | 151 | gpio_free(extcon_data->gpio); |
| 150 | extcon_dev_unregister(&extcon_data->edev); | 152 | extcon_dev_unregister(&extcon_data->edev); |
| 151 | devm_kfree(&pdev->dev, extcon_data); | 153 | devm_kfree(&pdev->dev, extcon_data); |
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index c4067d0141f7..542f0c04b695 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
| @@ -136,7 +136,7 @@ config GPIO_MPC8XXX | |||
| 136 | 136 | ||
| 137 | config GPIO_MSM_V1 | 137 | config GPIO_MSM_V1 |
| 138 | tristate "Qualcomm MSM GPIO v1" | 138 | tristate "Qualcomm MSM GPIO v1" |
| 139 | depends on GPIOLIB && ARCH_MSM | 139 | depends on GPIOLIB && ARCH_MSM && (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50) |
| 140 | help | 140 | help |
| 141 | Say yes here to support the GPIO interface on ARM v6 based | 141 | Say yes here to support the GPIO interface on ARM v6 based |
| 142 | Qualcomm MSM chips. Most of the pins on the MSM can be | 142 | Qualcomm MSM chips. Most of the pins on the MSM can be |
diff --git a/drivers/gpio/devres.c b/drivers/gpio/devres.c index 9e9947cb86a3..1077754f8289 100644 --- a/drivers/gpio/devres.c +++ b/drivers/gpio/devres.c | |||
| @@ -98,6 +98,7 @@ int devm_gpio_request_one(struct device *dev, unsigned gpio, | |||
| 98 | 98 | ||
| 99 | return 0; | 99 | return 0; |
| 100 | } | 100 | } |
| 101 | EXPORT_SYMBOL(devm_gpio_request_one); | ||
| 101 | 102 | ||
| 102 | /** | 103 | /** |
| 103 | * devm_gpio_free - free an interrupt | 104 | * devm_gpio_free - free an interrupt |
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index c337143b18f8..c89c4c1e668d 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c | |||
| @@ -398,10 +398,12 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev) | |||
| 398 | writel(~0, port->base + GPIO_ISR); | 398 | writel(~0, port->base + GPIO_ISR); |
| 399 | 399 | ||
| 400 | if (mxc_gpio_hwtype == IMX21_GPIO) { | 400 | if (mxc_gpio_hwtype == IMX21_GPIO) { |
| 401 | /* setup one handler for all GPIO interrupts */ | 401 | /* |
| 402 | if (pdev->id == 0) | 402 | * Setup one handler for all GPIO interrupts. Actually setting |
| 403 | irq_set_chained_handler(port->irq, | 403 | * the handler is needed only once, but doing it for every port |
| 404 | mx2_gpio_irq_handler); | 404 | * is more robust and easier. |
| 405 | */ | ||
| 406 | irq_set_chained_handler(port->irq, mx2_gpio_irq_handler); | ||
| 405 | } else { | 407 | } else { |
| 406 | /* setup one handler for each entry */ | 408 | /* setup one handler for each entry */ |
| 407 | irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); | 409 | irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index c4ed1722734c..4fbc208c32cf 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
| @@ -174,12 +174,22 @@ static inline void _gpio_dbck_enable(struct gpio_bank *bank) | |||
| 174 | if (bank->dbck_enable_mask && !bank->dbck_enabled) { | 174 | if (bank->dbck_enable_mask && !bank->dbck_enabled) { |
| 175 | clk_enable(bank->dbck); | 175 | clk_enable(bank->dbck); |
| 176 | bank->dbck_enabled = true; | 176 | bank->dbck_enabled = true; |
| 177 | |||
| 178 | __raw_writel(bank->dbck_enable_mask, | ||
| 179 | bank->base + bank->regs->debounce_en); | ||
| 177 | } | 180 | } |
| 178 | } | 181 | } |
| 179 | 182 | ||
| 180 | static inline void _gpio_dbck_disable(struct gpio_bank *bank) | 183 | static inline void _gpio_dbck_disable(struct gpio_bank *bank) |
| 181 | { | 184 | { |
| 182 | if (bank->dbck_enable_mask && bank->dbck_enabled) { | 185 | if (bank->dbck_enable_mask && bank->dbck_enabled) { |
| 186 | /* | ||
| 187 | * Disable debounce before cutting it's clock. If debounce is | ||
| 188 | * enabled but the clock is not, GPIO module seems to be unable | ||
| 189 | * to detect events and generate interrupts at least on OMAP3. | ||
| 190 | */ | ||
| 191 | __raw_writel(0, bank->base + bank->regs->debounce_en); | ||
| 192 | |||
| 183 | clk_disable(bank->dbck); | 193 | clk_disable(bank->dbck); |
| 184 | bank->dbck_enabled = false; | 194 | bank->dbck_enabled = false; |
| 185 | } | 195 | } |
| @@ -1081,7 +1091,6 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
| 1081 | bank->is_mpuio = pdata->is_mpuio; | 1091 | bank->is_mpuio = pdata->is_mpuio; |
| 1082 | bank->non_wakeup_gpios = pdata->non_wakeup_gpios; | 1092 | bank->non_wakeup_gpios = pdata->non_wakeup_gpios; |
| 1083 | bank->loses_context = pdata->loses_context; | 1093 | bank->loses_context = pdata->loses_context; |
| 1084 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
| 1085 | bank->regs = pdata->regs; | 1094 | bank->regs = pdata->regs; |
| 1086 | #ifdef CONFIG_OF_GPIO | 1095 | #ifdef CONFIG_OF_GPIO |
| 1087 | bank->chip.of_node = of_node_get(node); | 1096 | bank->chip.of_node = of_node_get(node); |
| @@ -1135,6 +1144,9 @@ static int __devinit omap_gpio_probe(struct platform_device *pdev) | |||
| 1135 | omap_gpio_chip_init(bank); | 1144 | omap_gpio_chip_init(bank); |
| 1136 | omap_gpio_show_rev(bank); | 1145 | omap_gpio_show_rev(bank); |
| 1137 | 1146 | ||
| 1147 | if (bank->loses_context) | ||
| 1148 | bank->get_context_loss_count = pdata->get_context_loss_count; | ||
| 1149 | |||
| 1138 | pm_runtime_put(bank->dev); | 1150 | pm_runtime_put(bank->dev); |
| 1139 | 1151 | ||
| 1140 | list_add_tail(&bank->node, &omap_gpio_list); | 1152 | list_add_tail(&bank->node, &omap_gpio_list); |
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c index 38416be8ba11..6064fb376e11 100644 --- a/drivers/gpio/gpio-sta2x11.c +++ b/drivers/gpio/gpio-sta2x11.c | |||
| @@ -383,8 +383,9 @@ static int __devinit gsta_probe(struct platform_device *dev) | |||
| 383 | } | 383 | } |
| 384 | spin_lock_init(&chip->lock); | 384 | spin_lock_init(&chip->lock); |
| 385 | gsta_gpio_setup(chip); | 385 | gsta_gpio_setup(chip); |
| 386 | for (i = 0; i < GSTA_NR_GPIO; i++) | 386 | if (gpio_pdata) |
| 387 | gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); | 387 | for (i = 0; i < GSTA_NR_GPIO; i++) |
| 388 | gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); | ||
| 388 | 389 | ||
| 389 | /* 384 was used in previous code: be compatible for other drivers */ | 390 | /* 384 was used in previous code: be compatible for other drivers */ |
| 390 | err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); | 391 | err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); |
diff --git a/drivers/gpio/gpio-tps65910.c b/drivers/gpio/gpio-tps65910.c index c1ad2884f2ed..11f29c82253c 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c | |||
| @@ -149,6 +149,9 @@ static int __devinit tps65910_gpio_probe(struct platform_device *pdev) | |||
| 149 | tps65910_gpio->gpio_chip.set = tps65910_gpio_set; | 149 | tps65910_gpio->gpio_chip.set = tps65910_gpio_set; |
| 150 | tps65910_gpio->gpio_chip.get = tps65910_gpio_get; | 150 | tps65910_gpio->gpio_chip.get = tps65910_gpio_get; |
| 151 | tps65910_gpio->gpio_chip.dev = &pdev->dev; | 151 | tps65910_gpio->gpio_chip.dev = &pdev->dev; |
| 152 | #ifdef CONFIG_OF_GPIO | ||
| 153 | tps65910_gpio->gpio_chip.of_node = tps65910->dev->of_node; | ||
| 154 | #endif | ||
| 152 | if (pdata && pdata->gpio_base) | 155 | if (pdata && pdata->gpio_base) |
| 153 | tps65910_gpio->gpio_chip.base = pdata->gpio_base; | 156 | tps65910_gpio->gpio_chip.base = pdata->gpio_base; |
| 154 | else | 157 | else |
diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c index 92ea5350dfe9..aa61ad2fcaaa 100644 --- a/drivers/gpio/gpio-wm8994.c +++ b/drivers/gpio/gpio-wm8994.c | |||
| @@ -89,8 +89,11 @@ static int wm8994_gpio_direction_out(struct gpio_chip *chip, | |||
| 89 | struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); | 89 | struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip); |
| 90 | struct wm8994 *wm8994 = wm8994_gpio->wm8994; | 90 | struct wm8994 *wm8994 = wm8994_gpio->wm8994; |
| 91 | 91 | ||
| 92 | if (value) | ||
| 93 | value = WM8994_GPN_LVL; | ||
| 94 | |||
| 92 | return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset, | 95 | return wm8994_set_bits(wm8994, WM8994_GPIO_1 + offset, |
| 93 | WM8994_GPN_DIR, 0); | 96 | WM8994_GPN_DIR | WM8994_GPN_LVL, value); |
| 94 | } | 97 | } |
| 95 | 98 | ||
| 96 | static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 99 | static void wm8994_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index eb92fe257a39..a8743c399e83 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
| @@ -610,7 +610,7 @@ static bool | |||
| 610 | drm_monitor_supports_rb(struct edid *edid) | 610 | drm_monitor_supports_rb(struct edid *edid) |
| 611 | { | 611 | { |
| 612 | if (edid->revision >= 4) { | 612 | if (edid->revision >= 4) { |
| 613 | bool ret; | 613 | bool ret = false; |
| 614 | drm_for_each_detailed_block((u8 *)edid, is_rb, &ret); | 614 | drm_for_each_detailed_block((u8 *)edid, is_rb, &ret); |
| 615 | return ret; | 615 | return ret; |
| 616 | } | 616 | } |
| @@ -1039,6 +1039,24 @@ mode_in_range(const struct drm_display_mode *mode, struct edid *edid, | |||
| 1039 | return true; | 1039 | return true; |
| 1040 | } | 1040 | } |
| 1041 | 1041 | ||
| 1042 | static bool valid_inferred_mode(const struct drm_connector *connector, | ||
| 1043 | const struct drm_display_mode *mode) | ||
| 1044 | { | ||
| 1045 | struct drm_display_mode *m; | ||
| 1046 | bool ok = false; | ||
| 1047 | |||
| 1048 | list_for_each_entry(m, &connector->probed_modes, head) { | ||
| 1049 | if (mode->hdisplay == m->hdisplay && | ||
| 1050 | mode->vdisplay == m->vdisplay && | ||
| 1051 | drm_mode_vrefresh(mode) == drm_mode_vrefresh(m)) | ||
| 1052 | return false; /* duplicated */ | ||
| 1053 | if (mode->hdisplay <= m->hdisplay && | ||
| 1054 | mode->vdisplay <= m->vdisplay) | ||
| 1055 | ok = true; | ||
| 1056 | } | ||
| 1057 | return ok; | ||
| 1058 | } | ||
| 1059 | |||
| 1042 | static int | 1060 | static int |
| 1043 | drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, | 1061 | drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, |
| 1044 | struct detailed_timing *timing) | 1062 | struct detailed_timing *timing) |
| @@ -1048,7 +1066,8 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
| 1048 | struct drm_device *dev = connector->dev; | 1066 | struct drm_device *dev = connector->dev; |
| 1049 | 1067 | ||
| 1050 | for (i = 0; i < drm_num_dmt_modes; i++) { | 1068 | for (i = 0; i < drm_num_dmt_modes; i++) { |
| 1051 | if (mode_in_range(drm_dmt_modes + i, edid, timing)) { | 1069 | if (mode_in_range(drm_dmt_modes + i, edid, timing) && |
| 1070 | valid_inferred_mode(connector, drm_dmt_modes + i)) { | ||
| 1052 | newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); | 1071 | newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); |
| 1053 | if (newmode) { | 1072 | if (newmode) { |
| 1054 | drm_mode_probed_add(connector, newmode); | 1073 | drm_mode_probed_add(connector, newmode); |
| @@ -1088,7 +1107,8 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
| 1088 | return modes; | 1107 | return modes; |
| 1089 | 1108 | ||
| 1090 | fixup_mode_1366x768(newmode); | 1109 | fixup_mode_1366x768(newmode); |
| 1091 | if (!mode_in_range(newmode, edid, timing)) { | 1110 | if (!mode_in_range(newmode, edid, timing) || |
| 1111 | !valid_inferred_mode(connector, newmode)) { | ||
| 1092 | drm_mode_destroy(dev, newmode); | 1112 | drm_mode_destroy(dev, newmode); |
| 1093 | continue; | 1113 | continue; |
| 1094 | } | 1114 | } |
| @@ -1116,7 +1136,8 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid, | |||
| 1116 | return modes; | 1136 | return modes; |
| 1117 | 1137 | ||
| 1118 | fixup_mode_1366x768(newmode); | 1138 | fixup_mode_1366x768(newmode); |
| 1119 | if (!mode_in_range(newmode, edid, timing)) { | 1139 | if (!mode_in_range(newmode, edid, timing) || |
| 1140 | !valid_inferred_mode(connector, newmode)) { | ||
| 1120 | drm_mode_destroy(dev, newmode); | 1141 | drm_mode_destroy(dev, newmode); |
| 1121 | continue; | 1142 | continue; |
| 1122 | } | 1143 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 420953197d0a..d6de2e07fa03 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
| @@ -244,8 +244,8 @@ static const struct file_operations exynos_drm_driver_fops = { | |||
| 244 | }; | 244 | }; |
| 245 | 245 | ||
| 246 | static struct drm_driver exynos_drm_driver = { | 246 | static struct drm_driver exynos_drm_driver = { |
| 247 | .driver_features = DRIVER_HAVE_IRQ | DRIVER_BUS_PLATFORM | | 247 | .driver_features = DRIVER_HAVE_IRQ | DRIVER_MODESET | |
| 248 | DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME, | 248 | DRIVER_GEM | DRIVER_PRIME, |
| 249 | .load = exynos_drm_load, | 249 | .load = exynos_drm_load, |
| 250 | .unload = exynos_drm_unload, | 250 | .unload = exynos_drm_unload, |
| 251 | .open = exynos_drm_open, | 251 | .open = exynos_drm_open, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index 6e9ac7bd1dcf..23d5ad379f86 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
| @@ -172,19 +172,12 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder) | |||
| 172 | manager_ops->commit(manager->dev); | 172 | manager_ops->commit(manager->dev); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | static struct drm_crtc * | ||
| 176 | exynos_drm_encoder_get_crtc(struct drm_encoder *encoder) | ||
| 177 | { | ||
| 178 | return encoder->crtc; | ||
| 179 | } | ||
| 180 | |||
| 181 | static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = { | 175 | static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = { |
| 182 | .dpms = exynos_drm_encoder_dpms, | 176 | .dpms = exynos_drm_encoder_dpms, |
| 183 | .mode_fixup = exynos_drm_encoder_mode_fixup, | 177 | .mode_fixup = exynos_drm_encoder_mode_fixup, |
| 184 | .mode_set = exynos_drm_encoder_mode_set, | 178 | .mode_set = exynos_drm_encoder_mode_set, |
| 185 | .prepare = exynos_drm_encoder_prepare, | 179 | .prepare = exynos_drm_encoder_prepare, |
| 186 | .commit = exynos_drm_encoder_commit, | 180 | .commit = exynos_drm_encoder_commit, |
| 187 | .get_crtc = exynos_drm_encoder_get_crtc, | ||
| 188 | }; | 181 | }; |
| 189 | 182 | ||
| 190 | static void exynos_drm_encoder_destroy(struct drm_encoder *encoder) | 183 | static void exynos_drm_encoder_destroy(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index f82a299553fb..4ccfe4328fab 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
| @@ -51,11 +51,22 @@ struct exynos_drm_fb { | |||
| 51 | static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) | 51 | static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) |
| 52 | { | 52 | { |
| 53 | struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); | 53 | struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); |
| 54 | unsigned int i; | ||
| 54 | 55 | ||
| 55 | DRM_DEBUG_KMS("%s\n", __FILE__); | 56 | DRM_DEBUG_KMS("%s\n", __FILE__); |
| 56 | 57 | ||
| 57 | drm_framebuffer_cleanup(fb); | 58 | drm_framebuffer_cleanup(fb); |
| 58 | 59 | ||
| 60 | for (i = 0; i < ARRAY_SIZE(exynos_fb->exynos_gem_obj); i++) { | ||
| 61 | struct drm_gem_object *obj; | ||
| 62 | |||
| 63 | if (exynos_fb->exynos_gem_obj[i] == NULL) | ||
| 64 | continue; | ||
| 65 | |||
| 66 | obj = &exynos_fb->exynos_gem_obj[i]->base; | ||
| 67 | drm_gem_object_unreference_unlocked(obj); | ||
| 68 | } | ||
| 69 | |||
| 59 | kfree(exynos_fb); | 70 | kfree(exynos_fb); |
| 60 | exynos_fb = NULL; | 71 | exynos_fb = NULL; |
| 61 | } | 72 | } |
| @@ -134,11 +145,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | |||
| 134 | return ERR_PTR(-ENOENT); | 145 | return ERR_PTR(-ENOENT); |
| 135 | } | 146 | } |
| 136 | 147 | ||
| 137 | drm_gem_object_unreference_unlocked(obj); | ||
| 138 | |||
| 139 | fb = exynos_drm_framebuffer_init(dev, mode_cmd, obj); | 148 | fb = exynos_drm_framebuffer_init(dev, mode_cmd, obj); |
| 140 | if (IS_ERR(fb)) | 149 | if (IS_ERR(fb)) { |
| 150 | drm_gem_object_unreference_unlocked(obj); | ||
| 141 | return fb; | 151 | return fb; |
| 152 | } | ||
| 142 | 153 | ||
| 143 | exynos_fb = to_exynos_fb(fb); | 154 | exynos_fb = to_exynos_fb(fb); |
| 144 | nr = exynos_drm_format_num_buffers(fb->pixel_format); | 155 | nr = exynos_drm_format_num_buffers(fb->pixel_format); |
| @@ -152,8 +163,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | |||
| 152 | return ERR_PTR(-ENOENT); | 163 | return ERR_PTR(-ENOENT); |
| 153 | } | 164 | } |
| 154 | 165 | ||
| 155 | drm_gem_object_unreference_unlocked(obj); | ||
| 156 | |||
| 157 | exynos_fb->exynos_gem_obj[i] = to_exynos_gem_obj(obj); | 166 | exynos_fb->exynos_gem_obj[i] = to_exynos_gem_obj(obj); |
| 158 | } | 167 | } |
| 159 | 168 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.h b/drivers/gpu/drm/exynos/exynos_drm_fb.h index 3ecb30d93552..50823756cdea 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.h | |||
| @@ -31,10 +31,10 @@ | |||
| 31 | static inline int exynos_drm_format_num_buffers(uint32_t format) | 31 | static inline int exynos_drm_format_num_buffers(uint32_t format) |
| 32 | { | 32 | { |
| 33 | switch (format) { | 33 | switch (format) { |
| 34 | case DRM_FORMAT_NV12M: | 34 | case DRM_FORMAT_NV12: |
| 35 | case DRM_FORMAT_NV12MT: | 35 | case DRM_FORMAT_NV12MT: |
| 36 | return 2; | 36 | return 2; |
| 37 | case DRM_FORMAT_YUV420M: | 37 | case DRM_FORMAT_YUV420: |
| 38 | return 3; | 38 | return 3; |
| 39 | default: | 39 | default: |
| 40 | return 1; | 40 | return 1; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index fc91293c4560..5c8b683029ea 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
| @@ -689,7 +689,6 @@ int exynos_drm_gem_dumb_map_offset(struct drm_file *file_priv, | |||
| 689 | struct drm_device *dev, uint32_t handle, | 689 | struct drm_device *dev, uint32_t handle, |
| 690 | uint64_t *offset) | 690 | uint64_t *offset) |
| 691 | { | 691 | { |
| 692 | struct exynos_drm_gem_obj *exynos_gem_obj; | ||
| 693 | struct drm_gem_object *obj; | 692 | struct drm_gem_object *obj; |
| 694 | int ret = 0; | 693 | int ret = 0; |
| 695 | 694 | ||
| @@ -710,15 +709,13 @@ int exynos_drm_gem_dumb_map_offset(struct drm_file *file_priv, | |||
| 710 | goto unlock; | 709 | goto unlock; |
| 711 | } | 710 | } |
| 712 | 711 | ||
| 713 | exynos_gem_obj = to_exynos_gem_obj(obj); | 712 | if (!obj->map_list.map) { |
| 714 | 713 | ret = drm_gem_create_mmap_offset(obj); | |
| 715 | if (!exynos_gem_obj->base.map_list.map) { | ||
| 716 | ret = drm_gem_create_mmap_offset(&exynos_gem_obj->base); | ||
| 717 | if (ret) | 714 | if (ret) |
| 718 | goto out; | 715 | goto out; |
| 719 | } | 716 | } |
| 720 | 717 | ||
| 721 | *offset = (u64)exynos_gem_obj->base.map_list.hash.key << PAGE_SHIFT; | 718 | *offset = (u64)obj->map_list.hash.key << PAGE_SHIFT; |
| 722 | DRM_DEBUG_KMS("offset = 0x%lx\n", (unsigned long)*offset); | 719 | DRM_DEBUG_KMS("offset = 0x%lx\n", (unsigned long)*offset); |
| 723 | 720 | ||
| 724 | out: | 721 | out: |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 68ef01028375..e2147a2ddcec 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
| @@ -365,7 +365,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
| 365 | switch (win_data->pixel_format) { | 365 | switch (win_data->pixel_format) { |
| 366 | case DRM_FORMAT_NV12MT: | 366 | case DRM_FORMAT_NV12MT: |
| 367 | tiled_mode = true; | 367 | tiled_mode = true; |
| 368 | case DRM_FORMAT_NV12M: | 368 | case DRM_FORMAT_NV12: |
| 369 | crcb_mode = false; | 369 | crcb_mode = false; |
| 370 | buf_num = 2; | 370 | buf_num = 2; |
| 371 | break; | 371 | break; |
| @@ -601,18 +601,20 @@ static void mixer_win_reset(struct mixer_context *ctx) | |||
| 601 | mixer_reg_write(res, MXR_BG_COLOR2, 0x008080); | 601 | mixer_reg_write(res, MXR_BG_COLOR2, 0x008080); |
| 602 | 602 | ||
| 603 | /* setting graphical layers */ | 603 | /* setting graphical layers */ |
| 604 | |||
| 605 | val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */ | 604 | val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */ |
| 606 | val |= MXR_GRP_CFG_WIN_BLEND_EN; | 605 | val |= MXR_GRP_CFG_WIN_BLEND_EN; |
| 606 | val |= MXR_GRP_CFG_BLEND_PRE_MUL; | ||
| 607 | val |= MXR_GRP_CFG_PIXEL_BLEND_EN; | ||
| 607 | val |= MXR_GRP_CFG_ALPHA_VAL(0xff); /* non-transparent alpha */ | 608 | val |= MXR_GRP_CFG_ALPHA_VAL(0xff); /* non-transparent alpha */ |
| 608 | 609 | ||
| 609 | /* the same configuration for both layers */ | 610 | /* the same configuration for both layers */ |
| 610 | mixer_reg_write(res, MXR_GRAPHIC_CFG(0), val); | 611 | mixer_reg_write(res, MXR_GRAPHIC_CFG(0), val); |
| 611 | |||
| 612 | val |= MXR_GRP_CFG_BLEND_PRE_MUL; | ||
| 613 | val |= MXR_GRP_CFG_PIXEL_BLEND_EN; | ||
| 614 | mixer_reg_write(res, MXR_GRAPHIC_CFG(1), val); | 612 | mixer_reg_write(res, MXR_GRAPHIC_CFG(1), val); |
| 615 | 613 | ||
| 614 | /* setting video layers */ | ||
| 615 | val = MXR_GRP_CFG_ALPHA_VAL(0); | ||
| 616 | mixer_reg_write(res, MXR_VIDEO_CFG, val); | ||
| 617 | |||
| 616 | /* configuration of Video Processor Registers */ | 618 | /* configuration of Video Processor Registers */ |
| 617 | vp_win_reset(ctx); | 619 | vp_win_reset(ctx); |
| 618 | vp_default_filter(res); | 620 | vp_default_filter(res); |
diff --git a/drivers/gpu/drm/gma500/cdv_device.c b/drivers/gpu/drm/gma500/cdv_device.c index 9764045428ce..b7e7b49d8f62 100644 --- a/drivers/gpu/drm/gma500/cdv_device.c +++ b/drivers/gpu/drm/gma500/cdv_device.c | |||
| @@ -78,21 +78,6 @@ static int cdv_backlight_combination_mode(struct drm_device *dev) | |||
| 78 | return REG_READ(BLC_PWM_CTL2) & PWM_LEGACY_MODE; | 78 | return REG_READ(BLC_PWM_CTL2) & PWM_LEGACY_MODE; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | static int cdv_get_brightness(struct backlight_device *bd) | ||
| 82 | { | ||
| 83 | struct drm_device *dev = bl_get_data(bd); | ||
| 84 | u32 val = REG_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | ||
| 85 | |||
| 86 | if (cdv_backlight_combination_mode(dev)) { | ||
| 87 | u8 lbpc; | ||
| 88 | |||
| 89 | val &= ~1; | ||
| 90 | pci_read_config_byte(dev->pdev, 0xF4, &lbpc); | ||
| 91 | val *= lbpc; | ||
| 92 | } | ||
| 93 | return val; | ||
| 94 | } | ||
| 95 | |||
| 96 | static u32 cdv_get_max_backlight(struct drm_device *dev) | 81 | static u32 cdv_get_max_backlight(struct drm_device *dev) |
| 97 | { | 82 | { |
| 98 | u32 max = REG_READ(BLC_PWM_CTL); | 83 | u32 max = REG_READ(BLC_PWM_CTL); |
| @@ -110,6 +95,22 @@ static u32 cdv_get_max_backlight(struct drm_device *dev) | |||
| 110 | return max; | 95 | return max; |
| 111 | } | 96 | } |
| 112 | 97 | ||
| 98 | static int cdv_get_brightness(struct backlight_device *bd) | ||
| 99 | { | ||
| 100 | struct drm_device *dev = bl_get_data(bd); | ||
| 101 | u32 val = REG_READ(BLC_PWM_CTL) & BACKLIGHT_DUTY_CYCLE_MASK; | ||
| 102 | |||
| 103 | if (cdv_backlight_combination_mode(dev)) { | ||
| 104 | u8 lbpc; | ||
| 105 | |||
| 106 | val &= ~1; | ||
| 107 | pci_read_config_byte(dev->pdev, 0xF4, &lbpc); | ||
| 108 | val *= lbpc; | ||
| 109 | } | ||
| 110 | return (val * 100)/cdv_get_max_backlight(dev); | ||
| 111 | |||
| 112 | } | ||
| 113 | |||
| 113 | static int cdv_set_brightness(struct backlight_device *bd) | 114 | static int cdv_set_brightness(struct backlight_device *bd) |
| 114 | { | 115 | { |
| 115 | struct drm_device *dev = bl_get_data(bd); | 116 | struct drm_device *dev = bl_get_data(bd); |
| @@ -120,6 +121,9 @@ static int cdv_set_brightness(struct backlight_device *bd) | |||
| 120 | if (level < 1) | 121 | if (level < 1) |
| 121 | level = 1; | 122 | level = 1; |
| 122 | 123 | ||
| 124 | level *= cdv_get_max_backlight(dev); | ||
| 125 | level /= 100; | ||
| 126 | |||
| 123 | if (cdv_backlight_combination_mode(dev)) { | 127 | if (cdv_backlight_combination_mode(dev)) { |
| 124 | u32 max = cdv_get_max_backlight(dev); | 128 | u32 max = cdv_get_max_backlight(dev); |
| 125 | u8 lbpc; | 129 | u8 lbpc; |
| @@ -157,7 +161,6 @@ static int cdv_backlight_init(struct drm_device *dev) | |||
| 157 | 161 | ||
| 158 | cdv_backlight_device->props.brightness = | 162 | cdv_backlight_device->props.brightness = |
| 159 | cdv_get_brightness(cdv_backlight_device); | 163 | cdv_get_brightness(cdv_backlight_device); |
| 160 | cdv_backlight_device->props.max_brightness = cdv_get_max_backlight(dev); | ||
| 161 | backlight_update_status(cdv_backlight_device); | 164 | backlight_update_status(cdv_backlight_device); |
| 162 | dev_priv->backlight_device = cdv_backlight_device; | 165 | dev_priv->backlight_device = cdv_backlight_device; |
| 163 | return 0; | 166 | return 0; |
diff --git a/drivers/gpu/drm/gma500/opregion.c b/drivers/gpu/drm/gma500/opregion.c index 4f186eca3a30..c430bd424681 100644 --- a/drivers/gpu/drm/gma500/opregion.c +++ b/drivers/gpu/drm/gma500/opregion.c | |||
| @@ -144,6 +144,8 @@ struct opregion_asle { | |||
| 144 | 144 | ||
| 145 | #define ASLE_CBLV_VALID (1<<31) | 145 | #define ASLE_CBLV_VALID (1<<31) |
| 146 | 146 | ||
| 147 | static struct psb_intel_opregion *system_opregion; | ||
| 148 | |||
| 147 | static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) | 149 | static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) |
| 148 | { | 150 | { |
| 149 | struct drm_psb_private *dev_priv = dev->dev_private; | 151 | struct drm_psb_private *dev_priv = dev->dev_private; |
| @@ -205,7 +207,7 @@ void psb_intel_opregion_enable_asle(struct drm_device *dev) | |||
| 205 | struct drm_psb_private *dev_priv = dev->dev_private; | 207 | struct drm_psb_private *dev_priv = dev->dev_private; |
| 206 | struct opregion_asle *asle = dev_priv->opregion.asle; | 208 | struct opregion_asle *asle = dev_priv->opregion.asle; |
| 207 | 209 | ||
| 208 | if (asle) { | 210 | if (asle && system_opregion ) { |
| 209 | /* Don't do this on Medfield or other non PC like devices, they | 211 | /* Don't do this on Medfield or other non PC like devices, they |
| 210 | use the bit for something different altogether */ | 212 | use the bit for something different altogether */ |
| 211 | psb_enable_pipestat(dev_priv, 0, PIPE_LEGACY_BLC_EVENT_ENABLE); | 213 | psb_enable_pipestat(dev_priv, 0, PIPE_LEGACY_BLC_EVENT_ENABLE); |
| @@ -221,7 +223,6 @@ void psb_intel_opregion_enable_asle(struct drm_device *dev) | |||
| 221 | #define ACPI_EV_LID (1<<1) | 223 | #define ACPI_EV_LID (1<<1) |
| 222 | #define ACPI_EV_DOCK (1<<2) | 224 | #define ACPI_EV_DOCK (1<<2) |
| 223 | 225 | ||
| 224 | static struct psb_intel_opregion *system_opregion; | ||
| 225 | 226 | ||
| 226 | static int psb_intel_opregion_video_event(struct notifier_block *nb, | 227 | static int psb_intel_opregion_video_event(struct notifier_block *nb, |
| 227 | unsigned long val, void *data) | 228 | unsigned long val, void *data) |
| @@ -266,9 +267,6 @@ void psb_intel_opregion_init(struct drm_device *dev) | |||
| 266 | system_opregion = opregion; | 267 | system_opregion = opregion; |
| 267 | register_acpi_notifier(&psb_intel_opregion_notifier); | 268 | register_acpi_notifier(&psb_intel_opregion_notifier); |
| 268 | } | 269 | } |
| 269 | |||
| 270 | if (opregion->asle) | ||
| 271 | psb_intel_opregion_enable_asle(dev); | ||
| 272 | } | 270 | } |
| 273 | 271 | ||
| 274 | void psb_intel_opregion_fini(struct drm_device *dev) | 272 | void psb_intel_opregion_fini(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/gma500/opregion.h b/drivers/gpu/drm/gma500/opregion.h index 72dc6b921265..4a90f8b0e16c 100644 --- a/drivers/gpu/drm/gma500/opregion.h +++ b/drivers/gpu/drm/gma500/opregion.h | |||
| @@ -27,6 +27,7 @@ extern void psb_intel_opregion_asle_intr(struct drm_device *dev); | |||
| 27 | extern void psb_intel_opregion_init(struct drm_device *dev); | 27 | extern void psb_intel_opregion_init(struct drm_device *dev); |
| 28 | extern void psb_intel_opregion_fini(struct drm_device *dev); | 28 | extern void psb_intel_opregion_fini(struct drm_device *dev); |
| 29 | extern int psb_intel_opregion_setup(struct drm_device *dev); | 29 | extern int psb_intel_opregion_setup(struct drm_device *dev); |
| 30 | extern void psb_intel_opregion_enable_asle(struct drm_device *dev); | ||
| 30 | 31 | ||
| 31 | #else | 32 | #else |
| 32 | 33 | ||
| @@ -46,4 +47,8 @@ extern inline int psb_intel_opregion_setup(struct drm_device *dev) | |||
| 46 | { | 47 | { |
| 47 | return 0; | 48 | return 0; |
| 48 | } | 49 | } |
| 50 | |||
| 51 | extern inline void psb_intel_opregion_enable_asle(struct drm_device *dev) | ||
| 52 | { | ||
| 53 | } | ||
| 49 | #endif | 54 | #endif |
diff --git a/drivers/gpu/drm/gma500/psb_device.c b/drivers/gpu/drm/gma500/psb_device.c index eff039bf92d4..5971bc82b765 100644 --- a/drivers/gpu/drm/gma500/psb_device.c +++ b/drivers/gpu/drm/gma500/psb_device.c | |||
| @@ -144,6 +144,10 @@ static int psb_backlight_init(struct drm_device *dev) | |||
| 144 | psb_backlight_device->props.max_brightness = 100; | 144 | psb_backlight_device->props.max_brightness = 100; |
| 145 | backlight_update_status(psb_backlight_device); | 145 | backlight_update_status(psb_backlight_device); |
| 146 | dev_priv->backlight_device = psb_backlight_device; | 146 | dev_priv->backlight_device = psb_backlight_device; |
| 147 | |||
| 148 | /* This must occur after the backlight is properly initialised */ | ||
| 149 | psb_lid_timer_init(dev_priv); | ||
| 150 | |||
| 147 | return 0; | 151 | return 0; |
| 148 | } | 152 | } |
| 149 | 153 | ||
| @@ -354,13 +358,6 @@ static int psb_chip_setup(struct drm_device *dev) | |||
| 354 | return 0; | 358 | return 0; |
| 355 | } | 359 | } |
| 356 | 360 | ||
| 357 | /* Not exactly an erratum more an irritation */ | ||
| 358 | static void psb_chip_errata(struct drm_device *dev) | ||
| 359 | { | ||
| 360 | struct drm_psb_private *dev_priv = dev->dev_private; | ||
| 361 | psb_lid_timer_init(dev_priv); | ||
| 362 | } | ||
| 363 | |||
| 364 | static void psb_chip_teardown(struct drm_device *dev) | 361 | static void psb_chip_teardown(struct drm_device *dev) |
| 365 | { | 362 | { |
| 366 | struct drm_psb_private *dev_priv = dev->dev_private; | 363 | struct drm_psb_private *dev_priv = dev->dev_private; |
| @@ -379,7 +376,6 @@ const struct psb_ops psb_chip_ops = { | |||
| 379 | .sgx_offset = PSB_SGX_OFFSET, | 376 | .sgx_offset = PSB_SGX_OFFSET, |
| 380 | .chip_setup = psb_chip_setup, | 377 | .chip_setup = psb_chip_setup, |
| 381 | .chip_teardown = psb_chip_teardown, | 378 | .chip_teardown = psb_chip_teardown, |
| 382 | .errata = psb_chip_errata, | ||
| 383 | 379 | ||
| 384 | .crtc_helper = &psb_intel_helper_funcs, | 380 | .crtc_helper = &psb_intel_helper_funcs, |
| 385 | .crtc_funcs = &psb_intel_crtc_funcs, | 381 | .crtc_funcs = &psb_intel_crtc_funcs, |
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c index caba6e08693c..a8858a907f47 100644 --- a/drivers/gpu/drm/gma500/psb_drv.c +++ b/drivers/gpu/drm/gma500/psb_drv.c | |||
| @@ -374,6 +374,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long chipset) | |||
| 374 | 374 | ||
| 375 | if (ret) | 375 | if (ret) |
| 376 | return ret; | 376 | return ret; |
| 377 | psb_intel_opregion_enable_asle(dev); | ||
| 377 | #if 0 | 378 | #if 0 |
| 378 | /*enable runtime pm at last*/ | 379 | /*enable runtime pm at last*/ |
| 379 | pm_runtime_enable(&dev->pdev->dev); | 380 | pm_runtime_enable(&dev->pdev->dev); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index f94792626b94..36822b924eb1 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
| @@ -1401,6 +1401,27 @@ i915_mtrr_setup(struct drm_i915_private *dev_priv, unsigned long base, | |||
| 1401 | } | 1401 | } |
| 1402 | } | 1402 | } |
| 1403 | 1403 | ||
| 1404 | static void i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv) | ||
| 1405 | { | ||
| 1406 | struct apertures_struct *ap; | ||
| 1407 | struct pci_dev *pdev = dev_priv->dev->pdev; | ||
| 1408 | bool primary; | ||
| 1409 | |||
| 1410 | ap = alloc_apertures(1); | ||
| 1411 | if (!ap) | ||
| 1412 | return; | ||
| 1413 | |||
| 1414 | ap->ranges[0].base = dev_priv->dev->agp->base; | ||
| 1415 | ap->ranges[0].size = | ||
| 1416 | dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | ||
| 1417 | primary = | ||
| 1418 | pdev->resource[PCI_ROM_RESOURCE].flags & IORESOURCE_ROM_SHADOW; | ||
| 1419 | |||
| 1420 | remove_conflicting_framebuffers(ap, "inteldrmfb", primary); | ||
| 1421 | |||
| 1422 | kfree(ap); | ||
| 1423 | } | ||
| 1424 | |||
| 1404 | /** | 1425 | /** |
| 1405 | * i915_driver_load - setup chip and create an initial config | 1426 | * i915_driver_load - setup chip and create an initial config |
| 1406 | * @dev: DRM device | 1427 | * @dev: DRM device |
| @@ -1446,6 +1467,15 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
| 1446 | goto free_priv; | 1467 | goto free_priv; |
| 1447 | } | 1468 | } |
| 1448 | 1469 | ||
| 1470 | dev_priv->mm.gtt = intel_gtt_get(); | ||
| 1471 | if (!dev_priv->mm.gtt) { | ||
| 1472 | DRM_ERROR("Failed to initialize GTT\n"); | ||
| 1473 | ret = -ENODEV; | ||
| 1474 | goto put_bridge; | ||
| 1475 | } | ||
| 1476 | |||
| 1477 | i915_kick_out_firmware_fb(dev_priv); | ||
| 1478 | |||
| 1449 | pci_set_master(dev->pdev); | 1479 | pci_set_master(dev->pdev); |
| 1450 | 1480 | ||
| 1451 | /* overlay on gen2 is broken and can't address above 1G */ | 1481 | /* overlay on gen2 is broken and can't address above 1G */ |
| @@ -1471,13 +1501,6 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
| 1471 | goto put_bridge; | 1501 | goto put_bridge; |
| 1472 | } | 1502 | } |
| 1473 | 1503 | ||
| 1474 | dev_priv->mm.gtt = intel_gtt_get(); | ||
| 1475 | if (!dev_priv->mm.gtt) { | ||
| 1476 | DRM_ERROR("Failed to initialize GTT\n"); | ||
| 1477 | ret = -ENODEV; | ||
| 1478 | goto out_rmmap; | ||
| 1479 | } | ||
| 1480 | |||
| 1481 | aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; | 1504 | aperture_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT; |
| 1482 | 1505 | ||
| 1483 | dev_priv->mm.gtt_mapping = | 1506 | dev_priv->mm.gtt_mapping = |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 238a52165833..9fe9ebe52a7a 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
| @@ -233,6 +233,7 @@ static const struct intel_device_info intel_sandybridge_d_info = { | |||
| 233 | .has_blt_ring = 1, | 233 | .has_blt_ring = 1, |
| 234 | .has_llc = 1, | 234 | .has_llc = 1, |
| 235 | .has_pch_split = 1, | 235 | .has_pch_split = 1, |
| 236 | .has_force_wake = 1, | ||
| 236 | }; | 237 | }; |
| 237 | 238 | ||
| 238 | static const struct intel_device_info intel_sandybridge_m_info = { | 239 | static const struct intel_device_info intel_sandybridge_m_info = { |
| @@ -243,6 +244,7 @@ static const struct intel_device_info intel_sandybridge_m_info = { | |||
| 243 | .has_blt_ring = 1, | 244 | .has_blt_ring = 1, |
| 244 | .has_llc = 1, | 245 | .has_llc = 1, |
| 245 | .has_pch_split = 1, | 246 | .has_pch_split = 1, |
| 247 | .has_force_wake = 1, | ||
| 246 | }; | 248 | }; |
| 247 | 249 | ||
| 248 | static const struct intel_device_info intel_ivybridge_d_info = { | 250 | static const struct intel_device_info intel_ivybridge_d_info = { |
| @@ -252,6 +254,7 @@ static const struct intel_device_info intel_ivybridge_d_info = { | |||
| 252 | .has_blt_ring = 1, | 254 | .has_blt_ring = 1, |
| 253 | .has_llc = 1, | 255 | .has_llc = 1, |
| 254 | .has_pch_split = 1, | 256 | .has_pch_split = 1, |
| 257 | .has_force_wake = 1, | ||
| 255 | }; | 258 | }; |
| 256 | 259 | ||
| 257 | static const struct intel_device_info intel_ivybridge_m_info = { | 260 | static const struct intel_device_info intel_ivybridge_m_info = { |
| @@ -262,6 +265,7 @@ static const struct intel_device_info intel_ivybridge_m_info = { | |||
| 262 | .has_blt_ring = 1, | 265 | .has_blt_ring = 1, |
| 263 | .has_llc = 1, | 266 | .has_llc = 1, |
| 264 | .has_pch_split = 1, | 267 | .has_pch_split = 1, |
| 268 | .has_force_wake = 1, | ||
| 265 | }; | 269 | }; |
| 266 | 270 | ||
| 267 | static const struct intel_device_info intel_valleyview_m_info = { | 271 | static const struct intel_device_info intel_valleyview_m_info = { |
| @@ -289,6 +293,7 @@ static const struct intel_device_info intel_haswell_d_info = { | |||
| 289 | .has_blt_ring = 1, | 293 | .has_blt_ring = 1, |
| 290 | .has_llc = 1, | 294 | .has_llc = 1, |
| 291 | .has_pch_split = 1, | 295 | .has_pch_split = 1, |
| 296 | .has_force_wake = 1, | ||
| 292 | }; | 297 | }; |
| 293 | 298 | ||
| 294 | static const struct intel_device_info intel_haswell_m_info = { | 299 | static const struct intel_device_info intel_haswell_m_info = { |
| @@ -298,6 +303,7 @@ static const struct intel_device_info intel_haswell_m_info = { | |||
| 298 | .has_blt_ring = 1, | 303 | .has_blt_ring = 1, |
| 299 | .has_llc = 1, | 304 | .has_llc = 1, |
| 300 | .has_pch_split = 1, | 305 | .has_pch_split = 1, |
| 306 | .has_force_wake = 1, | ||
| 301 | }; | 307 | }; |
| 302 | 308 | ||
| 303 | static const struct pci_device_id pciidlist[] = { /* aka */ | 309 | static const struct pci_device_id pciidlist[] = { /* aka */ |
| @@ -1139,10 +1145,9 @@ MODULE_LICENSE("GPL and additional rights"); | |||
| 1139 | 1145 | ||
| 1140 | /* We give fast paths for the really cool registers */ | 1146 | /* We give fast paths for the really cool registers */ |
| 1141 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ | 1147 | #define NEEDS_FORCE_WAKE(dev_priv, reg) \ |
| 1142 | (((dev_priv)->info->gen >= 6) && \ | 1148 | ((HAS_FORCE_WAKE((dev_priv)->dev)) && \ |
| 1143 | ((reg) < 0x40000) && \ | 1149 | ((reg) < 0x40000) && \ |
| 1144 | ((reg) != FORCEWAKE)) && \ | 1150 | ((reg) != FORCEWAKE)) |
| 1145 | (!IS_VALLEYVIEW((dev_priv)->dev)) | ||
| 1146 | 1151 | ||
| 1147 | #define __i915_read(x, y) \ | 1152 | #define __i915_read(x, y) \ |
| 1148 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ | 1153 | u##x i915_read##x(struct drm_i915_private *dev_priv, u32 reg) { \ |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c9cfc67c2cf5..b0b676abde0d 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
| @@ -285,6 +285,7 @@ struct intel_device_info { | |||
| 285 | u8 is_ivybridge:1; | 285 | u8 is_ivybridge:1; |
| 286 | u8 is_valleyview:1; | 286 | u8 is_valleyview:1; |
| 287 | u8 has_pch_split:1; | 287 | u8 has_pch_split:1; |
| 288 | u8 has_force_wake:1; | ||
| 288 | u8 is_haswell:1; | 289 | u8 is_haswell:1; |
| 289 | u8 has_fbc:1; | 290 | u8 has_fbc:1; |
| 290 | u8 has_pipe_cxsr:1; | 291 | u8 has_pipe_cxsr:1; |
| @@ -1101,6 +1102,8 @@ struct drm_i915_file_private { | |||
| 1101 | #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) | 1102 | #define HAS_PCH_CPT(dev) (INTEL_PCH_TYPE(dev) == PCH_CPT) |
| 1102 | #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) | 1103 | #define HAS_PCH_IBX(dev) (INTEL_PCH_TYPE(dev) == PCH_IBX) |
| 1103 | 1104 | ||
| 1105 | #define HAS_FORCE_WAKE(dev) (INTEL_INFO(dev)->has_force_wake) | ||
| 1106 | |||
| 1104 | #include "i915_trace.h" | 1107 | #include "i915_trace.h" |
| 1105 | 1108 | ||
| 1106 | /** | 1109 | /** |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 1417660a93ec..ed3224c37423 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
| @@ -412,7 +412,6 @@ static void gen6_queue_rps_work(struct drm_i915_private *dev_priv, | |||
| 412 | */ | 412 | */ |
| 413 | 413 | ||
| 414 | spin_lock_irqsave(&dev_priv->rps_lock, flags); | 414 | spin_lock_irqsave(&dev_priv->rps_lock, flags); |
| 415 | WARN(dev_priv->pm_iir & pm_iir, "Missed a PM interrupt\n"); | ||
| 416 | dev_priv->pm_iir |= pm_iir; | 415 | dev_priv->pm_iir |= pm_iir; |
| 417 | I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir); | 416 | I915_WRITE(GEN6_PMIMR, dev_priv->pm_iir); |
| 418 | POSTING_READ(GEN6_PMIMR); | 417 | POSTING_READ(GEN6_PMIMR); |
| @@ -510,7 +509,7 @@ out: | |||
| 510 | return ret; | 509 | return ret; |
| 511 | } | 510 | } |
| 512 | 511 | ||
| 513 | static void pch_irq_handler(struct drm_device *dev, u32 pch_iir) | 512 | static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir) |
| 514 | { | 513 | { |
| 515 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 514 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
| 516 | int pipe; | 515 | int pipe; |
| @@ -550,6 +549,35 @@ static void pch_irq_handler(struct drm_device *dev, u32 pch_iir) | |||
| 550 | DRM_DEBUG_DRIVER("PCH transcoder A underrun interrupt\n"); | 549 | DRM_DEBUG_DRIVER("PCH transcoder A underrun interrupt\n"); |
| 551 | } | 550 | } |
| 552 | 551 | ||
| 552 | static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir) | ||
| 553 | { | ||
| 554 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | ||
| 555 | int pipe; | ||
| 556 | |||
| 557 | if (pch_iir & SDE_AUDIO_POWER_MASK_CPT) | ||
| 558 | DRM_DEBUG_DRIVER("PCH audio power change on port %d\n", | ||
| 559 | (pch_iir & SDE_AUDIO_POWER_MASK_CPT) >> | ||
| 560 | SDE_AUDIO_POWER_SHIFT_CPT); | ||
| 561 | |||
| 562 | if (pch_iir & SDE_AUX_MASK_CPT) | ||
| 563 | DRM_DEBUG_DRIVER("AUX channel interrupt\n"); | ||
| 564 | |||
| 565 | if (pch_iir & SDE_GMBUS_CPT) | ||
| 566 | DRM_DEBUG_DRIVER("PCH GMBUS interrupt\n"); | ||
| 567 | |||
| 568 | if (pch_iir & SDE_AUDIO_CP_REQ_CPT) | ||
| 569 | DRM_DEBUG_DRIVER("Audio CP request interrupt\n"); | ||
| 570 | |||
| 571 | if (pch_iir & SDE_AUDIO_CP_CHG_CPT) | ||
| 572 | DRM_DEBUG_DRIVER("Audio CP change interrupt\n"); | ||
| 573 | |||
| 574 | if (pch_iir & SDE_FDI_MASK_CPT) | ||
| 575 | for_each_pipe(pipe) | ||
| 576 | DRM_DEBUG_DRIVER(" pipe %c FDI IIR: 0x%08x\n", | ||
| 577 | pipe_name(pipe), | ||
| 578 | I915_READ(FDI_RX_IIR(pipe))); | ||
| 579 | } | ||
| 580 | |||
| 553 | static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS) | 581 | static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS) |
| 554 | { | 582 | { |
| 555 | struct drm_device *dev = (struct drm_device *) arg; | 583 | struct drm_device *dev = (struct drm_device *) arg; |
| @@ -591,7 +619,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS) | |||
| 591 | 619 | ||
| 592 | if (pch_iir & SDE_HOTPLUG_MASK_CPT) | 620 | if (pch_iir & SDE_HOTPLUG_MASK_CPT) |
| 593 | queue_work(dev_priv->wq, &dev_priv->hotplug_work); | 621 | queue_work(dev_priv->wq, &dev_priv->hotplug_work); |
| 594 | pch_irq_handler(dev, pch_iir); | 622 | cpt_irq_handler(dev, pch_iir); |
| 595 | 623 | ||
| 596 | /* clear PCH hotplug event before clear CPU irq */ | 624 | /* clear PCH hotplug event before clear CPU irq */ |
| 597 | I915_WRITE(SDEIIR, pch_iir); | 625 | I915_WRITE(SDEIIR, pch_iir); |
| @@ -684,7 +712,10 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS) | |||
| 684 | if (de_iir & DE_PCH_EVENT) { | 712 | if (de_iir & DE_PCH_EVENT) { |
| 685 | if (pch_iir & hotplug_mask) | 713 | if (pch_iir & hotplug_mask) |
| 686 | queue_work(dev_priv->wq, &dev_priv->hotplug_work); | 714 | queue_work(dev_priv->wq, &dev_priv->hotplug_work); |
| 687 | pch_irq_handler(dev, pch_iir); | 715 | if (HAS_PCH_CPT(dev)) |
| 716 | cpt_irq_handler(dev, pch_iir); | ||
| 717 | else | ||
| 718 | ibx_irq_handler(dev, pch_iir); | ||
| 688 | } | 719 | } |
| 689 | 720 | ||
| 690 | if (de_iir & DE_PCU_EVENT) { | 721 | if (de_iir & DE_PCU_EVENT) { |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 2d49b9507ed0..48d5e8e051cf 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
| @@ -210,6 +210,14 @@ | |||
| 210 | #define MI_DISPLAY_FLIP MI_INSTR(0x14, 2) | 210 | #define MI_DISPLAY_FLIP MI_INSTR(0x14, 2) |
| 211 | #define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1) | 211 | #define MI_DISPLAY_FLIP_I915 MI_INSTR(0x14, 1) |
| 212 | #define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20) | 212 | #define MI_DISPLAY_FLIP_PLANE(n) ((n) << 20) |
| 213 | /* IVB has funny definitions for which plane to flip. */ | ||
| 214 | #define MI_DISPLAY_FLIP_IVB_PLANE_A (0 << 19) | ||
| 215 | #define MI_DISPLAY_FLIP_IVB_PLANE_B (1 << 19) | ||
| 216 | #define MI_DISPLAY_FLIP_IVB_SPRITE_A (2 << 19) | ||
| 217 | #define MI_DISPLAY_FLIP_IVB_SPRITE_B (3 << 19) | ||
| 218 | #define MI_DISPLAY_FLIP_IVB_PLANE_C (4 << 19) | ||
| 219 | #define MI_DISPLAY_FLIP_IVB_SPRITE_C (5 << 19) | ||
| 220 | |||
| 213 | #define MI_SET_CONTEXT MI_INSTR(0x18, 0) | 221 | #define MI_SET_CONTEXT MI_INSTR(0x18, 0) |
| 214 | #define MI_MM_SPACE_GTT (1<<8) | 222 | #define MI_MM_SPACE_GTT (1<<8) |
| 215 | #define MI_MM_SPACE_PHYSICAL (0<<8) | 223 | #define MI_MM_SPACE_PHYSICAL (0<<8) |
| @@ -3313,7 +3321,7 @@ | |||
| 3313 | 3321 | ||
| 3314 | /* PCH */ | 3322 | /* PCH */ |
| 3315 | 3323 | ||
| 3316 | /* south display engine interrupt */ | 3324 | /* south display engine interrupt: IBX */ |
| 3317 | #define SDE_AUDIO_POWER_D (1 << 27) | 3325 | #define SDE_AUDIO_POWER_D (1 << 27) |
| 3318 | #define SDE_AUDIO_POWER_C (1 << 26) | 3326 | #define SDE_AUDIO_POWER_C (1 << 26) |
| 3319 | #define SDE_AUDIO_POWER_B (1 << 25) | 3327 | #define SDE_AUDIO_POWER_B (1 << 25) |
| @@ -3349,15 +3357,44 @@ | |||
| 3349 | #define SDE_TRANSA_CRC_ERR (1 << 1) | 3357 | #define SDE_TRANSA_CRC_ERR (1 << 1) |
| 3350 | #define SDE_TRANSA_FIFO_UNDER (1 << 0) | 3358 | #define SDE_TRANSA_FIFO_UNDER (1 << 0) |
| 3351 | #define SDE_TRANS_MASK (0x3f) | 3359 | #define SDE_TRANS_MASK (0x3f) |
| 3352 | /* CPT */ | 3360 | |
| 3353 | #define SDE_CRT_HOTPLUG_CPT (1 << 19) | 3361 | /* south display engine interrupt: CPT/PPT */ |
| 3362 | #define SDE_AUDIO_POWER_D_CPT (1 << 31) | ||
| 3363 | #define SDE_AUDIO_POWER_C_CPT (1 << 30) | ||
| 3364 | #define SDE_AUDIO_POWER_B_CPT (1 << 29) | ||
| 3365 | #define SDE_AUDIO_POWER_SHIFT_CPT 29 | ||
| 3366 | #define SDE_AUDIO_POWER_MASK_CPT (7 << 29) | ||
| 3367 | #define SDE_AUXD_CPT (1 << 27) | ||
| 3368 | #define SDE_AUXC_CPT (1 << 26) | ||
| 3369 | #define SDE_AUXB_CPT (1 << 25) | ||
| 3370 | #define SDE_AUX_MASK_CPT (7 << 25) | ||
| 3354 | #define SDE_PORTD_HOTPLUG_CPT (1 << 23) | 3371 | #define SDE_PORTD_HOTPLUG_CPT (1 << 23) |
| 3355 | #define SDE_PORTC_HOTPLUG_CPT (1 << 22) | 3372 | #define SDE_PORTC_HOTPLUG_CPT (1 << 22) |
| 3356 | #define SDE_PORTB_HOTPLUG_CPT (1 << 21) | 3373 | #define SDE_PORTB_HOTPLUG_CPT (1 << 21) |
| 3374 | #define SDE_CRT_HOTPLUG_CPT (1 << 19) | ||
| 3357 | #define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \ | 3375 | #define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \ |
| 3358 | SDE_PORTD_HOTPLUG_CPT | \ | 3376 | SDE_PORTD_HOTPLUG_CPT | \ |
| 3359 | SDE_PORTC_HOTPLUG_CPT | \ | 3377 | SDE_PORTC_HOTPLUG_CPT | \ |
| 3360 | SDE_PORTB_HOTPLUG_CPT) | 3378 | SDE_PORTB_HOTPLUG_CPT) |
| 3379 | #define SDE_GMBUS_CPT (1 << 17) | ||
| 3380 | #define SDE_AUDIO_CP_REQ_C_CPT (1 << 10) | ||
| 3381 | #define SDE_AUDIO_CP_CHG_C_CPT (1 << 9) | ||
| 3382 | #define SDE_FDI_RXC_CPT (1 << 8) | ||
| 3383 | #define SDE_AUDIO_CP_REQ_B_CPT (1 << 6) | ||
| 3384 | #define SDE_AUDIO_CP_CHG_B_CPT (1 << 5) | ||
| 3385 | #define SDE_FDI_RXB_CPT (1 << 4) | ||
| 3386 | #define SDE_AUDIO_CP_REQ_A_CPT (1 << 2) | ||
| 3387 | #define SDE_AUDIO_CP_CHG_A_CPT (1 << 1) | ||
| 3388 | #define SDE_FDI_RXA_CPT (1 << 0) | ||
| 3389 | #define SDE_AUDIO_CP_REQ_CPT (SDE_AUDIO_CP_REQ_C_CPT | \ | ||
| 3390 | SDE_AUDIO_CP_REQ_B_CPT | \ | ||
| 3391 | SDE_AUDIO_CP_REQ_A_CPT) | ||
| 3392 | #define SDE_AUDIO_CP_CHG_CPT (SDE_AUDIO_CP_CHG_C_CPT | \ | ||
| 3393 | SDE_AUDIO_CP_CHG_B_CPT | \ | ||
| 3394 | SDE_AUDIO_CP_CHG_A_CPT) | ||
| 3395 | #define SDE_FDI_MASK_CPT (SDE_FDI_RXC_CPT | \ | ||
| 3396 | SDE_FDI_RXB_CPT | \ | ||
| 3397 | SDE_FDI_RXA_CPT) | ||
| 3361 | 3398 | ||
| 3362 | #define SDEISR 0xc4000 | 3399 | #define SDEISR 0xc4000 |
| 3363 | #define SDEIMR 0xc4004 | 3400 | #define SDEIMR 0xc4004 |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 0ede02a99d91..a748e5cabe14 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
| @@ -740,8 +740,11 @@ static void i915_restore_display(struct drm_device *dev) | |||
| 740 | if (HAS_PCH_SPLIT(dev)) { | 740 | if (HAS_PCH_SPLIT(dev)) { |
| 741 | I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL); | 741 | I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL); |
| 742 | I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2); | 742 | I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2); |
| 743 | I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL); | 743 | /* NOTE: BLC_PWM_CPU_CTL must be written after BLC_PWM_CPU_CTL2; |
| 744 | * otherwise we get blank eDP screen after S3 on some machines | ||
| 745 | */ | ||
| 744 | I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2); | 746 | I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2); |
| 747 | I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL); | ||
| 745 | I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); | 748 | I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); |
| 746 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | 749 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); |
| 747 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); | 750 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 914789420906..a8538ac0299d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -6158,17 +6158,34 @@ static int intel_gen7_queue_flip(struct drm_device *dev, | |||
| 6158 | struct drm_i915_private *dev_priv = dev->dev_private; | 6158 | struct drm_i915_private *dev_priv = dev->dev_private; |
| 6159 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 6159 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| 6160 | struct intel_ring_buffer *ring = &dev_priv->ring[BCS]; | 6160 | struct intel_ring_buffer *ring = &dev_priv->ring[BCS]; |
| 6161 | uint32_t plane_bit = 0; | ||
| 6161 | int ret; | 6162 | int ret; |
| 6162 | 6163 | ||
| 6163 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); | 6164 | ret = intel_pin_and_fence_fb_obj(dev, obj, ring); |
| 6164 | if (ret) | 6165 | if (ret) |
| 6165 | goto err; | 6166 | goto err; |
| 6166 | 6167 | ||
| 6168 | switch(intel_crtc->plane) { | ||
| 6169 | case PLANE_A: | ||
| 6170 | plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_A; | ||
| 6171 | break; | ||
| 6172 | case PLANE_B: | ||
| 6173 | plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_B; | ||
| 6174 | break; | ||
| 6175 | case PLANE_C: | ||
| 6176 | plane_bit = MI_DISPLAY_FLIP_IVB_PLANE_C; | ||
| 6177 | break; | ||
| 6178 | default: | ||
| 6179 | WARN_ONCE(1, "unknown plane in flip command\n"); | ||
| 6180 | ret = -ENODEV; | ||
| 6181 | goto err; | ||
| 6182 | } | ||
| 6183 | |||
| 6167 | ret = intel_ring_begin(ring, 4); | 6184 | ret = intel_ring_begin(ring, 4); |
| 6168 | if (ret) | 6185 | if (ret) |
| 6169 | goto err_unpin; | 6186 | goto err_unpin; |
| 6170 | 6187 | ||
| 6171 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | (intel_crtc->plane << 19)); | 6188 | intel_ring_emit(ring, MI_DISPLAY_FLIP_I915 | plane_bit); |
| 6172 | intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); | 6189 | intel_ring_emit(ring, (fb->pitches[0] | obj->tiling_mode)); |
| 6173 | intel_ring_emit(ring, (obj->gtt_offset)); | 6190 | intel_ring_emit(ring, (obj->gtt_offset)); |
| 6174 | intel_ring_emit(ring, (MI_NOOP)); | 6191 | intel_ring_emit(ring, (MI_NOOP)); |
| @@ -6541,7 +6558,7 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
| 6541 | if (I915_READ(HDMIC) & PORT_DETECTED) | 6558 | if (I915_READ(HDMIC) & PORT_DETECTED) |
| 6542 | intel_hdmi_init(dev, HDMIC); | 6559 | intel_hdmi_init(dev, HDMIC); |
| 6543 | 6560 | ||
| 6544 | if (I915_READ(HDMID) & PORT_DETECTED) | 6561 | if (!dpd_is_edp && I915_READ(HDMID) & PORT_DETECTED) |
| 6545 | intel_hdmi_init(dev, HDMID); | 6562 | intel_hdmi_init(dev, HDMID); |
| 6546 | 6563 | ||
| 6547 | if (I915_READ(PCH_DP_C) & DP_DETECTED) | 6564 | if (I915_READ(PCH_DP_C) & DP_DETECTED) |
| @@ -6904,19 +6921,6 @@ static void i915_disable_vga(struct drm_device *dev) | |||
| 6904 | POSTING_READ(vga_reg); | 6921 | POSTING_READ(vga_reg); |
| 6905 | } | 6922 | } |
| 6906 | 6923 | ||
| 6907 | static void ivb_pch_pwm_override(struct drm_device *dev) | ||
| 6908 | { | ||
| 6909 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 6910 | |||
| 6911 | /* | ||
| 6912 | * IVB has CPU eDP backlight regs too, set things up to let the | ||
| 6913 | * PCH regs control the backlight | ||
| 6914 | */ | ||
| 6915 | I915_WRITE(BLC_PWM_CPU_CTL2, PWM_ENABLE); | ||
| 6916 | I915_WRITE(BLC_PWM_CPU_CTL, 0); | ||
| 6917 | I915_WRITE(BLC_PWM_PCH_CTL1, PWM_ENABLE | (1<<30)); | ||
| 6918 | } | ||
| 6919 | |||
| 6920 | void intel_modeset_init_hw(struct drm_device *dev) | 6924 | void intel_modeset_init_hw(struct drm_device *dev) |
| 6921 | { | 6925 | { |
| 6922 | struct drm_i915_private *dev_priv = dev->dev_private; | 6926 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -6933,9 +6937,6 @@ void intel_modeset_init_hw(struct drm_device *dev) | |||
| 6933 | gen6_enable_rps(dev_priv); | 6937 | gen6_enable_rps(dev_priv); |
| 6934 | gen6_update_ring_freq(dev_priv); | 6938 | gen6_update_ring_freq(dev_priv); |
| 6935 | } | 6939 | } |
| 6936 | |||
| 6937 | if (IS_IVYBRIDGE(dev)) | ||
| 6938 | ivb_pch_pwm_override(dev); | ||
| 6939 | } | 6940 | } |
| 6940 | 6941 | ||
| 6941 | void intel_modeset_init(struct drm_device *dev) | 6942 | void intel_modeset_init(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 296cfc201a81..c0449324143c 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include "drm.h" | 32 | #include "drm.h" |
| 33 | #include "drm_crtc.h" | 33 | #include "drm_crtc.h" |
| 34 | #include "drm_crtc_helper.h" | 34 | #include "drm_crtc_helper.h" |
| 35 | #include "drm_edid.h" | ||
| 35 | #include "intel_drv.h" | 36 | #include "intel_drv.h" |
| 36 | #include "i915_drm.h" | 37 | #include "i915_drm.h" |
| 37 | #include "i915_drv.h" | 38 | #include "i915_drv.h" |
| @@ -67,6 +68,8 @@ struct intel_dp { | |||
| 67 | struct drm_display_mode *panel_fixed_mode; /* for eDP */ | 68 | struct drm_display_mode *panel_fixed_mode; /* for eDP */ |
| 68 | struct delayed_work panel_vdd_work; | 69 | struct delayed_work panel_vdd_work; |
| 69 | bool want_panel_vdd; | 70 | bool want_panel_vdd; |
| 71 | struct edid *edid; /* cached EDID for eDP */ | ||
| 72 | int edid_mode_count; | ||
| 70 | }; | 73 | }; |
| 71 | 74 | ||
| 72 | /** | 75 | /** |
| @@ -371,7 +374,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, | |||
| 371 | int recv_bytes; | 374 | int recv_bytes; |
| 372 | uint32_t status; | 375 | uint32_t status; |
| 373 | uint32_t aux_clock_divider; | 376 | uint32_t aux_clock_divider; |
| 374 | int try, precharge = 5; | 377 | int try, precharge; |
| 375 | 378 | ||
| 376 | intel_dp_check_edp(intel_dp); | 379 | intel_dp_check_edp(intel_dp); |
| 377 | /* The clock divider is based off the hrawclk, | 380 | /* The clock divider is based off the hrawclk, |
| @@ -391,6 +394,11 @@ intel_dp_aux_ch(struct intel_dp *intel_dp, | |||
| 391 | else | 394 | else |
| 392 | aux_clock_divider = intel_hrawclk(dev) / 2; | 395 | aux_clock_divider = intel_hrawclk(dev) / 2; |
| 393 | 396 | ||
| 397 | if (IS_GEN6(dev)) | ||
| 398 | precharge = 3; | ||
| 399 | else | ||
| 400 | precharge = 5; | ||
| 401 | |||
| 394 | /* Try to wait for any previous AUX channel activity */ | 402 | /* Try to wait for any previous AUX channel activity */ |
| 395 | for (try = 0; try < 3; try++) { | 403 | for (try = 0; try < 3; try++) { |
| 396 | status = I915_READ(ch_ctl); | 404 | status = I915_READ(ch_ctl); |
| @@ -1973,6 +1981,8 @@ intel_dp_probe_oui(struct intel_dp *intel_dp) | |||
| 1973 | if (!(intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) | 1981 | if (!(intel_dp->dpcd[DP_DOWN_STREAM_PORT_COUNT] & DP_OUI_SUPPORT)) |
| 1974 | return; | 1982 | return; |
| 1975 | 1983 | ||
| 1984 | ironlake_edp_panel_vdd_on(intel_dp); | ||
| 1985 | |||
| 1976 | if (intel_dp_aux_native_read_retry(intel_dp, DP_SINK_OUI, buf, 3)) | 1986 | if (intel_dp_aux_native_read_retry(intel_dp, DP_SINK_OUI, buf, 3)) |
| 1977 | DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", | 1987 | DRM_DEBUG_KMS("Sink OUI: %02hx%02hx%02hx\n", |
| 1978 | buf[0], buf[1], buf[2]); | 1988 | buf[0], buf[1], buf[2]); |
| @@ -1980,6 +1990,8 @@ intel_dp_probe_oui(struct intel_dp *intel_dp) | |||
| 1980 | if (intel_dp_aux_native_read_retry(intel_dp, DP_BRANCH_OUI, buf, 3)) | 1990 | if (intel_dp_aux_native_read_retry(intel_dp, DP_BRANCH_OUI, buf, 3)) |
| 1981 | DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", | 1991 | DRM_DEBUG_KMS("Branch OUI: %02hx%02hx%02hx\n", |
| 1982 | buf[0], buf[1], buf[2]); | 1992 | buf[0], buf[1], buf[2]); |
| 1993 | |||
| 1994 | ironlake_edp_panel_vdd_off(intel_dp, false); | ||
| 1983 | } | 1995 | } |
| 1984 | 1996 | ||
| 1985 | static bool | 1997 | static bool |
| @@ -2116,10 +2128,22 @@ intel_dp_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) | |||
| 2116 | { | 2128 | { |
| 2117 | struct intel_dp *intel_dp = intel_attached_dp(connector); | 2129 | struct intel_dp *intel_dp = intel_attached_dp(connector); |
| 2118 | struct edid *edid; | 2130 | struct edid *edid; |
| 2131 | int size; | ||
| 2132 | |||
| 2133 | if (is_edp(intel_dp)) { | ||
| 2134 | if (!intel_dp->edid) | ||
| 2135 | return NULL; | ||
| 2136 | |||
| 2137 | size = (intel_dp->edid->extensions + 1) * EDID_LENGTH; | ||
| 2138 | edid = kmalloc(size, GFP_KERNEL); | ||
| 2139 | if (!edid) | ||
| 2140 | return NULL; | ||
| 2141 | |||
| 2142 | memcpy(edid, intel_dp->edid, size); | ||
| 2143 | return edid; | ||
| 2144 | } | ||
| 2119 | 2145 | ||
| 2120 | ironlake_edp_panel_vdd_on(intel_dp); | ||
| 2121 | edid = drm_get_edid(connector, adapter); | 2146 | edid = drm_get_edid(connector, adapter); |
| 2122 | ironlake_edp_panel_vdd_off(intel_dp, false); | ||
| 2123 | return edid; | 2147 | return edid; |
| 2124 | } | 2148 | } |
| 2125 | 2149 | ||
| @@ -2129,9 +2153,17 @@ intel_dp_get_edid_modes(struct drm_connector *connector, struct i2c_adapter *ada | |||
| 2129 | struct intel_dp *intel_dp = intel_attached_dp(connector); | 2153 | struct intel_dp *intel_dp = intel_attached_dp(connector); |
| 2130 | int ret; | 2154 | int ret; |
| 2131 | 2155 | ||
| 2132 | ironlake_edp_panel_vdd_on(intel_dp); | 2156 | if (is_edp(intel_dp)) { |
| 2157 | drm_mode_connector_update_edid_property(connector, | ||
| 2158 | intel_dp->edid); | ||
| 2159 | ret = drm_add_edid_modes(connector, intel_dp->edid); | ||
| 2160 | drm_edid_to_eld(connector, | ||
| 2161 | intel_dp->edid); | ||
| 2162 | connector->display_info.raw_edid = NULL; | ||
| 2163 | return intel_dp->edid_mode_count; | ||
| 2164 | } | ||
| 2165 | |||
| 2133 | ret = intel_ddc_get_modes(connector, adapter); | 2166 | ret = intel_ddc_get_modes(connector, adapter); |
| 2134 | ironlake_edp_panel_vdd_off(intel_dp, false); | ||
| 2135 | return ret; | 2167 | return ret; |
| 2136 | } | 2168 | } |
| 2137 | 2169 | ||
| @@ -2321,6 +2353,7 @@ static void intel_dp_encoder_destroy(struct drm_encoder *encoder) | |||
| 2321 | i2c_del_adapter(&intel_dp->adapter); | 2353 | i2c_del_adapter(&intel_dp->adapter); |
| 2322 | drm_encoder_cleanup(encoder); | 2354 | drm_encoder_cleanup(encoder); |
| 2323 | if (is_edp(intel_dp)) { | 2355 | if (is_edp(intel_dp)) { |
| 2356 | kfree(intel_dp->edid); | ||
| 2324 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); | 2357 | cancel_delayed_work_sync(&intel_dp->panel_vdd_work); |
| 2325 | ironlake_panel_vdd_off_sync(intel_dp); | 2358 | ironlake_panel_vdd_off_sync(intel_dp); |
| 2326 | } | 2359 | } |
| @@ -2504,11 +2537,14 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
| 2504 | break; | 2537 | break; |
| 2505 | } | 2538 | } |
| 2506 | 2539 | ||
| 2540 | intel_dp_i2c_init(intel_dp, intel_connector, name); | ||
| 2541 | |||
| 2507 | /* Cache some DPCD data in the eDP case */ | 2542 | /* Cache some DPCD data in the eDP case */ |
| 2508 | if (is_edp(intel_dp)) { | 2543 | if (is_edp(intel_dp)) { |
| 2509 | bool ret; | 2544 | bool ret; |
| 2510 | struct edp_power_seq cur, vbt; | 2545 | struct edp_power_seq cur, vbt; |
| 2511 | u32 pp_on, pp_off, pp_div; | 2546 | u32 pp_on, pp_off, pp_div; |
| 2547 | struct edid *edid; | ||
| 2512 | 2548 | ||
| 2513 | pp_on = I915_READ(PCH_PP_ON_DELAYS); | 2549 | pp_on = I915_READ(PCH_PP_ON_DELAYS); |
| 2514 | pp_off = I915_READ(PCH_PP_OFF_DELAYS); | 2550 | pp_off = I915_READ(PCH_PP_OFF_DELAYS); |
| @@ -2576,9 +2612,19 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
| 2576 | intel_dp_destroy(&intel_connector->base); | 2612 | intel_dp_destroy(&intel_connector->base); |
| 2577 | return; | 2613 | return; |
| 2578 | } | 2614 | } |
| 2579 | } | ||
| 2580 | 2615 | ||
| 2581 | intel_dp_i2c_init(intel_dp, intel_connector, name); | 2616 | ironlake_edp_panel_vdd_on(intel_dp); |
| 2617 | edid = drm_get_edid(connector, &intel_dp->adapter); | ||
| 2618 | if (edid) { | ||
| 2619 | drm_mode_connector_update_edid_property(connector, | ||
| 2620 | edid); | ||
| 2621 | intel_dp->edid_mode_count = | ||
| 2622 | drm_add_edid_modes(connector, edid); | ||
| 2623 | drm_edid_to_eld(connector, edid); | ||
| 2624 | intel_dp->edid = edid; | ||
| 2625 | } | ||
| 2626 | ironlake_edp_panel_vdd_off(intel_dp, false); | ||
| 2627 | } | ||
| 2582 | 2628 | ||
| 2583 | intel_encoder->hot_plug = intel_dp_hot_plug; | 2629 | intel_encoder->hot_plug = intel_dp_hot_plug; |
| 2584 | 2630 | ||
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index b59b6d5b7583..e5b84ff89ca5 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
| @@ -266,10 +266,15 @@ u32 intel_ring_get_active_head(struct intel_ring_buffer *ring) | |||
| 266 | 266 | ||
| 267 | static int init_ring_common(struct intel_ring_buffer *ring) | 267 | static int init_ring_common(struct intel_ring_buffer *ring) |
| 268 | { | 268 | { |
| 269 | drm_i915_private_t *dev_priv = ring->dev->dev_private; | 269 | struct drm_device *dev = ring->dev; |
| 270 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
| 270 | struct drm_i915_gem_object *obj = ring->obj; | 271 | struct drm_i915_gem_object *obj = ring->obj; |
| 272 | int ret = 0; | ||
| 271 | u32 head; | 273 | u32 head; |
| 272 | 274 | ||
| 275 | if (HAS_FORCE_WAKE(dev)) | ||
| 276 | gen6_gt_force_wake_get(dev_priv); | ||
| 277 | |||
| 273 | /* Stop the ring if it's running. */ | 278 | /* Stop the ring if it's running. */ |
| 274 | I915_WRITE_CTL(ring, 0); | 279 | I915_WRITE_CTL(ring, 0); |
| 275 | I915_WRITE_HEAD(ring, 0); | 280 | I915_WRITE_HEAD(ring, 0); |
| @@ -317,7 +322,8 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
| 317 | I915_READ_HEAD(ring), | 322 | I915_READ_HEAD(ring), |
| 318 | I915_READ_TAIL(ring), | 323 | I915_READ_TAIL(ring), |
| 319 | I915_READ_START(ring)); | 324 | I915_READ_START(ring)); |
| 320 | return -EIO; | 325 | ret = -EIO; |
| 326 | goto out; | ||
| 321 | } | 327 | } |
| 322 | 328 | ||
| 323 | if (!drm_core_check_feature(ring->dev, DRIVER_MODESET)) | 329 | if (!drm_core_check_feature(ring->dev, DRIVER_MODESET)) |
| @@ -326,9 +332,14 @@ static int init_ring_common(struct intel_ring_buffer *ring) | |||
| 326 | ring->head = I915_READ_HEAD(ring); | 332 | ring->head = I915_READ_HEAD(ring); |
| 327 | ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR; | 333 | ring->tail = I915_READ_TAIL(ring) & TAIL_ADDR; |
| 328 | ring->space = ring_space(ring); | 334 | ring->space = ring_space(ring); |
| 335 | ring->last_retired_head = -1; | ||
| 329 | } | 336 | } |
| 330 | 337 | ||
| 331 | return 0; | 338 | out: |
| 339 | if (HAS_FORCE_WAKE(dev)) | ||
| 340 | gen6_gt_force_wake_put(dev_priv); | ||
| 341 | |||
| 342 | return ret; | ||
| 332 | } | 343 | } |
| 333 | 344 | ||
| 334 | static int | 345 | static int |
| @@ -987,6 +998,10 @@ static int intel_init_ring_buffer(struct drm_device *dev, | |||
| 987 | if (ret) | 998 | if (ret) |
| 988 | goto err_unref; | 999 | goto err_unref; |
| 989 | 1000 | ||
| 1001 | ret = i915_gem_object_set_to_gtt_domain(obj, true); | ||
| 1002 | if (ret) | ||
| 1003 | goto err_unpin; | ||
| 1004 | |||
| 990 | ring->virtual_start = ioremap_wc(dev->agp->base + obj->gtt_offset, | 1005 | ring->virtual_start = ioremap_wc(dev->agp->base + obj->gtt_offset, |
| 991 | ring->size); | 1006 | ring->size); |
| 992 | if (ring->virtual_start == NULL) { | 1007 | if (ring->virtual_start == NULL) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 153b9a15469b..1074bc5dd418 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
| @@ -467,7 +467,7 @@ int nouveau_fbcon_init(struct drm_device *dev) | |||
| 467 | nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; | 467 | nfbdev->helper.funcs = &nouveau_fbcon_helper_funcs; |
| 468 | 468 | ||
| 469 | ret = drm_fb_helper_init(dev, &nfbdev->helper, | 469 | ret = drm_fb_helper_init(dev, &nfbdev->helper, |
| 470 | nv_two_heads(dev) ? 2 : 1, 4); | 470 | dev->mode_config.num_crtc, 4); |
| 471 | if (ret) { | 471 | if (ret) { |
| 472 | kfree(nfbdev); | 472 | kfree(nfbdev); |
| 473 | return ret; | 473 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c index a89240e5fb29..a25cf2cb931f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c | |||
| @@ -1,3 +1,26 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2011 Red Hat Inc. | ||
| 3 | * | ||
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 5 | * copy of this software and associated documentation files (the "Software"), | ||
| 6 | * to deal in the Software without restriction, including without limitation | ||
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 9 | * Software is furnished to do so, subject to the following conditions: | ||
| 10 | * | ||
| 11 | * The above copyright notice and this permission notice shall be included in | ||
| 12 | * all copies or substantial portions of the Software. | ||
| 13 | * | ||
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| 20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
| 21 | * | ||
| 22 | * Authors: Dave Airlie | ||
| 23 | */ | ||
| 1 | 24 | ||
| 2 | #include "drmP.h" | 25 | #include "drmP.h" |
| 3 | #include "drm.h" | 26 | #include "drm.h" |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 01d77d1554f4..3904d7964a4b 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -1149,7 +1149,9 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1149 | } | 1149 | } |
| 1150 | 1150 | ||
| 1151 | if (tiling_flags & RADEON_TILING_MACRO) { | 1151 | if (tiling_flags & RADEON_TILING_MACRO) { |
| 1152 | if (rdev->family >= CHIP_CAYMAN) | 1152 | if (rdev->family >= CHIP_TAHITI) |
| 1153 | tmp = rdev->config.si.tile_config; | ||
| 1154 | else if (rdev->family >= CHIP_CAYMAN) | ||
| 1153 | tmp = rdev->config.cayman.tile_config; | 1155 | tmp = rdev->config.cayman.tile_config; |
| 1154 | else | 1156 | else |
| 1155 | tmp = rdev->config.evergreen.tile_config; | 1157 | tmp = rdev->config.evergreen.tile_config; |
| @@ -1177,6 +1179,12 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc, | |||
| 1177 | } else if (tiling_flags & RADEON_TILING_MICRO) | 1179 | } else if (tiling_flags & RADEON_TILING_MICRO) |
| 1178 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); | 1180 | fb_format |= EVERGREEN_GRPH_ARRAY_MODE(EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1); |
| 1179 | 1181 | ||
| 1182 | if ((rdev->family == CHIP_TAHITI) || | ||
| 1183 | (rdev->family == CHIP_PITCAIRN)) | ||
| 1184 | fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P8_32x32_8x16); | ||
| 1185 | else if (rdev->family == CHIP_VERDE) | ||
| 1186 | fb_format |= SI_GRPH_PIPE_CONFIG(SI_ADDR_SURF_P4_8x16); | ||
| 1187 | |||
| 1180 | switch (radeon_crtc->crtc_id) { | 1188 | switch (radeon_crtc->crtc_id) { |
| 1181 | case 0: | 1189 | case 0: |
| 1182 | WREG32(AVIVO_D1VGA_CONTROL, 0); | 1190 | WREG32(AVIVO_D1VGA_CONTROL, 0); |
diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index e7b1ec5ae8c6..486ccdf4aacd 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
| @@ -1926,7 +1926,9 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder, | |||
| 1926 | 1926 | ||
| 1927 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { | 1927 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) { |
| 1928 | r600_hdmi_enable(encoder); | 1928 | r600_hdmi_enable(encoder); |
| 1929 | if (ASIC_IS_DCE4(rdev)) | 1929 | if (ASIC_IS_DCE6(rdev)) |
| 1930 | ; /* TODO (use pointers instead of if-s?) */ | ||
| 1931 | else if (ASIC_IS_DCE4(rdev)) | ||
| 1930 | evergreen_hdmi_setmode(encoder, adjusted_mode); | 1932 | evergreen_hdmi_setmode(encoder, adjusted_mode); |
| 1931 | else | 1933 | else |
| 1932 | r600_hdmi_setmode(encoder, adjusted_mode); | 1934 | r600_hdmi_setmode(encoder, adjusted_mode); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 01550d05e273..7fb3d2e0434c 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -1932,6 +1932,9 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
| 1932 | smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets); | 1932 | smx_dc_ctl0 |= NUMBER_OF_SETS(rdev->config.evergreen.sx_num_of_sets); |
| 1933 | WREG32(SMX_DC_CTL0, smx_dc_ctl0); | 1933 | WREG32(SMX_DC_CTL0, smx_dc_ctl0); |
| 1934 | 1934 | ||
| 1935 | if (rdev->family <= CHIP_SUMO2) | ||
| 1936 | WREG32(SMX_SAR_CTL0, 0x00010000); | ||
| 1937 | |||
| 1935 | WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) | | 1938 | WREG32(SX_EXPORT_BUFFER_SIZES, (COLOR_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_size / 4) - 1) | |
| 1936 | POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) | | 1939 | POSITION_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_pos_size / 4) - 1) | |
| 1937 | SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1))); | 1940 | SMX_BUFFER_SIZE((rdev->config.evergreen.sx_max_export_smx_size / 4) - 1))); |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 4e7dd2b4843d..c16554122ccd 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
| @@ -52,6 +52,7 @@ struct evergreen_cs_track { | |||
| 52 | u32 cb_color_view[12]; | 52 | u32 cb_color_view[12]; |
| 53 | u32 cb_color_pitch[12]; | 53 | u32 cb_color_pitch[12]; |
| 54 | u32 cb_color_slice[12]; | 54 | u32 cb_color_slice[12]; |
| 55 | u32 cb_color_slice_idx[12]; | ||
| 55 | u32 cb_color_attrib[12]; | 56 | u32 cb_color_attrib[12]; |
| 56 | u32 cb_color_cmask_slice[8];/* unused */ | 57 | u32 cb_color_cmask_slice[8];/* unused */ |
| 57 | u32 cb_color_fmask_slice[8];/* unused */ | 58 | u32 cb_color_fmask_slice[8];/* unused */ |
| @@ -127,12 +128,14 @@ static void evergreen_cs_track_init(struct evergreen_cs_track *track) | |||
| 127 | track->cb_color_info[i] = 0; | 128 | track->cb_color_info[i] = 0; |
| 128 | track->cb_color_view[i] = 0xFFFFFFFF; | 129 | track->cb_color_view[i] = 0xFFFFFFFF; |
| 129 | track->cb_color_pitch[i] = 0; | 130 | track->cb_color_pitch[i] = 0; |
| 130 | track->cb_color_slice[i] = 0; | 131 | track->cb_color_slice[i] = 0xfffffff; |
| 132 | track->cb_color_slice_idx[i] = 0; | ||
| 131 | } | 133 | } |
| 132 | track->cb_target_mask = 0xFFFFFFFF; | 134 | track->cb_target_mask = 0xFFFFFFFF; |
| 133 | track->cb_shader_mask = 0xFFFFFFFF; | 135 | track->cb_shader_mask = 0xFFFFFFFF; |
| 134 | track->cb_dirty = true; | 136 | track->cb_dirty = true; |
| 135 | 137 | ||
| 138 | track->db_depth_slice = 0xffffffff; | ||
| 136 | track->db_depth_view = 0xFFFFC000; | 139 | track->db_depth_view = 0xFFFFC000; |
| 137 | track->db_depth_size = 0xFFFFFFFF; | 140 | track->db_depth_size = 0xFFFFFFFF; |
| 138 | track->db_depth_control = 0xFFFFFFFF; | 141 | track->db_depth_control = 0xFFFFFFFF; |
| @@ -250,10 +253,9 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p, | |||
| 250 | { | 253 | { |
| 251 | struct evergreen_cs_track *track = p->track; | 254 | struct evergreen_cs_track *track = p->track; |
| 252 | unsigned palign, halign, tileb, slice_pt; | 255 | unsigned palign, halign, tileb, slice_pt; |
| 256 | unsigned mtile_pr, mtile_ps, mtileb; | ||
| 253 | 257 | ||
| 254 | tileb = 64 * surf->bpe * surf->nsamples; | 258 | tileb = 64 * surf->bpe * surf->nsamples; |
| 255 | palign = track->group_size / (8 * surf->bpe * surf->nsamples); | ||
| 256 | palign = MAX(8, palign); | ||
| 257 | slice_pt = 1; | 259 | slice_pt = 1; |
| 258 | if (tileb > surf->tsplit) { | 260 | if (tileb > surf->tsplit) { |
| 259 | slice_pt = tileb / surf->tsplit; | 261 | slice_pt = tileb / surf->tsplit; |
| @@ -262,7 +264,10 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p, | |||
| 262 | /* macro tile width & height */ | 264 | /* macro tile width & height */ |
| 263 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; | 265 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; |
| 264 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; | 266 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; |
| 265 | surf->layer_size = surf->nbx * surf->nby * surf->bpe * slice_pt; | 267 | mtileb = (palign / 8) * (halign / 8) * tileb;; |
| 268 | mtile_pr = surf->nbx / palign; | ||
| 269 | mtile_ps = (mtile_pr * surf->nby) / halign; | ||
| 270 | surf->layer_size = mtile_ps * mtileb * slice_pt; | ||
| 266 | surf->base_align = (palign / 8) * (halign / 8) * tileb; | 271 | surf->base_align = (palign / 8) * (halign / 8) * tileb; |
| 267 | surf->palign = palign; | 272 | surf->palign = palign; |
| 268 | surf->halign = halign; | 273 | surf->halign = halign; |
| @@ -434,6 +439,39 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i | |||
| 434 | 439 | ||
| 435 | offset += surf.layer_size * mslice; | 440 | offset += surf.layer_size * mslice; |
| 436 | if (offset > radeon_bo_size(track->cb_color_bo[id])) { | 441 | if (offset > radeon_bo_size(track->cb_color_bo[id])) { |
| 442 | /* old ddx are broken they allocate bo with w*h*bpp but | ||
| 443 | * program slice with ALIGN(h, 8), catch this and patch | ||
| 444 | * command stream. | ||
| 445 | */ | ||
| 446 | if (!surf.mode) { | ||
| 447 | volatile u32 *ib = p->ib.ptr; | ||
| 448 | unsigned long tmp, nby, bsize, size, min = 0; | ||
| 449 | |||
| 450 | /* find the height the ddx wants */ | ||
| 451 | if (surf.nby > 8) { | ||
| 452 | min = surf.nby - 8; | ||
| 453 | } | ||
| 454 | bsize = radeon_bo_size(track->cb_color_bo[id]); | ||
| 455 | tmp = track->cb_color_bo_offset[id] << 8; | ||
| 456 | for (nby = surf.nby; nby > min; nby--) { | ||
| 457 | size = nby * surf.nbx * surf.bpe * surf.nsamples; | ||
| 458 | if ((tmp + size * mslice) <= bsize) { | ||
| 459 | break; | ||
| 460 | } | ||
| 461 | } | ||
| 462 | if (nby > min) { | ||
| 463 | surf.nby = nby; | ||
| 464 | slice = ((nby * surf.nbx) / 64) - 1; | ||
| 465 | if (!evergreen_surface_check(p, &surf, "cb")) { | ||
| 466 | /* check if this one works */ | ||
| 467 | tmp += surf.layer_size * mslice; | ||
| 468 | if (tmp <= bsize) { | ||
| 469 | ib[track->cb_color_slice_idx[id]] = slice; | ||
| 470 | goto old_ddx_ok; | ||
| 471 | } | ||
| 472 | } | ||
| 473 | } | ||
| 474 | } | ||
| 437 | dev_warn(p->dev, "%s:%d cb[%d] bo too small (layer size %d, " | 475 | dev_warn(p->dev, "%s:%d cb[%d] bo too small (layer size %d, " |
| 438 | "offset %d, max layer %d, bo size %ld, slice %d)\n", | 476 | "offset %d, max layer %d, bo size %ld, slice %d)\n", |
| 439 | __func__, __LINE__, id, surf.layer_size, | 477 | __func__, __LINE__, id, surf.layer_size, |
| @@ -446,6 +484,7 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i | |||
| 446 | surf.tsplit, surf.mtilea); | 484 | surf.tsplit, surf.mtilea); |
| 447 | return -EINVAL; | 485 | return -EINVAL; |
| 448 | } | 486 | } |
| 487 | old_ddx_ok: | ||
| 449 | 488 | ||
| 450 | return 0; | 489 | return 0; |
| 451 | } | 490 | } |
| @@ -1532,6 +1571,7 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 1532 | case CB_COLOR7_SLICE: | 1571 | case CB_COLOR7_SLICE: |
| 1533 | tmp = (reg - CB_COLOR0_SLICE) / 0x3c; | 1572 | tmp = (reg - CB_COLOR0_SLICE) / 0x3c; |
| 1534 | track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx); | 1573 | track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx); |
| 1574 | track->cb_color_slice_idx[tmp] = idx; | ||
| 1535 | track->cb_dirty = true; | 1575 | track->cb_dirty = true; |
| 1536 | break; | 1576 | break; |
| 1537 | case CB_COLOR8_SLICE: | 1577 | case CB_COLOR8_SLICE: |
| @@ -1540,6 +1580,7 @@ static int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx) | |||
| 1540 | case CB_COLOR11_SLICE: | 1580 | case CB_COLOR11_SLICE: |
| 1541 | tmp = ((reg - CB_COLOR8_SLICE) / 0x1c) + 8; | 1581 | tmp = ((reg - CB_COLOR8_SLICE) / 0x1c) + 8; |
| 1542 | track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx); | 1582 | track->cb_color_slice[tmp] = radeon_get_ib_value(p, idx); |
| 1583 | track->cb_color_slice_idx[tmp] = idx; | ||
| 1543 | track->cb_dirty = true; | 1584 | track->cb_dirty = true; |
| 1544 | break; | 1585 | break; |
| 1545 | case CB_COLOR0_ATTRIB: | 1586 | case CB_COLOR0_ATTRIB: |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index a51f880985f8..65c54160028b 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
| @@ -156,9 +156,6 @@ void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode | |||
| 156 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 156 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
| 157 | uint32_t offset; | 157 | uint32_t offset; |
| 158 | 158 | ||
| 159 | if (ASIC_IS_DCE5(rdev)) | ||
| 160 | return; | ||
| 161 | |||
| 162 | /* Silent, r600_hdmi_enable will raise WARN for us */ | 159 | /* Silent, r600_hdmi_enable will raise WARN for us */ |
| 163 | if (!dig->afmt->enabled) | 160 | if (!dig->afmt->enabled) |
| 164 | return; | 161 | return; |
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index 2773039b4902..b50b15c70498 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
| @@ -503,6 +503,7 @@ | |||
| 503 | #define SCRATCH_UMSK 0x8540 | 503 | #define SCRATCH_UMSK 0x8540 |
| 504 | #define SCRATCH_ADDR 0x8544 | 504 | #define SCRATCH_ADDR 0x8544 |
| 505 | 505 | ||
| 506 | #define SMX_SAR_CTL0 0xA008 | ||
| 506 | #define SMX_DC_CTL0 0xA020 | 507 | #define SMX_DC_CTL0 0xA020 |
| 507 | #define USE_HASH_FUNCTION (1 << 0) | 508 | #define USE_HASH_FUNCTION (1 << 0) |
| 508 | #define NUMBER_OF_SETS(x) ((x) << 1) | 509 | #define NUMBER_OF_SETS(x) ((x) << 1) |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index 3df4efa11942..b7bf18e40215 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
| @@ -460,15 +460,28 @@ static void cayman_gpu_init(struct radeon_device *rdev) | |||
| 460 | rdev->config.cayman.max_pipes_per_simd = 4; | 460 | rdev->config.cayman.max_pipes_per_simd = 4; |
| 461 | rdev->config.cayman.max_tile_pipes = 2; | 461 | rdev->config.cayman.max_tile_pipes = 2; |
| 462 | if ((rdev->pdev->device == 0x9900) || | 462 | if ((rdev->pdev->device == 0x9900) || |
| 463 | (rdev->pdev->device == 0x9901)) { | 463 | (rdev->pdev->device == 0x9901) || |
| 464 | (rdev->pdev->device == 0x9905) || | ||
| 465 | (rdev->pdev->device == 0x9906) || | ||
| 466 | (rdev->pdev->device == 0x9907) || | ||
| 467 | (rdev->pdev->device == 0x9908) || | ||
| 468 | (rdev->pdev->device == 0x9909) || | ||
| 469 | (rdev->pdev->device == 0x9910) || | ||
| 470 | (rdev->pdev->device == 0x9917)) { | ||
| 464 | rdev->config.cayman.max_simds_per_se = 6; | 471 | rdev->config.cayman.max_simds_per_se = 6; |
| 465 | rdev->config.cayman.max_backends_per_se = 2; | 472 | rdev->config.cayman.max_backends_per_se = 2; |
| 466 | } else if ((rdev->pdev->device == 0x9903) || | 473 | } else if ((rdev->pdev->device == 0x9903) || |
| 467 | (rdev->pdev->device == 0x9904)) { | 474 | (rdev->pdev->device == 0x9904) || |
| 475 | (rdev->pdev->device == 0x990A) || | ||
| 476 | (rdev->pdev->device == 0x9913) || | ||
| 477 | (rdev->pdev->device == 0x9918)) { | ||
| 468 | rdev->config.cayman.max_simds_per_se = 4; | 478 | rdev->config.cayman.max_simds_per_se = 4; |
| 469 | rdev->config.cayman.max_backends_per_se = 2; | 479 | rdev->config.cayman.max_backends_per_se = 2; |
| 470 | } else if ((rdev->pdev->device == 0x9990) || | 480 | } else if ((rdev->pdev->device == 0x9919) || |
| 471 | (rdev->pdev->device == 0x9991)) { | 481 | (rdev->pdev->device == 0x9990) || |
| 482 | (rdev->pdev->device == 0x9991) || | ||
| 483 | (rdev->pdev->device == 0x9994) || | ||
| 484 | (rdev->pdev->device == 0x99A0)) { | ||
| 472 | rdev->config.cayman.max_simds_per_se = 3; | 485 | rdev->config.cayman.max_simds_per_se = 3; |
| 473 | rdev->config.cayman.max_backends_per_se = 1; | 486 | rdev->config.cayman.max_backends_per_se = 1; |
| 474 | } else { | 487 | } else { |
| @@ -1290,6 +1303,10 @@ static int cayman_startup(struct radeon_device *rdev) | |||
| 1290 | if (r) | 1303 | if (r) |
| 1291 | return r; | 1304 | return r; |
| 1292 | 1305 | ||
| 1306 | r = r600_audio_init(rdev); | ||
| 1307 | if (r) | ||
| 1308 | return r; | ||
| 1309 | |||
| 1293 | return 0; | 1310 | return 0; |
| 1294 | } | 1311 | } |
| 1295 | 1312 | ||
| @@ -1316,6 +1333,7 @@ int cayman_resume(struct radeon_device *rdev) | |||
| 1316 | 1333 | ||
| 1317 | int cayman_suspend(struct radeon_device *rdev) | 1334 | int cayman_suspend(struct radeon_device *rdev) |
| 1318 | { | 1335 | { |
| 1336 | r600_audio_fini(rdev); | ||
| 1319 | /* FIXME: we should wait for ring to be empty */ | 1337 | /* FIXME: we should wait for ring to be empty */ |
| 1320 | radeon_ib_pool_suspend(rdev); | 1338 | radeon_ib_pool_suspend(rdev); |
| 1321 | radeon_vm_manager_suspend(rdev); | 1339 | radeon_vm_manager_suspend(rdev); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 45cfcea63507..bff627293812 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -1839,6 +1839,7 @@ void r600_gpu_init(struct radeon_device *rdev) | |||
| 1839 | WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA | | 1839 | WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA | |
| 1840 | NUM_CLIP_SEQ(3))); | 1840 | NUM_CLIP_SEQ(3))); |
| 1841 | WREG32(PA_SC_ENHANCE, FORCE_EOV_MAX_CLK_CNT(4095)); | 1841 | WREG32(PA_SC_ENHANCE, FORCE_EOV_MAX_CLK_CNT(4095)); |
| 1842 | WREG32(VC_ENHANCE, 0); | ||
| 1842 | } | 1843 | } |
| 1843 | 1844 | ||
| 1844 | 1845 | ||
| @@ -2426,6 +2427,12 @@ int r600_startup(struct radeon_device *rdev) | |||
| 2426 | if (r) | 2427 | if (r) |
| 2427 | return r; | 2428 | return r; |
| 2428 | 2429 | ||
| 2430 | r = r600_audio_init(rdev); | ||
| 2431 | if (r) { | ||
| 2432 | DRM_ERROR("radeon: audio init failed\n"); | ||
| 2433 | return r; | ||
| 2434 | } | ||
| 2435 | |||
| 2429 | return 0; | 2436 | return 0; |
| 2430 | } | 2437 | } |
| 2431 | 2438 | ||
| @@ -2462,12 +2469,6 @@ int r600_resume(struct radeon_device *rdev) | |||
| 2462 | return r; | 2469 | return r; |
| 2463 | } | 2470 | } |
| 2464 | 2471 | ||
| 2465 | r = r600_audio_init(rdev); | ||
| 2466 | if (r) { | ||
| 2467 | DRM_ERROR("radeon: audio resume failed\n"); | ||
| 2468 | return r; | ||
| 2469 | } | ||
| 2470 | |||
| 2471 | return r; | 2472 | return r; |
| 2472 | } | 2473 | } |
| 2473 | 2474 | ||
| @@ -2577,9 +2578,6 @@ int r600_init(struct radeon_device *rdev) | |||
| 2577 | rdev->accel_working = false; | 2578 | rdev->accel_working = false; |
| 2578 | } | 2579 | } |
| 2579 | 2580 | ||
| 2580 | r = r600_audio_init(rdev); | ||
| 2581 | if (r) | ||
| 2582 | return r; /* TODO error handling */ | ||
| 2583 | return 0; | 2581 | return 0; |
| 2584 | } | 2582 | } |
| 2585 | 2583 | ||
diff --git a/drivers/gpu/drm/radeon/r600_audio.c b/drivers/gpu/drm/radeon/r600_audio.c index 7c4fa77f018f..79b55916cf90 100644 --- a/drivers/gpu/drm/radeon/r600_audio.c +++ b/drivers/gpu/drm/radeon/r600_audio.c | |||
| @@ -57,7 +57,7 @@ static bool radeon_dig_encoder(struct drm_encoder *encoder) | |||
| 57 | */ | 57 | */ |
| 58 | static int r600_audio_chipset_supported(struct radeon_device *rdev) | 58 | static int r600_audio_chipset_supported(struct radeon_device *rdev) |
| 59 | { | 59 | { |
| 60 | return (rdev->family >= CHIP_R600 && !ASIC_IS_DCE5(rdev)) | 60 | return (rdev->family >= CHIP_R600 && !ASIC_IS_DCE6(rdev)) |
| 61 | || rdev->family == CHIP_RS600 | 61 | || rdev->family == CHIP_RS600 |
| 62 | || rdev->family == CHIP_RS690 | 62 | || rdev->family == CHIP_RS690 |
| 63 | || rdev->family == CHIP_RS740; | 63 | || rdev->family == CHIP_RS740; |
| @@ -192,6 +192,7 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock) | |||
| 192 | struct radeon_device *rdev = dev->dev_private; | 192 | struct radeon_device *rdev = dev->dev_private; |
| 193 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 193 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
| 194 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 194 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
| 195 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); | ||
| 195 | int base_rate = 48000; | 196 | int base_rate = 48000; |
| 196 | 197 | ||
| 197 | switch (radeon_encoder->encoder_id) { | 198 | switch (radeon_encoder->encoder_id) { |
| @@ -217,8 +218,8 @@ void r600_audio_set_clock(struct drm_encoder *encoder, int clock) | |||
| 217 | WREG32(EVERGREEN_AUDIO_PLL1_DIV, clock * 10); | 218 | WREG32(EVERGREEN_AUDIO_PLL1_DIV, clock * 10); |
| 218 | WREG32(EVERGREEN_AUDIO_PLL1_UNK, 0x00000071); | 219 | WREG32(EVERGREEN_AUDIO_PLL1_UNK, 0x00000071); |
| 219 | 220 | ||
| 220 | /* Some magic trigger or src sel? */ | 221 | /* Select DTO source */ |
| 221 | WREG32_P(0x5ac, 0x01, ~0x77); | 222 | WREG32(0x5ac, radeon_crtc->crtc_id); |
| 222 | } else { | 223 | } else { |
| 223 | switch (dig->dig_encoder) { | 224 | switch (dig->dig_encoder) { |
| 224 | case 0: | 225 | case 0: |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 0133f5f09bd6..ca87f7afaf23 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
| @@ -2079,6 +2079,48 @@ static int r600_packet3_check(struct radeon_cs_parser *p, | |||
| 2079 | return -EINVAL; | 2079 | return -EINVAL; |
| 2080 | } | 2080 | } |
| 2081 | break; | 2081 | break; |
| 2082 | case PACKET3_STRMOUT_BASE_UPDATE: | ||
| 2083 | if (p->family < CHIP_RV770) { | ||
| 2084 | DRM_ERROR("STRMOUT_BASE_UPDATE only supported on 7xx\n"); | ||
| 2085 | return -EINVAL; | ||
| 2086 | } | ||
| 2087 | if (pkt->count != 1) { | ||
| 2088 | DRM_ERROR("bad STRMOUT_BASE_UPDATE packet count\n"); | ||
| 2089 | return -EINVAL; | ||
| 2090 | } | ||
| 2091 | if (idx_value > 3) { | ||
| 2092 | DRM_ERROR("bad STRMOUT_BASE_UPDATE index\n"); | ||
| 2093 | return -EINVAL; | ||
| 2094 | } | ||
| 2095 | { | ||
| 2096 | u64 offset; | ||
| 2097 | |||
| 2098 | r = r600_cs_packet_next_reloc(p, &reloc); | ||
| 2099 | if (r) { | ||
| 2100 | DRM_ERROR("bad STRMOUT_BASE_UPDATE reloc\n"); | ||
| 2101 | return -EINVAL; | ||
| 2102 | } | ||
| 2103 | |||
| 2104 | if (reloc->robj != track->vgt_strmout_bo[idx_value]) { | ||
| 2105 | DRM_ERROR("bad STRMOUT_BASE_UPDATE, bo does not match\n"); | ||
| 2106 | return -EINVAL; | ||
| 2107 | } | ||
| 2108 | |||
| 2109 | offset = radeon_get_ib_value(p, idx+1) << 8; | ||
| 2110 | if (offset != track->vgt_strmout_bo_offset[idx_value]) { | ||
| 2111 | DRM_ERROR("bad STRMOUT_BASE_UPDATE, bo offset does not match: 0x%llx, 0x%x\n", | ||
| 2112 | offset, track->vgt_strmout_bo_offset[idx_value]); | ||
| 2113 | return -EINVAL; | ||
| 2114 | } | ||
| 2115 | |||
| 2116 | if ((offset + 4) > radeon_bo_size(reloc->robj)) { | ||
| 2117 | DRM_ERROR("bad STRMOUT_BASE_UPDATE bo too small: 0x%llx, 0x%lx\n", | ||
| 2118 | offset + 4, radeon_bo_size(reloc->robj)); | ||
| 2119 | return -EINVAL; | ||
| 2120 | } | ||
| 2121 | ib[idx+1] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | ||
| 2122 | } | ||
| 2123 | break; | ||
| 2082 | case PACKET3_SURFACE_BASE_UPDATE: | 2124 | case PACKET3_SURFACE_BASE_UPDATE: |
| 2083 | if (p->family >= CHIP_RV770 || p->family == CHIP_R600) { | 2125 | if (p->family >= CHIP_RV770 || p->family == CHIP_R600) { |
| 2084 | DRM_ERROR("bad SURFACE_BASE_UPDATE\n"); | 2126 | DRM_ERROR("bad SURFACE_BASE_UPDATE\n"); |
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 226379e00ac1..82a0a4c919c0 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
| @@ -322,9 +322,6 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
| 322 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 322 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
| 323 | uint32_t offset; | 323 | uint32_t offset; |
| 324 | 324 | ||
| 325 | if (ASIC_IS_DCE5(rdev)) | ||
| 326 | return; | ||
| 327 | |||
| 328 | /* Silent, r600_hdmi_enable will raise WARN for us */ | 325 | /* Silent, r600_hdmi_enable will raise WARN for us */ |
| 329 | if (!dig->afmt->enabled) | 326 | if (!dig->afmt->enabled) |
| 330 | return; | 327 | return; |
| @@ -348,7 +345,6 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod | |||
| 348 | WREG32(HDMI0_AUDIO_PACKET_CONTROL + offset, | 345 | WREG32(HDMI0_AUDIO_PACKET_CONTROL + offset, |
| 349 | HDMI0_AUDIO_SAMPLE_SEND | /* send audio packets */ | 346 | HDMI0_AUDIO_SAMPLE_SEND | /* send audio packets */ |
| 350 | HDMI0_AUDIO_DELAY_EN(1) | /* default audio delay */ | 347 | HDMI0_AUDIO_DELAY_EN(1) | /* default audio delay */ |
| 351 | HDMI0_AUDIO_SEND_MAX_PACKETS | /* send NULL packets if no audio is available */ | ||
| 352 | HDMI0_AUDIO_PACKETS_PER_LINE(3) | /* should be suffient for all audio modes and small enough for all hblanks */ | 348 | HDMI0_AUDIO_PACKETS_PER_LINE(3) | /* should be suffient for all audio modes and small enough for all hblanks */ |
| 353 | HDMI0_60958_CS_UPDATE); /* allow 60958 channel status fields to be updated */ | 349 | HDMI0_60958_CS_UPDATE); /* allow 60958 channel status fields to be updated */ |
| 354 | } | 350 | } |
| @@ -484,7 +480,7 @@ void r600_hdmi_enable(struct drm_encoder *encoder) | |||
| 484 | uint32_t offset; | 480 | uint32_t offset; |
| 485 | u32 hdmi; | 481 | u32 hdmi; |
| 486 | 482 | ||
| 487 | if (ASIC_IS_DCE5(rdev)) | 483 | if (ASIC_IS_DCE6(rdev)) |
| 488 | return; | 484 | return; |
| 489 | 485 | ||
| 490 | /* Silent, r600_hdmi_enable will raise WARN for us */ | 486 | /* Silent, r600_hdmi_enable will raise WARN for us */ |
| @@ -544,7 +540,7 @@ void r600_hdmi_disable(struct drm_encoder *encoder) | |||
| 544 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 540 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
| 545 | uint32_t offset; | 541 | uint32_t offset; |
| 546 | 542 | ||
| 547 | if (ASIC_IS_DCE5(rdev)) | 543 | if (ASIC_IS_DCE6(rdev)) |
| 548 | return; | 544 | return; |
| 549 | 545 | ||
| 550 | /* Called for ATOM_ENCODER_MODE_HDMI only */ | 546 | /* Called for ATOM_ENCODER_MODE_HDMI only */ |
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h index a0dbf1fe6a40..025fd5b6c08c 100644 --- a/drivers/gpu/drm/radeon/r600d.h +++ b/drivers/gpu/drm/radeon/r600d.h | |||
| @@ -485,6 +485,7 @@ | |||
| 485 | #define TC_L2_SIZE(x) ((x)<<5) | 485 | #define TC_L2_SIZE(x) ((x)<<5) |
| 486 | #define L2_DISABLE_LATE_HIT (1<<9) | 486 | #define L2_DISABLE_LATE_HIT (1<<9) |
| 487 | 487 | ||
| 488 | #define VC_ENHANCE 0x9714 | ||
| 488 | 489 | ||
| 489 | #define VGT_CACHE_INVALIDATION 0x88C4 | 490 | #define VGT_CACHE_INVALIDATION 0x88C4 |
| 490 | #define CACHE_INVALIDATION(x) ((x)<<0) | 491 | #define CACHE_INVALIDATION(x) ((x)<<0) |
| @@ -1163,6 +1164,7 @@ | |||
| 1163 | #define PACKET3_SET_CTL_CONST 0x6F | 1164 | #define PACKET3_SET_CTL_CONST 0x6F |
| 1164 | #define PACKET3_SET_CTL_CONST_OFFSET 0x0003cff0 | 1165 | #define PACKET3_SET_CTL_CONST_OFFSET 0x0003cff0 |
| 1165 | #define PACKET3_SET_CTL_CONST_END 0x0003e200 | 1166 | #define PACKET3_SET_CTL_CONST_END 0x0003e200 |
| 1167 | #define PACKET3_STRMOUT_BASE_UPDATE 0x72 /* r7xx */ | ||
| 1166 | #define PACKET3_SURFACE_BASE_UPDATE 0x73 | 1168 | #define PACKET3_SURFACE_BASE_UPDATE 0x73 |
| 1167 | 1169 | ||
| 1168 | 1170 | ||
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 85dac33e3cce..fefcca55c1eb 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
| @@ -1374,9 +1374,9 @@ struct cayman_asic { | |||
| 1374 | 1374 | ||
| 1375 | struct si_asic { | 1375 | struct si_asic { |
| 1376 | unsigned max_shader_engines; | 1376 | unsigned max_shader_engines; |
| 1377 | unsigned max_pipes_per_simd; | ||
| 1378 | unsigned max_tile_pipes; | 1377 | unsigned max_tile_pipes; |
| 1379 | unsigned max_simds_per_se; | 1378 | unsigned max_cu_per_sh; |
| 1379 | unsigned max_sh_per_se; | ||
| 1380 | unsigned max_backends_per_se; | 1380 | unsigned max_backends_per_se; |
| 1381 | unsigned max_texture_channel_caches; | 1381 | unsigned max_texture_channel_caches; |
| 1382 | unsigned max_gprs; | 1382 | unsigned max_gprs; |
| @@ -1387,7 +1387,6 @@ struct si_asic { | |||
| 1387 | unsigned sc_hiz_tile_fifo_size; | 1387 | unsigned sc_hiz_tile_fifo_size; |
| 1388 | unsigned sc_earlyz_tile_fifo_size; | 1388 | unsigned sc_earlyz_tile_fifo_size; |
| 1389 | 1389 | ||
| 1390 | unsigned num_shader_engines; | ||
| 1391 | unsigned num_tile_pipes; | 1390 | unsigned num_tile_pipes; |
| 1392 | unsigned num_backends_per_se; | 1391 | unsigned num_backends_per_se; |
| 1393 | unsigned backend_disable_mask_per_asic; | 1392 | unsigned backend_disable_mask_per_asic; |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index f0bb2b543b13..2c4d53fd20c5 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
| @@ -57,9 +57,11 @@ | |||
| 57 | * 2.13.0 - virtual memory support, streamout | 57 | * 2.13.0 - virtual memory support, streamout |
| 58 | * 2.14.0 - add evergreen tiling informations | 58 | * 2.14.0 - add evergreen tiling informations |
| 59 | * 2.15.0 - add max_pipes query | 59 | * 2.15.0 - add max_pipes query |
| 60 | * 2.16.0 - fix evergreen 2D tiled surface calculation | ||
| 61 | * 2.17.0 - add STRMOUT_BASE_UPDATE for r7xx | ||
| 60 | */ | 62 | */ |
| 61 | #define KMS_DRIVER_MAJOR 2 | 63 | #define KMS_DRIVER_MAJOR 2 |
| 62 | #define KMS_DRIVER_MINOR 15 | 64 | #define KMS_DRIVER_MINOR 17 |
| 63 | #define KMS_DRIVER_PATCHLEVEL 0 | 65 | #define KMS_DRIVER_PATCHLEVEL 0 |
| 64 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); | 66 | int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); |
| 65 | int radeon_driver_unload_kms(struct drm_device *dev); | 67 | int radeon_driver_unload_kms(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c index 79db56e6c2ac..84b648a7ddd8 100644 --- a/drivers/gpu/drm/radeon/radeon_gart.c +++ b/drivers/gpu/drm/radeon/radeon_gart.c | |||
| @@ -289,8 +289,9 @@ int radeon_vm_manager_init(struct radeon_device *rdev) | |||
| 289 | rdev->vm_manager.enabled = false; | 289 | rdev->vm_manager.enabled = false; |
| 290 | 290 | ||
| 291 | /* mark first vm as always in use, it's the system one */ | 291 | /* mark first vm as always in use, it's the system one */ |
| 292 | /* allocate enough for 2 full VM pts */ | ||
| 292 | r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, | 293 | r = radeon_sa_bo_manager_init(rdev, &rdev->vm_manager.sa_manager, |
| 293 | rdev->vm_manager.max_pfn * 8, | 294 | rdev->vm_manager.max_pfn * 8 * 2, |
| 294 | RADEON_GEM_DOMAIN_VRAM); | 295 | RADEON_GEM_DOMAIN_VRAM); |
| 295 | if (r) { | 296 | if (r) { |
| 296 | dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", | 297 | dev_err(rdev->dev, "failed to allocate vm bo (%dKB)\n", |
| @@ -476,12 +477,18 @@ int radeon_vm_bo_add(struct radeon_device *rdev, | |||
| 476 | 477 | ||
| 477 | mutex_lock(&vm->mutex); | 478 | mutex_lock(&vm->mutex); |
| 478 | if (last_pfn > vm->last_pfn) { | 479 | if (last_pfn > vm->last_pfn) { |
| 479 | /* grow va space 32M by 32M */ | 480 | /* release mutex and lock in right order */ |
| 480 | unsigned align = ((32 << 20) >> 12) - 1; | 481 | mutex_unlock(&vm->mutex); |
| 481 | radeon_mutex_lock(&rdev->cs_mutex); | 482 | radeon_mutex_lock(&rdev->cs_mutex); |
| 482 | radeon_vm_unbind_locked(rdev, vm); | 483 | mutex_lock(&vm->mutex); |
| 484 | /* and check again */ | ||
| 485 | if (last_pfn > vm->last_pfn) { | ||
| 486 | /* grow va space 32M by 32M */ | ||
| 487 | unsigned align = ((32 << 20) >> 12) - 1; | ||
| 488 | radeon_vm_unbind_locked(rdev, vm); | ||
| 489 | vm->last_pfn = (last_pfn + align) & ~align; | ||
| 490 | } | ||
| 483 | radeon_mutex_unlock(&rdev->cs_mutex); | 491 | radeon_mutex_unlock(&rdev->cs_mutex); |
| 484 | vm->last_pfn = (last_pfn + align) & ~align; | ||
| 485 | } | 492 | } |
| 486 | head = &vm->va; | 493 | head = &vm->va; |
| 487 | last_offset = 0; | 494 | last_offset = 0; |
| @@ -595,8 +602,8 @@ int radeon_vm_bo_rmv(struct radeon_device *rdev, | |||
| 595 | if (bo_va == NULL) | 602 | if (bo_va == NULL) |
| 596 | return 0; | 603 | return 0; |
| 597 | 604 | ||
| 598 | mutex_lock(&vm->mutex); | ||
| 599 | radeon_mutex_lock(&rdev->cs_mutex); | 605 | radeon_mutex_lock(&rdev->cs_mutex); |
| 606 | mutex_lock(&vm->mutex); | ||
| 600 | radeon_vm_bo_update_pte(rdev, vm, bo, NULL); | 607 | radeon_vm_bo_update_pte(rdev, vm, bo, NULL); |
| 601 | radeon_mutex_unlock(&rdev->cs_mutex); | 608 | radeon_mutex_unlock(&rdev->cs_mutex); |
| 602 | list_del(&bo_va->vm_list); | 609 | list_del(&bo_va->vm_list); |
| @@ -627,7 +634,15 @@ int radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm) | |||
| 627 | mutex_init(&vm->mutex); | 634 | mutex_init(&vm->mutex); |
| 628 | INIT_LIST_HEAD(&vm->list); | 635 | INIT_LIST_HEAD(&vm->list); |
| 629 | INIT_LIST_HEAD(&vm->va); | 636 | INIT_LIST_HEAD(&vm->va); |
| 630 | vm->last_pfn = 0; | 637 | /* SI requires equal sized PTs for all VMs, so always set |
| 638 | * last_pfn to max_pfn. cayman allows variable sized | ||
| 639 | * pts so we can grow then as needed. Once we switch | ||
| 640 | * to two level pts we can unify this again. | ||
| 641 | */ | ||
| 642 | if (rdev->family >= CHIP_TAHITI) | ||
| 643 | vm->last_pfn = rdev->vm_manager.max_pfn; | ||
| 644 | else | ||
| 645 | vm->last_pfn = 0; | ||
| 631 | /* map the ib pool buffer at 0 in virtual address space, set | 646 | /* map the ib pool buffer at 0 in virtual address space, set |
| 632 | * read only | 647 | * read only |
| 633 | */ | 648 | */ |
| @@ -641,9 +656,8 @@ void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm) | |||
| 641 | struct radeon_bo_va *bo_va, *tmp; | 656 | struct radeon_bo_va *bo_va, *tmp; |
| 642 | int r; | 657 | int r; |
| 643 | 658 | ||
| 644 | mutex_lock(&vm->mutex); | ||
| 645 | |||
| 646 | radeon_mutex_lock(&rdev->cs_mutex); | 659 | radeon_mutex_lock(&rdev->cs_mutex); |
| 660 | mutex_lock(&vm->mutex); | ||
| 647 | radeon_vm_unbind_locked(rdev, vm); | 661 | radeon_vm_unbind_locked(rdev, vm); |
| 648 | radeon_mutex_unlock(&rdev->cs_mutex); | 662 | radeon_mutex_unlock(&rdev->cs_mutex); |
| 649 | 663 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index f28bd4b7ef98..21ec9f5653ce 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
| @@ -292,6 +292,7 @@ int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
| 292 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | 292 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
| 293 | struct drm_file *filp) | 293 | struct drm_file *filp) |
| 294 | { | 294 | { |
| 295 | struct radeon_device *rdev = dev->dev_private; | ||
| 295 | struct drm_radeon_gem_busy *args = data; | 296 | struct drm_radeon_gem_busy *args = data; |
| 296 | struct drm_gem_object *gobj; | 297 | struct drm_gem_object *gobj; |
| 297 | struct radeon_bo *robj; | 298 | struct radeon_bo *robj; |
| @@ -317,13 +318,14 @@ int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, | |||
| 317 | break; | 318 | break; |
| 318 | } | 319 | } |
| 319 | drm_gem_object_unreference_unlocked(gobj); | 320 | drm_gem_object_unreference_unlocked(gobj); |
| 320 | r = radeon_gem_handle_lockup(robj->rdev, r); | 321 | r = radeon_gem_handle_lockup(rdev, r); |
| 321 | return r; | 322 | return r; |
| 322 | } | 323 | } |
| 323 | 324 | ||
| 324 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | 325 | int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, |
| 325 | struct drm_file *filp) | 326 | struct drm_file *filp) |
| 326 | { | 327 | { |
| 328 | struct radeon_device *rdev = dev->dev_private; | ||
| 327 | struct drm_radeon_gem_wait_idle *args = data; | 329 | struct drm_radeon_gem_wait_idle *args = data; |
| 328 | struct drm_gem_object *gobj; | 330 | struct drm_gem_object *gobj; |
| 329 | struct radeon_bo *robj; | 331 | struct radeon_bo *robj; |
| @@ -336,10 +338,10 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, | |||
| 336 | robj = gem_to_radeon_bo(gobj); | 338 | robj = gem_to_radeon_bo(gobj); |
| 337 | r = radeon_bo_wait(robj, NULL, false); | 339 | r = radeon_bo_wait(robj, NULL, false); |
| 338 | /* callback hw specific functions if any */ | 340 | /* callback hw specific functions if any */ |
| 339 | if (robj->rdev->asic->ioctl_wait_idle) | 341 | if (rdev->asic->ioctl_wait_idle) |
| 340 | robj->rdev->asic->ioctl_wait_idle(robj->rdev, robj); | 342 | robj->rdev->asic->ioctl_wait_idle(rdev, robj); |
| 341 | drm_gem_object_unreference_unlocked(gobj); | 343 | drm_gem_object_unreference_unlocked(gobj); |
| 342 | r = radeon_gem_handle_lockup(robj->rdev, r); | 344 | r = radeon_gem_handle_lockup(rdev, r); |
| 343 | return r; | 345 | return r; |
| 344 | } | 346 | } |
| 345 | 347 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index f1016a5820d1..5c58d7d90cb2 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
| @@ -273,7 +273,7 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
| 273 | break; | 273 | break; |
| 274 | case RADEON_INFO_MAX_PIPES: | 274 | case RADEON_INFO_MAX_PIPES: |
| 275 | if (rdev->family >= CHIP_TAHITI) | 275 | if (rdev->family >= CHIP_TAHITI) |
| 276 | value = rdev->config.si.max_pipes_per_simd; | 276 | value = rdev->config.si.max_cu_per_sh; |
| 277 | else if (rdev->family >= CHIP_CAYMAN) | 277 | else if (rdev->family >= CHIP_CAYMAN) |
| 278 | value = rdev->config.cayman.max_pipes_per_simd; | 278 | value = rdev->config.cayman.max_pipes_per_simd; |
| 279 | else if (rdev->family >= CHIP_CEDAR) | 279 | else if (rdev->family >= CHIP_CEDAR) |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 08825548ee69..5b37e283ec38 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
| @@ -801,9 +801,13 @@ static void radeon_dynpm_idle_work_handler(struct work_struct *work) | |||
| 801 | int i; | 801 | int i; |
| 802 | 802 | ||
| 803 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { | 803 | for (i = 0; i < RADEON_NUM_RINGS; ++i) { |
| 804 | not_processed += radeon_fence_count_emitted(rdev, i); | 804 | struct radeon_ring *ring = &rdev->ring[i]; |
| 805 | if (not_processed >= 3) | 805 | |
| 806 | break; | 806 | if (ring->ready) { |
| 807 | not_processed += radeon_fence_count_emitted(rdev, i); | ||
| 808 | if (not_processed >= 3) | ||
| 809 | break; | ||
| 810 | } | ||
| 807 | } | 811 | } |
| 808 | 812 | ||
| 809 | if (not_processed >= 3) { /* should upclock */ | 813 | if (not_processed >= 3) { /* should upclock */ |
diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c index 8ddab4c76710..6bef46ace831 100644 --- a/drivers/gpu/drm/radeon/radeon_prime.c +++ b/drivers/gpu/drm/radeon/radeon_prime.c | |||
| @@ -169,11 +169,17 @@ struct dma_buf *radeon_gem_prime_export(struct drm_device *dev, | |||
| 169 | struct radeon_bo *bo = gem_to_radeon_bo(obj); | 169 | struct radeon_bo *bo = gem_to_radeon_bo(obj); |
| 170 | int ret = 0; | 170 | int ret = 0; |
| 171 | 171 | ||
| 172 | ret = radeon_bo_reserve(bo, false); | ||
| 173 | if (unlikely(ret != 0)) | ||
| 174 | return ERR_PTR(ret); | ||
| 175 | |||
| 172 | /* pin buffer into GTT */ | 176 | /* pin buffer into GTT */ |
| 173 | ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL); | 177 | ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL); |
| 174 | if (ret) | 178 | if (ret) { |
| 179 | radeon_bo_unreserve(bo); | ||
| 175 | return ERR_PTR(ret); | 180 | return ERR_PTR(ret); |
| 176 | 181 | } | |
| 182 | radeon_bo_unreserve(bo); | ||
| 177 | return dma_buf_export(bo, &radeon_dmabuf_ops, obj->size, flags); | 183 | return dma_buf_export(bo, &radeon_dmabuf_ops, obj->size, flags); |
| 178 | } | 184 | } |
| 179 | 185 | ||
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 25f9eef12c42..e95c5e61d4e2 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
| @@ -908,12 +908,6 @@ static int rs600_startup(struct radeon_device *rdev) | |||
| 908 | return r; | 908 | return r; |
| 909 | } | 909 | } |
| 910 | 910 | ||
| 911 | r = r600_audio_init(rdev); | ||
| 912 | if (r) { | ||
| 913 | dev_err(rdev->dev, "failed initializing audio\n"); | ||
| 914 | return r; | ||
| 915 | } | ||
| 916 | |||
| 917 | r = radeon_ib_pool_start(rdev); | 911 | r = radeon_ib_pool_start(rdev); |
| 918 | if (r) | 912 | if (r) |
| 919 | return r; | 913 | return r; |
| @@ -922,6 +916,12 @@ static int rs600_startup(struct radeon_device *rdev) | |||
| 922 | if (r) | 916 | if (r) |
| 923 | return r; | 917 | return r; |
| 924 | 918 | ||
| 919 | r = r600_audio_init(rdev); | ||
| 920 | if (r) { | ||
| 921 | dev_err(rdev->dev, "failed initializing audio\n"); | ||
| 922 | return r; | ||
| 923 | } | ||
| 924 | |||
| 925 | return 0; | 925 | return 0; |
| 926 | } | 926 | } |
| 927 | 927 | ||
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 3277ddecfe9f..159b6a43fda0 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
| @@ -637,12 +637,6 @@ static int rs690_startup(struct radeon_device *rdev) | |||
| 637 | return r; | 637 | return r; |
| 638 | } | 638 | } |
| 639 | 639 | ||
| 640 | r = r600_audio_init(rdev); | ||
| 641 | if (r) { | ||
| 642 | dev_err(rdev->dev, "failed initializing audio\n"); | ||
| 643 | return r; | ||
| 644 | } | ||
| 645 | |||
| 646 | r = radeon_ib_pool_start(rdev); | 640 | r = radeon_ib_pool_start(rdev); |
| 647 | if (r) | 641 | if (r) |
| 648 | return r; | 642 | return r; |
| @@ -651,6 +645,12 @@ static int rs690_startup(struct radeon_device *rdev) | |||
| 651 | if (r) | 645 | if (r) |
| 652 | return r; | 646 | return r; |
| 653 | 647 | ||
| 648 | r = r600_audio_init(rdev); | ||
| 649 | if (r) { | ||
| 650 | dev_err(rdev->dev, "failed initializing audio\n"); | ||
| 651 | return r; | ||
| 652 | } | ||
| 653 | |||
| 654 | return 0; | 654 | return 0; |
| 655 | } | 655 | } |
| 656 | 656 | ||
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 04ddc365a908..b4f51c569c36 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -616,6 +616,9 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
| 616 | ACK_FLUSH_CTL(3) | | 616 | ACK_FLUSH_CTL(3) | |
| 617 | SYNC_FLUSH_CTL)); | 617 | SYNC_FLUSH_CTL)); |
| 618 | 618 | ||
| 619 | if (rdev->family != CHIP_RV770) | ||
| 620 | WREG32(SMX_SAR_CTL0, 0x00003f3f); | ||
| 621 | |||
| 619 | db_debug3 = RREG32(DB_DEBUG3); | 622 | db_debug3 = RREG32(DB_DEBUG3); |
| 620 | db_debug3 &= ~DB_CLK_OFF_DELAY(0x1f); | 623 | db_debug3 &= ~DB_CLK_OFF_DELAY(0x1f); |
| 621 | switch (rdev->family) { | 624 | switch (rdev->family) { |
| @@ -792,7 +795,7 @@ static void rv770_gpu_init(struct radeon_device *rdev) | |||
| 792 | 795 | ||
| 793 | WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA | | 796 | WREG32(PA_CL_ENHANCE, (CLIP_VTX_REORDER_ENA | |
| 794 | NUM_CLIP_SEQ(3))); | 797 | NUM_CLIP_SEQ(3))); |
| 795 | 798 | WREG32(VC_ENHANCE, 0); | |
| 796 | } | 799 | } |
| 797 | 800 | ||
| 798 | void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | 801 | void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) |
| @@ -956,6 +959,12 @@ static int rv770_startup(struct radeon_device *rdev) | |||
| 956 | if (r) | 959 | if (r) |
| 957 | return r; | 960 | return r; |
| 958 | 961 | ||
| 962 | r = r600_audio_init(rdev); | ||
| 963 | if (r) { | ||
| 964 | DRM_ERROR("radeon: audio init failed\n"); | ||
| 965 | return r; | ||
| 966 | } | ||
| 967 | |||
| 959 | return 0; | 968 | return 0; |
| 960 | } | 969 | } |
| 961 | 970 | ||
| @@ -978,12 +987,6 @@ int rv770_resume(struct radeon_device *rdev) | |||
| 978 | return r; | 987 | return r; |
| 979 | } | 988 | } |
| 980 | 989 | ||
| 981 | r = r600_audio_init(rdev); | ||
| 982 | if (r) { | ||
| 983 | dev_err(rdev->dev, "radeon: audio init failed\n"); | ||
| 984 | return r; | ||
| 985 | } | ||
| 986 | |||
| 987 | return r; | 990 | return r; |
| 988 | 991 | ||
| 989 | } | 992 | } |
| @@ -1092,12 +1095,6 @@ int rv770_init(struct radeon_device *rdev) | |||
| 1092 | rdev->accel_working = false; | 1095 | rdev->accel_working = false; |
| 1093 | } | 1096 | } |
| 1094 | 1097 | ||
| 1095 | r = r600_audio_init(rdev); | ||
| 1096 | if (r) { | ||
| 1097 | dev_err(rdev->dev, "radeon: audio init failed\n"); | ||
| 1098 | return r; | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | return 0; | 1098 | return 0; |
| 1102 | } | 1099 | } |
| 1103 | 1100 | ||
diff --git a/drivers/gpu/drm/radeon/rv770d.h b/drivers/gpu/drm/radeon/rv770d.h index fdc089896011..b0adfc595d75 100644 --- a/drivers/gpu/drm/radeon/rv770d.h +++ b/drivers/gpu/drm/radeon/rv770d.h | |||
| @@ -211,6 +211,7 @@ | |||
| 211 | #define SCRATCH_UMSK 0x8540 | 211 | #define SCRATCH_UMSK 0x8540 |
| 212 | #define SCRATCH_ADDR 0x8544 | 212 | #define SCRATCH_ADDR 0x8544 |
| 213 | 213 | ||
| 214 | #define SMX_SAR_CTL0 0xA008 | ||
| 214 | #define SMX_DC_CTL0 0xA020 | 215 | #define SMX_DC_CTL0 0xA020 |
| 215 | #define USE_HASH_FUNCTION (1 << 0) | 216 | #define USE_HASH_FUNCTION (1 << 0) |
| 216 | #define CACHE_DEPTH(x) ((x) << 1) | 217 | #define CACHE_DEPTH(x) ((x) << 1) |
| @@ -310,6 +311,8 @@ | |||
| 310 | #define TCP_CNTL 0x9610 | 311 | #define TCP_CNTL 0x9610 |
| 311 | #define TCP_CHAN_STEER 0x9614 | 312 | #define TCP_CHAN_STEER 0x9614 |
| 312 | 313 | ||
| 314 | #define VC_ENHANCE 0x9714 | ||
| 315 | |||
| 313 | #define VGT_CACHE_INVALIDATION 0x88C4 | 316 | #define VGT_CACHE_INVALIDATION 0x88C4 |
| 314 | #define CACHE_INVALIDATION(x) ((x)<<0) | 317 | #define CACHE_INVALIDATION(x) ((x)<<0) |
| 315 | #define VC_ONLY 0 | 318 | #define VC_ONLY 0 |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 549732e56ca9..0b0279291a73 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
| @@ -867,200 +867,6 @@ void dce6_bandwidth_update(struct radeon_device *rdev) | |||
| 867 | /* | 867 | /* |
| 868 | * Core functions | 868 | * Core functions |
| 869 | */ | 869 | */ |
| 870 | static u32 si_get_tile_pipe_to_backend_map(struct radeon_device *rdev, | ||
| 871 | u32 num_tile_pipes, | ||
| 872 | u32 num_backends_per_asic, | ||
| 873 | u32 *backend_disable_mask_per_asic, | ||
| 874 | u32 num_shader_engines) | ||
| 875 | { | ||
| 876 | u32 backend_map = 0; | ||
| 877 | u32 enabled_backends_mask = 0; | ||
| 878 | u32 enabled_backends_count = 0; | ||
| 879 | u32 num_backends_per_se; | ||
| 880 | u32 cur_pipe; | ||
| 881 | u32 swizzle_pipe[SI_MAX_PIPES]; | ||
| 882 | u32 cur_backend = 0; | ||
| 883 | u32 i; | ||
| 884 | bool force_no_swizzle; | ||
| 885 | |||
| 886 | /* force legal values */ | ||
| 887 | if (num_tile_pipes < 1) | ||
| 888 | num_tile_pipes = 1; | ||
| 889 | if (num_tile_pipes > rdev->config.si.max_tile_pipes) | ||
| 890 | num_tile_pipes = rdev->config.si.max_tile_pipes; | ||
| 891 | if (num_shader_engines < 1) | ||
| 892 | num_shader_engines = 1; | ||
| 893 | if (num_shader_engines > rdev->config.si.max_shader_engines) | ||
| 894 | num_shader_engines = rdev->config.si.max_shader_engines; | ||
| 895 | if (num_backends_per_asic < num_shader_engines) | ||
| 896 | num_backends_per_asic = num_shader_engines; | ||
| 897 | if (num_backends_per_asic > (rdev->config.si.max_backends_per_se * num_shader_engines)) | ||
| 898 | num_backends_per_asic = rdev->config.si.max_backends_per_se * num_shader_engines; | ||
| 899 | |||
| 900 | /* make sure we have the same number of backends per se */ | ||
| 901 | num_backends_per_asic = ALIGN(num_backends_per_asic, num_shader_engines); | ||
| 902 | /* set up the number of backends per se */ | ||
| 903 | num_backends_per_se = num_backends_per_asic / num_shader_engines; | ||
| 904 | if (num_backends_per_se > rdev->config.si.max_backends_per_se) { | ||
| 905 | num_backends_per_se = rdev->config.si.max_backends_per_se; | ||
| 906 | num_backends_per_asic = num_backends_per_se * num_shader_engines; | ||
| 907 | } | ||
| 908 | |||
| 909 | /* create enable mask and count for enabled backends */ | ||
| 910 | for (i = 0; i < SI_MAX_BACKENDS; ++i) { | ||
| 911 | if (((*backend_disable_mask_per_asic >> i) & 1) == 0) { | ||
| 912 | enabled_backends_mask |= (1 << i); | ||
| 913 | ++enabled_backends_count; | ||
| 914 | } | ||
| 915 | if (enabled_backends_count == num_backends_per_asic) | ||
| 916 | break; | ||
| 917 | } | ||
| 918 | |||
| 919 | /* force the backends mask to match the current number of backends */ | ||
| 920 | if (enabled_backends_count != num_backends_per_asic) { | ||
| 921 | u32 this_backend_enabled; | ||
| 922 | u32 shader_engine; | ||
| 923 | u32 backend_per_se; | ||
| 924 | |||
| 925 | enabled_backends_mask = 0; | ||
| 926 | enabled_backends_count = 0; | ||
| 927 | *backend_disable_mask_per_asic = SI_MAX_BACKENDS_MASK; | ||
| 928 | for (i = 0; i < SI_MAX_BACKENDS; ++i) { | ||
| 929 | /* calc the current se */ | ||
| 930 | shader_engine = i / rdev->config.si.max_backends_per_se; | ||
| 931 | /* calc the backend per se */ | ||
| 932 | backend_per_se = i % rdev->config.si.max_backends_per_se; | ||
| 933 | /* default to not enabled */ | ||
| 934 | this_backend_enabled = 0; | ||
| 935 | if ((shader_engine < num_shader_engines) && | ||
| 936 | (backend_per_se < num_backends_per_se)) | ||
| 937 | this_backend_enabled = 1; | ||
| 938 | if (this_backend_enabled) { | ||
| 939 | enabled_backends_mask |= (1 << i); | ||
| 940 | *backend_disable_mask_per_asic &= ~(1 << i); | ||
| 941 | ++enabled_backends_count; | ||
| 942 | } | ||
| 943 | } | ||
| 944 | } | ||
| 945 | |||
| 946 | |||
| 947 | memset((uint8_t *)&swizzle_pipe[0], 0, sizeof(u32) * SI_MAX_PIPES); | ||
| 948 | switch (rdev->family) { | ||
| 949 | case CHIP_TAHITI: | ||
| 950 | case CHIP_PITCAIRN: | ||
| 951 | case CHIP_VERDE: | ||
| 952 | force_no_swizzle = true; | ||
| 953 | break; | ||
| 954 | default: | ||
| 955 | force_no_swizzle = false; | ||
| 956 | break; | ||
| 957 | } | ||
| 958 | if (force_no_swizzle) { | ||
| 959 | bool last_backend_enabled = false; | ||
| 960 | |||
| 961 | force_no_swizzle = false; | ||
| 962 | for (i = 0; i < SI_MAX_BACKENDS; ++i) { | ||
| 963 | if (((enabled_backends_mask >> i) & 1) == 1) { | ||
| 964 | if (last_backend_enabled) | ||
| 965 | force_no_swizzle = true; | ||
| 966 | last_backend_enabled = true; | ||
| 967 | } else | ||
| 968 | last_backend_enabled = false; | ||
| 969 | } | ||
| 970 | } | ||
| 971 | |||
| 972 | switch (num_tile_pipes) { | ||
| 973 | case 1: | ||
| 974 | case 3: | ||
| 975 | case 5: | ||
| 976 | case 7: | ||
| 977 | DRM_ERROR("odd number of pipes!\n"); | ||
| 978 | break; | ||
| 979 | case 2: | ||
| 980 | swizzle_pipe[0] = 0; | ||
| 981 | swizzle_pipe[1] = 1; | ||
| 982 | break; | ||
| 983 | case 4: | ||
| 984 | if (force_no_swizzle) { | ||
| 985 | swizzle_pipe[0] = 0; | ||
| 986 | swizzle_pipe[1] = 1; | ||
| 987 | swizzle_pipe[2] = 2; | ||
| 988 | swizzle_pipe[3] = 3; | ||
| 989 | } else { | ||
| 990 | swizzle_pipe[0] = 0; | ||
| 991 | swizzle_pipe[1] = 2; | ||
| 992 | swizzle_pipe[2] = 1; | ||
| 993 | swizzle_pipe[3] = 3; | ||
| 994 | } | ||
| 995 | break; | ||
| 996 | case 6: | ||
| 997 | if (force_no_swizzle) { | ||
| 998 | swizzle_pipe[0] = 0; | ||
| 999 | swizzle_pipe[1] = 1; | ||
| 1000 | swizzle_pipe[2] = 2; | ||
| 1001 | swizzle_pipe[3] = 3; | ||
| 1002 | swizzle_pipe[4] = 4; | ||
| 1003 | swizzle_pipe[5] = 5; | ||
| 1004 | } else { | ||
| 1005 | swizzle_pipe[0] = 0; | ||
| 1006 | swizzle_pipe[1] = 2; | ||
| 1007 | swizzle_pipe[2] = 4; | ||
| 1008 | swizzle_pipe[3] = 1; | ||
| 1009 | swizzle_pipe[4] = 3; | ||
| 1010 | swizzle_pipe[5] = 5; | ||
| 1011 | } | ||
| 1012 | break; | ||
| 1013 | case 8: | ||
| 1014 | if (force_no_swizzle) { | ||
| 1015 | swizzle_pipe[0] = 0; | ||
| 1016 | swizzle_pipe[1] = 1; | ||
| 1017 | swizzle_pipe[2] = 2; | ||
| 1018 | swizzle_pipe[3] = 3; | ||
| 1019 | swizzle_pipe[4] = 4; | ||
| 1020 | swizzle_pipe[5] = 5; | ||
| 1021 | swizzle_pipe[6] = 6; | ||
| 1022 | swizzle_pipe[7] = 7; | ||
| 1023 | } else { | ||
| 1024 | swizzle_pipe[0] = 0; | ||
| 1025 | swizzle_pipe[1] = 2; | ||
| 1026 | swizzle_pipe[2] = 4; | ||
| 1027 | swizzle_pipe[3] = 6; | ||
| 1028 | swizzle_pipe[4] = 1; | ||
| 1029 | swizzle_pipe[5] = 3; | ||
| 1030 | swizzle_pipe[6] = 5; | ||
| 1031 | swizzle_pipe[7] = 7; | ||
| 1032 | } | ||
| 1033 | break; | ||
| 1034 | } | ||
| 1035 | |||
| 1036 | for (cur_pipe = 0; cur_pipe < num_tile_pipes; ++cur_pipe) { | ||
| 1037 | while (((1 << cur_backend) & enabled_backends_mask) == 0) | ||
| 1038 | cur_backend = (cur_backend + 1) % SI_MAX_BACKENDS; | ||
| 1039 | |||
| 1040 | backend_map |= (((cur_backend & 0xf) << (swizzle_pipe[cur_pipe] * 4))); | ||
| 1041 | |||
| 1042 | cur_backend = (cur_backend + 1) % SI_MAX_BACKENDS; | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | return backend_map; | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | static u32 si_get_disable_mask_per_asic(struct radeon_device *rdev, | ||
| 1049 | u32 disable_mask_per_se, | ||
| 1050 | u32 max_disable_mask_per_se, | ||
| 1051 | u32 num_shader_engines) | ||
| 1052 | { | ||
| 1053 | u32 disable_field_width_per_se = r600_count_pipe_bits(disable_mask_per_se); | ||
| 1054 | u32 disable_mask_per_asic = disable_mask_per_se & max_disable_mask_per_se; | ||
| 1055 | |||
| 1056 | if (num_shader_engines == 1) | ||
| 1057 | return disable_mask_per_asic; | ||
| 1058 | else if (num_shader_engines == 2) | ||
| 1059 | return disable_mask_per_asic | (disable_mask_per_asic << disable_field_width_per_se); | ||
| 1060 | else | ||
| 1061 | return 0xffffffff; | ||
| 1062 | } | ||
| 1063 | |||
| 1064 | static void si_tiling_mode_table_init(struct radeon_device *rdev) | 870 | static void si_tiling_mode_table_init(struct radeon_device *rdev) |
| 1065 | { | 871 | { |
| 1066 | const u32 num_tile_mode_states = 32; | 872 | const u32 num_tile_mode_states = 32; |
| @@ -1562,18 +1368,151 @@ static void si_tiling_mode_table_init(struct radeon_device *rdev) | |||
| 1562 | DRM_ERROR("unknown asic: 0x%x\n", rdev->family); | 1368 | DRM_ERROR("unknown asic: 0x%x\n", rdev->family); |
| 1563 | } | 1369 | } |
| 1564 | 1370 | ||
| 1371 | static void si_select_se_sh(struct radeon_device *rdev, | ||
| 1372 | u32 se_num, u32 sh_num) | ||
| 1373 | { | ||
| 1374 | u32 data = INSTANCE_BROADCAST_WRITES; | ||
| 1375 | |||
| 1376 | if ((se_num == 0xffffffff) && (sh_num == 0xffffffff)) | ||
| 1377 | data = SH_BROADCAST_WRITES | SE_BROADCAST_WRITES; | ||
| 1378 | else if (se_num == 0xffffffff) | ||
| 1379 | data |= SE_BROADCAST_WRITES | SH_INDEX(sh_num); | ||
| 1380 | else if (sh_num == 0xffffffff) | ||
| 1381 | data |= SH_BROADCAST_WRITES | SE_INDEX(se_num); | ||
| 1382 | else | ||
| 1383 | data |= SH_INDEX(sh_num) | SE_INDEX(se_num); | ||
| 1384 | WREG32(GRBM_GFX_INDEX, data); | ||
| 1385 | } | ||
| 1386 | |||
| 1387 | static u32 si_create_bitmask(u32 bit_width) | ||
| 1388 | { | ||
| 1389 | u32 i, mask = 0; | ||
| 1390 | |||
| 1391 | for (i = 0; i < bit_width; i++) { | ||
| 1392 | mask <<= 1; | ||
| 1393 | mask |= 1; | ||
| 1394 | } | ||
| 1395 | return mask; | ||
| 1396 | } | ||
| 1397 | |||
| 1398 | static u32 si_get_cu_enabled(struct radeon_device *rdev, u32 cu_per_sh) | ||
| 1399 | { | ||
| 1400 | u32 data, mask; | ||
| 1401 | |||
| 1402 | data = RREG32(CC_GC_SHADER_ARRAY_CONFIG); | ||
| 1403 | if (data & 1) | ||
| 1404 | data &= INACTIVE_CUS_MASK; | ||
| 1405 | else | ||
| 1406 | data = 0; | ||
| 1407 | data |= RREG32(GC_USER_SHADER_ARRAY_CONFIG); | ||
| 1408 | |||
| 1409 | data >>= INACTIVE_CUS_SHIFT; | ||
| 1410 | |||
| 1411 | mask = si_create_bitmask(cu_per_sh); | ||
| 1412 | |||
| 1413 | return ~data & mask; | ||
| 1414 | } | ||
| 1415 | |||
| 1416 | static void si_setup_spi(struct radeon_device *rdev, | ||
| 1417 | u32 se_num, u32 sh_per_se, | ||
| 1418 | u32 cu_per_sh) | ||
| 1419 | { | ||
| 1420 | int i, j, k; | ||
| 1421 | u32 data, mask, active_cu; | ||
| 1422 | |||
| 1423 | for (i = 0; i < se_num; i++) { | ||
| 1424 | for (j = 0; j < sh_per_se; j++) { | ||
| 1425 | si_select_se_sh(rdev, i, j); | ||
| 1426 | data = RREG32(SPI_STATIC_THREAD_MGMT_3); | ||
| 1427 | active_cu = si_get_cu_enabled(rdev, cu_per_sh); | ||
| 1428 | |||
| 1429 | mask = 1; | ||
| 1430 | for (k = 0; k < 16; k++) { | ||
| 1431 | mask <<= k; | ||
| 1432 | if (active_cu & mask) { | ||
| 1433 | data &= ~mask; | ||
| 1434 | WREG32(SPI_STATIC_THREAD_MGMT_3, data); | ||
| 1435 | break; | ||
| 1436 | } | ||
| 1437 | } | ||
| 1438 | } | ||
| 1439 | } | ||
| 1440 | si_select_se_sh(rdev, 0xffffffff, 0xffffffff); | ||
| 1441 | } | ||
| 1442 | |||
| 1443 | static u32 si_get_rb_disabled(struct radeon_device *rdev, | ||
| 1444 | u32 max_rb_num, u32 se_num, | ||
| 1445 | u32 sh_per_se) | ||
| 1446 | { | ||
| 1447 | u32 data, mask; | ||
| 1448 | |||
| 1449 | data = RREG32(CC_RB_BACKEND_DISABLE); | ||
| 1450 | if (data & 1) | ||
| 1451 | data &= BACKEND_DISABLE_MASK; | ||
| 1452 | else | ||
| 1453 | data = 0; | ||
| 1454 | data |= RREG32(GC_USER_RB_BACKEND_DISABLE); | ||
| 1455 | |||
| 1456 | data >>= BACKEND_DISABLE_SHIFT; | ||
| 1457 | |||
| 1458 | mask = si_create_bitmask(max_rb_num / se_num / sh_per_se); | ||
| 1459 | |||
| 1460 | return data & mask; | ||
| 1461 | } | ||
| 1462 | |||
| 1463 | static void si_setup_rb(struct radeon_device *rdev, | ||
| 1464 | u32 se_num, u32 sh_per_se, | ||
| 1465 | u32 max_rb_num) | ||
| 1466 | { | ||
| 1467 | int i, j; | ||
| 1468 | u32 data, mask; | ||
| 1469 | u32 disabled_rbs = 0; | ||
| 1470 | u32 enabled_rbs = 0; | ||
| 1471 | |||
| 1472 | for (i = 0; i < se_num; i++) { | ||
| 1473 | for (j = 0; j < sh_per_se; j++) { | ||
| 1474 | si_select_se_sh(rdev, i, j); | ||
| 1475 | data = si_get_rb_disabled(rdev, max_rb_num, se_num, sh_per_se); | ||
| 1476 | disabled_rbs |= data << ((i * sh_per_se + j) * TAHITI_RB_BITMAP_WIDTH_PER_SH); | ||
| 1477 | } | ||
| 1478 | } | ||
| 1479 | si_select_se_sh(rdev, 0xffffffff, 0xffffffff); | ||
| 1480 | |||
| 1481 | mask = 1; | ||
| 1482 | for (i = 0; i < max_rb_num; i++) { | ||
| 1483 | if (!(disabled_rbs & mask)) | ||
| 1484 | enabled_rbs |= mask; | ||
| 1485 | mask <<= 1; | ||
| 1486 | } | ||
| 1487 | |||
| 1488 | for (i = 0; i < se_num; i++) { | ||
| 1489 | si_select_se_sh(rdev, i, 0xffffffff); | ||
| 1490 | data = 0; | ||
| 1491 | for (j = 0; j < sh_per_se; j++) { | ||
| 1492 | switch (enabled_rbs & 3) { | ||
| 1493 | case 1: | ||
| 1494 | data |= (RASTER_CONFIG_RB_MAP_0 << (i * sh_per_se + j) * 2); | ||
| 1495 | break; | ||
| 1496 | case 2: | ||
| 1497 | data |= (RASTER_CONFIG_RB_MAP_3 << (i * sh_per_se + j) * 2); | ||
| 1498 | break; | ||
| 1499 | case 3: | ||
| 1500 | default: | ||
| 1501 | data |= (RASTER_CONFIG_RB_MAP_2 << (i * sh_per_se + j) * 2); | ||
| 1502 | break; | ||
| 1503 | } | ||
| 1504 | enabled_rbs >>= 2; | ||
| 1505 | } | ||
| 1506 | WREG32(PA_SC_RASTER_CONFIG, data); | ||
| 1507 | } | ||
| 1508 | si_select_se_sh(rdev, 0xffffffff, 0xffffffff); | ||
| 1509 | } | ||
| 1510 | |||
| 1565 | static void si_gpu_init(struct radeon_device *rdev) | 1511 | static void si_gpu_init(struct radeon_device *rdev) |
| 1566 | { | 1512 | { |
| 1567 | u32 cc_rb_backend_disable = 0; | ||
| 1568 | u32 cc_gc_shader_array_config; | ||
| 1569 | u32 gb_addr_config = 0; | 1513 | u32 gb_addr_config = 0; |
| 1570 | u32 mc_shared_chmap, mc_arb_ramcfg; | 1514 | u32 mc_shared_chmap, mc_arb_ramcfg; |
| 1571 | u32 gb_backend_map; | ||
| 1572 | u32 cgts_tcc_disable; | ||
| 1573 | u32 sx_debug_1; | 1515 | u32 sx_debug_1; |
| 1574 | u32 gc_user_shader_array_config; | ||
| 1575 | u32 gc_user_rb_backend_disable; | ||
| 1576 | u32 cgts_user_tcc_disable; | ||
| 1577 | u32 hdp_host_path_cntl; | 1516 | u32 hdp_host_path_cntl; |
| 1578 | u32 tmp; | 1517 | u32 tmp; |
| 1579 | int i, j; | 1518 | int i, j; |
| @@ -1581,9 +1520,9 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
| 1581 | switch (rdev->family) { | 1520 | switch (rdev->family) { |
| 1582 | case CHIP_TAHITI: | 1521 | case CHIP_TAHITI: |
| 1583 | rdev->config.si.max_shader_engines = 2; | 1522 | rdev->config.si.max_shader_engines = 2; |
| 1584 | rdev->config.si.max_pipes_per_simd = 4; | ||
| 1585 | rdev->config.si.max_tile_pipes = 12; | 1523 | rdev->config.si.max_tile_pipes = 12; |
| 1586 | rdev->config.si.max_simds_per_se = 8; | 1524 | rdev->config.si.max_cu_per_sh = 8; |
| 1525 | rdev->config.si.max_sh_per_se = 2; | ||
| 1587 | rdev->config.si.max_backends_per_se = 4; | 1526 | rdev->config.si.max_backends_per_se = 4; |
| 1588 | rdev->config.si.max_texture_channel_caches = 12; | 1527 | rdev->config.si.max_texture_channel_caches = 12; |
| 1589 | rdev->config.si.max_gprs = 256; | 1528 | rdev->config.si.max_gprs = 256; |
| @@ -1594,12 +1533,13 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
| 1594 | rdev->config.si.sc_prim_fifo_size_backend = 0x100; | 1533 | rdev->config.si.sc_prim_fifo_size_backend = 0x100; |
| 1595 | rdev->config.si.sc_hiz_tile_fifo_size = 0x30; | 1534 | rdev->config.si.sc_hiz_tile_fifo_size = 0x30; |
| 1596 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; | 1535 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; |
| 1536 | gb_addr_config = TAHITI_GB_ADDR_CONFIG_GOLDEN; | ||
| 1597 | break; | 1537 | break; |
| 1598 | case CHIP_PITCAIRN: | 1538 | case CHIP_PITCAIRN: |
| 1599 | rdev->config.si.max_shader_engines = 2; | 1539 | rdev->config.si.max_shader_engines = 2; |
| 1600 | rdev->config.si.max_pipes_per_simd = 4; | ||
| 1601 | rdev->config.si.max_tile_pipes = 8; | 1540 | rdev->config.si.max_tile_pipes = 8; |
| 1602 | rdev->config.si.max_simds_per_se = 5; | 1541 | rdev->config.si.max_cu_per_sh = 5; |
| 1542 | rdev->config.si.max_sh_per_se = 2; | ||
| 1603 | rdev->config.si.max_backends_per_se = 4; | 1543 | rdev->config.si.max_backends_per_se = 4; |
| 1604 | rdev->config.si.max_texture_channel_caches = 8; | 1544 | rdev->config.si.max_texture_channel_caches = 8; |
| 1605 | rdev->config.si.max_gprs = 256; | 1545 | rdev->config.si.max_gprs = 256; |
| @@ -1610,13 +1550,14 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
| 1610 | rdev->config.si.sc_prim_fifo_size_backend = 0x100; | 1550 | rdev->config.si.sc_prim_fifo_size_backend = 0x100; |
| 1611 | rdev->config.si.sc_hiz_tile_fifo_size = 0x30; | 1551 | rdev->config.si.sc_hiz_tile_fifo_size = 0x30; |
| 1612 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; | 1552 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; |
| 1553 | gb_addr_config = TAHITI_GB_ADDR_CONFIG_GOLDEN; | ||
| 1613 | break; | 1554 | break; |
| 1614 | case CHIP_VERDE: | 1555 | case CHIP_VERDE: |
| 1615 | default: | 1556 | default: |
| 1616 | rdev->config.si.max_shader_engines = 1; | 1557 | rdev->config.si.max_shader_engines = 1; |
| 1617 | rdev->config.si.max_pipes_per_simd = 4; | ||
| 1618 | rdev->config.si.max_tile_pipes = 4; | 1558 | rdev->config.si.max_tile_pipes = 4; |
| 1619 | rdev->config.si.max_simds_per_se = 2; | 1559 | rdev->config.si.max_cu_per_sh = 2; |
| 1560 | rdev->config.si.max_sh_per_se = 2; | ||
| 1620 | rdev->config.si.max_backends_per_se = 4; | 1561 | rdev->config.si.max_backends_per_se = 4; |
| 1621 | rdev->config.si.max_texture_channel_caches = 4; | 1562 | rdev->config.si.max_texture_channel_caches = 4; |
| 1622 | rdev->config.si.max_gprs = 256; | 1563 | rdev->config.si.max_gprs = 256; |
| @@ -1627,6 +1568,7 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
| 1627 | rdev->config.si.sc_prim_fifo_size_backend = 0x40; | 1568 | rdev->config.si.sc_prim_fifo_size_backend = 0x40; |
| 1628 | rdev->config.si.sc_hiz_tile_fifo_size = 0x30; | 1569 | rdev->config.si.sc_hiz_tile_fifo_size = 0x30; |
| 1629 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; | 1570 | rdev->config.si.sc_earlyz_tile_fifo_size = 0x130; |
| 1571 | gb_addr_config = VERDE_GB_ADDR_CONFIG_GOLDEN; | ||
| 1630 | break; | 1572 | break; |
| 1631 | } | 1573 | } |
| 1632 | 1574 | ||
| @@ -1648,31 +1590,7 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
| 1648 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); | 1590 | mc_shared_chmap = RREG32(MC_SHARED_CHMAP); |
| 1649 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); | 1591 | mc_arb_ramcfg = RREG32(MC_ARB_RAMCFG); |
| 1650 | 1592 | ||
| 1651 | cc_rb_backend_disable = RREG32(CC_RB_BACKEND_DISABLE); | ||
| 1652 | cc_gc_shader_array_config = RREG32(CC_GC_SHADER_ARRAY_CONFIG); | ||
| 1653 | cgts_tcc_disable = 0xffff0000; | ||
| 1654 | for (i = 0; i < rdev->config.si.max_texture_channel_caches; i++) | ||
| 1655 | cgts_tcc_disable &= ~(1 << (16 + i)); | ||
| 1656 | gc_user_rb_backend_disable = RREG32(GC_USER_RB_BACKEND_DISABLE); | ||
| 1657 | gc_user_shader_array_config = RREG32(GC_USER_SHADER_ARRAY_CONFIG); | ||
| 1658 | cgts_user_tcc_disable = RREG32(CGTS_USER_TCC_DISABLE); | ||
| 1659 | |||
| 1660 | rdev->config.si.num_shader_engines = rdev->config.si.max_shader_engines; | ||
| 1661 | rdev->config.si.num_tile_pipes = rdev->config.si.max_tile_pipes; | 1593 | rdev->config.si.num_tile_pipes = rdev->config.si.max_tile_pipes; |
| 1662 | tmp = ((~gc_user_rb_backend_disable) & BACKEND_DISABLE_MASK) >> BACKEND_DISABLE_SHIFT; | ||
| 1663 | rdev->config.si.num_backends_per_se = r600_count_pipe_bits(tmp); | ||
| 1664 | tmp = (gc_user_rb_backend_disable & BACKEND_DISABLE_MASK) >> BACKEND_DISABLE_SHIFT; | ||
| 1665 | rdev->config.si.backend_disable_mask_per_asic = | ||
| 1666 | si_get_disable_mask_per_asic(rdev, tmp, SI_MAX_BACKENDS_PER_SE_MASK, | ||
| 1667 | rdev->config.si.num_shader_engines); | ||
| 1668 | rdev->config.si.backend_map = | ||
| 1669 | si_get_tile_pipe_to_backend_map(rdev, rdev->config.si.num_tile_pipes, | ||
| 1670 | rdev->config.si.num_backends_per_se * | ||
| 1671 | rdev->config.si.num_shader_engines, | ||
| 1672 | &rdev->config.si.backend_disable_mask_per_asic, | ||
| 1673 | rdev->config.si.num_shader_engines); | ||
| 1674 | tmp = ((~cgts_user_tcc_disable) & TCC_DISABLE_MASK) >> TCC_DISABLE_SHIFT; | ||
| 1675 | rdev->config.si.num_texture_channel_caches = r600_count_pipe_bits(tmp); | ||
| 1676 | rdev->config.si.mem_max_burst_length_bytes = 256; | 1594 | rdev->config.si.mem_max_burst_length_bytes = 256; |
| 1677 | tmp = (mc_arb_ramcfg & NOOFCOLS_MASK) >> NOOFCOLS_SHIFT; | 1595 | tmp = (mc_arb_ramcfg & NOOFCOLS_MASK) >> NOOFCOLS_SHIFT; |
| 1678 | rdev->config.si.mem_row_size_in_kb = (4 * (1 << (8 + tmp))) / 1024; | 1596 | rdev->config.si.mem_row_size_in_kb = (4 * (1 << (8 + tmp))) / 1024; |
| @@ -1683,55 +1601,8 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
| 1683 | rdev->config.si.num_gpus = 1; | 1601 | rdev->config.si.num_gpus = 1; |
| 1684 | rdev->config.si.multi_gpu_tile_size = 64; | 1602 | rdev->config.si.multi_gpu_tile_size = 64; |
| 1685 | 1603 | ||
| 1686 | gb_addr_config = 0; | 1604 | /* fix up row size */ |
| 1687 | switch (rdev->config.si.num_tile_pipes) { | 1605 | gb_addr_config &= ~ROW_SIZE_MASK; |
| 1688 | case 1: | ||
| 1689 | gb_addr_config |= NUM_PIPES(0); | ||
| 1690 | break; | ||
| 1691 | case 2: | ||
| 1692 | gb_addr_config |= NUM_PIPES(1); | ||
| 1693 | break; | ||
| 1694 | case 4: | ||
| 1695 | gb_addr_config |= NUM_PIPES(2); | ||
| 1696 | break; | ||
| 1697 | case 8: | ||
| 1698 | default: | ||
| 1699 | gb_addr_config |= NUM_PIPES(3); | ||
| 1700 | break; | ||
| 1701 | } | ||
| 1702 | |||
| 1703 | tmp = (rdev->config.si.mem_max_burst_length_bytes / 256) - 1; | ||
| 1704 | gb_addr_config |= PIPE_INTERLEAVE_SIZE(tmp); | ||
| 1705 | gb_addr_config |= NUM_SHADER_ENGINES(rdev->config.si.num_shader_engines - 1); | ||
| 1706 | tmp = (rdev->config.si.shader_engine_tile_size / 16) - 1; | ||
| 1707 | gb_addr_config |= SHADER_ENGINE_TILE_SIZE(tmp); | ||
| 1708 | switch (rdev->config.si.num_gpus) { | ||
| 1709 | case 1: | ||
| 1710 | default: | ||
| 1711 | gb_addr_config |= NUM_GPUS(0); | ||
| 1712 | break; | ||
| 1713 | case 2: | ||
| 1714 | gb_addr_config |= NUM_GPUS(1); | ||
| 1715 | break; | ||
| 1716 | case 4: | ||
| 1717 | gb_addr_config |= NUM_GPUS(2); | ||
| 1718 | break; | ||
| 1719 | } | ||
| 1720 | switch (rdev->config.si.multi_gpu_tile_size) { | ||
| 1721 | case 16: | ||
| 1722 | gb_addr_config |= MULTI_GPU_TILE_SIZE(0); | ||
| 1723 | break; | ||
| 1724 | case 32: | ||
| 1725 | default: | ||
| 1726 | gb_addr_config |= MULTI_GPU_TILE_SIZE(1); | ||
| 1727 | break; | ||
| 1728 | case 64: | ||
| 1729 | gb_addr_config |= MULTI_GPU_TILE_SIZE(2); | ||
| 1730 | break; | ||
| 1731 | case 128: | ||
| 1732 | gb_addr_config |= MULTI_GPU_TILE_SIZE(3); | ||
| 1733 | break; | ||
| 1734 | } | ||
| 1735 | switch (rdev->config.si.mem_row_size_in_kb) { | 1606 | switch (rdev->config.si.mem_row_size_in_kb) { |
| 1736 | case 1: | 1607 | case 1: |
| 1737 | default: | 1608 | default: |
| @@ -1745,26 +1616,6 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
| 1745 | break; | 1616 | break; |
| 1746 | } | 1617 | } |
| 1747 | 1618 | ||
| 1748 | tmp = (gb_addr_config & NUM_PIPES_MASK) >> NUM_PIPES_SHIFT; | ||
| 1749 | rdev->config.si.num_tile_pipes = (1 << tmp); | ||
| 1750 | tmp = (gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT; | ||
| 1751 | rdev->config.si.mem_max_burst_length_bytes = (tmp + 1) * 256; | ||
| 1752 | tmp = (gb_addr_config & NUM_SHADER_ENGINES_MASK) >> NUM_SHADER_ENGINES_SHIFT; | ||
| 1753 | rdev->config.si.num_shader_engines = tmp + 1; | ||
| 1754 | tmp = (gb_addr_config & NUM_GPUS_MASK) >> NUM_GPUS_SHIFT; | ||
| 1755 | rdev->config.si.num_gpus = tmp + 1; | ||
| 1756 | tmp = (gb_addr_config & MULTI_GPU_TILE_SIZE_MASK) >> MULTI_GPU_TILE_SIZE_SHIFT; | ||
| 1757 | rdev->config.si.multi_gpu_tile_size = 1 << tmp; | ||
| 1758 | tmp = (gb_addr_config & ROW_SIZE_MASK) >> ROW_SIZE_SHIFT; | ||
| 1759 | rdev->config.si.mem_row_size_in_kb = 1 << tmp; | ||
| 1760 | |||
| 1761 | gb_backend_map = | ||
| 1762 | si_get_tile_pipe_to_backend_map(rdev, rdev->config.si.num_tile_pipes, | ||
| 1763 | rdev->config.si.num_backends_per_se * | ||
| 1764 | rdev->config.si.num_shader_engines, | ||
| 1765 | &rdev->config.si.backend_disable_mask_per_asic, | ||
| 1766 | rdev->config.si.num_shader_engines); | ||
| 1767 | |||
| 1768 | /* setup tiling info dword. gb_addr_config is not adequate since it does | 1619 | /* setup tiling info dword. gb_addr_config is not adequate since it does |
| 1769 | * not have bank info, so create a custom tiling dword. | 1620 | * not have bank info, so create a custom tiling dword. |
| 1770 | * bits 3:0 num_pipes | 1621 | * bits 3:0 num_pipes |
| @@ -1789,33 +1640,29 @@ static void si_gpu_init(struct radeon_device *rdev) | |||
| 1789 | rdev->config.si.tile_config |= (3 << 0); | 1640 | rdev->config.si.tile_config |= (3 << 0); |
| 1790 | break; | 1641 | break; |
| 1791 | } | 1642 | } |
| 1792 | rdev->config.si.tile_config |= | 1643 | if ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) |
| 1793 | ((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT) << 4; | 1644 | rdev->config.si.tile_config |= 1 << 4; |
| 1645 | else | ||
| 1646 | rdev->config.si.tile_config |= 0 << 4; | ||
| 1794 | rdev->config.si.tile_config |= | 1647 | rdev->config.si.tile_config |= |
| 1795 | ((gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT) << 8; | 1648 | ((gb_addr_config & PIPE_INTERLEAVE_SIZE_MASK) >> PIPE_INTERLEAVE_SIZE_SHIFT) << 8; |
| 1796 | rdev->config.si.tile_config |= | 1649 | rdev->config.si.tile_config |= |
| 1797 | ((gb_addr_config & ROW_SIZE_MASK) >> ROW_SIZE_SHIFT) << 12; | 1650 | ((gb_addr_config & ROW_SIZE_MASK) >> ROW_SIZE_SHIFT) << 12; |
| 1798 | 1651 | ||
| 1799 | rdev->config.si.backend_map = gb_backend_map; | ||
| 1800 | WREG32(GB_ADDR_CONFIG, gb_addr_config); | 1652 | WREG32(GB_ADDR_CONFIG, gb_addr_config); |
| 1801 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); | 1653 | WREG32(DMIF_ADDR_CONFIG, gb_addr_config); |
| 1802 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); | 1654 | WREG32(HDP_ADDR_CONFIG, gb_addr_config); |
| 1803 | 1655 | ||
| 1804 | /* primary versions */ | 1656 | si_tiling_mode_table_init(rdev); |
| 1805 | WREG32(CC_RB_BACKEND_DISABLE, cc_rb_backend_disable); | ||
| 1806 | WREG32(CC_SYS_RB_BACKEND_DISABLE, cc_rb_backend_disable); | ||
| 1807 | WREG32(CC_GC_SHADER_ARRAY_CONFIG, cc_gc_shader_array_config); | ||
| 1808 | |||
| 1809 | WREG32(CGTS_TCC_DISABLE, cgts_tcc_disable); | ||
| 1810 | 1657 | ||
| 1811 | /* user versions */ | 1658 | si_setup_rb(rdev, rdev->config.si.max_shader_engines, |
| 1812 | WREG32(GC_USER_RB_BACKEND_DISABLE, cc_rb_backend_disable); | 1659 | rdev->config.si.max_sh_per_se, |
| 1813 | WREG32(GC_USER_SYS_RB_BACKEND_DISABLE, cc_rb_backend_disable); | 1660 | rdev->config.si.max_backends_per_se); |
| 1814 | WREG32(GC_USER_SHADER_ARRAY_CONFIG, cc_gc_shader_array_config); | ||
| 1815 | 1661 | ||
| 1816 | WREG32(CGTS_USER_TCC_DISABLE, cgts_tcc_disable); | 1662 | si_setup_spi(rdev, rdev->config.si.max_shader_engines, |
| 1663 | rdev->config.si.max_sh_per_se, | ||
| 1664 | rdev->config.si.max_cu_per_sh); | ||
| 1817 | 1665 | ||
| 1818 | si_tiling_mode_table_init(rdev); | ||
| 1819 | 1666 | ||
| 1820 | /* set HW defaults for 3D engine */ | 1667 | /* set HW defaults for 3D engine */ |
| 1821 | WREG32(CP_QUEUE_THRESHOLDS, (ROQ_IB1_START(0x16) | | 1668 | WREG32(CP_QUEUE_THRESHOLDS, (ROQ_IB1_START(0x16) | |
| @@ -2518,12 +2365,12 @@ int si_pcie_gart_enable(struct radeon_device *rdev) | |||
| 2518 | WREG32(0x15DC, 0); | 2365 | WREG32(0x15DC, 0); |
| 2519 | 2366 | ||
| 2520 | /* empty context1-15 */ | 2367 | /* empty context1-15 */ |
| 2521 | /* FIXME start with 1G, once using 2 level pt switch to full | 2368 | /* FIXME start with 4G, once using 2 level pt switch to full |
| 2522 | * vm size space | 2369 | * vm size space |
| 2523 | */ | 2370 | */ |
| 2524 | /* set vm size, must be a multiple of 4 */ | 2371 | /* set vm size, must be a multiple of 4 */ |
| 2525 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); | 2372 | WREG32(VM_CONTEXT1_PAGE_TABLE_START_ADDR, 0); |
| 2526 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, (1 << 30) / RADEON_GPU_PAGE_SIZE); | 2373 | WREG32(VM_CONTEXT1_PAGE_TABLE_END_ADDR, rdev->vm_manager.max_pfn); |
| 2527 | for (i = 1; i < 16; i++) { | 2374 | for (i = 1; i < 16; i++) { |
| 2528 | if (i < 8) | 2375 | if (i < 8) |
| 2529 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), | 2376 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR + (i << 2), |
diff --git a/drivers/gpu/drm/radeon/si_reg.h b/drivers/gpu/drm/radeon/si_reg.h index eda938a7cb6e..501f9d431d57 100644 --- a/drivers/gpu/drm/radeon/si_reg.h +++ b/drivers/gpu/drm/radeon/si_reg.h | |||
| @@ -30,4 +30,76 @@ | |||
| 30 | #define SI_DC_GPIO_HPD_EN 0x65b8 | 30 | #define SI_DC_GPIO_HPD_EN 0x65b8 |
| 31 | #define SI_DC_GPIO_HPD_Y 0x65bc | 31 | #define SI_DC_GPIO_HPD_Y 0x65bc |
| 32 | 32 | ||
| 33 | #define SI_GRPH_CONTROL 0x6804 | ||
| 34 | # define SI_GRPH_DEPTH(x) (((x) & 0x3) << 0) | ||
| 35 | # define SI_GRPH_DEPTH_8BPP 0 | ||
| 36 | # define SI_GRPH_DEPTH_16BPP 1 | ||
| 37 | # define SI_GRPH_DEPTH_32BPP 2 | ||
| 38 | # define SI_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2) | ||
| 39 | # define SI_ADDR_SURF_2_BANK 0 | ||
| 40 | # define SI_ADDR_SURF_4_BANK 1 | ||
| 41 | # define SI_ADDR_SURF_8_BANK 2 | ||
| 42 | # define SI_ADDR_SURF_16_BANK 3 | ||
| 43 | # define SI_GRPH_Z(x) (((x) & 0x3) << 4) | ||
| 44 | # define SI_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6) | ||
| 45 | # define SI_ADDR_SURF_BANK_WIDTH_1 0 | ||
| 46 | # define SI_ADDR_SURF_BANK_WIDTH_2 1 | ||
| 47 | # define SI_ADDR_SURF_BANK_WIDTH_4 2 | ||
| 48 | # define SI_ADDR_SURF_BANK_WIDTH_8 3 | ||
| 49 | # define SI_GRPH_FORMAT(x) (((x) & 0x7) << 8) | ||
| 50 | /* 8 BPP */ | ||
| 51 | # define SI_GRPH_FORMAT_INDEXED 0 | ||
| 52 | /* 16 BPP */ | ||
| 53 | # define SI_GRPH_FORMAT_ARGB1555 0 | ||
| 54 | # define SI_GRPH_FORMAT_ARGB565 1 | ||
| 55 | # define SI_GRPH_FORMAT_ARGB4444 2 | ||
| 56 | # define SI_GRPH_FORMAT_AI88 3 | ||
| 57 | # define SI_GRPH_FORMAT_MONO16 4 | ||
| 58 | # define SI_GRPH_FORMAT_BGRA5551 5 | ||
| 59 | /* 32 BPP */ | ||
| 60 | # define SI_GRPH_FORMAT_ARGB8888 0 | ||
| 61 | # define SI_GRPH_FORMAT_ARGB2101010 1 | ||
| 62 | # define SI_GRPH_FORMAT_32BPP_DIG 2 | ||
| 63 | # define SI_GRPH_FORMAT_8B_ARGB2101010 3 | ||
| 64 | # define SI_GRPH_FORMAT_BGRA1010102 4 | ||
| 65 | # define SI_GRPH_FORMAT_8B_BGRA1010102 5 | ||
| 66 | # define SI_GRPH_FORMAT_RGB111110 6 | ||
| 67 | # define SI_GRPH_FORMAT_BGR101111 7 | ||
| 68 | # define SI_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11) | ||
| 69 | # define SI_ADDR_SURF_BANK_HEIGHT_1 0 | ||
| 70 | # define SI_ADDR_SURF_BANK_HEIGHT_2 1 | ||
| 71 | # define SI_ADDR_SURF_BANK_HEIGHT_4 2 | ||
| 72 | # define SI_ADDR_SURF_BANK_HEIGHT_8 3 | ||
| 73 | # define SI_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13) | ||
| 74 | # define SI_ADDR_SURF_TILE_SPLIT_64B 0 | ||
| 75 | # define SI_ADDR_SURF_TILE_SPLIT_128B 1 | ||
| 76 | # define SI_ADDR_SURF_TILE_SPLIT_256B 2 | ||
| 77 | # define SI_ADDR_SURF_TILE_SPLIT_512B 3 | ||
| 78 | # define SI_ADDR_SURF_TILE_SPLIT_1KB 4 | ||
| 79 | # define SI_ADDR_SURF_TILE_SPLIT_2KB 5 | ||
| 80 | # define SI_ADDR_SURF_TILE_SPLIT_4KB 6 | ||
| 81 | # define SI_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18) | ||
| 82 | # define SI_ADDR_SURF_MACRO_TILE_ASPECT_1 0 | ||
| 83 | # define SI_ADDR_SURF_MACRO_TILE_ASPECT_2 1 | ||
| 84 | # define SI_ADDR_SURF_MACRO_TILE_ASPECT_4 2 | ||
| 85 | # define SI_ADDR_SURF_MACRO_TILE_ASPECT_8 3 | ||
| 86 | # define SI_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) | ||
| 87 | # define SI_GRPH_ARRAY_LINEAR_GENERAL 0 | ||
| 88 | # define SI_GRPH_ARRAY_LINEAR_ALIGNED 1 | ||
| 89 | # define SI_GRPH_ARRAY_1D_TILED_THIN1 2 | ||
| 90 | # define SI_GRPH_ARRAY_2D_TILED_THIN1 4 | ||
| 91 | # define SI_GRPH_PIPE_CONFIG(x) (((x) & 0x1f) << 24) | ||
| 92 | # define SI_ADDR_SURF_P2 0 | ||
| 93 | # define SI_ADDR_SURF_P4_8x16 4 | ||
| 94 | # define SI_ADDR_SURF_P4_16x16 5 | ||
| 95 | # define SI_ADDR_SURF_P4_16x32 6 | ||
| 96 | # define SI_ADDR_SURF_P4_32x32 7 | ||
| 97 | # define SI_ADDR_SURF_P8_16x16_8x16 8 | ||
| 98 | # define SI_ADDR_SURF_P8_16x32_8x16 9 | ||
| 99 | # define SI_ADDR_SURF_P8_32x32_8x16 10 | ||
| 100 | # define SI_ADDR_SURF_P8_16x32_16x16 11 | ||
| 101 | # define SI_ADDR_SURF_P8_32x32_16x16 12 | ||
| 102 | # define SI_ADDR_SURF_P8_32x32_16x32 13 | ||
| 103 | # define SI_ADDR_SURF_P8_32x64_32x32 14 | ||
| 104 | |||
| 33 | #endif | 105 | #endif |
diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h index 53ea2c42dbd6..db4067962868 100644 --- a/drivers/gpu/drm/radeon/sid.h +++ b/drivers/gpu/drm/radeon/sid.h | |||
| @@ -24,6 +24,11 @@ | |||
| 24 | #ifndef SI_H | 24 | #ifndef SI_H |
| 25 | #define SI_H | 25 | #define SI_H |
| 26 | 26 | ||
| 27 | #define TAHITI_RB_BITMAP_WIDTH_PER_SH 2 | ||
| 28 | |||
| 29 | #define TAHITI_GB_ADDR_CONFIG_GOLDEN 0x12011003 | ||
| 30 | #define VERDE_GB_ADDR_CONFIG_GOLDEN 0x12010002 | ||
| 31 | |||
| 27 | #define CG_MULT_THERMAL_STATUS 0x714 | 32 | #define CG_MULT_THERMAL_STATUS 0x714 |
| 28 | #define ASIC_MAX_TEMP(x) ((x) << 0) | 33 | #define ASIC_MAX_TEMP(x) ((x) << 0) |
| 29 | #define ASIC_MAX_TEMP_MASK 0x000001ff | 34 | #define ASIC_MAX_TEMP_MASK 0x000001ff |
| @@ -408,6 +413,12 @@ | |||
| 408 | #define SOFT_RESET_IA (1 << 15) | 413 | #define SOFT_RESET_IA (1 << 15) |
| 409 | 414 | ||
| 410 | #define GRBM_GFX_INDEX 0x802C | 415 | #define GRBM_GFX_INDEX 0x802C |
| 416 | #define INSTANCE_INDEX(x) ((x) << 0) | ||
| 417 | #define SH_INDEX(x) ((x) << 8) | ||
| 418 | #define SE_INDEX(x) ((x) << 16) | ||
| 419 | #define SH_BROADCAST_WRITES (1 << 29) | ||
| 420 | #define INSTANCE_BROADCAST_WRITES (1 << 30) | ||
| 421 | #define SE_BROADCAST_WRITES (1 << 31) | ||
| 411 | 422 | ||
| 412 | #define GRBM_INT_CNTL 0x8060 | 423 | #define GRBM_INT_CNTL 0x8060 |
| 413 | # define RDERR_INT_ENABLE (1 << 0) | 424 | # define RDERR_INT_ENABLE (1 << 0) |
| @@ -480,6 +491,8 @@ | |||
| 480 | #define VGT_TF_MEMORY_BASE 0x89B8 | 491 | #define VGT_TF_MEMORY_BASE 0x89B8 |
| 481 | 492 | ||
| 482 | #define CC_GC_SHADER_ARRAY_CONFIG 0x89bc | 493 | #define CC_GC_SHADER_ARRAY_CONFIG 0x89bc |
| 494 | #define INACTIVE_CUS_MASK 0xFFFF0000 | ||
| 495 | #define INACTIVE_CUS_SHIFT 16 | ||
| 483 | #define GC_USER_SHADER_ARRAY_CONFIG 0x89c0 | 496 | #define GC_USER_SHADER_ARRAY_CONFIG 0x89c0 |
| 484 | 497 | ||
| 485 | #define PA_CL_ENHANCE 0x8A14 | 498 | #define PA_CL_ENHANCE 0x8A14 |
| @@ -688,6 +701,12 @@ | |||
| 688 | #define RLC_MC_CNTL 0xC344 | 701 | #define RLC_MC_CNTL 0xC344 |
| 689 | #define RLC_UCODE_CNTL 0xC348 | 702 | #define RLC_UCODE_CNTL 0xC348 |
| 690 | 703 | ||
| 704 | #define PA_SC_RASTER_CONFIG 0x28350 | ||
| 705 | # define RASTER_CONFIG_RB_MAP_0 0 | ||
| 706 | # define RASTER_CONFIG_RB_MAP_1 1 | ||
| 707 | # define RASTER_CONFIG_RB_MAP_2 2 | ||
| 708 | # define RASTER_CONFIG_RB_MAP_3 3 | ||
| 709 | |||
| 691 | #define VGT_EVENT_INITIATOR 0x28a90 | 710 | #define VGT_EVENT_INITIATOR 0x28a90 |
| 692 | # define SAMPLE_STREAMOUTSTATS1 (1 << 0) | 711 | # define SAMPLE_STREAMOUTSTATS1 (1 << 0) |
| 693 | # define SAMPLE_STREAMOUTSTATS2 (2 << 0) | 712 | # define SAMPLE_STREAMOUTSTATS2 (2 << 0) |
diff --git a/drivers/gpu/drm/sis/sis_drv.c b/drivers/gpu/drm/sis/sis_drv.c index 30d98d14b5c5..dd14cd1a0033 100644 --- a/drivers/gpu/drm/sis/sis_drv.c +++ b/drivers/gpu/drm/sis/sis_drv.c | |||
| @@ -47,9 +47,9 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset) | |||
| 47 | if (dev_priv == NULL) | 47 | if (dev_priv == NULL) |
| 48 | return -ENOMEM; | 48 | return -ENOMEM; |
| 49 | 49 | ||
| 50 | idr_init(&dev_priv->object_idr); | ||
| 50 | dev->dev_private = (void *)dev_priv; | 51 | dev->dev_private = (void *)dev_priv; |
| 51 | dev_priv->chipset = chipset; | 52 | dev_priv->chipset = chipset; |
| 52 | idr_init(&dev->object_name_idr); | ||
| 53 | 53 | ||
| 54 | return 0; | 54 | return 0; |
| 55 | } | 55 | } |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index b67cfcaa661f..36f4b28c1b90 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
| @@ -1204,6 +1204,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, | |||
| 1204 | (*destroy)(bo); | 1204 | (*destroy)(bo); |
| 1205 | else | 1205 | else |
| 1206 | kfree(bo); | 1206 | kfree(bo); |
| 1207 | ttm_mem_global_free(mem_glob, acc_size); | ||
| 1207 | return -EINVAL; | 1208 | return -EINVAL; |
| 1208 | } | 1209 | } |
| 1209 | bo->destroy = destroy; | 1210 | bo->destroy = destroy; |
| @@ -1307,22 +1308,14 @@ int ttm_bo_create(struct ttm_bo_device *bdev, | |||
| 1307 | struct ttm_buffer_object **p_bo) | 1308 | struct ttm_buffer_object **p_bo) |
| 1308 | { | 1309 | { |
| 1309 | struct ttm_buffer_object *bo; | 1310 | struct ttm_buffer_object *bo; |
| 1310 | struct ttm_mem_global *mem_glob = bdev->glob->mem_glob; | ||
| 1311 | size_t acc_size; | 1311 | size_t acc_size; |
| 1312 | int ret; | 1312 | int ret; |
| 1313 | 1313 | ||
| 1314 | acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object)); | ||
| 1315 | ret = ttm_mem_global_alloc(mem_glob, acc_size, false, false); | ||
| 1316 | if (unlikely(ret != 0)) | ||
| 1317 | return ret; | ||
| 1318 | |||
| 1319 | bo = kzalloc(sizeof(*bo), GFP_KERNEL); | 1314 | bo = kzalloc(sizeof(*bo), GFP_KERNEL); |
| 1320 | 1315 | if (unlikely(bo == NULL)) | |
| 1321 | if (unlikely(bo == NULL)) { | ||
| 1322 | ttm_mem_global_free(mem_glob, acc_size); | ||
| 1323 | return -ENOMEM; | 1316 | return -ENOMEM; |
| 1324 | } | ||
| 1325 | 1317 | ||
| 1318 | acc_size = ttm_bo_acc_size(bdev, size, sizeof(struct ttm_buffer_object)); | ||
| 1326 | ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, | 1319 | ret = ttm_bo_init(bdev, bo, size, type, placement, page_alignment, |
| 1327 | buffer_start, interruptible, | 1320 | buffer_start, interruptible, |
| 1328 | persistent_swap_storage, acc_size, NULL, NULL); | 1321 | persistent_swap_storage, acc_size, NULL, NULL); |
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index 4d02c46a9420..6e52069894b3 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c | |||
| @@ -13,8 +13,21 @@ | |||
| 13 | 13 | ||
| 14 | static struct drm_driver driver; | 14 | static struct drm_driver driver; |
| 15 | 15 | ||
| 16 | /* | ||
| 17 | * There are many DisplayLink-based graphics products, all with unique PIDs. | ||
| 18 | * So we match on DisplayLink's VID + Vendor-Defined Interface Class (0xff) | ||
| 19 | * We also require a match on SubClass (0x00) and Protocol (0x00), | ||
| 20 | * which is compatible with all known USB 2.0 era graphics chips and firmware, | ||
| 21 | * but allows DisplayLink to increment those for any future incompatible chips | ||
| 22 | */ | ||
| 16 | static struct usb_device_id id_table[] = { | 23 | static struct usb_device_id id_table[] = { |
| 17 | {.idVendor = 0x17e9, .match_flags = USB_DEVICE_ID_MATCH_VENDOR,}, | 24 | {.idVendor = 0x17e9, .bInterfaceClass = 0xff, |
| 25 | .bInterfaceSubClass = 0x00, | ||
| 26 | .bInterfaceProtocol = 0x00, | ||
| 27 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | | ||
| 28 | USB_DEVICE_ID_MATCH_INT_CLASS | | ||
| 29 | USB_DEVICE_ID_MATCH_INT_SUBCLASS | | ||
| 30 | USB_DEVICE_ID_MATCH_INT_PROTOCOL,}, | ||
| 18 | {}, | 31 | {}, |
| 19 | }; | 32 | }; |
| 20 | MODULE_DEVICE_TABLE(usb, id_table); | 33 | MODULE_DEVICE_TABLE(usb, id_table); |
diff --git a/drivers/gpu/drm/udl/udl_main.c b/drivers/gpu/drm/udl/udl_main.c index a8d5f09428c7..4c2d836a0893 100644 --- a/drivers/gpu/drm/udl/udl_main.c +++ b/drivers/gpu/drm/udl/udl_main.c | |||
| @@ -61,7 +61,7 @@ static int udl_parse_vendor_descriptor(struct drm_device *dev, | |||
| 61 | u8 length; | 61 | u8 length; |
| 62 | u16 key; | 62 | u16 key; |
| 63 | 63 | ||
| 64 | key = *((u16 *) desc); | 64 | key = le16_to_cpu(*((u16 *) desc)); |
| 65 | desc += sizeof(u16); | 65 | desc += sizeof(u16); |
| 66 | length = *desc; | 66 | length = *desc; |
| 67 | desc++; | 67 | desc++; |
diff --git a/drivers/gpu/drm/via/via_map.c b/drivers/gpu/drm/via/via_map.c index 1f182254e81e..c126182ac07e 100644 --- a/drivers/gpu/drm/via/via_map.c +++ b/drivers/gpu/drm/via/via_map.c | |||
| @@ -100,12 +100,11 @@ int via_driver_load(struct drm_device *dev, unsigned long chipset) | |||
| 100 | if (dev_priv == NULL) | 100 | if (dev_priv == NULL) |
| 101 | return -ENOMEM; | 101 | return -ENOMEM; |
| 102 | 102 | ||
| 103 | idr_init(&dev_priv->object_idr); | ||
| 103 | dev->dev_private = (void *)dev_priv; | 104 | dev->dev_private = (void *)dev_priv; |
| 104 | 105 | ||
| 105 | dev_priv->chipset = chipset; | 106 | dev_priv->chipset = chipset; |
| 106 | 107 | ||
| 107 | idr_init(&dev->object_name_idr); | ||
| 108 | |||
| 109 | pci_set_master(dev->pdev); | 108 | pci_set_master(dev->pdev); |
| 110 | 109 | ||
| 111 | ret = drm_vblank_init(dev, 1); | 110 | ret = drm_vblank_init(dev, 1); |
diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index 38f9534ac513..5b3c7d135dc9 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c | |||
| @@ -190,6 +190,19 @@ find_active_client(struct list_head *head) | |||
| 190 | return NULL; | 190 | return NULL; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | int vga_switcheroo_get_client_state(struct pci_dev *pdev) | ||
| 194 | { | ||
| 195 | struct vga_switcheroo_client *client; | ||
| 196 | |||
| 197 | client = find_client_from_pci(&vgasr_priv.clients, pdev); | ||
| 198 | if (!client) | ||
| 199 | return VGA_SWITCHEROO_NOT_FOUND; | ||
| 200 | if (!vgasr_priv.active) | ||
| 201 | return VGA_SWITCHEROO_INIT; | ||
| 202 | return client->pwr_state; | ||
| 203 | } | ||
| 204 | EXPORT_SYMBOL(vga_switcheroo_get_client_state); | ||
| 205 | |||
| 193 | void vga_switcheroo_unregister_client(struct pci_dev *pdev) | 206 | void vga_switcheroo_unregister_client(struct pci_dev *pdev) |
| 194 | { | 207 | { |
| 195 | struct vga_switcheroo_client *client; | 208 | struct vga_switcheroo_client *client; |
| @@ -291,8 +304,6 @@ static int vga_switchto_stage1(struct vga_switcheroo_client *new_client) | |||
| 291 | vga_switchon(new_client); | 304 | vga_switchon(new_client); |
| 292 | 305 | ||
| 293 | vga_set_default_device(new_client->pdev); | 306 | vga_set_default_device(new_client->pdev); |
| 294 | set_audio_state(new_client->id, VGA_SWITCHEROO_ON); | ||
| 295 | |||
| 296 | return 0; | 307 | return 0; |
| 297 | } | 308 | } |
| 298 | 309 | ||
| @@ -308,6 +319,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client) | |||
| 308 | 319 | ||
| 309 | active->active = false; | 320 | active->active = false; |
| 310 | 321 | ||
| 322 | set_audio_state(active->id, VGA_SWITCHEROO_OFF); | ||
| 323 | |||
| 311 | if (new_client->fb_info) { | 324 | if (new_client->fb_info) { |
| 312 | struct fb_event event; | 325 | struct fb_event event; |
| 313 | event.info = new_client->fb_info; | 326 | event.info = new_client->fb_info; |
| @@ -321,11 +334,11 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client) | |||
| 321 | if (new_client->ops->reprobe) | 334 | if (new_client->ops->reprobe) |
| 322 | new_client->ops->reprobe(new_client->pdev); | 335 | new_client->ops->reprobe(new_client->pdev); |
| 323 | 336 | ||
| 324 | set_audio_state(active->id, VGA_SWITCHEROO_OFF); | ||
| 325 | |||
| 326 | if (active->pwr_state == VGA_SWITCHEROO_ON) | 337 | if (active->pwr_state == VGA_SWITCHEROO_ON) |
| 327 | vga_switchoff(active); | 338 | vga_switchoff(active); |
| 328 | 339 | ||
| 340 | set_audio_state(new_client->id, VGA_SWITCHEROO_ON); | ||
| 341 | |||
| 329 | new_client->active = true; | 342 | new_client->active = true; |
| 330 | return 0; | 343 | return 0; |
| 331 | } | 344 | } |
| @@ -371,8 +384,9 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf, | |||
| 371 | /* pwr off the device not in use */ | 384 | /* pwr off the device not in use */ |
| 372 | if (strncmp(usercmd, "OFF", 3) == 0) { | 385 | if (strncmp(usercmd, "OFF", 3) == 0) { |
| 373 | list_for_each_entry(client, &vgasr_priv.clients, list) { | 386 | list_for_each_entry(client, &vgasr_priv.clients, list) { |
| 374 | if (client->active) | 387 | if (client->active || client_is_audio(client)) |
| 375 | continue; | 388 | continue; |
| 389 | set_audio_state(client->id, VGA_SWITCHEROO_OFF); | ||
| 376 | if (client->pwr_state == VGA_SWITCHEROO_ON) | 390 | if (client->pwr_state == VGA_SWITCHEROO_ON) |
| 377 | vga_switchoff(client); | 391 | vga_switchoff(client); |
| 378 | } | 392 | } |
| @@ -381,10 +395,11 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf, | |||
| 381 | /* pwr on the device not in use */ | 395 | /* pwr on the device not in use */ |
| 382 | if (strncmp(usercmd, "ON", 2) == 0) { | 396 | if (strncmp(usercmd, "ON", 2) == 0) { |
| 383 | list_for_each_entry(client, &vgasr_priv.clients, list) { | 397 | list_for_each_entry(client, &vgasr_priv.clients, list) { |
| 384 | if (client->active) | 398 | if (client->active || client_is_audio(client)) |
| 385 | continue; | 399 | continue; |
| 386 | if (client->pwr_state == VGA_SWITCHEROO_OFF) | 400 | if (client->pwr_state == VGA_SWITCHEROO_OFF) |
| 387 | vga_switchon(client); | 401 | vga_switchon(client); |
| 402 | set_audio_state(client->id, VGA_SWITCHEROO_ON); | ||
| 388 | } | 403 | } |
| 389 | goto out; | 404 | goto out; |
| 390 | } | 405 | } |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 034c80a10f1f..3fda8c87f02c 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
| @@ -1,20 +1,11 @@ | |||
| 1 | # | 1 | # |
| 2 | # HID driver configuration | 2 | # HID driver configuration |
| 3 | # | 3 | # |
| 4 | menuconfig HID_SUPPORT | 4 | menu "HID support" |
| 5 | bool "HID Devices" | 5 | depends on INPUT |
| 6 | depends on INPUT | ||
| 7 | default y | ||
| 8 | ---help--- | ||
| 9 | Say Y here to get to see options for various computer-human interface | ||
| 10 | device drivers. This option alone does not add any kernel code. | ||
| 11 | |||
| 12 | If you say N, all options in this submenu will be skipped and disabled. | ||
| 13 | |||
| 14 | if HID_SUPPORT | ||
| 15 | 6 | ||
| 16 | config HID | 7 | config HID |
| 17 | tristate "Generic HID support" | 8 | tristate "HID bus support" |
| 18 | depends on INPUT | 9 | depends on INPUT |
| 19 | default y | 10 | default y |
| 20 | ---help--- | 11 | ---help--- |
| @@ -23,14 +14,17 @@ config HID | |||
| 23 | most commonly used to refer to the USB-HID specification, but other | 14 | most commonly used to refer to the USB-HID specification, but other |
| 24 | devices (such as, but not strictly limited to, Bluetooth) are | 15 | devices (such as, but not strictly limited to, Bluetooth) are |
| 25 | designed using HID specification (this involves certain keyboards, | 16 | designed using HID specification (this involves certain keyboards, |
| 26 | mice, tablets, etc). This option compiles into kernel the generic | 17 | mice, tablets, etc). This option adds the HID bus to the kernel, |
| 27 | HID layer code (parser, usages, etc.), which can then be used by | 18 | together with generic HID layer code. The HID devices are added and |
| 28 | transport-specific HID implementation (like USB or Bluetooth). | 19 | removed from the HID bus by the transport-layer drivers, such as |
| 20 | usbhid (USB_HID) and hidp (BT_HIDP). | ||
| 29 | 21 | ||
| 30 | For docs and specs, see http://www.usb.org/developers/hidpage/ | 22 | For docs and specs, see http://www.usb.org/developers/hidpage/ |
| 31 | 23 | ||
| 32 | If unsure, say Y. | 24 | If unsure, say Y. |
| 33 | 25 | ||
| 26 | if HID | ||
| 27 | |||
| 34 | config HID_BATTERY_STRENGTH | 28 | config HID_BATTERY_STRENGTH |
| 35 | bool "Battery level reporting for HID devices" | 29 | bool "Battery level reporting for HID devices" |
| 36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY | 30 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY |
| @@ -59,23 +53,22 @@ config HIDRAW | |||
| 59 | 53 | ||
| 60 | If unsure, say Y. | 54 | If unsure, say Y. |
| 61 | 55 | ||
| 62 | source "drivers/hid/usbhid/Kconfig" | ||
| 63 | |||
| 64 | menu "Special HID drivers" | ||
| 65 | depends on HID | ||
| 66 | |||
| 67 | config HID_GENERIC | 56 | config HID_GENERIC |
| 68 | tristate "Generic HID driver" | 57 | tristate "Generic HID driver" |
| 69 | depends on HID | 58 | depends on HID |
| 70 | default y | 59 | default HID |
| 71 | ---help--- | 60 | ---help--- |
| 72 | Support for generic HID devices. | 61 | Support for generic devices on the HID bus. This includes most |
| 62 | keyboards and mice, joysticks, tablets and digitizers. | ||
| 73 | 63 | ||
| 74 | To compile this driver as a module, choose M here: the module | 64 | To compile this driver as a module, choose M here: the module |
| 75 | will be called hid-generic. | 65 | will be called hid-generic. |
| 76 | 66 | ||
| 77 | If unsure, say Y. | 67 | If unsure, say Y. |
| 78 | 68 | ||
| 69 | menu "Special HID drivers" | ||
| 70 | depends on HID | ||
| 71 | |||
| 79 | config HID_A4TECH | 72 | config HID_A4TECH |
| 80 | tristate "A4 tech mice" if EXPERT | 73 | tristate "A4 tech mice" if EXPERT |
| 81 | depends on USB_HID | 74 | depends on USB_HID |
| @@ -393,6 +386,7 @@ config HID_MULTITOUCH | |||
| 393 | - Unitec Panels | 386 | - Unitec Panels |
| 394 | - XAT optical touch panels | 387 | - XAT optical touch panels |
| 395 | - Xiroku optical touch panels | 388 | - Xiroku optical touch panels |
| 389 | - Zytronic touch panels | ||
| 396 | 390 | ||
| 397 | If unsure, say N. | 391 | If unsure, say N. |
| 398 | 392 | ||
| @@ -662,4 +656,8 @@ config HID_ZYDACRON | |||
| 662 | 656 | ||
| 663 | endmenu | 657 | endmenu |
| 664 | 658 | ||
| 665 | endif # HID_SUPPORT | 659 | endif # HID |
| 660 | |||
| 661 | source "drivers/hid/usbhid/Kconfig" | ||
| 662 | |||
| 663 | endmenu | ||
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index fa10f847f7db..585344b6d338 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
| @@ -517,6 +517,12 @@ static const struct hid_device_id apple_devices[] = { | |||
| 517 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | 517 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
| 518 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), | 518 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), |
| 519 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | 519 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
| 520 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), | ||
| 521 | .driver_data = APPLE_HAS_FN }, | ||
| 522 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), | ||
| 523 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | ||
| 524 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | ||
| 525 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | ||
| 520 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), | 526 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
| 521 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 527 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
| 522 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), | 528 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 8e3a6b261477..4c87276c8ddb 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1503,6 +1503,9 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
| 1503 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, | 1503 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, |
| 1504 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, | 1504 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, |
| 1505 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, | 1505 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, |
| 1506 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | ||
| 1507 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | ||
| 1508 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | ||
| 1506 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, | 1509 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, |
| 1507 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, | 1510 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, |
| 1508 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1511 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
| @@ -1880,6 +1883,7 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
| 1880 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, | 1883 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, |
| 1881 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, | 1884 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, |
| 1882 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, | 1885 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, |
| 1886 | { HID_USB_DEVICE(USB_VENDOR_ID_AXENTIA, USB_DEVICE_ID_AXENTIA_FM_RADIO) }, | ||
| 1883 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, | 1887 | { HID_USB_DEVICE(USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD) }, |
| 1884 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, | 1888 | { HID_USB_DEVICE(USB_VENDOR_ID_CIDC, 0x0103) }, |
| 1885 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, | 1889 | { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_RADIO_SI470X) }, |
| @@ -1994,6 +1998,7 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
| 1994 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, | 1998 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MCT) }, |
| 1995 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, | 1999 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) }, |
| 1996 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, | 2000 | { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) }, |
| 2001 | { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) }, | ||
| 1997 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, | 2002 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) }, |
| 1998 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, | 2003 | { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) }, |
| 1999 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, | 2004 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) }, |
| @@ -2088,6 +2093,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { | |||
| 2088 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, | 2093 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI) }, |
| 2089 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, | 2094 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO) }, |
| 2090 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, | 2095 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS) }, |
| 2096 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | ||
| 2097 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | ||
| 2098 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | ||
| 2091 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 2099 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
| 2092 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 2100 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
| 2093 | { } | 2101 | { } |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 9373f535dfe9..32039235cfee 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -125,6 +125,9 @@ | |||
| 125 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c | 125 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI 0x024c |
| 126 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d | 126 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_ISO 0x024d |
| 127 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS 0x024e | 127 | #define USB_DEVICE_ID_APPLE_WELLSPRING6_JIS 0x024e |
| 128 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 | ||
| 129 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 | ||
| 130 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 | ||
| 128 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 | 131 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239 |
| 129 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a | 132 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a |
| 130 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b | 133 | #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b |
| @@ -160,6 +163,9 @@ | |||
| 160 | #define USB_VENDOR_ID_AVERMEDIA 0x07ca | 163 | #define USB_VENDOR_ID_AVERMEDIA 0x07ca |
| 161 | #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 | 164 | #define USB_DEVICE_ID_AVER_FM_MR800 0xb800 |
| 162 | 165 | ||
| 166 | #define USB_VENDOR_ID_AXENTIA 0x12cf | ||
| 167 | #define USB_DEVICE_ID_AXENTIA_FM_RADIO 0x7111 | ||
| 168 | |||
| 163 | #define USB_VENDOR_ID_BAANTO 0x2453 | 169 | #define USB_VENDOR_ID_BAANTO 0x2453 |
| 164 | #define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100 | 170 | #define USB_DEVICE_ID_BAANTO_MT_190W2 0x0100 |
| 165 | 171 | ||
| @@ -515,6 +521,9 @@ | |||
| 515 | #define USB_DEVICE_ID_CRYSTALTOUCH 0x0006 | 521 | #define USB_DEVICE_ID_CRYSTALTOUCH 0x0006 |
| 516 | #define USB_DEVICE_ID_CRYSTALTOUCH_DUAL 0x0007 | 522 | #define USB_DEVICE_ID_CRYSTALTOUCH_DUAL 0x0007 |
| 517 | 523 | ||
| 524 | #define USB_VENDOR_ID_MADCATZ 0x0738 | ||
| 525 | #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 | ||
| 526 | |||
| 518 | #define USB_VENDOR_ID_MCC 0x09db | 527 | #define USB_VENDOR_ID_MCC 0x09db |
| 519 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 | 528 | #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 |
| 520 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a | 529 | #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a |
| @@ -650,6 +659,9 @@ | |||
| 650 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 | 659 | #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001 |
| 651 | #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600 | 660 | #define USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE 0x0600 |
| 652 | 661 | ||
| 662 | #define USB_VENDOR_ID_SENNHEISER 0x1395 | ||
| 663 | #define USB_DEVICE_ID_SENNHEISER_BTD500USB 0x002c | ||
| 664 | |||
| 653 | #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f | 665 | #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f |
| 654 | #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 | 666 | #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 |
| 655 | 667 | ||
| @@ -799,6 +811,9 @@ | |||
| 799 | #define USB_VENDOR_ID_ZYDACRON 0x13EC | 811 | #define USB_VENDOR_ID_ZYDACRON 0x13EC |
| 800 | #define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006 | 812 | #define USB_DEVICE_ID_ZYDACRON_REMOTE_CONTROL 0x0006 |
| 801 | 813 | ||
| 814 | #define USB_VENDOR_ID_ZYTRONIC 0x14c8 | ||
| 815 | #define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005 | ||
| 816 | |||
| 802 | #define USB_VENDOR_ID_PRIMAX 0x0461 | 817 | #define USB_VENDOR_ID_PRIMAX 0x0461 |
| 803 | #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05 | 818 | #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05 |
| 804 | 819 | ||
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 132b0019365e..5301006f6c15 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
| @@ -301,6 +301,9 @@ static const struct hid_device_id hid_battery_quirks[] = { | |||
| 301 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | 301 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, |
| 302 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), | 302 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI), |
| 303 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | 303 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, |
| 304 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, | ||
| 305 | USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI), | ||
| 306 | HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE }, | ||
| 304 | {} | 307 | {} |
| 305 | }; | 308 | }; |
| 306 | 309 | ||
diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 5e8a7ed42344..0f9c146fc00d 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c | |||
| @@ -436,27 +436,37 @@ static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, | |||
| 436 | 436 | ||
| 437 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) | 437 | static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev) |
| 438 | { | 438 | { |
| 439 | struct dj_report dj_report; | 439 | struct dj_report *dj_report; |
| 440 | int retval; | ||
| 440 | 441 | ||
| 441 | memset(&dj_report, 0, sizeof(dj_report)); | 442 | dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL); |
| 442 | dj_report.report_id = REPORT_ID_DJ_SHORT; | 443 | if (!dj_report) |
| 443 | dj_report.device_index = 0xFF; | 444 | return -ENOMEM; |
| 444 | dj_report.report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES; | 445 | dj_report->report_id = REPORT_ID_DJ_SHORT; |
| 445 | return logi_dj_recv_send_report(djrcv_dev, &dj_report); | 446 | dj_report->device_index = 0xFF; |
| 447 | dj_report->report_type = REPORT_TYPE_CMD_GET_PAIRED_DEVICES; | ||
| 448 | retval = logi_dj_recv_send_report(djrcv_dev, dj_report); | ||
| 449 | kfree(dj_report); | ||
| 450 | return retval; | ||
| 446 | } | 451 | } |
| 447 | 452 | ||
| 448 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, | 453 | static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, |
| 449 | unsigned timeout) | 454 | unsigned timeout) |
| 450 | { | 455 | { |
| 451 | struct dj_report dj_report; | 456 | struct dj_report *dj_report; |
| 457 | int retval; | ||
| 452 | 458 | ||
| 453 | memset(&dj_report, 0, sizeof(dj_report)); | 459 | dj_report = kzalloc(sizeof(dj_report), GFP_KERNEL); |
| 454 | dj_report.report_id = REPORT_ID_DJ_SHORT; | 460 | if (!dj_report) |
| 455 | dj_report.device_index = 0xFF; | 461 | return -ENOMEM; |
| 456 | dj_report.report_type = REPORT_TYPE_CMD_SWITCH; | 462 | dj_report->report_id = REPORT_ID_DJ_SHORT; |
| 457 | dj_report.report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F; | 463 | dj_report->device_index = 0xFF; |
| 458 | dj_report.report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout; | 464 | dj_report->report_type = REPORT_TYPE_CMD_SWITCH; |
| 459 | return logi_dj_recv_send_report(djrcv_dev, &dj_report); | 465 | dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F; |
| 466 | dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout; | ||
| 467 | retval = logi_dj_recv_send_report(djrcv_dev, dj_report); | ||
| 468 | kfree(dj_report); | ||
| 469 | return retval; | ||
| 460 | } | 470 | } |
| 461 | 471 | ||
| 462 | 472 | ||
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c index 7cf3ffe4b7bc..40ac6654f1d1 100644 --- a/drivers/hid/hid-magicmouse.c +++ b/drivers/hid/hid-magicmouse.c | |||
| @@ -426,8 +426,10 @@ static void magicmouse_setup_input(struct input_dev *input, struct hid_device *h | |||
| 426 | __set_bit(EV_ABS, input->evbit); | 426 | __set_bit(EV_ABS, input->evbit); |
| 427 | 427 | ||
| 428 | input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0); | 428 | input_set_abs_params(input, ABS_MT_TRACKING_ID, 0, 15, 0, 0); |
| 429 | input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255, 4, 0); | 429 | input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, 0, 255 << 2, |
| 430 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255, 4, 0); | 430 | 4, 0); |
| 431 | input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 255 << 2, | ||
| 432 | 4, 0); | ||
| 431 | input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); | 433 | input_set_abs_params(input, ABS_MT_ORIENTATION, -31, 32, 1, 0); |
| 432 | 434 | ||
| 433 | /* Note: Touch Y position from the device is inverted relative | 435 | /* Note: Touch Y position from the device is inverted relative |
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 6e3332a99976..76479246d4ee 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
| @@ -1048,6 +1048,11 @@ static const struct hid_device_id mt_devices[] = { | |||
| 1048 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, | 1048 | MT_USB_DEVICE(USB_VENDOR_ID_XIROKU, |
| 1049 | USB_DEVICE_ID_XIROKU_CSR2) }, | 1049 | USB_DEVICE_ID_XIROKU_CSR2) }, |
| 1050 | 1050 | ||
| 1051 | /* Zytronic panels */ | ||
| 1052 | { .driver_data = MT_CLS_SERIAL, | ||
| 1053 | MT_USB_DEVICE(USB_VENDOR_ID_ZYTRONIC, | ||
| 1054 | USB_DEVICE_ID_ZYTRONIC_ZXY100) }, | ||
| 1055 | |||
| 1051 | /* Generic MT device */ | 1056 | /* Generic MT device */ |
| 1052 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, | 1057 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, |
| 1053 | { } | 1058 | { } |
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig index 0f20fd17cf06..0108c5991a04 100644 --- a/drivers/hid/usbhid/Kconfig +++ b/drivers/hid/usbhid/Kconfig | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | comment "USB Input Devices" | 1 | menu "USB HID support" |
| 2 | depends on USB | 2 | depends on USB |
| 3 | 3 | ||
| 4 | config USB_HID | 4 | config USB_HID |
| 5 | tristate "USB Human Interface Device (full HID) support" | 5 | tristate "USB HID transport layer" |
| 6 | default y | 6 | default y |
| 7 | depends on USB && INPUT | 7 | depends on USB && INPUT |
| 8 | select HID | 8 | select HID |
| 9 | ---help--- | 9 | ---help--- |
| 10 | Say Y here if you want full HID support to connect USB keyboards, | 10 | Say Y here if you want to connect USB keyboards, |
| 11 | mice, joysticks, graphic tablets, or any other HID based devices | 11 | mice, joysticks, graphic tablets, or any other HID based devices |
| 12 | to your computer via USB, as well as Uninterruptible Power Supply | 12 | to your computer via USB, as well as Uninterruptible Power Supply |
| 13 | (UPS) and monitor control devices. | 13 | (UPS) and monitor control devices. |
| @@ -81,4 +81,4 @@ config USB_MOUSE | |||
| 81 | 81 | ||
| 82 | endmenu | 82 | endmenu |
| 83 | 83 | ||
| 84 | 84 | endmenu | |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 0597ee604f6e..903eef3d3e10 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -76,6 +76,7 @@ static const struct hid_blacklist { | |||
| 76 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, | 76 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, |
| 77 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, | 77 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, |
| 78 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, | 78 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, |
| 79 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, | ||
| 79 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | 80 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, |
| 80 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, | 81 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, |
| 81 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, | 82 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, |
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index f082e48ab113..2cde9ecf7731 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | * | 8 | * |
| 9 | * Based on hdaps.c driver: | 9 | * Based on hdaps.c driver: |
| 10 | * Copyright (C) 2005 Robert Love <rml@novell.com> | 10 | * Copyright (C) 2005 Robert Love <rml@novell.com> |
| 11 | * Copyright (C) 2005 Jesper Juhl <jesper.juhl@gmail.com> | 11 | * Copyright (C) 2005 Jesper Juhl <jj@chaosbits.net> |
| 12 | * | 12 | * |
| 13 | * Fan control based on smcFanControl: | 13 | * Fan control based on smcFanControl: |
| 14 | * Copyright (C) 2006 Hendrik Holtmann <holtmann@mac.com> | 14 | * Copyright (C) 2006 Hendrik Holtmann <holtmann@mac.com> |
| @@ -215,7 +215,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) | |||
| 215 | int i; | 215 | int i; |
| 216 | 216 | ||
| 217 | if (send_command(cmd) || send_argument(key)) { | 217 | if (send_command(cmd) || send_argument(key)) { |
| 218 | pr_warn("%s: read arg fail\n", key); | 218 | pr_warn("%.4s: read arg fail\n", key); |
| 219 | return -EIO; | 219 | return -EIO; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| @@ -223,7 +223,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len) | |||
| 223 | 223 | ||
| 224 | for (i = 0; i < len; i++) { | 224 | for (i = 0; i < len; i++) { |
| 225 | if (__wait_status(0x05)) { | 225 | if (__wait_status(0x05)) { |
| 226 | pr_warn("%s: read data fail\n", key); | 226 | pr_warn("%.4s: read data fail\n", key); |
| 227 | return -EIO; | 227 | return -EIO; |
| 228 | } | 228 | } |
| 229 | buffer[i] = inb(APPLESMC_DATA_PORT); | 229 | buffer[i] = inb(APPLESMC_DATA_PORT); |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index b9d512331ed4..637c51c11b44 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
| @@ -191,6 +191,24 @@ static ssize_t show_temp(struct device *dev, | |||
| 191 | return tdata->valid ? sprintf(buf, "%d\n", tdata->temp) : -EAGAIN; | 191 | return tdata->valid ? sprintf(buf, "%d\n", tdata->temp) : -EAGAIN; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | struct tjmax { | ||
| 195 | char const *id; | ||
| 196 | int tjmax; | ||
| 197 | }; | ||
| 198 | |||
| 199 | static struct tjmax __cpuinitconst tjmax_table[] = { | ||
| 200 | { "CPU D410", 100000 }, | ||
| 201 | { "CPU D425", 100000 }, | ||
| 202 | { "CPU D510", 100000 }, | ||
| 203 | { "CPU D525", 100000 }, | ||
| 204 | { "CPU N450", 100000 }, | ||
| 205 | { "CPU N455", 100000 }, | ||
| 206 | { "CPU N470", 100000 }, | ||
| 207 | { "CPU N475", 100000 }, | ||
| 208 | { "CPU 230", 100000 }, | ||
| 209 | { "CPU 330", 125000 }, | ||
| 210 | }; | ||
| 211 | |||
| 194 | static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, | 212 | static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, |
| 195 | struct device *dev) | 213 | struct device *dev) |
| 196 | { | 214 | { |
| @@ -202,6 +220,13 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, | |||
| 202 | int err; | 220 | int err; |
| 203 | u32 eax, edx; | 221 | u32 eax, edx; |
| 204 | struct pci_dev *host_bridge; | 222 | struct pci_dev *host_bridge; |
| 223 | int i; | ||
| 224 | |||
| 225 | /* explicit tjmax table entries override heuristics */ | ||
| 226 | for (i = 0; i < ARRAY_SIZE(tjmax_table); i++) { | ||
| 227 | if (strstr(c->x86_model_id, tjmax_table[i].id)) | ||
| 228 | return tjmax_table[i].tjmax; | ||
| 229 | } | ||
| 205 | 230 | ||
| 206 | /* Early chips have no MSR for TjMax */ | 231 | /* Early chips have no MSR for TjMax */ |
| 207 | 232 | ||
| @@ -210,7 +235,8 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, | |||
| 210 | 235 | ||
| 211 | /* Atom CPUs */ | 236 | /* Atom CPUs */ |
| 212 | 237 | ||
| 213 | if (c->x86_model == 0x1c) { | 238 | if (c->x86_model == 0x1c || c->x86_model == 0x26 |
| 239 | || c->x86_model == 0x27) { | ||
| 214 | usemsr_ee = 0; | 240 | usemsr_ee = 0; |
| 215 | 241 | ||
| 216 | host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); | 242 | host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0)); |
| @@ -223,6 +249,9 @@ static int __cpuinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, | |||
| 223 | tjmax = 90000; | 249 | tjmax = 90000; |
| 224 | 250 | ||
| 225 | pci_dev_put(host_bridge); | 251 | pci_dev_put(host_bridge); |
| 252 | } else if (c->x86_model == 0x36) { | ||
| 253 | usemsr_ee = 0; | ||
| 254 | tjmax = 100000; | ||
| 226 | } | 255 | } |
| 227 | 256 | ||
| 228 | if (c->x86_model > 0xe && usemsr_ee) { | 257 | if (c->x86_model > 0xe && usemsr_ee) { |
| @@ -664,7 +693,7 @@ static void __cpuinit get_core_online(unsigned int cpu) | |||
| 664 | * sensors. We check this bit only, all the early CPUs | 693 | * sensors. We check this bit only, all the early CPUs |
| 665 | * without thermal sensors will be filtered out. | 694 | * without thermal sensors will be filtered out. |
| 666 | */ | 695 | */ |
| 667 | if (!cpu_has(c, X86_FEATURE_DTS)) | 696 | if (!cpu_has(c, X86_FEATURE_DTHERM)) |
| 668 | return; | 697 | return; |
| 669 | 698 | ||
| 670 | if (!pdev) { | 699 | if (!pdev) { |
| @@ -765,14 +794,14 @@ static struct notifier_block coretemp_cpu_notifier __refdata = { | |||
| 765 | }; | 794 | }; |
| 766 | 795 | ||
| 767 | static const struct x86_cpu_id coretemp_ids[] = { | 796 | static const struct x86_cpu_id coretemp_ids[] = { |
| 768 | { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTS }, | 797 | { X86_VENDOR_INTEL, X86_FAMILY_ANY, X86_MODEL_ANY, X86_FEATURE_DTHERM }, |
| 769 | {} | 798 | {} |
| 770 | }; | 799 | }; |
| 771 | MODULE_DEVICE_TABLE(x86cpu, coretemp_ids); | 800 | MODULE_DEVICE_TABLE(x86cpu, coretemp_ids); |
| 772 | 801 | ||
| 773 | static int __init coretemp_init(void) | 802 | static int __init coretemp_init(void) |
| 774 | { | 803 | { |
| 775 | int i, err = -ENODEV; | 804 | int i, err; |
| 776 | 805 | ||
| 777 | /* | 806 | /* |
| 778 | * CPUID.06H.EAX[0] indicates whether the CPU has thermal | 807 | * CPUID.06H.EAX[0] indicates whether the CPU has thermal |
diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c index 9691f664c76e..e7d234b59312 100644 --- a/drivers/hwmon/emc2103.c +++ b/drivers/hwmon/emc2103.c | |||
| @@ -451,11 +451,15 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da, | |||
| 451 | data->fan_rpm_control = true; | 451 | data->fan_rpm_control = true; |
| 452 | break; | 452 | break; |
| 453 | default: | 453 | default: |
| 454 | mutex_unlock(&data->update_lock); | 454 | count = -EINVAL; |
| 455 | return -EINVAL; | 455 | goto err; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg); | 458 | result = read_u8_from_i2c(client, REG_FAN_CONF1, &conf_reg); |
| 459 | if (result) { | ||
| 460 | count = result; | ||
| 461 | goto err; | ||
| 462 | } | ||
| 459 | 463 | ||
| 460 | if (data->fan_rpm_control) | 464 | if (data->fan_rpm_control) |
| 461 | conf_reg |= 0x80; | 465 | conf_reg |= 0x80; |
| @@ -463,7 +467,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da, | |||
| 463 | conf_reg &= ~0x80; | 467 | conf_reg &= ~0x80; |
| 464 | 468 | ||
| 465 | i2c_smbus_write_byte_data(client, REG_FAN_CONF1, conf_reg); | 469 | i2c_smbus_write_byte_data(client, REG_FAN_CONF1, conf_reg); |
| 466 | 470 | err: | |
| 467 | mutex_unlock(&data->update_lock); | 471 | mutex_unlock(&data->update_lock); |
| 468 | return count; | 472 | return count; |
| 469 | } | 473 | } |
diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index e7701d99f8e8..f1de3979181f 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c | |||
| @@ -2341,7 +2341,7 @@ static void __devinit it87_init_device(struct platform_device *pdev) | |||
| 2341 | 2341 | ||
| 2342 | /* Start monitoring */ | 2342 | /* Start monitoring */ |
| 2343 | it87_write_value(data, IT87_REG_CONFIG, | 2343 | it87_write_value(data, IT87_REG_CONFIG, |
| 2344 | (it87_read_value(data, IT87_REG_CONFIG) & 0x36) | 2344 | (it87_read_value(data, IT87_REG_CONFIG) & 0x3e) |
| 2345 | | (update_vbat ? 0x41 : 0x01)); | 2345 | | (update_vbat ? 0x41 : 0x01)); |
| 2346 | } | 2346 | } |
| 2347 | 2347 | ||
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c index a9bfd6736d9a..e72ba5d2a824 100644 --- a/drivers/hwmon/jc42.c +++ b/drivers/hwmon/jc42.c | |||
| @@ -590,6 +590,6 @@ abort: | |||
| 590 | 590 | ||
| 591 | module_i2c_driver(jc42_driver); | 591 | module_i2c_driver(jc42_driver); |
| 592 | 592 | ||
| 593 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); | 593 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
| 594 | MODULE_DESCRIPTION("JC42 driver"); | 594 | MODULE_DESCRIPTION("JC42 driver"); |
| 595 | MODULE_LICENSE("GPL"); | 595 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c index d264937c7f5e..bd75d2415432 100644 --- a/drivers/hwmon/lineage-pem.c +++ b/drivers/hwmon/lineage-pem.c | |||
| @@ -567,6 +567,6 @@ static struct i2c_driver pem_driver = { | |||
| 567 | 567 | ||
| 568 | module_i2c_driver(pem_driver); | 568 | module_i2c_driver(pem_driver); |
| 569 | 569 | ||
| 570 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); | 570 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
| 571 | MODULE_DESCRIPTION("Lineage CPL PEM hardware monitoring driver"); | 571 | MODULE_DESCRIPTION("Lineage CPL PEM hardware monitoring driver"); |
| 572 | MODULE_LICENSE("GPL"); | 572 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/ltc4261.c b/drivers/hwmon/ltc4261.c index 069b7d34d8f9..77476a575c4e 100644 --- a/drivers/hwmon/ltc4261.c +++ b/drivers/hwmon/ltc4261.c | |||
| @@ -292,6 +292,6 @@ static struct i2c_driver ltc4261_driver = { | |||
| 292 | 292 | ||
| 293 | module_i2c_driver(ltc4261_driver); | 293 | module_i2c_driver(ltc4261_driver); |
| 294 | 294 | ||
| 295 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); | 295 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
| 296 | MODULE_DESCRIPTION("LTC4261 driver"); | 296 | MODULE_DESCRIPTION("LTC4261 driver"); |
| 297 | MODULE_LICENSE("GPL"); | 297 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/max16065.c b/drivers/hwmon/max16065.c index 822261be84dd..019427d7a5fd 100644 --- a/drivers/hwmon/max16065.c +++ b/drivers/hwmon/max16065.c | |||
| @@ -692,6 +692,6 @@ static struct i2c_driver max16065_driver = { | |||
| 692 | 692 | ||
| 693 | module_i2c_driver(max16065_driver); | 693 | module_i2c_driver(max16065_driver); |
| 694 | 694 | ||
| 695 | MODULE_AUTHOR("Guenter Roeck <guenter.roeck@ericsson.com>"); | 695 | MODULE_AUTHOR("Guenter Roeck <linux@roeck-us.net>"); |
| 696 | MODULE_DESCRIPTION("MAX16065 driver"); | 696 | MODULE_DESCRIPTION("MAX16065 driver"); |
| 697 | MODULE_LICENSE("GPL"); | 697 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwspinlock/hwspinlock_core.c b/drivers/hwspinlock/hwspinlock_core.c index 61c9cf15fa52..1201a15784c3 100644 --- a/drivers/hwspinlock/hwspinlock_core.c +++ b/drivers/hwspinlock/hwspinlock_core.c | |||
| @@ -345,7 +345,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, | |||
| 345 | spin_lock_init(&hwlock->lock); | 345 | spin_lock_init(&hwlock->lock); |
| 346 | hwlock->bank = bank; | 346 | hwlock->bank = bank; |
| 347 | 347 | ||
| 348 | ret = hwspin_lock_register_single(hwlock, i); | 348 | ret = hwspin_lock_register_single(hwlock, base_id + i); |
| 349 | if (ret) | 349 | if (ret) |
| 350 | goto reg_failed; | 350 | goto reg_failed; |
| 351 | } | 351 | } |
| @@ -354,7 +354,7 @@ int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, | |||
| 354 | 354 | ||
| 355 | reg_failed: | 355 | reg_failed: |
| 356 | while (--i >= 0) | 356 | while (--i >= 0) |
| 357 | hwspin_lock_unregister_single(i); | 357 | hwspin_lock_unregister_single(base_id + i); |
| 358 | return ret; | 358 | return ret; |
| 359 | } | 359 | } |
| 360 | EXPORT_SYMBOL_GPL(hwspin_lock_register); | 360 | EXPORT_SYMBOL_GPL(hwspin_lock_register); |
diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index beb2491db274..a0edd9854218 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig | |||
| @@ -37,4 +37,16 @@ config I2C_MUX_PCA954x | |||
| 37 | This driver can also be built as a module. If so, the module | 37 | This driver can also be built as a module. If so, the module |
| 38 | will be called i2c-mux-pca954x. | 38 | will be called i2c-mux-pca954x. |
| 39 | 39 | ||
| 40 | config I2C_MUX_PINCTRL | ||
| 41 | tristate "pinctrl-based I2C multiplexer" | ||
| 42 | depends on PINCTRL | ||
| 43 | help | ||
| 44 | If you say yes to this option, support will be included for an I2C | ||
| 45 | multiplexer that uses the pinctrl subsystem, i.e. pin multiplexing. | ||
| 46 | This is useful for SoCs whose I2C module's signals can be routed to | ||
| 47 | different sets of pins at run-time. | ||
| 48 | |||
| 49 | This driver can also be built as a module. If so, the module will be | ||
| 50 | called pinctrl-i2cmux. | ||
| 51 | |||
| 40 | endmenu | 52 | endmenu |
diff --git a/drivers/i2c/muxes/Makefile b/drivers/i2c/muxes/Makefile index 5826249b29ca..76da8692afff 100644 --- a/drivers/i2c/muxes/Makefile +++ b/drivers/i2c/muxes/Makefile | |||
| @@ -4,5 +4,6 @@ | |||
| 4 | obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o | 4 | obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o |
| 5 | obj-$(CONFIG_I2C_MUX_PCA9541) += i2c-mux-pca9541.o | 5 | obj-$(CONFIG_I2C_MUX_PCA9541) += i2c-mux-pca9541.o |
| 6 | obj-$(CONFIG_I2C_MUX_PCA954x) += i2c-mux-pca954x.o | 6 | obj-$(CONFIG_I2C_MUX_PCA954x) += i2c-mux-pca954x.o |
| 7 | obj-$(CONFIG_I2C_MUX_PINCTRL) += i2c-mux-pinctrl.o | ||
| 7 | 8 | ||
| 8 | ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG | 9 | ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG |
diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c new file mode 100644 index 000000000000..46a669763476 --- /dev/null +++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c | |||
| @@ -0,0 +1,279 @@ | |||
| 1 | /* | ||
| 2 | * I2C multiplexer using pinctrl API | ||
| 3 | * | ||
| 4 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms and conditions of the GNU General Public License, | ||
| 8 | * version 2, as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | * more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/i2c.h> | ||
| 20 | #include <linux/i2c-mux.h> | ||
| 21 | #include <linux/init.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | #include <linux/of_i2c.h> | ||
| 24 | #include <linux/pinctrl/consumer.h> | ||
| 25 | #include <linux/i2c-mux-pinctrl.h> | ||
| 26 | #include <linux/platform_device.h> | ||
| 27 | #include <linux/slab.h> | ||
| 28 | |||
| 29 | struct i2c_mux_pinctrl { | ||
| 30 | struct device *dev; | ||
| 31 | struct i2c_mux_pinctrl_platform_data *pdata; | ||
| 32 | struct pinctrl *pinctrl; | ||
| 33 | struct pinctrl_state **states; | ||
| 34 | struct pinctrl_state *state_idle; | ||
| 35 | struct i2c_adapter *parent; | ||
| 36 | struct i2c_adapter **busses; | ||
| 37 | }; | ||
| 38 | |||
| 39 | static int i2c_mux_pinctrl_select(struct i2c_adapter *adap, void *data, | ||
| 40 | u32 chan) | ||
| 41 | { | ||
| 42 | struct i2c_mux_pinctrl *mux = data; | ||
| 43 | |||
| 44 | return pinctrl_select_state(mux->pinctrl, mux->states[chan]); | ||
| 45 | } | ||
| 46 | |||
| 47 | static int i2c_mux_pinctrl_deselect(struct i2c_adapter *adap, void *data, | ||
| 48 | u32 chan) | ||
| 49 | { | ||
| 50 | struct i2c_mux_pinctrl *mux = data; | ||
| 51 | |||
| 52 | return pinctrl_select_state(mux->pinctrl, mux->state_idle); | ||
| 53 | } | ||
| 54 | |||
| 55 | #ifdef CONFIG_OF | ||
| 56 | static int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux, | ||
| 57 | struct platform_device *pdev) | ||
| 58 | { | ||
| 59 | struct device_node *np = pdev->dev.of_node; | ||
| 60 | int num_names, i, ret; | ||
| 61 | struct device_node *adapter_np; | ||
| 62 | struct i2c_adapter *adapter; | ||
| 63 | |||
| 64 | if (!np) | ||
| 65 | return 0; | ||
| 66 | |||
| 67 | mux->pdata = devm_kzalloc(&pdev->dev, sizeof(*mux->pdata), GFP_KERNEL); | ||
| 68 | if (!mux->pdata) { | ||
| 69 | dev_err(mux->dev, | ||
| 70 | "Cannot allocate i2c_mux_pinctrl_platform_data\n"); | ||
| 71 | return -ENOMEM; | ||
| 72 | } | ||
| 73 | |||
| 74 | num_names = of_property_count_strings(np, "pinctrl-names"); | ||
| 75 | if (num_names < 0) { | ||
| 76 | dev_err(mux->dev, "Cannot parse pinctrl-names: %d\n", | ||
| 77 | num_names); | ||
| 78 | return num_names; | ||
| 79 | } | ||
| 80 | |||
| 81 | mux->pdata->pinctrl_states = devm_kzalloc(&pdev->dev, | ||
| 82 | sizeof(*mux->pdata->pinctrl_states) * num_names, | ||
| 83 | GFP_KERNEL); | ||
| 84 | if (!mux->pdata->pinctrl_states) { | ||
| 85 | dev_err(mux->dev, "Cannot allocate pinctrl_states\n"); | ||
| 86 | return -ENOMEM; | ||
| 87 | } | ||
| 88 | |||
| 89 | for (i = 0; i < num_names; i++) { | ||
| 90 | ret = of_property_read_string_index(np, "pinctrl-names", i, | ||
| 91 | &mux->pdata->pinctrl_states[mux->pdata->bus_count]); | ||
| 92 | if (ret < 0) { | ||
| 93 | dev_err(mux->dev, "Cannot parse pinctrl-names: %d\n", | ||
| 94 | ret); | ||
| 95 | return ret; | ||
| 96 | } | ||
| 97 | if (!strcmp(mux->pdata->pinctrl_states[mux->pdata->bus_count], | ||
| 98 | "idle")) { | ||
| 99 | if (i != num_names - 1) { | ||
| 100 | dev_err(mux->dev, "idle state must be last\n"); | ||
| 101 | return -EINVAL; | ||
| 102 | } | ||
| 103 | mux->pdata->pinctrl_state_idle = "idle"; | ||
| 104 | } else { | ||
| 105 | mux->pdata->bus_count++; | ||
| 106 | } | ||
| 107 | } | ||
| 108 | |||
| 109 | adapter_np = of_parse_phandle(np, "i2c-parent", 0); | ||
| 110 | if (!adapter_np) { | ||
| 111 | dev_err(mux->dev, "Cannot parse i2c-parent\n"); | ||
| 112 | return -ENODEV; | ||
| 113 | } | ||
| 114 | adapter = of_find_i2c_adapter_by_node(adapter_np); | ||
| 115 | if (!adapter) { | ||
| 116 | dev_err(mux->dev, "Cannot find parent bus\n"); | ||
| 117 | return -ENODEV; | ||
| 118 | } | ||
| 119 | mux->pdata->parent_bus_num = i2c_adapter_id(adapter); | ||
| 120 | put_device(&adapter->dev); | ||
| 121 | |||
| 122 | return 0; | ||
| 123 | } | ||
| 124 | #else | ||
| 125 | static inline int i2c_mux_pinctrl_parse_dt(struct i2c_mux_pinctrl *mux, | ||
| 126 | struct platform_device *pdev) | ||
| 127 | { | ||
| 128 | return 0; | ||
| 129 | } | ||
| 130 | #endif | ||
| 131 | |||
| 132 | static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev) | ||
| 133 | { | ||
| 134 | struct i2c_mux_pinctrl *mux; | ||
| 135 | int (*deselect)(struct i2c_adapter *, void *, u32); | ||
| 136 | int i, ret; | ||
| 137 | |||
| 138 | mux = devm_kzalloc(&pdev->dev, sizeof(*mux), GFP_KERNEL); | ||
| 139 | if (!mux) { | ||
| 140 | dev_err(&pdev->dev, "Cannot allocate i2c_mux_pinctrl\n"); | ||
| 141 | ret = -ENOMEM; | ||
| 142 | goto err; | ||
| 143 | } | ||
| 144 | platform_set_drvdata(pdev, mux); | ||
| 145 | |||
| 146 | mux->dev = &pdev->dev; | ||
| 147 | |||
| 148 | mux->pdata = pdev->dev.platform_data; | ||
| 149 | if (!mux->pdata) { | ||
| 150 | ret = i2c_mux_pinctrl_parse_dt(mux, pdev); | ||
| 151 | if (ret < 0) | ||
| 152 | goto err; | ||
| 153 | } | ||
| 154 | if (!mux->pdata) { | ||
| 155 | dev_err(&pdev->dev, "Missing platform data\n"); | ||
| 156 | ret = -ENODEV; | ||
| 157 | goto err; | ||
| 158 | } | ||
| 159 | |||
| 160 | mux->states = devm_kzalloc(&pdev->dev, | ||
| 161 | sizeof(*mux->states) * mux->pdata->bus_count, | ||
| 162 | GFP_KERNEL); | ||
| 163 | if (!mux->states) { | ||
| 164 | dev_err(&pdev->dev, "Cannot allocate states\n"); | ||
| 165 | ret = -ENOMEM; | ||
| 166 | goto err; | ||
| 167 | } | ||
| 168 | |||
| 169 | mux->busses = devm_kzalloc(&pdev->dev, | ||
| 170 | sizeof(mux->busses) * mux->pdata->bus_count, | ||
| 171 | GFP_KERNEL); | ||
| 172 | if (!mux->states) { | ||
| 173 | dev_err(&pdev->dev, "Cannot allocate busses\n"); | ||
| 174 | ret = -ENOMEM; | ||
| 175 | goto err; | ||
| 176 | } | ||
| 177 | |||
| 178 | mux->pinctrl = devm_pinctrl_get(&pdev->dev); | ||
| 179 | if (IS_ERR(mux->pinctrl)) { | ||
| 180 | ret = PTR_ERR(mux->pinctrl); | ||
| 181 | dev_err(&pdev->dev, "Cannot get pinctrl: %d\n", ret); | ||
| 182 | goto err; | ||
| 183 | } | ||
| 184 | for (i = 0; i < mux->pdata->bus_count; i++) { | ||
| 185 | mux->states[i] = pinctrl_lookup_state(mux->pinctrl, | ||
| 186 | mux->pdata->pinctrl_states[i]); | ||
| 187 | if (IS_ERR(mux->states[i])) { | ||
| 188 | ret = PTR_ERR(mux->states[i]); | ||
| 189 | dev_err(&pdev->dev, | ||
| 190 | "Cannot look up pinctrl state %s: %d\n", | ||
| 191 | mux->pdata->pinctrl_states[i], ret); | ||
| 192 | goto err; | ||
| 193 | } | ||
| 194 | } | ||
| 195 | if (mux->pdata->pinctrl_state_idle) { | ||
| 196 | mux->state_idle = pinctrl_lookup_state(mux->pinctrl, | ||
| 197 | mux->pdata->pinctrl_state_idle); | ||
| 198 | if (IS_ERR(mux->state_idle)) { | ||
| 199 | ret = PTR_ERR(mux->state_idle); | ||
| 200 | dev_err(&pdev->dev, | ||
| 201 | "Cannot look up pinctrl state %s: %d\n", | ||
| 202 | mux->pdata->pinctrl_state_idle, ret); | ||
| 203 | goto err; | ||
| 204 | } | ||
| 205 | |||
| 206 | deselect = i2c_mux_pinctrl_deselect; | ||
| 207 | } else { | ||
| 208 | deselect = NULL; | ||
| 209 | } | ||
| 210 | |||
| 211 | mux->parent = i2c_get_adapter(mux->pdata->parent_bus_num); | ||
| 212 | if (!mux->parent) { | ||
| 213 | dev_err(&pdev->dev, "Parent adapter (%d) not found\n", | ||
| 214 | mux->pdata->parent_bus_num); | ||
| 215 | ret = -ENODEV; | ||
| 216 | goto err; | ||
| 217 | } | ||
| 218 | |||
| 219 | for (i = 0; i < mux->pdata->bus_count; i++) { | ||
| 220 | u32 bus = mux->pdata->base_bus_num ? | ||
| 221 | (mux->pdata->base_bus_num + i) : 0; | ||
| 222 | |||
| 223 | mux->busses[i] = i2c_add_mux_adapter(mux->parent, &pdev->dev, | ||
| 224 | mux, bus, i, | ||
| 225 | i2c_mux_pinctrl_select, | ||
| 226 | deselect); | ||
| 227 | if (!mux->busses[i]) { | ||
| 228 | ret = -ENODEV; | ||
| 229 | dev_err(&pdev->dev, "Failed to add adapter %d\n", i); | ||
| 230 | goto err_del_adapter; | ||
| 231 | } | ||
| 232 | } | ||
| 233 | |||
| 234 | return 0; | ||
| 235 | |||
| 236 | err_del_adapter: | ||
| 237 | for (; i > 0; i--) | ||
| 238 | i2c_del_mux_adapter(mux->busses[i - 1]); | ||
| 239 | i2c_put_adapter(mux->parent); | ||
| 240 | err: | ||
| 241 | return ret; | ||
| 242 | } | ||
| 243 | |||
| 244 | static int __devexit i2c_mux_pinctrl_remove(struct platform_device *pdev) | ||
| 245 | { | ||
| 246 | struct i2c_mux_pinctrl *mux = platform_get_drvdata(pdev); | ||
| 247 | int i; | ||
| 248 | |||
| 249 | for (i = 0; i < mux->pdata->bus_count; i++) | ||
| 250 | i2c_del_mux_adapter(mux->busses[i]); | ||
| 251 | |||
| 252 | i2c_put_adapter(mux->parent); | ||
| 253 | |||
| 254 | return 0; | ||
| 255 | } | ||
| 256 | |||
| 257 | #ifdef CONFIG_OF | ||
| 258 | static const struct of_device_id i2c_mux_pinctrl_of_match[] __devinitconst = { | ||
| 259 | { .compatible = "i2c-mux-pinctrl", }, | ||
| 260 | {}, | ||
| 261 | }; | ||
| 262 | MODULE_DEVICE_TABLE(of, i2c_mux_pinctrl_of_match); | ||
| 263 | #endif | ||
| 264 | |||
| 265 | static struct platform_driver i2c_mux_pinctrl_driver = { | ||
| 266 | .driver = { | ||
| 267 | .name = "i2c-mux-pinctrl", | ||
| 268 | .owner = THIS_MODULE, | ||
| 269 | .of_match_table = of_match_ptr(i2c_mux_pinctrl_of_match), | ||
| 270 | }, | ||
| 271 | .probe = i2c_mux_pinctrl_probe, | ||
| 272 | .remove = __devexit_p(i2c_mux_pinctrl_remove), | ||
| 273 | }; | ||
| 274 | module_platform_driver(i2c_mux_pinctrl_driver); | ||
| 275 | |||
| 276 | MODULE_DESCRIPTION("pinctrl-based I2C multiplexer driver"); | ||
| 277 | MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); | ||
| 278 | MODULE_LICENSE("GPL v2"); | ||
| 279 | MODULE_ALIAS("platform:i2c-mux-pinctrl"); | ||
diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 8716066a2f2b..bcb507b0cfd4 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c | |||
| @@ -236,7 +236,7 @@ static const struct ide_port_ops icside_v6_no_dma_port_ops = { | |||
| 236 | */ | 236 | */ |
| 237 | static void icside_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) | 237 | static void icside_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) |
| 238 | { | 238 | { |
| 239 | unsigned long cycle_time; | 239 | unsigned long cycle_time = 0; |
| 240 | int use_dma_info = 0; | 240 | int use_dma_info = 0; |
| 241 | const u8 xfer_mode = drive->dma_mode; | 241 | const u8 xfer_mode = drive->dma_mode; |
| 242 | 242 | ||
| @@ -271,9 +271,9 @@ static void icside_set_dma_mode(ide_hwif_t *hwif, ide_drive_t *drive) | |||
| 271 | 271 | ||
| 272 | ide_set_drivedata(drive, (void *)cycle_time); | 272 | ide_set_drivedata(drive, (void *)cycle_time); |
| 273 | 273 | ||
| 274 | printk("%s: %s selected (peak %dMB/s)\n", drive->name, | 274 | printk(KERN_INFO "%s: %s selected (peak %luMB/s)\n", |
| 275 | ide_xfer_verbose(xfer_mode), | 275 | drive->name, ide_xfer_verbose(xfer_mode), |
| 276 | 2000 / (unsigned long)ide_get_drivedata(drive)); | 276 | 2000 / (cycle_time ? cycle_time : (unsigned long) -1)); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | static const struct ide_port_ops icside_v6_port_ops = { | 279 | static const struct ide_port_ops icside_v6_port_ops = { |
| @@ -375,8 +375,6 @@ static const struct ide_dma_ops icside_v6_dma_ops = { | |||
| 375 | .dma_test_irq = icside_dma_test_irq, | 375 | .dma_test_irq = icside_dma_test_irq, |
| 376 | .dma_lost_irq = ide_dma_lost_irq, | 376 | .dma_lost_irq = ide_dma_lost_irq, |
| 377 | }; | 377 | }; |
| 378 | #else | ||
| 379 | #define icside_v6_dma_ops NULL | ||
| 380 | #endif | 378 | #endif |
| 381 | 379 | ||
| 382 | static int icside_dma_off_init(ide_hwif_t *hwif, const struct ide_port_info *d) | 380 | static int icside_dma_off_init(ide_hwif_t *hwif, const struct ide_port_info *d) |
| @@ -456,7 +454,6 @@ err_free: | |||
| 456 | static const struct ide_port_info icside_v6_port_info __initdata = { | 454 | static const struct ide_port_info icside_v6_port_info __initdata = { |
| 457 | .init_dma = icside_dma_off_init, | 455 | .init_dma = icside_dma_off_init, |
| 458 | .port_ops = &icside_v6_no_dma_port_ops, | 456 | .port_ops = &icside_v6_no_dma_port_ops, |
| 459 | .dma_ops = &icside_v6_dma_ops, | ||
| 460 | .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_MMIO, | 457 | .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_MMIO, |
| 461 | .mwdma_mask = ATA_MWDMA2, | 458 | .mwdma_mask = ATA_MWDMA2, |
| 462 | .swdma_mask = ATA_SWDMA2, | 459 | .swdma_mask = ATA_SWDMA2, |
| @@ -518,11 +515,13 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
| 518 | 515 | ||
| 519 | ecard_set_drvdata(ec, state); | 516 | ecard_set_drvdata(ec, state); |
| 520 | 517 | ||
| 518 | #ifdef CONFIG_BLK_DEV_IDEDMA_ICS | ||
| 521 | if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) { | 519 | if (ec->dma != NO_DMA && !request_dma(ec->dma, DRV_NAME)) { |
| 522 | d.init_dma = icside_dma_init; | 520 | d.init_dma = icside_dma_init; |
| 523 | d.port_ops = &icside_v6_port_ops; | 521 | d.port_ops = &icside_v6_port_ops; |
| 524 | } else | 522 | d.dma_ops = &icside_v6_dma_ops; |
| 525 | d.dma_ops = NULL; | 523 | } |
| 524 | #endif | ||
| 526 | 525 | ||
| 527 | ret = ide_host_register(host, &d, hws); | 526 | ret = ide_host_register(host, &d, hws); |
| 528 | if (ret) | 527 | if (ret) |
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 28e344ea514c..f1e922e2479a 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c | |||
| @@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data) | |||
| 167 | { | 167 | { |
| 168 | int *is_kme = priv_data; | 168 | int *is_kme = priv_data; |
| 169 | 169 | ||
| 170 | if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) { | 170 | if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH) |
| 171 | != IO_DATA_PATH_WIDTH_8) { | ||
| 171 | pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | 172 | pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
| 172 | pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | 173 | pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
| 173 | } | 174 | } |
diff --git a/drivers/iio/Kconfig b/drivers/iio/Kconfig index 56eecefcec75..2ec93da41e2c 100644 --- a/drivers/iio/Kconfig +++ b/drivers/iio/Kconfig | |||
| @@ -8,8 +8,7 @@ menuconfig IIO | |||
| 8 | help | 8 | help |
| 9 | The industrial I/O subsystem provides a unified framework for | 9 | The industrial I/O subsystem provides a unified framework for |
| 10 | drivers for many different types of embedded sensors using a | 10 | drivers for many different types of embedded sensors using a |
| 11 | number of different physical interfaces (i2c, spi, etc). See | 11 | number of different physical interfaces (i2c, spi, etc). |
| 12 | Documentation/iio for more information. | ||
| 13 | 12 | ||
| 14 | if IIO | 13 | if IIO |
| 15 | 14 | ||
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 1ddd8861c71b..4f947e4377ef 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c | |||
| @@ -661,7 +661,6 @@ static int iio_device_register_sysfs(struct iio_dev *indio_dev) | |||
| 661 | * New channel registration method - relies on the fact a group does | 661 | * New channel registration method - relies on the fact a group does |
| 662 | * not need to be initialized if it is name is NULL. | 662 | * not need to be initialized if it is name is NULL. |
| 663 | */ | 663 | */ |
| 664 | INIT_LIST_HEAD(&indio_dev->channel_attr_list); | ||
| 665 | if (indio_dev->channels) | 664 | if (indio_dev->channels) |
| 666 | for (i = 0; i < indio_dev->num_channels; i++) { | 665 | for (i = 0; i < indio_dev->num_channels; i++) { |
| 667 | ret = iio_device_add_channel_sysfs(indio_dev, | 666 | ret = iio_device_add_channel_sysfs(indio_dev, |
| @@ -725,12 +724,16 @@ static void iio_device_unregister_sysfs(struct iio_dev *indio_dev) | |||
| 725 | static void iio_dev_release(struct device *device) | 724 | static void iio_dev_release(struct device *device) |
| 726 | { | 725 | { |
| 727 | struct iio_dev *indio_dev = dev_to_iio_dev(device); | 726 | struct iio_dev *indio_dev = dev_to_iio_dev(device); |
| 728 | cdev_del(&indio_dev->chrdev); | 727 | if (indio_dev->chrdev.dev) |
| 728 | cdev_del(&indio_dev->chrdev); | ||
| 729 | if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) | 729 | if (indio_dev->modes & INDIO_BUFFER_TRIGGERED) |
| 730 | iio_device_unregister_trigger_consumer(indio_dev); | 730 | iio_device_unregister_trigger_consumer(indio_dev); |
| 731 | iio_device_unregister_eventset(indio_dev); | 731 | iio_device_unregister_eventset(indio_dev); |
| 732 | iio_device_unregister_sysfs(indio_dev); | 732 | iio_device_unregister_sysfs(indio_dev); |
| 733 | iio_device_unregister_debugfs(indio_dev); | 733 | iio_device_unregister_debugfs(indio_dev); |
| 734 | |||
| 735 | ida_simple_remove(&iio_ida, indio_dev->id); | ||
| 736 | kfree(indio_dev); | ||
| 734 | } | 737 | } |
| 735 | 738 | ||
| 736 | static struct device_type iio_dev_type = { | 739 | static struct device_type iio_dev_type = { |
| @@ -761,6 +764,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv) | |||
| 761 | dev_set_drvdata(&dev->dev, (void *)dev); | 764 | dev_set_drvdata(&dev->dev, (void *)dev); |
| 762 | mutex_init(&dev->mlock); | 765 | mutex_init(&dev->mlock); |
| 763 | mutex_init(&dev->info_exist_lock); | 766 | mutex_init(&dev->info_exist_lock); |
| 767 | INIT_LIST_HEAD(&dev->channel_attr_list); | ||
| 764 | 768 | ||
| 765 | dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); | 769 | dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); |
| 766 | if (dev->id < 0) { | 770 | if (dev->id < 0) { |
| @@ -778,10 +782,8 @@ EXPORT_SYMBOL(iio_device_alloc); | |||
| 778 | 782 | ||
| 779 | void iio_device_free(struct iio_dev *dev) | 783 | void iio_device_free(struct iio_dev *dev) |
| 780 | { | 784 | { |
| 781 | if (dev) { | 785 | if (dev) |
| 782 | ida_simple_remove(&iio_ida, dev->id); | 786 | put_device(&dev->dev); |
| 783 | kfree(dev); | ||
| 784 | } | ||
| 785 | } | 787 | } |
| 786 | EXPORT_SYMBOL(iio_device_free); | 788 | EXPORT_SYMBOL(iio_device_free); |
| 787 | 789 | ||
| @@ -902,7 +904,7 @@ void iio_device_unregister(struct iio_dev *indio_dev) | |||
| 902 | mutex_lock(&indio_dev->info_exist_lock); | 904 | mutex_lock(&indio_dev->info_exist_lock); |
| 903 | indio_dev->info = NULL; | 905 | indio_dev->info = NULL; |
| 904 | mutex_unlock(&indio_dev->info_exist_lock); | 906 | mutex_unlock(&indio_dev->info_exist_lock); |
| 905 | device_unregister(&indio_dev->dev); | 907 | device_del(&indio_dev->dev); |
| 906 | } | 908 | } |
| 907 | EXPORT_SYMBOL(iio_device_unregister); | 909 | EXPORT_SYMBOL(iio_device_unregister); |
| 908 | subsys_initcall(iio_init); | 910 | subsys_initcall(iio_init); |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 55d5642eb10a..2e826f9702c6 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
| @@ -1184,7 +1184,7 @@ static void cma_set_req_event_data(struct rdma_cm_event *event, | |||
| 1184 | 1184 | ||
| 1185 | static int cma_check_req_qp_type(struct rdma_cm_id *id, struct ib_cm_event *ib_event) | 1185 | static int cma_check_req_qp_type(struct rdma_cm_id *id, struct ib_cm_event *ib_event) |
| 1186 | { | 1186 | { |
| 1187 | return (((ib_event->event == IB_CM_REQ_RECEIVED) || | 1187 | return (((ib_event->event == IB_CM_REQ_RECEIVED) && |
| 1188 | (ib_event->param.req_rcvd.qp_type == id->qp_type)) || | 1188 | (ib_event->param.req_rcvd.qp_type == id->qp_type)) || |
| 1189 | ((ib_event->event == IB_CM_SIDR_REQ_RECEIVED) && | 1189 | ((ib_event->event == IB_CM_SIDR_REQ_RECEIVED) && |
| 1190 | (id->qp_type == IB_QPT_UD)) || | 1190 | (id->qp_type == IB_QPT_UD)) || |
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 55ab284e22f2..b18870c455ad 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c | |||
| @@ -1593,6 +1593,10 @@ static int import_ep(struct c4iw_ep *ep, __be32 peer_ip, struct dst_entry *dst, | |||
| 1593 | struct net_device *pdev; | 1593 | struct net_device *pdev; |
| 1594 | 1594 | ||
| 1595 | pdev = ip_dev_find(&init_net, peer_ip); | 1595 | pdev = ip_dev_find(&init_net, peer_ip); |
| 1596 | if (!pdev) { | ||
| 1597 | err = -ENODEV; | ||
| 1598 | goto out; | ||
| 1599 | } | ||
| 1596 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, | 1600 | ep->l2t = cxgb4_l2t_get(cdev->rdev.lldi.l2t, |
| 1597 | n, pdev, 0); | 1601 | n, pdev, 0); |
| 1598 | if (!ep->l2t) | 1602 | if (!ep->l2t) |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index ee1c577238f7..3530c41fcd1f 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
| @@ -140,7 +140,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, | |||
| 140 | props->max_mr_size = ~0ull; | 140 | props->max_mr_size = ~0ull; |
| 141 | props->page_size_cap = dev->dev->caps.page_size_cap; | 141 | props->page_size_cap = dev->dev->caps.page_size_cap; |
| 142 | props->max_qp = dev->dev->caps.num_qps - dev->dev->caps.reserved_qps; | 142 | props->max_qp = dev->dev->caps.num_qps - dev->dev->caps.reserved_qps; |
| 143 | props->max_qp_wr = dev->dev->caps.max_wqes; | 143 | props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE; |
| 144 | props->max_sge = min(dev->dev->caps.max_sq_sg, | 144 | props->max_sge = min(dev->dev->caps.max_sq_sg, |
| 145 | dev->dev->caps.max_rq_sg); | 145 | dev->dev->caps.max_rq_sg); |
| 146 | props->max_cq = dev->dev->caps.num_cqs - dev->dev->caps.reserved_cqs; | 146 | props->max_cq = dev->dev->caps.num_cqs - dev->dev->caps.reserved_cqs; |
| @@ -1084,12 +1084,9 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) | |||
| 1084 | int total_eqs = 0; | 1084 | int total_eqs = 0; |
| 1085 | int i, j, eq; | 1085 | int i, j, eq; |
| 1086 | 1086 | ||
| 1087 | /* Init eq table */ | 1087 | /* Legacy mode or comp_pool is not large enough */ |
| 1088 | ibdev->eq_table = NULL; | 1088 | if (dev->caps.comp_pool == 0 || |
| 1089 | ibdev->eq_added = 0; | 1089 | dev->caps.num_ports > dev->caps.comp_pool) |
| 1090 | |||
| 1091 | /* Legacy mode? */ | ||
| 1092 | if (dev->caps.comp_pool == 0) | ||
| 1093 | return; | 1090 | return; |
| 1094 | 1091 | ||
| 1095 | eq_per_port = rounddown_pow_of_two(dev->caps.comp_pool/ | 1092 | eq_per_port = rounddown_pow_of_two(dev->caps.comp_pool/ |
| @@ -1135,7 +1132,10 @@ static void mlx4_ib_alloc_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) | |||
| 1135 | static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) | 1132 | static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) |
| 1136 | { | 1133 | { |
| 1137 | int i; | 1134 | int i; |
| 1138 | int total_eqs; | 1135 | |
| 1136 | /* no additional eqs were added */ | ||
| 1137 | if (!ibdev->eq_table) | ||
| 1138 | return; | ||
| 1139 | 1139 | ||
| 1140 | /* Reset the advertised EQ number */ | 1140 | /* Reset the advertised EQ number */ |
| 1141 | ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; | 1141 | ibdev->ib_dev.num_comp_vectors = dev->caps.num_comp_vectors; |
| @@ -1148,12 +1148,7 @@ static void mlx4_ib_free_eqs(struct mlx4_dev *dev, struct mlx4_ib_dev *ibdev) | |||
| 1148 | mlx4_release_eq(dev, ibdev->eq_table[i]); | 1148 | mlx4_release_eq(dev, ibdev->eq_table[i]); |
| 1149 | } | 1149 | } |
| 1150 | 1150 | ||
| 1151 | total_eqs = dev->caps.num_comp_vectors + ibdev->eq_added; | ||
| 1152 | memset(ibdev->eq_table, 0, total_eqs * sizeof(int)); | ||
| 1153 | kfree(ibdev->eq_table); | 1151 | kfree(ibdev->eq_table); |
| 1154 | |||
| 1155 | ibdev->eq_table = NULL; | ||
| 1156 | ibdev->eq_added = 0; | ||
| 1157 | } | 1152 | } |
| 1158 | 1153 | ||
| 1159 | static void *mlx4_ib_add(struct mlx4_dev *dev) | 1154 | static void *mlx4_ib_add(struct mlx4_dev *dev) |
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h index e62297cc77cc..ff36655d23d3 100644 --- a/drivers/infiniband/hw/mlx4/mlx4_ib.h +++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h | |||
| @@ -44,6 +44,14 @@ | |||
| 44 | #include <linux/mlx4/device.h> | 44 | #include <linux/mlx4/device.h> |
| 45 | #include <linux/mlx4/doorbell.h> | 45 | #include <linux/mlx4/doorbell.h> |
| 46 | 46 | ||
| 47 | enum { | ||
| 48 | MLX4_IB_SQ_MIN_WQE_SHIFT = 6, | ||
| 49 | MLX4_IB_MAX_HEADROOM = 2048 | ||
| 50 | }; | ||
| 51 | |||
| 52 | #define MLX4_IB_SQ_HEADROOM(shift) ((MLX4_IB_MAX_HEADROOM >> (shift)) + 1) | ||
| 53 | #define MLX4_IB_SQ_MAX_SPARE (MLX4_IB_SQ_HEADROOM(MLX4_IB_SQ_MIN_WQE_SHIFT)) | ||
| 54 | |||
| 47 | struct mlx4_ib_ucontext { | 55 | struct mlx4_ib_ucontext { |
| 48 | struct ib_ucontext ibucontext; | 56 | struct ib_ucontext ibucontext; |
| 49 | struct mlx4_uar uar; | 57 | struct mlx4_uar uar; |
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index ceb33327091a..8d4ed24aef93 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
| @@ -310,8 +310,8 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
| 310 | int is_user, int has_rq, struct mlx4_ib_qp *qp) | 310 | int is_user, int has_rq, struct mlx4_ib_qp *qp) |
| 311 | { | 311 | { |
| 312 | /* Sanity check RQ size before proceeding */ | 312 | /* Sanity check RQ size before proceeding */ |
| 313 | if (cap->max_recv_wr > dev->dev->caps.max_wqes || | 313 | if (cap->max_recv_wr > dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE || |
| 314 | cap->max_recv_sge > dev->dev->caps.max_rq_sg) | 314 | cap->max_recv_sge > min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg)) |
| 315 | return -EINVAL; | 315 | return -EINVAL; |
| 316 | 316 | ||
| 317 | if (!has_rq) { | 317 | if (!has_rq) { |
| @@ -329,8 +329,17 @@ static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
| 329 | qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg)); | 329 | qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg)); |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | cap->max_recv_wr = qp->rq.max_post = qp->rq.wqe_cnt; | 332 | /* leave userspace return values as they were, so as not to break ABI */ |
| 333 | cap->max_recv_sge = qp->rq.max_gs; | 333 | if (is_user) { |
| 334 | cap->max_recv_wr = qp->rq.max_post = qp->rq.wqe_cnt; | ||
| 335 | cap->max_recv_sge = qp->rq.max_gs; | ||
| 336 | } else { | ||
| 337 | cap->max_recv_wr = qp->rq.max_post = | ||
| 338 | min(dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE, qp->rq.wqe_cnt); | ||
| 339 | cap->max_recv_sge = min(qp->rq.max_gs, | ||
| 340 | min(dev->dev->caps.max_sq_sg, | ||
| 341 | dev->dev->caps.max_rq_sg)); | ||
| 342 | } | ||
| 334 | 343 | ||
| 335 | return 0; | 344 | return 0; |
| 336 | } | 345 | } |
| @@ -341,8 +350,8 @@ static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, | |||
| 341 | int s; | 350 | int s; |
| 342 | 351 | ||
| 343 | /* Sanity check SQ size before proceeding */ | 352 | /* Sanity check SQ size before proceeding */ |
| 344 | if (cap->max_send_wr > dev->dev->caps.max_wqes || | 353 | if (cap->max_send_wr > (dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE) || |
| 345 | cap->max_send_sge > dev->dev->caps.max_sq_sg || | 354 | cap->max_send_sge > min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg) || |
| 346 | cap->max_inline_data + send_wqe_overhead(type, qp->flags) + | 355 | cap->max_inline_data + send_wqe_overhead(type, qp->flags) + |
| 347 | sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz) | 356 | sizeof (struct mlx4_wqe_inline_seg) > dev->dev->caps.max_sq_desc_sz) |
| 348 | return -EINVAL; | 357 | return -EINVAL; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma.h b/drivers/infiniband/hw/ocrdma/ocrdma.h index 85a69c958559..48970af23679 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma.h | |||
| @@ -61,6 +61,7 @@ struct ocrdma_dev_attr { | |||
| 61 | u32 max_inline_data; | 61 | u32 max_inline_data; |
| 62 | int max_send_sge; | 62 | int max_send_sge; |
| 63 | int max_recv_sge; | 63 | int max_recv_sge; |
| 64 | int max_srq_sge; | ||
| 64 | int max_mr; | 65 | int max_mr; |
| 65 | u64 max_mr_size; | 66 | u64 max_mr_size; |
| 66 | u32 max_num_mr_pbl; | 67 | u32 max_num_mr_pbl; |
| @@ -231,7 +232,6 @@ struct ocrdma_qp_hwq_info { | |||
| 231 | u32 entry_size; | 232 | u32 entry_size; |
| 232 | u32 max_cnt; | 233 | u32 max_cnt; |
| 233 | u32 max_wqe_idx; | 234 | u32 max_wqe_idx; |
| 234 | u32 free_delta; | ||
| 235 | u16 dbid; /* qid, where to ring the doorbell. */ | 235 | u16 dbid; /* qid, where to ring the doorbell. */ |
| 236 | u32 len; | 236 | u32 len; |
| 237 | dma_addr_t pa; | 237 | dma_addr_t pa; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_abi.h b/drivers/infiniband/hw/ocrdma/ocrdma_abi.h index a411a4e3193d..517ab20b727c 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_abi.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_abi.h | |||
| @@ -101,8 +101,6 @@ struct ocrdma_create_qp_uresp { | |||
| 101 | u32 rsvd1; | 101 | u32 rsvd1; |
| 102 | u32 num_wqe_allocated; | 102 | u32 num_wqe_allocated; |
| 103 | u32 num_rqe_allocated; | 103 | u32 num_rqe_allocated; |
| 104 | u32 free_wqe_delta; | ||
| 105 | u32 free_rqe_delta; | ||
| 106 | u32 db_sq_offset; | 104 | u32 db_sq_offset; |
| 107 | u32 db_rq_offset; | 105 | u32 db_rq_offset; |
| 108 | u32 db_shift; | 106 | u32 db_shift; |
| @@ -126,8 +124,7 @@ struct ocrdma_create_srq_uresp { | |||
| 126 | u32 db_rq_offset; | 124 | u32 db_rq_offset; |
| 127 | u32 db_shift; | 125 | u32 db_shift; |
| 128 | 126 | ||
| 129 | u32 free_rqe_delta; | 127 | u64 rsvd2; |
| 130 | u32 rsvd2; | ||
| 131 | u64 rsvd3; | 128 | u64 rsvd3; |
| 132 | } __packed; | 129 | } __packed; |
| 133 | 130 | ||
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 9b204b1ba336..71942af4fce9 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c | |||
| @@ -732,7 +732,7 @@ static void ocrdma_dispatch_ibevent(struct ocrdma_dev *dev, | |||
| 732 | break; | 732 | break; |
| 733 | case OCRDMA_SRQ_LIMIT_EVENT: | 733 | case OCRDMA_SRQ_LIMIT_EVENT: |
| 734 | ib_evt.element.srq = &qp->srq->ibsrq; | 734 | ib_evt.element.srq = &qp->srq->ibsrq; |
| 735 | ib_evt.event = IB_EVENT_QP_LAST_WQE_REACHED; | 735 | ib_evt.event = IB_EVENT_SRQ_LIMIT_REACHED; |
| 736 | srq_event = 1; | 736 | srq_event = 1; |
| 737 | qp_event = 0; | 737 | qp_event = 0; |
| 738 | break; | 738 | break; |
| @@ -990,8 +990,6 @@ static void ocrdma_get_attr(struct ocrdma_dev *dev, | |||
| 990 | struct ocrdma_dev_attr *attr, | 990 | struct ocrdma_dev_attr *attr, |
| 991 | struct ocrdma_mbx_query_config *rsp) | 991 | struct ocrdma_mbx_query_config *rsp) |
| 992 | { | 992 | { |
| 993 | int max_q_mem; | ||
| 994 | |||
| 995 | attr->max_pd = | 993 | attr->max_pd = |
| 996 | (rsp->max_pd_ca_ack_delay & OCRDMA_MBX_QUERY_CFG_MAX_PD_MASK) >> | 994 | (rsp->max_pd_ca_ack_delay & OCRDMA_MBX_QUERY_CFG_MAX_PD_MASK) >> |
| 997 | OCRDMA_MBX_QUERY_CFG_MAX_PD_SHIFT; | 995 | OCRDMA_MBX_QUERY_CFG_MAX_PD_SHIFT; |
| @@ -1004,6 +1002,9 @@ static void ocrdma_get_attr(struct ocrdma_dev *dev, | |||
| 1004 | attr->max_recv_sge = (rsp->max_write_send_sge & | 1002 | attr->max_recv_sge = (rsp->max_write_send_sge & |
| 1005 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK) >> | 1003 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK) >> |
| 1006 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT; | 1004 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT; |
| 1005 | attr->max_srq_sge = (rsp->max_srq_rqe_sge & | ||
| 1006 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_MASK) >> | ||
| 1007 | OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET; | ||
| 1007 | attr->max_ord_per_qp = (rsp->max_ird_ord_per_qp & | 1008 | attr->max_ord_per_qp = (rsp->max_ird_ord_per_qp & |
| 1008 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK) >> | 1009 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK) >> |
| 1009 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT; | 1010 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT; |
| @@ -1037,18 +1038,15 @@ static void ocrdma_get_attr(struct ocrdma_dev *dev, | |||
| 1037 | attr->max_inline_data = | 1038 | attr->max_inline_data = |
| 1038 | attr->wqe_size - (sizeof(struct ocrdma_hdr_wqe) + | 1039 | attr->wqe_size - (sizeof(struct ocrdma_hdr_wqe) + |
| 1039 | sizeof(struct ocrdma_sge)); | 1040 | sizeof(struct ocrdma_sge)); |
| 1040 | max_q_mem = OCRDMA_Q_PAGE_BASE_SIZE << (OCRDMA_MAX_Q_PAGE_SIZE_CNT - 1); | ||
| 1041 | /* hw can queue one less then the configured size, | ||
| 1042 | * so publish less by one to stack. | ||
| 1043 | */ | ||
| 1044 | if (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) { | 1041 | if (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) { |
| 1045 | dev->attr.max_wqe = max_q_mem / dev->attr.wqe_size; | ||
| 1046 | attr->ird = 1; | 1042 | attr->ird = 1; |
| 1047 | attr->ird_page_size = OCRDMA_MIN_Q_PAGE_SIZE; | 1043 | attr->ird_page_size = OCRDMA_MIN_Q_PAGE_SIZE; |
| 1048 | attr->num_ird_pages = MAX_OCRDMA_IRD_PAGES; | 1044 | attr->num_ird_pages = MAX_OCRDMA_IRD_PAGES; |
| 1049 | } else | 1045 | } |
| 1050 | dev->attr.max_wqe = (max_q_mem / dev->attr.wqe_size) - 1; | 1046 | dev->attr.max_wqe = rsp->max_wqes_rqes_per_q >> |
| 1051 | dev->attr.max_rqe = (max_q_mem / dev->attr.rqe_size) - 1; | 1047 | OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET; |
| 1048 | dev->attr.max_rqe = rsp->max_wqes_rqes_per_q & | ||
| 1049 | OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_MASK; | ||
| 1052 | } | 1050 | } |
| 1053 | 1051 | ||
| 1054 | static int ocrdma_check_fw_config(struct ocrdma_dev *dev, | 1052 | static int ocrdma_check_fw_config(struct ocrdma_dev *dev, |
| @@ -1990,19 +1988,12 @@ static void ocrdma_get_create_qp_rsp(struct ocrdma_create_qp_rsp *rsp, | |||
| 1990 | max_wqe_allocated = 1 << max_wqe_allocated; | 1988 | max_wqe_allocated = 1 << max_wqe_allocated; |
| 1991 | max_rqe_allocated = 1 << ((u16)rsp->max_wqe_rqe); | 1989 | max_rqe_allocated = 1 << ((u16)rsp->max_wqe_rqe); |
| 1992 | 1990 | ||
| 1993 | if (qp->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) { | ||
| 1994 | qp->sq.free_delta = 0; | ||
| 1995 | qp->rq.free_delta = 1; | ||
| 1996 | } else | ||
| 1997 | qp->sq.free_delta = 1; | ||
| 1998 | |||
| 1999 | qp->sq.max_cnt = max_wqe_allocated; | 1991 | qp->sq.max_cnt = max_wqe_allocated; |
| 2000 | qp->sq.max_wqe_idx = max_wqe_allocated - 1; | 1992 | qp->sq.max_wqe_idx = max_wqe_allocated - 1; |
| 2001 | 1993 | ||
| 2002 | if (!attrs->srq) { | 1994 | if (!attrs->srq) { |
| 2003 | qp->rq.max_cnt = max_rqe_allocated; | 1995 | qp->rq.max_cnt = max_rqe_allocated; |
| 2004 | qp->rq.max_wqe_idx = max_rqe_allocated - 1; | 1996 | qp->rq.max_wqe_idx = max_rqe_allocated - 1; |
| 2005 | qp->rq.free_delta = 1; | ||
| 2006 | } | 1997 | } |
| 2007 | } | 1998 | } |
| 2008 | 1999 | ||
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c index a20d16eaae71..b050e629e9c3 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | *******************************************************************/ | 26 | *******************************************************************/ |
| 27 | 27 | ||
| 28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 29 | #include <linux/version.h> | ||
| 30 | #include <linux/idr.h> | 29 | #include <linux/idr.h> |
| 31 | #include <rdma/ib_verbs.h> | 30 | #include <rdma/ib_verbs.h> |
| 32 | #include <rdma/ib_user_verbs.h> | 31 | #include <rdma/ib_user_verbs.h> |
| @@ -98,13 +97,11 @@ static void ocrdma_build_sgid_mac(union ib_gid *sgid, unsigned char *mac_addr, | |||
| 98 | sgid->raw[15] = mac_addr[5]; | 97 | sgid->raw[15] = mac_addr[5]; |
| 99 | } | 98 | } |
| 100 | 99 | ||
| 101 | static void ocrdma_add_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr, | 100 | static bool ocrdma_add_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr, |
| 102 | bool is_vlan, u16 vlan_id) | 101 | bool is_vlan, u16 vlan_id) |
| 103 | { | 102 | { |
| 104 | int i; | 103 | int i; |
| 105 | bool found = false; | ||
| 106 | union ib_gid new_sgid; | 104 | union ib_gid new_sgid; |
| 107 | int free_idx = OCRDMA_MAX_SGID; | ||
| 108 | unsigned long flags; | 105 | unsigned long flags; |
| 109 | 106 | ||
| 110 | memset(&ocrdma_zero_sgid, 0, sizeof(union ib_gid)); | 107 | memset(&ocrdma_zero_sgid, 0, sizeof(union ib_gid)); |
| @@ -116,23 +113,19 @@ static void ocrdma_add_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr, | |||
| 116 | if (!memcmp(&dev->sgid_tbl[i], &ocrdma_zero_sgid, | 113 | if (!memcmp(&dev->sgid_tbl[i], &ocrdma_zero_sgid, |
| 117 | sizeof(union ib_gid))) { | 114 | sizeof(union ib_gid))) { |
| 118 | /* found free entry */ | 115 | /* found free entry */ |
| 119 | if (!found) { | 116 | memcpy(&dev->sgid_tbl[i], &new_sgid, |
| 120 | free_idx = i; | 117 | sizeof(union ib_gid)); |
| 121 | found = true; | 118 | spin_unlock_irqrestore(&dev->sgid_lock, flags); |
| 122 | break; | 119 | return true; |
| 123 | } | ||
| 124 | } else if (!memcmp(&dev->sgid_tbl[i], &new_sgid, | 120 | } else if (!memcmp(&dev->sgid_tbl[i], &new_sgid, |
| 125 | sizeof(union ib_gid))) { | 121 | sizeof(union ib_gid))) { |
| 126 | /* entry already present, no addition is required. */ | 122 | /* entry already present, no addition is required. */ |
| 127 | spin_unlock_irqrestore(&dev->sgid_lock, flags); | 123 | spin_unlock_irqrestore(&dev->sgid_lock, flags); |
| 128 | return; | 124 | return false; |
| 129 | } | 125 | } |
| 130 | } | 126 | } |
| 131 | /* if entry doesn't exist and if table has some space, add entry */ | ||
| 132 | if (found) | ||
| 133 | memcpy(&dev->sgid_tbl[free_idx], &new_sgid, | ||
| 134 | sizeof(union ib_gid)); | ||
| 135 | spin_unlock_irqrestore(&dev->sgid_lock, flags); | 127 | spin_unlock_irqrestore(&dev->sgid_lock, flags); |
| 128 | return false; | ||
| 136 | } | 129 | } |
| 137 | 130 | ||
| 138 | static bool ocrdma_del_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr, | 131 | static bool ocrdma_del_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr, |
| @@ -168,7 +161,8 @@ static void ocrdma_add_default_sgid(struct ocrdma_dev *dev) | |||
| 168 | ocrdma_get_guid(dev, &sgid->raw[8]); | 161 | ocrdma_get_guid(dev, &sgid->raw[8]); |
| 169 | } | 162 | } |
| 170 | 163 | ||
| 171 | static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) | 164 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
| 165 | static void ocrdma_add_vlan_sgids(struct ocrdma_dev *dev) | ||
| 172 | { | 166 | { |
| 173 | struct net_device *netdev, *tmp; | 167 | struct net_device *netdev, *tmp; |
| 174 | u16 vlan_id; | 168 | u16 vlan_id; |
| @@ -176,8 +170,6 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) | |||
| 176 | 170 | ||
| 177 | netdev = dev->nic_info.netdev; | 171 | netdev = dev->nic_info.netdev; |
| 178 | 172 | ||
| 179 | ocrdma_add_default_sgid(dev); | ||
| 180 | |||
| 181 | rcu_read_lock(); | 173 | rcu_read_lock(); |
| 182 | for_each_netdev_rcu(&init_net, tmp) { | 174 | for_each_netdev_rcu(&init_net, tmp) { |
| 183 | if (netdev == tmp || vlan_dev_real_dev(tmp) == netdev) { | 175 | if (netdev == tmp || vlan_dev_real_dev(tmp) == netdev) { |
| @@ -195,10 +187,23 @@ static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) | |||
| 195 | } | 187 | } |
| 196 | } | 188 | } |
| 197 | rcu_read_unlock(); | 189 | rcu_read_unlock(); |
| 190 | } | ||
| 191 | #else | ||
| 192 | static void ocrdma_add_vlan_sgids(struct ocrdma_dev *dev) | ||
| 193 | { | ||
| 194 | |||
| 195 | } | ||
| 196 | #endif /* VLAN */ | ||
| 197 | |||
| 198 | static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev) | ||
| 199 | { | ||
| 200 | ocrdma_add_default_sgid(dev); | ||
| 201 | ocrdma_add_vlan_sgids(dev); | ||
| 198 | return 0; | 202 | return 0; |
| 199 | } | 203 | } |
| 200 | 204 | ||
| 201 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 205 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) || \ |
| 206 | defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
| 202 | 207 | ||
| 203 | static int ocrdma_inet6addr_event(struct notifier_block *notifier, | 208 | static int ocrdma_inet6addr_event(struct notifier_block *notifier, |
| 204 | unsigned long event, void *ptr) | 209 | unsigned long event, void *ptr) |
| @@ -209,6 +214,7 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier, | |||
| 209 | struct ib_event gid_event; | 214 | struct ib_event gid_event; |
| 210 | struct ocrdma_dev *dev; | 215 | struct ocrdma_dev *dev; |
| 211 | bool found = false; | 216 | bool found = false; |
| 217 | bool updated = false; | ||
| 212 | bool is_vlan = false; | 218 | bool is_vlan = false; |
| 213 | u16 vid = 0; | 219 | u16 vid = 0; |
| 214 | 220 | ||
| @@ -234,23 +240,21 @@ static int ocrdma_inet6addr_event(struct notifier_block *notifier, | |||
| 234 | mutex_lock(&dev->dev_lock); | 240 | mutex_lock(&dev->dev_lock); |
| 235 | switch (event) { | 241 | switch (event) { |
| 236 | case NETDEV_UP: | 242 | case NETDEV_UP: |
| 237 | ocrdma_add_sgid(dev, netdev->dev_addr, is_vlan, vid); | 243 | updated = ocrdma_add_sgid(dev, netdev->dev_addr, is_vlan, vid); |
| 238 | break; | 244 | break; |
| 239 | case NETDEV_DOWN: | 245 | case NETDEV_DOWN: |
| 240 | found = ocrdma_del_sgid(dev, netdev->dev_addr, is_vlan, vid); | 246 | updated = ocrdma_del_sgid(dev, netdev->dev_addr, is_vlan, vid); |
| 241 | if (found) { | ||
| 242 | /* found the matching entry, notify | ||
| 243 | * the consumers about it | ||
| 244 | */ | ||
| 245 | gid_event.device = &dev->ibdev; | ||
| 246 | gid_event.element.port_num = 1; | ||
| 247 | gid_event.event = IB_EVENT_GID_CHANGE; | ||
| 248 | ib_dispatch_event(&gid_event); | ||
| 249 | } | ||
| 250 | break; | 247 | break; |
| 251 | default: | 248 | default: |
| 252 | break; | 249 | break; |
| 253 | } | 250 | } |
| 251 | if (updated) { | ||
| 252 | /* GID table updated, notify the consumers about it */ | ||
| 253 | gid_event.device = &dev->ibdev; | ||
| 254 | gid_event.element.port_num = 1; | ||
| 255 | gid_event.event = IB_EVENT_GID_CHANGE; | ||
| 256 | ib_dispatch_event(&gid_event); | ||
| 257 | } | ||
| 254 | mutex_unlock(&dev->dev_lock); | 258 | mutex_unlock(&dev->dev_lock); |
| 255 | return NOTIFY_OK; | 259 | return NOTIFY_OK; |
| 256 | } | 260 | } |
| @@ -259,7 +263,7 @@ static struct notifier_block ocrdma_inet6addr_notifier = { | |||
| 259 | .notifier_call = ocrdma_inet6addr_event | 263 | .notifier_call = ocrdma_inet6addr_event |
| 260 | }; | 264 | }; |
| 261 | 265 | ||
| 262 | #endif /* IPV6 */ | 266 | #endif /* IPV6 and VLAN */ |
| 263 | 267 | ||
| 264 | static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device, | 268 | static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device, |
| 265 | u8 port_num) | 269 | u8 port_num) |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h index 7fd80cc0f037..c75cbdfa87e7 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h | |||
| @@ -418,6 +418,9 @@ enum { | |||
| 418 | 418 | ||
| 419 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT = 0, | 419 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT = 0, |
| 420 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK = 0xFFFF, | 420 | OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK = 0xFFFF, |
| 421 | OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT = 16, | ||
| 422 | OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_MASK = 0xFFFF << | ||
| 423 | OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT, | ||
| 421 | 424 | ||
| 422 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT = 0, | 425 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT = 0, |
| 423 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK = 0xFFFF, | 426 | OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK = 0xFFFF, |
| @@ -458,7 +461,7 @@ enum { | |||
| 458 | OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET, | 461 | OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET, |
| 459 | OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_OFFSET = 0, | 462 | OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_OFFSET = 0, |
| 460 | OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_MASK = 0xFFFF << | 463 | OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_MASK = 0xFFFF << |
| 461 | OCRDMA_MBX_QUERY_CFG_MAX_WQES_PER_WQ_OFFSET, | 464 | OCRDMA_MBX_QUERY_CFG_MAX_RQES_PER_RQ_OFFSET, |
| 462 | 465 | ||
| 463 | OCRDMA_MBX_QUERY_CFG_MAX_CQ_OFFSET = 16, | 466 | OCRDMA_MBX_QUERY_CFG_MAX_CQ_OFFSET = 16, |
| 464 | OCRDMA_MBX_QUERY_CFG_MAX_CQ_MASK = 0xFFFF << | 467 | OCRDMA_MBX_QUERY_CFG_MAX_CQ_MASK = 0xFFFF << |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index e9f74d1b48f6..2e2e7aecc990 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
| @@ -53,7 +53,7 @@ int ocrdma_query_gid(struct ib_device *ibdev, u8 port, | |||
| 53 | 53 | ||
| 54 | dev = get_ocrdma_dev(ibdev); | 54 | dev = get_ocrdma_dev(ibdev); |
| 55 | memset(sgid, 0, sizeof(*sgid)); | 55 | memset(sgid, 0, sizeof(*sgid)); |
| 56 | if (index > OCRDMA_MAX_SGID) | 56 | if (index >= OCRDMA_MAX_SGID) |
| 57 | return -EINVAL; | 57 | return -EINVAL; |
| 58 | 58 | ||
| 59 | memcpy(sgid, &dev->sgid_tbl[index], sizeof(*sgid)); | 59 | memcpy(sgid, &dev->sgid_tbl[index], sizeof(*sgid)); |
| @@ -83,8 +83,8 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr) | |||
| 83 | IB_DEVICE_SHUTDOWN_PORT | | 83 | IB_DEVICE_SHUTDOWN_PORT | |
| 84 | IB_DEVICE_SYS_IMAGE_GUID | | 84 | IB_DEVICE_SYS_IMAGE_GUID | |
| 85 | IB_DEVICE_LOCAL_DMA_LKEY; | 85 | IB_DEVICE_LOCAL_DMA_LKEY; |
| 86 | attr->max_sge = dev->attr.max_send_sge; | 86 | attr->max_sge = min(dev->attr.max_send_sge, dev->attr.max_srq_sge); |
| 87 | attr->max_sge_rd = dev->attr.max_send_sge; | 87 | attr->max_sge_rd = 0; |
| 88 | attr->max_cq = dev->attr.max_cq; | 88 | attr->max_cq = dev->attr.max_cq; |
| 89 | attr->max_cqe = dev->attr.max_cqe; | 89 | attr->max_cqe = dev->attr.max_cqe; |
| 90 | attr->max_mr = dev->attr.max_mr; | 90 | attr->max_mr = dev->attr.max_mr; |
| @@ -97,7 +97,7 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr) | |||
| 97 | min(dev->attr.max_ord_per_qp, dev->attr.max_ird_per_qp); | 97 | min(dev->attr.max_ord_per_qp, dev->attr.max_ird_per_qp); |
| 98 | attr->max_qp_init_rd_atom = dev->attr.max_ord_per_qp; | 98 | attr->max_qp_init_rd_atom = dev->attr.max_ord_per_qp; |
| 99 | attr->max_srq = (dev->attr.max_qp - 1); | 99 | attr->max_srq = (dev->attr.max_qp - 1); |
| 100 | attr->max_srq_sge = attr->max_sge; | 100 | attr->max_srq_sge = attr->max_srq_sge; |
| 101 | attr->max_srq_wr = dev->attr.max_rqe; | 101 | attr->max_srq_wr = dev->attr.max_rqe; |
| 102 | attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay; | 102 | attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay; |
| 103 | attr->max_fast_reg_page_list_len = 0; | 103 | attr->max_fast_reg_page_list_len = 0; |
| @@ -940,8 +940,6 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp, | |||
| 940 | uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET; | 940 | uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET; |
| 941 | uresp.db_shift = 16; | 941 | uresp.db_shift = 16; |
| 942 | } | 942 | } |
| 943 | uresp.free_wqe_delta = qp->sq.free_delta; | ||
| 944 | uresp.free_rqe_delta = qp->rq.free_delta; | ||
| 945 | 943 | ||
| 946 | if (qp->dpp_enabled) { | 944 | if (qp->dpp_enabled) { |
| 947 | uresp.dpp_credit = dpp_credit_lmt; | 945 | uresp.dpp_credit = dpp_credit_lmt; |
| @@ -1307,8 +1305,6 @@ static int ocrdma_hwq_free_cnt(struct ocrdma_qp_hwq_info *q) | |||
| 1307 | free_cnt = (q->max_cnt - q->head) + q->tail; | 1305 | free_cnt = (q->max_cnt - q->head) + q->tail; |
| 1308 | else | 1306 | else |
| 1309 | free_cnt = q->tail - q->head; | 1307 | free_cnt = q->tail - q->head; |
| 1310 | if (q->free_delta) | ||
| 1311 | free_cnt -= q->free_delta; | ||
| 1312 | return free_cnt; | 1308 | return free_cnt; |
| 1313 | } | 1309 | } |
| 1314 | 1310 | ||
| @@ -1501,7 +1497,6 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_srq *srq, struct ib_udata *udata) | |||
| 1501 | (srq->pd->id * srq->dev->nic_info.db_page_size); | 1497 | (srq->pd->id * srq->dev->nic_info.db_page_size); |
| 1502 | uresp.db_page_size = srq->dev->nic_info.db_page_size; | 1498 | uresp.db_page_size = srq->dev->nic_info.db_page_size; |
| 1503 | uresp.num_rqe_allocated = srq->rq.max_cnt; | 1499 | uresp.num_rqe_allocated = srq->rq.max_cnt; |
| 1504 | uresp.free_rqe_delta = 1; | ||
| 1505 | if (srq->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) { | 1500 | if (srq->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) { |
| 1506 | uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ1_OFFSET; | 1501 | uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ1_OFFSET; |
| 1507 | uresp.db_shift = 24; | 1502 | uresp.db_shift = 24; |
| @@ -2306,8 +2301,10 @@ static bool ocrdma_poll_err_rcqe(struct ocrdma_qp *qp, struct ocrdma_cqe *cqe, | |||
| 2306 | *stop = true; | 2301 | *stop = true; |
| 2307 | expand = false; | 2302 | expand = false; |
| 2308 | } | 2303 | } |
| 2309 | } else | 2304 | } else { |
| 2305 | *polled = true; | ||
| 2310 | expand = ocrdma_update_err_rcqe(ibwc, cqe, qp, status); | 2306 | expand = ocrdma_update_err_rcqe(ibwc, cqe, qp, status); |
| 2307 | } | ||
| 2311 | return expand; | 2308 | return expand; |
| 2312 | } | 2309 | } |
| 2313 | 2310 | ||
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h index e6483439f25f..633f03d80274 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | |||
| @@ -28,7 +28,6 @@ | |||
| 28 | #ifndef __OCRDMA_VERBS_H__ | 28 | #ifndef __OCRDMA_VERBS_H__ |
| 29 | #define __OCRDMA_VERBS_H__ | 29 | #define __OCRDMA_VERBS_H__ |
| 30 | 30 | ||
| 31 | #include <linux/version.h> | ||
| 32 | int ocrdma_post_send(struct ib_qp *, struct ib_send_wr *, | 31 | int ocrdma_post_send(struct ib_qp *, struct ib_send_wr *, |
| 33 | struct ib_send_wr **bad_wr); | 32 | struct ib_send_wr **bad_wr); |
| 34 | int ocrdma_post_recv(struct ib_qp *, struct ib_recv_wr *, | 33 | int ocrdma_post_recv(struct ib_qp *, struct ib_recv_wr *, |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index 5c1bc995e560..f10221f40803 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c | |||
| @@ -123,7 +123,7 @@ static void ipoib_ud_skb_put_frags(struct ipoib_dev_priv *priv, | |||
| 123 | 123 | ||
| 124 | skb_frag_size_set(frag, size); | 124 | skb_frag_size_set(frag, size); |
| 125 | skb->data_len += size; | 125 | skb->data_len += size; |
| 126 | skb->truesize += size; | 126 | skb->truesize += PAGE_SIZE; |
| 127 | } else | 127 | } else |
| 128 | skb_put(skb, length); | 128 | skb_put(skb, length); |
| 129 | 129 | ||
| @@ -156,14 +156,18 @@ static struct sk_buff *ipoib_alloc_rx_skb(struct net_device *dev, int id) | |||
| 156 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 156 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
| 157 | struct sk_buff *skb; | 157 | struct sk_buff *skb; |
| 158 | int buf_size; | 158 | int buf_size; |
| 159 | int tailroom; | ||
| 159 | u64 *mapping; | 160 | u64 *mapping; |
| 160 | 161 | ||
| 161 | if (ipoib_ud_need_sg(priv->max_ib_mtu)) | 162 | if (ipoib_ud_need_sg(priv->max_ib_mtu)) { |
| 162 | buf_size = IPOIB_UD_HEAD_SIZE; | 163 | buf_size = IPOIB_UD_HEAD_SIZE; |
| 163 | else | 164 | tailroom = 128; /* reserve some tailroom for IP/TCP headers */ |
| 165 | } else { | ||
| 164 | buf_size = IPOIB_UD_BUF_SIZE(priv->max_ib_mtu); | 166 | buf_size = IPOIB_UD_BUF_SIZE(priv->max_ib_mtu); |
| 167 | tailroom = 0; | ||
| 168 | } | ||
| 165 | 169 | ||
| 166 | skb = dev_alloc_skb(buf_size + 4); | 170 | skb = dev_alloc_skb(buf_size + tailroom + 4); |
| 167 | if (unlikely(!skb)) | 171 | if (unlikely(!skb)) |
| 168 | return NULL; | 172 | return NULL; |
| 169 | 173 | ||
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index 57d19d4e0a2d..c96653b58867 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c | |||
| @@ -282,7 +282,8 @@ static int __devinit as5011_probe(struct i2c_client *client, | |||
| 282 | 282 | ||
| 283 | error = request_threaded_irq(as5011->button_irq, | 283 | error = request_threaded_irq(as5011->button_irq, |
| 284 | NULL, as5011_button_interrupt, | 284 | NULL, as5011_button_interrupt, |
| 285 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 285 | IRQF_TRIGGER_RISING | |
| 286 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | ||
| 286 | "as5011_button", as5011); | 287 | "as5011_button", as5011); |
| 287 | if (error < 0) { | 288 | if (error < 0) { |
| 288 | dev_err(&client->dev, | 289 | dev_err(&client->dev, |
| @@ -296,7 +297,7 @@ static int __devinit as5011_probe(struct i2c_client *client, | |||
| 296 | 297 | ||
| 297 | error = request_threaded_irq(as5011->axis_irq, NULL, | 298 | error = request_threaded_irq(as5011->axis_irq, NULL, |
| 298 | as5011_axis_interrupt, | 299 | as5011_axis_interrupt, |
| 299 | plat_data->axis_irqflags, | 300 | plat_data->axis_irqflags | IRQF_ONESHOT, |
| 300 | "as5011_joystick", as5011); | 301 | "as5011_joystick", as5011); |
| 301 | if (error) { | 302 | if (error) { |
| 302 | dev_err(&client->dev, | 303 | dev_err(&client->dev, |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index ee16fb67b7ae..83811e45d633 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
| @@ -142,6 +142,7 @@ static const struct xpad_device { | |||
| 142 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX }, | 142 | { 0x0c12, 0x880a, "Pelican Eclipse PL-2023", 0, XTYPE_XBOX }, |
| 143 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, | 143 | { 0x0c12, 0x8810, "Zeroplus Xbox Controller", 0, XTYPE_XBOX }, |
| 144 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, | 144 | { 0x0c12, 0x9902, "HAMA VibraX - *FAULTY HARDWARE*", 0, XTYPE_XBOX }, |
| 145 | { 0x0d2f, 0x0002, "Andamiro Pump It Up pad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, | ||
| 145 | { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, | 146 | { 0x0e4c, 0x1097, "Radica Gamester Controller", 0, XTYPE_XBOX }, |
| 146 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX }, | 147 | { 0x0e4c, 0x2390, "Radica Games Jtech Controller", 0, XTYPE_XBOX }, |
| 147 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX }, | 148 | { 0x0e6f, 0x0003, "Logic3 Freebird wireless Controller", 0, XTYPE_XBOX }, |
| @@ -164,6 +165,7 @@ static const struct xpad_device { | |||
| 164 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | 165 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, |
| 165 | { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, | 166 | { 0x0f0d, 0x0016, "Hori Real Arcade Pro.EX", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
| 166 | { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, | 167 | { 0x0f0d, 0x000d, "Hori Fighting Stick EX2", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 }, |
| 168 | { 0x1689, 0xfd00, "Razer Onza Tournament Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | ||
| 167 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, | 169 | { 0xffff, 0xffff, "Chinese-made Xbox Controller", 0, XTYPE_XBOX }, |
| 168 | { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } | 170 | { 0x0000, 0x0000, "Generic X-Box pad", 0, XTYPE_UNKNOWN } |
| 169 | }; | 171 | }; |
| @@ -238,12 +240,14 @@ static struct usb_device_id xpad_table [] = { | |||
| 238 | XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ | 240 | XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ |
| 239 | XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ | 241 | XPAD_XBOX360_VENDOR(0x046d), /* Logitech X-Box 360 style controllers */ |
| 240 | XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ | 242 | XPAD_XBOX360_VENDOR(0x0738), /* Mad Catz X-Box 360 controllers */ |
| 243 | { USB_DEVICE(0x0738, 0x4540) }, /* Mad Catz Beat Pad */ | ||
| 241 | XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ | 244 | XPAD_XBOX360_VENDOR(0x0e6f), /* 0x0e6f X-Box 360 controllers */ |
| 242 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ | 245 | XPAD_XBOX360_VENDOR(0x12ab), /* X-Box 360 dance pads */ |
| 243 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ | 246 | XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */ |
| 244 | XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ | 247 | XPAD_XBOX360_VENDOR(0x146b), /* BigBen Interactive Controllers */ |
| 245 | XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ | 248 | XPAD_XBOX360_VENDOR(0x1bad), /* Harminix Rock Band Guitar and Drums */ |
| 246 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ | 249 | XPAD_XBOX360_VENDOR(0x0f0d), /* Hori Controllers */ |
| 250 | XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ | ||
| 247 | { } | 251 | { } |
| 248 | }; | 252 | }; |
| 249 | 253 | ||
diff --git a/drivers/input/keyboard/mcs_touchkey.c b/drivers/input/keyboard/mcs_touchkey.c index 64a0ca4c92f3..0d77f6c84950 100644 --- a/drivers/input/keyboard/mcs_touchkey.c +++ b/drivers/input/keyboard/mcs_touchkey.c | |||
| @@ -178,7 +178,8 @@ static int __devinit mcs_touchkey_probe(struct i2c_client *client, | |||
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | error = request_threaded_irq(client->irq, NULL, mcs_touchkey_interrupt, | 180 | error = request_threaded_irq(client->irq, NULL, mcs_touchkey_interrupt, |
| 181 | IRQF_TRIGGER_FALLING, client->dev.driver->name, data); | 181 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 182 | client->dev.driver->name, data); | ||
| 182 | if (error) { | 183 | if (error) { |
| 183 | dev_err(&client->dev, "Failed to register interrupt\n"); | 184 | dev_err(&client->dev, "Failed to register interrupt\n"); |
| 184 | goto err_free_mem; | 185 | goto err_free_mem; |
diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index caa218a51b5a..7613f1cac951 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c | |||
| @@ -248,7 +248,7 @@ static int __devinit mpr_touchkey_probe(struct i2c_client *client, | |||
| 248 | 248 | ||
| 249 | error = request_threaded_irq(client->irq, NULL, | 249 | error = request_threaded_irq(client->irq, NULL, |
| 250 | mpr_touchkey_interrupt, | 250 | mpr_touchkey_interrupt, |
| 251 | IRQF_TRIGGER_FALLING, | 251 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 252 | client->dev.driver->name, mpr121); | 252 | client->dev.driver->name, mpr121); |
| 253 | if (error) { | 253 | if (error) { |
| 254 | dev_err(&client->dev, "Failed to register interrupt\n"); | 254 | dev_err(&client->dev, "Failed to register interrupt\n"); |
diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c index 0b7b2f891752..ca68f2992d72 100644 --- a/drivers/input/keyboard/qt1070.c +++ b/drivers/input/keyboard/qt1070.c | |||
| @@ -201,7 +201,8 @@ static int __devinit qt1070_probe(struct i2c_client *client, | |||
| 201 | msleep(QT1070_RESET_TIME); | 201 | msleep(QT1070_RESET_TIME); |
| 202 | 202 | ||
| 203 | err = request_threaded_irq(client->irq, NULL, qt1070_interrupt, | 203 | err = request_threaded_irq(client->irq, NULL, qt1070_interrupt, |
| 204 | IRQF_TRIGGER_NONE, client->dev.driver->name, data); | 204 | IRQF_TRIGGER_NONE | IRQF_ONESHOT, |
| 205 | client->dev.driver->name, data); | ||
| 205 | if (err) { | 206 | if (err) { |
| 206 | dev_err(&client->dev, "fail to request irq\n"); | 207 | dev_err(&client->dev, "fail to request irq\n"); |
| 207 | goto err_free_mem; | 208 | goto err_free_mem; |
diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c index 3afea3f89718..c355cdde8d22 100644 --- a/drivers/input/keyboard/tca6416-keypad.c +++ b/drivers/input/keyboard/tca6416-keypad.c | |||
| @@ -278,7 +278,8 @@ static int __devinit tca6416_keypad_probe(struct i2c_client *client, | |||
| 278 | 278 | ||
| 279 | error = request_threaded_irq(chip->irqnum, NULL, | 279 | error = request_threaded_irq(chip->irqnum, NULL, |
| 280 | tca6416_keys_isr, | 280 | tca6416_keys_isr, |
| 281 | IRQF_TRIGGER_FALLING, | 281 | IRQF_TRIGGER_FALLING | |
| 282 | IRQF_ONESHOT, | ||
| 282 | "tca6416-keypad", chip); | 283 | "tca6416-keypad", chip); |
| 283 | if (error) { | 284 | if (error) { |
| 284 | dev_dbg(&client->dev, | 285 | dev_dbg(&client->dev, |
diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c index 5f87b28b3192..893869b29ed9 100644 --- a/drivers/input/keyboard/tca8418_keypad.c +++ b/drivers/input/keyboard/tca8418_keypad.c | |||
| @@ -360,7 +360,7 @@ static int __devinit tca8418_keypad_probe(struct i2c_client *client, | |||
| 360 | client->irq = gpio_to_irq(client->irq); | 360 | client->irq = gpio_to_irq(client->irq); |
| 361 | 361 | ||
| 362 | error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler, | 362 | error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler, |
| 363 | IRQF_TRIGGER_FALLING, | 363 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 364 | client->name, keypad_data); | 364 | client->name, keypad_data); |
| 365 | if (error) { | 365 | if (error) { |
| 366 | dev_dbg(&client->dev, | 366 | dev_dbg(&client->dev, |
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c index a4a445fb7020..4c34f21fbe2d 100644 --- a/drivers/input/keyboard/tnetv107x-keypad.c +++ b/drivers/input/keyboard/tnetv107x-keypad.c | |||
| @@ -227,15 +227,15 @@ static int __devinit keypad_probe(struct platform_device *pdev) | |||
| 227 | goto error_clk; | 227 | goto error_clk; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | error = request_threaded_irq(kp->irq_press, NULL, keypad_irq, 0, | 230 | error = request_threaded_irq(kp->irq_press, NULL, keypad_irq, |
| 231 | dev_name(dev), kp); | 231 | IRQF_ONESHOT, dev_name(dev), kp); |
| 232 | if (error < 0) { | 232 | if (error < 0) { |
| 233 | dev_err(kp->dev, "Could not allocate keypad press key irq\n"); | 233 | dev_err(kp->dev, "Could not allocate keypad press key irq\n"); |
| 234 | goto error_irq_press; | 234 | goto error_irq_press; |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | error = request_threaded_irq(kp->irq_release, NULL, keypad_irq, 0, | 237 | error = request_threaded_irq(kp->irq_release, NULL, keypad_irq, |
| 238 | dev_name(dev), kp); | 238 | IRQF_ONESHOT, dev_name(dev), kp); |
| 239 | if (error < 0) { | 239 | if (error < 0) { |
| 240 | dev_err(kp->dev, "Could not allocate keypad release key irq\n"); | 240 | dev_err(kp->dev, "Could not allocate keypad release key irq\n"); |
| 241 | goto error_irq_release; | 241 | goto error_irq_release; |
diff --git a/drivers/input/misc/ad714x.c b/drivers/input/misc/ad714x.c index 0ac75bbad4d6..2e5d5e1de647 100644 --- a/drivers/input/misc/ad714x.c +++ b/drivers/input/misc/ad714x.c | |||
| @@ -972,6 +972,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, | |||
| 972 | struct ad714x_platform_data *plat_data = dev->platform_data; | 972 | struct ad714x_platform_data *plat_data = dev->platform_data; |
| 973 | struct ad714x_chip *ad714x; | 973 | struct ad714x_chip *ad714x; |
| 974 | void *drv_mem; | 974 | void *drv_mem; |
| 975 | unsigned long irqflags; | ||
| 975 | 976 | ||
| 976 | struct ad714x_button_drv *bt_drv; | 977 | struct ad714x_button_drv *bt_drv; |
| 977 | struct ad714x_slider_drv *sd_drv; | 978 | struct ad714x_slider_drv *sd_drv; |
| @@ -1162,10 +1163,11 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq, | |||
| 1162 | alloc_idx++; | 1163 | alloc_idx++; |
| 1163 | } | 1164 | } |
| 1164 | 1165 | ||
| 1166 | irqflags = plat_data->irqflags ?: IRQF_TRIGGER_FALLING; | ||
| 1167 | irqflags |= IRQF_ONESHOT; | ||
| 1168 | |||
| 1165 | error = request_threaded_irq(ad714x->irq, NULL, ad714x_interrupt_thread, | 1169 | error = request_threaded_irq(ad714x->irq, NULL, ad714x_interrupt_thread, |
| 1166 | plat_data->irqflags ? | 1170 | irqflags, "ad714x_captouch", ad714x); |
| 1167 | plat_data->irqflags : IRQF_TRIGGER_FALLING, | ||
| 1168 | "ad714x_captouch", ad714x); | ||
| 1169 | if (error) { | 1171 | if (error) { |
| 1170 | dev_err(dev, "can't allocate irq %d\n", ad714x->irq); | 1172 | dev_err(dev, "can't allocate irq %d\n", ad714x->irq); |
| 1171 | goto err_unreg_dev; | 1173 | goto err_unreg_dev; |
diff --git a/drivers/input/misc/dm355evm_keys.c b/drivers/input/misc/dm355evm_keys.c index 35083c6836c3..c1313d8535c3 100644 --- a/drivers/input/misc/dm355evm_keys.c +++ b/drivers/input/misc/dm355evm_keys.c | |||
| @@ -213,7 +213,8 @@ static int __devinit dm355evm_keys_probe(struct platform_device *pdev) | |||
| 213 | /* REVISIT: flush the event queue? */ | 213 | /* REVISIT: flush the event queue? */ |
| 214 | 214 | ||
| 215 | status = request_threaded_irq(keys->irq, NULL, dm355evm_keys_irq, | 215 | status = request_threaded_irq(keys->irq, NULL, dm355evm_keys_irq, |
| 216 | IRQF_TRIGGER_FALLING, dev_name(&pdev->dev), keys); | 216 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 217 | dev_name(&pdev->dev), keys); | ||
| 217 | if (status < 0) | 218 | if (status < 0) |
| 218 | goto fail2; | 219 | goto fail2; |
| 219 | 220 | ||
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 2cf681d98c0d..d528c23e194f 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
| @@ -79,6 +79,10 @@ | |||
| 79 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 | 79 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 |
| 80 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 | 80 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 |
| 81 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 | 81 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 |
| 82 | /* MacbookPro10,1 (unibody, June 2012) */ | ||
| 83 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 | ||
| 84 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 | ||
| 85 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 | ||
| 82 | 86 | ||
| 83 | #define BCM5974_DEVICE(prod) { \ | 87 | #define BCM5974_DEVICE(prod) { \ |
| 84 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | 88 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
| @@ -128,6 +132,10 @@ static const struct usb_device_id bcm5974_table[] = { | |||
| 128 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), | 132 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI), |
| 129 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), | 133 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO), |
| 130 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), | 134 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS), |
| 135 | /* MacbookPro10,1 */ | ||
| 136 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), | ||
| 137 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), | ||
| 138 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | ||
| 131 | /* Terminating entry */ | 139 | /* Terminating entry */ |
| 132 | {} | 140 | {} |
| 133 | }; | 141 | }; |
| @@ -354,6 +362,18 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
| 354 | { DIM_X, DIM_X / SN_COORD, -4620, 5140 }, | 362 | { DIM_X, DIM_X / SN_COORD, -4620, 5140 }, |
| 355 | { DIM_Y, DIM_Y / SN_COORD, -150, 6600 } | 363 | { DIM_Y, DIM_Y / SN_COORD, -150, 6600 } |
| 356 | }, | 364 | }, |
| 365 | { | ||
| 366 | USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI, | ||
| 367 | USB_DEVICE_ID_APPLE_WELLSPRING7_ISO, | ||
| 368 | USB_DEVICE_ID_APPLE_WELLSPRING7_JIS, | ||
| 369 | HAS_INTEGRATED_BUTTON, | ||
| 370 | 0x84, sizeof(struct bt_data), | ||
| 371 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | ||
| 372 | { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 }, | ||
| 373 | { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, | ||
| 374 | { DIM_X, DIM_X / SN_COORD, -4750, 5280 }, | ||
| 375 | { DIM_Y, DIM_Y / SN_COORD, -150, 6730 } | ||
| 376 | }, | ||
| 357 | {} | 377 | {} |
| 358 | }; | 378 | }; |
| 359 | 379 | ||
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index cad5602d3ce4..8b31473a81fe 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
| @@ -216,7 +216,7 @@ static void wacom_retrieve_report_data(struct usb_interface *intf, | |||
| 216 | 216 | ||
| 217 | rep_data[0] = 12; | 217 | rep_data[0] = 12; |
| 218 | result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, | 218 | result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, |
| 219 | rep_data[0], &rep_data, 2, | 219 | rep_data[0], rep_data, 2, |
| 220 | WAC_MSG_RETRIES); | 220 | WAC_MSG_RETRIES); |
| 221 | 221 | ||
| 222 | if (result >= 0 && rep_data[1] > 2) | 222 | if (result >= 0 && rep_data[1] > 2) |
| @@ -401,7 +401,9 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
| 401 | break; | 401 | break; |
| 402 | 402 | ||
| 403 | case HID_USAGE_CONTACTMAX: | 403 | case HID_USAGE_CONTACTMAX: |
| 404 | wacom_retrieve_report_data(intf, features); | 404 | /* leave touch_max as is if predefined */ |
| 405 | if (!features->touch_max) | ||
| 406 | wacom_retrieve_report_data(intf, features); | ||
| 405 | i++; | 407 | i++; |
| 406 | break; | 408 | break; |
| 407 | } | 409 | } |
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index e2482b40da51..bd4eb4277697 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c | |||
| @@ -597,7 +597,7 @@ struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq, | |||
| 597 | AD7879_TMR(ts->pen_down_acc_interval); | 597 | AD7879_TMR(ts->pen_down_acc_interval); |
| 598 | 598 | ||
| 599 | err = request_threaded_irq(ts->irq, NULL, ad7879_irq, | 599 | err = request_threaded_irq(ts->irq, NULL, ad7879_irq, |
| 600 | IRQF_TRIGGER_FALLING, | 600 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 601 | dev_name(dev), ts); | 601 | dev_name(dev), ts); |
| 602 | if (err) { | 602 | if (err) { |
| 603 | dev_err(dev, "irq %d busy?\n", ts->irq); | 603 | dev_err(dev, "irq %d busy?\n", ts->irq); |
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 42e645062c20..25fd0561a17d 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
| @@ -1149,7 +1149,8 @@ static int __devinit mxt_probe(struct i2c_client *client, | |||
| 1149 | goto err_free_object; | 1149 | goto err_free_object; |
| 1150 | 1150 | ||
| 1151 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, | 1151 | error = request_threaded_irq(client->irq, NULL, mxt_interrupt, |
| 1152 | pdata->irqflags, client->dev.driver->name, data); | 1152 | pdata->irqflags | IRQF_ONESHOT, |
| 1153 | client->dev.driver->name, data); | ||
| 1153 | if (error) { | 1154 | if (error) { |
| 1154 | dev_err(&client->dev, "Failed to register interrupt\n"); | 1155 | dev_err(&client->dev, "Failed to register interrupt\n"); |
| 1155 | goto err_free_object; | 1156 | goto err_free_object; |
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index f2d03c06c2da..5c487d23f11c 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c | |||
| @@ -509,7 +509,8 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
| 509 | input_set_drvdata(in_dev, bu21013_data); | 509 | input_set_drvdata(in_dev, bu21013_data); |
| 510 | 510 | ||
| 511 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, | 511 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, |
| 512 | IRQF_TRIGGER_FALLING | IRQF_SHARED, | 512 | IRQF_TRIGGER_FALLING | IRQF_SHARED | |
| 513 | IRQF_ONESHOT, | ||
| 513 | DRIVER_TP, bu21013_data); | 514 | DRIVER_TP, bu21013_data); |
| 514 | if (error) { | 515 | if (error) { |
| 515 | dev_err(&client->dev, "request irq %d failed\n", pdata->irq); | 516 | dev_err(&client->dev, "request irq %d failed\n", pdata->irq); |
diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 237753ad1031..464f1bf4b61d 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c | |||
| @@ -251,7 +251,8 @@ static int __devinit cy8ctmg110_probe(struct i2c_client *client, | |||
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | err = request_threaded_irq(client->irq, NULL, cy8ctmg110_irq_thread, | 253 | err = request_threaded_irq(client->irq, NULL, cy8ctmg110_irq_thread, |
| 254 | IRQF_TRIGGER_RISING, "touch_reset_key", ts); | 254 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
| 255 | "touch_reset_key", ts); | ||
| 255 | if (err < 0) { | 256 | if (err < 0) { |
| 256 | dev_err(&client->dev, | 257 | dev_err(&client->dev, |
| 257 | "irq %d busy? error %d\n", client->irq, err); | 258 | "irq %d busy? error %d\n", client->irq, err); |
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c index 3cd7a837f82b..cf299377fc49 100644 --- a/drivers/input/touchscreen/intel-mid-touch.c +++ b/drivers/input/touchscreen/intel-mid-touch.c | |||
| @@ -620,7 +620,7 @@ static int __devinit mrstouch_probe(struct platform_device *pdev) | |||
| 620 | MRST_PRESSURE_MIN, MRST_PRESSURE_MAX, 0, 0); | 620 | MRST_PRESSURE_MIN, MRST_PRESSURE_MAX, 0, 0); |
| 621 | 621 | ||
| 622 | err = request_threaded_irq(tsdev->irq, NULL, mrstouch_pendet_irq, | 622 | err = request_threaded_irq(tsdev->irq, NULL, mrstouch_pendet_irq, |
| 623 | 0, "mrstouch", tsdev); | 623 | IRQF_ONESHOT, "mrstouch", tsdev); |
| 624 | if (err) { | 624 | if (err) { |
| 625 | dev_err(tsdev->dev, "unable to allocate irq\n"); | 625 | dev_err(tsdev->dev, "unable to allocate irq\n"); |
| 626 | goto err_free_mem; | 626 | goto err_free_mem; |
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index 72f6ba3a4709..953b4c105cad 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c | |||
| @@ -165,7 +165,7 @@ static int __devinit pixcir_i2c_ts_probe(struct i2c_client *client, | |||
| 165 | input_set_drvdata(input, tsdata); | 165 | input_set_drvdata(input, tsdata); |
| 166 | 166 | ||
| 167 | error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr, | 167 | error = request_threaded_irq(client->irq, NULL, pixcir_ts_isr, |
| 168 | IRQF_TRIGGER_FALLING, | 168 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 169 | client->name, tsdata); | 169 | client->name, tsdata); |
| 170 | if (error) { | 170 | if (error) { |
| 171 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); | 171 | dev_err(&client->dev, "Unable to request touchscreen IRQ.\n"); |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index 7e7488097359..368d2c6cf780 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
| @@ -297,7 +297,7 @@ static int __devinit tsc_probe(struct platform_device *pdev) | |||
| 297 | goto error_clk; | 297 | goto error_clk; |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | error = request_threaded_irq(ts->tsc_irq, NULL, tsc_irq, 0, | 300 | error = request_threaded_irq(ts->tsc_irq, NULL, tsc_irq, IRQF_ONESHOT, |
| 301 | dev_name(dev), ts); | 301 | dev_name(dev), ts); |
| 302 | if (error < 0) { | 302 | if (error < 0) { |
| 303 | dev_err(ts->dev, "Could not allocate ts irq\n"); | 303 | dev_err(ts->dev, "Could not allocate ts irq\n"); |
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index b6adeaee9cc5..5ce3fa8ce646 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c | |||
| @@ -650,7 +650,8 @@ static int __devinit tsc2005_probe(struct spi_device *spi) | |||
| 650 | tsc2005_stop_scan(ts); | 650 | tsc2005_stop_scan(ts); |
| 651 | 651 | ||
| 652 | error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread, | 652 | error = request_threaded_irq(spi->irq, NULL, tsc2005_irq_thread, |
| 653 | IRQF_TRIGGER_RISING, "tsc2005", ts); | 653 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
| 654 | "tsc2005", ts); | ||
| 654 | if (error) { | 655 | if (error) { |
| 655 | dev_err(&spi->dev, "Failed to request irq, err: %d\n", error); | 656 | dev_err(&spi->dev, "Failed to request irq, err: %d\n", error); |
| 656 | goto err_free_mem; | 657 | goto err_free_mem; |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index d90a421e9cac..625626391f2d 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -83,6 +83,8 @@ static struct iommu_ops amd_iommu_ops; | |||
| 83 | static ATOMIC_NOTIFIER_HEAD(ppr_notifier); | 83 | static ATOMIC_NOTIFIER_HEAD(ppr_notifier); |
| 84 | int amd_iommu_max_glx_val = -1; | 84 | int amd_iommu_max_glx_val = -1; |
| 85 | 85 | ||
| 86 | static struct dma_map_ops amd_iommu_dma_ops; | ||
| 87 | |||
| 86 | /* | 88 | /* |
| 87 | * general struct to manage commands send to an IOMMU | 89 | * general struct to manage commands send to an IOMMU |
| 88 | */ | 90 | */ |
| @@ -402,7 +404,7 @@ static void amd_iommu_stats_init(void) | |||
| 402 | return; | 404 | return; |
| 403 | 405 | ||
| 404 | de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, | 406 | de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir, |
| 405 | (u32 *)&amd_iommu_unmap_flush); | 407 | &amd_iommu_unmap_flush); |
| 406 | 408 | ||
| 407 | amd_iommu_stats_add(&compl_wait); | 409 | amd_iommu_stats_add(&compl_wait); |
| 408 | amd_iommu_stats_add(&cnt_map_single); | 410 | amd_iommu_stats_add(&cnt_map_single); |
| @@ -547,26 +549,12 @@ static void iommu_poll_events(struct amd_iommu *iommu) | |||
| 547 | spin_unlock_irqrestore(&iommu->lock, flags); | 549 | spin_unlock_irqrestore(&iommu->lock, flags); |
| 548 | } | 550 | } |
| 549 | 551 | ||
| 550 | static void iommu_handle_ppr_entry(struct amd_iommu *iommu, u32 head) | 552 | static void iommu_handle_ppr_entry(struct amd_iommu *iommu, u64 *raw) |
| 551 | { | 553 | { |
| 552 | struct amd_iommu_fault fault; | 554 | struct amd_iommu_fault fault; |
| 553 | volatile u64 *raw; | ||
| 554 | int i; | ||
| 555 | 555 | ||
| 556 | INC_STATS_COUNTER(pri_requests); | 556 | INC_STATS_COUNTER(pri_requests); |
| 557 | 557 | ||
| 558 | raw = (u64 *)(iommu->ppr_log + head); | ||
| 559 | |||
| 560 | /* | ||
| 561 | * Hardware bug: Interrupt may arrive before the entry is written to | ||
| 562 | * memory. If this happens we need to wait for the entry to arrive. | ||
| 563 | */ | ||
| 564 | for (i = 0; i < LOOP_TIMEOUT; ++i) { | ||
| 565 | if (PPR_REQ_TYPE(raw[0]) != 0) | ||
| 566 | break; | ||
| 567 | udelay(1); | ||
| 568 | } | ||
| 569 | |||
| 570 | if (PPR_REQ_TYPE(raw[0]) != PPR_REQ_FAULT) { | 558 | if (PPR_REQ_TYPE(raw[0]) != PPR_REQ_FAULT) { |
| 571 | pr_err_ratelimited("AMD-Vi: Unknown PPR request received\n"); | 559 | pr_err_ratelimited("AMD-Vi: Unknown PPR request received\n"); |
| 572 | return; | 560 | return; |
| @@ -578,12 +566,6 @@ static void iommu_handle_ppr_entry(struct amd_iommu *iommu, u32 head) | |||
| 578 | fault.tag = PPR_TAG(raw[0]); | 566 | fault.tag = PPR_TAG(raw[0]); |
| 579 | fault.flags = PPR_FLAGS(raw[0]); | 567 | fault.flags = PPR_FLAGS(raw[0]); |
| 580 | 568 | ||
| 581 | /* | ||
| 582 | * To detect the hardware bug we need to clear the entry | ||
| 583 | * to back to zero. | ||
| 584 | */ | ||
| 585 | raw[0] = raw[1] = 0; | ||
| 586 | |||
| 587 | atomic_notifier_call_chain(&ppr_notifier, 0, &fault); | 569 | atomic_notifier_call_chain(&ppr_notifier, 0, &fault); |
| 588 | } | 570 | } |
| 589 | 571 | ||
| @@ -595,25 +577,62 @@ static void iommu_poll_ppr_log(struct amd_iommu *iommu) | |||
| 595 | if (iommu->ppr_log == NULL) | 577 | if (iommu->ppr_log == NULL) |
| 596 | return; | 578 | return; |
| 597 | 579 | ||
| 580 | /* enable ppr interrupts again */ | ||
| 581 | writel(MMIO_STATUS_PPR_INT_MASK, iommu->mmio_base + MMIO_STATUS_OFFSET); | ||
| 582 | |||
| 598 | spin_lock_irqsave(&iommu->lock, flags); | 583 | spin_lock_irqsave(&iommu->lock, flags); |
| 599 | 584 | ||
| 600 | head = readl(iommu->mmio_base + MMIO_PPR_HEAD_OFFSET); | 585 | head = readl(iommu->mmio_base + MMIO_PPR_HEAD_OFFSET); |
| 601 | tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET); | 586 | tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET); |
| 602 | 587 | ||
| 603 | while (head != tail) { | 588 | while (head != tail) { |
| 589 | volatile u64 *raw; | ||
| 590 | u64 entry[2]; | ||
| 591 | int i; | ||
| 604 | 592 | ||
| 605 | /* Handle PPR entry */ | 593 | raw = (u64 *)(iommu->ppr_log + head); |
| 606 | iommu_handle_ppr_entry(iommu, head); | 594 | |
| 595 | /* | ||
| 596 | * Hardware bug: Interrupt may arrive before the entry is | ||
| 597 | * written to memory. If this happens we need to wait for the | ||
| 598 | * entry to arrive. | ||
| 599 | */ | ||
| 600 | for (i = 0; i < LOOP_TIMEOUT; ++i) { | ||
| 601 | if (PPR_REQ_TYPE(raw[0]) != 0) | ||
| 602 | break; | ||
| 603 | udelay(1); | ||
| 604 | } | ||
| 607 | 605 | ||
| 608 | /* Update and refresh ring-buffer state*/ | 606 | /* Avoid memcpy function-call overhead */ |
| 607 | entry[0] = raw[0]; | ||
| 608 | entry[1] = raw[1]; | ||
| 609 | |||
| 610 | /* | ||
| 611 | * To detect the hardware bug we need to clear the entry | ||
| 612 | * back to zero. | ||
| 613 | */ | ||
| 614 | raw[0] = raw[1] = 0UL; | ||
| 615 | |||
| 616 | /* Update head pointer of hardware ring-buffer */ | ||
| 609 | head = (head + PPR_ENTRY_SIZE) % PPR_LOG_SIZE; | 617 | head = (head + PPR_ENTRY_SIZE) % PPR_LOG_SIZE; |
| 610 | writel(head, iommu->mmio_base + MMIO_PPR_HEAD_OFFSET); | 618 | writel(head, iommu->mmio_base + MMIO_PPR_HEAD_OFFSET); |
| 619 | |||
| 620 | /* | ||
| 621 | * Release iommu->lock because ppr-handling might need to | ||
| 622 | * re-aquire it | ||
| 623 | */ | ||
| 624 | spin_unlock_irqrestore(&iommu->lock, flags); | ||
| 625 | |||
| 626 | /* Handle PPR entry */ | ||
| 627 | iommu_handle_ppr_entry(iommu, entry); | ||
| 628 | |||
| 629 | spin_lock_irqsave(&iommu->lock, flags); | ||
| 630 | |||
| 631 | /* Refresh ring-buffer information */ | ||
| 632 | head = readl(iommu->mmio_base + MMIO_PPR_HEAD_OFFSET); | ||
| 611 | tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET); | 633 | tail = readl(iommu->mmio_base + MMIO_PPR_TAIL_OFFSET); |
| 612 | } | 634 | } |
| 613 | 635 | ||
| 614 | /* enable ppr interrupts again */ | ||
| 615 | writel(MMIO_STATUS_PPR_INT_MASK, iommu->mmio_base + MMIO_STATUS_OFFSET); | ||
| 616 | |||
| 617 | spin_unlock_irqrestore(&iommu->lock, flags); | 636 | spin_unlock_irqrestore(&iommu->lock, flags); |
| 618 | } | 637 | } |
| 619 | 638 | ||
| @@ -2250,6 +2269,13 @@ static int device_change_notifier(struct notifier_block *nb, | |||
| 2250 | list_add_tail(&dma_domain->list, &iommu_pd_list); | 2269 | list_add_tail(&dma_domain->list, &iommu_pd_list); |
| 2251 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); | 2270 | spin_unlock_irqrestore(&iommu_pd_list_lock, flags); |
| 2252 | 2271 | ||
| 2272 | dev_data = get_dev_data(dev); | ||
| 2273 | |||
| 2274 | if (!dev_data->passthrough) | ||
| 2275 | dev->archdata.dma_ops = &amd_iommu_dma_ops; | ||
| 2276 | else | ||
| 2277 | dev->archdata.dma_ops = &nommu_dma_ops; | ||
| 2278 | |||
| 2253 | break; | 2279 | break; |
| 2254 | case BUS_NOTIFY_DEL_DEVICE: | 2280 | case BUS_NOTIFY_DEL_DEVICE: |
| 2255 | 2281 | ||
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index c56790375e0f..a33612f3206f 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
| @@ -129,7 +129,7 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have | |||
| 129 | to handle */ | 129 | to handle */ |
| 130 | LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings | 130 | LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings |
| 131 | we find in ACPI */ | 131 | we find in ACPI */ |
| 132 | bool amd_iommu_unmap_flush; /* if true, flush on every unmap */ | 132 | u32 amd_iommu_unmap_flush; /* if true, flush on every unmap */ |
| 133 | 133 | ||
| 134 | LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the | 134 | LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the |
| 135 | system */ | 135 | system */ |
| @@ -1029,6 +1029,9 @@ static int __init init_iommu_one(struct amd_iommu *iommu, struct ivhd_header *h) | |||
| 1029 | if (!iommu->dev) | 1029 | if (!iommu->dev) |
| 1030 | return 1; | 1030 | return 1; |
| 1031 | 1031 | ||
| 1032 | iommu->root_pdev = pci_get_bus_and_slot(iommu->dev->bus->number, | ||
| 1033 | PCI_DEVFN(0, 0)); | ||
| 1034 | |||
| 1032 | iommu->cap_ptr = h->cap_ptr; | 1035 | iommu->cap_ptr = h->cap_ptr; |
| 1033 | iommu->pci_seg = h->pci_seg; | 1036 | iommu->pci_seg = h->pci_seg; |
| 1034 | iommu->mmio_phys = h->mmio_phys; | 1037 | iommu->mmio_phys = h->mmio_phys; |
| @@ -1323,20 +1326,16 @@ static void iommu_apply_resume_quirks(struct amd_iommu *iommu) | |||
| 1323 | { | 1326 | { |
| 1324 | int i, j; | 1327 | int i, j; |
| 1325 | u32 ioc_feature_control; | 1328 | u32 ioc_feature_control; |
| 1326 | struct pci_dev *pdev = NULL; | 1329 | struct pci_dev *pdev = iommu->root_pdev; |
| 1327 | 1330 | ||
| 1328 | /* RD890 BIOSes may not have completely reconfigured the iommu */ | 1331 | /* RD890 BIOSes may not have completely reconfigured the iommu */ |
| 1329 | if (!is_rd890_iommu(iommu->dev)) | 1332 | if (!is_rd890_iommu(iommu->dev) || !pdev) |
| 1330 | return; | 1333 | return; |
| 1331 | 1334 | ||
| 1332 | /* | 1335 | /* |
| 1333 | * First, we need to ensure that the iommu is enabled. This is | 1336 | * First, we need to ensure that the iommu is enabled. This is |
| 1334 | * controlled by a register in the northbridge | 1337 | * controlled by a register in the northbridge |
| 1335 | */ | 1338 | */ |
| 1336 | pdev = pci_get_bus_and_slot(iommu->dev->bus->number, PCI_DEVFN(0, 0)); | ||
| 1337 | |||
| 1338 | if (!pdev) | ||
| 1339 | return; | ||
| 1340 | 1339 | ||
| 1341 | /* Select Northbridge indirect register 0x75 and enable writing */ | 1340 | /* Select Northbridge indirect register 0x75 and enable writing */ |
| 1342 | pci_write_config_dword(pdev, 0x60, 0x75 | (1 << 7)); | 1341 | pci_write_config_dword(pdev, 0x60, 0x75 | (1 << 7)); |
| @@ -1346,8 +1345,6 @@ static void iommu_apply_resume_quirks(struct amd_iommu *iommu) | |||
| 1346 | if (!(ioc_feature_control & 0x1)) | 1345 | if (!(ioc_feature_control & 0x1)) |
| 1347 | pci_write_config_dword(pdev, 0x64, ioc_feature_control | 1); | 1346 | pci_write_config_dword(pdev, 0x64, ioc_feature_control | 1); |
| 1348 | 1347 | ||
| 1349 | pci_dev_put(pdev); | ||
| 1350 | |||
| 1351 | /* Restore the iommu BAR */ | 1348 | /* Restore the iommu BAR */ |
| 1352 | pci_write_config_dword(iommu->dev, iommu->cap_ptr + 4, | 1349 | pci_write_config_dword(iommu->dev, iommu->cap_ptr + 4, |
| 1353 | iommu->stored_addr_lo); | 1350 | iommu->stored_addr_lo); |
| @@ -1644,6 +1641,8 @@ static int __init amd_iommu_init(void) | |||
| 1644 | 1641 | ||
| 1645 | amd_iommu_init_api(); | 1642 | amd_iommu_init_api(); |
| 1646 | 1643 | ||
| 1644 | x86_platform.iommu_shutdown = disable_iommus; | ||
| 1645 | |||
| 1647 | if (iommu_pass_through) | 1646 | if (iommu_pass_through) |
| 1648 | goto out; | 1647 | goto out; |
| 1649 | 1648 | ||
| @@ -1652,8 +1651,6 @@ static int __init amd_iommu_init(void) | |||
| 1652 | else | 1651 | else |
| 1653 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); | 1652 | printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n"); |
| 1654 | 1653 | ||
| 1655 | x86_platform.iommu_shutdown = disable_iommus; | ||
| 1656 | |||
| 1657 | out: | 1654 | out: |
| 1658 | return ret; | 1655 | return ret; |
| 1659 | 1656 | ||
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index 2452f3b71736..c1b1d489817e 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h | |||
| @@ -481,6 +481,9 @@ struct amd_iommu { | |||
| 481 | /* Pointer to PCI device of this IOMMU */ | 481 | /* Pointer to PCI device of this IOMMU */ |
| 482 | struct pci_dev *dev; | 482 | struct pci_dev *dev; |
| 483 | 483 | ||
| 484 | /* Cache pdev to root device for resume quirks */ | ||
| 485 | struct pci_dev *root_pdev; | ||
| 486 | |||
| 484 | /* physical address of MMIO space */ | 487 | /* physical address of MMIO space */ |
| 485 | u64 mmio_phys; | 488 | u64 mmio_phys; |
| 486 | /* virtual address of MMIO space */ | 489 | /* virtual address of MMIO space */ |
| @@ -649,7 +652,7 @@ extern unsigned long *amd_iommu_pd_alloc_bitmap; | |||
| 649 | * If true, the addresses will be flushed on unmap time, not when | 652 | * If true, the addresses will be flushed on unmap time, not when |
| 650 | * they are reused | 653 | * they are reused |
| 651 | */ | 654 | */ |
| 652 | extern bool amd_iommu_unmap_flush; | 655 | extern u32 amd_iommu_unmap_flush; |
| 653 | 656 | ||
| 654 | /* Smallest number of PASIDs supported by any IOMMU in the system */ | 657 | /* Smallest number of PASIDs supported by any IOMMU in the system */ |
| 655 | extern u32 amd_iommu_max_pasids; | 658 | extern u32 amd_iommu_max_pasids; |
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index ecd679043d77..3f3d09d560ea 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c | |||
| @@ -550,13 +550,13 @@ static int alloc_pdir(struct smmu_as *as) | |||
| 550 | return 0; | 550 | return 0; |
| 551 | 551 | ||
| 552 | as->pte_count = devm_kzalloc(smmu->dev, | 552 | as->pte_count = devm_kzalloc(smmu->dev, |
| 553 | sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_KERNEL); | 553 | sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_ATOMIC); |
| 554 | if (!as->pte_count) { | 554 | if (!as->pte_count) { |
| 555 | dev_err(smmu->dev, | 555 | dev_err(smmu->dev, |
| 556 | "failed to allocate smmu_device PTE cunters\n"); | 556 | "failed to allocate smmu_device PTE cunters\n"); |
| 557 | return -ENOMEM; | 557 | return -ENOMEM; |
| 558 | } | 558 | } |
| 559 | as->pdir_page = alloc_page(GFP_KERNEL | __GFP_DMA); | 559 | as->pdir_page = alloc_page(GFP_ATOMIC | __GFP_DMA); |
| 560 | if (!as->pdir_page) { | 560 | if (!as->pdir_page) { |
| 561 | dev_err(smmu->dev, | 561 | dev_err(smmu->dev, |
| 562 | "failed to allocate smmu_device page directory\n"); | 562 | "failed to allocate smmu_device page directory\n"); |
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c index 1a0ae4445ff2..5f21f629b7ae 100644 --- a/drivers/isdn/mISDN/stack.c +++ b/drivers/isdn/mISDN/stack.c | |||
| @@ -135,8 +135,8 @@ send_layer2(struct mISDNstack *st, struct sk_buff *skb) | |||
| 135 | skb = NULL; | 135 | skb = NULL; |
| 136 | else if (*debug & DEBUG_SEND_ERR) | 136 | else if (*debug & DEBUG_SEND_ERR) |
| 137 | printk(KERN_DEBUG | 137 | printk(KERN_DEBUG |
| 138 | "%s ch%d mgr prim(%x) addr(%x) err %d\n", | 138 | "%s mgr prim(%x) err %d\n", |
| 139 | __func__, ch->nr, hh->prim, ch->addr, ret); | 139 | __func__, hh->prim, ret); |
| 140 | } | 140 | } |
| 141 | out: | 141 | out: |
| 142 | mutex_unlock(&st->lmutex); | 142 | mutex_unlock(&st->lmutex); |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 04cb8c88d74b..12b2b55c519e 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
| @@ -379,7 +379,7 @@ config LEDS_NETXBIG | |||
| 379 | 379 | ||
| 380 | config LEDS_ASIC3 | 380 | config LEDS_ASIC3 |
| 381 | bool "LED support for the HTC ASIC3" | 381 | bool "LED support for the HTC ASIC3" |
| 382 | depends on LEDS_CLASS | 382 | depends on LEDS_CLASS=y |
| 383 | depends on MFD_ASIC3 | 383 | depends on MFD_ASIC3 |
| 384 | default y | 384 | default y |
| 385 | help | 385 | help |
| @@ -390,7 +390,7 @@ config LEDS_ASIC3 | |||
| 390 | 390 | ||
| 391 | config LEDS_RENESAS_TPU | 391 | config LEDS_RENESAS_TPU |
| 392 | bool "LED support for Renesas TPU" | 392 | bool "LED support for Renesas TPU" |
| 393 | depends on LEDS_CLASS && HAVE_CLK && GENERIC_GPIO | 393 | depends on LEDS_CLASS=y && HAVE_CLK && GENERIC_GPIO |
| 394 | help | 394 | help |
| 395 | This option enables build of the LED TPU platform driver, | 395 | This option enables build of the LED TPU platform driver, |
| 396 | suitable to drive any TPU channel on newer Renesas SoCs. | 396 | suitable to drive any TPU channel on newer Renesas SoCs. |
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 8ee92c81aec2..e663e6f413e9 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
| @@ -29,7 +29,7 @@ static void led_update_brightness(struct led_classdev *led_cdev) | |||
| 29 | led_cdev->brightness = led_cdev->brightness_get(led_cdev); | 29 | led_cdev->brightness = led_cdev->brightness_get(led_cdev); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | static ssize_t led_brightness_show(struct device *dev, | 32 | static ssize_t led_brightness_show(struct device *dev, |
| 33 | struct device_attribute *attr, char *buf) | 33 | struct device_attribute *attr, char *buf) |
| 34 | { | 34 | { |
| 35 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | 35 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index d6860043f6f9..d65353d8d3fc 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
| @@ -44,13 +44,6 @@ static void led_set_software_blink(struct led_classdev *led_cdev, | |||
| 44 | if (!led_cdev->blink_brightness) | 44 | if (!led_cdev->blink_brightness) |
| 45 | led_cdev->blink_brightness = led_cdev->max_brightness; | 45 | led_cdev->blink_brightness = led_cdev->max_brightness; |
| 46 | 46 | ||
| 47 | if (led_get_trigger_data(led_cdev) && | ||
| 48 | delay_on == led_cdev->blink_delay_on && | ||
| 49 | delay_off == led_cdev->blink_delay_off) | ||
| 50 | return; | ||
| 51 | |||
| 52 | led_stop_software_blink(led_cdev); | ||
| 53 | |||
| 54 | led_cdev->blink_delay_on = delay_on; | 47 | led_cdev->blink_delay_on = delay_on; |
| 55 | led_cdev->blink_delay_off = delay_off; | 48 | led_cdev->blink_delay_off = delay_off; |
| 56 | 49 | ||
diff --git a/drivers/leds/ledtrig-heartbeat.c b/drivers/leds/ledtrig-heartbeat.c index 41dc76db4311..a019fbb70880 100644 --- a/drivers/leds/ledtrig-heartbeat.c +++ b/drivers/leds/ledtrig-heartbeat.c | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | #include <linux/reboot.h> | 21 | #include <linux/reboot.h> |
| 22 | #include "leds.h" | 22 | #include "leds.h" |
| 23 | 23 | ||
| 24 | static int panic_heartbeats; | ||
| 25 | |||
| 24 | struct heartbeat_trig_data { | 26 | struct heartbeat_trig_data { |
| 25 | unsigned int phase; | 27 | unsigned int phase; |
| 26 | unsigned int period; | 28 | unsigned int period; |
| @@ -34,6 +36,11 @@ static void led_heartbeat_function(unsigned long data) | |||
| 34 | unsigned long brightness = LED_OFF; | 36 | unsigned long brightness = LED_OFF; |
| 35 | unsigned long delay = 0; | 37 | unsigned long delay = 0; |
| 36 | 38 | ||
| 39 | if (unlikely(panic_heartbeats)) { | ||
| 40 | led_set_brightness(led_cdev, LED_OFF); | ||
| 41 | return; | ||
| 42 | } | ||
| 43 | |||
| 37 | /* acts like an actual heart beat -- ie thump-thump-pause... */ | 44 | /* acts like an actual heart beat -- ie thump-thump-pause... */ |
| 38 | switch (heartbeat_data->phase) { | 45 | switch (heartbeat_data->phase) { |
| 39 | case 0: | 46 | case 0: |
| @@ -111,12 +118,19 @@ static int heartbeat_reboot_notifier(struct notifier_block *nb, | |||
| 111 | return NOTIFY_DONE; | 118 | return NOTIFY_DONE; |
| 112 | } | 119 | } |
| 113 | 120 | ||
| 121 | static int heartbeat_panic_notifier(struct notifier_block *nb, | ||
| 122 | unsigned long code, void *unused) | ||
| 123 | { | ||
| 124 | panic_heartbeats = 1; | ||
| 125 | return NOTIFY_DONE; | ||
| 126 | } | ||
| 127 | |||
| 114 | static struct notifier_block heartbeat_reboot_nb = { | 128 | static struct notifier_block heartbeat_reboot_nb = { |
| 115 | .notifier_call = heartbeat_reboot_notifier, | 129 | .notifier_call = heartbeat_reboot_notifier, |
| 116 | }; | 130 | }; |
| 117 | 131 | ||
| 118 | static struct notifier_block heartbeat_panic_nb = { | 132 | static struct notifier_block heartbeat_panic_nb = { |
| 119 | .notifier_call = heartbeat_reboot_notifier, | 133 | .notifier_call = heartbeat_panic_notifier, |
| 120 | }; | 134 | }; |
| 121 | 135 | ||
| 122 | static int __init heartbeat_trig_init(void) | 136 | static int __init heartbeat_trig_init(void) |
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index d039de8322f0..b58b7a33914a 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
| @@ -1084,6 +1084,7 @@ static int mirror_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 1084 | ti->split_io = dm_rh_get_region_size(ms->rh); | 1084 | ti->split_io = dm_rh_get_region_size(ms->rh); |
| 1085 | ti->num_flush_requests = 1; | 1085 | ti->num_flush_requests = 1; |
| 1086 | ti->num_discard_requests = 1; | 1086 | ti->num_discard_requests = 1; |
| 1087 | ti->discard_zeroes_data_unsupported = 1; | ||
| 1087 | 1088 | ||
| 1088 | ms->kmirrord_wq = alloc_workqueue("kmirrord", | 1089 | ms->kmirrord_wq = alloc_workqueue("kmirrord", |
| 1089 | WQ_NON_REENTRANT | WQ_MEM_RECLAIM, 0); | 1090 | WQ_NON_REENTRANT | WQ_MEM_RECLAIM, 0); |
| @@ -1214,7 +1215,7 @@ static int mirror_end_io(struct dm_target *ti, struct bio *bio, | |||
| 1214 | * We need to dec pending if this was a write. | 1215 | * We need to dec pending if this was a write. |
| 1215 | */ | 1216 | */ |
| 1216 | if (rw == WRITE) { | 1217 | if (rw == WRITE) { |
| 1217 | if (!(bio->bi_rw & REQ_FLUSH)) | 1218 | if (!(bio->bi_rw & (REQ_FLUSH | REQ_DISCARD))) |
| 1218 | dm_rh_dec(ms->rh, map_context->ll); | 1219 | dm_rh_dec(ms->rh, map_context->ll); |
| 1219 | return error; | 1220 | return error; |
| 1220 | } | 1221 | } |
diff --git a/drivers/md/dm-region-hash.c b/drivers/md/dm-region-hash.c index 7771ed212182..69732e03eb34 100644 --- a/drivers/md/dm-region-hash.c +++ b/drivers/md/dm-region-hash.c | |||
| @@ -404,6 +404,9 @@ void dm_rh_mark_nosync(struct dm_region_hash *rh, struct bio *bio) | |||
| 404 | return; | 404 | return; |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | if (bio->bi_rw & REQ_DISCARD) | ||
| 408 | return; | ||
| 409 | |||
| 407 | /* We must inform the log that the sync count has changed. */ | 410 | /* We must inform the log that the sync count has changed. */ |
| 408 | log->type->set_region_sync(log, region, 0); | 411 | log->type->set_region_sync(log, region, 0); |
| 409 | 412 | ||
| @@ -524,7 +527,7 @@ void dm_rh_inc_pending(struct dm_region_hash *rh, struct bio_list *bios) | |||
| 524 | struct bio *bio; | 527 | struct bio *bio; |
| 525 | 528 | ||
| 526 | for (bio = bios->head; bio; bio = bio->bi_next) { | 529 | for (bio = bios->head; bio; bio = bio->bi_next) { |
| 527 | if (bio->bi_rw & REQ_FLUSH) | 530 | if (bio->bi_rw & (REQ_FLUSH | REQ_DISCARD)) |
| 528 | continue; | 531 | continue; |
| 529 | rh_inc(rh, dm_rh_bio_to_region(rh, bio)); | 532 | rh_inc(rh, dm_rh_bio_to_region(rh, bio)); |
| 530 | } | 533 | } |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 37fdaf81bd1f..68694da0d21d 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
| @@ -1245,7 +1245,10 @@ static void process_discard(struct thin_c *tc, struct bio *bio) | |||
| 1245 | 1245 | ||
| 1246 | cell_release_singleton(cell, bio); | 1246 | cell_release_singleton(cell, bio); |
| 1247 | cell_release_singleton(cell2, bio); | 1247 | cell_release_singleton(cell2, bio); |
| 1248 | remap_and_issue(tc, bio, lookup_result.block); | 1248 | if ((!lookup_result.shared) && pool->pf.discard_passdown) |
| 1249 | remap_and_issue(tc, bio, lookup_result.block); | ||
| 1250 | else | ||
| 1251 | bio_endio(bio, 0); | ||
| 1249 | } | 1252 | } |
| 1250 | break; | 1253 | break; |
| 1251 | 1254 | ||
| @@ -2292,6 +2295,13 @@ static int process_reserve_metadata_snap_mesg(unsigned argc, char **argv, struct | |||
| 2292 | if (r) | 2295 | if (r) |
| 2293 | return r; | 2296 | return r; |
| 2294 | 2297 | ||
| 2298 | r = dm_pool_commit_metadata(pool->pmd); | ||
| 2299 | if (r) { | ||
| 2300 | DMERR("%s: dm_pool_commit_metadata() failed, error = %d", | ||
| 2301 | __func__, r); | ||
| 2302 | return r; | ||
| 2303 | } | ||
| 2304 | |||
| 2295 | r = dm_pool_reserve_metadata_snap(pool->pmd); | 2305 | r = dm_pool_reserve_metadata_snap(pool->pmd); |
| 2296 | if (r) | 2306 | if (r) |
| 2297 | DMWARN("reserve_metadata_snap message failed."); | 2307 | DMWARN("reserve_metadata_snap message failed."); |
| @@ -2621,6 +2631,7 @@ static int thin_ctr(struct dm_target *ti, unsigned argc, char **argv) | |||
| 2621 | if (tc->pool->pf.discard_enabled) { | 2631 | if (tc->pool->pf.discard_enabled) { |
| 2622 | ti->discards_supported = 1; | 2632 | ti->discards_supported = 1; |
| 2623 | ti->num_discard_requests = 1; | 2633 | ti->num_discard_requests = 1; |
| 2634 | ti->discard_zeroes_data_unsupported = 1; | ||
| 2624 | } | 2635 | } |
| 2625 | 2636 | ||
| 2626 | dm_put(pool_md); | 2637 | dm_put(pool_md); |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1c2f9048e1ae..d5ab4493c8be 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -2931,6 +2931,7 @@ offset_store(struct md_rdev *rdev, const char *buf, size_t len) | |||
| 2931 | * can be sane */ | 2931 | * can be sane */ |
| 2932 | return -EBUSY; | 2932 | return -EBUSY; |
| 2933 | rdev->data_offset = offset; | 2933 | rdev->data_offset = offset; |
| 2934 | rdev->new_data_offset = offset; | ||
| 2934 | return len; | 2935 | return len; |
| 2935 | } | 2936 | } |
| 2936 | 2937 | ||
| @@ -3926,8 +3927,8 @@ array_state_show(struct mddev *mddev, char *page) | |||
| 3926 | return sprintf(page, "%s\n", array_states[st]); | 3927 | return sprintf(page, "%s\n", array_states[st]); |
| 3927 | } | 3928 | } |
| 3928 | 3929 | ||
| 3929 | static int do_md_stop(struct mddev * mddev, int ro, int is_open); | 3930 | static int do_md_stop(struct mddev * mddev, int ro, struct block_device *bdev); |
| 3930 | static int md_set_readonly(struct mddev * mddev, int is_open); | 3931 | static int md_set_readonly(struct mddev * mddev, struct block_device *bdev); |
| 3931 | static int do_md_run(struct mddev * mddev); | 3932 | static int do_md_run(struct mddev * mddev); |
| 3932 | static int restart_array(struct mddev *mddev); | 3933 | static int restart_array(struct mddev *mddev); |
| 3933 | 3934 | ||
| @@ -3943,14 +3944,14 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) | |||
| 3943 | /* stopping an active array */ | 3944 | /* stopping an active array */ |
| 3944 | if (atomic_read(&mddev->openers) > 0) | 3945 | if (atomic_read(&mddev->openers) > 0) |
| 3945 | return -EBUSY; | 3946 | return -EBUSY; |
| 3946 | err = do_md_stop(mddev, 0, 0); | 3947 | err = do_md_stop(mddev, 0, NULL); |
| 3947 | break; | 3948 | break; |
| 3948 | case inactive: | 3949 | case inactive: |
| 3949 | /* stopping an active array */ | 3950 | /* stopping an active array */ |
| 3950 | if (mddev->pers) { | 3951 | if (mddev->pers) { |
| 3951 | if (atomic_read(&mddev->openers) > 0) | 3952 | if (atomic_read(&mddev->openers) > 0) |
| 3952 | return -EBUSY; | 3953 | return -EBUSY; |
| 3953 | err = do_md_stop(mddev, 2, 0); | 3954 | err = do_md_stop(mddev, 2, NULL); |
| 3954 | } else | 3955 | } else |
| 3955 | err = 0; /* already inactive */ | 3956 | err = 0; /* already inactive */ |
| 3956 | break; | 3957 | break; |
| @@ -3958,7 +3959,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) | |||
| 3958 | break; /* not supported yet */ | 3959 | break; /* not supported yet */ |
| 3959 | case readonly: | 3960 | case readonly: |
| 3960 | if (mddev->pers) | 3961 | if (mddev->pers) |
| 3961 | err = md_set_readonly(mddev, 0); | 3962 | err = md_set_readonly(mddev, NULL); |
| 3962 | else { | 3963 | else { |
| 3963 | mddev->ro = 1; | 3964 | mddev->ro = 1; |
| 3964 | set_disk_ro(mddev->gendisk, 1); | 3965 | set_disk_ro(mddev->gendisk, 1); |
| @@ -3968,7 +3969,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) | |||
| 3968 | case read_auto: | 3969 | case read_auto: |
| 3969 | if (mddev->pers) { | 3970 | if (mddev->pers) { |
| 3970 | if (mddev->ro == 0) | 3971 | if (mddev->ro == 0) |
| 3971 | err = md_set_readonly(mddev, 0); | 3972 | err = md_set_readonly(mddev, NULL); |
| 3972 | else if (mddev->ro == 1) | 3973 | else if (mddev->ro == 1) |
| 3973 | err = restart_array(mddev); | 3974 | err = restart_array(mddev); |
| 3974 | if (err == 0) { | 3975 | if (err == 0) { |
| @@ -5351,15 +5352,17 @@ void md_stop(struct mddev *mddev) | |||
| 5351 | } | 5352 | } |
| 5352 | EXPORT_SYMBOL_GPL(md_stop); | 5353 | EXPORT_SYMBOL_GPL(md_stop); |
| 5353 | 5354 | ||
| 5354 | static int md_set_readonly(struct mddev *mddev, int is_open) | 5355 | static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) |
| 5355 | { | 5356 | { |
| 5356 | int err = 0; | 5357 | int err = 0; |
| 5357 | mutex_lock(&mddev->open_mutex); | 5358 | mutex_lock(&mddev->open_mutex); |
| 5358 | if (atomic_read(&mddev->openers) > is_open) { | 5359 | if (atomic_read(&mddev->openers) > !!bdev) { |
| 5359 | printk("md: %s still in use.\n",mdname(mddev)); | 5360 | printk("md: %s still in use.\n",mdname(mddev)); |
| 5360 | err = -EBUSY; | 5361 | err = -EBUSY; |
| 5361 | goto out; | 5362 | goto out; |
| 5362 | } | 5363 | } |
| 5364 | if (bdev) | ||
| 5365 | sync_blockdev(bdev); | ||
| 5363 | if (mddev->pers) { | 5366 | if (mddev->pers) { |
| 5364 | __md_stop_writes(mddev); | 5367 | __md_stop_writes(mddev); |
| 5365 | 5368 | ||
| @@ -5381,18 +5384,26 @@ out: | |||
| 5381 | * 0 - completely stop and dis-assemble array | 5384 | * 0 - completely stop and dis-assemble array |
| 5382 | * 2 - stop but do not disassemble array | 5385 | * 2 - stop but do not disassemble array |
| 5383 | */ | 5386 | */ |
| 5384 | static int do_md_stop(struct mddev * mddev, int mode, int is_open) | 5387 | static int do_md_stop(struct mddev * mddev, int mode, |
| 5388 | struct block_device *bdev) | ||
| 5385 | { | 5389 | { |
| 5386 | struct gendisk *disk = mddev->gendisk; | 5390 | struct gendisk *disk = mddev->gendisk; |
| 5387 | struct md_rdev *rdev; | 5391 | struct md_rdev *rdev; |
| 5388 | 5392 | ||
| 5389 | mutex_lock(&mddev->open_mutex); | 5393 | mutex_lock(&mddev->open_mutex); |
| 5390 | if (atomic_read(&mddev->openers) > is_open || | 5394 | if (atomic_read(&mddev->openers) > !!bdev || |
| 5391 | mddev->sysfs_active) { | 5395 | mddev->sysfs_active) { |
| 5392 | printk("md: %s still in use.\n",mdname(mddev)); | 5396 | printk("md: %s still in use.\n",mdname(mddev)); |
| 5393 | mutex_unlock(&mddev->open_mutex); | 5397 | mutex_unlock(&mddev->open_mutex); |
| 5394 | return -EBUSY; | 5398 | return -EBUSY; |
| 5395 | } | 5399 | } |
| 5400 | if (bdev) | ||
| 5401 | /* It is possible IO was issued on some other | ||
| 5402 | * open file which was closed before we took ->open_mutex. | ||
| 5403 | * As that was not the last close __blkdev_put will not | ||
| 5404 | * have called sync_blockdev, so we must. | ||
| 5405 | */ | ||
| 5406 | sync_blockdev(bdev); | ||
| 5396 | 5407 | ||
| 5397 | if (mddev->pers) { | 5408 | if (mddev->pers) { |
| 5398 | if (mddev->ro) | 5409 | if (mddev->ro) |
| @@ -5466,7 +5477,7 @@ static void autorun_array(struct mddev *mddev) | |||
| 5466 | err = do_md_run(mddev); | 5477 | err = do_md_run(mddev); |
| 5467 | if (err) { | 5478 | if (err) { |
| 5468 | printk(KERN_WARNING "md: do_md_run() returned %d\n", err); | 5479 | printk(KERN_WARNING "md: do_md_run() returned %d\n", err); |
| 5469 | do_md_stop(mddev, 0, 0); | 5480 | do_md_stop(mddev, 0, NULL); |
| 5470 | } | 5481 | } |
| 5471 | } | 5482 | } |
| 5472 | 5483 | ||
| @@ -5784,8 +5795,7 @@ static int add_new_disk(struct mddev * mddev, mdu_disk_info_t *info) | |||
| 5784 | super_types[mddev->major_version]. | 5795 | super_types[mddev->major_version]. |
| 5785 | validate_super(mddev, rdev); | 5796 | validate_super(mddev, rdev); |
| 5786 | if ((info->state & (1<<MD_DISK_SYNC)) && | 5797 | if ((info->state & (1<<MD_DISK_SYNC)) && |
| 5787 | (!test_bit(In_sync, &rdev->flags) || | 5798 | rdev->raid_disk != info->raid_disk) { |
| 5788 | rdev->raid_disk != info->raid_disk)) { | ||
| 5789 | /* This was a hot-add request, but events doesn't | 5799 | /* This was a hot-add request, but events doesn't |
| 5790 | * match, so reject it. | 5800 | * match, so reject it. |
| 5791 | */ | 5801 | */ |
| @@ -6482,11 +6492,11 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 6482 | goto done_unlock; | 6492 | goto done_unlock; |
| 6483 | 6493 | ||
| 6484 | case STOP_ARRAY: | 6494 | case STOP_ARRAY: |
| 6485 | err = do_md_stop(mddev, 0, 1); | 6495 | err = do_md_stop(mddev, 0, bdev); |
| 6486 | goto done_unlock; | 6496 | goto done_unlock; |
| 6487 | 6497 | ||
| 6488 | case STOP_ARRAY_RO: | 6498 | case STOP_ARRAY_RO: |
| 6489 | err = md_set_readonly(mddev, 1); | 6499 | err = md_set_readonly(mddev, bdev); |
| 6490 | goto done_unlock; | 6500 | goto done_unlock; |
| 6491 | 6501 | ||
| 6492 | case BLKROSET: | 6502 | case BLKROSET: |
| @@ -6751,7 +6761,7 @@ struct md_thread *md_register_thread(void (*run) (struct mddev *), struct mddev | |||
| 6751 | thread->tsk = kthread_run(md_thread, thread, | 6761 | thread->tsk = kthread_run(md_thread, thread, |
| 6752 | "%s_%s", | 6762 | "%s_%s", |
| 6753 | mdname(thread->mddev), | 6763 | mdname(thread->mddev), |
| 6754 | name ?: mddev->pers->name); | 6764 | name); |
| 6755 | if (IS_ERR(thread->tsk)) { | 6765 | if (IS_ERR(thread->tsk)) { |
| 6756 | kfree(thread); | 6766 | kfree(thread); |
| 6757 | return NULL; | 6767 | return NULL; |
| @@ -7298,6 +7308,7 @@ void md_do_sync(struct mddev *mddev) | |||
| 7298 | int skipped = 0; | 7308 | int skipped = 0; |
| 7299 | struct md_rdev *rdev; | 7309 | struct md_rdev *rdev; |
| 7300 | char *desc; | 7310 | char *desc; |
| 7311 | struct blk_plug plug; | ||
| 7301 | 7312 | ||
| 7302 | /* just incase thread restarts... */ | 7313 | /* just incase thread restarts... */ |
| 7303 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) | 7314 | if (test_bit(MD_RECOVERY_DONE, &mddev->recovery)) |
| @@ -7447,6 +7458,7 @@ void md_do_sync(struct mddev *mddev) | |||
| 7447 | } | 7458 | } |
| 7448 | mddev->curr_resync_completed = j; | 7459 | mddev->curr_resync_completed = j; |
| 7449 | 7460 | ||
| 7461 | blk_start_plug(&plug); | ||
| 7450 | while (j < max_sectors) { | 7462 | while (j < max_sectors) { |
| 7451 | sector_t sectors; | 7463 | sector_t sectors; |
| 7452 | 7464 | ||
| @@ -7552,6 +7564,7 @@ void md_do_sync(struct mddev *mddev) | |||
| 7552 | * this also signals 'finished resyncing' to md_stop | 7564 | * this also signals 'finished resyncing' to md_stop |
| 7553 | */ | 7565 | */ |
| 7554 | out: | 7566 | out: |
| 7567 | blk_finish_plug(&plug); | ||
| 7555 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); | 7568 | wait_event(mddev->recovery_wait, !atomic_read(&mddev->recovery_active)); |
| 7556 | 7569 | ||
| 7557 | /* tell personality that we are finished */ | 7570 | /* tell personality that we are finished */ |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 9339e67fcc79..61a1833ebaf3 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
| @@ -474,7 +474,8 @@ static int multipath_run (struct mddev *mddev) | |||
| 474 | } | 474 | } |
| 475 | 475 | ||
| 476 | { | 476 | { |
| 477 | mddev->thread = md_register_thread(multipathd, mddev, NULL); | 477 | mddev->thread = md_register_thread(multipathd, mddev, |
| 478 | "multipath"); | ||
| 478 | if (!mddev->thread) { | 479 | if (!mddev->thread) { |
| 479 | printk(KERN_ERR "multipath: couldn't allocate thread" | 480 | printk(KERN_ERR "multipath: couldn't allocate thread" |
| 480 | " for %s\n", mdname(mddev)); | 481 | " for %s\n", mdname(mddev)); |
diff --git a/drivers/md/persistent-data/dm-space-map-checker.c b/drivers/md/persistent-data/dm-space-map-checker.c index 50ed53bf4aa2..fc90c11620ad 100644 --- a/drivers/md/persistent-data/dm-space-map-checker.c +++ b/drivers/md/persistent-data/dm-space-map-checker.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | 8 | ||
| 9 | #include <linux/device-mapper.h> | 9 | #include <linux/device-mapper.h> |
| 10 | #include <linux/export.h> | 10 | #include <linux/export.h> |
| 11 | #include <linux/vmalloc.h> | ||
| 11 | 12 | ||
| 12 | #ifdef CONFIG_DM_DEBUG_SPACE_MAPS | 13 | #ifdef CONFIG_DM_DEBUG_SPACE_MAPS |
| 13 | 14 | ||
| @@ -89,13 +90,23 @@ static int ca_create(struct count_array *ca, struct dm_space_map *sm) | |||
| 89 | 90 | ||
| 90 | ca->nr = nr_blocks; | 91 | ca->nr = nr_blocks; |
| 91 | ca->nr_free = nr_blocks; | 92 | ca->nr_free = nr_blocks; |
| 92 | ca->counts = kzalloc(sizeof(*ca->counts) * nr_blocks, GFP_KERNEL); | 93 | |
| 93 | if (!ca->counts) | 94 | if (!nr_blocks) |
| 94 | return -ENOMEM; | 95 | ca->counts = NULL; |
| 96 | else { | ||
| 97 | ca->counts = vzalloc(sizeof(*ca->counts) * nr_blocks); | ||
| 98 | if (!ca->counts) | ||
| 99 | return -ENOMEM; | ||
| 100 | } | ||
| 95 | 101 | ||
| 96 | return 0; | 102 | return 0; |
| 97 | } | 103 | } |
| 98 | 104 | ||
| 105 | static void ca_destroy(struct count_array *ca) | ||
| 106 | { | ||
| 107 | vfree(ca->counts); | ||
| 108 | } | ||
| 109 | |||
| 99 | static int ca_load(struct count_array *ca, struct dm_space_map *sm) | 110 | static int ca_load(struct count_array *ca, struct dm_space_map *sm) |
| 100 | { | 111 | { |
| 101 | int r; | 112 | int r; |
| @@ -126,12 +137,14 @@ static int ca_load(struct count_array *ca, struct dm_space_map *sm) | |||
| 126 | static int ca_extend(struct count_array *ca, dm_block_t extra_blocks) | 137 | static int ca_extend(struct count_array *ca, dm_block_t extra_blocks) |
| 127 | { | 138 | { |
| 128 | dm_block_t nr_blocks = ca->nr + extra_blocks; | 139 | dm_block_t nr_blocks = ca->nr + extra_blocks; |
| 129 | uint32_t *counts = kzalloc(sizeof(*counts) * nr_blocks, GFP_KERNEL); | 140 | uint32_t *counts = vzalloc(sizeof(*counts) * nr_blocks); |
| 130 | if (!counts) | 141 | if (!counts) |
| 131 | return -ENOMEM; | 142 | return -ENOMEM; |
| 132 | 143 | ||
| 133 | memcpy(counts, ca->counts, sizeof(*counts) * ca->nr); | 144 | if (ca->counts) { |
| 134 | kfree(ca->counts); | 145 | memcpy(counts, ca->counts, sizeof(*counts) * ca->nr); |
| 146 | ca_destroy(ca); | ||
| 147 | } | ||
| 135 | ca->nr = nr_blocks; | 148 | ca->nr = nr_blocks; |
| 136 | ca->nr_free += extra_blocks; | 149 | ca->nr_free += extra_blocks; |
| 137 | ca->counts = counts; | 150 | ca->counts = counts; |
| @@ -151,11 +164,6 @@ static int ca_commit(struct count_array *old, struct count_array *new) | |||
| 151 | return 0; | 164 | return 0; |
| 152 | } | 165 | } |
| 153 | 166 | ||
| 154 | static void ca_destroy(struct count_array *ca) | ||
| 155 | { | ||
| 156 | kfree(ca->counts); | ||
| 157 | } | ||
| 158 | |||
| 159 | /*----------------------------------------------------------------*/ | 167 | /*----------------------------------------------------------------*/ |
| 160 | 168 | ||
| 161 | struct sm_checker { | 169 | struct sm_checker { |
| @@ -343,25 +351,25 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
| 343 | int r; | 351 | int r; |
| 344 | struct sm_checker *smc; | 352 | struct sm_checker *smc; |
| 345 | 353 | ||
| 346 | if (!sm) | 354 | if (IS_ERR_OR_NULL(sm)) |
| 347 | return NULL; | 355 | return ERR_PTR(-EINVAL); |
| 348 | 356 | ||
| 349 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); | 357 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); |
| 350 | if (!smc) | 358 | if (!smc) |
| 351 | return NULL; | 359 | return ERR_PTR(-ENOMEM); |
| 352 | 360 | ||
| 353 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); | 361 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); |
| 354 | r = ca_create(&smc->old_counts, sm); | 362 | r = ca_create(&smc->old_counts, sm); |
| 355 | if (r) { | 363 | if (r) { |
| 356 | kfree(smc); | 364 | kfree(smc); |
| 357 | return NULL; | 365 | return ERR_PTR(r); |
| 358 | } | 366 | } |
| 359 | 367 | ||
| 360 | r = ca_create(&smc->counts, sm); | 368 | r = ca_create(&smc->counts, sm); |
| 361 | if (r) { | 369 | if (r) { |
| 362 | ca_destroy(&smc->old_counts); | 370 | ca_destroy(&smc->old_counts); |
| 363 | kfree(smc); | 371 | kfree(smc); |
| 364 | return NULL; | 372 | return ERR_PTR(r); |
| 365 | } | 373 | } |
| 366 | 374 | ||
| 367 | smc->real_sm = sm; | 375 | smc->real_sm = sm; |
| @@ -371,7 +379,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
| 371 | ca_destroy(&smc->counts); | 379 | ca_destroy(&smc->counts); |
| 372 | ca_destroy(&smc->old_counts); | 380 | ca_destroy(&smc->old_counts); |
| 373 | kfree(smc); | 381 | kfree(smc); |
| 374 | return NULL; | 382 | return ERR_PTR(r); |
| 375 | } | 383 | } |
| 376 | 384 | ||
| 377 | r = ca_commit(&smc->old_counts, &smc->counts); | 385 | r = ca_commit(&smc->old_counts, &smc->counts); |
| @@ -379,7 +387,7 @@ struct dm_space_map *dm_sm_checker_create(struct dm_space_map *sm) | |||
| 379 | ca_destroy(&smc->counts); | 387 | ca_destroy(&smc->counts); |
| 380 | ca_destroy(&smc->old_counts); | 388 | ca_destroy(&smc->old_counts); |
| 381 | kfree(smc); | 389 | kfree(smc); |
| 382 | return NULL; | 390 | return ERR_PTR(r); |
| 383 | } | 391 | } |
| 384 | 392 | ||
| 385 | return &smc->sm; | 393 | return &smc->sm; |
| @@ -391,25 +399,25 @@ struct dm_space_map *dm_sm_checker_create_fresh(struct dm_space_map *sm) | |||
| 391 | int r; | 399 | int r; |
| 392 | struct sm_checker *smc; | 400 | struct sm_checker *smc; |
| 393 | 401 | ||
| 394 | if (!sm) | 402 | if (IS_ERR_OR_NULL(sm)) |
| 395 | return NULL; | 403 | return ERR_PTR(-EINVAL); |
| 396 | 404 | ||
| 397 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); | 405 | smc = kmalloc(sizeof(*smc), GFP_KERNEL); |
| 398 | if (!smc) | 406 | if (!smc) |
| 399 | return NULL; | 407 | return ERR_PTR(-ENOMEM); |
| 400 | 408 | ||
| 401 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); | 409 | memcpy(&smc->sm, &ops_, sizeof(smc->sm)); |
| 402 | r = ca_create(&smc->old_counts, sm); | 410 | r = ca_create(&smc->old_counts, sm); |
| 403 | if (r) { | 411 | if (r) { |
| 404 | kfree(smc); | 412 | kfree(smc); |
| 405 | return NULL; | 413 | return ERR_PTR(r); |
| 406 | } | 414 | } |
| 407 | 415 | ||
| 408 | r = ca_create(&smc->counts, sm); | 416 | r = ca_create(&smc->counts, sm); |
| 409 | if (r) { | 417 | if (r) { |
| 410 | ca_destroy(&smc->old_counts); | 418 | ca_destroy(&smc->old_counts); |
| 411 | kfree(smc); | 419 | kfree(smc); |
| 412 | return NULL; | 420 | return ERR_PTR(r); |
| 413 | } | 421 | } |
| 414 | 422 | ||
| 415 | smc->real_sm = sm; | 423 | smc->real_sm = sm; |
diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c index fc469ba9f627..3d0ed5332883 100644 --- a/drivers/md/persistent-data/dm-space-map-disk.c +++ b/drivers/md/persistent-data/dm-space-map-disk.c | |||
| @@ -290,7 +290,16 @@ struct dm_space_map *dm_sm_disk_create(struct dm_transaction_manager *tm, | |||
| 290 | dm_block_t nr_blocks) | 290 | dm_block_t nr_blocks) |
| 291 | { | 291 | { |
| 292 | struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks); | 292 | struct dm_space_map *sm = dm_sm_disk_create_real(tm, nr_blocks); |
| 293 | return dm_sm_checker_create_fresh(sm); | 293 | struct dm_space_map *smc; |
| 294 | |||
| 295 | if (IS_ERR_OR_NULL(sm)) | ||
| 296 | return sm; | ||
| 297 | |||
| 298 | smc = dm_sm_checker_create_fresh(sm); | ||
| 299 | if (IS_ERR(smc)) | ||
| 300 | dm_sm_destroy(sm); | ||
| 301 | |||
| 302 | return smc; | ||
| 294 | } | 303 | } |
| 295 | EXPORT_SYMBOL_GPL(dm_sm_disk_create); | 304 | EXPORT_SYMBOL_GPL(dm_sm_disk_create); |
| 296 | 305 | ||
diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c index 400fe144c0cd..e5604b32d91f 100644 --- a/drivers/md/persistent-data/dm-transaction-manager.c +++ b/drivers/md/persistent-data/dm-transaction-manager.c | |||
| @@ -138,6 +138,9 @@ EXPORT_SYMBOL_GPL(dm_tm_create_non_blocking_clone); | |||
| 138 | 138 | ||
| 139 | void dm_tm_destroy(struct dm_transaction_manager *tm) | 139 | void dm_tm_destroy(struct dm_transaction_manager *tm) |
| 140 | { | 140 | { |
| 141 | if (!tm->is_clone) | ||
| 142 | wipe_shadow_table(tm); | ||
| 143 | |||
| 141 | kfree(tm); | 144 | kfree(tm); |
| 142 | } | 145 | } |
| 143 | EXPORT_SYMBOL_GPL(dm_tm_destroy); | 146 | EXPORT_SYMBOL_GPL(dm_tm_destroy); |
| @@ -344,8 +347,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, | |||
| 344 | } | 347 | } |
| 345 | 348 | ||
| 346 | *sm = dm_sm_checker_create(inner); | 349 | *sm = dm_sm_checker_create(inner); |
| 347 | if (!*sm) | 350 | if (IS_ERR(*sm)) { |
| 351 | r = PTR_ERR(*sm); | ||
| 348 | goto bad2; | 352 | goto bad2; |
| 353 | } | ||
| 349 | 354 | ||
| 350 | } else { | 355 | } else { |
| 351 | r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location, | 356 | r = dm_bm_write_lock(dm_tm_get_bm(*tm), sb_location, |
| @@ -364,8 +369,10 @@ static int dm_tm_create_internal(struct dm_block_manager *bm, | |||
| 364 | } | 369 | } |
| 365 | 370 | ||
| 366 | *sm = dm_sm_checker_create(inner); | 371 | *sm = dm_sm_checker_create(inner); |
| 367 | if (!*sm) | 372 | if (IS_ERR(*sm)) { |
| 373 | r = PTR_ERR(*sm); | ||
| 368 | goto bad2; | 374 | goto bad2; |
| 375 | } | ||
| 369 | } | 376 | } |
| 370 | 377 | ||
| 371 | return 0; | 378 | return 0; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 835de7168cd3..cacd008d6864 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -517,8 +517,8 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect | |||
| 517 | int bad_sectors; | 517 | int bad_sectors; |
| 518 | 518 | ||
| 519 | int disk = start_disk + i; | 519 | int disk = start_disk + i; |
| 520 | if (disk >= conf->raid_disks) | 520 | if (disk >= conf->raid_disks * 2) |
| 521 | disk -= conf->raid_disks; | 521 | disk -= conf->raid_disks * 2; |
| 522 | 522 | ||
| 523 | rdev = rcu_dereference(conf->mirrors[disk].rdev); | 523 | rdev = rcu_dereference(conf->mirrors[disk].rdev); |
| 524 | if (r1_bio->bios[disk] == IO_BLOCKED | 524 | if (r1_bio->bios[disk] == IO_BLOCKED |
| @@ -883,7 +883,6 @@ static void make_request(struct mddev *mddev, struct bio * bio) | |||
| 883 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); | 883 | const unsigned long do_sync = (bio->bi_rw & REQ_SYNC); |
| 884 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); | 884 | const unsigned long do_flush_fua = (bio->bi_rw & (REQ_FLUSH | REQ_FUA)); |
| 885 | struct md_rdev *blocked_rdev; | 885 | struct md_rdev *blocked_rdev; |
| 886 | int plugged; | ||
| 887 | int first_clone; | 886 | int first_clone; |
| 888 | int sectors_handled; | 887 | int sectors_handled; |
| 889 | int max_sectors; | 888 | int max_sectors; |
| @@ -1034,7 +1033,6 @@ read_again: | |||
| 1034 | * the bad blocks. Each set of writes gets it's own r1bio | 1033 | * the bad blocks. Each set of writes gets it's own r1bio |
| 1035 | * with a set of bios attached. | 1034 | * with a set of bios attached. |
| 1036 | */ | 1035 | */ |
| 1037 | plugged = mddev_check_plugged(mddev); | ||
| 1038 | 1036 | ||
| 1039 | disks = conf->raid_disks * 2; | 1037 | disks = conf->raid_disks * 2; |
| 1040 | retry_write: | 1038 | retry_write: |
| @@ -1191,6 +1189,8 @@ read_again: | |||
| 1191 | bio_list_add(&conf->pending_bio_list, mbio); | 1189 | bio_list_add(&conf->pending_bio_list, mbio); |
| 1192 | conf->pending_count++; | 1190 | conf->pending_count++; |
| 1193 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1191 | spin_unlock_irqrestore(&conf->device_lock, flags); |
| 1192 | if (!mddev_check_plugged(mddev)) | ||
| 1193 | md_wakeup_thread(mddev->thread); | ||
| 1194 | } | 1194 | } |
| 1195 | /* Mustn't call r1_bio_write_done before this next test, | 1195 | /* Mustn't call r1_bio_write_done before this next test, |
| 1196 | * as it could result in the bio being freed. | 1196 | * as it could result in the bio being freed. |
| @@ -1213,9 +1213,6 @@ read_again: | |||
| 1213 | 1213 | ||
| 1214 | /* In case raid1d snuck in to freeze_array */ | 1214 | /* In case raid1d snuck in to freeze_array */ |
| 1215 | wake_up(&conf->wait_barrier); | 1215 | wake_up(&conf->wait_barrier); |
| 1216 | |||
| 1217 | if (do_sync || !bitmap || !plugged) | ||
| 1218 | md_wakeup_thread(mddev->thread); | ||
| 1219 | } | 1216 | } |
| 1220 | 1217 | ||
| 1221 | static void status(struct seq_file *seq, struct mddev *mddev) | 1218 | static void status(struct seq_file *seq, struct mddev *mddev) |
| @@ -1821,8 +1818,14 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio) | |||
| 1821 | 1818 | ||
| 1822 | if (atomic_dec_and_test(&r1_bio->remaining)) { | 1819 | if (atomic_dec_and_test(&r1_bio->remaining)) { |
| 1823 | /* if we're here, all write(s) have completed, so clean up */ | 1820 | /* if we're here, all write(s) have completed, so clean up */ |
| 1824 | md_done_sync(mddev, r1_bio->sectors, 1); | 1821 | int s = r1_bio->sectors; |
| 1825 | put_buf(r1_bio); | 1822 | if (test_bit(R1BIO_MadeGood, &r1_bio->state) || |
| 1823 | test_bit(R1BIO_WriteError, &r1_bio->state)) | ||
| 1824 | reschedule_retry(r1_bio); | ||
| 1825 | else { | ||
| 1826 | put_buf(r1_bio); | ||
| 1827 | md_done_sync(mddev, s, 1); | ||
| 1828 | } | ||
| 1826 | } | 1829 | } |
| 1827 | } | 1830 | } |
| 1828 | 1831 | ||
| @@ -2488,9 +2491,10 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp | |||
| 2488 | */ | 2491 | */ |
| 2489 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { | 2492 | if (test_bit(MD_RECOVERY_REQUESTED, &mddev->recovery)) { |
| 2490 | atomic_set(&r1_bio->remaining, read_targets); | 2493 | atomic_set(&r1_bio->remaining, read_targets); |
| 2491 | for (i = 0; i < conf->raid_disks * 2; i++) { | 2494 | for (i = 0; i < conf->raid_disks * 2 && read_targets; i++) { |
| 2492 | bio = r1_bio->bios[i]; | 2495 | bio = r1_bio->bios[i]; |
| 2493 | if (bio->bi_end_io == end_sync_read) { | 2496 | if (bio->bi_end_io == end_sync_read) { |
| 2497 | read_targets--; | ||
| 2494 | md_sync_acct(bio->bi_bdev, nr_sectors); | 2498 | md_sync_acct(bio->bi_bdev, nr_sectors); |
| 2495 | generic_make_request(bio); | 2499 | generic_make_request(bio); |
| 2496 | } | 2500 | } |
| @@ -2550,6 +2554,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
| 2550 | err = -EINVAL; | 2554 | err = -EINVAL; |
| 2551 | spin_lock_init(&conf->device_lock); | 2555 | spin_lock_init(&conf->device_lock); |
| 2552 | rdev_for_each(rdev, mddev) { | 2556 | rdev_for_each(rdev, mddev) { |
| 2557 | struct request_queue *q; | ||
| 2553 | int disk_idx = rdev->raid_disk; | 2558 | int disk_idx = rdev->raid_disk; |
| 2554 | if (disk_idx >= mddev->raid_disks | 2559 | if (disk_idx >= mddev->raid_disks |
| 2555 | || disk_idx < 0) | 2560 | || disk_idx < 0) |
| @@ -2562,6 +2567,9 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
| 2562 | if (disk->rdev) | 2567 | if (disk->rdev) |
| 2563 | goto abort; | 2568 | goto abort; |
| 2564 | disk->rdev = rdev; | 2569 | disk->rdev = rdev; |
| 2570 | q = bdev_get_queue(rdev->bdev); | ||
| 2571 | if (q->merge_bvec_fn) | ||
| 2572 | mddev->merge_check_needed = 1; | ||
| 2565 | 2573 | ||
| 2566 | disk->head_position = 0; | 2574 | disk->head_position = 0; |
| 2567 | } | 2575 | } |
| @@ -2617,7 +2625,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
| 2617 | goto abort; | 2625 | goto abort; |
| 2618 | } | 2626 | } |
| 2619 | err = -ENOMEM; | 2627 | err = -ENOMEM; |
| 2620 | conf->thread = md_register_thread(raid1d, mddev, NULL); | 2628 | conf->thread = md_register_thread(raid1d, mddev, "raid1"); |
| 2621 | if (!conf->thread) { | 2629 | if (!conf->thread) { |
| 2622 | printk(KERN_ERR | 2630 | printk(KERN_ERR |
| 2623 | "md/raid1:%s: couldn't allocate thread\n", | 2631 | "md/raid1:%s: couldn't allocate thread\n", |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 987db37cb875..8da6282254c3 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
| @@ -1039,7 +1039,6 @@ static void make_request(struct mddev *mddev, struct bio * bio) | |||
| 1039 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); | 1039 | const unsigned long do_fua = (bio->bi_rw & REQ_FUA); |
| 1040 | unsigned long flags; | 1040 | unsigned long flags; |
| 1041 | struct md_rdev *blocked_rdev; | 1041 | struct md_rdev *blocked_rdev; |
| 1042 | int plugged; | ||
| 1043 | int sectors_handled; | 1042 | int sectors_handled; |
| 1044 | int max_sectors; | 1043 | int max_sectors; |
| 1045 | int sectors; | 1044 | int sectors; |
| @@ -1239,7 +1238,6 @@ read_again: | |||
| 1239 | * of r10_bios is recored in bio->bi_phys_segments just as with | 1238 | * of r10_bios is recored in bio->bi_phys_segments just as with |
| 1240 | * the read case. | 1239 | * the read case. |
| 1241 | */ | 1240 | */ |
| 1242 | plugged = mddev_check_plugged(mddev); | ||
| 1243 | 1241 | ||
| 1244 | r10_bio->read_slot = -1; /* make sure repl_bio gets freed */ | 1242 | r10_bio->read_slot = -1; /* make sure repl_bio gets freed */ |
| 1245 | raid10_find_phys(conf, r10_bio); | 1243 | raid10_find_phys(conf, r10_bio); |
| @@ -1396,6 +1394,8 @@ retry_write: | |||
| 1396 | bio_list_add(&conf->pending_bio_list, mbio); | 1394 | bio_list_add(&conf->pending_bio_list, mbio); |
| 1397 | conf->pending_count++; | 1395 | conf->pending_count++; |
| 1398 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1396 | spin_unlock_irqrestore(&conf->device_lock, flags); |
| 1397 | if (!mddev_check_plugged(mddev)) | ||
| 1398 | md_wakeup_thread(mddev->thread); | ||
| 1399 | 1399 | ||
| 1400 | if (!r10_bio->devs[i].repl_bio) | 1400 | if (!r10_bio->devs[i].repl_bio) |
| 1401 | continue; | 1401 | continue; |
| @@ -1423,6 +1423,8 @@ retry_write: | |||
| 1423 | bio_list_add(&conf->pending_bio_list, mbio); | 1423 | bio_list_add(&conf->pending_bio_list, mbio); |
| 1424 | conf->pending_count++; | 1424 | conf->pending_count++; |
| 1425 | spin_unlock_irqrestore(&conf->device_lock, flags); | 1425 | spin_unlock_irqrestore(&conf->device_lock, flags); |
| 1426 | if (!mddev_check_plugged(mddev)) | ||
| 1427 | md_wakeup_thread(mddev->thread); | ||
| 1426 | } | 1428 | } |
| 1427 | 1429 | ||
| 1428 | /* Don't remove the bias on 'remaining' (one_write_done) until | 1430 | /* Don't remove the bias on 'remaining' (one_write_done) until |
| @@ -1448,9 +1450,6 @@ retry_write: | |||
| 1448 | 1450 | ||
| 1449 | /* In case raid10d snuck in to freeze_array */ | 1451 | /* In case raid10d snuck in to freeze_array */ |
| 1450 | wake_up(&conf->wait_barrier); | 1452 | wake_up(&conf->wait_barrier); |
| 1451 | |||
| 1452 | if (do_sync || !mddev->bitmap || !plugged) | ||
| 1453 | md_wakeup_thread(mddev->thread); | ||
| 1454 | } | 1453 | } |
| 1455 | 1454 | ||
| 1456 | static void status(struct seq_file *seq, struct mddev *mddev) | 1455 | static void status(struct seq_file *seq, struct mddev *mddev) |
| @@ -2310,7 +2309,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 | |||
| 2310 | if (r10_sync_page_io(rdev, | 2309 | if (r10_sync_page_io(rdev, |
| 2311 | r10_bio->devs[sl].addr + | 2310 | r10_bio->devs[sl].addr + |
| 2312 | sect, | 2311 | sect, |
| 2313 | s<<9, conf->tmppage, WRITE) | 2312 | s, conf->tmppage, WRITE) |
| 2314 | == 0) { | 2313 | == 0) { |
| 2315 | /* Well, this device is dead */ | 2314 | /* Well, this device is dead */ |
| 2316 | printk(KERN_NOTICE | 2315 | printk(KERN_NOTICE |
| @@ -2349,7 +2348,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10 | |||
| 2349 | switch (r10_sync_page_io(rdev, | 2348 | switch (r10_sync_page_io(rdev, |
| 2350 | r10_bio->devs[sl].addr + | 2349 | r10_bio->devs[sl].addr + |
| 2351 | sect, | 2350 | sect, |
| 2352 | s<<9, conf->tmppage, | 2351 | s, conf->tmppage, |
| 2353 | READ)) { | 2352 | READ)) { |
| 2354 | case 0: | 2353 | case 0: |
| 2355 | /* Well, this device is dead */ | 2354 | /* Well, this device is dead */ |
| @@ -2512,7 +2511,7 @@ read_more: | |||
| 2512 | slot = r10_bio->read_slot; | 2511 | slot = r10_bio->read_slot; |
| 2513 | printk_ratelimited( | 2512 | printk_ratelimited( |
| 2514 | KERN_ERR | 2513 | KERN_ERR |
| 2515 | "md/raid10:%s: %s: redirecting" | 2514 | "md/raid10:%s: %s: redirecting " |
| 2516 | "sector %llu to another mirror\n", | 2515 | "sector %llu to another mirror\n", |
| 2517 | mdname(mddev), | 2516 | mdname(mddev), |
| 2518 | bdevname(rdev->bdev, b), | 2517 | bdevname(rdev->bdev, b), |
| @@ -2661,7 +2660,8 @@ static void raid10d(struct mddev *mddev) | |||
| 2661 | blk_start_plug(&plug); | 2660 | blk_start_plug(&plug); |
| 2662 | for (;;) { | 2661 | for (;;) { |
| 2663 | 2662 | ||
| 2664 | flush_pending_writes(conf); | 2663 | if (atomic_read(&mddev->plug_cnt) == 0) |
| 2664 | flush_pending_writes(conf); | ||
| 2665 | 2665 | ||
| 2666 | spin_lock_irqsave(&conf->device_lock, flags); | 2666 | spin_lock_irqsave(&conf->device_lock, flags); |
| 2667 | if (list_empty(head)) { | 2667 | if (list_empty(head)) { |
| @@ -2890,6 +2890,12 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
| 2890 | /* want to reconstruct this device */ | 2890 | /* want to reconstruct this device */ |
| 2891 | rb2 = r10_bio; | 2891 | rb2 = r10_bio; |
| 2892 | sect = raid10_find_virt(conf, sector_nr, i); | 2892 | sect = raid10_find_virt(conf, sector_nr, i); |
| 2893 | if (sect >= mddev->resync_max_sectors) { | ||
| 2894 | /* last stripe is not complete - don't | ||
| 2895 | * try to recover this sector. | ||
| 2896 | */ | ||
| 2897 | continue; | ||
| 2898 | } | ||
| 2893 | /* Unless we are doing a full sync, or a replacement | 2899 | /* Unless we are doing a full sync, or a replacement |
| 2894 | * we only need to recover the block if it is set in | 2900 | * we only need to recover the block if it is set in |
| 2895 | * the bitmap | 2901 | * the bitmap |
| @@ -3421,7 +3427,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) | |||
| 3421 | spin_lock_init(&conf->resync_lock); | 3427 | spin_lock_init(&conf->resync_lock); |
| 3422 | init_waitqueue_head(&conf->wait_barrier); | 3428 | init_waitqueue_head(&conf->wait_barrier); |
| 3423 | 3429 | ||
| 3424 | conf->thread = md_register_thread(raid10d, mddev, NULL); | 3430 | conf->thread = md_register_thread(raid10d, mddev, "raid10"); |
| 3425 | if (!conf->thread) | 3431 | if (!conf->thread) |
| 3426 | goto out; | 3432 | goto out; |
| 3427 | 3433 | ||
| @@ -3475,6 +3481,7 @@ static int run(struct mddev *mddev) | |||
| 3475 | 3481 | ||
| 3476 | rdev_for_each(rdev, mddev) { | 3482 | rdev_for_each(rdev, mddev) { |
| 3477 | long long diff; | 3483 | long long diff; |
| 3484 | struct request_queue *q; | ||
| 3478 | 3485 | ||
| 3479 | disk_idx = rdev->raid_disk; | 3486 | disk_idx = rdev->raid_disk; |
| 3480 | if (disk_idx < 0) | 3487 | if (disk_idx < 0) |
| @@ -3493,6 +3500,9 @@ static int run(struct mddev *mddev) | |||
| 3493 | goto out_free_conf; | 3500 | goto out_free_conf; |
| 3494 | disk->rdev = rdev; | 3501 | disk->rdev = rdev; |
| 3495 | } | 3502 | } |
| 3503 | q = bdev_get_queue(rdev->bdev); | ||
| 3504 | if (q->merge_bvec_fn) | ||
| 3505 | mddev->merge_check_needed = 1; | ||
| 3496 | diff = (rdev->new_data_offset - rdev->data_offset); | 3506 | diff = (rdev->new_data_offset - rdev->data_offset); |
| 3497 | if (!mddev->reshape_backwards) | 3507 | if (!mddev->reshape_backwards) |
| 3498 | diff = -diff; | 3508 | diff = -diff; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d26767246d26..04348d76bb30 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -196,12 +196,14 @@ static void __release_stripe(struct r5conf *conf, struct stripe_head *sh) | |||
| 196 | BUG_ON(!list_empty(&sh->lru)); | 196 | BUG_ON(!list_empty(&sh->lru)); |
| 197 | BUG_ON(atomic_read(&conf->active_stripes)==0); | 197 | BUG_ON(atomic_read(&conf->active_stripes)==0); |
| 198 | if (test_bit(STRIPE_HANDLE, &sh->state)) { | 198 | if (test_bit(STRIPE_HANDLE, &sh->state)) { |
| 199 | if (test_bit(STRIPE_DELAYED, &sh->state)) | 199 | if (test_bit(STRIPE_DELAYED, &sh->state) && |
| 200 | !test_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | ||
| 200 | list_add_tail(&sh->lru, &conf->delayed_list); | 201 | list_add_tail(&sh->lru, &conf->delayed_list); |
| 201 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && | 202 | else if (test_bit(STRIPE_BIT_DELAY, &sh->state) && |
| 202 | sh->bm_seq - conf->seq_write > 0) | 203 | sh->bm_seq - conf->seq_write > 0) |
| 203 | list_add_tail(&sh->lru, &conf->bitmap_list); | 204 | list_add_tail(&sh->lru, &conf->bitmap_list); |
| 204 | else { | 205 | else { |
| 206 | clear_bit(STRIPE_DELAYED, &sh->state); | ||
| 205 | clear_bit(STRIPE_BIT_DELAY, &sh->state); | 207 | clear_bit(STRIPE_BIT_DELAY, &sh->state); |
| 206 | list_add_tail(&sh->lru, &conf->handle_list); | 208 | list_add_tail(&sh->lru, &conf->handle_list); |
| 207 | } | 209 | } |
| @@ -606,6 +608,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) | |||
| 606 | * a chance*/ | 608 | * a chance*/ |
| 607 | md_check_recovery(conf->mddev); | 609 | md_check_recovery(conf->mddev); |
| 608 | } | 610 | } |
| 611 | /* | ||
| 612 | * Because md_wait_for_blocked_rdev | ||
| 613 | * will dec nr_pending, we must | ||
| 614 | * increment it first. | ||
| 615 | */ | ||
| 616 | atomic_inc(&rdev->nr_pending); | ||
| 609 | md_wait_for_blocked_rdev(rdev, conf->mddev); | 617 | md_wait_for_blocked_rdev(rdev, conf->mddev); |
| 610 | } else { | 618 | } else { |
| 611 | /* Acknowledged bad block - skip the write */ | 619 | /* Acknowledged bad block - skip the write */ |
| @@ -1737,6 +1745,7 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
| 1737 | } else { | 1745 | } else { |
| 1738 | const char *bdn = bdevname(rdev->bdev, b); | 1746 | const char *bdn = bdevname(rdev->bdev, b); |
| 1739 | int retry = 0; | 1747 | int retry = 0; |
| 1748 | int set_bad = 0; | ||
| 1740 | 1749 | ||
| 1741 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); | 1750 | clear_bit(R5_UPTODATE, &sh->dev[i].flags); |
| 1742 | atomic_inc(&rdev->read_errors); | 1751 | atomic_inc(&rdev->read_errors); |
| @@ -1748,7 +1757,8 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
| 1748 | mdname(conf->mddev), | 1757 | mdname(conf->mddev), |
| 1749 | (unsigned long long)s, | 1758 | (unsigned long long)s, |
| 1750 | bdn); | 1759 | bdn); |
| 1751 | else if (conf->mddev->degraded >= conf->max_degraded) | 1760 | else if (conf->mddev->degraded >= conf->max_degraded) { |
| 1761 | set_bad = 1; | ||
| 1752 | printk_ratelimited( | 1762 | printk_ratelimited( |
| 1753 | KERN_WARNING | 1763 | KERN_WARNING |
| 1754 | "md/raid:%s: read error not correctable " | 1764 | "md/raid:%s: read error not correctable " |
| @@ -1756,8 +1766,9 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
| 1756 | mdname(conf->mddev), | 1766 | mdname(conf->mddev), |
| 1757 | (unsigned long long)s, | 1767 | (unsigned long long)s, |
| 1758 | bdn); | 1768 | bdn); |
| 1759 | else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) | 1769 | } else if (test_bit(R5_ReWrite, &sh->dev[i].flags)) { |
| 1760 | /* Oh, no!!! */ | 1770 | /* Oh, no!!! */ |
| 1771 | set_bad = 1; | ||
| 1761 | printk_ratelimited( | 1772 | printk_ratelimited( |
| 1762 | KERN_WARNING | 1773 | KERN_WARNING |
| 1763 | "md/raid:%s: read error NOT corrected!! " | 1774 | "md/raid:%s: read error NOT corrected!! " |
| @@ -1765,7 +1776,7 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
| 1765 | mdname(conf->mddev), | 1776 | mdname(conf->mddev), |
| 1766 | (unsigned long long)s, | 1777 | (unsigned long long)s, |
| 1767 | bdn); | 1778 | bdn); |
| 1768 | else if (atomic_read(&rdev->read_errors) | 1779 | } else if (atomic_read(&rdev->read_errors) |
| 1769 | > conf->max_nr_stripes) | 1780 | > conf->max_nr_stripes) |
| 1770 | printk(KERN_WARNING | 1781 | printk(KERN_WARNING |
| 1771 | "md/raid:%s: Too many read errors, failing device %s.\n", | 1782 | "md/raid:%s: Too many read errors, failing device %s.\n", |
| @@ -1777,7 +1788,11 @@ static void raid5_end_read_request(struct bio * bi, int error) | |||
| 1777 | else { | 1788 | else { |
| 1778 | clear_bit(R5_ReadError, &sh->dev[i].flags); | 1789 | clear_bit(R5_ReadError, &sh->dev[i].flags); |
| 1779 | clear_bit(R5_ReWrite, &sh->dev[i].flags); | 1790 | clear_bit(R5_ReWrite, &sh->dev[i].flags); |
| 1780 | md_error(conf->mddev, rdev); | 1791 | if (!(set_bad |
| 1792 | && test_bit(In_sync, &rdev->flags) | ||
| 1793 | && rdev_set_badblocks( | ||
| 1794 | rdev, sh->sector, STRIPE_SECTORS, 0))) | ||
| 1795 | md_error(conf->mddev, rdev); | ||
| 1781 | } | 1796 | } |
| 1782 | } | 1797 | } |
| 1783 | rdev_dec_pending(rdev, conf->mddev); | 1798 | rdev_dec_pending(rdev, conf->mddev); |
| @@ -3582,8 +3597,18 @@ static void handle_stripe(struct stripe_head *sh) | |||
| 3582 | 3597 | ||
| 3583 | finish: | 3598 | finish: |
| 3584 | /* wait for this device to become unblocked */ | 3599 | /* wait for this device to become unblocked */ |
| 3585 | if (conf->mddev->external && unlikely(s.blocked_rdev)) | 3600 | if (unlikely(s.blocked_rdev)) { |
| 3586 | md_wait_for_blocked_rdev(s.blocked_rdev, conf->mddev); | 3601 | if (conf->mddev->external) |
| 3602 | md_wait_for_blocked_rdev(s.blocked_rdev, | ||
| 3603 | conf->mddev); | ||
| 3604 | else | ||
| 3605 | /* Internal metadata will immediately | ||
| 3606 | * be written by raid5d, so we don't | ||
| 3607 | * need to wait here. | ||
| 3608 | */ | ||
| 3609 | rdev_dec_pending(s.blocked_rdev, | ||
| 3610 | conf->mddev); | ||
| 3611 | } | ||
| 3587 | 3612 | ||
| 3588 | if (s.handle_bad_blocks) | 3613 | if (s.handle_bad_blocks) |
| 3589 | for (i = disks; i--; ) { | 3614 | for (i = disks; i--; ) { |
| @@ -3881,8 +3906,6 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
| 3881 | raid_bio->bi_next = (void*)rdev; | 3906 | raid_bio->bi_next = (void*)rdev; |
| 3882 | align_bi->bi_bdev = rdev->bdev; | 3907 | align_bi->bi_bdev = rdev->bdev; |
| 3883 | align_bi->bi_flags &= ~(1 << BIO_SEG_VALID); | 3908 | align_bi->bi_flags &= ~(1 << BIO_SEG_VALID); |
| 3884 | /* No reshape active, so we can trust rdev->data_offset */ | ||
| 3885 | align_bi->bi_sector += rdev->data_offset; | ||
| 3886 | 3909 | ||
| 3887 | if (!bio_fits_rdev(align_bi) || | 3910 | if (!bio_fits_rdev(align_bi) || |
| 3888 | is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9, | 3911 | is_badblock(rdev, align_bi->bi_sector, align_bi->bi_size>>9, |
| @@ -3893,6 +3916,9 @@ static int chunk_aligned_read(struct mddev *mddev, struct bio * raid_bio) | |||
| 3893 | return 0; | 3916 | return 0; |
| 3894 | } | 3917 | } |
| 3895 | 3918 | ||
| 3919 | /* No reshape active, so we can trust rdev->data_offset */ | ||
| 3920 | align_bi->bi_sector += rdev->data_offset; | ||
| 3921 | |||
| 3896 | spin_lock_irq(&conf->device_lock); | 3922 | spin_lock_irq(&conf->device_lock); |
| 3897 | wait_event_lock_irq(conf->wait_for_stripe, | 3923 | wait_event_lock_irq(conf->wait_for_stripe, |
| 3898 | conf->quiesce == 0, | 3924 | conf->quiesce == 0, |
| @@ -3971,7 +3997,6 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
| 3971 | struct stripe_head *sh; | 3997 | struct stripe_head *sh; |
| 3972 | const int rw = bio_data_dir(bi); | 3998 | const int rw = bio_data_dir(bi); |
| 3973 | int remaining; | 3999 | int remaining; |
| 3974 | int plugged; | ||
| 3975 | 4000 | ||
| 3976 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { | 4001 | if (unlikely(bi->bi_rw & REQ_FLUSH)) { |
| 3977 | md_flush_request(mddev, bi); | 4002 | md_flush_request(mddev, bi); |
| @@ -3990,7 +4015,6 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
| 3990 | bi->bi_next = NULL; | 4015 | bi->bi_next = NULL; |
| 3991 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ | 4016 | bi->bi_phys_segments = 1; /* over-loaded to count active stripes */ |
| 3992 | 4017 | ||
| 3993 | plugged = mddev_check_plugged(mddev); | ||
| 3994 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { | 4018 | for (;logical_sector < last_sector; logical_sector += STRIPE_SECTORS) { |
| 3995 | DEFINE_WAIT(w); | 4019 | DEFINE_WAIT(w); |
| 3996 | int previous; | 4020 | int previous; |
| @@ -4092,6 +4116,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
| 4092 | if ((bi->bi_rw & REQ_SYNC) && | 4116 | if ((bi->bi_rw & REQ_SYNC) && |
| 4093 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) | 4117 | !test_and_set_bit(STRIPE_PREREAD_ACTIVE, &sh->state)) |
| 4094 | atomic_inc(&conf->preread_active_stripes); | 4118 | atomic_inc(&conf->preread_active_stripes); |
| 4119 | mddev_check_plugged(mddev); | ||
| 4095 | release_stripe(sh); | 4120 | release_stripe(sh); |
| 4096 | } else { | 4121 | } else { |
| 4097 | /* cannot get stripe for read-ahead, just give-up */ | 4122 | /* cannot get stripe for read-ahead, just give-up */ |
| @@ -4099,10 +4124,7 @@ static void make_request(struct mddev *mddev, struct bio * bi) | |||
| 4099 | finish_wait(&conf->wait_for_overlap, &w); | 4124 | finish_wait(&conf->wait_for_overlap, &w); |
| 4100 | break; | 4125 | break; |
| 4101 | } | 4126 | } |
| 4102 | |||
| 4103 | } | 4127 | } |
| 4104 | if (!plugged) | ||
| 4105 | md_wakeup_thread(mddev->thread); | ||
| 4106 | 4128 | ||
| 4107 | spin_lock_irq(&conf->device_lock); | 4129 | spin_lock_irq(&conf->device_lock); |
| 4108 | remaining = raid5_dec_bi_phys_segments(bi); | 4130 | remaining = raid5_dec_bi_phys_segments(bi); |
| @@ -4823,6 +4845,7 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
| 4823 | int raid_disk, memory, max_disks; | 4845 | int raid_disk, memory, max_disks; |
| 4824 | struct md_rdev *rdev; | 4846 | struct md_rdev *rdev; |
| 4825 | struct disk_info *disk; | 4847 | struct disk_info *disk; |
| 4848 | char pers_name[6]; | ||
| 4826 | 4849 | ||
| 4827 | if (mddev->new_level != 5 | 4850 | if (mddev->new_level != 5 |
| 4828 | && mddev->new_level != 4 | 4851 | && mddev->new_level != 4 |
| @@ -4946,7 +4969,8 @@ static struct r5conf *setup_conf(struct mddev *mddev) | |||
| 4946 | printk(KERN_INFO "md/raid:%s: allocated %dkB\n", | 4969 | printk(KERN_INFO "md/raid:%s: allocated %dkB\n", |
| 4947 | mdname(mddev), memory); | 4970 | mdname(mddev), memory); |
| 4948 | 4971 | ||
| 4949 | conf->thread = md_register_thread(raid5d, mddev, NULL); | 4972 | sprintf(pers_name, "raid%d", mddev->new_level); |
| 4973 | conf->thread = md_register_thread(raid5d, mddev, pers_name); | ||
| 4950 | if (!conf->thread) { | 4974 | if (!conf->thread) { |
| 4951 | printk(KERN_ERR | 4975 | printk(KERN_ERR |
| 4952 | "md/raid:%s: couldn't allocate thread.\n", | 4976 | "md/raid:%s: couldn't allocate thread.\n", |
| @@ -5465,10 +5489,9 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
| 5465 | if (rdev->saved_raid_disk >= 0 && | 5489 | if (rdev->saved_raid_disk >= 0 && |
| 5466 | rdev->saved_raid_disk >= first && | 5490 | rdev->saved_raid_disk >= first && |
| 5467 | conf->disks[rdev->saved_raid_disk].rdev == NULL) | 5491 | conf->disks[rdev->saved_raid_disk].rdev == NULL) |
| 5468 | disk = rdev->saved_raid_disk; | 5492 | first = rdev->saved_raid_disk; |
| 5469 | else | 5493 | |
| 5470 | disk = first; | 5494 | for (disk = first; disk <= last; disk++) { |
| 5471 | for ( ; disk <= last ; disk++) { | ||
| 5472 | p = conf->disks + disk; | 5495 | p = conf->disks + disk; |
| 5473 | if (p->rdev == NULL) { | 5496 | if (p->rdev == NULL) { |
| 5474 | clear_bit(In_sync, &rdev->flags); | 5497 | clear_bit(In_sync, &rdev->flags); |
| @@ -5477,8 +5500,11 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
| 5477 | if (rdev->saved_raid_disk != disk) | 5500 | if (rdev->saved_raid_disk != disk) |
| 5478 | conf->fullsync = 1; | 5501 | conf->fullsync = 1; |
| 5479 | rcu_assign_pointer(p->rdev, rdev); | 5502 | rcu_assign_pointer(p->rdev, rdev); |
| 5480 | break; | 5503 | goto out; |
| 5481 | } | 5504 | } |
| 5505 | } | ||
| 5506 | for (disk = first; disk <= last; disk++) { | ||
| 5507 | p = conf->disks + disk; | ||
| 5482 | if (test_bit(WantReplacement, &p->rdev->flags) && | 5508 | if (test_bit(WantReplacement, &p->rdev->flags) && |
| 5483 | p->replacement == NULL) { | 5509 | p->replacement == NULL) { |
| 5484 | clear_bit(In_sync, &rdev->flags); | 5510 | clear_bit(In_sync, &rdev->flags); |
| @@ -5490,6 +5516,7 @@ static int raid5_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
| 5490 | break; | 5516 | break; |
| 5491 | } | 5517 | } |
| 5492 | } | 5518 | } |
| 5519 | out: | ||
| 5493 | print_raid5_conf(conf); | 5520 | print_raid5_conf(conf); |
| 5494 | return err; | 5521 | return err; |
| 5495 | } | 5522 | } |
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 7d42c11c8684..0cdbd742974a 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
| @@ -198,7 +198,6 @@ static int fops_open(struct file *file) | |||
| 198 | struct saa7146_dev *dev = video_drvdata(file); | 198 | struct saa7146_dev *dev = video_drvdata(file); |
| 199 | struct saa7146_fh *fh = NULL; | 199 | struct saa7146_fh *fh = NULL; |
| 200 | int result = 0; | 200 | int result = 0; |
| 201 | enum v4l2_buf_type type; | ||
| 202 | 201 | ||
| 203 | DEB_EE("file:%p, dev:%s\n", file, video_device_node_name(vdev)); | 202 | DEB_EE("file:%p, dev:%s\n", file, video_device_node_name(vdev)); |
| 204 | 203 | ||
| @@ -207,10 +206,6 @@ static int fops_open(struct file *file) | |||
| 207 | 206 | ||
| 208 | DEB_D("using: %p\n", dev); | 207 | DEB_D("using: %p\n", dev); |
| 209 | 208 | ||
| 210 | type = vdev->vfl_type == VFL_TYPE_GRABBER | ||
| 211 | ? V4L2_BUF_TYPE_VIDEO_CAPTURE | ||
| 212 | : V4L2_BUF_TYPE_VBI_CAPTURE; | ||
| 213 | |||
| 214 | /* check if an extension is registered */ | 209 | /* check if an extension is registered */ |
| 215 | if( NULL == dev->ext ) { | 210 | if( NULL == dev->ext ) { |
| 216 | DEB_S("no extension registered for this device\n"); | 211 | DEB_S("no extension registered for this device\n"); |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 00a67326c193..39eab73b01ae 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
| @@ -243,6 +243,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, | |||
| 243 | if (minor == MAX_DVB_MINORS) { | 243 | if (minor == MAX_DVB_MINORS) { |
| 244 | kfree(dvbdevfops); | 244 | kfree(dvbdevfops); |
| 245 | kfree(dvbdev); | 245 | kfree(dvbdev); |
| 246 | up_write(&minor_rwsem); | ||
| 246 | mutex_unlock(&dvbdev_register_lock); | 247 | mutex_unlock(&dvbdev_register_lock); |
| 247 | return -EINVAL; | 248 | return -EINVAL; |
| 248 | } | 249 | } |
diff --git a/drivers/media/dvb/frontends/cx24110.c b/drivers/media/dvb/frontends/cx24110.c index 98ecaf0900d6..3180f5b2a6a6 100644 --- a/drivers/media/dvb/frontends/cx24110.c +++ b/drivers/media/dvb/frontends/cx24110.c | |||
| @@ -516,9 +516,9 @@ static int cx24110_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks) | |||
| 516 | if(cx24110_readreg(state,0x10)&0x40) { | 516 | if(cx24110_readreg(state,0x10)&0x40) { |
| 517 | /* the RS error counter has finished one counting window */ | 517 | /* the RS error counter has finished one counting window */ |
| 518 | cx24110_writereg(state,0x10,0x60); /* select the byer reg */ | 518 | cx24110_writereg(state,0x10,0x60); /* select the byer reg */ |
| 519 | cx24110_readreg(state, 0x12) | | 519 | (void)(cx24110_readreg(state, 0x12) | |
| 520 | (cx24110_readreg(state, 0x13) << 8) | | 520 | (cx24110_readreg(state, 0x13) << 8) | |
| 521 | (cx24110_readreg(state, 0x14) << 16); | 521 | (cx24110_readreg(state, 0x14) << 16)); |
| 522 | cx24110_writereg(state,0x10,0x70); /* select the bler reg */ | 522 | cx24110_writereg(state,0x10,0x70); /* select the bler reg */ |
| 523 | state->lastbler=cx24110_readreg(state,0x12)| | 523 | state->lastbler=cx24110_readreg(state,0x12)| |
| 524 | (cx24110_readreg(state,0x13)<<8)| | 524 | (cx24110_readreg(state,0x13)<<8)| |
diff --git a/drivers/media/dvb/frontends/cxd2820r_c.c b/drivers/media/dvb/frontends/cxd2820r_c.c index 945404991529..ed3b0ba624de 100644 --- a/drivers/media/dvb/frontends/cxd2820r_c.c +++ b/drivers/media/dvb/frontends/cxd2820r_c.c | |||
| @@ -121,7 +121,7 @@ int cxd2820r_get_frontend_c(struct dvb_frontend *fe) | |||
| 121 | if (ret) | 121 | if (ret) |
| 122 | goto error; | 122 | goto error; |
| 123 | 123 | ||
| 124 | switch ((buf[0] >> 0) & 0x03) { | 124 | switch ((buf[0] >> 0) & 0x07) { |
| 125 | case 0: | 125 | case 0: |
| 126 | c->modulation = QAM_16; | 126 | c->modulation = QAM_16; |
| 127 | break; | 127 | break; |
diff --git a/drivers/media/dvb/frontends/lg2160.c b/drivers/media/dvb/frontends/lg2160.c index a3ab1a5b6597..cc11260e99df 100644 --- a/drivers/media/dvb/frontends/lg2160.c +++ b/drivers/media/dvb/frontends/lg2160.c | |||
| @@ -126,7 +126,7 @@ static int lg216x_write_regs(struct lg216x_state *state, | |||
| 126 | 126 | ||
| 127 | lg_reg("writing %d registers...\n", len); | 127 | lg_reg("writing %d registers...\n", len); |
| 128 | 128 | ||
| 129 | for (i = 0; i < len - 1; i++) { | 129 | for (i = 0; i < len; i++) { |
| 130 | ret = lg216x_write_reg(state, regs[i].reg, regs[i].val); | 130 | ret = lg216x_write_reg(state, regs[i].reg, regs[i].val); |
| 131 | if (lg_fail(ret)) | 131 | if (lg_fail(ret)) |
| 132 | return ret; | 132 | return ret; |
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index 63c004a25e0b..664e460f247b 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c | |||
| @@ -544,6 +544,8 @@ static const struct usb_device_id smsusb_id_table[] __devinitconst = { | |||
| 544 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | 544 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, |
| 545 | { USB_DEVICE(0x2040, 0xc0a0), | 545 | { USB_DEVICE(0x2040, 0xc0a0), |
| 546 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | 546 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, |
| 547 | { USB_DEVICE(0x2040, 0xf5a0), | ||
| 548 | .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM }, | ||
| 547 | { } /* Terminating entry */ | 549 | { } /* Terminating entry */ |
| 548 | }; | 550 | }; |
| 549 | 551 | ||
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 740a3d5520c7..b415211d0c4b 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
| @@ -157,7 +157,7 @@ static int __devinit maxiradio_probe(struct pci_dev *pdev, const struct pci_devi | |||
| 157 | goto err_out_free_region; | 157 | goto err_out_free_region; |
| 158 | 158 | ||
| 159 | dev->io = pci_resource_start(pdev, 0); | 159 | dev->io = pci_resource_start(pdev, 0); |
| 160 | if (snd_tea575x_init(&dev->tea)) { | 160 | if (snd_tea575x_init(&dev->tea, THIS_MODULE)) { |
| 161 | printk(KERN_ERR "radio-maxiradio: Unable to detect TEA575x tuner\n"); | 161 | printk(KERN_ERR "radio-maxiradio: Unable to detect TEA575x tuner\n"); |
| 162 | goto err_out_free_region; | 162 | goto err_out_free_region; |
| 163 | } | 163 | } |
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 52b8011f1b23..4efcbec74c52 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
| @@ -238,7 +238,7 @@ static int __devinit fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io) | |||
| 238 | snprintf(fmr2->tea.bus_info, sizeof(fmr2->tea.bus_info), "%s:%s", | 238 | snprintf(fmr2->tea.bus_info, sizeof(fmr2->tea.bus_info), "%s:%s", |
| 239 | fmr2->is_fmd2 ? "PnP" : "ISA", dev_name(pdev)); | 239 | fmr2->is_fmd2 ? "PnP" : "ISA", dev_name(pdev)); |
| 240 | 240 | ||
| 241 | if (snd_tea575x_init(&fmr2->tea)) { | 241 | if (snd_tea575x_init(&fmr2->tea, THIS_MODULE)) { |
| 242 | printk(KERN_ERR "radio-sf16fmr2: Unable to detect TEA575x tuner\n"); | 242 | printk(KERN_ERR "radio-sf16fmr2: Unable to detect TEA575x tuner\n"); |
| 243 | release_region(fmr2->io, 2); | 243 | release_region(fmr2->io, 2); |
| 244 | return -ENODEV; | 244 | return -ENODEV; |
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index e9f638761296..f412f7ab270b 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c | |||
| @@ -51,6 +51,8 @@ static struct usb_device_id si470x_usb_driver_id_table[] = { | |||
| 51 | { USB_DEVICE_AND_INTERFACE_INFO(0x1b80, 0xd700, USB_CLASS_HID, 0, 0) }, | 51 | { USB_DEVICE_AND_INTERFACE_INFO(0x1b80, 0xd700, USB_CLASS_HID, 0, 0) }, |
| 52 | /* Sanei Electric, Inc. FM USB Radio (sold as DealExtreme.com PCear) */ | 52 | /* Sanei Electric, Inc. FM USB Radio (sold as DealExtreme.com PCear) */ |
| 53 | { USB_DEVICE_AND_INTERFACE_INFO(0x10c5, 0x819a, USB_CLASS_HID, 0, 0) }, | 53 | { USB_DEVICE_AND_INTERFACE_INFO(0x10c5, 0x819a, USB_CLASS_HID, 0, 0) }, |
| 54 | /* Axentia ALERT FM USB Receiver */ | ||
| 55 | { USB_DEVICE_AND_INTERFACE_INFO(0x12cf, 0x7111, USB_CLASS_HID, 0, 0) }, | ||
| 54 | /* Terminating entry */ | 56 | /* Terminating entry */ |
| 55 | { } | 57 | { } |
| 56 | }; | 58 | }; |
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 342c2c8c1ddf..54ee34872d14 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
| @@ -232,7 +232,7 @@ MODULE_PARM_DESC(invert, "Invert the signal from the IR receiver"); | |||
| 232 | 232 | ||
| 233 | static bool txandrx; /* default = 0 */ | 233 | static bool txandrx; /* default = 0 */ |
| 234 | module_param(txandrx, bool, 0444); | 234 | module_param(txandrx, bool, 0444); |
| 235 | MODULE_PARM_DESC(invert, "Allow simultaneous TX and RX"); | 235 | MODULE_PARM_DESC(txandrx, "Allow simultaneous TX and RX"); |
| 236 | 236 | ||
| 237 | static unsigned int wake_sc = 0x800F040C; | 237 | static unsigned int wake_sc = 0x800F040C; |
| 238 | module_param(wake_sc, uint, 0644); | 238 | module_param(wake_sc, uint, 0644); |
| @@ -1032,6 +1032,8 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
| 1032 | data->dev->tx_ir = wbcir_tx; | 1032 | data->dev->tx_ir = wbcir_tx; |
| 1033 | data->dev->priv = data; | 1033 | data->dev->priv = data; |
| 1034 | data->dev->dev.parent = &device->dev; | 1034 | data->dev->dev.parent = &device->dev; |
| 1035 | data->dev->timeout = MS_TO_NS(100); | ||
| 1036 | data->dev->allowed_protos = RC_TYPE_ALL; | ||
| 1035 | 1037 | ||
| 1036 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { | 1038 | if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { |
| 1037 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", | 1039 | dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", |
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index ff2933ab705f..856ab962cd63 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
| @@ -371,7 +371,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 371 | .muxsel = MUXSEL(2, 3, 1, 1), | 371 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 372 | .gpiomux = { 2, 0, 0, 0 }, | 372 | .gpiomux = { 2, 0, 0, 0 }, |
| 373 | .gpiomute = 10, | 373 | .gpiomute = 10, |
| 374 | .needs_tvaudio = 1, | ||
| 375 | .tuner_type = UNSET, | 374 | .tuner_type = UNSET, |
| 376 | .tuner_addr = ADDR_UNSET, | 375 | .tuner_addr = ADDR_UNSET, |
| 377 | }, | 376 | }, |
| @@ -384,7 +383,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 384 | .muxsel = MUXSEL(2, 3, 1, 1), | 383 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 385 | .gpiomux = { 0, 1, 2, 3 }, | 384 | .gpiomux = { 0, 1, 2, 3 }, |
| 386 | .gpiomute = 4, | 385 | .gpiomute = 4, |
| 387 | .needs_tvaudio = 1, | ||
| 388 | .tuner_type = UNSET, | 386 | .tuner_type = UNSET, |
| 389 | .tuner_addr = ADDR_UNSET, | 387 | .tuner_addr = ADDR_UNSET, |
| 390 | }, | 388 | }, |
| @@ -398,7 +396,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 398 | .gpiomux = { 4, 0, 2, 3 }, | 396 | .gpiomux = { 4, 0, 2, 3 }, |
| 399 | .gpiomute = 1, | 397 | .gpiomute = 1, |
| 400 | .no_msp34xx = 1, | 398 | .no_msp34xx = 1, |
| 401 | .needs_tvaudio = 1, | ||
| 402 | .tuner_type = TUNER_PHILIPS_NTSC, | 399 | .tuner_type = TUNER_PHILIPS_NTSC, |
| 403 | .tuner_addr = ADDR_UNSET, | 400 | .tuner_addr = ADDR_UNSET, |
| 404 | .pll = PLL_28, | 401 | .pll = PLL_28, |
| @@ -414,7 +411,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 414 | .gpiomask = 0, | 411 | .gpiomask = 0, |
| 415 | .muxsel = MUXSEL(2, 3, 1, 1), | 412 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 416 | .gpiomux = { 0 }, | 413 | .gpiomux = { 0 }, |
| 417 | .needs_tvaudio = 0, | ||
| 418 | .tuner_type = TUNER_ABSENT, | 414 | .tuner_type = TUNER_ABSENT, |
| 419 | .tuner_addr = ADDR_UNSET, | 415 | .tuner_addr = ADDR_UNSET, |
| 420 | }, | 416 | }, |
| @@ -427,7 +423,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 427 | .muxsel = MUXSEL(2, 3, 1, 0), | 423 | .muxsel = MUXSEL(2, 3, 1, 0), |
| 428 | .gpiomux = { 0, 1, 0, 1 }, | 424 | .gpiomux = { 0, 1, 0, 1 }, |
| 429 | .gpiomute = 3, | 425 | .gpiomute = 3, |
| 430 | .needs_tvaudio = 1, | ||
| 431 | .tuner_type = UNSET, | 426 | .tuner_type = UNSET, |
| 432 | .tuner_addr = ADDR_UNSET, | 427 | .tuner_addr = ADDR_UNSET, |
| 433 | }, | 428 | }, |
| @@ -440,7 +435,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 440 | .gpiomask = 0x0f, | 435 | .gpiomask = 0x0f, |
| 441 | .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, | 436 | .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, |
| 442 | /* 0x04 for some cards ?? */ | 437 | /* 0x04 for some cards ?? */ |
| 443 | .needs_tvaudio = 1, | ||
| 444 | .tuner_type = UNSET, | 438 | .tuner_type = UNSET, |
| 445 | .tuner_addr = ADDR_UNSET, | 439 | .tuner_addr = ADDR_UNSET, |
| 446 | .audio_mode_gpio= avermedia_tvphone_audio, | 440 | .audio_mode_gpio= avermedia_tvphone_audio, |
| @@ -454,7 +448,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 454 | .gpiomask = 0, | 448 | .gpiomask = 0, |
| 455 | .muxsel = MUXSEL(2, 3, 1, 0, 0), | 449 | .muxsel = MUXSEL(2, 3, 1, 0, 0), |
| 456 | .gpiomux = { 0 }, | 450 | .gpiomux = { 0 }, |
| 457 | .needs_tvaudio = 1, | ||
| 458 | .tuner_type = TUNER_ABSENT, | 451 | .tuner_type = TUNER_ABSENT, |
| 459 | .tuner_addr = ADDR_UNSET, | 452 | .tuner_addr = ADDR_UNSET, |
| 460 | }, | 453 | }, |
| @@ -469,7 +462,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 469 | .muxsel = MUXSEL(2, 3, 1, 1), | 462 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 470 | .gpiomux = { 0, 0xc00, 0x800, 0x400 }, | 463 | .gpiomux = { 0, 0xc00, 0x800, 0x400 }, |
| 471 | .gpiomute = 0xc00, | 464 | .gpiomute = 0xc00, |
| 472 | .needs_tvaudio = 1, | ||
| 473 | .pll = PLL_28, | 465 | .pll = PLL_28, |
| 474 | .tuner_type = UNSET, | 466 | .tuner_type = UNSET, |
| 475 | .tuner_addr = ADDR_UNSET, | 467 | .tuner_addr = ADDR_UNSET, |
| @@ -482,7 +474,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 482 | .gpiomask = 3, | 474 | .gpiomask = 3, |
| 483 | .muxsel = MUXSEL(2, 3, 1, 1), | 475 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 484 | .gpiomux = { 1, 1, 2, 3 }, | 476 | .gpiomux = { 1, 1, 2, 3 }, |
| 485 | .needs_tvaudio = 0, | ||
| 486 | .pll = PLL_28, | 477 | .pll = PLL_28, |
| 487 | .tuner_type = TUNER_TEMIC_PAL, | 478 | .tuner_type = TUNER_TEMIC_PAL, |
| 488 | .tuner_addr = ADDR_UNSET, | 479 | .tuner_addr = ADDR_UNSET, |
| @@ -496,7 +487,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 496 | .muxsel = MUXSEL(2, 0, 1, 1), | 487 | .muxsel = MUXSEL(2, 0, 1, 1), |
| 497 | .gpiomux = { 0, 1, 2, 3 }, | 488 | .gpiomux = { 0, 1, 2, 3 }, |
| 498 | .gpiomute = 4, | 489 | .gpiomute = 4, |
| 499 | .needs_tvaudio = 1, | ||
| 500 | .pll = PLL_28, | 490 | .pll = PLL_28, |
| 501 | .tuner_type = UNSET, | 491 | .tuner_type = UNSET, |
| 502 | .tuner_addr = ADDR_UNSET, | 492 | .tuner_addr = ADDR_UNSET, |
| @@ -510,7 +500,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 510 | .muxsel = MUXSEL(2, 3, 1, 1), | 500 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 511 | .gpiomux = { 0x20001,0x10001, 0, 0 }, | 501 | .gpiomux = { 0x20001,0x10001, 0, 0 }, |
| 512 | .gpiomute = 10, | 502 | .gpiomute = 10, |
| 513 | .needs_tvaudio = 1, | ||
| 514 | .tuner_type = UNSET, | 503 | .tuner_type = UNSET, |
| 515 | .tuner_addr = ADDR_UNSET, | 504 | .tuner_addr = ADDR_UNSET, |
| 516 | }, | 505 | }, |
| @@ -524,7 +513,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 524 | .gpiomask = 15, | 513 | .gpiomask = 15, |
| 525 | .muxsel = MUXSEL(2, 3, 1, 1), | 514 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 526 | .gpiomux = { 13, 14, 11, 7 }, | 515 | .gpiomux = { 13, 14, 11, 7 }, |
| 527 | .needs_tvaudio = 1, | ||
| 528 | .tuner_type = UNSET, | 516 | .tuner_type = UNSET, |
| 529 | .tuner_addr = ADDR_UNSET, | 517 | .tuner_addr = ADDR_UNSET, |
| 530 | }, | 518 | }, |
| @@ -536,7 +524,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 536 | .gpiomask = 15, | 524 | .gpiomask = 15, |
| 537 | .muxsel = MUXSEL(2, 3, 1, 1), | 525 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 538 | .gpiomux = { 13, 14, 11, 7 }, | 526 | .gpiomux = { 13, 14, 11, 7 }, |
| 539 | .needs_tvaudio = 1, | ||
| 540 | .msp34xx_alt = 1, | 527 | .msp34xx_alt = 1, |
| 541 | .pll = PLL_28, | 528 | .pll = PLL_28, |
| 542 | .tuner_type = TUNER_PHILIPS_PAL, | 529 | .tuner_type = TUNER_PHILIPS_PAL, |
| @@ -553,7 +540,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 553 | .muxsel = MUXSEL(2, 3, 1, 1), | 540 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 554 | .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */ | 541 | .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */ |
| 555 | .gpiomute = 4, | 542 | .gpiomute = 4, |
| 556 | .needs_tvaudio = 1, | ||
| 557 | .pll = PLL_28, | 543 | .pll = PLL_28, |
| 558 | .tuner_type = UNSET, | 544 | .tuner_type = UNSET, |
| 559 | .tuner_addr = ADDR_UNSET, | 545 | .tuner_addr = ADDR_UNSET, |
| @@ -567,7 +553,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 567 | .muxsel = MUXSEL(2, 3, 1, 1), | 553 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 568 | .gpiomux = { 0, 0, 1, 0 }, | 554 | .gpiomux = { 0, 0, 1, 0 }, |
| 569 | .gpiomute = 10, | 555 | .gpiomute = 10, |
| 570 | .needs_tvaudio = 1, | ||
| 571 | .tuner_type = UNSET, | 556 | .tuner_type = UNSET, |
| 572 | .tuner_addr = ADDR_UNSET, | 557 | .tuner_addr = ADDR_UNSET, |
| 573 | }, | 558 | }, |
| @@ -583,7 +568,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 583 | /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ | 568 | /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ |
| 584 | .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, | 569 | .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, |
| 585 | .gpiomute = 0x002000, | 570 | .gpiomute = 0x002000, |
| 586 | .needs_tvaudio = 1, | ||
| 587 | .pll = PLL_28, | 571 | .pll = PLL_28, |
| 588 | .tuner_type = UNSET, | 572 | .tuner_type = UNSET, |
| 589 | .tuner_addr = ADDR_UNSET, | 573 | .tuner_addr = ADDR_UNSET, |
| @@ -597,7 +581,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 597 | .muxsel = MUXSEL(2, 3, 1, 1, 0), | 581 | .muxsel = MUXSEL(2, 3, 1, 1, 0), |
| 598 | .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, | 582 | .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, |
| 599 | .gpiomute = 0xcfa007, | 583 | .gpiomute = 0xcfa007, |
| 600 | .needs_tvaudio = 1, | ||
| 601 | .tuner_type = UNSET, | 584 | .tuner_type = UNSET, |
| 602 | .tuner_addr = ADDR_UNSET, | 585 | .tuner_addr = ADDR_UNSET, |
| 603 | .volume_gpio = winview_volume, | 586 | .volume_gpio = winview_volume, |
| @@ -611,7 +594,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 611 | .gpiomask = 0, | 594 | .gpiomask = 0, |
| 612 | .muxsel = MUXSEL(2, 3, 1, 1), | 595 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 613 | .gpiomux = { 1, 0, 0, 0 }, | 596 | .gpiomux = { 1, 0, 0, 0 }, |
| 614 | .needs_tvaudio = 1, | ||
| 615 | .tuner_type = UNSET, | 597 | .tuner_type = UNSET, |
| 616 | .tuner_addr = ADDR_UNSET, | 598 | .tuner_addr = ADDR_UNSET, |
| 617 | }, | 599 | }, |
| @@ -660,7 +642,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 660 | .muxsel = MUXSEL(2, 3, 1, 1), | 642 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 661 | .gpiomux = { 0, 1, 0x800, 0x400 }, | 643 | .gpiomux = { 0, 1, 0x800, 0x400 }, |
| 662 | .gpiomute = 0xc00, | 644 | .gpiomute = 0xc00, |
| 663 | .needs_tvaudio = 1, | ||
| 664 | .pll = PLL_28, | 645 | .pll = PLL_28, |
| 665 | .tuner_type = UNSET, | 646 | .tuner_type = UNSET, |
| 666 | .tuner_addr = ADDR_UNSET, | 647 | .tuner_addr = ADDR_UNSET, |
| @@ -691,7 +672,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 691 | .muxsel = MUXSEL(2, 3, 1, 1), | 672 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 692 | .gpiomux = {0x400, 0x400, 0x400, 0x400 }, | 673 | .gpiomux = {0x400, 0x400, 0x400, 0x400 }, |
| 693 | .gpiomute = 0xc00, | 674 | .gpiomute = 0xc00, |
| 694 | .needs_tvaudio = 1, | ||
| 695 | .pll = PLL_28, | 675 | .pll = PLL_28, |
| 696 | .tuner_type = UNSET, | 676 | .tuner_type = UNSET, |
| 697 | .tuner_addr = ADDR_UNSET, | 677 | .tuner_addr = ADDR_UNSET, |
| @@ -706,7 +686,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 706 | .muxsel = MUXSEL(2, 3, 1, 1), | 686 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 707 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, | 687 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, |
| 708 | .gpiomute = 0x40000, | 688 | .gpiomute = 0x40000, |
| 709 | .needs_tvaudio = 0, | ||
| 710 | .tuner_type = TUNER_PHILIPS_PAL, | 689 | .tuner_type = TUNER_PHILIPS_PAL, |
| 711 | .tuner_addr = ADDR_UNSET, | 690 | .tuner_addr = ADDR_UNSET, |
| 712 | .audio_mode_gpio= terratv_audio, | 691 | .audio_mode_gpio= terratv_audio, |
| @@ -720,7 +699,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 720 | .muxsel = MUXSEL(2, 0, 1, 1), | 699 | .muxsel = MUXSEL(2, 0, 1, 1), |
| 721 | .gpiomux = { 0, 1, 2, 3 }, | 700 | .gpiomux = { 0, 1, 2, 3 }, |
| 722 | .gpiomute = 4, | 701 | .gpiomute = 4, |
| 723 | .needs_tvaudio = 1, | ||
| 724 | .tuner_type = UNSET, | 702 | .tuner_type = UNSET, |
| 725 | .tuner_addr = ADDR_UNSET, | 703 | .tuner_addr = ADDR_UNSET, |
| 726 | }, | 704 | }, |
| @@ -748,7 +726,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 748 | .muxsel = MUXSEL(2, 3, 1, 1), | 726 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 749 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 }, | 727 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 }, |
| 750 | .gpiomute = 0x40000, | 728 | .gpiomute = 0x40000, |
| 751 | .needs_tvaudio = 0, | ||
| 752 | .tuner_type = TUNER_PHILIPS_PAL, | 729 | .tuner_type = TUNER_PHILIPS_PAL, |
| 753 | .tuner_addr = ADDR_UNSET, | 730 | .tuner_addr = ADDR_UNSET, |
| 754 | .audio_mode_gpio= terratv_audio, | 731 | .audio_mode_gpio= terratv_audio, |
| @@ -793,7 +770,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 793 | .gpiomask = 0, | 770 | .gpiomask = 0, |
| 794 | .muxsel = MUXSEL(2, 3, 1, 0, 0), | 771 | .muxsel = MUXSEL(2, 3, 1, 0, 0), |
| 795 | .gpiomux = { 0 }, | 772 | .gpiomux = { 0 }, |
| 796 | .needs_tvaudio = 1, | ||
| 797 | .tuner_type = TUNER_ABSENT, | 773 | .tuner_type = TUNER_ABSENT, |
| 798 | .tuner_addr = ADDR_UNSET, | 774 | .tuner_addr = ADDR_UNSET, |
| 799 | .muxsel_hook = PXC200_muxsel, | 775 | .muxsel_hook = PXC200_muxsel, |
| @@ -834,7 +810,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 834 | .gpiomask = 0, | 810 | .gpiomask = 0, |
| 835 | .muxsel = MUXSEL(2, 3, 1, 1), | 811 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 836 | .gpiomux = { 0 }, | 812 | .gpiomux = { 0 }, |
| 837 | .needs_tvaudio = 0, | ||
| 838 | .tuner_type = TUNER_ABSENT, | 813 | .tuner_type = TUNER_ABSENT, |
| 839 | .tuner_addr = ADDR_UNSET, | 814 | .tuner_addr = ADDR_UNSET, |
| 840 | }, | 815 | }, |
| @@ -847,7 +822,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 847 | .muxsel = MUXSEL(2, 3, 1, 1), | 822 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 848 | .gpiomux = { 0x500, 0, 0x300, 0x900 }, | 823 | .gpiomux = { 0x500, 0, 0x300, 0x900 }, |
| 849 | .gpiomute = 0x900, | 824 | .gpiomute = 0x900, |
| 850 | .needs_tvaudio = 1, | ||
| 851 | .pll = PLL_28, | 825 | .pll = PLL_28, |
| 852 | .tuner_type = TUNER_PHILIPS_PAL, | 826 | .tuner_type = TUNER_PHILIPS_PAL, |
| 853 | .tuner_addr = ADDR_UNSET, | 827 | .tuner_addr = ADDR_UNSET, |
| @@ -874,7 +848,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 874 | Note: There exists another variant "Winfast 2000" with tv stereo !? | 848 | Note: There exists another variant "Winfast 2000" with tv stereo !? |
| 875 | Note: eeprom only contains FF and pci subsystem id 107d:6606 | 849 | Note: eeprom only contains FF and pci subsystem id 107d:6606 |
| 876 | */ | 850 | */ |
| 877 | .needs_tvaudio = 0, | ||
| 878 | .pll = PLL_28, | 851 | .pll = PLL_28, |
| 879 | .has_radio = 1, | 852 | .has_radio = 1, |
| 880 | .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */ | 853 | .tuner_type = TUNER_PHILIPS_PAL, /* default for now, gpio reads BFFF06 for Pal bg+dk */ |
| @@ -934,7 +907,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 934 | .muxsel = MUXSEL(2, 3, 1, 0), | 907 | .muxsel = MUXSEL(2, 3, 1, 0), |
| 935 | .gpiomux = { 0x551400, 0x551200, 0, 0 }, | 908 | .gpiomux = { 0x551400, 0x551200, 0, 0 }, |
| 936 | .gpiomute = 0x551c00, | 909 | .gpiomute = 0x551c00, |
| 937 | .needs_tvaudio = 1, | ||
| 938 | .pll = PLL_28, | 910 | .pll = PLL_28, |
| 939 | .tuner_type = TUNER_PHILIPS_PAL_I, | 911 | .tuner_type = TUNER_PHILIPS_PAL_I, |
| 940 | .tuner_addr = ADDR_UNSET, | 912 | .tuner_addr = ADDR_UNSET, |
| @@ -949,7 +921,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 949 | .muxsel = MUXSEL(2, 3, 1, 1), | 921 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 950 | .gpiomux = { 2, 0xd0001, 0, 0 }, | 922 | .gpiomux = { 2, 0xd0001, 0, 0 }, |
| 951 | .gpiomute = 1, | 923 | .gpiomute = 1, |
| 952 | .needs_tvaudio = 0, | ||
| 953 | .pll = PLL_28, | 924 | .pll = PLL_28, |
| 954 | .tuner_type = UNSET, | 925 | .tuner_type = UNSET, |
| 955 | .tuner_addr = ADDR_UNSET, | 926 | .tuner_addr = ADDR_UNSET, |
| @@ -966,7 +937,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 966 | .gpiomux = { 4, 0, 2, 3 }, | 937 | .gpiomux = { 4, 0, 2, 3 }, |
| 967 | .gpiomute = 1, | 938 | .gpiomute = 1, |
| 968 | .no_msp34xx = 1, | 939 | .no_msp34xx = 1, |
| 969 | .needs_tvaudio = 1, | ||
| 970 | .tuner_type = TUNER_PHILIPS_NTSC, | 940 | .tuner_type = TUNER_PHILIPS_NTSC, |
| 971 | .tuner_addr = ADDR_UNSET, | 941 | .tuner_addr = ADDR_UNSET, |
| 972 | .pll = PLL_28, | 942 | .pll = PLL_28, |
| @@ -980,7 +950,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 980 | .gpiomask = 15, | 950 | .gpiomask = 15, |
| 981 | .muxsel = MUXSEL(2, 3, 1, 1), | 951 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 982 | .gpiomux = { 13, 4, 11, 7 }, | 952 | .gpiomux = { 13, 4, 11, 7 }, |
| 983 | .needs_tvaudio = 1, | ||
| 984 | .pll = PLL_28, | 953 | .pll = PLL_28, |
| 985 | .tuner_type = UNSET, | 954 | .tuner_type = UNSET, |
| 986 | .tuner_addr = ADDR_UNSET, | 955 | .tuner_addr = ADDR_UNSET, |
| @@ -995,7 +964,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 995 | .gpiomask = 0, | 964 | .gpiomask = 0, |
| 996 | .muxsel = MUXSEL(2, 3, 1, 1), | 965 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 997 | .gpiomux = { 0, 0, 0, 0}, | 966 | .gpiomux = { 0, 0, 0, 0}, |
| 998 | .needs_tvaudio = 1, | ||
| 999 | .no_msp34xx = 1, | 967 | .no_msp34xx = 1, |
| 1000 | .pll = PLL_28, | 968 | .pll = PLL_28, |
| 1001 | .tuner_type = TUNER_PHILIPS_PAL_I, | 969 | .tuner_type = TUNER_PHILIPS_PAL_I, |
| @@ -1066,7 +1034,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1066 | .muxsel = MUXSEL(2, 3, 1, 1), | 1034 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1067 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, | 1035 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, |
| 1068 | .gpiomute = 0x40000, | 1036 | .gpiomute = 0x40000, |
| 1069 | .needs_tvaudio = 1, | ||
| 1070 | .no_msp34xx = 1, | 1037 | .no_msp34xx = 1, |
| 1071 | .pll = PLL_35, | 1038 | .pll = PLL_35, |
| 1072 | .tuner_type = TUNER_PHILIPS_PAL_I, | 1039 | .tuner_type = TUNER_PHILIPS_PAL_I, |
| @@ -1084,7 +1051,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1084 | .muxsel = MUXSEL(2, 3, 1, 1), | 1051 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1085 | .gpiomux = {2,0,0,0 }, | 1052 | .gpiomux = {2,0,0,0 }, |
| 1086 | .gpiomute = 1, | 1053 | .gpiomute = 1, |
| 1087 | .needs_tvaudio = 1, | ||
| 1088 | .pll = PLL_28, | 1054 | .pll = PLL_28, |
| 1089 | .tuner_type = UNSET, | 1055 | .tuner_type = UNSET, |
| 1090 | .tuner_addr = ADDR_UNSET, | 1056 | .tuner_addr = ADDR_UNSET, |
| @@ -1163,7 +1129,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1163 | MUX2 (mask 0x30000): | 1129 | MUX2 (mask 0x30000): |
| 1164 | 0,2,3= from MSP34xx | 1130 | 0,2,3= from MSP34xx |
| 1165 | 1= FM stereo Radio from Tuner */ | 1131 | 1= FM stereo Radio from Tuner */ |
| 1166 | .needs_tvaudio = 0, | ||
| 1167 | .pll = PLL_28, | 1132 | .pll = PLL_28, |
| 1168 | .tuner_type = UNSET, | 1133 | .tuner_type = UNSET, |
| 1169 | .tuner_addr = ADDR_UNSET, | 1134 | .tuner_addr = ADDR_UNSET, |
| @@ -1179,7 +1144,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1179 | .muxsel = MUXSEL(2, 3, 1, 1), | 1144 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1180 | .gpiomux = { 0, 0, 0x10, 8 }, | 1145 | .gpiomux = { 0, 0, 0x10, 8 }, |
| 1181 | .gpiomute = 4, | 1146 | .gpiomute = 4, |
| 1182 | .needs_tvaudio = 1, | ||
| 1183 | .pll = PLL_28, | 1147 | .pll = PLL_28, |
| 1184 | .tuner_type = TUNER_PHILIPS_PAL, | 1148 | .tuner_type = TUNER_PHILIPS_PAL, |
| 1185 | .tuner_addr = ADDR_UNSET, | 1149 | .tuner_addr = ADDR_UNSET, |
| @@ -1218,7 +1182,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1218 | .muxsel = MUXSEL(2, 3, 1, 0), | 1182 | .muxsel = MUXSEL(2, 3, 1, 0), |
| 1219 | .gpiomux = { 2, 0, 0, 0 }, | 1183 | .gpiomux = { 2, 0, 0, 0 }, |
| 1220 | .gpiomute = 10, | 1184 | .gpiomute = 10, |
| 1221 | .needs_tvaudio = 0, | ||
| 1222 | .pll = PLL_28, | 1185 | .pll = PLL_28, |
| 1223 | .tuner_type = TUNER_TEMIC_PAL, | 1186 | .tuner_type = TUNER_TEMIC_PAL, |
| 1224 | .tuner_addr = ADDR_UNSET, | 1187 | .tuner_addr = ADDR_UNSET, |
| @@ -1250,7 +1213,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1250 | .gpiomask = 0, | 1213 | .gpiomask = 0, |
| 1251 | .muxsel = MUXSEL(3, 1), | 1214 | .muxsel = MUXSEL(3, 1), |
| 1252 | .gpiomux = { 0 }, | 1215 | .gpiomux = { 0 }, |
| 1253 | .needs_tvaudio = 0, | ||
| 1254 | .no_msp34xx = 1, | 1216 | .no_msp34xx = 1, |
| 1255 | .pll = PLL_35, | 1217 | .pll = PLL_35, |
| 1256 | .tuner_type = TUNER_ABSENT, | 1218 | .tuner_type = TUNER_ABSENT, |
| @@ -1266,7 +1228,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1266 | .muxsel = MUXSEL(2, 3, 1, 1), | 1228 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1267 | .gpiomux = { 0x400, 0x400, 0x400, 0x400 }, | 1229 | .gpiomux = { 0x400, 0x400, 0x400, 0x400 }, |
| 1268 | .gpiomute = 0x800, | 1230 | .gpiomute = 0x800, |
| 1269 | .needs_tvaudio = 1, | ||
| 1270 | .pll = PLL_28, | 1231 | .pll = PLL_28, |
| 1271 | .tuner_type = TUNER_TEMIC_4036FY5_NTSC, | 1232 | .tuner_type = TUNER_TEMIC_4036FY5_NTSC, |
| 1272 | .tuner_addr = ADDR_UNSET, | 1233 | .tuner_addr = ADDR_UNSET, |
| @@ -1312,7 +1273,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1312 | .muxsel = MUXSEL(2, 2), | 1273 | .muxsel = MUXSEL(2, 2), |
| 1313 | .gpiomux = { }, | 1274 | .gpiomux = { }, |
| 1314 | .no_msp34xx = 1, | 1275 | .no_msp34xx = 1, |
| 1315 | .needs_tvaudio = 0, | ||
| 1316 | .pll = PLL_28, | 1276 | .pll = PLL_28, |
| 1317 | .tuner_type = TUNER_ABSENT, | 1277 | .tuner_type = TUNER_ABSENT, |
| 1318 | .tuner_addr = ADDR_UNSET, | 1278 | .tuner_addr = ADDR_UNSET, |
| @@ -1329,7 +1289,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1329 | .muxsel = MUXSEL(2, 3, 1, 0), | 1289 | .muxsel = MUXSEL(2, 3, 1, 0), |
| 1330 | .gpiomux = { 1, 0, 4, 4 }, | 1290 | .gpiomux = { 1, 0, 4, 4 }, |
| 1331 | .gpiomute = 9, | 1291 | .gpiomute = 9, |
| 1332 | .needs_tvaudio = 0, | ||
| 1333 | .pll = PLL_28, | 1292 | .pll = PLL_28, |
| 1334 | .tuner_type = TUNER_PHILIPS_PAL, | 1293 | .tuner_type = TUNER_PHILIPS_PAL, |
| 1335 | .tuner_addr = ADDR_UNSET, | 1294 | .tuner_addr = ADDR_UNSET, |
| @@ -1379,7 +1338,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1379 | .gpiomute = 0x1800, | 1338 | .gpiomute = 0x1800, |
| 1380 | .audio_mode_gpio= fv2000s_audio, | 1339 | .audio_mode_gpio= fv2000s_audio, |
| 1381 | .no_msp34xx = 1, | 1340 | .no_msp34xx = 1, |
| 1382 | .needs_tvaudio = 1, | ||
| 1383 | .pll = PLL_28, | 1341 | .pll = PLL_28, |
| 1384 | .tuner_type = TUNER_PHILIPS_PAL, | 1342 | .tuner_type = TUNER_PHILIPS_PAL, |
| 1385 | .tuner_addr = ADDR_UNSET, | 1343 | .tuner_addr = ADDR_UNSET, |
| @@ -1393,7 +1351,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1393 | .muxsel = MUXSEL(2, 3, 1, 1), | 1351 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1394 | .gpiomux = { 0x500, 0x500, 0x300, 0x900 }, | 1352 | .gpiomux = { 0x500, 0x500, 0x300, 0x900 }, |
| 1395 | .gpiomute = 0x900, | 1353 | .gpiomute = 0x900, |
| 1396 | .needs_tvaudio = 1, | ||
| 1397 | .pll = PLL_28, | 1354 | .pll = PLL_28, |
| 1398 | .tuner_type = TUNER_PHILIPS_PAL, | 1355 | .tuner_type = TUNER_PHILIPS_PAL, |
| 1399 | .tuner_addr = ADDR_UNSET, | 1356 | .tuner_addr = ADDR_UNSET, |
| @@ -1477,7 +1434,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1477 | .muxsel = MUXSEL(2, 3, 1, 1), | 1434 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1478 | .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */ | 1435 | .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */ |
| 1479 | .gpiomute = 13, | 1436 | .gpiomute = 13, |
| 1480 | .needs_tvaudio = 1, | ||
| 1481 | .pll = PLL_28, | 1437 | .pll = PLL_28, |
| 1482 | .tuner_type = TUNER_LG_PAL_I_FM, | 1438 | .tuner_type = TUNER_LG_PAL_I_FM, |
| 1483 | .tuner_addr = ADDR_UNSET, | 1439 | .tuner_addr = ADDR_UNSET, |
| @@ -1514,7 +1470,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1514 | .muxsel = MUXSEL(2, 3, 1, 1), | 1470 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1515 | .gpiomux = { 0x01, 0x00, 0x03, 0x03 }, | 1471 | .gpiomux = { 0x01, 0x00, 0x03, 0x03 }, |
| 1516 | .gpiomute = 0x09, | 1472 | .gpiomute = 0x09, |
| 1517 | .needs_tvaudio = 1, | ||
| 1518 | .no_msp34xx = 1, | 1473 | .no_msp34xx = 1, |
| 1519 | .pll = PLL_28, | 1474 | .pll = PLL_28, |
| 1520 | .tuner_type = TUNER_PHILIPS_PAL, | 1475 | .tuner_type = TUNER_PHILIPS_PAL, |
| @@ -1540,7 +1495,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1540 | .gpiomask = 0, | 1495 | .gpiomask = 0, |
| 1541 | .muxsel = MUXSEL(2, 3, 1, 0, 0), | 1496 | .muxsel = MUXSEL(2, 3, 1, 0, 0), |
| 1542 | .gpiomux = { 0 }, | 1497 | .gpiomux = { 0 }, |
| 1543 | .needs_tvaudio = 0, | ||
| 1544 | .tuner_type = TUNER_ABSENT, | 1498 | .tuner_type = TUNER_ABSENT, |
| 1545 | .tuner_addr = ADDR_UNSET, | 1499 | .tuner_addr = ADDR_UNSET, |
| 1546 | }, | 1500 | }, |
| @@ -1567,7 +1521,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1567 | .muxsel = MUXSEL(2, 1, 1), | 1521 | .muxsel = MUXSEL(2, 1, 1), |
| 1568 | .gpiomux = { 0, 1, 2, 2 }, | 1522 | .gpiomux = { 0, 1, 2, 2 }, |
| 1569 | .gpiomute = 4, | 1523 | .gpiomute = 4, |
| 1570 | .needs_tvaudio = 0, | ||
| 1571 | .tuner_type = TUNER_PHILIPS_PAL, | 1524 | .tuner_type = TUNER_PHILIPS_PAL, |
| 1572 | .tuner_addr = ADDR_UNSET, | 1525 | .tuner_addr = ADDR_UNSET, |
| 1573 | .pll = PLL_28, | 1526 | .pll = PLL_28, |
| @@ -1597,7 +1550,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1597 | .gpiomask = 0, | 1550 | .gpiomask = 0, |
| 1598 | .muxsel = MUXSEL(2, 3, 1, 0), | 1551 | .muxsel = MUXSEL(2, 3, 1, 0), |
| 1599 | .gpiomux = { 0 }, | 1552 | .gpiomux = { 0 }, |
| 1600 | .needs_tvaudio = 0, | ||
| 1601 | .no_msp34xx = 1, | 1553 | .no_msp34xx = 1, |
| 1602 | .pll = PLL_28, | 1554 | .pll = PLL_28, |
| 1603 | .tuner_type = TUNER_ABSENT, | 1555 | .tuner_type = TUNER_ABSENT, |
| @@ -1619,7 +1571,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1619 | * btwincap uses 0x80000/0x80003 | 1571 | * btwincap uses 0x80000/0x80003 |
| 1620 | */ | 1572 | */ |
| 1621 | .gpiomute = 4, | 1573 | .gpiomute = 4, |
| 1622 | .needs_tvaudio = 0, | ||
| 1623 | .no_msp34xx = 1, | 1574 | .no_msp34xx = 1, |
| 1624 | .pll = PLL_28, | 1575 | .pll = PLL_28, |
| 1625 | .tuner_type = TUNER_PHILIPS_PAL, | 1576 | .tuner_type = TUNER_PHILIPS_PAL, |
| @@ -1655,7 +1606,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1655 | /* .audio_inputs= 1, */ | 1606 | /* .audio_inputs= 1, */ |
| 1656 | .svhs = 2, | 1607 | .svhs = 2, |
| 1657 | .muxsel = MUXSEL(2, 0, 1, 1), | 1608 | .muxsel = MUXSEL(2, 0, 1, 1), |
| 1658 | .needs_tvaudio = 1, | ||
| 1659 | .pll = PLL_28, | 1609 | .pll = PLL_28, |
| 1660 | .tuner_type = UNSET, | 1610 | .tuner_type = UNSET, |
| 1661 | .tuner_addr = ADDR_UNSET, | 1611 | .tuner_addr = ADDR_UNSET, |
| @@ -1875,7 +1825,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1875 | .muxsel = MUXSEL(2, 3, 1, 1), | 1825 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1876 | .gpiomux = { 0, 1, 2, 3}, | 1826 | .gpiomux = { 0, 1, 2, 3}, |
| 1877 | .gpiomute = 4, | 1827 | .gpiomute = 4, |
| 1878 | .needs_tvaudio = 1, | ||
| 1879 | .tuner_type = TUNER_PHILIPS_PAL, | 1828 | .tuner_type = TUNER_PHILIPS_PAL, |
| 1880 | .tuner_addr = ADDR_UNSET, | 1829 | .tuner_addr = ADDR_UNSET, |
| 1881 | .pll = PLL_28, | 1830 | .pll = PLL_28, |
| @@ -1902,7 +1851,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1902 | .gpiomask = 0, | 1851 | .gpiomask = 0, |
| 1903 | .muxsel = MUXSEL(2, 3), | 1852 | .muxsel = MUXSEL(2, 3), |
| 1904 | .gpiomux = { 0 }, | 1853 | .gpiomux = { 0 }, |
| 1905 | .needs_tvaudio = 0, | ||
| 1906 | .no_msp34xx = 1, | 1854 | .no_msp34xx = 1, |
| 1907 | .pll = PLL_28, | 1855 | .pll = PLL_28, |
| 1908 | .tuner_type = TUNER_ABSENT, | 1856 | .tuner_type = TUNER_ABSENT, |
| @@ -1920,7 +1868,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1920 | /* Tuner, Radio, external, internal, off, on */ | 1868 | /* Tuner, Radio, external, internal, off, on */ |
| 1921 | .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 }, | 1869 | .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 }, |
| 1922 | .gpiomute = 0x0f, | 1870 | .gpiomute = 0x0f, |
| 1923 | .needs_tvaudio = 0, | ||
| 1924 | .no_msp34xx = 1, | 1871 | .no_msp34xx = 1, |
| 1925 | .pll = PLL_28, | 1872 | .pll = PLL_28, |
| 1926 | .tuner_type = TUNER_PHILIPS_NTSC, | 1873 | .tuner_type = TUNER_PHILIPS_NTSC, |
| @@ -1936,7 +1883,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 1936 | .svhs = 2, | 1883 | .svhs = 2, |
| 1937 | .gpiomask = 0x00, | 1884 | .gpiomask = 0x00, |
| 1938 | .muxsel = MUXSEL(2, 3, 1, 1), | 1885 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 1939 | .needs_tvaudio = 1, | ||
| 1940 | .no_msp34xx = 1, | 1886 | .no_msp34xx = 1, |
| 1941 | .pll = PLL_28, | 1887 | .pll = PLL_28, |
| 1942 | .tuner_type = TUNER_PHILIPS_PAL, | 1888 | .tuner_type = TUNER_PHILIPS_PAL, |
| @@ -2034,7 +1980,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2034 | .gpiomask = 0, | 1980 | .gpiomask = 0, |
| 2035 | .muxsel = MUXSEL(2, 3, 1, 0), | 1981 | .muxsel = MUXSEL(2, 3, 1, 0), |
| 2036 | .gpiomux = { 0 }, | 1982 | .gpiomux = { 0 }, |
| 2037 | .needs_tvaudio = 0, | ||
| 2038 | .no_msp34xx = 1, | 1983 | .no_msp34xx = 1, |
| 2039 | .pll = PLL_28, | 1984 | .pll = PLL_28, |
| 2040 | .tuner_type = TUNER_ABSENT, | 1985 | .tuner_type = TUNER_ABSENT, |
| @@ -2049,7 +1994,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2049 | .gpiomask = 0x00, | 1994 | .gpiomask = 0x00, |
| 2050 | .muxsel = MUXSEL(2, 3, 1, 0), | 1995 | .muxsel = MUXSEL(2, 3, 1, 0), |
| 2051 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 1996 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
| 2052 | .needs_tvaudio = 0, | ||
| 2053 | .pll = PLL_28, | 1997 | .pll = PLL_28, |
| 2054 | .tuner_type = TUNER_ABSENT, | 1998 | .tuner_type = TUNER_ABSENT, |
| 2055 | .tuner_addr = ADDR_UNSET, | 1999 | .tuner_addr = ADDR_UNSET, |
| @@ -2062,7 +2006,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2062 | .gpiomask = 0x00, | 2006 | .gpiomask = 0x00, |
| 2063 | .muxsel = MUXSEL(2, 3, 1, 1), | 2007 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2064 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2008 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
| 2065 | .needs_tvaudio = 0, | ||
| 2066 | .pll = PLL_28, | 2009 | .pll = PLL_28, |
| 2067 | .tuner_type = TUNER_ABSENT, | 2010 | .tuner_type = TUNER_ABSENT, |
| 2068 | .tuner_addr = ADDR_UNSET, | 2011 | .tuner_addr = ADDR_UNSET, |
| @@ -2079,7 +2022,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2079 | .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 0), | 2022 | .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 0), |
| 2080 | .muxsel_hook = phytec_muxsel, | 2023 | .muxsel_hook = phytec_muxsel, |
| 2081 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2024 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
| 2082 | .needs_tvaudio = 1, | ||
| 2083 | .pll = PLL_28, | 2025 | .pll = PLL_28, |
| 2084 | .tuner_type = TUNER_ABSENT, | 2026 | .tuner_type = TUNER_ABSENT, |
| 2085 | .tuner_addr = ADDR_UNSET, | 2027 | .tuner_addr = ADDR_UNSET, |
| @@ -2094,7 +2036,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2094 | .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1), | 2036 | .muxsel = MUXSEL(2, 2, 2, 2, 3, 3, 3, 3, 1, 1), |
| 2095 | .muxsel_hook = phytec_muxsel, | 2037 | .muxsel_hook = phytec_muxsel, |
| 2096 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2038 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
| 2097 | .needs_tvaudio = 1, | ||
| 2098 | .pll = PLL_28, | 2039 | .pll = PLL_28, |
| 2099 | .tuner_type = TUNER_ABSENT, | 2040 | .tuner_type = TUNER_ABSENT, |
| 2100 | .tuner_addr = ADDR_UNSET, | 2041 | .tuner_addr = ADDR_UNSET, |
| @@ -2118,7 +2059,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2118 | .tuner_type = TUNER_ABSENT, | 2059 | .tuner_type = TUNER_ABSENT, |
| 2119 | .tuner_addr = ADDR_UNSET, | 2060 | .tuner_addr = ADDR_UNSET, |
| 2120 | .svhs = NO_SVHS, /* card has no svhs */ | 2061 | .svhs = NO_SVHS, /* card has no svhs */ |
| 2121 | .needs_tvaudio = 0, | ||
| 2122 | .no_msp34xx = 1, | 2062 | .no_msp34xx = 1, |
| 2123 | .no_tda7432 = 1, | 2063 | .no_tda7432 = 1, |
| 2124 | .gpiomask = 0x00, | 2064 | .gpiomask = 0x00, |
| @@ -2168,7 +2108,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2168 | .gpiomask = 3, | 2108 | .gpiomask = 3, |
| 2169 | .muxsel = MUXSEL(2, 3, 1, 1), | 2109 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2170 | .gpiomux = { 1, 1, 1, 1 }, | 2110 | .gpiomux = { 1, 1, 1, 1 }, |
| 2171 | .needs_tvaudio = 1, | ||
| 2172 | .tuner_type = TUNER_PHILIPS_PAL, | 2111 | .tuner_type = TUNER_PHILIPS_PAL, |
| 2173 | .tuner_addr = ADDR_UNSET, | 2112 | .tuner_addr = ADDR_UNSET, |
| 2174 | .pll = PLL_35, | 2113 | .pll = PLL_35, |
| @@ -2210,7 +2149,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2210 | .muxsel = MUXSEL(2, 3, 1, 0), | 2149 | .muxsel = MUXSEL(2, 3, 1, 0), |
| 2211 | .no_msp34xx = 1, | 2150 | .no_msp34xx = 1, |
| 2212 | .no_tda7432 = 1, | 2151 | .no_tda7432 = 1, |
| 2213 | .needs_tvaudio = 0, | ||
| 2214 | .tuner_type = TUNER_ABSENT, | 2152 | .tuner_type = TUNER_ABSENT, |
| 2215 | .tuner_addr = ADDR_UNSET, | 2153 | .tuner_addr = ADDR_UNSET, |
| 2216 | }, | 2154 | }, |
| @@ -2222,7 +2160,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2222 | .tuner_type = TUNER_PHILIPS_PAL, | 2160 | .tuner_type = TUNER_PHILIPS_PAL, |
| 2223 | .tuner_addr = ADDR_UNSET, | 2161 | .tuner_addr = ADDR_UNSET, |
| 2224 | .svhs = 2, | 2162 | .svhs = 2, |
| 2225 | .needs_tvaudio = 0, | ||
| 2226 | .gpiomask = 0x68, | 2163 | .gpiomask = 0x68, |
| 2227 | .muxsel = MUXSEL(2, 3, 1), | 2164 | .muxsel = MUXSEL(2, 3, 1), |
| 2228 | .gpiomux = { 0x68, 0x68, 0x61, 0x61 }, | 2165 | .gpiomux = { 0x68, 0x68, 0x61, 0x61 }, |
| @@ -2241,7 +2178,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2241 | .muxsel = MUXSEL(2, 3, 1, 1), | 2178 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2242 | .gpiomux = { 0, 1, 2, 2 }, | 2179 | .gpiomux = { 0, 1, 2, 2 }, |
| 2243 | .gpiomute = 3, | 2180 | .gpiomute = 3, |
| 2244 | .needs_tvaudio = 0, | ||
| 2245 | .pll = PLL_28, | 2181 | .pll = PLL_28, |
| 2246 | .tuner_type = TUNER_PHILIPS_PAL, | 2182 | .tuner_type = TUNER_PHILIPS_PAL, |
| 2247 | .tuner_addr = ADDR_UNSET, | 2183 | .tuner_addr = ADDR_UNSET, |
| @@ -2265,7 +2201,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2265 | .muxsel = MUXSEL(2, 2, 2, 2), | 2201 | .muxsel = MUXSEL(2, 2, 2, 2), |
| 2266 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2202 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
| 2267 | .pll = PLL_28, | 2203 | .pll = PLL_28, |
| 2268 | .needs_tvaudio = 0, | ||
| 2269 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ | 2204 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ |
| 2270 | .tuner_type = TUNER_ABSENT, | 2205 | .tuner_type = TUNER_ABSENT, |
| 2271 | .tuner_addr = ADDR_UNSET, | 2206 | .tuner_addr = ADDR_UNSET, |
| @@ -2358,7 +2293,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2358 | .muxsel = MUXSEL(2, 3, 1, 1), | 2293 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2359 | .gpiomux = { 2, 0, 0, 0 }, | 2294 | .gpiomux = { 2, 0, 0, 0 }, |
| 2360 | .gpiomute = 10, | 2295 | .gpiomute = 10, |
| 2361 | .needs_tvaudio = 0, | ||
| 2362 | .pll = PLL_28, | 2296 | .pll = PLL_28, |
| 2363 | .tuner_type = TUNER_PHILIPS_PAL, | 2297 | .tuner_type = TUNER_PHILIPS_PAL, |
| 2364 | .tuner_addr = ADDR_UNSET, | 2298 | .tuner_addr = ADDR_UNSET, |
| @@ -2405,7 +2339,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2405 | .tuner_addr = ADDR_UNSET, | 2339 | .tuner_addr = ADDR_UNSET, |
| 2406 | .gpiomask = 0x008007, | 2340 | .gpiomask = 0x008007, |
| 2407 | .gpiomux = { 0, 0x000001,0,0 }, | 2341 | .gpiomux = { 0, 0x000001,0,0 }, |
| 2408 | .needs_tvaudio = 1, | ||
| 2409 | .has_radio = 1, | 2342 | .has_radio = 1, |
| 2410 | }, | 2343 | }, |
| 2411 | [BTTV_BOARD_TIBET_CS16] = { | 2344 | [BTTV_BOARD_TIBET_CS16] = { |
| @@ -2518,7 +2451,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2518 | .muxsel = MUXSEL(2, 3, 1, 1), | 2451 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2519 | .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, | 2452 | .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, |
| 2520 | .gpiomute = 0x002000, | 2453 | .gpiomute = 0x002000, |
| 2521 | .needs_tvaudio = 1, | ||
| 2522 | .pll = PLL_28, | 2454 | .pll = PLL_28, |
| 2523 | .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, | 2455 | .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, |
| 2524 | .tuner_addr = 0xc1 >>1, | 2456 | .tuner_addr = 0xc1 >>1, |
| @@ -2534,7 +2466,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2534 | .muxsel = MUXSEL(2, 3, 1, 1), | 2466 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2535 | .gpiomux = { 0, 1, 2, 2 }, | 2467 | .gpiomux = { 0, 1, 2, 2 }, |
| 2536 | .gpiomute = 3, | 2468 | .gpiomute = 3, |
| 2537 | .needs_tvaudio = 0, | ||
| 2538 | .pll = PLL_28, | 2469 | .pll = PLL_28, |
| 2539 | .tuner_type = TUNER_TENA_9533_DI, | 2470 | .tuner_type = TUNER_TENA_9533_DI, |
| 2540 | .tuner_addr = ADDR_UNSET, | 2471 | .tuner_addr = ADDR_UNSET, |
| @@ -2615,7 +2546,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2615 | .muxsel = MUXSEL(2, 3, 1, 1), | 2546 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2616 | .gpiomux = { 2, 0, 0, 0 }, | 2547 | .gpiomux = { 2, 0, 0, 0 }, |
| 2617 | .gpiomute = 1, | 2548 | .gpiomute = 1, |
| 2618 | .needs_tvaudio = 1, | ||
| 2619 | .pll = PLL_28, | 2549 | .pll = PLL_28, |
| 2620 | .tuner_type = TUNER_PHILIPS_NTSC, | 2550 | .tuner_type = TUNER_PHILIPS_NTSC, |
| 2621 | .tuner_addr = ADDR_UNSET, | 2551 | .tuner_addr = ADDR_UNSET, |
| @@ -2714,7 +2644,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2714 | .muxsel = MUXSEL(2, 3, 1, 1), | 2644 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2715 | .gpiomux = { 0x20001,0x10001, 0, 0 }, | 2645 | .gpiomux = { 0x20001,0x10001, 0, 0 }, |
| 2716 | .gpiomute = 10, | 2646 | .gpiomute = 10, |
| 2717 | .needs_tvaudio = 1, | ||
| 2718 | .pll = PLL_28, | 2647 | .pll = PLL_28, |
| 2719 | .tuner_type = TUNER_PHILIPS_PAL_I, | 2648 | .tuner_type = TUNER_PHILIPS_PAL_I, |
| 2720 | .tuner_addr = ADDR_UNSET, | 2649 | .tuner_addr = ADDR_UNSET, |
| @@ -2746,7 +2675,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2746 | .muxsel = MUXSEL(2, 3, 1, 1), | 2675 | .muxsel = MUXSEL(2, 3, 1, 1), |
| 2747 | .gpiomux = { 0, 1, 2, 2 }, /* CONTVFMi */ | 2676 | .gpiomux = { 0, 1, 2, 2 }, /* CONTVFMi */ |
| 2748 | .gpiomute = 3, /* CONTVFMi */ | 2677 | .gpiomute = 3, /* CONTVFMi */ |
| 2749 | .needs_tvaudio = 0, | ||
| 2750 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, /* TCL MK3 */ | 2678 | .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, /* TCL MK3 */ |
| 2751 | .tuner_addr = ADDR_UNSET, | 2679 | .tuner_addr = ADDR_UNSET, |
| 2752 | .pll = PLL_28, | 2680 | .pll = PLL_28, |
| @@ -2785,7 +2713,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2785 | .gpiomask = 0x00, | 2713 | .gpiomask = 0x00, |
| 2786 | .muxsel = MUXSEL(0, 2, 3, 1), | 2714 | .muxsel = MUXSEL(0, 2, 3, 1), |
| 2787 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2715 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
| 2788 | .needs_tvaudio = 0, | ||
| 2789 | .pll = PLL_28, | 2716 | .pll = PLL_28, |
| 2790 | .tuner_type = TUNER_ABSENT, | 2717 | .tuner_type = TUNER_ABSENT, |
| 2791 | .tuner_addr = ADDR_UNSET, | 2718 | .tuner_addr = ADDR_UNSET, |
| @@ -2799,7 +2726,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2799 | .gpiomask = 0x00, | 2726 | .gpiomask = 0x00, |
| 2800 | .muxsel = MUXSEL(2, 3, 1), | 2727 | .muxsel = MUXSEL(2, 3, 1), |
| 2801 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2728 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
| 2802 | .needs_tvaudio = 0, | ||
| 2803 | .pll = PLL_28, | 2729 | .pll = PLL_28, |
| 2804 | .tuner_type = TUNER_ABSENT, | 2730 | .tuner_type = TUNER_ABSENT, |
| 2805 | .tuner_addr = ADDR_UNSET, | 2731 | .tuner_addr = ADDR_UNSET, |
| @@ -2813,7 +2739,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2813 | .gpiomask = 0x00, | 2739 | .gpiomask = 0x00, |
| 2814 | .muxsel = MUXSEL(3, 2, 1), | 2740 | .muxsel = MUXSEL(3, 2, 1), |
| 2815 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ | 2741 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
| 2816 | .needs_tvaudio = 0, | ||
| 2817 | .pll = PLL_28, | 2742 | .pll = PLL_28, |
| 2818 | .tuner_type = TUNER_ABSENT, | 2743 | .tuner_type = TUNER_ABSENT, |
| 2819 | .tuner_addr = ADDR_UNSET, | 2744 | .tuner_addr = ADDR_UNSET, |
| @@ -2877,7 +2802,6 @@ struct tvcard bttv_tvcards[] = { | |||
| 2877 | .gpiomask = 0, | 2802 | .gpiomask = 0, |
| 2878 | .muxsel = MUXSEL(2, 3), | 2803 | .muxsel = MUXSEL(2, 3), |
| 2879 | .gpiomux = { 0 }, | 2804 | .gpiomux = { 0 }, |
| 2880 | .needs_tvaudio = 0, | ||
| 2881 | .no_msp34xx = 1, | 2805 | .no_msp34xx = 1, |
| 2882 | .pll = PLL_28, | 2806 | .pll = PLL_28, |
| 2883 | .tuner_type = TUNER_ABSENT, | 2807 | .tuner_type = TUNER_ABSENT, |
| @@ -3649,7 +3573,7 @@ void __devinit bttv_init_tuner(struct bttv *btv) | |||
| 3649 | struct tuner_setup tun_setup; | 3573 | struct tuner_setup tun_setup; |
| 3650 | 3574 | ||
| 3651 | /* Load tuner module before issuing tuner config call! */ | 3575 | /* Load tuner module before issuing tuner config call! */ |
| 3652 | if (bttv_tvcards[btv->c.type].has_radio) | 3576 | if (btv->has_radio) |
| 3653 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3577 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
| 3654 | &btv->c.i2c_adap, "tuner", | 3578 | &btv->c.i2c_adap, "tuner", |
| 3655 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | 3579 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
| @@ -3664,7 +3588,7 @@ void __devinit bttv_init_tuner(struct bttv *btv) | |||
| 3664 | tun_setup.type = btv->tuner_type; | 3588 | tun_setup.type = btv->tuner_type; |
| 3665 | tun_setup.addr = addr; | 3589 | tun_setup.addr = addr; |
| 3666 | 3590 | ||
| 3667 | if (bttv_tvcards[btv->c.type].has_radio) | 3591 | if (btv->has_radio) |
| 3668 | tun_setup.mode_mask |= T_RADIO; | 3592 | tun_setup.mode_mask |= T_RADIO; |
| 3669 | 3593 | ||
| 3670 | bttv_call_all(btv, tuner, s_type_addr, &tun_setup); | 3594 | bttv_call_all(btv, tuner, s_type_addr, &tun_setup); |
| @@ -3724,6 +3648,10 @@ static void __devinit hauppauge_eeprom(struct bttv *btv) | |||
| 3724 | bttv_tvcards[BTTV_BOARD_HAUPPAUGE_IMPACTVCB].name); | 3648 | bttv_tvcards[BTTV_BOARD_HAUPPAUGE_IMPACTVCB].name); |
| 3725 | btv->c.type = BTTV_BOARD_HAUPPAUGE_IMPACTVCB; | 3649 | btv->c.type = BTTV_BOARD_HAUPPAUGE_IMPACTVCB; |
| 3726 | } | 3650 | } |
| 3651 | |||
| 3652 | /* The 61334 needs the msp3410 to do the radio demod to get sound */ | ||
| 3653 | if (tv.model == 61334) | ||
| 3654 | btv->radio_uses_msp_demodulator = 1; | ||
| 3727 | } | 3655 | } |
| 3728 | 3656 | ||
| 3729 | static int terratec_active_radio_upgrade(struct bttv *btv) | 3657 | static int terratec_active_radio_upgrade(struct bttv *btv) |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index a9cfb0f4be48..ff7a589d8e0f 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
| @@ -1218,6 +1218,11 @@ audio_mux(struct bttv *btv, int input, int mute) | |||
| 1218 | For now this is sufficient. */ | 1218 | For now this is sufficient. */ |
| 1219 | switch (input) { | 1219 | switch (input) { |
| 1220 | case TVAUDIO_INPUT_RADIO: | 1220 | case TVAUDIO_INPUT_RADIO: |
| 1221 | /* Some boards need the msp do to the radio demod */ | ||
| 1222 | if (btv->radio_uses_msp_demodulator) { | ||
| 1223 | in = MSP_INPUT_DEFAULT; | ||
| 1224 | break; | ||
| 1225 | } | ||
| 1221 | in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1, | 1226 | in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1, |
| 1222 | MSP_DSP_IN_SCART, MSP_DSP_IN_SCART); | 1227 | MSP_DSP_IN_SCART, MSP_DSP_IN_SCART); |
| 1223 | break; | 1228 | break; |
diff --git a/drivers/media/video/bt8xx/bttv.h b/drivers/media/video/bt8xx/bttv.h index c5171619ac79..acfe2f3b92d9 100644 --- a/drivers/media/video/bt8xx/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h | |||
| @@ -236,7 +236,6 @@ struct tvcard { | |||
| 236 | /* i2c audio flags */ | 236 | /* i2c audio flags */ |
| 237 | unsigned int no_msp34xx:1; | 237 | unsigned int no_msp34xx:1; |
| 238 | unsigned int no_tda7432:1; | 238 | unsigned int no_tda7432:1; |
| 239 | unsigned int needs_tvaudio:1; | ||
| 240 | unsigned int msp34xx_alt:1; | 239 | unsigned int msp34xx_alt:1; |
| 241 | /* Note: currently no card definition needs to mark the presence | 240 | /* Note: currently no card definition needs to mark the presence |
| 242 | of a RDS saa6588 chip. If this is ever needed, then add a new | 241 | of a RDS saa6588 chip. If this is ever needed, then add a new |
diff --git a/drivers/media/video/bt8xx/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index db943a8d580d..70fd4f23f605 100644 --- a/drivers/media/video/bt8xx/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h | |||
| @@ -440,6 +440,7 @@ struct bttv { | |||
| 440 | /* radio data/state */ | 440 | /* radio data/state */ |
| 441 | int has_radio; | 441 | int has_radio; |
| 442 | int radio_user; | 442 | int radio_user; |
| 443 | int radio_uses_msp_demodulator; | ||
| 443 | 444 | ||
| 444 | /* miro/pinnacle + Aimslab VHX | 445 | /* miro/pinnacle + Aimslab VHX |
| 445 | philips matchbox (tea5757 radio tuner) support */ | 446 | philips matchbox (tea5757 radio tuner) support */ |
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 2520219f01ba..5b75a64b199b 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
| @@ -607,8 +607,9 @@ static long qc_capture(struct qcam *q, char __user *buf, unsigned long len) | |||
| 607 | } | 607 | } |
| 608 | o = i * pixels_per_line + pixels_read + k; | 608 | o = i * pixels_per_line + pixels_read + k; |
| 609 | if (o < len) { | 609 | if (o < len) { |
| 610 | u8 ch = invert - buffer[k]; | ||
| 610 | got++; | 611 | got++; |
| 611 | put_user((invert - buffer[k]) << shift, buf + o); | 612 | put_user(ch << shift, buf + o); |
| 612 | } | 613 | } |
| 613 | } | 614 | } |
| 614 | pixels_read += bytes; | 615 | pixels_read += bytes; |
| @@ -648,8 +649,8 @@ static int qcam_querycap(struct file *file, void *priv, | |||
| 648 | struct qcam *qcam = video_drvdata(file); | 649 | struct qcam *qcam = video_drvdata(file); |
| 649 | 650 | ||
| 650 | strlcpy(vcap->driver, qcam->v4l2_dev.name, sizeof(vcap->driver)); | 651 | strlcpy(vcap->driver, qcam->v4l2_dev.name, sizeof(vcap->driver)); |
| 651 | strlcpy(vcap->card, "B&W Quickcam", sizeof(vcap->card)); | 652 | strlcpy(vcap->card, "Connectix B&W Quickcam", sizeof(vcap->card)); |
| 652 | strlcpy(vcap->bus_info, "parport", sizeof(vcap->bus_info)); | 653 | strlcpy(vcap->bus_info, qcam->pport->name, sizeof(vcap->bus_info)); |
| 653 | vcap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; | 654 | vcap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE; |
| 654 | vcap->capabilities = vcap->device_caps | V4L2_CAP_DEVICE_CAPS; | 655 | vcap->capabilities = vcap->device_caps | V4L2_CAP_DEVICE_CAPS; |
| 655 | return 0; | 656 | return 0; |
| @@ -688,8 +689,8 @@ static int qcam_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f | |||
| 688 | pix->height = qcam->height / qcam->transfer_scale; | 689 | pix->height = qcam->height / qcam->transfer_scale; |
| 689 | pix->pixelformat = (qcam->bpp == 4) ? V4L2_PIX_FMT_Y4 : V4L2_PIX_FMT_Y6; | 690 | pix->pixelformat = (qcam->bpp == 4) ? V4L2_PIX_FMT_Y4 : V4L2_PIX_FMT_Y6; |
| 690 | pix->field = V4L2_FIELD_NONE; | 691 | pix->field = V4L2_FIELD_NONE; |
| 691 | pix->bytesperline = qcam->width; | 692 | pix->bytesperline = pix->width; |
| 692 | pix->sizeimage = qcam->width * qcam->height; | 693 | pix->sizeimage = pix->width * pix->height; |
| 693 | /* Just a guess */ | 694 | /* Just a guess */ |
| 694 | pix->colorspace = V4L2_COLORSPACE_SRGB; | 695 | pix->colorspace = V4L2_COLORSPACE_SRGB; |
| 695 | return 0; | 696 | return 0; |
| @@ -757,7 +758,7 @@ static int qcam_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdes | |||
| 757 | "4-Bit Monochrome", V4L2_PIX_FMT_Y4, | 758 | "4-Bit Monochrome", V4L2_PIX_FMT_Y4, |
| 758 | { 0, 0, 0, 0 } | 759 | { 0, 0, 0, 0 } |
| 759 | }, | 760 | }, |
| 760 | { 0, 0, 0, | 761 | { 1, 0, 0, |
| 761 | "6-Bit Monochrome", V4L2_PIX_FMT_Y6, | 762 | "6-Bit Monochrome", V4L2_PIX_FMT_Y6, |
| 762 | { 0, 0, 0, 0 } | 763 | { 0, 0, 0, 0 } |
| 763 | }, | 764 | }, |
| @@ -772,6 +773,25 @@ static int qcam_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdes | |||
| 772 | return 0; | 773 | return 0; |
| 773 | } | 774 | } |
| 774 | 775 | ||
| 776 | static int qcam_enum_framesizes(struct file *file, void *fh, | ||
| 777 | struct v4l2_frmsizeenum *fsize) | ||
| 778 | { | ||
| 779 | static const struct v4l2_frmsize_discrete sizes[] = { | ||
| 780 | { 80, 60 }, | ||
| 781 | { 160, 120 }, | ||
| 782 | { 320, 240 }, | ||
| 783 | }; | ||
| 784 | |||
| 785 | if (fsize->index > 2) | ||
| 786 | return -EINVAL; | ||
| 787 | if (fsize->pixel_format != V4L2_PIX_FMT_Y4 && | ||
| 788 | fsize->pixel_format != V4L2_PIX_FMT_Y6) | ||
| 789 | return -EINVAL; | ||
| 790 | fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE; | ||
| 791 | fsize->discrete = sizes[fsize->index]; | ||
| 792 | return 0; | ||
| 793 | } | ||
| 794 | |||
| 775 | static ssize_t qcam_read(struct file *file, char __user *buf, | 795 | static ssize_t qcam_read(struct file *file, char __user *buf, |
| 776 | size_t count, loff_t *ppos) | 796 | size_t count, loff_t *ppos) |
| 777 | { | 797 | { |
| @@ -795,6 +815,11 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
| 795 | return len; | 815 | return len; |
| 796 | } | 816 | } |
| 797 | 817 | ||
| 818 | static unsigned int qcam_poll(struct file *filp, poll_table *wait) | ||
| 819 | { | ||
| 820 | return v4l2_ctrl_poll(filp, wait) | POLLIN | POLLRDNORM; | ||
| 821 | } | ||
| 822 | |||
| 798 | static int qcam_s_ctrl(struct v4l2_ctrl *ctrl) | 823 | static int qcam_s_ctrl(struct v4l2_ctrl *ctrl) |
| 799 | { | 824 | { |
| 800 | struct qcam *qcam = | 825 | struct qcam *qcam = |
| @@ -828,7 +853,7 @@ static const struct v4l2_file_operations qcam_fops = { | |||
| 828 | .owner = THIS_MODULE, | 853 | .owner = THIS_MODULE, |
| 829 | .open = v4l2_fh_open, | 854 | .open = v4l2_fh_open, |
| 830 | .release = v4l2_fh_release, | 855 | .release = v4l2_fh_release, |
| 831 | .poll = v4l2_ctrl_poll, | 856 | .poll = qcam_poll, |
| 832 | .unlocked_ioctl = video_ioctl2, | 857 | .unlocked_ioctl = video_ioctl2, |
| 833 | .read = qcam_read, | 858 | .read = qcam_read, |
| 834 | }; | 859 | }; |
| @@ -839,6 +864,7 @@ static const struct v4l2_ioctl_ops qcam_ioctl_ops = { | |||
| 839 | .vidioc_s_input = qcam_s_input, | 864 | .vidioc_s_input = qcam_s_input, |
| 840 | .vidioc_enum_input = qcam_enum_input, | 865 | .vidioc_enum_input = qcam_enum_input, |
| 841 | .vidioc_enum_fmt_vid_cap = qcam_enum_fmt_vid_cap, | 866 | .vidioc_enum_fmt_vid_cap = qcam_enum_fmt_vid_cap, |
| 867 | .vidioc_enum_framesizes = qcam_enum_framesizes, | ||
| 842 | .vidioc_g_fmt_vid_cap = qcam_g_fmt_vid_cap, | 868 | .vidioc_g_fmt_vid_cap = qcam_g_fmt_vid_cap, |
| 843 | .vidioc_s_fmt_vid_cap = qcam_s_fmt_vid_cap, | 869 | .vidioc_s_fmt_vid_cap = qcam_s_fmt_vid_cap, |
| 844 | .vidioc_try_fmt_vid_cap = qcam_try_fmt_vid_cap, | 870 | .vidioc_try_fmt_vid_cap = qcam_try_fmt_vid_cap, |
| @@ -864,9 +890,9 @@ static struct qcam *qcam_init(struct parport *port) | |||
| 864 | return NULL; | 890 | return NULL; |
| 865 | 891 | ||
| 866 | v4l2_dev = &qcam->v4l2_dev; | 892 | v4l2_dev = &qcam->v4l2_dev; |
| 867 | strlcpy(v4l2_dev->name, "bw-qcam", sizeof(v4l2_dev->name)); | 893 | snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "bw-qcam%d", num_cams); |
| 868 | 894 | ||
| 869 | if (v4l2_device_register(NULL, v4l2_dev) < 0) { | 895 | if (v4l2_device_register(port->dev, v4l2_dev) < 0) { |
| 870 | v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); | 896 | v4l2_err(v4l2_dev, "Could not register v4l2_device\n"); |
| 871 | kfree(qcam); | 897 | kfree(qcam); |
| 872 | return NULL; | 898 | return NULL; |
| @@ -886,7 +912,7 @@ static struct qcam *qcam_init(struct parport *port) | |||
| 886 | return NULL; | 912 | return NULL; |
| 887 | } | 913 | } |
| 888 | qcam->pport = port; | 914 | qcam->pport = port; |
| 889 | qcam->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, | 915 | qcam->pdev = parport_register_device(port, v4l2_dev->name, NULL, NULL, |
| 890 | NULL, 0, NULL); | 916 | NULL, 0, NULL); |
| 891 | if (qcam->pdev == NULL) { | 917 | if (qcam->pdev == NULL) { |
| 892 | v4l2_err(v4l2_dev, "couldn't register for %s.\n", port->name); | 918 | v4l2_err(v4l2_dev, "couldn't register for %s.\n", port->name); |
| @@ -975,6 +1001,7 @@ static int init_bwqcam(struct parport *port) | |||
| 975 | return -ENODEV; | 1001 | return -ENODEV; |
| 976 | } | 1002 | } |
| 977 | qc_calibrate(qcam); | 1003 | qc_calibrate(qcam); |
| 1004 | v4l2_ctrl_handler_setup(&qcam->hdl); | ||
| 978 | 1005 | ||
| 979 | parport_release(qcam->pdev); | 1006 | parport_release(qcam->pdev); |
| 980 | 1007 | ||
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index b55d57cc1a1c..7e5ffd6f5178 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
| @@ -838,10 +838,10 @@ static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *pci_dev, | |||
| 838 | } | 838 | } |
| 839 | 839 | ||
| 840 | CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, " | 840 | CX18_DEBUG_INFO("cx%d (rev %d) at %02x:%02x.%x, " |
| 841 | "irq: %d, latency: %d, memory: 0x%lx\n", | 841 | "irq: %d, latency: %d, memory: 0x%llx\n", |
| 842 | cx->pci_dev->device, cx->card_rev, pci_dev->bus->number, | 842 | cx->pci_dev->device, cx->card_rev, pci_dev->bus->number, |
| 843 | PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn), | 843 | PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn), |
| 844 | cx->pci_dev->irq, pci_latency, (unsigned long)cx->base_addr); | 844 | cx->pci_dev->irq, pci_latency, (u64)cx->base_addr); |
| 845 | 845 | ||
| 846 | return 0; | 846 | return 0; |
| 847 | } | 847 | } |
| @@ -938,7 +938,7 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev, | |||
| 938 | if (retval) | 938 | if (retval) |
| 939 | goto err; | 939 | goto err; |
| 940 | 940 | ||
| 941 | CX18_DEBUG_INFO("base addr: 0x%08x\n", cx->base_addr); | 941 | CX18_DEBUG_INFO("base addr: 0x%llx\n", (u64)cx->base_addr); |
| 942 | 942 | ||
| 943 | /* PCI Device Setup */ | 943 | /* PCI Device Setup */ |
| 944 | retval = cx18_setup_pci(cx, pci_dev, pci_id); | 944 | retval = cx18_setup_pci(cx, pci_dev, pci_id); |
| @@ -946,8 +946,8 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev, | |||
| 946 | goto free_workqueues; | 946 | goto free_workqueues; |
| 947 | 947 | ||
| 948 | /* map io memory */ | 948 | /* map io memory */ |
| 949 | CX18_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", | 949 | CX18_DEBUG_INFO("attempting ioremap at 0x%llx len 0x%08x\n", |
| 950 | cx->base_addr + CX18_MEM_OFFSET, CX18_MEM_SIZE); | 950 | (u64)cx->base_addr + CX18_MEM_OFFSET, CX18_MEM_SIZE); |
| 951 | cx->enc_mem = ioremap_nocache(cx->base_addr + CX18_MEM_OFFSET, | 951 | cx->enc_mem = ioremap_nocache(cx->base_addr + CX18_MEM_OFFSET, |
| 952 | CX18_MEM_SIZE); | 952 | CX18_MEM_SIZE); |
| 953 | if (!cx->enc_mem) { | 953 | if (!cx->enc_mem) { |
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index 7a37e0ee136f..2767c64df0c8 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h | |||
| @@ -622,7 +622,7 @@ struct cx18 { | |||
| 622 | unique ID. Starts at 1, so 0 can be used as | 622 | unique ID. Starts at 1, so 0 can be used as |
| 623 | uninitialized value in the stream->id. */ | 623 | uninitialized value in the stream->id. */ |
| 624 | 624 | ||
| 625 | u32 base_addr; | 625 | resource_size_t base_addr; |
| 626 | 626 | ||
| 627 | u8 card_rev; | 627 | u8 card_rev; |
| 628 | void __iomem *enc_mem, *reg_mem; | 628 | void __iomem *enc_mem, *reg_mem; |
diff --git a/drivers/media/video/cx18/cx18-firmware.c b/drivers/media/video/cx18/cx18-firmware.c index 1b3fb502e6be..b85c292a849a 100644 --- a/drivers/media/video/cx18/cx18-firmware.c +++ b/drivers/media/video/cx18/cx18-firmware.c | |||
| @@ -164,8 +164,13 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx, | |||
| 164 | 164 | ||
| 165 | apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32]; | 165 | apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32]; |
| 166 | while (offset + sizeof(seghdr) < fw->size) { | 166 | while (offset + sizeof(seghdr) < fw->size) { |
| 167 | /* TODO: byteswapping */ | 167 | const u32 *shptr = src + offset / 4; |
| 168 | memcpy(&seghdr, src + offset / 4, sizeof(seghdr)); | 168 | |
| 169 | seghdr.sync1 = le32_to_cpu(shptr[0]); | ||
| 170 | seghdr.sync2 = le32_to_cpu(shptr[1]); | ||
| 171 | seghdr.addr = le32_to_cpu(shptr[2]); | ||
| 172 | seghdr.size = le32_to_cpu(shptr[3]); | ||
| 173 | |||
| 169 | offset += sizeof(seghdr); | 174 | offset += sizeof(seghdr); |
| 170 | if (seghdr.sync1 != APU_ROM_SYNC1 || | 175 | if (seghdr.sync1 != APU_ROM_SYNC1 || |
| 171 | seghdr.sync2 != APU_ROM_SYNC2) { | 176 | seghdr.sync2 != APU_ROM_SYNC2) { |
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c index ed8118390b02..eabf00c6351b 100644 --- a/drivers/media/video/cx18/cx18-mailbox.c +++ b/drivers/media/video/cx18/cx18-mailbox.c | |||
| @@ -434,6 +434,7 @@ static int epu_dma_done_irq(struct cx18 *cx, struct cx18_in_work_order *order) | |||
| 434 | { | 434 | { |
| 435 | u32 handle, mdl_ack_offset, mdl_ack_count; | 435 | u32 handle, mdl_ack_offset, mdl_ack_count; |
| 436 | struct cx18_mailbox *mb; | 436 | struct cx18_mailbox *mb; |
| 437 | int i; | ||
| 437 | 438 | ||
| 438 | mb = &order->mb; | 439 | mb = &order->mb; |
| 439 | handle = mb->args[0]; | 440 | handle = mb->args[0]; |
| @@ -447,8 +448,9 @@ static int epu_dma_done_irq(struct cx18 *cx, struct cx18_in_work_order *order) | |||
| 447 | return -1; | 448 | return -1; |
| 448 | } | 449 | } |
| 449 | 450 | ||
| 450 | cx18_memcpy_fromio(cx, order->mdl_ack, cx->enc_mem + mdl_ack_offset, | 451 | for (i = 0; i < sizeof(struct cx18_mdl_ack) * mdl_ack_count; i += sizeof(u32)) |
| 451 | sizeof(struct cx18_mdl_ack) * mdl_ack_count); | 452 | ((u32 *)order->mdl_ack)[i / sizeof(u32)] = |
| 453 | cx18_readl(cx, cx->enc_mem + mdl_ack_offset + i); | ||
| 452 | 454 | ||
| 453 | if ((order->flags & CX18_F_EWO_MB_STALE) == 0) | 455 | if ((order->flags & CX18_F_EWO_MB_STALE) == 0) |
| 454 | mb_ack_irq(cx, order); | 456 | mb_ack_irq(cx, order); |
| @@ -538,6 +540,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) | |||
| 538 | struct cx18_mailbox *order_mb; | 540 | struct cx18_mailbox *order_mb; |
| 539 | struct cx18_in_work_order *order; | 541 | struct cx18_in_work_order *order; |
| 540 | int submit; | 542 | int submit; |
| 543 | int i; | ||
| 541 | 544 | ||
| 542 | switch (rpu) { | 545 | switch (rpu) { |
| 543 | case CPU: | 546 | case CPU: |
| @@ -562,10 +565,12 @@ void cx18_api_epu_cmd_irq(struct cx18 *cx, int rpu) | |||
| 562 | order_mb = &order->mb; | 565 | order_mb = &order->mb; |
| 563 | 566 | ||
| 564 | /* mb->cmd and mb->args[0] through mb->args[2] */ | 567 | /* mb->cmd and mb->args[0] through mb->args[2] */ |
| 565 | cx18_memcpy_fromio(cx, &order_mb->cmd, &mb->cmd, 4 * sizeof(u32)); | 568 | for (i = 0; i < 4; i++) |
| 569 | (&order_mb->cmd)[i] = cx18_readl(cx, &mb->cmd + i); | ||
| 570 | |||
| 566 | /* mb->request and mb->ack. N.B. we want to read mb->ack last */ | 571 | /* mb->request and mb->ack. N.B. we want to read mb->ack last */ |
| 567 | cx18_memcpy_fromio(cx, &order_mb->request, &mb->request, | 572 | for (i = 0; i < 2; i++) |
| 568 | 2 * sizeof(u32)); | 573 | (&order_mb->request)[i] = cx18_readl(cx, &mb->request + i); |
| 569 | 574 | ||
| 570 | if (order_mb->request == order_mb->ack) { | 575 | if (order_mb->request == order_mb->ack) { |
| 571 | CX18_DEBUG_WARN("Possibly falling behind: %s self-ack'ed our " | 576 | CX18_DEBUG_WARN("Possibly falling behind: %s self-ack'ed our " |
diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c index 068f78dc5d13..b4c99c7270cf 100644 --- a/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/drivers/media/video/cx231xx/cx231xx-audio.c | |||
| @@ -307,7 +307,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
| 307 | urb->context = dev; | 307 | urb->context = dev; |
| 308 | urb->pipe = usb_rcvisocpipe(dev->udev, | 308 | urb->pipe = usb_rcvisocpipe(dev->udev, |
| 309 | dev->adev.end_point_addr); | 309 | dev->adev.end_point_addr); |
| 310 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; | 310 | urb->transfer_flags = URB_ISO_ASAP; |
| 311 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 311 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
| 312 | urb->interval = 1; | 312 | urb->interval = 1; |
| 313 | urb->complete = cx231xx_audio_isocirq; | 313 | urb->complete = cx231xx_audio_isocirq; |
| @@ -368,7 +368,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev) | |||
| 368 | urb->context = dev; | 368 | urb->context = dev; |
| 369 | urb->pipe = usb_rcvbulkpipe(dev->udev, | 369 | urb->pipe = usb_rcvbulkpipe(dev->udev, |
| 370 | dev->adev.end_point_addr); | 370 | dev->adev.end_point_addr); |
| 371 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 371 | urb->transfer_flags = 0; |
| 372 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 372 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
| 373 | urb->complete = cx231xx_audio_bulkirq; | 373 | urb->complete = cx231xx_audio_bulkirq; |
| 374 | urb->transfer_buffer_length = sb_size; | 374 | urb->transfer_buffer_length = sb_size; |
diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.c b/drivers/media/video/cx231xx/cx231xx-vbi.c index 3d15314e1f88..ac7db52f404f 100644 --- a/drivers/media/video/cx231xx/cx231xx-vbi.c +++ b/drivers/media/video/cx231xx/cx231xx-vbi.c | |||
| @@ -448,7 +448,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
| 448 | return -ENOMEM; | 448 | return -ENOMEM; |
| 449 | } | 449 | } |
| 450 | dev->vbi_mode.bulk_ctl.urb[i] = urb; | 450 | dev->vbi_mode.bulk_ctl.urb[i] = urb; |
| 451 | urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; | 451 | urb->transfer_flags = 0; |
| 452 | 452 | ||
| 453 | dev->vbi_mode.bulk_ctl.transfer_buffer[i] = | 453 | dev->vbi_mode.bulk_ctl.transfer_buffer[i] = |
| 454 | kzalloc(sb_size, GFP_KERNEL); | 454 | kzalloc(sb_size, GFP_KERNEL); |
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index 13739e002a63..080e11157e5f 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
| @@ -127,22 +127,37 @@ struct cx23885_board cx23885_boards[] = { | |||
| 127 | }, | 127 | }, |
| 128 | [CX23885_BOARD_HAUPPAUGE_HVR1250] = { | 128 | [CX23885_BOARD_HAUPPAUGE_HVR1250] = { |
| 129 | .name = "Hauppauge WinTV-HVR1250", | 129 | .name = "Hauppauge WinTV-HVR1250", |
| 130 | .porta = CX23885_ANALOG_VIDEO, | ||
| 130 | .portc = CX23885_MPEG_DVB, | 131 | .portc = CX23885_MPEG_DVB, |
| 132 | #ifdef MT2131_NO_ANALOG_SUPPORT_YET | ||
| 133 | .tuner_type = TUNER_PHILIPS_TDA8290, | ||
| 134 | .tuner_addr = 0x42, /* 0x84 >> 1 */ | ||
| 135 | .tuner_bus = 1, | ||
| 136 | #endif | ||
| 137 | .force_bff = 1, | ||
| 131 | .input = {{ | 138 | .input = {{ |
| 139 | #ifdef MT2131_NO_ANALOG_SUPPORT_YET | ||
| 132 | .type = CX23885_VMUX_TELEVISION, | 140 | .type = CX23885_VMUX_TELEVISION, |
| 133 | .vmux = 0, | 141 | .vmux = CX25840_VIN7_CH3 | |
| 142 | CX25840_VIN5_CH2 | | ||
| 143 | CX25840_VIN2_CH1, | ||
| 144 | .amux = CX25840_AUDIO8, | ||
| 134 | .gpio0 = 0xff00, | 145 | .gpio0 = 0xff00, |
| 135 | }, { | 146 | }, { |
| 136 | .type = CX23885_VMUX_DEBUG, | 147 | #endif |
| 137 | .vmux = 0, | ||
| 138 | .gpio0 = 0xff01, | ||
| 139 | }, { | ||
| 140 | .type = CX23885_VMUX_COMPOSITE1, | 148 | .type = CX23885_VMUX_COMPOSITE1, |
| 141 | .vmux = 1, | 149 | .vmux = CX25840_VIN7_CH3 | |
| 150 | CX25840_VIN4_CH2 | | ||
| 151 | CX25840_VIN6_CH1, | ||
| 152 | .amux = CX25840_AUDIO7, | ||
| 142 | .gpio0 = 0xff02, | 153 | .gpio0 = 0xff02, |
| 143 | }, { | 154 | }, { |
| 144 | .type = CX23885_VMUX_SVIDEO, | 155 | .type = CX23885_VMUX_SVIDEO, |
| 145 | .vmux = 2, | 156 | .vmux = CX25840_VIN7_CH3 | |
| 157 | CX25840_VIN4_CH2 | | ||
| 158 | CX25840_VIN8_CH1 | | ||
| 159 | CX25840_SVIDEO_ON, | ||
| 160 | .amux = CX25840_AUDIO7, | ||
| 146 | .gpio0 = 0xff02, | 161 | .gpio0 = 0xff02, |
| 147 | } }, | 162 | } }, |
| 148 | }, | 163 | }, |
| @@ -267,7 +282,55 @@ struct cx23885_board cx23885_boards[] = { | |||
| 267 | }, | 282 | }, |
| 268 | [CX23885_BOARD_HAUPPAUGE_HVR1255] = { | 283 | [CX23885_BOARD_HAUPPAUGE_HVR1255] = { |
| 269 | .name = "Hauppauge WinTV-HVR1255", | 284 | .name = "Hauppauge WinTV-HVR1255", |
| 285 | .porta = CX23885_ANALOG_VIDEO, | ||
| 286 | .portc = CX23885_MPEG_DVB, | ||
| 287 | .tuner_type = TUNER_ABSENT, | ||
| 288 | .tuner_addr = 0x42, /* 0x84 >> 1 */ | ||
| 289 | .force_bff = 1, | ||
| 290 | .input = {{ | ||
| 291 | .type = CX23885_VMUX_TELEVISION, | ||
| 292 | .vmux = CX25840_VIN7_CH3 | | ||
| 293 | CX25840_VIN5_CH2 | | ||
| 294 | CX25840_VIN2_CH1 | | ||
| 295 | CX25840_DIF_ON, | ||
| 296 | .amux = CX25840_AUDIO8, | ||
| 297 | }, { | ||
| 298 | .type = CX23885_VMUX_COMPOSITE1, | ||
| 299 | .vmux = CX25840_VIN7_CH3 | | ||
| 300 | CX25840_VIN4_CH2 | | ||
| 301 | CX25840_VIN6_CH1, | ||
| 302 | .amux = CX25840_AUDIO7, | ||
| 303 | }, { | ||
| 304 | .type = CX23885_VMUX_SVIDEO, | ||
| 305 | .vmux = CX25840_VIN7_CH3 | | ||
| 306 | CX25840_VIN4_CH2 | | ||
| 307 | CX25840_VIN8_CH1 | | ||
| 308 | CX25840_SVIDEO_ON, | ||
| 309 | .amux = CX25840_AUDIO7, | ||
| 310 | } }, | ||
| 311 | }, | ||
| 312 | [CX23885_BOARD_HAUPPAUGE_HVR1255_22111] = { | ||
| 313 | .name = "Hauppauge WinTV-HVR1255", | ||
| 314 | .porta = CX23885_ANALOG_VIDEO, | ||
| 270 | .portc = CX23885_MPEG_DVB, | 315 | .portc = CX23885_MPEG_DVB, |
| 316 | .tuner_type = TUNER_ABSENT, | ||
| 317 | .tuner_addr = 0x42, /* 0x84 >> 1 */ | ||
| 318 | .force_bff = 1, | ||
| 319 | .input = {{ | ||
| 320 | .type = CX23885_VMUX_TELEVISION, | ||
| 321 | .vmux = CX25840_VIN7_CH3 | | ||
| 322 | CX25840_VIN5_CH2 | | ||
| 323 | CX25840_VIN2_CH1 | | ||
| 324 | CX25840_DIF_ON, | ||
| 325 | .amux = CX25840_AUDIO8, | ||
| 326 | }, { | ||
| 327 | .type = CX23885_VMUX_SVIDEO, | ||
| 328 | .vmux = CX25840_VIN7_CH3 | | ||
| 329 | CX25840_VIN4_CH2 | | ||
| 330 | CX25840_VIN8_CH1 | | ||
| 331 | CX25840_SVIDEO_ON, | ||
| 332 | .amux = CX25840_AUDIO7, | ||
| 333 | } }, | ||
| 271 | }, | 334 | }, |
| 272 | [CX23885_BOARD_HAUPPAUGE_HVR1210] = { | 335 | [CX23885_BOARD_HAUPPAUGE_HVR1210] = { |
| 273 | .name = "Hauppauge WinTV-HVR1210", | 336 | .name = "Hauppauge WinTV-HVR1210", |
| @@ -624,7 +687,7 @@ struct cx23885_subid cx23885_subids[] = { | |||
| 624 | }, { | 687 | }, { |
| 625 | .subvendor = 0x0070, | 688 | .subvendor = 0x0070, |
| 626 | .subdevice = 0x2259, | 689 | .subdevice = 0x2259, |
| 627 | .card = CX23885_BOARD_HAUPPAUGE_HVR1255, | 690 | .card = CX23885_BOARD_HAUPPAUGE_HVR1255_22111, |
| 628 | }, { | 691 | }, { |
| 629 | .subvendor = 0x0070, | 692 | .subvendor = 0x0070, |
| 630 | .subdevice = 0x2291, | 693 | .subdevice = 0x2291, |
| @@ -900,7 +963,7 @@ int cx23885_tuner_callback(void *priv, int component, int command, int arg) | |||
| 900 | struct cx23885_dev *dev = port->dev; | 963 | struct cx23885_dev *dev = port->dev; |
| 901 | u32 bitmask = 0; | 964 | u32 bitmask = 0; |
| 902 | 965 | ||
| 903 | if (command == XC2028_RESET_CLK) | 966 | if ((command == XC2028_RESET_CLK) || (command == XC2028_I2C_FLUSH)) |
| 904 | return 0; | 967 | return 0; |
| 905 | 968 | ||
| 906 | if (command != 0) { | 969 | if (command != 0) { |
| @@ -1130,6 +1193,7 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) | |||
| 1130 | case CX23885_BOARD_HAUPPAUGE_HVR1270: | 1193 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
| 1131 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | 1194 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
| 1132 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 1195 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| 1196 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
| 1133 | case CX23885_BOARD_HAUPPAUGE_HVR1210: | 1197 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| 1134 | /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */ | 1198 | /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */ |
| 1135 | /* GPIO-6 I2C Gate which can isolate the demod from the bus */ | 1199 | /* GPIO-6 I2C Gate which can isolate the demod from the bus */ |
| @@ -1267,6 +1331,7 @@ int cx23885_ir_init(struct cx23885_dev *dev) | |||
| 1267 | case CX23885_BOARD_HAUPPAUGE_HVR1400: | 1331 | case CX23885_BOARD_HAUPPAUGE_HVR1400: |
| 1268 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | 1332 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
| 1269 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 1333 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| 1334 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
| 1270 | case CX23885_BOARD_HAUPPAUGE_HVR1210: | 1335 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| 1271 | /* FIXME: Implement me */ | 1336 | /* FIXME: Implement me */ |
| 1272 | break; | 1337 | break; |
| @@ -1424,6 +1489,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
| 1424 | case CX23885_BOARD_HAUPPAUGE_HVR1270: | 1489 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
| 1425 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | 1490 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
| 1426 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 1491 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| 1492 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
| 1427 | case CX23885_BOARD_HAUPPAUGE_HVR1210: | 1493 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| 1428 | case CX23885_BOARD_HAUPPAUGE_HVR1850: | 1494 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| 1429 | case CX23885_BOARD_HAUPPAUGE_HVR1290: | 1495 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| @@ -1511,6 +1577,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
| 1511 | case CX23885_BOARD_HAUPPAUGE_HVR1270: | 1577 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
| 1512 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | 1578 | case CX23885_BOARD_HAUPPAUGE_HVR1275: |
| 1513 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 1579 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| 1580 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
| 1514 | case CX23885_BOARD_HAUPPAUGE_HVR1210: | 1581 | case CX23885_BOARD_HAUPPAUGE_HVR1210: |
| 1515 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: | 1582 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
| 1516 | case CX23885_BOARD_HAUPPAUGE_HVR1290: | 1583 | case CX23885_BOARD_HAUPPAUGE_HVR1290: |
| @@ -1526,10 +1593,10 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
| 1526 | */ | 1593 | */ |
| 1527 | switch (dev->board) { | 1594 | switch (dev->board) { |
| 1528 | case CX23885_BOARD_TEVII_S470: | 1595 | case CX23885_BOARD_TEVII_S470: |
| 1529 | case CX23885_BOARD_HAUPPAUGE_HVR1250: | ||
| 1530 | /* Currently only enabled for the integrated IR controller */ | 1596 | /* Currently only enabled for the integrated IR controller */ |
| 1531 | if (!enable_885_ir) | 1597 | if (!enable_885_ir) |
| 1532 | break; | 1598 | break; |
| 1599 | case CX23885_BOARD_HAUPPAUGE_HVR1250: | ||
| 1533 | case CX23885_BOARD_HAUPPAUGE_HVR1800: | 1600 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 1534 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: | 1601 | case CX23885_BOARD_HAUPPAUGE_HVR1800lp: |
| 1535 | case CX23885_BOARD_HAUPPAUGE_HVR1700: | 1602 | case CX23885_BOARD_HAUPPAUGE_HVR1700: |
| @@ -1539,6 +1606,8 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
| 1539 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: | 1606 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
| 1540 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: | 1607 | case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: |
| 1541 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: | 1608 | case CX23885_BOARD_COMPRO_VIDEOMATE_E800: |
| 1609 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | ||
| 1610 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
| 1542 | case CX23885_BOARD_HAUPPAUGE_HVR1270: | 1611 | case CX23885_BOARD_HAUPPAUGE_HVR1270: |
| 1543 | case CX23885_BOARD_HAUPPAUGE_HVR1850: | 1612 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| 1544 | case CX23885_BOARD_MYGICA_X8506: | 1613 | case CX23885_BOARD_MYGICA_X8506: |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index a80a92c47455..cd542684ba02 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
| @@ -712,6 +712,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
| 712 | } | 712 | } |
| 713 | break; | 713 | break; |
| 714 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 714 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
| 715 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
| 715 | i2c_bus = &dev->i2c_bus[0]; | 716 | i2c_bus = &dev->i2c_bus[0]; |
| 716 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, | 717 | fe0->dvb.frontend = dvb_attach(s5h1411_attach, |
| 717 | &hcw_s5h1411_config, | 718 | &hcw_s5h1411_config, |
| @@ -721,6 +722,11 @@ static int dvb_register(struct cx23885_tsport *port) | |||
| 721 | 0x60, &dev->i2c_bus[1].i2c_adap, | 722 | 0x60, &dev->i2c_bus[1].i2c_adap, |
| 722 | &hauppauge_tda18271_config); | 723 | &hauppauge_tda18271_config); |
| 723 | } | 724 | } |
| 725 | |||
| 726 | tda18271_attach(&dev->ts1.analog_fe, | ||
| 727 | 0x60, &dev->i2c_bus[1].i2c_adap, | ||
| 728 | &hauppauge_tda18271_config); | ||
| 729 | |||
| 724 | break; | 730 | break; |
| 725 | case CX23885_BOARD_HAUPPAUGE_HVR1800: | 731 | case CX23885_BOARD_HAUPPAUGE_HVR1800: |
| 726 | i2c_bus = &dev->i2c_bus[0]; | 732 | i2c_bus = &dev->i2c_bus[0]; |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index c654bdc7ccb2..22f8e7fbd665 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
| @@ -505,6 +505,9 @@ static int cx23885_video_mux(struct cx23885_dev *dev, unsigned int input) | |||
| 505 | 505 | ||
| 506 | if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) || | 506 | if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) || |
| 507 | (dev->board == CX23885_BOARD_MPX885) || | 507 | (dev->board == CX23885_BOARD_MPX885) || |
| 508 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1250) || | ||
| 509 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) || | ||
| 510 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111) || | ||
| 508 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850)) { | 511 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850)) { |
| 509 | /* Configure audio routing */ | 512 | /* Configure audio routing */ |
| 510 | v4l2_subdev_call(dev->sd_cx25840, audio, s_routing, | 513 | v4l2_subdev_call(dev->sd_cx25840, audio, s_routing, |
| @@ -1578,7 +1581,9 @@ static int cx23885_set_freq_via_ops(struct cx23885_dev *dev, | |||
| 1578 | 1581 | ||
| 1579 | fe = vfe->dvb.frontend; | 1582 | fe = vfe->dvb.frontend; |
| 1580 | 1583 | ||
| 1581 | if (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) | 1584 | if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) || |
| 1585 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) || | ||
| 1586 | (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111)) | ||
| 1582 | fe = &dev->ts1.analog_fe; | 1587 | fe = &dev->ts1.analog_fe; |
| 1583 | 1588 | ||
| 1584 | if (fe && fe->ops.tuner_ops.set_analog_params) { | 1589 | if (fe && fe->ops.tuner_ops.set_analog_params) { |
| @@ -1608,6 +1613,8 @@ int cx23885_set_frequency(struct file *file, void *priv, | |||
| 1608 | int ret; | 1613 | int ret; |
| 1609 | 1614 | ||
| 1610 | switch (dev->board) { | 1615 | switch (dev->board) { |
| 1616 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | ||
| 1617 | case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: | ||
| 1611 | case CX23885_BOARD_HAUPPAUGE_HVR1850: | 1618 | case CX23885_BOARD_HAUPPAUGE_HVR1850: |
| 1612 | ret = cx23885_set_freq_via_ops(dev, f); | 1619 | ret = cx23885_set_freq_via_ops(dev, f); |
| 1613 | break; | 1620 | break; |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index d884784a1c85..13c37ec07ae7 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
| @@ -90,6 +90,7 @@ | |||
| 90 | #define CX23885_BOARD_MYGICA_X8507 33 | 90 | #define CX23885_BOARD_MYGICA_X8507 33 |
| 91 | #define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL 34 | 91 | #define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL 34 |
| 92 | #define CX23885_BOARD_TEVII_S471 35 | 92 | #define CX23885_BOARD_TEVII_S471 35 |
| 93 | #define CX23885_BOARD_HAUPPAUGE_HVR1255_22111 36 | ||
| 93 | 94 | ||
| 94 | #define GPIO_0 0x00000001 | 95 | #define GPIO_0 0x00000001 |
| 95 | #define GPIO_1 0x00000002 | 96 | #define GPIO_1 0x00000002 |
diff --git a/drivers/media/video/cx25821/cx25821-core.c b/drivers/media/video/cx25821/cx25821-core.c index 83c1aa6b2e6c..f11f6f07e915 100644 --- a/drivers/media/video/cx25821/cx25821-core.c +++ b/drivers/media/video/cx25821/cx25821-core.c | |||
| @@ -904,9 +904,6 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) | |||
| 904 | list_add_tail(&dev->devlist, &cx25821_devlist); | 904 | list_add_tail(&dev->devlist, &cx25821_devlist); |
| 905 | mutex_unlock(&cx25821_devlist_mutex); | 905 | mutex_unlock(&cx25821_devlist_mutex); |
| 906 | 906 | ||
| 907 | strcpy(cx25821_boards[UNKNOWN_BOARD].name, "unknown"); | ||
| 908 | strcpy(cx25821_boards[CX25821_BOARD].name, "cx25821"); | ||
| 909 | |||
| 910 | if (dev->pci->device != 0x8210) { | 907 | if (dev->pci->device != 0x8210) { |
| 911 | pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n", | 908 | pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n", |
| 912 | __func__, dev->pci->device); | 909 | __func__, dev->pci->device); |
diff --git a/drivers/media/video/cx25821/cx25821.h b/drivers/media/video/cx25821/cx25821.h index b9aa801b00a7..029f2934a6d8 100644 --- a/drivers/media/video/cx25821/cx25821.h +++ b/drivers/media/video/cx25821/cx25821.h | |||
| @@ -187,7 +187,7 @@ enum port { | |||
| 187 | }; | 187 | }; |
| 188 | 188 | ||
| 189 | struct cx25821_board { | 189 | struct cx25821_board { |
| 190 | char *name; | 190 | const char *name; |
| 191 | enum port porta; | 191 | enum port porta; |
| 192 | enum port portb; | 192 | enum port portb; |
| 193 | enum port portc; | 193 | enum port portc; |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index fc1ff69cffd0..d8eac3e30a7e 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
| @@ -84,7 +84,7 @@ MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]"); | |||
| 84 | 84 | ||
| 85 | 85 | ||
| 86 | /* ----------------------------------------------------------------------- */ | 86 | /* ----------------------------------------------------------------------- */ |
| 87 | static void cx23885_std_setup(struct i2c_client *client); | 87 | static void cx23888_std_setup(struct i2c_client *client); |
| 88 | 88 | ||
| 89 | int cx25840_write(struct i2c_client *client, u16 addr, u8 value) | 89 | int cx25840_write(struct i2c_client *client, u16 addr, u8 value) |
| 90 | { | 90 | { |
| @@ -638,10 +638,13 @@ static void cx23885_initialize(struct i2c_client *client) | |||
| 638 | finish_wait(&state->fw_wait, &wait); | 638 | finish_wait(&state->fw_wait, &wait); |
| 639 | destroy_workqueue(q); | 639 | destroy_workqueue(q); |
| 640 | 640 | ||
| 641 | /* Call the cx23885 specific std setup func, we no longer rely on | 641 | /* Call the cx23888 specific std setup func, we no longer rely on |
| 642 | * the generic cx24840 func. | 642 | * the generic cx24840 func. |
| 643 | */ | 643 | */ |
| 644 | cx23885_std_setup(client); | 644 | if (is_cx23888(state)) |
| 645 | cx23888_std_setup(client); | ||
| 646 | else | ||
| 647 | cx25840_std_setup(client); | ||
| 645 | 648 | ||
| 646 | /* (re)set input */ | 649 | /* (re)set input */ |
| 647 | set_input(client, state->vid_input, state->aud_input); | 650 | set_input(client, state->vid_input, state->aud_input); |
| @@ -1103,9 +1106,23 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
| 1103 | 1106 | ||
| 1104 | cx25840_write4(client, 0x410, 0xffff0dbf); | 1107 | cx25840_write4(client, 0x410, 0xffff0dbf); |
| 1105 | cx25840_write4(client, 0x414, 0x00137d03); | 1108 | cx25840_write4(client, 0x414, 0x00137d03); |
| 1106 | cx25840_write4(client, 0x418, 0x01008080); | 1109 | |
| 1110 | /* on the 887, 0x418 is HSCALE_CTRL, on the 888 it is | ||
| 1111 | CHROMA_CTRL */ | ||
| 1112 | if (is_cx23888(state)) | ||
| 1113 | cx25840_write4(client, 0x418, 0x01008080); | ||
| 1114 | else | ||
| 1115 | cx25840_write4(client, 0x418, 0x01000000); | ||
| 1116 | |||
| 1107 | cx25840_write4(client, 0x41c, 0x00000000); | 1117 | cx25840_write4(client, 0x41c, 0x00000000); |
| 1108 | cx25840_write4(client, 0x420, 0x001c3e0f); | 1118 | |
| 1119 | /* on the 887, 0x420 is CHROMA_CTRL, on the 888 it is | ||
| 1120 | CRUSH_CTRL */ | ||
| 1121 | if (is_cx23888(state)) | ||
| 1122 | cx25840_write4(client, 0x420, 0x001c3e0f); | ||
| 1123 | else | ||
| 1124 | cx25840_write4(client, 0x420, 0x001c8282); | ||
| 1125 | |||
| 1109 | cx25840_write4(client, 0x42c, 0x42600000); | 1126 | cx25840_write4(client, 0x42c, 0x42600000); |
| 1110 | cx25840_write4(client, 0x430, 0x0000039b); | 1127 | cx25840_write4(client, 0x430, 0x0000039b); |
| 1111 | cx25840_write4(client, 0x438, 0x00000000); | 1128 | cx25840_write4(client, 0x438, 0x00000000); |
| @@ -1233,7 +1250,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
| 1233 | cx25840_write4(client, 0x8d0, 0x1f063870); | 1250 | cx25840_write4(client, 0x8d0, 0x1f063870); |
| 1234 | } | 1251 | } |
| 1235 | 1252 | ||
| 1236 | if (is_cx2388x(state)) { | 1253 | if (is_cx23888(state)) { |
| 1237 | /* HVR1850 */ | 1254 | /* HVR1850 */ |
| 1238 | /* AUD_IO_CTRL - I2S Input, Parallel1*/ | 1255 | /* AUD_IO_CTRL - I2S Input, Parallel1*/ |
| 1239 | /* - Channel 1 src - Parallel1 (Merlin out) */ | 1256 | /* - Channel 1 src - Parallel1 (Merlin out) */ |
| @@ -1298,8 +1315,8 @@ static int set_v4lstd(struct i2c_client *client) | |||
| 1298 | } | 1315 | } |
| 1299 | cx25840_and_or(client, 0x400, ~0xf, fmt); | 1316 | cx25840_and_or(client, 0x400, ~0xf, fmt); |
| 1300 | cx25840_and_or(client, 0x403, ~0x3, pal_m); | 1317 | cx25840_and_or(client, 0x403, ~0x3, pal_m); |
| 1301 | if (is_cx2388x(state)) | 1318 | if (is_cx23888(state)) |
| 1302 | cx23885_std_setup(client); | 1319 | cx23888_std_setup(client); |
| 1303 | else | 1320 | else |
| 1304 | cx25840_std_setup(client); | 1321 | cx25840_std_setup(client); |
| 1305 | if (!is_cx2583x(state)) | 1322 | if (!is_cx2583x(state)) |
| @@ -1312,6 +1329,7 @@ static int set_v4lstd(struct i2c_client *client) | |||
| 1312 | static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) | 1329 | static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) |
| 1313 | { | 1330 | { |
| 1314 | struct v4l2_subdev *sd = to_sd(ctrl); | 1331 | struct v4l2_subdev *sd = to_sd(ctrl); |
| 1332 | struct cx25840_state *state = to_state(sd); | ||
| 1315 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1333 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1316 | 1334 | ||
| 1317 | switch (ctrl->id) { | 1335 | switch (ctrl->id) { |
| @@ -1324,12 +1342,20 @@ static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) | |||
| 1324 | break; | 1342 | break; |
| 1325 | 1343 | ||
| 1326 | case V4L2_CID_SATURATION: | 1344 | case V4L2_CID_SATURATION: |
| 1327 | cx25840_write(client, 0x420, ctrl->val << 1); | 1345 | if (is_cx23888(state)) { |
| 1328 | cx25840_write(client, 0x421, ctrl->val << 1); | 1346 | cx25840_write(client, 0x418, ctrl->val << 1); |
| 1347 | cx25840_write(client, 0x419, ctrl->val << 1); | ||
| 1348 | } else { | ||
| 1349 | cx25840_write(client, 0x420, ctrl->val << 1); | ||
| 1350 | cx25840_write(client, 0x421, ctrl->val << 1); | ||
| 1351 | } | ||
| 1329 | break; | 1352 | break; |
| 1330 | 1353 | ||
| 1331 | case V4L2_CID_HUE: | 1354 | case V4L2_CID_HUE: |
| 1332 | cx25840_write(client, 0x422, ctrl->val); | 1355 | if (is_cx23888(state)) |
| 1356 | cx25840_write(client, 0x41a, ctrl->val); | ||
| 1357 | else | ||
| 1358 | cx25840_write(client, 0x422, ctrl->val); | ||
| 1333 | break; | 1359 | break; |
| 1334 | 1360 | ||
| 1335 | default: | 1361 | default: |
| @@ -1354,11 +1380,21 @@ static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt | |||
| 1354 | fmt->field = V4L2_FIELD_INTERLACED; | 1380 | fmt->field = V4L2_FIELD_INTERLACED; |
| 1355 | fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; | 1381 | fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; |
| 1356 | 1382 | ||
| 1357 | Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; | 1383 | if (is_cx23888(state)) { |
| 1358 | Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; | 1384 | Vsrc = (cx25840_read(client, 0x42a) & 0x3f) << 4; |
| 1385 | Vsrc |= (cx25840_read(client, 0x429) & 0xf0) >> 4; | ||
| 1386 | } else { | ||
| 1387 | Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; | ||
| 1388 | Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; | ||
| 1389 | } | ||
| 1359 | 1390 | ||
| 1360 | Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; | 1391 | if (is_cx23888(state)) { |
| 1361 | Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; | 1392 | Hsrc = (cx25840_read(client, 0x426) & 0x3f) << 4; |
| 1393 | Hsrc |= (cx25840_read(client, 0x425) & 0xf0) >> 4; | ||
| 1394 | } else { | ||
| 1395 | Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; | ||
| 1396 | Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; | ||
| 1397 | } | ||
| 1362 | 1398 | ||
| 1363 | Vlines = fmt->height + (is_50Hz ? 4 : 7); | 1399 | Vlines = fmt->height + (is_50Hz ? 4 : 7); |
| 1364 | 1400 | ||
| @@ -1782,8 +1818,8 @@ static int cx25840_s_video_routing(struct v4l2_subdev *sd, | |||
| 1782 | struct cx25840_state *state = to_state(sd); | 1818 | struct cx25840_state *state = to_state(sd); |
| 1783 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1819 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1784 | 1820 | ||
| 1785 | if (is_cx2388x(state)) | 1821 | if (is_cx23888(state)) |
| 1786 | cx23885_std_setup(client); | 1822 | cx23888_std_setup(client); |
| 1787 | 1823 | ||
| 1788 | return set_input(client, input, state->aud_input); | 1824 | return set_input(client, input, state->aud_input); |
| 1789 | } | 1825 | } |
| @@ -1794,8 +1830,8 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd, | |||
| 1794 | struct cx25840_state *state = to_state(sd); | 1830 | struct cx25840_state *state = to_state(sd); |
| 1795 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1831 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1796 | 1832 | ||
| 1797 | if (is_cx2388x(state)) | 1833 | if (is_cx23888(state)) |
| 1798 | cx23885_std_setup(client); | 1834 | cx23888_std_setup(client); |
| 1799 | return set_input(client, state->vid_input, input); | 1835 | return set_input(client, state->vid_input, input); |
| 1800 | } | 1836 | } |
| 1801 | 1837 | ||
| @@ -4939,7 +4975,7 @@ void cx23885_dif_setup(struct i2c_client *client, u32 ifHz) | |||
| 4939 | } | 4975 | } |
| 4940 | } | 4976 | } |
| 4941 | 4977 | ||
| 4942 | static void cx23885_std_setup(struct i2c_client *client) | 4978 | static void cx23888_std_setup(struct i2c_client *client) |
| 4943 | { | 4979 | { |
| 4944 | struct cx25840_state *state = to_state(i2c_get_clientdata(client)); | 4980 | struct cx25840_state *state = to_state(i2c_get_clientdata(client)); |
| 4945 | v4l2_std_id std = state->std; | 4981 | v4l2_std_id std = state->std; |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index e46446a449c0..ed7b2aa1ed83 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
| @@ -471,7 +471,7 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) | |||
| 471 | dprintk(1,"Loading firmware ...\n"); | 471 | dprintk(1,"Loading firmware ...\n"); |
| 472 | dataptr = (u32*)firmware->data; | 472 | dataptr = (u32*)firmware->data; |
| 473 | for (i = 0; i < (firmware->size >> 2); i++) { | 473 | for (i = 0; i < (firmware->size >> 2); i++) { |
| 474 | value = *dataptr; | 474 | value = le32_to_cpu(*dataptr); |
| 475 | checksum += ~value; | 475 | checksum += ~value; |
| 476 | memory_write(dev->core, i, value); | 476 | memory_write(dev->core, i, value); |
| 477 | dataptr++; | 477 | dataptr++; |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 20a7e24de6fb..862c6575c557 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
| @@ -974,6 +974,7 @@ struct em28xx_board em28xx_boards[] = { | |||
| 974 | [EM2884_BOARD_CINERGY_HTC_STICK] = { | 974 | [EM2884_BOARD_CINERGY_HTC_STICK] = { |
| 975 | .name = "Terratec Cinergy HTC Stick", | 975 | .name = "Terratec Cinergy HTC Stick", |
| 976 | .has_dvb = 1, | 976 | .has_dvb = 1, |
| 977 | .ir_codes = RC_MAP_NEC_TERRATEC_CINERGY_XS, | ||
| 977 | #if 0 | 978 | #if 0 |
| 978 | .tuner_type = TUNER_PHILIPS_TDA8290, | 979 | .tuner_type = TUNER_PHILIPS_TDA8290, |
| 979 | .tuner_addr = 0x41, | 980 | .tuner_addr = 0x41, |
| @@ -2892,7 +2893,7 @@ static void request_module_async(struct work_struct *work) | |||
| 2892 | 2893 | ||
| 2893 | if (dev->board.has_dvb) | 2894 | if (dev->board.has_dvb) |
| 2894 | request_module("em28xx-dvb"); | 2895 | request_module("em28xx-dvb"); |
| 2895 | if (dev->board.has_ir_i2c && !disable_ir) | 2896 | if (dev->board.ir_codes && !disable_ir) |
| 2896 | request_module("em28xx-rc"); | 2897 | request_module("em28xx-rc"); |
| 2897 | } | 2898 | } |
| 2898 | 2899 | ||
diff --git a/drivers/media/video/em28xx/em28xx-input.c b/drivers/media/video/em28xx/em28xx-input.c index fce5f7680c99..5e30c4f3f248 100644 --- a/drivers/media/video/em28xx/em28xx-input.c +++ b/drivers/media/video/em28xx/em28xx-input.c | |||
| @@ -527,6 +527,8 @@ static int em28xx_ir_init(struct em28xx *dev) | |||
| 527 | 527 | ||
| 528 | if (dev->board.ir_codes == NULL) { | 528 | if (dev->board.ir_codes == NULL) { |
| 529 | /* No remote control support */ | 529 | /* No remote control support */ |
| 530 | em28xx_warn("Remote control support is not available for " | ||
| 531 | "this card.\n"); | ||
| 530 | return 0; | 532 | return 0; |
| 531 | } | 533 | } |
| 532 | 534 | ||
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c index 137166d73945..31721eadc597 100644 --- a/drivers/media/video/gspca/gspca.c +++ b/drivers/media/video/gspca/gspca.c | |||
| @@ -1653,7 +1653,7 @@ static int vidioc_streamoff(struct file *file, void *priv, | |||
| 1653 | enum v4l2_buf_type buf_type) | 1653 | enum v4l2_buf_type buf_type) |
| 1654 | { | 1654 | { |
| 1655 | struct gspca_dev *gspca_dev = video_drvdata(file); | 1655 | struct gspca_dev *gspca_dev = video_drvdata(file); |
| 1656 | int ret; | 1656 | int i, ret; |
| 1657 | 1657 | ||
| 1658 | if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1658 | if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
| 1659 | return -EINVAL; | 1659 | return -EINVAL; |
| @@ -1678,6 +1678,8 @@ static int vidioc_streamoff(struct file *file, void *priv, | |||
| 1678 | wake_up_interruptible(&gspca_dev->wq); | 1678 | wake_up_interruptible(&gspca_dev->wq); |
| 1679 | 1679 | ||
| 1680 | /* empty the transfer queues */ | 1680 | /* empty the transfer queues */ |
| 1681 | for (i = 0; i < gspca_dev->nframes; i++) | ||
| 1682 | gspca_dev->frame[i].v4l2_buf.flags &= ~BUF_ALL_FLAGS; | ||
| 1681 | atomic_set(&gspca_dev->fr_q, 0); | 1683 | atomic_set(&gspca_dev->fr_q, 0); |
| 1682 | atomic_set(&gspca_dev->fr_i, 0); | 1684 | atomic_set(&gspca_dev->fr_i, 0); |
| 1683 | gspca_dev->fr_o = 0; | 1685 | gspca_dev->fr_o = 0; |
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c index b5acb1e4b4e7..80c81dd6d68b 100644 --- a/drivers/media/video/gspca/ov534.c +++ b/drivers/media/video/gspca/ov534.c | |||
| @@ -96,7 +96,7 @@ static void setbrightness(struct gspca_dev *gspca_dev); | |||
| 96 | static void setcontrast(struct gspca_dev *gspca_dev); | 96 | static void setcontrast(struct gspca_dev *gspca_dev); |
| 97 | static void setgain(struct gspca_dev *gspca_dev); | 97 | static void setgain(struct gspca_dev *gspca_dev); |
| 98 | static void setexposure(struct gspca_dev *gspca_dev); | 98 | static void setexposure(struct gspca_dev *gspca_dev); |
| 99 | static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val); | 99 | static void setagc(struct gspca_dev *gspca_dev); |
| 100 | static void setawb(struct gspca_dev *gspca_dev); | 100 | static void setawb(struct gspca_dev *gspca_dev); |
| 101 | static void setaec(struct gspca_dev *gspca_dev); | 101 | static void setaec(struct gspca_dev *gspca_dev); |
| 102 | static void setsharpness(struct gspca_dev *gspca_dev); | 102 | static void setsharpness(struct gspca_dev *gspca_dev); |
| @@ -189,7 +189,7 @@ static const struct ctrl sd_ctrls[] = { | |||
| 189 | .step = 1, | 189 | .step = 1, |
| 190 | .default_value = 1, | 190 | .default_value = 1, |
| 191 | }, | 191 | }, |
| 192 | .set = sd_setagc | 192 | .set_control = setagc |
| 193 | }, | 193 | }, |
| 194 | [AWB] = { | 194 | [AWB] = { |
| 195 | { | 195 | { |
| @@ -851,6 +851,7 @@ static int sccb_check_status(struct gspca_dev *gspca_dev) | |||
| 851 | int i; | 851 | int i; |
| 852 | 852 | ||
| 853 | for (i = 0; i < 5; i++) { | 853 | for (i = 0; i < 5; i++) { |
| 854 | msleep(10); | ||
| 854 | data = ov534_reg_read(gspca_dev, OV534_REG_STATUS); | 855 | data = ov534_reg_read(gspca_dev, OV534_REG_STATUS); |
| 855 | 856 | ||
| 856 | switch (data) { | 857 | switch (data) { |
| @@ -1242,10 +1243,6 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 1242 | 1243 | ||
| 1243 | cam->ctrls = sd->ctrls; | 1244 | cam->ctrls = sd->ctrls; |
| 1244 | 1245 | ||
| 1245 | /* the auto white balance control works only when auto gain is set */ | ||
| 1246 | if (sd_ctrls[AGC].qctrl.default_value == 0) | ||
| 1247 | gspca_dev->ctrl_inac |= (1 << AWB); | ||
| 1248 | |||
| 1249 | cam->cam_mode = ov772x_mode; | 1246 | cam->cam_mode = ov772x_mode; |
| 1250 | cam->nmodes = ARRAY_SIZE(ov772x_mode); | 1247 | cam->nmodes = ARRAY_SIZE(ov772x_mode); |
| 1251 | 1248 | ||
| @@ -1486,29 +1483,6 @@ scan_next: | |||
| 1486 | } while (remaining_len > 0); | 1483 | } while (remaining_len > 0); |
| 1487 | } | 1484 | } |
| 1488 | 1485 | ||
| 1489 | static int sd_setagc(struct gspca_dev *gspca_dev, __s32 val) | ||
| 1490 | { | ||
| 1491 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1492 | |||
| 1493 | sd->ctrls[AGC].val = val; | ||
| 1494 | |||
| 1495 | /* the auto white balance control works only | ||
| 1496 | * when auto gain is set */ | ||
| 1497 | if (val) { | ||
| 1498 | gspca_dev->ctrl_inac &= ~(1 << AWB); | ||
| 1499 | } else { | ||
| 1500 | gspca_dev->ctrl_inac |= (1 << AWB); | ||
| 1501 | if (sd->ctrls[AWB].val) { | ||
| 1502 | sd->ctrls[AWB].val = 0; | ||
| 1503 | if (gspca_dev->streaming) | ||
| 1504 | setawb(gspca_dev); | ||
| 1505 | } | ||
| 1506 | } | ||
| 1507 | if (gspca_dev->streaming) | ||
| 1508 | setagc(gspca_dev); | ||
| 1509 | return gspca_dev->usb_err; | ||
| 1510 | } | ||
| 1511 | |||
| 1512 | static int sd_querymenu(struct gspca_dev *gspca_dev, | 1486 | static int sd_querymenu(struct gspca_dev *gspca_dev, |
| 1513 | struct v4l2_querymenu *menu) | 1487 | struct v4l2_querymenu *menu) |
| 1514 | { | 1488 | { |
diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c index b5797308a39b..1fd41f0d2e95 100644 --- a/drivers/media/video/gspca/ov534_9.c +++ b/drivers/media/video/gspca/ov534_9.c | |||
| @@ -1008,6 +1008,7 @@ static int sccb_check_status(struct gspca_dev *gspca_dev) | |||
| 1008 | int i; | 1008 | int i; |
| 1009 | 1009 | ||
| 1010 | for (i = 0; i < 5; i++) { | 1010 | for (i = 0; i < 5; i++) { |
| 1011 | msleep(10); | ||
| 1011 | data = reg_r(gspca_dev, OV534_REG_STATUS); | 1012 | data = reg_r(gspca_dev, OV534_REG_STATUS); |
| 1012 | 1013 | ||
| 1013 | switch (data) { | 1014 | switch (data) { |
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index 2cb7d95f7be7..115da169f32a 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c | |||
| @@ -418,7 +418,7 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
| 418 | struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; | 418 | struct v4l2_ctrl_handler *hdl = &gspca_dev->ctrl_handler; |
| 419 | 419 | ||
| 420 | gspca_dev->vdev.ctrl_handler = hdl; | 420 | gspca_dev->vdev.ctrl_handler = hdl; |
| 421 | v4l2_ctrl_handler_init(hdl, 4); | 421 | v4l2_ctrl_handler_init(hdl, 5); |
| 422 | 422 | ||
| 423 | sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 423 | sd->contrast = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 424 | V4L2_CID_CONTRAST, 0, 15, 1, 7); | 424 | V4L2_CID_CONTRAST, 0, 15, 1, 7); |
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c index ad098202d7f0..b9c6f17eabb2 100644 --- a/drivers/media/video/gspca/sn9c20x.c +++ b/drivers/media/video/gspca/sn9c20x.c | |||
| @@ -1761,7 +1761,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
| 1761 | V4L2_CID_SATURATION, 0, 255, 1, 127); | 1761 | V4L2_CID_SATURATION, 0, 255, 1, 127); |
| 1762 | sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1762 | sd->hue = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 1763 | V4L2_CID_HUE, -180, 180, 1, 0); | 1763 | V4L2_CID_HUE, -180, 180, 1, 0); |
| 1764 | v4l2_ctrl_cluster(4, &sd->brightness); | ||
| 1765 | 1764 | ||
| 1766 | sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1765 | sd->gamma = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 1767 | V4L2_CID_GAMMA, 0, 255, 1, 0x10); | 1766 | V4L2_CID_GAMMA, 0, 255, 1, 0x10); |
| @@ -1770,7 +1769,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
| 1770 | V4L2_CID_BLUE_BALANCE, 0, 127, 1, 0x28); | 1769 | V4L2_CID_BLUE_BALANCE, 0, 127, 1, 0x28); |
| 1771 | sd->red = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1770 | sd->red = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 1772 | V4L2_CID_RED_BALANCE, 0, 127, 1, 0x28); | 1771 | V4L2_CID_RED_BALANCE, 0, 127, 1, 0x28); |
| 1773 | v4l2_ctrl_cluster(2, &sd->blue); | ||
| 1774 | 1772 | ||
| 1775 | if (sd->sensor != SENSOR_OV9655 && sd->sensor != SENSOR_SOI968 && | 1773 | if (sd->sensor != SENSOR_OV9655 && sd->sensor != SENSOR_SOI968 && |
| 1776 | sd->sensor != SENSOR_OV7670 && sd->sensor != SENSOR_MT9M001 && | 1774 | sd->sensor != SENSOR_OV7670 && sd->sensor != SENSOR_MT9M001 && |
| @@ -1779,7 +1777,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
| 1779 | V4L2_CID_HFLIP, 0, 1, 1, 0); | 1777 | V4L2_CID_HFLIP, 0, 1, 1, 0); |
| 1780 | sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1778 | sd->vflip = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 1781 | V4L2_CID_VFLIP, 0, 1, 1, 0); | 1779 | V4L2_CID_VFLIP, 0, 1, 1, 0); |
| 1782 | v4l2_ctrl_cluster(2, &sd->hflip); | ||
| 1783 | } | 1780 | } |
| 1784 | 1781 | ||
| 1785 | if (sd->sensor != SENSOR_SOI968 && sd->sensor != SENSOR_MT9VPRB && | 1782 | if (sd->sensor != SENSOR_SOI968 && sd->sensor != SENSOR_MT9VPRB && |
| @@ -1794,6 +1791,20 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
| 1794 | V4L2_CID_GAIN, 0, 28, 1, 0); | 1791 | V4L2_CID_GAIN, 0, 28, 1, 0); |
| 1795 | sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | 1792 | sd->autogain = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, |
| 1796 | V4L2_CID_AUTOGAIN, 0, 1, 1, 1); | 1793 | V4L2_CID_AUTOGAIN, 0, 1, 1, 1); |
| 1794 | } | ||
| 1795 | |||
| 1796 | sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | ||
| 1797 | V4L2_CID_JPEG_COMPRESSION_QUALITY, 50, 90, 1, 80); | ||
| 1798 | if (hdl->error) { | ||
| 1799 | pr_err("Could not initialize controls\n"); | ||
| 1800 | return hdl->error; | ||
| 1801 | } | ||
| 1802 | |||
| 1803 | v4l2_ctrl_cluster(4, &sd->brightness); | ||
| 1804 | v4l2_ctrl_cluster(2, &sd->blue); | ||
| 1805 | if (sd->hflip) | ||
| 1806 | v4l2_ctrl_cluster(2, &sd->hflip); | ||
| 1807 | if (sd->autogain) { | ||
| 1797 | if (sd->sensor == SENSOR_SOI968) | 1808 | if (sd->sensor == SENSOR_SOI968) |
| 1798 | /* this sensor doesn't have the exposure control and | 1809 | /* this sensor doesn't have the exposure control and |
| 1799 | autogain is clustered with gain instead. This works | 1810 | autogain is clustered with gain instead. This works |
| @@ -1803,13 +1814,6 @@ static int sd_init_controls(struct gspca_dev *gspca_dev) | |||
| 1803 | /* Otherwise autogain is clustered with exposure. */ | 1814 | /* Otherwise autogain is clustered with exposure. */ |
| 1804 | v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); | 1815 | v4l2_ctrl_auto_cluster(2, &sd->autogain, 0, false); |
| 1805 | } | 1816 | } |
| 1806 | |||
| 1807 | sd->jpegqual = v4l2_ctrl_new_std(hdl, &sd_ctrl_ops, | ||
| 1808 | V4L2_CID_JPEG_COMPRESSION_QUALITY, 50, 90, 1, 80); | ||
| 1809 | if (hdl->error) { | ||
| 1810 | pr_err("Could not initialize controls\n"); | ||
| 1811 | return hdl->error; | ||
| 1812 | } | ||
| 1813 | return 0; | 1817 | return 0; |
| 1814 | } | 1818 | } |
| 1815 | 1819 | ||
| @@ -2066,10 +2070,13 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
| 2066 | set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); | 2070 | set_gamma(gspca_dev, v4l2_ctrl_g_ctrl(sd->gamma)); |
| 2067 | set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), | 2071 | set_redblue(gspca_dev, v4l2_ctrl_g_ctrl(sd->blue), |
| 2068 | v4l2_ctrl_g_ctrl(sd->red)); | 2072 | v4l2_ctrl_g_ctrl(sd->red)); |
| 2069 | set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); | 2073 | if (sd->gain) |
| 2070 | set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); | 2074 | set_gain(gspca_dev, v4l2_ctrl_g_ctrl(sd->gain)); |
| 2071 | set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), | 2075 | if (sd->exposure) |
| 2072 | v4l2_ctrl_g_ctrl(sd->vflip)); | 2076 | set_exposure(gspca_dev, v4l2_ctrl_g_ctrl(sd->exposure)); |
| 2077 | if (sd->hflip) | ||
| 2078 | set_hvflip(gspca_dev, v4l2_ctrl_g_ctrl(sd->hflip), | ||
| 2079 | v4l2_ctrl_g_ctrl(sd->vflip)); | ||
| 2073 | 2080 | ||
| 2074 | reg_w1(gspca_dev, 0x1007, 0x20); | 2081 | reg_w1(gspca_dev, 0x1007, 0x20); |
| 2075 | reg_w1(gspca_dev, 0x1061, 0x03); | 2082 | reg_w1(gspca_dev, 0x1061, 0x03); |
| @@ -2172,7 +2179,7 @@ static void sd_dqcallback(struct gspca_dev *gspca_dev) | |||
| 2172 | struct sd *sd = (struct sd *) gspca_dev; | 2179 | struct sd *sd = (struct sd *) gspca_dev; |
| 2173 | int avg_lum; | 2180 | int avg_lum; |
| 2174 | 2181 | ||
| 2175 | if (!v4l2_ctrl_g_ctrl(sd->autogain)) | 2182 | if (sd->autogain == NULL || !v4l2_ctrl_g_ctrl(sd->autogain)) |
| 2176 | return; | 2183 | return; |
| 2177 | 2184 | ||
| 2178 | avg_lum = atomic_read(&sd->avg_lum); | 2185 | avg_lum = atomic_read(&sd->avg_lum); |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 4d1696d1a7f4..f38faa9b37c3 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
| @@ -3120,7 +3120,7 @@ static const struct sd_desc sd_desc = { | |||
| 3120 | | (SENSOR_ ## sensor << 8) \ | 3120 | | (SENSOR_ ## sensor << 8) \ |
| 3121 | | (flags) | 3121 | | (flags) |
| 3122 | static const struct usb_device_id device_table[] = { | 3122 | static const struct usb_device_id device_table[] = { |
| 3123 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, | 3123 | {USB_DEVICE(0x0458, 0x7025), BSF(SN9C120, MI0360B, F_PDN_INV)}, |
| 3124 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, | 3124 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, |
| 3125 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)}, | 3125 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)}, |
| 3126 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)}, | 3126 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)}, |
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c index 057929e165ab..5462ce2f60ea 100644 --- a/drivers/media/video/ivtv/ivtv-driver.c +++ b/drivers/media/video/ivtv/ivtv-driver.c | |||
| @@ -866,10 +866,10 @@ static int ivtv_setup_pci(struct ivtv *itv, struct pci_dev *pdev, | |||
| 866 | pci_write_config_dword(pdev, 0x40, 0xffff); | 866 | pci_write_config_dword(pdev, 0x40, 0xffff); |
| 867 | 867 | ||
| 868 | IVTV_DEBUG_INFO("%d (rev %d) at %02x:%02x.%x, " | 868 | IVTV_DEBUG_INFO("%d (rev %d) at %02x:%02x.%x, " |
| 869 | "irq: %d, latency: %d, memory: 0x%lx\n", | 869 | "irq: %d, latency: %d, memory: 0x%llx\n", |
| 870 | pdev->device, pdev->revision, pdev->bus->number, | 870 | pdev->device, pdev->revision, pdev->bus->number, |
| 871 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), | 871 | PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), |
| 872 | pdev->irq, pci_latency, (unsigned long)itv->base_addr); | 872 | pdev->irq, pci_latency, (u64)itv->base_addr); |
| 873 | 873 | ||
| 874 | return 0; | 874 | return 0; |
| 875 | } | 875 | } |
| @@ -1007,7 +1007,7 @@ static int __devinit ivtv_probe(struct pci_dev *pdev, | |||
| 1007 | itv->cxhdl.priv = itv; | 1007 | itv->cxhdl.priv = itv; |
| 1008 | itv->cxhdl.func = ivtv_api_func; | 1008 | itv->cxhdl.func = ivtv_api_func; |
| 1009 | 1009 | ||
| 1010 | IVTV_DEBUG_INFO("base addr: 0x%08x\n", itv->base_addr); | 1010 | IVTV_DEBUG_INFO("base addr: 0x%llx\n", (u64)itv->base_addr); |
| 1011 | 1011 | ||
| 1012 | /* PCI Device Setup */ | 1012 | /* PCI Device Setup */ |
| 1013 | retval = ivtv_setup_pci(itv, pdev, pci_id); | 1013 | retval = ivtv_setup_pci(itv, pdev, pci_id); |
| @@ -1017,8 +1017,8 @@ static int __devinit ivtv_probe(struct pci_dev *pdev, | |||
| 1017 | goto free_mem; | 1017 | goto free_mem; |
| 1018 | 1018 | ||
| 1019 | /* map io memory */ | 1019 | /* map io memory */ |
| 1020 | IVTV_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", | 1020 | IVTV_DEBUG_INFO("attempting ioremap at 0x%llx len 0x%08x\n", |
| 1021 | itv->base_addr + IVTV_ENCODER_OFFSET, IVTV_ENCODER_SIZE); | 1021 | (u64)itv->base_addr + IVTV_ENCODER_OFFSET, IVTV_ENCODER_SIZE); |
| 1022 | itv->enc_mem = ioremap_nocache(itv->base_addr + IVTV_ENCODER_OFFSET, | 1022 | itv->enc_mem = ioremap_nocache(itv->base_addr + IVTV_ENCODER_OFFSET, |
| 1023 | IVTV_ENCODER_SIZE); | 1023 | IVTV_ENCODER_SIZE); |
| 1024 | if (!itv->enc_mem) { | 1024 | if (!itv->enc_mem) { |
| @@ -1034,8 +1034,8 @@ static int __devinit ivtv_probe(struct pci_dev *pdev, | |||
| 1034 | } | 1034 | } |
| 1035 | 1035 | ||
| 1036 | if (itv->has_cx23415) { | 1036 | if (itv->has_cx23415) { |
| 1037 | IVTV_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", | 1037 | IVTV_DEBUG_INFO("attempting ioremap at 0x%llx len 0x%08x\n", |
| 1038 | itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); | 1038 | (u64)itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); |
| 1039 | itv->dec_mem = ioremap_nocache(itv->base_addr + IVTV_DECODER_OFFSET, | 1039 | itv->dec_mem = ioremap_nocache(itv->base_addr + IVTV_DECODER_OFFSET, |
| 1040 | IVTV_DECODER_SIZE); | 1040 | IVTV_DECODER_SIZE); |
| 1041 | if (!itv->dec_mem) { | 1041 | if (!itv->dec_mem) { |
| @@ -1056,8 +1056,8 @@ static int __devinit ivtv_probe(struct pci_dev *pdev, | |||
| 1056 | } | 1056 | } |
| 1057 | 1057 | ||
| 1058 | /* map registers memory */ | 1058 | /* map registers memory */ |
| 1059 | IVTV_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", | 1059 | IVTV_DEBUG_INFO("attempting ioremap at 0x%llx len 0x%08x\n", |
| 1060 | itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); | 1060 | (u64)itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); |
| 1061 | itv->reg_mem = | 1061 | itv->reg_mem = |
| 1062 | ioremap_nocache(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); | 1062 | ioremap_nocache(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); |
| 1063 | if (!itv->reg_mem) { | 1063 | if (!itv->reg_mem) { |
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h index 2e220028aad2..a7e00f8938f8 100644 --- a/drivers/media/video/ivtv/ivtv-driver.h +++ b/drivers/media/video/ivtv/ivtv-driver.h | |||
| @@ -622,7 +622,7 @@ struct ivtv { | |||
| 622 | struct v4l2_subdev *sd_video; /* controlling video decoder subdev */ | 622 | struct v4l2_subdev *sd_video; /* controlling video decoder subdev */ |
| 623 | struct v4l2_subdev *sd_audio; /* controlling audio subdev */ | 623 | struct v4l2_subdev *sd_audio; /* controlling audio subdev */ |
| 624 | struct v4l2_subdev *sd_muxer; /* controlling audio muxer subdev */ | 624 | struct v4l2_subdev *sd_muxer; /* controlling audio muxer subdev */ |
| 625 | u32 base_addr; /* PCI resource base address */ | 625 | resource_size_t base_addr; /* PCI resource base address */ |
| 626 | volatile void __iomem *enc_mem; /* pointer to mapped encoder memory */ | 626 | volatile void __iomem *enc_mem; /* pointer to mapped encoder memory */ |
| 627 | volatile void __iomem *dec_mem; /* pointer to mapped decoder memory */ | 627 | volatile void __iomem *dec_mem; /* pointer to mapped decoder memory */ |
| 628 | volatile void __iomem *reg_mem; /* pointer to mapped registers */ | 628 | volatile void __iomem *reg_mem; /* pointer to mapped registers */ |
diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index d2dec585e61b..3945556f5733 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c | |||
| @@ -110,22 +110,6 @@ enum { | |||
| 110 | V4L2_M2M_DST = 1, | 110 | V4L2_M2M_DST = 1, |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | /* Source and destination queue data */ | ||
| 114 | static struct m2mtest_q_data q_data[2]; | ||
| 115 | |||
| 116 | static struct m2mtest_q_data *get_q_data(enum v4l2_buf_type type) | ||
| 117 | { | ||
| 118 | switch (type) { | ||
| 119 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: | ||
| 120 | return &q_data[V4L2_M2M_SRC]; | ||
| 121 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | ||
| 122 | return &q_data[V4L2_M2M_DST]; | ||
| 123 | default: | ||
| 124 | BUG(); | ||
| 125 | } | ||
| 126 | return NULL; | ||
| 127 | } | ||
| 128 | |||
| 129 | #define V4L2_CID_TRANS_TIME_MSEC V4L2_CID_PRIVATE_BASE | 113 | #define V4L2_CID_TRANS_TIME_MSEC V4L2_CID_PRIVATE_BASE |
| 130 | #define V4L2_CID_TRANS_NUM_BUFS (V4L2_CID_PRIVATE_BASE + 1) | 114 | #define V4L2_CID_TRANS_NUM_BUFS (V4L2_CID_PRIVATE_BASE + 1) |
| 131 | 115 | ||
| @@ -198,8 +182,26 @@ struct m2mtest_ctx { | |||
| 198 | int aborting; | 182 | int aborting; |
| 199 | 183 | ||
| 200 | struct v4l2_m2m_ctx *m2m_ctx; | 184 | struct v4l2_m2m_ctx *m2m_ctx; |
| 185 | |||
| 186 | /* Source and destination queue data */ | ||
| 187 | struct m2mtest_q_data q_data[2]; | ||
| 201 | }; | 188 | }; |
| 202 | 189 | ||
| 190 | static struct m2mtest_q_data *get_q_data(struct m2mtest_ctx *ctx, | ||
| 191 | enum v4l2_buf_type type) | ||
| 192 | { | ||
| 193 | switch (type) { | ||
| 194 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: | ||
| 195 | return &ctx->q_data[V4L2_M2M_SRC]; | ||
| 196 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | ||
| 197 | return &ctx->q_data[V4L2_M2M_DST]; | ||
| 198 | default: | ||
| 199 | BUG(); | ||
| 200 | } | ||
| 201 | return NULL; | ||
| 202 | } | ||
| 203 | |||
| 204 | |||
| 203 | static struct v4l2_queryctrl *get_ctrl(int id) | 205 | static struct v4l2_queryctrl *get_ctrl(int id) |
| 204 | { | 206 | { |
| 205 | int i; | 207 | int i; |
| @@ -223,7 +225,7 @@ static int device_process(struct m2mtest_ctx *ctx, | |||
| 223 | int tile_w, bytes_left; | 225 | int tile_w, bytes_left; |
| 224 | int width, height, bytesperline; | 226 | int width, height, bytesperline; |
| 225 | 227 | ||
| 226 | q_data = get_q_data(V4L2_BUF_TYPE_VIDEO_OUTPUT); | 228 | q_data = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); |
| 227 | 229 | ||
| 228 | width = q_data->width; | 230 | width = q_data->width; |
| 229 | height = q_data->height; | 231 | height = q_data->height; |
| @@ -436,7 +438,7 @@ static int vidioc_g_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f) | |||
| 436 | if (!vq) | 438 | if (!vq) |
| 437 | return -EINVAL; | 439 | return -EINVAL; |
| 438 | 440 | ||
| 439 | q_data = get_q_data(f->type); | 441 | q_data = get_q_data(ctx, f->type); |
| 440 | 442 | ||
| 441 | f->fmt.pix.width = q_data->width; | 443 | f->fmt.pix.width = q_data->width; |
| 442 | f->fmt.pix.height = q_data->height; | 444 | f->fmt.pix.height = q_data->height; |
| @@ -535,7 +537,7 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f) | |||
| 535 | if (!vq) | 537 | if (!vq) |
| 536 | return -EINVAL; | 538 | return -EINVAL; |
| 537 | 539 | ||
| 538 | q_data = get_q_data(f->type); | 540 | q_data = get_q_data(ctx, f->type); |
| 539 | if (!q_data) | 541 | if (!q_data) |
| 540 | return -EINVAL; | 542 | return -EINVAL; |
| 541 | 543 | ||
| @@ -747,7 +749,7 @@ static int m2mtest_queue_setup(struct vb2_queue *vq, | |||
| 747 | struct m2mtest_q_data *q_data; | 749 | struct m2mtest_q_data *q_data; |
| 748 | unsigned int size, count = *nbuffers; | 750 | unsigned int size, count = *nbuffers; |
| 749 | 751 | ||
| 750 | q_data = get_q_data(vq->type); | 752 | q_data = get_q_data(ctx, vq->type); |
| 751 | 753 | ||
| 752 | size = q_data->width * q_data->height * q_data->fmt->depth >> 3; | 754 | size = q_data->width * q_data->height * q_data->fmt->depth >> 3; |
| 753 | 755 | ||
| @@ -775,7 +777,7 @@ static int m2mtest_buf_prepare(struct vb2_buffer *vb) | |||
| 775 | 777 | ||
| 776 | dprintk(ctx->dev, "type: %d\n", vb->vb2_queue->type); | 778 | dprintk(ctx->dev, "type: %d\n", vb->vb2_queue->type); |
| 777 | 779 | ||
| 778 | q_data = get_q_data(vb->vb2_queue->type); | 780 | q_data = get_q_data(ctx, vb->vb2_queue->type); |
| 779 | 781 | ||
| 780 | if (vb2_plane_size(vb, 0) < q_data->sizeimage) { | 782 | if (vb2_plane_size(vb, 0) < q_data->sizeimage) { |
| 781 | dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n", | 783 | dprintk(ctx->dev, "%s data will not fit into plane (%lu < %lu)\n", |
| @@ -860,6 +862,9 @@ static int m2mtest_open(struct file *file) | |||
| 860 | ctx->transtime = MEM2MEM_DEF_TRANSTIME; | 862 | ctx->transtime = MEM2MEM_DEF_TRANSTIME; |
| 861 | ctx->num_processed = 0; | 863 | ctx->num_processed = 0; |
| 862 | 864 | ||
| 865 | ctx->q_data[V4L2_M2M_SRC].fmt = &formats[0]; | ||
| 866 | ctx->q_data[V4L2_M2M_DST].fmt = &formats[0]; | ||
| 867 | |||
| 863 | ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init); | 868 | ctx->m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init); |
| 864 | 869 | ||
| 865 | if (IS_ERR(ctx->m2m_ctx)) { | 870 | if (IS_ERR(ctx->m2m_ctx)) { |
| @@ -986,9 +991,6 @@ static int m2mtest_probe(struct platform_device *pdev) | |||
| 986 | goto err_m2m; | 991 | goto err_m2m; |
| 987 | } | 992 | } |
| 988 | 993 | ||
| 989 | q_data[V4L2_M2M_SRC].fmt = &formats[0]; | ||
| 990 | q_data[V4L2_M2M_DST].fmt = &formats[0]; | ||
| 991 | |||
| 992 | return 0; | 994 | return 0; |
| 993 | 995 | ||
| 994 | v4l2_m2m_release(dev->m2m_dev); | 996 | v4l2_m2m_release(dev->m2m_dev); |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index ded26b7286fa..637bde8aca28 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
| @@ -83,6 +83,7 @@ | |||
| 83 | #define CSICR1_INV_DATA (1 << 3) | 83 | #define CSICR1_INV_DATA (1 << 3) |
| 84 | #define CSICR1_INV_PCLK (1 << 2) | 84 | #define CSICR1_INV_PCLK (1 << 2) |
| 85 | #define CSICR1_REDGE (1 << 1) | 85 | #define CSICR1_REDGE (1 << 1) |
| 86 | #define CSICR1_FMT_MASK (CSICR1_PACK_DIR | CSICR1_SWAP16_EN) | ||
| 86 | 87 | ||
| 87 | #define SHIFT_STATFF_LEVEL 22 | 88 | #define SHIFT_STATFF_LEVEL 22 |
| 88 | #define SHIFT_RXFF_LEVEL 19 | 89 | #define SHIFT_RXFF_LEVEL 19 |
| @@ -230,6 +231,7 @@ struct mx2_prp_cfg { | |||
| 230 | u32 src_pixel; | 231 | u32 src_pixel; |
| 231 | u32 ch1_pixel; | 232 | u32 ch1_pixel; |
| 232 | u32 irq_flags; | 233 | u32 irq_flags; |
| 234 | u32 csicr1; | ||
| 233 | }; | 235 | }; |
| 234 | 236 | ||
| 235 | /* prp resizing parameters */ | 237 | /* prp resizing parameters */ |
| @@ -330,6 +332,7 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
| 330 | .ch1_pixel = 0x2ca00565, /* RGB565 */ | 332 | .ch1_pixel = 0x2ca00565, /* RGB565 */ |
| 331 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH1WERR | | 333 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH1WERR | |
| 332 | PRP_INTR_CH1FC | PRP_INTR_LBOVF, | 334 | PRP_INTR_CH1FC | PRP_INTR_LBOVF, |
| 335 | .csicr1 = 0, | ||
| 333 | } | 336 | } |
| 334 | }, | 337 | }, |
| 335 | { | 338 | { |
| @@ -343,6 +346,7 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
| 343 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | | 346 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | |
| 344 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | | 347 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | |
| 345 | PRP_INTR_CH2OVF, | 348 | PRP_INTR_CH2OVF, |
| 349 | .csicr1 = CSICR1_PACK_DIR, | ||
| 346 | } | 350 | } |
| 347 | }, | 351 | }, |
| 348 | { | 352 | { |
| @@ -356,6 +360,7 @@ static struct mx2_fmt_cfg mx27_emma_prp_table[] = { | |||
| 356 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | | 360 | .irq_flags = PRP_INTR_RDERR | PRP_INTR_CH2WERR | |
| 357 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | | 361 | PRP_INTR_CH2FC | PRP_INTR_LBOVF | |
| 358 | PRP_INTR_CH2OVF, | 362 | PRP_INTR_CH2OVF, |
| 363 | .csicr1 = CSICR1_SWAP16_EN, | ||
| 359 | } | 364 | } |
| 360 | }, | 365 | }, |
| 361 | }; | 366 | }; |
| @@ -984,7 +989,6 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
| 984 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 989 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
| 985 | struct mx2_camera_dev *pcdev = ici->priv; | 990 | struct mx2_camera_dev *pcdev = ici->priv; |
| 986 | struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; | 991 | struct v4l2_mbus_config cfg = {.type = V4L2_MBUS_PARALLEL,}; |
| 987 | const struct soc_camera_format_xlate *xlate; | ||
| 988 | unsigned long common_flags; | 992 | unsigned long common_flags; |
| 989 | int ret; | 993 | int ret; |
| 990 | int bytesperline; | 994 | int bytesperline; |
| @@ -1029,24 +1033,7 @@ static int mx2_camera_set_bus_param(struct soc_camera_device *icd) | |||
| 1029 | return ret; | 1033 | return ret; |
| 1030 | } | 1034 | } |
| 1031 | 1035 | ||
| 1032 | xlate = soc_camera_xlate_by_fourcc(icd, pixfmt); | 1036 | csicr1 = (csicr1 & ~CSICR1_FMT_MASK) | pcdev->emma_prp->cfg.csicr1; |
| 1033 | if (!xlate) { | ||
| 1034 | dev_warn(icd->parent, "Format %x not found\n", pixfmt); | ||
| 1035 | return -EINVAL; | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | if (xlate->code == V4L2_MBUS_FMT_YUYV8_2X8) { | ||
| 1039 | csicr1 |= CSICR1_PACK_DIR; | ||
| 1040 | csicr1 &= ~CSICR1_SWAP16_EN; | ||
| 1041 | dev_dbg(icd->parent, "already yuyv format, don't convert\n"); | ||
| 1042 | } else if (xlate->code == V4L2_MBUS_FMT_UYVY8_2X8) { | ||
| 1043 | csicr1 &= ~CSICR1_PACK_DIR; | ||
| 1044 | csicr1 |= CSICR1_SWAP16_EN; | ||
| 1045 | dev_dbg(icd->parent, "convert uyvy mbus format into yuyv\n"); | ||
| 1046 | } else { | ||
| 1047 | dev_warn(icd->parent, "mbus format not supported\n"); | ||
| 1048 | return -EINVAL; | ||
| 1049 | } | ||
| 1050 | 1037 | ||
| 1051 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) | 1038 | if (common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) |
| 1052 | csicr1 |= CSICR1_REDGE; | 1039 | csicr1 |= CSICR1_REDGE; |
| @@ -1155,18 +1142,6 @@ static int mx2_camera_get_formats(struct soc_camera_device *icd, | |||
| 1155 | } | 1142 | } |
| 1156 | } | 1143 | } |
| 1157 | 1144 | ||
| 1158 | if (code == V4L2_MBUS_FMT_UYVY8_2X8) { | ||
| 1159 | formats++; | ||
| 1160 | if (xlate) { | ||
| 1161 | xlate->host_fmt = | ||
| 1162 | soc_mbus_get_fmtdesc(V4L2_MBUS_FMT_YUYV8_2X8); | ||
| 1163 | xlate->code = code; | ||
| 1164 | dev_dbg(dev, "Providing host format %s for sensor code %d\n", | ||
| 1165 | xlate->host_fmt->name, code); | ||
| 1166 | xlate++; | ||
| 1167 | } | ||
| 1168 | } | ||
| 1169 | |||
| 1170 | /* Generic pass-trough */ | 1145 | /* Generic pass-trough */ |
| 1171 | formats++; | 1146 | formats++; |
| 1172 | if (xlate) { | 1147 | if (xlate) { |
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c index 8a4935ecc655..dd91da26f1b0 100644 --- a/drivers/media/video/omap3isp/isppreview.c +++ b/drivers/media/video/omap3isp/isppreview.c | |||
| @@ -888,12 +888,12 @@ static const struct preview_update update_attrs[] = { | |||
| 888 | preview_config_contrast, | 888 | preview_config_contrast, |
| 889 | NULL, | 889 | NULL, |
| 890 | offsetof(struct prev_params, contrast), | 890 | offsetof(struct prev_params, contrast), |
| 891 | 0, true, | 891 | 0, 0, true, |
| 892 | }, /* OMAP3ISP_PREV_BRIGHTNESS */ { | 892 | }, /* OMAP3ISP_PREV_BRIGHTNESS */ { |
| 893 | preview_config_brightness, | 893 | preview_config_brightness, |
| 894 | NULL, | 894 | NULL, |
| 895 | offsetof(struct prev_params, brightness), | 895 | offsetof(struct prev_params, brightness), |
| 896 | 0, true, | 896 | 0, 0, true, |
| 897 | }, | 897 | }, |
| 898 | }; | 898 | }; |
| 899 | 899 | ||
| @@ -1102,7 +1102,7 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active) | |||
| 1102 | unsigned int elv = prev->crop.top + prev->crop.height - 1; | 1102 | unsigned int elv = prev->crop.top + prev->crop.height - 1; |
| 1103 | u32 features; | 1103 | u32 features; |
| 1104 | 1104 | ||
| 1105 | if (format->code == V4L2_MBUS_FMT_Y10_1X10) { | 1105 | if (format->code != V4L2_MBUS_FMT_Y10_1X10) { |
| 1106 | sph -= 2; | 1106 | sph -= 2; |
| 1107 | eph += 2; | 1107 | eph += 2; |
| 1108 | slv -= 2; | 1108 | slv -= 2; |
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index af2d9086d7e8..b4c679b3fb0f 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
| @@ -26,9 +26,11 @@ | |||
| 26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
| 27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
| 29 | #include <linux/slab.h> | ||
| 29 | #include <linux/ioport.h> | 30 | #include <linux/ioport.h> |
| 30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
| 31 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
| 33 | #include <linux/slab.h> | ||
| 32 | #include <linux/uaccess.h> | 34 | #include <linux/uaccess.h> |
| 33 | #include <linux/isa.h> | 35 | #include <linux/isa.h> |
| 34 | #include <asm/io.h> | 36 | #include <asm/io.h> |
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 354574591908..725812aa0c30 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
| @@ -350,7 +350,8 @@ static int queue_setup(struct vb2_queue *vq, const struct v4l2_format *pfmt, | |||
| 350 | if (pixm) | 350 | if (pixm) |
| 351 | sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); | 351 | sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); |
| 352 | else | 352 | else |
| 353 | sizes[i] = size; | 353 | sizes[i] = max_t(u32, size, frame->payload[i]); |
| 354 | |||
| 354 | allocators[i] = ctx->fimc_dev->alloc_ctx; | 355 | allocators[i] = ctx->fimc_dev->alloc_ctx; |
| 355 | } | 356 | } |
| 356 | 357 | ||
| @@ -479,37 +480,39 @@ static int fimc_capture_set_default_format(struct fimc_dev *fimc); | |||
| 479 | static int fimc_capture_open(struct file *file) | 480 | static int fimc_capture_open(struct file *file) |
| 480 | { | 481 | { |
| 481 | struct fimc_dev *fimc = video_drvdata(file); | 482 | struct fimc_dev *fimc = video_drvdata(file); |
| 482 | int ret = v4l2_fh_open(file); | 483 | int ret; |
| 483 | |||
| 484 | if (ret) | ||
| 485 | return ret; | ||
| 486 | 484 | ||
| 487 | dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); | 485 | dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); |
| 488 | 486 | ||
| 489 | /* Return if the corresponding video mem2mem node is already opened. */ | ||
| 490 | if (fimc_m2m_active(fimc)) | 487 | if (fimc_m2m_active(fimc)) |
| 491 | return -EBUSY; | 488 | return -EBUSY; |
| 492 | 489 | ||
| 493 | set_bit(ST_CAPT_BUSY, &fimc->state); | 490 | set_bit(ST_CAPT_BUSY, &fimc->state); |
| 494 | pm_runtime_get_sync(&fimc->pdev->dev); | 491 | ret = pm_runtime_get_sync(&fimc->pdev->dev); |
| 492 | if (ret < 0) | ||
| 493 | return ret; | ||
| 495 | 494 | ||
| 496 | if (++fimc->vid_cap.refcnt == 1) { | 495 | ret = v4l2_fh_open(file); |
| 497 | ret = fimc_pipeline_initialize(&fimc->pipeline, | 496 | if (ret) |
| 498 | &fimc->vid_cap.vfd->entity, true); | 497 | return ret; |
| 499 | if (ret < 0) { | ||
| 500 | dev_err(&fimc->pdev->dev, | ||
| 501 | "Video pipeline initialization failed\n"); | ||
| 502 | pm_runtime_put_sync(&fimc->pdev->dev); | ||
| 503 | fimc->vid_cap.refcnt--; | ||
| 504 | v4l2_fh_release(file); | ||
| 505 | clear_bit(ST_CAPT_BUSY, &fimc->state); | ||
| 506 | return ret; | ||
| 507 | } | ||
| 508 | ret = fimc_capture_ctrls_create(fimc); | ||
| 509 | 498 | ||
| 510 | if (!ret && !fimc->vid_cap.user_subdev_api) | 499 | if (++fimc->vid_cap.refcnt != 1) |
| 511 | ret = fimc_capture_set_default_format(fimc); | 500 | return 0; |
| 501 | |||
| 502 | ret = fimc_pipeline_initialize(&fimc->pipeline, | ||
| 503 | &fimc->vid_cap.vfd->entity, true); | ||
| 504 | if (ret < 0) { | ||
| 505 | clear_bit(ST_CAPT_BUSY, &fimc->state); | ||
| 506 | pm_runtime_put_sync(&fimc->pdev->dev); | ||
| 507 | fimc->vid_cap.refcnt--; | ||
| 508 | v4l2_fh_release(file); | ||
| 509 | return ret; | ||
| 512 | } | 510 | } |
| 511 | ret = fimc_capture_ctrls_create(fimc); | ||
| 512 | |||
| 513 | if (!ret && !fimc->vid_cap.user_subdev_api) | ||
| 514 | ret = fimc_capture_set_default_format(fimc); | ||
| 515 | |||
| 513 | return ret; | 516 | return ret; |
| 514 | } | 517 | } |
| 515 | 518 | ||
| @@ -818,9 +821,6 @@ static int fimc_cap_g_fmt_mplane(struct file *file, void *fh, | |||
| 818 | struct fimc_dev *fimc = video_drvdata(file); | 821 | struct fimc_dev *fimc = video_drvdata(file); |
| 819 | struct fimc_ctx *ctx = fimc->vid_cap.ctx; | 822 | struct fimc_ctx *ctx = fimc->vid_cap.ctx; |
| 820 | 823 | ||
| 821 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
| 822 | return -EINVAL; | ||
| 823 | |||
| 824 | return fimc_fill_format(&ctx->d_frame, f); | 824 | return fimc_fill_format(&ctx->d_frame, f); |
| 825 | } | 825 | } |
| 826 | 826 | ||
| @@ -833,9 +833,6 @@ static int fimc_cap_try_fmt_mplane(struct file *file, void *fh, | |||
| 833 | struct v4l2_mbus_framefmt mf; | 833 | struct v4l2_mbus_framefmt mf; |
| 834 | struct fimc_fmt *ffmt = NULL; | 834 | struct fimc_fmt *ffmt = NULL; |
| 835 | 835 | ||
| 836 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
| 837 | return -EINVAL; | ||
| 838 | |||
| 839 | if (pix->pixelformat == V4L2_PIX_FMT_JPEG) { | 836 | if (pix->pixelformat == V4L2_PIX_FMT_JPEG) { |
| 840 | fimc_capture_try_format(ctx, &pix->width, &pix->height, | 837 | fimc_capture_try_format(ctx, &pix->width, &pix->height, |
| 841 | NULL, &pix->pixelformat, | 838 | NULL, &pix->pixelformat, |
| @@ -887,8 +884,6 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) | |||
| 887 | struct fimc_fmt *s_fmt = NULL; | 884 | struct fimc_fmt *s_fmt = NULL; |
| 888 | int ret, i; | 885 | int ret, i; |
| 889 | 886 | ||
| 890 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) | ||
| 891 | return -EINVAL; | ||
| 892 | if (vb2_is_busy(&fimc->vid_cap.vbq)) | 887 | if (vb2_is_busy(&fimc->vid_cap.vbq)) |
| 893 | return -EBUSY; | 888 | return -EBUSY; |
| 894 | 889 | ||
| @@ -924,10 +919,10 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format *f) | |||
| 924 | pix->width = mf->width; | 919 | pix->width = mf->width; |
| 925 | pix->height = mf->height; | 920 | pix->height = mf->height; |
| 926 | } | 921 | } |
| 922 | |||
| 927 | fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); | 923 | fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); |
| 928 | for (i = 0; i < ff->fmt->colplanes; i++) | 924 | for (i = 0; i < ff->fmt->colplanes; i++) |
| 929 | ff->payload[i] = | 925 | ff->payload[i] = pix->plane_fmt[i].sizeimage; |
| 930 | (pix->width * pix->height * ff->fmt->depth[i]) / 8; | ||
| 931 | 926 | ||
| 932 | set_frame_bounds(ff, pix->width, pix->height); | 927 | set_frame_bounds(ff, pix->width, pix->height); |
| 933 | /* Reset the composition rectangle if not yet configured */ | 928 | /* Reset the composition rectangle if not yet configured */ |
| @@ -1045,18 +1040,22 @@ static int fimc_cap_streamon(struct file *file, void *priv, | |||
| 1045 | { | 1040 | { |
| 1046 | struct fimc_dev *fimc = video_drvdata(file); | 1041 | struct fimc_dev *fimc = video_drvdata(file); |
| 1047 | struct fimc_pipeline *p = &fimc->pipeline; | 1042 | struct fimc_pipeline *p = &fimc->pipeline; |
| 1043 | struct v4l2_subdev *sd = p->subdevs[IDX_SENSOR]; | ||
| 1048 | int ret; | 1044 | int ret; |
| 1049 | 1045 | ||
| 1050 | if (fimc_capture_active(fimc)) | 1046 | if (fimc_capture_active(fimc)) |
| 1051 | return -EBUSY; | 1047 | return -EBUSY; |
| 1052 | 1048 | ||
| 1053 | media_entity_pipeline_start(&p->subdevs[IDX_SENSOR]->entity, | 1049 | ret = media_entity_pipeline_start(&sd->entity, p->m_pipeline); |
| 1054 | p->m_pipeline); | 1050 | if (ret < 0) |
| 1051 | return ret; | ||
| 1055 | 1052 | ||
| 1056 | if (fimc->vid_cap.user_subdev_api) { | 1053 | if (fimc->vid_cap.user_subdev_api) { |
| 1057 | ret = fimc_pipeline_validate(fimc); | 1054 | ret = fimc_pipeline_validate(fimc); |
| 1058 | if (ret) | 1055 | if (ret < 0) { |
| 1056 | media_entity_pipeline_stop(&sd->entity); | ||
| 1059 | return ret; | 1057 | return ret; |
| 1058 | } | ||
| 1060 | } | 1059 | } |
| 1061 | return vb2_streamon(&fimc->vid_cap.vbq, type); | 1060 | return vb2_streamon(&fimc->vid_cap.vbq, type); |
| 1062 | } | 1061 | } |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index fedcd561ba27..a4646ca1d56f 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
| @@ -153,7 +153,7 @@ static struct fimc_fmt fimc_formats[] = { | |||
| 153 | .colplanes = 2, | 153 | .colplanes = 2, |
| 154 | .flags = FMT_FLAGS_M2M, | 154 | .flags = FMT_FLAGS_M2M, |
| 155 | }, { | 155 | }, { |
| 156 | .name = "YUV 4:2:0 non-contiguous 2-planar, Y/CbCr", | 156 | .name = "YUV 4:2:0 non-contig. 2p, Y/CbCr", |
| 157 | .fourcc = V4L2_PIX_FMT_NV12M, | 157 | .fourcc = V4L2_PIX_FMT_NV12M, |
| 158 | .color = FIMC_FMT_YCBCR420, | 158 | .color = FIMC_FMT_YCBCR420, |
| 159 | .depth = { 8, 4 }, | 159 | .depth = { 8, 4 }, |
| @@ -161,7 +161,7 @@ static struct fimc_fmt fimc_formats[] = { | |||
| 161 | .colplanes = 2, | 161 | .colplanes = 2, |
| 162 | .flags = FMT_FLAGS_M2M, | 162 | .flags = FMT_FLAGS_M2M, |
| 163 | }, { | 163 | }, { |
| 164 | .name = "YUV 4:2:0 non-contiguous 3-planar, Y/Cb/Cr", | 164 | .name = "YUV 4:2:0 non-contig. 3p, Y/Cb/Cr", |
| 165 | .fourcc = V4L2_PIX_FMT_YUV420M, | 165 | .fourcc = V4L2_PIX_FMT_YUV420M, |
| 166 | .color = FIMC_FMT_YCBCR420, | 166 | .color = FIMC_FMT_YCBCR420, |
| 167 | .depth = { 8, 2, 2 }, | 167 | .depth = { 8, 2, 2 }, |
| @@ -169,7 +169,7 @@ static struct fimc_fmt fimc_formats[] = { | |||
| 169 | .colplanes = 3, | 169 | .colplanes = 3, |
| 170 | .flags = FMT_FLAGS_M2M, | 170 | .flags = FMT_FLAGS_M2M, |
| 171 | }, { | 171 | }, { |
| 172 | .name = "YUV 4:2:0 non-contiguous 2-planar, Y/CbCr, tiled", | 172 | .name = "YUV 4:2:0 non-contig. 2p, tiled", |
| 173 | .fourcc = V4L2_PIX_FMT_NV12MT, | 173 | .fourcc = V4L2_PIX_FMT_NV12MT, |
| 174 | .color = FIMC_FMT_YCBCR420, | 174 | .color = FIMC_FMT_YCBCR420, |
| 175 | .depth = { 8, 4 }, | 175 | .depth = { 8, 4 }, |
| @@ -615,7 +615,7 @@ int fimc_ctrls_create(struct fimc_ctx *ctx) | |||
| 615 | ctx->effect.type = FIMC_REG_CIIMGEFF_FIN_BYPASS; | 615 | ctx->effect.type = FIMC_REG_CIIMGEFF_FIN_BYPASS; |
| 616 | 616 | ||
| 617 | if (!handler->error) { | 617 | if (!handler->error) { |
| 618 | v4l2_ctrl_cluster(3, &ctrls->colorfx); | 618 | v4l2_ctrl_cluster(2, &ctrls->colorfx); |
| 619 | ctrls->ready = true; | 619 | ctrls->ready = true; |
| 620 | } | 620 | } |
| 621 | 621 | ||
| @@ -641,7 +641,7 @@ void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active) | |||
| 641 | if (!ctrls->ready) | 641 | if (!ctrls->ready) |
| 642 | return; | 642 | return; |
| 643 | 643 | ||
| 644 | mutex_lock(&ctrls->handler.lock); | 644 | mutex_lock(ctrls->handler.lock); |
| 645 | v4l2_ctrl_activate(ctrls->rotate, active); | 645 | v4l2_ctrl_activate(ctrls->rotate, active); |
| 646 | v4l2_ctrl_activate(ctrls->hflip, active); | 646 | v4l2_ctrl_activate(ctrls->hflip, active); |
| 647 | v4l2_ctrl_activate(ctrls->vflip, active); | 647 | v4l2_ctrl_activate(ctrls->vflip, active); |
| @@ -660,7 +660,7 @@ void fimc_ctrls_activate(struct fimc_ctx *ctx, bool active) | |||
| 660 | ctx->hflip = 0; | 660 | ctx->hflip = 0; |
| 661 | ctx->vflip = 0; | 661 | ctx->vflip = 0; |
| 662 | } | 662 | } |
| 663 | mutex_unlock(&ctrls->handler.lock); | 663 | mutex_unlock(ctrls->handler.lock); |
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | /* Update maximum value of the alpha color control */ | 666 | /* Update maximum value of the alpha color control */ |
| @@ -741,8 +741,8 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, | |||
| 741 | pix->width = width; | 741 | pix->width = width; |
| 742 | 742 | ||
| 743 | for (i = 0; i < pix->num_planes; ++i) { | 743 | for (i = 0; i < pix->num_planes; ++i) { |
| 744 | u32 bpl = pix->plane_fmt[i].bytesperline; | 744 | struct v4l2_plane_pix_format *plane_fmt = &pix->plane_fmt[i]; |
| 745 | u32 *sizeimage = &pix->plane_fmt[i].sizeimage; | 745 | u32 bpl = plane_fmt->bytesperline; |
| 746 | 746 | ||
| 747 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) | 747 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) |
| 748 | bpl = pix->width; /* Planar */ | 748 | bpl = pix->width; /* Planar */ |
| @@ -754,8 +754,9 @@ void fimc_adjust_mplane_format(struct fimc_fmt *fmt, u32 width, u32 height, | |||
| 754 | if (i == 0) /* Same bytesperline for each plane. */ | 754 | if (i == 0) /* Same bytesperline for each plane. */ |
| 755 | bytesperline = bpl; | 755 | bytesperline = bpl; |
| 756 | 756 | ||
| 757 | pix->plane_fmt[i].bytesperline = bytesperline; | 757 | plane_fmt->bytesperline = bytesperline; |
| 758 | *sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; | 758 | plane_fmt->sizeimage = max((pix->width * pix->height * |
| 759 | fmt->depth[i]) / 8, plane_fmt->sizeimage); | ||
| 759 | } | 760 | } |
| 760 | } | 761 | } |
| 761 | 762 | ||
diff --git a/drivers/media/video/s5p-fimc/fimc-lite.c b/drivers/media/video/s5p-fimc/fimc-lite.c index 400d701aef04..74ff310db30c 100644 --- a/drivers/media/video/s5p-fimc/fimc-lite.c +++ b/drivers/media/video/s5p-fimc/fimc-lite.c | |||
| @@ -451,34 +451,44 @@ static void fimc_lite_clear_event_counters(struct fimc_lite *fimc) | |||
| 451 | static int fimc_lite_open(struct file *file) | 451 | static int fimc_lite_open(struct file *file) |
| 452 | { | 452 | { |
| 453 | struct fimc_lite *fimc = video_drvdata(file); | 453 | struct fimc_lite *fimc = video_drvdata(file); |
| 454 | int ret = v4l2_fh_open(file); | 454 | int ret; |
| 455 | 455 | ||
| 456 | if (ret) | 456 | if (mutex_lock_interruptible(&fimc->lock)) |
| 457 | return ret; | 457 | return -ERESTARTSYS; |
| 458 | 458 | ||
| 459 | set_bit(ST_FLITE_IN_USE, &fimc->state); | 459 | set_bit(ST_FLITE_IN_USE, &fimc->state); |
| 460 | pm_runtime_get_sync(&fimc->pdev->dev); | 460 | ret = pm_runtime_get_sync(&fimc->pdev->dev); |
| 461 | if (ret < 0) | ||
| 462 | goto done; | ||
| 461 | 463 | ||
| 462 | if (++fimc->ref_count != 1 || fimc->out_path != FIMC_IO_DMA) | 464 | ret = v4l2_fh_open(file); |
| 463 | return ret; | 465 | if (ret < 0) |
| 466 | goto done; | ||
| 464 | 467 | ||
| 465 | ret = fimc_pipeline_initialize(&fimc->pipeline, &fimc->vfd->entity, | 468 | if (++fimc->ref_count == 1 && fimc->out_path == FIMC_IO_DMA) { |
| 466 | true); | 469 | ret = fimc_pipeline_initialize(&fimc->pipeline, |
| 467 | if (ret < 0) { | 470 | &fimc->vfd->entity, true); |
| 468 | v4l2_err(fimc->vfd, "Video pipeline initialization failed\n"); | 471 | if (ret < 0) { |
| 469 | pm_runtime_put_sync(&fimc->pdev->dev); | 472 | pm_runtime_put_sync(&fimc->pdev->dev); |
| 470 | fimc->ref_count--; | 473 | fimc->ref_count--; |
| 471 | v4l2_fh_release(file); | 474 | v4l2_fh_release(file); |
| 472 | clear_bit(ST_FLITE_IN_USE, &fimc->state); | 475 | clear_bit(ST_FLITE_IN_USE, &fimc->state); |
| 473 | } | 476 | } |
| 474 | 477 | ||
| 475 | fimc_lite_clear_event_counters(fimc); | 478 | fimc_lite_clear_event_counters(fimc); |
| 479 | } | ||
| 480 | done: | ||
| 481 | mutex_unlock(&fimc->lock); | ||
| 476 | return ret; | 482 | return ret; |
| 477 | } | 483 | } |
| 478 | 484 | ||
| 479 | static int fimc_lite_close(struct file *file) | 485 | static int fimc_lite_close(struct file *file) |
| 480 | { | 486 | { |
| 481 | struct fimc_lite *fimc = video_drvdata(file); | 487 | struct fimc_lite *fimc = video_drvdata(file); |
| 488 | int ret; | ||
| 489 | |||
| 490 | if (mutex_lock_interruptible(&fimc->lock)) | ||
| 491 | return -ERESTARTSYS; | ||
| 482 | 492 | ||
| 483 | if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { | 493 | if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { |
| 484 | clear_bit(ST_FLITE_IN_USE, &fimc->state); | 494 | clear_bit(ST_FLITE_IN_USE, &fimc->state); |
| @@ -492,20 +502,39 @@ static int fimc_lite_close(struct file *file) | |||
| 492 | if (fimc->ref_count == 0) | 502 | if (fimc->ref_count == 0) |
| 493 | vb2_queue_release(&fimc->vb_queue); | 503 | vb2_queue_release(&fimc->vb_queue); |
| 494 | 504 | ||
| 495 | return v4l2_fh_release(file); | 505 | ret = v4l2_fh_release(file); |
| 506 | |||
| 507 | mutex_unlock(&fimc->lock); | ||
| 508 | return ret; | ||
| 496 | } | 509 | } |
| 497 | 510 | ||
| 498 | static unsigned int fimc_lite_poll(struct file *file, | 511 | static unsigned int fimc_lite_poll(struct file *file, |
| 499 | struct poll_table_struct *wait) | 512 | struct poll_table_struct *wait) |
| 500 | { | 513 | { |
| 501 | struct fimc_lite *fimc = video_drvdata(file); | 514 | struct fimc_lite *fimc = video_drvdata(file); |
| 502 | return vb2_poll(&fimc->vb_queue, file, wait); | 515 | int ret; |
| 516 | |||
| 517 | if (mutex_lock_interruptible(&fimc->lock)) | ||
| 518 | return POLL_ERR; | ||
| 519 | |||
| 520 | ret = vb2_poll(&fimc->vb_queue, file, wait); | ||
| 521 | mutex_unlock(&fimc->lock); | ||
| 522 | |||
| 523 | return ret; | ||
| 503 | } | 524 | } |
| 504 | 525 | ||
| 505 | static int fimc_lite_mmap(struct file *file, struct vm_area_struct *vma) | 526 | static int fimc_lite_mmap(struct file *file, struct vm_area_struct *vma) |
| 506 | { | 527 | { |
| 507 | struct fimc_lite *fimc = video_drvdata(file); | 528 | struct fimc_lite *fimc = video_drvdata(file); |
| 508 | return vb2_mmap(&fimc->vb_queue, vma); | 529 | int ret; |
| 530 | |||
| 531 | if (mutex_lock_interruptible(&fimc->lock)) | ||
| 532 | return -ERESTARTSYS; | ||
| 533 | |||
| 534 | ret = vb2_mmap(&fimc->vb_queue, vma); | ||
| 535 | mutex_unlock(&fimc->lock); | ||
| 536 | |||
| 537 | return ret; | ||
| 509 | } | 538 | } |
| 510 | 539 | ||
| 511 | static const struct v4l2_file_operations fimc_lite_fops = { | 540 | static const struct v4l2_file_operations fimc_lite_fops = { |
| @@ -762,7 +791,9 @@ static int fimc_lite_streamon(struct file *file, void *priv, | |||
| 762 | if (fimc_lite_active(fimc)) | 791 | if (fimc_lite_active(fimc)) |
| 763 | return -EBUSY; | 792 | return -EBUSY; |
| 764 | 793 | ||
| 765 | media_entity_pipeline_start(&sensor->entity, p->m_pipeline); | 794 | ret = media_entity_pipeline_start(&sensor->entity, p->m_pipeline); |
| 795 | if (ret < 0) | ||
| 796 | return ret; | ||
| 766 | 797 | ||
| 767 | ret = fimc_pipeline_validate(fimc); | 798 | ret = fimc_pipeline_validate(fimc); |
| 768 | if (ret) { | 799 | if (ret) { |
| @@ -1508,7 +1539,7 @@ static int fimc_lite_suspend(struct device *dev) | |||
| 1508 | return 0; | 1539 | return 0; |
| 1509 | 1540 | ||
| 1510 | ret = fimc_lite_stop_capture(fimc, suspend); | 1541 | ret = fimc_lite_stop_capture(fimc, suspend); |
| 1511 | if (ret) | 1542 | if (ret < 0 || !fimc_lite_active(fimc)) |
| 1512 | return ret; | 1543 | return ret; |
| 1513 | 1544 | ||
| 1514 | return fimc_pipeline_shutdown(&fimc->pipeline); | 1545 | return fimc_pipeline_shutdown(&fimc->pipeline); |
diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.c b/drivers/media/video/s5p-fimc/fimc-mdevice.c index 6753c45631b8..52cef4865423 100644 --- a/drivers/media/video/s5p-fimc/fimc-mdevice.c +++ b/drivers/media/video/s5p-fimc/fimc-mdevice.c | |||
| @@ -193,9 +193,13 @@ int __fimc_pipeline_shutdown(struct fimc_pipeline *p) | |||
| 193 | 193 | ||
| 194 | int fimc_pipeline_shutdown(struct fimc_pipeline *p) | 194 | int fimc_pipeline_shutdown(struct fimc_pipeline *p) |
| 195 | { | 195 | { |
| 196 | struct media_entity *me = &p->subdevs[IDX_SENSOR]->entity; | 196 | struct media_entity *me; |
| 197 | int ret; | 197 | int ret; |
| 198 | 198 | ||
| 199 | if (!p || !p->subdevs[IDX_SENSOR]) | ||
| 200 | return -EINVAL; | ||
| 201 | |||
| 202 | me = &p->subdevs[IDX_SENSOR]->entity; | ||
| 199 | mutex_lock(&me->parent->graph_mutex); | 203 | mutex_lock(&me->parent->graph_mutex); |
| 200 | ret = __fimc_pipeline_shutdown(p); | 204 | ret = __fimc_pipeline_shutdown(p); |
| 201 | mutex_unlock(&me->parent->graph_mutex); | 205 | mutex_unlock(&me->parent->graph_mutex); |
| @@ -498,12 +502,12 @@ static void fimc_md_unregister_entities(struct fimc_md *fmd) | |||
| 498 | * @source: the source entity to create links to all fimc entities from | 502 | * @source: the source entity to create links to all fimc entities from |
| 499 | * @sensor: sensor subdev linked to FIMC[fimc_id] entity, may be null | 503 | * @sensor: sensor subdev linked to FIMC[fimc_id] entity, may be null |
| 500 | * @pad: the source entity pad index | 504 | * @pad: the source entity pad index |
| 501 | * @fimc_id: index of the fimc device for which link should be enabled | 505 | * @link_mask: bitmask of the fimc devices for which link should be enabled |
| 502 | */ | 506 | */ |
| 503 | static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, | 507 | static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, |
| 504 | struct media_entity *source, | 508 | struct media_entity *source, |
| 505 | struct v4l2_subdev *sensor, | 509 | struct v4l2_subdev *sensor, |
| 506 | int pad, int fimc_id) | 510 | int pad, int link_mask) |
| 507 | { | 511 | { |
| 508 | struct fimc_sensor_info *s_info; | 512 | struct fimc_sensor_info *s_info; |
| 509 | struct media_entity *sink; | 513 | struct media_entity *sink; |
| @@ -520,7 +524,7 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, | |||
| 520 | if (!fmd->fimc[i]->variant->has_cam_if) | 524 | if (!fmd->fimc[i]->variant->has_cam_if) |
| 521 | continue; | 525 | continue; |
| 522 | 526 | ||
| 523 | flags = (i == fimc_id) ? MEDIA_LNK_FL_ENABLED : 0; | 527 | flags = ((1 << i) & link_mask) ? MEDIA_LNK_FL_ENABLED : 0; |
| 524 | 528 | ||
| 525 | sink = &fmd->fimc[i]->vid_cap.subdev.entity; | 529 | sink = &fmd->fimc[i]->vid_cap.subdev.entity; |
| 526 | ret = media_entity_create_link(source, pad, sink, | 530 | ret = media_entity_create_link(source, pad, sink, |
| @@ -552,7 +556,10 @@ static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, | |||
| 552 | if (!fmd->fimc_lite[i]) | 556 | if (!fmd->fimc_lite[i]) |
| 553 | continue; | 557 | continue; |
| 554 | 558 | ||
| 555 | flags = (i == fimc_id) ? MEDIA_LNK_FL_ENABLED : 0; | 559 | if (link_mask & (1 << (i + FIMC_MAX_DEVS))) |
| 560 | flags = MEDIA_LNK_FL_ENABLED; | ||
| 561 | else | ||
| 562 | flags = 0; | ||
| 556 | 563 | ||
| 557 | sink = &fmd->fimc_lite[i]->subdev.entity; | 564 | sink = &fmd->fimc_lite[i]->subdev.entity; |
| 558 | ret = media_entity_create_link(source, pad, sink, | 565 | ret = media_entity_create_link(source, pad, sink, |
| @@ -614,9 +621,8 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
| 614 | struct s5p_fimc_isp_info *pdata; | 621 | struct s5p_fimc_isp_info *pdata; |
| 615 | struct fimc_sensor_info *s_info; | 622 | struct fimc_sensor_info *s_info; |
| 616 | struct media_entity *source, *sink; | 623 | struct media_entity *source, *sink; |
| 617 | int i, pad, fimc_id = 0; | 624 | int i, pad, fimc_id = 0, ret = 0; |
| 618 | int ret = 0; | 625 | u32 flags, link_mask = 0; |
| 619 | u32 flags; | ||
| 620 | 626 | ||
| 621 | for (i = 0; i < fmd->num_sensors; i++) { | 627 | for (i = 0; i < fmd->num_sensors; i++) { |
| 622 | if (fmd->sensor[i].subdev == NULL) | 628 | if (fmd->sensor[i].subdev == NULL) |
| @@ -668,19 +674,20 @@ static int fimc_md_create_links(struct fimc_md *fmd) | |||
| 668 | if (source == NULL) | 674 | if (source == NULL) |
| 669 | continue; | 675 | continue; |
| 670 | 676 | ||
| 677 | link_mask = 1 << fimc_id++; | ||
| 671 | ret = __fimc_md_create_fimc_sink_links(fmd, source, sensor, | 678 | ret = __fimc_md_create_fimc_sink_links(fmd, source, sensor, |
| 672 | pad, fimc_id++); | 679 | pad, link_mask); |
| 673 | } | 680 | } |
| 674 | 681 | ||
| 675 | fimc_id = 0; | ||
| 676 | for (i = 0; i < ARRAY_SIZE(fmd->csis); i++) { | 682 | for (i = 0; i < ARRAY_SIZE(fmd->csis); i++) { |
| 677 | if (fmd->csis[i].sd == NULL) | 683 | if (fmd->csis[i].sd == NULL) |
| 678 | continue; | 684 | continue; |
| 679 | source = &fmd->csis[i].sd->entity; | 685 | source = &fmd->csis[i].sd->entity; |
| 680 | pad = CSIS_PAD_SOURCE; | 686 | pad = CSIS_PAD_SOURCE; |
| 681 | 687 | ||
| 688 | link_mask = 1 << fimc_id++; | ||
| 682 | ret = __fimc_md_create_fimc_sink_links(fmd, source, NULL, | 689 | ret = __fimc_md_create_fimc_sink_links(fmd, source, NULL, |
| 683 | pad, fimc_id++); | 690 | pad, link_mask); |
| 684 | } | 691 | } |
| 685 | 692 | ||
| 686 | /* Create immutable links between each FIMC's subdev and video node */ | 693 | /* Create immutable links between each FIMC's subdev and video node */ |
| @@ -734,8 +741,8 @@ static void fimc_md_put_clocks(struct fimc_md *fmd) | |||
| 734 | } | 741 | } |
| 735 | 742 | ||
| 736 | static int __fimc_md_set_camclk(struct fimc_md *fmd, | 743 | static int __fimc_md_set_camclk(struct fimc_md *fmd, |
| 737 | struct fimc_sensor_info *s_info, | 744 | struct fimc_sensor_info *s_info, |
| 738 | bool on) | 745 | bool on) |
| 739 | { | 746 | { |
| 740 | struct s5p_fimc_isp_info *pdata = s_info->pdata; | 747 | struct s5p_fimc_isp_info *pdata = s_info->pdata; |
| 741 | struct fimc_camclk_info *camclk; | 748 | struct fimc_camclk_info *camclk; |
| @@ -744,12 +751,10 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
| 744 | if (WARN_ON(pdata->clk_id >= FIMC_MAX_CAMCLKS) || fmd == NULL) | 751 | if (WARN_ON(pdata->clk_id >= FIMC_MAX_CAMCLKS) || fmd == NULL) |
| 745 | return -EINVAL; | 752 | return -EINVAL; |
| 746 | 753 | ||
| 747 | if (s_info->clk_on == on) | ||
| 748 | return 0; | ||
| 749 | camclk = &fmd->camclk[pdata->clk_id]; | 754 | camclk = &fmd->camclk[pdata->clk_id]; |
| 750 | 755 | ||
| 751 | dbg("camclk %d, f: %lu, clk: %p, on: %d", | 756 | dbg("camclk %d, f: %lu, use_count: %d, on: %d", |
| 752 | pdata->clk_id, pdata->clk_frequency, camclk, on); | 757 | pdata->clk_id, pdata->clk_frequency, camclk->use_count, on); |
| 753 | 758 | ||
| 754 | if (on) { | 759 | if (on) { |
| 755 | if (camclk->use_count > 0 && | 760 | if (camclk->use_count > 0 && |
| @@ -760,11 +765,9 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
| 760 | clk_set_rate(camclk->clock, pdata->clk_frequency); | 765 | clk_set_rate(camclk->clock, pdata->clk_frequency); |
| 761 | camclk->frequency = pdata->clk_frequency; | 766 | camclk->frequency = pdata->clk_frequency; |
| 762 | ret = clk_enable(camclk->clock); | 767 | ret = clk_enable(camclk->clock); |
| 768 | dbg("Enabled camclk %d: f: %lu", pdata->clk_id, | ||
| 769 | clk_get_rate(camclk->clock)); | ||
| 763 | } | 770 | } |
| 764 | s_info->clk_on = 1; | ||
| 765 | dbg("Enabled camclk %d: f: %lu", pdata->clk_id, | ||
| 766 | clk_get_rate(camclk->clock)); | ||
| 767 | |||
| 768 | return ret; | 771 | return ret; |
| 769 | } | 772 | } |
| 770 | 773 | ||
| @@ -773,7 +776,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
| 773 | 776 | ||
| 774 | if (--camclk->use_count == 0) { | 777 | if (--camclk->use_count == 0) { |
| 775 | clk_disable(camclk->clock); | 778 | clk_disable(camclk->clock); |
| 776 | s_info->clk_on = 0; | ||
| 777 | dbg("Disabled camclk %d", pdata->clk_id); | 779 | dbg("Disabled camclk %d", pdata->clk_id); |
| 778 | } | 780 | } |
| 779 | return ret; | 781 | return ret; |
| @@ -789,8 +791,6 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, | |||
| 789 | * devices to which sensors can be attached, either directly or through | 791 | * devices to which sensors can be attached, either directly or through |
| 790 | * the MIPI CSI receiver. The clock is allowed here to be used by | 792 | * the MIPI CSI receiver. The clock is allowed here to be used by |
| 791 | * multiple sensors concurrently if they use same frequency. | 793 | * multiple sensors concurrently if they use same frequency. |
| 792 | * The per sensor subdev clk_on attribute helps to synchronize accesses | ||
| 793 | * to the sclk_cam clocks from the video and media device nodes. | ||
| 794 | * This function should only be called when the graph mutex is held. | 794 | * This function should only be called when the graph mutex is held. |
| 795 | */ | 795 | */ |
| 796 | int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on) | 796 | int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on) |
diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.h b/drivers/media/video/s5p-fimc/fimc-mdevice.h index 3b8a3492a176..1f5dbaff5442 100644 --- a/drivers/media/video/s5p-fimc/fimc-mdevice.h +++ b/drivers/media/video/s5p-fimc/fimc-mdevice.h | |||
| @@ -47,7 +47,6 @@ struct fimc_camclk_info { | |||
| 47 | * @pdata: sensor's atrributes passed as media device's platform data | 47 | * @pdata: sensor's atrributes passed as media device's platform data |
| 48 | * @subdev: image sensor v4l2 subdev | 48 | * @subdev: image sensor v4l2 subdev |
| 49 | * @host: fimc device the sensor is currently linked to | 49 | * @host: fimc device the sensor is currently linked to |
| 50 | * @clk_on: sclk_cam clock's state associated with this subdev | ||
| 51 | * | 50 | * |
| 52 | * This data structure applies to image sensor and the writeback subdevs. | 51 | * This data structure applies to image sensor and the writeback subdevs. |
| 53 | */ | 52 | */ |
| @@ -55,7 +54,6 @@ struct fimc_sensor_info { | |||
| 55 | struct s5p_fimc_isp_info *pdata; | 54 | struct s5p_fimc_isp_info *pdata; |
| 56 | struct v4l2_subdev *subdev; | 55 | struct v4l2_subdev *subdev; |
| 57 | struct fimc_dev *host; | 56 | struct fimc_dev *host; |
| 58 | bool clk_on; | ||
| 59 | }; | 57 | }; |
| 60 | 58 | ||
| 61 | /** | 59 | /** |
diff --git a/drivers/media/video/s5p-mfc/regs-mfc.h b/drivers/media/video/s5p-mfc/regs-mfc.h index 053a8a872fd7..a19bece41ba9 100644 --- a/drivers/media/video/s5p-mfc/regs-mfc.h +++ b/drivers/media/video/s5p-mfc/regs-mfc.h | |||
| @@ -164,10 +164,15 @@ | |||
| 164 | decoded pic */ | 164 | decoded pic */ |
| 165 | #define S5P_FIMV_SI_DISPLAY_Y_ADR 0x2010 /* luma addr of displayed pic */ | 165 | #define S5P_FIMV_SI_DISPLAY_Y_ADR 0x2010 /* luma addr of displayed pic */ |
| 166 | #define S5P_FIMV_SI_DISPLAY_C_ADR 0x2014 /* chroma addrof displayed pic */ | 166 | #define S5P_FIMV_SI_DISPLAY_C_ADR 0x2014 /* chroma addrof displayed pic */ |
| 167 | |||
| 167 | #define S5P_FIMV_SI_CONSUMED_BYTES 0x2018 /* Consumed number of bytes to | 168 | #define S5P_FIMV_SI_CONSUMED_BYTES 0x2018 /* Consumed number of bytes to |
| 168 | decode a frame */ | 169 | decode a frame */ |
| 169 | #define S5P_FIMV_SI_DISPLAY_STATUS 0x201c /* status of decoded picture */ | 170 | #define S5P_FIMV_SI_DISPLAY_STATUS 0x201c /* status of decoded picture */ |
| 170 | 171 | ||
| 172 | #define S5P_FIMV_SI_DECODE_Y_ADR 0x2024 /* luma addr of decoded pic */ | ||
| 173 | #define S5P_FIMV_SI_DECODE_C_ADR 0x2028 /* chroma addrof decoded pic */ | ||
| 174 | #define S5P_FIMV_SI_DECODE_STATUS 0x202c /* status of decoded picture */ | ||
| 175 | |||
| 171 | #define S5P_FIMV_SI_CH0_SB_ST_ADR 0x2044 /* start addr of stream buf */ | 176 | #define S5P_FIMV_SI_CH0_SB_ST_ADR 0x2044 /* start addr of stream buf */ |
| 172 | #define S5P_FIMV_SI_CH0_SB_FRM_SIZE 0x2048 /* size of stream buf */ | 177 | #define S5P_FIMV_SI_CH0_SB_FRM_SIZE 0x2048 /* size of stream buf */ |
| 173 | #define S5P_FIMV_SI_CH0_DESC_ADR 0x204c /* addr of descriptor buf */ | 178 | #define S5P_FIMV_SI_CH0_DESC_ADR 0x204c /* addr of descriptor buf */ |
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c index c25ec022d267..feea867f318c 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_dec.c | |||
| @@ -627,13 +627,13 @@ static int s5p_mfc_dec_s_ctrl(struct v4l2_ctrl *ctrl) | |||
| 627 | 627 | ||
| 628 | switch (ctrl->id) { | 628 | switch (ctrl->id) { |
| 629 | case V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY: | 629 | case V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY: |
| 630 | ctx->loop_filter_mpeg4 = ctrl->val; | 630 | ctx->display_delay = ctrl->val; |
| 631 | break; | 631 | break; |
| 632 | case V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE: | 632 | case V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE: |
| 633 | ctx->display_delay_enable = ctrl->val; | 633 | ctx->display_delay_enable = ctrl->val; |
| 634 | break; | 634 | break; |
| 635 | case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: | 635 | case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: |
| 636 | ctx->display_delay = ctrl->val; | 636 | ctx->loop_filter_mpeg4 = ctrl->val; |
| 637 | break; | 637 | break; |
| 638 | case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: | 638 | case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: |
| 639 | ctx->slice_interface = ctrl->val; | 639 | ctx->slice_interface = ctrl->val; |
| @@ -996,6 +996,7 @@ int s5p_mfc_dec_ctrls_setup(struct s5p_mfc_ctx *ctx) | |||
| 996 | 996 | ||
| 997 | for (i = 0; i < NUM_CTRLS; i++) { | 997 | for (i = 0; i < NUM_CTRLS; i++) { |
| 998 | if (IS_MFC51_PRIV(controls[i].id)) { | 998 | if (IS_MFC51_PRIV(controls[i].id)) { |
| 999 | memset(&cfg, 0, sizeof(struct v4l2_ctrl_config)); | ||
| 999 | cfg.ops = &s5p_mfc_dec_ctrl_ops; | 1000 | cfg.ops = &s5p_mfc_dec_ctrl_ops; |
| 1000 | cfg.id = controls[i].id; | 1001 | cfg.id = controls[i].id; |
| 1001 | cfg.min = controls[i].minimum; | 1002 | cfg.min = controls[i].minimum; |
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c index acedb2004be3..158b78989b89 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/video/s5p-mfc/s5p_mfc_enc.c | |||
| @@ -243,12 +243,6 @@ static struct mfc_control controls[] = { | |||
| 243 | .minimum = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, | 243 | .minimum = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, |
| 244 | .maximum = V4L2_MPEG_VIDEO_H264_LEVEL_4_0, | 244 | .maximum = V4L2_MPEG_VIDEO_H264_LEVEL_4_0, |
| 245 | .default_value = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, | 245 | .default_value = V4L2_MPEG_VIDEO_H264_LEVEL_1_0, |
| 246 | .menu_skip_mask = ~( | ||
| 247 | (1 << V4L2_MPEG_VIDEO_H264_LEVEL_4_1) | | ||
| 248 | (1 << V4L2_MPEG_VIDEO_H264_LEVEL_4_2) | | ||
| 249 | (1 << V4L2_MPEG_VIDEO_H264_LEVEL_5_0) | | ||
| 250 | (1 << V4L2_MPEG_VIDEO_H264_LEVEL_5_1) | ||
| 251 | ), | ||
| 252 | }, | 246 | }, |
| 253 | { | 247 | { |
| 254 | .id = V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL, | 248 | .id = V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL, |
| @@ -494,7 +488,7 @@ static struct mfc_control controls[] = { | |||
| 494 | .type = V4L2_CTRL_TYPE_MENU, | 488 | .type = V4L2_CTRL_TYPE_MENU, |
| 495 | .minimum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED, | 489 | .minimum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED, |
| 496 | .maximum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED, | 490 | .maximum = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED, |
| 497 | .default_value = 0, | 491 | .default_value = V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED, |
| 498 | .menu_skip_mask = 0, | 492 | .menu_skip_mask = 0, |
| 499 | }, | 493 | }, |
| 500 | { | 494 | { |
| @@ -534,7 +528,7 @@ static struct mfc_control controls[] = { | |||
| 534 | .type = V4L2_CTRL_TYPE_MENU, | 528 | .type = V4L2_CTRL_TYPE_MENU, |
| 535 | .minimum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, | 529 | .minimum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, |
| 536 | .maximum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE, | 530 | .maximum = V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE, |
| 537 | .default_value = 0, | 531 | .default_value = V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE, |
| 538 | .menu_skip_mask = 0, | 532 | .menu_skip_mask = 0, |
| 539 | }, | 533 | }, |
| 540 | { | 534 | { |
| @@ -907,6 +901,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) | |||
| 907 | mfc_err("failed to try output format\n"); | 901 | mfc_err("failed to try output format\n"); |
| 908 | return -EINVAL; | 902 | return -EINVAL; |
| 909 | } | 903 | } |
| 904 | v4l_bound_align_image(&pix_fmt_mp->width, 8, 1920, 1, | ||
| 905 | &pix_fmt_mp->height, 4, 1080, 1, 0); | ||
| 910 | } else { | 906 | } else { |
| 911 | mfc_err("invalid buf type\n"); | 907 | mfc_err("invalid buf type\n"); |
| 912 | return -EINVAL; | 908 | return -EINVAL; |
| @@ -1777,6 +1773,7 @@ int s5p_mfc_enc_ctrls_setup(struct s5p_mfc_ctx *ctx) | |||
| 1777 | } | 1773 | } |
| 1778 | for (i = 0; i < NUM_CTRLS; i++) { | 1774 | for (i = 0; i < NUM_CTRLS; i++) { |
| 1779 | if (IS_MFC51_PRIV(controls[i].id)) { | 1775 | if (IS_MFC51_PRIV(controls[i].id)) { |
| 1776 | memset(&cfg, 0, sizeof(struct v4l2_ctrl_config)); | ||
| 1780 | cfg.ops = &s5p_mfc_enc_ctrl_ops; | 1777 | cfg.ops = &s5p_mfc_enc_ctrl_ops; |
| 1781 | cfg.id = controls[i].id; | 1778 | cfg.id = controls[i].id; |
| 1782 | cfg.min = controls[i].minimum; | 1779 | cfg.min = controls[i].minimum; |
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_opr.h b/drivers/media/video/s5p-mfc/s5p_mfc_opr.h index db83836e6a9f..5932d1c782c5 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_opr.h +++ b/drivers/media/video/s5p-mfc/s5p_mfc_opr.h | |||
| @@ -57,10 +57,12 @@ void s5p_mfc_cleanup_queue(struct list_head *lh, struct vb2_queue *vq); | |||
| 57 | S5P_FIMV_SI_DISPLAY_Y_ADR) << \ | 57 | S5P_FIMV_SI_DISPLAY_Y_ADR) << \ |
| 58 | MFC_OFFSET_SHIFT) | 58 | MFC_OFFSET_SHIFT) |
| 59 | #define s5p_mfc_get_dec_y_adr() (readl(dev->regs_base + \ | 59 | #define s5p_mfc_get_dec_y_adr() (readl(dev->regs_base + \ |
| 60 | S5P_FIMV_SI_DISPLAY_Y_ADR) << \ | 60 | S5P_FIMV_SI_DECODE_Y_ADR) << \ |
| 61 | MFC_OFFSET_SHIFT) | 61 | MFC_OFFSET_SHIFT) |
| 62 | #define s5p_mfc_get_dspl_status() readl(dev->regs_base + \ | 62 | #define s5p_mfc_get_dspl_status() readl(dev->regs_base + \ |
| 63 | S5P_FIMV_SI_DISPLAY_STATUS) | 63 | S5P_FIMV_SI_DISPLAY_STATUS) |
| 64 | #define s5p_mfc_get_dec_status() readl(dev->regs_base + \ | ||
| 65 | S5P_FIMV_SI_DECODE_STATUS) | ||
| 64 | #define s5p_mfc_get_frame_type() (readl(dev->regs_base + \ | 66 | #define s5p_mfc_get_frame_type() (readl(dev->regs_base + \ |
| 65 | S5P_FIMV_DECODE_FRAME_TYPE) \ | 67 | S5P_FIMV_DECODE_FRAME_TYPE) \ |
| 66 | & S5P_FIMV_DECODE_FRAME_MASK) | 68 | & S5P_FIMV_DECODE_FRAME_MASK) |
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_shm.h b/drivers/media/video/s5p-mfc/s5p_mfc_shm.h index 764eac6bcc4c..cf962a466276 100644 --- a/drivers/media/video/s5p-mfc/s5p_mfc_shm.h +++ b/drivers/media/video/s5p-mfc/s5p_mfc_shm.h | |||
| @@ -13,8 +13,7 @@ | |||
| 13 | #ifndef S5P_MFC_SHM_H_ | 13 | #ifndef S5P_MFC_SHM_H_ |
| 14 | #define S5P_MFC_SHM_H_ | 14 | #define S5P_MFC_SHM_H_ |
| 15 | 15 | ||
| 16 | enum MFC_SHM_OFS | 16 | enum MFC_SHM_OFS { |
| 17 | { | ||
| 18 | EXTENEDED_DECODE_STATUS = 0x00, /* D */ | 17 | EXTENEDED_DECODE_STATUS = 0x00, /* D */ |
| 19 | SET_FRAME_TAG = 0x04, /* D */ | 18 | SET_FRAME_TAG = 0x04, /* D */ |
| 20 | GET_FRAME_TAG_TOP = 0x08, /* D */ | 19 | GET_FRAME_TAG_TOP = 0x08, /* D */ |
diff --git a/drivers/media/video/smiapp/Kconfig b/drivers/media/video/smiapp/Kconfig index f7b35ff443bf..fb99ff18be07 100644 --- a/drivers/media/video/smiapp/Kconfig +++ b/drivers/media/video/smiapp/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config VIDEO_SMIAPP | 1 | config VIDEO_SMIAPP |
| 2 | tristate "SMIA++/SMIA sensor support" | 2 | tristate "SMIA++/SMIA sensor support" |
| 3 | depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API | 3 | depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAVE_CLK |
| 4 | select VIDEO_SMIAPP_PLL | 4 | select VIDEO_SMIAPP_PLL |
| 5 | ---help--- | 5 | ---help--- |
| 6 | This is a generic driver for SMIA++/SMIA camera modules. | 6 | This is a generic driver for SMIA++/SMIA camera modules. |
diff --git a/drivers/media/video/smiapp/smiapp-core.c b/drivers/media/video/smiapp/smiapp-core.c index f518026cb67b..9cf5bda35fbe 100644 --- a/drivers/media/video/smiapp/smiapp-core.c +++ b/drivers/media/video/smiapp/smiapp-core.c | |||
| @@ -31,7 +31,9 @@ | |||
| 31 | #include <linux/device.h> | 31 | #include <linux/device.h> |
| 32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
| 33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
| 34 | #include <linux/slab.h> | ||
| 34 | #include <linux/regulator/consumer.h> | 35 | #include <linux/regulator/consumer.h> |
| 36 | #include <linux/slab.h> | ||
| 35 | #include <linux/v4l2-mediabus.h> | 37 | #include <linux/v4l2-mediabus.h> |
| 36 | #include <media/v4l2-device.h> | 38 | #include <media/v4l2-device.h> |
| 37 | 39 | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 3e050e12153b..1ad5ab6ce5cf 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
| @@ -1178,7 +1178,7 @@ static int tuner_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) | |||
| 1178 | return 0; | 1178 | return 0; |
| 1179 | if (vt->type == t->mode && analog_ops->get_afc) | 1179 | if (vt->type == t->mode && analog_ops->get_afc) |
| 1180 | vt->afc = analog_ops->get_afc(&t->fe); | 1180 | vt->afc = analog_ops->get_afc(&t->fe); |
| 1181 | if (t->mode != V4L2_TUNER_RADIO) { | 1181 | if (vt->type != V4L2_TUNER_RADIO) { |
| 1182 | vt->capability |= V4L2_TUNER_CAP_NORM; | 1182 | vt->capability |= V4L2_TUNER_CAP_NORM; |
| 1183 | vt->rangelow = tv_range[0] * 16; | 1183 | vt->rangelow = tv_range[0] * 16; |
| 1184 | vt->rangehigh = tv_range[1] * 16; | 1184 | vt->rangehigh = tv_range[1] * 16; |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 5ccbd4629f9c..0cbada18f6f5 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
| @@ -656,7 +656,7 @@ static void determine_valid_ioctls(struct video_device *vdev) | |||
| 656 | SET_VALID_IOCTL(ops, VIDIOC_TRY_ENCODER_CMD, vidioc_try_encoder_cmd); | 656 | SET_VALID_IOCTL(ops, VIDIOC_TRY_ENCODER_CMD, vidioc_try_encoder_cmd); |
| 657 | SET_VALID_IOCTL(ops, VIDIOC_DECODER_CMD, vidioc_decoder_cmd); | 657 | SET_VALID_IOCTL(ops, VIDIOC_DECODER_CMD, vidioc_decoder_cmd); |
| 658 | SET_VALID_IOCTL(ops, VIDIOC_TRY_DECODER_CMD, vidioc_try_decoder_cmd); | 658 | SET_VALID_IOCTL(ops, VIDIOC_TRY_DECODER_CMD, vidioc_try_decoder_cmd); |
| 659 | if (ops->vidioc_g_parm || vdev->current_norm) | 659 | if (ops->vidioc_g_parm || vdev->vfl_type == VFL_TYPE_GRABBER) |
| 660 | set_bit(_IOC_NR(VIDIOC_G_PARM), valid_ioctls); | 660 | set_bit(_IOC_NR(VIDIOC_G_PARM), valid_ioctls); |
| 661 | SET_VALID_IOCTL(ops, VIDIOC_S_PARM, vidioc_s_parm); | 661 | SET_VALID_IOCTL(ops, VIDIOC_S_PARM, vidioc_s_parm); |
| 662 | SET_VALID_IOCTL(ops, VIDIOC_G_TUNER, vidioc_g_tuner); | 662 | SET_VALID_IOCTL(ops, VIDIOC_G_TUNER, vidioc_g_tuner); |
| @@ -679,6 +679,9 @@ static void determine_valid_ioctls(struct video_device *vdev) | |||
| 679 | SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_PRESET, vidioc_query_dv_preset); | 679 | SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_PRESET, vidioc_query_dv_preset); |
| 680 | SET_VALID_IOCTL(ops, VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings); | 680 | SET_VALID_IOCTL(ops, VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings); |
| 681 | SET_VALID_IOCTL(ops, VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings); | 681 | SET_VALID_IOCTL(ops, VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings); |
| 682 | SET_VALID_IOCTL(ops, VIDIOC_ENUM_DV_TIMINGS, vidioc_enum_dv_timings); | ||
| 683 | SET_VALID_IOCTL(ops, VIDIOC_QUERY_DV_TIMINGS, vidioc_query_dv_timings); | ||
| 684 | SET_VALID_IOCTL(ops, VIDIOC_DV_TIMINGS_CAP, vidioc_dv_timings_cap); | ||
| 682 | /* yes, really vidioc_subscribe_event */ | 685 | /* yes, really vidioc_subscribe_event */ |
| 683 | SET_VALID_IOCTL(ops, VIDIOC_DQEVENT, vidioc_subscribe_event); | 686 | SET_VALID_IOCTL(ops, VIDIOC_DQEVENT, vidioc_subscribe_event); |
| 684 | SET_VALID_IOCTL(ops, VIDIOC_SUBSCRIBE_EVENT, vidioc_subscribe_event); | 687 | SET_VALID_IOCTL(ops, VIDIOC_SUBSCRIBE_EVENT, vidioc_subscribe_event); |
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index 91be4e871f43..d7fa8962d8b3 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
| @@ -1680,6 +1680,7 @@ static long __video_do_ioctl(struct file *file, | |||
| 1680 | break; | 1680 | break; |
| 1681 | 1681 | ||
| 1682 | ret = 0; | 1682 | ret = 0; |
| 1683 | p->parm.capture.readbuffers = 2; | ||
| 1683 | if (ops->vidioc_g_std) | 1684 | if (ops->vidioc_g_std) |
| 1684 | ret = ops->vidioc_g_std(file, fh, &std); | 1685 | ret = ops->vidioc_g_std(file, fh, &std); |
| 1685 | if (ret == 0) | 1686 | if (ret == 0) |
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 4d7391ec8001..aae1720b2f2d 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
| @@ -2561,7 +2561,7 @@ static int vino_acquire_input(struct vino_channel_settings *vcs) | |||
| 2561 | } else if (vino_drvdata->decoder | 2561 | } else if (vino_drvdata->decoder |
| 2562 | && (vino_drvdata->decoder_owner == VINO_NO_CHANNEL)) { | 2562 | && (vino_drvdata->decoder_owner == VINO_NO_CHANNEL)) { |
| 2563 | int input; | 2563 | int input; |
| 2564 | int data_norm; | 2564 | int data_norm = 0; |
| 2565 | v4l2_std_id norm; | 2565 | v4l2_std_id norm; |
| 2566 | 2566 | ||
| 2567 | input = VINO_INPUT_COMPOSITE; | 2567 | input = VINO_INPUT_COMPOSITE; |
| @@ -2651,7 +2651,7 @@ static int vino_set_input(struct vino_channel_settings *vcs, int input) | |||
| 2651 | } | 2651 | } |
| 2652 | 2652 | ||
| 2653 | if (vino_drvdata->decoder_owner == vcs->channel) { | 2653 | if (vino_drvdata->decoder_owner == vcs->channel) { |
| 2654 | int data_norm; | 2654 | int data_norm = 0; |
| 2655 | v4l2_std_id norm; | 2655 | v4l2_std_id norm; |
| 2656 | 2656 | ||
| 2657 | ret = decoder_call(video, s_routing, | 2657 | ret = decoder_call(video, s_routing, |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 0960d7f0d394..08c10240e70f 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
| @@ -1149,10 +1149,14 @@ static ssize_t | |||
| 1149 | vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos) | 1149 | vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos) |
| 1150 | { | 1150 | { |
| 1151 | struct vivi_dev *dev = video_drvdata(file); | 1151 | struct vivi_dev *dev = video_drvdata(file); |
| 1152 | int err; | ||
| 1152 | 1153 | ||
| 1153 | dprintk(dev, 1, "read called\n"); | 1154 | dprintk(dev, 1, "read called\n"); |
| 1154 | return vb2_read(&dev->vb_vidq, data, count, ppos, | 1155 | mutex_lock(&dev->mutex); |
| 1156 | err = vb2_read(&dev->vb_vidq, data, count, ppos, | ||
| 1155 | file->f_flags & O_NONBLOCK); | 1157 | file->f_flags & O_NONBLOCK); |
| 1158 | mutex_unlock(&dev->mutex); | ||
| 1159 | return err; | ||
| 1156 | } | 1160 | } |
| 1157 | 1161 | ||
| 1158 | static unsigned int | 1162 | static unsigned int |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index e129c820df7d..92144ed1ad46 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -286,6 +286,7 @@ config TWL6040_CORE | |||
| 286 | depends on I2C=y && GENERIC_HARDIRQS | 286 | depends on I2C=y && GENERIC_HARDIRQS |
| 287 | select MFD_CORE | 287 | select MFD_CORE |
| 288 | select REGMAP_I2C | 288 | select REGMAP_I2C |
| 289 | select IRQ_DOMAIN | ||
| 289 | default n | 290 | default n |
| 290 | help | 291 | help |
| 291 | Say yes here if you want support for Texas Instruments TWL6040 audio | 292 | Say yes here if you want support for Texas Instruments TWL6040 audio |
diff --git a/drivers/mfd/ab5500-core.h b/drivers/mfd/ab5500-core.h deleted file mode 100644 index 63b30b17e4f3..000000000000 --- a/drivers/mfd/ab5500-core.h +++ /dev/null | |||
| @@ -1,87 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2011 ST-Ericsson | ||
| 3 | * License terms: GNU General Public License (GPL) version 2 | ||
| 4 | * Shared definitions and data structures for the AB5500 MFD driver | ||
| 5 | */ | ||
| 6 | |||
| 7 | /* Read/write operation values. */ | ||
| 8 | #define AB5500_PERM_RD (0x01) | ||
| 9 | #define AB5500_PERM_WR (0x02) | ||
| 10 | |||
| 11 | /* Read/write permissions. */ | ||
| 12 | #define AB5500_PERM_RO (AB5500_PERM_RD) | ||
| 13 | #define AB5500_PERM_RW (AB5500_PERM_RD | AB5500_PERM_WR) | ||
| 14 | |||
| 15 | #define AB5500_MASK_BASE (0x60) | ||
| 16 | #define AB5500_MASK_END (0x79) | ||
| 17 | #define AB5500_CHIP_ID (0x20) | ||
| 18 | |||
| 19 | /** | ||
| 20 | * struct ab5500_reg_range | ||
| 21 | * @first: the first address of the range | ||
| 22 | * @last: the last address of the range | ||
| 23 | * @perm: access permissions for the range | ||
| 24 | */ | ||
| 25 | struct ab5500_reg_range { | ||
| 26 | u8 first; | ||
| 27 | u8 last; | ||
| 28 | u8 perm; | ||
| 29 | }; | ||
| 30 | |||
| 31 | /** | ||
| 32 | * struct ab5500_i2c_ranges | ||
| 33 | * @count: the number of ranges in the list | ||
| 34 | * @range: the list of register ranges | ||
| 35 | */ | ||
| 36 | struct ab5500_i2c_ranges { | ||
| 37 | u8 nranges; | ||
| 38 | u8 bankid; | ||
| 39 | const struct ab5500_reg_range *range; | ||
| 40 | }; | ||
| 41 | |||
| 42 | /** | ||
| 43 | * struct ab5500_i2c_banks | ||
| 44 | * @count: the number of ranges in the list | ||
| 45 | * @range: the list of register ranges | ||
| 46 | */ | ||
| 47 | struct ab5500_i2c_banks { | ||
| 48 | u8 nbanks; | ||
| 49 | const struct ab5500_i2c_ranges *bank; | ||
| 50 | }; | ||
| 51 | |||
| 52 | /** | ||
| 53 | * struct ab5500_bank | ||
| 54 | * @slave_addr: I2C slave_addr found in AB5500 specification | ||
| 55 | * @name: Documentation name of the bank. For reference | ||
| 56 | */ | ||
| 57 | struct ab5500_bank { | ||
| 58 | u8 slave_addr; | ||
| 59 | const char *name; | ||
| 60 | }; | ||
| 61 | |||
| 62 | static const struct ab5500_bank bankinfo[AB5500_NUM_BANKS] = { | ||
| 63 | [AB5500_BANK_VIT_IO_I2C_CLK_TST_OTP] = { | ||
| 64 | AB5500_ADDR_VIT_IO_I2C_CLK_TST_OTP, "VIT_IO_I2C_CLK_TST_OTP"}, | ||
| 65 | [AB5500_BANK_VDDDIG_IO_I2C_CLK_TST] = { | ||
| 66 | AB5500_ADDR_VDDDIG_IO_I2C_CLK_TST, "VDDDIG_IO_I2C_CLK_TST"}, | ||
| 67 | [AB5500_BANK_VDENC] = {AB5500_ADDR_VDENC, "VDENC"}, | ||
| 68 | [AB5500_BANK_SIM_USBSIM] = {AB5500_ADDR_SIM_USBSIM, "SIM_USBSIM"}, | ||
| 69 | [AB5500_BANK_LED] = {AB5500_ADDR_LED, "LED"}, | ||
| 70 | [AB5500_BANK_ADC] = {AB5500_ADDR_ADC, "ADC"}, | ||
| 71 | [AB5500_BANK_RTC] = {AB5500_ADDR_RTC, "RTC"}, | ||
| 72 | [AB5500_BANK_STARTUP] = {AB5500_ADDR_STARTUP, "STARTUP"}, | ||
| 73 | [AB5500_BANK_DBI_ECI] = {AB5500_ADDR_DBI_ECI, "DBI-ECI"}, | ||
| 74 | [AB5500_BANK_CHG] = {AB5500_ADDR_CHG, "CHG"}, | ||
| 75 | [AB5500_BANK_FG_BATTCOM_ACC] = { | ||
| 76 | AB5500_ADDR_FG_BATTCOM_ACC, "FG_BATCOM_ACC"}, | ||
| 77 | [AB5500_BANK_USB] = {AB5500_ADDR_USB, "USB"}, | ||
| 78 | [AB5500_BANK_IT] = {AB5500_ADDR_IT, "IT"}, | ||
| 79 | [AB5500_BANK_VIBRA] = {AB5500_ADDR_VIBRA, "VIBRA"}, | ||
| 80 | [AB5500_BANK_AUDIO_HEADSETUSB] = { | ||
| 81 | AB5500_ADDR_AUDIO_HEADSETUSB, "AUDIO_HEADSETUSB"}, | ||
| 82 | }; | ||
| 83 | |||
| 84 | int ab5500_get_register_interruptible_raw(struct ab5500 *ab, u8 bank, u8 reg, | ||
| 85 | u8 *value); | ||
| 86 | int ab5500_mask_and_set_register_interruptible_raw(struct ab5500 *ab, u8 bank, | ||
| 87 | u8 reg, u8 bitmask, u8 bitvalues); | ||
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c index 3fcdab3eb8eb..03df422feb76 100644 --- a/drivers/mfd/mc13xxx-spi.c +++ b/drivers/mfd/mc13xxx-spi.c | |||
| @@ -49,10 +49,72 @@ static struct regmap_config mc13xxx_regmap_spi_config = { | |||
| 49 | .reg_bits = 7, | 49 | .reg_bits = 7, |
| 50 | .pad_bits = 1, | 50 | .pad_bits = 1, |
| 51 | .val_bits = 24, | 51 | .val_bits = 24, |
| 52 | .write_flag_mask = 0x80, | ||
| 52 | 53 | ||
| 53 | .max_register = MC13XXX_NUMREGS, | 54 | .max_register = MC13XXX_NUMREGS, |
| 54 | 55 | ||
| 55 | .cache_type = REGCACHE_NONE, | 56 | .cache_type = REGCACHE_NONE, |
| 57 | .use_single_rw = 1, | ||
| 58 | }; | ||
| 59 | |||
| 60 | static int mc13xxx_spi_read(void *context, const void *reg, size_t reg_size, | ||
| 61 | void *val, size_t val_size) | ||
| 62 | { | ||
| 63 | unsigned char w[4] = { *((unsigned char *) reg), 0, 0, 0}; | ||
| 64 | unsigned char r[4]; | ||
| 65 | unsigned char *p = val; | ||
| 66 | struct device *dev = context; | ||
| 67 | struct spi_device *spi = to_spi_device(dev); | ||
| 68 | struct spi_transfer t = { | ||
| 69 | .tx_buf = w, | ||
| 70 | .rx_buf = r, | ||
| 71 | .len = 4, | ||
| 72 | }; | ||
| 73 | |||
| 74 | struct spi_message m; | ||
| 75 | int ret; | ||
| 76 | |||
| 77 | if (val_size != 3 || reg_size != 1) | ||
| 78 | return -ENOTSUPP; | ||
| 79 | |||
| 80 | spi_message_init(&m); | ||
| 81 | spi_message_add_tail(&t, &m); | ||
| 82 | ret = spi_sync(spi, &m); | ||
| 83 | |||
| 84 | memcpy(p, &r[1], 3); | ||
| 85 | |||
| 86 | return ret; | ||
| 87 | } | ||
| 88 | |||
| 89 | static int mc13xxx_spi_write(void *context, const void *data, size_t count) | ||
| 90 | { | ||
| 91 | struct device *dev = context; | ||
| 92 | struct spi_device *spi = to_spi_device(dev); | ||
| 93 | |||
| 94 | if (count != 4) | ||
| 95 | return -ENOTSUPP; | ||
| 96 | |||
| 97 | return spi_write(spi, data, count); | ||
| 98 | } | ||
| 99 | |||
| 100 | /* | ||
| 101 | * We cannot use regmap-spi generic bus implementation here. | ||
| 102 | * The MC13783 chip will get corrupted if CS signal is deasserted | ||
| 103 | * and on i.Mx31 SoC (the target SoC for MC13783 PMIC) the SPI controller | ||
| 104 | * has the following errata (DSPhl22960): | ||
| 105 | * "The CSPI negates SS when the FIFO becomes empty with | ||
| 106 | * SSCTL= 0. Software cannot guarantee that the FIFO will not | ||
| 107 | * drain because of higher priority interrupts and the | ||
| 108 | * non-realtime characteristics of the operating system. As a | ||
| 109 | * result, the SS will negate before all of the data has been | ||
| 110 | * transferred to/from the peripheral." | ||
| 111 | * We workaround this by accessing the SPI controller with a | ||
| 112 | * single transfert. | ||
| 113 | */ | ||
| 114 | |||
| 115 | static struct regmap_bus regmap_mc13xxx_bus = { | ||
| 116 | .write = mc13xxx_spi_write, | ||
| 117 | .read = mc13xxx_spi_read, | ||
| 56 | }; | 118 | }; |
| 57 | 119 | ||
| 58 | static int mc13xxx_spi_probe(struct spi_device *spi) | 120 | static int mc13xxx_spi_probe(struct spi_device *spi) |
| @@ -73,12 +135,13 @@ static int mc13xxx_spi_probe(struct spi_device *spi) | |||
| 73 | 135 | ||
| 74 | dev_set_drvdata(&spi->dev, mc13xxx); | 136 | dev_set_drvdata(&spi->dev, mc13xxx); |
| 75 | spi->mode = SPI_MODE_0 | SPI_CS_HIGH; | 137 | spi->mode = SPI_MODE_0 | SPI_CS_HIGH; |
| 76 | spi->bits_per_word = 32; | ||
| 77 | 138 | ||
| 78 | mc13xxx->dev = &spi->dev; | 139 | mc13xxx->dev = &spi->dev; |
| 79 | mutex_init(&mc13xxx->lock); | 140 | mutex_init(&mc13xxx->lock); |
| 80 | 141 | ||
| 81 | mc13xxx->regmap = regmap_init_spi(spi, &mc13xxx_regmap_spi_config); | 142 | mc13xxx->regmap = regmap_init(&spi->dev, ®map_mc13xxx_bus, &spi->dev, |
| 143 | &mc13xxx_regmap_spi_config); | ||
| 144 | |||
| 82 | if (IS_ERR(mc13xxx->regmap)) { | 145 | if (IS_ERR(mc13xxx->regmap)) { |
| 83 | ret = PTR_ERR(mc13xxx->regmap); | 146 | ret = PTR_ERR(mc13xxx->regmap); |
| 84 | dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", | 147 | dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 7e96bb229724..41088ecbb2a9 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
| 26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
| 27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
| 28 | #include <linux/gpio.h> | ||
| 28 | #include <plat/cpu.h> | 29 | #include <plat/cpu.h> |
| 29 | #include <plat/usb.h> | 30 | #include <plat/usb.h> |
| 30 | #include <linux/pm_runtime.h> | 31 | #include <linux/pm_runtime.h> |
| @@ -500,8 +501,21 @@ static void omap_usbhs_init(struct device *dev) | |||
| 500 | dev_dbg(dev, "starting TI HSUSB Controller\n"); | 501 | dev_dbg(dev, "starting TI HSUSB Controller\n"); |
| 501 | 502 | ||
| 502 | pm_runtime_get_sync(dev); | 503 | pm_runtime_get_sync(dev); |
| 503 | spin_lock_irqsave(&omap->lock, flags); | ||
| 504 | 504 | ||
| 505 | if (pdata->ehci_data->phy_reset) { | ||
| 506 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
| 507 | gpio_request_one(pdata->ehci_data->reset_gpio_port[0], | ||
| 508 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
| 509 | |||
| 510 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
| 511 | gpio_request_one(pdata->ehci_data->reset_gpio_port[1], | ||
| 512 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
| 513 | |||
| 514 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
| 515 | udelay(10); | ||
| 516 | } | ||
| 517 | |||
| 518 | spin_lock_irqsave(&omap->lock, flags); | ||
| 505 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); | 519 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); |
| 506 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); | 520 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); |
| 507 | 521 | ||
| @@ -581,9 +595,39 @@ static void omap_usbhs_init(struct device *dev) | |||
| 581 | } | 595 | } |
| 582 | 596 | ||
| 583 | spin_unlock_irqrestore(&omap->lock, flags); | 597 | spin_unlock_irqrestore(&omap->lock, flags); |
| 598 | |||
| 599 | if (pdata->ehci_data->phy_reset) { | ||
| 600 | /* Hold the PHY in RESET for enough time till | ||
| 601 | * PHY is settled and ready | ||
| 602 | */ | ||
| 603 | udelay(10); | ||
| 604 | |||
| 605 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
| 606 | gpio_set_value_cansleep | ||
| 607 | (pdata->ehci_data->reset_gpio_port[0], 1); | ||
| 608 | |||
| 609 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
| 610 | gpio_set_value_cansleep | ||
| 611 | (pdata->ehci_data->reset_gpio_port[1], 1); | ||
| 612 | } | ||
| 613 | |||
| 584 | pm_runtime_put_sync(dev); | 614 | pm_runtime_put_sync(dev); |
| 585 | } | 615 | } |
| 586 | 616 | ||
| 617 | static void omap_usbhs_deinit(struct device *dev) | ||
| 618 | { | ||
| 619 | struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); | ||
| 620 | struct usbhs_omap_platform_data *pdata = &omap->platdata; | ||
| 621 | |||
| 622 | if (pdata->ehci_data->phy_reset) { | ||
| 623 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
| 624 | gpio_free(pdata->ehci_data->reset_gpio_port[0]); | ||
| 625 | |||
| 626 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
| 627 | gpio_free(pdata->ehci_data->reset_gpio_port[1]); | ||
| 628 | } | ||
| 629 | } | ||
| 630 | |||
| 587 | 631 | ||
| 588 | /** | 632 | /** |
| 589 | * usbhs_omap_probe - initialize TI-based HCDs | 633 | * usbhs_omap_probe - initialize TI-based HCDs |
| @@ -767,6 +811,7 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev) | |||
| 767 | goto end_probe; | 811 | goto end_probe; |
| 768 | 812 | ||
| 769 | err_alloc: | 813 | err_alloc: |
| 814 | omap_usbhs_deinit(&pdev->dev); | ||
| 770 | iounmap(omap->tll_base); | 815 | iounmap(omap->tll_base); |
| 771 | 816 | ||
| 772 | err_tll: | 817 | err_tll: |
| @@ -818,6 +863,7 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev) | |||
| 818 | { | 863 | { |
| 819 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); | 864 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); |
| 820 | 865 | ||
| 866 | omap_usbhs_deinit(&pdev->dev); | ||
| 821 | iounmap(omap->tll_base); | 867 | iounmap(omap->tll_base); |
| 822 | iounmap(omap->uhh_base); | 868 | iounmap(omap->uhh_base); |
| 823 | clk_put(omap->init_60m_fclk); | 869 | clk_put(omap->init_60m_fclk); |
diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c index 00c0aba7eba0..c4a69f193a1d 100644 --- a/drivers/mfd/palmas.c +++ b/drivers/mfd/palmas.c | |||
| @@ -356,7 +356,14 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c, | |||
| 356 | } | 356 | } |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | ret = regmap_add_irq_chip(palmas->regmap[1], palmas->irq, | 359 | /* Change IRQ into clear on read mode for efficiency */ |
| 360 | slave = PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE); | ||
| 361 | addr = PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE, PALMAS_INT_CTRL); | ||
| 362 | reg = PALMAS_INT_CTRL_INT_CLEAR; | ||
| 363 | |||
| 364 | regmap_write(palmas->regmap[slave], addr, reg); | ||
| 365 | |||
| 366 | ret = regmap_add_irq_chip(palmas->regmap[slave], palmas->irq, | ||
| 360 | IRQF_ONESHOT | IRQF_TRIGGER_LOW, -1, &palmas_irq_chip, | 367 | IRQF_ONESHOT | IRQF_TRIGGER_LOW, -1, &palmas_irq_chip, |
| 361 | &palmas->irq_data); | 368 | &palmas->irq_data); |
| 362 | if (ret < 0) | 369 | if (ret < 0) |
| @@ -441,6 +448,9 @@ static int __devinit palmas_i2c_probe(struct i2c_client *i2c, | |||
| 441 | goto err; | 448 | goto err; |
| 442 | } | 449 | } |
| 443 | 450 | ||
| 451 | children[PALMAS_PMIC_ID].platform_data = pdata->pmic_pdata; | ||
| 452 | children[PALMAS_PMIC_ID].pdata_size = sizeof(*pdata->pmic_pdata); | ||
| 453 | |||
| 444 | ret = mfd_add_devices(palmas->dev, -1, | 454 | ret = mfd_add_devices(palmas->dev, -1, |
| 445 | children, ARRAY_SIZE(palmas_children), | 455 | children, ARRAY_SIZE(palmas_children), |
| 446 | NULL, regmap_irq_chip_get_base(palmas->irq_data)); | 456 | NULL, regmap_irq_chip_get_base(palmas->irq_data)); |
| @@ -472,6 +482,7 @@ static const struct i2c_device_id palmas_i2c_id[] = { | |||
| 472 | { "twl6035", }, | 482 | { "twl6035", }, |
| 473 | { "twl6037", }, | 483 | { "twl6037", }, |
| 474 | { "tps65913", }, | 484 | { "tps65913", }, |
| 485 | { /* end */ } | ||
| 475 | }; | 486 | }; |
| 476 | MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); | 487 | MODULE_DEVICE_TABLE(i2c, palmas_i2c_id); |
| 477 | 488 | ||
diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c index 373f423b1181..947a06a1845f 100644 --- a/drivers/mfd/stmpe-i2c.c +++ b/drivers/mfd/stmpe-i2c.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * | 6 | * |
| 7 | * License Terms: GNU General Public License, version 2 | 7 | * License Terms: GNU General Public License, version 2 |
| 8 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson | 8 | * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson |
| 9 | * Author: Viresh Kumar <viresh.kumar@st.com> for ST Microelectronics | 9 | * Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #include <linux/i2c.h> | 12 | #include <linux/i2c.h> |
diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c index afd459013ecb..9edfe864cc05 100644 --- a/drivers/mfd/stmpe-spi.c +++ b/drivers/mfd/stmpe-spi.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Copyright (C) ST Microelectronics SA 2011 | 4 | * Copyright (C) ST Microelectronics SA 2011 |
| 5 | * | 5 | * |
| 6 | * License Terms: GNU General Public License, version 2 | 6 | * License Terms: GNU General Public License, version 2 |
| 7 | * Author: Viresh Kumar <viresh.kumar@st.com> for ST Microelectronics | 7 | * Author: Viresh Kumar <viresh.linux@gmail.com> for ST Microelectronics |
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include <linux/spi/spi.h> | 10 | #include <linux/spi/spi.h> |
| @@ -146,4 +146,4 @@ module_exit(stmpe_exit); | |||
| 146 | 146 | ||
| 147 | MODULE_LICENSE("GPL v2"); | 147 | MODULE_LICENSE("GPL v2"); |
| 148 | MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver"); | 148 | MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver"); |
| 149 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 149 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index 93936f1b75eb..23f5463d4cae 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
| @@ -835,7 +835,7 @@ static int _mei_irq_thread_read(struct mei_device *dev, s32 *slots, | |||
| 835 | struct mei_cl *cl, | 835 | struct mei_cl *cl, |
| 836 | struct mei_io_list *cmpl_list) | 836 | struct mei_io_list *cmpl_list) |
| 837 | { | 837 | { |
| 838 | if ((*slots * sizeof(u32)) >= (sizeof(struct mei_msg_hdr) + | 838 | if ((*slots * sizeof(u32)) < (sizeof(struct mei_msg_hdr) + |
| 839 | sizeof(struct hbm_flow_control))) { | 839 | sizeof(struct hbm_flow_control))) { |
| 840 | /* return the cancel routine */ | 840 | /* return the cancel routine */ |
| 841 | list_del(&cb_pos->cb_list); | 841 | list_del(&cb_pos->cb_list); |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index c70333228337..783fcd7365bc 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
| @@ -982,7 +982,7 @@ static int __devinit mei_probe(struct pci_dev *pdev, | |||
| 982 | err = request_threaded_irq(pdev->irq, | 982 | err = request_threaded_irq(pdev->irq, |
| 983 | NULL, | 983 | NULL, |
| 984 | mei_interrupt_thread_handler, | 984 | mei_interrupt_thread_handler, |
| 985 | 0, mei_driver_name, dev); | 985 | IRQF_ONESHOT, mei_driver_name, dev); |
| 986 | else | 986 | else |
| 987 | err = request_threaded_irq(pdev->irq, | 987 | err = request_threaded_irq(pdev->irq, |
| 988 | mei_interrupt_quick_handler, | 988 | mei_interrupt_quick_handler, |
| @@ -992,7 +992,7 @@ static int __devinit mei_probe(struct pci_dev *pdev, | |||
| 992 | if (err) { | 992 | if (err) { |
| 993 | dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n", | 993 | dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n", |
| 994 | pdev->irq); | 994 | pdev->irq); |
| 995 | goto unmap_memory; | 995 | goto disable_msi; |
| 996 | } | 996 | } |
| 997 | INIT_DELAYED_WORK(&dev->timer_work, mei_timer); | 997 | INIT_DELAYED_WORK(&dev->timer_work, mei_timer); |
| 998 | if (mei_hw_init(dev)) { | 998 | if (mei_hw_init(dev)) { |
| @@ -1023,8 +1023,8 @@ release_irq: | |||
| 1023 | mei_disable_interrupts(dev); | 1023 | mei_disable_interrupts(dev); |
| 1024 | flush_scheduled_work(); | 1024 | flush_scheduled_work(); |
| 1025 | free_irq(pdev->irq, dev); | 1025 | free_irq(pdev->irq, dev); |
| 1026 | disable_msi: | ||
| 1026 | pci_disable_msi(pdev); | 1027 | pci_disable_msi(pdev); |
| 1027 | unmap_memory: | ||
| 1028 | pci_iounmap(pdev, dev->mem_addr); | 1028 | pci_iounmap(pdev, dev->mem_addr); |
| 1029 | free_device: | 1029 | free_device: |
| 1030 | kfree(dev); | 1030 | kfree(dev); |
| @@ -1101,6 +1101,8 @@ static void __devexit mei_remove(struct pci_dev *pdev) | |||
| 1101 | 1101 | ||
| 1102 | pci_release_regions(pdev); | 1102 | pci_release_regions(pdev); |
| 1103 | pci_disable_device(pdev); | 1103 | pci_disable_device(pdev); |
| 1104 | |||
| 1105 | misc_deregister(&mei_misc_device); | ||
| 1104 | } | 1106 | } |
| 1105 | #ifdef CONFIG_PM | 1107 | #ifdef CONFIG_PM |
| 1106 | static int mei_pci_suspend(struct device *device) | 1108 | static int mei_pci_suspend(struct device *device) |
| @@ -1145,7 +1147,7 @@ static int mei_pci_resume(struct device *device) | |||
| 1145 | err = request_threaded_irq(pdev->irq, | 1147 | err = request_threaded_irq(pdev->irq, |
| 1146 | NULL, | 1148 | NULL, |
| 1147 | mei_interrupt_thread_handler, | 1149 | mei_interrupt_thread_handler, |
| 1148 | 0, mei_driver_name, dev); | 1150 | IRQF_ONESHOT, mei_driver_name, dev); |
| 1149 | else | 1151 | else |
| 1150 | err = request_threaded_irq(pdev->irq, | 1152 | err = request_threaded_irq(pdev->irq, |
| 1151 | mei_interrupt_quick_handler, | 1153 | mei_interrupt_quick_handler, |
| @@ -1216,7 +1218,6 @@ module_init(mei_init_module); | |||
| 1216 | */ | 1218 | */ |
| 1217 | static void __exit mei_exit_module(void) | 1219 | static void __exit mei_exit_module(void) |
| 1218 | { | 1220 | { |
| 1219 | misc_deregister(&mei_misc_device); | ||
| 1220 | pci_unregister_driver(&mei_driver); | 1221 | pci_unregister_driver(&mei_driver); |
| 1221 | 1222 | ||
| 1222 | pr_debug("unloaded successfully.\n"); | 1223 | pr_debug("unloaded successfully.\n"); |
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c index 6be5605707b4..e2ec0505eb5c 100644 --- a/drivers/misc/mei/wd.c +++ b/drivers/misc/mei/wd.c | |||
| @@ -341,7 +341,7 @@ static const struct watchdog_ops wd_ops = { | |||
| 341 | }; | 341 | }; |
| 342 | static const struct watchdog_info wd_info = { | 342 | static const struct watchdog_info wd_info = { |
| 343 | .identity = INTEL_AMT_WATCHDOG_ID, | 343 | .identity = INTEL_AMT_WATCHDOG_ID, |
| 344 | .options = WDIOF_KEEPALIVEPING, | 344 | .options = WDIOF_KEEPALIVEPING | WDIOF_ALARMONLY, |
| 345 | }; | 345 | }; |
| 346 | 346 | ||
| 347 | static struct watchdog_device amt_wd_dev = { | 347 | static struct watchdog_device amt_wd_dev = { |
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index 17bbacb1b4b1..87b251ab6ec5 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
| @@ -452,9 +452,9 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
| 452 | 452 | ||
| 453 | if (msg->activate_gru_mq_desc_gpa != | 453 | if (msg->activate_gru_mq_desc_gpa != |
| 454 | part_uv->activate_gru_mq_desc_gpa) { | 454 | part_uv->activate_gru_mq_desc_gpa) { |
| 455 | spin_lock_irqsave(&part_uv->flags_lock, irq_flags); | 455 | spin_lock(&part_uv->flags_lock); |
| 456 | part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV; | 456 | part_uv->flags &= ~XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV; |
| 457 | spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags); | 457 | spin_unlock(&part_uv->flags_lock); |
| 458 | part_uv->activate_gru_mq_desc_gpa = | 458 | part_uv->activate_gru_mq_desc_gpa = |
| 459 | msg->activate_gru_mq_desc_gpa; | 459 | msg->activate_gru_mq_desc_gpa; |
| 460 | } | 460 | } |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index dd2d374dcc7a..276d21ce6bc1 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -554,7 +554,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
| 554 | struct mmc_request mrq = {NULL}; | 554 | struct mmc_request mrq = {NULL}; |
| 555 | struct mmc_command cmd = {0}; | 555 | struct mmc_command cmd = {0}; |
| 556 | struct mmc_data data = {0}; | 556 | struct mmc_data data = {0}; |
| 557 | unsigned int timeout_us; | ||
| 558 | 557 | ||
| 559 | struct scatterlist sg; | 558 | struct scatterlist sg; |
| 560 | 559 | ||
| @@ -574,23 +573,12 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
| 574 | cmd.arg = 0; | 573 | cmd.arg = 0; |
| 575 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; | 574 | cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; |
| 576 | 575 | ||
| 577 | data.timeout_ns = card->csd.tacc_ns * 100; | ||
| 578 | data.timeout_clks = card->csd.tacc_clks * 100; | ||
| 579 | |||
| 580 | timeout_us = data.timeout_ns / 1000; | ||
| 581 | timeout_us += data.timeout_clks * 1000 / | ||
| 582 | (card->host->ios.clock / 1000); | ||
| 583 | |||
| 584 | if (timeout_us > 100000) { | ||
| 585 | data.timeout_ns = 100000000; | ||
| 586 | data.timeout_clks = 0; | ||
| 587 | } | ||
| 588 | |||
| 589 | data.blksz = 4; | 576 | data.blksz = 4; |
| 590 | data.blocks = 1; | 577 | data.blocks = 1; |
| 591 | data.flags = MMC_DATA_READ; | 578 | data.flags = MMC_DATA_READ; |
| 592 | data.sg = &sg; | 579 | data.sg = &sg; |
| 593 | data.sg_len = 1; | 580 | data.sg_len = 1; |
| 581 | mmc_set_data_timeout(&data, card); | ||
| 594 | 582 | ||
| 595 | mrq.cmd = &cmd; | 583 | mrq.cmd = &cmd; |
| 596 | mrq.data = &data; | 584 | mrq.data = &data; |
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index f13e38deceac..8f5dc08d6598 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c | |||
| @@ -50,8 +50,8 @@ int mmc_cd_gpio_request(struct mmc_host *host, unsigned int gpio) | |||
| 50 | goto egpioreq; | 50 | goto egpioreq; |
| 51 | 51 | ||
| 52 | ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt, | 52 | ret = request_threaded_irq(irq, NULL, mmc_cd_gpio_irqt, |
| 53 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 53 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | |
| 54 | cd->label, host); | 54 | IRQF_ONESHOT, cd->label, host); |
| 55 | if (ret < 0) | 55 | if (ret < 0) |
| 56 | goto eirqreq; | 56 | goto eirqreq; |
| 57 | 57 | ||
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 2d4a4b746750..4f4489aa6bae 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
| @@ -717,10 +717,6 @@ static int mmc_select_powerclass(struct mmc_card *card, | |||
| 717 | card->ext_csd.generic_cmd6_time); | 717 | card->ext_csd.generic_cmd6_time); |
| 718 | } | 718 | } |
| 719 | 719 | ||
| 720 | if (err) | ||
| 721 | pr_err("%s: power class selection for ext_csd_bus_width %d" | ||
| 722 | " failed\n", mmc_hostname(card->host), bus_width); | ||
| 723 | |||
| 724 | return err; | 720 | return err; |
| 725 | } | 721 | } |
| 726 | 722 | ||
| @@ -1104,7 +1100,9 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
| 1104 | EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; | 1100 | EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; |
| 1105 | err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); | 1101 | err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); |
| 1106 | if (err) | 1102 | if (err) |
| 1107 | goto err; | 1103 | pr_warning("%s: power class selection to bus width %d" |
| 1104 | " failed\n", mmc_hostname(card->host), | ||
| 1105 | 1 << bus_width); | ||
| 1108 | } | 1106 | } |
| 1109 | 1107 | ||
| 1110 | /* | 1108 | /* |
| @@ -1136,7 +1134,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
| 1136 | err = mmc_select_powerclass(card, ext_csd_bits[idx][0], | 1134 | err = mmc_select_powerclass(card, ext_csd_bits[idx][0], |
| 1137 | ext_csd); | 1135 | ext_csd); |
| 1138 | if (err) | 1136 | if (err) |
| 1139 | goto err; | 1137 | pr_warning("%s: power class selection to " |
| 1138 | "bus width %d failed\n", | ||
| 1139 | mmc_hostname(card->host), | ||
| 1140 | 1 << bus_width); | ||
| 1140 | 1141 | ||
| 1141 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1142 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
| 1142 | EXT_CSD_BUS_WIDTH, | 1143 | EXT_CSD_BUS_WIDTH, |
| @@ -1164,7 +1165,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
| 1164 | err = mmc_select_powerclass(card, ext_csd_bits[idx][1], | 1165 | err = mmc_select_powerclass(card, ext_csd_bits[idx][1], |
| 1165 | ext_csd); | 1166 | ext_csd); |
| 1166 | if (err) | 1167 | if (err) |
| 1167 | goto err; | 1168 | pr_warning("%s: power class selection to " |
| 1169 | "bus width %d ddr %d failed\n", | ||
| 1170 | mmc_hostname(card->host), | ||
| 1171 | 1 << bus_width, ddr); | ||
| 1168 | 1172 | ||
| 1169 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1173 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
| 1170 | EXT_CSD_BUS_WIDTH, | 1174 | EXT_CSD_BUS_WIDTH, |
| @@ -1326,7 +1330,7 @@ static int mmc_suspend(struct mmc_host *host) | |||
| 1326 | if (!err) | 1330 | if (!err) |
| 1327 | mmc_card_set_sleep(host->card); | 1331 | mmc_card_set_sleep(host->card); |
| 1328 | } else if (!mmc_host_is_spi(host)) | 1332 | } else if (!mmc_host_is_spi(host)) |
| 1329 | mmc_deselect_cards(host); | 1333 | err = mmc_deselect_cards(host); |
| 1330 | host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); | 1334 | host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200); |
| 1331 | mmc_release_host(host); | 1335 | mmc_release_host(host); |
| 1332 | 1336 | ||
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index c272c6868ecf..b2b43f624b9e 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
| @@ -1075,16 +1075,18 @@ static void mmc_sd_detect(struct mmc_host *host) | |||
| 1075 | */ | 1075 | */ |
| 1076 | static int mmc_sd_suspend(struct mmc_host *host) | 1076 | static int mmc_sd_suspend(struct mmc_host *host) |
| 1077 | { | 1077 | { |
| 1078 | int err = 0; | ||
| 1079 | |||
| 1078 | BUG_ON(!host); | 1080 | BUG_ON(!host); |
| 1079 | BUG_ON(!host->card); | 1081 | BUG_ON(!host->card); |
| 1080 | 1082 | ||
| 1081 | mmc_claim_host(host); | 1083 | mmc_claim_host(host); |
| 1082 | if (!mmc_host_is_spi(host)) | 1084 | if (!mmc_host_is_spi(host)) |
| 1083 | mmc_deselect_cards(host); | 1085 | err = mmc_deselect_cards(host); |
| 1084 | host->card->state &= ~MMC_STATE_HIGHSPEED; | 1086 | host->card->state &= ~MMC_STATE_HIGHSPEED; |
| 1085 | mmc_release_host(host); | 1087 | mmc_release_host(host); |
| 1086 | 1088 | ||
| 1087 | return 0; | 1089 | return err; |
| 1088 | } | 1090 | } |
| 1089 | 1091 | ||
| 1090 | /* | 1092 | /* |
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 13d0e95380ab..41c5fd8848f4 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
| @@ -218,6 +218,12 @@ static int sdio_enable_wide(struct mmc_card *card) | |||
| 218 | if (ret) | 218 | if (ret) |
| 219 | return ret; | 219 | return ret; |
| 220 | 220 | ||
| 221 | if ((ctrl & SDIO_BUS_WIDTH_MASK) == SDIO_BUS_WIDTH_RESERVED) | ||
| 222 | pr_warning("%s: SDIO_CCCR_IF is invalid: 0x%02x\n", | ||
| 223 | mmc_hostname(card->host), ctrl); | ||
| 224 | |||
| 225 | /* set as 4-bit bus width */ | ||
| 226 | ctrl &= ~SDIO_BUS_WIDTH_MASK; | ||
| 221 | ctrl |= SDIO_BUS_WIDTH_4BIT; | 227 | ctrl |= SDIO_BUS_WIDTH_4BIT; |
| 222 | 228 | ||
| 223 | ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL); | 229 | ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL); |
diff --git a/drivers/mmc/host/atmel-mci-regs.h b/drivers/mmc/host/atmel-mci-regs.h index 787aba1682bb..ab56f7db5315 100644 --- a/drivers/mmc/host/atmel-mci-regs.h +++ b/drivers/mmc/host/atmel-mci-regs.h | |||
| @@ -140,4 +140,18 @@ | |||
| 140 | #define atmci_writel(port,reg,value) \ | 140 | #define atmci_writel(port,reg,value) \ |
| 141 | __raw_writel((value), (port)->regs + reg) | 141 | __raw_writel((value), (port)->regs + reg) |
| 142 | 142 | ||
| 143 | /* | ||
| 144 | * Fix sconfig's burst size according to atmel MCI. We need to convert them as: | ||
| 145 | * 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3. | ||
| 146 | * | ||
| 147 | * This can be done by finding most significant bit set. | ||
| 148 | */ | ||
| 149 | static inline unsigned int atmci_convert_chksize(unsigned int maxburst) | ||
| 150 | { | ||
| 151 | if (maxburst > 1) | ||
| 152 | return fls(maxburst) - 2; | ||
| 153 | else | ||
| 154 | return 0; | ||
| 155 | } | ||
| 156 | |||
| 143 | #endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */ | 157 | #endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */ |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 420aca642b14..f2c115e06438 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
| @@ -910,6 +910,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
| 910 | enum dma_data_direction direction; | 910 | enum dma_data_direction direction; |
| 911 | enum dma_transfer_direction slave_dirn; | 911 | enum dma_transfer_direction slave_dirn; |
| 912 | unsigned int sglen; | 912 | unsigned int sglen; |
| 913 | u32 maxburst; | ||
| 913 | u32 iflags; | 914 | u32 iflags; |
| 914 | 915 | ||
| 915 | data->error = -EINPROGRESS; | 916 | data->error = -EINPROGRESS; |
| @@ -943,17 +944,18 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data) | |||
| 943 | if (!chan) | 944 | if (!chan) |
| 944 | return -ENODEV; | 945 | return -ENODEV; |
| 945 | 946 | ||
| 946 | if (host->caps.has_dma) | ||
| 947 | atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN); | ||
| 948 | |||
| 949 | if (data->flags & MMC_DATA_READ) { | 947 | if (data->flags & MMC_DATA_READ) { |
| 950 | direction = DMA_FROM_DEVICE; | 948 | direction = DMA_FROM_DEVICE; |
| 951 | host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM; | 949 | host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM; |
| 950 | maxburst = atmci_convert_chksize(host->dma_conf.src_maxburst); | ||
| 952 | } else { | 951 | } else { |
| 953 | direction = DMA_TO_DEVICE; | 952 | direction = DMA_TO_DEVICE; |
| 954 | host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV; | 953 | host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV; |
| 954 | maxburst = atmci_convert_chksize(host->dma_conf.dst_maxburst); | ||
| 955 | } | 955 | } |
| 956 | 956 | ||
| 957 | atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(maxburst) | ATMCI_DMAEN); | ||
| 958 | |||
| 957 | sglen = dma_map_sg(chan->device->dev, data->sg, | 959 | sglen = dma_map_sg(chan->device->dev, data->sg, |
| 958 | data->sg_len, direction); | 960 | data->sg_len, direction); |
| 959 | 961 | ||
| @@ -2314,6 +2316,8 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
| 2314 | 2316 | ||
| 2315 | platform_set_drvdata(pdev, host); | 2317 | platform_set_drvdata(pdev, host); |
| 2316 | 2318 | ||
| 2319 | setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host); | ||
| 2320 | |||
| 2317 | /* We need at least one slot to succeed */ | 2321 | /* We need at least one slot to succeed */ |
| 2318 | nr_slots = 0; | 2322 | nr_slots = 0; |
| 2319 | ret = -ENODEV; | 2323 | ret = -ENODEV; |
| @@ -2352,8 +2356,6 @@ static int __init atmci_probe(struct platform_device *pdev) | |||
| 2352 | } | 2356 | } |
| 2353 | } | 2357 | } |
| 2354 | 2358 | ||
| 2355 | setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host); | ||
| 2356 | |||
| 2357 | dev_info(&pdev->dev, | 2359 | dev_info(&pdev->dev, |
| 2358 | "Atmel MCI controller at 0x%08lx irq %d, %u slots\n", | 2360 | "Atmel MCI controller at 0x%08lx irq %d, %u slots\n", |
| 2359 | host->mapbase, irq, nr_slots); | 2361 | host->mapbase, irq, nr_slots); |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 9bbf45f8c538..1ca5e72ceb65 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
| @@ -418,6 +418,8 @@ static int dw_mci_idmac_init(struct dw_mci *host) | |||
| 418 | p->des3 = host->sg_dma; | 418 | p->des3 = host->sg_dma; |
| 419 | p->des0 = IDMAC_DES0_ER; | 419 | p->des0 = IDMAC_DES0_ER; |
| 420 | 420 | ||
| 421 | mci_writel(host, BMOD, SDMMC_IDMAC_SWRESET); | ||
| 422 | |||
| 421 | /* Mask out interrupts - get Tx & Rx complete only */ | 423 | /* Mask out interrupts - get Tx & Rx complete only */ |
| 422 | mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI | | 424 | mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI | |
| 423 | SDMMC_IDMAC_INT_TI); | 425 | SDMMC_IDMAC_INT_TI); |
| @@ -615,14 +617,15 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot) | |||
| 615 | u32 div; | 617 | u32 div; |
| 616 | 618 | ||
| 617 | if (slot->clock != host->current_speed) { | 619 | if (slot->clock != host->current_speed) { |
| 618 | if (host->bus_hz % slot->clock) | 620 | div = host->bus_hz / slot->clock; |
| 621 | if (host->bus_hz % slot->clock && host->bus_hz > slot->clock) | ||
| 619 | /* | 622 | /* |
| 620 | * move the + 1 after the divide to prevent | 623 | * move the + 1 after the divide to prevent |
| 621 | * over-clocking the card. | 624 | * over-clocking the card. |
| 622 | */ | 625 | */ |
| 623 | div = ((host->bus_hz / slot->clock) >> 1) + 1; | 626 | div += 1; |
| 624 | else | 627 | |
| 625 | div = (host->bus_hz / slot->clock) >> 1; | 628 | div = (host->bus_hz != slot->clock) ? DIV_ROUND_UP(div, 2) : 0; |
| 626 | 629 | ||
| 627 | dev_info(&slot->mmc->class_dev, | 630 | dev_info(&slot->mmc->class_dev, |
| 628 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ" | 631 | "Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ" |
| @@ -939,8 +942,8 @@ static void dw_mci_command_complete(struct dw_mci *host, struct mmc_command *cmd | |||
| 939 | mdelay(20); | 942 | mdelay(20); |
| 940 | 943 | ||
| 941 | if (cmd->data) { | 944 | if (cmd->data) { |
| 942 | host->data = NULL; | ||
| 943 | dw_mci_stop_dma(host); | 945 | dw_mci_stop_dma(host); |
| 946 | host->data = NULL; | ||
| 944 | } | 947 | } |
| 945 | } | 948 | } |
| 946 | } | 949 | } |
| @@ -1623,7 +1626,6 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) | |||
| 1623 | if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) { | 1626 | if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) { |
| 1624 | mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI); | 1627 | mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI); |
| 1625 | mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI); | 1628 | mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI); |
| 1626 | set_bit(EVENT_DATA_COMPLETE, &host->pending_events); | ||
| 1627 | host->dma_ops->complete(host); | 1629 | host->dma_ops->complete(host); |
| 1628 | } | 1630 | } |
| 1629 | #endif | 1631 | #endif |
| @@ -1725,7 +1727,8 @@ static void dw_mci_work_routine_card(struct work_struct *work) | |||
| 1725 | 1727 | ||
| 1726 | #ifdef CONFIG_MMC_DW_IDMAC | 1728 | #ifdef CONFIG_MMC_DW_IDMAC |
| 1727 | ctrl = mci_readl(host, BMOD); | 1729 | ctrl = mci_readl(host, BMOD); |
| 1728 | ctrl |= 0x01; /* Software reset of DMA */ | 1730 | /* Software reset of DMA */ |
| 1731 | ctrl |= SDMMC_IDMAC_SWRESET; | ||
| 1729 | mci_writel(host, BMOD, ctrl); | 1732 | mci_writel(host, BMOD, ctrl); |
| 1730 | #endif | 1733 | #endif |
| 1731 | 1734 | ||
| @@ -1950,10 +1953,6 @@ int dw_mci_probe(struct dw_mci *host) | |||
| 1950 | spin_lock_init(&host->lock); | 1953 | spin_lock_init(&host->lock); |
| 1951 | INIT_LIST_HEAD(&host->queue); | 1954 | INIT_LIST_HEAD(&host->queue); |
| 1952 | 1955 | ||
| 1953 | |||
| 1954 | host->dma_ops = host->pdata->dma_ops; | ||
| 1955 | dw_mci_init_dma(host); | ||
| 1956 | |||
| 1957 | /* | 1956 | /* |
| 1958 | * Get the host data width - this assumes that HCON has been set with | 1957 | * Get the host data width - this assumes that HCON has been set with |
| 1959 | * the correct values. | 1958 | * the correct values. |
| @@ -1981,10 +1980,11 @@ int dw_mci_probe(struct dw_mci *host) | |||
| 1981 | } | 1980 | } |
| 1982 | 1981 | ||
| 1983 | /* Reset all blocks */ | 1982 | /* Reset all blocks */ |
| 1984 | if (!mci_wait_reset(&host->dev, host)) { | 1983 | if (!mci_wait_reset(&host->dev, host)) |
| 1985 | ret = -ENODEV; | 1984 | return -ENODEV; |
| 1986 | goto err_dmaunmap; | 1985 | |
| 1987 | } | 1986 | host->dma_ops = host->pdata->dma_ops; |
| 1987 | dw_mci_init_dma(host); | ||
| 1988 | 1988 | ||
| 1989 | /* Clear the interrupts for the host controller */ | 1989 | /* Clear the interrupts for the host controller */ |
| 1990 | mci_writel(host, RINTSTS, 0xFFFFFFFF); | 1990 | mci_writel(host, RINTSTS, 0xFFFFFFFF); |
| @@ -2170,14 +2170,14 @@ int dw_mci_resume(struct dw_mci *host) | |||
| 2170 | if (host->vmmc) | 2170 | if (host->vmmc) |
| 2171 | regulator_enable(host->vmmc); | 2171 | regulator_enable(host->vmmc); |
| 2172 | 2172 | ||
| 2173 | if (host->dma_ops->init) | ||
| 2174 | host->dma_ops->init(host); | ||
| 2175 | |||
| 2176 | if (!mci_wait_reset(&host->dev, host)) { | 2173 | if (!mci_wait_reset(&host->dev, host)) { |
| 2177 | ret = -ENODEV; | 2174 | ret = -ENODEV; |
| 2178 | return ret; | 2175 | return ret; |
| 2179 | } | 2176 | } |
| 2180 | 2177 | ||
| 2178 | if (host->dma_ops->init) | ||
| 2179 | host->dma_ops->init(host); | ||
| 2180 | |||
| 2181 | /* Restore the old value at FIFOTH register */ | 2181 | /* Restore the old value at FIFOTH register */ |
| 2182 | mci_writel(host, FIFOTH, host->fifoth_val); | 2182 | mci_writel(host, FIFOTH, host->fifoth_val); |
| 2183 | 2183 | ||
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index f0fcce40cd8d..50ff19a62368 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
| @@ -1216,12 +1216,7 @@ static void mmci_dt_populate_generic_pdata(struct device_node *np, | |||
| 1216 | int bus_width = 0; | 1216 | int bus_width = 0; |
| 1217 | 1217 | ||
| 1218 | pdata->gpio_wp = of_get_named_gpio(np, "wp-gpios", 0); | 1218 | pdata->gpio_wp = of_get_named_gpio(np, "wp-gpios", 0); |
| 1219 | if (!pdata->gpio_wp) | ||
| 1220 | pdata->gpio_wp = -1; | ||
| 1221 | |||
| 1222 | pdata->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0); | 1219 | pdata->gpio_cd = of_get_named_gpio(np, "cd-gpios", 0); |
| 1223 | if (!pdata->gpio_cd) | ||
| 1224 | pdata->gpio_cd = -1; | ||
| 1225 | 1220 | ||
| 1226 | if (of_get_property(np, "cd-inverted", NULL)) | 1221 | if (of_get_property(np, "cd-inverted", NULL)) |
| 1227 | pdata->cd_invert = true; | 1222 | pdata->cd_invert = true; |
| @@ -1276,6 +1271,12 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
| 1276 | return -EINVAL; | 1271 | return -EINVAL; |
| 1277 | } | 1272 | } |
| 1278 | 1273 | ||
| 1274 | if (!plat) { | ||
| 1275 | plat = devm_kzalloc(&dev->dev, sizeof(*plat), GFP_KERNEL); | ||
| 1276 | if (!plat) | ||
| 1277 | return -ENOMEM; | ||
| 1278 | } | ||
| 1279 | |||
| 1279 | if (np) | 1280 | if (np) |
| 1280 | mmci_dt_populate_generic_pdata(np, plat); | 1281 | mmci_dt_populate_generic_pdata(np, plat); |
| 1281 | 1282 | ||
| @@ -1424,6 +1425,10 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
| 1424 | writel(0, host->base + MMCIMASK1); | 1425 | writel(0, host->base + MMCIMASK1); |
| 1425 | writel(0xfff, host->base + MMCICLEAR); | 1426 | writel(0xfff, host->base + MMCICLEAR); |
| 1426 | 1427 | ||
| 1428 | if (plat->gpio_cd == -EPROBE_DEFER) { | ||
| 1429 | ret = -EPROBE_DEFER; | ||
| 1430 | goto err_gpio_cd; | ||
| 1431 | } | ||
| 1427 | if (gpio_is_valid(plat->gpio_cd)) { | 1432 | if (gpio_is_valid(plat->gpio_cd)) { |
| 1428 | ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); | 1433 | ret = gpio_request(plat->gpio_cd, DRIVER_NAME " (cd)"); |
| 1429 | if (ret == 0) | 1434 | if (ret == 0) |
| @@ -1447,6 +1452,10 @@ static int __devinit mmci_probe(struct amba_device *dev, | |||
| 1447 | if (ret >= 0) | 1452 | if (ret >= 0) |
| 1448 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); | 1453 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); |
| 1449 | } | 1454 | } |
| 1455 | if (plat->gpio_wp == -EPROBE_DEFER) { | ||
| 1456 | ret = -EPROBE_DEFER; | ||
| 1457 | goto err_gpio_wp; | ||
| 1458 | } | ||
| 1450 | if (gpio_is_valid(plat->gpio_wp)) { | 1459 | if (gpio_is_valid(plat->gpio_wp)) { |
| 1451 | ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); | 1460 | ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); |
| 1452 | if (ret == 0) | 1461 | if (ret == 0) |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index 34a90266ab11..277161d279b8 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
| @@ -894,8 +894,8 @@ static struct platform_driver mxs_mmc_driver = { | |||
| 894 | .owner = THIS_MODULE, | 894 | .owner = THIS_MODULE, |
| 895 | #ifdef CONFIG_PM | 895 | #ifdef CONFIG_PM |
| 896 | .pm = &mxs_mmc_pm_ops, | 896 | .pm = &mxs_mmc_pm_ops, |
| 897 | .of_match_table = mxs_mmc_dt_ids, | ||
| 898 | #endif | 897 | #endif |
| 898 | .of_match_table = mxs_mmc_dt_ids, | ||
| 899 | }, | 899 | }, |
| 900 | }; | 900 | }; |
| 901 | 901 | ||
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c index 552196c764d4..3e8dcf8d2e05 100644 --- a/drivers/mmc/host/omap.c +++ b/drivers/mmc/host/omap.c | |||
| @@ -1300,7 +1300,7 @@ static const struct mmc_host_ops mmc_omap_ops = { | |||
| 1300 | .set_ios = mmc_omap_set_ios, | 1300 | .set_ios = mmc_omap_set_ios, |
| 1301 | }; | 1301 | }; |
| 1302 | 1302 | ||
| 1303 | static int __init mmc_omap_new_slot(struct mmc_omap_host *host, int id) | 1303 | static int __devinit mmc_omap_new_slot(struct mmc_omap_host *host, int id) |
| 1304 | { | 1304 | { |
| 1305 | struct mmc_omap_slot *slot = NULL; | 1305 | struct mmc_omap_slot *slot = NULL; |
| 1306 | struct mmc_host *mmc; | 1306 | struct mmc_host *mmc; |
| @@ -1485,24 +1485,26 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev) | |||
| 1485 | } | 1485 | } |
| 1486 | 1486 | ||
| 1487 | host->nr_slots = pdata->nr_slots; | 1487 | host->nr_slots = pdata->nr_slots; |
| 1488 | host->reg_shift = (cpu_is_omap7xx() ? 1 : 2); | ||
| 1489 | |||
| 1490 | host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0); | ||
| 1491 | if (!host->mmc_omap_wq) | ||
| 1492 | goto err_plat_cleanup; | ||
| 1493 | |||
| 1488 | for (i = 0; i < pdata->nr_slots; i++) { | 1494 | for (i = 0; i < pdata->nr_slots; i++) { |
| 1489 | ret = mmc_omap_new_slot(host, i); | 1495 | ret = mmc_omap_new_slot(host, i); |
| 1490 | if (ret < 0) { | 1496 | if (ret < 0) { |
| 1491 | while (--i >= 0) | 1497 | while (--i >= 0) |
| 1492 | mmc_omap_remove_slot(host->slots[i]); | 1498 | mmc_omap_remove_slot(host->slots[i]); |
| 1493 | 1499 | ||
| 1494 | goto err_plat_cleanup; | 1500 | goto err_destroy_wq; |
| 1495 | } | 1501 | } |
| 1496 | } | 1502 | } |
| 1497 | 1503 | ||
| 1498 | host->reg_shift = (cpu_is_omap7xx() ? 1 : 2); | ||
| 1499 | |||
| 1500 | host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0); | ||
| 1501 | if (!host->mmc_omap_wq) | ||
| 1502 | goto err_plat_cleanup; | ||
| 1503 | |||
| 1504 | return 0; | 1504 | return 0; |
| 1505 | 1505 | ||
| 1506 | err_destroy_wq: | ||
| 1507 | destroy_workqueue(host->mmc_omap_wq); | ||
| 1506 | err_plat_cleanup: | 1508 | err_plat_cleanup: |
| 1507 | if (pdata->cleanup) | 1509 | if (pdata->cleanup) |
| 1508 | pdata->cleanup(&pdev->dev); | 1510 | pdata->cleanup(&pdev->dev); |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 9a7a60aeb19e..389a3eedfc24 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
| @@ -85,7 +85,6 @@ | |||
| 85 | #define BRR_ENABLE (1 << 5) | 85 | #define BRR_ENABLE (1 << 5) |
| 86 | #define DTO_ENABLE (1 << 20) | 86 | #define DTO_ENABLE (1 << 20) |
| 87 | #define INIT_STREAM (1 << 1) | 87 | #define INIT_STREAM (1 << 1) |
| 88 | #define ACEN_ACMD12 (1 << 2) | ||
| 89 | #define DP_SELECT (1 << 21) | 88 | #define DP_SELECT (1 << 21) |
| 90 | #define DDIR (1 << 4) | 89 | #define DDIR (1 << 4) |
| 91 | #define DMA_EN 0x1 | 90 | #define DMA_EN 0x1 |
| @@ -117,7 +116,6 @@ | |||
| 117 | #define OMAP_MMC_MAX_CLOCK 52000000 | 116 | #define OMAP_MMC_MAX_CLOCK 52000000 |
| 118 | #define DRIVER_NAME "omap_hsmmc" | 117 | #define DRIVER_NAME "omap_hsmmc" |
| 119 | 118 | ||
| 120 | #define AUTO_CMD12 (1 << 0) /* Auto CMD12 support */ | ||
| 121 | /* | 119 | /* |
| 122 | * One controller can have multiple slots, like on some omap boards using | 120 | * One controller can have multiple slots, like on some omap boards using |
| 123 | * omap.c controller driver. Luckily this is not currently done on any known | 121 | * omap.c controller driver. Luckily this is not currently done on any known |
| @@ -177,7 +175,6 @@ struct omap_hsmmc_host { | |||
| 177 | int reqs_blocked; | 175 | int reqs_blocked; |
| 178 | int use_reg; | 176 | int use_reg; |
| 179 | int req_in_progress; | 177 | int req_in_progress; |
| 180 | unsigned int flags; | ||
| 181 | struct omap_hsmmc_next next_data; | 178 | struct omap_hsmmc_next next_data; |
| 182 | 179 | ||
| 183 | struct omap_mmc_platform_data *pdata; | 180 | struct omap_mmc_platform_data *pdata; |
| @@ -773,8 +770,6 @@ omap_hsmmc_start_command(struct omap_hsmmc_host *host, struct mmc_command *cmd, | |||
| 773 | cmdtype = 0x3; | 770 | cmdtype = 0x3; |
| 774 | 771 | ||
| 775 | cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22); | 772 | cmdreg = (cmd->opcode << 24) | (resptype << 16) | (cmdtype << 22); |
| 776 | if ((host->flags & AUTO_CMD12) && mmc_op_multi(cmd->opcode)) | ||
| 777 | cmdreg |= ACEN_ACMD12; | ||
| 778 | 773 | ||
| 779 | if (data) { | 774 | if (data) { |
| 780 | cmdreg |= DP_SELECT | MSBS | BCE; | 775 | cmdreg |= DP_SELECT | MSBS | BCE; |
| @@ -847,14 +842,11 @@ omap_hsmmc_xfer_done(struct omap_hsmmc_host *host, struct mmc_data *data) | |||
| 847 | else | 842 | else |
| 848 | data->bytes_xfered = 0; | 843 | data->bytes_xfered = 0; |
| 849 | 844 | ||
| 850 | if (data->stop && ((!(host->flags & AUTO_CMD12)) || data->error)) { | 845 | if (!data->stop) { |
| 851 | omap_hsmmc_start_command(host, data->stop, NULL); | ||
| 852 | } else { | ||
| 853 | if (data->stop) | ||
| 854 | data->stop->resp[0] = OMAP_HSMMC_READ(host->base, | ||
| 855 | RSP76); | ||
| 856 | omap_hsmmc_request_done(host, data->mrq); | 846 | omap_hsmmc_request_done(host, data->mrq); |
| 847 | return; | ||
| 857 | } | 848 | } |
| 849 | omap_hsmmc_start_command(host, data->stop, NULL); | ||
| 858 | } | 850 | } |
| 859 | 851 | ||
| 860 | /* | 852 | /* |
| @@ -1859,7 +1851,6 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev) | |||
| 1859 | host->mapbase = res->start + pdata->reg_offset; | 1851 | host->mapbase = res->start + pdata->reg_offset; |
| 1860 | host->base = ioremap(host->mapbase, SZ_4K); | 1852 | host->base = ioremap(host->mapbase, SZ_4K); |
| 1861 | host->power_mode = MMC_POWER_OFF; | 1853 | host->power_mode = MMC_POWER_OFF; |
| 1862 | host->flags = AUTO_CMD12; | ||
| 1863 | host->next_data.cookie = 1; | 1854 | host->next_data.cookie = 1; |
| 1864 | 1855 | ||
| 1865 | platform_set_drvdata(pdev, host); | 1856 | platform_set_drvdata(pdev, host); |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 55a164fcaa15..a50c205ea208 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
| @@ -404,7 +404,7 @@ static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc) | |||
| 404 | if (sc->ext_cd_irq && | 404 | if (sc->ext_cd_irq && |
| 405 | request_threaded_irq(sc->ext_cd_irq, NULL, | 405 | request_threaded_irq(sc->ext_cd_irq, NULL, |
| 406 | sdhci_s3c_gpio_card_detect_thread, | 406 | sdhci_s3c_gpio_card_detect_thread, |
| 407 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 407 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 408 | dev_name(dev), sc) == 0) { | 408 | dev_name(dev), sc) == 0) { |
| 409 | int status = gpio_get_value(sc->ext_cd_gpio); | 409 | int status = gpio_get_value(sc->ext_cd_gpio); |
| 410 | if (pdata->ext_cd_gpio_invert) | 410 | if (pdata->ext_cd_gpio_invert) |
diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c index 1fe32dfa7cd4..423da8194cd8 100644 --- a/drivers/mmc/host/sdhci-spear.c +++ b/drivers/mmc/host/sdhci-spear.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Support of SDHCI platform devices for spear soc family | 4 | * Support of SDHCI platform devices for spear soc family |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2010 ST Microelectronics | 6 | * Copyright (C) 2010 ST Microelectronics |
| 7 | * Viresh Kumar<viresh.kumar@st.com> | 7 | * Viresh Kumar <viresh.linux@gmail.com> |
| 8 | * | 8 | * |
| 9 | * Inspired by sdhci-pltfm.c | 9 | * Inspired by sdhci-pltfm.c |
| 10 | * | 10 | * |
| @@ -289,5 +289,5 @@ static struct platform_driver sdhci_driver = { | |||
| 289 | module_platform_driver(sdhci_driver); | 289 | module_platform_driver(sdhci_driver); |
| 290 | 290 | ||
| 291 | MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); | 291 | MODULE_DESCRIPTION("SPEAr Secure Digital Host Controller Interface driver"); |
| 292 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 292 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
| 293 | MODULE_LICENSE("GPL v2"); | 293 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index e626732aff77..f4b8b4db3a9a 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
| @@ -680,8 +680,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd) | |||
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | if (count >= 0xF) { | 682 | if (count >= 0xF) { |
| 683 | pr_warning("%s: Too large timeout 0x%x requested for CMD%d!\n", | 683 | DBG("%s: Too large timeout 0x%x requested for CMD%d!\n", |
| 684 | mmc_hostname(host->mmc), count, cmd->opcode); | 684 | mmc_hostname(host->mmc), count, cmd->opcode); |
| 685 | count = 0xE; | 685 | count = 0xE; |
| 686 | } | 686 | } |
| 687 | 687 | ||
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index ae36d7e1e913..551e316e4454 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c | |||
| @@ -304,32 +304,17 @@ static void find_next_position(struct mtdoops_context *cxt) | |||
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | static void mtdoops_do_dump(struct kmsg_dumper *dumper, | 306 | static void mtdoops_do_dump(struct kmsg_dumper *dumper, |
| 307 | enum kmsg_dump_reason reason, const char *s1, unsigned long l1, | 307 | enum kmsg_dump_reason reason) |
| 308 | const char *s2, unsigned long l2) | ||
| 309 | { | 308 | { |
| 310 | struct mtdoops_context *cxt = container_of(dumper, | 309 | struct mtdoops_context *cxt = container_of(dumper, |
| 311 | struct mtdoops_context, dump); | 310 | struct mtdoops_context, dump); |
| 312 | unsigned long s1_start, s2_start; | ||
| 313 | unsigned long l1_cpy, l2_cpy; | ||
| 314 | char *dst; | ||
| 315 | |||
| 316 | if (reason != KMSG_DUMP_OOPS && | ||
| 317 | reason != KMSG_DUMP_PANIC) | ||
| 318 | return; | ||
| 319 | 311 | ||
| 320 | /* Only dump oopses if dump_oops is set */ | 312 | /* Only dump oopses if dump_oops is set */ |
| 321 | if (reason == KMSG_DUMP_OOPS && !dump_oops) | 313 | if (reason == KMSG_DUMP_OOPS && !dump_oops) |
| 322 | return; | 314 | return; |
| 323 | 315 | ||
| 324 | dst = cxt->oops_buf + MTDOOPS_HEADER_SIZE; /* Skip the header */ | 316 | kmsg_dump_get_buffer(dumper, true, cxt->oops_buf + MTDOOPS_HEADER_SIZE, |
| 325 | l2_cpy = min(l2, record_size - MTDOOPS_HEADER_SIZE); | 317 | record_size - MTDOOPS_HEADER_SIZE, NULL); |
| 326 | l1_cpy = min(l1, record_size - MTDOOPS_HEADER_SIZE - l2_cpy); | ||
| 327 | |||
| 328 | s2_start = l2 - l2_cpy; | ||
| 329 | s1_start = l1 - l1_cpy; | ||
| 330 | |||
| 331 | memcpy(dst, s1 + s1_start, l1_cpy); | ||
| 332 | memcpy(dst + l1_cpy, s2 + s2_start, l2_cpy); | ||
| 333 | 318 | ||
| 334 | /* Panics must be written immediately */ | 319 | /* Panics must be written immediately */ |
| 335 | if (reason != KMSG_DUMP_OOPS) | 320 | if (reason != KMSG_DUMP_OOPS) |
| @@ -375,6 +360,7 @@ static void mtdoops_notify_add(struct mtd_info *mtd) | |||
| 375 | return; | 360 | return; |
| 376 | } | 361 | } |
| 377 | 362 | ||
| 363 | cxt->dump.max_reason = KMSG_DUMP_OOPS; | ||
| 378 | cxt->dump.dump = mtdoops_do_dump; | 364 | cxt->dump.dump = mtdoops_do_dump; |
| 379 | err = kmsg_dump_register(&cxt->dump); | 365 | err = kmsg_dump_register(&cxt->dump); |
| 380 | if (err) { | 366 | if (err) { |
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c index 41371ba1a811..f3f6cfedd69e 100644 --- a/drivers/mtd/nand/cafe_nand.c +++ b/drivers/mtd/nand/cafe_nand.c | |||
| @@ -102,7 +102,7 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; | |||
| 102 | static int cafe_device_ready(struct mtd_info *mtd) | 102 | static int cafe_device_ready(struct mtd_info *mtd) |
| 103 | { | 103 | { |
| 104 | struct cafe_priv *cafe = mtd->priv; | 104 | struct cafe_priv *cafe = mtd->priv; |
| 105 | int result = !!(cafe_readl(cafe, NAND_STATUS) | 0x40000000); | 105 | int result = !!(cafe_readl(cafe, NAND_STATUS) & 0x40000000); |
| 106 | uint32_t irqs = cafe_readl(cafe, NAND_IRQ); | 106 | uint32_t irqs = cafe_readl(cafe, NAND_IRQ); |
| 107 | 107 | ||
| 108 | cafe_writel(cafe, irqs, NAND_IRQ); | 108 | cafe_writel(cafe, irqs, NAND_IRQ); |
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index a05b7b444d4f..a6cad5caba78 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
| @@ -920,12 +920,12 @@ static int gpmi_ecc_read_page(struct mtd_info *mtd, struct nand_chip *chip, | |||
| 920 | */ | 920 | */ |
| 921 | memset(chip->oob_poi, ~0, mtd->oobsize); | 921 | memset(chip->oob_poi, ~0, mtd->oobsize); |
| 922 | chip->oob_poi[0] = ((uint8_t *) auxiliary_virt)[0]; | 922 | chip->oob_poi[0] = ((uint8_t *) auxiliary_virt)[0]; |
| 923 | |||
| 924 | read_page_swap_end(this, buf, mtd->writesize, | ||
| 925 | this->payload_virt, this->payload_phys, | ||
| 926 | nfc_geo->payload_size, | ||
| 927 | payload_virt, payload_phys); | ||
| 928 | } | 923 | } |
| 924 | |||
| 925 | read_page_swap_end(this, buf, mtd->writesize, | ||
| 926 | this->payload_virt, this->payload_phys, | ||
| 927 | nfc_geo->payload_size, | ||
| 928 | payload_virt, payload_phys); | ||
| 929 | exit_nfc: | 929 | exit_nfc: |
| 930 | return ret; | 930 | return ret; |
| 931 | } | 931 | } |
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index c58e6a93f445..6acc790c2fbb 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
| @@ -273,6 +273,26 @@ static struct nand_ecclayout nandv2_hw_eccoob_4k = { | |||
| 273 | 273 | ||
| 274 | static const char *part_probes[] = { "RedBoot", "cmdlinepart", "ofpart", NULL }; | 274 | static const char *part_probes[] = { "RedBoot", "cmdlinepart", "ofpart", NULL }; |
| 275 | 275 | ||
| 276 | static void memcpy32_fromio(void *trg, const void __iomem *src, size_t size) | ||
| 277 | { | ||
| 278 | int i; | ||
| 279 | u32 *t = trg; | ||
| 280 | const __iomem u32 *s = src; | ||
| 281 | |||
| 282 | for (i = 0; i < (size >> 2); i++) | ||
| 283 | *t++ = __raw_readl(s++); | ||
| 284 | } | ||
| 285 | |||
| 286 | static void memcpy32_toio(void __iomem *trg, const void *src, int size) | ||
| 287 | { | ||
| 288 | int i; | ||
| 289 | u32 __iomem *t = trg; | ||
| 290 | const u32 *s = src; | ||
| 291 | |||
| 292 | for (i = 0; i < (size >> 2); i++) | ||
| 293 | __raw_writel(*s++, t++); | ||
| 294 | } | ||
| 295 | |||
| 276 | static int check_int_v3(struct mxc_nand_host *host) | 296 | static int check_int_v3(struct mxc_nand_host *host) |
| 277 | { | 297 | { |
| 278 | uint32_t tmp; | 298 | uint32_t tmp; |
| @@ -519,7 +539,7 @@ static void send_read_id_v3(struct mxc_nand_host *host) | |||
| 519 | 539 | ||
| 520 | wait_op_done(host, true); | 540 | wait_op_done(host, true); |
| 521 | 541 | ||
| 522 | memcpy_fromio(host->data_buf, host->main_area0, 16); | 542 | memcpy32_fromio(host->data_buf, host->main_area0, 16); |
| 523 | } | 543 | } |
| 524 | 544 | ||
| 525 | /* Request the NANDFC to perform a read of the NAND device ID. */ | 545 | /* Request the NANDFC to perform a read of the NAND device ID. */ |
| @@ -535,7 +555,7 @@ static void send_read_id_v1_v2(struct mxc_nand_host *host) | |||
| 535 | /* Wait for operation to complete */ | 555 | /* Wait for operation to complete */ |
| 536 | wait_op_done(host, true); | 556 | wait_op_done(host, true); |
| 537 | 557 | ||
| 538 | memcpy_fromio(host->data_buf, host->main_area0, 16); | 558 | memcpy32_fromio(host->data_buf, host->main_area0, 16); |
| 539 | 559 | ||
| 540 | if (this->options & NAND_BUSWIDTH_16) { | 560 | if (this->options & NAND_BUSWIDTH_16) { |
| 541 | /* compress the ID info */ | 561 | /* compress the ID info */ |
| @@ -797,16 +817,16 @@ static void copy_spare(struct mtd_info *mtd, bool bfrom) | |||
| 797 | 817 | ||
| 798 | if (bfrom) { | 818 | if (bfrom) { |
| 799 | for (i = 0; i < n - 1; i++) | 819 | for (i = 0; i < n - 1; i++) |
| 800 | memcpy_fromio(d + i * j, s + i * t, j); | 820 | memcpy32_fromio(d + i * j, s + i * t, j); |
| 801 | 821 | ||
| 802 | /* the last section */ | 822 | /* the last section */ |
| 803 | memcpy_fromio(d + i * j, s + i * t, mtd->oobsize - i * j); | 823 | memcpy32_fromio(d + i * j, s + i * t, mtd->oobsize - i * j); |
| 804 | } else { | 824 | } else { |
| 805 | for (i = 0; i < n - 1; i++) | 825 | for (i = 0; i < n - 1; i++) |
| 806 | memcpy_toio(&s[i * t], &d[i * j], j); | 826 | memcpy32_toio(&s[i * t], &d[i * j], j); |
| 807 | 827 | ||
| 808 | /* the last section */ | 828 | /* the last section */ |
| 809 | memcpy_toio(&s[i * t], &d[i * j], mtd->oobsize - i * j); | 829 | memcpy32_toio(&s[i * t], &d[i * j], mtd->oobsize - i * j); |
| 810 | } | 830 | } |
| 811 | } | 831 | } |
| 812 | 832 | ||
| @@ -1070,7 +1090,8 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
| 1070 | 1090 | ||
| 1071 | host->devtype_data->send_page(mtd, NFC_OUTPUT); | 1091 | host->devtype_data->send_page(mtd, NFC_OUTPUT); |
| 1072 | 1092 | ||
| 1073 | memcpy_fromio(host->data_buf, host->main_area0, mtd->writesize); | 1093 | memcpy32_fromio(host->data_buf, host->main_area0, |
| 1094 | mtd->writesize); | ||
| 1074 | copy_spare(mtd, true); | 1095 | copy_spare(mtd, true); |
| 1075 | break; | 1096 | break; |
| 1076 | 1097 | ||
| @@ -1086,7 +1107,7 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command, | |||
| 1086 | break; | 1107 | break; |
| 1087 | 1108 | ||
| 1088 | case NAND_CMD_PAGEPROG: | 1109 | case NAND_CMD_PAGEPROG: |
| 1089 | memcpy_toio(host->main_area0, host->data_buf, mtd->writesize); | 1110 | memcpy32_toio(host->main_area0, host->data_buf, mtd->writesize); |
| 1090 | copy_spare(mtd, false); | 1111 | copy_spare(mtd, false); |
| 1091 | host->devtype_data->send_page(mtd, NFC_INPUT); | 1112 | host->devtype_data->send_page(mtd, NFC_INPUT); |
| 1092 | host->devtype_data->send_cmd(host, command, true); | 1113 | host->devtype_data->send_cmd(host, command, true); |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index d47586cf64ce..a11253a0fcab 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
| @@ -3501,6 +3501,13 @@ int nand_scan_tail(struct mtd_info *mtd) | |||
| 3501 | /* propagate ecc info to mtd_info */ | 3501 | /* propagate ecc info to mtd_info */ |
| 3502 | mtd->ecclayout = chip->ecc.layout; | 3502 | mtd->ecclayout = chip->ecc.layout; |
| 3503 | mtd->ecc_strength = chip->ecc.strength; | 3503 | mtd->ecc_strength = chip->ecc.strength; |
| 3504 | /* | ||
| 3505 | * Initialize bitflip_threshold to its default prior scan_bbt() call. | ||
| 3506 | * scan_bbt() might invoke mtd_read(), thus bitflip_threshold must be | ||
| 3507 | * properly set. | ||
| 3508 | */ | ||
| 3509 | if (!mtd->bitflip_threshold) | ||
| 3510 | mtd->bitflip_threshold = mtd->ecc_strength; | ||
| 3504 | 3511 | ||
| 3505 | /* Check, if we should skip the bad block table scan */ | 3512 | /* Check, if we should skip the bad block table scan */ |
| 3506 | if (chip->options & NAND_SKIP_BBTSCAN) | 3513 | if (chip->options & NAND_SKIP_BBTSCAN) |
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 6cc8fbfabb8e..cf0cd3146817 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
| 29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
| 30 | #include <linux/vmalloc.h> | 30 | #include <linux/vmalloc.h> |
| 31 | #include <asm/div64.h> | 31 | #include <linux/math64.h> |
| 32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
| 33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
| 34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
| @@ -546,12 +546,6 @@ static char *get_partition_name(int i) | |||
| 546 | return kstrdup(buf, GFP_KERNEL); | 546 | return kstrdup(buf, GFP_KERNEL); |
| 547 | } | 547 | } |
| 548 | 548 | ||
| 549 | static uint64_t divide(uint64_t n, uint32_t d) | ||
| 550 | { | ||
| 551 | do_div(n, d); | ||
| 552 | return n; | ||
| 553 | } | ||
| 554 | |||
| 555 | /* | 549 | /* |
| 556 | * Initialize the nandsim structure. | 550 | * Initialize the nandsim structure. |
| 557 | * | 551 | * |
| @@ -580,7 +574,7 @@ static int init_nandsim(struct mtd_info *mtd) | |||
| 580 | ns->geom.oobsz = mtd->oobsize; | 574 | ns->geom.oobsz = mtd->oobsize; |
| 581 | ns->geom.secsz = mtd->erasesize; | 575 | ns->geom.secsz = mtd->erasesize; |
| 582 | ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; | 576 | ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; |
| 583 | ns->geom.pgnum = divide(ns->geom.totsz, ns->geom.pgsz); | 577 | ns->geom.pgnum = div_u64(ns->geom.totsz, ns->geom.pgsz); |
| 584 | ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz; | 578 | ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz; |
| 585 | ns->geom.secshift = ffs(ns->geom.secsz) - 1; | 579 | ns->geom.secshift = ffs(ns->geom.secsz) - 1; |
| 586 | ns->geom.pgshift = chip->page_shift; | 580 | ns->geom.pgshift = chip->page_shift; |
| @@ -921,7 +915,7 @@ static int setup_wear_reporting(struct mtd_info *mtd) | |||
| 921 | 915 | ||
| 922 | if (!rptwear) | 916 | if (!rptwear) |
| 923 | return 0; | 917 | return 0; |
| 924 | wear_eb_count = divide(mtd->size, mtd->erasesize); | 918 | wear_eb_count = div_u64(mtd->size, mtd->erasesize); |
| 925 | mem = wear_eb_count * sizeof(unsigned long); | 919 | mem = wear_eb_count * sizeof(unsigned long); |
| 926 | if (mem / sizeof(unsigned long) != wear_eb_count) { | 920 | if (mem / sizeof(unsigned long) != wear_eb_count) { |
| 927 | NS_ERR("Too many erase blocks for wear reporting\n"); | 921 | NS_ERR("Too many erase blocks for wear reporting\n"); |
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index 9f957c2d48e9..7c1380305219 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
| @@ -264,6 +264,9 @@ static struct dentry *dfs_rootdir; | |||
| 264 | */ | 264 | */ |
| 265 | int ubi_debugfs_init(void) | 265 | int ubi_debugfs_init(void) |
| 266 | { | 266 | { |
| 267 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) | ||
| 268 | return 0; | ||
| 269 | |||
| 267 | dfs_rootdir = debugfs_create_dir("ubi", NULL); | 270 | dfs_rootdir = debugfs_create_dir("ubi", NULL); |
| 268 | if (IS_ERR_OR_NULL(dfs_rootdir)) { | 271 | if (IS_ERR_OR_NULL(dfs_rootdir)) { |
| 269 | int err = dfs_rootdir ? -ENODEV : PTR_ERR(dfs_rootdir); | 272 | int err = dfs_rootdir ? -ENODEV : PTR_ERR(dfs_rootdir); |
| @@ -281,7 +284,8 @@ int ubi_debugfs_init(void) | |||
| 281 | */ | 284 | */ |
| 282 | void ubi_debugfs_exit(void) | 285 | void ubi_debugfs_exit(void) |
| 283 | { | 286 | { |
| 284 | debugfs_remove(dfs_rootdir); | 287 | if (IS_ENABLED(CONFIG_DEBUG_FS)) |
| 288 | debugfs_remove(dfs_rootdir); | ||
| 285 | } | 289 | } |
| 286 | 290 | ||
| 287 | /* Read an UBI debugfs file */ | 291 | /* Read an UBI debugfs file */ |
| @@ -403,6 +407,9 @@ int ubi_debugfs_init_dev(struct ubi_device *ubi) | |||
| 403 | struct dentry *dent; | 407 | struct dentry *dent; |
| 404 | struct ubi_debug_info *d = ubi->dbg; | 408 | struct ubi_debug_info *d = ubi->dbg; |
| 405 | 409 | ||
| 410 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) | ||
| 411 | return 0; | ||
| 412 | |||
| 406 | n = snprintf(d->dfs_dir_name, UBI_DFS_DIR_LEN + 1, UBI_DFS_DIR_NAME, | 413 | n = snprintf(d->dfs_dir_name, UBI_DFS_DIR_LEN + 1, UBI_DFS_DIR_NAME, |
| 407 | ubi->ubi_num); | 414 | ubi->ubi_num); |
| 408 | if (n == UBI_DFS_DIR_LEN) { | 415 | if (n == UBI_DFS_DIR_LEN) { |
| @@ -470,5 +477,6 @@ out: | |||
| 470 | */ | 477 | */ |
| 471 | void ubi_debugfs_exit_dev(struct ubi_device *ubi) | 478 | void ubi_debugfs_exit_dev(struct ubi_device *ubi) |
| 472 | { | 479 | { |
| 473 | debugfs_remove_recursive(ubi->dbg->dfs_dir); | 480 | if (IS_ENABLED(CONFIG_DEBUG_FS)) |
| 481 | debugfs_remove_recursive(ubi->dbg->dfs_dir); | ||
| 474 | } | 482 | } |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 9df100a4ec38..b6be644e7b85 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
| @@ -1262,11 +1262,11 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum) | |||
| 1262 | dbg_wl("flush pending work for LEB %d:%d (%d pending works)", | 1262 | dbg_wl("flush pending work for LEB %d:%d (%d pending works)", |
| 1263 | vol_id, lnum, ubi->works_count); | 1263 | vol_id, lnum, ubi->works_count); |
| 1264 | 1264 | ||
| 1265 | down_write(&ubi->work_sem); | ||
| 1266 | while (found) { | 1265 | while (found) { |
| 1267 | struct ubi_work *wrk; | 1266 | struct ubi_work *wrk; |
| 1268 | found = 0; | 1267 | found = 0; |
| 1269 | 1268 | ||
| 1269 | down_read(&ubi->work_sem); | ||
| 1270 | spin_lock(&ubi->wl_lock); | 1270 | spin_lock(&ubi->wl_lock); |
| 1271 | list_for_each_entry(wrk, &ubi->works, list) { | 1271 | list_for_each_entry(wrk, &ubi->works, list) { |
| 1272 | if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) && | 1272 | if ((vol_id == UBI_ALL || wrk->vol_id == vol_id) && |
| @@ -1277,18 +1277,27 @@ int ubi_wl_flush(struct ubi_device *ubi, int vol_id, int lnum) | |||
| 1277 | spin_unlock(&ubi->wl_lock); | 1277 | spin_unlock(&ubi->wl_lock); |
| 1278 | 1278 | ||
| 1279 | err = wrk->func(ubi, wrk, 0); | 1279 | err = wrk->func(ubi, wrk, 0); |
| 1280 | if (err) | 1280 | if (err) { |
| 1281 | goto out; | 1281 | up_read(&ubi->work_sem); |
| 1282 | return err; | ||
| 1283 | } | ||
| 1284 | |||
| 1282 | spin_lock(&ubi->wl_lock); | 1285 | spin_lock(&ubi->wl_lock); |
| 1283 | found = 1; | 1286 | found = 1; |
| 1284 | break; | 1287 | break; |
| 1285 | } | 1288 | } |
| 1286 | } | 1289 | } |
| 1287 | spin_unlock(&ubi->wl_lock); | 1290 | spin_unlock(&ubi->wl_lock); |
| 1291 | up_read(&ubi->work_sem); | ||
| 1288 | } | 1292 | } |
| 1289 | 1293 | ||
| 1290 | out: | 1294 | /* |
| 1295 | * Make sure all the works which have been done in parallel are | ||
| 1296 | * finished. | ||
| 1297 | */ | ||
| 1298 | down_write(&ubi->work_sem); | ||
| 1291 | up_write(&ubi->work_sem); | 1299 | up_write(&ubi->work_sem); |
| 1300 | |||
| 1292 | return err; | 1301 | return err; |
| 1293 | } | 1302 | } |
| 1294 | 1303 | ||
diff --git a/drivers/net/bonding/bond_debugfs.c b/drivers/net/bonding/bond_debugfs.c index 3680aa251dea..2cf084eb9d52 100644 --- a/drivers/net/bonding/bond_debugfs.c +++ b/drivers/net/bonding/bond_debugfs.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #include "bonding.h" | 6 | #include "bonding.h" |
| 7 | #include "bond_alb.h" | 7 | #include "bond_alb.h" |
| 8 | 8 | ||
| 9 | #ifdef CONFIG_DEBUG_FS | 9 | #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_NET_NS) |
| 10 | 10 | ||
| 11 | #include <linux/debugfs.h> | 11 | #include <linux/debugfs.h> |
| 12 | #include <linux/seq_file.h> | 12 | #include <linux/seq_file.h> |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 2ee8cf9e8a3b..2ee76993f052 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
| @@ -76,6 +76,7 @@ | |||
| 76 | #include <net/route.h> | 76 | #include <net/route.h> |
| 77 | #include <net/net_namespace.h> | 77 | #include <net/net_namespace.h> |
| 78 | #include <net/netns/generic.h> | 78 | #include <net/netns/generic.h> |
| 79 | #include <net/pkt_sched.h> | ||
| 79 | #include "bonding.h" | 80 | #include "bonding.h" |
| 80 | #include "bond_3ad.h" | 81 | #include "bond_3ad.h" |
| 81 | #include "bond_alb.h" | 82 | #include "bond_alb.h" |
| @@ -381,8 +382,6 @@ struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr) | |||
| 381 | return next; | 382 | return next; |
| 382 | } | 383 | } |
| 383 | 384 | ||
| 384 | #define bond_queue_mapping(skb) (*(u16 *)((skb)->cb)) | ||
| 385 | |||
| 386 | /** | 385 | /** |
| 387 | * bond_dev_queue_xmit - Prepare skb for xmit. | 386 | * bond_dev_queue_xmit - Prepare skb for xmit. |
| 388 | * | 387 | * |
| @@ -395,7 +394,9 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, | |||
| 395 | { | 394 | { |
| 396 | skb->dev = slave_dev; | 395 | skb->dev = slave_dev; |
| 397 | 396 | ||
| 398 | skb->queue_mapping = bond_queue_mapping(skb); | 397 | BUILD_BUG_ON(sizeof(skb->queue_mapping) != |
| 398 | sizeof(qdisc_skb_cb(skb)->bond_queue_mapping)); | ||
| 399 | skb->queue_mapping = qdisc_skb_cb(skb)->bond_queue_mapping; | ||
| 399 | 400 | ||
| 400 | if (unlikely(netpoll_tx_running(slave_dev))) | 401 | if (unlikely(netpoll_tx_running(slave_dev))) |
| 401 | bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); | 402 | bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb); |
| @@ -3226,6 +3227,12 @@ static int bond_master_netdev_event(unsigned long event, | |||
| 3226 | switch (event) { | 3227 | switch (event) { |
| 3227 | case NETDEV_CHANGENAME: | 3228 | case NETDEV_CHANGENAME: |
| 3228 | return bond_event_changename(event_bond); | 3229 | return bond_event_changename(event_bond); |
| 3230 | case NETDEV_UNREGISTER: | ||
| 3231 | bond_remove_proc_entry(event_bond); | ||
| 3232 | break; | ||
| 3233 | case NETDEV_REGISTER: | ||
| 3234 | bond_create_proc_entry(event_bond); | ||
| 3235 | break; | ||
| 3229 | default: | 3236 | default: |
| 3230 | break; | 3237 | break; |
| 3231 | } | 3238 | } |
| @@ -4171,7 +4178,7 @@ static u16 bond_select_queue(struct net_device *dev, struct sk_buff *skb) | |||
| 4171 | /* | 4178 | /* |
| 4172 | * Save the original txq to restore before passing to the driver | 4179 | * Save the original txq to restore before passing to the driver |
| 4173 | */ | 4180 | */ |
| 4174 | bond_queue_mapping(skb) = skb->queue_mapping; | 4181 | qdisc_skb_cb(skb)->bond_queue_mapping = skb->queue_mapping; |
| 4175 | 4182 | ||
| 4176 | if (unlikely(txq >= dev->real_num_tx_queues)) { | 4183 | if (unlikely(txq >= dev->real_num_tx_queues)) { |
| 4177 | do { | 4184 | do { |
| @@ -4410,8 +4417,6 @@ static void bond_uninit(struct net_device *bond_dev) | |||
| 4410 | 4417 | ||
| 4411 | bond_work_cancel_all(bond); | 4418 | bond_work_cancel_all(bond); |
| 4412 | 4419 | ||
| 4413 | bond_remove_proc_entry(bond); | ||
| 4414 | |||
| 4415 | bond_debug_unregister(bond); | 4420 | bond_debug_unregister(bond); |
| 4416 | 4421 | ||
| 4417 | __hw_addr_flush(&bond->mc_list); | 4422 | __hw_addr_flush(&bond->mc_list); |
| @@ -4813,7 +4818,6 @@ static int bond_init(struct net_device *bond_dev) | |||
| 4813 | 4818 | ||
| 4814 | bond_set_lockdep_class(bond_dev); | 4819 | bond_set_lockdep_class(bond_dev); |
| 4815 | 4820 | ||
| 4816 | bond_create_proc_entry(bond); | ||
| 4817 | list_add_tail(&bond->bond_list, &bn->dev_list); | 4821 | list_add_tail(&bond->bond_list, &bn->dev_list); |
| 4818 | 4822 | ||
| 4819 | bond_prepare_sysfs_group(bond); | 4823 | bond_prepare_sysfs_group(bond); |
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index ad284baafe87..3cea38d37344 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c | |||
| @@ -150,14 +150,25 @@ static void bond_info_show_master(struct seq_file *seq) | |||
| 150 | } | 150 | } |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | static const char *bond_slave_link_status(s8 link) | ||
| 154 | { | ||
| 155 | static const char * const status[] = { | ||
| 156 | [BOND_LINK_UP] = "up", | ||
| 157 | [BOND_LINK_FAIL] = "going down", | ||
| 158 | [BOND_LINK_DOWN] = "down", | ||
| 159 | [BOND_LINK_BACK] = "going back", | ||
| 160 | }; | ||
| 161 | |||
| 162 | return status[link]; | ||
| 163 | } | ||
| 164 | |||
| 153 | static void bond_info_show_slave(struct seq_file *seq, | 165 | static void bond_info_show_slave(struct seq_file *seq, |
| 154 | const struct slave *slave) | 166 | const struct slave *slave) |
| 155 | { | 167 | { |
| 156 | struct bonding *bond = seq->private; | 168 | struct bonding *bond = seq->private; |
| 157 | 169 | ||
| 158 | seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); | 170 | seq_printf(seq, "\nSlave Interface: %s\n", slave->dev->name); |
| 159 | seq_printf(seq, "MII Status: %s\n", | 171 | seq_printf(seq, "MII Status: %s\n", bond_slave_link_status(slave->link)); |
| 160 | (slave->link == BOND_LINK_UP) ? "up" : "down"); | ||
| 161 | if (slave->speed == SPEED_UNKNOWN) | 172 | if (slave->speed == SPEED_UNKNOWN) |
| 162 | seq_printf(seq, "Speed: %s\n", "Unknown"); | 173 | seq_printf(seq, "Speed: %s\n", "Unknown"); |
| 163 | else | 174 | else |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index aef42f045320..485bedb8278c 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
| @@ -1082,8 +1082,12 @@ static ssize_t bonding_store_primary(struct device *d, | |||
| 1082 | } | 1082 | } |
| 1083 | } | 1083 | } |
| 1084 | 1084 | ||
| 1085 | pr_info("%s: Unable to set %.*s as primary slave.\n", | 1085 | strncpy(bond->params.primary, ifname, IFNAMSIZ); |
| 1086 | bond->dev->name, (int)strlen(buf) - 1, buf); | 1086 | bond->params.primary[IFNAMSIZ - 1] = 0; |
| 1087 | |||
| 1088 | pr_info("%s: Recording %s as primary, " | ||
| 1089 | "but it has not been enslaved to %s yet.\n", | ||
| 1090 | bond->dev->name, ifname, bond->dev->name); | ||
| 1087 | out: | 1091 | out: |
| 1088 | write_unlock_bh(&bond->curr_slave_lock); | 1092 | write_unlock_bh(&bond->curr_slave_lock); |
| 1089 | read_unlock(&bond->lock); | 1093 | read_unlock(&bond->lock); |
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c index 1520814c77c7..4a27adb7ae67 100644 --- a/drivers/net/caif/caif_hsi.c +++ b/drivers/net/caif/caif_hsi.c | |||
| @@ -693,8 +693,6 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi) | |||
| 693 | */ | 693 | */ |
| 694 | memcpy(rx_buf, (u8 *)piggy_desc, | 694 | memcpy(rx_buf, (u8 *)piggy_desc, |
| 695 | CFHSI_DESC_SHORT_SZ); | 695 | CFHSI_DESC_SHORT_SZ); |
| 696 | /* Mark no embedded frame here */ | ||
| 697 | piggy_desc->offset = 0; | ||
| 698 | if (desc_pld_len == -EPROTO) | 696 | if (desc_pld_len == -EPROTO) |
| 699 | goto out_of_sync; | 697 | goto out_of_sync; |
| 700 | } | 698 | } |
| @@ -737,6 +735,8 @@ static void cfhsi_rx_done(struct cfhsi *cfhsi) | |||
| 737 | /* Extract any payload in piggyback descriptor. */ | 735 | /* Extract any payload in piggyback descriptor. */ |
| 738 | if (cfhsi_rx_desc(piggy_desc, cfhsi) < 0) | 736 | if (cfhsi_rx_desc(piggy_desc, cfhsi) < 0) |
| 739 | goto out_of_sync; | 737 | goto out_of_sync; |
| 738 | /* Mark no embedded frame after extracting it */ | ||
| 739 | piggy_desc->offset = 0; | ||
| 740 | } | 740 | } |
| 741 | } | 741 | } |
| 742 | 742 | ||
| @@ -1178,6 +1178,7 @@ int cfhsi_probe(struct platform_device *pdev) | |||
| 1178 | dev_err(&ndev->dev, "%s: Registration error: %d.\n", | 1178 | dev_err(&ndev->dev, "%s: Registration error: %d.\n", |
| 1179 | __func__, res); | 1179 | __func__, res); |
| 1180 | free_netdev(ndev); | 1180 | free_netdev(ndev); |
| 1181 | return -ENODEV; | ||
| 1181 | } | 1182 | } |
| 1182 | /* Add CAIF HSI device to list. */ | 1183 | /* Add CAIF HSI device to list. */ |
| 1183 | spin_lock(&cfhsi_list_lock); | 1184 | spin_lock(&cfhsi_list_lock); |
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 536bda072a16..86cd532c78f9 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
| @@ -590,8 +590,8 @@ static void c_can_chip_config(struct net_device *dev) | |||
| 590 | priv->write_reg(priv, &priv->regs->control, | 590 | priv->write_reg(priv, &priv->regs->control, |
| 591 | CONTROL_ENABLE_AR); | 591 | CONTROL_ENABLE_AR); |
| 592 | 592 | ||
| 593 | if (priv->can.ctrlmode & (CAN_CTRLMODE_LISTENONLY & | 593 | if ((priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) && |
| 594 | CAN_CTRLMODE_LOOPBACK)) { | 594 | (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)) { |
| 595 | /* loopback + silent mode : useful for hot self-test */ | 595 | /* loopback + silent mode : useful for hot self-test */ |
| 596 | priv->write_reg(priv, &priv->regs->control, CONTROL_EIE | | 596 | priv->write_reg(priv, &priv->regs->control, CONTROL_EIE | |
| 597 | CONTROL_SIE | CONTROL_IE | CONTROL_TEST); | 597 | CONTROL_SIE | CONTROL_IE | CONTROL_TEST); |
| @@ -686,7 +686,7 @@ static int c_can_get_berr_counter(const struct net_device *dev, | |||
| 686 | * | 686 | * |
| 687 | * We iterate from priv->tx_echo to priv->tx_next and check if the | 687 | * We iterate from priv->tx_echo to priv->tx_next and check if the |
| 688 | * packet has been transmitted, echo it back to the CAN framework. | 688 | * packet has been transmitted, echo it back to the CAN framework. |
| 689 | * If we discover a not yet transmitted package, stop looking for more. | 689 | * If we discover a not yet transmitted packet, stop looking for more. |
| 690 | */ | 690 | */ |
| 691 | static void c_can_do_tx(struct net_device *dev) | 691 | static void c_can_do_tx(struct net_device *dev) |
| 692 | { | 692 | { |
| @@ -698,7 +698,7 @@ static void c_can_do_tx(struct net_device *dev) | |||
| 698 | for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) { | 698 | for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) { |
| 699 | msg_obj_no = get_tx_echo_msg_obj(priv); | 699 | msg_obj_no = get_tx_echo_msg_obj(priv); |
| 700 | val = c_can_read_reg32(priv, &priv->regs->txrqst1); | 700 | val = c_can_read_reg32(priv, &priv->regs->txrqst1); |
| 701 | if (!(val & (1 << msg_obj_no))) { | 701 | if (!(val & (1 << (msg_obj_no - 1)))) { |
| 702 | can_get_echo_skb(dev, | 702 | can_get_echo_skb(dev, |
| 703 | msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST); | 703 | msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST); |
| 704 | stats->tx_bytes += priv->read_reg(priv, | 704 | stats->tx_bytes += priv->read_reg(priv, |
| @@ -706,6 +706,8 @@ static void c_can_do_tx(struct net_device *dev) | |||
| 706 | & IF_MCONT_DLC_MASK; | 706 | & IF_MCONT_DLC_MASK; |
| 707 | stats->tx_packets++; | 707 | stats->tx_packets++; |
| 708 | c_can_inval_msg_object(dev, 0, msg_obj_no); | 708 | c_can_inval_msg_object(dev, 0, msg_obj_no); |
| 709 | } else { | ||
| 710 | break; | ||
| 709 | } | 711 | } |
| 710 | } | 712 | } |
| 711 | 713 | ||
| @@ -950,7 +952,7 @@ static int c_can_poll(struct napi_struct *napi, int quota) | |||
| 950 | struct net_device *dev = napi->dev; | 952 | struct net_device *dev = napi->dev; |
| 951 | struct c_can_priv *priv = netdev_priv(dev); | 953 | struct c_can_priv *priv = netdev_priv(dev); |
| 952 | 954 | ||
| 953 | irqstatus = priv->read_reg(priv, &priv->regs->interrupt); | 955 | irqstatus = priv->irqstatus; |
| 954 | if (!irqstatus) | 956 | if (!irqstatus) |
| 955 | goto end; | 957 | goto end; |
| 956 | 958 | ||
| @@ -1028,12 +1030,11 @@ end: | |||
| 1028 | 1030 | ||
| 1029 | static irqreturn_t c_can_isr(int irq, void *dev_id) | 1031 | static irqreturn_t c_can_isr(int irq, void *dev_id) |
| 1030 | { | 1032 | { |
| 1031 | u16 irqstatus; | ||
| 1032 | struct net_device *dev = (struct net_device *)dev_id; | 1033 | struct net_device *dev = (struct net_device *)dev_id; |
| 1033 | struct c_can_priv *priv = netdev_priv(dev); | 1034 | struct c_can_priv *priv = netdev_priv(dev); |
| 1034 | 1035 | ||
| 1035 | irqstatus = priv->read_reg(priv, &priv->regs->interrupt); | 1036 | priv->irqstatus = priv->read_reg(priv, &priv->regs->interrupt); |
| 1036 | if (!irqstatus) | 1037 | if (!priv->irqstatus) |
| 1037 | return IRQ_NONE; | 1038 | return IRQ_NONE; |
| 1038 | 1039 | ||
| 1039 | /* disable all interrupts and schedule the NAPI */ | 1040 | /* disable all interrupts and schedule the NAPI */ |
| @@ -1063,10 +1064,11 @@ static int c_can_open(struct net_device *dev) | |||
| 1063 | goto exit_irq_fail; | 1064 | goto exit_irq_fail; |
| 1064 | } | 1065 | } |
| 1065 | 1066 | ||
| 1067 | napi_enable(&priv->napi); | ||
| 1068 | |||
| 1066 | /* start the c_can controller */ | 1069 | /* start the c_can controller */ |
| 1067 | c_can_start(dev); | 1070 | c_can_start(dev); |
| 1068 | 1071 | ||
| 1069 | napi_enable(&priv->napi); | ||
| 1070 | netif_start_queue(dev); | 1072 | netif_start_queue(dev); |
| 1071 | 1073 | ||
| 1072 | return 0; | 1074 | return 0; |
diff --git a/drivers/net/can/c_can/c_can.h b/drivers/net/can/c_can/c_can.h index 9b7fbef3d09a..5f32d34af507 100644 --- a/drivers/net/can/c_can/c_can.h +++ b/drivers/net/can/c_can/c_can.h | |||
| @@ -76,6 +76,7 @@ struct c_can_priv { | |||
| 76 | unsigned int tx_next; | 76 | unsigned int tx_next; |
| 77 | unsigned int tx_echo; | 77 | unsigned int tx_echo; |
| 78 | void *priv; /* for board-specific data */ | 78 | void *priv; /* for board-specific data */ |
| 79 | u16 irqstatus; | ||
| 79 | }; | 80 | }; |
| 80 | 81 | ||
| 81 | struct net_device *alloc_c_can_dev(void); | 82 | struct net_device *alloc_c_can_dev(void); |
diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c index 53115eee8075..688371cda37a 100644 --- a/drivers/net/can/cc770/cc770_platform.c +++ b/drivers/net/can/cc770/cc770_platform.c | |||
| @@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev, | |||
| 154 | struct cc770_platform_data *pdata = pdev->dev.platform_data; | 154 | struct cc770_platform_data *pdata = pdev->dev.platform_data; |
| 155 | 155 | ||
| 156 | priv->can.clock.freq = pdata->osc_freq; | 156 | priv->can.clock.freq = pdata->osc_freq; |
| 157 | if (priv->cpu_interface | CPUIF_DSC) | 157 | if (priv->cpu_interface & CPUIF_DSC) |
| 158 | priv->can.clock.freq /= 2; | 158 | priv->can.clock.freq /= 2; |
| 159 | priv->clkout = pdata->cor; | 159 | priv->clkout = pdata->cor; |
| 160 | priv->bus_config = pdata->bcr; | 160 | priv->bus_config = pdata->bcr; |
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 38c0690df5c8..81d474102378 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c | |||
| @@ -939,12 +939,12 @@ static int __devinit flexcan_probe(struct platform_device *pdev) | |||
| 939 | return PTR_ERR(pinctrl); | 939 | return PTR_ERR(pinctrl); |
| 940 | 940 | ||
| 941 | if (pdev->dev.of_node) { | 941 | if (pdev->dev.of_node) { |
| 942 | const u32 *clock_freq_p; | 942 | const __be32 *clock_freq_p; |
| 943 | 943 | ||
| 944 | clock_freq_p = of_get_property(pdev->dev.of_node, | 944 | clock_freq_p = of_get_property(pdev->dev.of_node, |
| 945 | "clock-frequency", NULL); | 945 | "clock-frequency", NULL); |
| 946 | if (clock_freq_p) | 946 | if (clock_freq_p) |
| 947 | clock_freq = *clock_freq_p; | 947 | clock_freq = be32_to_cpup(clock_freq_p); |
| 948 | } | 948 | } |
| 949 | 949 | ||
| 950 | if (!clock_freq) { | 950 | if (!clock_freq) { |
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index 442d91a2747b..bab0158f1cc3 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c | |||
| @@ -187,8 +187,10 @@ static int __init dummy_init_module(void) | |||
| 187 | rtnl_lock(); | 187 | rtnl_lock(); |
| 188 | err = __rtnl_link_register(&dummy_link_ops); | 188 | err = __rtnl_link_register(&dummy_link_ops); |
| 189 | 189 | ||
| 190 | for (i = 0; i < numdummies && !err; i++) | 190 | for (i = 0; i < numdummies && !err; i++) { |
| 191 | err = dummy_init_one(); | 191 | err = dummy_init_one(); |
| 192 | cond_resched(); | ||
| 193 | } | ||
| 192 | if (err < 0) | 194 | if (err < 0) |
| 193 | __rtnl_link_unregister(&dummy_link_ops); | 195 | __rtnl_link_unregister(&dummy_link_ops); |
| 194 | rtnl_unlock(); | 196 | rtnl_unlock(); |
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 9cc15701101b..1f78b63d5efe 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
| @@ -261,7 +261,6 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter) | |||
| 261 | if ((phy_data & BMSR_LSTATUS) == 0) { | 261 | if ((phy_data & BMSR_LSTATUS) == 0) { |
| 262 | /* link down */ | 262 | /* link down */ |
| 263 | netif_carrier_off(netdev); | 263 | netif_carrier_off(netdev); |
| 264 | netif_stop_queue(netdev); | ||
| 265 | hw->hibernate = true; | 264 | hw->hibernate = true; |
| 266 | if (atl1c_reset_mac(hw) != 0) | 265 | if (atl1c_reset_mac(hw) != 0) |
| 267 | if (netif_msg_hw(adapter)) | 266 | if (netif_msg_hw(adapter)) |
diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c index 46b8b7d81633..d09c6b583d17 100644 --- a/drivers/net/ethernet/broadcom/b44.c +++ b/drivers/net/ethernet/broadcom/b44.c | |||
| @@ -656,7 +656,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked) | |||
| 656 | dma_unmap_single(bp->sdev->dma_dev, mapping, | 656 | dma_unmap_single(bp->sdev->dma_dev, mapping, |
| 657 | RX_PKT_BUF_SZ, DMA_FROM_DEVICE); | 657 | RX_PKT_BUF_SZ, DMA_FROM_DEVICE); |
| 658 | dev_kfree_skb_any(skb); | 658 | dev_kfree_skb_any(skb); |
| 659 | skb = __netdev_alloc_skb(bp->dev, RX_PKT_BUF_SZ, GFP_ATOMIC|GFP_DMA); | 659 | skb = alloc_skb(RX_PKT_BUF_SZ, GFP_ATOMIC | GFP_DMA); |
| 660 | if (skb == NULL) | 660 | if (skb == NULL) |
| 661 | return -ENOMEM; | 661 | return -ENOMEM; |
| 662 | mapping = dma_map_single(bp->sdev->dma_dev, skb->data, | 662 | mapping = dma_map_single(bp->sdev->dma_dev, skb->data, |
| @@ -967,7 +967,7 @@ static netdev_tx_t b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 967 | dma_unmap_single(bp->sdev->dma_dev, mapping, len, | 967 | dma_unmap_single(bp->sdev->dma_dev, mapping, len, |
| 968 | DMA_TO_DEVICE); | 968 | DMA_TO_DEVICE); |
| 969 | 969 | ||
| 970 | bounce_skb = __netdev_alloc_skb(dev, len, GFP_ATOMIC | GFP_DMA); | 970 | bounce_skb = alloc_skb(len, GFP_ATOMIC | GFP_DMA); |
| 971 | if (!bounce_skb) | 971 | if (!bounce_skb) |
| 972 | goto err_out; | 972 | goto err_out; |
| 973 | 973 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c index ac7b74488531..1fa4927a45b1 100644 --- a/drivers/net/ethernet/broadcom/bnx2.c +++ b/drivers/net/ethernet/broadcom/bnx2.c | |||
| @@ -5372,7 +5372,7 @@ bnx2_free_tx_skbs(struct bnx2 *bp) | |||
| 5372 | int k, last; | 5372 | int k, last; |
| 5373 | 5373 | ||
| 5374 | if (skb == NULL) { | 5374 | if (skb == NULL) { |
| 5375 | j++; | 5375 | j = NEXT_TX_BD(j); |
| 5376 | continue; | 5376 | continue; |
| 5377 | } | 5377 | } |
| 5378 | 5378 | ||
| @@ -5384,8 +5384,8 @@ bnx2_free_tx_skbs(struct bnx2 *bp) | |||
| 5384 | tx_buf->skb = NULL; | 5384 | tx_buf->skb = NULL; |
| 5385 | 5385 | ||
| 5386 | last = tx_buf->nr_frags; | 5386 | last = tx_buf->nr_frags; |
| 5387 | j++; | 5387 | j = NEXT_TX_BD(j); |
| 5388 | for (k = 0; k < last; k++, j++) { | 5388 | for (k = 0; k < last; k++, j = NEXT_TX_BD(j)) { |
| 5389 | tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)]; | 5389 | tx_buf = &txr->tx_buf_ring[TX_RING_IDX(j)]; |
| 5390 | dma_unmap_page(&bp->pdev->dev, | 5390 | dma_unmap_page(&bp->pdev->dev, |
| 5391 | dma_unmap_addr(tx_buf, mapping), | 5391 | dma_unmap_addr(tx_buf, mapping), |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index e30e2a2f354c..7de824184979 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
| @@ -747,21 +747,6 @@ struct bnx2x_fastpath { | |||
| 747 | 747 | ||
| 748 | #define ETH_RX_ERROR_FALGS ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG | 748 | #define ETH_RX_ERROR_FALGS ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG |
| 749 | 749 | ||
| 750 | #define BNX2X_IP_CSUM_ERR(cqe) \ | ||
| 751 | (!((cqe)->fast_path_cqe.status_flags & \ | ||
| 752 | ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG) && \ | ||
| 753 | ((cqe)->fast_path_cqe.type_error_flags & \ | ||
| 754 | ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG)) | ||
| 755 | |||
| 756 | #define BNX2X_L4_CSUM_ERR(cqe) \ | ||
| 757 | (!((cqe)->fast_path_cqe.status_flags & \ | ||
| 758 | ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG) && \ | ||
| 759 | ((cqe)->fast_path_cqe.type_error_flags & \ | ||
| 760 | ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG)) | ||
| 761 | |||
| 762 | #define BNX2X_RX_CSUM_OK(cqe) \ | ||
| 763 | (!(BNX2X_L4_CSUM_ERR(cqe) || BNX2X_IP_CSUM_ERR(cqe))) | ||
| 764 | |||
| 765 | #define BNX2X_PRS_FLAG_OVERETH_IPV4(flags) \ | 750 | #define BNX2X_PRS_FLAG_OVERETH_IPV4(flags) \ |
| 766 | (((le16_to_cpu(flags) & \ | 751 | (((le16_to_cpu(flags) & \ |
| 767 | PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) >> \ | 752 | PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) >> \ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index ad0743bf4bde..8098eea9704d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
| @@ -190,7 +190,7 @@ int bnx2x_tx_int(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata) | |||
| 190 | 190 | ||
| 191 | if ((netif_tx_queue_stopped(txq)) && | 191 | if ((netif_tx_queue_stopped(txq)) && |
| 192 | (bp->state == BNX2X_STATE_OPEN) && | 192 | (bp->state == BNX2X_STATE_OPEN) && |
| 193 | (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3)) | 193 | (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4)) |
| 194 | netif_tx_wake_queue(txq); | 194 | netif_tx_wake_queue(txq); |
| 195 | 195 | ||
| 196 | __netif_tx_unlock(txq); | 196 | __netif_tx_unlock(txq); |
| @@ -617,6 +617,25 @@ static int bnx2x_alloc_rx_data(struct bnx2x *bp, | |||
| 617 | return 0; | 617 | return 0; |
| 618 | } | 618 | } |
| 619 | 619 | ||
| 620 | static void bnx2x_csum_validate(struct sk_buff *skb, union eth_rx_cqe *cqe, | ||
| 621 | struct bnx2x_fastpath *fp) | ||
| 622 | { | ||
| 623 | /* Do nothing if no IP/L4 csum validation was done */ | ||
| 624 | |||
| 625 | if (cqe->fast_path_cqe.status_flags & | ||
| 626 | (ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG | | ||
| 627 | ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG)) | ||
| 628 | return; | ||
| 629 | |||
| 630 | /* If both IP/L4 validation were done, check if an error was found. */ | ||
| 631 | |||
| 632 | if (cqe->fast_path_cqe.type_error_flags & | ||
| 633 | (ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG | | ||
| 634 | ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG)) | ||
| 635 | fp->eth_q_stats.hw_csum_err++; | ||
| 636 | else | ||
| 637 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 638 | } | ||
| 620 | 639 | ||
| 621 | int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) | 640 | int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) |
| 622 | { | 641 | { |
| @@ -806,13 +825,9 @@ reuse_rx: | |||
| 806 | 825 | ||
| 807 | skb_checksum_none_assert(skb); | 826 | skb_checksum_none_assert(skb); |
| 808 | 827 | ||
| 809 | if (bp->dev->features & NETIF_F_RXCSUM) { | 828 | if (bp->dev->features & NETIF_F_RXCSUM) |
| 829 | bnx2x_csum_validate(skb, cqe, fp); | ||
| 810 | 830 | ||
| 811 | if (likely(BNX2X_RX_CSUM_OK(cqe))) | ||
| 812 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 813 | else | ||
| 814 | fp->eth_q_stats.hw_csum_err++; | ||
| 815 | } | ||
| 816 | 831 | ||
| 817 | skb_record_rx_queue(skb, fp->rx_queue); | 832 | skb_record_rx_queue(skb, fp->rx_queue); |
| 818 | 833 | ||
| @@ -2501,8 +2516,6 @@ int bnx2x_poll(struct napi_struct *napi, int budget) | |||
| 2501 | /* we split the first BD into headers and data BDs | 2516 | /* we split the first BD into headers and data BDs |
| 2502 | * to ease the pain of our fellow microcode engineers | 2517 | * to ease the pain of our fellow microcode engineers |
| 2503 | * we use one mapping for both BDs | 2518 | * we use one mapping for both BDs |
| 2504 | * So far this has only been observed to happen | ||
| 2505 | * in Other Operating Systems(TM) | ||
| 2506 | */ | 2519 | */ |
| 2507 | static noinline u16 bnx2x_tx_split(struct bnx2x *bp, | 2520 | static noinline u16 bnx2x_tx_split(struct bnx2x *bp, |
| 2508 | struct bnx2x_fp_txdata *txdata, | 2521 | struct bnx2x_fp_txdata *txdata, |
| @@ -3156,7 +3169,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3156 | 3169 | ||
| 3157 | txdata->tx_bd_prod += nbd; | 3170 | txdata->tx_bd_prod += nbd; |
| 3158 | 3171 | ||
| 3159 | if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 3)) { | 3172 | if (unlikely(bnx2x_tx_avail(bp, txdata) < MAX_SKB_FRAGS + 4)) { |
| 3160 | netif_tx_stop_queue(txq); | 3173 | netif_tx_stop_queue(txq); |
| 3161 | 3174 | ||
| 3162 | /* paired memory barrier is in bnx2x_tx_int(), we have to keep | 3175 | /* paired memory barrier is in bnx2x_tx_int(), we have to keep |
| @@ -3165,7 +3178,7 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3165 | smp_mb(); | 3178 | smp_mb(); |
| 3166 | 3179 | ||
| 3167 | fp->eth_q_stats.driver_xoff++; | 3180 | fp->eth_q_stats.driver_xoff++; |
| 3168 | if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 3) | 3181 | if (bnx2x_tx_avail(bp, txdata) >= MAX_SKB_FRAGS + 4) |
| 3169 | netif_tx_wake_queue(txq); | 3182 | netif_tx_wake_queue(txq); |
| 3170 | } | 3183 | } |
| 3171 | txdata->tx_pkt++; | 3184 | txdata->tx_pkt++; |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index a3fb7215cd89..6e7d5c0843b4 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #define I2C_BSC0 0 | 40 | #define I2C_BSC0 0 |
| 41 | #define I2C_BSC1 1 | 41 | #define I2C_BSC1 1 |
| 42 | #define I2C_WA_RETRY_CNT 3 | 42 | #define I2C_WA_RETRY_CNT 3 |
| 43 | #define I2C_WA_PWR_ITER (I2C_WA_RETRY_CNT - 1) | ||
| 43 | #define MCPR_IMC_COMMAND_READ_OP 1 | 44 | #define MCPR_IMC_COMMAND_READ_OP 1 |
| 44 | #define MCPR_IMC_COMMAND_WRITE_OP 2 | 45 | #define MCPR_IMC_COMMAND_WRITE_OP 2 |
| 45 | 46 | ||
| @@ -7659,6 +7660,28 @@ static int bnx2x_8726_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
| 7659 | return -EINVAL; | 7660 | return -EINVAL; |
| 7660 | } | 7661 | } |
| 7661 | 7662 | ||
| 7663 | static void bnx2x_warpcore_power_module(struct link_params *params, | ||
| 7664 | struct bnx2x_phy *phy, | ||
| 7665 | u8 power) | ||
| 7666 | { | ||
| 7667 | u32 pin_cfg; | ||
| 7668 | struct bnx2x *bp = params->bp; | ||
| 7669 | |||
| 7670 | pin_cfg = (REG_RD(bp, params->shmem_base + | ||
| 7671 | offsetof(struct shmem_region, | ||
| 7672 | dev_info.port_hw_config[params->port].e3_sfp_ctrl)) & | ||
| 7673 | PORT_HW_CFG_E3_PWR_DIS_MASK) >> | ||
| 7674 | PORT_HW_CFG_E3_PWR_DIS_SHIFT; | ||
| 7675 | |||
| 7676 | if (pin_cfg == PIN_CFG_NA) | ||
| 7677 | return; | ||
| 7678 | DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n", | ||
| 7679 | power, pin_cfg); | ||
| 7680 | /* Low ==> corresponding SFP+ module is powered | ||
| 7681 | * high ==> the SFP+ module is powered down | ||
| 7682 | */ | ||
| 7683 | bnx2x_set_cfg_pin(bp, pin_cfg, power ^ 1); | ||
| 7684 | } | ||
| 7662 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | 7685 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, |
| 7663 | struct link_params *params, | 7686 | struct link_params *params, |
| 7664 | u16 addr, u8 byte_cnt, | 7687 | u16 addr, u8 byte_cnt, |
| @@ -7678,6 +7701,12 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
| 7678 | /* 4 byte aligned address */ | 7701 | /* 4 byte aligned address */ |
| 7679 | addr32 = addr & (~0x3); | 7702 | addr32 = addr & (~0x3); |
| 7680 | do { | 7703 | do { |
| 7704 | if (cnt == I2C_WA_PWR_ITER) { | ||
| 7705 | bnx2x_warpcore_power_module(params, phy, 0); | ||
| 7706 | /* Note that 100us are not enough here */ | ||
| 7707 | usleep_range(1000,1000); | ||
| 7708 | bnx2x_warpcore_power_module(params, phy, 1); | ||
| 7709 | } | ||
| 7681 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, | 7710 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, |
| 7682 | data_array); | 7711 | data_array); |
| 7683 | } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT)); | 7712 | } while ((rc != 0) && (++cnt < I2C_WA_RETRY_CNT)); |
| @@ -8200,29 +8229,6 @@ static void bnx2x_set_sfp_module_fault_led(struct link_params *params, | |||
| 8200 | bnx2x_set_e1e2_module_fault_led(params, gpio_mode); | 8229 | bnx2x_set_e1e2_module_fault_led(params, gpio_mode); |
| 8201 | } | 8230 | } |
| 8202 | 8231 | ||
| 8203 | static void bnx2x_warpcore_power_module(struct link_params *params, | ||
| 8204 | struct bnx2x_phy *phy, | ||
| 8205 | u8 power) | ||
| 8206 | { | ||
| 8207 | u32 pin_cfg; | ||
| 8208 | struct bnx2x *bp = params->bp; | ||
| 8209 | |||
| 8210 | pin_cfg = (REG_RD(bp, params->shmem_base + | ||
| 8211 | offsetof(struct shmem_region, | ||
| 8212 | dev_info.port_hw_config[params->port].e3_sfp_ctrl)) & | ||
| 8213 | PORT_HW_CFG_E3_PWR_DIS_MASK) >> | ||
| 8214 | PORT_HW_CFG_E3_PWR_DIS_SHIFT; | ||
| 8215 | |||
| 8216 | if (pin_cfg == PIN_CFG_NA) | ||
| 8217 | return; | ||
| 8218 | DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n", | ||
| 8219 | power, pin_cfg); | ||
| 8220 | /* Low ==> corresponding SFP+ module is powered | ||
| 8221 | * high ==> the SFP+ module is powered down | ||
| 8222 | */ | ||
| 8223 | bnx2x_set_cfg_pin(bp, pin_cfg, power ^ 1); | ||
| 8224 | } | ||
| 8225 | |||
| 8226 | static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy, | 8232 | static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy, |
| 8227 | struct link_params *params) | 8233 | struct link_params *params) |
| 8228 | { | 8234 | { |
| @@ -9748,7 +9754,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
| 9748 | 9754 | ||
| 9749 | msleep(1); | 9755 | msleep(1); |
| 9750 | 9756 | ||
| 9751 | if (!(CHIP_IS_E1(bp))) | 9757 | if (!(CHIP_IS_E1x(bp))) |
| 9752 | port = BP_PATH(bp); | 9758 | port = BP_PATH(bp); |
| 9753 | else | 9759 | else |
| 9754 | port = params->port; | 9760 | port = params->port; |
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index c95e7b5e2b85..2c89d17cbb29 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
| @@ -534,7 +534,8 @@ int cnic_unregister_driver(int ulp_type) | |||
| 534 | } | 534 | } |
| 535 | 535 | ||
| 536 | if (atomic_read(&ulp_ops->ref_count) != 0) | 536 | if (atomic_read(&ulp_ops->ref_count) != 0) |
| 537 | netdev_warn(dev->netdev, "Failed waiting for ref count to go to zero\n"); | 537 | pr_warn("%s: Failed waiting for ref count to go to zero\n", |
| 538 | __func__); | ||
| 538 | return 0; | 539 | return 0; |
| 539 | 540 | ||
| 540 | out_unlock: | 541 | out_unlock: |
| @@ -1053,12 +1054,13 @@ static int cnic_init_uio(struct cnic_dev *dev) | |||
| 1053 | 1054 | ||
| 1054 | uinfo = &udev->cnic_uinfo; | 1055 | uinfo = &udev->cnic_uinfo; |
| 1055 | 1056 | ||
| 1056 | uinfo->mem[0].addr = dev->netdev->base_addr; | 1057 | uinfo->mem[0].addr = pci_resource_start(dev->pcidev, 0); |
| 1057 | uinfo->mem[0].internal_addr = dev->regview; | 1058 | uinfo->mem[0].internal_addr = dev->regview; |
| 1058 | uinfo->mem[0].size = dev->netdev->mem_end - dev->netdev->mem_start; | ||
| 1059 | uinfo->mem[0].memtype = UIO_MEM_PHYS; | 1059 | uinfo->mem[0].memtype = UIO_MEM_PHYS; |
| 1060 | 1060 | ||
| 1061 | if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) { | 1061 | if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) { |
| 1062 | uinfo->mem[0].size = MB_GET_CID_ADDR(TX_TSS_CID + | ||
| 1063 | TX_MAX_TSS_RINGS + 1); | ||
| 1062 | uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & | 1064 | uinfo->mem[1].addr = (unsigned long) cp->status_blk.gen & |
| 1063 | PAGE_MASK; | 1065 | PAGE_MASK; |
| 1064 | if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) | 1066 | if (cp->ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) |
| @@ -1068,6 +1070,8 @@ static int cnic_init_uio(struct cnic_dev *dev) | |||
| 1068 | 1070 | ||
| 1069 | uinfo->name = "bnx2_cnic"; | 1071 | uinfo->name = "bnx2_cnic"; |
| 1070 | } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { | 1072 | } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { |
| 1073 | uinfo->mem[0].size = pci_resource_len(dev->pcidev, 0); | ||
| 1074 | |||
| 1071 | uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & | 1075 | uinfo->mem[1].addr = (unsigned long) cp->bnx2x_def_status_blk & |
| 1072 | PAGE_MASK; | 1076 | PAGE_MASK; |
| 1073 | uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk); | 1077 | uinfo->mem[1].size = sizeof(*cp->bnx2x_def_status_blk); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index edeeb516807a..e47ff8be1d7b 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
| @@ -14275,7 +14275,8 @@ static int __devinit tg3_get_invariants(struct tg3 *tp) | |||
| 14275 | } | 14275 | } |
| 14276 | } | 14276 | } |
| 14277 | 14277 | ||
| 14278 | if (tg3_flag(tp, 5755_PLUS)) | 14278 | if (tg3_flag(tp, 5755_PLUS) || |
| 14279 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) | ||
| 14279 | tg3_flag_set(tp, SHORT_DMA_BUG); | 14280 | tg3_flag_set(tp, SHORT_DMA_BUG); |
| 14280 | 14281 | ||
| 14281 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) | 14282 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719) |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 8d06ea381741..921c2082af4c 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
| @@ -122,15 +122,15 @@ static int be_mcc_compl_process(struct be_adapter *adapter, | |||
| 122 | goto done; | 122 | goto done; |
| 123 | 123 | ||
| 124 | if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) { | 124 | if (compl_status == MCC_STATUS_UNAUTHORIZED_REQUEST) { |
| 125 | dev_warn(&adapter->pdev->dev, "This domain(VM) is not " | 125 | dev_warn(&adapter->pdev->dev, |
| 126 | "permitted to execute this cmd (opcode %d)\n", | 126 | "opcode %d-%d is not permitted\n", |
| 127 | opcode); | 127 | opcode, subsystem); |
| 128 | } else { | 128 | } else { |
| 129 | extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) & | 129 | extd_status = (compl->status >> CQE_STATUS_EXTD_SHIFT) & |
| 130 | CQE_STATUS_EXTD_MASK; | 130 | CQE_STATUS_EXTD_MASK; |
| 131 | dev_err(&adapter->pdev->dev, "Cmd (opcode %d) failed:" | 131 | dev_err(&adapter->pdev->dev, |
| 132 | "status %d, extd-status %d\n", | 132 | "opcode %d-%d failed:status %d-%d\n", |
| 133 | opcode, compl_status, extd_status); | 133 | opcode, subsystem, compl_status, extd_status); |
| 134 | } | 134 | } |
| 135 | } | 135 | } |
| 136 | done: | 136 | done: |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index 9625bf420c16..b3f3fc3d1323 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
| @@ -1566,7 +1566,7 @@ struct be_hw_stats_v1 { | |||
| 1566 | u32 rsvd0[BE_TXP_SW_SZ]; | 1566 | u32 rsvd0[BE_TXP_SW_SZ]; |
| 1567 | struct be_erx_stats_v1 erx; | 1567 | struct be_erx_stats_v1 erx; |
| 1568 | struct be_pmem_stats pmem; | 1568 | struct be_pmem_stats pmem; |
| 1569 | u32 rsvd1[3]; | 1569 | u32 rsvd1[18]; |
| 1570 | }; | 1570 | }; |
| 1571 | 1571 | ||
| 1572 | struct be_cmd_req_get_stats_v1 { | 1572 | struct be_cmd_req_get_stats_v1 { |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 08efd308d78a..501dfa9c88ec 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -736,6 +736,8 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, | |||
| 736 | 736 | ||
| 737 | copied = make_tx_wrbs(adapter, txq, skb, wrb_cnt, dummy_wrb); | 737 | copied = make_tx_wrbs(adapter, txq, skb, wrb_cnt, dummy_wrb); |
| 738 | if (copied) { | 738 | if (copied) { |
| 739 | int gso_segs = skb_shinfo(skb)->gso_segs; | ||
| 740 | |||
| 739 | /* record the sent skb in the sent_skb table */ | 741 | /* record the sent skb in the sent_skb table */ |
| 740 | BUG_ON(txo->sent_skb_list[start]); | 742 | BUG_ON(txo->sent_skb_list[start]); |
| 741 | txo->sent_skb_list[start] = skb; | 743 | txo->sent_skb_list[start] = skb; |
| @@ -753,8 +755,7 @@ static netdev_tx_t be_xmit(struct sk_buff *skb, | |||
| 753 | 755 | ||
| 754 | be_txq_notify(adapter, txq->id, wrb_cnt); | 756 | be_txq_notify(adapter, txq->id, wrb_cnt); |
| 755 | 757 | ||
| 756 | be_tx_stats_update(txo, wrb_cnt, copied, | 758 | be_tx_stats_update(txo, wrb_cnt, copied, gso_segs, stopped); |
| 757 | skb_shinfo(skb)->gso_segs, stopped); | ||
| 758 | } else { | 759 | } else { |
| 759 | txq->head = start; | 760 | txq->head = start; |
| 760 | dev_kfree_skb_any(skb); | 761 | dev_kfree_skb_any(skb); |
| @@ -3236,7 +3237,7 @@ static void be_netdev_init(struct net_device *netdev) | |||
| 3236 | 3237 | ||
| 3237 | netdev->flags |= IFF_MULTICAST; | 3238 | netdev->flags |= IFF_MULTICAST; |
| 3238 | 3239 | ||
| 3239 | netif_set_gso_max_size(netdev, 65535); | 3240 | netif_set_gso_max_size(netdev, 65535 - ETH_HLEN); |
| 3240 | 3241 | ||
| 3241 | netdev->netdev_ops = &be_netdev_ops; | 3242 | netdev->netdev_ops = &be_netdev_ops; |
| 3242 | 3243 | ||
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 0741aded9eb0..ab1d80ff0791 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
| @@ -1804,18 +1804,16 @@ void gfar_configure_coalescing(struct gfar_private *priv, | |||
| 1804 | if (priv->mode == MQ_MG_MODE) { | 1804 | if (priv->mode == MQ_MG_MODE) { |
| 1805 | baddr = ®s->txic0; | 1805 | baddr = ®s->txic0; |
| 1806 | for_each_set_bit(i, &tx_mask, priv->num_tx_queues) { | 1806 | for_each_set_bit(i, &tx_mask, priv->num_tx_queues) { |
| 1807 | if (likely(priv->tx_queue[i]->txcoalescing)) { | 1807 | gfar_write(baddr + i, 0); |
| 1808 | gfar_write(baddr + i, 0); | 1808 | if (likely(priv->tx_queue[i]->txcoalescing)) |
| 1809 | gfar_write(baddr + i, priv->tx_queue[i]->txic); | 1809 | gfar_write(baddr + i, priv->tx_queue[i]->txic); |
| 1810 | } | ||
| 1811 | } | 1810 | } |
| 1812 | 1811 | ||
| 1813 | baddr = ®s->rxic0; | 1812 | baddr = ®s->rxic0; |
| 1814 | for_each_set_bit(i, &rx_mask, priv->num_rx_queues) { | 1813 | for_each_set_bit(i, &rx_mask, priv->num_rx_queues) { |
| 1815 | if (likely(priv->rx_queue[i]->rxcoalescing)) { | 1814 | gfar_write(baddr + i, 0); |
| 1816 | gfar_write(baddr + i, 0); | 1815 | if (likely(priv->rx_queue[i]->rxcoalescing)) |
| 1817 | gfar_write(baddr + i, priv->rx_queue[i]->rxic); | 1816 | gfar_write(baddr + i, priv->rx_queue[i]->rxic); |
| 1818 | } | ||
| 1819 | } | 1817 | } |
| 1820 | } | 1818 | } |
| 1821 | } | 1819 | } |
| @@ -2065,10 +2063,9 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 2065 | return NETDEV_TX_OK; | 2063 | return NETDEV_TX_OK; |
| 2066 | } | 2064 | } |
| 2067 | 2065 | ||
| 2068 | /* Steal sock reference for processing TX time stamps */ | 2066 | if (skb->sk) |
| 2069 | swap(skb_new->sk, skb->sk); | 2067 | skb_set_owner_w(skb_new, skb->sk); |
| 2070 | swap(skb_new->destructor, skb->destructor); | 2068 | consume_skb(skb); |
| 2071 | kfree_skb(skb); | ||
| 2072 | skb = skb_new; | 2069 | skb = skb_new; |
| 2073 | } | 2070 | } |
| 2074 | 2071 | ||
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig index 79b07ec6726f..0cafe4fe9406 100644 --- a/drivers/net/ethernet/intel/Kconfig +++ b/drivers/net/ethernet/intel/Kconfig | |||
| @@ -122,8 +122,10 @@ config IGB_DCA | |||
| 122 | 122 | ||
| 123 | config IGB_PTP | 123 | config IGB_PTP |
| 124 | bool "PTP Hardware Clock (PHC)" | 124 | bool "PTP Hardware Clock (PHC)" |
| 125 | default y | 125 | default n |
| 126 | depends on IGB && PTP_1588_CLOCK | 126 | depends on IGB && EXPERIMENTAL |
| 127 | select PPS | ||
| 128 | select PTP_1588_CLOCK | ||
| 127 | ---help--- | 129 | ---help--- |
| 128 | Say Y here if you want to use PTP Hardware Clock (PHC) in the | 130 | Say Y here if you want to use PTP Hardware Clock (PHC) in the |
| 129 | driver. Only the basic clock operations have been implemented. | 131 | driver. Only the basic clock operations have been implemented. |
| @@ -223,7 +225,9 @@ config IXGBE_DCB | |||
| 223 | config IXGBE_PTP | 225 | config IXGBE_PTP |
| 224 | bool "PTP Clock Support" | 226 | bool "PTP Clock Support" |
| 225 | default n | 227 | default n |
| 226 | depends on IXGBE && PTP_1588_CLOCK | 228 | depends on IXGBE && EXPERIMENTAL |
| 229 | select PPS | ||
| 230 | select PTP_1588_CLOCK | ||
| 227 | ---help--- | 231 | ---help--- |
| 228 | Say Y here if you want support for 1588 Timestamping with a | 232 | Say Y here if you want support for 1588 Timestamping with a |
| 229 | PHC device, using the PTP 1588 Clock support. This is | 233 | PHC device, using the PTP 1588 Clock support. This is |
diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c index 36db4df09aed..1f063dcd8f85 100644 --- a/drivers/net/ethernet/intel/e1000e/82571.c +++ b/drivers/net/ethernet/intel/e1000e/82571.c | |||
| @@ -1572,6 +1572,9 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) | |||
| 1572 | ctrl = er32(CTRL); | 1572 | ctrl = er32(CTRL); |
| 1573 | status = er32(STATUS); | 1573 | status = er32(STATUS); |
| 1574 | rxcw = er32(RXCW); | 1574 | rxcw = er32(RXCW); |
| 1575 | /* SYNCH bit and IV bit are sticky */ | ||
| 1576 | udelay(10); | ||
| 1577 | rxcw = er32(RXCW); | ||
| 1575 | 1578 | ||
| 1576 | if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) { | 1579 | if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) { |
| 1577 | 1580 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/defines.h b/drivers/net/ethernet/intel/e1000e/defines.h index 351a4097b2ba..76edbc1be33b 100644 --- a/drivers/net/ethernet/intel/e1000e/defines.h +++ b/drivers/net/ethernet/intel/e1000e/defines.h | |||
| @@ -103,6 +103,7 @@ | |||
| 103 | #define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ | 103 | #define E1000_RXD_ERR_SEQ 0x04 /* Sequence Error */ |
| 104 | #define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ | 104 | #define E1000_RXD_ERR_CXE 0x10 /* Carrier Extension Error */ |
| 105 | #define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ | 105 | #define E1000_RXD_ERR_TCPE 0x20 /* TCP/UDP Checksum Error */ |
| 106 | #define E1000_RXD_ERR_IPE 0x40 /* IP Checksum Error */ | ||
| 106 | #define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ | 107 | #define E1000_RXD_ERR_RXE 0x80 /* Rx Data Error */ |
| 107 | #define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ | 108 | #define E1000_RXD_SPC_VLAN_MASK 0x0FFF /* VLAN ID is in lower 12 bits */ |
| 108 | 109 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/ethtool.c b/drivers/net/ethernet/intel/e1000e/ethtool.c index d863075df7a4..905e2147d918 100644 --- a/drivers/net/ethernet/intel/e1000e/ethtool.c +++ b/drivers/net/ethernet/intel/e1000e/ethtool.c | |||
| @@ -258,7 +258,8 @@ static int e1000_set_settings(struct net_device *netdev, | |||
| 258 | * When SoL/IDER sessions are active, autoneg/speed/duplex | 258 | * When SoL/IDER sessions are active, autoneg/speed/duplex |
| 259 | * cannot be changed | 259 | * cannot be changed |
| 260 | */ | 260 | */ |
| 261 | if (hw->phy.ops.check_reset_block(hw)) { | 261 | if (hw->phy.ops.check_reset_block && |
| 262 | hw->phy.ops.check_reset_block(hw)) { | ||
| 262 | e_err("Cannot change link characteristics when SoL/IDER is active.\n"); | 263 | e_err("Cannot change link characteristics when SoL/IDER is active.\n"); |
| 263 | return -EINVAL; | 264 | return -EINVAL; |
| 264 | } | 265 | } |
| @@ -1615,7 +1616,8 @@ static int e1000_loopback_test(struct e1000_adapter *adapter, u64 *data) | |||
| 1615 | * PHY loopback cannot be performed if SoL/IDER | 1616 | * PHY loopback cannot be performed if SoL/IDER |
| 1616 | * sessions are active | 1617 | * sessions are active |
| 1617 | */ | 1618 | */ |
| 1618 | if (hw->phy.ops.check_reset_block(hw)) { | 1619 | if (hw->phy.ops.check_reset_block && |
| 1620 | hw->phy.ops.check_reset_block(hw)) { | ||
| 1619 | e_err("Cannot do PHY loopback test when SoL/IDER is active.\n"); | 1621 | e_err("Cannot do PHY loopback test when SoL/IDER is active.\n"); |
| 1620 | *data = 0; | 1622 | *data = 0; |
| 1621 | goto out; | 1623 | goto out; |
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 238ab2f8a5e7..e3a7b07df629 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
| @@ -325,24 +325,46 @@ static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val) | |||
| 325 | **/ | 325 | **/ |
| 326 | static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) | 326 | static bool e1000_phy_is_accessible_pchlan(struct e1000_hw *hw) |
| 327 | { | 327 | { |
| 328 | u16 phy_reg; | 328 | u16 phy_reg = 0; |
| 329 | u32 phy_id; | 329 | u32 phy_id = 0; |
| 330 | s32 ret_val; | ||
| 331 | u16 retry_count; | ||
| 332 | |||
| 333 | for (retry_count = 0; retry_count < 2; retry_count++) { | ||
| 334 | ret_val = e1e_rphy_locked(hw, PHY_ID1, &phy_reg); | ||
| 335 | if (ret_val || (phy_reg == 0xFFFF)) | ||
| 336 | continue; | ||
| 337 | phy_id = (u32)(phy_reg << 16); | ||
| 330 | 338 | ||
| 331 | e1e_rphy_locked(hw, PHY_ID1, &phy_reg); | 339 | ret_val = e1e_rphy_locked(hw, PHY_ID2, &phy_reg); |
| 332 | phy_id = (u32)(phy_reg << 16); | 340 | if (ret_val || (phy_reg == 0xFFFF)) { |
| 333 | e1e_rphy_locked(hw, PHY_ID2, &phy_reg); | 341 | phy_id = 0; |
| 334 | phy_id |= (u32)(phy_reg & PHY_REVISION_MASK); | 342 | continue; |
| 343 | } | ||
| 344 | phy_id |= (u32)(phy_reg & PHY_REVISION_MASK); | ||
| 345 | break; | ||
| 346 | } | ||
| 335 | 347 | ||
| 336 | if (hw->phy.id) { | 348 | if (hw->phy.id) { |
| 337 | if (hw->phy.id == phy_id) | 349 | if (hw->phy.id == phy_id) |
| 338 | return true; | 350 | return true; |
| 339 | } else { | 351 | } else if (phy_id) { |
| 340 | if ((phy_id != 0) && (phy_id != PHY_REVISION_MASK)) | 352 | hw->phy.id = phy_id; |
| 341 | hw->phy.id = phy_id; | 353 | hw->phy.revision = (u32)(phy_reg & ~PHY_REVISION_MASK); |
| 342 | return true; | 354 | return true; |
| 343 | } | 355 | } |
| 344 | 356 | ||
| 345 | return false; | 357 | /* |
| 358 | * In case the PHY needs to be in mdio slow mode, | ||
| 359 | * set slow mode and try to get the PHY id again. | ||
| 360 | */ | ||
| 361 | hw->phy.ops.release(hw); | ||
| 362 | ret_val = e1000_set_mdio_slow_mode_hv(hw); | ||
| 363 | if (!ret_val) | ||
| 364 | ret_val = e1000e_get_phy_id(hw); | ||
| 365 | hw->phy.ops.acquire(hw); | ||
| 366 | |||
| 367 | return !ret_val; | ||
| 346 | } | 368 | } |
| 347 | 369 | ||
| 348 | /** | 370 | /** |
diff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c index 026e8b3ab52e..a13439928488 100644 --- a/drivers/net/ethernet/intel/e1000e/mac.c +++ b/drivers/net/ethernet/intel/e1000e/mac.c | |||
| @@ -709,7 +709,7 @@ s32 e1000e_setup_link_generic(struct e1000_hw *hw) | |||
| 709 | * In the case of the phy reset being blocked, we already have a link. | 709 | * In the case of the phy reset being blocked, we already have a link. |
| 710 | * We do not need to set it up again. | 710 | * We do not need to set it up again. |
| 711 | */ | 711 | */ |
| 712 | if (hw->phy.ops.check_reset_block(hw)) | 712 | if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) |
| 713 | return 0; | 713 | return 0; |
| 714 | 714 | ||
| 715 | /* | 715 | /* |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index a4b0435b00dc..623e30b9964d 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
| @@ -496,7 +496,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter, | |||
| 496 | * @sk_buff: socket buffer with received data | 496 | * @sk_buff: socket buffer with received data |
| 497 | **/ | 497 | **/ |
| 498 | static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | 498 | static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, |
| 499 | __le16 csum, struct sk_buff *skb) | 499 | struct sk_buff *skb) |
| 500 | { | 500 | { |
| 501 | u16 status = (u16)status_err; | 501 | u16 status = (u16)status_err; |
| 502 | u8 errors = (u8)(status_err >> 24); | 502 | u8 errors = (u8)(status_err >> 24); |
| @@ -511,8 +511,8 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | |||
| 511 | if (status & E1000_RXD_STAT_IXSM) | 511 | if (status & E1000_RXD_STAT_IXSM) |
| 512 | return; | 512 | return; |
| 513 | 513 | ||
| 514 | /* TCP/UDP checksum error bit is set */ | 514 | /* TCP/UDP checksum error bit or IP checksum error bit is set */ |
| 515 | if (errors & E1000_RXD_ERR_TCPE) { | 515 | if (errors & (E1000_RXD_ERR_TCPE | E1000_RXD_ERR_IPE)) { |
| 516 | /* let the stack verify checksum errors */ | 516 | /* let the stack verify checksum errors */ |
| 517 | adapter->hw_csum_err++; | 517 | adapter->hw_csum_err++; |
| 518 | return; | 518 | return; |
| @@ -523,19 +523,7 @@ static void e1000_rx_checksum(struct e1000_adapter *adapter, u32 status_err, | |||
| 523 | return; | 523 | return; |
| 524 | 524 | ||
| 525 | /* It must be a TCP or UDP packet with a valid checksum */ | 525 | /* It must be a TCP or UDP packet with a valid checksum */ |
| 526 | if (status & E1000_RXD_STAT_TCPCS) { | 526 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 527 | /* TCP checksum is good */ | ||
| 528 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 529 | } else { | ||
| 530 | /* | ||
| 531 | * IP fragment with UDP payload | ||
| 532 | * Hardware complements the payload checksum, so we undo it | ||
| 533 | * and then put the value in host order for further stack use. | ||
| 534 | */ | ||
| 535 | __sum16 sum = (__force __sum16)swab16((__force u16)csum); | ||
| 536 | skb->csum = csum_unfold(~sum); | ||
| 537 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
| 538 | } | ||
| 539 | adapter->hw_csum_good++; | 527 | adapter->hw_csum_good++; |
| 540 | } | 528 | } |
| 541 | 529 | ||
| @@ -954,8 +942,7 @@ static bool e1000_clean_rx_irq(struct e1000_ring *rx_ring, int *work_done, | |||
| 954 | skb_put(skb, length); | 942 | skb_put(skb, length); |
| 955 | 943 | ||
| 956 | /* Receive Checksum Offload */ | 944 | /* Receive Checksum Offload */ |
| 957 | e1000_rx_checksum(adapter, staterr, | 945 | e1000_rx_checksum(adapter, staterr, skb); |
| 958 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
| 959 | 946 | ||
| 960 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 947 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
| 961 | 948 | ||
| @@ -1341,8 +1328,7 @@ copydone: | |||
| 1341 | total_rx_bytes += skb->len; | 1328 | total_rx_bytes += skb->len; |
| 1342 | total_rx_packets++; | 1329 | total_rx_packets++; |
| 1343 | 1330 | ||
| 1344 | e1000_rx_checksum(adapter, staterr, | 1331 | e1000_rx_checksum(adapter, staterr, skb); |
| 1345 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
| 1346 | 1332 | ||
| 1347 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 1333 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
| 1348 | 1334 | ||
| @@ -1512,9 +1498,8 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_ring *rx_ring, int *work_done, | |||
| 1512 | } | 1498 | } |
| 1513 | } | 1499 | } |
| 1514 | 1500 | ||
| 1515 | /* Receive Checksum Offload XXX recompute due to CRC strip? */ | 1501 | /* Receive Checksum Offload */ |
| 1516 | e1000_rx_checksum(adapter, staterr, | 1502 | e1000_rx_checksum(adapter, staterr, skb); |
| 1517 | rx_desc->wb.lower.hi_dword.csum_ip.csum, skb); | ||
| 1518 | 1503 | ||
| 1519 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); | 1504 | e1000_rx_hash(netdev, rx_desc->wb.lower.hi_dword.rss, skb); |
| 1520 | 1505 | ||
| @@ -3098,19 +3083,10 @@ static void e1000_configure_rx(struct e1000_adapter *adapter) | |||
| 3098 | 3083 | ||
| 3099 | /* Enable Receive Checksum Offload for TCP and UDP */ | 3084 | /* Enable Receive Checksum Offload for TCP and UDP */ |
| 3100 | rxcsum = er32(RXCSUM); | 3085 | rxcsum = er32(RXCSUM); |
| 3101 | if (adapter->netdev->features & NETIF_F_RXCSUM) { | 3086 | if (adapter->netdev->features & NETIF_F_RXCSUM) |
| 3102 | rxcsum |= E1000_RXCSUM_TUOFL; | 3087 | rxcsum |= E1000_RXCSUM_TUOFL; |
| 3103 | 3088 | else | |
| 3104 | /* | ||
| 3105 | * IPv4 payload checksum for UDP fragments must be | ||
| 3106 | * used in conjunction with packet-split. | ||
| 3107 | */ | ||
| 3108 | if (adapter->rx_ps_pages) | ||
| 3109 | rxcsum |= E1000_RXCSUM_IPPCSE; | ||
| 3110 | } else { | ||
| 3111 | rxcsum &= ~E1000_RXCSUM_TUOFL; | 3089 | rxcsum &= ~E1000_RXCSUM_TUOFL; |
| 3112 | /* no need to clear IPPCSE as it defaults to 0 */ | ||
| 3113 | } | ||
| 3114 | ew32(RXCSUM, rxcsum); | 3090 | ew32(RXCSUM, rxcsum); |
| 3115 | 3091 | ||
| 3116 | if (adapter->hw.mac.type == e1000_pch2lan) { | 3092 | if (adapter->hw.mac.type == e1000_pch2lan) { |
| @@ -5241,22 +5217,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
| 5241 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; | 5217 | int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN; |
| 5242 | 5218 | ||
| 5243 | /* Jumbo frame support */ | 5219 | /* Jumbo frame support */ |
| 5244 | if (max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) { | 5220 | if ((max_frame > ETH_FRAME_LEN + ETH_FCS_LEN) && |
| 5245 | if (!(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { | 5221 | !(adapter->flags & FLAG_HAS_JUMBO_FRAMES)) { |
| 5246 | e_err("Jumbo Frames not supported.\n"); | 5222 | e_err("Jumbo Frames not supported.\n"); |
| 5247 | return -EINVAL; | 5223 | return -EINVAL; |
| 5248 | } | ||
| 5249 | |||
| 5250 | /* | ||
| 5251 | * IP payload checksum (enabled with jumbos/packet-split when | ||
| 5252 | * Rx checksum is enabled) and generation of RSS hash is | ||
| 5253 | * mutually exclusive in the hardware. | ||
| 5254 | */ | ||
| 5255 | if ((netdev->features & NETIF_F_RXCSUM) && | ||
| 5256 | (netdev->features & NETIF_F_RXHASH)) { | ||
| 5257 | e_err("Jumbo frames cannot be enabled when both receive checksum offload and receive hashing are enabled. Disable one of the receive offload features before enabling jumbos.\n"); | ||
| 5258 | return -EINVAL; | ||
| 5259 | } | ||
| 5260 | } | 5224 | } |
| 5261 | 5225 | ||
| 5262 | /* Supported frame sizes */ | 5226 | /* Supported frame sizes */ |
| @@ -6030,17 +5994,6 @@ static int e1000_set_features(struct net_device *netdev, | |||
| 6030 | NETIF_F_RXALL))) | 5994 | NETIF_F_RXALL))) |
| 6031 | return 0; | 5995 | return 0; |
| 6032 | 5996 | ||
| 6033 | /* | ||
| 6034 | * IP payload checksum (enabled with jumbos/packet-split when Rx | ||
| 6035 | * checksum is enabled) and generation of RSS hash is mutually | ||
| 6036 | * exclusive in the hardware. | ||
| 6037 | */ | ||
| 6038 | if (adapter->rx_ps_pages && | ||
| 6039 | (features & NETIF_F_RXCSUM) && (features & NETIF_F_RXHASH)) { | ||
| 6040 | e_err("Enabling both receive checksum offload and receive hashing is not possible with jumbo frames. Disable jumbos or enable only one of the receive offload features.\n"); | ||
| 6041 | return -EINVAL; | ||
| 6042 | } | ||
| 6043 | |||
| 6044 | if (changed & NETIF_F_RXFCS) { | 5997 | if (changed & NETIF_F_RXFCS) { |
| 6045 | if (features & NETIF_F_RXFCS) { | 5998 | if (features & NETIF_F_RXFCS) { |
| 6046 | adapter->flags2 &= ~FLAG2_CRC_STRIPPING; | 5999 | adapter->flags2 &= ~FLAG2_CRC_STRIPPING; |
| @@ -6237,7 +6190,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
| 6237 | adapter->hw.phy.ms_type = e1000_ms_hw_default; | 6190 | adapter->hw.phy.ms_type = e1000_ms_hw_default; |
| 6238 | } | 6191 | } |
| 6239 | 6192 | ||
| 6240 | if (hw->phy.ops.check_reset_block(hw)) | 6193 | if (hw->phy.ops.check_reset_block && hw->phy.ops.check_reset_block(hw)) |
| 6241 | e_info("PHY reset is blocked due to SOL/IDER session.\n"); | 6194 | e_info("PHY reset is blocked due to SOL/IDER session.\n"); |
| 6242 | 6195 | ||
| 6243 | /* Set initial default active device features */ | 6196 | /* Set initial default active device features */ |
| @@ -6404,7 +6357,7 @@ err_register: | |||
| 6404 | if (!(adapter->flags & FLAG_HAS_AMT)) | 6357 | if (!(adapter->flags & FLAG_HAS_AMT)) |
| 6405 | e1000e_release_hw_control(adapter); | 6358 | e1000e_release_hw_control(adapter); |
| 6406 | err_eeprom: | 6359 | err_eeprom: |
| 6407 | if (!hw->phy.ops.check_reset_block(hw)) | 6360 | if (hw->phy.ops.check_reset_block && !hw->phy.ops.check_reset_block(hw)) |
| 6408 | e1000_phy_hw_reset(&adapter->hw); | 6361 | e1000_phy_hw_reset(&adapter->hw); |
| 6409 | err_hw_init: | 6362 | err_hw_init: |
| 6410 | kfree(adapter->tx_ring); | 6363 | kfree(adapter->tx_ring); |
diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c index 0334d013bc3c..b860d4f7ea2a 100644 --- a/drivers/net/ethernet/intel/e1000e/phy.c +++ b/drivers/net/ethernet/intel/e1000e/phy.c | |||
| @@ -2155,9 +2155,11 @@ s32 e1000e_phy_hw_reset_generic(struct e1000_hw *hw) | |||
| 2155 | s32 ret_val; | 2155 | s32 ret_val; |
| 2156 | u32 ctrl; | 2156 | u32 ctrl; |
| 2157 | 2157 | ||
| 2158 | ret_val = phy->ops.check_reset_block(hw); | 2158 | if (phy->ops.check_reset_block) { |
| 2159 | if (ret_val) | 2159 | ret_val = phy->ops.check_reset_block(hw); |
| 2160 | return 0; | 2160 | if (ret_val) |
| 2161 | return 0; | ||
| 2162 | } | ||
| 2161 | 2163 | ||
| 2162 | ret_val = phy->ops.acquire(hw); | 2164 | ret_val = phy->ops.acquire(hw); |
| 2163 | if (ret_val) | 2165 | if (ret_val) |
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c index e65083958421..5e84eaac48c1 100644 --- a/drivers/net/ethernet/intel/igb/e1000_82575.c +++ b/drivers/net/ethernet/intel/igb/e1000_82575.c | |||
| @@ -206,8 +206,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
| 206 | mac->rar_entry_count = E1000_RAR_ENTRIES_82580; | 206 | mac->rar_entry_count = E1000_RAR_ENTRIES_82580; |
| 207 | break; | 207 | break; |
| 208 | case e1000_i350: | 208 | case e1000_i350: |
| 209 | case e1000_i210: | ||
| 210 | case e1000_i211: | ||
| 211 | mac->rar_entry_count = E1000_RAR_ENTRIES_I350; | 209 | mac->rar_entry_count = E1000_RAR_ENTRIES_I350; |
| 212 | break; | 210 | break; |
| 213 | default: | 211 | default: |
diff --git a/drivers/net/ethernet/intel/igbvf/ethtool.c b/drivers/net/ethernet/intel/igbvf/ethtool.c index 8ce67064b9c5..90eef07943f4 100644 --- a/drivers/net/ethernet/intel/igbvf/ethtool.c +++ b/drivers/net/ethernet/intel/igbvf/ethtool.c | |||
| @@ -357,21 +357,28 @@ static int igbvf_set_coalesce(struct net_device *netdev, | |||
| 357 | struct igbvf_adapter *adapter = netdev_priv(netdev); | 357 | struct igbvf_adapter *adapter = netdev_priv(netdev); |
| 358 | struct e1000_hw *hw = &adapter->hw; | 358 | struct e1000_hw *hw = &adapter->hw; |
| 359 | 359 | ||
| 360 | if ((ec->rx_coalesce_usecs > IGBVF_MAX_ITR_USECS) || | 360 | if ((ec->rx_coalesce_usecs >= IGBVF_MIN_ITR_USECS) && |
| 361 | ((ec->rx_coalesce_usecs > 3) && | 361 | (ec->rx_coalesce_usecs <= IGBVF_MAX_ITR_USECS)) { |
| 362 | (ec->rx_coalesce_usecs < IGBVF_MIN_ITR_USECS)) || | 362 | adapter->current_itr = ec->rx_coalesce_usecs << 2; |
| 363 | (ec->rx_coalesce_usecs == 2)) | 363 | adapter->requested_itr = 1000000000 / |
| 364 | return -EINVAL; | 364 | (adapter->current_itr * 256); |
| 365 | 365 | } else if ((ec->rx_coalesce_usecs == 3) || | |
| 366 | /* convert to rate of irq's per second */ | 366 | (ec->rx_coalesce_usecs == 2)) { |
| 367 | if (ec->rx_coalesce_usecs && ec->rx_coalesce_usecs <= 3) { | ||
| 368 | adapter->current_itr = IGBVF_START_ITR; | 367 | adapter->current_itr = IGBVF_START_ITR; |
| 369 | adapter->requested_itr = ec->rx_coalesce_usecs; | 368 | adapter->requested_itr = ec->rx_coalesce_usecs; |
| 370 | } else { | 369 | } else if (ec->rx_coalesce_usecs == 0) { |
| 371 | adapter->current_itr = ec->rx_coalesce_usecs << 2; | 370 | /* |
| 371 | * The user's desire is to turn off interrupt throttling | ||
| 372 | * altogether, but due to HW limitations, we can't do that. | ||
| 373 | * Instead we set a very small value in EITR, which would | ||
| 374 | * allow ~967k interrupts per second, but allow the adapter's | ||
| 375 | * internal clocking to still function properly. | ||
| 376 | */ | ||
| 377 | adapter->current_itr = 4; | ||
| 372 | adapter->requested_itr = 1000000000 / | 378 | adapter->requested_itr = 1000000000 / |
| 373 | (adapter->current_itr * 256); | 379 | (adapter->current_itr * 256); |
| 374 | } | 380 | } else |
| 381 | return -EINVAL; | ||
| 375 | 382 | ||
| 376 | writel(adapter->current_itr, | 383 | writel(adapter->current_itr, |
| 377 | hw->hw_addr + adapter->rx_ring->itr_register); | 384 | hw->hw_addr + adapter->rx_ring->itr_register); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 3ef3c5284e52..7af291e236bf 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
| @@ -196,7 +196,7 @@ enum ixgbe_ring_state_t { | |||
| 196 | __IXGBE_HANG_CHECK_ARMED, | 196 | __IXGBE_HANG_CHECK_ARMED, |
| 197 | __IXGBE_RX_RSC_ENABLED, | 197 | __IXGBE_RX_RSC_ENABLED, |
| 198 | __IXGBE_RX_CSUM_UDP_ZERO_ERR, | 198 | __IXGBE_RX_CSUM_UDP_ZERO_ERR, |
| 199 | __IXGBE_RX_FCOE_BUFSZ, | 199 | __IXGBE_RX_FCOE, |
| 200 | }; | 200 | }; |
| 201 | 201 | ||
| 202 | #define check_for_tx_hang(ring) \ | 202 | #define check_for_tx_hang(ring) \ |
| @@ -290,7 +290,7 @@ struct ixgbe_ring_feature { | |||
| 290 | #if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192) | 290 | #if defined(IXGBE_FCOE) && (PAGE_SIZE < 8192) |
| 291 | static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring) | 291 | static inline unsigned int ixgbe_rx_pg_order(struct ixgbe_ring *ring) |
| 292 | { | 292 | { |
| 293 | return test_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state) ? 1 : 0; | 293 | return test_bit(__IXGBE_RX_FCOE, &ring->state) ? 1 : 0; |
| 294 | } | 294 | } |
| 295 | #else | 295 | #else |
| 296 | #define ixgbe_rx_pg_order(_ring) 0 | 296 | #define ixgbe_rx_pg_order(_ring) 0 |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c index af1a5314b494..c377706e81a8 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | |||
| @@ -634,7 +634,7 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, | |||
| 634 | f = &adapter->ring_feature[RING_F_FCOE]; | 634 | f = &adapter->ring_feature[RING_F_FCOE]; |
| 635 | if ((rxr_idx >= f->mask) && | 635 | if ((rxr_idx >= f->mask) && |
| 636 | (rxr_idx < f->mask + f->indices)) | 636 | (rxr_idx < f->mask + f->indices)) |
| 637 | set_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state); | 637 | set_bit(__IXGBE_RX_FCOE, &ring->state); |
| 638 | } | 638 | } |
| 639 | 639 | ||
| 640 | #endif /* IXGBE_FCOE */ | 640 | #endif /* IXGBE_FCOE */ |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index bf20457ea23a..e242104ab471 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
| @@ -1058,17 +1058,17 @@ static inline void ixgbe_rx_hash(struct ixgbe_ring *ring, | |||
| 1058 | #ifdef IXGBE_FCOE | 1058 | #ifdef IXGBE_FCOE |
| 1059 | /** | 1059 | /** |
| 1060 | * ixgbe_rx_is_fcoe - check the rx desc for incoming pkt type | 1060 | * ixgbe_rx_is_fcoe - check the rx desc for incoming pkt type |
| 1061 | * @adapter: address of board private structure | 1061 | * @ring: structure containing ring specific data |
| 1062 | * @rx_desc: advanced rx descriptor | 1062 | * @rx_desc: advanced rx descriptor |
| 1063 | * | 1063 | * |
| 1064 | * Returns : true if it is FCoE pkt | 1064 | * Returns : true if it is FCoE pkt |
| 1065 | */ | 1065 | */ |
| 1066 | static inline bool ixgbe_rx_is_fcoe(struct ixgbe_adapter *adapter, | 1066 | static inline bool ixgbe_rx_is_fcoe(struct ixgbe_ring *ring, |
| 1067 | union ixgbe_adv_rx_desc *rx_desc) | 1067 | union ixgbe_adv_rx_desc *rx_desc) |
| 1068 | { | 1068 | { |
| 1069 | __le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; | 1069 | __le16 pkt_info = rx_desc->wb.lower.lo_dword.hs_rss.pkt_info; |
| 1070 | 1070 | ||
| 1071 | return (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) && | 1071 | return test_bit(__IXGBE_RX_FCOE, &ring->state) && |
| 1072 | ((pkt_info & cpu_to_le16(IXGBE_RXDADV_PKTTYPE_ETQF_MASK)) == | 1072 | ((pkt_info & cpu_to_le16(IXGBE_RXDADV_PKTTYPE_ETQF_MASK)) == |
| 1073 | (cpu_to_le16(IXGBE_ETQF_FILTER_FCOE << | 1073 | (cpu_to_le16(IXGBE_ETQF_FILTER_FCOE << |
| 1074 | IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT))); | 1074 | IXGBE_RXDADV_PKTTYPE_ETQF_SHIFT))); |
| @@ -1148,7 +1148,7 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring *rx_ring, | |||
| 1148 | 1148 | ||
| 1149 | /* alloc new page for storage */ | 1149 | /* alloc new page for storage */ |
| 1150 | if (likely(!page)) { | 1150 | if (likely(!page)) { |
| 1151 | page = alloc_pages(GFP_ATOMIC | __GFP_COLD, | 1151 | page = alloc_pages(GFP_ATOMIC | __GFP_COLD | __GFP_COMP, |
| 1152 | ixgbe_rx_pg_order(rx_ring)); | 1152 | ixgbe_rx_pg_order(rx_ring)); |
| 1153 | if (unlikely(!page)) { | 1153 | if (unlikely(!page)) { |
| 1154 | rx_ring->rx_stats.alloc_rx_page_failed++; | 1154 | rx_ring->rx_stats.alloc_rx_page_failed++; |
| @@ -1390,6 +1390,8 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring, | |||
| 1390 | union ixgbe_adv_rx_desc *rx_desc, | 1390 | union ixgbe_adv_rx_desc *rx_desc, |
| 1391 | struct sk_buff *skb) | 1391 | struct sk_buff *skb) |
| 1392 | { | 1392 | { |
| 1393 | struct net_device *dev = rx_ring->netdev; | ||
| 1394 | |||
| 1393 | ixgbe_update_rsc_stats(rx_ring, skb); | 1395 | ixgbe_update_rsc_stats(rx_ring, skb); |
| 1394 | 1396 | ||
| 1395 | ixgbe_rx_hash(rx_ring, rx_desc, skb); | 1397 | ixgbe_rx_hash(rx_ring, rx_desc, skb); |
| @@ -1401,14 +1403,15 @@ static void ixgbe_process_skb_fields(struct ixgbe_ring *rx_ring, | |||
| 1401 | ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, skb); | 1403 | ixgbe_ptp_rx_hwtstamp(rx_ring->q_vector, skb); |
| 1402 | #endif | 1404 | #endif |
| 1403 | 1405 | ||
| 1404 | if (ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) { | 1406 | if ((dev->features & NETIF_F_HW_VLAN_RX) && |
| 1407 | ixgbe_test_staterr(rx_desc, IXGBE_RXD_STAT_VP)) { | ||
| 1405 | u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan); | 1408 | u16 vid = le16_to_cpu(rx_desc->wb.upper.vlan); |
| 1406 | __vlan_hwaccel_put_tag(skb, vid); | 1409 | __vlan_hwaccel_put_tag(skb, vid); |
| 1407 | } | 1410 | } |
| 1408 | 1411 | ||
| 1409 | skb_record_rx_queue(skb, rx_ring->queue_index); | 1412 | skb_record_rx_queue(skb, rx_ring->queue_index); |
| 1410 | 1413 | ||
| 1411 | skb->protocol = eth_type_trans(skb, rx_ring->netdev); | 1414 | skb->protocol = eth_type_trans(skb, dev); |
| 1412 | } | 1415 | } |
| 1413 | 1416 | ||
| 1414 | static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector, | 1417 | static void ixgbe_rx_skb(struct ixgbe_q_vector *q_vector, |
| @@ -1546,6 +1549,12 @@ static bool ixgbe_cleanup_headers(struct ixgbe_ring *rx_ring, | |||
| 1546 | skb->truesize -= ixgbe_rx_bufsz(rx_ring); | 1549 | skb->truesize -= ixgbe_rx_bufsz(rx_ring); |
| 1547 | } | 1550 | } |
| 1548 | 1551 | ||
| 1552 | #ifdef IXGBE_FCOE | ||
| 1553 | /* do not attempt to pad FCoE Frames as this will disrupt DDP */ | ||
| 1554 | if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) | ||
| 1555 | return false; | ||
| 1556 | |||
| 1557 | #endif | ||
| 1549 | /* if skb_pad returns an error the skb was freed */ | 1558 | /* if skb_pad returns an error the skb was freed */ |
| 1550 | if (unlikely(skb->len < 60)) { | 1559 | if (unlikely(skb->len < 60)) { |
| 1551 | int pad_len = 60 - skb->len; | 1560 | int pad_len = 60 - skb->len; |
| @@ -1772,7 +1781,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
| 1772 | 1781 | ||
| 1773 | #ifdef IXGBE_FCOE | 1782 | #ifdef IXGBE_FCOE |
| 1774 | /* if ddp, not passing to ULD unless for FCP_RSP or error */ | 1783 | /* if ddp, not passing to ULD unless for FCP_RSP or error */ |
| 1775 | if (ixgbe_rx_is_fcoe(adapter, rx_desc)) { | 1784 | if (ixgbe_rx_is_fcoe(rx_ring, rx_desc)) { |
| 1776 | ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb); | 1785 | ddp_bytes = ixgbe_fcoe_ddp(adapter, rx_desc, skb); |
| 1777 | if (!ddp_bytes) { | 1786 | if (!ddp_bytes) { |
| 1778 | dev_kfree_skb_any(skb); | 1787 | dev_kfree_skb_any(skb); |
| @@ -3607,10 +3616,6 @@ static void ixgbe_configure_dcb(struct ixgbe_adapter *adapter) | |||
| 3607 | if (hw->mac.type == ixgbe_mac_82598EB) | 3616 | if (hw->mac.type == ixgbe_mac_82598EB) |
| 3608 | netif_set_gso_max_size(adapter->netdev, 32768); | 3617 | netif_set_gso_max_size(adapter->netdev, 32768); |
| 3609 | 3618 | ||
| 3610 | |||
| 3611 | /* Enable VLAN tag insert/strip */ | ||
| 3612 | adapter->netdev->features |= NETIF_F_HW_VLAN_RX; | ||
| 3613 | |||
| 3614 | hw->mac.ops.set_vfta(&adapter->hw, 0, 0, true); | 3619 | hw->mac.ops.set_vfta(&adapter->hw, 0, 0, true); |
| 3615 | 3620 | ||
| 3616 | #ifdef IXGBE_FCOE | 3621 | #ifdef IXGBE_FCOE |
| @@ -6642,6 +6647,11 @@ int ixgbe_setup_tc(struct net_device *dev, u8 tc) | |||
| 6642 | return -EINVAL; | 6647 | return -EINVAL; |
| 6643 | } | 6648 | } |
| 6644 | 6649 | ||
| 6650 | if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) { | ||
| 6651 | e_err(drv, "Enable failed, SR-IOV enabled\n"); | ||
| 6652 | return -EINVAL; | ||
| 6653 | } | ||
| 6654 | |||
| 6645 | /* Hardware supports up to 8 traffic classes */ | 6655 | /* Hardware supports up to 8 traffic classes */ |
| 6646 | if (tc > adapter->dcb_cfg.num_tcs.pg_tcs || | 6656 | if (tc > adapter->dcb_cfg.num_tcs.pg_tcs || |
| 6647 | (hw->mac.type == ixgbe_mac_82598EB && | 6657 | (hw->mac.type == ixgbe_mac_82598EB && |
| @@ -6701,11 +6711,6 @@ static netdev_features_t ixgbe_fix_features(struct net_device *netdev, | |||
| 6701 | { | 6711 | { |
| 6702 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 6712 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
| 6703 | 6713 | ||
| 6704 | #ifdef CONFIG_DCB | ||
| 6705 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) | ||
| 6706 | features &= ~NETIF_F_HW_VLAN_RX; | ||
| 6707 | #endif | ||
| 6708 | |||
| 6709 | /* return error if RXHASH is being enabled when RSS is not supported */ | 6714 | /* return error if RXHASH is being enabled when RSS is not supported */ |
| 6710 | if (!(adapter->flags & IXGBE_FLAG_RSS_ENABLED)) | 6715 | if (!(adapter->flags & IXGBE_FLAG_RSS_ENABLED)) |
| 6711 | features &= ~NETIF_F_RXHASH; | 6716 | features &= ~NETIF_F_RXHASH; |
| @@ -6718,7 +6723,6 @@ static netdev_features_t ixgbe_fix_features(struct net_device *netdev, | |||
| 6718 | if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) | 6723 | if (!(adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE)) |
| 6719 | features &= ~NETIF_F_LRO; | 6724 | features &= ~NETIF_F_LRO; |
| 6720 | 6725 | ||
| 6721 | |||
| 6722 | return features; | 6726 | return features; |
| 6723 | } | 6727 | } |
| 6724 | 6728 | ||
| @@ -6766,6 +6770,11 @@ static int ixgbe_set_features(struct net_device *netdev, | |||
| 6766 | need_reset = true; | 6770 | need_reset = true; |
| 6767 | } | 6771 | } |
| 6768 | 6772 | ||
| 6773 | if (features & NETIF_F_HW_VLAN_RX) | ||
| 6774 | ixgbe_vlan_strip_enable(adapter); | ||
| 6775 | else | ||
| 6776 | ixgbe_vlan_strip_disable(adapter); | ||
| 6777 | |||
| 6769 | if (changed & NETIF_F_RXALL) | 6778 | if (changed & NETIF_F_RXALL) |
| 6770 | need_reset = true; | 6779 | need_reset = true; |
| 6771 | 6780 | ||
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index ddc6a4d19302..dcebd128becf 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | |||
| @@ -708,6 +708,7 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter) | |||
| 708 | { | 708 | { |
| 709 | struct ixgbe_hw *hw = &adapter->hw; | 709 | struct ixgbe_hw *hw = &adapter->hw; |
| 710 | u32 incval = 0; | 710 | u32 incval = 0; |
| 711 | u32 timinca = 0; | ||
| 711 | u32 shift = 0; | 712 | u32 shift = 0; |
| 712 | u32 cycle_speed; | 713 | u32 cycle_speed; |
| 713 | unsigned long flags; | 714 | unsigned long flags; |
| @@ -730,8 +731,16 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter) | |||
| 730 | break; | 731 | break; |
| 731 | } | 732 | } |
| 732 | 733 | ||
| 733 | /* Bail if the cycle speed didn't change */ | 734 | /* |
| 734 | if (adapter->cycle_speed == cycle_speed) | 735 | * grab the current TIMINCA value from the register so that it can be |
| 736 | * double checked. If the register value has been cleared, it must be | ||
| 737 | * reset to the correct value for generating a cyclecounter. If | ||
| 738 | * TIMINCA is zero, the SYSTIME registers do not increment at all. | ||
| 739 | */ | ||
| 740 | timinca = IXGBE_READ_REG(hw, IXGBE_TIMINCA); | ||
| 741 | |||
| 742 | /* Bail if the cycle speed didn't change and TIMINCA is non-zero */ | ||
| 743 | if (adapter->cycle_speed == cycle_speed && timinca) | ||
| 735 | return; | 744 | return; |
| 736 | 745 | ||
| 737 | /* disable the SDP clock out */ | 746 | /* disable the SDP clock out */ |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index f69ec4288b10..41e32257a4e8 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
| @@ -201,6 +201,9 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter, | |||
| 201 | unsigned int i, eop, count = 0; | 201 | unsigned int i, eop, count = 0; |
| 202 | unsigned int total_bytes = 0, total_packets = 0; | 202 | unsigned int total_bytes = 0, total_packets = 0; |
| 203 | 203 | ||
| 204 | if (test_bit(__IXGBEVF_DOWN, &adapter->state)) | ||
| 205 | return true; | ||
| 206 | |||
| 204 | i = tx_ring->next_to_clean; | 207 | i = tx_ring->next_to_clean; |
| 205 | eop = tx_ring->tx_buffer_info[i].next_to_watch; | 208 | eop = tx_ring->tx_buffer_info[i].next_to_watch; |
| 206 | eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); | 209 | eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop); |
| @@ -969,8 +972,6 @@ static irqreturn_t ixgbevf_msix_clean_tx(int irq, void *data) | |||
| 969 | r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); | 972 | r_idx = find_first_bit(q_vector->txr_idx, adapter->num_tx_queues); |
| 970 | for (i = 0; i < q_vector->txr_count; i++) { | 973 | for (i = 0; i < q_vector->txr_count; i++) { |
| 971 | tx_ring = &(adapter->tx_ring[r_idx]); | 974 | tx_ring = &(adapter->tx_ring[r_idx]); |
| 972 | tx_ring->total_bytes = 0; | ||
| 973 | tx_ring->total_packets = 0; | ||
| 974 | ixgbevf_clean_tx_irq(adapter, tx_ring); | 975 | ixgbevf_clean_tx_irq(adapter, tx_ring); |
| 975 | r_idx = find_next_bit(q_vector->txr_idx, adapter->num_tx_queues, | 976 | r_idx = find_next_bit(q_vector->txr_idx, adapter->num_tx_queues, |
| 976 | r_idx + 1); | 977 | r_idx + 1); |
| @@ -994,16 +995,6 @@ static irqreturn_t ixgbevf_msix_clean_rx(int irq, void *data) | |||
| 994 | struct ixgbe_hw *hw = &adapter->hw; | 995 | struct ixgbe_hw *hw = &adapter->hw; |
| 995 | struct ixgbevf_ring *rx_ring; | 996 | struct ixgbevf_ring *rx_ring; |
| 996 | int r_idx; | 997 | int r_idx; |
| 997 | int i; | ||
| 998 | |||
| 999 | r_idx = find_first_bit(q_vector->rxr_idx, adapter->num_rx_queues); | ||
| 1000 | for (i = 0; i < q_vector->rxr_count; i++) { | ||
| 1001 | rx_ring = &(adapter->rx_ring[r_idx]); | ||
| 1002 | rx_ring->total_bytes = 0; | ||
| 1003 | rx_ring->total_packets = 0; | ||
| 1004 | r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues, | ||
| 1005 | r_idx + 1); | ||
| 1006 | } | ||
| 1007 | 998 | ||
| 1008 | if (!q_vector->rxr_count) | 999 | if (!q_vector->rxr_count) |
| 1009 | return IRQ_HANDLED; | 1000 | return IRQ_HANDLED; |
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 04d901d0ff63..f0f06b2bc28b 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
| @@ -436,7 +436,9 @@ struct mv643xx_eth_private { | |||
| 436 | /* | 436 | /* |
| 437 | * Hardware-specific parameters. | 437 | * Hardware-specific parameters. |
| 438 | */ | 438 | */ |
| 439 | #if defined(CONFIG_HAVE_CLK) | ||
| 439 | struct clk *clk; | 440 | struct clk *clk; |
| 441 | #endif | ||
| 440 | unsigned int t_clk; | 442 | unsigned int t_clk; |
| 441 | }; | 443 | }; |
| 442 | 444 | ||
| @@ -2895,17 +2897,17 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
| 2895 | mp->dev = dev; | 2897 | mp->dev = dev; |
| 2896 | 2898 | ||
| 2897 | /* | 2899 | /* |
| 2898 | * Get the clk rate, if there is one, otherwise use the default. | 2900 | * Start with a default rate, and if there is a clock, allow |
| 2901 | * it to override the default. | ||
| 2899 | */ | 2902 | */ |
| 2903 | mp->t_clk = 133000000; | ||
| 2904 | #if defined(CONFIG_HAVE_CLK) | ||
| 2900 | mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0")); | 2905 | mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0")); |
| 2901 | if (!IS_ERR(mp->clk)) { | 2906 | if (!IS_ERR(mp->clk)) { |
| 2902 | clk_prepare_enable(mp->clk); | 2907 | clk_prepare_enable(mp->clk); |
| 2903 | mp->t_clk = clk_get_rate(mp->clk); | 2908 | mp->t_clk = clk_get_rate(mp->clk); |
| 2904 | } else { | ||
| 2905 | mp->t_clk = 133000000; | ||
| 2906 | printk(KERN_WARNING "Unable to get clock"); | ||
| 2907 | } | 2909 | } |
| 2908 | 2910 | #endif | |
| 2909 | set_params(mp, pd); | 2911 | set_params(mp, pd); |
| 2910 | netif_set_real_num_tx_queues(dev, mp->txq_count); | 2912 | netif_set_real_num_tx_queues(dev, mp->txq_count); |
| 2911 | netif_set_real_num_rx_queues(dev, mp->rxq_count); | 2913 | netif_set_real_num_rx_queues(dev, mp->rxq_count); |
| @@ -2995,10 +2997,13 @@ static int mv643xx_eth_remove(struct platform_device *pdev) | |||
| 2995 | phy_detach(mp->phy); | 2997 | phy_detach(mp->phy); |
| 2996 | cancel_work_sync(&mp->tx_timeout_task); | 2998 | cancel_work_sync(&mp->tx_timeout_task); |
| 2997 | 2999 | ||
| 3000 | #if defined(CONFIG_HAVE_CLK) | ||
| 2998 | if (!IS_ERR(mp->clk)) { | 3001 | if (!IS_ERR(mp->clk)) { |
| 2999 | clk_disable_unprepare(mp->clk); | 3002 | clk_disable_unprepare(mp->clk); |
| 3000 | clk_put(mp->clk); | 3003 | clk_put(mp->clk); |
| 3001 | } | 3004 | } |
| 3005 | #endif | ||
| 3006 | |||
| 3002 | free_netdev(mp->dev); | 3007 | free_netdev(mp->dev); |
| 3003 | 3008 | ||
| 3004 | platform_set_drvdata(pdev, NULL); | 3009 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index cace36f2ab92..28a54451a3e5 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
| @@ -4381,10 +4381,12 @@ static int sky2_set_features(struct net_device *dev, netdev_features_t features) | |||
| 4381 | struct sky2_port *sky2 = netdev_priv(dev); | 4381 | struct sky2_port *sky2 = netdev_priv(dev); |
| 4382 | netdev_features_t changed = dev->features ^ features; | 4382 | netdev_features_t changed = dev->features ^ features; |
| 4383 | 4383 | ||
| 4384 | if (changed & NETIF_F_RXCSUM) { | 4384 | if ((changed & NETIF_F_RXCSUM) && |
| 4385 | bool on = features & NETIF_F_RXCSUM; | 4385 | !(sky2->hw->flags & SKY2_HW_NEW_LE)) { |
| 4386 | sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR), | 4386 | sky2_write32(sky2->hw, |
| 4387 | on ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); | 4387 | Q_ADDR(rxqaddr[sky2->port], Q_CSR), |
| 4388 | (features & NETIF_F_RXCSUM) | ||
| 4389 | ? BMU_ENA_RX_CHKSUM : BMU_DIS_RX_CHKSUM); | ||
| 4388 | } | 4390 | } |
| 4389 | 4391 | ||
| 4390 | if (changed & NETIF_F_RXHASH) | 4392 | if (changed & NETIF_F_RXHASH) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 926d8aac941c..073b85b45fc5 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
| @@ -929,15 +929,20 @@ void mlx4_en_free_resources(struct mlx4_en_priv *priv) | |||
| 929 | if (priv->rx_cq[i].buf) | 929 | if (priv->rx_cq[i].buf) |
| 930 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); | 930 | mlx4_en_destroy_cq(priv, &priv->rx_cq[i]); |
| 931 | } | 931 | } |
| 932 | |||
| 933 | if (priv->base_tx_qpn) { | ||
| 934 | mlx4_qp_release_range(priv->mdev->dev, priv->base_tx_qpn, priv->tx_ring_num); | ||
| 935 | priv->base_tx_qpn = 0; | ||
| 936 | } | ||
| 932 | } | 937 | } |
| 933 | 938 | ||
| 934 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | 939 | int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) |
| 935 | { | 940 | { |
| 936 | struct mlx4_en_port_profile *prof = priv->prof; | 941 | struct mlx4_en_port_profile *prof = priv->prof; |
| 937 | int i; | 942 | int i; |
| 938 | int base_tx_qpn, err; | 943 | int err; |
| 939 | 944 | ||
| 940 | err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &base_tx_qpn); | 945 | err = mlx4_qp_reserve_range(priv->mdev->dev, priv->tx_ring_num, 256, &priv->base_tx_qpn); |
| 941 | if (err) { | 946 | if (err) { |
| 942 | en_err(priv, "failed reserving range for TX rings\n"); | 947 | en_err(priv, "failed reserving range for TX rings\n"); |
| 943 | return err; | 948 | return err; |
| @@ -949,7 +954,7 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
| 949 | prof->tx_ring_size, i, TX)) | 954 | prof->tx_ring_size, i, TX)) |
| 950 | goto err; | 955 | goto err; |
| 951 | 956 | ||
| 952 | if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], base_tx_qpn + i, | 957 | if (mlx4_en_create_tx_ring(priv, &priv->tx_ring[i], priv->base_tx_qpn + i, |
| 953 | prof->tx_ring_size, TXBB_SIZE)) | 958 | prof->tx_ring_size, TXBB_SIZE)) |
| 954 | goto err; | 959 | goto err; |
| 955 | } | 960 | } |
| @@ -969,7 +974,6 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv) | |||
| 969 | 974 | ||
| 970 | err: | 975 | err: |
| 971 | en_err(priv, "Failed to allocate NIC resources\n"); | 976 | en_err(priv, "Failed to allocate NIC resources\n"); |
| 972 | mlx4_qp_release_range(priv->mdev->dev, base_tx_qpn, priv->tx_ring_num); | ||
| 973 | return -ENOMEM; | 977 | return -ENOMEM; |
| 974 | } | 978 | } |
| 975 | 979 | ||
| @@ -1204,9 +1208,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
| 1204 | en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); | 1208 | en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num); |
| 1205 | 1209 | ||
| 1206 | /* Configure port */ | 1210 | /* Configure port */ |
| 1211 | mlx4_en_calc_rx_buf(dev); | ||
| 1207 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, | 1212 | err = mlx4_SET_PORT_general(mdev->dev, priv->port, |
| 1208 | MLX4_EN_MIN_MTU, | 1213 | priv->rx_skb_size + ETH_FCS_LEN, |
| 1209 | 0, 0, 0, 0); | 1214 | prof->tx_pause, prof->tx_ppp, |
| 1215 | prof->rx_pause, prof->rx_ppp); | ||
| 1210 | if (err) { | 1216 | if (err) { |
| 1211 | en_err(priv, "Failed setting port general configurations " | 1217 | en_err(priv, "Failed setting port general configurations " |
| 1212 | "for port %d, with error %d\n", priv->port, err); | 1218 | "for port %d, with error %d\n", priv->port, err); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index ee6f4fe00837..a0313de122de 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
| @@ -1975,6 +1975,8 @@ slave_start: | |||
| 1975 | if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) && | 1975 | if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) && |
| 1976 | !mlx4_is_mfunc(dev)) { | 1976 | !mlx4_is_mfunc(dev)) { |
| 1977 | dev->flags &= ~MLX4_FLAG_MSI_X; | 1977 | dev->flags &= ~MLX4_FLAG_MSI_X; |
| 1978 | dev->caps.num_comp_vectors = 1; | ||
| 1979 | dev->caps.comp_pool = 0; | ||
| 1978 | pci_disable_msix(pdev); | 1980 | pci_disable_msix(pdev); |
| 1979 | err = mlx4_setup_hca(dev); | 1981 | err = mlx4_setup_hca(dev); |
| 1980 | } | 1982 | } |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 6ae350921b1a..225c20d47900 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
| @@ -495,6 +495,7 @@ struct mlx4_en_priv { | |||
| 495 | int vids[128]; | 495 | int vids[128]; |
| 496 | bool wol; | 496 | bool wol; |
| 497 | struct device *ddev; | 497 | struct device *ddev; |
| 498 | int base_tx_qpn; | ||
| 498 | 499 | ||
| 499 | #ifdef CONFIG_MLX4_EN_DCB | 500 | #ifdef CONFIG_MLX4_EN_DCB |
| 500 | struct ieee_ets ets; | 501 | struct ieee_ets ets; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 1fe2c7a8b40c..a8fb52992c64 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c | |||
| @@ -697,10 +697,10 @@ static int mlx4_common_set_port(struct mlx4_dev *dev, int slave, u32 in_mod, | |||
| 697 | if (slave != dev->caps.function) | 697 | if (slave != dev->caps.function) |
| 698 | memset(inbox->buf, 0, 256); | 698 | memset(inbox->buf, 0, 256); |
| 699 | if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { | 699 | if (dev->flags & MLX4_FLAG_OLD_PORT_CMDS) { |
| 700 | *(u8 *) inbox->buf = !!reset_qkey_viols << 6; | 700 | *(u8 *) inbox->buf |= !!reset_qkey_viols << 6; |
| 701 | ((__be32 *) inbox->buf)[2] = agg_cap_mask; | 701 | ((__be32 *) inbox->buf)[2] = agg_cap_mask; |
| 702 | } else { | 702 | } else { |
| 703 | ((u8 *) inbox->buf)[3] = !!reset_qkey_viols; | 703 | ((u8 *) inbox->buf)[3] |= !!reset_qkey_viols; |
| 704 | ((__be32 *) inbox->buf)[1] = agg_cap_mask; | 704 | ((__be32 *) inbox->buf)[1] = agg_cap_mask; |
| 705 | } | 705 | } |
| 706 | 706 | ||
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 8d2666fcffd7..083d6715335c 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
| @@ -946,16 +946,16 @@ static void __lpc_handle_xmit(struct net_device *ndev) | |||
| 946 | /* Update stats */ | 946 | /* Update stats */ |
| 947 | ndev->stats.tx_packets++; | 947 | ndev->stats.tx_packets++; |
| 948 | ndev->stats.tx_bytes += skb->len; | 948 | ndev->stats.tx_bytes += skb->len; |
| 949 | |||
| 950 | /* Free buffer */ | ||
| 951 | dev_kfree_skb_irq(skb); | ||
| 952 | } | 949 | } |
| 950 | dev_kfree_skb_irq(skb); | ||
| 953 | 951 | ||
| 954 | txcidx = readl(LPC_ENET_TXCONSUMEINDEX(pldat->net_base)); | 952 | txcidx = readl(LPC_ENET_TXCONSUMEINDEX(pldat->net_base)); |
| 955 | } | 953 | } |
| 956 | 954 | ||
| 957 | if (netif_queue_stopped(ndev)) | 955 | if (pldat->num_used_tx_buffs <= ENET_TX_DESC/2) { |
| 958 | netif_wake_queue(ndev); | 956 | if (netif_queue_stopped(ndev)) |
| 957 | netif_wake_queue(ndev); | ||
| 958 | } | ||
| 959 | } | 959 | } |
| 960 | 960 | ||
| 961 | static int __lpc_handle_recv(struct net_device *ndev, int budget) | 961 | static int __lpc_handle_recv(struct net_device *ndev, int budget) |
| @@ -1320,6 +1320,7 @@ static const struct net_device_ops lpc_netdev_ops = { | |||
| 1320 | .ndo_set_rx_mode = lpc_eth_set_multicast_list, | 1320 | .ndo_set_rx_mode = lpc_eth_set_multicast_list, |
| 1321 | .ndo_do_ioctl = lpc_eth_ioctl, | 1321 | .ndo_do_ioctl = lpc_eth_ioctl, |
| 1322 | .ndo_set_mac_address = lpc_set_mac_address, | 1322 | .ndo_set_mac_address = lpc_set_mac_address, |
| 1323 | .ndo_change_mtu = eth_change_mtu, | ||
| 1323 | }; | 1324 | }; |
| 1324 | 1325 | ||
| 1325 | static int lpc_eth_drv_probe(struct platform_device *pdev) | 1326 | static int lpc_eth_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 46e77a2c5121..ad98f4d7919d 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | |||
| @@ -479,7 +479,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter) | |||
| 479 | 479 | ||
| 480 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { | 480 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { |
| 481 | pfn = pci_info[i].id; | 481 | pfn = pci_info[i].id; |
| 482 | if (pfn > QLCNIC_MAX_PCI_FUNC) { | 482 | if (pfn >= QLCNIC_MAX_PCI_FUNC) { |
| 483 | ret = QL_STATUS_INVALID_PARAM; | 483 | ret = QL_STATUS_INVALID_PARAM; |
| 484 | goto err_eswitch; | 484 | goto err_eswitch; |
| 485 | } | 485 | } |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 9757ce3543a0..d7a04e091101 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
| @@ -3894,6 +3894,7 @@ static void rtl_init_rxcfg(struct rtl8169_private *tp) | |||
| 3894 | case RTL_GIGA_MAC_VER_22: | 3894 | case RTL_GIGA_MAC_VER_22: |
| 3895 | case RTL_GIGA_MAC_VER_23: | 3895 | case RTL_GIGA_MAC_VER_23: |
| 3896 | case RTL_GIGA_MAC_VER_24: | 3896 | case RTL_GIGA_MAC_VER_24: |
| 3897 | case RTL_GIGA_MAC_VER_34: | ||
| 3897 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); | 3898 | RTL_W32(RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); |
| 3898 | break; | 3899 | break; |
| 3899 | default: | 3900 | default: |
| @@ -5889,11 +5890,7 @@ static void rtl_slow_event_work(struct rtl8169_private *tp) | |||
| 5889 | if (status & LinkChg) | 5890 | if (status & LinkChg) |
| 5890 | __rtl8169_check_link_status(dev, tp, tp->mmio_addr, true); | 5891 | __rtl8169_check_link_status(dev, tp, tp->mmio_addr, true); |
| 5891 | 5892 | ||
| 5892 | napi_disable(&tp->napi); | 5893 | rtl_irq_enable_all(tp); |
| 5893 | rtl_irq_disable(tp); | ||
| 5894 | |||
| 5895 | napi_enable(&tp->napi); | ||
| 5896 | napi_schedule(&tp->napi); | ||
| 5897 | } | 5894 | } |
| 5898 | 5895 | ||
| 5899 | static void rtl_task(struct work_struct *work) | 5896 | static void rtl_task(struct work_struct *work) |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 667169b82526..79bf09b41971 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
| @@ -1011,7 +1011,7 @@ static int sh_eth_txfree(struct net_device *ndev) | |||
| 1011 | } | 1011 | } |
| 1012 | 1012 | ||
| 1013 | /* Packet receive function */ | 1013 | /* Packet receive function */ |
| 1014 | static int sh_eth_rx(struct net_device *ndev) | 1014 | static int sh_eth_rx(struct net_device *ndev, u32 intr_status) |
| 1015 | { | 1015 | { |
| 1016 | struct sh_eth_private *mdp = netdev_priv(ndev); | 1016 | struct sh_eth_private *mdp = netdev_priv(ndev); |
| 1017 | struct sh_eth_rxdesc *rxdesc; | 1017 | struct sh_eth_rxdesc *rxdesc; |
| @@ -1102,9 +1102,11 @@ static int sh_eth_rx(struct net_device *ndev) | |||
| 1102 | /* Restart Rx engine if stopped. */ | 1102 | /* Restart Rx engine if stopped. */ |
| 1103 | /* If we don't need to check status, don't. -KDU */ | 1103 | /* If we don't need to check status, don't. -KDU */ |
| 1104 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { | 1104 | if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { |
| 1105 | /* fix the values for the next receiving */ | 1105 | /* fix the values for the next receiving if RDE is set */ |
| 1106 | mdp->cur_rx = mdp->dirty_rx = (sh_eth_read(ndev, RDFAR) - | 1106 | if (intr_status & EESR_RDE) |
| 1107 | sh_eth_read(ndev, RDLAR)) >> 4; | 1107 | mdp->cur_rx = mdp->dirty_rx = |
| 1108 | (sh_eth_read(ndev, RDFAR) - | ||
| 1109 | sh_eth_read(ndev, RDLAR)) >> 4; | ||
| 1108 | sh_eth_write(ndev, EDRRR_R, EDRRR); | 1110 | sh_eth_write(ndev, EDRRR_R, EDRRR); |
| 1109 | } | 1111 | } |
| 1110 | 1112 | ||
| @@ -1273,7 +1275,7 @@ static irqreturn_t sh_eth_interrupt(int irq, void *netdev) | |||
| 1273 | EESR_RTSF | /* short frame recv */ | 1275 | EESR_RTSF | /* short frame recv */ |
| 1274 | EESR_PRE | /* PHY-LSI recv error */ | 1276 | EESR_PRE | /* PHY-LSI recv error */ |
| 1275 | EESR_CERF)){ /* recv frame CRC error */ | 1277 | EESR_CERF)){ /* recv frame CRC error */ |
| 1276 | sh_eth_rx(ndev); | 1278 | sh_eth_rx(ndev, intr_status); |
| 1277 | } | 1279 | } |
| 1278 | 1280 | ||
| 1279 | /* Tx Check */ | 1281 | /* Tx Check */ |
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index 036428348faa..9f448279e12a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig | |||
| @@ -13,7 +13,7 @@ config STMMAC_ETH | |||
| 13 | if STMMAC_ETH | 13 | if STMMAC_ETH |
| 14 | 14 | ||
| 15 | config STMMAC_PLATFORM | 15 | config STMMAC_PLATFORM |
| 16 | tristate "STMMAC platform bus support" | 16 | bool "STMMAC Platform bus support" |
| 17 | depends on STMMAC_ETH | 17 | depends on STMMAC_ETH |
| 18 | default y | 18 | default y |
| 19 | ---help--- | 19 | ---help--- |
| @@ -26,7 +26,7 @@ config STMMAC_PLATFORM | |||
| 26 | If unsure, say N. | 26 | If unsure, say N. |
| 27 | 27 | ||
| 28 | config STMMAC_PCI | 28 | config STMMAC_PCI |
| 29 | tristate "STMMAC support on PCI bus (EXPERIMENTAL)" | 29 | bool "STMMAC PCI bus support (EXPERIMENTAL)" |
| 30 | depends on STMMAC_ETH && PCI && EXPERIMENTAL | 30 | depends on STMMAC_ETH && PCI && EXPERIMENTAL |
| 31 | ---help--- | 31 | ---help--- |
| 32 | This is to select the Synopsys DWMAC available on PCI devices, | 32 | This is to select the Synopsys DWMAC available on PCI devices, |
diff --git a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c index fb8377da1687..4b785e10f2ed 100644 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c | |||
| @@ -51,7 +51,7 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
| 51 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 51 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
| 52 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, | 52 | priv->hw->desc->prepare_tx_desc(desc, 1, bmax, |
| 53 | csum); | 53 | csum); |
| 54 | 54 | wmb(); | |
| 55 | entry = (++priv->cur_tx) % txsize; | 55 | entry = (++priv->cur_tx) % txsize; |
| 56 | desc = priv->dma_tx + entry; | 56 | desc = priv->dma_tx + entry; |
| 57 | 57 | ||
| @@ -59,6 +59,7 @@ static unsigned int stmmac_jumbo_frm(void *p, struct sk_buff *skb, int csum) | |||
| 59 | len, DMA_TO_DEVICE); | 59 | len, DMA_TO_DEVICE); |
| 60 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; | 60 | desc->des3 = desc->des2 + BUF_SIZE_4KiB; |
| 61 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum); | 61 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum); |
| 62 | wmb(); | ||
| 62 | priv->hw->desc->set_tx_owner(desc); | 63 | priv->hw->desc->set_tx_owner(desc); |
| 63 | priv->tx_skbuff[entry] = NULL; | 64 | priv->tx_skbuff[entry] = NULL; |
| 64 | } else { | 65 | } else { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 6b5d060ee9de..dc20c56efc9d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
| 27 | #include <linux/stmmac.h> | 27 | #include <linux/stmmac.h> |
| 28 | #include <linux/phy.h> | 28 | #include <linux/phy.h> |
| 29 | #include <linux/pci.h> | ||
| 29 | #include "common.h" | 30 | #include "common.h" |
| 30 | #ifdef CONFIG_STMMAC_TIMER | 31 | #ifdef CONFIG_STMMAC_TIMER |
| 31 | #include "stmmac_timer.h" | 32 | #include "stmmac_timer.h" |
| @@ -95,7 +96,6 @@ extern int stmmac_mdio_register(struct net_device *ndev); | |||
| 95 | extern void stmmac_set_ethtool_ops(struct net_device *netdev); | 96 | extern void stmmac_set_ethtool_ops(struct net_device *netdev); |
| 96 | extern const struct stmmac_desc_ops enh_desc_ops; | 97 | extern const struct stmmac_desc_ops enh_desc_ops; |
| 97 | extern const struct stmmac_desc_ops ndesc_ops; | 98 | extern const struct stmmac_desc_ops ndesc_ops; |
| 98 | |||
| 99 | int stmmac_freeze(struct net_device *ndev); | 99 | int stmmac_freeze(struct net_device *ndev); |
| 100 | int stmmac_restore(struct net_device *ndev); | 100 | int stmmac_restore(struct net_device *ndev); |
| 101 | int stmmac_resume(struct net_device *ndev); | 101 | int stmmac_resume(struct net_device *ndev); |
| @@ -109,7 +109,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct device *device, | |||
| 109 | static inline int stmmac_clk_enable(struct stmmac_priv *priv) | 109 | static inline int stmmac_clk_enable(struct stmmac_priv *priv) |
| 110 | { | 110 | { |
| 111 | if (!IS_ERR(priv->stmmac_clk)) | 111 | if (!IS_ERR(priv->stmmac_clk)) |
| 112 | return clk_enable(priv->stmmac_clk); | 112 | return clk_prepare_enable(priv->stmmac_clk); |
| 113 | 113 | ||
| 114 | return 0; | 114 | return 0; |
| 115 | } | 115 | } |
| @@ -119,7 +119,7 @@ static inline void stmmac_clk_disable(struct stmmac_priv *priv) | |||
| 119 | if (IS_ERR(priv->stmmac_clk)) | 119 | if (IS_ERR(priv->stmmac_clk)) |
| 120 | return; | 120 | return; |
| 121 | 121 | ||
| 122 | clk_disable(priv->stmmac_clk); | 122 | clk_disable_unprepare(priv->stmmac_clk); |
| 123 | } | 123 | } |
| 124 | static inline int stmmac_clk_get(struct stmmac_priv *priv) | 124 | static inline int stmmac_clk_get(struct stmmac_priv *priv) |
| 125 | { | 125 | { |
| @@ -143,3 +143,60 @@ static inline int stmmac_clk_get(struct stmmac_priv *priv) | |||
| 143 | return 0; | 143 | return 0; |
| 144 | } | 144 | } |
| 145 | #endif /* CONFIG_HAVE_CLK */ | 145 | #endif /* CONFIG_HAVE_CLK */ |
| 146 | |||
| 147 | |||
| 148 | #ifdef CONFIG_STMMAC_PLATFORM | ||
| 149 | extern struct platform_driver stmmac_pltfr_driver; | ||
| 150 | static inline int stmmac_register_platform(void) | ||
| 151 | { | ||
| 152 | int err; | ||
| 153 | |||
| 154 | err = platform_driver_register(&stmmac_pltfr_driver); | ||
| 155 | if (err) | ||
| 156 | pr_err("stmmac: failed to register the platform driver\n"); | ||
| 157 | |||
| 158 | return err; | ||
| 159 | } | ||
| 160 | static inline void stmmac_unregister_platform(void) | ||
| 161 | { | ||
| 162 | platform_driver_register(&stmmac_pltfr_driver); | ||
| 163 | } | ||
| 164 | #else | ||
| 165 | static inline int stmmac_register_platform(void) | ||
| 166 | { | ||
| 167 | pr_debug("stmmac: do not register the platf driver\n"); | ||
| 168 | |||
| 169 | return -EINVAL; | ||
| 170 | } | ||
| 171 | static inline void stmmac_unregister_platform(void) | ||
| 172 | { | ||
| 173 | } | ||
| 174 | #endif /* CONFIG_STMMAC_PLATFORM */ | ||
| 175 | |||
| 176 | #ifdef CONFIG_STMMAC_PCI | ||
| 177 | extern struct pci_driver stmmac_pci_driver; | ||
| 178 | static inline int stmmac_register_pci(void) | ||
| 179 | { | ||
| 180 | int err; | ||
| 181 | |||
| 182 | err = pci_register_driver(&stmmac_pci_driver); | ||
| 183 | if (err) | ||
| 184 | pr_err("stmmac: failed to register the PCI driver\n"); | ||
| 185 | |||
| 186 | return err; | ||
| 187 | } | ||
| 188 | static inline void stmmac_unregister_pci(void) | ||
| 189 | { | ||
| 190 | pci_unregister_driver(&stmmac_pci_driver); | ||
| 191 | } | ||
| 192 | #else | ||
| 193 | static inline int stmmac_register_pci(void) | ||
| 194 | { | ||
| 195 | pr_debug("stmmac: do not register the PCI driver\n"); | ||
| 196 | |||
| 197 | return -EINVAL; | ||
| 198 | } | ||
| 199 | static inline void stmmac_unregister_pci(void) | ||
| 200 | { | ||
| 201 | } | ||
| 202 | #endif /* CONFIG_STMMAC_PCI */ | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 70966330f44e..ea3003edde18 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -833,8 +833,9 @@ static u32 stmmac_get_synopsys_id(struct stmmac_priv *priv) | |||
| 833 | 833 | ||
| 834 | /** | 834 | /** |
| 835 | * stmmac_selec_desc_mode | 835 | * stmmac_selec_desc_mode |
| 836 | * @dev : device pointer | 836 | * @priv : private structure |
| 837 | * Description: select the Enhanced/Alternate or Normal descriptors */ | 837 | * Description: select the Enhanced/Alternate or Normal descriptors |
| 838 | */ | ||
| 838 | static void stmmac_selec_desc_mode(struct stmmac_priv *priv) | 839 | static void stmmac_selec_desc_mode(struct stmmac_priv *priv) |
| 839 | { | 840 | { |
| 840 | if (priv->plat->enh_desc) { | 841 | if (priv->plat->enh_desc) { |
| @@ -1211,6 +1212,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1211 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion); | 1212 | priv->hw->desc->prepare_tx_desc(desc, 0, len, csum_insertion); |
| 1212 | wmb(); | 1213 | wmb(); |
| 1213 | priv->hw->desc->set_tx_owner(desc); | 1214 | priv->hw->desc->set_tx_owner(desc); |
| 1215 | wmb(); | ||
| 1214 | } | 1216 | } |
| 1215 | 1217 | ||
| 1216 | /* Interrupt on completition only for the latest segment */ | 1218 | /* Interrupt on completition only for the latest segment */ |
| @@ -1226,6 +1228,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1226 | 1228 | ||
| 1227 | /* To avoid raise condition */ | 1229 | /* To avoid raise condition */ |
| 1228 | priv->hw->desc->set_tx_owner(first); | 1230 | priv->hw->desc->set_tx_owner(first); |
| 1231 | wmb(); | ||
| 1229 | 1232 | ||
| 1230 | priv->cur_tx++; | 1233 | priv->cur_tx++; |
| 1231 | 1234 | ||
| @@ -1289,6 +1292,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv) | |||
| 1289 | } | 1292 | } |
| 1290 | wmb(); | 1293 | wmb(); |
| 1291 | priv->hw->desc->set_rx_owner(p + entry); | 1294 | priv->hw->desc->set_rx_owner(p + entry); |
| 1295 | wmb(); | ||
| 1292 | } | 1296 | } |
| 1293 | } | 1297 | } |
| 1294 | 1298 | ||
| @@ -1861,6 +1865,8 @@ static int stmmac_hw_init(struct stmmac_priv *priv) | |||
| 1861 | /** | 1865 | /** |
| 1862 | * stmmac_dvr_probe | 1866 | * stmmac_dvr_probe |
| 1863 | * @device: device pointer | 1867 | * @device: device pointer |
| 1868 | * @plat_dat: platform data pointer | ||
| 1869 | * @addr: iobase memory address | ||
| 1864 | * Description: this is the main probe function used to | 1870 | * Description: this is the main probe function used to |
| 1865 | * call the alloc_etherdev, allocate the priv structure. | 1871 | * call the alloc_etherdev, allocate the priv structure. |
| 1866 | */ | 1872 | */ |
| @@ -2090,6 +2096,34 @@ int stmmac_restore(struct net_device *ndev) | |||
| 2090 | } | 2096 | } |
| 2091 | #endif /* CONFIG_PM */ | 2097 | #endif /* CONFIG_PM */ |
| 2092 | 2098 | ||
| 2099 | /* Driver can be configured w/ and w/ both PCI and Platf drivers | ||
| 2100 | * depending on the configuration selected. | ||
| 2101 | */ | ||
| 2102 | static int __init stmmac_init(void) | ||
| 2103 | { | ||
| 2104 | int err_plt = 0; | ||
| 2105 | int err_pci = 0; | ||
| 2106 | |||
| 2107 | err_plt = stmmac_register_platform(); | ||
| 2108 | err_pci = stmmac_register_pci(); | ||
| 2109 | |||
| 2110 | if ((err_pci) && (err_plt)) { | ||
| 2111 | pr_err("stmmac: driver registration failed\n"); | ||
| 2112 | return -EINVAL; | ||
| 2113 | } | ||
| 2114 | |||
| 2115 | return 0; | ||
| 2116 | } | ||
| 2117 | |||
| 2118 | static void __exit stmmac_exit(void) | ||
| 2119 | { | ||
| 2120 | stmmac_unregister_platform(); | ||
| 2121 | stmmac_unregister_pci(); | ||
| 2122 | } | ||
| 2123 | |||
| 2124 | module_init(stmmac_init); | ||
| 2125 | module_exit(stmmac_exit); | ||
| 2126 | |||
| 2093 | #ifndef MODULE | 2127 | #ifndef MODULE |
| 2094 | static int __init stmmac_cmdline_opt(char *str) | 2128 | static int __init stmmac_cmdline_opt(char *str) |
| 2095 | { | 2129 | { |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 58fab5303e9c..cf826e6b6aa1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | |||
| @@ -179,7 +179,7 @@ static DEFINE_PCI_DEVICE_TABLE(stmmac_id_table) = { | |||
| 179 | 179 | ||
| 180 | MODULE_DEVICE_TABLE(pci, stmmac_id_table); | 180 | MODULE_DEVICE_TABLE(pci, stmmac_id_table); |
| 181 | 181 | ||
| 182 | static struct pci_driver stmmac_driver = { | 182 | struct pci_driver stmmac_pci_driver = { |
| 183 | .name = STMMAC_RESOURCE_NAME, | 183 | .name = STMMAC_RESOURCE_NAME, |
| 184 | .id_table = stmmac_id_table, | 184 | .id_table = stmmac_id_table, |
| 185 | .probe = stmmac_pci_probe, | 185 | .probe = stmmac_pci_probe, |
| @@ -190,33 +190,6 @@ static struct pci_driver stmmac_driver = { | |||
| 190 | #endif | 190 | #endif |
| 191 | }; | 191 | }; |
| 192 | 192 | ||
| 193 | /** | ||
| 194 | * stmmac_init_module - Entry point for the driver | ||
| 195 | * Description: This function is the entry point for the driver. | ||
| 196 | */ | ||
| 197 | static int __init stmmac_init_module(void) | ||
| 198 | { | ||
| 199 | int ret; | ||
| 200 | |||
| 201 | ret = pci_register_driver(&stmmac_driver); | ||
| 202 | if (ret < 0) | ||
| 203 | pr_err("%s: ERROR: driver registration failed\n", __func__); | ||
| 204 | |||
| 205 | return ret; | ||
| 206 | } | ||
| 207 | |||
| 208 | /** | ||
| 209 | * stmmac_cleanup_module - Cleanup routine for the driver | ||
| 210 | * Description: This function is the cleanup routine for the driver. | ||
| 211 | */ | ||
| 212 | static void __exit stmmac_cleanup_module(void) | ||
| 213 | { | ||
| 214 | pci_unregister_driver(&stmmac_driver); | ||
| 215 | } | ||
| 216 | |||
| 217 | module_init(stmmac_init_module); | ||
| 218 | module_exit(stmmac_cleanup_module); | ||
| 219 | |||
| 220 | MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver"); | 193 | MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver"); |
| 221 | MODULE_AUTHOR("Rayagond Kokatanur <rayagond.kokatanur@vayavyalabs.com>"); | 194 | MODULE_AUTHOR("Rayagond Kokatanur <rayagond.kokatanur@vayavyalabs.com>"); |
| 222 | MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); | 195 | MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 3dd8f0803808..680d2b8dfe27 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | |||
| @@ -255,7 +255,7 @@ static const struct of_device_id stmmac_dt_ids[] = { | |||
| 255 | }; | 255 | }; |
| 256 | MODULE_DEVICE_TABLE(of, stmmac_dt_ids); | 256 | MODULE_DEVICE_TABLE(of, stmmac_dt_ids); |
| 257 | 257 | ||
| 258 | static struct platform_driver stmmac_driver = { | 258 | struct platform_driver stmmac_pltfr_driver = { |
| 259 | .probe = stmmac_pltfr_probe, | 259 | .probe = stmmac_pltfr_probe, |
| 260 | .remove = stmmac_pltfr_remove, | 260 | .remove = stmmac_pltfr_remove, |
| 261 | .driver = { | 261 | .driver = { |
| @@ -266,8 +266,6 @@ static struct platform_driver stmmac_driver = { | |||
| 266 | }, | 266 | }, |
| 267 | }; | 267 | }; |
| 268 | 268 | ||
| 269 | module_platform_driver(stmmac_driver); | ||
| 270 | |||
| 271 | MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PLATFORM driver"); | 269 | MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PLATFORM driver"); |
| 272 | MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); | 270 | MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); |
| 273 | MODULE_LICENSE("GPL"); | 271 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 703c8cce2a2c..8c726b7004d3 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
| @@ -3598,7 +3598,6 @@ static int release_tx_packet(struct niu *np, struct tx_ring_info *rp, int idx) | |||
| 3598 | static void niu_tx_work(struct niu *np, struct tx_ring_info *rp) | 3598 | static void niu_tx_work(struct niu *np, struct tx_ring_info *rp) |
| 3599 | { | 3599 | { |
| 3600 | struct netdev_queue *txq; | 3600 | struct netdev_queue *txq; |
| 3601 | unsigned int tx_bytes; | ||
| 3602 | u16 pkt_cnt, tmp; | 3601 | u16 pkt_cnt, tmp; |
| 3603 | int cons, index; | 3602 | int cons, index; |
| 3604 | u64 cs; | 3603 | u64 cs; |
| @@ -3621,18 +3620,12 @@ static void niu_tx_work(struct niu *np, struct tx_ring_info *rp) | |||
| 3621 | netif_printk(np, tx_done, KERN_DEBUG, np->dev, | 3620 | netif_printk(np, tx_done, KERN_DEBUG, np->dev, |
| 3622 | "%s() pkt_cnt[%u] cons[%d]\n", __func__, pkt_cnt, cons); | 3621 | "%s() pkt_cnt[%u] cons[%d]\n", __func__, pkt_cnt, cons); |
| 3623 | 3622 | ||
| 3624 | tx_bytes = 0; | 3623 | while (pkt_cnt--) |
| 3625 | tmp = pkt_cnt; | ||
| 3626 | while (tmp--) { | ||
| 3627 | tx_bytes += rp->tx_buffs[cons].skb->len; | ||
| 3628 | cons = release_tx_packet(np, rp, cons); | 3624 | cons = release_tx_packet(np, rp, cons); |
| 3629 | } | ||
| 3630 | 3625 | ||
| 3631 | rp->cons = cons; | 3626 | rp->cons = cons; |
| 3632 | smp_mb(); | 3627 | smp_mb(); |
| 3633 | 3628 | ||
| 3634 | netdev_tx_completed_queue(txq, pkt_cnt, tx_bytes); | ||
| 3635 | |||
| 3636 | out: | 3629 | out: |
| 3637 | if (unlikely(netif_tx_queue_stopped(txq) && | 3630 | if (unlikely(netif_tx_queue_stopped(txq) && |
| 3638 | (niu_tx_avail(rp) > NIU_TX_WAKEUP_THRESH(rp)))) { | 3631 | (niu_tx_avail(rp) > NIU_TX_WAKEUP_THRESH(rp)))) { |
| @@ -4333,7 +4326,6 @@ static void niu_free_channels(struct niu *np) | |||
| 4333 | struct tx_ring_info *rp = &np->tx_rings[i]; | 4326 | struct tx_ring_info *rp = &np->tx_rings[i]; |
| 4334 | 4327 | ||
| 4335 | niu_free_tx_ring_info(np, rp); | 4328 | niu_free_tx_ring_info(np, rp); |
| 4336 | netdev_tx_reset_queue(netdev_get_tx_queue(np->dev, i)); | ||
| 4337 | } | 4329 | } |
| 4338 | kfree(np->tx_rings); | 4330 | kfree(np->tx_rings); |
| 4339 | np->tx_rings = NULL; | 4331 | np->tx_rings = NULL; |
| @@ -6739,8 +6731,6 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb, | |||
| 6739 | prod = NEXT_TX(rp, prod); | 6731 | prod = NEXT_TX(rp, prod); |
| 6740 | } | 6732 | } |
| 6741 | 6733 | ||
| 6742 | netdev_tx_sent_queue(txq, skb->len); | ||
| 6743 | |||
| 6744 | if (prod < rp->prod) | 6734 | if (prod < rp->prod) |
| 6745 | rp->wrap_bit ^= TX_RING_KICK_WRAP; | 6735 | rp->wrap_bit ^= TX_RING_KICK_WRAP; |
| 6746 | rp->prod = prod; | 6736 | rp->prod = prod; |
diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c index d614c374ed9d..3b5c4571b55e 100644 --- a/drivers/net/ethernet/ti/davinci_cpdma.c +++ b/drivers/net/ethernet/ti/davinci_cpdma.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 16 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
| 17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
| 18 | #include <linux/module.h> | ||
| 18 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
| 19 | #include <linux/err.h> | 20 | #include <linux/err.h> |
| 20 | #include <linux/dma-mapping.h> | 21 | #include <linux/dma-mapping.h> |
diff --git a/drivers/net/ethernet/tile/Kconfig b/drivers/net/ethernet/tile/Kconfig index 2d9218f86bca..098b1c42b393 100644 --- a/drivers/net/ethernet/tile/Kconfig +++ b/drivers/net/ethernet/tile/Kconfig | |||
| @@ -7,6 +7,8 @@ config TILE_NET | |||
| 7 | depends on TILE | 7 | depends on TILE |
| 8 | default y | 8 | default y |
| 9 | select CRC32 | 9 | select CRC32 |
| 10 | select TILE_GXIO_MPIPE if TILEGX | ||
| 11 | select HIGH_RES_TIMERS if TILEGX | ||
| 10 | ---help--- | 12 | ---help--- |
| 11 | This is a standard Linux network device driver for the | 13 | This is a standard Linux network device driver for the |
| 12 | on-chip Tilera Gigabit Ethernet and XAUI interfaces. | 14 | on-chip Tilera Gigabit Ethernet and XAUI interfaces. |
diff --git a/drivers/net/ethernet/tile/Makefile b/drivers/net/ethernet/tile/Makefile index f634f142cab4..0ef9eefd3211 100644 --- a/drivers/net/ethernet/tile/Makefile +++ b/drivers/net/ethernet/tile/Makefile | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | obj-$(CONFIG_TILE_NET) += tile_net.o | 5 | obj-$(CONFIG_TILE_NET) += tile_net.o |
| 6 | ifdef CONFIG_TILEGX | 6 | ifdef CONFIG_TILEGX |
| 7 | tile_net-objs := tilegx.o mpipe.o iorpc_mpipe.o dma_queue.o | 7 | tile_net-y := tilegx.o |
| 8 | else | 8 | else |
| 9 | tile_net-objs := tilepro.o | 9 | tile_net-y := tilepro.o |
| 10 | endif | 10 | endif |
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c new file mode 100644 index 000000000000..83b4b388ad49 --- /dev/null +++ b/drivers/net/ethernet/tile/tilegx.c | |||
| @@ -0,0 +1,1898 @@ | |||
| 1 | /* | ||
| 2 | * Copyright 2012 Tilera Corporation. All Rights Reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU General Public License | ||
| 6 | * as published by the Free Software Foundation, version 2. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, but | ||
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
| 11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
| 12 | * more details. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/module.h> | ||
| 16 | #include <linux/init.h> | ||
| 17 | #include <linux/moduleparam.h> | ||
| 18 | #include <linux/sched.h> | ||
| 19 | #include <linux/kernel.h> /* printk() */ | ||
| 20 | #include <linux/slab.h> /* kmalloc() */ | ||
| 21 | #include <linux/errno.h> /* error codes */ | ||
| 22 | #include <linux/types.h> /* size_t */ | ||
| 23 | #include <linux/interrupt.h> | ||
| 24 | #include <linux/in.h> | ||
| 25 | #include <linux/irq.h> | ||
| 26 | #include <linux/netdevice.h> /* struct device, and other headers */ | ||
| 27 | #include <linux/etherdevice.h> /* eth_type_trans */ | ||
| 28 | #include <linux/skbuff.h> | ||
| 29 | #include <linux/ioctl.h> | ||
| 30 | #include <linux/cdev.h> | ||
| 31 | #include <linux/hugetlb.h> | ||
| 32 | #include <linux/in6.h> | ||
| 33 | #include <linux/timer.h> | ||
| 34 | #include <linux/hrtimer.h> | ||
| 35 | #include <linux/ktime.h> | ||
| 36 | #include <linux/io.h> | ||
| 37 | #include <linux/ctype.h> | ||
| 38 | #include <linux/ip.h> | ||
| 39 | #include <linux/tcp.h> | ||
| 40 | |||
| 41 | #include <asm/checksum.h> | ||
| 42 | #include <asm/homecache.h> | ||
| 43 | #include <gxio/mpipe.h> | ||
| 44 | #include <arch/sim.h> | ||
| 45 | |||
| 46 | /* Default transmit lockup timeout period, in jiffies. */ | ||
| 47 | #define TILE_NET_TIMEOUT (5 * HZ) | ||
| 48 | |||
| 49 | /* The maximum number of distinct channels (idesc.channel is 5 bits). */ | ||
| 50 | #define TILE_NET_CHANNELS 32 | ||
| 51 | |||
| 52 | /* Maximum number of idescs to handle per "poll". */ | ||
| 53 | #define TILE_NET_BATCH 128 | ||
| 54 | |||
| 55 | /* Maximum number of packets to handle per "poll". */ | ||
| 56 | #define TILE_NET_WEIGHT 64 | ||
| 57 | |||
| 58 | /* Number of entries in each iqueue. */ | ||
| 59 | #define IQUEUE_ENTRIES 512 | ||
| 60 | |||
| 61 | /* Number of entries in each equeue. */ | ||
| 62 | #define EQUEUE_ENTRIES 2048 | ||
| 63 | |||
| 64 | /* Total header bytes per equeue slot. Must be big enough for 2 bytes | ||
| 65 | * of NET_IP_ALIGN alignment, plus 14 bytes (?) of L2 header, plus up to | ||
| 66 | * 60 bytes of actual TCP header. We round up to align to cache lines. | ||
| 67 | */ | ||
| 68 | #define HEADER_BYTES 128 | ||
| 69 | |||
| 70 | /* Maximum completions per cpu per device (must be a power of two). | ||
| 71 | * ISSUE: What is the right number here? If this is too small, then | ||
| 72 | * egress might block waiting for free space in a completions array. | ||
| 73 | * ISSUE: At the least, allocate these only for initialized echannels. | ||
| 74 | */ | ||
| 75 | #define TILE_NET_MAX_COMPS 64 | ||
| 76 | |||
| 77 | #define MAX_FRAGS (MAX_SKB_FRAGS + 1) | ||
| 78 | |||
| 79 | /* Size of completions data to allocate. | ||
| 80 | * ISSUE: Probably more than needed since we don't use all the channels. | ||
| 81 | */ | ||
| 82 | #define COMPS_SIZE (TILE_NET_CHANNELS * sizeof(struct tile_net_comps)) | ||
| 83 | |||
| 84 | /* Size of NotifRing data to allocate. */ | ||
| 85 | #define NOTIF_RING_SIZE (IQUEUE_ENTRIES * sizeof(gxio_mpipe_idesc_t)) | ||
| 86 | |||
| 87 | /* Timeout to wake the per-device TX timer after we stop the queue. | ||
| 88 | * We don't want the timeout too short (adds overhead, and might end | ||
| 89 | * up causing stop/wake/stop/wake cycles) or too long (affects performance). | ||
| 90 | * For the 10 Gb NIC, 30 usec means roughly 30+ 1500-byte packets. | ||
| 91 | */ | ||
| 92 | #define TX_TIMER_DELAY_USEC 30 | ||
| 93 | |||
| 94 | /* Timeout to wake the per-cpu egress timer to free completions. */ | ||
| 95 | #define EGRESS_TIMER_DELAY_USEC 1000 | ||
| 96 | |||
| 97 | MODULE_AUTHOR("Tilera Corporation"); | ||
| 98 | MODULE_LICENSE("GPL"); | ||
| 99 | |||
| 100 | /* A "packet fragment" (a chunk of memory). */ | ||
| 101 | struct frag { | ||
| 102 | void *buf; | ||
| 103 | size_t length; | ||
| 104 | }; | ||
| 105 | |||
| 106 | /* A single completion. */ | ||
| 107 | struct tile_net_comp { | ||
| 108 | /* The "complete_count" when the completion will be complete. */ | ||
| 109 | s64 when; | ||
| 110 | /* The buffer to be freed when the completion is complete. */ | ||
| 111 | struct sk_buff *skb; | ||
| 112 | }; | ||
| 113 | |||
| 114 | /* The completions for a given cpu and echannel. */ | ||
| 115 | struct tile_net_comps { | ||
| 116 | /* The completions. */ | ||
| 117 | struct tile_net_comp comp_queue[TILE_NET_MAX_COMPS]; | ||
| 118 | /* The number of completions used. */ | ||
| 119 | unsigned long comp_next; | ||
| 120 | /* The number of completions freed. */ | ||
| 121 | unsigned long comp_last; | ||
| 122 | }; | ||
| 123 | |||
| 124 | /* The transmit wake timer for a given cpu and echannel. */ | ||
| 125 | struct tile_net_tx_wake { | ||
| 126 | struct hrtimer timer; | ||
| 127 | struct net_device *dev; | ||
| 128 | }; | ||
| 129 | |||
| 130 | /* Info for a specific cpu. */ | ||
| 131 | struct tile_net_info { | ||
| 132 | /* The NAPI struct. */ | ||
| 133 | struct napi_struct napi; | ||
| 134 | /* Packet queue. */ | ||
| 135 | gxio_mpipe_iqueue_t iqueue; | ||
| 136 | /* Our cpu. */ | ||
| 137 | int my_cpu; | ||
| 138 | /* True if iqueue is valid. */ | ||
| 139 | bool has_iqueue; | ||
| 140 | /* NAPI flags. */ | ||
| 141 | bool napi_added; | ||
| 142 | bool napi_enabled; | ||
| 143 | /* Number of small sk_buffs which must still be provided. */ | ||
| 144 | unsigned int num_needed_small_buffers; | ||
| 145 | /* Number of large sk_buffs which must still be provided. */ | ||
| 146 | unsigned int num_needed_large_buffers; | ||
| 147 | /* A timer for handling egress completions. */ | ||
| 148 | struct hrtimer egress_timer; | ||
| 149 | /* True if "egress_timer" is scheduled. */ | ||
| 150 | bool egress_timer_scheduled; | ||
| 151 | /* Comps for each egress channel. */ | ||
| 152 | struct tile_net_comps *comps_for_echannel[TILE_NET_CHANNELS]; | ||
| 153 | /* Transmit wake timer for each egress channel. */ | ||
| 154 | struct tile_net_tx_wake tx_wake[TILE_NET_CHANNELS]; | ||
| 155 | }; | ||
| 156 | |||
| 157 | /* Info for egress on a particular egress channel. */ | ||
| 158 | struct tile_net_egress { | ||
| 159 | /* The "equeue". */ | ||
| 160 | gxio_mpipe_equeue_t *equeue; | ||
| 161 | /* The headers for TSO. */ | ||
| 162 | unsigned char *headers; | ||
| 163 | }; | ||
| 164 | |||
| 165 | /* Info for a specific device. */ | ||
| 166 | struct tile_net_priv { | ||
| 167 | /* Our network device. */ | ||
| 168 | struct net_device *dev; | ||
| 169 | /* The primary link. */ | ||
| 170 | gxio_mpipe_link_t link; | ||
| 171 | /* The primary channel, if open, else -1. */ | ||
| 172 | int channel; | ||
| 173 | /* The "loopify" egress link, if needed. */ | ||
| 174 | gxio_mpipe_link_t loopify_link; | ||
| 175 | /* The "loopify" egress channel, if open, else -1. */ | ||
| 176 | int loopify_channel; | ||
| 177 | /* The egress channel (channel or loopify_channel). */ | ||
| 178 | int echannel; | ||
| 179 | /* Total stats. */ | ||
| 180 | struct net_device_stats stats; | ||
| 181 | }; | ||
| 182 | |||
| 183 | /* Egress info, indexed by "priv->echannel" (lazily created as needed). */ | ||
| 184 | static struct tile_net_egress egress_for_echannel[TILE_NET_CHANNELS]; | ||
| 185 | |||
| 186 | /* Devices currently associated with each channel. | ||
| 187 | * NOTE: The array entry can become NULL after ifconfig down, but | ||
| 188 | * we do not free the underlying net_device structures, so it is | ||
| 189 | * safe to use a pointer after reading it from this array. | ||
| 190 | */ | ||
| 191 | static struct net_device *tile_net_devs_for_channel[TILE_NET_CHANNELS]; | ||
| 192 | |||
| 193 | /* A mutex for "tile_net_devs_for_channel". */ | ||
| 194 | static DEFINE_MUTEX(tile_net_devs_for_channel_mutex); | ||
| 195 | |||
| 196 | /* The per-cpu info. */ | ||
| 197 | static DEFINE_PER_CPU(struct tile_net_info, per_cpu_info); | ||
| 198 | |||
| 199 | /* The "context" for all devices. */ | ||
| 200 | static gxio_mpipe_context_t context; | ||
| 201 | |||
| 202 | /* Buffer sizes and mpipe enum codes for buffer stacks. | ||
| 203 | * See arch/tile/include/gxio/mpipe.h for the set of possible values. | ||
| 204 | */ | ||
| 205 | #define BUFFER_SIZE_SMALL_ENUM GXIO_MPIPE_BUFFER_SIZE_128 | ||
| 206 | #define BUFFER_SIZE_SMALL 128 | ||
| 207 | #define BUFFER_SIZE_LARGE_ENUM GXIO_MPIPE_BUFFER_SIZE_1664 | ||
| 208 | #define BUFFER_SIZE_LARGE 1664 | ||
| 209 | |||
| 210 | /* The small/large "buffer stacks". */ | ||
| 211 | static int small_buffer_stack = -1; | ||
| 212 | static int large_buffer_stack = -1; | ||
| 213 | |||
| 214 | /* Amount of memory allocated for each buffer stack. */ | ||
| 215 | static size_t buffer_stack_size; | ||
| 216 | |||
| 217 | /* The actual memory allocated for the buffer stacks. */ | ||
| 218 | static void *small_buffer_stack_va; | ||
| 219 | static void *large_buffer_stack_va; | ||
| 220 | |||
| 221 | /* The buckets. */ | ||
| 222 | static int first_bucket = -1; | ||
| 223 | static int num_buckets = 1; | ||
| 224 | |||
| 225 | /* The ingress irq. */ | ||
| 226 | static int ingress_irq = -1; | ||
| 227 | |||
| 228 | /* Text value of tile_net.cpus if passed as a module parameter. */ | ||
| 229 | static char *network_cpus_string; | ||
| 230 | |||
| 231 | /* The actual cpus in "network_cpus". */ | ||
| 232 | static struct cpumask network_cpus_map; | ||
| 233 | |||
| 234 | /* If "loopify=LINK" was specified, this is "LINK". */ | ||
| 235 | static char *loopify_link_name; | ||
| 236 | |||
| 237 | /* If "tile_net.custom" was specified, this is non-NULL. */ | ||
| 238 | static char *custom_str; | ||
| 239 | |||
| 240 | /* The "tile_net.cpus" argument specifies the cpus that are dedicated | ||
| 241 | * to handle ingress packets. | ||
| 242 | * | ||
| 243 | * The parameter should be in the form "tile_net.cpus=m-n[,x-y]", where | ||
| 244 | * m, n, x, y are integer numbers that represent the cpus that can be | ||
| 245 | * neither a dedicated cpu nor a dataplane cpu. | ||
| 246 | */ | ||
| 247 | static bool network_cpus_init(void) | ||
| 248 | { | ||
| 249 | char buf[1024]; | ||
| 250 | int rc; | ||
| 251 | |||
| 252 | if (network_cpus_string == NULL) | ||
| 253 | return false; | ||
| 254 | |||
| 255 | rc = cpulist_parse_crop(network_cpus_string, &network_cpus_map); | ||
| 256 | if (rc != 0) { | ||
| 257 | pr_warn("tile_net.cpus=%s: malformed cpu list\n", | ||
| 258 | network_cpus_string); | ||
| 259 | return false; | ||
| 260 | } | ||
| 261 | |||
| 262 | /* Remove dedicated cpus. */ | ||
| 263 | cpumask_and(&network_cpus_map, &network_cpus_map, cpu_possible_mask); | ||
| 264 | |||
| 265 | if (cpumask_empty(&network_cpus_map)) { | ||
| 266 | pr_warn("Ignoring empty tile_net.cpus='%s'.\n", | ||
| 267 | network_cpus_string); | ||
| 268 | return false; | ||
| 269 | } | ||
| 270 | |||
| 271 | cpulist_scnprintf(buf, sizeof(buf), &network_cpus_map); | ||
| 272 | pr_info("Linux network CPUs: %s\n", buf); | ||
| 273 | return true; | ||
| 274 | } | ||
| 275 | |||
| 276 | module_param_named(cpus, network_cpus_string, charp, 0444); | ||
| 277 | MODULE_PARM_DESC(cpus, "cpulist of cores that handle network interrupts"); | ||
| 278 | |||
| 279 | /* The "tile_net.loopify=LINK" argument causes the named device to | ||
| 280 | * actually use "loop0" for ingress, and "loop1" for egress. This | ||
| 281 | * allows an app to sit between the actual link and linux, passing | ||
| 282 | * (some) packets along to linux, and forwarding (some) packets sent | ||
| 283 | * out by linux. | ||
| 284 | */ | ||
| 285 | module_param_named(loopify, loopify_link_name, charp, 0444); | ||
| 286 | MODULE_PARM_DESC(loopify, "name the device to use loop0/1 for ingress/egress"); | ||
| 287 | |||
| 288 | /* The "tile_net.custom" argument causes us to ignore the "conventional" | ||
| 289 | * classifier metadata, in particular, the "l2_offset". | ||
| 290 | */ | ||
| 291 | module_param_named(custom, custom_str, charp, 0444); | ||
| 292 | MODULE_PARM_DESC(custom, "indicates a (heavily) customized classifier"); | ||
| 293 | |||
| 294 | /* Atomically update a statistics field. | ||
| 295 | * Note that on TILE-Gx, this operation is fire-and-forget on the | ||
| 296 | * issuing core (single-cycle dispatch) and takes only a few cycles | ||
| 297 | * longer than a regular store when the request reaches the home cache. | ||
| 298 | * No expensive bus management overhead is required. | ||
| 299 | */ | ||
| 300 | static void tile_net_stats_add(unsigned long value, unsigned long *field) | ||
| 301 | { | ||
| 302 | BUILD_BUG_ON(sizeof(atomic_long_t) != sizeof(unsigned long)); | ||
| 303 | atomic_long_add(value, (atomic_long_t *)field); | ||
| 304 | } | ||
| 305 | |||
| 306 | /* Allocate and push a buffer. */ | ||
| 307 | static bool tile_net_provide_buffer(bool small) | ||
| 308 | { | ||
| 309 | int stack = small ? small_buffer_stack : large_buffer_stack; | ||
| 310 | const unsigned long buffer_alignment = 128; | ||
| 311 | struct sk_buff *skb; | ||
| 312 | int len; | ||
| 313 | |||
| 314 | len = sizeof(struct sk_buff **) + buffer_alignment; | ||
| 315 | len += (small ? BUFFER_SIZE_SMALL : BUFFER_SIZE_LARGE); | ||
| 316 | skb = dev_alloc_skb(len); | ||
| 317 | if (skb == NULL) | ||
| 318 | return false; | ||
| 319 | |||
| 320 | /* Make room for a back-pointer to 'skb' and guarantee alignment. */ | ||
| 321 | skb_reserve(skb, sizeof(struct sk_buff **)); | ||
| 322 | skb_reserve(skb, -(long)skb->data & (buffer_alignment - 1)); | ||
| 323 | |||
| 324 | /* Save a back-pointer to 'skb'. */ | ||
| 325 | *(struct sk_buff **)(skb->data - sizeof(struct sk_buff **)) = skb; | ||
| 326 | |||
| 327 | /* Make sure "skb" and the back-pointer have been flushed. */ | ||
| 328 | wmb(); | ||
| 329 | |||
| 330 | gxio_mpipe_push_buffer(&context, stack, | ||
| 331 | (void *)va_to_tile_io_addr(skb->data)); | ||
| 332 | |||
| 333 | return true; | ||
| 334 | } | ||
| 335 | |||
| 336 | /* Convert a raw mpipe buffer to its matching skb pointer. */ | ||
| 337 | static struct sk_buff *mpipe_buf_to_skb(void *va) | ||
| 338 | { | ||
| 339 | /* Acquire the associated "skb". */ | ||
| 340 | struct sk_buff **skb_ptr = va - sizeof(*skb_ptr); | ||
| 341 | struct sk_buff *skb = *skb_ptr; | ||
| 342 | |||
| 343 | /* Paranoia. */ | ||
| 344 | if (skb->data != va) { | ||
| 345 | /* Panic here since there's a reasonable chance | ||
| 346 | * that corrupt buffers means generic memory | ||
| 347 | * corruption, with unpredictable system effects. | ||
| 348 | */ | ||
| 349 | panic("Corrupt linux buffer! va=%p, skb=%p, skb->data=%p", | ||
| 350 | va, skb, skb->data); | ||
| 351 | } | ||
| 352 | |||
| 353 | return skb; | ||
| 354 | } | ||
| 355 | |||
| 356 | static void tile_net_pop_all_buffers(int stack) | ||
| 357 | { | ||
| 358 | for (;;) { | ||
| 359 | tile_io_addr_t addr = | ||
| 360 | (tile_io_addr_t)gxio_mpipe_pop_buffer(&context, stack); | ||
| 361 | if (addr == 0) | ||
| 362 | break; | ||
| 363 | dev_kfree_skb_irq(mpipe_buf_to_skb(tile_io_addr_to_va(addr))); | ||
| 364 | } | ||
| 365 | } | ||
| 366 | |||
| 367 | /* Provide linux buffers to mPIPE. */ | ||
| 368 | static void tile_net_provide_needed_buffers(void) | ||
| 369 | { | ||
| 370 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 371 | |||
| 372 | while (info->num_needed_small_buffers != 0) { | ||
| 373 | if (!tile_net_provide_buffer(true)) | ||
| 374 | goto oops; | ||
| 375 | info->num_needed_small_buffers--; | ||
| 376 | } | ||
| 377 | |||
| 378 | while (info->num_needed_large_buffers != 0) { | ||
| 379 | if (!tile_net_provide_buffer(false)) | ||
| 380 | goto oops; | ||
| 381 | info->num_needed_large_buffers--; | ||
| 382 | } | ||
| 383 | |||
| 384 | return; | ||
| 385 | |||
| 386 | oops: | ||
| 387 | /* Add a description to the page allocation failure dump. */ | ||
| 388 | pr_notice("Tile %d still needs some buffers\n", info->my_cpu); | ||
| 389 | } | ||
| 390 | |||
| 391 | static inline bool filter_packet(struct net_device *dev, void *buf) | ||
| 392 | { | ||
| 393 | /* Filter packets received before we're up. */ | ||
| 394 | if (dev == NULL || !(dev->flags & IFF_UP)) | ||
| 395 | return true; | ||
| 396 | |||
| 397 | /* Filter out packets that aren't for us. */ | ||
| 398 | if (!(dev->flags & IFF_PROMISC) && | ||
| 399 | !is_multicast_ether_addr(buf) && | ||
| 400 | compare_ether_addr(dev->dev_addr, buf) != 0) | ||
| 401 | return true; | ||
| 402 | |||
| 403 | return false; | ||
| 404 | } | ||
| 405 | |||
| 406 | static void tile_net_receive_skb(struct net_device *dev, struct sk_buff *skb, | ||
| 407 | gxio_mpipe_idesc_t *idesc, unsigned long len) | ||
| 408 | { | ||
| 409 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 410 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 411 | |||
| 412 | /* Encode the actual packet length. */ | ||
| 413 | skb_put(skb, len); | ||
| 414 | |||
| 415 | skb->protocol = eth_type_trans(skb, dev); | ||
| 416 | |||
| 417 | /* Acknowledge "good" hardware checksums. */ | ||
| 418 | if (idesc->cs && idesc->csum_seed_val == 0xFFFF) | ||
| 419 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
| 420 | |||
| 421 | netif_receive_skb(skb); | ||
| 422 | |||
| 423 | /* Update stats. */ | ||
| 424 | tile_net_stats_add(1, &priv->stats.rx_packets); | ||
| 425 | tile_net_stats_add(len, &priv->stats.rx_bytes); | ||
| 426 | |||
| 427 | /* Need a new buffer. */ | ||
| 428 | if (idesc->size == BUFFER_SIZE_SMALL_ENUM) | ||
| 429 | info->num_needed_small_buffers++; | ||
| 430 | else | ||
| 431 | info->num_needed_large_buffers++; | ||
| 432 | } | ||
| 433 | |||
| 434 | /* Handle a packet. Return true if "processed", false if "filtered". */ | ||
| 435 | static bool tile_net_handle_packet(gxio_mpipe_idesc_t *idesc) | ||
| 436 | { | ||
| 437 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 438 | struct net_device *dev = tile_net_devs_for_channel[idesc->channel]; | ||
| 439 | uint8_t l2_offset; | ||
| 440 | void *va; | ||
| 441 | void *buf; | ||
| 442 | unsigned long len; | ||
| 443 | bool filter; | ||
| 444 | |||
| 445 | /* Drop packets for which no buffer was available. | ||
| 446 | * NOTE: This happens under heavy load. | ||
| 447 | */ | ||
| 448 | if (idesc->be) { | ||
| 449 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 450 | tile_net_stats_add(1, &priv->stats.rx_dropped); | ||
| 451 | gxio_mpipe_iqueue_consume(&info->iqueue, idesc); | ||
| 452 | if (net_ratelimit()) | ||
| 453 | pr_info("Dropping packet (insufficient buffers).\n"); | ||
| 454 | return false; | ||
| 455 | } | ||
| 456 | |||
| 457 | /* Get the "l2_offset", if allowed. */ | ||
| 458 | l2_offset = custom_str ? 0 : gxio_mpipe_idesc_get_l2_offset(idesc); | ||
| 459 | |||
| 460 | /* Get the raw buffer VA (includes "headroom"). */ | ||
| 461 | va = tile_io_addr_to_va((unsigned long)(long)idesc->va); | ||
| 462 | |||
| 463 | /* Get the actual packet start/length. */ | ||
| 464 | buf = va + l2_offset; | ||
| 465 | len = idesc->l2_size - l2_offset; | ||
| 466 | |||
| 467 | /* Point "va" at the raw buffer. */ | ||
| 468 | va -= NET_IP_ALIGN; | ||
| 469 | |||
| 470 | filter = filter_packet(dev, buf); | ||
| 471 | if (filter) { | ||
| 472 | gxio_mpipe_iqueue_drop(&info->iqueue, idesc); | ||
| 473 | } else { | ||
| 474 | struct sk_buff *skb = mpipe_buf_to_skb(va); | ||
| 475 | |||
| 476 | /* Skip headroom, and any custom header. */ | ||
| 477 | skb_reserve(skb, NET_IP_ALIGN + l2_offset); | ||
| 478 | |||
| 479 | tile_net_receive_skb(dev, skb, idesc, len); | ||
| 480 | } | ||
| 481 | |||
| 482 | gxio_mpipe_iqueue_consume(&info->iqueue, idesc); | ||
| 483 | return !filter; | ||
| 484 | } | ||
| 485 | |||
| 486 | /* Handle some packets for the current CPU. | ||
| 487 | * | ||
| 488 | * This function handles up to TILE_NET_BATCH idescs per call. | ||
| 489 | * | ||
| 490 | * ISSUE: Since we do not provide new buffers until this function is | ||
| 491 | * complete, we must initially provide enough buffers for each network | ||
| 492 | * cpu to fill its iqueue and also its batched idescs. | ||
| 493 | * | ||
| 494 | * ISSUE: The "rotting packet" race condition occurs if a packet | ||
| 495 | * arrives after the queue appears to be empty, and before the | ||
| 496 | * hypervisor interrupt is re-enabled. | ||
| 497 | */ | ||
| 498 | static int tile_net_poll(struct napi_struct *napi, int budget) | ||
| 499 | { | ||
| 500 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 501 | unsigned int work = 0; | ||
| 502 | gxio_mpipe_idesc_t *idesc; | ||
| 503 | int i, n; | ||
| 504 | |||
| 505 | /* Process packets. */ | ||
| 506 | while ((n = gxio_mpipe_iqueue_try_peek(&info->iqueue, &idesc)) > 0) { | ||
| 507 | for (i = 0; i < n; i++) { | ||
| 508 | if (i == TILE_NET_BATCH) | ||
| 509 | goto done; | ||
| 510 | if (tile_net_handle_packet(idesc + i)) { | ||
| 511 | if (++work >= budget) | ||
| 512 | goto done; | ||
| 513 | } | ||
| 514 | } | ||
| 515 | } | ||
| 516 | |||
| 517 | /* There are no packets left. */ | ||
| 518 | napi_complete(&info->napi); | ||
| 519 | |||
| 520 | /* Re-enable hypervisor interrupts. */ | ||
| 521 | gxio_mpipe_enable_notif_ring_interrupt(&context, info->iqueue.ring); | ||
| 522 | |||
| 523 | /* HACK: Avoid the "rotting packet" problem. */ | ||
| 524 | if (gxio_mpipe_iqueue_try_peek(&info->iqueue, &idesc) > 0) | ||
| 525 | napi_schedule(&info->napi); | ||
| 526 | |||
| 527 | /* ISSUE: Handle completions? */ | ||
| 528 | |||
| 529 | done: | ||
| 530 | tile_net_provide_needed_buffers(); | ||
| 531 | |||
| 532 | return work; | ||
| 533 | } | ||
| 534 | |||
| 535 | /* Handle an ingress interrupt on the current cpu. */ | ||
| 536 | static irqreturn_t tile_net_handle_ingress_irq(int irq, void *unused) | ||
| 537 | { | ||
| 538 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 539 | napi_schedule(&info->napi); | ||
| 540 | return IRQ_HANDLED; | ||
| 541 | } | ||
| 542 | |||
| 543 | /* Free some completions. This must be called with interrupts blocked. */ | ||
| 544 | static int tile_net_free_comps(gxio_mpipe_equeue_t *equeue, | ||
| 545 | struct tile_net_comps *comps, | ||
| 546 | int limit, bool force_update) | ||
| 547 | { | ||
| 548 | int n = 0; | ||
| 549 | while (comps->comp_last < comps->comp_next) { | ||
| 550 | unsigned int cid = comps->comp_last % TILE_NET_MAX_COMPS; | ||
| 551 | struct tile_net_comp *comp = &comps->comp_queue[cid]; | ||
| 552 | if (!gxio_mpipe_equeue_is_complete(equeue, comp->when, | ||
| 553 | force_update || n == 0)) | ||
| 554 | break; | ||
| 555 | dev_kfree_skb_irq(comp->skb); | ||
| 556 | comps->comp_last++; | ||
| 557 | if (++n == limit) | ||
| 558 | break; | ||
| 559 | } | ||
| 560 | return n; | ||
| 561 | } | ||
| 562 | |||
| 563 | /* Add a completion. This must be called with interrupts blocked. | ||
| 564 | * tile_net_equeue_try_reserve() will have ensured a free completion entry. | ||
| 565 | */ | ||
| 566 | static void add_comp(gxio_mpipe_equeue_t *equeue, | ||
| 567 | struct tile_net_comps *comps, | ||
| 568 | uint64_t when, struct sk_buff *skb) | ||
| 569 | { | ||
| 570 | int cid = comps->comp_next % TILE_NET_MAX_COMPS; | ||
| 571 | comps->comp_queue[cid].when = when; | ||
| 572 | comps->comp_queue[cid].skb = skb; | ||
| 573 | comps->comp_next++; | ||
| 574 | } | ||
| 575 | |||
| 576 | static void tile_net_schedule_tx_wake_timer(struct net_device *dev) | ||
| 577 | { | ||
| 578 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 579 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 580 | |||
| 581 | hrtimer_start(&info->tx_wake[priv->echannel].timer, | ||
| 582 | ktime_set(0, TX_TIMER_DELAY_USEC * 1000UL), | ||
| 583 | HRTIMER_MODE_REL_PINNED); | ||
| 584 | } | ||
| 585 | |||
| 586 | static enum hrtimer_restart tile_net_handle_tx_wake_timer(struct hrtimer *t) | ||
| 587 | { | ||
| 588 | struct tile_net_tx_wake *tx_wake = | ||
| 589 | container_of(t, struct tile_net_tx_wake, timer); | ||
| 590 | netif_wake_subqueue(tx_wake->dev, smp_processor_id()); | ||
| 591 | return HRTIMER_NORESTART; | ||
| 592 | } | ||
| 593 | |||
| 594 | /* Make sure the egress timer is scheduled. */ | ||
| 595 | static void tile_net_schedule_egress_timer(void) | ||
| 596 | { | ||
| 597 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 598 | |||
| 599 | if (!info->egress_timer_scheduled) { | ||
| 600 | hrtimer_start(&info->egress_timer, | ||
| 601 | ktime_set(0, EGRESS_TIMER_DELAY_USEC * 1000UL), | ||
| 602 | HRTIMER_MODE_REL_PINNED); | ||
| 603 | info->egress_timer_scheduled = true; | ||
| 604 | } | ||
| 605 | } | ||
| 606 | |||
| 607 | /* The "function" for "info->egress_timer". | ||
| 608 | * | ||
| 609 | * This timer will reschedule itself as long as there are any pending | ||
| 610 | * completions expected for this tile. | ||
| 611 | */ | ||
| 612 | static enum hrtimer_restart tile_net_handle_egress_timer(struct hrtimer *t) | ||
| 613 | { | ||
| 614 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 615 | unsigned long irqflags; | ||
| 616 | bool pending = false; | ||
| 617 | int i; | ||
| 618 | |||
| 619 | local_irq_save(irqflags); | ||
| 620 | |||
| 621 | /* The timer is no longer scheduled. */ | ||
| 622 | info->egress_timer_scheduled = false; | ||
| 623 | |||
| 624 | /* Free all possible comps for this tile. */ | ||
| 625 | for (i = 0; i < TILE_NET_CHANNELS; i++) { | ||
| 626 | struct tile_net_egress *egress = &egress_for_echannel[i]; | ||
| 627 | struct tile_net_comps *comps = info->comps_for_echannel[i]; | ||
| 628 | if (comps->comp_last >= comps->comp_next) | ||
| 629 | continue; | ||
| 630 | tile_net_free_comps(egress->equeue, comps, -1, true); | ||
| 631 | pending = pending || (comps->comp_last < comps->comp_next); | ||
| 632 | } | ||
| 633 | |||
| 634 | /* Reschedule timer if needed. */ | ||
| 635 | if (pending) | ||
| 636 | tile_net_schedule_egress_timer(); | ||
| 637 | |||
| 638 | local_irq_restore(irqflags); | ||
| 639 | |||
| 640 | return HRTIMER_NORESTART; | ||
| 641 | } | ||
| 642 | |||
| 643 | /* Helper function for "tile_net_update()". | ||
| 644 | * "dev" (i.e. arg) is the device being brought up or down, | ||
| 645 | * or NULL if all devices are now down. | ||
| 646 | */ | ||
| 647 | static void tile_net_update_cpu(void *arg) | ||
| 648 | { | ||
| 649 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 650 | struct net_device *dev = arg; | ||
| 651 | |||
| 652 | if (!info->has_iqueue) | ||
| 653 | return; | ||
| 654 | |||
| 655 | if (dev != NULL) { | ||
| 656 | if (!info->napi_added) { | ||
| 657 | netif_napi_add(dev, &info->napi, | ||
| 658 | tile_net_poll, TILE_NET_WEIGHT); | ||
| 659 | info->napi_added = true; | ||
| 660 | } | ||
| 661 | if (!info->napi_enabled) { | ||
| 662 | napi_enable(&info->napi); | ||
| 663 | info->napi_enabled = true; | ||
| 664 | } | ||
| 665 | enable_percpu_irq(ingress_irq, 0); | ||
| 666 | } else { | ||
| 667 | disable_percpu_irq(ingress_irq); | ||
| 668 | if (info->napi_enabled) { | ||
| 669 | napi_disable(&info->napi); | ||
| 670 | info->napi_enabled = false; | ||
| 671 | } | ||
| 672 | /* FIXME: Drain the iqueue. */ | ||
| 673 | } | ||
| 674 | } | ||
| 675 | |||
| 676 | /* Helper function for tile_net_open() and tile_net_stop(). | ||
| 677 | * Always called under tile_net_devs_for_channel_mutex. | ||
| 678 | */ | ||
| 679 | static int tile_net_update(struct net_device *dev) | ||
| 680 | { | ||
| 681 | static gxio_mpipe_rules_t rules; /* too big to fit on the stack */ | ||
| 682 | bool saw_channel = false; | ||
| 683 | int channel; | ||
| 684 | int rc; | ||
| 685 | int cpu; | ||
| 686 | |||
| 687 | gxio_mpipe_rules_init(&rules, &context); | ||
| 688 | |||
| 689 | for (channel = 0; channel < TILE_NET_CHANNELS; channel++) { | ||
| 690 | if (tile_net_devs_for_channel[channel] == NULL) | ||
| 691 | continue; | ||
| 692 | if (!saw_channel) { | ||
| 693 | saw_channel = true; | ||
| 694 | gxio_mpipe_rules_begin(&rules, first_bucket, | ||
| 695 | num_buckets, NULL); | ||
| 696 | gxio_mpipe_rules_set_headroom(&rules, NET_IP_ALIGN); | ||
| 697 | } | ||
| 698 | gxio_mpipe_rules_add_channel(&rules, channel); | ||
| 699 | } | ||
| 700 | |||
| 701 | /* NOTE: This can fail if there is no classifier. | ||
| 702 | * ISSUE: Can anything else cause it to fail? | ||
| 703 | */ | ||
| 704 | rc = gxio_mpipe_rules_commit(&rules); | ||
| 705 | if (rc != 0) { | ||
| 706 | netdev_warn(dev, "gxio_mpipe_rules_commit failed: %d\n", rc); | ||
| 707 | return -EIO; | ||
| 708 | } | ||
| 709 | |||
| 710 | /* Update all cpus, sequentially (to protect "netif_napi_add()"). */ | ||
| 711 | for_each_online_cpu(cpu) | ||
| 712 | smp_call_function_single(cpu, tile_net_update_cpu, | ||
| 713 | (saw_channel ? dev : NULL), 1); | ||
| 714 | |||
| 715 | /* HACK: Allow packets to flow in the simulator. */ | ||
| 716 | if (saw_channel) | ||
| 717 | sim_enable_mpipe_links(0, -1); | ||
| 718 | |||
| 719 | return 0; | ||
| 720 | } | ||
| 721 | |||
| 722 | /* Allocate and initialize mpipe buffer stacks, and register them in | ||
| 723 | * the mPIPE TLBs, for both small and large packet sizes. | ||
| 724 | * This routine supports tile_net_init_mpipe(), below. | ||
| 725 | */ | ||
| 726 | static int init_buffer_stacks(struct net_device *dev, int num_buffers) | ||
| 727 | { | ||
| 728 | pte_t hash_pte = pte_set_home((pte_t) { 0 }, PAGE_HOME_HASH); | ||
| 729 | int rc; | ||
| 730 | |||
| 731 | /* Compute stack bytes; we round up to 64KB and then use | ||
| 732 | * alloc_pages() so we get the required 64KB alignment as well. | ||
| 733 | */ | ||
| 734 | buffer_stack_size = | ||
| 735 | ALIGN(gxio_mpipe_calc_buffer_stack_bytes(num_buffers), | ||
| 736 | 64 * 1024); | ||
| 737 | |||
| 738 | /* Allocate two buffer stack indices. */ | ||
| 739 | rc = gxio_mpipe_alloc_buffer_stacks(&context, 2, 0, 0); | ||
| 740 | if (rc < 0) { | ||
| 741 | netdev_err(dev, "gxio_mpipe_alloc_buffer_stacks failed: %d\n", | ||
| 742 | rc); | ||
| 743 | return rc; | ||
| 744 | } | ||
| 745 | small_buffer_stack = rc; | ||
| 746 | large_buffer_stack = rc + 1; | ||
| 747 | |||
| 748 | /* Allocate the small memory stack. */ | ||
| 749 | small_buffer_stack_va = | ||
| 750 | alloc_pages_exact(buffer_stack_size, GFP_KERNEL); | ||
| 751 | if (small_buffer_stack_va == NULL) { | ||
| 752 | netdev_err(dev, | ||
| 753 | "Could not alloc %zd bytes for buffer stacks\n", | ||
| 754 | buffer_stack_size); | ||
| 755 | return -ENOMEM; | ||
| 756 | } | ||
| 757 | rc = gxio_mpipe_init_buffer_stack(&context, small_buffer_stack, | ||
| 758 | BUFFER_SIZE_SMALL_ENUM, | ||
| 759 | small_buffer_stack_va, | ||
| 760 | buffer_stack_size, 0); | ||
| 761 | if (rc != 0) { | ||
| 762 | netdev_err(dev, "gxio_mpipe_init_buffer_stack: %d\n", rc); | ||
| 763 | return rc; | ||
| 764 | } | ||
| 765 | rc = gxio_mpipe_register_client_memory(&context, small_buffer_stack, | ||
| 766 | hash_pte, 0); | ||
| 767 | if (rc != 0) { | ||
| 768 | netdev_err(dev, | ||
| 769 | "gxio_mpipe_register_buffer_memory failed: %d\n", | ||
| 770 | rc); | ||
| 771 | return rc; | ||
| 772 | } | ||
| 773 | |||
| 774 | /* Allocate the large buffer stack. */ | ||
| 775 | large_buffer_stack_va = | ||
| 776 | alloc_pages_exact(buffer_stack_size, GFP_KERNEL); | ||
| 777 | if (large_buffer_stack_va == NULL) { | ||
| 778 | netdev_err(dev, | ||
| 779 | "Could not alloc %zd bytes for buffer stacks\n", | ||
| 780 | buffer_stack_size); | ||
| 781 | return -ENOMEM; | ||
| 782 | } | ||
| 783 | rc = gxio_mpipe_init_buffer_stack(&context, large_buffer_stack, | ||
| 784 | BUFFER_SIZE_LARGE_ENUM, | ||
| 785 | large_buffer_stack_va, | ||
| 786 | buffer_stack_size, 0); | ||
| 787 | if (rc != 0) { | ||
| 788 | netdev_err(dev, "gxio_mpipe_init_buffer_stack failed: %d\n", | ||
| 789 | rc); | ||
| 790 | return rc; | ||
| 791 | } | ||
| 792 | rc = gxio_mpipe_register_client_memory(&context, large_buffer_stack, | ||
| 793 | hash_pte, 0); | ||
| 794 | if (rc != 0) { | ||
| 795 | netdev_err(dev, | ||
| 796 | "gxio_mpipe_register_buffer_memory failed: %d\n", | ||
| 797 | rc); | ||
| 798 | return rc; | ||
| 799 | } | ||
| 800 | |||
| 801 | return 0; | ||
| 802 | } | ||
| 803 | |||
| 804 | /* Allocate per-cpu resources (memory for completions and idescs). | ||
| 805 | * This routine supports tile_net_init_mpipe(), below. | ||
| 806 | */ | ||
| 807 | static int alloc_percpu_mpipe_resources(struct net_device *dev, | ||
| 808 | int cpu, int ring) | ||
| 809 | { | ||
| 810 | struct tile_net_info *info = &per_cpu(per_cpu_info, cpu); | ||
| 811 | int order, i, rc; | ||
| 812 | struct page *page; | ||
| 813 | void *addr; | ||
| 814 | |||
| 815 | /* Allocate the "comps". */ | ||
| 816 | order = get_order(COMPS_SIZE); | ||
| 817 | page = homecache_alloc_pages(GFP_KERNEL, order, cpu); | ||
| 818 | if (page == NULL) { | ||
| 819 | netdev_err(dev, "Failed to alloc %zd bytes comps memory\n", | ||
| 820 | COMPS_SIZE); | ||
| 821 | return -ENOMEM; | ||
| 822 | } | ||
| 823 | addr = pfn_to_kaddr(page_to_pfn(page)); | ||
| 824 | memset(addr, 0, COMPS_SIZE); | ||
| 825 | for (i = 0; i < TILE_NET_CHANNELS; i++) | ||
| 826 | info->comps_for_echannel[i] = | ||
| 827 | addr + i * sizeof(struct tile_net_comps); | ||
| 828 | |||
| 829 | /* If this is a network cpu, create an iqueue. */ | ||
| 830 | if (cpu_isset(cpu, network_cpus_map)) { | ||
| 831 | order = get_order(NOTIF_RING_SIZE); | ||
| 832 | page = homecache_alloc_pages(GFP_KERNEL, order, cpu); | ||
| 833 | if (page == NULL) { | ||
| 834 | netdev_err(dev, | ||
| 835 | "Failed to alloc %zd bytes iqueue memory\n", | ||
| 836 | NOTIF_RING_SIZE); | ||
| 837 | return -ENOMEM; | ||
| 838 | } | ||
| 839 | addr = pfn_to_kaddr(page_to_pfn(page)); | ||
| 840 | rc = gxio_mpipe_iqueue_init(&info->iqueue, &context, ring++, | ||
| 841 | addr, NOTIF_RING_SIZE, 0); | ||
| 842 | if (rc < 0) { | ||
| 843 | netdev_err(dev, | ||
| 844 | "gxio_mpipe_iqueue_init failed: %d\n", rc); | ||
| 845 | return rc; | ||
| 846 | } | ||
| 847 | info->has_iqueue = true; | ||
| 848 | } | ||
| 849 | |||
| 850 | return ring; | ||
| 851 | } | ||
| 852 | |||
| 853 | /* Initialize NotifGroup and buckets. | ||
| 854 | * This routine supports tile_net_init_mpipe(), below. | ||
| 855 | */ | ||
| 856 | static int init_notif_group_and_buckets(struct net_device *dev, | ||
| 857 | int ring, int network_cpus_count) | ||
| 858 | { | ||
| 859 | int group, rc; | ||
| 860 | |||
| 861 | /* Allocate one NotifGroup. */ | ||
| 862 | rc = gxio_mpipe_alloc_notif_groups(&context, 1, 0, 0); | ||
| 863 | if (rc < 0) { | ||
| 864 | netdev_err(dev, "gxio_mpipe_alloc_notif_groups failed: %d\n", | ||
| 865 | rc); | ||
| 866 | return rc; | ||
| 867 | } | ||
| 868 | group = rc; | ||
| 869 | |||
| 870 | /* Initialize global num_buckets value. */ | ||
| 871 | if (network_cpus_count > 4) | ||
| 872 | num_buckets = 256; | ||
| 873 | else if (network_cpus_count > 1) | ||
| 874 | num_buckets = 16; | ||
| 875 | |||
| 876 | /* Allocate some buckets, and set global first_bucket value. */ | ||
| 877 | rc = gxio_mpipe_alloc_buckets(&context, num_buckets, 0, 0); | ||
| 878 | if (rc < 0) { | ||
| 879 | netdev_err(dev, "gxio_mpipe_alloc_buckets failed: %d\n", rc); | ||
| 880 | return rc; | ||
| 881 | } | ||
| 882 | first_bucket = rc; | ||
| 883 | |||
| 884 | /* Init group and buckets. */ | ||
| 885 | rc = gxio_mpipe_init_notif_group_and_buckets( | ||
| 886 | &context, group, ring, network_cpus_count, | ||
| 887 | first_bucket, num_buckets, | ||
| 888 | GXIO_MPIPE_BUCKET_STICKY_FLOW_LOCALITY); | ||
| 889 | if (rc != 0) { | ||
| 890 | netdev_err( | ||
| 891 | dev, | ||
| 892 | "gxio_mpipe_init_notif_group_and_buckets failed: %d\n", | ||
| 893 | rc); | ||
| 894 | return rc; | ||
| 895 | } | ||
| 896 | |||
| 897 | return 0; | ||
| 898 | } | ||
| 899 | |||
| 900 | /* Create an irq and register it, then activate the irq and request | ||
| 901 | * interrupts on all cores. Note that "ingress_irq" being initialized | ||
| 902 | * is how we know not to call tile_net_init_mpipe() again. | ||
| 903 | * This routine supports tile_net_init_mpipe(), below. | ||
| 904 | */ | ||
| 905 | static int tile_net_setup_interrupts(struct net_device *dev) | ||
| 906 | { | ||
| 907 | int cpu, rc; | ||
| 908 | |||
| 909 | rc = create_irq(); | ||
| 910 | if (rc < 0) { | ||
| 911 | netdev_err(dev, "create_irq failed: %d\n", rc); | ||
| 912 | return rc; | ||
| 913 | } | ||
| 914 | ingress_irq = rc; | ||
| 915 | tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU); | ||
| 916 | rc = request_irq(ingress_irq, tile_net_handle_ingress_irq, | ||
| 917 | 0, NULL, NULL); | ||
| 918 | if (rc != 0) { | ||
| 919 | netdev_err(dev, "request_irq failed: %d\n", rc); | ||
| 920 | destroy_irq(ingress_irq); | ||
| 921 | ingress_irq = -1; | ||
| 922 | return rc; | ||
| 923 | } | ||
| 924 | |||
| 925 | for_each_online_cpu(cpu) { | ||
| 926 | struct tile_net_info *info = &per_cpu(per_cpu_info, cpu); | ||
| 927 | if (info->has_iqueue) { | ||
| 928 | gxio_mpipe_request_notif_ring_interrupt( | ||
| 929 | &context, cpu_x(cpu), cpu_y(cpu), | ||
| 930 | 1, ingress_irq, info->iqueue.ring); | ||
| 931 | } | ||
| 932 | } | ||
| 933 | |||
| 934 | return 0; | ||
| 935 | } | ||
| 936 | |||
| 937 | /* Undo any state set up partially by a failed call to tile_net_init_mpipe. */ | ||
| 938 | static void tile_net_init_mpipe_fail(void) | ||
| 939 | { | ||
| 940 | int cpu; | ||
| 941 | |||
| 942 | /* Do cleanups that require the mpipe context first. */ | ||
| 943 | if (small_buffer_stack >= 0) | ||
| 944 | tile_net_pop_all_buffers(small_buffer_stack); | ||
| 945 | if (large_buffer_stack >= 0) | ||
| 946 | tile_net_pop_all_buffers(large_buffer_stack); | ||
| 947 | |||
| 948 | /* Destroy mpipe context so the hardware no longer owns any memory. */ | ||
| 949 | gxio_mpipe_destroy(&context); | ||
| 950 | |||
| 951 | for_each_online_cpu(cpu) { | ||
| 952 | struct tile_net_info *info = &per_cpu(per_cpu_info, cpu); | ||
| 953 | free_pages((unsigned long)(info->comps_for_echannel[0]), | ||
| 954 | get_order(COMPS_SIZE)); | ||
| 955 | info->comps_for_echannel[0] = NULL; | ||
| 956 | free_pages((unsigned long)(info->iqueue.idescs), | ||
| 957 | get_order(NOTIF_RING_SIZE)); | ||
| 958 | info->iqueue.idescs = NULL; | ||
| 959 | } | ||
| 960 | |||
| 961 | if (small_buffer_stack_va) | ||
| 962 | free_pages_exact(small_buffer_stack_va, buffer_stack_size); | ||
| 963 | if (large_buffer_stack_va) | ||
| 964 | free_pages_exact(large_buffer_stack_va, buffer_stack_size); | ||
| 965 | |||
| 966 | small_buffer_stack_va = NULL; | ||
| 967 | large_buffer_stack_va = NULL; | ||
| 968 | large_buffer_stack = -1; | ||
| 969 | small_buffer_stack = -1; | ||
| 970 | first_bucket = -1; | ||
| 971 | } | ||
| 972 | |||
| 973 | /* The first time any tilegx network device is opened, we initialize | ||
| 974 | * the global mpipe state. If this step fails, we fail to open the | ||
| 975 | * device, but if it succeeds, we never need to do it again, and since | ||
| 976 | * tile_net can't be unloaded, we never undo it. | ||
| 977 | * | ||
| 978 | * Note that some resources in this path (buffer stack indices, | ||
| 979 | * bindings from init_buffer_stack, etc.) are hypervisor resources | ||
| 980 | * that are freed implicitly by gxio_mpipe_destroy(). | ||
| 981 | */ | ||
| 982 | static int tile_net_init_mpipe(struct net_device *dev) | ||
| 983 | { | ||
| 984 | int i, num_buffers, rc; | ||
| 985 | int cpu; | ||
| 986 | int first_ring, ring; | ||
| 987 | int network_cpus_count = cpus_weight(network_cpus_map); | ||
| 988 | |||
| 989 | if (!hash_default) { | ||
| 990 | netdev_err(dev, "Networking requires hash_default!\n"); | ||
| 991 | return -EIO; | ||
| 992 | } | ||
| 993 | |||
| 994 | rc = gxio_mpipe_init(&context, 0); | ||
| 995 | if (rc != 0) { | ||
| 996 | netdev_err(dev, "gxio_mpipe_init failed: %d\n", rc); | ||
| 997 | return -EIO; | ||
| 998 | } | ||
| 999 | |||
| 1000 | /* Set up the buffer stacks. */ | ||
| 1001 | num_buffers = | ||
| 1002 | network_cpus_count * (IQUEUE_ENTRIES + TILE_NET_BATCH); | ||
| 1003 | rc = init_buffer_stacks(dev, num_buffers); | ||
| 1004 | if (rc != 0) | ||
| 1005 | goto fail; | ||
| 1006 | |||
| 1007 | /* Provide initial buffers. */ | ||
| 1008 | rc = -ENOMEM; | ||
| 1009 | for (i = 0; i < num_buffers; i++) { | ||
| 1010 | if (!tile_net_provide_buffer(true)) { | ||
| 1011 | netdev_err(dev, "Cannot allocate initial sk_bufs!\n"); | ||
| 1012 | goto fail; | ||
| 1013 | } | ||
| 1014 | } | ||
| 1015 | for (i = 0; i < num_buffers; i++) { | ||
| 1016 | if (!tile_net_provide_buffer(false)) { | ||
| 1017 | netdev_err(dev, "Cannot allocate initial sk_bufs!\n"); | ||
| 1018 | goto fail; | ||
| 1019 | } | ||
| 1020 | } | ||
| 1021 | |||
| 1022 | /* Allocate one NotifRing for each network cpu. */ | ||
| 1023 | rc = gxio_mpipe_alloc_notif_rings(&context, network_cpus_count, 0, 0); | ||
| 1024 | if (rc < 0) { | ||
| 1025 | netdev_err(dev, "gxio_mpipe_alloc_notif_rings failed %d\n", | ||
| 1026 | rc); | ||
| 1027 | goto fail; | ||
| 1028 | } | ||
| 1029 | |||
| 1030 | /* Init NotifRings per-cpu. */ | ||
| 1031 | first_ring = rc; | ||
| 1032 | ring = first_ring; | ||
| 1033 | for_each_online_cpu(cpu) { | ||
| 1034 | rc = alloc_percpu_mpipe_resources(dev, cpu, ring); | ||
| 1035 | if (rc < 0) | ||
| 1036 | goto fail; | ||
| 1037 | ring = rc; | ||
| 1038 | } | ||
| 1039 | |||
| 1040 | /* Initialize NotifGroup and buckets. */ | ||
| 1041 | rc = init_notif_group_and_buckets(dev, first_ring, network_cpus_count); | ||
| 1042 | if (rc != 0) | ||
| 1043 | goto fail; | ||
| 1044 | |||
| 1045 | /* Create and enable interrupts. */ | ||
| 1046 | rc = tile_net_setup_interrupts(dev); | ||
| 1047 | if (rc != 0) | ||
| 1048 | goto fail; | ||
| 1049 | |||
| 1050 | return 0; | ||
| 1051 | |||
| 1052 | fail: | ||
| 1053 | tile_net_init_mpipe_fail(); | ||
| 1054 | return rc; | ||
| 1055 | } | ||
| 1056 | |||
| 1057 | /* Create persistent egress info for a given egress channel. | ||
| 1058 | * Note that this may be shared between, say, "gbe0" and "xgbe0". | ||
| 1059 | * ISSUE: Defer header allocation until TSO is actually needed? | ||
| 1060 | */ | ||
| 1061 | static int tile_net_init_egress(struct net_device *dev, int echannel) | ||
| 1062 | { | ||
| 1063 | struct page *headers_page, *edescs_page, *equeue_page; | ||
| 1064 | gxio_mpipe_edesc_t *edescs; | ||
| 1065 | gxio_mpipe_equeue_t *equeue; | ||
| 1066 | unsigned char *headers; | ||
| 1067 | int headers_order, edescs_order, equeue_order; | ||
| 1068 | size_t edescs_size; | ||
| 1069 | int edma; | ||
| 1070 | int rc = -ENOMEM; | ||
| 1071 | |||
| 1072 | /* Only initialize once. */ | ||
| 1073 | if (egress_for_echannel[echannel].equeue != NULL) | ||
| 1074 | return 0; | ||
| 1075 | |||
| 1076 | /* Allocate memory for the "headers". */ | ||
| 1077 | headers_order = get_order(EQUEUE_ENTRIES * HEADER_BYTES); | ||
| 1078 | headers_page = alloc_pages(GFP_KERNEL, headers_order); | ||
| 1079 | if (headers_page == NULL) { | ||
| 1080 | netdev_warn(dev, | ||
| 1081 | "Could not alloc %zd bytes for TSO headers.\n", | ||
| 1082 | PAGE_SIZE << headers_order); | ||
| 1083 | goto fail; | ||
| 1084 | } | ||
| 1085 | headers = pfn_to_kaddr(page_to_pfn(headers_page)); | ||
| 1086 | |||
| 1087 | /* Allocate memory for the "edescs". */ | ||
| 1088 | edescs_size = EQUEUE_ENTRIES * sizeof(*edescs); | ||
| 1089 | edescs_order = get_order(edescs_size); | ||
| 1090 | edescs_page = alloc_pages(GFP_KERNEL, edescs_order); | ||
| 1091 | if (edescs_page == NULL) { | ||
| 1092 | netdev_warn(dev, | ||
| 1093 | "Could not alloc %zd bytes for eDMA ring.\n", | ||
| 1094 | edescs_size); | ||
| 1095 | goto fail_headers; | ||
| 1096 | } | ||
| 1097 | edescs = pfn_to_kaddr(page_to_pfn(edescs_page)); | ||
| 1098 | |||
| 1099 | /* Allocate memory for the "equeue". */ | ||
| 1100 | equeue_order = get_order(sizeof(*equeue)); | ||
| 1101 | equeue_page = alloc_pages(GFP_KERNEL, equeue_order); | ||
| 1102 | if (equeue_page == NULL) { | ||
| 1103 | netdev_warn(dev, | ||
| 1104 | "Could not alloc %zd bytes for equeue info.\n", | ||
| 1105 | PAGE_SIZE << equeue_order); | ||
| 1106 | goto fail_edescs; | ||
| 1107 | } | ||
| 1108 | equeue = pfn_to_kaddr(page_to_pfn(equeue_page)); | ||
| 1109 | |||
| 1110 | /* Allocate an edma ring. Note that in practice this can't | ||
| 1111 | * fail, which is good, because we will leak an edma ring if so. | ||
| 1112 | */ | ||
| 1113 | rc = gxio_mpipe_alloc_edma_rings(&context, 1, 0, 0); | ||
| 1114 | if (rc < 0) { | ||
| 1115 | netdev_warn(dev, "gxio_mpipe_alloc_edma_rings failed: %d\n", | ||
| 1116 | rc); | ||
| 1117 | goto fail_equeue; | ||
| 1118 | } | ||
| 1119 | edma = rc; | ||
| 1120 | |||
| 1121 | /* Initialize the equeue. */ | ||
| 1122 | rc = gxio_mpipe_equeue_init(equeue, &context, edma, echannel, | ||
| 1123 | edescs, edescs_size, 0); | ||
| 1124 | if (rc != 0) { | ||
| 1125 | netdev_err(dev, "gxio_mpipe_equeue_init failed: %d\n", rc); | ||
| 1126 | goto fail_equeue; | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | /* Done. */ | ||
| 1130 | egress_for_echannel[echannel].equeue = equeue; | ||
| 1131 | egress_for_echannel[echannel].headers = headers; | ||
| 1132 | return 0; | ||
| 1133 | |||
| 1134 | fail_equeue: | ||
| 1135 | __free_pages(equeue_page, equeue_order); | ||
| 1136 | |||
| 1137 | fail_edescs: | ||
| 1138 | __free_pages(edescs_page, edescs_order); | ||
| 1139 | |||
| 1140 | fail_headers: | ||
| 1141 | __free_pages(headers_page, headers_order); | ||
| 1142 | |||
| 1143 | fail: | ||
| 1144 | return rc; | ||
| 1145 | } | ||
| 1146 | |||
| 1147 | /* Return channel number for a newly-opened link. */ | ||
| 1148 | static int tile_net_link_open(struct net_device *dev, gxio_mpipe_link_t *link, | ||
| 1149 | const char *link_name) | ||
| 1150 | { | ||
| 1151 | int rc = gxio_mpipe_link_open(link, &context, link_name, 0); | ||
| 1152 | if (rc < 0) { | ||
| 1153 | netdev_err(dev, "Failed to open '%s'\n", link_name); | ||
| 1154 | return rc; | ||
| 1155 | } | ||
| 1156 | rc = gxio_mpipe_link_channel(link); | ||
| 1157 | if (rc < 0 || rc >= TILE_NET_CHANNELS) { | ||
| 1158 | netdev_err(dev, "gxio_mpipe_link_channel bad value: %d\n", rc); | ||
| 1159 | gxio_mpipe_link_close(link); | ||
| 1160 | return -EINVAL; | ||
| 1161 | } | ||
| 1162 | return rc; | ||
| 1163 | } | ||
| 1164 | |||
| 1165 | /* Help the kernel activate the given network interface. */ | ||
| 1166 | static int tile_net_open(struct net_device *dev) | ||
| 1167 | { | ||
| 1168 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 1169 | int cpu, rc; | ||
| 1170 | |||
| 1171 | mutex_lock(&tile_net_devs_for_channel_mutex); | ||
| 1172 | |||
| 1173 | /* Do one-time initialization the first time any device is opened. */ | ||
| 1174 | if (ingress_irq < 0) { | ||
| 1175 | rc = tile_net_init_mpipe(dev); | ||
| 1176 | if (rc != 0) | ||
| 1177 | goto fail; | ||
| 1178 | } | ||
| 1179 | |||
| 1180 | /* Determine if this is the "loopify" device. */ | ||
| 1181 | if (unlikely((loopify_link_name != NULL) && | ||
| 1182 | !strcmp(dev->name, loopify_link_name))) { | ||
| 1183 | rc = tile_net_link_open(dev, &priv->link, "loop0"); | ||
| 1184 | if (rc < 0) | ||
| 1185 | goto fail; | ||
| 1186 | priv->channel = rc; | ||
| 1187 | rc = tile_net_link_open(dev, &priv->loopify_link, "loop1"); | ||
| 1188 | if (rc < 0) | ||
| 1189 | goto fail; | ||
| 1190 | priv->loopify_channel = rc; | ||
| 1191 | priv->echannel = rc; | ||
| 1192 | } else { | ||
| 1193 | rc = tile_net_link_open(dev, &priv->link, dev->name); | ||
| 1194 | if (rc < 0) | ||
| 1195 | goto fail; | ||
| 1196 | priv->channel = rc; | ||
| 1197 | priv->echannel = rc; | ||
| 1198 | } | ||
| 1199 | |||
| 1200 | /* Initialize egress info (if needed). Once ever, per echannel. */ | ||
| 1201 | rc = tile_net_init_egress(dev, priv->echannel); | ||
| 1202 | if (rc != 0) | ||
| 1203 | goto fail; | ||
| 1204 | |||
| 1205 | tile_net_devs_for_channel[priv->channel] = dev; | ||
| 1206 | |||
| 1207 | rc = tile_net_update(dev); | ||
| 1208 | if (rc != 0) | ||
| 1209 | goto fail; | ||
| 1210 | |||
| 1211 | mutex_unlock(&tile_net_devs_for_channel_mutex); | ||
| 1212 | |||
| 1213 | /* Initialize the transmit wake timer for this device for each cpu. */ | ||
| 1214 | for_each_online_cpu(cpu) { | ||
| 1215 | struct tile_net_info *info = &per_cpu(per_cpu_info, cpu); | ||
| 1216 | struct tile_net_tx_wake *tx_wake = | ||
| 1217 | &info->tx_wake[priv->echannel]; | ||
| 1218 | |||
| 1219 | hrtimer_init(&tx_wake->timer, CLOCK_MONOTONIC, | ||
| 1220 | HRTIMER_MODE_REL); | ||
| 1221 | tx_wake->timer.function = tile_net_handle_tx_wake_timer; | ||
| 1222 | tx_wake->dev = dev; | ||
| 1223 | } | ||
| 1224 | |||
| 1225 | for_each_online_cpu(cpu) | ||
| 1226 | netif_start_subqueue(dev, cpu); | ||
| 1227 | netif_carrier_on(dev); | ||
| 1228 | return 0; | ||
| 1229 | |||
| 1230 | fail: | ||
| 1231 | if (priv->loopify_channel >= 0) { | ||
| 1232 | if (gxio_mpipe_link_close(&priv->loopify_link) != 0) | ||
| 1233 | netdev_warn(dev, "Failed to close loopify link!\n"); | ||
| 1234 | priv->loopify_channel = -1; | ||
| 1235 | } | ||
| 1236 | if (priv->channel >= 0) { | ||
| 1237 | if (gxio_mpipe_link_close(&priv->link) != 0) | ||
| 1238 | netdev_warn(dev, "Failed to close link!\n"); | ||
| 1239 | priv->channel = -1; | ||
| 1240 | } | ||
| 1241 | priv->echannel = -1; | ||
| 1242 | tile_net_devs_for_channel[priv->channel] = NULL; | ||
| 1243 | mutex_unlock(&tile_net_devs_for_channel_mutex); | ||
| 1244 | |||
| 1245 | /* Don't return raw gxio error codes to generic Linux. */ | ||
| 1246 | return (rc > -512) ? rc : -EIO; | ||
| 1247 | } | ||
| 1248 | |||
| 1249 | /* Help the kernel deactivate the given network interface. */ | ||
| 1250 | static int tile_net_stop(struct net_device *dev) | ||
| 1251 | { | ||
| 1252 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 1253 | int cpu; | ||
| 1254 | |||
| 1255 | for_each_online_cpu(cpu) { | ||
| 1256 | struct tile_net_info *info = &per_cpu(per_cpu_info, cpu); | ||
| 1257 | struct tile_net_tx_wake *tx_wake = | ||
| 1258 | &info->tx_wake[priv->echannel]; | ||
| 1259 | |||
| 1260 | hrtimer_cancel(&tx_wake->timer); | ||
| 1261 | netif_stop_subqueue(dev, cpu); | ||
| 1262 | } | ||
| 1263 | |||
| 1264 | mutex_lock(&tile_net_devs_for_channel_mutex); | ||
| 1265 | tile_net_devs_for_channel[priv->channel] = NULL; | ||
| 1266 | (void)tile_net_update(dev); | ||
| 1267 | if (priv->loopify_channel >= 0) { | ||
| 1268 | if (gxio_mpipe_link_close(&priv->loopify_link) != 0) | ||
| 1269 | netdev_warn(dev, "Failed to close loopify link!\n"); | ||
| 1270 | priv->loopify_channel = -1; | ||
| 1271 | } | ||
| 1272 | if (priv->channel >= 0) { | ||
| 1273 | if (gxio_mpipe_link_close(&priv->link) != 0) | ||
| 1274 | netdev_warn(dev, "Failed to close link!\n"); | ||
| 1275 | priv->channel = -1; | ||
| 1276 | } | ||
| 1277 | priv->echannel = -1; | ||
| 1278 | mutex_unlock(&tile_net_devs_for_channel_mutex); | ||
| 1279 | |||
| 1280 | return 0; | ||
| 1281 | } | ||
| 1282 | |||
| 1283 | /* Determine the VA for a fragment. */ | ||
| 1284 | static inline void *tile_net_frag_buf(skb_frag_t *f) | ||
| 1285 | { | ||
| 1286 | unsigned long pfn = page_to_pfn(skb_frag_page(f)); | ||
| 1287 | return pfn_to_kaddr(pfn) + f->page_offset; | ||
| 1288 | } | ||
| 1289 | |||
| 1290 | /* Acquire a completion entry and an egress slot, or if we can't, | ||
| 1291 | * stop the queue and schedule the tx_wake timer. | ||
| 1292 | */ | ||
| 1293 | static s64 tile_net_equeue_try_reserve(struct net_device *dev, | ||
| 1294 | struct tile_net_comps *comps, | ||
| 1295 | gxio_mpipe_equeue_t *equeue, | ||
| 1296 | int num_edescs) | ||
| 1297 | { | ||
| 1298 | /* Try to acquire a completion entry. */ | ||
| 1299 | if (comps->comp_next - comps->comp_last < TILE_NET_MAX_COMPS - 1 || | ||
| 1300 | tile_net_free_comps(equeue, comps, 32, false) != 0) { | ||
| 1301 | |||
| 1302 | /* Try to acquire an egress slot. */ | ||
| 1303 | s64 slot = gxio_mpipe_equeue_try_reserve(equeue, num_edescs); | ||
| 1304 | if (slot >= 0) | ||
| 1305 | return slot; | ||
| 1306 | |||
| 1307 | /* Freeing some completions gives the equeue time to drain. */ | ||
| 1308 | tile_net_free_comps(equeue, comps, TILE_NET_MAX_COMPS, false); | ||
| 1309 | |||
| 1310 | slot = gxio_mpipe_equeue_try_reserve(equeue, num_edescs); | ||
| 1311 | if (slot >= 0) | ||
| 1312 | return slot; | ||
| 1313 | } | ||
| 1314 | |||
| 1315 | /* Still nothing; give up and stop the queue for a short while. */ | ||
| 1316 | netif_stop_subqueue(dev, smp_processor_id()); | ||
| 1317 | tile_net_schedule_tx_wake_timer(dev); | ||
| 1318 | return -1; | ||
| 1319 | } | ||
| 1320 | |||
| 1321 | /* Determine how many edesc's are needed for TSO. | ||
| 1322 | * | ||
| 1323 | * Sometimes, if "sendfile()" requires copying, we will be called with | ||
| 1324 | * "data" containing the header and payload, with "frags" being empty. | ||
| 1325 | * Sometimes, for example when using NFS over TCP, a single segment can | ||
| 1326 | * span 3 fragments. This requires special care. | ||
| 1327 | */ | ||
| 1328 | static int tso_count_edescs(struct sk_buff *skb) | ||
| 1329 | { | ||
| 1330 | struct skb_shared_info *sh = skb_shinfo(skb); | ||
| 1331 | unsigned int data_len = skb->data_len; | ||
| 1332 | unsigned int p_len = sh->gso_size; | ||
| 1333 | long f_id = -1; /* id of the current fragment */ | ||
| 1334 | long f_size = -1; /* size of the current fragment */ | ||
| 1335 | long f_used = -1; /* bytes used from the current fragment */ | ||
| 1336 | long n; /* size of the current piece of payload */ | ||
| 1337 | int num_edescs = 0; | ||
| 1338 | int segment; | ||
| 1339 | |||
| 1340 | for (segment = 0; segment < sh->gso_segs; segment++) { | ||
| 1341 | |||
| 1342 | unsigned int p_used = 0; | ||
| 1343 | |||
| 1344 | /* One edesc for header and for each piece of the payload. */ | ||
| 1345 | for (num_edescs++; p_used < p_len; num_edescs++) { | ||
| 1346 | |||
| 1347 | /* Advance as needed. */ | ||
| 1348 | while (f_used >= f_size) { | ||
| 1349 | f_id++; | ||
| 1350 | f_size = sh->frags[f_id].size; | ||
| 1351 | f_used = 0; | ||
| 1352 | } | ||
| 1353 | |||
| 1354 | /* Use bytes from the current fragment. */ | ||
| 1355 | n = p_len - p_used; | ||
| 1356 | if (n > f_size - f_used) | ||
| 1357 | n = f_size - f_used; | ||
| 1358 | f_used += n; | ||
| 1359 | p_used += n; | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | /* The last segment may be less than gso_size. */ | ||
| 1363 | data_len -= p_len; | ||
| 1364 | if (data_len < p_len) | ||
| 1365 | p_len = data_len; | ||
| 1366 | } | ||
| 1367 | |||
| 1368 | return num_edescs; | ||
| 1369 | } | ||
| 1370 | |||
| 1371 | /* Prepare modified copies of the skbuff headers. | ||
| 1372 | * FIXME: add support for IPv6. | ||
| 1373 | */ | ||
| 1374 | static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers, | ||
| 1375 | s64 slot) | ||
| 1376 | { | ||
| 1377 | struct skb_shared_info *sh = skb_shinfo(skb); | ||
| 1378 | struct iphdr *ih; | ||
| 1379 | struct tcphdr *th; | ||
| 1380 | unsigned int data_len = skb->data_len; | ||
| 1381 | unsigned char *data = skb->data; | ||
| 1382 | unsigned int ih_off, th_off, sh_len, p_len; | ||
| 1383 | unsigned int isum_seed, tsum_seed, id, seq; | ||
| 1384 | long f_id = -1; /* id of the current fragment */ | ||
| 1385 | long f_size = -1; /* size of the current fragment */ | ||
| 1386 | long f_used = -1; /* bytes used from the current fragment */ | ||
| 1387 | long n; /* size of the current piece of payload */ | ||
| 1388 | int segment; | ||
| 1389 | |||
| 1390 | /* Locate original headers and compute various lengths. */ | ||
| 1391 | ih = ip_hdr(skb); | ||
| 1392 | th = tcp_hdr(skb); | ||
| 1393 | ih_off = skb_network_offset(skb); | ||
| 1394 | th_off = skb_transport_offset(skb); | ||
| 1395 | sh_len = th_off + tcp_hdrlen(skb); | ||
| 1396 | p_len = sh->gso_size; | ||
| 1397 | |||
| 1398 | /* Set up seed values for IP and TCP csum and initialize id and seq. */ | ||
| 1399 | isum_seed = ((0xFFFF - ih->check) + | ||
| 1400 | (0xFFFF - ih->tot_len) + | ||
| 1401 | (0xFFFF - ih->id)); | ||
| 1402 | tsum_seed = th->check + (0xFFFF ^ htons(skb->len)); | ||
| 1403 | id = ntohs(ih->id); | ||
| 1404 | seq = ntohl(th->seq); | ||
| 1405 | |||
| 1406 | /* Prepare all the headers. */ | ||
| 1407 | for (segment = 0; segment < sh->gso_segs; segment++) { | ||
| 1408 | unsigned char *buf; | ||
| 1409 | unsigned int p_used = 0; | ||
| 1410 | |||
| 1411 | /* Copy to the header memory for this segment. */ | ||
| 1412 | buf = headers + (slot % EQUEUE_ENTRIES) * HEADER_BYTES + | ||
| 1413 | NET_IP_ALIGN; | ||
| 1414 | memcpy(buf, data, sh_len); | ||
| 1415 | |||
| 1416 | /* Update copied ip header. */ | ||
| 1417 | ih = (struct iphdr *)(buf + ih_off); | ||
| 1418 | ih->tot_len = htons(sh_len + p_len - ih_off); | ||
| 1419 | ih->id = htons(id); | ||
| 1420 | ih->check = csum_long(isum_seed + ih->tot_len + | ||
| 1421 | ih->id) ^ 0xffff; | ||
| 1422 | |||
| 1423 | /* Update copied tcp header. */ | ||
| 1424 | th = (struct tcphdr *)(buf + th_off); | ||
| 1425 | th->seq = htonl(seq); | ||
| 1426 | th->check = csum_long(tsum_seed + htons(sh_len + p_len)); | ||
| 1427 | if (segment != sh->gso_segs - 1) { | ||
| 1428 | th->fin = 0; | ||
| 1429 | th->psh = 0; | ||
| 1430 | } | ||
| 1431 | |||
| 1432 | /* Skip past the header. */ | ||
| 1433 | slot++; | ||
| 1434 | |||
| 1435 | /* Skip past the payload. */ | ||
| 1436 | while (p_used < p_len) { | ||
| 1437 | |||
| 1438 | /* Advance as needed. */ | ||
| 1439 | while (f_used >= f_size) { | ||
| 1440 | f_id++; | ||
| 1441 | f_size = sh->frags[f_id].size; | ||
| 1442 | f_used = 0; | ||
| 1443 | } | ||
| 1444 | |||
| 1445 | /* Use bytes from the current fragment. */ | ||
| 1446 | n = p_len - p_used; | ||
| 1447 | if (n > f_size - f_used) | ||
| 1448 | n = f_size - f_used; | ||
| 1449 | f_used += n; | ||
| 1450 | p_used += n; | ||
| 1451 | |||
| 1452 | slot++; | ||
| 1453 | } | ||
| 1454 | |||
| 1455 | id++; | ||
| 1456 | seq += p_len; | ||
| 1457 | |||
| 1458 | /* The last segment may be less than gso_size. */ | ||
| 1459 | data_len -= p_len; | ||
| 1460 | if (data_len < p_len) | ||
| 1461 | p_len = data_len; | ||
| 1462 | } | ||
| 1463 | |||
| 1464 | /* Flush the headers so they are ready for hardware DMA. */ | ||
| 1465 | wmb(); | ||
| 1466 | } | ||
| 1467 | |||
| 1468 | /* Pass all the data to mpipe for egress. */ | ||
| 1469 | static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue, | ||
| 1470 | struct sk_buff *skb, unsigned char *headers, s64 slot) | ||
| 1471 | { | ||
| 1472 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 1473 | struct skb_shared_info *sh = skb_shinfo(skb); | ||
| 1474 | unsigned int data_len = skb->data_len; | ||
| 1475 | unsigned int p_len = sh->gso_size; | ||
| 1476 | gxio_mpipe_edesc_t edesc_head = { { 0 } }; | ||
| 1477 | gxio_mpipe_edesc_t edesc_body = { { 0 } }; | ||
| 1478 | long f_id = -1; /* id of the current fragment */ | ||
| 1479 | long f_size = -1; /* size of the current fragment */ | ||
| 1480 | long f_used = -1; /* bytes used from the current fragment */ | ||
| 1481 | long n; /* size of the current piece of payload */ | ||
| 1482 | unsigned long tx_packets = 0, tx_bytes = 0; | ||
| 1483 | unsigned int csum_start, sh_len; | ||
| 1484 | int segment; | ||
| 1485 | |||
| 1486 | /* Prepare to egress the headers: set up header edesc. */ | ||
| 1487 | csum_start = skb_checksum_start_offset(skb); | ||
| 1488 | sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb); | ||
| 1489 | edesc_head.csum = 1; | ||
| 1490 | edesc_head.csum_start = csum_start; | ||
| 1491 | edesc_head.csum_dest = csum_start + skb->csum_offset; | ||
| 1492 | edesc_head.xfer_size = sh_len; | ||
| 1493 | |||
| 1494 | /* This is only used to specify the TLB. */ | ||
| 1495 | edesc_head.stack_idx = large_buffer_stack; | ||
| 1496 | edesc_body.stack_idx = large_buffer_stack; | ||
| 1497 | |||
| 1498 | /* Egress all the edescs. */ | ||
| 1499 | for (segment = 0; segment < sh->gso_segs; segment++) { | ||
| 1500 | void *va; | ||
| 1501 | unsigned char *buf; | ||
| 1502 | unsigned int p_used = 0; | ||
| 1503 | |||
| 1504 | /* Egress the header. */ | ||
| 1505 | buf = headers + (slot % EQUEUE_ENTRIES) * HEADER_BYTES + | ||
| 1506 | NET_IP_ALIGN; | ||
| 1507 | edesc_head.va = va_to_tile_io_addr(buf); | ||
| 1508 | gxio_mpipe_equeue_put_at(equeue, edesc_head, slot); | ||
| 1509 | slot++; | ||
| 1510 | |||
| 1511 | /* Egress the payload. */ | ||
| 1512 | while (p_used < p_len) { | ||
| 1513 | |||
| 1514 | /* Advance as needed. */ | ||
| 1515 | while (f_used >= f_size) { | ||
| 1516 | f_id++; | ||
| 1517 | f_size = sh->frags[f_id].size; | ||
| 1518 | f_used = 0; | ||
| 1519 | } | ||
| 1520 | |||
| 1521 | va = tile_net_frag_buf(&sh->frags[f_id]) + f_used; | ||
| 1522 | |||
| 1523 | /* Use bytes from the current fragment. */ | ||
| 1524 | n = p_len - p_used; | ||
| 1525 | if (n > f_size - f_used) | ||
| 1526 | n = f_size - f_used; | ||
| 1527 | f_used += n; | ||
| 1528 | p_used += n; | ||
| 1529 | |||
| 1530 | /* Egress a piece of the payload. */ | ||
| 1531 | edesc_body.va = va_to_tile_io_addr(va); | ||
| 1532 | edesc_body.xfer_size = n; | ||
| 1533 | edesc_body.bound = !(p_used < p_len); | ||
| 1534 | gxio_mpipe_equeue_put_at(equeue, edesc_body, slot); | ||
| 1535 | slot++; | ||
| 1536 | } | ||
| 1537 | |||
| 1538 | tx_packets++; | ||
| 1539 | tx_bytes += sh_len + p_len; | ||
| 1540 | |||
| 1541 | /* The last segment may be less than gso_size. */ | ||
| 1542 | data_len -= p_len; | ||
| 1543 | if (data_len < p_len) | ||
| 1544 | p_len = data_len; | ||
| 1545 | } | ||
| 1546 | |||
| 1547 | /* Update stats. */ | ||
| 1548 | tile_net_stats_add(tx_packets, &priv->stats.tx_packets); | ||
| 1549 | tile_net_stats_add(tx_bytes, &priv->stats.tx_bytes); | ||
| 1550 | } | ||
| 1551 | |||
| 1552 | /* Do "TSO" handling for egress. | ||
| 1553 | * | ||
| 1554 | * Normally drivers set NETIF_F_TSO only to support hardware TSO; | ||
| 1555 | * otherwise the stack uses scatter-gather to implement GSO in software. | ||
| 1556 | * On our testing, enabling GSO support (via NETIF_F_SG) drops network | ||
| 1557 | * performance down to around 7.5 Gbps on the 10G interfaces, although | ||
| 1558 | * also dropping cpu utilization way down, to under 8%. But | ||
| 1559 | * implementing "TSO" in the driver brings performance back up to line | ||
| 1560 | * rate, while dropping cpu usage even further, to less than 4%. In | ||
| 1561 | * practice, profiling of GSO shows that skb_segment() is what causes | ||
| 1562 | * the performance overheads; we benefit in the driver from using | ||
| 1563 | * preallocated memory to duplicate the TCP/IP headers. | ||
| 1564 | */ | ||
| 1565 | static int tile_net_tx_tso(struct sk_buff *skb, struct net_device *dev) | ||
| 1566 | { | ||
| 1567 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 1568 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 1569 | int channel = priv->echannel; | ||
| 1570 | struct tile_net_egress *egress = &egress_for_echannel[channel]; | ||
| 1571 | struct tile_net_comps *comps = info->comps_for_echannel[channel]; | ||
| 1572 | gxio_mpipe_equeue_t *equeue = egress->equeue; | ||
| 1573 | unsigned long irqflags; | ||
| 1574 | int num_edescs; | ||
| 1575 | s64 slot; | ||
| 1576 | |||
| 1577 | /* Determine how many mpipe edesc's are needed. */ | ||
| 1578 | num_edescs = tso_count_edescs(skb); | ||
| 1579 | |||
| 1580 | local_irq_save(irqflags); | ||
| 1581 | |||
| 1582 | /* Try to acquire a completion entry and an egress slot. */ | ||
| 1583 | slot = tile_net_equeue_try_reserve(dev, comps, equeue, num_edescs); | ||
| 1584 | if (slot < 0) { | ||
| 1585 | local_irq_restore(irqflags); | ||
| 1586 | return NETDEV_TX_BUSY; | ||
| 1587 | } | ||
| 1588 | |||
| 1589 | /* Set up copies of header data properly. */ | ||
| 1590 | tso_headers_prepare(skb, egress->headers, slot); | ||
| 1591 | |||
| 1592 | /* Actually pass the data to the network hardware. */ | ||
| 1593 | tso_egress(dev, equeue, skb, egress->headers, slot); | ||
| 1594 | |||
| 1595 | /* Add a completion record. */ | ||
| 1596 | add_comp(equeue, comps, slot + num_edescs - 1, skb); | ||
| 1597 | |||
| 1598 | local_irq_restore(irqflags); | ||
| 1599 | |||
| 1600 | /* Make sure the egress timer is scheduled. */ | ||
| 1601 | tile_net_schedule_egress_timer(); | ||
| 1602 | |||
| 1603 | return NETDEV_TX_OK; | ||
| 1604 | } | ||
| 1605 | |||
| 1606 | /* Analyze the body and frags for a transmit request. */ | ||
| 1607 | static unsigned int tile_net_tx_frags(struct frag *frags, | ||
| 1608 | struct sk_buff *skb, | ||
| 1609 | void *b_data, unsigned int b_len) | ||
| 1610 | { | ||
| 1611 | unsigned int i, n = 0; | ||
| 1612 | |||
| 1613 | struct skb_shared_info *sh = skb_shinfo(skb); | ||
| 1614 | |||
| 1615 | if (b_len != 0) { | ||
| 1616 | frags[n].buf = b_data; | ||
| 1617 | frags[n++].length = b_len; | ||
| 1618 | } | ||
| 1619 | |||
| 1620 | for (i = 0; i < sh->nr_frags; i++) { | ||
| 1621 | skb_frag_t *f = &sh->frags[i]; | ||
| 1622 | frags[n].buf = tile_net_frag_buf(f); | ||
| 1623 | frags[n++].length = skb_frag_size(f); | ||
| 1624 | } | ||
| 1625 | |||
| 1626 | return n; | ||
| 1627 | } | ||
| 1628 | |||
| 1629 | /* Help the kernel transmit a packet. */ | ||
| 1630 | static int tile_net_tx(struct sk_buff *skb, struct net_device *dev) | ||
| 1631 | { | ||
| 1632 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 1633 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 1634 | struct tile_net_egress *egress = &egress_for_echannel[priv->echannel]; | ||
| 1635 | gxio_mpipe_equeue_t *equeue = egress->equeue; | ||
| 1636 | struct tile_net_comps *comps = | ||
| 1637 | info->comps_for_echannel[priv->echannel]; | ||
| 1638 | unsigned int len = skb->len; | ||
| 1639 | unsigned char *data = skb->data; | ||
| 1640 | unsigned int num_edescs; | ||
| 1641 | struct frag frags[MAX_FRAGS]; | ||
| 1642 | gxio_mpipe_edesc_t edescs[MAX_FRAGS]; | ||
| 1643 | unsigned long irqflags; | ||
| 1644 | gxio_mpipe_edesc_t edesc = { { 0 } }; | ||
| 1645 | unsigned int i; | ||
| 1646 | s64 slot; | ||
| 1647 | |||
| 1648 | if (skb_is_gso(skb)) | ||
| 1649 | return tile_net_tx_tso(skb, dev); | ||
| 1650 | |||
| 1651 | num_edescs = tile_net_tx_frags(frags, skb, data, skb_headlen(skb)); | ||
| 1652 | |||
| 1653 | /* This is only used to specify the TLB. */ | ||
| 1654 | edesc.stack_idx = large_buffer_stack; | ||
| 1655 | |||
| 1656 | /* Prepare the edescs. */ | ||
| 1657 | for (i = 0; i < num_edescs; i++) { | ||
| 1658 | edesc.xfer_size = frags[i].length; | ||
| 1659 | edesc.va = va_to_tile_io_addr(frags[i].buf); | ||
| 1660 | edescs[i] = edesc; | ||
| 1661 | } | ||
| 1662 | |||
| 1663 | /* Mark the final edesc. */ | ||
| 1664 | edescs[num_edescs - 1].bound = 1; | ||
| 1665 | |||
| 1666 | /* Add checksum info to the initial edesc, if needed. */ | ||
| 1667 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | ||
| 1668 | unsigned int csum_start = skb_checksum_start_offset(skb); | ||
| 1669 | edescs[0].csum = 1; | ||
| 1670 | edescs[0].csum_start = csum_start; | ||
| 1671 | edescs[0].csum_dest = csum_start + skb->csum_offset; | ||
| 1672 | } | ||
| 1673 | |||
| 1674 | local_irq_save(irqflags); | ||
| 1675 | |||
| 1676 | /* Try to acquire a completion entry and an egress slot. */ | ||
| 1677 | slot = tile_net_equeue_try_reserve(dev, comps, equeue, num_edescs); | ||
| 1678 | if (slot < 0) { | ||
| 1679 | local_irq_restore(irqflags); | ||
| 1680 | return NETDEV_TX_BUSY; | ||
| 1681 | } | ||
| 1682 | |||
| 1683 | for (i = 0; i < num_edescs; i++) | ||
| 1684 | gxio_mpipe_equeue_put_at(equeue, edescs[i], slot++); | ||
| 1685 | |||
| 1686 | /* Add a completion record. */ | ||
| 1687 | add_comp(equeue, comps, slot - 1, skb); | ||
| 1688 | |||
| 1689 | /* NOTE: Use ETH_ZLEN for short packets (e.g. 42 < 60). */ | ||
| 1690 | tile_net_stats_add(1, &priv->stats.tx_packets); | ||
| 1691 | tile_net_stats_add(max_t(unsigned int, len, ETH_ZLEN), | ||
| 1692 | &priv->stats.tx_bytes); | ||
| 1693 | |||
| 1694 | local_irq_restore(irqflags); | ||
| 1695 | |||
| 1696 | /* Make sure the egress timer is scheduled. */ | ||
| 1697 | tile_net_schedule_egress_timer(); | ||
| 1698 | |||
| 1699 | return NETDEV_TX_OK; | ||
| 1700 | } | ||
| 1701 | |||
| 1702 | /* Return subqueue id on this core (one per core). */ | ||
| 1703 | static u16 tile_net_select_queue(struct net_device *dev, struct sk_buff *skb) | ||
| 1704 | { | ||
| 1705 | return smp_processor_id(); | ||
| 1706 | } | ||
| 1707 | |||
| 1708 | /* Deal with a transmit timeout. */ | ||
| 1709 | static void tile_net_tx_timeout(struct net_device *dev) | ||
| 1710 | { | ||
| 1711 | int cpu; | ||
| 1712 | |||
| 1713 | for_each_online_cpu(cpu) | ||
| 1714 | netif_wake_subqueue(dev, cpu); | ||
| 1715 | } | ||
| 1716 | |||
| 1717 | /* Ioctl commands. */ | ||
| 1718 | static int tile_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | ||
| 1719 | { | ||
| 1720 | return -EOPNOTSUPP; | ||
| 1721 | } | ||
| 1722 | |||
| 1723 | /* Get system network statistics for device. */ | ||
| 1724 | static struct net_device_stats *tile_net_get_stats(struct net_device *dev) | ||
| 1725 | { | ||
| 1726 | struct tile_net_priv *priv = netdev_priv(dev); | ||
| 1727 | return &priv->stats; | ||
| 1728 | } | ||
| 1729 | |||
| 1730 | /* Change the MTU. */ | ||
| 1731 | static int tile_net_change_mtu(struct net_device *dev, int new_mtu) | ||
| 1732 | { | ||
| 1733 | if ((new_mtu < 68) || (new_mtu > 1500)) | ||
| 1734 | return -EINVAL; | ||
| 1735 | dev->mtu = new_mtu; | ||
| 1736 | return 0; | ||
| 1737 | } | ||
| 1738 | |||
| 1739 | /* Change the Ethernet address of the NIC. | ||
| 1740 | * | ||
| 1741 | * The hypervisor driver does not support changing MAC address. However, | ||
| 1742 | * the hardware does not do anything with the MAC address, so the address | ||
| 1743 | * which gets used on outgoing packets, and which is accepted on incoming | ||
| 1744 | * packets, is completely up to us. | ||
| 1745 | * | ||
| 1746 | * Returns 0 on success, negative on failure. | ||
| 1747 | */ | ||
| 1748 | static int tile_net_set_mac_address(struct net_device *dev, void *p) | ||
| 1749 | { | ||
| 1750 | struct sockaddr *addr = p; | ||
| 1751 | |||
| 1752 | if (!is_valid_ether_addr(addr->sa_data)) | ||
| 1753 | return -EINVAL; | ||
| 1754 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | ||
| 1755 | return 0; | ||
| 1756 | } | ||
| 1757 | |||
| 1758 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 1759 | /* Polling 'interrupt' - used by things like netconsole to send skbs | ||
| 1760 | * without having to re-enable interrupts. It's not called while | ||
| 1761 | * the interrupt routine is executing. | ||
| 1762 | */ | ||
| 1763 | static void tile_net_netpoll(struct net_device *dev) | ||
| 1764 | { | ||
| 1765 | disable_percpu_irq(ingress_irq); | ||
| 1766 | tile_net_handle_ingress_irq(ingress_irq, NULL); | ||
| 1767 | enable_percpu_irq(ingress_irq, 0); | ||
| 1768 | } | ||
| 1769 | #endif | ||
| 1770 | |||
| 1771 | static const struct net_device_ops tile_net_ops = { | ||
| 1772 | .ndo_open = tile_net_open, | ||
| 1773 | .ndo_stop = tile_net_stop, | ||
| 1774 | .ndo_start_xmit = tile_net_tx, | ||
| 1775 | .ndo_select_queue = tile_net_select_queue, | ||
| 1776 | .ndo_do_ioctl = tile_net_ioctl, | ||
| 1777 | .ndo_get_stats = tile_net_get_stats, | ||
| 1778 | .ndo_change_mtu = tile_net_change_mtu, | ||
| 1779 | .ndo_tx_timeout = tile_net_tx_timeout, | ||
| 1780 | .ndo_set_mac_address = tile_net_set_mac_address, | ||
| 1781 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
| 1782 | .ndo_poll_controller = tile_net_netpoll, | ||
| 1783 | #endif | ||
| 1784 | }; | ||
| 1785 | |||
| 1786 | /* The setup function. | ||
| 1787 | * | ||
| 1788 | * This uses ether_setup() to assign various fields in dev, including | ||
| 1789 | * setting IFF_BROADCAST and IFF_MULTICAST, then sets some extra fields. | ||
| 1790 | */ | ||
| 1791 | static void tile_net_setup(struct net_device *dev) | ||
| 1792 | { | ||
| 1793 | ether_setup(dev); | ||
| 1794 | dev->netdev_ops = &tile_net_ops; | ||
| 1795 | dev->watchdog_timeo = TILE_NET_TIMEOUT; | ||
| 1796 | dev->features |= NETIF_F_LLTX; | ||
| 1797 | dev->features |= NETIF_F_HW_CSUM; | ||
| 1798 | dev->features |= NETIF_F_SG; | ||
| 1799 | dev->features |= NETIF_F_TSO; | ||
| 1800 | dev->mtu = 1500; | ||
| 1801 | } | ||
| 1802 | |||
| 1803 | /* Allocate the device structure, register the device, and obtain the | ||
| 1804 | * MAC address from the hypervisor. | ||
| 1805 | */ | ||
| 1806 | static void tile_net_dev_init(const char *name, const uint8_t *mac) | ||
| 1807 | { | ||
| 1808 | int ret; | ||
| 1809 | int i; | ||
| 1810 | int nz_addr = 0; | ||
| 1811 | struct net_device *dev; | ||
| 1812 | struct tile_net_priv *priv; | ||
| 1813 | |||
| 1814 | /* HACK: Ignore "loop" links. */ | ||
| 1815 | if (strncmp(name, "loop", 4) == 0) | ||
| 1816 | return; | ||
| 1817 | |||
| 1818 | /* Allocate the device structure. Normally, "name" is a | ||
| 1819 | * template, instantiated by register_netdev(), but not for us. | ||
| 1820 | */ | ||
| 1821 | dev = alloc_netdev_mqs(sizeof(*priv), name, tile_net_setup, | ||
| 1822 | NR_CPUS, 1); | ||
| 1823 | if (!dev) { | ||
| 1824 | pr_err("alloc_netdev_mqs(%s) failed\n", name); | ||
| 1825 | return; | ||
| 1826 | } | ||
| 1827 | |||
| 1828 | /* Initialize "priv". */ | ||
| 1829 | priv = netdev_priv(dev); | ||
| 1830 | memset(priv, 0, sizeof(*priv)); | ||
| 1831 | priv->dev = dev; | ||
| 1832 | priv->channel = -1; | ||
| 1833 | priv->loopify_channel = -1; | ||
| 1834 | priv->echannel = -1; | ||
| 1835 | |||
| 1836 | /* Get the MAC address and set it in the device struct; this must | ||
| 1837 | * be done before the device is opened. If the MAC is all zeroes, | ||
| 1838 | * we use a random address, since we're probably on the simulator. | ||
| 1839 | */ | ||
| 1840 | for (i = 0; i < 6; i++) | ||
| 1841 | nz_addr |= mac[i]; | ||
| 1842 | |||
| 1843 | if (nz_addr) { | ||
| 1844 | memcpy(dev->dev_addr, mac, 6); | ||
| 1845 | dev->addr_len = 6; | ||
| 1846 | } else { | ||
| 1847 | random_ether_addr(dev->dev_addr); | ||
| 1848 | } | ||
| 1849 | |||
| 1850 | /* Register the network device. */ | ||
| 1851 | ret = register_netdev(dev); | ||
| 1852 | if (ret) { | ||
| 1853 | netdev_err(dev, "register_netdev failed %d\n", ret); | ||
| 1854 | free_netdev(dev); | ||
| 1855 | return; | ||
| 1856 | } | ||
| 1857 | } | ||
| 1858 | |||
| 1859 | /* Per-cpu module initialization. */ | ||
| 1860 | static void tile_net_init_module_percpu(void *unused) | ||
| 1861 | { | ||
| 1862 | struct tile_net_info *info = &__get_cpu_var(per_cpu_info); | ||
| 1863 | int my_cpu = smp_processor_id(); | ||
| 1864 | |||
| 1865 | info->has_iqueue = false; | ||
| 1866 | |||
| 1867 | info->my_cpu = my_cpu; | ||
| 1868 | |||
| 1869 | /* Initialize the egress timer. */ | ||
| 1870 | hrtimer_init(&info->egress_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
| 1871 | info->egress_timer.function = tile_net_handle_egress_timer; | ||
| 1872 | } | ||
| 1873 | |||
| 1874 | /* Module initialization. */ | ||
| 1875 | static int __init tile_net_init_module(void) | ||
| 1876 | { | ||
| 1877 | int i; | ||
| 1878 | char name[GXIO_MPIPE_LINK_NAME_LEN]; | ||
| 1879 | uint8_t mac[6]; | ||
| 1880 | |||
| 1881 | pr_info("Tilera Network Driver\n"); | ||
| 1882 | |||
| 1883 | mutex_init(&tile_net_devs_for_channel_mutex); | ||
| 1884 | |||
| 1885 | /* Initialize each CPU. */ | ||
| 1886 | on_each_cpu(tile_net_init_module_percpu, NULL, 1); | ||
| 1887 | |||
| 1888 | /* Find out what devices we have, and initialize them. */ | ||
| 1889 | for (i = 0; gxio_mpipe_link_enumerate_mac(i, name, mac) >= 0; i++) | ||
| 1890 | tile_net_dev_init(name, mac); | ||
| 1891 | |||
| 1892 | if (!network_cpus_init()) | ||
| 1893 | network_cpus_map = *cpu_online_mask; | ||
| 1894 | |||
| 1895 | return 0; | ||
| 1896 | } | ||
| 1897 | |||
| 1898 | module_init(tile_net_init_module); | ||
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h index 4ffcd57b011b..2857ab078aac 100644 --- a/drivers/net/hyperv/hyperv_net.h +++ b/drivers/net/hyperv/hyperv_net.h | |||
| @@ -478,6 +478,7 @@ struct netvsc_device { | |||
| 478 | u32 nvsp_version; | 478 | u32 nvsp_version; |
| 479 | 479 | ||
| 480 | atomic_t num_outstanding_sends; | 480 | atomic_t num_outstanding_sends; |
| 481 | wait_queue_head_t wait_drain; | ||
| 481 | bool start_remove; | 482 | bool start_remove; |
| 482 | bool destroy; | 483 | bool destroy; |
| 483 | /* | 484 | /* |
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 8b919471472f..0c569831db5a 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c | |||
| @@ -42,6 +42,7 @@ static struct netvsc_device *alloc_net_device(struct hv_device *device) | |||
| 42 | if (!net_device) | 42 | if (!net_device) |
| 43 | return NULL; | 43 | return NULL; |
| 44 | 44 | ||
| 45 | init_waitqueue_head(&net_device->wait_drain); | ||
| 45 | net_device->start_remove = false; | 46 | net_device->start_remove = false; |
| 46 | net_device->destroy = false; | 47 | net_device->destroy = false; |
| 47 | net_device->dev = device; | 48 | net_device->dev = device; |
| @@ -387,12 +388,8 @@ int netvsc_device_remove(struct hv_device *device) | |||
| 387 | spin_unlock_irqrestore(&device->channel->inbound_lock, flags); | 388 | spin_unlock_irqrestore(&device->channel->inbound_lock, flags); |
| 388 | 389 | ||
| 389 | /* Wait for all send completions */ | 390 | /* Wait for all send completions */ |
| 390 | while (atomic_read(&net_device->num_outstanding_sends)) { | 391 | wait_event(net_device->wait_drain, |
| 391 | dev_info(&device->device, | 392 | atomic_read(&net_device->num_outstanding_sends) == 0); |
| 392 | "waiting for %d requests to complete...\n", | ||
| 393 | atomic_read(&net_device->num_outstanding_sends)); | ||
| 394 | udelay(100); | ||
| 395 | } | ||
| 396 | 393 | ||
| 397 | netvsc_disconnect_vsp(net_device); | 394 | netvsc_disconnect_vsp(net_device); |
| 398 | 395 | ||
| @@ -486,6 +483,9 @@ static void netvsc_send_completion(struct hv_device *device, | |||
| 486 | num_outstanding_sends = | 483 | num_outstanding_sends = |
| 487 | atomic_dec_return(&net_device->num_outstanding_sends); | 484 | atomic_dec_return(&net_device->num_outstanding_sends); |
| 488 | 485 | ||
| 486 | if (net_device->destroy && num_outstanding_sends == 0) | ||
| 487 | wake_up(&net_device->wait_drain); | ||
| 488 | |||
| 489 | if (netif_queue_stopped(ndev) && !net_device->start_remove && | 489 | if (netif_queue_stopped(ndev) && !net_device->start_remove && |
| 490 | (hv_ringbuf_avail_percent(&device->channel->outbound) | 490 | (hv_ringbuf_avail_percent(&device->channel->outbound) |
| 491 | > RING_AVAIL_PERCENT_HIWATER || | 491 | > RING_AVAIL_PERCENT_HIWATER || |
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index 5ac46f5226f3..47f8e8939266 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
| @@ -41,6 +41,8 @@ MODULE_LICENSE("GPL"); | |||
| 41 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ | 41 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ |
| 42 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ | 42 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ |
| 43 | #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ | 43 | #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ |
| 44 | #define IP101A_G_IRQ_PIN_USED (1<<15) /* INTR pin used */ | ||
| 45 | #define IP101A_G_IRQ_DEFAULT IP101A_G_IRQ_PIN_USED | ||
| 44 | 46 | ||
| 45 | static int ip175c_config_init(struct phy_device *phydev) | 47 | static int ip175c_config_init(struct phy_device *phydev) |
| 46 | { | 48 | { |
| @@ -136,6 +138,11 @@ static int ip1001_config_init(struct phy_device *phydev) | |||
| 136 | if (c < 0) | 138 | if (c < 0) |
| 137 | return c; | 139 | return c; |
| 138 | 140 | ||
| 141 | /* INTR pin used: speed/link/duplex will cause an interrupt */ | ||
| 142 | c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT); | ||
| 143 | if (c < 0) | ||
| 144 | return c; | ||
| 145 | |||
| 139 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { | 146 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { |
| 140 | /* Additional delay (2ns) used to adjust RX clock phase | 147 | /* Additional delay (2ns) used to adjust RX clock phase |
| 141 | * at RGMII interface */ | 148 | * at RGMII interface */ |
diff --git a/drivers/net/phy/mdio-mux.c b/drivers/net/phy/mdio-mux.c index 39ea0674dcde..5c120189ec86 100644 --- a/drivers/net/phy/mdio-mux.c +++ b/drivers/net/phy/mdio-mux.c | |||
| @@ -46,7 +46,13 @@ static int mdio_mux_read(struct mii_bus *bus, int phy_id, int regnum) | |||
| 46 | struct mdio_mux_parent_bus *pb = cb->parent; | 46 | struct mdio_mux_parent_bus *pb = cb->parent; |
| 47 | int r; | 47 | int r; |
| 48 | 48 | ||
| 49 | mutex_lock(&pb->mii_bus->mdio_lock); | 49 | /* In theory multiple mdio_mux could be stacked, thus creating |
| 50 | * more than a single level of nesting. But in practice, | ||
| 51 | * SINGLE_DEPTH_NESTING will cover the vast majority of use | ||
| 52 | * cases. We use it, instead of trying to handle the general | ||
| 53 | * case. | ||
| 54 | */ | ||
| 55 | mutex_lock_nested(&pb->mii_bus->mdio_lock, SINGLE_DEPTH_NESTING); | ||
| 50 | r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); | 56 | r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); |
| 51 | if (r) | 57 | if (r) |
| 52 | goto out; | 58 | goto out; |
| @@ -71,7 +77,7 @@ static int mdio_mux_write(struct mii_bus *bus, int phy_id, | |||
| 71 | 77 | ||
| 72 | int r; | 78 | int r; |
| 73 | 79 | ||
| 74 | mutex_lock(&pb->mii_bus->mdio_lock); | 80 | mutex_lock_nested(&pb->mii_bus->mdio_lock, SINGLE_DEPTH_NESTING); |
| 75 | r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); | 81 | r = pb->switch_fn(pb->current_child, cb->bus_number, pb->switch_data); |
| 76 | if (r) | 82 | if (r) |
| 77 | goto out; | 83 | goto out; |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 683ef1ce5519..5061608f408c 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
| @@ -96,7 +96,7 @@ static int of_mdio_bus_match(struct device *dev, void *mdio_bus_np) | |||
| 96 | } | 96 | } |
| 97 | /** | 97 | /** |
| 98 | * of_mdio_find_bus - Given an mii_bus node, find the mii_bus. | 98 | * of_mdio_find_bus - Given an mii_bus node, find the mii_bus. |
| 99 | * @mdio_np: Pointer to the mii_bus. | 99 | * @mdio_bus_np: Pointer to the mii_bus. |
| 100 | * | 100 | * |
| 101 | * Returns a pointer to the mii_bus, or NULL if none found. | 101 | * Returns a pointer to the mii_bus, or NULL if none found. |
| 102 | * | 102 | * |
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 590f902deb6b..9d6c80c8a0cf 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c | |||
| @@ -161,7 +161,7 @@ static struct phy_driver ks8051_driver = { | |||
| 161 | static struct phy_driver ks8001_driver = { | 161 | static struct phy_driver ks8001_driver = { |
| 162 | .phy_id = PHY_ID_KS8001, | 162 | .phy_id = PHY_ID_KS8001, |
| 163 | .name = "Micrel KS8001 or KS8721", | 163 | .name = "Micrel KS8001 or KS8721", |
| 164 | .phy_id_mask = 0x00fffff0, | 164 | .phy_id_mask = 0x00ffffff, |
| 165 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), | 165 | .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), |
| 166 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, | 166 | .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, |
| 167 | .config_init = kszphy_config_init, | 167 | .config_init = kszphy_config_init, |
| @@ -174,7 +174,7 @@ static struct phy_driver ks8001_driver = { | |||
| 174 | 174 | ||
| 175 | static struct phy_driver ksz9021_driver = { | 175 | static struct phy_driver ksz9021_driver = { |
| 176 | .phy_id = PHY_ID_KSZ9021, | 176 | .phy_id = PHY_ID_KSZ9021, |
| 177 | .phy_id_mask = 0x000fff10, | 177 | .phy_id_mask = 0x000ffffe, |
| 178 | .name = "Micrel KSZ9021 Gigabit PHY", | 178 | .name = "Micrel KSZ9021 Gigabit PHY", |
| 179 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause | 179 | .features = (PHY_GBIT_FEATURES | SUPPORTED_Pause |
| 180 | | SUPPORTED_Asym_Pause), | 180 | | SUPPORTED_Asym_Pause), |
| @@ -240,8 +240,8 @@ MODULE_AUTHOR("David J. Choi"); | |||
| 240 | MODULE_LICENSE("GPL"); | 240 | MODULE_LICENSE("GPL"); |
| 241 | 241 | ||
| 242 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { | 242 | static struct mdio_device_id __maybe_unused micrel_tbl[] = { |
| 243 | { PHY_ID_KSZ9021, 0x000fff10 }, | 243 | { PHY_ID_KSZ9021, 0x000ffffe }, |
| 244 | { PHY_ID_KS8001, 0x00fffff0 }, | 244 | { PHY_ID_KS8001, 0x00ffffff }, |
| 245 | { PHY_ID_KS8737, 0x00fffff0 }, | 245 | { PHY_ID_KS8737, 0x00fffff0 }, |
| 246 | { PHY_ID_KS8041, 0x00fffff0 }, | 246 | { PHY_ID_KS8041, 0x00fffff0 }, |
| 247 | { PHY_ID_KS8051, 0x00fffff0 }, | 247 | { PHY_ID_KS8051, 0x00fffff0 }, |
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 964031e3da87..a28a983d465e 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | #define USB_PRODUCT_IPHONE_3G 0x1292 | 59 | #define USB_PRODUCT_IPHONE_3G 0x1292 |
| 60 | #define USB_PRODUCT_IPHONE_3GS 0x1294 | 60 | #define USB_PRODUCT_IPHONE_3GS 0x1294 |
| 61 | #define USB_PRODUCT_IPHONE_4 0x1297 | 61 | #define USB_PRODUCT_IPHONE_4 0x1297 |
| 62 | #define USB_PRODUCT_IPAD 0x129a | ||
| 62 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c | 63 | #define USB_PRODUCT_IPHONE_4_VZW 0x129c |
| 63 | #define USB_PRODUCT_IPHONE_4S 0x12a0 | 64 | #define USB_PRODUCT_IPHONE_4S 0x12a0 |
| 64 | 65 | ||
| @@ -101,6 +102,10 @@ static struct usb_device_id ipheth_table[] = { | |||
| 101 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | 102 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, |
| 102 | IPHETH_USBINTF_PROTO) }, | 103 | IPHETH_USBINTF_PROTO) }, |
| 103 | { USB_DEVICE_AND_INTERFACE_INFO( | 104 | { USB_DEVICE_AND_INTERFACE_INFO( |
| 105 | USB_VENDOR_APPLE, USB_PRODUCT_IPAD, | ||
| 106 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | ||
| 107 | IPHETH_USBINTF_PROTO) }, | ||
| 108 | { USB_DEVICE_AND_INTERFACE_INFO( | ||
| 104 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW, | 109 | USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW, |
| 105 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, | 110 | IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, |
| 106 | IPHETH_USBINTF_PROTO) }, | 111 | IPHETH_USBINTF_PROTO) }, |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 3b206786b5e7..a051cedd64bd 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
| @@ -197,6 +197,10 @@ err: | |||
| 197 | static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) | 197 | static int qmi_wwan_cdc_wdm_manage_power(struct usb_interface *intf, int on) |
| 198 | { | 198 | { |
| 199 | struct usbnet *dev = usb_get_intfdata(intf); | 199 | struct usbnet *dev = usb_get_intfdata(intf); |
| 200 | |||
| 201 | /* can be called while disconnecting */ | ||
| 202 | if (!dev) | ||
| 203 | return 0; | ||
| 200 | return qmi_wwan_manage_power(dev, on); | 204 | return qmi_wwan_manage_power(dev, on); |
| 201 | } | 205 | } |
| 202 | 206 | ||
| @@ -257,29 +261,6 @@ err: | |||
| 257 | return rv; | 261 | return rv; |
| 258 | } | 262 | } |
| 259 | 263 | ||
| 260 | /* Gobi devices uses identical class/protocol codes for all interfaces regardless | ||
| 261 | * of function. Some of these are CDC ACM like and have the exact same endpoints | ||
| 262 | * we are looking for. This leaves two possible strategies for identifying the | ||
| 263 | * correct interface: | ||
| 264 | * a) hardcoding interface number, or | ||
| 265 | * b) use the fact that the wwan interface is the only one lacking additional | ||
| 266 | * (CDC functional) descriptors | ||
| 267 | * | ||
| 268 | * Let's see if we can get away with the generic b) solution. | ||
| 269 | */ | ||
| 270 | static int qmi_wwan_bind_gobi(struct usbnet *dev, struct usb_interface *intf) | ||
| 271 | { | ||
| 272 | int rv = -EINVAL; | ||
| 273 | |||
| 274 | /* ignore any interface with additional descriptors */ | ||
| 275 | if (intf->cur_altsetting->extralen) | ||
| 276 | goto err; | ||
| 277 | |||
| 278 | rv = qmi_wwan_bind_shared(dev, intf); | ||
| 279 | err: | ||
| 280 | return rv; | ||
| 281 | } | ||
| 282 | |||
| 283 | static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf) | 264 | static void qmi_wwan_unbind_shared(struct usbnet *dev, struct usb_interface *intf) |
| 284 | { | 265 | { |
| 285 | struct usb_driver *subdriver = (void *)dev->data[0]; | 266 | struct usb_driver *subdriver = (void *)dev->data[0]; |
| @@ -347,15 +328,15 @@ static const struct driver_info qmi_wwan_shared = { | |||
| 347 | .manage_power = qmi_wwan_manage_power, | 328 | .manage_power = qmi_wwan_manage_power, |
| 348 | }; | 329 | }; |
| 349 | 330 | ||
| 350 | static const struct driver_info qmi_wwan_gobi = { | 331 | static const struct driver_info qmi_wwan_force_int0 = { |
| 351 | .description = "Qualcomm Gobi wwan/QMI device", | 332 | .description = "Qualcomm WWAN/QMI device", |
| 352 | .flags = FLAG_WWAN, | 333 | .flags = FLAG_WWAN, |
| 353 | .bind = qmi_wwan_bind_gobi, | 334 | .bind = qmi_wwan_bind_shared, |
| 354 | .unbind = qmi_wwan_unbind_shared, | 335 | .unbind = qmi_wwan_unbind_shared, |
| 355 | .manage_power = qmi_wwan_manage_power, | 336 | .manage_power = qmi_wwan_manage_power, |
| 337 | .data = BIT(0), /* interface whitelist bitmap */ | ||
| 356 | }; | 338 | }; |
| 357 | 339 | ||
| 358 | /* ZTE suck at making USB descriptors */ | ||
| 359 | static const struct driver_info qmi_wwan_force_int1 = { | 340 | static const struct driver_info qmi_wwan_force_int1 = { |
| 360 | .description = "Qualcomm WWAN/QMI device", | 341 | .description = "Qualcomm WWAN/QMI device", |
| 361 | .flags = FLAG_WWAN, | 342 | .flags = FLAG_WWAN, |
| @@ -365,6 +346,24 @@ static const struct driver_info qmi_wwan_force_int1 = { | |||
| 365 | .data = BIT(1), /* interface whitelist bitmap */ | 346 | .data = BIT(1), /* interface whitelist bitmap */ |
| 366 | }; | 347 | }; |
| 367 | 348 | ||
| 349 | static const struct driver_info qmi_wwan_force_int2 = { | ||
| 350 | .description = "Qualcomm WWAN/QMI device", | ||
| 351 | .flags = FLAG_WWAN, | ||
| 352 | .bind = qmi_wwan_bind_shared, | ||
| 353 | .unbind = qmi_wwan_unbind_shared, | ||
| 354 | .manage_power = qmi_wwan_manage_power, | ||
| 355 | .data = BIT(2), /* interface whitelist bitmap */ | ||
| 356 | }; | ||
| 357 | |||
| 358 | static const struct driver_info qmi_wwan_force_int3 = { | ||
| 359 | .description = "Qualcomm WWAN/QMI device", | ||
| 360 | .flags = FLAG_WWAN, | ||
| 361 | .bind = qmi_wwan_bind_shared, | ||
| 362 | .unbind = qmi_wwan_unbind_shared, | ||
| 363 | .manage_power = qmi_wwan_manage_power, | ||
| 364 | .data = BIT(3), /* interface whitelist bitmap */ | ||
| 365 | }; | ||
| 366 | |||
| 368 | static const struct driver_info qmi_wwan_force_int4 = { | 367 | static const struct driver_info qmi_wwan_force_int4 = { |
| 369 | .description = "Qualcomm WWAN/QMI device", | 368 | .description = "Qualcomm WWAN/QMI device", |
| 370 | .flags = FLAG_WWAN, | 369 | .flags = FLAG_WWAN, |
| @@ -390,16 +389,23 @@ static const struct driver_info qmi_wwan_force_int4 = { | |||
| 390 | static const struct driver_info qmi_wwan_sierra = { | 389 | static const struct driver_info qmi_wwan_sierra = { |
| 391 | .description = "Sierra Wireless wwan/QMI device", | 390 | .description = "Sierra Wireless wwan/QMI device", |
| 392 | .flags = FLAG_WWAN, | 391 | .flags = FLAG_WWAN, |
| 393 | .bind = qmi_wwan_bind_gobi, | 392 | .bind = qmi_wwan_bind_shared, |
| 394 | .unbind = qmi_wwan_unbind_shared, | 393 | .unbind = qmi_wwan_unbind_shared, |
| 395 | .manage_power = qmi_wwan_manage_power, | 394 | .manage_power = qmi_wwan_manage_power, |
| 396 | .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ | 395 | .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ |
| 397 | }; | 396 | }; |
| 398 | 397 | ||
| 399 | #define HUAWEI_VENDOR_ID 0x12D1 | 398 | #define HUAWEI_VENDOR_ID 0x12D1 |
| 399 | |||
| 400 | /* Gobi 1000 QMI/wwan interface number is 3 according to qcserial */ | ||
| 401 | #define QMI_GOBI1K_DEVICE(vend, prod) \ | ||
| 402 | USB_DEVICE(vend, prod), \ | ||
| 403 | .driver_info = (unsigned long)&qmi_wwan_force_int3 | ||
| 404 | |||
| 405 | /* Gobi 2000 and Gobi 3000 QMI/wwan interface number is 0 according to qcserial */ | ||
| 400 | #define QMI_GOBI_DEVICE(vend, prod) \ | 406 | #define QMI_GOBI_DEVICE(vend, prod) \ |
| 401 | USB_DEVICE(vend, prod), \ | 407 | USB_DEVICE(vend, prod), \ |
| 402 | .driver_info = (unsigned long)&qmi_wwan_gobi | 408 | .driver_info = (unsigned long)&qmi_wwan_force_int0 |
| 403 | 409 | ||
| 404 | static const struct usb_device_id products[] = { | 410 | static const struct usb_device_id products[] = { |
| 405 | { /* Huawei E392, E398 and possibly others sharing both device id and more... */ | 411 | { /* Huawei E392, E398 and possibly others sharing both device id and more... */ |
| @@ -501,6 +507,15 @@ static const struct usb_device_id products[] = { | |||
| 501 | .bInterfaceProtocol = 0xff, | 507 | .bInterfaceProtocol = 0xff, |
| 502 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | 508 | .driver_info = (unsigned long)&qmi_wwan_force_int4, |
| 503 | }, | 509 | }, |
| 510 | { /* ZTE MF60 */ | ||
| 511 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
| 512 | .idVendor = 0x19d2, | ||
| 513 | .idProduct = 0x1402, | ||
| 514 | .bInterfaceClass = 0xff, | ||
| 515 | .bInterfaceSubClass = 0xff, | ||
| 516 | .bInterfaceProtocol = 0xff, | ||
| 517 | .driver_info = (unsigned long)&qmi_wwan_force_int2, | ||
| 518 | }, | ||
| 504 | { /* Sierra Wireless MC77xx in QMI mode */ | 519 | { /* Sierra Wireless MC77xx in QMI mode */ |
| 505 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | 520 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, |
| 506 | .idVendor = 0x1199, | 521 | .idVendor = 0x1199, |
| @@ -510,20 +525,24 @@ static const struct usb_device_id products[] = { | |||
| 510 | .bInterfaceProtocol = 0xff, | 525 | .bInterfaceProtocol = 0xff, |
| 511 | .driver_info = (unsigned long)&qmi_wwan_sierra, | 526 | .driver_info = (unsigned long)&qmi_wwan_sierra, |
| 512 | }, | 527 | }, |
| 513 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 528 | |
| 514 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ | 529 | /* Gobi 1000 devices */ |
| 515 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ | 530 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
| 516 | {QMI_GOBI_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ | 531 | {QMI_GOBI1K_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
| 517 | {QMI_GOBI_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ | 532 | {QMI_GOBI1K_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
| 518 | {QMI_GOBI_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ | 533 | {QMI_GOBI1K_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ |
| 519 | {QMI_GOBI_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ | 534 | {QMI_GOBI1K_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ |
| 520 | {QMI_GOBI_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ | 535 | {QMI_GOBI1K_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ |
| 521 | {QMI_GOBI_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ | 536 | {QMI_GOBI1K_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ |
| 522 | {QMI_GOBI_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ | 537 | {QMI_GOBI1K_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ |
| 523 | {QMI_GOBI_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ | 538 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ |
| 524 | {QMI_GOBI_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ | 539 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ |
| 525 | {QMI_GOBI_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ | 540 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ |
| 526 | {QMI_GOBI_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ | 541 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ |
| 542 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ | ||
| 543 | {QMI_GOBI1K_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ | ||
| 544 | |||
| 545 | /* Gobi 2000 and 3000 devices */ | ||
| 527 | {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ | 546 | {QMI_GOBI_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ |
| 528 | {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ | 547 | {QMI_GOBI_DEVICE(0x05c6, 0x920b)}, /* Generic Gobi 2000 Modem device */ |
| 529 | {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ | 548 | {QMI_GOBI_DEVICE(0x05c6, 0x9225)}, /* Sony Gobi 2000 Modem device (N0279, VU730) */ |
diff --git a/drivers/net/usb/sierra_net.c b/drivers/net/usb/sierra_net.c index 3faef5670d1f..d75d1f56becf 100644 --- a/drivers/net/usb/sierra_net.c +++ b/drivers/net/usb/sierra_net.c | |||
| @@ -946,7 +946,7 @@ struct sk_buff *sierra_net_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
| 946 | } | 946 | } |
| 947 | 947 | ||
| 948 | static const u8 sierra_net_ifnum_list[] = { 7, 10, 11 }; | 948 | static const u8 sierra_net_ifnum_list[] = { 7, 10, 11 }; |
| 949 | static const struct sierra_net_info_data sierra_net_info_data_68A3 = { | 949 | static const struct sierra_net_info_data sierra_net_info_data_direct_ip = { |
| 950 | .rx_urb_size = 8 * 1024, | 950 | .rx_urb_size = 8 * 1024, |
| 951 | .whitelist = { | 951 | .whitelist = { |
| 952 | .infolen = ARRAY_SIZE(sierra_net_ifnum_list), | 952 | .infolen = ARRAY_SIZE(sierra_net_ifnum_list), |
| @@ -954,7 +954,7 @@ static const struct sierra_net_info_data sierra_net_info_data_68A3 = { | |||
| 954 | } | 954 | } |
| 955 | }; | 955 | }; |
| 956 | 956 | ||
| 957 | static const struct driver_info sierra_net_info_68A3 = { | 957 | static const struct driver_info sierra_net_info_direct_ip = { |
| 958 | .description = "Sierra Wireless USB-to-WWAN Modem", | 958 | .description = "Sierra Wireless USB-to-WWAN Modem", |
| 959 | .flags = FLAG_WWAN | FLAG_SEND_ZLP, | 959 | .flags = FLAG_WWAN | FLAG_SEND_ZLP, |
| 960 | .bind = sierra_net_bind, | 960 | .bind = sierra_net_bind, |
| @@ -962,12 +962,18 @@ static const struct driver_info sierra_net_info_68A3 = { | |||
| 962 | .status = sierra_net_status, | 962 | .status = sierra_net_status, |
| 963 | .rx_fixup = sierra_net_rx_fixup, | 963 | .rx_fixup = sierra_net_rx_fixup, |
| 964 | .tx_fixup = sierra_net_tx_fixup, | 964 | .tx_fixup = sierra_net_tx_fixup, |
| 965 | .data = (unsigned long)&sierra_net_info_data_68A3, | 965 | .data = (unsigned long)&sierra_net_info_data_direct_ip, |
| 966 | }; | 966 | }; |
| 967 | 967 | ||
| 968 | static const struct usb_device_id products[] = { | 968 | static const struct usb_device_id products[] = { |
| 969 | {USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */ | 969 | {USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless USB-to-WWAN modem */ |
| 970 | .driver_info = (unsigned long) &sierra_net_info_68A3}, | 970 | .driver_info = (unsigned long) &sierra_net_info_direct_ip}, |
| 971 | {USB_DEVICE(0x0F3D, 0x68A3), /* AT&T Direct IP modem */ | ||
| 972 | .driver_info = (unsigned long) &sierra_net_info_direct_ip}, | ||
| 973 | {USB_DEVICE(0x1199, 0x68AA), /* Sierra Wireless Direct IP LTE modem */ | ||
| 974 | .driver_info = (unsigned long) &sierra_net_info_direct_ip}, | ||
| 975 | {USB_DEVICE(0x0F3D, 0x68AA), /* AT&T Direct IP LTE modem */ | ||
| 976 | .driver_info = (unsigned long) &sierra_net_info_direct_ip}, | ||
| 971 | 977 | ||
| 972 | {}, /* last item */ | 978 | {}, /* last item */ |
| 973 | }; | 979 | }; |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 9f58330f1312..aba769d77459 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
| @@ -796,11 +796,13 @@ int usbnet_open (struct net_device *net) | |||
| 796 | if (info->manage_power) { | 796 | if (info->manage_power) { |
| 797 | retval = info->manage_power(dev, 1); | 797 | retval = info->manage_power(dev, 1); |
| 798 | if (retval < 0) | 798 | if (retval < 0) |
| 799 | goto done; | 799 | goto done_manage_power_error; |
| 800 | usb_autopm_put_interface(dev->intf); | 800 | usb_autopm_put_interface(dev->intf); |
| 801 | } | 801 | } |
| 802 | return retval; | 802 | return retval; |
| 803 | 803 | ||
| 804 | done_manage_power_error: | ||
| 805 | clear_bit(EVENT_DEV_OPEN, &dev->flags); | ||
| 804 | done: | 806 | done: |
| 805 | usb_autopm_put_interface(dev->intf); | 807 | usb_autopm_put_interface(dev->intf); |
| 806 | done_nopm: | 808 | done_nopm: |
| @@ -876,9 +878,9 @@ void usbnet_get_drvinfo (struct net_device *net, struct ethtool_drvinfo *info) | |||
| 876 | { | 878 | { |
| 877 | struct usbnet *dev = netdev_priv(net); | 879 | struct usbnet *dev = netdev_priv(net); |
| 878 | 880 | ||
| 879 | strncpy (info->driver, dev->driver_name, sizeof info->driver); | 881 | strlcpy (info->driver, dev->driver_name, sizeof info->driver); |
| 880 | strncpy (info->version, DRIVER_VERSION, sizeof info->version); | 882 | strlcpy (info->version, DRIVER_VERSION, sizeof info->version); |
| 881 | strncpy (info->fw_version, dev->driver_info->description, | 883 | strlcpy (info->fw_version, dev->driver_info->description, |
| 882 | sizeof info->fw_version); | 884 | sizeof info->fw_version); |
| 883 | usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); | 885 | usb_make_path (dev->udev, info->bus_info, sizeof info->bus_info); |
| 884 | } | 886 | } |
| @@ -1202,6 +1204,21 @@ deferred: | |||
| 1202 | } | 1204 | } |
| 1203 | EXPORT_SYMBOL_GPL(usbnet_start_xmit); | 1205 | EXPORT_SYMBOL_GPL(usbnet_start_xmit); |
| 1204 | 1206 | ||
| 1207 | static void rx_alloc_submit(struct usbnet *dev, gfp_t flags) | ||
| 1208 | { | ||
| 1209 | struct urb *urb; | ||
| 1210 | int i; | ||
| 1211 | |||
| 1212 | /* don't refill the queue all at once */ | ||
| 1213 | for (i = 0; i < 10 && dev->rxq.qlen < RX_QLEN(dev); i++) { | ||
| 1214 | urb = usb_alloc_urb(0, flags); | ||
| 1215 | if (urb != NULL) { | ||
| 1216 | if (rx_submit(dev, urb, flags) == -ENOLINK) | ||
| 1217 | return; | ||
| 1218 | } | ||
| 1219 | } | ||
| 1220 | } | ||
| 1221 | |||
| 1205 | /*-------------------------------------------------------------------------*/ | 1222 | /*-------------------------------------------------------------------------*/ |
| 1206 | 1223 | ||
| 1207 | // tasklet (work deferred from completions, in_irq) or timer | 1224 | // tasklet (work deferred from completions, in_irq) or timer |
| @@ -1241,26 +1258,14 @@ static void usbnet_bh (unsigned long param) | |||
| 1241 | !timer_pending (&dev->delay) && | 1258 | !timer_pending (&dev->delay) && |
| 1242 | !test_bit (EVENT_RX_HALT, &dev->flags)) { | 1259 | !test_bit (EVENT_RX_HALT, &dev->flags)) { |
| 1243 | int temp = dev->rxq.qlen; | 1260 | int temp = dev->rxq.qlen; |
| 1244 | int qlen = RX_QLEN (dev); | 1261 | |
| 1245 | 1262 | if (temp < RX_QLEN(dev)) { | |
| 1246 | if (temp < qlen) { | 1263 | rx_alloc_submit(dev, GFP_ATOMIC); |
| 1247 | struct urb *urb; | ||
| 1248 | int i; | ||
| 1249 | |||
| 1250 | // don't refill the queue all at once | ||
| 1251 | for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) { | ||
| 1252 | urb = usb_alloc_urb (0, GFP_ATOMIC); | ||
| 1253 | if (urb != NULL) { | ||
| 1254 | if (rx_submit (dev, urb, GFP_ATOMIC) == | ||
| 1255 | -ENOLINK) | ||
| 1256 | return; | ||
| 1257 | } | ||
| 1258 | } | ||
| 1259 | if (temp != dev->rxq.qlen) | 1264 | if (temp != dev->rxq.qlen) |
| 1260 | netif_dbg(dev, link, dev->net, | 1265 | netif_dbg(dev, link, dev->net, |
| 1261 | "rxqlen %d --> %d\n", | 1266 | "rxqlen %d --> %d\n", |
| 1262 | temp, dev->rxq.qlen); | 1267 | temp, dev->rxq.qlen); |
| 1263 | if (dev->rxq.qlen < qlen) | 1268 | if (dev->rxq.qlen < RX_QLEN(dev)) |
| 1264 | tasklet_schedule (&dev->bh); | 1269 | tasklet_schedule (&dev->bh); |
| 1265 | } | 1270 | } |
| 1266 | if (dev->txq.qlen < TX_QLEN (dev)) | 1271 | if (dev->txq.qlen < TX_QLEN (dev)) |
| @@ -1513,6 +1518,7 @@ int usbnet_suspend (struct usb_interface *intf, pm_message_t message) | |||
| 1513 | spin_lock_irq(&dev->txq.lock); | 1518 | spin_lock_irq(&dev->txq.lock); |
| 1514 | /* don't autosuspend while transmitting */ | 1519 | /* don't autosuspend while transmitting */ |
| 1515 | if (dev->txq.qlen && PMSG_IS_AUTO(message)) { | 1520 | if (dev->txq.qlen && PMSG_IS_AUTO(message)) { |
| 1521 | dev->suspend_count--; | ||
| 1516 | spin_unlock_irq(&dev->txq.lock); | 1522 | spin_unlock_irq(&dev->txq.lock); |
| 1517 | return -EBUSY; | 1523 | return -EBUSY; |
| 1518 | } else { | 1524 | } else { |
| @@ -1569,6 +1575,13 @@ int usbnet_resume (struct usb_interface *intf) | |||
| 1569 | spin_unlock_irq(&dev->txq.lock); | 1575 | spin_unlock_irq(&dev->txq.lock); |
| 1570 | 1576 | ||
| 1571 | if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { | 1577 | if (test_bit(EVENT_DEV_OPEN, &dev->flags)) { |
| 1578 | /* handle remote wakeup ASAP */ | ||
| 1579 | if (!dev->wait && | ||
| 1580 | netif_device_present(dev->net) && | ||
| 1581 | !timer_pending(&dev->delay) && | ||
| 1582 | !test_bit(EVENT_RX_HALT, &dev->flags)) | ||
| 1583 | rx_alloc_submit(dev, GFP_KERNEL); | ||
| 1584 | |||
| 1572 | if (!(dev->txq.qlen >= TX_QLEN(dev))) | 1585 | if (!(dev->txq.qlen >= TX_QLEN(dev))) |
| 1573 | netif_tx_wake_all_queues(dev->net); | 1586 | netif_tx_wake_all_queues(dev->net); |
| 1574 | tasklet_schedule (&dev->bh); | 1587 | tasklet_schedule (&dev->bh); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 5214b1eceb95..f18149ae2588 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
| @@ -42,7 +42,8 @@ module_param(gso, bool, 0444); | |||
| 42 | #define VIRTNET_DRIVER_VERSION "1.0.0" | 42 | #define VIRTNET_DRIVER_VERSION "1.0.0" |
| 43 | 43 | ||
| 44 | struct virtnet_stats { | 44 | struct virtnet_stats { |
| 45 | struct u64_stats_sync syncp; | 45 | struct u64_stats_sync tx_syncp; |
| 46 | struct u64_stats_sync rx_syncp; | ||
| 46 | u64 tx_bytes; | 47 | u64 tx_bytes; |
| 47 | u64 tx_packets; | 48 | u64 tx_packets; |
| 48 | 49 | ||
| @@ -300,10 +301,10 @@ static void receive_buf(struct net_device *dev, void *buf, unsigned int len) | |||
| 300 | 301 | ||
| 301 | hdr = skb_vnet_hdr(skb); | 302 | hdr = skb_vnet_hdr(skb); |
| 302 | 303 | ||
| 303 | u64_stats_update_begin(&stats->syncp); | 304 | u64_stats_update_begin(&stats->rx_syncp); |
| 304 | stats->rx_bytes += skb->len; | 305 | stats->rx_bytes += skb->len; |
| 305 | stats->rx_packets++; | 306 | stats->rx_packets++; |
| 306 | u64_stats_update_end(&stats->syncp); | 307 | u64_stats_update_end(&stats->rx_syncp); |
| 307 | 308 | ||
| 308 | if (hdr->hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { | 309 | if (hdr->hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { |
| 309 | pr_debug("Needs csum!\n"); | 310 | pr_debug("Needs csum!\n"); |
| @@ -565,10 +566,10 @@ static unsigned int free_old_xmit_skbs(struct virtnet_info *vi) | |||
| 565 | while ((skb = virtqueue_get_buf(vi->svq, &len)) != NULL) { | 566 | while ((skb = virtqueue_get_buf(vi->svq, &len)) != NULL) { |
| 566 | pr_debug("Sent skb %p\n", skb); | 567 | pr_debug("Sent skb %p\n", skb); |
| 567 | 568 | ||
| 568 | u64_stats_update_begin(&stats->syncp); | 569 | u64_stats_update_begin(&stats->tx_syncp); |
| 569 | stats->tx_bytes += skb->len; | 570 | stats->tx_bytes += skb->len; |
| 570 | stats->tx_packets++; | 571 | stats->tx_packets++; |
| 571 | u64_stats_update_end(&stats->syncp); | 572 | u64_stats_update_end(&stats->tx_syncp); |
| 572 | 573 | ||
| 573 | tot_sgs += skb_vnet_hdr(skb)->num_sg; | 574 | tot_sgs += skb_vnet_hdr(skb)->num_sg; |
| 574 | dev_kfree_skb_any(skb); | 575 | dev_kfree_skb_any(skb); |
| @@ -703,12 +704,16 @@ static struct rtnl_link_stats64 *virtnet_stats(struct net_device *dev, | |||
| 703 | u64 tpackets, tbytes, rpackets, rbytes; | 704 | u64 tpackets, tbytes, rpackets, rbytes; |
| 704 | 705 | ||
| 705 | do { | 706 | do { |
| 706 | start = u64_stats_fetch_begin(&stats->syncp); | 707 | start = u64_stats_fetch_begin(&stats->tx_syncp); |
| 707 | tpackets = stats->tx_packets; | 708 | tpackets = stats->tx_packets; |
| 708 | tbytes = stats->tx_bytes; | 709 | tbytes = stats->tx_bytes; |
| 710 | } while (u64_stats_fetch_retry(&stats->tx_syncp, start)); | ||
| 711 | |||
| 712 | do { | ||
| 713 | start = u64_stats_fetch_begin(&stats->rx_syncp); | ||
| 709 | rpackets = stats->rx_packets; | 714 | rpackets = stats->rx_packets; |
| 710 | rbytes = stats->rx_bytes; | 715 | rbytes = stats->rx_bytes; |
| 711 | } while (u64_stats_fetch_retry(&stats->syncp, start)); | 716 | } while (u64_stats_fetch_retry(&stats->rx_syncp, start)); |
| 712 | 717 | ||
| 713 | tot->rx_packets += rpackets; | 718 | tot->rx_packets += rpackets; |
| 714 | tot->tx_packets += tpackets; | 719 | tot->tx_packets += tpackets; |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 520a4b2eb9cc..a747c632597a 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
| @@ -7233,8 +7233,8 @@ static int airo_get_aplist(struct net_device *dev, | |||
| 7233 | } | 7233 | } |
| 7234 | } else { | 7234 | } else { |
| 7235 | dwrq->flags = 1; /* Should be define'd */ | 7235 | dwrq->flags = 1; /* Should be define'd */ |
| 7236 | memcpy(extra + sizeof(struct sockaddr)*i, | 7236 | memcpy(extra + sizeof(struct sockaddr) * i, qual, |
| 7237 | &qual, sizeof(struct iw_quality)*i); | 7237 | sizeof(struct iw_quality) * i); |
| 7238 | } | 7238 | } |
| 7239 | dwrq->length = i; | 7239 | dwrq->length = i; |
| 7240 | 7240 | ||
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index c54b7d37bff1..420d69b2674c 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
| @@ -143,6 +143,7 @@ struct ath_common { | |||
| 143 | u32 keymax; | 143 | u32 keymax; |
| 144 | DECLARE_BITMAP(keymap, ATH_KEYMAX); | 144 | DECLARE_BITMAP(keymap, ATH_KEYMAX); |
| 145 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); | 145 | DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); |
| 146 | DECLARE_BITMAP(ccmp_keymap, ATH_KEYMAX); | ||
| 146 | enum ath_crypt_caps crypt_caps; | 147 | enum ath_crypt_caps crypt_caps; |
| 147 | 148 | ||
| 148 | unsigned int clockrate; | 149 | unsigned int clockrate; |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index fbaa30930076..44ad6fe0278f 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
| @@ -1045,11 +1045,11 @@ ath5k_drain_tx_buffs(struct ath5k_hw *ah) | |||
| 1045 | 1045 | ||
| 1046 | ath5k_txbuf_free_skb(ah, bf); | 1046 | ath5k_txbuf_free_skb(ah, bf); |
| 1047 | 1047 | ||
| 1048 | spin_lock_bh(&ah->txbuflock); | 1048 | spin_lock(&ah->txbuflock); |
| 1049 | list_move_tail(&bf->list, &ah->txbuf); | 1049 | list_move_tail(&bf->list, &ah->txbuf); |
| 1050 | ah->txbuf_len++; | 1050 | ah->txbuf_len++; |
| 1051 | txq->txq_len--; | 1051 | txq->txq_len--; |
| 1052 | spin_unlock_bh(&ah->txbuflock); | 1052 | spin_unlock(&ah->txbuflock); |
| 1053 | } | 1053 | } |
| 1054 | txq->link = NULL; | 1054 | txq->link = NULL; |
| 1055 | txq->txq_poll_mark = false; | 1055 | txq->txq_poll_mark = false; |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index a277cf6f339d..4866550ddd96 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
| @@ -214,6 +214,7 @@ struct ath_frame_info { | |||
| 214 | enum ath9k_key_type keytype; | 214 | enum ath9k_key_type keytype; |
| 215 | u8 keyix; | 215 | u8 keyix; |
| 216 | u8 retries; | 216 | u8 retries; |
| 217 | u8 rtscts_rate; | ||
| 217 | }; | 218 | }; |
| 218 | 219 | ||
| 219 | struct ath_buf_state { | 220 | struct ath_buf_state { |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 2b8f61c210e1..abbd6effd60d 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
| @@ -1496,6 +1496,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, | |||
| 1496 | priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--; | 1496 | priv->num_sta_assoc_vif++ : priv->num_sta_assoc_vif--; |
| 1497 | 1497 | ||
| 1498 | if (priv->ah->opmode == NL80211_IFTYPE_STATION) { | 1498 | if (priv->ah->opmode == NL80211_IFTYPE_STATION) { |
| 1499 | ath9k_htc_choose_set_bssid(priv); | ||
| 1499 | if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1)) | 1500 | if (bss_conf->assoc && (priv->num_sta_assoc_vif == 1)) |
| 1500 | ath9k_htc_start_ani(priv); | 1501 | ath9k_htc_start_ani(priv); |
| 1501 | else if (priv->num_sta_assoc_vif == 0) | 1502 | else if (priv->num_sta_assoc_vif == 0) |
| @@ -1503,13 +1504,11 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw, | |||
| 1503 | } | 1504 | } |
| 1504 | } | 1505 | } |
| 1505 | 1506 | ||
| 1506 | if (changed & BSS_CHANGED_BSSID) { | 1507 | if (changed & BSS_CHANGED_IBSS) { |
| 1507 | if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) { | 1508 | if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) { |
| 1508 | common->curaid = bss_conf->aid; | 1509 | common->curaid = bss_conf->aid; |
| 1509 | memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); | 1510 | memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN); |
| 1510 | ath9k_htc_set_bssid(priv); | 1511 | ath9k_htc_set_bssid(priv); |
| 1511 | } else if (priv->ah->opmode == NL80211_IFTYPE_STATION) { | ||
| 1512 | ath9k_htc_choose_set_bssid(priv); | ||
| 1513 | } | 1512 | } |
| 1514 | } | 1513 | } |
| 1515 | 1514 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 7db1890448f2..995ca8e1302e 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
| @@ -622,7 +622,7 @@ static int __ath9k_hw_init(struct ath_hw *ah) | |||
| 622 | 622 | ||
| 623 | if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) { | 623 | if (NR_CPUS > 1 && ah->config.serialize_regmode == SER_REG_MODE_AUTO) { |
| 624 | if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || | 624 | if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI || |
| 625 | ((AR_SREV_9160(ah) || AR_SREV_9280(ah)) && | 625 | ((AR_SREV_9160(ah) || AR_SREV_9280(ah) || AR_SREV_9287(ah)) && |
| 626 | !ah->is_pciexpress)) { | 626 | !ah->is_pciexpress)) { |
| 627 | ah->config.serialize_regmode = | 627 | ah->config.serialize_regmode = |
| 628 | SER_REG_MODE_ON; | 628 | SER_REG_MODE_ON; |
| @@ -784,13 +784,25 @@ static void ath9k_hw_init_qos(struct ath_hw *ah) | |||
| 784 | 784 | ||
| 785 | u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) | 785 | u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah) |
| 786 | { | 786 | { |
| 787 | struct ath_common *common = ath9k_hw_common(ah); | ||
| 788 | int i = 0; | ||
| 789 | |||
| 787 | REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); | 790 | REG_CLR_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); |
| 788 | udelay(100); | 791 | udelay(100); |
| 789 | REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); | 792 | REG_SET_BIT(ah, PLL3, PLL3_DO_MEAS_MASK); |
| 790 | 793 | ||
| 791 | while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) | 794 | while ((REG_READ(ah, PLL4) & PLL4_MEAS_DONE) == 0) { |
| 795 | |||
| 792 | udelay(100); | 796 | udelay(100); |
| 793 | 797 | ||
| 798 | if (WARN_ON_ONCE(i >= 100)) { | ||
| 799 | ath_err(common, "PLL4 meaurement not done\n"); | ||
| 800 | break; | ||
| 801 | } | ||
| 802 | |||
| 803 | i++; | ||
| 804 | } | ||
| 805 | |||
| 794 | return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3; | 806 | return (REG_READ(ah, PLL3) & SQSUM_DVC_MASK) >> 3; |
| 795 | } | 807 | } |
| 796 | EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc); | 808 | EXPORT_SYMBOL(ar9003_get_pll_sqsum_dvc); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 4de4473776ac..dac1a2709e3c 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
| @@ -971,6 +971,15 @@ void ath_hw_pll_work(struct work_struct *work) | |||
| 971 | hw_pll_work.work); | 971 | hw_pll_work.work); |
| 972 | u32 pll_sqsum; | 972 | u32 pll_sqsum; |
| 973 | 973 | ||
| 974 | /* | ||
| 975 | * ensure that the PLL WAR is executed only | ||
| 976 | * after the STA is associated (or) if the | ||
| 977 | * beaconing had started in interfaces that | ||
| 978 | * uses beacons. | ||
| 979 | */ | ||
| 980 | if (!(sc->sc_flags & SC_OP_BEACONS)) | ||
| 981 | return; | ||
| 982 | |||
| 974 | if (AR_SREV_9485(sc->sc_ah)) { | 983 | if (AR_SREV_9485(sc->sc_ah)) { |
| 975 | 984 | ||
| 976 | ath9k_ps_wakeup(sc); | 985 | ath9k_ps_wakeup(sc); |
| @@ -1443,15 +1452,6 @@ static int ath9k_add_interface(struct ieee80211_hw *hw, | |||
| 1443 | } | 1452 | } |
| 1444 | } | 1453 | } |
| 1445 | 1454 | ||
| 1446 | if ((ah->opmode == NL80211_IFTYPE_ADHOC) || | ||
| 1447 | ((vif->type == NL80211_IFTYPE_ADHOC) && | ||
| 1448 | sc->nvifs > 0)) { | ||
| 1449 | ath_err(common, "Cannot create ADHOC interface when other" | ||
| 1450 | " interfaces already exist.\n"); | ||
| 1451 | ret = -EINVAL; | ||
| 1452 | goto out; | ||
| 1453 | } | ||
| 1454 | |||
| 1455 | ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); | 1455 | ath_dbg(common, CONFIG, "Attach a VIF of type: %d\n", vif->type); |
| 1456 | 1456 | ||
| 1457 | sc->nvifs++; | 1457 | sc->nvifs++; |
| @@ -1476,15 +1476,6 @@ static int ath9k_change_interface(struct ieee80211_hw *hw, | |||
| 1476 | mutex_lock(&sc->mutex); | 1476 | mutex_lock(&sc->mutex); |
| 1477 | ath9k_ps_wakeup(sc); | 1477 | ath9k_ps_wakeup(sc); |
| 1478 | 1478 | ||
| 1479 | /* See if new interface type is valid. */ | ||
| 1480 | if ((new_type == NL80211_IFTYPE_ADHOC) && | ||
| 1481 | (sc->nvifs > 1)) { | ||
| 1482 | ath_err(common, "When using ADHOC, it must be the only" | ||
| 1483 | " interface.\n"); | ||
| 1484 | ret = -EINVAL; | ||
| 1485 | goto out; | ||
| 1486 | } | ||
| 1487 | |||
| 1488 | if (ath9k_uses_beacons(new_type) && | 1479 | if (ath9k_uses_beacons(new_type) && |
| 1489 | !ath9k_uses_beacons(vif->type)) { | 1480 | !ath9k_uses_beacons(vif->type)) { |
| 1490 | if (sc->nbcnvifs >= ATH_BCBUF) { | 1481 | if (sc->nbcnvifs >= ATH_BCBUF) { |
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index e1fcc68124dc..0735aeb3b26c 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
| @@ -695,9 +695,9 @@ static bool ath_edma_get_buffers(struct ath_softc *sc, | |||
| 695 | __skb_unlink(skb, &rx_edma->rx_fifo); | 695 | __skb_unlink(skb, &rx_edma->rx_fifo); |
| 696 | list_add_tail(&bf->list, &sc->rx.rxbuf); | 696 | list_add_tail(&bf->list, &sc->rx.rxbuf); |
| 697 | ath_rx_edma_buf_link(sc, qtype); | 697 | ath_rx_edma_buf_link(sc, qtype); |
| 698 | } else { | ||
| 699 | bf = NULL; | ||
| 700 | } | 698 | } |
| 699 | |||
| 700 | bf = NULL; | ||
| 701 | } | 701 | } |
| 702 | 702 | ||
| 703 | *dest = bf; | 703 | *dest = bf; |
| @@ -822,7 +822,8 @@ static bool ath9k_rx_accept(struct ath_common *common, | |||
| 822 | * descriptor does contain a valid key index. This has been observed | 822 | * descriptor does contain a valid key index. This has been observed |
| 823 | * mostly with CCMP encryption. | 823 | * mostly with CCMP encryption. |
| 824 | */ | 824 | */ |
| 825 | if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID) | 825 | if (rx_stats->rs_keyix == ATH9K_RXKEYIX_INVALID || |
| 826 | !test_bit(rx_stats->rs_keyix, common->ccmp_keymap)) | ||
| 826 | rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; | 827 | rx_stats->rs_status &= ~ATH9K_RXERR_KEYMISS; |
| 827 | 828 | ||
| 828 | if (!rx_stats->rs_datalen) { | 829 | if (!rx_stats->rs_datalen) { |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index d59dd01d6cde..4d571394c7a8 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
| @@ -938,6 +938,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, | |||
| 938 | struct ieee80211_tx_rate *rates; | 938 | struct ieee80211_tx_rate *rates; |
| 939 | const struct ieee80211_rate *rate; | 939 | const struct ieee80211_rate *rate; |
| 940 | struct ieee80211_hdr *hdr; | 940 | struct ieee80211_hdr *hdr; |
| 941 | struct ath_frame_info *fi = get_frame_info(bf->bf_mpdu); | ||
| 941 | int i; | 942 | int i; |
| 942 | u8 rix = 0; | 943 | u8 rix = 0; |
| 943 | 944 | ||
| @@ -948,18 +949,7 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, | |||
| 948 | 949 | ||
| 949 | /* set dur_update_en for l-sig computation except for PS-Poll frames */ | 950 | /* set dur_update_en for l-sig computation except for PS-Poll frames */ |
| 950 | info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); | 951 | info->dur_update = !ieee80211_is_pspoll(hdr->frame_control); |
| 951 | 952 | info->rtscts_rate = fi->rtscts_rate; | |
| 952 | /* | ||
| 953 | * We check if Short Preamble is needed for the CTS rate by | ||
| 954 | * checking the BSS's global flag. | ||
| 955 | * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. | ||
| 956 | */ | ||
| 957 | rate = ieee80211_get_rts_cts_rate(sc->hw, tx_info); | ||
| 958 | info->rtscts_rate = rate->hw_value; | ||
| 959 | |||
| 960 | if (tx_info->control.vif && | ||
| 961 | tx_info->control.vif->bss_conf.use_short_preamble) | ||
| 962 | info->rtscts_rate |= rate->hw_value_short; | ||
| 963 | 953 | ||
| 964 | for (i = 0; i < 4; i++) { | 954 | for (i = 0; i < 4; i++) { |
| 965 | bool is_40, is_sgi, is_sp; | 955 | bool is_40, is_sgi, is_sp; |
| @@ -1001,13 +991,13 @@ static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf, | |||
| 1001 | } | 991 | } |
| 1002 | 992 | ||
| 1003 | /* legacy rates */ | 993 | /* legacy rates */ |
| 994 | rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx]; | ||
| 1004 | if ((tx_info->band == IEEE80211_BAND_2GHZ) && | 995 | if ((tx_info->band == IEEE80211_BAND_2GHZ) && |
| 1005 | !(rate->flags & IEEE80211_RATE_ERP_G)) | 996 | !(rate->flags & IEEE80211_RATE_ERP_G)) |
| 1006 | phy = WLAN_RC_PHY_CCK; | 997 | phy = WLAN_RC_PHY_CCK; |
| 1007 | else | 998 | else |
| 1008 | phy = WLAN_RC_PHY_OFDM; | 999 | phy = WLAN_RC_PHY_OFDM; |
| 1009 | 1000 | ||
| 1010 | rate = &sc->sbands[tx_info->band].bitrates[rates[i].idx]; | ||
| 1011 | info->rates[i].Rate = rate->hw_value; | 1001 | info->rates[i].Rate = rate->hw_value; |
| 1012 | if (rate->hw_value_short) { | 1002 | if (rate->hw_value_short) { |
| 1013 | if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) | 1003 | if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) |
| @@ -1776,10 +1766,22 @@ static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
| 1776 | struct ieee80211_sta *sta = tx_info->control.sta; | 1766 | struct ieee80211_sta *sta = tx_info->control.sta; |
| 1777 | struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; | 1767 | struct ieee80211_key_conf *hw_key = tx_info->control.hw_key; |
| 1778 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1768 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
| 1769 | const struct ieee80211_rate *rate; | ||
| 1779 | struct ath_frame_info *fi = get_frame_info(skb); | 1770 | struct ath_frame_info *fi = get_frame_info(skb); |
| 1780 | struct ath_node *an = NULL; | 1771 | struct ath_node *an = NULL; |
| 1781 | enum ath9k_key_type keytype; | 1772 | enum ath9k_key_type keytype; |
| 1773 | bool short_preamble = false; | ||
| 1774 | |||
| 1775 | /* | ||
| 1776 | * We check if Short Preamble is needed for the CTS rate by | ||
| 1777 | * checking the BSS's global flag. | ||
| 1778 | * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used. | ||
| 1779 | */ | ||
| 1780 | if (tx_info->control.vif && | ||
| 1781 | tx_info->control.vif->bss_conf.use_short_preamble) | ||
| 1782 | short_preamble = true; | ||
| 1782 | 1783 | ||
| 1784 | rate = ieee80211_get_rts_cts_rate(hw, tx_info); | ||
| 1783 | keytype = ath9k_cmn_get_hw_crypto_keytype(skb); | 1785 | keytype = ath9k_cmn_get_hw_crypto_keytype(skb); |
| 1784 | 1786 | ||
| 1785 | if (sta) | 1787 | if (sta) |
| @@ -1794,6 +1796,9 @@ static void setup_frame_info(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
| 1794 | fi->keyix = ATH9K_TXKEYIX_INVALID; | 1796 | fi->keyix = ATH9K_TXKEYIX_INVALID; |
| 1795 | fi->keytype = keytype; | 1797 | fi->keytype = keytype; |
| 1796 | fi->framelen = framelen; | 1798 | fi->framelen = framelen; |
| 1799 | fi->rtscts_rate = rate->hw_value; | ||
| 1800 | if (short_preamble) | ||
| 1801 | fi->rtscts_rate |= rate->hw_value_short; | ||
| 1797 | } | 1802 | } |
| 1798 | 1803 | ||
| 1799 | u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) | 1804 | u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate) |
diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c index 0e81904956cf..5c54aa43ca2d 100644 --- a/drivers/net/wireless/ath/key.c +++ b/drivers/net/wireless/ath/key.c | |||
| @@ -556,6 +556,9 @@ int ath_key_config(struct ath_common *common, | |||
| 556 | return -EIO; | 556 | return -EIO; |
| 557 | 557 | ||
| 558 | set_bit(idx, common->keymap); | 558 | set_bit(idx, common->keymap); |
| 559 | if (key->cipher == WLAN_CIPHER_SUITE_CCMP) | ||
| 560 | set_bit(idx, common->ccmp_keymap); | ||
| 561 | |||
| 559 | if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { | 562 | if (key->cipher == WLAN_CIPHER_SUITE_TKIP) { |
| 560 | set_bit(idx + 64, common->keymap); | 563 | set_bit(idx + 64, common->keymap); |
| 561 | set_bit(idx, common->tkip_keymap); | 564 | set_bit(idx, common->tkip_keymap); |
| @@ -582,6 +585,7 @@ void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key) | |||
| 582 | return; | 585 | return; |
| 583 | 586 | ||
| 584 | clear_bit(key->hw_key_idx, common->keymap); | 587 | clear_bit(key->hw_key_idx, common->keymap); |
| 588 | clear_bit(key->hw_key_idx, common->ccmp_keymap); | ||
| 585 | if (key->cipher != WLAN_CIPHER_SUITE_TKIP) | 589 | if (key->cipher != WLAN_CIPHER_SUITE_TKIP) |
| 586 | return; | 590 | return; |
| 587 | 591 | ||
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 67c13af6f206..c06b6cb5c91e 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
| @@ -877,6 +877,10 @@ struct b43_wl { | |||
| 877 | * from the mac80211 subsystem. */ | 877 | * from the mac80211 subsystem. */ |
| 878 | u16 mac80211_initially_registered_queues; | 878 | u16 mac80211_initially_registered_queues; |
| 879 | 879 | ||
| 880 | /* Set this if we call ieee80211_register_hw() and check if we call | ||
| 881 | * ieee80211_unregister_hw(). */ | ||
| 882 | bool hw_registred; | ||
| 883 | |||
| 880 | /* We can only have one operating interface (802.11 core) | 884 | /* We can only have one operating interface (802.11 core) |
| 881 | * at a time. General information about this interface follows. | 885 | * at a time. General information about this interface follows. |
| 882 | */ | 886 | */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 5a39b226b2e3..1b988f26bdf1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
| @@ -2437,6 +2437,7 @@ start_ieee80211: | |||
| 2437 | err = ieee80211_register_hw(wl->hw); | 2437 | err = ieee80211_register_hw(wl->hw); |
| 2438 | if (err) | 2438 | if (err) |
| 2439 | goto err_one_core_detach; | 2439 | goto err_one_core_detach; |
| 2440 | wl->hw_registred = true; | ||
| 2440 | b43_leds_register(wl->current_dev); | 2441 | b43_leds_register(wl->current_dev); |
| 2441 | goto out; | 2442 | goto out; |
| 2442 | 2443 | ||
| @@ -3766,7 +3767,7 @@ static int b43_switch_band(struct b43_wl *wl, struct ieee80211_channel *chan) | |||
| 3766 | if (prev_status >= B43_STAT_STARTED) { | 3767 | if (prev_status >= B43_STAT_STARTED) { |
| 3767 | err = b43_wireless_core_start(up_dev); | 3768 | err = b43_wireless_core_start(up_dev); |
| 3768 | if (err) { | 3769 | if (err) { |
| 3769 | b43err(wl, "Fatal: Coult not start device for " | 3770 | b43err(wl, "Fatal: Could not start device for " |
| 3770 | "selected %s-GHz band\n", | 3771 | "selected %s-GHz band\n", |
| 3771 | band_to_string(chan->band)); | 3772 | band_to_string(chan->band)); |
| 3772 | b43_wireless_core_exit(up_dev); | 3773 | b43_wireless_core_exit(up_dev); |
| @@ -5299,6 +5300,7 @@ static struct b43_wl *b43_wireless_init(struct b43_bus_dev *dev) | |||
| 5299 | 5300 | ||
| 5300 | hw->queues = modparam_qos ? B43_QOS_QUEUE_NUM : 1; | 5301 | hw->queues = modparam_qos ? B43_QOS_QUEUE_NUM : 1; |
| 5301 | wl->mac80211_initially_registered_queues = hw->queues; | 5302 | wl->mac80211_initially_registered_queues = hw->queues; |
| 5303 | wl->hw_registred = false; | ||
| 5302 | hw->max_rates = 2; | 5304 | hw->max_rates = 2; |
| 5303 | SET_IEEE80211_DEV(hw, dev->dev); | 5305 | SET_IEEE80211_DEV(hw, dev->dev); |
| 5304 | if (is_valid_ether_addr(sprom->et1mac)) | 5306 | if (is_valid_ether_addr(sprom->et1mac)) |
| @@ -5370,12 +5372,15 @@ static void b43_bcma_remove(struct bcma_device *core) | |||
| 5370 | * as the ieee80211 unreg will destroy the workqueue. */ | 5372 | * as the ieee80211 unreg will destroy the workqueue. */ |
| 5371 | cancel_work_sync(&wldev->restart_work); | 5373 | cancel_work_sync(&wldev->restart_work); |
| 5372 | 5374 | ||
| 5373 | /* Restore the queues count before unregistering, because firmware detect | 5375 | B43_WARN_ON(!wl); |
| 5374 | * might have modified it. Restoring is important, so the networking | 5376 | if (wl->current_dev == wldev && wl->hw_registred) { |
| 5375 | * stack can properly free resources. */ | 5377 | /* Restore the queues count before unregistering, because firmware detect |
| 5376 | wl->hw->queues = wl->mac80211_initially_registered_queues; | 5378 | * might have modified it. Restoring is important, so the networking |
| 5377 | b43_leds_stop(wldev); | 5379 | * stack can properly free resources. */ |
| 5378 | ieee80211_unregister_hw(wl->hw); | 5380 | wl->hw->queues = wl->mac80211_initially_registered_queues; |
| 5381 | b43_leds_stop(wldev); | ||
| 5382 | ieee80211_unregister_hw(wl->hw); | ||
| 5383 | } | ||
| 5379 | 5384 | ||
| 5380 | b43_one_core_detach(wldev->dev); | 5385 | b43_one_core_detach(wldev->dev); |
| 5381 | 5386 | ||
| @@ -5446,7 +5451,7 @@ static void b43_ssb_remove(struct ssb_device *sdev) | |||
| 5446 | cancel_work_sync(&wldev->restart_work); | 5451 | cancel_work_sync(&wldev->restart_work); |
| 5447 | 5452 | ||
| 5448 | B43_WARN_ON(!wl); | 5453 | B43_WARN_ON(!wl); |
| 5449 | if (wl->current_dev == wldev) { | 5454 | if (wl->current_dev == wldev && wl->hw_registred) { |
| 5450 | /* Restore the queues count before unregistering, because firmware detect | 5455 | /* Restore the queues count before unregistering, because firmware detect |
| 5451 | * might have modified it. Restoring is important, so the networking | 5456 | * might have modified it. Restoring is important, so the networking |
| 5452 | * stack can properly free resources. */ | 5457 | * stack can properly free resources. */ |
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c index f1f8bd09bd87..c8baf020c20f 100644 --- a/drivers/net/wireless/b43legacy/dma.c +++ b/drivers/net/wireless/b43legacy/dma.c | |||
| @@ -1072,7 +1072,7 @@ static int dma_tx_fragment(struct b43legacy_dmaring *ring, | |||
| 1072 | meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); | 1072 | meta->dmaaddr = map_descbuffer(ring, skb->data, skb->len, 1); |
| 1073 | /* create a bounce buffer in zone_dma on mapping failure. */ | 1073 | /* create a bounce buffer in zone_dma on mapping failure. */ |
| 1074 | if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { | 1074 | if (b43legacy_dma_mapping_error(ring, meta->dmaaddr, skb->len, 1)) { |
| 1075 | bounce_skb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); | 1075 | bounce_skb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); |
| 1076 | if (!bounce_skb) { | 1076 | if (!bounce_skb) { |
| 1077 | ring->current_slot = old_top_slot; | 1077 | ring->current_slot = old_top_slot; |
| 1078 | ring->used_slots = old_used_slots; | 1078 | ring->used_slots = old_used_slots; |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index cd9c9bc186d9..eae691e2f7dd 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
| @@ -2633,7 +2633,7 @@ static int b43legacy_switch_phymode(struct b43legacy_wl *wl, | |||
| 2633 | if (prev_status >= B43legacy_STAT_STARTED) { | 2633 | if (prev_status >= B43legacy_STAT_STARTED) { |
| 2634 | err = b43legacy_wireless_core_start(up_dev); | 2634 | err = b43legacy_wireless_core_start(up_dev); |
| 2635 | if (err) { | 2635 | if (err) { |
| 2636 | b43legacyerr(wl, "Fatal: Coult not start device for " | 2636 | b43legacyerr(wl, "Fatal: Could not start device for " |
| 2637 | "newly selected %s-PHY mode\n", | 2637 | "newly selected %s-PHY mode\n", |
| 2638 | phymode_to_string(new_mode)); | 2638 | phymode_to_string(new_mode)); |
| 2639 | b43legacy_wireless_core_exit(up_dev); | 2639 | b43legacy_wireless_core_exit(up_dev); |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c index e2480d196276..8e7e6928c936 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | |||
| @@ -89,9 +89,9 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev) | |||
| 89 | data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1; | 89 | data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1; |
| 90 | brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret); | 90 | brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret); |
| 91 | 91 | ||
| 92 | /* redirect, configure ane enable io for interrupt signal */ | 92 | /* redirect, configure and enable io for interrupt signal */ |
| 93 | data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE; | 93 | data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE; |
| 94 | if (sdiodev->irq_flags | IRQF_TRIGGER_HIGH) | 94 | if (sdiodev->irq_flags & IRQF_TRIGGER_HIGH) |
| 95 | data |= SDIO_SEPINT_ACT_HI; | 95 | data |= SDIO_SEPINT_ACT_HI; |
| 96 | brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret); | 96 | brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret); |
| 97 | 97 | ||
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index 9cfae0c08707..95aa8e1683ec 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c | |||
| @@ -1903,14 +1903,6 @@ static void ipw2100_down(struct ipw2100_priv *priv) | |||
| 1903 | netif_stop_queue(priv->net_dev); | 1903 | netif_stop_queue(priv->net_dev); |
| 1904 | } | 1904 | } |
| 1905 | 1905 | ||
| 1906 | /* Called by register_netdev() */ | ||
| 1907 | static int ipw2100_net_init(struct net_device *dev) | ||
| 1908 | { | ||
| 1909 | struct ipw2100_priv *priv = libipw_priv(dev); | ||
| 1910 | |||
| 1911 | return ipw2100_up(priv, 1); | ||
| 1912 | } | ||
| 1913 | |||
| 1914 | static int ipw2100_wdev_init(struct net_device *dev) | 1906 | static int ipw2100_wdev_init(struct net_device *dev) |
| 1915 | { | 1907 | { |
| 1916 | struct ipw2100_priv *priv = libipw_priv(dev); | 1908 | struct ipw2100_priv *priv = libipw_priv(dev); |
| @@ -6087,7 +6079,6 @@ static const struct net_device_ops ipw2100_netdev_ops = { | |||
| 6087 | .ndo_stop = ipw2100_close, | 6079 | .ndo_stop = ipw2100_close, |
| 6088 | .ndo_start_xmit = libipw_xmit, | 6080 | .ndo_start_xmit = libipw_xmit, |
| 6089 | .ndo_change_mtu = libipw_change_mtu, | 6081 | .ndo_change_mtu = libipw_change_mtu, |
| 6090 | .ndo_init = ipw2100_net_init, | ||
| 6091 | .ndo_tx_timeout = ipw2100_tx_timeout, | 6082 | .ndo_tx_timeout = ipw2100_tx_timeout, |
| 6092 | .ndo_set_mac_address = ipw2100_set_address, | 6083 | .ndo_set_mac_address = ipw2100_set_address, |
| 6093 | .ndo_validate_addr = eth_validate_addr, | 6084 | .ndo_validate_addr = eth_validate_addr, |
| @@ -6329,6 +6320,10 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
| 6329 | printk(KERN_INFO DRV_NAME | 6320 | printk(KERN_INFO DRV_NAME |
| 6330 | ": Detected Intel PRO/Wireless 2100 Network Connection\n"); | 6321 | ": Detected Intel PRO/Wireless 2100 Network Connection\n"); |
| 6331 | 6322 | ||
| 6323 | err = ipw2100_up(priv, 1); | ||
| 6324 | if (err) | ||
| 6325 | goto fail; | ||
| 6326 | |||
| 6332 | err = ipw2100_wdev_init(dev); | 6327 | err = ipw2100_wdev_init(dev); |
| 6333 | if (err) | 6328 | if (err) |
| 6334 | goto fail; | 6329 | goto fail; |
| @@ -6338,12 +6333,7 @@ static int ipw2100_pci_init_one(struct pci_dev *pci_dev, | |||
| 6338 | * network device we would call ipw2100_up. This introduced a race | 6333 | * network device we would call ipw2100_up. This introduced a race |
| 6339 | * condition with newer hotplug configurations (network was coming | 6334 | * condition with newer hotplug configurations (network was coming |
| 6340 | * up and making calls before the device was initialized). | 6335 | * up and making calls before the device was initialized). |
| 6341 | * | 6336 | */ |
| 6342 | * If we called ipw2100_up before we registered the device, then the | ||
| 6343 | * device name wasn't registered. So, we instead use the net_dev->init | ||
| 6344 | * member to call a function that then just turns and calls ipw2100_up. | ||
| 6345 | * net_dev->init is called after name allocation but before the | ||
| 6346 | * notifier chain is called */ | ||
| 6347 | err = register_netdev(dev); | 6337 | err = register_netdev(dev); |
| 6348 | if (err) { | 6338 | if (err) { |
| 6349 | printk(KERN_WARNING DRV_NAME | 6339 | printk(KERN_WARNING DRV_NAME |
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 509301a5e7e2..ff5d689e13f3 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
| @@ -3405,7 +3405,7 @@ il4965_remove_dynamic_key(struct il_priv *il, | |||
| 3405 | return 0; | 3405 | return 0; |
| 3406 | } | 3406 | } |
| 3407 | 3407 | ||
| 3408 | if (il->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) { | 3408 | if (il->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_INVALID) { |
| 3409 | IL_WARN("Removing wrong key %d 0x%x\n", keyconf->keyidx, | 3409 | IL_WARN("Removing wrong key %d 0x%x\n", keyconf->keyidx, |
| 3410 | key_flags); | 3410 | key_flags); |
| 3411 | spin_unlock_irqrestore(&il->sta_lock, flags); | 3411 | spin_unlock_irqrestore(&il->sta_lock, flags); |
| @@ -3420,7 +3420,7 @@ il4965_remove_dynamic_key(struct il_priv *il, | |||
| 3420 | memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo)); | 3420 | memset(&il->stations[sta_id].sta.key, 0, sizeof(struct il4965_keyinfo)); |
| 3421 | il->stations[sta_id].sta.key.key_flags = | 3421 | il->stations[sta_id].sta.key.key_flags = |
| 3422 | STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; | 3422 | STA_KEY_FLG_NO_ENC | STA_KEY_FLG_INVALID; |
| 3423 | il->stations[sta_id].sta.key.key_offset = WEP_INVALID_OFFSET; | 3423 | il->stations[sta_id].sta.key.key_offset = keyconf->hw_key_idx; |
| 3424 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; | 3424 | il->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; |
| 3425 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; | 3425 | il->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; |
| 3426 | 3426 | ||
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index cbf2dc18341f..5d4807c2b56d 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
| @@ -4767,14 +4767,12 @@ il_bg_watchdog(unsigned long data) | |||
| 4767 | return; | 4767 | return; |
| 4768 | 4768 | ||
| 4769 | /* monitor and check for other stuck queues */ | 4769 | /* monitor and check for other stuck queues */ |
| 4770 | if (il_is_any_associated(il)) { | 4770 | for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { |
| 4771 | for (cnt = 0; cnt < il->hw_params.max_txq_num; cnt++) { | 4771 | /* skip as we already checked the command queue */ |
| 4772 | /* skip as we already checked the command queue */ | 4772 | if (cnt == il->cmd_queue) |
| 4773 | if (cnt == il->cmd_queue) | 4773 | continue; |
| 4774 | continue; | 4774 | if (il_check_stuck_queue(il, cnt)) |
| 4775 | if (il_check_stuck_queue(il, cnt)) | 4775 | return; |
| 4776 | return; | ||
| 4777 | } | ||
| 4778 | } | 4776 | } |
| 4779 | 4777 | ||
| 4780 | mod_timer(&il->watchdog, | 4778 | mod_timer(&il->watchdog, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 19f7ee84ae89..e5e8ada4aaf6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
| @@ -35,17 +35,20 @@ | |||
| 35 | #define IWL6000_UCODE_API_MAX 6 | 35 | #define IWL6000_UCODE_API_MAX 6 |
| 36 | #define IWL6050_UCODE_API_MAX 5 | 36 | #define IWL6050_UCODE_API_MAX 5 |
| 37 | #define IWL6000G2_UCODE_API_MAX 6 | 37 | #define IWL6000G2_UCODE_API_MAX 6 |
| 38 | #define IWL6035_UCODE_API_MAX 6 | ||
| 38 | 39 | ||
| 39 | /* Oldest version we won't warn about */ | 40 | /* Oldest version we won't warn about */ |
| 40 | #define IWL6000_UCODE_API_OK 4 | 41 | #define IWL6000_UCODE_API_OK 4 |
| 41 | #define IWL6000G2_UCODE_API_OK 5 | 42 | #define IWL6000G2_UCODE_API_OK 5 |
| 42 | #define IWL6050_UCODE_API_OK 5 | 43 | #define IWL6050_UCODE_API_OK 5 |
| 43 | #define IWL6000G2B_UCODE_API_OK 6 | 44 | #define IWL6000G2B_UCODE_API_OK 6 |
| 45 | #define IWL6035_UCODE_API_OK 6 | ||
| 44 | 46 | ||
| 45 | /* Lowest firmware API version supported */ | 47 | /* Lowest firmware API version supported */ |
| 46 | #define IWL6000_UCODE_API_MIN 4 | 48 | #define IWL6000_UCODE_API_MIN 4 |
| 47 | #define IWL6050_UCODE_API_MIN 4 | 49 | #define IWL6050_UCODE_API_MIN 4 |
| 48 | #define IWL6000G2_UCODE_API_MIN 4 | 50 | #define IWL6000G2_UCODE_API_MIN 5 |
| 51 | #define IWL6035_UCODE_API_MIN 6 | ||
| 49 | 52 | ||
| 50 | /* EEPROM versions */ | 53 | /* EEPROM versions */ |
| 51 | #define EEPROM_6000_TX_POWER_VERSION (4) | 54 | #define EEPROM_6000_TX_POWER_VERSION (4) |
| @@ -227,9 +230,25 @@ const struct iwl_cfg iwl6030_2bg_cfg = { | |||
| 227 | IWL_DEVICE_6030, | 230 | IWL_DEVICE_6030, |
| 228 | }; | 231 | }; |
| 229 | 232 | ||
| 233 | #define IWL_DEVICE_6035 \ | ||
| 234 | .fw_name_pre = IWL6030_FW_PRE, \ | ||
| 235 | .ucode_api_max = IWL6035_UCODE_API_MAX, \ | ||
| 236 | .ucode_api_ok = IWL6035_UCODE_API_OK, \ | ||
| 237 | .ucode_api_min = IWL6035_UCODE_API_MIN, \ | ||
| 238 | .device_family = IWL_DEVICE_FAMILY_6030, \ | ||
| 239 | .max_inst_size = IWL60_RTC_INST_SIZE, \ | ||
| 240 | .max_data_size = IWL60_RTC_DATA_SIZE, \ | ||
| 241 | .eeprom_ver = EEPROM_6030_EEPROM_VERSION, \ | ||
| 242 | .eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \ | ||
| 243 | .base_params = &iwl6000_g2_base_params, \ | ||
| 244 | .bt_params = &iwl6000_bt_params, \ | ||
| 245 | .need_temp_offset_calib = true, \ | ||
| 246 | .led_mode = IWL_LED_RF_STATE, \ | ||
| 247 | .adv_pm = true | ||
| 248 | |||
| 230 | const struct iwl_cfg iwl6035_2agn_cfg = { | 249 | const struct iwl_cfg iwl6035_2agn_cfg = { |
| 231 | .name = "Intel(R) Centrino(R) Advanced-N 6235 AGN", | 250 | .name = "Intel(R) Centrino(R) Advanced-N 6235 AGN", |
| 232 | IWL_DEVICE_6030, | 251 | IWL_DEVICE_6035, |
| 233 | .ht_params = &iwl6000_ht_params, | 252 | .ht_params = &iwl6000_ht_params, |
| 234 | }; | 253 | }; |
| 235 | 254 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c index aea07aab3c9e..eb6a8eaf42fc 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c | |||
| @@ -1267,7 +1267,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv, | |||
| 1267 | key_flags |= STA_KEY_MULTICAST_MSK; | 1267 | key_flags |= STA_KEY_MULTICAST_MSK; |
| 1268 | 1268 | ||
| 1269 | sta_cmd.key.key_flags = key_flags; | 1269 | sta_cmd.key.key_flags = key_flags; |
| 1270 | sta_cmd.key.key_offset = WEP_INVALID_OFFSET; | 1270 | sta_cmd.key.key_offset = keyconf->hw_key_idx; |
| 1271 | sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK; | 1271 | sta_cmd.sta.modify_mask = STA_MODIFY_KEY_MASK; |
| 1272 | sta_cmd.mode = STA_CONTROL_MODIFY_MSK; | 1272 | sta_cmd.mode = STA_CONTROL_MODIFY_MSK; |
| 1273 | 1273 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index e7c157e5ebeb..7f97dec8534d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
| @@ -2239,6 +2239,7 @@ static ssize_t iwl_dbgfs_echo_test_write(struct file *file, | |||
| 2239 | return count; | 2239 | return count; |
| 2240 | } | 2240 | } |
| 2241 | 2241 | ||
| 2242 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
| 2242 | static ssize_t iwl_dbgfs_log_event_read(struct file *file, | 2243 | static ssize_t iwl_dbgfs_log_event_read(struct file *file, |
| 2243 | char __user *user_buf, | 2244 | char __user *user_buf, |
| 2244 | size_t count, loff_t *ppos) | 2245 | size_t count, loff_t *ppos) |
| @@ -2276,6 +2277,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file, | |||
| 2276 | 2277 | ||
| 2277 | return count; | 2278 | return count; |
| 2278 | } | 2279 | } |
| 2280 | #endif | ||
| 2279 | 2281 | ||
| 2280 | static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file, | 2282 | static ssize_t iwl_dbgfs_calib_disabled_read(struct file *file, |
| 2281 | char __user *user_buf, | 2283 | char __user *user_buf, |
| @@ -2345,7 +2347,9 @@ DEBUGFS_READ_FILE_OPS(bt_traffic); | |||
| 2345 | DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); | 2347 | DEBUGFS_READ_WRITE_FILE_OPS(protection_mode); |
| 2346 | DEBUGFS_READ_FILE_OPS(reply_tx_error); | 2348 | DEBUGFS_READ_FILE_OPS(reply_tx_error); |
| 2347 | DEBUGFS_WRITE_FILE_OPS(echo_test); | 2349 | DEBUGFS_WRITE_FILE_OPS(echo_test); |
| 2350 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
| 2348 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); | 2351 | DEBUGFS_READ_WRITE_FILE_OPS(log_event); |
| 2352 | #endif | ||
| 2349 | DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); | 2353 | DEBUGFS_READ_WRITE_FILE_OPS(calib_disabled); |
| 2350 | 2354 | ||
| 2351 | /* | 2355 | /* |
| @@ -2405,7 +2409,9 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name) | |||
| 2405 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); | 2409 | DEBUGFS_ADD_FILE(rxon_flags, dir_debug, S_IWUSR); |
| 2406 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); | 2410 | DEBUGFS_ADD_FILE(rxon_filter_flags, dir_debug, S_IWUSR); |
| 2407 | DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR); | 2411 | DEBUGFS_ADD_FILE(echo_test, dir_debug, S_IWUSR); |
| 2412 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
| 2408 | DEBUGFS_ADD_FILE(log_event, dir_debug, S_IWUSR | S_IRUSR); | 2413 | DEBUGFS_ADD_FILE(log_event, dir_debug, S_IWUSR | S_IRUSR); |
| 2414 | #endif | ||
| 2409 | 2415 | ||
| 2410 | if (iwl_advanced_bt_coexist(priv)) | 2416 | if (iwl_advanced_bt_coexist(priv)) |
| 2411 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); | 2417 | DEBUGFS_ADD_FILE(bt_traffic, dir_debug, S_IRUSR); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c index d742900969ea..fac67a526a30 100644 --- a/drivers/net/wireless/iwlwifi/iwl-drv.c +++ b/drivers/net/wireless/iwlwifi/iwl-drv.c | |||
| @@ -861,13 +861,18 @@ static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context) | |||
| 861 | 861 | ||
| 862 | /* We have our copies now, allow OS release its copies */ | 862 | /* We have our copies now, allow OS release its copies */ |
| 863 | release_firmware(ucode_raw); | 863 | release_firmware(ucode_raw); |
| 864 | complete(&drv->request_firmware_complete); | ||
| 865 | 864 | ||
| 866 | drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw); | 865 | drv->op_mode = iwl_dvm_ops.start(drv->trans, drv->cfg, &drv->fw); |
| 867 | 866 | ||
| 868 | if (!drv->op_mode) | 867 | if (!drv->op_mode) |
| 869 | goto out_free_fw; | 868 | goto out_unbind; |
| 870 | 869 | ||
| 870 | /* | ||
| 871 | * Complete the firmware request last so that | ||
| 872 | * a driver unbind (stop) doesn't run while we | ||
| 873 | * are doing the start() above. | ||
| 874 | */ | ||
| 875 | complete(&drv->request_firmware_complete); | ||
| 871 | return; | 876 | return; |
| 872 | 877 | ||
| 873 | try_again: | 878 | try_again: |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c index 50c58911e718..b8e2b223ac36 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c | |||
| @@ -568,28 +568,28 @@ static int iwl_find_otp_image(struct iwl_trans *trans, | |||
| 568 | * iwl_get_max_txpower_avg - get the highest tx power from all chains. | 568 | * iwl_get_max_txpower_avg - get the highest tx power from all chains. |
| 569 | * find the highest tx power from all chains for the channel | 569 | * find the highest tx power from all chains for the channel |
| 570 | */ | 570 | */ |
| 571 | static s8 iwl_get_max_txpower_avg(const struct iwl_cfg *cfg, | 571 | static s8 iwl_get_max_txpower_avg(struct iwl_priv *priv, |
| 572 | struct iwl_eeprom_enhanced_txpwr *enhanced_txpower, | 572 | struct iwl_eeprom_enhanced_txpwr *enhanced_txpower, |
| 573 | int element, s8 *max_txpower_in_half_dbm) | 573 | int element, s8 *max_txpower_in_half_dbm) |
| 574 | { | 574 | { |
| 575 | s8 max_txpower_avg = 0; /* (dBm) */ | 575 | s8 max_txpower_avg = 0; /* (dBm) */ |
| 576 | 576 | ||
| 577 | /* Take the highest tx power from any valid chains */ | 577 | /* Take the highest tx power from any valid chains */ |
| 578 | if ((cfg->valid_tx_ant & ANT_A) && | 578 | if ((priv->hw_params.valid_tx_ant & ANT_A) && |
| 579 | (enhanced_txpower[element].chain_a_max > max_txpower_avg)) | 579 | (enhanced_txpower[element].chain_a_max > max_txpower_avg)) |
| 580 | max_txpower_avg = enhanced_txpower[element].chain_a_max; | 580 | max_txpower_avg = enhanced_txpower[element].chain_a_max; |
| 581 | if ((cfg->valid_tx_ant & ANT_B) && | 581 | if ((priv->hw_params.valid_tx_ant & ANT_B) && |
| 582 | (enhanced_txpower[element].chain_b_max > max_txpower_avg)) | 582 | (enhanced_txpower[element].chain_b_max > max_txpower_avg)) |
| 583 | max_txpower_avg = enhanced_txpower[element].chain_b_max; | 583 | max_txpower_avg = enhanced_txpower[element].chain_b_max; |
| 584 | if ((cfg->valid_tx_ant & ANT_C) && | 584 | if ((priv->hw_params.valid_tx_ant & ANT_C) && |
| 585 | (enhanced_txpower[element].chain_c_max > max_txpower_avg)) | 585 | (enhanced_txpower[element].chain_c_max > max_txpower_avg)) |
| 586 | max_txpower_avg = enhanced_txpower[element].chain_c_max; | 586 | max_txpower_avg = enhanced_txpower[element].chain_c_max; |
| 587 | if (((cfg->valid_tx_ant == ANT_AB) | | 587 | if (((priv->hw_params.valid_tx_ant == ANT_AB) | |
| 588 | (cfg->valid_tx_ant == ANT_BC) | | 588 | (priv->hw_params.valid_tx_ant == ANT_BC) | |
| 589 | (cfg->valid_tx_ant == ANT_AC)) && | 589 | (priv->hw_params.valid_tx_ant == ANT_AC)) && |
| 590 | (enhanced_txpower[element].mimo2_max > max_txpower_avg)) | 590 | (enhanced_txpower[element].mimo2_max > max_txpower_avg)) |
| 591 | max_txpower_avg = enhanced_txpower[element].mimo2_max; | 591 | max_txpower_avg = enhanced_txpower[element].mimo2_max; |
| 592 | if ((cfg->valid_tx_ant == ANT_ABC) && | 592 | if ((priv->hw_params.valid_tx_ant == ANT_ABC) && |
| 593 | (enhanced_txpower[element].mimo3_max > max_txpower_avg)) | 593 | (enhanced_txpower[element].mimo3_max > max_txpower_avg)) |
| 594 | max_txpower_avg = enhanced_txpower[element].mimo3_max; | 594 | max_txpower_avg = enhanced_txpower[element].mimo3_max; |
| 595 | 595 | ||
| @@ -691,7 +691,7 @@ static void iwl_eeprom_enhanced_txpower(struct iwl_priv *priv) | |||
| 691 | ((txp->delta_20_in_40 & 0xf0) >> 4), | 691 | ((txp->delta_20_in_40 & 0xf0) >> 4), |
| 692 | (txp->delta_20_in_40 & 0x0f)); | 692 | (txp->delta_20_in_40 & 0x0f)); |
| 693 | 693 | ||
| 694 | max_txp_avg = iwl_get_max_txpower_avg(priv->cfg, txp_array, idx, | 694 | max_txp_avg = iwl_get_max_txpower_avg(priv, txp_array, idx, |
| 695 | &max_txp_avg_halfdbm); | 695 | &max_txp_avg_halfdbm); |
| 696 | 696 | ||
| 697 | /* | 697 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c index ab2f4d7500a4..013680332f07 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
| @@ -199,6 +199,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
| 199 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 199 | WIPHY_FLAG_DISABLE_BEACON_HINTS | |
| 200 | WIPHY_FLAG_IBSS_RSN; | 200 | WIPHY_FLAG_IBSS_RSN; |
| 201 | 201 | ||
| 202 | #ifdef CONFIG_PM_SLEEP | ||
| 202 | if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len && | 203 | if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len && |
| 203 | priv->trans->ops->wowlan_suspend && | 204 | priv->trans->ops->wowlan_suspend && |
| 204 | device_can_wakeup(priv->trans->dev)) { | 205 | device_can_wakeup(priv->trans->dev)) { |
| @@ -217,6 +218,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
| 217 | hw->wiphy->wowlan.pattern_max_len = | 218 | hw->wiphy->wowlan.pattern_max_len = |
| 218 | IWLAGN_WOWLAN_MAX_PATTERN_LEN; | 219 | IWLAGN_WOWLAN_MAX_PATTERN_LEN; |
| 219 | } | 220 | } |
| 221 | #endif | ||
| 220 | 222 | ||
| 221 | if (iwlwifi_mod_params.power_save) | 223 | if (iwlwifi_mod_params.power_save) |
| 222 | hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; | 224 | hw->wiphy->flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; |
| @@ -249,6 +251,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
| 249 | ret = ieee80211_register_hw(priv->hw); | 251 | ret = ieee80211_register_hw(priv->hw); |
| 250 | if (ret) { | 252 | if (ret) { |
| 251 | IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); | 253 | IWL_ERR(priv, "Failed to register hw (error %d)\n", ret); |
| 254 | iwl_leds_exit(priv); | ||
| 252 | return ret; | 255 | return ret; |
| 253 | } | 256 | } |
| 254 | priv->mac80211_registered = 1; | 257 | priv->mac80211_registered = 1; |
| @@ -793,6 +796,18 @@ int iwlagn_mac_sta_state(struct ieee80211_hw *hw, | |||
| 793 | switch (op) { | 796 | switch (op) { |
| 794 | case ADD: | 797 | case ADD: |
| 795 | ret = iwlagn_mac_sta_add(hw, vif, sta); | 798 | ret = iwlagn_mac_sta_add(hw, vif, sta); |
| 799 | if (ret) | ||
| 800 | break; | ||
| 801 | /* | ||
| 802 | * Clear the in-progress flag, the AP station entry was added | ||
| 803 | * but we'll initialize LQ only when we've associated (which | ||
| 804 | * would also clear the in-progress flag). This is necessary | ||
| 805 | * in case we never initialize LQ because association fails. | ||
| 806 | */ | ||
| 807 | spin_lock_bh(&priv->sta_lock); | ||
| 808 | priv->stations[iwl_sta_id(sta)].used &= | ||
| 809 | ~IWL_STA_UCODE_INPROGRESS; | ||
| 810 | spin_unlock_bh(&priv->sta_lock); | ||
| 796 | break; | 811 | break; |
| 797 | case REMOVE: | 812 | case REMOVE: |
| 798 | ret = iwlagn_mac_sta_remove(hw, vif, sta); | 813 | ret = iwlagn_mac_sta_remove(hw, vif, sta); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index 3b1069290fa9..dfd54662e3e6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
| @@ -224,6 +224,7 @@ | |||
| 224 | #define SCD_TXFACT (SCD_BASE + 0x10) | 224 | #define SCD_TXFACT (SCD_BASE + 0x10) |
| 225 | #define SCD_ACTIVE (SCD_BASE + 0x14) | 225 | #define SCD_ACTIVE (SCD_BASE + 0x14) |
| 226 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) | 226 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) |
| 227 | #define SCD_CHAINEXT_EN (SCD_BASE + 0x244) | ||
| 227 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) | 228 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) |
| 228 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) | 229 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) |
| 229 | 230 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index ec6fb395b84d..79c6b91417f9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
| @@ -1058,6 +1058,11 @@ static void iwl_tx_start(struct iwl_trans *trans) | |||
| 1058 | iwl_write_prph(trans, SCD_DRAM_BASE_ADDR, | 1058 | iwl_write_prph(trans, SCD_DRAM_BASE_ADDR, |
| 1059 | trans_pcie->scd_bc_tbls.dma >> 10); | 1059 | trans_pcie->scd_bc_tbls.dma >> 10); |
| 1060 | 1060 | ||
| 1061 | /* The chain extension of the SCD doesn't work well. This feature is | ||
| 1062 | * enabled by default by the HW, so we need to disable it manually. | ||
| 1063 | */ | ||
| 1064 | iwl_write_prph(trans, SCD_CHAINEXT_EN, 0); | ||
| 1065 | |||
| 1061 | /* Enable DMA channel */ | 1066 | /* Enable DMA channel */ |
| 1062 | for (chan = 0; chan < FH_TCSR_CHNL_NUM ; chan++) | 1067 | for (chan = 0; chan < FH_TCSR_CHNL_NUM ; chan++) |
| 1063 | iwl_write_direct32(trans, FH_TCSR_CHNL_TX_CONFIG_REG(chan), | 1068 | iwl_write_direct32(trans, FH_TCSR_CHNL_TX_CONFIG_REG(chan), |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index fb787df01666..a0b7cfd34685 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
| @@ -1555,6 +1555,7 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, | |||
| 1555 | hdr = (struct ieee80211_hdr *) skb->data; | 1555 | hdr = (struct ieee80211_hdr *) skb->data; |
| 1556 | mac80211_hwsim_monitor_ack(data2->hw, hdr->addr2); | 1556 | mac80211_hwsim_monitor_ack(data2->hw, hdr->addr2); |
| 1557 | } | 1557 | } |
| 1558 | txi->flags |= IEEE80211_TX_STAT_ACK; | ||
| 1558 | } | 1559 | } |
| 1559 | ieee80211_tx_status_irqsafe(data2->hw, skb); | 1560 | ieee80211_tx_status_irqsafe(data2->hw, skb); |
| 1560 | return 0; | 1561 | return 0; |
| @@ -1721,6 +1722,24 @@ static void hwsim_exit_netlink(void) | |||
| 1721 | "unregister family %i\n", ret); | 1722 | "unregister family %i\n", ret); |
| 1722 | } | 1723 | } |
| 1723 | 1724 | ||
| 1725 | static const struct ieee80211_iface_limit hwsim_if_limits[] = { | ||
| 1726 | { .max = 1, .types = BIT(NL80211_IFTYPE_ADHOC) }, | ||
| 1727 | { .max = 2048, .types = BIT(NL80211_IFTYPE_STATION) | | ||
| 1728 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | ||
| 1729 | #ifdef CONFIG_MAC80211_MESH | ||
| 1730 | BIT(NL80211_IFTYPE_MESH_POINT) | | ||
| 1731 | #endif | ||
| 1732 | BIT(NL80211_IFTYPE_AP) | | ||
| 1733 | BIT(NL80211_IFTYPE_P2P_GO) }, | ||
| 1734 | }; | ||
| 1735 | |||
| 1736 | static const struct ieee80211_iface_combination hwsim_if_comb = { | ||
| 1737 | .limits = hwsim_if_limits, | ||
| 1738 | .n_limits = ARRAY_SIZE(hwsim_if_limits), | ||
| 1739 | .max_interfaces = 2048, | ||
| 1740 | .num_different_channels = 1, | ||
| 1741 | }; | ||
| 1742 | |||
| 1724 | static int __init init_mac80211_hwsim(void) | 1743 | static int __init init_mac80211_hwsim(void) |
| 1725 | { | 1744 | { |
| 1726 | int i, err = 0; | 1745 | int i, err = 0; |
| @@ -1782,6 +1801,9 @@ static int __init init_mac80211_hwsim(void) | |||
| 1782 | hw->wiphy->n_addresses = 2; | 1801 | hw->wiphy->n_addresses = 2; |
| 1783 | hw->wiphy->addresses = data->addresses; | 1802 | hw->wiphy->addresses = data->addresses; |
| 1784 | 1803 | ||
| 1804 | hw->wiphy->iface_combinations = &hwsim_if_comb; | ||
| 1805 | hw->wiphy->n_iface_combinations = 1; | ||
| 1806 | |||
| 1785 | if (fake_hw_scan) { | 1807 | if (fake_hw_scan) { |
| 1786 | hw->wiphy->max_scan_ssids = 255; | 1808 | hw->wiphy->max_scan_ssids = 255; |
| 1787 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; | 1809 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c index 9c44088054dd..900ee129e825 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c | |||
| @@ -256,7 +256,8 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, | |||
| 256 | else | 256 | else |
| 257 | last_seq = priv->rx_seq[tid]; | 257 | last_seq = priv->rx_seq[tid]; |
| 258 | 258 | ||
| 259 | if (last_seq >= new_node->start_win) | 259 | if (last_seq != MWIFIEX_DEF_11N_RX_SEQ_NUM && |
| 260 | last_seq >= new_node->start_win) | ||
| 260 | new_node->start_win = last_seq + 1; | 261 | new_node->start_win = last_seq + 1; |
| 261 | 262 | ||
| 262 | new_node->win_size = win_size; | 263 | new_node->win_size = win_size; |
| @@ -596,5 +597,5 @@ void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv) | |||
| 596 | spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); | 597 | spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); |
| 597 | 598 | ||
| 598 | INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr); | 599 | INIT_LIST_HEAD(&priv->rx_reorder_tbl_ptr); |
| 599 | memset(priv->rx_seq, 0, sizeof(priv->rx_seq)); | 600 | mwifiex_reset_11n_rx_seq_num(priv); |
| 600 | } | 601 | } |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h index f1bffebabc60..6c9815a0f5d8 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.h +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h | |||
| @@ -37,6 +37,13 @@ | |||
| 37 | 37 | ||
| 38 | #define ADDBA_RSP_STATUS_ACCEPT 0 | 38 | #define ADDBA_RSP_STATUS_ACCEPT 0 |
| 39 | 39 | ||
| 40 | #define MWIFIEX_DEF_11N_RX_SEQ_NUM 0xffff | ||
| 41 | |||
| 42 | static inline void mwifiex_reset_11n_rx_seq_num(struct mwifiex_private *priv) | ||
| 43 | { | ||
| 44 | memset(priv->rx_seq, 0xff, sizeof(priv->rx_seq)); | ||
| 45 | } | ||
| 46 | |||
| 40 | int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *, | 47 | int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *, |
| 41 | u16 seqNum, | 48 | u16 seqNum, |
| 42 | u16 tid, u8 *ta, | 49 | u16 tid, u8 *ta, |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 87671446e24b..5c7fd185373c 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
| @@ -948,6 +948,20 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, | |||
| 948 | bss_cfg->ssid.ssid_len = params->ssid_len; | 948 | bss_cfg->ssid.ssid_len = params->ssid_len; |
| 949 | } | 949 | } |
| 950 | 950 | ||
| 951 | switch (params->hidden_ssid) { | ||
| 952 | case NL80211_HIDDEN_SSID_NOT_IN_USE: | ||
| 953 | bss_cfg->bcast_ssid_ctl = 1; | ||
| 954 | break; | ||
| 955 | case NL80211_HIDDEN_SSID_ZERO_LEN: | ||
| 956 | bss_cfg->bcast_ssid_ctl = 0; | ||
| 957 | break; | ||
| 958 | case NL80211_HIDDEN_SSID_ZERO_CONTENTS: | ||
| 959 | /* firmware doesn't support this type of hidden SSID */ | ||
| 960 | default: | ||
| 961 | kfree(bss_cfg); | ||
| 962 | return -EINVAL; | ||
| 963 | } | ||
| 964 | |||
| 951 | if (mwifiex_set_secure_params(priv, bss_cfg, params)) { | 965 | if (mwifiex_set_secure_params(priv, bss_cfg, params)) { |
| 952 | kfree(bss_cfg); | 966 | kfree(bss_cfg); |
| 953 | wiphy_err(wiphy, "Failed to parse secuirty parameters!\n"); | 967 | wiphy_err(wiphy, "Failed to parse secuirty parameters!\n"); |
| @@ -1471,7 +1485,7 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
| 1471 | struct wireless_dev *wdev; | 1485 | struct wireless_dev *wdev; |
| 1472 | 1486 | ||
| 1473 | if (!adapter) | 1487 | if (!adapter) |
| 1474 | return NULL; | 1488 | return ERR_PTR(-EFAULT); |
| 1475 | 1489 | ||
| 1476 | switch (type) { | 1490 | switch (type) { |
| 1477 | case NL80211_IFTYPE_UNSPECIFIED: | 1491 | case NL80211_IFTYPE_UNSPECIFIED: |
| @@ -1481,12 +1495,12 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
| 1481 | if (priv->bss_mode) { | 1495 | if (priv->bss_mode) { |
| 1482 | wiphy_err(wiphy, | 1496 | wiphy_err(wiphy, |
| 1483 | "cannot create multiple sta/adhoc ifaces\n"); | 1497 | "cannot create multiple sta/adhoc ifaces\n"); |
| 1484 | return NULL; | 1498 | return ERR_PTR(-EINVAL); |
| 1485 | } | 1499 | } |
| 1486 | 1500 | ||
| 1487 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); | 1501 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); |
| 1488 | if (!wdev) | 1502 | if (!wdev) |
| 1489 | return NULL; | 1503 | return ERR_PTR(-ENOMEM); |
| 1490 | 1504 | ||
| 1491 | wdev->wiphy = wiphy; | 1505 | wdev->wiphy = wiphy; |
| 1492 | priv->wdev = wdev; | 1506 | priv->wdev = wdev; |
| @@ -1509,12 +1523,12 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
| 1509 | 1523 | ||
| 1510 | if (priv->bss_mode) { | 1524 | if (priv->bss_mode) { |
| 1511 | wiphy_err(wiphy, "Can't create multiple AP interfaces"); | 1525 | wiphy_err(wiphy, "Can't create multiple AP interfaces"); |
| 1512 | return NULL; | 1526 | return ERR_PTR(-EINVAL); |
| 1513 | } | 1527 | } |
| 1514 | 1528 | ||
| 1515 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); | 1529 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); |
| 1516 | if (!wdev) | 1530 | if (!wdev) |
| 1517 | return NULL; | 1531 | return ERR_PTR(-ENOMEM); |
| 1518 | 1532 | ||
| 1519 | priv->wdev = wdev; | 1533 | priv->wdev = wdev; |
| 1520 | wdev->wiphy = wiphy; | 1534 | wdev->wiphy = wiphy; |
| @@ -1531,14 +1545,15 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
| 1531 | break; | 1545 | break; |
| 1532 | default: | 1546 | default: |
| 1533 | wiphy_err(wiphy, "type not supported\n"); | 1547 | wiphy_err(wiphy, "type not supported\n"); |
| 1534 | return NULL; | 1548 | return ERR_PTR(-EINVAL); |
| 1535 | } | 1549 | } |
| 1536 | 1550 | ||
| 1537 | dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), name, | 1551 | dev = alloc_netdev_mq(sizeof(struct mwifiex_private *), name, |
| 1538 | ether_setup, 1); | 1552 | ether_setup, 1); |
| 1539 | if (!dev) { | 1553 | if (!dev) { |
| 1540 | wiphy_err(wiphy, "no memory available for netdevice\n"); | 1554 | wiphy_err(wiphy, "no memory available for netdevice\n"); |
| 1541 | goto error; | 1555 | priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; |
| 1556 | return ERR_PTR(-ENOMEM); | ||
| 1542 | } | 1557 | } |
| 1543 | 1558 | ||
| 1544 | mwifiex_init_priv_params(priv, dev); | 1559 | mwifiex_init_priv_params(priv, dev); |
| @@ -1569,7 +1584,9 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
| 1569 | /* Register network device */ | 1584 | /* Register network device */ |
| 1570 | if (register_netdevice(dev)) { | 1585 | if (register_netdevice(dev)) { |
| 1571 | wiphy_err(wiphy, "cannot register virtual network device\n"); | 1586 | wiphy_err(wiphy, "cannot register virtual network device\n"); |
| 1572 | goto error; | 1587 | free_netdev(dev); |
| 1588 | priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; | ||
| 1589 | return ERR_PTR(-EFAULT); | ||
| 1573 | } | 1590 | } |
| 1574 | 1591 | ||
| 1575 | sema_init(&priv->async_sem, 1); | 1592 | sema_init(&priv->async_sem, 1); |
| @@ -1581,12 +1598,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
| 1581 | mwifiex_dev_debugfs_init(priv); | 1598 | mwifiex_dev_debugfs_init(priv); |
| 1582 | #endif | 1599 | #endif |
| 1583 | return dev; | 1600 | return dev; |
| 1584 | error: | ||
| 1585 | if (dev && (dev->reg_state == NETREG_UNREGISTERED)) | ||
| 1586 | free_netdev(dev); | ||
| 1587 | priv->bss_mode = NL80211_IFTYPE_UNSPECIFIED; | ||
| 1588 | |||
| 1589 | return NULL; | ||
| 1590 | } | 1601 | } |
| 1591 | EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf); | 1602 | EXPORT_SYMBOL_GPL(mwifiex_add_virtual_intf); |
| 1592 | 1603 | ||
diff --git a/drivers/net/wireless/mwifiex/fw.h b/drivers/net/wireless/mwifiex/fw.h index 9f674bbebe65..561452a5c818 100644 --- a/drivers/net/wireless/mwifiex/fw.h +++ b/drivers/net/wireless/mwifiex/fw.h | |||
| @@ -122,6 +122,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER { | |||
| 122 | #define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42) | 122 | #define TLV_TYPE_CHANNELBANDLIST (PROPRIETARY_TLV_BASE_ID + 42) |
| 123 | #define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44) | 123 | #define TLV_TYPE_UAP_BEACON_PERIOD (PROPRIETARY_TLV_BASE_ID + 44) |
| 124 | #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) | 124 | #define TLV_TYPE_UAP_DTIM_PERIOD (PROPRIETARY_TLV_BASE_ID + 45) |
| 125 | #define TLV_TYPE_UAP_BCAST_SSID (PROPRIETARY_TLV_BASE_ID + 48) | ||
| 125 | #define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51) | 126 | #define TLV_TYPE_UAP_RTS_THRESHOLD (PROPRIETARY_TLV_BASE_ID + 51) |
| 126 | #define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60) | 127 | #define TLV_TYPE_UAP_WPA_PASSPHRASE (PROPRIETARY_TLV_BASE_ID + 60) |
| 127 | #define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64) | 128 | #define TLV_TYPE_UAP_ENCRY_PROTOCOL (PROPRIETARY_TLV_BASE_ID + 64) |
| @@ -1209,6 +1210,11 @@ struct host_cmd_tlv_ssid { | |||
| 1209 | u8 ssid[0]; | 1210 | u8 ssid[0]; |
| 1210 | } __packed; | 1211 | } __packed; |
| 1211 | 1212 | ||
| 1213 | struct host_cmd_tlv_bcast_ssid { | ||
| 1214 | struct host_cmd_tlv tlv; | ||
| 1215 | u8 bcast_ctl; | ||
| 1216 | } __packed; | ||
| 1217 | |||
| 1212 | struct host_cmd_tlv_beacon_period { | 1218 | struct host_cmd_tlv_beacon_period { |
| 1213 | struct host_cmd_tlv tlv; | 1219 | struct host_cmd_tlv tlv; |
| 1214 | __le16 period; | 1220 | __le16 period; |
diff --git a/drivers/net/wireless/mwifiex/ie.c b/drivers/net/wireless/mwifiex/ie.c index ceb82cd749cc..383820a52beb 100644 --- a/drivers/net/wireless/mwifiex/ie.c +++ b/drivers/net/wireless/mwifiex/ie.c | |||
| @@ -213,6 +213,7 @@ mwifiex_update_uap_custom_ie(struct mwifiex_private *priv, | |||
| 213 | /* save assoc resp ie index after auto-indexing */ | 213 | /* save assoc resp ie index after auto-indexing */ |
| 214 | *assoc_idx = *((u16 *)pos); | 214 | *assoc_idx = *((u16 *)pos); |
| 215 | 215 | ||
| 216 | kfree(ap_custom_ie); | ||
| 216 | return ret; | 217 | return ret; |
| 217 | } | 218 | } |
| 218 | 219 | ||
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c index e0377473282f..fc8a9bfa1248 100644 --- a/drivers/net/wireless/mwifiex/sdio.c +++ b/drivers/net/wireless/mwifiex/sdio.c | |||
| @@ -978,10 +978,10 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter, | |||
| 978 | dev_dbg(adapter->dev, "info: --- Rx: Event ---\n"); | 978 | dev_dbg(adapter->dev, "info: --- Rx: Event ---\n"); |
| 979 | adapter->event_cause = *(u32 *) skb->data; | 979 | adapter->event_cause = *(u32 *) skb->data; |
| 980 | 980 | ||
| 981 | skb_pull(skb, MWIFIEX_EVENT_HEADER_LEN); | ||
| 982 | |||
| 983 | if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE)) | 981 | if ((skb->len > 0) && (skb->len < MAX_EVENT_SIZE)) |
| 984 | memcpy(adapter->event_body, skb->data, skb->len); | 982 | memcpy(adapter->event_body, |
| 983 | skb->data + MWIFIEX_EVENT_HEADER_LEN, | ||
| 984 | skb->len); | ||
| 985 | 985 | ||
| 986 | /* event cause has been saved to adapter->event_cause */ | 986 | /* event cause has been saved to adapter->event_cause */ |
| 987 | adapter->event_received = true; | 987 | adapter->event_received = true; |
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c index 4ace5a3dcd23..11e731f3581c 100644 --- a/drivers/net/wireless/mwifiex/sta_event.c +++ b/drivers/net/wireless/mwifiex/sta_event.c | |||
| @@ -406,9 +406,9 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
| 406 | break; | 406 | break; |
| 407 | 407 | ||
| 408 | case EVENT_UAP_STA_ASSOC: | 408 | case EVENT_UAP_STA_ASSOC: |
| 409 | skb_pull(adapter->event_skb, MWIFIEX_UAP_EVENT_EXTRA_HEADER); | ||
| 410 | memset(&sinfo, 0, sizeof(sinfo)); | 409 | memset(&sinfo, 0, sizeof(sinfo)); |
| 411 | event = (struct mwifiex_assoc_event *)adapter->event_skb->data; | 410 | event = (struct mwifiex_assoc_event *) |
| 411 | (adapter->event_body + MWIFIEX_UAP_EVENT_EXTRA_HEADER); | ||
| 412 | if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) { | 412 | if (le16_to_cpu(event->type) == TLV_TYPE_UAP_MGMT_FRAME) { |
| 413 | len = -1; | 413 | len = -1; |
| 414 | 414 | ||
| @@ -433,9 +433,8 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv) | |||
| 433 | GFP_KERNEL); | 433 | GFP_KERNEL); |
| 434 | break; | 434 | break; |
| 435 | case EVENT_UAP_STA_DEAUTH: | 435 | case EVENT_UAP_STA_DEAUTH: |
| 436 | skb_pull(adapter->event_skb, MWIFIEX_UAP_EVENT_EXTRA_HEADER); | 436 | cfg80211_del_sta(priv->netdev, adapter->event_body + |
| 437 | cfg80211_del_sta(priv->netdev, adapter->event_skb->data, | 437 | MWIFIEX_UAP_EVENT_EXTRA_HEADER, GFP_KERNEL); |
| 438 | GFP_KERNEL); | ||
| 439 | break; | 438 | break; |
| 440 | case EVENT_UAP_BSS_IDLE: | 439 | case EVENT_UAP_BSS_IDLE: |
| 441 | priv->media_connected = false; | 440 | priv->media_connected = false; |
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c index e2faec4db108..cecb27283196 100644 --- a/drivers/net/wireless/mwifiex/txrx.c +++ b/drivers/net/wireless/mwifiex/txrx.c | |||
| @@ -161,15 +161,11 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, | |||
| 161 | goto done; | 161 | goto done; |
| 162 | 162 | ||
| 163 | for (i = 0; i < adapter->priv_num; i++) { | 163 | for (i = 0; i < adapter->priv_num; i++) { |
| 164 | |||
| 165 | tpriv = adapter->priv[i]; | 164 | tpriv = adapter->priv[i]; |
| 166 | 165 | ||
| 167 | if ((GET_BSS_ROLE(tpriv) == MWIFIEX_BSS_ROLE_STA) && | 166 | if (tpriv->media_connected && |
| 168 | (tpriv->media_connected)) { | 167 | netif_queue_stopped(tpriv->netdev)) |
| 169 | if (netif_queue_stopped(tpriv->netdev)) | 168 | mwifiex_wake_up_net_dev_queue(tpriv->netdev, adapter); |
| 170 | mwifiex_wake_up_net_dev_queue(tpriv->netdev, | ||
| 171 | adapter); | ||
| 172 | } | ||
| 173 | } | 169 | } |
| 174 | done: | 170 | done: |
| 175 | dev_kfree_skb_any(skb); | 171 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/wireless/mwifiex/uap_cmd.c b/drivers/net/wireless/mwifiex/uap_cmd.c index 76dfbc42a732..89f9a2a45de3 100644 --- a/drivers/net/wireless/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/mwifiex/uap_cmd.c | |||
| @@ -27,6 +27,17 @@ int mwifiex_set_secure_params(struct mwifiex_private *priv, | |||
| 27 | struct cfg80211_ap_settings *params) { | 27 | struct cfg80211_ap_settings *params) { |
| 28 | int i; | 28 | int i; |
| 29 | 29 | ||
| 30 | if (!params->privacy) { | ||
| 31 | bss_config->protocol = PROTOCOL_NO_SECURITY; | ||
| 32 | bss_config->key_mgmt = KEY_MGMT_NONE; | ||
| 33 | bss_config->wpa_cfg.length = 0; | ||
| 34 | priv->sec_info.wep_enabled = 0; | ||
| 35 | priv->sec_info.wpa_enabled = 0; | ||
| 36 | priv->sec_info.wpa2_enabled = 0; | ||
| 37 | |||
| 38 | return 0; | ||
| 39 | } | ||
| 40 | |||
| 30 | switch (params->auth_type) { | 41 | switch (params->auth_type) { |
| 31 | case NL80211_AUTHTYPE_OPEN_SYSTEM: | 42 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
| 32 | bss_config->auth_mode = WLAN_AUTH_OPEN; | 43 | bss_config->auth_mode = WLAN_AUTH_OPEN; |
| @@ -132,6 +143,7 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) | |||
| 132 | struct host_cmd_tlv_dtim_period *dtim_period; | 143 | struct host_cmd_tlv_dtim_period *dtim_period; |
| 133 | struct host_cmd_tlv_beacon_period *beacon_period; | 144 | struct host_cmd_tlv_beacon_period *beacon_period; |
| 134 | struct host_cmd_tlv_ssid *ssid; | 145 | struct host_cmd_tlv_ssid *ssid; |
| 146 | struct host_cmd_tlv_bcast_ssid *bcast_ssid; | ||
| 135 | struct host_cmd_tlv_channel_band *chan_band; | 147 | struct host_cmd_tlv_channel_band *chan_band; |
| 136 | struct host_cmd_tlv_frag_threshold *frag_threshold; | 148 | struct host_cmd_tlv_frag_threshold *frag_threshold; |
| 137 | struct host_cmd_tlv_rts_threshold *rts_threshold; | 149 | struct host_cmd_tlv_rts_threshold *rts_threshold; |
| @@ -153,6 +165,14 @@ mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) | |||
| 153 | cmd_size += sizeof(struct host_cmd_tlv) + | 165 | cmd_size += sizeof(struct host_cmd_tlv) + |
| 154 | bss_cfg->ssid.ssid_len; | 166 | bss_cfg->ssid.ssid_len; |
| 155 | tlv += sizeof(struct host_cmd_tlv) + bss_cfg->ssid.ssid_len; | 167 | tlv += sizeof(struct host_cmd_tlv) + bss_cfg->ssid.ssid_len; |
| 168 | |||
| 169 | bcast_ssid = (struct host_cmd_tlv_bcast_ssid *)tlv; | ||
| 170 | bcast_ssid->tlv.type = cpu_to_le16(TLV_TYPE_UAP_BCAST_SSID); | ||
| 171 | bcast_ssid->tlv.len = | ||
| 172 | cpu_to_le16(sizeof(bcast_ssid->bcast_ctl)); | ||
| 173 | bcast_ssid->bcast_ctl = bss_cfg->bcast_ssid_ctl; | ||
| 174 | cmd_size += sizeof(struct host_cmd_tlv_bcast_ssid); | ||
| 175 | tlv += sizeof(struct host_cmd_tlv_bcast_ssid); | ||
| 156 | } | 176 | } |
| 157 | if (bss_cfg->channel && bss_cfg->channel <= MAX_CHANNEL_BAND_BG) { | 177 | if (bss_cfg->channel && bss_cfg->channel <= MAX_CHANNEL_BAND_BG) { |
| 158 | chan_band = (struct host_cmd_tlv_channel_band *)tlv; | 178 | chan_band = (struct host_cmd_tlv_channel_band *)tlv; |
| @@ -416,6 +436,7 @@ int mwifiex_uap_set_channel(struct mwifiex_private *priv, int channel) | |||
| 416 | if (!bss_cfg) | 436 | if (!bss_cfg) |
| 417 | return -ENOMEM; | 437 | return -ENOMEM; |
| 418 | 438 | ||
| 439 | mwifiex_set_sys_config_invalid_data(bss_cfg); | ||
| 419 | bss_cfg->band_cfg = BAND_CONFIG_MANUAL; | 440 | bss_cfg->band_cfg = BAND_CONFIG_MANUAL; |
| 420 | bss_cfg->channel = channel; | 441 | bss_cfg->channel = channel; |
| 421 | 442 | ||
diff --git a/drivers/net/wireless/mwifiex/usb.c b/drivers/net/wireless/mwifiex/usb.c index 49ebf20c56eb..22a5916564b8 100644 --- a/drivers/net/wireless/mwifiex/usb.c +++ b/drivers/net/wireless/mwifiex/usb.c | |||
| @@ -49,6 +49,7 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
| 49 | struct device *dev = adapter->dev; | 49 | struct device *dev = adapter->dev; |
| 50 | u32 recv_type; | 50 | u32 recv_type; |
| 51 | __le32 tmp; | 51 | __le32 tmp; |
| 52 | int ret; | ||
| 52 | 53 | ||
| 53 | if (adapter->hs_activated) | 54 | if (adapter->hs_activated) |
| 54 | mwifiex_process_hs_config(adapter); | 55 | mwifiex_process_hs_config(adapter); |
| @@ -69,16 +70,19 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
| 69 | case MWIFIEX_USB_TYPE_CMD: | 70 | case MWIFIEX_USB_TYPE_CMD: |
| 70 | if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { | 71 | if (skb->len > MWIFIEX_SIZE_OF_CMD_BUFFER) { |
| 71 | dev_err(dev, "CMD: skb->len too large\n"); | 72 | dev_err(dev, "CMD: skb->len too large\n"); |
| 72 | return -1; | 73 | ret = -1; |
| 74 | goto exit_restore_skb; | ||
| 73 | } else if (!adapter->curr_cmd) { | 75 | } else if (!adapter->curr_cmd) { |
| 74 | dev_dbg(dev, "CMD: no curr_cmd\n"); | 76 | dev_dbg(dev, "CMD: no curr_cmd\n"); |
| 75 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { | 77 | if (adapter->ps_state == PS_STATE_SLEEP_CFM) { |
| 76 | mwifiex_process_sleep_confirm_resp( | 78 | mwifiex_process_sleep_confirm_resp( |
| 77 | adapter, skb->data, | 79 | adapter, skb->data, |
| 78 | skb->len); | 80 | skb->len); |
| 79 | return 0; | 81 | ret = 0; |
| 82 | goto exit_restore_skb; | ||
| 80 | } | 83 | } |
| 81 | return -1; | 84 | ret = -1; |
| 85 | goto exit_restore_skb; | ||
| 82 | } | 86 | } |
| 83 | 87 | ||
| 84 | adapter->curr_cmd->resp_skb = skb; | 88 | adapter->curr_cmd->resp_skb = skb; |
| @@ -87,20 +91,22 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
| 87 | case MWIFIEX_USB_TYPE_EVENT: | 91 | case MWIFIEX_USB_TYPE_EVENT: |
| 88 | if (skb->len < sizeof(u32)) { | 92 | if (skb->len < sizeof(u32)) { |
| 89 | dev_err(dev, "EVENT: skb->len too small\n"); | 93 | dev_err(dev, "EVENT: skb->len too small\n"); |
| 90 | return -1; | 94 | ret = -1; |
| 95 | goto exit_restore_skb; | ||
| 91 | } | 96 | } |
| 92 | skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); | 97 | skb_copy_from_linear_data(skb, &tmp, sizeof(u32)); |
| 93 | adapter->event_cause = le32_to_cpu(tmp); | 98 | adapter->event_cause = le32_to_cpu(tmp); |
| 94 | skb_pull(skb, sizeof(u32)); | ||
| 95 | dev_dbg(dev, "event_cause %#x\n", adapter->event_cause); | 99 | dev_dbg(dev, "event_cause %#x\n", adapter->event_cause); |
| 96 | 100 | ||
| 97 | if (skb->len > MAX_EVENT_SIZE) { | 101 | if (skb->len > MAX_EVENT_SIZE) { |
| 98 | dev_err(dev, "EVENT: event body too large\n"); | 102 | dev_err(dev, "EVENT: event body too large\n"); |
| 99 | return -1; | 103 | ret = -1; |
| 104 | goto exit_restore_skb; | ||
| 100 | } | 105 | } |
| 101 | 106 | ||
| 102 | skb_copy_from_linear_data(skb, adapter->event_body, | 107 | memcpy(adapter->event_body, skb->data + |
| 103 | skb->len); | 108 | MWIFIEX_EVENT_HEADER_LEN, skb->len); |
| 109 | |||
| 104 | adapter->event_received = true; | 110 | adapter->event_received = true; |
| 105 | adapter->event_skb = skb; | 111 | adapter->event_skb = skb; |
| 106 | break; | 112 | break; |
| @@ -124,6 +130,12 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter, | |||
| 124 | } | 130 | } |
| 125 | 131 | ||
| 126 | return -EINPROGRESS; | 132 | return -EINPROGRESS; |
| 133 | |||
| 134 | exit_restore_skb: | ||
| 135 | /* The buffer will be reused for further cmds/events */ | ||
| 136 | skb_push(skb, INTF_HEADER_LEN); | ||
| 137 | |||
| 138 | return ret; | ||
| 127 | } | 139 | } |
| 128 | 140 | ||
| 129 | static void mwifiex_usb_rx_complete(struct urb *urb) | 141 | static void mwifiex_usb_rx_complete(struct urb *urb) |
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c index f3fc65515857..3fa4d4176993 100644 --- a/drivers/net/wireless/mwifiex/wmm.c +++ b/drivers/net/wireless/mwifiex/wmm.c | |||
| @@ -404,6 +404,8 @@ mwifiex_wmm_init(struct mwifiex_adapter *adapter) | |||
| 404 | priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE; | 404 | priv->add_ba_param.tx_win_size = MWIFIEX_AMPDU_DEF_TXWINSIZE; |
| 405 | priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE; | 405 | priv->add_ba_param.rx_win_size = MWIFIEX_AMPDU_DEF_RXWINSIZE; |
| 406 | 406 | ||
| 407 | mwifiex_reset_11n_rx_seq_num(priv); | ||
| 408 | |||
| 407 | atomic_set(&priv->wmm.tx_pkts_queued, 0); | 409 | atomic_set(&priv->wmm.tx_pkts_queued, 0); |
| 408 | atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); | 410 | atomic_set(&priv->wmm.highest_queued_prio, HIGH_PRIO_TID); |
| 409 | } | 411 | } |
| @@ -1221,6 +1223,7 @@ mwifiex_dequeue_tx_packet(struct mwifiex_adapter *adapter) | |||
| 1221 | 1223 | ||
| 1222 | if (!ptr->is_11n_enabled || | 1224 | if (!ptr->is_11n_enabled || |
| 1223 | mwifiex_is_ba_stream_setup(priv, ptr, tid) || | 1225 | mwifiex_is_ba_stream_setup(priv, ptr, tid) || |
| 1226 | priv->wps.session_enable || | ||
| 1224 | ((priv->sec_info.wpa_enabled || | 1227 | ((priv->sec_info.wpa_enabled || |
| 1225 | priv->sec_info.wpa2_enabled) && | 1228 | priv->sec_info.wpa2_enabled) && |
| 1226 | !priv->wpa_is_gtk_set)) { | 1229 | !priv->wpa_is_gtk_set)) { |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 2e9e6af21362..dfcd02ab6cae 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
| @@ -2110,7 +2110,7 @@ resize_buf: | |||
| 2110 | while (check_bssid_list_item(bssid, bssid_len, buf, len)) { | 2110 | while (check_bssid_list_item(bssid, bssid_len, buf, len)) { |
| 2111 | if (rndis_bss_info_update(usbdev, bssid) && match_bssid && | 2111 | if (rndis_bss_info_update(usbdev, bssid) && match_bssid && |
| 2112 | matched) { | 2112 | matched) { |
| 2113 | if (!ether_addr_equal(bssid->mac, match_bssid)) | 2113 | if (ether_addr_equal(bssid->mac, match_bssid)) |
| 2114 | *matched = true; | 2114 | *matched = true; |
| 2115 | } | 2115 | } |
| 2116 | 2116 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index ca36cccaba31..8f754025b06e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
| @@ -396,8 +396,7 @@ struct rt2x00_intf { | |||
| 396 | * for hardware which doesn't support hardware | 396 | * for hardware which doesn't support hardware |
| 397 | * sequence counting. | 397 | * sequence counting. |
| 398 | */ | 398 | */ |
| 399 | spinlock_t seqlock; | 399 | atomic_t seqno; |
| 400 | u16 seqno; | ||
| 401 | }; | 400 | }; |
| 402 | 401 | ||
| 403 | static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif) | 402 | static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index b49773ef72f2..dd24b2663b5e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
| @@ -277,7 +277,6 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
| 277 | else | 277 | else |
| 278 | rt2x00dev->intf_sta_count++; | 278 | rt2x00dev->intf_sta_count++; |
| 279 | 279 | ||
| 280 | spin_lock_init(&intf->seqlock); | ||
| 281 | mutex_init(&intf->beacon_skb_mutex); | 280 | mutex_init(&intf->beacon_skb_mutex); |
| 282 | intf->beacon = entry; | 281 | intf->beacon = entry; |
| 283 | 282 | ||
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 4c662eccf53c..2fd830103415 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
| @@ -207,6 +207,7 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev, | |||
| 207 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 207 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
| 208 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 208 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
| 209 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); | 209 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); |
| 210 | u16 seqno; | ||
| 210 | 211 | ||
| 211 | if (!(tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) | 212 | if (!(tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ)) |
| 212 | return; | 213 | return; |
| @@ -238,15 +239,13 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev, | |||
| 238 | * sequence counting per-frame, since those will override the | 239 | * sequence counting per-frame, since those will override the |
| 239 | * sequence counter given by mac80211. | 240 | * sequence counter given by mac80211. |
| 240 | */ | 241 | */ |
| 241 | spin_lock(&intf->seqlock); | ||
| 242 | |||
| 243 | if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) | 242 | if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags)) |
| 244 | intf->seqno += 0x10; | 243 | seqno = atomic_add_return(0x10, &intf->seqno); |
| 245 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | 244 | else |
| 246 | hdr->seq_ctrl |= cpu_to_le16(intf->seqno); | 245 | seqno = atomic_read(&intf->seqno); |
| 247 | |||
| 248 | spin_unlock(&intf->seqlock); | ||
| 249 | 246 | ||
| 247 | hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG); | ||
| 248 | hdr->seq_ctrl |= cpu_to_le16(seqno); | ||
| 250 | } | 249 | } |
| 251 | 250 | ||
| 252 | static void rt2x00queue_create_tx_descriptor_plcp(struct rt2x00_dev *rt2x00dev, | 251 | static void rt2x00queue_create_tx_descriptor_plcp(struct rt2x00_dev *rt2x00dev, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index d357d1ed92f6..74ecc33fdd90 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
| @@ -436,8 +436,8 @@ void rt2x00usb_kick_queue(struct data_queue *queue) | |||
| 436 | case QID_RX: | 436 | case QID_RX: |
| 437 | if (!rt2x00queue_full(queue)) | 437 | if (!rt2x00queue_full(queue)) |
| 438 | rt2x00queue_for_each_entry(queue, | 438 | rt2x00queue_for_each_entry(queue, |
| 439 | Q_INDEX_DONE, | ||
| 440 | Q_INDEX, | 439 | Q_INDEX, |
| 440 | Q_INDEX_DONE, | ||
| 441 | NULL, | 441 | NULL, |
| 442 | rt2x00usb_kick_rx_entry); | 442 | rt2x00usb_kick_rx_entry); |
| 443 | break; | 443 | break; |
diff --git a/drivers/net/wireless/rtl818x/rtl8187/leds.c b/drivers/net/wireless/rtl818x/rtl8187/leds.c index 2e0de2f5f0f9..c2d5b495c179 100644 --- a/drivers/net/wireless/rtl818x/rtl8187/leds.c +++ b/drivers/net/wireless/rtl818x/rtl8187/leds.c | |||
| @@ -117,7 +117,7 @@ static void rtl8187_led_brightness_set(struct led_classdev *led_dev, | |||
| 117 | radio_on = true; | 117 | radio_on = true; |
| 118 | } else if (radio_on) { | 118 | } else if (radio_on) { |
| 119 | radio_on = false; | 119 | radio_on = false; |
| 120 | cancel_delayed_work_sync(&priv->led_on); | 120 | cancel_delayed_work(&priv->led_on); |
| 121 | ieee80211_queue_delayed_work(hw, &priv->led_off, 0); | 121 | ieee80211_queue_delayed_work(hw, &priv->led_off, 0); |
| 122 | } | 122 | } |
| 123 | } else if (radio_on) { | 123 | } else if (radio_on) { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index d228358e6a40..9970c2b1b199 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
| @@ -301,9 +301,11 @@ static struct usb_device_id rtl8192c_usb_ids[] = { | |||
| 301 | {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ | 301 | {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/ |
| 302 | {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ | 302 | {RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/ |
| 303 | {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ | 303 | {RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/ |
| 304 | {RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/ | ||
| 304 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | 305 | {RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
| 305 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ | 306 | {RTL_USB_DEVICE(0x0df6, 0x005c, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/ |
| 306 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ | 307 | {RTL_USB_DEVICE(0x0eb0, 0x9071, rtl92cu_hal_cfg)}, /*NO Brand - Etop*/ |
| 308 | {RTL_USB_DEVICE(0x4856, 0x0091, rtl92cu_hal_cfg)}, /*NetweeN - Feixun*/ | ||
| 307 | /* HP - Lite-On ,8188CUS Slim Combo */ | 309 | /* HP - Lite-On ,8188CUS Slim Combo */ |
| 308 | {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, | 310 | {RTL_USB_DEVICE(0x103c, 0x1629, rtl92cu_hal_cfg)}, |
| 309 | {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */ | 311 | {RTL_USB_DEVICE(0x13d3, 0x3357, rtl92cu_hal_cfg)}, /* AzureWave */ |
| @@ -346,6 +348,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = { | |||
| 346 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ | 348 | {RTL_USB_DEVICE(0x07b8, 0x8178, rtl92cu_hal_cfg)}, /*Funai -Abocom*/ |
| 347 | {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ | 349 | {RTL_USB_DEVICE(0x0846, 0x9021, rtl92cu_hal_cfg)}, /*Netgear-Sercomm*/ |
| 348 | {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ | 350 | {RTL_USB_DEVICE(0x0b05, 0x17ab, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/ |
| 351 | {RTL_USB_DEVICE(0x0bda, 0x8186, rtl92cu_hal_cfg)}, /*Realtek 92CE-VAU*/ | ||
| 349 | {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ | 352 | {RTL_USB_DEVICE(0x0df6, 0x0061, rtl92cu_hal_cfg)}, /*Sitecom-Edimax*/ |
| 350 | {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/ | 353 | {RTL_USB_DEVICE(0x0e66, 0x0019, rtl92cu_hal_cfg)}, /*Hawking-Edimax*/ |
| 351 | {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/ | 354 | {RTL_USB_DEVICE(0x2001, 0x3307, rtl92cu_hal_cfg)}, /*D-Link-Cameo*/ |
diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c index ad87a1ac6462..db6430c1a084 100644 --- a/drivers/net/wireless/ti/wl1251/acx.c +++ b/drivers/net/wireless/ti/wl1251/acx.c | |||
| @@ -869,7 +869,7 @@ int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime) | |||
| 869 | } | 869 | } |
| 870 | 870 | ||
| 871 | *mactime = tsf_info->current_tsf_lsb | | 871 | *mactime = tsf_info->current_tsf_lsb | |
| 872 | (tsf_info->current_tsf_msb << 31); | 872 | ((u64)tsf_info->current_tsf_msb << 32); |
| 873 | 873 | ||
| 874 | out: | 874 | out: |
| 875 | kfree(tsf_info); | 875 | kfree(tsf_info); |
diff --git a/drivers/net/wireless/ti/wl1251/event.c b/drivers/net/wireless/ti/wl1251/event.c index 9f15ccaf8f05..5ec50a476a69 100644 --- a/drivers/net/wireless/ti/wl1251/event.c +++ b/drivers/net/wireless/ti/wl1251/event.c | |||
| @@ -76,8 +76,7 @@ static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox) | |||
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID && | 79 | if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID) { |
| 80 | wl->station_mode != STATION_ACTIVE_MODE) { | ||
| 81 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); | 80 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); |
| 82 | 81 | ||
| 83 | /* indicate to the stack, that beacons have been lost */ | 82 | /* indicate to the stack, that beacons have been lost */ |
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c index 87f6305bda2c..567660cd2fcd 100644 --- a/drivers/net/wireless/ti/wl1251/spi.c +++ b/drivers/net/wireless/ti/wl1251/spi.c | |||
| @@ -73,6 +73,8 @@ static void wl1251_spi_reset(struct wl1251 *wl) | |||
| 73 | spi_sync(wl_to_spi(wl), &m); | 73 | spi_sync(wl_to_spi(wl), &m); |
| 74 | 74 | ||
| 75 | wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); | 75 | wl1251_dump(DEBUG_SPI, "spi reset -> ", cmd, WSPI_INIT_CMD_LEN); |
| 76 | |||
| 77 | kfree(cmd); | ||
| 76 | } | 78 | } |
| 77 | 79 | ||
| 78 | static void wl1251_spi_wake(struct wl1251 *wl) | 80 | static void wl1251_spi_wake(struct wl1251 *wl) |
| @@ -127,6 +129,8 @@ static void wl1251_spi_wake(struct wl1251 *wl) | |||
| 127 | spi_sync(wl_to_spi(wl), &m); | 129 | spi_sync(wl_to_spi(wl), &m); |
| 128 | 130 | ||
| 129 | wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); | 131 | wl1251_dump(DEBUG_SPI, "spi init -> ", cmd, WSPI_INIT_CMD_LEN); |
| 132 | |||
| 133 | kfree(cmd); | ||
| 130 | } | 134 | } |
| 131 | 135 | ||
| 132 | static void wl1251_spi_reset_wake(struct wl1251 *wl) | 136 | static void wl1251_spi_reset_wake(struct wl1251 *wl) |
diff --git a/drivers/net/wireless/ti/wlcore/Kconfig b/drivers/net/wireless/ti/wlcore/Kconfig index 54156b0b5c2d..d7b907e67170 100644 --- a/drivers/net/wireless/ti/wlcore/Kconfig +++ b/drivers/net/wireless/ti/wlcore/Kconfig | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | config WLCORE | 1 | config WLCORE |
| 2 | tristate "TI wlcore support" | 2 | tristate "TI wlcore support" |
| 3 | depends on WL_TI && GENERIC_HARDIRQS && MAC80211 | 3 | depends on WL_TI && GENERIC_HARDIRQS && MAC80211 |
| 4 | depends on INET | ||
| 5 | select FW_LOADER | 4 | select FW_LOADER |
| 6 | ---help--- | 5 | ---help--- |
| 7 | This module contains the main code for TI WLAN chips. It abstracts | 6 | This module contains the main code for TI WLAN chips. It abstracts |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 2027afe405fe..30899901aef5 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
| @@ -1935,14 +1935,14 @@ static int __devexit xennet_remove(struct xenbus_device *dev) | |||
| 1935 | 1935 | ||
| 1936 | dev_dbg(&dev->dev, "%s\n", dev->nodename); | 1936 | dev_dbg(&dev->dev, "%s\n", dev->nodename); |
| 1937 | 1937 | ||
| 1938 | unregister_netdev(info->netdev); | ||
| 1939 | |||
| 1940 | xennet_disconnect_backend(info); | 1938 | xennet_disconnect_backend(info); |
| 1941 | 1939 | ||
| 1942 | del_timer_sync(&info->rx_refill_timer); | ||
| 1943 | |||
| 1944 | xennet_sysfs_delif(info->netdev); | 1940 | xennet_sysfs_delif(info->netdev); |
| 1945 | 1941 | ||
| 1942 | unregister_netdev(info->netdev); | ||
| 1943 | |||
| 1944 | del_timer_sync(&info->rx_refill_timer); | ||
| 1945 | |||
| 1946 | free_percpu(info->stats); | 1946 | free_percpu(info->stats); |
| 1947 | 1947 | ||
| 1948 | free_netdev(info->netdev); | 1948 | free_netdev(info->netdev); |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 343ad29e211c..e44f8c2d239d 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
| @@ -317,10 +317,9 @@ static const struct of_dev_auxdata *of_dev_lookup(const struct of_dev_auxdata *l | |||
| 317 | for(; lookup->compatible != NULL; lookup++) { | 317 | for(; lookup->compatible != NULL; lookup++) { |
| 318 | if (!of_device_is_compatible(np, lookup->compatible)) | 318 | if (!of_device_is_compatible(np, lookup->compatible)) |
| 319 | continue; | 319 | continue; |
| 320 | if (of_address_to_resource(np, 0, &res)) | 320 | if (!of_address_to_resource(np, 0, &res)) |
| 321 | continue; | 321 | if (res.start != lookup->phys_addr) |
| 322 | if (res.start != lookup->phys_addr) | 322 | continue; |
| 323 | continue; | ||
| 324 | pr_debug("%s: devname=%s\n", np->full_name, lookup->name); | 323 | pr_debug("%s: devname=%s\n", np->full_name, lookup->name); |
| 325 | return lookup; | 324 | return lookup; |
| 326 | } | 325 | } |
| @@ -462,4 +461,5 @@ int of_platform_populate(struct device_node *root, | |||
| 462 | of_node_put(root); | 461 | of_node_put(root); |
| 463 | return rc; | 462 | return rc; |
| 464 | } | 463 | } |
| 464 | EXPORT_SYMBOL_GPL(of_platform_populate); | ||
| 465 | #endif /* CONFIG_OF_ADDRESS */ | 465 | #endif /* CONFIG_OF_ADDRESS */ |
diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c index da14432806c6..efc4b7f308cf 100644 --- a/drivers/oprofile/oprofile_perf.c +++ b/drivers/oprofile/oprofile_perf.c | |||
| @@ -25,7 +25,7 @@ static int oprofile_perf_enabled; | |||
| 25 | static DEFINE_MUTEX(oprofile_perf_mutex); | 25 | static DEFINE_MUTEX(oprofile_perf_mutex); |
| 26 | 26 | ||
| 27 | static struct op_counter_config *counter_config; | 27 | static struct op_counter_config *counter_config; |
| 28 | static struct perf_event **perf_events[nr_cpumask_bits]; | 28 | static struct perf_event **perf_events[NR_CPUS]; |
| 29 | static int num_counters; | 29 | static int num_counters; |
| 30 | 30 | ||
| 31 | /* | 31 | /* |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index bf0cee629b60..099f46cd8e87 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
| @@ -748,6 +748,18 @@ static int pci_pm_suspend_noirq(struct device *dev) | |||
| 748 | 748 | ||
| 749 | pci_pm_set_unknown_state(pci_dev); | 749 | pci_pm_set_unknown_state(pci_dev); |
| 750 | 750 | ||
| 751 | /* | ||
| 752 | * Some BIOSes from ASUS have a bug: If a USB EHCI host controller's | ||
| 753 | * PCI COMMAND register isn't 0, the BIOS assumes that the controller | ||
| 754 | * hasn't been quiesced and tries to turn it off. If the controller | ||
| 755 | * is already in D3, this can hang or cause memory corruption. | ||
| 756 | * | ||
| 757 | * Since the value of the COMMAND register doesn't matter once the | ||
| 758 | * device has been suspended, we can safely set it to 0 here. | ||
| 759 | */ | ||
| 760 | if (pci_dev->class == PCI_CLASS_SERIAL_USB_EHCI) | ||
| 761 | pci_write_config_word(pci_dev, PCI_COMMAND, 0); | ||
| 762 | |||
| 751 | return 0; | 763 | return 0; |
| 752 | } | 764 | } |
| 753 | 765 | ||
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index c3b331b74fa0..0cc053af70bd 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
| @@ -61,7 +61,7 @@ static LIST_HEAD(pinctrl_maps); | |||
| 61 | list_for_each_entry(_maps_node_, &pinctrl_maps, node) \ | 61 | list_for_each_entry(_maps_node_, &pinctrl_maps, node) \ |
| 62 | for (_i_ = 0, _map_ = &_maps_node_->maps[_i_]; \ | 62 | for (_i_ = 0, _map_ = &_maps_node_->maps[_i_]; \ |
| 63 | _i_ < _maps_node_->num_maps; \ | 63 | _i_ < _maps_node_->num_maps; \ |
| 64 | i++, _map_ = &_maps_node_->maps[_i_]) | 64 | _i_++, _map_ = &_maps_node_->maps[_i_]) |
| 65 | 65 | ||
| 66 | /** | 66 | /** |
| 67 | * pinctrl_provide_dummies() - indicate if pinctrl provides dummy state support | 67 | * pinctrl_provide_dummies() - indicate if pinctrl provides dummy state support |
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c index f6e7c670906c..90c837f469a6 100644 --- a/drivers/pinctrl/pinctrl-imx.c +++ b/drivers/pinctrl/pinctrl-imx.c | |||
| @@ -27,16 +27,16 @@ | |||
| 27 | #include "core.h" | 27 | #include "core.h" |
| 28 | #include "pinctrl-imx.h" | 28 | #include "pinctrl-imx.h" |
| 29 | 29 | ||
| 30 | #define IMX_PMX_DUMP(info, p, m, c, n) \ | 30 | #define IMX_PMX_DUMP(info, p, m, c, n) \ |
| 31 | { \ | 31 | { \ |
| 32 | int i, j; \ | 32 | int i, j; \ |
| 33 | printk("Format: Pin Mux Config\n"); \ | 33 | printk(KERN_DEBUG "Format: Pin Mux Config\n"); \ |
| 34 | for (i = 0; i < n; i++) { \ | 34 | for (i = 0; i < n; i++) { \ |
| 35 | j = p[i]; \ | 35 | j = p[i]; \ |
| 36 | printk("%s %d 0x%lx\n", \ | 36 | printk(KERN_DEBUG "%s %d 0x%lx\n", \ |
| 37 | info->pins[j].name, \ | 37 | info->pins[j].name, \ |
| 38 | m[i], c[i]); \ | 38 | m[i], c[i]); \ |
| 39 | } \ | 39 | } \ |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | /* The bits in CONFIG cell defined in binding doc*/ | 42 | /* The bits in CONFIG cell defined in binding doc*/ |
| @@ -173,8 +173,10 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 173 | 173 | ||
| 174 | /* create mux map */ | 174 | /* create mux map */ |
| 175 | parent = of_get_parent(np); | 175 | parent = of_get_parent(np); |
| 176 | if (!parent) | 176 | if (!parent) { |
| 177 | kfree(new_map); | ||
| 177 | return -EINVAL; | 178 | return -EINVAL; |
| 179 | } | ||
| 178 | new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; | 180 | new_map[0].type = PIN_MAP_TYPE_MUX_GROUP; |
| 179 | new_map[0].data.mux.function = parent->name; | 181 | new_map[0].data.mux.function = parent->name; |
| 180 | new_map[0].data.mux.group = np->name; | 182 | new_map[0].data.mux.group = np->name; |
| @@ -193,7 +195,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 193 | } | 195 | } |
| 194 | 196 | ||
| 195 | dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n", | 197 | dev_dbg(pctldev->dev, "maps: function %s group %s num %d\n", |
| 196 | new_map->data.mux.function, new_map->data.mux.group, map_num); | 198 | (*map)->data.mux.function, (*map)->data.mux.group, map_num); |
| 197 | 199 | ||
| 198 | return 0; | 200 | return 0; |
| 199 | } | 201 | } |
| @@ -201,10 +203,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 201 | static void imx_dt_free_map(struct pinctrl_dev *pctldev, | 203 | static void imx_dt_free_map(struct pinctrl_dev *pctldev, |
| 202 | struct pinctrl_map *map, unsigned num_maps) | 204 | struct pinctrl_map *map, unsigned num_maps) |
| 203 | { | 205 | { |
| 204 | int i; | 206 | kfree(map); |
| 205 | |||
| 206 | for (i = 0; i < num_maps; i++) | ||
| 207 | kfree(map); | ||
| 208 | } | 207 | } |
| 209 | 208 | ||
| 210 | static struct pinctrl_ops imx_pctrl_ops = { | 209 | static struct pinctrl_ops imx_pctrl_ops = { |
| @@ -478,6 +477,7 @@ static int __devinit imx_pinctrl_parse_groups(struct device_node *np, | |||
| 478 | #ifdef DEBUG | 477 | #ifdef DEBUG |
| 479 | IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins); | 478 | IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins); |
| 480 | #endif | 479 | #endif |
| 480 | |||
| 481 | return 0; | 481 | return 0; |
| 482 | } | 482 | } |
| 483 | 483 | ||
diff --git a/drivers/pinctrl/pinctrl-imx6q.c b/drivers/pinctrl/pinctrl-imx6q.c index 7737d4d71a3c..e9bf71fbedca 100644 --- a/drivers/pinctrl/pinctrl-imx6q.c +++ b/drivers/pinctrl/pinctrl-imx6q.c | |||
| @@ -1950,6 +1950,8 @@ static struct imx_pin_reg imx6q_pin_regs[] = { | |||
| 1950 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 5, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__GPIO_1_12 */ | 1950 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 5, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__GPIO_1_12 */ |
| 1951 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 6, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__SJC_DONE */ | 1951 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 6, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__SJC_DONE */ |
| 1952 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 7, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__ANATOP_TESTO_3 */ | 1952 | IMX_PIN_REG(MX6Q_PAD_SD2_DAT3, 0x0744, 0x035C, 7, 0x0000, 0), /* MX6Q_PAD_SD2_DAT3__ANATOP_TESTO_3 */ |
| 1953 | IMX_PIN_REG(MX6Q_PAD_ENET_RX_ER, 0x04EC, 0x01D8, 0, 0x0000, 0), /* MX6Q_PAD_ENET_RX_ER__ANATOP_USBOTG_ID */ | ||
| 1954 | IMX_PIN_REG(MX6Q_PAD_GPIO_1, 0x05F4, 0x0224, 3, 0x0000, 0), /* MX6Q_PAD_GPIO_1__ANATOP_USBOTG_ID */ | ||
| 1953 | }; | 1955 | }; |
| 1954 | 1956 | ||
| 1955 | /* Pad names for the pinmux subsystem */ | 1957 | /* Pad names for the pinmux subsystem */ |
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c index 556e45a213eb..4ba4636b6a4a 100644 --- a/drivers/pinctrl/pinctrl-mxs.c +++ b/drivers/pinctrl/pinctrl-mxs.c | |||
| @@ -107,8 +107,10 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 107 | 107 | ||
| 108 | /* Compose group name */ | 108 | /* Compose group name */ |
| 109 | group = kzalloc(length, GFP_KERNEL); | 109 | group = kzalloc(length, GFP_KERNEL); |
| 110 | if (!group) | 110 | if (!group) { |
| 111 | return -ENOMEM; | 111 | ret = -ENOMEM; |
| 112 | goto free; | ||
| 113 | } | ||
| 112 | snprintf(group, length, "%s.%d", np->name, reg); | 114 | snprintf(group, length, "%s.%d", np->name, reg); |
| 113 | new_map[i].data.mux.group = group; | 115 | new_map[i].data.mux.group = group; |
| 114 | i++; | 116 | i++; |
| @@ -118,7 +120,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 118 | pconfig = kmemdup(&config, sizeof(config), GFP_KERNEL); | 120 | pconfig = kmemdup(&config, sizeof(config), GFP_KERNEL); |
| 119 | if (!pconfig) { | 121 | if (!pconfig) { |
| 120 | ret = -ENOMEM; | 122 | ret = -ENOMEM; |
| 121 | goto free; | 123 | goto free_group; |
| 122 | } | 124 | } |
| 123 | 125 | ||
| 124 | new_map[i].type = PIN_MAP_TYPE_CONFIGS_GROUP; | 126 | new_map[i].type = PIN_MAP_TYPE_CONFIGS_GROUP; |
| @@ -133,6 +135,9 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 133 | 135 | ||
| 134 | return 0; | 136 | return 0; |
| 135 | 137 | ||
| 138 | free_group: | ||
| 139 | if (!purecfg) | ||
| 140 | kfree(group); | ||
| 136 | free: | 141 | free: |
| 137 | kfree(new_map); | 142 | kfree(new_map); |
| 138 | return ret; | 143 | return ret; |
| @@ -511,6 +516,7 @@ int __devinit mxs_pinctrl_probe(struct platform_device *pdev, | |||
| 511 | return 0; | 516 | return 0; |
| 512 | 517 | ||
| 513 | err: | 518 | err: |
| 519 | platform_set_drvdata(pdev, NULL); | ||
| 514 | iounmap(d->base); | 520 | iounmap(d->base); |
| 515 | return ret; | 521 | return ret; |
| 516 | } | 522 | } |
| @@ -520,6 +526,7 @@ int __devexit mxs_pinctrl_remove(struct platform_device *pdev) | |||
| 520 | { | 526 | { |
| 521 | struct mxs_pinctrl_data *d = platform_get_drvdata(pdev); | 527 | struct mxs_pinctrl_data *d = platform_get_drvdata(pdev); |
| 522 | 528 | ||
| 529 | platform_set_drvdata(pdev, NULL); | ||
| 523 | pinctrl_unregister(d->pctl); | 530 | pinctrl_unregister(d->pctl); |
| 524 | iounmap(d->base); | 531 | iounmap(d->base); |
| 525 | 532 | ||
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index b26395d16347..3e7e47d6b385 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
| @@ -673,7 +673,7 @@ static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, | |||
| 673 | * wakeup is anyhow controlled by the RIMSC and FIMSC registers. | 673 | * wakeup is anyhow controlled by the RIMSC and FIMSC registers. |
| 674 | */ | 674 | */ |
| 675 | if (nmk_chip->sleepmode && on) { | 675 | if (nmk_chip->sleepmode && on) { |
| 676 | __nmk_gpio_set_slpm(nmk_chip, gpio % nmk_chip->chip.base, | 676 | __nmk_gpio_set_slpm(nmk_chip, gpio % NMK_GPIO_PER_CHIP, |
| 677 | NMK_GPIO_SLPM_WAKEUP_ENABLE); | 677 | NMK_GPIO_SLPM_WAKEUP_ENABLE); |
| 678 | } | 678 | } |
| 679 | 679 | ||
| @@ -1246,6 +1246,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) | |||
| 1246 | ret = PTR_ERR(clk); | 1246 | ret = PTR_ERR(clk); |
| 1247 | goto out_unmap; | 1247 | goto out_unmap; |
| 1248 | } | 1248 | } |
| 1249 | clk_prepare(clk); | ||
| 1249 | 1250 | ||
| 1250 | nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); | 1251 | nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); |
| 1251 | if (!nmk_chip) { | 1252 | if (!nmk_chip) { |
| @@ -1437,7 +1438,27 @@ static int nmk_pmx_enable(struct pinctrl_dev *pctldev, unsigned function, | |||
| 1437 | 1438 | ||
| 1438 | dev_dbg(npct->dev, "enable group %s, %u pins\n", g->name, g->npins); | 1439 | dev_dbg(npct->dev, "enable group %s, %u pins\n", g->name, g->npins); |
| 1439 | 1440 | ||
| 1440 | /* Handle this special glitch on altfunction C */ | 1441 | /* |
| 1442 | * If we're setting altfunc C by setting both AFSLA and AFSLB to 1, | ||
| 1443 | * we may pass through an undesired state. In this case we take | ||
| 1444 | * some extra care. | ||
| 1445 | * | ||
| 1446 | * Safe sequence used to switch IOs between GPIO and Alternate-C mode: | ||
| 1447 | * - Save SLPM registers (since we have a shadow register in the | ||
| 1448 | * nmk_chip we're using that as backup) | ||
| 1449 | * - Set SLPM=0 for the IOs you want to switch and others to 1 | ||
| 1450 | * - Configure the GPIO registers for the IOs that are being switched | ||
| 1451 | * - Set IOFORCE=1 | ||
| 1452 | * - Modify the AFLSA/B registers for the IOs that are being switched | ||
| 1453 | * - Set IOFORCE=0 | ||
| 1454 | * - Restore SLPM registers | ||
| 1455 | * - Any spurious wake up event during switch sequence to be ignored | ||
| 1456 | * and cleared | ||
| 1457 | * | ||
| 1458 | * We REALLY need to save ALL slpm registers, because the external | ||
| 1459 | * IOFORCE will switch *all* ports to their sleepmode setting to as | ||
| 1460 | * to avoid glitches. (Not just one port!) | ||
| 1461 | */ | ||
| 1441 | glitch = (g->altsetting == NMK_GPIO_ALT_C); | 1462 | glitch = (g->altsetting == NMK_GPIO_ALT_C); |
| 1442 | 1463 | ||
| 1443 | if (glitch) { | 1464 | if (glitch) { |
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c index ba15b1a29e52..e9f8e7d11001 100644 --- a/drivers/pinctrl/pinctrl-sirf.c +++ b/drivers/pinctrl/pinctrl-sirf.c | |||
| @@ -1184,7 +1184,7 @@ out_no_gpio_remap: | |||
| 1184 | return ret; | 1184 | return ret; |
| 1185 | } | 1185 | } |
| 1186 | 1186 | ||
| 1187 | static const struct of_device_id pinmux_ids[] = { | 1187 | static const struct of_device_id pinmux_ids[] __devinitconst = { |
| 1188 | { .compatible = "sirf,prima2-gpio-pinmux" }, | 1188 | { .compatible = "sirf,prima2-gpio-pinmux" }, |
| 1189 | {} | 1189 | {} |
| 1190 | }; | 1190 | }; |
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c index 5ae50aadf885..b3f6b2873fdd 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.c +++ b/drivers/pinctrl/spear/pinctrl-spear.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver for the ST Microelectronics SPEAr pinmux | 2 | * Driver for the ST Microelectronics SPEAr pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * Inspired from: | 7 | * Inspired from: |
| 8 | * - U300 Pinctl drivers | 8 | * - U300 Pinctl drivers |
diff --git a/drivers/pinctrl/spear/pinctrl-spear.h b/drivers/pinctrl/spear/pinctrl-spear.h index 9155783bb47f..d950eb78d939 100644 --- a/drivers/pinctrl/spear/pinctrl-spear.h +++ b/drivers/pinctrl/spear/pinctrl-spear.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver header file for the ST Microelectronics SPEAr pinmux | 2 | * Driver header file for the ST Microelectronics SPEAr pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/pinctrl/spear/pinctrl-spear1310.c b/drivers/pinctrl/spear/pinctrl-spear1310.c index fff168be7f00..d6cca8c81b92 100644 --- a/drivers/pinctrl/spear/pinctrl-spear1310.c +++ b/drivers/pinctrl/spear/pinctrl-spear1310.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver for the ST Microelectronics SPEAr1310 pinmux | 2 | * Driver for the ST Microelectronics SPEAr1310 pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
| @@ -2192,7 +2192,7 @@ static void __exit spear1310_pinctrl_exit(void) | |||
| 2192 | } | 2192 | } |
| 2193 | module_exit(spear1310_pinctrl_exit); | 2193 | module_exit(spear1310_pinctrl_exit); |
| 2194 | 2194 | ||
| 2195 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 2195 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
| 2196 | MODULE_DESCRIPTION("ST Microelectronics SPEAr1310 pinctrl driver"); | 2196 | MODULE_DESCRIPTION("ST Microelectronics SPEAr1310 pinctrl driver"); |
| 2197 | MODULE_LICENSE("GPL v2"); | 2197 | MODULE_LICENSE("GPL v2"); |
| 2198 | MODULE_DEVICE_TABLE(of, spear1310_pinctrl_of_match); | 2198 | MODULE_DEVICE_TABLE(of, spear1310_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear1340.c b/drivers/pinctrl/spear/pinctrl-spear1340.c index a8ab2a6f51bf..a0eb057e55bd 100644 --- a/drivers/pinctrl/spear/pinctrl-spear1340.c +++ b/drivers/pinctrl/spear/pinctrl-spear1340.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver for the ST Microelectronics SPEAr1340 pinmux | 2 | * Driver for the ST Microelectronics SPEAr1340 pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
| @@ -1983,7 +1983,7 @@ static void __exit spear1340_pinctrl_exit(void) | |||
| 1983 | } | 1983 | } |
| 1984 | module_exit(spear1340_pinctrl_exit); | 1984 | module_exit(spear1340_pinctrl_exit); |
| 1985 | 1985 | ||
| 1986 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 1986 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
| 1987 | MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver"); | 1987 | MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver"); |
| 1988 | MODULE_LICENSE("GPL v2"); | 1988 | MODULE_LICENSE("GPL v2"); |
| 1989 | MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match); | 1989 | MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear300.c b/drivers/pinctrl/spear/pinctrl-spear300.c index 9c82a35e4e78..4dfc2849b172 100644 --- a/drivers/pinctrl/spear/pinctrl-spear300.c +++ b/drivers/pinctrl/spear/pinctrl-spear300.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver for the ST Microelectronics SPEAr300 pinmux | 2 | * Driver for the ST Microelectronics SPEAr300 pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
| @@ -702,7 +702,7 @@ static void __exit spear300_pinctrl_exit(void) | |||
| 702 | } | 702 | } |
| 703 | module_exit(spear300_pinctrl_exit); | 703 | module_exit(spear300_pinctrl_exit); |
| 704 | 704 | ||
| 705 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 705 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
| 706 | MODULE_DESCRIPTION("ST Microelectronics SPEAr300 pinctrl driver"); | 706 | MODULE_DESCRIPTION("ST Microelectronics SPEAr300 pinctrl driver"); |
| 707 | MODULE_LICENSE("GPL v2"); | 707 | MODULE_LICENSE("GPL v2"); |
| 708 | MODULE_DEVICE_TABLE(of, spear300_pinctrl_of_match); | 708 | MODULE_DEVICE_TABLE(of, spear300_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear310.c b/drivers/pinctrl/spear/pinctrl-spear310.c index 1a9707605125..96883693fb7e 100644 --- a/drivers/pinctrl/spear/pinctrl-spear310.c +++ b/drivers/pinctrl/spear/pinctrl-spear310.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver for the ST Microelectronics SPEAr310 pinmux | 2 | * Driver for the ST Microelectronics SPEAr310 pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
| @@ -425,7 +425,7 @@ static void __exit spear310_pinctrl_exit(void) | |||
| 425 | } | 425 | } |
| 426 | module_exit(spear310_pinctrl_exit); | 426 | module_exit(spear310_pinctrl_exit); |
| 427 | 427 | ||
| 428 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 428 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
| 429 | MODULE_DESCRIPTION("ST Microelectronics SPEAr310 pinctrl driver"); | 429 | MODULE_DESCRIPTION("ST Microelectronics SPEAr310 pinctrl driver"); |
| 430 | MODULE_LICENSE("GPL v2"); | 430 | MODULE_LICENSE("GPL v2"); |
| 431 | MODULE_DEVICE_TABLE(of, SPEAr310_pinctrl_of_match); | 431 | MODULE_DEVICE_TABLE(of, SPEAr310_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear320.c b/drivers/pinctrl/spear/pinctrl-spear320.c index de726e6c283a..020b1e0bdb3e 100644 --- a/drivers/pinctrl/spear/pinctrl-spear320.c +++ b/drivers/pinctrl/spear/pinctrl-spear320.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver for the ST Microelectronics SPEAr320 pinmux | 2 | * Driver for the ST Microelectronics SPEAr320 pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
| @@ -3462,7 +3462,7 @@ static void __exit spear320_pinctrl_exit(void) | |||
| 3462 | } | 3462 | } |
| 3463 | module_exit(spear320_pinctrl_exit); | 3463 | module_exit(spear320_pinctrl_exit); |
| 3464 | 3464 | ||
| 3465 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 3465 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
| 3466 | MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver"); | 3466 | MODULE_DESCRIPTION("ST Microelectronics SPEAr320 pinctrl driver"); |
| 3467 | MODULE_LICENSE("GPL v2"); | 3467 | MODULE_LICENSE("GPL v2"); |
| 3468 | MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match); | 3468 | MODULE_DEVICE_TABLE(of, spear320_pinctrl_of_match); |
diff --git a/drivers/pinctrl/spear/pinctrl-spear3xx.c b/drivers/pinctrl/spear/pinctrl-spear3xx.c index 91c883bc46a6..0242378f7cb8 100644 --- a/drivers/pinctrl/spear/pinctrl-spear3xx.c +++ b/drivers/pinctrl/spear/pinctrl-spear3xx.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Driver for the ST Microelectronics SPEAr3xx pinmux | 2 | * Driver for the ST Microelectronics SPEAr3xx pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/pinctrl/spear/pinctrl-spear3xx.h b/drivers/pinctrl/spear/pinctrl-spear3xx.h index 5d5fdd8df7b8..31f44347f17c 100644 --- a/drivers/pinctrl/spear/pinctrl-spear3xx.h +++ b/drivers/pinctrl/spear/pinctrl-spear3xx.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * Header file for the ST Microelectronics SPEAr3xx pinmux | 2 | * Header file for the ST Microelectronics SPEAr3xx pinmux |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2012 ST Microelectronics | 4 | * Copyright (C) 2012 ST Microelectronics |
| 5 | * Viresh Kumar <viresh.kumar@st.com> | 5 | * Viresh Kumar <viresh.linux@gmail.com> |
| 6 | * | 6 | * |
| 7 | * This file is licensed under the terms of the GNU General Public | 7 | * This file is licensed under the terms of the GNU General Public |
| 8 | * License version 2. This program is licensed "as is" without any | 8 | * License version 2. This program is licensed "as is" without any |
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index 639db4d0aa76..2fd9d36acd15 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * | 5 | * |
| 6 | * (C) 2009 - Peter Feuerer peter (a) piie.net | 6 | * (C) 2009 - Peter Feuerer peter (a) piie.net |
| 7 | * http://piie.net | 7 | * http://piie.net |
| 8 | * 2009 Borislav Petkov <petkovbb@gmail.com> | 8 | * 2009 Borislav Petkov bp (a) alien8.de |
| 9 | * | 9 | * |
| 10 | * Inspired by and many thanks to: | 10 | * Inspired by and many thanks to: |
| 11 | * o acerfand - Rachel Greenham | 11 | * o acerfand - Rachel Greenham |
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 4f20f8dd3d7c..17f6dfd8dbfb 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
| @@ -694,10 +694,10 @@ MODULE_DEVICE_TABLE(acpi, ideapad_device_ids); | |||
| 694 | static int __devinit ideapad_acpi_add(struct acpi_device *adevice) | 694 | static int __devinit ideapad_acpi_add(struct acpi_device *adevice) |
| 695 | { | 695 | { |
| 696 | int ret, i; | 696 | int ret, i; |
| 697 | unsigned long cfg; | 697 | int cfg; |
| 698 | struct ideapad_private *priv; | 698 | struct ideapad_private *priv; |
| 699 | 699 | ||
| 700 | if (read_method_int(adevice->handle, "_CFG", (int *)&cfg)) | 700 | if (read_method_int(adevice->handle, "_CFG", &cfg)) |
| 701 | return -ENODEV; | 701 | return -ENODEV; |
| 702 | 702 | ||
| 703 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 703 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| @@ -721,7 +721,7 @@ static int __devinit ideapad_acpi_add(struct acpi_device *adevice) | |||
| 721 | goto input_failed; | 721 | goto input_failed; |
| 722 | 722 | ||
| 723 | for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) { | 723 | for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) { |
| 724 | if (test_bit(ideapad_rfk_data[i].cfgbit, &cfg)) | 724 | if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg)) |
| 725 | ideapad_register_rfkill(adevice, i); | 725 | ideapad_register_rfkill(adevice, i); |
| 726 | else | 726 | else |
| 727 | priv->rfk[i] = NULL; | 727 | priv->rfk[i] = NULL; |
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index 0ffdb3cde2bb..9af4257d4901 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
| @@ -72,6 +72,7 @@ | |||
| 72 | #include <linux/string.h> | 72 | #include <linux/string.h> |
| 73 | #include <linux/tick.h> | 73 | #include <linux/tick.h> |
| 74 | #include <linux/timer.h> | 74 | #include <linux/timer.h> |
| 75 | #include <linux/dmi.h> | ||
| 75 | #include <drm/i915_drm.h> | 76 | #include <drm/i915_drm.h> |
| 76 | #include <asm/msr.h> | 77 | #include <asm/msr.h> |
| 77 | #include <asm/processor.h> | 78 | #include <asm/processor.h> |
| @@ -1485,6 +1486,24 @@ static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { | |||
| 1485 | 1486 | ||
| 1486 | MODULE_DEVICE_TABLE(pci, ips_id_table); | 1487 | MODULE_DEVICE_TABLE(pci, ips_id_table); |
| 1487 | 1488 | ||
| 1489 | static int ips_blacklist_callback(const struct dmi_system_id *id) | ||
| 1490 | { | ||
| 1491 | pr_info("Blacklisted intel_ips for %s\n", id->ident); | ||
| 1492 | return 1; | ||
| 1493 | } | ||
| 1494 | |||
| 1495 | static const struct dmi_system_id ips_blacklist[] = { | ||
| 1496 | { | ||
| 1497 | .callback = ips_blacklist_callback, | ||
| 1498 | .ident = "HP ProBook", | ||
| 1499 | .matches = { | ||
| 1500 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
| 1501 | DMI_MATCH(DMI_PRODUCT_NAME, "HP ProBook"), | ||
| 1502 | }, | ||
| 1503 | }, | ||
| 1504 | { } /* terminating entry */ | ||
| 1505 | }; | ||
| 1506 | |||
| 1488 | static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | 1507 | static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) |
| 1489 | { | 1508 | { |
| 1490 | u64 platform_info; | 1509 | u64 platform_info; |
| @@ -1494,6 +1513,9 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
| 1494 | u16 htshi, trc, trc_required_mask; | 1513 | u16 htshi, trc, trc_required_mask; |
| 1495 | u8 tse; | 1514 | u8 tse; |
| 1496 | 1515 | ||
| 1516 | if (dmi_check_system(ips_blacklist)) | ||
| 1517 | return -ENODEV; | ||
| 1518 | |||
| 1497 | ips = kzalloc(sizeof(struct ips_driver), GFP_KERNEL); | 1519 | ips = kzalloc(sizeof(struct ips_driver), GFP_KERNEL); |
| 1498 | if (!ips) | 1520 | if (!ips) |
| 1499 | return -ENOMEM; | 1521 | return -ENOMEM; |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 210d4ae547c2..d456ff0c73b7 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
| @@ -973,7 +973,7 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
| 973 | struct device_attribute *attr, | 973 | struct device_attribute *attr, |
| 974 | const char *buffer, size_t count) | 974 | const char *buffer, size_t count) |
| 975 | { | 975 | { |
| 976 | unsigned long value = 0; | 976 | int value; |
| 977 | int ret = 0; | 977 | int ret = 0; |
| 978 | struct sony_nc_value *item = | 978 | struct sony_nc_value *item = |
| 979 | container_of(attr, struct sony_nc_value, devattr); | 979 | container_of(attr, struct sony_nc_value, devattr); |
| @@ -984,7 +984,7 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
| 984 | if (count > 31) | 984 | if (count > 31) |
| 985 | return -EINVAL; | 985 | return -EINVAL; |
| 986 | 986 | ||
| 987 | if (kstrtoul(buffer, 10, &value)) | 987 | if (kstrtoint(buffer, 10, &value)) |
| 988 | return -EINVAL; | 988 | return -EINVAL; |
| 989 | 989 | ||
| 990 | if (item->validate) | 990 | if (item->validate) |
| @@ -994,7 +994,7 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
| 994 | return value; | 994 | return value; |
| 995 | 995 | ||
| 996 | ret = sony_nc_int_call(sony_nc_acpi_handle, *item->acpiset, | 996 | ret = sony_nc_int_call(sony_nc_acpi_handle, *item->acpiset, |
| 997 | (int *)&value, NULL); | 997 | &value, NULL); |
| 998 | if (ret < 0) | 998 | if (ret < 0) |
| 999 | return -EIO; | 999 | return -EIO; |
| 1000 | 1000 | ||
| @@ -1010,6 +1010,7 @@ static ssize_t sony_nc_sysfs_store(struct device *dev, | |||
| 1010 | struct sony_backlight_props { | 1010 | struct sony_backlight_props { |
| 1011 | struct backlight_device *dev; | 1011 | struct backlight_device *dev; |
| 1012 | int handle; | 1012 | int handle; |
| 1013 | int cmd_base; | ||
| 1013 | u8 offset; | 1014 | u8 offset; |
| 1014 | u8 maxlvl; | 1015 | u8 maxlvl; |
| 1015 | }; | 1016 | }; |
| @@ -1037,7 +1038,7 @@ static int sony_nc_get_brightness_ng(struct backlight_device *bd) | |||
| 1037 | struct sony_backlight_props *sdev = | 1038 | struct sony_backlight_props *sdev = |
| 1038 | (struct sony_backlight_props *)bl_get_data(bd); | 1039 | (struct sony_backlight_props *)bl_get_data(bd); |
| 1039 | 1040 | ||
| 1040 | sony_call_snc_handle(sdev->handle, 0x0200, &result); | 1041 | sony_call_snc_handle(sdev->handle, sdev->cmd_base + 0x100, &result); |
| 1041 | 1042 | ||
| 1042 | return (result & 0xff) - sdev->offset; | 1043 | return (result & 0xff) - sdev->offset; |
| 1043 | } | 1044 | } |
| @@ -1049,7 +1050,8 @@ static int sony_nc_update_status_ng(struct backlight_device *bd) | |||
| 1049 | (struct sony_backlight_props *)bl_get_data(bd); | 1050 | (struct sony_backlight_props *)bl_get_data(bd); |
| 1050 | 1051 | ||
| 1051 | value = bd->props.brightness + sdev->offset; | 1052 | value = bd->props.brightness + sdev->offset; |
| 1052 | if (sony_call_snc_handle(sdev->handle, 0x0100 | (value << 16), &result)) | 1053 | if (sony_call_snc_handle(sdev->handle, sdev->cmd_base | (value << 0x10), |
| 1054 | &result)) | ||
| 1053 | return -EIO; | 1055 | return -EIO; |
| 1054 | 1056 | ||
| 1055 | return value; | 1057 | return value; |
| @@ -1172,6 +1174,11 @@ static int sony_nc_hotkeys_decode(u32 event, unsigned int handle) | |||
| 1172 | /* | 1174 | /* |
| 1173 | * ACPI callbacks | 1175 | * ACPI callbacks |
| 1174 | */ | 1176 | */ |
| 1177 | enum event_types { | ||
| 1178 | HOTKEY = 1, | ||
| 1179 | KILLSWITCH, | ||
| 1180 | GFX_SWITCH | ||
| 1181 | }; | ||
| 1175 | static void sony_nc_notify(struct acpi_device *device, u32 event) | 1182 | static void sony_nc_notify(struct acpi_device *device, u32 event) |
| 1176 | { | 1183 | { |
| 1177 | u32 real_ev = event; | 1184 | u32 real_ev = event; |
| @@ -1196,7 +1203,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) | |||
| 1196 | /* hotkey event */ | 1203 | /* hotkey event */ |
| 1197 | case 0x0100: | 1204 | case 0x0100: |
| 1198 | case 0x0127: | 1205 | case 0x0127: |
| 1199 | ev_type = 1; | 1206 | ev_type = HOTKEY; |
| 1200 | real_ev = sony_nc_hotkeys_decode(event, handle); | 1207 | real_ev = sony_nc_hotkeys_decode(event, handle); |
| 1201 | 1208 | ||
| 1202 | if (real_ev > 0) | 1209 | if (real_ev > 0) |
| @@ -1216,7 +1223,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) | |||
| 1216 | * update the rfkill device status when the | 1223 | * update the rfkill device status when the |
| 1217 | * switch is moved. | 1224 | * switch is moved. |
| 1218 | */ | 1225 | */ |
| 1219 | ev_type = 2; | 1226 | ev_type = KILLSWITCH; |
| 1220 | sony_call_snc_handle(handle, 0x0100, &result); | 1227 | sony_call_snc_handle(handle, 0x0100, &result); |
| 1221 | real_ev = result & 0x03; | 1228 | real_ev = result & 0x03; |
| 1222 | 1229 | ||
| @@ -1226,6 +1233,24 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) | |||
| 1226 | 1233 | ||
| 1227 | break; | 1234 | break; |
| 1228 | 1235 | ||
| 1236 | case 0x0128: | ||
| 1237 | case 0x0146: | ||
| 1238 | /* Hybrid GFX switching */ | ||
| 1239 | sony_call_snc_handle(handle, 0x0000, &result); | ||
| 1240 | dprintk("GFX switch event received (reason: %s)\n", | ||
| 1241 | (result & 0x01) ? | ||
| 1242 | "switch change" : "unknown"); | ||
| 1243 | |||
| 1244 | /* verify the switch state | ||
| 1245 | * 1: discrete GFX | ||
| 1246 | * 0: integrated GFX | ||
| 1247 | */ | ||
| 1248 | sony_call_snc_handle(handle, 0x0100, &result); | ||
| 1249 | |||
| 1250 | ev_type = GFX_SWITCH; | ||
| 1251 | real_ev = result & 0xff; | ||
| 1252 | break; | ||
| 1253 | |||
| 1229 | default: | 1254 | default: |
| 1230 | dprintk("Unknown event 0x%x for handle 0x%x\n", | 1255 | dprintk("Unknown event 0x%x for handle 0x%x\n", |
| 1231 | event, handle); | 1256 | event, handle); |
| @@ -1238,7 +1263,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event) | |||
| 1238 | 1263 | ||
| 1239 | } else { | 1264 | } else { |
| 1240 | /* old style event */ | 1265 | /* old style event */ |
| 1241 | ev_type = 1; | 1266 | ev_type = HOTKEY; |
| 1242 | sony_laptop_report_input_event(real_ev); | 1267 | sony_laptop_report_input_event(real_ev); |
| 1243 | } | 1268 | } |
| 1244 | 1269 | ||
| @@ -1893,32 +1918,33 @@ static ssize_t sony_nc_battery_care_limit_store(struct device *dev, | |||
| 1893 | * bits 4,5: store the limit into the EC | 1918 | * bits 4,5: store the limit into the EC |
| 1894 | * bits 6,7: store the limit into the battery | 1919 | * bits 6,7: store the limit into the battery |
| 1895 | */ | 1920 | */ |
| 1921 | cmd = 0; | ||
| 1896 | 1922 | ||
| 1897 | /* | 1923 | if (value > 0) { |
| 1898 | * handle 0x0115 should allow storing on battery too; | 1924 | if (value <= 50) |
| 1899 | * handle 0x0136 same as 0x0115 + health status; | 1925 | cmd = 0x20; |
| 1900 | * handle 0x013f, same as 0x0136 but no storing on the battery | ||
| 1901 | * | ||
| 1902 | * Store only inside the EC for now, regardless the handle number | ||
| 1903 | */ | ||
| 1904 | if (value == 0) | ||
| 1905 | /* disable limits */ | ||
| 1906 | cmd = 0x0; | ||
| 1907 | 1926 | ||
| 1908 | else if (value <= 50) | 1927 | else if (value <= 80) |
| 1909 | cmd = 0x21; | 1928 | cmd = 0x10; |
| 1910 | 1929 | ||
| 1911 | else if (value <= 80) | 1930 | else if (value <= 100) |
| 1912 | cmd = 0x11; | 1931 | cmd = 0x30; |
| 1913 | 1932 | ||
| 1914 | else if (value <= 100) | 1933 | else |
| 1915 | cmd = 0x31; | 1934 | return -EINVAL; |
| 1916 | 1935 | ||
| 1917 | else | 1936 | /* |
| 1918 | return -EINVAL; | 1937 | * handle 0x0115 should allow storing on battery too; |
| 1938 | * handle 0x0136 same as 0x0115 + health status; | ||
| 1939 | * handle 0x013f, same as 0x0136 but no storing on the battery | ||
| 1940 | */ | ||
| 1941 | if (bcare_ctl->handle != 0x013f) | ||
| 1942 | cmd = cmd | (cmd << 2); | ||
| 1919 | 1943 | ||
| 1920 | if (sony_call_snc_handle(bcare_ctl->handle, (cmd << 0x10) | 0x0100, | 1944 | cmd = (cmd | 0x1) << 0x10; |
| 1921 | &result)) | 1945 | } |
| 1946 | |||
| 1947 | if (sony_call_snc_handle(bcare_ctl->handle, cmd | 0x0100, &result)) | ||
| 1922 | return -EIO; | 1948 | return -EIO; |
| 1923 | 1949 | ||
| 1924 | return count; | 1950 | return count; |
| @@ -2113,7 +2139,7 @@ static ssize_t sony_nc_thermal_mode_show(struct device *dev, | |||
| 2113 | struct device_attribute *attr, char *buffer) | 2139 | struct device_attribute *attr, char *buffer) |
| 2114 | { | 2140 | { |
| 2115 | ssize_t count = 0; | 2141 | ssize_t count = 0; |
| 2116 | unsigned int mode = sony_nc_thermal_mode_get(); | 2142 | int mode = sony_nc_thermal_mode_get(); |
| 2117 | 2143 | ||
| 2118 | if (mode < 0) | 2144 | if (mode < 0) |
| 2119 | return mode; | 2145 | return mode; |
| @@ -2472,6 +2498,7 @@ static void sony_nc_backlight_ng_read_limits(int handle, | |||
| 2472 | { | 2498 | { |
| 2473 | u64 offset; | 2499 | u64 offset; |
| 2474 | int i; | 2500 | int i; |
| 2501 | int lvl_table_len = 0; | ||
| 2475 | u8 min = 0xff, max = 0x00; | 2502 | u8 min = 0xff, max = 0x00; |
| 2476 | unsigned char buffer[32] = { 0 }; | 2503 | unsigned char buffer[32] = { 0 }; |
| 2477 | 2504 | ||
| @@ -2480,8 +2507,6 @@ static void sony_nc_backlight_ng_read_limits(int handle, | |||
| 2480 | props->maxlvl = 0xff; | 2507 | props->maxlvl = 0xff; |
| 2481 | 2508 | ||
| 2482 | offset = sony_find_snc_handle(handle); | 2509 | offset = sony_find_snc_handle(handle); |
| 2483 | if (offset < 0) | ||
| 2484 | return; | ||
| 2485 | 2510 | ||
| 2486 | /* try to read the boundaries from ACPI tables, if we fail the above | 2511 | /* try to read the boundaries from ACPI tables, if we fail the above |
| 2487 | * defaults should be reasonable | 2512 | * defaults should be reasonable |
| @@ -2491,11 +2516,21 @@ static void sony_nc_backlight_ng_read_limits(int handle, | |||
| 2491 | if (i < 0) | 2516 | if (i < 0) |
| 2492 | return; | 2517 | return; |
| 2493 | 2518 | ||
| 2519 | switch (handle) { | ||
| 2520 | case 0x012f: | ||
| 2521 | case 0x0137: | ||
| 2522 | lvl_table_len = 9; | ||
| 2523 | break; | ||
| 2524 | case 0x143: | ||
| 2525 | lvl_table_len = 16; | ||
| 2526 | break; | ||
| 2527 | } | ||
| 2528 | |||
| 2494 | /* the buffer lists brightness levels available, brightness levels are | 2529 | /* the buffer lists brightness levels available, brightness levels are |
| 2495 | * from position 0 to 8 in the array, other values are used by ALS | 2530 | * from position 0 to 8 in the array, other values are used by ALS |
| 2496 | * control. | 2531 | * control. |
| 2497 | */ | 2532 | */ |
| 2498 | for (i = 0; i < 9 && i < ARRAY_SIZE(buffer); i++) { | 2533 | for (i = 0; i < lvl_table_len && i < ARRAY_SIZE(buffer); i++) { |
| 2499 | 2534 | ||
| 2500 | dprintk("Brightness level: %d\n", buffer[i]); | 2535 | dprintk("Brightness level: %d\n", buffer[i]); |
| 2501 | 2536 | ||
| @@ -2520,16 +2555,24 @@ static void sony_nc_backlight_setup(void) | |||
| 2520 | const struct backlight_ops *ops = NULL; | 2555 | const struct backlight_ops *ops = NULL; |
| 2521 | struct backlight_properties props; | 2556 | struct backlight_properties props; |
| 2522 | 2557 | ||
| 2523 | if (sony_find_snc_handle(0x12f) != -1) { | 2558 | if (sony_find_snc_handle(0x12f) >= 0) { |
| 2524 | ops = &sony_backlight_ng_ops; | 2559 | ops = &sony_backlight_ng_ops; |
| 2560 | sony_bl_props.cmd_base = 0x0100; | ||
| 2525 | sony_nc_backlight_ng_read_limits(0x12f, &sony_bl_props); | 2561 | sony_nc_backlight_ng_read_limits(0x12f, &sony_bl_props); |
| 2526 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; | 2562 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; |
| 2527 | 2563 | ||
| 2528 | } else if (sony_find_snc_handle(0x137) != -1) { | 2564 | } else if (sony_find_snc_handle(0x137) >= 0) { |
| 2529 | ops = &sony_backlight_ng_ops; | 2565 | ops = &sony_backlight_ng_ops; |
| 2566 | sony_bl_props.cmd_base = 0x0100; | ||
| 2530 | sony_nc_backlight_ng_read_limits(0x137, &sony_bl_props); | 2567 | sony_nc_backlight_ng_read_limits(0x137, &sony_bl_props); |
| 2531 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; | 2568 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; |
| 2532 | 2569 | ||
| 2570 | } else if (sony_find_snc_handle(0x143) >= 0) { | ||
| 2571 | ops = &sony_backlight_ng_ops; | ||
| 2572 | sony_bl_props.cmd_base = 0x3000; | ||
| 2573 | sony_nc_backlight_ng_read_limits(0x143, &sony_bl_props); | ||
| 2574 | max_brightness = sony_bl_props.maxlvl - sony_bl_props.offset; | ||
| 2575 | |||
| 2533 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", | 2576 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", |
| 2534 | &unused))) { | 2577 | &unused))) { |
| 2535 | ops = &sony_backlight_ops; | 2578 | ops = &sony_backlight_ops; |
| @@ -2597,6 +2640,12 @@ static int sony_nc_add(struct acpi_device *device) | |||
| 2597 | } | 2640 | } |
| 2598 | } | 2641 | } |
| 2599 | 2642 | ||
| 2643 | result = sony_laptop_setup_input(device); | ||
| 2644 | if (result) { | ||
| 2645 | pr_err("Unable to create input devices\n"); | ||
| 2646 | goto outplatform; | ||
| 2647 | } | ||
| 2648 | |||
| 2600 | if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON", | 2649 | if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "ECON", |
| 2601 | &handle))) { | 2650 | &handle))) { |
| 2602 | int arg = 1; | 2651 | int arg = 1; |
| @@ -2614,12 +2663,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
| 2614 | } | 2663 | } |
| 2615 | 2664 | ||
| 2616 | /* setup input devices and helper fifo */ | 2665 | /* setup input devices and helper fifo */ |
| 2617 | result = sony_laptop_setup_input(device); | ||
| 2618 | if (result) { | ||
| 2619 | pr_err("Unable to create input devices\n"); | ||
| 2620 | goto outsnc; | ||
| 2621 | } | ||
| 2622 | |||
| 2623 | if (acpi_video_backlight_support()) { | 2666 | if (acpi_video_backlight_support()) { |
| 2624 | pr_info("brightness ignored, must be controlled by ACPI video driver\n"); | 2667 | pr_info("brightness ignored, must be controlled by ACPI video driver\n"); |
| 2625 | } else { | 2668 | } else { |
| @@ -2667,22 +2710,21 @@ static int sony_nc_add(struct acpi_device *device) | |||
| 2667 | 2710 | ||
| 2668 | return 0; | 2711 | return 0; |
| 2669 | 2712 | ||
| 2670 | out_sysfs: | 2713 | out_sysfs: |
| 2671 | for (item = sony_nc_values; item->name; ++item) { | 2714 | for (item = sony_nc_values; item->name; ++item) { |
| 2672 | device_remove_file(&sony_pf_device->dev, &item->devattr); | 2715 | device_remove_file(&sony_pf_device->dev, &item->devattr); |
| 2673 | } | 2716 | } |
| 2674 | sony_nc_backlight_cleanup(); | 2717 | sony_nc_backlight_cleanup(); |
| 2675 | |||
| 2676 | sony_laptop_remove_input(); | ||
| 2677 | |||
| 2678 | outsnc: | ||
| 2679 | sony_nc_function_cleanup(sony_pf_device); | 2718 | sony_nc_function_cleanup(sony_pf_device); |
| 2680 | sony_nc_handles_cleanup(sony_pf_device); | 2719 | sony_nc_handles_cleanup(sony_pf_device); |
| 2681 | 2720 | ||
| 2682 | outpresent: | 2721 | outplatform: |
| 2722 | sony_laptop_remove_input(); | ||
| 2723 | |||
| 2724 | outpresent: | ||
| 2683 | sony_pf_remove(); | 2725 | sony_pf_remove(); |
| 2684 | 2726 | ||
| 2685 | outwalk: | 2727 | outwalk: |
| 2686 | sony_nc_rfkill_cleanup(); | 2728 | sony_nc_rfkill_cleanup(); |
| 2687 | return result; | 2729 | return result; |
| 2688 | } | 2730 | } |
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index e1b8c54ace5a..a739f5ca936a 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
| @@ -794,17 +794,17 @@ static __devinit int ab8500_regulator_register(struct platform_device *pdev, | |||
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | static struct of_regulator_match ab8500_regulator_matches[] = { | 796 | static struct of_regulator_match ab8500_regulator_matches[] = { |
| 797 | { .name = "LDO-AUX1", .driver_data = (void *) AB8500_LDO_AUX1, }, | 797 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, }, |
| 798 | { .name = "LDO-AUX2", .driver_data = (void *) AB8500_LDO_AUX2, }, | 798 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, }, |
| 799 | { .name = "LDO-AUX3", .driver_data = (void *) AB8500_LDO_AUX3, }, | 799 | { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8500_LDO_AUX3, }, |
| 800 | { .name = "LDO-INTCORE", .driver_data = (void *) AB8500_LDO_INTCORE, }, | 800 | { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8500_LDO_INTCORE, }, |
| 801 | { .name = "LDO-TVOUT", .driver_data = (void *) AB8500_LDO_TVOUT, }, | 801 | { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8500_LDO_TVOUT, }, |
| 802 | { .name = "LDO-USB", .driver_data = (void *) AB8500_LDO_USB, }, | 802 | { .name = "ab8500_ldo_usb", .driver_data = (void *) AB8500_LDO_USB, }, |
| 803 | { .name = "LDO-AUDIO", .driver_data = (void *) AB8500_LDO_AUDIO, }, | 803 | { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8500_LDO_AUDIO, }, |
| 804 | { .name = "LDO-ANAMIC1", .driver_data = (void *) AB8500_LDO_ANAMIC1, }, | 804 | { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8500_LDO_ANAMIC1, }, |
| 805 | { .name = "LDO-ANAMIC2", .driver_data = (void *) AB8500_LDO_ANAMIC2, }, | 805 | { .name = "ab8500_ldo_amamic2", .driver_data = (void *) AB8500_LDO_ANAMIC2, }, |
| 806 | { .name = "LDO-DMIC", .driver_data = (void *) AB8500_LDO_DMIC, }, | 806 | { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8500_LDO_DMIC, }, |
| 807 | { .name = "LDO-ANA", .driver_data = (void *) AB8500_LDO_ANA, }, | 807 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, }, |
| 808 | }; | 808 | }; |
| 809 | 809 | ||
| 810 | static __devinit int | 810 | static __devinit int |
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 3660bace123c..e82e7eaac0f1 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
| @@ -224,7 +224,7 @@ static struct platform_driver anatop_regulator_driver = { | |||
| 224 | .of_match_table = of_anatop_regulator_match_tbl, | 224 | .of_match_table = of_anatop_regulator_match_tbl, |
| 225 | }, | 225 | }, |
| 226 | .probe = anatop_regulator_probe, | 226 | .probe = anatop_regulator_probe, |
| 227 | .remove = anatop_regulator_remove, | 227 | .remove = __devexit_p(anatop_regulator_remove), |
| 228 | }; | 228 | }; |
| 229 | 229 | ||
| 230 | static int __init anatop_regulator_init(void) | 230 | static int __init anatop_regulator_init(void) |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 7584a74eec8a..8b4b3829d9e7 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
| @@ -2050,6 +2050,9 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev, | |||
| 2050 | return -EINVAL; | 2050 | return -EINVAL; |
| 2051 | } | 2051 | } |
| 2052 | 2052 | ||
| 2053 | if (min_uV < rdev->desc->min_uV) | ||
| 2054 | min_uV = rdev->desc->min_uV; | ||
| 2055 | |||
| 2053 | ret = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step); | 2056 | ret = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step); |
| 2054 | if (ret < 0) | 2057 | if (ret < 0) |
| 2055 | return ret; | 2058 | return ret; |
| @@ -2516,9 +2519,12 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | |||
| 2516 | { | 2519 | { |
| 2517 | struct regulator_dev *rdev = regulator->rdev; | 2520 | struct regulator_dev *rdev = regulator->rdev; |
| 2518 | struct regulator *consumer; | 2521 | struct regulator *consumer; |
| 2519 | int ret, output_uV, input_uV, total_uA_load = 0; | 2522 | int ret, output_uV, input_uV = 0, total_uA_load = 0; |
| 2520 | unsigned int mode; | 2523 | unsigned int mode; |
| 2521 | 2524 | ||
| 2525 | if (rdev->supply) | ||
| 2526 | input_uV = regulator_get_voltage(rdev->supply); | ||
| 2527 | |||
| 2522 | mutex_lock(&rdev->mutex); | 2528 | mutex_lock(&rdev->mutex); |
| 2523 | 2529 | ||
| 2524 | /* | 2530 | /* |
| @@ -2551,10 +2557,7 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load) | |||
| 2551 | goto out; | 2557 | goto out; |
| 2552 | } | 2558 | } |
| 2553 | 2559 | ||
| 2554 | /* get input voltage */ | 2560 | /* No supply? Use constraint voltage */ |
| 2555 | input_uV = 0; | ||
| 2556 | if (rdev->supply) | ||
| 2557 | input_uV = regulator_get_voltage(rdev->supply); | ||
| 2558 | if (input_uV <= 0) | 2561 | if (input_uV <= 0) |
| 2559 | input_uV = rdev->constraints->input_uV; | 2562 | input_uV = rdev->constraints->input_uV; |
| 2560 | if (input_uV <= 0) { | 2563 | if (input_uV <= 0) { |
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c index 968f97f3cb3d..9dbb491b6efa 100644 --- a/drivers/regulator/db8500-prcmu.c +++ b/drivers/regulator/db8500-prcmu.c | |||
| @@ -452,26 +452,26 @@ static __devinit int db8500_regulator_register(struct platform_device *pdev, | |||
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | static struct of_regulator_match db8500_regulator_matches[] = { | 454 | static struct of_regulator_match db8500_regulator_matches[] = { |
| 455 | { .name = "db8500-vape", .driver_data = (void *) DB8500_REGULATOR_VAPE, }, | 455 | { .name = "db8500_vape", .driver_data = (void *) DB8500_REGULATOR_VAPE, }, |
| 456 | { .name = "db8500-varm", .driver_data = (void *) DB8500_REGULATOR_VARM, }, | 456 | { .name = "db8500_varm", .driver_data = (void *) DB8500_REGULATOR_VARM, }, |
| 457 | { .name = "db8500-vmodem", .driver_data = (void *) DB8500_REGULATOR_VMODEM, }, | 457 | { .name = "db8500_vmodem", .driver_data = (void *) DB8500_REGULATOR_VMODEM, }, |
| 458 | { .name = "db8500-vpll", .driver_data = (void *) DB8500_REGULATOR_VPLL, }, | 458 | { .name = "db8500_vpll", .driver_data = (void *) DB8500_REGULATOR_VPLL, }, |
| 459 | { .name = "db8500-vsmps1", .driver_data = (void *) DB8500_REGULATOR_VSMPS1, }, | 459 | { .name = "db8500_vsmps1", .driver_data = (void *) DB8500_REGULATOR_VSMPS1, }, |
| 460 | { .name = "db8500-vsmps2", .driver_data = (void *) DB8500_REGULATOR_VSMPS2, }, | 460 | { .name = "db8500_vsmps2", .driver_data = (void *) DB8500_REGULATOR_VSMPS2, }, |
| 461 | { .name = "db8500-vsmps3", .driver_data = (void *) DB8500_REGULATOR_VSMPS3, }, | 461 | { .name = "db8500_vsmps3", .driver_data = (void *) DB8500_REGULATOR_VSMPS3, }, |
| 462 | { .name = "db8500-vrf1", .driver_data = (void *) DB8500_REGULATOR_VRF1, }, | 462 | { .name = "db8500_vrf1", .driver_data = (void *) DB8500_REGULATOR_VRF1, }, |
| 463 | { .name = "db8500-sva-mmdsp", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAMMDSP, }, | 463 | { .name = "db8500_sva_mmdsp", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAMMDSP, }, |
| 464 | { .name = "db8500-sva-mmdsp-ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAMMDSPRET, }, | 464 | { .name = "db8500_sva_mmdsp_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAMMDSPRET, }, |
| 465 | { .name = "db8500-sva-pipe", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAPIPE, }, | 465 | { .name = "db8500_sva_pipe", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SVAPIPE, }, |
| 466 | { .name = "db8500-sia-mmdsp", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAMMDSP, }, | 466 | { .name = "db8500_sia_mmdsp", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAMMDSP, }, |
| 467 | { .name = "db8500-sia-mmdsp-ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAMMDSPRET, }, | 467 | { .name = "db8500_sia_mmdsp_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAMMDSPRET, }, |
| 468 | { .name = "db8500-sia-pipe", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAPIPE, }, | 468 | { .name = "db8500_sia_pipe", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SIAPIPE, }, |
| 469 | { .name = "db8500-sga", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SGA, }, | 469 | { .name = "db8500_sga", .driver_data = (void *) DB8500_REGULATOR_SWITCH_SGA, }, |
| 470 | { .name = "db8500-b2r2-mcde", .driver_data = (void *) DB8500_REGULATOR_SWITCH_B2R2_MCDE, }, | 470 | { .name = "db8500_b2r2_mcde", .driver_data = (void *) DB8500_REGULATOR_SWITCH_B2R2_MCDE, }, |
| 471 | { .name = "db8500-esram12", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM12, }, | 471 | { .name = "db8500_esram12", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM12, }, |
| 472 | { .name = "db8500-esram12-ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM12RET, }, | 472 | { .name = "db8500_esram12_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM12RET, }, |
| 473 | { .name = "db8500-esram34", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34, }, | 473 | { .name = "db8500_esram34", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34, }, |
| 474 | { .name = "db8500-esram34-ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34RET, }, | 474 | { .name = "db8500_esram34_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34RET, }, |
| 475 | }; | 475 | }; |
| 476 | 476 | ||
| 477 | static __devinit int | 477 | static __devinit int |
diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 9997d7aaca84..242851a4c1a6 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c | |||
| @@ -101,16 +101,20 @@ static int gpio_regulator_get_value(struct regulator_dev *dev) | |||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | static int gpio_regulator_set_value(struct regulator_dev *dev, | 103 | static int gpio_regulator_set_value(struct regulator_dev *dev, |
| 104 | int min, int max) | 104 | int min, int max, unsigned *selector) |
| 105 | { | 105 | { |
| 106 | struct gpio_regulator_data *data = rdev_get_drvdata(dev); | 106 | struct gpio_regulator_data *data = rdev_get_drvdata(dev); |
| 107 | int ptr, target, state, best_val = INT_MAX; | 107 | int ptr, target = 0, state, best_val = INT_MAX; |
| 108 | 108 | ||
| 109 | for (ptr = 0; ptr < data->nr_states; ptr++) | 109 | for (ptr = 0; ptr < data->nr_states; ptr++) |
| 110 | if (data->states[ptr].value < best_val && | 110 | if (data->states[ptr].value < best_val && |
| 111 | data->states[ptr].value >= min && | 111 | data->states[ptr].value >= min && |
| 112 | data->states[ptr].value <= max) | 112 | data->states[ptr].value <= max) { |
| 113 | target = data->states[ptr].gpios; | 113 | target = data->states[ptr].gpios; |
| 114 | best_val = data->states[ptr].value; | ||
| 115 | if (selector) | ||
| 116 | *selector = ptr; | ||
| 117 | } | ||
| 114 | 118 | ||
| 115 | if (best_val == INT_MAX) | 119 | if (best_val == INT_MAX) |
| 116 | return -EINVAL; | 120 | return -EINVAL; |
| @@ -128,7 +132,7 @@ static int gpio_regulator_set_voltage(struct regulator_dev *dev, | |||
| 128 | int min_uV, int max_uV, | 132 | int min_uV, int max_uV, |
| 129 | unsigned *selector) | 133 | unsigned *selector) |
| 130 | { | 134 | { |
| 131 | return gpio_regulator_set_value(dev, min_uV, max_uV); | 135 | return gpio_regulator_set_value(dev, min_uV, max_uV, selector); |
| 132 | } | 136 | } |
| 133 | 137 | ||
| 134 | static int gpio_regulator_list_voltage(struct regulator_dev *dev, | 138 | static int gpio_regulator_list_voltage(struct regulator_dev *dev, |
| @@ -145,7 +149,7 @@ static int gpio_regulator_list_voltage(struct regulator_dev *dev, | |||
| 145 | static int gpio_regulator_set_current_limit(struct regulator_dev *dev, | 149 | static int gpio_regulator_set_current_limit(struct regulator_dev *dev, |
| 146 | int min_uA, int max_uA) | 150 | int min_uA, int max_uA) |
| 147 | { | 151 | { |
| 148 | return gpio_regulator_set_value(dev, min_uA, max_uA); | 152 | return gpio_regulator_set_value(dev, min_uA, max_uA, NULL); |
| 149 | } | 153 | } |
| 150 | 154 | ||
| 151 | static struct regulator_ops gpio_regulator_voltage_ops = { | 155 | static struct regulator_ops gpio_regulator_voltage_ops = { |
| @@ -286,7 +290,7 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev) | |||
| 286 | 290 | ||
| 287 | cfg.dev = &pdev->dev; | 291 | cfg.dev = &pdev->dev; |
| 288 | cfg.init_data = config->init_data; | 292 | cfg.init_data = config->init_data; |
| 289 | cfg.driver_data = &drvdata; | 293 | cfg.driver_data = drvdata; |
| 290 | 294 | ||
| 291 | drvdata->dev = regulator_register(&drvdata->desc, &cfg); | 295 | drvdata->dev = regulator_register(&drvdata->desc, &cfg); |
| 292 | if (IS_ERR(drvdata->dev)) { | 296 | if (IS_ERR(drvdata->dev)) { |
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 1f4bb80457b3..9d540cd02dab 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c | |||
| @@ -259,6 +259,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client, | |||
| 259 | config.dev = &client->dev; | 259 | config.dev = &client->dev; |
| 260 | config.init_data = pdata->regulator; | 260 | config.init_data = pdata->regulator; |
| 261 | config.driver_data = info; | 261 | config.driver_data = info; |
| 262 | config.regmap = info->regmap; | ||
| 262 | 263 | ||
| 263 | info->regulator = regulator_register(&dcdc_desc, &config); | 264 | info->regulator = regulator_register(&dcdc_desc, &config); |
| 264 | if (IS_ERR(info->regulator)) { | 265 | if (IS_ERR(info->regulator)) { |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index c4435f608df7..795f75a6ac33 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
| @@ -673,7 +673,9 @@ static __devinit int palmas_probe(struct platform_device *pdev) | |||
| 673 | pmic->desc[id].ops = &palmas_ops_smps10; | 673 | pmic->desc[id].ops = &palmas_ops_smps10; |
| 674 | pmic->desc[id].vsel_reg = PALMAS_SMPS10_CTRL; | 674 | pmic->desc[id].vsel_reg = PALMAS_SMPS10_CTRL; |
| 675 | pmic->desc[id].vsel_mask = SMPS10_VSEL; | 675 | pmic->desc[id].vsel_mask = SMPS10_VSEL; |
| 676 | pmic->desc[id].enable_reg = PALMAS_SMPS10_STATUS; | 676 | pmic->desc[id].enable_reg = |
| 677 | PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, | ||
| 678 | PALMAS_SMPS10_STATUS); | ||
| 677 | pmic->desc[id].enable_mask = SMPS10_BOOST_EN; | 679 | pmic->desc[id].enable_mask = SMPS10_BOOST_EN; |
| 678 | } | 680 | } |
| 679 | 681 | ||
| @@ -739,7 +741,8 @@ static __devinit int palmas_probe(struct platform_device *pdev) | |||
| 739 | 741 | ||
| 740 | pmic->desc[id].type = REGULATOR_VOLTAGE; | 742 | pmic->desc[id].type = REGULATOR_VOLTAGE; |
| 741 | pmic->desc[id].owner = THIS_MODULE; | 743 | pmic->desc[id].owner = THIS_MODULE; |
| 742 | pmic->desc[id].enable_reg = palmas_regs_info[id].ctrl_addr; | 744 | pmic->desc[id].enable_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, |
| 745 | palmas_regs_info[id].ctrl_addr); | ||
| 743 | pmic->desc[id].enable_mask = PALMAS_LDO1_CTRL_MODE_ACTIVE; | 746 | pmic->desc[id].enable_mask = PALMAS_LDO1_CTRL_MODE_ACTIVE; |
| 744 | 747 | ||
| 745 | if (pdata && pdata->reg_data) | 748 | if (pdata && pdata->reg_data) |
| @@ -775,9 +778,6 @@ static __devinit int palmas_probe(struct platform_device *pdev) | |||
| 775 | err_unregister_regulator: | 778 | err_unregister_regulator: |
| 776 | while (--id >= 0) | 779 | while (--id >= 0) |
| 777 | regulator_unregister(pmic->rdev[id]); | 780 | regulator_unregister(pmic->rdev[id]); |
| 778 | kfree(pmic->rdev); | ||
| 779 | kfree(pmic->desc); | ||
| 780 | kfree(pmic); | ||
| 781 | return ret; | 781 | return ret; |
| 782 | } | 782 | } |
| 783 | 783 | ||
| @@ -788,10 +788,6 @@ static int __devexit palmas_remove(struct platform_device *pdev) | |||
| 788 | 788 | ||
| 789 | for (id = 0; id < PALMAS_NUM_REGS; id++) | 789 | for (id = 0; id < PALMAS_NUM_REGS; id++) |
| 790 | regulator_unregister(pmic->rdev[id]); | 790 | regulator_unregister(pmic->rdev[id]); |
| 791 | |||
| 792 | kfree(pmic->rdev); | ||
| 793 | kfree(pmic->desc); | ||
| 794 | kfree(pmic); | ||
| 795 | return 0; | 791 | return 0; |
| 796 | } | 792 | } |
| 797 | 793 | ||
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 290d6fc01029..9caadb482178 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
| @@ -451,7 +451,7 @@ static int s5m8767_set_voltage_time_sel(struct regulator_dev *rdev, | |||
| 451 | 451 | ||
| 452 | desc = reg_voltage_map[reg_id]; | 452 | desc = reg_voltage_map[reg_id]; |
| 453 | 453 | ||
| 454 | if (old_sel < new_sel) | 454 | if ((old_sel < new_sel) && s5m8767->ramp_delay) |
| 455 | return DIV_ROUND_UP(desc->step * (new_sel - old_sel), | 455 | return DIV_ROUND_UP(desc->step * (new_sel - old_sel), |
| 456 | s5m8767->ramp_delay * 1000); | 456 | s5m8767->ramp_delay * 1000); |
| 457 | return 0; | 457 | return 0; |
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c index f841bd0db6aa..8f1be8586c72 100644 --- a/drivers/regulator/tps65023-regulator.c +++ b/drivers/regulator/tps65023-regulator.c | |||
| @@ -71,7 +71,7 @@ | |||
| 71 | 71 | ||
| 72 | /* LDO_CTRL bitfields */ | 72 | /* LDO_CTRL bitfields */ |
| 73 | #define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id) ((ldo_id)*4) | 73 | #define TPS65023_LDO_CTRL_LDOx_SHIFT(ldo_id) ((ldo_id)*4) |
| 74 | #define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id) (0x0F << ((ldo_id)*4)) | 74 | #define TPS65023_LDO_CTRL_LDOx_MASK(ldo_id) (0x07 << ((ldo_id)*4)) |
| 75 | 75 | ||
| 76 | /* Number of step-down converters available */ | 76 | /* Number of step-down converters available */ |
| 77 | #define TPS65023_NUM_DCDC 3 | 77 | #define TPS65023_NUM_DCDC 3 |
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c index b88b3df82381..1b299aacf22f 100644 --- a/drivers/regulator/tps6524x-regulator.c +++ b/drivers/regulator/tps6524x-regulator.c | |||
| @@ -482,7 +482,7 @@ static int get_voltage_sel(struct regulator_dev *rdev) | |||
| 482 | info = &supply_info[rdev_get_id(rdev)]; | 482 | info = &supply_info[rdev_get_id(rdev)]; |
| 483 | 483 | ||
| 484 | if (info->flags & FIXED_VOLTAGE) | 484 | if (info->flags & FIXED_VOLTAGE) |
| 485 | return info->fixed_voltage; | 485 | return 0; |
| 486 | 486 | ||
| 487 | ret = read_field(hw, &info->voltage); | 487 | ret = read_field(hw, &info->voltage); |
| 488 | if (ret < 0) | 488 | if (ret < 0) |
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 24d880e78ec6..f8d818abf98c 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig | |||
| @@ -4,9 +4,11 @@ menu "Remoteproc drivers (EXPERIMENTAL)" | |||
| 4 | config REMOTEPROC | 4 | config REMOTEPROC |
| 5 | tristate | 5 | tristate |
| 6 | depends on EXPERIMENTAL | 6 | depends on EXPERIMENTAL |
| 7 | select FW_CONFIG | ||
| 7 | 8 | ||
| 8 | config OMAP_REMOTEPROC | 9 | config OMAP_REMOTEPROC |
| 9 | tristate "OMAP remoteproc support" | 10 | tristate "OMAP remoteproc support" |
| 11 | depends on EXPERIMENTAL | ||
| 10 | depends on ARCH_OMAP4 | 12 | depends on ARCH_OMAP4 |
| 11 | depends on OMAP_IOMMU | 13 | depends on OMAP_IOMMU |
| 12 | select REMOTEPROC | 14 | select REMOTEPROC |
diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c index 69425c4e86f3..de138e30d3e6 100644 --- a/drivers/remoteproc/omap_remoteproc.c +++ b/drivers/remoteproc/omap_remoteproc.c | |||
| @@ -182,7 +182,7 @@ static int __devinit omap_rproc_probe(struct platform_device *pdev) | |||
| 182 | 182 | ||
| 183 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); | 183 | ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); |
| 184 | if (ret) { | 184 | if (ret) { |
| 185 | dev_err(pdev->dev.parent, "dma_set_coherent_mask: %d\n", ret); | 185 | dev_err(&pdev->dev, "dma_set_coherent_mask: %d\n", ret); |
| 186 | return ret; | 186 | return ret; |
| 187 | } | 187 | } |
| 188 | 188 | ||
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 8ea7bccc7100..66324ee4678f 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c | |||
| @@ -247,7 +247,7 @@ rproc_load_segments(struct rproc *rproc, const u8 *elf_data, size_t len) | |||
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | if (offset + filesz > len) { | 249 | if (offset + filesz > len) { |
| 250 | dev_err(dev, "truncated fw: need 0x%x avail 0x%x\n", | 250 | dev_err(dev, "truncated fw: need 0x%x avail 0x%zx\n", |
| 251 | offset + filesz, len); | 251 | offset + filesz, len); |
| 252 | ret = -EINVAL; | 252 | ret = -EINVAL; |
| 253 | break; | 253 | break; |
| @@ -934,7 +934,7 @@ static void rproc_resource_cleanup(struct rproc *rproc) | |||
| 934 | unmapped = iommu_unmap(rproc->domain, entry->da, entry->len); | 934 | unmapped = iommu_unmap(rproc->domain, entry->da, entry->len); |
| 935 | if (unmapped != entry->len) { | 935 | if (unmapped != entry->len) { |
| 936 | /* nothing much to do besides complaining */ | 936 | /* nothing much to do besides complaining */ |
| 937 | dev_err(dev, "failed to unmap %u/%u\n", entry->len, | 937 | dev_err(dev, "failed to unmap %u/%zu\n", entry->len, |
| 938 | unmapped); | 938 | unmapped); |
| 939 | } | 939 | } |
| 940 | 940 | ||
| @@ -1020,7 +1020,7 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) | |||
| 1020 | 1020 | ||
| 1021 | ehdr = (struct elf32_hdr *)fw->data; | 1021 | ehdr = (struct elf32_hdr *)fw->data; |
| 1022 | 1022 | ||
| 1023 | dev_info(dev, "Booting fw image %s, size %d\n", name, fw->size); | 1023 | dev_info(dev, "Booting fw image %s, size %zd\n", name, fw->size); |
| 1024 | 1024 | ||
| 1025 | /* | 1025 | /* |
| 1026 | * if enabling an IOMMU isn't relevant for this rproc, this is | 1026 | * if enabling an IOMMU isn't relevant for this rproc, this is |
| @@ -1041,8 +1041,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) | |||
| 1041 | 1041 | ||
| 1042 | /* look for the resource table */ | 1042 | /* look for the resource table */ |
| 1043 | table = rproc_find_rsc_table(rproc, fw->data, fw->size, &tablesz); | 1043 | table = rproc_find_rsc_table(rproc, fw->data, fw->size, &tablesz); |
| 1044 | if (!table) | 1044 | if (!table) { |
| 1045 | ret = -EINVAL; | ||
| 1045 | goto clean_up; | 1046 | goto clean_up; |
| 1047 | } | ||
| 1046 | 1048 | ||
| 1047 | /* handle fw resources which are required to boot rproc */ | 1049 | /* handle fw resources which are required to boot rproc */ |
| 1048 | ret = rproc_handle_boot_rsc(rproc, table, tablesz); | 1050 | ret = rproc_handle_boot_rsc(rproc, table, tablesz); |
diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index 75506ec2840e..f56c8ba3a861 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c | |||
| @@ -188,6 +188,26 @@ static int rpmsg_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 188 | rpdev->id.name); | 188 | rpdev->id.name); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | /** | ||
| 192 | * __ept_release() - deallocate an rpmsg endpoint | ||
| 193 | * @kref: the ept's reference count | ||
| 194 | * | ||
| 195 | * This function deallocates an ept, and is invoked when its @kref refcount | ||
| 196 | * drops to zero. | ||
| 197 | * | ||
| 198 | * Never invoke this function directly! | ||
| 199 | */ | ||
| 200 | static void __ept_release(struct kref *kref) | ||
| 201 | { | ||
| 202 | struct rpmsg_endpoint *ept = container_of(kref, struct rpmsg_endpoint, | ||
| 203 | refcount); | ||
| 204 | /* | ||
| 205 | * At this point no one holds a reference to ept anymore, | ||
| 206 | * so we can directly free it | ||
| 207 | */ | ||
| 208 | kfree(ept); | ||
| 209 | } | ||
| 210 | |||
| 191 | /* for more info, see below documentation of rpmsg_create_ept() */ | 211 | /* for more info, see below documentation of rpmsg_create_ept() */ |
| 192 | static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, | 212 | static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, |
| 193 | struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb, | 213 | struct rpmsg_channel *rpdev, rpmsg_rx_cb_t cb, |
| @@ -206,6 +226,9 @@ static struct rpmsg_endpoint *__rpmsg_create_ept(struct virtproc_info *vrp, | |||
| 206 | return NULL; | 226 | return NULL; |
| 207 | } | 227 | } |
| 208 | 228 | ||
| 229 | kref_init(&ept->refcount); | ||
| 230 | mutex_init(&ept->cb_lock); | ||
| 231 | |||
| 209 | ept->rpdev = rpdev; | 232 | ept->rpdev = rpdev; |
| 210 | ept->cb = cb; | 233 | ept->cb = cb; |
| 211 | ept->priv = priv; | 234 | ept->priv = priv; |
| @@ -238,7 +261,7 @@ rem_idr: | |||
| 238 | idr_remove(&vrp->endpoints, request); | 261 | idr_remove(&vrp->endpoints, request); |
| 239 | free_ept: | 262 | free_ept: |
| 240 | mutex_unlock(&vrp->endpoints_lock); | 263 | mutex_unlock(&vrp->endpoints_lock); |
| 241 | kfree(ept); | 264 | kref_put(&ept->refcount, __ept_release); |
| 242 | return NULL; | 265 | return NULL; |
| 243 | } | 266 | } |
| 244 | 267 | ||
| @@ -302,11 +325,17 @@ EXPORT_SYMBOL(rpmsg_create_ept); | |||
| 302 | static void | 325 | static void |
| 303 | __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) | 326 | __rpmsg_destroy_ept(struct virtproc_info *vrp, struct rpmsg_endpoint *ept) |
| 304 | { | 327 | { |
| 328 | /* make sure new inbound messages can't find this ept anymore */ | ||
| 305 | mutex_lock(&vrp->endpoints_lock); | 329 | mutex_lock(&vrp->endpoints_lock); |
| 306 | idr_remove(&vrp->endpoints, ept->addr); | 330 | idr_remove(&vrp->endpoints, ept->addr); |
| 307 | mutex_unlock(&vrp->endpoints_lock); | 331 | mutex_unlock(&vrp->endpoints_lock); |
| 308 | 332 | ||
| 309 | kfree(ept); | 333 | /* make sure in-flight inbound messages won't invoke cb anymore */ |
| 334 | mutex_lock(&ept->cb_lock); | ||
| 335 | ept->cb = NULL; | ||
| 336 | mutex_unlock(&ept->cb_lock); | ||
| 337 | |||
| 338 | kref_put(&ept->refcount, __ept_release); | ||
| 310 | } | 339 | } |
| 311 | 340 | ||
| 312 | /** | 341 | /** |
| @@ -790,12 +819,28 @@ static void rpmsg_recv_done(struct virtqueue *rvq) | |||
| 790 | 819 | ||
| 791 | /* use the dst addr to fetch the callback of the appropriate user */ | 820 | /* use the dst addr to fetch the callback of the appropriate user */ |
| 792 | mutex_lock(&vrp->endpoints_lock); | 821 | mutex_lock(&vrp->endpoints_lock); |
| 822 | |||
| 793 | ept = idr_find(&vrp->endpoints, msg->dst); | 823 | ept = idr_find(&vrp->endpoints, msg->dst); |
| 824 | |||
| 825 | /* let's make sure no one deallocates ept while we use it */ | ||
| 826 | if (ept) | ||
| 827 | kref_get(&ept->refcount); | ||
| 828 | |||
| 794 | mutex_unlock(&vrp->endpoints_lock); | 829 | mutex_unlock(&vrp->endpoints_lock); |
| 795 | 830 | ||
| 796 | if (ept && ept->cb) | 831 | if (ept) { |
| 797 | ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, msg->src); | 832 | /* make sure ept->cb doesn't go away while we use it */ |
| 798 | else | 833 | mutex_lock(&ept->cb_lock); |
| 834 | |||
| 835 | if (ept->cb) | ||
| 836 | ept->cb(ept->rpdev, msg->data, msg->len, ept->priv, | ||
| 837 | msg->src); | ||
| 838 | |||
| 839 | mutex_unlock(&ept->cb_lock); | ||
| 840 | |||
| 841 | /* farewell, ept, we don't need you anymore */ | ||
| 842 | kref_put(&ept->refcount, __ept_release); | ||
| 843 | } else | ||
| 799 | dev_warn(dev, "msg received with no recepient\n"); | 844 | dev_warn(dev, "msg received with no recepient\n"); |
| 800 | 845 | ||
| 801 | /* publish the real size of the buffer */ | 846 | /* publish the real size of the buffer */ |
| @@ -1040,7 +1085,7 @@ static int __init rpmsg_init(void) | |||
| 1040 | 1085 | ||
| 1041 | return ret; | 1086 | return ret; |
| 1042 | } | 1087 | } |
| 1043 | module_init(rpmsg_init); | 1088 | subsys_initcall(rpmsg_init); |
| 1044 | 1089 | ||
| 1045 | static void __exit rpmsg_fini(void) | 1090 | static void __exit rpmsg_fini(void) |
| 1046 | { | 1091 | { |
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index 4bcf9ca2818a..370889d0489b 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/mfd/abx500.h> | 17 | #include <linux/mfd/abx500.h> |
| 18 | #include <linux/mfd/abx500/ab8500.h> | 18 | #include <linux/mfd/abx500/ab8500.h> |
| 19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
| 20 | #include <linux/of.h> | ||
| 20 | 21 | ||
| 21 | #define AB8500_RTC_SOFF_STAT_REG 0x00 | 22 | #define AB8500_RTC_SOFF_STAT_REG 0x00 |
| 22 | #define AB8500_RTC_CC_CONF_REG 0x01 | 23 | #define AB8500_RTC_CC_CONF_REG 0x01 |
| @@ -422,7 +423,7 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
| 422 | } | 423 | } |
| 423 | 424 | ||
| 424 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, | 425 | err = request_threaded_irq(irq, NULL, rtc_alarm_handler, |
| 425 | IRQF_NO_SUSPEND, "ab8500-rtc", rtc); | 426 | IRQF_NO_SUSPEND | IRQF_ONESHOT, "ab8500-rtc", rtc); |
| 426 | if (err < 0) { | 427 | if (err < 0) { |
| 427 | rtc_device_unregister(rtc); | 428 | rtc_device_unregister(rtc); |
| 428 | return err; | 429 | return err; |
| @@ -430,7 +431,6 @@ static int __devinit ab8500_rtc_probe(struct platform_device *pdev) | |||
| 430 | 431 | ||
| 431 | platform_set_drvdata(pdev, rtc); | 432 | platform_set_drvdata(pdev, rtc); |
| 432 | 433 | ||
| 433 | |||
| 434 | err = ab8500_sysfs_rtc_register(&pdev->dev); | 434 | err = ab8500_sysfs_rtc_register(&pdev->dev); |
| 435 | if (err) { | 435 | if (err) { |
| 436 | dev_err(&pdev->dev, "sysfs RTC failed to register\n"); | 436 | dev_err(&pdev->dev, "sysfs RTC failed to register\n"); |
| @@ -454,10 +454,16 @@ static int __devexit ab8500_rtc_remove(struct platform_device *pdev) | |||
| 454 | return 0; | 454 | return 0; |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | static const struct of_device_id ab8500_rtc_match[] = { | ||
| 458 | { .compatible = "stericsson,ab8500-rtc", }, | ||
| 459 | {} | ||
| 460 | }; | ||
| 461 | |||
| 457 | static struct platform_driver ab8500_rtc_driver = { | 462 | static struct platform_driver ab8500_rtc_driver = { |
| 458 | .driver = { | 463 | .driver = { |
| 459 | .name = "ab8500-rtc", | 464 | .name = "ab8500-rtc", |
| 460 | .owner = THIS_MODULE, | 465 | .owner = THIS_MODULE, |
| 466 | .of_match_table = ab8500_rtc_match, | ||
| 461 | }, | 467 | }, |
| 462 | .probe = ab8500_rtc_probe, | 468 | .probe = ab8500_rtc_probe, |
| 463 | .remove = __devexit_p(ab8500_rtc_remove), | 469 | .remove = __devexit_p(ab8500_rtc_remove), |
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 5e1d64ee5228..e3e50d69baf8 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c | |||
| @@ -202,10 +202,11 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
| 202 | struct platform_device *pdev = dev_id; | 202 | struct platform_device *pdev = dev_id; |
| 203 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); | 203 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
| 204 | void __iomem *ioaddr = pdata->ioaddr; | 204 | void __iomem *ioaddr = pdata->ioaddr; |
| 205 | unsigned long flags; | ||
| 205 | u32 status; | 206 | u32 status; |
| 206 | u32 events = 0; | 207 | u32 events = 0; |
| 207 | 208 | ||
| 208 | spin_lock_irq(&pdata->rtc->irq_lock); | 209 | spin_lock_irqsave(&pdata->rtc->irq_lock, flags); |
| 209 | status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR); | 210 | status = readw(ioaddr + RTC_RTCISR) & readw(ioaddr + RTC_RTCIENR); |
| 210 | /* clear interrupt sources */ | 211 | /* clear interrupt sources */ |
| 211 | writew(status, ioaddr + RTC_RTCISR); | 212 | writew(status, ioaddr + RTC_RTCISR); |
| @@ -224,7 +225,7 @@ static irqreturn_t mxc_rtc_interrupt(int irq, void *dev_id) | |||
| 224 | events |= (RTC_PF | RTC_IRQF); | 225 | events |= (RTC_PF | RTC_IRQF); |
| 225 | 226 | ||
| 226 | rtc_update_irq(pdata->rtc, 1, events); | 227 | rtc_update_irq(pdata->rtc, 1, events); |
| 227 | spin_unlock_irq(&pdata->rtc->irq_lock); | 228 | spin_unlock_irqrestore(&pdata->rtc->irq_lock, flags); |
| 228 | 229 | ||
| 229 | return IRQ_HANDLED; | 230 | return IRQ_HANDLED; |
| 230 | } | 231 | } |
diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c index 1f76320e545b..e2785479113c 100644 --- a/drivers/rtc/rtc-spear.c +++ b/drivers/rtc/rtc-spear.c | |||
| @@ -458,12 +458,12 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev) | |||
| 458 | clk_disable(config->clk); | 458 | clk_disable(config->clk); |
| 459 | clk_put(config->clk); | 459 | clk_put(config->clk); |
| 460 | iounmap(config->ioaddr); | 460 | iounmap(config->ioaddr); |
| 461 | kfree(config); | ||
| 462 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 461 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 463 | if (res) | 462 | if (res) |
| 464 | release_mem_region(res->start, resource_size(res)); | 463 | release_mem_region(res->start, resource_size(res)); |
| 465 | platform_set_drvdata(pdev, NULL); | 464 | platform_set_drvdata(pdev, NULL); |
| 466 | rtc_device_unregister(config->rtc); | 465 | rtc_device_unregister(config->rtc); |
| 466 | kfree(config); | ||
| 467 | 467 | ||
| 468 | return 0; | 468 | return 0; |
| 469 | } | 469 | } |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 258abeabf624..c5d06fe83bba 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
| @@ -510,7 +510,7 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev) | |||
| 510 | } | 510 | } |
| 511 | 511 | ||
| 512 | ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt, | 512 | ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt, |
| 513 | IRQF_TRIGGER_RISING, | 513 | IRQF_TRIGGER_RISING | IRQF_ONESHOT, |
| 514 | dev_name(&rtc->dev), rtc); | 514 | dev_name(&rtc->dev), rtc); |
| 515 | if (ret < 0) { | 515 | if (ret < 0) { |
| 516 | dev_err(&pdev->dev, "IRQ is not free.\n"); | 516 | dev_err(&pdev->dev, "IRQ is not free.\n"); |
diff --git a/drivers/scsi/aic94xx/aic94xx_task.c b/drivers/scsi/aic94xx/aic94xx_task.c index 532d212b6b2c..393e7ce8e95a 100644 --- a/drivers/scsi/aic94xx/aic94xx_task.c +++ b/drivers/scsi/aic94xx/aic94xx_task.c | |||
| @@ -201,7 +201,7 @@ static void asd_get_response_tasklet(struct asd_ascb *ascb, | |||
| 201 | 201 | ||
| 202 | if (SAS_STATUS_BUF_SIZE >= sizeof(*resp)) { | 202 | if (SAS_STATUS_BUF_SIZE >= sizeof(*resp)) { |
| 203 | resp->frame_len = le16_to_cpu(*(__le16 *)(r+6)); | 203 | resp->frame_len = le16_to_cpu(*(__le16 *)(r+6)); |
| 204 | memcpy(&resp->ending_fis[0], r+16, 24); | 204 | memcpy(&resp->ending_fis[0], r+16, ATA_RESP_FIS_SIZE); |
| 205 | ts->buf_valid_size = sizeof(*resp); | 205 | ts->buf_valid_size = sizeof(*resp); |
| 206 | } | 206 | } |
| 207 | } | 207 | } |
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h index 0c53c28dc3d3..7e77cf620291 100644 --- a/drivers/scsi/bnx2i/bnx2i.h +++ b/drivers/scsi/bnx2i/bnx2i.h | |||
| @@ -350,6 +350,7 @@ struct bnx2i_hba { | |||
| 350 | struct pci_dev *pcidev; | 350 | struct pci_dev *pcidev; |
| 351 | struct net_device *netdev; | 351 | struct net_device *netdev; |
| 352 | void __iomem *regview; | 352 | void __iomem *regview; |
| 353 | resource_size_t reg_base; | ||
| 353 | 354 | ||
| 354 | u32 age; | 355 | u32 age; |
| 355 | unsigned long cnic_dev_type; | 356 | unsigned long cnic_dev_type; |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index ece47e502282..86a12b48e477 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
| @@ -2724,7 +2724,6 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep) | |||
| 2724 | goto arm_cq; | 2724 | goto arm_cq; |
| 2725 | } | 2725 | } |
| 2726 | 2726 | ||
| 2727 | reg_base = ep->hba->netdev->base_addr; | ||
| 2728 | if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) && | 2727 | if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) && |
| 2729 | (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) { | 2728 | (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) { |
| 2730 | config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2); | 2729 | config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2); |
| @@ -2740,7 +2739,7 @@ int bnx2i_map_ep_dbell_regs(struct bnx2i_endpoint *ep) | |||
| 2740 | /* 5709 device in normal node and 5706/5708 devices */ | 2739 | /* 5709 device in normal node and 5706/5708 devices */ |
| 2741 | reg_off = CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num); | 2740 | reg_off = CTX_OFFSET + (MB_KERNEL_CTX_SIZE * cid_num); |
| 2742 | 2741 | ||
| 2743 | ep->qp.ctx_base = ioremap_nocache(reg_base + reg_off, | 2742 | ep->qp.ctx_base = ioremap_nocache(ep->hba->reg_base + reg_off, |
| 2744 | MB_KERNEL_CTX_SIZE); | 2743 | MB_KERNEL_CTX_SIZE); |
| 2745 | if (!ep->qp.ctx_base) | 2744 | if (!ep->qp.ctx_base) |
| 2746 | return -ENOMEM; | 2745 | return -ENOMEM; |
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index f8d516b53161..621538b8b544 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c | |||
| @@ -811,13 +811,13 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic) | |||
| 811 | bnx2i_identify_device(hba); | 811 | bnx2i_identify_device(hba); |
| 812 | bnx2i_setup_host_queue_size(hba, shost); | 812 | bnx2i_setup_host_queue_size(hba, shost); |
| 813 | 813 | ||
| 814 | hba->reg_base = pci_resource_start(hba->pcidev, 0); | ||
| 814 | if (test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) { | 815 | if (test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) { |
| 815 | hba->regview = ioremap_nocache(hba->netdev->base_addr, | 816 | hba->regview = pci_iomap(hba->pcidev, 0, BNX2_MQ_CONFIG2); |
| 816 | BNX2_MQ_CONFIG2); | ||
| 817 | if (!hba->regview) | 817 | if (!hba->regview) |
| 818 | goto ioreg_map_err; | 818 | goto ioreg_map_err; |
| 819 | } else if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) { | 819 | } else if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) { |
| 820 | hba->regview = ioremap_nocache(hba->netdev->base_addr, 4096); | 820 | hba->regview = pci_iomap(hba->pcidev, 0, 4096); |
| 821 | if (!hba->regview) | 821 | if (!hba->regview) |
| 822 | goto ioreg_map_err; | 822 | goto ioreg_map_err; |
| 823 | } | 823 | } |
| @@ -884,7 +884,7 @@ cid_que_err: | |||
| 884 | bnx2i_free_mp_bdt(hba); | 884 | bnx2i_free_mp_bdt(hba); |
| 885 | mp_bdt_mem_err: | 885 | mp_bdt_mem_err: |
| 886 | if (hba->regview) { | 886 | if (hba->regview) { |
| 887 | iounmap(hba->regview); | 887 | pci_iounmap(hba->pcidev, hba->regview); |
| 888 | hba->regview = NULL; | 888 | hba->regview = NULL; |
| 889 | } | 889 | } |
| 890 | ioreg_map_err: | 890 | ioreg_map_err: |
| @@ -910,7 +910,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) | |||
| 910 | pci_dev_put(hba->pcidev); | 910 | pci_dev_put(hba->pcidev); |
| 911 | 911 | ||
| 912 | if (hba->regview) { | 912 | if (hba->regview) { |
| 913 | iounmap(hba->regview); | 913 | pci_iounmap(hba->pcidev, hba->regview); |
| 914 | hba->regview = NULL; | 914 | hba->regview = NULL; |
| 915 | } | 915 | } |
| 916 | bnx2i_free_mp_bdt(hba); | 916 | bnx2i_free_mp_bdt(hba); |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 441d88ad99a7..d109cc3a17b6 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
| @@ -139,12 +139,12 @@ static void sas_ata_task_done(struct sas_task *task) | |||
| 139 | if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD || | 139 | if (stat->stat == SAS_PROTO_RESPONSE || stat->stat == SAM_STAT_GOOD || |
| 140 | ((stat->stat == SAM_STAT_CHECK_CONDITION && | 140 | ((stat->stat == SAM_STAT_CHECK_CONDITION && |
| 141 | dev->sata_dev.command_set == ATAPI_COMMAND_SET))) { | 141 | dev->sata_dev.command_set == ATAPI_COMMAND_SET))) { |
| 142 | ata_tf_from_fis(resp->ending_fis, &dev->sata_dev.tf); | 142 | memcpy(dev->sata_dev.fis, resp->ending_fis, ATA_RESP_FIS_SIZE); |
| 143 | 143 | ||
| 144 | if (!link->sactive) { | 144 | if (!link->sactive) { |
| 145 | qc->err_mask |= ac_err_mask(dev->sata_dev.tf.command); | 145 | qc->err_mask |= ac_err_mask(dev->sata_dev.fis[2]); |
| 146 | } else { | 146 | } else { |
| 147 | link->eh_info.err_mask |= ac_err_mask(dev->sata_dev.tf.command); | 147 | link->eh_info.err_mask |= ac_err_mask(dev->sata_dev.fis[2]); |
| 148 | if (unlikely(link->eh_info.err_mask)) | 148 | if (unlikely(link->eh_info.err_mask)) |
| 149 | qc->flags |= ATA_QCFLAG_FAILED; | 149 | qc->flags |= ATA_QCFLAG_FAILED; |
| 150 | } | 150 | } |
| @@ -161,8 +161,8 @@ static void sas_ata_task_done(struct sas_task *task) | |||
| 161 | qc->flags |= ATA_QCFLAG_FAILED; | 161 | qc->flags |= ATA_QCFLAG_FAILED; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | dev->sata_dev.tf.feature = 0x04; /* status err */ | 164 | dev->sata_dev.fis[3] = 0x04; /* status err */ |
| 165 | dev->sata_dev.tf.command = ATA_ERR; | 165 | dev->sata_dev.fis[2] = ATA_ERR; |
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 168 | 168 | ||
| @@ -269,7 +269,7 @@ static bool sas_ata_qc_fill_rtf(struct ata_queued_cmd *qc) | |||
| 269 | { | 269 | { |
| 270 | struct domain_device *dev = qc->ap->private_data; | 270 | struct domain_device *dev = qc->ap->private_data; |
| 271 | 271 | ||
| 272 | memcpy(&qc->result_tf, &dev->sata_dev.tf, sizeof(qc->result_tf)); | 272 | ata_tf_from_fis(dev->sata_dev.fis, &qc->result_tf); |
| 273 | return true; | 273 | return true; |
| 274 | } | 274 | } |
| 275 | 275 | ||
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 6102ef2cb2d8..9d46fcbe7755 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
| @@ -1792,7 +1792,7 @@ static inline void _base_writeq(__u64 b, volatile void __iomem *addr, | |||
| 1792 | static inline u8 | 1792 | static inline u8 |
| 1793 | _base_get_msix_index(struct MPT2SAS_ADAPTER *ioc) | 1793 | _base_get_msix_index(struct MPT2SAS_ADAPTER *ioc) |
| 1794 | { | 1794 | { |
| 1795 | return ioc->cpu_msix_table[smp_processor_id()]; | 1795 | return ioc->cpu_msix_table[raw_smp_processor_id()]; |
| 1796 | } | 1796 | } |
| 1797 | 1797 | ||
| 1798 | /** | 1798 | /** |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 04f80ebf09eb..77759c78cc21 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
| 28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
| 29 | #include <linux/version.h> | ||
| 30 | #include <linux/blkdev.h> | 29 | #include <linux/blkdev.h> |
| 31 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
| 32 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| @@ -2477,11 +2476,9 @@ static void qlt_do_ctio_completion(struct scsi_qla_host *vha, uint32_t handle, | |||
| 2477 | } | 2476 | } |
| 2478 | 2477 | ||
| 2479 | cmd = qlt_ctio_to_cmd(vha, handle, ctio); | 2478 | cmd = qlt_ctio_to_cmd(vha, handle, ctio); |
| 2480 | if (cmd == NULL) { | 2479 | if (cmd == NULL) |
| 2481 | if (status != CTIO_SUCCESS) | ||
| 2482 | qlt_term_ctio_exchange(vha, ctio, NULL, status); | ||
| 2483 | return; | 2480 | return; |
| 2484 | } | 2481 | |
| 2485 | se_cmd = &cmd->se_cmd; | 2482 | se_cmd = &cmd->se_cmd; |
| 2486 | tfo = se_cmd->se_tfo; | 2483 | tfo = se_cmd->se_tfo; |
| 2487 | 2484 | ||
| @@ -2727,10 +2724,12 @@ static void qlt_do_work(struct work_struct *work) | |||
| 2727 | out_term: | 2724 | out_term: |
| 2728 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf020, "Terminating work cmd %p", cmd); | 2725 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf020, "Terminating work cmd %p", cmd); |
| 2729 | /* | 2726 | /* |
| 2730 | * cmd has not sent to target yet, so pass NULL as the second argument | 2727 | * cmd has not sent to target yet, so pass NULL as the second |
| 2728 | * argument to qlt_send_term_exchange() and free the memory here. | ||
| 2731 | */ | 2729 | */ |
| 2732 | spin_lock_irqsave(&ha->hardware_lock, flags); | 2730 | spin_lock_irqsave(&ha->hardware_lock, flags); |
| 2733 | qlt_send_term_exchange(vha, NULL, &cmd->atio, 1); | 2731 | qlt_send_term_exchange(vha, NULL, &cmd->atio, 1); |
| 2732 | kmem_cache_free(qla_tgt_cmd_cachep, cmd); | ||
| 2734 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 2733 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 2735 | if (sess) | 2734 | if (sess) |
| 2736 | ha->tgt.tgt_ops->put_sess(sess); | 2735 | ha->tgt.tgt_ops->put_sess(sess); |
| @@ -3961,7 +3960,7 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha, | |||
| 3961 | { | 3960 | { |
| 3962 | struct qla_hw_data *ha = vha->hw; | 3961 | struct qla_hw_data *ha = vha->hw; |
| 3963 | struct qla_tgt *tgt = ha->tgt.qla_tgt; | 3962 | struct qla_tgt *tgt = ha->tgt.qla_tgt; |
| 3964 | int reason_code; | 3963 | int login_code; |
| 3965 | 3964 | ||
| 3966 | ql_dbg(ql_dbg_tgt, vha, 0xe039, | 3965 | ql_dbg(ql_dbg_tgt, vha, 0xe039, |
| 3967 | "scsi(%ld): ha state %d init_done %d oper_mode %d topo %d\n", | 3966 | "scsi(%ld): ha state %d init_done %d oper_mode %d topo %d\n", |
| @@ -4004,9 +4003,9 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha, | |||
| 4004 | { | 4003 | { |
| 4005 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03b, | 4004 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03b, |
| 4006 | "qla_target(%d): Async LOOP_UP occured " | 4005 | "qla_target(%d): Async LOOP_UP occured " |
| 4007 | "(m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, | 4006 | "(m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx, |
| 4008 | le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), | 4007 | le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]), |
| 4009 | le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); | 4008 | le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3])); |
| 4010 | if (tgt->link_reinit_iocb_pending) { | 4009 | if (tgt->link_reinit_iocb_pending) { |
| 4011 | qlt_send_notify_ack(vha, (void *)&tgt->link_reinit_iocb, | 4010 | qlt_send_notify_ack(vha, (void *)&tgt->link_reinit_iocb, |
| 4012 | 0, 0, 0, 0, 0, 0); | 4011 | 0, 0, 0, 0, 0, 0); |
| @@ -4021,23 +4020,24 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha, | |||
| 4021 | case MBA_RSCN_UPDATE: | 4020 | case MBA_RSCN_UPDATE: |
| 4022 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03c, | 4021 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03c, |
| 4023 | "qla_target(%d): Async event %#x occured " | 4022 | "qla_target(%d): Async event %#x occured " |
| 4024 | "(m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, code, | 4023 | "(m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx, code, |
| 4025 | le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), | 4024 | le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]), |
| 4026 | le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); | 4025 | le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3])); |
| 4027 | break; | 4026 | break; |
| 4028 | 4027 | ||
| 4029 | case MBA_PORT_UPDATE: | 4028 | case MBA_PORT_UPDATE: |
| 4030 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03d, | 4029 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03d, |
| 4031 | "qla_target(%d): Port update async event %#x " | 4030 | "qla_target(%d): Port update async event %#x " |
| 4032 | "occured: updating the ports database (m[1]=%x, m[2]=%x, " | 4031 | "occured: updating the ports database (m[0]=%x, m[1]=%x, " |
| 4033 | "m[3]=%x, m[4]=%x)", vha->vp_idx, code, | 4032 | "m[2]=%x, m[3]=%x)", vha->vp_idx, code, |
| 4034 | le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), | 4033 | le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]), |
| 4035 | le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); | 4034 | le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3])); |
| 4036 | reason_code = le16_to_cpu(mailbox[2]); | 4035 | |
| 4037 | if (reason_code == 0x4) | 4036 | login_code = le16_to_cpu(mailbox[2]); |
| 4037 | if (login_code == 0x4) | ||
| 4038 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03e, | 4038 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03e, |
| 4039 | "Async MB 2: Got PLOGI Complete\n"); | 4039 | "Async MB 2: Got PLOGI Complete\n"); |
| 4040 | else if (reason_code == 0x7) | 4040 | else if (login_code == 0x7) |
| 4041 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03f, | 4041 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf03f, |
| 4042 | "Async MB 2: Port Logged Out\n"); | 4042 | "Async MB 2: Port Logged Out\n"); |
| 4043 | break; | 4043 | break; |
| @@ -4045,9 +4045,9 @@ void qlt_async_event(uint16_t code, struct scsi_qla_host *vha, | |||
| 4045 | default: | 4045 | default: |
| 4046 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf040, | 4046 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf040, |
| 4047 | "qla_target(%d): Async event %#x occured: " | 4047 | "qla_target(%d): Async event %#x occured: " |
| 4048 | "ignore (m[1]=%x, m[2]=%x, m[3]=%x, m[4]=%x)", vha->vp_idx, | 4048 | "ignore (m[0]=%x, m[1]=%x, m[2]=%x, m[3]=%x)", vha->vp_idx, |
| 4049 | code, le16_to_cpu(mailbox[1]), le16_to_cpu(mailbox[2]), | 4049 | code, le16_to_cpu(mailbox[0]), le16_to_cpu(mailbox[1]), |
| 4050 | le16_to_cpu(mailbox[3]), le16_to_cpu(mailbox[4])); | 4050 | le16_to_cpu(mailbox[2]), le16_to_cpu(mailbox[3])); |
| 4051 | break; | 4051 | break; |
| 4052 | } | 4052 | } |
| 4053 | 4053 | ||
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 9ec19bc2f0fe..9f9ef1644fd9 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
| @@ -919,7 +919,6 @@ struct qla_tgt_srr_ctio { | |||
| 919 | #define QLA_TGT_XMIT_STATUS 2 | 919 | #define QLA_TGT_XMIT_STATUS 2 |
| 920 | #define QLA_TGT_XMIT_ALL (QLA_TGT_XMIT_STATUS|QLA_TGT_XMIT_DATA) | 920 | #define QLA_TGT_XMIT_ALL (QLA_TGT_XMIT_STATUS|QLA_TGT_XMIT_DATA) |
| 921 | 921 | ||
| 922 | #include <linux/version.h> | ||
| 923 | 922 | ||
| 924 | extern struct qla_tgt_data qla_target; | 923 | extern struct qla_tgt_data qla_target; |
| 925 | /* | 924 | /* |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 436598f57404..6e64314dbbb3 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
| @@ -137,13 +137,15 @@ static char *tcm_qla2xxx_get_fabric_name(void) | |||
| 137 | */ | 137 | */ |
| 138 | static int tcm_qla2xxx_npiv_extract_wwn(const char *ns, u64 *nm) | 138 | static int tcm_qla2xxx_npiv_extract_wwn(const char *ns, u64 *nm) |
| 139 | { | 139 | { |
| 140 | unsigned int i, j, value; | 140 | unsigned int i, j; |
| 141 | u8 wwn[8]; | 141 | u8 wwn[8]; |
| 142 | 142 | ||
| 143 | memset(wwn, 0, sizeof(wwn)); | 143 | memset(wwn, 0, sizeof(wwn)); |
| 144 | 144 | ||
| 145 | /* Validate and store the new name */ | 145 | /* Validate and store the new name */ |
| 146 | for (i = 0, j = 0; i < 16; i++) { | 146 | for (i = 0, j = 0; i < 16; i++) { |
| 147 | int value; | ||
| 148 | |||
| 147 | value = hex_to_bin(*ns++); | 149 | value = hex_to_bin(*ns++); |
| 148 | if (value >= 0) | 150 | if (value >= 0) |
| 149 | j = (j << 4) | value; | 151 | j = (j << 4) | value; |
| @@ -652,8 +654,8 @@ static int tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd) | |||
| 652 | /* | 654 | /* |
| 653 | * Called from qla_target.c:qlt_issue_task_mgmt() | 655 | * Called from qla_target.c:qlt_issue_task_mgmt() |
| 654 | */ | 656 | */ |
| 655 | int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun, | 657 | static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun, |
| 656 | uint8_t tmr_func, uint32_t tag) | 658 | uint8_t tmr_func, uint32_t tag) |
| 657 | { | 659 | { |
| 658 | struct qla_tgt_sess *sess = mcmd->sess; | 660 | struct qla_tgt_sess *sess = mcmd->sess; |
| 659 | struct se_cmd *se_cmd = &mcmd->se_cmd; | 661 | struct se_cmd *se_cmd = &mcmd->se_cmd; |
| @@ -762,65 +764,8 @@ static u16 tcm_qla2xxx_set_fabric_sense_len(struct se_cmd *se_cmd, | |||
| 762 | struct target_fabric_configfs *tcm_qla2xxx_fabric_configfs; | 764 | struct target_fabric_configfs *tcm_qla2xxx_fabric_configfs; |
| 763 | struct target_fabric_configfs *tcm_qla2xxx_npiv_fabric_configfs; | 765 | struct target_fabric_configfs *tcm_qla2xxx_npiv_fabric_configfs; |
| 764 | 766 | ||
| 765 | static int tcm_qla2xxx_setup_nacl_from_rport( | 767 | static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *, |
| 766 | struct se_portal_group *se_tpg, | 768 | struct tcm_qla2xxx_nacl *, struct qla_tgt_sess *); |
| 767 | struct se_node_acl *se_nacl, | ||
| 768 | struct tcm_qla2xxx_lport *lport, | ||
| 769 | struct tcm_qla2xxx_nacl *nacl, | ||
| 770 | u64 rport_wwnn) | ||
| 771 | { | ||
| 772 | struct scsi_qla_host *vha = lport->qla_vha; | ||
| 773 | struct Scsi_Host *sh = vha->host; | ||
| 774 | struct fc_host_attrs *fc_host = shost_to_fc_host(sh); | ||
| 775 | struct fc_rport *rport; | ||
| 776 | unsigned long flags; | ||
| 777 | void *node; | ||
| 778 | int rc; | ||
| 779 | |||
| 780 | /* | ||
| 781 | * Scan the existing rports, and create a session for the | ||
| 782 | * explict NodeACL is an matching rport->node_name already | ||
| 783 | * exists. | ||
| 784 | */ | ||
| 785 | spin_lock_irqsave(sh->host_lock, flags); | ||
| 786 | list_for_each_entry(rport, &fc_host->rports, peers) { | ||
| 787 | if (rport_wwnn != rport->node_name) | ||
| 788 | continue; | ||
| 789 | |||
| 790 | pr_debug("Located existing rport_wwpn and rport->node_name: 0x%016LX, port_id: 0x%04x\n", | ||
| 791 | rport->node_name, rport->port_id); | ||
| 792 | nacl->nport_id = rport->port_id; | ||
| 793 | |||
| 794 | spin_unlock_irqrestore(sh->host_lock, flags); | ||
| 795 | |||
| 796 | spin_lock_irqsave(&vha->hw->hardware_lock, flags); | ||
| 797 | node = btree_lookup32(&lport->lport_fcport_map, rport->port_id); | ||
| 798 | if (node) { | ||
| 799 | rc = btree_update32(&lport->lport_fcport_map, | ||
| 800 | rport->port_id, se_nacl); | ||
| 801 | } else { | ||
| 802 | rc = btree_insert32(&lport->lport_fcport_map, | ||
| 803 | rport->port_id, se_nacl, | ||
| 804 | GFP_ATOMIC); | ||
| 805 | } | ||
| 806 | spin_unlock_irqrestore(&vha->hw->hardware_lock, flags); | ||
| 807 | |||
| 808 | if (rc) { | ||
| 809 | pr_err("Unable to insert se_nacl into fcport_map"); | ||
| 810 | WARN_ON(rc > 0); | ||
| 811 | return rc; | ||
| 812 | } | ||
| 813 | |||
| 814 | pr_debug("Inserted into fcport_map: %p for WWNN: 0x%016LX, port_id: 0x%08x\n", | ||
| 815 | se_nacl, rport_wwnn, nacl->nport_id); | ||
| 816 | |||
| 817 | return 1; | ||
| 818 | } | ||
| 819 | spin_unlock_irqrestore(sh->host_lock, flags); | ||
| 820 | |||
| 821 | return 0; | ||
| 822 | } | ||
| 823 | |||
| 824 | /* | 769 | /* |
| 825 | * Expected to be called with struct qla_hw_data->hardware_lock held | 770 | * Expected to be called with struct qla_hw_data->hardware_lock held |
| 826 | */ | 771 | */ |
| @@ -842,11 +787,40 @@ static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct qla_tgt_sess *sess) | |||
| 842 | 787 | ||
| 843 | pr_debug("Removed from fcport_map: %p for WWNN: 0x%016LX, port_id: 0x%06x\n", | 788 | pr_debug("Removed from fcport_map: %p for WWNN: 0x%016LX, port_id: 0x%06x\n", |
| 844 | se_nacl, nacl->nport_wwnn, nacl->nport_id); | 789 | se_nacl, nacl->nport_wwnn, nacl->nport_id); |
| 790 | /* | ||
| 791 | * Now clear the se_nacl and session pointers from our HW lport lookup | ||
| 792 | * table mapping for this initiator's fabric S_ID and LOOP_ID entries. | ||
| 793 | * | ||
| 794 | * This is done ahead of callbacks into tcm_qla2xxx_free_session() -> | ||
| 795 | * target_wait_for_sess_cmds() before the session waits for outstanding | ||
| 796 | * I/O to complete, to avoid a race between session shutdown execution | ||
| 797 | * and incoming ATIOs or TMRs picking up a stale se_node_act reference. | ||
| 798 | */ | ||
| 799 | tcm_qla2xxx_clear_sess_lookup(lport, nacl, sess); | ||
| 800 | } | ||
| 801 | |||
| 802 | static void tcm_qla2xxx_release_session(struct kref *kref) | ||
| 803 | { | ||
| 804 | struct se_session *se_sess = container_of(kref, | ||
| 805 | struct se_session, sess_kref); | ||
| 806 | |||
| 807 | qlt_unreg_sess(se_sess->fabric_sess_ptr); | ||
| 808 | } | ||
| 809 | |||
| 810 | static void tcm_qla2xxx_put_session(struct se_session *se_sess) | ||
| 811 | { | ||
| 812 | struct qla_tgt_sess *sess = se_sess->fabric_sess_ptr; | ||
| 813 | struct qla_hw_data *ha = sess->vha->hw; | ||
| 814 | unsigned long flags; | ||
| 815 | |||
| 816 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
| 817 | kref_put(&se_sess->sess_kref, tcm_qla2xxx_release_session); | ||
| 818 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
| 845 | } | 819 | } |
| 846 | 820 | ||
| 847 | static void tcm_qla2xxx_put_sess(struct qla_tgt_sess *sess) | 821 | static void tcm_qla2xxx_put_sess(struct qla_tgt_sess *sess) |
| 848 | { | 822 | { |
| 849 | target_put_session(sess->se_sess); | 823 | tcm_qla2xxx_put_session(sess->se_sess); |
| 850 | } | 824 | } |
| 851 | 825 | ||
| 852 | static void tcm_qla2xxx_shutdown_sess(struct qla_tgt_sess *sess) | 826 | static void tcm_qla2xxx_shutdown_sess(struct qla_tgt_sess *sess) |
| @@ -859,14 +833,10 @@ static struct se_node_acl *tcm_qla2xxx_make_nodeacl( | |||
| 859 | struct config_group *group, | 833 | struct config_group *group, |
| 860 | const char *name) | 834 | const char *name) |
| 861 | { | 835 | { |
| 862 | struct se_wwn *se_wwn = se_tpg->se_tpg_wwn; | ||
| 863 | struct tcm_qla2xxx_lport *lport = container_of(se_wwn, | ||
| 864 | struct tcm_qla2xxx_lport, lport_wwn); | ||
| 865 | struct se_node_acl *se_nacl, *se_nacl_new; | 836 | struct se_node_acl *se_nacl, *se_nacl_new; |
| 866 | struct tcm_qla2xxx_nacl *nacl; | 837 | struct tcm_qla2xxx_nacl *nacl; |
| 867 | u64 wwnn; | 838 | u64 wwnn; |
| 868 | u32 qla2xxx_nexus_depth; | 839 | u32 qla2xxx_nexus_depth; |
| 869 | int rc; | ||
| 870 | 840 | ||
| 871 | if (tcm_qla2xxx_parse_wwn(name, &wwnn, 1) < 0) | 841 | if (tcm_qla2xxx_parse_wwn(name, &wwnn, 1) < 0) |
| 872 | return ERR_PTR(-EINVAL); | 842 | return ERR_PTR(-EINVAL); |
| @@ -893,16 +863,6 @@ static struct se_node_acl *tcm_qla2xxx_make_nodeacl( | |||
| 893 | nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl); | 863 | nacl = container_of(se_nacl, struct tcm_qla2xxx_nacl, se_node_acl); |
| 894 | nacl->nport_wwnn = wwnn; | 864 | nacl->nport_wwnn = wwnn; |
| 895 | tcm_qla2xxx_format_wwn(&nacl->nport_name[0], TCM_QLA2XXX_NAMELEN, wwnn); | 865 | tcm_qla2xxx_format_wwn(&nacl->nport_name[0], TCM_QLA2XXX_NAMELEN, wwnn); |
| 896 | /* | ||
| 897 | * Setup a se_nacl handle based on an a matching struct fc_rport setup | ||
| 898 | * via drivers/scsi/qla2xxx/qla_init.c:qla2x00_reg_remote_port() | ||
| 899 | */ | ||
| 900 | rc = tcm_qla2xxx_setup_nacl_from_rport(se_tpg, se_nacl, lport, | ||
| 901 | nacl, wwnn); | ||
| 902 | if (rc < 0) { | ||
| 903 | tcm_qla2xxx_release_fabric_acl(se_tpg, se_nacl_new); | ||
| 904 | return ERR_PTR(rc); | ||
| 905 | } | ||
| 906 | 866 | ||
| 907 | return se_nacl; | 867 | return se_nacl; |
| 908 | } | 868 | } |
| @@ -1390,6 +1350,25 @@ static void tcm_qla2xxx_set_sess_by_loop_id( | |||
| 1390 | nacl->qla_tgt_sess, new_se_nacl, new_se_nacl->initiatorname); | 1350 | nacl->qla_tgt_sess, new_se_nacl, new_se_nacl->initiatorname); |
| 1391 | } | 1351 | } |
| 1392 | 1352 | ||
| 1353 | /* | ||
| 1354 | * Should always be called with qla_hw_data->hardware_lock held. | ||
| 1355 | */ | ||
| 1356 | static void tcm_qla2xxx_clear_sess_lookup(struct tcm_qla2xxx_lport *lport, | ||
| 1357 | struct tcm_qla2xxx_nacl *nacl, struct qla_tgt_sess *sess) | ||
| 1358 | { | ||
| 1359 | struct se_session *se_sess = sess->se_sess; | ||
| 1360 | unsigned char be_sid[3]; | ||
| 1361 | |||
| 1362 | be_sid[0] = sess->s_id.b.domain; | ||
| 1363 | be_sid[1] = sess->s_id.b.area; | ||
| 1364 | be_sid[2] = sess->s_id.b.al_pa; | ||
| 1365 | |||
| 1366 | tcm_qla2xxx_set_sess_by_s_id(lport, NULL, nacl, se_sess, | ||
| 1367 | sess, be_sid); | ||
| 1368 | tcm_qla2xxx_set_sess_by_loop_id(lport, NULL, nacl, se_sess, | ||
| 1369 | sess, sess->loop_id); | ||
| 1370 | } | ||
| 1371 | |||
| 1393 | static void tcm_qla2xxx_free_session(struct qla_tgt_sess *sess) | 1372 | static void tcm_qla2xxx_free_session(struct qla_tgt_sess *sess) |
| 1394 | { | 1373 | { |
| 1395 | struct qla_tgt *tgt = sess->tgt; | 1374 | struct qla_tgt *tgt = sess->tgt; |
| @@ -1398,8 +1377,6 @@ static void tcm_qla2xxx_free_session(struct qla_tgt_sess *sess) | |||
| 1398 | struct se_node_acl *se_nacl; | 1377 | struct se_node_acl *se_nacl; |
| 1399 | struct tcm_qla2xxx_lport *lport; | 1378 | struct tcm_qla2xxx_lport *lport; |
| 1400 | struct tcm_qla2xxx_nacl *nacl; | 1379 | struct tcm_qla2xxx_nacl *nacl; |
| 1401 | unsigned char be_sid[3]; | ||
| 1402 | unsigned long flags; | ||
| 1403 | 1380 | ||
| 1404 | BUG_ON(in_interrupt()); | 1381 | BUG_ON(in_interrupt()); |
| 1405 | 1382 | ||
| @@ -1419,21 +1396,6 @@ static void tcm_qla2xxx_free_session(struct qla_tgt_sess *sess) | |||
| 1419 | return; | 1396 | return; |
| 1420 | } | 1397 | } |
| 1421 | target_wait_for_sess_cmds(se_sess, 0); | 1398 | target_wait_for_sess_cmds(se_sess, 0); |
| 1422 | /* | ||
| 1423 | * And now clear the se_nacl and session pointers from our HW lport | ||
| 1424 | * mappings for fabric S_ID and LOOP_ID. | ||
| 1425 | */ | ||
| 1426 | memset(&be_sid, 0, 3); | ||
| 1427 | be_sid[0] = sess->s_id.b.domain; | ||
| 1428 | be_sid[1] = sess->s_id.b.area; | ||
| 1429 | be_sid[2] = sess->s_id.b.al_pa; | ||
| 1430 | |||
| 1431 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
| 1432 | tcm_qla2xxx_set_sess_by_s_id(lport, NULL, nacl, se_sess, | ||
| 1433 | sess, be_sid); | ||
| 1434 | tcm_qla2xxx_set_sess_by_loop_id(lport, NULL, nacl, se_sess, | ||
| 1435 | sess, sess->loop_id); | ||
| 1436 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
| 1437 | 1399 | ||
| 1438 | transport_deregister_session_configfs(sess->se_sess); | 1400 | transport_deregister_session_configfs(sess->se_sess); |
| 1439 | transport_deregister_session(sess->se_sess); | 1401 | transport_deregister_session(sess->se_sess); |
| @@ -1731,6 +1693,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_ops = { | |||
| 1731 | .new_cmd_map = NULL, | 1693 | .new_cmd_map = NULL, |
| 1732 | .check_stop_free = tcm_qla2xxx_check_stop_free, | 1694 | .check_stop_free = tcm_qla2xxx_check_stop_free, |
| 1733 | .release_cmd = tcm_qla2xxx_release_cmd, | 1695 | .release_cmd = tcm_qla2xxx_release_cmd, |
| 1696 | .put_session = tcm_qla2xxx_put_session, | ||
| 1734 | .shutdown_session = tcm_qla2xxx_shutdown_session, | 1697 | .shutdown_session = tcm_qla2xxx_shutdown_session, |
| 1735 | .close_session = tcm_qla2xxx_close_session, | 1698 | .close_session = tcm_qla2xxx_close_session, |
| 1736 | .sess_get_index = tcm_qla2xxx_sess_get_index, | 1699 | .sess_get_index = tcm_qla2xxx_sess_get_index, |
| @@ -1779,6 +1742,7 @@ static struct target_core_fabric_ops tcm_qla2xxx_npiv_ops = { | |||
| 1779 | .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl, | 1742 | .tpg_release_fabric_acl = tcm_qla2xxx_release_fabric_acl, |
| 1780 | .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index, | 1743 | .tpg_get_inst_index = tcm_qla2xxx_tpg_get_inst_index, |
| 1781 | .release_cmd = tcm_qla2xxx_release_cmd, | 1744 | .release_cmd = tcm_qla2xxx_release_cmd, |
| 1745 | .put_session = tcm_qla2xxx_put_session, | ||
| 1782 | .shutdown_session = tcm_qla2xxx_shutdown_session, | 1746 | .shutdown_session = tcm_qla2xxx_shutdown_session, |
| 1783 | .close_session = tcm_qla2xxx_close_session, | 1747 | .close_session = tcm_qla2xxx_close_session, |
| 1784 | .sess_get_index = tcm_qla2xxx_sess_get_index, | 1748 | .sess_get_index = tcm_qla2xxx_sess_get_index, |
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 61c82a345f82..bbbc9c918d4c 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
| @@ -90,11 +90,9 @@ unsigned int scsi_logging_level; | |||
| 90 | EXPORT_SYMBOL(scsi_logging_level); | 90 | EXPORT_SYMBOL(scsi_logging_level); |
| 91 | #endif | 91 | #endif |
| 92 | 92 | ||
| 93 | #if IS_ENABLED(CONFIG_PM) || IS_ENABLED(CONFIG_BLK_DEV_SD) | 93 | /* sd, scsi core and power management need to coordinate flushing async actions */ |
| 94 | /* sd and scsi_pm need to coordinate flushing async actions */ | ||
| 95 | LIST_HEAD(scsi_sd_probe_domain); | 94 | LIST_HEAD(scsi_sd_probe_domain); |
| 96 | EXPORT_SYMBOL(scsi_sd_probe_domain); | 95 | EXPORT_SYMBOL(scsi_sd_probe_domain); |
| 97 | #endif | ||
| 98 | 96 | ||
| 99 | /* NB: These are exposed through /proc/scsi/scsi and form part of the ABI. | 97 | /* NB: These are exposed through /proc/scsi/scsi and form part of the ABI. |
| 100 | * You may not alter any existing entry (although adding new ones is | 98 | * You may not alter any existing entry (although adding new ones is |
diff --git a/drivers/scsi/scsi_wait_scan.c b/drivers/scsi/scsi_wait_scan.c index ae7814874618..072734538876 100644 --- a/drivers/scsi/scsi_wait_scan.c +++ b/drivers/scsi/scsi_wait_scan.c | |||
| @@ -22,11 +22,6 @@ static int __init wait_scan_init(void) | |||
| 22 | * and might not yet have reached the scsi async scanning | 22 | * and might not yet have reached the scsi async scanning |
| 23 | */ | 23 | */ |
| 24 | wait_for_device_probe(); | 24 | wait_for_device_probe(); |
| 25 | /* | ||
| 26 | * and then we wait for the actual asynchronous scsi scan | ||
| 27 | * to finish. | ||
| 28 | */ | ||
| 29 | scsi_complete_async_scans(); | ||
| 30 | return 0; | 25 | return 0; |
| 31 | } | 26 | } |
| 32 | 27 | ||
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 6f0a4c612b3b..6f72b80121a0 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
| @@ -1899,6 +1899,8 @@ static int sd_try_rc16_first(struct scsi_device *sdp) | |||
| 1899 | { | 1899 | { |
| 1900 | if (sdp->host->max_cmd_len < 16) | 1900 | if (sdp->host->max_cmd_len < 16) |
| 1901 | return 0; | 1901 | return 0; |
| 1902 | if (sdp->try_rc_10_first) | ||
| 1903 | return 0; | ||
| 1902 | if (sdp->scsi_level > SCSI_SPC_2) | 1904 | if (sdp->scsi_level > SCSI_SPC_2) |
| 1903 | return 1; | 1905 | return 1; |
| 1904 | if (scsi_device_protection(sdp)) | 1906 | if (scsi_device_protection(sdp)) |
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 46ef5fe51db5..0c73dd4f43a0 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c | |||
| @@ -801,7 +801,7 @@ static int omap2_mcspi_setup(struct spi_device *spi) | |||
| 801 | mcspi_dma = &mcspi->dma_channels[spi->chip_select]; | 801 | mcspi_dma = &mcspi->dma_channels[spi->chip_select]; |
| 802 | 802 | ||
| 803 | if (!cs) { | 803 | if (!cs) { |
| 804 | cs = devm_kzalloc(&spi->dev , sizeof *cs, GFP_KERNEL); | 804 | cs = kzalloc(sizeof *cs, GFP_KERNEL); |
| 805 | if (!cs) | 805 | if (!cs) |
| 806 | return -ENOMEM; | 806 | return -ENOMEM; |
| 807 | cs->base = mcspi->base + spi->chip_select * 0x14; | 807 | cs->base = mcspi->base + spi->chip_select * 0x14; |
| @@ -842,6 +842,7 @@ static void omap2_mcspi_cleanup(struct spi_device *spi) | |||
| 842 | cs = spi->controller_state; | 842 | cs = spi->controller_state; |
| 843 | list_del(&cs->node); | 843 | list_del(&cs->node); |
| 844 | 844 | ||
| 845 | kfree(cs); | ||
| 845 | } | 846 | } |
| 846 | 847 | ||
| 847 | if (spi->chip_select < spi->master->num_chipselect) { | 848 | if (spi->chip_select < spi->master->num_chipselect) { |
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 1c3d6386ea36..aeac1caba3f9 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
| 31 | #include <linux/usb.h> | 31 | #include <linux/usb.h> |
| 32 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
| 33 | #include <linux/kconfig.h> | ||
| 33 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
| 34 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
| 35 | #include <linux/fcntl.h> | 36 | #include <linux/fcntl.h> |
| @@ -981,6 +982,8 @@ void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver, | |||
| 981 | } | 982 | } |
| 982 | EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister); | 983 | EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister); |
| 983 | 984 | ||
| 985 | #if IS_ENABLED(CONFIG_USB) | ||
| 986 | |||
| 984 | static int comedi_old_usb_auto_config(struct usb_interface *intf, | 987 | static int comedi_old_usb_auto_config(struct usb_interface *intf, |
| 985 | struct comedi_driver *driver) | 988 | struct comedi_driver *driver) |
| 986 | { | 989 | { |
| @@ -1043,3 +1046,5 @@ void comedi_usb_driver_unregister(struct comedi_driver *comedi_driver, | |||
| 1043 | comedi_driver_unregister(comedi_driver); | 1046 | comedi_driver_unregister(comedi_driver); |
| 1044 | } | 1047 | } |
| 1045 | EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister); | 1048 | EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister); |
| 1049 | |||
| 1050 | #endif | ||
diff --git a/drivers/staging/gdm72xx/netlink_k.c b/drivers/staging/gdm72xx/netlink_k.c index 292af0f7f451..51665132c61b 100644 --- a/drivers/staging/gdm72xx/netlink_k.c +++ b/drivers/staging/gdm72xx/netlink_k.c | |||
| @@ -104,7 +104,7 @@ struct sock *netlink_init(int unit, void (*cb)(struct net_device *dev, u16 type, | |||
| 104 | 104 | ||
| 105 | void netlink_exit(struct sock *sock) | 105 | void netlink_exit(struct sock *sock) |
| 106 | { | 106 | { |
| 107 | sock_release(sock->sk_socket); | 107 | netlink_kernel_release(sock); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) | 110 | int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) |
diff --git a/drivers/staging/iio/Documentation/device.txt b/drivers/staging/iio/Documentation/device.txt index 0338c7cd0a8b..f03fbd3bb454 100644 --- a/drivers/staging/iio/Documentation/device.txt +++ b/drivers/staging/iio/Documentation/device.txt | |||
| @@ -29,8 +29,6 @@ Then fill in the following: | |||
| 29 | * info->driver_module: | 29 | * info->driver_module: |
| 30 | Set to THIS_MODULE. Used to ensure correct ownership | 30 | Set to THIS_MODULE. Used to ensure correct ownership |
| 31 | of various resources allocate by the core. | 31 | of various resources allocate by the core. |
| 32 | * info->num_interrupt_lines: | ||
| 33 | Number of event triggering hardware lines the device has. | ||
| 34 | * info->event_attrs: | 32 | * info->event_attrs: |
| 35 | Attributes used to enable / disable hardware events. | 33 | Attributes used to enable / disable hardware events. |
| 36 | * info->attrs: | 34 | * info->attrs: |
diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index 2490dd25093b..8f1b3af02f29 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig | |||
| @@ -13,6 +13,7 @@ config AD7291 | |||
| 13 | config AD7298 | 13 | config AD7298 |
| 14 | tristate "Analog Devices AD7298 ADC driver" | 14 | tristate "Analog Devices AD7298 ADC driver" |
| 15 | depends on SPI | 15 | depends on SPI |
| 16 | select IIO_KFIFO_BUF if IIO_BUFFER | ||
| 16 | help | 17 | help |
| 17 | Say yes here to build support for Analog Devices AD7298 | 18 | Say yes here to build support for Analog Devices AD7298 |
| 18 | 8 Channel ADC with temperature sensor. | 19 | 8 Channel ADC with temperature sensor. |
diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c index 10ab6dc823b9..a13afff2dfe6 100644 --- a/drivers/staging/iio/adc/ad7606_core.c +++ b/drivers/staging/iio/adc/ad7606_core.c | |||
| @@ -235,7 +235,8 @@ static const struct attribute_group ad7606_attribute_group_range = { | |||
| 235 | .indexed = 1, \ | 235 | .indexed = 1, \ |
| 236 | .channel = num, \ | 236 | .channel = num, \ |
| 237 | .address = num, \ | 237 | .address = num, \ |
| 238 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, \ | 238 | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ |
| 239 | IIO_CHAN_INFO_SCALE_SHARED_BIT, \ | ||
| 239 | .scan_index = num, \ | 240 | .scan_index = num, \ |
| 240 | .scan_type = IIO_ST('s', 16, 16, 0), \ | 241 | .scan_type = IIO_ST('s', 16, 16, 0), \ |
| 241 | } | 242 | } |
diff --git a/drivers/staging/media/lirc/lirc_serial.c b/drivers/staging/media/lirc/lirc_serial.c index 3295ea63f3eb..97ef67036e3f 100644 --- a/drivers/staging/media/lirc/lirc_serial.c +++ b/drivers/staging/media/lirc/lirc_serial.c | |||
| @@ -129,6 +129,7 @@ static void send_space_homebrew(long length); | |||
| 129 | 129 | ||
| 130 | static struct lirc_serial hardware[] = { | 130 | static struct lirc_serial hardware[] = { |
| 131 | [LIRC_HOMEBREW] = { | 131 | [LIRC_HOMEBREW] = { |
| 132 | .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_HOMEBREW].lock), | ||
| 132 | .signal_pin = UART_MSR_DCD, | 133 | .signal_pin = UART_MSR_DCD, |
| 133 | .signal_pin_change = UART_MSR_DDCD, | 134 | .signal_pin_change = UART_MSR_DDCD, |
| 134 | .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), | 135 | .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), |
| @@ -145,6 +146,7 @@ static struct lirc_serial hardware[] = { | |||
| 145 | }, | 146 | }, |
| 146 | 147 | ||
| 147 | [LIRC_IRDEO] = { | 148 | [LIRC_IRDEO] = { |
| 149 | .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_IRDEO].lock), | ||
| 148 | .signal_pin = UART_MSR_DSR, | 150 | .signal_pin = UART_MSR_DSR, |
| 149 | .signal_pin_change = UART_MSR_DDSR, | 151 | .signal_pin_change = UART_MSR_DDSR, |
| 150 | .on = UART_MCR_OUT2, | 152 | .on = UART_MCR_OUT2, |
| @@ -156,6 +158,7 @@ static struct lirc_serial hardware[] = { | |||
| 156 | }, | 158 | }, |
| 157 | 159 | ||
| 158 | [LIRC_IRDEO_REMOTE] = { | 160 | [LIRC_IRDEO_REMOTE] = { |
| 161 | .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_IRDEO_REMOTE].lock), | ||
| 159 | .signal_pin = UART_MSR_DSR, | 162 | .signal_pin = UART_MSR_DSR, |
| 160 | .signal_pin_change = UART_MSR_DDSR, | 163 | .signal_pin_change = UART_MSR_DDSR, |
| 161 | .on = (UART_MCR_RTS | UART_MCR_DTR | UART_MCR_OUT2), | 164 | .on = (UART_MCR_RTS | UART_MCR_DTR | UART_MCR_OUT2), |
| @@ -167,6 +170,7 @@ static struct lirc_serial hardware[] = { | |||
| 167 | }, | 170 | }, |
| 168 | 171 | ||
| 169 | [LIRC_ANIMAX] = { | 172 | [LIRC_ANIMAX] = { |
| 173 | .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_ANIMAX].lock), | ||
| 170 | .signal_pin = UART_MSR_DCD, | 174 | .signal_pin = UART_MSR_DCD, |
| 171 | .signal_pin_change = UART_MSR_DDCD, | 175 | .signal_pin_change = UART_MSR_DDCD, |
| 172 | .on = 0, | 176 | .on = 0, |
| @@ -177,6 +181,7 @@ static struct lirc_serial hardware[] = { | |||
| 177 | }, | 181 | }, |
| 178 | 182 | ||
| 179 | [LIRC_IGOR] = { | 183 | [LIRC_IGOR] = { |
| 184 | .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_IGOR].lock), | ||
| 180 | .signal_pin = UART_MSR_DSR, | 185 | .signal_pin = UART_MSR_DSR, |
| 181 | .signal_pin_change = UART_MSR_DDSR, | 186 | .signal_pin_change = UART_MSR_DDSR, |
| 182 | .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), | 187 | .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), |
| @@ -201,6 +206,7 @@ static struct lirc_serial hardware[] = { | |||
| 201 | * See also http://www.nslu2-linux.org for this device | 206 | * See also http://www.nslu2-linux.org for this device |
| 202 | */ | 207 | */ |
| 203 | [LIRC_NSLU2] = { | 208 | [LIRC_NSLU2] = { |
| 209 | .lock = __SPIN_LOCK_UNLOCKED(hardware[LIRC_NSLU2].lock), | ||
| 204 | .signal_pin = UART_MSR_CTS, | 210 | .signal_pin = UART_MSR_CTS, |
| 205 | .signal_pin_change = UART_MSR_DCTS, | 211 | .signal_pin_change = UART_MSR_DCTS, |
| 206 | .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), | 212 | .on = (UART_MCR_RTS | UART_MCR_OUT2 | UART_MCR_DTR), |
diff --git a/drivers/staging/omapdrm/omap_fbdev.c b/drivers/staging/omapdrm/omap_fbdev.c index 11acd4c35ed2..8c6ed3b0c6f6 100644 --- a/drivers/staging/omapdrm/omap_fbdev.c +++ b/drivers/staging/omapdrm/omap_fbdev.c | |||
| @@ -208,7 +208,8 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, | |||
| 208 | */ | 208 | */ |
| 209 | ret = omap_gem_get_paddr(fbdev->bo, &paddr, true); | 209 | ret = omap_gem_get_paddr(fbdev->bo, &paddr, true); |
| 210 | if (ret) { | 210 | if (ret) { |
| 211 | dev_err(dev->dev, "could not map (paddr)!\n"); | 211 | dev_err(dev->dev, |
| 212 | "could not map (paddr)! Skipping framebuffer alloc\n"); | ||
| 212 | ret = -ENOMEM; | 213 | ret = -ENOMEM; |
| 213 | goto fail; | 214 | goto fail; |
| 214 | } | 215 | } |
| @@ -388,8 +389,11 @@ void omap_fbdev_free(struct drm_device *dev) | |||
| 388 | 389 | ||
| 389 | fbi = helper->fbdev; | 390 | fbi = helper->fbdev; |
| 390 | 391 | ||
| 391 | unregister_framebuffer(fbi); | 392 | /* only cleanup framebuffer if it is present */ |
| 392 | framebuffer_release(fbi); | 393 | if (fbi) { |
| 394 | unregister_framebuffer(fbi); | ||
| 395 | framebuffer_release(fbi); | ||
| 396 | } | ||
| 393 | 397 | ||
| 394 | drm_fb_helper_fini(helper); | 398 | drm_fb_helper_fini(helper); |
| 395 | 399 | ||
diff --git a/drivers/staging/ramster/zcache-main.c b/drivers/staging/ramster/zcache-main.c index 4e7ef0e6b79c..d46764b5aaba 100644 --- a/drivers/staging/ramster/zcache-main.c +++ b/drivers/staging/ramster/zcache-main.c | |||
| @@ -3002,7 +3002,7 @@ static inline struct tmem_oid oswiz(unsigned type, u32 ind) | |||
| 3002 | return oid; | 3002 | return oid; |
| 3003 | } | 3003 | } |
| 3004 | 3004 | ||
| 3005 | static int zcache_frontswap_put_page(unsigned type, pgoff_t offset, | 3005 | static int zcache_frontswap_store(unsigned type, pgoff_t offset, |
| 3006 | struct page *page) | 3006 | struct page *page) |
| 3007 | { | 3007 | { |
| 3008 | u64 ind64 = (u64)offset; | 3008 | u64 ind64 = (u64)offset; |
| @@ -3025,7 +3025,7 @@ static int zcache_frontswap_put_page(unsigned type, pgoff_t offset, | |||
| 3025 | 3025 | ||
| 3026 | /* returns 0 if the page was successfully gotten from frontswap, -1 if | 3026 | /* returns 0 if the page was successfully gotten from frontswap, -1 if |
| 3027 | * was not present (should never happen!) */ | 3027 | * was not present (should never happen!) */ |
| 3028 | static int zcache_frontswap_get_page(unsigned type, pgoff_t offset, | 3028 | static int zcache_frontswap_load(unsigned type, pgoff_t offset, |
| 3029 | struct page *page) | 3029 | struct page *page) |
| 3030 | { | 3030 | { |
| 3031 | u64 ind64 = (u64)offset; | 3031 | u64 ind64 = (u64)offset; |
| @@ -3080,8 +3080,8 @@ static void zcache_frontswap_init(unsigned ignored) | |||
| 3080 | } | 3080 | } |
| 3081 | 3081 | ||
| 3082 | static struct frontswap_ops zcache_frontswap_ops = { | 3082 | static struct frontswap_ops zcache_frontswap_ops = { |
| 3083 | .put_page = zcache_frontswap_put_page, | 3083 | .store = zcache_frontswap_store, |
| 3084 | .get_page = zcache_frontswap_get_page, | 3084 | .load = zcache_frontswap_load, |
| 3085 | .invalidate_page = zcache_frontswap_flush_page, | 3085 | .invalidate_page = zcache_frontswap_flush_page, |
| 3086 | .invalidate_area = zcache_frontswap_flush_area, | 3086 | .invalidate_area = zcache_frontswap_flush_area, |
| 3087 | .init = zcache_frontswap_init | 3087 | .init = zcache_frontswap_init |
diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c index 9bd18e2d0513..69f616c6964e 100644 --- a/drivers/staging/rtl8712/usb_intf.c +++ b/drivers/staging/rtl8712/usb_intf.c | |||
| @@ -102,6 +102,8 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { | |||
| 102 | /* - */ | 102 | /* - */ |
| 103 | {USB_DEVICE(0x20F4, 0x646B)}, | 103 | {USB_DEVICE(0x20F4, 0x646B)}, |
| 104 | {USB_DEVICE(0x083A, 0xC512)}, | 104 | {USB_DEVICE(0x083A, 0xC512)}, |
| 105 | {USB_DEVICE(0x25D4, 0x4CA1)}, | ||
| 106 | {USB_DEVICE(0x25D4, 0x4CAB)}, | ||
| 105 | 107 | ||
| 106 | /* RTL8191SU */ | 108 | /* RTL8191SU */ |
| 107 | /* Realtek */ | 109 | /* Realtek */ |
diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 2734dacacbaf..784c796b9848 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c | |||
| @@ -1835,7 +1835,7 @@ static int zcache_frontswap_poolid = -1; | |||
| 1835 | * Swizzling increases objects per swaptype, increasing tmem concurrency | 1835 | * Swizzling increases objects per swaptype, increasing tmem concurrency |
| 1836 | * for heavy swaploads. Later, larger nr_cpus -> larger SWIZ_BITS | 1836 | * for heavy swaploads. Later, larger nr_cpus -> larger SWIZ_BITS |
| 1837 | * Setting SWIZ_BITS to 27 basically reconstructs the swap entry from | 1837 | * Setting SWIZ_BITS to 27 basically reconstructs the swap entry from |
| 1838 | * frontswap_get_page(), but has side-effects. Hence using 8. | 1838 | * frontswap_load(), but has side-effects. Hence using 8. |
| 1839 | */ | 1839 | */ |
| 1840 | #define SWIZ_BITS 8 | 1840 | #define SWIZ_BITS 8 |
| 1841 | #define SWIZ_MASK ((1 << SWIZ_BITS) - 1) | 1841 | #define SWIZ_MASK ((1 << SWIZ_BITS) - 1) |
| @@ -1849,7 +1849,7 @@ static inline struct tmem_oid oswiz(unsigned type, u32 ind) | |||
| 1849 | return oid; | 1849 | return oid; |
| 1850 | } | 1850 | } |
| 1851 | 1851 | ||
| 1852 | static int zcache_frontswap_put_page(unsigned type, pgoff_t offset, | 1852 | static int zcache_frontswap_store(unsigned type, pgoff_t offset, |
| 1853 | struct page *page) | 1853 | struct page *page) |
| 1854 | { | 1854 | { |
| 1855 | u64 ind64 = (u64)offset; | 1855 | u64 ind64 = (u64)offset; |
| @@ -1870,7 +1870,7 @@ static int zcache_frontswap_put_page(unsigned type, pgoff_t offset, | |||
| 1870 | 1870 | ||
| 1871 | /* returns 0 if the page was successfully gotten from frontswap, -1 if | 1871 | /* returns 0 if the page was successfully gotten from frontswap, -1 if |
| 1872 | * was not present (should never happen!) */ | 1872 | * was not present (should never happen!) */ |
| 1873 | static int zcache_frontswap_get_page(unsigned type, pgoff_t offset, | 1873 | static int zcache_frontswap_load(unsigned type, pgoff_t offset, |
| 1874 | struct page *page) | 1874 | struct page *page) |
| 1875 | { | 1875 | { |
| 1876 | u64 ind64 = (u64)offset; | 1876 | u64 ind64 = (u64)offset; |
| @@ -1919,8 +1919,8 @@ static void zcache_frontswap_init(unsigned ignored) | |||
| 1919 | } | 1919 | } |
| 1920 | 1920 | ||
| 1921 | static struct frontswap_ops zcache_frontswap_ops = { | 1921 | static struct frontswap_ops zcache_frontswap_ops = { |
| 1922 | .put_page = zcache_frontswap_put_page, | 1922 | .store = zcache_frontswap_store, |
| 1923 | .get_page = zcache_frontswap_get_page, | 1923 | .load = zcache_frontswap_load, |
| 1924 | .invalidate_page = zcache_frontswap_flush_page, | 1924 | .invalidate_page = zcache_frontswap_flush_page, |
| 1925 | .invalidate_area = zcache_frontswap_flush_area, | 1925 | .invalidate_area = zcache_frontswap_flush_area, |
| 1926 | .init = zcache_frontswap_init | 1926 | .init = zcache_frontswap_init |
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index 37c609898f84..7e6136e2ce81 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c | |||
| @@ -587,14 +587,14 @@ static void sbp_management_request_logout( | |||
| 587 | { | 587 | { |
| 588 | struct sbp_tport *tport = agent->tport; | 588 | struct sbp_tport *tport = agent->tport; |
| 589 | struct sbp_tpg *tpg = tport->tpg; | 589 | struct sbp_tpg *tpg = tport->tpg; |
| 590 | int login_id; | 590 | int id; |
| 591 | struct sbp_login_descriptor *login; | 591 | struct sbp_login_descriptor *login; |
| 592 | 592 | ||
| 593 | login_id = LOGOUT_ORB_LOGIN_ID(be32_to_cpu(req->orb.misc)); | 593 | id = LOGOUT_ORB_LOGIN_ID(be32_to_cpu(req->orb.misc)); |
| 594 | 594 | ||
| 595 | login = sbp_login_find_by_id(tpg, login_id); | 595 | login = sbp_login_find_by_id(tpg, id); |
| 596 | if (!login) { | 596 | if (!login) { |
| 597 | pr_warn("cannot find login: %d\n", login_id); | 597 | pr_warn("cannot find login: %d\n", id); |
| 598 | 598 | ||
| 599 | req->status.status = cpu_to_be32( | 599 | req->status.status = cpu_to_be32( |
| 600 | STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | | 600 | STATUS_BLOCK_RESP(STATUS_RESP_REQUEST_COMPLETE) | |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index e624b836469c..91799973081a 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
| @@ -374,8 +374,9 @@ int target_emulate_set_target_port_groups(struct se_cmd *cmd) | |||
| 374 | 374 | ||
| 375 | out: | 375 | out: |
| 376 | transport_kunmap_data_sg(cmd); | 376 | transport_kunmap_data_sg(cmd); |
| 377 | target_complete_cmd(cmd, GOOD); | 377 | if (!rc) |
| 378 | return 0; | 378 | target_complete_cmd(cmd, GOOD); |
| 379 | return rc; | ||
| 379 | } | 380 | } |
| 380 | 381 | ||
| 381 | static inline int core_alua_state_nonoptimized( | 382 | static inline int core_alua_state_nonoptimized( |
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 9888693a18fe..664f6e775d0e 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c | |||
| @@ -1095,7 +1095,7 @@ int target_emulate_write_same(struct se_cmd *cmd) | |||
| 1095 | if (num_blocks != 0) | 1095 | if (num_blocks != 0) |
| 1096 | range = num_blocks; | 1096 | range = num_blocks; |
| 1097 | else | 1097 | else |
| 1098 | range = (dev->transport->get_blocks(dev) - lba); | 1098 | range = (dev->transport->get_blocks(dev) - lba) + 1; |
| 1099 | 1099 | ||
| 1100 | pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n", | 1100 | pr_debug("WRITE_SAME UNMAP: LBA: %llu Range: %llu\n", |
| 1101 | (unsigned long long)lba, (unsigned long long)range); | 1101 | (unsigned long long)lba, (unsigned long long)range); |
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 686dba189f8e..9f99d0404908 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
| @@ -133,16 +133,11 @@ static struct se_device *fd_create_virtdevice( | |||
| 133 | ret = PTR_ERR(dev_p); | 133 | ret = PTR_ERR(dev_p); |
| 134 | goto fail; | 134 | goto fail; |
| 135 | } | 135 | } |
| 136 | |||
| 137 | /* O_DIRECT too? */ | ||
| 138 | flags = O_RDWR | O_CREAT | O_LARGEFILE; | ||
| 139 | |||
| 140 | /* | 136 | /* |
| 141 | * If fd_buffered_io=1 has not been set explicitly (the default), | 137 | * Use O_DSYNC by default instead of O_SYNC to forgo syncing |
| 142 | * use O_SYNC to force FILEIO writes to disk. | 138 | * of pure timestamp updates. |
| 143 | */ | 139 | */ |
| 144 | if (!(fd_dev->fbd_flags & FDBD_USE_BUFFERED_IO)) | 140 | flags = O_RDWR | O_CREAT | O_LARGEFILE | O_DSYNC; |
| 145 | flags |= O_SYNC; | ||
| 146 | 141 | ||
| 147 | file = filp_open(dev_p, flags, 0600); | 142 | file = filp_open(dev_p, flags, 0600); |
| 148 | if (IS_ERR(file)) { | 143 | if (IS_ERR(file)) { |
| @@ -380,23 +375,6 @@ static void fd_emulate_sync_cache(struct se_cmd *cmd) | |||
| 380 | } | 375 | } |
| 381 | } | 376 | } |
| 382 | 377 | ||
| 383 | static void fd_emulate_write_fua(struct se_cmd *cmd) | ||
| 384 | { | ||
| 385 | struct se_device *dev = cmd->se_dev; | ||
| 386 | struct fd_dev *fd_dev = dev->dev_ptr; | ||
| 387 | loff_t start = cmd->t_task_lba * | ||
| 388 | dev->se_sub_dev->se_dev_attrib.block_size; | ||
| 389 | loff_t end = start + cmd->data_length; | ||
| 390 | int ret; | ||
| 391 | |||
| 392 | pr_debug("FILEIO: FUA WRITE LBA: %llu, bytes: %u\n", | ||
| 393 | cmd->t_task_lba, cmd->data_length); | ||
| 394 | |||
| 395 | ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1); | ||
| 396 | if (ret != 0) | ||
| 397 | pr_err("FILEIO: vfs_fsync_range() failed: %d\n", ret); | ||
| 398 | } | ||
| 399 | |||
| 400 | static int fd_execute_cmd(struct se_cmd *cmd, struct scatterlist *sgl, | 378 | static int fd_execute_cmd(struct se_cmd *cmd, struct scatterlist *sgl, |
| 401 | u32 sgl_nents, enum dma_data_direction data_direction) | 379 | u32 sgl_nents, enum dma_data_direction data_direction) |
| 402 | { | 380 | { |
| @@ -411,19 +389,21 @@ static int fd_execute_cmd(struct se_cmd *cmd, struct scatterlist *sgl, | |||
| 411 | ret = fd_do_readv(cmd, sgl, sgl_nents); | 389 | ret = fd_do_readv(cmd, sgl, sgl_nents); |
| 412 | } else { | 390 | } else { |
| 413 | ret = fd_do_writev(cmd, sgl, sgl_nents); | 391 | ret = fd_do_writev(cmd, sgl, sgl_nents); |
| 414 | 392 | /* | |
| 393 | * Perform implict vfs_fsync_range() for fd_do_writev() ops | ||
| 394 | * for SCSI WRITEs with Forced Unit Access (FUA) set. | ||
| 395 | * Allow this to happen independent of WCE=0 setting. | ||
| 396 | */ | ||
| 415 | if (ret > 0 && | 397 | if (ret > 0 && |
| 416 | dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 && | ||
| 417 | dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && | 398 | dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 && |
| 418 | (cmd->se_cmd_flags & SCF_FUA)) { | 399 | (cmd->se_cmd_flags & SCF_FUA)) { |
| 419 | /* | 400 | struct fd_dev *fd_dev = dev->dev_ptr; |
| 420 | * We might need to be a bit smarter here | 401 | loff_t start = cmd->t_task_lba * |
| 421 | * and return some sense data to let the initiator | 402 | dev->se_sub_dev->se_dev_attrib.block_size; |
| 422 | * know the FUA WRITE cache sync failed..? | 403 | loff_t end = start + cmd->data_length; |
| 423 | */ | ||
| 424 | fd_emulate_write_fua(cmd); | ||
| 425 | } | ||
| 426 | 404 | ||
| 405 | vfs_fsync_range(fd_dev->fd_file, start, end, 1); | ||
| 406 | } | ||
| 427 | } | 407 | } |
| 428 | 408 | ||
| 429 | if (ret < 0) { | 409 | if (ret < 0) { |
| @@ -442,7 +422,6 @@ enum { | |||
| 442 | static match_table_t tokens = { | 422 | static match_table_t tokens = { |
| 443 | {Opt_fd_dev_name, "fd_dev_name=%s"}, | 423 | {Opt_fd_dev_name, "fd_dev_name=%s"}, |
| 444 | {Opt_fd_dev_size, "fd_dev_size=%s"}, | 424 | {Opt_fd_dev_size, "fd_dev_size=%s"}, |
| 445 | {Opt_fd_buffered_io, "fd_buffered_io=%d"}, | ||
| 446 | {Opt_err, NULL} | 425 | {Opt_err, NULL} |
| 447 | }; | 426 | }; |
| 448 | 427 | ||
| @@ -454,7 +433,7 @@ static ssize_t fd_set_configfs_dev_params( | |||
| 454 | struct fd_dev *fd_dev = se_dev->se_dev_su_ptr; | 433 | struct fd_dev *fd_dev = se_dev->se_dev_su_ptr; |
| 455 | char *orig, *ptr, *arg_p, *opts; | 434 | char *orig, *ptr, *arg_p, *opts; |
| 456 | substring_t args[MAX_OPT_ARGS]; | 435 | substring_t args[MAX_OPT_ARGS]; |
| 457 | int ret = 0, arg, token; | 436 | int ret = 0, token; |
| 458 | 437 | ||
| 459 | opts = kstrdup(page, GFP_KERNEL); | 438 | opts = kstrdup(page, GFP_KERNEL); |
| 460 | if (!opts) | 439 | if (!opts) |
| @@ -498,19 +477,6 @@ static ssize_t fd_set_configfs_dev_params( | |||
| 498 | " bytes\n", fd_dev->fd_dev_size); | 477 | " bytes\n", fd_dev->fd_dev_size); |
| 499 | fd_dev->fbd_flags |= FBDF_HAS_SIZE; | 478 | fd_dev->fbd_flags |= FBDF_HAS_SIZE; |
| 500 | break; | 479 | break; |
| 501 | case Opt_fd_buffered_io: | ||
| 502 | match_int(args, &arg); | ||
| 503 | if (arg != 1) { | ||
| 504 | pr_err("bogus fd_buffered_io=%d value\n", arg); | ||
| 505 | ret = -EINVAL; | ||
| 506 | goto out; | ||
| 507 | } | ||
| 508 | |||
| 509 | pr_debug("FILEIO: Using buffered I/O" | ||
| 510 | " operations for struct fd_dev\n"); | ||
| 511 | |||
| 512 | fd_dev->fbd_flags |= FDBD_USE_BUFFERED_IO; | ||
| 513 | break; | ||
| 514 | default: | 480 | default: |
| 515 | break; | 481 | break; |
| 516 | } | 482 | } |
| @@ -542,10 +508,8 @@ static ssize_t fd_show_configfs_dev_params( | |||
| 542 | ssize_t bl = 0; | 508 | ssize_t bl = 0; |
| 543 | 509 | ||
| 544 | bl = sprintf(b + bl, "TCM FILEIO ID: %u", fd_dev->fd_dev_id); | 510 | bl = sprintf(b + bl, "TCM FILEIO ID: %u", fd_dev->fd_dev_id); |
| 545 | bl += sprintf(b + bl, " File: %s Size: %llu Mode: %s\n", | 511 | bl += sprintf(b + bl, " File: %s Size: %llu Mode: O_DSYNC\n", |
| 546 | fd_dev->fd_dev_name, fd_dev->fd_dev_size, | 512 | fd_dev->fd_dev_name, fd_dev->fd_dev_size); |
| 547 | (fd_dev->fbd_flags & FDBD_USE_BUFFERED_IO) ? | ||
| 548 | "Buffered" : "Synchronous"); | ||
| 549 | return bl; | 513 | return bl; |
| 550 | } | 514 | } |
| 551 | 515 | ||
diff --git a/drivers/target/target_core_file.h b/drivers/target/target_core_file.h index fbd59ef7d8be..70ce7fd7111d 100644 --- a/drivers/target/target_core_file.h +++ b/drivers/target/target_core_file.h | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | 14 | ||
| 15 | #define FBDF_HAS_PATH 0x01 | 15 | #define FBDF_HAS_PATH 0x01 |
| 16 | #define FBDF_HAS_SIZE 0x02 | 16 | #define FBDF_HAS_SIZE 0x02 |
| 17 | #define FDBD_USE_BUFFERED_IO 0x04 | ||
| 18 | 17 | ||
| 19 | struct fd_dev { | 18 | struct fd_dev { |
| 20 | u32 fbd_flags; | 19 | u32 fbd_flags; |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 85564998500a..a1bcd927a9e6 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
| @@ -2031,7 +2031,7 @@ static int __core_scsi3_write_aptpl_to_file( | |||
| 2031 | if (IS_ERR(file) || !file || !file->f_dentry) { | 2031 | if (IS_ERR(file) || !file || !file->f_dentry) { |
| 2032 | pr_err("filp_open(%s) for APTPL metadata" | 2032 | pr_err("filp_open(%s) for APTPL metadata" |
| 2033 | " failed\n", path); | 2033 | " failed\n", path); |
| 2034 | return (PTR_ERR(file) < 0 ? PTR_ERR(file) : -ENOENT); | 2034 | return IS_ERR(file) ? PTR_ERR(file) : -ENOENT; |
| 2035 | } | 2035 | } |
| 2036 | 2036 | ||
| 2037 | iov[0].iov_base = &buf[0]; | 2037 | iov[0].iov_base = &buf[0]; |
| @@ -3818,7 +3818,7 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd) | |||
| 3818 | " SPC-2 reservation is held, returning" | 3818 | " SPC-2 reservation is held, returning" |
| 3819 | " RESERVATION_CONFLICT\n"); | 3819 | " RESERVATION_CONFLICT\n"); |
| 3820 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; | 3820 | cmd->scsi_sense_reason = TCM_RESERVATION_CONFLICT; |
| 3821 | ret = EINVAL; | 3821 | ret = -EINVAL; |
| 3822 | goto out; | 3822 | goto out; |
| 3823 | } | 3823 | } |
| 3824 | 3824 | ||
| @@ -3828,7 +3828,8 @@ int target_scsi3_emulate_pr_out(struct se_cmd *cmd) | |||
| 3828 | */ | 3828 | */ |
| 3829 | if (!cmd->se_sess) { | 3829 | if (!cmd->se_sess) { |
| 3830 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 3830 | cmd->scsi_sense_reason = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
| 3831 | return -EINVAL; | 3831 | ret = -EINVAL; |
| 3832 | goto out; | ||
| 3832 | } | 3833 | } |
| 3833 | 3834 | ||
| 3834 | if (cmd->data_length < 24) { | 3835 | if (cmd->data_length < 24) { |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index b05fdc0c05d3..634d0f31a28c 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
| @@ -315,7 +315,7 @@ void transport_register_session( | |||
| 315 | } | 315 | } |
| 316 | EXPORT_SYMBOL(transport_register_session); | 316 | EXPORT_SYMBOL(transport_register_session); |
| 317 | 317 | ||
| 318 | static void target_release_session(struct kref *kref) | 318 | void target_release_session(struct kref *kref) |
| 319 | { | 319 | { |
| 320 | struct se_session *se_sess = container_of(kref, | 320 | struct se_session *se_sess = container_of(kref, |
| 321 | struct se_session, sess_kref); | 321 | struct se_session, sess_kref); |
| @@ -332,6 +332,12 @@ EXPORT_SYMBOL(target_get_session); | |||
| 332 | 332 | ||
| 333 | void target_put_session(struct se_session *se_sess) | 333 | void target_put_session(struct se_session *se_sess) |
| 334 | { | 334 | { |
| 335 | struct se_portal_group *tpg = se_sess->se_tpg; | ||
| 336 | |||
| 337 | if (tpg->se_tpg_tfo->put_session != NULL) { | ||
| 338 | tpg->se_tpg_tfo->put_session(se_sess); | ||
| 339 | return; | ||
| 340 | } | ||
| 335 | kref_put(&se_sess->sess_kref, target_release_session); | 341 | kref_put(&se_sess->sess_kref, target_release_session); |
| 336 | } | 342 | } |
| 337 | EXPORT_SYMBOL(target_put_session); | 343 | EXPORT_SYMBOL(target_put_session); |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index f03fb9730f5b..5b65f33939a8 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
| @@ -230,6 +230,8 @@ u32 ft_get_task_tag(struct se_cmd *se_cmd) | |||
| 230 | { | 230 | { |
| 231 | struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); | 231 | struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd); |
| 232 | 232 | ||
| 233 | if (cmd->aborted) | ||
| 234 | return ~0; | ||
| 233 | return fc_seq_exch(cmd->seq)->rxid; | 235 | return fc_seq_exch(cmd->seq)->rxid; |
| 234 | } | 236 | } |
| 235 | 237 | ||
diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c index cb99da920068..87901fa74dd7 100644 --- a/drivers/target/tcm_fc/tfc_sess.c +++ b/drivers/target/tcm_fc/tfc_sess.c | |||
| @@ -58,7 +58,8 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport) | |||
| 58 | struct ft_tport *tport; | 58 | struct ft_tport *tport; |
| 59 | int i; | 59 | int i; |
| 60 | 60 | ||
| 61 | tport = rcu_dereference(lport->prov[FC_TYPE_FCP]); | 61 | tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP], |
| 62 | lockdep_is_held(&ft_lport_lock)); | ||
| 62 | if (tport && tport->tpg) | 63 | if (tport && tport->tpg) |
| 63 | return tport; | 64 | return tport; |
| 64 | 65 | ||
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c index ced26c8ccd57..0d2ea0c224c3 100644 --- a/drivers/tty/hvc/hvc_opal.c +++ b/drivers/tty/hvc/hvc_opal.c | |||
| @@ -401,7 +401,7 @@ out: | |||
| 401 | } | 401 | } |
| 402 | 402 | ||
| 403 | #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW | 403 | #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW |
| 404 | void __init udbg_init_debug_opal(void) | 404 | void __init udbg_init_debug_opal_raw(void) |
| 405 | { | 405 | { |
| 406 | u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; | 406 | u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; |
| 407 | hvc_opal_privs[index] = &hvc_opal_boot_priv; | 407 | hvc_opal_privs[index] = &hvc_opal_boot_priv; |
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c index d3d91dae065c..944eaeb8e0cf 100644 --- a/drivers/tty/hvc/hvc_xen.c +++ b/drivers/tty/hvc/hvc_xen.c | |||
| @@ -214,24 +214,24 @@ static int xen_hvm_console_init(void) | |||
| 214 | /* already configured */ | 214 | /* already configured */ |
| 215 | if (info->intf != NULL) | 215 | if (info->intf != NULL) |
| 216 | return 0; | 216 | return 0; |
| 217 | 217 | /* | |
| 218 | * If the toolstack (or the hypervisor) hasn't set these values, the | ||
| 219 | * default value is 0. Even though mfn = 0 and evtchn = 0 are | ||
| 220 | * theoretically correct values, in practice they never are and they | ||
| 221 | * mean that a legacy toolstack hasn't initialized the pv console correctly. | ||
| 222 | */ | ||
| 218 | r = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v); | 223 | r = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v); |
| 219 | if (r < 0) { | 224 | if (r < 0 || v == 0) |
| 220 | kfree(info); | 225 | goto err; |
| 221 | return -ENODEV; | ||
| 222 | } | ||
| 223 | info->evtchn = v; | 226 | info->evtchn = v; |
| 224 | hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v); | 227 | v = 0; |
| 225 | if (r < 0) { | 228 | r = hvm_get_parameter(HVM_PARAM_CONSOLE_PFN, &v); |
| 226 | kfree(info); | 229 | if (r < 0 || v == 0) |
| 227 | return -ENODEV; | 230 | goto err; |
| 228 | } | ||
| 229 | mfn = v; | 231 | mfn = v; |
| 230 | info->intf = ioremap(mfn << PAGE_SHIFT, PAGE_SIZE); | 232 | info->intf = ioremap(mfn << PAGE_SHIFT, PAGE_SIZE); |
| 231 | if (info->intf == NULL) { | 233 | if (info->intf == NULL) |
| 232 | kfree(info); | 234 | goto err; |
| 233 | return -ENODEV; | ||
| 234 | } | ||
| 235 | info->vtermno = HVC_COOKIE; | 235 | info->vtermno = HVC_COOKIE; |
| 236 | 236 | ||
| 237 | spin_lock(&xencons_lock); | 237 | spin_lock(&xencons_lock); |
| @@ -239,6 +239,9 @@ static int xen_hvm_console_init(void) | |||
| 239 | spin_unlock(&xencons_lock); | 239 | spin_unlock(&xencons_lock); |
| 240 | 240 | ||
| 241 | return 0; | 241 | return 0; |
| 242 | err: | ||
| 243 | kfree(info); | ||
| 244 | return -ENODEV; | ||
| 242 | } | 245 | } |
| 243 | 246 | ||
| 244 | static int xen_pv_console_init(void) | 247 | static int xen_pv_console_init(void) |
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 47d061b9ad4d..6e1958a325bd 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c | |||
| @@ -3113,7 +3113,7 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port * | |||
| 3113 | 3113 | ||
| 3114 | /** | 3114 | /** |
| 3115 | * serial8250_register_8250_port - register a serial port | 3115 | * serial8250_register_8250_port - register a serial port |
| 3116 | * @port: serial port template | 3116 | * @up: serial port template |
| 3117 | * | 3117 | * |
| 3118 | * Configure the serial port specified by the request. If the | 3118 | * Configure the serial port specified by the request. If the |
| 3119 | * port exists and is in use, it is hung up and unregistered | 3119 | * port exists and is in use, it is hung up and unregistered |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 4ad721fb8405..c17923ec6e95 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
| @@ -133,6 +133,10 @@ struct pl011_dmatx_data { | |||
| 133 | struct uart_amba_port { | 133 | struct uart_amba_port { |
| 134 | struct uart_port port; | 134 | struct uart_port port; |
| 135 | struct clk *clk; | 135 | struct clk *clk; |
| 136 | /* Two optional pin states - default & sleep */ | ||
| 137 | struct pinctrl *pinctrl; | ||
| 138 | struct pinctrl_state *pins_default; | ||
| 139 | struct pinctrl_state *pins_sleep; | ||
| 136 | const struct vendor_data *vendor; | 140 | const struct vendor_data *vendor; |
| 137 | unsigned int dmacr; /* dma control reg */ | 141 | unsigned int dmacr; /* dma control reg */ |
| 138 | unsigned int im; /* interrupt mask */ | 142 | unsigned int im; /* interrupt mask */ |
| @@ -1312,6 +1316,14 @@ static int pl011_startup(struct uart_port *port) | |||
| 1312 | unsigned int cr; | 1316 | unsigned int cr; |
| 1313 | int retval; | 1317 | int retval; |
| 1314 | 1318 | ||
| 1319 | /* Optionaly enable pins to be muxed in and configured */ | ||
| 1320 | if (!IS_ERR(uap->pins_default)) { | ||
| 1321 | retval = pinctrl_select_state(uap->pinctrl, uap->pins_default); | ||
| 1322 | if (retval) | ||
| 1323 | dev_err(port->dev, | ||
| 1324 | "could not set default pins\n"); | ||
| 1325 | } | ||
| 1326 | |||
| 1315 | retval = clk_prepare(uap->clk); | 1327 | retval = clk_prepare(uap->clk); |
| 1316 | if (retval) | 1328 | if (retval) |
| 1317 | goto out; | 1329 | goto out; |
| @@ -1420,6 +1432,7 @@ static void pl011_shutdown(struct uart_port *port) | |||
| 1420 | { | 1432 | { |
| 1421 | struct uart_amba_port *uap = (struct uart_amba_port *)port; | 1433 | struct uart_amba_port *uap = (struct uart_amba_port *)port; |
| 1422 | unsigned int cr; | 1434 | unsigned int cr; |
| 1435 | int retval; | ||
| 1423 | 1436 | ||
| 1424 | /* | 1437 | /* |
| 1425 | * disable all interrupts | 1438 | * disable all interrupts |
| @@ -1462,6 +1475,14 @@ static void pl011_shutdown(struct uart_port *port) | |||
| 1462 | */ | 1475 | */ |
| 1463 | clk_disable(uap->clk); | 1476 | clk_disable(uap->clk); |
| 1464 | clk_unprepare(uap->clk); | 1477 | clk_unprepare(uap->clk); |
| 1478 | /* Optionally let pins go into sleep states */ | ||
| 1479 | if (!IS_ERR(uap->pins_sleep)) { | ||
| 1480 | retval = pinctrl_select_state(uap->pinctrl, uap->pins_sleep); | ||
| 1481 | if (retval) | ||
| 1482 | dev_err(port->dev, | ||
| 1483 | "could not set pins to sleep state\n"); | ||
| 1484 | } | ||
| 1485 | |||
| 1465 | 1486 | ||
| 1466 | if (uap->port.dev->platform_data) { | 1487 | if (uap->port.dev->platform_data) { |
| 1467 | struct amba_pl011_data *plat; | 1488 | struct amba_pl011_data *plat; |
| @@ -1792,6 +1813,14 @@ static int __init pl011_console_setup(struct console *co, char *options) | |||
| 1792 | if (!uap) | 1813 | if (!uap) |
| 1793 | return -ENODEV; | 1814 | return -ENODEV; |
| 1794 | 1815 | ||
| 1816 | /* Allow pins to be muxed in and configured */ | ||
| 1817 | if (!IS_ERR(uap->pins_default)) { | ||
| 1818 | ret = pinctrl_select_state(uap->pinctrl, uap->pins_default); | ||
| 1819 | if (ret) | ||
| 1820 | dev_err(uap->port.dev, | ||
| 1821 | "could not set default pins\n"); | ||
| 1822 | } | ||
| 1823 | |||
| 1795 | ret = clk_prepare(uap->clk); | 1824 | ret = clk_prepare(uap->clk); |
| 1796 | if (ret) | 1825 | if (ret) |
| 1797 | return ret; | 1826 | return ret; |
| @@ -1844,7 +1873,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
| 1844 | { | 1873 | { |
| 1845 | struct uart_amba_port *uap; | 1874 | struct uart_amba_port *uap; |
| 1846 | struct vendor_data *vendor = id->data; | 1875 | struct vendor_data *vendor = id->data; |
| 1847 | struct pinctrl *pinctrl; | ||
| 1848 | void __iomem *base; | 1876 | void __iomem *base; |
| 1849 | int i, ret; | 1877 | int i, ret; |
| 1850 | 1878 | ||
| @@ -1869,11 +1897,20 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
| 1869 | goto free; | 1897 | goto free; |
| 1870 | } | 1898 | } |
| 1871 | 1899 | ||
| 1872 | pinctrl = devm_pinctrl_get_select_default(&dev->dev); | 1900 | uap->pinctrl = devm_pinctrl_get(&dev->dev); |
| 1873 | if (IS_ERR(pinctrl)) { | 1901 | if (IS_ERR(uap->pinctrl)) { |
| 1874 | ret = PTR_ERR(pinctrl); | 1902 | ret = PTR_ERR(uap->pinctrl); |
| 1875 | goto unmap; | 1903 | goto unmap; |
| 1876 | } | 1904 | } |
| 1905 | uap->pins_default = pinctrl_lookup_state(uap->pinctrl, | ||
| 1906 | PINCTRL_STATE_DEFAULT); | ||
| 1907 | if (IS_ERR(uap->pins_default)) | ||
| 1908 | dev_err(&dev->dev, "could not get default pinstate\n"); | ||
| 1909 | |||
| 1910 | uap->pins_sleep = pinctrl_lookup_state(uap->pinctrl, | ||
| 1911 | PINCTRL_STATE_SLEEP); | ||
| 1912 | if (IS_ERR(uap->pins_sleep)) | ||
| 1913 | dev_dbg(&dev->dev, "could not get sleep pinstate\n"); | ||
| 1877 | 1914 | ||
| 1878 | uap->clk = clk_get(&dev->dev, NULL); | 1915 | uap->clk = clk_get(&dev->dev, NULL); |
| 1879 | if (IS_ERR(uap->clk)) { | 1916 | if (IS_ERR(uap->clk)) { |
diff --git a/drivers/tty/serial/serial_txx9.c b/drivers/tty/serial/serial_txx9.c index 34bd345da775..6ae2a58d62f2 100644 --- a/drivers/tty/serial/serial_txx9.c +++ b/drivers/tty/serial/serial_txx9.c | |||
| @@ -466,7 +466,7 @@ static void serial_txx9_break_ctl(struct uart_port *port, int break_state) | |||
| 466 | spin_unlock_irqrestore(&up->port.lock, flags); | 466 | spin_unlock_irqrestore(&up->port.lock, flags); |
| 467 | } | 467 | } |
| 468 | 468 | ||
| 469 | #if defined(CONFIG_SERIAL_TXX9_CONSOLE) || (CONFIG_CONSOLE_POLL) | 469 | #if defined(CONFIG_SERIAL_TXX9_CONSOLE) || defined(CONFIG_CONSOLE_POLL) |
| 470 | /* | 470 | /* |
| 471 | * Wait for transmitter & holding register to empty | 471 | * Wait for transmitter & holding register to empty |
| 472 | */ | 472 | */ |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 4604153b7954..1bd9163bc118 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
| @@ -2179,6 +2179,16 @@ static int __devinit sci_init_single(struct platform_device *dev, | |||
| 2179 | return 0; | 2179 | return 0; |
| 2180 | } | 2180 | } |
| 2181 | 2181 | ||
| 2182 | static void sci_cleanup_single(struct sci_port *port) | ||
| 2183 | { | ||
| 2184 | sci_free_gpios(port); | ||
| 2185 | |||
| 2186 | clk_put(port->iclk); | ||
| 2187 | clk_put(port->fclk); | ||
| 2188 | |||
| 2189 | pm_runtime_disable(port->port.dev); | ||
| 2190 | } | ||
| 2191 | |||
| 2182 | #ifdef CONFIG_SERIAL_SH_SCI_CONSOLE | 2192 | #ifdef CONFIG_SERIAL_SH_SCI_CONSOLE |
| 2183 | static void serial_console_putchar(struct uart_port *port, int ch) | 2193 | static void serial_console_putchar(struct uart_port *port, int ch) |
| 2184 | { | 2194 | { |
| @@ -2360,14 +2370,10 @@ static int sci_remove(struct platform_device *dev) | |||
| 2360 | cpufreq_unregister_notifier(&port->freq_transition, | 2370 | cpufreq_unregister_notifier(&port->freq_transition, |
| 2361 | CPUFREQ_TRANSITION_NOTIFIER); | 2371 | CPUFREQ_TRANSITION_NOTIFIER); |
| 2362 | 2372 | ||
| 2363 | sci_free_gpios(port); | ||
| 2364 | |||
| 2365 | uart_remove_one_port(&sci_uart_driver, &port->port); | 2373 | uart_remove_one_port(&sci_uart_driver, &port->port); |
| 2366 | 2374 | ||
| 2367 | clk_put(port->iclk); | 2375 | sci_cleanup_single(port); |
| 2368 | clk_put(port->fclk); | ||
| 2369 | 2376 | ||
| 2370 | pm_runtime_disable(&dev->dev); | ||
| 2371 | return 0; | 2377 | return 0; |
| 2372 | } | 2378 | } |
| 2373 | 2379 | ||
| @@ -2385,14 +2391,20 @@ static int __devinit sci_probe_single(struct platform_device *dev, | |||
| 2385 | index+1, SCI_NPORTS); | 2391 | index+1, SCI_NPORTS); |
| 2386 | dev_notice(&dev->dev, "Consider bumping " | 2392 | dev_notice(&dev->dev, "Consider bumping " |
| 2387 | "CONFIG_SERIAL_SH_SCI_NR_UARTS!\n"); | 2393 | "CONFIG_SERIAL_SH_SCI_NR_UARTS!\n"); |
| 2388 | return 0; | 2394 | return -EINVAL; |
| 2389 | } | 2395 | } |
| 2390 | 2396 | ||
| 2391 | ret = sci_init_single(dev, sciport, index, p); | 2397 | ret = sci_init_single(dev, sciport, index, p); |
| 2392 | if (ret) | 2398 | if (ret) |
| 2393 | return ret; | 2399 | return ret; |
| 2394 | 2400 | ||
| 2395 | return uart_add_one_port(&sci_uart_driver, &sciport->port); | 2401 | ret = uart_add_one_port(&sci_uart_driver, &sciport->port); |
| 2402 | if (ret) { | ||
| 2403 | sci_cleanup_single(sciport); | ||
| 2404 | return ret; | ||
| 2405 | } | ||
| 2406 | |||
| 2407 | return 0; | ||
| 2396 | } | 2408 | } |
| 2397 | 2409 | ||
| 2398 | static int __devinit sci_probe(struct platform_device *dev) | 2410 | static int __devinit sci_probe(struct platform_device *dev) |
| @@ -2413,24 +2425,22 @@ static int __devinit sci_probe(struct platform_device *dev) | |||
| 2413 | 2425 | ||
| 2414 | ret = sci_probe_single(dev, dev->id, p, sp); | 2426 | ret = sci_probe_single(dev, dev->id, p, sp); |
| 2415 | if (ret) | 2427 | if (ret) |
| 2416 | goto err_unreg; | 2428 | return ret; |
| 2417 | 2429 | ||
| 2418 | sp->freq_transition.notifier_call = sci_notifier; | 2430 | sp->freq_transition.notifier_call = sci_notifier; |
| 2419 | 2431 | ||
| 2420 | ret = cpufreq_register_notifier(&sp->freq_transition, | 2432 | ret = cpufreq_register_notifier(&sp->freq_transition, |
| 2421 | CPUFREQ_TRANSITION_NOTIFIER); | 2433 | CPUFREQ_TRANSITION_NOTIFIER); |
| 2422 | if (unlikely(ret < 0)) | 2434 | if (unlikely(ret < 0)) { |
| 2423 | goto err_unreg; | 2435 | sci_cleanup_single(sp); |
| 2436 | return ret; | ||
| 2437 | } | ||
| 2424 | 2438 | ||
| 2425 | #ifdef CONFIG_SH_STANDARD_BIOS | 2439 | #ifdef CONFIG_SH_STANDARD_BIOS |
| 2426 | sh_bios_gdb_detach(); | 2440 | sh_bios_gdb_detach(); |
| 2427 | #endif | 2441 | #endif |
| 2428 | 2442 | ||
| 2429 | return 0; | 2443 | return 0; |
| 2430 | |||
| 2431 | err_unreg: | ||
| 2432 | sci_remove(dev); | ||
| 2433 | return ret; | ||
| 2434 | } | 2444 | } |
| 2435 | 2445 | ||
| 2436 | static int sci_suspend(struct device *dev) | 2446 | static int sci_suspend(struct device *dev) |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index c691eea51537..f5ed3d75fa5a 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
| @@ -46,7 +46,7 @@ obj-$(CONFIG_USB_MICROTEK) += image/ | |||
| 46 | obj-$(CONFIG_USB_SERIAL) += serial/ | 46 | obj-$(CONFIG_USB_SERIAL) += serial/ |
| 47 | 47 | ||
| 48 | obj-$(CONFIG_USB) += misc/ | 48 | obj-$(CONFIG_USB) += misc/ |
| 49 | obj-$(CONFIG_USB) += phy/ | 49 | obj-$(CONFIG_USB_COMMON) += phy/ |
| 50 | obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ | 50 | obj-$(CONFIG_EARLY_PRINTK_DBGP) += early/ |
| 51 | 51 | ||
| 52 | obj-$(CONFIG_USB_ATM) += atm/ | 52 | obj-$(CONFIG_USB_ATM) += atm/ |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index f2a120eea9d4..36a2a0b7b82c 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
| @@ -567,6 +567,14 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) | |||
| 567 | 567 | ||
| 568 | usb_autopm_put_interface(acm->control); | 568 | usb_autopm_put_interface(acm->control); |
| 569 | 569 | ||
| 570 | /* | ||
| 571 | * Unthrottle device in case the TTY was closed while throttled. | ||
| 572 | */ | ||
| 573 | spin_lock_irq(&acm->read_lock); | ||
| 574 | acm->throttled = 0; | ||
| 575 | acm->throttle_req = 0; | ||
| 576 | spin_unlock_irq(&acm->read_lock); | ||
| 577 | |||
| 570 | if (acm_submit_read_urbs(acm, GFP_KERNEL)) | 578 | if (acm_submit_read_urbs(acm, GFP_KERNEL)) |
| 571 | goto error_submit_read_urbs; | 579 | goto error_submit_read_urbs; |
| 572 | 580 | ||
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index ea8b304f0e85..ee469274a3fe 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
| @@ -55,6 +55,15 @@ static const struct usb_device_id wdm_ids[] = { | |||
| 55 | .bInterfaceSubClass = 1, | 55 | .bInterfaceSubClass = 1, |
| 56 | .bInterfaceProtocol = 9, /* NOTE: CDC ECM control interface! */ | 56 | .bInterfaceProtocol = 9, /* NOTE: CDC ECM control interface! */ |
| 57 | }, | 57 | }, |
| 58 | { | ||
| 59 | /* Vodafone/Huawei K5005 (12d1:14c8) and similar modems */ | ||
| 60 | .match_flags = USB_DEVICE_ID_MATCH_VENDOR | | ||
| 61 | USB_DEVICE_ID_MATCH_INT_INFO, | ||
| 62 | .idVendor = HUAWEI_VENDOR_ID, | ||
| 63 | .bInterfaceClass = USB_CLASS_VENDOR_SPEC, | ||
| 64 | .bInterfaceSubClass = 1, | ||
| 65 | .bInterfaceProtocol = 57, /* NOTE: CDC ECM control interface! */ | ||
| 66 | }, | ||
| 58 | { } | 67 | { } |
| 59 | }; | 68 | }; |
| 60 | 69 | ||
| @@ -491,6 +500,8 @@ retry: | |||
| 491 | goto retry; | 500 | goto retry; |
| 492 | } | 501 | } |
| 493 | if (!desc->reslength) { /* zero length read */ | 502 | if (!desc->reslength) { /* zero length read */ |
| 503 | dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__); | ||
| 504 | clear_bit(WDM_READ, &desc->flags); | ||
| 494 | spin_unlock_irq(&desc->iuspin); | 505 | spin_unlock_irq(&desc->iuspin); |
| 495 | goto retry; | 506 | goto retry; |
| 496 | } | 507 | } |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 57ed9e400c06..622b4a48e732 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
| @@ -493,15 +493,6 @@ static int hcd_pci_suspend_noirq(struct device *dev) | |||
| 493 | 493 | ||
| 494 | pci_save_state(pci_dev); | 494 | pci_save_state(pci_dev); |
| 495 | 495 | ||
| 496 | /* | ||
| 497 | * Some systems crash if an EHCI controller is in D3 during | ||
| 498 | * a sleep transition. We have to leave such controllers in D0. | ||
| 499 | */ | ||
| 500 | if (hcd->broken_pci_sleep) { | ||
| 501 | dev_dbg(dev, "Staying in PCI D0\n"); | ||
| 502 | return retval; | ||
| 503 | } | ||
| 504 | |||
| 505 | /* If the root hub is dead rather than suspended, disallow remote | 496 | /* If the root hub is dead rather than suspended, disallow remote |
| 506 | * wakeup. usb_hc_died() should ensure that both hosts are marked as | 497 | * wakeup. usb_hc_died() should ensure that both hosts are marked as |
| 507 | * dying, so we only need to check the primary roothub. | 498 | * dying, so we only need to check the primary roothub. |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 04fb834c3fa1..8fb484984c86 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
| @@ -2324,12 +2324,16 @@ static unsigned hub_is_wusb(struct usb_hub *hub) | |||
| 2324 | static int hub_port_reset(struct usb_hub *hub, int port1, | 2324 | static int hub_port_reset(struct usb_hub *hub, int port1, |
| 2325 | struct usb_device *udev, unsigned int delay, bool warm); | 2325 | struct usb_device *udev, unsigned int delay, bool warm); |
| 2326 | 2326 | ||
| 2327 | /* Is a USB 3.0 port in the Inactive state? */ | 2327 | /* Is a USB 3.0 port in the Inactive or Complinance Mode state? |
| 2328 | static bool hub_port_inactive(struct usb_hub *hub, u16 portstatus) | 2328 | * Port worm reset is required to recover |
| 2329 | */ | ||
| 2330 | static bool hub_port_warm_reset_required(struct usb_hub *hub, u16 portstatus) | ||
| 2329 | { | 2331 | { |
| 2330 | return hub_is_superspeed(hub->hdev) && | 2332 | return hub_is_superspeed(hub->hdev) && |
| 2331 | (portstatus & USB_PORT_STAT_LINK_STATE) == | 2333 | (((portstatus & USB_PORT_STAT_LINK_STATE) == |
| 2332 | USB_SS_PORT_LS_SS_INACTIVE; | 2334 | USB_SS_PORT_LS_SS_INACTIVE) || |
| 2335 | ((portstatus & USB_PORT_STAT_LINK_STATE) == | ||
| 2336 | USB_SS_PORT_LS_COMP_MOD)) ; | ||
| 2333 | } | 2337 | } |
| 2334 | 2338 | ||
| 2335 | static int hub_port_wait_reset(struct usb_hub *hub, int port1, | 2339 | static int hub_port_wait_reset(struct usb_hub *hub, int port1, |
| @@ -2365,7 +2369,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | |||
| 2365 | * | 2369 | * |
| 2366 | * See https://bugzilla.kernel.org/show_bug.cgi?id=41752 | 2370 | * See https://bugzilla.kernel.org/show_bug.cgi?id=41752 |
| 2367 | */ | 2371 | */ |
| 2368 | if (hub_port_inactive(hub, portstatus)) { | 2372 | if (hub_port_warm_reset_required(hub, portstatus)) { |
| 2369 | int ret; | 2373 | int ret; |
| 2370 | 2374 | ||
| 2371 | if ((portchange & USB_PORT_STAT_C_CONNECTION)) | 2375 | if ((portchange & USB_PORT_STAT_C_CONNECTION)) |
| @@ -3379,7 +3383,7 @@ int usb_disable_lpm(struct usb_device *udev) | |||
| 3379 | return 0; | 3383 | return 0; |
| 3380 | 3384 | ||
| 3381 | udev->lpm_disable_count++; | 3385 | udev->lpm_disable_count++; |
| 3382 | if ((udev->u1_params.timeout == 0 && udev->u1_params.timeout == 0)) | 3386 | if ((udev->u1_params.timeout == 0 && udev->u2_params.timeout == 0)) |
| 3383 | return 0; | 3387 | return 0; |
| 3384 | 3388 | ||
| 3385 | /* If LPM is enabled, attempt to disable it. */ | 3389 | /* If LPM is enabled, attempt to disable it. */ |
| @@ -4408,9 +4412,7 @@ static void hub_events(void) | |||
| 4408 | /* Warm reset a USB3 protocol port if it's in | 4412 | /* Warm reset a USB3 protocol port if it's in |
| 4409 | * SS.Inactive state. | 4413 | * SS.Inactive state. |
| 4410 | */ | 4414 | */ |
| 4411 | if (hub_is_superspeed(hub->hdev) && | 4415 | if (hub_port_warm_reset_required(hub, portstatus)) { |
| 4412 | (portstatus & USB_PORT_STAT_LINK_STATE) | ||
| 4413 | == USB_SS_PORT_LS_SS_INACTIVE) { | ||
| 4414 | dev_dbg(hub_dev, "warm reset port %d\n", i); | 4416 | dev_dbg(hub_dev, "warm reset port %d\n", i); |
| 4415 | hub_port_reset(hub, i, NULL, | 4417 | hub_port_reset(hub, i, NULL, |
| 4416 | HUB_BH_RESET_TIME, true); | 4418 | HUB_BH_RESET_TIME, true); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index b548cf1dbc62..bdd1c6749d88 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
| @@ -1838,7 +1838,6 @@ free_interfaces: | |||
| 1838 | intfc = cp->intf_cache[i]; | 1838 | intfc = cp->intf_cache[i]; |
| 1839 | intf->altsetting = intfc->altsetting; | 1839 | intf->altsetting = intfc->altsetting; |
| 1840 | intf->num_altsetting = intfc->num_altsetting; | 1840 | intf->num_altsetting = intfc->num_altsetting; |
| 1841 | intf->intf_assoc = find_iad(dev, cp, i); | ||
| 1842 | kref_get(&intfc->ref); | 1841 | kref_get(&intfc->ref); |
| 1843 | 1842 | ||
| 1844 | alt = usb_altnum_to_altsetting(intf, 0); | 1843 | alt = usb_altnum_to_altsetting(intf, 0); |
| @@ -1851,6 +1850,8 @@ free_interfaces: | |||
| 1851 | if (!alt) | 1850 | if (!alt) |
| 1852 | alt = &intf->altsetting[0]; | 1851 | alt = &intf->altsetting[0]; |
| 1853 | 1852 | ||
| 1853 | intf->intf_assoc = | ||
| 1854 | find_iad(dev, cp, alt->desc.bInterfaceNumber); | ||
| 1854 | intf->cur_altsetting = alt; | 1855 | intf->cur_altsetting = alt; |
| 1855 | usb_enable_interface(dev, intf, true); | 1856 | usb_enable_interface(dev, intf, true); |
| 1856 | intf->dev.parent = &dev->dev; | 1857 | intf->dev.parent = &dev->dev; |
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3df1a1973b05..ec70df7aba17 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
| @@ -1091,7 +1091,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, | |||
| 1091 | if (r == req) { | 1091 | if (r == req) { |
| 1092 | /* wait until it is processed */ | 1092 | /* wait until it is processed */ |
| 1093 | dwc3_stop_active_transfer(dwc, dep->number); | 1093 | dwc3_stop_active_transfer(dwc, dep->number); |
| 1094 | goto out0; | 1094 | goto out1; |
| 1095 | } | 1095 | } |
| 1096 | dev_err(dwc->dev, "request %p was not queued to %s\n", | 1096 | dev_err(dwc->dev, "request %p was not queued to %s\n", |
| 1097 | request, ep->name); | 1097 | request, ep->name); |
| @@ -1099,6 +1099,7 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep, | |||
| 1099 | goto out0; | 1099 | goto out0; |
| 1100 | } | 1100 | } |
| 1101 | 1101 | ||
| 1102 | out1: | ||
| 1102 | /* giveback the request */ | 1103 | /* giveback the request */ |
| 1103 | dwc3_gadget_giveback(dep, req, -ECONNRESET); | 1104 | dwc3_gadget_giveback(dep, req, -ECONNRESET); |
| 1104 | 1105 | ||
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c index e23bf7984aaf..9a9bced813ed 100644 --- a/drivers/usb/gadget/atmel_usba_udc.c +++ b/drivers/usb/gadget/atmel_usba_udc.c | |||
| @@ -599,12 +599,6 @@ usba_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | |||
| 599 | 599 | ||
| 600 | spin_lock_irqsave(&ep->udc->lock, flags); | 600 | spin_lock_irqsave(&ep->udc->lock, flags); |
| 601 | 601 | ||
| 602 | if (ep->ep.desc) { | ||
| 603 | spin_unlock_irqrestore(&ep->udc->lock, flags); | ||
| 604 | DBG(DBG_ERR, "ep%d already enabled\n", ep->index); | ||
| 605 | return -EBUSY; | ||
| 606 | } | ||
| 607 | |||
| 608 | ep->ep.desc = desc; | 602 | ep->ep.desc = desc; |
| 609 | ep->ep.maxpacket = maxpacket; | 603 | ep->ep.maxpacket = maxpacket; |
| 610 | 604 | ||
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c index 51881f3bd07a..b09452d6f33a 100644 --- a/drivers/usb/gadget/fsl_qe_udc.c +++ b/drivers/usb/gadget/fsl_qe_udc.c | |||
| @@ -1596,7 +1596,7 @@ static int qe_ep_enable(struct usb_ep *_ep, | |||
| 1596 | ep = container_of(_ep, struct qe_ep, ep); | 1596 | ep = container_of(_ep, struct qe_ep, ep); |
| 1597 | 1597 | ||
| 1598 | /* catch various bogus parameters */ | 1598 | /* catch various bogus parameters */ |
| 1599 | if (!_ep || !desc || ep->ep.desc || _ep->name == ep_name[0] || | 1599 | if (!_ep || !desc || _ep->name == ep_name[0] || |
| 1600 | (desc->bDescriptorType != USB_DT_ENDPOINT)) | 1600 | (desc->bDescriptorType != USB_DT_ENDPOINT)) |
| 1601 | return -EINVAL; | 1601 | return -EINVAL; |
| 1602 | 1602 | ||
diff --git a/drivers/usb/gadget/fsl_qe_udc.h b/drivers/usb/gadget/fsl_qe_udc.h index 4c07ca9cebf3..7026919fc901 100644 --- a/drivers/usb/gadget/fsl_qe_udc.h +++ b/drivers/usb/gadget/fsl_qe_udc.h | |||
| @@ -153,10 +153,10 @@ struct usb_ep_para{ | |||
| 153 | #define USB_BUSMODE_DTB 0x02 | 153 | #define USB_BUSMODE_DTB 0x02 |
| 154 | 154 | ||
| 155 | /* Endpoint basic handle */ | 155 | /* Endpoint basic handle */ |
| 156 | #define ep_index(EP) ((EP)->desc->bEndpointAddress & 0xF) | 156 | #define ep_index(EP) ((EP)->ep.desc->bEndpointAddress & 0xF) |
| 157 | #define ep_maxpacket(EP) ((EP)->ep.maxpacket) | 157 | #define ep_maxpacket(EP) ((EP)->ep.maxpacket) |
| 158 | #define ep_is_in(EP) ((ep_index(EP) == 0) ? (EP->udc->ep0_dir == \ | 158 | #define ep_is_in(EP) ((ep_index(EP) == 0) ? (EP->udc->ep0_dir == \ |
| 159 | USB_DIR_IN) : ((EP)->desc->bEndpointAddress \ | 159 | USB_DIR_IN) : ((EP)->ep.desc->bEndpointAddress \ |
| 160 | & USB_DIR_IN) == USB_DIR_IN) | 160 | & USB_DIR_IN) == USB_DIR_IN) |
| 161 | 161 | ||
| 162 | /* ep0 transfer state */ | 162 | /* ep0 transfer state */ |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 28316858208b..bc6f9bb9994a 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
| @@ -567,7 +567,7 @@ static int fsl_ep_enable(struct usb_ep *_ep, | |||
| 567 | ep = container_of(_ep, struct fsl_ep, ep); | 567 | ep = container_of(_ep, struct fsl_ep, ep); |
| 568 | 568 | ||
| 569 | /* catch various bogus parameters */ | 569 | /* catch various bogus parameters */ |
| 570 | if (!_ep || !desc || ep->ep.desc | 570 | if (!_ep || !desc |
| 571 | || (desc->bDescriptorType != USB_DT_ENDPOINT)) | 571 | || (desc->bDescriptorType != USB_DT_ENDPOINT)) |
| 572 | return -EINVAL; | 572 | return -EINVAL; |
| 573 | 573 | ||
| @@ -2575,7 +2575,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev) | |||
| 2575 | /* for ep0: the desc defined here; | 2575 | /* for ep0: the desc defined here; |
| 2576 | * for other eps, gadget layer called ep_enable with defined desc | 2576 | * for other eps, gadget layer called ep_enable with defined desc |
| 2577 | */ | 2577 | */ |
| 2578 | udc_controller->eps[0].desc = &fsl_ep0_desc; | 2578 | udc_controller->eps[0].ep.desc = &fsl_ep0_desc; |
| 2579 | udc_controller->eps[0].ep.maxpacket = USB_MAX_CTRL_PAYLOAD; | 2579 | udc_controller->eps[0].ep.maxpacket = USB_MAX_CTRL_PAYLOAD; |
| 2580 | 2580 | ||
| 2581 | /* setup the udc->eps[] for non-control endpoints and link | 2581 | /* setup the udc->eps[] for non-control endpoints and link |
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index 5cd7b7e7ddb4..f61a967f7082 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h | |||
| @@ -568,10 +568,10 @@ static void dump_msg(const char *label, const u8 * buf, unsigned int length) | |||
| 568 | /* | 568 | /* |
| 569 | * ### internal used help routines. | 569 | * ### internal used help routines. |
| 570 | */ | 570 | */ |
| 571 | #define ep_index(EP) ((EP)->desc->bEndpointAddress&0xF) | 571 | #define ep_index(EP) ((EP)->ep.desc->bEndpointAddress&0xF) |
| 572 | #define ep_maxpacket(EP) ((EP)->ep.maxpacket) | 572 | #define ep_maxpacket(EP) ((EP)->ep.maxpacket) |
| 573 | #define ep_is_in(EP) ( (ep_index(EP) == 0) ? (EP->udc->ep0_dir == \ | 573 | #define ep_is_in(EP) ( (ep_index(EP) == 0) ? (EP->udc->ep0_dir == \ |
| 574 | USB_DIR_IN ):((EP)->desc->bEndpointAddress \ | 574 | USB_DIR_IN) : ((EP)->ep.desc->bEndpointAddress \ |
| 575 | & USB_DIR_IN)==USB_DIR_IN) | 575 | & USB_DIR_IN)==USB_DIR_IN) |
| 576 | #define get_ep_by_pipe(udc, pipe) ((pipe == 1)? &udc->eps[0]: \ | 576 | #define get_ep_by_pipe(udc, pipe) ((pipe == 1)? &udc->eps[0]: \ |
| 577 | &udc->eps[pipe]) | 577 | &udc->eps[pipe]) |
diff --git a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c index b241e6c6a7f2..3d28fb976c78 100644 --- a/drivers/usb/gadget/goku_udc.c +++ b/drivers/usb/gadget/goku_udc.c | |||
| @@ -102,7 +102,7 @@ goku_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) | |||
| 102 | unsigned long flags; | 102 | unsigned long flags; |
| 103 | 103 | ||
| 104 | ep = container_of(_ep, struct goku_ep, ep); | 104 | ep = container_of(_ep, struct goku_ep, ep); |
| 105 | if (!_ep || !desc || ep->ep.desc | 105 | if (!_ep || !desc |
| 106 | || desc->bDescriptorType != USB_DT_ENDPOINT) | 106 | || desc->bDescriptorType != USB_DT_ENDPOINT) |
| 107 | return -EINVAL; | 107 | return -EINVAL; |
| 108 | dev = ep->dev; | 108 | dev = ep->dev; |
diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c index 262acfd53e32..2ab0388d93eb 100644 --- a/drivers/usb/gadget/lpc32xx_udc.c +++ b/drivers/usb/gadget/lpc32xx_udc.c | |||
| @@ -61,6 +61,7 @@ | |||
| 61 | #include <mach/irqs.h> | 61 | #include <mach/irqs.h> |
| 62 | #include <mach/board.h> | 62 | #include <mach/board.h> |
| 63 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES | 63 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES |
| 64 | #include <linux/debugfs.h> | ||
| 64 | #include <linux/seq_file.h> | 65 | #include <linux/seq_file.h> |
| 65 | #endif | 66 | #endif |
| 66 | 67 | ||
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c index dbcd1329495e..117a4bba1b8c 100644 --- a/drivers/usb/gadget/mv_udc_core.c +++ b/drivers/usb/gadget/mv_udc_core.c | |||
| @@ -464,7 +464,7 @@ static int mv_ep_enable(struct usb_ep *_ep, | |||
| 464 | ep = container_of(_ep, struct mv_ep, ep); | 464 | ep = container_of(_ep, struct mv_ep, ep); |
| 465 | udc = ep->udc; | 465 | udc = ep->udc; |
| 466 | 466 | ||
| 467 | if (!_ep || !desc || ep->ep.desc | 467 | if (!_ep || !desc |
| 468 | || desc->bDescriptorType != USB_DT_ENDPOINT) | 468 | || desc->bDescriptorType != USB_DT_ENDPOINT) |
| 469 | return -EINVAL; | 469 | return -EINVAL; |
| 470 | 470 | ||
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 7ba32469c5bd..a460e8c204f4 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
| @@ -153,7 +153,7 @@ static int omap_ep_enable(struct usb_ep *_ep, | |||
| 153 | u16 maxp; | 153 | u16 maxp; |
| 154 | 154 | ||
| 155 | /* catch various bogus parameters */ | 155 | /* catch various bogus parameters */ |
| 156 | if (!_ep || !desc || ep->ep.desc | 156 | if (!_ep || !desc |
| 157 | || desc->bDescriptorType != USB_DT_ENDPOINT | 157 | || desc->bDescriptorType != USB_DT_ENDPOINT |
| 158 | || ep->bEndpointAddress != desc->bEndpointAddress | 158 | || ep->bEndpointAddress != desc->bEndpointAddress |
| 159 | || ep->maxpacket < usb_endpoint_maxp(desc)) { | 159 | || ep->maxpacket < usb_endpoint_maxp(desc)) { |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index d7c8cb3bf759..f7ff9e8e746a 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
| @@ -218,7 +218,7 @@ static int pxa25x_ep_enable (struct usb_ep *_ep, | |||
| 218 | struct pxa25x_udc *dev; | 218 | struct pxa25x_udc *dev; |
| 219 | 219 | ||
| 220 | ep = container_of (_ep, struct pxa25x_ep, ep); | 220 | ep = container_of (_ep, struct pxa25x_ep, ep); |
| 221 | if (!_ep || !desc || ep->ep.desc || _ep->name == ep0name | 221 | if (!_ep || !desc || _ep->name == ep0name |
| 222 | || desc->bDescriptorType != USB_DT_ENDPOINT | 222 | || desc->bDescriptorType != USB_DT_ENDPOINT |
| 223 | || ep->bEndpointAddress != desc->bEndpointAddress | 223 | || ep->bEndpointAddress != desc->bEndpointAddress |
| 224 | || ep->fifo_size < usb_endpoint_maxp (desc)) { | 224 | || ep->fifo_size < usb_endpoint_maxp (desc)) { |
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c index 36c6836eeb0f..236b271871a0 100644 --- a/drivers/usb/gadget/s3c-hsudc.c +++ b/drivers/usb/gadget/s3c-hsudc.c | |||
| @@ -760,7 +760,7 @@ static int s3c_hsudc_ep_enable(struct usb_ep *_ep, | |||
| 760 | u32 ecr = 0; | 760 | u32 ecr = 0; |
| 761 | 761 | ||
| 762 | hsep = our_ep(_ep); | 762 | hsep = our_ep(_ep); |
| 763 | if (!_ep || !desc || hsep->ep.desc || _ep->name == ep0name | 763 | if (!_ep || !desc || _ep->name == ep0name |
| 764 | || desc->bDescriptorType != USB_DT_ENDPOINT | 764 | || desc->bDescriptorType != USB_DT_ENDPOINT |
| 765 | || hsep->bEndpointAddress != desc->bEndpointAddress | 765 | || hsep->bEndpointAddress != desc->bEndpointAddress |
| 766 | || ep_maxpacket(hsep) < usb_endpoint_maxp(desc)) | 766 | || ep_maxpacket(hsep) < usb_endpoint_maxp(desc)) |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index 3de71d37d75e..f2e51f50e528 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
| @@ -1062,7 +1062,7 @@ static int s3c2410_udc_ep_enable(struct usb_ep *_ep, | |||
| 1062 | 1062 | ||
| 1063 | ep = to_s3c2410_ep(_ep); | 1063 | ep = to_s3c2410_ep(_ep); |
| 1064 | 1064 | ||
| 1065 | if (!_ep || !desc || ep->ep.desc | 1065 | if (!_ep || !desc |
| 1066 | || _ep->name == ep0name | 1066 | || _ep->name == ep0name |
| 1067 | || desc->bDescriptorType != USB_DT_ENDPOINT) | 1067 | || desc->bDescriptorType != USB_DT_ENDPOINT) |
| 1068 | return -EINVAL; | 1068 | return -EINVAL; |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index b100f5f9f4b6..800be38c78b4 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
| @@ -671,7 +671,9 @@ static int ehci_init(struct usb_hcd *hcd) | |||
| 671 | hw = ehci->async->hw; | 671 | hw = ehci->async->hw; |
| 672 | hw->hw_next = QH_NEXT(ehci, ehci->async->qh_dma); | 672 | hw->hw_next = QH_NEXT(ehci, ehci->async->qh_dma); |
| 673 | hw->hw_info1 = cpu_to_hc32(ehci, QH_HEAD); | 673 | hw->hw_info1 = cpu_to_hc32(ehci, QH_HEAD); |
| 674 | #if defined(CONFIG_PPC_PS3) | ||
| 674 | hw->hw_info1 |= cpu_to_hc32(ehci, (1 << 7)); /* I = 1 */ | 675 | hw->hw_info1 |= cpu_to_hc32(ehci, (1 << 7)); /* I = 1 */ |
| 676 | #endif | ||
| 675 | hw->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT); | 677 | hw->hw_token = cpu_to_hc32(ehci, QTD_STS_HALT); |
| 676 | hw->hw_qtd_next = EHCI_LIST_END(ehci); | 678 | hw->hw_qtd_next = EHCI_LIST_END(ehci); |
| 677 | ehci->async->qh_state = QH_STATE_LINKED; | 679 | ehci->async->qh_state = QH_STATE_LINKED; |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index a44294d13494..c30435499a02 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #include <linux/regulator/consumer.h> | 43 | #include <linux/regulator/consumer.h> |
| 44 | #include <linux/pm_runtime.h> | 44 | #include <linux/pm_runtime.h> |
| 45 | #include <linux/gpio.h> | 45 | #include <linux/gpio.h> |
| 46 | #include <linux/clk.h> | ||
| 46 | 47 | ||
| 47 | /* EHCI Register Set */ | 48 | /* EHCI Register Set */ |
| 48 | #define EHCI_INSNREG04 (0xA0) | 49 | #define EHCI_INSNREG04 (0xA0) |
| @@ -55,6 +56,15 @@ | |||
| 55 | #define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 | 56 | #define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 |
| 56 | #define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 | 57 | #define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 |
| 57 | 58 | ||
| 59 | /* Errata i693 */ | ||
| 60 | static struct clk *utmi_p1_fck; | ||
| 61 | static struct clk *utmi_p2_fck; | ||
| 62 | static struct clk *xclk60mhsp1_ck; | ||
| 63 | static struct clk *xclk60mhsp2_ck; | ||
| 64 | static struct clk *usbhost_p1_fck; | ||
| 65 | static struct clk *usbhost_p2_fck; | ||
| 66 | static struct clk *init_60m_fclk; | ||
| 67 | |||
| 58 | /*-------------------------------------------------------------------------*/ | 68 | /*-------------------------------------------------------------------------*/ |
| 59 | 69 | ||
| 60 | static const struct hc_driver ehci_omap_hc_driver; | 70 | static const struct hc_driver ehci_omap_hc_driver; |
| @@ -70,6 +80,41 @@ static inline u32 ehci_read(void __iomem *base, u32 reg) | |||
| 70 | return __raw_readl(base + reg); | 80 | return __raw_readl(base + reg); |
| 71 | } | 81 | } |
| 72 | 82 | ||
| 83 | /* Erratum i693 workaround sequence */ | ||
| 84 | static void omap_ehci_erratum_i693(struct ehci_hcd *ehci) | ||
| 85 | { | ||
| 86 | int ret = 0; | ||
| 87 | |||
| 88 | /* Switch to the internal 60 MHz clock */ | ||
| 89 | ret = clk_set_parent(utmi_p1_fck, init_60m_fclk); | ||
| 90 | if (ret != 0) | ||
| 91 | ehci_err(ehci, "init_60m_fclk set parent" | ||
| 92 | "failed error:%d\n", ret); | ||
| 93 | |||
| 94 | ret = clk_set_parent(utmi_p2_fck, init_60m_fclk); | ||
| 95 | if (ret != 0) | ||
| 96 | ehci_err(ehci, "init_60m_fclk set parent" | ||
| 97 | "failed error:%d\n", ret); | ||
| 98 | |||
| 99 | clk_enable(usbhost_p1_fck); | ||
| 100 | clk_enable(usbhost_p2_fck); | ||
| 101 | |||
| 102 | /* Wait 1ms and switch back to the external clock */ | ||
| 103 | mdelay(1); | ||
| 104 | ret = clk_set_parent(utmi_p1_fck, xclk60mhsp1_ck); | ||
| 105 | if (ret != 0) | ||
| 106 | ehci_err(ehci, "xclk60mhsp1_ck set parent" | ||
| 107 | "failed error:%d\n", ret); | ||
| 108 | |||
| 109 | ret = clk_set_parent(utmi_p2_fck, xclk60mhsp2_ck); | ||
| 110 | if (ret != 0) | ||
| 111 | ehci_err(ehci, "xclk60mhsp2_ck set parent" | ||
| 112 | "failed error:%d\n", ret); | ||
| 113 | |||
| 114 | clk_disable(usbhost_p1_fck); | ||
| 115 | clk_disable(usbhost_p2_fck); | ||
| 116 | } | ||
| 117 | |||
| 73 | static void omap_ehci_soft_phy_reset(struct platform_device *pdev, u8 port) | 118 | static void omap_ehci_soft_phy_reset(struct platform_device *pdev, u8 port) |
| 74 | { | 119 | { |
| 75 | struct usb_hcd *hcd = dev_get_drvdata(&pdev->dev); | 120 | struct usb_hcd *hcd = dev_get_drvdata(&pdev->dev); |
| @@ -100,6 +145,50 @@ static void omap_ehci_soft_phy_reset(struct platform_device *pdev, u8 port) | |||
| 100 | } | 145 | } |
| 101 | } | 146 | } |
| 102 | 147 | ||
| 148 | static int omap_ehci_hub_control( | ||
| 149 | struct usb_hcd *hcd, | ||
| 150 | u16 typeReq, | ||
| 151 | u16 wValue, | ||
| 152 | u16 wIndex, | ||
| 153 | char *buf, | ||
| 154 | u16 wLength | ||
| 155 | ) | ||
| 156 | { | ||
| 157 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
| 158 | u32 __iomem *status_reg = &ehci->regs->port_status[ | ||
| 159 | (wIndex & 0xff) - 1]; | ||
| 160 | u32 temp; | ||
| 161 | unsigned long flags; | ||
| 162 | int retval = 0; | ||
| 163 | |||
| 164 | spin_lock_irqsave(&ehci->lock, flags); | ||
| 165 | |||
| 166 | if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) { | ||
| 167 | temp = ehci_readl(ehci, status_reg); | ||
| 168 | if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) { | ||
| 169 | retval = -EPIPE; | ||
| 170 | goto done; | ||
| 171 | } | ||
| 172 | |||
| 173 | temp &= ~PORT_WKCONN_E; | ||
| 174 | temp |= PORT_WKDISC_E | PORT_WKOC_E; | ||
| 175 | ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); | ||
| 176 | |||
| 177 | omap_ehci_erratum_i693(ehci); | ||
| 178 | |||
| 179 | set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports); | ||
| 180 | goto done; | ||
| 181 | } | ||
| 182 | |||
| 183 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
| 184 | |||
| 185 | /* Handle the hub control events here */ | ||
| 186 | return ehci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); | ||
| 187 | done: | ||
| 188 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
| 189 | return retval; | ||
| 190 | } | ||
| 191 | |||
| 103 | static void disable_put_regulator( | 192 | static void disable_put_regulator( |
| 104 | struct ehci_hcd_omap_platform_data *pdata) | 193 | struct ehci_hcd_omap_platform_data *pdata) |
| 105 | { | 194 | { |
| @@ -192,14 +281,13 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
| 192 | } | 281 | } |
| 193 | } | 282 | } |
| 194 | 283 | ||
| 284 | /* Hold PHYs in reset while initializing EHCI controller */ | ||
| 195 | if (pdata->phy_reset) { | 285 | if (pdata->phy_reset) { |
| 196 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | 286 | if (gpio_is_valid(pdata->reset_gpio_port[0])) |
| 197 | gpio_request_one(pdata->reset_gpio_port[0], | 287 | gpio_set_value_cansleep(pdata->reset_gpio_port[0], 0); |
| 198 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
| 199 | 288 | ||
| 200 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | 289 | if (gpio_is_valid(pdata->reset_gpio_port[1])) |
| 201 | gpio_request_one(pdata->reset_gpio_port[1], | 290 | gpio_set_value_cansleep(pdata->reset_gpio_port[1], 0); |
| 202 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
| 203 | 291 | ||
| 204 | /* Hold the PHY in RESET for enough time till DIR is high */ | 292 | /* Hold the PHY in RESET for enough time till DIR is high */ |
| 205 | udelay(10); | 293 | udelay(10); |
| @@ -241,6 +329,11 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
| 241 | omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); | 329 | omap_ehci->hcs_params = readl(&omap_ehci->caps->hcs_params); |
| 242 | 330 | ||
| 243 | ehci_reset(omap_ehci); | 331 | ehci_reset(omap_ehci); |
| 332 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | ||
| 333 | if (ret) { | ||
| 334 | dev_err(dev, "failed to add hcd with err %d\n", ret); | ||
| 335 | goto err_add_hcd; | ||
| 336 | } | ||
| 244 | 337 | ||
| 245 | if (pdata->phy_reset) { | 338 | if (pdata->phy_reset) { |
| 246 | /* Hold the PHY in RESET for enough time till | 339 | /* Hold the PHY in RESET for enough time till |
| @@ -255,17 +348,79 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
| 255 | gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1); | 348 | gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1); |
| 256 | } | 349 | } |
| 257 | 350 | ||
| 258 | ret = usb_add_hcd(hcd, irq, IRQF_SHARED); | 351 | /* root ports should always stay powered */ |
| 259 | if (ret) { | 352 | ehci_port_power(omap_ehci, 1); |
| 260 | dev_err(dev, "failed to add hcd with err %d\n", ret); | 353 | |
| 354 | /* get clocks */ | ||
| 355 | utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk"); | ||
| 356 | if (IS_ERR(utmi_p1_fck)) { | ||
| 357 | ret = PTR_ERR(utmi_p1_fck); | ||
| 358 | dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret); | ||
| 261 | goto err_add_hcd; | 359 | goto err_add_hcd; |
| 262 | } | 360 | } |
| 263 | 361 | ||
| 264 | /* root ports should always stay powered */ | 362 | xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck"); |
| 265 | ehci_port_power(omap_ehci, 1); | 363 | if (IS_ERR(xclk60mhsp1_ck)) { |
| 364 | ret = PTR_ERR(xclk60mhsp1_ck); | ||
| 365 | dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret); | ||
| 366 | goto err_utmi_p1_fck; | ||
| 367 | } | ||
| 368 | |||
| 369 | utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk"); | ||
| 370 | if (IS_ERR(utmi_p2_fck)) { | ||
| 371 | ret = PTR_ERR(utmi_p2_fck); | ||
| 372 | dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret); | ||
| 373 | goto err_xclk60mhsp1_ck; | ||
| 374 | } | ||
| 375 | |||
| 376 | xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck"); | ||
| 377 | if (IS_ERR(xclk60mhsp2_ck)) { | ||
| 378 | ret = PTR_ERR(xclk60mhsp2_ck); | ||
| 379 | dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret); | ||
| 380 | goto err_utmi_p2_fck; | ||
| 381 | } | ||
| 382 | |||
| 383 | usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk"); | ||
| 384 | if (IS_ERR(usbhost_p1_fck)) { | ||
| 385 | ret = PTR_ERR(usbhost_p1_fck); | ||
| 386 | dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret); | ||
| 387 | goto err_xclk60mhsp2_ck; | ||
| 388 | } | ||
| 389 | |||
| 390 | usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk"); | ||
| 391 | if (IS_ERR(usbhost_p2_fck)) { | ||
| 392 | ret = PTR_ERR(usbhost_p2_fck); | ||
| 393 | dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret); | ||
| 394 | goto err_usbhost_p1_fck; | ||
| 395 | } | ||
| 396 | |||
| 397 | init_60m_fclk = clk_get(dev, "init_60m_fclk"); | ||
| 398 | if (IS_ERR(init_60m_fclk)) { | ||
| 399 | ret = PTR_ERR(init_60m_fclk); | ||
| 400 | dev_err(dev, "init_60m_fclk failed error:%d\n", ret); | ||
| 401 | goto err_usbhost_p2_fck; | ||
| 402 | } | ||
| 266 | 403 | ||
| 267 | return 0; | 404 | return 0; |
| 268 | 405 | ||
| 406 | err_usbhost_p2_fck: | ||
| 407 | clk_put(usbhost_p2_fck); | ||
| 408 | |||
| 409 | err_usbhost_p1_fck: | ||
| 410 | clk_put(usbhost_p1_fck); | ||
| 411 | |||
| 412 | err_xclk60mhsp2_ck: | ||
| 413 | clk_put(xclk60mhsp2_ck); | ||
| 414 | |||
| 415 | err_utmi_p2_fck: | ||
| 416 | clk_put(utmi_p2_fck); | ||
| 417 | |||
| 418 | err_xclk60mhsp1_ck: | ||
| 419 | clk_put(xclk60mhsp1_ck); | ||
| 420 | |||
| 421 | err_utmi_p1_fck: | ||
| 422 | clk_put(utmi_p1_fck); | ||
| 423 | |||
| 269 | err_add_hcd: | 424 | err_add_hcd: |
| 270 | disable_put_regulator(pdata); | 425 | disable_put_regulator(pdata); |
| 271 | pm_runtime_put_sync(dev); | 426 | pm_runtime_put_sync(dev); |
| @@ -294,6 +449,15 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) | |||
| 294 | disable_put_regulator(dev->platform_data); | 449 | disable_put_regulator(dev->platform_data); |
| 295 | iounmap(hcd->regs); | 450 | iounmap(hcd->regs); |
| 296 | usb_put_hcd(hcd); | 451 | usb_put_hcd(hcd); |
| 452 | |||
| 453 | clk_put(utmi_p1_fck); | ||
| 454 | clk_put(utmi_p2_fck); | ||
| 455 | clk_put(xclk60mhsp1_ck); | ||
| 456 | clk_put(xclk60mhsp2_ck); | ||
| 457 | clk_put(usbhost_p1_fck); | ||
| 458 | clk_put(usbhost_p2_fck); | ||
| 459 | clk_put(init_60m_fclk); | ||
| 460 | |||
| 297 | pm_runtime_put_sync(dev); | 461 | pm_runtime_put_sync(dev); |
| 298 | pm_runtime_disable(dev); | 462 | pm_runtime_disable(dev); |
| 299 | 463 | ||
| @@ -364,7 +528,7 @@ static const struct hc_driver ehci_omap_hc_driver = { | |||
| 364 | * root hub support | 528 | * root hub support |
| 365 | */ | 529 | */ |
| 366 | .hub_status_data = ehci_hub_status_data, | 530 | .hub_status_data = ehci_hub_status_data, |
| 367 | .hub_control = ehci_hub_control, | 531 | .hub_control = omap_ehci_hub_control, |
| 368 | .bus_suspend = ehci_bus_suspend, | 532 | .bus_suspend = ehci_bus_suspend, |
| 369 | .bus_resume = ehci_bus_resume, | 533 | .bus_resume = ehci_bus_resume, |
| 370 | 534 | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index bc94d7bf072d..123481793a47 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
| @@ -144,14 +144,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
| 144 | hcd->has_tt = 1; | 144 | hcd->has_tt = 1; |
| 145 | tdi_reset(ehci); | 145 | tdi_reset(ehci); |
| 146 | } | 146 | } |
| 147 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) { | ||
| 148 | /* EHCI #1 or #2 on 6 Series/C200 Series chipset */ | ||
| 149 | if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) { | ||
| 150 | ehci_info(ehci, "broken D3 during system sleep on ASUS\n"); | ||
| 151 | hcd->broken_pci_sleep = 1; | ||
| 152 | device_set_wakeup_capable(&pdev->dev, false); | ||
| 153 | } | ||
| 154 | } | ||
| 155 | break; | 147 | break; |
| 156 | case PCI_VENDOR_ID_TDI: | 148 | case PCI_VENDOR_ID_TDI: |
| 157 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 149 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index ca819cdd0c5e..e7cb3925abf8 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c | |||
| @@ -126,8 +126,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) | |||
| 126 | goto fail_create_hcd; | 126 | goto fail_create_hcd; |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | if (pdev->dev.platform_data != NULL) | 129 | pdata = pdev->dev.platform_data; |
| 130 | pdata = pdev->dev.platform_data; | ||
| 131 | 130 | ||
| 132 | /* initialize hcd */ | 131 | /* initialize hcd */ |
| 133 | hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev, | 132 | hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev, |
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index 9c2cc4633894..e9713d589e30 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c | |||
| @@ -270,14 +270,12 @@ static int ehci_hcd_xilinx_of_remove(struct platform_device *op) | |||
| 270 | * | 270 | * |
| 271 | * Properly shutdown the hcd, call driver's shutdown routine. | 271 | * Properly shutdown the hcd, call driver's shutdown routine. |
| 272 | */ | 272 | */ |
| 273 | static int ehci_hcd_xilinx_of_shutdown(struct platform_device *op) | 273 | static void ehci_hcd_xilinx_of_shutdown(struct platform_device *op) |
| 274 | { | 274 | { |
| 275 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); | 275 | struct usb_hcd *hcd = dev_get_drvdata(&op->dev); |
| 276 | 276 | ||
| 277 | if (hcd->driver->shutdown) | 277 | if (hcd->driver->shutdown) |
| 278 | hcd->driver->shutdown(hcd); | 278 | hcd->driver->shutdown(hcd); |
| 279 | |||
| 280 | return 0; | ||
| 281 | } | 279 | } |
| 282 | 280 | ||
| 283 | 281 | ||
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c index 836772dfabd3..2f3619eefefa 100644 --- a/drivers/usb/host/ohci-hub.c +++ b/drivers/usb/host/ohci-hub.c | |||
| @@ -317,7 +317,7 @@ static int ohci_bus_resume (struct usb_hcd *hcd) | |||
| 317 | } | 317 | } |
| 318 | 318 | ||
| 319 | /* Carry out the final steps of resuming the controller device */ | 319 | /* Carry out the final steps of resuming the controller device */ |
| 320 | static void ohci_finish_controller_resume(struct usb_hcd *hcd) | 320 | static void __maybe_unused ohci_finish_controller_resume(struct usb_hcd *hcd) |
| 321 | { | 321 | { |
| 322 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | 322 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
| 323 | int port; | 323 | int port; |
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 2732ef660c5c..7b01094d7993 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c | |||
| @@ -462,6 +462,42 @@ void xhci_test_and_clear_bit(struct xhci_hcd *xhci, __le32 __iomem **port_array, | |||
| 462 | } | 462 | } |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | /* Updates Link Status for super Speed port */ | ||
| 466 | static void xhci_hub_report_link_state(u32 *status, u32 status_reg) | ||
| 467 | { | ||
| 468 | u32 pls = status_reg & PORT_PLS_MASK; | ||
| 469 | |||
| 470 | /* resume state is a xHCI internal state. | ||
| 471 | * Do not report it to usb core. | ||
| 472 | */ | ||
| 473 | if (pls == XDEV_RESUME) | ||
| 474 | return; | ||
| 475 | |||
| 476 | /* When the CAS bit is set then warm reset | ||
| 477 | * should be performed on port | ||
| 478 | */ | ||
| 479 | if (status_reg & PORT_CAS) { | ||
| 480 | /* The CAS bit can be set while the port is | ||
| 481 | * in any link state. | ||
| 482 | * Only roothubs have CAS bit, so we | ||
| 483 | * pretend to be in compliance mode | ||
| 484 | * unless we're already in compliance | ||
| 485 | * or the inactive state. | ||
| 486 | */ | ||
| 487 | if (pls != USB_SS_PORT_LS_COMP_MOD && | ||
| 488 | pls != USB_SS_PORT_LS_SS_INACTIVE) { | ||
| 489 | pls = USB_SS_PORT_LS_COMP_MOD; | ||
| 490 | } | ||
| 491 | /* Return also connection bit - | ||
| 492 | * hub state machine resets port | ||
| 493 | * when this bit is set. | ||
| 494 | */ | ||
| 495 | pls |= USB_PORT_STAT_CONNECTION; | ||
| 496 | } | ||
| 497 | /* update status field */ | ||
| 498 | *status |= pls; | ||
| 499 | } | ||
| 500 | |||
| 465 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | 501 | int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, |
| 466 | u16 wIndex, char *buf, u16 wLength) | 502 | u16 wIndex, char *buf, u16 wLength) |
| 467 | { | 503 | { |
| @@ -606,13 +642,9 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 606 | else | 642 | else |
| 607 | status |= USB_PORT_STAT_POWER; | 643 | status |= USB_PORT_STAT_POWER; |
| 608 | } | 644 | } |
| 609 | /* Port Link State */ | 645 | /* Update Port Link State for super speed ports*/ |
| 610 | if (hcd->speed == HCD_USB3) { | 646 | if (hcd->speed == HCD_USB3) { |
| 611 | /* resume state is a xHCI internal state. | 647 | xhci_hub_report_link_state(&status, temp); |
| 612 | * Do not report it to usb core. | ||
| 613 | */ | ||
| 614 | if ((temp & PORT_PLS_MASK) != XDEV_RESUME) | ||
| 615 | status |= (temp & PORT_PLS_MASK); | ||
| 616 | } | 648 | } |
| 617 | if (bus_state->port_c_suspend & (1 << wIndex)) | 649 | if (bus_state->port_c_suspend & (1 << wIndex)) |
| 618 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; | 650 | status |= 1 << USB_PORT_FEAT_C_SUSPEND; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index ec4338eec826..77689bd64cac 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
| @@ -793,10 +793,9 @@ static void xhci_free_tt_info(struct xhci_hcd *xhci, | |||
| 793 | struct xhci_virt_device *virt_dev, | 793 | struct xhci_virt_device *virt_dev, |
| 794 | int slot_id) | 794 | int slot_id) |
| 795 | { | 795 | { |
| 796 | struct list_head *tt; | ||
| 797 | struct list_head *tt_list_head; | 796 | struct list_head *tt_list_head; |
| 798 | struct list_head *tt_next; | 797 | struct xhci_tt_bw_info *tt_info, *next; |
| 799 | struct xhci_tt_bw_info *tt_info; | 798 | bool slot_found = false; |
| 800 | 799 | ||
| 801 | /* If the device never made it past the Set Address stage, | 800 | /* If the device never made it past the Set Address stage, |
| 802 | * it may not have the real_port set correctly. | 801 | * it may not have the real_port set correctly. |
| @@ -808,34 +807,16 @@ static void xhci_free_tt_info(struct xhci_hcd *xhci, | |||
| 808 | } | 807 | } |
| 809 | 808 | ||
| 810 | tt_list_head = &(xhci->rh_bw[virt_dev->real_port - 1].tts); | 809 | tt_list_head = &(xhci->rh_bw[virt_dev->real_port - 1].tts); |
| 811 | if (list_empty(tt_list_head)) | 810 | list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) { |
| 812 | return; | 811 | /* Multi-TT hubs will have more than one entry */ |
| 813 | 812 | if (tt_info->slot_id == slot_id) { | |
| 814 | list_for_each(tt, tt_list_head) { | 813 | slot_found = true; |
| 815 | tt_info = list_entry(tt, struct xhci_tt_bw_info, tt_list); | 814 | list_del(&tt_info->tt_list); |
| 816 | if (tt_info->slot_id == slot_id) | 815 | kfree(tt_info); |
| 816 | } else if (slot_found) { | ||
| 817 | break; | 817 | break; |
| 818 | } | ||
| 818 | } | 819 | } |
| 819 | /* Cautionary measure in case the hub was disconnected before we | ||
| 820 | * stored the TT information. | ||
| 821 | */ | ||
| 822 | if (tt_info->slot_id != slot_id) | ||
| 823 | return; | ||
| 824 | |||
| 825 | tt_next = tt->next; | ||
| 826 | tt_info = list_entry(tt, struct xhci_tt_bw_info, | ||
| 827 | tt_list); | ||
| 828 | /* Multi-TT hubs will have more than one entry */ | ||
| 829 | do { | ||
| 830 | list_del(tt); | ||
| 831 | kfree(tt_info); | ||
| 832 | tt = tt_next; | ||
| 833 | if (list_empty(tt_list_head)) | ||
| 834 | break; | ||
| 835 | tt_next = tt->next; | ||
| 836 | tt_info = list_entry(tt, struct xhci_tt_bw_info, | ||
| 837 | tt_list); | ||
| 838 | } while (tt_info->slot_id == slot_id); | ||
| 839 | } | 820 | } |
| 840 | 821 | ||
| 841 | int xhci_alloc_tt_info(struct xhci_hcd *xhci, | 822 | int xhci_alloc_tt_info(struct xhci_hcd *xhci, |
| @@ -1791,17 +1772,9 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
| 1791 | { | 1772 | { |
| 1792 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); | 1773 | struct pci_dev *pdev = to_pci_dev(xhci_to_hcd(xhci)->self.controller); |
| 1793 | struct dev_info *dev_info, *next; | 1774 | struct dev_info *dev_info, *next; |
| 1794 | struct list_head *tt_list_head; | ||
| 1795 | struct list_head *tt; | ||
| 1796 | struct list_head *endpoints; | ||
| 1797 | struct list_head *ep, *q; | ||
| 1798 | struct xhci_tt_bw_info *tt_info; | ||
| 1799 | struct xhci_interval_bw_table *bwt; | ||
| 1800 | struct xhci_virt_ep *virt_ep; | ||
| 1801 | |||
| 1802 | unsigned long flags; | 1775 | unsigned long flags; |
| 1803 | int size; | 1776 | int size; |
| 1804 | int i; | 1777 | int i, j, num_ports; |
| 1805 | 1778 | ||
| 1806 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 1779 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
| 1807 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 1780 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
| @@ -1860,21 +1833,22 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
| 1860 | } | 1833 | } |
| 1861 | spin_unlock_irqrestore(&xhci->lock, flags); | 1834 | spin_unlock_irqrestore(&xhci->lock, flags); |
| 1862 | 1835 | ||
| 1863 | bwt = &xhci->rh_bw->bw_table; | 1836 | num_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
| 1864 | for (i = 0; i < XHCI_MAX_INTERVAL; i++) { | 1837 | for (i = 0; i < num_ports; i++) { |
| 1865 | endpoints = &bwt->interval_bw[i].endpoints; | 1838 | struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table; |
| 1866 | list_for_each_safe(ep, q, endpoints) { | 1839 | for (j = 0; j < XHCI_MAX_INTERVAL; j++) { |
| 1867 | virt_ep = list_entry(ep, struct xhci_virt_ep, bw_endpoint_list); | 1840 | struct list_head *ep = &bwt->interval_bw[j].endpoints; |
| 1868 | list_del(&virt_ep->bw_endpoint_list); | 1841 | while (!list_empty(ep)) |
| 1869 | kfree(virt_ep); | 1842 | list_del_init(ep->next); |
| 1870 | } | 1843 | } |
| 1871 | } | 1844 | } |
| 1872 | 1845 | ||
| 1873 | tt_list_head = &xhci->rh_bw->tts; | 1846 | for (i = 0; i < num_ports; i++) { |
| 1874 | list_for_each_safe(tt, q, tt_list_head) { | 1847 | struct xhci_tt_bw_info *tt, *n; |
| 1875 | tt_info = list_entry(tt, struct xhci_tt_bw_info, tt_list); | 1848 | list_for_each_entry_safe(tt, n, &xhci->rh_bw[i].tts, tt_list) { |
| 1876 | list_del(tt); | 1849 | list_del(&tt->tt_list); |
| 1877 | kfree(tt_info); | 1850 | kfree(tt); |
| 1851 | } | ||
| 1878 | } | 1852 | } |
| 1879 | 1853 | ||
| 1880 | xhci->num_usb2_ports = 0; | 1854 | xhci->num_usb2_ports = 0; |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 23b4aefd1036..8275645889da 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
| @@ -885,6 +885,17 @@ static void update_ring_for_set_deq_completion(struct xhci_hcd *xhci, | |||
| 885 | num_trbs_free_temp = ep_ring->num_trbs_free; | 885 | num_trbs_free_temp = ep_ring->num_trbs_free; |
| 886 | dequeue_temp = ep_ring->dequeue; | 886 | dequeue_temp = ep_ring->dequeue; |
| 887 | 887 | ||
| 888 | /* If we get two back-to-back stalls, and the first stalled transfer | ||
| 889 | * ends just before a link TRB, the dequeue pointer will be left on | ||
| 890 | * the link TRB by the code in the while loop. So we have to update | ||
| 891 | * the dequeue pointer one segment further, or we'll jump off | ||
| 892 | * the segment into la-la-land. | ||
| 893 | */ | ||
| 894 | if (last_trb(xhci, ep_ring, ep_ring->deq_seg, ep_ring->dequeue)) { | ||
| 895 | ep_ring->deq_seg = ep_ring->deq_seg->next; | ||
| 896 | ep_ring->dequeue = ep_ring->deq_seg->trbs; | ||
| 897 | } | ||
| 898 | |||
| 888 | while (ep_ring->dequeue != dev->eps[ep_index].queued_deq_ptr) { | 899 | while (ep_ring->dequeue != dev->eps[ep_index].queued_deq_ptr) { |
| 889 | /* We have more usable TRBs */ | 900 | /* We have more usable TRBs */ |
| 890 | ep_ring->num_trbs_free++; | 901 | ep_ring->num_trbs_free++; |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index afdc73ee84a6..a979cd0dbe0f 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -795,8 +795,8 @@ int xhci_suspend(struct xhci_hcd *xhci) | |||
| 795 | command = xhci_readl(xhci, &xhci->op_regs->command); | 795 | command = xhci_readl(xhci, &xhci->op_regs->command); |
| 796 | command |= CMD_CSS; | 796 | command |= CMD_CSS; |
| 797 | xhci_writel(xhci, command, &xhci->op_regs->command); | 797 | xhci_writel(xhci, command, &xhci->op_regs->command); |
| 798 | if (handshake(xhci, &xhci->op_regs->status, STS_SAVE, 0, 10*100)) { | 798 | if (handshake(xhci, &xhci->op_regs->status, STS_SAVE, 0, 10 * 1000)) { |
| 799 | xhci_warn(xhci, "WARN: xHC CMD_CSS timeout\n"); | 799 | xhci_warn(xhci, "WARN: xHC save state timeout\n"); |
| 800 | spin_unlock_irq(&xhci->lock); | 800 | spin_unlock_irq(&xhci->lock); |
| 801 | return -ETIMEDOUT; | 801 | return -ETIMEDOUT; |
| 802 | } | 802 | } |
| @@ -848,8 +848,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
| 848 | command |= CMD_CRS; | 848 | command |= CMD_CRS; |
| 849 | xhci_writel(xhci, command, &xhci->op_regs->command); | 849 | xhci_writel(xhci, command, &xhci->op_regs->command); |
| 850 | if (handshake(xhci, &xhci->op_regs->status, | 850 | if (handshake(xhci, &xhci->op_regs->status, |
| 851 | STS_RESTORE, 0, 10*100)) { | 851 | STS_RESTORE, 0, 10 * 1000)) { |
| 852 | xhci_dbg(xhci, "WARN: xHC CMD_CSS timeout\n"); | 852 | xhci_warn(xhci, "WARN: xHC restore state timeout\n"); |
| 853 | spin_unlock_irq(&xhci->lock); | 853 | spin_unlock_irq(&xhci->lock); |
| 854 | return -ETIMEDOUT; | 854 | return -ETIMEDOUT; |
| 855 | } | 855 | } |
| @@ -3906,7 +3906,7 @@ static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev, | |||
| 3906 | default: | 3906 | default: |
| 3907 | dev_warn(&udev->dev, "%s: Can't get timeout for non-U1 or U2 state.\n", | 3907 | dev_warn(&udev->dev, "%s: Can't get timeout for non-U1 or U2 state.\n", |
| 3908 | __func__); | 3908 | __func__); |
| 3909 | return -EINVAL; | 3909 | return USB3_LPM_DISABLED; |
| 3910 | } | 3910 | } |
| 3911 | 3911 | ||
| 3912 | if (sel <= max_sel_pel && pel <= max_sel_pel) | 3912 | if (sel <= max_sel_pel && pel <= max_sel_pel) |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index de3d6e3e57be..55c0785810c9 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
| @@ -341,7 +341,11 @@ struct xhci_op_regs { | |||
| 341 | #define PORT_PLC (1 << 22) | 341 | #define PORT_PLC (1 << 22) |
| 342 | /* port configure error change - port failed to configure its link partner */ | 342 | /* port configure error change - port failed to configure its link partner */ |
| 343 | #define PORT_CEC (1 << 23) | 343 | #define PORT_CEC (1 << 23) |
| 344 | /* bit 24 reserved */ | 344 | /* Cold Attach Status - xHC can set this bit to report device attached during |
| 345 | * Sx state. Warm port reset should be perfomed to clear this bit and move port | ||
| 346 | * to connected state. | ||
| 347 | */ | ||
| 348 | #define PORT_CAS (1 << 24) | ||
| 345 | /* wake on connect (enable) */ | 349 | /* wake on connect (enable) */ |
| 346 | #define PORT_WKCONN_E (1 << 25) | 350 | #define PORT_WKCONN_E (1 << 25) |
| 347 | /* wake on disconnect (enable) */ | 351 | /* wake on disconnect (enable) */ |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 768b4b55c816..9d63ba4d10d6 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include <linux/dma-mapping.h> | 34 | #include <linux/dma-mapping.h> |
| 35 | 35 | ||
| 36 | #include <mach/cputype.h> | 36 | #include <mach/cputype.h> |
| 37 | #include <mach/hardware.h> | ||
| 37 | 38 | ||
| 38 | #include <asm/mach-types.h> | 39 | #include <asm/mach-types.h> |
| 39 | 40 | ||
diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h index 046c84433cad..371baa0ee509 100644 --- a/drivers/usb/musb/davinci.h +++ b/drivers/usb/musb/davinci.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | /* Integrated highspeed/otg PHY */ | 17 | /* Integrated highspeed/otg PHY */ |
| 18 | #define USBPHY_CTL_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x34) | 18 | #define USBPHY_CTL_PADDR 0x01c40034 |
| 19 | #define USBPHY_DATAPOL BIT(11) /* (dm355) switch D+/D- */ | 19 | #define USBPHY_DATAPOL BIT(11) /* (dm355) switch D+/D- */ |
| 20 | #define USBPHY_PHYCLKGD BIT(8) | 20 | #define USBPHY_PHYCLKGD BIT(8) |
| 21 | #define USBPHY_SESNDEN BIT(7) /* v(sess_end) comparator */ | 21 | #define USBPHY_SESNDEN BIT(7) /* v(sess_end) comparator */ |
| @@ -27,7 +27,7 @@ | |||
| 27 | #define USBPHY_OTGPDWN BIT(1) | 27 | #define USBPHY_OTGPDWN BIT(1) |
| 28 | #define USBPHY_PHYPDWN BIT(0) | 28 | #define USBPHY_PHYPDWN BIT(0) |
| 29 | 29 | ||
| 30 | #define DM355_DEEPSLEEP_PADDR (DAVINCI_SYSTEM_MODULE_BASE + 0x48) | 30 | #define DM355_DEEPSLEEP_PADDR 0x01c40048 |
| 31 | #define DRVVBUS_FORCE BIT(2) | 31 | #define DRVVBUS_FORCE BIT(2) |
| 32 | #define DRVVBUS_OVERRIDE BIT(1) | 32 | #define DRVVBUS_OVERRIDE BIT(1) |
| 33 | 33 | ||
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index f42c29b11f71..95918dacc99a 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -1232,6 +1232,7 @@ static int musb_gadget_disable(struct usb_ep *ep) | |||
| 1232 | } | 1232 | } |
| 1233 | 1233 | ||
| 1234 | musb_ep->desc = NULL; | 1234 | musb_ep->desc = NULL; |
| 1235 | musb_ep->end_point.desc = NULL; | ||
| 1235 | 1236 | ||
| 1236 | /* abort all pending DMA and requests */ | 1237 | /* abort all pending DMA and requests */ |
| 1237 | nuke(musb_ep, -ESHUTDOWN); | 1238 | nuke(musb_ep, -ESHUTDOWN); |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index ef8d744800ac..e090c799d87b 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
| @@ -375,11 +375,21 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, | |||
| 375 | */ | 375 | */ |
| 376 | if (list_empty(&qh->hep->urb_list)) { | 376 | if (list_empty(&qh->hep->urb_list)) { |
| 377 | struct list_head *head; | 377 | struct list_head *head; |
| 378 | struct dma_controller *dma = musb->dma_controller; | ||
| 378 | 379 | ||
| 379 | if (is_in) | 380 | if (is_in) { |
| 380 | ep->rx_reinit = 1; | 381 | ep->rx_reinit = 1; |
| 381 | else | 382 | if (ep->rx_channel) { |
| 383 | dma->channel_release(ep->rx_channel); | ||
| 384 | ep->rx_channel = NULL; | ||
| 385 | } | ||
| 386 | } else { | ||
| 382 | ep->tx_reinit = 1; | 387 | ep->tx_reinit = 1; |
| 388 | if (ep->tx_channel) { | ||
| 389 | dma->channel_release(ep->tx_channel); | ||
| 390 | ep->tx_channel = NULL; | ||
| 391 | } | ||
| 392 | } | ||
| 383 | 393 | ||
| 384 | /* Clobber old pointers to this qh */ | 394 | /* Clobber old pointers to this qh */ |
| 385 | musb_ep_set_qh(ep, is_in, NULL); | 395 | musb_ep_set_qh(ep, is_in, NULL); |
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c index d2a9a8e691b9..0eabb049b6a9 100644 --- a/drivers/usb/otg/twl6030-usb.c +++ b/drivers/usb/otg/twl6030-usb.c | |||
| @@ -305,9 +305,8 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
| 305 | 305 | ||
| 306 | regulator_enable(twl->usb3v3); | 306 | regulator_enable(twl->usb3v3); |
| 307 | twl->asleep = 1; | 307 | twl->asleep = 1; |
| 308 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, 0x1); | 308 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_CLR); |
| 309 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, | 309 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_SET); |
| 310 | 0x10); | ||
| 311 | status = USB_EVENT_ID; | 310 | status = USB_EVENT_ID; |
| 312 | otg->default_a = true; | 311 | otg->default_a = true; |
| 313 | twl->phy.state = OTG_STATE_A_IDLE; | 312 | twl->phy.state = OTG_STATE_A_IDLE; |
| @@ -316,12 +315,10 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
| 316 | atomic_notifier_call_chain(&twl->phy.notifier, status, | 315 | atomic_notifier_call_chain(&twl->phy.notifier, status, |
| 317 | otg->gadget); | 316 | otg->gadget); |
| 318 | } else { | 317 | } else { |
| 319 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, | 318 | twl6030_writeb(twl, TWL_MODULE_USB, 0x10, USB_ID_INT_EN_HI_CLR); |
| 320 | 0x10); | 319 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); |
| 321 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, | ||
| 322 | 0x1); | ||
| 323 | } | 320 | } |
| 324 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_LATCH_CLR, status); | 321 | twl6030_writeb(twl, TWL_MODULE_USB, status, USB_ID_INT_LATCH_CLR); |
| 325 | 322 | ||
| 326 | return IRQ_HANDLED; | 323 | return IRQ_HANDLED; |
| 327 | } | 324 | } |
| @@ -343,7 +340,7 @@ static int twl6030_enable_irq(struct usb_phy *x) | |||
| 343 | { | 340 | { |
| 344 | struct twl6030_usb *twl = phy_to_twl(x); | 341 | struct twl6030_usb *twl = phy_to_twl(x); |
| 345 | 342 | ||
| 346 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, 0x1); | 343 | twl6030_writeb(twl, TWL_MODULE_USB, 0x1, USB_ID_INT_EN_HI_SET); |
| 347 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); | 344 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); |
| 348 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C); | 345 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_STS_C); |
| 349 | 346 | ||
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 3cfabcba7447..e7cf84f0751a 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig | |||
| @@ -2,11 +2,11 @@ | |||
| 2 | # Physical Layer USB driver configuration | 2 | # Physical Layer USB driver configuration |
| 3 | # | 3 | # |
| 4 | comment "USB Physical Layer drivers" | 4 | comment "USB Physical Layer drivers" |
| 5 | depends on USB | 5 | depends on USB || USB_GADGET |
| 6 | 6 | ||
| 7 | config USB_ISP1301 | 7 | config USB_ISP1301 |
| 8 | tristate "NXP ISP1301 USB transceiver support" | 8 | tristate "NXP ISP1301 USB transceiver support" |
| 9 | depends on USB | 9 | depends on USB || USB_GADGET |
| 10 | depends on I2C | 10 | depends on I2C |
| 11 | help | 11 | help |
| 12 | Say Y here to add support for the NXP ISP1301 USB transceiver driver. | 12 | Say Y here to add support for the NXP ISP1301 USB transceiver driver. |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 1b1926200ba7..1e71079ce33b 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
| @@ -82,6 +82,7 @@ static const struct usb_device_id id_table[] = { | |||
| 82 | { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */ | 82 | { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */ |
| 83 | { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */ | 83 | { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */ |
| 84 | { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */ | 84 | { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */ |
| 85 | { USB_DEVICE(0x10C4, 0x80C4) }, /* Cygnal Integrated Products, Inc., Optris infrared thermometer */ | ||
| 85 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ | 86 | { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ |
| 86 | { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */ | 87 | { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */ |
| 87 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ | 88 | { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ |
| @@ -92,6 +93,7 @@ static const struct usb_device_id id_table[] = { | |||
| 92 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ | 93 | { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ |
| 93 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ | 94 | { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */ |
| 94 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ | 95 | { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ |
| 96 | { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */ | ||
| 95 | { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ | 97 | { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */ |
| 96 | { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ | 98 | { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ |
| 97 | { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */ | 99 | { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */ |
| @@ -133,7 +135,13 @@ static const struct usb_device_id id_table[] = { | |||
| 133 | { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ | 135 | { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ |
| 134 | { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ | 136 | { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ |
| 135 | { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ | 137 | { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ |
| 138 | { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */ | ||
| 139 | { USB_DEVICE(0x166A, 0x0301) }, /* Clipsal 5800PC C-Bus Wireless PC Interface */ | ||
| 136 | { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ | 140 | { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ |
| 141 | { USB_DEVICE(0x166A, 0x0304) }, /* Clipsal 5000CT2 C-Bus Black and White Touchscreen */ | ||
| 142 | { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum Colour Touchscreen */ | ||
| 143 | { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural Dimmer */ | ||
| 144 | { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room Audio Matrix Switcher */ | ||
| 137 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ | 145 | { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ |
| 138 | { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ | 146 | { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */ |
| 139 | { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ | 147 | { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */ |
| @@ -145,7 +153,11 @@ static const struct usb_device_id id_table[] = { | |||
| 145 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ | 153 | { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ |
| 146 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | 154 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ |
| 147 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | 155 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ |
| 156 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ | ||
| 157 | { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */ | ||
| 148 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ | 158 | { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ |
| 159 | { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ | ||
| 160 | { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ | ||
| 149 | { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ | 161 | { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ |
| 150 | { } /* Terminating Entry */ | 162 | { } /* Terminating Entry */ |
| 151 | }; | 163 | }; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8c084ea34e26..bc912e5a3beb 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
| @@ -737,6 +737,7 @@ static struct usb_device_id id_table_combined [] = { | |||
| 737 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 737 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
| 738 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, | 738 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, |
| 739 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, | 739 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, |
| 740 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_RTS01_PID) }, | ||
| 740 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 741 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
| 741 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 742 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
| 742 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, | 743 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index f3c7c78ede33..5661c7e2d415 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
| @@ -784,6 +784,7 @@ | |||
| 784 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ | 784 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
| 785 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ | 785 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ |
| 786 | #define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */ | 786 | #define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */ |
| 787 | #define RTSYSTEMS_RTS01_PID 0x9e57 /* USB-RTS01 Radio Cable */ | ||
| 787 | 788 | ||
| 788 | 789 | ||
| 789 | /* | 790 | /* |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 105a6d898ca4..9b026bf7afef 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
| @@ -39,13 +39,6 @@ MODULE_PARM_DESC(product, "User specified USB idProduct"); | |||
| 39 | 39 | ||
| 40 | static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */ | 40 | static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */ |
| 41 | 41 | ||
| 42 | /* we want to look at all devices, as the vendor/product id can change | ||
| 43 | * depending on the command line argument */ | ||
| 44 | static const struct usb_device_id generic_serial_ids[] = { | ||
| 45 | {.driver_info = 42}, | ||
| 46 | {} | ||
| 47 | }; | ||
| 48 | |||
| 49 | /* All of the device info needed for the Generic Serial Converter */ | 42 | /* All of the device info needed for the Generic Serial Converter */ |
| 50 | struct usb_serial_driver usb_serial_generic_device = { | 43 | struct usb_serial_driver usb_serial_generic_device = { |
| 51 | .driver = { | 44 | .driver = { |
| @@ -79,7 +72,8 @@ int usb_serial_generic_register(int _debug) | |||
| 79 | USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT; | 72 | USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT; |
| 80 | 73 | ||
| 81 | /* register our generic driver with ourselves */ | 74 | /* register our generic driver with ourselves */ |
| 82 | retval = usb_serial_register_drivers(serial_drivers, "usbserial_generic", generic_serial_ids); | 75 | retval = usb_serial_register_drivers(serial_drivers, |
| 76 | "usbserial_generic", generic_device_ids); | ||
| 83 | #endif | 77 | #endif |
| 84 | return retval; | 78 | return retval; |
| 85 | } | 79 | } |
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index d0ec1aa52719..a71fa0aa0406 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
| @@ -309,13 +309,16 @@ static int mct_u232_set_modem_ctrl(struct usb_serial *serial, | |||
| 309 | MCT_U232_SET_REQUEST_TYPE, | 309 | MCT_U232_SET_REQUEST_TYPE, |
| 310 | 0, 0, buf, MCT_U232_SET_MODEM_CTRL_SIZE, | 310 | 0, 0, buf, MCT_U232_SET_MODEM_CTRL_SIZE, |
| 311 | WDR_TIMEOUT); | 311 | WDR_TIMEOUT); |
| 312 | if (rc < 0) | 312 | kfree(buf); |
| 313 | dev_err(&serial->dev->dev, | 313 | |
| 314 | "Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc); | ||
| 315 | dbg("set_modem_ctrl: state=0x%x ==> mcr=0x%x", control_state, mcr); | 314 | dbg("set_modem_ctrl: state=0x%x ==> mcr=0x%x", control_state, mcr); |
| 316 | 315 | ||
| 317 | kfree(buf); | 316 | if (rc < 0) { |
| 318 | return rc; | 317 | dev_err(&serial->dev->dev, |
| 318 | "Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc); | ||
| 319 | return rc; | ||
| 320 | } | ||
| 321 | return 0; | ||
| 319 | } /* mct_u232_set_modem_ctrl */ | 322 | } /* mct_u232_set_modem_ctrl */ |
| 320 | 323 | ||
| 321 | static int mct_u232_get_modem_stat(struct usb_serial *serial, | 324 | static int mct_u232_get_modem_stat(struct usb_serial *serial, |
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 81423f7361db..d47eb06fe463 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
| @@ -222,14 +222,6 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
| 222 | metro_priv->throttled = 0; | 222 | metro_priv->throttled = 0; |
| 223 | spin_unlock_irqrestore(&metro_priv->lock, flags); | 223 | spin_unlock_irqrestore(&metro_priv->lock, flags); |
| 224 | 224 | ||
| 225 | /* | ||
| 226 | * Force low_latency on so that our tty_push actually forces the data | ||
| 227 | * through, otherwise it is scheduled, and with high data rates (like | ||
| 228 | * with OHCI) data can get lost. | ||
| 229 | */ | ||
| 230 | if (tty) | ||
| 231 | tty->low_latency = 1; | ||
| 232 | |||
| 233 | /* Clear the urb pipe. */ | 225 | /* Clear the urb pipe. */ |
| 234 | usb_clear_halt(serial->dev, port->interrupt_in_urb->pipe); | 226 | usb_clear_halt(serial->dev, port->interrupt_in_urb->pipe); |
| 235 | 227 | ||
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 29160f8b5101..57eca2448424 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
| @@ -190,7 +190,7 @@ | |||
| 190 | 190 | ||
| 191 | static int device_type; | 191 | static int device_type; |
| 192 | 192 | ||
| 193 | static const struct usb_device_id id_table[] __devinitconst = { | 193 | static const struct usb_device_id id_table[] = { |
| 194 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, | 194 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)}, |
| 195 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, | 195 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, |
| 196 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7810)}, | 196 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7810)}, |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 1aae9028cd0b..417ab1b0aa30 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | /* Function prototypes */ | 47 | /* Function prototypes */ |
| 48 | static int option_probe(struct usb_serial *serial, | 48 | static int option_probe(struct usb_serial *serial, |
| 49 | const struct usb_device_id *id); | 49 | const struct usb_device_id *id); |
| 50 | static void option_release(struct usb_serial *serial); | ||
| 50 | static int option_send_setup(struct usb_serial_port *port); | 51 | static int option_send_setup(struct usb_serial_port *port); |
| 51 | static void option_instat_callback(struct urb *urb); | 52 | static void option_instat_callback(struct urb *urb); |
| 52 | 53 | ||
| @@ -150,6 +151,7 @@ static void option_instat_callback(struct urb *urb); | |||
| 150 | #define HUAWEI_PRODUCT_E14AC 0x14AC | 151 | #define HUAWEI_PRODUCT_E14AC 0x14AC |
| 151 | #define HUAWEI_PRODUCT_K3806 0x14AE | 152 | #define HUAWEI_PRODUCT_K3806 0x14AE |
| 152 | #define HUAWEI_PRODUCT_K4605 0x14C6 | 153 | #define HUAWEI_PRODUCT_K4605 0x14C6 |
| 154 | #define HUAWEI_PRODUCT_K5005 0x14C8 | ||
| 153 | #define HUAWEI_PRODUCT_K3770 0x14C9 | 155 | #define HUAWEI_PRODUCT_K3770 0x14C9 |
| 154 | #define HUAWEI_PRODUCT_K3771 0x14CA | 156 | #define HUAWEI_PRODUCT_K3771 0x14CA |
| 155 | #define HUAWEI_PRODUCT_K4510 0x14CB | 157 | #define HUAWEI_PRODUCT_K4510 0x14CB |
| @@ -234,6 +236,7 @@ static void option_instat_callback(struct urb *urb); | |||
| 234 | #define NOVATELWIRELESS_PRODUCT_G1 0xA001 | 236 | #define NOVATELWIRELESS_PRODUCT_G1 0xA001 |
| 235 | #define NOVATELWIRELESS_PRODUCT_G1_M 0xA002 | 237 | #define NOVATELWIRELESS_PRODUCT_G1_M 0xA002 |
| 236 | #define NOVATELWIRELESS_PRODUCT_G2 0xA010 | 238 | #define NOVATELWIRELESS_PRODUCT_G2 0xA010 |
| 239 | #define NOVATELWIRELESS_PRODUCT_MC551 0xB001 | ||
| 237 | 240 | ||
| 238 | /* AMOI PRODUCTS */ | 241 | /* AMOI PRODUCTS */ |
| 239 | #define AMOI_VENDOR_ID 0x1614 | 242 | #define AMOI_VENDOR_ID 0x1614 |
| @@ -425,7 +428,7 @@ static void option_instat_callback(struct urb *urb); | |||
| 425 | #define SAMSUNG_VENDOR_ID 0x04e8 | 428 | #define SAMSUNG_VENDOR_ID 0x04e8 |
| 426 | #define SAMSUNG_PRODUCT_GT_B3730 0x6889 | 429 | #define SAMSUNG_PRODUCT_GT_B3730 0x6889 |
| 427 | 430 | ||
| 428 | /* YUGA products www.yuga-info.com*/ | 431 | /* YUGA products www.yuga-info.com gavin.kx@qq.com */ |
| 429 | #define YUGA_VENDOR_ID 0x257A | 432 | #define YUGA_VENDOR_ID 0x257A |
| 430 | #define YUGA_PRODUCT_CEM600 0x1601 | 433 | #define YUGA_PRODUCT_CEM600 0x1601 |
| 431 | #define YUGA_PRODUCT_CEM610 0x1602 | 434 | #define YUGA_PRODUCT_CEM610 0x1602 |
| @@ -442,6 +445,8 @@ static void option_instat_callback(struct urb *urb); | |||
| 442 | #define YUGA_PRODUCT_CEU516 0x160C | 445 | #define YUGA_PRODUCT_CEU516 0x160C |
| 443 | #define YUGA_PRODUCT_CEU528 0x160D | 446 | #define YUGA_PRODUCT_CEU528 0x160D |
| 444 | #define YUGA_PRODUCT_CEU526 0x160F | 447 | #define YUGA_PRODUCT_CEU526 0x160F |
| 448 | #define YUGA_PRODUCT_CEU881 0x161F | ||
| 449 | #define YUGA_PRODUCT_CEU882 0x162F | ||
| 445 | 450 | ||
| 446 | #define YUGA_PRODUCT_CWM600 0x2601 | 451 | #define YUGA_PRODUCT_CWM600 0x2601 |
| 447 | #define YUGA_PRODUCT_CWM610 0x2602 | 452 | #define YUGA_PRODUCT_CWM610 0x2602 |
| @@ -457,23 +462,26 @@ static void option_instat_callback(struct urb *urb); | |||
| 457 | #define YUGA_PRODUCT_CWU518 0x260B | 462 | #define YUGA_PRODUCT_CWU518 0x260B |
| 458 | #define YUGA_PRODUCT_CWU516 0x260C | 463 | #define YUGA_PRODUCT_CWU516 0x260C |
| 459 | #define YUGA_PRODUCT_CWU528 0x260D | 464 | #define YUGA_PRODUCT_CWU528 0x260D |
| 465 | #define YUGA_PRODUCT_CWU581 0x260E | ||
| 460 | #define YUGA_PRODUCT_CWU526 0x260F | 466 | #define YUGA_PRODUCT_CWU526 0x260F |
| 461 | 467 | #define YUGA_PRODUCT_CWU582 0x261F | |
| 462 | #define YUGA_PRODUCT_CLM600 0x2601 | 468 | #define YUGA_PRODUCT_CWU583 0x262F |
| 463 | #define YUGA_PRODUCT_CLM610 0x2602 | 469 | |
| 464 | #define YUGA_PRODUCT_CLM500 0x2603 | 470 | #define YUGA_PRODUCT_CLM600 0x3601 |
| 465 | #define YUGA_PRODUCT_CLM510 0x2604 | 471 | #define YUGA_PRODUCT_CLM610 0x3602 |
| 466 | #define YUGA_PRODUCT_CLM800 0x2605 | 472 | #define YUGA_PRODUCT_CLM500 0x3603 |
| 467 | #define YUGA_PRODUCT_CLM900 0x2606 | 473 | #define YUGA_PRODUCT_CLM510 0x3604 |
| 468 | 474 | #define YUGA_PRODUCT_CLM800 0x3605 | |
| 469 | #define YUGA_PRODUCT_CLU718 0x2607 | 475 | #define YUGA_PRODUCT_CLM900 0x3606 |
| 470 | #define YUGA_PRODUCT_CLU716 0x2608 | 476 | |
| 471 | #define YUGA_PRODUCT_CLU728 0x2609 | 477 | #define YUGA_PRODUCT_CLU718 0x3607 |
| 472 | #define YUGA_PRODUCT_CLU726 0x260A | 478 | #define YUGA_PRODUCT_CLU716 0x3608 |
| 473 | #define YUGA_PRODUCT_CLU518 0x260B | 479 | #define YUGA_PRODUCT_CLU728 0x3609 |
| 474 | #define YUGA_PRODUCT_CLU516 0x260C | 480 | #define YUGA_PRODUCT_CLU726 0x360A |
| 475 | #define YUGA_PRODUCT_CLU528 0x260D | 481 | #define YUGA_PRODUCT_CLU518 0x360B |
| 476 | #define YUGA_PRODUCT_CLU526 0x260F | 482 | #define YUGA_PRODUCT_CLU516 0x360C |
| 483 | #define YUGA_PRODUCT_CLU528 0x360D | ||
| 484 | #define YUGA_PRODUCT_CLU526 0x360F | ||
| 477 | 485 | ||
| 478 | /* Viettel products */ | 486 | /* Viettel products */ |
| 479 | #define VIETTEL_VENDOR_ID 0x2262 | 487 | #define VIETTEL_VENDOR_ID 0x2262 |
| @@ -489,6 +497,19 @@ static void option_instat_callback(struct urb *urb); | |||
| 489 | 497 | ||
| 490 | /* MediaTek products */ | 498 | /* MediaTek products */ |
| 491 | #define MEDIATEK_VENDOR_ID 0x0e8d | 499 | #define MEDIATEK_VENDOR_ID 0x0e8d |
| 500 | #define MEDIATEK_PRODUCT_DC_1COM 0x00a0 | ||
| 501 | #define MEDIATEK_PRODUCT_DC_4COM 0x00a5 | ||
| 502 | #define MEDIATEK_PRODUCT_DC_5COM 0x00a4 | ||
| 503 | #define MEDIATEK_PRODUCT_7208_1COM 0x7101 | ||
| 504 | #define MEDIATEK_PRODUCT_7208_2COM 0x7102 | ||
| 505 | #define MEDIATEK_PRODUCT_FP_1COM 0x0003 | ||
| 506 | #define MEDIATEK_PRODUCT_FP_2COM 0x0023 | ||
| 507 | #define MEDIATEK_PRODUCT_FPDC_1COM 0x0043 | ||
| 508 | #define MEDIATEK_PRODUCT_FPDC_2COM 0x0033 | ||
| 509 | |||
| 510 | /* Cellient products */ | ||
| 511 | #define CELLIENT_VENDOR_ID 0x2692 | ||
| 512 | #define CELLIENT_PRODUCT_MEN200 0x9005 | ||
| 492 | 513 | ||
| 493 | /* some devices interfaces need special handling due to a number of reasons */ | 514 | /* some devices interfaces need special handling due to a number of reasons */ |
| 494 | enum option_blacklist_reason { | 515 | enum option_blacklist_reason { |
| @@ -542,6 +563,10 @@ static const struct option_blacklist_info net_intf1_blacklist = { | |||
| 542 | .reserved = BIT(1), | 563 | .reserved = BIT(1), |
| 543 | }; | 564 | }; |
| 544 | 565 | ||
| 566 | static const struct option_blacklist_info net_intf2_blacklist = { | ||
| 567 | .reserved = BIT(2), | ||
| 568 | }; | ||
| 569 | |||
| 545 | static const struct option_blacklist_info net_intf3_blacklist = { | 570 | static const struct option_blacklist_info net_intf3_blacklist = { |
| 546 | .reserved = BIT(3), | 571 | .reserved = BIT(3), |
| 547 | }; | 572 | }; |
| @@ -666,6 +691,11 @@ static const struct usb_device_id option_ids[] = { | |||
| 666 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3806, 0xff, 0xff, 0xff) }, | 691 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3806, 0xff, 0xff, 0xff) }, |
| 667 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), | 692 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), |
| 668 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, | 693 | .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, |
| 694 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0x01, 0x31) }, | ||
| 695 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0x01, 0x32) }, | ||
| 696 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x31) }, | ||
| 697 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x32) }, | ||
| 698 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x33) }, | ||
| 669 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) }, | 699 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) }, |
| 670 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) }, | 700 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) }, |
| 671 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) }, | 701 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) }, |
| @@ -722,6 +752,8 @@ static const struct usb_device_id option_ids[] = { | |||
| 722 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) }, | 752 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) }, |
| 723 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) }, | 753 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) }, |
| 724 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) }, | 754 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) }, |
| 755 | /* Novatel Ovation MC551 a.k.a. Verizon USB551L */ | ||
| 756 | { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) }, | ||
| 725 | 757 | ||
| 726 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, | 758 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) }, |
| 727 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, | 759 | { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) }, |
| @@ -1080,6 +1112,8 @@ static const struct usb_device_id option_ids[] = { | |||
| 1080 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, | 1112 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, |
| 1081 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, | 1113 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, |
| 1082 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, | 1114 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, |
| 1115 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff), | ||
| 1116 | .driver_info = (kernel_ulong_t)&net_intf2_blacklist }, | ||
| 1083 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, | 1117 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, |
| 1084 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, | 1118 | 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist }, |
| 1085 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, | 1119 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) }, |
| @@ -1209,6 +1243,11 @@ static const struct usb_device_id option_ids[] = { | |||
| 1209 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) }, | 1243 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU516) }, |
| 1210 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) }, | 1244 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) }, |
| 1211 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) }, | 1245 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) }, |
| 1246 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU881) }, | ||
| 1247 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEU882) }, | ||
| 1248 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU581) }, | ||
| 1249 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU582) }, | ||
| 1250 | { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CWU583) }, | ||
| 1212 | { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) }, | 1251 | { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) }, |
| 1213 | { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) }, | 1252 | { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) }, |
| 1214 | { USB_DEVICE(LG_VENDOR_ID, LG_PRODUCT_L02C) }, /* docomo L-02C modem */ | 1253 | { USB_DEVICE(LG_VENDOR_ID, LG_PRODUCT_L02C) }, /* docomo L-02C modem */ |
| @@ -1216,6 +1255,18 @@ static const struct usb_device_id option_ids[] = { | |||
| 1216 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) }, | 1255 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) }, |
| 1217 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) }, | 1256 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) }, |
| 1218 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */ | 1257 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */ |
| 1258 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_1COM, 0x0a, 0x00, 0x00) }, | ||
| 1259 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_5COM, 0xff, 0x02, 0x01) }, | ||
| 1260 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_5COM, 0xff, 0x00, 0x00) }, | ||
| 1261 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM, 0xff, 0x02, 0x01) }, | ||
| 1262 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM, 0xff, 0x00, 0x00) }, | ||
| 1263 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7208_1COM, 0x02, 0x00, 0x00) }, | ||
| 1264 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7208_2COM, 0x02, 0x02, 0x01) }, | ||
| 1265 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_1COM, 0x0a, 0x00, 0x00) }, | ||
| 1266 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) }, | ||
| 1267 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) }, | ||
| 1268 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) }, | ||
| 1269 | { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, | ||
| 1219 | { } /* Terminating entry */ | 1270 | { } /* Terminating entry */ |
| 1220 | }; | 1271 | }; |
| 1221 | MODULE_DEVICE_TABLE(usb, option_ids); | 1272 | MODULE_DEVICE_TABLE(usb, option_ids); |
| @@ -1245,7 +1296,7 @@ static struct usb_serial_driver option_1port_device = { | |||
| 1245 | .ioctl = usb_wwan_ioctl, | 1296 | .ioctl = usb_wwan_ioctl, |
| 1246 | .attach = usb_wwan_startup, | 1297 | .attach = usb_wwan_startup, |
| 1247 | .disconnect = usb_wwan_disconnect, | 1298 | .disconnect = usb_wwan_disconnect, |
| 1248 | .release = usb_wwan_release, | 1299 | .release = option_release, |
| 1249 | .read_int_callback = option_instat_callback, | 1300 | .read_int_callback = option_instat_callback, |
| 1250 | #ifdef CONFIG_PM | 1301 | #ifdef CONFIG_PM |
| 1251 | .suspend = usb_wwan_suspend, | 1302 | .suspend = usb_wwan_suspend, |
| @@ -1259,35 +1310,6 @@ static struct usb_serial_driver * const serial_drivers[] = { | |||
| 1259 | 1310 | ||
| 1260 | static bool debug; | 1311 | static bool debug; |
| 1261 | 1312 | ||
| 1262 | /* per port private data */ | ||
| 1263 | |||
| 1264 | #define N_IN_URB 4 | ||
| 1265 | #define N_OUT_URB 4 | ||
| 1266 | #define IN_BUFLEN 4096 | ||
| 1267 | #define OUT_BUFLEN 4096 | ||
| 1268 | |||
| 1269 | struct option_port_private { | ||
| 1270 | /* Input endpoints and buffer for this port */ | ||
| 1271 | struct urb *in_urbs[N_IN_URB]; | ||
| 1272 | u8 *in_buffer[N_IN_URB]; | ||
| 1273 | /* Output endpoints and buffer for this port */ | ||
| 1274 | struct urb *out_urbs[N_OUT_URB]; | ||
| 1275 | u8 *out_buffer[N_OUT_URB]; | ||
| 1276 | unsigned long out_busy; /* Bit vector of URBs in use */ | ||
| 1277 | int opened; | ||
| 1278 | struct usb_anchor delayed; | ||
| 1279 | |||
| 1280 | /* Settings for the port */ | ||
| 1281 | int rts_state; /* Handshaking pins (outputs) */ | ||
| 1282 | int dtr_state; | ||
| 1283 | int cts_state; /* Handshaking pins (inputs) */ | ||
| 1284 | int dsr_state; | ||
| 1285 | int dcd_state; | ||
| 1286 | int ri_state; | ||
| 1287 | |||
| 1288 | unsigned long tx_start_time[N_OUT_URB]; | ||
| 1289 | }; | ||
| 1290 | |||
| 1291 | module_usb_serial_driver(serial_drivers, option_ids); | 1313 | module_usb_serial_driver(serial_drivers, option_ids); |
| 1292 | 1314 | ||
| 1293 | static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, | 1315 | static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason, |
| @@ -1356,12 +1378,22 @@ static int option_probe(struct usb_serial *serial, | |||
| 1356 | return 0; | 1378 | return 0; |
| 1357 | } | 1379 | } |
| 1358 | 1380 | ||
| 1381 | static void option_release(struct usb_serial *serial) | ||
| 1382 | { | ||
| 1383 | struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); | ||
| 1384 | |||
| 1385 | usb_wwan_release(serial); | ||
| 1386 | |||
| 1387 | kfree(priv); | ||
| 1388 | } | ||
| 1389 | |||
| 1359 | static void option_instat_callback(struct urb *urb) | 1390 | static void option_instat_callback(struct urb *urb) |
| 1360 | { | 1391 | { |
| 1361 | int err; | 1392 | int err; |
| 1362 | int status = urb->status; | 1393 | int status = urb->status; |
| 1363 | struct usb_serial_port *port = urb->context; | 1394 | struct usb_serial_port *port = urb->context; |
| 1364 | struct option_port_private *portdata = usb_get_serial_port_data(port); | 1395 | struct usb_wwan_port_private *portdata = |
| 1396 | usb_get_serial_port_data(port); | ||
| 1365 | 1397 | ||
| 1366 | dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata); | 1398 | dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata); |
| 1367 | 1399 | ||
| @@ -1421,7 +1453,7 @@ static int option_send_setup(struct usb_serial_port *port) | |||
| 1421 | struct usb_serial *serial = port->serial; | 1453 | struct usb_serial *serial = port->serial; |
| 1422 | struct usb_wwan_intf_private *intfdata = | 1454 | struct usb_wwan_intf_private *intfdata = |
| 1423 | (struct usb_wwan_intf_private *) serial->private; | 1455 | (struct usb_wwan_intf_private *) serial->private; |
| 1424 | struct option_port_private *portdata; | 1456 | struct usb_wwan_port_private *portdata; |
| 1425 | int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber; | 1457 | int ifNum = serial->interface->cur_altsetting->desc.bInterfaceNumber; |
| 1426 | int val = 0; | 1458 | int val = 0; |
| 1427 | 1459 | ||
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 0d5fe59ebb9e..996015c5f1ac 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
| @@ -105,7 +105,13 @@ static const struct usb_device_id id_table[] = { | |||
| 105 | {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */ | 105 | {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */ |
| 106 | {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */ | 106 | {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */ |
| 107 | {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ | 107 | {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ |
| 108 | {USB_DEVICE(0x1199, 0x9010)}, /* Sierra Wireless Gobi 3000 QDL */ | ||
| 109 | {USB_DEVICE(0x1199, 0x9012)}, /* Sierra Wireless Gobi 3000 QDL */ | ||
| 108 | {USB_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ | 110 | {USB_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ |
| 111 | {USB_DEVICE(0x1199, 0x9014)}, /* Sierra Wireless Gobi 3000 QDL */ | ||
| 112 | {USB_DEVICE(0x1199, 0x9015)}, /* Sierra Wireless Gobi 3000 Modem device */ | ||
| 113 | {USB_DEVICE(0x1199, 0x9018)}, /* Sierra Wireless Gobi 3000 QDL */ | ||
| 114 | {USB_DEVICE(0x1199, 0x9019)}, /* Sierra Wireless Gobi 3000 Modem device */ | ||
| 109 | {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ | 115 | {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ |
| 110 | {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ | 116 | {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ |
| 111 | { } /* Terminating entry */ | 117 | { } /* Terminating entry */ |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index ba54a0a8235c..d423d36acc04 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
| @@ -294,6 +294,10 @@ static const struct usb_device_id id_table[] = { | |||
| 294 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 294 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
| 295 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 295 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
| 296 | }, | 296 | }, |
| 297 | /* AT&T Direct IP LTE modems */ | ||
| 298 | { USB_DEVICE_AND_INTERFACE_INFO(0x0F3D, 0x68AA, 0xFF, 0xFF, 0xFF), | ||
| 299 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
| 300 | }, | ||
| 297 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ | 301 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ |
| 298 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
| 299 | }, | 303 | }, |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 6a1b609a0d94..27483f91a4a3 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
| @@ -659,12 +659,14 @@ exit: | |||
| 659 | static struct usb_serial_driver *search_serial_device( | 659 | static struct usb_serial_driver *search_serial_device( |
| 660 | struct usb_interface *iface) | 660 | struct usb_interface *iface) |
| 661 | { | 661 | { |
| 662 | const struct usb_device_id *id; | 662 | const struct usb_device_id *id = NULL; |
| 663 | struct usb_serial_driver *drv; | 663 | struct usb_serial_driver *drv; |
| 664 | struct usb_driver *driver = to_usb_driver(iface->dev.driver); | ||
| 664 | 665 | ||
| 665 | /* Check if the usb id matches a known device */ | 666 | /* Check if the usb id matches a known device */ |
| 666 | list_for_each_entry(drv, &usb_serial_driver_list, driver_list) { | 667 | list_for_each_entry(drv, &usb_serial_driver_list, driver_list) { |
| 667 | id = get_iface_id(drv, iface); | 668 | if (drv->usb_driver == driver) |
| 669 | id = get_iface_id(drv, iface); | ||
| 668 | if (id) | 670 | if (id) |
| 669 | return drv; | 671 | return drv; |
| 670 | } | 672 | } |
| @@ -755,7 +757,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
| 755 | 757 | ||
| 756 | if (retval) { | 758 | if (retval) { |
| 757 | dbg("sub driver rejected device"); | 759 | dbg("sub driver rejected device"); |
| 758 | kfree(serial); | 760 | usb_serial_put(serial); |
| 759 | module_put(type->driver.owner); | 761 | module_put(type->driver.owner); |
| 760 | return retval; | 762 | return retval; |
| 761 | } | 763 | } |
| @@ -827,7 +829,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
| 827 | */ | 829 | */ |
| 828 | if (num_bulk_in == 0 || num_bulk_out == 0) { | 830 | if (num_bulk_in == 0 || num_bulk_out == 0) { |
| 829 | dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); | 831 | dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); |
| 830 | kfree(serial); | 832 | usb_serial_put(serial); |
| 831 | module_put(type->driver.owner); | 833 | module_put(type->driver.owner); |
| 832 | return -ENODEV; | 834 | return -ENODEV; |
| 833 | } | 835 | } |
| @@ -841,7 +843,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
| 841 | if (num_ports == 0) { | 843 | if (num_ports == 0) { |
| 842 | dev_err(&interface->dev, | 844 | dev_err(&interface->dev, |
| 843 | "Generic device with no bulk out, not allowed.\n"); | 845 | "Generic device with no bulk out, not allowed.\n"); |
| 844 | kfree(serial); | 846 | usb_serial_put(serial); |
| 845 | module_put(type->driver.owner); | 847 | module_put(type->driver.owner); |
| 846 | return -EIO; | 848 | return -EIO; |
| 847 | } | 849 | } |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index a324a5d21e99..11418da9bc09 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
| @@ -202,6 +202,12 @@ static int slave_configure(struct scsi_device *sdev) | |||
| 202 | if (us->fflags & US_FL_NO_READ_CAPACITY_16) | 202 | if (us->fflags & US_FL_NO_READ_CAPACITY_16) |
| 203 | sdev->no_read_capacity_16 = 1; | 203 | sdev->no_read_capacity_16 = 1; |
| 204 | 204 | ||
| 205 | /* | ||
| 206 | * Many devices do not respond properly to READ_CAPACITY_16. | ||
| 207 | * Tell the SCSI layer to try READ_CAPACITY_10 first. | ||
| 208 | */ | ||
| 209 | sdev->try_rc_10_first = 1; | ||
| 210 | |||
| 205 | /* assume SPC3 or latter devices support sense size > 18 */ | 211 | /* assume SPC3 or latter devices support sense size > 18 */ |
| 206 | if (sdev->scsi_level > SCSI_SPC_2) | 212 | if (sdev->scsi_level > SCSI_SPC_2) |
| 207 | us->fflags |= US_FL_SANE_SENSE; | 213 | us->fflags |= US_FL_SANE_SENSE; |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 94dbd25caa30..112156f68afb 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
| @@ -191,7 +191,9 @@ static int vhost_worker(void *data) | |||
| 191 | struct vhost_dev *dev = data; | 191 | struct vhost_dev *dev = data; |
| 192 | struct vhost_work *work = NULL; | 192 | struct vhost_work *work = NULL; |
| 193 | unsigned uninitialized_var(seq); | 193 | unsigned uninitialized_var(seq); |
| 194 | mm_segment_t oldfs = get_fs(); | ||
| 194 | 195 | ||
| 196 | set_fs(USER_DS); | ||
| 195 | use_mm(dev->mm); | 197 | use_mm(dev->mm); |
| 196 | 198 | ||
| 197 | for (;;) { | 199 | for (;;) { |
| @@ -229,6 +231,7 @@ static int vhost_worker(void *data) | |||
| 229 | 231 | ||
| 230 | } | 232 | } |
| 231 | unuse_mm(dev->mm); | 233 | unuse_mm(dev->mm); |
| 234 | set_fs(oldfs); | ||
| 232 | return 0; | 235 | return 0; |
| 233 | } | 236 | } |
| 234 | 237 | ||
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index fa2b03750316..2979292650d6 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
| @@ -88,7 +88,7 @@ config LCD_PLATFORM | |||
| 88 | 88 | ||
| 89 | config LCD_TOSA | 89 | config LCD_TOSA |
| 90 | tristate "Sharp SL-6000 LCD Driver" | 90 | tristate "Sharp SL-6000 LCD Driver" |
| 91 | depends on SPI && MACH_TOSA | 91 | depends on I2C && SPI && MACH_TOSA |
| 92 | help | 92 | help |
| 93 | If you have an Sharp SL-6000 Zaurus say Y to enable a driver | 93 | If you have an Sharp SL-6000 Zaurus say Y to enable a driver |
| 94 | for its LCD. | 94 | for its LCD. |
diff --git a/drivers/video/backlight/ili9320.c b/drivers/video/backlight/ili9320.c index 6c9399341bcf..9327cd1b3143 100644 --- a/drivers/video/backlight/ili9320.c +++ b/drivers/video/backlight/ili9320.c | |||
| @@ -263,7 +263,7 @@ int __devinit ili9320_probe_spi(struct spi_device *spi, | |||
| 263 | 263 | ||
| 264 | EXPORT_SYMBOL_GPL(ili9320_probe_spi); | 264 | EXPORT_SYMBOL_GPL(ili9320_probe_spi); |
| 265 | 265 | ||
| 266 | int __devexit ili9320_remove(struct ili9320 *ili) | 266 | int ili9320_remove(struct ili9320 *ili) |
| 267 | { | 267 | { |
| 268 | ili9320_power(ili, FB_BLANK_POWERDOWN); | 268 | ili9320_power(ili, FB_BLANK_POWERDOWN); |
| 269 | 269 | ||
diff --git a/drivers/video/bfin_adv7393fb.c b/drivers/video/bfin_adv7393fb.c index 33ea874c87d2..9bdd4b0c18c8 100644 --- a/drivers/video/bfin_adv7393fb.c +++ b/drivers/video/bfin_adv7393fb.c | |||
| @@ -353,18 +353,16 @@ adv7393_read_proc(char *page, char **start, off_t off, | |||
| 353 | 353 | ||
| 354 | static int | 354 | static int |
| 355 | adv7393_write_proc(struct file *file, const char __user * buffer, | 355 | adv7393_write_proc(struct file *file, const char __user * buffer, |
| 356 | unsigned long count, void *data) | 356 | size_t count, void *data) |
| 357 | { | 357 | { |
| 358 | struct adv7393fb_device *fbdev = data; | 358 | struct adv7393fb_device *fbdev = data; |
| 359 | char line[8]; | ||
| 360 | unsigned int val; | 359 | unsigned int val; |
| 361 | int ret; | 360 | int ret; |
| 362 | 361 | ||
| 363 | ret = copy_from_user(line, buffer, count); | 362 | ret = kstrtouint_from_user(buffer, count, 0, &val); |
| 364 | if (ret) | 363 | if (ret) |
| 365 | return -EFAULT; | 364 | return -EFAULT; |
| 366 | 365 | ||
| 367 | val = simple_strtoul(line, NULL, 0); | ||
| 368 | adv7393_write(fbdev->client, val >> 8, val & 0xff); | 366 | adv7393_write(fbdev->client, val >> 8, val & 0xff); |
| 369 | 367 | ||
| 370 | return count; | 368 | return count; |
diff --git a/drivers/video/broadsheetfb.c b/drivers/video/broadsheetfb.c index 377dde3d5bfc..c95b417d0d41 100644 --- a/drivers/video/broadsheetfb.c +++ b/drivers/video/broadsheetfb.c | |||
| @@ -1211,7 +1211,7 @@ static int __devexit broadsheetfb_remove(struct platform_device *dev) | |||
| 1211 | 1211 | ||
| 1212 | static struct platform_driver broadsheetfb_driver = { | 1212 | static struct platform_driver broadsheetfb_driver = { |
| 1213 | .probe = broadsheetfb_probe, | 1213 | .probe = broadsheetfb_probe, |
| 1214 | .remove = broadsheetfb_remove, | 1214 | .remove = __devexit_p(broadsheetfb_remove), |
| 1215 | .driver = { | 1215 | .driver = { |
| 1216 | .owner = THIS_MODULE, | 1216 | .owner = THIS_MODULE, |
| 1217 | .name = "broadsheetfb", | 1217 | .name = "broadsheetfb", |
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index c2d11fef114b..e2c96d01d8f5 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig | |||
| @@ -224,5 +224,19 @@ config FONT_10x18 | |||
| 224 | big letters. It fits between the sun 12x22 and the normal 8x16 font. | 224 | big letters. It fits between the sun 12x22 and the normal 8x16 font. |
| 225 | If other fonts are too big or too small for you, say Y, otherwise say N. | 225 | If other fonts are too big or too small for you, say Y, otherwise say N. |
| 226 | 226 | ||
| 227 | config FONT_AUTOSELECT | ||
| 228 | def_bool y | ||
| 229 | depends on FRAMEBUFFER_CONSOLE || SGI_NEWPORT_CONSOLE || STI_CONSOLE || USB_SISUSBVGA_CON | ||
| 230 | depends on !FONT_8x8 | ||
| 231 | depends on !FONT_6x11 | ||
| 232 | depends on !FONT_7x14 | ||
| 233 | depends on !FONT_PEARL_8x8 | ||
| 234 | depends on !FONT_ACORN_8x8 | ||
| 235 | depends on !FONT_MINI_4x6 | ||
| 236 | depends on !FONT_SUN8x16 | ||
| 237 | depends on !FONT_SUN12x22 | ||
| 238 | depends on !FONT_10x18 | ||
| 239 | select FONT_8x16 | ||
| 240 | |||
| 227 | endmenu | 241 | endmenu |
| 228 | 242 | ||
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c index ab0a8e527333..85e4f44bfa61 100644 --- a/drivers/video/mbx/mbxfb.c +++ b/drivers/video/mbx/mbxfb.c | |||
| @@ -1045,7 +1045,7 @@ static int __devexit mbxfb_remove(struct platform_device *dev) | |||
| 1045 | 1045 | ||
| 1046 | static struct platform_driver mbxfb_driver = { | 1046 | static struct platform_driver mbxfb_driver = { |
| 1047 | .probe = mbxfb_probe, | 1047 | .probe = mbxfb_probe, |
| 1048 | .remove = mbxfb_remove, | 1048 | .remove = __devexit_p(mbxfb_remove), |
| 1049 | .suspend = mbxfb_suspend, | 1049 | .suspend = mbxfb_suspend, |
| 1050 | .resume = mbxfb_resume, | 1050 | .resume = mbxfb_resume, |
| 1051 | .driver = { | 1051 | .driver = { |
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c index 2ce9992f403b..901576eb5a84 100644 --- a/drivers/video/omap2/displays/panel-taal.c +++ b/drivers/video/omap2/displays/panel-taal.c | |||
| @@ -526,7 +526,7 @@ static ssize_t taal_num_errors_show(struct device *dev, | |||
| 526 | { | 526 | { |
| 527 | struct omap_dss_device *dssdev = to_dss_device(dev); | 527 | struct omap_dss_device *dssdev = to_dss_device(dev); |
| 528 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); | 528 | struct taal_data *td = dev_get_drvdata(&dssdev->dev); |
| 529 | u8 errors; | 529 | u8 errors = 0; |
| 530 | int r; | 530 | int r; |
| 531 | 531 | ||
| 532 | mutex_lock(&td->lock); | 532 | mutex_lock(&td->lock); |
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c index 72ded9cd2cb0..58bd9c27369d 100644 --- a/drivers/video/omap2/dss/core.c +++ b/drivers/video/omap2/dss/core.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
| 33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
| 34 | #include <linux/regulator/consumer.h> | 34 | #include <linux/regulator/consumer.h> |
| 35 | #include <linux/suspend.h> | ||
| 35 | 36 | ||
| 36 | #include <video/omapdss.h> | 37 | #include <video/omapdss.h> |
| 37 | 38 | ||
| @@ -194,14 +195,35 @@ static inline int dss_initialize_debugfs(void) | |||
| 194 | static inline void dss_uninitialize_debugfs(void) | 195 | static inline void dss_uninitialize_debugfs(void) |
| 195 | { | 196 | { |
| 196 | } | 197 | } |
| 197 | static inline int dss_debugfs_create_file(const char *name, | 198 | int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *)) |
| 198 | void (*write)(struct seq_file *)) | ||
| 199 | { | 199 | { |
| 200 | return 0; | 200 | return 0; |
| 201 | } | 201 | } |
| 202 | #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ | 202 | #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */ |
| 203 | 203 | ||
| 204 | /* PLATFORM DEVICE */ | 204 | /* PLATFORM DEVICE */ |
| 205 | static int omap_dss_pm_notif(struct notifier_block *b, unsigned long v, void *d) | ||
| 206 | { | ||
| 207 | DSSDBG("pm notif %lu\n", v); | ||
| 208 | |||
| 209 | switch (v) { | ||
| 210 | case PM_SUSPEND_PREPARE: | ||
| 211 | DSSDBG("suspending displays\n"); | ||
| 212 | return dss_suspend_all_devices(); | ||
| 213 | |||
| 214 | case PM_POST_SUSPEND: | ||
| 215 | DSSDBG("resuming displays\n"); | ||
| 216 | return dss_resume_all_devices(); | ||
| 217 | |||
| 218 | default: | ||
| 219 | return 0; | ||
| 220 | } | ||
| 221 | } | ||
| 222 | |||
| 223 | static struct notifier_block omap_dss_pm_notif_block = { | ||
| 224 | .notifier_call = omap_dss_pm_notif, | ||
| 225 | }; | ||
| 226 | |||
| 205 | static int __init omap_dss_probe(struct platform_device *pdev) | 227 | static int __init omap_dss_probe(struct platform_device *pdev) |
| 206 | { | 228 | { |
| 207 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; | 229 | struct omap_dss_board_info *pdata = pdev->dev.platform_data; |
| @@ -225,6 +247,8 @@ static int __init omap_dss_probe(struct platform_device *pdev) | |||
| 225 | else if (pdata->default_device) | 247 | else if (pdata->default_device) |
| 226 | core.default_display_name = pdata->default_device->name; | 248 | core.default_display_name = pdata->default_device->name; |
| 227 | 249 | ||
| 250 | register_pm_notifier(&omap_dss_pm_notif_block); | ||
| 251 | |||
| 228 | return 0; | 252 | return 0; |
| 229 | 253 | ||
| 230 | err_debugfs: | 254 | err_debugfs: |
| @@ -234,6 +258,8 @@ err_debugfs: | |||
| 234 | 258 | ||
| 235 | static int omap_dss_remove(struct platform_device *pdev) | 259 | static int omap_dss_remove(struct platform_device *pdev) |
| 236 | { | 260 | { |
| 261 | unregister_pm_notifier(&omap_dss_pm_notif_block); | ||
| 262 | |||
| 237 | dss_uninitialize_debugfs(); | 263 | dss_uninitialize_debugfs(); |
| 238 | 264 | ||
| 239 | dss_uninit_overlays(pdev); | 265 | dss_uninit_overlays(pdev); |
| @@ -248,25 +274,9 @@ static void omap_dss_shutdown(struct platform_device *pdev) | |||
| 248 | dss_disable_all_devices(); | 274 | dss_disable_all_devices(); |
| 249 | } | 275 | } |
| 250 | 276 | ||
| 251 | static int omap_dss_suspend(struct platform_device *pdev, pm_message_t state) | ||
| 252 | { | ||
| 253 | DSSDBG("suspend %d\n", state.event); | ||
| 254 | |||
| 255 | return dss_suspend_all_devices(); | ||
| 256 | } | ||
| 257 | |||
| 258 | static int omap_dss_resume(struct platform_device *pdev) | ||
| 259 | { | ||
| 260 | DSSDBG("resume\n"); | ||
| 261 | |||
| 262 | return dss_resume_all_devices(); | ||
| 263 | } | ||
| 264 | |||
| 265 | static struct platform_driver omap_dss_driver = { | 277 | static struct platform_driver omap_dss_driver = { |
| 266 | .remove = omap_dss_remove, | 278 | .remove = omap_dss_remove, |
| 267 | .shutdown = omap_dss_shutdown, | 279 | .shutdown = omap_dss_shutdown, |
| 268 | .suspend = omap_dss_suspend, | ||
| 269 | .resume = omap_dss_resume, | ||
| 270 | .driver = { | 280 | .driver = { |
| 271 | .name = "omapdss", | 281 | .name = "omapdss", |
| 272 | .owner = THIS_MODULE, | 282 | .owner = THIS_MODULE, |
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 4749ac356469..397d4eee11bb 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
| @@ -384,7 +384,7 @@ void dispc_runtime_put(void) | |||
| 384 | DSSDBG("dispc_runtime_put\n"); | 384 | DSSDBG("dispc_runtime_put\n"); |
| 385 | 385 | ||
| 386 | r = pm_runtime_put_sync(&dispc.pdev->dev); | 386 | r = pm_runtime_put_sync(&dispc.pdev->dev); |
| 387 | WARN_ON(r < 0); | 387 | WARN_ON(r < 0 && r != -ENOSYS); |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | static inline bool dispc_mgr_is_lcd(enum omap_channel channel) | 390 | static inline bool dispc_mgr_is_lcd(enum omap_channel channel) |
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c index ec363d8390ed..14ce8cc079e3 100644 --- a/drivers/video/omap2/dss/dsi.c +++ b/drivers/video/omap2/dss/dsi.c | |||
| @@ -1075,7 +1075,7 @@ void dsi_runtime_put(struct platform_device *dsidev) | |||
| 1075 | DSSDBG("dsi_runtime_put\n"); | 1075 | DSSDBG("dsi_runtime_put\n"); |
| 1076 | 1076 | ||
| 1077 | r = pm_runtime_put_sync(&dsi->pdev->dev); | 1077 | r = pm_runtime_put_sync(&dsi->pdev->dev); |
| 1078 | WARN_ON(r < 0); | 1078 | WARN_ON(r < 0 && r != -ENOSYS); |
| 1079 | } | 1079 | } |
| 1080 | 1080 | ||
| 1081 | /* source clock for DSI PLL. this could also be PCLKFREE */ | 1081 | /* source clock for DSI PLL. this could also be PCLKFREE */ |
| @@ -3724,7 +3724,7 @@ static int dsi_compute_interleave_lp(int blank, int enter_hs, int exit_hs, | |||
| 3724 | /* CLKIN4DDR = 16 * TXBYTECLKHS */ | 3724 | /* CLKIN4DDR = 16 * TXBYTECLKHS */ |
| 3725 | tlp_avail = thsbyte_clk * (blank - trans_lp); | 3725 | tlp_avail = thsbyte_clk * (blank - trans_lp); |
| 3726 | 3726 | ||
| 3727 | ttxclkesc = tdsi_fclk / lp_clk_div; | 3727 | ttxclkesc = tdsi_fclk * lp_clk_div; |
| 3728 | 3728 | ||
| 3729 | lp_inter = ((tlp_avail - 8 * thsbyte_clk - 5 * tdsi_fclk) / ttxclkesc - | 3729 | lp_inter = ((tlp_avail - 8 * thsbyte_clk - 5 * tdsi_fclk) / ttxclkesc - |
| 3730 | 26) / 16; | 3730 | 26) / 16; |
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 6ea1ff149f6f..d2b57197b292 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c | |||
| @@ -731,7 +731,7 @@ static void dss_runtime_put(void) | |||
| 731 | DSSDBG("dss_runtime_put\n"); | 731 | DSSDBG("dss_runtime_put\n"); |
| 732 | 732 | ||
| 733 | r = pm_runtime_put_sync(&dss.pdev->dev); | 733 | r = pm_runtime_put_sync(&dss.pdev->dev); |
| 734 | WARN_ON(r < 0); | 734 | WARN_ON(r < 0 && r != -ENOSYS && r != -EBUSY); |
| 735 | } | 735 | } |
| 736 | 736 | ||
| 737 | /* DEBUGFS */ | 737 | /* DEBUGFS */ |
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c index 8195c7166d20..26a2430a7028 100644 --- a/drivers/video/omap2/dss/hdmi.c +++ b/drivers/video/omap2/dss/hdmi.c | |||
| @@ -138,7 +138,7 @@ static void hdmi_runtime_put(void) | |||
| 138 | DSSDBG("hdmi_runtime_put\n"); | 138 | DSSDBG("hdmi_runtime_put\n"); |
| 139 | 139 | ||
| 140 | r = pm_runtime_put_sync(&hdmi.pdev->dev); | 140 | r = pm_runtime_put_sync(&hdmi.pdev->dev); |
| 141 | WARN_ON(r < 0); | 141 | WARN_ON(r < 0 && r != -ENOSYS); |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) | 144 | static int __init hdmi_init_display(struct omap_dss_device *dssdev) |
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c index 3d8c206e90e5..7985fa12b9b4 100644 --- a/drivers/video/omap2/dss/rfbi.c +++ b/drivers/video/omap2/dss/rfbi.c | |||
| @@ -141,7 +141,7 @@ static void rfbi_runtime_put(void) | |||
| 141 | DSSDBG("rfbi_runtime_put\n"); | 141 | DSSDBG("rfbi_runtime_put\n"); |
| 142 | 142 | ||
| 143 | r = pm_runtime_put_sync(&rfbi.pdev->dev); | 143 | r = pm_runtime_put_sync(&rfbi.pdev->dev); |
| 144 | WARN_ON(r < 0); | 144 | WARN_ON(r < 0 && r != -ENOSYS); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | void rfbi_bus_lock(void) | 147 | void rfbi_bus_lock(void) |
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 2b8973931ff4..3907c8b6ecbc 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c | |||
| @@ -402,7 +402,7 @@ static void venc_runtime_put(void) | |||
| 402 | DSSDBG("venc_runtime_put\n"); | 402 | DSSDBG("venc_runtime_put\n"); |
| 403 | 403 | ||
| 404 | r = pm_runtime_put_sync(&venc.pdev->dev); | 404 | r = pm_runtime_put_sync(&venc.pdev->dev); |
| 405 | WARN_ON(r < 0); | 405 | WARN_ON(r < 0 && r != -ENOSYS); |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | static const struct venc_config *venc_timings_to_config( | 408 | static const struct venc_config *venc_timings_to_config( |
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 5f9d8e69029e..ea7b661e7229 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
| @@ -361,7 +361,7 @@ static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk) | |||
| 361 | result = (unsigned int)tmp / 1000; | 361 | result = (unsigned int)tmp / 1000; |
| 362 | 362 | ||
| 363 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", | 363 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", |
| 364 | pixclk, clk, result, clk / result); | 364 | pixclk, clk, result, result ? clk / result : clk); |
| 365 | 365 | ||
| 366 | return result; | 366 | return result; |
| 367 | } | 367 | } |
| @@ -1348,8 +1348,14 @@ static void s3c_fb_clear_win(struct s3c_fb *sfb, int win) | |||
| 1348 | writel(0, regs + VIDOSD_A(win, sfb->variant)); | 1348 | writel(0, regs + VIDOSD_A(win, sfb->variant)); |
| 1349 | writel(0, regs + VIDOSD_B(win, sfb->variant)); | 1349 | writel(0, regs + VIDOSD_B(win, sfb->variant)); |
| 1350 | writel(0, regs + VIDOSD_C(win, sfb->variant)); | 1350 | writel(0, regs + VIDOSD_C(win, sfb->variant)); |
| 1351 | reg = readl(regs + SHADOWCON); | 1351 | |
| 1352 | writel(reg & ~SHADOWCON_WINx_PROTECT(win), regs + SHADOWCON); | 1352 | if (sfb->variant.has_shadowcon) { |
| 1353 | reg = readl(sfb->regs + SHADOWCON); | ||
| 1354 | reg &= ~(SHADOWCON_WINx_PROTECT(win) | | ||
| 1355 | SHADOWCON_CHx_ENABLE(win) | | ||
| 1356 | SHADOWCON_CHx_LOCAL_ENABLE(win)); | ||
| 1357 | writel(reg, sfb->regs + SHADOWCON); | ||
| 1358 | } | ||
| 1353 | } | 1359 | } |
| 1354 | 1360 | ||
| 1355 | static int __devinit s3c_fb_probe(struct platform_device *pdev) | 1361 | static int __devinit s3c_fb_probe(struct platform_device *pdev) |
diff --git a/drivers/video/savage/savagefb_driver.c b/drivers/video/savage/savagefb_driver.c index cee7803a0a1c..f3d3b9ce4751 100644 --- a/drivers/video/savage/savagefb_driver.c +++ b/drivers/video/savage/savagefb_driver.c | |||
| @@ -1351,7 +1351,7 @@ static void savagefb_set_par_int(struct savagefb_par *par, struct savage_reg *r | |||
| 1351 | /* following part not present in X11 driver */ | 1351 | /* following part not present in X11 driver */ |
| 1352 | cr67 = vga_in8(0x3d5, par) & 0xf; | 1352 | cr67 = vga_in8(0x3d5, par) & 0xf; |
| 1353 | vga_out8(0x3d5, 0x50 | cr67, par); | 1353 | vga_out8(0x3d5, 0x50 | cr67, par); |
| 1354 | udelay(10000); | 1354 | mdelay(10); |
| 1355 | vga_out8(0x3d4, 0x67, par); | 1355 | vga_out8(0x3d4, 0x67, par); |
| 1356 | /* end of part */ | 1356 | /* end of part */ |
| 1357 | vga_out8(0x3d5, reg->CR67 & ~0x0c, par); | 1357 | vga_out8(0x3d5, reg->CR67 & ~0x0c, par); |
| @@ -1904,11 +1904,11 @@ static int savage_init_hw(struct savagefb_par *par) | |||
| 1904 | vga_out8(0x3d4, 0x66, par); | 1904 | vga_out8(0x3d4, 0x66, par); |
| 1905 | cr66 = vga_in8(0x3d5, par); | 1905 | cr66 = vga_in8(0x3d5, par); |
| 1906 | vga_out8(0x3d5, cr66 | 0x02, par); | 1906 | vga_out8(0x3d5, cr66 | 0x02, par); |
| 1907 | udelay(10000); | 1907 | mdelay(10); |
| 1908 | 1908 | ||
| 1909 | vga_out8(0x3d4, 0x66, par); | 1909 | vga_out8(0x3d4, 0x66, par); |
| 1910 | vga_out8(0x3d5, cr66 & ~0x02, par); /* clear reset flag */ | 1910 | vga_out8(0x3d5, cr66 & ~0x02, par); /* clear reset flag */ |
| 1911 | udelay(10000); | 1911 | mdelay(10); |
| 1912 | 1912 | ||
| 1913 | 1913 | ||
| 1914 | /* | 1914 | /* |
| @@ -1918,11 +1918,11 @@ static int savage_init_hw(struct savagefb_par *par) | |||
| 1918 | vga_out8(0x3d4, 0x3f, par); | 1918 | vga_out8(0x3d4, 0x3f, par); |
| 1919 | cr3f = vga_in8(0x3d5, par); | 1919 | cr3f = vga_in8(0x3d5, par); |
| 1920 | vga_out8(0x3d5, cr3f | 0x08, par); | 1920 | vga_out8(0x3d5, cr3f | 0x08, par); |
| 1921 | udelay(10000); | 1921 | mdelay(10); |
| 1922 | 1922 | ||
| 1923 | vga_out8(0x3d4, 0x3f, par); | 1923 | vga_out8(0x3d4, 0x3f, par); |
| 1924 | vga_out8(0x3d5, cr3f & ~0x08, par); /* clear reset flags */ | 1924 | vga_out8(0x3d5, cr3f & ~0x08, par); /* clear reset flags */ |
| 1925 | udelay(10000); | 1925 | mdelay(10); |
| 1926 | 1926 | ||
| 1927 | /* Savage ramdac speeds */ | 1927 | /* Savage ramdac speeds */ |
| 1928 | par->numClocks = 4; | 1928 | par->numClocks = 4; |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index bfbc15ca38dd..0908e6044333 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
| @@ -47,7 +47,7 @@ struct virtio_balloon | |||
| 47 | struct task_struct *thread; | 47 | struct task_struct *thread; |
| 48 | 48 | ||
| 49 | /* Waiting for host to ack the pages we released. */ | 49 | /* Waiting for host to ack the pages we released. */ |
| 50 | struct completion acked; | 50 | wait_queue_head_t acked; |
| 51 | 51 | ||
| 52 | /* Number of balloon pages we've told the Host we're not using. */ | 52 | /* Number of balloon pages we've told the Host we're not using. */ |
| 53 | unsigned int num_pages; | 53 | unsigned int num_pages; |
| @@ -89,29 +89,25 @@ static struct page *balloon_pfn_to_page(u32 pfn) | |||
| 89 | 89 | ||
| 90 | static void balloon_ack(struct virtqueue *vq) | 90 | static void balloon_ack(struct virtqueue *vq) |
| 91 | { | 91 | { |
| 92 | struct virtio_balloon *vb; | 92 | struct virtio_balloon *vb = vq->vdev->priv; |
| 93 | unsigned int len; | ||
| 94 | 93 | ||
| 95 | vb = virtqueue_get_buf(vq, &len); | 94 | wake_up(&vb->acked); |
| 96 | if (vb) | ||
| 97 | complete(&vb->acked); | ||
| 98 | } | 95 | } |
| 99 | 96 | ||
| 100 | static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) | 97 | static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) |
| 101 | { | 98 | { |
| 102 | struct scatterlist sg; | 99 | struct scatterlist sg; |
| 100 | unsigned int len; | ||
| 103 | 101 | ||
| 104 | sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); | 102 | sg_init_one(&sg, vb->pfns, sizeof(vb->pfns[0]) * vb->num_pfns); |
| 105 | 103 | ||
| 106 | init_completion(&vb->acked); | ||
| 107 | |||
| 108 | /* We should always be able to add one buffer to an empty queue. */ | 104 | /* We should always be able to add one buffer to an empty queue. */ |
| 109 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) | 105 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) |
| 110 | BUG(); | 106 | BUG(); |
| 111 | virtqueue_kick(vq); | 107 | virtqueue_kick(vq); |
| 112 | 108 | ||
| 113 | /* When host has read buffer, this completes via balloon_ack */ | 109 | /* When host has read buffer, this completes via balloon_ack */ |
| 114 | wait_for_completion(&vb->acked); | 110 | wait_event(vb->acked, virtqueue_get_buf(vq, &len)); |
| 115 | } | 111 | } |
| 116 | 112 | ||
| 117 | static void set_page_pfns(u32 pfns[], struct page *page) | 113 | static void set_page_pfns(u32 pfns[], struct page *page) |
| @@ -231,12 +227,8 @@ static void update_balloon_stats(struct virtio_balloon *vb) | |||
| 231 | */ | 227 | */ |
| 232 | static void stats_request(struct virtqueue *vq) | 228 | static void stats_request(struct virtqueue *vq) |
| 233 | { | 229 | { |
| 234 | struct virtio_balloon *vb; | 230 | struct virtio_balloon *vb = vq->vdev->priv; |
| 235 | unsigned int len; | ||
| 236 | 231 | ||
| 237 | vb = virtqueue_get_buf(vq, &len); | ||
| 238 | if (!vb) | ||
| 239 | return; | ||
| 240 | vb->need_stats_update = 1; | 232 | vb->need_stats_update = 1; |
| 241 | wake_up(&vb->config_change); | 233 | wake_up(&vb->config_change); |
| 242 | } | 234 | } |
| @@ -245,11 +237,14 @@ static void stats_handle_request(struct virtio_balloon *vb) | |||
| 245 | { | 237 | { |
| 246 | struct virtqueue *vq; | 238 | struct virtqueue *vq; |
| 247 | struct scatterlist sg; | 239 | struct scatterlist sg; |
| 240 | unsigned int len; | ||
| 248 | 241 | ||
| 249 | vb->need_stats_update = 0; | 242 | vb->need_stats_update = 0; |
| 250 | update_balloon_stats(vb); | 243 | update_balloon_stats(vb); |
| 251 | 244 | ||
| 252 | vq = vb->stats_vq; | 245 | vq = vb->stats_vq; |
| 246 | if (!virtqueue_get_buf(vq, &len)) | ||
| 247 | return; | ||
| 253 | sg_init_one(&sg, vb->stats, sizeof(vb->stats)); | 248 | sg_init_one(&sg, vb->stats, sizeof(vb->stats)); |
| 254 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) | 249 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) |
| 255 | BUG(); | 250 | BUG(); |
| @@ -358,6 +353,7 @@ static int virtballoon_probe(struct virtio_device *vdev) | |||
| 358 | INIT_LIST_HEAD(&vb->pages); | 353 | INIT_LIST_HEAD(&vb->pages); |
| 359 | vb->num_pages = 0; | 354 | vb->num_pages = 0; |
| 360 | init_waitqueue_head(&vb->config_change); | 355 | init_waitqueue_head(&vb->config_change); |
| 356 | init_waitqueue_head(&vb->acked); | ||
| 361 | vb->vdev = vdev; | 357 | vb->vdev = vdev; |
| 362 | vb->need_stats_update = 0; | 358 | vb->need_stats_update = 0; |
| 363 | 359 | ||
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 2b763815aeec..1eff743ec497 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
| @@ -146,7 +146,7 @@ struct cmn_registers { | |||
| 146 | } __attribute__((packed)); | 146 | } __attribute__((packed)); |
| 147 | 147 | ||
| 148 | static unsigned int hpwdt_nmi_decoding; | 148 | static unsigned int hpwdt_nmi_decoding; |
| 149 | static unsigned int allow_kdump; | 149 | static unsigned int allow_kdump = 1; |
| 150 | static unsigned int is_icru; | 150 | static unsigned int is_icru; |
| 151 | static DEFINE_SPINLOCK(rom_lock); | 151 | static DEFINE_SPINLOCK(rom_lock); |
| 152 | static void *cru_rom_addr; | 152 | static void *cru_rom_addr; |
| @@ -756,6 +756,8 @@ error: | |||
| 756 | static void hpwdt_exit_nmi_decoding(void) | 756 | static void hpwdt_exit_nmi_decoding(void) |
| 757 | { | 757 | { |
| 758 | unregister_nmi_handler(NMI_UNKNOWN, "hpwdt"); | 758 | unregister_nmi_handler(NMI_UNKNOWN, "hpwdt"); |
| 759 | unregister_nmi_handler(NMI_SERR, "hpwdt"); | ||
| 760 | unregister_nmi_handler(NMI_IO_CHECK, "hpwdt"); | ||
| 759 | if (cru_rom_addr) | 761 | if (cru_rom_addr) |
| 760 | iounmap(cru_rom_addr); | 762 | iounmap(cru_rom_addr); |
| 761 | } | 763 | } |
diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c index bc47e9012f37..9c2c27c3b424 100644 --- a/drivers/watchdog/iTCO_wdt.c +++ b/drivers/watchdog/iTCO_wdt.c | |||
| @@ -699,3 +699,4 @@ MODULE_DESCRIPTION("Intel TCO WatchDog Timer Driver"); | |||
| 699 | MODULE_VERSION(DRV_VERSION); | 699 | MODULE_VERSION(DRV_VERSION); |
| 700 | MODULE_LICENSE("GPL"); | 700 | MODULE_LICENSE("GPL"); |
| 701 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 701 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
| 702 | MODULE_ALIAS("platform:" DRV_NAME); | ||
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index afcd13676542..e4841c36798b 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * Watchdog driver for ARM SP805 watchdog module | 4 | * Watchdog driver for ARM SP805 watchdog module |
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2010 ST Microelectronics | 6 | * Copyright (C) 2010 ST Microelectronics |
| 7 | * Viresh Kumar<viresh.kumar@st.com> | 7 | * Viresh Kumar <viresh.linux@gmail.com> |
| 8 | * | 8 | * |
| 9 | * This file is licensed under the terms of the GNU General Public | 9 | * This file is licensed under the terms of the GNU General Public |
| 10 | * License version 2 or later. This program is licensed "as is" without any | 10 | * License version 2 or later. This program is licensed "as is" without any |
| @@ -331,6 +331,6 @@ static struct amba_driver sp805_wdt_driver = { | |||
| 331 | 331 | ||
| 332 | module_amba_driver(sp805_wdt_driver); | 332 | module_amba_driver(sp805_wdt_driver); |
| 333 | 333 | ||
| 334 | MODULE_AUTHOR("Viresh Kumar <viresh.kumar@st.com>"); | 334 | MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>"); |
| 335 | MODULE_DESCRIPTION("ARM SP805 Watchdog Driver"); | 335 | MODULE_DESCRIPTION("ARM SP805 Watchdog Driver"); |
| 336 | MODULE_LICENSE("GPL"); | 336 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 672d169bf1da..ef8edecfc526 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c | |||
| @@ -349,7 +349,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, | |||
| 349 | sizeof(struct watchdog_info)) ? -EFAULT : 0; | 349 | sizeof(struct watchdog_info)) ? -EFAULT : 0; |
| 350 | case WDIOC_GETSTATUS: | 350 | case WDIOC_GETSTATUS: |
| 351 | err = watchdog_get_status(wdd, &val); | 351 | err = watchdog_get_status(wdd, &val); |
| 352 | if (err) | 352 | if (err == -ENODEV) |
| 353 | return err; | 353 | return err; |
| 354 | return put_user(val, p); | 354 | return put_user(val, p); |
| 355 | case WDIOC_GETBOOTSTATUS: | 355 | case WDIOC_GETBOOTSTATUS: |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 6908e4ce2a0d..7595581d032c 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
| @@ -827,6 +827,9 @@ int bind_evtchn_to_irq(unsigned int evtchn) | |||
| 827 | handle_edge_irq, "event"); | 827 | handle_edge_irq, "event"); |
| 828 | 828 | ||
| 829 | xen_irq_info_evtchn_init(irq, evtchn); | 829 | xen_irq_info_evtchn_init(irq, evtchn); |
| 830 | } else { | ||
| 831 | struct irq_info *info = info_for_irq(irq); | ||
| 832 | WARN_ON(info == NULL || info->type != IRQT_EVTCHN); | ||
| 830 | } | 833 | } |
| 831 | 834 | ||
| 832 | out: | 835 | out: |
| @@ -862,6 +865,9 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) | |||
| 862 | xen_irq_info_ipi_init(cpu, irq, evtchn, ipi); | 865 | xen_irq_info_ipi_init(cpu, irq, evtchn, ipi); |
| 863 | 866 | ||
| 864 | bind_evtchn_to_cpu(evtchn, cpu); | 867 | bind_evtchn_to_cpu(evtchn, cpu); |
| 868 | } else { | ||
| 869 | struct irq_info *info = info_for_irq(irq); | ||
| 870 | WARN_ON(info == NULL || info->type != IRQT_IPI); | ||
| 865 | } | 871 | } |
| 866 | 872 | ||
| 867 | out: | 873 | out: |
| @@ -939,6 +945,9 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | |||
| 939 | xen_irq_info_virq_init(cpu, irq, evtchn, virq); | 945 | xen_irq_info_virq_init(cpu, irq, evtchn, virq); |
| 940 | 946 | ||
| 941 | bind_evtchn_to_cpu(evtchn, cpu); | 947 | bind_evtchn_to_cpu(evtchn, cpu); |
| 948 | } else { | ||
| 949 | struct irq_info *info = info_for_irq(irq); | ||
| 950 | WARN_ON(info == NULL || info->type != IRQT_VIRQ); | ||
| 942 | } | 951 | } |
| 943 | 952 | ||
| 944 | out: | 953 | out: |
diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c index b84bf0b6cc34..18fff88254eb 100644 --- a/drivers/xen/pci.c +++ b/drivers/xen/pci.c | |||
| @@ -59,7 +59,7 @@ static int xen_add_device(struct device *dev) | |||
| 59 | 59 | ||
| 60 | #ifdef CONFIG_ACPI | 60 | #ifdef CONFIG_ACPI |
| 61 | handle = DEVICE_ACPI_HANDLE(&pci_dev->dev); | 61 | handle = DEVICE_ACPI_HANDLE(&pci_dev->dev); |
| 62 | if (!handle) | 62 | if (!handle && pci_dev->bus->bridge) |
| 63 | handle = DEVICE_ACPI_HANDLE(pci_dev->bus->bridge); | 63 | handle = DEVICE_ACPI_HANDLE(pci_dev->bus->bridge); |
| 64 | #ifdef CONFIG_PCI_IOV | 64 | #ifdef CONFIG_PCI_IOV |
| 65 | if (!handle && pci_dev->is_virtfn) | 65 | if (!handle && pci_dev->is_virtfn) |
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index dcb79521e6c8..89f264c67420 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c | |||
| @@ -269,7 +269,7 @@ static inline struct tmem_oid oswiz(unsigned type, u32 ind) | |||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | /* returns 0 if the page was successfully put into frontswap, -1 if not */ | 271 | /* returns 0 if the page was successfully put into frontswap, -1 if not */ |
| 272 | static int tmem_frontswap_put_page(unsigned type, pgoff_t offset, | 272 | static int tmem_frontswap_store(unsigned type, pgoff_t offset, |
| 273 | struct page *page) | 273 | struct page *page) |
| 274 | { | 274 | { |
| 275 | u64 ind64 = (u64)offset; | 275 | u64 ind64 = (u64)offset; |
| @@ -295,7 +295,7 @@ static int tmem_frontswap_put_page(unsigned type, pgoff_t offset, | |||
| 295 | * returns 0 if the page was successfully gotten from frontswap, -1 if | 295 | * returns 0 if the page was successfully gotten from frontswap, -1 if |
| 296 | * was not present (should never happen!) | 296 | * was not present (should never happen!) |
| 297 | */ | 297 | */ |
| 298 | static int tmem_frontswap_get_page(unsigned type, pgoff_t offset, | 298 | static int tmem_frontswap_load(unsigned type, pgoff_t offset, |
| 299 | struct page *page) | 299 | struct page *page) |
| 300 | { | 300 | { |
| 301 | u64 ind64 = (u64)offset; | 301 | u64 ind64 = (u64)offset; |
| @@ -362,8 +362,8 @@ static int __init no_frontswap(char *s) | |||
| 362 | __setup("nofrontswap", no_frontswap); | 362 | __setup("nofrontswap", no_frontswap); |
| 363 | 363 | ||
| 364 | static struct frontswap_ops __initdata tmem_frontswap_ops = { | 364 | static struct frontswap_ops __initdata tmem_frontswap_ops = { |
| 365 | .put_page = tmem_frontswap_put_page, | 365 | .store = tmem_frontswap_store, |
| 366 | .get_page = tmem_frontswap_get_page, | 366 | .load = tmem_frontswap_load, |
| 367 | .invalidate_page = tmem_frontswap_flush_page, | 367 | .invalidate_page = tmem_frontswap_flush_page, |
| 368 | .invalidate_area = tmem_frontswap_flush_area, | 368 | .invalidate_area = tmem_frontswap_flush_area, |
| 369 | .init = tmem_frontswap_init | 369 | .init = tmem_frontswap_init |
