diff options
Diffstat (limited to 'drivers')
199 files changed, 3210 insertions, 1321 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 7049a7d27c4f..330bb4d75852 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -631,7 +631,7 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state) | |||
631 | * We know a device's inferred power state when all the resources | 631 | * We know a device's inferred power state when all the resources |
632 | * required for a given D-state are 'on'. | 632 | * required for a given D-state are 'on'. |
633 | */ | 633 | */ |
634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3; i++) { | 634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3_HOT; i++) { |
635 | list = &device->power.states[i].resources; | 635 | list = &device->power.states[i].resources; |
636 | if (list->count < 1) | 636 | if (list->count < 1) |
637 | continue; | 637 | continue; |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 767e2dcb9616..7417267e88fa 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -869,7 +869,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
869 | /* | 869 | /* |
870 | * Enumerate supported power management states | 870 | * Enumerate supported power management states |
871 | */ | 871 | */ |
872 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3; i++) { | 872 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { |
873 | struct acpi_device_power_state *ps = &device->power.states[i]; | 873 | struct acpi_device_power_state *ps = &device->power.states[i]; |
874 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; | 874 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; |
875 | 875 | ||
@@ -884,21 +884,18 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
884 | acpi_bus_add_power_resource(ps->resources.handles[j]); | 884 | acpi_bus_add_power_resource(ps->resources.handles[j]); |
885 | } | 885 | } |
886 | 886 | ||
887 | /* The exist of _PR3 indicates D3Cold support */ | ||
888 | if (i == ACPI_STATE_D3) { | ||
889 | status = acpi_get_handle(device->handle, object_name, &handle); | ||
890 | if (ACPI_SUCCESS(status)) | ||
891 | device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1; | ||
892 | } | ||
893 | |||
894 | /* Evaluate "_PSx" to see if we can do explicit sets */ | 887 | /* Evaluate "_PSx" to see if we can do explicit sets */ |
895 | object_name[2] = 'S'; | 888 | object_name[2] = 'S'; |
896 | status = acpi_get_handle(device->handle, object_name, &handle); | 889 | status = acpi_get_handle(device->handle, object_name, &handle); |
897 | if (ACPI_SUCCESS(status)) | 890 | if (ACPI_SUCCESS(status)) |
898 | ps->flags.explicit_set = 1; | 891 | ps->flags.explicit_set = 1; |
899 | 892 | ||
900 | /* State is valid if we have some power control */ | 893 | /* |
901 | if (ps->resources.count || ps->flags.explicit_set) | 894 | * State is valid if there are means to put the device into it. |
895 | * D3hot is only valid if _PR3 present. | ||
896 | */ | ||
897 | if (ps->resources.count || | ||
898 | (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT)) | ||
902 | ps->flags.valid = 1; | 899 | ps->flags.valid = 1; |
903 | 900 | ||
904 | ps->power = -1; /* Unknown - driver assigned */ | 901 | ps->power = -1; /* Unknown - driver assigned */ |
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/libata-core.c b/drivers/ata/libata-core.c index 28db50b57b91..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 | atomic_t ata_print_id = ATOMIC_INIT(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; |
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 93dabdcd2cbe..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 = atomic_inc_return(&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 = atomic_inc_return(&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/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/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/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/clk/Makefile b/drivers/clk/Makefile index 24aa7144811b..4a5bdbc30389 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile | |||
@@ -2,3 +2,5 @@ | |||
2 | obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o | 2 | obj-$(CONFIG_CLKDEV_LOOKUP) += clkdev.o |
3 | obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ | 3 | obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed-rate.o clk-gate.o \ |
4 | clk-mux.o clk-divider.o clk-fixed-factor.o | 4 | clk-mux.o clk-divider.o clk-fixed-factor.o |
5 | |||
6 | obj-$(CONFIG_ARCH_MXS) += mxs/ | ||
diff --git a/drivers/clk/mxs/Makefile b/drivers/clk/mxs/Makefile new file mode 100644 index 000000000000..7bedeec08524 --- /dev/null +++ b/drivers/clk/mxs/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # | ||
2 | # Makefile for mxs specific clk | ||
3 | # | ||
4 | |||
5 | obj-y += clk.o clk-pll.o clk-ref.o clk-div.o clk-frac.o | ||
6 | |||
7 | obj-$(CONFIG_SOC_IMX23) += clk-imx23.o | ||
8 | obj-$(CONFIG_SOC_IMX28) += clk-imx28.o | ||
diff --git a/drivers/clk/mxs/clk-div.c b/drivers/clk/mxs/clk-div.c new file mode 100644 index 000000000000..90e1da93877e --- /dev/null +++ b/drivers/clk/mxs/clk-div.c | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/clk-provider.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include "clk.h" | ||
17 | |||
18 | /** | ||
19 | * struct clk_div - mxs integer divider clock | ||
20 | * @divider: the parent class | ||
21 | * @ops: pointer to clk_ops of parent class | ||
22 | * @reg: register address | ||
23 | * @busy: busy bit shift | ||
24 | * | ||
25 | * The mxs divider clock is a subclass of basic clk_divider with an | ||
26 | * addtional busy bit. | ||
27 | */ | ||
28 | struct clk_div { | ||
29 | struct clk_divider divider; | ||
30 | const struct clk_ops *ops; | ||
31 | void __iomem *reg; | ||
32 | u8 busy; | ||
33 | }; | ||
34 | |||
35 | static inline struct clk_div *to_clk_div(struct clk_hw *hw) | ||
36 | { | ||
37 | struct clk_divider *divider = container_of(hw, struct clk_divider, hw); | ||
38 | |||
39 | return container_of(divider, struct clk_div, divider); | ||
40 | } | ||
41 | |||
42 | static unsigned long clk_div_recalc_rate(struct clk_hw *hw, | ||
43 | unsigned long parent_rate) | ||
44 | { | ||
45 | struct clk_div *div = to_clk_div(hw); | ||
46 | |||
47 | return div->ops->recalc_rate(&div->divider.hw, parent_rate); | ||
48 | } | ||
49 | |||
50 | static long clk_div_round_rate(struct clk_hw *hw, unsigned long rate, | ||
51 | unsigned long *prate) | ||
52 | { | ||
53 | struct clk_div *div = to_clk_div(hw); | ||
54 | |||
55 | return div->ops->round_rate(&div->divider.hw, rate, prate); | ||
56 | } | ||
57 | |||
58 | static int clk_div_set_rate(struct clk_hw *hw, unsigned long rate, | ||
59 | unsigned long parent_rate) | ||
60 | { | ||
61 | struct clk_div *div = to_clk_div(hw); | ||
62 | int ret; | ||
63 | |||
64 | ret = div->ops->set_rate(&div->divider.hw, rate, parent_rate); | ||
65 | if (!ret) | ||
66 | ret = mxs_clk_wait(div->reg, div->busy); | ||
67 | |||
68 | return ret; | ||
69 | } | ||
70 | |||
71 | static struct clk_ops clk_div_ops = { | ||
72 | .recalc_rate = clk_div_recalc_rate, | ||
73 | .round_rate = clk_div_round_rate, | ||
74 | .set_rate = clk_div_set_rate, | ||
75 | }; | ||
76 | |||
77 | struct clk *mxs_clk_div(const char *name, const char *parent_name, | ||
78 | void __iomem *reg, u8 shift, u8 width, u8 busy) | ||
79 | { | ||
80 | struct clk_div *div; | ||
81 | struct clk *clk; | ||
82 | struct clk_init_data init; | ||
83 | |||
84 | div = kzalloc(sizeof(*div), GFP_KERNEL); | ||
85 | if (!div) | ||
86 | return ERR_PTR(-ENOMEM); | ||
87 | |||
88 | init.name = name; | ||
89 | init.ops = &clk_div_ops; | ||
90 | init.flags = CLK_SET_RATE_PARENT; | ||
91 | init.parent_names = (parent_name ? &parent_name: NULL); | ||
92 | init.num_parents = (parent_name ? 1 : 0); | ||
93 | |||
94 | div->reg = reg; | ||
95 | div->busy = busy; | ||
96 | |||
97 | div->divider.reg = reg; | ||
98 | div->divider.shift = shift; | ||
99 | div->divider.width = width; | ||
100 | div->divider.flags = CLK_DIVIDER_ONE_BASED; | ||
101 | div->divider.lock = &mxs_lock; | ||
102 | div->divider.hw.init = &init; | ||
103 | div->ops = &clk_divider_ops; | ||
104 | |||
105 | clk = clk_register(NULL, &div->divider.hw); | ||
106 | if (IS_ERR(clk)) | ||
107 | kfree(div); | ||
108 | |||
109 | return clk; | ||
110 | } | ||
diff --git a/drivers/clk/mxs/clk-frac.c b/drivers/clk/mxs/clk-frac.c new file mode 100644 index 000000000000..e6aa6b567d68 --- /dev/null +++ b/drivers/clk/mxs/clk-frac.c | |||
@@ -0,0 +1,139 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/clk-provider.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include "clk.h" | ||
18 | |||
19 | /** | ||
20 | * struct clk_frac - mxs fractional divider clock | ||
21 | * @hw: clk_hw for the fractional divider clock | ||
22 | * @reg: register address | ||
23 | * @shift: the divider bit shift | ||
24 | * @width: the divider bit width | ||
25 | * @busy: busy bit shift | ||
26 | * | ||
27 | * The clock is an adjustable fractional divider with a busy bit to wait | ||
28 | * when the divider is adjusted. | ||
29 | */ | ||
30 | struct clk_frac { | ||
31 | struct clk_hw hw; | ||
32 | void __iomem *reg; | ||
33 | u8 shift; | ||
34 | u8 width; | ||
35 | u8 busy; | ||
36 | }; | ||
37 | |||
38 | #define to_clk_frac(_hw) container_of(_hw, struct clk_frac, hw) | ||
39 | |||
40 | static unsigned long clk_frac_recalc_rate(struct clk_hw *hw, | ||
41 | unsigned long parent_rate) | ||
42 | { | ||
43 | struct clk_frac *frac = to_clk_frac(hw); | ||
44 | u32 div; | ||
45 | |||
46 | div = readl_relaxed(frac->reg) >> frac->shift; | ||
47 | div &= (1 << frac->width) - 1; | ||
48 | |||
49 | return (parent_rate >> frac->width) * div; | ||
50 | } | ||
51 | |||
52 | static long clk_frac_round_rate(struct clk_hw *hw, unsigned long rate, | ||
53 | unsigned long *prate) | ||
54 | { | ||
55 | struct clk_frac *frac = to_clk_frac(hw); | ||
56 | unsigned long parent_rate = *prate; | ||
57 | u32 div; | ||
58 | u64 tmp; | ||
59 | |||
60 | if (rate > parent_rate) | ||
61 | return -EINVAL; | ||
62 | |||
63 | tmp = rate; | ||
64 | tmp <<= frac->width; | ||
65 | do_div(tmp, parent_rate); | ||
66 | div = tmp; | ||
67 | |||
68 | if (!div) | ||
69 | return -EINVAL; | ||
70 | |||
71 | return (parent_rate >> frac->width) * div; | ||
72 | } | ||
73 | |||
74 | static int clk_frac_set_rate(struct clk_hw *hw, unsigned long rate, | ||
75 | unsigned long parent_rate) | ||
76 | { | ||
77 | struct clk_frac *frac = to_clk_frac(hw); | ||
78 | unsigned long flags; | ||
79 | u32 div, val; | ||
80 | u64 tmp; | ||
81 | |||
82 | if (rate > parent_rate) | ||
83 | return -EINVAL; | ||
84 | |||
85 | tmp = rate; | ||
86 | tmp <<= frac->width; | ||
87 | do_div(tmp, parent_rate); | ||
88 | div = tmp; | ||
89 | |||
90 | if (!div) | ||
91 | return -EINVAL; | ||
92 | |||
93 | spin_lock_irqsave(&mxs_lock, flags); | ||
94 | |||
95 | val = readl_relaxed(frac->reg); | ||
96 | val &= ~(((1 << frac->width) - 1) << frac->shift); | ||
97 | val |= div << frac->shift; | ||
98 | writel_relaxed(val, frac->reg); | ||
99 | |||
100 | spin_unlock_irqrestore(&mxs_lock, flags); | ||
101 | |||
102 | return mxs_clk_wait(frac->reg, frac->busy); | ||
103 | } | ||
104 | |||
105 | static struct clk_ops clk_frac_ops = { | ||
106 | .recalc_rate = clk_frac_recalc_rate, | ||
107 | .round_rate = clk_frac_round_rate, | ||
108 | .set_rate = clk_frac_set_rate, | ||
109 | }; | ||
110 | |||
111 | struct clk *mxs_clk_frac(const char *name, const char *parent_name, | ||
112 | void __iomem *reg, u8 shift, u8 width, u8 busy) | ||
113 | { | ||
114 | struct clk_frac *frac; | ||
115 | struct clk *clk; | ||
116 | struct clk_init_data init; | ||
117 | |||
118 | frac = kzalloc(sizeof(*frac), GFP_KERNEL); | ||
119 | if (!frac) | ||
120 | return ERR_PTR(-ENOMEM); | ||
121 | |||
122 | init.name = name; | ||
123 | init.ops = &clk_frac_ops; | ||
124 | init.flags = CLK_SET_RATE_PARENT; | ||
125 | init.parent_names = (parent_name ? &parent_name: NULL); | ||
126 | init.num_parents = (parent_name ? 1 : 0); | ||
127 | |||
128 | frac->reg = reg; | ||
129 | frac->shift = shift; | ||
130 | frac->width = width; | ||
131 | frac->busy = busy; | ||
132 | frac->hw.init = &init; | ||
133 | |||
134 | clk = clk_register(NULL, &frac->hw); | ||
135 | if (IS_ERR(clk)) | ||
136 | kfree(frac); | ||
137 | |||
138 | return clk; | ||
139 | } | ||
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c new file mode 100644 index 000000000000..dcae11285716 --- /dev/null +++ b/drivers/clk/mxs/clk-imx23.c | |||
@@ -0,0 +1,204 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/clkdev.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <mach/common.h> | ||
18 | #include <mach/mx23.h> | ||
19 | #include "clk.h" | ||
20 | |||
21 | #define DIGCTRL MX23_IO_ADDRESS(MX23_DIGCTL_BASE_ADDR) | ||
22 | #define CLKCTRL MX23_IO_ADDRESS(MX23_CLKCTRL_BASE_ADDR) | ||
23 | #define PLLCTRL0 (CLKCTRL + 0x0000) | ||
24 | #define CPU (CLKCTRL + 0x0020) | ||
25 | #define HBUS (CLKCTRL + 0x0030) | ||
26 | #define XBUS (CLKCTRL + 0x0040) | ||
27 | #define XTAL (CLKCTRL + 0x0050) | ||
28 | #define PIX (CLKCTRL + 0x0060) | ||
29 | #define SSP (CLKCTRL + 0x0070) | ||
30 | #define GPMI (CLKCTRL + 0x0080) | ||
31 | #define SPDIF (CLKCTRL + 0x0090) | ||
32 | #define EMI (CLKCTRL + 0x00a0) | ||
33 | #define SAIF (CLKCTRL + 0x00c0) | ||
34 | #define TV (CLKCTRL + 0x00d0) | ||
35 | #define ETM (CLKCTRL + 0x00e0) | ||
36 | #define FRAC (CLKCTRL + 0x00f0) | ||
37 | #define CLKSEQ (CLKCTRL + 0x0110) | ||
38 | |||
39 | #define BP_CPU_INTERRUPT_WAIT 12 | ||
40 | #define BP_CLKSEQ_BYPASS_SAIF 0 | ||
41 | #define BP_CLKSEQ_BYPASS_SSP 5 | ||
42 | #define BP_SAIF_DIV_FRAC_EN 16 | ||
43 | #define BP_FRAC_IOFRAC 24 | ||
44 | |||
45 | static void __init clk_misc_init(void) | ||
46 | { | ||
47 | u32 val; | ||
48 | |||
49 | /* Gate off cpu clock in WFI for power saving */ | ||
50 | __mxs_setl(1 << BP_CPU_INTERRUPT_WAIT, CPU); | ||
51 | |||
52 | /* Clear BYPASS for SAIF */ | ||
53 | __mxs_clrl(1 << BP_CLKSEQ_BYPASS_SAIF, CLKSEQ); | ||
54 | |||
55 | /* SAIF has to use frac div for functional operation */ | ||
56 | val = readl_relaxed(SAIF); | ||
57 | val |= 1 << BP_SAIF_DIV_FRAC_EN; | ||
58 | writel_relaxed(val, SAIF); | ||
59 | |||
60 | /* | ||
61 | * Source ssp clock from ref_io than ref_xtal, | ||
62 | * as ref_xtal only provides 24 MHz as maximum. | ||
63 | */ | ||
64 | __mxs_clrl(1 << BP_CLKSEQ_BYPASS_SSP, CLKSEQ); | ||
65 | |||
66 | /* | ||
67 | * 480 MHz seems too high to be ssp clock source directly, | ||
68 | * so set frac to get a 288 MHz ref_io. | ||
69 | */ | ||
70 | __mxs_clrl(0x3f << BP_FRAC_IOFRAC, FRAC); | ||
71 | __mxs_setl(30 << BP_FRAC_IOFRAC, FRAC); | ||
72 | } | ||
73 | |||
74 | static struct clk_lookup uart_lookups[] __initdata = { | ||
75 | { .dev_id = "duart", }, | ||
76 | { .dev_id = "mxs-auart.0", }, | ||
77 | { .dev_id = "mxs-auart.1", }, | ||
78 | { .dev_id = "8006c000.serial", }, | ||
79 | { .dev_id = "8006e000.serial", }, | ||
80 | { .dev_id = "80070000.serial", }, | ||
81 | }; | ||
82 | |||
83 | static struct clk_lookup hbus_lookups[] __initdata = { | ||
84 | { .dev_id = "mxs-dma-apbh", }, | ||
85 | { .dev_id = "80004000.dma-apbh", }, | ||
86 | }; | ||
87 | |||
88 | static struct clk_lookup xbus_lookups[] __initdata = { | ||
89 | { .dev_id = "duart", .con_id = "apb_pclk"}, | ||
90 | { .dev_id = "mxs-dma-apbx", }, | ||
91 | { .dev_id = "80024000.dma-apbx", }, | ||
92 | }; | ||
93 | |||
94 | static struct clk_lookup ssp_lookups[] __initdata = { | ||
95 | { .dev_id = "mxs-mmc.0", }, | ||
96 | { .dev_id = "mxs-mmc.1", }, | ||
97 | { .dev_id = "80010000.ssp", }, | ||
98 | { .dev_id = "80034000.ssp", }, | ||
99 | }; | ||
100 | |||
101 | static struct clk_lookup lcdif_lookups[] __initdata = { | ||
102 | { .dev_id = "imx23-fb", }, | ||
103 | { .dev_id = "80030000.lcdif", }, | ||
104 | }; | ||
105 | |||
106 | static struct clk_lookup gpmi_lookups[] __initdata = { | ||
107 | { .dev_id = "imx23-gpmi-nand", }, | ||
108 | { .dev_id = "8000c000.gpmi", }, | ||
109 | }; | ||
110 | |||
111 | static const char *sel_pll[] __initconst = { "pll", "ref_xtal", }; | ||
112 | static const char *sel_cpu[] __initconst = { "ref_cpu", "ref_xtal", }; | ||
113 | static const char *sel_pix[] __initconst = { "ref_pix", "ref_xtal", }; | ||
114 | static const char *sel_io[] __initconst = { "ref_io", "ref_xtal", }; | ||
115 | static const char *cpu_sels[] __initconst = { "cpu_pll", "cpu_xtal", }; | ||
116 | static const char *emi_sels[] __initconst = { "emi_pll", "emi_xtal", }; | ||
117 | |||
118 | enum imx23_clk { | ||
119 | ref_xtal, pll, ref_cpu, ref_emi, ref_pix, ref_io, saif_sel, | ||
120 | lcdif_sel, gpmi_sel, ssp_sel, emi_sel, cpu, etm_sel, cpu_pll, | ||
121 | cpu_xtal, hbus, xbus, lcdif_div, ssp_div, gpmi_div, emi_pll, | ||
122 | emi_xtal, etm_div, saif_div, clk32k_div, rtc, adc, spdif_div, | ||
123 | clk32k, dri, pwm, filt, uart, ssp, gpmi, spdif, emi, saif, | ||
124 | lcdif, etm, usb, usb_pwr, | ||
125 | clk_max | ||
126 | }; | ||
127 | |||
128 | static struct clk *clks[clk_max]; | ||
129 | |||
130 | static enum imx23_clk clks_init_on[] __initdata = { | ||
131 | cpu, hbus, xbus, emi, uart, | ||
132 | }; | ||
133 | |||
134 | int __init mx23_clocks_init(void) | ||
135 | { | ||
136 | int i; | ||
137 | |||
138 | clk_misc_init(); | ||
139 | |||
140 | clks[ref_xtal] = mxs_clk_fixed("ref_xtal", 24000000); | ||
141 | clks[pll] = mxs_clk_pll("pll", "ref_xtal", PLLCTRL0, 16, 480000000); | ||
142 | clks[ref_cpu] = mxs_clk_ref("ref_cpu", "pll", FRAC, 0); | ||
143 | clks[ref_emi] = mxs_clk_ref("ref_emi", "pll", FRAC, 1); | ||
144 | clks[ref_pix] = mxs_clk_ref("ref_pix", "pll", FRAC, 2); | ||
145 | clks[ref_io] = mxs_clk_ref("ref_io", "pll", FRAC, 3); | ||
146 | clks[saif_sel] = mxs_clk_mux("saif_sel", CLKSEQ, 0, 1, sel_pll, ARRAY_SIZE(sel_pll)); | ||
147 | clks[lcdif_sel] = mxs_clk_mux("lcdif_sel", CLKSEQ, 1, 1, sel_pix, ARRAY_SIZE(sel_pix)); | ||
148 | clks[gpmi_sel] = mxs_clk_mux("gpmi_sel", CLKSEQ, 4, 1, sel_io, ARRAY_SIZE(sel_io)); | ||
149 | clks[ssp_sel] = mxs_clk_mux("ssp_sel", CLKSEQ, 5, 1, sel_io, ARRAY_SIZE(sel_io)); | ||
150 | clks[emi_sel] = mxs_clk_mux("emi_sel", CLKSEQ, 6, 1, emi_sels, ARRAY_SIZE(emi_sels)); | ||
151 | clks[cpu] = mxs_clk_mux("cpu", CLKSEQ, 7, 1, cpu_sels, ARRAY_SIZE(cpu_sels)); | ||
152 | clks[etm_sel] = mxs_clk_mux("etm_sel", CLKSEQ, 8, 1, sel_cpu, ARRAY_SIZE(sel_cpu)); | ||
153 | clks[cpu_pll] = mxs_clk_div("cpu_pll", "ref_cpu", CPU, 0, 6, 28); | ||
154 | clks[cpu_xtal] = mxs_clk_div("cpu_xtal", "ref_xtal", CPU, 16, 10, 29); | ||
155 | clks[hbus] = mxs_clk_div("hbus", "cpu", HBUS, 0, 5, 29); | ||
156 | clks[xbus] = mxs_clk_div("xbus", "ref_xtal", XBUS, 0, 10, 31); | ||
157 | clks[lcdif_div] = mxs_clk_div("lcdif_div", "lcdif_sel", PIX, 0, 12, 29); | ||
158 | clks[ssp_div] = mxs_clk_div("ssp_div", "ssp_sel", SSP, 0, 9, 29); | ||
159 | clks[gpmi_div] = mxs_clk_div("gpmi_div", "gpmi_sel", GPMI, 0, 10, 29); | ||
160 | clks[emi_pll] = mxs_clk_div("emi_pll", "ref_emi", EMI, 0, 6, 28); | ||
161 | clks[emi_xtal] = mxs_clk_div("emi_xtal", "ref_xtal", EMI, 8, 4, 29); | ||
162 | clks[etm_div] = mxs_clk_div("etm_div", "etm_sel", ETM, 0, 6, 29); | ||
163 | clks[saif_div] = mxs_clk_frac("saif_div", "saif_sel", SAIF, 0, 16, 29); | ||
164 | clks[clk32k_div] = mxs_clk_fixed_factor("clk32k_div", "ref_xtal", 1, 750); | ||
165 | clks[rtc] = mxs_clk_fixed_factor("rtc", "ref_xtal", 1, 768); | ||
166 | clks[adc] = mxs_clk_fixed_factor("adc", "clk32k", 1, 16); | ||
167 | clks[spdif_div] = mxs_clk_fixed_factor("spdif_div", "pll", 1, 4); | ||
168 | clks[clk32k] = mxs_clk_gate("clk32k", "clk32k_div", XTAL, 26); | ||
169 | clks[dri] = mxs_clk_gate("dri", "ref_xtal", XTAL, 28); | ||
170 | clks[pwm] = mxs_clk_gate("pwm", "ref_xtal", XTAL, 29); | ||
171 | clks[filt] = mxs_clk_gate("filt", "ref_xtal", XTAL, 30); | ||
172 | clks[uart] = mxs_clk_gate("uart", "ref_xtal", XTAL, 31); | ||
173 | clks[ssp] = mxs_clk_gate("ssp", "ssp_div", SSP, 31); | ||
174 | clks[gpmi] = mxs_clk_gate("gpmi", "gpmi_div", GPMI, 31); | ||
175 | clks[spdif] = mxs_clk_gate("spdif", "spdif_div", SPDIF, 31); | ||
176 | clks[emi] = mxs_clk_gate("emi", "emi_sel", EMI, 31); | ||
177 | clks[saif] = mxs_clk_gate("saif", "saif_div", SAIF, 31); | ||
178 | clks[lcdif] = mxs_clk_gate("lcdif", "lcdif_div", PIX, 31); | ||
179 | clks[etm] = mxs_clk_gate("etm", "etm_div", ETM, 31); | ||
180 | clks[usb] = mxs_clk_gate("usb", "usb_pwr", DIGCTRL, 2); | ||
181 | clks[usb_pwr] = clk_register_gate(NULL, "usb_pwr", "pll", 0, PLLCTRL0, 18, 0, &mxs_lock); | ||
182 | |||
183 | for (i = 0; i < ARRAY_SIZE(clks); i++) | ||
184 | if (IS_ERR(clks[i])) { | ||
185 | pr_err("i.MX23 clk %d: register failed with %ld\n", | ||
186 | i, PTR_ERR(clks[i])); | ||
187 | return PTR_ERR(clks[i]); | ||
188 | } | ||
189 | |||
190 | clk_register_clkdev(clks[clk32k], NULL, "timrot"); | ||
191 | clk_register_clkdevs(clks[hbus], hbus_lookups, ARRAY_SIZE(hbus_lookups)); | ||
192 | clk_register_clkdevs(clks[xbus], xbus_lookups, ARRAY_SIZE(xbus_lookups)); | ||
193 | clk_register_clkdevs(clks[uart], uart_lookups, ARRAY_SIZE(uart_lookups)); | ||
194 | clk_register_clkdevs(clks[ssp], ssp_lookups, ARRAY_SIZE(ssp_lookups)); | ||
195 | clk_register_clkdevs(clks[gpmi], gpmi_lookups, ARRAY_SIZE(gpmi_lookups)); | ||
196 | clk_register_clkdevs(clks[lcdif], lcdif_lookups, ARRAY_SIZE(lcdif_lookups)); | ||
197 | |||
198 | for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) | ||
199 | clk_prepare_enable(clks[clks_init_on[i]]); | ||
200 | |||
201 | mxs_timer_init(MX23_INT_TIMER0); | ||
202 | |||
203 | return 0; | ||
204 | } | ||
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c new file mode 100644 index 000000000000..b2a3257d4f66 --- /dev/null +++ b/drivers/clk/mxs/clk-imx28.c | |||
@@ -0,0 +1,337 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/clkdev.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <mach/common.h> | ||
18 | #include <mach/mx28.h> | ||
19 | #include "clk.h" | ||
20 | |||
21 | #define CLKCTRL MX28_IO_ADDRESS(MX28_CLKCTRL_BASE_ADDR) | ||
22 | #define PLL0CTRL0 (CLKCTRL + 0x0000) | ||
23 | #define PLL1CTRL0 (CLKCTRL + 0x0020) | ||
24 | #define PLL2CTRL0 (CLKCTRL + 0x0040) | ||
25 | #define CPU (CLKCTRL + 0x0050) | ||
26 | #define HBUS (CLKCTRL + 0x0060) | ||
27 | #define XBUS (CLKCTRL + 0x0070) | ||
28 | #define XTAL (CLKCTRL + 0x0080) | ||
29 | #define SSP0 (CLKCTRL + 0x0090) | ||
30 | #define SSP1 (CLKCTRL + 0x00a0) | ||
31 | #define SSP2 (CLKCTRL + 0x00b0) | ||
32 | #define SSP3 (CLKCTRL + 0x00c0) | ||
33 | #define GPMI (CLKCTRL + 0x00d0) | ||
34 | #define SPDIF (CLKCTRL + 0x00e0) | ||
35 | #define EMI (CLKCTRL + 0x00f0) | ||
36 | #define SAIF0 (CLKCTRL + 0x0100) | ||
37 | #define SAIF1 (CLKCTRL + 0x0110) | ||
38 | #define LCDIF (CLKCTRL + 0x0120) | ||
39 | #define ETM (CLKCTRL + 0x0130) | ||
40 | #define ENET (CLKCTRL + 0x0140) | ||
41 | #define FLEXCAN (CLKCTRL + 0x0160) | ||
42 | #define FRAC0 (CLKCTRL + 0x01b0) | ||
43 | #define FRAC1 (CLKCTRL + 0x01c0) | ||
44 | #define CLKSEQ (CLKCTRL + 0x01d0) | ||
45 | |||
46 | #define BP_CPU_INTERRUPT_WAIT 12 | ||
47 | #define BP_SAIF_DIV_FRAC_EN 16 | ||
48 | #define BP_ENET_DIV_TIME 21 | ||
49 | #define BP_ENET_SLEEP 31 | ||
50 | #define BP_CLKSEQ_BYPASS_SAIF0 0 | ||
51 | #define BP_CLKSEQ_BYPASS_SSP0 3 | ||
52 | #define BP_FRAC0_IO1FRAC 16 | ||
53 | #define BP_FRAC0_IO0FRAC 24 | ||
54 | |||
55 | #define DIGCTRL MX28_IO_ADDRESS(MX28_DIGCTL_BASE_ADDR) | ||
56 | #define BP_SAIF_CLKMUX 10 | ||
57 | |||
58 | /* | ||
59 | * HW_SAIF_CLKMUX_SEL: | ||
60 | * DIRECT(0x0): SAIF0 clock pins selected for SAIF0 input clocks, and SAIF1 | ||
61 | * clock pins selected for SAIF1 input clocks. | ||
62 | * CROSSINPUT(0x1): SAIF1 clock inputs selected for SAIF0 input clocks, and | ||
63 | * SAIF0 clock inputs selected for SAIF1 input clocks. | ||
64 | * EXTMSTR0(0x2): SAIF0 clock pin selected for both SAIF0 and SAIF1 input | ||
65 | * clocks. | ||
66 | * EXTMSTR1(0x3): SAIF1 clock pin selected for both SAIF0 and SAIF1 input | ||
67 | * clocks. | ||
68 | */ | ||
69 | int mxs_saif_clkmux_select(unsigned int clkmux) | ||
70 | { | ||
71 | if (clkmux > 0x3) | ||
72 | return -EINVAL; | ||
73 | |||
74 | __mxs_clrl(0x3 << BP_SAIF_CLKMUX, DIGCTRL); | ||
75 | __mxs_setl(clkmux << BP_SAIF_CLKMUX, DIGCTRL); | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static void __init clk_misc_init(void) | ||
81 | { | ||
82 | u32 val; | ||
83 | |||
84 | /* Gate off cpu clock in WFI for power saving */ | ||
85 | __mxs_setl(1 << BP_CPU_INTERRUPT_WAIT, CPU); | ||
86 | |||
87 | /* 0 is a bad default value for a divider */ | ||
88 | __mxs_setl(1 << BP_ENET_DIV_TIME, ENET); | ||
89 | |||
90 | /* Clear BYPASS for SAIF */ | ||
91 | __mxs_clrl(0x3 << BP_CLKSEQ_BYPASS_SAIF0, CLKSEQ); | ||
92 | |||
93 | /* SAIF has to use frac div for functional operation */ | ||
94 | val = readl_relaxed(SAIF0); | ||
95 | val |= 1 << BP_SAIF_DIV_FRAC_EN; | ||
96 | writel_relaxed(val, SAIF0); | ||
97 | |||
98 | val = readl_relaxed(SAIF1); | ||
99 | val |= 1 << BP_SAIF_DIV_FRAC_EN; | ||
100 | writel_relaxed(val, SAIF1); | ||
101 | |||
102 | /* Extra fec clock setting */ | ||
103 | val = readl_relaxed(ENET); | ||
104 | val &= ~(1 << BP_ENET_SLEEP); | ||
105 | writel_relaxed(val, ENET); | ||
106 | |||
107 | /* | ||
108 | * Source ssp clock from ref_io than ref_xtal, | ||
109 | * as ref_xtal only provides 24 MHz as maximum. | ||
110 | */ | ||
111 | __mxs_clrl(0xf << BP_CLKSEQ_BYPASS_SSP0, CLKSEQ); | ||
112 | |||
113 | /* | ||
114 | * 480 MHz seems too high to be ssp clock source directly, | ||
115 | * so set frac0 to get a 288 MHz ref_io0. | ||
116 | */ | ||
117 | val = readl_relaxed(FRAC0); | ||
118 | val &= ~(0x3f << BP_FRAC0_IO0FRAC); | ||
119 | val |= 30 << BP_FRAC0_IO0FRAC; | ||
120 | writel_relaxed(val, FRAC0); | ||
121 | } | ||
122 | |||
123 | static struct clk_lookup uart_lookups[] __initdata = { | ||
124 | { .dev_id = "duart", }, | ||
125 | { .dev_id = "mxs-auart.0", }, | ||
126 | { .dev_id = "mxs-auart.1", }, | ||
127 | { .dev_id = "mxs-auart.2", }, | ||
128 | { .dev_id = "mxs-auart.3", }, | ||
129 | { .dev_id = "mxs-auart.4", }, | ||
130 | { .dev_id = "8006a000.serial", }, | ||
131 | { .dev_id = "8006c000.serial", }, | ||
132 | { .dev_id = "8006e000.serial", }, | ||
133 | { .dev_id = "80070000.serial", }, | ||
134 | { .dev_id = "80072000.serial", }, | ||
135 | { .dev_id = "80074000.serial", }, | ||
136 | }; | ||
137 | |||
138 | static struct clk_lookup hbus_lookups[] __initdata = { | ||
139 | { .dev_id = "mxs-dma-apbh", }, | ||
140 | { .dev_id = "80004000.dma-apbh", }, | ||
141 | }; | ||
142 | |||
143 | static struct clk_lookup xbus_lookups[] __initdata = { | ||
144 | { .dev_id = "duart", .con_id = "apb_pclk"}, | ||
145 | { .dev_id = "mxs-dma-apbx", }, | ||
146 | { .dev_id = "80024000.dma-apbx", }, | ||
147 | }; | ||
148 | |||
149 | static struct clk_lookup ssp0_lookups[] __initdata = { | ||
150 | { .dev_id = "mxs-mmc.0", }, | ||
151 | { .dev_id = "80010000.ssp", }, | ||
152 | }; | ||
153 | |||
154 | static struct clk_lookup ssp1_lookups[] __initdata = { | ||
155 | { .dev_id = "mxs-mmc.1", }, | ||
156 | { .dev_id = "80012000.ssp", }, | ||
157 | }; | ||
158 | |||
159 | static struct clk_lookup ssp2_lookups[] __initdata = { | ||
160 | { .dev_id = "mxs-mmc.2", }, | ||
161 | { .dev_id = "80014000.ssp", }, | ||
162 | }; | ||
163 | |||
164 | static struct clk_lookup ssp3_lookups[] __initdata = { | ||
165 | { .dev_id = "mxs-mmc.3", }, | ||
166 | { .dev_id = "80016000.ssp", }, | ||
167 | }; | ||
168 | |||
169 | static struct clk_lookup lcdif_lookups[] __initdata = { | ||
170 | { .dev_id = "imx28-fb", }, | ||
171 | { .dev_id = "80030000.lcdif", }, | ||
172 | }; | ||
173 | |||
174 | static struct clk_lookup gpmi_lookups[] __initdata = { | ||
175 | { .dev_id = "imx28-gpmi-nand", }, | ||
176 | { .dev_id = "8000c000.gpmi", }, | ||
177 | }; | ||
178 | |||
179 | static struct clk_lookup fec_lookups[] __initdata = { | ||
180 | { .dev_id = "imx28-fec.0", }, | ||
181 | { .dev_id = "imx28-fec.1", }, | ||
182 | { .dev_id = "800f0000.ethernet", }, | ||
183 | { .dev_id = "800f4000.ethernet", }, | ||
184 | }; | ||
185 | |||
186 | static struct clk_lookup can0_lookups[] __initdata = { | ||
187 | { .dev_id = "flexcan.0", }, | ||
188 | { .dev_id = "80032000.can", }, | ||
189 | }; | ||
190 | |||
191 | static struct clk_lookup can1_lookups[] __initdata = { | ||
192 | { .dev_id = "flexcan.1", }, | ||
193 | { .dev_id = "80034000.can", }, | ||
194 | }; | ||
195 | |||
196 | static struct clk_lookup saif0_lookups[] __initdata = { | ||
197 | { .dev_id = "mxs-saif.0", }, | ||
198 | { .dev_id = "80042000.saif", }, | ||
199 | }; | ||
200 | |||
201 | static struct clk_lookup saif1_lookups[] __initdata = { | ||
202 | { .dev_id = "mxs-saif.1", }, | ||
203 | { .dev_id = "80046000.saif", }, | ||
204 | }; | ||
205 | |||
206 | static const char *sel_cpu[] __initconst = { "ref_cpu", "ref_xtal", }; | ||
207 | static const char *sel_io0[] __initconst = { "ref_io0", "ref_xtal", }; | ||
208 | static const char *sel_io1[] __initconst = { "ref_io1", "ref_xtal", }; | ||
209 | static const char *sel_pix[] __initconst = { "ref_pix", "ref_xtal", }; | ||
210 | static const char *sel_gpmi[] __initconst = { "ref_gpmi", "ref_xtal", }; | ||
211 | static const char *sel_pll0[] __initconst = { "pll0", "ref_xtal", }; | ||
212 | static const char *cpu_sels[] __initconst = { "cpu_pll", "cpu_xtal", }; | ||
213 | static const char *emi_sels[] __initconst = { "emi_pll", "emi_xtal", }; | ||
214 | static const char *ptp_sels[] __initconst = { "ref_xtal", "pll0", }; | ||
215 | |||
216 | enum imx28_clk { | ||
217 | ref_xtal, pll0, pll1, pll2, ref_cpu, ref_emi, ref_io0, ref_io1, | ||
218 | ref_pix, ref_hsadc, ref_gpmi, saif0_sel, saif1_sel, gpmi_sel, | ||
219 | ssp0_sel, ssp1_sel, ssp2_sel, ssp3_sel, emi_sel, etm_sel, | ||
220 | lcdif_sel, cpu, ptp_sel, cpu_pll, cpu_xtal, hbus, xbus, | ||
221 | ssp0_div, ssp1_div, ssp2_div, ssp3_div, gpmi_div, emi_pll, | ||
222 | emi_xtal, lcdif_div, etm_div, ptp, saif0_div, saif1_div, | ||
223 | clk32k_div, rtc, lradc, spdif_div, clk32k, pwm, uart, ssp0, | ||
224 | ssp1, ssp2, ssp3, gpmi, spdif, emi, saif0, saif1, lcdif, etm, | ||
225 | fec, can0, can1, usb0, usb1, usb0_pwr, usb1_pwr, enet_out, | ||
226 | clk_max | ||
227 | }; | ||
228 | |||
229 | static struct clk *clks[clk_max]; | ||
230 | |||
231 | static enum imx28_clk clks_init_on[] __initdata = { | ||
232 | cpu, hbus, xbus, emi, uart, | ||
233 | }; | ||
234 | |||
235 | int __init mx28_clocks_init(void) | ||
236 | { | ||
237 | int i; | ||
238 | |||
239 | clk_misc_init(); | ||
240 | |||
241 | clks[ref_xtal] = mxs_clk_fixed("ref_xtal", 24000000); | ||
242 | clks[pll0] = mxs_clk_pll("pll0", "ref_xtal", PLL0CTRL0, 17, 480000000); | ||
243 | clks[pll1] = mxs_clk_pll("pll1", "ref_xtal", PLL1CTRL0, 17, 480000000); | ||
244 | clks[pll2] = mxs_clk_pll("pll2", "ref_xtal", PLL2CTRL0, 23, 50000000); | ||
245 | clks[ref_cpu] = mxs_clk_ref("ref_cpu", "pll0", FRAC0, 0); | ||
246 | clks[ref_emi] = mxs_clk_ref("ref_emi", "pll0", FRAC0, 1); | ||
247 | clks[ref_io0] = mxs_clk_ref("ref_io0", "pll0", FRAC0, 2); | ||
248 | clks[ref_io1] = mxs_clk_ref("ref_io1", "pll0", FRAC0, 3); | ||
249 | clks[ref_pix] = mxs_clk_ref("ref_pix", "pll0", FRAC1, 0); | ||
250 | clks[ref_hsadc] = mxs_clk_ref("ref_hsadc", "pll0", FRAC1, 1); | ||
251 | clks[ref_gpmi] = mxs_clk_ref("ref_gpmi", "pll0", FRAC1, 2); | ||
252 | clks[saif0_sel] = mxs_clk_mux("saif0_sel", CLKSEQ, 0, 1, sel_pll0, ARRAY_SIZE(sel_pll0)); | ||
253 | clks[saif1_sel] = mxs_clk_mux("saif1_sel", CLKSEQ, 1, 1, sel_pll0, ARRAY_SIZE(sel_pll0)); | ||
254 | clks[gpmi_sel] = mxs_clk_mux("gpmi_sel", CLKSEQ, 2, 1, sel_gpmi, ARRAY_SIZE(sel_gpmi)); | ||
255 | clks[ssp0_sel] = mxs_clk_mux("ssp0_sel", CLKSEQ, 3, 1, sel_io0, ARRAY_SIZE(sel_io0)); | ||
256 | clks[ssp1_sel] = mxs_clk_mux("ssp1_sel", CLKSEQ, 4, 1, sel_io0, ARRAY_SIZE(sel_io0)); | ||
257 | clks[ssp2_sel] = mxs_clk_mux("ssp2_sel", CLKSEQ, 5, 1, sel_io1, ARRAY_SIZE(sel_io1)); | ||
258 | clks[ssp3_sel] = mxs_clk_mux("ssp3_sel", CLKSEQ, 6, 1, sel_io1, ARRAY_SIZE(sel_io1)); | ||
259 | clks[emi_sel] = mxs_clk_mux("emi_sel", CLKSEQ, 7, 1, emi_sels, ARRAY_SIZE(emi_sels)); | ||
260 | clks[etm_sel] = mxs_clk_mux("etm_sel", CLKSEQ, 8, 1, sel_cpu, ARRAY_SIZE(sel_cpu)); | ||
261 | clks[lcdif_sel] = mxs_clk_mux("lcdif_sel", CLKSEQ, 14, 1, sel_pix, ARRAY_SIZE(sel_pix)); | ||
262 | clks[cpu] = mxs_clk_mux("cpu", CLKSEQ, 18, 1, cpu_sels, ARRAY_SIZE(cpu_sels)); | ||
263 | clks[ptp_sel] = mxs_clk_mux("ptp_sel", ENET, 19, 1, ptp_sels, ARRAY_SIZE(ptp_sels)); | ||
264 | clks[cpu_pll] = mxs_clk_div("cpu_pll", "ref_cpu", CPU, 0, 6, 28); | ||
265 | clks[cpu_xtal] = mxs_clk_div("cpu_xtal", "ref_xtal", CPU, 16, 10, 29); | ||
266 | clks[hbus] = mxs_clk_div("hbus", "cpu", HBUS, 0, 5, 31); | ||
267 | clks[xbus] = mxs_clk_div("xbus", "ref_xtal", XBUS, 0, 10, 31); | ||
268 | clks[ssp0_div] = mxs_clk_div("ssp0_div", "ssp0_sel", SSP0, 0, 9, 29); | ||
269 | clks[ssp1_div] = mxs_clk_div("ssp1_div", "ssp1_sel", SSP1, 0, 9, 29); | ||
270 | clks[ssp2_div] = mxs_clk_div("ssp2_div", "ssp2_sel", SSP2, 0, 9, 29); | ||
271 | clks[ssp3_div] = mxs_clk_div("ssp3_div", "ssp3_sel", SSP3, 0, 9, 29); | ||
272 | clks[gpmi_div] = mxs_clk_div("gpmi_div", "gpmi_sel", GPMI, 0, 10, 29); | ||
273 | clks[emi_pll] = mxs_clk_div("emi_pll", "ref_emi", EMI, 0, 6, 28); | ||
274 | clks[emi_xtal] = mxs_clk_div("emi_xtal", "ref_xtal", EMI, 8, 4, 29); | ||
275 | clks[lcdif_div] = mxs_clk_div("lcdif_div", "lcdif_sel", LCDIF, 0, 13, 29); | ||
276 | clks[etm_div] = mxs_clk_div("etm_div", "etm_sel", ETM, 0, 7, 29); | ||
277 | clks[ptp] = mxs_clk_div("ptp", "ptp_sel", ENET, 21, 6, 27); | ||
278 | clks[saif0_div] = mxs_clk_frac("saif0_div", "saif0_sel", SAIF0, 0, 16, 29); | ||
279 | clks[saif1_div] = mxs_clk_frac("saif1_div", "saif1_sel", SAIF1, 0, 16, 29); | ||
280 | clks[clk32k_div] = mxs_clk_fixed_factor("clk32k_div", "ref_xtal", 1, 750); | ||
281 | clks[rtc] = mxs_clk_fixed_factor("rtc", "ref_xtal", 1, 768); | ||
282 | clks[lradc] = mxs_clk_fixed_factor("lradc", "clk32k", 1, 16); | ||
283 | clks[spdif_div] = mxs_clk_fixed_factor("spdif_div", "pll0", 1, 4); | ||
284 | clks[clk32k] = mxs_clk_gate("clk32k", "clk32k_div", XTAL, 26); | ||
285 | clks[pwm] = mxs_clk_gate("pwm", "ref_xtal", XTAL, 29); | ||
286 | clks[uart] = mxs_clk_gate("uart", "ref_xtal", XTAL, 31); | ||
287 | clks[ssp0] = mxs_clk_gate("ssp0", "ssp0_div", SSP0, 31); | ||
288 | clks[ssp1] = mxs_clk_gate("ssp1", "ssp1_div", SSP1, 31); | ||
289 | clks[ssp2] = mxs_clk_gate("ssp2", "ssp2_div", SSP2, 31); | ||
290 | clks[ssp3] = mxs_clk_gate("ssp3", "ssp3_div", SSP3, 31); | ||
291 | clks[gpmi] = mxs_clk_gate("gpmi", "gpmi_div", GPMI, 31); | ||
292 | clks[spdif] = mxs_clk_gate("spdif", "spdif_div", SPDIF, 31); | ||
293 | clks[emi] = mxs_clk_gate("emi", "emi_sel", EMI, 31); | ||
294 | clks[saif0] = mxs_clk_gate("saif0", "saif0_div", SAIF0, 31); | ||
295 | clks[saif1] = mxs_clk_gate("saif1", "saif1_div", SAIF1, 31); | ||
296 | clks[lcdif] = mxs_clk_gate("lcdif", "lcdif_div", LCDIF, 31); | ||
297 | clks[etm] = mxs_clk_gate("etm", "etm_div", ETM, 31); | ||
298 | clks[fec] = mxs_clk_gate("fec", "hbus", ENET, 30); | ||
299 | clks[can0] = mxs_clk_gate("can0", "ref_xtal", FLEXCAN, 30); | ||
300 | clks[can1] = mxs_clk_gate("can1", "ref_xtal", FLEXCAN, 28); | ||
301 | clks[usb0] = mxs_clk_gate("usb0", "usb0_pwr", DIGCTRL, 2); | ||
302 | clks[usb1] = mxs_clk_gate("usb1", "usb1_pwr", DIGCTRL, 16); | ||
303 | clks[usb0_pwr] = clk_register_gate(NULL, "usb0_pwr", "pll0", 0, PLL0CTRL0, 18, 0, &mxs_lock); | ||
304 | clks[usb1_pwr] = clk_register_gate(NULL, "usb1_pwr", "pll1", 0, PLL1CTRL0, 18, 0, &mxs_lock); | ||
305 | clks[enet_out] = clk_register_gate(NULL, "enet_out", "pll2", 0, ENET, 18, 0, &mxs_lock); | ||
306 | |||
307 | for (i = 0; i < ARRAY_SIZE(clks); i++) | ||
308 | if (IS_ERR(clks[i])) { | ||
309 | pr_err("i.MX28 clk %d: register failed with %ld\n", | ||
310 | i, PTR_ERR(clks[i])); | ||
311 | return PTR_ERR(clks[i]); | ||
312 | } | ||
313 | |||
314 | clk_register_clkdev(clks[clk32k], NULL, "timrot"); | ||
315 | clk_register_clkdev(clks[enet_out], NULL, "enet_out"); | ||
316 | clk_register_clkdevs(clks[hbus], hbus_lookups, ARRAY_SIZE(hbus_lookups)); | ||
317 | clk_register_clkdevs(clks[xbus], xbus_lookups, ARRAY_SIZE(xbus_lookups)); | ||
318 | clk_register_clkdevs(clks[uart], uart_lookups, ARRAY_SIZE(uart_lookups)); | ||
319 | clk_register_clkdevs(clks[ssp0], ssp0_lookups, ARRAY_SIZE(ssp0_lookups)); | ||
320 | clk_register_clkdevs(clks[ssp1], ssp1_lookups, ARRAY_SIZE(ssp1_lookups)); | ||
321 | clk_register_clkdevs(clks[ssp2], ssp2_lookups, ARRAY_SIZE(ssp2_lookups)); | ||
322 | clk_register_clkdevs(clks[ssp3], ssp3_lookups, ARRAY_SIZE(ssp3_lookups)); | ||
323 | clk_register_clkdevs(clks[gpmi], gpmi_lookups, ARRAY_SIZE(gpmi_lookups)); | ||
324 | clk_register_clkdevs(clks[saif0], saif0_lookups, ARRAY_SIZE(saif0_lookups)); | ||
325 | clk_register_clkdevs(clks[saif1], saif1_lookups, ARRAY_SIZE(saif1_lookups)); | ||
326 | clk_register_clkdevs(clks[lcdif], lcdif_lookups, ARRAY_SIZE(lcdif_lookups)); | ||
327 | clk_register_clkdevs(clks[fec], fec_lookups, ARRAY_SIZE(fec_lookups)); | ||
328 | clk_register_clkdevs(clks[can0], can0_lookups, ARRAY_SIZE(can0_lookups)); | ||
329 | clk_register_clkdevs(clks[can1], can1_lookups, ARRAY_SIZE(can1_lookups)); | ||
330 | |||
331 | for (i = 0; i < ARRAY_SIZE(clks_init_on); i++) | ||
332 | clk_prepare_enable(clks[clks_init_on[i]]); | ||
333 | |||
334 | mxs_timer_init(MX28_INT_TIMER0); | ||
335 | |||
336 | return 0; | ||
337 | } | ||
diff --git a/drivers/clk/mxs/clk-pll.c b/drivers/clk/mxs/clk-pll.c new file mode 100644 index 000000000000..fadae41833ec --- /dev/null +++ b/drivers/clk/mxs/clk-pll.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/clk-provider.h> | ||
14 | #include <linux/delay.h> | ||
15 | #include <linux/err.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include "clk.h" | ||
19 | |||
20 | /** | ||
21 | * struct clk_pll - mxs pll clock | ||
22 | * @hw: clk_hw for the pll | ||
23 | * @base: base address of the pll | ||
24 | * @power: the shift of power bit | ||
25 | * @rate: the clock rate of the pll | ||
26 | * | ||
27 | * The mxs pll is a fixed rate clock with power and gate control, | ||
28 | * and the shift of gate bit is always 31. | ||
29 | */ | ||
30 | struct clk_pll { | ||
31 | struct clk_hw hw; | ||
32 | void __iomem *base; | ||
33 | u8 power; | ||
34 | unsigned long rate; | ||
35 | }; | ||
36 | |||
37 | #define to_clk_pll(_hw) container_of(_hw, struct clk_pll, hw) | ||
38 | |||
39 | static int clk_pll_prepare(struct clk_hw *hw) | ||
40 | { | ||
41 | struct clk_pll *pll = to_clk_pll(hw); | ||
42 | |||
43 | writel_relaxed(1 << pll->power, pll->base + SET); | ||
44 | |||
45 | udelay(10); | ||
46 | |||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | static void clk_pll_unprepare(struct clk_hw *hw) | ||
51 | { | ||
52 | struct clk_pll *pll = to_clk_pll(hw); | ||
53 | |||
54 | writel_relaxed(1 << pll->power, pll->base + CLR); | ||
55 | } | ||
56 | |||
57 | static int clk_pll_enable(struct clk_hw *hw) | ||
58 | { | ||
59 | struct clk_pll *pll = to_clk_pll(hw); | ||
60 | |||
61 | writel_relaxed(1 << 31, pll->base + CLR); | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | static void clk_pll_disable(struct clk_hw *hw) | ||
67 | { | ||
68 | struct clk_pll *pll = to_clk_pll(hw); | ||
69 | |||
70 | writel_relaxed(1 << 31, pll->base + SET); | ||
71 | } | ||
72 | |||
73 | static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, | ||
74 | unsigned long parent_rate) | ||
75 | { | ||
76 | struct clk_pll *pll = to_clk_pll(hw); | ||
77 | |||
78 | return pll->rate; | ||
79 | } | ||
80 | |||
81 | static const struct clk_ops clk_pll_ops = { | ||
82 | .prepare = clk_pll_prepare, | ||
83 | .unprepare = clk_pll_unprepare, | ||
84 | .enable = clk_pll_enable, | ||
85 | .disable = clk_pll_disable, | ||
86 | .recalc_rate = clk_pll_recalc_rate, | ||
87 | }; | ||
88 | |||
89 | struct clk *mxs_clk_pll(const char *name, const char *parent_name, | ||
90 | void __iomem *base, u8 power, unsigned long rate) | ||
91 | { | ||
92 | struct clk_pll *pll; | ||
93 | struct clk *clk; | ||
94 | struct clk_init_data init; | ||
95 | |||
96 | pll = kzalloc(sizeof(*pll), GFP_KERNEL); | ||
97 | if (!pll) | ||
98 | return ERR_PTR(-ENOMEM); | ||
99 | |||
100 | init.name = name; | ||
101 | init.ops = &clk_pll_ops; | ||
102 | init.flags = 0; | ||
103 | init.parent_names = (parent_name ? &parent_name: NULL); | ||
104 | init.num_parents = (parent_name ? 1 : 0); | ||
105 | |||
106 | pll->base = base; | ||
107 | pll->rate = rate; | ||
108 | pll->power = power; | ||
109 | pll->hw.init = &init; | ||
110 | |||
111 | clk = clk_register(NULL, &pll->hw); | ||
112 | if (IS_ERR(clk)) | ||
113 | kfree(pll); | ||
114 | |||
115 | return clk; | ||
116 | } | ||
diff --git a/drivers/clk/mxs/clk-ref.c b/drivers/clk/mxs/clk-ref.c new file mode 100644 index 000000000000..4adeed6c2f94 --- /dev/null +++ b/drivers/clk/mxs/clk-ref.c | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/clk.h> | ||
13 | #include <linux/clk-provider.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/slab.h> | ||
17 | #include "clk.h" | ||
18 | |||
19 | /** | ||
20 | * struct clk_ref - mxs reference clock | ||
21 | * @hw: clk_hw for the reference clock | ||
22 | * @reg: register address | ||
23 | * @idx: the index of the reference clock within the same register | ||
24 | * | ||
25 | * The mxs reference clock sources from pll. Every 4 reference clocks share | ||
26 | * one register space, and @idx is used to identify them. Each reference | ||
27 | * clock has a gate control and a fractional * divider. The rate is calculated | ||
28 | * as pll rate * (18 / FRAC), where FRAC = 18 ~ 35. | ||
29 | */ | ||
30 | struct clk_ref { | ||
31 | struct clk_hw hw; | ||
32 | void __iomem *reg; | ||
33 | u8 idx; | ||
34 | }; | ||
35 | |||
36 | #define to_clk_ref(_hw) container_of(_hw, struct clk_ref, hw) | ||
37 | |||
38 | static int clk_ref_enable(struct clk_hw *hw) | ||
39 | { | ||
40 | struct clk_ref *ref = to_clk_ref(hw); | ||
41 | |||
42 | writel_relaxed(1 << ((ref->idx + 1) * 8 - 1), ref->reg + CLR); | ||
43 | |||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | static void clk_ref_disable(struct clk_hw *hw) | ||
48 | { | ||
49 | struct clk_ref *ref = to_clk_ref(hw); | ||
50 | |||
51 | writel_relaxed(1 << ((ref->idx + 1) * 8 - 1), ref->reg + SET); | ||
52 | } | ||
53 | |||
54 | static unsigned long clk_ref_recalc_rate(struct clk_hw *hw, | ||
55 | unsigned long parent_rate) | ||
56 | { | ||
57 | struct clk_ref *ref = to_clk_ref(hw); | ||
58 | u64 tmp = parent_rate; | ||
59 | u8 frac = (readl_relaxed(ref->reg) >> (ref->idx * 8)) & 0x3f; | ||
60 | |||
61 | tmp *= 18; | ||
62 | do_div(tmp, frac); | ||
63 | |||
64 | return tmp; | ||
65 | } | ||
66 | |||
67 | static long clk_ref_round_rate(struct clk_hw *hw, unsigned long rate, | ||
68 | unsigned long *prate) | ||
69 | { | ||
70 | unsigned long parent_rate = *prate; | ||
71 | u64 tmp = parent_rate; | ||
72 | u8 frac; | ||
73 | |||
74 | tmp = tmp * 18 + rate / 2; | ||
75 | do_div(tmp, rate); | ||
76 | frac = tmp; | ||
77 | |||
78 | if (frac < 18) | ||
79 | frac = 18; | ||
80 | else if (frac > 35) | ||
81 | frac = 35; | ||
82 | |||
83 | tmp = parent_rate; | ||
84 | tmp *= 18; | ||
85 | do_div(tmp, frac); | ||
86 | |||
87 | return tmp; | ||
88 | } | ||
89 | |||
90 | static int clk_ref_set_rate(struct clk_hw *hw, unsigned long rate, | ||
91 | unsigned long parent_rate) | ||
92 | { | ||
93 | struct clk_ref *ref = to_clk_ref(hw); | ||
94 | unsigned long flags; | ||
95 | u64 tmp = parent_rate; | ||
96 | u32 val; | ||
97 | u8 frac, shift = ref->idx * 8; | ||
98 | |||
99 | tmp = tmp * 18 + rate / 2; | ||
100 | do_div(tmp, rate); | ||
101 | frac = tmp; | ||
102 | |||
103 | if (frac < 18) | ||
104 | frac = 18; | ||
105 | else if (frac > 35) | ||
106 | frac = 35; | ||
107 | |||
108 | spin_lock_irqsave(&mxs_lock, flags); | ||
109 | |||
110 | val = readl_relaxed(ref->reg); | ||
111 | val &= ~(0x3f << shift); | ||
112 | val |= frac << shift; | ||
113 | writel_relaxed(val, ref->reg); | ||
114 | |||
115 | spin_unlock_irqrestore(&mxs_lock, flags); | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | static const struct clk_ops clk_ref_ops = { | ||
121 | .enable = clk_ref_enable, | ||
122 | .disable = clk_ref_disable, | ||
123 | .recalc_rate = clk_ref_recalc_rate, | ||
124 | .round_rate = clk_ref_round_rate, | ||
125 | .set_rate = clk_ref_set_rate, | ||
126 | }; | ||
127 | |||
128 | struct clk *mxs_clk_ref(const char *name, const char *parent_name, | ||
129 | void __iomem *reg, u8 idx) | ||
130 | { | ||
131 | struct clk_ref *ref; | ||
132 | struct clk *clk; | ||
133 | struct clk_init_data init; | ||
134 | |||
135 | ref = kzalloc(sizeof(*ref), GFP_KERNEL); | ||
136 | if (!ref) | ||
137 | return ERR_PTR(-ENOMEM); | ||
138 | |||
139 | init.name = name; | ||
140 | init.ops = &clk_ref_ops; | ||
141 | init.flags = 0; | ||
142 | init.parent_names = (parent_name ? &parent_name: NULL); | ||
143 | init.num_parents = (parent_name ? 1 : 0); | ||
144 | |||
145 | ref->reg = reg; | ||
146 | ref->idx = idx; | ||
147 | ref->hw.init = &init; | ||
148 | |||
149 | clk = clk_register(NULL, &ref->hw); | ||
150 | if (IS_ERR(clk)) | ||
151 | kfree(ref); | ||
152 | |||
153 | return clk; | ||
154 | } | ||
diff --git a/drivers/clk/mxs/clk.c b/drivers/clk/mxs/clk.c new file mode 100644 index 000000000000..b24d56067c80 --- /dev/null +++ b/drivers/clk/mxs/clk.c | |||
@@ -0,0 +1,28 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #include <linux/err.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <linux/jiffies.h> | ||
15 | #include <linux/spinlock.h> | ||
16 | |||
17 | DEFINE_SPINLOCK(mxs_lock); | ||
18 | |||
19 | int mxs_clk_wait(void __iomem *reg, u8 shift) | ||
20 | { | ||
21 | unsigned long timeout = jiffies + msecs_to_jiffies(10); | ||
22 | |||
23 | while (readl_relaxed(reg) & (1 << shift)) | ||
24 | if (time_after(jiffies, timeout)) | ||
25 | return -ETIMEDOUT; | ||
26 | |||
27 | return 0; | ||
28 | } | ||
diff --git a/drivers/clk/mxs/clk.h b/drivers/clk/mxs/clk.h new file mode 100644 index 000000000000..81421e28e69c --- /dev/null +++ b/drivers/clk/mxs/clk.h | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * The code contained herein is licensed under the GNU General Public | ||
5 | * License. You may obtain a copy of the GNU General Public License | ||
6 | * Version 2 or later at the following locations: | ||
7 | * | ||
8 | * http://www.opensource.org/licenses/gpl-license.html | ||
9 | * http://www.gnu.org/copyleft/gpl.html | ||
10 | */ | ||
11 | |||
12 | #ifndef __MXS_CLK_H | ||
13 | #define __MXS_CLK_H | ||
14 | |||
15 | #include <linux/clk.h> | ||
16 | #include <linux/clk-provider.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | |||
19 | #define SET 0x4 | ||
20 | #define CLR 0x8 | ||
21 | |||
22 | extern spinlock_t mxs_lock; | ||
23 | |||
24 | int mxs_clk_wait(void __iomem *reg, u8 shift); | ||
25 | |||
26 | struct clk *mxs_clk_pll(const char *name, const char *parent_name, | ||
27 | void __iomem *base, u8 power, unsigned long rate); | ||
28 | |||
29 | struct clk *mxs_clk_ref(const char *name, const char *parent_name, | ||
30 | void __iomem *reg, u8 idx); | ||
31 | |||
32 | struct clk *mxs_clk_div(const char *name, const char *parent_name, | ||
33 | void __iomem *reg, u8 shift, u8 width, u8 busy); | ||
34 | |||
35 | struct clk *mxs_clk_frac(const char *name, const char *parent_name, | ||
36 | void __iomem *reg, u8 shift, u8 width, u8 busy); | ||
37 | |||
38 | static inline struct clk *mxs_clk_fixed(const char *name, int rate) | ||
39 | { | ||
40 | return clk_register_fixed_rate(NULL, name, NULL, CLK_IS_ROOT, rate); | ||
41 | } | ||
42 | |||
43 | static inline struct clk *mxs_clk_gate(const char *name, | ||
44 | const char *parent_name, void __iomem *reg, u8 shift) | ||
45 | { | ||
46 | return clk_register_gate(NULL, name, parent_name, CLK_SET_RATE_PARENT, | ||
47 | reg, shift, CLK_GATE_SET_TO_DISABLE, | ||
48 | &mxs_lock); | ||
49 | } | ||
50 | |||
51 | static inline struct clk *mxs_clk_mux(const char *name, void __iomem *reg, | ||
52 | u8 shift, u8 width, const char **parent_names, int num_parents) | ||
53 | { | ||
54 | return clk_register_mux(NULL, name, parent_names, num_parents, | ||
55 | CLK_SET_RATE_PARENT, reg, shift, width, | ||
56 | 0, &mxs_lock); | ||
57 | } | ||
58 | |||
59 | static inline struct clk *mxs_clk_fixed_factor(const char *name, | ||
60 | const char *parent_name, unsigned int mult, unsigned int div) | ||
61 | { | ||
62 | return clk_register_fixed_factor(NULL, name, parent_name, | ||
63 | CLK_SET_RATE_PARENT, mult, div); | ||
64 | } | ||
65 | |||
66 | #endif /* __MXS_CLK_H */ | ||
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/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 392ce71ed6a1..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) { |
@@ -710,7 +702,6 @@ int exynos_drm_gem_dumb_destroy(struct drm_file *file_priv, | |||
710 | 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) |
711 | { | 703 | { |
712 | struct drm_gem_object *obj = vma->vm_private_data; | 704 | struct drm_gem_object *obj = vma->vm_private_data; |
713 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); | ||
714 | struct drm_device *dev = obj->dev; | 705 | struct drm_device *dev = obj->dev; |
715 | unsigned long f_vaddr; | 706 | unsigned long f_vaddr; |
716 | pgoff_t page_offset; | 707 | pgoff_t page_offset; |
@@ -722,21 +713,10 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
722 | 713 | ||
723 | mutex_lock(&dev->struct_mutex); | 714 | mutex_lock(&dev->struct_mutex); |
724 | 715 | ||
725 | /* | ||
726 | * allocate all pages as desired size if user wants to allocate | ||
727 | * physically non-continuous memory. | ||
728 | */ | ||
729 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { | ||
730 | ret = exynos_drm_gem_get_pages(obj); | ||
731 | if (ret < 0) | ||
732 | goto err; | ||
733 | } | ||
734 | |||
735 | 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); |
736 | if (ret < 0) | 717 | if (ret < 0) |
737 | DRM_ERROR("failed to map pages.\n"); | 718 | DRM_ERROR("failed to map pages.\n"); |
738 | 719 | ||
739 | err: | ||
740 | mutex_unlock(&dev->struct_mutex); | 720 | mutex_unlock(&dev->struct_mutex); |
741 | 721 | ||
742 | return convert_to_vm_err_msg(ret); | 722 | return convert_to_vm_err_msg(ret); |
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_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 5908cd563400..1b1cf3b3ff51 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -7072,9 +7072,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7072 | struct drm_device *dev = crtc->dev; | 7072 | struct drm_device *dev = crtc->dev; |
7073 | drm_i915_private_t *dev_priv = dev->dev_private; | 7073 | drm_i915_private_t *dev_priv = dev->dev_private; |
7074 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 7074 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
7075 | int pipe = intel_crtc->pipe; | ||
7076 | int dpll_reg = DPLL(pipe); | ||
7077 | int dpll = I915_READ(dpll_reg); | ||
7078 | 7075 | ||
7079 | if (HAS_PCH_SPLIT(dev)) | 7076 | if (HAS_PCH_SPLIT(dev)) |
7080 | return; | 7077 | return; |
@@ -7087,10 +7084,15 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7087 | * the manual case. | 7084 | * the manual case. |
7088 | */ | 7085 | */ |
7089 | 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 | |||
7090 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); | 7091 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); |
7091 | 7092 | ||
7092 | assert_panel_unlocked(dev_priv, pipe); | 7093 | assert_panel_unlocked(dev_priv, pipe); |
7093 | 7094 | ||
7095 | dpll = I915_READ(dpll_reg); | ||
7094 | dpll |= DISPLAY_RATE_SELECT_FPA1; | 7096 | dpll |= DISPLAY_RATE_SELECT_FPA1; |
7095 | I915_WRITE(dpll_reg, dpll); | 7097 | I915_WRITE(dpll_reg, dpll); |
7096 | intel_wait_for_vblank(dev, pipe); | 7098 | intel_wait_for_vblank(dev, pipe); |
@@ -7098,7 +7100,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7098 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) | 7100 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) |
7099 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); | 7101 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); |
7100 | } | 7102 | } |
7101 | |||
7102 | } | 7103 | } |
7103 | 7104 | ||
7104 | /** | 7105 | /** |
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 30e2c82101de..9c71183629c2 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -750,7 +750,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
750 | .ident = "Hewlett-Packard t5745", | 750 | .ident = "Hewlett-Packard t5745", |
751 | .matches = { | 751 | .matches = { |
752 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 752 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
753 | DMI_MATCH(DMI_BOARD_NAME, "hp t5745"), | 753 | DMI_MATCH(DMI_PRODUCT_NAME, "hp t5745"), |
754 | }, | 754 | }, |
755 | }, | 755 | }, |
756 | { | 756 | { |
@@ -758,7 +758,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
758 | .ident = "Hewlett-Packard st5747", | 758 | .ident = "Hewlett-Packard st5747", |
759 | .matches = { | 759 | .matches = { |
760 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 760 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
761 | DMI_MATCH(DMI_BOARD_NAME, "hp st5747"), | 761 | DMI_MATCH(DMI_PRODUCT_NAME, "hp st5747"), |
762 | }, | 762 | }, |
763 | }, | 763 | }, |
764 | { | 764 | { |
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/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/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/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/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/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 37a8fc92b44a..e8e18cab1fb8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -128,17 +128,20 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
128 | * counter saturations resulting in bogus power readings. | 128 | * counter saturations resulting in bogus power readings. |
129 | * We correct this value ourselves to cope with older BIOSes. | 129 | * We correct this value ourselves to cope with older BIOSes. |
130 | */ | 130 | */ |
131 | static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | ||
132 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | ||
133 | { 0 } | ||
134 | }; | ||
135 | |||
131 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | 136 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) |
132 | { | 137 | { |
133 | u32 val; | 138 | u32 val; |
134 | const struct pci_device_id affected_device = { | ||
135 | PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }; | ||
136 | 139 | ||
137 | /* | 140 | /* |
138 | * let this quirk apply only to the current version of the | 141 | * let this quirk apply only to the current version of the |
139 | * northbridge, since future versions may change the behavior | 142 | * northbridge, since future versions may change the behavior |
140 | */ | 143 | */ |
141 | if (!pci_match_id(&affected_device, pdev)) | 144 | if (!pci_match_id(affected_device, pdev)) |
142 | return; | 145 | return; |
143 | 146 | ||
144 | pci_bus_read_config_dword(pdev->bus, | 147 | pci_bus_read_config_dword(pdev->bus, |
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/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/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/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index c8aae6640e64..7e96bb229724 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <plat/cpu.h> | ||
28 | #include <plat/usb.h> | 29 | #include <plat/usb.h> |
29 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
30 | 31 | ||
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/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/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 0f150f271c2a..1929c0c63b75 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -200,7 +200,7 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) | |||
200 | return PCI_D1; | 200 | return PCI_D1; |
201 | case ACPI_STATE_D2: | 201 | case ACPI_STATE_D2: |
202 | return PCI_D2; | 202 | return PCI_D2; |
203 | case ACPI_STATE_D3: | 203 | case ACPI_STATE_D3_HOT: |
204 | return PCI_D3hot; | 204 | return PCI_D3hot; |
205 | case ACPI_STATE_D3_COLD: | 205 | case ACPI_STATE_D3_COLD: |
206 | return PCI_D3cold; | 206 | return PCI_D3cold; |
@@ -223,7 +223,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
223 | [PCI_D0] = ACPI_STATE_D0, | 223 | [PCI_D0] = ACPI_STATE_D0, |
224 | [PCI_D1] = ACPI_STATE_D1, | 224 | [PCI_D1] = ACPI_STATE_D1, |
225 | [PCI_D2] = ACPI_STATE_D2, | 225 | [PCI_D2] = ACPI_STATE_D2, |
226 | [PCI_D3hot] = ACPI_STATE_D3, | 226 | [PCI_D3hot] = ACPI_STATE_D3_HOT, |
227 | [PCI_D3cold] = ACPI_STATE_D3 | 227 | [PCI_D3cold] = ACPI_STATE_D3 |
228 | }; | 228 | }; |
229 | int error = -EINVAL; | 229 | int error = -EINVAL; |
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/platform/x86/intel_mid_powerbtn.c b/drivers/platform/x86/intel_mid_powerbtn.c index 0a3594c7e912..bcbad8452a6f 100644 --- a/drivers/platform/x86/intel_mid_powerbtn.c +++ b/drivers/platform/x86/intel_mid_powerbtn.c | |||
@@ -78,7 +78,7 @@ static int __devinit mfld_pb_probe(struct platform_device *pdev) | |||
78 | 78 | ||
79 | input_set_capability(input, EV_KEY, KEY_POWER); | 79 | input_set_capability(input, EV_KEY, KEY_POWER); |
80 | 80 | ||
81 | error = request_threaded_irq(irq, NULL, mfld_pb_isr, 0, | 81 | error = request_threaded_irq(irq, NULL, mfld_pb_isr, IRQF_NO_SUSPEND, |
82 | DRIVER_NAME, input); | 82 | DRIVER_NAME, input); |
83 | if (error) { | 83 | if (error) { |
84 | dev_err(&pdev->dev, "Unable to request irq %d for mfld power" | 84 | dev_err(&pdev->dev, "Unable to request irq %d for mfld power" |
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/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index 42f5f829b3ee..029e421baaed 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
@@ -360,12 +360,11 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op) | |||
360 | &mpc5200_rtc_ops, THIS_MODULE); | 360 | &mpc5200_rtc_ops, THIS_MODULE); |
361 | } | 361 | } |
362 | 362 | ||
363 | rtc->rtc->uie_unsupported = 1; | ||
364 | |||
365 | if (IS_ERR(rtc->rtc)) { | 363 | if (IS_ERR(rtc->rtc)) { |
366 | err = PTR_ERR(rtc->rtc); | 364 | err = PTR_ERR(rtc->rtc); |
367 | goto out_free_irq; | 365 | goto out_free_irq; |
368 | } | 366 | } |
367 | rtc->rtc->uie_unsupported = 1; | ||
369 | 368 | ||
370 | return 0; | 369 | return 0; |
371 | 370 | ||
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/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/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_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/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/udc-core.c b/drivers/usb/gadget/udc-core.c index 2fa9865babed..e5e44f8cde9a 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -263,8 +263,8 @@ 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 | udc->driver->unbind(udc->gadget); | ||
267 | usb_gadget_disconnect(udc->gadget); | 266 | usb_gadget_disconnect(udc->gadget); |
267 | udc->driver->unbind(udc->gadget); | ||
268 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 268 | usb_gadget_udc_stop(udc->gadget, udc->driver); |
269 | } else { | 269 | } else { |
270 | usb_gadget_stop(udc->gadget, udc->driver); | 270 | usb_gadget_stop(udc->gadget, udc->driver); |
@@ -415,9 +415,9 @@ static ssize_t usb_udc_softconn_store(struct device *dev, | |||
415 | usb_gadget_udc_start(udc->gadget, udc->driver); | 415 | usb_gadget_udc_start(udc->gadget, udc->driver); |
416 | usb_gadget_connect(udc->gadget); | 416 | usb_gadget_connect(udc->gadget); |
417 | } else if (sysfs_streq(buf, "disconnect")) { | 417 | } else if (sysfs_streq(buf, "disconnect")) { |
418 | usb_gadget_disconnect(udc->gadget); | ||
418 | if (udc_is_newstyle(udc)) | 419 | if (udc_is_newstyle(udc)) |
419 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 420 | usb_gadget_udc_stop(udc->gadget, udc->driver); |
420 | usb_gadget_disconnect(udc->gadget); | ||
421 | } else { | 421 | } else { |
422 | dev_err(dev, "unsupported command '%s'\n", buf); | 422 | dev_err(dev, "unsupported command '%s'\n", buf); |
423 | 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_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-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 86183366647f..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); |
@@ -746,6 +776,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
746 | goto fail; | 776 | goto fail; |
747 | } | 777 | } |
748 | 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); | ||
749 | return err; | 787 | return err; |
750 | 788 | ||
751 | fail: | 789 | fail: |
@@ -772,33 +810,6 @@ fail_hcd: | |||
772 | return err; | 810 | return err; |
773 | } | 811 | } |
774 | 812 | ||
775 | #ifdef CONFIG_PM | ||
776 | static int tegra_ehci_resume(struct platform_device *pdev) | ||
777 | { | ||
778 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
779 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
780 | |||
781 | if (tegra->bus_suspended) | ||
782 | return 0; | ||
783 | |||
784 | return tegra_usb_resume(hcd); | ||
785 | } | ||
786 | |||
787 | static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state) | ||
788 | { | ||
789 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
790 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
791 | |||
792 | if (tegra->bus_suspended) | ||
793 | return 0; | ||
794 | |||
795 | if (time_before(jiffies, tegra->ehci->next_statechange)) | ||
796 | msleep(10); | ||
797 | |||
798 | return tegra_usb_suspend(hcd); | ||
799 | } | ||
800 | #endif | ||
801 | |||
802 | static int tegra_ehci_remove(struct platform_device *pdev) | 813 | static int tegra_ehci_remove(struct platform_device *pdev) |
803 | { | 814 | { |
804 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | 815 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); |
@@ -807,6 +818,10 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
807 | if (tegra == NULL || hcd == NULL) | 818 | if (tegra == NULL || hcd == NULL) |
808 | return -EINVAL; | 819 | return -EINVAL; |
809 | 820 | ||
821 | pm_runtime_get_sync(&pdev->dev); | ||
822 | pm_runtime_disable(&pdev->dev); | ||
823 | pm_runtime_put_noidle(&pdev->dev); | ||
824 | |||
810 | #ifdef CONFIG_USB_OTG_UTILS | 825 | #ifdef CONFIG_USB_OTG_UTILS |
811 | if (tegra->transceiver) { | 826 | if (tegra->transceiver) { |
812 | otg_set_host(tegra->transceiver->otg, NULL); | 827 | otg_set_host(tegra->transceiver->otg, NULL); |
@@ -847,13 +862,12 @@ static struct of_device_id tegra_ehci_of_match[] __devinitdata = { | |||
847 | static struct platform_driver tegra_ehci_driver = { | 862 | static struct platform_driver tegra_ehci_driver = { |
848 | .probe = tegra_ehci_probe, | 863 | .probe = tegra_ehci_probe, |
849 | .remove = tegra_ehci_remove, | 864 | .remove = tegra_ehci_remove, |
850 | #ifdef CONFIG_PM | ||
851 | .suspend = tegra_ehci_suspend, | ||
852 | .resume = tegra_ehci_resume, | ||
853 | #endif | ||
854 | .shutdown = tegra_ehci_hcd_shutdown, | 865 | .shutdown = tegra_ehci_hcd_shutdown, |
855 | .driver = { | 866 | .driver = { |
856 | .name = "tegra-ehci", | 867 | .name = "tegra-ehci", |
857 | .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 | ||
858 | } | 872 | } |
859 | }; | 873 | }; |
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.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/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/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/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 | ||