diff options
Diffstat (limited to 'drivers')
151 files changed, 1862 insertions, 1150 deletions
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/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/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_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_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_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/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/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index fcf73518f63c..f755a665dab3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -9485,13 +9485,34 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) | |||
9485 | return bnx2x_prev_mcp_done(bp); | 9485 | return bnx2x_prev_mcp_done(bp); |
9486 | } | 9486 | } |
9487 | 9487 | ||
9488 | /* previous driver DMAE transaction may have occurred when pre-boot stage ended | ||
9489 | * and boot began, or when kdump kernel was loaded. Either case would invalidate | ||
9490 | * the addresses of the transaction, resulting in was-error bit set in the pci | ||
9491 | * causing all hw-to-host pcie transactions to timeout. If this happened we want | ||
9492 | * to clear the interrupt which detected this from the pglueb and the was done | ||
9493 | * bit | ||
9494 | */ | ||
9495 | static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp) | ||
9496 | { | ||
9497 | u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS); | ||
9498 | if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) { | ||
9499 | BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing"); | ||
9500 | REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, 1 << BP_FUNC(bp)); | ||
9501 | } | ||
9502 | } | ||
9503 | |||
9488 | static int __devinit bnx2x_prev_unload(struct bnx2x *bp) | 9504 | static int __devinit bnx2x_prev_unload(struct bnx2x *bp) |
9489 | { | 9505 | { |
9490 | int time_counter = 10; | 9506 | int time_counter = 10; |
9491 | u32 rc, fw, hw_lock_reg, hw_lock_val; | 9507 | u32 rc, fw, hw_lock_reg, hw_lock_val; |
9492 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); | 9508 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); |
9493 | 9509 | ||
9494 | /* Release previously held locks */ | 9510 | /* clear hw from errors which may have resulted from an interrupted |
9511 | * dmae transaction. | ||
9512 | */ | ||
9513 | bnx2x_prev_interrupted_dmae(bp); | ||
9514 | |||
9515 | /* Release previously held locks */ | ||
9495 | hw_lock_reg = (BP_FUNC(bp) <= 5) ? | 9516 | hw_lock_reg = (BP_FUNC(bp) <= 5) ? |
9496 | (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) : | 9517 | (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) : |
9497 | (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8); | 9518 | (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8); |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 482138ec64d2..39b92f5ed7dd 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -888,8 +888,13 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi) | |||
888 | if (sblk->status & SD_STATUS_LINK_CHG) | 888 | if (sblk->status & SD_STATUS_LINK_CHG) |
889 | work_exists = 1; | 889 | work_exists = 1; |
890 | } | 890 | } |
891 | /* check for RX/TX work to do */ | 891 | |
892 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons || | 892 | /* check for TX work to do */ |
893 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons) | ||
894 | work_exists = 1; | ||
895 | |||
896 | /* check for RX work to do */ | ||
897 | if (tnapi->rx_rcb_prod_idx && | ||
893 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) | 898 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) |
894 | work_exists = 1; | 899 | work_exists = 1; |
895 | 900 | ||
@@ -6172,6 +6177,9 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) | |||
6172 | return work_done; | 6177 | return work_done; |
6173 | } | 6178 | } |
6174 | 6179 | ||
6180 | if (!tnapi->rx_rcb_prod_idx) | ||
6181 | return work_done; | ||
6182 | |||
6175 | /* run RX thread, within the bounds set by NAPI. | 6183 | /* run RX thread, within the bounds set by NAPI. |
6176 | * All RX "locking" is done by ensuring outside | 6184 | * All RX "locking" is done by ensuring outside |
6177 | * code synchronizes with tg3->napi.poll() | 6185 | * code synchronizes with tg3->napi.poll() |
@@ -7621,6 +7629,12 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
7621 | */ | 7629 | */ |
7622 | switch (i) { | 7630 | switch (i) { |
7623 | default: | 7631 | default: |
7632 | if (tg3_flag(tp, ENABLE_RSS)) { | ||
7633 | tnapi->rx_rcb_prod_idx = NULL; | ||
7634 | break; | ||
7635 | } | ||
7636 | /* Fall through */ | ||
7637 | case 1: | ||
7624 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; | 7638 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; |
7625 | break; | 7639 | break; |
7626 | case 2: | 7640 | 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 ef4499d2ee4b..a059f0c27e28 100644 --- a/drivers/net/ethernet/dlink/dl2k.c +++ b/drivers/net/ethernet/dlink/dl2k.c | |||
@@ -1254,55 +1254,21 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1254 | { | 1254 | { |
1255 | int phy_addr; | 1255 | int phy_addr; |
1256 | struct netdev_private *np = netdev_priv(dev); | 1256 | struct netdev_private *np = netdev_priv(dev); |
1257 | struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; | 1257 | struct mii_ioctl_data *miidata = if_mii(rq); |
1258 | |||
1259 | struct netdev_desc *desc; | ||
1260 | int i; | ||
1261 | 1258 | ||
1262 | phy_addr = np->phy_addr; | 1259 | phy_addr = np->phy_addr; |
1263 | switch (cmd) { | 1260 | switch (cmd) { |
1264 | case SIOCDEVPRIVATE: | 1261 | case SIOCGMIIPHY: |
1265 | break; | 1262 | miidata->phy_id = phy_addr; |
1266 | |||
1267 | case SIOCDEVPRIVATE + 1: | ||
1268 | miidata->out_value = mii_read (dev, phy_addr, miidata->reg_num); | ||
1269 | break; | 1263 | break; |
1270 | case SIOCDEVPRIVATE + 2: | 1264 | case SIOCGMIIREG: |
1271 | mii_write (dev, phy_addr, miidata->reg_num, miidata->in_value); | 1265 | miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num); |
1272 | break; | 1266 | break; |
1273 | case SIOCDEVPRIVATE + 3: | 1267 | case SIOCSMIIREG: |
1274 | break; | 1268 | if (!capable(CAP_NET_ADMIN)) |
1275 | case SIOCDEVPRIVATE + 4: | 1269 | return -EPERM; |
1276 | break; | 1270 | mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in); |
1277 | case SIOCDEVPRIVATE + 5: | ||
1278 | netif_stop_queue (dev); | ||
1279 | break; | 1271 | break; |
1280 | case SIOCDEVPRIVATE + 6: | ||
1281 | netif_wake_queue (dev); | ||
1282 | break; | ||
1283 | case SIOCDEVPRIVATE + 7: | ||
1284 | printk | ||
1285 | ("tx_full=%x cur_tx=%lx old_tx=%lx cur_rx=%lx old_rx=%lx\n", | ||
1286 | netif_queue_stopped(dev), np->cur_tx, np->old_tx, np->cur_rx, | ||
1287 | np->old_rx); | ||
1288 | break; | ||
1289 | case SIOCDEVPRIVATE + 8: | ||
1290 | printk("TX ring:\n"); | ||
1291 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
1292 | desc = &np->tx_ring[i]; | ||
1293 | printk | ||
1294 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", | ||
1295 | i, | ||
1296 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), | ||
1297 | (u32)le64_to_cpu(desc->next_desc), | ||
1298 | (u32)le64_to_cpu(desc->status), | ||
1299 | (u32)(le64_to_cpu(desc->fraginfo) >> 32), | ||
1300 | (u32)le64_to_cpu(desc->fraginfo)); | ||
1301 | printk ("\n"); | ||
1302 | } | ||
1303 | printk ("\n"); | ||
1304 | break; | ||
1305 | |||
1306 | default: | 1272 | default: |
1307 | return -EOPNOTSUPP; | 1273 | return -EOPNOTSUPP; |
1308 | } | 1274 | } |
diff --git a/drivers/net/ethernet/dlink/dl2k.h b/drivers/net/ethernet/dlink/dl2k.h index 40ba6e02988c..3699565704c7 100644 --- a/drivers/net/ethernet/dlink/dl2k.h +++ b/drivers/net/ethernet/dlink/dl2k.h | |||
@@ -348,13 +348,6 @@ struct ioctl_data { | |||
348 | char *data; | 348 | char *data; |
349 | }; | 349 | }; |
350 | 350 | ||
351 | struct mii_data { | ||
352 | __u16 reserved; | ||
353 | __u16 reg_num; | ||
354 | __u16 in_value; | ||
355 | __u16 out_value; | ||
356 | }; | ||
357 | |||
358 | /* The Rx and Tx buffer descriptors. */ | 351 | /* The Rx and Tx buffer descriptors. */ |
359 | struct netdev_desc { | 352 | struct netdev_desc { |
360 | __le64 next_desc; | 353 | __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/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 40438eabd26c..f1aef68e1e83 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -3400,7 +3400,7 @@ static void e1000_dump(struct e1000_adapter *adapter) | |||
3400 | for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { | 3400 | for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { |
3401 | struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i); | 3401 | struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i); |
3402 | struct e1000_buffer *buffer_info = &tx_ring->buffer_info[i]; | 3402 | struct e1000_buffer *buffer_info = &tx_ring->buffer_info[i]; |
3403 | struct my_u { u64 a; u64 b; }; | 3403 | struct my_u { __le64 a; __le64 b; }; |
3404 | struct my_u *u = (struct my_u *)tx_desc; | 3404 | struct my_u *u = (struct my_u *)tx_desc; |
3405 | const char *type; | 3405 | const char *type; |
3406 | 3406 | ||
@@ -3444,7 +3444,7 @@ rx_ring_summary: | |||
3444 | for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { | 3444 | for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { |
3445 | struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i); | 3445 | struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i); |
3446 | struct e1000_buffer *buffer_info = &rx_ring->buffer_info[i]; | 3446 | struct e1000_buffer *buffer_info = &rx_ring->buffer_info[i]; |
3447 | struct my_u { u64 a; u64 b; }; | 3447 | struct my_u { __le64 a; __le64 b; }; |
3448 | struct my_u *u = (struct my_u *)rx_desc; | 3448 | struct my_u *u = (struct my_u *)rx_desc; |
3449 | const char *type; | 3449 | const char *type; |
3450 | 3450 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index f648299c54ea..a4b0435b00dc 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -3778,7 +3778,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) | |||
3778 | /* fire an unusual interrupt on the test handler */ | 3778 | /* fire an unusual interrupt on the test handler */ |
3779 | ew32(ICS, E1000_ICS_RXSEQ); | 3779 | ew32(ICS, E1000_ICS_RXSEQ); |
3780 | e1e_flush(); | 3780 | e1e_flush(); |
3781 | msleep(50); | 3781 | msleep(100); |
3782 | 3782 | ||
3783 | e1000_irq_disable(adapter); | 3783 | e1000_irq_disable(adapter); |
3784 | 3784 | ||
diff --git a/drivers/net/ethernet/intel/e1000e/param.c b/drivers/net/ethernet/intel/e1000e/param.c index feb6eebb0021..42444d14aae6 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 |
@@ -389,8 +389,49 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
389 | break; | 389 | break; |
390 | } | 390 | } |
391 | } else { | 391 | } else { |
392 | adapter->itr_setting = opt.def; | 392 | /* |
393 | * If no option specified, use default value and go | ||
394 | * through the logic below to adjust itr/itr_setting | ||
395 | */ | ||
396 | adapter->itr = opt.def; | ||
397 | |||
398 | /* | ||
399 | * Make sure a message is printed for non-special | ||
400 | * default values | ||
401 | */ | ||
402 | if (adapter->itr > 40) | ||
403 | e_info("%s set to default %d\n", opt.name, | ||
404 | adapter->itr); | ||
405 | } | ||
406 | |||
407 | adapter->itr_setting = adapter->itr; | ||
408 | switch (adapter->itr) { | ||
409 | case 0: | ||
410 | e_info("%s turned off\n", opt.name); | ||
411 | break; | ||
412 | case 1: | ||
413 | e_info("%s set to dynamic mode\n", opt.name); | ||
414 | adapter->itr = 20000; | ||
415 | break; | ||
416 | case 3: | ||
417 | e_info("%s set to dynamic conservative mode\n", | ||
418 | opt.name); | ||
393 | adapter->itr = 20000; | 419 | adapter->itr = 20000; |
420 | break; | ||
421 | case 4: | ||
422 | e_info("%s set to simplified (2000-8000 ints) mode\n", | ||
423 | opt.name); | ||
424 | break; | ||
425 | default: | ||
426 | /* | ||
427 | * Save the setting, because the dynamic bits | ||
428 | * change itr. | ||
429 | * | ||
430 | * Clear the lower two bits because | ||
431 | * they are used as control. | ||
432 | */ | ||
433 | adapter->itr_setting &= ~3; | ||
434 | break; | ||
394 | } | 435 | } |
395 | } | 436 | } |
396 | { /* Interrupt Mode */ | 437 | { /* Interrupt Mode */ |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index f40f3886eb26..80d52d2dfea3 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -2649,8 +2649,6 @@ void igb_configure_tx_ring(struct igb_adapter *adapter, | |||
2649 | 2649 | ||
2650 | txdctl |= E1000_TXDCTL_QUEUE_ENABLE; | 2650 | txdctl |= E1000_TXDCTL_QUEUE_ENABLE; |
2651 | wr32(E1000_TXDCTL(reg_idx), txdctl); | 2651 | wr32(E1000_TXDCTL(reg_idx), txdctl); |
2652 | |||
2653 | netdev_tx_reset_queue(txring_txq(ring)); | ||
2654 | } | 2652 | } |
2655 | 2653 | ||
2656 | /** | 2654 | /** |
@@ -3160,6 +3158,8 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring) | |||
3160 | igb_unmap_and_free_tx_resource(tx_ring, buffer_info); | 3158 | igb_unmap_and_free_tx_resource(tx_ring, buffer_info); |
3161 | } | 3159 | } |
3162 | 3160 | ||
3161 | netdev_tx_reset_queue(txring_txq(tx_ring)); | ||
3162 | |||
3163 | size = sizeof(struct igb_tx_buffer) * tx_ring->count; | 3163 | size = sizeof(struct igb_tx_buffer) * tx_ring->count; |
3164 | memset(tx_ring->tx_buffer_info, 0, size); | 3164 | memset(tx_ring->tx_buffer_info, 0, size); |
3165 | 3165 | ||
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.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 89cebc812ab9..425f86432f90 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -598,9 +598,6 @@ extern struct ixgbe_info ixgbe_82599_info; | |||
598 | extern struct ixgbe_info ixgbe_X540_info; | 598 | extern struct ixgbe_info ixgbe_X540_info; |
599 | #ifdef CONFIG_IXGBE_DCB | 599 | #ifdef CONFIG_IXGBE_DCB |
600 | extern const struct dcbnl_rtnl_ops dcbnl_ops; | 600 | extern const struct dcbnl_rtnl_ops dcbnl_ops; |
601 | extern int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg, | ||
602 | struct ixgbe_dcb_config *dst_dcb_cfg, | ||
603 | int tc_max); | ||
604 | #endif | 601 | #endif |
605 | 602 | ||
606 | extern char ixgbe_driver_name[]; | 603 | extern char ixgbe_driver_name[]; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index 2feacf698d9b..a09d6b4f0ab0 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | |||
@@ -44,18 +44,26 @@ | |||
44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ | 44 | #define DCB_NO_HW_CHG 1 /* DCB configuration did not change */ |
45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ | 45 | #define DCB_HW_CHG 2 /* DCB configuration changed, no reset */ |
46 | 46 | ||
47 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *scfg, | 47 | static int ixgbe_copy_dcb_cfg(struct ixgbe_adapter *adapter, int tc_max) |
48 | struct ixgbe_dcb_config *dcfg, int tc_max) | ||
49 | { | 48 | { |
49 | struct ixgbe_dcb_config *scfg = &adapter->temp_dcb_cfg; | ||
50 | struct ixgbe_dcb_config *dcfg = &adapter->dcb_cfg; | ||
50 | struct tc_configuration *src = NULL; | 51 | struct tc_configuration *src = NULL; |
51 | struct tc_configuration *dst = NULL; | 52 | struct tc_configuration *dst = NULL; |
52 | int i, j; | 53 | int i, j; |
53 | int tx = DCB_TX_CONFIG; | 54 | int tx = DCB_TX_CONFIG; |
54 | int rx = DCB_RX_CONFIG; | 55 | int rx = DCB_RX_CONFIG; |
55 | int changes = 0; | 56 | int changes = 0; |
57 | #ifdef IXGBE_FCOE | ||
58 | struct dcb_app app = { | ||
59 | .selector = DCB_APP_IDTYPE_ETHTYPE, | ||
60 | .protocol = ETH_P_FCOE, | ||
61 | }; | ||
62 | u8 up = dcb_getapp(adapter->netdev, &app); | ||
56 | 63 | ||
57 | if (!scfg || !dcfg) | 64 | if (up && !(up & (1 << adapter->fcoe.up))) |
58 | return changes; | 65 | changes |= BIT_APP_UPCHG; |
66 | #endif | ||
59 | 67 | ||
60 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { | 68 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { |
61 | src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0]; | 69 | src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
@@ -332,28 +340,12 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
332 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 340 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
333 | int ret = DCB_NO_HW_CHG; | 341 | int ret = DCB_NO_HW_CHG; |
334 | int i; | 342 | int i; |
335 | #ifdef IXGBE_FCOE | ||
336 | struct dcb_app app = { | ||
337 | .selector = DCB_APP_IDTYPE_ETHTYPE, | ||
338 | .protocol = ETH_P_FCOE, | ||
339 | }; | ||
340 | u8 up; | ||
341 | |||
342 | /* In IEEE mode, use the IEEE Ethertype selector value */ | ||
343 | if (adapter->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) { | ||
344 | app.selector = IEEE_8021QAZ_APP_SEL_ETHERTYPE; | ||
345 | up = dcb_ieee_getapp_mask(netdev, &app); | ||
346 | } else { | ||
347 | up = dcb_getapp(netdev, &app); | ||
348 | } | ||
349 | #endif | ||
350 | 343 | ||
351 | /* Fail command if not in CEE mode */ | 344 | /* Fail command if not in CEE mode */ |
352 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 345 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
353 | return ret; | 346 | return ret; |
354 | 347 | ||
355 | adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, | 348 | adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(adapter, |
356 | &adapter->dcb_cfg, | ||
357 | MAX_TRAFFIC_CLASS); | 349 | MAX_TRAFFIC_CLASS); |
358 | if (!adapter->dcb_set_bitmap) | 350 | if (!adapter->dcb_set_bitmap) |
359 | return ret; | 351 | return ret; |
@@ -440,8 +432,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
440 | * FCoE is using changes. This happens if the APP info | 432 | * FCoE is using changes. This happens if the APP info |
441 | * changes or the up2tc mapping is updated. | 433 | * changes or the up2tc mapping is updated. |
442 | */ | 434 | */ |
443 | if ((up && !(up & (1 << adapter->fcoe.up))) || | 435 | if (adapter->dcb_set_bitmap & BIT_APP_UPCHG) { |
444 | (adapter->dcb_set_bitmap & BIT_APP_UPCHG)) { | 436 | struct dcb_app app = { |
437 | .selector = DCB_APP_IDTYPE_ETHTYPE, | ||
438 | .protocol = ETH_P_FCOE, | ||
439 | }; | ||
440 | u8 up = dcb_getapp(netdev, &app); | ||
441 | |||
445 | adapter->fcoe.up = ffs(up) - 1; | 442 | adapter->fcoe.up = ffs(up) - 1; |
446 | ixgbe_dcbnl_devreset(netdev); | 443 | ixgbe_dcbnl_devreset(netdev); |
447 | ret = DCB_HW_CHG_RST; | 444 | ret = DCB_HW_CHG_RST; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 27225ff44e2f..cca3e9c4a08a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -1780,6 +1780,8 @@ static u16 ixgbe_clean_test_rings(struct ixgbe_ring *rx_ring, | |||
1780 | rx_desc = IXGBE_RX_DESC(rx_ring, rx_ntc); | 1780 | rx_desc = IXGBE_RX_DESC(rx_ring, rx_ntc); |
1781 | } | 1781 | } |
1782 | 1782 | ||
1783 | netdev_tx_reset_queue(txring_txq(tx_ring)); | ||
1784 | |||
1783 | /* re-map buffers to ring, store next to clean values */ | 1785 | /* re-map buffers to ring, store next to clean values */ |
1784 | ixgbe_alloc_rx_buffers(rx_ring, count); | 1786 | ixgbe_alloc_rx_buffers(rx_ring, count); |
1785 | rx_ring->next_to_clean = rx_ntc; | 1787 | rx_ring->next_to_clean = rx_ntc; |
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_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 4048c9d35caa..ea3cb710c2dd 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -2675,8 +2675,6 @@ void ixgbe_configure_tx_ring(struct ixgbe_adapter *adapter, | |||
2675 | /* enable queue */ | 2675 | /* enable queue */ |
2676 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl); | 2676 | IXGBE_WRITE_REG(hw, IXGBE_TXDCTL(reg_idx), txdctl); |
2677 | 2677 | ||
2678 | netdev_tx_reset_queue(txring_txq(ring)); | ||
2679 | |||
2680 | /* TXDCTL.EN will return 0 on 82598 if link is down, so skip it */ | 2678 | /* TXDCTL.EN will return 0 on 82598 if link is down, so skip it */ |
2681 | if (hw->mac.type == ixgbe_mac_82598EB && | 2679 | if (hw->mac.type == ixgbe_mac_82598EB && |
2682 | !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP)) | 2680 | !(IXGBE_READ_REG(hw, IXGBE_LINKS) & IXGBE_LINKS_UP)) |
@@ -4144,6 +4142,8 @@ static void ixgbe_clean_tx_ring(struct ixgbe_ring *tx_ring) | |||
4144 | ixgbe_unmap_and_free_tx_resource(tx_ring, tx_buffer_info); | 4142 | ixgbe_unmap_and_free_tx_resource(tx_ring, tx_buffer_info); |
4145 | } | 4143 | } |
4146 | 4144 | ||
4145 | netdev_tx_reset_queue(txring_txq(tx_ring)); | ||
4146 | |||
4147 | size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; | 4147 | size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count; |
4148 | memset(tx_ring->tx_buffer_info, 0, size); | 4148 | memset(tx_ring->tx_buffer_info, 0, size); |
4149 | 4149 | ||
@@ -4395,8 +4395,8 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter) | |||
4395 | adapter->dcb_cfg.pfc_mode_enable = false; | 4395 | adapter->dcb_cfg.pfc_mode_enable = false; |
4396 | adapter->dcb_set_bitmap = 0x00; | 4396 | adapter->dcb_set_bitmap = 0x00; |
4397 | adapter->dcbx_cap = DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_CEE; | 4397 | adapter->dcbx_cap = DCB_CAP_DCBX_HOST | DCB_CAP_DCBX_VER_CEE; |
4398 | ixgbe_copy_dcb_cfg(&adapter->dcb_cfg, &adapter->temp_dcb_cfg, | 4398 | memcpy(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, |
4399 | MAX_TRAFFIC_CLASS); | 4399 | sizeof(adapter->temp_dcb_cfg)); |
4400 | 4400 | ||
4401 | #endif | 4401 | #endif |
4402 | 4402 | ||
@@ -4843,17 +4843,15 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4843 | netif_device_detach(netdev); | 4843 | netif_device_detach(netdev); |
4844 | 4844 | ||
4845 | if (netif_running(netdev)) { | 4845 | if (netif_running(netdev)) { |
4846 | rtnl_lock(); | ||
4846 | ixgbe_down(adapter); | 4847 | ixgbe_down(adapter); |
4847 | ixgbe_free_irq(adapter); | 4848 | ixgbe_free_irq(adapter); |
4848 | ixgbe_free_all_tx_resources(adapter); | 4849 | ixgbe_free_all_tx_resources(adapter); |
4849 | ixgbe_free_all_rx_resources(adapter); | 4850 | ixgbe_free_all_rx_resources(adapter); |
4851 | rtnl_unlock(); | ||
4850 | } | 4852 | } |
4851 | 4853 | ||
4852 | ixgbe_clear_interrupt_scheme(adapter); | 4854 | ixgbe_clear_interrupt_scheme(adapter); |
4853 | #ifdef CONFIG_DCB | ||
4854 | kfree(adapter->ixgbe_ieee_pfc); | ||
4855 | kfree(adapter->ixgbe_ieee_ets); | ||
4856 | #endif | ||
4857 | 4855 | ||
4858 | #ifdef CONFIG_PM | 4856 | #ifdef CONFIG_PM |
4859 | retval = pci_save_state(pdev); | 4857 | retval = pci_save_state(pdev); |
@@ -7299,6 +7297,11 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
7299 | 7297 | ||
7300 | ixgbe_release_hw_control(adapter); | 7298 | ixgbe_release_hw_control(adapter); |
7301 | 7299 | ||
7300 | #ifdef CONFIG_DCB | ||
7301 | kfree(adapter->ixgbe_ieee_pfc); | ||
7302 | kfree(adapter->ixgbe_ieee_ets); | ||
7303 | |||
7304 | #endif | ||
7302 | iounmap(adapter->hw.hw_addr); | 7305 | iounmap(adapter->hw.hw_addr); |
7303 | pci_release_selected_regions(pdev, pci_select_bars(pdev, | 7306 | pci_release_selected_regions(pdev, pci_select_bars(pdev, |
7304 | IORESOURCE_MEM)); | 7307 | IORESOURCE_MEM)); |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index 7732474263da..cace36f2ab92 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/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index dc065face7ac..3cf4ab755838 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 8aa33326bec3..4da93a5d7ec6 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1512,7 +1512,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) | |||
1512 | 1512 | ||
1513 | static int match_first_device(struct device *dev, void *data) | 1513 | static int match_first_device(struct device *dev, void *data) |
1514 | { | 1514 | { |
1515 | return 1; | 1515 | return !strncmp(dev_name(dev), "davinci_mdio", 12); |
1516 | } | 1516 | } |
1517 | 1517 | ||
1518 | /** | 1518 | /** |
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c index bb8b802a328b..3e6abf0f2771 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/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/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 90a30026a931..00880edba048 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -83,6 +83,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
83 | struct cdc_state *info = (void *) &dev->data; | 83 | struct cdc_state *info = (void *) &dev->data; |
84 | int status; | 84 | int status; |
85 | int rndis; | 85 | int rndis; |
86 | bool android_rndis_quirk = false; | ||
86 | struct usb_driver *driver = driver_of(intf); | 87 | struct usb_driver *driver = driver_of(intf); |
87 | struct usb_cdc_mdlm_desc *desc = NULL; | 88 | struct usb_cdc_mdlm_desc *desc = NULL; |
88 | struct usb_cdc_mdlm_detail_desc *detail = NULL; | 89 | struct usb_cdc_mdlm_detail_desc *detail = NULL; |
@@ -195,6 +196,11 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
195 | info->control, | 196 | info->control, |
196 | info->u->bSlaveInterface0, | 197 | info->u->bSlaveInterface0, |
197 | info->data); | 198 | info->data); |
199 | /* fall back to hard-wiring for RNDIS */ | ||
200 | if (rndis) { | ||
201 | android_rndis_quirk = true; | ||
202 | goto next_desc; | ||
203 | } | ||
198 | goto bad_desc; | 204 | goto bad_desc; |
199 | } | 205 | } |
200 | if (info->control != intf) { | 206 | if (info->control != intf) { |
@@ -271,11 +277,15 @@ next_desc: | |||
271 | /* Microsoft ActiveSync based and some regular RNDIS devices lack the | 277 | /* Microsoft ActiveSync based and some regular RNDIS devices lack the |
272 | * CDC descriptors, so we'll hard-wire the interfaces and not check | 278 | * CDC descriptors, so we'll hard-wire the interfaces and not check |
273 | * for descriptors. | 279 | * for descriptors. |
280 | * | ||
281 | * Some Android RNDIS devices have a CDC Union descriptor pointing | ||
282 | * to non-existing interfaces. Ignore that and attempt the same | ||
283 | * hard-wired 0 and 1 interfaces. | ||
274 | */ | 284 | */ |
275 | if (rndis && !info->u) { | 285 | if (rndis && (!info->u || android_rndis_quirk)) { |
276 | info->control = usb_ifnum_to_if(dev->udev, 0); | 286 | info->control = usb_ifnum_to_if(dev->udev, 0); |
277 | info->data = usb_ifnum_to_if(dev->udev, 1); | 287 | info->data = usb_ifnum_to_if(dev->udev, 1); |
278 | if (!info->control || !info->data) { | 288 | if (!info->control || !info->data || info->control != intf) { |
279 | dev_dbg(&intf->dev, | 289 | dev_dbg(&intf->dev, |
280 | "rndis: master #0/%p slave #1/%p\n", | 290 | "rndis: master #0/%p slave #1/%p\n", |
281 | info->control, | 291 | info->control, |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index a2349483cd2a..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 | ||
@@ -1212,7 +1225,7 @@ static const struct driver_info smsc75xx_info = { | |||
1212 | .rx_fixup = smsc75xx_rx_fixup, | 1225 | .rx_fixup = smsc75xx_rx_fixup, |
1213 | .tx_fixup = smsc75xx_tx_fixup, | 1226 | .tx_fixup = smsc75xx_tx_fixup, |
1214 | .status = smsc75xx_status, | 1227 | .status = smsc75xx_status, |
1215 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1228 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
1216 | }; | 1229 | }; |
1217 | 1230 | ||
1218 | 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 db9953630da5..80b837c88f0d 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); |
@@ -1444,7 +1445,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1444 | 1445 | ||
1445 | status = register_netdev (net); | 1446 | status = register_netdev (net); |
1446 | if (status) | 1447 | if (status) |
1447 | goto out3; | 1448 | goto out4; |
1448 | netif_info(dev, probe, dev->net, | 1449 | netif_info(dev, probe, dev->net, |
1449 | "register '%s' at usb-%s-%s, %s, %pM\n", | 1450 | "register '%s' at usb-%s-%s, %s, %pM\n", |
1450 | udev->dev.driver->name, | 1451 | udev->dev.driver->name, |
@@ -1462,6 +1463,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1462 | 1463 | ||
1463 | return 0; | 1464 | return 0; |
1464 | 1465 | ||
1466 | out4: | ||
1467 | usb_free_urb(dev->interrupt); | ||
1465 | out3: | 1468 | out3: |
1466 | if (info->unbind) | 1469 | if (info->unbind) |
1467 | info->unbind (dev, udev); | 1470 | info->unbind (dev, udev); |
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index 8c50d9d19d78..aec33cc207fd 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c | |||
@@ -220,6 +220,7 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
220 | } | 220 | } |
221 | 221 | ||
222 | ath5k_deinit_ah(ah); | 222 | ath5k_deinit_ah(ah); |
223 | iounmap(ah->iobase); | ||
223 | platform_set_drvdata(pdev, NULL); | 224 | platform_set_drvdata(pdev, NULL); |
224 | ieee80211_free_hw(hw); | 225 | ieee80211_free_hw(hw); |
225 | 226 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index f554bff87e62..c7492c6a2519 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -859,7 +859,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
859 | ar5008_hw_set_channel_regs(ah, chan); | 859 | ar5008_hw_set_channel_regs(ah, chan); |
860 | ar5008_hw_init_chain_masks(ah); | 860 | ar5008_hw_init_chain_masks(ah); |
861 | ath9k_olc_init(ah); | 861 | ath9k_olc_init(ah); |
862 | ath9k_hw_apply_txpower(ah, chan); | 862 | ath9k_hw_apply_txpower(ah, chan, false); |
863 | 863 | ||
864 | /* Write analog registers */ | 864 | /* Write analog registers */ |
865 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { | 865 | 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 a1c0879a5d4e..11abb972be1f 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -373,7 +373,7 @@ static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah, | |||
373 | else | 373 | else |
374 | spur_subchannel_sd = 0; | 374 | spur_subchannel_sd = 0; |
375 | 375 | ||
376 | spur_freq_sd = (freq_offset << 9) / 11; | 376 | spur_freq_sd = ((freq_offset + 10) << 9) / 11; |
377 | 377 | ||
378 | } else { | 378 | } else { |
379 | if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, | 379 | if (REG_READ_FIELD(ah, AR_PHY_GEN_CTRL, |
@@ -382,7 +382,7 @@ static void ar9003_hw_spur_ofdm_work(struct ath_hw *ah, | |||
382 | else | 382 | else |
383 | spur_subchannel_sd = 1; | 383 | spur_subchannel_sd = 1; |
384 | 384 | ||
385 | spur_freq_sd = (freq_offset << 9) / 11; | 385 | spur_freq_sd = ((freq_offset - 10) << 9) / 11; |
386 | 386 | ||
387 | } | 387 | } |
388 | 388 | ||
@@ -680,7 +680,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, | |||
680 | ar9003_hw_override_ini(ah); | 680 | ar9003_hw_override_ini(ah); |
681 | ar9003_hw_set_channel_regs(ah, chan); | 681 | ar9003_hw_set_channel_regs(ah, chan); |
682 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | 682 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
683 | ath9k_hw_apply_txpower(ah, chan); | 683 | ath9k_hw_apply_txpower(ah, chan, false); |
684 | 684 | ||
685 | if (AR_SREV_9462(ah)) { | 685 | if (AR_SREV_9462(ah)) { |
686 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, | 686 | 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 5ab0e6ed4655..aa614767adff 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -798,6 +798,8 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, | |||
798 | regulatory->max_power_level = ratesArray[i]; | 798 | regulatory->max_power_level = ratesArray[i]; |
799 | } | 799 | } |
800 | 800 | ||
801 | ath9k_hw_update_regulatory_maxpower(ah); | ||
802 | |||
801 | if (test) | 803 | if (test) |
802 | return; | 804 | return; |
803 | 805 | ||
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 75fd87f295d4..f84477c5ebb1 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1522,7 +1522,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1522 | return false; | 1522 | return false; |
1523 | } | 1523 | } |
1524 | ath9k_hw_set_clockrate(ah); | 1524 | ath9k_hw_set_clockrate(ah); |
1525 | ath9k_hw_apply_txpower(ah, chan); | 1525 | ath9k_hw_apply_txpower(ah, chan, false); |
1526 | ath9k_hw_rfbus_done(ah); | 1526 | ath9k_hw_rfbus_done(ah); |
1527 | 1527 | ||
1528 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) | 1528 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) |
@@ -2797,7 +2797,8 @@ static int get_antenna_gain(struct ath_hw *ah, struct ath9k_channel *chan) | |||
2797 | return ah->eep_ops->get_eeprom(ah, gain_param); | 2797 | return ah->eep_ops->get_eeprom(ah, gain_param); |
2798 | } | 2798 | } |
2799 | 2799 | ||
2800 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | 2800 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
2801 | bool test) | ||
2801 | { | 2802 | { |
2802 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); | 2803 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); |
2803 | struct ieee80211_channel *channel; | 2804 | struct ieee80211_channel *channel; |
@@ -2818,7 +2819,7 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | |||
2818 | 2819 | ||
2819 | ah->eep_ops->set_txpower(ah, chan, | 2820 | ah->eep_ops->set_txpower(ah, chan, |
2820 | ath9k_regd_get_ctl(reg, chan), | 2821 | ath9k_regd_get_ctl(reg, chan), |
2821 | ant_reduction, new_pwr, false); | 2822 | ant_reduction, new_pwr, test); |
2822 | } | 2823 | } |
2823 | 2824 | ||
2824 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | 2825 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) |
@@ -2831,7 +2832,7 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | |||
2831 | if (test) | 2832 | if (test) |
2832 | channel->max_power = MAX_RATE_POWER / 2; | 2833 | channel->max_power = MAX_RATE_POWER / 2; |
2833 | 2834 | ||
2834 | ath9k_hw_apply_txpower(ah, chan); | 2835 | ath9k_hw_apply_txpower(ah, chan, test); |
2835 | 2836 | ||
2836 | if (test) | 2837 | if (test) |
2837 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); | 2838 | 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 8535f76699af..828b9bbc456d 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/b43/main.c b/drivers/net/wireless/b43/main.c index 05ea95ba6de0..617afc8211b2 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -4841,8 +4841,14 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4841 | out_mutex_unlock: | 4841 | out_mutex_unlock: |
4842 | mutex_unlock(&wl->mutex); | 4842 | mutex_unlock(&wl->mutex); |
4843 | 4843 | ||
4844 | /* reload configuration */ | 4844 | /* |
4845 | b43_op_config(hw, ~0); | 4845 | * Configuration may have been overwritten during initialization. |
4846 | * Reload the configuration, but only if initialization was | ||
4847 | * successful. Reloading the configuration after a failed init | ||
4848 | * may hang the system. | ||
4849 | */ | ||
4850 | if (!err) | ||
4851 | b43_op_config(hw, ~0); | ||
4846 | 4852 | ||
4847 | return err; | 4853 | return err; |
4848 | } | 4854 | } |
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 a83fbea04c04..a80b840051a7 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,59 @@ 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; |
2640 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
2616 | break; | 2641 | break; |
2617 | } | 2642 | } |
2618 | } else | 2643 | |
2619 | break; | 2644 | if (brcmf_sdbrcm_dpc(bus)) |
2645 | brcmf_sdbrcm_adddpctsk(bus); | ||
2646 | |||
2647 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
2648 | list_del(cur_hd); | ||
2649 | kfree(cur_hd); | ||
2650 | } | ||
2651 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
2620 | } | 2652 | } |
2621 | return 0; | 2653 | return 0; |
2622 | } | 2654 | } |
@@ -2669,8 +2701,10 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) | |||
2669 | /* Schedule DPC if needed to send queued packet(s) */ | 2701 | /* Schedule DPC if needed to send queued packet(s) */ |
2670 | if (!bus->dpc_sched) { | 2702 | if (!bus->dpc_sched) { |
2671 | bus->dpc_sched = true; | 2703 | bus->dpc_sched = true; |
2672 | if (bus->dpc_tsk) | 2704 | if (bus->dpc_tsk) { |
2705 | brcmf_sdbrcm_adddpctsk(bus); | ||
2673 | complete(&bus->dpc_wait); | 2706 | complete(&bus->dpc_wait); |
2707 | } | ||
2674 | } | 2708 | } |
2675 | 2709 | ||
2676 | return ret; | 2710 | return ret; |
@@ -3514,8 +3548,10 @@ void brcmf_sdbrcm_isr(void *arg) | |||
3514 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); | 3548 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); |
3515 | 3549 | ||
3516 | bus->dpc_sched = true; | 3550 | bus->dpc_sched = true; |
3517 | if (bus->dpc_tsk) | 3551 | if (bus->dpc_tsk) { |
3552 | brcmf_sdbrcm_adddpctsk(bus); | ||
3518 | complete(&bus->dpc_wait); | 3553 | complete(&bus->dpc_wait); |
3554 | } | ||
3519 | } | 3555 | } |
3520 | 3556 | ||
3521 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | 3557 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) |
@@ -3559,8 +3595,10 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | |||
3559 | bus->ipend = true; | 3595 | bus->ipend = true; |
3560 | 3596 | ||
3561 | bus->dpc_sched = true; | 3597 | bus->dpc_sched = true; |
3562 | if (bus->dpc_tsk) | 3598 | if (bus->dpc_tsk) { |
3599 | brcmf_sdbrcm_adddpctsk(bus); | ||
3563 | complete(&bus->dpc_wait); | 3600 | complete(&bus->dpc_wait); |
3601 | } | ||
3564 | } | 3602 | } |
3565 | } | 3603 | } |
3566 | 3604 | ||
@@ -3897,6 +3935,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3897 | } | 3935 | } |
3898 | /* Initialize DPC thread */ | 3936 | /* Initialize DPC thread */ |
3899 | init_completion(&bus->dpc_wait); | 3937 | init_completion(&bus->dpc_wait); |
3938 | INIT_LIST_HEAD(&bus->dpc_tsklst); | ||
3939 | spin_lock_init(&bus->dpc_tl_lock); | ||
3900 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, | 3940 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, |
3901 | bus, "brcmf_dpc"); | 3941 | bus, "brcmf_dpc"); |
3902 | if (IS_ERR(bus->dpc_tsk)) { | 3942 | 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 7083db75b00c..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 | ||
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index d57522c64073..b3707dadad15 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -2192,6 +2192,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
2192 | { | 2192 | { |
2193 | int rc = 0; | 2193 | int rc = 0; |
2194 | unsigned long flags; | 2194 | unsigned long flags; |
2195 | unsigned long now, end; | ||
2195 | 2196 | ||
2196 | spin_lock_irqsave(&priv->lock, flags); | 2197 | spin_lock_irqsave(&priv->lock, flags); |
2197 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2198 | if (priv->status & STATUS_HCMD_ACTIVE) { |
@@ -2233,10 +2234,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
2233 | } | 2234 | } |
2234 | spin_unlock_irqrestore(&priv->lock, flags); | 2235 | spin_unlock_irqrestore(&priv->lock, flags); |
2235 | 2236 | ||
2237 | now = jiffies; | ||
2238 | end = now + HOST_COMPLETE_TIMEOUT; | ||
2239 | again: | ||
2236 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, | 2240 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
2237 | !(priv-> | 2241 | !(priv-> |
2238 | status & STATUS_HCMD_ACTIVE), | 2242 | status & STATUS_HCMD_ACTIVE), |
2239 | HOST_COMPLETE_TIMEOUT); | 2243 | end - now); |
2244 | if (rc < 0) { | ||
2245 | now = jiffies; | ||
2246 | if (time_before(now, end)) | ||
2247 | goto again; | ||
2248 | rc = 0; | ||
2249 | } | ||
2250 | |||
2240 | if (rc == 0) { | 2251 | if (rc == 0) { |
2241 | spin_lock_irqsave(&priv->lock, flags); | 2252 | spin_lock_irqsave(&priv->lock, flags); |
2242 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2253 | 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 8c7a0cd13854..2629a6602dfa 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -32,8 +32,8 @@ | |||
32 | #include "iwl-agn-hw.h" | 32 | #include "iwl-agn-hw.h" |
33 | 33 | ||
34 | /* Highest firmware API version supported */ | 34 | /* Highest firmware API version supported */ |
35 | #define IWL1000_UCODE_API_MAX 6 | 35 | #define IWL1000_UCODE_API_MAX 5 |
36 | #define IWL100_UCODE_API_MAX 6 | 36 | #define IWL100_UCODE_API_MAX 5 |
37 | 37 | ||
38 | /* Oldest version we won't warn about */ | 38 | /* Oldest version we won't warn about */ |
39 | #define IWL1000_UCODE_API_OK 5 | 39 | #define IWL1000_UCODE_API_OK 5 |
@@ -122,5 +122,5 @@ const struct iwl_cfg iwl100_bg_cfg = { | |||
122 | IWL_DEVICE_100, | 122 | IWL_DEVICE_100, |
123 | }; | 123 | }; |
124 | 124 | ||
125 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | 125 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK)); |
126 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX)); | 126 | 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 9484e3be2678..7f793417c787 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
@@ -38,10 +38,10 @@ | |||
38 | #define IWL135_UCODE_API_MAX 6 | 38 | #define IWL135_UCODE_API_MAX 6 |
39 | 39 | ||
40 | /* Oldest version we won't warn about */ | 40 | /* Oldest version we won't warn about */ |
41 | #define IWL2030_UCODE_API_OK 5 | 41 | #define IWL2030_UCODE_API_OK 6 |
42 | #define IWL2000_UCODE_API_OK 5 | 42 | #define IWL2000_UCODE_API_OK 6 |
43 | #define IWL105_UCODE_API_OK 5 | 43 | #define IWL105_UCODE_API_OK 6 |
44 | #define IWL135_UCODE_API_OK 5 | 44 | #define IWL135_UCODE_API_OK 6 |
45 | 45 | ||
46 | /* Lowest firmware API version supported */ | 46 | /* Lowest firmware API version supported */ |
47 | #define IWL2030_UCODE_API_MIN 5 | 47 | #define IWL2030_UCODE_API_MIN 5 |
@@ -219,7 +219,7 @@ const struct iwl_cfg iwl135_bgn_cfg = { | |||
219 | .ht_params = &iwl2000_ht_params, | 219 | .ht_params = &iwl2000_ht_params, |
220 | }; | 220 | }; |
221 | 221 | ||
222 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX)); | 222 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK)); |
223 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX)); | 223 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK)); |
224 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX)); | 224 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK)); |
225 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX)); | 225 | 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 67d4ef26043b..8e26bc825f23 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -35,6 +35,10 @@ | |||
35 | #define IWL5000_UCODE_API_MAX 5 | 35 | #define IWL5000_UCODE_API_MAX 5 |
36 | #define IWL5150_UCODE_API_MAX 2 | 36 | #define IWL5150_UCODE_API_MAX 2 |
37 | 37 | ||
38 | /* Oldest version we won't warn about */ | ||
39 | #define IWL5000_UCODE_API_OK 5 | ||
40 | #define IWL5150_UCODE_API_OK 2 | ||
41 | |||
38 | /* Lowest firmware API version supported */ | 42 | /* Lowest firmware API version supported */ |
39 | #define IWL5000_UCODE_API_MIN 1 | 43 | #define IWL5000_UCODE_API_MIN 1 |
40 | #define IWL5150_UCODE_API_MIN 1 | 44 | #define IWL5150_UCODE_API_MIN 1 |
@@ -70,6 +74,7 @@ static const struct iwl_ht_params iwl5000_ht_params = { | |||
70 | #define IWL_DEVICE_5000 \ | 74 | #define IWL_DEVICE_5000 \ |
71 | .fw_name_pre = IWL5000_FW_PRE, \ | 75 | .fw_name_pre = IWL5000_FW_PRE, \ |
72 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ | 76 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ |
77 | .ucode_api_ok = IWL5000_UCODE_API_OK, \ | ||
73 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ | 78 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ |
74 | .device_family = IWL_DEVICE_FAMILY_5000, \ | 79 | .device_family = IWL_DEVICE_FAMILY_5000, \ |
75 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 80 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
@@ -115,6 +120,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
115 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", | 120 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", |
116 | .fw_name_pre = IWL5000_FW_PRE, | 121 | .fw_name_pre = IWL5000_FW_PRE, |
117 | .ucode_api_max = IWL5000_UCODE_API_MAX, | 122 | .ucode_api_max = IWL5000_UCODE_API_MAX, |
123 | .ucode_api_ok = IWL5000_UCODE_API_OK, | ||
118 | .ucode_api_min = IWL5000_UCODE_API_MIN, | 124 | .ucode_api_min = IWL5000_UCODE_API_MIN, |
119 | .device_family = IWL_DEVICE_FAMILY_5000, | 125 | .device_family = IWL_DEVICE_FAMILY_5000, |
120 | .max_inst_size = IWLAGN_RTC_INST_SIZE, | 126 | .max_inst_size = IWLAGN_RTC_INST_SIZE, |
@@ -130,6 +136,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
130 | #define IWL_DEVICE_5150 \ | 136 | #define IWL_DEVICE_5150 \ |
131 | .fw_name_pre = IWL5150_FW_PRE, \ | 137 | .fw_name_pre = IWL5150_FW_PRE, \ |
132 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ | 138 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ |
139 | .ucode_api_ok = IWL5150_UCODE_API_OK, \ | ||
133 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ | 140 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ |
134 | .device_family = IWL_DEVICE_FAMILY_5150, \ | 141 | .device_family = IWL_DEVICE_FAMILY_5150, \ |
135 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 142 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
@@ -153,5 +160,5 @@ const struct iwl_cfg iwl5150_abg_cfg = { | |||
153 | IWL_DEVICE_5150, | 160 | IWL_DEVICE_5150, |
154 | }; | 161 | }; |
155 | 162 | ||
156 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 163 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK)); |
157 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | 164 | 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 08afedf4b3ec..381b02cf339c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -39,6 +39,8 @@ | |||
39 | /* Oldest version we won't warn about */ | 39 | /* Oldest version we won't warn about */ |
40 | #define IWL6000_UCODE_API_OK 4 | 40 | #define IWL6000_UCODE_API_OK 4 |
41 | #define IWL6000G2_UCODE_API_OK 5 | 41 | #define IWL6000G2_UCODE_API_OK 5 |
42 | #define IWL6050_UCODE_API_OK 5 | ||
43 | #define IWL6000G2B_UCODE_API_OK 6 | ||
42 | 44 | ||
43 | /* Lowest firmware API version supported */ | 45 | /* Lowest firmware API version supported */ |
44 | #define IWL6000_UCODE_API_MIN 4 | 46 | #define IWL6000_UCODE_API_MIN 4 |
@@ -190,7 +192,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { | |||
190 | #define IWL_DEVICE_6030 \ | 192 | #define IWL_DEVICE_6030 \ |
191 | .fw_name_pre = IWL6030_FW_PRE, \ | 193 | .fw_name_pre = IWL6030_FW_PRE, \ |
192 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ | 194 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ |
193 | .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ | 195 | .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \ |
194 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ | 196 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ |
195 | .device_family = IWL_DEVICE_FAMILY_6030, \ | 197 | .device_family = IWL_DEVICE_FAMILY_6030, \ |
196 | .max_inst_size = IWL60_RTC_INST_SIZE, \ | 198 | .max_inst_size = IWL60_RTC_INST_SIZE, \ |
@@ -356,6 +358,6 @@ const struct iwl_cfg iwl6000_3agn_cfg = { | |||
356 | }; | 358 | }; |
357 | 359 | ||
358 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); | 360 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); |
359 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | 361 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK)); |
360 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 362 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK)); |
361 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 363 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c index f94122387e25..0c252c5d8bf1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rx.c | |||
@@ -737,8 +737,7 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
737 | struct sk_buff *skb; | 737 | struct sk_buff *skb; |
738 | __le16 fc = hdr->frame_control; | 738 | __le16 fc = hdr->frame_control; |
739 | struct iwl_rxon_context *ctx; | 739 | struct iwl_rxon_context *ctx; |
740 | struct page *p; | 740 | unsigned int hdrlen, fraglen; |
741 | int offset; | ||
742 | 741 | ||
743 | /* We only process data packets if the interface is open */ | 742 | /* We only process data packets if the interface is open */ |
744 | if (unlikely(!priv->is_open)) { | 743 | if (unlikely(!priv->is_open)) { |
@@ -752,15 +751,24 @@ static void iwlagn_pass_packet_to_mac80211(struct iwl_priv *priv, | |||
752 | iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) | 751 | iwlagn_set_decrypted_flag(priv, hdr, ampdu_status, stats)) |
753 | return; | 752 | return; |
754 | 753 | ||
755 | skb = dev_alloc_skb(128); | 754 | /* Dont use dev_alloc_skb(), we'll have enough headroom once |
755 | * ieee80211_hdr pulled. | ||
756 | */ | ||
757 | skb = alloc_skb(128, GFP_ATOMIC); | ||
756 | if (!skb) { | 758 | if (!skb) { |
757 | IWL_ERR(priv, "dev_alloc_skb failed\n"); | 759 | IWL_ERR(priv, "alloc_skb failed\n"); |
758 | return; | 760 | return; |
759 | } | 761 | } |
762 | hdrlen = min_t(unsigned int, len, skb_tailroom(skb)); | ||
763 | memcpy(skb_put(skb, hdrlen), hdr, hdrlen); | ||
764 | fraglen = len - hdrlen; | ||
765 | |||
766 | if (fraglen) { | ||
767 | int offset = (void *)hdr - rxb_addr(rxb) + rxb_offset(rxb); | ||
760 | 768 | ||
761 | offset = (void *)hdr - rxb_addr(rxb) + rxb_offset(rxb); | 769 | skb_add_rx_frag(skb, 0, rxb_steal_page(rxb), offset, |
762 | p = rxb_steal_page(rxb); | 770 | fraglen, rxb->truesize); |
763 | skb_add_rx_frag(skb, 0, p, offset, len, len); | 771 | } |
764 | 772 | ||
765 | /* | 773 | /* |
766 | * Wake any queues that were stopped due to a passive channel tx | 774 | * Wake any queues that were stopped due to a passive channel tx |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b53852dcdbfd..8bd9610a5d68 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -975,7 +975,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) | |||
975 | 975 | ||
976 | void iwlagn_prepare_restart(struct iwl_priv *priv) | 976 | void iwlagn_prepare_restart(struct iwl_priv *priv) |
977 | { | 977 | { |
978 | struct iwl_rxon_context *ctx; | ||
979 | bool bt_full_concurrent; | 978 | bool bt_full_concurrent; |
980 | u8 bt_ci_compliance; | 979 | u8 bt_ci_compliance; |
981 | u8 bt_load; | 980 | u8 bt_load; |
@@ -985,8 +984,6 @@ void iwlagn_prepare_restart(struct iwl_priv *priv) | |||
985 | 984 | ||
986 | lockdep_assert_held(&priv->mutex); | 985 | lockdep_assert_held(&priv->mutex); |
987 | 986 | ||
988 | for_each_context(priv, ctx) | ||
989 | ctx->vif = NULL; | ||
990 | priv->is_open = 0; | 987 | priv->is_open = 0; |
991 | 988 | ||
992 | /* | 989 | /* |
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 b30bb0c637ca..d33cc9cc7d3f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
@@ -1273,6 +1273,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1273 | struct iwl_rxon_context *tmp, *ctx = NULL; | 1273 | struct iwl_rxon_context *tmp, *ctx = NULL; |
1274 | int err; | 1274 | int err; |
1275 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); | 1275 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); |
1276 | bool reset = false; | ||
1276 | 1277 | ||
1277 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", | 1278 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", |
1278 | viftype, vif->addr); | 1279 | viftype, vif->addr); |
@@ -1294,6 +1295,13 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1294 | tmp->interface_modes | tmp->exclusive_interface_modes; | 1295 | tmp->interface_modes | tmp->exclusive_interface_modes; |
1295 | 1296 | ||
1296 | if (tmp->vif) { | 1297 | if (tmp->vif) { |
1298 | /* On reset we need to add the same interface again */ | ||
1299 | if (tmp->vif == vif) { | ||
1300 | reset = true; | ||
1301 | ctx = tmp; | ||
1302 | break; | ||
1303 | } | ||
1304 | |||
1297 | /* check if this busy context is exclusive */ | 1305 | /* check if this busy context is exclusive */ |
1298 | if (tmp->exclusive_interface_modes & | 1306 | if (tmp->exclusive_interface_modes & |
1299 | BIT(tmp->vif->type)) { | 1307 | BIT(tmp->vif->type)) { |
@@ -1320,7 +1328,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1320 | ctx->vif = vif; | 1328 | ctx->vif = vif; |
1321 | 1329 | ||
1322 | err = iwl_setup_interface(priv, ctx); | 1330 | err = iwl_setup_interface(priv, ctx); |
1323 | if (!err) | 1331 | if (!err || reset) |
1324 | goto out; | 1332 | goto out; |
1325 | 1333 | ||
1326 | ctx->vif = NULL; | 1334 | 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/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c index d2239aad7f11..08517d3c80bb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | |||
@@ -385,6 +385,7 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans, | |||
385 | ._offset = offset, | 385 | ._offset = offset, |
386 | ._page = rxb->page, | 386 | ._page = rxb->page, |
387 | ._page_stolen = false, | 387 | ._page_stolen = false, |
388 | .truesize = max_len, | ||
388 | }; | 389 | }; |
389 | 390 | ||
390 | pkt = rxb_addr(&rxcb); | 391 | pkt = rxb_addr(&rxcb); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 7018d313a4e0..79a1e7ae4995 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -258,6 +258,7 @@ struct iwl_rx_cmd_buffer { | |||
258 | struct page *_page; | 258 | struct page *_page; |
259 | int _offset; | 259 | int _offset; |
260 | bool _page_stolen; | 260 | bool _page_stolen; |
261 | unsigned int truesize; | ||
261 | }; | 262 | }; |
262 | 263 | ||
263 | static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r) | 264 | static inline void *rxb_addr(struct iwl_rx_cmd_buffer *r) |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 81d0c9b34328..f7868c0d79ed 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -1943,6 +1943,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) | |||
1943 | rtl_deinit_deferred_work(hw); | 1943 | rtl_deinit_deferred_work(hw); |
1944 | rtlpriv->intf_ops->adapter_stop(hw); | 1944 | rtlpriv->intf_ops->adapter_stop(hw); |
1945 | } | 1945 | } |
1946 | rtlpriv->cfg->ops->disable_interrupt(hw); | ||
1946 | 1947 | ||
1947 | /*deinit rfkill */ | 1948 | /*deinit rfkill */ |
1948 | rtl_deinit_rfkill(hw); | 1949 | rtl_deinit_rfkill(hw); |
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index 41302c7b1ad0..d1afb8e3b2ef 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/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/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c index f78694295c39..1b851f650e07 100644 --- a/drivers/net/wireless/ti/wl1251/sdio.c +++ b/drivers/net/wireless/ti/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/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index bc8384c6f3eb..639db4d0aa76 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
@@ -50,7 +50,7 @@ | |||
50 | */ | 50 | */ |
51 | #undef START_IN_KERNEL_MODE | 51 | #undef START_IN_KERNEL_MODE |
52 | 52 | ||
53 | #define DRV_VER "0.5.24" | 53 | #define DRV_VER "0.5.26" |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * According to the Atom N270 datasheet, | 56 | * According to the Atom N270 datasheet, |
@@ -83,8 +83,8 @@ static int kernelmode; | |||
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | static unsigned int interval = 10; | 85 | static unsigned int interval = 10; |
86 | static unsigned int fanon = 63000; | 86 | static unsigned int fanon = 60000; |
87 | static unsigned int fanoff = 58000; | 87 | static unsigned int fanoff = 53000; |
88 | static unsigned int verbose; | 88 | static unsigned int verbose; |
89 | static unsigned int fanstate = ACERHDF_FAN_AUTO; | 89 | static unsigned int fanstate = ACERHDF_FAN_AUTO; |
90 | static char force_bios[16]; | 90 | static char force_bios[16]; |
@@ -150,6 +150,8 @@ static const struct bios_settings_t bios_tbl[] = { | |||
150 | {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, | 150 | {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, |
151 | {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, | 151 | {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, |
152 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, | 152 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, |
153 | /* LT1005u */ | ||
154 | {"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, | ||
153 | /* Acer 1410 */ | 155 | /* Acer 1410 */ |
154 | {"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 156 | {"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
155 | {"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, | 157 | {"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, |
@@ -161,6 +163,7 @@ static const struct bios_settings_t bios_tbl[] = { | |||
161 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, | 163 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, |
162 | {"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, | 164 | {"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, |
163 | {"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 165 | {"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
166 | {"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | ||
164 | /* Acer 1810xx */ | 167 | /* Acer 1810xx */ |
165 | {"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 168 | {"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
166 | {"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 169 | {"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
@@ -183,29 +186,44 @@ static const struct bios_settings_t bios_tbl[] = { | |||
183 | {"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 186 | {"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
184 | {"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 187 | {"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
185 | {"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | 188 | {"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, |
189 | {"Acer", "Aspire 1810T", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | ||
186 | /* Acer 531 */ | 190 | /* Acer 531 */ |
191 | {"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} }, | ||
187 | {"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} }, | 192 | {"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} }, |
193 | {"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} }, | ||
194 | /* Acer 751 */ | ||
195 | {"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} }, | ||
196 | /* Acer 1825 */ | ||
197 | {"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} }, | ||
198 | {"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} }, | ||
199 | /* Acer TravelMate 7730 */ | ||
200 | {"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} }, | ||
188 | /* Gateway */ | 201 | /* Gateway */ |
189 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, | 202 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, |
190 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, | 203 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, |
191 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} }, | 204 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} }, |
192 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | 205 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, |
193 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | 206 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, |
207 | {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00} }, | ||
194 | /* Packard Bell */ | 208 | /* Packard Bell */ |
195 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, | 209 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, |
196 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, | 210 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, |
197 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, | 211 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, |
198 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, | 212 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, |
199 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, | 213 | {"Packard Bell", "ENBFT", "V1.3118", 0x55, 0x58, {0x9e, 0x00} }, |
200 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} }, | 214 | {"Packard Bell", "ENBFT", "V1.3127", 0x55, 0x58, {0x9e, 0x00} }, |
201 | {"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 215 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, |
202 | {"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, | 216 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} }, |
203 | {"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} }, | 217 | {"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
204 | {"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} }, | 218 | {"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, |
205 | {"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} }, | 219 | {"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} }, |
206 | {"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} }, | 220 | {"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} }, |
207 | {"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | 221 | {"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} }, |
208 | {"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | 222 | {"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} }, |
223 | {"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | ||
224 | {"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | ||
225 | {"Packard Bell", "DOTMA", "v1.3303t", 0x55, 0x58, {0x9e, 0x00} }, | ||
226 | {"Packard Bell", "DOTVR46", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, | ||
209 | /* pewpew-terminator */ | 227 | /* pewpew-terminator */ |
210 | {"", "", "", 0, 0, {0, 0} } | 228 | {"", "", "", 0, 0, {0, 0} } |
211 | }; | 229 | }; |
@@ -701,15 +719,20 @@ MODULE_LICENSE("GPL"); | |||
701 | MODULE_AUTHOR("Peter Feuerer"); | 719 | MODULE_AUTHOR("Peter Feuerer"); |
702 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); | 720 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); |
703 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); | 721 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); |
722 | MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:"); | ||
704 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:"); | 723 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:"); |
705 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:"); | 724 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:"); |
725 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:"); | ||
706 | MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:"); | 726 | MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:"); |
727 | MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:"); | ||
707 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); | 728 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); |
708 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); | 729 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); |
709 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:"); | 730 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:"); |
710 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOA*:"); | 731 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOA*:"); |
711 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:"); | 732 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:"); |
733 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:"); | ||
712 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:"); | 734 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:"); |
735 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:"); | ||
713 | 736 | ||
714 | module_init(acerhdf_init); | 737 | module_init(acerhdf_init); |
715 | module_exit(acerhdf_exit); | 738 | module_exit(acerhdf_exit); |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index a05fc9c955d8..e6c08ee8d46c 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -212,6 +212,7 @@ static struct dmi_system_id __devinitdata dell_quirks[] = { | |||
212 | }, | 212 | }, |
213 | .driver_data = &quirk_dell_vostro_v130, | 213 | .driver_data = &quirk_dell_vostro_v130, |
214 | }, | 214 | }, |
215 | { } | ||
215 | }; | 216 | }; |
216 | 217 | ||
217 | static struct calling_interface_buffer *buffer; | 218 | static struct calling_interface_buffer *buffer; |
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index f7ba316e0ed6..0ffdb3cde2bb 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
@@ -1565,7 +1565,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1565 | ips->poll_turbo_status = true; | 1565 | ips->poll_turbo_status = true; |
1566 | 1566 | ||
1567 | if (!ips_get_i915_syms(ips)) { | 1567 | if (!ips_get_i915_syms(ips)) { |
1568 | dev_err(&dev->dev, "failed to get i915 symbols, graphics turbo disabled\n"); | 1568 | dev_info(&dev->dev, "failed to get i915 symbols, graphics turbo disabled until i915 loads\n"); |
1569 | ips->gpu_turbo_enabled = false; | 1569 | ips->gpu_turbo_enabled = false; |
1570 | } else { | 1570 | } else { |
1571 | dev_dbg(&dev->dev, "graphics turbo enabled\n"); | 1571 | dev_dbg(&dev->dev, "graphics turbo enabled\n"); |
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index cd188ab72f79..c293d0cdb104 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -902,6 +902,7 @@ read_rtc: | |||
902 | } | 902 | } |
903 | ds1307->nvram->attr.name = "nvram"; | 903 | ds1307->nvram->attr.name = "nvram"; |
904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; | 904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; |
905 | sysfs_bin_attr_init(ds1307->nvram); | ||
905 | ds1307->nvram->read = ds1307_nvram_read, | 906 | ds1307->nvram->read = ds1307_nvram_read, |
906 | ds1307->nvram->write = ds1307_nvram_write, | 907 | ds1307->nvram->write = ds1307_nvram_write, |
907 | ds1307->nvram->size = chip->nvram_size; | 908 | ds1307->nvram->size = chip->nvram_size; |
diff --git a/drivers/s390/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 418ed03d0887..5877b2c64e2a 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/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 | ||