diff options
Diffstat (limited to 'drivers')
272 files changed, 2735 insertions, 1731 deletions
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index ab513a972c95..a716fede4f25 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
@@ -74,7 +74,8 @@ acpi_status acpi_reset(void) | |||
74 | 74 | ||
75 | /* Check if the reset register is supported */ | 75 | /* Check if the reset register is supported */ |
76 | 76 | ||
77 | if (!reset_reg->address) { | 77 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || |
78 | !reset_reg->address) { | ||
78 | return_ACPI_STATUS(AE_NOT_EXIST); | 79 | return_ACPI_STATUS(AE_NOT_EXIST); |
79 | } | 80 | } |
80 | 81 | ||
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index ba14fb93c929..c3881b2eb8b2 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -607,8 +607,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, | |||
607 | 607 | ||
608 | acpi_irq_handler = handler; | 608 | acpi_irq_handler = handler; |
609 | acpi_irq_context = context; | 609 | acpi_irq_context = context; |
610 | if (request_threaded_irq(irq, NULL, acpi_irq, IRQF_SHARED, "acpi", | 610 | if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) { |
611 | acpi_irq)) { | ||
612 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); | 611 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); |
613 | acpi_irq_handler = NULL; | 612 | acpi_irq_handler = NULL; |
614 | return AE_NOT_ACQUIRED; | 613 | return AE_NOT_ACQUIRED; |
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index c1d612435939..a6c77e8b37bd 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c | |||
@@ -23,7 +23,8 @@ void acpi_reboot(void) | |||
23 | /* Is the reset register supported? The spec says we should be | 23 | /* Is the reset register supported? The spec says we should be |
24 | * checking the bit width and bit offset, but Windows ignores | 24 | * checking the bit width and bit offset, but Windows ignores |
25 | * these fields */ | 25 | * these fields */ |
26 | /* Ignore also acpi_gbl_FADT.flags.ACPI_FADT_RESET_REGISTER */ | 26 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER)) |
27 | return; | ||
27 | 28 | ||
28 | reset_value = acpi_gbl_FADT.reset_value; | 29 | reset_value = acpi_gbl_FADT.reset_value; |
29 | 30 | ||
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 1d661b5c3287..eb6fd233764b 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -28,23 +28,33 @@ | |||
28 | #include "internal.h" | 28 | #include "internal.h" |
29 | #include "sleep.h" | 29 | #include "sleep.h" |
30 | 30 | ||
31 | u8 wake_sleep_flags = ACPI_NO_OPTIONAL_METHODS; | ||
31 | static unsigned int gts, bfs; | 32 | static unsigned int gts, bfs; |
32 | module_param(gts, uint, 0644); | 33 | static int set_param_wake_flag(const char *val, struct kernel_param *kp) |
33 | module_param(bfs, uint, 0644); | ||
34 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
35 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
36 | |||
37 | static u8 wake_sleep_flags(void) | ||
38 | { | 34 | { |
39 | u8 flags = ACPI_NO_OPTIONAL_METHODS; | 35 | int ret = param_set_int(val, kp); |
40 | 36 | ||
41 | if (gts) | 37 | if (ret) |
42 | flags |= ACPI_EXECUTE_GTS; | 38 | return ret; |
43 | if (bfs) | ||
44 | flags |= ACPI_EXECUTE_BFS; | ||
45 | 39 | ||
46 | return flags; | 40 | if (kp->arg == (const char *)>s) { |
41 | if (gts) | ||
42 | wake_sleep_flags |= ACPI_EXECUTE_GTS; | ||
43 | else | ||
44 | wake_sleep_flags &= ~ACPI_EXECUTE_GTS; | ||
45 | } | ||
46 | if (kp->arg == (const char *)&bfs) { | ||
47 | if (bfs) | ||
48 | wake_sleep_flags |= ACPI_EXECUTE_BFS; | ||
49 | else | ||
50 | wake_sleep_flags &= ~ACPI_EXECUTE_BFS; | ||
51 | } | ||
52 | return ret; | ||
47 | } | 53 | } |
54 | module_param_call(gts, set_param_wake_flag, param_get_int, >s, 0644); | ||
55 | module_param_call(bfs, set_param_wake_flag, param_get_int, &bfs, 0644); | ||
56 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
57 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
48 | 58 | ||
49 | static u8 sleep_states[ACPI_S_STATE_COUNT]; | 59 | static u8 sleep_states[ACPI_S_STATE_COUNT]; |
50 | 60 | ||
@@ -263,7 +273,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
263 | { | 273 | { |
264 | acpi_status status = AE_OK; | 274 | acpi_status status = AE_OK; |
265 | u32 acpi_state = acpi_target_sleep_state; | 275 | u32 acpi_state = acpi_target_sleep_state; |
266 | u8 flags = wake_sleep_flags(); | ||
267 | int error; | 276 | int error; |
268 | 277 | ||
269 | ACPI_FLUSH_CPU_CACHE(); | 278 | ACPI_FLUSH_CPU_CACHE(); |
@@ -271,7 +280,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
271 | switch (acpi_state) { | 280 | switch (acpi_state) { |
272 | case ACPI_STATE_S1: | 281 | case ACPI_STATE_S1: |
273 | barrier(); | 282 | barrier(); |
274 | status = acpi_enter_sleep_state(acpi_state, flags); | 283 | status = acpi_enter_sleep_state(acpi_state, wake_sleep_flags); |
275 | break; | 284 | break; |
276 | 285 | ||
277 | case ACPI_STATE_S3: | 286 | case ACPI_STATE_S3: |
@@ -286,7 +295,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
286 | acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); | 295 | acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); |
287 | 296 | ||
288 | /* Reprogram control registers and execute _BFS */ | 297 | /* Reprogram control registers and execute _BFS */ |
289 | acpi_leave_sleep_state_prep(acpi_state, flags); | 298 | acpi_leave_sleep_state_prep(acpi_state, wake_sleep_flags); |
290 | 299 | ||
291 | /* ACPI 3.0 specs (P62) says that it's the responsibility | 300 | /* ACPI 3.0 specs (P62) says that it's the responsibility |
292 | * of the OSPM to clear the status bit [ implying that the | 301 | * of the OSPM to clear the status bit [ implying that the |
@@ -550,30 +559,27 @@ static int acpi_hibernation_begin(void) | |||
550 | 559 | ||
551 | static int acpi_hibernation_enter(void) | 560 | static int acpi_hibernation_enter(void) |
552 | { | 561 | { |
553 | u8 flags = wake_sleep_flags(); | ||
554 | acpi_status status = AE_OK; | 562 | acpi_status status = AE_OK; |
555 | 563 | ||
556 | ACPI_FLUSH_CPU_CACHE(); | 564 | ACPI_FLUSH_CPU_CACHE(); |
557 | 565 | ||
558 | /* This shouldn't return. If it returns, we have a problem */ | 566 | /* This shouldn't return. If it returns, we have a problem */ |
559 | status = acpi_enter_sleep_state(ACPI_STATE_S4, flags); | 567 | status = acpi_enter_sleep_state(ACPI_STATE_S4, wake_sleep_flags); |
560 | /* Reprogram control registers and execute _BFS */ | 568 | /* Reprogram control registers and execute _BFS */ |
561 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); | 569 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); |
562 | 570 | ||
563 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 571 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
564 | } | 572 | } |
565 | 573 | ||
566 | static void acpi_hibernation_leave(void) | 574 | static void acpi_hibernation_leave(void) |
567 | { | 575 | { |
568 | u8 flags = wake_sleep_flags(); | ||
569 | |||
570 | /* | 576 | /* |
571 | * If ACPI is not enabled by the BIOS and the boot kernel, we need to | 577 | * If ACPI is not enabled by the BIOS and the boot kernel, we need to |
572 | * enable it here. | 578 | * enable it here. |
573 | */ | 579 | */ |
574 | acpi_enable(); | 580 | acpi_enable(); |
575 | /* Reprogram control registers and execute _BFS */ | 581 | /* Reprogram control registers and execute _BFS */ |
576 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); | 582 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); |
577 | /* Check the hardware signature */ | 583 | /* Check the hardware signature */ |
578 | if (facs && s4_hardware_signature != facs->hardware_signature) { | 584 | if (facs && s4_hardware_signature != facs->hardware_signature) { |
579 | printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " | 585 | printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " |
@@ -828,12 +834,10 @@ static void acpi_power_off_prepare(void) | |||
828 | 834 | ||
829 | static void acpi_power_off(void) | 835 | static void acpi_power_off(void) |
830 | { | 836 | { |
831 | u8 flags = wake_sleep_flags(); | ||
832 | |||
833 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | 837 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
834 | printk(KERN_DEBUG "%s called\n", __func__); | 838 | printk(KERN_DEBUG "%s called\n", __func__); |
835 | local_irq_disable(); | 839 | local_irq_disable(); |
836 | acpi_enter_sleep_state(ACPI_STATE_S5, flags); | 840 | acpi_enter_sleep_state(ACPI_STATE_S5, wake_sleep_flags); |
837 | } | 841 | } |
838 | 842 | ||
839 | /* | 843 | /* |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 79a1e9dd56d9..ebaf67e4b2bc 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -394,6 +394,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
394 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | 394 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ |
395 | { PCI_DEVICE(0x1b4b, 0x9125), | 395 | { PCI_DEVICE(0x1b4b, 0x9125), |
396 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ | 396 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ |
397 | { PCI_DEVICE(0x1b4b, 0x917a), | ||
398 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | ||
397 | { PCI_DEVICE(0x1b4b, 0x91a3), | 399 | { PCI_DEVICE(0x1b4b, 0x91a3), |
398 | .driver_data = board_ahci_yes_fbs }, | 400 | .driver_data = board_ahci_yes_fbs }, |
399 | 401 | ||
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 0c86c77764bc..9e419e1c2006 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
@@ -280,6 +280,7 @@ static struct dev_pm_ops ahci_pm_ops = { | |||
280 | 280 | ||
281 | static const struct of_device_id ahci_of_match[] = { | 281 | static const struct of_device_id ahci_of_match[] = { |
282 | { .compatible = "calxeda,hb-ahci", }, | 282 | { .compatible = "calxeda,hb-ahci", }, |
283 | { .compatible = "snps,spear-ahci", }, | ||
283 | {}, | 284 | {}, |
284 | }; | 285 | }; |
285 | MODULE_DEVICE_TABLE(of, ahci_of_match); | 286 | MODULE_DEVICE_TABLE(of, ahci_of_match); |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 68013f96729f..7857e8fd0a3e 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -329,6 +329,8 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
329 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 329 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
330 | /* SATA Controller IDE (Lynx Point) */ | 330 | /* SATA Controller IDE (Lynx Point) */ |
331 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 331 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
332 | /* SATA Controller IDE (DH89xxCC) */ | ||
333 | { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
332 | { } /* terminate list */ | 334 | { } /* terminate list */ |
333 | }; | 335 | }; |
334 | 336 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e0bda9ff89cd..23763a1ec570 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -95,7 +95,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev); | |||
95 | static void ata_dev_xfermask(struct ata_device *dev); | 95 | static void ata_dev_xfermask(struct ata_device *dev); |
96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); | 96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); |
97 | 97 | ||
98 | unsigned int ata_print_id = 1; | 98 | atomic_t ata_print_id = ATOMIC_INIT(0); |
99 | 99 | ||
100 | struct ata_force_param { | 100 | struct ata_force_param { |
101 | const char *name; | 101 | const char *name; |
@@ -6029,7 +6029,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6029 | 6029 | ||
6030 | /* give ports names and add SCSI hosts */ | 6030 | /* give ports names and add SCSI hosts */ |
6031 | for (i = 0; i < host->n_ports; i++) | 6031 | for (i = 0; i < host->n_ports; i++) |
6032 | host->ports[i]->print_id = ata_print_id++; | 6032 | host->ports[i]->print_id = atomic_inc_return(&ata_print_id); |
6033 | 6033 | ||
6034 | 6034 | ||
6035 | /* Create associated sysfs transport objects */ | 6035 | /* Create associated sysfs transport objects */ |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c61316e9d2f7..d1fbd59ead16 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -3501,7 +3501,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg | |||
3501 | u64 now = get_jiffies_64(); | 3501 | u64 now = get_jiffies_64(); |
3502 | int *trials = void_arg; | 3502 | int *trials = void_arg; |
3503 | 3503 | ||
3504 | if (ent->timestamp < now - min(now, interval)) | 3504 | if ((ent->eflags & ATA_EFLAG_OLD_ER) || |
3505 | (ent->timestamp < now - min(now, interval))) | ||
3505 | return -1; | 3506 | return -1; |
3506 | 3507 | ||
3507 | (*trials)++; | 3508 | (*trials)++; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 1ee00c8b5b04..22226350cd0c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3399,7 +3399,8 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) | |||
3399 | */ | 3399 | */ |
3400 | shost->max_host_blocked = 1; | 3400 | shost->max_host_blocked = 1; |
3401 | 3401 | ||
3402 | rc = scsi_add_host(ap->scsi_host, &ap->tdev); | 3402 | rc = scsi_add_host_with_dma(ap->scsi_host, |
3403 | &ap->tdev, ap->host->dev); | ||
3403 | if (rc) | 3404 | if (rc) |
3404 | goto err_add; | 3405 | goto err_add; |
3405 | } | 3406 | } |
@@ -3838,18 +3839,25 @@ void ata_sas_port_stop(struct ata_port *ap) | |||
3838 | } | 3839 | } |
3839 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); | 3840 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); |
3840 | 3841 | ||
3841 | int ata_sas_async_port_init(struct ata_port *ap) | 3842 | /** |
3843 | * ata_sas_async_probe - simply schedule probing and return | ||
3844 | * @ap: Port to probe | ||
3845 | * | ||
3846 | * For batch scheduling of probe for sas attached ata devices, assumes | ||
3847 | * the port has already been through ata_sas_port_init() | ||
3848 | */ | ||
3849 | void ata_sas_async_probe(struct ata_port *ap) | ||
3842 | { | 3850 | { |
3843 | int rc = ap->ops->port_start(ap); | 3851 | __ata_port_probe(ap); |
3844 | 3852 | } | |
3845 | if (!rc) { | 3853 | EXPORT_SYMBOL_GPL(ata_sas_async_probe); |
3846 | ap->print_id = ata_print_id++; | ||
3847 | __ata_port_probe(ap); | ||
3848 | } | ||
3849 | 3854 | ||
3850 | return rc; | 3855 | int ata_sas_sync_probe(struct ata_port *ap) |
3856 | { | ||
3857 | return ata_port_probe(ap); | ||
3851 | } | 3858 | } |
3852 | EXPORT_SYMBOL_GPL(ata_sas_async_port_init); | 3859 | EXPORT_SYMBOL_GPL(ata_sas_sync_probe); |
3860 | |||
3853 | 3861 | ||
3854 | /** | 3862 | /** |
3855 | * ata_sas_port_init - Initialize a SATA device | 3863 | * ata_sas_port_init - Initialize a SATA device |
@@ -3866,12 +3874,10 @@ int ata_sas_port_init(struct ata_port *ap) | |||
3866 | { | 3874 | { |
3867 | int rc = ap->ops->port_start(ap); | 3875 | int rc = ap->ops->port_start(ap); |
3868 | 3876 | ||
3869 | if (!rc) { | 3877 | if (rc) |
3870 | ap->print_id = ata_print_id++; | 3878 | return rc; |
3871 | rc = ata_port_probe(ap); | 3879 | ap->print_id = atomic_inc_return(&ata_print_id); |
3872 | } | 3880 | return 0; |
3873 | |||
3874 | return rc; | ||
3875 | } | 3881 | } |
3876 | EXPORT_SYMBOL_GPL(ata_sas_port_init); | 3882 | EXPORT_SYMBOL_GPL(ata_sas_port_init); |
3877 | 3883 | ||
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index 74aaee30e264..c34190485377 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c | |||
@@ -294,6 +294,7 @@ int ata_tport_add(struct device *parent, | |||
294 | device_enable_async_suspend(dev); | 294 | device_enable_async_suspend(dev); |
295 | pm_runtime_set_active(dev); | 295 | pm_runtime_set_active(dev); |
296 | pm_runtime_enable(dev); | 296 | pm_runtime_enable(dev); |
297 | pm_runtime_forbid(dev); | ||
297 | 298 | ||
298 | transport_add_device(dev); | 299 | transport_add_device(dev); |
299 | transport_configure_device(dev); | 300 | transport_configure_device(dev); |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 2e26fcaf635b..9d0fd0b71852 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -53,7 +53,7 @@ enum { | |||
53 | ATA_DNXFER_QUIET = (1 << 31), | 53 | ATA_DNXFER_QUIET = (1 << 31), |
54 | }; | 54 | }; |
55 | 55 | ||
56 | extern unsigned int ata_print_id; | 56 | extern atomic_t ata_print_id; |
57 | extern int atapi_passthru16; | 57 | extern int atapi_passthru16; |
58 | extern int libata_fua; | 58 | extern int libata_fua; |
59 | extern int libata_noacpi; | 59 | extern int libata_noacpi; |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index fc2db2a89a6b..3239517f4d90 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -943,9 +943,9 @@ static int arasan_cf_resume(struct device *dev) | |||
943 | 943 | ||
944 | return 0; | 944 | return 0; |
945 | } | 945 | } |
946 | #endif | ||
946 | 947 | ||
947 | static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); | 948 | static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); |
948 | #endif | ||
949 | 949 | ||
950 | static struct platform_driver arasan_cf_driver = { | 950 | static struct platform_driver arasan_cf_driver = { |
951 | .probe = arasan_cf_probe, | 951 | .probe = arasan_cf_probe, |
@@ -953,9 +953,7 @@ static struct platform_driver arasan_cf_driver = { | |||
953 | .driver = { | 953 | .driver = { |
954 | .name = DRIVER_NAME, | 954 | .name = DRIVER_NAME, |
955 | .owner = THIS_MODULE, | 955 | .owner = THIS_MODULE, |
956 | #ifdef CONFIG_PM | ||
957 | .pm = &arasan_cf_pm_ops, | 956 | .pm = &arasan_cf_pm_ops, |
958 | #endif | ||
959 | }, | 957 | }, |
960 | }; | 958 | }; |
961 | 959 | ||
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 38950ea8398a..7336d4a7ab31 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -4025,7 +4025,8 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4025 | struct ata_host *host; | 4025 | struct ata_host *host; |
4026 | struct mv_host_priv *hpriv; | 4026 | struct mv_host_priv *hpriv; |
4027 | struct resource *res; | 4027 | struct resource *res; |
4028 | int n_ports, rc; | 4028 | int n_ports = 0; |
4029 | int rc; | ||
4029 | 4030 | ||
4030 | ata_print_version_once(&pdev->dev, DRV_VERSION); | 4031 | ata_print_version_once(&pdev->dev, DRV_VERSION); |
4031 | 4032 | ||
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index cdcf75c0954f..3e2a6002aae6 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c | |||
@@ -404,16 +404,19 @@ int bcma_sprom_get(struct bcma_bus *bus) | |||
404 | return -EOPNOTSUPP; | 404 | return -EOPNOTSUPP; |
405 | 405 | ||
406 | if (!bcma_sprom_ext_available(bus)) { | 406 | if (!bcma_sprom_ext_available(bus)) { |
407 | bool sprom_onchip; | ||
408 | |||
407 | /* | 409 | /* |
408 | * External SPROM takes precedence so check | 410 | * External SPROM takes precedence so check |
409 | * on-chip OTP only when no external SPROM | 411 | * on-chip OTP only when no external SPROM |
410 | * is present. | 412 | * is present. |
411 | */ | 413 | */ |
412 | if (bcma_sprom_onchip_available(bus)) { | 414 | sprom_onchip = bcma_sprom_onchip_available(bus); |
415 | if (sprom_onchip) { | ||
413 | /* determine offset */ | 416 | /* determine offset */ |
414 | offset = bcma_sprom_onchip_offset(bus); | 417 | offset = bcma_sprom_onchip_offset(bus); |
415 | } | 418 | } |
416 | if (!offset) { | 419 | if (!offset || !sprom_onchip) { |
417 | /* | 420 | /* |
418 | * Maybe there is no SPROM on the device? | 421 | * Maybe there is no SPROM on the device? |
419 | * Now we ask the arch code if there is some sprom | 422 | * Now we ask the arch code if there is some sprom |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 89860f34a7ec..4f66171c6683 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -416,7 +416,7 @@ static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info | |||
416 | "discard-secure", "%d", | 416 | "discard-secure", "%d", |
417 | blkif->vbd.discard_secure); | 417 | blkif->vbd.discard_secure); |
418 | if (err) { | 418 | if (err) { |
419 | dev_warn(dev-dev, "writing discard-secure (%d)", err); | 419 | dev_warn(&dev->dev, "writing discard-secure (%d)", err); |
420 | return; | 420 | return; |
421 | } | 421 | } |
422 | } | 422 | } |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index ae9edca7b56d..57fd867553d7 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -75,6 +75,8 @@ static struct usb_device_id ath3k_table[] = { | |||
75 | { USB_DEVICE(0x0CF3, 0x311D) }, | 75 | { USB_DEVICE(0x0CF3, 0x311D) }, |
76 | { USB_DEVICE(0x13d3, 0x3375) }, | 76 | { USB_DEVICE(0x13d3, 0x3375) }, |
77 | { USB_DEVICE(0x04CA, 0x3005) }, | 77 | { USB_DEVICE(0x04CA, 0x3005) }, |
78 | { USB_DEVICE(0x13d3, 0x3362) }, | ||
79 | { USB_DEVICE(0x0CF3, 0xE004) }, | ||
78 | 80 | ||
79 | /* Atheros AR5BBU12 with sflash firmware */ | 81 | /* Atheros AR5BBU12 with sflash firmware */ |
80 | { USB_DEVICE(0x0489, 0xE02C) }, | 82 | { USB_DEVICE(0x0489, 0xE02C) }, |
@@ -94,6 +96,8 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
94 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | 96 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, |
95 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 97 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
96 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 98 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
99 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | ||
100 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | ||
97 | 101 | ||
98 | { } /* Terminating entry */ | 102 | { } /* Terminating entry */ |
99 | }; | 103 | }; |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 3311b812a0c6..9217121362e1 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -101,12 +101,16 @@ static struct usb_device_id btusb_table[] = { | |||
101 | { USB_DEVICE(0x0c10, 0x0000) }, | 101 | { USB_DEVICE(0x0c10, 0x0000) }, |
102 | 102 | ||
103 | /* Broadcom BCM20702A0 */ | 103 | /* Broadcom BCM20702A0 */ |
104 | { USB_DEVICE(0x0489, 0xe042) }, | ||
104 | { USB_DEVICE(0x0a5c, 0x21e3) }, | 105 | { USB_DEVICE(0x0a5c, 0x21e3) }, |
105 | { USB_DEVICE(0x0a5c, 0x21e6) }, | 106 | { USB_DEVICE(0x0a5c, 0x21e6) }, |
106 | { USB_DEVICE(0x0a5c, 0x21e8) }, | 107 | { USB_DEVICE(0x0a5c, 0x21e8) }, |
107 | { USB_DEVICE(0x0a5c, 0x21f3) }, | 108 | { USB_DEVICE(0x0a5c, 0x21f3) }, |
108 | { USB_DEVICE(0x413c, 0x8197) }, | 109 | { USB_DEVICE(0x413c, 0x8197) }, |
109 | 110 | ||
111 | /* Foxconn - Hon Hai */ | ||
112 | { USB_DEVICE(0x0489, 0xe033) }, | ||
113 | |||
110 | { } /* Terminating entry */ | 114 | { } /* Terminating entry */ |
111 | }; | 115 | }; |
112 | 116 | ||
@@ -133,6 +137,8 @@ static struct usb_device_id blacklist_table[] = { | |||
133 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | 137 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, |
134 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 138 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
135 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, | 139 | { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 }, |
140 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | ||
141 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | ||
136 | 142 | ||
137 | /* Atheros AR5BBU12 with sflash firmware */ | 143 | /* Atheros AR5BBU12 with sflash firmware */ |
138 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 144 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 0053d7ebb5ca..8f3f74ce8c7f 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/gfp.h> | 20 | #include <linux/gfp.h> |
21 | #include <linux/module.h> | ||
21 | 22 | ||
22 | #include <crypto/ctr.h> | 23 | #include <crypto/ctr.h> |
23 | #include <crypto/des.h> | 24 | #include <crypto/des.h> |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index dc641c796526..921039e56f87 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
@@ -124,6 +124,9 @@ struct talitos_private { | |||
124 | void __iomem *reg; | 124 | void __iomem *reg; |
125 | int irq[2]; | 125 | int irq[2]; |
126 | 126 | ||
127 | /* SEC global registers lock */ | ||
128 | spinlock_t reg_lock ____cacheline_aligned; | ||
129 | |||
127 | /* SEC version geometry (from device tree node) */ | 130 | /* SEC version geometry (from device tree node) */ |
128 | unsigned int num_channels; | 131 | unsigned int num_channels; |
129 | unsigned int chfifo_len; | 132 | unsigned int chfifo_len; |
@@ -412,6 +415,7 @@ static void talitos_done_##name(unsigned long data) \ | |||
412 | { \ | 415 | { \ |
413 | struct device *dev = (struct device *)data; \ | 416 | struct device *dev = (struct device *)data; \ |
414 | struct talitos_private *priv = dev_get_drvdata(dev); \ | 417 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
418 | unsigned long flags; \ | ||
415 | \ | 419 | \ |
416 | if (ch_done_mask & 1) \ | 420 | if (ch_done_mask & 1) \ |
417 | flush_channel(dev, 0, 0, 0); \ | 421 | flush_channel(dev, 0, 0, 0); \ |
@@ -427,8 +431,10 @@ static void talitos_done_##name(unsigned long data) \ | |||
427 | out: \ | 431 | out: \ |
428 | /* At this point, all completed channels have been processed */ \ | 432 | /* At this point, all completed channels have been processed */ \ |
429 | /* Unmask done interrupts for channels completed later on. */ \ | 433 | /* Unmask done interrupts for channels completed later on. */ \ |
434 | spin_lock_irqsave(&priv->reg_lock, flags); \ | ||
430 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | 435 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
431 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ | 436 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ |
437 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ | ||
432 | } | 438 | } |
433 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) | 439 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) |
434 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) | 440 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) |
@@ -619,22 +625,28 @@ static irqreturn_t talitos_interrupt_##name(int irq, void *data) \ | |||
619 | struct device *dev = data; \ | 625 | struct device *dev = data; \ |
620 | struct talitos_private *priv = dev_get_drvdata(dev); \ | 626 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
621 | u32 isr, isr_lo; \ | 627 | u32 isr, isr_lo; \ |
628 | unsigned long flags; \ | ||
622 | \ | 629 | \ |
630 | spin_lock_irqsave(&priv->reg_lock, flags); \ | ||
623 | isr = in_be32(priv->reg + TALITOS_ISR); \ | 631 | isr = in_be32(priv->reg + TALITOS_ISR); \ |
624 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ | 632 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ |
625 | /* Acknowledge interrupt */ \ | 633 | /* Acknowledge interrupt */ \ |
626 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ | 634 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ |
627 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ | 635 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ |
628 | \ | 636 | \ |
629 | if (unlikely((isr & ~TALITOS_ISR_4CHDONE) & ch_err_mask || isr_lo)) \ | 637 | if (unlikely(isr & ch_err_mask || isr_lo)) { \ |
630 | talitos_error(dev, isr, isr_lo); \ | 638 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ |
631 | else \ | 639 | talitos_error(dev, isr & ch_err_mask, isr_lo); \ |
640 | } \ | ||
641 | else { \ | ||
632 | if (likely(isr & ch_done_mask)) { \ | 642 | if (likely(isr & ch_done_mask)) { \ |
633 | /* mask further done interrupts. */ \ | 643 | /* mask further done interrupts. */ \ |
634 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | 644 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
635 | /* done_task will unmask done interrupts at exit */ \ | 645 | /* done_task will unmask done interrupts at exit */ \ |
636 | tasklet_schedule(&priv->done_task[tlet]); \ | 646 | tasklet_schedule(&priv->done_task[tlet]); \ |
637 | } \ | 647 | } \ |
648 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ | ||
649 | } \ | ||
638 | \ | 650 | \ |
639 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ | 651 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ |
640 | IRQ_NONE; \ | 652 | IRQ_NONE; \ |
@@ -2719,6 +2731,8 @@ static int talitos_probe(struct platform_device *ofdev) | |||
2719 | 2731 | ||
2720 | priv->ofdev = ofdev; | 2732 | priv->ofdev = ofdev; |
2721 | 2733 | ||
2734 | spin_lock_init(&priv->reg_lock); | ||
2735 | |||
2722 | err = talitos_probe_irq(ofdev); | 2736 | err = talitos_probe_irq(ofdev); |
2723 | if (err) | 2737 | if (err) |
2724 | goto err_out; | 2738 | goto err_out; |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index cf9da362d64f..ef378b5b17e4 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -91,11 +91,10 @@ config DW_DMAC | |||
91 | 91 | ||
92 | config AT_HDMAC | 92 | config AT_HDMAC |
93 | tristate "Atmel AHB DMA support" | 93 | tristate "Atmel AHB DMA support" |
94 | depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 | 94 | depends on ARCH_AT91 |
95 | select DMA_ENGINE | 95 | select DMA_ENGINE |
96 | help | 96 | help |
97 | Support the Atmel AHB DMA controller. This can be integrated in | 97 | Support the Atmel AHB DMA controller. |
98 | chips such as the Atmel AT91SAM9RL. | ||
99 | 98 | ||
100 | config FSL_DMA | 99 | config FSL_DMA |
101 | tristate "Freescale Elo and Elo Plus DMA support" | 100 | tristate "Freescale Elo and Elo Plus DMA support" |
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index c301a8ec31aa..3d704abd7912 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -1429,6 +1429,7 @@ static int pl08x_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
1429 | * signal | 1429 | * signal |
1430 | */ | 1430 | */ |
1431 | release_phy_channel(plchan); | 1431 | release_phy_channel(plchan); |
1432 | plchan->phychan_hold = 0; | ||
1432 | } | 1433 | } |
1433 | /* Dequeue jobs and free LLIs */ | 1434 | /* Dequeue jobs and free LLIs */ |
1434 | if (plchan->at) { | 1435 | if (plchan->at) { |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 7aa58d204892..445fdf811695 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -221,10 +221,6 @@ static void atc_dostart(struct at_dma_chan *atchan, struct at_desc *first) | |||
221 | 221 | ||
222 | vdbg_dump_regs(atchan); | 222 | vdbg_dump_regs(atchan); |
223 | 223 | ||
224 | /* clear any pending interrupt */ | ||
225 | while (dma_readl(atdma, EBCISR)) | ||
226 | cpu_relax(); | ||
227 | |||
228 | channel_writel(atchan, SADDR, 0); | 224 | channel_writel(atchan, SADDR, 0); |
229 | channel_writel(atchan, DADDR, 0); | 225 | channel_writel(atchan, DADDR, 0); |
230 | channel_writel(atchan, CTRLA, 0); | 226 | channel_writel(atchan, CTRLA, 0); |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index a45b5d2a5987..bb787d8e1529 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -571,11 +571,14 @@ static void imxdma_tasklet(unsigned long data) | |||
571 | if (desc->desc.callback) | 571 | if (desc->desc.callback) |
572 | desc->desc.callback(desc->desc.callback_param); | 572 | desc->desc.callback(desc->desc.callback_param); |
573 | 573 | ||
574 | dma_cookie_complete(&desc->desc); | 574 | /* If we are dealing with a cyclic descriptor keep it on ld_active |
575 | 575 | * and dont mark the descripor as complete. | |
576 | /* If we are dealing with a cyclic descriptor keep it on ld_active */ | 576 | * Only in non-cyclic cases it would be marked as complete |
577 | */ | ||
577 | if (imxdma_chan_is_doing_cyclic(imxdmac)) | 578 | if (imxdma_chan_is_doing_cyclic(imxdmac)) |
578 | goto out; | 579 | goto out; |
580 | else | ||
581 | dma_cookie_complete(&desc->desc); | ||
579 | 582 | ||
580 | /* Free 2D slot if it was an interleaved transfer */ | 583 | /* Free 2D slot if it was an interleaved transfer */ |
581 | if (imxdmac->enabled_2d) { | 584 | if (imxdmac->enabled_2d) { |
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c index c81ef7e10e08..655d4ce6ed0d 100644 --- a/drivers/dma/mxs-dma.c +++ b/drivers/dma/mxs-dma.c | |||
@@ -201,10 +201,6 @@ static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) | |||
201 | 201 | ||
202 | static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx) | 202 | static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx) |
203 | { | 203 | { |
204 | struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(tx->chan); | ||
205 | |||
206 | mxs_dma_enable_chan(mxs_chan); | ||
207 | |||
208 | return dma_cookie_assign(tx); | 204 | return dma_cookie_assign(tx); |
209 | } | 205 | } |
210 | 206 | ||
@@ -558,9 +554,9 @@ static enum dma_status mxs_dma_tx_status(struct dma_chan *chan, | |||
558 | 554 | ||
559 | static void mxs_dma_issue_pending(struct dma_chan *chan) | 555 | static void mxs_dma_issue_pending(struct dma_chan *chan) |
560 | { | 556 | { |
561 | /* | 557 | struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan); |
562 | * Nothing to do. We only have a single descriptor. | 558 | |
563 | */ | 559 | mxs_dma_enable_chan(mxs_chan); |
564 | } | 560 | } |
565 | 561 | ||
566 | static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) | 562 | static int __init mxs_dma_init(struct mxs_dma_engine *mxs_dma) |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 282caf118be8..2ee6e23930ad 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -2225,12 +2225,9 @@ static inline void free_desc_list(struct list_head *list) | |||
2225 | { | 2225 | { |
2226 | struct dma_pl330_dmac *pdmac; | 2226 | struct dma_pl330_dmac *pdmac; |
2227 | struct dma_pl330_desc *desc; | 2227 | struct dma_pl330_desc *desc; |
2228 | struct dma_pl330_chan *pch; | 2228 | struct dma_pl330_chan *pch = NULL; |
2229 | unsigned long flags; | 2229 | unsigned long flags; |
2230 | 2230 | ||
2231 | if (list_empty(list)) | ||
2232 | return; | ||
2233 | |||
2234 | /* Finish off the work list */ | 2231 | /* Finish off the work list */ |
2235 | list_for_each_entry(desc, list, node) { | 2232 | list_for_each_entry(desc, list, node) { |
2236 | dma_async_tx_callback callback; | 2233 | dma_async_tx_callback callback; |
@@ -2247,6 +2244,10 @@ static inline void free_desc_list(struct list_head *list) | |||
2247 | desc->pchan = NULL; | 2244 | desc->pchan = NULL; |
2248 | } | 2245 | } |
2249 | 2246 | ||
2247 | /* pch will be unset if list was empty */ | ||
2248 | if (!pch) | ||
2249 | return; | ||
2250 | |||
2250 | pdmac = pch->dmac; | 2251 | pdmac = pch->dmac; |
2251 | 2252 | ||
2252 | spin_lock_irqsave(&pdmac->pool_lock, flags); | 2253 | spin_lock_irqsave(&pdmac->pool_lock, flags); |
@@ -2257,12 +2258,9 @@ static inline void free_desc_list(struct list_head *list) | |||
2257 | static inline void handle_cyclic_desc_list(struct list_head *list) | 2258 | static inline void handle_cyclic_desc_list(struct list_head *list) |
2258 | { | 2259 | { |
2259 | struct dma_pl330_desc *desc; | 2260 | struct dma_pl330_desc *desc; |
2260 | struct dma_pl330_chan *pch; | 2261 | struct dma_pl330_chan *pch = NULL; |
2261 | unsigned long flags; | 2262 | unsigned long flags; |
2262 | 2263 | ||
2263 | if (list_empty(list)) | ||
2264 | return; | ||
2265 | |||
2266 | list_for_each_entry(desc, list, node) { | 2264 | list_for_each_entry(desc, list, node) { |
2267 | dma_async_tx_callback callback; | 2265 | dma_async_tx_callback callback; |
2268 | 2266 | ||
@@ -2274,6 +2272,10 @@ static inline void handle_cyclic_desc_list(struct list_head *list) | |||
2274 | callback(desc->txd.callback_param); | 2272 | callback(desc->txd.callback_param); |
2275 | } | 2273 | } |
2276 | 2274 | ||
2275 | /* pch will be unset if list was empty */ | ||
2276 | if (!pch) | ||
2277 | return; | ||
2278 | |||
2277 | spin_lock_irqsave(&pch->lock, flags); | 2279 | spin_lock_irqsave(&pch->lock, flags); |
2278 | list_splice_tail_init(list, &pch->work_list); | 2280 | list_splice_tail_init(list, &pch->work_list); |
2279 | spin_unlock_irqrestore(&pch->lock, flags); | 2281 | spin_unlock_irqrestore(&pch->lock, flags); |
@@ -2926,8 +2928,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id) | |||
2926 | INIT_LIST_HEAD(&pd->channels); | 2928 | INIT_LIST_HEAD(&pd->channels); |
2927 | 2929 | ||
2928 | /* Initialize channel parameters */ | 2930 | /* Initialize channel parameters */ |
2929 | num_chan = max(pdat ? pdat->nr_valid_peri : (u8)pi->pcfg.num_peri, | 2931 | if (pdat) |
2930 | (u8)pi->pcfg.num_chan); | 2932 | num_chan = max_t(int, pdat->nr_valid_peri, pi->pcfg.num_chan); |
2933 | else | ||
2934 | num_chan = max_t(int, pi->pcfg.num_peri, pi->pcfg.num_chan); | ||
2935 | |||
2931 | pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); | 2936 | pdmac->peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL); |
2932 | 2937 | ||
2933 | for (i = 0; i < num_chan; i++) { | 2938 | for (i = 0; i < num_chan; i++) { |
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index bdd41d4bfa8d..2ed1ac3513f3 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pm_runtime.h> | 18 | #include <linux/pm_runtime.h> |
19 | #include <linux/err.h> | 19 | #include <linux/err.h> |
20 | #include <linux/amba/bus.h> | 20 | #include <linux/amba/bus.h> |
21 | #include <linux/regulator/consumer.h> | ||
21 | 22 | ||
22 | #include <plat/ste_dma40.h> | 23 | #include <plat/ste_dma40.h> |
23 | 24 | ||
@@ -69,6 +70,22 @@ enum d40_command { | |||
69 | }; | 70 | }; |
70 | 71 | ||
71 | /* | 72 | /* |
73 | * enum d40_events - The different Event Enables for the event lines. | ||
74 | * | ||
75 | * @D40_DEACTIVATE_EVENTLINE: De-activate Event line, stopping the logical chan. | ||
76 | * @D40_ACTIVATE_EVENTLINE: Activate the Event line, to start a logical chan. | ||
77 | * @D40_SUSPEND_REQ_EVENTLINE: Requesting for suspending a event line. | ||
78 | * @D40_ROUND_EVENTLINE: Status check for event line. | ||
79 | */ | ||
80 | |||
81 | enum d40_events { | ||
82 | D40_DEACTIVATE_EVENTLINE = 0, | ||
83 | D40_ACTIVATE_EVENTLINE = 1, | ||
84 | D40_SUSPEND_REQ_EVENTLINE = 2, | ||
85 | D40_ROUND_EVENTLINE = 3 | ||
86 | }; | ||
87 | |||
88 | /* | ||
72 | * These are the registers that has to be saved and later restored | 89 | * These are the registers that has to be saved and later restored |
73 | * when the DMA hw is powered off. | 90 | * when the DMA hw is powered off. |
74 | * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works. | 91 | * TODO: Add save/restore of D40_DREG_GCC on dma40 v3 or later, if that works. |
@@ -870,8 +887,8 @@ static void d40_save_restore_registers(struct d40_base *base, bool save) | |||
870 | } | 887 | } |
871 | #endif | 888 | #endif |
872 | 889 | ||
873 | static int d40_channel_execute_command(struct d40_chan *d40c, | 890 | static int __d40_execute_command_phy(struct d40_chan *d40c, |
874 | enum d40_command command) | 891 | enum d40_command command) |
875 | { | 892 | { |
876 | u32 status; | 893 | u32 status; |
877 | int i; | 894 | int i; |
@@ -880,6 +897,12 @@ static int d40_channel_execute_command(struct d40_chan *d40c, | |||
880 | unsigned long flags; | 897 | unsigned long flags; |
881 | u32 wmask; | 898 | u32 wmask; |
882 | 899 | ||
900 | if (command == D40_DMA_STOP) { | ||
901 | ret = __d40_execute_command_phy(d40c, D40_DMA_SUSPEND_REQ); | ||
902 | if (ret) | ||
903 | return ret; | ||
904 | } | ||
905 | |||
883 | spin_lock_irqsave(&d40c->base->execmd_lock, flags); | 906 | spin_lock_irqsave(&d40c->base->execmd_lock, flags); |
884 | 907 | ||
885 | if (d40c->phy_chan->num % 2 == 0) | 908 | if (d40c->phy_chan->num % 2 == 0) |
@@ -973,67 +996,109 @@ static void d40_term_all(struct d40_chan *d40c) | |||
973 | } | 996 | } |
974 | 997 | ||
975 | d40c->pending_tx = 0; | 998 | d40c->pending_tx = 0; |
976 | d40c->busy = false; | ||
977 | } | 999 | } |
978 | 1000 | ||
979 | static void __d40_config_set_event(struct d40_chan *d40c, bool enable, | 1001 | static void __d40_config_set_event(struct d40_chan *d40c, |
980 | u32 event, int reg) | 1002 | enum d40_events event_type, u32 event, |
1003 | int reg) | ||
981 | { | 1004 | { |
982 | void __iomem *addr = chan_base(d40c) + reg; | 1005 | void __iomem *addr = chan_base(d40c) + reg; |
983 | int tries; | 1006 | int tries; |
1007 | u32 status; | ||
1008 | |||
1009 | switch (event_type) { | ||
1010 | |||
1011 | case D40_DEACTIVATE_EVENTLINE: | ||
984 | 1012 | ||
985 | if (!enable) { | ||
986 | writel((D40_DEACTIVATE_EVENTLINE << D40_EVENTLINE_POS(event)) | 1013 | writel((D40_DEACTIVATE_EVENTLINE << D40_EVENTLINE_POS(event)) |
987 | | ~D40_EVENTLINE_MASK(event), addr); | 1014 | | ~D40_EVENTLINE_MASK(event), addr); |
988 | return; | 1015 | break; |
989 | } | 1016 | |
1017 | case D40_SUSPEND_REQ_EVENTLINE: | ||
1018 | status = (readl(addr) & D40_EVENTLINE_MASK(event)) >> | ||
1019 | D40_EVENTLINE_POS(event); | ||
1020 | |||
1021 | if (status == D40_DEACTIVATE_EVENTLINE || | ||
1022 | status == D40_SUSPEND_REQ_EVENTLINE) | ||
1023 | break; | ||
990 | 1024 | ||
1025 | writel((D40_SUSPEND_REQ_EVENTLINE << D40_EVENTLINE_POS(event)) | ||
1026 | | ~D40_EVENTLINE_MASK(event), addr); | ||
1027 | |||
1028 | for (tries = 0 ; tries < D40_SUSPEND_MAX_IT; tries++) { | ||
1029 | |||
1030 | status = (readl(addr) & D40_EVENTLINE_MASK(event)) >> | ||
1031 | D40_EVENTLINE_POS(event); | ||
1032 | |||
1033 | cpu_relax(); | ||
1034 | /* | ||
1035 | * Reduce the number of bus accesses while | ||
1036 | * waiting for the DMA to suspend. | ||
1037 | */ | ||
1038 | udelay(3); | ||
1039 | |||
1040 | if (status == D40_DEACTIVATE_EVENTLINE) | ||
1041 | break; | ||
1042 | } | ||
1043 | |||
1044 | if (tries == D40_SUSPEND_MAX_IT) { | ||
1045 | chan_err(d40c, | ||
1046 | "unable to stop the event_line chl %d (log: %d)" | ||
1047 | "status %x\n", d40c->phy_chan->num, | ||
1048 | d40c->log_num, status); | ||
1049 | } | ||
1050 | break; | ||
1051 | |||
1052 | case D40_ACTIVATE_EVENTLINE: | ||
991 | /* | 1053 | /* |
992 | * The hardware sometimes doesn't register the enable when src and dst | 1054 | * The hardware sometimes doesn't register the enable when src and dst |
993 | * event lines are active on the same logical channel. Retry to ensure | 1055 | * event lines are active on the same logical channel. Retry to ensure |
994 | * it does. Usually only one retry is sufficient. | 1056 | * it does. Usually only one retry is sufficient. |
995 | */ | 1057 | */ |
996 | tries = 100; | 1058 | tries = 100; |
997 | while (--tries) { | 1059 | while (--tries) { |
998 | writel((D40_ACTIVATE_EVENTLINE << D40_EVENTLINE_POS(event)) | 1060 | writel((D40_ACTIVATE_EVENTLINE << |
999 | | ~D40_EVENTLINE_MASK(event), addr); | 1061 | D40_EVENTLINE_POS(event)) | |
1062 | ~D40_EVENTLINE_MASK(event), addr); | ||
1000 | 1063 | ||
1001 | if (readl(addr) & D40_EVENTLINE_MASK(event)) | 1064 | if (readl(addr) & D40_EVENTLINE_MASK(event)) |
1002 | break; | 1065 | break; |
1003 | } | 1066 | } |
1004 | 1067 | ||
1005 | if (tries != 99) | 1068 | if (tries != 99) |
1006 | dev_dbg(chan2dev(d40c), | 1069 | dev_dbg(chan2dev(d40c), |
1007 | "[%s] workaround enable S%cLNK (%d tries)\n", | 1070 | "[%s] workaround enable S%cLNK (%d tries)\n", |
1008 | __func__, reg == D40_CHAN_REG_SSLNK ? 'S' : 'D', | 1071 | __func__, reg == D40_CHAN_REG_SSLNK ? 'S' : 'D', |
1009 | 100 - tries); | 1072 | 100 - tries); |
1010 | 1073 | ||
1011 | WARN_ON(!tries); | 1074 | WARN_ON(!tries); |
1012 | } | 1075 | break; |
1013 | 1076 | ||
1014 | static void d40_config_set_event(struct d40_chan *d40c, bool do_enable) | 1077 | case D40_ROUND_EVENTLINE: |
1015 | { | 1078 | BUG(); |
1016 | unsigned long flags; | 1079 | break; |
1017 | 1080 | ||
1018 | spin_lock_irqsave(&d40c->phy_chan->lock, flags); | 1081 | } |
1082 | } | ||
1019 | 1083 | ||
1084 | static void d40_config_set_event(struct d40_chan *d40c, | ||
1085 | enum d40_events event_type) | ||
1086 | { | ||
1020 | /* Enable event line connected to device (or memcpy) */ | 1087 | /* Enable event line connected to device (or memcpy) */ |
1021 | if ((d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) || | 1088 | if ((d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_MEM) || |
1022 | (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) { | 1089 | (d40c->dma_cfg.dir == STEDMA40_PERIPH_TO_PERIPH)) { |
1023 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.src_dev_type); | 1090 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.src_dev_type); |
1024 | 1091 | ||
1025 | __d40_config_set_event(d40c, do_enable, event, | 1092 | __d40_config_set_event(d40c, event_type, event, |
1026 | D40_CHAN_REG_SSLNK); | 1093 | D40_CHAN_REG_SSLNK); |
1027 | } | 1094 | } |
1028 | 1095 | ||
1029 | if (d40c->dma_cfg.dir != STEDMA40_PERIPH_TO_MEM) { | 1096 | if (d40c->dma_cfg.dir != STEDMA40_PERIPH_TO_MEM) { |
1030 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); | 1097 | u32 event = D40_TYPE_TO_EVENT(d40c->dma_cfg.dst_dev_type); |
1031 | 1098 | ||
1032 | __d40_config_set_event(d40c, do_enable, event, | 1099 | __d40_config_set_event(d40c, event_type, event, |
1033 | D40_CHAN_REG_SDLNK); | 1100 | D40_CHAN_REG_SDLNK); |
1034 | } | 1101 | } |
1035 | |||
1036 | spin_unlock_irqrestore(&d40c->phy_chan->lock, flags); | ||
1037 | } | 1102 | } |
1038 | 1103 | ||
1039 | static u32 d40_chan_has_events(struct d40_chan *d40c) | 1104 | static u32 d40_chan_has_events(struct d40_chan *d40c) |
@@ -1047,6 +1112,64 @@ static u32 d40_chan_has_events(struct d40_chan *d40c) | |||
1047 | return val; | 1112 | return val; |
1048 | } | 1113 | } |
1049 | 1114 | ||
1115 | static int | ||
1116 | __d40_execute_command_log(struct d40_chan *d40c, enum d40_command command) | ||
1117 | { | ||
1118 | unsigned long flags; | ||
1119 | int ret = 0; | ||
1120 | u32 active_status; | ||
1121 | void __iomem *active_reg; | ||
1122 | |||
1123 | if (d40c->phy_chan->num % 2 == 0) | ||
1124 | active_reg = d40c->base->virtbase + D40_DREG_ACTIVE; | ||
1125 | else | ||
1126 | active_reg = d40c->base->virtbase + D40_DREG_ACTIVO; | ||
1127 | |||
1128 | |||
1129 | spin_lock_irqsave(&d40c->phy_chan->lock, flags); | ||
1130 | |||
1131 | switch (command) { | ||
1132 | case D40_DMA_STOP: | ||
1133 | case D40_DMA_SUSPEND_REQ: | ||
1134 | |||
1135 | active_status = (readl(active_reg) & | ||
1136 | D40_CHAN_POS_MASK(d40c->phy_chan->num)) >> | ||
1137 | D40_CHAN_POS(d40c->phy_chan->num); | ||
1138 | |||
1139 | if (active_status == D40_DMA_RUN) | ||
1140 | d40_config_set_event(d40c, D40_SUSPEND_REQ_EVENTLINE); | ||
1141 | else | ||
1142 | d40_config_set_event(d40c, D40_DEACTIVATE_EVENTLINE); | ||
1143 | |||
1144 | if (!d40_chan_has_events(d40c) && (command == D40_DMA_STOP)) | ||
1145 | ret = __d40_execute_command_phy(d40c, command); | ||
1146 | |||
1147 | break; | ||
1148 | |||
1149 | case D40_DMA_RUN: | ||
1150 | |||
1151 | d40_config_set_event(d40c, D40_ACTIVATE_EVENTLINE); | ||
1152 | ret = __d40_execute_command_phy(d40c, command); | ||
1153 | break; | ||
1154 | |||
1155 | case D40_DMA_SUSPENDED: | ||
1156 | BUG(); | ||
1157 | break; | ||
1158 | } | ||
1159 | |||
1160 | spin_unlock_irqrestore(&d40c->phy_chan->lock, flags); | ||
1161 | return ret; | ||
1162 | } | ||
1163 | |||
1164 | static int d40_channel_execute_command(struct d40_chan *d40c, | ||
1165 | enum d40_command command) | ||
1166 | { | ||
1167 | if (chan_is_logical(d40c)) | ||
1168 | return __d40_execute_command_log(d40c, command); | ||
1169 | else | ||
1170 | return __d40_execute_command_phy(d40c, command); | ||
1171 | } | ||
1172 | |||
1050 | static u32 d40_get_prmo(struct d40_chan *d40c) | 1173 | static u32 d40_get_prmo(struct d40_chan *d40c) |
1051 | { | 1174 | { |
1052 | static const unsigned int phy_map[] = { | 1175 | static const unsigned int phy_map[] = { |
@@ -1149,15 +1272,7 @@ static int d40_pause(struct d40_chan *d40c) | |||
1149 | spin_lock_irqsave(&d40c->lock, flags); | 1272 | spin_lock_irqsave(&d40c->lock, flags); |
1150 | 1273 | ||
1151 | res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); | 1274 | res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); |
1152 | if (res == 0) { | 1275 | |
1153 | if (chan_is_logical(d40c)) { | ||
1154 | d40_config_set_event(d40c, false); | ||
1155 | /* Resume the other logical channels if any */ | ||
1156 | if (d40_chan_has_events(d40c)) | ||
1157 | res = d40_channel_execute_command(d40c, | ||
1158 | D40_DMA_RUN); | ||
1159 | } | ||
1160 | } | ||
1161 | pm_runtime_mark_last_busy(d40c->base->dev); | 1276 | pm_runtime_mark_last_busy(d40c->base->dev); |
1162 | pm_runtime_put_autosuspend(d40c->base->dev); | 1277 | pm_runtime_put_autosuspend(d40c->base->dev); |
1163 | spin_unlock_irqrestore(&d40c->lock, flags); | 1278 | spin_unlock_irqrestore(&d40c->lock, flags); |
@@ -1174,45 +1289,17 @@ static int d40_resume(struct d40_chan *d40c) | |||
1174 | 1289 | ||
1175 | spin_lock_irqsave(&d40c->lock, flags); | 1290 | spin_lock_irqsave(&d40c->lock, flags); |
1176 | pm_runtime_get_sync(d40c->base->dev); | 1291 | pm_runtime_get_sync(d40c->base->dev); |
1177 | if (d40c->base->rev == 0) | ||
1178 | if (chan_is_logical(d40c)) { | ||
1179 | res = d40_channel_execute_command(d40c, | ||
1180 | D40_DMA_SUSPEND_REQ); | ||
1181 | goto no_suspend; | ||
1182 | } | ||
1183 | 1292 | ||
1184 | /* If bytes left to transfer or linked tx resume job */ | 1293 | /* If bytes left to transfer or linked tx resume job */ |
1185 | if (d40_residue(d40c) || d40_tx_is_linked(d40c)) { | 1294 | if (d40_residue(d40c) || d40_tx_is_linked(d40c)) |
1186 | |||
1187 | if (chan_is_logical(d40c)) | ||
1188 | d40_config_set_event(d40c, true); | ||
1189 | |||
1190 | res = d40_channel_execute_command(d40c, D40_DMA_RUN); | 1295 | res = d40_channel_execute_command(d40c, D40_DMA_RUN); |
1191 | } | ||
1192 | 1296 | ||
1193 | no_suspend: | ||
1194 | pm_runtime_mark_last_busy(d40c->base->dev); | 1297 | pm_runtime_mark_last_busy(d40c->base->dev); |
1195 | pm_runtime_put_autosuspend(d40c->base->dev); | 1298 | pm_runtime_put_autosuspend(d40c->base->dev); |
1196 | spin_unlock_irqrestore(&d40c->lock, flags); | 1299 | spin_unlock_irqrestore(&d40c->lock, flags); |
1197 | return res; | 1300 | return res; |
1198 | } | 1301 | } |
1199 | 1302 | ||
1200 | static int d40_terminate_all(struct d40_chan *chan) | ||
1201 | { | ||
1202 | unsigned long flags; | ||
1203 | int ret = 0; | ||
1204 | |||
1205 | ret = d40_pause(chan); | ||
1206 | if (!ret && chan_is_physical(chan)) | ||
1207 | ret = d40_channel_execute_command(chan, D40_DMA_STOP); | ||
1208 | |||
1209 | spin_lock_irqsave(&chan->lock, flags); | ||
1210 | d40_term_all(chan); | ||
1211 | spin_unlock_irqrestore(&chan->lock, flags); | ||
1212 | |||
1213 | return ret; | ||
1214 | } | ||
1215 | |||
1216 | static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx) | 1303 | static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx) |
1217 | { | 1304 | { |
1218 | struct d40_chan *d40c = container_of(tx->chan, | 1305 | struct d40_chan *d40c = container_of(tx->chan, |
@@ -1232,20 +1319,6 @@ static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx) | |||
1232 | 1319 | ||
1233 | static int d40_start(struct d40_chan *d40c) | 1320 | static int d40_start(struct d40_chan *d40c) |
1234 | { | 1321 | { |
1235 | if (d40c->base->rev == 0) { | ||
1236 | int err; | ||
1237 | |||
1238 | if (chan_is_logical(d40c)) { | ||
1239 | err = d40_channel_execute_command(d40c, | ||
1240 | D40_DMA_SUSPEND_REQ); | ||
1241 | if (err) | ||
1242 | return err; | ||
1243 | } | ||
1244 | } | ||
1245 | |||
1246 | if (chan_is_logical(d40c)) | ||
1247 | d40_config_set_event(d40c, true); | ||
1248 | |||
1249 | return d40_channel_execute_command(d40c, D40_DMA_RUN); | 1322 | return d40_channel_execute_command(d40c, D40_DMA_RUN); |
1250 | } | 1323 | } |
1251 | 1324 | ||
@@ -1258,10 +1331,10 @@ static struct d40_desc *d40_queue_start(struct d40_chan *d40c) | |||
1258 | d40d = d40_first_queued(d40c); | 1331 | d40d = d40_first_queued(d40c); |
1259 | 1332 | ||
1260 | if (d40d != NULL) { | 1333 | if (d40d != NULL) { |
1261 | if (!d40c->busy) | 1334 | if (!d40c->busy) { |
1262 | d40c->busy = true; | 1335 | d40c->busy = true; |
1263 | 1336 | pm_runtime_get_sync(d40c->base->dev); | |
1264 | pm_runtime_get_sync(d40c->base->dev); | 1337 | } |
1265 | 1338 | ||
1266 | /* Remove from queue */ | 1339 | /* Remove from queue */ |
1267 | d40_desc_remove(d40d); | 1340 | d40_desc_remove(d40d); |
@@ -1388,8 +1461,8 @@ static void dma_tasklet(unsigned long data) | |||
1388 | 1461 | ||
1389 | return; | 1462 | return; |
1390 | 1463 | ||
1391 | err: | 1464 | err: |
1392 | /* Rescue manoeuvre if receiving double interrupts */ | 1465 | /* Rescue manouver if receiving double interrupts */ |
1393 | if (d40c->pending_tx > 0) | 1466 | if (d40c->pending_tx > 0) |
1394 | d40c->pending_tx--; | 1467 | d40c->pending_tx--; |
1395 | spin_unlock_irqrestore(&d40c->lock, flags); | 1468 | spin_unlock_irqrestore(&d40c->lock, flags); |
@@ -1770,7 +1843,6 @@ static int d40_config_memcpy(struct d40_chan *d40c) | |||
1770 | return 0; | 1843 | return 0; |
1771 | } | 1844 | } |
1772 | 1845 | ||
1773 | |||
1774 | static int d40_free_dma(struct d40_chan *d40c) | 1846 | static int d40_free_dma(struct d40_chan *d40c) |
1775 | { | 1847 | { |
1776 | 1848 | ||
@@ -1806,43 +1878,18 @@ static int d40_free_dma(struct d40_chan *d40c) | |||
1806 | } | 1878 | } |
1807 | 1879 | ||
1808 | pm_runtime_get_sync(d40c->base->dev); | 1880 | pm_runtime_get_sync(d40c->base->dev); |
1809 | res = d40_channel_execute_command(d40c, D40_DMA_SUSPEND_REQ); | 1881 | res = d40_channel_execute_command(d40c, D40_DMA_STOP); |
1810 | if (res) { | 1882 | if (res) { |
1811 | chan_err(d40c, "suspend failed\n"); | 1883 | chan_err(d40c, "stop failed\n"); |
1812 | goto out; | 1884 | goto out; |
1813 | } | 1885 | } |
1814 | 1886 | ||
1815 | if (chan_is_logical(d40c)) { | 1887 | d40_alloc_mask_free(phy, is_src, chan_is_logical(d40c) ? event : 0); |
1816 | /* Release logical channel, deactivate the event line */ | ||
1817 | 1888 | ||
1818 | d40_config_set_event(d40c, false); | 1889 | if (chan_is_logical(d40c)) |
1819 | d40c->base->lookup_log_chans[d40c->log_num] = NULL; | 1890 | d40c->base->lookup_log_chans[d40c->log_num] = NULL; |
1820 | 1891 | else | |
1821 | /* | 1892 | d40c->base->lookup_phy_chans[phy->num] = NULL; |
1822 | * Check if there are more logical allocation | ||
1823 | * on this phy channel. | ||
1824 | */ | ||
1825 | if (!d40_alloc_mask_free(phy, is_src, event)) { | ||
1826 | /* Resume the other logical channels if any */ | ||
1827 | if (d40_chan_has_events(d40c)) { | ||
1828 | res = d40_channel_execute_command(d40c, | ||
1829 | D40_DMA_RUN); | ||
1830 | if (res) | ||
1831 | chan_err(d40c, | ||
1832 | "Executing RUN command\n"); | ||
1833 | } | ||
1834 | goto out; | ||
1835 | } | ||
1836 | } else { | ||
1837 | (void) d40_alloc_mask_free(phy, is_src, 0); | ||
1838 | } | ||
1839 | |||
1840 | /* Release physical channel */ | ||
1841 | res = d40_channel_execute_command(d40c, D40_DMA_STOP); | ||
1842 | if (res) { | ||
1843 | chan_err(d40c, "Failed to stop channel\n"); | ||
1844 | goto out; | ||
1845 | } | ||
1846 | 1893 | ||
1847 | if (d40c->busy) { | 1894 | if (d40c->busy) { |
1848 | pm_runtime_mark_last_busy(d40c->base->dev); | 1895 | pm_runtime_mark_last_busy(d40c->base->dev); |
@@ -1852,7 +1899,6 @@ static int d40_free_dma(struct d40_chan *d40c) | |||
1852 | d40c->busy = false; | 1899 | d40c->busy = false; |
1853 | d40c->phy_chan = NULL; | 1900 | d40c->phy_chan = NULL; |
1854 | d40c->configured = false; | 1901 | d40c->configured = false; |
1855 | d40c->base->lookup_phy_chans[phy->num] = NULL; | ||
1856 | out: | 1902 | out: |
1857 | 1903 | ||
1858 | pm_runtime_mark_last_busy(d40c->base->dev); | 1904 | pm_runtime_mark_last_busy(d40c->base->dev); |
@@ -2070,7 +2116,7 @@ d40_prep_sg(struct dma_chan *dchan, struct scatterlist *sg_src, | |||
2070 | if (sg_next(&sg_src[sg_len - 1]) == sg_src) | 2116 | if (sg_next(&sg_src[sg_len - 1]) == sg_src) |
2071 | desc->cyclic = true; | 2117 | desc->cyclic = true; |
2072 | 2118 | ||
2073 | if (direction != DMA_NONE) { | 2119 | if (direction != DMA_TRANS_NONE) { |
2074 | dma_addr_t dev_addr = d40_get_dev_addr(chan, direction); | 2120 | dma_addr_t dev_addr = d40_get_dev_addr(chan, direction); |
2075 | 2121 | ||
2076 | if (direction == DMA_DEV_TO_MEM) | 2122 | if (direction == DMA_DEV_TO_MEM) |
@@ -2371,6 +2417,31 @@ static void d40_issue_pending(struct dma_chan *chan) | |||
2371 | spin_unlock_irqrestore(&d40c->lock, flags); | 2417 | spin_unlock_irqrestore(&d40c->lock, flags); |
2372 | } | 2418 | } |
2373 | 2419 | ||
2420 | static void d40_terminate_all(struct dma_chan *chan) | ||
2421 | { | ||
2422 | unsigned long flags; | ||
2423 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); | ||
2424 | int ret; | ||
2425 | |||
2426 | spin_lock_irqsave(&d40c->lock, flags); | ||
2427 | |||
2428 | pm_runtime_get_sync(d40c->base->dev); | ||
2429 | ret = d40_channel_execute_command(d40c, D40_DMA_STOP); | ||
2430 | if (ret) | ||
2431 | chan_err(d40c, "Failed to stop channel\n"); | ||
2432 | |||
2433 | d40_term_all(d40c); | ||
2434 | pm_runtime_mark_last_busy(d40c->base->dev); | ||
2435 | pm_runtime_put_autosuspend(d40c->base->dev); | ||
2436 | if (d40c->busy) { | ||
2437 | pm_runtime_mark_last_busy(d40c->base->dev); | ||
2438 | pm_runtime_put_autosuspend(d40c->base->dev); | ||
2439 | } | ||
2440 | d40c->busy = false; | ||
2441 | |||
2442 | spin_unlock_irqrestore(&d40c->lock, flags); | ||
2443 | } | ||
2444 | |||
2374 | static int | 2445 | static int |
2375 | dma40_config_to_halfchannel(struct d40_chan *d40c, | 2446 | dma40_config_to_halfchannel(struct d40_chan *d40c, |
2376 | struct stedma40_half_channel_info *info, | 2447 | struct stedma40_half_channel_info *info, |
@@ -2551,7 +2622,8 @@ static int d40_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
2551 | 2622 | ||
2552 | switch (cmd) { | 2623 | switch (cmd) { |
2553 | case DMA_TERMINATE_ALL: | 2624 | case DMA_TERMINATE_ALL: |
2554 | return d40_terminate_all(d40c); | 2625 | d40_terminate_all(chan); |
2626 | return 0; | ||
2555 | case DMA_PAUSE: | 2627 | case DMA_PAUSE: |
2556 | return d40_pause(d40c); | 2628 | return d40_pause(d40c); |
2557 | case DMA_RESUME: | 2629 | case DMA_RESUME: |
@@ -2908,6 +2980,12 @@ static struct d40_base * __init d40_hw_detect_init(struct platform_device *pdev) | |||
2908 | dev_info(&pdev->dev, "hardware revision: %d @ 0x%x\n", | 2980 | dev_info(&pdev->dev, "hardware revision: %d @ 0x%x\n", |
2909 | rev, res->start); | 2981 | rev, res->start); |
2910 | 2982 | ||
2983 | if (rev < 2) { | ||
2984 | d40_err(&pdev->dev, "hardware revision: %d is not supported", | ||
2985 | rev); | ||
2986 | goto failure; | ||
2987 | } | ||
2988 | |||
2911 | plat_data = pdev->dev.platform_data; | 2989 | plat_data = pdev->dev.platform_data; |
2912 | 2990 | ||
2913 | /* Count the number of logical channels in use */ | 2991 | /* Count the number of logical channels in use */ |
@@ -2998,6 +3076,7 @@ failure: | |||
2998 | 3076 | ||
2999 | if (base) { | 3077 | if (base) { |
3000 | kfree(base->lcla_pool.alloc_map); | 3078 | kfree(base->lcla_pool.alloc_map); |
3079 | kfree(base->reg_val_backup_chan); | ||
3001 | kfree(base->lookup_log_chans); | 3080 | kfree(base->lookup_log_chans); |
3002 | kfree(base->lookup_phy_chans); | 3081 | kfree(base->lookup_phy_chans); |
3003 | kfree(base->phy_res); | 3082 | kfree(base->phy_res); |
diff --git a/drivers/dma/ste_dma40_ll.h b/drivers/dma/ste_dma40_ll.h index 8d3d490968a3..51e8e5396e9b 100644 --- a/drivers/dma/ste_dma40_ll.h +++ b/drivers/dma/ste_dma40_ll.h | |||
@@ -62,8 +62,6 @@ | |||
62 | #define D40_SREG_ELEM_LOG_LIDX_MASK (0xFF << D40_SREG_ELEM_LOG_LIDX_POS) | 62 | #define D40_SREG_ELEM_LOG_LIDX_MASK (0xFF << D40_SREG_ELEM_LOG_LIDX_POS) |
63 | 63 | ||
64 | /* Link register */ | 64 | /* Link register */ |
65 | #define D40_DEACTIVATE_EVENTLINE 0x0 | ||
66 | #define D40_ACTIVATE_EVENTLINE 0x1 | ||
67 | #define D40_EVENTLINE_POS(i) (2 * i) | 65 | #define D40_EVENTLINE_POS(i) (2 * i) |
68 | #define D40_EVENTLINE_MASK(i) (0x3 << D40_EVENTLINE_POS(i)) | 66 | #define D40_EVENTLINE_MASK(i) (0x3 << D40_EVENTLINE_POS(i)) |
69 | 67 | ||
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c index d25599f2a3f8..47408e802ab6 100644 --- a/drivers/firmware/efivars.c +++ b/drivers/firmware/efivars.c | |||
@@ -191,6 +191,190 @@ utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len) | |||
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | static bool | ||
195 | validate_device_path(struct efi_variable *var, int match, u8 *buffer, | ||
196 | unsigned long len) | ||
197 | { | ||
198 | struct efi_generic_dev_path *node; | ||
199 | int offset = 0; | ||
200 | |||
201 | node = (struct efi_generic_dev_path *)buffer; | ||
202 | |||
203 | if (len < sizeof(*node)) | ||
204 | return false; | ||
205 | |||
206 | while (offset <= len - sizeof(*node) && | ||
207 | node->length >= sizeof(*node) && | ||
208 | node->length <= len - offset) { | ||
209 | offset += node->length; | ||
210 | |||
211 | if ((node->type == EFI_DEV_END_PATH || | ||
212 | node->type == EFI_DEV_END_PATH2) && | ||
213 | node->sub_type == EFI_DEV_END_ENTIRE) | ||
214 | return true; | ||
215 | |||
216 | node = (struct efi_generic_dev_path *)(buffer + offset); | ||
217 | } | ||
218 | |||
219 | /* | ||
220 | * If we're here then either node->length pointed past the end | ||
221 | * of the buffer or we reached the end of the buffer without | ||
222 | * finding a device path end node. | ||
223 | */ | ||
224 | return false; | ||
225 | } | ||
226 | |||
227 | static bool | ||
228 | validate_boot_order(struct efi_variable *var, int match, u8 *buffer, | ||
229 | unsigned long len) | ||
230 | { | ||
231 | /* An array of 16-bit integers */ | ||
232 | if ((len % 2) != 0) | ||
233 | return false; | ||
234 | |||
235 | return true; | ||
236 | } | ||
237 | |||
238 | static bool | ||
239 | validate_load_option(struct efi_variable *var, int match, u8 *buffer, | ||
240 | unsigned long len) | ||
241 | { | ||
242 | u16 filepathlength; | ||
243 | int i, desclength = 0, namelen; | ||
244 | |||
245 | namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName)); | ||
246 | |||
247 | /* Either "Boot" or "Driver" followed by four digits of hex */ | ||
248 | for (i = match; i < match+4; i++) { | ||
249 | if (var->VariableName[i] > 127 || | ||
250 | hex_to_bin(var->VariableName[i] & 0xff) < 0) | ||
251 | return true; | ||
252 | } | ||
253 | |||
254 | /* Reject it if there's 4 digits of hex and then further content */ | ||
255 | if (namelen > match + 4) | ||
256 | return false; | ||
257 | |||
258 | /* A valid entry must be at least 8 bytes */ | ||
259 | if (len < 8) | ||
260 | return false; | ||
261 | |||
262 | filepathlength = buffer[4] | buffer[5] << 8; | ||
263 | |||
264 | /* | ||
265 | * There's no stored length for the description, so it has to be | ||
266 | * found by hand | ||
267 | */ | ||
268 | desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2; | ||
269 | |||
270 | /* Each boot entry must have a descriptor */ | ||
271 | if (!desclength) | ||
272 | return false; | ||
273 | |||
274 | /* | ||
275 | * If the sum of the length of the description, the claimed filepath | ||
276 | * length and the original header are greater than the length of the | ||
277 | * variable, it's malformed | ||
278 | */ | ||
279 | if ((desclength + filepathlength + 6) > len) | ||
280 | return false; | ||
281 | |||
282 | /* | ||
283 | * And, finally, check the filepath | ||
284 | */ | ||
285 | return validate_device_path(var, match, buffer + desclength + 6, | ||
286 | filepathlength); | ||
287 | } | ||
288 | |||
289 | static bool | ||
290 | validate_uint16(struct efi_variable *var, int match, u8 *buffer, | ||
291 | unsigned long len) | ||
292 | { | ||
293 | /* A single 16-bit integer */ | ||
294 | if (len != 2) | ||
295 | return false; | ||
296 | |||
297 | return true; | ||
298 | } | ||
299 | |||
300 | static bool | ||
301 | validate_ascii_string(struct efi_variable *var, int match, u8 *buffer, | ||
302 | unsigned long len) | ||
303 | { | ||
304 | int i; | ||
305 | |||
306 | for (i = 0; i < len; i++) { | ||
307 | if (buffer[i] > 127) | ||
308 | return false; | ||
309 | |||
310 | if (buffer[i] == 0) | ||
311 | return true; | ||
312 | } | ||
313 | |||
314 | return false; | ||
315 | } | ||
316 | |||
317 | struct variable_validate { | ||
318 | char *name; | ||
319 | bool (*validate)(struct efi_variable *var, int match, u8 *data, | ||
320 | unsigned long len); | ||
321 | }; | ||
322 | |||
323 | static const struct variable_validate variable_validate[] = { | ||
324 | { "BootNext", validate_uint16 }, | ||
325 | { "BootOrder", validate_boot_order }, | ||
326 | { "DriverOrder", validate_boot_order }, | ||
327 | { "Boot*", validate_load_option }, | ||
328 | { "Driver*", validate_load_option }, | ||
329 | { "ConIn", validate_device_path }, | ||
330 | { "ConInDev", validate_device_path }, | ||
331 | { "ConOut", validate_device_path }, | ||
332 | { "ConOutDev", validate_device_path }, | ||
333 | { "ErrOut", validate_device_path }, | ||
334 | { "ErrOutDev", validate_device_path }, | ||
335 | { "Timeout", validate_uint16 }, | ||
336 | { "Lang", validate_ascii_string }, | ||
337 | { "PlatformLang", validate_ascii_string }, | ||
338 | { "", NULL }, | ||
339 | }; | ||
340 | |||
341 | static bool | ||
342 | validate_var(struct efi_variable *var, u8 *data, unsigned long len) | ||
343 | { | ||
344 | int i; | ||
345 | u16 *unicode_name = var->VariableName; | ||
346 | |||
347 | for (i = 0; variable_validate[i].validate != NULL; i++) { | ||
348 | const char *name = variable_validate[i].name; | ||
349 | int match; | ||
350 | |||
351 | for (match = 0; ; match++) { | ||
352 | char c = name[match]; | ||
353 | u16 u = unicode_name[match]; | ||
354 | |||
355 | /* All special variables are plain ascii */ | ||
356 | if (u > 127) | ||
357 | return true; | ||
358 | |||
359 | /* Wildcard in the matching name means we've matched */ | ||
360 | if (c == '*') | ||
361 | return variable_validate[i].validate(var, | ||
362 | match, data, len); | ||
363 | |||
364 | /* Case sensitive match */ | ||
365 | if (c != u) | ||
366 | break; | ||
367 | |||
368 | /* Reached the end of the string while matching */ | ||
369 | if (!c) | ||
370 | return variable_validate[i].validate(var, | ||
371 | match, data, len); | ||
372 | } | ||
373 | } | ||
374 | |||
375 | return true; | ||
376 | } | ||
377 | |||
194 | static efi_status_t | 378 | static efi_status_t |
195 | get_var_data_locked(struct efivars *efivars, struct efi_variable *var) | 379 | get_var_data_locked(struct efivars *efivars, struct efi_variable *var) |
196 | { | 380 | { |
@@ -324,6 +508,12 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count) | |||
324 | return -EINVAL; | 508 | return -EINVAL; |
325 | } | 509 | } |
326 | 510 | ||
511 | if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || | ||
512 | validate_var(new_var, new_var->Data, new_var->DataSize) == false) { | ||
513 | printk(KERN_ERR "efivars: Malformed variable content\n"); | ||
514 | return -EINVAL; | ||
515 | } | ||
516 | |||
327 | spin_lock(&efivars->lock); | 517 | spin_lock(&efivars->lock); |
328 | status = efivars->ops->set_variable(new_var->VariableName, | 518 | status = efivars->ops->set_variable(new_var->VariableName, |
329 | &new_var->VendorGuid, | 519 | &new_var->VendorGuid, |
@@ -626,6 +816,12 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj, | |||
626 | if (!capable(CAP_SYS_ADMIN)) | 816 | if (!capable(CAP_SYS_ADMIN)) |
627 | return -EACCES; | 817 | return -EACCES; |
628 | 818 | ||
819 | if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 || | ||
820 | validate_var(new_var, new_var->Data, new_var->DataSize) == false) { | ||
821 | printk(KERN_ERR "efivars: Malformed variable content\n"); | ||
822 | return -EINVAL; | ||
823 | } | ||
824 | |||
629 | spin_lock(&efivars->lock); | 825 | spin_lock(&efivars->lock); |
630 | 826 | ||
631 | /* | 827 | /* |
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 5689ce62fd81..fc3ace3fd4cb 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c | |||
@@ -64,6 +64,7 @@ struct pxa_gpio_chip { | |||
64 | unsigned long irq_mask; | 64 | unsigned long irq_mask; |
65 | unsigned long irq_edge_rise; | 65 | unsigned long irq_edge_rise; |
66 | unsigned long irq_edge_fall; | 66 | unsigned long irq_edge_fall; |
67 | int (*set_wake)(unsigned int gpio, unsigned int on); | ||
67 | 68 | ||
68 | #ifdef CONFIG_PM | 69 | #ifdef CONFIG_PM |
69 | unsigned long saved_gplr; | 70 | unsigned long saved_gplr; |
@@ -269,7 +270,8 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
269 | (value ? GPSR_OFFSET : GPCR_OFFSET)); | 270 | (value ? GPSR_OFFSET : GPCR_OFFSET)); |
270 | } | 271 | } |
271 | 272 | ||
272 | static int __devinit pxa_init_gpio_chip(int gpio_end) | 273 | static int __devinit pxa_init_gpio_chip(int gpio_end, |
274 | int (*set_wake)(unsigned int, unsigned int)) | ||
273 | { | 275 | { |
274 | int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; | 276 | int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; |
275 | struct pxa_gpio_chip *chips; | 277 | struct pxa_gpio_chip *chips; |
@@ -285,6 +287,7 @@ static int __devinit pxa_init_gpio_chip(int gpio_end) | |||
285 | 287 | ||
286 | sprintf(chips[i].label, "gpio-%d", i); | 288 | sprintf(chips[i].label, "gpio-%d", i); |
287 | chips[i].regbase = gpio_reg_base + BANK_OFF(i); | 289 | chips[i].regbase = gpio_reg_base + BANK_OFF(i); |
290 | chips[i].set_wake = set_wake; | ||
288 | 291 | ||
289 | c->base = gpio; | 292 | c->base = gpio; |
290 | c->label = chips[i].label; | 293 | c->label = chips[i].label; |
@@ -412,6 +415,17 @@ static void pxa_mask_muxed_gpio(struct irq_data *d) | |||
412 | writel_relaxed(gfer, c->regbase + GFER_OFFSET); | 415 | writel_relaxed(gfer, c->regbase + GFER_OFFSET); |
413 | } | 416 | } |
414 | 417 | ||
418 | static int pxa_gpio_set_wake(struct irq_data *d, unsigned int on) | ||
419 | { | ||
420 | int gpio = pxa_irq_to_gpio(d->irq); | ||
421 | struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); | ||
422 | |||
423 | if (c->set_wake) | ||
424 | return c->set_wake(gpio, on); | ||
425 | else | ||
426 | return 0; | ||
427 | } | ||
428 | |||
415 | static void pxa_unmask_muxed_gpio(struct irq_data *d) | 429 | static void pxa_unmask_muxed_gpio(struct irq_data *d) |
416 | { | 430 | { |
417 | int gpio = pxa_irq_to_gpio(d->irq); | 431 | int gpio = pxa_irq_to_gpio(d->irq); |
@@ -427,6 +441,7 @@ static struct irq_chip pxa_muxed_gpio_chip = { | |||
427 | .irq_mask = pxa_mask_muxed_gpio, | 441 | .irq_mask = pxa_mask_muxed_gpio, |
428 | .irq_unmask = pxa_unmask_muxed_gpio, | 442 | .irq_unmask = pxa_unmask_muxed_gpio, |
429 | .irq_set_type = pxa_gpio_irq_type, | 443 | .irq_set_type = pxa_gpio_irq_type, |
444 | .irq_set_wake = pxa_gpio_set_wake, | ||
430 | }; | 445 | }; |
431 | 446 | ||
432 | static int pxa_gpio_nums(void) | 447 | static int pxa_gpio_nums(void) |
@@ -471,6 +486,7 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) | |||
471 | struct pxa_gpio_chip *c; | 486 | struct pxa_gpio_chip *c; |
472 | struct resource *res; | 487 | struct resource *res; |
473 | struct clk *clk; | 488 | struct clk *clk; |
489 | struct pxa_gpio_platform_data *info; | ||
474 | int gpio, irq, ret; | 490 | int gpio, irq, ret; |
475 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; | 491 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; |
476 | 492 | ||
@@ -516,7 +532,8 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) | |||
516 | } | 532 | } |
517 | 533 | ||
518 | /* Initialize GPIO chips */ | 534 | /* Initialize GPIO chips */ |
519 | pxa_init_gpio_chip(pxa_last_gpio); | 535 | info = dev_get_platdata(&pdev->dev); |
536 | pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL); | ||
520 | 537 | ||
521 | /* clear all GPIO edge detects */ | 538 | /* clear all GPIO edge detects */ |
522 | for_each_gpio_chip(gpio, c) { | 539 | for_each_gpio_chip(gpio, c) { |
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 30372f7b2d45..348b367debeb 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -1510,8 +1510,8 @@ int drm_freebufs(struct drm_device *dev, void *data, | |||
1510 | * \param arg pointer to a drm_buf_map structure. | 1510 | * \param arg pointer to a drm_buf_map structure. |
1511 | * \return zero on success or a negative number on failure. | 1511 | * \return zero on success or a negative number on failure. |
1512 | * | 1512 | * |
1513 | * Maps the AGP, SG or PCI buffer region with do_mmap(), and copies information | 1513 | * Maps the AGP, SG or PCI buffer region with vm_mmap(), and copies information |
1514 | * about each buffer into user space. For PCI buffers, it calls do_mmap() with | 1514 | * about each buffer into user space. For PCI buffers, it calls vm_mmap() with |
1515 | * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls | 1515 | * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls |
1516 | * drm_mmap_dma(). | 1516 | * drm_mmap_dma(). |
1517 | */ | 1517 | */ |
@@ -1553,18 +1553,14 @@ int drm_mapbufs(struct drm_device *dev, void *data, | |||
1553 | retcode = -EINVAL; | 1553 | retcode = -EINVAL; |
1554 | goto done; | 1554 | goto done; |
1555 | } | 1555 | } |
1556 | down_write(¤t->mm->mmap_sem); | 1556 | virtual = vm_mmap(file_priv->filp, 0, map->size, |
1557 | virtual = do_mmap(file_priv->filp, 0, map->size, | ||
1558 | PROT_READ | PROT_WRITE, | 1557 | PROT_READ | PROT_WRITE, |
1559 | MAP_SHARED, | 1558 | MAP_SHARED, |
1560 | token); | 1559 | token); |
1561 | up_write(¤t->mm->mmap_sem); | ||
1562 | } else { | 1560 | } else { |
1563 | down_write(¤t->mm->mmap_sem); | 1561 | virtual = vm_mmap(file_priv->filp, 0, dma->byte_count, |
1564 | virtual = do_mmap(file_priv->filp, 0, dma->byte_count, | ||
1565 | PROT_READ | PROT_WRITE, | 1562 | PROT_READ | PROT_WRITE, |
1566 | MAP_SHARED, 0); | 1563 | MAP_SHARED, 0); |
1567 | up_write(¤t->mm->mmap_sem); | ||
1568 | } | 1564 | } |
1569 | if (virtual > -1024UL) { | 1565 | if (virtual > -1024UL) { |
1570 | /* Real error */ | 1566 | /* Real error */ |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d3aaeb6ae236..c79870a75c2f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -3335,10 +3335,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
3335 | 3335 | ||
3336 | ret = crtc->funcs->page_flip(crtc, fb, e); | 3336 | ret = crtc->funcs->page_flip(crtc, fb, e); |
3337 | if (ret) { | 3337 | if (ret) { |
3338 | spin_lock_irqsave(&dev->event_lock, flags); | 3338 | if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { |
3339 | file_priv->event_space += sizeof e->event; | 3339 | spin_lock_irqsave(&dev->event_lock, flags); |
3340 | spin_unlock_irqrestore(&dev->event_lock, flags); | 3340 | file_priv->event_space += sizeof e->event; |
3341 | kfree(e); | 3341 | spin_unlock_irqrestore(&dev->event_lock, flags); |
3342 | kfree(e); | ||
3343 | } | ||
3342 | } | 3344 | } |
3343 | 3345 | ||
3344 | out: | 3346 | out: |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index cdfbf27b2b3c..123de28f94ef 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -507,12 +507,12 @@ int drm_release(struct inode *inode, struct file *filp) | |||
507 | 507 | ||
508 | drm_events_release(file_priv); | 508 | drm_events_release(file_priv); |
509 | 509 | ||
510 | if (dev->driver->driver_features & DRIVER_GEM) | ||
511 | drm_gem_release(dev, file_priv); | ||
512 | |||
513 | if (dev->driver->driver_features & DRIVER_MODESET) | 510 | if (dev->driver->driver_features & DRIVER_MODESET) |
514 | drm_fb_release(file_priv); | 511 | drm_fb_release(file_priv); |
515 | 512 | ||
513 | if (dev->driver->driver_features & DRIVER_GEM) | ||
514 | drm_gem_release(dev, file_priv); | ||
515 | |||
516 | mutex_lock(&dev->ctxlist_mutex); | 516 | mutex_lock(&dev->ctxlist_mutex); |
517 | if (!list_empty(&dev->ctxlist)) { | 517 | if (!list_empty(&dev->ctxlist)) { |
518 | struct drm_ctx_list *pos, *n; | 518 | struct drm_ctx_list *pos, *n; |
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c index c8c83dad2ce1..37c9a523dd1c 100644 --- a/drivers/gpu/drm/drm_usb.c +++ b/drivers/gpu/drm/drm_usb.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "drmP.h" | 1 | #include "drmP.h" |
2 | #include <linux/usb.h> | 2 | #include <linux/usb.h> |
3 | #include <linux/export.h> | 3 | #include <linux/module.h> |
4 | 4 | ||
5 | int drm_get_usb_dev(struct usb_interface *interface, | 5 | int drm_get_usb_dev(struct usb_interface *interface, |
6 | const struct usb_device_id *id, | 6 | const struct usb_device_id *id, |
@@ -114,3 +114,7 @@ void drm_usb_exit(struct drm_driver *driver, | |||
114 | usb_deregister(udriver); | 114 | usb_deregister(udriver); |
115 | } | 115 | } |
116 | EXPORT_SYMBOL(drm_usb_exit); | 116 | EXPORT_SYMBOL(drm_usb_exit); |
117 | |||
118 | MODULE_AUTHOR("David Airlie"); | ||
119 | MODULE_DESCRIPTION("USB DRM support"); | ||
120 | MODULE_LICENSE("GPL and additional rights"); | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 26d51979116b..1dffa8359f88 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
@@ -149,22 +149,12 @@ static int exynos_drm_gem_map_pages(struct drm_gem_object *obj, | |||
149 | unsigned long pfn; | 149 | unsigned long pfn; |
150 | 150 | ||
151 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { | 151 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { |
152 | unsigned long usize = buf->size; | ||
153 | |||
154 | if (!buf->pages) | 152 | if (!buf->pages) |
155 | return -EINTR; | 153 | return -EINTR; |
156 | 154 | ||
157 | while (usize > 0) { | 155 | pfn = page_to_pfn(buf->pages[page_offset++]); |
158 | pfn = page_to_pfn(buf->pages[page_offset++]); | 156 | } else |
159 | vm_insert_mixed(vma, f_vaddr, pfn); | 157 | pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset; |
160 | f_vaddr += PAGE_SIZE; | ||
161 | usize -= PAGE_SIZE; | ||
162 | } | ||
163 | |||
164 | return 0; | ||
165 | } | ||
166 | |||
167 | pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset; | ||
168 | 158 | ||
169 | return vm_insert_mixed(vma, f_vaddr, pfn); | 159 | return vm_insert_mixed(vma, f_vaddr, pfn); |
170 | } | 160 | } |
@@ -524,6 +514,8 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp, | |||
524 | if (!buffer->pages) | 514 | if (!buffer->pages) |
525 | return -EINVAL; | 515 | return -EINVAL; |
526 | 516 | ||
517 | vma->vm_flags |= VM_MIXEDMAP; | ||
518 | |||
527 | do { | 519 | do { |
528 | ret = vm_insert_page(vma, uaddr, buffer->pages[i++]); | 520 | ret = vm_insert_page(vma, uaddr, buffer->pages[i++]); |
529 | if (ret) { | 521 | if (ret) { |
@@ -581,10 +573,8 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
581 | obj->filp->f_op = &exynos_drm_gem_fops; | 573 | obj->filp->f_op = &exynos_drm_gem_fops; |
582 | obj->filp->private_data = obj; | 574 | obj->filp->private_data = obj; |
583 | 575 | ||
584 | down_write(¤t->mm->mmap_sem); | 576 | addr = vm_mmap(obj->filp, 0, args->size, |
585 | addr = do_mmap(obj->filp, 0, args->size, | ||
586 | PROT_READ | PROT_WRITE, MAP_SHARED, 0); | 577 | PROT_READ | PROT_WRITE, MAP_SHARED, 0); |
587 | up_write(¤t->mm->mmap_sem); | ||
588 | 578 | ||
589 | drm_gem_object_unreference_unlocked(obj); | 579 | drm_gem_object_unreference_unlocked(obj); |
590 | 580 | ||
@@ -712,7 +702,6 @@ int exynos_drm_gem_dumb_destroy(struct drm_file *file_priv, | |||
712 | int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 702 | int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
713 | { | 703 | { |
714 | struct drm_gem_object *obj = vma->vm_private_data; | 704 | struct drm_gem_object *obj = vma->vm_private_data; |
715 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); | ||
716 | struct drm_device *dev = obj->dev; | 705 | struct drm_device *dev = obj->dev; |
717 | unsigned long f_vaddr; | 706 | unsigned long f_vaddr; |
718 | pgoff_t page_offset; | 707 | pgoff_t page_offset; |
@@ -724,21 +713,10 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
724 | 713 | ||
725 | mutex_lock(&dev->struct_mutex); | 714 | mutex_lock(&dev->struct_mutex); |
726 | 715 | ||
727 | /* | ||
728 | * allocate all pages as desired size if user wants to allocate | ||
729 | * physically non-continuous memory. | ||
730 | */ | ||
731 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { | ||
732 | ret = exynos_drm_gem_get_pages(obj); | ||
733 | if (ret < 0) | ||
734 | goto err; | ||
735 | } | ||
736 | |||
737 | ret = exynos_drm_gem_map_pages(obj, vma, f_vaddr, page_offset); | 716 | ret = exynos_drm_gem_map_pages(obj, vma, f_vaddr, page_offset); |
738 | if (ret < 0) | 717 | if (ret < 0) |
739 | DRM_ERROR("failed to map pages.\n"); | 718 | DRM_ERROR("failed to map pages.\n"); |
740 | 719 | ||
741 | err: | ||
742 | mutex_unlock(&dev->struct_mutex); | 720 | mutex_unlock(&dev->struct_mutex); |
743 | 721 | ||
744 | return convert_to_vm_err_msg(ret); | 722 | return convert_to_vm_err_msg(ret); |
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers/gpu/drm/gma500/mdfld_dsi_output.h index 21071cef92a4..36eb0744841c 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_output.h +++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #define __MDFLD_DSI_OUTPUT_H__ | 29 | #define __MDFLD_DSI_OUTPUT_H__ |
30 | 30 | ||
31 | #include <linux/backlight.h> | 31 | #include <linux/backlight.h> |
32 | #include <linux/version.h> | ||
33 | #include <drm/drmP.h> | 32 | #include <drm/drmP.h> |
34 | #include <drm/drm.h> | 33 | #include <drm/drm.h> |
35 | #include <drm/drm_crtc.h> | 34 | #include <drm/drm_crtc.h> |
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 2c8a60c3b98e..f920fb5e42b6 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -129,6 +129,7 @@ static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv) | |||
129 | if (buf_priv->currently_mapped == I810_BUF_MAPPED) | 129 | if (buf_priv->currently_mapped == I810_BUF_MAPPED) |
130 | return -EINVAL; | 130 | return -EINVAL; |
131 | 131 | ||
132 | /* This is all entirely broken */ | ||
132 | down_write(¤t->mm->mmap_sem); | 133 | down_write(¤t->mm->mmap_sem); |
133 | old_fops = file_priv->filp->f_op; | 134 | old_fops = file_priv->filp->f_op; |
134 | file_priv->filp->f_op = &i810_buffer_fops; | 135 | file_priv->filp->f_op = &i810_buffer_fops; |
@@ -157,11 +158,8 @@ static int i810_unmap_buffer(struct drm_buf *buf) | |||
157 | if (buf_priv->currently_mapped != I810_BUF_MAPPED) | 158 | if (buf_priv->currently_mapped != I810_BUF_MAPPED) |
158 | return -EINVAL; | 159 | return -EINVAL; |
159 | 160 | ||
160 | down_write(¤t->mm->mmap_sem); | 161 | retcode = vm_munmap((unsigned long)buf_priv->virtual, |
161 | retcode = do_munmap(current->mm, | ||
162 | (unsigned long)buf_priv->virtual, | ||
163 | (size_t) buf->total); | 162 | (size_t) buf->total); |
164 | up_write(¤t->mm->mmap_sem); | ||
165 | 163 | ||
166 | buf_priv->currently_mapped = I810_BUF_UNMAPPED; | 164 | buf_priv->currently_mapped = I810_BUF_UNMAPPED; |
167 | buf_priv->virtual = NULL; | 165 | buf_priv->virtual = NULL; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index b505b70dba05..e6162a1681f0 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -1224,6 +1224,9 @@ static int i915_emon_status(struct seq_file *m, void *unused) | |||
1224 | unsigned long temp, chipset, gfx; | 1224 | unsigned long temp, chipset, gfx; |
1225 | int ret; | 1225 | int ret; |
1226 | 1226 | ||
1227 | if (!IS_GEN5(dev)) | ||
1228 | return -ENODEV; | ||
1229 | |||
1227 | ret = mutex_lock_interruptible(&dev->struct_mutex); | 1230 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
1228 | if (ret) | 1231 | if (ret) |
1229 | return ret; | 1232 | return ret; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 785f67f963ef..ba60f3c8f911 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1701,6 +1701,9 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv) | |||
1701 | unsigned long diffms; | 1701 | unsigned long diffms; |
1702 | u32 count; | 1702 | u32 count; |
1703 | 1703 | ||
1704 | if (dev_priv->info->gen != 5) | ||
1705 | return; | ||
1706 | |||
1704 | getrawmonotonic(&now); | 1707 | getrawmonotonic(&now); |
1705 | diff1 = timespec_sub(now, dev_priv->last_time2); | 1708 | diff1 = timespec_sub(now, dev_priv->last_time2); |
1706 | 1709 | ||
@@ -2121,12 +2124,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
2121 | setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, | 2124 | setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, |
2122 | (unsigned long) dev); | 2125 | (unsigned long) dev); |
2123 | 2126 | ||
2124 | spin_lock(&mchdev_lock); | 2127 | if (IS_GEN5(dev)) { |
2125 | i915_mch_dev = dev_priv; | 2128 | spin_lock(&mchdev_lock); |
2126 | dev_priv->mchdev_lock = &mchdev_lock; | 2129 | i915_mch_dev = dev_priv; |
2127 | spin_unlock(&mchdev_lock); | 2130 | dev_priv->mchdev_lock = &mchdev_lock; |
2131 | spin_unlock(&mchdev_lock); | ||
2128 | 2132 | ||
2129 | ips_ping_for_i915_load(); | 2133 | ips_ping_for_i915_load(); |
2134 | } | ||
2130 | 2135 | ||
2131 | return 0; | 2136 | return 0; |
2132 | 2137 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 0e3c6acde955..0d1e4b7b4b99 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1087,11 +1087,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
1087 | if (obj == NULL) | 1087 | if (obj == NULL) |
1088 | return -ENOENT; | 1088 | return -ENOENT; |
1089 | 1089 | ||
1090 | down_write(¤t->mm->mmap_sem); | 1090 | addr = vm_mmap(obj->filp, 0, args->size, |
1091 | addr = do_mmap(obj->filp, 0, args->size, | ||
1092 | PROT_READ | PROT_WRITE, MAP_SHARED, | 1091 | PROT_READ | PROT_WRITE, MAP_SHARED, |
1093 | args->offset); | 1092 | args->offset); |
1094 | up_write(¤t->mm->mmap_sem); | ||
1095 | drm_gem_object_unreference_unlocked(obj); | 1093 | drm_gem_object_unreference_unlocked(obj); |
1096 | if (IS_ERR((void *)addr)) | 1094 | if (IS_ERR((void *)addr)) |
1097 | return addr; | 1095 | return addr; |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index f51a696486cb..de431942ded4 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -1133,6 +1133,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, | |||
1133 | return -EINVAL; | 1133 | return -EINVAL; |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) { | ||
1137 | DRM_DEBUG("execbuf with %u cliprects\n", | ||
1138 | args->num_cliprects); | ||
1139 | return -EINVAL; | ||
1140 | } | ||
1136 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), | 1141 | cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects), |
1137 | GFP_KERNEL); | 1142 | GFP_KERNEL); |
1138 | if (cliprects == NULL) { | 1143 | if (cliprects == NULL) { |
@@ -1404,7 +1409,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data, | |||
1404 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; | 1409 | struct drm_i915_gem_exec_object2 *exec2_list = NULL; |
1405 | int ret; | 1410 | int ret; |
1406 | 1411 | ||
1407 | if (args->buffer_count < 1) { | 1412 | if (args->buffer_count < 1 || |
1413 | args->buffer_count > UINT_MAX / sizeof(*exec2_list)) { | ||
1408 | DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count); | 1414 | DRM_DEBUG("execbuf2 with %d buffers\n", args->buffer_count); |
1409 | return -EINVAL; | 1415 | return -EINVAL; |
1410 | } | 1416 | } |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b4bb1ef77ddc..9d24d65f0c3e 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -568,6 +568,7 @@ | |||
568 | #define CM0_MASK_SHIFT 16 | 568 | #define CM0_MASK_SHIFT 16 |
569 | #define CM0_IZ_OPT_DISABLE (1<<6) | 569 | #define CM0_IZ_OPT_DISABLE (1<<6) |
570 | #define CM0_ZR_OPT_DISABLE (1<<5) | 570 | #define CM0_ZR_OPT_DISABLE (1<<5) |
571 | #define CM0_STC_EVICT_DISABLE_LRA_SNB (1<<5) | ||
571 | #define CM0_DEPTH_EVICT_DISABLE (1<<4) | 572 | #define CM0_DEPTH_EVICT_DISABLE (1<<4) |
572 | #define CM0_COLOR_EVICT_DISABLE (1<<3) | 573 | #define CM0_COLOR_EVICT_DISABLE (1<<3) |
573 | #define CM0_DEPTH_WRITE_DISABLE (1<<1) | 574 | #define CM0_DEPTH_WRITE_DISABLE (1<<1) |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 4d3d736a4f56..90b9793fd5da 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -430,8 +430,8 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
430 | { | 430 | { |
431 | struct drm_device *dev = connector->dev; | 431 | struct drm_device *dev = connector->dev; |
432 | struct intel_crt *crt = intel_attached_crt(connector); | 432 | struct intel_crt *crt = intel_attached_crt(connector); |
433 | struct drm_crtc *crtc; | ||
434 | enum drm_connector_status status; | 433 | enum drm_connector_status status; |
434 | struct intel_load_detect_pipe tmp; | ||
435 | 435 | ||
436 | if (I915_HAS_HOTPLUG(dev)) { | 436 | if (I915_HAS_HOTPLUG(dev)) { |
437 | if (intel_crt_detect_hotplug(connector)) { | 437 | if (intel_crt_detect_hotplug(connector)) { |
@@ -450,23 +450,16 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
450 | return connector->status; | 450 | return connector->status; |
451 | 451 | ||
452 | /* for pre-945g platforms use load detect */ | 452 | /* for pre-945g platforms use load detect */ |
453 | crtc = crt->base.base.crtc; | 453 | if (intel_get_load_detect_pipe(&crt->base, connector, NULL, |
454 | if (crtc && crtc->enabled) { | 454 | &tmp)) { |
455 | status = intel_crt_load_detect(crt); | 455 | if (intel_crt_detect_ddc(connector)) |
456 | } else { | 456 | status = connector_status_connected; |
457 | struct intel_load_detect_pipe tmp; | 457 | else |
458 | 458 | status = intel_crt_load_detect(crt); | |
459 | if (intel_get_load_detect_pipe(&crt->base, connector, NULL, | 459 | intel_release_load_detect_pipe(&crt->base, connector, |
460 | &tmp)) { | 460 | &tmp); |
461 | if (intel_crt_detect_ddc(connector)) | 461 | } else |
462 | status = connector_status_connected; | 462 | status = connector_status_unknown; |
463 | else | ||
464 | status = intel_crt_load_detect(crt); | ||
465 | intel_release_load_detect_pipe(&crt->base, connector, | ||
466 | &tmp); | ||
467 | } else | ||
468 | status = connector_status_unknown; | ||
469 | } | ||
470 | 463 | ||
471 | return status; | 464 | return status; |
472 | } | 465 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index bae38acf44dc..1b1cf3b3ff51 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -3478,8 +3478,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, | |||
3478 | return false; | 3478 | return false; |
3479 | } | 3479 | } |
3480 | 3480 | ||
3481 | /* All interlaced capable intel hw wants timings in frames. */ | 3481 | /* All interlaced capable intel hw wants timings in frames. Note though |
3482 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 3482 | * that intel_lvds_mode_fixup does some funny tricks with the crtc |
3483 | * timings, so we need to be careful not to clobber these.*/ | ||
3484 | if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET)) | ||
3485 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
3483 | 3486 | ||
3484 | return true; | 3487 | return true; |
3485 | } | 3488 | } |
@@ -7069,9 +7072,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7069 | struct drm_device *dev = crtc->dev; | 7072 | struct drm_device *dev = crtc->dev; |
7070 | drm_i915_private_t *dev_priv = dev->dev_private; | 7073 | drm_i915_private_t *dev_priv = dev->dev_private; |
7071 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 7074 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
7072 | int pipe = intel_crtc->pipe; | ||
7073 | int dpll_reg = DPLL(pipe); | ||
7074 | int dpll = I915_READ(dpll_reg); | ||
7075 | 7075 | ||
7076 | if (HAS_PCH_SPLIT(dev)) | 7076 | if (HAS_PCH_SPLIT(dev)) |
7077 | return; | 7077 | return; |
@@ -7084,10 +7084,15 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7084 | * the manual case. | 7084 | * the manual case. |
7085 | */ | 7085 | */ |
7086 | if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { | 7086 | if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { |
7087 | int pipe = intel_crtc->pipe; | ||
7088 | int dpll_reg = DPLL(pipe); | ||
7089 | u32 dpll; | ||
7090 | |||
7087 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); | 7091 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); |
7088 | 7092 | ||
7089 | assert_panel_unlocked(dev_priv, pipe); | 7093 | assert_panel_unlocked(dev_priv, pipe); |
7090 | 7094 | ||
7095 | dpll = I915_READ(dpll_reg); | ||
7091 | dpll |= DISPLAY_RATE_SELECT_FPA1; | 7096 | dpll |= DISPLAY_RATE_SELECT_FPA1; |
7092 | I915_WRITE(dpll_reg, dpll); | 7097 | I915_WRITE(dpll_reg, dpll); |
7093 | intel_wait_for_vblank(dev, pipe); | 7098 | intel_wait_for_vblank(dev, pipe); |
@@ -7095,7 +7100,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7095 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) | 7100 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) |
7096 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); | 7101 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); |
7097 | } | 7102 | } |
7098 | |||
7099 | } | 7103 | } |
7100 | 7104 | ||
7101 | /** | 7105 | /** |
@@ -7465,7 +7469,13 @@ static int intel_gen6_queue_flip(struct drm_device *dev, | |||
7465 | OUT_RING(fb->pitches[0] | obj->tiling_mode); | 7469 | OUT_RING(fb->pitches[0] | obj->tiling_mode); |
7466 | OUT_RING(obj->gtt_offset); | 7470 | OUT_RING(obj->gtt_offset); |
7467 | 7471 | ||
7468 | pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; | 7472 | /* Contrary to the suggestions in the documentation, |
7473 | * "Enable Panel Fitter" does not seem to be required when page | ||
7474 | * flipping with a non-native mode, and worse causes a normal | ||
7475 | * modeset to fail. | ||
7476 | * pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; | ||
7477 | */ | ||
7478 | pf = 0; | ||
7469 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; | 7479 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; |
7470 | OUT_RING(pf | pipesrc); | 7480 | OUT_RING(pf | pipesrc); |
7471 | ADVANCE_LP_RING(); | 7481 | ADVANCE_LP_RING(); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 5a14149b3794..715afa153025 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -105,6 +105,10 @@ | |||
105 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) | 105 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) |
106 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) | 106 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) |
107 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) | 107 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) |
108 | /* This flag must be set by the encoder's mode_fixup if it changes the crtc | ||
109 | * timings in the mode to prevent the crtc fixup from overwriting them. | ||
110 | * Currently only lvds needs that. */ | ||
111 | #define INTEL_MODE_CRTC_TIMINGS_SET (0x20) | ||
108 | 112 | ||
109 | static inline void | 113 | static inline void |
110 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, | 114 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 19ecd78b8a2c..6e9ee33fd412 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -279,6 +279,8 @@ void intel_fb_restore_mode(struct drm_device *dev) | |||
279 | struct drm_mode_config *config = &dev->mode_config; | 279 | struct drm_mode_config *config = &dev->mode_config; |
280 | struct drm_plane *plane; | 280 | struct drm_plane *plane; |
281 | 281 | ||
282 | mutex_lock(&dev->mode_config.mutex); | ||
283 | |||
282 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); | 284 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); |
283 | if (ret) | 285 | if (ret) |
284 | DRM_DEBUG("failed to restore crtc mode\n"); | 286 | DRM_DEBUG("failed to restore crtc mode\n"); |
@@ -286,4 +288,6 @@ void intel_fb_restore_mode(struct drm_device *dev) | |||
286 | /* Be sure to shut off any planes that may be active */ | 288 | /* Be sure to shut off any planes that may be active */ |
287 | list_for_each_entry(plane, &config->plane_list, head) | 289 | list_for_each_entry(plane, &config->plane_list, head) |
288 | plane->funcs->disable_plane(plane); | 290 | plane->funcs->disable_plane(plane); |
291 | |||
292 | mutex_unlock(&dev->mode_config.mutex); | ||
289 | } | 293 | } |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index cae3e5f17a49..2d7f47b56b6a 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -136,7 +136,7 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder, | |||
136 | 136 | ||
137 | val &= ~VIDEO_DIP_SELECT_MASK; | 137 | val &= ~VIDEO_DIP_SELECT_MASK; |
138 | 138 | ||
139 | I915_WRITE(VIDEO_DIP_CTL, val | port | flags); | 139 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); |
140 | 140 | ||
141 | for (i = 0; i < len; i += 4) { | 141 | for (i = 0; i < len; i += 4) { |
142 | I915_WRITE(VIDEO_DIP_DATA, *data); | 142 | I915_WRITE(VIDEO_DIP_DATA, *data); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 95db2e988227..9c71183629c2 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -187,6 +187,8 @@ centre_horizontally(struct drm_display_mode *mode, | |||
187 | 187 | ||
188 | mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; | 188 | mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; |
189 | mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; | 189 | mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; |
190 | |||
191 | mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET; | ||
190 | } | 192 | } |
191 | 193 | ||
192 | static void | 194 | static void |
@@ -208,6 +210,8 @@ centre_vertically(struct drm_display_mode *mode, | |||
208 | 210 | ||
209 | mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; | 211 | mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; |
210 | mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; | 212 | mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; |
213 | |||
214 | mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET; | ||
211 | } | 215 | } |
212 | 216 | ||
213 | static inline u32 panel_fitter_scaling(u32 source, u32 target) | 217 | static inline u32 panel_fitter_scaling(u32 source, u32 target) |
@@ -283,6 +287,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
283 | for_each_pipe(pipe) | 287 | for_each_pipe(pipe) |
284 | I915_WRITE(BCLRPAT(pipe), 0); | 288 | I915_WRITE(BCLRPAT(pipe), 0); |
285 | 289 | ||
290 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
291 | |||
286 | switch (intel_lvds->fitting_mode) { | 292 | switch (intel_lvds->fitting_mode) { |
287 | case DRM_MODE_SCALE_CENTER: | 293 | case DRM_MODE_SCALE_CENTER: |
288 | /* | 294 | /* |
@@ -744,7 +750,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
744 | .ident = "Hewlett-Packard t5745", | 750 | .ident = "Hewlett-Packard t5745", |
745 | .matches = { | 751 | .matches = { |
746 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 752 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
747 | DMI_MATCH(DMI_BOARD_NAME, "hp t5745"), | 753 | DMI_MATCH(DMI_PRODUCT_NAME, "hp t5745"), |
748 | }, | 754 | }, |
749 | }, | 755 | }, |
750 | { | 756 | { |
@@ -752,7 +758,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
752 | .ident = "Hewlett-Packard st5747", | 758 | .ident = "Hewlett-Packard st5747", |
753 | .matches = { | 759 | .matches = { |
754 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 760 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
755 | DMI_MATCH(DMI_BOARD_NAME, "hp st5747"), | 761 | DMI_MATCH(DMI_PRODUCT_NAME, "hp st5747"), |
756 | }, | 762 | }, |
757 | }, | 763 | }, |
758 | { | 764 | { |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 230a141dbea3..48177ec4720e 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -47,8 +47,6 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode, | |||
47 | adjusted_mode->vtotal = fixed_mode->vtotal; | 47 | adjusted_mode->vtotal = fixed_mode->vtotal; |
48 | 48 | ||
49 | adjusted_mode->clock = fixed_mode->clock; | 49 | adjusted_mode->clock = fixed_mode->clock; |
50 | |||
51 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
52 | } | 50 | } |
53 | 51 | ||
54 | /* adjusted_mode has been preset to be the panel's fixed mode */ | 52 | /* adjusted_mode has been preset to be the panel's fixed mode */ |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index f75806e5bff5..80fce51e2f43 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -401,6 +401,14 @@ static int init_render_ring(struct intel_ring_buffer *ring) | |||
401 | if (INTEL_INFO(dev)->gen >= 6) { | 401 | if (INTEL_INFO(dev)->gen >= 6) { |
402 | I915_WRITE(INSTPM, | 402 | I915_WRITE(INSTPM, |
403 | INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING); | 403 | INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING); |
404 | |||
405 | /* From the Sandybridge PRM, volume 1 part 3, page 24: | ||
406 | * "If this bit is set, STCunit will have LRA as replacement | ||
407 | * policy. [...] This bit must be reset. LRA replacement | ||
408 | * policy is not supported." | ||
409 | */ | ||
410 | I915_WRITE(CACHE_MODE_0, | ||
411 | CM0_STC_EVICT_DISABLE_LRA_SNB << CM0_MASK_SHIFT); | ||
404 | } | 412 | } |
405 | 413 | ||
406 | return ret; | 414 | return ret; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index e36b171c1e7d..232d77d07d8b 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -731,6 +731,7 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd, | |||
731 | uint16_t width, height; | 731 | uint16_t width, height; |
732 | uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len; | 732 | uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len; |
733 | uint16_t h_sync_offset, v_sync_offset; | 733 | uint16_t h_sync_offset, v_sync_offset; |
734 | int mode_clock; | ||
734 | 735 | ||
735 | width = mode->crtc_hdisplay; | 736 | width = mode->crtc_hdisplay; |
736 | height = mode->crtc_vdisplay; | 737 | height = mode->crtc_vdisplay; |
@@ -745,7 +746,11 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd, | |||
745 | h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start; | 746 | h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start; |
746 | v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start; | 747 | v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start; |
747 | 748 | ||
748 | dtd->part1.clock = mode->clock / 10; | 749 | mode_clock = mode->clock; |
750 | mode_clock /= intel_mode_get_pixel_multiplier(mode) ?: 1; | ||
751 | mode_clock /= 10; | ||
752 | dtd->part1.clock = mode_clock; | ||
753 | |||
749 | dtd->part1.h_active = width & 0xff; | 754 | dtd->part1.h_active = width & 0xff; |
750 | dtd->part1.h_blank = h_blank_len & 0xff; | 755 | dtd->part1.h_blank = h_blank_len & 0xff; |
751 | dtd->part1.h_high = (((width >> 8) & 0xf) << 4) | | 756 | dtd->part1.h_high = (((width >> 8) & 0xf) << 4) | |
@@ -996,7 +1001,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
996 | struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder); | 1001 | struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder); |
997 | u32 sdvox; | 1002 | u32 sdvox; |
998 | struct intel_sdvo_in_out_map in_out; | 1003 | struct intel_sdvo_in_out_map in_out; |
999 | struct intel_sdvo_dtd input_dtd; | 1004 | struct intel_sdvo_dtd input_dtd, output_dtd; |
1000 | int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); | 1005 | int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode); |
1001 | int rate; | 1006 | int rate; |
1002 | 1007 | ||
@@ -1021,20 +1026,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1021 | intel_sdvo->attached_output)) | 1026 | intel_sdvo->attached_output)) |
1022 | return; | 1027 | return; |
1023 | 1028 | ||
1024 | /* We have tried to get input timing in mode_fixup, and filled into | 1029 | /* lvds has a special fixed output timing. */ |
1025 | * adjusted_mode. | 1030 | if (intel_sdvo->is_lvds) |
1026 | */ | 1031 | intel_sdvo_get_dtd_from_mode(&output_dtd, |
1027 | if (intel_sdvo->is_tv || intel_sdvo->is_lvds) { | 1032 | intel_sdvo->sdvo_lvds_fixed_mode); |
1028 | input_dtd = intel_sdvo->input_dtd; | 1033 | else |
1029 | } else { | 1034 | intel_sdvo_get_dtd_from_mode(&output_dtd, mode); |
1030 | /* Set the output timing to the screen */ | 1035 | (void) intel_sdvo_set_output_timing(intel_sdvo, &output_dtd); |
1031 | if (!intel_sdvo_set_target_output(intel_sdvo, | ||
1032 | intel_sdvo->attached_output)) | ||
1033 | return; | ||
1034 | |||
1035 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | ||
1036 | (void) intel_sdvo_set_output_timing(intel_sdvo, &input_dtd); | ||
1037 | } | ||
1038 | 1036 | ||
1039 | /* Set the input timing to the screen. Assume always input 0. */ | 1037 | /* Set the input timing to the screen. Assume always input 0. */ |
1040 | if (!intel_sdvo_set_target_input(intel_sdvo)) | 1038 | if (!intel_sdvo_set_target_input(intel_sdvo)) |
@@ -1052,6 +1050,10 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1052 | !intel_sdvo_set_tv_format(intel_sdvo)) | 1050 | !intel_sdvo_set_tv_format(intel_sdvo)) |
1053 | return; | 1051 | return; |
1054 | 1052 | ||
1053 | /* We have tried to get input timing in mode_fixup, and filled into | ||
1054 | * adjusted_mode. | ||
1055 | */ | ||
1056 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | ||
1055 | (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd); | 1057 | (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd); |
1056 | 1058 | ||
1057 | switch (pixel_multiplier) { | 1059 | switch (pixel_multiplier) { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index 7814a760c164..284bd25d5d21 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
@@ -270,7 +270,7 @@ static bool nouveau_dsm_detect(void) | |||
270 | struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name}; | 270 | struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name}; |
271 | struct pci_dev *pdev = NULL; | 271 | struct pci_dev *pdev = NULL; |
272 | int has_dsm = 0; | 272 | int has_dsm = 0; |
273 | int has_optimus; | 273 | int has_optimus = 0; |
274 | int vga_count = 0; | 274 | int vga_count = 0; |
275 | bool guid_valid; | 275 | bool guid_valid; |
276 | int retval; | 276 | int retval; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 80963d05b54a..0be4a815e706 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -6156,10 +6156,14 @@ dcb_fake_connectors(struct nvbios *bios) | |||
6156 | 6156 | ||
6157 | /* heuristic: if we ever get a non-zero connector field, assume | 6157 | /* heuristic: if we ever get a non-zero connector field, assume |
6158 | * that all the indices are valid and we don't need fake them. | 6158 | * that all the indices are valid and we don't need fake them. |
6159 | * | ||
6160 | * and, as usual, a blacklist of boards with bad bios data.. | ||
6159 | */ | 6161 | */ |
6160 | for (i = 0; i < dcbt->entries; i++) { | 6162 | if (!nv_match_device(bios->dev, 0x0392, 0x107d, 0x20a2)) { |
6161 | if (dcbt->entry[i].connector) | 6163 | for (i = 0; i < dcbt->entries; i++) { |
6162 | return; | 6164 | if (dcbt->entry[i].connector) |
6165 | return; | ||
6166 | } | ||
6163 | } | 6167 | } |
6164 | 6168 | ||
6165 | /* no useful connector info available, we need to make it up | 6169 | /* no useful connector info available, we need to make it up |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hdmi.c b/drivers/gpu/drm/nouveau/nouveau_hdmi.c index 59ea1c14eca0..c3de36384522 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hdmi.c +++ b/drivers/gpu/drm/nouveau/nouveau_hdmi.c | |||
@@ -32,7 +32,9 @@ static bool | |||
32 | hdmi_sor(struct drm_encoder *encoder) | 32 | hdmi_sor(struct drm_encoder *encoder) |
33 | { | 33 | { |
34 | struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; | 34 | struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; |
35 | if (dev_priv->chipset < 0xa3) | 35 | if (dev_priv->chipset < 0xa3 || |
36 | dev_priv->chipset == 0xaa || | ||
37 | dev_priv->chipset == 0xac) | ||
36 | return false; | 38 | return false; |
37 | return true; | 39 | return true; |
38 | } | 40 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 34d591b7d4ef..da3e7c3abab7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -235,6 +235,7 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile) | |||
235 | return -EPERM; | 235 | return -EPERM; |
236 | 236 | ||
237 | strncpy(string, profile, sizeof(string)); | 237 | strncpy(string, profile, sizeof(string)); |
238 | string[sizeof(string) - 1] = 0; | ||
238 | if ((ptr = strchr(string, '\n'))) | 239 | if ((ptr = strchr(string, '\n'))) |
239 | *ptr = '\0'; | 240 | *ptr = '\0'; |
240 | 241 | ||
diff --git a/drivers/gpu/drm/nouveau/nv10_gpio.c b/drivers/gpu/drm/nouveau/nv10_gpio.c index 550ad3fcf0af..9d79180069df 100644 --- a/drivers/gpu/drm/nouveau/nv10_gpio.c +++ b/drivers/gpu/drm/nouveau/nv10_gpio.c | |||
@@ -65,7 +65,7 @@ nv10_gpio_drive(struct drm_device *dev, int line, int dir, int out) | |||
65 | if (line < 10) { | 65 | if (line < 10) { |
66 | line = (line - 2) * 4; | 66 | line = (line - 2) * 4; |
67 | reg = NV_PCRTC_GPIO_EXT; | 67 | reg = NV_PCRTC_GPIO_EXT; |
68 | mask = 0x00000003 << ((line - 2) * 4); | 68 | mask = 0x00000003; |
69 | data = (dir << 1) | out; | 69 | data = (dir << 1) | out; |
70 | } else | 70 | } else |
71 | if (line < 14) { | 71 | if (line < 14) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c index a7844ab6a50c..274640212475 100644 --- a/drivers/gpu/drm/nouveau/nv50_sor.c +++ b/drivers/gpu/drm/nouveau/nv50_sor.c | |||
@@ -42,7 +42,7 @@ nv50_sor_dp_lane_map(struct drm_device *dev, struct dcb_entry *dcb, u8 lane) | |||
42 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 42 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
43 | static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ | 43 | static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ |
44 | static const u8 nv50[] = { 16, 8, 0, 24 }; | 44 | static const u8 nv50[] = { 16, 8, 0, 24 }; |
45 | if (dev_priv->card_type == 0xaf) | 45 | if (dev_priv->chipset == 0xaf) |
46 | return nvaf[lane]; | 46 | return nvaf[lane]; |
47 | return nv50[lane]; | 47 | return nv50[lane]; |
48 | } | 48 | } |
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c index 5bf55038fd92..f704e942372e 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fb.c +++ b/drivers/gpu/drm/nouveau/nvc0_fb.c | |||
@@ -54,6 +54,11 @@ nvc0_mfb_isr(struct drm_device *dev) | |||
54 | nvc0_mfb_subp_isr(dev, unit, subp); | 54 | nvc0_mfb_subp_isr(dev, unit, subp); |
55 | units &= ~(1 << unit); | 55 | units &= ~(1 << unit); |
56 | } | 56 | } |
57 | |||
58 | /* we do something horribly wrong and upset PMFB a lot, so mask off | ||
59 | * interrupts from it after the first one until it's fixed | ||
60 | */ | ||
61 | nv_mask(dev, 0x000640, 0x02000000, 0x00000000); | ||
57 | } | 62 | } |
58 | 63 | ||
59 | static void | 64 | static void |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index b5ff1f7b6f7e..af1054f8202a 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -575,6 +575,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
575 | 575 | ||
576 | if (rdev->family < CHIP_RV770) | 576 | if (rdev->family < CHIP_RV770) |
577 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; | 577 | pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP; |
578 | /* use frac fb div on APUs */ | ||
579 | if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev)) | ||
580 | pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV; | ||
578 | } else { | 581 | } else { |
579 | pll->flags |= RADEON_PLL_LEGACY; | 582 | pll->flags |= RADEON_PLL_LEGACY; |
580 | 583 | ||
@@ -955,8 +958,8 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
955 | break; | 958 | break; |
956 | } | 959 | } |
957 | 960 | ||
958 | if (radeon_encoder->active_device & | 961 | if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) || |
959 | (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) { | 962 | (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) { |
960 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; | 963 | struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; |
961 | struct drm_connector *connector = | 964 | struct drm_connector *connector = |
962 | radeon_get_connector_for_encoder(encoder); | 965 | radeon_get_connector_for_encoder(encoder); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index de71243b591f..c8187c4b6ae8 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1135,7 +1135,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc | |||
1135 | } | 1135 | } |
1136 | if (rdev->flags & RADEON_IS_AGP) { | 1136 | if (rdev->flags & RADEON_IS_AGP) { |
1137 | size_bf = mc->gtt_start; | 1137 | size_bf = mc->gtt_start; |
1138 | size_af = 0xFFFFFFFF - mc->gtt_end + 1; | 1138 | size_af = 0xFFFFFFFF - mc->gtt_end; |
1139 | if (size_bf > size_af) { | 1139 | if (size_bf > size_af) { |
1140 | if (mc->mc_vram_size > size_bf) { | 1140 | if (mc->mc_vram_size > size_bf) { |
1141 | dev_warn(rdev->dev, "limiting VRAM\n"); | 1141 | dev_warn(rdev->dev, "limiting VRAM\n"); |
@@ -1149,7 +1149,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc | |||
1149 | mc->real_vram_size = size_af; | 1149 | mc->real_vram_size = size_af; |
1150 | mc->mc_vram_size = size_af; | 1150 | mc->mc_vram_size = size_af; |
1151 | } | 1151 | } |
1152 | mc->vram_start = mc->gtt_end; | 1152 | mc->vram_start = mc->gtt_end + 1; |
1153 | } | 1153 | } |
1154 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 1154 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
1155 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 1155 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index bd05156edbdb..3c2e7a000a2a 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -970,7 +970,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
970 | 970 | ||
971 | encoder = obj_to_encoder(obj); | 971 | encoder = obj_to_encoder(obj); |
972 | 972 | ||
973 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC || | 973 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC && |
974 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) | 974 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) |
975 | continue; | 975 | continue; |
976 | 976 | ||
@@ -1000,6 +1000,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1000 | * cases the DVI port is actually a virtual KVM port connected to the service | 1000 | * cases the DVI port is actually a virtual KVM port connected to the service |
1001 | * processor. | 1001 | * processor. |
1002 | */ | 1002 | */ |
1003 | out: | ||
1003 | if ((!rdev->is_atom_bios) && | 1004 | if ((!rdev->is_atom_bios) && |
1004 | (ret == connector_status_disconnected) && | 1005 | (ret == connector_status_disconnected) && |
1005 | rdev->mode_info.bios_hardcoded_edid_size) { | 1006 | rdev->mode_info.bios_hardcoded_edid_size) { |
@@ -1007,7 +1008,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1007 | ret = connector_status_connected; | 1008 | ret = connector_status_connected; |
1008 | } | 1009 | } |
1009 | 1010 | ||
1010 | out: | ||
1011 | /* updated in get modes as well since we need to know if it's analog or digital */ | 1011 | /* updated in get modes as well since we need to know if it's analog or digital */ |
1012 | radeon_connector_update_scratch_regs(connector, ret); | 1012 | radeon_connector_update_scratch_regs(connector, ret); |
1013 | return ret; | 1013 | return ret; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index ea7df16e2f84..5992502a3448 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -241,8 +241,8 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
241 | rdev->wb.use_event = true; | 241 | rdev->wb.use_event = true; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | /* always use writeback/events on NI */ | 244 | /* always use writeback/events on NI, APUs */ |
245 | if (ASIC_IS_DCE5(rdev)) { | 245 | if (rdev->family >= CHIP_PALM) { |
246 | rdev->wb.enabled = true; | 246 | rdev->wb.enabled = true; |
247 | rdev->wb.use_event = true; | 247 | rdev->wb.use_event = true; |
248 | } | 248 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8086c96e0b06..0a1d4bd65edc 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -533,7 +533,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index) | |||
533 | radeon_legacy_init_crtc(dev, radeon_crtc); | 533 | radeon_legacy_init_crtc(dev, radeon_crtc); |
534 | } | 534 | } |
535 | 535 | ||
536 | static const char *encoder_names[36] = { | 536 | static const char *encoder_names[37] = { |
537 | "NONE", | 537 | "NONE", |
538 | "INTERNAL_LVDS", | 538 | "INTERNAL_LVDS", |
539 | "INTERNAL_TMDS1", | 539 | "INTERNAL_TMDS1", |
@@ -570,6 +570,7 @@ static const char *encoder_names[36] = { | |||
570 | "INTERNAL_UNIPHY2", | 570 | "INTERNAL_UNIPHY2", |
571 | "NUTMEG", | 571 | "NUTMEG", |
572 | "TRAVIS", | 572 | "TRAVIS", |
573 | "INTERNAL_VCE" | ||
573 | }; | 574 | }; |
574 | 575 | ||
575 | static const char *connector_names[15] = { | 576 | static const char *connector_names[15] = { |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 66d5fe1c8174..65060b77c805 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -147,6 +147,12 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
147 | (rdev->pdev->subsystem_device == 0x01fd)) | 147 | (rdev->pdev->subsystem_device == 0x01fd)) |
148 | return true; | 148 | return true; |
149 | 149 | ||
150 | /* RV515 seems to have MSI issues where it loses | ||
151 | * MSI rearms occasionally. This leads to lockups and freezes. | ||
152 | * disable it by default. | ||
153 | */ | ||
154 | if (rdev->family == CHIP_RV515) | ||
155 | return false; | ||
150 | if (rdev->flags & RADEON_IS_IGP) { | 156 | if (rdev->flags & RADEON_IS_IGP) { |
151 | /* APUs work fine with MSIs */ | 157 | /* APUs work fine with MSIs */ |
152 | if (rdev->family >= CHIP_PALM) | 158 | if (rdev->family >= CHIP_PALM) |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index c62ae4be3845..cdab1aeaed6e 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -969,7 +969,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
969 | } | 969 | } |
970 | if (rdev->flags & RADEON_IS_AGP) { | 970 | if (rdev->flags & RADEON_IS_AGP) { |
971 | size_bf = mc->gtt_start; | 971 | size_bf = mc->gtt_start; |
972 | size_af = 0xFFFFFFFF - mc->gtt_end + 1; | 972 | size_af = 0xFFFFFFFF - mc->gtt_end; |
973 | if (size_bf > size_af) { | 973 | if (size_bf > size_af) { |
974 | if (mc->mc_vram_size > size_bf) { | 974 | if (mc->mc_vram_size > size_bf) { |
975 | dev_warn(rdev->dev, "limiting VRAM\n"); | 975 | dev_warn(rdev->dev, "limiting VRAM\n"); |
@@ -983,7 +983,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
983 | mc->real_vram_size = size_af; | 983 | mc->real_vram_size = size_af; |
984 | mc->mc_vram_size = size_af; | 984 | mc->mc_vram_size = size_af; |
985 | } | 985 | } |
986 | mc->vram_start = mc->gtt_end; | 986 | mc->vram_start = mc->gtt_end + 1; |
987 | } | 987 | } |
988 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 988 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
989 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 989 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index ac7a199ffece..27bda986fc2b 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2999,8 +2999,8 @@ int si_rlc_init(struct radeon_device *rdev) | |||
2999 | } | 2999 | } |
3000 | r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, | 3000 | r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, |
3001 | &rdev->rlc.save_restore_gpu_addr); | 3001 | &rdev->rlc.save_restore_gpu_addr); |
3002 | radeon_bo_unreserve(rdev->rlc.save_restore_obj); | ||
3002 | if (r) { | 3003 | if (r) { |
3003 | radeon_bo_unreserve(rdev->rlc.save_restore_obj); | ||
3004 | dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); | 3004 | dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); |
3005 | si_rlc_fini(rdev); | 3005 | si_rlc_fini(rdev); |
3006 | return r; | 3006 | return r; |
@@ -3023,9 +3023,8 @@ int si_rlc_init(struct radeon_device *rdev) | |||
3023 | } | 3023 | } |
3024 | r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, | 3024 | r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, |
3025 | &rdev->rlc.clear_state_gpu_addr); | 3025 | &rdev->rlc.clear_state_gpu_addr); |
3026 | radeon_bo_unreserve(rdev->rlc.clear_state_obj); | ||
3026 | if (r) { | 3027 | if (r) { |
3027 | |||
3028 | radeon_bo_unreserve(rdev->rlc.clear_state_obj); | ||
3029 | dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); | 3028 | dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); |
3030 | si_rlc_fini(rdev); | 3029 | si_rlc_fini(rdev); |
3031 | return r; | 3030 | return r; |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index a3d033252995..ffddcba32af6 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -34,7 +34,7 @@ config HID | |||
34 | config HID_BATTERY_STRENGTH | 34 | config HID_BATTERY_STRENGTH |
35 | bool | 35 | bool |
36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY | 36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY |
37 | default y | 37 | default n |
38 | 38 | ||
39 | config HIDRAW | 39 | config HIDRAW |
40 | bool "/dev/hidraw raw HID device support" | 40 | bool "/dev/hidraw raw HID device support" |
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c index de47039c708c..9f85f827607f 100644 --- a/drivers/hid/hid-tivo.c +++ b/drivers/hid/hid-tivo.c | |||
@@ -62,7 +62,7 @@ static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
62 | 62 | ||
63 | static const struct hid_device_id tivo_devices[] = { | 63 | static const struct hid_device_id tivo_devices[] = { |
64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ | 64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ |
65 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, | 65 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, | 66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
67 | { } | 67 | { } |
68 | }; | 68 | }; |
diff --git a/drivers/hsi/clients/hsi_char.c b/drivers/hsi/clients/hsi_char.c index 88a050df2389..3ad91f6447d8 100644 --- a/drivers/hsi/clients/hsi_char.c +++ b/drivers/hsi/clients/hsi_char.c | |||
@@ -123,7 +123,7 @@ struct hsc_client_data { | |||
123 | static unsigned int hsc_major; | 123 | static unsigned int hsc_major; |
124 | /* Maximum buffer size that hsi_char will accept from userspace */ | 124 | /* Maximum buffer size that hsi_char will accept from userspace */ |
125 | static unsigned int max_data_size = 0x1000; | 125 | static unsigned int max_data_size = 0x1000; |
126 | module_param(max_data_size, uint, S_IRUSR | S_IWUSR); | 126 | module_param(max_data_size, uint, 0); |
127 | MODULE_PARM_DESC(max_data_size, "max read/write data size [4,8..65536] (^2)"); | 127 | MODULE_PARM_DESC(max_data_size, "max read/write data size [4,8..65536] (^2)"); |
128 | 128 | ||
129 | static void hsc_add_tail(struct hsc_channel *channel, struct hsi_msg *msg, | 129 | static void hsc_add_tail(struct hsc_channel *channel, struct hsi_msg *msg, |
diff --git a/drivers/hsi/hsi.c b/drivers/hsi/hsi.c index 4e2d79b79334..2d58f939d27f 100644 --- a/drivers/hsi/hsi.c +++ b/drivers/hsi/hsi.c | |||
@@ -21,26 +21,13 @@ | |||
21 | */ | 21 | */ |
22 | #include <linux/hsi/hsi.h> | 22 | #include <linux/hsi/hsi.h> |
23 | #include <linux/compiler.h> | 23 | #include <linux/compiler.h> |
24 | #include <linux/rwsem.h> | ||
25 | #include <linux/list.h> | 24 | #include <linux/list.h> |
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/kobject.h> | 25 | #include <linux/kobject.h> |
28 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
29 | #include <linux/string.h> | 27 | #include <linux/string.h> |
28 | #include <linux/notifier.h> | ||
30 | #include "hsi_core.h" | 29 | #include "hsi_core.h" |
31 | 30 | ||
32 | static struct device_type hsi_ctrl = { | ||
33 | .name = "hsi_controller", | ||
34 | }; | ||
35 | |||
36 | static struct device_type hsi_cl = { | ||
37 | .name = "hsi_client", | ||
38 | }; | ||
39 | |||
40 | static struct device_type hsi_port = { | ||
41 | .name = "hsi_port", | ||
42 | }; | ||
43 | |||
44 | static ssize_t modalias_show(struct device *dev, | 31 | static ssize_t modalias_show(struct device *dev, |
45 | struct device_attribute *a __maybe_unused, char *buf) | 32 | struct device_attribute *a __maybe_unused, char *buf) |
46 | { | 33 | { |
@@ -54,8 +41,7 @@ static struct device_attribute hsi_bus_dev_attrs[] = { | |||
54 | 41 | ||
55 | static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) | 42 | static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) |
56 | { | 43 | { |
57 | if (dev->type == &hsi_cl) | 44 | add_uevent_var(env, "MODALIAS=hsi:%s", dev_name(dev)); |
58 | add_uevent_var(env, "MODALIAS=hsi:%s", dev_name(dev)); | ||
59 | 45 | ||
60 | return 0; | 46 | return 0; |
61 | } | 47 | } |
@@ -80,12 +66,10 @@ static void hsi_client_release(struct device *dev) | |||
80 | static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) | 66 | static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) |
81 | { | 67 | { |
82 | struct hsi_client *cl; | 68 | struct hsi_client *cl; |
83 | unsigned long flags; | ||
84 | 69 | ||
85 | cl = kzalloc(sizeof(*cl), GFP_KERNEL); | 70 | cl = kzalloc(sizeof(*cl), GFP_KERNEL); |
86 | if (!cl) | 71 | if (!cl) |
87 | return; | 72 | return; |
88 | cl->device.type = &hsi_cl; | ||
89 | cl->tx_cfg = info->tx_cfg; | 73 | cl->tx_cfg = info->tx_cfg; |
90 | cl->rx_cfg = info->rx_cfg; | 74 | cl->rx_cfg = info->rx_cfg; |
91 | cl->device.bus = &hsi_bus_type; | 75 | cl->device.bus = &hsi_bus_type; |
@@ -93,14 +77,11 @@ static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) | |||
93 | cl->device.release = hsi_client_release; | 77 | cl->device.release = hsi_client_release; |
94 | dev_set_name(&cl->device, info->name); | 78 | dev_set_name(&cl->device, info->name); |
95 | cl->device.platform_data = info->platform_data; | 79 | cl->device.platform_data = info->platform_data; |
96 | spin_lock_irqsave(&port->clock, flags); | ||
97 | list_add_tail(&cl->link, &port->clients); | ||
98 | spin_unlock_irqrestore(&port->clock, flags); | ||
99 | if (info->archdata) | 80 | if (info->archdata) |
100 | cl->device.archdata = *info->archdata; | 81 | cl->device.archdata = *info->archdata; |
101 | if (device_register(&cl->device) < 0) { | 82 | if (device_register(&cl->device) < 0) { |
102 | pr_err("hsi: failed to register client: %s\n", info->name); | 83 | pr_err("hsi: failed to register client: %s\n", info->name); |
103 | kfree(cl); | 84 | put_device(&cl->device); |
104 | } | 85 | } |
105 | } | 86 | } |
106 | 87 | ||
@@ -120,13 +101,6 @@ static void hsi_scan_board_info(struct hsi_controller *hsi) | |||
120 | 101 | ||
121 | static int hsi_remove_client(struct device *dev, void *data __maybe_unused) | 102 | static int hsi_remove_client(struct device *dev, void *data __maybe_unused) |
122 | { | 103 | { |
123 | struct hsi_client *cl = to_hsi_client(dev); | ||
124 | struct hsi_port *port = to_hsi_port(dev->parent); | ||
125 | unsigned long flags; | ||
126 | |||
127 | spin_lock_irqsave(&port->clock, flags); | ||
128 | list_del(&cl->link); | ||
129 | spin_unlock_irqrestore(&port->clock, flags); | ||
130 | device_unregister(dev); | 104 | device_unregister(dev); |
131 | 105 | ||
132 | return 0; | 106 | return 0; |
@@ -140,12 +114,17 @@ static int hsi_remove_port(struct device *dev, void *data __maybe_unused) | |||
140 | return 0; | 114 | return 0; |
141 | } | 115 | } |
142 | 116 | ||
143 | static void hsi_controller_release(struct device *dev __maybe_unused) | 117 | static void hsi_controller_release(struct device *dev) |
144 | { | 118 | { |
119 | struct hsi_controller *hsi = to_hsi_controller(dev); | ||
120 | |||
121 | kfree(hsi->port); | ||
122 | kfree(hsi); | ||
145 | } | 123 | } |
146 | 124 | ||
147 | static void hsi_port_release(struct device *dev __maybe_unused) | 125 | static void hsi_port_release(struct device *dev) |
148 | { | 126 | { |
127 | kfree(to_hsi_port(dev)); | ||
149 | } | 128 | } |
150 | 129 | ||
151 | /** | 130 | /** |
@@ -170,20 +149,12 @@ int hsi_register_controller(struct hsi_controller *hsi) | |||
170 | unsigned int i; | 149 | unsigned int i; |
171 | int err; | 150 | int err; |
172 | 151 | ||
173 | hsi->device.type = &hsi_ctrl; | 152 | err = device_add(&hsi->device); |
174 | hsi->device.bus = &hsi_bus_type; | ||
175 | hsi->device.release = hsi_controller_release; | ||
176 | err = device_register(&hsi->device); | ||
177 | if (err < 0) | 153 | if (err < 0) |
178 | return err; | 154 | return err; |
179 | for (i = 0; i < hsi->num_ports; i++) { | 155 | for (i = 0; i < hsi->num_ports; i++) { |
180 | hsi->port[i].device.parent = &hsi->device; | 156 | hsi->port[i]->device.parent = &hsi->device; |
181 | hsi->port[i].device.bus = &hsi_bus_type; | 157 | err = device_add(&hsi->port[i]->device); |
182 | hsi->port[i].device.release = hsi_port_release; | ||
183 | hsi->port[i].device.type = &hsi_port; | ||
184 | INIT_LIST_HEAD(&hsi->port[i].clients); | ||
185 | spin_lock_init(&hsi->port[i].clock); | ||
186 | err = device_register(&hsi->port[i].device); | ||
187 | if (err < 0) | 158 | if (err < 0) |
188 | goto out; | 159 | goto out; |
189 | } | 160 | } |
@@ -192,7 +163,9 @@ int hsi_register_controller(struct hsi_controller *hsi) | |||
192 | 163 | ||
193 | return 0; | 164 | return 0; |
194 | out: | 165 | out: |
195 | hsi_unregister_controller(hsi); | 166 | while (i-- > 0) |
167 | device_del(&hsi->port[i]->device); | ||
168 | device_del(&hsi->device); | ||
196 | 169 | ||
197 | return err; | 170 | return err; |
198 | } | 171 | } |
@@ -223,6 +196,29 @@ static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) | |||
223 | } | 196 | } |
224 | 197 | ||
225 | /** | 198 | /** |
199 | * hsi_put_controller - Free an HSI controller | ||
200 | * | ||
201 | * @hsi: Pointer to the HSI controller to freed | ||
202 | * | ||
203 | * HSI controller drivers should only use this function if they need | ||
204 | * to free their allocated hsi_controller structures before a successful | ||
205 | * call to hsi_register_controller. Other use is not allowed. | ||
206 | */ | ||
207 | void hsi_put_controller(struct hsi_controller *hsi) | ||
208 | { | ||
209 | unsigned int i; | ||
210 | |||
211 | if (!hsi) | ||
212 | return; | ||
213 | |||
214 | for (i = 0; i < hsi->num_ports; i++) | ||
215 | if (hsi->port && hsi->port[i]) | ||
216 | put_device(&hsi->port[i]->device); | ||
217 | put_device(&hsi->device); | ||
218 | } | ||
219 | EXPORT_SYMBOL_GPL(hsi_put_controller); | ||
220 | |||
221 | /** | ||
226 | * hsi_alloc_controller - Allocate an HSI controller and its ports | 222 | * hsi_alloc_controller - Allocate an HSI controller and its ports |
227 | * @n_ports: Number of ports on the HSI controller | 223 | * @n_ports: Number of ports on the HSI controller |
228 | * @flags: Kernel allocation flags | 224 | * @flags: Kernel allocation flags |
@@ -232,55 +228,52 @@ static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) | |||
232 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags) | 228 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags) |
233 | { | 229 | { |
234 | struct hsi_controller *hsi; | 230 | struct hsi_controller *hsi; |
235 | struct hsi_port *port; | 231 | struct hsi_port **port; |
236 | unsigned int i; | 232 | unsigned int i; |
237 | 233 | ||
238 | if (!n_ports) | 234 | if (!n_ports) |
239 | return NULL; | 235 | return NULL; |
240 | 236 | ||
241 | port = kzalloc(sizeof(*port)*n_ports, flags); | ||
242 | if (!port) | ||
243 | return NULL; | ||
244 | hsi = kzalloc(sizeof(*hsi), flags); | 237 | hsi = kzalloc(sizeof(*hsi), flags); |
245 | if (!hsi) | 238 | if (!hsi) |
246 | goto out; | 239 | return NULL; |
247 | for (i = 0; i < n_ports; i++) { | 240 | port = kzalloc(sizeof(*port)*n_ports, flags); |
248 | dev_set_name(&port[i].device, "port%d", i); | 241 | if (!port) { |
249 | port[i].num = i; | 242 | kfree(hsi); |
250 | port[i].async = hsi_dummy_msg; | 243 | return NULL; |
251 | port[i].setup = hsi_dummy_cl; | ||
252 | port[i].flush = hsi_dummy_cl; | ||
253 | port[i].start_tx = hsi_dummy_cl; | ||
254 | port[i].stop_tx = hsi_dummy_cl; | ||
255 | port[i].release = hsi_dummy_cl; | ||
256 | mutex_init(&port[i].lock); | ||
257 | } | 244 | } |
258 | hsi->num_ports = n_ports; | 245 | hsi->num_ports = n_ports; |
259 | hsi->port = port; | 246 | hsi->port = port; |
247 | hsi->device.release = hsi_controller_release; | ||
248 | device_initialize(&hsi->device); | ||
249 | |||
250 | for (i = 0; i < n_ports; i++) { | ||
251 | port[i] = kzalloc(sizeof(**port), flags); | ||
252 | if (port[i] == NULL) | ||
253 | goto out; | ||
254 | port[i]->num = i; | ||
255 | port[i]->async = hsi_dummy_msg; | ||
256 | port[i]->setup = hsi_dummy_cl; | ||
257 | port[i]->flush = hsi_dummy_cl; | ||
258 | port[i]->start_tx = hsi_dummy_cl; | ||
259 | port[i]->stop_tx = hsi_dummy_cl; | ||
260 | port[i]->release = hsi_dummy_cl; | ||
261 | mutex_init(&port[i]->lock); | ||
262 | ATOMIC_INIT_NOTIFIER_HEAD(&port[i]->n_head); | ||
263 | dev_set_name(&port[i]->device, "port%d", i); | ||
264 | hsi->port[i]->device.release = hsi_port_release; | ||
265 | device_initialize(&hsi->port[i]->device); | ||
266 | } | ||
260 | 267 | ||
261 | return hsi; | 268 | return hsi; |
262 | out: | 269 | out: |
263 | kfree(port); | 270 | hsi_put_controller(hsi); |
264 | 271 | ||
265 | return NULL; | 272 | return NULL; |
266 | } | 273 | } |
267 | EXPORT_SYMBOL_GPL(hsi_alloc_controller); | 274 | EXPORT_SYMBOL_GPL(hsi_alloc_controller); |
268 | 275 | ||
269 | /** | 276 | /** |
270 | * hsi_free_controller - Free an HSI controller | ||
271 | * @hsi: Pointer to HSI controller | ||
272 | */ | ||
273 | void hsi_free_controller(struct hsi_controller *hsi) | ||
274 | { | ||
275 | if (!hsi) | ||
276 | return; | ||
277 | |||
278 | kfree(hsi->port); | ||
279 | kfree(hsi); | ||
280 | } | ||
281 | EXPORT_SYMBOL_GPL(hsi_free_controller); | ||
282 | |||
283 | /** | ||
284 | * hsi_free_msg - Free an HSI message | 277 | * hsi_free_msg - Free an HSI message |
285 | * @msg: Pointer to the HSI message | 278 | * @msg: Pointer to the HSI message |
286 | * | 279 | * |
@@ -414,37 +407,67 @@ void hsi_release_port(struct hsi_client *cl) | |||
414 | } | 407 | } |
415 | EXPORT_SYMBOL_GPL(hsi_release_port); | 408 | EXPORT_SYMBOL_GPL(hsi_release_port); |
416 | 409 | ||
417 | static int hsi_start_rx(struct hsi_client *cl, void *data __maybe_unused) | 410 | static int hsi_event_notifier_call(struct notifier_block *nb, |
411 | unsigned long event, void *data __maybe_unused) | ||
418 | { | 412 | { |
419 | if (cl->hsi_start_rx) | 413 | struct hsi_client *cl = container_of(nb, struct hsi_client, nb); |
420 | (*cl->hsi_start_rx)(cl); | 414 | |
415 | (*cl->ehandler)(cl, event); | ||
421 | 416 | ||
422 | return 0; | 417 | return 0; |
423 | } | 418 | } |
424 | 419 | ||
425 | static int hsi_stop_rx(struct hsi_client *cl, void *data __maybe_unused) | 420 | /** |
421 | * hsi_register_port_event - Register a client to receive port events | ||
422 | * @cl: HSI client that wants to receive port events | ||
423 | * @cb: Event handler callback | ||
424 | * | ||
425 | * Clients should register a callback to be able to receive | ||
426 | * events from the ports. Registration should happen after | ||
427 | * claiming the port. | ||
428 | * The handler can be called in interrupt context. | ||
429 | * | ||
430 | * Returns -errno on error, or 0 on success. | ||
431 | */ | ||
432 | int hsi_register_port_event(struct hsi_client *cl, | ||
433 | void (*handler)(struct hsi_client *, unsigned long)) | ||
426 | { | 434 | { |
427 | if (cl->hsi_stop_rx) | 435 | struct hsi_port *port = hsi_get_port(cl); |
428 | (*cl->hsi_stop_rx)(cl); | ||
429 | 436 | ||
430 | return 0; | 437 | if (!handler || cl->ehandler) |
438 | return -EINVAL; | ||
439 | if (!hsi_port_claimed(cl)) | ||
440 | return -EACCES; | ||
441 | cl->ehandler = handler; | ||
442 | cl->nb.notifier_call = hsi_event_notifier_call; | ||
443 | |||
444 | return atomic_notifier_chain_register(&port->n_head, &cl->nb); | ||
431 | } | 445 | } |
446 | EXPORT_SYMBOL_GPL(hsi_register_port_event); | ||
432 | 447 | ||
433 | static int hsi_port_for_each_client(struct hsi_port *port, void *data, | 448 | /** |
434 | int (*fn)(struct hsi_client *cl, void *data)) | 449 | * hsi_unregister_port_event - Stop receiving port events for a client |
450 | * @cl: HSI client that wants to stop receiving port events | ||
451 | * | ||
452 | * Clients should call this function before releasing their associated | ||
453 | * port. | ||
454 | * | ||
455 | * Returns -errno on error, or 0 on success. | ||
456 | */ | ||
457 | int hsi_unregister_port_event(struct hsi_client *cl) | ||
435 | { | 458 | { |
436 | struct hsi_client *cl; | 459 | struct hsi_port *port = hsi_get_port(cl); |
460 | int err; | ||
437 | 461 | ||
438 | spin_lock(&port->clock); | 462 | WARN_ON(!hsi_port_claimed(cl)); |
439 | list_for_each_entry(cl, &port->clients, link) { | ||
440 | spin_unlock(&port->clock); | ||
441 | (*fn)(cl, data); | ||
442 | spin_lock(&port->clock); | ||
443 | } | ||
444 | spin_unlock(&port->clock); | ||
445 | 463 | ||
446 | return 0; | 464 | err = atomic_notifier_chain_unregister(&port->n_head, &cl->nb); |
465 | if (!err) | ||
466 | cl->ehandler = NULL; | ||
467 | |||
468 | return err; | ||
447 | } | 469 | } |
470 | EXPORT_SYMBOL_GPL(hsi_unregister_port_event); | ||
448 | 471 | ||
449 | /** | 472 | /** |
450 | * hsi_event -Notifies clients about port events | 473 | * hsi_event -Notifies clients about port events |
@@ -458,22 +481,12 @@ static int hsi_port_for_each_client(struct hsi_port *port, void *data, | |||
458 | * Events: | 481 | * Events: |
459 | * HSI_EVENT_START_RX - Incoming wake line high | 482 | * HSI_EVENT_START_RX - Incoming wake line high |
460 | * HSI_EVENT_STOP_RX - Incoming wake line down | 483 | * HSI_EVENT_STOP_RX - Incoming wake line down |
484 | * | ||
485 | * Returns -errno on error, or 0 on success. | ||
461 | */ | 486 | */ |
462 | void hsi_event(struct hsi_port *port, unsigned int event) | 487 | int hsi_event(struct hsi_port *port, unsigned long event) |
463 | { | 488 | { |
464 | int (*fn)(struct hsi_client *cl, void *data); | 489 | return atomic_notifier_call_chain(&port->n_head, event, NULL); |
465 | |||
466 | switch (event) { | ||
467 | case HSI_EVENT_START_RX: | ||
468 | fn = hsi_start_rx; | ||
469 | break; | ||
470 | case HSI_EVENT_STOP_RX: | ||
471 | fn = hsi_stop_rx; | ||
472 | break; | ||
473 | default: | ||
474 | return; | ||
475 | } | ||
476 | hsi_port_for_each_client(port, NULL, fn); | ||
477 | } | 490 | } |
478 | EXPORT_SYMBOL_GPL(hsi_event); | 491 | EXPORT_SYMBOL_GPL(hsi_event); |
479 | 492 | ||
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index ce43642ef03e..f85ce70d9677 100644 --- a/drivers/hwmon/ad7314.c +++ b/drivers/hwmon/ad7314.c | |||
@@ -47,7 +47,7 @@ struct ad7314_data { | |||
47 | u16 rx ____cacheline_aligned; | 47 | u16 rx ____cacheline_aligned; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static int ad7314_spi_read(struct ad7314_data *chip, s16 *data) | 50 | static int ad7314_spi_read(struct ad7314_data *chip) |
51 | { | 51 | { |
52 | int ret; | 52 | int ret; |
53 | 53 | ||
@@ -57,9 +57,7 @@ static int ad7314_spi_read(struct ad7314_data *chip, s16 *data) | |||
57 | return ret; | 57 | return ret; |
58 | } | 58 | } |
59 | 59 | ||
60 | *data = be16_to_cpu(chip->rx); | 60 | return be16_to_cpu(chip->rx); |
61 | |||
62 | return ret; | ||
63 | } | 61 | } |
64 | 62 | ||
65 | static ssize_t ad7314_show_temperature(struct device *dev, | 63 | static ssize_t ad7314_show_temperature(struct device *dev, |
@@ -70,12 +68,12 @@ static ssize_t ad7314_show_temperature(struct device *dev, | |||
70 | s16 data; | 68 | s16 data; |
71 | int ret; | 69 | int ret; |
72 | 70 | ||
73 | ret = ad7314_spi_read(chip, &data); | 71 | ret = ad7314_spi_read(chip); |
74 | if (ret < 0) | 72 | if (ret < 0) |
75 | return ret; | 73 | return ret; |
76 | switch (spi_get_device_id(chip->spi_dev)->driver_data) { | 74 | switch (spi_get_device_id(chip->spi_dev)->driver_data) { |
77 | case ad7314: | 75 | case ad7314: |
78 | data = (data & AD7314_TEMP_MASK) >> AD7314_TEMP_OFFSET; | 76 | data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_OFFSET; |
79 | data = (data << 6) >> 6; | 77 | data = (data << 6) >> 6; |
80 | 78 | ||
81 | return sprintf(buf, "%d\n", 250 * data); | 79 | return sprintf(buf, "%d\n", 250 * data); |
@@ -86,7 +84,7 @@ static ssize_t ad7314_show_temperature(struct device *dev, | |||
86 | * with a sign bit - which is a 14 bit 2's complement | 84 | * with a sign bit - which is a 14 bit 2's complement |
87 | * register. 1lsb - 31.25 milli degrees centigrade | 85 | * register. 1lsb - 31.25 milli degrees centigrade |
88 | */ | 86 | */ |
89 | data &= ADT7301_TEMP_MASK; | 87 | data = ret & ADT7301_TEMP_MASK; |
90 | data = (data << 2) >> 2; | 88 | data = (data << 2) >> 2; |
91 | 89 | ||
92 | return sprintf(buf, "%d\n", | 90 | return sprintf(buf, "%d\n", |
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c index 7765e4f74ec5..1958f03efd7a 100644 --- a/drivers/hwmon/ads1015.c +++ b/drivers/hwmon/ads1015.c | |||
@@ -59,14 +59,11 @@ struct ads1015_data { | |||
59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; | 59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | 62 | static int ads1015_read_adc(struct i2c_client *client, unsigned int channel) |
63 | int *value) | ||
64 | { | 63 | { |
65 | u16 config; | 64 | u16 config; |
66 | s16 conversion; | ||
67 | struct ads1015_data *data = i2c_get_clientdata(client); | 65 | struct ads1015_data *data = i2c_get_clientdata(client); |
68 | unsigned int pga = data->channel_data[channel].pga; | 66 | unsigned int pga = data->channel_data[channel].pga; |
69 | int fullscale; | ||
70 | unsigned int data_rate = data->channel_data[channel].data_rate; | 67 | unsigned int data_rate = data->channel_data[channel].data_rate; |
71 | unsigned int conversion_time_ms; | 68 | unsigned int conversion_time_ms; |
72 | int res; | 69 | int res; |
@@ -78,7 +75,6 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
78 | if (res < 0) | 75 | if (res < 0) |
79 | goto err_unlock; | 76 | goto err_unlock; |
80 | config = res; | 77 | config = res; |
81 | fullscale = fullscale_table[pga]; | ||
82 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); | 78 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); |
83 | 79 | ||
84 | /* setup and start single conversion */ | 80 | /* setup and start single conversion */ |
@@ -105,33 +101,36 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
105 | } | 101 | } |
106 | 102 | ||
107 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); | 103 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); |
108 | if (res < 0) | ||
109 | goto err_unlock; | ||
110 | conversion = res; | ||
111 | |||
112 | mutex_unlock(&data->update_lock); | ||
113 | |||
114 | *value = DIV_ROUND_CLOSEST(conversion * fullscale, 0x7ff0); | ||
115 | |||
116 | return 0; | ||
117 | 104 | ||
118 | err_unlock: | 105 | err_unlock: |
119 | mutex_unlock(&data->update_lock); | 106 | mutex_unlock(&data->update_lock); |
120 | return res; | 107 | return res; |
121 | } | 108 | } |
122 | 109 | ||
110 | static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel, | ||
111 | s16 reg) | ||
112 | { | ||
113 | struct ads1015_data *data = i2c_get_clientdata(client); | ||
114 | unsigned int pga = data->channel_data[channel].pga; | ||
115 | int fullscale = fullscale_table[pga]; | ||
116 | |||
117 | return DIV_ROUND_CLOSEST(reg * fullscale, 0x7ff0); | ||
118 | } | ||
119 | |||
123 | /* sysfs callback function */ | 120 | /* sysfs callback function */ |
124 | static ssize_t show_in(struct device *dev, struct device_attribute *da, | 121 | static ssize_t show_in(struct device *dev, struct device_attribute *da, |
125 | char *buf) | 122 | char *buf) |
126 | { | 123 | { |
127 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 124 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
128 | struct i2c_client *client = to_i2c_client(dev); | 125 | struct i2c_client *client = to_i2c_client(dev); |
129 | int in; | ||
130 | int res; | 126 | int res; |
127 | int index = attr->index; | ||
131 | 128 | ||
132 | res = ads1015_read_value(client, attr->index, &in); | 129 | res = ads1015_read_adc(client, index); |
130 | if (res < 0) | ||
131 | return res; | ||
133 | 132 | ||
134 | return (res < 0) ? res : sprintf(buf, "%d\n", in); | 133 | return sprintf(buf, "%d\n", ads1015_reg_to_mv(client, index, res)); |
135 | } | 134 | } |
136 | 135 | ||
137 | static const struct sensor_device_attribute ads1015_in[] = { | 136 | static const struct sensor_device_attribute ads1015_in[] = { |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0d3141fbbc20..b9d512331ed4 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -52,7 +52,7 @@ module_param_named(tjmax, force_tjmax, int, 0444); | |||
52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); | 52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); |
53 | 53 | ||
54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ | 54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ |
55 | #define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ | 55 | #define NUM_REAL_CORES 32 /* Number of Real cores per cpu */ |
56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ | 56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ |
57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ | 57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ |
58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) | 58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) |
@@ -709,6 +709,10 @@ static void __cpuinit put_core_offline(unsigned int cpu) | |||
709 | 709 | ||
710 | indx = TO_ATTR_NO(cpu); | 710 | indx = TO_ATTR_NO(cpu); |
711 | 711 | ||
712 | /* The core id is too big, just return */ | ||
713 | if (indx > MAX_CORE_DATA - 1) | ||
714 | return; | ||
715 | |||
712 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) | 716 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) |
713 | coretemp_remove_core(pdata, &pdev->dev, indx); | 717 | coretemp_remove_core(pdata, &pdev->dev, indx); |
714 | 718 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index b7494af1e4a9..e8e18cab1fb8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -122,6 +122,41 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
122 | return true; | 122 | return true; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* | ||
126 | * Newer BKDG versions have an updated recommendation on how to properly | ||
127 | * initialize the running average range (was: 0xE, now: 0x9). This avoids | ||
128 | * counter saturations resulting in bogus power readings. | ||
129 | * We correct this value ourselves to cope with older BIOSes. | ||
130 | */ | ||
131 | static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | ||
132 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | ||
133 | { 0 } | ||
134 | }; | ||
135 | |||
136 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | ||
137 | { | ||
138 | u32 val; | ||
139 | |||
140 | /* | ||
141 | * let this quirk apply only to the current version of the | ||
142 | * northbridge, since future versions may change the behavior | ||
143 | */ | ||
144 | if (!pci_match_id(affected_device, pdev)) | ||
145 | return; | ||
146 | |||
147 | pci_bus_read_config_dword(pdev->bus, | ||
148 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
149 | REG_TDP_RUNNING_AVERAGE, &val); | ||
150 | if ((val & 0xf) != 0xe) | ||
151 | return; | ||
152 | |||
153 | val &= ~0xf; | ||
154 | val |= 0x9; | ||
155 | pci_bus_write_config_dword(pdev->bus, | ||
156 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
157 | REG_TDP_RUNNING_AVERAGE, val); | ||
158 | } | ||
159 | |||
125 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 160 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
126 | struct fam15h_power_data *data) | 161 | struct fam15h_power_data *data) |
127 | { | 162 | { |
@@ -155,6 +190,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev, | |||
155 | struct device *dev; | 190 | struct device *dev; |
156 | int err; | 191 | int err; |
157 | 192 | ||
193 | /* | ||
194 | * though we ignore every other northbridge, we still have to | ||
195 | * do the tweaking on _each_ node in MCM processors as the counters | ||
196 | * are working hand-in-hand | ||
197 | */ | ||
198 | tweak_runavg_range(pdev); | ||
199 | |||
158 | if (!fam15h_power_is_internal_node0(pdev)) { | 200 | if (!fam15h_power_is_internal_node0(pdev)) { |
159 | err = -ENODEV; | 201 | err = -ENODEV; |
160 | goto exit; | 202 | goto exit; |
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index f086131cb1c7..c811289b61e2 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c | |||
@@ -324,7 +324,7 @@ static s32 pch_i2c_wait_for_xfer_complete(struct i2c_algo_pch_data *adap) | |||
324 | { | 324 | { |
325 | long ret; | 325 | long ret; |
326 | ret = wait_event_timeout(pch_event, | 326 | ret = wait_event_timeout(pch_event, |
327 | (adap->pch_event_flag != 0), msecs_to_jiffies(50)); | 327 | (adap->pch_event_flag != 0), msecs_to_jiffies(1000)); |
328 | 328 | ||
329 | if (ret == 0) { | 329 | if (ret == 0) { |
330 | pch_err(adap, "timeout: %x\n", adap->pch_event_flag); | 330 | pch_err(adap, "timeout: %x\n", adap->pch_event_flag); |
@@ -1063,6 +1063,6 @@ module_exit(pch_pci_exit); | |||
1063 | 1063 | ||
1064 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semico ML7213/ML7223/ML7831 IOH I2C"); | 1064 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semico ML7213/ML7223/ML7831 IOH I2C"); |
1065 | MODULE_LICENSE("GPL"); | 1065 | MODULE_LICENSE("GPL"); |
1066 | MODULE_AUTHOR("Tomoya MORINAGA. <tomoya-linux@dsn.lapis-semi.com>"); | 1066 | MODULE_AUTHOR("Tomoya MORINAGA. <tomoya.rohm@gmail.com>"); |
1067 | module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR)); | 1067 | module_param(pch_i2c_speed, int, (S_IRUSR | S_IWUSR)); |
1068 | module_param(pch_clk, int, (S_IRUSR | S_IWUSR)); | 1068 | module_param(pch_clk, int, (S_IRUSR | S_IWUSR)); |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 3d471d56bf15..76b8af44f634 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -227,6 +227,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
227 | return -EINVAL; | 227 | return -EINVAL; |
228 | 228 | ||
229 | init_completion(&i2c->cmd_complete); | 229 | init_completion(&i2c->cmd_complete); |
230 | i2c->cmd_err = 0; | ||
230 | 231 | ||
231 | flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0; | 232 | flags = stop ? MXS_I2C_CTRL0_POST_SEND_STOP : 0; |
232 | 233 | ||
@@ -252,6 +253,9 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
252 | 253 | ||
253 | if (i2c->cmd_err == -ENXIO) | 254 | if (i2c->cmd_err == -ENXIO) |
254 | mxs_i2c_reset(i2c); | 255 | mxs_i2c_reset(i2c); |
256 | else | ||
257 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
258 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
255 | 259 | ||
256 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); | 260 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); |
257 | 261 | ||
@@ -299,8 +303,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
299 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | MXS_I2C_CTRL1_SLAVE_IRQ)) | 303 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | MXS_I2C_CTRL1_SLAVE_IRQ)) |
300 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ | 304 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ |
301 | i2c->cmd_err = -EIO; | 305 | i2c->cmd_err = -EIO; |
302 | else | ||
303 | i2c->cmd_err = 0; | ||
304 | 306 | ||
305 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & | 307 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & |
306 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; | 308 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; |
@@ -384,8 +386,6 @@ static int __devexit mxs_i2c_remove(struct platform_device *pdev) | |||
384 | if (ret) | 386 | if (ret) |
385 | return -EBUSY; | 387 | return -EBUSY; |
386 | 388 | ||
387 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
388 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
389 | writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); | 389 | writel(MXS_I2C_CTRL0_SFTRST, i2c->regs + MXS_I2C_CTRL0_SET); |
390 | 390 | ||
391 | platform_set_drvdata(pdev, NULL); | 391 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 04be9f82e14b..eb8ad538c79f 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c | |||
@@ -546,8 +546,7 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev, | |||
546 | { | 546 | { |
547 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); | 547 | struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev); |
548 | 548 | ||
549 | /* FIXME: shouldn't this be clk_disable? */ | 549 | clk_disable(alg_data->clk); |
550 | clk_enable(alg_data->clk); | ||
551 | 550 | ||
552 | return 0; | 551 | return 0; |
553 | } | 552 | } |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index e978635e60f0..55e5ea62ccee 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -516,6 +516,14 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, | |||
516 | if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) | 516 | if (likely(i2c_dev->msg_err == I2C_ERR_NONE)) |
517 | return 0; | 517 | return 0; |
518 | 518 | ||
519 | /* | ||
520 | * NACK interrupt is generated before the I2C controller generates the | ||
521 | * STOP condition on the bus. So wait for 2 clock periods before resetting | ||
522 | * the controller so that STOP condition has been delivered properly. | ||
523 | */ | ||
524 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) | ||
525 | udelay(DIV_ROUND_UP(2 * 1000000, i2c_dev->bus_clk_rate)); | ||
526 | |||
519 | tegra_i2c_init(i2c_dev); | 527 | tegra_i2c_init(i2c_dev); |
520 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { | 528 | if (i2c_dev->msg_err == I2C_ERR_NO_ACK) { |
521 | if (msg->flags & I2C_M_IGNORE_NAK) | 529 | if (msg->flags & I2C_M_IGNORE_NAK) |
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 426bb7617ec6..b0d0bc8a6fb6 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c | |||
@@ -1854,6 +1854,8 @@ static bool generate_unmatched_resp(struct ib_mad_private *recv, | |||
1854 | response->mad.mad.mad_hdr.method = IB_MGMT_METHOD_GET_RESP; | 1854 | response->mad.mad.mad_hdr.method = IB_MGMT_METHOD_GET_RESP; |
1855 | response->mad.mad.mad_hdr.status = | 1855 | response->mad.mad.mad_hdr.status = |
1856 | cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB); | 1856 | cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB); |
1857 | if (recv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE) | ||
1858 | response->mad.mad.mad_hdr.status |= IB_SMP_DIRECTION; | ||
1857 | 1859 | ||
1858 | return true; | 1860 | return true; |
1859 | } else { | 1861 | } else { |
@@ -1869,6 +1871,7 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, | |||
1869 | struct ib_mad_list_head *mad_list; | 1871 | struct ib_mad_list_head *mad_list; |
1870 | struct ib_mad_agent_private *mad_agent; | 1872 | struct ib_mad_agent_private *mad_agent; |
1871 | int port_num; | 1873 | int port_num; |
1874 | int ret = IB_MAD_RESULT_SUCCESS; | ||
1872 | 1875 | ||
1873 | mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; | 1876 | mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id; |
1874 | qp_info = mad_list->mad_queue->qp_info; | 1877 | qp_info = mad_list->mad_queue->qp_info; |
@@ -1952,8 +1955,6 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv, | |||
1952 | local: | 1955 | local: |
1953 | /* Give driver "right of first refusal" on incoming MAD */ | 1956 | /* Give driver "right of first refusal" on incoming MAD */ |
1954 | if (port_priv->device->process_mad) { | 1957 | if (port_priv->device->process_mad) { |
1955 | int ret; | ||
1956 | |||
1957 | ret = port_priv->device->process_mad(port_priv->device, 0, | 1958 | ret = port_priv->device->process_mad(port_priv->device, 0, |
1958 | port_priv->port_num, | 1959 | port_priv->port_num, |
1959 | wc, &recv->grh, | 1960 | wc, &recv->grh, |
@@ -1981,7 +1982,8 @@ local: | |||
1981 | * or via recv_handler in ib_mad_complete_recv() | 1982 | * or via recv_handler in ib_mad_complete_recv() |
1982 | */ | 1983 | */ |
1983 | recv = NULL; | 1984 | recv = NULL; |
1984 | } else if (generate_unmatched_resp(recv, response)) { | 1985 | } else if ((ret & IB_MAD_RESULT_SUCCESS) && |
1986 | generate_unmatched_resp(recv, response)) { | ||
1985 | agent_send_response(&response->mad.mad, &recv->grh, wc, | 1987 | agent_send_response(&response->mad.mad, &recv->grh, wc, |
1986 | port_priv->device, port_num, qp_info->qp->qp_num); | 1988 | port_priv->device, port_num, qp_info->qp->qp_num); |
1987 | } | 1989 | } |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 669673e81439..b948b6dd5d55 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -247,7 +247,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port, | |||
247 | err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, | 247 | err = mlx4_MAD_IFC(to_mdev(ibdev), 1, 1, port, |
248 | NULL, NULL, in_mad, out_mad); | 248 | NULL, NULL, in_mad, out_mad); |
249 | if (err) | 249 | if (err) |
250 | return err; | 250 | goto out; |
251 | 251 | ||
252 | /* Checking LinkSpeedActive for FDR-10 */ | 252 | /* Checking LinkSpeedActive for FDR-10 */ |
253 | if (out_mad->data[15] & 0x1) | 253 | if (out_mad->data[15] & 0x1) |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 2d787796bf50..7faf4a7fcaa9 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -380,8 +380,7 @@ config INPUT_TWL4030_VIBRA | |||
380 | 380 | ||
381 | config INPUT_TWL6040_VIBRA | 381 | config INPUT_TWL6040_VIBRA |
382 | tristate "Support for TWL6040 Vibrator" | 382 | tristate "Support for TWL6040 Vibrator" |
383 | depends on TWL4030_CORE | 383 | depends on TWL6040_CORE |
384 | select TWL6040_CORE | ||
385 | select INPUT_FF_MEMLESS | 384 | select INPUT_FF_MEMLESS |
386 | help | 385 | help |
387 | This option enables support for TWL6040 Vibrator Driver. | 386 | This option enables support for TWL6040 Vibrator Driver. |
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index 45874fed523a..14e94f56cb7d 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | #include <linux/i2c/twl.h> | 31 | #include <linux/input.h> |
32 | #include <linux/mfd/twl6040.h> | 32 | #include <linux/mfd/twl6040.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
@@ -257,7 +257,7 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); | |||
257 | 257 | ||
258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) | 258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) |
259 | { | 259 | { |
260 | struct twl4030_vibra_data *pdata = pdev->dev.platform_data; | 260 | struct twl6040_vibra_data *pdata = pdev->dev.platform_data; |
261 | struct vibra_info *info; | 261 | struct vibra_info *info; |
262 | int ret; | 262 | int ret; |
263 | 263 | ||
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 8081a0a5d602..a4b14a41cbf4 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -274,7 +274,8 @@ static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse) | |||
274 | static unsigned char param = 0xc8; | 274 | static unsigned char param = 0xc8; |
275 | struct synaptics_data *priv = psmouse->private; | 275 | struct synaptics_data *priv = psmouse->private; |
276 | 276 | ||
277 | if (!SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) | 277 | if (!(SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) || |
278 | SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c))) | ||
278 | return 0; | 279 | return 0; |
279 | 280 | ||
280 | if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) | 281 | if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL)) |
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c index 800243b6037e..64ad702a2ecc 100644 --- a/drivers/leds/leds-atmel-pwm.c +++ b/drivers/leds/leds-atmel-pwm.c | |||
@@ -35,7 +35,7 @@ static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b) | |||
35 | * NOTE: we reuse the platform_data structure of GPIO leds, | 35 | * NOTE: we reuse the platform_data structure of GPIO leds, |
36 | * but repurpose its "gpio" number as a PWM channel number. | 36 | * but repurpose its "gpio" number as a PWM channel number. |
37 | */ | 37 | */ |
38 | static int __init pwmled_probe(struct platform_device *pdev) | 38 | static int __devinit pwmled_probe(struct platform_device *pdev) |
39 | { | 39 | { |
40 | const struct gpio_led_platform_data *pdata; | 40 | const struct gpio_led_platform_data *pdata; |
41 | struct pwmled *leds; | 41 | struct pwmled *leds; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 97e73e555d11..17e2b472e16d 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -1727,8 +1727,7 @@ int bitmap_create(struct mddev *mddev) | |||
1727 | bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) | 1727 | bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) |
1728 | - BITMAP_BLOCK_SHIFT); | 1728 | - BITMAP_BLOCK_SHIFT); |
1729 | 1729 | ||
1730 | /* now that chunksize and chunkshift are set, we can use these macros */ | 1730 | chunks = (blocks + (1 << bitmap->chunkshift) - 1) >> |
1731 | chunks = (blocks + bitmap->chunkshift - 1) >> | ||
1732 | bitmap->chunkshift; | 1731 | bitmap->chunkshift; |
1733 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; | 1732 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; |
1734 | 1733 | ||
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h index 55ca5aec84e4..b44b0aba2d47 100644 --- a/drivers/md/bitmap.h +++ b/drivers/md/bitmap.h | |||
@@ -101,9 +101,6 @@ typedef __u16 bitmap_counter_t; | |||
101 | 101 | ||
102 | #define BITMAP_BLOCK_SHIFT 9 | 102 | #define BITMAP_BLOCK_SHIFT 9 |
103 | 103 | ||
104 | /* how many blocks per chunk? (this is variable) */ | ||
105 | #define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->mddev->bitmap_info.chunksize >> BITMAP_BLOCK_SHIFT) | ||
106 | |||
107 | #endif | 104 | #endif |
108 | 105 | ||
109 | /* | 106 | /* |
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index b0ba52459ed7..68965e663248 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -859,7 +859,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) | |||
859 | int ret; | 859 | int ret; |
860 | unsigned redundancy = 0; | 860 | unsigned redundancy = 0; |
861 | struct raid_dev *dev; | 861 | struct raid_dev *dev; |
862 | struct md_rdev *rdev, *freshest; | 862 | struct md_rdev *rdev, *tmp, *freshest; |
863 | struct mddev *mddev = &rs->md; | 863 | struct mddev *mddev = &rs->md; |
864 | 864 | ||
865 | switch (rs->raid_type->level) { | 865 | switch (rs->raid_type->level) { |
@@ -877,7 +877,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) | |||
877 | } | 877 | } |
878 | 878 | ||
879 | freshest = NULL; | 879 | freshest = NULL; |
880 | rdev_for_each(rdev, mddev) { | 880 | rdev_for_each_safe(rdev, tmp, mddev) { |
881 | if (!rdev->meta_bdev) | 881 | if (!rdev->meta_bdev) |
882 | continue; | 882 | continue; |
883 | 883 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index b572e1e386ce..477eb2e180c0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7560,14 +7560,14 @@ void md_check_recovery(struct mddev *mddev) | |||
7560 | * any transients in the value of "sync_action". | 7560 | * any transients in the value of "sync_action". |
7561 | */ | 7561 | */ |
7562 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); | 7562 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); |
7563 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
7564 | /* Clear some bits that don't mean anything, but | 7563 | /* Clear some bits that don't mean anything, but |
7565 | * might be left set | 7564 | * might be left set |
7566 | */ | 7565 | */ |
7567 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); | 7566 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); |
7568 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); | 7567 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); |
7569 | 7568 | ||
7570 | if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) | 7569 | if (!test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || |
7570 | test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) | ||
7571 | goto unlock; | 7571 | goto unlock; |
7572 | /* no recovery is running. | 7572 | /* no recovery is running. |
7573 | * remove any failed drives, then | 7573 | * remove any failed drives, then |
@@ -8140,7 +8140,8 @@ static int md_notify_reboot(struct notifier_block *this, | |||
8140 | 8140 | ||
8141 | for_each_mddev(mddev, tmp) { | 8141 | for_each_mddev(mddev, tmp) { |
8142 | if (mddev_trylock(mddev)) { | 8142 | if (mddev_trylock(mddev)) { |
8143 | __md_stop_writes(mddev); | 8143 | if (mddev->pers) |
8144 | __md_stop_writes(mddev); | ||
8144 | mddev->safemode = 2; | 8145 | mddev->safemode = 2; |
8145 | mddev_unlock(mddev); | 8146 | mddev_unlock(mddev); |
8146 | } | 8147 | } |
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 7f98984e4fad..eab2ea424200 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
@@ -54,6 +54,7 @@ struct xc5000_priv { | |||
54 | struct list_head hybrid_tuner_instance_list; | 54 | struct list_head hybrid_tuner_instance_list; |
55 | 55 | ||
56 | u32 if_khz; | 56 | u32 if_khz; |
57 | u32 xtal_khz; | ||
57 | u32 freq_hz; | 58 | u32 freq_hz; |
58 | u32 bandwidth; | 59 | u32 bandwidth; |
59 | u8 video_standard; | 60 | u8 video_standard; |
@@ -214,9 +215,9 @@ static const struct xc5000_fw_cfg xc5000a_1_6_114 = { | |||
214 | .size = 12401, | 215 | .size = 12401, |
215 | }; | 216 | }; |
216 | 217 | ||
217 | static const struct xc5000_fw_cfg xc5000c_41_024_5_31875 = { | 218 | static const struct xc5000_fw_cfg xc5000c_41_024_5 = { |
218 | .name = "dvb-fe-xc5000c-41.024.5-31875.fw", | 219 | .name = "dvb-fe-xc5000c-41.024.5.fw", |
219 | .size = 16503, | 220 | .size = 16497, |
220 | }; | 221 | }; |
221 | 222 | ||
222 | static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) | 223 | static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) |
@@ -226,7 +227,7 @@ static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) | |||
226 | case XC5000A: | 227 | case XC5000A: |
227 | return &xc5000a_1_6_114; | 228 | return &xc5000a_1_6_114; |
228 | case XC5000C: | 229 | case XC5000C: |
229 | return &xc5000c_41_024_5_31875; | 230 | return &xc5000c_41_024_5; |
230 | } | 231 | } |
231 | } | 232 | } |
232 | 233 | ||
@@ -572,6 +573,31 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode) | |||
572 | return found; | 573 | return found; |
573 | } | 574 | } |
574 | 575 | ||
576 | static int xc_set_xtal(struct dvb_frontend *fe) | ||
577 | { | ||
578 | struct xc5000_priv *priv = fe->tuner_priv; | ||
579 | int ret = XC_RESULT_SUCCESS; | ||
580 | |||
581 | switch (priv->chip_id) { | ||
582 | default: | ||
583 | case XC5000A: | ||
584 | /* 32.000 MHz xtal is default */ | ||
585 | break; | ||
586 | case XC5000C: | ||
587 | switch (priv->xtal_khz) { | ||
588 | default: | ||
589 | case 32000: | ||
590 | /* 32.000 MHz xtal is default */ | ||
591 | break; | ||
592 | case 31875: | ||
593 | /* 31.875 MHz xtal configuration */ | ||
594 | ret = xc_write_reg(priv, 0x000f, 0x8081); | ||
595 | break; | ||
596 | } | ||
597 | break; | ||
598 | } | ||
599 | return ret; | ||
600 | } | ||
575 | 601 | ||
576 | static int xc5000_fwupload(struct dvb_frontend *fe) | 602 | static int xc5000_fwupload(struct dvb_frontend *fe) |
577 | { | 603 | { |
@@ -603,6 +629,8 @@ static int xc5000_fwupload(struct dvb_frontend *fe) | |||
603 | } else { | 629 | } else { |
604 | printk(KERN_INFO "xc5000: firmware uploading...\n"); | 630 | printk(KERN_INFO "xc5000: firmware uploading...\n"); |
605 | ret = xc_load_i2c_sequence(fe, fw->data); | 631 | ret = xc_load_i2c_sequence(fe, fw->data); |
632 | if (XC_RESULT_SUCCESS == ret) | ||
633 | ret = xc_set_xtal(fe); | ||
606 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); | 634 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); |
607 | } | 635 | } |
608 | 636 | ||
@@ -1164,6 +1192,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | |||
1164 | priv->if_khz = cfg->if_khz; | 1192 | priv->if_khz = cfg->if_khz; |
1165 | } | 1193 | } |
1166 | 1194 | ||
1195 | if (priv->xtal_khz == 0) | ||
1196 | priv->xtal_khz = cfg->xtal_khz; | ||
1197 | |||
1167 | if (priv->radio_input == 0) | 1198 | if (priv->radio_input == 0) |
1168 | priv->radio_input = cfg->radio_input; | 1199 | priv->radio_input = cfg->radio_input; |
1169 | 1200 | ||
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h index 3396f8e02b40..39a73bf01406 100644 --- a/drivers/media/common/tuners/xc5000.h +++ b/drivers/media/common/tuners/xc5000.h | |||
@@ -34,6 +34,7 @@ struct xc5000_config { | |||
34 | u8 i2c_address; | 34 | u8 i2c_address; |
35 | u32 if_khz; | 35 | u32 if_khz; |
36 | u8 radio_input; | 36 | u8 radio_input; |
37 | u32 xtal_khz; | ||
37 | 38 | ||
38 | int chip_id; | 39 | int chip_id; |
39 | }; | 40 | }; |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 39696c6a4ed7..0f64d7182657 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -1446,6 +1446,28 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) | |||
1446 | __func__); | 1446 | __func__); |
1447 | return -EINVAL; | 1447 | return -EINVAL; |
1448 | } | 1448 | } |
1449 | /* | ||
1450 | * Get a delivery system that is compatible with DVBv3 | ||
1451 | * NOTE: in order for this to work with softwares like Kaffeine that | ||
1452 | * uses a DVBv5 call for DVB-S2 and a DVBv3 call to go back to | ||
1453 | * DVB-S, drivers that support both should put the SYS_DVBS entry | ||
1454 | * before the SYS_DVBS2, otherwise it won't switch back to DVB-S. | ||
1455 | * The real fix is that userspace applications should not use DVBv3 | ||
1456 | * and not trust on calling FE_SET_FRONTEND to switch the delivery | ||
1457 | * system. | ||
1458 | */ | ||
1459 | ncaps = 0; | ||
1460 | while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) { | ||
1461 | if (fe->ops.delsys[ncaps] == desired_system) { | ||
1462 | delsys = desired_system; | ||
1463 | break; | ||
1464 | } | ||
1465 | ncaps++; | ||
1466 | } | ||
1467 | if (delsys == SYS_UNDEFINED) { | ||
1468 | dprintk("%s() Couldn't find a delivery system that matches %d\n", | ||
1469 | __func__, desired_system); | ||
1470 | } | ||
1449 | } else { | 1471 | } else { |
1450 | /* | 1472 | /* |
1451 | * This is a DVBv5 call. So, it likely knows the supported | 1473 | * This is a DVBv5 call. So, it likely knows the supported |
@@ -1494,9 +1516,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) | |||
1494 | __func__); | 1516 | __func__); |
1495 | return -EINVAL; | 1517 | return -EINVAL; |
1496 | } | 1518 | } |
1497 | c->delivery_system = delsys; | ||
1498 | } | 1519 | } |
1499 | 1520 | ||
1521 | c->delivery_system = delsys; | ||
1522 | |||
1500 | /* | 1523 | /* |
1501 | * The DVBv3 or DVBv5 call is requesting a different system. So, | 1524 | * The DVBv3 or DVBv5 call is requesting a different system. So, |
1502 | * emulation is needed. | 1525 | * emulation is needed. |
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index 36d11756492f..a414b1f2b6a5 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c | |||
@@ -1520,8 +1520,10 @@ static int scu_command(struct drxk_state *state, | |||
1520 | dprintk(1, "\n"); | 1520 | dprintk(1, "\n"); |
1521 | 1521 | ||
1522 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || | 1522 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || |
1523 | ((resultLen > 0) && (result == NULL))) | 1523 | ((resultLen > 0) && (result == NULL))) { |
1524 | goto error; | 1524 | printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__); |
1525 | return status; | ||
1526 | } | ||
1525 | 1527 | ||
1526 | mutex_lock(&state->mutex); | 1528 | mutex_lock(&state->mutex); |
1527 | 1529 | ||
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index b09c5fae489b..af526586fa26 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
@@ -1046,6 +1046,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
1046 | goto exit_unregister_led; | 1046 | goto exit_unregister_led; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | data->dev->driver_type = RC_DRIVER_IR_RAW; | ||
1049 | data->dev->driver_name = WBCIR_NAME; | 1050 | data->dev->driver_name = WBCIR_NAME; |
1050 | data->dev->input_name = WBCIR_NAME; | 1051 | data->dev->input_name = WBCIR_NAME; |
1051 | data->dev->input_phys = "wbcir/cir0"; | 1052 | data->dev->input_phys = "wbcir/cir0"; |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index f2479c5c0eb2..ce1e7ba940f6 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -492,7 +492,7 @@ config VIDEO_VS6624 | |||
492 | 492 | ||
493 | config VIDEO_MT9M032 | 493 | config VIDEO_MT9M032 |
494 | tristate "MT9M032 camera sensor support" | 494 | tristate "MT9M032 camera sensor support" |
495 | depends on I2C && VIDEO_V4L2 | 495 | depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API |
496 | select VIDEO_APTINA_PLL | 496 | select VIDEO_APTINA_PLL |
497 | ---help--- | 497 | ---help--- |
498 | This driver supports MT9M032 camera sensors from Aptina, monochrome | 498 | This driver supports MT9M032 camera sensors from Aptina, monochrome |
diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c index 7636672c3548..645973c5feb0 100644 --- a/drivers/media/video/mt9m032.c +++ b/drivers/media/video/mt9m032.c | |||
@@ -392,10 +392,11 @@ static int mt9m032_set_pad_format(struct v4l2_subdev *subdev, | |||
392 | } | 392 | } |
393 | 393 | ||
394 | /* Scaling is not supported, the format is thus fixed. */ | 394 | /* Scaling is not supported, the format is thus fixed. */ |
395 | ret = mt9m032_get_pad_format(subdev, fh, fmt); | 395 | fmt->format = *__mt9m032_get_pad_format(sensor, fh, fmt->which); |
396 | ret = 0; | ||
396 | 397 | ||
397 | done: | 398 | done: |
398 | mutex_lock(&sensor->lock); | 399 | mutex_unlock(&sensor->lock); |
399 | return ret; | 400 | return ret; |
400 | } | 401 | } |
401 | 402 | ||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 29f463cc09cb..11e44386fa9b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -268,10 +268,17 @@ config TWL6030_PWM | |||
268 | This is used to control charging LED brightness. | 268 | This is used to control charging LED brightness. |
269 | 269 | ||
270 | config TWL6040_CORE | 270 | config TWL6040_CORE |
271 | bool | 271 | bool "Support for TWL6040 audio codec" |
272 | depends on TWL4030_CORE && GENERIC_HARDIRQS | 272 | depends on I2C=y && GENERIC_HARDIRQS |
273 | select MFD_CORE | 273 | select MFD_CORE |
274 | select REGMAP_I2C | ||
274 | default n | 275 | default n |
276 | help | ||
277 | Say yes here if you want support for Texas Instruments TWL6040 audio | ||
278 | codec. | ||
279 | This driver provides common support for accessing the device, | ||
280 | additional drivers must be enabled in order to use the | ||
281 | functionality of the device (audio, vibra). | ||
275 | 282 | ||
276 | config MFD_STMPE | 283 | config MFD_STMPE |
277 | bool "Support STMicroelectronics STMPE" | 284 | bool "Support STMicroelectronics STMPE" |
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 1895cf9fab8c..1582c3d95257 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -527,7 +527,9 @@ static void asic3_gpio_set(struct gpio_chip *chip, | |||
527 | 527 | ||
528 | static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 528 | static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
529 | { | 529 | { |
530 | return (offset < ASIC3_NUM_GPIOS) ? IRQ_BOARD_START + offset : -ENXIO; | 530 | struct asic3 *asic = container_of(chip, struct asic3, gpio); |
531 | |||
532 | return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO; | ||
531 | } | 533 | } |
532 | 534 | ||
533 | static __init int asic3_gpio_probe(struct platform_device *pdev, | 535 | static __init int asic3_gpio_probe(struct platform_device *pdev, |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 95a2e546a489..7e96bb229724 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -25,7 +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/usb.h> | 29 | #include <plat/usb.h> |
30 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
31 | 31 | ||
@@ -502,19 +502,6 @@ static void omap_usbhs_init(struct device *dev) | |||
502 | pm_runtime_get_sync(dev); | 502 | pm_runtime_get_sync(dev); |
503 | spin_lock_irqsave(&omap->lock, flags); | 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 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); | 505 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); |
519 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); | 506 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); |
520 | 507 | ||
@@ -593,39 +580,10 @@ static void omap_usbhs_init(struct device *dev) | |||
593 | usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); | 580 | usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); |
594 | } | 581 | } |
595 | 582 | ||
596 | if (pdata->ehci_data->phy_reset) { | ||
597 | /* Hold the PHY in RESET for enough time till | ||
598 | * PHY is settled and ready | ||
599 | */ | ||
600 | udelay(10); | ||
601 | |||
602 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
603 | gpio_set_value | ||
604 | (pdata->ehci_data->reset_gpio_port[0], 1); | ||
605 | |||
606 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
607 | gpio_set_value | ||
608 | (pdata->ehci_data->reset_gpio_port[1], 1); | ||
609 | } | ||
610 | |||
611 | spin_unlock_irqrestore(&omap->lock, flags); | 583 | spin_unlock_irqrestore(&omap->lock, flags); |
612 | pm_runtime_put_sync(dev); | 584 | pm_runtime_put_sync(dev); |
613 | } | 585 | } |
614 | 586 | ||
615 | static void omap_usbhs_deinit(struct device *dev) | ||
616 | { | ||
617 | struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); | ||
618 | struct usbhs_omap_platform_data *pdata = &omap->platdata; | ||
619 | |||
620 | if (pdata->ehci_data->phy_reset) { | ||
621 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
622 | gpio_free(pdata->ehci_data->reset_gpio_port[0]); | ||
623 | |||
624 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
625 | gpio_free(pdata->ehci_data->reset_gpio_port[1]); | ||
626 | } | ||
627 | } | ||
628 | |||
629 | 587 | ||
630 | /** | 588 | /** |
631 | * usbhs_omap_probe - initialize TI-based HCDs | 589 | * usbhs_omap_probe - initialize TI-based HCDs |
@@ -860,7 +818,6 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev) | |||
860 | { | 818 | { |
861 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); | 819 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); |
862 | 820 | ||
863 | omap_usbhs_deinit(&pdev->dev); | ||
864 | iounmap(omap->tll_base); | 821 | iounmap(omap->tll_base); |
865 | iounmap(omap->uhh_base); | 822 | iounmap(omap->uhh_base); |
866 | clk_put(omap->init_60m_fclk); | 823 | clk_put(omap->init_60m_fclk); |
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c index 99ef944c621d..44afae0a69ce 100644 --- a/drivers/mfd/rc5t583.c +++ b/drivers/mfd/rc5t583.c | |||
@@ -80,44 +80,6 @@ static struct mfd_cell rc5t583_subdevs[] = { | |||
80 | {.name = "rc5t583-key", } | 80 | {.name = "rc5t583-key", } |
81 | }; | 81 | }; |
82 | 82 | ||
83 | int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) | ||
84 | { | ||
85 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
86 | return regmap_write(rc5t583->regmap, reg, val); | ||
87 | } | ||
88 | |||
89 | int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) | ||
90 | { | ||
91 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
92 | unsigned int ival; | ||
93 | int ret; | ||
94 | ret = regmap_read(rc5t583->regmap, reg, &ival); | ||
95 | if (!ret) | ||
96 | *val = (uint8_t)ival; | ||
97 | return ret; | ||
98 | } | ||
99 | |||
100 | int rc5t583_set_bits(struct device *dev, unsigned int reg, | ||
101 | unsigned int bit_mask) | ||
102 | { | ||
103 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
104 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); | ||
105 | } | ||
106 | |||
107 | int rc5t583_clear_bits(struct device *dev, unsigned int reg, | ||
108 | unsigned int bit_mask) | ||
109 | { | ||
110 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
111 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); | ||
112 | } | ||
113 | |||
114 | int rc5t583_update(struct device *dev, unsigned int reg, | ||
115 | unsigned int val, unsigned int mask) | ||
116 | { | ||
117 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
118 | return regmap_update_bits(rc5t583->regmap, reg, mask, val); | ||
119 | } | ||
120 | |||
121 | static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, | 83 | static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, |
122 | int id, int ext_pwr, int slots) | 84 | int id, int ext_pwr, int slots) |
123 | { | 85 | { |
@@ -197,6 +159,7 @@ int rc5t583_ext_power_req_config(struct device *dev, int ds_id, | |||
197 | ds_id, ext_pwr_req); | 159 | ds_id, ext_pwr_req); |
198 | return 0; | 160 | return 0; |
199 | } | 161 | } |
162 | EXPORT_SYMBOL(rc5t583_ext_power_req_config); | ||
200 | 163 | ||
201 | static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, | 164 | static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, |
202 | struct rc5t583_platform_data *pdata) | 165 | struct rc5t583_platform_data *pdata) |
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index b2d8e512d3cb..2d6bedadca09 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
@@ -30,7 +30,9 @@ | |||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/i2c/twl.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/regmap.h> | ||
35 | #include <linux/err.h> | ||
34 | #include <linux/mfd/core.h> | 36 | #include <linux/mfd/core.h> |
35 | #include <linux/mfd/twl6040.h> | 37 | #include <linux/mfd/twl6040.h> |
36 | 38 | ||
@@ -39,7 +41,7 @@ | |||
39 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | 41 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) |
40 | { | 42 | { |
41 | int ret; | 43 | int ret; |
42 | u8 val = 0; | 44 | unsigned int val; |
43 | 45 | ||
44 | mutex_lock(&twl6040->io_mutex); | 46 | mutex_lock(&twl6040->io_mutex); |
45 | /* Vibra control registers from cache */ | 47 | /* Vibra control registers from cache */ |
@@ -47,7 +49,7 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | |||
47 | reg == TWL6040_REG_VIBCTLR)) { | 49 | reg == TWL6040_REG_VIBCTLR)) { |
48 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; | 50 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; |
49 | } else { | 51 | } else { |
50 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 52 | ret = regmap_read(twl6040->regmap, reg, &val); |
51 | if (ret < 0) { | 53 | if (ret < 0) { |
52 | mutex_unlock(&twl6040->io_mutex); | 54 | mutex_unlock(&twl6040->io_mutex); |
53 | return ret; | 55 | return ret; |
@@ -64,7 +66,7 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val) | |||
64 | int ret; | 66 | int ret; |
65 | 67 | ||
66 | mutex_lock(&twl6040->io_mutex); | 68 | mutex_lock(&twl6040->io_mutex); |
67 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | 69 | ret = regmap_write(twl6040->regmap, reg, val); |
68 | /* Cache the vibra control registers */ | 70 | /* Cache the vibra control registers */ |
69 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) | 71 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) |
70 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; | 72 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; |
@@ -77,16 +79,9 @@ EXPORT_SYMBOL(twl6040_reg_write); | |||
77 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 79 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
78 | { | 80 | { |
79 | int ret; | 81 | int ret; |
80 | u8 val; | ||
81 | 82 | ||
82 | mutex_lock(&twl6040->io_mutex); | 83 | mutex_lock(&twl6040->io_mutex); |
83 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 84 | ret = regmap_update_bits(twl6040->regmap, reg, mask, mask); |
84 | if (ret) | ||
85 | goto out; | ||
86 | |||
87 | val |= mask; | ||
88 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | ||
89 | out: | ||
90 | mutex_unlock(&twl6040->io_mutex); | 85 | mutex_unlock(&twl6040->io_mutex); |
91 | return ret; | 86 | return ret; |
92 | } | 87 | } |
@@ -95,16 +90,9 @@ EXPORT_SYMBOL(twl6040_set_bits); | |||
95 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 90 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
96 | { | 91 | { |
97 | int ret; | 92 | int ret; |
98 | u8 val; | ||
99 | 93 | ||
100 | mutex_lock(&twl6040->io_mutex); | 94 | mutex_lock(&twl6040->io_mutex); |
101 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 95 | ret = regmap_update_bits(twl6040->regmap, reg, mask, 0); |
102 | if (ret) | ||
103 | goto out; | ||
104 | |||
105 | val &= ~mask; | ||
106 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | ||
107 | out: | ||
108 | mutex_unlock(&twl6040->io_mutex); | 96 | mutex_unlock(&twl6040->io_mutex); |
109 | return ret; | 97 | return ret; |
110 | } | 98 | } |
@@ -494,32 +482,58 @@ static struct resource twl6040_codec_rsrc[] = { | |||
494 | }, | 482 | }, |
495 | }; | 483 | }; |
496 | 484 | ||
497 | static int __devinit twl6040_probe(struct platform_device *pdev) | 485 | static bool twl6040_readable_reg(struct device *dev, unsigned int reg) |
498 | { | 486 | { |
499 | struct twl4030_audio_data *pdata = pdev->dev.platform_data; | 487 | /* Register 0 is not readable */ |
488 | if (!reg) | ||
489 | return false; | ||
490 | return true; | ||
491 | } | ||
492 | |||
493 | static struct regmap_config twl6040_regmap_config = { | ||
494 | .reg_bits = 8, | ||
495 | .val_bits = 8, | ||
496 | .max_register = TWL6040_REG_STATUS, /* 0x2e */ | ||
497 | |||
498 | .readable_reg = twl6040_readable_reg, | ||
499 | }; | ||
500 | |||
501 | static int __devinit twl6040_probe(struct i2c_client *client, | ||
502 | const struct i2c_device_id *id) | ||
503 | { | ||
504 | struct twl6040_platform_data *pdata = client->dev.platform_data; | ||
500 | struct twl6040 *twl6040; | 505 | struct twl6040 *twl6040; |
501 | struct mfd_cell *cell = NULL; | 506 | struct mfd_cell *cell = NULL; |
502 | int ret, children = 0; | 507 | int ret, children = 0; |
503 | 508 | ||
504 | if (!pdata) { | 509 | if (!pdata) { |
505 | dev_err(&pdev->dev, "Platform data is missing\n"); | 510 | dev_err(&client->dev, "Platform data is missing\n"); |
506 | return -EINVAL; | 511 | return -EINVAL; |
507 | } | 512 | } |
508 | 513 | ||
509 | /* In order to operate correctly we need valid interrupt config */ | 514 | /* In order to operate correctly we need valid interrupt config */ |
510 | if (!pdata->naudint_irq || !pdata->irq_base) { | 515 | if (!client->irq || !pdata->irq_base) { |
511 | dev_err(&pdev->dev, "Invalid IRQ configuration\n"); | 516 | dev_err(&client->dev, "Invalid IRQ configuration\n"); |
512 | return -EINVAL; | 517 | return -EINVAL; |
513 | } | 518 | } |
514 | 519 | ||
515 | twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); | 520 | twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040), |
516 | if (!twl6040) | 521 | GFP_KERNEL); |
517 | return -ENOMEM; | 522 | if (!twl6040) { |
523 | ret = -ENOMEM; | ||
524 | goto err; | ||
525 | } | ||
526 | |||
527 | twl6040->regmap = regmap_init_i2c(client, &twl6040_regmap_config); | ||
528 | if (IS_ERR(twl6040->regmap)) { | ||
529 | ret = PTR_ERR(twl6040->regmap); | ||
530 | goto err; | ||
531 | } | ||
518 | 532 | ||
519 | platform_set_drvdata(pdev, twl6040); | 533 | i2c_set_clientdata(client, twl6040); |
520 | 534 | ||
521 | twl6040->dev = &pdev->dev; | 535 | twl6040->dev = &client->dev; |
522 | twl6040->irq = pdata->naudint_irq; | 536 | twl6040->irq = client->irq; |
523 | twl6040->irq_base = pdata->irq_base; | 537 | twl6040->irq_base = pdata->irq_base; |
524 | 538 | ||
525 | mutex_init(&twl6040->mutex); | 539 | mutex_init(&twl6040->mutex); |
@@ -588,12 +602,12 @@ static int __devinit twl6040_probe(struct platform_device *pdev) | |||
588 | } | 602 | } |
589 | 603 | ||
590 | if (children) { | 604 | if (children) { |
591 | ret = mfd_add_devices(&pdev->dev, pdev->id, twl6040->cells, | 605 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, |
592 | children, NULL, 0); | 606 | children, NULL, 0); |
593 | if (ret) | 607 | if (ret) |
594 | goto mfd_err; | 608 | goto mfd_err; |
595 | } else { | 609 | } else { |
596 | dev_err(&pdev->dev, "No platform data found for children\n"); | 610 | dev_err(&client->dev, "No platform data found for children\n"); |
597 | ret = -ENODEV; | 611 | ret = -ENODEV; |
598 | goto mfd_err; | 612 | goto mfd_err; |
599 | } | 613 | } |
@@ -608,14 +622,15 @@ gpio2_err: | |||
608 | if (gpio_is_valid(twl6040->audpwron)) | 622 | if (gpio_is_valid(twl6040->audpwron)) |
609 | gpio_free(twl6040->audpwron); | 623 | gpio_free(twl6040->audpwron); |
610 | gpio1_err: | 624 | gpio1_err: |
611 | platform_set_drvdata(pdev, NULL); | 625 | i2c_set_clientdata(client, NULL); |
612 | kfree(twl6040); | 626 | regmap_exit(twl6040->regmap); |
627 | err: | ||
613 | return ret; | 628 | return ret; |
614 | } | 629 | } |
615 | 630 | ||
616 | static int __devexit twl6040_remove(struct platform_device *pdev) | 631 | static int __devexit twl6040_remove(struct i2c_client *client) |
617 | { | 632 | { |
618 | struct twl6040 *twl6040 = platform_get_drvdata(pdev); | 633 | struct twl6040 *twl6040 = i2c_get_clientdata(client); |
619 | 634 | ||
620 | if (twl6040->power_count) | 635 | if (twl6040->power_count) |
621 | twl6040_power(twl6040, 0); | 636 | twl6040_power(twl6040, 0); |
@@ -626,23 +641,30 @@ static int __devexit twl6040_remove(struct platform_device *pdev) | |||
626 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); | 641 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); |
627 | twl6040_irq_exit(twl6040); | 642 | twl6040_irq_exit(twl6040); |
628 | 643 | ||
629 | mfd_remove_devices(&pdev->dev); | 644 | mfd_remove_devices(&client->dev); |
630 | platform_set_drvdata(pdev, NULL); | 645 | i2c_set_clientdata(client, NULL); |
631 | kfree(twl6040); | 646 | regmap_exit(twl6040->regmap); |
632 | 647 | ||
633 | return 0; | 648 | return 0; |
634 | } | 649 | } |
635 | 650 | ||
636 | static struct platform_driver twl6040_driver = { | 651 | static const struct i2c_device_id twl6040_i2c_id[] = { |
652 | { "twl6040", 0, }, | ||
653 | { }, | ||
654 | }; | ||
655 | MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id); | ||
656 | |||
657 | static struct i2c_driver twl6040_driver = { | ||
658 | .driver = { | ||
659 | .name = "twl6040", | ||
660 | .owner = THIS_MODULE, | ||
661 | }, | ||
637 | .probe = twl6040_probe, | 662 | .probe = twl6040_probe, |
638 | .remove = __devexit_p(twl6040_remove), | 663 | .remove = __devexit_p(twl6040_remove), |
639 | .driver = { | 664 | .id_table = twl6040_i2c_id, |
640 | .owner = THIS_MODULE, | ||
641 | .name = "twl6040", | ||
642 | }, | ||
643 | }; | 665 | }; |
644 | 666 | ||
645 | module_platform_driver(twl6040_driver); | 667 | module_i2c_driver(twl6040_driver); |
646 | 668 | ||
647 | MODULE_DESCRIPTION("TWL6040 MFD"); | 669 | MODULE_DESCRIPTION("TWL6040 MFD"); |
648 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); | 670 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index b1809650b7aa..dabec556ebb8 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -873,7 +873,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | |||
873 | { | 873 | { |
874 | struct mmc_blk_data *md = mq->data; | 874 | struct mmc_blk_data *md = mq->data; |
875 | struct mmc_card *card = md->queue.card; | 875 | struct mmc_card *card = md->queue.card; |
876 | unsigned int from, nr, arg; | 876 | unsigned int from, nr, arg, trim_arg, erase_arg; |
877 | int err = 0, type = MMC_BLK_SECDISCARD; | 877 | int err = 0, type = MMC_BLK_SECDISCARD; |
878 | 878 | ||
879 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { | 879 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { |
@@ -881,20 +881,26 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | |||
881 | goto out; | 881 | goto out; |
882 | } | 882 | } |
883 | 883 | ||
884 | from = blk_rq_pos(req); | ||
885 | nr = blk_rq_sectors(req); | ||
886 | |||
884 | /* The sanitize operation is supported at v4.5 only */ | 887 | /* The sanitize operation is supported at v4.5 only */ |
885 | if (mmc_can_sanitize(card)) { | 888 | if (mmc_can_sanitize(card)) { |
886 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 889 | erase_arg = MMC_ERASE_ARG; |
887 | EXT_CSD_SANITIZE_START, 1, 0); | 890 | trim_arg = MMC_TRIM_ARG; |
888 | goto out; | 891 | } else { |
892 | erase_arg = MMC_SECURE_ERASE_ARG; | ||
893 | trim_arg = MMC_SECURE_TRIM1_ARG; | ||
889 | } | 894 | } |
890 | 895 | ||
891 | from = blk_rq_pos(req); | 896 | if (mmc_erase_group_aligned(card, from, nr)) |
892 | nr = blk_rq_sectors(req); | 897 | arg = erase_arg; |
893 | 898 | else if (mmc_can_trim(card)) | |
894 | if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) | 899 | arg = trim_arg; |
895 | arg = MMC_SECURE_TRIM1_ARG; | 900 | else { |
896 | else | 901 | err = -EINVAL; |
897 | arg = MMC_SECURE_ERASE_ARG; | 902 | goto out; |
903 | } | ||
898 | retry: | 904 | retry: |
899 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | 905 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { |
900 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 906 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
@@ -904,25 +910,41 @@ retry: | |||
904 | INAND_CMD38_ARG_SECERASE, | 910 | INAND_CMD38_ARG_SECERASE, |
905 | 0); | 911 | 0); |
906 | if (err) | 912 | if (err) |
907 | goto out; | 913 | goto out_retry; |
908 | } | 914 | } |
915 | |||
909 | err = mmc_erase(card, from, nr, arg); | 916 | err = mmc_erase(card, from, nr, arg); |
910 | if (!err && arg == MMC_SECURE_TRIM1_ARG) { | 917 | if (err == -EIO) |
918 | goto out_retry; | ||
919 | if (err) | ||
920 | goto out; | ||
921 | |||
922 | if (arg == MMC_SECURE_TRIM1_ARG) { | ||
911 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | 923 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { |
912 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 924 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
913 | INAND_CMD38_ARG_EXT_CSD, | 925 | INAND_CMD38_ARG_EXT_CSD, |
914 | INAND_CMD38_ARG_SECTRIM2, | 926 | INAND_CMD38_ARG_SECTRIM2, |
915 | 0); | 927 | 0); |
916 | if (err) | 928 | if (err) |
917 | goto out; | 929 | goto out_retry; |
918 | } | 930 | } |
931 | |||
919 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); | 932 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); |
933 | if (err == -EIO) | ||
934 | goto out_retry; | ||
935 | if (err) | ||
936 | goto out; | ||
920 | } | 937 | } |
921 | out: | 938 | |
922 | if (err == -EIO && !mmc_blk_reset(md, card->host, type)) | 939 | if (mmc_can_sanitize(card)) |
940 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
941 | EXT_CSD_SANITIZE_START, 1, 0); | ||
942 | out_retry: | ||
943 | if (err && !mmc_blk_reset(md, card->host, type)) | ||
923 | goto retry; | 944 | goto retry; |
924 | if (!err) | 945 | if (!err) |
925 | mmc_blk_reset_success(md, type); | 946 | mmc_blk_reset_success(md, type); |
947 | out: | ||
926 | spin_lock_irq(&md->lock); | 948 | spin_lock_irq(&md->lock); |
927 | __blk_end_request(req, err, blk_rq_bytes(req)); | 949 | __blk_end_request(req, err, blk_rq_bytes(req)); |
928 | spin_unlock_irq(&md->lock); | 950 | spin_unlock_irq(&md->lock); |
@@ -1802,7 +1824,7 @@ static void mmc_blk_remove(struct mmc_card *card) | |||
1802 | } | 1824 | } |
1803 | 1825 | ||
1804 | #ifdef CONFIG_PM | 1826 | #ifdef CONFIG_PM |
1805 | static int mmc_blk_suspend(struct mmc_card *card, pm_message_t state) | 1827 | static int mmc_blk_suspend(struct mmc_card *card) |
1806 | { | 1828 | { |
1807 | struct mmc_blk_data *part_md; | 1829 | struct mmc_blk_data *part_md; |
1808 | struct mmc_blk_data *md = mmc_get_drvdata(card); | 1830 | struct mmc_blk_data *md = mmc_get_drvdata(card); |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 2517547b4366..996f8e36e23d 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -139,7 +139,7 @@ static void mmc_queue_setup_discard(struct request_queue *q, | |||
139 | 139 | ||
140 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); | 140 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); |
141 | q->limits.max_discard_sectors = max_discard; | 141 | q->limits.max_discard_sectors = max_discard; |
142 | if (card->erased_byte == 0) | 142 | if (card->erased_byte == 0 && !mmc_can_discard(card)) |
143 | q->limits.discard_zeroes_data = 1; | 143 | q->limits.discard_zeroes_data = 1; |
144 | q->limits.discard_granularity = card->pref_erase << 9; | 144 | q->limits.discard_granularity = card->pref_erase << 9; |
145 | /* granularity must not be greater than max. discard */ | 145 | /* granularity must not be greater than max. discard */ |
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 3f606068d552..c60cee92a2b2 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev) | |||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | static int mmc_bus_suspend(struct device *dev, pm_message_t state) | 125 | static int mmc_bus_suspend(struct device *dev) |
126 | { | 126 | { |
127 | struct mmc_driver *drv = to_mmc_driver(dev->driver); | 127 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
128 | struct mmc_card *card = mmc_dev_to_card(dev); | 128 | struct mmc_card *card = mmc_dev_to_card(dev); |
129 | int ret = 0; | 129 | int ret = 0; |
130 | 130 | ||
131 | if (dev->driver && drv->suspend) | 131 | if (dev->driver && drv->suspend) |
132 | ret = drv->suspend(card, state); | 132 | ret = drv->suspend(card); |
133 | return ret; | 133 | return ret; |
134 | } | 134 | } |
135 | 135 | ||
@@ -165,20 +165,14 @@ static int mmc_runtime_idle(struct device *dev) | |||
165 | return pm_runtime_suspend(dev); | 165 | return pm_runtime_suspend(dev); |
166 | } | 166 | } |
167 | 167 | ||
168 | #endif /* !CONFIG_PM_RUNTIME */ | ||
169 | |||
168 | static const struct dev_pm_ops mmc_bus_pm_ops = { | 170 | static const struct dev_pm_ops mmc_bus_pm_ops = { |
169 | .runtime_suspend = mmc_runtime_suspend, | 171 | SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, |
170 | .runtime_resume = mmc_runtime_resume, | 172 | mmc_runtime_idle) |
171 | .runtime_idle = mmc_runtime_idle, | 173 | SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume) |
172 | }; | 174 | }; |
173 | 175 | ||
174 | #define MMC_PM_OPS_PTR (&mmc_bus_pm_ops) | ||
175 | |||
176 | #else /* !CONFIG_PM_RUNTIME */ | ||
177 | |||
178 | #define MMC_PM_OPS_PTR NULL | ||
179 | |||
180 | #endif /* !CONFIG_PM_RUNTIME */ | ||
181 | |||
182 | static struct bus_type mmc_bus_type = { | 176 | static struct bus_type mmc_bus_type = { |
183 | .name = "mmc", | 177 | .name = "mmc", |
184 | .dev_attrs = mmc_dev_attrs, | 178 | .dev_attrs = mmc_dev_attrs, |
@@ -186,9 +180,7 @@ static struct bus_type mmc_bus_type = { | |||
186 | .uevent = mmc_bus_uevent, | 180 | .uevent = mmc_bus_uevent, |
187 | .probe = mmc_bus_probe, | 181 | .probe = mmc_bus_probe, |
188 | .remove = mmc_bus_remove, | 182 | .remove = mmc_bus_remove, |
189 | .suspend = mmc_bus_suspend, | 183 | .pm = &mmc_bus_pm_ops, |
190 | .resume = mmc_bus_resume, | ||
191 | .pm = MMC_PM_OPS_PTR, | ||
192 | }; | 184 | }; |
193 | 185 | ||
194 | int mmc_register_bus(void) | 186 | int mmc_register_bus(void) |
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index 29de31e260dd..2c14be73254c 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/gpio.h> | 12 | #include <linux/gpio.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/jiffies.h> | 14 | #include <linux/jiffies.h> |
15 | #include <linux/mmc/cd-gpio.h> | ||
15 | #include <linux/mmc/host.h> | 16 | #include <linux/mmc/host.h> |
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 7474c47b9c08..ba821fe70bca 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1409,7 +1409,10 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card, | |||
1409 | { | 1409 | { |
1410 | unsigned int erase_timeout; | 1410 | unsigned int erase_timeout; |
1411 | 1411 | ||
1412 | if (card->ext_csd.erase_group_def & 1) { | 1412 | if (arg == MMC_DISCARD_ARG || |
1413 | (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) { | ||
1414 | erase_timeout = card->ext_csd.trim_timeout; | ||
1415 | } else if (card->ext_csd.erase_group_def & 1) { | ||
1413 | /* High Capacity Erase Group Size uses HC timeouts */ | 1416 | /* High Capacity Erase Group Size uses HC timeouts */ |
1414 | if (arg == MMC_TRIM_ARG) | 1417 | if (arg == MMC_TRIM_ARG) |
1415 | erase_timeout = card->ext_csd.trim_timeout; | 1418 | erase_timeout = card->ext_csd.trim_timeout; |
@@ -1681,8 +1684,6 @@ int mmc_can_trim(struct mmc_card *card) | |||
1681 | { | 1684 | { |
1682 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) | 1685 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) |
1683 | return 1; | 1686 | return 1; |
1684 | if (mmc_can_discard(card)) | ||
1685 | return 1; | ||
1686 | return 0; | 1687 | return 0; |
1687 | } | 1688 | } |
1688 | EXPORT_SYMBOL(mmc_can_trim); | 1689 | EXPORT_SYMBOL(mmc_can_trim); |
@@ -1701,6 +1702,8 @@ EXPORT_SYMBOL(mmc_can_discard); | |||
1701 | 1702 | ||
1702 | int mmc_can_sanitize(struct mmc_card *card) | 1703 | int mmc_can_sanitize(struct mmc_card *card) |
1703 | { | 1704 | { |
1705 | if (!mmc_can_trim(card) && !mmc_can_erase(card)) | ||
1706 | return 0; | ||
1704 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) | 1707 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) |
1705 | return 1; | 1708 | return 1; |
1706 | return 0; | 1709 | return 0; |
@@ -2235,6 +2238,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | |||
2235 | mmc_card_is_removable(host)) | 2238 | mmc_card_is_removable(host)) |
2236 | return err; | 2239 | return err; |
2237 | 2240 | ||
2241 | mmc_claim_host(host); | ||
2238 | if (card && mmc_card_mmc(card) && | 2242 | if (card && mmc_card_mmc(card) && |
2239 | (card->ext_csd.cache_size > 0)) { | 2243 | (card->ext_csd.cache_size > 0)) { |
2240 | enable = !!enable; | 2244 | enable = !!enable; |
@@ -2252,6 +2256,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | |||
2252 | card->ext_csd.cache_ctrl = enable; | 2256 | card->ext_csd.cache_ctrl = enable; |
2253 | } | 2257 | } |
2254 | } | 2258 | } |
2259 | mmc_release_host(host); | ||
2255 | 2260 | ||
2256 | return err; | 2261 | return err; |
2257 | } | 2262 | } |
@@ -2269,49 +2274,32 @@ int mmc_suspend_host(struct mmc_host *host) | |||
2269 | 2274 | ||
2270 | cancel_delayed_work(&host->detect); | 2275 | cancel_delayed_work(&host->detect); |
2271 | mmc_flush_scheduled_work(); | 2276 | mmc_flush_scheduled_work(); |
2272 | if (mmc_try_claim_host(host)) { | ||
2273 | err = mmc_cache_ctrl(host, 0); | ||
2274 | mmc_release_host(host); | ||
2275 | } else { | ||
2276 | err = -EBUSY; | ||
2277 | } | ||
2278 | 2277 | ||
2278 | err = mmc_cache_ctrl(host, 0); | ||
2279 | if (err) | 2279 | if (err) |
2280 | goto out; | 2280 | goto out; |
2281 | 2281 | ||
2282 | mmc_bus_get(host); | 2282 | mmc_bus_get(host); |
2283 | if (host->bus_ops && !host->bus_dead) { | 2283 | if (host->bus_ops && !host->bus_dead) { |
2284 | 2284 | ||
2285 | /* | 2285 | if (host->bus_ops->suspend) |
2286 | * A long response time is not acceptable for device drivers | 2286 | err = host->bus_ops->suspend(host); |
2287 | * when doing suspend. Prevent mmc_claim_host in the suspend | ||
2288 | * sequence, to potentially wait "forever" by trying to | ||
2289 | * pre-claim the host. | ||
2290 | */ | ||
2291 | if (mmc_try_claim_host(host)) { | ||
2292 | if (host->bus_ops->suspend) { | ||
2293 | err = host->bus_ops->suspend(host); | ||
2294 | } | ||
2295 | mmc_release_host(host); | ||
2296 | 2287 | ||
2297 | if (err == -ENOSYS || !host->bus_ops->resume) { | 2288 | if (err == -ENOSYS || !host->bus_ops->resume) { |
2298 | /* | 2289 | /* |
2299 | * We simply "remove" the card in this case. | 2290 | * We simply "remove" the card in this case. |
2300 | * It will be redetected on resume. (Calling | 2291 | * It will be redetected on resume. (Calling |
2301 | * bus_ops->remove() with a claimed host can | 2292 | * bus_ops->remove() with a claimed host can |
2302 | * deadlock.) | 2293 | * deadlock.) |
2303 | */ | 2294 | */ |
2304 | if (host->bus_ops->remove) | 2295 | if (host->bus_ops->remove) |
2305 | host->bus_ops->remove(host); | 2296 | host->bus_ops->remove(host); |
2306 | mmc_claim_host(host); | 2297 | mmc_claim_host(host); |
2307 | mmc_detach_bus(host); | 2298 | mmc_detach_bus(host); |
2308 | mmc_power_off(host); | 2299 | mmc_power_off(host); |
2309 | mmc_release_host(host); | 2300 | mmc_release_host(host); |
2310 | host->pm_flags = 0; | 2301 | host->pm_flags = 0; |
2311 | err = 0; | 2302 | err = 0; |
2312 | } | ||
2313 | } else { | ||
2314 | err = -EBUSY; | ||
2315 | } | 2303 | } |
2316 | } | 2304 | } |
2317 | mmc_bus_put(host); | 2305 | mmc_bus_put(host); |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index bf3c9b456aaf..ab3fc4617107 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -526,8 +526,10 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data) | |||
526 | return -ENODEV; | 526 | return -ENODEV; |
527 | 527 | ||
528 | sg_len = dw_mci_pre_dma_transfer(host, data, 0); | 528 | sg_len = dw_mci_pre_dma_transfer(host, data, 0); |
529 | if (sg_len < 0) | 529 | if (sg_len < 0) { |
530 | host->dma_ops->stop(host); | ||
530 | return sg_len; | 531 | return sg_len; |
532 | } | ||
531 | 533 | ||
532 | host->using_dma = 1; | 534 | host->using_dma = 1; |
533 | 535 | ||
@@ -1879,7 +1881,8 @@ static void dw_mci_init_dma(struct dw_mci *host) | |||
1879 | if (!host->dma_ops) | 1881 | if (!host->dma_ops) |
1880 | goto no_dma; | 1882 | goto no_dma; |
1881 | 1883 | ||
1882 | if (host->dma_ops->init) { | 1884 | if (host->dma_ops->init && host->dma_ops->start && |
1885 | host->dma_ops->stop && host->dma_ops->cleanup) { | ||
1883 | if (host->dma_ops->init(host)) { | 1886 | if (host->dma_ops->init(host)) { |
1884 | dev_err(&host->dev, "%s: Unable to initialize " | 1887 | dev_err(&host->dev, "%s: Unable to initialize " |
1885 | "DMA Controller.\n", __func__); | 1888 | "DMA Controller.\n", __func__); |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index b0f2ef988188..e3f5af96ab87 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -363,6 +363,7 @@ static void mxs_mmc_bc(struct mxs_mmc_host *host) | |||
363 | goto out; | 363 | goto out; |
364 | 364 | ||
365 | dmaengine_submit(desc); | 365 | dmaengine_submit(desc); |
366 | dma_async_issue_pending(host->dmach); | ||
366 | return; | 367 | return; |
367 | 368 | ||
368 | out: | 369 | out: |
@@ -403,6 +404,7 @@ static void mxs_mmc_ac(struct mxs_mmc_host *host) | |||
403 | goto out; | 404 | goto out; |
404 | 405 | ||
405 | dmaengine_submit(desc); | 406 | dmaengine_submit(desc); |
407 | dma_async_issue_pending(host->dmach); | ||
406 | return; | 408 | return; |
407 | 409 | ||
408 | out: | 410 | out: |
@@ -531,6 +533,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
531 | goto out; | 533 | goto out; |
532 | 534 | ||
533 | dmaengine_submit(desc); | 535 | dmaengine_submit(desc); |
536 | dma_async_issue_pending(host->dmach); | ||
534 | return; | 537 | return; |
535 | out: | 538 | out: |
536 | dev_warn(mmc_dev(host->mmc), | 539 | dev_warn(mmc_dev(host->mmc), |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 5c2b1c10af9c..56d4499d4388 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -249,7 +249,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, | |||
249 | * the pbias cell programming support is still missing when | 249 | * the pbias cell programming support is still missing when |
250 | * booting with Device tree | 250 | * booting with Device tree |
251 | */ | 251 | */ |
252 | if (of_have_populated_dt() && !vdd) | 252 | if (dev->of_node && !vdd) |
253 | return 0; | 253 | return 0; |
254 | 254 | ||
255 | if (mmc_slot(host).before_set_reg) | 255 | if (mmc_slot(host).before_set_reg) |
@@ -1549,7 +1549,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1549 | * can't be allowed when booting with device | 1549 | * can't be allowed when booting with device |
1550 | * tree. | 1550 | * tree. |
1551 | */ | 1551 | */ |
1552 | (!of_have_populated_dt())) { | 1552 | !host->dev->of_node) { |
1553 | /* | 1553 | /* |
1554 | * The mmc_select_voltage fn of the core does | 1554 | * The mmc_select_voltage fn of the core does |
1555 | * not seem to set the power_mode to | 1555 | * not seem to set the power_mode to |
@@ -1741,7 +1741,7 @@ static const struct of_device_id omap_mmc_of_match[] = { | |||
1741 | .data = &omap4_reg_offset, | 1741 | .data = &omap4_reg_offset, |
1742 | }, | 1742 | }, |
1743 | {}, | 1743 | {}, |
1744 | } | 1744 | }; |
1745 | MODULE_DEVICE_TABLE(of, omap_mmc_of_match); | 1745 | MODULE_DEVICE_TABLE(of, omap_mmc_of_match); |
1746 | 1746 | ||
1747 | static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) | 1747 | static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 6193a0d7bde5..8abdaf6697a8 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -467,8 +467,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
467 | clk_prepare_enable(clk); | 467 | clk_prepare_enable(clk); |
468 | pltfm_host->clk = clk; | 468 | pltfm_host->clk = clk; |
469 | 469 | ||
470 | if (!is_imx25_esdhc(imx_data)) | 470 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
471 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; | ||
472 | 471 | ||
473 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) | 472 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) |
474 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ | 473 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 9aa77f3f04a8..ccefdebeff14 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -147,7 +147,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable) | |||
147 | u32 present, irqs; | 147 | u32 present, irqs; |
148 | 148 | ||
149 | if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || | 149 | if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || |
150 | !mmc_card_is_removable(host->mmc)) | 150 | (host->mmc->caps & MMC_CAP_NONREMOVABLE)) |
151 | return; | 151 | return; |
152 | 152 | ||
153 | present = sdhci_readl(host, SDHCI_PRESENT_STATE) & | 153 | present = sdhci_readl(host, SDHCI_PRESENT_STATE) & |
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 75b1dde16358..9ec51cec2e14 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c | |||
@@ -266,6 +266,7 @@ int start_dma_without_bch_irq(struct gpmi_nand_data *this, | |||
266 | desc->callback = dma_irq_callback; | 266 | desc->callback = dma_irq_callback; |
267 | desc->callback_param = this; | 267 | desc->callback_param = this; |
268 | dmaengine_submit(desc); | 268 | dmaengine_submit(desc); |
269 | dma_async_issue_pending(get_dma_chan(this)); | ||
269 | 270 | ||
270 | /* Wait for the interrupt from the DMA block. */ | 271 | /* Wait for the interrupt from the DMA block. */ |
271 | err = wait_for_completion_timeout(dma_c, msecs_to_jiffies(1000)); | 272 | err = wait_for_completion_timeout(dma_c, msecs_to_jiffies(1000)); |
diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c index 25197b698dd6..b8b4c7ba884f 100644 --- a/drivers/net/arcnet/arc-rimi.c +++ b/drivers/net/arcnet/arc-rimi.c | |||
@@ -89,16 +89,16 @@ static int __init arcrimi_probe(struct net_device *dev) | |||
89 | BUGLVL(D_NORMAL) printk(VERSION); | 89 | BUGLVL(D_NORMAL) printk(VERSION); |
90 | BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); | 90 | BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); |
91 | 91 | ||
92 | BUGMSG(D_NORMAL, "Given: node %02Xh, shmem %lXh, irq %d\n", | 92 | BUGLVL(D_NORMAL) printk("Given: node %02Xh, shmem %lXh, irq %d\n", |
93 | dev->dev_addr[0], dev->mem_start, dev->irq); | 93 | dev->dev_addr[0], dev->mem_start, dev->irq); |
94 | 94 | ||
95 | if (dev->mem_start <= 0 || dev->irq <= 0) { | 95 | if (dev->mem_start <= 0 || dev->irq <= 0) { |
96 | BUGMSG(D_NORMAL, "No autoprobe for RIM I; you " | 96 | BUGLVL(D_NORMAL) printk("No autoprobe for RIM I; you " |
97 | "must specify the shmem and irq!\n"); | 97 | "must specify the shmem and irq!\n"); |
98 | return -ENODEV; | 98 | return -ENODEV; |
99 | } | 99 | } |
100 | if (dev->dev_addr[0] == 0) { | 100 | if (dev->dev_addr[0] == 0) { |
101 | BUGMSG(D_NORMAL, "You need to specify your card's station " | 101 | BUGLVL(D_NORMAL) printk("You need to specify your card's station " |
102 | "ID!\n"); | 102 | "ID!\n"); |
103 | return -ENODEV; | 103 | return -ENODEV; |
104 | } | 104 | } |
@@ -109,7 +109,7 @@ static int __init arcrimi_probe(struct net_device *dev) | |||
109 | * will be taken. | 109 | * will be taken. |
110 | */ | 110 | */ |
111 | if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { | 111 | if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { |
112 | BUGMSG(D_NORMAL, "Card memory already allocated\n"); | 112 | BUGLVL(D_NORMAL) printk("Card memory already allocated\n"); |
113 | return -ENODEV; | 113 | return -ENODEV; |
114 | } | 114 | } |
115 | return arcrimi_found(dev); | 115 | return arcrimi_found(dev); |
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c index 9a66e2a910ae..9c1c8cd5223f 100644 --- a/drivers/net/caif/caif_hsi.c +++ b/drivers/net/caif/caif_hsi.c | |||
@@ -744,14 +744,14 @@ static void cfhsi_wake_up(struct work_struct *work) | |||
744 | size_t fifo_occupancy = 0; | 744 | size_t fifo_occupancy = 0; |
745 | 745 | ||
746 | /* Wakeup timeout */ | 746 | /* Wakeup timeout */ |
747 | dev_err(&cfhsi->ndev->dev, "%s: Timeout.\n", | 747 | dev_dbg(&cfhsi->ndev->dev, "%s: Timeout.\n", |
748 | __func__); | 748 | __func__); |
749 | 749 | ||
750 | /* Check FIFO to check if modem has sent something. */ | 750 | /* Check FIFO to check if modem has sent something. */ |
751 | WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, | 751 | WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, |
752 | &fifo_occupancy)); | 752 | &fifo_occupancy)); |
753 | 753 | ||
754 | dev_err(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n", | 754 | dev_dbg(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n", |
755 | __func__, (unsigned) fifo_occupancy); | 755 | __func__, (unsigned) fifo_occupancy); |
756 | 756 | ||
757 | /* Check if we misssed the interrupt. */ | 757 | /* Check if we misssed the interrupt. */ |
@@ -1210,7 +1210,7 @@ int cfhsi_probe(struct platform_device *pdev) | |||
1210 | 1210 | ||
1211 | static void cfhsi_shutdown(struct cfhsi *cfhsi) | 1211 | static void cfhsi_shutdown(struct cfhsi *cfhsi) |
1212 | { | 1212 | { |
1213 | u8 *tx_buf, *rx_buf; | 1213 | u8 *tx_buf, *rx_buf, *flip_buf; |
1214 | 1214 | ||
1215 | /* Stop TXing */ | 1215 | /* Stop TXing */ |
1216 | netif_tx_stop_all_queues(cfhsi->ndev); | 1216 | netif_tx_stop_all_queues(cfhsi->ndev); |
@@ -1234,7 +1234,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi) | |||
1234 | /* Store bufferes: will be freed later. */ | 1234 | /* Store bufferes: will be freed later. */ |
1235 | tx_buf = cfhsi->tx_buf; | 1235 | tx_buf = cfhsi->tx_buf; |
1236 | rx_buf = cfhsi->rx_buf; | 1236 | rx_buf = cfhsi->rx_buf; |
1237 | 1237 | flip_buf = cfhsi->rx_flip_buf; | |
1238 | /* Flush transmit queues. */ | 1238 | /* Flush transmit queues. */ |
1239 | cfhsi_abort_tx(cfhsi); | 1239 | cfhsi_abort_tx(cfhsi); |
1240 | 1240 | ||
@@ -1247,6 +1247,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi) | |||
1247 | /* Free buffers. */ | 1247 | /* Free buffers. */ |
1248 | kfree(tx_buf); | 1248 | kfree(tx_buf); |
1249 | kfree(rx_buf); | 1249 | kfree(rx_buf); |
1250 | kfree(flip_buf); | ||
1250 | } | 1251 | } |
1251 | 1252 | ||
1252 | int cfhsi_remove(struct platform_device *pdev) | 1253 | int cfhsi_remove(struct platform_device *pdev) |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 5234586dff15..629c4ba5d49d 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
@@ -875,6 +875,7 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
875 | PCAN_USBPRO_INFO_FW, | 875 | PCAN_USBPRO_INFO_FW, |
876 | &fi, sizeof(fi)); | 876 | &fi, sizeof(fi)); |
877 | if (err) { | 877 | if (err) { |
878 | kfree(usb_if); | ||
878 | dev_err(dev->netdev->dev.parent, | 879 | dev_err(dev->netdev->dev.parent, |
879 | "unable to read %s firmware info (err %d)\n", | 880 | "unable to read %s firmware info (err %d)\n", |
880 | pcan_usb_pro.name, err); | 881 | pcan_usb_pro.name, err); |
@@ -885,6 +886,7 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
885 | PCAN_USBPRO_INFO_BL, | 886 | PCAN_USBPRO_INFO_BL, |
886 | &bi, sizeof(bi)); | 887 | &bi, sizeof(bi)); |
887 | if (err) { | 888 | if (err) { |
889 | kfree(usb_if); | ||
888 | dev_err(dev->netdev->dev.parent, | 890 | dev_err(dev->netdev->dev.parent, |
889 | "unable to read %s bootloader info (err %d)\n", | 891 | "unable to read %s bootloader info (err %d)\n", |
890 | pcan_usb_pro.name, err); | 892 | pcan_usb_pro.name, err); |
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index d5c6d92f1ee7..442d91a2747b 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c | |||
@@ -107,14 +107,14 @@ static int dummy_dev_init(struct net_device *dev) | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | static void dummy_dev_free(struct net_device *dev) | 110 | static void dummy_dev_uninit(struct net_device *dev) |
111 | { | 111 | { |
112 | free_percpu(dev->dstats); | 112 | free_percpu(dev->dstats); |
113 | free_netdev(dev); | ||
114 | } | 113 | } |
115 | 114 | ||
116 | static const struct net_device_ops dummy_netdev_ops = { | 115 | static const struct net_device_ops dummy_netdev_ops = { |
117 | .ndo_init = dummy_dev_init, | 116 | .ndo_init = dummy_dev_init, |
117 | .ndo_uninit = dummy_dev_uninit, | ||
118 | .ndo_start_xmit = dummy_xmit, | 118 | .ndo_start_xmit = dummy_xmit, |
119 | .ndo_validate_addr = eth_validate_addr, | 119 | .ndo_validate_addr = eth_validate_addr, |
120 | .ndo_set_rx_mode = set_multicast_list, | 120 | .ndo_set_rx_mode = set_multicast_list, |
@@ -128,7 +128,7 @@ static void dummy_setup(struct net_device *dev) | |||
128 | 128 | ||
129 | /* Initialize the device structure. */ | 129 | /* Initialize the device structure. */ |
130 | dev->netdev_ops = &dummy_netdev_ops; | 130 | dev->netdev_ops = &dummy_netdev_ops; |
131 | dev->destructor = dummy_dev_free; | 131 | dev->destructor = free_netdev; |
132 | 132 | ||
133 | /* Fill in device structure with ethernet-generic values. */ | 133 | /* Fill in device structure with ethernet-generic values. */ |
134 | dev->tx_queue_len = 0; | 134 | dev->tx_queue_len = 0; |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index 40ac41436549..c926857e8205 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | |||
@@ -2476,7 +2476,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
2476 | "pcie phy link down %x\n", status); | 2476 | "pcie phy link down %x\n", status); |
2477 | if (netif_running(adapter->netdev)) { /* reset MAC */ | 2477 | if (netif_running(adapter->netdev)) { /* reset MAC */ |
2478 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | 2478 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); |
2479 | schedule_work(&adapter->pcie_dma_to_rst_task); | 2479 | schedule_work(&adapter->reset_dev_task); |
2480 | return IRQ_HANDLED; | 2480 | return IRQ_HANDLED; |
2481 | } | 2481 | } |
2482 | } | 2482 | } |
@@ -2488,7 +2488,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
2488 | "pcie DMA r/w error (status = 0x%x)\n", | 2488 | "pcie DMA r/w error (status = 0x%x)\n", |
2489 | status); | 2489 | status); |
2490 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | 2490 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); |
2491 | schedule_work(&adapter->pcie_dma_to_rst_task); | 2491 | schedule_work(&adapter->reset_dev_task); |
2492 | return IRQ_HANDLED; | 2492 | return IRQ_HANDLED; |
2493 | } | 2493 | } |
2494 | 2494 | ||
@@ -2633,10 +2633,10 @@ static void atl1_down(struct atl1_adapter *adapter) | |||
2633 | atl1_clean_rx_ring(adapter); | 2633 | atl1_clean_rx_ring(adapter); |
2634 | } | 2634 | } |
2635 | 2635 | ||
2636 | static void atl1_tx_timeout_task(struct work_struct *work) | 2636 | static void atl1_reset_dev_task(struct work_struct *work) |
2637 | { | 2637 | { |
2638 | struct atl1_adapter *adapter = | 2638 | struct atl1_adapter *adapter = |
2639 | container_of(work, struct atl1_adapter, tx_timeout_task); | 2639 | container_of(work, struct atl1_adapter, reset_dev_task); |
2640 | struct net_device *netdev = adapter->netdev; | 2640 | struct net_device *netdev = adapter->netdev; |
2641 | 2641 | ||
2642 | netif_device_detach(netdev); | 2642 | netif_device_detach(netdev); |
@@ -3038,12 +3038,10 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
3038 | (unsigned long)adapter); | 3038 | (unsigned long)adapter); |
3039 | adapter->phy_timer_pending = false; | 3039 | adapter->phy_timer_pending = false; |
3040 | 3040 | ||
3041 | INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); | 3041 | INIT_WORK(&adapter->reset_dev_task, atl1_reset_dev_task); |
3042 | 3042 | ||
3043 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); | 3043 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); |
3044 | 3044 | ||
3045 | INIT_WORK(&adapter->pcie_dma_to_rst_task, atl1_tx_timeout_task); | ||
3046 | |||
3047 | err = register_netdev(netdev); | 3045 | err = register_netdev(netdev); |
3048 | if (err) | 3046 | if (err) |
3049 | goto err_common; | 3047 | goto err_common; |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h index 109d6da8be97..e04bf4d71e46 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.h +++ b/drivers/net/ethernet/atheros/atlx/atl1.h | |||
@@ -758,9 +758,8 @@ struct atl1_adapter { | |||
758 | u16 link_speed; | 758 | u16 link_speed; |
759 | u16 link_duplex; | 759 | u16 link_duplex; |
760 | spinlock_t lock; | 760 | spinlock_t lock; |
761 | struct work_struct tx_timeout_task; | 761 | struct work_struct reset_dev_task; |
762 | struct work_struct link_chg_task; | 762 | struct work_struct link_chg_task; |
763 | struct work_struct pcie_dma_to_rst_task; | ||
764 | 763 | ||
765 | struct timer_list phy_config_timer; | 764 | struct timer_list phy_config_timer; |
766 | bool phy_timer_pending; | 765 | bool phy_timer_pending; |
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index 3cd8837236dc..c9e9dc57986c 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c | |||
@@ -194,7 +194,7 @@ static void atlx_tx_timeout(struct net_device *netdev) | |||
194 | { | 194 | { |
195 | struct atlx_adapter *adapter = netdev_priv(netdev); | 195 | struct atlx_adapter *adapter = netdev_priv(netdev); |
196 | /* Do the reset outside of interrupt context */ | 196 | /* Do the reset outside of interrupt context */ |
197 | schedule_work(&adapter->tx_timeout_task); | 197 | schedule_work(&adapter->reset_dev_task); |
198 | } | 198 | } |
199 | 199 | ||
200 | /* | 200 | /* |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index ad95324dc042..64392ec410a3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -942,6 +942,12 @@ static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params, | |||
942 | const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 : | 942 | const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 : |
943 | DCBX_E3B0_MAX_NUM_COS_PORT0; | 943 | DCBX_E3B0_MAX_NUM_COS_PORT0; |
944 | 944 | ||
945 | if (pri >= max_num_of_cos) { | ||
946 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | ||
947 | "parameter Illegal strict priority\n"); | ||
948 | return -EINVAL; | ||
949 | } | ||
950 | |||
945 | if (sp_pri_to_cos[pri] != DCBX_INVALID_COS) { | 951 | if (sp_pri_to_cos[pri] != DCBX_INVALID_COS) { |
946 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | 952 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " |
947 | "parameter There can't be two COS's with " | 953 | "parameter There can't be two COS's with " |
@@ -949,12 +955,6 @@ static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params, | |||
949 | return -EINVAL; | 955 | return -EINVAL; |
950 | } | 956 | } |
951 | 957 | ||
952 | if (pri > max_num_of_cos) { | ||
953 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | ||
954 | "parameter Illegal strict priority\n"); | ||
955 | return -EINVAL; | ||
956 | } | ||
957 | |||
958 | sp_pri_to_cos[pri] = cos_entry; | 958 | sp_pri_to_cos[pri] = cos_entry; |
959 | return 0; | 959 | return 0; |
960 | 960 | ||
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 062ac333fde6..ceeab8e852ef 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -879,8 +879,13 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi) | |||
879 | if (sblk->status & SD_STATUS_LINK_CHG) | 879 | if (sblk->status & SD_STATUS_LINK_CHG) |
880 | work_exists = 1; | 880 | work_exists = 1; |
881 | } | 881 | } |
882 | /* check for RX/TX work to do */ | 882 | |
883 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons || | 883 | /* check for TX work to do */ |
884 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons) | ||
885 | work_exists = 1; | ||
886 | |||
887 | /* check for RX work to do */ | ||
888 | if (tnapi->rx_rcb_prod_idx && | ||
884 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) | 889 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) |
885 | work_exists = 1; | 890 | work_exists = 1; |
886 | 891 | ||
@@ -6124,6 +6129,9 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) | |||
6124 | return work_done; | 6129 | return work_done; |
6125 | } | 6130 | } |
6126 | 6131 | ||
6132 | if (!tnapi->rx_rcb_prod_idx) | ||
6133 | return work_done; | ||
6134 | |||
6127 | /* run RX thread, within the bounds set by NAPI. | 6135 | /* run RX thread, within the bounds set by NAPI. |
6128 | * All RX "locking" is done by ensuring outside | 6136 | * All RX "locking" is done by ensuring outside |
6129 | * code synchronizes with tg3->napi.poll() | 6137 | * code synchronizes with tg3->napi.poll() |
@@ -7567,6 +7575,12 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
7567 | */ | 7575 | */ |
7568 | switch (i) { | 7576 | switch (i) { |
7569 | default: | 7577 | default: |
7578 | if (tg3_flag(tp, ENABLE_RSS)) { | ||
7579 | tnapi->rx_rcb_prod_idx = NULL; | ||
7580 | break; | ||
7581 | } | ||
7582 | /* Fall through */ | ||
7583 | case 1: | ||
7570 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; | 7584 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; |
7571 | break; | 7585 | break; |
7572 | case 2: | 7586 | case 2: |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 63bfdd10bd6d..abb6ce7c1b7e 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | |||
@@ -1150,6 +1150,48 @@ release_tpsram: | |||
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | /** | 1152 | /** |
1153 | * t3_synchronize_rx - wait for current Rx processing on a port to complete | ||
1154 | * @adap: the adapter | ||
1155 | * @p: the port | ||
1156 | * | ||
1157 | * Ensures that current Rx processing on any of the queues associated with | ||
1158 | * the given port completes before returning. We do this by acquiring and | ||
1159 | * releasing the locks of the response queues associated with the port. | ||
1160 | */ | ||
1161 | static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | ||
1162 | { | ||
1163 | int i; | ||
1164 | |||
1165 | for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | ||
1166 | struct sge_rspq *q = &adap->sge.qs[i].rspq; | ||
1167 | |||
1168 | spin_lock_irq(&q->lock); | ||
1169 | spin_unlock_irq(&q->lock); | ||
1170 | } | ||
1171 | } | ||
1172 | |||
1173 | static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | ||
1174 | { | ||
1175 | struct port_info *pi = netdev_priv(dev); | ||
1176 | struct adapter *adapter = pi->adapter; | ||
1177 | |||
1178 | if (adapter->params.rev > 0) { | ||
1179 | t3_set_vlan_accel(adapter, 1 << pi->port_id, | ||
1180 | features & NETIF_F_HW_VLAN_RX); | ||
1181 | } else { | ||
1182 | /* single control for all ports */ | ||
1183 | unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | ||
1184 | |||
1185 | for_each_port(adapter, i) | ||
1186 | have_vlans |= | ||
1187 | adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | ||
1188 | |||
1189 | t3_set_vlan_accel(adapter, 1, have_vlans); | ||
1190 | } | ||
1191 | t3_synchronize_rx(adapter, pi); | ||
1192 | } | ||
1193 | |||
1194 | /** | ||
1153 | * cxgb_up - enable the adapter | 1195 | * cxgb_up - enable the adapter |
1154 | * @adapter: adapter being enabled | 1196 | * @adapter: adapter being enabled |
1155 | * | 1197 | * |
@@ -1161,7 +1203,7 @@ release_tpsram: | |||
1161 | */ | 1203 | */ |
1162 | static int cxgb_up(struct adapter *adap) | 1204 | static int cxgb_up(struct adapter *adap) |
1163 | { | 1205 | { |
1164 | int err; | 1206 | int i, err; |
1165 | 1207 | ||
1166 | if (!(adap->flags & FULL_INIT_DONE)) { | 1208 | if (!(adap->flags & FULL_INIT_DONE)) { |
1167 | err = t3_check_fw_version(adap); | 1209 | err = t3_check_fw_version(adap); |
@@ -1198,6 +1240,9 @@ static int cxgb_up(struct adapter *adap) | |||
1198 | if (err) | 1240 | if (err) |
1199 | goto out; | 1241 | goto out; |
1200 | 1242 | ||
1243 | for_each_port(adap, i) | ||
1244 | cxgb_vlan_mode(adap->port[i], adap->port[i]->features); | ||
1245 | |||
1201 | setup_rss(adap); | 1246 | setup_rss(adap); |
1202 | if (!(adap->flags & NAPI_INIT)) | 1247 | if (!(adap->flags & NAPI_INIT)) |
1203 | init_napi(adap); | 1248 | init_napi(adap); |
@@ -2508,48 +2553,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) | |||
2508 | return 0; | 2553 | return 0; |
2509 | } | 2554 | } |
2510 | 2555 | ||
2511 | /** | ||
2512 | * t3_synchronize_rx - wait for current Rx processing on a port to complete | ||
2513 | * @adap: the adapter | ||
2514 | * @p: the port | ||
2515 | * | ||
2516 | * Ensures that current Rx processing on any of the queues associated with | ||
2517 | * the given port completes before returning. We do this by acquiring and | ||
2518 | * releasing the locks of the response queues associated with the port. | ||
2519 | */ | ||
2520 | static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | ||
2521 | { | ||
2522 | int i; | ||
2523 | |||
2524 | for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | ||
2525 | struct sge_rspq *q = &adap->sge.qs[i].rspq; | ||
2526 | |||
2527 | spin_lock_irq(&q->lock); | ||
2528 | spin_unlock_irq(&q->lock); | ||
2529 | } | ||
2530 | } | ||
2531 | |||
2532 | static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | ||
2533 | { | ||
2534 | struct port_info *pi = netdev_priv(dev); | ||
2535 | struct adapter *adapter = pi->adapter; | ||
2536 | |||
2537 | if (adapter->params.rev > 0) { | ||
2538 | t3_set_vlan_accel(adapter, 1 << pi->port_id, | ||
2539 | features & NETIF_F_HW_VLAN_RX); | ||
2540 | } else { | ||
2541 | /* single control for all ports */ | ||
2542 | unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | ||
2543 | |||
2544 | for_each_port(adapter, i) | ||
2545 | have_vlans |= | ||
2546 | adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | ||
2547 | |||
2548 | t3_set_vlan_accel(adapter, 1, have_vlans); | ||
2549 | } | ||
2550 | t3_synchronize_rx(adapter, pi); | ||
2551 | } | ||
2552 | |||
2553 | static netdev_features_t cxgb_fix_features(struct net_device *dev, | 2556 | static netdev_features_t cxgb_fix_features(struct net_device *dev, |
2554 | netdev_features_t features) | 2557 | netdev_features_t features) |
2555 | { | 2558 | { |
@@ -3353,9 +3356,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3353 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, | 3356 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, |
3354 | &cxgb3_attr_group); | 3357 | &cxgb3_attr_group); |
3355 | 3358 | ||
3356 | for_each_port(adapter, i) | ||
3357 | cxgb_vlan_mode(adapter->port[i], adapter->port[i]->features); | ||
3358 | |||
3359 | print_port_info(adapter, ai); | 3359 | print_port_info(adapter, ai); |
3360 | return 0; | 3360 | return 0; |
3361 | 3361 | ||
diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c index b2dc2c81a147..2e09edb9cdf8 100644 --- a/drivers/net/ethernet/dlink/dl2k.c +++ b/drivers/net/ethernet/dlink/dl2k.c | |||
@@ -1259,55 +1259,21 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1259 | { | 1259 | { |
1260 | int phy_addr; | 1260 | int phy_addr; |
1261 | struct netdev_private *np = netdev_priv(dev); | 1261 | struct netdev_private *np = netdev_priv(dev); |
1262 | struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; | 1262 | struct mii_ioctl_data *miidata = if_mii(rq); |
1263 | |||
1264 | struct netdev_desc *desc; | ||
1265 | int i; | ||
1266 | 1263 | ||
1267 | phy_addr = np->phy_addr; | 1264 | phy_addr = np->phy_addr; |
1268 | switch (cmd) { | 1265 | switch (cmd) { |
1269 | case SIOCDEVPRIVATE: | 1266 | case SIOCGMIIPHY: |
1270 | break; | 1267 | miidata->phy_id = phy_addr; |
1271 | |||
1272 | case SIOCDEVPRIVATE + 1: | ||
1273 | miidata->out_value = mii_read (dev, phy_addr, miidata->reg_num); | ||
1274 | break; | 1268 | break; |
1275 | case SIOCDEVPRIVATE + 2: | 1269 | case SIOCGMIIREG: |
1276 | mii_write (dev, phy_addr, miidata->reg_num, miidata->in_value); | 1270 | miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num); |
1277 | break; | 1271 | break; |
1278 | case SIOCDEVPRIVATE + 3: | 1272 | case SIOCSMIIREG: |
1279 | break; | 1273 | if (!capable(CAP_NET_ADMIN)) |
1280 | case SIOCDEVPRIVATE + 4: | 1274 | return -EPERM; |
1281 | break; | 1275 | mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in); |
1282 | case SIOCDEVPRIVATE + 5: | ||
1283 | netif_stop_queue (dev); | ||
1284 | break; | 1276 | break; |
1285 | case SIOCDEVPRIVATE + 6: | ||
1286 | netif_wake_queue (dev); | ||
1287 | break; | ||
1288 | case SIOCDEVPRIVATE + 7: | ||
1289 | printk | ||
1290 | ("tx_full=%x cur_tx=%lx old_tx=%lx cur_rx=%lx old_rx=%lx\n", | ||
1291 | netif_queue_stopped(dev), np->cur_tx, np->old_tx, np->cur_rx, | ||
1292 | np->old_rx); | ||
1293 | break; | ||
1294 | case SIOCDEVPRIVATE + 8: | ||
1295 | printk("TX ring:\n"); | ||
1296 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
1297 | desc = &np->tx_ring[i]; | ||
1298 | printk | ||
1299 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", | ||
1300 | i, | ||
1301 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), | ||
1302 | (u32)le64_to_cpu(desc->next_desc), | ||
1303 | (u32)le64_to_cpu(desc->status), | ||
1304 | (u32)(le64_to_cpu(desc->fraginfo) >> 32), | ||
1305 | (u32)le64_to_cpu(desc->fraginfo)); | ||
1306 | printk ("\n"); | ||
1307 | } | ||
1308 | printk ("\n"); | ||
1309 | break; | ||
1310 | |||
1311 | default: | 1277 | default: |
1312 | return -EOPNOTSUPP; | 1278 | return -EOPNOTSUPP; |
1313 | } | 1279 | } |
diff --git a/drivers/net/ethernet/dlink/dl2k.h b/drivers/net/ethernet/dlink/dl2k.h index ba0adcafa55a..30c2da3de548 100644 --- a/drivers/net/ethernet/dlink/dl2k.h +++ b/drivers/net/ethernet/dlink/dl2k.h | |||
@@ -365,13 +365,6 @@ struct ioctl_data { | |||
365 | char *data; | 365 | char *data; |
366 | }; | 366 | }; |
367 | 367 | ||
368 | struct mii_data { | ||
369 | __u16 reserved; | ||
370 | __u16 reg_num; | ||
371 | __u16 in_value; | ||
372 | __u16 out_value; | ||
373 | }; | ||
374 | |||
375 | /* The Rx and Tx buffer descriptors. */ | 368 | /* The Rx and Tx buffer descriptors. */ |
376 | struct netdev_desc { | 369 | struct netdev_desc { |
377 | __le64 next_desc; | 370 | __le64 next_desc; |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 17a46e76123f..9ac14f804851 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
@@ -116,10 +116,10 @@ static struct ucc_geth_info ugeth_primary_info = { | |||
116 | .maxGroupAddrInHash = 4, | 116 | .maxGroupAddrInHash = 4, |
117 | .maxIndAddrInHash = 4, | 117 | .maxIndAddrInHash = 4, |
118 | .prel = 7, | 118 | .prel = 7, |
119 | .maxFrameLength = 1518, | 119 | .maxFrameLength = 1518+16, /* Add extra bytes for VLANs etc. */ |
120 | .minFrameLength = 64, | 120 | .minFrameLength = 64, |
121 | .maxD1Length = 1520, | 121 | .maxD1Length = 1520+16, /* Add extra bytes for VLANs etc. */ |
122 | .maxD2Length = 1520, | 122 | .maxD2Length = 1520+16, /* Add extra bytes for VLANs etc. */ |
123 | .vlantype = 0x8100, | 123 | .vlantype = 0x8100, |
124 | .ecamptr = ((uint32_t) NULL), | 124 | .ecamptr = ((uint32_t) NULL), |
125 | .eventRegMask = UCCE_OTHER, | 125 | .eventRegMask = UCCE_OTHER, |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.h b/drivers/net/ethernet/freescale/ucc_geth.h index 2e395a2566b8..f71b3e7b12de 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.h +++ b/drivers/net/ethernet/freescale/ucc_geth.h | |||
@@ -877,7 +877,7 @@ struct ucc_geth_hardware_statistics { | |||
877 | 877 | ||
878 | /* Driver definitions */ | 878 | /* Driver definitions */ |
879 | #define TX_BD_RING_LEN 0x10 | 879 | #define TX_BD_RING_LEN 0x10 |
880 | #define RX_BD_RING_LEN 0x10 | 880 | #define RX_BD_RING_LEN 0x20 |
881 | 881 | ||
882 | #define TX_RING_MOD_MASK(size) (size-1) | 882 | #define TX_RING_MOD_MASK(size) (size-1) |
883 | #define RX_RING_MOD_MASK(size) (size-1) | 883 | #define RX_RING_MOD_MASK(size) (size-1) |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 3516e17a399d..c9069a28832b 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
@@ -290,16 +290,18 @@ static void ehea_update_bcmc_registrations(void) | |||
290 | 290 | ||
291 | arr[i].adh = adapter->handle; | 291 | arr[i].adh = adapter->handle; |
292 | arr[i].port_id = port->logical_port_id; | 292 | arr[i].port_id = port->logical_port_id; |
293 | arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | | 293 | arr[i].reg_type = EHEA_BCMC_MULTICAST | |
294 | EHEA_BCMC_MULTICAST | | ||
295 | EHEA_BCMC_UNTAGGED; | 294 | EHEA_BCMC_UNTAGGED; |
295 | if (mc_entry->macaddr == 0) | ||
296 | arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
296 | arr[i++].macaddr = mc_entry->macaddr; | 297 | arr[i++].macaddr = mc_entry->macaddr; |
297 | 298 | ||
298 | arr[i].adh = adapter->handle; | 299 | arr[i].adh = adapter->handle; |
299 | arr[i].port_id = port->logical_port_id; | 300 | arr[i].port_id = port->logical_port_id; |
300 | arr[i].reg_type = EHEA_BCMC_SCOPE_ALL | | 301 | arr[i].reg_type = EHEA_BCMC_MULTICAST | |
301 | EHEA_BCMC_MULTICAST | | ||
302 | EHEA_BCMC_VLANID_ALL; | 302 | EHEA_BCMC_VLANID_ALL; |
303 | if (mc_entry->macaddr == 0) | ||
304 | arr[i].reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
303 | arr[i++].macaddr = mc_entry->macaddr; | 305 | arr[i++].macaddr = mc_entry->macaddr; |
304 | num_registrations -= 2; | 306 | num_registrations -= 2; |
305 | } | 307 | } |
@@ -1838,8 +1840,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, | |||
1838 | u64 hret; | 1840 | u64 hret; |
1839 | u8 reg_type; | 1841 | u8 reg_type; |
1840 | 1842 | ||
1841 | reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST | 1843 | reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_UNTAGGED; |
1842 | | EHEA_BCMC_UNTAGGED; | 1844 | if (mc_mac_addr == 0) |
1845 | reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
1843 | 1846 | ||
1844 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, | 1847 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, |
1845 | port->logical_port_id, | 1848 | port->logical_port_id, |
@@ -1847,8 +1850,9 @@ static u64 ehea_multicast_reg_helper(struct ehea_port *port, u64 mc_mac_addr, | |||
1847 | if (hret) | 1850 | if (hret) |
1848 | goto out; | 1851 | goto out; |
1849 | 1852 | ||
1850 | reg_type = EHEA_BCMC_SCOPE_ALL | EHEA_BCMC_MULTICAST | 1853 | reg_type = EHEA_BCMC_MULTICAST | EHEA_BCMC_VLANID_ALL; |
1851 | | EHEA_BCMC_VLANID_ALL; | 1854 | if (mc_mac_addr == 0) |
1855 | reg_type |= EHEA_BCMC_SCOPE_ALL; | ||
1852 | 1856 | ||
1853 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, | 1857 | hret = ehea_h_reg_dereg_bcmc(port->adapter->handle, |
1854 | port->logical_port_id, | 1858 | port->logical_port_id, |
@@ -1898,7 +1902,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) | |||
1898 | netdev_err(dev, | 1902 | netdev_err(dev, |
1899 | "failed enabling IFF_ALLMULTI\n"); | 1903 | "failed enabling IFF_ALLMULTI\n"); |
1900 | } | 1904 | } |
1901 | } else | 1905 | } else { |
1902 | if (!enable) { | 1906 | if (!enable) { |
1903 | /* Disable ALLMULTI */ | 1907 | /* Disable ALLMULTI */ |
1904 | hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC); | 1908 | hret = ehea_multicast_reg_helper(port, 0, H_DEREG_BCMC); |
@@ -1908,6 +1912,7 @@ static void ehea_allmulti(struct net_device *dev, int enable) | |||
1908 | netdev_err(dev, | 1912 | netdev_err(dev, |
1909 | "failed disabling IFF_ALLMULTI\n"); | 1913 | "failed disabling IFF_ALLMULTI\n"); |
1910 | } | 1914 | } |
1915 | } | ||
1911 | } | 1916 | } |
1912 | 1917 | ||
1913 | static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) | 1918 | static void ehea_add_multicast_entry(struct ehea_port *port, u8 *mc_mac_addr) |
@@ -1941,11 +1946,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1941 | struct netdev_hw_addr *ha; | 1946 | struct netdev_hw_addr *ha; |
1942 | int ret; | 1947 | int ret; |
1943 | 1948 | ||
1944 | if (port->promisc) { | 1949 | ehea_promiscuous(dev, !!(dev->flags & IFF_PROMISC)); |
1945 | ehea_promiscuous(dev, 1); | ||
1946 | return; | ||
1947 | } | ||
1948 | ehea_promiscuous(dev, 0); | ||
1949 | 1950 | ||
1950 | if (dev->flags & IFF_ALLMULTI) { | 1951 | if (dev->flags & IFF_ALLMULTI) { |
1951 | ehea_allmulti(dev, 1); | 1952 | ehea_allmulti(dev, 1); |
@@ -2463,6 +2464,7 @@ static int ehea_down(struct net_device *dev) | |||
2463 | return 0; | 2464 | return 0; |
2464 | 2465 | ||
2465 | ehea_drop_multicast_list(dev); | 2466 | ehea_drop_multicast_list(dev); |
2467 | ehea_allmulti(dev, 0); | ||
2466 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | 2468 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
2467 | 2469 | ||
2468 | ehea_free_interrupts(dev); | 2470 | ehea_free_interrupts(dev); |
@@ -3261,6 +3263,7 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
3261 | struct ehea_adapter *adapter; | 3263 | struct ehea_adapter *adapter; |
3262 | const u64 *adapter_handle; | 3264 | const u64 *adapter_handle; |
3263 | int ret; | 3265 | int ret; |
3266 | int i; | ||
3264 | 3267 | ||
3265 | if (!dev || !dev->dev.of_node) { | 3268 | if (!dev || !dev->dev.of_node) { |
3266 | pr_err("Invalid ibmebus device probed\n"); | 3269 | pr_err("Invalid ibmebus device probed\n"); |
@@ -3314,17 +3317,9 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
3314 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, | 3317 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, |
3315 | (unsigned long)adapter); | 3318 | (unsigned long)adapter); |
3316 | 3319 | ||
3317 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, | ||
3318 | ehea_interrupt_neq, IRQF_DISABLED, | ||
3319 | "ehea_neq", adapter); | ||
3320 | if (ret) { | ||
3321 | dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | ||
3322 | goto out_kill_eq; | ||
3323 | } | ||
3324 | |||
3325 | ret = ehea_create_device_sysfs(dev); | 3320 | ret = ehea_create_device_sysfs(dev); |
3326 | if (ret) | 3321 | if (ret) |
3327 | goto out_free_irq; | 3322 | goto out_kill_eq; |
3328 | 3323 | ||
3329 | ret = ehea_setup_ports(adapter); | 3324 | ret = ehea_setup_ports(adapter); |
3330 | if (ret) { | 3325 | if (ret) { |
@@ -3332,15 +3327,28 @@ static int __devinit ehea_probe_adapter(struct platform_device *dev, | |||
3332 | goto out_rem_dev_sysfs; | 3327 | goto out_rem_dev_sysfs; |
3333 | } | 3328 | } |
3334 | 3329 | ||
3330 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, | ||
3331 | ehea_interrupt_neq, IRQF_DISABLED, | ||
3332 | "ehea_neq", adapter); | ||
3333 | if (ret) { | ||
3334 | dev_err(&dev->dev, "requesting NEQ IRQ failed\n"); | ||
3335 | goto out_shutdown_ports; | ||
3336 | } | ||
3337 | |||
3338 | |||
3335 | ret = 0; | 3339 | ret = 0; |
3336 | goto out; | 3340 | goto out; |
3337 | 3341 | ||
3342 | out_shutdown_ports: | ||
3343 | for (i = 0; i < EHEA_MAX_PORTS; i++) | ||
3344 | if (adapter->port[i]) { | ||
3345 | ehea_shutdown_single_port(adapter->port[i]); | ||
3346 | adapter->port[i] = NULL; | ||
3347 | } | ||
3348 | |||
3338 | out_rem_dev_sysfs: | 3349 | out_rem_dev_sysfs: |
3339 | ehea_remove_device_sysfs(dev); | 3350 | ehea_remove_device_sysfs(dev); |
3340 | 3351 | ||
3341 | out_free_irq: | ||
3342 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); | ||
3343 | |||
3344 | out_kill_eq: | 3352 | out_kill_eq: |
3345 | ehea_destroy_eq(adapter->neq); | 3353 | ehea_destroy_eq(adapter->neq); |
3346 | 3354 | ||
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_phyp.h b/drivers/net/ethernet/ibm/ehea/ehea_phyp.h index 52c456ec4d6c..8364815c32ff 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_phyp.h +++ b/drivers/net/ethernet/ibm/ehea/ehea_phyp.h | |||
@@ -450,7 +450,7 @@ u64 ehea_h_modify_ehea_port(const u64 adapter_handle, const u16 port_num, | |||
450 | void *cb_addr); | 450 | void *cb_addr); |
451 | 451 | ||
452 | #define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63) | 452 | #define H_REGBCMC_PN EHEA_BMASK_IBM(48, 63) |
453 | #define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(61, 63) | 453 | #define H_REGBCMC_REGTYPE EHEA_BMASK_IBM(60, 63) |
454 | #define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63) | 454 | #define H_REGBCMC_MACADDR EHEA_BMASK_IBM(16, 63) |
455 | #define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63) | 455 | #define H_REGBCMC_VLANID EHEA_BMASK_IBM(52, 63) |
456 | 456 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 64c76443a7aa..b461c24945e3 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
@@ -1310,10 +1310,6 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
1310 | 1310 | ||
1311 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) | 1311 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) |
1312 | oem_reg |= HV_OEM_BITS_LPLU; | 1312 | oem_reg |= HV_OEM_BITS_LPLU; |
1313 | |||
1314 | /* Set Restart auto-neg to activate the bits */ | ||
1315 | if (!hw->phy.ops.check_reset_block(hw)) | ||
1316 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
1317 | } else { | 1313 | } else { |
1318 | if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | | 1314 | if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | |
1319 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) | 1315 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) |
@@ -1324,6 +1320,11 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
1324 | oem_reg |= HV_OEM_BITS_LPLU; | 1320 | oem_reg |= HV_OEM_BITS_LPLU; |
1325 | } | 1321 | } |
1326 | 1322 | ||
1323 | /* Set Restart auto-neg to activate the bits */ | ||
1324 | if ((d0_state || (hw->mac.type != e1000_pchlan)) && | ||
1325 | !hw->phy.ops.check_reset_block(hw)) | ||
1326 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
1327 | |||
1327 | ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); | 1328 | ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); |
1328 | 1329 | ||
1329 | release: | 1330 | release: |
@@ -3682,7 +3683,11 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw) | |||
3682 | 3683 | ||
3683 | if (hw->mac.type >= e1000_pchlan) { | 3684 | if (hw->mac.type >= e1000_pchlan) { |
3684 | e1000_oem_bits_config_ich8lan(hw, false); | 3685 | e1000_oem_bits_config_ich8lan(hw, false); |
3685 | e1000_phy_hw_reset_ich8lan(hw); | 3686 | |
3687 | /* Reset PHY to activate OEM bits on 82577/8 */ | ||
3688 | if (hw->mac.type == e1000_pchlan) | ||
3689 | e1000e_phy_hw_reset_generic(hw); | ||
3690 | |||
3686 | ret_val = hw->phy.ops.acquire(hw); | 3691 | ret_val = hw->phy.ops.acquire(hw); |
3687 | if (ret_val) | 3692 | if (ret_val) |
3688 | return; | 3693 | return; |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 19ab2154802c..9520a6ac1f30 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -3799,7 +3799,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) | |||
3799 | /* fire an unusual interrupt on the test handler */ | 3799 | /* fire an unusual interrupt on the test handler */ |
3800 | ew32(ICS, E1000_ICS_RXSEQ); | 3800 | ew32(ICS, E1000_ICS_RXSEQ); |
3801 | e1e_flush(); | 3801 | e1e_flush(); |
3802 | msleep(50); | 3802 | msleep(100); |
3803 | 3803 | ||
3804 | e1000_irq_disable(adapter); | 3804 | e1000_irq_disable(adapter); |
3805 | 3805 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/param.c b/drivers/net/ethernet/intel/e1000e/param.c index ff796e42c3eb..16adeb9418a8 100644 --- a/drivers/net/ethernet/intel/e1000e/param.c +++ b/drivers/net/ethernet/intel/e1000e/param.c | |||
@@ -106,7 +106,7 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); | |||
106 | /* | 106 | /* |
107 | * Interrupt Throttle Rate (interrupts/sec) | 107 | * Interrupt Throttle Rate (interrupts/sec) |
108 | * | 108 | * |
109 | * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) | 109 | * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative |
110 | */ | 110 | */ |
111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); | 111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); |
112 | #define DEFAULT_ITR 3 | 112 | #define DEFAULT_ITR 3 |
@@ -344,53 +344,60 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
344 | 344 | ||
345 | if (num_InterruptThrottleRate > bd) { | 345 | if (num_InterruptThrottleRate > bd) { |
346 | adapter->itr = InterruptThrottleRate[bd]; | 346 | adapter->itr = InterruptThrottleRate[bd]; |
347 | switch (adapter->itr) { | 347 | |
348 | case 0: | 348 | /* |
349 | e_info("%s turned off\n", opt.name); | 349 | * Make sure a message is printed for non-special |
350 | break; | 350 | * values. And in case of an invalid option, display |
351 | case 1: | 351 | * warning, use default and got through itr/itr_setting |
352 | e_info("%s set to dynamic mode\n", opt.name); | 352 | * adjustment logic below |
353 | adapter->itr_setting = adapter->itr; | 353 | */ |
354 | adapter->itr = 20000; | 354 | if ((adapter->itr > 4) && |
355 | break; | 355 | e1000_validate_option(&adapter->itr, &opt, adapter)) |
356 | case 3: | 356 | adapter->itr = opt.def; |
357 | e_info("%s set to dynamic conservative mode\n", | ||
358 | opt.name); | ||
359 | adapter->itr_setting = adapter->itr; | ||
360 | adapter->itr = 20000; | ||
361 | break; | ||
362 | case 4: | ||
363 | e_info("%s set to simplified (2000-8000 ints) " | ||
364 | "mode\n", opt.name); | ||
365 | adapter->itr_setting = 4; | ||
366 | break; | ||
367 | default: | ||
368 | /* | ||
369 | * Save the setting, because the dynamic bits | ||
370 | * change itr. | ||
371 | */ | ||
372 | if (e1000_validate_option(&adapter->itr, &opt, | ||
373 | adapter) && | ||
374 | (adapter->itr == 3)) { | ||
375 | /* | ||
376 | * In case of invalid user value, | ||
377 | * default to conservative mode. | ||
378 | */ | ||
379 | adapter->itr_setting = adapter->itr; | ||
380 | adapter->itr = 20000; | ||
381 | } else { | ||
382 | /* | ||
383 | * Clear the lower two bits because | ||
384 | * they are used as control. | ||
385 | */ | ||
386 | adapter->itr_setting = | ||
387 | adapter->itr & ~3; | ||
388 | } | ||
389 | break; | ||
390 | } | ||
391 | } else { | 357 | } else { |
392 | adapter->itr_setting = opt.def; | 358 | /* |
359 | * If no option specified, use default value and go | ||
360 | * through the logic below to adjust itr/itr_setting | ||
361 | */ | ||
362 | adapter->itr = opt.def; | ||
363 | |||
364 | /* | ||
365 | * Make sure a message is printed for non-special | ||
366 | * default values | ||
367 | */ | ||
368 | if (adapter->itr > 40) | ||
369 | e_info("%s set to default %d\n", opt.name, | ||
370 | adapter->itr); | ||
371 | } | ||
372 | |||
373 | adapter->itr_setting = adapter->itr; | ||
374 | switch (adapter->itr) { | ||
375 | case 0: | ||
376 | e_info("%s turned off\n", opt.name); | ||
377 | break; | ||
378 | case 1: | ||
379 | e_info("%s set to dynamic mode\n", opt.name); | ||
380 | adapter->itr = 20000; | ||
381 | break; | ||
382 | case 3: | ||
383 | e_info("%s set to dynamic conservative mode\n", | ||
384 | opt.name); | ||
393 | adapter->itr = 20000; | 385 | adapter->itr = 20000; |
386 | break; | ||
387 | case 4: | ||
388 | e_info("%s set to simplified (2000-8000 ints) mode\n", | ||
389 | opt.name); | ||
390 | break; | ||
391 | default: | ||
392 | /* | ||
393 | * Save the setting, because the dynamic bits | ||
394 | * change itr. | ||
395 | * | ||
396 | * Clear the lower two bits because | ||
397 | * they are used as control. | ||
398 | */ | ||
399 | adapter->itr_setting &= ~3; | ||
400 | break; | ||
394 | } | 401 | } |
395 | } | 402 | } |
396 | { /* Interrupt Mode */ | 403 | { /* Interrupt Mode */ |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index d61ca2a732f0..8ec74b07f940 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -2731,14 +2731,14 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2731 | netdev->addr_len); | 2731 | netdev->addr_len); |
2732 | } | 2732 | } |
2733 | 2733 | ||
2734 | if (!is_valid_ether_addr(netdev->perm_addr)) { | 2734 | if (!is_valid_ether_addr(netdev->dev_addr)) { |
2735 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", | 2735 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", |
2736 | netdev->dev_addr); | 2736 | netdev->dev_addr); |
2737 | err = -EIO; | 2737 | err = -EIO; |
2738 | goto err_hw_init; | 2738 | goto err_hw_init; |
2739 | } | 2739 | } |
2740 | 2740 | ||
2741 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | 2741 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); |
2742 | 2742 | ||
2743 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, | 2743 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, |
2744 | (unsigned long) adapter); | 2744 | (unsigned long) adapter); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 77ea4b716535..bc07933d67da 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | |||
@@ -437,6 +437,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, | |||
437 | */ | 437 | */ |
438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && | 438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && |
439 | (fctl & FC_FC_END_SEQ)) { | 439 | (fctl & FC_FC_END_SEQ)) { |
440 | skb_linearize(skb); | ||
440 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); | 441 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); |
441 | crc->fcoe_eof = FC_EOF_T; | 442 | crc->fcoe_eof = FC_EOF_T; |
442 | } | 443 | } |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c index 027d7a75be39..ed1b47dc0834 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | |||
@@ -622,6 +622,16 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, int v_idx, | |||
622 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | 622 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) |
623 | set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state); | 623 | set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state); |
624 | 624 | ||
625 | #ifdef IXGBE_FCOE | ||
626 | if (adapter->netdev->features & NETIF_F_FCOE_MTU) { | ||
627 | struct ixgbe_ring_feature *f; | ||
628 | f = &adapter->ring_feature[RING_F_FCOE]; | ||
629 | if ((rxr_idx >= f->mask) && | ||
630 | (rxr_idx < f->mask + f->indices)) | ||
631 | set_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state); | ||
632 | } | ||
633 | |||
634 | #endif /* IXGBE_FCOE */ | ||
625 | /* apply Rx specific ring traits */ | 635 | /* apply Rx specific ring traits */ |
626 | ring->count = adapter->rx_ring_count; | 636 | ring->count = adapter->rx_ring_count; |
627 | ring->queue_index = rxr_idx; | 637 | ring->queue_index = rxr_idx; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 3e26b1f9ac75..88f6b2e9b72d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -3154,14 +3154,6 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) | |||
3154 | set_ring_rsc_enabled(rx_ring); | 3154 | set_ring_rsc_enabled(rx_ring); |
3155 | else | 3155 | else |
3156 | clear_ring_rsc_enabled(rx_ring); | 3156 | clear_ring_rsc_enabled(rx_ring); |
3157 | #ifdef IXGBE_FCOE | ||
3158 | if (netdev->features & NETIF_F_FCOE_MTU) { | ||
3159 | struct ixgbe_ring_feature *f; | ||
3160 | f = &adapter->ring_feature[RING_F_FCOE]; | ||
3161 | if ((i >= f->mask) && (i < f->mask + f->indices)) | ||
3162 | set_bit(__IXGBE_RX_FCOE_BUFSZ, &rx_ring->state); | ||
3163 | } | ||
3164 | #endif /* IXGBE_FCOE */ | ||
3165 | } | 3157 | } |
3166 | } | 3158 | } |
3167 | 3159 | ||
@@ -4836,7 +4828,9 @@ static int ixgbe_resume(struct pci_dev *pdev) | |||
4836 | 4828 | ||
4837 | pci_wake_from_d3(pdev, false); | 4829 | pci_wake_from_d3(pdev, false); |
4838 | 4830 | ||
4831 | rtnl_lock(); | ||
4839 | err = ixgbe_init_interrupt_scheme(adapter); | 4832 | err = ixgbe_init_interrupt_scheme(adapter); |
4833 | rtnl_unlock(); | ||
4840 | if (err) { | 4834 | if (err) { |
4841 | e_dev_err("Cannot initialize interrupts for device\n"); | 4835 | e_dev_err("Cannot initialize interrupts for device\n"); |
4842 | return err; | 4836 | return err; |
@@ -4879,10 +4873,6 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4879 | } | 4873 | } |
4880 | 4874 | ||
4881 | ixgbe_clear_interrupt_scheme(adapter); | 4875 | ixgbe_clear_interrupt_scheme(adapter); |
4882 | #ifdef CONFIG_DCB | ||
4883 | kfree(adapter->ixgbe_ieee_pfc); | ||
4884 | kfree(adapter->ixgbe_ieee_ets); | ||
4885 | #endif | ||
4886 | 4876 | ||
4887 | #ifdef CONFIG_PM | 4877 | #ifdef CONFIG_PM |
4888 | retval = pci_save_state(pdev); | 4878 | retval = pci_save_state(pdev); |
@@ -4893,6 +4883,16 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4893 | if (wufc) { | 4883 | if (wufc) { |
4894 | ixgbe_set_rx_mode(netdev); | 4884 | ixgbe_set_rx_mode(netdev); |
4895 | 4885 | ||
4886 | /* | ||
4887 | * enable the optics for both mult-speed fiber and | ||
4888 | * 82599 SFP+ fiber as we can WoL. | ||
4889 | */ | ||
4890 | if (hw->mac.ops.enable_tx_laser && | ||
4891 | (hw->phy.multispeed_fiber || | ||
4892 | (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber && | ||
4893 | hw->mac.type == ixgbe_mac_82599EB))) | ||
4894 | hw->mac.ops.enable_tx_laser(hw); | ||
4895 | |||
4896 | /* turn on all-multi mode if wake on multicast is enabled */ | 4896 | /* turn on all-multi mode if wake on multicast is enabled */ |
4897 | if (wufc & IXGBE_WUFC_MC) { | 4897 | if (wufc & IXGBE_WUFC_MC) { |
4898 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); | 4898 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); |
@@ -7220,6 +7220,11 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
7220 | 7220 | ||
7221 | ixgbe_release_hw_control(adapter); | 7221 | ixgbe_release_hw_control(adapter); |
7222 | 7222 | ||
7223 | #ifdef CONFIG_DCB | ||
7224 | kfree(adapter->ixgbe_ieee_pfc); | ||
7225 | kfree(adapter->ixgbe_ieee_ets); | ||
7226 | |||
7227 | #endif | ||
7223 | iounmap(adapter->hw.hw_addr); | 7228 | iounmap(adapter->hw.hw_addr); |
7224 | pci_release_selected_regions(pdev, pci_select_bars(pdev, | 7229 | pci_release_selected_regions(pdev, pci_select_bars(pdev, |
7225 | IORESOURCE_MEM)); | 7230 | IORESOURCE_MEM)); |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index c9b504e2dfc3..487a6c8bd4ec 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -2494,8 +2494,13 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, | |||
2494 | skb_copy_from_linear_data(re->skb, skb->data, length); | 2494 | skb_copy_from_linear_data(re->skb, skb->data, length); |
2495 | skb->ip_summed = re->skb->ip_summed; | 2495 | skb->ip_summed = re->skb->ip_summed; |
2496 | skb->csum = re->skb->csum; | 2496 | skb->csum = re->skb->csum; |
2497 | skb->rxhash = re->skb->rxhash; | ||
2498 | skb->vlan_tci = re->skb->vlan_tci; | ||
2499 | |||
2497 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, | 2500 | pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr, |
2498 | length, PCI_DMA_FROMDEVICE); | 2501 | length, PCI_DMA_FROMDEVICE); |
2502 | re->skb->vlan_tci = 0; | ||
2503 | re->skb->rxhash = 0; | ||
2499 | re->skb->ip_summed = CHECKSUM_NONE; | 2504 | re->skb->ip_summed = CHECKSUM_NONE; |
2500 | skb_put(skb, length); | 2505 | skb_put(skb, length); |
2501 | } | 2506 | } |
@@ -2580,9 +2585,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
2580 | struct sk_buff *skb = NULL; | 2585 | struct sk_buff *skb = NULL; |
2581 | u16 count = (status & GMR_FS_LEN) >> 16; | 2586 | u16 count = (status & GMR_FS_LEN) >> 16; |
2582 | 2587 | ||
2583 | if (status & GMR_FS_VLAN) | ||
2584 | count -= VLAN_HLEN; /* Account for vlan tag */ | ||
2585 | |||
2586 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, | 2588 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, |
2587 | "rx slot %u status 0x%x len %d\n", | 2589 | "rx slot %u status 0x%x len %d\n", |
2588 | sky2->rx_next, status, length); | 2590 | sky2->rx_next, status, length); |
@@ -2590,6 +2592,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
2590 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; | 2592 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; |
2591 | prefetch(sky2->rx_ring + sky2->rx_next); | 2593 | prefetch(sky2->rx_ring + sky2->rx_next); |
2592 | 2594 | ||
2595 | if (vlan_tx_tag_present(re->skb)) | ||
2596 | count -= VLAN_HLEN; /* Account for vlan tag */ | ||
2597 | |||
2593 | /* This chip has hardware problems that generates bogus status. | 2598 | /* This chip has hardware problems that generates bogus status. |
2594 | * So do only marginal checking and expect higher level protocols | 2599 | * So do only marginal checking and expect higher level protocols |
2595 | * to handle crap frames. | 2600 | * to handle crap frames. |
@@ -2647,11 +2652,8 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
2647 | } | 2652 | } |
2648 | 2653 | ||
2649 | static inline void sky2_skb_rx(const struct sky2_port *sky2, | 2654 | static inline void sky2_skb_rx(const struct sky2_port *sky2, |
2650 | u32 status, struct sk_buff *skb) | 2655 | struct sk_buff *skb) |
2651 | { | 2656 | { |
2652 | if (status & GMR_FS_VLAN) | ||
2653 | __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag)); | ||
2654 | |||
2655 | if (skb->ip_summed == CHECKSUM_NONE) | 2657 | if (skb->ip_summed == CHECKSUM_NONE) |
2656 | netif_receive_skb(skb); | 2658 | netif_receive_skb(skb); |
2657 | else | 2659 | else |
@@ -2705,6 +2707,14 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status) | |||
2705 | } | 2707 | } |
2706 | } | 2708 | } |
2707 | 2709 | ||
2710 | static void sky2_rx_tag(struct sky2_port *sky2, u16 length) | ||
2711 | { | ||
2712 | struct sk_buff *skb; | ||
2713 | |||
2714 | skb = sky2->rx_ring[sky2->rx_next].skb; | ||
2715 | __vlan_hwaccel_put_tag(skb, be16_to_cpu(length)); | ||
2716 | } | ||
2717 | |||
2708 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) | 2718 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) |
2709 | { | 2719 | { |
2710 | struct sk_buff *skb; | 2720 | struct sk_buff *skb; |
@@ -2763,8 +2773,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
2763 | } | 2773 | } |
2764 | 2774 | ||
2765 | skb->protocol = eth_type_trans(skb, dev); | 2775 | skb->protocol = eth_type_trans(skb, dev); |
2766 | 2776 | sky2_skb_rx(sky2, skb); | |
2767 | sky2_skb_rx(sky2, status, skb); | ||
2768 | 2777 | ||
2769 | /* Stop after net poll weight */ | 2778 | /* Stop after net poll weight */ |
2770 | if (++work_done >= to_do) | 2779 | if (++work_done >= to_do) |
@@ -2772,11 +2781,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
2772 | break; | 2781 | break; |
2773 | 2782 | ||
2774 | case OP_RXVLAN: | 2783 | case OP_RXVLAN: |
2775 | sky2->rx_tag = length; | 2784 | sky2_rx_tag(sky2, length); |
2776 | break; | 2785 | break; |
2777 | 2786 | ||
2778 | case OP_RXCHKSVLAN: | 2787 | case OP_RXCHKSVLAN: |
2779 | sky2->rx_tag = length; | 2788 | sky2_rx_tag(sky2, length); |
2780 | /* fall through */ | 2789 | /* fall through */ |
2781 | case OP_RXCHKS: | 2790 | case OP_RXCHKS: |
2782 | if (likely(dev->features & NETIF_F_RXCSUM)) | 2791 | if (likely(dev->features & NETIF_F_RXCSUM)) |
diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h index ff6f58bf822a..3c896ce80b71 100644 --- a/drivers/net/ethernet/marvell/sky2.h +++ b/drivers/net/ethernet/marvell/sky2.h | |||
@@ -2241,7 +2241,6 @@ struct sky2_port { | |||
2241 | u16 rx_pending; | 2241 | u16 rx_pending; |
2242 | u16 rx_data_size; | 2242 | u16 rx_data_size; |
2243 | u16 rx_nfrags; | 2243 | u16 rx_nfrags; |
2244 | u16 rx_tag; | ||
2245 | 2244 | ||
2246 | struct { | 2245 | struct { |
2247 | unsigned long last; | 2246 | unsigned long last; |
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index c722aa607d07..f8dda009d3c0 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
@@ -889,16 +889,17 @@ static int ks8851_net_stop(struct net_device *dev) | |||
889 | netif_stop_queue(dev); | 889 | netif_stop_queue(dev); |
890 | 890 | ||
891 | mutex_lock(&ks->lock); | 891 | mutex_lock(&ks->lock); |
892 | /* turn off the IRQs and ack any outstanding */ | ||
893 | ks8851_wrreg16(ks, KS_IER, 0x0000); | ||
894 | ks8851_wrreg16(ks, KS_ISR, 0xffff); | ||
895 | mutex_unlock(&ks->lock); | ||
892 | 896 | ||
893 | /* stop any outstanding work */ | 897 | /* stop any outstanding work */ |
894 | flush_work(&ks->irq_work); | 898 | flush_work(&ks->irq_work); |
895 | flush_work(&ks->tx_work); | 899 | flush_work(&ks->tx_work); |
896 | flush_work(&ks->rxctrl_work); | 900 | flush_work(&ks->rxctrl_work); |
897 | 901 | ||
898 | /* turn off the IRQs and ack any outstanding */ | 902 | mutex_lock(&ks->lock); |
899 | ks8851_wrreg16(ks, KS_IER, 0x0000); | ||
900 | ks8851_wrreg16(ks, KS_ISR, 0xffff); | ||
901 | |||
902 | /* shutdown RX process */ | 903 | /* shutdown RX process */ |
903 | ks8851_wrreg16(ks, KS_RXCR1, 0x0000); | 904 | ks8851_wrreg16(ks, KS_RXCR1, 0x0000); |
904 | 905 | ||
@@ -907,6 +908,7 @@ static int ks8851_net_stop(struct net_device *dev) | |||
907 | 908 | ||
908 | /* set powermode to soft power down to save power */ | 909 | /* set powermode to soft power down to save power */ |
909 | ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN); | 910 | ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN); |
911 | mutex_unlock(&ks->lock); | ||
910 | 912 | ||
911 | /* ensure any queued tx buffers are dumped */ | 913 | /* ensure any queued tx buffers are dumped */ |
912 | while (!skb_queue_empty(&ks->txq)) { | 914 | while (!skb_queue_empty(&ks->txq)) { |
@@ -918,7 +920,6 @@ static int ks8851_net_stop(struct net_device *dev) | |||
918 | dev_kfree_skb(txb); | 920 | dev_kfree_skb(txb); |
919 | } | 921 | } |
920 | 922 | ||
921 | mutex_unlock(&ks->lock); | ||
922 | return 0; | 923 | return 0; |
923 | } | 924 | } |
924 | 925 | ||
@@ -1418,6 +1419,7 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1418 | struct net_device *ndev; | 1419 | struct net_device *ndev; |
1419 | struct ks8851_net *ks; | 1420 | struct ks8851_net *ks; |
1420 | int ret; | 1421 | int ret; |
1422 | unsigned cider; | ||
1421 | 1423 | ||
1422 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); | 1424 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); |
1423 | if (!ndev) | 1425 | if (!ndev) |
@@ -1484,8 +1486,8 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1484 | ks8851_soft_reset(ks, GRR_GSR); | 1486 | ks8851_soft_reset(ks, GRR_GSR); |
1485 | 1487 | ||
1486 | /* simple check for a valid chip being connected to the bus */ | 1488 | /* simple check for a valid chip being connected to the bus */ |
1487 | 1489 | cider = ks8851_rdreg16(ks, KS_CIDER); | |
1488 | if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { | 1490 | if ((cider & ~CIDER_REV_MASK) != CIDER_ID) { |
1489 | dev_err(&spi->dev, "failed to read device ID\n"); | 1491 | dev_err(&spi->dev, "failed to read device ID\n"); |
1490 | ret = -ENODEV; | 1492 | ret = -ENODEV; |
1491 | goto err_id; | 1493 | goto err_id; |
@@ -1516,15 +1518,14 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1516 | } | 1518 | } |
1517 | 1519 | ||
1518 | netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", | 1520 | netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", |
1519 | CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), | 1521 | CIDER_REV_GET(cider), ndev->dev_addr, ndev->irq, |
1520 | ndev->dev_addr, ndev->irq, | ||
1521 | ks->rc_ccr & CCR_EEPROM ? "has" : "no"); | 1522 | ks->rc_ccr & CCR_EEPROM ? "has" : "no"); |
1522 | 1523 | ||
1523 | return 0; | 1524 | return 0; |
1524 | 1525 | ||
1525 | 1526 | ||
1526 | err_netdev: | 1527 | err_netdev: |
1527 | free_irq(ndev->irq, ndev); | 1528 | free_irq(ndev->irq, ks); |
1528 | 1529 | ||
1529 | err_id: | 1530 | err_id: |
1530 | err_irq: | 1531 | err_irq: |
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c index b8104d9f4081..5ffde23ac8fb 100644 --- a/drivers/net/ethernet/micrel/ks8851_mll.c +++ b/drivers/net/ethernet/micrel/ks8851_mll.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #define DRV_NAME "ks8851_mll" | 40 | #define DRV_NAME "ks8851_mll" |
41 | 41 | ||
42 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; | 42 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; |
43 | #define MAX_RECV_FRAMES 32 | 43 | #define MAX_RECV_FRAMES 255 |
44 | #define MAX_BUF_SIZE 2048 | 44 | #define MAX_BUF_SIZE 2048 |
45 | #define TX_BUF_SIZE 2000 | 45 | #define TX_BUF_SIZE 2000 |
46 | #define RX_BUF_SIZE 2000 | 46 | #define RX_BUF_SIZE 2000 |
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index ef723b185d85..eaf9ff0262a9 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c | |||
@@ -5675,7 +5675,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr) | |||
5675 | memcpy(hw->override_addr, mac->sa_data, ETH_ALEN); | 5675 | memcpy(hw->override_addr, mac->sa_data, ETH_ALEN); |
5676 | } | 5676 | } |
5677 | 5677 | ||
5678 | memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN); | 5678 | memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN); |
5679 | 5679 | ||
5680 | interrupt = hw_block_intr(hw); | 5680 | interrupt = hw_block_intr(hw); |
5681 | 5681 | ||
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index abc79076f867..b3287c0fe279 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -958,6 +958,11 @@ static inline void cp_start_hw (struct cp_private *cp) | |||
958 | cpw8(Cmd, RxOn | TxOn); | 958 | cpw8(Cmd, RxOn | TxOn); |
959 | } | 959 | } |
960 | 960 | ||
961 | static void cp_enable_irq(struct cp_private *cp) | ||
962 | { | ||
963 | cpw16_f(IntrMask, cp_intr_mask); | ||
964 | } | ||
965 | |||
961 | static void cp_init_hw (struct cp_private *cp) | 966 | static void cp_init_hw (struct cp_private *cp) |
962 | { | 967 | { |
963 | struct net_device *dev = cp->dev; | 968 | struct net_device *dev = cp->dev; |
@@ -997,8 +1002,6 @@ static void cp_init_hw (struct cp_private *cp) | |||
997 | 1002 | ||
998 | cpw16(MultiIntr, 0); | 1003 | cpw16(MultiIntr, 0); |
999 | 1004 | ||
1000 | cpw16_f(IntrMask, cp_intr_mask); | ||
1001 | |||
1002 | cpw8_f(Cfg9346, Cfg9346_Lock); | 1005 | cpw8_f(Cfg9346, Cfg9346_Lock); |
1003 | } | 1006 | } |
1004 | 1007 | ||
@@ -1130,6 +1133,8 @@ static int cp_open (struct net_device *dev) | |||
1130 | if (rc) | 1133 | if (rc) |
1131 | goto err_out_hw; | 1134 | goto err_out_hw; |
1132 | 1135 | ||
1136 | cp_enable_irq(cp); | ||
1137 | |||
1133 | netif_carrier_off(dev); | 1138 | netif_carrier_off(dev); |
1134 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); | 1139 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); |
1135 | netif_start_queue(dev); | 1140 | netif_start_queue(dev); |
@@ -2031,6 +2036,7 @@ static int cp_resume (struct pci_dev *pdev) | |||
2031 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ | 2036 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ |
2032 | cp_init_rings_index (cp); | 2037 | cp_init_rings_index (cp); |
2033 | cp_init_hw (cp); | 2038 | cp_init_hw (cp); |
2039 | cp_enable_irq(cp); | ||
2034 | netif_start_queue (dev); | 2040 | netif_start_queue (dev); |
2035 | 2041 | ||
2036 | spin_lock_irqsave (&cp->lock, flags); | 2042 | spin_lock_irqsave (&cp->lock, flags); |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 4a6971027076..cd3defb11ffb 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1166,10 +1166,8 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat) | |||
1166 | 1166 | ||
1167 | /* Quickly dumps bad packets */ | 1167 | /* Quickly dumps bad packets */ |
1168 | static void | 1168 | static void |
1169 | smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes) | 1169 | smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktwords) |
1170 | { | 1170 | { |
1171 | unsigned int pktwords = (pktbytes + NET_IP_ALIGN + 3) >> 2; | ||
1172 | |||
1173 | if (likely(pktwords >= 4)) { | 1171 | if (likely(pktwords >= 4)) { |
1174 | unsigned int timeout = 500; | 1172 | unsigned int timeout = 500; |
1175 | unsigned int val; | 1173 | unsigned int val; |
@@ -1233,7 +1231,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
1233 | continue; | 1231 | continue; |
1234 | } | 1232 | } |
1235 | 1233 | ||
1236 | skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN); | 1234 | skb = netdev_alloc_skb(dev, pktwords << 2); |
1237 | if (unlikely(!skb)) { | 1235 | if (unlikely(!skb)) { |
1238 | SMSC_WARN(pdata, rx_err, | 1236 | SMSC_WARN(pdata, rx_err, |
1239 | "Unable to allocate skb for rx packet"); | 1237 | "Unable to allocate skb for rx packet"); |
@@ -1243,14 +1241,12 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
1243 | break; | 1241 | break; |
1244 | } | 1242 | } |
1245 | 1243 | ||
1246 | skb->data = skb->head; | 1244 | pdata->ops->rx_readfifo(pdata, |
1247 | skb_reset_tail_pointer(skb); | 1245 | (unsigned int *)skb->data, pktwords); |
1248 | 1246 | ||
1249 | /* Align IP on 16B boundary */ | 1247 | /* Align IP on 16B boundary */ |
1250 | skb_reserve(skb, NET_IP_ALIGN); | 1248 | skb_reserve(skb, NET_IP_ALIGN); |
1251 | skb_put(skb, pktlength - 4); | 1249 | skb_put(skb, pktlength - 4); |
1252 | pdata->ops->rx_readfifo(pdata, | ||
1253 | (unsigned int *)skb->head, pktwords); | ||
1254 | skb->protocol = eth_type_trans(skb, dev); | 1250 | skb->protocol = eth_type_trans(skb, dev); |
1255 | skb_checksum_none_assert(skb); | 1251 | skb_checksum_none_assert(skb); |
1256 | netif_receive_skb(skb); | 1252 | netif_receive_skb(skb); |
@@ -1565,7 +1561,7 @@ static int smsc911x_open(struct net_device *dev) | |||
1565 | smsc911x_reg_write(pdata, FIFO_INT, temp); | 1561 | smsc911x_reg_write(pdata, FIFO_INT, temp); |
1566 | 1562 | ||
1567 | /* set RX Data offset to 2 bytes for alignment */ | 1563 | /* set RX Data offset to 2 bytes for alignment */ |
1568 | smsc911x_reg_write(pdata, RX_CFG, (2 << 8)); | 1564 | smsc911x_reg_write(pdata, RX_CFG, (NET_IP_ALIGN << 8)); |
1569 | 1565 | ||
1570 | /* enable NAPI polling before enabling RX interrupts */ | 1566 | /* enable NAPI polling before enabling RX interrupts */ |
1571 | napi_enable(&pdata->napi); | 1567 | napi_enable(&pdata->napi); |
@@ -2382,7 +2378,6 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
2382 | SET_NETDEV_DEV(dev, &pdev->dev); | 2378 | SET_NETDEV_DEV(dev, &pdev->dev); |
2383 | 2379 | ||
2384 | pdata = netdev_priv(dev); | 2380 | pdata = netdev_priv(dev); |
2385 | |||
2386 | dev->irq = irq_res->start; | 2381 | dev->irq = irq_res->start; |
2387 | irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; | 2382 | irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; |
2388 | pdata->ioaddr = ioremap_nocache(res->start, res_size); | 2383 | pdata->ioaddr = ioremap_nocache(res->start, res_size); |
@@ -2446,7 +2441,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
2446 | if (retval) { | 2441 | if (retval) { |
2447 | SMSC_WARN(pdata, probe, | 2442 | SMSC_WARN(pdata, probe, |
2448 | "Unable to claim requested irq: %d", dev->irq); | 2443 | "Unable to claim requested irq: %d", dev->irq); |
2449 | goto out_free_irq; | 2444 | goto out_disable_resources; |
2450 | } | 2445 | } |
2451 | 2446 | ||
2452 | retval = register_netdev(dev); | 2447 | retval = register_netdev(dev); |
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 558409ff4058..4ba969096717 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c | |||
@@ -2339,7 +2339,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2339 | netif_device_detach(dev); | 2339 | netif_device_detach(dev); |
2340 | 2340 | ||
2341 | /* Switch off chip, remember WOL setting */ | 2341 | /* Switch off chip, remember WOL setting */ |
2342 | gp->asleep_wol = gp->wake_on_lan; | 2342 | gp->asleep_wol = !!gp->wake_on_lan; |
2343 | gem_do_stop(dev, gp->asleep_wol); | 2343 | gem_do_stop(dev, gp->asleep_wol); |
2344 | 2344 | ||
2345 | /* Unlock the network stack */ | 2345 | /* Unlock the network stack */ |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 174a3348f676..08aff1a2087c 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1511,7 +1511,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) | |||
1511 | 1511 | ||
1512 | static int match_first_device(struct device *dev, void *data) | 1512 | static int match_first_device(struct device *dev, void *data) |
1513 | { | 1513 | { |
1514 | return 1; | 1514 | return !strncmp(dev_name(dev), "davinci_mdio", 12); |
1515 | } | 1515 | } |
1516 | 1516 | ||
1517 | /** | 1517 | /** |
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 2757c7d6e633..e4e47088e26b 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c | |||
@@ -181,6 +181,11 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data) | |||
181 | __davinci_mdio_reset(data); | 181 | __davinci_mdio_reset(data); |
182 | return -EAGAIN; | 182 | return -EAGAIN; |
183 | } | 183 | } |
184 | |||
185 | reg = __raw_readl(®s->user[0].access); | ||
186 | if ((reg & USERACCESS_GO) == 0) | ||
187 | return 0; | ||
188 | |||
184 | dev_err(data->dev, "timed out waiting for user access\n"); | 189 | dev_err(data->dev, "timed out waiting for user access\n"); |
185 | return -ETIMEDOUT; | 190 | return -ETIMEDOUT; |
186 | } | 191 | } |
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c index 817ad3bc4957..efd36691ce54 100644 --- a/drivers/net/ethernet/ti/tlan.c +++ b/drivers/net/ethernet/ti/tlan.c | |||
@@ -228,7 +228,7 @@ tlan_get_skb(const struct tlan_list *tag) | |||
228 | unsigned long addr; | 228 | unsigned long addr; |
229 | 229 | ||
230 | addr = tag->buffer[9].address; | 230 | addr = tag->buffer[9].address; |
231 | addr |= (tag->buffer[8].address << 16) << 16; | 231 | addr |= ((unsigned long) tag->buffer[8].address << 16) << 16; |
232 | return (struct sk_buff *) addr; | 232 | return (struct sk_buff *) addr; |
233 | } | 233 | } |
234 | 234 | ||
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index cc83af083fd7..44b8d2bad8c3 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h | |||
@@ -2,9 +2,7 @@ | |||
2 | * Definitions for Xilinx Axi Ethernet device driver. | 2 | * Definitions for Xilinx Axi Ethernet device driver. |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. | 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. |
5 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 5 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
6 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | ||
7 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | ||
8 | */ | 6 | */ |
9 | 7 | ||
10 | #ifndef XILINX_AXIENET_H | 8 | #ifndef XILINX_AXIENET_H |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 2fcbeba6814b..9c365e192a31 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -4,9 +4,9 @@ | |||
4 | * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi | 4 | * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi |
5 | * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> | 5 | * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> |
6 | * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. | 6 | * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. |
7 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 7 | * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu> |
8 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | 8 | * Copyright (c) 2010 - 2011 PetaLogix |
9 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | 9 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
10 | * | 10 | * |
11 | * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 | 11 | * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 |
12 | * and Spartan6. | 12 | * and Spartan6. |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c index d70b6e79f6c0..e90e1f46121e 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | |||
@@ -2,9 +2,9 @@ | |||
2 | * MDIO bus driver for the Xilinx Axi Ethernet device | 2 | * MDIO bus driver for the Xilinx Axi Ethernet device |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. | 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. |
5 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 5 | * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu> |
6 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | 6 | * Copyright (c) 2010 - 2011 PetaLogix |
7 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | 7 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/of_address.h> | 10 | #include <linux/of_address.h> |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index dd294783b5c5..2d59138db7f3 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -44,6 +44,7 @@ struct net_device_context { | |||
44 | /* point back to our device context */ | 44 | /* point back to our device context */ |
45 | struct hv_device *device_ctx; | 45 | struct hv_device *device_ctx; |
46 | struct delayed_work dwork; | 46 | struct delayed_work dwork; |
47 | struct work_struct work; | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | 50 | ||
@@ -51,30 +52,22 @@ static int ring_size = 128; | |||
51 | module_param(ring_size, int, S_IRUGO); | 52 | module_param(ring_size, int, S_IRUGO); |
52 | MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); | 53 | MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); |
53 | 54 | ||
54 | struct set_multicast_work { | ||
55 | struct work_struct work; | ||
56 | struct net_device *net; | ||
57 | }; | ||
58 | |||
59 | static void do_set_multicast(struct work_struct *w) | 55 | static void do_set_multicast(struct work_struct *w) |
60 | { | 56 | { |
61 | struct set_multicast_work *swk = | 57 | struct net_device_context *ndevctx = |
62 | container_of(w, struct set_multicast_work, work); | 58 | container_of(w, struct net_device_context, work); |
63 | struct net_device *net = swk->net; | ||
64 | |||
65 | struct net_device_context *ndevctx = netdev_priv(net); | ||
66 | struct netvsc_device *nvdev; | 59 | struct netvsc_device *nvdev; |
67 | struct rndis_device *rdev; | 60 | struct rndis_device *rdev; |
68 | 61 | ||
69 | nvdev = hv_get_drvdata(ndevctx->device_ctx); | 62 | nvdev = hv_get_drvdata(ndevctx->device_ctx); |
70 | if (nvdev == NULL) | 63 | if (nvdev == NULL || nvdev->ndev == NULL) |
71 | goto out; | 64 | return; |
72 | 65 | ||
73 | rdev = nvdev->extension; | 66 | rdev = nvdev->extension; |
74 | if (rdev == NULL) | 67 | if (rdev == NULL) |
75 | goto out; | 68 | return; |
76 | 69 | ||
77 | if (net->flags & IFF_PROMISC) | 70 | if (nvdev->ndev->flags & IFF_PROMISC) |
78 | rndis_filter_set_packet_filter(rdev, | 71 | rndis_filter_set_packet_filter(rdev, |
79 | NDIS_PACKET_TYPE_PROMISCUOUS); | 72 | NDIS_PACKET_TYPE_PROMISCUOUS); |
80 | else | 73 | else |
@@ -82,21 +75,13 @@ static void do_set_multicast(struct work_struct *w) | |||
82 | NDIS_PACKET_TYPE_BROADCAST | | 75 | NDIS_PACKET_TYPE_BROADCAST | |
83 | NDIS_PACKET_TYPE_ALL_MULTICAST | | 76 | NDIS_PACKET_TYPE_ALL_MULTICAST | |
84 | NDIS_PACKET_TYPE_DIRECTED); | 77 | NDIS_PACKET_TYPE_DIRECTED); |
85 | |||
86 | out: | ||
87 | kfree(w); | ||
88 | } | 78 | } |
89 | 79 | ||
90 | static void netvsc_set_multicast_list(struct net_device *net) | 80 | static void netvsc_set_multicast_list(struct net_device *net) |
91 | { | 81 | { |
92 | struct set_multicast_work *swk = | 82 | struct net_device_context *net_device_ctx = netdev_priv(net); |
93 | kmalloc(sizeof(struct set_multicast_work), GFP_ATOMIC); | ||
94 | if (swk == NULL) | ||
95 | return; | ||
96 | 83 | ||
97 | swk->net = net; | 84 | schedule_work(&net_device_ctx->work); |
98 | INIT_WORK(&swk->work, do_set_multicast); | ||
99 | schedule_work(&swk->work); | ||
100 | } | 85 | } |
101 | 86 | ||
102 | static int netvsc_open(struct net_device *net) | 87 | static int netvsc_open(struct net_device *net) |
@@ -125,6 +110,8 @@ static int netvsc_close(struct net_device *net) | |||
125 | 110 | ||
126 | netif_tx_disable(net); | 111 | netif_tx_disable(net); |
127 | 112 | ||
113 | /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */ | ||
114 | cancel_work_sync(&net_device_ctx->work); | ||
128 | ret = rndis_filter_close(device_obj); | 115 | ret = rndis_filter_close(device_obj); |
129 | if (ret != 0) | 116 | if (ret != 0) |
130 | netdev_err(net, "unable to close device (ret %d).\n", ret); | 117 | netdev_err(net, "unable to close device (ret %d).\n", ret); |
@@ -335,6 +322,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) | |||
335 | 322 | ||
336 | nvdev->start_remove = true; | 323 | nvdev->start_remove = true; |
337 | cancel_delayed_work_sync(&ndevctx->dwork); | 324 | cancel_delayed_work_sync(&ndevctx->dwork); |
325 | cancel_work_sync(&ndevctx->work); | ||
338 | netif_tx_disable(ndev); | 326 | netif_tx_disable(ndev); |
339 | rndis_filter_device_remove(hdev); | 327 | rndis_filter_device_remove(hdev); |
340 | 328 | ||
@@ -403,6 +391,7 @@ static int netvsc_probe(struct hv_device *dev, | |||
403 | net_device_ctx->device_ctx = dev; | 391 | net_device_ctx->device_ctx = dev; |
404 | hv_set_drvdata(dev, net); | 392 | hv_set_drvdata(dev, net); |
405 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp); | 393 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp); |
394 | INIT_WORK(&net_device_ctx->work, do_set_multicast); | ||
406 | 395 | ||
407 | net->netdev_ops = &device_ops; | 396 | net->netdev_ops = &device_ops; |
408 | 397 | ||
@@ -456,6 +445,7 @@ static int netvsc_remove(struct hv_device *dev) | |||
456 | 445 | ||
457 | ndev_ctx = netdev_priv(net); | 446 | ndev_ctx = netdev_priv(net); |
458 | cancel_delayed_work_sync(&ndev_ctx->dwork); | 447 | cancel_delayed_work_sync(&ndev_ctx->dwork); |
448 | cancel_work_sync(&ndev_ctx->work); | ||
459 | 449 | ||
460 | /* Stop outbound asap */ | 450 | /* Stop outbound asap */ |
461 | netif_tx_disable(net); | 451 | netif_tx_disable(net); |
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index f08c85acf761..5ac46f5226f3 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
@@ -40,6 +40,7 @@ MODULE_LICENSE("GPL"); | |||
40 | #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ | 40 | #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ |
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 | 44 | ||
44 | static int ip175c_config_init(struct phy_device *phydev) | 45 | static int ip175c_config_init(struct phy_device *phydev) |
45 | { | 46 | { |
@@ -185,6 +186,15 @@ static int ip175c_config_aneg(struct phy_device *phydev) | |||
185 | return 0; | 186 | return 0; |
186 | } | 187 | } |
187 | 188 | ||
189 | static int ip101a_g_ack_interrupt(struct phy_device *phydev) | ||
190 | { | ||
191 | int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS); | ||
192 | if (err < 0) | ||
193 | return err; | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
188 | static struct phy_driver ip175c_driver = { | 198 | static struct phy_driver ip175c_driver = { |
189 | .phy_id = 0x02430d80, | 199 | .phy_id = 0x02430d80, |
190 | .name = "ICPlus IP175C", | 200 | .name = "ICPlus IP175C", |
@@ -204,7 +214,6 @@ static struct phy_driver ip1001_driver = { | |||
204 | .phy_id_mask = 0x0ffffff0, | 214 | .phy_id_mask = 0x0ffffff0, |
205 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | | 215 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | |
206 | SUPPORTED_Asym_Pause, | 216 | SUPPORTED_Asym_Pause, |
207 | .flags = PHY_HAS_INTERRUPT, | ||
208 | .config_init = &ip1001_config_init, | 217 | .config_init = &ip1001_config_init, |
209 | .config_aneg = &genphy_config_aneg, | 218 | .config_aneg = &genphy_config_aneg, |
210 | .read_status = &genphy_read_status, | 219 | .read_status = &genphy_read_status, |
@@ -220,6 +229,7 @@ static struct phy_driver ip101a_g_driver = { | |||
220 | .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | | 229 | .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | |
221 | SUPPORTED_Asym_Pause, | 230 | SUPPORTED_Asym_Pause, |
222 | .flags = PHY_HAS_INTERRUPT, | 231 | .flags = PHY_HAS_INTERRUPT, |
232 | .ack_interrupt = ip101a_g_ack_interrupt, | ||
223 | .config_init = &ip101a_g_config_init, | 233 | .config_init = &ip101a_g_config_init, |
224 | .config_aneg = &genphy_config_aneg, | 234 | .config_aneg = &genphy_config_aneg, |
225 | .read_status = &genphy_read_status, | 235 | .read_status = &genphy_read_status, |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 33f8c51968b6..21d7151fb0ab 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
@@ -235,7 +235,7 @@ struct ppp_net { | |||
235 | /* Prototypes. */ | 235 | /* Prototypes. */ |
236 | static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, | 236 | static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf, |
237 | struct file *file, unsigned int cmd, unsigned long arg); | 237 | struct file *file, unsigned int cmd, unsigned long arg); |
238 | static int ppp_xmit_process(struct ppp *ppp); | 238 | static void ppp_xmit_process(struct ppp *ppp); |
239 | static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); | 239 | static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb); |
240 | static void ppp_push(struct ppp *ppp); | 240 | static void ppp_push(struct ppp *ppp); |
241 | static void ppp_channel_push(struct channel *pch); | 241 | static void ppp_channel_push(struct channel *pch); |
@@ -969,8 +969,7 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
969 | put_unaligned_be16(proto, pp); | 969 | put_unaligned_be16(proto, pp); |
970 | 970 | ||
971 | skb_queue_tail(&ppp->file.xq, skb); | 971 | skb_queue_tail(&ppp->file.xq, skb); |
972 | if (!ppp_xmit_process(ppp)) | 972 | ppp_xmit_process(ppp); |
973 | netif_stop_queue(dev); | ||
974 | return NETDEV_TX_OK; | 973 | return NETDEV_TX_OK; |
975 | 974 | ||
976 | outf: | 975 | outf: |
@@ -1048,11 +1047,10 @@ static void ppp_setup(struct net_device *dev) | |||
1048 | * Called to do any work queued up on the transmit side | 1047 | * Called to do any work queued up on the transmit side |
1049 | * that can now be done. | 1048 | * that can now be done. |
1050 | */ | 1049 | */ |
1051 | static int | 1050 | static void |
1052 | ppp_xmit_process(struct ppp *ppp) | 1051 | ppp_xmit_process(struct ppp *ppp) |
1053 | { | 1052 | { |
1054 | struct sk_buff *skb; | 1053 | struct sk_buff *skb; |
1055 | int ret = 0; | ||
1056 | 1054 | ||
1057 | ppp_xmit_lock(ppp); | 1055 | ppp_xmit_lock(ppp); |
1058 | if (!ppp->closing) { | 1056 | if (!ppp->closing) { |
@@ -1062,13 +1060,12 @@ ppp_xmit_process(struct ppp *ppp) | |||
1062 | ppp_send_frame(ppp, skb); | 1060 | ppp_send_frame(ppp, skb); |
1063 | /* If there's no work left to do, tell the core net | 1061 | /* If there's no work left to do, tell the core net |
1064 | code that we can accept some more. */ | 1062 | code that we can accept some more. */ |
1065 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) { | 1063 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) |
1066 | netif_wake_queue(ppp->dev); | 1064 | netif_wake_queue(ppp->dev); |
1067 | ret = 1; | 1065 | else |
1068 | } | 1066 | netif_stop_queue(ppp->dev); |
1069 | } | 1067 | } |
1070 | ppp_xmit_unlock(ppp); | 1068 | ppp_xmit_unlock(ppp); |
1071 | return ret; | ||
1072 | } | 1069 | } |
1073 | 1070 | ||
1074 | static inline struct sk_buff * | 1071 | static inline struct sk_buff * |
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 5ee032cafade..42b5151aa78a 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -355,7 +355,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
355 | u32 packet_len; | 355 | u32 packet_len; |
356 | u32 padbytes = 0xffff0000; | 356 | u32 padbytes = 0xffff0000; |
357 | 357 | ||
358 | padlen = ((skb->len + 4) % 512) ? 0 : 4; | 358 | padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4; |
359 | 359 | ||
360 | if ((!skb_cloned(skb)) && | 360 | if ((!skb_cloned(skb)) && |
361 | ((headroom + tailroom) >= (4 + padlen))) { | 361 | ((headroom + tailroom) >= (4 + padlen))) { |
@@ -377,7 +377,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb, | |||
377 | cpu_to_le32s(&packet_len); | 377 | cpu_to_le32s(&packet_len); |
378 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); | 378 | skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len)); |
379 | 379 | ||
380 | if ((skb->len % 512) == 0) { | 380 | if (padlen) { |
381 | cpu_to_le32s(&padbytes); | 381 | cpu_to_le32s(&padbytes); |
382 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); | 382 | memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes)); |
383 | skb_put(skb, sizeof(padbytes)); | 383 | skb_put(skb, sizeof(padbytes)); |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 552d24bf862e..d316503b35d4 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -365,6 +365,27 @@ static const struct driver_info qmi_wwan_force_int4 = { | |||
365 | .data = BIT(4), /* interface whitelist bitmap */ | 365 | .data = BIT(4), /* interface whitelist bitmap */ |
366 | }; | 366 | }; |
367 | 367 | ||
368 | /* Sierra Wireless provide equally useless interface descriptors | ||
369 | * Devices in QMI mode can be switched between two different | ||
370 | * configurations: | ||
371 | * a) USB interface #8 is QMI/wwan | ||
372 | * b) USB interfaces #8, #19 and #20 are QMI/wwan | ||
373 | * | ||
374 | * Both configurations provide a number of other interfaces (serial++), | ||
375 | * some of which have the same endpoint configuration as we expect, so | ||
376 | * a whitelist or blacklist is necessary. | ||
377 | * | ||
378 | * FIXME: The below whitelist should include BIT(20). It does not | ||
379 | * because I cannot get it to work... | ||
380 | */ | ||
381 | static const struct driver_info qmi_wwan_sierra = { | ||
382 | .description = "Sierra Wireless wwan/QMI device", | ||
383 | .flags = FLAG_WWAN, | ||
384 | .bind = qmi_wwan_bind_gobi, | ||
385 | .unbind = qmi_wwan_unbind_shared, | ||
386 | .manage_power = qmi_wwan_manage_power, | ||
387 | .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ | ||
388 | }; | ||
368 | 389 | ||
369 | #define HUAWEI_VENDOR_ID 0x12D1 | 390 | #define HUAWEI_VENDOR_ID 0x12D1 |
370 | #define QMI_GOBI_DEVICE(vend, prod) \ | 391 | #define QMI_GOBI_DEVICE(vend, prod) \ |
@@ -445,6 +466,15 @@ static const struct usb_device_id products[] = { | |||
445 | .bInterfaceProtocol = 0xff, | 466 | .bInterfaceProtocol = 0xff, |
446 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | 467 | .driver_info = (unsigned long)&qmi_wwan_force_int4, |
447 | }, | 468 | }, |
469 | { /* Sierra Wireless MC77xx in QMI mode */ | ||
470 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
471 | .idVendor = 0x1199, | ||
472 | .idProduct = 0x68a2, | ||
473 | .bInterfaceClass = 0xff, | ||
474 | .bInterfaceSubClass = 0xff, | ||
475 | .bInterfaceProtocol = 0xff, | ||
476 | .driver_info = (unsigned long)&qmi_wwan_sierra, | ||
477 | }, | ||
448 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 478 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
449 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ | 479 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
450 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ | 480 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 187d01ccb973..00103a8c5e04 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -98,7 +98,7 @@ static int __must_check smsc75xx_read_reg(struct usbnet *dev, u32 index, | |||
98 | 98 | ||
99 | if (unlikely(ret < 0)) | 99 | if (unlikely(ret < 0)) |
100 | netdev_warn(dev->net, | 100 | netdev_warn(dev->net, |
101 | "Failed to read register index 0x%08x", index); | 101 | "Failed to read reg index 0x%08x: %d", index, ret); |
102 | 102 | ||
103 | le32_to_cpus(buf); | 103 | le32_to_cpus(buf); |
104 | *data = *buf; | 104 | *data = *buf; |
@@ -128,7 +128,7 @@ static int __must_check smsc75xx_write_reg(struct usbnet *dev, u32 index, | |||
128 | 128 | ||
129 | if (unlikely(ret < 0)) | 129 | if (unlikely(ret < 0)) |
130 | netdev_warn(dev->net, | 130 | netdev_warn(dev->net, |
131 | "Failed to write register index 0x%08x", index); | 131 | "Failed to write reg index 0x%08x: %d", index, ret); |
132 | 132 | ||
133 | kfree(buf); | 133 | kfree(buf); |
134 | 134 | ||
@@ -171,7 +171,7 @@ static int smsc75xx_mdio_read(struct net_device *netdev, int phy_id, int idx) | |||
171 | idx &= dev->mii.reg_num_mask; | 171 | idx &= dev->mii.reg_num_mask; |
172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) | 172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) | 173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
174 | | MII_ACCESS_READ; | 174 | | MII_ACCESS_READ | MII_ACCESS_BUSY; |
175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); | 175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); | 176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
177 | 177 | ||
@@ -210,7 +210,7 @@ static void smsc75xx_mdio_write(struct net_device *netdev, int phy_id, int idx, | |||
210 | idx &= dev->mii.reg_num_mask; | 210 | idx &= dev->mii.reg_num_mask; |
211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) | 211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) | 212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
213 | | MII_ACCESS_WRITE; | 213 | | MII_ACCESS_WRITE | MII_ACCESS_BUSY; |
214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); | 214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); | 215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
216 | 216 | ||
@@ -508,9 +508,10 @@ static int smsc75xx_link_reset(struct usbnet *dev) | |||
508 | u16 lcladv, rmtadv; | 508 | u16 lcladv, rmtadv; |
509 | int ret; | 509 | int ret; |
510 | 510 | ||
511 | /* clear interrupt status */ | 511 | /* read and write to clear phy interrupt status */ |
512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); | 512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); |
513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); | 513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
514 | smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC, 0xffff); | ||
514 | 515 | ||
515 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); | 516 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); |
516 | check_warn_return(ret, "Error writing INT_STS"); | 517 | check_warn_return(ret, "Error writing INT_STS"); |
@@ -643,7 +644,7 @@ static int smsc75xx_set_mac_address(struct usbnet *dev) | |||
643 | 644 | ||
644 | static int smsc75xx_phy_initialize(struct usbnet *dev) | 645 | static int smsc75xx_phy_initialize(struct usbnet *dev) |
645 | { | 646 | { |
646 | int bmcr, timeout = 0; | 647 | int bmcr, ret, timeout = 0; |
647 | 648 | ||
648 | /* Initialize MII structure */ | 649 | /* Initialize MII structure */ |
649 | dev->mii.dev = dev->net; | 650 | dev->mii.dev = dev->net; |
@@ -651,6 +652,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
651 | dev->mii.mdio_write = smsc75xx_mdio_write; | 652 | dev->mii.mdio_write = smsc75xx_mdio_write; |
652 | dev->mii.phy_id_mask = 0x1f; | 653 | dev->mii.phy_id_mask = 0x1f; |
653 | dev->mii.reg_num_mask = 0x1f; | 654 | dev->mii.reg_num_mask = 0x1f; |
655 | dev->mii.supports_gmii = 1; | ||
654 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; | 656 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; |
655 | 657 | ||
656 | /* reset phy and wait for reset to complete */ | 658 | /* reset phy and wait for reset to complete */ |
@@ -661,7 +663,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
661 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); | 663 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); |
662 | check_warn_return(bmcr, "Error reading MII_BMCR"); | 664 | check_warn_return(bmcr, "Error reading MII_BMCR"); |
663 | timeout++; | 665 | timeout++; |
664 | } while ((bmcr & MII_BMCR) && (timeout < 100)); | 666 | } while ((bmcr & BMCR_RESET) && (timeout < 100)); |
665 | 667 | ||
666 | if (timeout >= 100) { | 668 | if (timeout >= 100) { |
667 | netdev_warn(dev->net, "timeout on PHY Reset"); | 669 | netdev_warn(dev->net, "timeout on PHY Reset"); |
@@ -671,10 +673,13 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
671 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, | 673 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, |
672 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | | 674 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | |
673 | ADVERTISE_PAUSE_ASYM); | 675 | ADVERTISE_PAUSE_ASYM); |
676 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000, | ||
677 | ADVERTISE_1000FULL); | ||
674 | 678 | ||
675 | /* read to clear */ | 679 | /* read and write to clear phy interrupt status */ |
676 | smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); | 680 | ret = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); |
677 | check_warn_return(bmcr, "Error reading PHY_INT_SRC"); | 681 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
682 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_SRC, 0xffff); | ||
678 | 683 | ||
679 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, | 684 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, |
680 | PHY_INT_MASK_DEFAULT); | 685 | PHY_INT_MASK_DEFAULT); |
@@ -946,6 +951,14 @@ static int smsc75xx_reset(struct usbnet *dev) | |||
946 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); | 951 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); |
947 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); | 952 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); |
948 | 953 | ||
954 | /* allow mac to detect speed and duplex from phy */ | ||
955 | ret = smsc75xx_read_reg(dev, MAC_CR, &buf); | ||
956 | check_warn_return(ret, "Failed to read MAC_CR: %d", ret); | ||
957 | |||
958 | buf |= (MAC_CR_ADD | MAC_CR_ASD); | ||
959 | ret = smsc75xx_write_reg(dev, MAC_CR, buf); | ||
960 | check_warn_return(ret, "Failed to write MAC_CR: %d", ret); | ||
961 | |||
949 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); | 962 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); |
950 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); | 963 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); |
951 | 964 | ||
@@ -1051,6 +1064,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1051 | dev->net->ethtool_ops = &smsc75xx_ethtool_ops; | 1064 | dev->net->ethtool_ops = &smsc75xx_ethtool_ops; |
1052 | dev->net->flags |= IFF_MULTICAST; | 1065 | dev->net->flags |= IFF_MULTICAST; |
1053 | dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD; | 1066 | dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD; |
1067 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
1054 | return 0; | 1068 | return 0; |
1055 | } | 1069 | } |
1056 | 1070 | ||
@@ -1211,7 +1225,7 @@ static const struct driver_info smsc75xx_info = { | |||
1211 | .rx_fixup = smsc75xx_rx_fixup, | 1225 | .rx_fixup = smsc75xx_rx_fixup, |
1212 | .tx_fixup = smsc75xx_tx_fixup, | 1226 | .tx_fixup = smsc75xx_tx_fixup, |
1213 | .status = smsc75xx_status, | 1227 | .status = smsc75xx_status, |
1214 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1228 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
1215 | }; | 1229 | }; |
1216 | 1230 | ||
1217 | static const struct usb_device_id products[] = { | 1231 | static const struct usb_device_id products[] = { |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 5f19f84d3494..94ae66999f59 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -1017,6 +1017,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; | 1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; |
1018 | dev->net->flags |= IFF_MULTICAST; | 1018 | dev->net->flags |= IFF_MULTICAST; |
1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; | 1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; |
1020 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
1020 | return 0; | 1021 | return 0; |
1021 | } | 1022 | } |
1022 | 1023 | ||
@@ -1191,7 +1192,7 @@ static const struct driver_info smsc95xx_info = { | |||
1191 | .rx_fixup = smsc95xx_rx_fixup, | 1192 | .rx_fixup = smsc95xx_rx_fixup, |
1192 | .tx_fixup = smsc95xx_tx_fixup, | 1193 | .tx_fixup = smsc95xx_tx_fixup, |
1193 | .status = smsc95xx_status, | 1194 | .status = smsc95xx_status, |
1194 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1195 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
1195 | }; | 1196 | }; |
1196 | 1197 | ||
1197 | static const struct usb_device_id products[] = { | 1198 | static const struct usb_device_id products[] = { |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index b7b3f5b0d406..2d927fb4adf4 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf) | |||
210 | } else { | 210 | } else { |
211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, | 211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, |
212 | buf, maxp, intr_complete, dev, period); | 212 | buf, maxp, intr_complete, dev, period); |
213 | dev->interrupt->transfer_flags |= URB_FREE_BUFFER; | ||
213 | dev_dbg(&intf->dev, | 214 | dev_dbg(&intf->dev, |
214 | "status ep%din, %d bytes period %d\n", | 215 | "status ep%din, %d bytes period %d\n", |
215 | usb_pipeendpoint(pipe), maxp, period); | 216 | usb_pipeendpoint(pipe), maxp, period); |
@@ -1443,7 +1444,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1443 | 1444 | ||
1444 | status = register_netdev (net); | 1445 | status = register_netdev (net); |
1445 | if (status) | 1446 | if (status) |
1446 | goto out3; | 1447 | goto out4; |
1447 | netif_info(dev, probe, dev->net, | 1448 | netif_info(dev, probe, dev->net, |
1448 | "register '%s' at usb-%s-%s, %s, %pM\n", | 1449 | "register '%s' at usb-%s-%s, %s, %pM\n", |
1449 | udev->dev.driver->name, | 1450 | udev->dev.driver->name, |
@@ -1461,6 +1462,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1461 | 1462 | ||
1462 | return 0; | 1463 | return 0; |
1463 | 1464 | ||
1465 | out4: | ||
1466 | usb_free_urb(dev->interrupt); | ||
1464 | out3: | 1467 | out3: |
1465 | if (info->unbind) | 1468 | if (info->unbind) |
1466 | info->unbind (dev, udev); | 1469 | info->unbind (dev, udev); |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 4de2760c5937..af8acc85f4bb 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -626,16 +626,15 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
626 | /* This can happen with OOM and indirect buffers. */ | 626 | /* This can happen with OOM and indirect buffers. */ |
627 | if (unlikely(capacity < 0)) { | 627 | if (unlikely(capacity < 0)) { |
628 | if (likely(capacity == -ENOMEM)) { | 628 | if (likely(capacity == -ENOMEM)) { |
629 | if (net_ratelimit()) { | 629 | if (net_ratelimit()) |
630 | dev_warn(&dev->dev, | 630 | dev_warn(&dev->dev, |
631 | "TX queue failure: out of memory\n"); | 631 | "TX queue failure: out of memory\n"); |
632 | } else { | 632 | } else { |
633 | dev->stats.tx_fifo_errors++; | 633 | dev->stats.tx_fifo_errors++; |
634 | if (net_ratelimit()) | 634 | if (net_ratelimit()) |
635 | dev_warn(&dev->dev, | 635 | dev_warn(&dev->dev, |
636 | "Unexpected TX queue failure: %d\n", | 636 | "Unexpected TX queue failure: %d\n", |
637 | capacity); | 637 | capacity); |
638 | } | ||
639 | } | 638 | } |
640 | dev->stats.tx_dropped++; | 639 | dev->stats.tx_dropped++; |
641 | kfree_skb(skb); | 640 | kfree_skb(skb); |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index ebb9f24eefb5..1a623183cbe5 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -2483,6 +2483,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2483 | pr_err("Control memory remap failed\n"); | 2483 | pr_err("Control memory remap failed\n"); |
2484 | pci_release_regions(pdev); | 2484 | pci_release_regions(pdev); |
2485 | pci_disable_device(pdev); | 2485 | pci_disable_device(pdev); |
2486 | iounmap(card->mem); | ||
2486 | kfree(card); | 2487 | kfree(card); |
2487 | return -ENODEV; | 2488 | return -ENODEV; |
2488 | } | 2489 | } |
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index 8faa129da5a0..aec33cc207fd 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/nl80211.h> | 19 | #include <linux/nl80211.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/etherdevice.h> | 21 | #include <linux/etherdevice.h> |
22 | #include <linux/export.h> | ||
22 | #include <ar231x_platform.h> | 23 | #include <ar231x_platform.h> |
23 | #include "ath5k.h" | 24 | #include "ath5k.h" |
24 | #include "debug.h" | 25 | #include "debug.h" |
@@ -119,7 +120,7 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
119 | if (res == NULL) { | 120 | if (res == NULL) { |
120 | dev_err(&pdev->dev, "no IRQ resource found\n"); | 121 | dev_err(&pdev->dev, "no IRQ resource found\n"); |
121 | ret = -ENXIO; | 122 | ret = -ENXIO; |
122 | goto err_out; | 123 | goto err_iounmap; |
123 | } | 124 | } |
124 | 125 | ||
125 | irq = res->start; | 126 | irq = res->start; |
@@ -128,7 +129,7 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
128 | if (hw == NULL) { | 129 | if (hw == NULL) { |
129 | dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); | 130 | dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); |
130 | ret = -ENOMEM; | 131 | ret = -ENOMEM; |
131 | goto err_out; | 132 | goto err_iounmap; |
132 | } | 133 | } |
133 | 134 | ||
134 | ah = hw->priv; | 135 | ah = hw->priv; |
@@ -185,6 +186,8 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
185 | err_free_hw: | 186 | err_free_hw: |
186 | ieee80211_free_hw(hw); | 187 | ieee80211_free_hw(hw); |
187 | platform_set_drvdata(pdev, NULL); | 188 | platform_set_drvdata(pdev, NULL); |
189 | err_iounmap: | ||
190 | iounmap(mem); | ||
188 | err_out: | 191 | err_out: |
189 | return ret; | 192 | return ret; |
190 | } | 193 | } |
@@ -217,6 +220,7 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
217 | } | 220 | } |
218 | 221 | ||
219 | ath5k_deinit_ah(ah); | 222 | ath5k_deinit_ah(ah); |
223 | iounmap(ah->iobase); | ||
220 | platform_set_drvdata(pdev, NULL); | 224 | platform_set_drvdata(pdev, NULL); |
221 | ieee80211_free_hw(hw); | 225 | ieee80211_free_hw(hw); |
222 | 226 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index d7d8e9199140..aba088005b22 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -869,7 +869,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
869 | ar5008_hw_set_channel_regs(ah, chan); | 869 | ar5008_hw_set_channel_regs(ah, chan); |
870 | ar5008_hw_init_chain_masks(ah); | 870 | ar5008_hw_init_chain_masks(ah); |
871 | ath9k_olc_init(ah); | 871 | ath9k_olc_init(ah); |
872 | ath9k_hw_apply_txpower(ah, chan); | 872 | ath9k_hw_apply_txpower(ah, chan, false); |
873 | 873 | ||
874 | /* Write analog registers */ | 874 | /* Write analog registers */ |
875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { | 875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c index 59647a3ceb7f..3d400e8d6535 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c | |||
@@ -54,7 +54,7 @@ void ar9003_paprd_enable(struct ath_hw *ah, bool val) | |||
54 | 54 | ||
55 | if (val) { | 55 | if (val) { |
56 | ah->paprd_table_write_done = true; | 56 | ah->paprd_table_write_done = true; |
57 | ath9k_hw_apply_txpower(ah, chan); | 57 | ath9k_hw_apply_txpower(ah, chan, false); |
58 | } | 58 | } |
59 | 59 | ||
60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, | 60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index bc992b237ae5..deb6cfb2959a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -694,7 +694,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, | |||
694 | ar9003_hw_override_ini(ah); | 694 | ar9003_hw_override_ini(ah); |
695 | ar9003_hw_set_channel_regs(ah, chan); | 695 | ar9003_hw_set_channel_regs(ah, chan); |
696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | 696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
697 | ath9k_hw_apply_txpower(ah, chan); | 697 | ath9k_hw_apply_txpower(ah, chan, false); |
698 | 698 | ||
699 | if (AR_SREV_9462(ah)) { | 699 | if (AR_SREV_9462(ah)) { |
700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, | 700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index f272236d8053..b34e8b2990b1 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -824,6 +824,8 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, | |||
824 | regulatory->max_power_level = ratesArray[i]; | 824 | regulatory->max_power_level = ratesArray[i]; |
825 | } | 825 | } |
826 | 826 | ||
827 | ath9k_hw_update_regulatory_maxpower(ah); | ||
828 | |||
827 | if (test) | 829 | if (test) |
828 | return; | 830 | return; |
829 | 831 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 6c69e4e8b1cb..fa84e37bf091 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1454,7 +1454,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1454 | return false; | 1454 | return false; |
1455 | } | 1455 | } |
1456 | ath9k_hw_set_clockrate(ah); | 1456 | ath9k_hw_set_clockrate(ah); |
1457 | ath9k_hw_apply_txpower(ah, chan); | 1457 | ath9k_hw_apply_txpower(ah, chan, false); |
1458 | ath9k_hw_rfbus_done(ah); | 1458 | ath9k_hw_rfbus_done(ah); |
1459 | 1459 | ||
1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) | 1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) |
@@ -2652,7 +2652,8 @@ static int get_antenna_gain(struct ath_hw *ah, struct ath9k_channel *chan) | |||
2652 | return ah->eep_ops->get_eeprom(ah, gain_param); | 2652 | return ah->eep_ops->get_eeprom(ah, gain_param); |
2653 | } | 2653 | } |
2654 | 2654 | ||
2655 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | 2655 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
2656 | bool test) | ||
2656 | { | 2657 | { |
2657 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); | 2658 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); |
2658 | struct ieee80211_channel *channel; | 2659 | struct ieee80211_channel *channel; |
@@ -2673,7 +2674,7 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | |||
2673 | 2674 | ||
2674 | ah->eep_ops->set_txpower(ah, chan, | 2675 | ah->eep_ops->set_txpower(ah, chan, |
2675 | ath9k_regd_get_ctl(reg, chan), | 2676 | ath9k_regd_get_ctl(reg, chan), |
2676 | ant_reduction, new_pwr, false); | 2677 | ant_reduction, new_pwr, test); |
2677 | } | 2678 | } |
2678 | 2679 | ||
2679 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | 2680 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) |
@@ -2686,7 +2687,7 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | |||
2686 | if (test) | 2687 | if (test) |
2687 | channel->max_power = MAX_RATE_POWER / 2; | 2688 | channel->max_power = MAX_RATE_POWER / 2; |
2688 | 2689 | ||
2689 | ath9k_hw_apply_txpower(ah, chan); | 2690 | ath9k_hw_apply_txpower(ah, chan, test); |
2690 | 2691 | ||
2691 | if (test) | 2692 | if (test) |
2692 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); | 2693 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index aa1680a0c7fd..e88f182ff45c 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -985,7 +985,8 @@ void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); | |||
985 | /* PHY */ | 985 | /* PHY */ |
986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, | 986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, |
987 | u32 *coef_mantissa, u32 *coef_exponent); | 987 | u32 *coef_mantissa, u32 *coef_exponent); |
988 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan); | 988 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
989 | bool test); | ||
989 | 990 | ||
990 | /* | 991 | /* |
991 | * Code Specific to AR5008, AR9001 or AR9002, | 992 | * Code Specific to AR5008, AR9001 or AR9002, |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 2504ab005589..798ea57252b4 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1548,6 +1548,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1548 | struct ath_hw *ah = sc->sc_ah; | 1548 | struct ath_hw *ah = sc->sc_ah; |
1549 | struct ath_common *common = ath9k_hw_common(ah); | 1549 | struct ath_common *common = ath9k_hw_common(ah); |
1550 | struct ieee80211_conf *conf = &hw->conf; | 1550 | struct ieee80211_conf *conf = &hw->conf; |
1551 | bool reset_channel = false; | ||
1551 | 1552 | ||
1552 | ath9k_ps_wakeup(sc); | 1553 | ath9k_ps_wakeup(sc); |
1553 | mutex_lock(&sc->mutex); | 1554 | mutex_lock(&sc->mutex); |
@@ -1556,6 +1557,12 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1556 | sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); | 1557 | sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); |
1557 | if (sc->ps_idle) | 1558 | if (sc->ps_idle) |
1558 | ath_cancel_work(sc); | 1559 | ath_cancel_work(sc); |
1560 | else | ||
1561 | /* | ||
1562 | * The chip needs a reset to properly wake up from | ||
1563 | * full sleep | ||
1564 | */ | ||
1565 | reset_channel = ah->chip_fullsleep; | ||
1559 | } | 1566 | } |
1560 | 1567 | ||
1561 | /* | 1568 | /* |
@@ -1584,7 +1591,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1584 | } | 1591 | } |
1585 | } | 1592 | } |
1586 | 1593 | ||
1587 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 1594 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) { |
1588 | struct ieee80211_channel *curchan = hw->conf.channel; | 1595 | struct ieee80211_channel *curchan = hw->conf.channel; |
1589 | int pos = curchan->hw_value; | 1596 | int pos = curchan->hw_value; |
1590 | int old_pos = -1; | 1597 | int old_pos = -1; |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 834e6bc45e8b..23eaa1b26ebe 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1820,6 +1820,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | |||
1820 | struct ath_frame_info *fi = get_frame_info(skb); | 1820 | struct ath_frame_info *fi = get_frame_info(skb); |
1821 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1821 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1822 | struct ath_buf *bf; | 1822 | struct ath_buf *bf; |
1823 | int fragno; | ||
1823 | u16 seqno; | 1824 | u16 seqno; |
1824 | 1825 | ||
1825 | bf = ath_tx_get_buffer(sc); | 1826 | bf = ath_tx_get_buffer(sc); |
@@ -1831,9 +1832,16 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | |||
1831 | ATH_TXBUF_RESET(bf); | 1832 | ATH_TXBUF_RESET(bf); |
1832 | 1833 | ||
1833 | if (tid) { | 1834 | if (tid) { |
1835 | fragno = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; | ||
1834 | seqno = tid->seq_next; | 1836 | seqno = tid->seq_next; |
1835 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); | 1837 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); |
1836 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | 1838 | |
1839 | if (fragno) | ||
1840 | hdr->seq_ctrl |= cpu_to_le16(fragno); | ||
1841 | |||
1842 | if (!ieee80211_has_morefrags(hdr->frame_control)) | ||
1843 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | ||
1844 | |||
1837 | bf->bf_state.seqno = seqno; | 1845 | bf->bf_state.seqno = seqno; |
1838 | } | 1846 | } |
1839 | 1847 | ||
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index c79e6638c88d..e4d6dc2e37d1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -4827,8 +4827,14 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4827 | out_mutex_unlock: | 4827 | out_mutex_unlock: |
4828 | mutex_unlock(&wl->mutex); | 4828 | mutex_unlock(&wl->mutex); |
4829 | 4829 | ||
4830 | /* reload configuration */ | 4830 | /* |
4831 | b43_op_config(hw, ~0); | 4831 | * Configuration may have been overwritten during initialization. |
4832 | * Reload the configuration, but only if initialization was | ||
4833 | * successful. Reloading the configuration after a failed init | ||
4834 | * may hang the system. | ||
4835 | */ | ||
4836 | if (!err) | ||
4837 | b43_op_config(hw, ~0); | ||
4832 | 4838 | ||
4833 | return err; | 4839 | return err; |
4834 | } | 4840 | } |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 4688904908ec..758c115b556e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
@@ -108,9 +108,15 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, | |||
108 | sdio_release_host(sdfunc); | 108 | sdio_release_host(sdfunc); |
109 | } | 109 | } |
110 | } else if (regaddr == SDIO_CCCR_ABORT) { | 110 | } else if (regaddr == SDIO_CCCR_ABORT) { |
111 | sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func), | ||
112 | GFP_KERNEL); | ||
113 | if (!sdfunc) | ||
114 | return -ENOMEM; | ||
115 | sdfunc->num = 0; | ||
111 | sdio_claim_host(sdfunc); | 116 | sdio_claim_host(sdfunc); |
112 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); | 117 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); |
113 | sdio_release_host(sdfunc); | 118 | sdio_release_host(sdfunc); |
119 | kfree(sdfunc); | ||
114 | } else if (regaddr < 0xF0) { | 120 | } else if (regaddr < 0xF0) { |
115 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); | 121 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); |
116 | err_ret = -EPERM; | 122 | err_ret = -EPERM; |
@@ -486,7 +492,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, | |||
486 | kfree(bus_if); | 492 | kfree(bus_if); |
487 | return -ENOMEM; | 493 | return -ENOMEM; |
488 | } | 494 | } |
489 | sdiodev->func[0] = func->card->sdio_func[0]; | 495 | sdiodev->func[0] = func; |
490 | sdiodev->func[1] = func; | 496 | sdiodev->func[1] = func; |
491 | sdiodev->bus_if = bus_if; | 497 | sdiodev->bus_if = bus_if; |
492 | bus_if->bus_priv.sdio = sdiodev; | 498 | bus_if->bus_priv.sdio = sdiodev; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 2bf5dda29291..eb3829b03cd3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -574,6 +574,8 @@ struct brcmf_sdio { | |||
574 | 574 | ||
575 | struct task_struct *dpc_tsk; | 575 | struct task_struct *dpc_tsk; |
576 | struct completion dpc_wait; | 576 | struct completion dpc_wait; |
577 | struct list_head dpc_tsklst; | ||
578 | spinlock_t dpc_tl_lock; | ||
577 | 579 | ||
578 | struct semaphore sdsem; | 580 | struct semaphore sdsem; |
579 | 581 | ||
@@ -2594,29 +2596,58 @@ clkwait: | |||
2594 | return resched; | 2596 | return resched; |
2595 | } | 2597 | } |
2596 | 2598 | ||
2599 | static inline void brcmf_sdbrcm_adddpctsk(struct brcmf_sdio *bus) | ||
2600 | { | ||
2601 | struct list_head *new_hd; | ||
2602 | unsigned long flags; | ||
2603 | |||
2604 | if (in_interrupt()) | ||
2605 | new_hd = kzalloc(sizeof(struct list_head), GFP_ATOMIC); | ||
2606 | else | ||
2607 | new_hd = kzalloc(sizeof(struct list_head), GFP_KERNEL); | ||
2608 | if (new_hd == NULL) | ||
2609 | return; | ||
2610 | |||
2611 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
2612 | list_add_tail(new_hd, &bus->dpc_tsklst); | ||
2613 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
2614 | } | ||
2615 | |||
2597 | static int brcmf_sdbrcm_dpc_thread(void *data) | 2616 | static int brcmf_sdbrcm_dpc_thread(void *data) |
2598 | { | 2617 | { |
2599 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; | 2618 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; |
2619 | struct list_head *cur_hd, *tmp_hd; | ||
2620 | unsigned long flags; | ||
2600 | 2621 | ||
2601 | allow_signal(SIGTERM); | 2622 | allow_signal(SIGTERM); |
2602 | /* Run until signal received */ | 2623 | /* Run until signal received */ |
2603 | while (1) { | 2624 | while (1) { |
2604 | if (kthread_should_stop()) | 2625 | if (kthread_should_stop()) |
2605 | break; | 2626 | break; |
2606 | if (!wait_for_completion_interruptible(&bus->dpc_wait)) { | 2627 | |
2607 | /* Call bus dpc unless it indicated down | 2628 | if (list_empty(&bus->dpc_tsklst)) |
2608 | (then clean stop) */ | 2629 | if (wait_for_completion_interruptible(&bus->dpc_wait)) |
2609 | if (bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN) { | 2630 | break; |
2610 | if (brcmf_sdbrcm_dpc(bus)) | 2631 | |
2611 | complete(&bus->dpc_wait); | 2632 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); |
2612 | } else { | 2633 | list_for_each_safe(cur_hd, tmp_hd, &bus->dpc_tsklst) { |
2634 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
2635 | |||
2636 | if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { | ||
2613 | /* after stopping the bus, exit thread */ | 2637 | /* after stopping the bus, exit thread */ |
2614 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); | 2638 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); |
2615 | bus->dpc_tsk = NULL; | 2639 | bus->dpc_tsk = NULL; |
2616 | break; | 2640 | break; |
2617 | } | 2641 | } |
2618 | } else | 2642 | |
2619 | break; | 2643 | if (brcmf_sdbrcm_dpc(bus)) |
2644 | brcmf_sdbrcm_adddpctsk(bus); | ||
2645 | |||
2646 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
2647 | list_del(cur_hd); | ||
2648 | kfree(cur_hd); | ||
2649 | } | ||
2650 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
2620 | } | 2651 | } |
2621 | return 0; | 2652 | return 0; |
2622 | } | 2653 | } |
@@ -2669,8 +2700,10 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) | |||
2669 | /* Schedule DPC if needed to send queued packet(s) */ | 2700 | /* Schedule DPC if needed to send queued packet(s) */ |
2670 | if (!bus->dpc_sched) { | 2701 | if (!bus->dpc_sched) { |
2671 | bus->dpc_sched = true; | 2702 | bus->dpc_sched = true; |
2672 | if (bus->dpc_tsk) | 2703 | if (bus->dpc_tsk) { |
2704 | brcmf_sdbrcm_adddpctsk(bus); | ||
2673 | complete(&bus->dpc_wait); | 2705 | complete(&bus->dpc_wait); |
2706 | } | ||
2674 | } | 2707 | } |
2675 | 2708 | ||
2676 | return ret; | 2709 | return ret; |
@@ -3514,8 +3547,10 @@ void brcmf_sdbrcm_isr(void *arg) | |||
3514 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); | 3547 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); |
3515 | 3548 | ||
3516 | bus->dpc_sched = true; | 3549 | bus->dpc_sched = true; |
3517 | if (bus->dpc_tsk) | 3550 | if (bus->dpc_tsk) { |
3551 | brcmf_sdbrcm_adddpctsk(bus); | ||
3518 | complete(&bus->dpc_wait); | 3552 | complete(&bus->dpc_wait); |
3553 | } | ||
3519 | } | 3554 | } |
3520 | 3555 | ||
3521 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | 3556 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) |
@@ -3559,8 +3594,10 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | |||
3559 | bus->ipend = true; | 3594 | bus->ipend = true; |
3560 | 3595 | ||
3561 | bus->dpc_sched = true; | 3596 | bus->dpc_sched = true; |
3562 | if (bus->dpc_tsk) | 3597 | if (bus->dpc_tsk) { |
3598 | brcmf_sdbrcm_adddpctsk(bus); | ||
3563 | complete(&bus->dpc_wait); | 3599 | complete(&bus->dpc_wait); |
3600 | } | ||
3564 | } | 3601 | } |
3565 | } | 3602 | } |
3566 | 3603 | ||
@@ -3897,6 +3934,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3897 | } | 3934 | } |
3898 | /* Initialize DPC thread */ | 3935 | /* Initialize DPC thread */ |
3899 | init_completion(&bus->dpc_wait); | 3936 | init_completion(&bus->dpc_wait); |
3937 | INIT_LIST_HEAD(&bus->dpc_tsklst); | ||
3938 | spin_lock_init(&bus->dpc_tl_lock); | ||
3900 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, | 3939 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, |
3901 | bus, "brcmf_dpc"); | 3940 | bus, "brcmf_dpc"); |
3902 | if (IS_ERR(bus->dpc_tsk)) { | 3941 | if (IS_ERR(bus->dpc_tsk)) { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 231ddf4a674f..b4d92792c502 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
@@ -847,8 +847,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
847 | */ | 847 | */ |
848 | if (!(txs->status & TX_STATUS_AMPDU) | 848 | if (!(txs->status & TX_STATUS_AMPDU) |
849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { | 849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { |
850 | wiphy_err(wlc->wiphy, "%s: INTERMEDIATE but not AMPDU\n", | 850 | BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n"); |
851 | __func__); | ||
852 | return false; | 851 | return false; |
853 | } | 852 | } |
854 | 853 | ||
@@ -7614,6 +7613,7 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7614 | { | 7613 | { |
7615 | int len_mpdu; | 7614 | int len_mpdu; |
7616 | struct ieee80211_rx_status rx_status; | 7615 | struct ieee80211_rx_status rx_status; |
7616 | struct ieee80211_hdr *hdr; | ||
7617 | 7617 | ||
7618 | memset(&rx_status, 0, sizeof(rx_status)); | 7618 | memset(&rx_status, 0, sizeof(rx_status)); |
7619 | prep_mac80211_status(wlc, rxh, p, &rx_status); | 7619 | prep_mac80211_status(wlc, rxh, p, &rx_status); |
@@ -7623,6 +7623,13 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7623 | skb_pull(p, D11_PHY_HDR_LEN); | 7623 | skb_pull(p, D11_PHY_HDR_LEN); |
7624 | __skb_trim(p, len_mpdu); | 7624 | __skb_trim(p, len_mpdu); |
7625 | 7625 | ||
7626 | /* unmute transmit */ | ||
7627 | if (wlc->hw->suspended_fifos) { | ||
7628 | hdr = (struct ieee80211_hdr *)p->data; | ||
7629 | if (ieee80211_is_beacon(hdr->frame_control)) | ||
7630 | brcms_b_mute(wlc->hw, false); | ||
7631 | } | ||
7632 | |||
7626 | memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); | 7633 | memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); |
7627 | ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); | 7634 | ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); |
7628 | } | 7635 | } |
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 2b022571a859..1779db3aa2b0 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -2191,6 +2191,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
2191 | { | 2191 | { |
2192 | int rc = 0; | 2192 | int rc = 0; |
2193 | unsigned long flags; | 2193 | unsigned long flags; |
2194 | unsigned long now, end; | ||
2194 | 2195 | ||
2195 | spin_lock_irqsave(&priv->lock, flags); | 2196 | spin_lock_irqsave(&priv->lock, flags); |
2196 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2197 | if (priv->status & STATUS_HCMD_ACTIVE) { |
@@ -2232,10 +2233,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
2232 | } | 2233 | } |
2233 | spin_unlock_irqrestore(&priv->lock, flags); | 2234 | spin_unlock_irqrestore(&priv->lock, flags); |
2234 | 2235 | ||
2236 | now = jiffies; | ||
2237 | end = now + HOST_COMPLETE_TIMEOUT; | ||
2238 | again: | ||
2235 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, | 2239 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
2236 | !(priv-> | 2240 | !(priv-> |
2237 | status & STATUS_HCMD_ACTIVE), | 2241 | status & STATUS_HCMD_ACTIVE), |
2238 | HOST_COMPLETE_TIMEOUT); | 2242 | end - now); |
2243 | if (rc < 0) { | ||
2244 | now = jiffies; | ||
2245 | if (time_before(now, end)) | ||
2246 | goto again; | ||
2247 | rc = 0; | ||
2248 | } | ||
2249 | |||
2239 | if (rc == 0) { | 2250 | if (rc == 0) { |
2240 | spin_lock_irqsave(&priv->lock, flags); | 2251 | spin_lock_irqsave(&priv->lock, flags); |
2241 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2252 | if (priv->status & STATUS_HCMD_ACTIVE) { |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 5b0d888f746b..8d80e233bc7a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include "iwl-prph.h" | 46 | #include "iwl-prph.h" |
47 | 47 | ||
48 | /* Highest firmware API version supported */ | 48 | /* Highest firmware API version supported */ |
49 | #define IWL1000_UCODE_API_MAX 6 | 49 | #define IWL1000_UCODE_API_MAX 5 |
50 | #define IWL100_UCODE_API_MAX 6 | 50 | #define IWL100_UCODE_API_MAX 5 |
51 | 51 | ||
52 | /* Oldest version we won't warn about */ | 52 | /* Oldest version we won't warn about */ |
53 | #define IWL1000_UCODE_API_OK 5 | 53 | #define IWL1000_UCODE_API_OK 5 |
@@ -226,5 +226,5 @@ const struct iwl_cfg iwl100_bg_cfg = { | |||
226 | IWL_DEVICE_100, | 226 | IWL_DEVICE_100, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | 229 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK)); |
230 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX)); | 230 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 5635b9e2c69e..ea108622e0bd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
@@ -51,10 +51,10 @@ | |||
51 | #define IWL135_UCODE_API_MAX 6 | 51 | #define IWL135_UCODE_API_MAX 6 |
52 | 52 | ||
53 | /* Oldest version we won't warn about */ | 53 | /* Oldest version we won't warn about */ |
54 | #define IWL2030_UCODE_API_OK 5 | 54 | #define IWL2030_UCODE_API_OK 6 |
55 | #define IWL2000_UCODE_API_OK 5 | 55 | #define IWL2000_UCODE_API_OK 6 |
56 | #define IWL105_UCODE_API_OK 5 | 56 | #define IWL105_UCODE_API_OK 6 |
57 | #define IWL135_UCODE_API_OK 5 | 57 | #define IWL135_UCODE_API_OK 6 |
58 | 58 | ||
59 | /* Lowest firmware API version supported */ | 59 | /* Lowest firmware API version supported */ |
60 | #define IWL2030_UCODE_API_MIN 5 | 60 | #define IWL2030_UCODE_API_MIN 5 |
@@ -328,7 +328,7 @@ const struct iwl_cfg iwl135_bgn_cfg = { | |||
328 | .ht_params = &iwl2000_ht_params, | 328 | .ht_params = &iwl2000_ht_params, |
329 | }; | 329 | }; |
330 | 330 | ||
331 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX)); | 331 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK)); |
332 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX)); | 332 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK)); |
333 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX)); | 333 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK)); |
334 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX)); | 334 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index a805e97b89af..de0920c74cdd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -51,6 +51,10 @@ | |||
51 | #define IWL5000_UCODE_API_MAX 5 | 51 | #define IWL5000_UCODE_API_MAX 5 |
52 | #define IWL5150_UCODE_API_MAX 2 | 52 | #define IWL5150_UCODE_API_MAX 2 |
53 | 53 | ||
54 | /* Oldest version we won't warn about */ | ||
55 | #define IWL5000_UCODE_API_OK 5 | ||
56 | #define IWL5150_UCODE_API_OK 2 | ||
57 | |||
54 | /* Lowest firmware API version supported */ | 58 | /* Lowest firmware API version supported */ |
55 | #define IWL5000_UCODE_API_MIN 1 | 59 | #define IWL5000_UCODE_API_MIN 1 |
56 | #define IWL5150_UCODE_API_MIN 1 | 60 | #define IWL5150_UCODE_API_MIN 1 |
@@ -326,6 +330,7 @@ static const struct iwl_ht_params iwl5000_ht_params = { | |||
326 | #define IWL_DEVICE_5000 \ | 330 | #define IWL_DEVICE_5000 \ |
327 | .fw_name_pre = IWL5000_FW_PRE, \ | 331 | .fw_name_pre = IWL5000_FW_PRE, \ |
328 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ | 332 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ |
333 | .ucode_api_ok = IWL5000_UCODE_API_OK, \ | ||
329 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ | 334 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ |
330 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 335 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
331 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ | 336 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
@@ -371,6 +376,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
371 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", | 376 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", |
372 | .fw_name_pre = IWL5000_FW_PRE, | 377 | .fw_name_pre = IWL5000_FW_PRE, |
373 | .ucode_api_max = IWL5000_UCODE_API_MAX, | 378 | .ucode_api_max = IWL5000_UCODE_API_MAX, |
379 | .ucode_api_ok = IWL5000_UCODE_API_OK, | ||
374 | .ucode_api_min = IWL5000_UCODE_API_MIN, | 380 | .ucode_api_min = IWL5000_UCODE_API_MIN, |
375 | .max_inst_size = IWLAGN_RTC_INST_SIZE, | 381 | .max_inst_size = IWLAGN_RTC_INST_SIZE, |
376 | .max_data_size = IWLAGN_RTC_DATA_SIZE, | 382 | .max_data_size = IWLAGN_RTC_DATA_SIZE, |
@@ -386,6 +392,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
386 | #define IWL_DEVICE_5150 \ | 392 | #define IWL_DEVICE_5150 \ |
387 | .fw_name_pre = IWL5150_FW_PRE, \ | 393 | .fw_name_pre = IWL5150_FW_PRE, \ |
388 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ | 394 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ |
395 | .ucode_api_ok = IWL5150_UCODE_API_OK, \ | ||
389 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ | 396 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ |
390 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 397 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
391 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ | 398 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
@@ -409,5 +416,5 @@ const struct iwl_cfg iwl5150_abg_cfg = { | |||
409 | IWL_DEVICE_5150, | 416 | IWL_DEVICE_5150, |
410 | }; | 417 | }; |
411 | 418 | ||
412 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 419 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK)); |
413 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | 420 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 64060cd738b5..f0c91505a7f7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -53,6 +53,8 @@ | |||
53 | /* Oldest version we won't warn about */ | 53 | /* Oldest version we won't warn about */ |
54 | #define IWL6000_UCODE_API_OK 4 | 54 | #define IWL6000_UCODE_API_OK 4 |
55 | #define IWL6000G2_UCODE_API_OK 5 | 55 | #define IWL6000G2_UCODE_API_OK 5 |
56 | #define IWL6050_UCODE_API_OK 5 | ||
57 | #define IWL6000G2B_UCODE_API_OK 6 | ||
56 | 58 | ||
57 | /* Lowest firmware API version supported */ | 59 | /* Lowest firmware API version supported */ |
58 | #define IWL6000_UCODE_API_MIN 4 | 60 | #define IWL6000_UCODE_API_MIN 4 |
@@ -388,7 +390,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { | |||
388 | #define IWL_DEVICE_6030 \ | 390 | #define IWL_DEVICE_6030 \ |
389 | .fw_name_pre = IWL6030_FW_PRE, \ | 391 | .fw_name_pre = IWL6030_FW_PRE, \ |
390 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ | 392 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ |
391 | .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ | 393 | .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \ |
392 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ | 394 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ |
393 | .max_inst_size = IWL60_RTC_INST_SIZE, \ | 395 | .max_inst_size = IWL60_RTC_INST_SIZE, \ |
394 | .max_data_size = IWL60_RTC_DATA_SIZE, \ | 396 | .max_data_size = IWL60_RTC_DATA_SIZE, \ |
@@ -557,6 +559,6 @@ const struct iwl_cfg iwl6000_3agn_cfg = { | |||
557 | }; | 559 | }; |
558 | 560 | ||
559 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); | 561 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); |
560 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | 562 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK)); |
561 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 563 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK)); |
562 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 564 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index f1226dbf789d..2a9a16f901c3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -863,7 +863,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) | |||
863 | 863 | ||
864 | void iwlagn_prepare_restart(struct iwl_priv *priv) | 864 | void iwlagn_prepare_restart(struct iwl_priv *priv) |
865 | { | 865 | { |
866 | struct iwl_rxon_context *ctx; | ||
867 | bool bt_full_concurrent; | 866 | bool bt_full_concurrent; |
868 | u8 bt_ci_compliance; | 867 | u8 bt_ci_compliance; |
869 | u8 bt_load; | 868 | u8 bt_load; |
@@ -872,8 +871,6 @@ void iwlagn_prepare_restart(struct iwl_priv *priv) | |||
872 | 871 | ||
873 | lockdep_assert_held(&priv->mutex); | 872 | lockdep_assert_held(&priv->mutex); |
874 | 873 | ||
875 | for_each_context(priv, ctx) | ||
876 | ctx->vif = NULL; | ||
877 | priv->is_open = 0; | 874 | priv->is_open = 0; |
878 | 875 | ||
879 | /* | 876 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index 90208094b8eb..74bce97a8600 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
@@ -104,15 +104,29 @@ | |||
104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 | 104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 |
105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte | 105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte |
106 | * aligned (address bits 0-7 must be 0). | 106 | * aligned (address bits 0-7 must be 0). |
107 | * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers | ||
108 | * for them are in different places. | ||
107 | * | 109 | * |
108 | * Bit fields in each pointer register: | 110 | * Bit fields in each pointer register: |
109 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned | 111 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned |
110 | */ | 112 | */ |
111 | #define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) | 113 | #define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) |
112 | #define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) | 114 | #define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) |
113 | 115 | #define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0) | |
114 | /* Find TFD CB base pointer for given queue (range 0-15). */ | 116 | #define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) |
115 | #define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) | 117 | #define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) |
118 | #define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) | ||
119 | |||
120 | /* Find TFD CB base pointer for given queue */ | ||
121 | static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | ||
122 | { | ||
123 | if (chnl < 16) | ||
124 | return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; | ||
125 | if (chnl < 20) | ||
126 | return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16); | ||
127 | WARN_ON_ONCE(chnl >= 32); | ||
128 | return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); | ||
129 | } | ||
116 | 130 | ||
117 | 131 | ||
118 | /** | 132 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c index b6805f8e9a01..c24a7134a6f9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
@@ -1244,6 +1244,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1244 | struct iwl_rxon_context *tmp, *ctx = NULL; | 1244 | struct iwl_rxon_context *tmp, *ctx = NULL; |
1245 | int err; | 1245 | int err; |
1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); | 1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); |
1247 | bool reset = false; | ||
1247 | 1248 | ||
1248 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", | 1249 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", |
1249 | viftype, vif->addr); | 1250 | viftype, vif->addr); |
@@ -1265,6 +1266,13 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1265 | tmp->interface_modes | tmp->exclusive_interface_modes; | 1266 | tmp->interface_modes | tmp->exclusive_interface_modes; |
1266 | 1267 | ||
1267 | if (tmp->vif) { | 1268 | if (tmp->vif) { |
1269 | /* On reset we need to add the same interface again */ | ||
1270 | if (tmp->vif == vif) { | ||
1271 | reset = true; | ||
1272 | ctx = tmp; | ||
1273 | break; | ||
1274 | } | ||
1275 | |||
1268 | /* check if this busy context is exclusive */ | 1276 | /* check if this busy context is exclusive */ |
1269 | if (tmp->exclusive_interface_modes & | 1277 | if (tmp->exclusive_interface_modes & |
1270 | BIT(tmp->vif->type)) { | 1278 | BIT(tmp->vif->type)) { |
@@ -1291,7 +1299,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1291 | ctx->vif = vif; | 1299 | ctx->vif = vif; |
1292 | 1300 | ||
1293 | err = iwl_setup_interface(priv, ctx); | 1301 | err = iwl_setup_interface(priv, ctx); |
1294 | if (!err) | 1302 | if (!err || reset) |
1295 | goto out; | 1303 | goto out; |
1296 | 1304 | ||
1297 | ctx->vif = NULL; | 1305 | ctx->vif = NULL; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index 75dc20bd965b..3b1069290fa9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -223,12 +223,33 @@ | |||
223 | #define SCD_AIT (SCD_BASE + 0x0c) | 223 | #define SCD_AIT (SCD_BASE + 0x0c) |
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_QUEUE_WRPTR(x) (SCD_BASE + 0x18 + (x) * 4) | ||
227 | #define SCD_QUEUE_RDPTR(x) (SCD_BASE + 0x68 + (x) * 4) | ||
228 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) | 226 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) |
229 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) | 227 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) |
230 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) | 228 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) |
231 | #define SCD_QUEUE_STATUS_BITS(x) (SCD_BASE + 0x10c + (x) * 4) | 229 | |
230 | static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl) | ||
231 | { | ||
232 | if (chnl < 20) | ||
233 | return SCD_BASE + 0x18 + chnl * 4; | ||
234 | WARN_ON_ONCE(chnl >= 32); | ||
235 | return SCD_BASE + 0x284 + (chnl - 20) * 4; | ||
236 | } | ||
237 | |||
238 | static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl) | ||
239 | { | ||
240 | if (chnl < 20) | ||
241 | return SCD_BASE + 0x68 + chnl * 4; | ||
242 | WARN_ON_ONCE(chnl >= 32); | ||
243 | return SCD_BASE + 0x2B4 + (chnl - 20) * 4; | ||
244 | } | ||
245 | |||
246 | static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl) | ||
247 | { | ||
248 | if (chnl < 20) | ||
249 | return SCD_BASE + 0x10c + chnl * 4; | ||
250 | WARN_ON_ONCE(chnl >= 32); | ||
251 | return SCD_BASE + 0x384 + (chnl - 20) * 4; | ||
252 | } | ||
232 | 253 | ||
233 | /*********************** END TX SCHEDULER *************************************/ | 254 | /*********************** END TX SCHEDULER *************************************/ |
234 | 255 | ||
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 3fa1ecebadfd..2fa879b015b6 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -103,7 +103,7 @@ static const u32 cipher_suites[] = { | |||
103 | * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1 | 103 | * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1 |
104 | * in the firmware spec | 104 | * in the firmware spec |
105 | */ | 105 | */ |
106 | static u8 lbs_auth_to_authtype(enum nl80211_auth_type auth_type) | 106 | static int lbs_auth_to_authtype(enum nl80211_auth_type auth_type) |
107 | { | 107 | { |
108 | int ret = -ENOTSUPP; | 108 | int ret = -ENOTSUPP; |
109 | 109 | ||
@@ -1411,7 +1411,12 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1411 | goto done; | 1411 | goto done; |
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | lbs_set_authtype(priv, sme); | 1414 | ret = lbs_set_authtype(priv, sme); |
1415 | if (ret == -ENOTSUPP) { | ||
1416 | wiphy_err(wiphy, "unsupported authtype 0x%x\n", sme->auth_type); | ||
1417 | goto done; | ||
1418 | } | ||
1419 | |||
1415 | lbs_set_radio(priv, preamble, 1); | 1420 | lbs_set_radio(priv, preamble, 1); |
1416 | 1421 | ||
1417 | /* Do the actual association */ | 1422 | /* Do the actual association */ |
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h index 445ff21772e2..2f218f9a3fd3 100644 --- a/drivers/net/wireless/mwifiex/pcie.h +++ b/drivers/net/wireless/mwifiex/pcie.h | |||
@@ -48,15 +48,15 @@ | |||
48 | #define PCIE_HOST_INT_STATUS_MASK 0xC3C | 48 | #define PCIE_HOST_INT_STATUS_MASK 0xC3C |
49 | #define PCIE_SCRATCH_2_REG 0xC40 | 49 | #define PCIE_SCRATCH_2_REG 0xC40 |
50 | #define PCIE_SCRATCH_3_REG 0xC44 | 50 | #define PCIE_SCRATCH_3_REG 0xC44 |
51 | #define PCIE_SCRATCH_4_REG 0xCC0 | 51 | #define PCIE_SCRATCH_4_REG 0xCD0 |
52 | #define PCIE_SCRATCH_5_REG 0xCC4 | 52 | #define PCIE_SCRATCH_5_REG 0xCD4 |
53 | #define PCIE_SCRATCH_6_REG 0xCC8 | 53 | #define PCIE_SCRATCH_6_REG 0xCD8 |
54 | #define PCIE_SCRATCH_7_REG 0xCCC | 54 | #define PCIE_SCRATCH_7_REG 0xCDC |
55 | #define PCIE_SCRATCH_8_REG 0xCD0 | 55 | #define PCIE_SCRATCH_8_REG 0xCE0 |
56 | #define PCIE_SCRATCH_9_REG 0xCD4 | 56 | #define PCIE_SCRATCH_9_REG 0xCE4 |
57 | #define PCIE_SCRATCH_10_REG 0xCD8 | 57 | #define PCIE_SCRATCH_10_REG 0xCE8 |
58 | #define PCIE_SCRATCH_11_REG 0xCDC | 58 | #define PCIE_SCRATCH_11_REG 0xCEC |
59 | #define PCIE_SCRATCH_12_REG 0xCE0 | 59 | #define PCIE_SCRATCH_12_REG 0xCF0 |
60 | 60 | ||
61 | #define CPU_INTR_DNLD_RDY BIT(0) | 61 | #define CPU_INTR_DNLD_RDY BIT(0) |
62 | #define CPU_INTR_DOOR_BELL BIT(1) | 62 | #define CPU_INTR_DOOR_BELL BIT(1) |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 288b035a3579..cc15fdb36060 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -1941,6 +1941,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) | |||
1941 | rtl_deinit_deferred_work(hw); | 1941 | rtl_deinit_deferred_work(hw); |
1942 | rtlpriv->intf_ops->adapter_stop(hw); | 1942 | rtlpriv->intf_ops->adapter_stop(hw); |
1943 | } | 1943 | } |
1944 | rtlpriv->cfg->ops->disable_interrupt(hw); | ||
1944 | 1945 | ||
1945 | /*deinit rfkill */ | 1946 | /*deinit rfkill */ |
1946 | rtl_deinit_rfkill(hw); | 1947 | rtl_deinit_rfkill(hw); |
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c index 41302c7b1ad0..d1afb8e3b2ef 100644 --- a/drivers/net/wireless/wl1251/main.c +++ b/drivers/net/wireless/wl1251/main.c | |||
@@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) | |||
479 | cancel_work_sync(&wl->irq_work); | 479 | cancel_work_sync(&wl->irq_work); |
480 | cancel_work_sync(&wl->tx_work); | 480 | cancel_work_sync(&wl->tx_work); |
481 | cancel_work_sync(&wl->filter_work); | 481 | cancel_work_sync(&wl->filter_work); |
482 | cancel_delayed_work_sync(&wl->elp_work); | ||
482 | 483 | ||
483 | mutex_lock(&wl->mutex); | 484 | mutex_lock(&wl->mutex); |
484 | 485 | ||
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c index f78694295c39..1b851f650e07 100644 --- a/drivers/net/wireless/wl1251/sdio.c +++ b/drivers/net/wireless/wl1251/sdio.c | |||
@@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func) | |||
315 | 315 | ||
316 | if (wl->irq) | 316 | if (wl->irq) |
317 | free_irq(wl->irq, wl); | 317 | free_irq(wl->irq, wl); |
318 | kfree(wl_sdio); | ||
319 | wl1251_free_hw(wl); | 318 | wl1251_free_hw(wl); |
319 | kfree(wl_sdio); | ||
320 | 320 | ||
321 | sdio_claim_host(func); | 321 | sdio_claim_host(func); |
322 | sdio_release_irq(func); | 322 | sdio_release_irq(func); |
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 083a49fee56a..165274c064bc 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
@@ -42,6 +42,7 @@ obj-$(CONFIG_UNICORE32) += setup-bus.o setup-irq.o | |||
42 | obj-$(CONFIG_PARISC) += setup-bus.o | 42 | obj-$(CONFIG_PARISC) += setup-bus.o |
43 | obj-$(CONFIG_SUPERH) += setup-bus.o setup-irq.o | 43 | obj-$(CONFIG_SUPERH) += setup-bus.o setup-irq.o |
44 | obj-$(CONFIG_PPC) += setup-bus.o | 44 | obj-$(CONFIG_PPC) += setup-bus.o |
45 | obj-$(CONFIG_FRV) += setup-bus.o | ||
45 | obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o | 46 | obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o |
46 | obj-$(CONFIG_X86_VISWS) += setup-irq.o | 47 | obj-$(CONFIG_X86_VISWS) += setup-irq.o |
47 | obj-$(CONFIG_MN10300) += setup-bus.o | 48 | obj-$(CONFIG_MN10300) += setup-bus.o |
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ec3b8cc188af..df6296c5f47b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -908,10 +908,6 @@ static int pinctrl_groups_show(struct seq_file *s, void *what) | |||
908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | 908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; |
909 | unsigned selector = 0; | 909 | unsigned selector = 0; |
910 | 910 | ||
911 | /* No grouping */ | ||
912 | if (!ops) | ||
913 | return 0; | ||
914 | |||
915 | mutex_lock(&pinctrl_mutex); | 911 | mutex_lock(&pinctrl_mutex); |
916 | 912 | ||
917 | seq_puts(s, "registered pin groups:\n"); | 913 | seq_puts(s, "registered pin groups:\n"); |
@@ -1225,6 +1221,19 @@ static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev) | |||
1225 | 1221 | ||
1226 | #endif | 1222 | #endif |
1227 | 1223 | ||
1224 | static int pinctrl_check_ops(struct pinctrl_dev *pctldev) | ||
1225 | { | ||
1226 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | ||
1227 | |||
1228 | if (!ops || | ||
1229 | !ops->list_groups || | ||
1230 | !ops->get_group_name || | ||
1231 | !ops->get_group_pins) | ||
1232 | return -EINVAL; | ||
1233 | |||
1234 | return 0; | ||
1235 | } | ||
1236 | |||
1228 | /** | 1237 | /** |
1229 | * pinctrl_register() - register a pin controller device | 1238 | * pinctrl_register() - register a pin controller device |
1230 | * @pctldesc: descriptor for this pin controller | 1239 | * @pctldesc: descriptor for this pin controller |
@@ -1256,6 +1265,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
1256 | INIT_LIST_HEAD(&pctldev->gpio_ranges); | 1265 | INIT_LIST_HEAD(&pctldev->gpio_ranges); |
1257 | pctldev->dev = dev; | 1266 | pctldev->dev = dev; |
1258 | 1267 | ||
1268 | /* check core ops for sanity */ | ||
1269 | ret = pinctrl_check_ops(pctldev); | ||
1270 | if (ret) { | ||
1271 | pr_err("%s pinctrl ops lacks necessary functions\n", | ||
1272 | pctldesc->name); | ||
1273 | goto out_err; | ||
1274 | } | ||
1275 | |||
1259 | /* If we're implementing pinmuxing, check the ops for sanity */ | 1276 | /* If we're implementing pinmuxing, check the ops for sanity */ |
1260 | if (pctldesc->pmxops) { | 1277 | if (pctldesc->pmxops) { |
1261 | ret = pinmux_check_ops(pctldev); | 1278 | ret = pinmux_check_ops(pctldev); |
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index bc8384c6f3eb..639db4d0aa76 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
@@ -50,7 +50,7 @@ | |||
50 | */ | 50 | */ |
51 | #undef START_IN_KERNEL_MODE | 51 | #undef START_IN_KERNEL_MODE |
52 | 52 | ||
53 | #define DRV_VER "0.5.24" | 53 | #define DRV_VER "0.5.26" |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * According to the Atom N270 datasheet, | 56 | * According to the Atom N270 datasheet, |
@@ -83,8 +83,8 @@ static int kernelmode; | |||
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | static unsigned int interval = 10; | 85 | static unsigned int interval = 10; |
86 | static unsigned int fanon = 63000; | 86 | static unsigned int fanon = 60000; |
87 | static unsigned int fanoff = 58000; | 87 | static unsigned int fanoff = 53000; |
88 | static unsigned int verbose; | 88 | static unsigned int verbose; |
89 | static unsigned int fanstate = ACERHDF_FAN_AUTO; | 89 | static unsigned int fanstate = ACERHDF_FAN_AUTO; |
90 | static char force_bios[16]; | 90 | static char force_bios[16]; |
@@ -150,6 +150,8 @@ static const struct bios_settings_t bios_tbl[] = { | |||
150 | {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, | 150 | {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, |
151 | {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, | 151 | {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, |
152 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, | 152 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, |
153 | /* LT1005u */ | ||
154 | {"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, | ||
153 | /* Acer 1410 */ | 155 | /* Acer 1410 */ |
154 | {"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 156 | {"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
155 | {"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, | 157 | {"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, |
@@ -161,6 +163,7 @@ static const struct bios_settings_t bios_tbl[] = { | |||
161 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, | 163 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, |
162 | {"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, | 164 | {"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, |
163 | {"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 165 | {"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
166 | {"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | ||
164 | /* Acer 1810xx */ | 167 | /* Acer 1810xx */ |
165 | {"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 168 | {"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
166 | {"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 169 | {"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
@@ -183,29 +186,44 @@ static const struct bios_settings_t bios_tbl[] = { | |||
183 | {"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 186 | {"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
184 | {"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 187 | {"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
185 | {"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | 188 | {"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, |
189 | {"Acer", "Aspire 1810T", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | ||
186 | /* Acer 531 */ | 190 | /* Acer 531 */ |
191 | {"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} }, | ||
187 | {"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} }, | 192 | {"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} }, |
193 | {"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} }, | ||
194 | /* Acer 751 */ | ||
195 | {"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} }, | ||
196 | /* Acer 1825 */ | ||
197 | {"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} }, | ||
198 | {"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} }, | ||
199 | /* Acer TravelMate 7730 */ | ||
200 | {"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} }, | ||
188 | /* Gateway */ | 201 | /* Gateway */ |
189 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, | 202 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, |
190 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, | 203 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, |
191 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} }, | 204 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} }, |
192 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | 205 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, |
193 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | 206 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, |
207 | {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00} }, | ||
194 | /* Packard Bell */ | 208 | /* Packard Bell */ |
195 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, | 209 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, |
196 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, | 210 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, |
197 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, | 211 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, |
198 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, | 212 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, |
199 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, | 213 | {"Packard Bell", "ENBFT", "V1.3118", 0x55, 0x58, {0x9e, 0x00} }, |
200 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} }, | 214 | {"Packard Bell", "ENBFT", "V1.3127", 0x55, 0x58, {0x9e, 0x00} }, |
201 | {"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 215 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, |
202 | {"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, | 216 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} }, |
203 | {"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} }, | 217 | {"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
204 | {"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} }, | 218 | {"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, |
205 | {"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} }, | 219 | {"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} }, |
206 | {"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} }, | 220 | {"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} }, |
207 | {"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | 221 | {"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} }, |
208 | {"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | 222 | {"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} }, |
223 | {"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | ||
224 | {"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | ||
225 | {"Packard Bell", "DOTMA", "v1.3303t", 0x55, 0x58, {0x9e, 0x00} }, | ||
226 | {"Packard Bell", "DOTVR46", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, | ||
209 | /* pewpew-terminator */ | 227 | /* pewpew-terminator */ |
210 | {"", "", "", 0, 0, {0, 0} } | 228 | {"", "", "", 0, 0, {0, 0} } |
211 | }; | 229 | }; |
@@ -701,15 +719,20 @@ MODULE_LICENSE("GPL"); | |||
701 | MODULE_AUTHOR("Peter Feuerer"); | 719 | MODULE_AUTHOR("Peter Feuerer"); |
702 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); | 720 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); |
703 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); | 721 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); |
722 | MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:"); | ||
704 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:"); | 723 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:"); |
705 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:"); | 724 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:"); |
725 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:"); | ||
706 | MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:"); | 726 | MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:"); |
727 | MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:"); | ||
707 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); | 728 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); |
708 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); | 729 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); |
709 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:"); | 730 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:"); |
710 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOA*:"); | 731 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOA*:"); |
711 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:"); | 732 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:"); |
733 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:"); | ||
712 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:"); | 734 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:"); |
735 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:"); | ||
713 | 736 | ||
714 | module_init(acerhdf_init); | 737 | module_init(acerhdf_init); |
715 | module_exit(acerhdf_exit); | 738 | module_exit(acerhdf_exit); |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index a05fc9c955d8..e6c08ee8d46c 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -212,6 +212,7 @@ static struct dmi_system_id __devinitdata dell_quirks[] = { | |||
212 | }, | 212 | }, |
213 | .driver_data = &quirk_dell_vostro_v130, | 213 | .driver_data = &quirk_dell_vostro_v130, |
214 | }, | 214 | }, |
215 | { } | ||
215 | }; | 216 | }; |
216 | 217 | ||
217 | static struct calling_interface_buffer *buffer; | 218 | static struct calling_interface_buffer *buffer; |
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index f7ba316e0ed6..0ffdb3cde2bb 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
@@ -1565,7 +1565,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1565 | ips->poll_turbo_status = true; | 1565 | ips->poll_turbo_status = true; |
1566 | 1566 | ||
1567 | if (!ips_get_i915_syms(ips)) { | 1567 | if (!ips_get_i915_syms(ips)) { |
1568 | dev_err(&dev->dev, "failed to get i915 symbols, graphics turbo disabled\n"); | 1568 | dev_info(&dev->dev, "failed to get i915 symbols, graphics turbo disabled until i915 loads\n"); |
1569 | ips->gpu_turbo_enabled = false; | 1569 | ips->gpu_turbo_enabled = false; |
1570 | } else { | 1570 | } else { |
1571 | dev_dbg(&dev->dev, "graphics turbo enabled\n"); | 1571 | dev_dbg(&dev->dev, "graphics turbo enabled\n"); |
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index cd188ab72f79..c293d0cdb104 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -902,6 +902,7 @@ read_rtc: | |||
902 | } | 902 | } |
903 | ds1307->nvram->attr.name = "nvram"; | 903 | ds1307->nvram->attr.name = "nvram"; |
904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; | 904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; |
905 | sysfs_bin_attr_init(ds1307->nvram); | ||
905 | ds1307->nvram->read = ds1307_nvram_read, | 906 | ds1307->nvram->read = ds1307_nvram_read, |
906 | ds1307->nvram->write = ds1307_nvram_write, | 907 | ds1307->nvram->write = ds1307_nvram_write, |
907 | ds1307->nvram->size = chip->nvram_size; | 908 | ds1307->nvram->size = chip->nvram_size; |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index c21871a4e73d..bc2e8a7c265b 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -2844,6 +2844,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2844 | sector_t recid, trkid; | 2844 | sector_t recid, trkid; |
2845 | unsigned int offs; | 2845 | unsigned int offs; |
2846 | unsigned int count, count_to_trk_end; | 2846 | unsigned int count, count_to_trk_end; |
2847 | int ret; | ||
2847 | 2848 | ||
2848 | basedev = block->base; | 2849 | basedev = block->base; |
2849 | if (rq_data_dir(req) == READ) { | 2850 | if (rq_data_dir(req) == READ) { |
@@ -2884,8 +2885,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2884 | 2885 | ||
2885 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); | 2886 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); |
2886 | if (IS_ERR(itcw)) { | 2887 | if (IS_ERR(itcw)) { |
2887 | dasd_sfree_request(cqr, startdev); | 2888 | ret = -EINVAL; |
2888 | return ERR_PTR(-EINVAL); | 2889 | goto out_error; |
2889 | } | 2890 | } |
2890 | cqr->cpaddr = itcw_get_tcw(itcw); | 2891 | cqr->cpaddr = itcw_get_tcw(itcw); |
2891 | if (prepare_itcw(itcw, first_trk, last_trk, | 2892 | if (prepare_itcw(itcw, first_trk, last_trk, |
@@ -2897,8 +2898,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2897 | /* Clock not in sync and XRC is enabled. | 2898 | /* Clock not in sync and XRC is enabled. |
2898 | * Try again later. | 2899 | * Try again later. |
2899 | */ | 2900 | */ |
2900 | dasd_sfree_request(cqr, startdev); | 2901 | ret = -EAGAIN; |
2901 | return ERR_PTR(-EAGAIN); | 2902 | goto out_error; |
2902 | } | 2903 | } |
2903 | len_to_track_end = 0; | 2904 | len_to_track_end = 0; |
2904 | /* | 2905 | /* |
@@ -2937,8 +2938,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2937 | tidaw_flags = 0; | 2938 | tidaw_flags = 0; |
2938 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, | 2939 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, |
2939 | dst, part_len); | 2940 | dst, part_len); |
2940 | if (IS_ERR(last_tidaw)) | 2941 | if (IS_ERR(last_tidaw)) { |
2941 | return ERR_PTR(-EINVAL); | 2942 | ret = -EINVAL; |
2943 | goto out_error; | ||
2944 | } | ||
2942 | dst += part_len; | 2945 | dst += part_len; |
2943 | } | 2946 | } |
2944 | } | 2947 | } |
@@ -2947,8 +2950,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2947 | dst = page_address(bv->bv_page) + bv->bv_offset; | 2950 | dst = page_address(bv->bv_page) + bv->bv_offset; |
2948 | last_tidaw = itcw_add_tidaw(itcw, 0x00, | 2951 | last_tidaw = itcw_add_tidaw(itcw, 0x00, |
2949 | dst, bv->bv_len); | 2952 | dst, bv->bv_len); |
2950 | if (IS_ERR(last_tidaw)) | 2953 | if (IS_ERR(last_tidaw)) { |
2951 | return ERR_PTR(-EINVAL); | 2954 | ret = -EINVAL; |
2955 | goto out_error; | ||
2956 | } | ||
2952 | } | 2957 | } |
2953 | } | 2958 | } |
2954 | last_tidaw->flags |= TIDAW_FLAGS_LAST; | 2959 | last_tidaw->flags |= TIDAW_FLAGS_LAST; |
@@ -2968,6 +2973,9 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2968 | cqr->buildclk = get_clock(); | 2973 | cqr->buildclk = get_clock(); |
2969 | cqr->status = DASD_CQR_FILLED; | 2974 | cqr->status = DASD_CQR_FILLED; |
2970 | return cqr; | 2975 | return cqr; |
2976 | out_error: | ||
2977 | dasd_sfree_request(cqr, startdev); | ||
2978 | return ERR_PTR(ret); | ||
2971 | } | 2979 | } |
2972 | 2980 | ||
2973 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, | 2981 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, |
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index 85f4a9a5d12e..73bef0bd394c 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c | |||
@@ -903,7 +903,7 @@ static int ur_set_online(struct ccw_device *cdev) | |||
903 | goto fail_urdev_put; | 903 | goto fail_urdev_put; |
904 | } | 904 | } |
905 | 905 | ||
906 | cdev_init(urd->char_device, &ur_fops); | 906 | urd->char_device->ops = &ur_fops; |
907 | urd->char_device->dev = MKDEV(major, minor); | 907 | urd->char_device->dev = MKDEV(major, minor); |
908 | urd->char_device->owner = ur_fops.owner; | 908 | urd->char_device->owner = ur_fops.owner; |
909 | 909 | ||
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 120955c66410..8334dadc681d 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -1672,7 +1672,8 @@ static void qeth_configure_blkt_default(struct qeth_card *card, char *prcd) | |||
1672 | { | 1672 | { |
1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); | 1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); |
1674 | 1674 | ||
1675 | if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && prcd[76] == 0xF5) { | 1675 | if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && |
1676 | (prcd[76] == 0xF5 || prcd[76] == 0xF6)) { | ||
1676 | card->info.blkt.time_total = 250; | 1677 | card->info.blkt.time_total = 250; |
1677 | card->info.blkt.inter_packet = 5; | 1678 | card->info.blkt.inter_packet = 5; |
1678 | card->info.blkt.inter_packet_jumbo = 15; | 1679 | card->info.blkt.inter_packet_jumbo = 15; |
@@ -4540,7 +4541,8 @@ static void qeth_determine_capabilities(struct qeth_card *card) | |||
4540 | goto out_offline; | 4541 | goto out_offline; |
4541 | } | 4542 | } |
4542 | qeth_configure_unitaddr(card, prcd); | 4543 | qeth_configure_unitaddr(card, prcd); |
4543 | qeth_configure_blkt_default(card, prcd); | 4544 | if (ddev_offline) |
4545 | qeth_configure_blkt_default(card, prcd); | ||
4544 | kfree(prcd); | 4546 | kfree(prcd); |
4545 | 4547 | ||
4546 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); | 4548 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index e002cd466e9a..467dc38246f9 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -4549,8 +4549,12 @@ static int ipr_ata_slave_alloc(struct scsi_device *sdev) | |||
4549 | ENTER; | 4549 | ENTER; |
4550 | if (sdev->sdev_target) | 4550 | if (sdev->sdev_target) |
4551 | sata_port = sdev->sdev_target->hostdata; | 4551 | sata_port = sdev->sdev_target->hostdata; |
4552 | if (sata_port) | 4552 | if (sata_port) { |
4553 | rc = ata_sas_port_init(sata_port->ap); | 4553 | rc = ata_sas_port_init(sata_port->ap); |
4554 | if (rc == 0) | ||
4555 | rc = ata_sas_sync_probe(sata_port->ap); | ||
4556 | } | ||
4557 | |||
4554 | if (rc) | 4558 | if (rc) |
4555 | ipr_slave_destroy(sdev); | 4559 | ipr_slave_destroy(sdev); |
4556 | 4560 | ||
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index ef9560dff295..cc83b66d45b7 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -1742,17 +1742,19 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1742 | 1742 | ||
1743 | mfs = ntohs(flp->fl_csp.sp_bb_data) & | 1743 | mfs = ntohs(flp->fl_csp.sp_bb_data) & |
1744 | FC_SP_BB_DATA_MASK; | 1744 | FC_SP_BB_DATA_MASK; |
1745 | if (mfs >= FC_SP_MIN_MAX_PAYLOAD && | 1745 | |
1746 | mfs <= lport->mfs) { | 1746 | if (mfs < FC_SP_MIN_MAX_PAYLOAD || mfs > FC_SP_MAX_MAX_PAYLOAD) { |
1747 | lport->mfs = mfs; | ||
1748 | fc_host_maxframe_size(lport->host) = mfs; | ||
1749 | } else { | ||
1750 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " | 1747 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " |
1751 | "lport->mfs:%hu\n", mfs, lport->mfs); | 1748 | "lport->mfs:%hu\n", mfs, lport->mfs); |
1752 | fc_lport_error(lport, fp); | 1749 | fc_lport_error(lport, fp); |
1753 | goto err; | 1750 | goto err; |
1754 | } | 1751 | } |
1755 | 1752 | ||
1753 | if (mfs <= lport->mfs) { | ||
1754 | lport->mfs = mfs; | ||
1755 | fc_host_maxframe_size(lport->host) = mfs; | ||
1756 | } | ||
1757 | |||
1756 | csp_flags = ntohs(flp->fl_csp.sp_features); | 1758 | csp_flags = ntohs(flp->fl_csp.sp_features); |
1757 | r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); | 1759 | r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); |
1758 | e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); | 1760 | e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index bc0cecc6ad62..441d88ad99a7 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -546,11 +546,12 @@ static struct ata_port_info sata_port_info = { | |||
546 | .port_ops = &sas_sata_ops | 546 | .port_ops = &sas_sata_ops |
547 | }; | 547 | }; |
548 | 548 | ||
549 | int sas_ata_init_host_and_port(struct domain_device *found_dev) | 549 | int sas_ata_init(struct domain_device *found_dev) |
550 | { | 550 | { |
551 | struct sas_ha_struct *ha = found_dev->port->ha; | 551 | struct sas_ha_struct *ha = found_dev->port->ha; |
552 | struct Scsi_Host *shost = ha->core.shost; | 552 | struct Scsi_Host *shost = ha->core.shost; |
553 | struct ata_port *ap; | 553 | struct ata_port *ap; |
554 | int rc; | ||
554 | 555 | ||
555 | ata_host_init(&found_dev->sata_dev.ata_host, | 556 | ata_host_init(&found_dev->sata_dev.ata_host, |
556 | ha->dev, | 557 | ha->dev, |
@@ -567,8 +568,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev) | |||
567 | ap->private_data = found_dev; | 568 | ap->private_data = found_dev; |
568 | ap->cbl = ATA_CBL_SATA; | 569 | ap->cbl = ATA_CBL_SATA; |
569 | ap->scsi_host = shost; | 570 | ap->scsi_host = shost; |
570 | /* publish initialized ata port */ | 571 | rc = ata_sas_port_init(ap); |
571 | smp_wmb(); | 572 | if (rc) { |
573 | ata_sas_port_destroy(ap); | ||
574 | return rc; | ||
575 | } | ||
572 | found_dev->sata_dev.ap = ap; | 576 | found_dev->sata_dev.ap = ap; |
573 | 577 | ||
574 | return 0; | 578 | return 0; |
@@ -648,18 +652,13 @@ static void sas_get_ata_command_set(struct domain_device *dev) | |||
648 | void sas_probe_sata(struct asd_sas_port *port) | 652 | void sas_probe_sata(struct asd_sas_port *port) |
649 | { | 653 | { |
650 | struct domain_device *dev, *n; | 654 | struct domain_device *dev, *n; |
651 | int err; | ||
652 | 655 | ||
653 | mutex_lock(&port->ha->disco_mutex); | 656 | mutex_lock(&port->ha->disco_mutex); |
654 | list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node) { | 657 | list_for_each_entry(dev, &port->disco_list, disco_list_node) { |
655 | if (!dev_is_sata(dev)) | 658 | if (!dev_is_sata(dev)) |
656 | continue; | 659 | continue; |
657 | 660 | ||
658 | err = sas_ata_init_host_and_port(dev); | 661 | ata_sas_async_probe(dev->sata_dev.ap); |
659 | if (err) | ||
660 | sas_fail_probe(dev, __func__, err); | ||
661 | else | ||
662 | ata_sas_async_port_init(dev->sata_dev.ap); | ||
663 | } | 662 | } |
664 | mutex_unlock(&port->ha->disco_mutex); | 663 | mutex_unlock(&port->ha->disco_mutex); |
665 | 664 | ||
@@ -718,18 +717,6 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie) | |||
718 | sas_put_device(dev); | 717 | sas_put_device(dev); |
719 | } | 718 | } |
720 | 719 | ||
721 | static bool sas_ata_dev_eh_valid(struct domain_device *dev) | ||
722 | { | ||
723 | struct ata_port *ap; | ||
724 | |||
725 | if (!dev_is_sata(dev)) | ||
726 | return false; | ||
727 | ap = dev->sata_dev.ap; | ||
728 | /* consume fully initialized ata ports */ | ||
729 | smp_rmb(); | ||
730 | return !!ap; | ||
731 | } | ||
732 | |||
733 | void sas_ata_strategy_handler(struct Scsi_Host *shost) | 720 | void sas_ata_strategy_handler(struct Scsi_Host *shost) |
734 | { | 721 | { |
735 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | 722 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); |
@@ -753,7 +740,7 @@ void sas_ata_strategy_handler(struct Scsi_Host *shost) | |||
753 | 740 | ||
754 | spin_lock(&port->dev_list_lock); | 741 | spin_lock(&port->dev_list_lock); |
755 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { | 742 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { |
756 | if (!sas_ata_dev_eh_valid(dev)) | 743 | if (!dev_is_sata(dev)) |
757 | continue; | 744 | continue; |
758 | async_schedule_domain(async_sas_ata_eh, dev, &async); | 745 | async_schedule_domain(async_sas_ata_eh, dev, &async); |
759 | } | 746 | } |
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 364679675602..629a0865b130 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c | |||
@@ -72,6 +72,7 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
72 | struct asd_sas_phy *phy; | 72 | struct asd_sas_phy *phy; |
73 | struct sas_rphy *rphy; | 73 | struct sas_rphy *rphy; |
74 | struct domain_device *dev; | 74 | struct domain_device *dev; |
75 | int rc = -ENODEV; | ||
75 | 76 | ||
76 | dev = sas_alloc_device(); | 77 | dev = sas_alloc_device(); |
77 | if (!dev) | 78 | if (!dev) |
@@ -110,9 +111,16 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
110 | 111 | ||
111 | sas_init_dev(dev); | 112 | sas_init_dev(dev); |
112 | 113 | ||
114 | dev->port = port; | ||
113 | switch (dev->dev_type) { | 115 | switch (dev->dev_type) { |
114 | case SAS_END_DEV: | ||
115 | case SATA_DEV: | 116 | case SATA_DEV: |
117 | rc = sas_ata_init(dev); | ||
118 | if (rc) { | ||
119 | rphy = NULL; | ||
120 | break; | ||
121 | } | ||
122 | /* fall through */ | ||
123 | case SAS_END_DEV: | ||
116 | rphy = sas_end_device_alloc(port->port); | 124 | rphy = sas_end_device_alloc(port->port); |
117 | break; | 125 | break; |
118 | case EDGE_DEV: | 126 | case EDGE_DEV: |
@@ -131,19 +139,14 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
131 | 139 | ||
132 | if (!rphy) { | 140 | if (!rphy) { |
133 | sas_put_device(dev); | 141 | sas_put_device(dev); |
134 | return -ENODEV; | 142 | return rc; |
135 | } | 143 | } |
136 | 144 | ||
137 | spin_lock_irq(&port->phy_list_lock); | ||
138 | list_for_each_entry(phy, &port->phy_list, port_phy_el) | ||
139 | sas_phy_set_target(phy, dev); | ||
140 | spin_unlock_irq(&port->phy_list_lock); | ||
141 | rphy->identify.phy_identifier = phy->phy->identify.phy_identifier; | 145 | rphy->identify.phy_identifier = phy->phy->identify.phy_identifier; |
142 | memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE); | 146 | memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE); |
143 | sas_fill_in_rphy(dev, rphy); | 147 | sas_fill_in_rphy(dev, rphy); |
144 | sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr); | 148 | sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr); |
145 | port->port_dev = dev; | 149 | port->port_dev = dev; |
146 | dev->port = port; | ||
147 | dev->linkrate = port->linkrate; | 150 | dev->linkrate = port->linkrate; |
148 | dev->min_linkrate = port->linkrate; | 151 | dev->min_linkrate = port->linkrate; |
149 | dev->max_linkrate = port->linkrate; | 152 | dev->max_linkrate = port->linkrate; |
@@ -155,6 +158,7 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
155 | sas_device_set_phy(dev, port->port); | 158 | sas_device_set_phy(dev, port->port); |
156 | 159 | ||
157 | dev->rphy = rphy; | 160 | dev->rphy = rphy; |
161 | get_device(&dev->rphy->dev); | ||
158 | 162 | ||
159 | if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) | 163 | if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) |
160 | list_add_tail(&dev->disco_list_node, &port->disco_list); | 164 | list_add_tail(&dev->disco_list_node, &port->disco_list); |
@@ -164,6 +168,11 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
164 | spin_unlock_irq(&port->dev_list_lock); | 168 | spin_unlock_irq(&port->dev_list_lock); |
165 | } | 169 | } |
166 | 170 | ||
171 | spin_lock_irq(&port->phy_list_lock); | ||
172 | list_for_each_entry(phy, &port->phy_list, port_phy_el) | ||
173 | sas_phy_set_target(phy, dev); | ||
174 | spin_unlock_irq(&port->phy_list_lock); | ||
175 | |||
167 | return 0; | 176 | return 0; |
168 | } | 177 | } |
169 | 178 | ||
@@ -205,8 +214,7 @@ void sas_notify_lldd_dev_gone(struct domain_device *dev) | |||
205 | static void sas_probe_devices(struct work_struct *work) | 214 | static void sas_probe_devices(struct work_struct *work) |
206 | { | 215 | { |
207 | struct domain_device *dev, *n; | 216 | struct domain_device *dev, *n; |
208 | struct sas_discovery_event *ev = | 217 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
209 | container_of(work, struct sas_discovery_event, work); | ||
210 | struct asd_sas_port *port = ev->port; | 218 | struct asd_sas_port *port = ev->port; |
211 | 219 | ||
212 | clear_bit(DISCE_PROBE, &port->disc.pending); | 220 | clear_bit(DISCE_PROBE, &port->disc.pending); |
@@ -255,6 +263,9 @@ void sas_free_device(struct kref *kref) | |||
255 | { | 263 | { |
256 | struct domain_device *dev = container_of(kref, typeof(*dev), kref); | 264 | struct domain_device *dev = container_of(kref, typeof(*dev), kref); |
257 | 265 | ||
266 | put_device(&dev->rphy->dev); | ||
267 | dev->rphy = NULL; | ||
268 | |||
258 | if (dev->parent) | 269 | if (dev->parent) |
259 | sas_put_device(dev->parent); | 270 | sas_put_device(dev->parent); |
260 | 271 | ||
@@ -291,8 +302,7 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_d | |||
291 | static void sas_destruct_devices(struct work_struct *work) | 302 | static void sas_destruct_devices(struct work_struct *work) |
292 | { | 303 | { |
293 | struct domain_device *dev, *n; | 304 | struct domain_device *dev, *n; |
294 | struct sas_discovery_event *ev = | 305 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
295 | container_of(work, struct sas_discovery_event, work); | ||
296 | struct asd_sas_port *port = ev->port; | 306 | struct asd_sas_port *port = ev->port; |
297 | 307 | ||
298 | clear_bit(DISCE_DESTRUCT, &port->disc.pending); | 308 | clear_bit(DISCE_DESTRUCT, &port->disc.pending); |
@@ -302,7 +312,6 @@ static void sas_destruct_devices(struct work_struct *work) | |||
302 | 312 | ||
303 | sas_remove_children(&dev->rphy->dev); | 313 | sas_remove_children(&dev->rphy->dev); |
304 | sas_rphy_delete(dev->rphy); | 314 | sas_rphy_delete(dev->rphy); |
305 | dev->rphy = NULL; | ||
306 | sas_unregister_common_dev(port, dev); | 315 | sas_unregister_common_dev(port, dev); |
307 | } | 316 | } |
308 | } | 317 | } |
@@ -314,11 +323,11 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev) | |||
314 | /* this rphy never saw sas_rphy_add */ | 323 | /* this rphy never saw sas_rphy_add */ |
315 | list_del_init(&dev->disco_list_node); | 324 | list_del_init(&dev->disco_list_node); |
316 | sas_rphy_free(dev->rphy); | 325 | sas_rphy_free(dev->rphy); |
317 | dev->rphy = NULL; | ||
318 | sas_unregister_common_dev(port, dev); | 326 | sas_unregister_common_dev(port, dev); |
327 | return; | ||
319 | } | 328 | } |
320 | 329 | ||
321 | if (dev->rphy && !test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { | 330 | if (!test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { |
322 | sas_rphy_unlink(dev->rphy); | 331 | sas_rphy_unlink(dev->rphy); |
323 | list_move_tail(&dev->disco_list_node, &port->destroy_list); | 332 | list_move_tail(&dev->disco_list_node, &port->destroy_list); |
324 | sas_discover_event(dev->port, DISCE_DESTRUCT); | 333 | sas_discover_event(dev->port, DISCE_DESTRUCT); |
@@ -377,8 +386,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
377 | { | 386 | { |
378 | struct domain_device *dev; | 387 | struct domain_device *dev; |
379 | int error = 0; | 388 | int error = 0; |
380 | struct sas_discovery_event *ev = | 389 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
381 | container_of(work, struct sas_discovery_event, work); | ||
382 | struct asd_sas_port *port = ev->port; | 390 | struct asd_sas_port *port = ev->port; |
383 | 391 | ||
384 | clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending); | 392 | clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending); |
@@ -419,8 +427,6 @@ static void sas_discover_domain(struct work_struct *work) | |||
419 | 427 | ||
420 | if (error) { | 428 | if (error) { |
421 | sas_rphy_free(dev->rphy); | 429 | sas_rphy_free(dev->rphy); |
422 | dev->rphy = NULL; | ||
423 | |||
424 | list_del_init(&dev->disco_list_node); | 430 | list_del_init(&dev->disco_list_node); |
425 | spin_lock_irq(&port->dev_list_lock); | 431 | spin_lock_irq(&port->dev_list_lock); |
426 | list_del_init(&dev->dev_list_node); | 432 | list_del_init(&dev->dev_list_node); |
@@ -437,8 +443,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
437 | static void sas_revalidate_domain(struct work_struct *work) | 443 | static void sas_revalidate_domain(struct work_struct *work) |
438 | { | 444 | { |
439 | int res = 0; | 445 | int res = 0; |
440 | struct sas_discovery_event *ev = | 446 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
441 | container_of(work, struct sas_discovery_event, work); | ||
442 | struct asd_sas_port *port = ev->port; | 447 | struct asd_sas_port *port = ev->port; |
443 | struct sas_ha_struct *ha = port->ha; | 448 | struct sas_ha_struct *ha = port->ha; |
444 | 449 | ||
@@ -466,21 +471,25 @@ static void sas_revalidate_domain(struct work_struct *work) | |||
466 | 471 | ||
467 | /* ---------- Events ---------- */ | 472 | /* ---------- Events ---------- */ |
468 | 473 | ||
469 | static void sas_chain_work(struct sas_ha_struct *ha, struct work_struct *work) | 474 | static void sas_chain_work(struct sas_ha_struct *ha, struct sas_work *sw) |
470 | { | 475 | { |
471 | /* chained work is not subject to SA_HA_DRAINING or SAS_HA_REGISTERED */ | 476 | /* chained work is not subject to SA_HA_DRAINING or |
472 | scsi_queue_work(ha->core.shost, work); | 477 | * SAS_HA_REGISTERED, because it is either submitted in the |
478 | * workqueue, or known to be submitted from a context that is | ||
479 | * not racing against draining | ||
480 | */ | ||
481 | scsi_queue_work(ha->core.shost, &sw->work); | ||
473 | } | 482 | } |
474 | 483 | ||
475 | static void sas_chain_event(int event, unsigned long *pending, | 484 | static void sas_chain_event(int event, unsigned long *pending, |
476 | struct work_struct *work, | 485 | struct sas_work *sw, |
477 | struct sas_ha_struct *ha) | 486 | struct sas_ha_struct *ha) |
478 | { | 487 | { |
479 | if (!test_and_set_bit(event, pending)) { | 488 | if (!test_and_set_bit(event, pending)) { |
480 | unsigned long flags; | 489 | unsigned long flags; |
481 | 490 | ||
482 | spin_lock_irqsave(&ha->state_lock, flags); | 491 | spin_lock_irqsave(&ha->state_lock, flags); |
483 | sas_chain_work(ha, work); | 492 | sas_chain_work(ha, sw); |
484 | spin_unlock_irqrestore(&ha->state_lock, flags); | 493 | spin_unlock_irqrestore(&ha->state_lock, flags); |
485 | } | 494 | } |
486 | } | 495 | } |
@@ -519,7 +528,7 @@ void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port) | |||
519 | 528 | ||
520 | disc->pending = 0; | 529 | disc->pending = 0; |
521 | for (i = 0; i < DISC_NUM_EVENTS; i++) { | 530 | for (i = 0; i < DISC_NUM_EVENTS; i++) { |
522 | INIT_WORK(&disc->disc_work[i].work, sas_event_fns[i]); | 531 | INIT_SAS_WORK(&disc->disc_work[i].work, sas_event_fns[i]); |
523 | disc->disc_work[i].port = port; | 532 | disc->disc_work[i].port = port; |
524 | } | 533 | } |
525 | } | 534 | } |
diff --git a/drivers/scsi/libsas/sas_event.c b/drivers/scsi/libsas/sas_event.c index 16639bbae629..4e4292d210c1 100644 --- a/drivers/scsi/libsas/sas_event.c +++ b/drivers/scsi/libsas/sas_event.c | |||
@@ -27,19 +27,21 @@ | |||
27 | #include "sas_internal.h" | 27 | #include "sas_internal.h" |
28 | #include "sas_dump.h" | 28 | #include "sas_dump.h" |
29 | 29 | ||
30 | void sas_queue_work(struct sas_ha_struct *ha, struct work_struct *work) | 30 | void sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw) |
31 | { | 31 | { |
32 | if (!test_bit(SAS_HA_REGISTERED, &ha->state)) | 32 | if (!test_bit(SAS_HA_REGISTERED, &ha->state)) |
33 | return; | 33 | return; |
34 | 34 | ||
35 | if (test_bit(SAS_HA_DRAINING, &ha->state)) | 35 | if (test_bit(SAS_HA_DRAINING, &ha->state)) { |
36 | list_add(&work->entry, &ha->defer_q); | 36 | /* add it to the defer list, if not already pending */ |
37 | else | 37 | if (list_empty(&sw->drain_node)) |
38 | scsi_queue_work(ha->core.shost, work); | 38 | list_add(&sw->drain_node, &ha->defer_q); |
39 | } else | ||
40 | scsi_queue_work(ha->core.shost, &sw->work); | ||
39 | } | 41 | } |
40 | 42 | ||
41 | static void sas_queue_event(int event, unsigned long *pending, | 43 | static void sas_queue_event(int event, unsigned long *pending, |
42 | struct work_struct *work, | 44 | struct sas_work *work, |
43 | struct sas_ha_struct *ha) | 45 | struct sas_ha_struct *ha) |
44 | { | 46 | { |
45 | if (!test_and_set_bit(event, pending)) { | 47 | if (!test_and_set_bit(event, pending)) { |
@@ -55,7 +57,7 @@ static void sas_queue_event(int event, unsigned long *pending, | |||
55 | void __sas_drain_work(struct sas_ha_struct *ha) | 57 | void __sas_drain_work(struct sas_ha_struct *ha) |
56 | { | 58 | { |
57 | struct workqueue_struct *wq = ha->core.shost->work_q; | 59 | struct workqueue_struct *wq = ha->core.shost->work_q; |
58 | struct work_struct *w, *_w; | 60 | struct sas_work *sw, *_sw; |
59 | 61 | ||
60 | set_bit(SAS_HA_DRAINING, &ha->state); | 62 | set_bit(SAS_HA_DRAINING, &ha->state); |
61 | /* flush submitters */ | 63 | /* flush submitters */ |
@@ -66,9 +68,9 @@ void __sas_drain_work(struct sas_ha_struct *ha) | |||
66 | 68 | ||
67 | spin_lock_irq(&ha->state_lock); | 69 | spin_lock_irq(&ha->state_lock); |
68 | clear_bit(SAS_HA_DRAINING, &ha->state); | 70 | clear_bit(SAS_HA_DRAINING, &ha->state); |
69 | list_for_each_entry_safe(w, _w, &ha->defer_q, entry) { | 71 | list_for_each_entry_safe(sw, _sw, &ha->defer_q, drain_node) { |
70 | list_del_init(&w->entry); | 72 | list_del_init(&sw->drain_node); |
71 | sas_queue_work(ha, w); | 73 | sas_queue_work(ha, sw); |
72 | } | 74 | } |
73 | spin_unlock_irq(&ha->state_lock); | 75 | spin_unlock_irq(&ha->state_lock); |
74 | } | 76 | } |
@@ -151,7 +153,7 @@ int sas_init_events(struct sas_ha_struct *sas_ha) | |||
151 | int i; | 153 | int i; |
152 | 154 | ||
153 | for (i = 0; i < HA_NUM_EVENTS; i++) { | 155 | for (i = 0; i < HA_NUM_EVENTS; i++) { |
154 | INIT_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); | 156 | INIT_SAS_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); |
155 | sas_ha->ha_events[i].ha = sas_ha; | 157 | sas_ha->ha_events[i].ha = sas_ha; |
156 | } | 158 | } |
157 | 159 | ||
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 05acd9e35fc4..caa0525d2523 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -202,6 +202,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
202 | u8 sas_addr[SAS_ADDR_SIZE]; | 202 | u8 sas_addr[SAS_ADDR_SIZE]; |
203 | struct smp_resp *resp = rsp; | 203 | struct smp_resp *resp = rsp; |
204 | struct discover_resp *dr = &resp->disc; | 204 | struct discover_resp *dr = &resp->disc; |
205 | struct sas_ha_struct *ha = dev->port->ha; | ||
205 | struct expander_device *ex = &dev->ex_dev; | 206 | struct expander_device *ex = &dev->ex_dev; |
206 | struct ex_phy *phy = &ex->ex_phy[phy_id]; | 207 | struct ex_phy *phy = &ex->ex_phy[phy_id]; |
207 | struct sas_rphy *rphy = dev->rphy; | 208 | struct sas_rphy *rphy = dev->rphy; |
@@ -209,6 +210,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
209 | char *type; | 210 | char *type; |
210 | 211 | ||
211 | if (new_phy) { | 212 | if (new_phy) { |
213 | if (WARN_ON_ONCE(test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state))) | ||
214 | return; | ||
212 | phy->phy = sas_phy_alloc(&rphy->dev, phy_id); | 215 | phy->phy = sas_phy_alloc(&rphy->dev, phy_id); |
213 | 216 | ||
214 | /* FIXME: error_handling */ | 217 | /* FIXME: error_handling */ |
@@ -233,6 +236,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
233 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); | 236 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); |
234 | 237 | ||
235 | phy->attached_dev_type = to_dev_type(dr); | 238 | phy->attached_dev_type = to_dev_type(dr); |
239 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | ||
240 | goto out; | ||
236 | phy->phy_id = phy_id; | 241 | phy->phy_id = phy_id; |
237 | phy->linkrate = dr->linkrate; | 242 | phy->linkrate = dr->linkrate; |
238 | phy->attached_sata_host = dr->attached_sata_host; | 243 | phy->attached_sata_host = dr->attached_sata_host; |
@@ -240,7 +245,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
240 | phy->attached_sata_ps = dr->attached_sata_ps; | 245 | phy->attached_sata_ps = dr->attached_sata_ps; |
241 | phy->attached_iproto = dr->iproto << 1; | 246 | phy->attached_iproto = dr->iproto << 1; |
242 | phy->attached_tproto = dr->tproto << 1; | 247 | phy->attached_tproto = dr->tproto << 1; |
243 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | 248 | /* help some expanders that fail to zero sas_address in the 'no |
249 | * device' case | ||
250 | */ | ||
251 | if (phy->attached_dev_type == NO_DEVICE || | ||
252 | phy->linkrate < SAS_LINK_RATE_1_5_GBPS) | ||
253 | memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | ||
254 | else | ||
255 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | ||
244 | phy->attached_phy_id = dr->attached_phy_id; | 256 | phy->attached_phy_id = dr->attached_phy_id; |
245 | phy->phy_change_count = dr->change_count; | 257 | phy->phy_change_count = dr->change_count; |
246 | phy->routing_attr = dr->routing_attr; | 258 | phy->routing_attr = dr->routing_attr; |
@@ -266,6 +278,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
266 | return; | 278 | return; |
267 | } | 279 | } |
268 | 280 | ||
281 | out: | ||
269 | switch (phy->attached_dev_type) { | 282 | switch (phy->attached_dev_type) { |
270 | case SATA_PENDING: | 283 | case SATA_PENDING: |
271 | type = "stp pending"; | 284 | type = "stp pending"; |
@@ -304,7 +317,15 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
304 | else | 317 | else |
305 | return; | 318 | return; |
306 | 319 | ||
307 | SAS_DPRINTK("ex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", | 320 | /* if the attached device type changed and ata_eh is active, |
321 | * make sure we run revalidation when eh completes (see: | ||
322 | * sas_enable_revalidation) | ||
323 | */ | ||
324 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | ||
325 | set_bit(DISCE_REVALIDATE_DOMAIN, &dev->port->disc.pending); | ||
326 | |||
327 | SAS_DPRINTK("%sex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", | ||
328 | test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state) ? "ata: " : "", | ||
308 | SAS_ADDR(dev->sas_addr), phy->phy_id, | 329 | SAS_ADDR(dev->sas_addr), phy->phy_id, |
309 | sas_route_char(dev, phy), phy->linkrate, | 330 | sas_route_char(dev, phy), phy->linkrate, |
310 | SAS_ADDR(phy->attached_sas_addr), type); | 331 | SAS_ADDR(phy->attached_sas_addr), type); |
@@ -776,13 +797,16 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
776 | if (res) | 797 | if (res) |
777 | goto out_free; | 798 | goto out_free; |
778 | 799 | ||
800 | sas_init_dev(child); | ||
801 | res = sas_ata_init(child); | ||
802 | if (res) | ||
803 | goto out_free; | ||
779 | rphy = sas_end_device_alloc(phy->port); | 804 | rphy = sas_end_device_alloc(phy->port); |
780 | if (unlikely(!rphy)) | 805 | if (!rphy) |
781 | goto out_free; | 806 | goto out_free; |
782 | 807 | ||
783 | sas_init_dev(child); | ||
784 | |||
785 | child->rphy = rphy; | 808 | child->rphy = rphy; |
809 | get_device(&rphy->dev); | ||
786 | 810 | ||
787 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
788 | 812 | ||
@@ -806,6 +830,7 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
806 | sas_init_dev(child); | 830 | sas_init_dev(child); |
807 | 831 | ||
808 | child->rphy = rphy; | 832 | child->rphy = rphy; |
833 | get_device(&rphy->dev); | ||
809 | sas_fill_in_rphy(child, rphy); | 834 | sas_fill_in_rphy(child, rphy); |
810 | 835 | ||
811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 836 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
@@ -830,8 +855,6 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
830 | 855 | ||
831 | out_list_del: | 856 | out_list_del: |
832 | sas_rphy_free(child->rphy); | 857 | sas_rphy_free(child->rphy); |
833 | child->rphy = NULL; | ||
834 | |||
835 | list_del(&child->disco_list_node); | 858 | list_del(&child->disco_list_node); |
836 | spin_lock_irq(&parent->port->dev_list_lock); | 859 | spin_lock_irq(&parent->port->dev_list_lock); |
837 | list_del(&child->dev_list_node); | 860 | list_del(&child->dev_list_node); |
@@ -911,6 +934,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
911 | } | 934 | } |
912 | port = parent->port; | 935 | port = parent->port; |
913 | child->rphy = rphy; | 936 | child->rphy = rphy; |
937 | get_device(&rphy->dev); | ||
914 | edev = rphy_to_expander_device(rphy); | 938 | edev = rphy_to_expander_device(rphy); |
915 | child->dev_type = phy->attached_dev_type; | 939 | child->dev_type = phy->attached_dev_type; |
916 | kref_get(&parent->kref); | 940 | kref_get(&parent->kref); |
@@ -934,6 +958,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
934 | 958 | ||
935 | res = sas_discover_expander(child); | 959 | res = sas_discover_expander(child); |
936 | if (res) { | 960 | if (res) { |
961 | sas_rphy_delete(rphy); | ||
937 | spin_lock_irq(&parent->port->dev_list_lock); | 962 | spin_lock_irq(&parent->port->dev_list_lock); |
938 | list_del(&child->dev_list_node); | 963 | list_del(&child->dev_list_node); |
939 | spin_unlock_irq(&parent->port->dev_list_lock); | 964 | spin_unlock_irq(&parent->port->dev_list_lock); |
@@ -1718,9 +1743,17 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | |||
1718 | int phy_change_count = 0; | 1743 | int phy_change_count = 0; |
1719 | 1744 | ||
1720 | res = sas_get_phy_change_count(dev, i, &phy_change_count); | 1745 | res = sas_get_phy_change_count(dev, i, &phy_change_count); |
1721 | if (res) | 1746 | switch (res) { |
1722 | goto out; | 1747 | case SMP_RESP_PHY_VACANT: |
1723 | else if (phy_change_count != ex->ex_phy[i].phy_change_count) { | 1748 | case SMP_RESP_NO_PHY: |
1749 | continue; | ||
1750 | case SMP_RESP_FUNC_ACC: | ||
1751 | break; | ||
1752 | default: | ||
1753 | return res; | ||
1754 | } | ||
1755 | |||
1756 | if (phy_change_count != ex->ex_phy[i].phy_change_count) { | ||
1724 | if (update) | 1757 | if (update) |
1725 | ex->ex_phy[i].phy_change_count = | 1758 | ex->ex_phy[i].phy_change_count = |
1726 | phy_change_count; | 1759 | phy_change_count; |
@@ -1728,8 +1761,7 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | |||
1728 | return 0; | 1761 | return 0; |
1729 | } | 1762 | } |
1730 | } | 1763 | } |
1731 | out: | 1764 | return 0; |
1732 | return res; | ||
1733 | } | 1765 | } |
1734 | 1766 | ||
1735 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) | 1767 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) |
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 120bff64be30..10cb5ae30977 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c | |||
@@ -94,8 +94,7 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr) | |||
94 | 94 | ||
95 | void sas_hae_reset(struct work_struct *work) | 95 | void sas_hae_reset(struct work_struct *work) |
96 | { | 96 | { |
97 | struct sas_ha_event *ev = | 97 | struct sas_ha_event *ev = to_sas_ha_event(work); |
98 | container_of(work, struct sas_ha_event, work); | ||
99 | struct sas_ha_struct *ha = ev->ha; | 98 | struct sas_ha_struct *ha = ev->ha; |
100 | 99 | ||
101 | clear_bit(HAE_RESET, &ha->pending); | 100 | clear_bit(HAE_RESET, &ha->pending); |
@@ -369,14 +368,14 @@ static void sas_phy_release(struct sas_phy *phy) | |||
369 | 368 | ||
370 | static void phy_reset_work(struct work_struct *work) | 369 | static void phy_reset_work(struct work_struct *work) |
371 | { | 370 | { |
372 | struct sas_phy_data *d = container_of(work, typeof(*d), reset_work); | 371 | struct sas_phy_data *d = container_of(work, typeof(*d), reset_work.work); |
373 | 372 | ||
374 | d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset); | 373 | d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset); |
375 | } | 374 | } |
376 | 375 | ||
377 | static void phy_enable_work(struct work_struct *work) | 376 | static void phy_enable_work(struct work_struct *work) |
378 | { | 377 | { |
379 | struct sas_phy_data *d = container_of(work, typeof(*d), enable_work); | 378 | struct sas_phy_data *d = container_of(work, typeof(*d), enable_work.work); |
380 | 379 | ||
381 | d->enable_result = sas_phy_enable(d->phy, d->enable); | 380 | d->enable_result = sas_phy_enable(d->phy, d->enable); |
382 | } | 381 | } |
@@ -389,8 +388,8 @@ static int sas_phy_setup(struct sas_phy *phy) | |||
389 | return -ENOMEM; | 388 | return -ENOMEM; |
390 | 389 | ||
391 | mutex_init(&d->event_lock); | 390 | mutex_init(&d->event_lock); |
392 | INIT_WORK(&d->reset_work, phy_reset_work); | 391 | INIT_SAS_WORK(&d->reset_work, phy_reset_work); |
393 | INIT_WORK(&d->enable_work, phy_enable_work); | 392 | INIT_SAS_WORK(&d->enable_work, phy_enable_work); |
394 | d->phy = phy; | 393 | d->phy = phy; |
395 | phy->hostdata = d; | 394 | phy->hostdata = d; |
396 | 395 | ||
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index f05c63879949..507e4cf12e56 100644 --- a/drivers/scsi/libsas/sas_internal.h +++ b/drivers/scsi/libsas/sas_internal.h | |||
@@ -45,10 +45,10 @@ struct sas_phy_data { | |||
45 | struct mutex event_lock; | 45 | struct mutex event_lock; |
46 | int hard_reset; | 46 | int hard_reset; |
47 | int reset_result; | 47 | int reset_result; |
48 | struct work_struct reset_work; | 48 | struct sas_work reset_work; |
49 | int enable; | 49 | int enable; |
50 | int enable_result; | 50 | int enable_result; |
51 | struct work_struct enable_work; | 51 | struct sas_work enable_work; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | void sas_scsi_recover_host(struct Scsi_Host *shost); | 54 | void sas_scsi_recover_host(struct Scsi_Host *shost); |
@@ -80,7 +80,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work); | |||
80 | void sas_porte_link_reset_err(struct work_struct *work); | 80 | void sas_porte_link_reset_err(struct work_struct *work); |
81 | void sas_porte_timer_event(struct work_struct *work); | 81 | void sas_porte_timer_event(struct work_struct *work); |
82 | void sas_porte_hard_reset(struct work_struct *work); | 82 | void sas_porte_hard_reset(struct work_struct *work); |
83 | void sas_queue_work(struct sas_ha_struct *ha, struct work_struct *work); | 83 | void sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw); |
84 | 84 | ||
85 | int sas_notify_lldd_dev_found(struct domain_device *); | 85 | int sas_notify_lldd_dev_found(struct domain_device *); |
86 | void sas_notify_lldd_dev_gone(struct domain_device *); | 86 | void sas_notify_lldd_dev_gone(struct domain_device *); |
diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c index dcfd4a9105c5..521422e857ab 100644 --- a/drivers/scsi/libsas/sas_phy.c +++ b/drivers/scsi/libsas/sas_phy.c | |||
@@ -32,8 +32,7 @@ | |||
32 | 32 | ||
33 | static void sas_phye_loss_of_signal(struct work_struct *work) | 33 | static void sas_phye_loss_of_signal(struct work_struct *work) |
34 | { | 34 | { |
35 | struct asd_sas_event *ev = | 35 | struct asd_sas_event *ev = to_asd_sas_event(work); |
36 | container_of(work, struct asd_sas_event, work); | ||
37 | struct asd_sas_phy *phy = ev->phy; | 36 | struct asd_sas_phy *phy = ev->phy; |
38 | 37 | ||
39 | clear_bit(PHYE_LOSS_OF_SIGNAL, &phy->phy_events_pending); | 38 | clear_bit(PHYE_LOSS_OF_SIGNAL, &phy->phy_events_pending); |
@@ -43,8 +42,7 @@ static void sas_phye_loss_of_signal(struct work_struct *work) | |||
43 | 42 | ||
44 | static void sas_phye_oob_done(struct work_struct *work) | 43 | static void sas_phye_oob_done(struct work_struct *work) |
45 | { | 44 | { |
46 | struct asd_sas_event *ev = | 45 | struct asd_sas_event *ev = to_asd_sas_event(work); |
47 | container_of(work, struct asd_sas_event, work); | ||
48 | struct asd_sas_phy *phy = ev->phy; | 46 | struct asd_sas_phy *phy = ev->phy; |
49 | 47 | ||
50 | clear_bit(PHYE_OOB_DONE, &phy->phy_events_pending); | 48 | clear_bit(PHYE_OOB_DONE, &phy->phy_events_pending); |
@@ -53,8 +51,7 @@ static void sas_phye_oob_done(struct work_struct *work) | |||
53 | 51 | ||
54 | static void sas_phye_oob_error(struct work_struct *work) | 52 | static void sas_phye_oob_error(struct work_struct *work) |
55 | { | 53 | { |
56 | struct asd_sas_event *ev = | 54 | struct asd_sas_event *ev = to_asd_sas_event(work); |
57 | container_of(work, struct asd_sas_event, work); | ||
58 | struct asd_sas_phy *phy = ev->phy; | 55 | struct asd_sas_phy *phy = ev->phy; |
59 | struct sas_ha_struct *sas_ha = phy->ha; | 56 | struct sas_ha_struct *sas_ha = phy->ha; |
60 | struct asd_sas_port *port = phy->port; | 57 | struct asd_sas_port *port = phy->port; |
@@ -85,8 +82,7 @@ static void sas_phye_oob_error(struct work_struct *work) | |||
85 | 82 | ||
86 | static void sas_phye_spinup_hold(struct work_struct *work) | 83 | static void sas_phye_spinup_hold(struct work_struct *work) |
87 | { | 84 | { |
88 | struct asd_sas_event *ev = | 85 | struct asd_sas_event *ev = to_asd_sas_event(work); |
89 | container_of(work, struct asd_sas_event, work); | ||
90 | struct asd_sas_phy *phy = ev->phy; | 86 | struct asd_sas_phy *phy = ev->phy; |
91 | struct sas_ha_struct *sas_ha = phy->ha; | 87 | struct sas_ha_struct *sas_ha = phy->ha; |
92 | struct sas_internal *i = | 88 | struct sas_internal *i = |
@@ -127,14 +123,12 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
127 | phy->error = 0; | 123 | phy->error = 0; |
128 | INIT_LIST_HEAD(&phy->port_phy_el); | 124 | INIT_LIST_HEAD(&phy->port_phy_el); |
129 | for (k = 0; k < PORT_NUM_EVENTS; k++) { | 125 | for (k = 0; k < PORT_NUM_EVENTS; k++) { |
130 | INIT_WORK(&phy->port_events[k].work, | 126 | INIT_SAS_WORK(&phy->port_events[k].work, sas_port_event_fns[k]); |
131 | sas_port_event_fns[k]); | ||
132 | phy->port_events[k].phy = phy; | 127 | phy->port_events[k].phy = phy; |
133 | } | 128 | } |
134 | 129 | ||
135 | for (k = 0; k < PHY_NUM_EVENTS; k++) { | 130 | for (k = 0; k < PHY_NUM_EVENTS; k++) { |
136 | INIT_WORK(&phy->phy_events[k].work, | 131 | INIT_SAS_WORK(&phy->phy_events[k].work, sas_phy_event_fns[k]); |
137 | sas_phy_event_fns[k]); | ||
138 | phy->phy_events[k].phy = phy; | 132 | phy->phy_events[k].phy = phy; |
139 | } | 133 | } |
140 | 134 | ||
@@ -144,8 +138,7 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
144 | spin_lock_init(&phy->sas_prim_lock); | 138 | spin_lock_init(&phy->sas_prim_lock); |
145 | phy->frame_rcvd_size = 0; | 139 | phy->frame_rcvd_size = 0; |
146 | 140 | ||
147 | phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, | 141 | phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, i); |
148 | i); | ||
149 | if (!phy->phy) | 142 | if (!phy->phy) |
150 | return -ENOMEM; | 143 | return -ENOMEM; |
151 | 144 | ||
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index eb19c016d500..e884a8c58a0c 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c | |||
@@ -123,7 +123,7 @@ static void sas_form_port(struct asd_sas_phy *phy) | |||
123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); | 123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); |
124 | 124 | ||
125 | if (!port->port) { | 125 | if (!port->port) { |
126 | port->port = sas_port_alloc(phy->phy->dev.parent, phy->id); | 126 | port->port = sas_port_alloc(phy->phy->dev.parent, port->id); |
127 | BUG_ON(!port->port); | 127 | BUG_ON(!port->port); |
128 | sas_port_add(port->port); | 128 | sas_port_add(port->port); |
129 | } | 129 | } |
@@ -208,8 +208,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) | |||
208 | 208 | ||
209 | void sas_porte_bytes_dmaed(struct work_struct *work) | 209 | void sas_porte_bytes_dmaed(struct work_struct *work) |
210 | { | 210 | { |
211 | struct asd_sas_event *ev = | 211 | struct asd_sas_event *ev = to_asd_sas_event(work); |
212 | container_of(work, struct asd_sas_event, work); | ||
213 | struct asd_sas_phy *phy = ev->phy; | 212 | struct asd_sas_phy *phy = ev->phy; |
214 | 213 | ||
215 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); | 214 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); |
@@ -219,8 +218,7 @@ void sas_porte_bytes_dmaed(struct work_struct *work) | |||
219 | 218 | ||
220 | void sas_porte_broadcast_rcvd(struct work_struct *work) | 219 | void sas_porte_broadcast_rcvd(struct work_struct *work) |
221 | { | 220 | { |
222 | struct asd_sas_event *ev = | 221 | struct asd_sas_event *ev = to_asd_sas_event(work); |
223 | container_of(work, struct asd_sas_event, work); | ||
224 | struct asd_sas_phy *phy = ev->phy; | 222 | struct asd_sas_phy *phy = ev->phy; |
225 | unsigned long flags; | 223 | unsigned long flags; |
226 | u32 prim; | 224 | u32 prim; |
@@ -237,8 +235,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work) | |||
237 | 235 | ||
238 | void sas_porte_link_reset_err(struct work_struct *work) | 236 | void sas_porte_link_reset_err(struct work_struct *work) |
239 | { | 237 | { |
240 | struct asd_sas_event *ev = | 238 | struct asd_sas_event *ev = to_asd_sas_event(work); |
241 | container_of(work, struct asd_sas_event, work); | ||
242 | struct asd_sas_phy *phy = ev->phy; | 239 | struct asd_sas_phy *phy = ev->phy; |
243 | 240 | ||
244 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); | 241 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); |
@@ -248,8 +245,7 @@ void sas_porte_link_reset_err(struct work_struct *work) | |||
248 | 245 | ||
249 | void sas_porte_timer_event(struct work_struct *work) | 246 | void sas_porte_timer_event(struct work_struct *work) |
250 | { | 247 | { |
251 | struct asd_sas_event *ev = | 248 | struct asd_sas_event *ev = to_asd_sas_event(work); |
252 | container_of(work, struct asd_sas_event, work); | ||
253 | struct asd_sas_phy *phy = ev->phy; | 249 | struct asd_sas_phy *phy = ev->phy; |
254 | 250 | ||
255 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); | 251 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); |
@@ -259,8 +255,7 @@ void sas_porte_timer_event(struct work_struct *work) | |||
259 | 255 | ||
260 | void sas_porte_hard_reset(struct work_struct *work) | 256 | void sas_porte_hard_reset(struct work_struct *work) |
261 | { | 257 | { |
262 | struct asd_sas_event *ev = | 258 | struct asd_sas_event *ev = to_asd_sas_event(work); |
263 | container_of(work, struct asd_sas_event, work); | ||
264 | struct asd_sas_phy *phy = ev->phy; | 259 | struct asd_sas_phy *phy = ev->phy; |
265 | 260 | ||
266 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); | 261 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ead6405f3e51..5dfd7495d1a1 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1638,7 +1638,7 @@ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, | |||
1638 | request_fn_proc *request_fn) | 1638 | request_fn_proc *request_fn) |
1639 | { | 1639 | { |
1640 | struct request_queue *q; | 1640 | struct request_queue *q; |
1641 | struct device *dev = shost->shost_gendev.parent; | 1641 | struct device *dev = shost->dma_dev; |
1642 | 1642 | ||
1643 | q = blk_init_queue(request_fn, NULL); | 1643 | q = blk_init_queue(request_fn, NULL); |
1644 | if (!q) | 1644 | if (!q) |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 3ed748355b98..00c024039c97 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -74,7 +74,7 @@ config SPI_ATMEL | |||
74 | This selects a driver for the Atmel SPI Controller, present on | 74 | This selects a driver for the Atmel SPI Controller, present on |
75 | many AT32 (AVR32) and AT91 (ARM) chips. | 75 | many AT32 (AVR32) and AT91 (ARM) chips. |
76 | 76 | ||
77 | config SPI_BFIN | 77 | config SPI_BFIN5XX |
78 | tristate "SPI controller driver for ADI Blackfin5xx" | 78 | tristate "SPI controller driver for ADI Blackfin5xx" |
79 | depends on BLACKFIN | 79 | depends on BLACKFIN |
80 | help | 80 | help |
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index a1d48e0ba3dc..9d75d2198ff5 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile | |||
@@ -15,7 +15,7 @@ obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o | |||
15 | obj-$(CONFIG_SPI_ATH79) += spi-ath79.o | 15 | obj-$(CONFIG_SPI_ATH79) += spi-ath79.o |
16 | obj-$(CONFIG_SPI_AU1550) += spi-au1550.o | 16 | obj-$(CONFIG_SPI_AU1550) += spi-au1550.o |
17 | obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o | 17 | obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o |
18 | obj-$(CONFIG_SPI_BFIN) += spi-bfin5xx.o | 18 | obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o |
19 | obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o | 19 | obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o |
20 | obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o | 20 | obj-$(CONFIG_SPI_BITBANG) += spi-bitbang.o |
21 | obj-$(CONFIG_SPI_BUTTERFLY) += spi-butterfly.o | 21 | obj-$(CONFIG_SPI_BUTTERFLY) += spi-butterfly.o |
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c index f01b2648452e..7491971139a6 100644 --- a/drivers/spi/spi-bcm63xx.c +++ b/drivers/spi/spi-bcm63xx.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Broadcom BCM63xx SPI controller support | 2 | * Broadcom BCM63xx SPI controller support |
3 | * | 3 | * |
4 | * Copyright (C) 2009-2011 Florian Fainelli <florian@openwrt.org> | 4 | * Copyright (C) 2009-2012 Florian Fainelli <florian@openwrt.org> |
5 | * Copyright (C) 2010 Tanguy Bouzeloc <tanguy.bouzeloc@efixo.com> | 5 | * Copyright (C) 2010 Tanguy Bouzeloc <tanguy.bouzeloc@efixo.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
@@ -30,6 +30,8 @@ | |||
30 | #include <linux/spi/spi.h> | 30 | #include <linux/spi/spi.h> |
31 | #include <linux/completion.h> | 31 | #include <linux/completion.h> |
32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
33 | #include <linux/workqueue.h> | ||
34 | #include <linux/pm_runtime.h> | ||
33 | 35 | ||
34 | #include <bcm63xx_dev_spi.h> | 36 | #include <bcm63xx_dev_spi.h> |
35 | 37 | ||
@@ -37,8 +39,6 @@ | |||
37 | #define DRV_VER "0.1.2" | 39 | #define DRV_VER "0.1.2" |
38 | 40 | ||
39 | struct bcm63xx_spi { | 41 | struct bcm63xx_spi { |
40 | spinlock_t lock; | ||
41 | int stopping; | ||
42 | struct completion done; | 42 | struct completion done; |
43 | 43 | ||
44 | void __iomem *regs; | 44 | void __iomem *regs; |
@@ -96,17 +96,12 @@ static const unsigned bcm63xx_spi_freq_table[SPI_CLK_MASK][2] = { | |||
96 | { 391000, SPI_CLK_0_391MHZ } | 96 | { 391000, SPI_CLK_0_391MHZ } |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static int bcm63xx_spi_setup_transfer(struct spi_device *spi, | 99 | static int bcm63xx_spi_check_transfer(struct spi_device *spi, |
100 | struct spi_transfer *t) | 100 | struct spi_transfer *t) |
101 | { | 101 | { |
102 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); | ||
103 | u8 bits_per_word; | 102 | u8 bits_per_word; |
104 | u8 clk_cfg, reg; | ||
105 | u32 hz; | ||
106 | int i; | ||
107 | 103 | ||
108 | bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; | 104 | bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word; |
109 | hz = (t) ? t->speed_hz : spi->max_speed_hz; | ||
110 | if (bits_per_word != 8) { | 105 | if (bits_per_word != 8) { |
111 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", | 106 | dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n", |
112 | __func__, bits_per_word); | 107 | __func__, bits_per_word); |
@@ -119,6 +114,19 @@ static int bcm63xx_spi_setup_transfer(struct spi_device *spi, | |||
119 | return -EINVAL; | 114 | return -EINVAL; |
120 | } | 115 | } |
121 | 116 | ||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static void bcm63xx_spi_setup_transfer(struct spi_device *spi, | ||
121 | struct spi_transfer *t) | ||
122 | { | ||
123 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); | ||
124 | u32 hz; | ||
125 | u8 clk_cfg, reg; | ||
126 | int i; | ||
127 | |||
128 | hz = (t) ? t->speed_hz : spi->max_speed_hz; | ||
129 | |||
122 | /* Find the closest clock configuration */ | 130 | /* Find the closest clock configuration */ |
123 | for (i = 0; i < SPI_CLK_MASK; i++) { | 131 | for (i = 0; i < SPI_CLK_MASK; i++) { |
124 | if (hz <= bcm63xx_spi_freq_table[i][0]) { | 132 | if (hz <= bcm63xx_spi_freq_table[i][0]) { |
@@ -139,8 +147,6 @@ static int bcm63xx_spi_setup_transfer(struct spi_device *spi, | |||
139 | bcm_spi_writeb(bs, reg, SPI_CLK_CFG); | 147 | bcm_spi_writeb(bs, reg, SPI_CLK_CFG); |
140 | dev_dbg(&spi->dev, "Setting clock register to %02x (hz %d)\n", | 148 | dev_dbg(&spi->dev, "Setting clock register to %02x (hz %d)\n", |
141 | clk_cfg, hz); | 149 | clk_cfg, hz); |
142 | |||
143 | return 0; | ||
144 | } | 150 | } |
145 | 151 | ||
146 | /* the spi->mode bits understood by this driver: */ | 152 | /* the spi->mode bits understood by this driver: */ |
@@ -153,9 +159,6 @@ static int bcm63xx_spi_setup(struct spi_device *spi) | |||
153 | 159 | ||
154 | bs = spi_master_get_devdata(spi->master); | 160 | bs = spi_master_get_devdata(spi->master); |
155 | 161 | ||
156 | if (bs->stopping) | ||
157 | return -ESHUTDOWN; | ||
158 | |||
159 | if (!spi->bits_per_word) | 162 | if (!spi->bits_per_word) |
160 | spi->bits_per_word = 8; | 163 | spi->bits_per_word = 8; |
161 | 164 | ||
@@ -165,7 +168,7 @@ static int bcm63xx_spi_setup(struct spi_device *spi) | |||
165 | return -EINVAL; | 168 | return -EINVAL; |
166 | } | 169 | } |
167 | 170 | ||
168 | ret = bcm63xx_spi_setup_transfer(spi, NULL); | 171 | ret = bcm63xx_spi_check_transfer(spi, NULL); |
169 | if (ret < 0) { | 172 | if (ret < 0) { |
170 | dev_err(&spi->dev, "setup: unsupported mode bits %x\n", | 173 | dev_err(&spi->dev, "setup: unsupported mode bits %x\n", |
171 | spi->mode & ~MODEBITS); | 174 | spi->mode & ~MODEBITS); |
@@ -190,28 +193,29 @@ static void bcm63xx_spi_fill_tx_fifo(struct bcm63xx_spi *bs) | |||
190 | bs->remaining_bytes -= size; | 193 | bs->remaining_bytes -= size; |
191 | } | 194 | } |
192 | 195 | ||
193 | static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | 196 | static unsigned int bcm63xx_txrx_bufs(struct spi_device *spi, |
197 | struct spi_transfer *t) | ||
194 | { | 198 | { |
195 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); | 199 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); |
196 | u16 msg_ctl; | 200 | u16 msg_ctl; |
197 | u16 cmd; | 201 | u16 cmd; |
198 | 202 | ||
203 | /* Disable the CMD_DONE interrupt */ | ||
204 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | ||
205 | |||
199 | dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n", | 206 | dev_dbg(&spi->dev, "txrx: tx %p, rx %p, len %d\n", |
200 | t->tx_buf, t->rx_buf, t->len); | 207 | t->tx_buf, t->rx_buf, t->len); |
201 | 208 | ||
202 | /* Transmitter is inhibited */ | 209 | /* Transmitter is inhibited */ |
203 | bs->tx_ptr = t->tx_buf; | 210 | bs->tx_ptr = t->tx_buf; |
204 | bs->rx_ptr = t->rx_buf; | 211 | bs->rx_ptr = t->rx_buf; |
205 | init_completion(&bs->done); | ||
206 | 212 | ||
207 | if (t->tx_buf) { | 213 | if (t->tx_buf) { |
208 | bs->remaining_bytes = t->len; | 214 | bs->remaining_bytes = t->len; |
209 | bcm63xx_spi_fill_tx_fifo(bs); | 215 | bcm63xx_spi_fill_tx_fifo(bs); |
210 | } | 216 | } |
211 | 217 | ||
212 | /* Enable the command done interrupt which | 218 | init_completion(&bs->done); |
213 | * we use to determine completion of a command */ | ||
214 | bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); | ||
215 | 219 | ||
216 | /* Fill in the Message control register */ | 220 | /* Fill in the Message control register */ |
217 | msg_ctl = (t->len << SPI_BYTE_CNT_SHIFT); | 221 | msg_ctl = (t->len << SPI_BYTE_CNT_SHIFT); |
@@ -230,33 +234,76 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
230 | cmd |= (0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT); | 234 | cmd |= (0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT); |
231 | cmd |= (spi->chip_select << SPI_CMD_DEVICE_ID_SHIFT); | 235 | cmd |= (spi->chip_select << SPI_CMD_DEVICE_ID_SHIFT); |
232 | bcm_spi_writew(bs, cmd, SPI_CMD); | 236 | bcm_spi_writew(bs, cmd, SPI_CMD); |
233 | wait_for_completion(&bs->done); | ||
234 | 237 | ||
235 | /* Disable the CMD_DONE interrupt */ | 238 | /* Enable the CMD_DONE interrupt */ |
236 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | 239 | bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); |
237 | 240 | ||
238 | return t->len - bs->remaining_bytes; | 241 | return t->len - bs->remaining_bytes; |
239 | } | 242 | } |
240 | 243 | ||
241 | static int bcm63xx_transfer(struct spi_device *spi, struct spi_message *m) | 244 | static int bcm63xx_spi_prepare_transfer(struct spi_master *master) |
242 | { | 245 | { |
243 | struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); | 246 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
244 | struct spi_transfer *t; | ||
245 | int ret = 0; | ||
246 | 247 | ||
247 | if (unlikely(list_empty(&m->transfers))) | 248 | pm_runtime_get_sync(&bs->pdev->dev); |
248 | return -EINVAL; | ||
249 | 249 | ||
250 | if (bs->stopping) | 250 | return 0; |
251 | return -ESHUTDOWN; | 251 | } |
252 | |||
253 | static int bcm63xx_spi_unprepare_transfer(struct spi_master *master) | ||
254 | { | ||
255 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | ||
256 | |||
257 | pm_runtime_put(&bs->pdev->dev); | ||
258 | |||
259 | return 0; | ||
260 | } | ||
261 | |||
262 | static int bcm63xx_spi_transfer_one(struct spi_master *master, | ||
263 | struct spi_message *m) | ||
264 | { | ||
265 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | ||
266 | struct spi_transfer *t; | ||
267 | struct spi_device *spi = m->spi; | ||
268 | int status = 0; | ||
269 | unsigned int timeout = 0; | ||
252 | 270 | ||
253 | list_for_each_entry(t, &m->transfers, transfer_list) { | 271 | list_for_each_entry(t, &m->transfers, transfer_list) { |
254 | ret += bcm63xx_txrx_bufs(spi, t); | 272 | unsigned int len = t->len; |
255 | } | 273 | u8 rx_tail; |
256 | 274 | ||
257 | m->complete(m->context); | 275 | status = bcm63xx_spi_check_transfer(spi, t); |
276 | if (status < 0) | ||
277 | goto exit; | ||
258 | 278 | ||
259 | return ret; | 279 | /* configure adapter for a new transfer */ |
280 | bcm63xx_spi_setup_transfer(spi, t); | ||
281 | |||
282 | while (len) { | ||
283 | /* send the data */ | ||
284 | len -= bcm63xx_txrx_bufs(spi, t); | ||
285 | |||
286 | timeout = wait_for_completion_timeout(&bs->done, HZ); | ||
287 | if (!timeout) { | ||
288 | status = -ETIMEDOUT; | ||
289 | goto exit; | ||
290 | } | ||
291 | |||
292 | /* read out all data */ | ||
293 | rx_tail = bcm_spi_readb(bs, SPI_RX_TAIL); | ||
294 | |||
295 | /* Read out all the data */ | ||
296 | if (rx_tail) | ||
297 | memcpy_fromio(bs->rx_ptr, bs->rx_io, rx_tail); | ||
298 | } | ||
299 | |||
300 | m->actual_length += t->len; | ||
301 | } | ||
302 | exit: | ||
303 | m->status = status; | ||
304 | spi_finalize_current_message(master); | ||
305 | |||
306 | return 0; | ||
260 | } | 307 | } |
261 | 308 | ||
262 | /* This driver supports single master mode only. Hence | 309 | /* This driver supports single master mode only. Hence |
@@ -267,39 +314,15 @@ static irqreturn_t bcm63xx_spi_interrupt(int irq, void *dev_id) | |||
267 | struct spi_master *master = (struct spi_master *)dev_id; | 314 | struct spi_master *master = (struct spi_master *)dev_id; |
268 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | 315 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
269 | u8 intr; | 316 | u8 intr; |
270 | u16 cmd; | ||
271 | 317 | ||
272 | /* Read interupts and clear them immediately */ | 318 | /* Read interupts and clear them immediately */ |
273 | intr = bcm_spi_readb(bs, SPI_INT_STATUS); | 319 | intr = bcm_spi_readb(bs, SPI_INT_STATUS); |
274 | bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); | 320 | bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS); |
275 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | 321 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); |
276 | 322 | ||
277 | /* A tansfer completed */ | 323 | /* A transfer completed */ |
278 | if (intr & SPI_INTR_CMD_DONE) { | 324 | if (intr & SPI_INTR_CMD_DONE) |
279 | u8 rx_tail; | 325 | complete(&bs->done); |
280 | |||
281 | rx_tail = bcm_spi_readb(bs, SPI_RX_TAIL); | ||
282 | |||
283 | /* Read out all the data */ | ||
284 | if (rx_tail) | ||
285 | memcpy_fromio(bs->rx_ptr, bs->rx_io, rx_tail); | ||
286 | |||
287 | /* See if there is more data to send */ | ||
288 | if (bs->remaining_bytes > 0) { | ||
289 | bcm63xx_spi_fill_tx_fifo(bs); | ||
290 | |||
291 | /* Start the transfer */ | ||
292 | bcm_spi_writew(bs, SPI_HD_W << SPI_MSG_TYPE_SHIFT, | ||
293 | SPI_MSG_CTL); | ||
294 | cmd = bcm_spi_readw(bs, SPI_CMD); | ||
295 | cmd |= SPI_CMD_START_IMMEDIATE; | ||
296 | cmd |= (0 << SPI_CMD_PREPEND_BYTE_CNT_SHIFT); | ||
297 | bcm_spi_writeb(bs, SPI_INTR_CMD_DONE, SPI_INT_MASK); | ||
298 | bcm_spi_writew(bs, cmd, SPI_CMD); | ||
299 | } else { | ||
300 | complete(&bs->done); | ||
301 | } | ||
302 | } | ||
303 | 326 | ||
304 | return IRQ_HANDLED; | 327 | return IRQ_HANDLED; |
305 | } | 328 | } |
@@ -345,7 +368,6 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev) | |||
345 | } | 368 | } |
346 | 369 | ||
347 | bs = spi_master_get_devdata(master); | 370 | bs = spi_master_get_devdata(master); |
348 | init_completion(&bs->done); | ||
349 | 371 | ||
350 | platform_set_drvdata(pdev, master); | 372 | platform_set_drvdata(pdev, master); |
351 | bs->pdev = pdev; | 373 | bs->pdev = pdev; |
@@ -379,12 +401,13 @@ static int __devinit bcm63xx_spi_probe(struct platform_device *pdev) | |||
379 | master->bus_num = pdata->bus_num; | 401 | master->bus_num = pdata->bus_num; |
380 | master->num_chipselect = pdata->num_chipselect; | 402 | master->num_chipselect = pdata->num_chipselect; |
381 | master->setup = bcm63xx_spi_setup; | 403 | master->setup = bcm63xx_spi_setup; |
382 | master->transfer = bcm63xx_transfer; | 404 | master->prepare_transfer_hardware = bcm63xx_spi_prepare_transfer; |
405 | master->unprepare_transfer_hardware = bcm63xx_spi_unprepare_transfer; | ||
406 | master->transfer_one_message = bcm63xx_spi_transfer_one; | ||
407 | master->mode_bits = MODEBITS; | ||
383 | bs->speed_hz = pdata->speed_hz; | 408 | bs->speed_hz = pdata->speed_hz; |
384 | bs->stopping = 0; | ||
385 | bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); | 409 | bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); |
386 | bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); | 410 | bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); |
387 | spin_lock_init(&bs->lock); | ||
388 | 411 | ||
389 | /* Initialize hardware */ | 412 | /* Initialize hardware */ |
390 | clk_enable(bs->clk); | 413 | clk_enable(bs->clk); |
@@ -418,18 +441,16 @@ static int __devexit bcm63xx_spi_remove(struct platform_device *pdev) | |||
418 | struct spi_master *master = platform_get_drvdata(pdev); | 441 | struct spi_master *master = platform_get_drvdata(pdev); |
419 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); | 442 | struct bcm63xx_spi *bs = spi_master_get_devdata(master); |
420 | 443 | ||
444 | spi_unregister_master(master); | ||
445 | |||
421 | /* reset spi block */ | 446 | /* reset spi block */ |
422 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); | 447 | bcm_spi_writeb(bs, 0, SPI_INT_MASK); |
423 | spin_lock(&bs->lock); | ||
424 | bs->stopping = 1; | ||
425 | 448 | ||
426 | /* HW shutdown */ | 449 | /* HW shutdown */ |
427 | clk_disable(bs->clk); | 450 | clk_disable(bs->clk); |
428 | clk_put(bs->clk); | 451 | clk_put(bs->clk); |
429 | 452 | ||
430 | spin_unlock(&bs->lock); | ||
431 | platform_set_drvdata(pdev, 0); | 453 | platform_set_drvdata(pdev, 0); |
432 | spi_unregister_master(master); | ||
433 | 454 | ||
434 | return 0; | 455 | return 0; |
435 | } | 456 | } |
diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c index 248a2cc671a9..1fe51198a622 100644 --- a/drivers/spi/spi-bfin-sport.c +++ b/drivers/spi/spi-bfin-sport.c | |||
@@ -252,19 +252,15 @@ static void | |||
252 | bfin_sport_spi_restore_state(struct bfin_sport_spi_master_data *drv_data) | 252 | bfin_sport_spi_restore_state(struct bfin_sport_spi_master_data *drv_data) |
253 | { | 253 | { |
254 | struct bfin_sport_spi_slave_data *chip = drv_data->cur_chip; | 254 | struct bfin_sport_spi_slave_data *chip = drv_data->cur_chip; |
255 | unsigned int bits = (drv_data->ops == &bfin_sport_transfer_ops_u8 ? 7 : 15); | ||
256 | 255 | ||
257 | bfin_sport_spi_disable(drv_data); | 256 | bfin_sport_spi_disable(drv_data); |
258 | dev_dbg(drv_data->dev, "restoring spi ctl state\n"); | 257 | dev_dbg(drv_data->dev, "restoring spi ctl state\n"); |
259 | 258 | ||
260 | bfin_write(&drv_data->regs->tcr1, chip->ctl_reg); | 259 | bfin_write(&drv_data->regs->tcr1, chip->ctl_reg); |
261 | bfin_write(&drv_data->regs->tcr2, bits); | ||
262 | bfin_write(&drv_data->regs->tclkdiv, chip->baud); | 260 | bfin_write(&drv_data->regs->tclkdiv, chip->baud); |
263 | bfin_write(&drv_data->regs->tfsdiv, bits); | ||
264 | SSYNC(); | 261 | SSYNC(); |
265 | 262 | ||
266 | bfin_write(&drv_data->regs->rcr1, chip->ctl_reg & ~(ITCLK | ITFS)); | 263 | bfin_write(&drv_data->regs->rcr1, chip->ctl_reg & ~(ITCLK | ITFS)); |
267 | bfin_write(&drv_data->regs->rcr2, bits); | ||
268 | SSYNC(); | 264 | SSYNC(); |
269 | 265 | ||
270 | bfin_sport_spi_cs_active(chip); | 266 | bfin_sport_spi_cs_active(chip); |
@@ -420,11 +416,15 @@ bfin_sport_spi_pump_transfers(unsigned long data) | |||
420 | drv_data->cs_change = transfer->cs_change; | 416 | drv_data->cs_change = transfer->cs_change; |
421 | 417 | ||
422 | /* Bits per word setup */ | 418 | /* Bits per word setup */ |
423 | bits_per_word = transfer->bits_per_word ? : message->spi->bits_per_word; | 419 | bits_per_word = transfer->bits_per_word ? : |
424 | if (bits_per_word == 8) | 420 | message->spi->bits_per_word ? : 8; |
425 | drv_data->ops = &bfin_sport_transfer_ops_u8; | 421 | if (bits_per_word % 16 == 0) |
426 | else | ||
427 | drv_data->ops = &bfin_sport_transfer_ops_u16; | 422 | drv_data->ops = &bfin_sport_transfer_ops_u16; |
423 | else | ||
424 | drv_data->ops = &bfin_sport_transfer_ops_u8; | ||
425 | bfin_write(&drv_data->regs->tcr2, bits_per_word - 1); | ||
426 | bfin_write(&drv_data->regs->tfsdiv, bits_per_word - 1); | ||
427 | bfin_write(&drv_data->regs->rcr2, bits_per_word - 1); | ||
428 | 428 | ||
429 | drv_data->state = RUNNING_STATE; | 429 | drv_data->state = RUNNING_STATE; |
430 | 430 | ||
@@ -598,11 +598,12 @@ bfin_sport_spi_setup(struct spi_device *spi) | |||
598 | } | 598 | } |
599 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; | 599 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; |
600 | chip->idle_tx_val = chip_info->idle_tx_val; | 600 | chip->idle_tx_val = chip_info->idle_tx_val; |
601 | spi->bits_per_word = chip_info->bits_per_word; | ||
602 | } | 601 | } |
603 | } | 602 | } |
604 | 603 | ||
605 | if (spi->bits_per_word != 8 && spi->bits_per_word != 16) { | 604 | if (spi->bits_per_word % 8) { |
605 | dev_err(&spi->dev, "%d bits_per_word is not supported\n", | ||
606 | spi->bits_per_word); | ||
606 | ret = -EINVAL; | 607 | ret = -EINVAL; |
607 | goto error; | 608 | goto error; |
608 | } | 609 | } |
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c index 3b83ff8b1e2b..9bb4d4af8547 100644 --- a/drivers/spi/spi-bfin5xx.c +++ b/drivers/spi/spi-bfin5xx.c | |||
@@ -396,7 +396,7 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
396 | /* last read */ | 396 | /* last read */ |
397 | if (drv_data->rx) { | 397 | if (drv_data->rx) { |
398 | dev_dbg(&drv_data->pdev->dev, "last read\n"); | 398 | dev_dbg(&drv_data->pdev->dev, "last read\n"); |
399 | if (n_bytes % 2) { | 399 | if (!(n_bytes % 2)) { |
400 | u16 *buf = (u16 *)drv_data->rx; | 400 | u16 *buf = (u16 *)drv_data->rx; |
401 | for (loop = 0; loop < n_bytes / 2; loop++) | 401 | for (loop = 0; loop < n_bytes / 2; loop++) |
402 | *buf++ = bfin_read(&drv_data->regs->rdbr); | 402 | *buf++ = bfin_read(&drv_data->regs->rdbr); |
@@ -424,7 +424,7 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
424 | if (drv_data->rx && drv_data->tx) { | 424 | if (drv_data->rx && drv_data->tx) { |
425 | /* duplex */ | 425 | /* duplex */ |
426 | dev_dbg(&drv_data->pdev->dev, "duplex: write_TDBR\n"); | 426 | dev_dbg(&drv_data->pdev->dev, "duplex: write_TDBR\n"); |
427 | if (n_bytes % 2) { | 427 | if (!(n_bytes % 2)) { |
428 | u16 *buf = (u16 *)drv_data->rx; | 428 | u16 *buf = (u16 *)drv_data->rx; |
429 | u16 *buf2 = (u16 *)drv_data->tx; | 429 | u16 *buf2 = (u16 *)drv_data->tx; |
430 | for (loop = 0; loop < n_bytes / 2; loop++) { | 430 | for (loop = 0; loop < n_bytes / 2; loop++) { |
@@ -442,7 +442,7 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
442 | } else if (drv_data->rx) { | 442 | } else if (drv_data->rx) { |
443 | /* read */ | 443 | /* read */ |
444 | dev_dbg(&drv_data->pdev->dev, "read: write_TDBR\n"); | 444 | dev_dbg(&drv_data->pdev->dev, "read: write_TDBR\n"); |
445 | if (n_bytes % 2) { | 445 | if (!(n_bytes % 2)) { |
446 | u16 *buf = (u16 *)drv_data->rx; | 446 | u16 *buf = (u16 *)drv_data->rx; |
447 | for (loop = 0; loop < n_bytes / 2; loop++) { | 447 | for (loop = 0; loop < n_bytes / 2; loop++) { |
448 | *buf++ = bfin_read(&drv_data->regs->rdbr); | 448 | *buf++ = bfin_read(&drv_data->regs->rdbr); |
@@ -458,7 +458,7 @@ static irqreturn_t bfin_spi_pio_irq_handler(int irq, void *dev_id) | |||
458 | } else if (drv_data->tx) { | 458 | } else if (drv_data->tx) { |
459 | /* write */ | 459 | /* write */ |
460 | dev_dbg(&drv_data->pdev->dev, "write: write_TDBR\n"); | 460 | dev_dbg(&drv_data->pdev->dev, "write: write_TDBR\n"); |
461 | if (n_bytes % 2) { | 461 | if (!(n_bytes % 2)) { |
462 | u16 *buf = (u16 *)drv_data->tx; | 462 | u16 *buf = (u16 *)drv_data->tx; |
463 | for (loop = 0; loop < n_bytes / 2; loop++) { | 463 | for (loop = 0; loop < n_bytes / 2; loop++) { |
464 | bfin_read(&drv_data->regs->rdbr); | 464 | bfin_read(&drv_data->regs->rdbr); |
@@ -587,6 +587,7 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
587 | if (message->state == DONE_STATE) { | 587 | if (message->state == DONE_STATE) { |
588 | dev_dbg(&drv_data->pdev->dev, "transfer: all done!\n"); | 588 | dev_dbg(&drv_data->pdev->dev, "transfer: all done!\n"); |
589 | message->status = 0; | 589 | message->status = 0; |
590 | bfin_spi_flush(drv_data); | ||
590 | bfin_spi_giveback(drv_data); | 591 | bfin_spi_giveback(drv_data); |
591 | return; | 592 | return; |
592 | } | 593 | } |
@@ -870,8 +871,10 @@ static void bfin_spi_pump_transfers(unsigned long data) | |||
870 | message->actual_length += drv_data->len_in_bytes; | 871 | message->actual_length += drv_data->len_in_bytes; |
871 | /* Move to next transfer of this msg */ | 872 | /* Move to next transfer of this msg */ |
872 | message->state = bfin_spi_next_transfer(drv_data); | 873 | message->state = bfin_spi_next_transfer(drv_data); |
873 | if (drv_data->cs_change) | 874 | if (drv_data->cs_change && message->state != DONE_STATE) { |
875 | bfin_spi_flush(drv_data); | ||
874 | bfin_spi_cs_deactive(drv_data, chip); | 876 | bfin_spi_cs_deactive(drv_data, chip); |
877 | } | ||
875 | } | 878 | } |
876 | 879 | ||
877 | /* Schedule next transfer tasklet */ | 880 | /* Schedule next transfer tasklet */ |
@@ -1026,7 +1029,6 @@ static int bfin_spi_setup(struct spi_device *spi) | |||
1026 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; | 1029 | chip->cs_chg_udelay = chip_info->cs_chg_udelay; |
1027 | chip->idle_tx_val = chip_info->idle_tx_val; | 1030 | chip->idle_tx_val = chip_info->idle_tx_val; |
1028 | chip->pio_interrupt = chip_info->pio_interrupt; | 1031 | chip->pio_interrupt = chip_info->pio_interrupt; |
1029 | spi->bits_per_word = chip_info->bits_per_word; | ||
1030 | } else { | 1032 | } else { |
1031 | /* force a default base state */ | 1033 | /* force a default base state */ |
1032 | chip->ctl_reg &= bfin_ctl_reg; | 1034 | chip->ctl_reg &= bfin_ctl_reg; |
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index 6db2887852d6..e8055073e84d 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c | |||
@@ -545,13 +545,12 @@ static void ep93xx_spi_pio_transfer(struct ep93xx_spi *espi) | |||
545 | * in case of failure. | 545 | * in case of failure. |
546 | */ | 546 | */ |
547 | static struct dma_async_tx_descriptor * | 547 | static struct dma_async_tx_descriptor * |
548 | ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | 548 | ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_transfer_direction dir) |
549 | { | 549 | { |
550 | struct spi_transfer *t = espi->current_msg->state; | 550 | struct spi_transfer *t = espi->current_msg->state; |
551 | struct dma_async_tx_descriptor *txd; | 551 | struct dma_async_tx_descriptor *txd; |
552 | enum dma_slave_buswidth buswidth; | 552 | enum dma_slave_buswidth buswidth; |
553 | struct dma_slave_config conf; | 553 | struct dma_slave_config conf; |
554 | enum dma_transfer_direction slave_dirn; | ||
555 | struct scatterlist *sg; | 554 | struct scatterlist *sg; |
556 | struct sg_table *sgt; | 555 | struct sg_table *sgt; |
557 | struct dma_chan *chan; | 556 | struct dma_chan *chan; |
@@ -567,14 +566,13 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
567 | memset(&conf, 0, sizeof(conf)); | 566 | memset(&conf, 0, sizeof(conf)); |
568 | conf.direction = dir; | 567 | conf.direction = dir; |
569 | 568 | ||
570 | if (dir == DMA_FROM_DEVICE) { | 569 | if (dir == DMA_DEV_TO_MEM) { |
571 | chan = espi->dma_rx; | 570 | chan = espi->dma_rx; |
572 | buf = t->rx_buf; | 571 | buf = t->rx_buf; |
573 | sgt = &espi->rx_sgt; | 572 | sgt = &espi->rx_sgt; |
574 | 573 | ||
575 | conf.src_addr = espi->sspdr_phys; | 574 | conf.src_addr = espi->sspdr_phys; |
576 | conf.src_addr_width = buswidth; | 575 | conf.src_addr_width = buswidth; |
577 | slave_dirn = DMA_DEV_TO_MEM; | ||
578 | } else { | 576 | } else { |
579 | chan = espi->dma_tx; | 577 | chan = espi->dma_tx; |
580 | buf = t->tx_buf; | 578 | buf = t->tx_buf; |
@@ -582,7 +580,6 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
582 | 580 | ||
583 | conf.dst_addr = espi->sspdr_phys; | 581 | conf.dst_addr = espi->sspdr_phys; |
584 | conf.dst_addr_width = buswidth; | 582 | conf.dst_addr_width = buswidth; |
585 | slave_dirn = DMA_MEM_TO_DEV; | ||
586 | } | 583 | } |
587 | 584 | ||
588 | ret = dmaengine_slave_config(chan, &conf); | 585 | ret = dmaengine_slave_config(chan, &conf); |
@@ -633,8 +630,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
633 | if (!nents) | 630 | if (!nents) |
634 | return ERR_PTR(-ENOMEM); | 631 | return ERR_PTR(-ENOMEM); |
635 | 632 | ||
636 | txd = dmaengine_prep_slave_sg(chan, sgt->sgl, nents, | 633 | txd = dmaengine_prep_slave_sg(chan, sgt->sgl, nents, dir, DMA_CTRL_ACK); |
637 | slave_dirn, DMA_CTRL_ACK); | ||
638 | if (!txd) { | 634 | if (!txd) { |
639 | dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); | 635 | dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); |
640 | return ERR_PTR(-ENOMEM); | 636 | return ERR_PTR(-ENOMEM); |
@@ -651,12 +647,12 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
651 | * unmapped. | 647 | * unmapped. |
652 | */ | 648 | */ |
653 | static void ep93xx_spi_dma_finish(struct ep93xx_spi *espi, | 649 | static void ep93xx_spi_dma_finish(struct ep93xx_spi *espi, |
654 | enum dma_data_direction dir) | 650 | enum dma_transfer_direction dir) |
655 | { | 651 | { |
656 | struct dma_chan *chan; | 652 | struct dma_chan *chan; |
657 | struct sg_table *sgt; | 653 | struct sg_table *sgt; |
658 | 654 | ||
659 | if (dir == DMA_FROM_DEVICE) { | 655 | if (dir == DMA_DEV_TO_MEM) { |
660 | chan = espi->dma_rx; | 656 | chan = espi->dma_rx; |
661 | sgt = &espi->rx_sgt; | 657 | sgt = &espi->rx_sgt; |
662 | } else { | 658 | } else { |
@@ -677,16 +673,16 @@ static void ep93xx_spi_dma_transfer(struct ep93xx_spi *espi) | |||
677 | struct spi_message *msg = espi->current_msg; | 673 | struct spi_message *msg = espi->current_msg; |
678 | struct dma_async_tx_descriptor *rxd, *txd; | 674 | struct dma_async_tx_descriptor *rxd, *txd; |
679 | 675 | ||
680 | rxd = ep93xx_spi_dma_prepare(espi, DMA_FROM_DEVICE); | 676 | rxd = ep93xx_spi_dma_prepare(espi, DMA_DEV_TO_MEM); |
681 | if (IS_ERR(rxd)) { | 677 | if (IS_ERR(rxd)) { |
682 | dev_err(&espi->pdev->dev, "DMA RX failed: %ld\n", PTR_ERR(rxd)); | 678 | dev_err(&espi->pdev->dev, "DMA RX failed: %ld\n", PTR_ERR(rxd)); |
683 | msg->status = PTR_ERR(rxd); | 679 | msg->status = PTR_ERR(rxd); |
684 | return; | 680 | return; |
685 | } | 681 | } |
686 | 682 | ||
687 | txd = ep93xx_spi_dma_prepare(espi, DMA_TO_DEVICE); | 683 | txd = ep93xx_spi_dma_prepare(espi, DMA_MEM_TO_DEV); |
688 | if (IS_ERR(txd)) { | 684 | if (IS_ERR(txd)) { |
689 | ep93xx_spi_dma_finish(espi, DMA_FROM_DEVICE); | 685 | ep93xx_spi_dma_finish(espi, DMA_DEV_TO_MEM); |
690 | dev_err(&espi->pdev->dev, "DMA TX failed: %ld\n", PTR_ERR(rxd)); | 686 | dev_err(&espi->pdev->dev, "DMA TX failed: %ld\n", PTR_ERR(rxd)); |
691 | msg->status = PTR_ERR(txd); | 687 | msg->status = PTR_ERR(txd); |
692 | return; | 688 | return; |
@@ -705,8 +701,8 @@ static void ep93xx_spi_dma_transfer(struct ep93xx_spi *espi) | |||
705 | 701 | ||
706 | wait_for_completion(&espi->wait); | 702 | wait_for_completion(&espi->wait); |
707 | 703 | ||
708 | ep93xx_spi_dma_finish(espi, DMA_TO_DEVICE); | 704 | ep93xx_spi_dma_finish(espi, DMA_MEM_TO_DEV); |
709 | ep93xx_spi_dma_finish(espi, DMA_FROM_DEVICE); | 705 | ep93xx_spi_dma_finish(espi, DMA_DEV_TO_MEM); |
710 | } | 706 | } |
711 | 707 | ||
712 | /** | 708 | /** |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 09c925aaf320..400ae2121a2a 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -1667,9 +1667,15 @@ static int calculate_effective_freq(struct pl022 *pl022, int freq, struct | |||
1667 | /* cpsdvsr = 254 & scr = 255 */ | 1667 | /* cpsdvsr = 254 & scr = 255 */ |
1668 | min_tclk = spi_rate(rate, CPSDVR_MAX, SCR_MAX); | 1668 | min_tclk = spi_rate(rate, CPSDVR_MAX, SCR_MAX); |
1669 | 1669 | ||
1670 | if (!((freq <= max_tclk) && (freq >= min_tclk))) { | 1670 | if (freq > max_tclk) |
1671 | dev_warn(&pl022->adev->dev, | ||
1672 | "Max speed that can be programmed is %d Hz, you requested %d\n", | ||
1673 | max_tclk, freq); | ||
1674 | |||
1675 | if (freq < min_tclk) { | ||
1671 | dev_err(&pl022->adev->dev, | 1676 | dev_err(&pl022->adev->dev, |
1672 | "controller data is incorrect: out of range frequency"); | 1677 | "Requested frequency: %d Hz is less than minimum possible %d Hz\n", |
1678 | freq, min_tclk); | ||
1673 | return -EINVAL; | 1679 | return -EINVAL; |
1674 | } | 1680 | } |
1675 | 1681 | ||
@@ -1681,26 +1687,37 @@ static int calculate_effective_freq(struct pl022 *pl022, int freq, struct | |||
1681 | while (scr <= SCR_MAX) { | 1687 | while (scr <= SCR_MAX) { |
1682 | tmp = spi_rate(rate, cpsdvsr, scr); | 1688 | tmp = spi_rate(rate, cpsdvsr, scr); |
1683 | 1689 | ||
1684 | if (tmp > freq) | 1690 | if (tmp > freq) { |
1691 | /* we need lower freq */ | ||
1685 | scr++; | 1692 | scr++; |
1693 | continue; | ||
1694 | } | ||
1695 | |||
1686 | /* | 1696 | /* |
1687 | * If found exact value, update and break. | 1697 | * If found exact value, mark found and break. |
1688 | * If found more closer value, update and continue. | 1698 | * If found more closer value, update and break. |
1689 | */ | 1699 | */ |
1690 | else if ((tmp == freq) || (tmp > best_freq)) { | 1700 | if (tmp > best_freq) { |
1691 | best_freq = tmp; | 1701 | best_freq = tmp; |
1692 | best_cpsdvsr = cpsdvsr; | 1702 | best_cpsdvsr = cpsdvsr; |
1693 | best_scr = scr; | 1703 | best_scr = scr; |
1694 | 1704 | ||
1695 | if (tmp == freq) | 1705 | if (tmp == freq) |
1696 | break; | 1706 | found = 1; |
1697 | } | 1707 | } |
1698 | scr++; | 1708 | /* |
1709 | * increased scr will give lower rates, which are not | ||
1710 | * required | ||
1711 | */ | ||
1712 | break; | ||
1699 | } | 1713 | } |
1700 | cpsdvsr += 2; | 1714 | cpsdvsr += 2; |
1701 | scr = SCR_MIN; | 1715 | scr = SCR_MIN; |
1702 | } | 1716 | } |
1703 | 1717 | ||
1718 | WARN(!best_freq, "pl022: Matching cpsdvsr and scr not found for %d Hz rate \n", | ||
1719 | freq); | ||
1720 | |||
1704 | clk_freq->cpsdvsr = (u8) (best_cpsdvsr & 0xFF); | 1721 | clk_freq->cpsdvsr = (u8) (best_cpsdvsr & 0xFF); |
1705 | clk_freq->scr = (u8) (best_scr & 0xFF); | 1722 | clk_freq->scr = (u8) (best_scr & 0xFF); |
1706 | dev_dbg(&pl022->adev->dev, | 1723 | dev_dbg(&pl022->adev->dev, |
@@ -1823,9 +1840,12 @@ static int pl022_setup(struct spi_device *spi) | |||
1823 | } else | 1840 | } else |
1824 | chip->cs_control = chip_info->cs_control; | 1841 | chip->cs_control = chip_info->cs_control; |
1825 | 1842 | ||
1826 | if (bits <= 3) { | 1843 | /* Check bits per word with vendor specific range */ |
1827 | /* PL022 doesn't support less than 4-bits */ | 1844 | if ((bits <= 3) || (bits > pl022->vendor->max_bpw)) { |
1828 | status = -ENOTSUPP; | 1845 | status = -ENOTSUPP; |
1846 | dev_err(&spi->dev, "illegal data size for this controller!\n"); | ||
1847 | dev_err(&spi->dev, "This controller can only handle 4 <= n <= %d bit words\n", | ||
1848 | pl022->vendor->max_bpw); | ||
1829 | goto err_config_params; | 1849 | goto err_config_params; |
1830 | } else if (bits <= 8) { | 1850 | } else if (bits <= 8) { |
1831 | dev_dbg(&spi->dev, "4 <= n <=8 bits per word\n"); | 1851 | dev_dbg(&spi->dev, "4 <= n <=8 bits per word\n"); |
@@ -1838,20 +1858,10 @@ static int pl022_setup(struct spi_device *spi) | |||
1838 | chip->read = READING_U16; | 1858 | chip->read = READING_U16; |
1839 | chip->write = WRITING_U16; | 1859 | chip->write = WRITING_U16; |
1840 | } else { | 1860 | } else { |
1841 | if (pl022->vendor->max_bpw >= 32) { | 1861 | dev_dbg(&spi->dev, "17 <= n <= 32 bits per word\n"); |
1842 | dev_dbg(&spi->dev, "17 <= n <= 32 bits per word\n"); | 1862 | chip->n_bytes = 4; |
1843 | chip->n_bytes = 4; | 1863 | chip->read = READING_U32; |
1844 | chip->read = READING_U32; | 1864 | chip->write = WRITING_U32; |
1845 | chip->write = WRITING_U32; | ||
1846 | } else { | ||
1847 | dev_err(&spi->dev, | ||
1848 | "illegal data size for this controller!\n"); | ||
1849 | dev_err(&spi->dev, | ||
1850 | "a standard pl022 can only handle " | ||
1851 | "1 <= n <= 16 bit words\n"); | ||
1852 | status = -ENOTSUPP; | ||
1853 | goto err_config_params; | ||
1854 | } | ||
1855 | } | 1865 | } |
1856 | 1866 | ||
1857 | /* Now Initialize all register settings required for this chip */ | 1867 | /* Now Initialize all register settings required for this chip */ |
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index 400df8cbee53..d91751f9ffe8 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/prefetch.h> | 36 | #include <linux/prefetch.h> |
37 | #include <linux/ratelimit.h> | 37 | #include <linux/ratelimit.h> |
38 | #include <linux/smp.h> | 38 | #include <linux/smp.h> |
39 | #include <linux/interrupt.h> | ||
39 | #include <net/dst.h> | 40 | #include <net/dst.h> |
40 | #ifdef CONFIG_XFRM | 41 | #ifdef CONFIG_XFRM |
41 | #include <linux/xfrm.h> | 42 | #include <linux/xfrm.h> |
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 56d74dc2fbd5..91a97b3e45c6 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/ip.h> | 32 | #include <linux/ip.h> |
33 | #include <linux/ratelimit.h> | 33 | #include <linux/ratelimit.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/interrupt.h> | ||
35 | #include <net/dst.h> | 36 | #include <net/dst.h> |
36 | #ifdef CONFIG_XFRM | 37 | #ifdef CONFIG_XFRM |
37 | #include <linux/xfrm.h> | 38 | #include <linux/xfrm.h> |
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 9112cd882154..60cba8194de3 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/etherdevice.h> | 31 | #include <linux/etherdevice.h> |
32 | #include <linux/phy.h> | 32 | #include <linux/phy.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/interrupt.h> | ||
34 | 35 | ||
35 | #include <net/dst.h> | 36 | #include <net/dst.h> |
36 | 37 | ||
diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 2b45d3d1800c..04cd57f2a6da 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c | |||
@@ -383,8 +383,6 @@ static void oz_tx_frame_free(struct oz_pd *pd, struct oz_tx_frame *f) | |||
383 | pd->tx_pool = &f->link; | 383 | pd->tx_pool = &f->link; |
384 | pd->tx_pool_count++; | 384 | pd->tx_pool_count++; |
385 | f = 0; | 385 | f = 0; |
386 | } else { | ||
387 | kfree(f); | ||
388 | } | 386 | } |
389 | spin_unlock_bh(&pd->tx_frame_lock); | 387 | spin_unlock_bh(&pd->tx_frame_lock); |
390 | if (f) | 388 | if (f) |
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c index 7862513cc295..9cf29fcea11e 100644 --- a/drivers/staging/tidspbridge/core/tiomap3430.c +++ b/drivers/staging/tidspbridge/core/tiomap3430.c | |||
@@ -79,10 +79,6 @@ | |||
79 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) | 79 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) |
80 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) | 80 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) |
81 | 81 | ||
82 | #define OMAP343X_CTRL_REGADDR(reg) \ | ||
83 | OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg)) | ||
84 | |||
85 | |||
86 | /* Forward Declarations: */ | 82 | /* Forward Declarations: */ |
87 | static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt); | 83 | static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt); |
88 | static int bridge_brd_read(struct bridge_dev_context *dev_ctxt, | 84 | static int bridge_brd_read(struct bridge_dev_context *dev_ctxt, |
@@ -418,19 +414,27 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt, | |||
418 | 414 | ||
419 | /* Assert RST1 i.e only the RST only for DSP megacell */ | 415 | /* Assert RST1 i.e only the RST only for DSP megacell */ |
420 | if (!status) { | 416 | if (!status) { |
417 | /* | ||
418 | * XXX: ioremapping MUST be removed once ctrl | ||
419 | * function is made available. | ||
420 | */ | ||
421 | void __iomem *ctrl = ioremap(OMAP343X_CTRL_BASE, SZ_4K); | ||
422 | if (!ctrl) | ||
423 | return -ENOMEM; | ||
424 | |||
421 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, | 425 | (*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK, |
422 | OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, | 426 | OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD, |
423 | OMAP2_RM_RSTCTRL); | 427 | OMAP2_RM_RSTCTRL); |
424 | /* Mask address with 1K for compatibility */ | 428 | /* Mask address with 1K for compatibility */ |
425 | __raw_writel(dsp_addr & OMAP3_IVA2_BOOTADDR_MASK, | 429 | __raw_writel(dsp_addr & OMAP3_IVA2_BOOTADDR_MASK, |
426 | OMAP343X_CTRL_REGADDR( | 430 | ctrl + OMAP343X_CONTROL_IVA2_BOOTADDR); |
427 | OMAP343X_CONTROL_IVA2_BOOTADDR)); | ||
428 | /* | 431 | /* |
429 | * Set bootmode to self loop if dsp_debug flag is true | 432 | * Set bootmode to self loop if dsp_debug flag is true |
430 | */ | 433 | */ |
431 | __raw_writel((dsp_debug) ? OMAP3_IVA2_BOOTMOD_IDLE : 0, | 434 | __raw_writel((dsp_debug) ? OMAP3_IVA2_BOOTMOD_IDLE : 0, |
432 | OMAP343X_CTRL_REGADDR( | 435 | ctrl + OMAP343X_CONTROL_IVA2_BOOTMOD); |
433 | OMAP343X_CONTROL_IVA2_BOOTMOD)); | 436 | |
437 | iounmap(ctrl); | ||
434 | } | 438 | } |
435 | } | 439 | } |
436 | if (!status) { | 440 | if (!status) { |
diff --git a/drivers/staging/tidspbridge/core/wdt.c b/drivers/staging/tidspbridge/core/wdt.c index 70055c8111ed..870f934f4f3b 100644 --- a/drivers/staging/tidspbridge/core/wdt.c +++ b/drivers/staging/tidspbridge/core/wdt.c | |||
@@ -53,7 +53,10 @@ int dsp_wdt_init(void) | |||
53 | int ret = 0; | 53 | int ret = 0; |
54 | 54 | ||
55 | dsp_wdt.sm_wdt = NULL; | 55 | dsp_wdt.sm_wdt = NULL; |
56 | dsp_wdt.reg_base = OMAP2_L4_IO_ADDRESS(OMAP34XX_WDT3_BASE); | 56 | dsp_wdt.reg_base = ioremap(OMAP34XX_WDT3_BASE, SZ_4K); |
57 | if (!dsp_wdt.reg_base) | ||
58 | return -ENOMEM; | ||
59 | |||
57 | tasklet_init(&dsp_wdt.wdt3_tasklet, dsp_wdt_dpc, 0); | 60 | tasklet_init(&dsp_wdt.wdt3_tasklet, dsp_wdt_dpc, 0); |
58 | 61 | ||
59 | dsp_wdt.fclk = clk_get(NULL, "wdt3_fck"); | 62 | dsp_wdt.fclk = clk_get(NULL, "wdt3_fck"); |
@@ -99,6 +102,9 @@ void dsp_wdt_exit(void) | |||
99 | dsp_wdt.fclk = NULL; | 102 | dsp_wdt.fclk = NULL; |
100 | dsp_wdt.iclk = NULL; | 103 | dsp_wdt.iclk = NULL; |
101 | dsp_wdt.sm_wdt = NULL; | 104 | dsp_wdt.sm_wdt = NULL; |
105 | |||
106 | if (dsp_wdt.reg_base) | ||
107 | iounmap(dsp_wdt.reg_base); | ||
102 | dsp_wdt.reg_base = NULL; | 108 | dsp_wdt.reg_base = NULL; |
103 | } | 109 | } |
104 | 110 | ||
diff --git a/drivers/staging/zcache/Kconfig b/drivers/staging/zcache/Kconfig index 3ed2c8f656a5..7048e01f0817 100644 --- a/drivers/staging/zcache/Kconfig +++ b/drivers/staging/zcache/Kconfig | |||
@@ -2,7 +2,7 @@ config ZCACHE | |||
2 | bool "Dynamic compression of swap pages and clean pagecache pages" | 2 | bool "Dynamic compression of swap pages and clean pagecache pages" |
3 | # X86 dependency is because zsmalloc uses non-portable pte/tlb | 3 | # X86 dependency is because zsmalloc uses non-portable pte/tlb |
4 | # functions | 4 | # functions |
5 | depends on (CLEANCACHE || FRONTSWAP) && CRYPTO && X86 | 5 | depends on (CLEANCACHE || FRONTSWAP) && CRYPTO=y && X86 |
6 | select ZSMALLOC | 6 | select ZSMALLOC |
7 | select CRYPTO_LZO | 7 | select CRYPTO_LZO |
8 | default n | 8 | default n |
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 24145c30c9b0..6cc4358f68c1 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -1073,8 +1073,10 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
1073 | (new_serial.close_delay != port->close_delay) || | 1073 | (new_serial.close_delay != port->close_delay) || |
1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || | 1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || |
1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != | 1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != |
1076 | (port->flags & ~ASYNC_USR_MASK))) | 1076 | (port->flags & ~ASYNC_USR_MASK))) { |
1077 | tty_unlock(); | ||
1077 | return -EPERM; | 1078 | return -EPERM; |
1079 | } | ||
1078 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | | 1080 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | |
1079 | (new_serial.flags & ASYNC_USR_MASK)); | 1081 | (new_serial.flags & ASYNC_USR_MASK)); |
1080 | state->custom_divisor = new_serial.custom_divisor; | 1082 | state->custom_divisor = new_serial.custom_divisor; |
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index e6c3dbd781d6..836fe2731234 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
@@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | |||
154 | port->x_char = 0; | 154 | port->x_char = 0; |
155 | return IRQ_HANDLED; | 155 | return IRQ_HANDLED; |
156 | } | 156 | } |
157 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { | 157 | |
158 | clps711xuart_stop_tx(port); | 158 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) |
159 | return IRQ_HANDLED; | 159 | goto disable_tx_irq; |
160 | } | ||
161 | 160 | ||
162 | count = port->fifosize >> 1; | 161 | count = port->fifosize >> 1; |
163 | do { | 162 | do { |
@@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | |||
171 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 170 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
172 | uart_write_wakeup(port); | 171 | uart_write_wakeup(port); |
173 | 172 | ||
174 | if (uart_circ_empty(xmit)) | 173 | if (uart_circ_empty(xmit)) { |
175 | clps711xuart_stop_tx(port); | 174 | disable_tx_irq: |
175 | disable_irq_nosync(TX_IRQ(port)); | ||
176 | tx_enabled(port) = 0; | ||
177 | } | ||
176 | 178 | ||
177 | return IRQ_HANDLED; | 179 | return IRQ_HANDLED; |
178 | } | 180 | } |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index bbbec4a74cfb..c2816f494807 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -1447,9 +1447,11 @@ static int pch_uart_verify_port(struct uart_port *port, | |||
1447 | __func__); | 1447 | __func__); |
1448 | return -EOPNOTSUPP; | 1448 | return -EOPNOTSUPP; |
1449 | #endif | 1449 | #endif |
1450 | priv->use_dma = 1; | ||
1451 | priv->use_dma_flag = 1; | 1450 | priv->use_dma_flag = 1; |
1452 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); | 1451 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); |
1452 | if (!priv->use_dma) | ||
1453 | pch_request_dma(port); | ||
1454 | priv->use_dma = 1; | ||
1453 | } | 1455 | } |
1454 | 1456 | ||
1455 | return 0; | 1457 | return 0; |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index 08ebe901bb59..654755a990df 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
@@ -469,7 +469,7 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
469 | tty = NULL; | 469 | tty = NULL; |
470 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { | 470 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { |
471 | if (!ZS_IS_OPEN(uap_a)) { | 471 | if (!ZS_IS_OPEN(uap_a)) { |
472 | pmz_debug("ChanA interrupt while open !\n"); | 472 | pmz_debug("ChanA interrupt while not open !\n"); |
473 | goto skip_a; | 473 | goto skip_a; |
474 | } | 474 | } |
475 | write_zsreg(uap_a, R0, RES_H_IUS); | 475 | write_zsreg(uap_a, R0, RES_H_IUS); |
@@ -493,8 +493,8 @@ static irqreturn_t pmz_interrupt(int irq, void *dev_id) | |||
493 | spin_lock(&uap_b->port.lock); | 493 | spin_lock(&uap_b->port.lock); |
494 | tty = NULL; | 494 | tty = NULL; |
495 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { | 495 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { |
496 | if (!ZS_IS_OPEN(uap_a)) { | 496 | if (!ZS_IS_OPEN(uap_b)) { |
497 | pmz_debug("ChanB interrupt while open !\n"); | 497 | pmz_debug("ChanB interrupt while not open !\n"); |
498 | goto skip_b; | 498 | goto skip_b; |
499 | } | 499 | } |
500 | write_zsreg(uap_b, R0, RES_H_IUS); | 500 | write_zsreg(uap_b, R0, RES_H_IUS); |
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c index 86dd1e302bb3..29ca20dbd335 100644 --- a/drivers/tty/vt/keyboard.c +++ b/drivers/tty/vt/keyboard.c | |||
@@ -1085,15 +1085,21 @@ void vt_set_led_state(int console, int leds) | |||
1085 | * | 1085 | * |
1086 | * Handle console start. This is a wrapper for the VT layer | 1086 | * Handle console start. This is a wrapper for the VT layer |
1087 | * so that we can keep kbd knowledge internal | 1087 | * so that we can keep kbd knowledge internal |
1088 | * | ||
1089 | * FIXME: We eventually need to hold the kbd lock here to protect | ||
1090 | * the LED updating. We can't do it yet because fn_hold calls stop_tty | ||
1091 | * and start_tty under the kbd_event_lock, while normal tty paths | ||
1092 | * don't hold the lock. We probably need to split out an LED lock | ||
1093 | * but not during an -rc release! | ||
1088 | */ | 1094 | */ |
1089 | void vt_kbd_con_start(int console) | 1095 | void vt_kbd_con_start(int console) |
1090 | { | 1096 | { |
1091 | struct kbd_struct * kbd = kbd_table + console; | 1097 | struct kbd_struct * kbd = kbd_table + console; |
1092 | unsigned long flags; | 1098 | /* unsigned long flags; */ |
1093 | spin_lock_irqsave(&kbd_event_lock, flags); | 1099 | /* spin_lock_irqsave(&kbd_event_lock, flags); */ |
1094 | clr_vc_kbd_led(kbd, VC_SCROLLOCK); | 1100 | clr_vc_kbd_led(kbd, VC_SCROLLOCK); |
1095 | set_leds(); | 1101 | set_leds(); |
1096 | spin_unlock_irqrestore(&kbd_event_lock, flags); | 1102 | /* spin_unlock_irqrestore(&kbd_event_lock, flags); */ |
1097 | } | 1103 | } |
1098 | 1104 | ||
1099 | /** | 1105 | /** |
@@ -1102,22 +1108,28 @@ void vt_kbd_con_start(int console) | |||
1102 | * | 1108 | * |
1103 | * Handle console stop. This is a wrapper for the VT layer | 1109 | * Handle console stop. This is a wrapper for the VT layer |
1104 | * so that we can keep kbd knowledge internal | 1110 | * so that we can keep kbd knowledge internal |
1111 | * | ||
1112 | * FIXME: We eventually need to hold the kbd lock here to protect | ||
1113 | * the LED updating. We can't do it yet because fn_hold calls stop_tty | ||
1114 | * and start_tty under the kbd_event_lock, while normal tty paths | ||
1115 | * don't hold the lock. We probably need to split out an LED lock | ||
1116 | * but not during an -rc release! | ||
1105 | */ | 1117 | */ |
1106 | void vt_kbd_con_stop(int console) | 1118 | void vt_kbd_con_stop(int console) |
1107 | { | 1119 | { |
1108 | struct kbd_struct * kbd = kbd_table + console; | 1120 | struct kbd_struct * kbd = kbd_table + console; |
1109 | unsigned long flags; | 1121 | /* unsigned long flags; */ |
1110 | spin_lock_irqsave(&kbd_event_lock, flags); | 1122 | /* spin_lock_irqsave(&kbd_event_lock, flags); */ |
1111 | set_vc_kbd_led(kbd, VC_SCROLLOCK); | 1123 | set_vc_kbd_led(kbd, VC_SCROLLOCK); |
1112 | set_leds(); | 1124 | set_leds(); |
1113 | spin_unlock_irqrestore(&kbd_event_lock, flags); | 1125 | /* spin_unlock_irqrestore(&kbd_event_lock, flags); */ |
1114 | } | 1126 | } |
1115 | 1127 | ||
1116 | /* | 1128 | /* |
1117 | * This is the tasklet that updates LED state on all keyboards | 1129 | * This is the tasklet that updates LED state on all keyboards |
1118 | * attached to the box. The reason we use tasklet is that we | 1130 | * attached to the box. The reason we use tasklet is that we |
1119 | * need to handle the scenario when keyboard handler is not | 1131 | * need to handle the scenario when keyboard handler is not |
1120 | * registered yet but we already getting updates form VT to | 1132 | * registered yet but we already getting updates from the VT to |
1121 | * update led state. | 1133 | * update led state. |
1122 | */ | 1134 | */ |
1123 | static void kbd_bh(unsigned long dummy) | 1135 | static void kbd_bh(unsigned long dummy) |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index c6f6560d436c..0bb2b3248dad 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -157,8 +157,9 @@ static void wdm_out_callback(struct urb *urb) | |||
157 | spin_lock(&desc->iuspin); | 157 | spin_lock(&desc->iuspin); |
158 | desc->werr = urb->status; | 158 | desc->werr = urb->status; |
159 | spin_unlock(&desc->iuspin); | 159 | spin_unlock(&desc->iuspin); |
160 | clear_bit(WDM_IN_USE, &desc->flags); | ||
161 | kfree(desc->outbuf); | 160 | kfree(desc->outbuf); |
161 | desc->outbuf = NULL; | ||
162 | clear_bit(WDM_IN_USE, &desc->flags); | ||
162 | wake_up(&desc->wait); | 163 | wake_up(&desc->wait); |
163 | } | 164 | } |
164 | 165 | ||
@@ -338,7 +339,7 @@ static ssize_t wdm_write | |||
338 | if (we < 0) | 339 | if (we < 0) |
339 | return -EIO; | 340 | return -EIO; |
340 | 341 | ||
341 | desc->outbuf = buf = kmalloc(count, GFP_KERNEL); | 342 | buf = kmalloc(count, GFP_KERNEL); |
342 | if (!buf) { | 343 | if (!buf) { |
343 | rv = -ENOMEM; | 344 | rv = -ENOMEM; |
344 | goto outnl; | 345 | goto outnl; |
@@ -406,10 +407,12 @@ static ssize_t wdm_write | |||
406 | req->wIndex = desc->inum; | 407 | req->wIndex = desc->inum; |
407 | req->wLength = cpu_to_le16(count); | 408 | req->wLength = cpu_to_le16(count); |
408 | set_bit(WDM_IN_USE, &desc->flags); | 409 | set_bit(WDM_IN_USE, &desc->flags); |
410 | desc->outbuf = buf; | ||
409 | 411 | ||
410 | rv = usb_submit_urb(desc->command, GFP_KERNEL); | 412 | rv = usb_submit_urb(desc->command, GFP_KERNEL); |
411 | if (rv < 0) { | 413 | if (rv < 0) { |
412 | kfree(buf); | 414 | kfree(buf); |
415 | desc->outbuf = NULL; | ||
413 | clear_bit(WDM_IN_USE, &desc->flags); | 416 | clear_bit(WDM_IN_USE, &desc->flags); |
414 | dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); | 417 | dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv); |
415 | } else { | 418 | } else { |
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 622b4a48e732..57ed9e400c06 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -493,6 +493,15 @@ 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 | |||
496 | /* If the root hub is dead rather than suspended, disallow remote | 505 | /* If the root hub is dead rather than suspended, disallow remote |
497 | * wakeup. usb_hc_died() should ensure that both hosts are marked as | 506 | * wakeup. usb_hc_died() should ensure that both hosts are marked as |
498 | * dying, so we only need to check the primary roothub. | 507 | * 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 a2aa9d652c67..ec6c97dadbe4 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1667,7 +1667,6 @@ void usb_disconnect(struct usb_device **pdev) | |||
1667 | { | 1667 | { |
1668 | struct usb_device *udev = *pdev; | 1668 | struct usb_device *udev = *pdev; |
1669 | int i; | 1669 | int i; |
1670 | struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
1671 | 1670 | ||
1672 | /* mark the device as inactive, so any further urb submissions for | 1671 | /* mark the device as inactive, so any further urb submissions for |
1673 | * this device (and any of its children) will fail immediately. | 1672 | * this device (and any of its children) will fail immediately. |
@@ -1690,9 +1689,7 @@ void usb_disconnect(struct usb_device **pdev) | |||
1690 | * so that the hardware is now fully quiesced. | 1689 | * so that the hardware is now fully quiesced. |
1691 | */ | 1690 | */ |
1692 | dev_dbg (&udev->dev, "unregistering device\n"); | 1691 | dev_dbg (&udev->dev, "unregistering device\n"); |
1693 | mutex_lock(hcd->bandwidth_mutex); | ||
1694 | usb_disable_device(udev, 0); | 1692 | usb_disable_device(udev, 0); |
1695 | mutex_unlock(hcd->bandwidth_mutex); | ||
1696 | usb_hcd_synchronize_unlinks(udev); | 1693 | usb_hcd_synchronize_unlinks(udev); |
1697 | 1694 | ||
1698 | usb_remove_ep_devs(&udev->ep0); | 1695 | usb_remove_ep_devs(&udev->ep0); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index aed3e07942d4..ca717da3be95 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1136,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, | |||
1136 | * Deallocates hcd/hardware state for the endpoints (nuking all or most | 1136 | * Deallocates hcd/hardware state for the endpoints (nuking all or most |
1137 | * pending urbs) and usbcore state for the interfaces, so that usbcore | 1137 | * pending urbs) and usbcore state for the interfaces, so that usbcore |
1138 | * must usb_set_configuration() before any interfaces could be used. | 1138 | * must usb_set_configuration() before any interfaces could be used. |
1139 | * | ||
1140 | * Must be called with hcd->bandwidth_mutex held. | ||
1141 | */ | 1139 | */ |
1142 | void usb_disable_device(struct usb_device *dev, int skip_ep0) | 1140 | void usb_disable_device(struct usb_device *dev, int skip_ep0) |
1143 | { | 1141 | { |
@@ -1190,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1190 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); | 1188 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); |
1191 | } | 1189 | } |
1192 | /* Remove endpoints from the host controller internal state */ | 1190 | /* Remove endpoints from the host controller internal state */ |
1191 | mutex_lock(hcd->bandwidth_mutex); | ||
1193 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | 1192 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
1193 | mutex_unlock(hcd->bandwidth_mutex); | ||
1194 | /* Second pass: remove endpoint pointers */ | 1194 | /* Second pass: remove endpoint pointers */ |
1195 | } | 1195 | } |
1196 | for (i = skip_ep0; i < 16; ++i) { | 1196 | for (i = skip_ep0; i < 16; ++i) { |
@@ -1750,7 +1750,6 @@ free_interfaces: | |||
1750 | /* if it's already configured, clear out old state first. | 1750 | /* if it's already configured, clear out old state first. |
1751 | * getting rid of old interfaces means unbinding their drivers. | 1751 | * getting rid of old interfaces means unbinding their drivers. |
1752 | */ | 1752 | */ |
1753 | mutex_lock(hcd->bandwidth_mutex); | ||
1754 | if (dev->state != USB_STATE_ADDRESS) | 1753 | if (dev->state != USB_STATE_ADDRESS) |
1755 | usb_disable_device(dev, 1); /* Skip ep0 */ | 1754 | usb_disable_device(dev, 1); /* Skip ep0 */ |
1756 | 1755 | ||
@@ -1763,6 +1762,7 @@ free_interfaces: | |||
1763 | * host controller will not allow submissions to dropped endpoints. If | 1762 | * host controller will not allow submissions to dropped endpoints. If |
1764 | * this call fails, the device state is unchanged. | 1763 | * this call fails, the device state is unchanged. |
1765 | */ | 1764 | */ |
1765 | mutex_lock(hcd->bandwidth_mutex); | ||
1766 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | 1766 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
1767 | if (ret < 0) { | 1767 | if (ret < 0) { |
1768 | mutex_unlock(hcd->bandwidth_mutex); | 1768 | mutex_unlock(hcd->bandwidth_mutex); |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7bd815a507e8..99b58d84553a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -206,11 +206,11 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc) | |||
206 | 206 | ||
207 | for (i = 0; i < dwc->num_event_buffers; i++) { | 207 | for (i = 0; i < dwc->num_event_buffers; i++) { |
208 | evt = dwc->ev_buffs[i]; | 208 | evt = dwc->ev_buffs[i]; |
209 | if (evt) { | 209 | if (evt) |
210 | dwc3_free_one_event_buffer(dwc, evt); | 210 | dwc3_free_one_event_buffer(dwc, evt); |
211 | dwc->ev_buffs[i] = NULL; | ||
212 | } | ||
213 | } | 211 | } |
212 | |||
213 | kfree(dwc->ev_buffs); | ||
214 | } | 214 | } |
215 | 215 | ||
216 | /** | 216 | /** |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 25910e251c04..3584a169886f 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -353,6 +353,9 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, | |||
353 | 353 | ||
354 | dwc->test_mode_nr = wIndex >> 8; | 354 | dwc->test_mode_nr = wIndex >> 8; |
355 | dwc->test_mode = true; | 355 | dwc->test_mode = true; |
356 | break; | ||
357 | default: | ||
358 | return -EINVAL; | ||
356 | } | 359 | } |
357 | break; | 360 | break; |
358 | 361 | ||
@@ -559,15 +562,20 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
559 | length = trb->size & DWC3_TRB_SIZE_MASK; | 562 | length = trb->size & DWC3_TRB_SIZE_MASK; |
560 | 563 | ||
561 | if (dwc->ep0_bounced) { | 564 | if (dwc->ep0_bounced) { |
565 | unsigned transfer_size = ur->length; | ||
566 | unsigned maxp = ep0->endpoint.maxpacket; | ||
567 | |||
568 | transfer_size += (maxp - (transfer_size % maxp)); | ||
562 | transferred = min_t(u32, ur->length, | 569 | transferred = min_t(u32, ur->length, |
563 | ep0->endpoint.maxpacket - length); | 570 | transfer_size - length); |
564 | memcpy(ur->buf, dwc->ep0_bounce, transferred); | 571 | memcpy(ur->buf, dwc->ep0_bounce, transferred); |
565 | dwc->ep0_bounced = false; | 572 | dwc->ep0_bounced = false; |
566 | } else { | 573 | } else { |
567 | transferred = ur->length - length; | 574 | transferred = ur->length - length; |
568 | ur->actual += transferred; | ||
569 | } | 575 | } |
570 | 576 | ||
577 | ur->actual += transferred; | ||
578 | |||
571 | if ((epnum & 1) && ur->actual < ur->length) { | 579 | if ((epnum & 1) && ur->actual < ur->length) { |
572 | /* for some reason we did not get everything out */ | 580 | /* for some reason we did not get everything out */ |
573 | 581 | ||
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 0c935d7c65bd..9d7bcd910074 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1863,8 +1863,8 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1863 | mod_timer(&udc->vbus_timer, | 1863 | mod_timer(&udc->vbus_timer, |
1864 | jiffies + VBUS_POLL_TIMEOUT); | 1864 | jiffies + VBUS_POLL_TIMEOUT); |
1865 | } else { | 1865 | } else { |
1866 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, | 1866 | if (request_irq(gpio_to_irq(udc->board.vbus_pin), |
1867 | 0, driver_name, udc)) { | 1867 | at91_vbus_irq, 0, driver_name, udc)) { |
1868 | DBG("request vbus irq %d failed\n", | 1868 | DBG("request vbus irq %d failed\n", |
1869 | udc->board.vbus_pin); | 1869 | udc->board.vbus_pin); |
1870 | retval = -EBUSY; | 1870 | retval = -EBUSY; |
@@ -1886,7 +1886,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1886 | return 0; | 1886 | return 0; |
1887 | fail4: | 1887 | fail4: |
1888 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) | 1888 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) |
1889 | free_irq(udc->board.vbus_pin, udc); | 1889 | free_irq(gpio_to_irq(udc->board.vbus_pin), udc); |
1890 | fail3: | 1890 | fail3: |
1891 | if (gpio_is_valid(udc->board.vbus_pin)) | 1891 | if (gpio_is_valid(udc->board.vbus_pin)) |
1892 | gpio_free(udc->board.vbus_pin); | 1892 | gpio_free(udc->board.vbus_pin); |
@@ -1924,7 +1924,7 @@ static int __exit at91udc_remove(struct platform_device *pdev) | |||
1924 | device_init_wakeup(&pdev->dev, 0); | 1924 | device_init_wakeup(&pdev->dev, 0); |
1925 | remove_debug_file(udc); | 1925 | remove_debug_file(udc); |
1926 | if (gpio_is_valid(udc->board.vbus_pin)) { | 1926 | if (gpio_is_valid(udc->board.vbus_pin)) { |
1927 | free_irq(udc->board.vbus_pin, udc); | 1927 | free_irq(gpio_to_irq(udc->board.vbus_pin), udc); |
1928 | gpio_free(udc->board.vbus_pin); | 1928 | gpio_free(udc->board.vbus_pin); |
1929 | } | 1929 | } |
1930 | free_irq(udc->udp_irq, udc); | 1930 | free_irq(udc->udp_irq, udc); |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index a6dfd2164166..170cbe89d9f8 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -927,7 +927,6 @@ static int dummy_udc_stop(struct usb_gadget *g, | |||
927 | 927 | ||
928 | dum->driver = NULL; | 928 | dum->driver = NULL; |
929 | 929 | ||
930 | dummy_pullup(&dum->gadget, 0); | ||
931 | return 0; | 930 | return 0; |
932 | } | 931 | } |
933 | 932 | ||
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 1cbba70836bc..f52cb1ae45d9 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value) | |||
712 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { | 712 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { |
713 | struct ffs_function *func = ffs->func; | 713 | struct ffs_function *func = ffs->func; |
714 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; | 714 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; |
715 | } else if (gadget->ops->ioctl) { | 715 | } else if (gadget && gadget->ops->ioctl) { |
716 | ret = gadget->ops->ioctl(gadget, code, value); | 716 | ret = gadget->ops->ioctl(gadget, code, value); |
717 | } else { | 717 | } else { |
718 | ret = -ENOTTY; | 718 | ret = -ENOTTY; |
@@ -1382,6 +1382,7 @@ static void functionfs_unbind(struct ffs_data *ffs) | |||
1382 | ffs->ep0req = NULL; | 1382 | ffs->ep0req = NULL; |
1383 | ffs->gadget = NULL; | 1383 | ffs->gadget = NULL; |
1384 | ffs_data_put(ffs); | 1384 | ffs_data_put(ffs); |
1385 | clear_bit(FFS_FL_BOUND, &ffs->flags); | ||
1385 | } | 1386 | } |
1386 | } | 1387 | } |
1387 | 1388 | ||
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index a371e966425f..cb8c162cae5a 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -2189,7 +2189,7 @@ unknown_cmnd: | |||
2189 | common->data_size_from_cmnd = 0; | 2189 | common->data_size_from_cmnd = 0; |
2190 | sprintf(unknown, "Unknown x%02x", common->cmnd[0]); | 2190 | sprintf(unknown, "Unknown x%02x", common->cmnd[0]); |
2191 | reply = check_command(common, common->cmnd_size, | 2191 | reply = check_command(common, common->cmnd_size, |
2192 | DATA_DIR_UNKNOWN, 0xff, 0, unknown); | 2192 | DATA_DIR_UNKNOWN, ~0, 0, unknown); |
2193 | if (reply == 0) { | 2193 | if (reply == 0) { |
2194 | common->curlun->sense_data = SS_INVALID_COMMAND; | 2194 | common->curlun->sense_data = SS_INVALID_COMMAND; |
2195 | reply = -EINVAL; | 2195 | reply = -EINVAL; |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 7b1cf18df5e3..52343654f5df 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -500,6 +500,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) | |||
500 | if (buf) { | 500 | if (buf) { |
501 | memcpy(req->buf, buf, n); | 501 | memcpy(req->buf, buf, n); |
502 | req->complete = rndis_response_complete; | 502 | req->complete = rndis_response_complete; |
503 | req->context = rndis; | ||
503 | rndis_free_response(rndis->config, buf); | 504 | rndis_free_response(rndis->config, buf); |
504 | value = n; | 505 | value = n; |
505 | } | 506 | } |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 4fac56927741..a896d73f7a93 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -2579,7 +2579,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2579 | fsg->data_size_from_cmnd = 0; | 2579 | fsg->data_size_from_cmnd = 0; |
2580 | sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); | 2580 | sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); |
2581 | if ((reply = check_command(fsg, fsg->cmnd_size, | 2581 | if ((reply = check_command(fsg, fsg->cmnd_size, |
2582 | DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) { | 2582 | DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) { |
2583 | fsg->curlun->sense_data = SS_INVALID_COMMAND; | 2583 | fsg->curlun->sense_data = SS_INVALID_COMMAND; |
2584 | reply = -EINVAL; | 2584 | reply = -EINVAL; |
2585 | } | 2585 | } |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 5f94e79cd6b9..55abfb6bd612 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) | |||
730 | : (1 << (ep_index(ep))); | 730 | : (1 << (ep_index(ep))); |
731 | 731 | ||
732 | /* check if the pipe is empty */ | 732 | /* check if the pipe is empty */ |
733 | if (!(list_empty(&ep->queue))) { | 733 | if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) { |
734 | /* Add td to the end */ | 734 | /* Add td to the end */ |
735 | struct fsl_req *lastreq; | 735 | struct fsl_req *lastreq; |
736 | lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); | 736 | lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); |
@@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
918 | return -ENOMEM; | 918 | return -ENOMEM; |
919 | } | 919 | } |
920 | 920 | ||
921 | /* Update ep0 state */ | ||
922 | if ((ep_index(ep) == 0)) | ||
923 | udc->ep0_state = DATA_STATE_XMIT; | ||
924 | |||
925 | /* irq handler advances the queue */ | 921 | /* irq handler advances the queue */ |
926 | if (req != NULL) | 922 | if (req != NULL) |
927 | list_add_tail(&req->queue, &ep->queue); | 923 | list_add_tail(&req->queue, &ep->queue); |
@@ -1279,7 +1275,8 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction) | |||
1279 | udc->ep0_dir = USB_DIR_OUT; | 1275 | udc->ep0_dir = USB_DIR_OUT; |
1280 | 1276 | ||
1281 | ep = &udc->eps[0]; | 1277 | ep = &udc->eps[0]; |
1282 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | 1278 | if (udc->ep0_state != DATA_STATE_XMIT) |
1279 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | ||
1283 | 1280 | ||
1284 | req->ep = ep; | 1281 | req->ep = ep; |
1285 | req->req.length = 0; | 1282 | req->req.length = 0; |
@@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value, | |||
1384 | 1381 | ||
1385 | list_add_tail(&req->queue, &ep->queue); | 1382 | list_add_tail(&req->queue, &ep->queue); |
1386 | udc->ep0_state = DATA_STATE_XMIT; | 1383 | udc->ep0_state = DATA_STATE_XMIT; |
1384 | if (ep0_prime_status(udc, EP_DIR_OUT)) | ||
1385 | ep0stall(udc); | ||
1386 | |||
1387 | return; | 1387 | return; |
1388 | stall: | 1388 | stall: |
1389 | ep0stall(udc); | 1389 | ep0stall(udc); |
@@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc, | |||
1492 | spin_lock(&udc->lock); | 1492 | spin_lock(&udc->lock); |
1493 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) | 1493 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) |
1494 | ? DATA_STATE_XMIT : DATA_STATE_RECV; | 1494 | ? DATA_STATE_XMIT : DATA_STATE_RECV; |
1495 | /* | ||
1496 | * If the data stage is IN, send status prime immediately. | ||
1497 | * See 2.0 Spec chapter 8.5.3.3 for detail. | ||
1498 | */ | ||
1499 | if (udc->ep0_state == DATA_STATE_XMIT) | ||
1500 | if (ep0_prime_status(udc, EP_DIR_OUT)) | ||
1501 | ep0stall(udc); | ||
1502 | |||
1495 | } else { | 1503 | } else { |
1496 | /* No data phase, IN status from gadget */ | 1504 | /* No data phase, IN status from gadget */ |
1497 | udc->ep0_dir = USB_DIR_IN; | 1505 | udc->ep0_dir = USB_DIR_IN; |
@@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0, | |||
1520 | 1528 | ||
1521 | switch (udc->ep0_state) { | 1529 | switch (udc->ep0_state) { |
1522 | case DATA_STATE_XMIT: | 1530 | case DATA_STATE_XMIT: |
1523 | /* receive status phase */ | 1531 | /* already primed at setup_received_irq */ |
1524 | if (ep0_prime_status(udc, EP_DIR_OUT)) | 1532 | udc->ep0_state = WAIT_FOR_OUT_STATUS; |
1525 | ep0stall(udc); | ||
1526 | break; | 1533 | break; |
1527 | case DATA_STATE_RECV: | 1534 | case DATA_STATE_RECV: |
1528 | /* send status phase */ | 1535 | /* send status phase */ |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 331cd6729d3c..a85eaf40b948 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -161,7 +161,7 @@ static struct usb_composite_driver gfs_driver = { | |||
161 | static struct ffs_data *gfs_ffs_data; | 161 | static struct ffs_data *gfs_ffs_data; |
162 | static unsigned long gfs_registered; | 162 | static unsigned long gfs_registered; |
163 | 163 | ||
164 | static int gfs_init(void) | 164 | static int __init gfs_init(void) |
165 | { | 165 | { |
166 | ENTER(); | 166 | ENTER(); |
167 | 167 | ||
@@ -169,7 +169,7 @@ static int gfs_init(void) | |||
169 | } | 169 | } |
170 | module_init(gfs_init); | 170 | module_init(gfs_init); |
171 | 171 | ||
172 | static void gfs_exit(void) | 172 | static void __exit gfs_exit(void) |
173 | { | 173 | { |
174 | ENTER(); | 174 | ENTER(); |
175 | 175 | ||
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 69295ba9d99a..105b206cd844 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -340,7 +340,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) | |||
340 | /* currently we allocate TX FIFOs for all possible endpoints, | 340 | /* currently we allocate TX FIFOs for all possible endpoints, |
341 | * and assume that they are all the same size. */ | 341 | * and assume that they are all the same size. */ |
342 | 342 | ||
343 | for (ep = 0; ep <= 15; ep++) { | 343 | for (ep = 1; ep <= 15; ep++) { |
344 | val = addr; | 344 | val = addr; |
345 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; | 345 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; |
346 | addr += size; | 346 | addr += size; |
@@ -741,7 +741,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, | |||
741 | /* write size / packets */ | 741 | /* write size / packets */ |
742 | writel(epsize, hsotg->regs + epsize_reg); | 742 | writel(epsize, hsotg->regs + epsize_reg); |
743 | 743 | ||
744 | if (using_dma(hsotg)) { | 744 | if (using_dma(hsotg) && !continuing) { |
745 | unsigned int dma_reg; | 745 | unsigned int dma_reg; |
746 | 746 | ||
747 | /* write DMA address to control register, buffer already | 747 | /* write DMA address to control register, buffer already |
@@ -1696,10 +1696,12 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg, | |||
1696 | reg |= mpsval; | 1696 | reg |= mpsval; |
1697 | writel(reg, regs + S3C_DIEPCTL(ep)); | 1697 | writel(reg, regs + S3C_DIEPCTL(ep)); |
1698 | 1698 | ||
1699 | reg = readl(regs + S3C_DOEPCTL(ep)); | 1699 | if (ep) { |
1700 | reg &= ~S3C_DxEPCTL_MPS_MASK; | 1700 | reg = readl(regs + S3C_DOEPCTL(ep)); |
1701 | reg |= mpsval; | 1701 | reg &= ~S3C_DxEPCTL_MPS_MASK; |
1702 | writel(reg, regs + S3C_DOEPCTL(ep)); | 1702 | reg |= mpsval; |
1703 | writel(reg, regs + S3C_DOEPCTL(ep)); | ||
1704 | } | ||
1703 | 1705 | ||
1704 | return; | 1706 | return; |
1705 | 1707 | ||
@@ -1919,7 +1921,8 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, | |||
1919 | ints & S3C_DIEPMSK_TxFIFOEmpty) { | 1921 | ints & S3C_DIEPMSK_TxFIFOEmpty) { |
1920 | dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", | 1922 | dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", |
1921 | __func__, idx); | 1923 | __func__, idx); |
1922 | s3c_hsotg_trytx(hsotg, hs_ep); | 1924 | if (!using_dma(hsotg)) |
1925 | s3c_hsotg_trytx(hsotg, hs_ep); | ||
1923 | } | 1926 | } |
1924 | } | 1927 | } |
1925 | } | 1928 | } |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 56da49f31d6c..e5e44f8cde9a 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -263,9 +263,9 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
263 | 263 | ||
264 | if (udc_is_newstyle(udc)) { | 264 | if (udc_is_newstyle(udc)) { |
265 | udc->driver->disconnect(udc->gadget); | 265 | udc->driver->disconnect(udc->gadget); |
266 | usb_gadget_disconnect(udc->gadget); | ||
266 | udc->driver->unbind(udc->gadget); | 267 | udc->driver->unbind(udc->gadget); |
267 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 268 | usb_gadget_udc_stop(udc->gadget, udc->driver); |
268 | usb_gadget_disconnect(udc->gadget); | ||
269 | } else { | 269 | } else { |
270 | usb_gadget_stop(udc->gadget, udc->driver); | 270 | usb_gadget_stop(udc->gadget, udc->driver); |
271 | } | 271 | } |
@@ -411,9 +411,13 @@ static ssize_t usb_udc_softconn_store(struct device *dev, | |||
411 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); | 411 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); |
412 | 412 | ||
413 | if (sysfs_streq(buf, "connect")) { | 413 | if (sysfs_streq(buf, "connect")) { |
414 | if (udc_is_newstyle(udc)) | ||
415 | usb_gadget_udc_start(udc->gadget, udc->driver); | ||
414 | usb_gadget_connect(udc->gadget); | 416 | usb_gadget_connect(udc->gadget); |
415 | } else if (sysfs_streq(buf, "disconnect")) { | 417 | } else if (sysfs_streq(buf, "disconnect")) { |
416 | usb_gadget_disconnect(udc->gadget); | 418 | usb_gadget_disconnect(udc->gadget); |
419 | if (udc_is_newstyle(udc)) | ||
420 | usb_gadget_udc_stop(udc->gadget, udc->driver); | ||
417 | } else { | 421 | } else { |
418 | dev_err(dev, "unsupported command '%s'\n", buf); | 422 | dev_err(dev, "unsupported command '%s'\n", buf); |
419 | return -EINVAL; | 423 | return -EINVAL; |
diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h index bc78c606c12b..ca4e03a1c73a 100644 --- a/drivers/usb/gadget/uvc.h +++ b/drivers/usb/gadget/uvc.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | struct uvc_request_data | 29 | struct uvc_request_data |
30 | { | 30 | { |
31 | unsigned int length; | 31 | __s32 length; |
32 | __u8 data[60]; | 32 | __u8 data[60]; |
33 | }; | 33 | }; |
34 | 34 | ||
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c index d776adb2da67..0cdf89d32a15 100644 --- a/drivers/usb/gadget/uvc_queue.c +++ b/drivers/usb/gadget/uvc_queue.c | |||
@@ -543,11 +543,11 @@ done: | |||
543 | return ret; | 543 | return ret; |
544 | } | 544 | } |
545 | 545 | ||
546 | /* called with queue->irqlock held.. */ | ||
546 | static struct uvc_buffer * | 547 | static struct uvc_buffer * |
547 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) | 548 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) |
548 | { | 549 | { |
549 | struct uvc_buffer *nextbuf; | 550 | struct uvc_buffer *nextbuf; |
550 | unsigned long flags; | ||
551 | 551 | ||
552 | if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && | 552 | if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && |
553 | buf->buf.length != buf->buf.bytesused) { | 553 | buf->buf.length != buf->buf.bytesused) { |
@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) | |||
556 | return buf; | 556 | return buf; |
557 | } | 557 | } |
558 | 558 | ||
559 | spin_lock_irqsave(&queue->irqlock, flags); | ||
560 | list_del(&buf->queue); | 559 | list_del(&buf->queue); |
561 | if (!list_empty(&queue->irqqueue)) | 560 | if (!list_empty(&queue->irqqueue)) |
562 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | 561 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, |
563 | queue); | 562 | queue); |
564 | else | 563 | else |
565 | nextbuf = NULL; | 564 | nextbuf = NULL; |
566 | spin_unlock_irqrestore(&queue->irqlock, flags); | ||
567 | 565 | ||
568 | buf->buf.sequence = queue->sequence++; | 566 | buf->buf.sequence = queue->sequence++; |
569 | do_gettimeofday(&buf->buf.timestamp); | 567 | do_gettimeofday(&buf->buf.timestamp); |
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c index f6e083b50191..54d7ca559cb2 100644 --- a/drivers/usb/gadget/uvc_v4l2.c +++ b/drivers/usb/gadget/uvc_v4l2.c | |||
@@ -39,7 +39,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data) | |||
39 | if (data->length < 0) | 39 | if (data->length < 0) |
40 | return usb_ep_set_halt(cdev->gadget->ep0); | 40 | return usb_ep_set_halt(cdev->gadget->ep0); |
41 | 41 | ||
42 | req->length = min(uvc->event_length, data->length); | 42 | req->length = min_t(unsigned int, uvc->event_length, data->length); |
43 | req->zero = data->length < uvc->event_length; | 43 | req->zero = data->length < uvc->event_length; |
44 | req->dma = DMA_ADDR_INVALID; | 44 | req->dma = DMA_ADDR_INVALID; |
45 | 45 | ||
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 3e7345172e03..d0a84bd3f3eb 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
218 | u32 portsc; | 218 | u32 portsc; |
219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | 219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); |
220 | void __iomem *non_ehci = hcd->regs; | 220 | void __iomem *non_ehci = hcd->regs; |
221 | struct fsl_usb2_platform_data *pdata; | ||
222 | |||
223 | pdata = hcd->self.controller->platform_data; | ||
221 | 224 | ||
222 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); | 225 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); |
223 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); | 226 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); |
@@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
234 | /* fall through */ | 237 | /* fall through */ |
235 | case FSL_USB2_PHY_UTMI: | 238 | case FSL_USB2_PHY_UTMI: |
236 | /* enable UTMI PHY */ | 239 | /* enable UTMI PHY */ |
237 | setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); | 240 | if (pdata->have_sysif_regs) |
241 | setbits32(non_ehci + FSL_SOC_USB_CTRL, | ||
242 | CTRL_UTMI_PHY_EN); | ||
238 | portsc |= PORT_PTS_UTMI; | 243 | portsc |= PORT_PTS_UTMI; |
239 | break; | 244 | break; |
240 | case FSL_USB2_PHY_NONE: | 245 | case FSL_USB2_PHY_NONE: |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 806cc95317aa..4a3bc5b7a06f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -858,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
858 | goto dead; | 858 | goto dead; |
859 | } | 859 | } |
860 | 860 | ||
861 | /* | ||
862 | * We don't use STS_FLR, but some controllers don't like it to | ||
863 | * remain on, so mask it out along with the other status bits. | ||
864 | */ | ||
865 | masked_status = status & (INTR_MASK | STS_FLR); | ||
866 | |||
861 | /* Shared IRQ? */ | 867 | /* Shared IRQ? */ |
862 | masked_status = status & INTR_MASK; | ||
863 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { | 868 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { |
864 | spin_unlock(&ehci->lock); | 869 | spin_unlock(&ehci->lock); |
865 | return IRQ_NONE; | 870 | return IRQ_NONE; |
@@ -910,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
910 | pcd_status = status; | 915 | pcd_status = status; |
911 | 916 | ||
912 | /* resume root hub? */ | 917 | /* resume root hub? */ |
913 | if (!(cmd & CMD_RUN)) | 918 | if (ehci->rh_state == EHCI_RH_SUSPENDED) |
914 | usb_hcd_resume_root_hub(hcd); | 919 | usb_hcd_resume_root_hub(hcd); |
915 | 920 | ||
916 | /* get per-port change detect bits */ | 921 | /* get per-port change detect bits */ |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index bba9850f32f0..5c78f9e71466 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <plat/usb.h> | 42 | #include <plat/usb.h> |
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 | 46 | ||
46 | /* EHCI Register Set */ | 47 | /* EHCI Register Set */ |
47 | #define EHCI_INSNREG04 (0xA0) | 48 | #define EHCI_INSNREG04 (0xA0) |
@@ -191,6 +192,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
191 | } | 192 | } |
192 | } | 193 | } |
193 | 194 | ||
195 | if (pdata->phy_reset) { | ||
196 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
197 | gpio_request_one(pdata->reset_gpio_port[0], | ||
198 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
199 | |||
200 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
201 | gpio_request_one(pdata->reset_gpio_port[1], | ||
202 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
203 | |||
204 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
205 | udelay(10); | ||
206 | } | ||
207 | |||
194 | pm_runtime_enable(dev); | 208 | pm_runtime_enable(dev); |
195 | pm_runtime_get_sync(dev); | 209 | pm_runtime_get_sync(dev); |
196 | 210 | ||
@@ -237,6 +251,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
237 | /* root ports should always stay powered */ | 251 | /* root ports should always stay powered */ |
238 | ehci_port_power(omap_ehci, 1); | 252 | ehci_port_power(omap_ehci, 1); |
239 | 253 | ||
254 | if (pdata->phy_reset) { | ||
255 | /* Hold the PHY in RESET for enough time till | ||
256 | * PHY is settled and ready | ||
257 | */ | ||
258 | udelay(10); | ||
259 | |||
260 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
261 | gpio_set_value(pdata->reset_gpio_port[0], 1); | ||
262 | |||
263 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
264 | gpio_set_value(pdata->reset_gpio_port[1], 1); | ||
265 | } | ||
266 | |||
240 | return 0; | 267 | return 0; |
241 | 268 | ||
242 | err_add_hcd: | 269 | err_add_hcd: |
@@ -259,8 +286,9 @@ err_io: | |||
259 | */ | 286 | */ |
260 | static int ehci_hcd_omap_remove(struct platform_device *pdev) | 287 | static int ehci_hcd_omap_remove(struct platform_device *pdev) |
261 | { | 288 | { |
262 | struct device *dev = &pdev->dev; | 289 | struct device *dev = &pdev->dev; |
263 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 290 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
291 | struct ehci_hcd_omap_platform_data *pdata = dev->platform_data; | ||
264 | 292 | ||
265 | usb_remove_hcd(hcd); | 293 | usb_remove_hcd(hcd); |
266 | disable_put_regulator(dev->platform_data); | 294 | disable_put_regulator(dev->platform_data); |
@@ -269,6 +297,13 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) | |||
269 | pm_runtime_put_sync(dev); | 297 | pm_runtime_put_sync(dev); |
270 | pm_runtime_disable(dev); | 298 | pm_runtime_disable(dev); |
271 | 299 | ||
300 | if (pdata->phy_reset) { | ||
301 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
302 | gpio_free(pdata->reset_gpio_port[0]); | ||
303 | |||
304 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
305 | gpio_free(pdata->reset_gpio_port[1]); | ||
306 | } | ||
272 | return 0; | 307 | return 0; |
273 | } | 308 | } |
274 | 309 | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 01bb7241d6ef..fe8dc069164e 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -144,6 +144,14 @@ 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 | } | ||
147 | break; | 155 | break; |
148 | case PCI_VENDOR_ID_TDI: | 156 | case PCI_VENDOR_ID_TDI: |
149 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 157 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 73544bd440bd..f214a80cdee2 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/of.h> | 25 | #include <linux/of.h> |
26 | #include <linux/of_gpio.h> | 26 | #include <linux/of_gpio.h> |
27 | #include <linux/pm_runtime.h> | ||
27 | 28 | ||
28 | #include <mach/usb_phy.h> | 29 | #include <mach/usb_phy.h> |
29 | #include <mach/iomap.h> | 30 | #include <mach/iomap.h> |
@@ -37,9 +38,7 @@ struct tegra_ehci_hcd { | |||
37 | struct clk *emc_clk; | 38 | struct clk *emc_clk; |
38 | struct usb_phy *transceiver; | 39 | struct usb_phy *transceiver; |
39 | int host_resumed; | 40 | int host_resumed; |
40 | int bus_suspended; | ||
41 | int port_resuming; | 41 | int port_resuming; |
42 | int power_down_on_bus_suspend; | ||
43 | enum tegra_usb_phy_port_speed port_speed; | 42 | enum tegra_usb_phy_port_speed port_speed; |
44 | }; | 43 | }; |
45 | 44 | ||
@@ -273,120 +272,6 @@ static void tegra_ehci_restart(struct usb_hcd *hcd) | |||
273 | up_write(&ehci_cf_port_reset_rwsem); | 272 | up_write(&ehci_cf_port_reset_rwsem); |
274 | } | 273 | } |
275 | 274 | ||
276 | static int tegra_usb_suspend(struct usb_hcd *hcd) | ||
277 | { | ||
278 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
279 | struct ehci_regs __iomem *hw = tegra->ehci->regs; | ||
280 | unsigned long flags; | ||
281 | |||
282 | spin_lock_irqsave(&tegra->ehci->lock, flags); | ||
283 | |||
284 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; | ||
285 | ehci_halt(tegra->ehci); | ||
286 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
287 | |||
288 | spin_unlock_irqrestore(&tegra->ehci->lock, flags); | ||
289 | |||
290 | tegra_ehci_power_down(hcd); | ||
291 | return 0; | ||
292 | } | ||
293 | |||
294 | static int tegra_usb_resume(struct usb_hcd *hcd) | ||
295 | { | ||
296 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
297 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
298 | struct ehci_regs __iomem *hw = ehci->regs; | ||
299 | unsigned long val; | ||
300 | |||
301 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
302 | tegra_ehci_power_up(hcd); | ||
303 | |||
304 | if (tegra->port_speed > TEGRA_USB_PHY_PORT_SPEED_HIGH) { | ||
305 | /* Wait for the phy to detect new devices | ||
306 | * before we restart the controller */ | ||
307 | msleep(10); | ||
308 | goto restart; | ||
309 | } | ||
310 | |||
311 | /* Force the phy to keep data lines in suspend state */ | ||
312 | tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed); | ||
313 | |||
314 | /* Enable host mode */ | ||
315 | tdi_reset(ehci); | ||
316 | |||
317 | /* Enable Port Power */ | ||
318 | val = readl(&hw->port_status[0]); | ||
319 | val |= PORT_POWER; | ||
320 | writel(val, &hw->port_status[0]); | ||
321 | udelay(10); | ||
322 | |||
323 | /* Check if the phy resume from LP0. When the phy resume from LP0 | ||
324 | * USB register will be reset. */ | ||
325 | if (!readl(&hw->async_next)) { | ||
326 | /* Program the field PTC based on the saved speed mode */ | ||
327 | val = readl(&hw->port_status[0]); | ||
328 | val &= ~PORT_TEST(~0); | ||
329 | if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
330 | val |= PORT_TEST_FORCE; | ||
331 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_FULL) | ||
332 | val |= PORT_TEST(6); | ||
333 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) | ||
334 | val |= PORT_TEST(7); | ||
335 | writel(val, &hw->port_status[0]); | ||
336 | udelay(10); | ||
337 | |||
338 | /* Disable test mode by setting PTC field to NORMAL_OP */ | ||
339 | val = readl(&hw->port_status[0]); | ||
340 | val &= ~PORT_TEST(~0); | ||
341 | writel(val, &hw->port_status[0]); | ||
342 | udelay(10); | ||
343 | } | ||
344 | |||
345 | /* Poll until CCS is enabled */ | ||
346 | if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, | ||
347 | PORT_CONNECT, 2000)) { | ||
348 | pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); | ||
349 | goto restart; | ||
350 | } | ||
351 | |||
352 | /* Poll until PE is enabled */ | ||
353 | if (handshake(ehci, &hw->port_status[0], PORT_PE, | ||
354 | PORT_PE, 2000)) { | ||
355 | pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); | ||
356 | goto restart; | ||
357 | } | ||
358 | |||
359 | /* Clear the PCI status, to avoid an interrupt taken upon resume */ | ||
360 | val = readl(&hw->status); | ||
361 | val |= STS_PCD; | ||
362 | writel(val, &hw->status); | ||
363 | |||
364 | /* Put controller in suspend mode by writing 1 to SUSP bit of PORTSC */ | ||
365 | val = readl(&hw->port_status[0]); | ||
366 | if ((val & PORT_POWER) && (val & PORT_PE)) { | ||
367 | val |= PORT_SUSPEND; | ||
368 | writel(val, &hw->port_status[0]); | ||
369 | |||
370 | /* Wait until port suspend completes */ | ||
371 | if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, | ||
372 | PORT_SUSPEND, 1000)) { | ||
373 | pr_err("%s: timeout waiting for PORT_SUSPEND\n", | ||
374 | __func__); | ||
375 | goto restart; | ||
376 | } | ||
377 | } | ||
378 | |||
379 | tegra_ehci_phy_restore_end(tegra->phy); | ||
380 | return 0; | ||
381 | |||
382 | restart: | ||
383 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
384 | tegra_ehci_phy_restore_end(tegra->phy); | ||
385 | |||
386 | tegra_ehci_restart(hcd); | ||
387 | return 0; | ||
388 | } | ||
389 | |||
390 | static void tegra_ehci_shutdown(struct usb_hcd *hcd) | 275 | static void tegra_ehci_shutdown(struct usb_hcd *hcd) |
391 | { | 276 | { |
392 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | 277 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); |
@@ -434,36 +319,6 @@ static int tegra_ehci_setup(struct usb_hcd *hcd) | |||
434 | return retval; | 319 | return retval; |
435 | } | 320 | } |
436 | 321 | ||
437 | #ifdef CONFIG_PM | ||
438 | static int tegra_ehci_bus_suspend(struct usb_hcd *hcd) | ||
439 | { | ||
440 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
441 | int error_status = 0; | ||
442 | |||
443 | error_status = ehci_bus_suspend(hcd); | ||
444 | if (!error_status && tegra->power_down_on_bus_suspend) { | ||
445 | tegra_usb_suspend(hcd); | ||
446 | tegra->bus_suspended = 1; | ||
447 | } | ||
448 | |||
449 | return error_status; | ||
450 | } | ||
451 | |||
452 | static int tegra_ehci_bus_resume(struct usb_hcd *hcd) | ||
453 | { | ||
454 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
455 | |||
456 | if (tegra->bus_suspended && tegra->power_down_on_bus_suspend) { | ||
457 | tegra_usb_resume(hcd); | ||
458 | tegra->bus_suspended = 0; | ||
459 | } | ||
460 | |||
461 | tegra_usb_phy_preresume(tegra->phy); | ||
462 | tegra->port_resuming = 1; | ||
463 | return ehci_bus_resume(hcd); | ||
464 | } | ||
465 | #endif | ||
466 | |||
467 | struct temp_buffer { | 322 | struct temp_buffer { |
468 | void *kmalloc_ptr; | 323 | void *kmalloc_ptr; |
469 | void *old_xfer_buffer; | 324 | void *old_xfer_buffer; |
@@ -574,8 +429,8 @@ static const struct hc_driver tegra_ehci_hc_driver = { | |||
574 | .hub_control = tegra_ehci_hub_control, | 429 | .hub_control = tegra_ehci_hub_control, |
575 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 430 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
576 | #ifdef CONFIG_PM | 431 | #ifdef CONFIG_PM |
577 | .bus_suspend = tegra_ehci_bus_suspend, | 432 | .bus_suspend = ehci_bus_suspend, |
578 | .bus_resume = tegra_ehci_bus_resume, | 433 | .bus_resume = ehci_bus_resume, |
579 | #endif | 434 | #endif |
580 | .relinquish_port = ehci_relinquish_port, | 435 | .relinquish_port = ehci_relinquish_port, |
581 | .port_handed_over = ehci_port_handed_over, | 436 | .port_handed_over = ehci_port_handed_over, |
@@ -603,11 +458,187 @@ static int setup_vbus_gpio(struct platform_device *pdev) | |||
603 | dev_err(&pdev->dev, "can't enable vbus\n"); | 458 | dev_err(&pdev->dev, "can't enable vbus\n"); |
604 | return err; | 459 | return err; |
605 | } | 460 | } |
606 | gpio_set_value(gpio, 1); | ||
607 | 461 | ||
608 | return err; | 462 | return err; |
609 | } | 463 | } |
610 | 464 | ||
465 | #ifdef CONFIG_PM | ||
466 | |||
467 | static int controller_suspend(struct device *dev) | ||
468 | { | ||
469 | struct tegra_ehci_hcd *tegra = | ||
470 | platform_get_drvdata(to_platform_device(dev)); | ||
471 | struct ehci_hcd *ehci = tegra->ehci; | ||
472 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | ||
473 | struct ehci_regs __iomem *hw = ehci->regs; | ||
474 | unsigned long flags; | ||
475 | |||
476 | if (time_before(jiffies, ehci->next_statechange)) | ||
477 | msleep(10); | ||
478 | |||
479 | spin_lock_irqsave(&ehci->lock, flags); | ||
480 | |||
481 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; | ||
482 | ehci_halt(ehci); | ||
483 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
484 | |||
485 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
486 | |||
487 | tegra_ehci_power_down(hcd); | ||
488 | return 0; | ||
489 | } | ||
490 | |||
491 | static int controller_resume(struct device *dev) | ||
492 | { | ||
493 | struct tegra_ehci_hcd *tegra = | ||
494 | platform_get_drvdata(to_platform_device(dev)); | ||
495 | struct ehci_hcd *ehci = tegra->ehci; | ||
496 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | ||
497 | struct ehci_regs __iomem *hw = ehci->regs; | ||
498 | unsigned long val; | ||
499 | |||
500 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
501 | tegra_ehci_power_up(hcd); | ||
502 | |||
503 | if (tegra->port_speed > TEGRA_USB_PHY_PORT_SPEED_HIGH) { | ||
504 | /* Wait for the phy to detect new devices | ||
505 | * before we restart the controller */ | ||
506 | msleep(10); | ||
507 | goto restart; | ||
508 | } | ||
509 | |||
510 | /* Force the phy to keep data lines in suspend state */ | ||
511 | tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed); | ||
512 | |||
513 | /* Enable host mode */ | ||
514 | tdi_reset(ehci); | ||
515 | |||
516 | /* Enable Port Power */ | ||
517 | val = readl(&hw->port_status[0]); | ||
518 | val |= PORT_POWER; | ||
519 | writel(val, &hw->port_status[0]); | ||
520 | udelay(10); | ||
521 | |||
522 | /* Check if the phy resume from LP0. When the phy resume from LP0 | ||
523 | * USB register will be reset. */ | ||
524 | if (!readl(&hw->async_next)) { | ||
525 | /* Program the field PTC based on the saved speed mode */ | ||
526 | val = readl(&hw->port_status[0]); | ||
527 | val &= ~PORT_TEST(~0); | ||
528 | if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
529 | val |= PORT_TEST_FORCE; | ||
530 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_FULL) | ||
531 | val |= PORT_TEST(6); | ||
532 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) | ||
533 | val |= PORT_TEST(7); | ||
534 | writel(val, &hw->port_status[0]); | ||
535 | udelay(10); | ||
536 | |||
537 | /* Disable test mode by setting PTC field to NORMAL_OP */ | ||
538 | val = readl(&hw->port_status[0]); | ||
539 | val &= ~PORT_TEST(~0); | ||
540 | writel(val, &hw->port_status[0]); | ||
541 | udelay(10); | ||
542 | } | ||
543 | |||
544 | /* Poll until CCS is enabled */ | ||
545 | if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, | ||
546 | PORT_CONNECT, 2000)) { | ||
547 | pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); | ||
548 | goto restart; | ||
549 | } | ||
550 | |||
551 | /* Poll until PE is enabled */ | ||
552 | if (handshake(ehci, &hw->port_status[0], PORT_PE, | ||
553 | PORT_PE, 2000)) { | ||
554 | pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); | ||
555 | goto restart; | ||
556 | } | ||
557 | |||
558 | /* Clear the PCI status, to avoid an interrupt taken upon resume */ | ||
559 | val = readl(&hw->status); | ||
560 | val |= STS_PCD; | ||
561 | writel(val, &hw->status); | ||
562 | |||
563 | /* Put controller in suspend mode by writing 1 to SUSP bit of PORTSC */ | ||
564 | val = readl(&hw->port_status[0]); | ||
565 | if ((val & PORT_POWER) && (val & PORT_PE)) { | ||
566 | val |= PORT_SUSPEND; | ||
567 | writel(val, &hw->port_status[0]); | ||
568 | |||
569 | /* Wait until port suspend completes */ | ||
570 | if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, | ||
571 | PORT_SUSPEND, 1000)) { | ||
572 | pr_err("%s: timeout waiting for PORT_SUSPEND\n", | ||
573 | __func__); | ||
574 | goto restart; | ||
575 | } | ||
576 | } | ||
577 | |||
578 | tegra_ehci_phy_restore_end(tegra->phy); | ||
579 | goto done; | ||
580 | |||
581 | restart: | ||
582 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
583 | tegra_ehci_phy_restore_end(tegra->phy); | ||
584 | |||
585 | tegra_ehci_restart(hcd); | ||
586 | |||
587 | done: | ||
588 | tegra_usb_phy_preresume(tegra->phy); | ||
589 | tegra->port_resuming = 1; | ||
590 | return 0; | ||
591 | } | ||
592 | |||
593 | static int tegra_ehci_suspend(struct device *dev) | ||
594 | { | ||
595 | struct tegra_ehci_hcd *tegra = | ||
596 | platform_get_drvdata(to_platform_device(dev)); | ||
597 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
598 | int rc = 0; | ||
599 | |||
600 | /* | ||
601 | * When system sleep is supported and USB controller wakeup is | ||
602 | * implemented: If the controller is runtime-suspended and the | ||
603 | * wakeup setting needs to be changed, call pm_runtime_resume(). | ||
604 | */ | ||
605 | if (HCD_HW_ACCESSIBLE(hcd)) | ||
606 | rc = controller_suspend(dev); | ||
607 | return rc; | ||
608 | } | ||
609 | |||
610 | static int tegra_ehci_resume(struct device *dev) | ||
611 | { | ||
612 | int rc; | ||
613 | |||
614 | rc = controller_resume(dev); | ||
615 | if (rc == 0) { | ||
616 | pm_runtime_disable(dev); | ||
617 | pm_runtime_set_active(dev); | ||
618 | pm_runtime_enable(dev); | ||
619 | } | ||
620 | return rc; | ||
621 | } | ||
622 | |||
623 | static int tegra_ehci_runtime_suspend(struct device *dev) | ||
624 | { | ||
625 | return controller_suspend(dev); | ||
626 | } | ||
627 | |||
628 | static int tegra_ehci_runtime_resume(struct device *dev) | ||
629 | { | ||
630 | return controller_resume(dev); | ||
631 | } | ||
632 | |||
633 | static const struct dev_pm_ops tegra_ehci_pm_ops = { | ||
634 | .suspend = tegra_ehci_suspend, | ||
635 | .resume = tegra_ehci_resume, | ||
636 | .runtime_suspend = tegra_ehci_runtime_suspend, | ||
637 | .runtime_resume = tegra_ehci_runtime_resume, | ||
638 | }; | ||
639 | |||
640 | #endif | ||
641 | |||
611 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); | 642 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); |
612 | 643 | ||
613 | static int tegra_ehci_probe(struct platform_device *pdev) | 644 | static int tegra_ehci_probe(struct platform_device *pdev) |
@@ -722,7 +753,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
722 | } | 753 | } |
723 | 754 | ||
724 | tegra->host_resumed = 1; | 755 | tegra->host_resumed = 1; |
725 | tegra->power_down_on_bus_suspend = pdata->power_down_on_bus_suspend; | ||
726 | tegra->ehci = hcd_to_ehci(hcd); | 756 | tegra->ehci = hcd_to_ehci(hcd); |
727 | 757 | ||
728 | irq = platform_get_irq(pdev, 0); | 758 | irq = platform_get_irq(pdev, 0); |
@@ -731,7 +761,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
731 | err = -ENODEV; | 761 | err = -ENODEV; |
732 | goto fail; | 762 | goto fail; |
733 | } | 763 | } |
734 | set_irq_flags(irq, IRQF_VALID); | ||
735 | 764 | ||
736 | #ifdef CONFIG_USB_OTG_UTILS | 765 | #ifdef CONFIG_USB_OTG_UTILS |
737 | if (pdata->operating_mode == TEGRA_USB_OTG) { | 766 | if (pdata->operating_mode == TEGRA_USB_OTG) { |
@@ -747,6 +776,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
747 | goto fail; | 776 | goto fail; |
748 | } | 777 | } |
749 | 778 | ||
779 | pm_runtime_set_active(&pdev->dev); | ||
780 | pm_runtime_get_noresume(&pdev->dev); | ||
781 | |||
782 | /* Don't skip the pm_runtime_forbid call if wakeup isn't working */ | ||
783 | /* if (!pdata->power_down_on_bus_suspend) */ | ||
784 | pm_runtime_forbid(&pdev->dev); | ||
785 | pm_runtime_enable(&pdev->dev); | ||
786 | pm_runtime_put_sync(&pdev->dev); | ||
750 | return err; | 787 | return err; |
751 | 788 | ||
752 | fail: | 789 | fail: |
@@ -773,33 +810,6 @@ fail_hcd: | |||
773 | return err; | 810 | return err; |
774 | } | 811 | } |
775 | 812 | ||
776 | #ifdef CONFIG_PM | ||
777 | static int tegra_ehci_resume(struct platform_device *pdev) | ||
778 | { | ||
779 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
780 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
781 | |||
782 | if (tegra->bus_suspended) | ||
783 | return 0; | ||
784 | |||
785 | return tegra_usb_resume(hcd); | ||
786 | } | ||
787 | |||
788 | static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state) | ||
789 | { | ||
790 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
791 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
792 | |||
793 | if (tegra->bus_suspended) | ||
794 | return 0; | ||
795 | |||
796 | if (time_before(jiffies, tegra->ehci->next_statechange)) | ||
797 | msleep(10); | ||
798 | |||
799 | return tegra_usb_suspend(hcd); | ||
800 | } | ||
801 | #endif | ||
802 | |||
803 | static int tegra_ehci_remove(struct platform_device *pdev) | 813 | static int tegra_ehci_remove(struct platform_device *pdev) |
804 | { | 814 | { |
805 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | 815 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); |
@@ -808,6 +818,10 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
808 | if (tegra == NULL || hcd == NULL) | 818 | if (tegra == NULL || hcd == NULL) |
809 | return -EINVAL; | 819 | return -EINVAL; |
810 | 820 | ||
821 | pm_runtime_get_sync(&pdev->dev); | ||
822 | pm_runtime_disable(&pdev->dev); | ||
823 | pm_runtime_put_noidle(&pdev->dev); | ||
824 | |||
811 | #ifdef CONFIG_USB_OTG_UTILS | 825 | #ifdef CONFIG_USB_OTG_UTILS |
812 | if (tegra->transceiver) { | 826 | if (tegra->transceiver) { |
813 | otg_set_host(tegra->transceiver->otg, NULL); | 827 | otg_set_host(tegra->transceiver->otg, NULL); |
@@ -848,13 +862,12 @@ static struct of_device_id tegra_ehci_of_match[] __devinitdata = { | |||
848 | static struct platform_driver tegra_ehci_driver = { | 862 | static struct platform_driver tegra_ehci_driver = { |
849 | .probe = tegra_ehci_probe, | 863 | .probe = tegra_ehci_probe, |
850 | .remove = tegra_ehci_remove, | 864 | .remove = tegra_ehci_remove, |
851 | #ifdef CONFIG_PM | ||
852 | .suspend = tegra_ehci_suspend, | ||
853 | .resume = tegra_ehci_resume, | ||
854 | #endif | ||
855 | .shutdown = tegra_ehci_hcd_shutdown, | 865 | .shutdown = tegra_ehci_hcd_shutdown, |
856 | .driver = { | 866 | .driver = { |
857 | .name = "tegra-ehci", | 867 | .name = "tegra-ehci", |
858 | .of_match_table = tegra_ehci_of_match, | 868 | .of_match_table = tegra_ehci_of_match, |
869 | #ifdef CONFIG_PM | ||
870 | .pm = &tegra_ehci_pm_ops, | ||
871 | #endif | ||
859 | } | 872 | } |
860 | }; | 873 | }; |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 09f597ad6e00..13ebeca8e73e 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -94,7 +94,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
94 | 94 | ||
95 | /*-------------------------------------------------------------------------*/ | 95 | /*-------------------------------------------------------------------------*/ |
96 | 96 | ||
97 | static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | 97 | static void __devexit usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); |
98 | 98 | ||
99 | /* configure so an HC device and id are always provided */ | 99 | /* configure so an HC device and id are always provided */ |
100 | /* always called with process context; sleeping is OK */ | 100 | /* always called with process context; sleeping is OK */ |
@@ -108,7 +108,7 @@ static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
108 | * then invokes the start() method for the HCD associated with it | 108 | * then invokes the start() method for the HCD associated with it |
109 | * through the hotplug entry's driver_data. | 109 | * through the hotplug entry's driver_data. |
110 | */ | 110 | */ |
111 | static int usb_hcd_at91_probe(const struct hc_driver *driver, | 111 | static int __devinit usb_hcd_at91_probe(const struct hc_driver *driver, |
112 | struct platform_device *pdev) | 112 | struct platform_device *pdev) |
113 | { | 113 | { |
114 | int retval; | 114 | int retval; |
@@ -203,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
203 | * context, "rmmod" or something similar. | 203 | * context, "rmmod" or something similar. |
204 | * | 204 | * |
205 | */ | 205 | */ |
206 | static void usb_hcd_at91_remove(struct usb_hcd *hcd, | 206 | static void __devexit usb_hcd_at91_remove(struct usb_hcd *hcd, |
207 | struct platform_device *pdev) | 207 | struct platform_device *pdev) |
208 | { | 208 | { |
209 | usb_remove_hcd(hcd); | 209 | usb_remove_hcd(hcd); |
@@ -545,7 +545,7 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev) | |||
545 | 545 | ||
546 | /*-------------------------------------------------------------------------*/ | 546 | /*-------------------------------------------------------------------------*/ |
547 | 547 | ||
548 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | 548 | static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
549 | { | 549 | { |
550 | struct at91_usbh_data *pdata; | 550 | struct at91_usbh_data *pdata; |
551 | int i; | 551 | int i; |
@@ -620,7 +620,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
620 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | 620 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); |
621 | } | 621 | } |
622 | 622 | ||
623 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | 623 | static int __devexit ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
624 | { | 624 | { |
625 | struct at91_usbh_data *pdata = pdev->dev.platform_data; | 625 | struct at91_usbh_data *pdata = pdev->dev.platform_data; |
626 | int i; | 626 | int i; |
@@ -696,7 +696,7 @@ MODULE_ALIAS("platform:at91_ohci"); | |||
696 | 696 | ||
697 | static struct platform_driver ohci_hcd_at91_driver = { | 697 | static struct platform_driver ohci_hcd_at91_driver = { |
698 | .probe = ohci_hcd_at91_drv_probe, | 698 | .probe = ohci_hcd_at91_drv_probe, |
699 | .remove = ohci_hcd_at91_drv_remove, | 699 | .remove = __devexit_p(ohci_hcd_at91_drv_remove), |
700 | .shutdown = usb_hcd_platform_shutdown, | 700 | .shutdown = usb_hcd_platform_shutdown, |
701 | .suspend = ohci_hcd_at91_drv_suspend, | 701 | .suspend = ohci_hcd_at91_drv_suspend, |
702 | .resume = ohci_hcd_at91_drv_resume, | 702 | .resume = ohci_hcd_at91_drv_resume, |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 959145baf3cf..9dcb68f04f03 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -423,7 +423,7 @@ alloc_sglist(int nents, int max, int vary) | |||
423 | unsigned i; | 423 | unsigned i; |
424 | unsigned size = max; | 424 | unsigned size = max; |
425 | 425 | ||
426 | sg = kmalloc(nents * sizeof *sg, GFP_KERNEL); | 426 | sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL); |
427 | if (!sg) | 427 | if (!sg) |
428 | return NULL; | 428 | return NULL; |
429 | sg_init_table(sg, nents); | 429 | sg_init_table(sg, nents); |
@@ -904,6 +904,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param) | |||
904 | struct ctrl_ctx context; | 904 | struct ctrl_ctx context; |
905 | int i; | 905 | int i; |
906 | 906 | ||
907 | if (param->sglen == 0 || param->iterations > UINT_MAX / param->sglen) | ||
908 | return -EOPNOTSUPP; | ||
909 | |||
907 | spin_lock_init(&context.lock); | 910 | spin_lock_init(&context.lock); |
908 | context.dev = dev; | 911 | context.dev = dev; |
909 | init_completion(&context.complete); | 912 | init_completion(&context.complete); |
@@ -1981,8 +1984,6 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) | |||
1981 | 1984 | ||
1982 | /* queued control messaging */ | 1985 | /* queued control messaging */ |
1983 | case 10: | 1986 | case 10: |
1984 | if (param->sglen == 0) | ||
1985 | break; | ||
1986 | retval = 0; | 1987 | retval = 0; |
1987 | dev_info(&intf->dev, | 1988 | dev_info(&intf->dev, |
1988 | "TEST 10: queue %d control calls, %d times\n", | 1989 | "TEST 10: queue %d control calls, %d times\n", |
@@ -2276,6 +2277,8 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2276 | if (status < 0) { | 2277 | if (status < 0) { |
2277 | WARNING(dev, "couldn't get endpoints, %d\n", | 2278 | WARNING(dev, "couldn't get endpoints, %d\n", |
2278 | status); | 2279 | status); |
2280 | kfree(dev->buf); | ||
2281 | kfree(dev); | ||
2279 | return status; | 2282 | return status; |
2280 | } | 2283 | } |
2281 | /* may find bulk or ISO pipes */ | 2284 | /* may find bulk or ISO pipes */ |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 897edda42270..70201462e19c 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref) | |||
99 | usb_put_dev(dev->udev); | 99 | usb_put_dev(dev->udev); |
100 | if (dev->cntl_urb) { | 100 | if (dev->cntl_urb) { |
101 | usb_kill_urb(dev->cntl_urb); | 101 | usb_kill_urb(dev->cntl_urb); |
102 | if (dev->cntl_req) | 102 | kfree(dev->cntl_req); |
103 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | ||
104 | dev->cntl_req, dev->cntl_urb->setup_dma); | ||
105 | if (dev->cntl_buffer) | 103 | if (dev->cntl_buffer) |
106 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | 104 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, |
107 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); | 105 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); |
@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
234 | } | 232 | } |
235 | 233 | ||
236 | /* allocate buffer for control req */ | 234 | /* allocate buffer for control req */ |
237 | dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, | 235 | dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL); |
238 | GFP_KERNEL, | ||
239 | &dev->cntl_urb->setup_dma); | ||
240 | if (!dev->cntl_req) { | 236 | if (!dev->cntl_req) { |
241 | err("Could not allocate cntl_req"); | 237 | err("Could not allocate cntl_req"); |
242 | goto error; | 238 | goto error; |
@@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
286 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), | 282 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), |
287 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, | 283 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, |
288 | dev, 1); | 284 | dev, 1); |
289 | dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 285 | dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
290 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { | 286 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { |
291 | retval = -EIO; | 287 | retval = -EIO; |
292 | err("Could not submitting URB"); | 288 | err("Could not submitting URB"); |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 97ab975fa442..768b4b55c816 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -386,7 +386,7 @@ static int davinci_musb_init(struct musb *musb) | |||
386 | usb_nop_xceiv_register(); | 386 | usb_nop_xceiv_register(); |
387 | musb->xceiv = usb_get_transceiver(); | 387 | musb->xceiv = usb_get_transceiver(); |
388 | if (!musb->xceiv) | 388 | if (!musb->xceiv) |
389 | return -ENODEV; | 389 | goto unregister; |
390 | 390 | ||
391 | musb->mregs += DAVINCI_BASE_OFFSET; | 391 | musb->mregs += DAVINCI_BASE_OFFSET; |
392 | 392 | ||
@@ -444,6 +444,7 @@ static int davinci_musb_init(struct musb *musb) | |||
444 | 444 | ||
445 | fail: | 445 | fail: |
446 | usb_put_transceiver(musb->xceiv); | 446 | usb_put_transceiver(musb->xceiv); |
447 | unregister: | ||
447 | usb_nop_xceiv_unregister(); | 448 | usb_nop_xceiv_unregister(); |
448 | return -ENODEV; | 449 | return -ENODEV; |
449 | } | 450 | } |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 0f8b82918a40..66aaccf04490 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -137,6 +137,9 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | |||
137 | int i = 0; | 137 | int i = 0; |
138 | u8 r; | 138 | u8 r; |
139 | u8 power; | 139 | u8 power; |
140 | int ret; | ||
141 | |||
142 | pm_runtime_get_sync(phy->io_dev); | ||
140 | 143 | ||
141 | /* Make sure the transceiver is not in low power mode */ | 144 | /* Make sure the transceiver is not in low power mode */ |
142 | power = musb_readb(addr, MUSB_POWER); | 145 | power = musb_readb(addr, MUSB_POWER); |
@@ -154,15 +157,22 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | |||
154 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) | 157 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
155 | & MUSB_ULPI_REG_CMPLT)) { | 158 | & MUSB_ULPI_REG_CMPLT)) { |
156 | i++; | 159 | i++; |
157 | if (i == 10000) | 160 | if (i == 10000) { |
158 | return -ETIMEDOUT; | 161 | ret = -ETIMEDOUT; |
162 | goto out; | ||
163 | } | ||
159 | 164 | ||
160 | } | 165 | } |
161 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); | 166 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); |
162 | r &= ~MUSB_ULPI_REG_CMPLT; | 167 | r &= ~MUSB_ULPI_REG_CMPLT; |
163 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); | 168 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); |
164 | 169 | ||
165 | return musb_readb(addr, MUSB_ULPI_REG_DATA); | 170 | ret = musb_readb(addr, MUSB_ULPI_REG_DATA); |
171 | |||
172 | out: | ||
173 | pm_runtime_put(phy->io_dev); | ||
174 | |||
175 | return ret; | ||
166 | } | 176 | } |
167 | 177 | ||
168 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | 178 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
@@ -171,6 +181,9 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | |||
171 | int i = 0; | 181 | int i = 0; |
172 | u8 r = 0; | 182 | u8 r = 0; |
173 | u8 power; | 183 | u8 power; |
184 | int ret = 0; | ||
185 | |||
186 | pm_runtime_get_sync(phy->io_dev); | ||
174 | 187 | ||
175 | /* Make sure the transceiver is not in low power mode */ | 188 | /* Make sure the transceiver is not in low power mode */ |
176 | power = musb_readb(addr, MUSB_POWER); | 189 | power = musb_readb(addr, MUSB_POWER); |
@@ -184,15 +197,20 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | |||
184 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) | 197 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
185 | & MUSB_ULPI_REG_CMPLT)) { | 198 | & MUSB_ULPI_REG_CMPLT)) { |
186 | i++; | 199 | i++; |
187 | if (i == 10000) | 200 | if (i == 10000) { |
188 | return -ETIMEDOUT; | 201 | ret = -ETIMEDOUT; |
202 | goto out; | ||
203 | } | ||
189 | } | 204 | } |
190 | 205 | ||
191 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); | 206 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); |
192 | r &= ~MUSB_ULPI_REG_CMPLT; | 207 | r &= ~MUSB_ULPI_REG_CMPLT; |
193 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); | 208 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); |
194 | 209 | ||
195 | return 0; | 210 | out: |
211 | pm_runtime_put(phy->io_dev); | ||
212 | |||
213 | return ret; | ||
196 | } | 214 | } |
197 | #else | 215 | #else |
198 | #define musb_ulpi_read NULL | 216 | #define musb_ulpi_read NULL |
@@ -1904,14 +1922,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1904 | 1922 | ||
1905 | if (!musb->isr) { | 1923 | if (!musb->isr) { |
1906 | status = -ENODEV; | 1924 | status = -ENODEV; |
1907 | goto fail3; | 1925 | goto fail2; |
1908 | } | 1926 | } |
1909 | 1927 | ||
1910 | if (!musb->xceiv->io_ops) { | 1928 | if (!musb->xceiv->io_ops) { |
1929 | musb->xceiv->io_dev = musb->controller; | ||
1911 | musb->xceiv->io_priv = musb->mregs; | 1930 | musb->xceiv->io_priv = musb->mregs; |
1912 | musb->xceiv->io_ops = &musb_ulpi_access; | 1931 | musb->xceiv->io_ops = &musb_ulpi_access; |
1913 | } | 1932 | } |
1914 | 1933 | ||
1934 | pm_runtime_get_sync(musb->controller); | ||
1935 | |||
1915 | #ifndef CONFIG_MUSB_PIO_ONLY | 1936 | #ifndef CONFIG_MUSB_PIO_ONLY |
1916 | if (use_dma && dev->dma_mask) { | 1937 | if (use_dma && dev->dma_mask) { |
1917 | struct dma_controller *c; | 1938 | struct dma_controller *c; |
@@ -2023,6 +2044,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2023 | goto fail5; | 2044 | goto fail5; |
2024 | #endif | 2045 | #endif |
2025 | 2046 | ||
2047 | pm_runtime_put(musb->controller); | ||
2048 | |||
2026 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", | 2049 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", |
2027 | ({char *s; | 2050 | ({char *s; |
2028 | switch (musb->board_mode) { | 2051 | switch (musb->board_mode) { |
@@ -2047,6 +2070,9 @@ fail4: | |||
2047 | musb_gadget_cleanup(musb); | 2070 | musb_gadget_cleanup(musb); |
2048 | 2071 | ||
2049 | fail3: | 2072 | fail3: |
2073 | pm_runtime_put_sync(musb->controller); | ||
2074 | |||
2075 | fail2: | ||
2050 | if (musb->irq_wake) | 2076 | if (musb->irq_wake) |
2051 | device_init_wakeup(dev, 0); | 2077 | device_init_wakeup(dev, 0); |
2052 | musb_platform_exit(musb); | 2078 | musb_platform_exit(musb); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 93de517a32a0..f4a40f001c88 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -449,7 +449,7 @@ struct musb { | |||
449 | * We added this flag to forcefully disable double | 449 | * We added this flag to forcefully disable double |
450 | * buffering until we get it working. | 450 | * buffering until we get it working. |
451 | */ | 451 | */ |
452 | unsigned double_buffer_not_ok:1 __deprecated; | 452 | unsigned double_buffer_not_ok:1; |
453 | 453 | ||
454 | struct musb_hdrc_config *config; | 454 | struct musb_hdrc_config *config; |
455 | 455 | ||
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 79cb0af779fa..ef8d744800ac 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2098,7 +2098,7 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) | |||
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | /* turn off DMA requests, discard state, stop polling ... */ | 2100 | /* turn off DMA requests, discard state, stop polling ... */ |
2101 | if (is_in) { | 2101 | if (ep->epnum && is_in) { |
2102 | /* giveback saves bulk toggle */ | 2102 | /* giveback saves bulk toggle */ |
2103 | csr = musb_h_flush_rxfifo(ep, 0); | 2103 | csr = musb_h_flush_rxfifo(ep, 0); |
2104 | 2104 | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2ae0bb309994..c7785e81254c 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work) | |||
282 | 282 | ||
283 | static int omap2430_musb_init(struct musb *musb) | 283 | static int omap2430_musb_init(struct musb *musb) |
284 | { | 284 | { |
285 | u32 l, status = 0; | 285 | u32 l; |
286 | int status = 0; | ||
286 | struct device *dev = musb->controller; | 287 | struct device *dev = musb->controller; |
287 | struct musb_hdrc_platform_data *plat = dev->platform_data; | 288 | struct musb_hdrc_platform_data *plat = dev->platform_data; |
288 | struct omap_musb_board_data *data = plat->board_data; | 289 | struct omap_musb_board_data *data = plat->board_data; |
@@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
301 | 302 | ||
302 | status = pm_runtime_get_sync(dev); | 303 | status = pm_runtime_get_sync(dev); |
303 | if (status < 0) { | 304 | if (status < 0) { |
304 | dev_err(dev, "pm_runtime_get_sync FAILED"); | 305 | dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); |
305 | goto err1; | 306 | goto err1; |
306 | } | 307 | } |
307 | 308 | ||
@@ -333,6 +334,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
333 | 334 | ||
334 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); | 335 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); |
335 | 336 | ||
337 | pm_runtime_put_noidle(musb->controller); | ||
336 | return 0; | 338 | return 0; |
337 | 339 | ||
338 | err1: | 340 | err1: |
@@ -452,14 +454,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
452 | goto err2; | 454 | goto err2; |
453 | } | 455 | } |
454 | 456 | ||
457 | pm_runtime_enable(&pdev->dev); | ||
458 | |||
455 | ret = platform_device_add(musb); | 459 | ret = platform_device_add(musb); |
456 | if (ret) { | 460 | if (ret) { |
457 | dev_err(&pdev->dev, "failed to register musb device\n"); | 461 | dev_err(&pdev->dev, "failed to register musb device\n"); |
458 | goto err2; | 462 | goto err2; |
459 | } | 463 | } |
460 | 464 | ||
461 | pm_runtime_enable(&pdev->dev); | ||
462 | |||
463 | return 0; | 465 | return 0; |
464 | 466 | ||
465 | err2: | 467 | err2: |
@@ -478,7 +480,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev) | |||
478 | 480 | ||
479 | platform_device_del(glue->musb); | 481 | platform_device_del(glue->musb); |
480 | platform_device_put(glue->musb); | 482 | platform_device_put(glue->musb); |
481 | pm_runtime_put(&pdev->dev); | ||
482 | kfree(glue); | 483 | kfree(glue); |
483 | 484 | ||
484 | return 0; | 485 | return 0; |
@@ -491,11 +492,13 @@ static int omap2430_runtime_suspend(struct device *dev) | |||
491 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 492 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
492 | struct musb *musb = glue_to_musb(glue); | 493 | struct musb *musb = glue_to_musb(glue); |
493 | 494 | ||
494 | musb->context.otg_interfsel = musb_readl(musb->mregs, | 495 | if (musb) { |
495 | OTG_INTERFSEL); | 496 | musb->context.otg_interfsel = musb_readl(musb->mregs, |
497 | OTG_INTERFSEL); | ||
496 | 498 | ||
497 | omap2430_low_level_exit(musb); | 499 | omap2430_low_level_exit(musb); |
498 | usb_phy_set_suspend(musb->xceiv, 1); | 500 | usb_phy_set_suspend(musb->xceiv, 1); |
501 | } | ||
499 | 502 | ||
500 | return 0; | 503 | return 0; |
501 | } | 504 | } |
@@ -505,11 +508,13 @@ static int omap2430_runtime_resume(struct device *dev) | |||
505 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 508 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
506 | struct musb *musb = glue_to_musb(glue); | 509 | struct musb *musb = glue_to_musb(glue); |
507 | 510 | ||
508 | omap2430_low_level_init(musb); | 511 | if (musb) { |
509 | musb_writel(musb->mregs, OTG_INTERFSEL, | 512 | omap2430_low_level_init(musb); |
510 | musb->context.otg_interfsel); | 513 | musb_writel(musb->mregs, OTG_INTERFSEL, |
514 | musb->context.otg_interfsel); | ||
511 | 515 | ||
512 | usb_phy_set_suspend(musb->xceiv, 0); | 516 | usb_phy_set_suspend(musb->xceiv, 0); |
517 | } | ||
513 | 518 | ||
514 | return 0; | 519 | return 0; |
515 | } | 520 | } |
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index 3ece43a2e4c1..a0a2178974fe 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c | |||
@@ -96,7 +96,7 @@ static void gpio_vbus_work(struct work_struct *work) | |||
96 | struct gpio_vbus_data *gpio_vbus = | 96 | struct gpio_vbus_data *gpio_vbus = |
97 | container_of(work, struct gpio_vbus_data, work); | 97 | container_of(work, struct gpio_vbus_data, work); |
98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; | 98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; |
99 | int gpio; | 99 | int gpio, status; |
100 | 100 | ||
101 | if (!gpio_vbus->phy.otg->gadget) | 101 | if (!gpio_vbus->phy.otg->gadget) |
102 | return; | 102 | return; |
@@ -108,7 +108,9 @@ static void gpio_vbus_work(struct work_struct *work) | |||
108 | */ | 108 | */ |
109 | gpio = pdata->gpio_pullup; | 109 | gpio = pdata->gpio_pullup; |
110 | if (is_vbus_powered(pdata)) { | 110 | if (is_vbus_powered(pdata)) { |
111 | status = USB_EVENT_VBUS; | ||
111 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; | 112 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; |
113 | gpio_vbus->phy.last_event = status; | ||
112 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); | 114 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); |
113 | 115 | ||
114 | /* drawing a "unit load" is *always* OK, except for OTG */ | 116 | /* drawing a "unit load" is *always* OK, except for OTG */ |
@@ -117,6 +119,9 @@ static void gpio_vbus_work(struct work_struct *work) | |||
117 | /* optionally enable D+ pullup */ | 119 | /* optionally enable D+ pullup */ |
118 | if (gpio_is_valid(gpio)) | 120 | if (gpio_is_valid(gpio)) |
119 | gpio_set_value(gpio, !pdata->gpio_pullup_inverted); | 121 | gpio_set_value(gpio, !pdata->gpio_pullup_inverted); |
122 | |||
123 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | ||
124 | status, gpio_vbus->phy.otg->gadget); | ||
120 | } else { | 125 | } else { |
121 | /* optionally disable D+ pullup */ | 126 | /* optionally disable D+ pullup */ |
122 | if (gpio_is_valid(gpio)) | 127 | if (gpio_is_valid(gpio)) |
@@ -125,7 +130,12 @@ static void gpio_vbus_work(struct work_struct *work) | |||
125 | set_vbus_draw(gpio_vbus, 0); | 130 | set_vbus_draw(gpio_vbus, 0); |
126 | 131 | ||
127 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); | 132 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); |
133 | status = USB_EVENT_NONE; | ||
128 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; | 134 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; |
135 | gpio_vbus->phy.last_event = status; | ||
136 | |||
137 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | ||
138 | status, gpio_vbus->phy.otg->gadget); | ||
129 | } | 139 | } |
130 | } | 140 | } |
131 | 141 | ||
@@ -287,6 +297,9 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
287 | irq, err); | 297 | irq, err); |
288 | goto err_irq; | 298 | goto err_irq; |
289 | } | 299 | } |
300 | |||
301 | ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier); | ||
302 | |||
290 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); | 303 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); |
291 | 304 | ||
292 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); | 305 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 0310e2df59f5..ec30f95ef399 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -287,7 +287,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, | |||
287 | /* Issue the request, attempting to read 'size' bytes */ | 287 | /* Issue the request, attempting to read 'size' bytes */ |
288 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 288 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
289 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, | 289 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, |
290 | port_priv->bInterfaceNumber, buf, size, 300); | 290 | port_priv->bInterfaceNumber, buf, size, |
291 | USB_CTRL_GET_TIMEOUT); | ||
291 | 292 | ||
292 | /* Convert data into an array of integers */ | 293 | /* Convert data into an array of integers */ |
293 | for (i = 0; i < length; i++) | 294 | for (i = 0; i < length; i++) |
@@ -340,12 +341,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, | |||
340 | result = usb_control_msg(serial->dev, | 341 | result = usb_control_msg(serial->dev, |
341 | usb_sndctrlpipe(serial->dev, 0), | 342 | usb_sndctrlpipe(serial->dev, 0), |
342 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, | 343 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, |
343 | port_priv->bInterfaceNumber, buf, size, 300); | 344 | port_priv->bInterfaceNumber, buf, size, |
345 | USB_CTRL_SET_TIMEOUT); | ||
344 | } else { | 346 | } else { |
345 | result = usb_control_msg(serial->dev, | 347 | result = usb_control_msg(serial->dev, |
346 | usb_sndctrlpipe(serial->dev, 0), | 348 | usb_sndctrlpipe(serial->dev, 0), |
347 | request, REQTYPE_HOST_TO_DEVICE, data[0], | 349 | request, REQTYPE_HOST_TO_DEVICE, data[0], |
348 | port_priv->bInterfaceNumber, NULL, 0, 300); | 350 | port_priv->bInterfaceNumber, NULL, 0, |
351 | USB_CTRL_SET_TIMEOUT); | ||
349 | } | 352 | } |
350 | 353 | ||
351 | kfree(buf); | 354 | kfree(buf); |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index fdd5aa2c8d82..8c8bf806f6fa 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = { | |||
221 | }; | 221 | }; |
222 | 222 | ||
223 | /* 'blacklist' of interfaces not served by this driver */ | 223 | /* 'blacklist' of interfaces not served by this driver */ |
224 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 }; | 224 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 }; |
225 | static const struct sierra_iface_info direct_ip_interface_blacklist = { | 225 | static const struct sierra_iface_info direct_ip_interface_blacklist = { |
226 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), | 226 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), |
227 | .ifaceinfo = direct_ip_non_serial_ifaces, | 227 | .ifaceinfo = direct_ip_non_serial_ifaces, |
@@ -289,7 +289,6 @@ static const struct usb_device_id id_table[] = { | |||
289 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ | 289 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ |
290 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ | 290 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ |
291 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ | 291 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ |
292 | { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */ | ||
293 | /* Sierra Wireless C885 */ | 292 | /* Sierra Wireless C885 */ |
294 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, | 293 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, |
295 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ | 294 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ |
@@ -299,6 +298,9 @@ static const struct usb_device_id id_table[] = { | |||
299 | /* Sierra Wireless HSPA Non-Composite Device */ | 298 | /* Sierra Wireless HSPA Non-Composite Device */ |
300 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 299 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
301 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | 300 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ |
301 | { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */ | ||
302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
303 | }, | ||
302 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 304 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
303 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 305 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
304 | }, | 306 | }, |
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c index 66797e9c5010..810c90ae2c55 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c | |||
@@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb) | |||
645 | dev_err(dev, "NEEP: URB error %d\n", urb->status); | 645 | dev_err(dev, "NEEP: URB error %d\n", urb->status); |
646 | } | 646 | } |
647 | result = usb_submit_urb(urb, GFP_ATOMIC); | 647 | result = usb_submit_urb(urb, GFP_ATOMIC); |
648 | if (result < 0) { | 648 | if (result < 0 && result != -ENODEV && result != -EPERM) { |
649 | /* ignoring unrecoverable errors */ | ||
649 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", | 650 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", |
650 | result); | 651 | result); |
651 | goto error; | 652 | goto error; |
diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c index a269937be1b8..8cb71bb333c2 100644 --- a/drivers/uwb/neh.c +++ b/drivers/uwb/neh.c | |||
@@ -107,6 +107,7 @@ struct uwb_rc_neh { | |||
107 | u8 evt_type; | 107 | u8 evt_type; |
108 | __le16 evt; | 108 | __le16 evt; |
109 | u8 context; | 109 | u8 context; |
110 | u8 completed; | ||
110 | uwb_rc_cmd_cb_f cb; | 111 | uwb_rc_cmd_cb_f cb; |
111 | void *arg; | 112 | void *arg; |
112 | 113 | ||
@@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | |||
409 | struct device *dev = &rc->uwb_dev.dev; | 410 | struct device *dev = &rc->uwb_dev.dev; |
410 | struct uwb_rc_neh *neh; | 411 | struct uwb_rc_neh *neh; |
411 | struct uwb_rceb *notif; | 412 | struct uwb_rceb *notif; |
413 | unsigned long flags; | ||
412 | 414 | ||
413 | if (rceb->bEventContext == 0) { | 415 | if (rceb->bEventContext == 0) { |
414 | notif = kmalloc(size, GFP_ATOMIC); | 416 | notif = kmalloc(size, GFP_ATOMIC); |
@@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | |||
422 | } else { | 424 | } else { |
423 | neh = uwb_rc_neh_lookup(rc, rceb); | 425 | neh = uwb_rc_neh_lookup(rc, rceb); |
424 | if (neh) { | 426 | if (neh) { |
425 | del_timer_sync(&neh->timer); | 427 | spin_lock_irqsave(&rc->neh_lock, flags); |
428 | /* to guard against a timeout */ | ||
429 | neh->completed = 1; | ||
430 | del_timer(&neh->timer); | ||
431 | spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
426 | uwb_rc_neh_cb(neh, rceb, size); | 432 | uwb_rc_neh_cb(neh, rceb, size); |
427 | } else | 433 | } else |
428 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", | 434 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", |
@@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg) | |||
568 | unsigned long flags; | 574 | unsigned long flags; |
569 | 575 | ||
570 | spin_lock_irqsave(&rc->neh_lock, flags); | 576 | spin_lock_irqsave(&rc->neh_lock, flags); |
577 | if (neh->completed) { | ||
578 | spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
579 | return; | ||
580 | } | ||
571 | if (neh->context) | 581 | if (neh->context) |
572 | __uwb_rc_neh_rm(rc, neh); | 582 | __uwb_rc_neh_rm(rc, neh); |
573 | else | 583 | else |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index f0da2c32fbde..1f21d2a1e528 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -238,7 +238,7 @@ static void handle_tx(struct vhost_net *net) | |||
238 | 238 | ||
239 | vq->heads[vq->upend_idx].len = len; | 239 | vq->heads[vq->upend_idx].len = len; |
240 | ubuf->callback = vhost_zerocopy_callback; | 240 | ubuf->callback = vhost_zerocopy_callback; |
241 | ubuf->arg = vq->ubufs; | 241 | ubuf->ctx = vq->ubufs; |
242 | ubuf->desc = vq->upend_idx; | 242 | ubuf->desc = vq->upend_idx; |
243 | msg.msg_control = ubuf; | 243 | msg.msg_control = ubuf; |
244 | msg.msg_controllen = sizeof(ubuf); | 244 | msg.msg_controllen = sizeof(ubuf); |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 947f00d8e091..51e4c1eeec4f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -1598,10 +1598,9 @@ void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs) | |||
1598 | kfree(ubufs); | 1598 | kfree(ubufs); |
1599 | } | 1599 | } |
1600 | 1600 | ||
1601 | void vhost_zerocopy_callback(void *arg) | 1601 | void vhost_zerocopy_callback(struct ubuf_info *ubuf) |
1602 | { | 1602 | { |
1603 | struct ubuf_info *ubuf = arg; | 1603 | struct vhost_ubuf_ref *ubufs = ubuf->ctx; |
1604 | struct vhost_ubuf_ref *ubufs = ubuf->arg; | ||
1605 | struct vhost_virtqueue *vq = ubufs->vq; | 1604 | struct vhost_virtqueue *vq = ubufs->vq; |
1606 | 1605 | ||
1607 | /* set len = 1 to mark this desc buffers done DMA */ | 1606 | /* set len = 1 to mark this desc buffers done DMA */ |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 8dcf4cca6bf2..8de1fd5b8efb 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -188,7 +188,7 @@ bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *); | |||
188 | 188 | ||
189 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, | 189 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
190 | unsigned int log_num, u64 len); | 190 | unsigned int log_num, u64 len); |
191 | void vhost_zerocopy_callback(void *arg); | 191 | void vhost_zerocopy_callback(struct ubuf_info *); |
192 | int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq); | 192 | int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq); |
193 | 193 | ||
194 | #define vq_err(vq, fmt, ...) do { \ | 194 | #define vq_err(vq, fmt, ...) do { \ |
diff --git a/drivers/video/bfin-lq035q1-fb.c b/drivers/video/bfin-lq035q1-fb.c index 86922ac84412..353c02fe8a95 100644 --- a/drivers/video/bfin-lq035q1-fb.c +++ b/drivers/video/bfin-lq035q1-fb.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
14 | #include <linux/string.h> | 14 | #include <linux/string.h> |
15 | #include <linux/fb.h> | 15 | #include <linux/fb.h> |
16 | #include <linux/gpio.h> | ||
16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index cbc7ceef2786..9f13b897fd64 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -435,16 +435,16 @@ static void hpwdt_start(void) | |||
435 | { | 435 | { |
436 | reload = SECS_TO_TICKS(soft_margin); | 436 | reload = SECS_TO_TICKS(soft_margin); |
437 | iowrite16(reload, hpwdt_timer_reg); | 437 | iowrite16(reload, hpwdt_timer_reg); |
438 | iowrite16(0x85, hpwdt_timer_con); | 438 | iowrite8(0x85, hpwdt_timer_con); |
439 | } | 439 | } |
440 | 440 | ||
441 | static void hpwdt_stop(void) | 441 | static void hpwdt_stop(void) |
442 | { | 442 | { |
443 | unsigned long data; | 443 | unsigned long data; |
444 | 444 | ||
445 | data = ioread16(hpwdt_timer_con); | 445 | data = ioread8(hpwdt_timer_con); |
446 | data &= 0xFE; | 446 | data &= 0xFE; |
447 | iowrite16(data, hpwdt_timer_con); | 447 | iowrite8(data, hpwdt_timer_con); |
448 | } | 448 | } |
449 | 449 | ||
450 | static void hpwdt_ping(void) | 450 | static void hpwdt_ping(void) |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 4b33acd8ed4e..0a8a17cd80be 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -274,7 +274,7 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn) | |||
274 | 274 | ||
275 | static bool pirq_check_eoi_map(unsigned irq) | 275 | static bool pirq_check_eoi_map(unsigned irq) |
276 | { | 276 | { |
277 | return test_bit(irq, pirq_eoi_map); | 277 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); |
278 | } | 278 | } |
279 | 279 | ||
280 | static bool pirq_needs_eoi_flag(unsigned irq) | 280 | static bool pirq_needs_eoi_flag(unsigned irq) |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 99d8151c824a..1ffd03bf8e10 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -722,7 +722,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | |||
722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; | 722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; |
723 | 723 | ||
724 | if (use_ptemod) | 724 | if (use_ptemod) |
725 | vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; | 725 | vma->vm_flags |= VM_DONTCOPY; |
726 | 726 | ||
727 | vma->vm_private_data = map; | 727 | vma->vm_private_data = map; |
728 | 728 | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index b4d4eac761db..f100ce20b16b 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -1029,6 +1029,7 @@ int gnttab_init(void) | |||
1029 | int i; | 1029 | int i; |
1030 | unsigned int max_nr_glist_frames, nr_glist_frames; | 1030 | unsigned int max_nr_glist_frames, nr_glist_frames; |
1031 | unsigned int nr_init_grefs; | 1031 | unsigned int nr_init_grefs; |
1032 | int ret; | ||
1032 | 1033 | ||
1033 | nr_grant_frames = 1; | 1034 | nr_grant_frames = 1; |
1034 | boot_max_nr_grant_frames = __max_nr_grant_frames(); | 1035 | boot_max_nr_grant_frames = __max_nr_grant_frames(); |
@@ -1047,12 +1048,16 @@ int gnttab_init(void) | |||
1047 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | 1048 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; |
1048 | for (i = 0; i < nr_glist_frames; i++) { | 1049 | for (i = 0; i < nr_glist_frames; i++) { |
1049 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); | 1050 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); |
1050 | if (gnttab_list[i] == NULL) | 1051 | if (gnttab_list[i] == NULL) { |
1052 | ret = -ENOMEM; | ||
1051 | goto ini_nomem; | 1053 | goto ini_nomem; |
1054 | } | ||
1052 | } | 1055 | } |
1053 | 1056 | ||
1054 | if (gnttab_resume() < 0) | 1057 | if (gnttab_resume() < 0) { |
1055 | return -ENODEV; | 1058 | ret = -ENODEV; |
1059 | goto ini_nomem; | ||
1060 | } | ||
1056 | 1061 | ||
1057 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; | 1062 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; |
1058 | 1063 | ||
@@ -1070,7 +1075,7 @@ int gnttab_init(void) | |||
1070 | for (i--; i >= 0; i--) | 1075 | for (i--; i >= 0; i--) |
1071 | free_page((unsigned long)gnttab_list[i]); | 1076 | free_page((unsigned long)gnttab_list[i]); |
1072 | kfree(gnttab_list); | 1077 | kfree(gnttab_list); |
1073 | return -ENOMEM; | 1078 | return ret; |
1074 | } | 1079 | } |
1075 | EXPORT_SYMBOL_GPL(gnttab_init); | 1080 | EXPORT_SYMBOL_GPL(gnttab_init); |
1076 | 1081 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 9e14ae6cd49c..412b96cc5305 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -132,6 +132,7 @@ static void do_suspend(void) | |||
132 | err = dpm_suspend_end(PMSG_FREEZE); | 132 | err = dpm_suspend_end(PMSG_FREEZE); |
133 | if (err) { | 133 | if (err) { |
134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); | 134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); |
135 | si.cancelled = 0; | ||
135 | goto out_resume; | 136 | goto out_resume; |
136 | } | 137 | } |
137 | 138 | ||
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 174b5653cd8a..0b48579a9cd6 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
@@ -128,7 +128,10 @@ static int push_cxx_to_hypervisor(struct acpi_processor *_pr) | |||
128 | pr_debug(" C%d: %s %d uS\n", | 128 | pr_debug(" C%d: %s %d uS\n", |
129 | cx->type, cx->desc, (u32)cx->latency); | 129 | cx->type, cx->desc, (u32)cx->latency); |
130 | } | 130 | } |
131 | } else | 131 | } else if (ret != -EINVAL) |
132 | /* EINVAL means the ACPI ID is incorrect - meaning the ACPI | ||
133 | * table is referencing a non-existing CPU - which can happen | ||
134 | * with broken ACPI tables. */ | ||
132 | pr_err(DRV_NAME "(CX): Hypervisor error (%d) for ACPI CPU%u\n", | 135 | pr_err(DRV_NAME "(CX): Hypervisor error (%d) for ACPI CPU%u\n", |
133 | ret, _pr->acpi_id); | 136 | ret, _pr->acpi_id); |
134 | 137 | ||
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index f20c5f178b40..a31b54d48839 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -135,7 +135,7 @@ static int read_backend_details(struct xenbus_device *xendev) | |||
135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); | 135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); |
136 | } | 136 | } |
137 | 137 | ||
138 | static int is_device_connecting(struct device *dev, void *data) | 138 | static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential) |
139 | { | 139 | { |
140 | struct xenbus_device *xendev = to_xenbus_device(dev); | 140 | struct xenbus_device *xendev = to_xenbus_device(dev); |
141 | struct device_driver *drv = data; | 141 | struct device_driver *drv = data; |
@@ -152,16 +152,41 @@ static int is_device_connecting(struct device *dev, void *data) | |||
152 | if (drv && (dev->driver != drv)) | 152 | if (drv && (dev->driver != drv)) |
153 | return 0; | 153 | return 0; |
154 | 154 | ||
155 | if (ignore_nonessential) { | ||
156 | /* With older QEMU, for PVonHVM guests the guest config files | ||
157 | * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0'] | ||
158 | * which is nonsensical as there is no PV FB (there can be | ||
159 | * a PVKB) running as HVM guest. */ | ||
160 | |||
161 | if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0)) | ||
162 | return 0; | ||
163 | |||
164 | if ((strncmp(xendev->nodename, "device/vfb", 10) == 0)) | ||
165 | return 0; | ||
166 | } | ||
155 | xendrv = to_xenbus_driver(dev->driver); | 167 | xendrv = to_xenbus_driver(dev->driver); |
156 | return (xendev->state < XenbusStateConnected || | 168 | return (xendev->state < XenbusStateConnected || |
157 | (xendev->state == XenbusStateConnected && | 169 | (xendev->state == XenbusStateConnected && |
158 | xendrv->is_ready && !xendrv->is_ready(xendev))); | 170 | xendrv->is_ready && !xendrv->is_ready(xendev))); |
159 | } | 171 | } |
172 | static int essential_device_connecting(struct device *dev, void *data) | ||
173 | { | ||
174 | return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */); | ||
175 | } | ||
176 | static int non_essential_device_connecting(struct device *dev, void *data) | ||
177 | { | ||
178 | return is_device_connecting(dev, data, false); | ||
179 | } | ||
160 | 180 | ||
161 | static int exists_connecting_device(struct device_driver *drv) | 181 | static int exists_essential_connecting_device(struct device_driver *drv) |
162 | { | 182 | { |
163 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | 183 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, |
164 | is_device_connecting); | 184 | essential_device_connecting); |
185 | } | ||
186 | static int exists_non_essential_connecting_device(struct device_driver *drv) | ||
187 | { | ||
188 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | ||
189 | non_essential_device_connecting); | ||
165 | } | 190 | } |
166 | 191 | ||
167 | static int print_device_status(struct device *dev, void *data) | 192 | static int print_device_status(struct device *dev, void *data) |
@@ -192,6 +217,23 @@ static int print_device_status(struct device *dev, void *data) | |||
192 | /* We only wait for device setup after most initcalls have run. */ | 217 | /* We only wait for device setup after most initcalls have run. */ |
193 | static int ready_to_wait_for_devices; | 218 | static int ready_to_wait_for_devices; |
194 | 219 | ||
220 | static bool wait_loop(unsigned long start, unsigned int max_delay, | ||
221 | unsigned int *seconds_waited) | ||
222 | { | ||
223 | if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) { | ||
224 | if (!*seconds_waited) | ||
225 | printk(KERN_WARNING "XENBUS: Waiting for " | ||
226 | "devices to initialise: "); | ||
227 | *seconds_waited += 5; | ||
228 | printk("%us...", max_delay - *seconds_waited); | ||
229 | if (*seconds_waited == max_delay) | ||
230 | return true; | ||
231 | } | ||
232 | |||
233 | schedule_timeout_interruptible(HZ/10); | ||
234 | |||
235 | return false; | ||
236 | } | ||
195 | /* | 237 | /* |
196 | * On a 5-minute timeout, wait for all devices currently configured. We need | 238 | * On a 5-minute timeout, wait for all devices currently configured. We need |
197 | * to do this to guarantee that the filesystems and / or network devices | 239 | * to do this to guarantee that the filesystems and / or network devices |
@@ -215,19 +257,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv) | |||
215 | if (!ready_to_wait_for_devices || !xen_domain()) | 257 | if (!ready_to_wait_for_devices || !xen_domain()) |
216 | return; | 258 | return; |
217 | 259 | ||
218 | while (exists_connecting_device(drv)) { | 260 | while (exists_non_essential_connecting_device(drv)) |
219 | if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { | 261 | if (wait_loop(start, 30, &seconds_waited)) |
220 | if (!seconds_waited) | 262 | break; |
221 | printk(KERN_WARNING "XENBUS: Waiting for " | 263 | |
222 | "devices to initialise: "); | 264 | /* Skips PVKB and PVFB check.*/ |
223 | seconds_waited += 5; | 265 | while (exists_essential_connecting_device(drv)) |
224 | printk("%us...", 300 - seconds_waited); | 266 | if (wait_loop(start, 270, &seconds_waited)) |
225 | if (seconds_waited == 300) | 267 | break; |
226 | break; | ||
227 | } | ||
228 | |||
229 | schedule_timeout_interruptible(HZ/10); | ||
230 | } | ||
231 | 268 | ||
232 | if (seconds_waited) | 269 | if (seconds_waited) |
233 | printk("\n"); | 270 | printk("\n"); |