diff options
Diffstat (limited to 'drivers')
617 files changed, 9183 insertions, 4709 deletions
diff --git a/drivers/Kconfig b/drivers/Kconfig index 6f0459cb745b..d236aef7e59f 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig | |||
@@ -50,6 +50,8 @@ source "drivers/i2c/Kconfig" | |||
50 | 50 | ||
51 | source "drivers/spi/Kconfig" | 51 | source "drivers/spi/Kconfig" |
52 | 52 | ||
53 | source "drivers/hsi/Kconfig" | ||
54 | |||
53 | source "drivers/pps/Kconfig" | 55 | source "drivers/pps/Kconfig" |
54 | 56 | ||
55 | source "drivers/ptp/Kconfig" | 57 | source "drivers/ptp/Kconfig" |
diff --git a/drivers/Makefile b/drivers/Makefile index 262b19d6b627..95952c82bf16 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -53,6 +53,7 @@ obj-$(CONFIG_ATA) += ata/ | |||
53 | obj-$(CONFIG_TARGET_CORE) += target/ | 53 | obj-$(CONFIG_TARGET_CORE) += target/ |
54 | obj-$(CONFIG_MTD) += mtd/ | 54 | obj-$(CONFIG_MTD) += mtd/ |
55 | obj-$(CONFIG_SPI) += spi/ | 55 | obj-$(CONFIG_SPI) += spi/ |
56 | obj-y += hsi/ | ||
56 | obj-y += net/ | 57 | obj-y += net/ |
57 | obj-$(CONFIG_ATM) += atm/ | 58 | obj-$(CONFIG_ATM) += atm/ |
58 | obj-$(CONFIG_FUSION) += message/ | 59 | obj-$(CONFIG_FUSION) += message/ |
diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index ab513a972c95..a716fede4f25 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c | |||
@@ -74,7 +74,8 @@ acpi_status acpi_reset(void) | |||
74 | 74 | ||
75 | /* Check if the reset register is supported */ | 75 | /* Check if the reset register is supported */ |
76 | 76 | ||
77 | if (!reset_reg->address) { | 77 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) || |
78 | !reset_reg->address) { | ||
78 | return_ACPI_STATUS(AE_NOT_EXIST); | 79 | return_ACPI_STATUS(AE_NOT_EXIST); |
79 | } | 80 | } |
80 | 81 | ||
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c index b258cab9061c..7586544fddb4 100644 --- a/drivers/acpi/ec_sys.c +++ b/drivers/acpi/ec_sys.c | |||
@@ -27,12 +27,6 @@ MODULE_PARM_DESC(write_support, "Dangerous, reboot and removal of battery may " | |||
27 | 27 | ||
28 | static struct dentry *acpi_ec_debugfs_dir; | 28 | static struct dentry *acpi_ec_debugfs_dir; |
29 | 29 | ||
30 | static int acpi_ec_open_io(struct inode *i, struct file *f) | ||
31 | { | ||
32 | f->private_data = i->i_private; | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static ssize_t acpi_ec_read_io(struct file *f, char __user *buf, | 30 | static ssize_t acpi_ec_read_io(struct file *f, char __user *buf, |
37 | size_t count, loff_t *off) | 31 | size_t count, loff_t *off) |
38 | { | 32 | { |
@@ -95,7 +89,7 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf, | |||
95 | 89 | ||
96 | static const struct file_operations acpi_ec_io_ops = { | 90 | static const struct file_operations acpi_ec_io_ops = { |
97 | .owner = THIS_MODULE, | 91 | .owner = THIS_MODULE, |
98 | .open = acpi_ec_open_io, | 92 | .open = simple_open, |
99 | .read = acpi_ec_read_io, | 93 | .read = acpi_ec_read_io, |
100 | .write = acpi_ec_write_io, | 94 | .write = acpi_ec_write_io, |
101 | .llseek = default_llseek, | 95 | .llseek = default_llseek, |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index ba14fb93c929..c3881b2eb8b2 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -607,8 +607,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, | |||
607 | 607 | ||
608 | acpi_irq_handler = handler; | 608 | acpi_irq_handler = handler; |
609 | acpi_irq_context = context; | 609 | acpi_irq_context = context; |
610 | if (request_threaded_irq(irq, NULL, acpi_irq, IRQF_SHARED, "acpi", | 610 | if (request_irq(irq, acpi_irq, IRQF_SHARED, "acpi", acpi_irq)) { |
611 | acpi_irq)) { | ||
612 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); | 611 | printk(KERN_ERR PREFIX "SCI (IRQ%d) allocation failed\n", irq); |
613 | acpi_irq_handler = NULL; | 612 | acpi_irq_handler = NULL; |
614 | return AE_NOT_ACQUIRED; | 613 | return AE_NOT_ACQUIRED; |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 7049a7d27c4f..330bb4d75852 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -631,7 +631,7 @@ int acpi_power_get_inferred_state(struct acpi_device *device, int *state) | |||
631 | * We know a device's inferred power state when all the resources | 631 | * We know a device's inferred power state when all the resources |
632 | * required for a given D-state are 'on'. | 632 | * required for a given D-state are 'on'. |
633 | */ | 633 | */ |
634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3; i++) { | 634 | for (i = ACPI_STATE_D0; i < ACPI_STATE_D3_HOT; i++) { |
635 | list = &device->power.states[i].resources; | 635 | list = &device->power.states[i].resources; |
636 | if (list->count < 1) | 636 | if (list->count < 1) |
637 | continue; | 637 | continue; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index b3447f63e46b..f3decb30223f 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -786,7 +786,7 @@ static int acpi_idle_play_dead(struct cpuidle_device *dev, int index) | |||
786 | while (1) { | 786 | while (1) { |
787 | 787 | ||
788 | if (cx->entry_method == ACPI_CSTATE_HALT) | 788 | if (cx->entry_method == ACPI_CSTATE_HALT) |
789 | halt(); | 789 | safe_halt(); |
790 | else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) { | 790 | else if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) { |
791 | inb(cx->address); | 791 | inb(cx->address); |
792 | /* See comment in acpi_idle_do_entry() */ | 792 | /* See comment in acpi_idle_do_entry() */ |
diff --git a/drivers/acpi/reboot.c b/drivers/acpi/reboot.c index c1d612435939..a6c77e8b37bd 100644 --- a/drivers/acpi/reboot.c +++ b/drivers/acpi/reboot.c | |||
@@ -23,7 +23,8 @@ void acpi_reboot(void) | |||
23 | /* Is the reset register supported? The spec says we should be | 23 | /* Is the reset register supported? The spec says we should be |
24 | * checking the bit width and bit offset, but Windows ignores | 24 | * checking the bit width and bit offset, but Windows ignores |
25 | * these fields */ | 25 | * these fields */ |
26 | /* Ignore also acpi_gbl_FADT.flags.ACPI_FADT_RESET_REGISTER */ | 26 | if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER)) |
27 | return; | ||
27 | 28 | ||
28 | reset_value = acpi_gbl_FADT.reset_value; | 29 | reset_value = acpi_gbl_FADT.reset_value; |
29 | 30 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 767e2dcb9616..7417267e88fa 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -869,7 +869,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
869 | /* | 869 | /* |
870 | * Enumerate supported power management states | 870 | * Enumerate supported power management states |
871 | */ | 871 | */ |
872 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3; i++) { | 872 | for (i = ACPI_STATE_D0; i <= ACPI_STATE_D3_HOT; i++) { |
873 | struct acpi_device_power_state *ps = &device->power.states[i]; | 873 | struct acpi_device_power_state *ps = &device->power.states[i]; |
874 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; | 874 | char object_name[5] = { '_', 'P', 'R', '0' + i, '\0' }; |
875 | 875 | ||
@@ -884,21 +884,18 @@ static int acpi_bus_get_power_flags(struct acpi_device *device) | |||
884 | acpi_bus_add_power_resource(ps->resources.handles[j]); | 884 | acpi_bus_add_power_resource(ps->resources.handles[j]); |
885 | } | 885 | } |
886 | 886 | ||
887 | /* The exist of _PR3 indicates D3Cold support */ | ||
888 | if (i == ACPI_STATE_D3) { | ||
889 | status = acpi_get_handle(device->handle, object_name, &handle); | ||
890 | if (ACPI_SUCCESS(status)) | ||
891 | device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1; | ||
892 | } | ||
893 | |||
894 | /* Evaluate "_PSx" to see if we can do explicit sets */ | 887 | /* Evaluate "_PSx" to see if we can do explicit sets */ |
895 | object_name[2] = 'S'; | 888 | object_name[2] = 'S'; |
896 | status = acpi_get_handle(device->handle, object_name, &handle); | 889 | status = acpi_get_handle(device->handle, object_name, &handle); |
897 | if (ACPI_SUCCESS(status)) | 890 | if (ACPI_SUCCESS(status)) |
898 | ps->flags.explicit_set = 1; | 891 | ps->flags.explicit_set = 1; |
899 | 892 | ||
900 | /* State is valid if we have some power control */ | 893 | /* |
901 | if (ps->resources.count || ps->flags.explicit_set) | 894 | * State is valid if there are means to put the device into it. |
895 | * D3hot is only valid if _PR3 present. | ||
896 | */ | ||
897 | if (ps->resources.count || | ||
898 | (ps->flags.explicit_set && i < ACPI_STATE_D3_HOT)) | ||
902 | ps->flags.valid = 1; | 899 | ps->flags.valid = 1; |
903 | 900 | ||
904 | ps->power = -1; /* Unknown - driver assigned */ | 901 | ps->power = -1; /* Unknown - driver assigned */ |
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 1d661b5c3287..eb6fd233764b 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c | |||
@@ -28,23 +28,33 @@ | |||
28 | #include "internal.h" | 28 | #include "internal.h" |
29 | #include "sleep.h" | 29 | #include "sleep.h" |
30 | 30 | ||
31 | u8 wake_sleep_flags = ACPI_NO_OPTIONAL_METHODS; | ||
31 | static unsigned int gts, bfs; | 32 | static unsigned int gts, bfs; |
32 | module_param(gts, uint, 0644); | 33 | static int set_param_wake_flag(const char *val, struct kernel_param *kp) |
33 | module_param(bfs, uint, 0644); | ||
34 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
35 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
36 | |||
37 | static u8 wake_sleep_flags(void) | ||
38 | { | 34 | { |
39 | u8 flags = ACPI_NO_OPTIONAL_METHODS; | 35 | int ret = param_set_int(val, kp); |
40 | 36 | ||
41 | if (gts) | 37 | if (ret) |
42 | flags |= ACPI_EXECUTE_GTS; | 38 | return ret; |
43 | if (bfs) | ||
44 | flags |= ACPI_EXECUTE_BFS; | ||
45 | 39 | ||
46 | return flags; | 40 | if (kp->arg == (const char *)>s) { |
41 | if (gts) | ||
42 | wake_sleep_flags |= ACPI_EXECUTE_GTS; | ||
43 | else | ||
44 | wake_sleep_flags &= ~ACPI_EXECUTE_GTS; | ||
45 | } | ||
46 | if (kp->arg == (const char *)&bfs) { | ||
47 | if (bfs) | ||
48 | wake_sleep_flags |= ACPI_EXECUTE_BFS; | ||
49 | else | ||
50 | wake_sleep_flags &= ~ACPI_EXECUTE_BFS; | ||
51 | } | ||
52 | return ret; | ||
47 | } | 53 | } |
54 | module_param_call(gts, set_param_wake_flag, param_get_int, >s, 0644); | ||
55 | module_param_call(bfs, set_param_wake_flag, param_get_int, &bfs, 0644); | ||
56 | MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend."); | ||
57 | MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".); | ||
48 | 58 | ||
49 | static u8 sleep_states[ACPI_S_STATE_COUNT]; | 59 | static u8 sleep_states[ACPI_S_STATE_COUNT]; |
50 | 60 | ||
@@ -263,7 +273,6 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
263 | { | 273 | { |
264 | acpi_status status = AE_OK; | 274 | acpi_status status = AE_OK; |
265 | u32 acpi_state = acpi_target_sleep_state; | 275 | u32 acpi_state = acpi_target_sleep_state; |
266 | u8 flags = wake_sleep_flags(); | ||
267 | int error; | 276 | int error; |
268 | 277 | ||
269 | ACPI_FLUSH_CPU_CACHE(); | 278 | ACPI_FLUSH_CPU_CACHE(); |
@@ -271,7 +280,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
271 | switch (acpi_state) { | 280 | switch (acpi_state) { |
272 | case ACPI_STATE_S1: | 281 | case ACPI_STATE_S1: |
273 | barrier(); | 282 | barrier(); |
274 | status = acpi_enter_sleep_state(acpi_state, flags); | 283 | status = acpi_enter_sleep_state(acpi_state, wake_sleep_flags); |
275 | break; | 284 | break; |
276 | 285 | ||
277 | case ACPI_STATE_S3: | 286 | case ACPI_STATE_S3: |
@@ -286,7 +295,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) | |||
286 | acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); | 295 | acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1); |
287 | 296 | ||
288 | /* Reprogram control registers and execute _BFS */ | 297 | /* Reprogram control registers and execute _BFS */ |
289 | acpi_leave_sleep_state_prep(acpi_state, flags); | 298 | acpi_leave_sleep_state_prep(acpi_state, wake_sleep_flags); |
290 | 299 | ||
291 | /* ACPI 3.0 specs (P62) says that it's the responsibility | 300 | /* ACPI 3.0 specs (P62) says that it's the responsibility |
292 | * of the OSPM to clear the status bit [ implying that the | 301 | * of the OSPM to clear the status bit [ implying that the |
@@ -550,30 +559,27 @@ static int acpi_hibernation_begin(void) | |||
550 | 559 | ||
551 | static int acpi_hibernation_enter(void) | 560 | static int acpi_hibernation_enter(void) |
552 | { | 561 | { |
553 | u8 flags = wake_sleep_flags(); | ||
554 | acpi_status status = AE_OK; | 562 | acpi_status status = AE_OK; |
555 | 563 | ||
556 | ACPI_FLUSH_CPU_CACHE(); | 564 | ACPI_FLUSH_CPU_CACHE(); |
557 | 565 | ||
558 | /* This shouldn't return. If it returns, we have a problem */ | 566 | /* This shouldn't return. If it returns, we have a problem */ |
559 | status = acpi_enter_sleep_state(ACPI_STATE_S4, flags); | 567 | status = acpi_enter_sleep_state(ACPI_STATE_S4, wake_sleep_flags); |
560 | /* Reprogram control registers and execute _BFS */ | 568 | /* Reprogram control registers and execute _BFS */ |
561 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); | 569 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); |
562 | 570 | ||
563 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 571 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
564 | } | 572 | } |
565 | 573 | ||
566 | static void acpi_hibernation_leave(void) | 574 | static void acpi_hibernation_leave(void) |
567 | { | 575 | { |
568 | u8 flags = wake_sleep_flags(); | ||
569 | |||
570 | /* | 576 | /* |
571 | * If ACPI is not enabled by the BIOS and the boot kernel, we need to | 577 | * If ACPI is not enabled by the BIOS and the boot kernel, we need to |
572 | * enable it here. | 578 | * enable it here. |
573 | */ | 579 | */ |
574 | acpi_enable(); | 580 | acpi_enable(); |
575 | /* Reprogram control registers and execute _BFS */ | 581 | /* Reprogram control registers and execute _BFS */ |
576 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, flags); | 582 | acpi_leave_sleep_state_prep(ACPI_STATE_S4, wake_sleep_flags); |
577 | /* Check the hardware signature */ | 583 | /* Check the hardware signature */ |
578 | if (facs && s4_hardware_signature != facs->hardware_signature) { | 584 | if (facs && s4_hardware_signature != facs->hardware_signature) { |
579 | printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " | 585 | printk(KERN_EMERG "ACPI: Hardware changed while hibernated, " |
@@ -828,12 +834,10 @@ static void acpi_power_off_prepare(void) | |||
828 | 834 | ||
829 | static void acpi_power_off(void) | 835 | static void acpi_power_off(void) |
830 | { | 836 | { |
831 | u8 flags = wake_sleep_flags(); | ||
832 | |||
833 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ | 837 | /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */ |
834 | printk(KERN_DEBUG "%s called\n", __func__); | 838 | printk(KERN_DEBUG "%s called\n", __func__); |
835 | local_irq_disable(); | 839 | local_irq_disable(); |
836 | acpi_enter_sleep_state(ACPI_STATE_S5, flags); | 840 | acpi_enter_sleep_state(ACPI_STATE_S5, wake_sleep_flags); |
837 | } | 841 | } |
838 | 842 | ||
839 | /* | 843 | /* |
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 01c2cf4efcdd..cc273226dbd0 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
@@ -247,8 +247,7 @@ static int amba_pm_restore(struct device *dev) | |||
247 | /* | 247 | /* |
248 | * Hooks to provide runtime PM of the pclk (bus clock). It is safe to | 248 | * Hooks to provide runtime PM of the pclk (bus clock). It is safe to |
249 | * enable/disable the bus clock at runtime PM suspend/resume as this | 249 | * enable/disable the bus clock at runtime PM suspend/resume as this |
250 | * does not result in loss of context. However, disabling vcore power | 250 | * does not result in loss of context. |
251 | * would do, so we leave that to the driver. | ||
252 | */ | 251 | */ |
253 | static int amba_pm_runtime_suspend(struct device *dev) | 252 | static int amba_pm_runtime_suspend(struct device *dev) |
254 | { | 253 | { |
@@ -354,39 +353,6 @@ static void amba_put_disable_pclk(struct amba_device *pcdev) | |||
354 | clk_put(pclk); | 353 | clk_put(pclk); |
355 | } | 354 | } |
356 | 355 | ||
357 | static int amba_get_enable_vcore(struct amba_device *pcdev) | ||
358 | { | ||
359 | struct regulator *vcore = regulator_get(&pcdev->dev, "vcore"); | ||
360 | int ret; | ||
361 | |||
362 | pcdev->vcore = vcore; | ||
363 | |||
364 | if (IS_ERR(vcore)) { | ||
365 | /* It is OK not to supply a vcore regulator */ | ||
366 | if (PTR_ERR(vcore) == -ENODEV) | ||
367 | return 0; | ||
368 | return PTR_ERR(vcore); | ||
369 | } | ||
370 | |||
371 | ret = regulator_enable(vcore); | ||
372 | if (ret) { | ||
373 | regulator_put(vcore); | ||
374 | pcdev->vcore = ERR_PTR(-ENODEV); | ||
375 | } | ||
376 | |||
377 | return ret; | ||
378 | } | ||
379 | |||
380 | static void amba_put_disable_vcore(struct amba_device *pcdev) | ||
381 | { | ||
382 | struct regulator *vcore = pcdev->vcore; | ||
383 | |||
384 | if (!IS_ERR(vcore)) { | ||
385 | regulator_disable(vcore); | ||
386 | regulator_put(vcore); | ||
387 | } | ||
388 | } | ||
389 | |||
390 | /* | 356 | /* |
391 | * These are the device model conversion veneers; they convert the | 357 | * These are the device model conversion veneers; they convert the |
392 | * device model structures to our more specific structures. | 358 | * device model structures to our more specific structures. |
@@ -399,10 +365,6 @@ static int amba_probe(struct device *dev) | |||
399 | int ret; | 365 | int ret; |
400 | 366 | ||
401 | do { | 367 | do { |
402 | ret = amba_get_enable_vcore(pcdev); | ||
403 | if (ret) | ||
404 | break; | ||
405 | |||
406 | ret = amba_get_enable_pclk(pcdev); | 368 | ret = amba_get_enable_pclk(pcdev); |
407 | if (ret) | 369 | if (ret) |
408 | break; | 370 | break; |
@@ -420,7 +382,6 @@ static int amba_probe(struct device *dev) | |||
420 | pm_runtime_put_noidle(dev); | 382 | pm_runtime_put_noidle(dev); |
421 | 383 | ||
422 | amba_put_disable_pclk(pcdev); | 384 | amba_put_disable_pclk(pcdev); |
423 | amba_put_disable_vcore(pcdev); | ||
424 | } while (0); | 385 | } while (0); |
425 | 386 | ||
426 | return ret; | 387 | return ret; |
@@ -442,7 +403,6 @@ static int amba_remove(struct device *dev) | |||
442 | pm_runtime_put_noidle(dev); | 403 | pm_runtime_put_noidle(dev); |
443 | 404 | ||
444 | amba_put_disable_pclk(pcdev); | 405 | amba_put_disable_pclk(pcdev); |
445 | amba_put_disable_vcore(pcdev); | ||
446 | 406 | ||
447 | return ret; | 407 | return ret; |
448 | } | 408 | } |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 79a1e9dd56d9..ebaf67e4b2bc 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -394,6 +394,8 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
394 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ | 394 | .driver_data = board_ahci_yes_fbs }, /* 88se9128 */ |
395 | { PCI_DEVICE(0x1b4b, 0x9125), | 395 | { PCI_DEVICE(0x1b4b, 0x9125), |
396 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ | 396 | .driver_data = board_ahci_yes_fbs }, /* 88se9125 */ |
397 | { PCI_DEVICE(0x1b4b, 0x917a), | ||
398 | .driver_data = board_ahci_yes_fbs }, /* 88se9172 */ | ||
397 | { PCI_DEVICE(0x1b4b, 0x91a3), | 399 | { PCI_DEVICE(0x1b4b, 0x91a3), |
398 | .driver_data = board_ahci_yes_fbs }, | 400 | .driver_data = board_ahci_yes_fbs }, |
399 | 401 | ||
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 0c86c77764bc..9e419e1c2006 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c | |||
@@ -280,6 +280,7 @@ static struct dev_pm_ops ahci_pm_ops = { | |||
280 | 280 | ||
281 | static const struct of_device_id ahci_of_match[] = { | 281 | static const struct of_device_id ahci_of_match[] = { |
282 | { .compatible = "calxeda,hb-ahci", }, | 282 | { .compatible = "calxeda,hb-ahci", }, |
283 | { .compatible = "snps,spear-ahci", }, | ||
283 | {}, | 284 | {}, |
284 | }; | 285 | }; |
285 | MODULE_DEVICE_TABLE(of, ahci_of_match); | 286 | MODULE_DEVICE_TABLE(of, ahci_of_match); |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 68013f96729f..7857e8fd0a3e 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -329,6 +329,8 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
329 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 329 | { 0x8086, 0x8c08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
330 | /* SATA Controller IDE (Lynx Point) */ | 330 | /* SATA Controller IDE (Lynx Point) */ |
331 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | 331 | { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
332 | /* SATA Controller IDE (DH89xxCC) */ | ||
333 | { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, | ||
332 | { } /* terminate list */ | 334 | { } /* terminate list */ |
333 | }; | 335 | }; |
334 | 336 | ||
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index e0bda9ff89cd..23763a1ec570 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -95,7 +95,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev); | |||
95 | static void ata_dev_xfermask(struct ata_device *dev); | 95 | static void ata_dev_xfermask(struct ata_device *dev); |
96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); | 96 | static unsigned long ata_dev_blacklisted(const struct ata_device *dev); |
97 | 97 | ||
98 | unsigned int ata_print_id = 1; | 98 | atomic_t ata_print_id = ATOMIC_INIT(0); |
99 | 99 | ||
100 | struct ata_force_param { | 100 | struct ata_force_param { |
101 | const char *name; | 101 | const char *name; |
@@ -6029,7 +6029,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht) | |||
6029 | 6029 | ||
6030 | /* give ports names and add SCSI hosts */ | 6030 | /* give ports names and add SCSI hosts */ |
6031 | for (i = 0; i < host->n_ports; i++) | 6031 | for (i = 0; i < host->n_ports; i++) |
6032 | host->ports[i]->print_id = ata_print_id++; | 6032 | host->ports[i]->print_id = atomic_inc_return(&ata_print_id); |
6033 | 6033 | ||
6034 | 6034 | ||
6035 | /* Create associated sysfs transport objects */ | 6035 | /* Create associated sysfs transport objects */ |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c61316e9d2f7..d1fbd59ead16 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -3501,7 +3501,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg | |||
3501 | u64 now = get_jiffies_64(); | 3501 | u64 now = get_jiffies_64(); |
3502 | int *trials = void_arg; | 3502 | int *trials = void_arg; |
3503 | 3503 | ||
3504 | if (ent->timestamp < now - min(now, interval)) | 3504 | if ((ent->eflags & ATA_EFLAG_OLD_ER) || |
3505 | (ent->timestamp < now - min(now, interval))) | ||
3505 | return -1; | 3506 | return -1; |
3506 | 3507 | ||
3507 | (*trials)++; | 3508 | (*trials)++; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 1ee00c8b5b04..22226350cd0c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -3399,7 +3399,8 @@ int ata_scsi_add_hosts(struct ata_host *host, struct scsi_host_template *sht) | |||
3399 | */ | 3399 | */ |
3400 | shost->max_host_blocked = 1; | 3400 | shost->max_host_blocked = 1; |
3401 | 3401 | ||
3402 | rc = scsi_add_host(ap->scsi_host, &ap->tdev); | 3402 | rc = scsi_add_host_with_dma(ap->scsi_host, |
3403 | &ap->tdev, ap->host->dev); | ||
3403 | if (rc) | 3404 | if (rc) |
3404 | goto err_add; | 3405 | goto err_add; |
3405 | } | 3406 | } |
@@ -3838,18 +3839,25 @@ void ata_sas_port_stop(struct ata_port *ap) | |||
3838 | } | 3839 | } |
3839 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); | 3840 | EXPORT_SYMBOL_GPL(ata_sas_port_stop); |
3840 | 3841 | ||
3841 | int ata_sas_async_port_init(struct ata_port *ap) | 3842 | /** |
3843 | * ata_sas_async_probe - simply schedule probing and return | ||
3844 | * @ap: Port to probe | ||
3845 | * | ||
3846 | * For batch scheduling of probe for sas attached ata devices, assumes | ||
3847 | * the port has already been through ata_sas_port_init() | ||
3848 | */ | ||
3849 | void ata_sas_async_probe(struct ata_port *ap) | ||
3842 | { | 3850 | { |
3843 | int rc = ap->ops->port_start(ap); | 3851 | __ata_port_probe(ap); |
3844 | 3852 | } | |
3845 | if (!rc) { | 3853 | EXPORT_SYMBOL_GPL(ata_sas_async_probe); |
3846 | ap->print_id = ata_print_id++; | ||
3847 | __ata_port_probe(ap); | ||
3848 | } | ||
3849 | 3854 | ||
3850 | return rc; | 3855 | int ata_sas_sync_probe(struct ata_port *ap) |
3856 | { | ||
3857 | return ata_port_probe(ap); | ||
3851 | } | 3858 | } |
3852 | EXPORT_SYMBOL_GPL(ata_sas_async_port_init); | 3859 | EXPORT_SYMBOL_GPL(ata_sas_sync_probe); |
3860 | |||
3853 | 3861 | ||
3854 | /** | 3862 | /** |
3855 | * ata_sas_port_init - Initialize a SATA device | 3863 | * ata_sas_port_init - Initialize a SATA device |
@@ -3866,12 +3874,10 @@ int ata_sas_port_init(struct ata_port *ap) | |||
3866 | { | 3874 | { |
3867 | int rc = ap->ops->port_start(ap); | 3875 | int rc = ap->ops->port_start(ap); |
3868 | 3876 | ||
3869 | if (!rc) { | 3877 | if (rc) |
3870 | ap->print_id = ata_print_id++; | 3878 | return rc; |
3871 | rc = ata_port_probe(ap); | 3879 | ap->print_id = atomic_inc_return(&ata_print_id); |
3872 | } | 3880 | return 0; |
3873 | |||
3874 | return rc; | ||
3875 | } | 3881 | } |
3876 | EXPORT_SYMBOL_GPL(ata_sas_port_init); | 3882 | EXPORT_SYMBOL_GPL(ata_sas_port_init); |
3877 | 3883 | ||
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index 74aaee30e264..c34190485377 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c | |||
@@ -294,6 +294,7 @@ int ata_tport_add(struct device *parent, | |||
294 | device_enable_async_suspend(dev); | 294 | device_enable_async_suspend(dev); |
295 | pm_runtime_set_active(dev); | 295 | pm_runtime_set_active(dev); |
296 | pm_runtime_enable(dev); | 296 | pm_runtime_enable(dev); |
297 | pm_runtime_forbid(dev); | ||
297 | 298 | ||
298 | transport_add_device(dev); | 299 | transport_add_device(dev); |
299 | transport_configure_device(dev); | 300 | transport_configure_device(dev); |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 2e26fcaf635b..9d0fd0b71852 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -53,7 +53,7 @@ enum { | |||
53 | ATA_DNXFER_QUIET = (1 << 31), | 53 | ATA_DNXFER_QUIET = (1 << 31), |
54 | }; | 54 | }; |
55 | 55 | ||
56 | extern unsigned int ata_print_id; | 56 | extern atomic_t ata_print_id; |
57 | extern int atapi_passthru16; | 57 | extern int atapi_passthru16; |
58 | extern int libata_fua; | 58 | extern int libata_fua; |
59 | extern int libata_noacpi; | 59 | extern int libata_noacpi; |
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c index fc2db2a89a6b..3239517f4d90 100644 --- a/drivers/ata/pata_arasan_cf.c +++ b/drivers/ata/pata_arasan_cf.c | |||
@@ -943,9 +943,9 @@ static int arasan_cf_resume(struct device *dev) | |||
943 | 943 | ||
944 | return 0; | 944 | return 0; |
945 | } | 945 | } |
946 | #endif | ||
946 | 947 | ||
947 | static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); | 948 | static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume); |
948 | #endif | ||
949 | 949 | ||
950 | static struct platform_driver arasan_cf_driver = { | 950 | static struct platform_driver arasan_cf_driver = { |
951 | .probe = arasan_cf_probe, | 951 | .probe = arasan_cf_probe, |
@@ -953,9 +953,7 @@ static struct platform_driver arasan_cf_driver = { | |||
953 | .driver = { | 953 | .driver = { |
954 | .name = DRIVER_NAME, | 954 | .name = DRIVER_NAME, |
955 | .owner = THIS_MODULE, | 955 | .owner = THIS_MODULE, |
956 | #ifdef CONFIG_PM | ||
957 | .pm = &arasan_cf_pm_ops, | 956 | .pm = &arasan_cf_pm_ops, |
958 | #endif | ||
959 | }, | 957 | }, |
960 | }; | 958 | }; |
961 | 959 | ||
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 38950ea8398a..7336d4a7ab31 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -4025,7 +4025,8 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4025 | struct ata_host *host; | 4025 | struct ata_host *host; |
4026 | struct mv_host_priv *hpriv; | 4026 | struct mv_host_priv *hpriv; |
4027 | struct resource *res; | 4027 | struct resource *res; |
4028 | int n_ports, rc; | 4028 | int n_ports = 0; |
4029 | int rc; | ||
4029 | 4030 | ||
4030 | ata_print_version_once(&pdev->dev, DRV_VERSION); | 4031 | ata_print_version_once(&pdev->dev, DRV_VERSION); |
4031 | 4032 | ||
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 6c9387d646ec..5401814c874d 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -16,10 +16,11 @@ | |||
16 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
17 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
18 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
19 | #include <linux/kthread.h> | 19 | #include <linux/workqueue.h> |
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/firmware.h> | 21 | #include <linux/firmware.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/sched.h> | ||
23 | 24 | ||
24 | #define to_dev(obj) container_of(obj, struct device, kobj) | 25 | #define to_dev(obj) container_of(obj, struct device, kobj) |
25 | 26 | ||
@@ -81,6 +82,11 @@ enum { | |||
81 | 82 | ||
82 | static int loading_timeout = 60; /* In seconds */ | 83 | static int loading_timeout = 60; /* In seconds */ |
83 | 84 | ||
85 | static inline long firmware_loading_timeout(void) | ||
86 | { | ||
87 | return loading_timeout > 0 ? loading_timeout * HZ : MAX_SCHEDULE_TIMEOUT; | ||
88 | } | ||
89 | |||
84 | /* fw_lock could be moved to 'struct firmware_priv' but since it is just | 90 | /* fw_lock could be moved to 'struct firmware_priv' but since it is just |
85 | * guarding for corner cases a global lock should be OK */ | 91 | * guarding for corner cases a global lock should be OK */ |
86 | static DEFINE_MUTEX(fw_lock); | 92 | static DEFINE_MUTEX(fw_lock); |
@@ -440,13 +446,11 @@ fw_create_instance(struct firmware *firmware, const char *fw_name, | |||
440 | { | 446 | { |
441 | struct firmware_priv *fw_priv; | 447 | struct firmware_priv *fw_priv; |
442 | struct device *f_dev; | 448 | struct device *f_dev; |
443 | int error; | ||
444 | 449 | ||
445 | fw_priv = kzalloc(sizeof(*fw_priv) + strlen(fw_name) + 1 , GFP_KERNEL); | 450 | fw_priv = kzalloc(sizeof(*fw_priv) + strlen(fw_name) + 1 , GFP_KERNEL); |
446 | if (!fw_priv) { | 451 | if (!fw_priv) { |
447 | dev_err(device, "%s: kmalloc failed\n", __func__); | 452 | dev_err(device, "%s: kmalloc failed\n", __func__); |
448 | error = -ENOMEM; | 453 | return ERR_PTR(-ENOMEM); |
449 | goto err_out; | ||
450 | } | 454 | } |
451 | 455 | ||
452 | fw_priv->fw = firmware; | 456 | fw_priv->fw = firmware; |
@@ -463,98 +467,80 @@ fw_create_instance(struct firmware *firmware, const char *fw_name, | |||
463 | f_dev->parent = device; | 467 | f_dev->parent = device; |
464 | f_dev->class = &firmware_class; | 468 | f_dev->class = &firmware_class; |
465 | 469 | ||
466 | dev_set_uevent_suppress(f_dev, true); | ||
467 | |||
468 | /* Need to pin this module until class device is destroyed */ | ||
469 | __module_get(THIS_MODULE); | ||
470 | |||
471 | error = device_add(f_dev); | ||
472 | if (error) { | ||
473 | dev_err(device, "%s: device_register failed\n", __func__); | ||
474 | goto err_put_dev; | ||
475 | } | ||
476 | |||
477 | error = device_create_bin_file(f_dev, &firmware_attr_data); | ||
478 | if (error) { | ||
479 | dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); | ||
480 | goto err_del_dev; | ||
481 | } | ||
482 | |||
483 | error = device_create_file(f_dev, &dev_attr_loading); | ||
484 | if (error) { | ||
485 | dev_err(device, "%s: device_create_file failed\n", __func__); | ||
486 | goto err_del_bin_attr; | ||
487 | } | ||
488 | |||
489 | if (uevent) | ||
490 | dev_set_uevent_suppress(f_dev, false); | ||
491 | |||
492 | return fw_priv; | 470 | return fw_priv; |
493 | |||
494 | err_del_bin_attr: | ||
495 | device_remove_bin_file(f_dev, &firmware_attr_data); | ||
496 | err_del_dev: | ||
497 | device_del(f_dev); | ||
498 | err_put_dev: | ||
499 | put_device(f_dev); | ||
500 | err_out: | ||
501 | return ERR_PTR(error); | ||
502 | } | 471 | } |
503 | 472 | ||
504 | static void fw_destroy_instance(struct firmware_priv *fw_priv) | 473 | static struct firmware_priv * |
505 | { | 474 | _request_firmware_prepare(const struct firmware **firmware_p, const char *name, |
506 | struct device *f_dev = &fw_priv->dev; | 475 | struct device *device, bool uevent, bool nowait) |
507 | |||
508 | device_remove_file(f_dev, &dev_attr_loading); | ||
509 | device_remove_bin_file(f_dev, &firmware_attr_data); | ||
510 | device_unregister(f_dev); | ||
511 | } | ||
512 | |||
513 | static int _request_firmware(const struct firmware **firmware_p, | ||
514 | const char *name, struct device *device, | ||
515 | bool uevent, bool nowait) | ||
516 | { | 476 | { |
517 | struct firmware_priv *fw_priv; | ||
518 | struct firmware *firmware; | 477 | struct firmware *firmware; |
519 | int retval = 0; | 478 | struct firmware_priv *fw_priv; |
520 | 479 | ||
521 | if (!firmware_p) | 480 | if (!firmware_p) |
522 | return -EINVAL; | 481 | return ERR_PTR(-EINVAL); |
523 | 482 | ||
524 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); | 483 | *firmware_p = firmware = kzalloc(sizeof(*firmware), GFP_KERNEL); |
525 | if (!firmware) { | 484 | if (!firmware) { |
526 | dev_err(device, "%s: kmalloc(struct firmware) failed\n", | 485 | dev_err(device, "%s: kmalloc(struct firmware) failed\n", |
527 | __func__); | 486 | __func__); |
528 | return -ENOMEM; | 487 | return ERR_PTR(-ENOMEM); |
529 | } | 488 | } |
530 | 489 | ||
531 | if (fw_get_builtin_firmware(firmware, name)) { | 490 | if (fw_get_builtin_firmware(firmware, name)) { |
532 | dev_dbg(device, "firmware: using built-in firmware %s\n", name); | 491 | dev_dbg(device, "firmware: using built-in firmware %s\n", name); |
533 | return 0; | 492 | return NULL; |
493 | } | ||
494 | |||
495 | fw_priv = fw_create_instance(firmware, name, device, uevent, nowait); | ||
496 | if (IS_ERR(fw_priv)) { | ||
497 | release_firmware(firmware); | ||
498 | *firmware_p = NULL; | ||
534 | } | 499 | } |
500 | return fw_priv; | ||
501 | } | ||
535 | 502 | ||
536 | read_lock_usermodehelper(); | 503 | static void _request_firmware_cleanup(const struct firmware **firmware_p) |
504 | { | ||
505 | release_firmware(*firmware_p); | ||
506 | *firmware_p = NULL; | ||
507 | } | ||
537 | 508 | ||
538 | if (WARN_ON(usermodehelper_is_disabled())) { | 509 | static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent, |
539 | dev_err(device, "firmware: %s will not be loaded\n", name); | 510 | long timeout) |
540 | retval = -EBUSY; | 511 | { |
541 | goto out; | 512 | int retval = 0; |
513 | struct device *f_dev = &fw_priv->dev; | ||
514 | |||
515 | dev_set_uevent_suppress(f_dev, true); | ||
516 | |||
517 | /* Need to pin this module until class device is destroyed */ | ||
518 | __module_get(THIS_MODULE); | ||
519 | |||
520 | retval = device_add(f_dev); | ||
521 | if (retval) { | ||
522 | dev_err(f_dev, "%s: device_register failed\n", __func__); | ||
523 | goto err_put_dev; | ||
542 | } | 524 | } |
543 | 525 | ||
544 | if (uevent) | 526 | retval = device_create_bin_file(f_dev, &firmware_attr_data); |
545 | dev_dbg(device, "firmware: requesting %s\n", name); | 527 | if (retval) { |
528 | dev_err(f_dev, "%s: sysfs_create_bin_file failed\n", __func__); | ||
529 | goto err_del_dev; | ||
530 | } | ||
546 | 531 | ||
547 | fw_priv = fw_create_instance(firmware, name, device, uevent, nowait); | 532 | retval = device_create_file(f_dev, &dev_attr_loading); |
548 | if (IS_ERR(fw_priv)) { | 533 | if (retval) { |
549 | retval = PTR_ERR(fw_priv); | 534 | dev_err(f_dev, "%s: device_create_file failed\n", __func__); |
550 | goto out; | 535 | goto err_del_bin_attr; |
551 | } | 536 | } |
552 | 537 | ||
553 | if (uevent) { | 538 | if (uevent) { |
554 | if (loading_timeout > 0) | 539 | dev_set_uevent_suppress(f_dev, false); |
540 | dev_dbg(f_dev, "firmware: requesting %s\n", fw_priv->fw_id); | ||
541 | if (timeout != MAX_SCHEDULE_TIMEOUT) | ||
555 | mod_timer(&fw_priv->timeout, | 542 | mod_timer(&fw_priv->timeout, |
556 | round_jiffies_up(jiffies + | 543 | round_jiffies_up(jiffies + timeout)); |
557 | loading_timeout * HZ)); | ||
558 | 544 | ||
559 | kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); | 545 | kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); |
560 | } | 546 | } |
@@ -570,16 +556,13 @@ static int _request_firmware(const struct firmware **firmware_p, | |||
570 | fw_priv->fw = NULL; | 556 | fw_priv->fw = NULL; |
571 | mutex_unlock(&fw_lock); | 557 | mutex_unlock(&fw_lock); |
572 | 558 | ||
573 | fw_destroy_instance(fw_priv); | 559 | device_remove_file(f_dev, &dev_attr_loading); |
574 | 560 | err_del_bin_attr: | |
575 | out: | 561 | device_remove_bin_file(f_dev, &firmware_attr_data); |
576 | read_unlock_usermodehelper(); | 562 | err_del_dev: |
577 | 563 | device_del(f_dev); | |
578 | if (retval) { | 564 | err_put_dev: |
579 | release_firmware(firmware); | 565 | put_device(f_dev); |
580 | *firmware_p = NULL; | ||
581 | } | ||
582 | |||
583 | return retval; | 566 | return retval; |
584 | } | 567 | } |
585 | 568 | ||
@@ -602,7 +585,26 @@ int | |||
602 | request_firmware(const struct firmware **firmware_p, const char *name, | 585 | request_firmware(const struct firmware **firmware_p, const char *name, |
603 | struct device *device) | 586 | struct device *device) |
604 | { | 587 | { |
605 | return _request_firmware(firmware_p, name, device, true, false); | 588 | struct firmware_priv *fw_priv; |
589 | int ret; | ||
590 | |||
591 | fw_priv = _request_firmware_prepare(firmware_p, name, device, true, | ||
592 | false); | ||
593 | if (IS_ERR_OR_NULL(fw_priv)) | ||
594 | return PTR_RET(fw_priv); | ||
595 | |||
596 | ret = usermodehelper_read_trylock(); | ||
597 | if (WARN_ON(ret)) { | ||
598 | dev_err(device, "firmware: %s will not be loaded\n", name); | ||
599 | } else { | ||
600 | ret = _request_firmware_load(fw_priv, true, | ||
601 | firmware_loading_timeout()); | ||
602 | usermodehelper_read_unlock(); | ||
603 | } | ||
604 | if (ret) | ||
605 | _request_firmware_cleanup(firmware_p); | ||
606 | |||
607 | return ret; | ||
606 | } | 608 | } |
607 | 609 | ||
608 | /** | 610 | /** |
@@ -629,25 +631,39 @@ struct firmware_work { | |||
629 | bool uevent; | 631 | bool uevent; |
630 | }; | 632 | }; |
631 | 633 | ||
632 | static int request_firmware_work_func(void *arg) | 634 | static void request_firmware_work_func(struct work_struct *work) |
633 | { | 635 | { |
634 | struct firmware_work *fw_work = arg; | 636 | struct firmware_work *fw_work; |
635 | const struct firmware *fw; | 637 | const struct firmware *fw; |
638 | struct firmware_priv *fw_priv; | ||
639 | long timeout; | ||
636 | int ret; | 640 | int ret; |
637 | 641 | ||
638 | if (!arg) { | 642 | fw_work = container_of(work, struct firmware_work, work); |
639 | WARN_ON(1); | 643 | fw_priv = _request_firmware_prepare(&fw, fw_work->name, fw_work->device, |
640 | return 0; | 644 | fw_work->uevent, true); |
645 | if (IS_ERR_OR_NULL(fw_priv)) { | ||
646 | ret = PTR_RET(fw_priv); | ||
647 | goto out; | ||
648 | } | ||
649 | |||
650 | timeout = usermodehelper_read_lock_wait(firmware_loading_timeout()); | ||
651 | if (timeout) { | ||
652 | ret = _request_firmware_load(fw_priv, fw_work->uevent, timeout); | ||
653 | usermodehelper_read_unlock(); | ||
654 | } else { | ||
655 | dev_dbg(fw_work->device, "firmware: %s loading timed out\n", | ||
656 | fw_work->name); | ||
657 | ret = -EAGAIN; | ||
641 | } | 658 | } |
659 | if (ret) | ||
660 | _request_firmware_cleanup(&fw); | ||
642 | 661 | ||
643 | ret = _request_firmware(&fw, fw_work->name, fw_work->device, | 662 | out: |
644 | fw_work->uevent, true); | ||
645 | fw_work->cont(fw, fw_work->context); | 663 | fw_work->cont(fw, fw_work->context); |
646 | 664 | ||
647 | module_put(fw_work->module); | 665 | module_put(fw_work->module); |
648 | kfree(fw_work); | 666 | kfree(fw_work); |
649 | |||
650 | return ret; | ||
651 | } | 667 | } |
652 | 668 | ||
653 | /** | 669 | /** |
@@ -673,7 +689,6 @@ request_firmware_nowait( | |||
673 | const char *name, struct device *device, gfp_t gfp, void *context, | 689 | const char *name, struct device *device, gfp_t gfp, void *context, |
674 | void (*cont)(const struct firmware *fw, void *context)) | 690 | void (*cont)(const struct firmware *fw, void *context)) |
675 | { | 691 | { |
676 | struct task_struct *task; | ||
677 | struct firmware_work *fw_work; | 692 | struct firmware_work *fw_work; |
678 | 693 | ||
679 | fw_work = kzalloc(sizeof (struct firmware_work), gfp); | 694 | fw_work = kzalloc(sizeof (struct firmware_work), gfp); |
@@ -692,15 +707,8 @@ request_firmware_nowait( | |||
692 | return -EFAULT; | 707 | return -EFAULT; |
693 | } | 708 | } |
694 | 709 | ||
695 | task = kthread_run(request_firmware_work_func, fw_work, | 710 | INIT_WORK(&fw_work->work, request_firmware_work_func); |
696 | "firmware/%s", name); | 711 | schedule_work(&fw_work->work); |
697 | if (IS_ERR(task)) { | ||
698 | fw_work->cont(NULL, fw_work->context); | ||
699 | module_put(fw_work->module); | ||
700 | kfree(fw_work); | ||
701 | return PTR_ERR(task); | ||
702 | } | ||
703 | |||
704 | return 0; | 712 | return 0; |
705 | } | 713 | } |
706 | 714 | ||
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 541f821d4ea6..bd0f3949bcf9 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c | |||
@@ -532,6 +532,8 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
532 | dev->power.suspend_time = ktime_set(0, 0); | 532 | dev->power.suspend_time = ktime_set(0, 0); |
533 | dev->power.max_time_suspended_ns = -1; | 533 | dev->power.max_time_suspended_ns = -1; |
534 | dev->power.deferred_resume = false; | 534 | dev->power.deferred_resume = false; |
535 | wake_up_all(&dev->power.wait_queue); | ||
536 | |||
535 | if (retval == -EAGAIN || retval == -EBUSY) { | 537 | if (retval == -EAGAIN || retval == -EBUSY) { |
536 | dev->power.runtime_error = 0; | 538 | dev->power.runtime_error = 0; |
537 | 539 | ||
@@ -547,7 +549,6 @@ static int rpm_suspend(struct device *dev, int rpmflags) | |||
547 | } else { | 549 | } else { |
548 | pm_runtime_cancel_pending(dev); | 550 | pm_runtime_cancel_pending(dev); |
549 | } | 551 | } |
550 | wake_up_all(&dev->power.wait_queue); | ||
551 | goto out; | 552 | goto out; |
552 | } | 553 | } |
553 | 554 | ||
diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c index 5157fa04c2f0..92b779ee002b 100644 --- a/drivers/base/regmap/regcache-rbtree.c +++ b/drivers/base/regmap/regcache-rbtree.c | |||
@@ -138,6 +138,7 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
138 | unsigned int base, top; | 138 | unsigned int base, top; |
139 | int nodes = 0; | 139 | int nodes = 0; |
140 | int registers = 0; | 140 | int registers = 0; |
141 | int average; | ||
141 | 142 | ||
142 | mutex_lock(&map->lock); | 143 | mutex_lock(&map->lock); |
143 | 144 | ||
@@ -152,8 +153,13 @@ static int rbtree_show(struct seq_file *s, void *ignored) | |||
152 | registers += top - base + 1; | 153 | registers += top - base + 1; |
153 | } | 154 | } |
154 | 155 | ||
156 | if (nodes) | ||
157 | average = registers / nodes; | ||
158 | else | ||
159 | average = 0; | ||
160 | |||
155 | seq_printf(s, "%d nodes, %d registers, average %d registers\n", | 161 | seq_printf(s, "%d nodes, %d registers, average %d registers\n", |
156 | nodes, registers, registers / nodes); | 162 | nodes, registers, average); |
157 | 163 | ||
158 | mutex_unlock(&map->lock); | 164 | mutex_unlock(&map->lock); |
159 | 165 | ||
@@ -396,7 +402,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, | |||
396 | map->cache_word_size); | 402 | map->cache_word_size); |
397 | 403 | ||
398 | /* Is this the hardware default? If so skip. */ | 404 | /* Is this the hardware default? If so skip. */ |
399 | ret = regcache_lookup_reg(map, i); | 405 | ret = regcache_lookup_reg(map, regtmp); |
400 | if (ret >= 0 && val == map->reg_defaults[ret].def) | 406 | if (ret >= 0 && val == map->reg_defaults[ret].def) |
401 | continue; | 407 | continue; |
402 | 408 | ||
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 87f54dbf601b..74b69095def6 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
@@ -346,6 +346,7 @@ out: | |||
346 | 346 | ||
347 | return ret; | 347 | return ret; |
348 | } | 348 | } |
349 | EXPORT_SYMBOL_GPL(regcache_sync_region); | ||
349 | 350 | ||
350 | /** | 351 | /** |
351 | * regcache_cache_only: Put a register map into cache only mode | 352 | * regcache_cache_only: Put a register map into cache only mode |
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index 58517a5dac13..251eb70f83e7 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -27,12 +27,6 @@ static size_t regmap_calc_reg_len(int max_val, char *buf, size_t buf_size) | |||
27 | return strlen(buf); | 27 | return strlen(buf); |
28 | } | 28 | } |
29 | 29 | ||
30 | static int regmap_open_file(struct inode *inode, struct file *file) | ||
31 | { | ||
32 | file->private_data = inode->i_private; | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | static ssize_t regmap_name_read_file(struct file *file, | 30 | static ssize_t regmap_name_read_file(struct file *file, |
37 | char __user *user_buf, size_t count, | 31 | char __user *user_buf, size_t count, |
38 | loff_t *ppos) | 32 | loff_t *ppos) |
@@ -57,7 +51,7 @@ static ssize_t regmap_name_read_file(struct file *file, | |||
57 | } | 51 | } |
58 | 52 | ||
59 | static const struct file_operations regmap_name_fops = { | 53 | static const struct file_operations regmap_name_fops = { |
60 | .open = regmap_open_file, | 54 | .open = simple_open, |
61 | .read = regmap_name_read_file, | 55 | .read = regmap_name_read_file, |
62 | .llseek = default_llseek, | 56 | .llseek = default_llseek, |
63 | }; | 57 | }; |
@@ -174,7 +168,7 @@ static ssize_t regmap_map_write_file(struct file *file, | |||
174 | #endif | 168 | #endif |
175 | 169 | ||
176 | static const struct file_operations regmap_map_fops = { | 170 | static const struct file_operations regmap_map_fops = { |
177 | .open = regmap_open_file, | 171 | .open = simple_open, |
178 | .read = regmap_map_read_file, | 172 | .read = regmap_map_read_file, |
179 | .write = regmap_map_write_file, | 173 | .write = regmap_map_write_file, |
180 | .llseek = default_llseek, | 174 | .llseek = default_llseek, |
@@ -243,7 +237,7 @@ out: | |||
243 | } | 237 | } |
244 | 238 | ||
245 | static const struct file_operations regmap_access_fops = { | 239 | static const struct file_operations regmap_access_fops = { |
246 | .open = regmap_open_file, | 240 | .open = simple_open, |
247 | .read = regmap_access_read_file, | 241 | .read = regmap_access_read_file, |
248 | .llseek = default_llseek, | 242 | .llseek = default_llseek, |
249 | }; | 243 | }; |
diff --git a/drivers/base/soc.c b/drivers/base/soc.c index 05f150382da8..ba29b2e73d48 100644 --- a/drivers/base/soc.c +++ b/drivers/base/soc.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/sys_soc.h> | 15 | #include <linux/sys_soc.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | 17 | ||
18 | static DEFINE_IDR(soc_ida); | 18 | static DEFINE_IDA(soc_ida); |
19 | static DEFINE_SPINLOCK(soc_lock); | 19 | static DEFINE_SPINLOCK(soc_lock); |
20 | 20 | ||
21 | static ssize_t soc_info_get(struct device *dev, | 21 | static ssize_t soc_info_get(struct device *dev, |
@@ -168,8 +168,6 @@ void soc_device_unregister(struct soc_device *soc_dev) | |||
168 | 168 | ||
169 | static int __init soc_bus_register(void) | 169 | static int __init soc_bus_register(void) |
170 | { | 170 | { |
171 | spin_lock_init(&soc_lock); | ||
172 | |||
173 | return bus_register(&soc_bus_type); | 171 | return bus_register(&soc_bus_type); |
174 | } | 172 | } |
175 | core_initcall(soc_bus_register); | 173 | core_initcall(soc_bus_register); |
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig index c1172dafdffa..fb7c80fb721e 100644 --- a/drivers/bcma/Kconfig +++ b/drivers/bcma/Kconfig | |||
@@ -29,7 +29,7 @@ config BCMA_HOST_PCI | |||
29 | 29 | ||
30 | config BCMA_DRIVER_PCI_HOSTMODE | 30 | config BCMA_DRIVER_PCI_HOSTMODE |
31 | bool "Driver for PCI core working in hostmode" | 31 | bool "Driver for PCI core working in hostmode" |
32 | depends on BCMA && MIPS | 32 | depends on BCMA && MIPS && BCMA_HOST_PCI |
33 | help | 33 | help |
34 | PCI core hostmode operation (external PCI bus). | 34 | PCI core hostmode operation (external PCI bus). |
35 | 35 | ||
diff --git a/drivers/bcma/driver_pci_host.c b/drivers/bcma/driver_pci_host.c index 4e20bcfa7ec5..d2097a11c3c7 100644 --- a/drivers/bcma/driver_pci_host.c +++ b/drivers/bcma/driver_pci_host.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "bcma_private.h" | 12 | #include "bcma_private.h" |
13 | #include <linux/pci.h> | ||
13 | #include <linux/export.h> | 14 | #include <linux/export.h> |
14 | #include <linux/bcma/bcma.h> | 15 | #include <linux/bcma/bcma.h> |
15 | #include <asm/paccess.h> | 16 | #include <asm/paccess.h> |
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index cdcf75c0954f..3e2a6002aae6 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c | |||
@@ -404,16 +404,19 @@ int bcma_sprom_get(struct bcma_bus *bus) | |||
404 | return -EOPNOTSUPP; | 404 | return -EOPNOTSUPP; |
405 | 405 | ||
406 | if (!bcma_sprom_ext_available(bus)) { | 406 | if (!bcma_sprom_ext_available(bus)) { |
407 | bool sprom_onchip; | ||
408 | |||
407 | /* | 409 | /* |
408 | * External SPROM takes precedence so check | 410 | * External SPROM takes precedence so check |
409 | * on-chip OTP only when no external SPROM | 411 | * on-chip OTP only when no external SPROM |
410 | * is present. | 412 | * is present. |
411 | */ | 413 | */ |
412 | if (bcma_sprom_onchip_available(bus)) { | 414 | sprom_onchip = bcma_sprom_onchip_available(bus); |
415 | if (sprom_onchip) { | ||
413 | /* determine offset */ | 416 | /* determine offset */ |
414 | offset = bcma_sprom_onchip_offset(bus); | 417 | offset = bcma_sprom_onchip_offset(bus); |
415 | } | 418 | } |
416 | if (!offset) { | 419 | if (!offset || !sprom_onchip) { |
417 | /* | 420 | /* |
418 | * Maybe there is no SPROM on the device? | 421 | * Maybe there is no SPROM on the device? |
419 | * Now we ask the arch code if there is some sprom | 422 | * Now we ask the arch code if there is some sprom |
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index e820b68d2f6c..acda773b3720 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -866,6 +866,7 @@ cciss_scsi_detect(ctlr_info_t *h) | |||
866 | sh->can_queue = cciss_tape_cmds; | 866 | sh->can_queue = cciss_tape_cmds; |
867 | sh->sg_tablesize = h->maxsgentries; | 867 | sh->sg_tablesize = h->maxsgentries; |
868 | sh->max_cmd_len = MAX_COMMAND_SIZE; | 868 | sh->max_cmd_len = MAX_COMMAND_SIZE; |
869 | sh->max_sectors = h->cciss_max_sectors; | ||
869 | 870 | ||
870 | ((struct cciss_scsi_adapter_data_t *) | 871 | ((struct cciss_scsi_adapter_data_t *) |
871 | h->scsi_ctlr)->scsi_host = sh; | 872 | h->scsi_ctlr)->scsi_host = sh; |
@@ -1410,7 +1411,7 @@ static void cciss_scatter_gather(ctlr_info_t *h, CommandList_struct *c, | |||
1410 | /* track how many SG entries we are using */ | 1411 | /* track how many SG entries we are using */ |
1411 | if (request_nsgs > h->maxSG) | 1412 | if (request_nsgs > h->maxSG) |
1412 | h->maxSG = request_nsgs; | 1413 | h->maxSG = request_nsgs; |
1413 | c->Header.SGTotal = (__u8) request_nsgs + chained; | 1414 | c->Header.SGTotal = (u16) request_nsgs + chained; |
1414 | if (request_nsgs > h->max_cmd_sgentries) | 1415 | if (request_nsgs > h->max_cmd_sgentries) |
1415 | c->Header.SGList = h->max_cmd_sgentries; | 1416 | c->Header.SGList = h->max_cmd_sgentries; |
1416 | else | 1417 | else |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 76a08236430a..b0b00d70c166 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -1030,37 +1030,6 @@ static int fd_wait_for_completion(unsigned long delay, timeout_fn function) | |||
1030 | return 0; | 1030 | return 0; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static DEFINE_SPINLOCK(floppy_hlt_lock); | ||
1034 | static int hlt_disabled; | ||
1035 | static void floppy_disable_hlt(void) | ||
1036 | { | ||
1037 | unsigned long flags; | ||
1038 | |||
1039 | WARN_ONCE(1, "floppy_disable_hlt() scheduled for removal in 2012"); | ||
1040 | spin_lock_irqsave(&floppy_hlt_lock, flags); | ||
1041 | if (!hlt_disabled) { | ||
1042 | hlt_disabled = 1; | ||
1043 | #ifdef HAVE_DISABLE_HLT | ||
1044 | disable_hlt(); | ||
1045 | #endif | ||
1046 | } | ||
1047 | spin_unlock_irqrestore(&floppy_hlt_lock, flags); | ||
1048 | } | ||
1049 | |||
1050 | static void floppy_enable_hlt(void) | ||
1051 | { | ||
1052 | unsigned long flags; | ||
1053 | |||
1054 | spin_lock_irqsave(&floppy_hlt_lock, flags); | ||
1055 | if (hlt_disabled) { | ||
1056 | hlt_disabled = 0; | ||
1057 | #ifdef HAVE_DISABLE_HLT | ||
1058 | enable_hlt(); | ||
1059 | #endif | ||
1060 | } | ||
1061 | spin_unlock_irqrestore(&floppy_hlt_lock, flags); | ||
1062 | } | ||
1063 | |||
1064 | static void setup_DMA(void) | 1033 | static void setup_DMA(void) |
1065 | { | 1034 | { |
1066 | unsigned long f; | 1035 | unsigned long f; |
@@ -1105,7 +1074,6 @@ static void setup_DMA(void) | |||
1105 | fd_enable_dma(); | 1074 | fd_enable_dma(); |
1106 | release_dma_lock(f); | 1075 | release_dma_lock(f); |
1107 | #endif | 1076 | #endif |
1108 | floppy_disable_hlt(); | ||
1109 | } | 1077 | } |
1110 | 1078 | ||
1111 | static void show_floppy(void); | 1079 | static void show_floppy(void); |
@@ -1707,7 +1675,6 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id) | |||
1707 | fd_disable_dma(); | 1675 | fd_disable_dma(); |
1708 | release_dma_lock(f); | 1676 | release_dma_lock(f); |
1709 | 1677 | ||
1710 | floppy_enable_hlt(); | ||
1711 | do_floppy = NULL; | 1678 | do_floppy = NULL; |
1712 | if (fdc >= N_FDC || FDCS->address == -1) { | 1679 | if (fdc >= N_FDC || FDCS->address == -1) { |
1713 | /* we don't even know which FDC is the culprit */ | 1680 | /* we don't even know which FDC is the culprit */ |
@@ -1856,8 +1823,6 @@ static void floppy_shutdown(unsigned long data) | |||
1856 | show_floppy(); | 1823 | show_floppy(); |
1857 | cancel_activity(); | 1824 | cancel_activity(); |
1858 | 1825 | ||
1859 | floppy_enable_hlt(); | ||
1860 | |||
1861 | flags = claim_dma_lock(); | 1826 | flags = claim_dma_lock(); |
1862 | fd_disable_dma(); | 1827 | fd_disable_dma(); |
1863 | release_dma_lock(flags); | 1828 | release_dma_lock(flags); |
@@ -4508,7 +4473,6 @@ static void floppy_release_irq_and_dma(void) | |||
4508 | #if N_FDC > 1 | 4473 | #if N_FDC > 1 |
4509 | set_dor(1, ~8, 0); | 4474 | set_dor(1, ~8, 0); |
4510 | #endif | 4475 | #endif |
4511 | floppy_enable_hlt(); | ||
4512 | 4476 | ||
4513 | if (floppy_track_buffer && max_buffer_sectors) { | 4477 | if (floppy_track_buffer && max_buffer_sectors) { |
4514 | tmpsize = max_buffer_sectors * 1024; | 4478 | tmpsize = max_buffer_sectors * 1024; |
diff --git a/drivers/block/mtip32xx/Kconfig b/drivers/block/mtip32xx/Kconfig index b5dd14e072f2..0ba837fc62a8 100644 --- a/drivers/block/mtip32xx/Kconfig +++ b/drivers/block/mtip32xx/Kconfig | |||
@@ -4,6 +4,6 @@ | |||
4 | 4 | ||
5 | config BLK_DEV_PCIESSD_MTIP32XX | 5 | config BLK_DEV_PCIESSD_MTIP32XX |
6 | tristate "Block Device Driver for Micron PCIe SSDs" | 6 | tristate "Block Device Driver for Micron PCIe SSDs" |
7 | depends on HOTPLUG_PCI_PCIE | 7 | depends on PCI |
8 | help | 8 | help |
9 | This enables the block driver for Micron PCIe SSDs. | 9 | This enables the block driver for Micron PCIe SSDs. |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index 8eb81c96608f..00f9fc992090 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/idr.h> | 36 | #include <linux/idr.h> |
37 | #include <linux/kthread.h> | 37 | #include <linux/kthread.h> |
38 | #include <../drivers/ata/ahci.h> | 38 | #include <../drivers/ata/ahci.h> |
39 | #include <linux/export.h> | ||
39 | #include "mtip32xx.h" | 40 | #include "mtip32xx.h" |
40 | 41 | ||
41 | #define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) | 42 | #define HW_CMD_SLOT_SZ (MTIP_MAX_COMMAND_SLOTS * 32) |
@@ -44,6 +45,7 @@ | |||
44 | #define HW_PORT_PRIV_DMA_SZ \ | 45 | #define HW_PORT_PRIV_DMA_SZ \ |
45 | (HW_CMD_SLOT_SZ + HW_CMD_TBL_AR_SZ + AHCI_RX_FIS_SZ) | 46 | (HW_CMD_SLOT_SZ + HW_CMD_TBL_AR_SZ + AHCI_RX_FIS_SZ) |
46 | 47 | ||
48 | #define HOST_CAP_NZDMA (1 << 19) | ||
47 | #define HOST_HSORG 0xFC | 49 | #define HOST_HSORG 0xFC |
48 | #define HSORG_DISABLE_SLOTGRP_INTR (1<<24) | 50 | #define HSORG_DISABLE_SLOTGRP_INTR (1<<24) |
49 | #define HSORG_DISABLE_SLOTGRP_PXIS (1<<16) | 51 | #define HSORG_DISABLE_SLOTGRP_PXIS (1<<16) |
@@ -139,6 +141,12 @@ static void mtip_command_cleanup(struct driver_data *dd) | |||
139 | int group = 0, commandslot = 0, commandindex = 0; | 141 | int group = 0, commandslot = 0, commandindex = 0; |
140 | struct mtip_cmd *command; | 142 | struct mtip_cmd *command; |
141 | struct mtip_port *port = dd->port; | 143 | struct mtip_port *port = dd->port; |
144 | static int in_progress; | ||
145 | |||
146 | if (in_progress) | ||
147 | return; | ||
148 | |||
149 | in_progress = 1; | ||
142 | 150 | ||
143 | for (group = 0; group < 4; group++) { | 151 | for (group = 0; group < 4; group++) { |
144 | for (commandslot = 0; commandslot < 32; commandslot++) { | 152 | for (commandslot = 0; commandslot < 32; commandslot++) { |
@@ -165,7 +173,8 @@ static void mtip_command_cleanup(struct driver_data *dd) | |||
165 | 173 | ||
166 | up(&port->cmd_slot); | 174 | up(&port->cmd_slot); |
167 | 175 | ||
168 | atomic_set(&dd->drv_cleanup_done, true); | 176 | set_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag); |
177 | in_progress = 0; | ||
169 | } | 178 | } |
170 | 179 | ||
171 | /* | 180 | /* |
@@ -262,6 +271,9 @@ static int hba_reset_nosleep(struct driver_data *dd) | |||
262 | && time_before(jiffies, timeout)) | 271 | && time_before(jiffies, timeout)) |
263 | mdelay(1); | 272 | mdelay(1); |
264 | 273 | ||
274 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) | ||
275 | return -1; | ||
276 | |||
265 | if (readl(dd->mmio + HOST_CTL) & HOST_RESET) | 277 | if (readl(dd->mmio + HOST_CTL) & HOST_RESET) |
266 | return -1; | 278 | return -1; |
267 | 279 | ||
@@ -294,6 +306,10 @@ static inline void mtip_issue_ncq_command(struct mtip_port *port, int tag) | |||
294 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); | 306 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); |
295 | 307 | ||
296 | spin_unlock_irqrestore(&port->cmd_issue_lock, flags); | 308 | spin_unlock_irqrestore(&port->cmd_issue_lock, flags); |
309 | |||
310 | /* Set the command's timeout value.*/ | ||
311 | port->commands[tag].comp_time = jiffies + msecs_to_jiffies( | ||
312 | MTIP_NCQ_COMMAND_TIMEOUT_MS); | ||
297 | } | 313 | } |
298 | 314 | ||
299 | /* | 315 | /* |
@@ -420,7 +436,12 @@ static void mtip_init_port(struct mtip_port *port) | |||
420 | writel(0xFFFFFFFF, port->completed[i]); | 436 | writel(0xFFFFFFFF, port->completed[i]); |
421 | 437 | ||
422 | /* Clear any pending interrupts for this port */ | 438 | /* Clear any pending interrupts for this port */ |
423 | writel(readl(port->mmio + PORT_IRQ_STAT), port->mmio + PORT_IRQ_STAT); | 439 | writel(readl(port->dd->mmio + PORT_IRQ_STAT), |
440 | port->dd->mmio + PORT_IRQ_STAT); | ||
441 | |||
442 | /* Clear any pending interrupts on the HBA. */ | ||
443 | writel(readl(port->dd->mmio + HOST_IRQ_STAT), | ||
444 | port->dd->mmio + HOST_IRQ_STAT); | ||
424 | 445 | ||
425 | /* Enable port interrupts */ | 446 | /* Enable port interrupts */ |
426 | writel(DEF_PORT_IRQ, port->mmio + PORT_IRQ_MASK); | 447 | writel(DEF_PORT_IRQ, port->mmio + PORT_IRQ_MASK); |
@@ -447,6 +468,9 @@ static void mtip_restart_port(struct mtip_port *port) | |||
447 | && time_before(jiffies, timeout)) | 468 | && time_before(jiffies, timeout)) |
448 | ; | 469 | ; |
449 | 470 | ||
471 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
472 | return; | ||
473 | |||
450 | /* | 474 | /* |
451 | * Chip quirk: escalate to hba reset if | 475 | * Chip quirk: escalate to hba reset if |
452 | * PxCMD.CR not clear after 500 ms | 476 | * PxCMD.CR not clear after 500 ms |
@@ -475,6 +499,9 @@ static void mtip_restart_port(struct mtip_port *port) | |||
475 | while (time_before(jiffies, timeout)) | 499 | while (time_before(jiffies, timeout)) |
476 | ; | 500 | ; |
477 | 501 | ||
502 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
503 | return; | ||
504 | |||
478 | /* Clear PxSCTL.DET */ | 505 | /* Clear PxSCTL.DET */ |
479 | writel(readl(port->mmio + PORT_SCR_CTL) & ~1, | 506 | writel(readl(port->mmio + PORT_SCR_CTL) & ~1, |
480 | port->mmio + PORT_SCR_CTL); | 507 | port->mmio + PORT_SCR_CTL); |
@@ -486,15 +513,35 @@ static void mtip_restart_port(struct mtip_port *port) | |||
486 | && time_before(jiffies, timeout)) | 513 | && time_before(jiffies, timeout)) |
487 | ; | 514 | ; |
488 | 515 | ||
516 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
517 | return; | ||
518 | |||
489 | if ((readl(port->mmio + PORT_SCR_STAT) & 0x01) == 0) | 519 | if ((readl(port->mmio + PORT_SCR_STAT) & 0x01) == 0) |
490 | dev_warn(&port->dd->pdev->dev, | 520 | dev_warn(&port->dd->pdev->dev, |
491 | "COM reset failed\n"); | 521 | "COM reset failed\n"); |
492 | 522 | ||
493 | /* Clear SError, the PxSERR.DIAG.x should be set so clear it */ | 523 | mtip_init_port(port); |
494 | writel(readl(port->mmio + PORT_SCR_ERR), port->mmio + PORT_SCR_ERR); | 524 | mtip_start_port(port); |
495 | 525 | ||
496 | /* Enable the DMA engine */ | 526 | } |
497 | mtip_enable_engine(port, 1); | 527 | |
528 | /* | ||
529 | * Helper function for tag logging | ||
530 | */ | ||
531 | static void print_tags(struct driver_data *dd, | ||
532 | char *msg, | ||
533 | unsigned long *tagbits, | ||
534 | int cnt) | ||
535 | { | ||
536 | unsigned char tagmap[128]; | ||
537 | int group, tagmap_len = 0; | ||
538 | |||
539 | memset(tagmap, 0, sizeof(tagmap)); | ||
540 | for (group = SLOTBITS_IN_LONGS; group > 0; group--) | ||
541 | tagmap_len = sprintf(tagmap + tagmap_len, "%016lX ", | ||
542 | tagbits[group-1]); | ||
543 | dev_warn(&dd->pdev->dev, | ||
544 | "%d command(s) %s: tagmap [%s]", cnt, msg, tagmap); | ||
498 | } | 545 | } |
499 | 546 | ||
500 | /* | 547 | /* |
@@ -514,15 +561,18 @@ static void mtip_timeout_function(unsigned long int data) | |||
514 | int tag, cmdto_cnt = 0; | 561 | int tag, cmdto_cnt = 0; |
515 | unsigned int bit, group; | 562 | unsigned int bit, group; |
516 | unsigned int num_command_slots = port->dd->slot_groups * 32; | 563 | unsigned int num_command_slots = port->dd->slot_groups * 32; |
564 | unsigned long to, tagaccum[SLOTBITS_IN_LONGS]; | ||
517 | 565 | ||
518 | if (unlikely(!port)) | 566 | if (unlikely(!port)) |
519 | return; | 567 | return; |
520 | 568 | ||
521 | if (atomic_read(&port->dd->resumeflag) == true) { | 569 | if (test_bit(MTIP_DDF_RESUME_BIT, &port->dd->dd_flag)) { |
522 | mod_timer(&port->cmd_timer, | 570 | mod_timer(&port->cmd_timer, |
523 | jiffies + msecs_to_jiffies(30000)); | 571 | jiffies + msecs_to_jiffies(30000)); |
524 | return; | 572 | return; |
525 | } | 573 | } |
574 | /* clear the tag accumulator */ | ||
575 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | ||
526 | 576 | ||
527 | for (tag = 0; tag < num_command_slots; tag++) { | 577 | for (tag = 0; tag < num_command_slots; tag++) { |
528 | /* | 578 | /* |
@@ -540,12 +590,10 @@ static void mtip_timeout_function(unsigned long int data) | |||
540 | command = &port->commands[tag]; | 590 | command = &port->commands[tag]; |
541 | fis = (struct host_to_dev_fis *) command->command; | 591 | fis = (struct host_to_dev_fis *) command->command; |
542 | 592 | ||
543 | dev_warn(&port->dd->pdev->dev, | 593 | set_bit(tag, tagaccum); |
544 | "Timeout for command tag %d\n", tag); | ||
545 | |||
546 | cmdto_cnt++; | 594 | cmdto_cnt++; |
547 | if (cmdto_cnt == 1) | 595 | if (cmdto_cnt == 1) |
548 | set_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags); | 596 | set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
549 | 597 | ||
550 | /* | 598 | /* |
551 | * Clear the completed bit. This should prevent | 599 | * Clear the completed bit. This should prevent |
@@ -578,15 +626,29 @@ static void mtip_timeout_function(unsigned long int data) | |||
578 | } | 626 | } |
579 | } | 627 | } |
580 | 628 | ||
581 | if (cmdto_cnt) { | 629 | if (cmdto_cnt && !test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { |
582 | dev_warn(&port->dd->pdev->dev, | 630 | print_tags(port->dd, "timed out", tagaccum, cmdto_cnt); |
583 | "%d commands timed out: restarting port", | 631 | |
584 | cmdto_cnt); | ||
585 | mtip_restart_port(port); | 632 | mtip_restart_port(port); |
586 | clear_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags); | 633 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
587 | wake_up_interruptible(&port->svc_wait); | 634 | wake_up_interruptible(&port->svc_wait); |
588 | } | 635 | } |
589 | 636 | ||
637 | if (port->ic_pause_timer) { | ||
638 | to = port->ic_pause_timer + msecs_to_jiffies(1000); | ||
639 | if (time_after(jiffies, to)) { | ||
640 | if (!test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags)) { | ||
641 | port->ic_pause_timer = 0; | ||
642 | clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
643 | clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
644 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | ||
645 | wake_up_interruptible(&port->svc_wait); | ||
646 | } | ||
647 | |||
648 | |||
649 | } | ||
650 | } | ||
651 | |||
590 | /* Restart the timer */ | 652 | /* Restart the timer */ |
591 | mod_timer(&port->cmd_timer, | 653 | mod_timer(&port->cmd_timer, |
592 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); | 654 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); |
@@ -681,23 +743,18 @@ static void mtip_completion(struct mtip_port *port, | |||
681 | complete(waiting); | 743 | complete(waiting); |
682 | } | 744 | } |
683 | 745 | ||
684 | /* | 746 | static void mtip_null_completion(struct mtip_port *port, |
685 | * Helper function for tag logging | 747 | int tag, |
686 | */ | 748 | void *data, |
687 | static void print_tags(struct driver_data *dd, | 749 | int status) |
688 | char *msg, | ||
689 | unsigned long *tagbits) | ||
690 | { | 750 | { |
691 | unsigned int tag, count = 0; | 751 | return; |
692 | |||
693 | for (tag = 0; tag < (dd->slot_groups) * 32; tag++) { | ||
694 | if (test_bit(tag, tagbits)) | ||
695 | count++; | ||
696 | } | ||
697 | if (count) | ||
698 | dev_info(&dd->pdev->dev, "%s [%i tags]\n", msg, count); | ||
699 | } | 752 | } |
700 | 753 | ||
754 | static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, | ||
755 | dma_addr_t buffer_dma, unsigned int sectors); | ||
756 | static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, | ||
757 | struct smart_attr *attrib); | ||
701 | /* | 758 | /* |
702 | * Handle an error. | 759 | * Handle an error. |
703 | * | 760 | * |
@@ -708,12 +765,16 @@ static void print_tags(struct driver_data *dd, | |||
708 | */ | 765 | */ |
709 | static void mtip_handle_tfe(struct driver_data *dd) | 766 | static void mtip_handle_tfe(struct driver_data *dd) |
710 | { | 767 | { |
711 | int group, tag, bit, reissue; | 768 | int group, tag, bit, reissue, rv; |
712 | struct mtip_port *port; | 769 | struct mtip_port *port; |
713 | struct mtip_cmd *command; | 770 | struct mtip_cmd *cmd; |
714 | u32 completed; | 771 | u32 completed; |
715 | struct host_to_dev_fis *fis; | 772 | struct host_to_dev_fis *fis; |
716 | unsigned long tagaccum[SLOTBITS_IN_LONGS]; | 773 | unsigned long tagaccum[SLOTBITS_IN_LONGS]; |
774 | unsigned int cmd_cnt = 0; | ||
775 | unsigned char *buf; | ||
776 | char *fail_reason = NULL; | ||
777 | int fail_all_ncq_write = 0, fail_all_ncq_cmds = 0; | ||
717 | 778 | ||
718 | dev_warn(&dd->pdev->dev, "Taskfile error\n"); | 779 | dev_warn(&dd->pdev->dev, "Taskfile error\n"); |
719 | 780 | ||
@@ -722,8 +783,11 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
722 | /* Stop the timer to prevent command timeouts. */ | 783 | /* Stop the timer to prevent command timeouts. */ |
723 | del_timer(&port->cmd_timer); | 784 | del_timer(&port->cmd_timer); |
724 | 785 | ||
786 | /* clear the tag accumulator */ | ||
787 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | ||
788 | |||
725 | /* Set eh_active */ | 789 | /* Set eh_active */ |
726 | set_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags); | 790 | set_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
727 | 791 | ||
728 | /* Loop through all the groups */ | 792 | /* Loop through all the groups */ |
729 | for (group = 0; group < dd->slot_groups; group++) { | 793 | for (group = 0; group < dd->slot_groups; group++) { |
@@ -732,9 +796,6 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
732 | /* clear completed status register in the hardware.*/ | 796 | /* clear completed status register in the hardware.*/ |
733 | writel(completed, port->completed[group]); | 797 | writel(completed, port->completed[group]); |
734 | 798 | ||
735 | /* clear the tag accumulator */ | ||
736 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | ||
737 | |||
738 | /* Process successfully completed commands */ | 799 | /* Process successfully completed commands */ |
739 | for (bit = 0; bit < 32 && completed; bit++) { | 800 | for (bit = 0; bit < 32 && completed; bit++) { |
740 | if (!(completed & (1<<bit))) | 801 | if (!(completed & (1<<bit))) |
@@ -745,13 +806,14 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
745 | if (tag == MTIP_TAG_INTERNAL) | 806 | if (tag == MTIP_TAG_INTERNAL) |
746 | continue; | 807 | continue; |
747 | 808 | ||
748 | command = &port->commands[tag]; | 809 | cmd = &port->commands[tag]; |
749 | if (likely(command->comp_func)) { | 810 | if (likely(cmd->comp_func)) { |
750 | set_bit(tag, tagaccum); | 811 | set_bit(tag, tagaccum); |
751 | atomic_set(&port->commands[tag].active, 0); | 812 | cmd_cnt++; |
752 | command->comp_func(port, | 813 | atomic_set(&cmd->active, 0); |
814 | cmd->comp_func(port, | ||
753 | tag, | 815 | tag, |
754 | command->comp_data, | 816 | cmd->comp_data, |
755 | 0); | 817 | 0); |
756 | } else { | 818 | } else { |
757 | dev_err(&port->dd->pdev->dev, | 819 | dev_err(&port->dd->pdev->dev, |
@@ -765,12 +827,45 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
765 | } | 827 | } |
766 | } | 828 | } |
767 | } | 829 | } |
768 | print_tags(dd, "TFE tags completed:", tagaccum); | 830 | |
831 | print_tags(dd, "completed (TFE)", tagaccum, cmd_cnt); | ||
769 | 832 | ||
770 | /* Restart the port */ | 833 | /* Restart the port */ |
771 | mdelay(20); | 834 | mdelay(20); |
772 | mtip_restart_port(port); | 835 | mtip_restart_port(port); |
773 | 836 | ||
837 | /* Trying to determine the cause of the error */ | ||
838 | rv = mtip_read_log_page(dd->port, ATA_LOG_SATA_NCQ, | ||
839 | dd->port->log_buf, | ||
840 | dd->port->log_buf_dma, 1); | ||
841 | if (rv) { | ||
842 | dev_warn(&dd->pdev->dev, | ||
843 | "Error in READ LOG EXT (10h) command\n"); | ||
844 | /* non-critical error, don't fail the load */ | ||
845 | } else { | ||
846 | buf = (unsigned char *)dd->port->log_buf; | ||
847 | if (buf[259] & 0x1) { | ||
848 | dev_info(&dd->pdev->dev, | ||
849 | "Write protect bit is set.\n"); | ||
850 | set_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag); | ||
851 | fail_all_ncq_write = 1; | ||
852 | fail_reason = "write protect"; | ||
853 | } | ||
854 | if (buf[288] == 0xF7) { | ||
855 | dev_info(&dd->pdev->dev, | ||
856 | "Exceeded Tmax, drive in thermal shutdown.\n"); | ||
857 | set_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag); | ||
858 | fail_all_ncq_cmds = 1; | ||
859 | fail_reason = "thermal shutdown"; | ||
860 | } | ||
861 | if (buf[288] == 0xBF) { | ||
862 | dev_info(&dd->pdev->dev, | ||
863 | "Drive indicates rebuild has failed.\n"); | ||
864 | fail_all_ncq_cmds = 1; | ||
865 | fail_reason = "rebuild failed"; | ||
866 | } | ||
867 | } | ||
868 | |||
774 | /* clear the tag accumulator */ | 869 | /* clear the tag accumulator */ |
775 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); | 870 | memset(tagaccum, 0, SLOTBITS_IN_LONGS * sizeof(long)); |
776 | 871 | ||
@@ -779,32 +874,47 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
779 | for (bit = 0; bit < 32; bit++) { | 874 | for (bit = 0; bit < 32; bit++) { |
780 | reissue = 1; | 875 | reissue = 1; |
781 | tag = (group << 5) + bit; | 876 | tag = (group << 5) + bit; |
877 | cmd = &port->commands[tag]; | ||
782 | 878 | ||
783 | /* If the active bit is set re-issue the command */ | 879 | /* If the active bit is set re-issue the command */ |
784 | if (atomic_read(&port->commands[tag].active) == 0) | 880 | if (atomic_read(&cmd->active) == 0) |
785 | continue; | 881 | continue; |
786 | 882 | ||
787 | fis = (struct host_to_dev_fis *) | 883 | fis = (struct host_to_dev_fis *)cmd->command; |
788 | port->commands[tag].command; | ||
789 | 884 | ||
790 | /* Should re-issue? */ | 885 | /* Should re-issue? */ |
791 | if (tag == MTIP_TAG_INTERNAL || | 886 | if (tag == MTIP_TAG_INTERNAL || |
792 | fis->command == ATA_CMD_SET_FEATURES) | 887 | fis->command == ATA_CMD_SET_FEATURES) |
793 | reissue = 0; | 888 | reissue = 0; |
889 | else { | ||
890 | if (fail_all_ncq_cmds || | ||
891 | (fail_all_ncq_write && | ||
892 | fis->command == ATA_CMD_FPDMA_WRITE)) { | ||
893 | dev_warn(&dd->pdev->dev, | ||
894 | " Fail: %s w/tag %d [%s].\n", | ||
895 | fis->command == ATA_CMD_FPDMA_WRITE ? | ||
896 | "write" : "read", | ||
897 | tag, | ||
898 | fail_reason != NULL ? | ||
899 | fail_reason : "unknown"); | ||
900 | atomic_set(&cmd->active, 0); | ||
901 | if (cmd->comp_func) { | ||
902 | cmd->comp_func(port, tag, | ||
903 | cmd->comp_data, | ||
904 | -ENODATA); | ||
905 | } | ||
906 | continue; | ||
907 | } | ||
908 | } | ||
794 | 909 | ||
795 | /* | 910 | /* |
796 | * First check if this command has | 911 | * First check if this command has |
797 | * exceeded its retries. | 912 | * exceeded its retries. |
798 | */ | 913 | */ |
799 | if (reissue && | 914 | if (reissue && (cmd->retries-- > 0)) { |
800 | (port->commands[tag].retries-- > 0)) { | ||
801 | 915 | ||
802 | set_bit(tag, tagaccum); | 916 | set_bit(tag, tagaccum); |
803 | 917 | ||
804 | /* Update the timeout value. */ | ||
805 | port->commands[tag].comp_time = | ||
806 | jiffies + msecs_to_jiffies( | ||
807 | MTIP_NCQ_COMMAND_TIMEOUT_MS); | ||
808 | /* Re-issue the command. */ | 918 | /* Re-issue the command. */ |
809 | mtip_issue_ncq_command(port, tag); | 919 | mtip_issue_ncq_command(port, tag); |
810 | 920 | ||
@@ -814,13 +924,13 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
814 | /* Retire a command that will not be reissued */ | 924 | /* Retire a command that will not be reissued */ |
815 | dev_warn(&port->dd->pdev->dev, | 925 | dev_warn(&port->dd->pdev->dev, |
816 | "retiring tag %d\n", tag); | 926 | "retiring tag %d\n", tag); |
817 | atomic_set(&port->commands[tag].active, 0); | 927 | atomic_set(&cmd->active, 0); |
818 | 928 | ||
819 | if (port->commands[tag].comp_func) | 929 | if (cmd->comp_func) |
820 | port->commands[tag].comp_func( | 930 | cmd->comp_func( |
821 | port, | 931 | port, |
822 | tag, | 932 | tag, |
823 | port->commands[tag].comp_data, | 933 | cmd->comp_data, |
824 | PORT_IRQ_TF_ERR); | 934 | PORT_IRQ_TF_ERR); |
825 | else | 935 | else |
826 | dev_warn(&port->dd->pdev->dev, | 936 | dev_warn(&port->dd->pdev->dev, |
@@ -828,10 +938,10 @@ static void mtip_handle_tfe(struct driver_data *dd) | |||
828 | tag); | 938 | tag); |
829 | } | 939 | } |
830 | } | 940 | } |
831 | print_tags(dd, "TFE tags reissued:", tagaccum); | 941 | print_tags(dd, "reissued (TFE)", tagaccum, cmd_cnt); |
832 | 942 | ||
833 | /* clear eh_active */ | 943 | /* clear eh_active */ |
834 | clear_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags); | 944 | clear_bit(MTIP_PF_EH_ACTIVE_BIT, &port->flags); |
835 | wake_up_interruptible(&port->svc_wait); | 945 | wake_up_interruptible(&port->svc_wait); |
836 | 946 | ||
837 | mod_timer(&port->cmd_timer, | 947 | mod_timer(&port->cmd_timer, |
@@ -899,7 +1009,7 @@ static inline void mtip_process_legacy(struct driver_data *dd, u32 port_stat) | |||
899 | struct mtip_port *port = dd->port; | 1009 | struct mtip_port *port = dd->port; |
900 | struct mtip_cmd *cmd = &port->commands[MTIP_TAG_INTERNAL]; | 1010 | struct mtip_cmd *cmd = &port->commands[MTIP_TAG_INTERNAL]; |
901 | 1011 | ||
902 | if (test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) && | 1012 | if (test_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags) && |
903 | (cmd != NULL) && !(readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | 1013 | (cmd != NULL) && !(readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
904 | & (1 << MTIP_TAG_INTERNAL))) { | 1014 | & (1 << MTIP_TAG_INTERNAL))) { |
905 | if (cmd->comp_func) { | 1015 | if (cmd->comp_func) { |
@@ -911,8 +1021,6 @@ static inline void mtip_process_legacy(struct driver_data *dd, u32 port_stat) | |||
911 | } | 1021 | } |
912 | } | 1022 | } |
913 | 1023 | ||
914 | dev_warn(&dd->pdev->dev, "IRQ status 0x%x ignored.\n", port_stat); | ||
915 | |||
916 | return; | 1024 | return; |
917 | } | 1025 | } |
918 | 1026 | ||
@@ -968,6 +1076,9 @@ static inline irqreturn_t mtip_handle_irq(struct driver_data *data) | |||
968 | /* don't proceed further */ | 1076 | /* don't proceed further */ |
969 | return IRQ_HANDLED; | 1077 | return IRQ_HANDLED; |
970 | } | 1078 | } |
1079 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1080 | &dd->dd_flag)) | ||
1081 | return rv; | ||
971 | 1082 | ||
972 | mtip_process_errors(dd, port_stat & PORT_IRQ_ERR); | 1083 | mtip_process_errors(dd, port_stat & PORT_IRQ_ERR); |
973 | } | 1084 | } |
@@ -1015,6 +1126,39 @@ static void mtip_issue_non_ncq_command(struct mtip_port *port, int tag) | |||
1015 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); | 1126 | port->cmd_issue[MTIP_TAG_INDEX(tag)]); |
1016 | } | 1127 | } |
1017 | 1128 | ||
1129 | static bool mtip_pause_ncq(struct mtip_port *port, | ||
1130 | struct host_to_dev_fis *fis) | ||
1131 | { | ||
1132 | struct host_to_dev_fis *reply; | ||
1133 | unsigned long task_file_data; | ||
1134 | |||
1135 | reply = port->rxfis + RX_FIS_D2H_REG; | ||
1136 | task_file_data = readl(port->mmio+PORT_TFDATA); | ||
1137 | |||
1138 | if ((task_file_data & 1) || (fis->command == ATA_CMD_SEC_ERASE_UNIT)) | ||
1139 | return false; | ||
1140 | |||
1141 | if (fis->command == ATA_CMD_SEC_ERASE_PREP) { | ||
1142 | set_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
1143 | port->ic_pause_timer = jiffies; | ||
1144 | return true; | ||
1145 | } else if ((fis->command == ATA_CMD_DOWNLOAD_MICRO) && | ||
1146 | (fis->features == 0x03)) { | ||
1147 | set_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
1148 | port->ic_pause_timer = jiffies; | ||
1149 | return true; | ||
1150 | } else if ((fis->command == ATA_CMD_SEC_ERASE_UNIT) || | ||
1151 | ((fis->command == 0xFC) && | ||
1152 | (fis->features == 0x27 || fis->features == 0x72 || | ||
1153 | fis->features == 0x62 || fis->features == 0x26))) { | ||
1154 | /* Com reset after secure erase or lowlevel format */ | ||
1155 | mtip_restart_port(port); | ||
1156 | return false; | ||
1157 | } | ||
1158 | |||
1159 | return false; | ||
1160 | } | ||
1161 | |||
1018 | /* | 1162 | /* |
1019 | * Wait for port to quiesce | 1163 | * Wait for port to quiesce |
1020 | * | 1164 | * |
@@ -1033,11 +1177,13 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) | |||
1033 | 1177 | ||
1034 | to = jiffies + msecs_to_jiffies(timeout); | 1178 | to = jiffies + msecs_to_jiffies(timeout); |
1035 | do { | 1179 | do { |
1036 | if (test_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags) && | 1180 | if (test_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags) && |
1037 | test_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags)) { | 1181 | test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) { |
1038 | msleep(20); | 1182 | msleep(20); |
1039 | continue; /* svc thd is actively issuing commands */ | 1183 | continue; /* svc thd is actively issuing commands */ |
1040 | } | 1184 | } |
1185 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
1186 | return -EFAULT; | ||
1041 | /* | 1187 | /* |
1042 | * Ignore s_active bit 0 of array element 0. | 1188 | * Ignore s_active bit 0 of array element 0. |
1043 | * This bit will always be set | 1189 | * This bit will always be set |
@@ -1074,7 +1220,7 @@ static int mtip_quiesce_io(struct mtip_port *port, unsigned long timeout) | |||
1074 | * -EAGAIN Time out waiting for command to complete. | 1220 | * -EAGAIN Time out waiting for command to complete. |
1075 | */ | 1221 | */ |
1076 | static int mtip_exec_internal_command(struct mtip_port *port, | 1222 | static int mtip_exec_internal_command(struct mtip_port *port, |
1077 | void *fis, | 1223 | struct host_to_dev_fis *fis, |
1078 | int fis_len, | 1224 | int fis_len, |
1079 | dma_addr_t buffer, | 1225 | dma_addr_t buffer, |
1080 | int buf_len, | 1226 | int buf_len, |
@@ -1084,8 +1230,9 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1084 | { | 1230 | { |
1085 | struct mtip_cmd_sg *command_sg; | 1231 | struct mtip_cmd_sg *command_sg; |
1086 | DECLARE_COMPLETION_ONSTACK(wait); | 1232 | DECLARE_COMPLETION_ONSTACK(wait); |
1087 | int rv = 0; | 1233 | int rv = 0, ready2go = 1; |
1088 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; | 1234 | struct mtip_cmd *int_cmd = &port->commands[MTIP_TAG_INTERNAL]; |
1235 | unsigned long to; | ||
1089 | 1236 | ||
1090 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ | 1237 | /* Make sure the buffer is 8 byte aligned. This is asic specific. */ |
1091 | if (buffer & 0x00000007) { | 1238 | if (buffer & 0x00000007) { |
@@ -1094,23 +1241,38 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1094 | return -EFAULT; | 1241 | return -EFAULT; |
1095 | } | 1242 | } |
1096 | 1243 | ||
1097 | /* Only one internal command should be running at a time */ | 1244 | to = jiffies + msecs_to_jiffies(timeout); |
1098 | if (test_and_set_bit(MTIP_TAG_INTERNAL, port->allocated)) { | 1245 | do { |
1246 | ready2go = !test_and_set_bit(MTIP_TAG_INTERNAL, | ||
1247 | port->allocated); | ||
1248 | if (ready2go) | ||
1249 | break; | ||
1250 | mdelay(100); | ||
1251 | } while (time_before(jiffies, to)); | ||
1252 | if (!ready2go) { | ||
1099 | dev_warn(&port->dd->pdev->dev, | 1253 | dev_warn(&port->dd->pdev->dev, |
1100 | "Internal command already active\n"); | 1254 | "Internal cmd active. new cmd [%02X]\n", fis->command); |
1101 | return -EBUSY; | 1255 | return -EBUSY; |
1102 | } | 1256 | } |
1103 | set_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); | 1257 | set_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
1258 | port->ic_pause_timer = 0; | ||
1259 | |||
1260 | if (fis->command == ATA_CMD_SEC_ERASE_UNIT) | ||
1261 | clear_bit(MTIP_PF_SE_ACTIVE_BIT, &port->flags); | ||
1262 | else if (fis->command == ATA_CMD_DOWNLOAD_MICRO) | ||
1263 | clear_bit(MTIP_PF_DM_ACTIVE_BIT, &port->flags); | ||
1104 | 1264 | ||
1105 | if (atomic == GFP_KERNEL) { | 1265 | if (atomic == GFP_KERNEL) { |
1106 | /* wait for io to complete if non atomic */ | 1266 | if (fis->command != ATA_CMD_STANDBYNOW1) { |
1107 | if (mtip_quiesce_io(port, 5000) < 0) { | 1267 | /* wait for io to complete if non atomic */ |
1108 | dev_warn(&port->dd->pdev->dev, | 1268 | if (mtip_quiesce_io(port, 5000) < 0) { |
1109 | "Failed to quiesce IO\n"); | 1269 | dev_warn(&port->dd->pdev->dev, |
1110 | release_slot(port, MTIP_TAG_INTERNAL); | 1270 | "Failed to quiesce IO\n"); |
1111 | clear_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); | 1271 | release_slot(port, MTIP_TAG_INTERNAL); |
1112 | wake_up_interruptible(&port->svc_wait); | 1272 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); |
1113 | return -EBUSY; | 1273 | wake_up_interruptible(&port->svc_wait); |
1274 | return -EBUSY; | ||
1275 | } | ||
1114 | } | 1276 | } |
1115 | 1277 | ||
1116 | /* Set the completion function and data for the command. */ | 1278 | /* Set the completion function and data for the command. */ |
@@ -1120,7 +1282,7 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1120 | } else { | 1282 | } else { |
1121 | /* Clear completion - we're going to poll */ | 1283 | /* Clear completion - we're going to poll */ |
1122 | int_cmd->comp_data = NULL; | 1284 | int_cmd->comp_data = NULL; |
1123 | int_cmd->comp_func = NULL; | 1285 | int_cmd->comp_func = mtip_null_completion; |
1124 | } | 1286 | } |
1125 | 1287 | ||
1126 | /* Copy the command to the command table */ | 1288 | /* Copy the command to the command table */ |
@@ -1159,6 +1321,12 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1159 | "Internal command did not complete [%d] " | 1321 | "Internal command did not complete [%d] " |
1160 | "within timeout of %lu ms\n", | 1322 | "within timeout of %lu ms\n", |
1161 | atomic, timeout); | 1323 | atomic, timeout); |
1324 | if (mtip_check_surprise_removal(port->dd->pdev) || | ||
1325 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1326 | &port->dd->dd_flag)) { | ||
1327 | rv = -ENXIO; | ||
1328 | goto exec_ic_exit; | ||
1329 | } | ||
1162 | rv = -EAGAIN; | 1330 | rv = -EAGAIN; |
1163 | } | 1331 | } |
1164 | 1332 | ||
@@ -1166,31 +1334,59 @@ static int mtip_exec_internal_command(struct mtip_port *port, | |||
1166 | & (1 << MTIP_TAG_INTERNAL)) { | 1334 | & (1 << MTIP_TAG_INTERNAL)) { |
1167 | dev_warn(&port->dd->pdev->dev, | 1335 | dev_warn(&port->dd->pdev->dev, |
1168 | "Retiring internal command but CI is 1.\n"); | 1336 | "Retiring internal command but CI is 1.\n"); |
1337 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1338 | &port->dd->dd_flag)) { | ||
1339 | hba_reset_nosleep(port->dd); | ||
1340 | rv = -ENXIO; | ||
1341 | } else { | ||
1342 | mtip_restart_port(port); | ||
1343 | rv = -EAGAIN; | ||
1344 | } | ||
1345 | goto exec_ic_exit; | ||
1169 | } | 1346 | } |
1170 | 1347 | ||
1171 | } else { | 1348 | } else { |
1172 | /* Spin for <timeout> checking if command still outstanding */ | 1349 | /* Spin for <timeout> checking if command still outstanding */ |
1173 | timeout = jiffies + msecs_to_jiffies(timeout); | 1350 | timeout = jiffies + msecs_to_jiffies(timeout); |
1174 | 1351 | while ((readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | |
1175 | while ((readl( | 1352 | & (1 << MTIP_TAG_INTERNAL)) |
1176 | port->cmd_issue[MTIP_TAG_INTERNAL]) | 1353 | && time_before(jiffies, timeout)) { |
1177 | & (1 << MTIP_TAG_INTERNAL)) | 1354 | if (mtip_check_surprise_removal(port->dd->pdev)) { |
1178 | && time_before(jiffies, timeout)) | 1355 | rv = -ENXIO; |
1179 | ; | 1356 | goto exec_ic_exit; |
1357 | } | ||
1358 | if ((fis->command != ATA_CMD_STANDBYNOW1) && | ||
1359 | test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1360 | &port->dd->dd_flag)) { | ||
1361 | rv = -ENXIO; | ||
1362 | goto exec_ic_exit; | ||
1363 | } | ||
1364 | } | ||
1180 | 1365 | ||
1181 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) | 1366 | if (readl(port->cmd_issue[MTIP_TAG_INTERNAL]) |
1182 | & (1 << MTIP_TAG_INTERNAL)) { | 1367 | & (1 << MTIP_TAG_INTERNAL)) { |
1183 | dev_err(&port->dd->pdev->dev, | 1368 | dev_err(&port->dd->pdev->dev, |
1184 | "Internal command did not complete [%d]\n", | 1369 | "Internal command did not complete [atomic]\n"); |
1185 | atomic); | ||
1186 | rv = -EAGAIN; | 1370 | rv = -EAGAIN; |
1371 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
1372 | &port->dd->dd_flag)) { | ||
1373 | hba_reset_nosleep(port->dd); | ||
1374 | rv = -ENXIO; | ||
1375 | } else { | ||
1376 | mtip_restart_port(port); | ||
1377 | rv = -EAGAIN; | ||
1378 | } | ||
1187 | } | 1379 | } |
1188 | } | 1380 | } |
1189 | 1381 | exec_ic_exit: | |
1190 | /* Clear the allocated and active bits for the internal command. */ | 1382 | /* Clear the allocated and active bits for the internal command. */ |
1191 | atomic_set(&int_cmd->active, 0); | 1383 | atomic_set(&int_cmd->active, 0); |
1192 | release_slot(port, MTIP_TAG_INTERNAL); | 1384 | release_slot(port, MTIP_TAG_INTERNAL); |
1193 | clear_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags); | 1385 | if (rv >= 0 && mtip_pause_ncq(port, fis)) { |
1386 | /* NCQ paused */ | ||
1387 | return rv; | ||
1388 | } | ||
1389 | clear_bit(MTIP_PF_IC_ACTIVE_BIT, &port->flags); | ||
1194 | wake_up_interruptible(&port->svc_wait); | 1390 | wake_up_interruptible(&port->svc_wait); |
1195 | 1391 | ||
1196 | return rv; | 1392 | return rv; |
@@ -1240,6 +1436,9 @@ static int mtip_get_identify(struct mtip_port *port, void __user *user_buffer) | |||
1240 | int rv = 0; | 1436 | int rv = 0; |
1241 | struct host_to_dev_fis fis; | 1437 | struct host_to_dev_fis fis; |
1242 | 1438 | ||
1439 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &port->dd->dd_flag)) | ||
1440 | return -EFAULT; | ||
1441 | |||
1243 | /* Build the FIS. */ | 1442 | /* Build the FIS. */ |
1244 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | 1443 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); |
1245 | fis.type = 0x27; | 1444 | fis.type = 0x27; |
@@ -1313,6 +1512,7 @@ static int mtip_standby_immediate(struct mtip_port *port) | |||
1313 | { | 1512 | { |
1314 | int rv; | 1513 | int rv; |
1315 | struct host_to_dev_fis fis; | 1514 | struct host_to_dev_fis fis; |
1515 | unsigned long start; | ||
1316 | 1516 | ||
1317 | /* Build the FIS. */ | 1517 | /* Build the FIS. */ |
1318 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | 1518 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); |
@@ -1320,15 +1520,150 @@ static int mtip_standby_immediate(struct mtip_port *port) | |||
1320 | fis.opts = 1 << 7; | 1520 | fis.opts = 1 << 7; |
1321 | fis.command = ATA_CMD_STANDBYNOW1; | 1521 | fis.command = ATA_CMD_STANDBYNOW1; |
1322 | 1522 | ||
1323 | /* Execute the command. Use a 15-second timeout for large drives. */ | 1523 | start = jiffies; |
1324 | rv = mtip_exec_internal_command(port, | 1524 | rv = mtip_exec_internal_command(port, |
1325 | &fis, | 1525 | &fis, |
1326 | 5, | 1526 | 5, |
1327 | 0, | 1527 | 0, |
1328 | 0, | 1528 | 0, |
1329 | 0, | 1529 | 0, |
1330 | GFP_KERNEL, | 1530 | GFP_ATOMIC, |
1331 | 15000); | 1531 | 15000); |
1532 | dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n", | ||
1533 | jiffies_to_msecs(jiffies - start)); | ||
1534 | if (rv) | ||
1535 | dev_warn(&port->dd->pdev->dev, | ||
1536 | "STANDBY IMMEDIATE command failed.\n"); | ||
1537 | |||
1538 | return rv; | ||
1539 | } | ||
1540 | |||
1541 | /* | ||
1542 | * Issue a READ LOG EXT command to the device. | ||
1543 | * | ||
1544 | * @port pointer to the port structure. | ||
1545 | * @page page number to fetch | ||
1546 | * @buffer pointer to buffer | ||
1547 | * @buffer_dma dma address corresponding to @buffer | ||
1548 | * @sectors page length to fetch, in sectors | ||
1549 | * | ||
1550 | * return value | ||
1551 | * @rv return value from mtip_exec_internal_command() | ||
1552 | */ | ||
1553 | static int mtip_read_log_page(struct mtip_port *port, u8 page, u16 *buffer, | ||
1554 | dma_addr_t buffer_dma, unsigned int sectors) | ||
1555 | { | ||
1556 | struct host_to_dev_fis fis; | ||
1557 | |||
1558 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | ||
1559 | fis.type = 0x27; | ||
1560 | fis.opts = 1 << 7; | ||
1561 | fis.command = ATA_CMD_READ_LOG_EXT; | ||
1562 | fis.sect_count = sectors & 0xFF; | ||
1563 | fis.sect_cnt_ex = (sectors >> 8) & 0xFF; | ||
1564 | fis.lba_low = page; | ||
1565 | fis.lba_mid = 0; | ||
1566 | fis.device = ATA_DEVICE_OBS; | ||
1567 | |||
1568 | memset(buffer, 0, sectors * ATA_SECT_SIZE); | ||
1569 | |||
1570 | return mtip_exec_internal_command(port, | ||
1571 | &fis, | ||
1572 | 5, | ||
1573 | buffer_dma, | ||
1574 | sectors * ATA_SECT_SIZE, | ||
1575 | 0, | ||
1576 | GFP_ATOMIC, | ||
1577 | MTIP_INTERNAL_COMMAND_TIMEOUT_MS); | ||
1578 | } | ||
1579 | |||
1580 | /* | ||
1581 | * Issue a SMART READ DATA command to the device. | ||
1582 | * | ||
1583 | * @port pointer to the port structure. | ||
1584 | * @buffer pointer to buffer | ||
1585 | * @buffer_dma dma address corresponding to @buffer | ||
1586 | * | ||
1587 | * return value | ||
1588 | * @rv return value from mtip_exec_internal_command() | ||
1589 | */ | ||
1590 | static int mtip_get_smart_data(struct mtip_port *port, u8 *buffer, | ||
1591 | dma_addr_t buffer_dma) | ||
1592 | { | ||
1593 | struct host_to_dev_fis fis; | ||
1594 | |||
1595 | memset(&fis, 0, sizeof(struct host_to_dev_fis)); | ||
1596 | fis.type = 0x27; | ||
1597 | fis.opts = 1 << 7; | ||
1598 | fis.command = ATA_CMD_SMART; | ||
1599 | fis.features = 0xD0; | ||
1600 | fis.sect_count = 1; | ||
1601 | fis.lba_mid = 0x4F; | ||
1602 | fis.lba_hi = 0xC2; | ||
1603 | fis.device = ATA_DEVICE_OBS; | ||
1604 | |||
1605 | return mtip_exec_internal_command(port, | ||
1606 | &fis, | ||
1607 | 5, | ||
1608 | buffer_dma, | ||
1609 | ATA_SECT_SIZE, | ||
1610 | 0, | ||
1611 | GFP_ATOMIC, | ||
1612 | 15000); | ||
1613 | } | ||
1614 | |||
1615 | /* | ||
1616 | * Get the value of a smart attribute | ||
1617 | * | ||
1618 | * @port pointer to the port structure | ||
1619 | * @id attribute number | ||
1620 | * @attrib pointer to return attrib information corresponding to @id | ||
1621 | * | ||
1622 | * return value | ||
1623 | * -EINVAL NULL buffer passed or unsupported attribute @id. | ||
1624 | * -EPERM Identify data not valid, SMART not supported or not enabled | ||
1625 | */ | ||
1626 | static int mtip_get_smart_attr(struct mtip_port *port, unsigned int id, | ||
1627 | struct smart_attr *attrib) | ||
1628 | { | ||
1629 | int rv, i; | ||
1630 | struct smart_attr *pattr; | ||
1631 | |||
1632 | if (!attrib) | ||
1633 | return -EINVAL; | ||
1634 | |||
1635 | if (!port->identify_valid) { | ||
1636 | dev_warn(&port->dd->pdev->dev, "IDENTIFY DATA not valid\n"); | ||
1637 | return -EPERM; | ||
1638 | } | ||
1639 | if (!(port->identify[82] & 0x1)) { | ||
1640 | dev_warn(&port->dd->pdev->dev, "SMART not supported\n"); | ||
1641 | return -EPERM; | ||
1642 | } | ||
1643 | if (!(port->identify[85] & 0x1)) { | ||
1644 | dev_warn(&port->dd->pdev->dev, "SMART not enabled\n"); | ||
1645 | return -EPERM; | ||
1646 | } | ||
1647 | |||
1648 | memset(port->smart_buf, 0, ATA_SECT_SIZE); | ||
1649 | rv = mtip_get_smart_data(port, port->smart_buf, port->smart_buf_dma); | ||
1650 | if (rv) { | ||
1651 | dev_warn(&port->dd->pdev->dev, "Failed to ge SMART data\n"); | ||
1652 | return rv; | ||
1653 | } | ||
1654 | |||
1655 | pattr = (struct smart_attr *)(port->smart_buf + 2); | ||
1656 | for (i = 0; i < 29; i++, pattr++) | ||
1657 | if (pattr->attr_id == id) { | ||
1658 | memcpy(attrib, pattr, sizeof(struct smart_attr)); | ||
1659 | break; | ||
1660 | } | ||
1661 | |||
1662 | if (i == 29) { | ||
1663 | dev_warn(&port->dd->pdev->dev, | ||
1664 | "Query for invalid SMART attribute ID\n"); | ||
1665 | rv = -EINVAL; | ||
1666 | } | ||
1332 | 1667 | ||
1333 | return rv; | 1668 | return rv; |
1334 | } | 1669 | } |
@@ -1504,10 +1839,7 @@ static int exec_drive_task(struct mtip_port *port, u8 *command) | |||
1504 | fis.cyl_hi = command[5]; | 1839 | fis.cyl_hi = command[5]; |
1505 | fis.device = command[6] & ~0x10; /* Clear the dev bit*/ | 1840 | fis.device = command[6] & ~0x10; /* Clear the dev bit*/ |
1506 | 1841 | ||
1507 | 1842 | dbg_printk(MTIP_DRV_NAME " %s: User Command: cmd %x, feat %x, nsect %x, sect %x, lcyl %x, hcyl %x, sel %x\n", | |
1508 | dbg_printk(MTIP_DRV_NAME "%s: User Command: cmd %x, feat %x, " | ||
1509 | "nsect %x, sect %x, lcyl %x, " | ||
1510 | "hcyl %x, sel %x\n", | ||
1511 | __func__, | 1843 | __func__, |
1512 | command[0], | 1844 | command[0], |
1513 | command[1], | 1845 | command[1], |
@@ -1534,8 +1866,7 @@ static int exec_drive_task(struct mtip_port *port, u8 *command) | |||
1534 | command[4] = reply->cyl_low; | 1866 | command[4] = reply->cyl_low; |
1535 | command[5] = reply->cyl_hi; | 1867 | command[5] = reply->cyl_hi; |
1536 | 1868 | ||
1537 | dbg_printk(MTIP_DRV_NAME "%s: Completion Status: stat %x, " | 1869 | dbg_printk(MTIP_DRV_NAME " %s: Completion Status: stat %x, err %x , cyl_lo %x cyl_hi %x\n", |
1538 | "err %x , cyl_lo %x cyl_hi %x\n", | ||
1539 | __func__, | 1870 | __func__, |
1540 | command[0], | 1871 | command[0], |
1541 | command[1], | 1872 | command[1], |
@@ -1578,7 +1909,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, | |||
1578 | } | 1909 | } |
1579 | 1910 | ||
1580 | dbg_printk(MTIP_DRV_NAME | 1911 | dbg_printk(MTIP_DRV_NAME |
1581 | "%s: User Command: cmd %x, sect %x, " | 1912 | " %s: User Command: cmd %x, sect %x, " |
1582 | "feat %x, sectcnt %x\n", | 1913 | "feat %x, sectcnt %x\n", |
1583 | __func__, | 1914 | __func__, |
1584 | command[0], | 1915 | command[0], |
@@ -1607,7 +1938,7 @@ static int exec_drive_command(struct mtip_port *port, u8 *command, | |||
1607 | command[2] = command[3]; | 1938 | command[2] = command[3]; |
1608 | 1939 | ||
1609 | dbg_printk(MTIP_DRV_NAME | 1940 | dbg_printk(MTIP_DRV_NAME |
1610 | "%s: Completion Status: stat %x, " | 1941 | " %s: Completion Status: stat %x, " |
1611 | "err %x, cmd %x\n", | 1942 | "err %x, cmd %x\n", |
1612 | __func__, | 1943 | __func__, |
1613 | command[0], | 1944 | command[0], |
@@ -1810,9 +2141,10 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1810 | } | 2141 | } |
1811 | 2142 | ||
1812 | dbg_printk(MTIP_DRV_NAME | 2143 | dbg_printk(MTIP_DRV_NAME |
1813 | "taskfile: cmd %x, feat %x, nsect %x," | 2144 | " %s: cmd %x, feat %x, nsect %x," |
1814 | " sect/lbal %x, lcyl/lbam %x, hcyl/lbah %x," | 2145 | " sect/lbal %x, lcyl/lbam %x, hcyl/lbah %x," |
1815 | " head/dev %x\n", | 2146 | " head/dev %x\n", |
2147 | __func__, | ||
1816 | fis.command, | 2148 | fis.command, |
1817 | fis.features, | 2149 | fis.features, |
1818 | fis.sect_count, | 2150 | fis.sect_count, |
@@ -1823,8 +2155,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1823 | 2155 | ||
1824 | switch (fis.command) { | 2156 | switch (fis.command) { |
1825 | case ATA_CMD_DOWNLOAD_MICRO: | 2157 | case ATA_CMD_DOWNLOAD_MICRO: |
1826 | /* Change timeout for Download Microcode to 60 seconds.*/ | 2158 | /* Change timeout for Download Microcode to 2 minutes */ |
1827 | timeout = 60000; | 2159 | timeout = 120000; |
1828 | break; | 2160 | break; |
1829 | case ATA_CMD_SEC_ERASE_UNIT: | 2161 | case ATA_CMD_SEC_ERASE_UNIT: |
1830 | /* Change timeout for Security Erase Unit to 4 minutes.*/ | 2162 | /* Change timeout for Security Erase Unit to 4 minutes.*/ |
@@ -1840,8 +2172,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1840 | timeout = 10000; | 2172 | timeout = 10000; |
1841 | break; | 2173 | break; |
1842 | case ATA_CMD_SMART: | 2174 | case ATA_CMD_SMART: |
1843 | /* Change timeout for vendor unique command to 10 secs */ | 2175 | /* Change timeout for vendor unique command to 15 secs */ |
1844 | timeout = 10000; | 2176 | timeout = 15000; |
1845 | break; | 2177 | break; |
1846 | default: | 2178 | default: |
1847 | timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; | 2179 | timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS; |
@@ -1903,18 +2235,8 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
1903 | req_task->hob_ports[1] = reply->features_ex; | 2235 | req_task->hob_ports[1] = reply->features_ex; |
1904 | req_task->hob_ports[2] = reply->sect_cnt_ex; | 2236 | req_task->hob_ports[2] = reply->sect_cnt_ex; |
1905 | } | 2237 | } |
1906 | |||
1907 | /* Com rest after secure erase or lowlevel format */ | ||
1908 | if (((fis.command == ATA_CMD_SEC_ERASE_UNIT) || | ||
1909 | ((fis.command == 0xFC) && | ||
1910 | (fis.features == 0x27 || fis.features == 0x72 || | ||
1911 | fis.features == 0x62 || fis.features == 0x26))) && | ||
1912 | !(reply->command & 1)) { | ||
1913 | mtip_restart_port(dd->port); | ||
1914 | } | ||
1915 | |||
1916 | dbg_printk(MTIP_DRV_NAME | 2238 | dbg_printk(MTIP_DRV_NAME |
1917 | "%s: Completion: stat %x," | 2239 | " %s: Completion: stat %x," |
1918 | "err %x, sect_cnt %x, lbalo %x," | 2240 | "err %x, sect_cnt %x, lbalo %x," |
1919 | "lbamid %x, lbahi %x, dev %x\n", | 2241 | "lbamid %x, lbahi %x, dev %x\n", |
1920 | __func__, | 2242 | __func__, |
@@ -2080,14 +2402,10 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
2080 | struct host_to_dev_fis *fis; | 2402 | struct host_to_dev_fis *fis; |
2081 | struct mtip_port *port = dd->port; | 2403 | struct mtip_port *port = dd->port; |
2082 | struct mtip_cmd *command = &port->commands[tag]; | 2404 | struct mtip_cmd *command = &port->commands[tag]; |
2405 | int dma_dir = (dir == READ) ? DMA_FROM_DEVICE : DMA_TO_DEVICE; | ||
2083 | 2406 | ||
2084 | /* Map the scatter list for DMA access */ | 2407 | /* Map the scatter list for DMA access */ |
2085 | if (dir == READ) | 2408 | nents = dma_map_sg(&dd->pdev->dev, command->sg, nents, dma_dir); |
2086 | nents = dma_map_sg(&dd->pdev->dev, command->sg, | ||
2087 | nents, DMA_FROM_DEVICE); | ||
2088 | else | ||
2089 | nents = dma_map_sg(&dd->pdev->dev, command->sg, | ||
2090 | nents, DMA_TO_DEVICE); | ||
2091 | 2409 | ||
2092 | command->scatter_ents = nents; | 2410 | command->scatter_ents = nents; |
2093 | 2411 | ||
@@ -2127,7 +2445,7 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
2127 | */ | 2445 | */ |
2128 | command->comp_data = dd; | 2446 | command->comp_data = dd; |
2129 | command->comp_func = mtip_async_complete; | 2447 | command->comp_func = mtip_async_complete; |
2130 | command->direction = (dir == READ ? DMA_FROM_DEVICE : DMA_TO_DEVICE); | 2448 | command->direction = dma_dir; |
2131 | 2449 | ||
2132 | /* | 2450 | /* |
2133 | * Set the completion function and data for the command passed | 2451 | * Set the completion function and data for the command passed |
@@ -2140,19 +2458,16 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t start, | |||
2140 | * To prevent this command from being issued | 2458 | * To prevent this command from being issued |
2141 | * if an internal command is in progress or error handling is active. | 2459 | * if an internal command is in progress or error handling is active. |
2142 | */ | 2460 | */ |
2143 | if (unlikely(test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) || | 2461 | if (port->flags & MTIP_PF_PAUSE_IO) { |
2144 | test_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags))) { | ||
2145 | set_bit(tag, port->cmds_to_issue); | 2462 | set_bit(tag, port->cmds_to_issue); |
2146 | set_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags); | 2463 | set_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags); |
2147 | return; | 2464 | return; |
2148 | } | 2465 | } |
2149 | 2466 | ||
2150 | /* Issue the command to the hardware */ | 2467 | /* Issue the command to the hardware */ |
2151 | mtip_issue_ncq_command(port, tag); | 2468 | mtip_issue_ncq_command(port, tag); |
2152 | 2469 | ||
2153 | /* Set the command's timeout value.*/ | 2470 | return; |
2154 | port->commands[tag].comp_time = jiffies + msecs_to_jiffies( | ||
2155 | MTIP_NCQ_COMMAND_TIMEOUT_MS); | ||
2156 | } | 2471 | } |
2157 | 2472 | ||
2158 | /* | 2473 | /* |
@@ -2191,6 +2506,10 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2191 | down(&dd->port->cmd_slot); | 2506 | down(&dd->port->cmd_slot); |
2192 | *tag = get_slot(dd->port); | 2507 | *tag = get_slot(dd->port); |
2193 | 2508 | ||
2509 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) { | ||
2510 | up(&dd->port->cmd_slot); | ||
2511 | return NULL; | ||
2512 | } | ||
2194 | if (unlikely(*tag < 0)) | 2513 | if (unlikely(*tag < 0)) |
2195 | return NULL; | 2514 | return NULL; |
2196 | 2515 | ||
@@ -2207,7 +2526,7 @@ static struct scatterlist *mtip_hw_get_scatterlist(struct driver_data *dd, | |||
2207 | * return value | 2526 | * return value |
2208 | * The size, in bytes, of the data copied into buf. | 2527 | * The size, in bytes, of the data copied into buf. |
2209 | */ | 2528 | */ |
2210 | static ssize_t hw_show_registers(struct device *dev, | 2529 | static ssize_t mtip_hw_show_registers(struct device *dev, |
2211 | struct device_attribute *attr, | 2530 | struct device_attribute *attr, |
2212 | char *buf) | 2531 | char *buf) |
2213 | { | 2532 | { |
@@ -2216,7 +2535,7 @@ static ssize_t hw_show_registers(struct device *dev, | |||
2216 | int size = 0; | 2535 | int size = 0; |
2217 | int n; | 2536 | int n; |
2218 | 2537 | ||
2219 | size += sprintf(&buf[size], "%s:\ns_active:\n", __func__); | 2538 | size += sprintf(&buf[size], "S ACTive:\n"); |
2220 | 2539 | ||
2221 | for (n = 0; n < dd->slot_groups; n++) | 2540 | for (n = 0; n < dd->slot_groups; n++) |
2222 | size += sprintf(&buf[size], "0x%08x\n", | 2541 | size += sprintf(&buf[size], "0x%08x\n", |
@@ -2240,20 +2559,39 @@ static ssize_t hw_show_registers(struct device *dev, | |||
2240 | group_allocated); | 2559 | group_allocated); |
2241 | } | 2560 | } |
2242 | 2561 | ||
2243 | size += sprintf(&buf[size], "completed:\n"); | 2562 | size += sprintf(&buf[size], "Completed:\n"); |
2244 | 2563 | ||
2245 | for (n = 0; n < dd->slot_groups; n++) | 2564 | for (n = 0; n < dd->slot_groups; n++) |
2246 | size += sprintf(&buf[size], "0x%08x\n", | 2565 | size += sprintf(&buf[size], "0x%08x\n", |
2247 | readl(dd->port->completed[n])); | 2566 | readl(dd->port->completed[n])); |
2248 | 2567 | ||
2249 | size += sprintf(&buf[size], "PORT_IRQ_STAT 0x%08x\n", | 2568 | size += sprintf(&buf[size], "PORT IRQ STAT : 0x%08x\n", |
2250 | readl(dd->port->mmio + PORT_IRQ_STAT)); | 2569 | readl(dd->port->mmio + PORT_IRQ_STAT)); |
2251 | size += sprintf(&buf[size], "HOST_IRQ_STAT 0x%08x\n", | 2570 | size += sprintf(&buf[size], "HOST IRQ STAT : 0x%08x\n", |
2252 | readl(dd->mmio + HOST_IRQ_STAT)); | 2571 | readl(dd->mmio + HOST_IRQ_STAT)); |
2253 | 2572 | ||
2254 | return size; | 2573 | return size; |
2255 | } | 2574 | } |
2256 | static DEVICE_ATTR(registers, S_IRUGO, hw_show_registers, NULL); | 2575 | |
2576 | static ssize_t mtip_hw_show_status(struct device *dev, | ||
2577 | struct device_attribute *attr, | ||
2578 | char *buf) | ||
2579 | { | ||
2580 | struct driver_data *dd = dev_to_disk(dev)->private_data; | ||
2581 | int size = 0; | ||
2582 | |||
2583 | if (test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag)) | ||
2584 | size += sprintf(buf, "%s", "thermal_shutdown\n"); | ||
2585 | else if (test_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag)) | ||
2586 | size += sprintf(buf, "%s", "write_protect\n"); | ||
2587 | else | ||
2588 | size += sprintf(buf, "%s", "online\n"); | ||
2589 | |||
2590 | return size; | ||
2591 | } | ||
2592 | |||
2593 | static DEVICE_ATTR(registers, S_IRUGO, mtip_hw_show_registers, NULL); | ||
2594 | static DEVICE_ATTR(status, S_IRUGO, mtip_hw_show_status, NULL); | ||
2257 | 2595 | ||
2258 | /* | 2596 | /* |
2259 | * Create the sysfs related attributes. | 2597 | * Create the sysfs related attributes. |
@@ -2272,7 +2610,10 @@ static int mtip_hw_sysfs_init(struct driver_data *dd, struct kobject *kobj) | |||
2272 | 2610 | ||
2273 | if (sysfs_create_file(kobj, &dev_attr_registers.attr)) | 2611 | if (sysfs_create_file(kobj, &dev_attr_registers.attr)) |
2274 | dev_warn(&dd->pdev->dev, | 2612 | dev_warn(&dd->pdev->dev, |
2275 | "Error creating registers sysfs entry\n"); | 2613 | "Error creating 'registers' sysfs entry\n"); |
2614 | if (sysfs_create_file(kobj, &dev_attr_status.attr)) | ||
2615 | dev_warn(&dd->pdev->dev, | ||
2616 | "Error creating 'status' sysfs entry\n"); | ||
2276 | return 0; | 2617 | return 0; |
2277 | } | 2618 | } |
2278 | 2619 | ||
@@ -2292,6 +2633,7 @@ static int mtip_hw_sysfs_exit(struct driver_data *dd, struct kobject *kobj) | |||
2292 | return -EINVAL; | 2633 | return -EINVAL; |
2293 | 2634 | ||
2294 | sysfs_remove_file(kobj, &dev_attr_registers.attr); | 2635 | sysfs_remove_file(kobj, &dev_attr_registers.attr); |
2636 | sysfs_remove_file(kobj, &dev_attr_status.attr); | ||
2295 | 2637 | ||
2296 | return 0; | 2638 | return 0; |
2297 | } | 2639 | } |
@@ -2384,10 +2726,12 @@ static int mtip_ftl_rebuild_poll(struct driver_data *dd) | |||
2384 | "FTL rebuild in progress. Polling for completion.\n"); | 2726 | "FTL rebuild in progress. Polling for completion.\n"); |
2385 | 2727 | ||
2386 | start = jiffies; | 2728 | start = jiffies; |
2387 | dd->ftlrebuildflag = 1; | ||
2388 | timeout = jiffies + msecs_to_jiffies(MTIP_FTL_REBUILD_TIMEOUT_MS); | 2729 | timeout = jiffies + msecs_to_jiffies(MTIP_FTL_REBUILD_TIMEOUT_MS); |
2389 | 2730 | ||
2390 | do { | 2731 | do { |
2732 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
2733 | &dd->dd_flag))) | ||
2734 | return -EFAULT; | ||
2391 | if (mtip_check_surprise_removal(dd->pdev)) | 2735 | if (mtip_check_surprise_removal(dd->pdev)) |
2392 | return -EFAULT; | 2736 | return -EFAULT; |
2393 | 2737 | ||
@@ -2408,22 +2752,17 @@ static int mtip_ftl_rebuild_poll(struct driver_data *dd) | |||
2408 | dev_warn(&dd->pdev->dev, | 2752 | dev_warn(&dd->pdev->dev, |
2409 | "FTL rebuild complete (%d secs).\n", | 2753 | "FTL rebuild complete (%d secs).\n", |
2410 | jiffies_to_msecs(jiffies - start) / 1000); | 2754 | jiffies_to_msecs(jiffies - start) / 1000); |
2411 | dd->ftlrebuildflag = 0; | ||
2412 | mtip_block_initialize(dd); | 2755 | mtip_block_initialize(dd); |
2413 | break; | 2756 | return 0; |
2414 | } | 2757 | } |
2415 | ssleep(10); | 2758 | ssleep(10); |
2416 | } while (time_before(jiffies, timeout)); | 2759 | } while (time_before(jiffies, timeout)); |
2417 | 2760 | ||
2418 | /* Check for timeout */ | 2761 | /* Check for timeout */ |
2419 | if (dd->ftlrebuildflag) { | 2762 | dev_err(&dd->pdev->dev, |
2420 | dev_err(&dd->pdev->dev, | ||
2421 | "Timed out waiting for FTL rebuild to complete (%d secs).\n", | 2763 | "Timed out waiting for FTL rebuild to complete (%d secs).\n", |
2422 | jiffies_to_msecs(jiffies - start) / 1000); | 2764 | jiffies_to_msecs(jiffies - start) / 1000); |
2423 | return -EFAULT; | 2765 | return -EFAULT; |
2424 | } | ||
2425 | |||
2426 | return 0; | ||
2427 | } | 2766 | } |
2428 | 2767 | ||
2429 | /* | 2768 | /* |
@@ -2448,14 +2787,17 @@ static int mtip_service_thread(void *data) | |||
2448 | * is in progress nor error handling is active | 2787 | * is in progress nor error handling is active |
2449 | */ | 2788 | */ |
2450 | wait_event_interruptible(port->svc_wait, (port->flags) && | 2789 | wait_event_interruptible(port->svc_wait, (port->flags) && |
2451 | !test_bit(MTIP_FLAG_IC_ACTIVE_BIT, &port->flags) && | 2790 | !(port->flags & MTIP_PF_PAUSE_IO)); |
2452 | !test_bit(MTIP_FLAG_EH_ACTIVE_BIT, &port->flags)); | ||
2453 | 2791 | ||
2454 | if (kthread_should_stop()) | 2792 | if (kthread_should_stop()) |
2455 | break; | 2793 | break; |
2456 | 2794 | ||
2457 | set_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags); | 2795 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, |
2458 | if (test_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags)) { | 2796 | &dd->dd_flag))) |
2797 | break; | ||
2798 | |||
2799 | set_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags); | ||
2800 | if (test_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags)) { | ||
2459 | slot = 1; | 2801 | slot = 1; |
2460 | /* used to restrict the loop to one iteration */ | 2802 | /* used to restrict the loop to one iteration */ |
2461 | slot_start = num_cmd_slots; | 2803 | slot_start = num_cmd_slots; |
@@ -2480,21 +2822,19 @@ static int mtip_service_thread(void *data) | |||
2480 | /* Issue the command to the hardware */ | 2822 | /* Issue the command to the hardware */ |
2481 | mtip_issue_ncq_command(port, slot); | 2823 | mtip_issue_ncq_command(port, slot); |
2482 | 2824 | ||
2483 | /* Set the command's timeout value.*/ | ||
2484 | port->commands[slot].comp_time = jiffies + | ||
2485 | msecs_to_jiffies(MTIP_NCQ_COMMAND_TIMEOUT_MS); | ||
2486 | |||
2487 | clear_bit(slot, port->cmds_to_issue); | 2825 | clear_bit(slot, port->cmds_to_issue); |
2488 | } | 2826 | } |
2489 | 2827 | ||
2490 | clear_bit(MTIP_FLAG_ISSUE_CMDS_BIT, &port->flags); | 2828 | clear_bit(MTIP_PF_ISSUE_CMDS_BIT, &port->flags); |
2491 | } else if (test_bit(MTIP_FLAG_REBUILD_BIT, &port->flags)) { | 2829 | } else if (test_bit(MTIP_PF_REBUILD_BIT, &port->flags)) { |
2492 | mtip_ftl_rebuild_poll(dd); | 2830 | if (!mtip_ftl_rebuild_poll(dd)) |
2493 | clear_bit(MTIP_FLAG_REBUILD_BIT, &port->flags); | 2831 | set_bit(MTIP_DDF_REBUILD_FAILED_BIT, |
2832 | &dd->dd_flag); | ||
2833 | clear_bit(MTIP_PF_REBUILD_BIT, &port->flags); | ||
2494 | } | 2834 | } |
2495 | clear_bit(MTIP_FLAG_SVC_THD_ACTIVE_BIT, &port->flags); | 2835 | clear_bit(MTIP_PF_SVC_THD_ACTIVE_BIT, &port->flags); |
2496 | 2836 | ||
2497 | if (test_bit(MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT, &port->flags)) | 2837 | if (test_bit(MTIP_PF_SVC_THD_STOP_BIT, &port->flags)) |
2498 | break; | 2838 | break; |
2499 | } | 2839 | } |
2500 | return 0; | 2840 | return 0; |
@@ -2513,6 +2853,9 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2513 | int i; | 2853 | int i; |
2514 | int rv; | 2854 | int rv; |
2515 | unsigned int num_command_slots; | 2855 | unsigned int num_command_slots; |
2856 | unsigned long timeout, timetaken; | ||
2857 | unsigned char *buf; | ||
2858 | struct smart_attr attr242; | ||
2516 | 2859 | ||
2517 | dd->mmio = pcim_iomap_table(dd->pdev)[MTIP_ABAR]; | 2860 | dd->mmio = pcim_iomap_table(dd->pdev)[MTIP_ABAR]; |
2518 | 2861 | ||
@@ -2547,7 +2890,7 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2547 | /* Allocate memory for the command list. */ | 2890 | /* Allocate memory for the command list. */ |
2548 | dd->port->command_list = | 2891 | dd->port->command_list = |
2549 | dmam_alloc_coherent(&dd->pdev->dev, | 2892 | dmam_alloc_coherent(&dd->pdev->dev, |
2550 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2), | 2893 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4), |
2551 | &dd->port->command_list_dma, | 2894 | &dd->port->command_list_dma, |
2552 | GFP_KERNEL); | 2895 | GFP_KERNEL); |
2553 | if (!dd->port->command_list) { | 2896 | if (!dd->port->command_list) { |
@@ -2560,7 +2903,7 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2560 | /* Clear the memory we have allocated. */ | 2903 | /* Clear the memory we have allocated. */ |
2561 | memset(dd->port->command_list, | 2904 | memset(dd->port->command_list, |
2562 | 0, | 2905 | 0, |
2563 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2)); | 2906 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4)); |
2564 | 2907 | ||
2565 | /* Setup the addresse of the RX FIS. */ | 2908 | /* Setup the addresse of the RX FIS. */ |
2566 | dd->port->rxfis = dd->port->command_list + HW_CMD_SLOT_SZ; | 2909 | dd->port->rxfis = dd->port->command_list + HW_CMD_SLOT_SZ; |
@@ -2576,10 +2919,19 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2576 | dd->port->identify_dma = dd->port->command_tbl_dma + | 2919 | dd->port->identify_dma = dd->port->command_tbl_dma + |
2577 | HW_CMD_TBL_AR_SZ; | 2920 | HW_CMD_TBL_AR_SZ; |
2578 | 2921 | ||
2579 | /* Setup the address of the sector buffer. */ | 2922 | /* Setup the address of the sector buffer - for some non-ncq cmds */ |
2580 | dd->port->sector_buffer = (void *) dd->port->identify + ATA_SECT_SIZE; | 2923 | dd->port->sector_buffer = (void *) dd->port->identify + ATA_SECT_SIZE; |
2581 | dd->port->sector_buffer_dma = dd->port->identify_dma + ATA_SECT_SIZE; | 2924 | dd->port->sector_buffer_dma = dd->port->identify_dma + ATA_SECT_SIZE; |
2582 | 2925 | ||
2926 | /* Setup the address of the log buf - for read log command */ | ||
2927 | dd->port->log_buf = (void *)dd->port->sector_buffer + ATA_SECT_SIZE; | ||
2928 | dd->port->log_buf_dma = dd->port->sector_buffer_dma + ATA_SECT_SIZE; | ||
2929 | |||
2930 | /* Setup the address of the smart buf - for smart read data command */ | ||
2931 | dd->port->smart_buf = (void *)dd->port->log_buf + ATA_SECT_SIZE; | ||
2932 | dd->port->smart_buf_dma = dd->port->log_buf_dma + ATA_SECT_SIZE; | ||
2933 | |||
2934 | |||
2583 | /* Point the command headers at the command tables. */ | 2935 | /* Point the command headers at the command tables. */ |
2584 | for (i = 0; i < num_command_slots; i++) { | 2936 | for (i = 0; i < num_command_slots; i++) { |
2585 | dd->port->commands[i].command_header = | 2937 | dd->port->commands[i].command_header = |
@@ -2623,14 +2975,43 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2623 | dd->port->mmio + i*0x80 + PORT_SDBV; | 2975 | dd->port->mmio + i*0x80 + PORT_SDBV; |
2624 | } | 2976 | } |
2625 | 2977 | ||
2626 | /* Reset the HBA. */ | 2978 | timetaken = jiffies; |
2627 | if (mtip_hba_reset(dd) < 0) { | 2979 | timeout = jiffies + msecs_to_jiffies(30000); |
2628 | dev_err(&dd->pdev->dev, | 2980 | while (((readl(dd->port->mmio + PORT_SCR_STAT) & 0x0F) != 0x03) && |
2629 | "Card did not reset within timeout\n"); | 2981 | time_before(jiffies, timeout)) { |
2630 | rv = -EIO; | 2982 | mdelay(100); |
2983 | } | ||
2984 | if (unlikely(mtip_check_surprise_removal(dd->pdev))) { | ||
2985 | timetaken = jiffies - timetaken; | ||
2986 | dev_warn(&dd->pdev->dev, | ||
2987 | "Surprise removal detected at %u ms\n", | ||
2988 | jiffies_to_msecs(timetaken)); | ||
2989 | rv = -ENODEV; | ||
2990 | goto out2 ; | ||
2991 | } | ||
2992 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) { | ||
2993 | timetaken = jiffies - timetaken; | ||
2994 | dev_warn(&dd->pdev->dev, | ||
2995 | "Removal detected at %u ms\n", | ||
2996 | jiffies_to_msecs(timetaken)); | ||
2997 | rv = -EFAULT; | ||
2631 | goto out2; | 2998 | goto out2; |
2632 | } | 2999 | } |
2633 | 3000 | ||
3001 | /* Conditionally reset the HBA. */ | ||
3002 | if (!(readl(dd->mmio + HOST_CAP) & HOST_CAP_NZDMA)) { | ||
3003 | if (mtip_hba_reset(dd) < 0) { | ||
3004 | dev_err(&dd->pdev->dev, | ||
3005 | "Card did not reset within timeout\n"); | ||
3006 | rv = -EIO; | ||
3007 | goto out2; | ||
3008 | } | ||
3009 | } else { | ||
3010 | /* Clear any pending interrupts on the HBA */ | ||
3011 | writel(readl(dd->mmio + HOST_IRQ_STAT), | ||
3012 | dd->mmio + HOST_IRQ_STAT); | ||
3013 | } | ||
3014 | |||
2634 | mtip_init_port(dd->port); | 3015 | mtip_init_port(dd->port); |
2635 | mtip_start_port(dd->port); | 3016 | mtip_start_port(dd->port); |
2636 | 3017 | ||
@@ -2660,6 +3041,12 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2660 | mod_timer(&dd->port->cmd_timer, | 3041 | mod_timer(&dd->port->cmd_timer, |
2661 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); | 3042 | jiffies + msecs_to_jiffies(MTIP_TIMEOUT_CHECK_PERIOD)); |
2662 | 3043 | ||
3044 | |||
3045 | if (test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)) { | ||
3046 | rv = -EFAULT; | ||
3047 | goto out3; | ||
3048 | } | ||
3049 | |||
2663 | if (mtip_get_identify(dd->port, NULL) < 0) { | 3050 | if (mtip_get_identify(dd->port, NULL) < 0) { |
2664 | rv = -EFAULT; | 3051 | rv = -EFAULT; |
2665 | goto out3; | 3052 | goto out3; |
@@ -2667,10 +3054,47 @@ static int mtip_hw_init(struct driver_data *dd) | |||
2667 | 3054 | ||
2668 | if (*(dd->port->identify + MTIP_FTL_REBUILD_OFFSET) == | 3055 | if (*(dd->port->identify + MTIP_FTL_REBUILD_OFFSET) == |
2669 | MTIP_FTL_REBUILD_MAGIC) { | 3056 | MTIP_FTL_REBUILD_MAGIC) { |
2670 | set_bit(MTIP_FLAG_REBUILD_BIT, &dd->port->flags); | 3057 | set_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags); |
2671 | return MTIP_FTL_REBUILD_MAGIC; | 3058 | return MTIP_FTL_REBUILD_MAGIC; |
2672 | } | 3059 | } |
2673 | mtip_dump_identify(dd->port); | 3060 | mtip_dump_identify(dd->port); |
3061 | |||
3062 | /* check write protect, over temp and rebuild statuses */ | ||
3063 | rv = mtip_read_log_page(dd->port, ATA_LOG_SATA_NCQ, | ||
3064 | dd->port->log_buf, | ||
3065 | dd->port->log_buf_dma, 1); | ||
3066 | if (rv) { | ||
3067 | dev_warn(&dd->pdev->dev, | ||
3068 | "Error in READ LOG EXT (10h) command\n"); | ||
3069 | /* non-critical error, don't fail the load */ | ||
3070 | } else { | ||
3071 | buf = (unsigned char *)dd->port->log_buf; | ||
3072 | if (buf[259] & 0x1) { | ||
3073 | dev_info(&dd->pdev->dev, | ||
3074 | "Write protect bit is set.\n"); | ||
3075 | set_bit(MTIP_DDF_WRITE_PROTECT_BIT, &dd->dd_flag); | ||
3076 | } | ||
3077 | if (buf[288] == 0xF7) { | ||
3078 | dev_info(&dd->pdev->dev, | ||
3079 | "Exceeded Tmax, drive in thermal shutdown.\n"); | ||
3080 | set_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag); | ||
3081 | } | ||
3082 | if (buf[288] == 0xBF) { | ||
3083 | dev_info(&dd->pdev->dev, | ||
3084 | "Drive indicates rebuild has failed.\n"); | ||
3085 | /* TODO */ | ||
3086 | } | ||
3087 | } | ||
3088 | |||
3089 | /* get write protect progess */ | ||
3090 | memset(&attr242, 0, sizeof(struct smart_attr)); | ||
3091 | if (mtip_get_smart_attr(dd->port, 242, &attr242)) | ||
3092 | dev_warn(&dd->pdev->dev, | ||
3093 | "Unable to check write protect progress\n"); | ||
3094 | else | ||
3095 | dev_info(&dd->pdev->dev, | ||
3096 | "Write protect progress: %d%% (%d blocks)\n", | ||
3097 | attr242.cur, attr242.data); | ||
2674 | return rv; | 3098 | return rv; |
2675 | 3099 | ||
2676 | out3: | 3100 | out3: |
@@ -2688,7 +3112,7 @@ out2: | |||
2688 | 3112 | ||
2689 | /* Free the command/command header memory. */ | 3113 | /* Free the command/command header memory. */ |
2690 | dmam_free_coherent(&dd->pdev->dev, | 3114 | dmam_free_coherent(&dd->pdev->dev, |
2691 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2), | 3115 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4), |
2692 | dd->port->command_list, | 3116 | dd->port->command_list, |
2693 | dd->port->command_list_dma); | 3117 | dd->port->command_list_dma); |
2694 | out1: | 3118 | out1: |
@@ -2712,9 +3136,12 @@ static int mtip_hw_exit(struct driver_data *dd) | |||
2712 | * Send standby immediate (E0h) to the drive so that it | 3136 | * Send standby immediate (E0h) to the drive so that it |
2713 | * saves its state. | 3137 | * saves its state. |
2714 | */ | 3138 | */ |
2715 | if (atomic_read(&dd->drv_cleanup_done) != true) { | 3139 | if (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) { |
2716 | 3140 | ||
2717 | mtip_standby_immediate(dd->port); | 3141 | if (!test_bit(MTIP_PF_REBUILD_BIT, &dd->port->flags)) |
3142 | if (mtip_standby_immediate(dd->port)) | ||
3143 | dev_warn(&dd->pdev->dev, | ||
3144 | "STANDBY IMMEDIATE failed\n"); | ||
2718 | 3145 | ||
2719 | /* de-initialize the port. */ | 3146 | /* de-initialize the port. */ |
2720 | mtip_deinit_port(dd->port); | 3147 | mtip_deinit_port(dd->port); |
@@ -2734,7 +3161,7 @@ static int mtip_hw_exit(struct driver_data *dd) | |||
2734 | 3161 | ||
2735 | /* Free the command/command header memory. */ | 3162 | /* Free the command/command header memory. */ |
2736 | dmam_free_coherent(&dd->pdev->dev, | 3163 | dmam_free_coherent(&dd->pdev->dev, |
2737 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 2), | 3164 | HW_PORT_PRIV_DMA_SZ + (ATA_SECT_SIZE * 4), |
2738 | dd->port->command_list, | 3165 | dd->port->command_list, |
2739 | dd->port->command_list_dma); | 3166 | dd->port->command_list_dma); |
2740 | /* Free the memory allocated for the for structure. */ | 3167 | /* Free the memory allocated for the for structure. */ |
@@ -2892,6 +3319,9 @@ static int mtip_block_ioctl(struct block_device *dev, | |||
2892 | if (!dd) | 3319 | if (!dd) |
2893 | return -ENOTTY; | 3320 | return -ENOTTY; |
2894 | 3321 | ||
3322 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) | ||
3323 | return -ENOTTY; | ||
3324 | |||
2895 | switch (cmd) { | 3325 | switch (cmd) { |
2896 | case BLKFLSBUF: | 3326 | case BLKFLSBUF: |
2897 | return -ENOTTY; | 3327 | return -ENOTTY; |
@@ -2927,6 +3357,9 @@ static int mtip_block_compat_ioctl(struct block_device *dev, | |||
2927 | if (!dd) | 3357 | if (!dd) |
2928 | return -ENOTTY; | 3358 | return -ENOTTY; |
2929 | 3359 | ||
3360 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag))) | ||
3361 | return -ENOTTY; | ||
3362 | |||
2930 | switch (cmd) { | 3363 | switch (cmd) { |
2931 | case BLKFLSBUF: | 3364 | case BLKFLSBUF: |
2932 | return -ENOTTY; | 3365 | return -ENOTTY; |
@@ -3049,6 +3482,24 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) | |||
3049 | int nents = 0; | 3482 | int nents = 0; |
3050 | int tag = 0; | 3483 | int tag = 0; |
3051 | 3484 | ||
3485 | if (unlikely(dd->dd_flag & MTIP_DDF_STOP_IO)) { | ||
3486 | if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, | ||
3487 | &dd->dd_flag))) { | ||
3488 | bio_endio(bio, -ENXIO); | ||
3489 | return; | ||
3490 | } | ||
3491 | if (unlikely(test_bit(MTIP_DDF_OVER_TEMP_BIT, &dd->dd_flag))) { | ||
3492 | bio_endio(bio, -ENODATA); | ||
3493 | return; | ||
3494 | } | ||
3495 | if (unlikely(test_bit(MTIP_DDF_WRITE_PROTECT_BIT, | ||
3496 | &dd->dd_flag) && | ||
3497 | bio_data_dir(bio))) { | ||
3498 | bio_endio(bio, -ENODATA); | ||
3499 | return; | ||
3500 | } | ||
3501 | } | ||
3502 | |||
3052 | if (unlikely(!bio_has_data(bio))) { | 3503 | if (unlikely(!bio_has_data(bio))) { |
3053 | blk_queue_flush(queue, 0); | 3504 | blk_queue_flush(queue, 0); |
3054 | bio_endio(bio, 0); | 3505 | bio_endio(bio, 0); |
@@ -3061,7 +3512,7 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) | |||
3061 | 3512 | ||
3062 | if (unlikely((bio)->bi_vcnt > MTIP_MAX_SG)) { | 3513 | if (unlikely((bio)->bi_vcnt > MTIP_MAX_SG)) { |
3063 | dev_warn(&dd->pdev->dev, | 3514 | dev_warn(&dd->pdev->dev, |
3064 | "Maximum number of SGL entries exceeded"); | 3515 | "Maximum number of SGL entries exceeded\n"); |
3065 | bio_io_error(bio); | 3516 | bio_io_error(bio); |
3066 | mtip_hw_release_scatterlist(dd, tag); | 3517 | mtip_hw_release_scatterlist(dd, tag); |
3067 | return; | 3518 | return; |
@@ -3210,8 +3661,10 @@ skip_create_disk: | |||
3210 | kobject_put(kobj); | 3661 | kobject_put(kobj); |
3211 | } | 3662 | } |
3212 | 3663 | ||
3213 | if (dd->mtip_svc_handler) | 3664 | if (dd->mtip_svc_handler) { |
3665 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); | ||
3214 | return rv; /* service thread created for handling rebuild */ | 3666 | return rv; /* service thread created for handling rebuild */ |
3667 | } | ||
3215 | 3668 | ||
3216 | start_service_thread: | 3669 | start_service_thread: |
3217 | sprintf(thd_name, "mtip_svc_thd_%02d", index); | 3670 | sprintf(thd_name, "mtip_svc_thd_%02d", index); |
@@ -3220,12 +3673,15 @@ start_service_thread: | |||
3220 | dd, thd_name); | 3673 | dd, thd_name); |
3221 | 3674 | ||
3222 | if (IS_ERR(dd->mtip_svc_handler)) { | 3675 | if (IS_ERR(dd->mtip_svc_handler)) { |
3223 | printk(KERN_ERR "mtip32xx: service thread failed to start\n"); | 3676 | dev_err(&dd->pdev->dev, "service thread failed to start\n"); |
3224 | dd->mtip_svc_handler = NULL; | 3677 | dd->mtip_svc_handler = NULL; |
3225 | rv = -EFAULT; | 3678 | rv = -EFAULT; |
3226 | goto kthread_run_error; | 3679 | goto kthread_run_error; |
3227 | } | 3680 | } |
3228 | 3681 | ||
3682 | if (wait_for_rebuild == MTIP_FTL_REBUILD_MAGIC) | ||
3683 | rv = wait_for_rebuild; | ||
3684 | |||
3229 | return rv; | 3685 | return rv; |
3230 | 3686 | ||
3231 | kthread_run_error: | 3687 | kthread_run_error: |
@@ -3266,16 +3722,18 @@ static int mtip_block_remove(struct driver_data *dd) | |||
3266 | struct kobject *kobj; | 3722 | struct kobject *kobj; |
3267 | 3723 | ||
3268 | if (dd->mtip_svc_handler) { | 3724 | if (dd->mtip_svc_handler) { |
3269 | set_bit(MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT, &dd->port->flags); | 3725 | set_bit(MTIP_PF_SVC_THD_STOP_BIT, &dd->port->flags); |
3270 | wake_up_interruptible(&dd->port->svc_wait); | 3726 | wake_up_interruptible(&dd->port->svc_wait); |
3271 | kthread_stop(dd->mtip_svc_handler); | 3727 | kthread_stop(dd->mtip_svc_handler); |
3272 | } | 3728 | } |
3273 | 3729 | ||
3274 | /* Clean up the sysfs attributes managed by the protocol layer. */ | 3730 | /* Clean up the sysfs attributes, if created */ |
3275 | kobj = kobject_get(&disk_to_dev(dd->disk)->kobj); | 3731 | if (test_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag)) { |
3276 | if (kobj) { | 3732 | kobj = kobject_get(&disk_to_dev(dd->disk)->kobj); |
3277 | mtip_hw_sysfs_exit(dd, kobj); | 3733 | if (kobj) { |
3278 | kobject_put(kobj); | 3734 | mtip_hw_sysfs_exit(dd, kobj); |
3735 | kobject_put(kobj); | ||
3736 | } | ||
3279 | } | 3737 | } |
3280 | 3738 | ||
3281 | /* | 3739 | /* |
@@ -3283,6 +3741,11 @@ static int mtip_block_remove(struct driver_data *dd) | |||
3283 | * from /dev | 3741 | * from /dev |
3284 | */ | 3742 | */ |
3285 | del_gendisk(dd->disk); | 3743 | del_gendisk(dd->disk); |
3744 | |||
3745 | spin_lock(&rssd_index_lock); | ||
3746 | ida_remove(&rssd_index_ida, dd->index); | ||
3747 | spin_unlock(&rssd_index_lock); | ||
3748 | |||
3286 | blk_cleanup_queue(dd->queue); | 3749 | blk_cleanup_queue(dd->queue); |
3287 | dd->disk = NULL; | 3750 | dd->disk = NULL; |
3288 | dd->queue = NULL; | 3751 | dd->queue = NULL; |
@@ -3312,6 +3775,11 @@ static int mtip_block_shutdown(struct driver_data *dd) | |||
3312 | 3775 | ||
3313 | /* Delete our gendisk structure, and cleanup the blk queue. */ | 3776 | /* Delete our gendisk structure, and cleanup the blk queue. */ |
3314 | del_gendisk(dd->disk); | 3777 | del_gendisk(dd->disk); |
3778 | |||
3779 | spin_lock(&rssd_index_lock); | ||
3780 | ida_remove(&rssd_index_ida, dd->index); | ||
3781 | spin_unlock(&rssd_index_lock); | ||
3782 | |||
3315 | blk_cleanup_queue(dd->queue); | 3783 | blk_cleanup_queue(dd->queue); |
3316 | dd->disk = NULL; | 3784 | dd->disk = NULL; |
3317 | dd->queue = NULL; | 3785 | dd->queue = NULL; |
@@ -3359,11 +3827,6 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
3359 | return -ENOMEM; | 3827 | return -ENOMEM; |
3360 | } | 3828 | } |
3361 | 3829 | ||
3362 | /* Set the atomic variable as 1 in case of SRSI */ | ||
3363 | atomic_set(&dd->drv_cleanup_done, true); | ||
3364 | |||
3365 | atomic_set(&dd->resumeflag, false); | ||
3366 | |||
3367 | /* Attach the private data to this PCI device. */ | 3830 | /* Attach the private data to this PCI device. */ |
3368 | pci_set_drvdata(pdev, dd); | 3831 | pci_set_drvdata(pdev, dd); |
3369 | 3832 | ||
@@ -3420,7 +3883,8 @@ static int mtip_pci_probe(struct pci_dev *pdev, | |||
3420 | * instance number. | 3883 | * instance number. |
3421 | */ | 3884 | */ |
3422 | instance++; | 3885 | instance++; |
3423 | 3886 | if (rv != MTIP_FTL_REBUILD_MAGIC) | |
3887 | set_bit(MTIP_DDF_INIT_DONE_BIT, &dd->dd_flag); | ||
3424 | goto done; | 3888 | goto done; |
3425 | 3889 | ||
3426 | block_initialize_err: | 3890 | block_initialize_err: |
@@ -3434,9 +3898,6 @@ iomap_err: | |||
3434 | pci_set_drvdata(pdev, NULL); | 3898 | pci_set_drvdata(pdev, NULL); |
3435 | return rv; | 3899 | return rv; |
3436 | done: | 3900 | done: |
3437 | /* Set the atomic variable as 0 in case of SRSI */ | ||
3438 | atomic_set(&dd->drv_cleanup_done, true); | ||
3439 | |||
3440 | return rv; | 3901 | return rv; |
3441 | } | 3902 | } |
3442 | 3903 | ||
@@ -3452,8 +3913,10 @@ static void mtip_pci_remove(struct pci_dev *pdev) | |||
3452 | struct driver_data *dd = pci_get_drvdata(pdev); | 3913 | struct driver_data *dd = pci_get_drvdata(pdev); |
3453 | int counter = 0; | 3914 | int counter = 0; |
3454 | 3915 | ||
3916 | set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag); | ||
3917 | |||
3455 | if (mtip_check_surprise_removal(pdev)) { | 3918 | if (mtip_check_surprise_removal(pdev)) { |
3456 | while (atomic_read(&dd->drv_cleanup_done) == false) { | 3919 | while (!test_bit(MTIP_DDF_CLEANUP_BIT, &dd->dd_flag)) { |
3457 | counter++; | 3920 | counter++; |
3458 | msleep(20); | 3921 | msleep(20); |
3459 | if (counter == 10) { | 3922 | if (counter == 10) { |
@@ -3463,8 +3926,6 @@ static void mtip_pci_remove(struct pci_dev *pdev) | |||
3463 | } | 3926 | } |
3464 | } | 3927 | } |
3465 | } | 3928 | } |
3466 | /* Set the atomic variable as 1 in case of SRSI */ | ||
3467 | atomic_set(&dd->drv_cleanup_done, true); | ||
3468 | 3929 | ||
3469 | /* Clean up the block layer. */ | 3930 | /* Clean up the block layer. */ |
3470 | mtip_block_remove(dd); | 3931 | mtip_block_remove(dd); |
@@ -3493,7 +3954,7 @@ static int mtip_pci_suspend(struct pci_dev *pdev, pm_message_t mesg) | |||
3493 | return -EFAULT; | 3954 | return -EFAULT; |
3494 | } | 3955 | } |
3495 | 3956 | ||
3496 | atomic_set(&dd->resumeflag, true); | 3957 | set_bit(MTIP_DDF_RESUME_BIT, &dd->dd_flag); |
3497 | 3958 | ||
3498 | /* Disable ports & interrupts then send standby immediate */ | 3959 | /* Disable ports & interrupts then send standby immediate */ |
3499 | rv = mtip_block_suspend(dd); | 3960 | rv = mtip_block_suspend(dd); |
@@ -3559,7 +4020,7 @@ static int mtip_pci_resume(struct pci_dev *pdev) | |||
3559 | dev_err(&pdev->dev, "Unable to resume\n"); | 4020 | dev_err(&pdev->dev, "Unable to resume\n"); |
3560 | 4021 | ||
3561 | err: | 4022 | err: |
3562 | atomic_set(&dd->resumeflag, false); | 4023 | clear_bit(MTIP_DDF_RESUME_BIT, &dd->dd_flag); |
3563 | 4024 | ||
3564 | return rv; | 4025 | return rv; |
3565 | } | 4026 | } |
@@ -3608,18 +4069,25 @@ MODULE_DEVICE_TABLE(pci, mtip_pci_tbl); | |||
3608 | */ | 4069 | */ |
3609 | static int __init mtip_init(void) | 4070 | static int __init mtip_init(void) |
3610 | { | 4071 | { |
4072 | int error; | ||
4073 | |||
3611 | printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); | 4074 | printk(KERN_INFO MTIP_DRV_NAME " Version " MTIP_DRV_VERSION "\n"); |
3612 | 4075 | ||
3613 | /* Allocate a major block device number to use with this driver. */ | 4076 | /* Allocate a major block device number to use with this driver. */ |
3614 | mtip_major = register_blkdev(0, MTIP_DRV_NAME); | 4077 | error = register_blkdev(0, MTIP_DRV_NAME); |
3615 | if (mtip_major < 0) { | 4078 | if (error <= 0) { |
3616 | printk(KERN_ERR "Unable to register block device (%d)\n", | 4079 | printk(KERN_ERR "Unable to register block device (%d)\n", |
3617 | mtip_major); | 4080 | error); |
3618 | return -EBUSY; | 4081 | return -EBUSY; |
3619 | } | 4082 | } |
4083 | mtip_major = error; | ||
3620 | 4084 | ||
3621 | /* Register our PCI operations. */ | 4085 | /* Register our PCI operations. */ |
3622 | return pci_register_driver(&mtip_pci_driver); | 4086 | error = pci_register_driver(&mtip_pci_driver); |
4087 | if (error) | ||
4088 | unregister_blkdev(mtip_major, MTIP_DRV_NAME); | ||
4089 | |||
4090 | return error; | ||
3623 | } | 4091 | } |
3624 | 4092 | ||
3625 | /* | 4093 | /* |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index e0554a8f2233..4ef58336310a 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -34,8 +34,8 @@ | |||
34 | /* offset of Device Control register in PCIe extended capabilites space */ | 34 | /* offset of Device Control register in PCIe extended capabilites space */ |
35 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 | 35 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 |
36 | 36 | ||
37 | /* # of times to retry timed out IOs */ | 37 | /* # of times to retry timed out/failed IOs */ |
38 | #define MTIP_MAX_RETRIES 5 | 38 | #define MTIP_MAX_RETRIES 2 |
39 | 39 | ||
40 | /* Various timeout values in ms */ | 40 | /* Various timeout values in ms */ |
41 | #define MTIP_NCQ_COMMAND_TIMEOUT_MS 5000 | 41 | #define MTIP_NCQ_COMMAND_TIMEOUT_MS 5000 |
@@ -114,12 +114,41 @@ | |||
114 | #define __force_bit2int (unsigned int __force) | 114 | #define __force_bit2int (unsigned int __force) |
115 | 115 | ||
116 | /* below are bit numbers in 'flags' defined in mtip_port */ | 116 | /* below are bit numbers in 'flags' defined in mtip_port */ |
117 | #define MTIP_FLAG_IC_ACTIVE_BIT 0 | 117 | #define MTIP_PF_IC_ACTIVE_BIT 0 /* pio/ioctl */ |
118 | #define MTIP_FLAG_EH_ACTIVE_BIT 1 | 118 | #define MTIP_PF_EH_ACTIVE_BIT 1 /* error handling */ |
119 | #define MTIP_FLAG_SVC_THD_ACTIVE_BIT 2 | 119 | #define MTIP_PF_SE_ACTIVE_BIT 2 /* secure erase */ |
120 | #define MTIP_FLAG_ISSUE_CMDS_BIT 4 | 120 | #define MTIP_PF_DM_ACTIVE_BIT 3 /* download microcde */ |
121 | #define MTIP_FLAG_REBUILD_BIT 5 | 121 | #define MTIP_PF_PAUSE_IO ((1 << MTIP_PF_IC_ACTIVE_BIT) | \ |
122 | #define MTIP_FLAG_SVC_THD_SHOULD_STOP_BIT 8 | 122 | (1 << MTIP_PF_EH_ACTIVE_BIT) | \ |
123 | (1 << MTIP_PF_SE_ACTIVE_BIT) | \ | ||
124 | (1 << MTIP_PF_DM_ACTIVE_BIT)) | ||
125 | |||
126 | #define MTIP_PF_SVC_THD_ACTIVE_BIT 4 | ||
127 | #define MTIP_PF_ISSUE_CMDS_BIT 5 | ||
128 | #define MTIP_PF_REBUILD_BIT 6 | ||
129 | #define MTIP_PF_SVC_THD_STOP_BIT 8 | ||
130 | |||
131 | /* below are bit numbers in 'dd_flag' defined in driver_data */ | ||
132 | #define MTIP_DDF_REMOVE_PENDING_BIT 1 | ||
133 | #define MTIP_DDF_OVER_TEMP_BIT 2 | ||
134 | #define MTIP_DDF_WRITE_PROTECT_BIT 3 | ||
135 | #define MTIP_DDF_STOP_IO ((1 << MTIP_DDF_REMOVE_PENDING_BIT) | \ | ||
136 | (1 << MTIP_DDF_OVER_TEMP_BIT) | \ | ||
137 | (1 << MTIP_DDF_WRITE_PROTECT_BIT)) | ||
138 | |||
139 | #define MTIP_DDF_CLEANUP_BIT 5 | ||
140 | #define MTIP_DDF_RESUME_BIT 6 | ||
141 | #define MTIP_DDF_INIT_DONE_BIT 7 | ||
142 | #define MTIP_DDF_REBUILD_FAILED_BIT 8 | ||
143 | |||
144 | __packed struct smart_attr{ | ||
145 | u8 attr_id; | ||
146 | u16 flags; | ||
147 | u8 cur; | ||
148 | u8 worst; | ||
149 | u32 data; | ||
150 | u8 res[3]; | ||
151 | }; | ||
123 | 152 | ||
124 | /* Register Frame Information Structure (FIS), host to device. */ | 153 | /* Register Frame Information Structure (FIS), host to device. */ |
125 | struct host_to_dev_fis { | 154 | struct host_to_dev_fis { |
@@ -345,6 +374,12 @@ struct mtip_port { | |||
345 | * when the command slot and all associated data structures | 374 | * when the command slot and all associated data structures |
346 | * are no longer needed. | 375 | * are no longer needed. |
347 | */ | 376 | */ |
377 | u16 *log_buf; | ||
378 | dma_addr_t log_buf_dma; | ||
379 | |||
380 | u8 *smart_buf; | ||
381 | dma_addr_t smart_buf_dma; | ||
382 | |||
348 | unsigned long allocated[SLOTBITS_IN_LONGS]; | 383 | unsigned long allocated[SLOTBITS_IN_LONGS]; |
349 | /* | 384 | /* |
350 | * used to queue commands when an internal command is in progress | 385 | * used to queue commands when an internal command is in progress |
@@ -368,6 +403,7 @@ struct mtip_port { | |||
368 | * Timer used to complete commands that have been active for too long. | 403 | * Timer used to complete commands that have been active for too long. |
369 | */ | 404 | */ |
370 | struct timer_list cmd_timer; | 405 | struct timer_list cmd_timer; |
406 | unsigned long ic_pause_timer; | ||
371 | /* | 407 | /* |
372 | * Semaphore used to block threads if there are no | 408 | * Semaphore used to block threads if there are no |
373 | * command slots available. | 409 | * command slots available. |
@@ -404,13 +440,9 @@ struct driver_data { | |||
404 | 440 | ||
405 | unsigned slot_groups; /* number of slot groups the product supports */ | 441 | unsigned slot_groups; /* number of slot groups the product supports */ |
406 | 442 | ||
407 | atomic_t drv_cleanup_done; /* Atomic variable for SRSI */ | ||
408 | |||
409 | unsigned long index; /* Index to determine the disk name */ | 443 | unsigned long index; /* Index to determine the disk name */ |
410 | 444 | ||
411 | unsigned int ftlrebuildflag; /* FTL rebuild flag */ | 445 | unsigned long dd_flag; /* NOTE: use atomic bit operations on this */ |
412 | |||
413 | atomic_t resumeflag; /* Atomic variable to track suspend/resume */ | ||
414 | 446 | ||
415 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ | 447 | struct task_struct *mtip_svc_handler; /* task_struct of svc thd */ |
416 | }; | 448 | }; |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index c4a60badf252..0d39f2f4294a 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -351,6 +351,7 @@ static void virtblk_config_changed_work(struct work_struct *work) | |||
351 | cap_str_10, cap_str_2); | 351 | cap_str_10, cap_str_2); |
352 | 352 | ||
353 | set_capacity(vblk->disk, capacity); | 353 | set_capacity(vblk->disk, capacity); |
354 | revalidate_disk(vblk->disk); | ||
354 | done: | 355 | done: |
355 | mutex_unlock(&vblk->config_lock); | 356 | mutex_unlock(&vblk->config_lock); |
356 | } | 357 | } |
@@ -374,6 +375,34 @@ static int init_vq(struct virtio_blk *vblk) | |||
374 | return err; | 375 | return err; |
375 | } | 376 | } |
376 | 377 | ||
378 | /* | ||
379 | * Legacy naming scheme used for virtio devices. We are stuck with it for | ||
380 | * virtio blk but don't ever use it for any new driver. | ||
381 | */ | ||
382 | static int virtblk_name_format(char *prefix, int index, char *buf, int buflen) | ||
383 | { | ||
384 | const int base = 'z' - 'a' + 1; | ||
385 | char *begin = buf + strlen(prefix); | ||
386 | char *end = buf + buflen; | ||
387 | char *p; | ||
388 | int unit; | ||
389 | |||
390 | p = end - 1; | ||
391 | *p = '\0'; | ||
392 | unit = base; | ||
393 | do { | ||
394 | if (p == begin) | ||
395 | return -EINVAL; | ||
396 | *--p = 'a' + (index % unit); | ||
397 | index = (index / unit) - 1; | ||
398 | } while (index >= 0); | ||
399 | |||
400 | memmove(begin, p, end - p); | ||
401 | memcpy(buf, prefix, strlen(prefix)); | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | |||
377 | static int __devinit virtblk_probe(struct virtio_device *vdev) | 406 | static int __devinit virtblk_probe(struct virtio_device *vdev) |
378 | { | 407 | { |
379 | struct virtio_blk *vblk; | 408 | struct virtio_blk *vblk; |
@@ -442,18 +471,7 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
442 | 471 | ||
443 | q->queuedata = vblk; | 472 | q->queuedata = vblk; |
444 | 473 | ||
445 | if (index < 26) { | 474 | virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); |
446 | sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); | ||
447 | } else if (index < (26 + 1) * 26) { | ||
448 | sprintf(vblk->disk->disk_name, "vd%c%c", | ||
449 | 'a' + index / 26 - 1, 'a' + index % 26); | ||
450 | } else { | ||
451 | const unsigned int m1 = (index / 26 - 1) / 26 - 1; | ||
452 | const unsigned int m2 = (index / 26 - 1) % 26; | ||
453 | const unsigned int m3 = index % 26; | ||
454 | sprintf(vblk->disk->disk_name, "vd%c%c%c", | ||
455 | 'a' + m1, 'a' + m2, 'a' + m3); | ||
456 | } | ||
457 | 475 | ||
458 | vblk->disk->major = major; | 476 | vblk->disk->major = major; |
459 | vblk->disk->first_minor = index_to_minor(index); | 477 | vblk->disk->first_minor = index_to_minor(index); |
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 0088bf60f368..73f196ca713f 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c | |||
@@ -321,6 +321,7 @@ struct seg_buf { | |||
321 | static void xen_blkbk_unmap(struct pending_req *req) | 321 | static void xen_blkbk_unmap(struct pending_req *req) |
322 | { | 322 | { |
323 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 323 | struct gnttab_unmap_grant_ref unmap[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
324 | struct page *pages[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | ||
324 | unsigned int i, invcount = 0; | 325 | unsigned int i, invcount = 0; |
325 | grant_handle_t handle; | 326 | grant_handle_t handle; |
326 | int ret; | 327 | int ret; |
@@ -332,25 +333,12 @@ static void xen_blkbk_unmap(struct pending_req *req) | |||
332 | gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i), | 333 | gnttab_set_unmap_op(&unmap[invcount], vaddr(req, i), |
333 | GNTMAP_host_map, handle); | 334 | GNTMAP_host_map, handle); |
334 | pending_handle(req, i) = BLKBACK_INVALID_HANDLE; | 335 | pending_handle(req, i) = BLKBACK_INVALID_HANDLE; |
336 | pages[invcount] = virt_to_page(vaddr(req, i)); | ||
335 | invcount++; | 337 | invcount++; |
336 | } | 338 | } |
337 | 339 | ||
338 | ret = HYPERVISOR_grant_table_op( | 340 | ret = gnttab_unmap_refs(unmap, pages, invcount, false); |
339 | GNTTABOP_unmap_grant_ref, unmap, invcount); | ||
340 | BUG_ON(ret); | 341 | BUG_ON(ret); |
341 | /* | ||
342 | * Note, we use invcount, so nr->pages, so we can't index | ||
343 | * using vaddr(req, i). | ||
344 | */ | ||
345 | for (i = 0; i < invcount; i++) { | ||
346 | ret = m2p_remove_override( | ||
347 | virt_to_page(unmap[i].host_addr), false); | ||
348 | if (ret) { | ||
349 | pr_alert(DRV_PFX "Failed to remove M2P override for %lx\n", | ||
350 | (unsigned long)unmap[i].host_addr); | ||
351 | continue; | ||
352 | } | ||
353 | } | ||
354 | } | 342 | } |
355 | 343 | ||
356 | static int xen_blkbk_map(struct blkif_request *req, | 344 | static int xen_blkbk_map(struct blkif_request *req, |
@@ -378,7 +366,7 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
378 | pending_req->blkif->domid); | 366 | pending_req->blkif->domid); |
379 | } | 367 | } |
380 | 368 | ||
381 | ret = HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, map, nseg); | 369 | ret = gnttab_map_refs(map, NULL, &blkbk->pending_page(pending_req, 0), nseg); |
382 | BUG_ON(ret); | 370 | BUG_ON(ret); |
383 | 371 | ||
384 | /* | 372 | /* |
@@ -398,15 +386,6 @@ static int xen_blkbk_map(struct blkif_request *req, | |||
398 | if (ret) | 386 | if (ret) |
399 | continue; | 387 | continue; |
400 | 388 | ||
401 | ret = m2p_add_override(PFN_DOWN(map[i].dev_bus_addr), | ||
402 | blkbk->pending_page(pending_req, i), NULL); | ||
403 | if (ret) { | ||
404 | pr_alert(DRV_PFX "Failed to install M2P override for %lx (ret: %d)\n", | ||
405 | (unsigned long)map[i].dev_bus_addr, ret); | ||
406 | /* We could switch over to GNTTABOP_copy */ | ||
407 | continue; | ||
408 | } | ||
409 | |||
410 | seg[i].buf = map[i].dev_bus_addr | | 389 | seg[i].buf = map[i].dev_bus_addr | |
411 | (req->u.rw.seg[i].first_sect << 9); | 390 | (req->u.rw.seg[i].first_sect << 9); |
412 | } | 391 | } |
@@ -419,21 +398,18 @@ static int dispatch_discard_io(struct xen_blkif *blkif, | |||
419 | int err = 0; | 398 | int err = 0; |
420 | int status = BLKIF_RSP_OKAY; | 399 | int status = BLKIF_RSP_OKAY; |
421 | struct block_device *bdev = blkif->vbd.bdev; | 400 | struct block_device *bdev = blkif->vbd.bdev; |
401 | unsigned long secure; | ||
422 | 402 | ||
423 | blkif->st_ds_req++; | 403 | blkif->st_ds_req++; |
424 | 404 | ||
425 | xen_blkif_get(blkif); | 405 | xen_blkif_get(blkif); |
426 | if (blkif->blk_backend_type == BLKIF_BACKEND_PHY || | 406 | secure = (blkif->vbd.discard_secure && |
427 | blkif->blk_backend_type == BLKIF_BACKEND_FILE) { | 407 | (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ? |
428 | unsigned long secure = (blkif->vbd.discard_secure && | 408 | BLKDEV_DISCARD_SECURE : 0; |
429 | (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ? | 409 | |
430 | BLKDEV_DISCARD_SECURE : 0; | 410 | err = blkdev_issue_discard(bdev, req->u.discard.sector_number, |
431 | err = blkdev_issue_discard(bdev, | 411 | req->u.discard.nr_sectors, |
432 | req->u.discard.sector_number, | 412 | GFP_KERNEL, secure); |
433 | req->u.discard.nr_sectors, | ||
434 | GFP_KERNEL, secure); | ||
435 | } else | ||
436 | err = -EOPNOTSUPP; | ||
437 | 413 | ||
438 | if (err == -EOPNOTSUPP) { | 414 | if (err == -EOPNOTSUPP) { |
439 | pr_debug(DRV_PFX "discard op failed, not supported\n"); | 415 | pr_debug(DRV_PFX "discard op failed, not supported\n"); |
@@ -830,7 +806,7 @@ static int __init xen_blkif_init(void) | |||
830 | int i, mmap_pages; | 806 | int i, mmap_pages; |
831 | int rc = 0; | 807 | int rc = 0; |
832 | 808 | ||
833 | if (!xen_pv_domain()) | 809 | if (!xen_domain()) |
834 | return -ENODEV; | 810 | return -ENODEV; |
835 | 811 | ||
836 | blkbk = kzalloc(sizeof(struct xen_blkbk), GFP_KERNEL); | 812 | blkbk = kzalloc(sizeof(struct xen_blkbk), GFP_KERNEL); |
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index d0ee7edc9be8..773cf27dc23f 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -146,11 +146,6 @@ enum blkif_protocol { | |||
146 | BLKIF_PROTOCOL_X86_64 = 3, | 146 | BLKIF_PROTOCOL_X86_64 = 3, |
147 | }; | 147 | }; |
148 | 148 | ||
149 | enum blkif_backend_type { | ||
150 | BLKIF_BACKEND_PHY = 1, | ||
151 | BLKIF_BACKEND_FILE = 2, | ||
152 | }; | ||
153 | |||
154 | struct xen_vbd { | 149 | struct xen_vbd { |
155 | /* What the domain refers to this vbd as. */ | 150 | /* What the domain refers to this vbd as. */ |
156 | blkif_vdev_t handle; | 151 | blkif_vdev_t handle; |
@@ -177,7 +172,6 @@ struct xen_blkif { | |||
177 | unsigned int irq; | 172 | unsigned int irq; |
178 | /* Comms information. */ | 173 | /* Comms information. */ |
179 | enum blkif_protocol blk_protocol; | 174 | enum blkif_protocol blk_protocol; |
180 | enum blkif_backend_type blk_backend_type; | ||
181 | union blkif_back_rings blk_rings; | 175 | union blkif_back_rings blk_rings; |
182 | void *blk_ring; | 176 | void *blk_ring; |
183 | /* The VBD attached to this interface. */ | 177 | /* The VBD attached to this interface. */ |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 24a2fb57e5d0..4f66171c6683 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -381,72 +381,49 @@ int xen_blkbk_flush_diskcache(struct xenbus_transaction xbt, | |||
381 | err = xenbus_printf(xbt, dev->nodename, "feature-flush-cache", | 381 | err = xenbus_printf(xbt, dev->nodename, "feature-flush-cache", |
382 | "%d", state); | 382 | "%d", state); |
383 | if (err) | 383 | if (err) |
384 | xenbus_dev_fatal(dev, err, "writing feature-flush-cache"); | 384 | dev_warn(&dev->dev, "writing feature-flush-cache (%d)", err); |
385 | 385 | ||
386 | return err; | 386 | return err; |
387 | } | 387 | } |
388 | 388 | ||
389 | int xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) | 389 | static void xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be) |
390 | { | 390 | { |
391 | struct xenbus_device *dev = be->dev; | 391 | struct xenbus_device *dev = be->dev; |
392 | struct xen_blkif *blkif = be->blkif; | 392 | struct xen_blkif *blkif = be->blkif; |
393 | char *type; | ||
394 | int err; | 393 | int err; |
395 | int state = 0; | 394 | int state = 0; |
395 | struct block_device *bdev = be->blkif->vbd.bdev; | ||
396 | struct request_queue *q = bdev_get_queue(bdev); | ||
396 | 397 | ||
397 | type = xenbus_read(XBT_NIL, dev->nodename, "type", NULL); | 398 | if (blk_queue_discard(q)) { |
398 | if (!IS_ERR(type)) { | 399 | err = xenbus_printf(xbt, dev->nodename, |
399 | if (strncmp(type, "file", 4) == 0) { | 400 | "discard-granularity", "%u", |
400 | state = 1; | 401 | q->limits.discard_granularity); |
401 | blkif->blk_backend_type = BLKIF_BACKEND_FILE; | 402 | if (err) { |
403 | dev_warn(&dev->dev, "writing discard-granularity (%d)", err); | ||
404 | return; | ||
402 | } | 405 | } |
403 | if (strncmp(type, "phy", 3) == 0) { | 406 | err = xenbus_printf(xbt, dev->nodename, |
404 | struct block_device *bdev = be->blkif->vbd.bdev; | 407 | "discard-alignment", "%u", |
405 | struct request_queue *q = bdev_get_queue(bdev); | 408 | q->limits.discard_alignment); |
406 | if (blk_queue_discard(q)) { | 409 | if (err) { |
407 | err = xenbus_printf(xbt, dev->nodename, | 410 | dev_warn(&dev->dev, "writing discard-alignment (%d)", err); |
408 | "discard-granularity", "%u", | 411 | return; |
409 | q->limits.discard_granularity); | 412 | } |
410 | if (err) { | 413 | state = 1; |
411 | xenbus_dev_fatal(dev, err, | 414 | /* Optional. */ |
412 | "writing discard-granularity"); | 415 | err = xenbus_printf(xbt, dev->nodename, |
413 | goto kfree; | 416 | "discard-secure", "%d", |
414 | } | 417 | blkif->vbd.discard_secure); |
415 | err = xenbus_printf(xbt, dev->nodename, | 418 | if (err) { |
416 | "discard-alignment", "%u", | 419 | dev_warn(&dev->dev, "writing discard-secure (%d)", err); |
417 | q->limits.discard_alignment); | 420 | return; |
418 | if (err) { | ||
419 | xenbus_dev_fatal(dev, err, | ||
420 | "writing discard-alignment"); | ||
421 | goto kfree; | ||
422 | } | ||
423 | state = 1; | ||
424 | blkif->blk_backend_type = BLKIF_BACKEND_PHY; | ||
425 | } | ||
426 | /* Optional. */ | ||
427 | err = xenbus_printf(xbt, dev->nodename, | ||
428 | "discard-secure", "%d", | ||
429 | blkif->vbd.discard_secure); | ||
430 | if (err) { | ||
431 | xenbus_dev_fatal(dev, err, | ||
432 | "writting discard-secure"); | ||
433 | goto kfree; | ||
434 | } | ||
435 | } | 421 | } |
436 | } else { | ||
437 | err = PTR_ERR(type); | ||
438 | xenbus_dev_fatal(dev, err, "reading type"); | ||
439 | goto out; | ||
440 | } | 422 | } |
441 | |||
442 | err = xenbus_printf(xbt, dev->nodename, "feature-discard", | 423 | err = xenbus_printf(xbt, dev->nodename, "feature-discard", |
443 | "%d", state); | 424 | "%d", state); |
444 | if (err) | 425 | if (err) |
445 | xenbus_dev_fatal(dev, err, "writing feature-discard"); | 426 | dev_warn(&dev->dev, "writing feature-discard (%d)", err); |
446 | kfree: | ||
447 | kfree(type); | ||
448 | out: | ||
449 | return err; | ||
450 | } | 427 | } |
451 | int xen_blkbk_barrier(struct xenbus_transaction xbt, | 428 | int xen_blkbk_barrier(struct xenbus_transaction xbt, |
452 | struct backend_info *be, int state) | 429 | struct backend_info *be, int state) |
@@ -457,7 +434,7 @@ int xen_blkbk_barrier(struct xenbus_transaction xbt, | |||
457 | err = xenbus_printf(xbt, dev->nodename, "feature-barrier", | 434 | err = xenbus_printf(xbt, dev->nodename, "feature-barrier", |
458 | "%d", state); | 435 | "%d", state); |
459 | if (err) | 436 | if (err) |
460 | xenbus_dev_fatal(dev, err, "writing feature-barrier"); | 437 | dev_warn(&dev->dev, "writing feature-barrier (%d)", err); |
461 | 438 | ||
462 | return err; | 439 | return err; |
463 | } | 440 | } |
@@ -689,14 +666,12 @@ again: | |||
689 | return; | 666 | return; |
690 | } | 667 | } |
691 | 668 | ||
692 | err = xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); | 669 | /* If we can't advertise it is OK. */ |
693 | if (err) | 670 | xen_blkbk_flush_diskcache(xbt, be, be->blkif->vbd.flush_support); |
694 | goto abort; | ||
695 | 671 | ||
696 | err = xen_blkbk_discard(xbt, be); | 672 | xen_blkbk_discard(xbt, be); |
697 | 673 | ||
698 | /* If we can't advertise it is OK. */ | 674 | xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); |
699 | err = xen_blkbk_barrier(xbt, be, be->blkif->vbd.flush_support); | ||
700 | 675 | ||
701 | err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", | 676 | err = xenbus_printf(xbt, dev->nodename, "sectors", "%llu", |
702 | (unsigned long long)vbd_sz(&be->blkif->vbd)); | 677 | (unsigned long long)vbd_sz(&be->blkif->vbd)); |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index d5e1ab956740..4e86393a09cf 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
45 | #include <linux/scatterlist.h> | 45 | #include <linux/scatterlist.h> |
46 | #include <linux/bitmap.h> | ||
46 | 47 | ||
47 | #include <xen/xen.h> | 48 | #include <xen/xen.h> |
48 | #include <xen/xenbus.h> | 49 | #include <xen/xenbus.h> |
@@ -81,6 +82,7 @@ static const struct block_device_operations xlvbd_block_fops; | |||
81 | */ | 82 | */ |
82 | struct blkfront_info | 83 | struct blkfront_info |
83 | { | 84 | { |
85 | spinlock_t io_lock; | ||
84 | struct mutex mutex; | 86 | struct mutex mutex; |
85 | struct xenbus_device *xbdev; | 87 | struct xenbus_device *xbdev; |
86 | struct gendisk *gd; | 88 | struct gendisk *gd; |
@@ -105,8 +107,6 @@ struct blkfront_info | |||
105 | int is_ready; | 107 | int is_ready; |
106 | }; | 108 | }; |
107 | 109 | ||
108 | static DEFINE_SPINLOCK(blkif_io_lock); | ||
109 | |||
110 | static unsigned int nr_minors; | 110 | static unsigned int nr_minors; |
111 | static unsigned long *minors; | 111 | static unsigned long *minors; |
112 | static DEFINE_SPINLOCK(minor_lock); | 112 | static DEFINE_SPINLOCK(minor_lock); |
@@ -177,8 +177,7 @@ static int xlbd_reserve_minors(unsigned int minor, unsigned int nr) | |||
177 | 177 | ||
178 | spin_lock(&minor_lock); | 178 | spin_lock(&minor_lock); |
179 | if (find_next_bit(minors, end, minor) >= end) { | 179 | if (find_next_bit(minors, end, minor) >= end) { |
180 | for (; minor < end; ++minor) | 180 | bitmap_set(minors, minor, nr); |
181 | __set_bit(minor, minors); | ||
182 | rc = 0; | 181 | rc = 0; |
183 | } else | 182 | } else |
184 | rc = -EBUSY; | 183 | rc = -EBUSY; |
@@ -193,8 +192,7 @@ static void xlbd_release_minors(unsigned int minor, unsigned int nr) | |||
193 | 192 | ||
194 | BUG_ON(end > nr_minors); | 193 | BUG_ON(end > nr_minors); |
195 | spin_lock(&minor_lock); | 194 | spin_lock(&minor_lock); |
196 | for (; minor < end; ++minor) | 195 | bitmap_clear(minors, minor, nr); |
197 | __clear_bit(minor, minors); | ||
198 | spin_unlock(&minor_lock); | 196 | spin_unlock(&minor_lock); |
199 | } | 197 | } |
200 | 198 | ||
@@ -419,7 +417,7 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size) | |||
419 | struct request_queue *rq; | 417 | struct request_queue *rq; |
420 | struct blkfront_info *info = gd->private_data; | 418 | struct blkfront_info *info = gd->private_data; |
421 | 419 | ||
422 | rq = blk_init_queue(do_blkif_request, &blkif_io_lock); | 420 | rq = blk_init_queue(do_blkif_request, &info->io_lock); |
423 | if (rq == NULL) | 421 | if (rq == NULL) |
424 | return -1; | 422 | return -1; |
425 | 423 | ||
@@ -636,14 +634,14 @@ static void xlvbd_release_gendisk(struct blkfront_info *info) | |||
636 | if (info->rq == NULL) | 634 | if (info->rq == NULL) |
637 | return; | 635 | return; |
638 | 636 | ||
639 | spin_lock_irqsave(&blkif_io_lock, flags); | 637 | spin_lock_irqsave(&info->io_lock, flags); |
640 | 638 | ||
641 | /* No more blkif_request(). */ | 639 | /* No more blkif_request(). */ |
642 | blk_stop_queue(info->rq); | 640 | blk_stop_queue(info->rq); |
643 | 641 | ||
644 | /* No more gnttab callback work. */ | 642 | /* No more gnttab callback work. */ |
645 | gnttab_cancel_free_callback(&info->callback); | 643 | gnttab_cancel_free_callback(&info->callback); |
646 | spin_unlock_irqrestore(&blkif_io_lock, flags); | 644 | spin_unlock_irqrestore(&info->io_lock, flags); |
647 | 645 | ||
648 | /* Flush gnttab callback work. Must be done with no locks held. */ | 646 | /* Flush gnttab callback work. Must be done with no locks held. */ |
649 | flush_work_sync(&info->work); | 647 | flush_work_sync(&info->work); |
@@ -675,16 +673,16 @@ static void blkif_restart_queue(struct work_struct *work) | |||
675 | { | 673 | { |
676 | struct blkfront_info *info = container_of(work, struct blkfront_info, work); | 674 | struct blkfront_info *info = container_of(work, struct blkfront_info, work); |
677 | 675 | ||
678 | spin_lock_irq(&blkif_io_lock); | 676 | spin_lock_irq(&info->io_lock); |
679 | if (info->connected == BLKIF_STATE_CONNECTED) | 677 | if (info->connected == BLKIF_STATE_CONNECTED) |
680 | kick_pending_request_queues(info); | 678 | kick_pending_request_queues(info); |
681 | spin_unlock_irq(&blkif_io_lock); | 679 | spin_unlock_irq(&info->io_lock); |
682 | } | 680 | } |
683 | 681 | ||
684 | static void blkif_free(struct blkfront_info *info, int suspend) | 682 | static void blkif_free(struct blkfront_info *info, int suspend) |
685 | { | 683 | { |
686 | /* Prevent new requests being issued until we fix things up. */ | 684 | /* Prevent new requests being issued until we fix things up. */ |
687 | spin_lock_irq(&blkif_io_lock); | 685 | spin_lock_irq(&info->io_lock); |
688 | info->connected = suspend ? | 686 | info->connected = suspend ? |
689 | BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED; | 687 | BLKIF_STATE_SUSPENDED : BLKIF_STATE_DISCONNECTED; |
690 | /* No more blkif_request(). */ | 688 | /* No more blkif_request(). */ |
@@ -692,7 +690,7 @@ static void blkif_free(struct blkfront_info *info, int suspend) | |||
692 | blk_stop_queue(info->rq); | 690 | blk_stop_queue(info->rq); |
693 | /* No more gnttab callback work. */ | 691 | /* No more gnttab callback work. */ |
694 | gnttab_cancel_free_callback(&info->callback); | 692 | gnttab_cancel_free_callback(&info->callback); |
695 | spin_unlock_irq(&blkif_io_lock); | 693 | spin_unlock_irq(&info->io_lock); |
696 | 694 | ||
697 | /* Flush gnttab callback work. Must be done with no locks held. */ | 695 | /* Flush gnttab callback work. Must be done with no locks held. */ |
698 | flush_work_sync(&info->work); | 696 | flush_work_sync(&info->work); |
@@ -728,10 +726,10 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
728 | struct blkfront_info *info = (struct blkfront_info *)dev_id; | 726 | struct blkfront_info *info = (struct blkfront_info *)dev_id; |
729 | int error; | 727 | int error; |
730 | 728 | ||
731 | spin_lock_irqsave(&blkif_io_lock, flags); | 729 | spin_lock_irqsave(&info->io_lock, flags); |
732 | 730 | ||
733 | if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) { | 731 | if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) { |
734 | spin_unlock_irqrestore(&blkif_io_lock, flags); | 732 | spin_unlock_irqrestore(&info->io_lock, flags); |
735 | return IRQ_HANDLED; | 733 | return IRQ_HANDLED; |
736 | } | 734 | } |
737 | 735 | ||
@@ -816,7 +814,7 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id) | |||
816 | 814 | ||
817 | kick_pending_request_queues(info); | 815 | kick_pending_request_queues(info); |
818 | 816 | ||
819 | spin_unlock_irqrestore(&blkif_io_lock, flags); | 817 | spin_unlock_irqrestore(&info->io_lock, flags); |
820 | 818 | ||
821 | return IRQ_HANDLED; | 819 | return IRQ_HANDLED; |
822 | } | 820 | } |
@@ -991,6 +989,7 @@ static int blkfront_probe(struct xenbus_device *dev, | |||
991 | } | 989 | } |
992 | 990 | ||
993 | mutex_init(&info->mutex); | 991 | mutex_init(&info->mutex); |
992 | spin_lock_init(&info->io_lock); | ||
994 | info->xbdev = dev; | 993 | info->xbdev = dev; |
995 | info->vdevice = vdevice; | 994 | info->vdevice = vdevice; |
996 | info->connected = BLKIF_STATE_DISCONNECTED; | 995 | info->connected = BLKIF_STATE_DISCONNECTED; |
@@ -1068,7 +1067,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
1068 | 1067 | ||
1069 | xenbus_switch_state(info->xbdev, XenbusStateConnected); | 1068 | xenbus_switch_state(info->xbdev, XenbusStateConnected); |
1070 | 1069 | ||
1071 | spin_lock_irq(&blkif_io_lock); | 1070 | spin_lock_irq(&info->io_lock); |
1072 | 1071 | ||
1073 | /* Now safe for us to use the shared ring */ | 1072 | /* Now safe for us to use the shared ring */ |
1074 | info->connected = BLKIF_STATE_CONNECTED; | 1073 | info->connected = BLKIF_STATE_CONNECTED; |
@@ -1079,7 +1078,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
1079 | /* Kick any other new requests queued since we resumed */ | 1078 | /* Kick any other new requests queued since we resumed */ |
1080 | kick_pending_request_queues(info); | 1079 | kick_pending_request_queues(info); |
1081 | 1080 | ||
1082 | spin_unlock_irq(&blkif_io_lock); | 1081 | spin_unlock_irq(&info->io_lock); |
1083 | 1082 | ||
1084 | return 0; | 1083 | return 0; |
1085 | } | 1084 | } |
@@ -1277,10 +1276,10 @@ static void blkfront_connect(struct blkfront_info *info) | |||
1277 | xenbus_switch_state(info->xbdev, XenbusStateConnected); | 1276 | xenbus_switch_state(info->xbdev, XenbusStateConnected); |
1278 | 1277 | ||
1279 | /* Kick pending requests. */ | 1278 | /* Kick pending requests. */ |
1280 | spin_lock_irq(&blkif_io_lock); | 1279 | spin_lock_irq(&info->io_lock); |
1281 | info->connected = BLKIF_STATE_CONNECTED; | 1280 | info->connected = BLKIF_STATE_CONNECTED; |
1282 | kick_pending_request_queues(info); | 1281 | kick_pending_request_queues(info); |
1283 | spin_unlock_irq(&blkif_io_lock); | 1282 | spin_unlock_irq(&info->io_lock); |
1284 | 1283 | ||
1285 | add_disk(info->gd); | 1284 | add_disk(info->gd); |
1286 | 1285 | ||
@@ -1410,7 +1409,6 @@ static int blkif_release(struct gendisk *disk, fmode_t mode) | |||
1410 | mutex_lock(&blkfront_mutex); | 1409 | mutex_lock(&blkfront_mutex); |
1411 | 1410 | ||
1412 | bdev = bdget_disk(disk, 0); | 1411 | bdev = bdget_disk(disk, 0); |
1413 | bdput(bdev); | ||
1414 | 1412 | ||
1415 | if (bdev->bd_openers) | 1413 | if (bdev->bd_openers) |
1416 | goto out; | 1414 | goto out; |
@@ -1441,6 +1439,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode) | |||
1441 | } | 1439 | } |
1442 | 1440 | ||
1443 | out: | 1441 | out: |
1442 | bdput(bdev); | ||
1444 | mutex_unlock(&blkfront_mutex); | 1443 | mutex_unlock(&blkfront_mutex); |
1445 | return 0; | 1444 | return 0; |
1446 | } | 1445 | } |
@@ -1475,7 +1474,7 @@ static int __init xlblk_init(void) | |||
1475 | if (!xen_domain()) | 1474 | if (!xen_domain()) |
1476 | return -ENODEV; | 1475 | return -ENODEV; |
1477 | 1476 | ||
1478 | if (!xen_platform_pci_unplug) | 1477 | if (xen_hvm_domain() && !xen_platform_pci_unplug) |
1479 | return -ENODEV; | 1478 | return -ENODEV; |
1480 | 1479 | ||
1481 | if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) { | 1480 | if (register_blkdev(XENVBD_MAJOR, DEV_NAME)) { |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 48442476ec00..57fd867553d7 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -72,7 +72,11 @@ static struct usb_device_id ath3k_table[] = { | |||
72 | 72 | ||
73 | /* Atheros AR3012 with sflash firmware*/ | 73 | /* Atheros AR3012 with sflash firmware*/ |
74 | { USB_DEVICE(0x0CF3, 0x3004) }, | 74 | { USB_DEVICE(0x0CF3, 0x3004) }, |
75 | { USB_DEVICE(0x0CF3, 0x311D) }, | ||
75 | { USB_DEVICE(0x13d3, 0x3375) }, | 76 | { USB_DEVICE(0x13d3, 0x3375) }, |
77 | { USB_DEVICE(0x04CA, 0x3005) }, | ||
78 | { USB_DEVICE(0x13d3, 0x3362) }, | ||
79 | { USB_DEVICE(0x0CF3, 0xE004) }, | ||
76 | 80 | ||
77 | /* Atheros AR5BBU12 with sflash firmware */ | 81 | /* Atheros AR5BBU12 with sflash firmware */ |
78 | { USB_DEVICE(0x0489, 0xE02C) }, | 82 | { USB_DEVICE(0x0489, 0xE02C) }, |
@@ -89,7 +93,11 @@ static struct usb_device_id ath3k_blist_tbl[] = { | |||
89 | 93 | ||
90 | /* Atheros AR3012 with sflash firmware*/ | 94 | /* Atheros AR3012 with sflash firmware*/ |
91 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 95 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
96 | { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 }, | ||
92 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 97 | { USB_DEVICE(0x13d3, 0x3375), .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 }, | ||
93 | 101 | ||
94 | { } /* Terminating entry */ | 102 | { } /* Terminating entry */ |
95 | }; | 103 | }; |
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c index 6c20bbb54b71..428dbb7574bd 100644 --- a/drivers/bluetooth/btmrvl_debugfs.c +++ b/drivers/bluetooth/btmrvl_debugfs.c | |||
@@ -45,12 +45,6 @@ struct btmrvl_debugfs_data { | |||
45 | struct dentry *txdnldready; | 45 | struct dentry *txdnldready; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static int btmrvl_open_generic(struct inode *inode, struct file *file) | ||
49 | { | ||
50 | file->private_data = inode->i_private; | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static ssize_t btmrvl_hscfgcmd_write(struct file *file, | 48 | static ssize_t btmrvl_hscfgcmd_write(struct file *file, |
55 | const char __user *ubuf, size_t count, loff_t *ppos) | 49 | const char __user *ubuf, size_t count, loff_t *ppos) |
56 | { | 50 | { |
@@ -93,7 +87,7 @@ static ssize_t btmrvl_hscfgcmd_read(struct file *file, char __user *userbuf, | |||
93 | static const struct file_operations btmrvl_hscfgcmd_fops = { | 87 | static const struct file_operations btmrvl_hscfgcmd_fops = { |
94 | .read = btmrvl_hscfgcmd_read, | 88 | .read = btmrvl_hscfgcmd_read, |
95 | .write = btmrvl_hscfgcmd_write, | 89 | .write = btmrvl_hscfgcmd_write, |
96 | .open = btmrvl_open_generic, | 90 | .open = simple_open, |
97 | .llseek = default_llseek, | 91 | .llseek = default_llseek, |
98 | }; | 92 | }; |
99 | 93 | ||
@@ -134,7 +128,7 @@ static ssize_t btmrvl_psmode_read(struct file *file, char __user *userbuf, | |||
134 | static const struct file_operations btmrvl_psmode_fops = { | 128 | static const struct file_operations btmrvl_psmode_fops = { |
135 | .read = btmrvl_psmode_read, | 129 | .read = btmrvl_psmode_read, |
136 | .write = btmrvl_psmode_write, | 130 | .write = btmrvl_psmode_write, |
137 | .open = btmrvl_open_generic, | 131 | .open = simple_open, |
138 | .llseek = default_llseek, | 132 | .llseek = default_llseek, |
139 | }; | 133 | }; |
140 | 134 | ||
@@ -180,7 +174,7 @@ static ssize_t btmrvl_pscmd_read(struct file *file, char __user *userbuf, | |||
180 | static const struct file_operations btmrvl_pscmd_fops = { | 174 | static const struct file_operations btmrvl_pscmd_fops = { |
181 | .read = btmrvl_pscmd_read, | 175 | .read = btmrvl_pscmd_read, |
182 | .write = btmrvl_pscmd_write, | 176 | .write = btmrvl_pscmd_write, |
183 | .open = btmrvl_open_generic, | 177 | .open = simple_open, |
184 | .llseek = default_llseek, | 178 | .llseek = default_llseek, |
185 | }; | 179 | }; |
186 | 180 | ||
@@ -221,7 +215,7 @@ static ssize_t btmrvl_gpiogap_read(struct file *file, char __user *userbuf, | |||
221 | static const struct file_operations btmrvl_gpiogap_fops = { | 215 | static const struct file_operations btmrvl_gpiogap_fops = { |
222 | .read = btmrvl_gpiogap_read, | 216 | .read = btmrvl_gpiogap_read, |
223 | .write = btmrvl_gpiogap_write, | 217 | .write = btmrvl_gpiogap_write, |
224 | .open = btmrvl_open_generic, | 218 | .open = simple_open, |
225 | .llseek = default_llseek, | 219 | .llseek = default_llseek, |
226 | }; | 220 | }; |
227 | 221 | ||
@@ -265,7 +259,7 @@ static ssize_t btmrvl_hscmd_read(struct file *file, char __user *userbuf, | |||
265 | static const struct file_operations btmrvl_hscmd_fops = { | 259 | static const struct file_operations btmrvl_hscmd_fops = { |
266 | .read = btmrvl_hscmd_read, | 260 | .read = btmrvl_hscmd_read, |
267 | .write = btmrvl_hscmd_write, | 261 | .write = btmrvl_hscmd_write, |
268 | .open = btmrvl_open_generic, | 262 | .open = simple_open, |
269 | .llseek = default_llseek, | 263 | .llseek = default_llseek, |
270 | }; | 264 | }; |
271 | 265 | ||
@@ -305,7 +299,7 @@ static ssize_t btmrvl_hsmode_read(struct file *file, char __user * userbuf, | |||
305 | static const struct file_operations btmrvl_hsmode_fops = { | 299 | static const struct file_operations btmrvl_hsmode_fops = { |
306 | .read = btmrvl_hsmode_read, | 300 | .read = btmrvl_hsmode_read, |
307 | .write = btmrvl_hsmode_write, | 301 | .write = btmrvl_hsmode_write, |
308 | .open = btmrvl_open_generic, | 302 | .open = simple_open, |
309 | .llseek = default_llseek, | 303 | .llseek = default_llseek, |
310 | }; | 304 | }; |
311 | 305 | ||
@@ -323,7 +317,7 @@ static ssize_t btmrvl_curpsmode_read(struct file *file, char __user *userbuf, | |||
323 | 317 | ||
324 | static const struct file_operations btmrvl_curpsmode_fops = { | 318 | static const struct file_operations btmrvl_curpsmode_fops = { |
325 | .read = btmrvl_curpsmode_read, | 319 | .read = btmrvl_curpsmode_read, |
326 | .open = btmrvl_open_generic, | 320 | .open = simple_open, |
327 | .llseek = default_llseek, | 321 | .llseek = default_llseek, |
328 | }; | 322 | }; |
329 | 323 | ||
@@ -341,7 +335,7 @@ static ssize_t btmrvl_psstate_read(struct file *file, char __user * userbuf, | |||
341 | 335 | ||
342 | static const struct file_operations btmrvl_psstate_fops = { | 336 | static const struct file_operations btmrvl_psstate_fops = { |
343 | .read = btmrvl_psstate_read, | 337 | .read = btmrvl_psstate_read, |
344 | .open = btmrvl_open_generic, | 338 | .open = simple_open, |
345 | .llseek = default_llseek, | 339 | .llseek = default_llseek, |
346 | }; | 340 | }; |
347 | 341 | ||
@@ -359,7 +353,7 @@ static ssize_t btmrvl_hsstate_read(struct file *file, char __user *userbuf, | |||
359 | 353 | ||
360 | static const struct file_operations btmrvl_hsstate_fops = { | 354 | static const struct file_operations btmrvl_hsstate_fops = { |
361 | .read = btmrvl_hsstate_read, | 355 | .read = btmrvl_hsstate_read, |
362 | .open = btmrvl_open_generic, | 356 | .open = simple_open, |
363 | .llseek = default_llseek, | 357 | .llseek = default_llseek, |
364 | }; | 358 | }; |
365 | 359 | ||
@@ -378,7 +372,7 @@ static ssize_t btmrvl_txdnldready_read(struct file *file, char __user *userbuf, | |||
378 | 372 | ||
379 | static const struct file_operations btmrvl_txdnldready_fops = { | 373 | static const struct file_operations btmrvl_txdnldready_fops = { |
380 | .read = btmrvl_txdnldready_read, | 374 | .read = btmrvl_txdnldready_read, |
381 | .open = btmrvl_open_generic, | 375 | .open = simple_open, |
382 | .llseek = default_llseek, | 376 | .llseek = default_llseek, |
383 | }; | 377 | }; |
384 | 378 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 480cad920048..9217121362e1 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -61,7 +61,7 @@ static struct usb_device_id btusb_table[] = { | |||
61 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, | 61 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, |
62 | 62 | ||
63 | /* Broadcom SoftSailing reporting vendor specific */ | 63 | /* Broadcom SoftSailing reporting vendor specific */ |
64 | { USB_DEVICE(0x05ac, 0x21e1) }, | 64 | { USB_DEVICE(0x0a5c, 0x21e1) }, |
65 | 65 | ||
66 | /* Apple MacBookPro 7,1 */ | 66 | /* Apple MacBookPro 7,1 */ |
67 | { USB_DEVICE(0x05ac, 0x8213) }, | 67 | { USB_DEVICE(0x05ac, 0x8213) }, |
@@ -101,11 +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) }, |
107 | { USB_DEVICE(0x0a5c, 0x21e8) }, | ||
106 | { USB_DEVICE(0x0a5c, 0x21f3) }, | 108 | { USB_DEVICE(0x0a5c, 0x21f3) }, |
107 | { USB_DEVICE(0x413c, 0x8197) }, | 109 | { USB_DEVICE(0x413c, 0x8197) }, |
108 | 110 | ||
111 | /* Foxconn - Hon Hai */ | ||
112 | { USB_DEVICE(0x0489, 0xe033) }, | ||
113 | |||
109 | { } /* Terminating entry */ | 114 | { } /* Terminating entry */ |
110 | }; | 115 | }; |
111 | 116 | ||
@@ -129,7 +134,11 @@ static struct usb_device_id blacklist_table[] = { | |||
129 | 134 | ||
130 | /* Atheros 3012 with sflash firmware */ | 135 | /* Atheros 3012 with sflash firmware */ |
131 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, | 136 | { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, |
137 | { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, | ||
132 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 138 | { USB_DEVICE(0x13d3, 0x3375), .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 }, | ||
133 | 142 | ||
134 | /* Atheros AR5BBU12 with sflash firmware */ | 143 | /* Atheros AR5BBU12 with sflash firmware */ |
135 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | 144 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, |
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index fd5adb408f44..98a8c05d4f23 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c | |||
@@ -299,11 +299,11 @@ static void hci_uart_tty_close(struct tty_struct *tty) | |||
299 | hci_uart_close(hdev); | 299 | hci_uart_close(hdev); |
300 | 300 | ||
301 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { | 301 | if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) { |
302 | hu->proto->close(hu); | ||
303 | if (hdev) { | 302 | if (hdev) { |
304 | hci_unregister_dev(hdev); | 303 | hci_unregister_dev(hdev); |
305 | hci_free_dev(hdev); | 304 | hci_free_dev(hdev); |
306 | } | 305 | } |
306 | hu->proto->close(hu); | ||
307 | } | 307 | } |
308 | 308 | ||
309 | kfree(hu); | 309 | kfree(hu); |
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h index 5da67f165afa..7ea18a5fe71c 100644 --- a/drivers/char/agp/intel-agp.h +++ b/drivers/char/agp/intel-agp.h | |||
@@ -234,6 +234,7 @@ | |||
234 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_GT2_IG 0x0166 | 234 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_M_GT2_IG 0x0166 |
235 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB 0x0158 /* Server */ | 235 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_HB 0x0158 /* Server */ |
236 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG 0x015A | 236 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG 0x015A |
237 | #define PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT2_IG 0x016A | ||
237 | 238 | ||
238 | int intel_gmch_probe(struct pci_dev *pdev, | 239 | int intel_gmch_probe(struct pci_dev *pdev, |
239 | struct agp_bridge_data *bridge); | 240 | struct agp_bridge_data *bridge); |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index 5cf47ac2d401..7f025fb620de 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -1190,7 +1190,6 @@ static inline int needs_idle_maps(void) | |||
1190 | { | 1190 | { |
1191 | #ifdef CONFIG_INTEL_IOMMU | 1191 | #ifdef CONFIG_INTEL_IOMMU |
1192 | const unsigned short gpu_devid = intel_private.pcidev->device; | 1192 | const unsigned short gpu_devid = intel_private.pcidev->device; |
1193 | extern int intel_iommu_gfx_mapped; | ||
1194 | 1193 | ||
1195 | /* Query intel_iommu to see if we need the workaround. Presumably that | 1194 | /* Query intel_iommu to see if we need the workaround. Presumably that |
1196 | * was loaded first. | 1195 | * was loaded first. |
@@ -1459,6 +1458,8 @@ static const struct intel_gtt_driver_description { | |||
1459 | "Ivybridge", &sandybridge_gtt_driver }, | 1458 | "Ivybridge", &sandybridge_gtt_driver }, |
1460 | { PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG, | 1459 | { PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT1_IG, |
1461 | "Ivybridge", &sandybridge_gtt_driver }, | 1460 | "Ivybridge", &sandybridge_gtt_driver }, |
1461 | { PCI_DEVICE_ID_INTEL_IVYBRIDGE_S_GT2_IG, | ||
1462 | "Ivybridge", &sandybridge_gtt_driver }, | ||
1462 | { 0, NULL, NULL } | 1463 | { 0, NULL, NULL } |
1463 | }; | 1464 | }; |
1464 | 1465 | ||
diff --git a/drivers/char/apm-emulation.c b/drivers/char/apm-emulation.c index 57501ca9204b..46118f845948 100644 --- a/drivers/char/apm-emulation.c +++ b/drivers/char/apm-emulation.c | |||
@@ -301,7 +301,7 @@ apm_ioctl(struct file *filp, u_int cmd, u_long arg) | |||
301 | * anything critical, chill a bit on each iteration. | 301 | * anything critical, chill a bit on each iteration. |
302 | */ | 302 | */ |
303 | while (wait_event_freezable(apm_suspend_waitqueue, | 303 | while (wait_event_freezable(apm_suspend_waitqueue, |
304 | as->suspend_state == SUSPEND_DONE)) | 304 | as->suspend_state != SUSPEND_ACKED)) |
305 | msleep(10); | 305 | msleep(10); |
306 | break; | 306 | break; |
307 | case SUSPEND_ACKTO: | 307 | case SUSPEND_ACKTO: |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 3845ab44c330..dfd7876f127c 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -906,8 +906,8 @@ int hpet_alloc(struct hpet_data *hdp) | |||
906 | hpetp->hp_which, hdp->hd_phys_address, | 906 | hpetp->hp_which, hdp->hd_phys_address, |
907 | hpetp->hp_ntimer > 1 ? "s" : ""); | 907 | hpetp->hp_ntimer > 1 ? "s" : ""); |
908 | for (i = 0; i < hpetp->hp_ntimer; i++) | 908 | for (i = 0; i < hpetp->hp_ntimer; i++) |
909 | printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); | 909 | printk(KERN_CONT "%s %d", i > 0 ? "," : "", hdp->hd_irq[i]); |
910 | printk("\n"); | 910 | printk(KERN_CONT "\n"); |
911 | 911 | ||
912 | temp = hpetp->hp_tick_freq; | 912 | temp = hpetp->hp_tick_freq; |
913 | remainder = do_div(temp, 1000000); | 913 | remainder = do_div(temp, 1000000); |
diff --git a/drivers/char/random.c b/drivers/char/random.c index 54ca8b23cde3..4ec04a754733 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1260,10 +1260,15 @@ static int proc_do_uuid(ctl_table *table, int write, | |||
1260 | uuid = table->data; | 1260 | uuid = table->data; |
1261 | if (!uuid) { | 1261 | if (!uuid) { |
1262 | uuid = tmp_uuid; | 1262 | uuid = tmp_uuid; |
1263 | uuid[8] = 0; | ||
1264 | } | ||
1265 | if (uuid[8] == 0) | ||
1266 | generate_random_uuid(uuid); | 1263 | generate_random_uuid(uuid); |
1264 | } else { | ||
1265 | static DEFINE_SPINLOCK(bootid_spinlock); | ||
1266 | |||
1267 | spin_lock(&bootid_spinlock); | ||
1268 | if (!uuid[8]) | ||
1269 | generate_random_uuid(uuid); | ||
1270 | spin_unlock(&bootid_spinlock); | ||
1271 | } | ||
1267 | 1272 | ||
1268 | sprintf(buf, "%pU", uuid); | 1273 | sprintf(buf, "%pU", uuid); |
1269 | 1274 | ||
diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c index 4dc019408fac..3b22a606f79d 100644 --- a/drivers/char/tile-srom.c +++ b/drivers/char/tile-srom.c | |||
@@ -194,17 +194,17 @@ static ssize_t srom_read(struct file *filp, char __user *buf, | |||
194 | 194 | ||
195 | hv_retval = _srom_read(srom->hv_devhdl, kernbuf, | 195 | hv_retval = _srom_read(srom->hv_devhdl, kernbuf, |
196 | *f_pos, bytes_this_pass); | 196 | *f_pos, bytes_this_pass); |
197 | if (hv_retval > 0) { | 197 | if (hv_retval <= 0) { |
198 | if (copy_to_user(buf, kernbuf, hv_retval) != 0) { | ||
199 | retval = -EFAULT; | ||
200 | break; | ||
201 | } | ||
202 | } else if (hv_retval <= 0) { | ||
203 | if (retval == 0) | 198 | if (retval == 0) |
204 | retval = hv_retval; | 199 | retval = hv_retval; |
205 | break; | 200 | break; |
206 | } | 201 | } |
207 | 202 | ||
203 | if (copy_to_user(buf, kernbuf, hv_retval) != 0) { | ||
204 | retval = -EFAULT; | ||
205 | break; | ||
206 | } | ||
207 | |||
208 | retval += hv_retval; | 208 | retval += hv_retval; |
209 | *f_pos += hv_retval; | 209 | *f_pos += hv_retval; |
210 | buf += hv_retval; | 210 | buf += hv_retval; |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index b58b56187065..ddf86b6500b7 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1038,12 +1038,6 @@ static struct attribute_group port_attribute_group = { | |||
1038 | .attrs = port_sysfs_entries, | 1038 | .attrs = port_sysfs_entries, |
1039 | }; | 1039 | }; |
1040 | 1040 | ||
1041 | static int debugfs_open(struct inode *inode, struct file *filp) | ||
1042 | { | ||
1043 | filp->private_data = inode->i_private; | ||
1044 | return 0; | ||
1045 | } | ||
1046 | |||
1047 | static ssize_t debugfs_read(struct file *filp, char __user *ubuf, | 1041 | static ssize_t debugfs_read(struct file *filp, char __user *ubuf, |
1048 | size_t count, loff_t *offp) | 1042 | size_t count, loff_t *offp) |
1049 | { | 1043 | { |
@@ -1087,7 +1081,7 @@ static ssize_t debugfs_read(struct file *filp, char __user *ubuf, | |||
1087 | 1081 | ||
1088 | static const struct file_operations port_debugfs_ops = { | 1082 | static const struct file_operations port_debugfs_ops = { |
1089 | .owner = THIS_MODULE, | 1083 | .owner = THIS_MODULE, |
1090 | .open = debugfs_open, | 1084 | .open = simple_open, |
1091 | .read = debugfs_read, | 1085 | .read = debugfs_read, |
1092 | }; | 1086 | }; |
1093 | 1087 | ||
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index 82e882028fcf..6b5cf02c35c8 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/pci.h> | 24 | #include <linux/pci.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/async.h> | ||
27 | #include <asm/io.h> | 26 | #include <asm/io.h> |
28 | 27 | ||
29 | /* | 28 | /* |
@@ -180,15 +179,17 @@ static int verify_pmtmr_rate(void) | |||
180 | /* Number of reads we try to get two different values */ | 179 | /* Number of reads we try to get two different values */ |
181 | #define ACPI_PM_READ_CHECKS 10000 | 180 | #define ACPI_PM_READ_CHECKS 10000 |
182 | 181 | ||
183 | static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie) | 182 | static int __init init_acpi_pm_clocksource(void) |
184 | { | 183 | { |
185 | cycle_t value1, value2; | 184 | cycle_t value1, value2; |
186 | unsigned int i, j = 0; | 185 | unsigned int i, j = 0; |
187 | 186 | ||
187 | if (!pmtmr_ioport) | ||
188 | return -ENODEV; | ||
188 | 189 | ||
189 | /* "verify" this timing source: */ | 190 | /* "verify" this timing source: */ |
190 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { | 191 | for (j = 0; j < ACPI_PM_MONOTONICITY_CHECKS; j++) { |
191 | usleep_range(100 * j, 100 * j + 100); | 192 | udelay(100 * j); |
192 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); | 193 | value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
193 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { | 194 | for (i = 0; i < ACPI_PM_READ_CHECKS; i++) { |
194 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); | 195 | value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm); |
@@ -202,34 +203,25 @@ static void __init acpi_pm_clocksource_async(void *unused, async_cookie_t cookie | |||
202 | " 0x%#llx, 0x%#llx - aborting.\n", | 203 | " 0x%#llx, 0x%#llx - aborting.\n", |
203 | value1, value2); | 204 | value1, value2); |
204 | pmtmr_ioport = 0; | 205 | pmtmr_ioport = 0; |
205 | return; | 206 | return -EINVAL; |
206 | } | 207 | } |
207 | if (i == ACPI_PM_READ_CHECKS) { | 208 | if (i == ACPI_PM_READ_CHECKS) { |
208 | printk(KERN_INFO "PM-Timer failed consistency check " | 209 | printk(KERN_INFO "PM-Timer failed consistency check " |
209 | " (0x%#llx) - aborting.\n", value1); | 210 | " (0x%#llx) - aborting.\n", value1); |
210 | pmtmr_ioport = 0; | 211 | pmtmr_ioport = 0; |
211 | return; | 212 | return -ENODEV; |
212 | } | 213 | } |
213 | } | 214 | } |
214 | 215 | ||
215 | if (verify_pmtmr_rate() != 0){ | 216 | if (verify_pmtmr_rate() != 0){ |
216 | pmtmr_ioport = 0; | 217 | pmtmr_ioport = 0; |
217 | return; | 218 | return -ENODEV; |
218 | } | 219 | } |
219 | 220 | ||
220 | clocksource_register_hz(&clocksource_acpi_pm, | 221 | return clocksource_register_hz(&clocksource_acpi_pm, |
221 | PMTMR_TICKS_PER_SEC); | 222 | PMTMR_TICKS_PER_SEC); |
222 | } | 223 | } |
223 | 224 | ||
224 | static int __init init_acpi_pm_clocksource(void) | ||
225 | { | ||
226 | if (!pmtmr_ioport) | ||
227 | return -ENODEV; | ||
228 | |||
229 | async_schedule(acpi_pm_clocksource_async, NULL); | ||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | /* We use fs_initcall because we want the PCI fixups to have run | 225 | /* We use fs_initcall because we want the PCI fixups to have run |
234 | * but we still need to load before device_initcall | 226 | * but we still need to load before device_initcall |
235 | */ | 227 | */ |
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 32d790dd8180..5961e6415f08 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm | |||
@@ -4,6 +4,7 @@ | |||
4 | 4 | ||
5 | config ARM_OMAP2PLUS_CPUFREQ | 5 | config ARM_OMAP2PLUS_CPUFREQ |
6 | bool "TI OMAP2+" | 6 | bool "TI OMAP2+" |
7 | depends on ARCH_OMAP2PLUS | ||
7 | default ARCH_OMAP2PLUS | 8 | default ARCH_OMAP2PLUS |
8 | select CPU_FREQ_TABLE | 9 | select CPU_FREQ_TABLE |
9 | 10 | ||
@@ -51,9 +52,6 @@ config ARM_S5PV210_CPUFREQ | |||
51 | config ARM_EXYNOS_CPUFREQ | 52 | config ARM_EXYNOS_CPUFREQ |
52 | bool "SAMSUNG EXYNOS SoCs" | 53 | bool "SAMSUNG EXYNOS SoCs" |
53 | depends on ARCH_EXYNOS | 54 | depends on ARCH_EXYNOS |
54 | select ARM_EXYNOS4210_CPUFREQ if CPU_EXYNOS4210 | ||
55 | select ARM_EXYNOS4X12_CPUFREQ if (SOC_EXYNOS4212 || SOC_EXYNOS4412) | ||
56 | select ARM_EXYNOS5250_CPUFREQ if SOC_EXYNOS5250 | ||
57 | default y | 55 | default y |
58 | help | 56 | help |
59 | This adds the CPUFreq driver common part for Samsung | 57 | This adds the CPUFreq driver common part for Samsung |
@@ -62,20 +60,19 @@ config ARM_EXYNOS_CPUFREQ | |||
62 | If in doubt, say N. | 60 | If in doubt, say N. |
63 | 61 | ||
64 | config ARM_EXYNOS4210_CPUFREQ | 62 | config ARM_EXYNOS4210_CPUFREQ |
65 | bool "Samsung EXYNOS4210" | 63 | def_bool CPU_EXYNOS4210 |
66 | depends on ARCH_EXYNOS | ||
67 | help | 64 | help |
68 | This adds the CPUFreq driver for Samsung EXYNOS4210 | 65 | This adds the CPUFreq driver for Samsung EXYNOS4210 |
69 | SoC (S5PV310 or S5PC210). | 66 | SoC (S5PV310 or S5PC210). |
70 | 67 | ||
71 | config ARM_EXYNOS4X12_CPUFREQ | 68 | config ARM_EXYNOS4X12_CPUFREQ |
72 | bool "Samsung EXYNOS4X12" | 69 | def_bool (SOC_EXYNOS4212 || SOC_EXYNOS4412) |
73 | help | 70 | help |
74 | This adds the CPUFreq driver for Samsung EXYNOS4X12 | 71 | This adds the CPUFreq driver for Samsung EXYNOS4X12 |
75 | SoC (EXYNOS4212 or EXYNOS4412). | 72 | SoC (EXYNOS4212 or EXYNOS4412). |
76 | 73 | ||
77 | config ARM_EXYNOS5250_CPUFREQ | 74 | config ARM_EXYNOS5250_CPUFREQ |
78 | bool "Samsung EXYNOS5250" | 75 | def_bool SOC_EXYNOS5250 |
79 | help | 76 | help |
80 | This adds the CPUFreq driver for Samsung EXYNOS5250 | 77 | This adds the CPUFreq driver for Samsung EXYNOS5250 |
81 | SoC. | 78 | SoC. |
diff --git a/drivers/cpufreq/db8500-cpufreq.c b/drivers/cpufreq/db8500-cpufreq.c index a22ffa5bff9f..0bf1b8910eeb 100644 --- a/drivers/cpufreq/db8500-cpufreq.c +++ b/drivers/cpufreq/db8500-cpufreq.c | |||
@@ -142,7 +142,7 @@ static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) | |||
142 | policy->cpuinfo.transition_latency = 20 * 1000; /* in ns */ | 142 | policy->cpuinfo.transition_latency = 20 * 1000; /* in ns */ |
143 | 143 | ||
144 | /* policy sharing between dual CPUs */ | 144 | /* policy sharing between dual CPUs */ |
145 | cpumask_copy(policy->cpus, &cpu_present_map); | 145 | cpumask_copy(policy->cpus, cpu_present_mask); |
146 | 146 | ||
147 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; | 147 | policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; |
148 | 148 | ||
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 87411cebc577..2f0083a51a9a 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c | |||
@@ -74,7 +74,7 @@ static cpuidle_enter_t cpuidle_enter_ops; | |||
74 | /** | 74 | /** |
75 | * cpuidle_play_dead - cpu off-lining | 75 | * cpuidle_play_dead - cpu off-lining |
76 | * | 76 | * |
77 | * Only returns in case of an error | 77 | * Returns in case of an error or no driver |
78 | */ | 78 | */ |
79 | int cpuidle_play_dead(void) | 79 | int cpuidle_play_dead(void) |
80 | { | 80 | { |
@@ -83,6 +83,9 @@ int cpuidle_play_dead(void) | |||
83 | int i, dead_state = -1; | 83 | int i, dead_state = -1; |
84 | int power_usage = -1; | 84 | int power_usage = -1; |
85 | 85 | ||
86 | if (!drv) | ||
87 | return -ENODEV; | ||
88 | |||
86 | /* Find lowest-power state that supports long-term idle */ | 89 | /* Find lowest-power state that supports long-term idle */ |
87 | for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) { | 90 | for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) { |
88 | struct cpuidle_state *s = &drv->states[i]; | 91 | struct cpuidle_state *s = &drv->states[i]; |
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 0053d7ebb5ca..8f3f74ce8c7f 100644 --- a/drivers/crypto/ixp4xx_crypto.c +++ b/drivers/crypto/ixp4xx_crypto.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
20 | #include <linux/gfp.h> | 20 | #include <linux/gfp.h> |
21 | #include <linux/module.h> | ||
21 | 22 | ||
22 | #include <crypto/ctr.h> | 23 | #include <crypto/ctr.h> |
23 | #include <crypto/des.h> | 24 | #include <crypto/des.h> |
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index dc641c796526..921039e56f87 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c | |||
@@ -124,6 +124,9 @@ struct talitos_private { | |||
124 | void __iomem *reg; | 124 | void __iomem *reg; |
125 | int irq[2]; | 125 | int irq[2]; |
126 | 126 | ||
127 | /* SEC global registers lock */ | ||
128 | spinlock_t reg_lock ____cacheline_aligned; | ||
129 | |||
127 | /* SEC version geometry (from device tree node) */ | 130 | /* SEC version geometry (from device tree node) */ |
128 | unsigned int num_channels; | 131 | unsigned int num_channels; |
129 | unsigned int chfifo_len; | 132 | unsigned int chfifo_len; |
@@ -412,6 +415,7 @@ static void talitos_done_##name(unsigned long data) \ | |||
412 | { \ | 415 | { \ |
413 | struct device *dev = (struct device *)data; \ | 416 | struct device *dev = (struct device *)data; \ |
414 | struct talitos_private *priv = dev_get_drvdata(dev); \ | 417 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
418 | unsigned long flags; \ | ||
415 | \ | 419 | \ |
416 | if (ch_done_mask & 1) \ | 420 | if (ch_done_mask & 1) \ |
417 | flush_channel(dev, 0, 0, 0); \ | 421 | flush_channel(dev, 0, 0, 0); \ |
@@ -427,8 +431,10 @@ static void talitos_done_##name(unsigned long data) \ | |||
427 | out: \ | 431 | out: \ |
428 | /* At this point, all completed channels have been processed */ \ | 432 | /* At this point, all completed channels have been processed */ \ |
429 | /* Unmask done interrupts for channels completed later on. */ \ | 433 | /* Unmask done interrupts for channels completed later on. */ \ |
434 | spin_lock_irqsave(&priv->reg_lock, flags); \ | ||
430 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | 435 | setbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
431 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ | 436 | setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); \ |
437 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ | ||
432 | } | 438 | } |
433 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) | 439 | DEF_TALITOS_DONE(4ch, TALITOS_ISR_4CHDONE) |
434 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) | 440 | DEF_TALITOS_DONE(ch0_2, TALITOS_ISR_CH_0_2_DONE) |
@@ -619,22 +625,28 @@ static irqreturn_t talitos_interrupt_##name(int irq, void *data) \ | |||
619 | struct device *dev = data; \ | 625 | struct device *dev = data; \ |
620 | struct talitos_private *priv = dev_get_drvdata(dev); \ | 626 | struct talitos_private *priv = dev_get_drvdata(dev); \ |
621 | u32 isr, isr_lo; \ | 627 | u32 isr, isr_lo; \ |
628 | unsigned long flags; \ | ||
622 | \ | 629 | \ |
630 | spin_lock_irqsave(&priv->reg_lock, flags); \ | ||
623 | isr = in_be32(priv->reg + TALITOS_ISR); \ | 631 | isr = in_be32(priv->reg + TALITOS_ISR); \ |
624 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ | 632 | isr_lo = in_be32(priv->reg + TALITOS_ISR_LO); \ |
625 | /* Acknowledge interrupt */ \ | 633 | /* Acknowledge interrupt */ \ |
626 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ | 634 | out_be32(priv->reg + TALITOS_ICR, isr & (ch_done_mask | ch_err_mask)); \ |
627 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ | 635 | out_be32(priv->reg + TALITOS_ICR_LO, isr_lo); \ |
628 | \ | 636 | \ |
629 | if (unlikely((isr & ~TALITOS_ISR_4CHDONE) & ch_err_mask || isr_lo)) \ | 637 | if (unlikely(isr & ch_err_mask || isr_lo)) { \ |
630 | talitos_error(dev, isr, isr_lo); \ | 638 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ |
631 | else \ | 639 | talitos_error(dev, isr & ch_err_mask, isr_lo); \ |
640 | } \ | ||
641 | else { \ | ||
632 | if (likely(isr & ch_done_mask)) { \ | 642 | if (likely(isr & ch_done_mask)) { \ |
633 | /* mask further done interrupts. */ \ | 643 | /* mask further done interrupts. */ \ |
634 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ | 644 | clrbits32(priv->reg + TALITOS_IMR, ch_done_mask); \ |
635 | /* done_task will unmask done interrupts at exit */ \ | 645 | /* done_task will unmask done interrupts at exit */ \ |
636 | tasklet_schedule(&priv->done_task[tlet]); \ | 646 | tasklet_schedule(&priv->done_task[tlet]); \ |
637 | } \ | 647 | } \ |
648 | spin_unlock_irqrestore(&priv->reg_lock, flags); \ | ||
649 | } \ | ||
638 | \ | 650 | \ |
639 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ | 651 | return (isr & (ch_done_mask | ch_err_mask) || isr_lo) ? IRQ_HANDLED : \ |
640 | IRQ_NONE; \ | 652 | IRQ_NONE; \ |
@@ -2719,6 +2731,8 @@ static int talitos_probe(struct platform_device *ofdev) | |||
2719 | 2731 | ||
2720 | priv->ofdev = ofdev; | 2732 | priv->ofdev = ofdev; |
2721 | 2733 | ||
2734 | spin_lock_init(&priv->reg_lock); | ||
2735 | |||
2722 | err = talitos_probe_irq(ofdev); | 2736 | err = talitos_probe_irq(ofdev); |
2723 | if (err) | 2737 | if (err) |
2724 | goto err_out; | 2738 | goto err_out; |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index cf9da362d64f..ef378b5b17e4 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -91,11 +91,10 @@ config DW_DMAC | |||
91 | 91 | ||
92 | config AT_HDMAC | 92 | config AT_HDMAC |
93 | tristate "Atmel AHB DMA support" | 93 | tristate "Atmel AHB DMA support" |
94 | depends on ARCH_AT91SAM9RL || ARCH_AT91SAM9G45 | 94 | depends on ARCH_AT91 |
95 | select DMA_ENGINE | 95 | select DMA_ENGINE |
96 | help | 96 | help |
97 | Support the Atmel AHB DMA controller. This can be integrated in | 97 | Support the Atmel AHB DMA controller. |
98 | chips such as the Atmel AT91SAM9RL. | ||
99 | 98 | ||
100 | config FSL_DMA | 99 | config FSL_DMA |
101 | tristate "Freescale Elo and Elo Plus DMA support" | 100 | tristate "Freescale Elo and Elo Plus DMA support" |
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index c301a8ec31aa..3d704abd7912 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -1429,6 +1429,7 @@ static int pl08x_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd, | |||
1429 | * signal | 1429 | * signal |
1430 | */ | 1430 | */ |
1431 | release_phy_channel(plchan); | 1431 | release_phy_channel(plchan); |
1432 | plchan->phychan_hold = 0; | ||
1432 | } | 1433 | } |
1433 | /* Dequeue jobs and free LLIs */ | 1434 | /* Dequeue jobs and free LLIs */ |
1434 | if (plchan->at) { | 1435 | if (plchan->at) { |
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 7aa58d204892..445fdf811695 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c | |||
@@ -221,10 +221,6 @@ static void atc_dostart(struct at_dma_chan *atchan, struct at_desc *first) | |||
221 | 221 | ||
222 | vdbg_dump_regs(atchan); | 222 | vdbg_dump_regs(atchan); |
223 | 223 | ||
224 | /* clear any pending interrupt */ | ||
225 | while (dma_readl(atdma, EBCISR)) | ||
226 | cpu_relax(); | ||
227 | |||
228 | channel_writel(atchan, SADDR, 0); | 224 | channel_writel(atchan, SADDR, 0); |
229 | channel_writel(atchan, DADDR, 0); | 225 | channel_writel(atchan, DADDR, 0); |
230 | channel_writel(atchan, CTRLA, 0); | 226 | channel_writel(atchan, CTRLA, 0); |
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index dc89455f5550..750925f9638b 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c | |||
@@ -104,13 +104,6 @@ static void coh901318_list_print(struct coh901318_chan *cohc, | |||
104 | static struct coh901318_base *debugfs_dma_base; | 104 | static struct coh901318_base *debugfs_dma_base; |
105 | static struct dentry *dma_dentry; | 105 | static struct dentry *dma_dentry; |
106 | 106 | ||
107 | static int coh901318_debugfs_open(struct inode *inode, struct file *file) | ||
108 | { | ||
109 | |||
110 | file->private_data = inode->i_private; | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | static int coh901318_debugfs_read(struct file *file, char __user *buf, | 107 | static int coh901318_debugfs_read(struct file *file, char __user *buf, |
115 | size_t count, loff_t *f_pos) | 108 | size_t count, loff_t *f_pos) |
116 | { | 109 | { |
@@ -158,7 +151,7 @@ static int coh901318_debugfs_read(struct file *file, char __user *buf, | |||
158 | 151 | ||
159 | static const struct file_operations coh901318_debugfs_status_operations = { | 152 | static const struct file_operations coh901318_debugfs_status_operations = { |
160 | .owner = THIS_MODULE, | 153 | .owner = THIS_MODULE, |
161 | .open = coh901318_debugfs_open, | 154 | .open = simple_open, |
162 | .read = coh901318_debugfs_read, | 155 | .read = coh901318_debugfs_read, |
163 | .llseek = default_llseek, | 156 | .llseek = default_llseek, |
164 | }; | 157 | }; |
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 767bcc31b365..2397f6f451b1 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c | |||
@@ -332,6 +332,20 @@ struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type) | |||
332 | } | 332 | } |
333 | EXPORT_SYMBOL(dma_find_channel); | 333 | EXPORT_SYMBOL(dma_find_channel); |
334 | 334 | ||
335 | /* | ||
336 | * net_dma_find_channel - find a channel for net_dma | ||
337 | * net_dma has alignment requirements | ||
338 | */ | ||
339 | struct dma_chan *net_dma_find_channel(void) | ||
340 | { | ||
341 | struct dma_chan *chan = dma_find_channel(DMA_MEMCPY); | ||
342 | if (chan && !is_dma_copy_aligned(chan->device, 1, 1, 1)) | ||
343 | return NULL; | ||
344 | |||
345 | return chan; | ||
346 | } | ||
347 | EXPORT_SYMBOL(net_dma_find_channel); | ||
348 | |||
335 | /** | 349 | /** |
336 | * dma_issue_pending_all - flush all pending operations across all channels | 350 | * dma_issue_pending_all - flush all pending operations across all channels |
337 | */ | 351 | */ |
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/ioat/dma.c b/drivers/dma/ioat/dma.c index 31493d80e0e9..73b2b65cb1de 100644 --- a/drivers/dma/ioat/dma.c +++ b/drivers/dma/ioat/dma.c | |||
@@ -546,9 +546,9 @@ void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, | |||
546 | PCI_DMA_TODEVICE, flags, 0); | 546 | PCI_DMA_TODEVICE, flags, 0); |
547 | } | 547 | } |
548 | 548 | ||
549 | unsigned long ioat_get_current_completion(struct ioat_chan_common *chan) | 549 | dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan) |
550 | { | 550 | { |
551 | unsigned long phys_complete; | 551 | dma_addr_t phys_complete; |
552 | u64 completion; | 552 | u64 completion; |
553 | 553 | ||
554 | completion = *chan->completion; | 554 | completion = *chan->completion; |
@@ -569,7 +569,7 @@ unsigned long ioat_get_current_completion(struct ioat_chan_common *chan) | |||
569 | } | 569 | } |
570 | 570 | ||
571 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | 571 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, |
572 | unsigned long *phys_complete) | 572 | dma_addr_t *phys_complete) |
573 | { | 573 | { |
574 | *phys_complete = ioat_get_current_completion(chan); | 574 | *phys_complete = ioat_get_current_completion(chan); |
575 | if (*phys_complete == chan->last_completion) | 575 | if (*phys_complete == chan->last_completion) |
@@ -580,14 +580,14 @@ bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | |||
580 | return true; | 580 | return true; |
581 | } | 581 | } |
582 | 582 | ||
583 | static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete) | 583 | static void __cleanup(struct ioat_dma_chan *ioat, dma_addr_t phys_complete) |
584 | { | 584 | { |
585 | struct ioat_chan_common *chan = &ioat->base; | 585 | struct ioat_chan_common *chan = &ioat->base; |
586 | struct list_head *_desc, *n; | 586 | struct list_head *_desc, *n; |
587 | struct dma_async_tx_descriptor *tx; | 587 | struct dma_async_tx_descriptor *tx; |
588 | 588 | ||
589 | dev_dbg(to_dev(chan), "%s: phys_complete: %lx\n", | 589 | dev_dbg(to_dev(chan), "%s: phys_complete: %llx\n", |
590 | __func__, phys_complete); | 590 | __func__, (unsigned long long) phys_complete); |
591 | list_for_each_safe(_desc, n, &ioat->used_desc) { | 591 | list_for_each_safe(_desc, n, &ioat->used_desc) { |
592 | struct ioat_desc_sw *desc; | 592 | struct ioat_desc_sw *desc; |
593 | 593 | ||
@@ -652,7 +652,7 @@ static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete) | |||
652 | static void ioat1_cleanup(struct ioat_dma_chan *ioat) | 652 | static void ioat1_cleanup(struct ioat_dma_chan *ioat) |
653 | { | 653 | { |
654 | struct ioat_chan_common *chan = &ioat->base; | 654 | struct ioat_chan_common *chan = &ioat->base; |
655 | unsigned long phys_complete; | 655 | dma_addr_t phys_complete; |
656 | 656 | ||
657 | prefetch(chan->completion); | 657 | prefetch(chan->completion); |
658 | 658 | ||
@@ -698,7 +698,7 @@ static void ioat1_timer_event(unsigned long data) | |||
698 | mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); | 698 | mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT); |
699 | spin_unlock_bh(&ioat->desc_lock); | 699 | spin_unlock_bh(&ioat->desc_lock); |
700 | } else if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 700 | } else if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
701 | unsigned long phys_complete; | 701 | dma_addr_t phys_complete; |
702 | 702 | ||
703 | spin_lock_bh(&ioat->desc_lock); | 703 | spin_lock_bh(&ioat->desc_lock); |
704 | /* if we haven't made progress and we have already | 704 | /* if we haven't made progress and we have already |
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h index c7888bccd974..5e8fe01ba69d 100644 --- a/drivers/dma/ioat/dma.h +++ b/drivers/dma/ioat/dma.h | |||
@@ -88,7 +88,7 @@ struct ioatdma_device { | |||
88 | struct ioat_chan_common { | 88 | struct ioat_chan_common { |
89 | struct dma_chan common; | 89 | struct dma_chan common; |
90 | void __iomem *reg_base; | 90 | void __iomem *reg_base; |
91 | unsigned long last_completion; | 91 | dma_addr_t last_completion; |
92 | spinlock_t cleanup_lock; | 92 | spinlock_t cleanup_lock; |
93 | unsigned long state; | 93 | unsigned long state; |
94 | #define IOAT_COMPLETION_PENDING 0 | 94 | #define IOAT_COMPLETION_PENDING 0 |
@@ -310,7 +310,7 @@ int __devinit ioat_dma_self_test(struct ioatdma_device *device); | |||
310 | void __devexit ioat_dma_remove(struct ioatdma_device *device); | 310 | void __devexit ioat_dma_remove(struct ioatdma_device *device); |
311 | struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev, | 311 | struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev, |
312 | void __iomem *iobase); | 312 | void __iomem *iobase); |
313 | unsigned long ioat_get_current_completion(struct ioat_chan_common *chan); | 313 | dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan); |
314 | void ioat_init_channel(struct ioatdma_device *device, | 314 | void ioat_init_channel(struct ioatdma_device *device, |
315 | struct ioat_chan_common *chan, int idx); | 315 | struct ioat_chan_common *chan, int idx); |
316 | enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, | 316 | enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, |
@@ -318,7 +318,7 @@ enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie, | |||
318 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, | 318 | void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags, |
319 | size_t len, struct ioat_dma_descriptor *hw); | 319 | size_t len, struct ioat_dma_descriptor *hw); |
320 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, | 320 | bool ioat_cleanup_preamble(struct ioat_chan_common *chan, |
321 | unsigned long *phys_complete); | 321 | dma_addr_t *phys_complete); |
322 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); | 322 | void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type); |
323 | void ioat_kobject_del(struct ioatdma_device *device); | 323 | void ioat_kobject_del(struct ioatdma_device *device); |
324 | extern const struct sysfs_ops ioat_sysfs_ops; | 324 | extern const struct sysfs_ops ioat_sysfs_ops; |
diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c index e8e110ff3d96..86895760b598 100644 --- a/drivers/dma/ioat/dma_v2.c +++ b/drivers/dma/ioat/dma_v2.c | |||
@@ -128,7 +128,7 @@ static void ioat2_start_null_desc(struct ioat2_dma_chan *ioat) | |||
128 | spin_unlock_bh(&ioat->prep_lock); | 128 | spin_unlock_bh(&ioat->prep_lock); |
129 | } | 129 | } |
130 | 130 | ||
131 | static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | 131 | static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete) |
132 | { | 132 | { |
133 | struct ioat_chan_common *chan = &ioat->base; | 133 | struct ioat_chan_common *chan = &ioat->base; |
134 | struct dma_async_tx_descriptor *tx; | 134 | struct dma_async_tx_descriptor *tx; |
@@ -179,7 +179,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | |||
179 | static void ioat2_cleanup(struct ioat2_dma_chan *ioat) | 179 | static void ioat2_cleanup(struct ioat2_dma_chan *ioat) |
180 | { | 180 | { |
181 | struct ioat_chan_common *chan = &ioat->base; | 181 | struct ioat_chan_common *chan = &ioat->base; |
182 | unsigned long phys_complete; | 182 | dma_addr_t phys_complete; |
183 | 183 | ||
184 | spin_lock_bh(&chan->cleanup_lock); | 184 | spin_lock_bh(&chan->cleanup_lock); |
185 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 185 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -260,7 +260,7 @@ int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo) | |||
260 | static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) | 260 | static void ioat2_restart_channel(struct ioat2_dma_chan *ioat) |
261 | { | 261 | { |
262 | struct ioat_chan_common *chan = &ioat->base; | 262 | struct ioat_chan_common *chan = &ioat->base; |
263 | unsigned long phys_complete; | 263 | dma_addr_t phys_complete; |
264 | 264 | ||
265 | ioat2_quiesce(chan, 0); | 265 | ioat2_quiesce(chan, 0); |
266 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 266 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -275,7 +275,7 @@ void ioat2_timer_event(unsigned long data) | |||
275 | struct ioat_chan_common *chan = &ioat->base; | 275 | struct ioat_chan_common *chan = &ioat->base; |
276 | 276 | ||
277 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 277 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
278 | unsigned long phys_complete; | 278 | dma_addr_t phys_complete; |
279 | u64 status; | 279 | u64 status; |
280 | 280 | ||
281 | status = ioat_chansts(chan); | 281 | status = ioat_chansts(chan); |
@@ -572,9 +572,9 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order) | |||
572 | */ | 572 | */ |
573 | struct ioat_chan_common *chan = &ioat->base; | 573 | struct ioat_chan_common *chan = &ioat->base; |
574 | struct dma_chan *c = &chan->common; | 574 | struct dma_chan *c = &chan->common; |
575 | const u16 curr_size = ioat2_ring_size(ioat); | 575 | const u32 curr_size = ioat2_ring_size(ioat); |
576 | const u16 active = ioat2_ring_active(ioat); | 576 | const u16 active = ioat2_ring_active(ioat); |
577 | const u16 new_size = 1 << order; | 577 | const u32 new_size = 1 << order; |
578 | struct ioat_ring_ent **ring; | 578 | struct ioat_ring_ent **ring; |
579 | u16 i; | 579 | u16 i; |
580 | 580 | ||
diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h index a2c413b2b8d8..be2a55b95c23 100644 --- a/drivers/dma/ioat/dma_v2.h +++ b/drivers/dma/ioat/dma_v2.h | |||
@@ -74,7 +74,7 @@ static inline struct ioat2_dma_chan *to_ioat2_chan(struct dma_chan *c) | |||
74 | return container_of(chan, struct ioat2_dma_chan, base); | 74 | return container_of(chan, struct ioat2_dma_chan, base); |
75 | } | 75 | } |
76 | 76 | ||
77 | static inline u16 ioat2_ring_size(struct ioat2_dma_chan *ioat) | 77 | static inline u32 ioat2_ring_size(struct ioat2_dma_chan *ioat) |
78 | { | 78 | { |
79 | return 1 << ioat->alloc_order; | 79 | return 1 << ioat->alloc_order; |
80 | } | 80 | } |
@@ -91,7 +91,7 @@ static inline u16 ioat2_ring_pending(struct ioat2_dma_chan *ioat) | |||
91 | return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat)); | 91 | return CIRC_CNT(ioat->head, ioat->issued, ioat2_ring_size(ioat)); |
92 | } | 92 | } |
93 | 93 | ||
94 | static inline u16 ioat2_ring_space(struct ioat2_dma_chan *ioat) | 94 | static inline u32 ioat2_ring_space(struct ioat2_dma_chan *ioat) |
95 | { | 95 | { |
96 | return ioat2_ring_size(ioat) - ioat2_ring_active(ioat); | 96 | return ioat2_ring_size(ioat) - ioat2_ring_active(ioat); |
97 | } | 97 | } |
diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c index 2c4476c0e405..f7f1dc62c15c 100644 --- a/drivers/dma/ioat/dma_v3.c +++ b/drivers/dma/ioat/dma_v3.c | |||
@@ -257,7 +257,7 @@ static bool desc_has_ext(struct ioat_ring_ent *desc) | |||
257 | * The difference from the dma_v2.c __cleanup() is that this routine | 257 | * The difference from the dma_v2.c __cleanup() is that this routine |
258 | * handles extended descriptors and dma-unmapping raid operations. | 258 | * handles extended descriptors and dma-unmapping raid operations. |
259 | */ | 259 | */ |
260 | static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | 260 | static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete) |
261 | { | 261 | { |
262 | struct ioat_chan_common *chan = &ioat->base; | 262 | struct ioat_chan_common *chan = &ioat->base; |
263 | struct ioat_ring_ent *desc; | 263 | struct ioat_ring_ent *desc; |
@@ -314,7 +314,7 @@ static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete) | |||
314 | static void ioat3_cleanup(struct ioat2_dma_chan *ioat) | 314 | static void ioat3_cleanup(struct ioat2_dma_chan *ioat) |
315 | { | 315 | { |
316 | struct ioat_chan_common *chan = &ioat->base; | 316 | struct ioat_chan_common *chan = &ioat->base; |
317 | unsigned long phys_complete; | 317 | dma_addr_t phys_complete; |
318 | 318 | ||
319 | spin_lock_bh(&chan->cleanup_lock); | 319 | spin_lock_bh(&chan->cleanup_lock); |
320 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 320 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -333,7 +333,7 @@ static void ioat3_cleanup_event(unsigned long data) | |||
333 | static void ioat3_restart_channel(struct ioat2_dma_chan *ioat) | 333 | static void ioat3_restart_channel(struct ioat2_dma_chan *ioat) |
334 | { | 334 | { |
335 | struct ioat_chan_common *chan = &ioat->base; | 335 | struct ioat_chan_common *chan = &ioat->base; |
336 | unsigned long phys_complete; | 336 | dma_addr_t phys_complete; |
337 | 337 | ||
338 | ioat2_quiesce(chan, 0); | 338 | ioat2_quiesce(chan, 0); |
339 | if (ioat_cleanup_preamble(chan, &phys_complete)) | 339 | if (ioat_cleanup_preamble(chan, &phys_complete)) |
@@ -348,7 +348,7 @@ static void ioat3_timer_event(unsigned long data) | |||
348 | struct ioat_chan_common *chan = &ioat->base; | 348 | struct ioat_chan_common *chan = &ioat->base; |
349 | 349 | ||
350 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { | 350 | if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) { |
351 | unsigned long phys_complete; | 351 | dma_addr_t phys_complete; |
352 | u64 status; | 352 | u64 status; |
353 | 353 | ||
354 | status = ioat_chansts(chan); | 354 | status = ioat_chansts(chan); |
@@ -1149,6 +1149,44 @@ static int ioat3_reset_hw(struct ioat_chan_common *chan) | |||
1149 | return ioat2_reset_sync(chan, msecs_to_jiffies(200)); | 1149 | return ioat2_reset_sync(chan, msecs_to_jiffies(200)); |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | static bool is_jf_ioat(struct pci_dev *pdev) | ||
1153 | { | ||
1154 | switch (pdev->device) { | ||
1155 | case PCI_DEVICE_ID_INTEL_IOAT_JSF0: | ||
1156 | case PCI_DEVICE_ID_INTEL_IOAT_JSF1: | ||
1157 | case PCI_DEVICE_ID_INTEL_IOAT_JSF2: | ||
1158 | case PCI_DEVICE_ID_INTEL_IOAT_JSF3: | ||
1159 | case PCI_DEVICE_ID_INTEL_IOAT_JSF4: | ||
1160 | case PCI_DEVICE_ID_INTEL_IOAT_JSF5: | ||
1161 | case PCI_DEVICE_ID_INTEL_IOAT_JSF6: | ||
1162 | case PCI_DEVICE_ID_INTEL_IOAT_JSF7: | ||
1163 | case PCI_DEVICE_ID_INTEL_IOAT_JSF8: | ||
1164 | case PCI_DEVICE_ID_INTEL_IOAT_JSF9: | ||
1165 | return true; | ||
1166 | default: | ||
1167 | return false; | ||
1168 | } | ||
1169 | } | ||
1170 | |||
1171 | static bool is_snb_ioat(struct pci_dev *pdev) | ||
1172 | { | ||
1173 | switch (pdev->device) { | ||
1174 | case PCI_DEVICE_ID_INTEL_IOAT_SNB0: | ||
1175 | case PCI_DEVICE_ID_INTEL_IOAT_SNB1: | ||
1176 | case PCI_DEVICE_ID_INTEL_IOAT_SNB2: | ||
1177 | case PCI_DEVICE_ID_INTEL_IOAT_SNB3: | ||
1178 | case PCI_DEVICE_ID_INTEL_IOAT_SNB4: | ||
1179 | case PCI_DEVICE_ID_INTEL_IOAT_SNB5: | ||
1180 | case PCI_DEVICE_ID_INTEL_IOAT_SNB6: | ||
1181 | case PCI_DEVICE_ID_INTEL_IOAT_SNB7: | ||
1182 | case PCI_DEVICE_ID_INTEL_IOAT_SNB8: | ||
1183 | case PCI_DEVICE_ID_INTEL_IOAT_SNB9: | ||
1184 | return true; | ||
1185 | default: | ||
1186 | return false; | ||
1187 | } | ||
1188 | } | ||
1189 | |||
1152 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | 1190 | int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) |
1153 | { | 1191 | { |
1154 | struct pci_dev *pdev = device->pdev; | 1192 | struct pci_dev *pdev = device->pdev; |
@@ -1169,6 +1207,9 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca) | |||
1169 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; | 1207 | dma->device_alloc_chan_resources = ioat2_alloc_chan_resources; |
1170 | dma->device_free_chan_resources = ioat2_free_chan_resources; | 1208 | dma->device_free_chan_resources = ioat2_free_chan_resources; |
1171 | 1209 | ||
1210 | if (is_jf_ioat(pdev) || is_snb_ioat(pdev)) | ||
1211 | dma->copy_align = 6; | ||
1212 | |||
1172 | dma_cap_set(DMA_INTERRUPT, dma->cap_mask); | 1213 | dma_cap_set(DMA_INTERRUPT, dma->cap_mask); |
1173 | dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock; | 1214 | dma->device_prep_dma_interrupt = ioat3_prep_interrupt_lock; |
1174 | 1215 | ||
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index da6c4c2c066a..79e3eba29702 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -1252,8 +1252,8 @@ iop_adma_pq_zero_sum_self_test(struct iop_adma_device *device) | |||
1252 | struct page **pq_hw = &pq[IOP_ADMA_NUM_SRC_TEST+2]; | 1252 | struct page **pq_hw = &pq[IOP_ADMA_NUM_SRC_TEST+2]; |
1253 | /* address conversion buffers (dma_map / page_address) */ | 1253 | /* address conversion buffers (dma_map / page_address) */ |
1254 | void *pq_sw[IOP_ADMA_NUM_SRC_TEST+2]; | 1254 | void *pq_sw[IOP_ADMA_NUM_SRC_TEST+2]; |
1255 | dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST]; | 1255 | dma_addr_t pq_src[IOP_ADMA_NUM_SRC_TEST+2]; |
1256 | dma_addr_t pq_dest[2]; | 1256 | dma_addr_t *pq_dest = &pq_src[IOP_ADMA_NUM_SRC_TEST]; |
1257 | 1257 | ||
1258 | int i; | 1258 | int i; |
1259 | struct dma_async_tx_descriptor *tx; | 1259 | struct dma_async_tx_descriptor *tx; |
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/sa11x0-dma.c b/drivers/dma/sa11x0-dma.c index 16a6b48883cf..ec78ccef9132 100644 --- a/drivers/dma/sa11x0-dma.c +++ b/drivers/dma/sa11x0-dma.c | |||
@@ -585,7 +585,7 @@ static dma_cookie_t sa11x0_dma_tx_submit(struct dma_async_tx_descriptor *tx) | |||
585 | 585 | ||
586 | static struct dma_async_tx_descriptor *sa11x0_dma_prep_slave_sg( | 586 | static struct dma_async_tx_descriptor *sa11x0_dma_prep_slave_sg( |
587 | struct dma_chan *chan, struct scatterlist *sg, unsigned int sglen, | 587 | struct dma_chan *chan, struct scatterlist *sg, unsigned int sglen, |
588 | enum dma_transfer_direction dir, unsigned long flags) | 588 | enum dma_transfer_direction dir, unsigned long flags, void *context) |
589 | { | 589 | { |
590 | struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan); | 590 | struct sa11x0_dma_chan *c = to_sa11x0_dma_chan(chan); |
591 | struct sa11x0_dma_desc *txd; | 591 | struct sa11x0_dma_desc *txd; |
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/edac/mce_amd.c b/drivers/edac/mce_amd.c index 36e1486eb9aa..d0c372e30de4 100644 --- a/drivers/edac/mce_amd.c +++ b/drivers/edac/mce_amd.c | |||
@@ -754,9 +754,7 @@ static int __init mce_amd_init(void) | |||
754 | if (c->x86_vendor != X86_VENDOR_AMD) | 754 | if (c->x86_vendor != X86_VENDOR_AMD) |
755 | return 0; | 755 | return 0; |
756 | 756 | ||
757 | if ((c->x86 < 0xf || c->x86 > 0x12) && | 757 | if (c->x86 < 0xf || c->x86 > 0x15) |
758 | (c->x86 != 0x14 || c->x86_model > 0xf) && | ||
759 | (c->x86 != 0x15 || c->x86_model > 0xf)) | ||
760 | return 0; | 758 | return 0; |
761 | 759 | ||
762 | fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); | 760 | fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL); |
@@ -797,7 +795,7 @@ static int __init mce_amd_init(void) | |||
797 | break; | 795 | break; |
798 | 796 | ||
799 | default: | 797 | default: |
800 | printk(KERN_WARNING "Huh? What family is that: %d?!\n", c->x86); | 798 | printk(KERN_WARNING "Huh? What family is it: 0x%x?!\n", c->x86); |
801 | kfree(fam_ops); | 799 | kfree(fam_ops); |
802 | return -EINVAL; | 800 | return -EINVAL; |
803 | } | 801 | } |
diff --git a/drivers/edac/tile_edac.c b/drivers/edac/tile_edac.c index 1d5cf06f6c6b..e99d00976189 100644 --- a/drivers/edac/tile_edac.c +++ b/drivers/edac/tile_edac.c | |||
@@ -145,7 +145,11 @@ static int __devinit tile_edac_mc_probe(struct platform_device *pdev) | |||
145 | mci->edac_ctl_cap = EDAC_FLAG_SECDED; | 145 | mci->edac_ctl_cap = EDAC_FLAG_SECDED; |
146 | 146 | ||
147 | mci->mod_name = DRV_NAME; | 147 | mci->mod_name = DRV_NAME; |
148 | #ifdef __tilegx__ | ||
149 | mci->ctl_name = "TILEGx_Memory_Controller"; | ||
150 | #else | ||
148 | mci->ctl_name = "TILEPro_Memory_Controller"; | 151 | mci->ctl_name = "TILEPro_Memory_Controller"; |
152 | #endif | ||
149 | mci->dev_name = dev_name(&pdev->dev); | 153 | mci->dev_name = dev_name(&pdev->dev); |
150 | mci->edac_check = tile_edac_check; | 154 | mci->edac_check = tile_edac_check; |
151 | 155 | ||
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/Kconfig b/drivers/gpio/Kconfig index edadbdad31d0..e03653d69357 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -430,7 +430,7 @@ config GPIO_ML_IOH | |||
430 | 430 | ||
431 | config GPIO_SODAVILLE | 431 | config GPIO_SODAVILLE |
432 | bool "Intel Sodaville GPIO support" | 432 | bool "Intel Sodaville GPIO support" |
433 | depends on X86 && PCI && OF && BROKEN | 433 | depends on X86 && PCI && OF |
434 | select GPIO_GENERIC | 434 | select GPIO_GENERIC |
435 | select GENERIC_IRQ_CHIP | 435 | select GENERIC_IRQ_CHIP |
436 | help | 436 | help |
diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c index 9ad1703d1408..ae5d7f12ce66 100644 --- a/drivers/gpio/gpio-adp5588.c +++ b/drivers/gpio/gpio-adp5588.c | |||
@@ -252,7 +252,7 @@ static irqreturn_t adp5588_irq_handler(int irq, void *devid) | |||
252 | if (ret < 0) | 252 | if (ret < 0) |
253 | memset(dev->irq_stat, 0, ARRAY_SIZE(dev->irq_stat)); | 253 | memset(dev->irq_stat, 0, ARRAY_SIZE(dev->irq_stat)); |
254 | 254 | ||
255 | for (bank = 0; bank <= ADP5588_BANK(ADP5588_MAXGPIO); | 255 | for (bank = 0, bit = 0; bank <= ADP5588_BANK(ADP5588_MAXGPIO); |
256 | bank++, bit = 0) { | 256 | bank++, bit = 0) { |
257 | pending = dev->irq_stat[bank] & dev->irq_mask[bank]; | 257 | pending = dev->irq_stat[bank] & dev->irq_mask[bank]; |
258 | 258 | ||
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/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 46277877b7ec..19d6fc0229c3 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -2382,8 +2382,8 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { | |||
2382 | #endif | 2382 | #endif |
2383 | }; | 2383 | }; |
2384 | 2384 | ||
2385 | static struct samsung_gpio_chip exynos5_gpios_1[] = { | ||
2386 | #ifdef CONFIG_ARCH_EXYNOS5 | 2385 | #ifdef CONFIG_ARCH_EXYNOS5 |
2386 | static struct samsung_gpio_chip exynos5_gpios_1[] = { | ||
2387 | { | 2387 | { |
2388 | .chip = { | 2388 | .chip = { |
2389 | .base = EXYNOS5_GPA0(0), | 2389 | .base = EXYNOS5_GPA0(0), |
@@ -2541,11 +2541,11 @@ static struct samsung_gpio_chip exynos5_gpios_1[] = { | |||
2541 | .to_irq = samsung_gpiolib_to_irq, | 2541 | .to_irq = samsung_gpiolib_to_irq, |
2542 | }, | 2542 | }, |
2543 | }, | 2543 | }, |
2544 | #endif | ||
2545 | }; | 2544 | }; |
2545 | #endif | ||
2546 | 2546 | ||
2547 | static struct samsung_gpio_chip exynos5_gpios_2[] = { | ||
2548 | #ifdef CONFIG_ARCH_EXYNOS5 | 2547 | #ifdef CONFIG_ARCH_EXYNOS5 |
2548 | static struct samsung_gpio_chip exynos5_gpios_2[] = { | ||
2549 | { | 2549 | { |
2550 | .chip = { | 2550 | .chip = { |
2551 | .base = EXYNOS5_GPE0(0), | 2551 | .base = EXYNOS5_GPE0(0), |
@@ -2602,11 +2602,11 @@ static struct samsung_gpio_chip exynos5_gpios_2[] = { | |||
2602 | 2602 | ||
2603 | }, | 2603 | }, |
2604 | }, | 2604 | }, |
2605 | #endif | ||
2606 | }; | 2605 | }; |
2606 | #endif | ||
2607 | 2607 | ||
2608 | static struct samsung_gpio_chip exynos5_gpios_3[] = { | ||
2609 | #ifdef CONFIG_ARCH_EXYNOS5 | 2608 | #ifdef CONFIG_ARCH_EXYNOS5 |
2609 | static struct samsung_gpio_chip exynos5_gpios_3[] = { | ||
2610 | { | 2610 | { |
2611 | .chip = { | 2611 | .chip = { |
2612 | .base = EXYNOS5_GPV0(0), | 2612 | .base = EXYNOS5_GPV0(0), |
@@ -2638,11 +2638,11 @@ static struct samsung_gpio_chip exynos5_gpios_3[] = { | |||
2638 | .label = "GPV4", | 2638 | .label = "GPV4", |
2639 | }, | 2639 | }, |
2640 | }, | 2640 | }, |
2641 | #endif | ||
2642 | }; | 2641 | }; |
2642 | #endif | ||
2643 | 2643 | ||
2644 | static struct samsung_gpio_chip exynos5_gpios_4[] = { | ||
2645 | #ifdef CONFIG_ARCH_EXYNOS5 | 2644 | #ifdef CONFIG_ARCH_EXYNOS5 |
2645 | static struct samsung_gpio_chip exynos5_gpios_4[] = { | ||
2646 | { | 2646 | { |
2647 | .chip = { | 2647 | .chip = { |
2648 | .base = EXYNOS5_GPZ(0), | 2648 | .base = EXYNOS5_GPZ(0), |
@@ -2650,8 +2650,8 @@ static struct samsung_gpio_chip exynos5_gpios_4[] = { | |||
2650 | .label = "GPZ", | 2650 | .label = "GPZ", |
2651 | }, | 2651 | }, |
2652 | }, | 2652 | }, |
2653 | #endif | ||
2654 | }; | 2653 | }; |
2654 | #endif | ||
2655 | 2655 | ||
2656 | 2656 | ||
2657 | #if defined(CONFIG_ARCH_EXYNOS) && defined(CONFIG_OF) | 2657 | #if defined(CONFIG_ARCH_EXYNOS) && defined(CONFIG_OF) |
diff --git a/drivers/gpio/gpio-sodaville.c b/drivers/gpio/gpio-sodaville.c index 9ba15d31d242..031e5d24837d 100644 --- a/drivers/gpio/gpio-sodaville.c +++ b/drivers/gpio/gpio-sodaville.c | |||
@@ -41,7 +41,7 @@ | |||
41 | struct sdv_gpio_chip_data { | 41 | struct sdv_gpio_chip_data { |
42 | int irq_base; | 42 | int irq_base; |
43 | void __iomem *gpio_pub_base; | 43 | void __iomem *gpio_pub_base; |
44 | struct irq_domain id; | 44 | struct irq_domain *id; |
45 | struct irq_chip_generic *gc; | 45 | struct irq_chip_generic *gc; |
46 | struct bgpio_chip bgpio; | 46 | struct bgpio_chip bgpio; |
47 | }; | 47 | }; |
@@ -51,10 +51,9 @@ static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type) | |||
51 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 51 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
52 | struct sdv_gpio_chip_data *sd = gc->private; | 52 | struct sdv_gpio_chip_data *sd = gc->private; |
53 | void __iomem *type_reg; | 53 | void __iomem *type_reg; |
54 | u32 irq_offs = d->irq - sd->irq_base; | ||
55 | u32 reg; | 54 | u32 reg; |
56 | 55 | ||
57 | if (irq_offs < 8) | 56 | if (d->hwirq < 8) |
58 | type_reg = sd->gpio_pub_base + GPIT1R0; | 57 | type_reg = sd->gpio_pub_base + GPIT1R0; |
59 | else | 58 | else |
60 | type_reg = sd->gpio_pub_base + GPIT1R1; | 59 | type_reg = sd->gpio_pub_base + GPIT1R1; |
@@ -63,11 +62,11 @@ static int sdv_gpio_pub_set_type(struct irq_data *d, unsigned int type) | |||
63 | 62 | ||
64 | switch (type) { | 63 | switch (type) { |
65 | case IRQ_TYPE_LEVEL_HIGH: | 64 | case IRQ_TYPE_LEVEL_HIGH: |
66 | reg &= ~BIT(4 * (irq_offs % 8)); | 65 | reg &= ~BIT(4 * (d->hwirq % 8)); |
67 | break; | 66 | break; |
68 | 67 | ||
69 | case IRQ_TYPE_LEVEL_LOW: | 68 | case IRQ_TYPE_LEVEL_LOW: |
70 | reg |= BIT(4 * (irq_offs % 8)); | 69 | reg |= BIT(4 * (d->hwirq % 8)); |
71 | break; | 70 | break; |
72 | 71 | ||
73 | default: | 72 | default: |
@@ -91,7 +90,7 @@ static irqreturn_t sdv_gpio_pub_irq_handler(int irq, void *data) | |||
91 | u32 irq_bit = __fls(irq_stat); | 90 | u32 irq_bit = __fls(irq_stat); |
92 | 91 | ||
93 | irq_stat &= ~BIT(irq_bit); | 92 | irq_stat &= ~BIT(irq_bit); |
94 | generic_handle_irq(sd->irq_base + irq_bit); | 93 | generic_handle_irq(irq_find_mapping(sd->id, irq_bit)); |
95 | } | 94 | } |
96 | 95 | ||
97 | return IRQ_HANDLED; | 96 | return IRQ_HANDLED; |
@@ -127,7 +126,7 @@ static int sdv_xlate(struct irq_domain *h, struct device_node *node, | |||
127 | } | 126 | } |
128 | 127 | ||
129 | static struct irq_domain_ops irq_domain_sdv_ops = { | 128 | static struct irq_domain_ops irq_domain_sdv_ops = { |
130 | .dt_translate = sdv_xlate, | 129 | .xlate = sdv_xlate, |
131 | }; | 130 | }; |
132 | 131 | ||
133 | static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | 132 | static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, |
@@ -149,10 +148,6 @@ static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | |||
149 | if (ret) | 148 | if (ret) |
150 | goto out_free_desc; | 149 | goto out_free_desc; |
151 | 150 | ||
152 | sd->id.irq_base = sd->irq_base; | ||
153 | sd->id.of_node = of_node_get(pdev->dev.of_node); | ||
154 | sd->id.ops = &irq_domain_sdv_ops; | ||
155 | |||
156 | /* | 151 | /* |
157 | * This gpio irq controller latches level irqs. Testing shows that if | 152 | * This gpio irq controller latches level irqs. Testing shows that if |
158 | * we unmask & ACK the IRQ before the source of the interrupt is gone | 153 | * we unmask & ACK the IRQ before the source of the interrupt is gone |
@@ -179,7 +174,10 @@ static __devinit int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, | |||
179 | IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, | 174 | IRQ_GC_INIT_MASK_CACHE, IRQ_NOREQUEST, |
180 | IRQ_LEVEL | IRQ_NOPROBE); | 175 | IRQ_LEVEL | IRQ_NOPROBE); |
181 | 176 | ||
182 | irq_domain_add(&sd->id); | 177 | sd->id = irq_domain_add_legacy(pdev->dev.of_node, SDV_NUM_PUB_GPIOS, |
178 | sd->irq_base, 0, &irq_domain_sdv_ops, sd); | ||
179 | if (!sd->id) | ||
180 | goto out_free_irq; | ||
183 | return 0; | 181 | return 0; |
184 | out_free_irq: | 182 | out_free_irq: |
185 | free_irq(pdev->irq, sd); | 183 | free_irq(pdev->irq, sd); |
@@ -260,7 +258,6 @@ static void sdv_gpio_remove(struct pci_dev *pdev) | |||
260 | { | 258 | { |
261 | struct sdv_gpio_chip_data *sd = pci_get_drvdata(pdev); | 259 | struct sdv_gpio_chip_data *sd = pci_get_drvdata(pdev); |
262 | 260 | ||
263 | irq_domain_del(&sd->id); | ||
264 | free_irq(pdev->irq, sd); | 261 | free_irq(pdev->irq, sd); |
265 | irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); | 262 | irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS); |
266 | 263 | ||
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 32de6707e3c4..12f349b3830d 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/of.h> | 25 | #include <linux/of_device.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/irqdomain.h> | 28 | #include <linux/irqdomain.h> |
@@ -37,7 +37,8 @@ | |||
37 | #define GPIO_PORT(x) (((x) >> 3) & 0x3) | 37 | #define GPIO_PORT(x) (((x) >> 3) & 0x3) |
38 | #define GPIO_BIT(x) ((x) & 0x7) | 38 | #define GPIO_BIT(x) ((x) & 0x7) |
39 | 39 | ||
40 | #define GPIO_REG(x) (GPIO_BANK(x) * 0x80 + GPIO_PORT(x) * 4) | 40 | #define GPIO_REG(x) (GPIO_BANK(x) * tegra_gpio_bank_stride + \ |
41 | GPIO_PORT(x) * 4) | ||
41 | 42 | ||
42 | #define GPIO_CNF(x) (GPIO_REG(x) + 0x00) | 43 | #define GPIO_CNF(x) (GPIO_REG(x) + 0x00) |
43 | #define GPIO_OE(x) (GPIO_REG(x) + 0x10) | 44 | #define GPIO_OE(x) (GPIO_REG(x) + 0x10) |
@@ -48,12 +49,12 @@ | |||
48 | #define GPIO_INT_LVL(x) (GPIO_REG(x) + 0x60) | 49 | #define GPIO_INT_LVL(x) (GPIO_REG(x) + 0x60) |
49 | #define GPIO_INT_CLR(x) (GPIO_REG(x) + 0x70) | 50 | #define GPIO_INT_CLR(x) (GPIO_REG(x) + 0x70) |
50 | 51 | ||
51 | #define GPIO_MSK_CNF(x) (GPIO_REG(x) + 0x800) | 52 | #define GPIO_MSK_CNF(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x00) |
52 | #define GPIO_MSK_OE(x) (GPIO_REG(x) + 0x810) | 53 | #define GPIO_MSK_OE(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x10) |
53 | #define GPIO_MSK_OUT(x) (GPIO_REG(x) + 0X820) | 54 | #define GPIO_MSK_OUT(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0X20) |
54 | #define GPIO_MSK_INT_STA(x) (GPIO_REG(x) + 0x840) | 55 | #define GPIO_MSK_INT_STA(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x40) |
55 | #define GPIO_MSK_INT_ENB(x) (GPIO_REG(x) + 0x850) | 56 | #define GPIO_MSK_INT_ENB(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x50) |
56 | #define GPIO_MSK_INT_LVL(x) (GPIO_REG(x) + 0x860) | 57 | #define GPIO_MSK_INT_LVL(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x60) |
57 | 58 | ||
58 | #define GPIO_INT_LVL_MASK 0x010101 | 59 | #define GPIO_INT_LVL_MASK 0x010101 |
59 | #define GPIO_INT_LVL_EDGE_RISING 0x000101 | 60 | #define GPIO_INT_LVL_EDGE_RISING 0x000101 |
@@ -78,6 +79,8 @@ struct tegra_gpio_bank { | |||
78 | static struct irq_domain *irq_domain; | 79 | static struct irq_domain *irq_domain; |
79 | static void __iomem *regs; | 80 | static void __iomem *regs; |
80 | static u32 tegra_gpio_bank_count; | 81 | static u32 tegra_gpio_bank_count; |
82 | static u32 tegra_gpio_bank_stride; | ||
83 | static u32 tegra_gpio_upper_offset; | ||
81 | static struct tegra_gpio_bank *tegra_gpio_banks; | 84 | static struct tegra_gpio_bank *tegra_gpio_banks; |
82 | 85 | ||
83 | static inline void tegra_gpio_writel(u32 val, u32 reg) | 86 | static inline void tegra_gpio_writel(u32 val, u32 reg) |
@@ -333,6 +336,26 @@ static struct irq_chip tegra_gpio_irq_chip = { | |||
333 | #endif | 336 | #endif |
334 | }; | 337 | }; |
335 | 338 | ||
339 | struct tegra_gpio_soc_config { | ||
340 | u32 bank_stride; | ||
341 | u32 upper_offset; | ||
342 | }; | ||
343 | |||
344 | static struct tegra_gpio_soc_config tegra20_gpio_config = { | ||
345 | .bank_stride = 0x80, | ||
346 | .upper_offset = 0x800, | ||
347 | }; | ||
348 | |||
349 | static struct tegra_gpio_soc_config tegra30_gpio_config = { | ||
350 | .bank_stride = 0x100, | ||
351 | .upper_offset = 0x80, | ||
352 | }; | ||
353 | |||
354 | static struct of_device_id tegra_gpio_of_match[] __devinitdata = { | ||
355 | { .compatible = "nvidia,tegra30-gpio", .data = &tegra30_gpio_config }, | ||
356 | { .compatible = "nvidia,tegra20-gpio", .data = &tegra20_gpio_config }, | ||
357 | { }, | ||
358 | }; | ||
336 | 359 | ||
337 | /* This lock class tells lockdep that GPIO irqs are in a different | 360 | /* This lock class tells lockdep that GPIO irqs are in a different |
338 | * category than their parents, so it won't report false recursion. | 361 | * category than their parents, so it won't report false recursion. |
@@ -341,6 +364,8 @@ static struct lock_class_key gpio_lock_class; | |||
341 | 364 | ||
342 | static int __devinit tegra_gpio_probe(struct platform_device *pdev) | 365 | static int __devinit tegra_gpio_probe(struct platform_device *pdev) |
343 | { | 366 | { |
367 | const struct of_device_id *match; | ||
368 | struct tegra_gpio_soc_config *config; | ||
344 | int irq_base; | 369 | int irq_base; |
345 | struct resource *res; | 370 | struct resource *res; |
346 | struct tegra_gpio_bank *bank; | 371 | struct tegra_gpio_bank *bank; |
@@ -348,6 +373,15 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
348 | int i; | 373 | int i; |
349 | int j; | 374 | int j; |
350 | 375 | ||
376 | match = of_match_device(tegra_gpio_of_match, &pdev->dev); | ||
377 | if (match) | ||
378 | config = (struct tegra_gpio_soc_config *)match->data; | ||
379 | else | ||
380 | config = &tegra20_gpio_config; | ||
381 | |||
382 | tegra_gpio_bank_stride = config->bank_stride; | ||
383 | tegra_gpio_upper_offset = config->upper_offset; | ||
384 | |||
351 | for (;;) { | 385 | for (;;) { |
352 | res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count); | 386 | res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count); |
353 | if (!res) | 387 | if (!res) |
@@ -402,7 +436,7 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
402 | return -ENODEV; | 436 | return -ENODEV; |
403 | } | 437 | } |
404 | 438 | ||
405 | for (i = 0; i < 7; i++) { | 439 | for (i = 0; i < tegra_gpio_bank_count; i++) { |
406 | for (j = 0; j < 4; j++) { | 440 | for (j = 0; j < 4; j++) { |
407 | int gpio = tegra_gpio_compose(i, j, 0); | 441 | int gpio = tegra_gpio_compose(i, j, 0); |
408 | tegra_gpio_writel(0x00, GPIO_INT_ENB(gpio)); | 442 | tegra_gpio_writel(0x00, GPIO_INT_ENB(gpio)); |
@@ -441,11 +475,6 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev) | |||
441 | return 0; | 475 | return 0; |
442 | } | 476 | } |
443 | 477 | ||
444 | static struct of_device_id tegra_gpio_of_match[] __devinitdata = { | ||
445 | { .compatible = "nvidia,tegra20-gpio", }, | ||
446 | { }, | ||
447 | }; | ||
448 | |||
449 | static struct platform_driver tegra_gpio_driver = { | 478 | static struct platform_driver tegra_gpio_driver = { |
450 | .driver = { | 479 | .driver = { |
451 | .name = "tegra-gpio", | 480 | .name = "tegra-gpio", |
@@ -485,7 +514,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused) | |||
485 | int i; | 514 | int i; |
486 | int j; | 515 | int j; |
487 | 516 | ||
488 | for (i = 0; i < 7; i++) { | 517 | for (i = 0; i < tegra_gpio_bank_count; i++) { |
489 | for (j = 0; j < 4; j++) { | 518 | for (j = 0; j < 4; j++) { |
490 | int gpio = tegra_gpio_compose(i, j, 0); | 519 | int gpio = tegra_gpio_compose(i, j, 0); |
491 | seq_printf(s, | 520 | seq_printf(s, |
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index cc1148837e24..e354bc0b052a 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig | |||
@@ -9,6 +9,7 @@ menuconfig DRM | |||
9 | depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU | 9 | depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && MMU |
10 | select I2C | 10 | select I2C |
11 | select I2C_ALGOBIT | 11 | select I2C_ALGOBIT |
12 | select DMA_SHARED_BUFFER | ||
12 | help | 13 | help |
13 | Kernel-level support for the Direct Rendering Infrastructure (DRI) | 14 | Kernel-level support for the Direct Rendering Infrastructure (DRI) |
14 | introduced in XFree86 4.0. If you say Y here, you need to select | 15 | introduced in XFree86 4.0. If you say Y here, you need to select |
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index a858532806ae..c20da5bda355 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile | |||
@@ -12,7 +12,7 @@ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ | |||
12 | drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ | 12 | drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ |
13 | drm_crtc.o drm_modes.o drm_edid.o \ | 13 | drm_crtc.o drm_modes.o drm_edid.o \ |
14 | drm_info.o drm_debugfs.o drm_encoder_slave.o \ | 14 | drm_info.o drm_debugfs.o drm_encoder_slave.o \ |
15 | drm_trace_points.o drm_global.o | 15 | drm_trace_points.o drm_global.o drm_prime.o |
16 | 16 | ||
17 | drm-$(CONFIG_COMPAT) += drm_ioc32.o | 17 | drm-$(CONFIG_COMPAT) += drm_ioc32.o |
18 | 18 | ||
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 30372f7b2d45..348b367debeb 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -1510,8 +1510,8 @@ int drm_freebufs(struct drm_device *dev, void *data, | |||
1510 | * \param arg pointer to a drm_buf_map structure. | 1510 | * \param arg pointer to a drm_buf_map structure. |
1511 | * \return zero on success or a negative number on failure. | 1511 | * \return zero on success or a negative number on failure. |
1512 | * | 1512 | * |
1513 | * Maps the AGP, SG or PCI buffer region with do_mmap(), and copies information | 1513 | * Maps the AGP, SG or PCI buffer region with vm_mmap(), and copies information |
1514 | * about each buffer into user space. For PCI buffers, it calls do_mmap() with | 1514 | * about each buffer into user space. For PCI buffers, it calls vm_mmap() with |
1515 | * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls | 1515 | * offset equal to 0, which drm_mmap() interpretes as PCI buffers and calls |
1516 | * drm_mmap_dma(). | 1516 | * drm_mmap_dma(). |
1517 | */ | 1517 | */ |
@@ -1553,18 +1553,14 @@ int drm_mapbufs(struct drm_device *dev, void *data, | |||
1553 | retcode = -EINVAL; | 1553 | retcode = -EINVAL; |
1554 | goto done; | 1554 | goto done; |
1555 | } | 1555 | } |
1556 | down_write(¤t->mm->mmap_sem); | 1556 | virtual = vm_mmap(file_priv->filp, 0, map->size, |
1557 | virtual = do_mmap(file_priv->filp, 0, map->size, | ||
1558 | PROT_READ | PROT_WRITE, | 1557 | PROT_READ | PROT_WRITE, |
1559 | MAP_SHARED, | 1558 | MAP_SHARED, |
1560 | token); | 1559 | token); |
1561 | up_write(¤t->mm->mmap_sem); | ||
1562 | } else { | 1560 | } else { |
1563 | down_write(¤t->mm->mmap_sem); | 1561 | virtual = vm_mmap(file_priv->filp, 0, dma->byte_count, |
1564 | virtual = do_mmap(file_priv->filp, 0, dma->byte_count, | ||
1565 | PROT_READ | PROT_WRITE, | 1562 | PROT_READ | PROT_WRITE, |
1566 | MAP_SHARED, 0); | 1563 | MAP_SHARED, 0); |
1567 | up_write(¤t->mm->mmap_sem); | ||
1568 | } | 1564 | } |
1569 | if (virtual > -1024UL) { | 1565 | if (virtual > -1024UL) { |
1570 | /* Real error */ | 1566 | /* Real error */ |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d3aaeb6ae236..c79870a75c2f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -3335,10 +3335,12 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
3335 | 3335 | ||
3336 | ret = crtc->funcs->page_flip(crtc, fb, e); | 3336 | ret = crtc->funcs->page_flip(crtc, fb, e); |
3337 | if (ret) { | 3337 | if (ret) { |
3338 | spin_lock_irqsave(&dev->event_lock, flags); | 3338 | if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { |
3339 | file_priv->event_space += sizeof e->event; | 3339 | spin_lock_irqsave(&dev->event_lock, flags); |
3340 | spin_unlock_irqrestore(&dev->event_lock, flags); | 3340 | file_priv->event_space += sizeof e->event; |
3341 | kfree(e); | 3341 | spin_unlock_irqrestore(&dev->event_lock, flags); |
3342 | kfree(e); | ||
3343 | } | ||
3342 | } | 3344 | } |
3343 | 3345 | ||
3344 | out: | 3346 | out: |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 0b65fbc8a630..6116e3b75393 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -136,6 +136,10 @@ static struct drm_ioctl_desc drm_ioctls[] = { | |||
136 | DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, DRM_AUTH|DRM_UNLOCKED), | 136 | DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, DRM_AUTH|DRM_UNLOCKED), |
137 | 137 | ||
138 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 138 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
139 | |||
140 | DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, drm_prime_handle_to_fd_ioctl, DRM_AUTH|DRM_UNLOCKED), | ||
141 | DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_UNLOCKED), | ||
142 | |||
139 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 143 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
140 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 144 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
141 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 145 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 7740dd26f007..a0d6e894d97c 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -559,9 +559,13 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var, | |||
559 | return -EINVAL; | 559 | return -EINVAL; |
560 | 560 | ||
561 | /* Need to resize the fb object !!! */ | 561 | /* Need to resize the fb object !!! */ |
562 | if (var->bits_per_pixel > fb->bits_per_pixel || var->xres > fb->width || var->yres > fb->height) { | 562 | if (var->bits_per_pixel > fb->bits_per_pixel || |
563 | var->xres > fb->width || var->yres > fb->height || | ||
564 | var->xres_virtual > fb->width || var->yres_virtual > fb->height) { | ||
563 | DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " | 565 | DRM_DEBUG("fb userspace requested width/height/bpp is greater than current fb " |
564 | "object %dx%d-%d > %dx%d-%d\n", var->xres, var->yres, var->bits_per_pixel, | 566 | "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n", |
567 | var->xres, var->yres, var->bits_per_pixel, | ||
568 | var->xres_virtual, var->yres_virtual, | ||
565 | fb->width, fb->height, fb->bits_per_pixel); | 569 | fb->width, fb->height, fb->bits_per_pixel); |
566 | return -EINVAL; | 570 | return -EINVAL; |
567 | } | 571 | } |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index 7348a3dab250..123de28f94ef 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -271,6 +271,9 @@ static int drm_open_helper(struct inode *inode, struct file *filp, | |||
271 | if (dev->driver->driver_features & DRIVER_GEM) | 271 | if (dev->driver->driver_features & DRIVER_GEM) |
272 | drm_gem_open(dev, priv); | 272 | drm_gem_open(dev, priv); |
273 | 273 | ||
274 | if (drm_core_check_feature(dev, DRIVER_PRIME)) | ||
275 | drm_prime_init_file_private(&priv->prime); | ||
276 | |||
274 | if (dev->driver->open) { | 277 | if (dev->driver->open) { |
275 | ret = dev->driver->open(dev, priv); | 278 | ret = dev->driver->open(dev, priv); |
276 | if (ret < 0) | 279 | if (ret < 0) |
@@ -504,12 +507,12 @@ int drm_release(struct inode *inode, struct file *filp) | |||
504 | 507 | ||
505 | drm_events_release(file_priv); | 508 | drm_events_release(file_priv); |
506 | 509 | ||
507 | if (dev->driver->driver_features & DRIVER_GEM) | ||
508 | drm_gem_release(dev, file_priv); | ||
509 | |||
510 | if (dev->driver->driver_features & DRIVER_MODESET) | 510 | if (dev->driver->driver_features & DRIVER_MODESET) |
511 | drm_fb_release(file_priv); | 511 | drm_fb_release(file_priv); |
512 | 512 | ||
513 | if (dev->driver->driver_features & DRIVER_GEM) | ||
514 | drm_gem_release(dev, file_priv); | ||
515 | |||
513 | mutex_lock(&dev->ctxlist_mutex); | 516 | mutex_lock(&dev->ctxlist_mutex); |
514 | if (!list_empty(&dev->ctxlist)) { | 517 | if (!list_empty(&dev->ctxlist)) { |
515 | struct drm_ctx_list *pos, *n; | 518 | struct drm_ctx_list *pos, *n; |
@@ -571,6 +574,10 @@ int drm_release(struct inode *inode, struct file *filp) | |||
571 | 574 | ||
572 | if (dev->driver->postclose) | 575 | if (dev->driver->postclose) |
573 | dev->driver->postclose(dev, file_priv); | 576 | dev->driver->postclose(dev, file_priv); |
577 | |||
578 | if (drm_core_check_feature(dev, DRIVER_PRIME)) | ||
579 | drm_prime_destroy_file_private(&file_priv->prime); | ||
580 | |||
574 | kfree(file_priv); | 581 | kfree(file_priv); |
575 | 582 | ||
576 | /* ======================================================== | 583 | /* ======================================================== |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 0ef358e53245..83114b5e3cee 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/mman.h> | 35 | #include <linux/mman.h> |
36 | #include <linux/pagemap.h> | 36 | #include <linux/pagemap.h> |
37 | #include <linux/shmem_fs.h> | 37 | #include <linux/shmem_fs.h> |
38 | #include <linux/dma-buf.h> | ||
38 | #include "drmP.h" | 39 | #include "drmP.h" |
39 | 40 | ||
40 | /** @file drm_gem.c | 41 | /** @file drm_gem.c |
@@ -232,6 +233,10 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle) | |||
232 | idr_remove(&filp->object_idr, handle); | 233 | idr_remove(&filp->object_idr, handle); |
233 | spin_unlock(&filp->table_lock); | 234 | spin_unlock(&filp->table_lock); |
234 | 235 | ||
236 | if (obj->import_attach) | ||
237 | drm_prime_remove_imported_buf_handle(&filp->prime, | ||
238 | obj->import_attach->dmabuf); | ||
239 | |||
235 | if (dev->driver->gem_close_object) | 240 | if (dev->driver->gem_close_object) |
236 | dev->driver->gem_close_object(obj, filp); | 241 | dev->driver->gem_close_object(obj, filp); |
237 | drm_gem_object_handle_unreference_unlocked(obj); | 242 | drm_gem_object_handle_unreference_unlocked(obj); |
@@ -527,6 +532,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data) | |||
527 | struct drm_gem_object *obj = ptr; | 532 | struct drm_gem_object *obj = ptr; |
528 | struct drm_device *dev = obj->dev; | 533 | struct drm_device *dev = obj->dev; |
529 | 534 | ||
535 | if (obj->import_attach) | ||
536 | drm_prime_remove_imported_buf_handle(&file_priv->prime, | ||
537 | obj->import_attach->dmabuf); | ||
538 | |||
530 | if (dev->driver->gem_close_object) | 539 | if (dev->driver->gem_close_object) |
531 | dev->driver->gem_close_object(obj, file_priv); | 540 | dev->driver->gem_close_object(obj, file_priv); |
532 | 541 | ||
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c new file mode 100644 index 000000000000..1bdf2b54eaf6 --- /dev/null +++ b/drivers/gpu/drm/drm_prime.c | |||
@@ -0,0 +1,304 @@ | |||
1 | /* | ||
2 | * Copyright © 2012 Red Hat | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice (including the next | ||
12 | * paragraph) shall be included in all copies or substantial portions of the | ||
13 | * Software. | ||
14 | * | ||
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
21 | * IN THE SOFTWARE. | ||
22 | * | ||
23 | * Authors: | ||
24 | * Dave Airlie <airlied@redhat.com> | ||
25 | * Rob Clark <rob.clark@linaro.org> | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #include <linux/export.h> | ||
30 | #include <linux/dma-buf.h> | ||
31 | #include "drmP.h" | ||
32 | |||
33 | /* | ||
34 | * DMA-BUF/GEM Object references and lifetime overview: | ||
35 | * | ||
36 | * On the export the dma_buf holds a reference to the exporting GEM | ||
37 | * object. It takes this reference in handle_to_fd_ioctl, when it | ||
38 | * first calls .prime_export and stores the exporting GEM object in | ||
39 | * the dma_buf priv. This reference is released when the dma_buf | ||
40 | * object goes away in the driver .release function. | ||
41 | * | ||
42 | * On the import the importing GEM object holds a reference to the | ||
43 | * dma_buf (which in turn holds a ref to the exporting GEM object). | ||
44 | * It takes that reference in the fd_to_handle ioctl. | ||
45 | * It calls dma_buf_get, creates an attachment to it and stores the | ||
46 | * attachment in the GEM object. When this attachment is destroyed | ||
47 | * when the imported object is destroyed, we remove the attachment | ||
48 | * and drop the reference to the dma_buf. | ||
49 | * | ||
50 | * Thus the chain of references always flows in one direction | ||
51 | * (avoiding loops): importing_gem -> dmabuf -> exporting_gem | ||
52 | * | ||
53 | * Self-importing: if userspace is using PRIME as a replacement for flink | ||
54 | * then it will get a fd->handle request for a GEM object that it created. | ||
55 | * Drivers should detect this situation and return back the gem object | ||
56 | * from the dma-buf private. | ||
57 | */ | ||
58 | |||
59 | struct drm_prime_member { | ||
60 | struct list_head entry; | ||
61 | struct dma_buf *dma_buf; | ||
62 | uint32_t handle; | ||
63 | }; | ||
64 | |||
65 | int drm_gem_prime_handle_to_fd(struct drm_device *dev, | ||
66 | struct drm_file *file_priv, uint32_t handle, uint32_t flags, | ||
67 | int *prime_fd) | ||
68 | { | ||
69 | struct drm_gem_object *obj; | ||
70 | void *buf; | ||
71 | |||
72 | obj = drm_gem_object_lookup(dev, file_priv, handle); | ||
73 | if (!obj) | ||
74 | return -ENOENT; | ||
75 | |||
76 | mutex_lock(&file_priv->prime.lock); | ||
77 | /* re-export the original imported object */ | ||
78 | if (obj->import_attach) { | ||
79 | get_dma_buf(obj->import_attach->dmabuf); | ||
80 | *prime_fd = dma_buf_fd(obj->import_attach->dmabuf, flags); | ||
81 | drm_gem_object_unreference_unlocked(obj); | ||
82 | mutex_unlock(&file_priv->prime.lock); | ||
83 | return 0; | ||
84 | } | ||
85 | |||
86 | if (obj->export_dma_buf) { | ||
87 | get_dma_buf(obj->export_dma_buf); | ||
88 | *prime_fd = dma_buf_fd(obj->export_dma_buf, flags); | ||
89 | drm_gem_object_unreference_unlocked(obj); | ||
90 | } else { | ||
91 | buf = dev->driver->gem_prime_export(dev, obj, flags); | ||
92 | if (IS_ERR(buf)) { | ||
93 | /* normally the created dma-buf takes ownership of the ref, | ||
94 | * but if that fails then drop the ref | ||
95 | */ | ||
96 | drm_gem_object_unreference_unlocked(obj); | ||
97 | mutex_unlock(&file_priv->prime.lock); | ||
98 | return PTR_ERR(buf); | ||
99 | } | ||
100 | obj->export_dma_buf = buf; | ||
101 | *prime_fd = dma_buf_fd(buf, flags); | ||
102 | } | ||
103 | mutex_unlock(&file_priv->prime.lock); | ||
104 | return 0; | ||
105 | } | ||
106 | EXPORT_SYMBOL(drm_gem_prime_handle_to_fd); | ||
107 | |||
108 | int drm_gem_prime_fd_to_handle(struct drm_device *dev, | ||
109 | struct drm_file *file_priv, int prime_fd, uint32_t *handle) | ||
110 | { | ||
111 | struct dma_buf *dma_buf; | ||
112 | struct drm_gem_object *obj; | ||
113 | int ret; | ||
114 | |||
115 | dma_buf = dma_buf_get(prime_fd); | ||
116 | if (IS_ERR(dma_buf)) | ||
117 | return PTR_ERR(dma_buf); | ||
118 | |||
119 | mutex_lock(&file_priv->prime.lock); | ||
120 | |||
121 | ret = drm_prime_lookup_imported_buf_handle(&file_priv->prime, | ||
122 | dma_buf, handle); | ||
123 | if (!ret) { | ||
124 | ret = 0; | ||
125 | goto out_put; | ||
126 | } | ||
127 | |||
128 | /* never seen this one, need to import */ | ||
129 | obj = dev->driver->gem_prime_import(dev, dma_buf); | ||
130 | if (IS_ERR(obj)) { | ||
131 | ret = PTR_ERR(obj); | ||
132 | goto out_put; | ||
133 | } | ||
134 | |||
135 | ret = drm_gem_handle_create(file_priv, obj, handle); | ||
136 | drm_gem_object_unreference_unlocked(obj); | ||
137 | if (ret) | ||
138 | goto out_put; | ||
139 | |||
140 | ret = drm_prime_add_imported_buf_handle(&file_priv->prime, | ||
141 | dma_buf, *handle); | ||
142 | if (ret) | ||
143 | goto fail; | ||
144 | |||
145 | mutex_unlock(&file_priv->prime.lock); | ||
146 | return 0; | ||
147 | |||
148 | fail: | ||
149 | /* hmm, if driver attached, we are relying on the free-object path | ||
150 | * to detach.. which seems ok.. | ||
151 | */ | ||
152 | drm_gem_object_handle_unreference_unlocked(obj); | ||
153 | out_put: | ||
154 | dma_buf_put(dma_buf); | ||
155 | mutex_unlock(&file_priv->prime.lock); | ||
156 | return ret; | ||
157 | } | ||
158 | EXPORT_SYMBOL(drm_gem_prime_fd_to_handle); | ||
159 | |||
160 | int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data, | ||
161 | struct drm_file *file_priv) | ||
162 | { | ||
163 | struct drm_prime_handle *args = data; | ||
164 | uint32_t flags; | ||
165 | |||
166 | if (!drm_core_check_feature(dev, DRIVER_PRIME)) | ||
167 | return -EINVAL; | ||
168 | |||
169 | if (!dev->driver->prime_handle_to_fd) | ||
170 | return -ENOSYS; | ||
171 | |||
172 | /* check flags are valid */ | ||
173 | if (args->flags & ~DRM_CLOEXEC) | ||
174 | return -EINVAL; | ||
175 | |||
176 | /* we only want to pass DRM_CLOEXEC which is == O_CLOEXEC */ | ||
177 | flags = args->flags & DRM_CLOEXEC; | ||
178 | |||
179 | return dev->driver->prime_handle_to_fd(dev, file_priv, | ||
180 | args->handle, flags, &args->fd); | ||
181 | } | ||
182 | |||
183 | int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data, | ||
184 | struct drm_file *file_priv) | ||
185 | { | ||
186 | struct drm_prime_handle *args = data; | ||
187 | |||
188 | if (!drm_core_check_feature(dev, DRIVER_PRIME)) | ||
189 | return -EINVAL; | ||
190 | |||
191 | if (!dev->driver->prime_fd_to_handle) | ||
192 | return -ENOSYS; | ||
193 | |||
194 | return dev->driver->prime_fd_to_handle(dev, file_priv, | ||
195 | args->fd, &args->handle); | ||
196 | } | ||
197 | |||
198 | /* | ||
199 | * drm_prime_pages_to_sg | ||
200 | * | ||
201 | * this helper creates an sg table object from a set of pages | ||
202 | * the driver is responsible for mapping the pages into the | ||
203 | * importers address space | ||
204 | */ | ||
205 | struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages) | ||
206 | { | ||
207 | struct sg_table *sg = NULL; | ||
208 | struct scatterlist *iter; | ||
209 | int i; | ||
210 | int ret; | ||
211 | |||
212 | sg = kmalloc(sizeof(struct sg_table), GFP_KERNEL); | ||
213 | if (!sg) | ||
214 | goto out; | ||
215 | |||
216 | ret = sg_alloc_table(sg, nr_pages, GFP_KERNEL); | ||
217 | if (ret) | ||
218 | goto out; | ||
219 | |||
220 | for_each_sg(sg->sgl, iter, nr_pages, i) | ||
221 | sg_set_page(iter, pages[i], PAGE_SIZE, 0); | ||
222 | |||
223 | return sg; | ||
224 | out: | ||
225 | kfree(sg); | ||
226 | return NULL; | ||
227 | } | ||
228 | EXPORT_SYMBOL(drm_prime_pages_to_sg); | ||
229 | |||
230 | /* helper function to cleanup a GEM/prime object */ | ||
231 | void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg) | ||
232 | { | ||
233 | struct dma_buf_attachment *attach; | ||
234 | struct dma_buf *dma_buf; | ||
235 | attach = obj->import_attach; | ||
236 | if (sg) | ||
237 | dma_buf_unmap_attachment(attach, sg, DMA_BIDIRECTIONAL); | ||
238 | dma_buf = attach->dmabuf; | ||
239 | dma_buf_detach(attach->dmabuf, attach); | ||
240 | /* remove the reference */ | ||
241 | dma_buf_put(dma_buf); | ||
242 | } | ||
243 | EXPORT_SYMBOL(drm_prime_gem_destroy); | ||
244 | |||
245 | void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv) | ||
246 | { | ||
247 | INIT_LIST_HEAD(&prime_fpriv->head); | ||
248 | mutex_init(&prime_fpriv->lock); | ||
249 | } | ||
250 | EXPORT_SYMBOL(drm_prime_init_file_private); | ||
251 | |||
252 | void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv) | ||
253 | { | ||
254 | struct drm_prime_member *member, *safe; | ||
255 | list_for_each_entry_safe(member, safe, &prime_fpriv->head, entry) { | ||
256 | list_del(&member->entry); | ||
257 | kfree(member); | ||
258 | } | ||
259 | } | ||
260 | EXPORT_SYMBOL(drm_prime_destroy_file_private); | ||
261 | |||
262 | int drm_prime_add_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle) | ||
263 | { | ||
264 | struct drm_prime_member *member; | ||
265 | |||
266 | member = kmalloc(sizeof(*member), GFP_KERNEL); | ||
267 | if (!member) | ||
268 | return -ENOMEM; | ||
269 | |||
270 | member->dma_buf = dma_buf; | ||
271 | member->handle = handle; | ||
272 | list_add(&member->entry, &prime_fpriv->head); | ||
273 | return 0; | ||
274 | } | ||
275 | EXPORT_SYMBOL(drm_prime_add_imported_buf_handle); | ||
276 | |||
277 | int drm_prime_lookup_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t *handle) | ||
278 | { | ||
279 | struct drm_prime_member *member; | ||
280 | |||
281 | list_for_each_entry(member, &prime_fpriv->head, entry) { | ||
282 | if (member->dma_buf == dma_buf) { | ||
283 | *handle = member->handle; | ||
284 | return 0; | ||
285 | } | ||
286 | } | ||
287 | return -ENOENT; | ||
288 | } | ||
289 | EXPORT_SYMBOL(drm_prime_lookup_imported_buf_handle); | ||
290 | |||
291 | void drm_prime_remove_imported_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf) | ||
292 | { | ||
293 | struct drm_prime_member *member, *safe; | ||
294 | |||
295 | mutex_lock(&prime_fpriv->lock); | ||
296 | list_for_each_entry_safe(member, safe, &prime_fpriv->head, entry) { | ||
297 | if (member->dma_buf == dma_buf) { | ||
298 | list_del(&member->entry); | ||
299 | kfree(member); | ||
300 | } | ||
301 | } | ||
302 | mutex_unlock(&prime_fpriv->lock); | ||
303 | } | ||
304 | EXPORT_SYMBOL(drm_prime_remove_imported_buf_handle); | ||
diff --git a/drivers/gpu/drm/drm_usb.c b/drivers/gpu/drm/drm_usb.c index c8c83dad2ce1..37c9a523dd1c 100644 --- a/drivers/gpu/drm/drm_usb.c +++ b/drivers/gpu/drm/drm_usb.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include "drmP.h" | 1 | #include "drmP.h" |
2 | #include <linux/usb.h> | 2 | #include <linux/usb.h> |
3 | #include <linux/export.h> | 3 | #include <linux/module.h> |
4 | 4 | ||
5 | int drm_get_usb_dev(struct usb_interface *interface, | 5 | int drm_get_usb_dev(struct usb_interface *interface, |
6 | const struct usb_device_id *id, | 6 | const struct usb_device_id *id, |
@@ -114,3 +114,7 @@ void drm_usb_exit(struct drm_driver *driver, | |||
114 | usb_deregister(udriver); | 114 | usb_deregister(udriver); |
115 | } | 115 | } |
116 | EXPORT_SYMBOL(drm_usb_exit); | 116 | EXPORT_SYMBOL(drm_usb_exit); |
117 | |||
118 | MODULE_AUTHOR("David Airlie"); | ||
119 | MODULE_DESCRIPTION("USB DRM support"); | ||
120 | MODULE_LICENSE("GPL and additional rights"); | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 4a3a5f72ed4a..de8d2090bce3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c | |||
@@ -34,14 +34,14 @@ | |||
34 | static int lowlevel_buffer_allocate(struct drm_device *dev, | 34 | static int lowlevel_buffer_allocate(struct drm_device *dev, |
35 | unsigned int flags, struct exynos_drm_gem_buf *buf) | 35 | unsigned int flags, struct exynos_drm_gem_buf *buf) |
36 | { | 36 | { |
37 | dma_addr_t start_addr, end_addr; | 37 | dma_addr_t start_addr; |
38 | unsigned int npages, page_size, i = 0; | 38 | unsigned int npages, page_size, i = 0; |
39 | struct scatterlist *sgl; | 39 | struct scatterlist *sgl; |
40 | int ret = 0; | 40 | int ret = 0; |
41 | 41 | ||
42 | DRM_DEBUG_KMS("%s\n", __FILE__); | 42 | DRM_DEBUG_KMS("%s\n", __FILE__); |
43 | 43 | ||
44 | if (flags & EXYNOS_BO_NONCONTIG) { | 44 | if (IS_NONCONTIG_BUFFER(flags)) { |
45 | DRM_DEBUG_KMS("not support allocation type.\n"); | 45 | DRM_DEBUG_KMS("not support allocation type.\n"); |
46 | return -EINVAL; | 46 | return -EINVAL; |
47 | } | 47 | } |
@@ -52,13 +52,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
52 | } | 52 | } |
53 | 53 | ||
54 | if (buf->size >= SZ_1M) { | 54 | if (buf->size >= SZ_1M) { |
55 | npages = (buf->size >> SECTION_SHIFT) + 1; | 55 | npages = buf->size >> SECTION_SHIFT; |
56 | page_size = SECTION_SIZE; | 56 | page_size = SECTION_SIZE; |
57 | } else if (buf->size >= SZ_64K) { | 57 | } else if (buf->size >= SZ_64K) { |
58 | npages = (buf->size >> 16) + 1; | 58 | npages = buf->size >> 16; |
59 | page_size = SZ_64K; | 59 | page_size = SZ_64K; |
60 | } else { | 60 | } else { |
61 | npages = (buf->size >> PAGE_SHIFT) + 1; | 61 | npages = buf->size >> PAGE_SHIFT; |
62 | page_size = PAGE_SIZE; | 62 | page_size = PAGE_SIZE; |
63 | } | 63 | } |
64 | 64 | ||
@@ -76,26 +76,13 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
76 | return -ENOMEM; | 76 | return -ENOMEM; |
77 | } | 77 | } |
78 | 78 | ||
79 | buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size, | 79 | buf->kvaddr = dma_alloc_writecombine(dev->dev, buf->size, |
80 | &buf->dma_addr, GFP_KERNEL); | 80 | &buf->dma_addr, GFP_KERNEL); |
81 | if (!buf->kvaddr) { | 81 | if (!buf->kvaddr) { |
82 | DRM_ERROR("failed to allocate buffer.\n"); | 82 | DRM_ERROR("failed to allocate buffer.\n"); |
83 | ret = -ENOMEM; | 83 | ret = -ENOMEM; |
84 | goto err1; | 84 | goto err1; |
85 | } | 85 | } |
86 | |||
87 | start_addr = buf->dma_addr; | ||
88 | end_addr = buf->dma_addr + buf->size; | ||
89 | |||
90 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); | ||
91 | if (!buf->pages) { | ||
92 | DRM_ERROR("failed to allocate pages.\n"); | ||
93 | ret = -ENOMEM; | ||
94 | goto err2; | ||
95 | } | ||
96 | |||
97 | start_addr = buf->dma_addr; | ||
98 | end_addr = buf->dma_addr + buf->size; | ||
99 | 86 | ||
100 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); | 87 | buf->pages = kzalloc(sizeof(struct page) * npages, GFP_KERNEL); |
101 | if (!buf->pages) { | 88 | if (!buf->pages) { |
@@ -105,23 +92,17 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, | |||
105 | } | 92 | } |
106 | 93 | ||
107 | sgl = buf->sgt->sgl; | 94 | sgl = buf->sgt->sgl; |
95 | start_addr = buf->dma_addr; | ||
108 | 96 | ||
109 | while (i < npages) { | 97 | while (i < npages) { |
110 | buf->pages[i] = phys_to_page(start_addr); | 98 | buf->pages[i] = phys_to_page(start_addr); |
111 | sg_set_page(sgl, buf->pages[i], page_size, 0); | 99 | sg_set_page(sgl, buf->pages[i], page_size, 0); |
112 | sg_dma_address(sgl) = start_addr; | 100 | sg_dma_address(sgl) = start_addr; |
113 | start_addr += page_size; | 101 | start_addr += page_size; |
114 | if (end_addr - start_addr < page_size) | ||
115 | break; | ||
116 | sgl = sg_next(sgl); | 102 | sgl = sg_next(sgl); |
117 | i++; | 103 | i++; |
118 | } | 104 | } |
119 | 105 | ||
120 | buf->pages[i] = phys_to_page(start_addr); | ||
121 | |||
122 | sgl = sg_next(sgl); | ||
123 | sg_set_page(sgl, buf->pages[i+1], end_addr - start_addr, 0); | ||
124 | |||
125 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", | 106 | DRM_DEBUG_KMS("vaddr(0x%lx), dma_addr(0x%lx), size(0x%lx)\n", |
126 | (unsigned long)buf->kvaddr, | 107 | (unsigned long)buf->kvaddr, |
127 | (unsigned long)buf->dma_addr, | 108 | (unsigned long)buf->dma_addr, |
@@ -150,7 +131,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, | |||
150 | * non-continuous memory would be released by exynos | 131 | * non-continuous memory would be released by exynos |
151 | * gem framework. | 132 | * gem framework. |
152 | */ | 133 | */ |
153 | if (flags & EXYNOS_BO_NONCONTIG) { | 134 | if (IS_NONCONTIG_BUFFER(flags)) { |
154 | DRM_DEBUG_KMS("not support allocation type.\n"); | 135 | DRM_DEBUG_KMS("not support allocation type.\n"); |
155 | return; | 136 | return; |
156 | } | 137 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c index 411832e8e17a..eaf630dc5dba 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ b/drivers/gpu/drm/exynos/exynos_drm_core.c | |||
@@ -54,16 +54,18 @@ static int exynos_drm_subdrv_probe(struct drm_device *dev, | |||
54 | * | 54 | * |
55 | * P.S. note that this driver is considered for modularization. | 55 | * P.S. note that this driver is considered for modularization. |
56 | */ | 56 | */ |
57 | ret = subdrv->probe(dev, subdrv->manager.dev); | 57 | ret = subdrv->probe(dev, subdrv->dev); |
58 | if (ret) | 58 | if (ret) |
59 | return ret; | 59 | return ret; |
60 | } | 60 | } |
61 | 61 | ||
62 | if (subdrv->is_local) | 62 | if (!subdrv->manager) |
63 | return 0; | 63 | return 0; |
64 | 64 | ||
65 | subdrv->manager->dev = subdrv->dev; | ||
66 | |||
65 | /* create and initialize a encoder for this sub driver. */ | 67 | /* create and initialize a encoder for this sub driver. */ |
66 | encoder = exynos_drm_encoder_create(dev, &subdrv->manager, | 68 | encoder = exynos_drm_encoder_create(dev, subdrv->manager, |
67 | (1 << MAX_CRTC) - 1); | 69 | (1 << MAX_CRTC) - 1); |
68 | if (!encoder) { | 70 | if (!encoder) { |
69 | DRM_ERROR("failed to create encoder\n"); | 71 | DRM_ERROR("failed to create encoder\n"); |
@@ -186,7 +188,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | |||
186 | 188 | ||
187 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | 189 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
188 | if (subdrv->open) { | 190 | if (subdrv->open) { |
189 | ret = subdrv->open(dev, subdrv->manager.dev, file); | 191 | ret = subdrv->open(dev, subdrv->dev, file); |
190 | if (ret) | 192 | if (ret) |
191 | goto err; | 193 | goto err; |
192 | } | 194 | } |
@@ -197,7 +199,7 @@ int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) | |||
197 | err: | 199 | err: |
198 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { | 200 | list_for_each_entry_reverse(subdrv, &subdrv->list, list) { |
199 | if (subdrv->close) | 201 | if (subdrv->close) |
200 | subdrv->close(dev, subdrv->manager.dev, file); | 202 | subdrv->close(dev, subdrv->dev, file); |
201 | } | 203 | } |
202 | return ret; | 204 | return ret; |
203 | } | 205 | } |
@@ -209,7 +211,7 @@ void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) | |||
209 | 211 | ||
210 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { | 212 | list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { |
211 | if (subdrv->close) | 213 | if (subdrv->close) |
212 | subdrv->close(dev, subdrv->manager.dev, file); | 214 | subdrv->close(dev, subdrv->dev, file); |
213 | } | 215 | } |
214 | } | 216 | } |
215 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); | 217 | EXPORT_SYMBOL_GPL(exynos_drm_subdrv_close); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index fbd0a232c93d..1d814175cd49 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -225,24 +225,25 @@ struct exynos_drm_private { | |||
225 | * Exynos drm sub driver structure. | 225 | * Exynos drm sub driver structure. |
226 | * | 226 | * |
227 | * @list: sub driver has its own list object to register to exynos drm driver. | 227 | * @list: sub driver has its own list object to register to exynos drm driver. |
228 | * @dev: pointer to device object for subdrv device driver. | ||
228 | * @drm_dev: pointer to drm_device and this pointer would be set | 229 | * @drm_dev: pointer to drm_device and this pointer would be set |
229 | * when sub driver calls exynos_drm_subdrv_register(). | 230 | * when sub driver calls exynos_drm_subdrv_register(). |
230 | * @is_local: appear encoder and connector disrelated device. | 231 | * @manager: subdrv has its own manager to control a hardware appropriately |
232 | * and we can access a hardware drawing on this manager. | ||
231 | * @probe: this callback would be called by exynos drm driver after | 233 | * @probe: this callback would be called by exynos drm driver after |
232 | * subdrv is registered to it. | 234 | * subdrv is registered to it. |
233 | * @remove: this callback is used to release resources created | 235 | * @remove: this callback is used to release resources created |
234 | * by probe callback. | 236 | * by probe callback. |
235 | * @open: this would be called with drm device file open. | 237 | * @open: this would be called with drm device file open. |
236 | * @close: this would be called with drm device file close. | 238 | * @close: this would be called with drm device file close. |
237 | * @manager: subdrv has its own manager to control a hardware appropriately | ||
238 | * and we can access a hardware drawing on this manager. | ||
239 | * @encoder: encoder object owned by this sub driver. | 239 | * @encoder: encoder object owned by this sub driver. |
240 | * @connector: connector object owned by this sub driver. | 240 | * @connector: connector object owned by this sub driver. |
241 | */ | 241 | */ |
242 | struct exynos_drm_subdrv { | 242 | struct exynos_drm_subdrv { |
243 | struct list_head list; | 243 | struct list_head list; |
244 | struct device *dev; | ||
244 | struct drm_device *drm_dev; | 245 | struct drm_device *drm_dev; |
245 | bool is_local; | 246 | struct exynos_drm_manager *manager; |
246 | 247 | ||
247 | int (*probe)(struct drm_device *drm_dev, struct device *dev); | 248 | int (*probe)(struct drm_device *drm_dev, struct device *dev); |
248 | void (*remove)(struct drm_device *dev); | 249 | void (*remove)(struct drm_device *dev); |
@@ -251,7 +252,6 @@ struct exynos_drm_subdrv { | |||
251 | void (*close)(struct drm_device *drm_dev, struct device *dev, | 252 | void (*close)(struct drm_device *drm_dev, struct device *dev, |
252 | struct drm_file *file); | 253 | struct drm_file *file); |
253 | 254 | ||
254 | struct exynos_drm_manager manager; | ||
255 | struct drm_encoder *encoder; | 255 | struct drm_encoder *encoder; |
256 | struct drm_connector *connector; | 256 | struct drm_connector *connector; |
257 | }; | 257 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index ecb6db229700..29fdbfeb43cb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -172,7 +172,7 @@ static void fimd_dpms(struct device *subdrv_dev, int mode) | |||
172 | static void fimd_apply(struct device *subdrv_dev) | 172 | static void fimd_apply(struct device *subdrv_dev) |
173 | { | 173 | { |
174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); | 174 | struct fimd_context *ctx = get_fimd_context(subdrv_dev); |
175 | struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | 175 | struct exynos_drm_manager *mgr = ctx->subdrv.manager; |
176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; | 176 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; | 177 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
178 | struct fimd_win_data *win_data; | 178 | struct fimd_win_data *win_data; |
@@ -577,6 +577,13 @@ static struct exynos_drm_overlay_ops fimd_overlay_ops = { | |||
577 | .disable = fimd_win_disable, | 577 | .disable = fimd_win_disable, |
578 | }; | 578 | }; |
579 | 579 | ||
580 | static struct exynos_drm_manager fimd_manager = { | ||
581 | .pipe = -1, | ||
582 | .ops = &fimd_manager_ops, | ||
583 | .overlay_ops = &fimd_overlay_ops, | ||
584 | .display_ops = &fimd_display_ops, | ||
585 | }; | ||
586 | |||
580 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) | 587 | static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc) |
581 | { | 588 | { |
582 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | 589 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
@@ -628,7 +635,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | |||
628 | struct fimd_context *ctx = (struct fimd_context *)dev_id; | 635 | struct fimd_context *ctx = (struct fimd_context *)dev_id; |
629 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 636 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
630 | struct drm_device *drm_dev = subdrv->drm_dev; | 637 | struct drm_device *drm_dev = subdrv->drm_dev; |
631 | struct exynos_drm_manager *manager = &subdrv->manager; | 638 | struct exynos_drm_manager *manager = subdrv->manager; |
632 | u32 val; | 639 | u32 val; |
633 | 640 | ||
634 | val = readl(ctx->regs + VIDINTCON1); | 641 | val = readl(ctx->regs + VIDINTCON1); |
@@ -744,7 +751,7 @@ static void fimd_clear_win(struct fimd_context *ctx, int win) | |||
744 | static int fimd_power_on(struct fimd_context *ctx, bool enable) | 751 | static int fimd_power_on(struct fimd_context *ctx, bool enable) |
745 | { | 752 | { |
746 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 753 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
747 | struct device *dev = subdrv->manager.dev; | 754 | struct device *dev = subdrv->dev; |
748 | 755 | ||
749 | DRM_DEBUG_KMS("%s\n", __FILE__); | 756 | DRM_DEBUG_KMS("%s\n", __FILE__); |
750 | 757 | ||
@@ -867,13 +874,10 @@ static int __devinit fimd_probe(struct platform_device *pdev) | |||
867 | 874 | ||
868 | subdrv = &ctx->subdrv; | 875 | subdrv = &ctx->subdrv; |
869 | 876 | ||
877 | subdrv->dev = dev; | ||
878 | subdrv->manager = &fimd_manager; | ||
870 | subdrv->probe = fimd_subdrv_probe; | 879 | subdrv->probe = fimd_subdrv_probe; |
871 | subdrv->remove = fimd_subdrv_remove; | 880 | subdrv->remove = fimd_subdrv_remove; |
872 | subdrv->manager.pipe = -1; | ||
873 | subdrv->manager.ops = &fimd_manager_ops; | ||
874 | subdrv->manager.overlay_ops = &fimd_overlay_ops; | ||
875 | subdrv->manager.display_ops = &fimd_display_ops; | ||
876 | subdrv->manager.dev = dev; | ||
877 | 881 | ||
878 | mutex_init(&ctx->lock); | 882 | mutex_init(&ctx->lock); |
879 | 883 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index fa1aa94a3d8e..1dffa8359f88 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c | |||
@@ -56,9 +56,28 @@ static unsigned int convert_to_vm_err_msg(int msg) | |||
56 | return out_msg; | 56 | return out_msg; |
57 | } | 57 | } |
58 | 58 | ||
59 | static unsigned int mask_gem_flags(unsigned int flags) | 59 | static int check_gem_flags(unsigned int flags) |
60 | { | 60 | { |
61 | return flags &= EXYNOS_BO_NONCONTIG; | 61 | if (flags & ~(EXYNOS_BO_MASK)) { |
62 | DRM_ERROR("invalid flags.\n"); | ||
63 | return -EINVAL; | ||
64 | } | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | static unsigned long roundup_gem_size(unsigned long size, unsigned int flags) | ||
70 | { | ||
71 | if (!IS_NONCONTIG_BUFFER(flags)) { | ||
72 | if (size >= SZ_1M) | ||
73 | return roundup(size, SECTION_SIZE); | ||
74 | else if (size >= SZ_64K) | ||
75 | return roundup(size, SZ_64K); | ||
76 | else | ||
77 | goto out; | ||
78 | } | ||
79 | out: | ||
80 | return roundup(size, PAGE_SIZE); | ||
62 | } | 81 | } |
63 | 82 | ||
64 | static struct page **exynos_gem_get_pages(struct drm_gem_object *obj, | 83 | static struct page **exynos_gem_get_pages(struct drm_gem_object *obj, |
@@ -130,22 +149,12 @@ static int exynos_drm_gem_map_pages(struct drm_gem_object *obj, | |||
130 | unsigned long pfn; | 149 | unsigned long pfn; |
131 | 150 | ||
132 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { | 151 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { |
133 | unsigned long usize = buf->size; | ||
134 | |||
135 | if (!buf->pages) | 152 | if (!buf->pages) |
136 | return -EINTR; | 153 | return -EINTR; |
137 | 154 | ||
138 | while (usize > 0) { | 155 | pfn = page_to_pfn(buf->pages[page_offset++]); |
139 | pfn = page_to_pfn(buf->pages[page_offset++]); | 156 | } else |
140 | vm_insert_mixed(vma, f_vaddr, pfn); | 157 | pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset; |
141 | f_vaddr += PAGE_SIZE; | ||
142 | usize -= PAGE_SIZE; | ||
143 | } | ||
144 | |||
145 | return 0; | ||
146 | } | ||
147 | |||
148 | pfn = (buf->dma_addr >> PAGE_SHIFT) + page_offset; | ||
149 | 158 | ||
150 | return vm_insert_mixed(vma, f_vaddr, pfn); | 159 | return vm_insert_mixed(vma, f_vaddr, pfn); |
151 | } | 160 | } |
@@ -319,10 +328,17 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
319 | struct exynos_drm_gem_buf *buf; | 328 | struct exynos_drm_gem_buf *buf; |
320 | int ret; | 329 | int ret; |
321 | 330 | ||
322 | size = roundup(size, PAGE_SIZE); | 331 | if (!size) { |
323 | DRM_DEBUG_KMS("%s: size = 0x%lx\n", __FILE__, size); | 332 | DRM_ERROR("invalid size.\n"); |
333 | return ERR_PTR(-EINVAL); | ||
334 | } | ||
335 | |||
336 | size = roundup_gem_size(size, flags); | ||
337 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
324 | 338 | ||
325 | flags = mask_gem_flags(flags); | 339 | ret = check_gem_flags(flags); |
340 | if (ret) | ||
341 | return ERR_PTR(ret); | ||
326 | 342 | ||
327 | buf = exynos_drm_init_buf(dev, size); | 343 | buf = exynos_drm_init_buf(dev, size); |
328 | if (!buf) | 344 | if (!buf) |
@@ -331,7 +347,7 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
331 | exynos_gem_obj = exynos_drm_gem_init(dev, size); | 347 | exynos_gem_obj = exynos_drm_gem_init(dev, size); |
332 | if (!exynos_gem_obj) { | 348 | if (!exynos_gem_obj) { |
333 | ret = -ENOMEM; | 349 | ret = -ENOMEM; |
334 | goto err; | 350 | goto err_fini_buf; |
335 | } | 351 | } |
336 | 352 | ||
337 | exynos_gem_obj->buffer = buf; | 353 | exynos_gem_obj->buffer = buf; |
@@ -347,18 +363,19 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, | |||
347 | ret = exynos_drm_gem_get_pages(&exynos_gem_obj->base); | 363 | ret = exynos_drm_gem_get_pages(&exynos_gem_obj->base); |
348 | if (ret < 0) { | 364 | if (ret < 0) { |
349 | drm_gem_object_release(&exynos_gem_obj->base); | 365 | drm_gem_object_release(&exynos_gem_obj->base); |
350 | goto err; | 366 | goto err_fini_buf; |
351 | } | 367 | } |
352 | } else { | 368 | } else { |
353 | ret = exynos_drm_alloc_buf(dev, buf, flags); | 369 | ret = exynos_drm_alloc_buf(dev, buf, flags); |
354 | if (ret < 0) { | 370 | if (ret < 0) { |
355 | drm_gem_object_release(&exynos_gem_obj->base); | 371 | drm_gem_object_release(&exynos_gem_obj->base); |
356 | goto err; | 372 | goto err_fini_buf; |
357 | } | 373 | } |
358 | } | 374 | } |
359 | 375 | ||
360 | return exynos_gem_obj; | 376 | return exynos_gem_obj; |
361 | err: | 377 | |
378 | err_fini_buf: | ||
362 | exynos_drm_fini_buf(dev, buf); | 379 | exynos_drm_fini_buf(dev, buf); |
363 | return ERR_PTR(ret); | 380 | return ERR_PTR(ret); |
364 | } | 381 | } |
@@ -497,6 +514,8 @@ static int exynos_drm_gem_mmap_buffer(struct file *filp, | |||
497 | if (!buffer->pages) | 514 | if (!buffer->pages) |
498 | return -EINVAL; | 515 | return -EINVAL; |
499 | 516 | ||
517 | vma->vm_flags |= VM_MIXEDMAP; | ||
518 | |||
500 | do { | 519 | do { |
501 | ret = vm_insert_page(vma, uaddr, buffer->pages[i++]); | 520 | ret = vm_insert_page(vma, uaddr, buffer->pages[i++]); |
502 | if (ret) { | 521 | if (ret) { |
@@ -554,10 +573,8 @@ int exynos_drm_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
554 | obj->filp->f_op = &exynos_drm_gem_fops; | 573 | obj->filp->f_op = &exynos_drm_gem_fops; |
555 | obj->filp->private_data = obj; | 574 | obj->filp->private_data = obj; |
556 | 575 | ||
557 | down_write(¤t->mm->mmap_sem); | 576 | addr = vm_mmap(obj->filp, 0, args->size, |
558 | addr = do_mmap(obj->filp, 0, args->size, | ||
559 | PROT_READ | PROT_WRITE, MAP_SHARED, 0); | 577 | PROT_READ | PROT_WRITE, MAP_SHARED, 0); |
560 | up_write(¤t->mm->mmap_sem); | ||
561 | 578 | ||
562 | drm_gem_object_unreference_unlocked(obj); | 579 | drm_gem_object_unreference_unlocked(obj); |
563 | 580 | ||
@@ -685,7 +702,6 @@ int exynos_drm_gem_dumb_destroy(struct drm_file *file_priv, | |||
685 | 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) |
686 | { | 703 | { |
687 | struct drm_gem_object *obj = vma->vm_private_data; | 704 | struct drm_gem_object *obj = vma->vm_private_data; |
688 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); | ||
689 | struct drm_device *dev = obj->dev; | 705 | struct drm_device *dev = obj->dev; |
690 | unsigned long f_vaddr; | 706 | unsigned long f_vaddr; |
691 | pgoff_t page_offset; | 707 | pgoff_t page_offset; |
@@ -697,21 +713,10 @@ int exynos_drm_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
697 | 713 | ||
698 | mutex_lock(&dev->struct_mutex); | 714 | mutex_lock(&dev->struct_mutex); |
699 | 715 | ||
700 | /* | ||
701 | * allocate all pages as desired size if user wants to allocate | ||
702 | * physically non-continuous memory. | ||
703 | */ | ||
704 | if (exynos_gem_obj->flags & EXYNOS_BO_NONCONTIG) { | ||
705 | ret = exynos_drm_gem_get_pages(obj); | ||
706 | if (ret < 0) | ||
707 | goto err; | ||
708 | } | ||
709 | |||
710 | 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); |
711 | if (ret < 0) | 717 | if (ret < 0) |
712 | DRM_ERROR("failed to map pages.\n"); | 718 | DRM_ERROR("failed to map pages.\n"); |
713 | 719 | ||
714 | err: | ||
715 | mutex_unlock(&dev->struct_mutex); | 720 | mutex_unlock(&dev->struct_mutex); |
716 | 721 | ||
717 | return convert_to_vm_err_msg(ret); | 722 | return convert_to_vm_err_msg(ret); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index e40fbad8b705..4ed842039505 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #define to_exynos_gem_obj(x) container_of(x,\ | 29 | #define to_exynos_gem_obj(x) container_of(x,\ |
30 | struct exynos_drm_gem_obj, base) | 30 | struct exynos_drm_gem_obj, base) |
31 | 31 | ||
32 | #define IS_NONCONTIG_BUFFER(f) (f & EXYNOS_BO_NONCONTIG) | ||
33 | |||
32 | /* | 34 | /* |
33 | * exynos drm gem buffer structure. | 35 | * exynos drm gem buffer structure. |
34 | * | 36 | * |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c index 14eb26b0ba1c..3424463676e0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.c | |||
@@ -30,9 +30,8 @@ | |||
30 | struct drm_hdmi_context, subdrv); | 30 | struct drm_hdmi_context, subdrv); |
31 | 31 | ||
32 | /* these callback points shoud be set by specific drivers. */ | 32 | /* these callback points shoud be set by specific drivers. */ |
33 | static struct exynos_hdmi_display_ops *hdmi_display_ops; | 33 | static struct exynos_hdmi_ops *hdmi_ops; |
34 | static struct exynos_hdmi_manager_ops *hdmi_manager_ops; | 34 | static struct exynos_mixer_ops *mixer_ops; |
35 | static struct exynos_hdmi_overlay_ops *hdmi_overlay_ops; | ||
36 | 35 | ||
37 | struct drm_hdmi_context { | 36 | struct drm_hdmi_context { |
38 | struct exynos_drm_subdrv subdrv; | 37 | struct exynos_drm_subdrv subdrv; |
@@ -40,31 +39,20 @@ struct drm_hdmi_context { | |||
40 | struct exynos_drm_hdmi_context *mixer_ctx; | 39 | struct exynos_drm_hdmi_context *mixer_ctx; |
41 | }; | 40 | }; |
42 | 41 | ||
43 | void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | 42 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops) |
44 | *display_ops) | ||
45 | { | 43 | { |
46 | DRM_DEBUG_KMS("%s\n", __FILE__); | 44 | DRM_DEBUG_KMS("%s\n", __FILE__); |
47 | 45 | ||
48 | if (display_ops) | 46 | if (ops) |
49 | hdmi_display_ops = display_ops; | 47 | hdmi_ops = ops; |
50 | } | 48 | } |
51 | 49 | ||
52 | void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | 50 | void exynos_mixer_ops_register(struct exynos_mixer_ops *ops) |
53 | *manager_ops) | ||
54 | { | 51 | { |
55 | DRM_DEBUG_KMS("%s\n", __FILE__); | 52 | DRM_DEBUG_KMS("%s\n", __FILE__); |
56 | 53 | ||
57 | if (manager_ops) | 54 | if (ops) |
58 | hdmi_manager_ops = manager_ops; | 55 | mixer_ops = ops; |
59 | } | ||
60 | |||
61 | void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | ||
62 | *overlay_ops) | ||
63 | { | ||
64 | DRM_DEBUG_KMS("%s\n", __FILE__); | ||
65 | |||
66 | if (overlay_ops) | ||
67 | hdmi_overlay_ops = overlay_ops; | ||
68 | } | 56 | } |
69 | 57 | ||
70 | static bool drm_hdmi_is_connected(struct device *dev) | 58 | static bool drm_hdmi_is_connected(struct device *dev) |
@@ -73,8 +61,8 @@ static bool drm_hdmi_is_connected(struct device *dev) | |||
73 | 61 | ||
74 | DRM_DEBUG_KMS("%s\n", __FILE__); | 62 | DRM_DEBUG_KMS("%s\n", __FILE__); |
75 | 63 | ||
76 | if (hdmi_display_ops && hdmi_display_ops->is_connected) | 64 | if (hdmi_ops && hdmi_ops->is_connected) |
77 | return hdmi_display_ops->is_connected(ctx->hdmi_ctx->ctx); | 65 | return hdmi_ops->is_connected(ctx->hdmi_ctx->ctx); |
78 | 66 | ||
79 | return false; | 67 | return false; |
80 | } | 68 | } |
@@ -86,9 +74,9 @@ static int drm_hdmi_get_edid(struct device *dev, | |||
86 | 74 | ||
87 | DRM_DEBUG_KMS("%s\n", __FILE__); | 75 | DRM_DEBUG_KMS("%s\n", __FILE__); |
88 | 76 | ||
89 | if (hdmi_display_ops && hdmi_display_ops->get_edid) | 77 | if (hdmi_ops && hdmi_ops->get_edid) |
90 | return hdmi_display_ops->get_edid(ctx->hdmi_ctx->ctx, | 78 | return hdmi_ops->get_edid(ctx->hdmi_ctx->ctx, connector, edid, |
91 | connector, edid, len); | 79 | len); |
92 | 80 | ||
93 | return 0; | 81 | return 0; |
94 | } | 82 | } |
@@ -99,9 +87,8 @@ static int drm_hdmi_check_timing(struct device *dev, void *timing) | |||
99 | 87 | ||
100 | DRM_DEBUG_KMS("%s\n", __FILE__); | 88 | DRM_DEBUG_KMS("%s\n", __FILE__); |
101 | 89 | ||
102 | if (hdmi_display_ops && hdmi_display_ops->check_timing) | 90 | if (hdmi_ops && hdmi_ops->check_timing) |
103 | return hdmi_display_ops->check_timing(ctx->hdmi_ctx->ctx, | 91 | return hdmi_ops->check_timing(ctx->hdmi_ctx->ctx, timing); |
104 | timing); | ||
105 | 92 | ||
106 | return 0; | 93 | return 0; |
107 | } | 94 | } |
@@ -112,8 +99,8 @@ static int drm_hdmi_power_on(struct device *dev, int mode) | |||
112 | 99 | ||
113 | DRM_DEBUG_KMS("%s\n", __FILE__); | 100 | DRM_DEBUG_KMS("%s\n", __FILE__); |
114 | 101 | ||
115 | if (hdmi_display_ops && hdmi_display_ops->power_on) | 102 | if (hdmi_ops && hdmi_ops->power_on) |
116 | return hdmi_display_ops->power_on(ctx->hdmi_ctx->ctx, mode); | 103 | return hdmi_ops->power_on(ctx->hdmi_ctx->ctx, mode); |
117 | 104 | ||
118 | return 0; | 105 | return 0; |
119 | } | 106 | } |
@@ -130,13 +117,13 @@ static int drm_hdmi_enable_vblank(struct device *subdrv_dev) | |||
130 | { | 117 | { |
131 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); | 118 | struct drm_hdmi_context *ctx = to_context(subdrv_dev); |
132 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 119 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
133 | struct exynos_drm_manager *manager = &subdrv->manager; | 120 | struct exynos_drm_manager *manager = subdrv->manager; |
134 | 121 | ||
135 | DRM_DEBUG_KMS("%s\n", __FILE__); | 122 | DRM_DEBUG_KMS("%s\n", __FILE__); |
136 | 123 | ||
137 | if (hdmi_overlay_ops && hdmi_overlay_ops->enable_vblank) | 124 | if (mixer_ops && mixer_ops->enable_vblank) |
138 | return hdmi_overlay_ops->enable_vblank(ctx->mixer_ctx->ctx, | 125 | return mixer_ops->enable_vblank(ctx->mixer_ctx->ctx, |
139 | manager->pipe); | 126 | manager->pipe); |
140 | 127 | ||
141 | return 0; | 128 | return 0; |
142 | } | 129 | } |
@@ -147,8 +134,8 @@ static void drm_hdmi_disable_vblank(struct device *subdrv_dev) | |||
147 | 134 | ||
148 | DRM_DEBUG_KMS("%s\n", __FILE__); | 135 | DRM_DEBUG_KMS("%s\n", __FILE__); |
149 | 136 | ||
150 | if (hdmi_overlay_ops && hdmi_overlay_ops->disable_vblank) | 137 | if (mixer_ops && mixer_ops->disable_vblank) |
151 | return hdmi_overlay_ops->disable_vblank(ctx->mixer_ctx->ctx); | 138 | return mixer_ops->disable_vblank(ctx->mixer_ctx->ctx); |
152 | } | 139 | } |
153 | 140 | ||
154 | static void drm_hdmi_mode_fixup(struct device *subdrv_dev, | 141 | static void drm_hdmi_mode_fixup(struct device *subdrv_dev, |
@@ -160,9 +147,9 @@ static void drm_hdmi_mode_fixup(struct device *subdrv_dev, | |||
160 | 147 | ||
161 | DRM_DEBUG_KMS("%s\n", __FILE__); | 148 | DRM_DEBUG_KMS("%s\n", __FILE__); |
162 | 149 | ||
163 | if (hdmi_manager_ops && hdmi_manager_ops->mode_fixup) | 150 | if (hdmi_ops && hdmi_ops->mode_fixup) |
164 | hdmi_manager_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, | 151 | hdmi_ops->mode_fixup(ctx->hdmi_ctx->ctx, connector, mode, |
165 | mode, adjusted_mode); | 152 | adjusted_mode); |
166 | } | 153 | } |
167 | 154 | ||
168 | static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) | 155 | static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) |
@@ -171,8 +158,8 @@ static void drm_hdmi_mode_set(struct device *subdrv_dev, void *mode) | |||
171 | 158 | ||
172 | DRM_DEBUG_KMS("%s\n", __FILE__); | 159 | DRM_DEBUG_KMS("%s\n", __FILE__); |
173 | 160 | ||
174 | if (hdmi_manager_ops && hdmi_manager_ops->mode_set) | 161 | if (hdmi_ops && hdmi_ops->mode_set) |
175 | hdmi_manager_ops->mode_set(ctx->hdmi_ctx->ctx, mode); | 162 | hdmi_ops->mode_set(ctx->hdmi_ctx->ctx, mode); |
176 | } | 163 | } |
177 | 164 | ||
178 | static void drm_hdmi_get_max_resol(struct device *subdrv_dev, | 165 | static void drm_hdmi_get_max_resol(struct device *subdrv_dev, |
@@ -182,9 +169,8 @@ static void drm_hdmi_get_max_resol(struct device *subdrv_dev, | |||
182 | 169 | ||
183 | DRM_DEBUG_KMS("%s\n", __FILE__); | 170 | DRM_DEBUG_KMS("%s\n", __FILE__); |
184 | 171 | ||
185 | if (hdmi_manager_ops && hdmi_manager_ops->get_max_resol) | 172 | if (hdmi_ops && hdmi_ops->get_max_resol) |
186 | hdmi_manager_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, | 173 | hdmi_ops->get_max_resol(ctx->hdmi_ctx->ctx, width, height); |
187 | height); | ||
188 | } | 174 | } |
189 | 175 | ||
190 | static void drm_hdmi_commit(struct device *subdrv_dev) | 176 | static void drm_hdmi_commit(struct device *subdrv_dev) |
@@ -193,8 +179,8 @@ static void drm_hdmi_commit(struct device *subdrv_dev) | |||
193 | 179 | ||
194 | DRM_DEBUG_KMS("%s\n", __FILE__); | 180 | DRM_DEBUG_KMS("%s\n", __FILE__); |
195 | 181 | ||
196 | if (hdmi_manager_ops && hdmi_manager_ops->commit) | 182 | if (hdmi_ops && hdmi_ops->commit) |
197 | hdmi_manager_ops->commit(ctx->hdmi_ctx->ctx); | 183 | hdmi_ops->commit(ctx->hdmi_ctx->ctx); |
198 | } | 184 | } |
199 | 185 | ||
200 | static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) | 186 | static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) |
@@ -209,8 +195,8 @@ static void drm_hdmi_dpms(struct device *subdrv_dev, int mode) | |||
209 | case DRM_MODE_DPMS_STANDBY: | 195 | case DRM_MODE_DPMS_STANDBY: |
210 | case DRM_MODE_DPMS_SUSPEND: | 196 | case DRM_MODE_DPMS_SUSPEND: |
211 | case DRM_MODE_DPMS_OFF: | 197 | case DRM_MODE_DPMS_OFF: |
212 | if (hdmi_manager_ops && hdmi_manager_ops->disable) | 198 | if (hdmi_ops && hdmi_ops->disable) |
213 | hdmi_manager_ops->disable(ctx->hdmi_ctx->ctx); | 199 | hdmi_ops->disable(ctx->hdmi_ctx->ctx); |
214 | break; | 200 | break; |
215 | default: | 201 | default: |
216 | DRM_DEBUG_KMS("unkown dps mode: %d\n", mode); | 202 | DRM_DEBUG_KMS("unkown dps mode: %d\n", mode); |
@@ -235,8 +221,8 @@ static void drm_mixer_mode_set(struct device *subdrv_dev, | |||
235 | 221 | ||
236 | DRM_DEBUG_KMS("%s\n", __FILE__); | 222 | DRM_DEBUG_KMS("%s\n", __FILE__); |
237 | 223 | ||
238 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_mode_set) | 224 | if (mixer_ops && mixer_ops->win_mode_set) |
239 | hdmi_overlay_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); | 225 | mixer_ops->win_mode_set(ctx->mixer_ctx->ctx, overlay); |
240 | } | 226 | } |
241 | 227 | ||
242 | static void drm_mixer_commit(struct device *subdrv_dev, int zpos) | 228 | static void drm_mixer_commit(struct device *subdrv_dev, int zpos) |
@@ -245,8 +231,8 @@ static void drm_mixer_commit(struct device *subdrv_dev, int zpos) | |||
245 | 231 | ||
246 | DRM_DEBUG_KMS("%s\n", __FILE__); | 232 | DRM_DEBUG_KMS("%s\n", __FILE__); |
247 | 233 | ||
248 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_commit) | 234 | if (mixer_ops && mixer_ops->win_commit) |
249 | hdmi_overlay_ops->win_commit(ctx->mixer_ctx->ctx, zpos); | 235 | mixer_ops->win_commit(ctx->mixer_ctx->ctx, zpos); |
250 | } | 236 | } |
251 | 237 | ||
252 | static void drm_mixer_disable(struct device *subdrv_dev, int zpos) | 238 | static void drm_mixer_disable(struct device *subdrv_dev, int zpos) |
@@ -255,8 +241,8 @@ static void drm_mixer_disable(struct device *subdrv_dev, int zpos) | |||
255 | 241 | ||
256 | DRM_DEBUG_KMS("%s\n", __FILE__); | 242 | DRM_DEBUG_KMS("%s\n", __FILE__); |
257 | 243 | ||
258 | if (hdmi_overlay_ops && hdmi_overlay_ops->win_disable) | 244 | if (mixer_ops && mixer_ops->win_disable) |
259 | hdmi_overlay_ops->win_disable(ctx->mixer_ctx->ctx, zpos); | 245 | mixer_ops->win_disable(ctx->mixer_ctx->ctx, zpos); |
260 | } | 246 | } |
261 | 247 | ||
262 | static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { | 248 | static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { |
@@ -265,6 +251,12 @@ static struct exynos_drm_overlay_ops drm_hdmi_overlay_ops = { | |||
265 | .disable = drm_mixer_disable, | 251 | .disable = drm_mixer_disable, |
266 | }; | 252 | }; |
267 | 253 | ||
254 | static struct exynos_drm_manager hdmi_manager = { | ||
255 | .pipe = -1, | ||
256 | .ops = &drm_hdmi_manager_ops, | ||
257 | .overlay_ops = &drm_hdmi_overlay_ops, | ||
258 | .display_ops = &drm_hdmi_display_ops, | ||
259 | }; | ||
268 | 260 | ||
269 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, | 261 | static int hdmi_subdrv_probe(struct drm_device *drm_dev, |
270 | struct device *dev) | 262 | struct device *dev) |
@@ -332,12 +324,9 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) | |||
332 | 324 | ||
333 | subdrv = &ctx->subdrv; | 325 | subdrv = &ctx->subdrv; |
334 | 326 | ||
327 | subdrv->dev = dev; | ||
328 | subdrv->manager = &hdmi_manager; | ||
335 | subdrv->probe = hdmi_subdrv_probe; | 329 | subdrv->probe = hdmi_subdrv_probe; |
336 | subdrv->manager.pipe = -1; | ||
337 | subdrv->manager.ops = &drm_hdmi_manager_ops; | ||
338 | subdrv->manager.overlay_ops = &drm_hdmi_overlay_ops; | ||
339 | subdrv->manager.display_ops = &drm_hdmi_display_ops; | ||
340 | subdrv->manager.dev = dev; | ||
341 | 330 | ||
342 | platform_set_drvdata(pdev, subdrv); | 331 | platform_set_drvdata(pdev, subdrv); |
343 | 332 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h index 44497cfb6c74..f3ae192c8dcf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_hdmi.h +++ b/drivers/gpu/drm/exynos/exynos_drm_hdmi.h | |||
@@ -38,15 +38,15 @@ struct exynos_drm_hdmi_context { | |||
38 | void *ctx; | 38 | void *ctx; |
39 | }; | 39 | }; |
40 | 40 | ||
41 | struct exynos_hdmi_display_ops { | 41 | struct exynos_hdmi_ops { |
42 | /* display */ | ||
42 | bool (*is_connected)(void *ctx); | 43 | bool (*is_connected)(void *ctx); |
43 | int (*get_edid)(void *ctx, struct drm_connector *connector, | 44 | int (*get_edid)(void *ctx, struct drm_connector *connector, |
44 | u8 *edid, int len); | 45 | u8 *edid, int len); |
45 | int (*check_timing)(void *ctx, void *timing); | 46 | int (*check_timing)(void *ctx, void *timing); |
46 | int (*power_on)(void *ctx, int mode); | 47 | int (*power_on)(void *ctx, int mode); |
47 | }; | ||
48 | 48 | ||
49 | struct exynos_hdmi_manager_ops { | 49 | /* manager */ |
50 | void (*mode_fixup)(void *ctx, struct drm_connector *connector, | 50 | void (*mode_fixup)(void *ctx, struct drm_connector *connector, |
51 | struct drm_display_mode *mode, | 51 | struct drm_display_mode *mode, |
52 | struct drm_display_mode *adjusted_mode); | 52 | struct drm_display_mode *adjusted_mode); |
@@ -57,22 +57,17 @@ struct exynos_hdmi_manager_ops { | |||
57 | void (*disable)(void *ctx); | 57 | void (*disable)(void *ctx); |
58 | }; | 58 | }; |
59 | 59 | ||
60 | struct exynos_hdmi_overlay_ops { | 60 | struct exynos_mixer_ops { |
61 | /* manager */ | ||
61 | int (*enable_vblank)(void *ctx, int pipe); | 62 | int (*enable_vblank)(void *ctx, int pipe); |
62 | void (*disable_vblank)(void *ctx); | 63 | void (*disable_vblank)(void *ctx); |
64 | |||
65 | /* overlay */ | ||
63 | void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); | 66 | void (*win_mode_set)(void *ctx, struct exynos_drm_overlay *overlay); |
64 | void (*win_commit)(void *ctx, int zpos); | 67 | void (*win_commit)(void *ctx, int zpos); |
65 | void (*win_disable)(void *ctx, int zpos); | 68 | void (*win_disable)(void *ctx, int zpos); |
66 | }; | 69 | }; |
67 | 70 | ||
68 | extern struct platform_driver hdmi_driver; | 71 | void exynos_hdmi_ops_register(struct exynos_hdmi_ops *ops); |
69 | extern struct platform_driver mixer_driver; | 72 | void exynos_mixer_ops_register(struct exynos_mixer_ops *ops); |
70 | |||
71 | void exynos_drm_display_ops_register(struct exynos_hdmi_display_ops | ||
72 | *display_ops); | ||
73 | void exynos_drm_manager_ops_register(struct exynos_hdmi_manager_ops | ||
74 | *manager_ops); | ||
75 | void exynos_drm_overlay_ops_register(struct exynos_hdmi_overlay_ops | ||
76 | *overlay_ops); | ||
77 | |||
78 | #endif | 73 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index c277a3a445f5..f92fe4c6174a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
@@ -24,6 +24,10 @@ struct exynos_plane { | |||
24 | 24 | ||
25 | static const uint32_t formats[] = { | 25 | static const uint32_t formats[] = { |
26 | DRM_FORMAT_XRGB8888, | 26 | DRM_FORMAT_XRGB8888, |
27 | DRM_FORMAT_ARGB8888, | ||
28 | DRM_FORMAT_NV12, | ||
29 | DRM_FORMAT_NV12M, | ||
30 | DRM_FORMAT_NV12MT, | ||
27 | }; | 31 | }; |
28 | 32 | ||
29 | static int | 33 | static int |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 8e1339f9fe1f..7b9c153dceb6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -199,7 +199,7 @@ static void vidi_dpms(struct device *subdrv_dev, int mode) | |||
199 | static void vidi_apply(struct device *subdrv_dev) | 199 | static void vidi_apply(struct device *subdrv_dev) |
200 | { | 200 | { |
201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); | 201 | struct vidi_context *ctx = get_vidi_context(subdrv_dev); |
202 | struct exynos_drm_manager *mgr = &ctx->subdrv.manager; | 202 | struct exynos_drm_manager *mgr = ctx->subdrv.manager; |
203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; | 203 | struct exynos_drm_manager_ops *mgr_ops = mgr->ops; |
204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; | 204 | struct exynos_drm_overlay_ops *ovl_ops = mgr->overlay_ops; |
205 | struct vidi_win_data *win_data; | 205 | struct vidi_win_data *win_data; |
@@ -374,6 +374,13 @@ static struct exynos_drm_overlay_ops vidi_overlay_ops = { | |||
374 | .disable = vidi_win_disable, | 374 | .disable = vidi_win_disable, |
375 | }; | 375 | }; |
376 | 376 | ||
377 | static struct exynos_drm_manager vidi_manager = { | ||
378 | .pipe = -1, | ||
379 | .ops = &vidi_manager_ops, | ||
380 | .overlay_ops = &vidi_overlay_ops, | ||
381 | .display_ops = &vidi_display_ops, | ||
382 | }; | ||
383 | |||
377 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) | 384 | static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc) |
378 | { | 385 | { |
379 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; | 386 | struct exynos_drm_private *dev_priv = drm_dev->dev_private; |
@@ -425,7 +432,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) | |||
425 | struct vidi_context *ctx = container_of(work, struct vidi_context, | 432 | struct vidi_context *ctx = container_of(work, struct vidi_context, |
426 | work); | 433 | work); |
427 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 434 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
428 | struct exynos_drm_manager *manager = &subdrv->manager; | 435 | struct exynos_drm_manager *manager = subdrv->manager; |
429 | 436 | ||
430 | if (manager->pipe < 0) | 437 | if (manager->pipe < 0) |
431 | return; | 438 | return; |
@@ -471,7 +478,7 @@ static void vidi_subdrv_remove(struct drm_device *drm_dev) | |||
471 | static int vidi_power_on(struct vidi_context *ctx, bool enable) | 478 | static int vidi_power_on(struct vidi_context *ctx, bool enable) |
472 | { | 479 | { |
473 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; | 480 | struct exynos_drm_subdrv *subdrv = &ctx->subdrv; |
474 | struct device *dev = subdrv->manager.dev; | 481 | struct device *dev = subdrv->dev; |
475 | 482 | ||
476 | DRM_DEBUG_KMS("%s\n", __FILE__); | 483 | DRM_DEBUG_KMS("%s\n", __FILE__); |
477 | 484 | ||
@@ -611,13 +618,10 @@ static int __devinit vidi_probe(struct platform_device *pdev) | |||
611 | ctx->raw_edid = (struct edid *)fake_edid_info; | 618 | ctx->raw_edid = (struct edid *)fake_edid_info; |
612 | 619 | ||
613 | subdrv = &ctx->subdrv; | 620 | subdrv = &ctx->subdrv; |
621 | subdrv->dev = dev; | ||
622 | subdrv->manager = &vidi_manager; | ||
614 | subdrv->probe = vidi_subdrv_probe; | 623 | subdrv->probe = vidi_subdrv_probe; |
615 | subdrv->remove = vidi_subdrv_remove; | 624 | subdrv->remove = vidi_subdrv_remove; |
616 | subdrv->manager.pipe = -1; | ||
617 | subdrv->manager.ops = &vidi_manager_ops; | ||
618 | subdrv->manager.overlay_ops = &vidi_overlay_ops; | ||
619 | subdrv->manager.display_ops = &vidi_display_ops; | ||
620 | subdrv->manager.dev = dev; | ||
621 | 625 | ||
622 | mutex_init(&ctx->lock); | 626 | mutex_init(&ctx->lock); |
623 | 627 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 575a8cbd3533..b00353876458 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #include "exynos_hdmi.h" | 41 | #include "exynos_hdmi.h" |
42 | 42 | ||
43 | #define HDMI_OVERLAY_NUMBER 3 | ||
44 | #define MAX_WIDTH 1920 | 43 | #define MAX_WIDTH 1920 |
45 | #define MAX_HEIGHT 1080 | 44 | #define MAX_HEIGHT 1080 |
46 | #define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) | 45 | #define get_hdmi_context(dev) platform_get_drvdata(to_platform_device(dev)) |
@@ -1194,7 +1193,7 @@ static int hdmi_conf_index(struct hdmi_context *hdata, | |||
1194 | 1193 | ||
1195 | static bool hdmi_is_connected(void *ctx) | 1194 | static bool hdmi_is_connected(void *ctx) |
1196 | { | 1195 | { |
1197 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1196 | struct hdmi_context *hdata = ctx; |
1198 | u32 val = hdmi_reg_read(hdata, HDMI_HPD_STATUS); | 1197 | u32 val = hdmi_reg_read(hdata, HDMI_HPD_STATUS); |
1199 | 1198 | ||
1200 | if (val) | 1199 | if (val) |
@@ -1207,7 +1206,7 @@ static int hdmi_get_edid(void *ctx, struct drm_connector *connector, | |||
1207 | u8 *edid, int len) | 1206 | u8 *edid, int len) |
1208 | { | 1207 | { |
1209 | struct edid *raw_edid; | 1208 | struct edid *raw_edid; |
1210 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1209 | struct hdmi_context *hdata = ctx; |
1211 | 1210 | ||
1212 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1211 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1213 | 1212 | ||
@@ -1275,7 +1274,7 @@ static int hdmi_v14_check_timing(struct fb_videomode *check_timing) | |||
1275 | 1274 | ||
1276 | static int hdmi_check_timing(void *ctx, void *timing) | 1275 | static int hdmi_check_timing(void *ctx, void *timing) |
1277 | { | 1276 | { |
1278 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1277 | struct hdmi_context *hdata = ctx; |
1279 | struct fb_videomode *check_timing = timing; | 1278 | struct fb_videomode *check_timing = timing; |
1280 | 1279 | ||
1281 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1280 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1312,13 +1311,6 @@ static int hdmi_display_power_on(void *ctx, int mode) | |||
1312 | return 0; | 1311 | return 0; |
1313 | } | 1312 | } |
1314 | 1313 | ||
1315 | static struct exynos_hdmi_display_ops display_ops = { | ||
1316 | .is_connected = hdmi_is_connected, | ||
1317 | .get_edid = hdmi_get_edid, | ||
1318 | .check_timing = hdmi_check_timing, | ||
1319 | .power_on = hdmi_display_power_on, | ||
1320 | }; | ||
1321 | |||
1322 | static void hdmi_set_acr(u32 freq, u8 *acr) | 1314 | static void hdmi_set_acr(u32 freq, u8 *acr) |
1323 | { | 1315 | { |
1324 | u32 n, cts; | 1316 | u32 n, cts; |
@@ -1914,7 +1906,7 @@ static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector, | |||
1914 | struct drm_display_mode *adjusted_mode) | 1906 | struct drm_display_mode *adjusted_mode) |
1915 | { | 1907 | { |
1916 | struct drm_display_mode *m; | 1908 | struct drm_display_mode *m; |
1917 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1909 | struct hdmi_context *hdata = ctx; |
1918 | int index; | 1910 | int index; |
1919 | 1911 | ||
1920 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1912 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1951,7 +1943,7 @@ static void hdmi_mode_fixup(void *ctx, struct drm_connector *connector, | |||
1951 | 1943 | ||
1952 | static void hdmi_mode_set(void *ctx, void *mode) | 1944 | static void hdmi_mode_set(void *ctx, void *mode) |
1953 | { | 1945 | { |
1954 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1946 | struct hdmi_context *hdata = ctx; |
1955 | int conf_idx; | 1947 | int conf_idx; |
1956 | 1948 | ||
1957 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1949 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
@@ -1974,7 +1966,7 @@ static void hdmi_get_max_resol(void *ctx, unsigned int *width, | |||
1974 | 1966 | ||
1975 | static void hdmi_commit(void *ctx) | 1967 | static void hdmi_commit(void *ctx) |
1976 | { | 1968 | { |
1977 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1969 | struct hdmi_context *hdata = ctx; |
1978 | 1970 | ||
1979 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1971 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1980 | 1972 | ||
@@ -1985,7 +1977,7 @@ static void hdmi_commit(void *ctx) | |||
1985 | 1977 | ||
1986 | static void hdmi_disable(void *ctx) | 1978 | static void hdmi_disable(void *ctx) |
1987 | { | 1979 | { |
1988 | struct hdmi_context *hdata = (struct hdmi_context *)ctx; | 1980 | struct hdmi_context *hdata = ctx; |
1989 | 1981 | ||
1990 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 1982 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
1991 | 1983 | ||
@@ -1996,7 +1988,14 @@ static void hdmi_disable(void *ctx) | |||
1996 | } | 1988 | } |
1997 | } | 1989 | } |
1998 | 1990 | ||
1999 | static struct exynos_hdmi_manager_ops manager_ops = { | 1991 | static struct exynos_hdmi_ops hdmi_ops = { |
1992 | /* display */ | ||
1993 | .is_connected = hdmi_is_connected, | ||
1994 | .get_edid = hdmi_get_edid, | ||
1995 | .check_timing = hdmi_check_timing, | ||
1996 | .power_on = hdmi_display_power_on, | ||
1997 | |||
1998 | /* manager */ | ||
2000 | .mode_fixup = hdmi_mode_fixup, | 1999 | .mode_fixup = hdmi_mode_fixup, |
2001 | .mode_set = hdmi_mode_set, | 2000 | .mode_set = hdmi_mode_set, |
2002 | .get_max_resol = hdmi_get_max_resol, | 2001 | .get_max_resol = hdmi_get_max_resol, |
@@ -2020,7 +2019,7 @@ static void hdmi_hotplug_func(struct work_struct *work) | |||
2020 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) | 2019 | static irqreturn_t hdmi_irq_handler(int irq, void *arg) |
2021 | { | 2020 | { |
2022 | struct exynos_drm_hdmi_context *ctx = arg; | 2021 | struct exynos_drm_hdmi_context *ctx = arg; |
2023 | struct hdmi_context *hdata = (struct hdmi_context *)ctx->ctx; | 2022 | struct hdmi_context *hdata = ctx->ctx; |
2024 | u32 intc_flag; | 2023 | u32 intc_flag; |
2025 | 2024 | ||
2026 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); | 2025 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); |
@@ -2173,7 +2172,7 @@ static int hdmi_runtime_suspend(struct device *dev) | |||
2173 | 2172 | ||
2174 | DRM_DEBUG_KMS("%s\n", __func__); | 2173 | DRM_DEBUG_KMS("%s\n", __func__); |
2175 | 2174 | ||
2176 | hdmi_resource_poweroff((struct hdmi_context *)ctx->ctx); | 2175 | hdmi_resource_poweroff(ctx->ctx); |
2177 | 2176 | ||
2178 | return 0; | 2177 | return 0; |
2179 | } | 2178 | } |
@@ -2184,7 +2183,7 @@ static int hdmi_runtime_resume(struct device *dev) | |||
2184 | 2183 | ||
2185 | DRM_DEBUG_KMS("%s\n", __func__); | 2184 | DRM_DEBUG_KMS("%s\n", __func__); |
2186 | 2185 | ||
2187 | hdmi_resource_poweron((struct hdmi_context *)ctx->ctx); | 2186 | hdmi_resource_poweron(ctx->ctx); |
2188 | 2187 | ||
2189 | return 0; | 2188 | return 0; |
2190 | } | 2189 | } |
@@ -2322,8 +2321,7 @@ static int __devinit hdmi_probe(struct platform_device *pdev) | |||
2322 | hdata->irq = res->start; | 2321 | hdata->irq = res->start; |
2323 | 2322 | ||
2324 | /* register specific callbacks to common hdmi. */ | 2323 | /* register specific callbacks to common hdmi. */ |
2325 | exynos_drm_display_ops_register(&display_ops); | 2324 | exynos_hdmi_ops_register(&hdmi_ops); |
2326 | exynos_drm_manager_ops_register(&manager_ops); | ||
2327 | 2325 | ||
2328 | hdmi_resource_poweron(hdata); | 2326 | hdmi_resource_poweron(hdata); |
2329 | 2327 | ||
@@ -2351,7 +2349,7 @@ err_data: | |||
2351 | static int __devexit hdmi_remove(struct platform_device *pdev) | 2349 | static int __devexit hdmi_remove(struct platform_device *pdev) |
2352 | { | 2350 | { |
2353 | struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); | 2351 | struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev); |
2354 | struct hdmi_context *hdata = (struct hdmi_context *)ctx->ctx; | 2352 | struct hdmi_context *hdata = ctx->ctx; |
2355 | 2353 | ||
2356 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 2354 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
2357 | 2355 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4d5f41e19527..e15438c01129 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -37,7 +37,8 @@ | |||
37 | #include "exynos_drm_drv.h" | 37 | #include "exynos_drm_drv.h" |
38 | #include "exynos_drm_hdmi.h" | 38 | #include "exynos_drm_hdmi.h" |
39 | 39 | ||
40 | #define HDMI_OVERLAY_NUMBER 3 | 40 | #define MIXER_WIN_NR 3 |
41 | #define MIXER_DEFAULT_WIN 0 | ||
41 | 42 | ||
42 | #define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) | 43 | #define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) |
43 | 44 | ||
@@ -75,16 +76,12 @@ struct mixer_resources { | |||
75 | }; | 76 | }; |
76 | 77 | ||
77 | struct mixer_context { | 78 | struct mixer_context { |
78 | struct fb_videomode *default_timing; | ||
79 | unsigned int default_win; | ||
80 | unsigned int default_bpp; | ||
81 | unsigned int irq; | 79 | unsigned int irq; |
82 | int pipe; | 80 | int pipe; |
83 | bool interlace; | 81 | bool interlace; |
84 | bool vp_enabled; | ||
85 | 82 | ||
86 | struct mixer_resources mixer_res; | 83 | struct mixer_resources mixer_res; |
87 | struct hdmi_win_data win_data[HDMI_OVERLAY_NUMBER]; | 84 | struct hdmi_win_data win_data[MIXER_WIN_NR]; |
88 | }; | 85 | }; |
89 | 86 | ||
90 | static const u8 filter_y_horiz_tap8[] = { | 87 | static const u8 filter_y_horiz_tap8[] = { |
@@ -643,9 +640,9 @@ static void mixer_win_mode_set(void *ctx, | |||
643 | 640 | ||
644 | win = overlay->zpos; | 641 | win = overlay->zpos; |
645 | if (win == DEFAULT_ZPOS) | 642 | if (win == DEFAULT_ZPOS) |
646 | win = mixer_ctx->default_win; | 643 | win = MIXER_DEFAULT_WIN; |
647 | 644 | ||
648 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 645 | if (win < 0 || win > MIXER_WIN_NR) { |
649 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 646 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
650 | return; | 647 | return; |
651 | } | 648 | } |
@@ -683,9 +680,9 @@ static void mixer_win_commit(void *ctx, int zpos) | |||
683 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); | 680 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
684 | 681 | ||
685 | if (win == DEFAULT_ZPOS) | 682 | if (win == DEFAULT_ZPOS) |
686 | win = mixer_ctx->default_win; | 683 | win = MIXER_DEFAULT_WIN; |
687 | 684 | ||
688 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 685 | if (win < 0 || win > MIXER_WIN_NR) { |
689 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 686 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
690 | return; | 687 | return; |
691 | } | 688 | } |
@@ -706,9 +703,9 @@ static void mixer_win_disable(void *ctx, int zpos) | |||
706 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); | 703 | DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); |
707 | 704 | ||
708 | if (win == DEFAULT_ZPOS) | 705 | if (win == DEFAULT_ZPOS) |
709 | win = mixer_ctx->default_win; | 706 | win = MIXER_DEFAULT_WIN; |
710 | 707 | ||
711 | if (win < 0 || win > HDMI_OVERLAY_NUMBER) { | 708 | if (win < 0 || win > MIXER_WIN_NR) { |
712 | DRM_ERROR("overlay plane[%d] is wrong\n", win); | 709 | DRM_ERROR("overlay plane[%d] is wrong\n", win); |
713 | return; | 710 | return; |
714 | } | 711 | } |
@@ -722,9 +719,12 @@ static void mixer_win_disable(void *ctx, int zpos) | |||
722 | spin_unlock_irqrestore(&res->reg_slock, flags); | 719 | spin_unlock_irqrestore(&res->reg_slock, flags); |
723 | } | 720 | } |
724 | 721 | ||
725 | static struct exynos_hdmi_overlay_ops overlay_ops = { | 722 | static struct exynos_mixer_ops mixer_ops = { |
723 | /* manager */ | ||
726 | .enable_vblank = mixer_enable_vblank, | 724 | .enable_vblank = mixer_enable_vblank, |
727 | .disable_vblank = mixer_disable_vblank, | 725 | .disable_vblank = mixer_disable_vblank, |
726 | |||
727 | /* overlay */ | ||
728 | .win_mode_set = mixer_win_mode_set, | 728 | .win_mode_set = mixer_win_mode_set, |
729 | .win_commit = mixer_win_commit, | 729 | .win_commit = mixer_win_commit, |
730 | .win_disable = mixer_win_disable, | 730 | .win_disable = mixer_win_disable, |
@@ -771,8 +771,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc) | |||
771 | static irqreturn_t mixer_irq_handler(int irq, void *arg) | 771 | static irqreturn_t mixer_irq_handler(int irq, void *arg) |
772 | { | 772 | { |
773 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; | 773 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; |
774 | struct mixer_context *ctx = | 774 | struct mixer_context *ctx = drm_hdmi_ctx->ctx; |
775 | (struct mixer_context *)drm_hdmi_ctx->ctx; | ||
776 | struct mixer_resources *res = &ctx->mixer_res; | 775 | struct mixer_resources *res = &ctx->mixer_res; |
777 | u32 val, val_base; | 776 | u32 val, val_base; |
778 | 777 | ||
@@ -902,7 +901,7 @@ static int mixer_runtime_resume(struct device *dev) | |||
902 | 901 | ||
903 | DRM_DEBUG_KMS("resume - start\n"); | 902 | DRM_DEBUG_KMS("resume - start\n"); |
904 | 903 | ||
905 | mixer_resource_poweron((struct mixer_context *)ctx->ctx); | 904 | mixer_resource_poweron(ctx->ctx); |
906 | 905 | ||
907 | return 0; | 906 | return 0; |
908 | } | 907 | } |
@@ -913,7 +912,7 @@ static int mixer_runtime_suspend(struct device *dev) | |||
913 | 912 | ||
914 | DRM_DEBUG_KMS("suspend - start\n"); | 913 | DRM_DEBUG_KMS("suspend - start\n"); |
915 | 914 | ||
916 | mixer_resource_poweroff((struct mixer_context *)ctx->ctx); | 915 | mixer_resource_poweroff(ctx->ctx); |
917 | 916 | ||
918 | return 0; | 917 | return 0; |
919 | } | 918 | } |
@@ -926,8 +925,7 @@ static const struct dev_pm_ops mixer_pm_ops = { | |||
926 | static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, | 925 | static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, |
927 | struct platform_device *pdev) | 926 | struct platform_device *pdev) |
928 | { | 927 | { |
929 | struct mixer_context *mixer_ctx = | 928 | struct mixer_context *mixer_ctx = ctx->ctx; |
930 | (struct mixer_context *)ctx->ctx; | ||
931 | struct device *dev = &pdev->dev; | 929 | struct device *dev = &pdev->dev; |
932 | struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; | 930 | struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; |
933 | struct resource *res; | 931 | struct resource *res; |
@@ -1076,7 +1074,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) | |||
1076 | goto fail; | 1074 | goto fail; |
1077 | 1075 | ||
1078 | /* register specific callback point to common hdmi. */ | 1076 | /* register specific callback point to common hdmi. */ |
1079 | exynos_drm_overlay_ops_register(&overlay_ops); | 1077 | exynos_mixer_ops_register(&mixer_ops); |
1080 | 1078 | ||
1081 | mixer_resource_poweron(ctx); | 1079 | mixer_resource_poweron(ctx); |
1082 | 1080 | ||
@@ -1093,7 +1091,7 @@ static int mixer_remove(struct platform_device *pdev) | |||
1093 | struct device *dev = &pdev->dev; | 1091 | struct device *dev = &pdev->dev; |
1094 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = | 1092 | struct exynos_drm_hdmi_context *drm_hdmi_ctx = |
1095 | platform_get_drvdata(pdev); | 1093 | platform_get_drvdata(pdev); |
1096 | struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; | 1094 | struct mixer_context *ctx = drm_hdmi_ctx->ctx; |
1097 | 1095 | ||
1098 | dev_info(dev, "remove successful\n"); | 1096 | dev_info(dev, "remove successful\n"); |
1099 | 1097 | ||
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.h b/drivers/gpu/drm/gma500/mdfld_dsi_output.h index 21071cef92a4..36eb0744841c 100644 --- a/drivers/gpu/drm/gma500/mdfld_dsi_output.h +++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #define __MDFLD_DSI_OUTPUT_H__ | 29 | #define __MDFLD_DSI_OUTPUT_H__ |
30 | 30 | ||
31 | #include <linux/backlight.h> | 31 | #include <linux/backlight.h> |
32 | #include <linux/version.h> | ||
33 | #include <drm/drmP.h> | 32 | #include <drm/drmP.h> |
34 | #include <drm/drm.h> | 33 | #include <drm/drm.h> |
35 | #include <drm/drm_crtc.h> | 34 | #include <drm/drm_crtc.h> |
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c index 2c8a60c3b98e..f920fb5e42b6 100644 --- a/drivers/gpu/drm/i810/i810_dma.c +++ b/drivers/gpu/drm/i810/i810_dma.c | |||
@@ -129,6 +129,7 @@ static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv) | |||
129 | if (buf_priv->currently_mapped == I810_BUF_MAPPED) | 129 | if (buf_priv->currently_mapped == I810_BUF_MAPPED) |
130 | return -EINVAL; | 130 | return -EINVAL; |
131 | 131 | ||
132 | /* This is all entirely broken */ | ||
132 | down_write(¤t->mm->mmap_sem); | 133 | down_write(¤t->mm->mmap_sem); |
133 | old_fops = file_priv->filp->f_op; | 134 | old_fops = file_priv->filp->f_op; |
134 | file_priv->filp->f_op = &i810_buffer_fops; | 135 | file_priv->filp->f_op = &i810_buffer_fops; |
@@ -157,11 +158,8 @@ static int i810_unmap_buffer(struct drm_buf *buf) | |||
157 | if (buf_priv->currently_mapped != I810_BUF_MAPPED) | 158 | if (buf_priv->currently_mapped != I810_BUF_MAPPED) |
158 | return -EINVAL; | 159 | return -EINVAL; |
159 | 160 | ||
160 | down_write(¤t->mm->mmap_sem); | 161 | retcode = vm_munmap((unsigned long)buf_priv->virtual, |
161 | retcode = do_munmap(current->mm, | ||
162 | (unsigned long)buf_priv->virtual, | ||
163 | (size_t) buf->total); | 162 | (size_t) buf->total); |
164 | up_write(¤t->mm->mmap_sem); | ||
165 | 163 | ||
166 | buf_priv->currently_mapped = I810_BUF_UNMAPPED; | 164 | buf_priv->currently_mapped = I810_BUF_UNMAPPED; |
167 | buf_priv->virtual = NULL; | 165 | buf_priv->virtual = NULL; |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index fdb7ccefffbd..e6162a1681f0 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -1224,6 +1224,9 @@ static int i915_emon_status(struct seq_file *m, void *unused) | |||
1224 | unsigned long temp, chipset, gfx; | 1224 | unsigned long temp, chipset, gfx; |
1225 | int ret; | 1225 | int ret; |
1226 | 1226 | ||
1227 | if (!IS_GEN5(dev)) | ||
1228 | return -ENODEV; | ||
1229 | |||
1227 | ret = mutex_lock_interruptible(&dev->struct_mutex); | 1230 | ret = mutex_lock_interruptible(&dev->struct_mutex); |
1228 | if (ret) | 1231 | if (ret) |
1229 | return ret; | 1232 | return ret; |
@@ -1502,14 +1505,6 @@ static int i915_ppgtt_info(struct seq_file *m, void *data) | |||
1502 | return 0; | 1505 | return 0; |
1503 | } | 1506 | } |
1504 | 1507 | ||
1505 | static int | ||
1506 | i915_debugfs_common_open(struct inode *inode, | ||
1507 | struct file *filp) | ||
1508 | { | ||
1509 | filp->private_data = inode->i_private; | ||
1510 | return 0; | ||
1511 | } | ||
1512 | |||
1513 | static ssize_t | 1508 | static ssize_t |
1514 | i915_wedged_read(struct file *filp, | 1509 | i915_wedged_read(struct file *filp, |
1515 | char __user *ubuf, | 1510 | char __user *ubuf, |
@@ -1560,7 +1555,7 @@ i915_wedged_write(struct file *filp, | |||
1560 | 1555 | ||
1561 | static const struct file_operations i915_wedged_fops = { | 1556 | static const struct file_operations i915_wedged_fops = { |
1562 | .owner = THIS_MODULE, | 1557 | .owner = THIS_MODULE, |
1563 | .open = i915_debugfs_common_open, | 1558 | .open = simple_open, |
1564 | .read = i915_wedged_read, | 1559 | .read = i915_wedged_read, |
1565 | .write = i915_wedged_write, | 1560 | .write = i915_wedged_write, |
1566 | .llseek = default_llseek, | 1561 | .llseek = default_llseek, |
@@ -1622,7 +1617,7 @@ i915_max_freq_write(struct file *filp, | |||
1622 | 1617 | ||
1623 | static const struct file_operations i915_max_freq_fops = { | 1618 | static const struct file_operations i915_max_freq_fops = { |
1624 | .owner = THIS_MODULE, | 1619 | .owner = THIS_MODULE, |
1625 | .open = i915_debugfs_common_open, | 1620 | .open = simple_open, |
1626 | .read = i915_max_freq_read, | 1621 | .read = i915_max_freq_read, |
1627 | .write = i915_max_freq_write, | 1622 | .write = i915_max_freq_write, |
1628 | .llseek = default_llseek, | 1623 | .llseek = default_llseek, |
@@ -1693,7 +1688,7 @@ i915_cache_sharing_write(struct file *filp, | |||
1693 | 1688 | ||
1694 | static const struct file_operations i915_cache_sharing_fops = { | 1689 | static const struct file_operations i915_cache_sharing_fops = { |
1695 | .owner = THIS_MODULE, | 1690 | .owner = THIS_MODULE, |
1696 | .open = i915_debugfs_common_open, | 1691 | .open = simple_open, |
1697 | .read = i915_cache_sharing_read, | 1692 | .read = i915_cache_sharing_read, |
1698 | .write = i915_cache_sharing_write, | 1693 | .write = i915_cache_sharing_write, |
1699 | .llseek = default_llseek, | 1694 | .llseek = default_llseek, |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 9341eb8ce93b..ba60f3c8f911 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1183,6 +1183,21 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev) | |||
1183 | return can_switch; | 1183 | return can_switch; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | static bool | ||
1187 | intel_enable_ppgtt(struct drm_device *dev) | ||
1188 | { | ||
1189 | if (i915_enable_ppgtt >= 0) | ||
1190 | return i915_enable_ppgtt; | ||
1191 | |||
1192 | #ifdef CONFIG_INTEL_IOMMU | ||
1193 | /* Disable ppgtt on SNB if VT-d is on. */ | ||
1194 | if (INTEL_INFO(dev)->gen == 6 && intel_iommu_gfx_mapped) | ||
1195 | return false; | ||
1196 | #endif | ||
1197 | |||
1198 | return true; | ||
1199 | } | ||
1200 | |||
1186 | static int i915_load_gem_init(struct drm_device *dev) | 1201 | static int i915_load_gem_init(struct drm_device *dev) |
1187 | { | 1202 | { |
1188 | struct drm_i915_private *dev_priv = dev->dev_private; | 1203 | struct drm_i915_private *dev_priv = dev->dev_private; |
@@ -1197,7 +1212,7 @@ static int i915_load_gem_init(struct drm_device *dev) | |||
1197 | drm_mm_init(&dev_priv->mm.stolen, 0, prealloc_size); | 1212 | drm_mm_init(&dev_priv->mm.stolen, 0, prealloc_size); |
1198 | 1213 | ||
1199 | mutex_lock(&dev->struct_mutex); | 1214 | mutex_lock(&dev->struct_mutex); |
1200 | if (i915_enable_ppgtt && HAS_ALIASING_PPGTT(dev)) { | 1215 | if (intel_enable_ppgtt(dev) && HAS_ALIASING_PPGTT(dev)) { |
1201 | /* PPGTT pdes are stolen from global gtt ptes, so shrink the | 1216 | /* PPGTT pdes are stolen from global gtt ptes, so shrink the |
1202 | * aperture accordingly when using aliasing ppgtt. */ | 1217 | * aperture accordingly when using aliasing ppgtt. */ |
1203 | gtt_size -= I915_PPGTT_PD_ENTRIES*PAGE_SIZE; | 1218 | gtt_size -= I915_PPGTT_PD_ENTRIES*PAGE_SIZE; |
@@ -1207,8 +1222,10 @@ static int i915_load_gem_init(struct drm_device *dev) | |||
1207 | i915_gem_do_init(dev, 0, mappable_size, gtt_size); | 1222 | i915_gem_do_init(dev, 0, mappable_size, gtt_size); |
1208 | 1223 | ||
1209 | ret = i915_gem_init_aliasing_ppgtt(dev); | 1224 | ret = i915_gem_init_aliasing_ppgtt(dev); |
1210 | if (ret) | 1225 | if (ret) { |
1226 | mutex_unlock(&dev->struct_mutex); | ||
1211 | return ret; | 1227 | return ret; |
1228 | } | ||
1212 | } else { | 1229 | } else { |
1213 | /* Let GEM Manage all of the aperture. | 1230 | /* Let GEM Manage all of the aperture. |
1214 | * | 1231 | * |
@@ -1684,6 +1701,9 @@ void i915_update_gfx_val(struct drm_i915_private *dev_priv) | |||
1684 | unsigned long diffms; | 1701 | unsigned long diffms; |
1685 | u32 count; | 1702 | u32 count; |
1686 | 1703 | ||
1704 | if (dev_priv->info->gen != 5) | ||
1705 | return; | ||
1706 | |||
1687 | getrawmonotonic(&now); | 1707 | getrawmonotonic(&now); |
1688 | diff1 = timespec_sub(now, dev_priv->last_time2); | 1708 | diff1 = timespec_sub(now, dev_priv->last_time2); |
1689 | 1709 | ||
@@ -2104,12 +2124,14 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
2104 | setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, | 2124 | setup_timer(&dev_priv->hangcheck_timer, i915_hangcheck_elapsed, |
2105 | (unsigned long) dev); | 2125 | (unsigned long) dev); |
2106 | 2126 | ||
2107 | spin_lock(&mchdev_lock); | 2127 | if (IS_GEN5(dev)) { |
2108 | i915_mch_dev = dev_priv; | 2128 | spin_lock(&mchdev_lock); |
2109 | dev_priv->mchdev_lock = &mchdev_lock; | 2129 | i915_mch_dev = dev_priv; |
2110 | spin_unlock(&mchdev_lock); | 2130 | dev_priv->mchdev_lock = &mchdev_lock; |
2131 | spin_unlock(&mchdev_lock); | ||
2111 | 2132 | ||
2112 | ips_ping_for_i915_load(); | 2133 | ips_ping_for_i915_load(); |
2134 | } | ||
2113 | 2135 | ||
2114 | return 0; | 2136 | return 0; |
2115 | 2137 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 1a7559b59997..ae8a64f9f845 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -64,9 +64,13 @@ MODULE_PARM_DESC(semaphores, | |||
64 | "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); | 64 | "Use semaphores for inter-ring sync (default: -1 (use per-chip defaults))"); |
65 | 65 | ||
66 | int i915_enable_rc6 __read_mostly = -1; | 66 | int i915_enable_rc6 __read_mostly = -1; |
67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | 67 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0400); |
68 | MODULE_PARM_DESC(i915_enable_rc6, | 68 | MODULE_PARM_DESC(i915_enable_rc6, |
69 | "Enable power-saving render C-state 6 (default: -1 (use per-chip default)"); | 69 | "Enable power-saving render C-state 6. " |
70 | "Different stages can be selected via bitmask values " | ||
71 | "(0 = disable; 1 = enable rc6; 2 = enable deep rc6; 4 = enable deepest rc6). " | ||
72 | "For example, 3 would enable rc6 and deep rc6, and 7 would enable everything. " | ||
73 | "default: -1 (use per-chip default)"); | ||
70 | 74 | ||
71 | int i915_enable_fbc __read_mostly = -1; | 75 | int i915_enable_fbc __read_mostly = -1; |
72 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); | 76 | module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600); |
@@ -103,8 +107,8 @@ MODULE_PARM_DESC(enable_hangcheck, | |||
103 | "WARNING: Disabling this can cause system wide hangs. " | 107 | "WARNING: Disabling this can cause system wide hangs. " |
104 | "(default: true)"); | 108 | "(default: true)"); |
105 | 109 | ||
106 | bool i915_enable_ppgtt __read_mostly = 1; | 110 | int i915_enable_ppgtt __read_mostly = -1; |
107 | module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, bool, 0600); | 111 | module_param_named(i915_enable_ppgtt, i915_enable_ppgtt, int, 0600); |
108 | MODULE_PARM_DESC(i915_enable_ppgtt, | 112 | MODULE_PARM_DESC(i915_enable_ppgtt, |
109 | "Enable PPGTT (default: true)"); | 113 | "Enable PPGTT (default: true)"); |
110 | 114 | ||
@@ -292,6 +296,7 @@ static const struct pci_device_id pciidlist[] = { /* aka */ | |||
292 | INTEL_VGA_DEVICE(0x0152, &intel_ivybridge_d_info), /* GT1 desktop */ | 296 | INTEL_VGA_DEVICE(0x0152, &intel_ivybridge_d_info), /* GT1 desktop */ |
293 | INTEL_VGA_DEVICE(0x0162, &intel_ivybridge_d_info), /* GT2 desktop */ | 297 | INTEL_VGA_DEVICE(0x0162, &intel_ivybridge_d_info), /* GT2 desktop */ |
294 | INTEL_VGA_DEVICE(0x015a, &intel_ivybridge_d_info), /* GT1 server */ | 298 | INTEL_VGA_DEVICE(0x015a, &intel_ivybridge_d_info), /* GT1 server */ |
299 | INTEL_VGA_DEVICE(0x016a, &intel_ivybridge_d_info), /* GT2 server */ | ||
295 | {0, 0, 0} | 300 | {0, 0, 0} |
296 | }; | 301 | }; |
297 | 302 | ||
@@ -533,7 +538,9 @@ static int i915_drm_thaw(struct drm_device *dev) | |||
533 | drm_irq_install(dev); | 538 | drm_irq_install(dev); |
534 | 539 | ||
535 | /* Resume the modeset for every activated CRTC */ | 540 | /* Resume the modeset for every activated CRTC */ |
541 | mutex_lock(&dev->mode_config.mutex); | ||
536 | drm_helper_resume_force_mode(dev); | 542 | drm_helper_resume_force_mode(dev); |
543 | mutex_unlock(&dev->mode_config.mutex); | ||
537 | 544 | ||
538 | if (IS_IRONLAKE_M(dev)) | 545 | if (IS_IRONLAKE_M(dev)) |
539 | ironlake_enable_rc6(dev); | 546 | ironlake_enable_rc6(dev); |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c0f19f572004..5fabc6c31fec 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1053,6 +1053,27 @@ struct drm_i915_file_private { | |||
1053 | 1053 | ||
1054 | #include "i915_trace.h" | 1054 | #include "i915_trace.h" |
1055 | 1055 | ||
1056 | /** | ||
1057 | * RC6 is a special power stage which allows the GPU to enter an very | ||
1058 | * low-voltage mode when idle, using down to 0V while at this stage. This | ||
1059 | * stage is entered automatically when the GPU is idle when RC6 support is | ||
1060 | * enabled, and as soon as new workload arises GPU wakes up automatically as well. | ||
1061 | * | ||
1062 | * There are different RC6 modes available in Intel GPU, which differentiate | ||
1063 | * among each other with the latency required to enter and leave RC6 and | ||
1064 | * voltage consumed by the GPU in different states. | ||
1065 | * | ||
1066 | * The combination of the following flags define which states GPU is allowed | ||
1067 | * to enter, while RC6 is the normal RC6 state, RC6p is the deep RC6, and | ||
1068 | * RC6pp is deepest RC6. Their support by hardware varies according to the | ||
1069 | * GPU, BIOS, chipset and platform. RC6 is usually the safest one and the one | ||
1070 | * which brings the most power savings; deeper states save more power, but | ||
1071 | * require higher latency to switch to and wake up. | ||
1072 | */ | ||
1073 | #define INTEL_RC6_ENABLE (1<<0) | ||
1074 | #define INTEL_RC6p_ENABLE (1<<1) | ||
1075 | #define INTEL_RC6pp_ENABLE (1<<2) | ||
1076 | |||
1056 | extern struct drm_ioctl_desc i915_ioctls[]; | 1077 | extern struct drm_ioctl_desc i915_ioctls[]; |
1057 | extern int i915_max_ioctl; | 1078 | extern int i915_max_ioctl; |
1058 | extern unsigned int i915_fbpercrtc __always_unused; | 1079 | extern unsigned int i915_fbpercrtc __always_unused; |
@@ -1065,7 +1086,7 @@ extern int i915_vbt_sdvo_panel_type __read_mostly; | |||
1065 | extern int i915_enable_rc6 __read_mostly; | 1086 | extern int i915_enable_rc6 __read_mostly; |
1066 | extern int i915_enable_fbc __read_mostly; | 1087 | extern int i915_enable_fbc __read_mostly; |
1067 | extern bool i915_enable_hangcheck __read_mostly; | 1088 | extern bool i915_enable_hangcheck __read_mostly; |
1068 | extern bool i915_enable_ppgtt __read_mostly; | 1089 | extern int i915_enable_ppgtt __read_mostly; |
1069 | 1090 | ||
1070 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); | 1091 | extern int i915_suspend(struct drm_device *dev, pm_message_t state); |
1071 | extern int i915_resume(struct drm_device *dev); | 1092 | extern int i915_resume(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 1f441f5c2405..0d1e4b7b4b99 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1087,11 +1087,9 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data, | |||
1087 | if (obj == NULL) | 1087 | if (obj == NULL) |
1088 | return -ENOENT; | 1088 | return -ENOENT; |
1089 | 1089 | ||
1090 | down_write(¤t->mm->mmap_sem); | 1090 | addr = vm_mmap(obj->filp, 0, args->size, |
1091 | addr = do_mmap(obj->filp, 0, args->size, | ||
1092 | PROT_READ | PROT_WRITE, MAP_SHARED, | 1091 | PROT_READ | PROT_WRITE, MAP_SHARED, |
1093 | args->offset); | 1092 | args->offset); |
1094 | up_write(¤t->mm->mmap_sem); | ||
1095 | drm_gem_object_unreference_unlocked(obj); | 1093 | drm_gem_object_unreference_unlocked(obj); |
1096 | if (IS_ERR((void *)addr)) | 1094 | if (IS_ERR((void *)addr)) |
1097 | return addr; | 1095 | return addr; |
@@ -1472,16 +1470,19 @@ i915_gem_object_move_to_active(struct drm_i915_gem_object *obj, | |||
1472 | list_move_tail(&obj->ring_list, &ring->active_list); | 1470 | list_move_tail(&obj->ring_list, &ring->active_list); |
1473 | 1471 | ||
1474 | obj->last_rendering_seqno = seqno; | 1472 | obj->last_rendering_seqno = seqno; |
1475 | if (obj->fenced_gpu_access) { | ||
1476 | struct drm_i915_fence_reg *reg; | ||
1477 | |||
1478 | BUG_ON(obj->fence_reg == I915_FENCE_REG_NONE); | ||
1479 | 1473 | ||
1474 | if (obj->fenced_gpu_access) { | ||
1480 | obj->last_fenced_seqno = seqno; | 1475 | obj->last_fenced_seqno = seqno; |
1481 | obj->last_fenced_ring = ring; | 1476 | obj->last_fenced_ring = ring; |
1482 | 1477 | ||
1483 | reg = &dev_priv->fence_regs[obj->fence_reg]; | 1478 | /* Bump MRU to take account of the delayed flush */ |
1484 | list_move_tail(®->lru_list, &dev_priv->mm.fence_list); | 1479 | if (obj->fence_reg != I915_FENCE_REG_NONE) { |
1480 | struct drm_i915_fence_reg *reg; | ||
1481 | |||
1482 | reg = &dev_priv->fence_regs[obj->fence_reg]; | ||
1483 | list_move_tail(®->lru_list, | ||
1484 | &dev_priv->mm.fence_list); | ||
1485 | } | ||
1485 | } | 1486 | } |
1486 | } | 1487 | } |
1487 | 1488 | ||
@@ -1490,6 +1491,7 @@ i915_gem_object_move_off_active(struct drm_i915_gem_object *obj) | |||
1490 | { | 1491 | { |
1491 | list_del_init(&obj->ring_list); | 1492 | list_del_init(&obj->ring_list); |
1492 | obj->last_rendering_seqno = 0; | 1493 | obj->last_rendering_seqno = 0; |
1494 | obj->last_fenced_seqno = 0; | ||
1493 | } | 1495 | } |
1494 | 1496 | ||
1495 | static void | 1497 | static void |
@@ -1518,6 +1520,7 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj) | |||
1518 | BUG_ON(!list_empty(&obj->gpu_write_list)); | 1520 | BUG_ON(!list_empty(&obj->gpu_write_list)); |
1519 | BUG_ON(!obj->active); | 1521 | BUG_ON(!obj->active); |
1520 | obj->ring = NULL; | 1522 | obj->ring = NULL; |
1523 | obj->last_fenced_ring = NULL; | ||
1521 | 1524 | ||
1522 | i915_gem_object_move_off_active(obj); | 1525 | i915_gem_object_move_off_active(obj); |
1523 | obj->fenced_gpu_access = false; | 1526 | obj->fenced_gpu_access = false; |
@@ -3754,12 +3757,32 @@ void i915_gem_init_ppgtt(struct drm_device *dev) | |||
3754 | drm_i915_private_t *dev_priv = dev->dev_private; | 3757 | drm_i915_private_t *dev_priv = dev->dev_private; |
3755 | uint32_t pd_offset; | 3758 | uint32_t pd_offset; |
3756 | struct intel_ring_buffer *ring; | 3759 | struct intel_ring_buffer *ring; |
3760 | struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt; | ||
3761 | uint32_t __iomem *pd_addr; | ||
3762 | uint32_t pd_entry; | ||
3757 | int i; | 3763 | int i; |
3758 | 3764 | ||
3759 | if (!dev_priv->mm.aliasing_ppgtt) | 3765 | if (!dev_priv->mm.aliasing_ppgtt) |
3760 | return; | 3766 | return; |
3761 | 3767 | ||
3762 | pd_offset = dev_priv->mm.aliasing_ppgtt->pd_offset; | 3768 | |
3769 | pd_addr = dev_priv->mm.gtt->gtt + ppgtt->pd_offset/sizeof(uint32_t); | ||
3770 | for (i = 0; i < ppgtt->num_pd_entries; i++) { | ||
3771 | dma_addr_t pt_addr; | ||
3772 | |||
3773 | if (dev_priv->mm.gtt->needs_dmar) | ||
3774 | pt_addr = ppgtt->pt_dma_addr[i]; | ||
3775 | else | ||
3776 | pt_addr = page_to_phys(ppgtt->pt_pages[i]); | ||
3777 | |||
3778 | pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr); | ||
3779 | pd_entry |= GEN6_PDE_VALID; | ||
3780 | |||
3781 | writel(pd_entry, pd_addr + i); | ||
3782 | } | ||
3783 | readl(pd_addr); | ||
3784 | |||
3785 | pd_offset = ppgtt->pd_offset; | ||
3763 | pd_offset /= 64; /* in cachelines, */ | 3786 | pd_offset /= 64; /* in cachelines, */ |
3764 | pd_offset <<= 16; | 3787 | pd_offset <<= 16; |
3765 | 3788 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 81687af00893..de431942ded4 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -498,8 +498,8 @@ pin_and_fence_object(struct drm_i915_gem_object *obj, | |||
498 | if (ret) | 498 | if (ret) |
499 | goto err_unpin; | 499 | goto err_unpin; |
500 | } | 500 | } |
501 | obj->pending_fenced_gpu_access = true; | ||
501 | } | 502 | } |
502 | obj->pending_fenced_gpu_access = need_fence; | ||
503 | } | 503 | } |
504 | 504 | ||
505 | entry->offset = obj->gtt_offset; | 505 | entry->offset = obj->gtt_offset; |
@@ -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_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 2eacd78bb93b..a135c61f4119 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -65,9 +65,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) | |||
65 | { | 65 | { |
66 | struct drm_i915_private *dev_priv = dev->dev_private; | 66 | struct drm_i915_private *dev_priv = dev->dev_private; |
67 | struct i915_hw_ppgtt *ppgtt; | 67 | struct i915_hw_ppgtt *ppgtt; |
68 | uint32_t pd_entry; | ||
69 | unsigned first_pd_entry_in_global_pt; | 68 | unsigned first_pd_entry_in_global_pt; |
70 | uint32_t __iomem *pd_addr; | ||
71 | int i; | 69 | int i; |
72 | int ret = -ENOMEM; | 70 | int ret = -ENOMEM; |
73 | 71 | ||
@@ -100,7 +98,6 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) | |||
100 | goto err_pt_alloc; | 98 | goto err_pt_alloc; |
101 | } | 99 | } |
102 | 100 | ||
103 | pd_addr = dev_priv->mm.gtt->gtt + first_pd_entry_in_global_pt; | ||
104 | for (i = 0; i < ppgtt->num_pd_entries; i++) { | 101 | for (i = 0; i < ppgtt->num_pd_entries; i++) { |
105 | dma_addr_t pt_addr; | 102 | dma_addr_t pt_addr; |
106 | if (dev_priv->mm.gtt->needs_dmar) { | 103 | if (dev_priv->mm.gtt->needs_dmar) { |
@@ -117,13 +114,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) | |||
117 | ppgtt->pt_dma_addr[i] = pt_addr; | 114 | ppgtt->pt_dma_addr[i] = pt_addr; |
118 | } else | 115 | } else |
119 | pt_addr = page_to_phys(ppgtt->pt_pages[i]); | 116 | pt_addr = page_to_phys(ppgtt->pt_pages[i]); |
120 | |||
121 | pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr); | ||
122 | pd_entry |= GEN6_PDE_VALID; | ||
123 | |||
124 | writel(pd_entry, pd_addr + i); | ||
125 | } | 117 | } |
126 | readl(pd_addr); | ||
127 | 118 | ||
128 | ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma; | 119 | ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma; |
129 | 120 | ||
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 3886cf051bac..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) |
@@ -2385,6 +2386,7 @@ | |||
2385 | #define PIPECONF_DISABLE 0 | 2386 | #define PIPECONF_DISABLE 0 |
2386 | #define PIPECONF_DOUBLE_WIDE (1<<30) | 2387 | #define PIPECONF_DOUBLE_WIDE (1<<30) |
2387 | #define I965_PIPECONF_ACTIVE (1<<30) | 2388 | #define I965_PIPECONF_ACTIVE (1<<30) |
2389 | #define PIPECONF_FRAME_START_DELAY_MASK (3<<27) | ||
2388 | #define PIPECONF_SINGLE_WIDE 0 | 2390 | #define PIPECONF_SINGLE_WIDE 0 |
2389 | #define PIPECONF_PIPE_UNLOCKED 0 | 2391 | #define PIPECONF_PIPE_UNLOCKED 0 |
2390 | #define PIPECONF_PIPE_LOCKED (1<<25) | 2392 | #define PIPECONF_PIPE_LOCKED (1<<25) |
@@ -3727,6 +3729,9 @@ | |||
3727 | #define GT_FIFO_FREE_ENTRIES 0x120008 | 3729 | #define GT_FIFO_FREE_ENTRIES 0x120008 |
3728 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 | 3730 | #define GT_FIFO_NUM_RESERVED_ENTRIES 20 |
3729 | 3731 | ||
3732 | #define GEN6_UCGCTL1 0x9400 | ||
3733 | # define GEN6_BLBUNIT_CLOCK_GATE_DISABLE (1 << 5) | ||
3734 | |||
3730 | #define GEN6_UCGCTL2 0x9404 | 3735 | #define GEN6_UCGCTL2 0x9404 |
3731 | # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13) | 3736 | # define GEN6_RCZUNIT_CLOCK_GATE_DISABLE (1 << 13) |
3732 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) | 3737 | # define GEN6_RCPBUNIT_CLOCK_GATE_DISABLE (1 << 12) |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 8168d8f8a634..b48fc2a8410c 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -24,6 +24,7 @@ | |||
24 | * Eric Anholt <eric@anholt.net> | 24 | * Eric Anholt <eric@anholt.net> |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #include <linux/dmi.h> | ||
27 | #include <drm/drm_dp_helper.h> | 28 | #include <drm/drm_dp_helper.h> |
28 | #include "drmP.h" | 29 | #include "drmP.h" |
29 | #include "drm.h" | 30 | #include "drm.h" |
@@ -621,6 +622,26 @@ init_vbt_defaults(struct drm_i915_private *dev_priv) | |||
621 | dev_priv->edp.bpp = 18; | 622 | dev_priv->edp.bpp = 18; |
622 | } | 623 | } |
623 | 624 | ||
625 | static int __init intel_no_opregion_vbt_callback(const struct dmi_system_id *id) | ||
626 | { | ||
627 | DRM_DEBUG_KMS("Falling back to manually reading VBT from " | ||
628 | "VBIOS ROM for %s\n", | ||
629 | id->ident); | ||
630 | return 1; | ||
631 | } | ||
632 | |||
633 | static const struct dmi_system_id intel_no_opregion_vbt[] = { | ||
634 | { | ||
635 | .callback = intel_no_opregion_vbt_callback, | ||
636 | .ident = "ThinkCentre A57", | ||
637 | .matches = { | ||
638 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
639 | DMI_MATCH(DMI_PRODUCT_NAME, "97027RG"), | ||
640 | }, | ||
641 | }, | ||
642 | { } | ||
643 | }; | ||
644 | |||
624 | /** | 645 | /** |
625 | * intel_parse_bios - find VBT and initialize settings from the BIOS | 646 | * intel_parse_bios - find VBT and initialize settings from the BIOS |
626 | * @dev: DRM device | 647 | * @dev: DRM device |
@@ -641,7 +662,7 @@ intel_parse_bios(struct drm_device *dev) | |||
641 | init_vbt_defaults(dev_priv); | 662 | init_vbt_defaults(dev_priv); |
642 | 663 | ||
643 | /* XXX Should this validation be moved to intel_opregion.c? */ | 664 | /* XXX Should this validation be moved to intel_opregion.c? */ |
644 | if (dev_priv->opregion.vbt) { | 665 | if (!dmi_check_system(intel_no_opregion_vbt) && dev_priv->opregion.vbt) { |
645 | struct vbt_header *vbt = dev_priv->opregion.vbt; | 666 | struct vbt_header *vbt = dev_priv->opregion.vbt; |
646 | if (memcmp(vbt->signature, "$VBT", 4) == 0) { | 667 | if (memcmp(vbt->signature, "$VBT", 4) == 0) { |
647 | DRM_DEBUG_KMS("Using VBT from OpRegion: %20s\n", | 668 | DRM_DEBUG_KMS("Using VBT from OpRegion: %20s\n", |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 4d3d736a4f56..90b9793fd5da 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -430,8 +430,8 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
430 | { | 430 | { |
431 | struct drm_device *dev = connector->dev; | 431 | struct drm_device *dev = connector->dev; |
432 | struct intel_crt *crt = intel_attached_crt(connector); | 432 | struct intel_crt *crt = intel_attached_crt(connector); |
433 | struct drm_crtc *crtc; | ||
434 | enum drm_connector_status status; | 433 | enum drm_connector_status status; |
434 | struct intel_load_detect_pipe tmp; | ||
435 | 435 | ||
436 | if (I915_HAS_HOTPLUG(dev)) { | 436 | if (I915_HAS_HOTPLUG(dev)) { |
437 | if (intel_crt_detect_hotplug(connector)) { | 437 | if (intel_crt_detect_hotplug(connector)) { |
@@ -450,23 +450,16 @@ intel_crt_detect(struct drm_connector *connector, bool force) | |||
450 | return connector->status; | 450 | return connector->status; |
451 | 451 | ||
452 | /* for pre-945g platforms use load detect */ | 452 | /* for pre-945g platforms use load detect */ |
453 | crtc = crt->base.base.crtc; | 453 | if (intel_get_load_detect_pipe(&crt->base, connector, NULL, |
454 | if (crtc && crtc->enabled) { | 454 | &tmp)) { |
455 | status = intel_crt_load_detect(crt); | 455 | if (intel_crt_detect_ddc(connector)) |
456 | } else { | 456 | status = connector_status_connected; |
457 | struct intel_load_detect_pipe tmp; | 457 | else |
458 | 458 | status = intel_crt_load_detect(crt); | |
459 | if (intel_get_load_detect_pipe(&crt->base, connector, NULL, | 459 | intel_release_load_detect_pipe(&crt->base, connector, |
460 | &tmp)) { | 460 | &tmp); |
461 | if (intel_crt_detect_ddc(connector)) | 461 | } else |
462 | status = connector_status_connected; | 462 | status = connector_status_unknown; |
463 | else | ||
464 | status = intel_crt_load_detect(crt); | ||
465 | intel_release_load_detect_pipe(&crt->base, connector, | ||
466 | &tmp); | ||
467 | } else | ||
468 | status = connector_status_unknown; | ||
469 | } | ||
470 | 463 | ||
471 | return status; | 464 | return status; |
472 | } | 465 | } |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d514719f65e2..1b1cf3b3ff51 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2245,6 +2245,33 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, | |||
2245 | } | 2245 | } |
2246 | 2246 | ||
2247 | static int | 2247 | static int |
2248 | intel_finish_fb(struct drm_framebuffer *old_fb) | ||
2249 | { | ||
2250 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | ||
2251 | struct drm_i915_private *dev_priv = obj->base.dev->dev_private; | ||
2252 | bool was_interruptible = dev_priv->mm.interruptible; | ||
2253 | int ret; | ||
2254 | |||
2255 | wait_event(dev_priv->pending_flip_queue, | ||
2256 | atomic_read(&dev_priv->mm.wedged) || | ||
2257 | atomic_read(&obj->pending_flip) == 0); | ||
2258 | |||
2259 | /* Big Hammer, we also need to ensure that any pending | ||
2260 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | ||
2261 | * current scanout is retired before unpinning the old | ||
2262 | * framebuffer. | ||
2263 | * | ||
2264 | * This should only fail upon a hung GPU, in which case we | ||
2265 | * can safely continue. | ||
2266 | */ | ||
2267 | dev_priv->mm.interruptible = false; | ||
2268 | ret = i915_gem_object_finish_gpu(obj); | ||
2269 | dev_priv->mm.interruptible = was_interruptible; | ||
2270 | |||
2271 | return ret; | ||
2272 | } | ||
2273 | |||
2274 | static int | ||
2248 | intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | 2275 | intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, |
2249 | struct drm_framebuffer *old_fb) | 2276 | struct drm_framebuffer *old_fb) |
2250 | { | 2277 | { |
@@ -2282,25 +2309,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
2282 | return ret; | 2309 | return ret; |
2283 | } | 2310 | } |
2284 | 2311 | ||
2285 | if (old_fb) { | 2312 | if (old_fb) |
2286 | struct drm_i915_private *dev_priv = dev->dev_private; | 2313 | intel_finish_fb(old_fb); |
2287 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | ||
2288 | |||
2289 | wait_event(dev_priv->pending_flip_queue, | ||
2290 | atomic_read(&dev_priv->mm.wedged) || | ||
2291 | atomic_read(&obj->pending_flip) == 0); | ||
2292 | |||
2293 | /* Big Hammer, we also need to ensure that any pending | ||
2294 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | ||
2295 | * current scanout is retired before unpinning the old | ||
2296 | * framebuffer. | ||
2297 | * | ||
2298 | * This should only fail upon a hung GPU, in which case we | ||
2299 | * can safely continue. | ||
2300 | */ | ||
2301 | ret = i915_gem_object_finish_gpu(obj); | ||
2302 | (void) ret; | ||
2303 | } | ||
2304 | 2314 | ||
2305 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 2315 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, |
2306 | LEAVE_ATOMIC_MODE_SET); | 2316 | LEAVE_ATOMIC_MODE_SET); |
@@ -3371,6 +3381,23 @@ static void intel_crtc_disable(struct drm_crtc *crtc) | |||
3371 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; | 3381 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; |
3372 | struct drm_device *dev = crtc->dev; | 3382 | struct drm_device *dev = crtc->dev; |
3373 | 3383 | ||
3384 | /* Flush any pending WAITs before we disable the pipe. Note that | ||
3385 | * we need to drop the struct_mutex in order to acquire it again | ||
3386 | * during the lowlevel dpms routines around a couple of the | ||
3387 | * operations. It does not look trivial nor desirable to move | ||
3388 | * that locking higher. So instead we leave a window for the | ||
3389 | * submission of further commands on the fb before we can actually | ||
3390 | * disable it. This race with userspace exists anyway, and we can | ||
3391 | * only rely on the pipe being disabled by userspace after it | ||
3392 | * receives the hotplug notification and has flushed any pending | ||
3393 | * batches. | ||
3394 | */ | ||
3395 | if (crtc->fb) { | ||
3396 | mutex_lock(&dev->struct_mutex); | ||
3397 | intel_finish_fb(crtc->fb); | ||
3398 | mutex_unlock(&dev->struct_mutex); | ||
3399 | } | ||
3400 | |||
3374 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); | 3401 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); |
3375 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); | 3402 | assert_plane_disabled(dev->dev_private, to_intel_crtc(crtc)->plane); |
3376 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); | 3403 | assert_pipe_disabled(dev->dev_private, to_intel_crtc(crtc)->pipe); |
@@ -3451,8 +3478,11 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, | |||
3451 | return false; | 3478 | return false; |
3452 | } | 3479 | } |
3453 | 3480 | ||
3454 | /* All interlaced capable intel hw wants timings in frames. */ | 3481 | /* All interlaced capable intel hw wants timings in frames. Note though |
3455 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 3482 | * that intel_lvds_mode_fixup does some funny tricks with the crtc |
3483 | * timings, so we need to be careful not to clobber these.*/ | ||
3484 | if (!(adjusted_mode->private_flags & INTEL_MODE_CRTC_TIMINGS_SET)) | ||
3485 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
3456 | 3486 | ||
3457 | return true; | 3487 | return true; |
3458 | } | 3488 | } |
@@ -5539,7 +5569,8 @@ void ironlake_init_pch_refclk(struct drm_device *dev) | |||
5539 | if (intel_panel_use_ssc(dev_priv) && can_ssc) { | 5569 | if (intel_panel_use_ssc(dev_priv) && can_ssc) { |
5540 | DRM_DEBUG_KMS("Using SSC on panel\n"); | 5570 | DRM_DEBUG_KMS("Using SSC on panel\n"); |
5541 | temp |= DREF_SSC1_ENABLE; | 5571 | temp |= DREF_SSC1_ENABLE; |
5542 | } | 5572 | } else |
5573 | temp &= ~DREF_SSC1_ENABLE; | ||
5543 | 5574 | ||
5544 | /* Get SSC going before enabling the outputs */ | 5575 | /* Get SSC going before enabling the outputs */ |
5545 | I915_WRITE(PCH_DREF_CONTROL, temp); | 5576 | I915_WRITE(PCH_DREF_CONTROL, temp); |
@@ -7041,9 +7072,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7041 | struct drm_device *dev = crtc->dev; | 7072 | struct drm_device *dev = crtc->dev; |
7042 | drm_i915_private_t *dev_priv = dev->dev_private; | 7073 | drm_i915_private_t *dev_priv = dev->dev_private; |
7043 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 7074 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
7044 | int pipe = intel_crtc->pipe; | ||
7045 | int dpll_reg = DPLL(pipe); | ||
7046 | int dpll = I915_READ(dpll_reg); | ||
7047 | 7075 | ||
7048 | if (HAS_PCH_SPLIT(dev)) | 7076 | if (HAS_PCH_SPLIT(dev)) |
7049 | return; | 7077 | return; |
@@ -7056,10 +7084,15 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7056 | * the manual case. | 7084 | * the manual case. |
7057 | */ | 7085 | */ |
7058 | if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { | 7086 | if (!HAS_PIPE_CXSR(dev) && intel_crtc->lowfreq_avail) { |
7087 | int pipe = intel_crtc->pipe; | ||
7088 | int dpll_reg = DPLL(pipe); | ||
7089 | u32 dpll; | ||
7090 | |||
7059 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); | 7091 | DRM_DEBUG_DRIVER("downclocking LVDS\n"); |
7060 | 7092 | ||
7061 | assert_panel_unlocked(dev_priv, pipe); | 7093 | assert_panel_unlocked(dev_priv, pipe); |
7062 | 7094 | ||
7095 | dpll = I915_READ(dpll_reg); | ||
7063 | dpll |= DISPLAY_RATE_SELECT_FPA1; | 7096 | dpll |= DISPLAY_RATE_SELECT_FPA1; |
7064 | I915_WRITE(dpll_reg, dpll); | 7097 | I915_WRITE(dpll_reg, dpll); |
7065 | intel_wait_for_vblank(dev, pipe); | 7098 | intel_wait_for_vblank(dev, pipe); |
@@ -7067,7 +7100,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc) | |||
7067 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) | 7100 | if (!(dpll & DISPLAY_RATE_SELECT_FPA1)) |
7068 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); | 7101 | DRM_DEBUG_DRIVER("failed to downclock LVDS!\n"); |
7069 | } | 7102 | } |
7070 | |||
7071 | } | 7103 | } |
7072 | 7104 | ||
7073 | /** | 7105 | /** |
@@ -7437,7 +7469,13 @@ static int intel_gen6_queue_flip(struct drm_device *dev, | |||
7437 | OUT_RING(fb->pitches[0] | obj->tiling_mode); | 7469 | OUT_RING(fb->pitches[0] | obj->tiling_mode); |
7438 | OUT_RING(obj->gtt_offset); | 7470 | OUT_RING(obj->gtt_offset); |
7439 | 7471 | ||
7440 | pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; | 7472 | /* Contrary to the suggestions in the documentation, |
7473 | * "Enable Panel Fitter" does not seem to be required when page | ||
7474 | * flipping with a non-native mode, and worse causes a normal | ||
7475 | * modeset to fail. | ||
7476 | * pf = I915_READ(PF_CTL(intel_crtc->pipe)) & PF_ENABLE; | ||
7477 | */ | ||
7478 | pf = 0; | ||
7441 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; | 7479 | pipesrc = I915_READ(PIPESRC(intel_crtc->pipe)) & 0x0fff0fff; |
7442 | OUT_RING(pf | pipesrc); | 7480 | OUT_RING(pf | pipesrc); |
7443 | ADVANCE_LP_RING(); | 7481 | ADVANCE_LP_RING(); |
@@ -7580,6 +7618,12 @@ static void intel_sanitize_modesetting(struct drm_device *dev, | |||
7580 | struct drm_i915_private *dev_priv = dev->dev_private; | 7618 | struct drm_i915_private *dev_priv = dev->dev_private; |
7581 | u32 reg, val; | 7619 | u32 reg, val; |
7582 | 7620 | ||
7621 | /* Clear any frame start delays used for debugging left by the BIOS */ | ||
7622 | for_each_pipe(pipe) { | ||
7623 | reg = PIPECONF(pipe); | ||
7624 | I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK); | ||
7625 | } | ||
7626 | |||
7583 | if (HAS_PCH_SPLIT(dev)) | 7627 | if (HAS_PCH_SPLIT(dev)) |
7584 | return; | 7628 | return; |
7585 | 7629 | ||
@@ -8215,7 +8259,7 @@ void intel_init_emon(struct drm_device *dev) | |||
8215 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); | 8259 | dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK); |
8216 | } | 8260 | } |
8217 | 8261 | ||
8218 | static bool intel_enable_rc6(struct drm_device *dev) | 8262 | static int intel_enable_rc6(struct drm_device *dev) |
8219 | { | 8263 | { |
8220 | /* | 8264 | /* |
8221 | * Respect the kernel parameter if it is set | 8265 | * Respect the kernel parameter if it is set |
@@ -8233,11 +8277,11 @@ static bool intel_enable_rc6(struct drm_device *dev) | |||
8233 | * Disable rc6 on Sandybridge | 8277 | * Disable rc6 on Sandybridge |
8234 | */ | 8278 | */ |
8235 | if (INTEL_INFO(dev)->gen == 6) { | 8279 | if (INTEL_INFO(dev)->gen == 6) { |
8236 | DRM_DEBUG_DRIVER("Sandybridge: RC6 disabled\n"); | 8280 | DRM_DEBUG_DRIVER("Sandybridge: deep RC6 disabled\n"); |
8237 | return 0; | 8281 | return INTEL_RC6_ENABLE; |
8238 | } | 8282 | } |
8239 | DRM_DEBUG_DRIVER("RC6 enabled\n"); | 8283 | DRM_DEBUG_DRIVER("RC6 and deep RC6 enabled\n"); |
8240 | return 1; | 8284 | return (INTEL_RC6_ENABLE | INTEL_RC6p_ENABLE); |
8241 | } | 8285 | } |
8242 | 8286 | ||
8243 | void gen6_enable_rps(struct drm_i915_private *dev_priv) | 8287 | void gen6_enable_rps(struct drm_i915_private *dev_priv) |
@@ -8247,6 +8291,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
8247 | u32 pcu_mbox, rc6_mask = 0; | 8291 | u32 pcu_mbox, rc6_mask = 0; |
8248 | u32 gtfifodbg; | 8292 | u32 gtfifodbg; |
8249 | int cur_freq, min_freq, max_freq; | 8293 | int cur_freq, min_freq, max_freq; |
8294 | int rc6_mode; | ||
8250 | int i; | 8295 | int i; |
8251 | 8296 | ||
8252 | /* Here begins a magic sequence of register writes to enable | 8297 | /* Here begins a magic sequence of register writes to enable |
@@ -8284,9 +8329,20 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
8284 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); | 8329 | I915_WRITE(GEN6_RC6p_THRESHOLD, 100000); |
8285 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ | 8330 | I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */ |
8286 | 8331 | ||
8287 | if (intel_enable_rc6(dev_priv->dev)) | 8332 | rc6_mode = intel_enable_rc6(dev_priv->dev); |
8288 | rc6_mask = GEN6_RC_CTL_RC6_ENABLE | | 8333 | if (rc6_mode & INTEL_RC6_ENABLE) |
8289 | ((IS_GEN7(dev_priv->dev)) ? GEN6_RC_CTL_RC6p_ENABLE : 0); | 8334 | rc6_mask |= GEN6_RC_CTL_RC6_ENABLE; |
8335 | |||
8336 | if (rc6_mode & INTEL_RC6p_ENABLE) | ||
8337 | rc6_mask |= GEN6_RC_CTL_RC6p_ENABLE; | ||
8338 | |||
8339 | if (rc6_mode & INTEL_RC6pp_ENABLE) | ||
8340 | rc6_mask |= GEN6_RC_CTL_RC6pp_ENABLE; | ||
8341 | |||
8342 | DRM_INFO("Enabling RC6 states: RC6 %s, RC6p %s, RC6pp %s\n", | ||
8343 | (rc6_mode & INTEL_RC6_ENABLE) ? "on" : "off", | ||
8344 | (rc6_mode & INTEL_RC6p_ENABLE) ? "on" : "off", | ||
8345 | (rc6_mode & INTEL_RC6pp_ENABLE) ? "on" : "off"); | ||
8290 | 8346 | ||
8291 | I915_WRITE(GEN6_RC_CONTROL, | 8347 | I915_WRITE(GEN6_RC_CONTROL, |
8292 | rc6_mask | | 8348 | rc6_mask | |
@@ -8510,6 +8566,10 @@ static void gen6_init_clock_gating(struct drm_device *dev) | |||
8510 | I915_WRITE(WM2_LP_ILK, 0); | 8566 | I915_WRITE(WM2_LP_ILK, 0); |
8511 | I915_WRITE(WM1_LP_ILK, 0); | 8567 | I915_WRITE(WM1_LP_ILK, 0); |
8512 | 8568 | ||
8569 | I915_WRITE(GEN6_UCGCTL1, | ||
8570 | I915_READ(GEN6_UCGCTL1) | | ||
8571 | GEN6_BLBUNIT_CLOCK_GATE_DISABLE); | ||
8572 | |||
8513 | /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock | 8573 | /* According to the BSpec vol1g, bit 12 (RCPBUNIT) clock |
8514 | * gating disable must be set. Failure to set it results in | 8574 | * gating disable must be set. Failure to set it results in |
8515 | * flickering pixels due to Z write ordering failures after | 8575 | * flickering pixels due to Z write ordering failures after |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 110552ff302c..4b637919f74f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -219,14 +219,38 @@ intel_dp_max_data_rate(int max_link_clock, int max_lanes) | |||
219 | return (max_link_clock * max_lanes * 8) / 10; | 219 | return (max_link_clock * max_lanes * 8) / 10; |
220 | } | 220 | } |
221 | 221 | ||
222 | static bool | ||
223 | intel_dp_adjust_dithering(struct intel_dp *intel_dp, | ||
224 | struct drm_display_mode *mode, | ||
225 | struct drm_display_mode *adjusted_mode) | ||
226 | { | ||
227 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | ||
228 | int max_lanes = intel_dp_max_lane_count(intel_dp); | ||
229 | int max_rate, mode_rate; | ||
230 | |||
231 | mode_rate = intel_dp_link_required(mode->clock, 24); | ||
232 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); | ||
233 | |||
234 | if (mode_rate > max_rate) { | ||
235 | mode_rate = intel_dp_link_required(mode->clock, 18); | ||
236 | if (mode_rate > max_rate) | ||
237 | return false; | ||
238 | |||
239 | if (adjusted_mode) | ||
240 | adjusted_mode->private_flags | ||
241 | |= INTEL_MODE_DP_FORCE_6BPC; | ||
242 | |||
243 | return true; | ||
244 | } | ||
245 | |||
246 | return true; | ||
247 | } | ||
248 | |||
222 | static int | 249 | static int |
223 | intel_dp_mode_valid(struct drm_connector *connector, | 250 | intel_dp_mode_valid(struct drm_connector *connector, |
224 | struct drm_display_mode *mode) | 251 | struct drm_display_mode *mode) |
225 | { | 252 | { |
226 | struct intel_dp *intel_dp = intel_attached_dp(connector); | 253 | struct intel_dp *intel_dp = intel_attached_dp(connector); |
227 | int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_dp)); | ||
228 | int max_lanes = intel_dp_max_lane_count(intel_dp); | ||
229 | int max_rate, mode_rate; | ||
230 | 254 | ||
231 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 255 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
232 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) | 256 | if (mode->hdisplay > intel_dp->panel_fixed_mode->hdisplay) |
@@ -236,16 +260,8 @@ intel_dp_mode_valid(struct drm_connector *connector, | |||
236 | return MODE_PANEL; | 260 | return MODE_PANEL; |
237 | } | 261 | } |
238 | 262 | ||
239 | mode_rate = intel_dp_link_required(mode->clock, 24); | 263 | if (!intel_dp_adjust_dithering(intel_dp, mode, NULL)) |
240 | max_rate = intel_dp_max_data_rate(max_link_clock, max_lanes); | 264 | return MODE_CLOCK_HIGH; |
241 | |||
242 | if (mode_rate > max_rate) { | ||
243 | mode_rate = intel_dp_link_required(mode->clock, 18); | ||
244 | if (mode_rate > max_rate) | ||
245 | return MODE_CLOCK_HIGH; | ||
246 | else | ||
247 | mode->private_flags |= INTEL_MODE_DP_FORCE_6BPC; | ||
248 | } | ||
249 | 265 | ||
250 | if (mode->clock < 10000) | 266 | if (mode->clock < 10000) |
251 | return MODE_CLOCK_LOW; | 267 | return MODE_CLOCK_LOW; |
@@ -672,7 +688,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
672 | int lane_count, clock; | 688 | int lane_count, clock; |
673 | int max_lane_count = intel_dp_max_lane_count(intel_dp); | 689 | int max_lane_count = intel_dp_max_lane_count(intel_dp); |
674 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; | 690 | int max_clock = intel_dp_max_link_bw(intel_dp) == DP_LINK_BW_2_7 ? 1 : 0; |
675 | int bpp = mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; | 691 | int bpp; |
676 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; | 692 | static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; |
677 | 693 | ||
678 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { | 694 | if (is_edp(intel_dp) && intel_dp->panel_fixed_mode) { |
@@ -686,6 +702,11 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
686 | mode->clock = intel_dp->panel_fixed_mode->clock; | 702 | mode->clock = intel_dp->panel_fixed_mode->clock; |
687 | } | 703 | } |
688 | 704 | ||
705 | if (!intel_dp_adjust_dithering(intel_dp, mode, adjusted_mode)) | ||
706 | return false; | ||
707 | |||
708 | bpp = adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC ? 18 : 24; | ||
709 | |||
689 | for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { | 710 | for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { |
690 | for (clock = 0; clock <= max_clock; clock++) { | 711 | for (clock = 0; clock <= max_clock; clock++) { |
691 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); | 712 | int link_avail = intel_dp_max_data_rate(intel_dp_link_clock(bws[clock]), lane_count); |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 5a14149b3794..715afa153025 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -105,6 +105,10 @@ | |||
105 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) | 105 | #define INTEL_MODE_PIXEL_MULTIPLIER_SHIFT (0x0) |
106 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) | 106 | #define INTEL_MODE_PIXEL_MULTIPLIER_MASK (0xf << INTEL_MODE_PIXEL_MULTIPLIER_SHIFT) |
107 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) | 107 | #define INTEL_MODE_DP_FORCE_6BPC (0x10) |
108 | /* This flag must be set by the encoder's mode_fixup if it changes the crtc | ||
109 | * timings in the mode to prevent the crtc fixup from overwriting them. | ||
110 | * Currently only lvds needs that. */ | ||
111 | #define INTEL_MODE_CRTC_TIMINGS_SET (0x20) | ||
108 | 112 | ||
109 | static inline void | 113 | static inline void |
110 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, | 114 | intel_mode_set_pixel_multiplier(struct drm_display_mode *mode, |
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 19ecd78b8a2c..6e9ee33fd412 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -279,6 +279,8 @@ void intel_fb_restore_mode(struct drm_device *dev) | |||
279 | struct drm_mode_config *config = &dev->mode_config; | 279 | struct drm_mode_config *config = &dev->mode_config; |
280 | struct drm_plane *plane; | 280 | struct drm_plane *plane; |
281 | 281 | ||
282 | mutex_lock(&dev->mode_config.mutex); | ||
283 | |||
282 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); | 284 | ret = drm_fb_helper_restore_fbdev_mode(&dev_priv->fbdev->helper); |
283 | if (ret) | 285 | if (ret) |
284 | DRM_DEBUG("failed to restore crtc mode\n"); | 286 | DRM_DEBUG("failed to restore crtc mode\n"); |
@@ -286,4 +288,6 @@ void intel_fb_restore_mode(struct drm_device *dev) | |||
286 | /* Be sure to shut off any planes that may be active */ | 288 | /* Be sure to shut off any planes that may be active */ |
287 | list_for_each_entry(plane, &config->plane_list, head) | 289 | list_for_each_entry(plane, &config->plane_list, head) |
288 | plane->funcs->disable_plane(plane); | 290 | plane->funcs->disable_plane(plane); |
291 | |||
292 | mutex_unlock(&dev->mode_config.mutex); | ||
289 | } | 293 | } |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index cae3e5f17a49..2d7f47b56b6a 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -136,7 +136,7 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder, | |||
136 | 136 | ||
137 | val &= ~VIDEO_DIP_SELECT_MASK; | 137 | val &= ~VIDEO_DIP_SELECT_MASK; |
138 | 138 | ||
139 | I915_WRITE(VIDEO_DIP_CTL, val | port | flags); | 139 | I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); |
140 | 140 | ||
141 | for (i = 0; i < len; i += 4) { | 141 | for (i = 0; i < len; i += 4) { |
142 | I915_WRITE(VIDEO_DIP_DATA, *data); | 142 | I915_WRITE(VIDEO_DIP_DATA, *data); |
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c index 601c86e664af..8fdc95700218 100644 --- a/drivers/gpu/drm/i915/intel_i2c.c +++ b/drivers/gpu/drm/i915/intel_i2c.c | |||
@@ -390,7 +390,7 @@ int intel_setup_gmbus(struct drm_device *dev) | |||
390 | bus->has_gpio = intel_gpio_setup(bus, i); | 390 | bus->has_gpio = intel_gpio_setup(bus, i); |
391 | 391 | ||
392 | /* XXX force bit banging until GMBUS is fully debugged */ | 392 | /* XXX force bit banging until GMBUS is fully debugged */ |
393 | if (bus->has_gpio && IS_GEN2(dev)) | 393 | if (bus->has_gpio) |
394 | bus->force_bit = true; | 394 | bus->force_bit = true; |
395 | } | 395 | } |
396 | 396 | ||
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index c5c0973af8a1..9c71183629c2 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -187,6 +187,8 @@ centre_horizontally(struct drm_display_mode *mode, | |||
187 | 187 | ||
188 | mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; | 188 | mode->crtc_hsync_start = mode->crtc_hblank_start + sync_pos; |
189 | mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; | 189 | mode->crtc_hsync_end = mode->crtc_hsync_start + sync_width; |
190 | |||
191 | mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET; | ||
190 | } | 192 | } |
191 | 193 | ||
192 | static void | 194 | static void |
@@ -208,6 +210,8 @@ centre_vertically(struct drm_display_mode *mode, | |||
208 | 210 | ||
209 | mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; | 211 | mode->crtc_vsync_start = mode->crtc_vblank_start + sync_pos; |
210 | mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; | 212 | mode->crtc_vsync_end = mode->crtc_vsync_start + sync_width; |
213 | |||
214 | mode->private_flags |= INTEL_MODE_CRTC_TIMINGS_SET; | ||
211 | } | 215 | } |
212 | 216 | ||
213 | static inline u32 panel_fitter_scaling(u32 source, u32 target) | 217 | static inline u32 panel_fitter_scaling(u32 source, u32 target) |
@@ -283,6 +287,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
283 | for_each_pipe(pipe) | 287 | for_each_pipe(pipe) |
284 | I915_WRITE(BCLRPAT(pipe), 0); | 288 | I915_WRITE(BCLRPAT(pipe), 0); |
285 | 289 | ||
290 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
291 | |||
286 | switch (intel_lvds->fitting_mode) { | 292 | switch (intel_lvds->fitting_mode) { |
287 | case DRM_MODE_SCALE_CENTER: | 293 | case DRM_MODE_SCALE_CENTER: |
288 | /* | 294 | /* |
@@ -744,7 +750,7 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
744 | .ident = "Hewlett-Packard t5745", | 750 | .ident = "Hewlett-Packard t5745", |
745 | .matches = { | 751 | .matches = { |
746 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 752 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
747 | DMI_MATCH(DMI_BOARD_NAME, "hp t5745"), | 753 | DMI_MATCH(DMI_PRODUCT_NAME, "hp t5745"), |
748 | }, | 754 | }, |
749 | }, | 755 | }, |
750 | { | 756 | { |
@@ -752,7 +758,15 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
752 | .ident = "Hewlett-Packard st5747", | 758 | .ident = "Hewlett-Packard st5747", |
753 | .matches = { | 759 | .matches = { |
754 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), | 760 | DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), |
755 | DMI_MATCH(DMI_BOARD_NAME, "hp st5747"), | 761 | DMI_MATCH(DMI_PRODUCT_NAME, "hp st5747"), |
762 | }, | ||
763 | }, | ||
764 | { | ||
765 | .callback = intel_no_lvds_dmi_callback, | ||
766 | .ident = "MSI Wind Box DC500", | ||
767 | .matches = { | ||
768 | DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"), | ||
769 | DMI_MATCH(DMI_BOARD_NAME, "MS-7469"), | ||
756 | }, | 770 | }, |
757 | }, | 771 | }, |
758 | 772 | ||
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 230a141dbea3..48177ec4720e 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -47,8 +47,6 @@ intel_fixed_panel_mode(struct drm_display_mode *fixed_mode, | |||
47 | adjusted_mode->vtotal = fixed_mode->vtotal; | 47 | adjusted_mode->vtotal = fixed_mode->vtotal; |
48 | 48 | ||
49 | adjusted_mode->clock = fixed_mode->clock; | 49 | adjusted_mode->clock = fixed_mode->clock; |
50 | |||
51 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
52 | } | 50 | } |
53 | 51 | ||
54 | /* adjusted_mode has been preset to be the panel's fixed mode */ | 52 | /* adjusted_mode has been preset to be the panel's fixed mode */ |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index fc66af6a9448..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; |
@@ -626,7 +634,7 @@ gen6_ring_get_seqno(struct intel_ring_buffer *ring) | |||
626 | /* Workaround to force correct ordering between irq and seqno writes on | 634 | /* Workaround to force correct ordering between irq and seqno writes on |
627 | * ivb (and maybe also on snb) by reading from a CS register (like | 635 | * ivb (and maybe also on snb) by reading from a CS register (like |
628 | * ACTHD) before reading the status page. */ | 636 | * ACTHD) before reading the status page. */ |
629 | if (IS_GEN7(dev)) | 637 | if (IS_GEN6(dev) || IS_GEN7(dev)) |
630 | intel_ring_get_active_head(ring); | 638 | intel_ring_get_active_head(ring); |
631 | return intel_read_status_page(ring, I915_GEM_HWS_INDEX); | 639 | return intel_read_status_page(ring, I915_GEM_HWS_INDEX); |
632 | } | 640 | } |
@@ -1038,7 +1046,7 @@ int intel_init_ring_buffer(struct drm_device *dev, | |||
1038 | * of the buffer. | 1046 | * of the buffer. |
1039 | */ | 1047 | */ |
1040 | ring->effective_size = ring->size; | 1048 | ring->effective_size = ring->size; |
1041 | if (IS_I830(ring->dev)) | 1049 | if (IS_I830(ring->dev) || IS_845G(ring->dev)) |
1042 | ring->effective_size -= 128; | 1050 | ring->effective_size -= 128; |
1043 | 1051 | ||
1044 | return 0; | 1052 | return 0; |
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/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index 7aa0450399a1..e90dfb625c42 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -95,7 +95,6 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb, | |||
95 | /* must disable */ | 95 | /* must disable */ |
96 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; | 96 | sprctl |= SPRITE_TRICKLE_FEED_DISABLE; |
97 | sprctl |= SPRITE_ENABLE; | 97 | sprctl |= SPRITE_ENABLE; |
98 | sprctl |= SPRITE_DEST_KEY; | ||
99 | 98 | ||
100 | /* Sizes are 0 based */ | 99 | /* Sizes are 0 based */ |
101 | src_w--; | 100 | src_w--; |
@@ -411,6 +410,9 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, | |||
411 | 410 | ||
412 | old_obj = intel_plane->obj; | 411 | old_obj = intel_plane->obj; |
413 | 412 | ||
413 | src_w = src_w >> 16; | ||
414 | src_h = src_h >> 16; | ||
415 | |||
414 | /* Pipe must be running... */ | 416 | /* Pipe must be running... */ |
415 | if (!(I915_READ(PIPECONF(pipe)) & PIPECONF_ENABLE)) | 417 | if (!(I915_READ(PIPECONF(pipe)) & PIPECONF_ENABLE)) |
416 | return -EINVAL; | 418 | return -EINVAL; |
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig index ca1639918f57..97a81260485a 100644 --- a/drivers/gpu/drm/nouveau/Kconfig +++ b/drivers/gpu/drm/nouveau/Kconfig | |||
@@ -13,6 +13,7 @@ config DRM_NOUVEAU | |||
13 | select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT | 13 | select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT |
14 | select ACPI_WMI if ACPI | 14 | select ACPI_WMI if ACPI |
15 | select MXM_WMI if ACPI | 15 | select MXM_WMI if ACPI |
16 | select POWER_SUPPLY | ||
16 | help | 17 | help |
17 | Choose this option for open-source nVidia support. | 18 | Choose this option for open-source nVidia support. |
18 | 19 | ||
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 637afe71de56..0be4a815e706 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -177,14 +177,15 @@ bios_shadow_pci(struct nvbios *bios) | |||
177 | 177 | ||
178 | if (!pci_enable_rom(pdev)) { | 178 | if (!pci_enable_rom(pdev)) { |
179 | void __iomem *rom = pci_map_rom(pdev, &length); | 179 | void __iomem *rom = pci_map_rom(pdev, &length); |
180 | if (rom) { | 180 | if (rom && length) { |
181 | bios->data = kmalloc(length, GFP_KERNEL); | 181 | bios->data = kmalloc(length, GFP_KERNEL); |
182 | if (bios->data) { | 182 | if (bios->data) { |
183 | memcpy_fromio(bios->data, rom, length); | 183 | memcpy_fromio(bios->data, rom, length); |
184 | bios->length = length; | 184 | bios->length = length; |
185 | } | 185 | } |
186 | pci_unmap_rom(pdev, rom); | ||
187 | } | 186 | } |
187 | if (rom) | ||
188 | pci_unmap_rom(pdev, rom); | ||
188 | 189 | ||
189 | pci_disable_rom(pdev); | 190 | pci_disable_rom(pdev); |
190 | } | 191 | } |
@@ -6155,10 +6156,14 @@ dcb_fake_connectors(struct nvbios *bios) | |||
6155 | 6156 | ||
6156 | /* heuristic: if we ever get a non-zero connector field, assume | 6157 | /* heuristic: if we ever get a non-zero connector field, assume |
6157 | * 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.. | ||
6158 | */ | 6161 | */ |
6159 | for (i = 0; i < dcbt->entries; i++) { | 6162 | if (!nv_match_device(bios->dev, 0x0392, 0x107d, 0x20a2)) { |
6160 | if (dcbt->entry[i].connector) | 6163 | for (i = 0; i < dcbt->entries; i++) { |
6161 | return; | 6164 | if (dcbt->entry[i].connector) |
6165 | return; | ||
6166 | } | ||
6162 | } | 6167 | } |
6163 | 6168 | ||
6164 | /* 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_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index 44e6416d4a33..846afb0bfef4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -436,11 +436,11 @@ nouveau_ioctl_fifo_alloc(struct drm_device *dev, void *data, | |||
436 | } | 436 | } |
437 | 437 | ||
438 | if (dev_priv->card_type < NV_C0) { | 438 | if (dev_priv->card_type < NV_C0) { |
439 | init->subchan[0].handle = NvSw; | 439 | init->subchan[0].handle = 0x00000000; |
440 | init->subchan[0].grclass = NV_SW; | 440 | init->subchan[0].grclass = 0x0000; |
441 | init->nr_subchan = 1; | 441 | init->subchan[1].handle = NvSw; |
442 | } else { | 442 | init->subchan[1].grclass = NV_SW; |
443 | init->nr_subchan = 0; | 443 | init->nr_subchan = 2; |
444 | } | 444 | } |
445 | 445 | ||
446 | /* Named memory object area */ | 446 | /* Named memory object area */ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.h b/drivers/gpu/drm/nouveau/nouveau_dma.h index bcf0fd9e313e..23d4edf992b7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.h +++ b/drivers/gpu/drm/nouveau/nouveau_dma.h | |||
@@ -48,8 +48,8 @@ void nv50_dma_push(struct nouveau_channel *, struct nouveau_bo *, | |||
48 | 48 | ||
49 | /* Hardcoded object assignments to subchannels (subchannel id). */ | 49 | /* Hardcoded object assignments to subchannels (subchannel id). */ |
50 | enum { | 50 | enum { |
51 | NvSubSw = 0, | 51 | NvSubM2MF = 0, |
52 | NvSubM2MF = 1, | 52 | NvSubSw = 1, |
53 | NvSub2D = 2, | 53 | NvSub2D = 2, |
54 | NvSubCtxSurf2D = 2, | 54 | NvSubCtxSurf2D = 2, |
55 | NvSubGdiRect = 3, | 55 | NvSubGdiRect = 3, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hdmi.c b/drivers/gpu/drm/nouveau/nouveau_hdmi.c index 59ea1c14eca0..c3de36384522 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hdmi.c +++ b/drivers/gpu/drm/nouveau/nouveau_hdmi.c | |||
@@ -32,7 +32,9 @@ static bool | |||
32 | hdmi_sor(struct drm_encoder *encoder) | 32 | hdmi_sor(struct drm_encoder *encoder) |
33 | { | 33 | { |
34 | struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; | 34 | struct drm_nouveau_private *dev_priv = encoder->dev->dev_private; |
35 | if (dev_priv->chipset < 0xa3) | 35 | if (dev_priv->chipset < 0xa3 || |
36 | dev_priv->chipset == 0xaa || | ||
37 | dev_priv->chipset == 0xac) | ||
36 | return false; | 38 | return false; |
37 | return true; | 39 | return true; |
38 | } | 40 | } |
diff --git a/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index 34d591b7d4ef..da3e7c3abab7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -235,6 +235,7 @@ nouveau_pm_profile_set(struct drm_device *dev, const char *profile) | |||
235 | return -EPERM; | 235 | return -EPERM; |
236 | 236 | ||
237 | strncpy(string, profile, sizeof(string)); | 237 | strncpy(string, profile, sizeof(string)); |
238 | string[sizeof(string) - 1] = 0; | ||
238 | if ((ptr = strchr(string, '\n'))) | 239 | if ((ptr = strchr(string, '\n'))) |
239 | *ptr = '\0'; | 240 | *ptr = '\0'; |
240 | 241 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c index a4886b36d0fa..c2a8511e855a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_state.c +++ b/drivers/gpu/drm/nouveau/nouveau_state.c | |||
@@ -642,7 +642,7 @@ nouveau_card_channel_init(struct drm_device *dev) | |||
642 | OUT_RING (chan, chan->vram_handle); | 642 | OUT_RING (chan, chan->vram_handle); |
643 | OUT_RING (chan, chan->gart_handle); | 643 | OUT_RING (chan, chan->gart_handle); |
644 | } else | 644 | } else |
645 | if (dev_priv->card_type <= NV_C0) { | 645 | if (dev_priv->card_type <= NV_D0) { |
646 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); | 646 | ret = nouveau_gpuobj_gr_new(chan, 0x9039, 0x9039); |
647 | if (ret) | 647 | if (ret) |
648 | goto error; | 648 | goto error; |
diff --git a/drivers/gpu/drm/nouveau/nv10_gpio.c b/drivers/gpu/drm/nouveau/nv10_gpio.c index 550ad3fcf0af..9d79180069df 100644 --- a/drivers/gpu/drm/nouveau/nv10_gpio.c +++ b/drivers/gpu/drm/nouveau/nv10_gpio.c | |||
@@ -65,7 +65,7 @@ nv10_gpio_drive(struct drm_device *dev, int line, int dir, int out) | |||
65 | if (line < 10) { | 65 | if (line < 10) { |
66 | line = (line - 2) * 4; | 66 | line = (line - 2) * 4; |
67 | reg = NV_PCRTC_GPIO_EXT; | 67 | reg = NV_PCRTC_GPIO_EXT; |
68 | mask = 0x00000003 << ((line - 2) * 4); | 68 | mask = 0x00000003; |
69 | data = (dir << 1) | out; | 69 | data = (dir << 1) | out; |
70 | } else | 70 | } else |
71 | if (line < 14) { | 71 | if (line < 14) { |
diff --git a/drivers/gpu/drm/nouveau/nv50_sor.c b/drivers/gpu/drm/nouveau/nv50_sor.c index a7844ab6a50c..274640212475 100644 --- a/drivers/gpu/drm/nouveau/nv50_sor.c +++ b/drivers/gpu/drm/nouveau/nv50_sor.c | |||
@@ -42,7 +42,7 @@ nv50_sor_dp_lane_map(struct drm_device *dev, struct dcb_entry *dcb, u8 lane) | |||
42 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 42 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
43 | static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ | 43 | static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */ |
44 | static const u8 nv50[] = { 16, 8, 0, 24 }; | 44 | static const u8 nv50[] = { 16, 8, 0, 24 }; |
45 | if (dev_priv->card_type == 0xaf) | 45 | if (dev_priv->chipset == 0xaf) |
46 | return nvaf[lane]; | 46 | return nvaf[lane]; |
47 | return nv50[lane]; | 47 | return nv50[lane]; |
48 | } | 48 | } |
diff --git a/drivers/gpu/drm/nouveau/nvc0_fb.c b/drivers/gpu/drm/nouveau/nvc0_fb.c index 5bf55038fd92..f704e942372e 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fb.c +++ b/drivers/gpu/drm/nouveau/nvc0_fb.c | |||
@@ -54,6 +54,11 @@ nvc0_mfb_isr(struct drm_device *dev) | |||
54 | nvc0_mfb_subp_isr(dev, unit, subp); | 54 | nvc0_mfb_subp_isr(dev, unit, subp); |
55 | units &= ~(1 << unit); | 55 | units &= ~(1 << unit); |
56 | } | 56 | } |
57 | |||
58 | /* we do something horribly wrong and upset PMFB a lot, so mask off | ||
59 | * interrupts from it after the first one until it's fixed | ||
60 | */ | ||
61 | nv_mask(dev, 0x000640, 0x02000000, 0x00000000); | ||
57 | } | 62 | } |
58 | 63 | ||
59 | static void | 64 | static void |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index d1bd239cd9e9..5ce9bf51a8de 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -1306,8 +1306,11 @@ struct atom_context *atom_parse(struct card_info *card, void *bios) | |||
1306 | 1306 | ||
1307 | int atom_asic_init(struct atom_context *ctx) | 1307 | int atom_asic_init(struct atom_context *ctx) |
1308 | { | 1308 | { |
1309 | struct radeon_device *rdev = ctx->card->dev->dev_private; | ||
1309 | int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); | 1310 | int hwi = CU16(ctx->data_table + ATOM_DATA_FWI_PTR); |
1310 | uint32_t ps[16]; | 1311 | uint32_t ps[16]; |
1312 | int ret; | ||
1313 | |||
1311 | memset(ps, 0, 64); | 1314 | memset(ps, 0, 64); |
1312 | 1315 | ||
1313 | ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR)); | 1316 | ps[0] = cpu_to_le32(CU32(hwi + ATOM_FWI_DEFSCLK_PTR)); |
@@ -1317,7 +1320,17 @@ int atom_asic_init(struct atom_context *ctx) | |||
1317 | 1320 | ||
1318 | if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) | 1321 | if (!CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_INIT)) |
1319 | return 1; | 1322 | return 1; |
1320 | return atom_execute_table(ctx, ATOM_CMD_INIT, ps); | 1323 | ret = atom_execute_table(ctx, ATOM_CMD_INIT, ps); |
1324 | if (ret) | ||
1325 | return ret; | ||
1326 | |||
1327 | memset(ps, 0, 64); | ||
1328 | |||
1329 | if (rdev->family < CHIP_R600) { | ||
1330 | if (CU16(ctx->cmd_table + 4 + 2 * ATOM_CMD_SPDFANCNTL)) | ||
1331 | atom_execute_table(ctx, ATOM_CMD_SPDFANCNTL, ps); | ||
1332 | } | ||
1333 | return ret; | ||
1321 | } | 1334 | } |
1322 | 1335 | ||
1323 | void atom_destroy(struct atom_context *ctx) | 1336 | void atom_destroy(struct atom_context *ctx) |
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h index 93cfe2086ba0..25fea631dad2 100644 --- a/drivers/gpu/drm/radeon/atom.h +++ b/drivers/gpu/drm/radeon/atom.h | |||
@@ -44,6 +44,7 @@ | |||
44 | #define ATOM_CMD_SETSCLK 0x0A | 44 | #define ATOM_CMD_SETSCLK 0x0A |
45 | #define ATOM_CMD_SETMCLK 0x0B | 45 | #define ATOM_CMD_SETMCLK 0x0B |
46 | #define ATOM_CMD_SETPCLK 0x0C | 46 | #define ATOM_CMD_SETPCLK 0x0C |
47 | #define ATOM_CMD_SPDFANCNTL 0x39 | ||
47 | 48 | ||
48 | #define ATOM_DATA_FWI_PTR 0xC | 49 | #define ATOM_DATA_FWI_PTR 0xC |
49 | #define ATOM_DATA_IIO_PTR 0x32 | 50 | #define ATOM_DATA_IIO_PTR 0x32 |
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/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c index e607c4d7dd98..2d39f9977e00 100644 --- a/drivers/gpu/drm/radeon/atombios_encoders.c +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | |||
@@ -230,6 +230,10 @@ atombios_dvo_setup(struct drm_encoder *encoder, int action) | |||
230 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) | 230 | if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | /* some R4xx chips have the wrong frev */ | ||
234 | if (rdev->family <= CHIP_RV410) | ||
235 | frev = 1; | ||
236 | |||
233 | switch (frev) { | 237 | switch (frev) { |
234 | case 1: | 238 | case 1: |
235 | switch (crev) { | 239 | switch (crev) { |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 81801c176aa5..fe33d35dae8c 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -2553,7 +2553,7 @@ static void r100_pll_errata_after_data(struct radeon_device *rdev) | |||
2553 | * or the chip could hang on a subsequent access | 2553 | * or the chip could hang on a subsequent access |
2554 | */ | 2554 | */ |
2555 | if (rdev->pll_errata & CHIP_ERRATA_PLL_DELAY) { | 2555 | if (rdev->pll_errata & CHIP_ERRATA_PLL_DELAY) { |
2556 | udelay(5000); | 2556 | mdelay(5); |
2557 | } | 2557 | } |
2558 | 2558 | ||
2559 | /* This function is required to workaround a hardware bug in some (all?) | 2559 | /* This function is required to workaround a hardware bug in some (all?) |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 391bd2636a80..c8187c4b6ae8 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1135,7 +1135,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc | |||
1135 | } | 1135 | } |
1136 | if (rdev->flags & RADEON_IS_AGP) { | 1136 | if (rdev->flags & RADEON_IS_AGP) { |
1137 | size_bf = mc->gtt_start; | 1137 | size_bf = mc->gtt_start; |
1138 | size_af = 0xFFFFFFFF - mc->gtt_end + 1; | 1138 | size_af = 0xFFFFFFFF - mc->gtt_end; |
1139 | if (size_bf > size_af) { | 1139 | if (size_bf > size_af) { |
1140 | if (mc->mc_vram_size > size_bf) { | 1140 | if (mc->mc_vram_size > size_bf) { |
1141 | dev_warn(rdev->dev, "limiting VRAM\n"); | 1141 | dev_warn(rdev->dev, "limiting VRAM\n"); |
@@ -1149,7 +1149,7 @@ static void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc | |||
1149 | mc->real_vram_size = size_af; | 1149 | mc->real_vram_size = size_af; |
1150 | mc->mc_vram_size = size_af; | 1150 | mc->mc_vram_size = size_af; |
1151 | } | 1151 | } |
1152 | mc->vram_start = mc->gtt_end; | 1152 | mc->vram_start = mc->gtt_end + 1; |
1153 | } | 1153 | } |
1154 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 1154 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
1155 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 1155 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", |
@@ -2839,7 +2839,7 @@ void r600_rlc_stop(struct radeon_device *rdev) | |||
2839 | /* r7xx asics need to soft reset RLC before halting */ | 2839 | /* r7xx asics need to soft reset RLC before halting */ |
2840 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_RLC); | 2840 | WREG32(SRBM_SOFT_RESET, SOFT_RESET_RLC); |
2841 | RREG32(SRBM_SOFT_RESET); | 2841 | RREG32(SRBM_SOFT_RESET); |
2842 | udelay(15000); | 2842 | mdelay(15); |
2843 | WREG32(SRBM_SOFT_RESET, 0); | 2843 | WREG32(SRBM_SOFT_RESET, 0); |
2844 | RREG32(SRBM_SOFT_RESET); | 2844 | RREG32(SRBM_SOFT_RESET); |
2845 | } | 2845 | } |
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 84c546250955..75ed17c96115 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c | |||
@@ -407,7 +407,7 @@ static void r600_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
407 | 407 | ||
408 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 408 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
409 | RADEON_READ(R600_GRBM_SOFT_RESET); | 409 | RADEON_READ(R600_GRBM_SOFT_RESET); |
410 | DRM_UDELAY(15000); | 410 | mdelay(15); |
411 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 411 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
412 | 412 | ||
413 | fw_data = (const __be32 *)dev_priv->me_fw->data; | 413 | fw_data = (const __be32 *)dev_priv->me_fw->data; |
@@ -500,7 +500,7 @@ static void r700_cp_load_microcode(drm_radeon_private_t *dev_priv) | |||
500 | 500 | ||
501 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 501 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
502 | RADEON_READ(R600_GRBM_SOFT_RESET); | 502 | RADEON_READ(R600_GRBM_SOFT_RESET); |
503 | DRM_UDELAY(15000); | 503 | mdelay(15); |
504 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 504 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
505 | 505 | ||
506 | fw_data = (const __be32 *)dev_priv->pfp_fw->data; | 506 | fw_data = (const __be32 *)dev_priv->pfp_fw->data; |
@@ -1797,7 +1797,7 @@ static void r600_cp_init_ring_buffer(struct drm_device *dev, | |||
1797 | 1797 | ||
1798 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); | 1798 | RADEON_WRITE(R600_GRBM_SOFT_RESET, R600_SOFT_RESET_CP); |
1799 | RADEON_READ(R600_GRBM_SOFT_RESET); | 1799 | RADEON_READ(R600_GRBM_SOFT_RESET); |
1800 | DRM_UDELAY(15000); | 1800 | mdelay(15); |
1801 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); | 1801 | RADEON_WRITE(R600_GRBM_SOFT_RESET, 0); |
1802 | 1802 | ||
1803 | 1803 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_clocks.c b/drivers/gpu/drm/radeon/radeon_clocks.c index 6ae0c75f016a..9c6b29a41927 100644 --- a/drivers/gpu/drm/radeon/radeon_clocks.c +++ b/drivers/gpu/drm/radeon/radeon_clocks.c | |||
@@ -633,7 +633,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
633 | tmp &= ~(R300_SCLK_FORCE_VAP); | 633 | tmp &= ~(R300_SCLK_FORCE_VAP); |
634 | tmp |= RADEON_SCLK_FORCE_CP; | 634 | tmp |= RADEON_SCLK_FORCE_CP; |
635 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); | 635 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); |
636 | udelay(15000); | 636 | mdelay(15); |
637 | 637 | ||
638 | tmp = RREG32_PLL(R300_SCLK_CNTL2); | 638 | tmp = RREG32_PLL(R300_SCLK_CNTL2); |
639 | tmp &= ~(R300_SCLK_FORCE_TCL | | 639 | tmp &= ~(R300_SCLK_FORCE_TCL | |
@@ -651,12 +651,12 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
651 | tmp |= (RADEON_ENGIN_DYNCLK_MODE | | 651 | tmp |= (RADEON_ENGIN_DYNCLK_MODE | |
652 | (0x01 << RADEON_ACTIVE_HILO_LAT_SHIFT)); | 652 | (0x01 << RADEON_ACTIVE_HILO_LAT_SHIFT)); |
653 | WREG32_PLL(RADEON_CLK_PWRMGT_CNTL, tmp); | 653 | WREG32_PLL(RADEON_CLK_PWRMGT_CNTL, tmp); |
654 | udelay(15000); | 654 | mdelay(15); |
655 | 655 | ||
656 | tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL); | 656 | tmp = RREG32_PLL(RADEON_CLK_PIN_CNTL); |
657 | tmp |= RADEON_SCLK_DYN_START_CNTL; | 657 | tmp |= RADEON_SCLK_DYN_START_CNTL; |
658 | WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp); | 658 | WREG32_PLL(RADEON_CLK_PIN_CNTL, tmp); |
659 | udelay(15000); | 659 | mdelay(15); |
660 | 660 | ||
661 | /* When DRI is enabled, setting DYN_STOP_LAT to zero can cause some R200 | 661 | /* When DRI is enabled, setting DYN_STOP_LAT to zero can cause some R200 |
662 | to lockup randomly, leave them as set by BIOS. | 662 | to lockup randomly, leave them as set by BIOS. |
@@ -696,7 +696,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
696 | tmp |= RADEON_SCLK_MORE_FORCEON; | 696 | tmp |= RADEON_SCLK_MORE_FORCEON; |
697 | } | 697 | } |
698 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); | 698 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); |
699 | udelay(15000); | 699 | mdelay(15); |
700 | } | 700 | } |
701 | 701 | ||
702 | /* RV200::A11 A12, RV250::A11 A12 */ | 702 | /* RV200::A11 A12, RV250::A11 A12 */ |
@@ -709,7 +709,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
709 | tmp |= RADEON_TCL_BYPASS_DISABLE; | 709 | tmp |= RADEON_TCL_BYPASS_DISABLE; |
710 | WREG32_PLL(RADEON_PLL_PWRMGT_CNTL, tmp); | 710 | WREG32_PLL(RADEON_PLL_PWRMGT_CNTL, tmp); |
711 | } | 711 | } |
712 | udelay(15000); | 712 | mdelay(15); |
713 | 713 | ||
714 | /*enable dynamic mode for display clocks (PIXCLK and PIX2CLK) */ | 714 | /*enable dynamic mode for display clocks (PIXCLK and PIX2CLK) */ |
715 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 715 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
@@ -722,14 +722,14 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
722 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); | 722 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); |
723 | 723 | ||
724 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 724 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
725 | udelay(15000); | 725 | mdelay(15); |
726 | 726 | ||
727 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); | 727 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); |
728 | tmp |= (RADEON_PIXCLK_ALWAYS_ONb | | 728 | tmp |= (RADEON_PIXCLK_ALWAYS_ONb | |
729 | RADEON_PIXCLK_DAC_ALWAYS_ONb); | 729 | RADEON_PIXCLK_DAC_ALWAYS_ONb); |
730 | 730 | ||
731 | WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp); | 731 | WREG32_PLL(RADEON_VCLK_ECP_CNTL, tmp); |
732 | udelay(15000); | 732 | mdelay(15); |
733 | } | 733 | } |
734 | } else { | 734 | } else { |
735 | /* Turn everything OFF (ForceON to everything) */ | 735 | /* Turn everything OFF (ForceON to everything) */ |
@@ -861,7 +861,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
861 | } | 861 | } |
862 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); | 862 | WREG32_PLL(RADEON_SCLK_CNTL, tmp); |
863 | 863 | ||
864 | udelay(16000); | 864 | mdelay(16); |
865 | 865 | ||
866 | if ((rdev->family == CHIP_R300) || | 866 | if ((rdev->family == CHIP_R300) || |
867 | (rdev->family == CHIP_R350)) { | 867 | (rdev->family == CHIP_R350)) { |
@@ -870,7 +870,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
870 | R300_SCLK_FORCE_GA | | 870 | R300_SCLK_FORCE_GA | |
871 | R300_SCLK_FORCE_CBA); | 871 | R300_SCLK_FORCE_CBA); |
872 | WREG32_PLL(R300_SCLK_CNTL2, tmp); | 872 | WREG32_PLL(R300_SCLK_CNTL2, tmp); |
873 | udelay(16000); | 873 | mdelay(16); |
874 | } | 874 | } |
875 | 875 | ||
876 | if (rdev->flags & RADEON_IS_IGP) { | 876 | if (rdev->flags & RADEON_IS_IGP) { |
@@ -878,7 +878,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
878 | tmp &= ~(RADEON_FORCEON_MCLKA | | 878 | tmp &= ~(RADEON_FORCEON_MCLKA | |
879 | RADEON_FORCEON_YCLKA); | 879 | RADEON_FORCEON_YCLKA); |
880 | WREG32_PLL(RADEON_MCLK_CNTL, tmp); | 880 | WREG32_PLL(RADEON_MCLK_CNTL, tmp); |
881 | udelay(16000); | 881 | mdelay(16); |
882 | } | 882 | } |
883 | 883 | ||
884 | if ((rdev->family == CHIP_RV200) || | 884 | if ((rdev->family == CHIP_RV200) || |
@@ -887,7 +887,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
887 | tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL); | 887 | tmp = RREG32_PLL(RADEON_SCLK_MORE_CNTL); |
888 | tmp |= RADEON_SCLK_MORE_FORCEON; | 888 | tmp |= RADEON_SCLK_MORE_FORCEON; |
889 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); | 889 | WREG32_PLL(RADEON_SCLK_MORE_CNTL, tmp); |
890 | udelay(16000); | 890 | mdelay(16); |
891 | } | 891 | } |
892 | 892 | ||
893 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 893 | tmp = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
@@ -900,7 +900,7 @@ void radeon_legacy_set_clock_gating(struct radeon_device *rdev, int enable) | |||
900 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); | 900 | RADEON_PIXCLK_TMDS_ALWAYS_ONb); |
901 | 901 | ||
902 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 902 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
903 | udelay(16000); | 903 | mdelay(16); |
904 | 904 | ||
905 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); | 905 | tmp = RREG32_PLL(RADEON_VCLK_ECP_CNTL); |
906 | tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb | | 906 | tmp &= ~(RADEON_PIXCLK_ALWAYS_ONb | |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 81fc100be7e1..2cad9fde92fc 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -2845,7 +2845,7 @@ bool radeon_combios_external_tmds_setup(struct drm_encoder *encoder) | |||
2845 | case 4: | 2845 | case 4: |
2846 | val = RBIOS16(index); | 2846 | val = RBIOS16(index); |
2847 | index += 2; | 2847 | index += 2; |
2848 | udelay(val * 1000); | 2848 | mdelay(val); |
2849 | break; | 2849 | break; |
2850 | case 6: | 2850 | case 6: |
2851 | slave_addr = id & 0xff; | 2851 | slave_addr = id & 0xff; |
@@ -3044,7 +3044,7 @@ static void combios_parse_pll_table(struct drm_device *dev, uint16_t offset) | |||
3044 | udelay(150); | 3044 | udelay(150); |
3045 | break; | 3045 | break; |
3046 | case 2: | 3046 | case 2: |
3047 | udelay(1000); | 3047 | mdelay(1); |
3048 | break; | 3048 | break; |
3049 | case 3: | 3049 | case 3: |
3050 | while (tmp--) { | 3050 | while (tmp--) { |
@@ -3075,13 +3075,13 @@ static void combios_parse_pll_table(struct drm_device *dev, uint16_t offset) | |||
3075 | /*mclk_cntl |= 0x00001111;*//* ??? */ | 3075 | /*mclk_cntl |= 0x00001111;*//* ??? */ |
3076 | WREG32_PLL(RADEON_MCLK_CNTL, | 3076 | WREG32_PLL(RADEON_MCLK_CNTL, |
3077 | mclk_cntl); | 3077 | mclk_cntl); |
3078 | udelay(10000); | 3078 | mdelay(10); |
3079 | #endif | 3079 | #endif |
3080 | WREG32_PLL | 3080 | WREG32_PLL |
3081 | (RADEON_CLK_PWRMGT_CNTL, | 3081 | (RADEON_CLK_PWRMGT_CNTL, |
3082 | tmp & | 3082 | tmp & |
3083 | ~RADEON_CG_NO1_DEBUG_0); | 3083 | ~RADEON_CG_NO1_DEBUG_0); |
3084 | udelay(10000); | 3084 | mdelay(10); |
3085 | } | 3085 | } |
3086 | break; | 3086 | break; |
3087 | default: | 3087 | default: |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index bd05156edbdb..3c2e7a000a2a 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -970,7 +970,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
970 | 970 | ||
971 | encoder = obj_to_encoder(obj); | 971 | encoder = obj_to_encoder(obj); |
972 | 972 | ||
973 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC || | 973 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC && |
974 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) | 974 | encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) |
975 | continue; | 975 | continue; |
976 | 976 | ||
@@ -1000,6 +1000,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1000 | * cases the DVI port is actually a virtual KVM port connected to the service | 1000 | * cases the DVI port is actually a virtual KVM port connected to the service |
1001 | * processor. | 1001 | * processor. |
1002 | */ | 1002 | */ |
1003 | out: | ||
1003 | if ((!rdev->is_atom_bios) && | 1004 | if ((!rdev->is_atom_bios) && |
1004 | (ret == connector_status_disconnected) && | 1005 | (ret == connector_status_disconnected) && |
1005 | rdev->mode_info.bios_hardcoded_edid_size) { | 1006 | rdev->mode_info.bios_hardcoded_edid_size) { |
@@ -1007,7 +1008,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1007 | ret = connector_status_connected; | 1008 | ret = connector_status_connected; |
1008 | } | 1009 | } |
1009 | 1010 | ||
1010 | out: | ||
1011 | /* updated in get modes as well since we need to know if it's analog or digital */ | 1011 | /* updated in get modes as well since we need to know if it's analog or digital */ |
1012 | radeon_connector_update_scratch_regs(connector, ret); | 1012 | radeon_connector_update_scratch_regs(connector, ret); |
1013 | return ret; | 1013 | return ret; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index ea7df16e2f84..5992502a3448 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -241,8 +241,8 @@ int radeon_wb_init(struct radeon_device *rdev) | |||
241 | rdev->wb.use_event = true; | 241 | rdev->wb.use_event = true; |
242 | } | 242 | } |
243 | } | 243 | } |
244 | /* always use writeback/events on NI */ | 244 | /* always use writeback/events on NI, APUs */ |
245 | if (ASIC_IS_DCE5(rdev)) { | 245 | if (rdev->family >= CHIP_PALM) { |
246 | rdev->wb.enabled = true; | 246 | rdev->wb.enabled = true; |
247 | rdev->wb.use_event = true; | 247 | rdev->wb.use_event = true; |
248 | } | 248 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 8086c96e0b06..0a1d4bd65edc 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -533,7 +533,7 @@ static void radeon_crtc_init(struct drm_device *dev, int index) | |||
533 | radeon_legacy_init_crtc(dev, radeon_crtc); | 533 | radeon_legacy_init_crtc(dev, radeon_crtc); |
534 | } | 534 | } |
535 | 535 | ||
536 | static const char *encoder_names[36] = { | 536 | static const char *encoder_names[37] = { |
537 | "NONE", | 537 | "NONE", |
538 | "INTERNAL_LVDS", | 538 | "INTERNAL_LVDS", |
539 | "INTERNAL_TMDS1", | 539 | "INTERNAL_TMDS1", |
@@ -570,6 +570,7 @@ static const char *encoder_names[36] = { | |||
570 | "INTERNAL_UNIPHY2", | 570 | "INTERNAL_UNIPHY2", |
571 | "NUTMEG", | 571 | "NUTMEG", |
572 | "TRAVIS", | 572 | "TRAVIS", |
573 | "INTERNAL_VCE" | ||
573 | }; | 574 | }; |
574 | 575 | ||
575 | static const char *connector_names[15] = { | 576 | static const char *connector_names[15] = { |
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c index 85bcfc8923a7..3edec1c198e3 100644 --- a/drivers/gpu/drm/radeon/radeon_i2c.c +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | |||
@@ -900,6 +900,10 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | |||
900 | struct radeon_i2c_chan *i2c; | 900 | struct radeon_i2c_chan *i2c; |
901 | int ret; | 901 | int ret; |
902 | 902 | ||
903 | /* don't add the mm_i2c bus unless hw_i2c is enabled */ | ||
904 | if (rec->mm_i2c && (radeon_hw_i2c == 0)) | ||
905 | return NULL; | ||
906 | |||
903 | i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL); | 907 | i2c = kzalloc(sizeof(struct radeon_i2c_chan), GFP_KERNEL); |
904 | if (i2c == NULL) | 908 | if (i2c == NULL) |
905 | return NULL; | 909 | return NULL; |
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c index 66d5fe1c8174..65060b77c805 100644 --- a/drivers/gpu/drm/radeon/radeon_irq_kms.c +++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c | |||
@@ -147,6 +147,12 @@ static bool radeon_msi_ok(struct radeon_device *rdev) | |||
147 | (rdev->pdev->subsystem_device == 0x01fd)) | 147 | (rdev->pdev->subsystem_device == 0x01fd)) |
148 | return true; | 148 | return true; |
149 | 149 | ||
150 | /* RV515 seems to have MSI issues where it loses | ||
151 | * MSI rearms occasionally. This leads to lockups and freezes. | ||
152 | * disable it by default. | ||
153 | */ | ||
154 | if (rdev->family == CHIP_RV515) | ||
155 | return false; | ||
150 | if (rdev->flags & RADEON_IS_IGP) { | 156 | if (rdev->flags & RADEON_IS_IGP) { |
151 | /* APUs work fine with MSIs */ | 157 | /* APUs work fine with MSIs */ |
152 | if (rdev->family >= CHIP_PALM) | 158 | if (rdev->family >= CHIP_PALM) |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 2f46e0c8df53..42db254f6bb0 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -88,7 +88,7 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
88 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); | 88 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); |
89 | lvds_pll_cntl |= RADEON_LVDS_PLL_EN; | 89 | lvds_pll_cntl |= RADEON_LVDS_PLL_EN; |
90 | WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); | 90 | WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); |
91 | udelay(1000); | 91 | mdelay(1); |
92 | 92 | ||
93 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); | 93 | lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL); |
94 | lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET; | 94 | lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET; |
@@ -101,7 +101,7 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
101 | (backlight_level << RADEON_LVDS_BL_MOD_LEVEL_SHIFT)); | 101 | (backlight_level << RADEON_LVDS_BL_MOD_LEVEL_SHIFT)); |
102 | if (is_mac) | 102 | if (is_mac) |
103 | lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; | 103 | lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; |
104 | udelay(panel_pwr_delay * 1000); | 104 | mdelay(panel_pwr_delay); |
105 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 105 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
106 | break; | 106 | break; |
107 | case DRM_MODE_DPMS_STANDBY: | 107 | case DRM_MODE_DPMS_STANDBY: |
@@ -118,10 +118,10 @@ static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) | |||
118 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 118 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
119 | lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON); | 119 | lvds_gen_cntl &= ~(RADEON_LVDS_ON | RADEON_LVDS_BLON | RADEON_LVDS_EN | RADEON_LVDS_DIGON); |
120 | } | 120 | } |
121 | udelay(panel_pwr_delay * 1000); | 121 | mdelay(panel_pwr_delay); |
122 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); | 122 | WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); |
123 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); | 123 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); |
124 | udelay(panel_pwr_delay * 1000); | 124 | mdelay(panel_pwr_delay); |
125 | break; | 125 | break; |
126 | } | 126 | } |
127 | 127 | ||
@@ -656,7 +656,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
656 | 656 | ||
657 | WREG32(RADEON_DAC_MACRO_CNTL, tmp); | 657 | WREG32(RADEON_DAC_MACRO_CNTL, tmp); |
658 | 658 | ||
659 | udelay(2000); | 659 | mdelay(2); |
660 | 660 | ||
661 | if (RREG32(RADEON_DAC_CNTL) & RADEON_DAC_CMP_OUTPUT) | 661 | if (RREG32(RADEON_DAC_CNTL) & RADEON_DAC_CMP_OUTPUT) |
662 | found = connector_status_connected; | 662 | found = connector_status_connected; |
@@ -1499,7 +1499,7 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1499 | tmp = dac_cntl2 | RADEON_DAC2_DAC2_CLK_SEL | RADEON_DAC2_CMP_EN; | 1499 | tmp = dac_cntl2 | RADEON_DAC2_DAC2_CLK_SEL | RADEON_DAC2_CMP_EN; |
1500 | WREG32(RADEON_DAC_CNTL2, tmp); | 1500 | WREG32(RADEON_DAC_CNTL2, tmp); |
1501 | 1501 | ||
1502 | udelay(10000); | 1502 | mdelay(10); |
1503 | 1503 | ||
1504 | if (ASIC_IS_R300(rdev)) { | 1504 | if (ASIC_IS_R300(rdev)) { |
1505 | if (RREG32(RADEON_DAC_CNTL2) & RADEON_DAC2_CMP_OUT_B) | 1505 | if (RREG32(RADEON_DAC_CNTL2) & RADEON_DAC2_CMP_OUT_B) |
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c index 6f70158d34e4..df6a4dbd93f8 100644 --- a/drivers/gpu/drm/radeon/radeon_object.c +++ b/drivers/gpu/drm/radeon/radeon_object.c | |||
@@ -241,7 +241,8 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset, | |||
241 | domain_start = bo->rdev->mc.vram_start; | 241 | domain_start = bo->rdev->mc.vram_start; |
242 | else | 242 | else |
243 | domain_start = bo->rdev->mc.gtt_start; | 243 | domain_start = bo->rdev->mc.gtt_start; |
244 | WARN_ON_ONCE((*gpu_addr - domain_start) > max_offset); | 244 | WARN_ON_ONCE(max_offset < |
245 | (radeon_bo_gpu_offset(bo) - domain_start)); | ||
245 | } | 246 | } |
246 | 247 | ||
247 | return 0; | 248 | return 0; |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index c62ae4be3845..cdab1aeaed6e 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -969,7 +969,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
969 | } | 969 | } |
970 | if (rdev->flags & RADEON_IS_AGP) { | 970 | if (rdev->flags & RADEON_IS_AGP) { |
971 | size_bf = mc->gtt_start; | 971 | size_bf = mc->gtt_start; |
972 | size_af = 0xFFFFFFFF - mc->gtt_end + 1; | 972 | size_af = 0xFFFFFFFF - mc->gtt_end; |
973 | if (size_bf > size_af) { | 973 | if (size_bf > size_af) { |
974 | if (mc->mc_vram_size > size_bf) { | 974 | if (mc->mc_vram_size > size_bf) { |
975 | dev_warn(rdev->dev, "limiting VRAM\n"); | 975 | dev_warn(rdev->dev, "limiting VRAM\n"); |
@@ -983,7 +983,7 @@ void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | |||
983 | mc->real_vram_size = size_af; | 983 | mc->real_vram_size = size_af; |
984 | mc->mc_vram_size = size_af; | 984 | mc->mc_vram_size = size_af; |
985 | } | 985 | } |
986 | mc->vram_start = mc->gtt_end; | 986 | mc->vram_start = mc->gtt_end + 1; |
987 | } | 987 | } |
988 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | 988 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; |
989 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", | 989 | dev_info(rdev->dev, "VRAM: %lluM 0x%08llX - 0x%08llX (%lluM used)\n", |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index ac7a199ffece..27bda986fc2b 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2999,8 +2999,8 @@ int si_rlc_init(struct radeon_device *rdev) | |||
2999 | } | 2999 | } |
3000 | r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, | 3000 | r = radeon_bo_pin(rdev->rlc.save_restore_obj, RADEON_GEM_DOMAIN_VRAM, |
3001 | &rdev->rlc.save_restore_gpu_addr); | 3001 | &rdev->rlc.save_restore_gpu_addr); |
3002 | radeon_bo_unreserve(rdev->rlc.save_restore_obj); | ||
3002 | if (r) { | 3003 | if (r) { |
3003 | radeon_bo_unreserve(rdev->rlc.save_restore_obj); | ||
3004 | dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); | 3004 | dev_warn(rdev->dev, "(%d) pin RLC sr bo failed\n", r); |
3005 | si_rlc_fini(rdev); | 3005 | si_rlc_fini(rdev); |
3006 | return r; | 3006 | return r; |
@@ -3023,9 +3023,8 @@ int si_rlc_init(struct radeon_device *rdev) | |||
3023 | } | 3023 | } |
3024 | r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, | 3024 | r = radeon_bo_pin(rdev->rlc.clear_state_obj, RADEON_GEM_DOMAIN_VRAM, |
3025 | &rdev->rlc.clear_state_gpu_addr); | 3025 | &rdev->rlc.clear_state_gpu_addr); |
3026 | radeon_bo_unreserve(rdev->rlc.clear_state_obj); | ||
3026 | if (r) { | 3027 | if (r) { |
3027 | |||
3028 | radeon_bo_unreserve(rdev->rlc.clear_state_obj); | ||
3029 | dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); | 3028 | dev_warn(rdev->dev, "(%d) pin RLC c bo failed\n", r); |
3030 | si_rlc_fini(rdev); | 3029 | si_rlc_fini(rdev); |
3031 | return r; | 3030 | return r; |
diff --git a/drivers/gpu/drm/savage/savage_state.c b/drivers/gpu/drm/savage/savage_state.c index 031aaaf79ac2..b6d8608375cd 100644 --- a/drivers/gpu/drm/savage/savage_state.c +++ b/drivers/gpu/drm/savage/savage_state.c | |||
@@ -988,7 +988,7 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ | |||
988 | * for locking on FreeBSD. | 988 | * for locking on FreeBSD. |
989 | */ | 989 | */ |
990 | if (cmdbuf->size) { | 990 | if (cmdbuf->size) { |
991 | kcmd_addr = kmalloc(cmdbuf->size * 8, GFP_KERNEL); | 991 | kcmd_addr = kmalloc_array(cmdbuf->size, 8, GFP_KERNEL); |
992 | if (kcmd_addr == NULL) | 992 | if (kcmd_addr == NULL) |
993 | return -ENOMEM; | 993 | return -ENOMEM; |
994 | 994 | ||
@@ -1015,8 +1015,8 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ | |||
1015 | cmdbuf->vb_addr = kvb_addr; | 1015 | cmdbuf->vb_addr = kvb_addr; |
1016 | } | 1016 | } |
1017 | if (cmdbuf->nbox) { | 1017 | if (cmdbuf->nbox) { |
1018 | kbox_addr = kmalloc(cmdbuf->nbox * sizeof(struct drm_clip_rect), | 1018 | kbox_addr = kmalloc_array(cmdbuf->nbox, sizeof(struct drm_clip_rect), |
1019 | GFP_KERNEL); | 1019 | GFP_KERNEL); |
1020 | if (kbox_addr == NULL) { | 1020 | if (kbox_addr == NULL) { |
1021 | ret = -ENOMEM; | 1021 | ret = -ENOMEM; |
1022 | goto done; | 1022 | goto done; |
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c index 5340c5f3987b..53673907a6a0 100644 --- a/drivers/gpu/drm/udl/udl_drv.c +++ b/drivers/gpu/drm/udl/udl_drv.c | |||
@@ -47,7 +47,7 @@ static struct vm_operations_struct udl_gem_vm_ops = { | |||
47 | static const struct file_operations udl_driver_fops = { | 47 | static const struct file_operations udl_driver_fops = { |
48 | .owner = THIS_MODULE, | 48 | .owner = THIS_MODULE, |
49 | .open = drm_open, | 49 | .open = drm_open, |
50 | .mmap = drm_gem_mmap, | 50 | .mmap = udl_drm_gem_mmap, |
51 | .poll = drm_poll, | 51 | .poll = drm_poll, |
52 | .read = drm_read, | 52 | .read = drm_read, |
53 | .unlocked_ioctl = drm_ioctl, | 53 | .unlocked_ioctl = drm_ioctl, |
diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index 1612954a5bc4..96820d03a303 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h | |||
@@ -121,6 +121,7 @@ struct udl_gem_object *udl_gem_alloc_object(struct drm_device *dev, | |||
121 | 121 | ||
122 | int udl_gem_vmap(struct udl_gem_object *obj); | 122 | int udl_gem_vmap(struct udl_gem_object *obj); |
123 | void udl_gem_vunmap(struct udl_gem_object *obj); | 123 | void udl_gem_vunmap(struct udl_gem_object *obj); |
124 | int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); | ||
124 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); | 125 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf); |
125 | 126 | ||
126 | int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, | 127 | int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, |
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index 852642dc1187..92f19ef329b0 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c | |||
@@ -71,6 +71,20 @@ int udl_dumb_destroy(struct drm_file *file, struct drm_device *dev, | |||
71 | return drm_gem_handle_delete(file, handle); | 71 | return drm_gem_handle_delete(file, handle); |
72 | } | 72 | } |
73 | 73 | ||
74 | int udl_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma) | ||
75 | { | ||
76 | int ret; | ||
77 | |||
78 | ret = drm_gem_mmap(filp, vma); | ||
79 | if (ret) | ||
80 | return ret; | ||
81 | |||
82 | vma->vm_flags &= ~VM_PFNMAP; | ||
83 | vma->vm_flags |= VM_MIXEDMAP; | ||
84 | |||
85 | return ret; | ||
86 | } | ||
87 | |||
74 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | 88 | int udl_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) |
75 | { | 89 | { |
76 | struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data); | 90 | struct udl_gem_object *obj = to_udl_bo(vma->vm_private_data); |
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index a3d033252995..ffddcba32af6 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -34,7 +34,7 @@ config HID | |||
34 | config HID_BATTERY_STRENGTH | 34 | config HID_BATTERY_STRENGTH |
35 | bool | 35 | bool |
36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY | 36 | depends on HID && POWER_SUPPLY && HID = POWER_SUPPLY |
37 | default y | 37 | default n |
38 | 38 | ||
39 | config HIDRAW | 39 | config HIDRAW |
40 | bool "/dev/hidraw raw HID device support" | 40 | bool "/dev/hidraw raw HID device support" |
diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c index 12f9777c385d..45c3433f7986 100644 --- a/drivers/hid/hid-picolcd.c +++ b/drivers/hid/hid-picolcd.c | |||
@@ -1525,12 +1525,6 @@ static const struct file_operations picolcd_debug_reset_fops = { | |||
1525 | /* | 1525 | /* |
1526 | * The "eeprom" file | 1526 | * The "eeprom" file |
1527 | */ | 1527 | */ |
1528 | static int picolcd_debug_eeprom_open(struct inode *i, struct file *f) | ||
1529 | { | ||
1530 | f->private_data = i->i_private; | ||
1531 | return 0; | ||
1532 | } | ||
1533 | |||
1534 | static ssize_t picolcd_debug_eeprom_read(struct file *f, char __user *u, | 1528 | static ssize_t picolcd_debug_eeprom_read(struct file *f, char __user *u, |
1535 | size_t s, loff_t *off) | 1529 | size_t s, loff_t *off) |
1536 | { | 1530 | { |
@@ -1618,7 +1612,7 @@ static ssize_t picolcd_debug_eeprom_write(struct file *f, const char __user *u, | |||
1618 | */ | 1612 | */ |
1619 | static const struct file_operations picolcd_debug_eeprom_fops = { | 1613 | static const struct file_operations picolcd_debug_eeprom_fops = { |
1620 | .owner = THIS_MODULE, | 1614 | .owner = THIS_MODULE, |
1621 | .open = picolcd_debug_eeprom_open, | 1615 | .open = simple_open, |
1622 | .read = picolcd_debug_eeprom_read, | 1616 | .read = picolcd_debug_eeprom_read, |
1623 | .write = picolcd_debug_eeprom_write, | 1617 | .write = picolcd_debug_eeprom_write, |
1624 | .llseek = generic_file_llseek, | 1618 | .llseek = generic_file_llseek, |
@@ -1627,12 +1621,6 @@ static const struct file_operations picolcd_debug_eeprom_fops = { | |||
1627 | /* | 1621 | /* |
1628 | * The "flash" file | 1622 | * The "flash" file |
1629 | */ | 1623 | */ |
1630 | static int picolcd_debug_flash_open(struct inode *i, struct file *f) | ||
1631 | { | ||
1632 | f->private_data = i->i_private; | ||
1633 | return 0; | ||
1634 | } | ||
1635 | |||
1636 | /* record a flash address to buf (bounds check to be done by caller) */ | 1624 | /* record a flash address to buf (bounds check to be done by caller) */ |
1637 | static int _picolcd_flash_setaddr(struct picolcd_data *data, u8 *buf, long off) | 1625 | static int _picolcd_flash_setaddr(struct picolcd_data *data, u8 *buf, long off) |
1638 | { | 1626 | { |
@@ -1817,7 +1805,7 @@ static ssize_t picolcd_debug_flash_write(struct file *f, const char __user *u, | |||
1817 | */ | 1805 | */ |
1818 | static const struct file_operations picolcd_debug_flash_fops = { | 1806 | static const struct file_operations picolcd_debug_flash_fops = { |
1819 | .owner = THIS_MODULE, | 1807 | .owner = THIS_MODULE, |
1820 | .open = picolcd_debug_flash_open, | 1808 | .open = simple_open, |
1821 | .read = picolcd_debug_flash_read, | 1809 | .read = picolcd_debug_flash_read, |
1822 | .write = picolcd_debug_flash_write, | 1810 | .write = picolcd_debug_flash_write, |
1823 | .llseek = generic_file_llseek, | 1811 | .llseek = generic_file_llseek, |
diff --git a/drivers/hid/hid-tivo.c b/drivers/hid/hid-tivo.c index de47039c708c..9f85f827607f 100644 --- a/drivers/hid/hid-tivo.c +++ b/drivers/hid/hid-tivo.c | |||
@@ -62,7 +62,7 @@ static int tivo_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
62 | 62 | ||
63 | static const struct hid_device_id tivo_devices[] = { | 63 | static const struct hid_device_id tivo_devices[] = { |
64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ | 64 | /* TiVo Slide Bluetooth remote, pairs with a Broadcom dongle */ |
65 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, | 65 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE_BT) }, |
66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, | 66 | { HID_USB_DEVICE(USB_VENDOR_ID_TIVO, USB_DEVICE_ID_TIVO_SLIDE) }, |
67 | { } | 67 | { } |
68 | }; | 68 | }; |
diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c index 17dabc1f339e..eec329197c16 100644 --- a/drivers/hid/hid-wiimote-debug.c +++ b/drivers/hid/hid-wiimote-debug.c | |||
@@ -23,12 +23,6 @@ struct wiimote_debug { | |||
23 | struct dentry *drm; | 23 | struct dentry *drm; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | static int wiidebug_eeprom_open(struct inode *i, struct file *f) | ||
27 | { | ||
28 | f->private_data = i->i_private; | ||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s, | 26 | static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s, |
33 | loff_t *off) | 27 | loff_t *off) |
34 | { | 28 | { |
@@ -83,7 +77,7 @@ static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s, | |||
83 | 77 | ||
84 | static const struct file_operations wiidebug_eeprom_fops = { | 78 | static const struct file_operations wiidebug_eeprom_fops = { |
85 | .owner = THIS_MODULE, | 79 | .owner = THIS_MODULE, |
86 | .open = wiidebug_eeprom_open, | 80 | .open = simple_open, |
87 | .read = wiidebug_eeprom_read, | 81 | .read = wiidebug_eeprom_read, |
88 | .llseek = generic_file_llseek, | 82 | .llseek = generic_file_llseek, |
89 | }; | 83 | }; |
diff --git a/drivers/hsi/Kconfig b/drivers/hsi/Kconfig new file mode 100644 index 000000000000..d94e38dd80c7 --- /dev/null +++ b/drivers/hsi/Kconfig | |||
@@ -0,0 +1,19 @@ | |||
1 | # | ||
2 | # HSI driver configuration | ||
3 | # | ||
4 | menuconfig HSI | ||
5 | tristate "HSI support" | ||
6 | ---help--- | ||
7 | The "High speed synchronous Serial Interface" is | ||
8 | synchronous serial interface used mainly to connect | ||
9 | application engines and cellular modems. | ||
10 | |||
11 | if HSI | ||
12 | |||
13 | config HSI_BOARDINFO | ||
14 | bool | ||
15 | default y | ||
16 | |||
17 | source "drivers/hsi/clients/Kconfig" | ||
18 | |||
19 | endif # HSI | ||
diff --git a/drivers/hsi/Makefile b/drivers/hsi/Makefile new file mode 100644 index 000000000000..9d5d33f90de2 --- /dev/null +++ b/drivers/hsi/Makefile | |||
@@ -0,0 +1,6 @@ | |||
1 | # | ||
2 | # Makefile for HSI | ||
3 | # | ||
4 | obj-$(CONFIG_HSI_BOARDINFO) += hsi_boardinfo.o | ||
5 | obj-$(CONFIG_HSI) += hsi.o | ||
6 | obj-y += clients/ | ||
diff --git a/drivers/hsi/clients/Kconfig b/drivers/hsi/clients/Kconfig new file mode 100644 index 000000000000..3bacd275f479 --- /dev/null +++ b/drivers/hsi/clients/Kconfig | |||
@@ -0,0 +1,13 @@ | |||
1 | # | ||
2 | # HSI clients configuration | ||
3 | # | ||
4 | |||
5 | comment "HSI clients" | ||
6 | |||
7 | config HSI_CHAR | ||
8 | tristate "HSI/SSI character driver" | ||
9 | depends on HSI | ||
10 | ---help--- | ||
11 | If you say Y here, you will enable the HSI/SSI character driver. | ||
12 | This driver provides a simple character device interface for | ||
13 | serial communication with the cellular modem over HSI/SSI bus. | ||
diff --git a/drivers/hsi/clients/Makefile b/drivers/hsi/clients/Makefile new file mode 100644 index 000000000000..327c0e27c8b0 --- /dev/null +++ b/drivers/hsi/clients/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for HSI clients | ||
3 | # | ||
4 | |||
5 | obj-$(CONFIG_HSI_CHAR) += hsi_char.o | ||
diff --git a/drivers/hsi/clients/hsi_char.c b/drivers/hsi/clients/hsi_char.c new file mode 100644 index 000000000000..3ad91f6447d8 --- /dev/null +++ b/drivers/hsi/clients/hsi_char.c | |||
@@ -0,0 +1,802 @@ | |||
1 | /* | ||
2 | * HSI character device driver, implements the character device | ||
3 | * interface. | ||
4 | * | ||
5 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
6 | * | ||
7 | * Contact: Andras Domokos <andras.domokos@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * version 2 as published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
21 | * 02110-1301 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/errno.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/atomic.h> | ||
27 | #include <linux/kernel.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/module.h> | ||
30 | #include <linux/mutex.h> | ||
31 | #include <linux/list.h> | ||
32 | #include <linux/slab.h> | ||
33 | #include <linux/kmemleak.h> | ||
34 | #include <linux/ioctl.h> | ||
35 | #include <linux/wait.h> | ||
36 | #include <linux/fs.h> | ||
37 | #include <linux/sched.h> | ||
38 | #include <linux/device.h> | ||
39 | #include <linux/cdev.h> | ||
40 | #include <linux/uaccess.h> | ||
41 | #include <linux/scatterlist.h> | ||
42 | #include <linux/stat.h> | ||
43 | #include <linux/hsi/hsi.h> | ||
44 | #include <linux/hsi/hsi_char.h> | ||
45 | |||
46 | #define HSC_DEVS 16 /* Num of channels */ | ||
47 | #define HSC_MSGS 4 | ||
48 | |||
49 | #define HSC_RXBREAK 0 | ||
50 | |||
51 | #define HSC_ID_BITS 6 | ||
52 | #define HSC_PORT_ID_BITS 4 | ||
53 | #define HSC_ID_MASK 3 | ||
54 | #define HSC_PORT_ID_MASK 3 | ||
55 | #define HSC_CH_MASK 0xf | ||
56 | |||
57 | /* | ||
58 | * We support up to 4 controllers that can have up to 4 | ||
59 | * ports, which should currently be more than enough. | ||
60 | */ | ||
61 | #define HSC_BASEMINOR(id, port_id) \ | ||
62 | ((((id) & HSC_ID_MASK) << HSC_ID_BITS) | \ | ||
63 | (((port_id) & HSC_PORT_ID_MASK) << HSC_PORT_ID_BITS)) | ||
64 | |||
65 | enum { | ||
66 | HSC_CH_OPEN, | ||
67 | HSC_CH_READ, | ||
68 | HSC_CH_WRITE, | ||
69 | HSC_CH_WLINE, | ||
70 | }; | ||
71 | |||
72 | enum { | ||
73 | HSC_RX, | ||
74 | HSC_TX, | ||
75 | }; | ||
76 | |||
77 | struct hsc_client_data; | ||
78 | /** | ||
79 | * struct hsc_channel - hsi_char internal channel data | ||
80 | * @ch: channel number | ||
81 | * @flags: Keeps state of the channel (open/close, reading, writing) | ||
82 | * @free_msgs_list: List of free HSI messages/requests | ||
83 | * @rx_msgs_queue: List of pending RX requests | ||
84 | * @tx_msgs_queue: List of pending TX requests | ||
85 | * @lock: Serialize access to the lists | ||
86 | * @cl: reference to the associated hsi_client | ||
87 | * @cl_data: reference to the client data that this channels belongs to | ||
88 | * @rx_wait: RX requests wait queue | ||
89 | * @tx_wait: TX requests wait queue | ||
90 | */ | ||
91 | struct hsc_channel { | ||
92 | unsigned int ch; | ||
93 | unsigned long flags; | ||
94 | struct list_head free_msgs_list; | ||
95 | struct list_head rx_msgs_queue; | ||
96 | struct list_head tx_msgs_queue; | ||
97 | spinlock_t lock; | ||
98 | struct hsi_client *cl; | ||
99 | struct hsc_client_data *cl_data; | ||
100 | wait_queue_head_t rx_wait; | ||
101 | wait_queue_head_t tx_wait; | ||
102 | }; | ||
103 | |||
104 | /** | ||
105 | * struct hsc_client_data - hsi_char internal client data | ||
106 | * @cdev: Characther device associated to the hsi_client | ||
107 | * @lock: Lock to serialize open/close access | ||
108 | * @flags: Keeps track of port state (rx hwbreak armed) | ||
109 | * @usecnt: Use count for claiming the HSI port (mutex protected) | ||
110 | * @cl: Referece to the HSI client | ||
111 | * @channels: Array of channels accessible by the client | ||
112 | */ | ||
113 | struct hsc_client_data { | ||
114 | struct cdev cdev; | ||
115 | struct mutex lock; | ||
116 | unsigned long flags; | ||
117 | unsigned int usecnt; | ||
118 | struct hsi_client *cl; | ||
119 | struct hsc_channel channels[HSC_DEVS]; | ||
120 | }; | ||
121 | |||
122 | /* Stores the major number dynamically allocated for hsi_char */ | ||
123 | static unsigned int hsc_major; | ||
124 | /* Maximum buffer size that hsi_char will accept from userspace */ | ||
125 | static unsigned int max_data_size = 0x1000; | ||
126 | module_param(max_data_size, uint, 0); | ||
127 | MODULE_PARM_DESC(max_data_size, "max read/write data size [4,8..65536] (^2)"); | ||
128 | |||
129 | static void hsc_add_tail(struct hsc_channel *channel, struct hsi_msg *msg, | ||
130 | struct list_head *queue) | ||
131 | { | ||
132 | unsigned long flags; | ||
133 | |||
134 | spin_lock_irqsave(&channel->lock, flags); | ||
135 | list_add_tail(&msg->link, queue); | ||
136 | spin_unlock_irqrestore(&channel->lock, flags); | ||
137 | } | ||
138 | |||
139 | static struct hsi_msg *hsc_get_first_msg(struct hsc_channel *channel, | ||
140 | struct list_head *queue) | ||
141 | { | ||
142 | struct hsi_msg *msg = NULL; | ||
143 | unsigned long flags; | ||
144 | |||
145 | spin_lock_irqsave(&channel->lock, flags); | ||
146 | |||
147 | if (list_empty(queue)) | ||
148 | goto out; | ||
149 | |||
150 | msg = list_first_entry(queue, struct hsi_msg, link); | ||
151 | list_del(&msg->link); | ||
152 | out: | ||
153 | spin_unlock_irqrestore(&channel->lock, flags); | ||
154 | |||
155 | return msg; | ||
156 | } | ||
157 | |||
158 | static inline void hsc_msg_free(struct hsi_msg *msg) | ||
159 | { | ||
160 | kfree(sg_virt(msg->sgt.sgl)); | ||
161 | hsi_free_msg(msg); | ||
162 | } | ||
163 | |||
164 | static void hsc_free_list(struct list_head *list) | ||
165 | { | ||
166 | struct hsi_msg *msg, *tmp; | ||
167 | |||
168 | list_for_each_entry_safe(msg, tmp, list, link) { | ||
169 | list_del(&msg->link); | ||
170 | hsc_msg_free(msg); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | static void hsc_reset_list(struct hsc_channel *channel, struct list_head *l) | ||
175 | { | ||
176 | unsigned long flags; | ||
177 | LIST_HEAD(list); | ||
178 | |||
179 | spin_lock_irqsave(&channel->lock, flags); | ||
180 | list_splice_init(l, &list); | ||
181 | spin_unlock_irqrestore(&channel->lock, flags); | ||
182 | |||
183 | hsc_free_list(&list); | ||
184 | } | ||
185 | |||
186 | static inline struct hsi_msg *hsc_msg_alloc(unsigned int alloc_size) | ||
187 | { | ||
188 | struct hsi_msg *msg; | ||
189 | void *buf; | ||
190 | |||
191 | msg = hsi_alloc_msg(1, GFP_KERNEL); | ||
192 | if (!msg) | ||
193 | goto out; | ||
194 | buf = kmalloc(alloc_size, GFP_KERNEL); | ||
195 | if (!buf) { | ||
196 | hsi_free_msg(msg); | ||
197 | goto out; | ||
198 | } | ||
199 | sg_init_one(msg->sgt.sgl, buf, alloc_size); | ||
200 | /* Ignore false positive, due to sg pointer handling */ | ||
201 | kmemleak_ignore(buf); | ||
202 | |||
203 | return msg; | ||
204 | out: | ||
205 | return NULL; | ||
206 | } | ||
207 | |||
208 | static inline int hsc_msgs_alloc(struct hsc_channel *channel) | ||
209 | { | ||
210 | struct hsi_msg *msg; | ||
211 | int i; | ||
212 | |||
213 | for (i = 0; i < HSC_MSGS; i++) { | ||
214 | msg = hsc_msg_alloc(max_data_size); | ||
215 | if (!msg) | ||
216 | goto out; | ||
217 | msg->channel = channel->ch; | ||
218 | list_add_tail(&msg->link, &channel->free_msgs_list); | ||
219 | } | ||
220 | |||
221 | return 0; | ||
222 | out: | ||
223 | hsc_free_list(&channel->free_msgs_list); | ||
224 | |||
225 | return -ENOMEM; | ||
226 | } | ||
227 | |||
228 | static inline unsigned int hsc_msg_len_get(struct hsi_msg *msg) | ||
229 | { | ||
230 | return msg->sgt.sgl->length; | ||
231 | } | ||
232 | |||
233 | static inline void hsc_msg_len_set(struct hsi_msg *msg, unsigned int len) | ||
234 | { | ||
235 | msg->sgt.sgl->length = len; | ||
236 | } | ||
237 | |||
238 | static void hsc_rx_completed(struct hsi_msg *msg) | ||
239 | { | ||
240 | struct hsc_client_data *cl_data = hsi_client_drvdata(msg->cl); | ||
241 | struct hsc_channel *channel = cl_data->channels + msg->channel; | ||
242 | |||
243 | if (test_bit(HSC_CH_READ, &channel->flags)) { | ||
244 | hsc_add_tail(channel, msg, &channel->rx_msgs_queue); | ||
245 | wake_up(&channel->rx_wait); | ||
246 | } else { | ||
247 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
248 | } | ||
249 | } | ||
250 | |||
251 | static void hsc_rx_msg_destructor(struct hsi_msg *msg) | ||
252 | { | ||
253 | msg->status = HSI_STATUS_ERROR; | ||
254 | hsc_msg_len_set(msg, 0); | ||
255 | hsc_rx_completed(msg); | ||
256 | } | ||
257 | |||
258 | static void hsc_tx_completed(struct hsi_msg *msg) | ||
259 | { | ||
260 | struct hsc_client_data *cl_data = hsi_client_drvdata(msg->cl); | ||
261 | struct hsc_channel *channel = cl_data->channels + msg->channel; | ||
262 | |||
263 | if (test_bit(HSC_CH_WRITE, &channel->flags)) { | ||
264 | hsc_add_tail(channel, msg, &channel->tx_msgs_queue); | ||
265 | wake_up(&channel->tx_wait); | ||
266 | } else { | ||
267 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
268 | } | ||
269 | } | ||
270 | |||
271 | static void hsc_tx_msg_destructor(struct hsi_msg *msg) | ||
272 | { | ||
273 | msg->status = HSI_STATUS_ERROR; | ||
274 | hsc_msg_len_set(msg, 0); | ||
275 | hsc_tx_completed(msg); | ||
276 | } | ||
277 | |||
278 | static void hsc_break_req_destructor(struct hsi_msg *msg) | ||
279 | { | ||
280 | struct hsc_client_data *cl_data = hsi_client_drvdata(msg->cl); | ||
281 | |||
282 | hsi_free_msg(msg); | ||
283 | clear_bit(HSC_RXBREAK, &cl_data->flags); | ||
284 | } | ||
285 | |||
286 | static void hsc_break_received(struct hsi_msg *msg) | ||
287 | { | ||
288 | struct hsc_client_data *cl_data = hsi_client_drvdata(msg->cl); | ||
289 | struct hsc_channel *channel = cl_data->channels; | ||
290 | int i, ret; | ||
291 | |||
292 | /* Broadcast HWBREAK on all channels */ | ||
293 | for (i = 0; i < HSC_DEVS; i++, channel++) { | ||
294 | struct hsi_msg *msg2; | ||
295 | |||
296 | if (!test_bit(HSC_CH_READ, &channel->flags)) | ||
297 | continue; | ||
298 | msg2 = hsc_get_first_msg(channel, &channel->free_msgs_list); | ||
299 | if (!msg2) | ||
300 | continue; | ||
301 | clear_bit(HSC_CH_READ, &channel->flags); | ||
302 | hsc_msg_len_set(msg2, 0); | ||
303 | msg2->status = HSI_STATUS_COMPLETED; | ||
304 | hsc_add_tail(channel, msg2, &channel->rx_msgs_queue); | ||
305 | wake_up(&channel->rx_wait); | ||
306 | } | ||
307 | hsi_flush(msg->cl); | ||
308 | ret = hsi_async_read(msg->cl, msg); | ||
309 | if (ret < 0) | ||
310 | hsc_break_req_destructor(msg); | ||
311 | } | ||
312 | |||
313 | static int hsc_break_request(struct hsi_client *cl) | ||
314 | { | ||
315 | struct hsc_client_data *cl_data = hsi_client_drvdata(cl); | ||
316 | struct hsi_msg *msg; | ||
317 | int ret; | ||
318 | |||
319 | if (test_and_set_bit(HSC_RXBREAK, &cl_data->flags)) | ||
320 | return -EBUSY; | ||
321 | |||
322 | msg = hsi_alloc_msg(0, GFP_KERNEL); | ||
323 | if (!msg) { | ||
324 | clear_bit(HSC_RXBREAK, &cl_data->flags); | ||
325 | return -ENOMEM; | ||
326 | } | ||
327 | msg->break_frame = 1; | ||
328 | msg->complete = hsc_break_received; | ||
329 | msg->destructor = hsc_break_req_destructor; | ||
330 | ret = hsi_async_read(cl, msg); | ||
331 | if (ret < 0) | ||
332 | hsc_break_req_destructor(msg); | ||
333 | |||
334 | return ret; | ||
335 | } | ||
336 | |||
337 | static int hsc_break_send(struct hsi_client *cl) | ||
338 | { | ||
339 | struct hsi_msg *msg; | ||
340 | int ret; | ||
341 | |||
342 | msg = hsi_alloc_msg(0, GFP_ATOMIC); | ||
343 | if (!msg) | ||
344 | return -ENOMEM; | ||
345 | msg->break_frame = 1; | ||
346 | msg->complete = hsi_free_msg; | ||
347 | msg->destructor = hsi_free_msg; | ||
348 | ret = hsi_async_write(cl, msg); | ||
349 | if (ret < 0) | ||
350 | hsi_free_msg(msg); | ||
351 | |||
352 | return ret; | ||
353 | } | ||
354 | |||
355 | static int hsc_rx_set(struct hsi_client *cl, struct hsc_rx_config *rxc) | ||
356 | { | ||
357 | struct hsi_config tmp; | ||
358 | int ret; | ||
359 | |||
360 | if ((rxc->mode != HSI_MODE_STREAM) && (rxc->mode != HSI_MODE_FRAME)) | ||
361 | return -EINVAL; | ||
362 | if ((rxc->channels == 0) || (rxc->channels > HSC_DEVS)) | ||
363 | return -EINVAL; | ||
364 | if (rxc->channels & (rxc->channels - 1)) | ||
365 | return -EINVAL; | ||
366 | if ((rxc->flow != HSI_FLOW_SYNC) && (rxc->flow != HSI_FLOW_PIPE)) | ||
367 | return -EINVAL; | ||
368 | tmp = cl->rx_cfg; | ||
369 | cl->rx_cfg.mode = rxc->mode; | ||
370 | cl->rx_cfg.channels = rxc->channels; | ||
371 | cl->rx_cfg.flow = rxc->flow; | ||
372 | ret = hsi_setup(cl); | ||
373 | if (ret < 0) { | ||
374 | cl->rx_cfg = tmp; | ||
375 | return ret; | ||
376 | } | ||
377 | if (rxc->mode == HSI_MODE_FRAME) | ||
378 | hsc_break_request(cl); | ||
379 | |||
380 | return ret; | ||
381 | } | ||
382 | |||
383 | static inline void hsc_rx_get(struct hsi_client *cl, struct hsc_rx_config *rxc) | ||
384 | { | ||
385 | rxc->mode = cl->rx_cfg.mode; | ||
386 | rxc->channels = cl->rx_cfg.channels; | ||
387 | rxc->flow = cl->rx_cfg.flow; | ||
388 | } | ||
389 | |||
390 | static int hsc_tx_set(struct hsi_client *cl, struct hsc_tx_config *txc) | ||
391 | { | ||
392 | struct hsi_config tmp; | ||
393 | int ret; | ||
394 | |||
395 | if ((txc->mode != HSI_MODE_STREAM) && (txc->mode != HSI_MODE_FRAME)) | ||
396 | return -EINVAL; | ||
397 | if ((txc->channels == 0) || (txc->channels > HSC_DEVS)) | ||
398 | return -EINVAL; | ||
399 | if (txc->channels & (txc->channels - 1)) | ||
400 | return -EINVAL; | ||
401 | if ((txc->arb_mode != HSI_ARB_RR) && (txc->arb_mode != HSI_ARB_PRIO)) | ||
402 | return -EINVAL; | ||
403 | tmp = cl->tx_cfg; | ||
404 | cl->tx_cfg.mode = txc->mode; | ||
405 | cl->tx_cfg.channels = txc->channels; | ||
406 | cl->tx_cfg.speed = txc->speed; | ||
407 | cl->tx_cfg.arb_mode = txc->arb_mode; | ||
408 | ret = hsi_setup(cl); | ||
409 | if (ret < 0) { | ||
410 | cl->tx_cfg = tmp; | ||
411 | return ret; | ||
412 | } | ||
413 | |||
414 | return ret; | ||
415 | } | ||
416 | |||
417 | static inline void hsc_tx_get(struct hsi_client *cl, struct hsc_tx_config *txc) | ||
418 | { | ||
419 | txc->mode = cl->tx_cfg.mode; | ||
420 | txc->channels = cl->tx_cfg.channels; | ||
421 | txc->speed = cl->tx_cfg.speed; | ||
422 | txc->arb_mode = cl->tx_cfg.arb_mode; | ||
423 | } | ||
424 | |||
425 | static ssize_t hsc_read(struct file *file, char __user *buf, size_t len, | ||
426 | loff_t *ppos __maybe_unused) | ||
427 | { | ||
428 | struct hsc_channel *channel = file->private_data; | ||
429 | struct hsi_msg *msg; | ||
430 | ssize_t ret; | ||
431 | |||
432 | if (len == 0) | ||
433 | return 0; | ||
434 | if (!IS_ALIGNED(len, sizeof(u32))) | ||
435 | return -EINVAL; | ||
436 | if (len > max_data_size) | ||
437 | len = max_data_size; | ||
438 | if (channel->ch >= channel->cl->rx_cfg.channels) | ||
439 | return -ECHRNG; | ||
440 | if (test_and_set_bit(HSC_CH_READ, &channel->flags)) | ||
441 | return -EBUSY; | ||
442 | msg = hsc_get_first_msg(channel, &channel->free_msgs_list); | ||
443 | if (!msg) { | ||
444 | ret = -ENOSPC; | ||
445 | goto out; | ||
446 | } | ||
447 | hsc_msg_len_set(msg, len); | ||
448 | msg->complete = hsc_rx_completed; | ||
449 | msg->destructor = hsc_rx_msg_destructor; | ||
450 | ret = hsi_async_read(channel->cl, msg); | ||
451 | if (ret < 0) { | ||
452 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
453 | goto out; | ||
454 | } | ||
455 | |||
456 | ret = wait_event_interruptible(channel->rx_wait, | ||
457 | !list_empty(&channel->rx_msgs_queue)); | ||
458 | if (ret < 0) { | ||
459 | clear_bit(HSC_CH_READ, &channel->flags); | ||
460 | hsi_flush(channel->cl); | ||
461 | return -EINTR; | ||
462 | } | ||
463 | |||
464 | msg = hsc_get_first_msg(channel, &channel->rx_msgs_queue); | ||
465 | if (msg) { | ||
466 | if (msg->status != HSI_STATUS_ERROR) { | ||
467 | ret = copy_to_user((void __user *)buf, | ||
468 | sg_virt(msg->sgt.sgl), hsc_msg_len_get(msg)); | ||
469 | if (ret) | ||
470 | ret = -EFAULT; | ||
471 | else | ||
472 | ret = hsc_msg_len_get(msg); | ||
473 | } else { | ||
474 | ret = -EIO; | ||
475 | } | ||
476 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
477 | } | ||
478 | out: | ||
479 | clear_bit(HSC_CH_READ, &channel->flags); | ||
480 | |||
481 | return ret; | ||
482 | } | ||
483 | |||
484 | static ssize_t hsc_write(struct file *file, const char __user *buf, size_t len, | ||
485 | loff_t *ppos __maybe_unused) | ||
486 | { | ||
487 | struct hsc_channel *channel = file->private_data; | ||
488 | struct hsi_msg *msg; | ||
489 | ssize_t ret; | ||
490 | |||
491 | if ((len == 0) || !IS_ALIGNED(len, sizeof(u32))) | ||
492 | return -EINVAL; | ||
493 | if (len > max_data_size) | ||
494 | len = max_data_size; | ||
495 | if (channel->ch >= channel->cl->tx_cfg.channels) | ||
496 | return -ECHRNG; | ||
497 | if (test_and_set_bit(HSC_CH_WRITE, &channel->flags)) | ||
498 | return -EBUSY; | ||
499 | msg = hsc_get_first_msg(channel, &channel->free_msgs_list); | ||
500 | if (!msg) { | ||
501 | clear_bit(HSC_CH_WRITE, &channel->flags); | ||
502 | return -ENOSPC; | ||
503 | } | ||
504 | if (copy_from_user(sg_virt(msg->sgt.sgl), (void __user *)buf, len)) { | ||
505 | ret = -EFAULT; | ||
506 | goto out; | ||
507 | } | ||
508 | hsc_msg_len_set(msg, len); | ||
509 | msg->complete = hsc_tx_completed; | ||
510 | msg->destructor = hsc_tx_msg_destructor; | ||
511 | ret = hsi_async_write(channel->cl, msg); | ||
512 | if (ret < 0) | ||
513 | goto out; | ||
514 | |||
515 | ret = wait_event_interruptible(channel->tx_wait, | ||
516 | !list_empty(&channel->tx_msgs_queue)); | ||
517 | if (ret < 0) { | ||
518 | clear_bit(HSC_CH_WRITE, &channel->flags); | ||
519 | hsi_flush(channel->cl); | ||
520 | return -EINTR; | ||
521 | } | ||
522 | |||
523 | msg = hsc_get_first_msg(channel, &channel->tx_msgs_queue); | ||
524 | if (msg) { | ||
525 | if (msg->status == HSI_STATUS_ERROR) | ||
526 | ret = -EIO; | ||
527 | else | ||
528 | ret = hsc_msg_len_get(msg); | ||
529 | |||
530 | hsc_add_tail(channel, msg, &channel->free_msgs_list); | ||
531 | } | ||
532 | out: | ||
533 | clear_bit(HSC_CH_WRITE, &channel->flags); | ||
534 | |||
535 | return ret; | ||
536 | } | ||
537 | |||
538 | static long hsc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
539 | { | ||
540 | struct hsc_channel *channel = file->private_data; | ||
541 | unsigned int state; | ||
542 | struct hsc_rx_config rxc; | ||
543 | struct hsc_tx_config txc; | ||
544 | long ret = 0; | ||
545 | |||
546 | switch (cmd) { | ||
547 | case HSC_RESET: | ||
548 | hsi_flush(channel->cl); | ||
549 | break; | ||
550 | case HSC_SET_PM: | ||
551 | if (copy_from_user(&state, (void __user *)arg, sizeof(state))) | ||
552 | return -EFAULT; | ||
553 | if (state == HSC_PM_DISABLE) { | ||
554 | if (test_and_set_bit(HSC_CH_WLINE, &channel->flags)) | ||
555 | return -EINVAL; | ||
556 | ret = hsi_start_tx(channel->cl); | ||
557 | } else if (state == HSC_PM_ENABLE) { | ||
558 | if (!test_and_clear_bit(HSC_CH_WLINE, &channel->flags)) | ||
559 | return -EINVAL; | ||
560 | ret = hsi_stop_tx(channel->cl); | ||
561 | } else { | ||
562 | ret = -EINVAL; | ||
563 | } | ||
564 | break; | ||
565 | case HSC_SEND_BREAK: | ||
566 | return hsc_break_send(channel->cl); | ||
567 | case HSC_SET_RX: | ||
568 | if (copy_from_user(&rxc, (void __user *)arg, sizeof(rxc))) | ||
569 | return -EFAULT; | ||
570 | return hsc_rx_set(channel->cl, &rxc); | ||
571 | case HSC_GET_RX: | ||
572 | hsc_rx_get(channel->cl, &rxc); | ||
573 | if (copy_to_user((void __user *)arg, &rxc, sizeof(rxc))) | ||
574 | return -EFAULT; | ||
575 | break; | ||
576 | case HSC_SET_TX: | ||
577 | if (copy_from_user(&txc, (void __user *)arg, sizeof(txc))) | ||
578 | return -EFAULT; | ||
579 | return hsc_tx_set(channel->cl, &txc); | ||
580 | case HSC_GET_TX: | ||
581 | hsc_tx_get(channel->cl, &txc); | ||
582 | if (copy_to_user((void __user *)arg, &txc, sizeof(txc))) | ||
583 | return -EFAULT; | ||
584 | break; | ||
585 | default: | ||
586 | return -ENOIOCTLCMD; | ||
587 | } | ||
588 | |||
589 | return ret; | ||
590 | } | ||
591 | |||
592 | static inline void __hsc_port_release(struct hsc_client_data *cl_data) | ||
593 | { | ||
594 | BUG_ON(cl_data->usecnt == 0); | ||
595 | |||
596 | if (--cl_data->usecnt == 0) { | ||
597 | hsi_flush(cl_data->cl); | ||
598 | hsi_release_port(cl_data->cl); | ||
599 | } | ||
600 | } | ||
601 | |||
602 | static int hsc_open(struct inode *inode, struct file *file) | ||
603 | { | ||
604 | struct hsc_client_data *cl_data; | ||
605 | struct hsc_channel *channel; | ||
606 | int ret = 0; | ||
607 | |||
608 | pr_debug("open, minor = %d\n", iminor(inode)); | ||
609 | |||
610 | cl_data = container_of(inode->i_cdev, struct hsc_client_data, cdev); | ||
611 | mutex_lock(&cl_data->lock); | ||
612 | channel = cl_data->channels + (iminor(inode) & HSC_CH_MASK); | ||
613 | |||
614 | if (test_and_set_bit(HSC_CH_OPEN, &channel->flags)) { | ||
615 | ret = -EBUSY; | ||
616 | goto out; | ||
617 | } | ||
618 | /* | ||
619 | * Check if we have already claimed the port associated to the HSI | ||
620 | * client. If not then try to claim it, else increase its refcount | ||
621 | */ | ||
622 | if (cl_data->usecnt == 0) { | ||
623 | ret = hsi_claim_port(cl_data->cl, 0); | ||
624 | if (ret < 0) | ||
625 | goto out; | ||
626 | hsi_setup(cl_data->cl); | ||
627 | } | ||
628 | cl_data->usecnt++; | ||
629 | |||
630 | ret = hsc_msgs_alloc(channel); | ||
631 | if (ret < 0) { | ||
632 | __hsc_port_release(cl_data); | ||
633 | goto out; | ||
634 | } | ||
635 | |||
636 | file->private_data = channel; | ||
637 | mutex_unlock(&cl_data->lock); | ||
638 | |||
639 | return ret; | ||
640 | out: | ||
641 | mutex_unlock(&cl_data->lock); | ||
642 | |||
643 | return ret; | ||
644 | } | ||
645 | |||
646 | static int hsc_release(struct inode *inode __maybe_unused, struct file *file) | ||
647 | { | ||
648 | struct hsc_channel *channel = file->private_data; | ||
649 | struct hsc_client_data *cl_data = channel->cl_data; | ||
650 | |||
651 | mutex_lock(&cl_data->lock); | ||
652 | file->private_data = NULL; | ||
653 | if (test_and_clear_bit(HSC_CH_WLINE, &channel->flags)) | ||
654 | hsi_stop_tx(channel->cl); | ||
655 | __hsc_port_release(cl_data); | ||
656 | hsc_reset_list(channel, &channel->rx_msgs_queue); | ||
657 | hsc_reset_list(channel, &channel->tx_msgs_queue); | ||
658 | hsc_reset_list(channel, &channel->free_msgs_list); | ||
659 | clear_bit(HSC_CH_READ, &channel->flags); | ||
660 | clear_bit(HSC_CH_WRITE, &channel->flags); | ||
661 | clear_bit(HSC_CH_OPEN, &channel->flags); | ||
662 | wake_up(&channel->rx_wait); | ||
663 | wake_up(&channel->tx_wait); | ||
664 | mutex_unlock(&cl_data->lock); | ||
665 | |||
666 | return 0; | ||
667 | } | ||
668 | |||
669 | static const struct file_operations hsc_fops = { | ||
670 | .owner = THIS_MODULE, | ||
671 | .read = hsc_read, | ||
672 | .write = hsc_write, | ||
673 | .unlocked_ioctl = hsc_ioctl, | ||
674 | .open = hsc_open, | ||
675 | .release = hsc_release, | ||
676 | }; | ||
677 | |||
678 | static void __devinit hsc_channel_init(struct hsc_channel *channel) | ||
679 | { | ||
680 | init_waitqueue_head(&channel->rx_wait); | ||
681 | init_waitqueue_head(&channel->tx_wait); | ||
682 | spin_lock_init(&channel->lock); | ||
683 | INIT_LIST_HEAD(&channel->free_msgs_list); | ||
684 | INIT_LIST_HEAD(&channel->rx_msgs_queue); | ||
685 | INIT_LIST_HEAD(&channel->tx_msgs_queue); | ||
686 | } | ||
687 | |||
688 | static int __devinit hsc_probe(struct device *dev) | ||
689 | { | ||
690 | const char devname[] = "hsi_char"; | ||
691 | struct hsc_client_data *cl_data; | ||
692 | struct hsc_channel *channel; | ||
693 | struct hsi_client *cl = to_hsi_client(dev); | ||
694 | unsigned int hsc_baseminor; | ||
695 | dev_t hsc_dev; | ||
696 | int ret; | ||
697 | int i; | ||
698 | |||
699 | cl_data = kzalloc(sizeof(*cl_data), GFP_KERNEL); | ||
700 | if (!cl_data) { | ||
701 | dev_err(dev, "Could not allocate hsc_client_data\n"); | ||
702 | return -ENOMEM; | ||
703 | } | ||
704 | hsc_baseminor = HSC_BASEMINOR(hsi_id(cl), hsi_port_id(cl)); | ||
705 | if (!hsc_major) { | ||
706 | ret = alloc_chrdev_region(&hsc_dev, hsc_baseminor, | ||
707 | HSC_DEVS, devname); | ||
708 | if (ret > 0) | ||
709 | hsc_major = MAJOR(hsc_dev); | ||
710 | } else { | ||
711 | hsc_dev = MKDEV(hsc_major, hsc_baseminor); | ||
712 | ret = register_chrdev_region(hsc_dev, HSC_DEVS, devname); | ||
713 | } | ||
714 | if (ret < 0) { | ||
715 | dev_err(dev, "Device %s allocation failed %d\n", | ||
716 | hsc_major ? "minor" : "major", ret); | ||
717 | goto out1; | ||
718 | } | ||
719 | mutex_init(&cl_data->lock); | ||
720 | hsi_client_set_drvdata(cl, cl_data); | ||
721 | cdev_init(&cl_data->cdev, &hsc_fops); | ||
722 | cl_data->cdev.owner = THIS_MODULE; | ||
723 | cl_data->cl = cl; | ||
724 | for (i = 0, channel = cl_data->channels; i < HSC_DEVS; i++, channel++) { | ||
725 | hsc_channel_init(channel); | ||
726 | channel->ch = i; | ||
727 | channel->cl = cl; | ||
728 | channel->cl_data = cl_data; | ||
729 | } | ||
730 | |||
731 | /* 1 hsi client -> N char devices (one for each channel) */ | ||
732 | ret = cdev_add(&cl_data->cdev, hsc_dev, HSC_DEVS); | ||
733 | if (ret) { | ||
734 | dev_err(dev, "Could not add char device %d\n", ret); | ||
735 | goto out2; | ||
736 | } | ||
737 | |||
738 | return 0; | ||
739 | out2: | ||
740 | unregister_chrdev_region(hsc_dev, HSC_DEVS); | ||
741 | out1: | ||
742 | kfree(cl_data); | ||
743 | |||
744 | return ret; | ||
745 | } | ||
746 | |||
747 | static int __devexit hsc_remove(struct device *dev) | ||
748 | { | ||
749 | struct hsi_client *cl = to_hsi_client(dev); | ||
750 | struct hsc_client_data *cl_data = hsi_client_drvdata(cl); | ||
751 | dev_t hsc_dev = cl_data->cdev.dev; | ||
752 | |||
753 | cdev_del(&cl_data->cdev); | ||
754 | unregister_chrdev_region(hsc_dev, HSC_DEVS); | ||
755 | hsi_client_set_drvdata(cl, NULL); | ||
756 | kfree(cl_data); | ||
757 | |||
758 | return 0; | ||
759 | } | ||
760 | |||
761 | static struct hsi_client_driver hsc_driver = { | ||
762 | .driver = { | ||
763 | .name = "hsi_char", | ||
764 | .owner = THIS_MODULE, | ||
765 | .probe = hsc_probe, | ||
766 | .remove = __devexit_p(hsc_remove), | ||
767 | }, | ||
768 | }; | ||
769 | |||
770 | static int __init hsc_init(void) | ||
771 | { | ||
772 | int ret; | ||
773 | |||
774 | if ((max_data_size < 4) || (max_data_size > 0x10000) || | ||
775 | (max_data_size & (max_data_size - 1))) { | ||
776 | pr_err("Invalid max read/write data size"); | ||
777 | return -EINVAL; | ||
778 | } | ||
779 | |||
780 | ret = hsi_register_client_driver(&hsc_driver); | ||
781 | if (ret) { | ||
782 | pr_err("Error while registering HSI/SSI driver %d", ret); | ||
783 | return ret; | ||
784 | } | ||
785 | |||
786 | pr_info("HSI/SSI char device loaded\n"); | ||
787 | |||
788 | return 0; | ||
789 | } | ||
790 | module_init(hsc_init); | ||
791 | |||
792 | static void __exit hsc_exit(void) | ||
793 | { | ||
794 | hsi_unregister_client_driver(&hsc_driver); | ||
795 | pr_info("HSI char device removed\n"); | ||
796 | } | ||
797 | module_exit(hsc_exit); | ||
798 | |||
799 | MODULE_AUTHOR("Andras Domokos <andras.domokos@nokia.com>"); | ||
800 | MODULE_ALIAS("hsi:hsi_char"); | ||
801 | MODULE_DESCRIPTION("HSI character device"); | ||
802 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/hsi/hsi.c b/drivers/hsi/hsi.c new file mode 100644 index 000000000000..2d58f939d27f --- /dev/null +++ b/drivers/hsi/hsi.c | |||
@@ -0,0 +1,507 @@ | |||
1 | /* | ||
2 | * HSI core. | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | #include <linux/hsi/hsi.h> | ||
23 | #include <linux/compiler.h> | ||
24 | #include <linux/list.h> | ||
25 | #include <linux/kobject.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/string.h> | ||
28 | #include <linux/notifier.h> | ||
29 | #include "hsi_core.h" | ||
30 | |||
31 | static ssize_t modalias_show(struct device *dev, | ||
32 | struct device_attribute *a __maybe_unused, char *buf) | ||
33 | { | ||
34 | return sprintf(buf, "hsi:%s\n", dev_name(dev)); | ||
35 | } | ||
36 | |||
37 | static struct device_attribute hsi_bus_dev_attrs[] = { | ||
38 | __ATTR_RO(modalias), | ||
39 | __ATTR_NULL, | ||
40 | }; | ||
41 | |||
42 | static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
43 | { | ||
44 | add_uevent_var(env, "MODALIAS=hsi:%s", dev_name(dev)); | ||
45 | |||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | static int hsi_bus_match(struct device *dev, struct device_driver *driver) | ||
50 | { | ||
51 | return strcmp(dev_name(dev), driver->name) == 0; | ||
52 | } | ||
53 | |||
54 | static struct bus_type hsi_bus_type = { | ||
55 | .name = "hsi", | ||
56 | .dev_attrs = hsi_bus_dev_attrs, | ||
57 | .match = hsi_bus_match, | ||
58 | .uevent = hsi_bus_uevent, | ||
59 | }; | ||
60 | |||
61 | static void hsi_client_release(struct device *dev) | ||
62 | { | ||
63 | kfree(to_hsi_client(dev)); | ||
64 | } | ||
65 | |||
66 | static void hsi_new_client(struct hsi_port *port, struct hsi_board_info *info) | ||
67 | { | ||
68 | struct hsi_client *cl; | ||
69 | |||
70 | cl = kzalloc(sizeof(*cl), GFP_KERNEL); | ||
71 | if (!cl) | ||
72 | return; | ||
73 | cl->tx_cfg = info->tx_cfg; | ||
74 | cl->rx_cfg = info->rx_cfg; | ||
75 | cl->device.bus = &hsi_bus_type; | ||
76 | cl->device.parent = &port->device; | ||
77 | cl->device.release = hsi_client_release; | ||
78 | dev_set_name(&cl->device, info->name); | ||
79 | cl->device.platform_data = info->platform_data; | ||
80 | if (info->archdata) | ||
81 | cl->device.archdata = *info->archdata; | ||
82 | if (device_register(&cl->device) < 0) { | ||
83 | pr_err("hsi: failed to register client: %s\n", info->name); | ||
84 | put_device(&cl->device); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | static void hsi_scan_board_info(struct hsi_controller *hsi) | ||
89 | { | ||
90 | struct hsi_cl_info *cl_info; | ||
91 | struct hsi_port *p; | ||
92 | |||
93 | list_for_each_entry(cl_info, &hsi_board_list, list) | ||
94 | if (cl_info->info.hsi_id == hsi->id) { | ||
95 | p = hsi_find_port_num(hsi, cl_info->info.port); | ||
96 | if (!p) | ||
97 | continue; | ||
98 | hsi_new_client(p, &cl_info->info); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | static int hsi_remove_client(struct device *dev, void *data __maybe_unused) | ||
103 | { | ||
104 | device_unregister(dev); | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | static int hsi_remove_port(struct device *dev, void *data __maybe_unused) | ||
110 | { | ||
111 | device_for_each_child(dev, NULL, hsi_remove_client); | ||
112 | device_unregister(dev); | ||
113 | |||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static void hsi_controller_release(struct device *dev) | ||
118 | { | ||
119 | struct hsi_controller *hsi = to_hsi_controller(dev); | ||
120 | |||
121 | kfree(hsi->port); | ||
122 | kfree(hsi); | ||
123 | } | ||
124 | |||
125 | static void hsi_port_release(struct device *dev) | ||
126 | { | ||
127 | kfree(to_hsi_port(dev)); | ||
128 | } | ||
129 | |||
130 | /** | ||
131 | * hsi_unregister_controller - Unregister an HSI controller | ||
132 | * @hsi: The HSI controller to register | ||
133 | */ | ||
134 | void hsi_unregister_controller(struct hsi_controller *hsi) | ||
135 | { | ||
136 | device_for_each_child(&hsi->device, NULL, hsi_remove_port); | ||
137 | device_unregister(&hsi->device); | ||
138 | } | ||
139 | EXPORT_SYMBOL_GPL(hsi_unregister_controller); | ||
140 | |||
141 | /** | ||
142 | * hsi_register_controller - Register an HSI controller and its ports | ||
143 | * @hsi: The HSI controller to register | ||
144 | * | ||
145 | * Returns -errno on failure, 0 on success. | ||
146 | */ | ||
147 | int hsi_register_controller(struct hsi_controller *hsi) | ||
148 | { | ||
149 | unsigned int i; | ||
150 | int err; | ||
151 | |||
152 | err = device_add(&hsi->device); | ||
153 | if (err < 0) | ||
154 | return err; | ||
155 | for (i = 0; i < hsi->num_ports; i++) { | ||
156 | hsi->port[i]->device.parent = &hsi->device; | ||
157 | err = device_add(&hsi->port[i]->device); | ||
158 | if (err < 0) | ||
159 | goto out; | ||
160 | } | ||
161 | /* Populate HSI bus with HSI clients */ | ||
162 | hsi_scan_board_info(hsi); | ||
163 | |||
164 | return 0; | ||
165 | out: | ||
166 | while (i-- > 0) | ||
167 | device_del(&hsi->port[i]->device); | ||
168 | device_del(&hsi->device); | ||
169 | |||
170 | return err; | ||
171 | } | ||
172 | EXPORT_SYMBOL_GPL(hsi_register_controller); | ||
173 | |||
174 | /** | ||
175 | * hsi_register_client_driver - Register an HSI client to the HSI bus | ||
176 | * @drv: HSI client driver to register | ||
177 | * | ||
178 | * Returns -errno on failure, 0 on success. | ||
179 | */ | ||
180 | int hsi_register_client_driver(struct hsi_client_driver *drv) | ||
181 | { | ||
182 | drv->driver.bus = &hsi_bus_type; | ||
183 | |||
184 | return driver_register(&drv->driver); | ||
185 | } | ||
186 | EXPORT_SYMBOL_GPL(hsi_register_client_driver); | ||
187 | |||
188 | static inline int hsi_dummy_msg(struct hsi_msg *msg __maybe_unused) | ||
189 | { | ||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) | ||
194 | { | ||
195 | return 0; | ||
196 | } | ||
197 | |||
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 | /** | ||
222 | * hsi_alloc_controller - Allocate an HSI controller and its ports | ||
223 | * @n_ports: Number of ports on the HSI controller | ||
224 | * @flags: Kernel allocation flags | ||
225 | * | ||
226 | * Return NULL on failure or a pointer to an hsi_controller on success. | ||
227 | */ | ||
228 | struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags) | ||
229 | { | ||
230 | struct hsi_controller *hsi; | ||
231 | struct hsi_port **port; | ||
232 | unsigned int i; | ||
233 | |||
234 | if (!n_ports) | ||
235 | return NULL; | ||
236 | |||
237 | hsi = kzalloc(sizeof(*hsi), flags); | ||
238 | if (!hsi) | ||
239 | return NULL; | ||
240 | port = kzalloc(sizeof(*port)*n_ports, flags); | ||
241 | if (!port) { | ||
242 | kfree(hsi); | ||
243 | return NULL; | ||
244 | } | ||
245 | hsi->num_ports = n_ports; | ||
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 | } | ||
267 | |||
268 | return hsi; | ||
269 | out: | ||
270 | hsi_put_controller(hsi); | ||
271 | |||
272 | return NULL; | ||
273 | } | ||
274 | EXPORT_SYMBOL_GPL(hsi_alloc_controller); | ||
275 | |||
276 | /** | ||
277 | * hsi_free_msg - Free an HSI message | ||
278 | * @msg: Pointer to the HSI message | ||
279 | * | ||
280 | * Client is responsible to free the buffers pointed by the scatterlists. | ||
281 | */ | ||
282 | void hsi_free_msg(struct hsi_msg *msg) | ||
283 | { | ||
284 | if (!msg) | ||
285 | return; | ||
286 | sg_free_table(&msg->sgt); | ||
287 | kfree(msg); | ||
288 | } | ||
289 | EXPORT_SYMBOL_GPL(hsi_free_msg); | ||
290 | |||
291 | /** | ||
292 | * hsi_alloc_msg - Allocate an HSI message | ||
293 | * @nents: Number of memory entries | ||
294 | * @flags: Kernel allocation flags | ||
295 | * | ||
296 | * nents can be 0. This mainly makes sense for read transfer. | ||
297 | * In that case, HSI drivers will call the complete callback when | ||
298 | * there is data to be read without consuming it. | ||
299 | * | ||
300 | * Return NULL on failure or a pointer to an hsi_msg on success. | ||
301 | */ | ||
302 | struct hsi_msg *hsi_alloc_msg(unsigned int nents, gfp_t flags) | ||
303 | { | ||
304 | struct hsi_msg *msg; | ||
305 | int err; | ||
306 | |||
307 | msg = kzalloc(sizeof(*msg), flags); | ||
308 | if (!msg) | ||
309 | return NULL; | ||
310 | |||
311 | if (!nents) | ||
312 | return msg; | ||
313 | |||
314 | err = sg_alloc_table(&msg->sgt, nents, flags); | ||
315 | if (unlikely(err)) { | ||
316 | kfree(msg); | ||
317 | msg = NULL; | ||
318 | } | ||
319 | |||
320 | return msg; | ||
321 | } | ||
322 | EXPORT_SYMBOL_GPL(hsi_alloc_msg); | ||
323 | |||
324 | /** | ||
325 | * hsi_async - Submit an HSI transfer to the controller | ||
326 | * @cl: HSI client sending the transfer | ||
327 | * @msg: The HSI transfer passed to controller | ||
328 | * | ||
329 | * The HSI message must have the channel, ttype, complete and destructor | ||
330 | * fields set beforehand. If nents > 0 then the client has to initialize | ||
331 | * also the scatterlists to point to the buffers to write to or read from. | ||
332 | * | ||
333 | * HSI controllers relay on pre-allocated buffers from their clients and they | ||
334 | * do not allocate buffers on their own. | ||
335 | * | ||
336 | * Once the HSI message transfer finishes, the HSI controller calls the | ||
337 | * complete callback with the status and actual_len fields of the HSI message | ||
338 | * updated. The complete callback can be called before returning from | ||
339 | * hsi_async. | ||
340 | * | ||
341 | * Returns -errno on failure or 0 on success | ||
342 | */ | ||
343 | int hsi_async(struct hsi_client *cl, struct hsi_msg *msg) | ||
344 | { | ||
345 | struct hsi_port *port = hsi_get_port(cl); | ||
346 | |||
347 | if (!hsi_port_claimed(cl)) | ||
348 | return -EACCES; | ||
349 | |||
350 | WARN_ON_ONCE(!msg->destructor || !msg->complete); | ||
351 | msg->cl = cl; | ||
352 | |||
353 | return port->async(msg); | ||
354 | } | ||
355 | EXPORT_SYMBOL_GPL(hsi_async); | ||
356 | |||
357 | /** | ||
358 | * hsi_claim_port - Claim the HSI client's port | ||
359 | * @cl: HSI client that wants to claim its port | ||
360 | * @share: Flag to indicate if the client wants to share the port or not. | ||
361 | * | ||
362 | * Returns -errno on failure, 0 on success. | ||
363 | */ | ||
364 | int hsi_claim_port(struct hsi_client *cl, unsigned int share) | ||
365 | { | ||
366 | struct hsi_port *port = hsi_get_port(cl); | ||
367 | int err = 0; | ||
368 | |||
369 | mutex_lock(&port->lock); | ||
370 | if ((port->claimed) && (!port->shared || !share)) { | ||
371 | err = -EBUSY; | ||
372 | goto out; | ||
373 | } | ||
374 | if (!try_module_get(to_hsi_controller(port->device.parent)->owner)) { | ||
375 | err = -ENODEV; | ||
376 | goto out; | ||
377 | } | ||
378 | port->claimed++; | ||
379 | port->shared = !!share; | ||
380 | cl->pclaimed = 1; | ||
381 | out: | ||
382 | mutex_unlock(&port->lock); | ||
383 | |||
384 | return err; | ||
385 | } | ||
386 | EXPORT_SYMBOL_GPL(hsi_claim_port); | ||
387 | |||
388 | /** | ||
389 | * hsi_release_port - Release the HSI client's port | ||
390 | * @cl: HSI client which previously claimed its port | ||
391 | */ | ||
392 | void hsi_release_port(struct hsi_client *cl) | ||
393 | { | ||
394 | struct hsi_port *port = hsi_get_port(cl); | ||
395 | |||
396 | mutex_lock(&port->lock); | ||
397 | /* Allow HW driver to do some cleanup */ | ||
398 | port->release(cl); | ||
399 | if (cl->pclaimed) | ||
400 | port->claimed--; | ||
401 | BUG_ON(port->claimed < 0); | ||
402 | cl->pclaimed = 0; | ||
403 | if (!port->claimed) | ||
404 | port->shared = 0; | ||
405 | module_put(to_hsi_controller(port->device.parent)->owner); | ||
406 | mutex_unlock(&port->lock); | ||
407 | } | ||
408 | EXPORT_SYMBOL_GPL(hsi_release_port); | ||
409 | |||
410 | static int hsi_event_notifier_call(struct notifier_block *nb, | ||
411 | unsigned long event, void *data __maybe_unused) | ||
412 | { | ||
413 | struct hsi_client *cl = container_of(nb, struct hsi_client, nb); | ||
414 | |||
415 | (*cl->ehandler)(cl, event); | ||
416 | |||
417 | return 0; | ||
418 | } | ||
419 | |||
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)) | ||
434 | { | ||
435 | struct hsi_port *port = hsi_get_port(cl); | ||
436 | |||
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); | ||
445 | } | ||
446 | EXPORT_SYMBOL_GPL(hsi_register_port_event); | ||
447 | |||
448 | /** | ||
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) | ||
458 | { | ||
459 | struct hsi_port *port = hsi_get_port(cl); | ||
460 | int err; | ||
461 | |||
462 | WARN_ON(!hsi_port_claimed(cl)); | ||
463 | |||
464 | err = atomic_notifier_chain_unregister(&port->n_head, &cl->nb); | ||
465 | if (!err) | ||
466 | cl->ehandler = NULL; | ||
467 | |||
468 | return err; | ||
469 | } | ||
470 | EXPORT_SYMBOL_GPL(hsi_unregister_port_event); | ||
471 | |||
472 | /** | ||
473 | * hsi_event -Notifies clients about port events | ||
474 | * @port: Port where the event occurred | ||
475 | * @event: The event type | ||
476 | * | ||
477 | * Clients should not be concerned about wake line behavior. However, due | ||
478 | * to a race condition in HSI HW protocol, clients need to be notified | ||
479 | * about wake line changes, so they can implement a workaround for it. | ||
480 | * | ||
481 | * Events: | ||
482 | * HSI_EVENT_START_RX - Incoming wake line high | ||
483 | * HSI_EVENT_STOP_RX - Incoming wake line down | ||
484 | * | ||
485 | * Returns -errno on error, or 0 on success. | ||
486 | */ | ||
487 | int hsi_event(struct hsi_port *port, unsigned long event) | ||
488 | { | ||
489 | return atomic_notifier_call_chain(&port->n_head, event, NULL); | ||
490 | } | ||
491 | EXPORT_SYMBOL_GPL(hsi_event); | ||
492 | |||
493 | static int __init hsi_init(void) | ||
494 | { | ||
495 | return bus_register(&hsi_bus_type); | ||
496 | } | ||
497 | postcore_initcall(hsi_init); | ||
498 | |||
499 | static void __exit hsi_exit(void) | ||
500 | { | ||
501 | bus_unregister(&hsi_bus_type); | ||
502 | } | ||
503 | module_exit(hsi_exit); | ||
504 | |||
505 | MODULE_AUTHOR("Carlos Chinea <carlos.chinea@nokia.com>"); | ||
506 | MODULE_DESCRIPTION("High-speed Synchronous Serial Interface (HSI) framework"); | ||
507 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/hsi/hsi_boardinfo.c b/drivers/hsi/hsi_boardinfo.c new file mode 100644 index 000000000000..e56bc6da5f98 --- /dev/null +++ b/drivers/hsi/hsi_boardinfo.c | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * HSI clients registration interface | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | #include <linux/hsi/hsi.h> | ||
23 | #include <linux/list.h> | ||
24 | #include <linux/slab.h> | ||
25 | #include "hsi_core.h" | ||
26 | |||
27 | /* | ||
28 | * hsi_board_list is only used internally by the HSI framework. | ||
29 | * No one else is allowed to make use of it. | ||
30 | */ | ||
31 | LIST_HEAD(hsi_board_list); | ||
32 | EXPORT_SYMBOL_GPL(hsi_board_list); | ||
33 | |||
34 | /** | ||
35 | * hsi_register_board_info - Register HSI clients information | ||
36 | * @info: Array of HSI clients on the board | ||
37 | * @len: Length of the array | ||
38 | * | ||
39 | * HSI clients are statically declared and registered on board files. | ||
40 | * | ||
41 | * HSI clients will be automatically registered to the HSI bus once the | ||
42 | * controller and the port where the clients wishes to attach are registered | ||
43 | * to it. | ||
44 | * | ||
45 | * Return -errno on failure, 0 on success. | ||
46 | */ | ||
47 | int __init hsi_register_board_info(struct hsi_board_info const *info, | ||
48 | unsigned int len) | ||
49 | { | ||
50 | struct hsi_cl_info *cl_info; | ||
51 | |||
52 | cl_info = kzalloc(sizeof(*cl_info) * len, GFP_KERNEL); | ||
53 | if (!cl_info) | ||
54 | return -ENOMEM; | ||
55 | |||
56 | for (; len; len--, info++, cl_info++) { | ||
57 | cl_info->info = *info; | ||
58 | list_add_tail(&cl_info->list, &hsi_board_list); | ||
59 | } | ||
60 | |||
61 | return 0; | ||
62 | } | ||
diff --git a/drivers/hsi/hsi_core.h b/drivers/hsi/hsi_core.h new file mode 100644 index 000000000000..ab5c2fb175fd --- /dev/null +++ b/drivers/hsi/hsi_core.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * HSI framework internal interfaces, | ||
3 | * | ||
4 | * Copyright (C) 2010 Nokia Corporation. All rights reserved. | ||
5 | * | ||
6 | * Contact: Carlos Chinea <carlos.chinea@nokia.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * version 2 as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
20 | * 02110-1301 USA | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_HSI_CORE_H__ | ||
24 | #define __LINUX_HSI_CORE_H__ | ||
25 | |||
26 | #include <linux/hsi/hsi.h> | ||
27 | |||
28 | struct hsi_cl_info { | ||
29 | struct list_head list; | ||
30 | struct hsi_board_info info; | ||
31 | }; | ||
32 | |||
33 | extern struct list_head hsi_board_list; | ||
34 | |||
35 | #endif /* __LINUX_HSI_CORE_H__ */ | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 5b32d56dbb4d..8deedc1b9840 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -253,7 +253,8 @@ config SENSORS_K10TEMP | |||
253 | If you say yes here you get support for the temperature | 253 | If you say yes here you get support for the temperature |
254 | sensor(s) inside your CPU. Supported are later revisions of | 254 | sensor(s) inside your CPU. Supported are later revisions of |
255 | the AMD Family 10h and all revisions of the AMD Family 11h, | 255 | the AMD Family 10h and all revisions of the AMD Family 11h, |
256 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer) microarchitectures. | 256 | 12h (Llano), 14h (Brazos) and 15h (Bulldozer/Trinity) |
257 | microarchitectures. | ||
257 | 258 | ||
258 | This driver can also be built as a module. If so, the module | 259 | This driver can also be built as a module. If so, the module |
259 | will be called k10temp. | 260 | will be called k10temp. |
@@ -425,7 +426,7 @@ config SENSORS_GL520SM | |||
425 | 426 | ||
426 | config SENSORS_GPIO_FAN | 427 | config SENSORS_GPIO_FAN |
427 | tristate "GPIO fan" | 428 | tristate "GPIO fan" |
428 | depends on GENERIC_GPIO | 429 | depends on GPIOLIB |
429 | help | 430 | help |
430 | If you say yes here you get support for fans connected to GPIO lines. | 431 | If you say yes here you get support for fans connected to GPIO lines. |
431 | 432 | ||
@@ -883,7 +884,7 @@ source drivers/hwmon/pmbus/Kconfig | |||
883 | 884 | ||
884 | config SENSORS_SHT15 | 885 | config SENSORS_SHT15 |
885 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." | 886 | tristate "Sensiron humidity and temperature sensors. SHT15 and compat." |
886 | depends on GENERIC_GPIO | 887 | depends on GPIOLIB |
887 | help | 888 | help |
888 | If you say yes here you get support for the Sensiron SHT10, SHT11, | 889 | If you say yes here you get support for the Sensiron SHT10, SHT11, |
889 | SHT15, SHT71, SHT75 humidity and temperature sensors. | 890 | SHT15, SHT71, SHT75 humidity and temperature sensors. |
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c index 554f046bcf20..9140236a0182 100644 --- a/drivers/hwmon/acpi_power_meter.c +++ b/drivers/hwmon/acpi_power_meter.c | |||
@@ -391,6 +391,7 @@ static ssize_t show_str(struct device *dev, | |||
391 | break; | 391 | break; |
392 | default: | 392 | default: |
393 | BUG(); | 393 | BUG(); |
394 | val = ""; | ||
394 | } | 395 | } |
395 | 396 | ||
396 | return sprintf(buf, "%s\n", val); | 397 | return sprintf(buf, "%s\n", val); |
@@ -632,6 +633,7 @@ static int register_ro_attrs(struct acpi_power_meter_resource *resource, | |||
632 | sensors->dev_attr.show = ro->show; | 633 | sensors->dev_attr.show = ro->show; |
633 | sensors->index = ro->index; | 634 | sensors->index = ro->index; |
634 | 635 | ||
636 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
635 | res = device_create_file(dev, &sensors->dev_attr); | 637 | res = device_create_file(dev, &sensors->dev_attr); |
636 | if (res) { | 638 | if (res) { |
637 | sensors->dev_attr.attr.name = NULL; | 639 | sensors->dev_attr.attr.name = NULL; |
@@ -661,6 +663,7 @@ static int register_rw_attrs(struct acpi_power_meter_resource *resource, | |||
661 | sensors->dev_attr.store = rw->set; | 663 | sensors->dev_attr.store = rw->set; |
662 | sensors->index = rw->index; | 664 | sensors->index = rw->index; |
663 | 665 | ||
666 | sysfs_attr_init(&sensors->dev_attr.attr); | ||
664 | res = device_create_file(dev, &sensors->dev_attr); | 667 | res = device_create_file(dev, &sensors->dev_attr); |
665 | if (res) { | 668 | if (res) { |
666 | sensors->dev_attr.attr.name = NULL; | 669 | sensors->dev_attr.attr.name = NULL; |
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c index 0e0cfcc36f8d..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", |
@@ -128,6 +126,7 @@ static int __devinit ad7314_probe(struct spi_device *spi_dev) | |||
128 | ret = PTR_ERR(chip->hwmon_dev); | 126 | ret = PTR_ERR(chip->hwmon_dev); |
129 | goto error_remove_group; | 127 | goto error_remove_group; |
130 | } | 128 | } |
129 | chip->spi_dev = spi_dev; | ||
131 | 130 | ||
132 | return 0; | 131 | return 0; |
133 | error_remove_group: | 132 | error_remove_group: |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index ff37363ea5bc..44e1fd7f3d81 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -233,18 +233,15 @@ static const auto_chan_table_t auto_channel_select_table_adm1030 = { | |||
233 | * nearest match if no exact match where found. | 233 | * nearest match if no exact match where found. |
234 | */ | 234 | */ |
235 | static int | 235 | static int |
236 | get_fan_auto_nearest(struct adm1031_data *data, | 236 | get_fan_auto_nearest(struct adm1031_data *data, int chan, u8 val, u8 reg) |
237 | int chan, u8 val, u8 reg, u8 *new_reg) | ||
238 | { | 237 | { |
239 | int i; | 238 | int i; |
240 | int first_match = -1, exact_match = -1; | 239 | int first_match = -1, exact_match = -1; |
241 | u8 other_reg_val = | 240 | u8 other_reg_val = |
242 | (*data->chan_select_table)[FAN_CHAN_FROM_REG(reg)][chan ? 0 : 1]; | 241 | (*data->chan_select_table)[FAN_CHAN_FROM_REG(reg)][chan ? 0 : 1]; |
243 | 242 | ||
244 | if (val == 0) { | 243 | if (val == 0) |
245 | *new_reg = 0; | ||
246 | return 0; | 244 | return 0; |
247 | } | ||
248 | 245 | ||
249 | for (i = 0; i < 8; i++) { | 246 | for (i = 0; i < 8; i++) { |
250 | if ((val == (*data->chan_select_table)[i][chan]) && | 247 | if ((val == (*data->chan_select_table)[i][chan]) && |
@@ -264,13 +261,11 @@ get_fan_auto_nearest(struct adm1031_data *data, | |||
264 | } | 261 | } |
265 | 262 | ||
266 | if (exact_match >= 0) | 263 | if (exact_match >= 0) |
267 | *new_reg = exact_match; | 264 | return exact_match; |
268 | else if (first_match >= 0) | 265 | else if (first_match >= 0) |
269 | *new_reg = first_match; | 266 | return first_match; |
270 | else | ||
271 | return -EINVAL; | ||
272 | 267 | ||
273 | return 0; | 268 | return -EINVAL; |
274 | } | 269 | } |
275 | 270 | ||
276 | static ssize_t show_fan_auto_channel(struct device *dev, | 271 | static ssize_t show_fan_auto_channel(struct device *dev, |
@@ -301,11 +296,12 @@ set_fan_auto_channel(struct device *dev, struct device_attribute *attr, | |||
301 | 296 | ||
302 | mutex_lock(&data->update_lock); | 297 | mutex_lock(&data->update_lock); |
303 | 298 | ||
304 | ret = get_fan_auto_nearest(data, nr, val, data->conf1, ®); | 299 | ret = get_fan_auto_nearest(data, nr, val, data->conf1); |
305 | if (ret) { | 300 | if (ret < 0) { |
306 | mutex_unlock(&data->update_lock); | 301 | mutex_unlock(&data->update_lock); |
307 | return ret; | 302 | return ret; |
308 | } | 303 | } |
304 | reg = ret; | ||
309 | data->conf1 = FAN_CHAN_TO_REG(reg, data->conf1); | 305 | data->conf1 = FAN_CHAN_TO_REG(reg, data->conf1); |
310 | if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) ^ | 306 | if ((data->conf1 & ADM1031_CONF1_AUTO_MODE) ^ |
311 | (old_fan_mode & ADM1031_CONF1_AUTO_MODE)) { | 307 | (old_fan_mode & ADM1031_CONF1_AUTO_MODE)) { |
diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c index 7765e4f74ec5..1958f03efd7a 100644 --- a/drivers/hwmon/ads1015.c +++ b/drivers/hwmon/ads1015.c | |||
@@ -59,14 +59,11 @@ struct ads1015_data { | |||
59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; | 59 | struct ads1015_channel_data channel_data[ADS1015_CHANNELS]; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | 62 | static int ads1015_read_adc(struct i2c_client *client, unsigned int channel) |
63 | int *value) | ||
64 | { | 63 | { |
65 | u16 config; | 64 | u16 config; |
66 | s16 conversion; | ||
67 | struct ads1015_data *data = i2c_get_clientdata(client); | 65 | struct ads1015_data *data = i2c_get_clientdata(client); |
68 | unsigned int pga = data->channel_data[channel].pga; | 66 | unsigned int pga = data->channel_data[channel].pga; |
69 | int fullscale; | ||
70 | unsigned int data_rate = data->channel_data[channel].data_rate; | 67 | unsigned int data_rate = data->channel_data[channel].data_rate; |
71 | unsigned int conversion_time_ms; | 68 | unsigned int conversion_time_ms; |
72 | int res; | 69 | int res; |
@@ -78,7 +75,6 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
78 | if (res < 0) | 75 | if (res < 0) |
79 | goto err_unlock; | 76 | goto err_unlock; |
80 | config = res; | 77 | config = res; |
81 | fullscale = fullscale_table[pga]; | ||
82 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); | 78 | conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]); |
83 | 79 | ||
84 | /* setup and start single conversion */ | 80 | /* setup and start single conversion */ |
@@ -105,33 +101,36 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel, | |||
105 | } | 101 | } |
106 | 102 | ||
107 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); | 103 | res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION); |
108 | if (res < 0) | ||
109 | goto err_unlock; | ||
110 | conversion = res; | ||
111 | |||
112 | mutex_unlock(&data->update_lock); | ||
113 | |||
114 | *value = DIV_ROUND_CLOSEST(conversion * fullscale, 0x7ff0); | ||
115 | |||
116 | return 0; | ||
117 | 104 | ||
118 | err_unlock: | 105 | err_unlock: |
119 | mutex_unlock(&data->update_lock); | 106 | mutex_unlock(&data->update_lock); |
120 | return res; | 107 | return res; |
121 | } | 108 | } |
122 | 109 | ||
110 | static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel, | ||
111 | s16 reg) | ||
112 | { | ||
113 | struct ads1015_data *data = i2c_get_clientdata(client); | ||
114 | unsigned int pga = data->channel_data[channel].pga; | ||
115 | int fullscale = fullscale_table[pga]; | ||
116 | |||
117 | return DIV_ROUND_CLOSEST(reg * fullscale, 0x7ff0); | ||
118 | } | ||
119 | |||
123 | /* sysfs callback function */ | 120 | /* sysfs callback function */ |
124 | static ssize_t show_in(struct device *dev, struct device_attribute *da, | 121 | static ssize_t show_in(struct device *dev, struct device_attribute *da, |
125 | char *buf) | 122 | char *buf) |
126 | { | 123 | { |
127 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 124 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
128 | struct i2c_client *client = to_i2c_client(dev); | 125 | struct i2c_client *client = to_i2c_client(dev); |
129 | int in; | ||
130 | int res; | 126 | int res; |
127 | int index = attr->index; | ||
131 | 128 | ||
132 | res = ads1015_read_value(client, attr->index, &in); | 129 | res = ads1015_read_adc(client, index); |
130 | if (res < 0) | ||
131 | return res; | ||
133 | 132 | ||
134 | return (res < 0) ? res : sprintf(buf, "%d\n", in); | 133 | return sprintf(buf, "%d\n", ads1015_reg_to_mv(client, index, res)); |
135 | } | 134 | } |
136 | 135 | ||
137 | static const struct sensor_device_attribute ads1015_in[] = { | 136 | static const struct sensor_device_attribute ads1015_in[] = { |
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 0d3141fbbc20..b9d512331ed4 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -52,7 +52,7 @@ module_param_named(tjmax, force_tjmax, int, 0444); | |||
52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); | 52 | MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius"); |
53 | 53 | ||
54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ | 54 | #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */ |
55 | #define NUM_REAL_CORES 16 /* Number of Real cores per cpu */ | 55 | #define NUM_REAL_CORES 32 /* Number of Real cores per cpu */ |
56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ | 56 | #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */ |
57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ | 57 | #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */ |
58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) | 58 | #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1) |
@@ -709,6 +709,10 @@ static void __cpuinit put_core_offline(unsigned int cpu) | |||
709 | 709 | ||
710 | indx = TO_ATTR_NO(cpu); | 710 | indx = TO_ATTR_NO(cpu); |
711 | 711 | ||
712 | /* The core id is too big, just return */ | ||
713 | if (indx > MAX_CORE_DATA - 1) | ||
714 | return; | ||
715 | |||
712 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) | 716 | if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu) |
713 | coretemp_remove_core(pdata, &pdev->dev, indx); | 717 | coretemp_remove_core(pdata, &pdev->dev, indx); |
714 | 718 | ||
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 729499e75210..ece4159bd453 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -276,6 +276,7 @@ static bool duty_mode_enabled(u8 pwm_enable) | |||
276 | return false; | 276 | return false; |
277 | default: | 277 | default: |
278 | BUG(); | 278 | BUG(); |
279 | return true; | ||
279 | } | 280 | } |
280 | } | 281 | } |
281 | 282 | ||
@@ -291,6 +292,7 @@ static bool auto_mode_enabled(u8 pwm_enable) | |||
291 | return true; | 292 | return true; |
292 | default: | 293 | default: |
293 | BUG(); | 294 | BUG(); |
295 | return false; | ||
294 | } | 296 | } |
295 | } | 297 | } |
296 | 298 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index b7494af1e4a9..e8e18cab1fb8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -122,6 +122,41 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
122 | return true; | 122 | return true; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* | ||
126 | * Newer BKDG versions have an updated recommendation on how to properly | ||
127 | * initialize the running average range (was: 0xE, now: 0x9). This avoids | ||
128 | * counter saturations resulting in bogus power readings. | ||
129 | * We correct this value ourselves to cope with older BIOSes. | ||
130 | */ | ||
131 | static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | ||
132 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | ||
133 | { 0 } | ||
134 | }; | ||
135 | |||
136 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | ||
137 | { | ||
138 | u32 val; | ||
139 | |||
140 | /* | ||
141 | * let this quirk apply only to the current version of the | ||
142 | * northbridge, since future versions may change the behavior | ||
143 | */ | ||
144 | if (!pci_match_id(affected_device, pdev)) | ||
145 | return; | ||
146 | |||
147 | pci_bus_read_config_dword(pdev->bus, | ||
148 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
149 | REG_TDP_RUNNING_AVERAGE, &val); | ||
150 | if ((val & 0xf) != 0xe) | ||
151 | return; | ||
152 | |||
153 | val &= ~0xf; | ||
154 | val |= 0x9; | ||
155 | pci_bus_write_config_dword(pdev->bus, | ||
156 | PCI_DEVFN(PCI_SLOT(pdev->devfn), 5), | ||
157 | REG_TDP_RUNNING_AVERAGE, val); | ||
158 | } | ||
159 | |||
125 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 160 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
126 | struct fam15h_power_data *data) | 161 | struct fam15h_power_data *data) |
127 | { | 162 | { |
@@ -155,6 +190,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev, | |||
155 | struct device *dev; | 190 | struct device *dev; |
156 | int err; | 191 | int err; |
157 | 192 | ||
193 | /* | ||
194 | * though we ignore every other northbridge, we still have to | ||
195 | * do the tweaking on _each_ node in MCM processors as the counters | ||
196 | * are working hand-in-hand | ||
197 | */ | ||
198 | tweak_runavg_range(pdev); | ||
199 | |||
158 | if (!fam15h_power_is_internal_node0(pdev)) { | 200 | if (!fam15h_power_is_internal_node0(pdev)) { |
159 | err = -ENODEV; | 201 | err = -ENODEV; |
160 | goto exit; | 202 | goto exit; |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index aba29d63f195..307bb325dde9 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -33,6 +33,9 @@ static bool force; | |||
33 | module_param(force, bool, 0444); | 33 | module_param(force, bool, 0444); |
34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); | 34 | MODULE_PARM_DESC(force, "force loading on processors with erratum 319"); |
35 | 35 | ||
36 | /* PCI-IDs for Northbridge devices not used anywhere else */ | ||
37 | #define PCI_DEVICE_ID_AMD_15H_M10H_NB_F3 0x1403 | ||
38 | |||
36 | /* CPUID function 0x80000001, ebx */ | 39 | /* CPUID function 0x80000001, ebx */ |
37 | #define CPUID_PKGTYPE_MASK 0xf0000000 | 40 | #define CPUID_PKGTYPE_MASK 0xf0000000 |
38 | #define CPUID_PKGTYPE_F 0x00000000 | 41 | #define CPUID_PKGTYPE_F 0x00000000 |
@@ -210,6 +213,7 @@ static DEFINE_PCI_DEVICE_TABLE(k10temp_id_table) = { | |||
210 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, | 213 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, |
211 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, | 214 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, |
212 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, | 215 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F3) }, |
216 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M10H_NB_F3) }, | ||
213 | {} | 217 | {} |
214 | }; | 218 | }; |
215 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); | 219 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); |
diff --git a/drivers/hwmon/max6639.c b/drivers/hwmon/max6639.c index 193067e27b6f..de8f7adaccbd 100644 --- a/drivers/hwmon/max6639.c +++ b/drivers/hwmon/max6639.c | |||
@@ -596,8 +596,10 @@ static int max6639_remove(struct i2c_client *client) | |||
596 | return 0; | 596 | return 0; |
597 | } | 597 | } |
598 | 598 | ||
599 | static int max6639_suspend(struct i2c_client *client, pm_message_t mesg) | 599 | #ifdef CONFIG_PM_SLEEP |
600 | static int max6639_suspend(struct device *dev) | ||
600 | { | 601 | { |
602 | struct i2c_client *client = to_i2c_client(dev); | ||
601 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); | 603 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); |
602 | if (data < 0) | 604 | if (data < 0) |
603 | return data; | 605 | return data; |
@@ -606,8 +608,9 @@ static int max6639_suspend(struct i2c_client *client, pm_message_t mesg) | |||
606 | MAX6639_REG_GCONFIG, data | MAX6639_GCONFIG_STANDBY); | 608 | MAX6639_REG_GCONFIG, data | MAX6639_GCONFIG_STANDBY); |
607 | } | 609 | } |
608 | 610 | ||
609 | static int max6639_resume(struct i2c_client *client) | 611 | static int max6639_resume(struct device *dev) |
610 | { | 612 | { |
613 | struct i2c_client *client = to_i2c_client(dev); | ||
611 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); | 614 | int data = i2c_smbus_read_byte_data(client, MAX6639_REG_GCONFIG); |
612 | if (data < 0) | 615 | if (data < 0) |
613 | return data; | 616 | return data; |
@@ -615,6 +618,7 @@ static int max6639_resume(struct i2c_client *client) | |||
615 | return i2c_smbus_write_byte_data(client, | 618 | return i2c_smbus_write_byte_data(client, |
616 | MAX6639_REG_GCONFIG, data & ~MAX6639_GCONFIG_STANDBY); | 619 | MAX6639_REG_GCONFIG, data & ~MAX6639_GCONFIG_STANDBY); |
617 | } | 620 | } |
621 | #endif /* CONFIG_PM_SLEEP */ | ||
618 | 622 | ||
619 | static const struct i2c_device_id max6639_id[] = { | 623 | static const struct i2c_device_id max6639_id[] = { |
620 | {"max6639", 0}, | 624 | {"max6639", 0}, |
@@ -623,15 +627,18 @@ static const struct i2c_device_id max6639_id[] = { | |||
623 | 627 | ||
624 | MODULE_DEVICE_TABLE(i2c, max6639_id); | 628 | MODULE_DEVICE_TABLE(i2c, max6639_id); |
625 | 629 | ||
630 | static const struct dev_pm_ops max6639_pm_ops = { | ||
631 | SET_SYSTEM_SLEEP_PM_OPS(max6639_suspend, max6639_resume) | ||
632 | }; | ||
633 | |||
626 | static struct i2c_driver max6639_driver = { | 634 | static struct i2c_driver max6639_driver = { |
627 | .class = I2C_CLASS_HWMON, | 635 | .class = I2C_CLASS_HWMON, |
628 | .driver = { | 636 | .driver = { |
629 | .name = "max6639", | 637 | .name = "max6639", |
638 | .pm = &max6639_pm_ops, | ||
630 | }, | 639 | }, |
631 | .probe = max6639_probe, | 640 | .probe = max6639_probe, |
632 | .remove = max6639_remove, | 641 | .remove = max6639_remove, |
633 | .suspend = max6639_suspend, | ||
634 | .resume = max6639_resume, | ||
635 | .id_table = max6639_id, | 642 | .id_table = max6639_id, |
636 | .detect = max6639_detect, | 643 | .detect = max6639_detect, |
637 | .address_list = normal_i2c, | 644 | .address_list = normal_i2c, |
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c index be51037363c8..29b319db573e 100644 --- a/drivers/hwmon/pmbus/pmbus_core.c +++ b/drivers/hwmon/pmbus/pmbus_core.c | |||
@@ -710,13 +710,13 @@ static u16 pmbus_data2reg(struct pmbus_data *data, | |||
710 | * If a negative value is stored in any of the referenced registers, this value | 710 | * If a negative value is stored in any of the referenced registers, this value |
711 | * reflects an error code which will be returned. | 711 | * reflects an error code which will be returned. |
712 | */ | 712 | */ |
713 | static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | 713 | static int pmbus_get_boolean(struct pmbus_data *data, int index) |
714 | { | 714 | { |
715 | u8 s1 = (index >> 24) & 0xff; | 715 | u8 s1 = (index >> 24) & 0xff; |
716 | u8 s2 = (index >> 16) & 0xff; | 716 | u8 s2 = (index >> 16) & 0xff; |
717 | u8 reg = (index >> 8) & 0xff; | 717 | u8 reg = (index >> 8) & 0xff; |
718 | u8 mask = index & 0xff; | 718 | u8 mask = index & 0xff; |
719 | int status; | 719 | int ret, status; |
720 | u8 regval; | 720 | u8 regval; |
721 | 721 | ||
722 | status = data->status[reg]; | 722 | status = data->status[reg]; |
@@ -725,7 +725,7 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | |||
725 | 725 | ||
726 | regval = status & mask; | 726 | regval = status & mask; |
727 | if (!s1 && !s2) | 727 | if (!s1 && !s2) |
728 | *val = !!regval; | 728 | ret = !!regval; |
729 | else { | 729 | else { |
730 | long v1, v2; | 730 | long v1, v2; |
731 | struct pmbus_sensor *sensor1, *sensor2; | 731 | struct pmbus_sensor *sensor1, *sensor2; |
@@ -739,9 +739,9 @@ static int pmbus_get_boolean(struct pmbus_data *data, int index, int *val) | |||
739 | 739 | ||
740 | v1 = pmbus_reg2data(data, sensor1); | 740 | v1 = pmbus_reg2data(data, sensor1); |
741 | v2 = pmbus_reg2data(data, sensor2); | 741 | v2 = pmbus_reg2data(data, sensor2); |
742 | *val = !!(regval && v1 >= v2); | 742 | ret = !!(regval && v1 >= v2); |
743 | } | 743 | } |
744 | return 0; | 744 | return ret; |
745 | } | 745 | } |
746 | 746 | ||
747 | static ssize_t pmbus_show_boolean(struct device *dev, | 747 | static ssize_t pmbus_show_boolean(struct device *dev, |
@@ -750,11 +750,10 @@ static ssize_t pmbus_show_boolean(struct device *dev, | |||
750 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | 750 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); |
751 | struct pmbus_data *data = pmbus_update_device(dev); | 751 | struct pmbus_data *data = pmbus_update_device(dev); |
752 | int val; | 752 | int val; |
753 | int err; | ||
754 | 753 | ||
755 | err = pmbus_get_boolean(data, attr->index, &val); | 754 | val = pmbus_get_boolean(data, attr->index); |
756 | if (err) | 755 | if (val < 0) |
757 | return err; | 756 | return val; |
758 | return snprintf(buf, PAGE_SIZE, "%d\n", val); | 757 | return snprintf(buf, PAGE_SIZE, "%d\n", val); |
759 | } | 758 | } |
760 | 759 | ||
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index d3b778da3f86..c5f6be478bad 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -343,10 +343,11 @@ exit: | |||
343 | return err; | 343 | return err; |
344 | } | 344 | } |
345 | 345 | ||
346 | static int __init smsc47b397_find(unsigned short *addr) | 346 | static int __init smsc47b397_find(void) |
347 | { | 347 | { |
348 | u8 id, rev; | 348 | u8 id, rev; |
349 | char *name; | 349 | char *name; |
350 | unsigned short addr; | ||
350 | 351 | ||
351 | superio_enter(); | 352 | superio_enter(); |
352 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 353 | id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
@@ -370,14 +371,14 @@ static int __init smsc47b397_find(unsigned short *addr) | |||
370 | rev = superio_inb(SUPERIO_REG_DEVREV); | 371 | rev = superio_inb(SUPERIO_REG_DEVREV); |
371 | 372 | ||
372 | superio_select(SUPERIO_REG_LD8); | 373 | superio_select(SUPERIO_REG_LD8); |
373 | *addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) | 374 | addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) |
374 | | superio_inb(SUPERIO_REG_BASE_LSB); | 375 | | superio_inb(SUPERIO_REG_BASE_LSB); |
375 | 376 | ||
376 | pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", | 377 | pr_info("found SMSC %s (base address 0x%04x, revision %u)\n", |
377 | name, *addr, rev); | 378 | name, addr, rev); |
378 | 379 | ||
379 | superio_exit(); | 380 | superio_exit(); |
380 | return 0; | 381 | return addr; |
381 | } | 382 | } |
382 | 383 | ||
383 | static int __init smsc47b397_init(void) | 384 | static int __init smsc47b397_init(void) |
@@ -385,9 +386,10 @@ static int __init smsc47b397_init(void) | |||
385 | unsigned short address; | 386 | unsigned short address; |
386 | int ret; | 387 | int ret; |
387 | 388 | ||
388 | ret = smsc47b397_find(&address); | 389 | ret = smsc47b397_find(); |
389 | if (ret) | 390 | if (ret < 0) |
390 | return ret; | 391 | return ret; |
392 | address = ret; | ||
391 | 393 | ||
392 | ret = platform_driver_register(&smsc47b397_driver); | 394 | ret = platform_driver_register(&smsc47b397_driver); |
393 | if (ret) | 395 | if (ret) |
diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index c590c1469793..b5aa38dd7ab9 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c | |||
@@ -491,10 +491,10 @@ static const struct attribute_group smsc47m1_group = { | |||
491 | .attrs = smsc47m1_attributes, | 491 | .attrs = smsc47m1_attributes, |
492 | }; | 492 | }; |
493 | 493 | ||
494 | static int __init smsc47m1_find(unsigned short *addr, | 494 | static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
495 | struct smsc47m1_sio_data *sio_data) | ||
496 | { | 495 | { |
497 | u8 val; | 496 | u8 val; |
497 | unsigned short addr; | ||
498 | 498 | ||
499 | superio_enter(); | 499 | superio_enter(); |
500 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); | 500 | val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
@@ -546,9 +546,9 @@ static int __init smsc47m1_find(unsigned short *addr, | |||
546 | } | 546 | } |
547 | 547 | ||
548 | superio_select(); | 548 | superio_select(); |
549 | *addr = (superio_inb(SUPERIO_REG_BASE) << 8) | 549 | addr = (superio_inb(SUPERIO_REG_BASE) << 8) |
550 | | superio_inb(SUPERIO_REG_BASE + 1); | 550 | | superio_inb(SUPERIO_REG_BASE + 1); |
551 | if (*addr == 0) { | 551 | if (addr == 0) { |
552 | pr_info("Device address not set, will not use\n"); | 552 | pr_info("Device address not set, will not use\n"); |
553 | superio_exit(); | 553 | superio_exit(); |
554 | return -ENODEV; | 554 | return -ENODEV; |
@@ -565,7 +565,7 @@ static int __init smsc47m1_find(unsigned short *addr, | |||
565 | } | 565 | } |
566 | 566 | ||
567 | superio_exit(); | 567 | superio_exit(); |
568 | return 0; | 568 | return addr; |
569 | } | 569 | } |
570 | 570 | ||
571 | /* Restore device to its initial state */ | 571 | /* Restore device to its initial state */ |
@@ -938,13 +938,15 @@ static int __init sm_smsc47m1_init(void) | |||
938 | unsigned short address; | 938 | unsigned short address; |
939 | struct smsc47m1_sio_data sio_data; | 939 | struct smsc47m1_sio_data sio_data; |
940 | 940 | ||
941 | if (smsc47m1_find(&address, &sio_data)) | 941 | err = smsc47m1_find(&sio_data); |
942 | return -ENODEV; | 942 | if (err < 0) |
943 | return err; | ||
944 | address = err; | ||
943 | 945 | ||
944 | /* Sets global pdev as a side effect */ | 946 | /* Sets global pdev as a side effect */ |
945 | err = smsc47m1_device_add(address, &sio_data); | 947 | err = smsc47m1_device_add(address, &sio_data); |
946 | if (err) | 948 | if (err) |
947 | goto exit; | 949 | return err; |
948 | 950 | ||
949 | err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); | 951 | err = platform_driver_probe(&smsc47m1_driver, smsc47m1_probe); |
950 | if (err) | 952 | if (err) |
@@ -955,7 +957,6 @@ static int __init sm_smsc47m1_init(void) | |||
955 | exit_device: | 957 | exit_device: |
956 | platform_device_unregister(pdev); | 958 | platform_device_unregister(pdev); |
957 | smsc47m1_restore(&sio_data); | 959 | smsc47m1_restore(&sio_data); |
958 | exit: | ||
959 | return err; | 960 | return err; |
960 | } | 961 | } |
961 | 962 | ||
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index a25350cf9554..54922ed12978 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -2619,15 +2619,15 @@ static struct platform_driver w83627ehf_driver = { | |||
2619 | static int __init w83627ehf_find(int sioaddr, unsigned short *addr, | 2619 | static int __init w83627ehf_find(int sioaddr, unsigned short *addr, |
2620 | struct w83627ehf_sio_data *sio_data) | 2620 | struct w83627ehf_sio_data *sio_data) |
2621 | { | 2621 | { |
2622 | static const char __initdata sio_name_W83627EHF[] = "W83627EHF"; | 2622 | static const char sio_name_W83627EHF[] __initconst = "W83627EHF"; |
2623 | static const char __initdata sio_name_W83627EHG[] = "W83627EHG"; | 2623 | static const char sio_name_W83627EHG[] __initconst = "W83627EHG"; |
2624 | static const char __initdata sio_name_W83627DHG[] = "W83627DHG"; | 2624 | static const char sio_name_W83627DHG[] __initconst = "W83627DHG"; |
2625 | static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P"; | 2625 | static const char sio_name_W83627DHG_P[] __initconst = "W83627DHG-P"; |
2626 | static const char __initdata sio_name_W83627UHG[] = "W83627UHG"; | 2626 | static const char sio_name_W83627UHG[] __initconst = "W83627UHG"; |
2627 | static const char __initdata sio_name_W83667HG[] = "W83667HG"; | 2627 | static const char sio_name_W83667HG[] __initconst = "W83667HG"; |
2628 | static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B"; | 2628 | static const char sio_name_W83667HG_B[] __initconst = "W83667HG-B"; |
2629 | static const char __initdata sio_name_NCT6775[] = "NCT6775F"; | 2629 | static const char sio_name_NCT6775[] __initconst = "NCT6775F"; |
2630 | static const char __initdata sio_name_NCT6776[] = "NCT6776F"; | 2630 | static const char sio_name_NCT6776[] __initconst = "NCT6776F"; |
2631 | 2631 | ||
2632 | u16 val; | 2632 | u16 val; |
2633 | const char *sio_name; | 2633 | const char *sio_name; |
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index 37f42113af31..00e8f213f56e 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c | |||
@@ -182,7 +182,6 @@ static int i2c_dw_pci_resume(struct device *dev) | |||
182 | pci_restore_state(pdev); | 182 | pci_restore_state(pdev); |
183 | 183 | ||
184 | i2c_dw_init(i2c); | 184 | i2c_dw_init(i2c); |
185 | i2c_dw_enable(i2c); | ||
186 | return 0; | 185 | return 0; |
187 | } | 186 | } |
188 | 187 | ||
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/idle/i7300_idle.c b/drivers/idle/i7300_idle.c index c976285d313e..fa080ebd568f 100644 --- a/drivers/idle/i7300_idle.c +++ b/drivers/idle/i7300_idle.c | |||
@@ -516,12 +516,6 @@ static struct notifier_block i7300_idle_nb = { | |||
516 | 516 | ||
517 | MODULE_DEVICE_TABLE(pci, pci_tbl); | 517 | MODULE_DEVICE_TABLE(pci, pci_tbl); |
518 | 518 | ||
519 | int stats_open_generic(struct inode *inode, struct file *fp) | ||
520 | { | ||
521 | fp->private_data = inode->i_private; | ||
522 | return 0; | ||
523 | } | ||
524 | |||
525 | static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count, | 519 | static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count, |
526 | loff_t *off) | 520 | loff_t *off) |
527 | { | 521 | { |
@@ -534,7 +528,7 @@ static ssize_t stats_read_ul(struct file *fp, char __user *ubuf, size_t count, | |||
534 | } | 528 | } |
535 | 529 | ||
536 | static const struct file_operations idle_fops = { | 530 | static const struct file_operations idle_fops = { |
537 | .open = stats_open_generic, | 531 | .open = simple_open, |
538 | .read = stats_read_ul, | 532 | .read = stats_read_ul, |
539 | .llseek = default_llseek, | 533 | .llseek = default_llseek, |
540 | }; | 534 | }; |
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/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 83b720ef6c34..246fdc151652 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -179,7 +179,7 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
179 | { | 179 | { |
180 | struct ib_port_attr attr; | 180 | struct ib_port_attr attr; |
181 | char *speed = ""; | 181 | char *speed = ""; |
182 | int rate = -1; /* in deci-Gb/sec */ | 182 | int rate; /* in deci-Gb/sec */ |
183 | ssize_t ret; | 183 | ssize_t ret; |
184 | 184 | ||
185 | ret = ib_query_port(p->ibdev, p->port_num, &attr); | 185 | ret = ib_query_port(p->ibdev, p->port_num, &attr); |
@@ -187,9 +187,6 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
187 | return ret; | 187 | return ret; |
188 | 188 | ||
189 | switch (attr.active_speed) { | 189 | switch (attr.active_speed) { |
190 | case IB_SPEED_SDR: | ||
191 | rate = 25; | ||
192 | break; | ||
193 | case IB_SPEED_DDR: | 190 | case IB_SPEED_DDR: |
194 | speed = " DDR"; | 191 | speed = " DDR"; |
195 | rate = 50; | 192 | rate = 50; |
@@ -210,6 +207,10 @@ static ssize_t rate_show(struct ib_port *p, struct port_attribute *unused, | |||
210 | speed = " EDR"; | 207 | speed = " EDR"; |
211 | rate = 250; | 208 | rate = 250; |
212 | break; | 209 | break; |
210 | case IB_SPEED_SDR: | ||
211 | default: /* default to SDR for invalid rates */ | ||
212 | rate = 25; | ||
213 | break; | ||
213 | } | 214 | } |
214 | 215 | ||
215 | rate *= ib_width_enum_to_int(attr.active_width); | 216 | rate *= ib_width_enum_to_int(attr.active_width); |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 75d305629300..b948b6dd5d55 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -247,12 +247,17 @@ 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) |
254 | props->active_speed = IB_SPEED_FDR10; | 254 | props->active_speed = IB_SPEED_FDR10; |
255 | } | 255 | } |
256 | |||
257 | /* Avoid wrong speed value returned by FW if the IB link is down. */ | ||
258 | if (props->state == IB_PORT_DOWN) | ||
259 | props->active_speed = IB_SPEED_SDR; | ||
260 | |||
256 | out: | 261 | out: |
257 | kfree(in_mad); | 262 | kfree(in_mad); |
258 | kfree(out_mad); | 263 | kfree(out_mad); |
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index 69e2ad06e515..daf21b899999 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c | |||
@@ -3232,6 +3232,7 @@ static void srpt_add_one(struct ib_device *device) | |||
3232 | srq_attr.attr.max_wr = sdev->srq_size; | 3232 | srq_attr.attr.max_wr = sdev->srq_size; |
3233 | srq_attr.attr.max_sge = 1; | 3233 | srq_attr.attr.max_sge = 1; |
3234 | srq_attr.attr.srq_limit = 0; | 3234 | srq_attr.attr.srq_limit = 0; |
3235 | srq_attr.srq_type = IB_SRQT_BASIC; | ||
3235 | 3236 | ||
3236 | sdev->srq = ib_create_srq(sdev->pd, &srq_attr); | 3237 | sdev->srq = ib_create_srq(sdev->pd, &srq_attr); |
3237 | if (IS_ERR(sdev->srq)) | 3238 | if (IS_ERR(sdev->srq)) |
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 2d787796bf50..7faf4a7fcaa9 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -380,8 +380,7 @@ config INPUT_TWL4030_VIBRA | |||
380 | 380 | ||
381 | config INPUT_TWL6040_VIBRA | 381 | config INPUT_TWL6040_VIBRA |
382 | tristate "Support for TWL6040 Vibrator" | 382 | tristate "Support for TWL6040 Vibrator" |
383 | depends on TWL4030_CORE | 383 | depends on TWL6040_CORE |
384 | select TWL6040_CORE | ||
385 | select INPUT_FF_MEMLESS | 384 | select INPUT_FF_MEMLESS |
386 | help | 385 | help |
387 | This option enables support for TWL6040 Vibrator Driver. | 386 | This option enables support for TWL6040 Vibrator Driver. |
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c index 34aebb8cd080..3c843cd725fa 100644 --- a/drivers/input/misc/da9052_onkey.c +++ b/drivers/input/misc/da9052_onkey.c | |||
@@ -95,7 +95,8 @@ static int __devinit da9052_onkey_probe(struct platform_device *pdev) | |||
95 | input_dev = input_allocate_device(); | 95 | input_dev = input_allocate_device(); |
96 | if (!onkey || !input_dev) { | 96 | if (!onkey || !input_dev) { |
97 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | 97 | dev_err(&pdev->dev, "Failed to allocate memory\n"); |
98 | return -ENOMEM; | 98 | error = -ENOMEM; |
99 | goto err_free_mem; | ||
99 | } | 100 | } |
100 | 101 | ||
101 | onkey->input = input_dev; | 102 | onkey->input = input_dev; |
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index 45874fed523a..14e94f56cb7d 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
31 | #include <linux/i2c/twl.h> | 31 | #include <linux/input.h> |
32 | #include <linux/mfd/twl6040.h> | 32 | #include <linux/mfd/twl6040.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
@@ -257,7 +257,7 @@ static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); | |||
257 | 257 | ||
258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) | 258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) |
259 | { | 259 | { |
260 | struct twl4030_vibra_data *pdata = pdev->dev.platform_data; | 260 | struct twl6040_vibra_data *pdata = pdev->dev.platform_data; |
261 | struct vibra_info *info; | 261 | struct vibra_info *info; |
262 | int ret; | 262 | int ret; |
263 | 263 | ||
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index d2c0db159b18..479011004a11 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -486,7 +486,6 @@ static void elantech_input_sync_v4(struct psmouse *psmouse) | |||
486 | unsigned char *packet = psmouse->packet; | 486 | unsigned char *packet = psmouse->packet; |
487 | 487 | ||
488 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | 488 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); |
489 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | ||
490 | input_mt_report_pointer_emulation(dev, true); | 489 | input_mt_report_pointer_emulation(dev, true); |
491 | input_sync(dev); | 490 | input_sync(dev); |
492 | } | 491 | } |
@@ -967,6 +966,7 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
967 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) | 966 | if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) |
968 | return -1; | 967 | return -1; |
969 | 968 | ||
969 | __set_bit(INPUT_PROP_POINTER, dev->propbit); | ||
970 | __set_bit(EV_KEY, dev->evbit); | 970 | __set_bit(EV_KEY, dev->evbit); |
971 | __set_bit(EV_ABS, dev->evbit); | 971 | __set_bit(EV_ABS, dev->evbit); |
972 | __clear_bit(EV_REL, dev->evbit); | 972 | __clear_bit(EV_REL, dev->evbit); |
@@ -1017,7 +1017,9 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1017 | */ | 1017 | */ |
1018 | psmouse_warn(psmouse, "couldn't query resolution data.\n"); | 1018 | psmouse_warn(psmouse, "couldn't query resolution data.\n"); |
1019 | } | 1019 | } |
1020 | 1020 | /* v4 is clickpad, with only one button. */ | |
1021 | __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); | ||
1022 | __clear_bit(BTN_RIGHT, dev->keybit); | ||
1021 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); | 1023 | __set_bit(BTN_TOOL_QUADTAP, dev->keybit); |
1022 | /* For X to recognize me as touchpad. */ | 1024 | /* For X to recognize me as touchpad. */ |
1023 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); | 1025 | input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); |
@@ -1245,6 +1247,8 @@ static void elantech_disconnect(struct psmouse *psmouse) | |||
1245 | */ | 1247 | */ |
1246 | static int elantech_reconnect(struct psmouse *psmouse) | 1248 | static int elantech_reconnect(struct psmouse *psmouse) |
1247 | { | 1249 | { |
1250 | psmouse_reset(psmouse); | ||
1251 | |||
1248 | if (elantech_detect(psmouse, 0)) | 1252 | if (elantech_detect(psmouse, 0)) |
1249 | return -1; | 1253 | return -1; |
1250 | 1254 | ||
@@ -1324,6 +1328,8 @@ int elantech_init(struct psmouse *psmouse) | |||
1324 | if (!etd) | 1328 | if (!etd) |
1325 | return -ENOMEM; | 1329 | return -ENOMEM; |
1326 | 1330 | ||
1331 | psmouse_reset(psmouse); | ||
1332 | |||
1327 | etd->parity[0] = 1; | 1333 | etd->parity[0] = 1; |
1328 | for (i = 1; i < 256; i++) | 1334 | for (i = 1; i < 256; i++) |
1329 | etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; | 1335 | etd->parity[i] = etd->parity[i & (i - 1)] ^ 1; |
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index a9ad8e1402be..39fe9b737cae 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
@@ -12,9 +12,9 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/input-polldev.h> | 14 | #include <linux/input-polldev.h> |
15 | #include <linux/gpio.h> | ||
15 | #include <linux/gpio_mouse.h> | 16 | #include <linux/gpio_mouse.h> |
16 | 17 | ||
17 | #include <asm/gpio.h> | ||
18 | 18 | ||
19 | /* | 19 | /* |
20 | * Timer function which is run every scan_ms ms when the device is opened. | 20 | * Timer function which is run every scan_ms ms when the device is opened. |
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index a977bfaa6821..661a0ca3b3d6 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -741,6 +741,14 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) | |||
741 | } | 741 | } |
742 | } else { | 742 | } else { |
743 | /* SFAC packet */ | 743 | /* SFAC packet */ |
744 | if ((packet[0] & (FSP_PB0_LBTN|FSP_PB0_PHY_BTN)) == | ||
745 | FSP_PB0_LBTN) { | ||
746 | /* On-pad click in SFAC mode should be handled | ||
747 | * by userspace. On-pad clicks in MFMC mode | ||
748 | * are real clickpad clicks, and not ignored. | ||
749 | */ | ||
750 | packet[0] &= ~FSP_PB0_LBTN; | ||
751 | } | ||
744 | 752 | ||
745 | /* no multi-finger information */ | 753 | /* no multi-finger information */ |
746 | ad->last_mt_fgr = 0; | 754 | ad->last_mt_fgr = 0; |
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/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 22b218018137..f3102494237d 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -304,7 +304,7 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
304 | return 0; | 304 | return 0; |
305 | 305 | ||
306 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { | 306 | if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) { |
307 | printk(KERN_WARNING "trackpoint.c: failed to get extended button data\n"); | 307 | psmouse_warn(psmouse, "failed to get extended button data\n"); |
308 | button_info = 0; | 308 | button_info = 0; |
309 | } | 309 | } |
310 | 310 | ||
@@ -326,16 +326,18 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
326 | 326 | ||
327 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); | 327 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); |
328 | if (error) { | 328 | if (error) { |
329 | printk(KERN_ERR | 329 | psmouse_err(psmouse, |
330 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", | 330 | "failed to create sysfs attributes, error: %d\n", |
331 | error); | 331 | error); |
332 | kfree(psmouse->private); | 332 | kfree(psmouse->private); |
333 | psmouse->private = NULL; | 333 | psmouse->private = NULL; |
334 | return -1; | 334 | return -1; |
335 | } | 335 | } |
336 | 336 | ||
337 | printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", | 337 | psmouse_info(psmouse, |
338 | firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f); | 338 | "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n", |
339 | firmware_id, | ||
340 | (button_info & 0xf0) >> 4, button_info & 0x0f); | ||
339 | 341 | ||
340 | return 0; | 342 | return 0; |
341 | } | 343 | } |
diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index 6c6f6d8ea9b4..f7eda3d00fad 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/input/touchscreen/tps6507x_ts.c | ||
3 | * | ||
4 | * Touchscreen driver for the tps6507x chip. | 2 | * Touchscreen driver for the tps6507x chip. |
5 | * | 3 | * |
6 | * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com) | 4 | * Copyright (c) 2009 RidgeRun (todd.fischer@ridgerun.com) |
@@ -376,4 +374,4 @@ module_platform_driver(tps6507x_ts_driver); | |||
376 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); | 374 | MODULE_AUTHOR("Todd Fischer <todd.fischer@ridgerun.com>"); |
377 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); | 375 | MODULE_DESCRIPTION("TPS6507x - TouchScreen driver"); |
378 | MODULE_LICENSE("GPL v2"); | 376 | MODULE_LICENSE("GPL v2"); |
379 | MODULE_ALIAS("platform:tps6507x-tsc"); | 377 | MODULE_ALIAS("platform:tps6507x-ts"); |
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index ae2ec929e52f..a5bee8e2dfce 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -2707,7 +2707,8 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist, | |||
2707 | * The exported alloc_coherent function for dma_ops. | 2707 | * The exported alloc_coherent function for dma_ops. |
2708 | */ | 2708 | */ |
2709 | static void *alloc_coherent(struct device *dev, size_t size, | 2709 | static void *alloc_coherent(struct device *dev, size_t size, |
2710 | dma_addr_t *dma_addr, gfp_t flag) | 2710 | dma_addr_t *dma_addr, gfp_t flag, |
2711 | struct dma_attrs *attrs) | ||
2711 | { | 2712 | { |
2712 | unsigned long flags; | 2713 | unsigned long flags; |
2713 | void *virt_addr; | 2714 | void *virt_addr; |
@@ -2765,7 +2766,8 @@ out_free: | |||
2765 | * The exported free_coherent function for dma_ops. | 2766 | * The exported free_coherent function for dma_ops. |
2766 | */ | 2767 | */ |
2767 | static void free_coherent(struct device *dev, size_t size, | 2768 | static void free_coherent(struct device *dev, size_t size, |
2768 | void *virt_addr, dma_addr_t dma_addr) | 2769 | void *virt_addr, dma_addr_t dma_addr, |
2770 | struct dma_attrs *attrs) | ||
2769 | { | 2771 | { |
2770 | unsigned long flags; | 2772 | unsigned long flags; |
2771 | struct protection_domain *domain; | 2773 | struct protection_domain *domain; |
@@ -2846,8 +2848,8 @@ static void __init prealloc_protection_domains(void) | |||
2846 | } | 2848 | } |
2847 | 2849 | ||
2848 | static struct dma_map_ops amd_iommu_dma_ops = { | 2850 | static struct dma_map_ops amd_iommu_dma_ops = { |
2849 | .alloc_coherent = alloc_coherent, | 2851 | .alloc = alloc_coherent, |
2850 | .free_coherent = free_coherent, | 2852 | .free = free_coherent, |
2851 | .map_page = map_page, | 2853 | .map_page = map_page, |
2852 | .unmap_page = unmap_page, | 2854 | .unmap_page = unmap_page, |
2853 | .map_sg = map_sg, | 2855 | .map_sg = map_sg, |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 132f93b05154..f93d5ac8f81c 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2949,7 +2949,8 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, | |||
2949 | } | 2949 | } |
2950 | 2950 | ||
2951 | static void *intel_alloc_coherent(struct device *hwdev, size_t size, | 2951 | static void *intel_alloc_coherent(struct device *hwdev, size_t size, |
2952 | dma_addr_t *dma_handle, gfp_t flags) | 2952 | dma_addr_t *dma_handle, gfp_t flags, |
2953 | struct dma_attrs *attrs) | ||
2953 | { | 2954 | { |
2954 | void *vaddr; | 2955 | void *vaddr; |
2955 | int order; | 2956 | int order; |
@@ -2981,7 +2982,7 @@ static void *intel_alloc_coherent(struct device *hwdev, size_t size, | |||
2981 | } | 2982 | } |
2982 | 2983 | ||
2983 | static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, | 2984 | static void intel_free_coherent(struct device *hwdev, size_t size, void *vaddr, |
2984 | dma_addr_t dma_handle) | 2985 | dma_addr_t dma_handle, struct dma_attrs *attrs) |
2985 | { | 2986 | { |
2986 | int order; | 2987 | int order; |
2987 | 2988 | ||
@@ -3126,8 +3127,8 @@ static int intel_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
3126 | } | 3127 | } |
3127 | 3128 | ||
3128 | struct dma_map_ops intel_dma_ops = { | 3129 | struct dma_map_ops intel_dma_ops = { |
3129 | .alloc_coherent = intel_alloc_coherent, | 3130 | .alloc = intel_alloc_coherent, |
3130 | .free_coherent = intel_free_coherent, | 3131 | .free = intel_free_coherent, |
3131 | .map_sg = intel_map_sg, | 3132 | .map_sg = intel_map_sg, |
3132 | .unmap_sg = intel_unmap_sg, | 3133 | .unmap_sg = intel_unmap_sg, |
3133 | .map_page = intel_map_page, | 3134 | .map_page = intel_map_page, |
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 103dbd92e256..f55fc5dfbadc 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c | |||
@@ -323,15 +323,9 @@ err_out: | |||
323 | return count; | 323 | return count; |
324 | } | 324 | } |
325 | 325 | ||
326 | static int debug_open_generic(struct inode *inode, struct file *file) | ||
327 | { | ||
328 | file->private_data = inode->i_private; | ||
329 | return 0; | ||
330 | } | ||
331 | |||
332 | #define DEBUG_FOPS(name) \ | 326 | #define DEBUG_FOPS(name) \ |
333 | static const struct file_operations debug_##name##_fops = { \ | 327 | static const struct file_operations debug_##name##_fops = { \ |
334 | .open = debug_open_generic, \ | 328 | .open = simple_open, \ |
335 | .read = debug_read_##name, \ | 329 | .read = debug_read_##name, \ |
336 | .write = debug_write_##name, \ | 330 | .write = debug_write_##name, \ |
337 | .llseek = generic_file_llseek, \ | 331 | .llseek = generic_file_llseek, \ |
@@ -339,7 +333,7 @@ static int debug_open_generic(struct inode *inode, struct file *file) | |||
339 | 333 | ||
340 | #define DEBUG_FOPS_RO(name) \ | 334 | #define DEBUG_FOPS_RO(name) \ |
341 | static const struct file_operations debug_##name##_fops = { \ | 335 | static const struct file_operations debug_##name##_fops = { \ |
342 | .open = debug_open_generic, \ | 336 | .open = simple_open, \ |
343 | .read = debug_read_##name, \ | 337 | .read = debug_read_##name, \ |
344 | .llseek = generic_file_llseek, \ | 338 | .llseek = generic_file_llseek, \ |
345 | }; | 339 | }; |
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c index b3d6ac17272d..a6d9fd2858f7 100644 --- a/drivers/isdn/gigaset/interface.c +++ b/drivers/isdn/gigaset/interface.c | |||
@@ -176,7 +176,7 @@ static void if_close(struct tty_struct *tty, struct file *filp) | |||
176 | struct cardstate *cs = tty->driver_data; | 176 | struct cardstate *cs = tty->driver_data; |
177 | 177 | ||
178 | if (!cs) { /* happens if we didn't find cs in open */ | 178 | if (!cs) { /* happens if we didn't find cs in open */ |
179 | printk(KERN_DEBUG "%s: no cardstate\n", __func__); | 179 | gig_dbg(DEBUG_IF, "%s: no cardstate", __func__); |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | 182 | ||
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c index 05ed4d0cb18b..c0b8c960ee3f 100644 --- a/drivers/isdn/hardware/mISDN/avmfritz.c +++ b/drivers/isdn/hardware/mISDN/avmfritz.c | |||
@@ -891,7 +891,7 @@ open_bchannel(struct fritzcard *fc, struct channel_req *rq) | |||
891 | { | 891 | { |
892 | struct bchannel *bch; | 892 | struct bchannel *bch; |
893 | 893 | ||
894 | if (rq->adr.channel > 2) | 894 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
895 | return -EINVAL; | 895 | return -EINVAL; |
896 | if (rq->protocol == ISDN_P_NONE) | 896 | if (rq->protocol == ISDN_P_NONE) |
897 | return -EINVAL; | 897 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c index d055ae7fa040..e2c83a2d7691 100644 --- a/drivers/isdn/hardware/mISDN/hfcpci.c +++ b/drivers/isdn/hardware/mISDN/hfcpci.c | |||
@@ -1962,7 +1962,7 @@ open_bchannel(struct hfc_pci *hc, struct channel_req *rq) | |||
1962 | { | 1962 | { |
1963 | struct bchannel *bch; | 1963 | struct bchannel *bch; |
1964 | 1964 | ||
1965 | if (rq->adr.channel > 2) | 1965 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1966 | return -EINVAL; | 1966 | return -EINVAL; |
1967 | if (rq->protocol == ISDN_P_NONE) | 1967 | if (rq->protocol == ISDN_P_NONE) |
1968 | return -EINVAL; | 1968 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/hfcsusb.c b/drivers/isdn/hardware/mISDN/hfcsusb.c index 602338734634..8cde2a0538ab 100644 --- a/drivers/isdn/hardware/mISDN/hfcsusb.c +++ b/drivers/isdn/hardware/mISDN/hfcsusb.c | |||
@@ -486,7 +486,7 @@ open_bchannel(struct hfcsusb *hw, struct channel_req *rq) | |||
486 | { | 486 | { |
487 | struct bchannel *bch; | 487 | struct bchannel *bch; |
488 | 488 | ||
489 | if (rq->adr.channel > 2) | 489 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
490 | return -EINVAL; | 490 | return -EINVAL; |
491 | if (rq->protocol == ISDN_P_NONE) | 491 | if (rq->protocol == ISDN_P_NONE) |
492 | return -EINVAL; | 492 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c index b47e9bed2185..884369f09cad 100644 --- a/drivers/isdn/hardware/mISDN/mISDNipac.c +++ b/drivers/isdn/hardware/mISDN/mISDNipac.c | |||
@@ -1506,7 +1506,7 @@ open_bchannel(struct ipac_hw *ipac, struct channel_req *rq) | |||
1506 | { | 1506 | { |
1507 | struct bchannel *bch; | 1507 | struct bchannel *bch; |
1508 | 1508 | ||
1509 | if (rq->adr.channel > 2) | 1509 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1510 | return -EINVAL; | 1510 | return -EINVAL; |
1511 | if (rq->protocol == ISDN_P_NONE) | 1511 | if (rq->protocol == ISDN_P_NONE) |
1512 | return -EINVAL; | 1512 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/mISDNisar.c b/drivers/isdn/hardware/mISDN/mISDNisar.c index 10446ab404b5..9a6da6edcfa8 100644 --- a/drivers/isdn/hardware/mISDN/mISDNisar.c +++ b/drivers/isdn/hardware/mISDN/mISDNisar.c | |||
@@ -1670,7 +1670,7 @@ isar_open(struct isar_hw *isar, struct channel_req *rq) | |||
1670 | { | 1670 | { |
1671 | struct bchannel *bch; | 1671 | struct bchannel *bch; |
1672 | 1672 | ||
1673 | if (rq->adr.channel > 2) | 1673 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1674 | return -EINVAL; | 1674 | return -EINVAL; |
1675 | if (rq->protocol == ISDN_P_NONE) | 1675 | if (rq->protocol == ISDN_P_NONE) |
1676 | return -EINVAL; | 1676 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c index dd6de9f7a8a3..c726e09d0981 100644 --- a/drivers/isdn/hardware/mISDN/netjet.c +++ b/drivers/isdn/hardware/mISDN/netjet.c | |||
@@ -860,7 +860,7 @@ open_bchannel(struct tiger_hw *card, struct channel_req *rq) | |||
860 | { | 860 | { |
861 | struct bchannel *bch; | 861 | struct bchannel *bch; |
862 | 862 | ||
863 | if (rq->adr.channel > 2) | 863 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
864 | return -EINVAL; | 864 | return -EINVAL; |
865 | if (rq->protocol == ISDN_P_NONE) | 865 | if (rq->protocol == ISDN_P_NONE) |
866 | return -EINVAL; | 866 | return -EINVAL; |
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c index 7f1e7ba75cd1..2183357f0799 100644 --- a/drivers/isdn/hardware/mISDN/w6692.c +++ b/drivers/isdn/hardware/mISDN/w6692.c | |||
@@ -1015,7 +1015,7 @@ open_bchannel(struct w6692_hw *card, struct channel_req *rq) | |||
1015 | { | 1015 | { |
1016 | struct bchannel *bch; | 1016 | struct bchannel *bch; |
1017 | 1017 | ||
1018 | if (rq->adr.channel > 2) | 1018 | if (rq->adr.channel == 0 || rq->adr.channel > 2) |
1019 | return -EINVAL; | 1019 | return -EINVAL; |
1020 | if (rq->protocol == ISDN_P_NONE) | 1020 | if (rq->protocol == ISDN_P_NONE) |
1021 | return -EINVAL; | 1021 | return -EINVAL; |
diff --git a/drivers/leds/leds-atmel-pwm.c b/drivers/leds/leds-atmel-pwm.c index 800243b6037e..64ad702a2ecc 100644 --- a/drivers/leds/leds-atmel-pwm.c +++ b/drivers/leds/leds-atmel-pwm.c | |||
@@ -35,7 +35,7 @@ static void pwmled_brightness(struct led_classdev *cdev, enum led_brightness b) | |||
35 | * NOTE: we reuse the platform_data structure of GPIO leds, | 35 | * NOTE: we reuse the platform_data structure of GPIO leds, |
36 | * but repurpose its "gpio" number as a PWM channel number. | 36 | * but repurpose its "gpio" number as a PWM channel number. |
37 | */ | 37 | */ |
38 | static int __init pwmled_probe(struct platform_device *pdev) | 38 | static int __devinit pwmled_probe(struct platform_device *pdev) |
39 | { | 39 | { |
40 | const struct gpio_led_platform_data *pdata; | 40 | const struct gpio_led_platform_data *pdata; |
41 | struct pwmled *leds; | 41 | struct pwmled *leds; |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 3d0dfa7a89a2..17e2b472e16d 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -539,9 +539,6 @@ static int bitmap_new_disk_sb(struct bitmap *bitmap) | |||
539 | bitmap->events_cleared = bitmap->mddev->events; | 539 | bitmap->events_cleared = bitmap->mddev->events; |
540 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); | 540 | sb->events_cleared = cpu_to_le64(bitmap->mddev->events); |
541 | 541 | ||
542 | bitmap->flags |= BITMAP_HOSTENDIAN; | ||
543 | sb->version = cpu_to_le32(BITMAP_MAJOR_HOSTENDIAN); | ||
544 | |||
545 | kunmap_atomic(sb); | 542 | kunmap_atomic(sb); |
546 | 543 | ||
547 | return 0; | 544 | return 0; |
@@ -1730,8 +1727,7 @@ int bitmap_create(struct mddev *mddev) | |||
1730 | bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) | 1727 | bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) |
1731 | - BITMAP_BLOCK_SHIFT); | 1728 | - BITMAP_BLOCK_SHIFT); |
1732 | 1729 | ||
1733 | /* now that chunksize and chunkshift are set, we can use these macros */ | 1730 | chunks = (blocks + (1 << bitmap->chunkshift) - 1) >> |
1734 | chunks = (blocks + bitmap->chunkshift - 1) >> | ||
1735 | bitmap->chunkshift; | 1731 | bitmap->chunkshift; |
1736 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; | 1732 | pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; |
1737 | 1733 | ||
@@ -1788,7 +1784,9 @@ int bitmap_load(struct mddev *mddev) | |||
1788 | * re-add of a missing device */ | 1784 | * re-add of a missing device */ |
1789 | start = mddev->recovery_cp; | 1785 | start = mddev->recovery_cp; |
1790 | 1786 | ||
1787 | mutex_lock(&mddev->bitmap_info.mutex); | ||
1791 | err = bitmap_init_from_disk(bitmap, start); | 1788 | err = bitmap_init_from_disk(bitmap, start); |
1789 | mutex_unlock(&mddev->bitmap_info.mutex); | ||
1792 | 1790 | ||
1793 | if (err) | 1791 | if (err) |
1794 | goto out; | 1792 | goto out; |
diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h index 55ca5aec84e4..b44b0aba2d47 100644 --- a/drivers/md/bitmap.h +++ b/drivers/md/bitmap.h | |||
@@ -101,9 +101,6 @@ typedef __u16 bitmap_counter_t; | |||
101 | 101 | ||
102 | #define BITMAP_BLOCK_SHIFT 9 | 102 | #define BITMAP_BLOCK_SHIFT 9 |
103 | 103 | ||
104 | /* how many blocks per chunk? (this is variable) */ | ||
105 | #define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->mddev->bitmap_info.chunksize >> BITMAP_BLOCK_SHIFT) | ||
106 | |||
107 | #endif | 104 | #endif |
108 | 105 | ||
109 | /* | 106 | /* |
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index b0ba52459ed7..68965e663248 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -859,7 +859,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) | |||
859 | int ret; | 859 | int ret; |
860 | unsigned redundancy = 0; | 860 | unsigned redundancy = 0; |
861 | struct raid_dev *dev; | 861 | struct raid_dev *dev; |
862 | struct md_rdev *rdev, *freshest; | 862 | struct md_rdev *rdev, *tmp, *freshest; |
863 | struct mddev *mddev = &rs->md; | 863 | struct mddev *mddev = &rs->md; |
864 | 864 | ||
865 | switch (rs->raid_type->level) { | 865 | switch (rs->raid_type->level) { |
@@ -877,7 +877,7 @@ static int analyse_superblocks(struct dm_target *ti, struct raid_set *rs) | |||
877 | } | 877 | } |
878 | 878 | ||
879 | freshest = NULL; | 879 | freshest = NULL; |
880 | rdev_for_each(rdev, mddev) { | 880 | rdev_for_each_safe(rdev, tmp, mddev) { |
881 | if (!rdev->meta_bdev) | 881 | if (!rdev->meta_bdev) |
882 | continue; | 882 | continue; |
883 | 883 | ||
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index b0fcc7d02adb..fa211d80fc0a 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -198,6 +198,7 @@ out: | |||
198 | static int linear_run (struct mddev *mddev) | 198 | static int linear_run (struct mddev *mddev) |
199 | { | 199 | { |
200 | struct linear_conf *conf; | 200 | struct linear_conf *conf; |
201 | int ret; | ||
201 | 202 | ||
202 | if (md_check_no_bitmap(mddev)) | 203 | if (md_check_no_bitmap(mddev)) |
203 | return -EINVAL; | 204 | return -EINVAL; |
@@ -211,7 +212,13 @@ static int linear_run (struct mddev *mddev) | |||
211 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); | 212 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); |
212 | mddev->queue->backing_dev_info.congested_fn = linear_congested; | 213 | mddev->queue->backing_dev_info.congested_fn = linear_congested; |
213 | mddev->queue->backing_dev_info.congested_data = mddev; | 214 | mddev->queue->backing_dev_info.congested_data = mddev; |
214 | return md_integrity_register(mddev); | 215 | |
216 | ret = md_integrity_register(mddev); | ||
217 | if (ret) { | ||
218 | kfree(conf); | ||
219 | mddev->private = NULL; | ||
220 | } | ||
221 | return ret; | ||
215 | } | 222 | } |
216 | 223 | ||
217 | static int linear_add(struct mddev *mddev, struct md_rdev *rdev) | 224 | static int linear_add(struct mddev *mddev, struct md_rdev *rdev) |
diff --git a/drivers/md/md.c b/drivers/md/md.c index b572e1e386ce..477eb2e180c0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -7560,14 +7560,14 @@ void md_check_recovery(struct mddev *mddev) | |||
7560 | * any transients in the value of "sync_action". | 7560 | * any transients in the value of "sync_action". |
7561 | */ | 7561 | */ |
7562 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); | 7562 | set_bit(MD_RECOVERY_RUNNING, &mddev->recovery); |
7563 | clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
7564 | /* Clear some bits that don't mean anything, but | 7563 | /* Clear some bits that don't mean anything, but |
7565 | * might be left set | 7564 | * might be left set |
7566 | */ | 7565 | */ |
7567 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); | 7566 | clear_bit(MD_RECOVERY_INTR, &mddev->recovery); |
7568 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); | 7567 | clear_bit(MD_RECOVERY_DONE, &mddev->recovery); |
7569 | 7568 | ||
7570 | if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) | 7569 | if (!test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || |
7570 | test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) | ||
7571 | goto unlock; | 7571 | goto unlock; |
7572 | /* no recovery is running. | 7572 | /* no recovery is running. |
7573 | * remove any failed drives, then | 7573 | * remove any failed drives, then |
@@ -8140,7 +8140,8 @@ static int md_notify_reboot(struct notifier_block *this, | |||
8140 | 8140 | ||
8141 | for_each_mddev(mddev, tmp) { | 8141 | for_each_mddev(mddev, tmp) { |
8142 | if (mddev_trylock(mddev)) { | 8142 | if (mddev_trylock(mddev)) { |
8143 | __md_stop_writes(mddev); | 8143 | if (mddev->pers) |
8144 | __md_stop_writes(mddev); | ||
8144 | mddev->safemode = 2; | 8145 | mddev->safemode = 2; |
8145 | mddev_unlock(mddev); | 8146 | mddev_unlock(mddev); |
8146 | } | 8147 | } |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 6f31f5596e01..de63a1fc3737 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -407,6 +407,8 @@ static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks | |||
407 | return array_sectors; | 407 | return array_sectors; |
408 | } | 408 | } |
409 | 409 | ||
410 | static int raid0_stop(struct mddev *mddev); | ||
411 | |||
410 | static int raid0_run(struct mddev *mddev) | 412 | static int raid0_run(struct mddev *mddev) |
411 | { | 413 | { |
412 | struct r0conf *conf; | 414 | struct r0conf *conf; |
@@ -454,7 +456,12 @@ static int raid0_run(struct mddev *mddev) | |||
454 | 456 | ||
455 | blk_queue_merge_bvec(mddev->queue, raid0_mergeable_bvec); | 457 | blk_queue_merge_bvec(mddev->queue, raid0_mergeable_bvec); |
456 | dump_zones(mddev); | 458 | dump_zones(mddev); |
457 | return md_integrity_register(mddev); | 459 | |
460 | ret = md_integrity_register(mddev); | ||
461 | if (ret) | ||
462 | raid0_stop(mddev); | ||
463 | |||
464 | return ret; | ||
458 | } | 465 | } |
459 | 466 | ||
460 | static int raid0_stop(struct mddev *mddev) | 467 | static int raid0_stop(struct mddev *mddev) |
@@ -625,6 +632,7 @@ static void *raid0_takeover_raid10(struct mddev *mddev) | |||
625 | static void *raid0_takeover_raid1(struct mddev *mddev) | 632 | static void *raid0_takeover_raid1(struct mddev *mddev) |
626 | { | 633 | { |
627 | struct r0conf *priv_conf; | 634 | struct r0conf *priv_conf; |
635 | int chunksect; | ||
628 | 636 | ||
629 | /* Check layout: | 637 | /* Check layout: |
630 | * - (N - 1) mirror drives must be already faulty | 638 | * - (N - 1) mirror drives must be already faulty |
@@ -635,10 +643,25 @@ static void *raid0_takeover_raid1(struct mddev *mddev) | |||
635 | return ERR_PTR(-EINVAL); | 643 | return ERR_PTR(-EINVAL); |
636 | } | 644 | } |
637 | 645 | ||
646 | /* | ||
647 | * a raid1 doesn't have the notion of chunk size, so | ||
648 | * figure out the largest suitable size we can use. | ||
649 | */ | ||
650 | chunksect = 64 * 2; /* 64K by default */ | ||
651 | |||
652 | /* The array must be an exact multiple of chunksize */ | ||
653 | while (chunksect && (mddev->array_sectors & (chunksect - 1))) | ||
654 | chunksect >>= 1; | ||
655 | |||
656 | if ((chunksect << 9) < PAGE_SIZE) | ||
657 | /* array size does not allow a suitable chunk size */ | ||
658 | return ERR_PTR(-EINVAL); | ||
659 | |||
638 | /* Set new parameters */ | 660 | /* Set new parameters */ |
639 | mddev->new_level = 0; | 661 | mddev->new_level = 0; |
640 | mddev->new_layout = 0; | 662 | mddev->new_layout = 0; |
641 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ | 663 | mddev->new_chunk_sectors = chunksect; |
664 | mddev->chunk_sectors = chunksect; | ||
642 | mddev->delta_disks = 1 - mddev->raid_disks; | 665 | mddev->delta_disks = 1 - mddev->raid_disks; |
643 | mddev->raid_disks = 1; | 666 | mddev->raid_disks = 1; |
644 | /* make sure it will be not marked as dirty */ | 667 | /* make sure it will be not marked as dirty */ |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 4a40a200d769..15dd59b84e94 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1712,6 +1712,7 @@ static int process_checks(struct r1bio *r1_bio) | |||
1712 | struct r1conf *conf = mddev->private; | 1712 | struct r1conf *conf = mddev->private; |
1713 | int primary; | 1713 | int primary; |
1714 | int i; | 1714 | int i; |
1715 | int vcnt; | ||
1715 | 1716 | ||
1716 | for (primary = 0; primary < conf->raid_disks * 2; primary++) | 1717 | for (primary = 0; primary < conf->raid_disks * 2; primary++) |
1717 | if (r1_bio->bios[primary]->bi_end_io == end_sync_read && | 1718 | if (r1_bio->bios[primary]->bi_end_io == end_sync_read && |
@@ -1721,9 +1722,9 @@ static int process_checks(struct r1bio *r1_bio) | |||
1721 | break; | 1722 | break; |
1722 | } | 1723 | } |
1723 | r1_bio->read_disk = primary; | 1724 | r1_bio->read_disk = primary; |
1725 | vcnt = (r1_bio->sectors + PAGE_SIZE / 512 - 1) >> (PAGE_SHIFT - 9); | ||
1724 | for (i = 0; i < conf->raid_disks * 2; i++) { | 1726 | for (i = 0; i < conf->raid_disks * 2; i++) { |
1725 | int j; | 1727 | int j; |
1726 | int vcnt = r1_bio->sectors >> (PAGE_SHIFT- 9); | ||
1727 | struct bio *pbio = r1_bio->bios[primary]; | 1728 | struct bio *pbio = r1_bio->bios[primary]; |
1728 | struct bio *sbio = r1_bio->bios[i]; | 1729 | struct bio *sbio = r1_bio->bios[i]; |
1729 | int size; | 1730 | int size; |
@@ -1738,7 +1739,7 @@ static int process_checks(struct r1bio *r1_bio) | |||
1738 | s = sbio->bi_io_vec[j].bv_page; | 1739 | s = sbio->bi_io_vec[j].bv_page; |
1739 | if (memcmp(page_address(p), | 1740 | if (memcmp(page_address(p), |
1740 | page_address(s), | 1741 | page_address(s), |
1741 | PAGE_SIZE)) | 1742 | sbio->bi_io_vec[j].bv_len)) |
1742 | break; | 1743 | break; |
1743 | } | 1744 | } |
1744 | } else | 1745 | } else |
@@ -2386,8 +2387,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp | |||
2386 | int ok = 1; | 2387 | int ok = 1; |
2387 | for (i = 0 ; i < conf->raid_disks * 2 ; i++) | 2388 | for (i = 0 ; i < conf->raid_disks * 2 ; i++) |
2388 | if (r1_bio->bios[i]->bi_end_io == end_sync_write) { | 2389 | if (r1_bio->bios[i]->bi_end_io == end_sync_write) { |
2389 | struct md_rdev *rdev = | 2390 | struct md_rdev *rdev = conf->mirrors[i].rdev; |
2390 | rcu_dereference(conf->mirrors[i].rdev); | ||
2391 | ok = rdev_set_badblocks(rdev, sector_nr, | 2391 | ok = rdev_set_badblocks(rdev, sector_nr, |
2392 | min_bad, 0 | 2392 | min_bad, 0 |
2393 | ) && ok; | 2393 | ) && ok; |
@@ -2636,11 +2636,13 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2636 | return ERR_PTR(err); | 2636 | return ERR_PTR(err); |
2637 | } | 2637 | } |
2638 | 2638 | ||
2639 | static int stop(struct mddev *mddev); | ||
2639 | static int run(struct mddev *mddev) | 2640 | static int run(struct mddev *mddev) |
2640 | { | 2641 | { |
2641 | struct r1conf *conf; | 2642 | struct r1conf *conf; |
2642 | int i; | 2643 | int i; |
2643 | struct md_rdev *rdev; | 2644 | struct md_rdev *rdev; |
2645 | int ret; | ||
2644 | 2646 | ||
2645 | if (mddev->level != 1) { | 2647 | if (mddev->level != 1) { |
2646 | printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", | 2648 | printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", |
@@ -2705,7 +2707,11 @@ static int run(struct mddev *mddev) | |||
2705 | mddev->queue->backing_dev_info.congested_data = mddev; | 2707 | mddev->queue->backing_dev_info.congested_data = mddev; |
2706 | blk_queue_merge_bvec(mddev->queue, raid1_mergeable_bvec); | 2708 | blk_queue_merge_bvec(mddev->queue, raid1_mergeable_bvec); |
2707 | } | 2709 | } |
2708 | return md_integrity_register(mddev); | 2710 | |
2711 | ret = md_integrity_register(mddev); | ||
2712 | if (ret) | ||
2713 | stop(mddev); | ||
2714 | return ret; | ||
2709 | } | 2715 | } |
2710 | 2716 | ||
2711 | static int stop(struct mddev *mddev) | 2717 | static int stop(struct mddev *mddev) |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 3540316886f2..c8dbb84d5357 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1788,6 +1788,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1788 | struct r10conf *conf = mddev->private; | 1788 | struct r10conf *conf = mddev->private; |
1789 | int i, first; | 1789 | int i, first; |
1790 | struct bio *tbio, *fbio; | 1790 | struct bio *tbio, *fbio; |
1791 | int vcnt; | ||
1791 | 1792 | ||
1792 | atomic_set(&r10_bio->remaining, 1); | 1793 | atomic_set(&r10_bio->remaining, 1); |
1793 | 1794 | ||
@@ -1802,10 +1803,10 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1802 | first = i; | 1803 | first = i; |
1803 | fbio = r10_bio->devs[i].bio; | 1804 | fbio = r10_bio->devs[i].bio; |
1804 | 1805 | ||
1806 | vcnt = (r10_bio->sectors + (PAGE_SIZE >> 9) - 1) >> (PAGE_SHIFT - 9); | ||
1805 | /* now find blocks with errors */ | 1807 | /* now find blocks with errors */ |
1806 | for (i=0 ; i < conf->copies ; i++) { | 1808 | for (i=0 ; i < conf->copies ; i++) { |
1807 | int j, d; | 1809 | int j, d; |
1808 | int vcnt = r10_bio->sectors >> (PAGE_SHIFT-9); | ||
1809 | 1810 | ||
1810 | tbio = r10_bio->devs[i].bio; | 1811 | tbio = r10_bio->devs[i].bio; |
1811 | 1812 | ||
@@ -1821,7 +1822,7 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1821 | for (j = 0; j < vcnt; j++) | 1822 | for (j = 0; j < vcnt; j++) |
1822 | if (memcmp(page_address(fbio->bi_io_vec[j].bv_page), | 1823 | if (memcmp(page_address(fbio->bi_io_vec[j].bv_page), |
1823 | page_address(tbio->bi_io_vec[j].bv_page), | 1824 | page_address(tbio->bi_io_vec[j].bv_page), |
1824 | PAGE_SIZE)) | 1825 | fbio->bi_io_vec[j].bv_len)) |
1825 | break; | 1826 | break; |
1826 | if (j == vcnt) | 1827 | if (j == vcnt) |
1827 | continue; | 1828 | continue; |
@@ -1871,7 +1872,6 @@ static void sync_request_write(struct mddev *mddev, struct r10bio *r10_bio) | |||
1871 | */ | 1872 | */ |
1872 | for (i = 0; i < conf->copies; i++) { | 1873 | for (i = 0; i < conf->copies; i++) { |
1873 | int j, d; | 1874 | int j, d; |
1874 | int vcnt = r10_bio->sectors >> (PAGE_SHIFT-9); | ||
1875 | 1875 | ||
1876 | tbio = r10_bio->devs[i].repl_bio; | 1876 | tbio = r10_bio->devs[i].repl_bio; |
1877 | if (!tbio || !tbio->bi_end_io) | 1877 | if (!tbio || !tbio->bi_end_io) |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 23ac880bba9a..f351422938e0 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -2471,39 +2471,41 @@ handle_failed_sync(struct r5conf *conf, struct stripe_head *sh, | |||
2471 | int abort = 0; | 2471 | int abort = 0; |
2472 | int i; | 2472 | int i; |
2473 | 2473 | ||
2474 | md_done_sync(conf->mddev, STRIPE_SECTORS, 0); | ||
2475 | clear_bit(STRIPE_SYNCING, &sh->state); | 2474 | clear_bit(STRIPE_SYNCING, &sh->state); |
2476 | s->syncing = 0; | 2475 | s->syncing = 0; |
2477 | s->replacing = 0; | 2476 | s->replacing = 0; |
2478 | /* There is nothing more to do for sync/check/repair. | 2477 | /* There is nothing more to do for sync/check/repair. |
2478 | * Don't even need to abort as that is handled elsewhere | ||
2479 | * if needed, and not always wanted e.g. if there is a known | ||
2480 | * bad block here. | ||
2479 | * For recover/replace we need to record a bad block on all | 2481 | * For recover/replace we need to record a bad block on all |
2480 | * non-sync devices, or abort the recovery | 2482 | * non-sync devices, or abort the recovery |
2481 | */ | 2483 | */ |
2482 | if (!test_bit(MD_RECOVERY_RECOVER, &conf->mddev->recovery)) | 2484 | if (test_bit(MD_RECOVERY_RECOVER, &conf->mddev->recovery)) { |
2483 | return; | 2485 | /* During recovery devices cannot be removed, so |
2484 | /* During recovery devices cannot be removed, so locking and | 2486 | * locking and refcounting of rdevs is not needed |
2485 | * refcounting of rdevs is not needed | 2487 | */ |
2486 | */ | 2488 | for (i = 0; i < conf->raid_disks; i++) { |
2487 | for (i = 0; i < conf->raid_disks; i++) { | 2489 | struct md_rdev *rdev = conf->disks[i].rdev; |
2488 | struct md_rdev *rdev = conf->disks[i].rdev; | 2490 | if (rdev |
2489 | if (rdev | 2491 | && !test_bit(Faulty, &rdev->flags) |
2490 | && !test_bit(Faulty, &rdev->flags) | 2492 | && !test_bit(In_sync, &rdev->flags) |
2491 | && !test_bit(In_sync, &rdev->flags) | 2493 | && !rdev_set_badblocks(rdev, sh->sector, |
2492 | && !rdev_set_badblocks(rdev, sh->sector, | 2494 | STRIPE_SECTORS, 0)) |
2493 | STRIPE_SECTORS, 0)) | 2495 | abort = 1; |
2494 | abort = 1; | 2496 | rdev = conf->disks[i].replacement; |
2495 | rdev = conf->disks[i].replacement; | 2497 | if (rdev |
2496 | if (rdev | 2498 | && !test_bit(Faulty, &rdev->flags) |
2497 | && !test_bit(Faulty, &rdev->flags) | 2499 | && !test_bit(In_sync, &rdev->flags) |
2498 | && !test_bit(In_sync, &rdev->flags) | 2500 | && !rdev_set_badblocks(rdev, sh->sector, |
2499 | && !rdev_set_badblocks(rdev, sh->sector, | 2501 | STRIPE_SECTORS, 0)) |
2500 | STRIPE_SECTORS, 0)) | 2502 | abort = 1; |
2501 | abort = 1; | 2503 | } |
2502 | } | 2504 | if (abort) |
2503 | if (abort) { | 2505 | conf->recovery_disabled = |
2504 | conf->recovery_disabled = conf->mddev->recovery_disabled; | 2506 | conf->mddev->recovery_disabled; |
2505 | set_bit(MD_RECOVERY_INTR, &conf->mddev->recovery); | ||
2506 | } | 2507 | } |
2508 | md_done_sync(conf->mddev, STRIPE_SECTORS, !abort); | ||
2507 | } | 2509 | } |
2508 | 2510 | ||
2509 | static int want_replace(struct stripe_head *sh, int disk_idx) | 2511 | static int want_replace(struct stripe_head *sh, int disk_idx) |
@@ -3203,7 +3205,8 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
3203 | /* Not in-sync */; | 3205 | /* Not in-sync */; |
3204 | else if (is_bad) { | 3206 | else if (is_bad) { |
3205 | /* also not in-sync */ | 3207 | /* also not in-sync */ |
3206 | if (!test_bit(WriteErrorSeen, &rdev->flags)) { | 3208 | if (!test_bit(WriteErrorSeen, &rdev->flags) && |
3209 | test_bit(R5_UPTODATE, &dev->flags)) { | ||
3207 | /* treat as in-sync, but with a read error | 3210 | /* treat as in-sync, but with a read error |
3208 | * which we can now try to correct | 3211 | * which we can now try to correct |
3209 | */ | 3212 | */ |
@@ -3276,12 +3279,14 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
3276 | /* If there is a failed device being replaced, | 3279 | /* If there is a failed device being replaced, |
3277 | * we must be recovering. | 3280 | * we must be recovering. |
3278 | * else if we are after recovery_cp, we must be syncing | 3281 | * else if we are after recovery_cp, we must be syncing |
3282 | * else if MD_RECOVERY_REQUESTED is set, we also are syncing. | ||
3279 | * else we can only be replacing | 3283 | * else we can only be replacing |
3280 | * sync and recovery both need to read all devices, and so | 3284 | * sync and recovery both need to read all devices, and so |
3281 | * use the same flag. | 3285 | * use the same flag. |
3282 | */ | 3286 | */ |
3283 | if (do_recovery || | 3287 | if (do_recovery || |
3284 | sh->sector >= conf->mddev->recovery_cp) | 3288 | sh->sector >= conf->mddev->recovery_cp || |
3289 | test_bit(MD_RECOVERY_REQUESTED, &(conf->mddev->recovery))) | ||
3285 | s->syncing = 1; | 3290 | s->syncing = 1; |
3286 | else | 3291 | else |
3287 | s->replacing = 1; | 3292 | s->replacing = 1; |
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 7f98984e4fad..eab2ea424200 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c | |||
@@ -54,6 +54,7 @@ struct xc5000_priv { | |||
54 | struct list_head hybrid_tuner_instance_list; | 54 | struct list_head hybrid_tuner_instance_list; |
55 | 55 | ||
56 | u32 if_khz; | 56 | u32 if_khz; |
57 | u32 xtal_khz; | ||
57 | u32 freq_hz; | 58 | u32 freq_hz; |
58 | u32 bandwidth; | 59 | u32 bandwidth; |
59 | u8 video_standard; | 60 | u8 video_standard; |
@@ -214,9 +215,9 @@ static const struct xc5000_fw_cfg xc5000a_1_6_114 = { | |||
214 | .size = 12401, | 215 | .size = 12401, |
215 | }; | 216 | }; |
216 | 217 | ||
217 | static const struct xc5000_fw_cfg xc5000c_41_024_5_31875 = { | 218 | static const struct xc5000_fw_cfg xc5000c_41_024_5 = { |
218 | .name = "dvb-fe-xc5000c-41.024.5-31875.fw", | 219 | .name = "dvb-fe-xc5000c-41.024.5.fw", |
219 | .size = 16503, | 220 | .size = 16497, |
220 | }; | 221 | }; |
221 | 222 | ||
222 | static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) | 223 | static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) |
@@ -226,7 +227,7 @@ static inline const struct xc5000_fw_cfg *xc5000_assign_firmware(int chip_id) | |||
226 | case XC5000A: | 227 | case XC5000A: |
227 | return &xc5000a_1_6_114; | 228 | return &xc5000a_1_6_114; |
228 | case XC5000C: | 229 | case XC5000C: |
229 | return &xc5000c_41_024_5_31875; | 230 | return &xc5000c_41_024_5; |
230 | } | 231 | } |
231 | } | 232 | } |
232 | 233 | ||
@@ -572,6 +573,31 @@ static int xc_tune_channel(struct xc5000_priv *priv, u32 freq_hz, int mode) | |||
572 | return found; | 573 | return found; |
573 | } | 574 | } |
574 | 575 | ||
576 | static int xc_set_xtal(struct dvb_frontend *fe) | ||
577 | { | ||
578 | struct xc5000_priv *priv = fe->tuner_priv; | ||
579 | int ret = XC_RESULT_SUCCESS; | ||
580 | |||
581 | switch (priv->chip_id) { | ||
582 | default: | ||
583 | case XC5000A: | ||
584 | /* 32.000 MHz xtal is default */ | ||
585 | break; | ||
586 | case XC5000C: | ||
587 | switch (priv->xtal_khz) { | ||
588 | default: | ||
589 | case 32000: | ||
590 | /* 32.000 MHz xtal is default */ | ||
591 | break; | ||
592 | case 31875: | ||
593 | /* 31.875 MHz xtal configuration */ | ||
594 | ret = xc_write_reg(priv, 0x000f, 0x8081); | ||
595 | break; | ||
596 | } | ||
597 | break; | ||
598 | } | ||
599 | return ret; | ||
600 | } | ||
575 | 601 | ||
576 | static int xc5000_fwupload(struct dvb_frontend *fe) | 602 | static int xc5000_fwupload(struct dvb_frontend *fe) |
577 | { | 603 | { |
@@ -603,6 +629,8 @@ static int xc5000_fwupload(struct dvb_frontend *fe) | |||
603 | } else { | 629 | } else { |
604 | printk(KERN_INFO "xc5000: firmware uploading...\n"); | 630 | printk(KERN_INFO "xc5000: firmware uploading...\n"); |
605 | ret = xc_load_i2c_sequence(fe, fw->data); | 631 | ret = xc_load_i2c_sequence(fe, fw->data); |
632 | if (XC_RESULT_SUCCESS == ret) | ||
633 | ret = xc_set_xtal(fe); | ||
606 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); | 634 | printk(KERN_INFO "xc5000: firmware upload complete...\n"); |
607 | } | 635 | } |
608 | 636 | ||
@@ -1164,6 +1192,9 @@ struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | |||
1164 | priv->if_khz = cfg->if_khz; | 1192 | priv->if_khz = cfg->if_khz; |
1165 | } | 1193 | } |
1166 | 1194 | ||
1195 | if (priv->xtal_khz == 0) | ||
1196 | priv->xtal_khz = cfg->xtal_khz; | ||
1197 | |||
1167 | if (priv->radio_input == 0) | 1198 | if (priv->radio_input == 0) |
1168 | priv->radio_input = cfg->radio_input; | 1199 | priv->radio_input = cfg->radio_input; |
1169 | 1200 | ||
diff --git a/drivers/media/common/tuners/xc5000.h b/drivers/media/common/tuners/xc5000.h index 3396f8e02b40..39a73bf01406 100644 --- a/drivers/media/common/tuners/xc5000.h +++ b/drivers/media/common/tuners/xc5000.h | |||
@@ -34,6 +34,7 @@ struct xc5000_config { | |||
34 | u8 i2c_address; | 34 | u8 i2c_address; |
35 | u32 if_khz; | 35 | u32 if_khz; |
36 | u8 radio_input; | 36 | u8 radio_input; |
37 | u32 xtal_khz; | ||
37 | 38 | ||
38 | int chip_id; | 39 | int chip_id; |
39 | }; | 40 | }; |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 4555baa383b2..0f64d7182657 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -143,10 +143,12 @@ struct dvb_frontend_private { | |||
143 | static void dvb_frontend_wakeup(struct dvb_frontend *fe); | 143 | static void dvb_frontend_wakeup(struct dvb_frontend *fe); |
144 | static int dtv_get_frontend(struct dvb_frontend *fe, | 144 | static int dtv_get_frontend(struct dvb_frontend *fe, |
145 | struct dvb_frontend_parameters *p_out); | 145 | struct dvb_frontend_parameters *p_out); |
146 | static int dtv_property_legacy_params_sync(struct dvb_frontend *fe, | ||
147 | struct dvb_frontend_parameters *p); | ||
146 | 148 | ||
147 | static bool has_get_frontend(struct dvb_frontend *fe) | 149 | static bool has_get_frontend(struct dvb_frontend *fe) |
148 | { | 150 | { |
149 | return fe->ops.get_frontend; | 151 | return fe->ops.get_frontend != NULL; |
150 | } | 152 | } |
151 | 153 | ||
152 | /* | 154 | /* |
@@ -697,6 +699,7 @@ restart: | |||
697 | fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; | 699 | fepriv->algo_status |= DVBFE_ALGO_SEARCH_AGAIN; |
698 | fepriv->delay = HZ / 2; | 700 | fepriv->delay = HZ / 2; |
699 | } | 701 | } |
702 | dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); | ||
700 | fe->ops.read_status(fe, &s); | 703 | fe->ops.read_status(fe, &s); |
701 | if (s != fepriv->status) { | 704 | if (s != fepriv->status) { |
702 | dvb_frontend_add_event(fe, s); /* update event list */ | 705 | dvb_frontend_add_event(fe, s); /* update event list */ |
@@ -1443,6 +1446,28 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) | |||
1443 | __func__); | 1446 | __func__); |
1444 | return -EINVAL; | 1447 | return -EINVAL; |
1445 | } | 1448 | } |
1449 | /* | ||
1450 | * Get a delivery system that is compatible with DVBv3 | ||
1451 | * NOTE: in order for this to work with softwares like Kaffeine that | ||
1452 | * uses a DVBv5 call for DVB-S2 and a DVBv3 call to go back to | ||
1453 | * DVB-S, drivers that support both should put the SYS_DVBS entry | ||
1454 | * before the SYS_DVBS2, otherwise it won't switch back to DVB-S. | ||
1455 | * The real fix is that userspace applications should not use DVBv3 | ||
1456 | * and not trust on calling FE_SET_FRONTEND to switch the delivery | ||
1457 | * system. | ||
1458 | */ | ||
1459 | ncaps = 0; | ||
1460 | while (fe->ops.delsys[ncaps] && ncaps < MAX_DELSYS) { | ||
1461 | if (fe->ops.delsys[ncaps] == desired_system) { | ||
1462 | delsys = desired_system; | ||
1463 | break; | ||
1464 | } | ||
1465 | ncaps++; | ||
1466 | } | ||
1467 | if (delsys == SYS_UNDEFINED) { | ||
1468 | dprintk("%s() Couldn't find a delivery system that matches %d\n", | ||
1469 | __func__, desired_system); | ||
1470 | } | ||
1446 | } else { | 1471 | } else { |
1447 | /* | 1472 | /* |
1448 | * This is a DVBv5 call. So, it likely knows the supported | 1473 | * This is a DVBv5 call. So, it likely knows the supported |
@@ -1491,9 +1516,10 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) | |||
1491 | __func__); | 1516 | __func__); |
1492 | return -EINVAL; | 1517 | return -EINVAL; |
1493 | } | 1518 | } |
1494 | c->delivery_system = delsys; | ||
1495 | } | 1519 | } |
1496 | 1520 | ||
1521 | c->delivery_system = delsys; | ||
1522 | |||
1497 | /* | 1523 | /* |
1498 | * The DVBv3 or DVBv5 call is requesting a different system. So, | 1524 | * The DVBv3 or DVBv5 call is requesting a different system. So, |
1499 | * emulation is needed. | 1525 | * emulation is needed. |
@@ -1833,6 +1859,13 @@ static int dtv_set_frontend(struct dvb_frontend *fe) | |||
1833 | return -EINVAL; | 1859 | return -EINVAL; |
1834 | 1860 | ||
1835 | /* | 1861 | /* |
1862 | * Initialize output parameters to match the values given by | ||
1863 | * the user. FE_SET_FRONTEND triggers an initial frontend event | ||
1864 | * with status = 0, which copies output parameters to userspace. | ||
1865 | */ | ||
1866 | dtv_property_legacy_params_sync(fe, &fepriv->parameters_out); | ||
1867 | |||
1868 | /* | ||
1836 | * Be sure that the bandwidth will be filled for all | 1869 | * Be sure that the bandwidth will be filled for all |
1837 | * non-satellite systems, as tuners need to know what | 1870 | * non-satellite systems, as tuners need to know what |
1838 | * low pass/Nyquist half filter should be applied, in | 1871 | * low pass/Nyquist half filter should be applied, in |
diff --git a/drivers/media/dvb/dvb-usb/it913x.c b/drivers/media/dvb/dvb-usb/it913x.c index 3b7b102f20ae..482d249ca7f3 100644 --- a/drivers/media/dvb/dvb-usb/it913x.c +++ b/drivers/media/dvb/dvb-usb/it913x.c | |||
@@ -238,12 +238,27 @@ static int it913x_read_reg(struct usb_device *udev, u32 reg) | |||
238 | 238 | ||
239 | static u32 it913x_query(struct usb_device *udev, u8 pro) | 239 | static u32 it913x_query(struct usb_device *udev, u8 pro) |
240 | { | 240 | { |
241 | int ret; | 241 | int ret, i; |
242 | u8 data[4]; | 242 | u8 data[4]; |
243 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, | 243 | u8 ver; |
244 | 0x1222, 0, &data[0], 3); | 244 | |
245 | for (i = 0; i < 5; i++) { | ||
246 | ret = it913x_io(udev, READ_LONG, pro, CMD_DEMOD_READ, | ||
247 | 0x1222, 0, &data[0], 3); | ||
248 | ver = data[0]; | ||
249 | if (ver > 0 && ver < 3) | ||
250 | break; | ||
251 | msleep(100); | ||
252 | } | ||
245 | 253 | ||
246 | it913x_config.chip_ver = data[0]; | 254 | if (ver < 1 || ver > 2) { |
255 | info("Failed to identify chip version applying 1"); | ||
256 | it913x_config.chip_ver = 0x1; | ||
257 | it913x_config.chip_type = 0x9135; | ||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | it913x_config.chip_ver = ver; | ||
247 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; | 262 | it913x_config.chip_type = (u16)(data[2] << 8) + data[1]; |
248 | 263 | ||
249 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, | 264 | info("Chip Version=%02x Chip Type=%04x", it913x_config.chip_ver, |
@@ -660,30 +675,41 @@ static int it913x_download_firmware(struct usb_device *udev, | |||
660 | if ((packet_size > min_pkt) || (i == fw->size)) { | 675 | if ((packet_size > min_pkt) || (i == fw->size)) { |
661 | fw_data = (u8 *)(fw->data + pos); | 676 | fw_data = (u8 *)(fw->data + pos); |
662 | pos += packet_size; | 677 | pos += packet_size; |
663 | if (packet_size > 0) | 678 | if (packet_size > 0) { |
664 | ret |= it913x_io(udev, WRITE_DATA, | 679 | ret = it913x_io(udev, WRITE_DATA, |
665 | DEV_0, CMD_SCATTER_WRITE, 0, | 680 | DEV_0, CMD_SCATTER_WRITE, 0, |
666 | 0, fw_data, packet_size); | 681 | 0, fw_data, packet_size); |
682 | if (ret < 0) | ||
683 | break; | ||
684 | } | ||
667 | udelay(1000); | 685 | udelay(1000); |
668 | } | 686 | } |
669 | } | 687 | } |
670 | i++; | 688 | i++; |
671 | } | 689 | } |
672 | 690 | ||
673 | ret |= it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); | ||
674 | |||
675 | msleep(100); | ||
676 | |||
677 | if (ret < 0) | 691 | if (ret < 0) |
678 | info("FRM Firmware Download Failed (%04x)" , ret); | 692 | info("FRM Firmware Download Failed (%d)" , ret); |
679 | else | 693 | else |
680 | info("FRM Firmware Download Completed - Resetting Device"); | 694 | info("FRM Firmware Download Completed - Resetting Device"); |
681 | 695 | ||
682 | ret |= it913x_return_status(udev); | 696 | msleep(30); |
697 | |||
698 | ret = it913x_io(udev, WRITE_CMD, DEV_0, CMD_BOOT, 0, 0, NULL, 0); | ||
699 | if (ret < 0) | ||
700 | info("FRM Device not responding to reboot"); | ||
701 | |||
702 | ret = it913x_return_status(udev); | ||
703 | if (ret == 0) { | ||
704 | info("FRM Failed to reboot device"); | ||
705 | return -ENODEV; | ||
706 | } | ||
683 | 707 | ||
684 | msleep(30); | 708 | msleep(30); |
685 | 709 | ||
686 | ret |= it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); | 710 | ret = it913x_wr_reg(udev, DEV_0, I2C_CLK, I2C_CLK_400); |
711 | |||
712 | msleep(30); | ||
687 | 713 | ||
688 | /* Tuner function */ | 714 | /* Tuner function */ |
689 | if (it913x_config.dual_mode) | 715 | if (it913x_config.dual_mode) |
@@ -901,5 +927,5 @@ module_usb_driver(it913x_driver); | |||
901 | 927 | ||
902 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); | 928 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); |
903 | MODULE_DESCRIPTION("it913x USB 2 Driver"); | 929 | MODULE_DESCRIPTION("it913x USB 2 Driver"); |
904 | MODULE_VERSION("1.27"); | 930 | MODULE_VERSION("1.28"); |
905 | MODULE_LICENSE("GPL"); | 931 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index 36d11756492f..a414b1f2b6a5 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c | |||
@@ -1520,8 +1520,10 @@ static int scu_command(struct drxk_state *state, | |||
1520 | dprintk(1, "\n"); | 1520 | dprintk(1, "\n"); |
1521 | 1521 | ||
1522 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || | 1522 | if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) || |
1523 | ((resultLen > 0) && (result == NULL))) | 1523 | ((resultLen > 0) && (result == NULL))) { |
1524 | goto error; | 1524 | printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__); |
1525 | return status; | ||
1526 | } | ||
1525 | 1527 | ||
1526 | mutex_lock(&state->mutex); | 1528 | mutex_lock(&state->mutex); |
1527 | 1529 | ||
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index b09c5fae489b..af526586fa26 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c | |||
@@ -1046,6 +1046,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) | |||
1046 | goto exit_unregister_led; | 1046 | goto exit_unregister_led; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | data->dev->driver_type = RC_DRIVER_IR_RAW; | ||
1049 | data->dev->driver_name = WBCIR_NAME; | 1050 | data->dev->driver_name = WBCIR_NAME; |
1050 | data->dev->input_name = WBCIR_NAME; | 1051 | data->dev->input_name = WBCIR_NAME; |
1051 | data->dev->input_phys = "wbcir/cir0"; | 1052 | data->dev->input_phys = "wbcir/cir0"; |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index f2479c5c0eb2..ce1e7ba940f6 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -492,7 +492,7 @@ config VIDEO_VS6624 | |||
492 | 492 | ||
493 | config VIDEO_MT9M032 | 493 | config VIDEO_MT9M032 |
494 | tristate "MT9M032 camera sensor support" | 494 | tristate "MT9M032 camera sensor support" |
495 | depends on I2C && VIDEO_V4L2 | 495 | depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API |
496 | select VIDEO_APTINA_PLL | 496 | select VIDEO_APTINA_PLL |
497 | ---help--- | 497 | ---help--- |
498 | This driver supports MT9M032 camera sensors from Aptina, monochrome | 498 | This driver supports MT9M032 camera sensors from Aptina, monochrome |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 5452beef8e11..989e556913ed 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -1763,13 +1763,13 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1763 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); | 1763 | IVTV_DEBUG_IOCTL("AUDIO_CHANNEL_SELECT\n"); |
1764 | if (iarg > AUDIO_STEREO_SWAPPED) | 1764 | if (iarg > AUDIO_STEREO_SWAPPED) |
1765 | return -EINVAL; | 1765 | return -EINVAL; |
1766 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg); | 1766 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_playback, iarg + 1); |
1767 | 1767 | ||
1768 | case AUDIO_BILINGUAL_CHANNEL_SELECT: | 1768 | case AUDIO_BILINGUAL_CHANNEL_SELECT: |
1769 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); | 1769 | IVTV_DEBUG_IOCTL("AUDIO_BILINGUAL_CHANNEL_SELECT\n"); |
1770 | if (iarg > AUDIO_STEREO_SWAPPED) | 1770 | if (iarg > AUDIO_STEREO_SWAPPED) |
1771 | return -EINVAL; | 1771 | return -EINVAL; |
1772 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg); | 1772 | return v4l2_ctrl_s_ctrl(itv->ctrl_audio_multilingual_playback, iarg + 1); |
1773 | 1773 | ||
1774 | default: | 1774 | default: |
1775 | return -EINVAL; | 1775 | return -EINVAL; |
diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c index 7636672c3548..645973c5feb0 100644 --- a/drivers/media/video/mt9m032.c +++ b/drivers/media/video/mt9m032.c | |||
@@ -392,10 +392,11 @@ static int mt9m032_set_pad_format(struct v4l2_subdev *subdev, | |||
392 | } | 392 | } |
393 | 393 | ||
394 | /* Scaling is not supported, the format is thus fixed. */ | 394 | /* Scaling is not supported, the format is thus fixed. */ |
395 | ret = mt9m032_get_pad_format(subdev, fh, fmt); | 395 | fmt->format = *__mt9m032_get_pad_format(sensor, fh, fmt->which); |
396 | ret = 0; | ||
396 | 397 | ||
397 | done: | 398 | done: |
398 | mutex_lock(&sensor->lock); | 399 | mutex_unlock(&sensor->lock); |
399 | return ret; | 400 | return ret; |
400 | } | 401 | } |
401 | 402 | ||
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 4a44f9a1bae0..b76b0ac0958f 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -468,22 +468,30 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf, | |||
468 | spin_unlock_irqrestore(&stream->clock.lock, flags); | 468 | spin_unlock_irqrestore(&stream->clock.lock, flags); |
469 | } | 469 | } |
470 | 470 | ||
471 | static int uvc_video_clock_init(struct uvc_streaming *stream) | 471 | static void uvc_video_clock_reset(struct uvc_streaming *stream) |
472 | { | 472 | { |
473 | struct uvc_clock *clock = &stream->clock; | 473 | struct uvc_clock *clock = &stream->clock; |
474 | 474 | ||
475 | spin_lock_init(&clock->lock); | ||
476 | clock->head = 0; | 475 | clock->head = 0; |
477 | clock->count = 0; | 476 | clock->count = 0; |
478 | clock->size = 32; | ||
479 | clock->last_sof = -1; | 477 | clock->last_sof = -1; |
480 | clock->sof_offset = -1; | 478 | clock->sof_offset = -1; |
479 | } | ||
480 | |||
481 | static int uvc_video_clock_init(struct uvc_streaming *stream) | ||
482 | { | ||
483 | struct uvc_clock *clock = &stream->clock; | ||
484 | |||
485 | spin_lock_init(&clock->lock); | ||
486 | clock->size = 32; | ||
481 | 487 | ||
482 | clock->samples = kmalloc(clock->size * sizeof(*clock->samples), | 488 | clock->samples = kmalloc(clock->size * sizeof(*clock->samples), |
483 | GFP_KERNEL); | 489 | GFP_KERNEL); |
484 | if (clock->samples == NULL) | 490 | if (clock->samples == NULL) |
485 | return -ENOMEM; | 491 | return -ENOMEM; |
486 | 492 | ||
493 | uvc_video_clock_reset(stream); | ||
494 | |||
487 | return 0; | 495 | return 0; |
488 | } | 496 | } |
489 | 497 | ||
@@ -1424,8 +1432,6 @@ static void uvc_uninit_video(struct uvc_streaming *stream, int free_buffers) | |||
1424 | 1432 | ||
1425 | if (free_buffers) | 1433 | if (free_buffers) |
1426 | uvc_free_urb_buffers(stream); | 1434 | uvc_free_urb_buffers(stream); |
1427 | |||
1428 | uvc_video_clock_cleanup(stream); | ||
1429 | } | 1435 | } |
1430 | 1436 | ||
1431 | /* | 1437 | /* |
@@ -1555,10 +1561,6 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags) | |||
1555 | 1561 | ||
1556 | uvc_video_stats_start(stream); | 1562 | uvc_video_stats_start(stream); |
1557 | 1563 | ||
1558 | ret = uvc_video_clock_init(stream); | ||
1559 | if (ret < 0) | ||
1560 | return ret; | ||
1561 | |||
1562 | if (intf->num_altsetting > 1) { | 1564 | if (intf->num_altsetting > 1) { |
1563 | struct usb_host_endpoint *best_ep = NULL; | 1565 | struct usb_host_endpoint *best_ep = NULL; |
1564 | unsigned int best_psize = 3 * 1024; | 1566 | unsigned int best_psize = 3 * 1024; |
@@ -1683,6 +1685,8 @@ int uvc_video_resume(struct uvc_streaming *stream, int reset) | |||
1683 | 1685 | ||
1684 | stream->frozen = 0; | 1686 | stream->frozen = 0; |
1685 | 1687 | ||
1688 | uvc_video_clock_reset(stream); | ||
1689 | |||
1686 | ret = uvc_commit_video(stream, &stream->ctrl); | 1690 | ret = uvc_commit_video(stream, &stream->ctrl); |
1687 | if (ret < 0) { | 1691 | if (ret < 0) { |
1688 | uvc_queue_enable(&stream->queue, 0); | 1692 | uvc_queue_enable(&stream->queue, 0); |
@@ -1819,25 +1823,35 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable) | |||
1819 | uvc_uninit_video(stream, 1); | 1823 | uvc_uninit_video(stream, 1); |
1820 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | 1824 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); |
1821 | uvc_queue_enable(&stream->queue, 0); | 1825 | uvc_queue_enable(&stream->queue, 0); |
1826 | uvc_video_clock_cleanup(stream); | ||
1822 | return 0; | 1827 | return 0; |
1823 | } | 1828 | } |
1824 | 1829 | ||
1825 | ret = uvc_queue_enable(&stream->queue, 1); | 1830 | ret = uvc_video_clock_init(stream); |
1826 | if (ret < 0) | 1831 | if (ret < 0) |
1827 | return ret; | 1832 | return ret; |
1828 | 1833 | ||
1834 | ret = uvc_queue_enable(&stream->queue, 1); | ||
1835 | if (ret < 0) | ||
1836 | goto error_queue; | ||
1837 | |||
1829 | /* Commit the streaming parameters. */ | 1838 | /* Commit the streaming parameters. */ |
1830 | ret = uvc_commit_video(stream, &stream->ctrl); | 1839 | ret = uvc_commit_video(stream, &stream->ctrl); |
1831 | if (ret < 0) { | 1840 | if (ret < 0) |
1832 | uvc_queue_enable(&stream->queue, 0); | 1841 | goto error_commit; |
1833 | return ret; | ||
1834 | } | ||
1835 | 1842 | ||
1836 | ret = uvc_init_video(stream, GFP_KERNEL); | 1843 | ret = uvc_init_video(stream, GFP_KERNEL); |
1837 | if (ret < 0) { | 1844 | if (ret < 0) |
1838 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | 1845 | goto error_video; |
1839 | uvc_queue_enable(&stream->queue, 0); | 1846 | |
1840 | } | 1847 | return 0; |
1848 | |||
1849 | error_video: | ||
1850 | usb_set_interface(stream->dev->udev, stream->intfnum, 0); | ||
1851 | error_commit: | ||
1852 | uvc_queue_enable(&stream->queue, 0); | ||
1853 | error_queue: | ||
1854 | uvc_video_clock_cleanup(stream); | ||
1841 | 1855 | ||
1842 | return ret; | 1856 | return ret; |
1843 | } | 1857 | } |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 29f463cc09cb..11e44386fa9b 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -268,10 +268,17 @@ config TWL6030_PWM | |||
268 | This is used to control charging LED brightness. | 268 | This is used to control charging LED brightness. |
269 | 269 | ||
270 | config TWL6040_CORE | 270 | config TWL6040_CORE |
271 | bool | 271 | bool "Support for TWL6040 audio codec" |
272 | depends on TWL4030_CORE && GENERIC_HARDIRQS | 272 | depends on I2C=y && GENERIC_HARDIRQS |
273 | select MFD_CORE | 273 | select MFD_CORE |
274 | select REGMAP_I2C | ||
274 | default n | 275 | default n |
276 | help | ||
277 | Say yes here if you want support for Texas Instruments TWL6040 audio | ||
278 | codec. | ||
279 | This driver provides common support for accessing the device, | ||
280 | additional drivers must be enabled in order to use the | ||
281 | functionality of the device (audio, vibra). | ||
275 | 282 | ||
276 | config MFD_STMPE | 283 | config MFD_STMPE |
277 | bool "Support STMicroelectronics STMPE" | 284 | bool "Support STMicroelectronics STMPE" |
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index 3aa36eb5c79b..44a3fdbadef4 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c | |||
@@ -262,13 +262,6 @@ static ssize_t aat2870_dump_reg(struct aat2870_data *aat2870, char *buf) | |||
262 | return count; | 262 | return count; |
263 | } | 263 | } |
264 | 264 | ||
265 | static int aat2870_reg_open_file(struct inode *inode, struct file *file) | ||
266 | { | ||
267 | file->private_data = inode->i_private; | ||
268 | |||
269 | return 0; | ||
270 | } | ||
271 | |||
272 | static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf, | 265 | static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf, |
273 | size_t count, loff_t *ppos) | 266 | size_t count, loff_t *ppos) |
274 | { | 267 | { |
@@ -330,7 +323,7 @@ static ssize_t aat2870_reg_write_file(struct file *file, | |||
330 | } | 323 | } |
331 | 324 | ||
332 | static const struct file_operations aat2870_reg_fops = { | 325 | static const struct file_operations aat2870_reg_fops = { |
333 | .open = aat2870_reg_open_file, | 326 | .open = simple_open, |
334 | .read = aat2870_reg_read_file, | 327 | .read = aat2870_reg_read_file, |
335 | .write = aat2870_reg_write_file, | 328 | .write = aat2870_reg_write_file, |
336 | }; | 329 | }; |
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index 60107ee166fc..1efad20fb175 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c | |||
@@ -483,12 +483,6 @@ struct ab3100_get_set_reg_priv { | |||
483 | bool mode; | 483 | bool mode; |
484 | }; | 484 | }; |
485 | 485 | ||
486 | static int ab3100_get_set_reg_open_file(struct inode *inode, struct file *file) | ||
487 | { | ||
488 | file->private_data = inode->i_private; | ||
489 | return 0; | ||
490 | } | ||
491 | |||
492 | static ssize_t ab3100_get_set_reg(struct file *file, | 486 | static ssize_t ab3100_get_set_reg(struct file *file, |
493 | const char __user *user_buf, | 487 | const char __user *user_buf, |
494 | size_t count, loff_t *ppos) | 488 | size_t count, loff_t *ppos) |
@@ -583,7 +577,7 @@ static ssize_t ab3100_get_set_reg(struct file *file, | |||
583 | } | 577 | } |
584 | 578 | ||
585 | static const struct file_operations ab3100_get_set_reg_fops = { | 579 | static const struct file_operations ab3100_get_set_reg_fops = { |
586 | .open = ab3100_get_set_reg_open_file, | 580 | .open = simple_open, |
587 | .write = ab3100_get_set_reg, | 581 | .write = ab3100_get_set_reg, |
588 | .llseek = noop_llseek, | 582 | .llseek = noop_llseek, |
589 | }; | 583 | }; |
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 1895cf9fab8c..1582c3d95257 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -527,7 +527,9 @@ static void asic3_gpio_set(struct gpio_chip *chip, | |||
527 | 527 | ||
528 | static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 528 | static int asic3_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
529 | { | 529 | { |
530 | return (offset < ASIC3_NUM_GPIOS) ? IRQ_BOARD_START + offset : -ENXIO; | 530 | struct asic3 *asic = container_of(chip, struct asic3, gpio); |
531 | |||
532 | return (offset < ASIC3_NUM_GPIOS) ? asic->irq_base + offset : -ENXIO; | ||
531 | } | 533 | } |
532 | 534 | ||
533 | static __init int asic3_gpio_probe(struct platform_device *pdev, | 535 | static __init int asic3_gpio_probe(struct platform_device *pdev, |
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index ebc1e8658226..5be32489714f 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c | |||
@@ -2788,6 +2788,7 @@ static struct regulator_init_data db8500_regulators[DB8500_NUM_REGULATORS] = { | |||
2788 | .constraints = { | 2788 | .constraints = { |
2789 | .name = "db8500-vape", | 2789 | .name = "db8500-vape", |
2790 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | 2790 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
2791 | .always_on = true, | ||
2791 | }, | 2792 | }, |
2792 | .consumer_supplies = db8500_vape_consumers, | 2793 | .consumer_supplies = db8500_vape_consumers, |
2793 | .num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers), | 2794 | .num_consumer_supplies = ARRAY_SIZE(db8500_vape_consumers), |
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 95a2e546a489..7e96bb229724 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <linux/dma-mapping.h> | 26 | #include <linux/dma-mapping.h> |
27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
28 | #include <linux/gpio.h> | 28 | #include <plat/cpu.h> |
29 | #include <plat/usb.h> | 29 | #include <plat/usb.h> |
30 | #include <linux/pm_runtime.h> | 30 | #include <linux/pm_runtime.h> |
31 | 31 | ||
@@ -502,19 +502,6 @@ static void omap_usbhs_init(struct device *dev) | |||
502 | pm_runtime_get_sync(dev); | 502 | pm_runtime_get_sync(dev); |
503 | spin_lock_irqsave(&omap->lock, flags); | 503 | spin_lock_irqsave(&omap->lock, flags); |
504 | 504 | ||
505 | if (pdata->ehci_data->phy_reset) { | ||
506 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
507 | gpio_request_one(pdata->ehci_data->reset_gpio_port[0], | ||
508 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
509 | |||
510 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
511 | gpio_request_one(pdata->ehci_data->reset_gpio_port[1], | ||
512 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
513 | |||
514 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
515 | udelay(10); | ||
516 | } | ||
517 | |||
518 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); | 505 | omap->usbhs_rev = usbhs_read(omap->uhh_base, OMAP_UHH_REVISION); |
519 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); | 506 | dev_dbg(dev, "OMAP UHH_REVISION 0x%x\n", omap->usbhs_rev); |
520 | 507 | ||
@@ -593,39 +580,10 @@ static void omap_usbhs_init(struct device *dev) | |||
593 | usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); | 580 | usbhs_omap_tll_init(dev, OMAP_TLL_CHANNEL_COUNT); |
594 | } | 581 | } |
595 | 582 | ||
596 | if (pdata->ehci_data->phy_reset) { | ||
597 | /* Hold the PHY in RESET for enough time till | ||
598 | * PHY is settled and ready | ||
599 | */ | ||
600 | udelay(10); | ||
601 | |||
602 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
603 | gpio_set_value | ||
604 | (pdata->ehci_data->reset_gpio_port[0], 1); | ||
605 | |||
606 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
607 | gpio_set_value | ||
608 | (pdata->ehci_data->reset_gpio_port[1], 1); | ||
609 | } | ||
610 | |||
611 | spin_unlock_irqrestore(&omap->lock, flags); | 583 | spin_unlock_irqrestore(&omap->lock, flags); |
612 | pm_runtime_put_sync(dev); | 584 | pm_runtime_put_sync(dev); |
613 | } | 585 | } |
614 | 586 | ||
615 | static void omap_usbhs_deinit(struct device *dev) | ||
616 | { | ||
617 | struct usbhs_hcd_omap *omap = dev_get_drvdata(dev); | ||
618 | struct usbhs_omap_platform_data *pdata = &omap->platdata; | ||
619 | |||
620 | if (pdata->ehci_data->phy_reset) { | ||
621 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[0])) | ||
622 | gpio_free(pdata->ehci_data->reset_gpio_port[0]); | ||
623 | |||
624 | if (gpio_is_valid(pdata->ehci_data->reset_gpio_port[1])) | ||
625 | gpio_free(pdata->ehci_data->reset_gpio_port[1]); | ||
626 | } | ||
627 | } | ||
628 | |||
629 | 587 | ||
630 | /** | 588 | /** |
631 | * usbhs_omap_probe - initialize TI-based HCDs | 589 | * usbhs_omap_probe - initialize TI-based HCDs |
@@ -860,7 +818,6 @@ static int __devexit usbhs_omap_remove(struct platform_device *pdev) | |||
860 | { | 818 | { |
861 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); | 819 | struct usbhs_hcd_omap *omap = platform_get_drvdata(pdev); |
862 | 820 | ||
863 | omap_usbhs_deinit(&pdev->dev); | ||
864 | iounmap(omap->tll_base); | 821 | iounmap(omap->tll_base); |
865 | iounmap(omap->uhh_base); | 822 | iounmap(omap->uhh_base); |
866 | clk_put(omap->init_60m_fclk); | 823 | clk_put(omap->init_60m_fclk); |
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c index 99ef944c621d..44afae0a69ce 100644 --- a/drivers/mfd/rc5t583.c +++ b/drivers/mfd/rc5t583.c | |||
@@ -80,44 +80,6 @@ static struct mfd_cell rc5t583_subdevs[] = { | |||
80 | {.name = "rc5t583-key", } | 80 | {.name = "rc5t583-key", } |
81 | }; | 81 | }; |
82 | 82 | ||
83 | int rc5t583_write(struct device *dev, uint8_t reg, uint8_t val) | ||
84 | { | ||
85 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
86 | return regmap_write(rc5t583->regmap, reg, val); | ||
87 | } | ||
88 | |||
89 | int rc5t583_read(struct device *dev, uint8_t reg, uint8_t *val) | ||
90 | { | ||
91 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
92 | unsigned int ival; | ||
93 | int ret; | ||
94 | ret = regmap_read(rc5t583->regmap, reg, &ival); | ||
95 | if (!ret) | ||
96 | *val = (uint8_t)ival; | ||
97 | return ret; | ||
98 | } | ||
99 | |||
100 | int rc5t583_set_bits(struct device *dev, unsigned int reg, | ||
101 | unsigned int bit_mask) | ||
102 | { | ||
103 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
104 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, bit_mask); | ||
105 | } | ||
106 | |||
107 | int rc5t583_clear_bits(struct device *dev, unsigned int reg, | ||
108 | unsigned int bit_mask) | ||
109 | { | ||
110 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
111 | return regmap_update_bits(rc5t583->regmap, reg, bit_mask, 0); | ||
112 | } | ||
113 | |||
114 | int rc5t583_update(struct device *dev, unsigned int reg, | ||
115 | unsigned int val, unsigned int mask) | ||
116 | { | ||
117 | struct rc5t583 *rc5t583 = dev_get_drvdata(dev); | ||
118 | return regmap_update_bits(rc5t583->regmap, reg, mask, val); | ||
119 | } | ||
120 | |||
121 | static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, | 83 | static int __rc5t583_set_ext_pwrreq1_control(struct device *dev, |
122 | int id, int ext_pwr, int slots) | 84 | int id, int ext_pwr, int slots) |
123 | { | 85 | { |
@@ -197,6 +159,7 @@ int rc5t583_ext_power_req_config(struct device *dev, int ds_id, | |||
197 | ds_id, ext_pwr_req); | 159 | ds_id, ext_pwr_req); |
198 | return 0; | 160 | return 0; |
199 | } | 161 | } |
162 | EXPORT_SYMBOL(rc5t583_ext_power_req_config); | ||
200 | 163 | ||
201 | static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, | 164 | static int rc5t583_clear_ext_power_req(struct rc5t583 *rc5t583, |
202 | struct rc5t583_platform_data *pdata) | 165 | struct rc5t583_platform_data *pdata) |
diff --git a/drivers/mfd/twl6040-core.c b/drivers/mfd/twl6040-core.c index b2d8e512d3cb..2d6bedadca09 100644 --- a/drivers/mfd/twl6040-core.c +++ b/drivers/mfd/twl6040-core.c | |||
@@ -30,7 +30,9 @@ | |||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/i2c/twl.h> | 33 | #include <linux/i2c.h> |
34 | #include <linux/regmap.h> | ||
35 | #include <linux/err.h> | ||
34 | #include <linux/mfd/core.h> | 36 | #include <linux/mfd/core.h> |
35 | #include <linux/mfd/twl6040.h> | 37 | #include <linux/mfd/twl6040.h> |
36 | 38 | ||
@@ -39,7 +41,7 @@ | |||
39 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | 41 | int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) |
40 | { | 42 | { |
41 | int ret; | 43 | int ret; |
42 | u8 val = 0; | 44 | unsigned int val; |
43 | 45 | ||
44 | mutex_lock(&twl6040->io_mutex); | 46 | mutex_lock(&twl6040->io_mutex); |
45 | /* Vibra control registers from cache */ | 47 | /* Vibra control registers from cache */ |
@@ -47,7 +49,7 @@ int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg) | |||
47 | reg == TWL6040_REG_VIBCTLR)) { | 49 | reg == TWL6040_REG_VIBCTLR)) { |
48 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; | 50 | val = twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)]; |
49 | } else { | 51 | } else { |
50 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 52 | ret = regmap_read(twl6040->regmap, reg, &val); |
51 | if (ret < 0) { | 53 | if (ret < 0) { |
52 | mutex_unlock(&twl6040->io_mutex); | 54 | mutex_unlock(&twl6040->io_mutex); |
53 | return ret; | 55 | return ret; |
@@ -64,7 +66,7 @@ int twl6040_reg_write(struct twl6040 *twl6040, unsigned int reg, u8 val) | |||
64 | int ret; | 66 | int ret; |
65 | 67 | ||
66 | mutex_lock(&twl6040->io_mutex); | 68 | mutex_lock(&twl6040->io_mutex); |
67 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | 69 | ret = regmap_write(twl6040->regmap, reg, val); |
68 | /* Cache the vibra control registers */ | 70 | /* Cache the vibra control registers */ |
69 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) | 71 | if (reg == TWL6040_REG_VIBCTLL || reg == TWL6040_REG_VIBCTLR) |
70 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; | 72 | twl6040->vibra_ctrl_cache[VIBRACTRL_MEMBER(reg)] = val; |
@@ -77,16 +79,9 @@ EXPORT_SYMBOL(twl6040_reg_write); | |||
77 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 79 | int twl6040_set_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
78 | { | 80 | { |
79 | int ret; | 81 | int ret; |
80 | u8 val; | ||
81 | 82 | ||
82 | mutex_lock(&twl6040->io_mutex); | 83 | mutex_lock(&twl6040->io_mutex); |
83 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 84 | ret = regmap_update_bits(twl6040->regmap, reg, mask, mask); |
84 | if (ret) | ||
85 | goto out; | ||
86 | |||
87 | val |= mask; | ||
88 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | ||
89 | out: | ||
90 | mutex_unlock(&twl6040->io_mutex); | 85 | mutex_unlock(&twl6040->io_mutex); |
91 | return ret; | 86 | return ret; |
92 | } | 87 | } |
@@ -95,16 +90,9 @@ EXPORT_SYMBOL(twl6040_set_bits); | |||
95 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) | 90 | int twl6040_clear_bits(struct twl6040 *twl6040, unsigned int reg, u8 mask) |
96 | { | 91 | { |
97 | int ret; | 92 | int ret; |
98 | u8 val; | ||
99 | 93 | ||
100 | mutex_lock(&twl6040->io_mutex); | 94 | mutex_lock(&twl6040->io_mutex); |
101 | ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &val, reg); | 95 | ret = regmap_update_bits(twl6040->regmap, reg, mask, 0); |
102 | if (ret) | ||
103 | goto out; | ||
104 | |||
105 | val &= ~mask; | ||
106 | ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, val, reg); | ||
107 | out: | ||
108 | mutex_unlock(&twl6040->io_mutex); | 96 | mutex_unlock(&twl6040->io_mutex); |
109 | return ret; | 97 | return ret; |
110 | } | 98 | } |
@@ -494,32 +482,58 @@ static struct resource twl6040_codec_rsrc[] = { | |||
494 | }, | 482 | }, |
495 | }; | 483 | }; |
496 | 484 | ||
497 | static int __devinit twl6040_probe(struct platform_device *pdev) | 485 | static bool twl6040_readable_reg(struct device *dev, unsigned int reg) |
498 | { | 486 | { |
499 | struct twl4030_audio_data *pdata = pdev->dev.platform_data; | 487 | /* Register 0 is not readable */ |
488 | if (!reg) | ||
489 | return false; | ||
490 | return true; | ||
491 | } | ||
492 | |||
493 | static struct regmap_config twl6040_regmap_config = { | ||
494 | .reg_bits = 8, | ||
495 | .val_bits = 8, | ||
496 | .max_register = TWL6040_REG_STATUS, /* 0x2e */ | ||
497 | |||
498 | .readable_reg = twl6040_readable_reg, | ||
499 | }; | ||
500 | |||
501 | static int __devinit twl6040_probe(struct i2c_client *client, | ||
502 | const struct i2c_device_id *id) | ||
503 | { | ||
504 | struct twl6040_platform_data *pdata = client->dev.platform_data; | ||
500 | struct twl6040 *twl6040; | 505 | struct twl6040 *twl6040; |
501 | struct mfd_cell *cell = NULL; | 506 | struct mfd_cell *cell = NULL; |
502 | int ret, children = 0; | 507 | int ret, children = 0; |
503 | 508 | ||
504 | if (!pdata) { | 509 | if (!pdata) { |
505 | dev_err(&pdev->dev, "Platform data is missing\n"); | 510 | dev_err(&client->dev, "Platform data is missing\n"); |
506 | return -EINVAL; | 511 | return -EINVAL; |
507 | } | 512 | } |
508 | 513 | ||
509 | /* In order to operate correctly we need valid interrupt config */ | 514 | /* In order to operate correctly we need valid interrupt config */ |
510 | if (!pdata->naudint_irq || !pdata->irq_base) { | 515 | if (!client->irq || !pdata->irq_base) { |
511 | dev_err(&pdev->dev, "Invalid IRQ configuration\n"); | 516 | dev_err(&client->dev, "Invalid IRQ configuration\n"); |
512 | return -EINVAL; | 517 | return -EINVAL; |
513 | } | 518 | } |
514 | 519 | ||
515 | twl6040 = kzalloc(sizeof(struct twl6040), GFP_KERNEL); | 520 | twl6040 = devm_kzalloc(&client->dev, sizeof(struct twl6040), |
516 | if (!twl6040) | 521 | GFP_KERNEL); |
517 | return -ENOMEM; | 522 | if (!twl6040) { |
523 | ret = -ENOMEM; | ||
524 | goto err; | ||
525 | } | ||
526 | |||
527 | twl6040->regmap = regmap_init_i2c(client, &twl6040_regmap_config); | ||
528 | if (IS_ERR(twl6040->regmap)) { | ||
529 | ret = PTR_ERR(twl6040->regmap); | ||
530 | goto err; | ||
531 | } | ||
518 | 532 | ||
519 | platform_set_drvdata(pdev, twl6040); | 533 | i2c_set_clientdata(client, twl6040); |
520 | 534 | ||
521 | twl6040->dev = &pdev->dev; | 535 | twl6040->dev = &client->dev; |
522 | twl6040->irq = pdata->naudint_irq; | 536 | twl6040->irq = client->irq; |
523 | twl6040->irq_base = pdata->irq_base; | 537 | twl6040->irq_base = pdata->irq_base; |
524 | 538 | ||
525 | mutex_init(&twl6040->mutex); | 539 | mutex_init(&twl6040->mutex); |
@@ -588,12 +602,12 @@ static int __devinit twl6040_probe(struct platform_device *pdev) | |||
588 | } | 602 | } |
589 | 603 | ||
590 | if (children) { | 604 | if (children) { |
591 | ret = mfd_add_devices(&pdev->dev, pdev->id, twl6040->cells, | 605 | ret = mfd_add_devices(&client->dev, -1, twl6040->cells, |
592 | children, NULL, 0); | 606 | children, NULL, 0); |
593 | if (ret) | 607 | if (ret) |
594 | goto mfd_err; | 608 | goto mfd_err; |
595 | } else { | 609 | } else { |
596 | dev_err(&pdev->dev, "No platform data found for children\n"); | 610 | dev_err(&client->dev, "No platform data found for children\n"); |
597 | ret = -ENODEV; | 611 | ret = -ENODEV; |
598 | goto mfd_err; | 612 | goto mfd_err; |
599 | } | 613 | } |
@@ -608,14 +622,15 @@ gpio2_err: | |||
608 | if (gpio_is_valid(twl6040->audpwron)) | 622 | if (gpio_is_valid(twl6040->audpwron)) |
609 | gpio_free(twl6040->audpwron); | 623 | gpio_free(twl6040->audpwron); |
610 | gpio1_err: | 624 | gpio1_err: |
611 | platform_set_drvdata(pdev, NULL); | 625 | i2c_set_clientdata(client, NULL); |
612 | kfree(twl6040); | 626 | regmap_exit(twl6040->regmap); |
627 | err: | ||
613 | return ret; | 628 | return ret; |
614 | } | 629 | } |
615 | 630 | ||
616 | static int __devexit twl6040_remove(struct platform_device *pdev) | 631 | static int __devexit twl6040_remove(struct i2c_client *client) |
617 | { | 632 | { |
618 | struct twl6040 *twl6040 = platform_get_drvdata(pdev); | 633 | struct twl6040 *twl6040 = i2c_get_clientdata(client); |
619 | 634 | ||
620 | if (twl6040->power_count) | 635 | if (twl6040->power_count) |
621 | twl6040_power(twl6040, 0); | 636 | twl6040_power(twl6040, 0); |
@@ -626,23 +641,30 @@ static int __devexit twl6040_remove(struct platform_device *pdev) | |||
626 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); | 641 | free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040); |
627 | twl6040_irq_exit(twl6040); | 642 | twl6040_irq_exit(twl6040); |
628 | 643 | ||
629 | mfd_remove_devices(&pdev->dev); | 644 | mfd_remove_devices(&client->dev); |
630 | platform_set_drvdata(pdev, NULL); | 645 | i2c_set_clientdata(client, NULL); |
631 | kfree(twl6040); | 646 | regmap_exit(twl6040->regmap); |
632 | 647 | ||
633 | return 0; | 648 | return 0; |
634 | } | 649 | } |
635 | 650 | ||
636 | static struct platform_driver twl6040_driver = { | 651 | static const struct i2c_device_id twl6040_i2c_id[] = { |
652 | { "twl6040", 0, }, | ||
653 | { }, | ||
654 | }; | ||
655 | MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id); | ||
656 | |||
657 | static struct i2c_driver twl6040_driver = { | ||
658 | .driver = { | ||
659 | .name = "twl6040", | ||
660 | .owner = THIS_MODULE, | ||
661 | }, | ||
637 | .probe = twl6040_probe, | 662 | .probe = twl6040_probe, |
638 | .remove = __devexit_p(twl6040_remove), | 663 | .remove = __devexit_p(twl6040_remove), |
639 | .driver = { | 664 | .id_table = twl6040_i2c_id, |
640 | .owner = THIS_MODULE, | ||
641 | .name = "twl6040", | ||
642 | }, | ||
643 | }; | 665 | }; |
644 | 666 | ||
645 | module_platform_driver(twl6040_driver); | 667 | module_i2c_driver(twl6040_driver); |
646 | 668 | ||
647 | MODULE_DESCRIPTION("TWL6040 MFD"); | 669 | MODULE_DESCRIPTION("TWL6040 MFD"); |
648 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); | 670 | MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); |
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c index 1c034b80d408..6673e578b3e9 100644 --- a/drivers/misc/ibmasm/ibmasmfs.c +++ b/drivers/misc/ibmasm/ibmasmfs.c | |||
@@ -500,12 +500,6 @@ static ssize_t r_heartbeat_file_write(struct file *file, const char __user *buf, | |||
500 | return 1; | 500 | return 1; |
501 | } | 501 | } |
502 | 502 | ||
503 | static int remote_settings_file_open(struct inode *inode, struct file *file) | ||
504 | { | ||
505 | file->private_data = inode->i_private; | ||
506 | return 0; | ||
507 | } | ||
508 | |||
509 | static int remote_settings_file_close(struct inode *inode, struct file *file) | 503 | static int remote_settings_file_close(struct inode *inode, struct file *file) |
510 | { | 504 | { |
511 | return 0; | 505 | return 0; |
@@ -600,7 +594,7 @@ static const struct file_operations r_heartbeat_fops = { | |||
600 | }; | 594 | }; |
601 | 595 | ||
602 | static const struct file_operations remote_settings_fops = { | 596 | static const struct file_operations remote_settings_fops = { |
603 | .open = remote_settings_file_open, | 597 | .open = simple_open, |
604 | .release = remote_settings_file_close, | 598 | .release = remote_settings_file_close, |
605 | .read = remote_settings_file_read, | 599 | .read = remote_settings_file_read, |
606 | .write = remote_settings_file_write, | 600 | .write = remote_settings_file_write, |
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index 3f7ad83ed740..3aa9a969b373 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c | |||
@@ -134,12 +134,17 @@ static int force_hwbrks; | |||
134 | static int hwbreaks_ok; | 134 | static int hwbreaks_ok; |
135 | static int hw_break_val; | 135 | static int hw_break_val; |
136 | static int hw_break_val2; | 136 | static int hw_break_val2; |
137 | static int cont_instead_of_sstep; | ||
138 | static unsigned long cont_thread_id; | ||
139 | static unsigned long sstep_thread_id; | ||
137 | #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_SPARC) | 140 | #if defined(CONFIG_ARM) || defined(CONFIG_MIPS) || defined(CONFIG_SPARC) |
138 | static int arch_needs_sstep_emulation = 1; | 141 | static int arch_needs_sstep_emulation = 1; |
139 | #else | 142 | #else |
140 | static int arch_needs_sstep_emulation; | 143 | static int arch_needs_sstep_emulation; |
141 | #endif | 144 | #endif |
145 | static unsigned long cont_addr; | ||
142 | static unsigned long sstep_addr; | 146 | static unsigned long sstep_addr; |
147 | static int restart_from_top_after_write; | ||
143 | static int sstep_state; | 148 | static int sstep_state; |
144 | 149 | ||
145 | /* Storage for the registers, in GDB format. */ | 150 | /* Storage for the registers, in GDB format. */ |
@@ -187,7 +192,8 @@ static int kgdbts_unreg_thread(void *ptr) | |||
187 | */ | 192 | */ |
188 | while (!final_ack) | 193 | while (!final_ack) |
189 | msleep_interruptible(1500); | 194 | msleep_interruptible(1500); |
190 | 195 | /* Pause for any other threads to exit after final ack. */ | |
196 | msleep_interruptible(1000); | ||
191 | if (configured) | 197 | if (configured) |
192 | kgdb_unregister_io_module(&kgdbts_io_ops); | 198 | kgdb_unregister_io_module(&kgdbts_io_ops); |
193 | configured = 0; | 199 | configured = 0; |
@@ -211,7 +217,7 @@ static unsigned long lookup_addr(char *arg) | |||
211 | if (!strcmp(arg, "kgdbts_break_test")) | 217 | if (!strcmp(arg, "kgdbts_break_test")) |
212 | addr = (unsigned long)kgdbts_break_test; | 218 | addr = (unsigned long)kgdbts_break_test; |
213 | else if (!strcmp(arg, "sys_open")) | 219 | else if (!strcmp(arg, "sys_open")) |
214 | addr = (unsigned long)sys_open; | 220 | addr = (unsigned long)do_sys_open; |
215 | else if (!strcmp(arg, "do_fork")) | 221 | else if (!strcmp(arg, "do_fork")) |
216 | addr = (unsigned long)do_fork; | 222 | addr = (unsigned long)do_fork; |
217 | else if (!strcmp(arg, "hw_break_val")) | 223 | else if (!strcmp(arg, "hw_break_val")) |
@@ -283,6 +289,16 @@ static void hw_break_val_write(void) | |||
283 | hw_break_val++; | 289 | hw_break_val++; |
284 | } | 290 | } |
285 | 291 | ||
292 | static int get_thread_id_continue(char *put_str, char *arg) | ||
293 | { | ||
294 | char *ptr = &put_str[11]; | ||
295 | |||
296 | if (put_str[1] != 'T' || put_str[2] != '0') | ||
297 | return 1; | ||
298 | kgdb_hex2long(&ptr, &cont_thread_id); | ||
299 | return 0; | ||
300 | } | ||
301 | |||
286 | static int check_and_rewind_pc(char *put_str, char *arg) | 302 | static int check_and_rewind_pc(char *put_str, char *arg) |
287 | { | 303 | { |
288 | unsigned long addr = lookup_addr(arg); | 304 | unsigned long addr = lookup_addr(arg); |
@@ -299,13 +315,21 @@ static int check_and_rewind_pc(char *put_str, char *arg) | |||
299 | if (addr + BREAK_INSTR_SIZE == ip) | 315 | if (addr + BREAK_INSTR_SIZE == ip) |
300 | offset = -BREAK_INSTR_SIZE; | 316 | offset = -BREAK_INSTR_SIZE; |
301 | #endif | 317 | #endif |
302 | if (strcmp(arg, "silent") && ip + offset != addr) { | 318 | |
319 | if (arch_needs_sstep_emulation && sstep_addr && | ||
320 | ip + offset == sstep_addr && | ||
321 | ((!strcmp(arg, "sys_open") || !strcmp(arg, "do_fork")))) { | ||
322 | /* This is special case for emulated single step */ | ||
323 | v2printk("Emul: rewind hit single step bp\n"); | ||
324 | restart_from_top_after_write = 1; | ||
325 | } else if (strcmp(arg, "silent") && ip + offset != addr) { | ||
303 | eprintk("kgdbts: BP mismatch %lx expected %lx\n", | 326 | eprintk("kgdbts: BP mismatch %lx expected %lx\n", |
304 | ip + offset, addr); | 327 | ip + offset, addr); |
305 | return 1; | 328 | return 1; |
306 | } | 329 | } |
307 | /* Readjust the instruction pointer if needed */ | 330 | /* Readjust the instruction pointer if needed */ |
308 | ip += offset; | 331 | ip += offset; |
332 | cont_addr = ip; | ||
309 | #ifdef GDB_ADJUSTS_BREAK_OFFSET | 333 | #ifdef GDB_ADJUSTS_BREAK_OFFSET |
310 | instruction_pointer_set(&kgdbts_regs, ip); | 334 | instruction_pointer_set(&kgdbts_regs, ip); |
311 | #endif | 335 | #endif |
@@ -315,6 +339,8 @@ static int check_and_rewind_pc(char *put_str, char *arg) | |||
315 | static int check_single_step(char *put_str, char *arg) | 339 | static int check_single_step(char *put_str, char *arg) |
316 | { | 340 | { |
317 | unsigned long addr = lookup_addr(arg); | 341 | unsigned long addr = lookup_addr(arg); |
342 | static int matched_id; | ||
343 | |||
318 | /* | 344 | /* |
319 | * From an arch indepent point of view the instruction pointer | 345 | * From an arch indepent point of view the instruction pointer |
320 | * should be on a different instruction | 346 | * should be on a different instruction |
@@ -324,6 +350,29 @@ static int check_single_step(char *put_str, char *arg) | |||
324 | gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs); | 350 | gdb_regs_to_pt_regs(kgdbts_gdb_regs, &kgdbts_regs); |
325 | v2printk("Singlestep stopped at IP: %lx\n", | 351 | v2printk("Singlestep stopped at IP: %lx\n", |
326 | instruction_pointer(&kgdbts_regs)); | 352 | instruction_pointer(&kgdbts_regs)); |
353 | |||
354 | if (sstep_thread_id != cont_thread_id) { | ||
355 | /* | ||
356 | * Ensure we stopped in the same thread id as before, else the | ||
357 | * debugger should continue until the original thread that was | ||
358 | * single stepped is scheduled again, emulating gdb's behavior. | ||
359 | */ | ||
360 | v2printk("ThrID does not match: %lx\n", cont_thread_id); | ||
361 | if (arch_needs_sstep_emulation) { | ||
362 | if (matched_id && | ||
363 | instruction_pointer(&kgdbts_regs) != addr) | ||
364 | goto continue_test; | ||
365 | matched_id++; | ||
366 | ts.idx -= 2; | ||
367 | sstep_state = 0; | ||
368 | return 0; | ||
369 | } | ||
370 | cont_instead_of_sstep = 1; | ||
371 | ts.idx -= 4; | ||
372 | return 0; | ||
373 | } | ||
374 | continue_test: | ||
375 | matched_id = 0; | ||
327 | if (instruction_pointer(&kgdbts_regs) == addr) { | 376 | if (instruction_pointer(&kgdbts_regs) == addr) { |
328 | eprintk("kgdbts: SingleStep failed at %lx\n", | 377 | eprintk("kgdbts: SingleStep failed at %lx\n", |
329 | instruction_pointer(&kgdbts_regs)); | 378 | instruction_pointer(&kgdbts_regs)); |
@@ -365,10 +414,40 @@ static int got_break(char *put_str, char *arg) | |||
365 | return 1; | 414 | return 1; |
366 | } | 415 | } |
367 | 416 | ||
417 | static void get_cont_catch(char *arg) | ||
418 | { | ||
419 | /* Always send detach because the test is completed at this point */ | ||
420 | fill_get_buf("D"); | ||
421 | } | ||
422 | |||
423 | static int put_cont_catch(char *put_str, char *arg) | ||
424 | { | ||
425 | /* This is at the end of the test and we catch any and all input */ | ||
426 | v2printk("kgdbts: cleanup task: %lx\n", sstep_thread_id); | ||
427 | ts.idx--; | ||
428 | return 0; | ||
429 | } | ||
430 | |||
431 | static int emul_reset(char *put_str, char *arg) | ||
432 | { | ||
433 | if (strncmp(put_str, "$OK", 3)) | ||
434 | return 1; | ||
435 | if (restart_from_top_after_write) { | ||
436 | restart_from_top_after_write = 0; | ||
437 | ts.idx = -1; | ||
438 | } | ||
439 | return 0; | ||
440 | } | ||
441 | |||
368 | static void emul_sstep_get(char *arg) | 442 | static void emul_sstep_get(char *arg) |
369 | { | 443 | { |
370 | if (!arch_needs_sstep_emulation) { | 444 | if (!arch_needs_sstep_emulation) { |
371 | fill_get_buf(arg); | 445 | if (cont_instead_of_sstep) { |
446 | cont_instead_of_sstep = 0; | ||
447 | fill_get_buf("c"); | ||
448 | } else { | ||
449 | fill_get_buf(arg); | ||
450 | } | ||
372 | return; | 451 | return; |
373 | } | 452 | } |
374 | switch (sstep_state) { | 453 | switch (sstep_state) { |
@@ -398,9 +477,11 @@ static void emul_sstep_get(char *arg) | |||
398 | static int emul_sstep_put(char *put_str, char *arg) | 477 | static int emul_sstep_put(char *put_str, char *arg) |
399 | { | 478 | { |
400 | if (!arch_needs_sstep_emulation) { | 479 | if (!arch_needs_sstep_emulation) { |
401 | if (!strncmp(put_str+1, arg, 2)) | 480 | char *ptr = &put_str[11]; |
402 | return 0; | 481 | if (put_str[1] != 'T' || put_str[2] != '0') |
403 | return 1; | 482 | return 1; |
483 | kgdb_hex2long(&ptr, &sstep_thread_id); | ||
484 | return 0; | ||
404 | } | 485 | } |
405 | switch (sstep_state) { | 486 | switch (sstep_state) { |
406 | case 1: | 487 | case 1: |
@@ -411,8 +492,7 @@ static int emul_sstep_put(char *put_str, char *arg) | |||
411 | v2printk("Stopped at IP: %lx\n", | 492 | v2printk("Stopped at IP: %lx\n", |
412 | instruction_pointer(&kgdbts_regs)); | 493 | instruction_pointer(&kgdbts_regs)); |
413 | /* Want to stop at IP + break instruction size by default */ | 494 | /* Want to stop at IP + break instruction size by default */ |
414 | sstep_addr = instruction_pointer(&kgdbts_regs) + | 495 | sstep_addr = cont_addr + BREAK_INSTR_SIZE; |
415 | BREAK_INSTR_SIZE; | ||
416 | break; | 496 | break; |
417 | case 2: | 497 | case 2: |
418 | if (strncmp(put_str, "$OK", 3)) { | 498 | if (strncmp(put_str, "$OK", 3)) { |
@@ -424,6 +504,9 @@ static int emul_sstep_put(char *put_str, char *arg) | |||
424 | if (strncmp(put_str, "$T0", 3)) { | 504 | if (strncmp(put_str, "$T0", 3)) { |
425 | eprintk("kgdbts: failed continue sstep\n"); | 505 | eprintk("kgdbts: failed continue sstep\n"); |
426 | return 1; | 506 | return 1; |
507 | } else { | ||
508 | char *ptr = &put_str[11]; | ||
509 | kgdb_hex2long(&ptr, &sstep_thread_id); | ||
427 | } | 510 | } |
428 | break; | 511 | break; |
429 | case 4: | 512 | case 4: |
@@ -502,10 +585,10 @@ static struct test_struct bad_read_test[] = { | |||
502 | static struct test_struct singlestep_break_test[] = { | 585 | static struct test_struct singlestep_break_test[] = { |
503 | { "?", "S0*" }, /* Clear break points */ | 586 | { "?", "S0*" }, /* Clear break points */ |
504 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ | 587 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ |
505 | { "c", "T0*", }, /* Continue */ | 588 | { "c", "T0*", NULL, get_thread_id_continue }, /* Continue */ |
589 | { "kgdbts_break_test", "OK", sw_rem_break }, /*remove breakpoint */ | ||
506 | { "g", "kgdbts_break_test", NULL, check_and_rewind_pc }, | 590 | { "g", "kgdbts_break_test", NULL, check_and_rewind_pc }, |
507 | { "write", "OK", write_regs }, /* Write registers */ | 591 | { "write", "OK", write_regs }, /* Write registers */ |
508 | { "kgdbts_break_test", "OK", sw_rem_break }, /*remove breakpoint */ | ||
509 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 592 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
510 | { "g", "kgdbts_break_test", NULL, check_single_step }, | 593 | { "g", "kgdbts_break_test", NULL, check_single_step }, |
511 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ | 594 | { "kgdbts_break_test", "OK", sw_break, }, /* set sw breakpoint */ |
@@ -523,16 +606,16 @@ static struct test_struct singlestep_break_test[] = { | |||
523 | static struct test_struct do_fork_test[] = { | 606 | static struct test_struct do_fork_test[] = { |
524 | { "?", "S0*" }, /* Clear break points */ | 607 | { "?", "S0*" }, /* Clear break points */ |
525 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ | 608 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ |
526 | { "c", "T0*", }, /* Continue */ | 609 | { "c", "T0*", NULL, get_thread_id_continue }, /* Continue */ |
527 | { "g", "do_fork", NULL, check_and_rewind_pc }, /* check location */ | ||
528 | { "write", "OK", write_regs }, /* Write registers */ | ||
529 | { "do_fork", "OK", sw_rem_break }, /*remove breakpoint */ | 610 | { "do_fork", "OK", sw_rem_break }, /*remove breakpoint */ |
611 | { "g", "do_fork", NULL, check_and_rewind_pc }, /* check location */ | ||
612 | { "write", "OK", write_regs, emul_reset }, /* Write registers */ | ||
530 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 613 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
531 | { "g", "do_fork", NULL, check_single_step }, | 614 | { "g", "do_fork", NULL, check_single_step }, |
532 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ | 615 | { "do_fork", "OK", sw_break, }, /* set sw breakpoint */ |
533 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ | 616 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ |
534 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ | 617 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ |
535 | { "", "" }, | 618 | { "", "", get_cont_catch, put_cont_catch }, |
536 | }; | 619 | }; |
537 | 620 | ||
538 | /* Test for hitting a breakpoint at sys_open for what ever the number | 621 | /* Test for hitting a breakpoint at sys_open for what ever the number |
@@ -541,16 +624,16 @@ static struct test_struct do_fork_test[] = { | |||
541 | static struct test_struct sys_open_test[] = { | 624 | static struct test_struct sys_open_test[] = { |
542 | { "?", "S0*" }, /* Clear break points */ | 625 | { "?", "S0*" }, /* Clear break points */ |
543 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ | 626 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ |
544 | { "c", "T0*", }, /* Continue */ | 627 | { "c", "T0*", NULL, get_thread_id_continue }, /* Continue */ |
545 | { "g", "sys_open", NULL, check_and_rewind_pc }, /* check location */ | ||
546 | { "write", "OK", write_regs }, /* Write registers */ | ||
547 | { "sys_open", "OK", sw_rem_break }, /*remove breakpoint */ | 628 | { "sys_open", "OK", sw_rem_break }, /*remove breakpoint */ |
629 | { "g", "sys_open", NULL, check_and_rewind_pc }, /* check location */ | ||
630 | { "write", "OK", write_regs, emul_reset }, /* Write registers */ | ||
548 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ | 631 | { "s", "T0*", emul_sstep_get, emul_sstep_put }, /* Single step */ |
549 | { "g", "sys_open", NULL, check_single_step }, | 632 | { "g", "sys_open", NULL, check_single_step }, |
550 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ | 633 | { "sys_open", "OK", sw_break, }, /* set sw breakpoint */ |
551 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ | 634 | { "7", "T0*", skip_back_repeat_test }, /* Loop based on repeat_test */ |
552 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ | 635 | { "D", "OK", NULL, final_ack_set }, /* detach and unregister I/O */ |
553 | { "", "" }, | 636 | { "", "", get_cont_catch, put_cont_catch }, |
554 | }; | 637 | }; |
555 | 638 | ||
556 | /* | 639 | /* |
@@ -693,8 +776,8 @@ static int run_simple_test(int is_get_char, int chr) | |||
693 | /* This callback is a put char which is when kgdb sends data to | 776 | /* This callback is a put char which is when kgdb sends data to |
694 | * this I/O module. | 777 | * this I/O module. |
695 | */ | 778 | */ |
696 | if (ts.tst[ts.idx].get[0] == '\0' && | 779 | if (ts.tst[ts.idx].get[0] == '\0' && ts.tst[ts.idx].put[0] == '\0' && |
697 | ts.tst[ts.idx].put[0] == '\0') { | 780 | !ts.tst[ts.idx].get_handler) { |
698 | eprintk("kgdbts: ERROR: beyond end of test on" | 781 | eprintk("kgdbts: ERROR: beyond end of test on" |
699 | " '%s' line %i\n", ts.name, ts.idx); | 782 | " '%s' line %i\n", ts.name, ts.idx); |
700 | return 0; | 783 | return 0; |
@@ -907,6 +990,17 @@ static void kgdbts_run_tests(void) | |||
907 | if (ptr) | 990 | if (ptr) |
908 | sstep_test = simple_strtol(ptr+1, NULL, 10); | 991 | sstep_test = simple_strtol(ptr+1, NULL, 10); |
909 | 992 | ||
993 | /* All HW break point tests */ | ||
994 | if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) { | ||
995 | hwbreaks_ok = 1; | ||
996 | v1printk("kgdbts:RUN hw breakpoint test\n"); | ||
997 | run_breakpoint_test(1); | ||
998 | v1printk("kgdbts:RUN hw write breakpoint test\n"); | ||
999 | run_hw_break_test(1); | ||
1000 | v1printk("kgdbts:RUN access write breakpoint test\n"); | ||
1001 | run_hw_break_test(0); | ||
1002 | } | ||
1003 | |||
910 | /* required internal KGDB tests */ | 1004 | /* required internal KGDB tests */ |
911 | v1printk("kgdbts:RUN plant and detach test\n"); | 1005 | v1printk("kgdbts:RUN plant and detach test\n"); |
912 | run_plant_and_detach_test(0); | 1006 | run_plant_and_detach_test(0); |
@@ -924,35 +1018,11 @@ static void kgdbts_run_tests(void) | |||
924 | 1018 | ||
925 | /* ===Optional tests=== */ | 1019 | /* ===Optional tests=== */ |
926 | 1020 | ||
927 | /* All HW break point tests */ | ||
928 | if (arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT) { | ||
929 | hwbreaks_ok = 1; | ||
930 | v1printk("kgdbts:RUN hw breakpoint test\n"); | ||
931 | run_breakpoint_test(1); | ||
932 | v1printk("kgdbts:RUN hw write breakpoint test\n"); | ||
933 | run_hw_break_test(1); | ||
934 | v1printk("kgdbts:RUN access write breakpoint test\n"); | ||
935 | run_hw_break_test(0); | ||
936 | } | ||
937 | |||
938 | if (nmi_sleep) { | 1021 | if (nmi_sleep) { |
939 | v1printk("kgdbts:RUN NMI sleep %i seconds test\n", nmi_sleep); | 1022 | v1printk("kgdbts:RUN NMI sleep %i seconds test\n", nmi_sleep); |
940 | run_nmi_sleep_test(nmi_sleep); | 1023 | run_nmi_sleep_test(nmi_sleep); |
941 | } | 1024 | } |
942 | 1025 | ||
943 | #ifdef CONFIG_DEBUG_RODATA | ||
944 | /* Until there is an api to write to read-only text segments, use | ||
945 | * HW breakpoints for the remainder of any tests, else print a | ||
946 | * failure message if hw breakpoints do not work. | ||
947 | */ | ||
948 | if (!(arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT && hwbreaks_ok)) { | ||
949 | eprintk("kgdbts: HW breakpoints do not work," | ||
950 | "skipping remaining tests\n"); | ||
951 | return; | ||
952 | } | ||
953 | force_hwbrks = 1; | ||
954 | #endif /* CONFIG_DEBUG_RODATA */ | ||
955 | |||
956 | /* If the do_fork test is run it will be the last test that is | 1026 | /* If the do_fork test is run it will be the last test that is |
957 | * executed because a kernel thread will be spawned at the very | 1027 | * executed because a kernel thread will be spawned at the very |
958 | * end to unregister the debug hooks. | 1028 | * end to unregister the debug hooks. |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index eed213a5c8cb..dabec556ebb8 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -873,7 +873,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | |||
873 | { | 873 | { |
874 | struct mmc_blk_data *md = mq->data; | 874 | struct mmc_blk_data *md = mq->data; |
875 | struct mmc_card *card = md->queue.card; | 875 | struct mmc_card *card = md->queue.card; |
876 | unsigned int from, nr, arg; | 876 | unsigned int from, nr, arg, trim_arg, erase_arg; |
877 | int err = 0, type = MMC_BLK_SECDISCARD; | 877 | int err = 0, type = MMC_BLK_SECDISCARD; |
878 | 878 | ||
879 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { | 879 | if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) { |
@@ -881,20 +881,26 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, | |||
881 | goto out; | 881 | goto out; |
882 | } | 882 | } |
883 | 883 | ||
884 | from = blk_rq_pos(req); | ||
885 | nr = blk_rq_sectors(req); | ||
886 | |||
884 | /* The sanitize operation is supported at v4.5 only */ | 887 | /* The sanitize operation is supported at v4.5 only */ |
885 | if (mmc_can_sanitize(card)) { | 888 | if (mmc_can_sanitize(card)) { |
886 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 889 | erase_arg = MMC_ERASE_ARG; |
887 | EXT_CSD_SANITIZE_START, 1, 0); | 890 | trim_arg = MMC_TRIM_ARG; |
888 | goto out; | 891 | } else { |
892 | erase_arg = MMC_SECURE_ERASE_ARG; | ||
893 | trim_arg = MMC_SECURE_TRIM1_ARG; | ||
889 | } | 894 | } |
890 | 895 | ||
891 | from = blk_rq_pos(req); | 896 | if (mmc_erase_group_aligned(card, from, nr)) |
892 | nr = blk_rq_sectors(req); | 897 | arg = erase_arg; |
893 | 898 | else if (mmc_can_trim(card)) | |
894 | if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) | 899 | arg = trim_arg; |
895 | arg = MMC_SECURE_TRIM1_ARG; | 900 | else { |
896 | else | 901 | err = -EINVAL; |
897 | arg = MMC_SECURE_ERASE_ARG; | 902 | goto out; |
903 | } | ||
898 | retry: | 904 | retry: |
899 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | 905 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { |
900 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 906 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
@@ -904,25 +910,41 @@ retry: | |||
904 | INAND_CMD38_ARG_SECERASE, | 910 | INAND_CMD38_ARG_SECERASE, |
905 | 0); | 911 | 0); |
906 | if (err) | 912 | if (err) |
907 | goto out; | 913 | goto out_retry; |
908 | } | 914 | } |
915 | |||
909 | err = mmc_erase(card, from, nr, arg); | 916 | err = mmc_erase(card, from, nr, arg); |
910 | if (!err && arg == MMC_SECURE_TRIM1_ARG) { | 917 | if (err == -EIO) |
918 | goto out_retry; | ||
919 | if (err) | ||
920 | goto out; | ||
921 | |||
922 | if (arg == MMC_SECURE_TRIM1_ARG) { | ||
911 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { | 923 | if (card->quirks & MMC_QUIRK_INAND_CMD38) { |
912 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 924 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
913 | INAND_CMD38_ARG_EXT_CSD, | 925 | INAND_CMD38_ARG_EXT_CSD, |
914 | INAND_CMD38_ARG_SECTRIM2, | 926 | INAND_CMD38_ARG_SECTRIM2, |
915 | 0); | 927 | 0); |
916 | if (err) | 928 | if (err) |
917 | goto out; | 929 | goto out_retry; |
918 | } | 930 | } |
931 | |||
919 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); | 932 | err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG); |
933 | if (err == -EIO) | ||
934 | goto out_retry; | ||
935 | if (err) | ||
936 | goto out; | ||
920 | } | 937 | } |
921 | out: | 938 | |
922 | if (err == -EIO && !mmc_blk_reset(md, card->host, type)) | 939 | if (mmc_can_sanitize(card)) |
940 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | ||
941 | EXT_CSD_SANITIZE_START, 1, 0); | ||
942 | out_retry: | ||
943 | if (err && !mmc_blk_reset(md, card->host, type)) | ||
923 | goto retry; | 944 | goto retry; |
924 | if (!err) | 945 | if (!err) |
925 | mmc_blk_reset_success(md, type); | 946 | mmc_blk_reset_success(md, type); |
947 | out: | ||
926 | spin_lock_irq(&md->lock); | 948 | spin_lock_irq(&md->lock); |
927 | __blk_end_request(req, err, blk_rq_bytes(req)); | 949 | __blk_end_request(req, err, blk_rq_bytes(req)); |
928 | spin_unlock_irq(&md->lock); | 950 | spin_unlock_irq(&md->lock); |
@@ -1623,24 +1645,6 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md) | |||
1623 | return ret; | 1645 | return ret; |
1624 | } | 1646 | } |
1625 | 1647 | ||
1626 | static int | ||
1627 | mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card) | ||
1628 | { | ||
1629 | int err; | ||
1630 | |||
1631 | mmc_claim_host(card->host); | ||
1632 | err = mmc_set_blocklen(card, 512); | ||
1633 | mmc_release_host(card->host); | ||
1634 | |||
1635 | if (err) { | ||
1636 | pr_err("%s: unable to set block size to 512: %d\n", | ||
1637 | md->disk->disk_name, err); | ||
1638 | return -EINVAL; | ||
1639 | } | ||
1640 | |||
1641 | return 0; | ||
1642 | } | ||
1643 | |||
1644 | static void mmc_blk_remove_req(struct mmc_blk_data *md) | 1648 | static void mmc_blk_remove_req(struct mmc_blk_data *md) |
1645 | { | 1649 | { |
1646 | struct mmc_card *card; | 1650 | struct mmc_card *card; |
@@ -1768,7 +1772,6 @@ static const struct mmc_fixup blk_fixups[] = | |||
1768 | static int mmc_blk_probe(struct mmc_card *card) | 1772 | static int mmc_blk_probe(struct mmc_card *card) |
1769 | { | 1773 | { |
1770 | struct mmc_blk_data *md, *part_md; | 1774 | struct mmc_blk_data *md, *part_md; |
1771 | int err; | ||
1772 | char cap_str[10]; | 1775 | char cap_str[10]; |
1773 | 1776 | ||
1774 | /* | 1777 | /* |
@@ -1781,10 +1784,6 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
1781 | if (IS_ERR(md)) | 1784 | if (IS_ERR(md)) |
1782 | return PTR_ERR(md); | 1785 | return PTR_ERR(md); |
1783 | 1786 | ||
1784 | err = mmc_blk_set_blksize(md, card); | ||
1785 | if (err) | ||
1786 | goto out; | ||
1787 | |||
1788 | string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2, | 1787 | string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2, |
1789 | cap_str, sizeof(cap_str)); | 1788 | cap_str, sizeof(cap_str)); |
1790 | pr_info("%s: %s %s %s %s\n", | 1789 | pr_info("%s: %s %s %s %s\n", |
@@ -1809,7 +1808,7 @@ static int mmc_blk_probe(struct mmc_card *card) | |||
1809 | out: | 1808 | out: |
1810 | mmc_blk_remove_parts(card, md); | 1809 | mmc_blk_remove_parts(card, md); |
1811 | mmc_blk_remove_req(md); | 1810 | mmc_blk_remove_req(md); |
1812 | return err; | 1811 | return 0; |
1813 | } | 1812 | } |
1814 | 1813 | ||
1815 | static void mmc_blk_remove(struct mmc_card *card) | 1814 | static void mmc_blk_remove(struct mmc_card *card) |
@@ -1825,7 +1824,7 @@ static void mmc_blk_remove(struct mmc_card *card) | |||
1825 | } | 1824 | } |
1826 | 1825 | ||
1827 | #ifdef CONFIG_PM | 1826 | #ifdef CONFIG_PM |
1828 | static int mmc_blk_suspend(struct mmc_card *card, pm_message_t state) | 1827 | static int mmc_blk_suspend(struct mmc_card *card) |
1829 | { | 1828 | { |
1830 | struct mmc_blk_data *part_md; | 1829 | struct mmc_blk_data *part_md; |
1831 | struct mmc_blk_data *md = mmc_get_drvdata(card); | 1830 | struct mmc_blk_data *md = mmc_get_drvdata(card); |
@@ -1845,8 +1844,6 @@ static int mmc_blk_resume(struct mmc_card *card) | |||
1845 | struct mmc_blk_data *md = mmc_get_drvdata(card); | 1844 | struct mmc_blk_data *md = mmc_get_drvdata(card); |
1846 | 1845 | ||
1847 | if (md) { | 1846 | if (md) { |
1848 | mmc_blk_set_blksize(md, card); | ||
1849 | |||
1850 | /* | 1847 | /* |
1851 | * Resume involves the card going into idle state, | 1848 | * Resume involves the card going into idle state, |
1852 | * so current partition is always the main one. | 1849 | * so current partition is always the main one. |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 2517547b4366..996f8e36e23d 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -139,7 +139,7 @@ static void mmc_queue_setup_discard(struct request_queue *q, | |||
139 | 139 | ||
140 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); | 140 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q); |
141 | q->limits.max_discard_sectors = max_discard; | 141 | q->limits.max_discard_sectors = max_discard; |
142 | if (card->erased_byte == 0) | 142 | if (card->erased_byte == 0 && !mmc_can_discard(card)) |
143 | q->limits.discard_zeroes_data = 1; | 143 | q->limits.discard_zeroes_data = 1; |
144 | q->limits.discard_granularity = card->pref_erase << 9; | 144 | q->limits.discard_granularity = card->pref_erase << 9; |
145 | /* granularity must not be greater than max. discard */ | 145 | /* granularity must not be greater than max. discard */ |
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 5d011a39dfff..c60cee92a2b2 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -122,14 +122,14 @@ static int mmc_bus_remove(struct device *dev) | |||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | static int mmc_bus_suspend(struct device *dev, pm_message_t state) | 125 | static int mmc_bus_suspend(struct device *dev) |
126 | { | 126 | { |
127 | struct mmc_driver *drv = to_mmc_driver(dev->driver); | 127 | struct mmc_driver *drv = to_mmc_driver(dev->driver); |
128 | struct mmc_card *card = mmc_dev_to_card(dev); | 128 | struct mmc_card *card = mmc_dev_to_card(dev); |
129 | int ret = 0; | 129 | int ret = 0; |
130 | 130 | ||
131 | if (dev->driver && drv->suspend) | 131 | if (dev->driver && drv->suspend) |
132 | ret = drv->suspend(card, state); | 132 | ret = drv->suspend(card); |
133 | return ret; | 133 | return ret; |
134 | } | 134 | } |
135 | 135 | ||
@@ -165,20 +165,14 @@ static int mmc_runtime_idle(struct device *dev) | |||
165 | return pm_runtime_suspend(dev); | 165 | return pm_runtime_suspend(dev); |
166 | } | 166 | } |
167 | 167 | ||
168 | #endif /* !CONFIG_PM_RUNTIME */ | ||
169 | |||
168 | static const struct dev_pm_ops mmc_bus_pm_ops = { | 170 | static const struct dev_pm_ops mmc_bus_pm_ops = { |
169 | .runtime_suspend = mmc_runtime_suspend, | 171 | SET_RUNTIME_PM_OPS(mmc_runtime_suspend, mmc_runtime_resume, |
170 | .runtime_resume = mmc_runtime_resume, | 172 | mmc_runtime_idle) |
171 | .runtime_idle = mmc_runtime_idle, | 173 | SET_SYSTEM_SLEEP_PM_OPS(mmc_bus_suspend, mmc_bus_resume) |
172 | }; | 174 | }; |
173 | 175 | ||
174 | #define MMC_PM_OPS_PTR (&mmc_bus_pm_ops) | ||
175 | |||
176 | #else /* !CONFIG_PM_RUNTIME */ | ||
177 | |||
178 | #define MMC_PM_OPS_PTR NULL | ||
179 | |||
180 | #endif /* !CONFIG_PM_RUNTIME */ | ||
181 | |||
182 | static struct bus_type mmc_bus_type = { | 176 | static struct bus_type mmc_bus_type = { |
183 | .name = "mmc", | 177 | .name = "mmc", |
184 | .dev_attrs = mmc_dev_attrs, | 178 | .dev_attrs = mmc_dev_attrs, |
@@ -186,9 +180,7 @@ static struct bus_type mmc_bus_type = { | |||
186 | .uevent = mmc_bus_uevent, | 180 | .uevent = mmc_bus_uevent, |
187 | .probe = mmc_bus_probe, | 181 | .probe = mmc_bus_probe, |
188 | .remove = mmc_bus_remove, | 182 | .remove = mmc_bus_remove, |
189 | .suspend = mmc_bus_suspend, | 183 | .pm = &mmc_bus_pm_ops, |
190 | .resume = mmc_bus_resume, | ||
191 | .pm = MMC_PM_OPS_PTR, | ||
192 | }; | 184 | }; |
193 | 185 | ||
194 | int mmc_register_bus(void) | 186 | int mmc_register_bus(void) |
@@ -267,6 +259,15 @@ int mmc_add_card(struct mmc_card *card) | |||
267 | { | 259 | { |
268 | int ret; | 260 | int ret; |
269 | const char *type; | 261 | const char *type; |
262 | const char *uhs_bus_speed_mode = ""; | ||
263 | static const char *const uhs_speeds[] = { | ||
264 | [UHS_SDR12_BUS_SPEED] = "SDR12 ", | ||
265 | [UHS_SDR25_BUS_SPEED] = "SDR25 ", | ||
266 | [UHS_SDR50_BUS_SPEED] = "SDR50 ", | ||
267 | [UHS_SDR104_BUS_SPEED] = "SDR104 ", | ||
268 | [UHS_DDR50_BUS_SPEED] = "DDR50 ", | ||
269 | }; | ||
270 | |||
270 | 271 | ||
271 | dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca); | 272 | dev_set_name(&card->dev, "%s:%04x", mmc_hostname(card->host), card->rca); |
272 | 273 | ||
@@ -296,6 +297,10 @@ int mmc_add_card(struct mmc_card *card) | |||
296 | break; | 297 | break; |
297 | } | 298 | } |
298 | 299 | ||
300 | if (mmc_sd_card_uhs(card) && | ||
301 | (card->sd_bus_speed < ARRAY_SIZE(uhs_speeds))) | ||
302 | uhs_bus_speed_mode = uhs_speeds[card->sd_bus_speed]; | ||
303 | |||
299 | if (mmc_host_is_spi(card->host)) { | 304 | if (mmc_host_is_spi(card->host)) { |
300 | pr_info("%s: new %s%s%s card on SPI\n", | 305 | pr_info("%s: new %s%s%s card on SPI\n", |
301 | mmc_hostname(card->host), | 306 | mmc_hostname(card->host), |
@@ -303,13 +308,13 @@ int mmc_add_card(struct mmc_card *card) | |||
303 | mmc_card_ddr_mode(card) ? "DDR " : "", | 308 | mmc_card_ddr_mode(card) ? "DDR " : "", |
304 | type); | 309 | type); |
305 | } else { | 310 | } else { |
306 | pr_info("%s: new %s%s%s%s card at address %04x\n", | 311 | pr_info("%s: new %s%s%s%s%s card at address %04x\n", |
307 | mmc_hostname(card->host), | 312 | mmc_hostname(card->host), |
308 | mmc_card_uhs(card) ? "ultra high speed " : | 313 | mmc_card_uhs(card) ? "ultra high speed " : |
309 | (mmc_card_highspeed(card) ? "high speed " : ""), | 314 | (mmc_card_highspeed(card) ? "high speed " : ""), |
310 | (mmc_card_hs200(card) ? "HS200 " : ""), | 315 | (mmc_card_hs200(card) ? "HS200 " : ""), |
311 | mmc_card_ddr_mode(card) ? "DDR " : "", | 316 | mmc_card_ddr_mode(card) ? "DDR " : "", |
312 | type, card->rca); | 317 | uhs_bus_speed_mode, type, card->rca); |
313 | } | 318 | } |
314 | 319 | ||
315 | #ifdef CONFIG_DEBUG_FS | 320 | #ifdef CONFIG_DEBUG_FS |
diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c index 29de31e260dd..2c14be73254c 100644 --- a/drivers/mmc/core/cd-gpio.c +++ b/drivers/mmc/core/cd-gpio.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/gpio.h> | 12 | #include <linux/gpio.h> |
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/jiffies.h> | 14 | #include <linux/jiffies.h> |
15 | #include <linux/mmc/cd-gpio.h> | ||
15 | #include <linux/mmc/host.h> | 16 | #include <linux/mmc/host.h> |
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 14f262e9246d..ba821fe70bca 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -527,10 +527,14 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) | |||
527 | 527 | ||
528 | if (data->flags & MMC_DATA_WRITE) | 528 | if (data->flags & MMC_DATA_WRITE) |
529 | /* | 529 | /* |
530 | * The limit is really 250 ms, but that is | 530 | * The MMC spec "It is strongly recommended |
531 | * insufficient for some crappy cards. | 531 | * for hosts to implement more than 500ms |
532 | * timeout value even if the card indicates | ||
533 | * the 250ms maximum busy length." Even the | ||
534 | * previous value of 300ms is known to be | ||
535 | * insufficient for some cards. | ||
532 | */ | 536 | */ |
533 | limit_us = 300000; | 537 | limit_us = 3000000; |
534 | else | 538 | else |
535 | limit_us = 100000; | 539 | limit_us = 100000; |
536 | 540 | ||
@@ -1405,7 +1409,10 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card, | |||
1405 | { | 1409 | { |
1406 | unsigned int erase_timeout; | 1410 | unsigned int erase_timeout; |
1407 | 1411 | ||
1408 | if (card->ext_csd.erase_group_def & 1) { | 1412 | if (arg == MMC_DISCARD_ARG || |
1413 | (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) { | ||
1414 | erase_timeout = card->ext_csd.trim_timeout; | ||
1415 | } else if (card->ext_csd.erase_group_def & 1) { | ||
1409 | /* High Capacity Erase Group Size uses HC timeouts */ | 1416 | /* High Capacity Erase Group Size uses HC timeouts */ |
1410 | if (arg == MMC_TRIM_ARG) | 1417 | if (arg == MMC_TRIM_ARG) |
1411 | erase_timeout = card->ext_csd.trim_timeout; | 1418 | erase_timeout = card->ext_csd.trim_timeout; |
@@ -1677,8 +1684,6 @@ int mmc_can_trim(struct mmc_card *card) | |||
1677 | { | 1684 | { |
1678 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) | 1685 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) |
1679 | return 1; | 1686 | return 1; |
1680 | if (mmc_can_discard(card)) | ||
1681 | return 1; | ||
1682 | return 0; | 1687 | return 0; |
1683 | } | 1688 | } |
1684 | EXPORT_SYMBOL(mmc_can_trim); | 1689 | EXPORT_SYMBOL(mmc_can_trim); |
@@ -1697,6 +1702,8 @@ EXPORT_SYMBOL(mmc_can_discard); | |||
1697 | 1702 | ||
1698 | int mmc_can_sanitize(struct mmc_card *card) | 1703 | int mmc_can_sanitize(struct mmc_card *card) |
1699 | { | 1704 | { |
1705 | if (!mmc_can_trim(card) && !mmc_can_erase(card)) | ||
1706 | return 0; | ||
1700 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) | 1707 | if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) |
1701 | return 1; | 1708 | return 1; |
1702 | return 0; | 1709 | return 0; |
@@ -2231,6 +2238,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | |||
2231 | mmc_card_is_removable(host)) | 2238 | mmc_card_is_removable(host)) |
2232 | return err; | 2239 | return err; |
2233 | 2240 | ||
2241 | mmc_claim_host(host); | ||
2234 | if (card && mmc_card_mmc(card) && | 2242 | if (card && mmc_card_mmc(card) && |
2235 | (card->ext_csd.cache_size > 0)) { | 2243 | (card->ext_csd.cache_size > 0)) { |
2236 | enable = !!enable; | 2244 | enable = !!enable; |
@@ -2248,6 +2256,7 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable) | |||
2248 | card->ext_csd.cache_ctrl = enable; | 2256 | card->ext_csd.cache_ctrl = enable; |
2249 | } | 2257 | } |
2250 | } | 2258 | } |
2259 | mmc_release_host(host); | ||
2251 | 2260 | ||
2252 | return err; | 2261 | return err; |
2253 | } | 2262 | } |
@@ -2265,49 +2274,32 @@ int mmc_suspend_host(struct mmc_host *host) | |||
2265 | 2274 | ||
2266 | cancel_delayed_work(&host->detect); | 2275 | cancel_delayed_work(&host->detect); |
2267 | mmc_flush_scheduled_work(); | 2276 | mmc_flush_scheduled_work(); |
2268 | if (mmc_try_claim_host(host)) { | ||
2269 | err = mmc_cache_ctrl(host, 0); | ||
2270 | mmc_release_host(host); | ||
2271 | } else { | ||
2272 | err = -EBUSY; | ||
2273 | } | ||
2274 | 2277 | ||
2278 | err = mmc_cache_ctrl(host, 0); | ||
2275 | if (err) | 2279 | if (err) |
2276 | goto out; | 2280 | goto out; |
2277 | 2281 | ||
2278 | mmc_bus_get(host); | 2282 | mmc_bus_get(host); |
2279 | if (host->bus_ops && !host->bus_dead) { | 2283 | if (host->bus_ops && !host->bus_dead) { |
2280 | 2284 | ||
2281 | /* | 2285 | if (host->bus_ops->suspend) |
2282 | * A long response time is not acceptable for device drivers | 2286 | err = host->bus_ops->suspend(host); |
2283 | * when doing suspend. Prevent mmc_claim_host in the suspend | ||
2284 | * sequence, to potentially wait "forever" by trying to | ||
2285 | * pre-claim the host. | ||
2286 | */ | ||
2287 | if (mmc_try_claim_host(host)) { | ||
2288 | if (host->bus_ops->suspend) { | ||
2289 | err = host->bus_ops->suspend(host); | ||
2290 | } | ||
2291 | mmc_release_host(host); | ||
2292 | 2287 | ||
2293 | if (err == -ENOSYS || !host->bus_ops->resume) { | 2288 | if (err == -ENOSYS || !host->bus_ops->resume) { |
2294 | /* | 2289 | /* |
2295 | * We simply "remove" the card in this case. | 2290 | * We simply "remove" the card in this case. |
2296 | * It will be redetected on resume. (Calling | 2291 | * It will be redetected on resume. (Calling |
2297 | * bus_ops->remove() with a claimed host can | 2292 | * bus_ops->remove() with a claimed host can |
2298 | * deadlock.) | 2293 | * deadlock.) |
2299 | */ | 2294 | */ |
2300 | if (host->bus_ops->remove) | 2295 | if (host->bus_ops->remove) |
2301 | host->bus_ops->remove(host); | 2296 | host->bus_ops->remove(host); |
2302 | mmc_claim_host(host); | 2297 | mmc_claim_host(host); |
2303 | mmc_detach_bus(host); | 2298 | mmc_detach_bus(host); |
2304 | mmc_power_off(host); | 2299 | mmc_power_off(host); |
2305 | mmc_release_host(host); | 2300 | mmc_release_host(host); |
2306 | host->pm_flags = 0; | 2301 | host->pm_flags = 0; |
2307 | err = 0; | 2302 | err = 0; |
2308 | } | ||
2309 | } else { | ||
2310 | err = -EBUSY; | ||
2311 | } | 2303 | } |
2312 | } | 2304 | } |
2313 | mmc_bus_put(host); | 2305 | mmc_bus_put(host); |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 02914d609a91..54df5adc0413 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -695,6 +695,11 @@ static int mmc_select_powerclass(struct mmc_card *card, | |||
695 | else if (host->ios.clock <= 200000000) | 695 | else if (host->ios.clock <= 200000000) |
696 | index = EXT_CSD_PWR_CL_200_195; | 696 | index = EXT_CSD_PWR_CL_200_195; |
697 | break; | 697 | break; |
698 | case MMC_VDD_27_28: | ||
699 | case MMC_VDD_28_29: | ||
700 | case MMC_VDD_29_30: | ||
701 | case MMC_VDD_30_31: | ||
702 | case MMC_VDD_31_32: | ||
698 | case MMC_VDD_32_33: | 703 | case MMC_VDD_32_33: |
699 | case MMC_VDD_33_34: | 704 | case MMC_VDD_33_34: |
700 | case MMC_VDD_34_35: | 705 | case MMC_VDD_34_35: |
@@ -1111,11 +1116,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1111 | ext_csd_bits = (bus_width == MMC_BUS_WIDTH_8) ? | 1116 | ext_csd_bits = (bus_width == MMC_BUS_WIDTH_8) ? |
1112 | EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; | 1117 | EXT_CSD_BUS_WIDTH_8 : EXT_CSD_BUS_WIDTH_4; |
1113 | err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); | 1118 | err = mmc_select_powerclass(card, ext_csd_bits, ext_csd); |
1114 | if (err) { | 1119 | if (err) |
1115 | pr_err("%s: power class selection to bus width %d failed\n", | 1120 | pr_warning("%s: power class selection to bus width %d" |
1116 | mmc_hostname(card->host), 1 << bus_width); | 1121 | " failed\n", mmc_hostname(card->host), |
1117 | goto err; | 1122 | 1 << bus_width); |
1118 | } | ||
1119 | } | 1123 | } |
1120 | 1124 | ||
1121 | /* | 1125 | /* |
@@ -1147,10 +1151,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1147 | err = mmc_select_powerclass(card, ext_csd_bits[idx][0], | 1151 | err = mmc_select_powerclass(card, ext_csd_bits[idx][0], |
1148 | ext_csd); | 1152 | ext_csd); |
1149 | if (err) | 1153 | if (err) |
1150 | pr_err("%s: power class selection to " | 1154 | pr_warning("%s: power class selection to " |
1151 | "bus width %d failed\n", | 1155 | "bus width %d failed\n", |
1152 | mmc_hostname(card->host), | 1156 | mmc_hostname(card->host), |
1153 | 1 << bus_width); | 1157 | 1 << bus_width); |
1154 | 1158 | ||
1155 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1159 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
1156 | EXT_CSD_BUS_WIDTH, | 1160 | EXT_CSD_BUS_WIDTH, |
@@ -1178,10 +1182,10 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
1178 | err = mmc_select_powerclass(card, ext_csd_bits[idx][1], | 1182 | err = mmc_select_powerclass(card, ext_csd_bits[idx][1], |
1179 | ext_csd); | 1183 | ext_csd); |
1180 | if (err) | 1184 | if (err) |
1181 | pr_err("%s: power class selection to " | 1185 | pr_warning("%s: power class selection to " |
1182 | "bus width %d ddr %d failed\n", | 1186 | "bus width %d ddr %d failed\n", |
1183 | mmc_hostname(card->host), | 1187 | mmc_hostname(card->host), |
1184 | 1 << bus_width, ddr); | 1188 | 1 << bus_width, ddr); |
1185 | 1189 | ||
1186 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 1190 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
1187 | EXT_CSD_BUS_WIDTH, | 1191 | EXT_CSD_BUS_WIDTH, |
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 40989e6bb53a..236842ec955a 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c | |||
@@ -192,9 +192,15 @@ static int sdio_bus_remove(struct device *dev) | |||
192 | return ret; | 192 | return ret; |
193 | } | 193 | } |
194 | 194 | ||
195 | #ifdef CONFIG_PM_RUNTIME | 195 | #ifdef CONFIG_PM |
196 | |||
197 | static int pm_no_operation(struct device *dev) | ||
198 | { | ||
199 | return 0; | ||
200 | } | ||
196 | 201 | ||
197 | static const struct dev_pm_ops sdio_bus_pm_ops = { | 202 | static const struct dev_pm_ops sdio_bus_pm_ops = { |
203 | SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) | ||
198 | SET_RUNTIME_PM_OPS( | 204 | SET_RUNTIME_PM_OPS( |
199 | pm_generic_runtime_suspend, | 205 | pm_generic_runtime_suspend, |
200 | pm_generic_runtime_resume, | 206 | pm_generic_runtime_resume, |
@@ -204,11 +210,11 @@ static const struct dev_pm_ops sdio_bus_pm_ops = { | |||
204 | 210 | ||
205 | #define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops) | 211 | #define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops) |
206 | 212 | ||
207 | #else /* !CONFIG_PM_RUNTIME */ | 213 | #else /* !CONFIG_PM */ |
208 | 214 | ||
209 | #define SDIO_PM_OPS_PTR NULL | 215 | #define SDIO_PM_OPS_PTR NULL |
210 | 216 | ||
211 | #endif /* !CONFIG_PM_RUNTIME */ | 217 | #endif /* !CONFIG_PM */ |
212 | 218 | ||
213 | static struct bus_type sdio_bus_type = { | 219 | static struct bus_type sdio_bus_type = { |
214 | .name = "sdio", | 220 | .name = "sdio", |
diff --git a/drivers/mmc/host/atmel-mci-regs.h b/drivers/mmc/host/atmel-mci-regs.h index 000b3ad0f5ca..787aba1682bb 100644 --- a/drivers/mmc/host/atmel-mci-regs.h +++ b/drivers/mmc/host/atmel-mci-regs.h | |||
@@ -31,6 +31,7 @@ | |||
31 | # define ATMCI_MR_PDCFBYTE ( 1 << 13) /* Force Byte Transfer */ | 31 | # define ATMCI_MR_PDCFBYTE ( 1 << 13) /* Force Byte Transfer */ |
32 | # define ATMCI_MR_PDCPADV ( 1 << 14) /* Padding Value */ | 32 | # define ATMCI_MR_PDCPADV ( 1 << 14) /* Padding Value */ |
33 | # define ATMCI_MR_PDCMODE ( 1 << 15) /* PDC-oriented Mode */ | 33 | # define ATMCI_MR_PDCMODE ( 1 << 15) /* PDC-oriented Mode */ |
34 | # define ATMCI_MR_CLKODD(x) ((x) << 16) /* LSB of Clock Divider */ | ||
34 | #define ATMCI_DTOR 0x0008 /* Data Timeout */ | 35 | #define ATMCI_DTOR 0x0008 /* Data Timeout */ |
35 | # define ATMCI_DTOCYC(x) ((x) << 0) /* Data Timeout Cycles */ | 36 | # define ATMCI_DTOCYC(x) ((x) << 0) /* Data Timeout Cycles */ |
36 | # define ATMCI_DTOMUL(x) ((x) << 4) /* Data Timeout Multiplier */ | 37 | # define ATMCI_DTOMUL(x) ((x) << 4) /* Data Timeout Multiplier */ |
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 9819dc09ce08..e94476beca18 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -77,6 +77,7 @@ struct atmel_mci_caps { | |||
77 | bool has_cstor_reg; | 77 | bool has_cstor_reg; |
78 | bool has_highspeed; | 78 | bool has_highspeed; |
79 | bool has_rwproof; | 79 | bool has_rwproof; |
80 | bool has_odd_clk_div; | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | struct atmel_mci_dma { | 83 | struct atmel_mci_dma { |
@@ -482,7 +483,14 @@ err: | |||
482 | static inline unsigned int atmci_ns_to_clocks(struct atmel_mci *host, | 483 | static inline unsigned int atmci_ns_to_clocks(struct atmel_mci *host, |
483 | unsigned int ns) | 484 | unsigned int ns) |
484 | { | 485 | { |
485 | return (ns * (host->bus_hz / 1000000) + 999) / 1000; | 486 | /* |
487 | * It is easier here to use us instead of ns for the timeout, | ||
488 | * it prevents from overflows during calculation. | ||
489 | */ | ||
490 | unsigned int us = DIV_ROUND_UP(ns, 1000); | ||
491 | |||
492 | /* Maximum clock frequency is host->bus_hz/2 */ | ||
493 | return us * (DIV_ROUND_UP(host->bus_hz, 2000000)); | ||
486 | } | 494 | } |
487 | 495 | ||
488 | static void atmci_set_timeout(struct atmel_mci *host, | 496 | static void atmci_set_timeout(struct atmel_mci *host, |
@@ -1127,16 +1135,27 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1127 | } | 1135 | } |
1128 | 1136 | ||
1129 | /* Calculate clock divider */ | 1137 | /* Calculate clock divider */ |
1130 | clkdiv = DIV_ROUND_UP(host->bus_hz, 2 * clock_min) - 1; | 1138 | if (host->caps.has_odd_clk_div) { |
1131 | if (clkdiv > 255) { | 1139 | clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2; |
1132 | dev_warn(&mmc->class_dev, | 1140 | if (clkdiv > 511) { |
1133 | "clock %u too slow; using %lu\n", | 1141 | dev_warn(&mmc->class_dev, |
1134 | clock_min, host->bus_hz / (2 * 256)); | 1142 | "clock %u too slow; using %lu\n", |
1135 | clkdiv = 255; | 1143 | clock_min, host->bus_hz / (511 + 2)); |
1144 | clkdiv = 511; | ||
1145 | } | ||
1146 | host->mode_reg = ATMCI_MR_CLKDIV(clkdiv >> 1) | ||
1147 | | ATMCI_MR_CLKODD(clkdiv & 1); | ||
1148 | } else { | ||
1149 | clkdiv = DIV_ROUND_UP(host->bus_hz, 2 * clock_min) - 1; | ||
1150 | if (clkdiv > 255) { | ||
1151 | dev_warn(&mmc->class_dev, | ||
1152 | "clock %u too slow; using %lu\n", | ||
1153 | clock_min, host->bus_hz / (2 * 256)); | ||
1154 | clkdiv = 255; | ||
1155 | } | ||
1156 | host->mode_reg = ATMCI_MR_CLKDIV(clkdiv); | ||
1136 | } | 1157 | } |
1137 | 1158 | ||
1138 | host->mode_reg = ATMCI_MR_CLKDIV(clkdiv); | ||
1139 | |||
1140 | /* | 1159 | /* |
1141 | * WRPROOF and RDPROOF prevent overruns/underruns by | 1160 | * WRPROOF and RDPROOF prevent overruns/underruns by |
1142 | * stopping the clock when the FIFO is full/empty. | 1161 | * stopping the clock when the FIFO is full/empty. |
@@ -2007,35 +2026,35 @@ static void __init atmci_get_cap(struct atmel_mci *host) | |||
2007 | "version: 0x%x\n", version); | 2026 | "version: 0x%x\n", version); |
2008 | 2027 | ||
2009 | host->caps.has_dma = 0; | 2028 | host->caps.has_dma = 0; |
2010 | host->caps.has_pdc = 0; | 2029 | host->caps.has_pdc = 1; |
2011 | host->caps.has_cfg_reg = 0; | 2030 | host->caps.has_cfg_reg = 0; |
2012 | host->caps.has_cstor_reg = 0; | 2031 | host->caps.has_cstor_reg = 0; |
2013 | host->caps.has_highspeed = 0; | 2032 | host->caps.has_highspeed = 0; |
2014 | host->caps.has_rwproof = 0; | 2033 | host->caps.has_rwproof = 0; |
2034 | host->caps.has_odd_clk_div = 0; | ||
2015 | 2035 | ||
2016 | /* keep only major version number */ | 2036 | /* keep only major version number */ |
2017 | switch (version & 0xf00) { | 2037 | switch (version & 0xf00) { |
2018 | case 0x100: | ||
2019 | case 0x200: | ||
2020 | host->caps.has_pdc = 1; | ||
2021 | host->caps.has_rwproof = 1; | ||
2022 | break; | ||
2023 | case 0x300: | ||
2024 | case 0x400: | ||
2025 | case 0x500: | 2038 | case 0x500: |
2039 | host->caps.has_odd_clk_div = 1; | ||
2040 | case 0x400: | ||
2041 | case 0x300: | ||
2026 | #ifdef CONFIG_AT_HDMAC | 2042 | #ifdef CONFIG_AT_HDMAC |
2027 | host->caps.has_dma = 1; | 2043 | host->caps.has_dma = 1; |
2028 | #else | 2044 | #else |
2029 | host->caps.has_dma = 0; | ||
2030 | dev_info(&host->pdev->dev, | 2045 | dev_info(&host->pdev->dev, |
2031 | "has dma capability but dma engine is not selected, then use pio\n"); | 2046 | "has dma capability but dma engine is not selected, then use pio\n"); |
2032 | #endif | 2047 | #endif |
2048 | host->caps.has_pdc = 0; | ||
2033 | host->caps.has_cfg_reg = 1; | 2049 | host->caps.has_cfg_reg = 1; |
2034 | host->caps.has_cstor_reg = 1; | 2050 | host->caps.has_cstor_reg = 1; |
2035 | host->caps.has_highspeed = 1; | 2051 | host->caps.has_highspeed = 1; |
2052 | case 0x200: | ||
2036 | host->caps.has_rwproof = 1; | 2053 | host->caps.has_rwproof = 1; |
2054 | case 0x100: | ||
2037 | break; | 2055 | break; |
2038 | default: | 2056 | default: |
2057 | host->caps.has_pdc = 0; | ||
2039 | dev_warn(&host->pdev->dev, | 2058 | dev_warn(&host->pdev->dev, |
2040 | "Unmanaged mci version, set minimum capabilities\n"); | 2059 | "Unmanaged mci version, set minimum capabilities\n"); |
2041 | break; | 2060 | break; |
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index bf3c9b456aaf..ab3fc4617107 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c | |||
@@ -526,8 +526,10 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data) | |||
526 | return -ENODEV; | 526 | return -ENODEV; |
527 | 527 | ||
528 | sg_len = dw_mci_pre_dma_transfer(host, data, 0); | 528 | sg_len = dw_mci_pre_dma_transfer(host, data, 0); |
529 | if (sg_len < 0) | 529 | if (sg_len < 0) { |
530 | host->dma_ops->stop(host); | ||
530 | return sg_len; | 531 | return sg_len; |
532 | } | ||
531 | 533 | ||
532 | host->using_dma = 1; | 534 | host->using_dma = 1; |
533 | 535 | ||
@@ -1879,7 +1881,8 @@ static void dw_mci_init_dma(struct dw_mci *host) | |||
1879 | if (!host->dma_ops) | 1881 | if (!host->dma_ops) |
1880 | goto no_dma; | 1882 | goto no_dma; |
1881 | 1883 | ||
1882 | if (host->dma_ops->init) { | 1884 | if (host->dma_ops->init && host->dma_ops->start && |
1885 | host->dma_ops->stop && host->dma_ops->cleanup) { | ||
1883 | if (host->dma_ops->init(host)) { | 1886 | if (host->dma_ops->init(host)) { |
1884 | dev_err(&host->dev, "%s: Unable to initialize " | 1887 | dev_err(&host->dev, "%s: Unable to initialize " |
1885 | "DMA Controller.\n", __func__); | 1888 | "DMA Controller.\n", __func__); |
diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c index b0f2ef988188..e3f5af96ab87 100644 --- a/drivers/mmc/host/mxs-mmc.c +++ b/drivers/mmc/host/mxs-mmc.c | |||
@@ -363,6 +363,7 @@ static void mxs_mmc_bc(struct mxs_mmc_host *host) | |||
363 | goto out; | 363 | goto out; |
364 | 364 | ||
365 | dmaengine_submit(desc); | 365 | dmaengine_submit(desc); |
366 | dma_async_issue_pending(host->dmach); | ||
366 | return; | 367 | return; |
367 | 368 | ||
368 | out: | 369 | out: |
@@ -403,6 +404,7 @@ static void mxs_mmc_ac(struct mxs_mmc_host *host) | |||
403 | goto out; | 404 | goto out; |
404 | 405 | ||
405 | dmaengine_submit(desc); | 406 | dmaengine_submit(desc); |
407 | dma_async_issue_pending(host->dmach); | ||
406 | return; | 408 | return; |
407 | 409 | ||
408 | out: | 410 | out: |
@@ -531,6 +533,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) | |||
531 | goto out; | 533 | goto out; |
532 | 534 | ||
533 | dmaengine_submit(desc); | 535 | dmaengine_submit(desc); |
536 | dma_async_issue_pending(host->dmach); | ||
534 | return; | 537 | return; |
535 | out: | 538 | out: |
536 | dev_warn(mmc_dev(host->mmc), | 539 | dev_warn(mmc_dev(host->mmc), |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 47adb161d3ad..56d4499d4388 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -249,7 +249,7 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on, | |||
249 | * the pbias cell programming support is still missing when | 249 | * the pbias cell programming support is still missing when |
250 | * booting with Device tree | 250 | * booting with Device tree |
251 | */ | 251 | */ |
252 | if (of_have_populated_dt() && !vdd) | 252 | if (dev->of_node && !vdd) |
253 | return 0; | 253 | return 0; |
254 | 254 | ||
255 | if (mmc_slot(host).before_set_reg) | 255 | if (mmc_slot(host).before_set_reg) |
@@ -1549,7 +1549,7 @@ static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1549 | * can't be allowed when booting with device | 1549 | * can't be allowed when booting with device |
1550 | * tree. | 1550 | * tree. |
1551 | */ | 1551 | */ |
1552 | (!of_have_populated_dt())) { | 1552 | !host->dev->of_node) { |
1553 | /* | 1553 | /* |
1554 | * The mmc_select_voltage fn of the core does | 1554 | * The mmc_select_voltage fn of the core does |
1555 | * not seem to set the power_mode to | 1555 | * not seem to set the power_mode to |
@@ -1741,7 +1741,7 @@ static const struct of_device_id omap_mmc_of_match[] = { | |||
1741 | .data = &omap4_reg_offset, | 1741 | .data = &omap4_reg_offset, |
1742 | }, | 1742 | }, |
1743 | {}, | 1743 | {}, |
1744 | } | 1744 | }; |
1745 | MODULE_DEVICE_TABLE(of, omap_mmc_of_match); | 1745 | MODULE_DEVICE_TABLE(of, omap_mmc_of_match); |
1746 | 1746 | ||
1747 | static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) | 1747 | static struct omap_mmc_platform_data *of_get_hsmmc_pdata(struct device *dev) |
@@ -1785,7 +1785,7 @@ static inline struct omap_mmc_platform_data | |||
1785 | } | 1785 | } |
1786 | #endif | 1786 | #endif |
1787 | 1787 | ||
1788 | static int __init omap_hsmmc_probe(struct platform_device *pdev) | 1788 | static int __devinit omap_hsmmc_probe(struct platform_device *pdev) |
1789 | { | 1789 | { |
1790 | struct omap_mmc_platform_data *pdata = pdev->dev.platform_data; | 1790 | struct omap_mmc_platform_data *pdata = pdev->dev.platform_data; |
1791 | struct mmc_host *mmc; | 1791 | struct mmc_host *mmc; |
@@ -1818,8 +1818,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1818 | if (res == NULL || irq < 0) | 1818 | if (res == NULL || irq < 0) |
1819 | return -ENXIO; | 1819 | return -ENXIO; |
1820 | 1820 | ||
1821 | res->start += pdata->reg_offset; | ||
1822 | res->end += pdata->reg_offset; | ||
1823 | res = request_mem_region(res->start, resource_size(res), pdev->name); | 1821 | res = request_mem_region(res->start, resource_size(res), pdev->name); |
1824 | if (res == NULL) | 1822 | if (res == NULL) |
1825 | return -EBUSY; | 1823 | return -EBUSY; |
@@ -1843,7 +1841,7 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1843 | host->dma_ch = -1; | 1841 | host->dma_ch = -1; |
1844 | host->irq = irq; | 1842 | host->irq = irq; |
1845 | host->slot_id = 0; | 1843 | host->slot_id = 0; |
1846 | host->mapbase = res->start; | 1844 | host->mapbase = res->start + pdata->reg_offset; |
1847 | host->base = ioremap(host->mapbase, SZ_4K); | 1845 | host->base = ioremap(host->mapbase, SZ_4K); |
1848 | host->power_mode = MMC_POWER_OFF; | 1846 | host->power_mode = MMC_POWER_OFF; |
1849 | host->next_data.cookie = 1; | 1847 | host->next_data.cookie = 1; |
@@ -1875,8 +1873,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1875 | goto err1; | 1873 | goto err1; |
1876 | } | 1874 | } |
1877 | 1875 | ||
1878 | omap_hsmmc_context_save(host); | ||
1879 | |||
1880 | if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) { | 1876 | if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) { |
1881 | dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n"); | 1877 | dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n"); |
1882 | mmc->caps2 |= MMC_CAP2_NO_MULTI_READ; | 1878 | mmc->caps2 |= MMC_CAP2_NO_MULTI_READ; |
@@ -1887,6 +1883,8 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) | |||
1887 | pm_runtime_set_autosuspend_delay(host->dev, MMC_AUTOSUSPEND_DELAY); | 1883 | pm_runtime_set_autosuspend_delay(host->dev, MMC_AUTOSUSPEND_DELAY); |
1888 | pm_runtime_use_autosuspend(host->dev); | 1884 | pm_runtime_use_autosuspend(host->dev); |
1889 | 1885 | ||
1886 | omap_hsmmc_context_save(host); | ||
1887 | |||
1890 | if (cpu_is_omap2430()) { | 1888 | if (cpu_is_omap2430()) { |
1891 | host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck"); | 1889 | host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck"); |
1892 | /* | 1890 | /* |
@@ -2018,8 +2016,7 @@ err_reg: | |||
2018 | err_irq_cd_init: | 2016 | err_irq_cd_init: |
2019 | free_irq(host->irq, host); | 2017 | free_irq(host->irq, host); |
2020 | err_irq: | 2018 | err_irq: |
2021 | pm_runtime_mark_last_busy(host->dev); | 2019 | pm_runtime_put_sync(host->dev); |
2022 | pm_runtime_put_autosuspend(host->dev); | ||
2023 | pm_runtime_disable(host->dev); | 2020 | pm_runtime_disable(host->dev); |
2024 | clk_put(host->fclk); | 2021 | clk_put(host->fclk); |
2025 | if (host->got_dbclk) { | 2022 | if (host->got_dbclk) { |
@@ -2037,35 +2034,33 @@ err: | |||
2037 | return ret; | 2034 | return ret; |
2038 | } | 2035 | } |
2039 | 2036 | ||
2040 | static int omap_hsmmc_remove(struct platform_device *pdev) | 2037 | static int __devexit omap_hsmmc_remove(struct platform_device *pdev) |
2041 | { | 2038 | { |
2042 | struct omap_hsmmc_host *host = platform_get_drvdata(pdev); | 2039 | struct omap_hsmmc_host *host = platform_get_drvdata(pdev); |
2043 | struct resource *res; | 2040 | struct resource *res; |
2044 | 2041 | ||
2045 | if (host) { | 2042 | pm_runtime_get_sync(host->dev); |
2046 | pm_runtime_get_sync(host->dev); | 2043 | mmc_remove_host(host->mmc); |
2047 | mmc_remove_host(host->mmc); | 2044 | if (host->use_reg) |
2048 | if (host->use_reg) | 2045 | omap_hsmmc_reg_put(host); |
2049 | omap_hsmmc_reg_put(host); | 2046 | if (host->pdata->cleanup) |
2050 | if (host->pdata->cleanup) | 2047 | host->pdata->cleanup(&pdev->dev); |
2051 | host->pdata->cleanup(&pdev->dev); | 2048 | free_irq(host->irq, host); |
2052 | free_irq(host->irq, host); | 2049 | if (mmc_slot(host).card_detect_irq) |
2053 | if (mmc_slot(host).card_detect_irq) | 2050 | free_irq(mmc_slot(host).card_detect_irq, host); |
2054 | free_irq(mmc_slot(host).card_detect_irq, host); | ||
2055 | |||
2056 | pm_runtime_put_sync(host->dev); | ||
2057 | pm_runtime_disable(host->dev); | ||
2058 | clk_put(host->fclk); | ||
2059 | if (host->got_dbclk) { | ||
2060 | clk_disable(host->dbclk); | ||
2061 | clk_put(host->dbclk); | ||
2062 | } | ||
2063 | 2051 | ||
2064 | mmc_free_host(host->mmc); | 2052 | pm_runtime_put_sync(host->dev); |
2065 | iounmap(host->base); | 2053 | pm_runtime_disable(host->dev); |
2066 | omap_hsmmc_gpio_free(pdev->dev.platform_data); | 2054 | clk_put(host->fclk); |
2055 | if (host->got_dbclk) { | ||
2056 | clk_disable(host->dbclk); | ||
2057 | clk_put(host->dbclk); | ||
2067 | } | 2058 | } |
2068 | 2059 | ||
2060 | mmc_free_host(host->mmc); | ||
2061 | iounmap(host->base); | ||
2062 | omap_hsmmc_gpio_free(pdev->dev.platform_data); | ||
2063 | |||
2069 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2064 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
2070 | if (res) | 2065 | if (res) |
2071 | release_mem_region(res->start, resource_size(res)); | 2066 | release_mem_region(res->start, resource_size(res)); |
@@ -2078,49 +2073,45 @@ static int omap_hsmmc_remove(struct platform_device *pdev) | |||
2078 | static int omap_hsmmc_suspend(struct device *dev) | 2073 | static int omap_hsmmc_suspend(struct device *dev) |
2079 | { | 2074 | { |
2080 | int ret = 0; | 2075 | int ret = 0; |
2081 | struct platform_device *pdev = to_platform_device(dev); | 2076 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
2082 | struct omap_hsmmc_host *host = platform_get_drvdata(pdev); | ||
2083 | 2077 | ||
2084 | if (host && host->suspended) | 2078 | if (!host) |
2085 | return 0; | 2079 | return 0; |
2086 | 2080 | ||
2087 | if (host) { | 2081 | if (host && host->suspended) |
2088 | pm_runtime_get_sync(host->dev); | 2082 | return 0; |
2089 | host->suspended = 1; | ||
2090 | if (host->pdata->suspend) { | ||
2091 | ret = host->pdata->suspend(&pdev->dev, | ||
2092 | host->slot_id); | ||
2093 | if (ret) { | ||
2094 | dev_dbg(mmc_dev(host->mmc), | ||
2095 | "Unable to handle MMC board" | ||
2096 | " level suspend\n"); | ||
2097 | host->suspended = 0; | ||
2098 | return ret; | ||
2099 | } | ||
2100 | } | ||
2101 | ret = mmc_suspend_host(host->mmc); | ||
2102 | 2083 | ||
2084 | pm_runtime_get_sync(host->dev); | ||
2085 | host->suspended = 1; | ||
2086 | if (host->pdata->suspend) { | ||
2087 | ret = host->pdata->suspend(dev, host->slot_id); | ||
2103 | if (ret) { | 2088 | if (ret) { |
2089 | dev_dbg(dev, "Unable to handle MMC board" | ||
2090 | " level suspend\n"); | ||
2104 | host->suspended = 0; | 2091 | host->suspended = 0; |
2105 | if (host->pdata->resume) { | 2092 | return ret; |
2106 | ret = host->pdata->resume(&pdev->dev, | ||
2107 | host->slot_id); | ||
2108 | if (ret) | ||
2109 | dev_dbg(mmc_dev(host->mmc), | ||
2110 | "Unmask interrupt failed\n"); | ||
2111 | } | ||
2112 | goto err; | ||
2113 | } | 2093 | } |
2094 | } | ||
2095 | ret = mmc_suspend_host(host->mmc); | ||
2114 | 2096 | ||
2115 | if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) { | 2097 | if (ret) { |
2116 | omap_hsmmc_disable_irq(host); | 2098 | host->suspended = 0; |
2117 | OMAP_HSMMC_WRITE(host->base, HCTL, | 2099 | if (host->pdata->resume) { |
2118 | OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); | 2100 | ret = host->pdata->resume(dev, host->slot_id); |
2101 | if (ret) | ||
2102 | dev_dbg(dev, "Unmask interrupt failed\n"); | ||
2119 | } | 2103 | } |
2120 | if (host->got_dbclk) | 2104 | goto err; |
2121 | clk_disable(host->dbclk); | 2105 | } |
2122 | 2106 | ||
2107 | if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) { | ||
2108 | omap_hsmmc_disable_irq(host); | ||
2109 | OMAP_HSMMC_WRITE(host->base, HCTL, | ||
2110 | OMAP_HSMMC_READ(host->base, HCTL) & ~SDBP); | ||
2123 | } | 2111 | } |
2112 | |||
2113 | if (host->got_dbclk) | ||
2114 | clk_disable(host->dbclk); | ||
2124 | err: | 2115 | err: |
2125 | pm_runtime_put_sync(host->dev); | 2116 | pm_runtime_put_sync(host->dev); |
2126 | return ret; | 2117 | return ret; |
@@ -2130,38 +2121,37 @@ err: | |||
2130 | static int omap_hsmmc_resume(struct device *dev) | 2121 | static int omap_hsmmc_resume(struct device *dev) |
2131 | { | 2122 | { |
2132 | int ret = 0; | 2123 | int ret = 0; |
2133 | struct platform_device *pdev = to_platform_device(dev); | 2124 | struct omap_hsmmc_host *host = dev_get_drvdata(dev); |
2134 | struct omap_hsmmc_host *host = platform_get_drvdata(pdev); | 2125 | |
2126 | if (!host) | ||
2127 | return 0; | ||
2135 | 2128 | ||
2136 | if (host && !host->suspended) | 2129 | if (host && !host->suspended) |
2137 | return 0; | 2130 | return 0; |
2138 | 2131 | ||
2139 | if (host) { | 2132 | pm_runtime_get_sync(host->dev); |
2140 | pm_runtime_get_sync(host->dev); | ||
2141 | 2133 | ||
2142 | if (host->got_dbclk) | 2134 | if (host->got_dbclk) |
2143 | clk_enable(host->dbclk); | 2135 | clk_enable(host->dbclk); |
2144 | 2136 | ||
2145 | if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) | 2137 | if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) |
2146 | omap_hsmmc_conf_bus_power(host); | 2138 | omap_hsmmc_conf_bus_power(host); |
2147 | 2139 | ||
2148 | if (host->pdata->resume) { | 2140 | if (host->pdata->resume) { |
2149 | ret = host->pdata->resume(&pdev->dev, host->slot_id); | 2141 | ret = host->pdata->resume(dev, host->slot_id); |
2150 | if (ret) | 2142 | if (ret) |
2151 | dev_dbg(mmc_dev(host->mmc), | 2143 | dev_dbg(dev, "Unmask interrupt failed\n"); |
2152 | "Unmask interrupt failed\n"); | 2144 | } |
2153 | } | ||
2154 | 2145 | ||
2155 | omap_hsmmc_protect_card(host); | 2146 | omap_hsmmc_protect_card(host); |
2156 | 2147 | ||
2157 | /* Notify the core to resume the host */ | 2148 | /* Notify the core to resume the host */ |
2158 | ret = mmc_resume_host(host->mmc); | 2149 | ret = mmc_resume_host(host->mmc); |
2159 | if (ret == 0) | 2150 | if (ret == 0) |
2160 | host->suspended = 0; | 2151 | host->suspended = 0; |
2161 | 2152 | ||
2162 | pm_runtime_mark_last_busy(host->dev); | 2153 | pm_runtime_mark_last_busy(host->dev); |
2163 | pm_runtime_put_autosuspend(host->dev); | 2154 | pm_runtime_put_autosuspend(host->dev); |
2164 | } | ||
2165 | 2155 | ||
2166 | return ret; | 2156 | return ret; |
2167 | 2157 | ||
@@ -2178,7 +2168,7 @@ static int omap_hsmmc_runtime_suspend(struct device *dev) | |||
2178 | 2168 | ||
2179 | host = platform_get_drvdata(to_platform_device(dev)); | 2169 | host = platform_get_drvdata(to_platform_device(dev)); |
2180 | omap_hsmmc_context_save(host); | 2170 | omap_hsmmc_context_save(host); |
2181 | dev_dbg(mmc_dev(host->mmc), "disabled\n"); | 2171 | dev_dbg(dev, "disabled\n"); |
2182 | 2172 | ||
2183 | return 0; | 2173 | return 0; |
2184 | } | 2174 | } |
@@ -2189,7 +2179,7 @@ static int omap_hsmmc_runtime_resume(struct device *dev) | |||
2189 | 2179 | ||
2190 | host = platform_get_drvdata(to_platform_device(dev)); | 2180 | host = platform_get_drvdata(to_platform_device(dev)); |
2191 | omap_hsmmc_context_restore(host); | 2181 | omap_hsmmc_context_restore(host); |
2192 | dev_dbg(mmc_dev(host->mmc), "enabled\n"); | 2182 | dev_dbg(dev, "enabled\n"); |
2193 | 2183 | ||
2194 | return 0; | 2184 | return 0; |
2195 | } | 2185 | } |
@@ -2202,7 +2192,8 @@ static struct dev_pm_ops omap_hsmmc_dev_pm_ops = { | |||
2202 | }; | 2192 | }; |
2203 | 2193 | ||
2204 | static struct platform_driver omap_hsmmc_driver = { | 2194 | static struct platform_driver omap_hsmmc_driver = { |
2205 | .remove = omap_hsmmc_remove, | 2195 | .probe = omap_hsmmc_probe, |
2196 | .remove = __devexit_p(omap_hsmmc_remove), | ||
2206 | .driver = { | 2197 | .driver = { |
2207 | .name = DRIVER_NAME, | 2198 | .name = DRIVER_NAME, |
2208 | .owner = THIS_MODULE, | 2199 | .owner = THIS_MODULE, |
@@ -2211,21 +2202,7 @@ static struct platform_driver omap_hsmmc_driver = { | |||
2211 | }, | 2202 | }, |
2212 | }; | 2203 | }; |
2213 | 2204 | ||
2214 | static int __init omap_hsmmc_init(void) | 2205 | module_platform_driver(omap_hsmmc_driver); |
2215 | { | ||
2216 | /* Register the MMC driver */ | ||
2217 | return platform_driver_probe(&omap_hsmmc_driver, omap_hsmmc_probe); | ||
2218 | } | ||
2219 | |||
2220 | static void __exit omap_hsmmc_cleanup(void) | ||
2221 | { | ||
2222 | /* Unregister MMC driver */ | ||
2223 | platform_driver_unregister(&omap_hsmmc_driver); | ||
2224 | } | ||
2225 | |||
2226 | module_init(omap_hsmmc_init); | ||
2227 | module_exit(omap_hsmmc_cleanup); | ||
2228 | |||
2229 | MODULE_DESCRIPTION("OMAP High Speed Multimedia Card driver"); | 2206 | MODULE_DESCRIPTION("OMAP High Speed Multimedia Card driver"); |
2230 | MODULE_LICENSE("GPL"); | 2207 | MODULE_LICENSE("GPL"); |
2231 | MODULE_ALIAS("platform:" DRIVER_NAME); | 2208 | MODULE_ALIAS("platform:" DRIVER_NAME); |
diff --git a/drivers/mmc/host/sdhci-dove.c b/drivers/mmc/host/sdhci-dove.c index 46fd1fd1b605..177f697b5835 100644 --- a/drivers/mmc/host/sdhci-dove.c +++ b/drivers/mmc/host/sdhci-dove.c | |||
@@ -20,6 +20,7 @@ | |||
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/module.h> | ||
23 | #include <linux/mmc/host.h> | 24 | #include <linux/mmc/host.h> |
24 | 25 | ||
25 | #include "sdhci-pltfm.h" | 26 | #include "sdhci-pltfm.h" |
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 6193a0d7bde5..8abdaf6697a8 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c | |||
@@ -467,8 +467,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev) | |||
467 | clk_prepare_enable(clk); | 467 | clk_prepare_enable(clk); |
468 | pltfm_host->clk = clk; | 468 | pltfm_host->clk = clk; |
469 | 469 | ||
470 | if (!is_imx25_esdhc(imx_data)) | 470 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
471 | host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; | ||
472 | 471 | ||
473 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) | 472 | if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data)) |
474 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ | 473 | /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */ |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index fbbebe251e01..69ef0beae104 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
@@ -1418,8 +1418,6 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev, | |||
1418 | 1418 | ||
1419 | slots = chip->num_slots; /* Quirk may have changed this */ | 1419 | slots = chip->num_slots; /* Quirk may have changed this */ |
1420 | 1420 | ||
1421 | pci_enable_msi(pdev); | ||
1422 | |||
1423 | for (i = 0; i < slots; i++) { | 1421 | for (i = 0; i < slots; i++) { |
1424 | slot = sdhci_pci_probe_slot(pdev, chip, first_bar, i); | 1422 | slot = sdhci_pci_probe_slot(pdev, chip, first_bar, i); |
1425 | if (IS_ERR(slot)) { | 1423 | if (IS_ERR(slot)) { |
@@ -1438,8 +1436,6 @@ static int __devinit sdhci_pci_probe(struct pci_dev *pdev, | |||
1438 | return 0; | 1436 | return 0; |
1439 | 1437 | ||
1440 | free: | 1438 | free: |
1441 | pci_disable_msi(pdev); | ||
1442 | |||
1443 | pci_set_drvdata(pdev, NULL); | 1439 | pci_set_drvdata(pdev, NULL); |
1444 | kfree(chip); | 1440 | kfree(chip); |
1445 | 1441 | ||
@@ -1462,8 +1458,6 @@ static void __devexit sdhci_pci_remove(struct pci_dev *pdev) | |||
1462 | for (i = 0; i < chip->num_slots; i++) | 1458 | for (i = 0; i < chip->num_slots; i++) |
1463 | sdhci_pci_remove_slot(chip->slots[i]); | 1459 | sdhci_pci_remove_slot(chip->slots[i]); |
1464 | 1460 | ||
1465 | pci_disable_msi(pdev); | ||
1466 | |||
1467 | pci_set_drvdata(pdev, NULL); | 1461 | pci_set_drvdata(pdev, NULL); |
1468 | kfree(chip); | 1462 | kfree(chip); |
1469 | } | 1463 | } |
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index b19e7d435f8d..55a164fcaa15 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c | |||
@@ -20,6 +20,10 @@ | |||
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/gpio.h> | 21 | #include <linux/gpio.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/of.h> | ||
24 | #include <linux/of_gpio.h> | ||
25 | #include <linux/pm.h> | ||
26 | #include <linux/pm_runtime.h> | ||
23 | 27 | ||
24 | #include <linux/mmc/host.h> | 28 | #include <linux/mmc/host.h> |
25 | 29 | ||
@@ -53,6 +57,18 @@ struct sdhci_s3c { | |||
53 | struct clk *clk_bus[MAX_BUS_CLK]; | 57 | struct clk *clk_bus[MAX_BUS_CLK]; |
54 | }; | 58 | }; |
55 | 59 | ||
60 | /** | ||
61 | * struct sdhci_s3c_driver_data - S3C SDHCI platform specific driver data | ||
62 | * @sdhci_quirks: sdhci host specific quirks. | ||
63 | * | ||
64 | * Specifies platform specific configuration of sdhci controller. | ||
65 | * Note: A structure for driver specific platform data is used for future | ||
66 | * expansion of its usage. | ||
67 | */ | ||
68 | struct sdhci_s3c_drv_data { | ||
69 | unsigned int sdhci_quirks; | ||
70 | }; | ||
71 | |||
56 | static inline struct sdhci_s3c *to_s3c(struct sdhci_host *host) | 72 | static inline struct sdhci_s3c *to_s3c(struct sdhci_host *host) |
57 | { | 73 | { |
58 | return sdhci_priv(host); | 74 | return sdhci_priv(host); |
@@ -132,10 +148,10 @@ static unsigned int sdhci_s3c_consider_clock(struct sdhci_s3c *ourhost, | |||
132 | return UINT_MAX; | 148 | return UINT_MAX; |
133 | 149 | ||
134 | /* | 150 | /* |
135 | * Clock divider's step is different as 1 from that of host controller | 151 | * If controller uses a non-standard clock division, find the best clock |
136 | * when 'clk_type' is S3C_SDHCI_CLK_DIV_EXTERNAL. | 152 | * speed possible with selected clock source and skip the division. |
137 | */ | 153 | */ |
138 | if (ourhost->pdata->clk_type) { | 154 | if (ourhost->host->quirks & SDHCI_QUIRK_NONSTANDARD_CLOCK) { |
139 | rate = clk_round_rate(clksrc, wanted); | 155 | rate = clk_round_rate(clksrc, wanted); |
140 | return wanted - rate; | 156 | return wanted - rate; |
141 | } | 157 | } |
@@ -272,6 +288,8 @@ static unsigned int sdhci_cmu_get_min_clock(struct sdhci_host *host) | |||
272 | static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock) | 288 | static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock) |
273 | { | 289 | { |
274 | struct sdhci_s3c *ourhost = to_s3c(host); | 290 | struct sdhci_s3c *ourhost = to_s3c(host); |
291 | unsigned long timeout; | ||
292 | u16 clk = 0; | ||
275 | 293 | ||
276 | /* don't bother if the clock is going off */ | 294 | /* don't bother if the clock is going off */ |
277 | if (clock == 0) | 295 | if (clock == 0) |
@@ -282,6 +300,25 @@ static void sdhci_cmu_set_clock(struct sdhci_host *host, unsigned int clock) | |||
282 | clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock); | 300 | clk_set_rate(ourhost->clk_bus[ourhost->cur_clk], clock); |
283 | 301 | ||
284 | host->clock = clock; | 302 | host->clock = clock; |
303 | |||
304 | clk = SDHCI_CLOCK_INT_EN; | ||
305 | sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); | ||
306 | |||
307 | /* Wait max 20 ms */ | ||
308 | timeout = 20; | ||
309 | while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL)) | ||
310 | & SDHCI_CLOCK_INT_STABLE)) { | ||
311 | if (timeout == 0) { | ||
312 | printk(KERN_ERR "%s: Internal clock never " | ||
313 | "stabilised.\n", mmc_hostname(host->mmc)); | ||
314 | return; | ||
315 | } | ||
316 | timeout--; | ||
317 | mdelay(1); | ||
318 | } | ||
319 | |||
320 | clk |= SDHCI_CLOCK_CARD_EN; | ||
321 | sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); | ||
285 | } | 322 | } |
286 | 323 | ||
287 | /** | 324 | /** |
@@ -382,16 +419,24 @@ static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc) | |||
382 | } | 419 | } |
383 | } | 420 | } |
384 | 421 | ||
422 | static inline struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data( | ||
423 | struct platform_device *pdev) | ||
424 | { | ||
425 | return (struct sdhci_s3c_drv_data *) | ||
426 | platform_get_device_id(pdev)->driver_data; | ||
427 | } | ||
428 | |||
385 | static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | 429 | static int __devinit sdhci_s3c_probe(struct platform_device *pdev) |
386 | { | 430 | { |
387 | struct s3c_sdhci_platdata *pdata = pdev->dev.platform_data; | 431 | struct s3c_sdhci_platdata *pdata; |
432 | struct sdhci_s3c_drv_data *drv_data; | ||
388 | struct device *dev = &pdev->dev; | 433 | struct device *dev = &pdev->dev; |
389 | struct sdhci_host *host; | 434 | struct sdhci_host *host; |
390 | struct sdhci_s3c *sc; | 435 | struct sdhci_s3c *sc; |
391 | struct resource *res; | 436 | struct resource *res; |
392 | int ret, irq, ptr, clks; | 437 | int ret, irq, ptr, clks; |
393 | 438 | ||
394 | if (!pdata) { | 439 | if (!pdev->dev.platform_data) { |
395 | dev_err(dev, "no device data specified\n"); | 440 | dev_err(dev, "no device data specified\n"); |
396 | return -ENOENT; | 441 | return -ENOENT; |
397 | } | 442 | } |
@@ -402,18 +447,20 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
402 | return irq; | 447 | return irq; |
403 | } | 448 | } |
404 | 449 | ||
405 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
406 | if (!res) { | ||
407 | dev_err(dev, "no memory specified\n"); | ||
408 | return -ENOENT; | ||
409 | } | ||
410 | |||
411 | host = sdhci_alloc_host(dev, sizeof(struct sdhci_s3c)); | 450 | host = sdhci_alloc_host(dev, sizeof(struct sdhci_s3c)); |
412 | if (IS_ERR(host)) { | 451 | if (IS_ERR(host)) { |
413 | dev_err(dev, "sdhci_alloc_host() failed\n"); | 452 | dev_err(dev, "sdhci_alloc_host() failed\n"); |
414 | return PTR_ERR(host); | 453 | return PTR_ERR(host); |
415 | } | 454 | } |
416 | 455 | ||
456 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
457 | if (!pdata) { | ||
458 | ret = -ENOMEM; | ||
459 | goto err_io_clk; | ||
460 | } | ||
461 | memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata)); | ||
462 | |||
463 | drv_data = sdhci_s3c_get_driver_data(pdev); | ||
417 | sc = sdhci_priv(host); | 464 | sc = sdhci_priv(host); |
418 | 465 | ||
419 | sc->host = host; | 466 | sc->host = host; |
@@ -464,15 +511,8 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
464 | goto err_no_busclks; | 511 | goto err_no_busclks; |
465 | } | 512 | } |
466 | 513 | ||
467 | sc->ioarea = request_mem_region(res->start, resource_size(res), | 514 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
468 | mmc_hostname(host->mmc)); | 515 | host->ioaddr = devm_request_and_ioremap(&pdev->dev, res); |
469 | if (!sc->ioarea) { | ||
470 | dev_err(dev, "failed to reserve register area\n"); | ||
471 | ret = -ENXIO; | ||
472 | goto err_req_regs; | ||
473 | } | ||
474 | |||
475 | host->ioaddr = ioremap_nocache(res->start, resource_size(res)); | ||
476 | if (!host->ioaddr) { | 516 | if (!host->ioaddr) { |
477 | dev_err(dev, "failed to map registers\n"); | 517 | dev_err(dev, "failed to map registers\n"); |
478 | ret = -ENXIO; | 518 | ret = -ENXIO; |
@@ -491,6 +531,8 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
491 | /* Setup quirks for the controller */ | 531 | /* Setup quirks for the controller */ |
492 | host->quirks |= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC; | 532 | host->quirks |= SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC; |
493 | host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT; | 533 | host->quirks |= SDHCI_QUIRK_NO_HISPD_BIT; |
534 | if (drv_data) | ||
535 | host->quirks |= drv_data->sdhci_quirks; | ||
494 | 536 | ||
495 | #ifndef CONFIG_MMC_SDHCI_S3C_DMA | 537 | #ifndef CONFIG_MMC_SDHCI_S3C_DMA |
496 | 538 | ||
@@ -518,6 +560,14 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
518 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) | 560 | if (pdata->cd_type == S3C_SDHCI_CD_PERMANENT) |
519 | host->mmc->caps = MMC_CAP_NONREMOVABLE; | 561 | host->mmc->caps = MMC_CAP_NONREMOVABLE; |
520 | 562 | ||
563 | switch (pdata->max_width) { | ||
564 | case 8: | ||
565 | host->mmc->caps |= MMC_CAP_8_BIT_DATA; | ||
566 | case 4: | ||
567 | host->mmc->caps |= MMC_CAP_4_BIT_DATA; | ||
568 | break; | ||
569 | } | ||
570 | |||
521 | if (pdata->pm_caps) | 571 | if (pdata->pm_caps) |
522 | host->mmc->pm_caps |= pdata->pm_caps; | 572 | host->mmc->pm_caps |= pdata->pm_caps; |
523 | 573 | ||
@@ -531,7 +581,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
531 | * If controller does not have internal clock divider, | 581 | * If controller does not have internal clock divider, |
532 | * we can use overriding functions instead of default. | 582 | * we can use overriding functions instead of default. |
533 | */ | 583 | */ |
534 | if (pdata->clk_type) { | 584 | if (host->quirks & SDHCI_QUIRK_NONSTANDARD_CLOCK) { |
535 | sdhci_s3c_ops.set_clock = sdhci_cmu_set_clock; | 585 | sdhci_s3c_ops.set_clock = sdhci_cmu_set_clock; |
536 | sdhci_s3c_ops.get_min_clock = sdhci_cmu_get_min_clock; | 586 | sdhci_s3c_ops.get_min_clock = sdhci_cmu_get_min_clock; |
537 | sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock; | 587 | sdhci_s3c_ops.get_max_clock = sdhci_cmu_get_max_clock; |
@@ -544,10 +594,17 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
544 | if (pdata->host_caps2) | 594 | if (pdata->host_caps2) |
545 | host->mmc->caps2 |= pdata->host_caps2; | 595 | host->mmc->caps2 |= pdata->host_caps2; |
546 | 596 | ||
597 | pm_runtime_enable(&pdev->dev); | ||
598 | pm_runtime_set_autosuspend_delay(&pdev->dev, 50); | ||
599 | pm_runtime_use_autosuspend(&pdev->dev); | ||
600 | pm_suspend_ignore_children(&pdev->dev, 1); | ||
601 | |||
547 | ret = sdhci_add_host(host); | 602 | ret = sdhci_add_host(host); |
548 | if (ret) { | 603 | if (ret) { |
549 | dev_err(dev, "sdhci_add_host() failed\n"); | 604 | dev_err(dev, "sdhci_add_host() failed\n"); |
550 | goto err_add_host; | 605 | pm_runtime_forbid(&pdev->dev); |
606 | pm_runtime_get_noresume(&pdev->dev); | ||
607 | goto err_req_regs; | ||
551 | } | 608 | } |
552 | 609 | ||
553 | /* The following two methods of card detection might call | 610 | /* The following two methods of card detection might call |
@@ -561,10 +618,6 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) | |||
561 | 618 | ||
562 | return 0; | 619 | return 0; |
563 | 620 | ||
564 | err_add_host: | ||
565 | release_resource(sc->ioarea); | ||
566 | kfree(sc->ioarea); | ||
567 | |||
568 | err_req_regs: | 621 | err_req_regs: |
569 | for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { | 622 | for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { |
570 | if (sc->clk_bus[ptr]) { | 623 | if (sc->clk_bus[ptr]) { |
@@ -601,6 +654,8 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) | |||
601 | 654 | ||
602 | sdhci_remove_host(host, 1); | 655 | sdhci_remove_host(host, 1); |
603 | 656 | ||
657 | pm_runtime_disable(&pdev->dev); | ||
658 | |||
604 | for (ptr = 0; ptr < 3; ptr++) { | 659 | for (ptr = 0; ptr < 3; ptr++) { |
605 | if (sc->clk_bus[ptr]) { | 660 | if (sc->clk_bus[ptr]) { |
606 | clk_disable(sc->clk_bus[ptr]); | 661 | clk_disable(sc->clk_bus[ptr]); |
@@ -610,18 +665,13 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) | |||
610 | clk_disable(sc->clk_io); | 665 | clk_disable(sc->clk_io); |
611 | clk_put(sc->clk_io); | 666 | clk_put(sc->clk_io); |
612 | 667 | ||
613 | iounmap(host->ioaddr); | ||
614 | release_resource(sc->ioarea); | ||
615 | kfree(sc->ioarea); | ||
616 | |||
617 | sdhci_free_host(host); | 668 | sdhci_free_host(host); |
618 | platform_set_drvdata(pdev, NULL); | 669 | platform_set_drvdata(pdev, NULL); |
619 | 670 | ||
620 | return 0; | 671 | return 0; |
621 | } | 672 | } |
622 | 673 | ||
623 | #ifdef CONFIG_PM | 674 | #ifdef CONFIG_PM_SLEEP |
624 | |||
625 | static int sdhci_s3c_suspend(struct device *dev) | 675 | static int sdhci_s3c_suspend(struct device *dev) |
626 | { | 676 | { |
627 | struct sdhci_host *host = dev_get_drvdata(dev); | 677 | struct sdhci_host *host = dev_get_drvdata(dev); |
@@ -635,10 +685,29 @@ static int sdhci_s3c_resume(struct device *dev) | |||
635 | 685 | ||
636 | return sdhci_resume_host(host); | 686 | return sdhci_resume_host(host); |
637 | } | 687 | } |
688 | #endif | ||
689 | |||
690 | #ifdef CONFIG_PM_RUNTIME | ||
691 | static int sdhci_s3c_runtime_suspend(struct device *dev) | ||
692 | { | ||
693 | struct sdhci_host *host = dev_get_drvdata(dev); | ||
694 | |||
695 | return sdhci_runtime_suspend_host(host); | ||
696 | } | ||
638 | 697 | ||
698 | static int sdhci_s3c_runtime_resume(struct device *dev) | ||
699 | { | ||
700 | struct sdhci_host *host = dev_get_drvdata(dev); | ||
701 | |||
702 | return sdhci_runtime_resume_host(host); | ||
703 | } | ||
704 | #endif | ||
705 | |||
706 | #ifdef CONFIG_PM | ||
639 | static const struct dev_pm_ops sdhci_s3c_pmops = { | 707 | static const struct dev_pm_ops sdhci_s3c_pmops = { |
640 | .suspend = sdhci_s3c_suspend, | 708 | SET_SYSTEM_SLEEP_PM_OPS(sdhci_s3c_suspend, sdhci_s3c_resume) |
641 | .resume = sdhci_s3c_resume, | 709 | SET_RUNTIME_PM_OPS(sdhci_s3c_runtime_suspend, sdhci_s3c_runtime_resume, |
710 | NULL) | ||
642 | }; | 711 | }; |
643 | 712 | ||
644 | #define SDHCI_S3C_PMOPS (&sdhci_s3c_pmops) | 713 | #define SDHCI_S3C_PMOPS (&sdhci_s3c_pmops) |
@@ -647,9 +716,31 @@ static const struct dev_pm_ops sdhci_s3c_pmops = { | |||
647 | #define SDHCI_S3C_PMOPS NULL | 716 | #define SDHCI_S3C_PMOPS NULL |
648 | #endif | 717 | #endif |
649 | 718 | ||
719 | #if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS4212) | ||
720 | static struct sdhci_s3c_drv_data exynos4_sdhci_drv_data = { | ||
721 | .sdhci_quirks = SDHCI_QUIRK_NONSTANDARD_CLOCK, | ||
722 | }; | ||
723 | #define EXYNOS4_SDHCI_DRV_DATA ((kernel_ulong_t)&exynos4_sdhci_drv_data) | ||
724 | #else | ||
725 | #define EXYNOS4_SDHCI_DRV_DATA ((kernel_ulong_t)NULL) | ||
726 | #endif | ||
727 | |||
728 | static struct platform_device_id sdhci_s3c_driver_ids[] = { | ||
729 | { | ||
730 | .name = "s3c-sdhci", | ||
731 | .driver_data = (kernel_ulong_t)NULL, | ||
732 | }, { | ||
733 | .name = "exynos4-sdhci", | ||
734 | .driver_data = EXYNOS4_SDHCI_DRV_DATA, | ||
735 | }, | ||
736 | { } | ||
737 | }; | ||
738 | MODULE_DEVICE_TABLE(platform, sdhci_s3c_driver_ids); | ||
739 | |||
650 | static struct platform_driver sdhci_s3c_driver = { | 740 | static struct platform_driver sdhci_s3c_driver = { |
651 | .probe = sdhci_s3c_probe, | 741 | .probe = sdhci_s3c_probe, |
652 | .remove = __devexit_p(sdhci_s3c_remove), | 742 | .remove = __devexit_p(sdhci_s3c_remove), |
743 | .id_table = sdhci_s3c_driver_ids, | ||
653 | .driver = { | 744 | .driver = { |
654 | .owner = THIS_MODULE, | 745 | .owner = THIS_MODULE, |
655 | .name = "s3c-sdhci", | 746 | .name = "s3c-sdhci", |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 8262cadfdab7..ccefdebeff14 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -147,7 +147,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable) | |||
147 | u32 present, irqs; | 147 | u32 present, irqs; |
148 | 148 | ||
149 | if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || | 149 | if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || |
150 | !mmc_card_is_removable(host->mmc)) | 150 | (host->mmc->caps & MMC_CAP_NONREMOVABLE)) |
151 | return; | 151 | return; |
152 | 152 | ||
153 | present = sdhci_readl(host, SDHCI_PRESENT_STATE) & | 153 | present = sdhci_readl(host, SDHCI_PRESENT_STATE) & |
@@ -2782,8 +2782,9 @@ int sdhci_add_host(struct sdhci_host *host) | |||
2782 | mmc_card_is_removable(mmc)) | 2782 | mmc_card_is_removable(mmc)) |
2783 | mmc->caps |= MMC_CAP_NEEDS_POLL; | 2783 | mmc->caps |= MMC_CAP_NEEDS_POLL; |
2784 | 2784 | ||
2785 | /* UHS-I mode(s) supported by the host controller. */ | 2785 | /* Any UHS-I mode in caps implies SDR12 and SDR25 support. */ |
2786 | if (host->version >= SDHCI_SPEC_300) | 2786 | if (caps[1] & (SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 | |
2787 | SDHCI_SUPPORT_DDR50)) | ||
2787 | mmc->caps |= MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25; | 2788 | mmc->caps |= MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25; |
2788 | 2789 | ||
2789 | /* SDR104 supports also implies SDR50 support */ | 2790 | /* SDR104 supports also implies SDR50 support */ |
diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index aafaf0b6eb1c..724b35e85a26 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c | |||
@@ -454,7 +454,8 @@ static void sh_mmcif_clock_control(struct sh_mmcif_host *host, unsigned int clk) | |||
454 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_SUP_PCLK); | 454 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_SUP_PCLK); |
455 | else | 455 | else |
456 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR & | 456 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_CLEAR & |
457 | ((fls(host->clk / clk) - 1) << 16)); | 457 | ((fls(DIV_ROUND_UP(host->clk, |
458 | clk) - 1) - 1) << 16)); | ||
458 | 459 | ||
459 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE); | 460 | sh_mmcif_bitset(host, MMCIF_CE_CLK_CTRL, CLK_ENABLE); |
460 | } | 461 | } |
@@ -1297,14 +1298,8 @@ static int __devinit sh_mmcif_probe(struct platform_device *pdev) | |||
1297 | spin_lock_init(&host->lock); | 1298 | spin_lock_init(&host->lock); |
1298 | 1299 | ||
1299 | mmc->ops = &sh_mmcif_ops; | 1300 | mmc->ops = &sh_mmcif_ops; |
1300 | mmc->f_max = host->clk; | 1301 | mmc->f_max = host->clk / 2; |
1301 | /* close to 400KHz */ | 1302 | mmc->f_min = host->clk / 512; |
1302 | if (mmc->f_max < 51200000) | ||
1303 | mmc->f_min = mmc->f_max / 128; | ||
1304 | else if (mmc->f_max < 102400000) | ||
1305 | mmc->f_min = mmc->f_max / 256; | ||
1306 | else | ||
1307 | mmc->f_min = mmc->f_max / 512; | ||
1308 | if (pd->ocr) | 1303 | if (pd->ocr) |
1309 | mmc->ocr_avail = pd->ocr; | 1304 | mmc->ocr_avail = pd->ocr; |
1310 | mmc->caps = MMC_CAP_MMC_HIGHSPEED; | 1305 | mmc->caps = MMC_CAP_MMC_HIGHSPEED; |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 94eb05b1afdf..58fc65f5c817 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -106,16 +106,14 @@ static int mtdchar_open(struct inode *inode, struct file *file) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | if (mtd->type == MTD_ABSENT) { | 108 | if (mtd->type == MTD_ABSENT) { |
109 | put_mtd_device(mtd); | ||
110 | ret = -ENODEV; | 109 | ret = -ENODEV; |
111 | goto out; | 110 | goto out1; |
112 | } | 111 | } |
113 | 112 | ||
114 | mtd_ino = iget_locked(mnt->mnt_sb, devnum); | 113 | mtd_ino = iget_locked(mnt->mnt_sb, devnum); |
115 | if (!mtd_ino) { | 114 | if (!mtd_ino) { |
116 | put_mtd_device(mtd); | ||
117 | ret = -ENOMEM; | 115 | ret = -ENOMEM; |
118 | goto out; | 116 | goto out1; |
119 | } | 117 | } |
120 | if (mtd_ino->i_state & I_NEW) { | 118 | if (mtd_ino->i_state & I_NEW) { |
121 | mtd_ino->i_private = mtd; | 119 | mtd_ino->i_private = mtd; |
@@ -127,23 +125,25 @@ static int mtdchar_open(struct inode *inode, struct file *file) | |||
127 | 125 | ||
128 | /* You can't open it RW if it's not a writeable device */ | 126 | /* You can't open it RW if it's not a writeable device */ |
129 | if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) { | 127 | if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) { |
130 | iput(mtd_ino); | ||
131 | put_mtd_device(mtd); | ||
132 | ret = -EACCES; | 128 | ret = -EACCES; |
133 | goto out; | 129 | goto out2; |
134 | } | 130 | } |
135 | 131 | ||
136 | mfi = kzalloc(sizeof(*mfi), GFP_KERNEL); | 132 | mfi = kzalloc(sizeof(*mfi), GFP_KERNEL); |
137 | if (!mfi) { | 133 | if (!mfi) { |
138 | iput(mtd_ino); | ||
139 | put_mtd_device(mtd); | ||
140 | ret = -ENOMEM; | 134 | ret = -ENOMEM; |
141 | goto out; | 135 | goto out2; |
142 | } | 136 | } |
143 | mfi->ino = mtd_ino; | 137 | mfi->ino = mtd_ino; |
144 | mfi->mtd = mtd; | 138 | mfi->mtd = mtd; |
145 | file->private_data = mfi; | 139 | file->private_data = mfi; |
140 | mutex_unlock(&mtd_mutex); | ||
141 | return 0; | ||
146 | 142 | ||
143 | out2: | ||
144 | iput(mtd_ino); | ||
145 | out1: | ||
146 | put_mtd_device(mtd); | ||
147 | out: | 147 | out: |
148 | mutex_unlock(&mtd_mutex); | 148 | mutex_unlock(&mtd_mutex); |
149 | simple_release_fs(&mnt, &count); | 149 | simple_release_fs(&mnt, &count); |
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/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index e2cdebf40840..61af9bb560ab 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -386,19 +386,11 @@ out: | |||
386 | return count; | 386 | return count; |
387 | } | 387 | } |
388 | 388 | ||
389 | static int default_open(struct inode *inode, struct file *file) | ||
390 | { | ||
391 | if (inode->i_private) | ||
392 | file->private_data = inode->i_private; | ||
393 | |||
394 | return 0; | ||
395 | } | ||
396 | |||
397 | /* File operations for all UBI debugfs files */ | 389 | /* File operations for all UBI debugfs files */ |
398 | static const struct file_operations dfs_fops = { | 390 | static const struct file_operations dfs_fops = { |
399 | .read = dfs_file_read, | 391 | .read = dfs_file_read, |
400 | .write = dfs_file_write, | 392 | .write = dfs_file_write, |
401 | .open = default_open, | 393 | .open = simple_open, |
402 | .llseek = no_llseek, | 394 | .llseek = no_llseek, |
403 | .owner = THIS_MODULE, | 395 | .owner = THIS_MODULE, |
404 | }; | 396 | }; |
diff --git a/drivers/net/arcnet/arc-rimi.c b/drivers/net/arcnet/arc-rimi.c index 25197b698dd6..b8b4c7ba884f 100644 --- a/drivers/net/arcnet/arc-rimi.c +++ b/drivers/net/arcnet/arc-rimi.c | |||
@@ -89,16 +89,16 @@ static int __init arcrimi_probe(struct net_device *dev) | |||
89 | BUGLVL(D_NORMAL) printk(VERSION); | 89 | BUGLVL(D_NORMAL) printk(VERSION); |
90 | BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); | 90 | BUGLVL(D_NORMAL) printk("E-mail me if you actually test the RIM I driver, please!\n"); |
91 | 91 | ||
92 | BUGMSG(D_NORMAL, "Given: node %02Xh, shmem %lXh, irq %d\n", | 92 | BUGLVL(D_NORMAL) printk("Given: node %02Xh, shmem %lXh, irq %d\n", |
93 | dev->dev_addr[0], dev->mem_start, dev->irq); | 93 | dev->dev_addr[0], dev->mem_start, dev->irq); |
94 | 94 | ||
95 | if (dev->mem_start <= 0 || dev->irq <= 0) { | 95 | if (dev->mem_start <= 0 || dev->irq <= 0) { |
96 | BUGMSG(D_NORMAL, "No autoprobe for RIM I; you " | 96 | BUGLVL(D_NORMAL) printk("No autoprobe for RIM I; you " |
97 | "must specify the shmem and irq!\n"); | 97 | "must specify the shmem and irq!\n"); |
98 | return -ENODEV; | 98 | return -ENODEV; |
99 | } | 99 | } |
100 | if (dev->dev_addr[0] == 0) { | 100 | if (dev->dev_addr[0] == 0) { |
101 | BUGMSG(D_NORMAL, "You need to specify your card's station " | 101 | BUGLVL(D_NORMAL) printk("You need to specify your card's station " |
102 | "ID!\n"); | 102 | "ID!\n"); |
103 | return -ENODEV; | 103 | return -ENODEV; |
104 | } | 104 | } |
@@ -109,7 +109,7 @@ static int __init arcrimi_probe(struct net_device *dev) | |||
109 | * will be taken. | 109 | * will be taken. |
110 | */ | 110 | */ |
111 | if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { | 111 | if (!request_mem_region(dev->mem_start, MIRROR_SIZE, "arcnet (90xx)")) { |
112 | BUGMSG(D_NORMAL, "Card memory already allocated\n"); | 112 | BUGLVL(D_NORMAL) printk("Card memory already allocated\n"); |
113 | return -ENODEV; | 113 | return -ENODEV; |
114 | } | 114 | } |
115 | return arcrimi_found(dev); | 115 | return arcrimi_found(dev); |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 0c76186bb9e7..62d2409bb293 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -891,9 +891,15 @@ static void bond_do_fail_over_mac(struct bonding *bond, | |||
891 | 891 | ||
892 | switch (bond->params.fail_over_mac) { | 892 | switch (bond->params.fail_over_mac) { |
893 | case BOND_FOM_ACTIVE: | 893 | case BOND_FOM_ACTIVE: |
894 | if (new_active) | 894 | if (new_active) { |
895 | memcpy(bond->dev->dev_addr, new_active->dev->dev_addr, | 895 | memcpy(bond->dev->dev_addr, new_active->dev->dev_addr, |
896 | new_active->dev->addr_len); | 896 | new_active->dev->addr_len); |
897 | write_unlock_bh(&bond->curr_slave_lock); | ||
898 | read_unlock(&bond->lock); | ||
899 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); | ||
900 | read_lock(&bond->lock); | ||
901 | write_lock_bh(&bond->curr_slave_lock); | ||
902 | } | ||
897 | break; | 903 | break; |
898 | case BOND_FOM_FOLLOW: | 904 | case BOND_FOM_FOLLOW: |
899 | /* | 905 | /* |
@@ -2028,6 +2034,9 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) | |||
2028 | write_unlock_bh(&bond->lock); | 2034 | write_unlock_bh(&bond->lock); |
2029 | unblock_netpoll_tx(); | 2035 | unblock_netpoll_tx(); |
2030 | 2036 | ||
2037 | if (bond->slave_cnt == 0) | ||
2038 | call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev); | ||
2039 | |||
2031 | bond_compute_features(bond); | 2040 | bond_compute_features(bond); |
2032 | if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && | 2041 | if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && |
2033 | (old_features & NETIF_F_VLAN_CHALLENGED)) | 2042 | (old_features & NETIF_F_VLAN_CHALLENGED)) |
@@ -3001,7 +3010,11 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
3001 | trans_start + delta_in_ticks)) || | 3010 | trans_start + delta_in_ticks)) || |
3002 | bond->curr_active_slave != slave) { | 3011 | bond->curr_active_slave != slave) { |
3003 | slave->link = BOND_LINK_UP; | 3012 | slave->link = BOND_LINK_UP; |
3004 | bond->current_arp_slave = NULL; | 3013 | if (bond->current_arp_slave) { |
3014 | bond_set_slave_inactive_flags( | ||
3015 | bond->current_arp_slave); | ||
3016 | bond->current_arp_slave = NULL; | ||
3017 | } | ||
3005 | 3018 | ||
3006 | pr_info("%s: link status definitely up for interface %s.\n", | 3019 | pr_info("%s: link status definitely up for interface %s.\n", |
3007 | bond->dev->name, slave->dev->name); | 3020 | bond->dev->name, slave->dev->name); |
@@ -3695,17 +3708,52 @@ static void bond_set_multicast_list(struct net_device *bond_dev) | |||
3695 | read_unlock(&bond->lock); | 3708 | read_unlock(&bond->lock); |
3696 | } | 3709 | } |
3697 | 3710 | ||
3698 | static int bond_neigh_setup(struct net_device *dev, struct neigh_parms *parms) | 3711 | static int bond_neigh_init(struct neighbour *n) |
3699 | { | 3712 | { |
3700 | struct bonding *bond = netdev_priv(dev); | 3713 | struct bonding *bond = netdev_priv(n->dev); |
3701 | struct slave *slave = bond->first_slave; | 3714 | struct slave *slave = bond->first_slave; |
3715 | const struct net_device_ops *slave_ops; | ||
3716 | struct neigh_parms parms; | ||
3717 | int ret; | ||
3718 | |||
3719 | if (!slave) | ||
3720 | return 0; | ||
3721 | |||
3722 | slave_ops = slave->dev->netdev_ops; | ||
3723 | |||
3724 | if (!slave_ops->ndo_neigh_setup) | ||
3725 | return 0; | ||
3726 | |||
3727 | parms.neigh_setup = NULL; | ||
3728 | parms.neigh_cleanup = NULL; | ||
3729 | ret = slave_ops->ndo_neigh_setup(slave->dev, &parms); | ||
3730 | if (ret) | ||
3731 | return ret; | ||
3732 | |||
3733 | /* | ||
3734 | * Assign slave's neigh_cleanup to neighbour in case cleanup is called | ||
3735 | * after the last slave has been detached. Assumes that all slaves | ||
3736 | * utilize the same neigh_cleanup (true at this writing as only user | ||
3737 | * is ipoib). | ||
3738 | */ | ||
3739 | n->parms->neigh_cleanup = parms.neigh_cleanup; | ||
3740 | |||
3741 | if (!parms.neigh_setup) | ||
3742 | return 0; | ||
3743 | |||
3744 | return parms.neigh_setup(n); | ||
3745 | } | ||
3746 | |||
3747 | /* | ||
3748 | * The bonding ndo_neigh_setup is called at init time beofre any | ||
3749 | * slave exists. So we must declare proxy setup function which will | ||
3750 | * be used at run time to resolve the actual slave neigh param setup. | ||
3751 | */ | ||
3752 | static int bond_neigh_setup(struct net_device *dev, | ||
3753 | struct neigh_parms *parms) | ||
3754 | { | ||
3755 | parms->neigh_setup = bond_neigh_init; | ||
3702 | 3756 | ||
3703 | if (slave) { | ||
3704 | const struct net_device_ops *slave_ops | ||
3705 | = slave->dev->netdev_ops; | ||
3706 | if (slave_ops->ndo_neigh_setup) | ||
3707 | return slave_ops->ndo_neigh_setup(slave->dev, parms); | ||
3708 | } | ||
3709 | return 0; | 3757 | return 0; |
3710 | } | 3758 | } |
3711 | 3759 | ||
diff --git a/drivers/net/caif/caif_hsi.c b/drivers/net/caif/caif_hsi.c index 9a66e2a910ae..9c1c8cd5223f 100644 --- a/drivers/net/caif/caif_hsi.c +++ b/drivers/net/caif/caif_hsi.c | |||
@@ -744,14 +744,14 @@ static void cfhsi_wake_up(struct work_struct *work) | |||
744 | size_t fifo_occupancy = 0; | 744 | size_t fifo_occupancy = 0; |
745 | 745 | ||
746 | /* Wakeup timeout */ | 746 | /* Wakeup timeout */ |
747 | dev_err(&cfhsi->ndev->dev, "%s: Timeout.\n", | 747 | dev_dbg(&cfhsi->ndev->dev, "%s: Timeout.\n", |
748 | __func__); | 748 | __func__); |
749 | 749 | ||
750 | /* Check FIFO to check if modem has sent something. */ | 750 | /* Check FIFO to check if modem has sent something. */ |
751 | WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, | 751 | WARN_ON(cfhsi->dev->cfhsi_fifo_occupancy(cfhsi->dev, |
752 | &fifo_occupancy)); | 752 | &fifo_occupancy)); |
753 | 753 | ||
754 | dev_err(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n", | 754 | dev_dbg(&cfhsi->ndev->dev, "%s: Bytes in FIFO: %u.\n", |
755 | __func__, (unsigned) fifo_occupancy); | 755 | __func__, (unsigned) fifo_occupancy); |
756 | 756 | ||
757 | /* Check if we misssed the interrupt. */ | 757 | /* Check if we misssed the interrupt. */ |
@@ -1210,7 +1210,7 @@ int cfhsi_probe(struct platform_device *pdev) | |||
1210 | 1210 | ||
1211 | static void cfhsi_shutdown(struct cfhsi *cfhsi) | 1211 | static void cfhsi_shutdown(struct cfhsi *cfhsi) |
1212 | { | 1212 | { |
1213 | u8 *tx_buf, *rx_buf; | 1213 | u8 *tx_buf, *rx_buf, *flip_buf; |
1214 | 1214 | ||
1215 | /* Stop TXing */ | 1215 | /* Stop TXing */ |
1216 | netif_tx_stop_all_queues(cfhsi->ndev); | 1216 | netif_tx_stop_all_queues(cfhsi->ndev); |
@@ -1234,7 +1234,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi) | |||
1234 | /* Store bufferes: will be freed later. */ | 1234 | /* Store bufferes: will be freed later. */ |
1235 | tx_buf = cfhsi->tx_buf; | 1235 | tx_buf = cfhsi->tx_buf; |
1236 | rx_buf = cfhsi->rx_buf; | 1236 | rx_buf = cfhsi->rx_buf; |
1237 | 1237 | flip_buf = cfhsi->rx_flip_buf; | |
1238 | /* Flush transmit queues. */ | 1238 | /* Flush transmit queues. */ |
1239 | cfhsi_abort_tx(cfhsi); | 1239 | cfhsi_abort_tx(cfhsi); |
1240 | 1240 | ||
@@ -1247,6 +1247,7 @@ static void cfhsi_shutdown(struct cfhsi *cfhsi) | |||
1247 | /* Free buffers. */ | 1247 | /* Free buffers. */ |
1248 | kfree(tx_buf); | 1248 | kfree(tx_buf); |
1249 | kfree(rx_buf); | 1249 | kfree(rx_buf); |
1250 | kfree(flip_buf); | ||
1250 | } | 1251 | } |
1251 | 1252 | ||
1252 | int cfhsi_remove(struct platform_device *pdev) | 1253 | int cfhsi_remove(struct platform_device *pdev) |
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c index 96391c36fa74..b71ce9bf0afb 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c | |||
@@ -127,12 +127,6 @@ static inline void dev_debugfs_rem(struct cfspi *cfspi) | |||
127 | debugfs_remove(cfspi->dbgfs_dir); | 127 | debugfs_remove(cfspi->dbgfs_dir); |
128 | } | 128 | } |
129 | 129 | ||
130 | static int dbgfs_open(struct inode *inode, struct file *file) | ||
131 | { | ||
132 | file->private_data = inode->i_private; | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static ssize_t dbgfs_state(struct file *file, char __user *user_buf, | 130 | static ssize_t dbgfs_state(struct file *file, char __user *user_buf, |
137 | size_t count, loff_t *ppos) | 131 | size_t count, loff_t *ppos) |
138 | { | 132 | { |
@@ -243,13 +237,13 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf, | |||
243 | } | 237 | } |
244 | 238 | ||
245 | static const struct file_operations dbgfs_state_fops = { | 239 | static const struct file_operations dbgfs_state_fops = { |
246 | .open = dbgfs_open, | 240 | .open = simple_open, |
247 | .read = dbgfs_state, | 241 | .read = dbgfs_state, |
248 | .owner = THIS_MODULE | 242 | .owner = THIS_MODULE |
249 | }; | 243 | }; |
250 | 244 | ||
251 | static const struct file_operations dbgfs_frame_fops = { | 245 | static const struct file_operations dbgfs_frame_fops = { |
252 | .open = dbgfs_open, | 246 | .open = simple_open, |
253 | .read = dbgfs_frame, | 247 | .read = dbgfs_frame, |
254 | .owner = THIS_MODULE | 248 | .owner = THIS_MODULE |
255 | }; | 249 | }; |
diff --git a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c index 5234586dff15..629c4ba5d49d 100644 --- a/drivers/net/can/usb/peak_usb/pcan_usb_pro.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_pro.c | |||
@@ -875,6 +875,7 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
875 | PCAN_USBPRO_INFO_FW, | 875 | PCAN_USBPRO_INFO_FW, |
876 | &fi, sizeof(fi)); | 876 | &fi, sizeof(fi)); |
877 | if (err) { | 877 | if (err) { |
878 | kfree(usb_if); | ||
878 | dev_err(dev->netdev->dev.parent, | 879 | dev_err(dev->netdev->dev.parent, |
879 | "unable to read %s firmware info (err %d)\n", | 880 | "unable to read %s firmware info (err %d)\n", |
880 | pcan_usb_pro.name, err); | 881 | pcan_usb_pro.name, err); |
@@ -885,6 +886,7 @@ static int pcan_usb_pro_init(struct peak_usb_device *dev) | |||
885 | PCAN_USBPRO_INFO_BL, | 886 | PCAN_USBPRO_INFO_BL, |
886 | &bi, sizeof(bi)); | 887 | &bi, sizeof(bi)); |
887 | if (err) { | 888 | if (err) { |
889 | kfree(usb_if); | ||
888 | dev_err(dev->netdev->dev.parent, | 890 | dev_err(dev->netdev->dev.parent, |
889 | "unable to read %s bootloader info (err %d)\n", | 891 | "unable to read %s bootloader info (err %d)\n", |
890 | pcan_usb_pro.name, err); | 892 | pcan_usb_pro.name, err); |
diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c index d5c6d92f1ee7..442d91a2747b 100644 --- a/drivers/net/dummy.c +++ b/drivers/net/dummy.c | |||
@@ -107,14 +107,14 @@ static int dummy_dev_init(struct net_device *dev) | |||
107 | return 0; | 107 | return 0; |
108 | } | 108 | } |
109 | 109 | ||
110 | static void dummy_dev_free(struct net_device *dev) | 110 | static void dummy_dev_uninit(struct net_device *dev) |
111 | { | 111 | { |
112 | free_percpu(dev->dstats); | 112 | free_percpu(dev->dstats); |
113 | free_netdev(dev); | ||
114 | } | 113 | } |
115 | 114 | ||
116 | static const struct net_device_ops dummy_netdev_ops = { | 115 | static const struct net_device_ops dummy_netdev_ops = { |
117 | .ndo_init = dummy_dev_init, | 116 | .ndo_init = dummy_dev_init, |
117 | .ndo_uninit = dummy_dev_uninit, | ||
118 | .ndo_start_xmit = dummy_xmit, | 118 | .ndo_start_xmit = dummy_xmit, |
119 | .ndo_validate_addr = eth_validate_addr, | 119 | .ndo_validate_addr = eth_validate_addr, |
120 | .ndo_set_rx_mode = set_multicast_list, | 120 | .ndo_set_rx_mode = set_multicast_list, |
@@ -128,7 +128,7 @@ static void dummy_setup(struct net_device *dev) | |||
128 | 128 | ||
129 | /* Initialize the device structure. */ | 129 | /* Initialize the device structure. */ |
130 | dev->netdev_ops = &dummy_netdev_ops; | 130 | dev->netdev_ops = &dummy_netdev_ops; |
131 | dev->destructor = dummy_dev_free; | 131 | dev->destructor = free_netdev; |
132 | 132 | ||
133 | /* Fill in device structure with ethernet-generic values. */ | 133 | /* Fill in device structure with ethernet-generic values. */ |
134 | dev->tx_queue_len = 0; | 134 | dev->tx_queue_len = 0; |
diff --git a/drivers/net/eql.c b/drivers/net/eql.c index a59cf961a436..f219d38acf58 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c | |||
@@ -125,6 +125,7 @@ | |||
125 | #include <linux/if.h> | 125 | #include <linux/if.h> |
126 | #include <linux/if_arp.h> | 126 | #include <linux/if_arp.h> |
127 | #include <linux/if_eql.h> | 127 | #include <linux/if_eql.h> |
128 | #include <linux/pkt_sched.h> | ||
128 | 129 | ||
129 | #include <asm/uaccess.h> | 130 | #include <asm/uaccess.h> |
130 | 131 | ||
@@ -143,7 +144,7 @@ static void eql_timer(unsigned long param) | |||
143 | equalizer_t *eql = (equalizer_t *) param; | 144 | equalizer_t *eql = (equalizer_t *) param; |
144 | struct list_head *this, *tmp, *head; | 145 | struct list_head *this, *tmp, *head; |
145 | 146 | ||
146 | spin_lock_bh(&eql->queue.lock); | 147 | spin_lock(&eql->queue.lock); |
147 | head = &eql->queue.all_slaves; | 148 | head = &eql->queue.all_slaves; |
148 | list_for_each_safe(this, tmp, head) { | 149 | list_for_each_safe(this, tmp, head) { |
149 | slave_t *slave = list_entry(this, slave_t, list); | 150 | slave_t *slave = list_entry(this, slave_t, list); |
@@ -157,7 +158,7 @@ static void eql_timer(unsigned long param) | |||
157 | } | 158 | } |
158 | 159 | ||
159 | } | 160 | } |
160 | spin_unlock_bh(&eql->queue.lock); | 161 | spin_unlock(&eql->queue.lock); |
161 | 162 | ||
162 | eql->timer.expires = jiffies + EQL_DEFAULT_RESCHED_IVAL; | 163 | eql->timer.expires = jiffies + EQL_DEFAULT_RESCHED_IVAL; |
163 | add_timer(&eql->timer); | 164 | add_timer(&eql->timer); |
@@ -341,7 +342,7 @@ static netdev_tx_t eql_slave_xmit(struct sk_buff *skb, struct net_device *dev) | |||
341 | struct net_device *slave_dev = slave->dev; | 342 | struct net_device *slave_dev = slave->dev; |
342 | 343 | ||
343 | skb->dev = slave_dev; | 344 | skb->dev = slave_dev; |
344 | skb->priority = 1; | 345 | skb->priority = TC_PRIO_FILLER; |
345 | slave->bytes_queued += skb->len; | 346 | slave->bytes_queued += skb->len; |
346 | dev_queue_xmit(skb); | 347 | dev_queue_xmit(skb); |
347 | dev->stats.tx_packets++; | 348 | dev->stats.tx_packets++; |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index 40ac41436549..c926857e8205 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | |||
@@ -2476,7 +2476,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
2476 | "pcie phy link down %x\n", status); | 2476 | "pcie phy link down %x\n", status); |
2477 | if (netif_running(adapter->netdev)) { /* reset MAC */ | 2477 | if (netif_running(adapter->netdev)) { /* reset MAC */ |
2478 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | 2478 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); |
2479 | schedule_work(&adapter->pcie_dma_to_rst_task); | 2479 | schedule_work(&adapter->reset_dev_task); |
2480 | return IRQ_HANDLED; | 2480 | return IRQ_HANDLED; |
2481 | } | 2481 | } |
2482 | } | 2482 | } |
@@ -2488,7 +2488,7 @@ static irqreturn_t atl1_intr(int irq, void *data) | |||
2488 | "pcie DMA r/w error (status = 0x%x)\n", | 2488 | "pcie DMA r/w error (status = 0x%x)\n", |
2489 | status); | 2489 | status); |
2490 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); | 2490 | iowrite32(0, adapter->hw.hw_addr + REG_IMR); |
2491 | schedule_work(&adapter->pcie_dma_to_rst_task); | 2491 | schedule_work(&adapter->reset_dev_task); |
2492 | return IRQ_HANDLED; | 2492 | return IRQ_HANDLED; |
2493 | } | 2493 | } |
2494 | 2494 | ||
@@ -2633,10 +2633,10 @@ static void atl1_down(struct atl1_adapter *adapter) | |||
2633 | atl1_clean_rx_ring(adapter); | 2633 | atl1_clean_rx_ring(adapter); |
2634 | } | 2634 | } |
2635 | 2635 | ||
2636 | static void atl1_tx_timeout_task(struct work_struct *work) | 2636 | static void atl1_reset_dev_task(struct work_struct *work) |
2637 | { | 2637 | { |
2638 | struct atl1_adapter *adapter = | 2638 | struct atl1_adapter *adapter = |
2639 | container_of(work, struct atl1_adapter, tx_timeout_task); | 2639 | container_of(work, struct atl1_adapter, reset_dev_task); |
2640 | struct net_device *netdev = adapter->netdev; | 2640 | struct net_device *netdev = adapter->netdev; |
2641 | 2641 | ||
2642 | netif_device_detach(netdev); | 2642 | netif_device_detach(netdev); |
@@ -3038,12 +3038,10 @@ static int __devinit atl1_probe(struct pci_dev *pdev, | |||
3038 | (unsigned long)adapter); | 3038 | (unsigned long)adapter); |
3039 | adapter->phy_timer_pending = false; | 3039 | adapter->phy_timer_pending = false; |
3040 | 3040 | ||
3041 | INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task); | 3041 | INIT_WORK(&adapter->reset_dev_task, atl1_reset_dev_task); |
3042 | 3042 | ||
3043 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); | 3043 | INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task); |
3044 | 3044 | ||
3045 | INIT_WORK(&adapter->pcie_dma_to_rst_task, atl1_tx_timeout_task); | ||
3046 | |||
3047 | err = register_netdev(netdev); | 3045 | err = register_netdev(netdev); |
3048 | if (err) | 3046 | if (err) |
3049 | goto err_common; | 3047 | goto err_common; |
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h index 109d6da8be97..e04bf4d71e46 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.h +++ b/drivers/net/ethernet/atheros/atlx/atl1.h | |||
@@ -758,9 +758,8 @@ struct atl1_adapter { | |||
758 | u16 link_speed; | 758 | u16 link_speed; |
759 | u16 link_duplex; | 759 | u16 link_duplex; |
760 | spinlock_t lock; | 760 | spinlock_t lock; |
761 | struct work_struct tx_timeout_task; | 761 | struct work_struct reset_dev_task; |
762 | struct work_struct link_chg_task; | 762 | struct work_struct link_chg_task; |
763 | struct work_struct pcie_dma_to_rst_task; | ||
764 | 763 | ||
765 | struct timer_list phy_config_timer; | 764 | struct timer_list phy_config_timer; |
766 | bool phy_timer_pending; | 765 | bool phy_timer_pending; |
diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c index 3cd8837236dc..c9e9dc57986c 100644 --- a/drivers/net/ethernet/atheros/atlx/atlx.c +++ b/drivers/net/ethernet/atheros/atlx/atlx.c | |||
@@ -194,7 +194,7 @@ static void atlx_tx_timeout(struct net_device *netdev) | |||
194 | { | 194 | { |
195 | struct atlx_adapter *adapter = netdev_priv(netdev); | 195 | struct atlx_adapter *adapter = netdev_priv(netdev); |
196 | /* Do the reset outside of interrupt context */ | 196 | /* Do the reset outside of interrupt context */ |
197 | schedule_work(&adapter->tx_timeout_task); | 197 | schedule_work(&adapter->reset_dev_task); |
198 | } | 198 | } |
199 | 199 | ||
200 | /* | 200 | /* |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h index e37161f19250..2c9ee552dffc 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | |||
@@ -1173,6 +1173,13 @@ enum { | |||
1173 | }; | 1173 | }; |
1174 | 1174 | ||
1175 | 1175 | ||
1176 | struct bnx2x_prev_path_list { | ||
1177 | u8 bus; | ||
1178 | u8 slot; | ||
1179 | u8 path; | ||
1180 | struct list_head list; | ||
1181 | }; | ||
1182 | |||
1176 | struct bnx2x { | 1183 | struct bnx2x { |
1177 | /* Fields used in the tx and intr/napi performance paths | 1184 | /* Fields used in the tx and intr/napi performance paths |
1178 | * are grouped together in the beginning of the structure | 1185 | * are grouped together in the beginning of the structure |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index f1f3ca65667a..4b054812713a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -1721,6 +1721,29 @@ static void bnx2x_squeeze_objects(struct bnx2x *bp) | |||
1721 | } while (0) | 1721 | } while (0) |
1722 | #endif | 1722 | #endif |
1723 | 1723 | ||
1724 | bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err) | ||
1725 | { | ||
1726 | /* build FW version dword */ | ||
1727 | u32 my_fw = (BCM_5710_FW_MAJOR_VERSION) + | ||
1728 | (BCM_5710_FW_MINOR_VERSION << 8) + | ||
1729 | (BCM_5710_FW_REVISION_VERSION << 16) + | ||
1730 | (BCM_5710_FW_ENGINEERING_VERSION << 24); | ||
1731 | |||
1732 | /* read loaded FW from chip */ | ||
1733 | u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM); | ||
1734 | |||
1735 | DP(NETIF_MSG_IFUP, "loaded fw %x, my fw %x\n", loaded_fw, my_fw); | ||
1736 | |||
1737 | if (loaded_fw != my_fw) { | ||
1738 | if (is_err) | ||
1739 | BNX2X_ERR("bnx2x with FW %x was already loaded, which mismatches my %x FW. aborting\n", | ||
1740 | loaded_fw, my_fw); | ||
1741 | return false; | ||
1742 | } | ||
1743 | |||
1744 | return true; | ||
1745 | } | ||
1746 | |||
1724 | /* must be called with rtnl_lock */ | 1747 | /* must be called with rtnl_lock */ |
1725 | int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | 1748 | int bnx2x_nic_load(struct bnx2x *bp, int load_mode) |
1726 | { | 1749 | { |
@@ -1815,23 +1838,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1815 | } | 1838 | } |
1816 | if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && | 1839 | if (load_code != FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && |
1817 | load_code != FW_MSG_CODE_DRV_LOAD_COMMON) { | 1840 | load_code != FW_MSG_CODE_DRV_LOAD_COMMON) { |
1818 | /* build FW version dword */ | ||
1819 | u32 my_fw = (BCM_5710_FW_MAJOR_VERSION) + | ||
1820 | (BCM_5710_FW_MINOR_VERSION << 8) + | ||
1821 | (BCM_5710_FW_REVISION_VERSION << 16) + | ||
1822 | (BCM_5710_FW_ENGINEERING_VERSION << 24); | ||
1823 | |||
1824 | /* read loaded FW from chip */ | ||
1825 | u32 loaded_fw = REG_RD(bp, XSEM_REG_PRAM); | ||
1826 | |||
1827 | DP(BNX2X_MSG_SP, "loaded fw %x, my fw %x", | ||
1828 | loaded_fw, my_fw); | ||
1829 | |||
1830 | /* abort nic load if version mismatch */ | 1841 | /* abort nic load if version mismatch */ |
1831 | if (my_fw != loaded_fw) { | 1842 | if (!bnx2x_test_firmware_version(bp, true)) { |
1832 | BNX2X_ERR("bnx2x with FW %x already loaded, " | ||
1833 | "which mismatches my %x FW. aborting", | ||
1834 | loaded_fw, my_fw); | ||
1835 | rc = -EBUSY; | 1843 | rc = -EBUSY; |
1836 | LOAD_ERROR_EXIT(bp, load_error2); | 1844 | LOAD_ERROR_EXIT(bp, load_error2); |
1837 | } | 1845 | } |
@@ -1866,7 +1874,6 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1866 | * bnx2x_periodic_task(). | 1874 | * bnx2x_periodic_task(). |
1867 | */ | 1875 | */ |
1868 | smp_mb(); | 1876 | smp_mb(); |
1869 | queue_delayed_work(bnx2x_wq, &bp->period_task, 0); | ||
1870 | } else | 1877 | } else |
1871 | bp->port.pmf = 0; | 1878 | bp->port.pmf = 0; |
1872 | 1879 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h index 8b163388659a..5c27454d2ec2 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h | |||
@@ -431,6 +431,9 @@ void bnx2x_panic_dump(struct bnx2x *bp); | |||
431 | 431 | ||
432 | void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl); | 432 | void bnx2x_fw_dump_lvl(struct bnx2x *bp, const char *lvl); |
433 | 433 | ||
434 | /* validate currect fw is loaded */ | ||
435 | bool bnx2x_test_firmware_version(struct bnx2x *bp, bool is_err); | ||
436 | |||
434 | /* dev_close main block */ | 437 | /* dev_close main block */ |
435 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); | 438 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); |
436 | 439 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h index cd6dfa9eaa3a..b9b263323436 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_fw_defs.h | |||
@@ -25,31 +25,31 @@ | |||
25 | (IRO[149].base + ((funcId) * IRO[149].m1)) | 25 | (IRO[149].base + ((funcId) * IRO[149].m1)) |
26 | #define CSTORM_IGU_MODE_OFFSET (IRO[157].base) | 26 | #define CSTORM_IGU_MODE_OFFSET (IRO[157].base) |
27 | #define CSTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ | 27 | #define CSTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ |
28 | (IRO[315].base + ((pfId) * IRO[315].m1)) | ||
29 | #define CSTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \ | ||
30 | (IRO[316].base + ((pfId) * IRO[316].m1)) | 28 | (IRO[316].base + ((pfId) * IRO[316].m1)) |
29 | #define CSTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \ | ||
30 | (IRO[317].base + ((pfId) * IRO[317].m1)) | ||
31 | #define CSTORM_ISCSI_EQ_CONS_OFFSET(pfId, iscsiEqId) \ | 31 | #define CSTORM_ISCSI_EQ_CONS_OFFSET(pfId, iscsiEqId) \ |
32 | (IRO[308].base + ((pfId) * IRO[308].m1) + ((iscsiEqId) * IRO[308].m2)) | 32 | (IRO[309].base + ((pfId) * IRO[309].m1) + ((iscsiEqId) * IRO[309].m2)) |
33 | #define CSTORM_ISCSI_EQ_NEXT_EQE_ADDR_OFFSET(pfId, iscsiEqId) \ | 33 | #define CSTORM_ISCSI_EQ_NEXT_EQE_ADDR_OFFSET(pfId, iscsiEqId) \ |
34 | (IRO[310].base + ((pfId) * IRO[310].m1) + ((iscsiEqId) * IRO[310].m2)) | 34 | (IRO[311].base + ((pfId) * IRO[311].m1) + ((iscsiEqId) * IRO[311].m2)) |
35 | #define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_OFFSET(pfId, iscsiEqId) \ | 35 | #define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_OFFSET(pfId, iscsiEqId) \ |
36 | (IRO[309].base + ((pfId) * IRO[309].m1) + ((iscsiEqId) * IRO[309].m2)) | 36 | (IRO[310].base + ((pfId) * IRO[310].m1) + ((iscsiEqId) * IRO[310].m2)) |
37 | #define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_VALID_OFFSET(pfId, iscsiEqId) \ | 37 | #define CSTORM_ISCSI_EQ_NEXT_PAGE_ADDR_VALID_OFFSET(pfId, iscsiEqId) \ |
38 | (IRO[311].base + ((pfId) * IRO[311].m1) + ((iscsiEqId) * IRO[311].m2)) | 38 | (IRO[312].base + ((pfId) * IRO[312].m1) + ((iscsiEqId) * IRO[312].m2)) |
39 | #define CSTORM_ISCSI_EQ_PROD_OFFSET(pfId, iscsiEqId) \ | 39 | #define CSTORM_ISCSI_EQ_PROD_OFFSET(pfId, iscsiEqId) \ |
40 | (IRO[307].base + ((pfId) * IRO[307].m1) + ((iscsiEqId) * IRO[307].m2)) | 40 | (IRO[308].base + ((pfId) * IRO[308].m1) + ((iscsiEqId) * IRO[308].m2)) |
41 | #define CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfId, iscsiEqId) \ | 41 | #define CSTORM_ISCSI_EQ_SB_INDEX_OFFSET(pfId, iscsiEqId) \ |
42 | (IRO[313].base + ((pfId) * IRO[313].m1) + ((iscsiEqId) * IRO[313].m2)) | 42 | (IRO[314].base + ((pfId) * IRO[314].m1) + ((iscsiEqId) * IRO[314].m2)) |
43 | #define CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfId, iscsiEqId) \ | 43 | #define CSTORM_ISCSI_EQ_SB_NUM_OFFSET(pfId, iscsiEqId) \ |
44 | (IRO[312].base + ((pfId) * IRO[312].m1) + ((iscsiEqId) * IRO[312].m2)) | 44 | (IRO[313].base + ((pfId) * IRO[313].m1) + ((iscsiEqId) * IRO[313].m2)) |
45 | #define CSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ | 45 | #define CSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ |
46 | (IRO[314].base + ((pfId) * IRO[314].m1)) | 46 | (IRO[315].base + ((pfId) * IRO[315].m1)) |
47 | #define CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ | 47 | #define CSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ |
48 | (IRO[306].base + ((pfId) * IRO[306].m1)) | 48 | (IRO[307].base + ((pfId) * IRO[307].m1)) |
49 | #define CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ | 49 | #define CSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ |
50 | (IRO[305].base + ((pfId) * IRO[305].m1)) | 50 | (IRO[306].base + ((pfId) * IRO[306].m1)) |
51 | #define CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ | 51 | #define CSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ |
52 | (IRO[304].base + ((pfId) * IRO[304].m1)) | 52 | (IRO[305].base + ((pfId) * IRO[305].m1)) |
53 | #define CSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ | 53 | #define CSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ |
54 | (IRO[151].base + ((funcId) * IRO[151].m1)) | 54 | (IRO[151].base + ((funcId) * IRO[151].m1)) |
55 | #define CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(pfId) \ | 55 | #define CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(pfId) \ |
@@ -96,37 +96,37 @@ | |||
96 | #define TSTORM_FUNC_EN_OFFSET(funcId) \ | 96 | #define TSTORM_FUNC_EN_OFFSET(funcId) \ |
97 | (IRO[103].base + ((funcId) * IRO[103].m1)) | 97 | (IRO[103].base + ((funcId) * IRO[103].m1)) |
98 | #define TSTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ | 98 | #define TSTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ |
99 | (IRO[271].base + ((pfId) * IRO[271].m1)) | ||
100 | #define TSTORM_ISCSI_L2_ISCSI_OOO_CID_TABLE_OFFSET(pfId) \ | ||
101 | (IRO[272].base + ((pfId) * IRO[272].m1)) | 99 | (IRO[272].base + ((pfId) * IRO[272].m1)) |
102 | #define TSTORM_ISCSI_L2_ISCSI_OOO_CLIENT_ID_TABLE_OFFSET(pfId) \ | 100 | #define TSTORM_ISCSI_L2_ISCSI_OOO_CID_TABLE_OFFSET(pfId) \ |
103 | (IRO[273].base + ((pfId) * IRO[273].m1)) | 101 | (IRO[273].base + ((pfId) * IRO[273].m1)) |
104 | #define TSTORM_ISCSI_L2_ISCSI_OOO_PROD_OFFSET(pfId) \ | 102 | #define TSTORM_ISCSI_L2_ISCSI_OOO_CLIENT_ID_TABLE_OFFSET(pfId) \ |
105 | (IRO[274].base + ((pfId) * IRO[274].m1)) | 103 | (IRO[274].base + ((pfId) * IRO[274].m1)) |
104 | #define TSTORM_ISCSI_L2_ISCSI_OOO_PROD_OFFSET(pfId) \ | ||
105 | (IRO[275].base + ((pfId) * IRO[275].m1)) | ||
106 | #define TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ | 106 | #define TSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ |
107 | (IRO[270].base + ((pfId) * IRO[270].m1)) | 107 | (IRO[271].base + ((pfId) * IRO[271].m1)) |
108 | #define TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ | 108 | #define TSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ |
109 | (IRO[269].base + ((pfId) * IRO[269].m1)) | 109 | (IRO[270].base + ((pfId) * IRO[270].m1)) |
110 | #define TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ | 110 | #define TSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ |
111 | (IRO[268].base + ((pfId) * IRO[268].m1)) | 111 | (IRO[269].base + ((pfId) * IRO[269].m1)) |
112 | #define TSTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ | 112 | #define TSTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ |
113 | (IRO[267].base + ((pfId) * IRO[267].m1)) | 113 | (IRO[268].base + ((pfId) * IRO[268].m1)) |
114 | #define TSTORM_ISCSI_TCP_LOCAL_ADV_WND_OFFSET(pfId) \ | 114 | #define TSTORM_ISCSI_TCP_LOCAL_ADV_WND_OFFSET(pfId) \ |
115 | (IRO[276].base + ((pfId) * IRO[276].m1)) | 115 | (IRO[277].base + ((pfId) * IRO[277].m1)) |
116 | #define TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ | 116 | #define TSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ |
117 | (IRO[263].base + ((pfId) * IRO[263].m1)) | ||
118 | #define TSTORM_ISCSI_TCP_VARS_LSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ | ||
119 | (IRO[264].base + ((pfId) * IRO[264].m1)) | 117 | (IRO[264].base + ((pfId) * IRO[264].m1)) |
120 | #define TSTORM_ISCSI_TCP_VARS_MID_LOCAL_MAC_ADDR_OFFSET(pfId) \ | 118 | #define TSTORM_ISCSI_TCP_VARS_LSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ |
121 | (IRO[265].base + ((pfId) * IRO[265].m1)) | 119 | (IRO[265].base + ((pfId) * IRO[265].m1)) |
122 | #define TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ | 120 | #define TSTORM_ISCSI_TCP_VARS_MID_LOCAL_MAC_ADDR_OFFSET(pfId) \ |
123 | (IRO[266].base + ((pfId) * IRO[266].m1)) | 121 | (IRO[266].base + ((pfId) * IRO[266].m1)) |
122 | #define TSTORM_ISCSI_TCP_VARS_MSB_LOCAL_MAC_ADDR_OFFSET(pfId) \ | ||
123 | (IRO[267].base + ((pfId) * IRO[267].m1)) | ||
124 | #define TSTORM_MAC_FILTER_CONFIG_OFFSET(pfId) \ | 124 | #define TSTORM_MAC_FILTER_CONFIG_OFFSET(pfId) \ |
125 | (IRO[202].base + ((pfId) * IRO[202].m1)) | 125 | (IRO[202].base + ((pfId) * IRO[202].m1)) |
126 | #define TSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ | 126 | #define TSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ |
127 | (IRO[105].base + ((funcId) * IRO[105].m1)) | 127 | (IRO[105].base + ((funcId) * IRO[105].m1)) |
128 | #define TSTORM_TCP_MAX_CWND_OFFSET(pfId) \ | 128 | #define TSTORM_TCP_MAX_CWND_OFFSET(pfId) \ |
129 | (IRO[216].base + ((pfId) * IRO[216].m1)) | 129 | (IRO[217].base + ((pfId) * IRO[217].m1)) |
130 | #define TSTORM_VF_TO_PF_OFFSET(funcId) \ | 130 | #define TSTORM_VF_TO_PF_OFFSET(funcId) \ |
131 | (IRO[104].base + ((funcId) * IRO[104].m1)) | 131 | (IRO[104].base + ((funcId) * IRO[104].m1)) |
132 | #define USTORM_AGG_DATA_OFFSET (IRO[206].base) | 132 | #define USTORM_AGG_DATA_OFFSET (IRO[206].base) |
@@ -140,29 +140,29 @@ | |||
140 | #define USTORM_ETH_PAUSE_ENABLED_OFFSET(portId) \ | 140 | #define USTORM_ETH_PAUSE_ENABLED_OFFSET(portId) \ |
141 | (IRO[183].base + ((portId) * IRO[183].m1)) | 141 | (IRO[183].base + ((portId) * IRO[183].m1)) |
142 | #define USTORM_FCOE_EQ_PROD_OFFSET(pfId) \ | 142 | #define USTORM_FCOE_EQ_PROD_OFFSET(pfId) \ |
143 | (IRO[317].base + ((pfId) * IRO[317].m1)) | 143 | (IRO[318].base + ((pfId) * IRO[318].m1)) |
144 | #define USTORM_FUNC_EN_OFFSET(funcId) \ | 144 | #define USTORM_FUNC_EN_OFFSET(funcId) \ |
145 | (IRO[178].base + ((funcId) * IRO[178].m1)) | 145 | (IRO[178].base + ((funcId) * IRO[178].m1)) |
146 | #define USTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ | 146 | #define USTORM_ISCSI_CQ_SIZE_OFFSET(pfId) \ |
147 | (IRO[281].base + ((pfId) * IRO[281].m1)) | ||
148 | #define USTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \ | ||
149 | (IRO[282].base + ((pfId) * IRO[282].m1)) | 147 | (IRO[282].base + ((pfId) * IRO[282].m1)) |
148 | #define USTORM_ISCSI_CQ_SQN_SIZE_OFFSET(pfId) \ | ||
149 | (IRO[283].base + ((pfId) * IRO[283].m1)) | ||
150 | #define USTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ | 150 | #define USTORM_ISCSI_ERROR_BITMAP_OFFSET(pfId) \ |
151 | (IRO[286].base + ((pfId) * IRO[286].m1)) | 151 | (IRO[287].base + ((pfId) * IRO[287].m1)) |
152 | #define USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfId) \ | 152 | #define USTORM_ISCSI_GLOBAL_BUF_PHYS_ADDR_OFFSET(pfId) \ |
153 | (IRO[283].base + ((pfId) * IRO[283].m1)) | 153 | (IRO[284].base + ((pfId) * IRO[284].m1)) |
154 | #define USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ | 154 | #define USTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ |
155 | (IRO[279].base + ((pfId) * IRO[279].m1)) | 155 | (IRO[280].base + ((pfId) * IRO[280].m1)) |
156 | #define USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ | 156 | #define USTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ |
157 | (IRO[278].base + ((pfId) * IRO[278].m1)) | 157 | (IRO[279].base + ((pfId) * IRO[279].m1)) |
158 | #define USTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ | 158 | #define USTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ |
159 | (IRO[277].base + ((pfId) * IRO[277].m1)) | 159 | (IRO[278].base + ((pfId) * IRO[278].m1)) |
160 | #define USTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ | 160 | #define USTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ |
161 | (IRO[280].base + ((pfId) * IRO[280].m1)) | 161 | (IRO[281].base + ((pfId) * IRO[281].m1)) |
162 | #define USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfId) \ | 162 | #define USTORM_ISCSI_RQ_BUFFER_SIZE_OFFSET(pfId) \ |
163 | (IRO[284].base + ((pfId) * IRO[284].m1)) | ||
164 | #define USTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ | ||
165 | (IRO[285].base + ((pfId) * IRO[285].m1)) | 163 | (IRO[285].base + ((pfId) * IRO[285].m1)) |
164 | #define USTORM_ISCSI_RQ_SIZE_OFFSET(pfId) \ | ||
165 | (IRO[286].base + ((pfId) * IRO[286].m1)) | ||
166 | #define USTORM_MEM_WORKAROUND_ADDRESS_OFFSET(pfId) \ | 166 | #define USTORM_MEM_WORKAROUND_ADDRESS_OFFSET(pfId) \ |
167 | (IRO[182].base + ((pfId) * IRO[182].m1)) | 167 | (IRO[182].base + ((pfId) * IRO[182].m1)) |
168 | #define USTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ | 168 | #define USTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ |
@@ -188,39 +188,39 @@ | |||
188 | #define XSTORM_FUNC_EN_OFFSET(funcId) \ | 188 | #define XSTORM_FUNC_EN_OFFSET(funcId) \ |
189 | (IRO[47].base + ((funcId) * IRO[47].m1)) | 189 | (IRO[47].base + ((funcId) * IRO[47].m1)) |
190 | #define XSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ | 190 | #define XSTORM_ISCSI_HQ_SIZE_OFFSET(pfId) \ |
191 | (IRO[294].base + ((pfId) * IRO[294].m1)) | 191 | (IRO[295].base + ((pfId) * IRO[295].m1)) |
192 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR0_OFFSET(pfId) \ | 192 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR0_OFFSET(pfId) \ |
193 | (IRO[297].base + ((pfId) * IRO[297].m1)) | ||
194 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR1_OFFSET(pfId) \ | ||
195 | (IRO[298].base + ((pfId) * IRO[298].m1)) | 193 | (IRO[298].base + ((pfId) * IRO[298].m1)) |
196 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR2_OFFSET(pfId) \ | 194 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR1_OFFSET(pfId) \ |
197 | (IRO[299].base + ((pfId) * IRO[299].m1)) | 195 | (IRO[299].base + ((pfId) * IRO[299].m1)) |
198 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR3_OFFSET(pfId) \ | 196 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR2_OFFSET(pfId) \ |
199 | (IRO[300].base + ((pfId) * IRO[300].m1)) | 197 | (IRO[300].base + ((pfId) * IRO[300].m1)) |
200 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR4_OFFSET(pfId) \ | 198 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR3_OFFSET(pfId) \ |
201 | (IRO[301].base + ((pfId) * IRO[301].m1)) | 199 | (IRO[301].base + ((pfId) * IRO[301].m1)) |
202 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR5_OFFSET(pfId) \ | 200 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR4_OFFSET(pfId) \ |
203 | (IRO[302].base + ((pfId) * IRO[302].m1)) | 201 | (IRO[302].base + ((pfId) * IRO[302].m1)) |
204 | #define XSTORM_ISCSI_LOCAL_VLAN_OFFSET(pfId) \ | 202 | #define XSTORM_ISCSI_LOCAL_MAC_ADDR5_OFFSET(pfId) \ |
205 | (IRO[303].base + ((pfId) * IRO[303].m1)) | 203 | (IRO[303].base + ((pfId) * IRO[303].m1)) |
204 | #define XSTORM_ISCSI_LOCAL_VLAN_OFFSET(pfId) \ | ||
205 | (IRO[304].base + ((pfId) * IRO[304].m1)) | ||
206 | #define XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ | 206 | #define XSTORM_ISCSI_NUM_OF_TASKS_OFFSET(pfId) \ |
207 | (IRO[293].base + ((pfId) * IRO[293].m1)) | 207 | (IRO[294].base + ((pfId) * IRO[294].m1)) |
208 | #define XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ | 208 | #define XSTORM_ISCSI_PAGE_SIZE_LOG_OFFSET(pfId) \ |
209 | (IRO[292].base + ((pfId) * IRO[292].m1)) | 209 | (IRO[293].base + ((pfId) * IRO[293].m1)) |
210 | #define XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ | 210 | #define XSTORM_ISCSI_PAGE_SIZE_OFFSET(pfId) \ |
211 | (IRO[291].base + ((pfId) * IRO[291].m1)) | 211 | (IRO[292].base + ((pfId) * IRO[292].m1)) |
212 | #define XSTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ | 212 | #define XSTORM_ISCSI_R2TQ_SIZE_OFFSET(pfId) \ |
213 | (IRO[296].base + ((pfId) * IRO[296].m1)) | 213 | (IRO[297].base + ((pfId) * IRO[297].m1)) |
214 | #define XSTORM_ISCSI_SQ_SIZE_OFFSET(pfId) \ | 214 | #define XSTORM_ISCSI_SQ_SIZE_OFFSET(pfId) \ |
215 | (IRO[295].base + ((pfId) * IRO[295].m1)) | 215 | (IRO[296].base + ((pfId) * IRO[296].m1)) |
216 | #define XSTORM_ISCSI_TCP_VARS_ADV_WND_SCL_OFFSET(pfId) \ | 216 | #define XSTORM_ISCSI_TCP_VARS_ADV_WND_SCL_OFFSET(pfId) \ |
217 | (IRO[290].base + ((pfId) * IRO[290].m1)) | 217 | (IRO[291].base + ((pfId) * IRO[291].m1)) |
218 | #define XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ | 218 | #define XSTORM_ISCSI_TCP_VARS_FLAGS_OFFSET(pfId) \ |
219 | (IRO[289].base + ((pfId) * IRO[289].m1)) | 219 | (IRO[290].base + ((pfId) * IRO[290].m1)) |
220 | #define XSTORM_ISCSI_TCP_VARS_TOS_OFFSET(pfId) \ | 220 | #define XSTORM_ISCSI_TCP_VARS_TOS_OFFSET(pfId) \ |
221 | (IRO[288].base + ((pfId) * IRO[288].m1)) | 221 | (IRO[289].base + ((pfId) * IRO[289].m1)) |
222 | #define XSTORM_ISCSI_TCP_VARS_TTL_OFFSET(pfId) \ | 222 | #define XSTORM_ISCSI_TCP_VARS_TTL_OFFSET(pfId) \ |
223 | (IRO[287].base + ((pfId) * IRO[287].m1)) | 223 | (IRO[288].base + ((pfId) * IRO[288].m1)) |
224 | #define XSTORM_RATE_SHAPING_PER_VN_VARS_OFFSET(pfId) \ | 224 | #define XSTORM_RATE_SHAPING_PER_VN_VARS_OFFSET(pfId) \ |
225 | (IRO[44].base + ((pfId) * IRO[44].m1)) | 225 | (IRO[44].base + ((pfId) * IRO[44].m1)) |
226 | #define XSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ | 226 | #define XSTORM_RECORD_SLOW_PATH_OFFSET(funcId) \ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h index 5d71b7d43237..dbff5915b81a 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_hsi.h | |||
@@ -1251,6 +1251,9 @@ struct drv_func_mb { | |||
1251 | 1251 | ||
1252 | #define DRV_MSG_CODE_LINK_STATUS_CHANGED 0x01000000 | 1252 | #define DRV_MSG_CODE_LINK_STATUS_CHANGED 0x01000000 |
1253 | 1253 | ||
1254 | #define DRV_MSG_CODE_INITIATE_FLR 0x02000000 | ||
1255 | #define REQ_BC_VER_4_INITIATE_FLR 0x00070213 | ||
1256 | |||
1254 | #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000 | 1257 | #define BIOS_MSG_CODE_LIC_CHALLENGE 0xff010000 |
1255 | #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000 | 1258 | #define BIOS_MSG_CODE_LIC_RESPONSE 0xff020000 |
1256 | #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000 | 1259 | #define BIOS_MSG_CODE_VIRT_MAC_PRIM 0xff030000 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index beb4cdbdb6e1..64392ec410a3 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #define ETH_MAX_PACKET_SIZE 1500 | 35 | #define ETH_MAX_PACKET_SIZE 1500 |
36 | #define ETH_MAX_JUMBO_PACKET_SIZE 9600 | 36 | #define ETH_MAX_JUMBO_PACKET_SIZE 9600 |
37 | #define MDIO_ACCESS_TIMEOUT 1000 | 37 | #define MDIO_ACCESS_TIMEOUT 1000 |
38 | #define BMAC_CONTROL_RX_ENABLE 2 | ||
39 | #define WC_LANE_MAX 4 | 38 | #define WC_LANE_MAX 4 |
40 | #define I2C_SWITCH_WIDTH 2 | 39 | #define I2C_SWITCH_WIDTH 2 |
41 | #define I2C_BSC0 0 | 40 | #define I2C_BSC0 0 |
@@ -943,6 +942,12 @@ static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params, | |||
943 | const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 : | 942 | const u8 max_num_of_cos = (port) ? DCBX_E3B0_MAX_NUM_COS_PORT1 : |
944 | DCBX_E3B0_MAX_NUM_COS_PORT0; | 943 | DCBX_E3B0_MAX_NUM_COS_PORT0; |
945 | 944 | ||
945 | if (pri >= max_num_of_cos) { | ||
946 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | ||
947 | "parameter Illegal strict priority\n"); | ||
948 | return -EINVAL; | ||
949 | } | ||
950 | |||
946 | if (sp_pri_to_cos[pri] != DCBX_INVALID_COS) { | 951 | if (sp_pri_to_cos[pri] != DCBX_INVALID_COS) { |
947 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | 952 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " |
948 | "parameter There can't be two COS's with " | 953 | "parameter There can't be two COS's with " |
@@ -950,12 +955,6 @@ static int bnx2x_ets_e3b0_sp_pri_to_cos_set(const struct link_params *params, | |||
950 | return -EINVAL; | 955 | return -EINVAL; |
951 | } | 956 | } |
952 | 957 | ||
953 | if (pri > max_num_of_cos) { | ||
954 | DP(NETIF_MSG_LINK, "bnx2x_ets_e3b0_sp_pri_to_cos_set invalid " | ||
955 | "parameter Illegal strict priority\n"); | ||
956 | return -EINVAL; | ||
957 | } | ||
958 | |||
959 | sp_pri_to_cos[pri] = cos_entry; | 958 | sp_pri_to_cos[pri] = cos_entry; |
960 | return 0; | 959 | return 0; |
961 | 960 | ||
@@ -1372,7 +1371,14 @@ static void bnx2x_update_pfc_xmac(struct link_params *params, | |||
1372 | pfc1_val |= XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN | | 1371 | pfc1_val |= XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN | |
1373 | XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN | | 1372 | XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN | |
1374 | XMAC_PFC_CTRL_HI_REG_RX_PFC_EN | | 1373 | XMAC_PFC_CTRL_HI_REG_RX_PFC_EN | |
1375 | XMAC_PFC_CTRL_HI_REG_TX_PFC_EN; | 1374 | XMAC_PFC_CTRL_HI_REG_TX_PFC_EN | |
1375 | XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON; | ||
1376 | /* Write pause and PFC registers */ | ||
1377 | REG_WR(bp, xmac_base + XMAC_REG_PAUSE_CTRL, pause_val); | ||
1378 | REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL, pfc0_val); | ||
1379 | REG_WR(bp, xmac_base + XMAC_REG_PFC_CTRL_HI, pfc1_val); | ||
1380 | pfc1_val &= ~XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON; | ||
1381 | |||
1376 | } | 1382 | } |
1377 | 1383 | ||
1378 | /* Write pause and PFC registers */ | 1384 | /* Write pause and PFC registers */ |
@@ -3649,6 +3655,33 @@ static void bnx2x_ext_phy_update_adv_fc(struct bnx2x_phy *phy, | |||
3649 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) { | 3655 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) { |
3650 | bnx2x_cl22_read(bp, phy, 0x4, &ld_pause); | 3656 | bnx2x_cl22_read(bp, phy, 0x4, &ld_pause); |
3651 | bnx2x_cl22_read(bp, phy, 0x5, &lp_pause); | 3657 | bnx2x_cl22_read(bp, phy, 0x5, &lp_pause); |
3658 | } else if (CHIP_IS_E3(bp) && | ||
3659 | SINGLE_MEDIA_DIRECT(params)) { | ||
3660 | u8 lane = bnx2x_get_warpcore_lane(phy, params); | ||
3661 | u16 gp_status, gp_mask; | ||
3662 | bnx2x_cl45_read(bp, phy, | ||
3663 | MDIO_AN_DEVAD, MDIO_WC_REG_GP2_STATUS_GP_2_4, | ||
3664 | &gp_status); | ||
3665 | gp_mask = (MDIO_WC_REG_GP2_STATUS_GP_2_4_CL73_AN_CMPL | | ||
3666 | MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_LP_AN_CAP) << | ||
3667 | lane; | ||
3668 | if ((gp_status & gp_mask) == gp_mask) { | ||
3669 | bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | ||
3670 | MDIO_AN_REG_ADV_PAUSE, &ld_pause); | ||
3671 | bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | ||
3672 | MDIO_AN_REG_LP_AUTO_NEG, &lp_pause); | ||
3673 | } else { | ||
3674 | bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | ||
3675 | MDIO_AN_REG_CL37_FC_LD, &ld_pause); | ||
3676 | bnx2x_cl45_read(bp, phy, MDIO_AN_DEVAD, | ||
3677 | MDIO_AN_REG_CL37_FC_LP, &lp_pause); | ||
3678 | ld_pause = ((ld_pause & | ||
3679 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH) | ||
3680 | << 3); | ||
3681 | lp_pause = ((lp_pause & | ||
3682 | MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH) | ||
3683 | << 3); | ||
3684 | } | ||
3652 | } else { | 3685 | } else { |
3653 | bnx2x_cl45_read(bp, phy, | 3686 | bnx2x_cl45_read(bp, phy, |
3654 | MDIO_AN_DEVAD, | 3687 | MDIO_AN_DEVAD, |
@@ -3699,7 +3732,23 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3699 | u16 val16 = 0, lane, bam37 = 0; | 3732 | u16 val16 = 0, lane, bam37 = 0; |
3700 | struct bnx2x *bp = params->bp; | 3733 | struct bnx2x *bp = params->bp; |
3701 | DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n"); | 3734 | DP(NETIF_MSG_LINK, "Enable Auto Negotiation for KR\n"); |
3702 | 3735 | /* Set to default registers that may be overriden by 10G force */ | |
3736 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3737 | MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7); | ||
3738 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | ||
3739 | MDIO_WC_REG_PAR_DET_10G_CTRL, 0); | ||
3740 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3741 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, 0); | ||
3742 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3743 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0xff); | ||
3744 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3745 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0x5555); | ||
3746 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, | ||
3747 | MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0); | ||
3748 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3749 | MDIO_WC_REG_RX66_CONTROL, 0x7415); | ||
3750 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3751 | MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190); | ||
3703 | /* Disable Autoneg: re-enable it after adv is done. */ | 3752 | /* Disable Autoneg: re-enable it after adv is done. */ |
3704 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3753 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
3705 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0); | 3754 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0); |
@@ -3945,13 +3994,13 @@ static void bnx2x_warpcore_set_10G_XFI(struct bnx2x_phy *phy, | |||
3945 | 3994 | ||
3946 | } else { | 3995 | } else { |
3947 | misc1_val |= 0x9; | 3996 | misc1_val |= 0x9; |
3948 | tap_val = ((0x12 << MDIO_WC_REG_TX_FIR_TAP_POST_TAP_OFFSET) | | 3997 | tap_val = ((0x0f << MDIO_WC_REG_TX_FIR_TAP_POST_TAP_OFFSET) | |
3949 | (0x2d << MDIO_WC_REG_TX_FIR_TAP_MAIN_TAP_OFFSET) | | 3998 | (0x2b << MDIO_WC_REG_TX_FIR_TAP_MAIN_TAP_OFFSET) | |
3950 | (0x00 << MDIO_WC_REG_TX_FIR_TAP_PRE_TAP_OFFSET)); | 3999 | (0x02 << MDIO_WC_REG_TX_FIR_TAP_PRE_TAP_OFFSET)); |
3951 | tx_driver_val = | 4000 | tx_driver_val = |
3952 | ((0x02 << MDIO_WC_REG_TX0_TX_DRIVER_POST2_COEFF_OFFSET) | | 4001 | ((0x03 << MDIO_WC_REG_TX0_TX_DRIVER_POST2_COEFF_OFFSET) | |
3953 | (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IDRIVER_OFFSET) | | 4002 | (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IDRIVER_OFFSET) | |
3954 | (0x02 << MDIO_WC_REG_TX0_TX_DRIVER_IPRE_DRIVER_OFFSET)); | 4003 | (0x06 << MDIO_WC_REG_TX0_TX_DRIVER_IPRE_DRIVER_OFFSET)); |
3955 | } | 4004 | } |
3956 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | 4005 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, |
3957 | MDIO_WC_REG_SERDESDIGITAL_MISC1, misc1_val); | 4006 | MDIO_WC_REG_SERDESDIGITAL_MISC1, misc1_val); |
@@ -4369,7 +4418,7 @@ static void bnx2x_warpcore_config_init(struct bnx2x_phy *phy, | |||
4369 | switch (serdes_net_if) { | 4418 | switch (serdes_net_if) { |
4370 | case PORT_HW_CFG_NET_SERDES_IF_KR: | 4419 | case PORT_HW_CFG_NET_SERDES_IF_KR: |
4371 | /* Enable KR Auto Neg */ | 4420 | /* Enable KR Auto Neg */ |
4372 | if (params->loopback_mode == LOOPBACK_NONE) | 4421 | if (params->loopback_mode != LOOPBACK_EXT) |
4373 | bnx2x_warpcore_enable_AN_KR(phy, params, vars); | 4422 | bnx2x_warpcore_enable_AN_KR(phy, params, vars); |
4374 | else { | 4423 | else { |
4375 | DP(NETIF_MSG_LINK, "Setting KR 10G-Force\n"); | 4424 | DP(NETIF_MSG_LINK, "Setting KR 10G-Force\n"); |
@@ -6167,12 +6216,14 @@ int bnx2x_set_led(struct link_params *params, | |||
6167 | 6216 | ||
6168 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | 6217 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); |
6169 | if (params->phy[EXT_PHY1].type == | 6218 | if (params->phy[EXT_PHY1].type == |
6170 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) | 6219 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) |
6171 | EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp & 0xfff1); | 6220 | tmp &= ~(EMAC_LED_1000MB_OVERRIDE | |
6172 | else { | 6221 | EMAC_LED_100MB_OVERRIDE | |
6173 | EMAC_WR(bp, EMAC_REG_EMAC_LED, | 6222 | EMAC_LED_10MB_OVERRIDE); |
6174 | (tmp | EMAC_LED_OVERRIDE)); | 6223 | else |
6175 | } | 6224 | tmp |= EMAC_LED_OVERRIDE; |
6225 | |||
6226 | EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp); | ||
6176 | break; | 6227 | break; |
6177 | 6228 | ||
6178 | case LED_MODE_OPER: | 6229 | case LED_MODE_OPER: |
@@ -6227,10 +6278,15 @@ int bnx2x_set_led(struct link_params *params, | |||
6227 | hw_led_mode); | 6278 | hw_led_mode); |
6228 | } else if ((params->phy[EXT_PHY1].type == | 6279 | } else if ((params->phy[EXT_PHY1].type == |
6229 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) && | 6280 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) && |
6230 | (mode != LED_MODE_OPER)) { | 6281 | (mode == LED_MODE_ON)) { |
6231 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); | 6282 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); |
6232 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | 6283 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); |
6233 | EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp | 0x3); | 6284 | EMAC_WR(bp, EMAC_REG_EMAC_LED, tmp | |
6285 | EMAC_LED_OVERRIDE | EMAC_LED_1000MB_OVERRIDE); | ||
6286 | /* Break here; otherwise, it'll disable the | ||
6287 | * intended override. | ||
6288 | */ | ||
6289 | break; | ||
6234 | } else | 6290 | } else |
6235 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, | 6291 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, |
6236 | hw_led_mode); | 6292 | hw_led_mode); |
@@ -6245,13 +6301,9 @@ int bnx2x_set_led(struct link_params *params, | |||
6245 | LED_BLINK_RATE_VAL_E1X_E2); | 6301 | LED_BLINK_RATE_VAL_E1X_E2); |
6246 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 + | 6302 | REG_WR(bp, NIG_REG_LED_CONTROL_BLINK_RATE_ENA_P0 + |
6247 | port*4, 1); | 6303 | port*4, 1); |
6248 | if ((params->phy[EXT_PHY1].type != | 6304 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); |
6249 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM54618SE) && | 6305 | EMAC_WR(bp, EMAC_REG_EMAC_LED, |
6250 | (mode != LED_MODE_OPER)) { | 6306 | (tmp & (~EMAC_LED_OVERRIDE))); |
6251 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | ||
6252 | EMAC_WR(bp, EMAC_REG_EMAC_LED, | ||
6253 | (tmp & (~EMAC_LED_OVERRIDE))); | ||
6254 | } | ||
6255 | 6307 | ||
6256 | if (CHIP_IS_E1(bp) && | 6308 | if (CHIP_IS_E1(bp) && |
6257 | ((speed == SPEED_2500) || | 6309 | ((speed == SPEED_2500) || |
@@ -6844,6 +6896,12 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
6844 | SINGLE_MEDIA_DIRECT(params)) && | 6896 | SINGLE_MEDIA_DIRECT(params)) && |
6845 | (phy_vars[active_external_phy].fault_detected == 0)); | 6897 | (phy_vars[active_external_phy].fault_detected == 0)); |
6846 | 6898 | ||
6899 | /* Update the PFC configuration in case it was changed */ | ||
6900 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) | ||
6901 | vars->link_status |= LINK_STATUS_PFC_ENABLED; | ||
6902 | else | ||
6903 | vars->link_status &= ~LINK_STATUS_PFC_ENABLED; | ||
6904 | |||
6847 | if (vars->link_up) | 6905 | if (vars->link_up) |
6848 | rc = bnx2x_update_link_up(params, vars, link_10g_plus); | 6906 | rc = bnx2x_update_link_up(params, vars, link_10g_plus); |
6849 | else | 6907 | else |
@@ -8031,7 +8089,9 @@ static int bnx2x_verify_sfp_module(struct bnx2x_phy *phy, | |||
8031 | netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected," | 8089 | netdev_err(bp->dev, "Warning: Unqualified SFP+ module detected," |
8032 | " Port %d from %s part number %s\n", | 8090 | " Port %d from %s part number %s\n", |
8033 | params->port, vendor_name, vendor_pn); | 8091 | params->port, vendor_name, vendor_pn); |
8034 | phy->flags |= FLAGS_SFP_NOT_APPROVED; | 8092 | if ((val & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_MASK) != |
8093 | PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_WARNING_MSG) | ||
8094 | phy->flags |= FLAGS_SFP_NOT_APPROVED; | ||
8035 | return -EINVAL; | 8095 | return -EINVAL; |
8036 | } | 8096 | } |
8037 | 8097 | ||
@@ -9091,6 +9151,12 @@ static int bnx2x_8727_config_init(struct bnx2x_phy *phy, | |||
9091 | tmp2 &= 0xFFEF; | 9151 | tmp2 &= 0xFFEF; |
9092 | bnx2x_cl45_write(bp, phy, | 9152 | bnx2x_cl45_write(bp, phy, |
9093 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_OPT_CFG_REG, tmp2); | 9153 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8727_OPT_CFG_REG, tmp2); |
9154 | bnx2x_cl45_read(bp, phy, | ||
9155 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, | ||
9156 | &tmp2); | ||
9157 | bnx2x_cl45_write(bp, phy, | ||
9158 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, | ||
9159 | (tmp2 & 0x7fff)); | ||
9094 | } | 9160 | } |
9095 | 9161 | ||
9096 | return 0; | 9162 | return 0; |
@@ -9271,12 +9337,11 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
9271 | MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL, | 9337 | MDIO_PMA_DEVAD, MDIO_PMA_LASI_RXCTRL, |
9272 | ((1<<5) | (1<<2))); | 9338 | ((1<<5) | (1<<2))); |
9273 | } | 9339 | } |
9274 | DP(NETIF_MSG_LINK, "Enabling 8727 TX laser if SFP is approved\n"); | 9340 | |
9275 | bnx2x_8727_specific_func(phy, params, ENABLE_TX); | 9341 | if (!(phy->flags & FLAGS_SFP_NOT_APPROVED)) { |
9276 | /* If transmitter is disabled, ignore false link up indication */ | 9342 | DP(NETIF_MSG_LINK, "Enabling 8727 TX laser\n"); |
9277 | bnx2x_cl45_read(bp, phy, | 9343 | bnx2x_sfp_set_transmitter(params, phy, 1); |
9278 | MDIO_PMA_DEVAD, MDIO_PMA_REG_PHY_IDENTIFIER, &val1); | 9344 | } else { |
9279 | if (val1 & (1<<15)) { | ||
9280 | DP(NETIF_MSG_LINK, "Tx is disabled\n"); | 9345 | DP(NETIF_MSG_LINK, "Tx is disabled\n"); |
9281 | return 0; | 9346 | return 0; |
9282 | } | 9347 | } |
@@ -9370,8 +9435,7 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, | |||
9370 | 9435 | ||
9371 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { | 9436 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { |
9372 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); | 9437 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); |
9373 | bnx2x_save_spirom_version(bp, port, | 9438 | bnx2x_save_spirom_version(bp, port, fw_ver1 & 0xfff, |
9374 | ((fw_ver1 & 0xf000)>>5) | (fw_ver1 & 0x7f), | ||
9375 | phy->ver_addr); | 9439 | phy->ver_addr); |
9376 | } else { | 9440 | } else { |
9377 | /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ | 9441 | /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ |
@@ -9794,6 +9858,15 @@ static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, | |||
9794 | other_shmem_base_addr)); | 9858 | other_shmem_base_addr)); |
9795 | 9859 | ||
9796 | u32 shmem_base_path[2]; | 9860 | u32 shmem_base_path[2]; |
9861 | |||
9862 | /* Work around for 84833 LED failure inside RESET status */ | ||
9863 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | ||
9864 | MDIO_AN_REG_8481_LEGACY_MII_CTRL, | ||
9865 | MDIO_AN_REG_8481_MII_CTRL_FORCE_1G); | ||
9866 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | ||
9867 | MDIO_AN_REG_8481_1G_100T_EXT_CTRL, | ||
9868 | MIDO_AN_REG_8481_EXT_CTRL_FORCE_LEDS_OFF); | ||
9869 | |||
9797 | shmem_base_path[0] = params->shmem_base; | 9870 | shmem_base_path[0] = params->shmem_base; |
9798 | shmem_base_path[1] = other_shmem_base_addr; | 9871 | shmem_base_path[1] = other_shmem_base_addr; |
9799 | 9872 | ||
@@ -10104,7 +10177,7 @@ static void bnx2x_848x3_link_reset(struct bnx2x_phy *phy, | |||
10104 | u8 port; | 10177 | u8 port; |
10105 | u16 val16; | 10178 | u16 val16; |
10106 | 10179 | ||
10107 | if (!(CHIP_IS_E1(bp))) | 10180 | if (!(CHIP_IS_E1x(bp))) |
10108 | port = BP_PATH(bp); | 10181 | port = BP_PATH(bp); |
10109 | else | 10182 | else |
10110 | port = params->port; | 10183 | port = params->port; |
@@ -10131,7 +10204,7 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
10131 | u16 val; | 10204 | u16 val; |
10132 | u8 port; | 10205 | u8 port; |
10133 | 10206 | ||
10134 | if (!(CHIP_IS_E1(bp))) | 10207 | if (!(CHIP_IS_E1x(bp))) |
10135 | port = BP_PATH(bp); | 10208 | port = BP_PATH(bp); |
10136 | else | 10209 | else |
10137 | port = params->port; | 10210 | port = params->port; |
@@ -12050,6 +12123,9 @@ int bnx2x_phy_init(struct link_params *params, struct link_vars *vars) | |||
12050 | 12123 | ||
12051 | bnx2x_emac_init(params, vars); | 12124 | bnx2x_emac_init(params, vars); |
12052 | 12125 | ||
12126 | if (params->feature_config_flags & FEATURE_CONFIG_PFC_ENABLED) | ||
12127 | vars->link_status |= LINK_STATUS_PFC_ENABLED; | ||
12128 | |||
12053 | if (params->num_phys == 0) { | 12129 | if (params->num_phys == 0) { |
12054 | DP(NETIF_MSG_LINK, "No phy found for initialization !!\n"); | 12130 | DP(NETIF_MSG_LINK, "No phy found for initialization !!\n"); |
12055 | return -EINVAL; | 12131 | return -EINVAL; |
@@ -12129,10 +12205,10 @@ int bnx2x_link_reset(struct link_params *params, struct link_vars *vars, | |||
12129 | * Hold it as vars low | 12205 | * Hold it as vars low |
12130 | */ | 12206 | */ |
12131 | /* clear link led */ | 12207 | /* clear link led */ |
12208 | bnx2x_set_mdio_clk(bp, params->chip_id, port); | ||
12132 | bnx2x_set_led(params, vars, LED_MODE_OFF, 0); | 12209 | bnx2x_set_led(params, vars, LED_MODE_OFF, 0); |
12133 | 12210 | ||
12134 | if (reset_ext_phy) { | 12211 | if (reset_ext_phy) { |
12135 | bnx2x_set_mdio_clk(bp, params->chip_id, port); | ||
12136 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; | 12212 | for (phy_index = EXT_PHY1; phy_index < params->num_phys; |
12137 | phy_index++) { | 12213 | phy_index++) { |
12138 | if (params->phy[phy_index].link_reset) { | 12214 | if (params->phy[phy_index].link_reset) { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h index 7ba557a610da..763535ee4832 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.h | |||
@@ -89,6 +89,8 @@ | |||
89 | #define PFC_BRB_FULL_LB_XON_THRESHOLD 250 | 89 | #define PFC_BRB_FULL_LB_XON_THRESHOLD 250 |
90 | 90 | ||
91 | #define MAXVAL(a, b) (((a) > (b)) ? (a) : (b)) | 91 | #define MAXVAL(a, b) (((a) > (b)) ? (a) : (b)) |
92 | |||
93 | #define BMAC_CONTROL_RX_ENABLE 2 | ||
92 | /***********************************************************/ | 94 | /***********************************************************/ |
93 | /* Structs */ | 95 | /* Structs */ |
94 | /***********************************************************/ | 96 | /***********************************************************/ |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index f7f9aa807264..e077d2508727 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/prefetch.h> | 52 | #include <linux/prefetch.h> |
53 | #include <linux/zlib.h> | 53 | #include <linux/zlib.h> |
54 | #include <linux/io.h> | 54 | #include <linux/io.h> |
55 | #include <linux/semaphore.h> | ||
55 | #include <linux/stringify.h> | 56 | #include <linux/stringify.h> |
56 | #include <linux/vmalloc.h> | 57 | #include <linux/vmalloc.h> |
57 | 58 | ||
@@ -211,6 +212,10 @@ static DEFINE_PCI_DEVICE_TABLE(bnx2x_pci_tbl) = { | |||
211 | 212 | ||
212 | MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl); | 213 | MODULE_DEVICE_TABLE(pci, bnx2x_pci_tbl); |
213 | 214 | ||
215 | /* Global resources for unloading a previously loaded device */ | ||
216 | #define BNX2X_PREV_WAIT_NEEDED 1 | ||
217 | static DEFINE_SEMAPHORE(bnx2x_prev_sem); | ||
218 | static LIST_HEAD(bnx2x_prev_list); | ||
214 | /**************************************************************************** | 219 | /**************************************************************************** |
215 | * General service functions | 220 | * General service functions |
216 | ****************************************************************************/ | 221 | ****************************************************************************/ |
@@ -8812,109 +8817,371 @@ static inline void bnx2x_undi_int_disable(struct bnx2x *bp) | |||
8812 | bnx2x_undi_int_disable_e1h(bp); | 8817 | bnx2x_undi_int_disable_e1h(bp); |
8813 | } | 8818 | } |
8814 | 8819 | ||
8815 | static void __devinit bnx2x_undi_unload(struct bnx2x *bp) | 8820 | static void __devinit bnx2x_prev_unload_close_mac(struct bnx2x *bp) |
8816 | { | 8821 | { |
8817 | u32 val; | 8822 | u32 val, base_addr, offset, mask, reset_reg; |
8823 | bool mac_stopped = false; | ||
8824 | u8 port = BP_PORT(bp); | ||
8818 | 8825 | ||
8819 | /* possibly another driver is trying to reset the chip */ | 8826 | reset_reg = REG_RD(bp, MISC_REG_RESET_REG_2); |
8820 | bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_RESET); | ||
8821 | 8827 | ||
8822 | /* check if doorbell queue is reset */ | 8828 | if (!CHIP_IS_E3(bp)) { |
8823 | if (REG_RD(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET) | 8829 | val = REG_RD(bp, NIG_REG_BMAC0_REGS_OUT_EN + port * 4); |
8824 | & MISC_REGISTERS_RESET_REG_1_RST_DORQ) { | 8830 | mask = MISC_REGISTERS_RESET_REG_2_RST_BMAC0 << port; |
8831 | if ((mask & reset_reg) && val) { | ||
8832 | u32 wb_data[2]; | ||
8833 | BNX2X_DEV_INFO("Disable bmac Rx\n"); | ||
8834 | base_addr = BP_PORT(bp) ? NIG_REG_INGRESS_BMAC1_MEM | ||
8835 | : NIG_REG_INGRESS_BMAC0_MEM; | ||
8836 | offset = CHIP_IS_E2(bp) ? BIGMAC2_REGISTER_BMAC_CONTROL | ||
8837 | : BIGMAC_REGISTER_BMAC_CONTROL; | ||
8825 | 8838 | ||
8826 | /* | 8839 | /* |
8827 | * Check if it is the UNDI driver | 8840 | * use rd/wr since we cannot use dmae. This is safe |
8841 | * since MCP won't access the bus due to the request | ||
8842 | * to unload, and no function on the path can be | ||
8843 | * loaded at this time. | ||
8844 | */ | ||
8845 | wb_data[0] = REG_RD(bp, base_addr + offset); | ||
8846 | wb_data[1] = REG_RD(bp, base_addr + offset + 0x4); | ||
8847 | wb_data[0] &= ~BMAC_CONTROL_RX_ENABLE; | ||
8848 | REG_WR(bp, base_addr + offset, wb_data[0]); | ||
8849 | REG_WR(bp, base_addr + offset + 0x4, wb_data[1]); | ||
8850 | |||
8851 | } | ||
8852 | BNX2X_DEV_INFO("Disable emac Rx\n"); | ||
8853 | REG_WR(bp, NIG_REG_NIG_EMAC0_EN + BP_PORT(bp)*4, 0); | ||
8854 | |||
8855 | mac_stopped = true; | ||
8856 | } else { | ||
8857 | if (reset_reg & MISC_REGISTERS_RESET_REG_2_XMAC) { | ||
8858 | BNX2X_DEV_INFO("Disable xmac Rx\n"); | ||
8859 | base_addr = BP_PORT(bp) ? GRCBASE_XMAC1 : GRCBASE_XMAC0; | ||
8860 | val = REG_RD(bp, base_addr + XMAC_REG_PFC_CTRL_HI); | ||
8861 | REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI, | ||
8862 | val & ~(1 << 1)); | ||
8863 | REG_WR(bp, base_addr + XMAC_REG_PFC_CTRL_HI, | ||
8864 | val | (1 << 1)); | ||
8865 | REG_WR(bp, base_addr + XMAC_REG_CTRL, 0); | ||
8866 | mac_stopped = true; | ||
8867 | } | ||
8868 | mask = MISC_REGISTERS_RESET_REG_2_UMAC0 << port; | ||
8869 | if (mask & reset_reg) { | ||
8870 | BNX2X_DEV_INFO("Disable umac Rx\n"); | ||
8871 | base_addr = BP_PORT(bp) ? GRCBASE_UMAC1 : GRCBASE_UMAC0; | ||
8872 | REG_WR(bp, base_addr + UMAC_REG_COMMAND_CONFIG, 0); | ||
8873 | mac_stopped = true; | ||
8874 | } | ||
8875 | } | ||
8876 | |||
8877 | if (mac_stopped) | ||
8878 | msleep(20); | ||
8879 | |||
8880 | } | ||
8881 | |||
8882 | #define BNX2X_PREV_UNDI_PROD_ADDR(p) (BAR_TSTRORM_INTMEM + 0x1508 + ((p) << 4)) | ||
8883 | #define BNX2X_PREV_UNDI_RCQ(val) ((val) & 0xffff) | ||
8884 | #define BNX2X_PREV_UNDI_BD(val) ((val) >> 16 & 0xffff) | ||
8885 | #define BNX2X_PREV_UNDI_PROD(rcq, bd) ((bd) << 16 | (rcq)) | ||
8886 | |||
8887 | static void __devinit bnx2x_prev_unload_undi_inc(struct bnx2x *bp, u8 port, | ||
8888 | u8 inc) | ||
8889 | { | ||
8890 | u16 rcq, bd; | ||
8891 | u32 tmp_reg = REG_RD(bp, BNX2X_PREV_UNDI_PROD_ADDR(port)); | ||
8892 | |||
8893 | rcq = BNX2X_PREV_UNDI_RCQ(tmp_reg) + inc; | ||
8894 | bd = BNX2X_PREV_UNDI_BD(tmp_reg) + inc; | ||
8895 | |||
8896 | tmp_reg = BNX2X_PREV_UNDI_PROD(rcq, bd); | ||
8897 | REG_WR(bp, BNX2X_PREV_UNDI_PROD_ADDR(port), tmp_reg); | ||
8898 | |||
8899 | BNX2X_DEV_INFO("UNDI producer [%d] rings bd -> 0x%04x, rcq -> 0x%04x\n", | ||
8900 | port, bd, rcq); | ||
8901 | } | ||
8902 | |||
8903 | static int __devinit bnx2x_prev_mcp_done(struct bnx2x *bp) | ||
8904 | { | ||
8905 | u32 rc = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0); | ||
8906 | if (!rc) { | ||
8907 | BNX2X_ERR("MCP response failure, aborting\n"); | ||
8908 | return -EBUSY; | ||
8909 | } | ||
8910 | |||
8911 | return 0; | ||
8912 | } | ||
8913 | |||
8914 | static bool __devinit bnx2x_prev_is_path_marked(struct bnx2x *bp) | ||
8915 | { | ||
8916 | struct bnx2x_prev_path_list *tmp_list; | ||
8917 | int rc = false; | ||
8918 | |||
8919 | if (down_trylock(&bnx2x_prev_sem)) | ||
8920 | return false; | ||
8921 | |||
8922 | list_for_each_entry(tmp_list, &bnx2x_prev_list, list) { | ||
8923 | if (PCI_SLOT(bp->pdev->devfn) == tmp_list->slot && | ||
8924 | bp->pdev->bus->number == tmp_list->bus && | ||
8925 | BP_PATH(bp) == tmp_list->path) { | ||
8926 | rc = true; | ||
8927 | BNX2X_DEV_INFO("Path %d was already cleaned from previous drivers\n", | ||
8928 | BP_PATH(bp)); | ||
8929 | break; | ||
8930 | } | ||
8931 | } | ||
8932 | |||
8933 | up(&bnx2x_prev_sem); | ||
8934 | |||
8935 | return rc; | ||
8936 | } | ||
8937 | |||
8938 | static int __devinit bnx2x_prev_mark_path(struct bnx2x *bp) | ||
8939 | { | ||
8940 | struct bnx2x_prev_path_list *tmp_list; | ||
8941 | int rc; | ||
8942 | |||
8943 | tmp_list = (struct bnx2x_prev_path_list *) | ||
8944 | kmalloc(sizeof(struct bnx2x_prev_path_list), GFP_KERNEL); | ||
8945 | if (!tmp_list) { | ||
8946 | BNX2X_ERR("Failed to allocate 'bnx2x_prev_path_list'\n"); | ||
8947 | return -ENOMEM; | ||
8948 | } | ||
8949 | |||
8950 | tmp_list->bus = bp->pdev->bus->number; | ||
8951 | tmp_list->slot = PCI_SLOT(bp->pdev->devfn); | ||
8952 | tmp_list->path = BP_PATH(bp); | ||
8953 | |||
8954 | rc = down_interruptible(&bnx2x_prev_sem); | ||
8955 | if (rc) { | ||
8956 | BNX2X_ERR("Received %d when tried to take lock\n", rc); | ||
8957 | kfree(tmp_list); | ||
8958 | } else { | ||
8959 | BNX2X_DEV_INFO("Marked path [%d] - finished previous unload\n", | ||
8960 | BP_PATH(bp)); | ||
8961 | list_add(&tmp_list->list, &bnx2x_prev_list); | ||
8962 | up(&bnx2x_prev_sem); | ||
8963 | } | ||
8964 | |||
8965 | return rc; | ||
8966 | } | ||
8967 | |||
8968 | static bool __devinit bnx2x_can_flr(struct bnx2x *bp) | ||
8969 | { | ||
8970 | int pos; | ||
8971 | u32 cap; | ||
8972 | struct pci_dev *dev = bp->pdev; | ||
8973 | |||
8974 | pos = pci_pcie_cap(dev); | ||
8975 | if (!pos) | ||
8976 | return false; | ||
8977 | |||
8978 | pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP, &cap); | ||
8979 | if (!(cap & PCI_EXP_DEVCAP_FLR)) | ||
8980 | return false; | ||
8981 | |||
8982 | return true; | ||
8983 | } | ||
8984 | |||
8985 | static int __devinit bnx2x_do_flr(struct bnx2x *bp) | ||
8986 | { | ||
8987 | int i, pos; | ||
8988 | u16 status; | ||
8989 | struct pci_dev *dev = bp->pdev; | ||
8990 | |||
8991 | /* probe the capability first */ | ||
8992 | if (bnx2x_can_flr(bp)) | ||
8993 | return -ENOTTY; | ||
8994 | |||
8995 | pos = pci_pcie_cap(dev); | ||
8996 | if (!pos) | ||
8997 | return -ENOTTY; | ||
8998 | |||
8999 | /* Wait for Transaction Pending bit clean */ | ||
9000 | for (i = 0; i < 4; i++) { | ||
9001 | if (i) | ||
9002 | msleep((1 << (i - 1)) * 100); | ||
9003 | |||
9004 | pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, &status); | ||
9005 | if (!(status & PCI_EXP_DEVSTA_TRPND)) | ||
9006 | goto clear; | ||
9007 | } | ||
9008 | |||
9009 | dev_err(&dev->dev, | ||
9010 | "transaction is not cleared; proceeding with reset anyway\n"); | ||
9011 | |||
9012 | clear: | ||
9013 | if (bp->common.bc_ver < REQ_BC_VER_4_INITIATE_FLR) { | ||
9014 | BNX2X_ERR("FLR not supported by BC_VER: 0x%x\n", | ||
9015 | bp->common.bc_ver); | ||
9016 | return -EINVAL; | ||
9017 | } | ||
9018 | |||
9019 | bnx2x_fw_command(bp, DRV_MSG_CODE_INITIATE_FLR, 0); | ||
9020 | |||
9021 | return 0; | ||
9022 | } | ||
9023 | |||
9024 | static int __devinit bnx2x_prev_unload_uncommon(struct bnx2x *bp) | ||
9025 | { | ||
9026 | int rc; | ||
9027 | |||
9028 | BNX2X_DEV_INFO("Uncommon unload Flow\n"); | ||
9029 | |||
9030 | /* Test if previous unload process was already finished for this path */ | ||
9031 | if (bnx2x_prev_is_path_marked(bp)) | ||
9032 | return bnx2x_prev_mcp_done(bp); | ||
9033 | |||
9034 | /* If function has FLR capabilities, and existing FW version matches | ||
9035 | * the one required, then FLR will be sufficient to clean any residue | ||
9036 | * left by previous driver | ||
9037 | */ | ||
9038 | if (bnx2x_test_firmware_version(bp, false) && bnx2x_can_flr(bp)) | ||
9039 | return bnx2x_do_flr(bp); | ||
9040 | |||
9041 | /* Close the MCP request, return failure*/ | ||
9042 | rc = bnx2x_prev_mcp_done(bp); | ||
9043 | if (!rc) | ||
9044 | rc = BNX2X_PREV_WAIT_NEEDED; | ||
9045 | |||
9046 | return rc; | ||
9047 | } | ||
9048 | |||
9049 | static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp) | ||
9050 | { | ||
9051 | u32 reset_reg, tmp_reg = 0, rc; | ||
9052 | /* It is possible a previous function received 'common' answer, | ||
9053 | * but hasn't loaded yet, therefore creating a scenario of | ||
9054 | * multiple functions receiving 'common' on the same path. | ||
9055 | */ | ||
9056 | BNX2X_DEV_INFO("Common unload Flow\n"); | ||
9057 | |||
9058 | if (bnx2x_prev_is_path_marked(bp)) | ||
9059 | return bnx2x_prev_mcp_done(bp); | ||
9060 | |||
9061 | reset_reg = REG_RD(bp, MISC_REG_RESET_REG_1); | ||
9062 | |||
9063 | /* Reset should be performed after BRB is emptied */ | ||
9064 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_BRB1) { | ||
9065 | u32 timer_count = 1000; | ||
9066 | bool prev_undi = false; | ||
9067 | |||
9068 | /* Close the MAC Rx to prevent BRB from filling up */ | ||
9069 | bnx2x_prev_unload_close_mac(bp); | ||
9070 | |||
9071 | /* Check if the UNDI driver was previously loaded | ||
8828 | * UNDI driver initializes CID offset for normal bell to 0x7 | 9072 | * UNDI driver initializes CID offset for normal bell to 0x7 |
8829 | */ | 9073 | */ |
8830 | val = REG_RD(bp, DORQ_REG_NORM_CID_OFST); | 9074 | reset_reg = REG_RD(bp, MISC_REG_RESET_REG_1); |
8831 | if (val == 0x7) { | 9075 | if (reset_reg & MISC_REGISTERS_RESET_REG_1_RST_DORQ) { |
8832 | u32 reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | 9076 | tmp_reg = REG_RD(bp, DORQ_REG_NORM_CID_OFST); |
8833 | /* save our pf_num */ | 9077 | if (tmp_reg == 0x7) { |
8834 | int orig_pf_num = bp->pf_num; | 9078 | BNX2X_DEV_INFO("UNDI previously loaded\n"); |
8835 | int port; | 9079 | prev_undi = true; |
8836 | u32 swap_en, swap_val, value; | 9080 | /* clear the UNDI indication */ |
8837 | 9081 | REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0); | |
8838 | /* clear the UNDI indication */ | ||
8839 | REG_WR(bp, DORQ_REG_NORM_CID_OFST, 0); | ||
8840 | |||
8841 | BNX2X_DEV_INFO("UNDI is active! reset device\n"); | ||
8842 | |||
8843 | /* try unload UNDI on port 0 */ | ||
8844 | bp->pf_num = 0; | ||
8845 | bp->fw_seq = | ||
8846 | (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) & | ||
8847 | DRV_MSG_SEQ_NUMBER_MASK); | ||
8848 | reset_code = bnx2x_fw_command(bp, reset_code, 0); | ||
8849 | |||
8850 | /* if UNDI is loaded on the other port */ | ||
8851 | if (reset_code != FW_MSG_CODE_DRV_UNLOAD_COMMON) { | ||
8852 | |||
8853 | /* send "DONE" for previous unload */ | ||
8854 | bnx2x_fw_command(bp, | ||
8855 | DRV_MSG_CODE_UNLOAD_DONE, 0); | ||
8856 | |||
8857 | /* unload UNDI on port 1 */ | ||
8858 | bp->pf_num = 1; | ||
8859 | bp->fw_seq = | ||
8860 | (SHMEM_RD(bp, func_mb[bp->pf_num].drv_mb_header) & | ||
8861 | DRV_MSG_SEQ_NUMBER_MASK); | ||
8862 | reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS; | ||
8863 | |||
8864 | bnx2x_fw_command(bp, reset_code, 0); | ||
8865 | } | 9082 | } |
9083 | } | ||
9084 | /* wait until BRB is empty */ | ||
9085 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); | ||
9086 | while (timer_count) { | ||
9087 | u32 prev_brb = tmp_reg; | ||
8866 | 9088 | ||
8867 | bnx2x_undi_int_disable(bp); | 9089 | tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS); |
8868 | port = BP_PORT(bp); | 9090 | if (!tmp_reg) |
8869 | 9091 | break; | |
8870 | /* close input traffic and wait for it */ | ||
8871 | /* Do not rcv packets to BRB */ | ||
8872 | REG_WR(bp, (port ? NIG_REG_LLH1_BRB1_DRV_MASK : | ||
8873 | NIG_REG_LLH0_BRB1_DRV_MASK), 0x0); | ||
8874 | /* Do not direct rcv packets that are not for MCP to | ||
8875 | * the BRB */ | ||
8876 | REG_WR(bp, (port ? NIG_REG_LLH1_BRB1_NOT_MCP : | ||
8877 | NIG_REG_LLH0_BRB1_NOT_MCP), 0x0); | ||
8878 | /* clear AEU */ | ||
8879 | REG_WR(bp, (port ? MISC_REG_AEU_MASK_ATTN_FUNC_1 : | ||
8880 | MISC_REG_AEU_MASK_ATTN_FUNC_0), 0); | ||
8881 | msleep(10); | ||
8882 | |||
8883 | /* save NIG port swap info */ | ||
8884 | swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); | ||
8885 | swap_en = REG_RD(bp, NIG_REG_STRAP_OVERRIDE); | ||
8886 | /* reset device */ | ||
8887 | REG_WR(bp, | ||
8888 | GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_CLEAR, | ||
8889 | 0xd3ffffff); | ||
8890 | |||
8891 | value = 0x1400; | ||
8892 | if (CHIP_IS_E3(bp)) { | ||
8893 | value |= MISC_REGISTERS_RESET_REG_2_MSTAT0; | ||
8894 | value |= MISC_REGISTERS_RESET_REG_2_MSTAT1; | ||
8895 | } | ||
8896 | 9092 | ||
8897 | REG_WR(bp, | 9093 | BNX2X_DEV_INFO("BRB still has 0x%08x\n", tmp_reg); |
8898 | GRCBASE_MISC + MISC_REGISTERS_RESET_REG_2_CLEAR, | ||
8899 | value); | ||
8900 | 9094 | ||
8901 | /* take the NIG out of reset and restore swap values */ | 9095 | /* reset timer as long as BRB actually gets emptied */ |
8902 | REG_WR(bp, | 9096 | if (prev_brb > tmp_reg) |
8903 | GRCBASE_MISC + MISC_REGISTERS_RESET_REG_1_SET, | 9097 | timer_count = 1000; |
8904 | MISC_REGISTERS_RESET_REG_1_RST_NIG); | 9098 | else |
8905 | REG_WR(bp, NIG_REG_PORT_SWAP, swap_val); | 9099 | timer_count--; |
8906 | REG_WR(bp, NIG_REG_STRAP_OVERRIDE, swap_en); | ||
8907 | 9100 | ||
8908 | /* send unload done to the MCP */ | 9101 | /* If UNDI resides in memory, manually increment it */ |
8909 | bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0); | 9102 | if (prev_undi) |
9103 | bnx2x_prev_unload_undi_inc(bp, BP_PORT(bp), 1); | ||
8910 | 9104 | ||
8911 | /* restore our func and fw_seq */ | 9105 | udelay(10); |
8912 | bp->pf_num = orig_pf_num; | ||
8913 | } | 9106 | } |
9107 | |||
9108 | if (!timer_count) | ||
9109 | BNX2X_ERR("Failed to empty BRB, hope for the best\n"); | ||
9110 | |||
8914 | } | 9111 | } |
8915 | 9112 | ||
8916 | /* now it's safe to release the lock */ | 9113 | /* No packets are in the pipeline, path is ready for reset */ |
8917 | bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_RESET); | 9114 | bnx2x_reset_common(bp); |
9115 | |||
9116 | rc = bnx2x_prev_mark_path(bp); | ||
9117 | if (rc) { | ||
9118 | bnx2x_prev_mcp_done(bp); | ||
9119 | return rc; | ||
9120 | } | ||
9121 | |||
9122 | return bnx2x_prev_mcp_done(bp); | ||
9123 | } | ||
9124 | |||
9125 | static int __devinit bnx2x_prev_unload(struct bnx2x *bp) | ||
9126 | { | ||
9127 | int time_counter = 10; | ||
9128 | u32 rc, fw, hw_lock_reg, hw_lock_val; | ||
9129 | BNX2X_DEV_INFO("Entering Previous Unload Flow\n"); | ||
9130 | |||
9131 | /* Release previously held locks */ | ||
9132 | hw_lock_reg = (BP_FUNC(bp) <= 5) ? | ||
9133 | (MISC_REG_DRIVER_CONTROL_1 + BP_FUNC(bp) * 8) : | ||
9134 | (MISC_REG_DRIVER_CONTROL_7 + (BP_FUNC(bp) - 6) * 8); | ||
9135 | |||
9136 | hw_lock_val = (REG_RD(bp, hw_lock_reg)); | ||
9137 | if (hw_lock_val) { | ||
9138 | if (hw_lock_val & HW_LOCK_RESOURCE_NVRAM) { | ||
9139 | BNX2X_DEV_INFO("Release Previously held NVRAM lock\n"); | ||
9140 | REG_WR(bp, MCP_REG_MCPR_NVM_SW_ARB, | ||
9141 | (MCPR_NVM_SW_ARB_ARB_REQ_CLR1 << BP_PORT(bp))); | ||
9142 | } | ||
9143 | |||
9144 | BNX2X_DEV_INFO("Release Previously held hw lock\n"); | ||
9145 | REG_WR(bp, hw_lock_reg, 0xffffffff); | ||
9146 | } else | ||
9147 | BNX2X_DEV_INFO("No need to release hw/nvram locks\n"); | ||
9148 | |||
9149 | if (MCPR_ACCESS_LOCK_LOCK & REG_RD(bp, MCP_REG_MCPR_ACCESS_LOCK)) { | ||
9150 | BNX2X_DEV_INFO("Release previously held alr\n"); | ||
9151 | REG_WR(bp, MCP_REG_MCPR_ACCESS_LOCK, 0); | ||
9152 | } | ||
9153 | |||
9154 | |||
9155 | do { | ||
9156 | /* Lock MCP using an unload request */ | ||
9157 | fw = bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS, 0); | ||
9158 | if (!fw) { | ||
9159 | BNX2X_ERR("MCP response failure, aborting\n"); | ||
9160 | rc = -EBUSY; | ||
9161 | break; | ||
9162 | } | ||
9163 | |||
9164 | if (fw == FW_MSG_CODE_DRV_UNLOAD_COMMON) { | ||
9165 | rc = bnx2x_prev_unload_common(bp); | ||
9166 | break; | ||
9167 | } | ||
9168 | |||
9169 | /* non-common reply from MCP night require looping */ | ||
9170 | rc = bnx2x_prev_unload_uncommon(bp); | ||
9171 | if (rc != BNX2X_PREV_WAIT_NEEDED) | ||
9172 | break; | ||
9173 | |||
9174 | msleep(20); | ||
9175 | } while (--time_counter); | ||
9176 | |||
9177 | if (!time_counter || rc) { | ||
9178 | BNX2X_ERR("Failed unloading previous driver, aborting\n"); | ||
9179 | rc = -EBUSY; | ||
9180 | } | ||
9181 | |||
9182 | BNX2X_DEV_INFO("Finished Previous Unload Flow [%d]\n", rc); | ||
9183 | |||
9184 | return rc; | ||
8918 | } | 9185 | } |
8919 | 9186 | ||
8920 | static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) | 9187 | static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp) |
@@ -10100,8 +10367,16 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp) | |||
10100 | func = BP_FUNC(bp); | 10367 | func = BP_FUNC(bp); |
10101 | 10368 | ||
10102 | /* need to reset chip if undi was active */ | 10369 | /* need to reset chip if undi was active */ |
10103 | if (!BP_NOMCP(bp)) | 10370 | if (!BP_NOMCP(bp)) { |
10104 | bnx2x_undi_unload(bp); | 10371 | /* init fw_seq */ |
10372 | bp->fw_seq = | ||
10373 | SHMEM_RD(bp, func_mb[BP_FW_MB_IDX(bp)].drv_mb_header) & | ||
10374 | DRV_MSG_SEQ_NUMBER_MASK; | ||
10375 | BNX2X_DEV_INFO("fw_seq 0x%08x\n", bp->fw_seq); | ||
10376 | |||
10377 | bnx2x_prev_unload(bp); | ||
10378 | } | ||
10379 | |||
10105 | 10380 | ||
10106 | if (CHIP_REV_IS_FPGA(bp)) | 10381 | if (CHIP_REV_IS_FPGA(bp)) |
10107 | dev_err(&bp->pdev->dev, "FPGA detected\n"); | 10382 | dev_err(&bp->pdev->dev, "FPGA detected\n"); |
@@ -11431,9 +11706,18 @@ static int __init bnx2x_init(void) | |||
11431 | 11706 | ||
11432 | static void __exit bnx2x_cleanup(void) | 11707 | static void __exit bnx2x_cleanup(void) |
11433 | { | 11708 | { |
11709 | struct list_head *pos, *q; | ||
11434 | pci_unregister_driver(&bnx2x_pci_driver); | 11710 | pci_unregister_driver(&bnx2x_pci_driver); |
11435 | 11711 | ||
11436 | destroy_workqueue(bnx2x_wq); | 11712 | destroy_workqueue(bnx2x_wq); |
11713 | |||
11714 | /* Free globablly allocated resources */ | ||
11715 | list_for_each_safe(pos, q, &bnx2x_prev_list) { | ||
11716 | struct bnx2x_prev_path_list *tmp = | ||
11717 | list_entry(pos, struct bnx2x_prev_path_list, list); | ||
11718 | list_del(pos); | ||
11719 | kfree(tmp); | ||
11720 | } | ||
11437 | } | 11721 | } |
11438 | 11722 | ||
11439 | void bnx2x_notify_link_changed(struct bnx2x *bp) | 11723 | void bnx2x_notify_link_changed(struct bnx2x *bp) |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h index fd7fb4581849..c25803b9c0ca 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_reg.h | |||
@@ -987,6 +987,7 @@ | |||
987 | * clear; 1 = set. Data valid only in addresses 0-4. all the rest are zero. */ | 987 | * clear; 1 = set. Data valid only in addresses 0-4. all the rest are zero. */ |
988 | #define IGU_REG_WRITE_DONE_PENDING 0x130480 | 988 | #define IGU_REG_WRITE_DONE_PENDING 0x130480 |
989 | #define MCP_A_REG_MCPR_SCRATCH 0x3a0000 | 989 | #define MCP_A_REG_MCPR_SCRATCH 0x3a0000 |
990 | #define MCP_REG_MCPR_ACCESS_LOCK 0x8009c | ||
990 | #define MCP_REG_MCPR_CPU_PROGRAM_COUNTER 0x8501c | 991 | #define MCP_REG_MCPR_CPU_PROGRAM_COUNTER 0x8501c |
991 | #define MCP_REG_MCPR_GP_INPUTS 0x800c0 | 992 | #define MCP_REG_MCPR_GP_INPUTS 0x800c0 |
992 | #define MCP_REG_MCPR_GP_OENABLE 0x800c8 | 993 | #define MCP_REG_MCPR_GP_OENABLE 0x800c8 |
@@ -1686,6 +1687,7 @@ | |||
1686 | [10] rst_dbg; [11] rst_misc_core; [12] rst_dbue (UART); [13] | 1687 | [10] rst_dbg; [11] rst_misc_core; [12] rst_dbue (UART); [13] |
1687 | Pci_resetmdio_n; [14] rst_emac0_hard_core; [15] rst_emac1_hard_core; 16] | 1688 | Pci_resetmdio_n; [14] rst_emac0_hard_core; [15] rst_emac1_hard_core; 16] |
1688 | rst_pxp_rq_rd_wr; 31:17] reserved */ | 1689 | rst_pxp_rq_rd_wr; 31:17] reserved */ |
1690 | #define MISC_REG_RESET_REG_1 0xa580 | ||
1689 | #define MISC_REG_RESET_REG_2 0xa590 | 1691 | #define MISC_REG_RESET_REG_2 0xa590 |
1690 | /* [RW 20] 20 bit GRC address where the scratch-pad of the MCP that is | 1692 | /* [RW 20] 20 bit GRC address where the scratch-pad of the MCP that is |
1691 | shared with the driver resides */ | 1693 | shared with the driver resides */ |
@@ -5352,6 +5354,7 @@ | |||
5352 | #define XMAC_CTRL_REG_TX_EN (0x1<<0) | 5354 | #define XMAC_CTRL_REG_TX_EN (0x1<<0) |
5353 | #define XMAC_PAUSE_CTRL_REG_RX_PAUSE_EN (0x1<<18) | 5355 | #define XMAC_PAUSE_CTRL_REG_RX_PAUSE_EN (0x1<<18) |
5354 | #define XMAC_PAUSE_CTRL_REG_TX_PAUSE_EN (0x1<<17) | 5356 | #define XMAC_PAUSE_CTRL_REG_TX_PAUSE_EN (0x1<<17) |
5357 | #define XMAC_PFC_CTRL_HI_REG_FORCE_PFC_XON (0x1<<1) | ||
5355 | #define XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN (0x1<<0) | 5358 | #define XMAC_PFC_CTRL_HI_REG_PFC_REFRESH_EN (0x1<<0) |
5356 | #define XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN (0x1<<3) | 5359 | #define XMAC_PFC_CTRL_HI_REG_PFC_STATS_EN (0x1<<3) |
5357 | #define XMAC_PFC_CTRL_HI_REG_RX_PFC_EN (0x1<<4) | 5360 | #define XMAC_PFC_CTRL_HI_REG_RX_PFC_EN (0x1<<4) |
@@ -5606,6 +5609,7 @@ | |||
5606 | /* [RC 32] Parity register #0 read clear */ | 5609 | /* [RC 32] Parity register #0 read clear */ |
5607 | #define XSEM_REG_XSEM_PRTY_STS_CLR_0 0x280128 | 5610 | #define XSEM_REG_XSEM_PRTY_STS_CLR_0 0x280128 |
5608 | #define XSEM_REG_XSEM_PRTY_STS_CLR_1 0x280138 | 5611 | #define XSEM_REG_XSEM_PRTY_STS_CLR_1 0x280138 |
5612 | #define MCPR_ACCESS_LOCK_LOCK (1L<<31) | ||
5609 | #define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0) | 5613 | #define MCPR_NVM_ACCESS_ENABLE_EN (1L<<0) |
5610 | #define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1) | 5614 | #define MCPR_NVM_ACCESS_ENABLE_WR_EN (1L<<1) |
5611 | #define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0) | 5615 | #define MCPR_NVM_ADDR_NVM_ADDR_VALUE (0xffffffL<<0) |
@@ -5732,6 +5736,7 @@ | |||
5732 | #define MISC_REGISTERS_GPIO_PORT_SHIFT 4 | 5736 | #define MISC_REGISTERS_GPIO_PORT_SHIFT 4 |
5733 | #define MISC_REGISTERS_GPIO_SET_POS 8 | 5737 | #define MISC_REGISTERS_GPIO_SET_POS 8 |
5734 | #define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588 | 5738 | #define MISC_REGISTERS_RESET_REG_1_CLEAR 0x588 |
5739 | #define MISC_REGISTERS_RESET_REG_1_RST_BRB1 (0x1<<0) | ||
5735 | #define MISC_REGISTERS_RESET_REG_1_RST_DORQ (0x1<<19) | 5740 | #define MISC_REGISTERS_RESET_REG_1_RST_DORQ (0x1<<19) |
5736 | #define MISC_REGISTERS_RESET_REG_1_RST_HC (0x1<<29) | 5741 | #define MISC_REGISTERS_RESET_REG_1_RST_HC (0x1<<29) |
5737 | #define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7) | 5742 | #define MISC_REGISTERS_RESET_REG_1_RST_NIG (0x1<<7) |
@@ -6816,10 +6821,13 @@ Theotherbitsarereservedandshouldbezero*/ | |||
6816 | 6821 | ||
6817 | #define MDIO_AN_REG_8481_10GBASE_T_AN_CTRL 0x0020 | 6822 | #define MDIO_AN_REG_8481_10GBASE_T_AN_CTRL 0x0020 |
6818 | #define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0 | 6823 | #define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0 |
6824 | #define MDIO_AN_REG_8481_MII_CTRL_FORCE_1G 0x40 | ||
6819 | #define MDIO_AN_REG_8481_LEGACY_MII_STATUS 0xffe1 | 6825 | #define MDIO_AN_REG_8481_LEGACY_MII_STATUS 0xffe1 |
6820 | #define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4 | 6826 | #define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4 |
6821 | #define MDIO_AN_REG_8481_LEGACY_AN_EXPANSION 0xffe6 | 6827 | #define MDIO_AN_REG_8481_LEGACY_AN_EXPANSION 0xffe6 |
6822 | #define MDIO_AN_REG_8481_1000T_CTRL 0xffe9 | 6828 | #define MDIO_AN_REG_8481_1000T_CTRL 0xffe9 |
6829 | #define MDIO_AN_REG_8481_1G_100T_EXT_CTRL 0xfff0 | ||
6830 | #define MIDO_AN_REG_8481_EXT_CTRL_FORCE_LEDS_OFF 0x0008 | ||
6823 | #define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5 | 6831 | #define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5 |
6824 | #define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7 | 6832 | #define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7 |
6825 | #define MDIO_AN_REG_8481_AUX_CTRL 0xfff8 | 6833 | #define MDIO_AN_REG_8481_AUX_CTRL 0xfff8 |
@@ -6939,6 +6947,10 @@ Theotherbitsarereservedandshouldbezero*/ | |||
6939 | #define MDIO_WC_REG_GP2_STATUS_GP_2_2 0x81d2 | 6947 | #define MDIO_WC_REG_GP2_STATUS_GP_2_2 0x81d2 |
6940 | #define MDIO_WC_REG_GP2_STATUS_GP_2_3 0x81d3 | 6948 | #define MDIO_WC_REG_GP2_STATUS_GP_2_3 0x81d3 |
6941 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4 0x81d4 | 6949 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4 0x81d4 |
6950 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL73_AN_CMPL 0x1000 | ||
6951 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_AN_CMPL 0x0100 | ||
6952 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_LP_AN_CAP 0x0010 | ||
6953 | #define MDIO_WC_REG_GP2_STATUS_GP_2_4_CL37_AN_CAP 0x1 | ||
6942 | #define MDIO_WC_REG_UC_INFO_B0_DEAD_TRAP 0x81EE | 6954 | #define MDIO_WC_REG_UC_INFO_B0_DEAD_TRAP 0x81EE |
6943 | #define MDIO_WC_REG_UC_INFO_B1_VERSION 0x81F0 | 6955 | #define MDIO_WC_REG_UC_INFO_B1_VERSION 0x81F0 |
6944 | #define MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE 0x81F2 | 6956 | #define MDIO_WC_REG_UC_INFO_B1_FIRMWARE_MODE 0x81F2 |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c index 3f52fadee3ed..513573321625 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c | |||
@@ -3847,7 +3847,7 @@ static bool bnx2x_credit_pool_get_entry( | |||
3847 | continue; | 3847 | continue; |
3848 | 3848 | ||
3849 | /* If we've got here we are going to find a free entry */ | 3849 | /* If we've got here we are going to find a free entry */ |
3850 | for (idx = vec * BNX2X_POOL_VEC_SIZE, i = 0; | 3850 | for (idx = vec * BIT_VEC64_ELEM_SZ, i = 0; |
3851 | i < BIT_VEC64_ELEM_SZ; idx++, i++) | 3851 | i < BIT_VEC64_ELEM_SZ; idx++, i++) |
3852 | 3852 | ||
3853 | if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) { | 3853 | if (BIT_VEC64_TEST_BIT(o->pool_mirror, idx)) { |
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 4e4bb3875868..ceeab8e852ef 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -879,8 +879,13 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi) | |||
879 | if (sblk->status & SD_STATUS_LINK_CHG) | 879 | if (sblk->status & SD_STATUS_LINK_CHG) |
880 | work_exists = 1; | 880 | work_exists = 1; |
881 | } | 881 | } |
882 | /* check for RX/TX work to do */ | 882 | |
883 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons || | 883 | /* check for TX work to do */ |
884 | if (sblk->idx[0].tx_consumer != tnapi->tx_cons) | ||
885 | work_exists = 1; | ||
886 | |||
887 | /* check for RX work to do */ | ||
888 | if (tnapi->rx_rcb_prod_idx && | ||
884 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) | 889 | *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr) |
885 | work_exists = 1; | 890 | work_exists = 1; |
886 | 891 | ||
@@ -2778,7 +2783,9 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power) | |||
2778 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || | 2783 | if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 || |
2779 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || | 2784 | GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 || |
2780 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && | 2785 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5780 && |
2781 | (tp->phy_flags & TG3_PHYFLG_MII_SERDES))) | 2786 | (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) || |
2787 | (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 && | ||
2788 | !tp->pci_fn)) | ||
2782 | return; | 2789 | return; |
2783 | 2790 | ||
2784 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX || | 2791 | if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX || |
@@ -6122,6 +6129,9 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget) | |||
6122 | return work_done; | 6129 | return work_done; |
6123 | } | 6130 | } |
6124 | 6131 | ||
6132 | if (!tnapi->rx_rcb_prod_idx) | ||
6133 | return work_done; | ||
6134 | |||
6125 | /* run RX thread, within the bounds set by NAPI. | 6135 | /* run RX thread, within the bounds set by NAPI. |
6126 | * All RX "locking" is done by ensuring outside | 6136 | * All RX "locking" is done by ensuring outside |
6127 | * code synchronizes with tg3->napi.poll() | 6137 | * code synchronizes with tg3->napi.poll() |
@@ -7565,6 +7575,12 @@ static int tg3_alloc_consistent(struct tg3 *tp) | |||
7565 | */ | 7575 | */ |
7566 | switch (i) { | 7576 | switch (i) { |
7567 | default: | 7577 | default: |
7578 | if (tg3_flag(tp, ENABLE_RSS)) { | ||
7579 | tnapi->rx_rcb_prod_idx = NULL; | ||
7580 | break; | ||
7581 | } | ||
7582 | /* Fall through */ | ||
7583 | case 1: | ||
7568 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; | 7584 | tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer; |
7569 | break; | 7585 | break; |
7570 | case 2: | 7586 | case 2: |
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c index 63bfdd10bd6d..abb6ce7c1b7e 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c +++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c | |||
@@ -1150,6 +1150,48 @@ release_tpsram: | |||
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | /** | 1152 | /** |
1153 | * t3_synchronize_rx - wait for current Rx processing on a port to complete | ||
1154 | * @adap: the adapter | ||
1155 | * @p: the port | ||
1156 | * | ||
1157 | * Ensures that current Rx processing on any of the queues associated with | ||
1158 | * the given port completes before returning. We do this by acquiring and | ||
1159 | * releasing the locks of the response queues associated with the port. | ||
1160 | */ | ||
1161 | static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | ||
1162 | { | ||
1163 | int i; | ||
1164 | |||
1165 | for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | ||
1166 | struct sge_rspq *q = &adap->sge.qs[i].rspq; | ||
1167 | |||
1168 | spin_lock_irq(&q->lock); | ||
1169 | spin_unlock_irq(&q->lock); | ||
1170 | } | ||
1171 | } | ||
1172 | |||
1173 | static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | ||
1174 | { | ||
1175 | struct port_info *pi = netdev_priv(dev); | ||
1176 | struct adapter *adapter = pi->adapter; | ||
1177 | |||
1178 | if (adapter->params.rev > 0) { | ||
1179 | t3_set_vlan_accel(adapter, 1 << pi->port_id, | ||
1180 | features & NETIF_F_HW_VLAN_RX); | ||
1181 | } else { | ||
1182 | /* single control for all ports */ | ||
1183 | unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | ||
1184 | |||
1185 | for_each_port(adapter, i) | ||
1186 | have_vlans |= | ||
1187 | adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | ||
1188 | |||
1189 | t3_set_vlan_accel(adapter, 1, have_vlans); | ||
1190 | } | ||
1191 | t3_synchronize_rx(adapter, pi); | ||
1192 | } | ||
1193 | |||
1194 | /** | ||
1153 | * cxgb_up - enable the adapter | 1195 | * cxgb_up - enable the adapter |
1154 | * @adapter: adapter being enabled | 1196 | * @adapter: adapter being enabled |
1155 | * | 1197 | * |
@@ -1161,7 +1203,7 @@ release_tpsram: | |||
1161 | */ | 1203 | */ |
1162 | static int cxgb_up(struct adapter *adap) | 1204 | static int cxgb_up(struct adapter *adap) |
1163 | { | 1205 | { |
1164 | int err; | 1206 | int i, err; |
1165 | 1207 | ||
1166 | if (!(adap->flags & FULL_INIT_DONE)) { | 1208 | if (!(adap->flags & FULL_INIT_DONE)) { |
1167 | err = t3_check_fw_version(adap); | 1209 | err = t3_check_fw_version(adap); |
@@ -1198,6 +1240,9 @@ static int cxgb_up(struct adapter *adap) | |||
1198 | if (err) | 1240 | if (err) |
1199 | goto out; | 1241 | goto out; |
1200 | 1242 | ||
1243 | for_each_port(adap, i) | ||
1244 | cxgb_vlan_mode(adap->port[i], adap->port[i]->features); | ||
1245 | |||
1201 | setup_rss(adap); | 1246 | setup_rss(adap); |
1202 | if (!(adap->flags & NAPI_INIT)) | 1247 | if (!(adap->flags & NAPI_INIT)) |
1203 | init_napi(adap); | 1248 | init_napi(adap); |
@@ -2508,48 +2553,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p) | |||
2508 | return 0; | 2553 | return 0; |
2509 | } | 2554 | } |
2510 | 2555 | ||
2511 | /** | ||
2512 | * t3_synchronize_rx - wait for current Rx processing on a port to complete | ||
2513 | * @adap: the adapter | ||
2514 | * @p: the port | ||
2515 | * | ||
2516 | * Ensures that current Rx processing on any of the queues associated with | ||
2517 | * the given port completes before returning. We do this by acquiring and | ||
2518 | * releasing the locks of the response queues associated with the port. | ||
2519 | */ | ||
2520 | static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) | ||
2521 | { | ||
2522 | int i; | ||
2523 | |||
2524 | for (i = p->first_qset; i < p->first_qset + p->nqsets; i++) { | ||
2525 | struct sge_rspq *q = &adap->sge.qs[i].rspq; | ||
2526 | |||
2527 | spin_lock_irq(&q->lock); | ||
2528 | spin_unlock_irq(&q->lock); | ||
2529 | } | ||
2530 | } | ||
2531 | |||
2532 | static void cxgb_vlan_mode(struct net_device *dev, netdev_features_t features) | ||
2533 | { | ||
2534 | struct port_info *pi = netdev_priv(dev); | ||
2535 | struct adapter *adapter = pi->adapter; | ||
2536 | |||
2537 | if (adapter->params.rev > 0) { | ||
2538 | t3_set_vlan_accel(adapter, 1 << pi->port_id, | ||
2539 | features & NETIF_F_HW_VLAN_RX); | ||
2540 | } else { | ||
2541 | /* single control for all ports */ | ||
2542 | unsigned int i, have_vlans = features & NETIF_F_HW_VLAN_RX; | ||
2543 | |||
2544 | for_each_port(adapter, i) | ||
2545 | have_vlans |= | ||
2546 | adapter->port[i]->features & NETIF_F_HW_VLAN_RX; | ||
2547 | |||
2548 | t3_set_vlan_accel(adapter, 1, have_vlans); | ||
2549 | } | ||
2550 | t3_synchronize_rx(adapter, pi); | ||
2551 | } | ||
2552 | |||
2553 | static netdev_features_t cxgb_fix_features(struct net_device *dev, | 2556 | static netdev_features_t cxgb_fix_features(struct net_device *dev, |
2554 | netdev_features_t features) | 2557 | netdev_features_t features) |
2555 | { | 2558 | { |
@@ -3353,9 +3356,6 @@ static int __devinit init_one(struct pci_dev *pdev, | |||
3353 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, | 3356 | err = sysfs_create_group(&adapter->port[0]->dev.kobj, |
3354 | &cxgb3_attr_group); | 3357 | &cxgb3_attr_group); |
3355 | 3358 | ||
3356 | for_each_port(adapter, i) | ||
3357 | cxgb_vlan_mode(adapter->port[i], adapter->port[i]->features); | ||
3358 | |||
3359 | print_port_info(adapter, ai); | 3359 | print_port_info(adapter, ai); |
3360 | return 0; | 3360 | return 0; |
3361 | 3361 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 05ff076af06d..b126b98065a9 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -2000,13 +2000,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = { | |||
2000 | /* | 2000 | /* |
2001 | * debugfs support | 2001 | * debugfs support |
2002 | */ | 2002 | */ |
2003 | |||
2004 | static int mem_open(struct inode *inode, struct file *file) | ||
2005 | { | ||
2006 | file->private_data = inode->i_private; | ||
2007 | return 0; | ||
2008 | } | ||
2009 | |||
2010 | static ssize_t mem_read(struct file *file, char __user *buf, size_t count, | 2003 | static ssize_t mem_read(struct file *file, char __user *buf, size_t count, |
2011 | loff_t *ppos) | 2004 | loff_t *ppos) |
2012 | { | 2005 | { |
@@ -2050,7 +2043,7 @@ static ssize_t mem_read(struct file *file, char __user *buf, size_t count, | |||
2050 | 2043 | ||
2051 | static const struct file_operations mem_debugfs_fops = { | 2044 | static const struct file_operations mem_debugfs_fops = { |
2052 | .owner = THIS_MODULE, | 2045 | .owner = THIS_MODULE, |
2053 | .open = mem_open, | 2046 | .open = simple_open, |
2054 | .read = mem_read, | 2047 | .read = mem_read, |
2055 | .llseek = default_llseek, | 2048 | .llseek = default_llseek, |
2056 | }; | 2049 | }; |
diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c index b2dc2c81a147..2e09edb9cdf8 100644 --- a/drivers/net/ethernet/dlink/dl2k.c +++ b/drivers/net/ethernet/dlink/dl2k.c | |||
@@ -1259,55 +1259,21 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) | |||
1259 | { | 1259 | { |
1260 | int phy_addr; | 1260 | int phy_addr; |
1261 | struct netdev_private *np = netdev_priv(dev); | 1261 | struct netdev_private *np = netdev_priv(dev); |
1262 | struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru; | 1262 | struct mii_ioctl_data *miidata = if_mii(rq); |
1263 | |||
1264 | struct netdev_desc *desc; | ||
1265 | int i; | ||
1266 | 1263 | ||
1267 | phy_addr = np->phy_addr; | 1264 | phy_addr = np->phy_addr; |
1268 | switch (cmd) { | 1265 | switch (cmd) { |
1269 | case SIOCDEVPRIVATE: | 1266 | case SIOCGMIIPHY: |
1270 | break; | 1267 | miidata->phy_id = phy_addr; |
1271 | |||
1272 | case SIOCDEVPRIVATE + 1: | ||
1273 | miidata->out_value = mii_read (dev, phy_addr, miidata->reg_num); | ||
1274 | break; | 1268 | break; |
1275 | case SIOCDEVPRIVATE + 2: | 1269 | case SIOCGMIIREG: |
1276 | mii_write (dev, phy_addr, miidata->reg_num, miidata->in_value); | 1270 | miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num); |
1277 | break; | 1271 | break; |
1278 | case SIOCDEVPRIVATE + 3: | 1272 | case SIOCSMIIREG: |
1279 | break; | 1273 | if (!capable(CAP_NET_ADMIN)) |
1280 | case SIOCDEVPRIVATE + 4: | 1274 | return -EPERM; |
1281 | break; | 1275 | mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in); |
1282 | case SIOCDEVPRIVATE + 5: | ||
1283 | netif_stop_queue (dev); | ||
1284 | break; | 1276 | break; |
1285 | case SIOCDEVPRIVATE + 6: | ||
1286 | netif_wake_queue (dev); | ||
1287 | break; | ||
1288 | case SIOCDEVPRIVATE + 7: | ||
1289 | printk | ||
1290 | ("tx_full=%x cur_tx=%lx old_tx=%lx cur_rx=%lx old_rx=%lx\n", | ||
1291 | netif_queue_stopped(dev), np->cur_tx, np->old_tx, np->cur_rx, | ||
1292 | np->old_rx); | ||
1293 | break; | ||
1294 | case SIOCDEVPRIVATE + 8: | ||
1295 | printk("TX ring:\n"); | ||
1296 | for (i = 0; i < TX_RING_SIZE; i++) { | ||
1297 | desc = &np->tx_ring[i]; | ||
1298 | printk | ||
1299 | ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x", | ||
1300 | i, | ||
1301 | (u32) (np->tx_ring_dma + i * sizeof (*desc)), | ||
1302 | (u32)le64_to_cpu(desc->next_desc), | ||
1303 | (u32)le64_to_cpu(desc->status), | ||
1304 | (u32)(le64_to_cpu(desc->fraginfo) >> 32), | ||
1305 | (u32)le64_to_cpu(desc->fraginfo)); | ||
1306 | printk ("\n"); | ||
1307 | } | ||
1308 | printk ("\n"); | ||
1309 | break; | ||
1310 | |||
1311 | default: | 1277 | default: |
1312 | return -EOPNOTSUPP; | 1278 | return -EOPNOTSUPP; |
1313 | } | 1279 | } |
diff --git a/drivers/net/ethernet/dlink/dl2k.h b/drivers/net/ethernet/dlink/dl2k.h index ba0adcafa55a..30c2da3de548 100644 --- a/drivers/net/ethernet/dlink/dl2k.h +++ b/drivers/net/ethernet/dlink/dl2k.h | |||
@@ -365,13 +365,6 @@ struct ioctl_data { | |||
365 | char *data; | 365 | char *data; |
366 | }; | 366 | }; |
367 | 367 | ||
368 | struct mii_data { | ||
369 | __u16 reserved; | ||
370 | __u16 reg_num; | ||
371 | __u16 in_value; | ||
372 | __u16 out_value; | ||
373 | }; | ||
374 | |||
375 | /* The Rx and Tx buffer descriptors. */ | 368 | /* The Rx and Tx buffer descriptors. */ |
376 | struct netdev_desc { | 369 | struct netdev_desc { |
377 | __le64 next_desc; | 370 | __le64 next_desc; |
diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 9eb815941df5..f7f0bf5d037b 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c | |||
@@ -356,13 +356,13 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev) | |||
356 | 356 | ||
357 | if (prop) | 357 | if (prop) |
358 | tbiaddr = *prop; | 358 | tbiaddr = *prop; |
359 | } | ||
360 | 359 | ||
361 | if (tbiaddr == -1) { | 360 | if (tbiaddr == -1) { |
362 | err = -EBUSY; | 361 | err = -EBUSY; |
363 | goto err_free_irqs; | 362 | goto err_free_irqs; |
364 | } else { | 363 | } else { |
365 | out_be32(tbipa, tbiaddr); | 364 | out_be32(tbipa, tbiaddr); |
365 | } | ||
366 | } | 366 | } |
367 | 367 | ||
368 | err = of_mdiobus_register(new_bus, np); | 368 | err = of_mdiobus_register(new_bus, np); |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 4e3cd2f8debb..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, |
@@ -3945,6 +3945,8 @@ static int ucc_geth_probe(struct platform_device* ofdev) | |||
3945 | } | 3945 | } |
3946 | 3946 | ||
3947 | if (max_speed == SPEED_1000) { | 3947 | if (max_speed == SPEED_1000) { |
3948 | unsigned int snums = qe_get_num_of_snums(); | ||
3949 | |||
3948 | /* configure muram FIFOs for gigabit operation */ | 3950 | /* configure muram FIFOs for gigabit operation */ |
3949 | ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT; | 3951 | ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT; |
3950 | ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT; | 3952 | ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT; |
@@ -3954,11 +3956,11 @@ static int ucc_geth_probe(struct platform_device* ofdev) | |||
3954 | ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; | 3956 | ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT; |
3955 | ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4; | 3957 | ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4; |
3956 | 3958 | ||
3957 | /* If QE's snum number is 46 which means we need to support | 3959 | /* If QE's snum number is 46/76 which means we need to support |
3958 | * 4 UECs at 1000Base-T simultaneously, we need to allocate | 3960 | * 4 UECs at 1000Base-T simultaneously, we need to allocate |
3959 | * more Threads to Rx. | 3961 | * more Threads to Rx. |
3960 | */ | 3962 | */ |
3961 | if (qe_get_num_of_snums() == 46) | 3963 | if ((snums == 76) || (snums == 46)) |
3962 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_6; | 3964 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_6; |
3963 | else | 3965 | else |
3964 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; | 3966 | ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4; |
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 0e9aec8f6917..4348b6fd44fa 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -164,6 +164,8 @@ static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter, | |||
164 | static bool e1000_vlan_used(struct e1000_adapter *adapter); | 164 | static bool e1000_vlan_used(struct e1000_adapter *adapter); |
165 | static void e1000_vlan_mode(struct net_device *netdev, | 165 | static void e1000_vlan_mode(struct net_device *netdev, |
166 | netdev_features_t features); | 166 | netdev_features_t features); |
167 | static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, | ||
168 | bool filter_on); | ||
167 | static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid); | 169 | static int e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid); |
168 | static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); | 170 | static int e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid); |
169 | static void e1000_restore_vlan(struct e1000_adapter *adapter); | 171 | static void e1000_restore_vlan(struct e1000_adapter *adapter); |
@@ -215,7 +217,8 @@ MODULE_DESCRIPTION("Intel(R) PRO/1000 Network Driver"); | |||
215 | MODULE_LICENSE("GPL"); | 217 | MODULE_LICENSE("GPL"); |
216 | MODULE_VERSION(DRV_VERSION); | 218 | MODULE_VERSION(DRV_VERSION); |
217 | 219 | ||
218 | static int debug = NETIF_MSG_DRV | NETIF_MSG_PROBE; | 220 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) |
221 | static int debug = -1; | ||
219 | module_param(debug, int, 0); | 222 | module_param(debug, int, 0); |
220 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | 223 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
221 | 224 | ||
@@ -979,7 +982,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
979 | adapter = netdev_priv(netdev); | 982 | adapter = netdev_priv(netdev); |
980 | adapter->netdev = netdev; | 983 | adapter->netdev = netdev; |
981 | adapter->pdev = pdev; | 984 | adapter->pdev = pdev; |
982 | adapter->msg_enable = (1 << debug) - 1; | 985 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
983 | adapter->bars = bars; | 986 | adapter->bars = bars; |
984 | adapter->need_ioport = need_ioport; | 987 | adapter->need_ioport = need_ioport; |
985 | 988 | ||
@@ -1214,7 +1217,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
1214 | if (err) | 1217 | if (err) |
1215 | goto err_register; | 1218 | goto err_register; |
1216 | 1219 | ||
1217 | e1000_vlan_mode(netdev, netdev->features); | 1220 | e1000_vlan_filter_on_off(adapter, false); |
1218 | 1221 | ||
1219 | /* print bus type/speed/width info */ | 1222 | /* print bus type/speed/width info */ |
1220 | e_info(probe, "(PCI%s:%dMHz:%d-bit) %pM\n", | 1223 | e_info(probe, "(PCI%s:%dMHz:%d-bit) %pM\n", |
@@ -4770,6 +4773,22 @@ static bool e1000_vlan_used(struct e1000_adapter *adapter) | |||
4770 | return false; | 4773 | return false; |
4771 | } | 4774 | } |
4772 | 4775 | ||
4776 | static void __e1000_vlan_mode(struct e1000_adapter *adapter, | ||
4777 | netdev_features_t features) | ||
4778 | { | ||
4779 | struct e1000_hw *hw = &adapter->hw; | ||
4780 | u32 ctrl; | ||
4781 | |||
4782 | ctrl = er32(CTRL); | ||
4783 | if (features & NETIF_F_HW_VLAN_RX) { | ||
4784 | /* enable VLAN tag insert/strip */ | ||
4785 | ctrl |= E1000_CTRL_VME; | ||
4786 | } else { | ||
4787 | /* disable VLAN tag insert/strip */ | ||
4788 | ctrl &= ~E1000_CTRL_VME; | ||
4789 | } | ||
4790 | ew32(CTRL, ctrl); | ||
4791 | } | ||
4773 | static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, | 4792 | static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, |
4774 | bool filter_on) | 4793 | bool filter_on) |
4775 | { | 4794 | { |
@@ -4779,6 +4798,7 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, | |||
4779 | if (!test_bit(__E1000_DOWN, &adapter->flags)) | 4798 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
4780 | e1000_irq_disable(adapter); | 4799 | e1000_irq_disable(adapter); |
4781 | 4800 | ||
4801 | __e1000_vlan_mode(adapter, adapter->netdev->features); | ||
4782 | if (filter_on) { | 4802 | if (filter_on) { |
4783 | /* enable VLAN receive filtering */ | 4803 | /* enable VLAN receive filtering */ |
4784 | rctl = er32(RCTL); | 4804 | rctl = er32(RCTL); |
@@ -4799,24 +4819,14 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter, | |||
4799 | } | 4819 | } |
4800 | 4820 | ||
4801 | static void e1000_vlan_mode(struct net_device *netdev, | 4821 | static void e1000_vlan_mode(struct net_device *netdev, |
4802 | netdev_features_t features) | 4822 | netdev_features_t features) |
4803 | { | 4823 | { |
4804 | struct e1000_adapter *adapter = netdev_priv(netdev); | 4824 | struct e1000_adapter *adapter = netdev_priv(netdev); |
4805 | struct e1000_hw *hw = &adapter->hw; | ||
4806 | u32 ctrl; | ||
4807 | 4825 | ||
4808 | if (!test_bit(__E1000_DOWN, &adapter->flags)) | 4826 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
4809 | e1000_irq_disable(adapter); | 4827 | e1000_irq_disable(adapter); |
4810 | 4828 | ||
4811 | ctrl = er32(CTRL); | 4829 | __e1000_vlan_mode(adapter, features); |
4812 | if (features & NETIF_F_HW_VLAN_RX) { | ||
4813 | /* enable VLAN tag insert/strip */ | ||
4814 | ctrl |= E1000_CTRL_VME; | ||
4815 | } else { | ||
4816 | /* disable VLAN tag insert/strip */ | ||
4817 | ctrl &= ~E1000_CTRL_VME; | ||
4818 | } | ||
4819 | ew32(CTRL, ctrl); | ||
4820 | 4830 | ||
4821 | if (!test_bit(__E1000_DOWN, &adapter->flags)) | 4831 | if (!test_bit(__E1000_DOWN, &adapter->flags)) |
4822 | e1000_irq_enable(adapter); | 4832 | e1000_irq_enable(adapter); |
diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h index 86cdd4793992..b83897f76ee3 100644 --- a/drivers/net/ethernet/intel/e1000e/e1000.h +++ b/drivers/net/ethernet/intel/e1000e/e1000.h | |||
@@ -161,6 +161,12 @@ struct e1000_info; | |||
161 | /* Time to wait before putting the device into D3 if there's no link (in ms). */ | 161 | /* Time to wait before putting the device into D3 if there's no link (in ms). */ |
162 | #define LINK_TIMEOUT 100 | 162 | #define LINK_TIMEOUT 100 |
163 | 163 | ||
164 | /* | ||
165 | * Count for polling __E1000_RESET condition every 10-20msec. | ||
166 | * Experimentation has shown the reset can take approximately 210msec. | ||
167 | */ | ||
168 | #define E1000_CHECK_RESET_COUNT 25 | ||
169 | |||
164 | #define DEFAULT_RDTR 0 | 170 | #define DEFAULT_RDTR 0 |
165 | #define DEFAULT_RADV 8 | 171 | #define DEFAULT_RADV 8 |
166 | #define BURST_RDTR 0x20 | 172 | #define BURST_RDTR 0x20 |
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 64c76443a7aa..b461c24945e3 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c | |||
@@ -1310,10 +1310,6 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
1310 | 1310 | ||
1311 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) | 1311 | if (mac_reg & E1000_PHY_CTRL_D0A_LPLU) |
1312 | oem_reg |= HV_OEM_BITS_LPLU; | 1312 | oem_reg |= HV_OEM_BITS_LPLU; |
1313 | |||
1314 | /* Set Restart auto-neg to activate the bits */ | ||
1315 | if (!hw->phy.ops.check_reset_block(hw)) | ||
1316 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
1317 | } else { | 1313 | } else { |
1318 | if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | | 1314 | if (mac_reg & (E1000_PHY_CTRL_GBE_DISABLE | |
1319 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) | 1315 | E1000_PHY_CTRL_NOND0A_GBE_DISABLE)) |
@@ -1324,6 +1320,11 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
1324 | oem_reg |= HV_OEM_BITS_LPLU; | 1320 | oem_reg |= HV_OEM_BITS_LPLU; |
1325 | } | 1321 | } |
1326 | 1322 | ||
1323 | /* Set Restart auto-neg to activate the bits */ | ||
1324 | if ((d0_state || (hw->mac.type != e1000_pchlan)) && | ||
1325 | !hw->phy.ops.check_reset_block(hw)) | ||
1326 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
1327 | |||
1327 | ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); | 1328 | ret_val = hw->phy.ops.write_reg_locked(hw, HV_OEM_BITS, oem_reg); |
1328 | 1329 | ||
1329 | release: | 1330 | release: |
@@ -3682,7 +3683,11 @@ void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw) | |||
3682 | 3683 | ||
3683 | if (hw->mac.type >= e1000_pchlan) { | 3684 | if (hw->mac.type >= e1000_pchlan) { |
3684 | e1000_oem_bits_config_ich8lan(hw, false); | 3685 | e1000_oem_bits_config_ich8lan(hw, false); |
3685 | e1000_phy_hw_reset_ich8lan(hw); | 3686 | |
3687 | /* Reset PHY to activate OEM bits on 82577/8 */ | ||
3688 | if (hw->mac.type == e1000_pchlan) | ||
3689 | e1000e_phy_hw_reset_generic(hw); | ||
3690 | |||
3686 | ret_val = hw->phy.ops.acquire(hw); | 3691 | ret_val = hw->phy.ops.acquire(hw); |
3687 | if (ret_val) | 3692 | if (ret_val) |
3688 | return; | 3693 | return; |
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index 7152eb11b7b9..9520a6ac1f30 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c | |||
@@ -60,6 +60,11 @@ | |||
60 | char e1000e_driver_name[] = "e1000e"; | 60 | char e1000e_driver_name[] = "e1000e"; |
61 | const char e1000e_driver_version[] = DRV_VERSION; | 61 | const char e1000e_driver_version[] = DRV_VERSION; |
62 | 62 | ||
63 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) | ||
64 | static int debug = -1; | ||
65 | module_param(debug, int, 0); | ||
66 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
67 | |||
63 | static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state); | 68 | static void e1000e_disable_aspm(struct pci_dev *pdev, u16 state); |
64 | 69 | ||
65 | static const struct e1000_info *e1000_info_tbl[] = { | 70 | static const struct e1000_info *e1000_info_tbl[] = { |
@@ -1054,6 +1059,13 @@ static void e1000_print_hw_hang(struct work_struct *work) | |||
1054 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | 1059 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); |
1055 | /* execute the writes immediately */ | 1060 | /* execute the writes immediately */ |
1056 | e1e_flush(); | 1061 | e1e_flush(); |
1062 | /* | ||
1063 | * Due to rare timing issues, write to TIDV again to ensure | ||
1064 | * the write is successful | ||
1065 | */ | ||
1066 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | ||
1067 | /* execute the writes immediately */ | ||
1068 | e1e_flush(); | ||
1057 | adapter->tx_hang_recheck = true; | 1069 | adapter->tx_hang_recheck = true; |
1058 | return; | 1070 | return; |
1059 | } | 1071 | } |
@@ -3611,6 +3623,16 @@ static void e1000e_flush_descriptors(struct e1000_adapter *adapter) | |||
3611 | 3623 | ||
3612 | /* execute the writes immediately */ | 3624 | /* execute the writes immediately */ |
3613 | e1e_flush(); | 3625 | e1e_flush(); |
3626 | |||
3627 | /* | ||
3628 | * due to rare timing issues, write to TIDV/RDTR again to ensure the | ||
3629 | * write is successful | ||
3630 | */ | ||
3631 | ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); | ||
3632 | ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); | ||
3633 | |||
3634 | /* execute the writes immediately */ | ||
3635 | e1e_flush(); | ||
3614 | } | 3636 | } |
3615 | 3637 | ||
3616 | static void e1000e_update_stats(struct e1000_adapter *adapter); | 3638 | static void e1000e_update_stats(struct e1000_adapter *adapter); |
@@ -3777,7 +3799,7 @@ static int e1000_test_msi_interrupt(struct e1000_adapter *adapter) | |||
3777 | /* fire an unusual interrupt on the test handler */ | 3799 | /* fire an unusual interrupt on the test handler */ |
3778 | ew32(ICS, E1000_ICS_RXSEQ); | 3800 | ew32(ICS, E1000_ICS_RXSEQ); |
3779 | e1e_flush(); | 3801 | e1e_flush(); |
3780 | msleep(50); | 3802 | msleep(100); |
3781 | 3803 | ||
3782 | e1000_irq_disable(adapter); | 3804 | e1000_irq_disable(adapter); |
3783 | 3805 | ||
@@ -3963,6 +3985,10 @@ static int e1000_close(struct net_device *netdev) | |||
3963 | { | 3985 | { |
3964 | struct e1000_adapter *adapter = netdev_priv(netdev); | 3986 | struct e1000_adapter *adapter = netdev_priv(netdev); |
3965 | struct pci_dev *pdev = adapter->pdev; | 3987 | struct pci_dev *pdev = adapter->pdev; |
3988 | int count = E1000_CHECK_RESET_COUNT; | ||
3989 | |||
3990 | while (test_bit(__E1000_RESETTING, &adapter->state) && count--) | ||
3991 | usleep_range(10000, 20000); | ||
3966 | 3992 | ||
3967 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); | 3993 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
3968 | 3994 | ||
@@ -5467,6 +5493,11 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool *enable_wake, | |||
5467 | netif_device_detach(netdev); | 5493 | netif_device_detach(netdev); |
5468 | 5494 | ||
5469 | if (netif_running(netdev)) { | 5495 | if (netif_running(netdev)) { |
5496 | int count = E1000_CHECK_RESET_COUNT; | ||
5497 | |||
5498 | while (test_bit(__E1000_RESETTING, &adapter->state) && count--) | ||
5499 | usleep_range(10000, 20000); | ||
5500 | |||
5470 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); | 5501 | WARN_ON(test_bit(__E1000_RESETTING, &adapter->state)); |
5471 | e1000e_down(adapter); | 5502 | e1000e_down(adapter); |
5472 | e1000_free_irq(adapter); | 5503 | e1000_free_irq(adapter); |
@@ -6172,7 +6203,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
6172 | adapter->hw.adapter = adapter; | 6203 | adapter->hw.adapter = adapter; |
6173 | adapter->hw.mac.type = ei->mac; | 6204 | adapter->hw.mac.type = ei->mac; |
6174 | adapter->max_hw_frame_size = ei->max_hw_frame_size; | 6205 | adapter->max_hw_frame_size = ei->max_hw_frame_size; |
6175 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; | 6206 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
6176 | 6207 | ||
6177 | mmio_start = pci_resource_start(pdev, 0); | 6208 | mmio_start = pci_resource_start(pdev, 0); |
6178 | mmio_len = pci_resource_len(pdev, 0); | 6209 | mmio_len = pci_resource_len(pdev, 0); |
diff --git a/drivers/net/ethernet/intel/e1000e/param.c b/drivers/net/ethernet/intel/e1000e/param.c index ff796e42c3eb..16adeb9418a8 100644 --- a/drivers/net/ethernet/intel/e1000e/param.c +++ b/drivers/net/ethernet/intel/e1000e/param.c | |||
@@ -106,7 +106,7 @@ E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay"); | |||
106 | /* | 106 | /* |
107 | * Interrupt Throttle Rate (interrupts/sec) | 107 | * Interrupt Throttle Rate (interrupts/sec) |
108 | * | 108 | * |
109 | * Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative) | 109 | * Valid Range: 100-100000 or one of: 0=off, 1=dynamic, 3=dynamic conservative |
110 | */ | 110 | */ |
111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); | 111 | E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate"); |
112 | #define DEFAULT_ITR 3 | 112 | #define DEFAULT_ITR 3 |
@@ -344,53 +344,60 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter) | |||
344 | 344 | ||
345 | if (num_InterruptThrottleRate > bd) { | 345 | if (num_InterruptThrottleRate > bd) { |
346 | adapter->itr = InterruptThrottleRate[bd]; | 346 | adapter->itr = InterruptThrottleRate[bd]; |
347 | switch (adapter->itr) { | 347 | |
348 | case 0: | 348 | /* |
349 | e_info("%s turned off\n", opt.name); | 349 | * Make sure a message is printed for non-special |
350 | break; | 350 | * values. And in case of an invalid option, display |
351 | case 1: | 351 | * warning, use default and got through itr/itr_setting |
352 | e_info("%s set to dynamic mode\n", opt.name); | 352 | * adjustment logic below |
353 | adapter->itr_setting = adapter->itr; | 353 | */ |
354 | adapter->itr = 20000; | 354 | if ((adapter->itr > 4) && |
355 | break; | 355 | e1000_validate_option(&adapter->itr, &opt, adapter)) |
356 | case 3: | 356 | adapter->itr = opt.def; |
357 | e_info("%s set to dynamic conservative mode\n", | ||
358 | opt.name); | ||
359 | adapter->itr_setting = adapter->itr; | ||
360 | adapter->itr = 20000; | ||
361 | break; | ||
362 | case 4: | ||
363 | e_info("%s set to simplified (2000-8000 ints) " | ||
364 | "mode\n", opt.name); | ||
365 | adapter->itr_setting = 4; | ||
366 | break; | ||
367 | default: | ||
368 | /* | ||
369 | * Save the setting, because the dynamic bits | ||
370 | * change itr. | ||
371 | */ | ||
372 | if (e1000_validate_option(&adapter->itr, &opt, | ||
373 | adapter) && | ||
374 | (adapter->itr == 3)) { | ||
375 | /* | ||
376 | * In case of invalid user value, | ||
377 | * default to conservative mode. | ||
378 | */ | ||
379 | adapter->itr_setting = adapter->itr; | ||
380 | adapter->itr = 20000; | ||
381 | } else { | ||
382 | /* | ||
383 | * Clear the lower two bits because | ||
384 | * they are used as control. | ||
385 | */ | ||
386 | adapter->itr_setting = | ||
387 | adapter->itr & ~3; | ||
388 | } | ||
389 | break; | ||
390 | } | ||
391 | } else { | 357 | } else { |
392 | adapter->itr_setting = opt.def; | 358 | /* |
359 | * If no option specified, use default value and go | ||
360 | * through the logic below to adjust itr/itr_setting | ||
361 | */ | ||
362 | adapter->itr = opt.def; | ||
363 | |||
364 | /* | ||
365 | * Make sure a message is printed for non-special | ||
366 | * default values | ||
367 | */ | ||
368 | if (adapter->itr > 40) | ||
369 | e_info("%s set to default %d\n", opt.name, | ||
370 | adapter->itr); | ||
371 | } | ||
372 | |||
373 | adapter->itr_setting = adapter->itr; | ||
374 | switch (adapter->itr) { | ||
375 | case 0: | ||
376 | e_info("%s turned off\n", opt.name); | ||
377 | break; | ||
378 | case 1: | ||
379 | e_info("%s set to dynamic mode\n", opt.name); | ||
380 | adapter->itr = 20000; | ||
381 | break; | ||
382 | case 3: | ||
383 | e_info("%s set to dynamic conservative mode\n", | ||
384 | opt.name); | ||
393 | adapter->itr = 20000; | 385 | adapter->itr = 20000; |
386 | break; | ||
387 | case 4: | ||
388 | e_info("%s set to simplified (2000-8000 ints) mode\n", | ||
389 | opt.name); | ||
390 | break; | ||
391 | default: | ||
392 | /* | ||
393 | * Save the setting, because the dynamic bits | ||
394 | * change itr. | ||
395 | * | ||
396 | * Clear the lower two bits because | ||
397 | * they are used as control. | ||
398 | */ | ||
399 | adapter->itr_setting &= ~3; | ||
400 | break; | ||
394 | } | 401 | } |
395 | } | 402 | } |
396 | { /* Interrupt Mode */ | 403 | { /* Interrupt Mode */ |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index c4902411d749..5ec31598ee47 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -238,6 +238,11 @@ MODULE_DESCRIPTION("Intel(R) Gigabit Ethernet Network Driver"); | |||
238 | MODULE_LICENSE("GPL"); | 238 | MODULE_LICENSE("GPL"); |
239 | MODULE_VERSION(DRV_VERSION); | 239 | MODULE_VERSION(DRV_VERSION); |
240 | 240 | ||
241 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) | ||
242 | static int debug = -1; | ||
243 | module_param(debug, int, 0); | ||
244 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
245 | |||
241 | struct igb_reg_info { | 246 | struct igb_reg_info { |
242 | u32 ofs; | 247 | u32 ofs; |
243 | char *name; | 248 | char *name; |
@@ -1893,7 +1898,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, | |||
1893 | adapter->pdev = pdev; | 1898 | adapter->pdev = pdev; |
1894 | hw = &adapter->hw; | 1899 | hw = &adapter->hw; |
1895 | hw->back = adapter; | 1900 | hw->back = adapter; |
1896 | adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE; | 1901 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
1897 | 1902 | ||
1898 | mmio_start = pci_resource_start(pdev, 0); | 1903 | mmio_start = pci_resource_start(pdev, 0); |
1899 | mmio_len = pci_resource_len(pdev, 0); | 1904 | mmio_len = pci_resource_len(pdev, 0); |
diff --git a/drivers/net/ethernet/intel/igbvf/netdev.c b/drivers/net/ethernet/intel/igbvf/netdev.c index 217c143686d2..8ec74b07f940 100644 --- a/drivers/net/ethernet/intel/igbvf/netdev.c +++ b/drivers/net/ethernet/intel/igbvf/netdev.c | |||
@@ -55,6 +55,11 @@ static const char igbvf_driver_string[] = | |||
55 | static const char igbvf_copyright[] = | 55 | static const char igbvf_copyright[] = |
56 | "Copyright (c) 2009 - 2012 Intel Corporation."; | 56 | "Copyright (c) 2009 - 2012 Intel Corporation."; |
57 | 57 | ||
58 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) | ||
59 | static int debug = -1; | ||
60 | module_param(debug, int, 0); | ||
61 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
62 | |||
58 | static int igbvf_poll(struct napi_struct *napi, int budget); | 63 | static int igbvf_poll(struct napi_struct *napi, int budget); |
59 | static void igbvf_reset(struct igbvf_adapter *); | 64 | static void igbvf_reset(struct igbvf_adapter *); |
60 | static void igbvf_set_interrupt_capability(struct igbvf_adapter *); | 65 | static void igbvf_set_interrupt_capability(struct igbvf_adapter *); |
@@ -2649,7 +2654,7 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2649 | adapter->flags = ei->flags; | 2654 | adapter->flags = ei->flags; |
2650 | adapter->hw.back = adapter; | 2655 | adapter->hw.back = adapter; |
2651 | adapter->hw.mac.type = ei->mac; | 2656 | adapter->hw.mac.type = ei->mac; |
2652 | adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1; | 2657 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
2653 | 2658 | ||
2654 | /* PCI config space info */ | 2659 | /* PCI config space info */ |
2655 | 2660 | ||
@@ -2726,14 +2731,14 @@ static int __devinit igbvf_probe(struct pci_dev *pdev, | |||
2726 | netdev->addr_len); | 2731 | netdev->addr_len); |
2727 | } | 2732 | } |
2728 | 2733 | ||
2729 | if (!is_valid_ether_addr(netdev->perm_addr)) { | 2734 | if (!is_valid_ether_addr(netdev->dev_addr)) { |
2730 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", | 2735 | dev_err(&pdev->dev, "Invalid MAC Address: %pM\n", |
2731 | netdev->dev_addr); | 2736 | netdev->dev_addr); |
2732 | err = -EIO; | 2737 | err = -EIO; |
2733 | goto err_hw_init; | 2738 | goto err_hw_init; |
2734 | } | 2739 | } |
2735 | 2740 | ||
2736 | memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len); | 2741 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); |
2737 | 2742 | ||
2738 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, | 2743 | setup_timer(&adapter->watchdog_timer, &igbvf_watchdog, |
2739 | (unsigned long) adapter); | 2744 | (unsigned long) adapter); |
diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_main.c b/drivers/net/ethernet/intel/ixgb/ixgb_main.c index 82aaa792cbf3..5fce363d810a 100644 --- a/drivers/net/ethernet/intel/ixgb/ixgb_main.c +++ b/drivers/net/ethernet/intel/ixgb/ixgb_main.c | |||
@@ -134,8 +134,8 @@ MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver"); | |||
134 | MODULE_LICENSE("GPL"); | 134 | MODULE_LICENSE("GPL"); |
135 | MODULE_VERSION(DRV_VERSION); | 135 | MODULE_VERSION(DRV_VERSION); |
136 | 136 | ||
137 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 | 137 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) |
138 | static int debug = DEFAULT_DEBUG_LEVEL_SHIFT; | 138 | static int debug = -1; |
139 | module_param(debug, int, 0); | 139 | module_param(debug, int, 0); |
140 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | 140 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); |
141 | 141 | ||
@@ -442,7 +442,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
442 | adapter->netdev = netdev; | 442 | adapter->netdev = netdev; |
443 | adapter->pdev = pdev; | 443 | adapter->pdev = pdev; |
444 | adapter->hw.back = adapter; | 444 | adapter->hw.back = adapter; |
445 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_DEBUG_LEVEL_SHIFT); | 445 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
446 | 446 | ||
447 | adapter->hw.hw_addr = pci_ioremap_bar(pdev, BAR_0); | 447 | adapter->hw.hw_addr = pci_ioremap_bar(pdev, BAR_0); |
448 | if (!adapter->hw.hw_addr) { | 448 | if (!adapter->hw.hw_addr) { |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index 80e26ff30ebf..74e192107f9a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -544,7 +544,7 @@ struct ixgbe_fdir_filter { | |||
544 | u16 action; | 544 | u16 action; |
545 | }; | 545 | }; |
546 | 546 | ||
547 | enum ixbge_state_t { | 547 | enum ixgbe_state_t { |
548 | __IXGBE_TESTING, | 548 | __IXGBE_TESTING, |
549 | __IXGBE_RESETTING, | 549 | __IXGBE_RESETTING, |
550 | __IXGBE_DOWN, | 550 | __IXGBE_DOWN, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c index dde65f951400..652e4b09546d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_dcb_nl.c | |||
@@ -44,62 +44,94 @@ | |||
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 *src_dcb_cfg, | 47 | int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *scfg, |
48 | struct ixgbe_dcb_config *dst_dcb_cfg, int tc_max) | 48 | struct ixgbe_dcb_config *dcfg, int tc_max) |
49 | { | 49 | { |
50 | struct tc_configuration *src_tc_cfg = NULL; | 50 | struct tc_configuration *src = NULL; |
51 | struct tc_configuration *dst_tc_cfg = NULL; | 51 | struct tc_configuration *dst = NULL; |
52 | int i; | 52 | int i, j; |
53 | int tx = DCB_TX_CONFIG; | ||
54 | int rx = DCB_RX_CONFIG; | ||
55 | int changes = 0; | ||
53 | 56 | ||
54 | if (!src_dcb_cfg || !dst_dcb_cfg) | 57 | if (!scfg || !dcfg) |
55 | return -EINVAL; | 58 | return changes; |
56 | 59 | ||
57 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { | 60 | for (i = DCB_PG_ATTR_TC_0; i < tc_max + DCB_PG_ATTR_TC_0; i++) { |
58 | src_tc_cfg = &src_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; | 61 | src = &scfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
59 | dst_tc_cfg = &dst_dcb_cfg->tc_config[i - DCB_PG_ATTR_TC_0]; | 62 | dst = &dcfg->tc_config[i - DCB_PG_ATTR_TC_0]; |
60 | 63 | ||
61 | dst_tc_cfg->path[DCB_TX_CONFIG].prio_type = | 64 | if (dst->path[tx].prio_type != src->path[tx].prio_type) { |
62 | src_tc_cfg->path[DCB_TX_CONFIG].prio_type; | 65 | dst->path[tx].prio_type = src->path[tx].prio_type; |
66 | changes |= BIT_PG_TX; | ||
67 | } | ||
63 | 68 | ||
64 | dst_tc_cfg->path[DCB_TX_CONFIG].bwg_id = | 69 | if (dst->path[tx].bwg_id != src->path[tx].bwg_id) { |
65 | src_tc_cfg->path[DCB_TX_CONFIG].bwg_id; | 70 | dst->path[tx].bwg_id = src->path[tx].bwg_id; |
71 | changes |= BIT_PG_TX; | ||
72 | } | ||
66 | 73 | ||
67 | dst_tc_cfg->path[DCB_TX_CONFIG].bwg_percent = | 74 | if (dst->path[tx].bwg_percent != src->path[tx].bwg_percent) { |
68 | src_tc_cfg->path[DCB_TX_CONFIG].bwg_percent; | 75 | dst->path[tx].bwg_percent = src->path[tx].bwg_percent; |
76 | changes |= BIT_PG_TX; | ||
77 | } | ||
69 | 78 | ||
70 | dst_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap = | 79 | if (dst->path[tx].up_to_tc_bitmap != |
71 | src_tc_cfg->path[DCB_TX_CONFIG].up_to_tc_bitmap; | 80 | src->path[tx].up_to_tc_bitmap) { |
81 | dst->path[tx].up_to_tc_bitmap = | ||
82 | src->path[tx].up_to_tc_bitmap; | ||
83 | changes |= (BIT_PG_TX | BIT_PFC | BIT_APP_UPCHG); | ||
84 | } | ||
72 | 85 | ||
73 | dst_tc_cfg->path[DCB_RX_CONFIG].prio_type = | 86 | if (dst->path[rx].prio_type != src->path[rx].prio_type) { |
74 | src_tc_cfg->path[DCB_RX_CONFIG].prio_type; | 87 | dst->path[rx].prio_type = src->path[rx].prio_type; |
88 | changes |= BIT_PG_RX; | ||
89 | } | ||
75 | 90 | ||
76 | dst_tc_cfg->path[DCB_RX_CONFIG].bwg_id = | 91 | if (dst->path[rx].bwg_id != src->path[rx].bwg_id) { |
77 | src_tc_cfg->path[DCB_RX_CONFIG].bwg_id; | 92 | dst->path[rx].bwg_id = src->path[rx].bwg_id; |
93 | changes |= BIT_PG_RX; | ||
94 | } | ||
78 | 95 | ||
79 | dst_tc_cfg->path[DCB_RX_CONFIG].bwg_percent = | 96 | if (dst->path[rx].bwg_percent != src->path[rx].bwg_percent) { |
80 | src_tc_cfg->path[DCB_RX_CONFIG].bwg_percent; | 97 | dst->path[rx].bwg_percent = src->path[rx].bwg_percent; |
98 | changes |= BIT_PG_RX; | ||
99 | } | ||
81 | 100 | ||
82 | dst_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap = | 101 | if (dst->path[rx].up_to_tc_bitmap != |
83 | src_tc_cfg->path[DCB_RX_CONFIG].up_to_tc_bitmap; | 102 | src->path[rx].up_to_tc_bitmap) { |
103 | dst->path[rx].up_to_tc_bitmap = | ||
104 | src->path[rx].up_to_tc_bitmap; | ||
105 | changes |= (BIT_PG_RX | BIT_PFC | BIT_APP_UPCHG); | ||
106 | } | ||
84 | } | 107 | } |
85 | 108 | ||
86 | for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) { | 109 | for (i = DCB_PG_ATTR_BW_ID_0; i < DCB_PG_ATTR_BW_ID_MAX; i++) { |
87 | dst_dcb_cfg->bw_percentage[DCB_TX_CONFIG] | 110 | j = i - DCB_PG_ATTR_BW_ID_0; |
88 | [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage | 111 | if (dcfg->bw_percentage[tx][j] != scfg->bw_percentage[tx][j]) { |
89 | [DCB_TX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; | 112 | dcfg->bw_percentage[tx][j] = scfg->bw_percentage[tx][j]; |
90 | dst_dcb_cfg->bw_percentage[DCB_RX_CONFIG] | 113 | changes |= BIT_PG_TX; |
91 | [i-DCB_PG_ATTR_BW_ID_0] = src_dcb_cfg->bw_percentage | 114 | } |
92 | [DCB_RX_CONFIG][i-DCB_PG_ATTR_BW_ID_0]; | 115 | if (dcfg->bw_percentage[rx][j] != scfg->bw_percentage[rx][j]) { |
116 | dcfg->bw_percentage[rx][j] = scfg->bw_percentage[rx][j]; | ||
117 | changes |= BIT_PG_RX; | ||
118 | } | ||
93 | } | 119 | } |
94 | 120 | ||
95 | for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) { | 121 | for (i = DCB_PFC_UP_ATTR_0; i < DCB_PFC_UP_ATTR_MAX; i++) { |
96 | dst_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc = | 122 | j = i - DCB_PFC_UP_ATTR_0; |
97 | src_dcb_cfg->tc_config[i - DCB_PFC_UP_ATTR_0].dcb_pfc; | 123 | if (dcfg->tc_config[j].dcb_pfc != scfg->tc_config[j].dcb_pfc) { |
124 | dcfg->tc_config[j].dcb_pfc = scfg->tc_config[j].dcb_pfc; | ||
125 | changes |= BIT_PFC; | ||
126 | } | ||
98 | } | 127 | } |
99 | 128 | ||
100 | dst_dcb_cfg->pfc_mode_enable = src_dcb_cfg->pfc_mode_enable; | 129 | if (dcfg->pfc_mode_enable != scfg->pfc_mode_enable) { |
130 | dcfg->pfc_mode_enable = scfg->pfc_mode_enable; | ||
131 | changes |= BIT_PFC; | ||
132 | } | ||
101 | 133 | ||
102 | return 0; | 134 | return changes; |
103 | } | 135 | } |
104 | 136 | ||
105 | static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) | 137 | static u8 ixgbe_dcbnl_get_state(struct net_device *netdev) |
@@ -179,20 +211,6 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_tx(struct net_device *netdev, int tc, | |||
179 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) | 211 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) |
180 | adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap = | 212 | adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap = |
181 | up_map; | 213 | up_map; |
182 | |||
183 | if ((adapter->temp_dcb_cfg.tc_config[tc].path[0].prio_type != | ||
184 | adapter->dcb_cfg.tc_config[tc].path[0].prio_type) || | ||
185 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_id != | ||
186 | adapter->dcb_cfg.tc_config[tc].path[0].bwg_id) || | ||
187 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].bwg_percent != | ||
188 | adapter->dcb_cfg.tc_config[tc].path[0].bwg_percent) || | ||
189 | (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != | ||
190 | adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap)) | ||
191 | adapter->dcb_set_bitmap |= BIT_PG_TX; | ||
192 | |||
193 | if (adapter->temp_dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap != | ||
194 | adapter->dcb_cfg.tc_config[tc].path[0].up_to_tc_bitmap) | ||
195 | adapter->dcb_set_bitmap |= BIT_PFC | BIT_APP_UPCHG; | ||
196 | } | 214 | } |
197 | 215 | ||
198 | static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | 216 | static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, |
@@ -201,10 +219,6 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_tx(struct net_device *netdev, int bwg_id, | |||
201 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 219 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
202 | 220 | ||
203 | adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; | 221 | adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] = bw_pct; |
204 | |||
205 | if (adapter->temp_dcb_cfg.bw_percentage[0][bwg_id] != | ||
206 | adapter->dcb_cfg.bw_percentage[0][bwg_id]) | ||
207 | adapter->dcb_set_bitmap |= BIT_PG_TX; | ||
208 | } | 222 | } |
209 | 223 | ||
210 | static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, | 224 | static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, |
@@ -223,20 +237,6 @@ static void ixgbe_dcbnl_set_pg_tc_cfg_rx(struct net_device *netdev, int tc, | |||
223 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) | 237 | if (up_map != DCB_ATTR_VALUE_UNDEFINED) |
224 | adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap = | 238 | adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap = |
225 | up_map; | 239 | up_map; |
226 | |||
227 | if ((adapter->temp_dcb_cfg.tc_config[tc].path[1].prio_type != | ||
228 | adapter->dcb_cfg.tc_config[tc].path[1].prio_type) || | ||
229 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_id != | ||
230 | adapter->dcb_cfg.tc_config[tc].path[1].bwg_id) || | ||
231 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].bwg_percent != | ||
232 | adapter->dcb_cfg.tc_config[tc].path[1].bwg_percent) || | ||
233 | (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap != | ||
234 | adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap)) | ||
235 | adapter->dcb_set_bitmap |= BIT_PG_RX; | ||
236 | |||
237 | if (adapter->temp_dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap != | ||
238 | adapter->dcb_cfg.tc_config[tc].path[1].up_to_tc_bitmap) | ||
239 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
240 | } | 240 | } |
241 | 241 | ||
242 | static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, | 242 | static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, |
@@ -245,10 +245,6 @@ static void ixgbe_dcbnl_set_pg_bwg_cfg_rx(struct net_device *netdev, int bwg_id, | |||
245 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 245 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
246 | 246 | ||
247 | adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; | 247 | adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] = bw_pct; |
248 | |||
249 | if (adapter->temp_dcb_cfg.bw_percentage[1][bwg_id] != | ||
250 | adapter->dcb_cfg.bw_percentage[1][bwg_id]) | ||
251 | adapter->dcb_set_bitmap |= BIT_PG_RX; | ||
252 | } | 248 | } |
253 | 249 | ||
254 | static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, | 250 | static void ixgbe_dcbnl_get_pg_tc_cfg_tx(struct net_device *netdev, int tc, |
@@ -298,10 +294,8 @@ static void ixgbe_dcbnl_set_pfc_cfg(struct net_device *netdev, int priority, | |||
298 | 294 | ||
299 | adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting; | 295 | adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc = setting; |
300 | if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc != | 296 | if (adapter->temp_dcb_cfg.tc_config[priority].dcb_pfc != |
301 | adapter->dcb_cfg.tc_config[priority].dcb_pfc) { | 297 | adapter->dcb_cfg.tc_config[priority].dcb_pfc) |
302 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
303 | adapter->temp_dcb_cfg.pfc_mode_enable = true; | 298 | adapter->temp_dcb_cfg.pfc_mode_enable = true; |
304 | } | ||
305 | } | 299 | } |
306 | 300 | ||
307 | static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, | 301 | static void ixgbe_dcbnl_get_pfc_cfg(struct net_device *netdev, int priority, |
@@ -336,7 +330,8 @@ static void ixgbe_dcbnl_devreset(struct net_device *dev) | |||
336 | static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | 330 | static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) |
337 | { | 331 | { |
338 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 332 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
339 | int ret, i; | 333 | int ret = DCB_NO_HW_CHG; |
334 | int i; | ||
340 | #ifdef IXGBE_FCOE | 335 | #ifdef IXGBE_FCOE |
341 | struct dcb_app app = { | 336 | struct dcb_app app = { |
342 | .selector = DCB_APP_IDTYPE_ETHTYPE, | 337 | .selector = DCB_APP_IDTYPE_ETHTYPE, |
@@ -355,12 +350,13 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
355 | 350 | ||
356 | /* Fail command if not in CEE mode */ | 351 | /* Fail command if not in CEE mode */ |
357 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) | 352 | if (!(adapter->dcbx_cap & DCB_CAP_DCBX_VER_CEE)) |
358 | return 1; | 353 | return ret; |
359 | 354 | ||
360 | ret = ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, &adapter->dcb_cfg, | 355 | adapter->dcb_set_bitmap |= ixgbe_copy_dcb_cfg(&adapter->temp_dcb_cfg, |
361 | MAX_TRAFFIC_CLASS); | 356 | &adapter->dcb_cfg, |
362 | if (ret) | 357 | MAX_TRAFFIC_CLASS); |
363 | return DCB_NO_HW_CHG; | 358 | if (!adapter->dcb_set_bitmap) |
359 | return ret; | ||
364 | 360 | ||
365 | if (adapter->dcb_cfg.pfc_mode_enable) { | 361 | if (adapter->dcb_cfg.pfc_mode_enable) { |
366 | switch (adapter->hw.mac.type) { | 362 | switch (adapter->hw.mac.type) { |
@@ -420,6 +416,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
420 | 416 | ||
421 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) | 417 | for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) |
422 | netdev_set_prio_tc_map(netdev, i, prio_tc[i]); | 418 | netdev_set_prio_tc_map(netdev, i, prio_tc[i]); |
419 | |||
420 | ret = DCB_HW_CHG_RST; | ||
423 | } | 421 | } |
424 | 422 | ||
425 | if (adapter->dcb_set_bitmap & BIT_PFC) { | 423 | if (adapter->dcb_set_bitmap & BIT_PFC) { |
@@ -430,7 +428,8 @@ static u8 ixgbe_dcbnl_set_all(struct net_device *netdev) | |||
430 | DCB_TX_CONFIG, prio_tc); | 428 | DCB_TX_CONFIG, prio_tc); |
431 | ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en); | 429 | ixgbe_dcb_unpack_pfc(&adapter->dcb_cfg, &pfc_en); |
432 | ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc); | 430 | ixgbe_dcb_hw_pfc_config(&adapter->hw, pfc_en, prio_tc); |
433 | ret = DCB_HW_CHG; | 431 | if (ret != DCB_HW_CHG_RST) |
432 | ret = DCB_HW_CHG; | ||
434 | } | 433 | } |
435 | 434 | ||
436 | if (adapter->dcb_cfg.pfc_mode_enable) | 435 | if (adapter->dcb_cfg.pfc_mode_enable) |
@@ -531,9 +530,6 @@ static void ixgbe_dcbnl_setpfcstate(struct net_device *netdev, u8 state) | |||
531 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 530 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
532 | 531 | ||
533 | adapter->temp_dcb_cfg.pfc_mode_enable = state; | 532 | adapter->temp_dcb_cfg.pfc_mode_enable = state; |
534 | if (adapter->temp_dcb_cfg.pfc_mode_enable != | ||
535 | adapter->dcb_cfg.pfc_mode_enable) | ||
536 | adapter->dcb_set_bitmap |= BIT_PFC; | ||
537 | } | 533 | } |
538 | 534 | ||
539 | /** | 535 | /** |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c index 77ea4b716535..bc07933d67da 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | |||
@@ -437,6 +437,7 @@ int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter, | |||
437 | */ | 437 | */ |
438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && | 438 | if ((fh->fh_r_ctl == FC_RCTL_DD_SOL_DATA) && |
439 | (fctl & FC_FC_END_SEQ)) { | 439 | (fctl & FC_FC_END_SEQ)) { |
440 | skb_linearize(skb); | ||
440 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); | 441 | crc = (struct fcoe_crc_eof *)skb_put(skb, sizeof(*crc)); |
441 | crc->fcoe_eof = FC_EOF_T; | 442 | crc->fcoe_eof = FC_EOF_T; |
442 | } | 443 | } |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c index 027d7a75be39..ed1b47dc0834 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | |||
@@ -622,6 +622,16 @@ static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter, int v_idx, | |||
622 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | 622 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) |
623 | set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state); | 623 | set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state); |
624 | 624 | ||
625 | #ifdef IXGBE_FCOE | ||
626 | if (adapter->netdev->features & NETIF_F_FCOE_MTU) { | ||
627 | struct ixgbe_ring_feature *f; | ||
628 | f = &adapter->ring_feature[RING_F_FCOE]; | ||
629 | if ((rxr_idx >= f->mask) && | ||
630 | (rxr_idx < f->mask + f->indices)) | ||
631 | set_bit(__IXGBE_RX_FCOE_BUFSZ, &ring->state); | ||
632 | } | ||
633 | |||
634 | #endif /* IXGBE_FCOE */ | ||
625 | /* apply Rx specific ring traits */ | 635 | /* apply Rx specific ring traits */ |
626 | ring->count = adapter->rx_ring_count; | 636 | ring->count = adapter->rx_ring_count; |
627 | ring->queue_index = rxr_idx; | 637 | ring->queue_index = rxr_idx; |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 398fc223cab9..88f6b2e9b72d 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -63,8 +63,8 @@ static char ixgbe_default_device_descr[] = | |||
63 | "Intel(R) 10 Gigabit Network Connection"; | 63 | "Intel(R) 10 Gigabit Network Connection"; |
64 | #endif | 64 | #endif |
65 | #define MAJ 3 | 65 | #define MAJ 3 |
66 | #define MIN 6 | 66 | #define MIN 8 |
67 | #define BUILD 7 | 67 | #define BUILD 21 |
68 | #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ | 68 | #define DRV_VERSION __stringify(MAJ) "." __stringify(MIN) "." \ |
69 | __stringify(BUILD) "-k" | 69 | __stringify(BUILD) "-k" |
70 | const char ixgbe_driver_version[] = DRV_VERSION; | 70 | const char ixgbe_driver_version[] = DRV_VERSION; |
@@ -141,13 +141,16 @@ module_param(allow_unsupported_sfp, uint, 0); | |||
141 | MODULE_PARM_DESC(allow_unsupported_sfp, | 141 | MODULE_PARM_DESC(allow_unsupported_sfp, |
142 | "Allow unsupported and untested SFP+ modules on 82599-based adapters"); | 142 | "Allow unsupported and untested SFP+ modules on 82599-based adapters"); |
143 | 143 | ||
144 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) | ||
145 | static int debug = -1; | ||
146 | module_param(debug, int, 0); | ||
147 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
148 | |||
144 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); | 149 | MODULE_AUTHOR("Intel Corporation, <linux.nics@intel.com>"); |
145 | MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver"); | 150 | MODULE_DESCRIPTION("Intel(R) 10 Gigabit PCI Express Network Driver"); |
146 | MODULE_LICENSE("GPL"); | 151 | MODULE_LICENSE("GPL"); |
147 | MODULE_VERSION(DRV_VERSION); | 152 | MODULE_VERSION(DRV_VERSION); |
148 | 153 | ||
149 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 | ||
150 | |||
151 | static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) | 154 | static void ixgbe_service_event_schedule(struct ixgbe_adapter *adapter) |
152 | { | 155 | { |
153 | if (!test_bit(__IXGBE_DOWN, &adapter->state) && | 156 | if (!test_bit(__IXGBE_DOWN, &adapter->state) && |
@@ -3151,14 +3154,6 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter) | |||
3151 | set_ring_rsc_enabled(rx_ring); | 3154 | set_ring_rsc_enabled(rx_ring); |
3152 | else | 3155 | else |
3153 | clear_ring_rsc_enabled(rx_ring); | 3156 | clear_ring_rsc_enabled(rx_ring); |
3154 | #ifdef IXGBE_FCOE | ||
3155 | if (netdev->features & NETIF_F_FCOE_MTU) { | ||
3156 | struct ixgbe_ring_feature *f; | ||
3157 | f = &adapter->ring_feature[RING_F_FCOE]; | ||
3158 | if ((i >= f->mask) && (i < f->mask + f->indices)) | ||
3159 | set_bit(__IXGBE_RX_FCOE_BUFSZ, &rx_ring->state); | ||
3160 | } | ||
3161 | #endif /* IXGBE_FCOE */ | ||
3162 | } | 3157 | } |
3163 | } | 3158 | } |
3164 | 3159 | ||
@@ -4833,7 +4828,9 @@ static int ixgbe_resume(struct pci_dev *pdev) | |||
4833 | 4828 | ||
4834 | pci_wake_from_d3(pdev, false); | 4829 | pci_wake_from_d3(pdev, false); |
4835 | 4830 | ||
4831 | rtnl_lock(); | ||
4836 | err = ixgbe_init_interrupt_scheme(adapter); | 4832 | err = ixgbe_init_interrupt_scheme(adapter); |
4833 | rtnl_unlock(); | ||
4837 | if (err) { | 4834 | if (err) { |
4838 | e_dev_err("Cannot initialize interrupts for device\n"); | 4835 | e_dev_err("Cannot initialize interrupts for device\n"); |
4839 | return err; | 4836 | return err; |
@@ -4876,10 +4873,6 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4876 | } | 4873 | } |
4877 | 4874 | ||
4878 | ixgbe_clear_interrupt_scheme(adapter); | 4875 | ixgbe_clear_interrupt_scheme(adapter); |
4879 | #ifdef CONFIG_DCB | ||
4880 | kfree(adapter->ixgbe_ieee_pfc); | ||
4881 | kfree(adapter->ixgbe_ieee_ets); | ||
4882 | #endif | ||
4883 | 4876 | ||
4884 | #ifdef CONFIG_PM | 4877 | #ifdef CONFIG_PM |
4885 | retval = pci_save_state(pdev); | 4878 | retval = pci_save_state(pdev); |
@@ -4890,6 +4883,16 @@ static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | |||
4890 | if (wufc) { | 4883 | if (wufc) { |
4891 | ixgbe_set_rx_mode(netdev); | 4884 | ixgbe_set_rx_mode(netdev); |
4892 | 4885 | ||
4886 | /* | ||
4887 | * enable the optics for both mult-speed fiber and | ||
4888 | * 82599 SFP+ fiber as we can WoL. | ||
4889 | */ | ||
4890 | if (hw->mac.ops.enable_tx_laser && | ||
4891 | (hw->phy.multispeed_fiber || | ||
4892 | (hw->mac.ops.get_media_type(hw) == ixgbe_media_type_fiber && | ||
4893 | hw->mac.type == ixgbe_mac_82599EB))) | ||
4894 | hw->mac.ops.enable_tx_laser(hw); | ||
4895 | |||
4893 | /* turn on all-multi mode if wake on multicast is enabled */ | 4896 | /* turn on all-multi mode if wake on multicast is enabled */ |
4894 | if (wufc & IXGBE_WUFC_MC) { | 4897 | if (wufc & IXGBE_WUFC_MC) { |
4895 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); | 4898 | fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); |
@@ -6834,7 +6837,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
6834 | adapter->pdev = pdev; | 6837 | adapter->pdev = pdev; |
6835 | hw = &adapter->hw; | 6838 | hw = &adapter->hw; |
6836 | hw->back = adapter; | 6839 | hw->back = adapter; |
6837 | adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1; | 6840 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
6838 | 6841 | ||
6839 | hw->hw_addr = ioremap(pci_resource_start(pdev, 0), | 6842 | hw->hw_addr = ioremap(pci_resource_start(pdev, 0), |
6840 | pci_resource_len(pdev, 0)); | 6843 | pci_resource_len(pdev, 0)); |
@@ -7217,6 +7220,11 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
7217 | 7220 | ||
7218 | ixgbe_release_hw_control(adapter); | 7221 | ixgbe_release_hw_control(adapter); |
7219 | 7222 | ||
7223 | #ifdef CONFIG_DCB | ||
7224 | kfree(adapter->ixgbe_ieee_pfc); | ||
7225 | kfree(adapter->ixgbe_ieee_ets); | ||
7226 | |||
7227 | #endif | ||
7220 | iounmap(adapter->hw.hw_addr); | 7228 | iounmap(adapter->hw.hw_addr); |
7221 | pci_release_selected_regions(pdev, pci_select_bars(pdev, | 7229 | pci_release_selected_regions(pdev, pci_select_bars(pdev, |
7222 | IORESOURCE_MEM)); | 7230 | IORESOURCE_MEM)); |
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 581c65976bb4..307611ae831d 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | |||
@@ -91,7 +91,10 @@ MODULE_DESCRIPTION("Intel(R) 82599 Virtual Function Driver"); | |||
91 | MODULE_LICENSE("GPL"); | 91 | MODULE_LICENSE("GPL"); |
92 | MODULE_VERSION(DRV_VERSION); | 92 | MODULE_VERSION(DRV_VERSION); |
93 | 93 | ||
94 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 | 94 | #define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV|NETIF_MSG_PROBE|NETIF_MSG_LINK) |
95 | static int debug = -1; | ||
96 | module_param(debug, int, 0); | ||
97 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
95 | 98 | ||
96 | /* forward decls */ | 99 | /* forward decls */ |
97 | static void ixgbevf_set_itr_msix(struct ixgbevf_q_vector *q_vector); | 100 | static void ixgbevf_set_itr_msix(struct ixgbevf_q_vector *q_vector); |
@@ -3367,7 +3370,7 @@ static int __devinit ixgbevf_probe(struct pci_dev *pdev, | |||
3367 | adapter->pdev = pdev; | 3370 | adapter->pdev = pdev; |
3368 | hw = &adapter->hw; | 3371 | hw = &adapter->hw; |
3369 | hw->back = adapter; | 3372 | hw->back = adapter; |
3370 | adapter->msg_enable = (1 << DEFAULT_DEBUG_LEVEL_SHIFT) - 1; | 3373 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); |
3371 | 3374 | ||
3372 | /* | 3375 | /* |
3373 | * call save state here in standalone driver because it relies on | 3376 | * call save state here in standalone driver because it relies on |
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index 423a1a2a702e..487a6c8bd4ec 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c | |||
@@ -1767,13 +1767,14 @@ static int sky2_open(struct net_device *dev) | |||
1767 | 1767 | ||
1768 | sky2_hw_up(sky2); | 1768 | sky2_hw_up(sky2); |
1769 | 1769 | ||
1770 | /* Enable interrupts from phy/mac for port */ | ||
1771 | imask = sky2_read32(hw, B0_IMSK); | ||
1772 | |||
1770 | if (hw->chip_id == CHIP_ID_YUKON_OPT || | 1773 | if (hw->chip_id == CHIP_ID_YUKON_OPT || |
1771 | hw->chip_id == CHIP_ID_YUKON_PRM || | 1774 | hw->chip_id == CHIP_ID_YUKON_PRM || |
1772 | hw->chip_id == CHIP_ID_YUKON_OP_2) | 1775 | hw->chip_id == CHIP_ID_YUKON_OP_2) |
1773 | imask |= Y2_IS_PHY_QLNK; /* enable PHY Quick Link */ | 1776 | imask |= Y2_IS_PHY_QLNK; /* enable PHY Quick Link */ |
1774 | 1777 | ||
1775 | /* Enable interrupts from phy/mac for port */ | ||
1776 | imask = sky2_read32(hw, B0_IMSK); | ||
1777 | imask |= portirq_msk[port]; | 1778 | imask |= portirq_msk[port]; |
1778 | sky2_write32(hw, B0_IMSK, imask); | 1779 | sky2_write32(hw, B0_IMSK, imask); |
1779 | sky2_read32(hw, B0_IMSK); | 1780 | sky2_read32(hw, B0_IMSK); |
@@ -2468,6 +2469,17 @@ static int sky2_change_mtu(struct net_device *dev, int new_mtu) | |||
2468 | return err; | 2469 | return err; |
2469 | } | 2470 | } |
2470 | 2471 | ||
2472 | static inline bool needs_copy(const struct rx_ring_info *re, | ||
2473 | unsigned length) | ||
2474 | { | ||
2475 | #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS | ||
2476 | /* Some architectures need the IP header to be aligned */ | ||
2477 | if (!IS_ALIGNED(re->data_addr + ETH_HLEN, sizeof(u32))) | ||
2478 | return true; | ||
2479 | #endif | ||
2480 | return length < copybreak; | ||
2481 | } | ||
2482 | |||
2471 | /* For small just reuse existing skb for next receive */ | 2483 | /* For small just reuse existing skb for next receive */ |
2472 | static struct sk_buff *receive_copy(struct sky2_port *sky2, | 2484 | static struct sk_buff *receive_copy(struct sky2_port *sky2, |
2473 | const struct rx_ring_info *re, | 2485 | const struct rx_ring_info *re, |
@@ -2482,8 +2494,13 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2, | |||
2482 | skb_copy_from_linear_data(re->skb, skb->data, length); | 2494 | skb_copy_from_linear_data(re->skb, skb->data, length); |
2483 | skb->ip_summed = re->skb->ip_summed; | 2495 | skb->ip_summed = re->skb->ip_summed; |
2484 | 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 | |||
2485 | 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, |
2486 | length, PCI_DMA_FROMDEVICE); | 2501 | length, PCI_DMA_FROMDEVICE); |
2502 | re->skb->vlan_tci = 0; | ||
2503 | re->skb->rxhash = 0; | ||
2487 | re->skb->ip_summed = CHECKSUM_NONE; | 2504 | re->skb->ip_summed = CHECKSUM_NONE; |
2488 | skb_put(skb, length); | 2505 | skb_put(skb, length); |
2489 | } | 2506 | } |
@@ -2568,9 +2585,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
2568 | struct sk_buff *skb = NULL; | 2585 | struct sk_buff *skb = NULL; |
2569 | u16 count = (status & GMR_FS_LEN) >> 16; | 2586 | u16 count = (status & GMR_FS_LEN) >> 16; |
2570 | 2587 | ||
2571 | if (status & GMR_FS_VLAN) | ||
2572 | count -= VLAN_HLEN; /* Account for vlan tag */ | ||
2573 | |||
2574 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, | 2588 | netif_printk(sky2, rx_status, KERN_DEBUG, dev, |
2575 | "rx slot %u status 0x%x len %d\n", | 2589 | "rx slot %u status 0x%x len %d\n", |
2576 | sky2->rx_next, status, length); | 2590 | sky2->rx_next, status, length); |
@@ -2578,6 +2592,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
2578 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; | 2592 | sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending; |
2579 | prefetch(sky2->rx_ring + sky2->rx_next); | 2593 | prefetch(sky2->rx_ring + sky2->rx_next); |
2580 | 2594 | ||
2595 | if (vlan_tx_tag_present(re->skb)) | ||
2596 | count -= VLAN_HLEN; /* Account for vlan tag */ | ||
2597 | |||
2581 | /* This chip has hardware problems that generates bogus status. | 2598 | /* This chip has hardware problems that generates bogus status. |
2582 | * So do only marginal checking and expect higher level protocols | 2599 | * So do only marginal checking and expect higher level protocols |
2583 | * to handle crap frames. | 2600 | * to handle crap frames. |
@@ -2598,7 +2615,7 @@ static struct sk_buff *sky2_receive(struct net_device *dev, | |||
2598 | goto error; | 2615 | goto error; |
2599 | 2616 | ||
2600 | okay: | 2617 | okay: |
2601 | if (length < copybreak) | 2618 | if (needs_copy(re, length)) |
2602 | skb = receive_copy(sky2, re, length); | 2619 | skb = receive_copy(sky2, re, length); |
2603 | else | 2620 | else |
2604 | skb = receive_new(sky2, re, length); | 2621 | skb = receive_new(sky2, re, length); |
@@ -2635,11 +2652,8 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last) | |||
2635 | } | 2652 | } |
2636 | 2653 | ||
2637 | static inline void sky2_skb_rx(const struct sky2_port *sky2, | 2654 | static inline void sky2_skb_rx(const struct sky2_port *sky2, |
2638 | u32 status, struct sk_buff *skb) | 2655 | struct sk_buff *skb) |
2639 | { | 2656 | { |
2640 | if (status & GMR_FS_VLAN) | ||
2641 | __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag)); | ||
2642 | |||
2643 | if (skb->ip_summed == CHECKSUM_NONE) | 2657 | if (skb->ip_summed == CHECKSUM_NONE) |
2644 | netif_receive_skb(skb); | 2658 | netif_receive_skb(skb); |
2645 | else | 2659 | else |
@@ -2693,6 +2707,14 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status) | |||
2693 | } | 2707 | } |
2694 | } | 2708 | } |
2695 | 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 | |||
2696 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) | 2718 | static void sky2_rx_hash(struct sky2_port *sky2, u32 status) |
2697 | { | 2719 | { |
2698 | struct sk_buff *skb; | 2720 | struct sk_buff *skb; |
@@ -2751,8 +2773,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
2751 | } | 2773 | } |
2752 | 2774 | ||
2753 | skb->protocol = eth_type_trans(skb, dev); | 2775 | skb->protocol = eth_type_trans(skb, dev); |
2754 | 2776 | sky2_skb_rx(sky2, skb); | |
2755 | sky2_skb_rx(sky2, status, skb); | ||
2756 | 2777 | ||
2757 | /* Stop after net poll weight */ | 2778 | /* Stop after net poll weight */ |
2758 | if (++work_done >= to_do) | 2779 | if (++work_done >= to_do) |
@@ -2760,11 +2781,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx) | |||
2760 | break; | 2781 | break; |
2761 | 2782 | ||
2762 | case OP_RXVLAN: | 2783 | case OP_RXVLAN: |
2763 | sky2->rx_tag = length; | 2784 | sky2_rx_tag(sky2, length); |
2764 | break; | 2785 | break; |
2765 | 2786 | ||
2766 | case OP_RXCHKSVLAN: | 2787 | case OP_RXCHKSVLAN: |
2767 | sky2->rx_tag = length; | 2788 | sky2_rx_tag(sky2, length); |
2768 | /* fall through */ | 2789 | /* fall through */ |
2769 | case OP_RXCHKS: | 2790 | case OP_RXCHKS: |
2770 | 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/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index 9e2b911a1230..d69fee41f24a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -83,8 +83,9 @@ | |||
83 | 83 | ||
84 | #define MLX4_EN_WATCHDOG_TIMEOUT (15 * HZ) | 84 | #define MLX4_EN_WATCHDOG_TIMEOUT (15 * HZ) |
85 | 85 | ||
86 | #define MLX4_EN_ALLOC_ORDER 2 | 86 | /* Use the maximum between 16384 and a single page */ |
87 | #define MLX4_EN_ALLOC_SIZE (PAGE_SIZE << MLX4_EN_ALLOC_ORDER) | 87 | #define MLX4_EN_ALLOC_SIZE PAGE_ALIGN(16384) |
88 | #define MLX4_EN_ALLOC_ORDER get_order(MLX4_EN_ALLOC_SIZE) | ||
88 | 89 | ||
89 | #define MLX4_EN_MAX_LRO_DESCRIPTORS 32 | 90 | #define MLX4_EN_MAX_LRO_DESCRIPTORS 32 |
90 | 91 | ||
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c index c722aa607d07..f8dda009d3c0 100644 --- a/drivers/net/ethernet/micrel/ks8851.c +++ b/drivers/net/ethernet/micrel/ks8851.c | |||
@@ -889,16 +889,17 @@ static int ks8851_net_stop(struct net_device *dev) | |||
889 | netif_stop_queue(dev); | 889 | netif_stop_queue(dev); |
890 | 890 | ||
891 | mutex_lock(&ks->lock); | 891 | mutex_lock(&ks->lock); |
892 | /* turn off the IRQs and ack any outstanding */ | ||
893 | ks8851_wrreg16(ks, KS_IER, 0x0000); | ||
894 | ks8851_wrreg16(ks, KS_ISR, 0xffff); | ||
895 | mutex_unlock(&ks->lock); | ||
892 | 896 | ||
893 | /* stop any outstanding work */ | 897 | /* stop any outstanding work */ |
894 | flush_work(&ks->irq_work); | 898 | flush_work(&ks->irq_work); |
895 | flush_work(&ks->tx_work); | 899 | flush_work(&ks->tx_work); |
896 | flush_work(&ks->rxctrl_work); | 900 | flush_work(&ks->rxctrl_work); |
897 | 901 | ||
898 | /* turn off the IRQs and ack any outstanding */ | 902 | mutex_lock(&ks->lock); |
899 | ks8851_wrreg16(ks, KS_IER, 0x0000); | ||
900 | ks8851_wrreg16(ks, KS_ISR, 0xffff); | ||
901 | |||
902 | /* shutdown RX process */ | 903 | /* shutdown RX process */ |
903 | ks8851_wrreg16(ks, KS_RXCR1, 0x0000); | 904 | ks8851_wrreg16(ks, KS_RXCR1, 0x0000); |
904 | 905 | ||
@@ -907,6 +908,7 @@ static int ks8851_net_stop(struct net_device *dev) | |||
907 | 908 | ||
908 | /* set powermode to soft power down to save power */ | 909 | /* set powermode to soft power down to save power */ |
909 | ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN); | 910 | ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN); |
911 | mutex_unlock(&ks->lock); | ||
910 | 912 | ||
911 | /* ensure any queued tx buffers are dumped */ | 913 | /* ensure any queued tx buffers are dumped */ |
912 | while (!skb_queue_empty(&ks->txq)) { | 914 | while (!skb_queue_empty(&ks->txq)) { |
@@ -918,7 +920,6 @@ static int ks8851_net_stop(struct net_device *dev) | |||
918 | dev_kfree_skb(txb); | 920 | dev_kfree_skb(txb); |
919 | } | 921 | } |
920 | 922 | ||
921 | mutex_unlock(&ks->lock); | ||
922 | return 0; | 923 | return 0; |
923 | } | 924 | } |
924 | 925 | ||
@@ -1418,6 +1419,7 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1418 | struct net_device *ndev; | 1419 | struct net_device *ndev; |
1419 | struct ks8851_net *ks; | 1420 | struct ks8851_net *ks; |
1420 | int ret; | 1421 | int ret; |
1422 | unsigned cider; | ||
1421 | 1423 | ||
1422 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); | 1424 | ndev = alloc_etherdev(sizeof(struct ks8851_net)); |
1423 | if (!ndev) | 1425 | if (!ndev) |
@@ -1484,8 +1486,8 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1484 | ks8851_soft_reset(ks, GRR_GSR); | 1486 | ks8851_soft_reset(ks, GRR_GSR); |
1485 | 1487 | ||
1486 | /* simple check for a valid chip being connected to the bus */ | 1488 | /* simple check for a valid chip being connected to the bus */ |
1487 | 1489 | cider = ks8851_rdreg16(ks, KS_CIDER); | |
1488 | if ((ks8851_rdreg16(ks, KS_CIDER) & ~CIDER_REV_MASK) != CIDER_ID) { | 1490 | if ((cider & ~CIDER_REV_MASK) != CIDER_ID) { |
1489 | dev_err(&spi->dev, "failed to read device ID\n"); | 1491 | dev_err(&spi->dev, "failed to read device ID\n"); |
1490 | ret = -ENODEV; | 1492 | ret = -ENODEV; |
1491 | goto err_id; | 1493 | goto err_id; |
@@ -1516,15 +1518,14 @@ static int __devinit ks8851_probe(struct spi_device *spi) | |||
1516 | } | 1518 | } |
1517 | 1519 | ||
1518 | netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", | 1520 | netdev_info(ndev, "revision %d, MAC %pM, IRQ %d, %s EEPROM\n", |
1519 | CIDER_REV_GET(ks8851_rdreg16(ks, KS_CIDER)), | 1521 | CIDER_REV_GET(cider), ndev->dev_addr, ndev->irq, |
1520 | ndev->dev_addr, ndev->irq, | ||
1521 | ks->rc_ccr & CCR_EEPROM ? "has" : "no"); | 1522 | ks->rc_ccr & CCR_EEPROM ? "has" : "no"); |
1522 | 1523 | ||
1523 | return 0; | 1524 | return 0; |
1524 | 1525 | ||
1525 | 1526 | ||
1526 | err_netdev: | 1527 | err_netdev: |
1527 | free_irq(ndev->irq, ndev); | 1528 | free_irq(ndev->irq, ks); |
1528 | 1529 | ||
1529 | err_id: | 1530 | err_id: |
1530 | err_irq: | 1531 | err_irq: |
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c index b8104d9f4081..5ffde23ac8fb 100644 --- a/drivers/net/ethernet/micrel/ks8851_mll.c +++ b/drivers/net/ethernet/micrel/ks8851_mll.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #define DRV_NAME "ks8851_mll" | 40 | #define DRV_NAME "ks8851_mll" |
41 | 41 | ||
42 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; | 42 | static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 }; |
43 | #define MAX_RECV_FRAMES 32 | 43 | #define MAX_RECV_FRAMES 255 |
44 | #define MAX_BUF_SIZE 2048 | 44 | #define MAX_BUF_SIZE 2048 |
45 | #define TX_BUF_SIZE 2000 | 45 | #define TX_BUF_SIZE 2000 |
46 | #define RX_BUF_SIZE 2000 | 46 | #define RX_BUF_SIZE 2000 |
diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c index ef723b185d85..eaf9ff0262a9 100644 --- a/drivers/net/ethernet/micrel/ksz884x.c +++ b/drivers/net/ethernet/micrel/ksz884x.c | |||
@@ -5675,7 +5675,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr) | |||
5675 | memcpy(hw->override_addr, mac->sa_data, ETH_ALEN); | 5675 | memcpy(hw->override_addr, mac->sa_data, ETH_ALEN); |
5676 | } | 5676 | } |
5677 | 5677 | ||
5678 | memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN); | 5678 | memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN); |
5679 | 5679 | ||
5680 | interrupt = hw_block_intr(hw); | 5680 | interrupt = hw_block_intr(hw); |
5681 | 5681 | ||
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 69444247c20b..6dfc26d85e47 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1441,7 +1441,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) | |||
1441 | } | 1441 | } |
1442 | #endif | 1442 | #endif |
1443 | if (!is_valid_ether_addr(ndev->dev_addr)) | 1443 | if (!is_valid_ether_addr(ndev->dev_addr)) |
1444 | dev_hw_addr_random(ndev, ndev->dev_addr); | 1444 | eth_hw_addr_random(ndev); |
1445 | 1445 | ||
1446 | /* Reset the ethernet controller */ | 1446 | /* Reset the ethernet controller */ |
1447 | __lpc_eth_reset(pldat); | 1447 | __lpc_eth_reset(pldat); |
diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index abc79076f867..b3287c0fe279 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c | |||
@@ -958,6 +958,11 @@ static inline void cp_start_hw (struct cp_private *cp) | |||
958 | cpw8(Cmd, RxOn | TxOn); | 958 | cpw8(Cmd, RxOn | TxOn); |
959 | } | 959 | } |
960 | 960 | ||
961 | static void cp_enable_irq(struct cp_private *cp) | ||
962 | { | ||
963 | cpw16_f(IntrMask, cp_intr_mask); | ||
964 | } | ||
965 | |||
961 | static void cp_init_hw (struct cp_private *cp) | 966 | static void cp_init_hw (struct cp_private *cp) |
962 | { | 967 | { |
963 | struct net_device *dev = cp->dev; | 968 | struct net_device *dev = cp->dev; |
@@ -997,8 +1002,6 @@ static void cp_init_hw (struct cp_private *cp) | |||
997 | 1002 | ||
998 | cpw16(MultiIntr, 0); | 1003 | cpw16(MultiIntr, 0); |
999 | 1004 | ||
1000 | cpw16_f(IntrMask, cp_intr_mask); | ||
1001 | |||
1002 | cpw8_f(Cfg9346, Cfg9346_Lock); | 1005 | cpw8_f(Cfg9346, Cfg9346_Lock); |
1003 | } | 1006 | } |
1004 | 1007 | ||
@@ -1130,6 +1133,8 @@ static int cp_open (struct net_device *dev) | |||
1130 | if (rc) | 1133 | if (rc) |
1131 | goto err_out_hw; | 1134 | goto err_out_hw; |
1132 | 1135 | ||
1136 | cp_enable_irq(cp); | ||
1137 | |||
1133 | netif_carrier_off(dev); | 1138 | netif_carrier_off(dev); |
1134 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); | 1139 | mii_check_media(&cp->mii_if, netif_msg_link(cp), true); |
1135 | netif_start_queue(dev); | 1140 | netif_start_queue(dev); |
@@ -2031,6 +2036,7 @@ static int cp_resume (struct pci_dev *pdev) | |||
2031 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ | 2036 | /* FIXME: sh*t may happen if the Rx ring buffer is depleted */ |
2032 | cp_init_rings_index (cp); | 2037 | cp_init_rings_index (cp); |
2033 | cp_init_hw (cp); | 2038 | cp_init_hw (cp); |
2039 | cp_enable_irq(cp); | ||
2034 | netif_start_queue (dev); | 2040 | netif_start_queue (dev); |
2035 | 2041 | ||
2036 | spin_lock_irqsave (&cp->lock, flags); | 2042 | spin_lock_irqsave (&cp->lock, flags); |
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 7b23554f80b6..f54509377efa 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c | |||
@@ -5810,7 +5810,10 @@ static void __rtl8169_resume(struct net_device *dev) | |||
5810 | 5810 | ||
5811 | rtl_pll_power_up(tp); | 5811 | rtl_pll_power_up(tp); |
5812 | 5812 | ||
5813 | rtl_lock_work(tp); | ||
5814 | napi_enable(&tp->napi); | ||
5813 | set_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags); | 5815 | set_bit(RTL_FLAG_TASK_ENABLED, tp->wk.flags); |
5816 | rtl_unlock_work(tp); | ||
5814 | 5817 | ||
5815 | rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING); | 5818 | rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING); |
5816 | } | 5819 | } |
diff --git a/drivers/net/ethernet/renesas/Kconfig b/drivers/net/ethernet/renesas/Kconfig index 9755b49bbefb..3fb2355af37e 100644 --- a/drivers/net/ethernet/renesas/Kconfig +++ b/drivers/net/ethernet/renesas/Kconfig | |||
@@ -7,7 +7,8 @@ config SH_ETH | |||
7 | depends on SUPERH && \ | 7 | depends on SUPERH && \ |
8 | (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ | 8 | (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ |
9 | CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ | 9 | CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ |
10 | CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7757) | 10 | CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \ |
11 | CPU_SUBTYPE_SH7757) | ||
11 | select CRC32 | 12 | select CRC32 |
12 | select NET_CORE | 13 | select NET_CORE |
13 | select MII | 14 | select MII |
@@ -16,4 +17,4 @@ config SH_ETH | |||
16 | ---help--- | 17 | ---help--- |
17 | Renesas SuperH Ethernet device driver. | 18 | Renesas SuperH Ethernet device driver. |
18 | This driver supporting CPUs are: | 19 | This driver supporting CPUs are: |
19 | - SH7710, SH7712, SH7763, SH7619, SH7724, and SH7757. | 20 | - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763 and SH7757. |
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index 8615961c1287..d63e09b29a96 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * SuperH Ethernet device driver | 2 | * SuperH Ethernet device driver |
3 | * | 3 | * |
4 | * Copyright (C) 2006-2008 Nobuhiro Iwamatsu | 4 | * Copyright (C) 2006-2012 Nobuhiro Iwamatsu |
5 | * Copyright (C) 2008-2009 Renesas Solutions Corp. | 5 | * Copyright (C) 2008-2012 Renesas Solutions Corp. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms and conditions of the GNU General Public License, | 8 | * under the terms and conditions of the GNU General Public License, |
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/ethtool.h> | 39 | #include <linux/ethtool.h> |
40 | #include <linux/if_vlan.h> | 40 | #include <linux/if_vlan.h> |
41 | #include <linux/clk.h> | ||
41 | #include <linux/sh_eth.h> | 42 | #include <linux/sh_eth.h> |
42 | 43 | ||
43 | #include "sh_eth.h" | 44 | #include "sh_eth.h" |
@@ -279,8 +280,9 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp) | |||
279 | return &sh_eth_my_cpu_data; | 280 | return &sh_eth_my_cpu_data; |
280 | } | 281 | } |
281 | 282 | ||
282 | #elif defined(CONFIG_CPU_SUBTYPE_SH7763) | 283 | #elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) |
283 | #define SH_ETH_HAS_TSU 1 | 284 | #define SH_ETH_HAS_TSU 1 |
285 | static void sh_eth_reset_hw_crc(struct net_device *ndev); | ||
284 | static void sh_eth_chip_reset(struct net_device *ndev) | 286 | static void sh_eth_chip_reset(struct net_device *ndev) |
285 | { | 287 | { |
286 | struct sh_eth_private *mdp = netdev_priv(ndev); | 288 | struct sh_eth_private *mdp = netdev_priv(ndev); |
@@ -314,6 +316,9 @@ static void sh_eth_reset(struct net_device *ndev) | |||
314 | sh_eth_write(ndev, 0x0, RDFAR); | 316 | sh_eth_write(ndev, 0x0, RDFAR); |
315 | sh_eth_write(ndev, 0x0, RDFXR); | 317 | sh_eth_write(ndev, 0x0, RDFXR); |
316 | sh_eth_write(ndev, 0x0, RDFFR); | 318 | sh_eth_write(ndev, 0x0, RDFFR); |
319 | |||
320 | /* Reset HW CRC register */ | ||
321 | sh_eth_reset_hw_crc(ndev); | ||
317 | } | 322 | } |
318 | 323 | ||
319 | static void sh_eth_set_duplex(struct net_device *ndev) | 324 | static void sh_eth_set_duplex(struct net_device *ndev) |
@@ -370,8 +375,17 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | |||
370 | .no_trimd = 1, | 375 | .no_trimd = 1, |
371 | .no_ade = 1, | 376 | .no_ade = 1, |
372 | .tsu = 1, | 377 | .tsu = 1, |
378 | #if defined(CONFIG_CPU_SUBTYPE_SH7734) | ||
379 | .hw_crc = 1, | ||
380 | #endif | ||
373 | }; | 381 | }; |
374 | 382 | ||
383 | static void sh_eth_reset_hw_crc(struct net_device *ndev) | ||
384 | { | ||
385 | if (sh_eth_my_cpu_data.hw_crc) | ||
386 | sh_eth_write(ndev, 0x0, CSMR); | ||
387 | } | ||
388 | |||
375 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) | 389 | #elif defined(CONFIG_CPU_SUBTYPE_SH7619) |
376 | #define SH_ETH_RESET_DEFAULT 1 | 390 | #define SH_ETH_RESET_DEFAULT 1 |
377 | static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | 391 | static struct sh_eth_cpu_data sh_eth_my_cpu_data = { |
@@ -790,7 +804,7 @@ static int sh_eth_dev_init(struct net_device *ndev) | |||
790 | /* all sh_eth int mask */ | 804 | /* all sh_eth int mask */ |
791 | sh_eth_write(ndev, 0, EESIPR); | 805 | sh_eth_write(ndev, 0, EESIPR); |
792 | 806 | ||
793 | #if defined(__LITTLE_ENDIAN__) | 807 | #if defined(__LITTLE_ENDIAN) |
794 | if (mdp->cd->hw_swap) | 808 | if (mdp->cd->hw_swap) |
795 | sh_eth_write(ndev, EDMR_EL, EDMR); | 809 | sh_eth_write(ndev, EDMR_EL, EDMR); |
796 | else | 810 | else |
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h index 57dc26261116..0fa14afce23d 100644 --- a/drivers/net/ethernet/renesas/sh_eth.h +++ b/drivers/net/ethernet/renesas/sh_eth.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * SuperH Ethernet device driver | 2 | * SuperH Ethernet device driver |
3 | * | 3 | * |
4 | * Copyright (C) 2006-2008 Nobuhiro Iwamatsu | 4 | * Copyright (C) 2006-2012 Nobuhiro Iwamatsu |
5 | * Copyright (C) 2008-2011 Renesas Solutions Corp. | 5 | * Copyright (C) 2008-2012 Renesas Solutions Corp. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
8 | * under the terms and conditions of the GNU General Public License, | 8 | * under the terms and conditions of the GNU General Public License, |
@@ -98,6 +98,8 @@ enum { | |||
98 | CEECR, | 98 | CEECR, |
99 | MAFCR, | 99 | MAFCR, |
100 | RTRATE, | 100 | RTRATE, |
101 | CSMR, | ||
102 | RMII_MII, | ||
101 | 103 | ||
102 | /* TSU Absolute address */ | 104 | /* TSU Absolute address */ |
103 | ARSTR, | 105 | ARSTR, |
@@ -172,6 +174,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
172 | [RMCR] = 0x0458, | 174 | [RMCR] = 0x0458, |
173 | [RPADIR] = 0x0460, | 175 | [RPADIR] = 0x0460, |
174 | [FCFTR] = 0x0468, | 176 | [FCFTR] = 0x0468, |
177 | [CSMR] = 0x04E4, | ||
175 | 178 | ||
176 | [ECMR] = 0x0500, | 179 | [ECMR] = 0x0500, |
177 | [ECSR] = 0x0510, | 180 | [ECSR] = 0x0510, |
@@ -200,6 +203,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
200 | [CERCR] = 0x0768, | 203 | [CERCR] = 0x0768, |
201 | [CEECR] = 0x0770, | 204 | [CEECR] = 0x0770, |
202 | [MAFCR] = 0x0778, | 205 | [MAFCR] = 0x0778, |
206 | [RMII_MII] = 0x0790, | ||
203 | 207 | ||
204 | [ARSTR] = 0x0000, | 208 | [ARSTR] = 0x0000, |
205 | [TSU_CTRST] = 0x0004, | 209 | [TSU_CTRST] = 0x0004, |
@@ -377,7 +381,7 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = { | |||
377 | /* | 381 | /* |
378 | * Register's bits | 382 | * Register's bits |
379 | */ | 383 | */ |
380 | #ifdef CONFIG_CPU_SUBTYPE_SH7763 | 384 | #if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) |
381 | /* EDSR */ | 385 | /* EDSR */ |
382 | enum EDSR_BIT { | 386 | enum EDSR_BIT { |
383 | EDSR_ENT = 0x01, EDSR_ENR = 0x02, | 387 | EDSR_ENT = 0x01, EDSR_ENR = 0x02, |
@@ -689,7 +693,7 @@ enum TSU_FWSLC_BIT { | |||
689 | */ | 693 | */ |
690 | struct sh_eth_txdesc { | 694 | struct sh_eth_txdesc { |
691 | u32 status; /* TD0 */ | 695 | u32 status; /* TD0 */ |
692 | #if defined(CONFIG_CPU_LITTLE_ENDIAN) | 696 | #if defined(__LITTLE_ENDIAN) |
693 | u16 pad0; /* TD1 */ | 697 | u16 pad0; /* TD1 */ |
694 | u16 buffer_length; /* TD1 */ | 698 | u16 buffer_length; /* TD1 */ |
695 | #else | 699 | #else |
@@ -706,7 +710,7 @@ struct sh_eth_txdesc { | |||
706 | */ | 710 | */ |
707 | struct sh_eth_rxdesc { | 711 | struct sh_eth_rxdesc { |
708 | u32 status; /* RD0 */ | 712 | u32 status; /* RD0 */ |
709 | #if defined(CONFIG_CPU_LITTLE_ENDIAN) | 713 | #if defined(__LITTLE_ENDIAN) |
710 | u16 frame_length; /* RD1 */ | 714 | u16 frame_length; /* RD1 */ |
711 | u16 buffer_length; /* RD1 */ | 715 | u16 buffer_length; /* RD1 */ |
712 | #else | 716 | #else |
@@ -751,6 +755,7 @@ struct sh_eth_cpu_data { | |||
751 | unsigned rpadir:1; /* E-DMAC have RPADIR */ | 755 | unsigned rpadir:1; /* E-DMAC have RPADIR */ |
752 | unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */ | 756 | unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */ |
753 | unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ | 757 | unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ |
758 | unsigned hw_crc:1; /* E-DMAC have CSMR */ | ||
754 | }; | 759 | }; |
755 | 760 | ||
756 | struct sh_eth_private { | 761 | struct sh_eth_private { |
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index 4a6971027076..cd3defb11ffb 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1166,10 +1166,8 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat) | |||
1166 | 1166 | ||
1167 | /* Quickly dumps bad packets */ | 1167 | /* Quickly dumps bad packets */ |
1168 | static void | 1168 | static void |
1169 | smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes) | 1169 | smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktwords) |
1170 | { | 1170 | { |
1171 | unsigned int pktwords = (pktbytes + NET_IP_ALIGN + 3) >> 2; | ||
1172 | |||
1173 | if (likely(pktwords >= 4)) { | 1171 | if (likely(pktwords >= 4)) { |
1174 | unsigned int timeout = 500; | 1172 | unsigned int timeout = 500; |
1175 | unsigned int val; | 1173 | unsigned int val; |
@@ -1233,7 +1231,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
1233 | continue; | 1231 | continue; |
1234 | } | 1232 | } |
1235 | 1233 | ||
1236 | skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN); | 1234 | skb = netdev_alloc_skb(dev, pktwords << 2); |
1237 | if (unlikely(!skb)) { | 1235 | if (unlikely(!skb)) { |
1238 | SMSC_WARN(pdata, rx_err, | 1236 | SMSC_WARN(pdata, rx_err, |
1239 | "Unable to allocate skb for rx packet"); | 1237 | "Unable to allocate skb for rx packet"); |
@@ -1243,14 +1241,12 @@ static int smsc911x_poll(struct napi_struct *napi, int budget) | |||
1243 | break; | 1241 | break; |
1244 | } | 1242 | } |
1245 | 1243 | ||
1246 | skb->data = skb->head; | 1244 | pdata->ops->rx_readfifo(pdata, |
1247 | skb_reset_tail_pointer(skb); | 1245 | (unsigned int *)skb->data, pktwords); |
1248 | 1246 | ||
1249 | /* Align IP on 16B boundary */ | 1247 | /* Align IP on 16B boundary */ |
1250 | skb_reserve(skb, NET_IP_ALIGN); | 1248 | skb_reserve(skb, NET_IP_ALIGN); |
1251 | skb_put(skb, pktlength - 4); | 1249 | skb_put(skb, pktlength - 4); |
1252 | pdata->ops->rx_readfifo(pdata, | ||
1253 | (unsigned int *)skb->head, pktwords); | ||
1254 | skb->protocol = eth_type_trans(skb, dev); | 1250 | skb->protocol = eth_type_trans(skb, dev); |
1255 | skb_checksum_none_assert(skb); | 1251 | skb_checksum_none_assert(skb); |
1256 | netif_receive_skb(skb); | 1252 | netif_receive_skb(skb); |
@@ -1565,7 +1561,7 @@ static int smsc911x_open(struct net_device *dev) | |||
1565 | smsc911x_reg_write(pdata, FIFO_INT, temp); | 1561 | smsc911x_reg_write(pdata, FIFO_INT, temp); |
1566 | 1562 | ||
1567 | /* set RX Data offset to 2 bytes for alignment */ | 1563 | /* set RX Data offset to 2 bytes for alignment */ |
1568 | smsc911x_reg_write(pdata, RX_CFG, (2 << 8)); | 1564 | smsc911x_reg_write(pdata, RX_CFG, (NET_IP_ALIGN << 8)); |
1569 | 1565 | ||
1570 | /* enable NAPI polling before enabling RX interrupts */ | 1566 | /* enable NAPI polling before enabling RX interrupts */ |
1571 | napi_enable(&pdata->napi); | 1567 | napi_enable(&pdata->napi); |
@@ -2382,7 +2378,6 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
2382 | SET_NETDEV_DEV(dev, &pdev->dev); | 2378 | SET_NETDEV_DEV(dev, &pdev->dev); |
2383 | 2379 | ||
2384 | pdata = netdev_priv(dev); | 2380 | pdata = netdev_priv(dev); |
2385 | |||
2386 | dev->irq = irq_res->start; | 2381 | dev->irq = irq_res->start; |
2387 | irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; | 2382 | irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; |
2388 | pdata->ioaddr = ioremap_nocache(res->start, res_size); | 2383 | pdata->ioaddr = ioremap_nocache(res->start, res_size); |
@@ -2446,7 +2441,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
2446 | if (retval) { | 2441 | if (retval) { |
2447 | SMSC_WARN(pdata, probe, | 2442 | SMSC_WARN(pdata, probe, |
2448 | "Unable to claim requested irq: %d", dev->irq); | 2443 | "Unable to claim requested irq: %d", dev->irq); |
2449 | goto out_free_irq; | 2444 | goto out_disable_resources; |
2450 | } | 2445 | } |
2451 | 2446 | ||
2452 | retval = register_netdev(dev); | 2447 | retval = register_netdev(dev); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e85ffbd54830..48d56da62f08 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -1737,10 +1737,12 @@ static int stmmac_hw_init(struct stmmac_priv *priv) | |||
1737 | struct mac_device_info *mac; | 1737 | struct mac_device_info *mac; |
1738 | 1738 | ||
1739 | /* Identify the MAC HW device */ | 1739 | /* Identify the MAC HW device */ |
1740 | if (priv->plat->has_gmac) | 1740 | if (priv->plat->has_gmac) { |
1741 | priv->dev->priv_flags |= IFF_UNICAST_FLT; | ||
1741 | mac = dwmac1000_setup(priv->ioaddr); | 1742 | mac = dwmac1000_setup(priv->ioaddr); |
1742 | else | 1743 | } else { |
1743 | mac = dwmac100_setup(priv->ioaddr); | 1744 | mac = dwmac100_setup(priv->ioaddr); |
1745 | } | ||
1744 | if (!mac) | 1746 | if (!mac) |
1745 | return -ENOMEM; | 1747 | return -ENOMEM; |
1746 | 1748 | ||
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 558409ff4058..4ba969096717 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c | |||
@@ -2339,7 +2339,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state) | |||
2339 | netif_device_detach(dev); | 2339 | netif_device_detach(dev); |
2340 | 2340 | ||
2341 | /* Switch off chip, remember WOL setting */ | 2341 | /* Switch off chip, remember WOL setting */ |
2342 | gp->asleep_wol = gp->wake_on_lan; | 2342 | gp->asleep_wol = !!gp->wake_on_lan; |
2343 | gem_do_stop(dev, gp->asleep_wol); | 2343 | gem_do_stop(dev, gp->asleep_wol); |
2344 | 2344 | ||
2345 | /* Unlock the network stack */ | 2345 | /* Unlock the network stack */ |
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 174a3348f676..08aff1a2087c 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
@@ -1511,7 +1511,7 @@ static int emac_devioctl(struct net_device *ndev, struct ifreq *ifrq, int cmd) | |||
1511 | 1511 | ||
1512 | static int match_first_device(struct device *dev, void *data) | 1512 | static int match_first_device(struct device *dev, void *data) |
1513 | { | 1513 | { |
1514 | return 1; | 1514 | return !strncmp(dev_name(dev), "davinci_mdio", 12); |
1515 | } | 1515 | } |
1516 | 1516 | ||
1517 | /** | 1517 | /** |
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c index 2757c7d6e633..e4e47088e26b 100644 --- a/drivers/net/ethernet/ti/davinci_mdio.c +++ b/drivers/net/ethernet/ti/davinci_mdio.c | |||
@@ -181,6 +181,11 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data) | |||
181 | __davinci_mdio_reset(data); | 181 | __davinci_mdio_reset(data); |
182 | return -EAGAIN; | 182 | return -EAGAIN; |
183 | } | 183 | } |
184 | |||
185 | reg = __raw_readl(®s->user[0].access); | ||
186 | if ((reg & USERACCESS_GO) == 0) | ||
187 | return 0; | ||
188 | |||
184 | dev_err(data->dev, "timed out waiting for user access\n"); | 189 | dev_err(data->dev, "timed out waiting for user access\n"); |
185 | return -ETIMEDOUT; | 190 | return -ETIMEDOUT; |
186 | } | 191 | } |
diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c index 817ad3bc4957..efd36691ce54 100644 --- a/drivers/net/ethernet/ti/tlan.c +++ b/drivers/net/ethernet/ti/tlan.c | |||
@@ -228,7 +228,7 @@ tlan_get_skb(const struct tlan_list *tag) | |||
228 | unsigned long addr; | 228 | unsigned long addr; |
229 | 229 | ||
230 | addr = tag->buffer[9].address; | 230 | addr = tag->buffer[9].address; |
231 | addr |= (tag->buffer[8].address << 16) << 16; | 231 | addr |= ((unsigned long) tag->buffer[8].address << 16) << 16; |
232 | return (struct sk_buff *) addr; | 232 | return (struct sk_buff *) addr; |
233 | } | 233 | } |
234 | 234 | ||
diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c index 261356c2dc99..3d501ec7fad7 100644 --- a/drivers/net/ethernet/tile/tilepro.c +++ b/drivers/net/ethernet/tile/tilepro.c | |||
@@ -342,6 +342,21 @@ inline int __netio_fastio1(u32 fastio_index, u32 arg0) | |||
342 | } | 342 | } |
343 | 343 | ||
344 | 344 | ||
345 | static void tile_net_return_credit(struct tile_net_cpu *info) | ||
346 | { | ||
347 | struct tile_netio_queue *queue = &info->queue; | ||
348 | netio_queue_user_impl_t *qup = &queue->__user_part; | ||
349 | |||
350 | /* Return four credits after every fourth packet. */ | ||
351 | if (--qup->__receive_credit_remaining == 0) { | ||
352 | u32 interval = qup->__receive_credit_interval; | ||
353 | qup->__receive_credit_remaining = interval; | ||
354 | __netio_fastio_return_credits(qup->__fastio_index, interval); | ||
355 | } | ||
356 | } | ||
357 | |||
358 | |||
359 | |||
345 | /* | 360 | /* |
346 | * Provide a linux buffer to LIPP. | 361 | * Provide a linux buffer to LIPP. |
347 | */ | 362 | */ |
@@ -433,7 +448,7 @@ static bool tile_net_provide_needed_buffer(struct tile_net_cpu *info, | |||
433 | struct sk_buff **skb_ptr; | 448 | struct sk_buff **skb_ptr; |
434 | 449 | ||
435 | /* Request 96 extra bytes for alignment purposes. */ | 450 | /* Request 96 extra bytes for alignment purposes. */ |
436 | skb = netdev_alloc_skb(info->napi->dev, len + padding); | 451 | skb = netdev_alloc_skb(info->napi.dev, len + padding); |
437 | if (skb == NULL) | 452 | if (skb == NULL) |
438 | return false; | 453 | return false; |
439 | 454 | ||
@@ -864,19 +879,11 @@ static bool tile_net_poll_aux(struct tile_net_cpu *info, int index) | |||
864 | 879 | ||
865 | stats->rx_packets++; | 880 | stats->rx_packets++; |
866 | stats->rx_bytes += len; | 881 | stats->rx_bytes += len; |
867 | |||
868 | if (small) | ||
869 | info->num_needed_small_buffers++; | ||
870 | else | ||
871 | info->num_needed_large_buffers++; | ||
872 | } | 882 | } |
873 | 883 | ||
874 | /* Return four credits after every fourth packet. */ | 884 | /* ISSUE: It would be nice to defer this until the packet has */ |
875 | if (--qup->__receive_credit_remaining == 0) { | 885 | /* actually been processed. */ |
876 | u32 interval = qup->__receive_credit_interval; | 886 | tile_net_return_credit(info); |
877 | qup->__receive_credit_remaining = interval; | ||
878 | __netio_fastio_return_credits(qup->__fastio_index, interval); | ||
879 | } | ||
880 | 887 | ||
881 | /* Consume this packet. */ | 888 | /* Consume this packet. */ |
882 | qup->__packet_receive_read = index2; | 889 | qup->__packet_receive_read = index2; |
@@ -1543,7 +1550,7 @@ static int tile_net_drain_lipp_buffers(struct tile_net_priv *priv) | |||
1543 | 1550 | ||
1544 | /* Drain all the LIPP buffers. */ | 1551 | /* Drain all the LIPP buffers. */ |
1545 | while (true) { | 1552 | while (true) { |
1546 | int buffer; | 1553 | unsigned int buffer; |
1547 | 1554 | ||
1548 | /* NOTE: This should never fail. */ | 1555 | /* NOTE: This should never fail. */ |
1549 | if (hv_dev_pread(priv->hv_devhdl, 0, (HV_VirtAddr)&buffer, | 1556 | if (hv_dev_pread(priv->hv_devhdl, 0, (HV_VirtAddr)&buffer, |
@@ -1707,7 +1714,7 @@ static unsigned int tile_net_tx_frags(lepp_frag_t *frags, | |||
1707 | if (!hash_default) { | 1714 | if (!hash_default) { |
1708 | void *va = pfn_to_kaddr(pfn) + f->page_offset; | 1715 | void *va = pfn_to_kaddr(pfn) + f->page_offset; |
1709 | BUG_ON(PageHighMem(skb_frag_page(f))); | 1716 | BUG_ON(PageHighMem(skb_frag_page(f))); |
1710 | finv_buffer_remote(va, f->size, 0); | 1717 | finv_buffer_remote(va, skb_frag_size(f), 0); |
1711 | } | 1718 | } |
1712 | 1719 | ||
1713 | cpa = ((phys_addr_t)pfn << PAGE_SHIFT) + f->page_offset; | 1720 | cpa = ((phys_addr_t)pfn << PAGE_SHIFT) + f->page_offset; |
@@ -1735,8 +1742,8 @@ static unsigned int tile_net_tx_frags(lepp_frag_t *frags, | |||
1735 | * Sometimes, if "sendfile()" requires copying, we will be called with | 1742 | * Sometimes, if "sendfile()" requires copying, we will be called with |
1736 | * "data" containing the header and payload, with "frags" being empty. | 1743 | * "data" containing the header and payload, with "frags" being empty. |
1737 | * | 1744 | * |
1738 | * In theory, "sh->nr_frags" could be 3, but in practice, it seems | 1745 | * Sometimes, for example when using NFS over TCP, a single segment can |
1739 | * that this will never actually happen. | 1746 | * span 3 fragments, which must be handled carefully in LEPP. |
1740 | * | 1747 | * |
1741 | * See "emulate_large_send_offload()" for some reference code, which | 1748 | * See "emulate_large_send_offload()" for some reference code, which |
1742 | * does not handle checksumming. | 1749 | * does not handle checksumming. |
@@ -1844,10 +1851,8 @@ static int tile_net_tx_tso(struct sk_buff *skb, struct net_device *dev) | |||
1844 | 1851 | ||
1845 | spin_lock_irqsave(&priv->eq_lock, irqflags); | 1852 | spin_lock_irqsave(&priv->eq_lock, irqflags); |
1846 | 1853 | ||
1847 | /* | 1854 | /* Handle completions if needed to make room. */ |
1848 | * Handle completions if needed to make room. | 1855 | /* NOTE: Return NETDEV_TX_BUSY if there is still no room. */ |
1849 | * HACK: Spin until there is sufficient room. | ||
1850 | */ | ||
1851 | if (lepp_num_free_comp_slots(eq) == 0) { | 1856 | if (lepp_num_free_comp_slots(eq) == 0) { |
1852 | nolds = tile_net_lepp_grab_comps(eq, olds, wanted, 0); | 1857 | nolds = tile_net_lepp_grab_comps(eq, olds, wanted, 0); |
1853 | if (nolds == 0) { | 1858 | if (nolds == 0) { |
@@ -1861,6 +1866,7 @@ busy: | |||
1861 | cmd_tail = eq->cmd_tail; | 1866 | cmd_tail = eq->cmd_tail; |
1862 | 1867 | ||
1863 | /* Prepare to advance, detecting full queue. */ | 1868 | /* Prepare to advance, detecting full queue. */ |
1869 | /* NOTE: Return NETDEV_TX_BUSY if the queue is full. */ | ||
1864 | cmd_next = cmd_tail + cmd_size; | 1870 | cmd_next = cmd_tail + cmd_size; |
1865 | if (cmd_tail < cmd_head && cmd_next >= cmd_head) | 1871 | if (cmd_tail < cmd_head && cmd_next >= cmd_head) |
1866 | goto busy; | 1872 | goto busy; |
@@ -2023,10 +2029,8 @@ static int tile_net_tx(struct sk_buff *skb, struct net_device *dev) | |||
2023 | 2029 | ||
2024 | spin_lock_irqsave(&priv->eq_lock, irqflags); | 2030 | spin_lock_irqsave(&priv->eq_lock, irqflags); |
2025 | 2031 | ||
2026 | /* | 2032 | /* Handle completions if needed to make room. */ |
2027 | * Handle completions if needed to make room. | 2033 | /* NOTE: Return NETDEV_TX_BUSY if there is still no room. */ |
2028 | * HACK: Spin until there is sufficient room. | ||
2029 | */ | ||
2030 | if (lepp_num_free_comp_slots(eq) == 0) { | 2034 | if (lepp_num_free_comp_slots(eq) == 0) { |
2031 | nolds = tile_net_lepp_grab_comps(eq, olds, wanted, 0); | 2035 | nolds = tile_net_lepp_grab_comps(eq, olds, wanted, 0); |
2032 | if (nolds == 0) { | 2036 | if (nolds == 0) { |
@@ -2040,6 +2044,7 @@ busy: | |||
2040 | cmd_tail = eq->cmd_tail; | 2044 | cmd_tail = eq->cmd_tail; |
2041 | 2045 | ||
2042 | /* Copy the commands, or fail. */ | 2046 | /* Copy the commands, or fail. */ |
2047 | /* NOTE: Return NETDEV_TX_BUSY if the queue is full. */ | ||
2043 | for (i = 0; i < num_frags; i++) { | 2048 | for (i = 0; i < num_frags; i++) { |
2044 | 2049 | ||
2045 | /* Prepare to advance, detecting full queue. */ | 2050 | /* Prepare to advance, detecting full queue. */ |
@@ -2261,6 +2266,23 @@ static int tile_net_get_mac(struct net_device *dev) | |||
2261 | return 0; | 2266 | return 0; |
2262 | } | 2267 | } |
2263 | 2268 | ||
2269 | |||
2270 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
2271 | /* | ||
2272 | * Polling 'interrupt' - used by things like netconsole to send skbs | ||
2273 | * without having to re-enable interrupts. It's not called while | ||
2274 | * the interrupt routine is executing. | ||
2275 | */ | ||
2276 | static void tile_net_netpoll(struct net_device *dev) | ||
2277 | { | ||
2278 | struct tile_net_priv *priv = netdev_priv(dev); | ||
2279 | disable_percpu_irq(priv->intr_id); | ||
2280 | tile_net_handle_ingress_interrupt(priv->intr_id, dev); | ||
2281 | enable_percpu_irq(priv->intr_id, 0); | ||
2282 | } | ||
2283 | #endif | ||
2284 | |||
2285 | |||
2264 | static const struct net_device_ops tile_net_ops = { | 2286 | static const struct net_device_ops tile_net_ops = { |
2265 | .ndo_open = tile_net_open, | 2287 | .ndo_open = tile_net_open, |
2266 | .ndo_stop = tile_net_stop, | 2288 | .ndo_stop = tile_net_stop, |
@@ -2269,7 +2291,10 @@ static const struct net_device_ops tile_net_ops = { | |||
2269 | .ndo_get_stats = tile_net_get_stats, | 2291 | .ndo_get_stats = tile_net_get_stats, |
2270 | .ndo_change_mtu = tile_net_change_mtu, | 2292 | .ndo_change_mtu = tile_net_change_mtu, |
2271 | .ndo_tx_timeout = tile_net_tx_timeout, | 2293 | .ndo_tx_timeout = tile_net_tx_timeout, |
2272 | .ndo_set_mac_address = tile_net_set_mac_address | 2294 | .ndo_set_mac_address = tile_net_set_mac_address, |
2295 | #ifdef CONFIG_NET_POLL_CONTROLLER | ||
2296 | .ndo_poll_controller = tile_net_netpoll, | ||
2297 | #endif | ||
2273 | }; | 2298 | }; |
2274 | 2299 | ||
2275 | 2300 | ||
@@ -2409,7 +2434,7 @@ static void tile_net_cleanup(void) | |||
2409 | */ | 2434 | */ |
2410 | static int tile_net_init_module(void) | 2435 | static int tile_net_init_module(void) |
2411 | { | 2436 | { |
2412 | pr_info("Tilera IPP Net Driver\n"); | 2437 | pr_info("Tilera Network Driver\n"); |
2413 | 2438 | ||
2414 | tile_net_devs[0] = tile_net_dev_init("xgbe0"); | 2439 | tile_net_devs[0] = tile_net_dev_init("xgbe0"); |
2415 | tile_net_devs[1] = tile_net_dev_init("xgbe1"); | 2440 | tile_net_devs[1] = tile_net_dev_init("xgbe1"); |
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c index 39b8cf3dafcd..fcfa01f7ceb6 100644 --- a/drivers/net/ethernet/via/via-rhine.c +++ b/drivers/net/ethernet/via/via-rhine.c | |||
@@ -503,30 +503,32 @@ static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid); | |||
503 | static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); | 503 | static int rhine_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid); |
504 | static void rhine_restart_tx(struct net_device *dev); | 504 | static void rhine_restart_tx(struct net_device *dev); |
505 | 505 | ||
506 | static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool high) | 506 | static void rhine_wait_bit(struct rhine_private *rp, u8 reg, u8 mask, bool low) |
507 | { | 507 | { |
508 | void __iomem *ioaddr = rp->base; | 508 | void __iomem *ioaddr = rp->base; |
509 | int i; | 509 | int i; |
510 | 510 | ||
511 | for (i = 0; i < 1024; i++) { | 511 | for (i = 0; i < 1024; i++) { |
512 | if (high ^ !!(ioread8(ioaddr + reg) & mask)) | 512 | bool has_mask_bits = !!(ioread8(ioaddr + reg) & mask); |
513 | |||
514 | if (low ^ has_mask_bits) | ||
513 | break; | 515 | break; |
514 | udelay(10); | 516 | udelay(10); |
515 | } | 517 | } |
516 | if (i > 64) { | 518 | if (i > 64) { |
517 | netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle " | 519 | netif_dbg(rp, hw, rp->dev, "%s bit wait (%02x/%02x) cycle " |
518 | "count: %04d\n", high ? "high" : "low", reg, mask, i); | 520 | "count: %04d\n", low ? "low" : "high", reg, mask, i); |
519 | } | 521 | } |
520 | } | 522 | } |
521 | 523 | ||
522 | static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask) | 524 | static void rhine_wait_bit_high(struct rhine_private *rp, u8 reg, u8 mask) |
523 | { | 525 | { |
524 | rhine_wait_bit(rp, reg, mask, true); | 526 | rhine_wait_bit(rp, reg, mask, false); |
525 | } | 527 | } |
526 | 528 | ||
527 | static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask) | 529 | static void rhine_wait_bit_low(struct rhine_private *rp, u8 reg, u8 mask) |
528 | { | 530 | { |
529 | rhine_wait_bit(rp, reg, mask, false); | 531 | rhine_wait_bit(rp, reg, mask, true); |
530 | } | 532 | } |
531 | 533 | ||
532 | static u32 rhine_get_events(struct rhine_private *rp) | 534 | static u32 rhine_get_events(struct rhine_private *rp) |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index cc83af083fd7..44b8d2bad8c3 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h | |||
@@ -2,9 +2,7 @@ | |||
2 | * Definitions for Xilinx Axi Ethernet device driver. | 2 | * Definitions for Xilinx Axi Ethernet device driver. |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. | 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. |
5 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 5 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
6 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | ||
7 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | ||
8 | */ | 6 | */ |
9 | 7 | ||
10 | #ifndef XILINX_AXIENET_H | 8 | #ifndef XILINX_AXIENET_H |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 2fcbeba6814b..9c365e192a31 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
@@ -4,9 +4,9 @@ | |||
4 | * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi | 4 | * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi |
5 | * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> | 5 | * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net> |
6 | * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. | 6 | * Copyright (c) 2008-2009 Secret Lab Technologies Ltd. |
7 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 7 | * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu> |
8 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | 8 | * Copyright (c) 2010 - 2011 PetaLogix |
9 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | 9 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
10 | * | 10 | * |
11 | * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 | 11 | * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6 |
12 | * and Spartan6. | 12 | * and Spartan6. |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c index d70b6e79f6c0..e90e1f46121e 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | |||
@@ -2,9 +2,9 @@ | |||
2 | * MDIO bus driver for the Xilinx Axi Ethernet device | 2 | * MDIO bus driver for the Xilinx Axi Ethernet device |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. | 4 | * Copyright (c) 2009 Secret Lab Technologies, Ltd. |
5 | * Copyright (c) 2010 Xilinx, Inc. All rights reserved. | 5 | * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu> |
6 | * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch> | 6 | * Copyright (c) 2010 - 2011 PetaLogix |
7 | * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch> | 7 | * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/of_address.h> | 10 | #include <linux/of_address.h> |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index dd294783b5c5..2d59138db7f3 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -44,6 +44,7 @@ struct net_device_context { | |||
44 | /* point back to our device context */ | 44 | /* point back to our device context */ |
45 | struct hv_device *device_ctx; | 45 | struct hv_device *device_ctx; |
46 | struct delayed_work dwork; | 46 | struct delayed_work dwork; |
47 | struct work_struct work; | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | 50 | ||
@@ -51,30 +52,22 @@ static int ring_size = 128; | |||
51 | module_param(ring_size, int, S_IRUGO); | 52 | module_param(ring_size, int, S_IRUGO); |
52 | MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); | 53 | MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); |
53 | 54 | ||
54 | struct set_multicast_work { | ||
55 | struct work_struct work; | ||
56 | struct net_device *net; | ||
57 | }; | ||
58 | |||
59 | static void do_set_multicast(struct work_struct *w) | 55 | static void do_set_multicast(struct work_struct *w) |
60 | { | 56 | { |
61 | struct set_multicast_work *swk = | 57 | struct net_device_context *ndevctx = |
62 | container_of(w, struct set_multicast_work, work); | 58 | container_of(w, struct net_device_context, work); |
63 | struct net_device *net = swk->net; | ||
64 | |||
65 | struct net_device_context *ndevctx = netdev_priv(net); | ||
66 | struct netvsc_device *nvdev; | 59 | struct netvsc_device *nvdev; |
67 | struct rndis_device *rdev; | 60 | struct rndis_device *rdev; |
68 | 61 | ||
69 | nvdev = hv_get_drvdata(ndevctx->device_ctx); | 62 | nvdev = hv_get_drvdata(ndevctx->device_ctx); |
70 | if (nvdev == NULL) | 63 | if (nvdev == NULL || nvdev->ndev == NULL) |
71 | goto out; | 64 | return; |
72 | 65 | ||
73 | rdev = nvdev->extension; | 66 | rdev = nvdev->extension; |
74 | if (rdev == NULL) | 67 | if (rdev == NULL) |
75 | goto out; | 68 | return; |
76 | 69 | ||
77 | if (net->flags & IFF_PROMISC) | 70 | if (nvdev->ndev->flags & IFF_PROMISC) |
78 | rndis_filter_set_packet_filter(rdev, | 71 | rndis_filter_set_packet_filter(rdev, |
79 | NDIS_PACKET_TYPE_PROMISCUOUS); | 72 | NDIS_PACKET_TYPE_PROMISCUOUS); |
80 | else | 73 | else |
@@ -82,21 +75,13 @@ static void do_set_multicast(struct work_struct *w) | |||
82 | NDIS_PACKET_TYPE_BROADCAST | | 75 | NDIS_PACKET_TYPE_BROADCAST | |
83 | NDIS_PACKET_TYPE_ALL_MULTICAST | | 76 | NDIS_PACKET_TYPE_ALL_MULTICAST | |
84 | NDIS_PACKET_TYPE_DIRECTED); | 77 | NDIS_PACKET_TYPE_DIRECTED); |
85 | |||
86 | out: | ||
87 | kfree(w); | ||
88 | } | 78 | } |
89 | 79 | ||
90 | static void netvsc_set_multicast_list(struct net_device *net) | 80 | static void netvsc_set_multicast_list(struct net_device *net) |
91 | { | 81 | { |
92 | struct set_multicast_work *swk = | 82 | struct net_device_context *net_device_ctx = netdev_priv(net); |
93 | kmalloc(sizeof(struct set_multicast_work), GFP_ATOMIC); | ||
94 | if (swk == NULL) | ||
95 | return; | ||
96 | 83 | ||
97 | swk->net = net; | 84 | schedule_work(&net_device_ctx->work); |
98 | INIT_WORK(&swk->work, do_set_multicast); | ||
99 | schedule_work(&swk->work); | ||
100 | } | 85 | } |
101 | 86 | ||
102 | static int netvsc_open(struct net_device *net) | 87 | static int netvsc_open(struct net_device *net) |
@@ -125,6 +110,8 @@ static int netvsc_close(struct net_device *net) | |||
125 | 110 | ||
126 | netif_tx_disable(net); | 111 | netif_tx_disable(net); |
127 | 112 | ||
113 | /* Make sure netvsc_set_multicast_list doesn't re-enable filter! */ | ||
114 | cancel_work_sync(&net_device_ctx->work); | ||
128 | ret = rndis_filter_close(device_obj); | 115 | ret = rndis_filter_close(device_obj); |
129 | if (ret != 0) | 116 | if (ret != 0) |
130 | netdev_err(net, "unable to close device (ret %d).\n", ret); | 117 | netdev_err(net, "unable to close device (ret %d).\n", ret); |
@@ -335,6 +322,7 @@ static int netvsc_change_mtu(struct net_device *ndev, int mtu) | |||
335 | 322 | ||
336 | nvdev->start_remove = true; | 323 | nvdev->start_remove = true; |
337 | cancel_delayed_work_sync(&ndevctx->dwork); | 324 | cancel_delayed_work_sync(&ndevctx->dwork); |
325 | cancel_work_sync(&ndevctx->work); | ||
338 | netif_tx_disable(ndev); | 326 | netif_tx_disable(ndev); |
339 | rndis_filter_device_remove(hdev); | 327 | rndis_filter_device_remove(hdev); |
340 | 328 | ||
@@ -403,6 +391,7 @@ static int netvsc_probe(struct hv_device *dev, | |||
403 | net_device_ctx->device_ctx = dev; | 391 | net_device_ctx->device_ctx = dev; |
404 | hv_set_drvdata(dev, net); | 392 | hv_set_drvdata(dev, net); |
405 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp); | 393 | INIT_DELAYED_WORK(&net_device_ctx->dwork, netvsc_send_garp); |
394 | INIT_WORK(&net_device_ctx->work, do_set_multicast); | ||
406 | 395 | ||
407 | net->netdev_ops = &device_ops; | 396 | net->netdev_ops = &device_ops; |
408 | 397 | ||
@@ -456,6 +445,7 @@ static int netvsc_remove(struct hv_device *dev) | |||
456 | 445 | ||
457 | ndev_ctx = netdev_priv(net); | 446 | ndev_ctx = netdev_priv(net); |
458 | cancel_delayed_work_sync(&ndev_ctx->dwork); | 447 | cancel_delayed_work_sync(&ndev_ctx->dwork); |
448 | cancel_work_sync(&ndev_ctx->work); | ||
459 | 449 | ||
460 | /* Stop outbound asap */ | 450 | /* Stop outbound asap */ |
461 | netif_tx_disable(net); | 451 | netif_tx_disable(net); |
diff --git a/drivers/net/irda/sa1100_ir.c b/drivers/net/irda/sa1100_ir.c index a0d1913a58d3..e25067552b20 100644 --- a/drivers/net/irda/sa1100_ir.c +++ b/drivers/net/irda/sa1100_ir.c | |||
@@ -147,7 +147,7 @@ static void sa1100_irda_dma_start(struct sa1100_buf *buf, | |||
147 | struct dma_async_tx_descriptor *desc; | 147 | struct dma_async_tx_descriptor *desc; |
148 | struct dma_chan *chan = buf->chan; | 148 | struct dma_chan *chan = buf->chan; |
149 | 149 | ||
150 | desc = chan->device->device_prep_slave_sg(chan, &buf->sg, 1, dir, | 150 | desc = dmaengine_prep_slave_sg(chan, &buf->sg, 1, dir, |
151 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 151 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
152 | if (desc) { | 152 | if (desc) { |
153 | desc->callback = cb; | 153 | desc->callback = cb; |
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index 0856e1b7a849..5ac46f5226f3 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
@@ -40,6 +40,7 @@ MODULE_LICENSE("GPL"); | |||
40 | #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ | 40 | #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ |
41 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ | 41 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ |
42 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ | 42 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ |
43 | #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ | ||
43 | 44 | ||
44 | static int ip175c_config_init(struct phy_device *phydev) | 45 | static int ip175c_config_init(struct phy_device *phydev) |
45 | { | 46 | { |
@@ -162,7 +163,8 @@ static int ip101a_g_config_init(struct phy_device *phydev) | |||
162 | /* Enable Auto Power Saving mode */ | 163 | /* Enable Auto Power Saving mode */ |
163 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); | 164 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); |
164 | c |= IP101A_G_APS_ON; | 165 | c |= IP101A_G_APS_ON; |
165 | return c; | 166 | |
167 | return phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); | ||
166 | } | 168 | } |
167 | 169 | ||
168 | static int ip175c_read_status(struct phy_device *phydev) | 170 | static int ip175c_read_status(struct phy_device *phydev) |
@@ -184,6 +186,15 @@ static int ip175c_config_aneg(struct phy_device *phydev) | |||
184 | return 0; | 186 | return 0; |
185 | } | 187 | } |
186 | 188 | ||
189 | static int ip101a_g_ack_interrupt(struct phy_device *phydev) | ||
190 | { | ||
191 | int err = phy_read(phydev, IP101A_G_IRQ_CONF_STATUS); | ||
192 | if (err < 0) | ||
193 | return err; | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
187 | static struct phy_driver ip175c_driver = { | 198 | static struct phy_driver ip175c_driver = { |
188 | .phy_id = 0x02430d80, | 199 | .phy_id = 0x02430d80, |
189 | .name = "ICPlus IP175C", | 200 | .name = "ICPlus IP175C", |
@@ -203,7 +214,6 @@ static struct phy_driver ip1001_driver = { | |||
203 | .phy_id_mask = 0x0ffffff0, | 214 | .phy_id_mask = 0x0ffffff0, |
204 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | | 215 | .features = PHY_GBIT_FEATURES | SUPPORTED_Pause | |
205 | SUPPORTED_Asym_Pause, | 216 | SUPPORTED_Asym_Pause, |
206 | .flags = PHY_HAS_INTERRUPT, | ||
207 | .config_init = &ip1001_config_init, | 217 | .config_init = &ip1001_config_init, |
208 | .config_aneg = &genphy_config_aneg, | 218 | .config_aneg = &genphy_config_aneg, |
209 | .read_status = &genphy_read_status, | 219 | .read_status = &genphy_read_status, |
@@ -219,6 +229,7 @@ static struct phy_driver ip101a_g_driver = { | |||
219 | .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | | 229 | .features = PHY_BASIC_FEATURES | SUPPORTED_Pause | |
220 | SUPPORTED_Asym_Pause, | 230 | SUPPORTED_Asym_Pause, |
221 | .flags = PHY_HAS_INTERRUPT, | 231 | .flags = PHY_HAS_INTERRUPT, |
232 | .ack_interrupt = ip101a_g_ack_interrupt, | ||
222 | .config_init = &ip101a_g_config_init, | 233 | .config_init = &ip101a_g_config_init, |
223 | .config_aneg = &genphy_config_aneg, | 234 | .config_aneg = &genphy_config_aneg, |
224 | .read_status = &genphy_read_status, | 235 | .read_status = &genphy_read_status, |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 159da2905fe9..21d7151fb0ab 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
@@ -968,7 +968,6 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
968 | proto = npindex_to_proto[npi]; | 968 | proto = npindex_to_proto[npi]; |
969 | put_unaligned_be16(proto, pp); | 969 | put_unaligned_be16(proto, pp); |
970 | 970 | ||
971 | netif_stop_queue(dev); | ||
972 | skb_queue_tail(&ppp->file.xq, skb); | 971 | skb_queue_tail(&ppp->file.xq, skb); |
973 | ppp_xmit_process(ppp); | 972 | ppp_xmit_process(ppp); |
974 | return NETDEV_TX_OK; | 973 | return NETDEV_TX_OK; |
@@ -1063,6 +1062,8 @@ ppp_xmit_process(struct ppp *ppp) | |||
1063 | code that we can accept some more. */ | 1062 | code that we can accept some more. */ |
1064 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) | 1063 | if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq)) |
1065 | netif_wake_queue(ppp->dev); | 1064 | netif_wake_queue(ppp->dev); |
1065 | else | ||
1066 | netif_stop_queue(ppp->dev); | ||
1066 | } | 1067 | } |
1067 | ppp_xmit_unlock(ppp); | 1068 | ppp_xmit_unlock(ppp); |
1068 | } | 1069 | } |
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index a57f05726b57..91d25888a1b9 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -375,8 +375,8 @@ static void rionet_remove(struct rio_dev *rdev) | |||
375 | struct net_device *ndev = rio_get_drvdata(rdev); | 375 | struct net_device *ndev = rio_get_drvdata(rdev); |
376 | struct rionet_peer *peer, *tmp; | 376 | struct rionet_peer *peer, *tmp; |
377 | 377 | ||
378 | free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? | 378 | free_pages((unsigned long)rionet_active, get_order(sizeof(void *) * |
379 | __fls(sizeof(void *)) + 4 : 0); | 379 | RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size))); |
380 | unregister_netdev(ndev); | 380 | unregister_netdev(ndev); |
381 | free_netdev(ndev); | 381 | free_netdev(ndev); |
382 | 382 | ||
@@ -432,15 +432,16 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev) | |||
432 | int rc = 0; | 432 | int rc = 0; |
433 | struct rionet_private *rnet; | 433 | struct rionet_private *rnet; |
434 | u16 device_id; | 434 | u16 device_id; |
435 | const size_t rionet_active_bytes = sizeof(void *) * | ||
436 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size); | ||
435 | 437 | ||
436 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, | 438 | rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, |
437 | mport->sys_size ? __fls(sizeof(void *)) + 4 : 0); | 439 | get_order(rionet_active_bytes)); |
438 | if (!rionet_active) { | 440 | if (!rionet_active) { |
439 | rc = -ENOMEM; | 441 | rc = -ENOMEM; |
440 | goto out; | 442 | goto out; |
441 | } | 443 | } |
442 | memset((void *)rionet_active, 0, sizeof(void *) * | 444 | memset((void *)rionet_active, 0, rionet_active_bytes); |
443 | RIO_MAX_ROUTE_ENTRIES(mport->sys_size)); | ||
444 | 445 | ||
445 | /* Set up private area */ | 446 | /* Set up private area */ |
446 | rnet = netdev_priv(ndev); | 447 | rnet = netdev_priv(ndev); |
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-phonet.c b/drivers/net/usb/cdc-phonet.c index 3886b30ed373..3e41b00c6806 100644 --- a/drivers/net/usb/cdc-phonet.c +++ b/drivers/net/usb/cdc-phonet.c | |||
@@ -165,13 +165,13 @@ static void rx_complete(struct urb *req) | |||
165 | memcpy(skb_put(skb, 1), page_address(page), 1); | 165 | memcpy(skb_put(skb, 1), page_address(page), 1); |
166 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | 166 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
167 | page, 1, req->actual_length, | 167 | page, 1, req->actual_length, |
168 | req->actual_length); | 168 | PAGE_SIZE); |
169 | page = NULL; | 169 | page = NULL; |
170 | } | 170 | } |
171 | } else { | 171 | } else { |
172 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, | 172 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, |
173 | page, 0, req->actual_length, | 173 | page, 0, req->actual_length, |
174 | req->actual_length); | 174 | PAGE_SIZE); |
175 | page = NULL; | 175 | page = NULL; |
176 | } | 176 | } |
177 | if (req->actual_length < PAGE_SIZE) | 177 | if (req->actual_length < PAGE_SIZE) |
diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c index 439690be519f..685a4e22c768 100644 --- a/drivers/net/usb/cdc_eem.c +++ b/drivers/net/usb/cdc_eem.c | |||
@@ -93,6 +93,7 @@ static int eem_bind(struct usbnet *dev, struct usb_interface *intf) | |||
93 | /* no jumbogram (16K) support for now */ | 93 | /* no jumbogram (16K) support for now */ |
94 | 94 | ||
95 | dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN; | 95 | dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN; |
96 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
96 | 97 | ||
97 | return 0; | 98 | return 0; |
98 | } | 99 | } |
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c index 552d24bf862e..d316503b35d4 100644 --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c | |||
@@ -365,6 +365,27 @@ static const struct driver_info qmi_wwan_force_int4 = { | |||
365 | .data = BIT(4), /* interface whitelist bitmap */ | 365 | .data = BIT(4), /* interface whitelist bitmap */ |
366 | }; | 366 | }; |
367 | 367 | ||
368 | /* Sierra Wireless provide equally useless interface descriptors | ||
369 | * Devices in QMI mode can be switched between two different | ||
370 | * configurations: | ||
371 | * a) USB interface #8 is QMI/wwan | ||
372 | * b) USB interfaces #8, #19 and #20 are QMI/wwan | ||
373 | * | ||
374 | * Both configurations provide a number of other interfaces (serial++), | ||
375 | * some of which have the same endpoint configuration as we expect, so | ||
376 | * a whitelist or blacklist is necessary. | ||
377 | * | ||
378 | * FIXME: The below whitelist should include BIT(20). It does not | ||
379 | * because I cannot get it to work... | ||
380 | */ | ||
381 | static const struct driver_info qmi_wwan_sierra = { | ||
382 | .description = "Sierra Wireless wwan/QMI device", | ||
383 | .flags = FLAG_WWAN, | ||
384 | .bind = qmi_wwan_bind_gobi, | ||
385 | .unbind = qmi_wwan_unbind_shared, | ||
386 | .manage_power = qmi_wwan_manage_power, | ||
387 | .data = BIT(8) | BIT(19), /* interface whitelist bitmap */ | ||
388 | }; | ||
368 | 389 | ||
369 | #define HUAWEI_VENDOR_ID 0x12D1 | 390 | #define HUAWEI_VENDOR_ID 0x12D1 |
370 | #define QMI_GOBI_DEVICE(vend, prod) \ | 391 | #define QMI_GOBI_DEVICE(vend, prod) \ |
@@ -445,6 +466,15 @@ static const struct usb_device_id products[] = { | |||
445 | .bInterfaceProtocol = 0xff, | 466 | .bInterfaceProtocol = 0xff, |
446 | .driver_info = (unsigned long)&qmi_wwan_force_int4, | 467 | .driver_info = (unsigned long)&qmi_wwan_force_int4, |
447 | }, | 468 | }, |
469 | { /* Sierra Wireless MC77xx in QMI mode */ | ||
470 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_INFO, | ||
471 | .idVendor = 0x1199, | ||
472 | .idProduct = 0x68a2, | ||
473 | .bInterfaceClass = 0xff, | ||
474 | .bInterfaceSubClass = 0xff, | ||
475 | .bInterfaceProtocol = 0xff, | ||
476 | .driver_info = (unsigned long)&qmi_wwan_sierra, | ||
477 | }, | ||
448 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ | 478 | {QMI_GOBI_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
449 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ | 479 | {QMI_GOBI_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
450 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ | 480 | {QMI_GOBI_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c index 6dda2fe5b15b..d363b31053da 100644 --- a/drivers/net/usb/rtl8150.c +++ b/drivers/net/usb/rtl8150.c | |||
@@ -85,32 +85,6 @@ | |||
85 | #define INT_CRERR_CNT 0x06 | 85 | #define INT_CRERR_CNT 0x06 |
86 | #define INT_COL_CNT 0x07 | 86 | #define INT_COL_CNT 0x07 |
87 | 87 | ||
88 | /* Transmit status register errors */ | ||
89 | #define TSR_ECOL (1<<5) | ||
90 | #define TSR_LCOL (1<<4) | ||
91 | #define TSR_LOSS_CRS (1<<3) | ||
92 | #define TSR_JBR (1<<2) | ||
93 | #define TSR_ERRORS (TSR_ECOL | TSR_LCOL | TSR_LOSS_CRS | TSR_JBR) | ||
94 | /* Receive status register errors */ | ||
95 | #define RSR_CRC (1<<2) | ||
96 | #define RSR_FAE (1<<1) | ||
97 | #define RSR_ERRORS (RSR_CRC | RSR_FAE) | ||
98 | |||
99 | /* Media status register definitions */ | ||
100 | #define MSR_DUPLEX (1<<4) | ||
101 | #define MSR_SPEED (1<<3) | ||
102 | #define MSR_LINK (1<<2) | ||
103 | |||
104 | /* Interrupt pipe data */ | ||
105 | #define INT_TSR 0x00 | ||
106 | #define INT_RSR 0x01 | ||
107 | #define INT_MSR 0x02 | ||
108 | #define INT_WAKSR 0x03 | ||
109 | #define INT_TXOK_CNT 0x04 | ||
110 | #define INT_RXLOST_CNT 0x05 | ||
111 | #define INT_CRERR_CNT 0x06 | ||
112 | #define INT_COL_CNT 0x07 | ||
113 | |||
114 | 88 | ||
115 | #define RTL8150_MTU 1540 | 89 | #define RTL8150_MTU 1540 |
116 | #define RTL8150_TX_TIMEOUT (HZ) | 90 | #define RTL8150_TX_TIMEOUT (HZ) |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 187d01ccb973..00103a8c5e04 100644 --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c | |||
@@ -98,7 +98,7 @@ static int __must_check smsc75xx_read_reg(struct usbnet *dev, u32 index, | |||
98 | 98 | ||
99 | if (unlikely(ret < 0)) | 99 | if (unlikely(ret < 0)) |
100 | netdev_warn(dev->net, | 100 | netdev_warn(dev->net, |
101 | "Failed to read register index 0x%08x", index); | 101 | "Failed to read reg index 0x%08x: %d", index, ret); |
102 | 102 | ||
103 | le32_to_cpus(buf); | 103 | le32_to_cpus(buf); |
104 | *data = *buf; | 104 | *data = *buf; |
@@ -128,7 +128,7 @@ static int __must_check smsc75xx_write_reg(struct usbnet *dev, u32 index, | |||
128 | 128 | ||
129 | if (unlikely(ret < 0)) | 129 | if (unlikely(ret < 0)) |
130 | netdev_warn(dev->net, | 130 | netdev_warn(dev->net, |
131 | "Failed to write register index 0x%08x", index); | 131 | "Failed to write reg index 0x%08x: %d", index, ret); |
132 | 132 | ||
133 | kfree(buf); | 133 | kfree(buf); |
134 | 134 | ||
@@ -171,7 +171,7 @@ static int smsc75xx_mdio_read(struct net_device *netdev, int phy_id, int idx) | |||
171 | idx &= dev->mii.reg_num_mask; | 171 | idx &= dev->mii.reg_num_mask; |
172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) | 172 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) | 173 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
174 | | MII_ACCESS_READ; | 174 | | MII_ACCESS_READ | MII_ACCESS_BUSY; |
175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); | 175 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); | 176 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
177 | 177 | ||
@@ -210,7 +210,7 @@ static void smsc75xx_mdio_write(struct net_device *netdev, int phy_id, int idx, | |||
210 | idx &= dev->mii.reg_num_mask; | 210 | idx &= dev->mii.reg_num_mask; |
211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) | 211 | addr = ((phy_id << MII_ACCESS_PHY_ADDR_SHIFT) & MII_ACCESS_PHY_ADDR) |
212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) | 212 | | ((idx << MII_ACCESS_REG_ADDR_SHIFT) & MII_ACCESS_REG_ADDR) |
213 | | MII_ACCESS_WRITE; | 213 | | MII_ACCESS_WRITE | MII_ACCESS_BUSY; |
214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); | 214 | ret = smsc75xx_write_reg(dev, MII_ACCESS, addr); |
215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); | 215 | check_warn_goto_done(ret, "Error writing MII_ACCESS"); |
216 | 216 | ||
@@ -508,9 +508,10 @@ static int smsc75xx_link_reset(struct usbnet *dev) | |||
508 | u16 lcladv, rmtadv; | 508 | u16 lcladv, rmtadv; |
509 | int ret; | 509 | int ret; |
510 | 510 | ||
511 | /* clear interrupt status */ | 511 | /* read and write to clear phy interrupt status */ |
512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); | 512 | ret = smsc75xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC); |
513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); | 513 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
514 | smsc75xx_mdio_write(dev->net, mii->phy_id, PHY_INT_SRC, 0xffff); | ||
514 | 515 | ||
515 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); | 516 | ret = smsc75xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL); |
516 | check_warn_return(ret, "Error writing INT_STS"); | 517 | check_warn_return(ret, "Error writing INT_STS"); |
@@ -643,7 +644,7 @@ static int smsc75xx_set_mac_address(struct usbnet *dev) | |||
643 | 644 | ||
644 | static int smsc75xx_phy_initialize(struct usbnet *dev) | 645 | static int smsc75xx_phy_initialize(struct usbnet *dev) |
645 | { | 646 | { |
646 | int bmcr, timeout = 0; | 647 | int bmcr, ret, timeout = 0; |
647 | 648 | ||
648 | /* Initialize MII structure */ | 649 | /* Initialize MII structure */ |
649 | dev->mii.dev = dev->net; | 650 | dev->mii.dev = dev->net; |
@@ -651,6 +652,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
651 | dev->mii.mdio_write = smsc75xx_mdio_write; | 652 | dev->mii.mdio_write = smsc75xx_mdio_write; |
652 | dev->mii.phy_id_mask = 0x1f; | 653 | dev->mii.phy_id_mask = 0x1f; |
653 | dev->mii.reg_num_mask = 0x1f; | 654 | dev->mii.reg_num_mask = 0x1f; |
655 | dev->mii.supports_gmii = 1; | ||
654 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; | 656 | dev->mii.phy_id = SMSC75XX_INTERNAL_PHY_ID; |
655 | 657 | ||
656 | /* reset phy and wait for reset to complete */ | 658 | /* reset phy and wait for reset to complete */ |
@@ -661,7 +663,7 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
661 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); | 663 | bmcr = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); |
662 | check_warn_return(bmcr, "Error reading MII_BMCR"); | 664 | check_warn_return(bmcr, "Error reading MII_BMCR"); |
663 | timeout++; | 665 | timeout++; |
664 | } while ((bmcr & MII_BMCR) && (timeout < 100)); | 666 | } while ((bmcr & BMCR_RESET) && (timeout < 100)); |
665 | 667 | ||
666 | if (timeout >= 100) { | 668 | if (timeout >= 100) { |
667 | netdev_warn(dev->net, "timeout on PHY Reset"); | 669 | netdev_warn(dev->net, "timeout on PHY Reset"); |
@@ -671,10 +673,13 @@ static int smsc75xx_phy_initialize(struct usbnet *dev) | |||
671 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, | 673 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, |
672 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | | 674 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | |
673 | ADVERTISE_PAUSE_ASYM); | 675 | ADVERTISE_PAUSE_ASYM); |
676 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000, | ||
677 | ADVERTISE_1000FULL); | ||
674 | 678 | ||
675 | /* read to clear */ | 679 | /* read and write to clear phy interrupt status */ |
676 | smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); | 680 | ret = smsc75xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC); |
677 | check_warn_return(bmcr, "Error reading PHY_INT_SRC"); | 681 | check_warn_return(ret, "Error reading PHY_INT_SRC"); |
682 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_SRC, 0xffff); | ||
678 | 683 | ||
679 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, | 684 | smsc75xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK, |
680 | PHY_INT_MASK_DEFAULT); | 685 | PHY_INT_MASK_DEFAULT); |
@@ -946,6 +951,14 @@ static int smsc75xx_reset(struct usbnet *dev) | |||
946 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); | 951 | ret = smsc75xx_write_reg(dev, INT_EP_CTL, buf); |
947 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); | 952 | check_warn_return(ret, "Failed to write INT_EP_CTL: %d", ret); |
948 | 953 | ||
954 | /* allow mac to detect speed and duplex from phy */ | ||
955 | ret = smsc75xx_read_reg(dev, MAC_CR, &buf); | ||
956 | check_warn_return(ret, "Failed to read MAC_CR: %d", ret); | ||
957 | |||
958 | buf |= (MAC_CR_ADD | MAC_CR_ASD); | ||
959 | ret = smsc75xx_write_reg(dev, MAC_CR, buf); | ||
960 | check_warn_return(ret, "Failed to write MAC_CR: %d", ret); | ||
961 | |||
949 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); | 962 | ret = smsc75xx_read_reg(dev, MAC_TX, &buf); |
950 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); | 963 | check_warn_return(ret, "Failed to read MAC_TX: %d", ret); |
951 | 964 | ||
@@ -1051,6 +1064,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1051 | dev->net->ethtool_ops = &smsc75xx_ethtool_ops; | 1064 | dev->net->ethtool_ops = &smsc75xx_ethtool_ops; |
1052 | dev->net->flags |= IFF_MULTICAST; | 1065 | dev->net->flags |= IFF_MULTICAST; |
1053 | dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD; | 1066 | dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD; |
1067 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
1054 | return 0; | 1068 | return 0; |
1055 | } | 1069 | } |
1056 | 1070 | ||
@@ -1211,7 +1225,7 @@ static const struct driver_info smsc75xx_info = { | |||
1211 | .rx_fixup = smsc75xx_rx_fixup, | 1225 | .rx_fixup = smsc75xx_rx_fixup, |
1212 | .tx_fixup = smsc75xx_tx_fixup, | 1226 | .tx_fixup = smsc75xx_tx_fixup, |
1213 | .status = smsc75xx_status, | 1227 | .status = smsc75xx_status, |
1214 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1228 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
1215 | }; | 1229 | }; |
1216 | 1230 | ||
1217 | static const struct usb_device_id products[] = { | 1231 | static const struct usb_device_id products[] = { |
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 5f19f84d3494..94ae66999f59 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -1017,6 +1017,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; | 1017 | dev->net->ethtool_ops = &smsc95xx_ethtool_ops; |
1018 | dev->net->flags |= IFF_MULTICAST; | 1018 | dev->net->flags |= IFF_MULTICAST; |
1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; | 1019 | dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM; |
1020 | dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len; | ||
1020 | return 0; | 1021 | return 0; |
1021 | } | 1022 | } |
1022 | 1023 | ||
@@ -1191,7 +1192,7 @@ static const struct driver_info smsc95xx_info = { | |||
1191 | .rx_fixup = smsc95xx_rx_fixup, | 1192 | .rx_fixup = smsc95xx_rx_fixup, |
1192 | .tx_fixup = smsc95xx_tx_fixup, | 1193 | .tx_fixup = smsc95xx_tx_fixup, |
1193 | .status = smsc95xx_status, | 1194 | .status = smsc95xx_status, |
1194 | .flags = FLAG_ETHER | FLAG_SEND_ZLP, | 1195 | .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR, |
1195 | }; | 1196 | }; |
1196 | 1197 | ||
1197 | static const struct usb_device_id products[] = { | 1198 | static const struct usb_device_id products[] = { |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index b7b3f5b0d406..2d927fb4adf4 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -210,6 +210,7 @@ static int init_status (struct usbnet *dev, struct usb_interface *intf) | |||
210 | } else { | 210 | } else { |
211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, | 211 | usb_fill_int_urb(dev->interrupt, dev->udev, pipe, |
212 | buf, maxp, intr_complete, dev, period); | 212 | buf, maxp, intr_complete, dev, period); |
213 | dev->interrupt->transfer_flags |= URB_FREE_BUFFER; | ||
213 | dev_dbg(&intf->dev, | 214 | dev_dbg(&intf->dev, |
214 | "status ep%din, %d bytes period %d\n", | 215 | "status ep%din, %d bytes period %d\n", |
215 | usb_pipeendpoint(pipe), maxp, period); | 216 | usb_pipeendpoint(pipe), maxp, period); |
@@ -1443,7 +1444,7 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1443 | 1444 | ||
1444 | status = register_netdev (net); | 1445 | status = register_netdev (net); |
1445 | if (status) | 1446 | if (status) |
1446 | goto out3; | 1447 | goto out4; |
1447 | netif_info(dev, probe, dev->net, | 1448 | netif_info(dev, probe, dev->net, |
1448 | "register '%s' at usb-%s-%s, %s, %pM\n", | 1449 | "register '%s' at usb-%s-%s, %s, %pM\n", |
1449 | udev->dev.driver->name, | 1450 | udev->dev.driver->name, |
@@ -1461,6 +1462,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) | |||
1461 | 1462 | ||
1462 | return 0; | 1463 | return 0; |
1463 | 1464 | ||
1465 | out4: | ||
1466 | usb_free_urb(dev->interrupt); | ||
1464 | out3: | 1467 | out3: |
1465 | if (info->unbind) | 1468 | if (info->unbind) |
1466 | info->unbind (dev, udev); | 1469 | info->unbind (dev, udev); |
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c index c3197ce0e2ad..34db195fb8b0 100644 --- a/drivers/net/usb/zaurus.c +++ b/drivers/net/usb/zaurus.c | |||
@@ -337,6 +337,11 @@ static const struct usb_device_id products [] = { | |||
337 | .driver_info = ZAURUS_PXA_INFO, | 337 | .driver_info = ZAURUS_PXA_INFO, |
338 | }, | 338 | }, |
339 | { | 339 | { |
340 | /* Motorola Rokr E6 */ | ||
341 | USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6027, USB_CLASS_COMM, | ||
342 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | ||
343 | .driver_info = (unsigned long) &bogus_mdlm_info, | ||
344 | }, { | ||
340 | /* Motorola MOTOMAGX phones */ | 345 | /* Motorola MOTOMAGX phones */ |
341 | USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM, | 346 | USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM, |
342 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), | 347 | USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 019da012669f..af8acc85f4bb 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -625,16 +625,16 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
625 | 625 | ||
626 | /* This can happen with OOM and indirect buffers. */ | 626 | /* This can happen with OOM and indirect buffers. */ |
627 | if (unlikely(capacity < 0)) { | 627 | if (unlikely(capacity < 0)) { |
628 | if (net_ratelimit()) { | 628 | if (likely(capacity == -ENOMEM)) { |
629 | if (likely(capacity == -ENOMEM)) { | 629 | if (net_ratelimit()) |
630 | dev_warn(&dev->dev, | 630 | dev_warn(&dev->dev, |
631 | "TX queue failure: out of memory\n"); | 631 | "TX queue failure: out of memory\n"); |
632 | } else { | 632 | } else { |
633 | dev->stats.tx_fifo_errors++; | 633 | dev->stats.tx_fifo_errors++; |
634 | if (net_ratelimit()) | ||
634 | dev_warn(&dev->dev, | 635 | dev_warn(&dev->dev, |
635 | "Unexpected TX queue failure: %d\n", | 636 | "Unexpected TX queue failure: %d\n", |
636 | capacity); | 637 | capacity); |
637 | } | ||
638 | } | 638 | } |
639 | dev->stats.tx_dropped++; | 639 | dev->stats.tx_dropped++; |
640 | kfree_skb(skb); | 640 | kfree_skb(skb); |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index ebb9f24eefb5..1a623183cbe5 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -2483,6 +2483,7 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2483 | pr_err("Control memory remap failed\n"); | 2483 | pr_err("Control memory remap failed\n"); |
2484 | pci_release_regions(pdev); | 2484 | pci_release_regions(pdev); |
2485 | pci_disable_device(pdev); | 2485 | pci_disable_device(pdev); |
2486 | iounmap(card->mem); | ||
2486 | kfree(card); | 2487 | kfree(card); |
2487 | return -ENODEV; | 2488 | return -ENODEV; |
2488 | } | 2489 | } |
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c index 129ba36bd04d..4b66ab1d0e5c 100644 --- a/drivers/net/wimax/i2400m/debugfs.c +++ b/drivers/net/wimax/i2400m/debugfs.c | |||
@@ -53,17 +53,6 @@ struct dentry *debugfs_create_netdev_queue_stopped( | |||
53 | &fops_netdev_queue_stopped); | 53 | &fops_netdev_queue_stopped); |
54 | } | 54 | } |
55 | 55 | ||
56 | |||
57 | /* | ||
58 | * inode->i_private has the @data argument to debugfs_create_file() | ||
59 | */ | ||
60 | static | ||
61 | int i2400m_stats_open(struct inode *inode, struct file *filp) | ||
62 | { | ||
63 | filp->private_data = inode->i_private; | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | /* | 56 | /* |
68 | * We don't allow partial reads of this file, as then the reader would | 57 | * We don't allow partial reads of this file, as then the reader would |
69 | * get weirdly confused data as it is updated. | 58 | * get weirdly confused data as it is updated. |
@@ -117,7 +106,7 @@ ssize_t i2400m_rx_stats_write(struct file *filp, const char __user *buffer, | |||
117 | static | 106 | static |
118 | const struct file_operations i2400m_rx_stats_fops = { | 107 | const struct file_operations i2400m_rx_stats_fops = { |
119 | .owner = THIS_MODULE, | 108 | .owner = THIS_MODULE, |
120 | .open = i2400m_stats_open, | 109 | .open = simple_open, |
121 | .read = i2400m_rx_stats_read, | 110 | .read = i2400m_rx_stats_read, |
122 | .write = i2400m_rx_stats_write, | 111 | .write = i2400m_rx_stats_write, |
123 | .llseek = default_llseek, | 112 | .llseek = default_llseek, |
@@ -170,7 +159,7 @@ ssize_t i2400m_tx_stats_write(struct file *filp, const char __user *buffer, | |||
170 | static | 159 | static |
171 | const struct file_operations i2400m_tx_stats_fops = { | 160 | const struct file_operations i2400m_tx_stats_fops = { |
172 | .owner = THIS_MODULE, | 161 | .owner = THIS_MODULE, |
173 | .open = i2400m_stats_open, | 162 | .open = simple_open, |
174 | .read = i2400m_tx_stats_read, | 163 | .read = i2400m_tx_stats_read, |
175 | .write = i2400m_tx_stats_write, | 164 | .write = i2400m_tx_stats_write, |
176 | .llseek = default_llseek, | 165 | .llseek = default_llseek, |
diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c index 63e4b709efa9..1d76ae855f07 100644 --- a/drivers/net/wimax/i2400m/netdev.c +++ b/drivers/net/wimax/i2400m/netdev.c | |||
@@ -597,7 +597,8 @@ static void i2400m_get_drvinfo(struct net_device *net_dev, | |||
597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); | 597 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); |
598 | 598 | ||
599 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | 599 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); |
600 | strncpy(info->fw_version, i2400m->fw_name, sizeof(info->fw_version) - 1); | 600 | strncpy(info->fw_version, |
601 | i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | ||
601 | if (net_dev->dev.parent) | 602 | if (net_dev->dev.parent) |
602 | strncpy(info->bus_info, dev_name(net_dev->dev.parent), | 603 | strncpy(info->bus_info, dev_name(net_dev->dev.parent), |
603 | sizeof(info->bus_info) - 1); | 604 | sizeof(info->bus_info) - 1); |
diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c index 2c1b8b687646..29b1e033a10b 100644 --- a/drivers/net/wimax/i2400m/usb.c +++ b/drivers/net/wimax/i2400m/usb.c | |||
@@ -339,6 +339,23 @@ int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt) | |||
339 | return result; | 339 | return result; |
340 | } | 340 | } |
341 | 341 | ||
342 | static void i2400mu_get_drvinfo(struct net_device *net_dev, | ||
343 | struct ethtool_drvinfo *info) | ||
344 | { | ||
345 | struct i2400m *i2400m = net_dev_to_i2400m(net_dev); | ||
346 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); | ||
347 | struct usb_device *udev = i2400mu->usb_dev; | ||
348 | |||
349 | strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1); | ||
350 | strncpy(info->fw_version, | ||
351 | i2400m->fw_name ? : "", sizeof(info->fw_version) - 1); | ||
352 | usb_make_path(udev, info->bus_info, sizeof(info->bus_info)); | ||
353 | } | ||
354 | |||
355 | static const struct ethtool_ops i2400mu_ethtool_ops = { | ||
356 | .get_drvinfo = i2400mu_get_drvinfo, | ||
357 | .get_link = ethtool_op_get_link, | ||
358 | }; | ||
342 | 359 | ||
343 | static | 360 | static |
344 | void i2400mu_netdev_setup(struct net_device *net_dev) | 361 | void i2400mu_netdev_setup(struct net_device *net_dev) |
@@ -347,6 +364,7 @@ void i2400mu_netdev_setup(struct net_device *net_dev) | |||
347 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); | 364 | struct i2400mu *i2400mu = container_of(i2400m, struct i2400mu, i2400m); |
348 | i2400mu_init(i2400mu); | 365 | i2400mu_init(i2400mu); |
349 | i2400m_netdev_setup(net_dev); | 366 | i2400m_netdev_setup(net_dev); |
367 | net_dev->ethtool_ops = &i2400mu_ethtool_ops; | ||
350 | } | 368 | } |
351 | 369 | ||
352 | 370 | ||
diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wireless/ath/ath5k/ahb.c index 8faa129da5a0..aec33cc207fd 100644 --- a/drivers/net/wireless/ath/ath5k/ahb.c +++ b/drivers/net/wireless/ath/ath5k/ahb.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/nl80211.h> | 19 | #include <linux/nl80211.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/etherdevice.h> | 21 | #include <linux/etherdevice.h> |
22 | #include <linux/export.h> | ||
22 | #include <ar231x_platform.h> | 23 | #include <ar231x_platform.h> |
23 | #include "ath5k.h" | 24 | #include "ath5k.h" |
24 | #include "debug.h" | 25 | #include "debug.h" |
@@ -119,7 +120,7 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
119 | if (res == NULL) { | 120 | if (res == NULL) { |
120 | dev_err(&pdev->dev, "no IRQ resource found\n"); | 121 | dev_err(&pdev->dev, "no IRQ resource found\n"); |
121 | ret = -ENXIO; | 122 | ret = -ENXIO; |
122 | goto err_out; | 123 | goto err_iounmap; |
123 | } | 124 | } |
124 | 125 | ||
125 | irq = res->start; | 126 | irq = res->start; |
@@ -128,7 +129,7 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
128 | if (hw == NULL) { | 129 | if (hw == NULL) { |
129 | dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); | 130 | dev_err(&pdev->dev, "no memory for ieee80211_hw\n"); |
130 | ret = -ENOMEM; | 131 | ret = -ENOMEM; |
131 | goto err_out; | 132 | goto err_iounmap; |
132 | } | 133 | } |
133 | 134 | ||
134 | ah = hw->priv; | 135 | ah = hw->priv; |
@@ -185,6 +186,8 @@ static int ath_ahb_probe(struct platform_device *pdev) | |||
185 | err_free_hw: | 186 | err_free_hw: |
186 | ieee80211_free_hw(hw); | 187 | ieee80211_free_hw(hw); |
187 | platform_set_drvdata(pdev, NULL); | 188 | platform_set_drvdata(pdev, NULL); |
189 | err_iounmap: | ||
190 | iounmap(mem); | ||
188 | err_out: | 191 | err_out: |
189 | return ret; | 192 | return ret; |
190 | } | 193 | } |
@@ -217,6 +220,7 @@ static int ath_ahb_remove(struct platform_device *pdev) | |||
217 | } | 220 | } |
218 | 221 | ||
219 | ath5k_deinit_ah(ah); | 222 | ath5k_deinit_ah(ah); |
223 | iounmap(ah->iobase); | ||
220 | platform_set_drvdata(pdev, NULL); | 224 | platform_set_drvdata(pdev, NULL); |
221 | ieee80211_free_hw(hw); | 225 | ieee80211_free_hw(hw); |
222 | 226 | ||
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index 8c5ce8b0c734..e5e8f45d86ac 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c | |||
@@ -71,13 +71,6 @@ static unsigned int ath5k_debug; | |||
71 | module_param_named(debug, ath5k_debug, uint, 0); | 71 | module_param_named(debug, ath5k_debug, uint, 0); |
72 | 72 | ||
73 | 73 | ||
74 | static int ath5k_debugfs_open(struct inode *inode, struct file *file) | ||
75 | { | ||
76 | file->private_data = inode->i_private; | ||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | |||
81 | /* debugfs: registers */ | 74 | /* debugfs: registers */ |
82 | 75 | ||
83 | struct reg { | 76 | struct reg { |
@@ -265,7 +258,7 @@ static ssize_t write_file_beacon(struct file *file, | |||
265 | static const struct file_operations fops_beacon = { | 258 | static const struct file_operations fops_beacon = { |
266 | .read = read_file_beacon, | 259 | .read = read_file_beacon, |
267 | .write = write_file_beacon, | 260 | .write = write_file_beacon, |
268 | .open = ath5k_debugfs_open, | 261 | .open = simple_open, |
269 | .owner = THIS_MODULE, | 262 | .owner = THIS_MODULE, |
270 | .llseek = default_llseek, | 263 | .llseek = default_llseek, |
271 | }; | 264 | }; |
@@ -285,7 +278,7 @@ static ssize_t write_file_reset(struct file *file, | |||
285 | 278 | ||
286 | static const struct file_operations fops_reset = { | 279 | static const struct file_operations fops_reset = { |
287 | .write = write_file_reset, | 280 | .write = write_file_reset, |
288 | .open = ath5k_debugfs_open, | 281 | .open = simple_open, |
289 | .owner = THIS_MODULE, | 282 | .owner = THIS_MODULE, |
290 | .llseek = noop_llseek, | 283 | .llseek = noop_llseek, |
291 | }; | 284 | }; |
@@ -365,7 +358,7 @@ static ssize_t write_file_debug(struct file *file, | |||
365 | static const struct file_operations fops_debug = { | 358 | static const struct file_operations fops_debug = { |
366 | .read = read_file_debug, | 359 | .read = read_file_debug, |
367 | .write = write_file_debug, | 360 | .write = write_file_debug, |
368 | .open = ath5k_debugfs_open, | 361 | .open = simple_open, |
369 | .owner = THIS_MODULE, | 362 | .owner = THIS_MODULE, |
370 | .llseek = default_llseek, | 363 | .llseek = default_llseek, |
371 | }; | 364 | }; |
@@ -477,7 +470,7 @@ static ssize_t write_file_antenna(struct file *file, | |||
477 | static const struct file_operations fops_antenna = { | 470 | static const struct file_operations fops_antenna = { |
478 | .read = read_file_antenna, | 471 | .read = read_file_antenna, |
479 | .write = write_file_antenna, | 472 | .write = write_file_antenna, |
480 | .open = ath5k_debugfs_open, | 473 | .open = simple_open, |
481 | .owner = THIS_MODULE, | 474 | .owner = THIS_MODULE, |
482 | .llseek = default_llseek, | 475 | .llseek = default_llseek, |
483 | }; | 476 | }; |
@@ -532,7 +525,7 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf, | |||
532 | 525 | ||
533 | static const struct file_operations fops_misc = { | 526 | static const struct file_operations fops_misc = { |
534 | .read = read_file_misc, | 527 | .read = read_file_misc, |
535 | .open = ath5k_debugfs_open, | 528 | .open = simple_open, |
536 | .owner = THIS_MODULE, | 529 | .owner = THIS_MODULE, |
537 | }; | 530 | }; |
538 | 531 | ||
@@ -647,7 +640,7 @@ static ssize_t write_file_frameerrors(struct file *file, | |||
647 | static const struct file_operations fops_frameerrors = { | 640 | static const struct file_operations fops_frameerrors = { |
648 | .read = read_file_frameerrors, | 641 | .read = read_file_frameerrors, |
649 | .write = write_file_frameerrors, | 642 | .write = write_file_frameerrors, |
650 | .open = ath5k_debugfs_open, | 643 | .open = simple_open, |
651 | .owner = THIS_MODULE, | 644 | .owner = THIS_MODULE, |
652 | .llseek = default_llseek, | 645 | .llseek = default_llseek, |
653 | }; | 646 | }; |
@@ -810,7 +803,7 @@ static ssize_t write_file_ani(struct file *file, | |||
810 | static const struct file_operations fops_ani = { | 803 | static const struct file_operations fops_ani = { |
811 | .read = read_file_ani, | 804 | .read = read_file_ani, |
812 | .write = write_file_ani, | 805 | .write = write_file_ani, |
813 | .open = ath5k_debugfs_open, | 806 | .open = simple_open, |
814 | .owner = THIS_MODULE, | 807 | .owner = THIS_MODULE, |
815 | .llseek = default_llseek, | 808 | .llseek = default_llseek, |
816 | }; | 809 | }; |
@@ -881,7 +874,7 @@ static ssize_t write_file_queue(struct file *file, | |||
881 | static const struct file_operations fops_queue = { | 874 | static const struct file_operations fops_queue = { |
882 | .read = read_file_queue, | 875 | .read = read_file_queue, |
883 | .write = write_file_queue, | 876 | .write = write_file_queue, |
884 | .open = ath5k_debugfs_open, | 877 | .open = simple_open, |
885 | .owner = THIS_MODULE, | 878 | .owner = THIS_MODULE, |
886 | .llseek = default_llseek, | 879 | .llseek = default_llseek, |
887 | }; | 880 | }; |
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index 552adb3f80d0..d01403a263ff 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c | |||
@@ -217,12 +217,6 @@ void dump_cred_dist_stats(struct htc_target *target) | |||
217 | target->credit_info->cur_free_credits); | 217 | target->credit_info->cur_free_credits); |
218 | } | 218 | } |
219 | 219 | ||
220 | static int ath6kl_debugfs_open(struct inode *inode, struct file *file) | ||
221 | { | ||
222 | file->private_data = inode->i_private; | ||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) | 220 | void ath6kl_debug_war(struct ath6kl *ar, enum ath6kl_war war) |
227 | { | 221 | { |
228 | switch (war) { | 222 | switch (war) { |
@@ -263,7 +257,7 @@ static ssize_t read_file_war_stats(struct file *file, char __user *user_buf, | |||
263 | 257 | ||
264 | static const struct file_operations fops_war_stats = { | 258 | static const struct file_operations fops_war_stats = { |
265 | .read = read_file_war_stats, | 259 | .read = read_file_war_stats, |
266 | .open = ath6kl_debugfs_open, | 260 | .open = simple_open, |
267 | .owner = THIS_MODULE, | 261 | .owner = THIS_MODULE, |
268 | .llseek = default_llseek, | 262 | .llseek = default_llseek, |
269 | }; | 263 | }; |
@@ -488,7 +482,7 @@ static ssize_t ath6kl_fwlog_mask_write(struct file *file, | |||
488 | } | 482 | } |
489 | 483 | ||
490 | static const struct file_operations fops_fwlog_mask = { | 484 | static const struct file_operations fops_fwlog_mask = { |
491 | .open = ath6kl_debugfs_open, | 485 | .open = simple_open, |
492 | .read = ath6kl_fwlog_mask_read, | 486 | .read = ath6kl_fwlog_mask_read, |
493 | .write = ath6kl_fwlog_mask_write, | 487 | .write = ath6kl_fwlog_mask_write, |
494 | .owner = THIS_MODULE, | 488 | .owner = THIS_MODULE, |
@@ -634,7 +628,7 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, | |||
634 | 628 | ||
635 | static const struct file_operations fops_tgt_stats = { | 629 | static const struct file_operations fops_tgt_stats = { |
636 | .read = read_file_tgt_stats, | 630 | .read = read_file_tgt_stats, |
637 | .open = ath6kl_debugfs_open, | 631 | .open = simple_open, |
638 | .owner = THIS_MODULE, | 632 | .owner = THIS_MODULE, |
639 | .llseek = default_llseek, | 633 | .llseek = default_llseek, |
640 | }; | 634 | }; |
@@ -699,7 +693,7 @@ static ssize_t read_file_credit_dist_stats(struct file *file, | |||
699 | 693 | ||
700 | static const struct file_operations fops_credit_dist_stats = { | 694 | static const struct file_operations fops_credit_dist_stats = { |
701 | .read = read_file_credit_dist_stats, | 695 | .read = read_file_credit_dist_stats, |
702 | .open = ath6kl_debugfs_open, | 696 | .open = simple_open, |
703 | .owner = THIS_MODULE, | 697 | .owner = THIS_MODULE, |
704 | .llseek = default_llseek, | 698 | .llseek = default_llseek, |
705 | }; | 699 | }; |
@@ -802,7 +796,7 @@ static ssize_t ath6kl_endpoint_stats_write(struct file *file, | |||
802 | } | 796 | } |
803 | 797 | ||
804 | static const struct file_operations fops_endpoint_stats = { | 798 | static const struct file_operations fops_endpoint_stats = { |
805 | .open = ath6kl_debugfs_open, | 799 | .open = simple_open, |
806 | .read = ath6kl_endpoint_stats_read, | 800 | .read = ath6kl_endpoint_stats_read, |
807 | .write = ath6kl_endpoint_stats_write, | 801 | .write = ath6kl_endpoint_stats_write, |
808 | .owner = THIS_MODULE, | 802 | .owner = THIS_MODULE, |
@@ -875,7 +869,7 @@ static ssize_t ath6kl_regread_write(struct file *file, | |||
875 | static const struct file_operations fops_diag_reg_read = { | 869 | static const struct file_operations fops_diag_reg_read = { |
876 | .read = ath6kl_regread_read, | 870 | .read = ath6kl_regread_read, |
877 | .write = ath6kl_regread_write, | 871 | .write = ath6kl_regread_write, |
878 | .open = ath6kl_debugfs_open, | 872 | .open = simple_open, |
879 | .owner = THIS_MODULE, | 873 | .owner = THIS_MODULE, |
880 | .llseek = default_llseek, | 874 | .llseek = default_llseek, |
881 | }; | 875 | }; |
@@ -999,7 +993,7 @@ static ssize_t ath6kl_lrssi_roam_read(struct file *file, | |||
999 | static const struct file_operations fops_lrssi_roam_threshold = { | 993 | static const struct file_operations fops_lrssi_roam_threshold = { |
1000 | .read = ath6kl_lrssi_roam_read, | 994 | .read = ath6kl_lrssi_roam_read, |
1001 | .write = ath6kl_lrssi_roam_write, | 995 | .write = ath6kl_lrssi_roam_write, |
1002 | .open = ath6kl_debugfs_open, | 996 | .open = simple_open, |
1003 | .owner = THIS_MODULE, | 997 | .owner = THIS_MODULE, |
1004 | .llseek = default_llseek, | 998 | .llseek = default_llseek, |
1005 | }; | 999 | }; |
@@ -1061,7 +1055,7 @@ static ssize_t ath6kl_regwrite_write(struct file *file, | |||
1061 | static const struct file_operations fops_diag_reg_write = { | 1055 | static const struct file_operations fops_diag_reg_write = { |
1062 | .read = ath6kl_regwrite_read, | 1056 | .read = ath6kl_regwrite_read, |
1063 | .write = ath6kl_regwrite_write, | 1057 | .write = ath6kl_regwrite_write, |
1064 | .open = ath6kl_debugfs_open, | 1058 | .open = simple_open, |
1065 | .owner = THIS_MODULE, | 1059 | .owner = THIS_MODULE, |
1066 | .llseek = default_llseek, | 1060 | .llseek = default_llseek, |
1067 | }; | 1061 | }; |
@@ -1166,7 +1160,7 @@ static ssize_t ath6kl_roam_table_read(struct file *file, char __user *user_buf, | |||
1166 | 1160 | ||
1167 | static const struct file_operations fops_roam_table = { | 1161 | static const struct file_operations fops_roam_table = { |
1168 | .read = ath6kl_roam_table_read, | 1162 | .read = ath6kl_roam_table_read, |
1169 | .open = ath6kl_debugfs_open, | 1163 | .open = simple_open, |
1170 | .owner = THIS_MODULE, | 1164 | .owner = THIS_MODULE, |
1171 | .llseek = default_llseek, | 1165 | .llseek = default_llseek, |
1172 | }; | 1166 | }; |
@@ -1204,7 +1198,7 @@ static ssize_t ath6kl_force_roam_write(struct file *file, | |||
1204 | 1198 | ||
1205 | static const struct file_operations fops_force_roam = { | 1199 | static const struct file_operations fops_force_roam = { |
1206 | .write = ath6kl_force_roam_write, | 1200 | .write = ath6kl_force_roam_write, |
1207 | .open = ath6kl_debugfs_open, | 1201 | .open = simple_open, |
1208 | .owner = THIS_MODULE, | 1202 | .owner = THIS_MODULE, |
1209 | .llseek = default_llseek, | 1203 | .llseek = default_llseek, |
1210 | }; | 1204 | }; |
@@ -1244,7 +1238,7 @@ static ssize_t ath6kl_roam_mode_write(struct file *file, | |||
1244 | 1238 | ||
1245 | static const struct file_operations fops_roam_mode = { | 1239 | static const struct file_operations fops_roam_mode = { |
1246 | .write = ath6kl_roam_mode_write, | 1240 | .write = ath6kl_roam_mode_write, |
1247 | .open = ath6kl_debugfs_open, | 1241 | .open = simple_open, |
1248 | .owner = THIS_MODULE, | 1242 | .owner = THIS_MODULE, |
1249 | .llseek = default_llseek, | 1243 | .llseek = default_llseek, |
1250 | }; | 1244 | }; |
@@ -1286,7 +1280,7 @@ static ssize_t ath6kl_keepalive_write(struct file *file, | |||
1286 | } | 1280 | } |
1287 | 1281 | ||
1288 | static const struct file_operations fops_keepalive = { | 1282 | static const struct file_operations fops_keepalive = { |
1289 | .open = ath6kl_debugfs_open, | 1283 | .open = simple_open, |
1290 | .read = ath6kl_keepalive_read, | 1284 | .read = ath6kl_keepalive_read, |
1291 | .write = ath6kl_keepalive_write, | 1285 | .write = ath6kl_keepalive_write, |
1292 | .owner = THIS_MODULE, | 1286 | .owner = THIS_MODULE, |
@@ -1331,7 +1325,7 @@ static ssize_t ath6kl_disconnect_timeout_write(struct file *file, | |||
1331 | } | 1325 | } |
1332 | 1326 | ||
1333 | static const struct file_operations fops_disconnect_timeout = { | 1327 | static const struct file_operations fops_disconnect_timeout = { |
1334 | .open = ath6kl_debugfs_open, | 1328 | .open = simple_open, |
1335 | .read = ath6kl_disconnect_timeout_read, | 1329 | .read = ath6kl_disconnect_timeout_read, |
1336 | .write = ath6kl_disconnect_timeout_write, | 1330 | .write = ath6kl_disconnect_timeout_write, |
1337 | .owner = THIS_MODULE, | 1331 | .owner = THIS_MODULE, |
@@ -1512,7 +1506,7 @@ static ssize_t ath6kl_create_qos_write(struct file *file, | |||
1512 | 1506 | ||
1513 | static const struct file_operations fops_create_qos = { | 1507 | static const struct file_operations fops_create_qos = { |
1514 | .write = ath6kl_create_qos_write, | 1508 | .write = ath6kl_create_qos_write, |
1515 | .open = ath6kl_debugfs_open, | 1509 | .open = simple_open, |
1516 | .owner = THIS_MODULE, | 1510 | .owner = THIS_MODULE, |
1517 | .llseek = default_llseek, | 1511 | .llseek = default_llseek, |
1518 | }; | 1512 | }; |
@@ -1560,7 +1554,7 @@ static ssize_t ath6kl_delete_qos_write(struct file *file, | |||
1560 | 1554 | ||
1561 | static const struct file_operations fops_delete_qos = { | 1555 | static const struct file_operations fops_delete_qos = { |
1562 | .write = ath6kl_delete_qos_write, | 1556 | .write = ath6kl_delete_qos_write, |
1563 | .open = ath6kl_debugfs_open, | 1557 | .open = simple_open, |
1564 | .owner = THIS_MODULE, | 1558 | .owner = THIS_MODULE, |
1565 | .llseek = default_llseek, | 1559 | .llseek = default_llseek, |
1566 | }; | 1560 | }; |
@@ -1593,7 +1587,7 @@ static ssize_t ath6kl_bgscan_int_write(struct file *file, | |||
1593 | 1587 | ||
1594 | static const struct file_operations fops_bgscan_int = { | 1588 | static const struct file_operations fops_bgscan_int = { |
1595 | .write = ath6kl_bgscan_int_write, | 1589 | .write = ath6kl_bgscan_int_write, |
1596 | .open = ath6kl_debugfs_open, | 1590 | .open = simple_open, |
1597 | .owner = THIS_MODULE, | 1591 | .owner = THIS_MODULE, |
1598 | .llseek = default_llseek, | 1592 | .llseek = default_llseek, |
1599 | }; | 1593 | }; |
@@ -1651,7 +1645,7 @@ static ssize_t ath6kl_listen_int_read(struct file *file, | |||
1651 | static const struct file_operations fops_listen_int = { | 1645 | static const struct file_operations fops_listen_int = { |
1652 | .read = ath6kl_listen_int_read, | 1646 | .read = ath6kl_listen_int_read, |
1653 | .write = ath6kl_listen_int_write, | 1647 | .write = ath6kl_listen_int_write, |
1654 | .open = ath6kl_debugfs_open, | 1648 | .open = simple_open, |
1655 | .owner = THIS_MODULE, | 1649 | .owner = THIS_MODULE, |
1656 | .llseek = default_llseek, | 1650 | .llseek = default_llseek, |
1657 | }; | 1651 | }; |
@@ -1711,7 +1705,7 @@ static ssize_t ath6kl_power_params_write(struct file *file, | |||
1711 | 1705 | ||
1712 | static const struct file_operations fops_power_params = { | 1706 | static const struct file_operations fops_power_params = { |
1713 | .write = ath6kl_power_params_write, | 1707 | .write = ath6kl_power_params_write, |
1714 | .open = ath6kl_debugfs_open, | 1708 | .open = simple_open, |
1715 | .owner = THIS_MODULE, | 1709 | .owner = THIS_MODULE, |
1716 | .llseek = default_llseek, | 1710 | .llseek = default_llseek, |
1717 | }; | 1711 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c index d7d8e9199140..aba088005b22 100644 --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c | |||
@@ -869,7 +869,7 @@ static int ar5008_hw_process_ini(struct ath_hw *ah, | |||
869 | ar5008_hw_set_channel_regs(ah, chan); | 869 | ar5008_hw_set_channel_regs(ah, chan); |
870 | ar5008_hw_init_chain_masks(ah); | 870 | ar5008_hw_init_chain_masks(ah); |
871 | ath9k_olc_init(ah); | 871 | ath9k_olc_init(ah); |
872 | ath9k_hw_apply_txpower(ah, chan); | 872 | ath9k_hw_apply_txpower(ah, chan, false); |
873 | 873 | ||
874 | /* Write analog registers */ | 874 | /* Write analog registers */ |
875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { | 875 | if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c index 59647a3ceb7f..3d400e8d6535 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c | |||
@@ -54,7 +54,7 @@ void ar9003_paprd_enable(struct ath_hw *ah, bool val) | |||
54 | 54 | ||
55 | if (val) { | 55 | if (val) { |
56 | ah->paprd_table_write_done = true; | 56 | ah->paprd_table_write_done = true; |
57 | ath9k_hw_apply_txpower(ah, chan); | 57 | ath9k_hw_apply_txpower(ah, chan, false); |
58 | } | 58 | } |
59 | 59 | ||
60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, | 60 | REG_RMW_FIELD(ah, AR_PHY_PAPRD_CTRL0_B0, |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c index bc992b237ae5..deb6cfb2959a 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c | |||
@@ -694,7 +694,7 @@ static int ar9003_hw_process_ini(struct ath_hw *ah, | |||
694 | ar9003_hw_override_ini(ah); | 694 | ar9003_hw_override_ini(ah); |
695 | ar9003_hw_set_channel_regs(ah, chan); | 695 | ar9003_hw_set_channel_regs(ah, chan); |
696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); | 696 | ar9003_hw_set_chain_masks(ah, ah->rxchainmask, ah->txchainmask); |
697 | ath9k_hw_apply_txpower(ah, chan); | 697 | ath9k_hw_apply_txpower(ah, chan, false); |
698 | 698 | ||
699 | if (AR_SREV_9462(ah)) { | 699 | if (AR_SREV_9462(ah)) { |
700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, | 700 | if (REG_READ_FIELD(ah, AR_PHY_TX_IQCAL_CONTROL_0, |
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index 2f4b48e6fb03..e5cceb077574 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c | |||
@@ -20,7 +20,6 @@ | |||
20 | 20 | ||
21 | /* Common calibration code */ | 21 | /* Common calibration code */ |
22 | 22 | ||
23 | #define ATH9K_NF_TOO_HIGH -60 | ||
24 | 23 | ||
25 | static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer) | 24 | static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer) |
26 | { | 25 | { |
@@ -346,10 +345,10 @@ static void ath9k_hw_nf_sanitize(struct ath_hw *ah, s16 *nf) | |||
346 | "NF calibrated [%s] [chain %d] is %d\n", | 345 | "NF calibrated [%s] [chain %d] is %d\n", |
347 | (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); | 346 | (i >= 3 ? "ext" : "ctl"), i % 3, nf[i]); |
348 | 347 | ||
349 | if (nf[i] > ATH9K_NF_TOO_HIGH) { | 348 | if (nf[i] > limit->max) { |
350 | ath_dbg(common, CALIBRATE, | 349 | ath_dbg(common, CALIBRATE, |
351 | "NF[%d] (%d) > MAX (%d), correcting to MAX\n", | 350 | "NF[%d] (%d) > MAX (%d), correcting to MAX\n", |
352 | i, nf[i], ATH9K_NF_TOO_HIGH); | 351 | i, nf[i], limit->max); |
353 | nf[i] = limit->max; | 352 | nf[i] = limit->max; |
354 | } else if (nf[i] < limit->min) { | 353 | } else if (nf[i] < limit->min) { |
355 | ath_dbg(common, CALIBRATE, | 354 | ath_dbg(common, CALIBRATE, |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 35d1c8e91d1c..ff47b32ecaf4 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -26,11 +26,6 @@ | |||
26 | #define REG_READ_D(_ah, _reg) \ | 26 | #define REG_READ_D(_ah, _reg) \ |
27 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) | 27 | ath9k_hw_common(_ah)->ops->read((_ah), (_reg)) |
28 | 28 | ||
29 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) | ||
30 | { | ||
31 | file->private_data = inode->i_private; | ||
32 | return 0; | ||
33 | } | ||
34 | 29 | ||
35 | static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, | 30 | static ssize_t ath9k_debugfs_read_buf(struct file *file, char __user *user_buf, |
36 | size_t count, loff_t *ppos) | 31 | size_t count, loff_t *ppos) |
@@ -83,7 +78,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, | |||
83 | static const struct file_operations fops_debug = { | 78 | static const struct file_operations fops_debug = { |
84 | .read = read_file_debug, | 79 | .read = read_file_debug, |
85 | .write = write_file_debug, | 80 | .write = write_file_debug, |
86 | .open = ath9k_debugfs_open, | 81 | .open = simple_open, |
87 | .owner = THIS_MODULE, | 82 | .owner = THIS_MODULE, |
88 | .llseek = default_llseek, | 83 | .llseek = default_llseek, |
89 | }; | 84 | }; |
@@ -129,7 +124,7 @@ static ssize_t write_file_tx_chainmask(struct file *file, const char __user *use | |||
129 | static const struct file_operations fops_tx_chainmask = { | 124 | static const struct file_operations fops_tx_chainmask = { |
130 | .read = read_file_tx_chainmask, | 125 | .read = read_file_tx_chainmask, |
131 | .write = write_file_tx_chainmask, | 126 | .write = write_file_tx_chainmask, |
132 | .open = ath9k_debugfs_open, | 127 | .open = simple_open, |
133 | .owner = THIS_MODULE, | 128 | .owner = THIS_MODULE, |
134 | .llseek = default_llseek, | 129 | .llseek = default_llseek, |
135 | }; | 130 | }; |
@@ -172,7 +167,7 @@ static ssize_t write_file_rx_chainmask(struct file *file, const char __user *use | |||
172 | static const struct file_operations fops_rx_chainmask = { | 167 | static const struct file_operations fops_rx_chainmask = { |
173 | .read = read_file_rx_chainmask, | 168 | .read = read_file_rx_chainmask, |
174 | .write = write_file_rx_chainmask, | 169 | .write = write_file_rx_chainmask, |
175 | .open = ath9k_debugfs_open, | 170 | .open = simple_open, |
176 | .owner = THIS_MODULE, | 171 | .owner = THIS_MODULE, |
177 | .llseek = default_llseek, | 172 | .llseek = default_llseek, |
178 | }; | 173 | }; |
@@ -223,7 +218,7 @@ static ssize_t write_file_disable_ani(struct file *file, | |||
223 | static const struct file_operations fops_disable_ani = { | 218 | static const struct file_operations fops_disable_ani = { |
224 | .read = read_file_disable_ani, | 219 | .read = read_file_disable_ani, |
225 | .write = write_file_disable_ani, | 220 | .write = write_file_disable_ani, |
226 | .open = ath9k_debugfs_open, | 221 | .open = simple_open, |
227 | .owner = THIS_MODULE, | 222 | .owner = THIS_MODULE, |
228 | .llseek = default_llseek, | 223 | .llseek = default_llseek, |
229 | }; | 224 | }; |
@@ -324,7 +319,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
324 | 319 | ||
325 | static const struct file_operations fops_dma = { | 320 | static const struct file_operations fops_dma = { |
326 | .read = read_file_dma, | 321 | .read = read_file_dma, |
327 | .open = ath9k_debugfs_open, | 322 | .open = simple_open, |
328 | .owner = THIS_MODULE, | 323 | .owner = THIS_MODULE, |
329 | .llseek = default_llseek, | 324 | .llseek = default_llseek, |
330 | }; | 325 | }; |
@@ -446,7 +441,7 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, | |||
446 | 441 | ||
447 | static const struct file_operations fops_interrupt = { | 442 | static const struct file_operations fops_interrupt = { |
448 | .read = read_file_interrupt, | 443 | .read = read_file_interrupt, |
449 | .open = ath9k_debugfs_open, | 444 | .open = simple_open, |
450 | .owner = THIS_MODULE, | 445 | .owner = THIS_MODULE, |
451 | .llseek = default_llseek, | 446 | .llseek = default_llseek, |
452 | }; | 447 | }; |
@@ -852,28 +847,28 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf, | |||
852 | 847 | ||
853 | static const struct file_operations fops_xmit = { | 848 | static const struct file_operations fops_xmit = { |
854 | .read = read_file_xmit, | 849 | .read = read_file_xmit, |
855 | .open = ath9k_debugfs_open, | 850 | .open = simple_open, |
856 | .owner = THIS_MODULE, | 851 | .owner = THIS_MODULE, |
857 | .llseek = default_llseek, | 852 | .llseek = default_llseek, |
858 | }; | 853 | }; |
859 | 854 | ||
860 | static const struct file_operations fops_stations = { | 855 | static const struct file_operations fops_stations = { |
861 | .read = read_file_stations, | 856 | .read = read_file_stations, |
862 | .open = ath9k_debugfs_open, | 857 | .open = simple_open, |
863 | .owner = THIS_MODULE, | 858 | .owner = THIS_MODULE, |
864 | .llseek = default_llseek, | 859 | .llseek = default_llseek, |
865 | }; | 860 | }; |
866 | 861 | ||
867 | static const struct file_operations fops_misc = { | 862 | static const struct file_operations fops_misc = { |
868 | .read = read_file_misc, | 863 | .read = read_file_misc, |
869 | .open = ath9k_debugfs_open, | 864 | .open = simple_open, |
870 | .owner = THIS_MODULE, | 865 | .owner = THIS_MODULE, |
871 | .llseek = default_llseek, | 866 | .llseek = default_llseek, |
872 | }; | 867 | }; |
873 | 868 | ||
874 | static const struct file_operations fops_reset = { | 869 | static const struct file_operations fops_reset = { |
875 | .read = read_file_reset, | 870 | .read = read_file_reset, |
876 | .open = ath9k_debugfs_open, | 871 | .open = simple_open, |
877 | .owner = THIS_MODULE, | 872 | .owner = THIS_MODULE, |
878 | .llseek = default_llseek, | 873 | .llseek = default_llseek, |
879 | }; | 874 | }; |
@@ -1016,7 +1011,7 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) | |||
1016 | 1011 | ||
1017 | static const struct file_operations fops_recv = { | 1012 | static const struct file_operations fops_recv = { |
1018 | .read = read_file_recv, | 1013 | .read = read_file_recv, |
1019 | .open = ath9k_debugfs_open, | 1014 | .open = simple_open, |
1020 | .owner = THIS_MODULE, | 1015 | .owner = THIS_MODULE, |
1021 | .llseek = default_llseek, | 1016 | .llseek = default_llseek, |
1022 | }; | 1017 | }; |
@@ -1055,7 +1050,7 @@ static ssize_t write_file_regidx(struct file *file, const char __user *user_buf, | |||
1055 | static const struct file_operations fops_regidx = { | 1050 | static const struct file_operations fops_regidx = { |
1056 | .read = read_file_regidx, | 1051 | .read = read_file_regidx, |
1057 | .write = write_file_regidx, | 1052 | .write = write_file_regidx, |
1058 | .open = ath9k_debugfs_open, | 1053 | .open = simple_open, |
1059 | .owner = THIS_MODULE, | 1054 | .owner = THIS_MODULE, |
1060 | .llseek = default_llseek, | 1055 | .llseek = default_llseek, |
1061 | }; | 1056 | }; |
@@ -1102,7 +1097,7 @@ static ssize_t write_file_regval(struct file *file, const char __user *user_buf, | |||
1102 | static const struct file_operations fops_regval = { | 1097 | static const struct file_operations fops_regval = { |
1103 | .read = read_file_regval, | 1098 | .read = read_file_regval, |
1104 | .write = write_file_regval, | 1099 | .write = write_file_regval, |
1105 | .open = ath9k_debugfs_open, | 1100 | .open = simple_open, |
1106 | .owner = THIS_MODULE, | 1101 | .owner = THIS_MODULE, |
1107 | .llseek = default_llseek, | 1102 | .llseek = default_llseek, |
1108 | }; | 1103 | }; |
@@ -1191,7 +1186,7 @@ static ssize_t read_file_dump_nfcal(struct file *file, char __user *user_buf, | |||
1191 | 1186 | ||
1192 | static const struct file_operations fops_dump_nfcal = { | 1187 | static const struct file_operations fops_dump_nfcal = { |
1193 | .read = read_file_dump_nfcal, | 1188 | .read = read_file_dump_nfcal, |
1194 | .open = ath9k_debugfs_open, | 1189 | .open = simple_open, |
1195 | .owner = THIS_MODULE, | 1190 | .owner = THIS_MODULE, |
1196 | .llseek = default_llseek, | 1191 | .llseek = default_llseek, |
1197 | }; | 1192 | }; |
@@ -1219,7 +1214,7 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | |||
1219 | 1214 | ||
1220 | static const struct file_operations fops_base_eeprom = { | 1215 | static const struct file_operations fops_base_eeprom = { |
1221 | .read = read_file_base_eeprom, | 1216 | .read = read_file_base_eeprom, |
1222 | .open = ath9k_debugfs_open, | 1217 | .open = simple_open, |
1223 | .owner = THIS_MODULE, | 1218 | .owner = THIS_MODULE, |
1224 | .llseek = default_llseek, | 1219 | .llseek = default_llseek, |
1225 | }; | 1220 | }; |
@@ -1247,7 +1242,7 @@ static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | |||
1247 | 1242 | ||
1248 | static const struct file_operations fops_modal_eeprom = { | 1243 | static const struct file_operations fops_modal_eeprom = { |
1249 | .read = read_file_modal_eeprom, | 1244 | .read = read_file_modal_eeprom, |
1250 | .open = ath9k_debugfs_open, | 1245 | .open = simple_open, |
1251 | .owner = THIS_MODULE, | 1246 | .owner = THIS_MODULE, |
1252 | .llseek = default_llseek, | 1247 | .llseek = default_llseek, |
1253 | }; | 1248 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/dfs_debug.c b/drivers/net/wireless/ath/ath9k/dfs_debug.c index 106d031d834a..4364c103ed33 100644 --- a/drivers/net/wireless/ath/ath9k/dfs_debug.c +++ b/drivers/net/wireless/ath/ath9k/dfs_debug.c | |||
@@ -60,16 +60,9 @@ static ssize_t read_file_dfs(struct file *file, char __user *user_buf, | |||
60 | return retval; | 60 | return retval; |
61 | } | 61 | } |
62 | 62 | ||
63 | static int ath9k_dfs_debugfs_open(struct inode *inode, struct file *file) | ||
64 | { | ||
65 | file->private_data = inode->i_private; | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | static const struct file_operations fops_dfs_stats = { | 63 | static const struct file_operations fops_dfs_stats = { |
71 | .read = read_file_dfs, | 64 | .read = read_file_dfs, |
72 | .open = ath9k_dfs_debugfs_open, | 65 | .open = simple_open, |
73 | .owner = THIS_MODULE, | 66 | .owner = THIS_MODULE, |
74 | .llseek = default_llseek, | 67 | .llseek = default_llseek, |
75 | }; | 68 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c index f272236d8053..b34e8b2990b1 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c | |||
@@ -824,6 +824,8 @@ static void ath9k_hw_ar9287_set_txpower(struct ath_hw *ah, | |||
824 | regulatory->max_power_level = ratesArray[i]; | 824 | regulatory->max_power_level = ratesArray[i]; |
825 | } | 825 | } |
826 | 826 | ||
827 | ath9k_hw_update_regulatory_maxpower(ah); | ||
828 | |||
827 | if (test) | 829 | if (test) |
828 | return; | 830 | return; |
829 | 831 | ||
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c index d3ff33c71aa5..3035deb7a0cd 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c | |||
@@ -16,12 +16,6 @@ | |||
16 | 16 | ||
17 | #include "htc.h" | 17 | #include "htc.h" |
18 | 18 | ||
19 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) | ||
20 | { | ||
21 | file->private_data = inode->i_private; | ||
22 | return 0; | ||
23 | } | ||
24 | |||
25 | static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, | 19 | static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, |
26 | size_t count, loff_t *ppos) | 20 | size_t count, loff_t *ppos) |
27 | { | 21 | { |
@@ -75,7 +69,7 @@ static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf, | |||
75 | 69 | ||
76 | static const struct file_operations fops_tgt_int_stats = { | 70 | static const struct file_operations fops_tgt_int_stats = { |
77 | .read = read_file_tgt_int_stats, | 71 | .read = read_file_tgt_int_stats, |
78 | .open = ath9k_debugfs_open, | 72 | .open = simple_open, |
79 | .owner = THIS_MODULE, | 73 | .owner = THIS_MODULE, |
80 | .llseek = default_llseek, | 74 | .llseek = default_llseek, |
81 | }; | 75 | }; |
@@ -145,7 +139,7 @@ static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf, | |||
145 | 139 | ||
146 | static const struct file_operations fops_tgt_tx_stats = { | 140 | static const struct file_operations fops_tgt_tx_stats = { |
147 | .read = read_file_tgt_tx_stats, | 141 | .read = read_file_tgt_tx_stats, |
148 | .open = ath9k_debugfs_open, | 142 | .open = simple_open, |
149 | .owner = THIS_MODULE, | 143 | .owner = THIS_MODULE, |
150 | .llseek = default_llseek, | 144 | .llseek = default_llseek, |
151 | }; | 145 | }; |
@@ -191,7 +185,7 @@ static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf, | |||
191 | 185 | ||
192 | static const struct file_operations fops_tgt_rx_stats = { | 186 | static const struct file_operations fops_tgt_rx_stats = { |
193 | .read = read_file_tgt_rx_stats, | 187 | .read = read_file_tgt_rx_stats, |
194 | .open = ath9k_debugfs_open, | 188 | .open = simple_open, |
195 | .owner = THIS_MODULE, | 189 | .owner = THIS_MODULE, |
196 | .llseek = default_llseek, | 190 | .llseek = default_llseek, |
197 | }; | 191 | }; |
@@ -243,7 +237,7 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf, | |||
243 | 237 | ||
244 | static const struct file_operations fops_xmit = { | 238 | static const struct file_operations fops_xmit = { |
245 | .read = read_file_xmit, | 239 | .read = read_file_xmit, |
246 | .open = ath9k_debugfs_open, | 240 | .open = simple_open, |
247 | .owner = THIS_MODULE, | 241 | .owner = THIS_MODULE, |
248 | .llseek = default_llseek, | 242 | .llseek = default_llseek, |
249 | }; | 243 | }; |
@@ -364,7 +358,7 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
364 | 358 | ||
365 | static const struct file_operations fops_recv = { | 359 | static const struct file_operations fops_recv = { |
366 | .read = read_file_recv, | 360 | .read = read_file_recv, |
367 | .open = ath9k_debugfs_open, | 361 | .open = simple_open, |
368 | .owner = THIS_MODULE, | 362 | .owner = THIS_MODULE, |
369 | .llseek = default_llseek, | 363 | .llseek = default_llseek, |
370 | }; | 364 | }; |
@@ -399,7 +393,7 @@ static ssize_t read_file_slot(struct file *file, char __user *user_buf, | |||
399 | 393 | ||
400 | static const struct file_operations fops_slot = { | 394 | static const struct file_operations fops_slot = { |
401 | .read = read_file_slot, | 395 | .read = read_file_slot, |
402 | .open = ath9k_debugfs_open, | 396 | .open = simple_open, |
403 | .owner = THIS_MODULE, | 397 | .owner = THIS_MODULE, |
404 | .llseek = default_llseek, | 398 | .llseek = default_llseek, |
405 | }; | 399 | }; |
@@ -446,7 +440,7 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf, | |||
446 | 440 | ||
447 | static const struct file_operations fops_queue = { | 441 | static const struct file_operations fops_queue = { |
448 | .read = read_file_queue, | 442 | .read = read_file_queue, |
449 | .open = ath9k_debugfs_open, | 443 | .open = simple_open, |
450 | .owner = THIS_MODULE, | 444 | .owner = THIS_MODULE, |
451 | .llseek = default_llseek, | 445 | .llseek = default_llseek, |
452 | }; | 446 | }; |
@@ -487,7 +481,7 @@ static ssize_t write_file_debug(struct file *file, const char __user *user_buf, | |||
487 | static const struct file_operations fops_debug = { | 481 | static const struct file_operations fops_debug = { |
488 | .read = read_file_debug, | 482 | .read = read_file_debug, |
489 | .write = write_file_debug, | 483 | .write = write_file_debug, |
490 | .open = ath9k_debugfs_open, | 484 | .open = simple_open, |
491 | .owner = THIS_MODULE, | 485 | .owner = THIS_MODULE, |
492 | .llseek = default_llseek, | 486 | .llseek = default_llseek, |
493 | }; | 487 | }; |
@@ -636,7 +630,7 @@ static ssize_t read_file_base_eeprom(struct file *file, char __user *user_buf, | |||
636 | 630 | ||
637 | static const struct file_operations fops_base_eeprom = { | 631 | static const struct file_operations fops_base_eeprom = { |
638 | .read = read_file_base_eeprom, | 632 | .read = read_file_base_eeprom, |
639 | .open = ath9k_debugfs_open, | 633 | .open = simple_open, |
640 | .owner = THIS_MODULE, | 634 | .owner = THIS_MODULE, |
641 | .llseek = default_llseek, | 635 | .llseek = default_llseek, |
642 | }; | 636 | }; |
@@ -917,7 +911,7 @@ static ssize_t read_file_modal_eeprom(struct file *file, char __user *user_buf, | |||
917 | 911 | ||
918 | static const struct file_operations fops_modal_eeprom = { | 912 | static const struct file_operations fops_modal_eeprom = { |
919 | .read = read_file_modal_eeprom, | 913 | .read = read_file_modal_eeprom, |
920 | .open = ath9k_debugfs_open, | 914 | .open = simple_open, |
921 | .owner = THIS_MODULE, | 915 | .owner = THIS_MODULE, |
922 | .llseek = default_llseek, | 916 | .llseek = default_llseek, |
923 | }; | 917 | }; |
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c index 6c69e4e8b1cb..fa84e37bf091 100644 --- a/drivers/net/wireless/ath/ath9k/hw.c +++ b/drivers/net/wireless/ath/ath9k/hw.c | |||
@@ -1454,7 +1454,7 @@ static bool ath9k_hw_channel_change(struct ath_hw *ah, | |||
1454 | return false; | 1454 | return false; |
1455 | } | 1455 | } |
1456 | ath9k_hw_set_clockrate(ah); | 1456 | ath9k_hw_set_clockrate(ah); |
1457 | ath9k_hw_apply_txpower(ah, chan); | 1457 | ath9k_hw_apply_txpower(ah, chan, false); |
1458 | ath9k_hw_rfbus_done(ah); | 1458 | ath9k_hw_rfbus_done(ah); |
1459 | 1459 | ||
1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) | 1460 | if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan)) |
@@ -2652,7 +2652,8 @@ static int get_antenna_gain(struct ath_hw *ah, struct ath9k_channel *chan) | |||
2652 | return ah->eep_ops->get_eeprom(ah, gain_param); | 2652 | return ah->eep_ops->get_eeprom(ah, gain_param); |
2653 | } | 2653 | } |
2654 | 2654 | ||
2655 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | 2655 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
2656 | bool test) | ||
2656 | { | 2657 | { |
2657 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); | 2658 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); |
2658 | struct ieee80211_channel *channel; | 2659 | struct ieee80211_channel *channel; |
@@ -2673,7 +2674,7 @@ void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan) | |||
2673 | 2674 | ||
2674 | ah->eep_ops->set_txpower(ah, chan, | 2675 | ah->eep_ops->set_txpower(ah, chan, |
2675 | ath9k_regd_get_ctl(reg, chan), | 2676 | ath9k_regd_get_ctl(reg, chan), |
2676 | ant_reduction, new_pwr, false); | 2677 | ant_reduction, new_pwr, test); |
2677 | } | 2678 | } |
2678 | 2679 | ||
2679 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | 2680 | void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) |
@@ -2686,7 +2687,7 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test) | |||
2686 | if (test) | 2687 | if (test) |
2687 | channel->max_power = MAX_RATE_POWER / 2; | 2688 | channel->max_power = MAX_RATE_POWER / 2; |
2688 | 2689 | ||
2689 | ath9k_hw_apply_txpower(ah, chan); | 2690 | ath9k_hw_apply_txpower(ah, chan, test); |
2690 | 2691 | ||
2691 | if (test) | 2692 | if (test) |
2692 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); | 2693 | channel->max_power = DIV_ROUND_UP(reg->max_power_level, 2); |
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index aa1680a0c7fd..e88f182ff45c 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h | |||
@@ -985,7 +985,8 @@ void ath9k_hw_name(struct ath_hw *ah, char *hw_name, size_t len); | |||
985 | /* PHY */ | 985 | /* PHY */ |
986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, | 986 | void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah, u32 coef_scaled, |
987 | u32 *coef_mantissa, u32 *coef_exponent); | 987 | u32 *coef_mantissa, u32 *coef_exponent); |
988 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan); | 988 | void ath9k_hw_apply_txpower(struct ath_hw *ah, struct ath9k_channel *chan, |
989 | bool test); | ||
989 | 990 | ||
990 | /* | 991 | /* |
991 | * Code Specific to AR5008, AR9001 or AR9002, | 992 | * Code Specific to AR5008, AR9001 or AR9002, |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 60159f4ee532..cb006458fc4b 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -680,7 +680,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
680 | hw->queues = 4; | 680 | hw->queues = 4; |
681 | hw->max_rates = 4; | 681 | hw->max_rates = 4; |
682 | hw->channel_change_time = 5000; | 682 | hw->channel_change_time = 5000; |
683 | hw->max_listen_interval = 10; | 683 | hw->max_listen_interval = 1; |
684 | hw->max_rate_tries = 10; | 684 | hw->max_rate_tries = 10; |
685 | hw->sta_data_size = sizeof(struct ath_node); | 685 | hw->sta_data_size = sizeof(struct ath_node); |
686 | hw->vif_data_size = sizeof(struct ath_vif); | 686 | hw->vif_data_size = sizeof(struct ath_vif); |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 38794850f005..798ea57252b4 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -118,15 +118,13 @@ void ath9k_ps_restore(struct ath_softc *sc) | |||
118 | if (--sc->ps_usecount != 0) | 118 | if (--sc->ps_usecount != 0) |
119 | goto unlock; | 119 | goto unlock; |
120 | 120 | ||
121 | if (sc->ps_flags & PS_WAIT_FOR_TX_ACK) | 121 | if (sc->ps_idle && (sc->ps_flags & PS_WAIT_FOR_TX_ACK)) |
122 | goto unlock; | ||
123 | |||
124 | if (sc->ps_idle) | ||
125 | mode = ATH9K_PM_FULL_SLEEP; | 122 | mode = ATH9K_PM_FULL_SLEEP; |
126 | else if (sc->ps_enabled && | 123 | else if (sc->ps_enabled && |
127 | !(sc->ps_flags & (PS_WAIT_FOR_BEACON | | 124 | !(sc->ps_flags & (PS_WAIT_FOR_BEACON | |
128 | PS_WAIT_FOR_CAB | | 125 | PS_WAIT_FOR_CAB | |
129 | PS_WAIT_FOR_PSPOLL_DATA))) | 126 | PS_WAIT_FOR_PSPOLL_DATA | |
127 | PS_WAIT_FOR_TX_ACK))) | ||
130 | mode = ATH9K_PM_NETWORK_SLEEP; | 128 | mode = ATH9K_PM_NETWORK_SLEEP; |
131 | else | 129 | else |
132 | goto unlock; | 130 | goto unlock; |
@@ -640,7 +638,7 @@ static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta, | |||
640 | an->sta = sta; | 638 | an->sta = sta; |
641 | an->vif = vif; | 639 | an->vif = vif; |
642 | 640 | ||
643 | if (sta->ht_cap.ht_supported) { | 641 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) { |
644 | ath_tx_node_init(sc, an); | 642 | ath_tx_node_init(sc, an); |
645 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + | 643 | an->maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR + |
646 | sta->ht_cap.ampdu_factor); | 644 | sta->ht_cap.ampdu_factor); |
@@ -659,7 +657,7 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta) | |||
659 | an->sta = NULL; | 657 | an->sta = NULL; |
660 | #endif | 658 | #endif |
661 | 659 | ||
662 | if (sta->ht_cap.ht_supported) | 660 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) |
663 | ath_tx_node_cleanup(sc, an); | 661 | ath_tx_node_cleanup(sc, an); |
664 | } | 662 | } |
665 | 663 | ||
@@ -1550,6 +1548,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1550 | struct ath_hw *ah = sc->sc_ah; | 1548 | struct ath_hw *ah = sc->sc_ah; |
1551 | struct ath_common *common = ath9k_hw_common(ah); | 1549 | struct ath_common *common = ath9k_hw_common(ah); |
1552 | struct ieee80211_conf *conf = &hw->conf; | 1550 | struct ieee80211_conf *conf = &hw->conf; |
1551 | bool reset_channel = false; | ||
1553 | 1552 | ||
1554 | ath9k_ps_wakeup(sc); | 1553 | ath9k_ps_wakeup(sc); |
1555 | mutex_lock(&sc->mutex); | 1554 | mutex_lock(&sc->mutex); |
@@ -1558,6 +1557,12 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1558 | sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); | 1557 | sc->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE); |
1559 | if (sc->ps_idle) | 1558 | if (sc->ps_idle) |
1560 | ath_cancel_work(sc); | 1559 | ath_cancel_work(sc); |
1560 | else | ||
1561 | /* | ||
1562 | * The chip needs a reset to properly wake up from | ||
1563 | * full sleep | ||
1564 | */ | ||
1565 | reset_channel = ah->chip_fullsleep; | ||
1561 | } | 1566 | } |
1562 | 1567 | ||
1563 | /* | 1568 | /* |
@@ -1586,7 +1591,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) | |||
1586 | } | 1591 | } |
1587 | } | 1592 | } |
1588 | 1593 | ||
1589 | if (changed & IEEE80211_CONF_CHANGE_CHANNEL) { | 1594 | if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || reset_channel) { |
1590 | struct ieee80211_channel *curchan = hw->conf.channel; | 1595 | struct ieee80211_channel *curchan = hw->conf.channel; |
1591 | int pos = curchan->hw_value; | 1596 | int pos = curchan->hw_value; |
1592 | int old_pos = -1; | 1597 | int old_pos = -1; |
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index 4f848493fece..08bb45532701 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -1480,12 +1480,6 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, | |||
1480 | 1480 | ||
1481 | #ifdef CONFIG_ATH9K_DEBUGFS | 1481 | #ifdef CONFIG_ATH9K_DEBUGFS |
1482 | 1482 | ||
1483 | static int ath9k_debugfs_open(struct inode *inode, struct file *file) | ||
1484 | { | ||
1485 | file->private_data = inode->i_private; | ||
1486 | return 0; | ||
1487 | } | ||
1488 | |||
1489 | static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, | 1483 | static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, |
1490 | size_t count, loff_t *ppos) | 1484 | size_t count, loff_t *ppos) |
1491 | { | 1485 | { |
@@ -1553,7 +1547,7 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, | |||
1553 | 1547 | ||
1554 | static const struct file_operations fops_rcstat = { | 1548 | static const struct file_operations fops_rcstat = { |
1555 | .read = read_file_rcstat, | 1549 | .read = read_file_rcstat, |
1556 | .open = ath9k_debugfs_open, | 1550 | .open = simple_open, |
1557 | .owner = THIS_MODULE | 1551 | .owner = THIS_MODULE |
1558 | }; | 1552 | }; |
1559 | 1553 | ||
diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index f4ae3ba994a8..1c4583c7ff7c 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c | |||
@@ -1913,13 +1913,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) | |||
1913 | if (sc->rx.frag) { | 1913 | if (sc->rx.frag) { |
1914 | int space = skb->len - skb_tailroom(hdr_skb); | 1914 | int space = skb->len - skb_tailroom(hdr_skb); |
1915 | 1915 | ||
1916 | sc->rx.frag = NULL; | ||
1917 | |||
1918 | if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) { | 1916 | if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) { |
1919 | dev_kfree_skb(skb); | 1917 | dev_kfree_skb(skb); |
1920 | goto requeue_drop_frag; | 1918 | goto requeue_drop_frag; |
1921 | } | 1919 | } |
1922 | 1920 | ||
1921 | sc->rx.frag = NULL; | ||
1922 | |||
1923 | skb_copy_from_linear_data(skb, skb_put(hdr_skb, skb->len), | 1923 | skb_copy_from_linear_data(skb, skb_put(hdr_skb, skb->len), |
1924 | skb->len); | 1924 | skb->len); |
1925 | dev_kfree_skb_any(skb); | 1925 | dev_kfree_skb_any(skb); |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 834e6bc45e8b..23eaa1b26ebe 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -1820,6 +1820,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | |||
1820 | struct ath_frame_info *fi = get_frame_info(skb); | 1820 | struct ath_frame_info *fi = get_frame_info(skb); |
1821 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1821 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1822 | struct ath_buf *bf; | 1822 | struct ath_buf *bf; |
1823 | int fragno; | ||
1823 | u16 seqno; | 1824 | u16 seqno; |
1824 | 1825 | ||
1825 | bf = ath_tx_get_buffer(sc); | 1826 | bf = ath_tx_get_buffer(sc); |
@@ -1831,9 +1832,16 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, | |||
1831 | ATH_TXBUF_RESET(bf); | 1832 | ATH_TXBUF_RESET(bf); |
1832 | 1833 | ||
1833 | if (tid) { | 1834 | if (tid) { |
1835 | fragno = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; | ||
1834 | seqno = tid->seq_next; | 1836 | seqno = tid->seq_next; |
1835 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); | 1837 | hdr->seq_ctrl = cpu_to_le16(tid->seq_next << IEEE80211_SEQ_SEQ_SHIFT); |
1836 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | 1838 | |
1839 | if (fragno) | ||
1840 | hdr->seq_ctrl |= cpu_to_le16(fragno); | ||
1841 | |||
1842 | if (!ieee80211_has_morefrags(hdr->frame_control)) | ||
1843 | INCR(tid->seq_next, IEEE80211_SEQ_MAX); | ||
1844 | |||
1837 | bf->bf_state.seqno = seqno; | 1845 | bf->bf_state.seqno = seqno; |
1838 | } | 1846 | } |
1839 | 1847 | ||
diff --git a/drivers/net/wireless/ath/carl9170/debug.c b/drivers/net/wireless/ath/carl9170/debug.c index 3c164226687f..93fe6003a493 100644 --- a/drivers/net/wireless/ath/carl9170/debug.c +++ b/drivers/net/wireless/ath/carl9170/debug.c | |||
@@ -48,11 +48,6 @@ | |||
48 | #define ADD(buf, off, max, fmt, args...) \ | 48 | #define ADD(buf, off, max, fmt, args...) \ |
49 | off += snprintf(&buf[off], max - off, fmt, ##args); | 49 | off += snprintf(&buf[off], max - off, fmt, ##args); |
50 | 50 | ||
51 | static int carl9170_debugfs_open(struct inode *inode, struct file *file) | ||
52 | { | ||
53 | file->private_data = inode->i_private; | ||
54 | return 0; | ||
55 | } | ||
56 | 51 | ||
57 | struct carl9170_debugfs_fops { | 52 | struct carl9170_debugfs_fops { |
58 | unsigned int read_bufsize; | 53 | unsigned int read_bufsize; |
@@ -178,7 +173,7 @@ static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\ | |||
178 | .attr = _attr, \ | 173 | .attr = _attr, \ |
179 | .req_dev_state = _dstate, \ | 174 | .req_dev_state = _dstate, \ |
180 | .fops = { \ | 175 | .fops = { \ |
181 | .open = carl9170_debugfs_open, \ | 176 | .open = simple_open, \ |
182 | .read = carl9170_debugfs_read, \ | 177 | .read = carl9170_debugfs_read, \ |
183 | .write = carl9170_debugfs_write, \ | 178 | .write = carl9170_debugfs_write, \ |
184 | .owner = THIS_MODULE \ | 179 | .owner = THIS_MODULE \ |
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index e751fdee89b2..e807bd930647 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -500,12 +500,6 @@ out: | |||
500 | 500 | ||
501 | #undef fappend | 501 | #undef fappend |
502 | 502 | ||
503 | static int b43_debugfs_open(struct inode *inode, struct file *file) | ||
504 | { | ||
505 | file->private_data = inode->i_private; | ||
506 | return 0; | ||
507 | } | ||
508 | |||
509 | static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, | 503 | static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf, |
510 | size_t count, loff_t *ppos) | 504 | size_t count, loff_t *ppos) |
511 | { | 505 | { |
@@ -624,7 +618,7 @@ out_unlock: | |||
624 | .read = _read, \ | 618 | .read = _read, \ |
625 | .write = _write, \ | 619 | .write = _write, \ |
626 | .fops = { \ | 620 | .fops = { \ |
627 | .open = b43_debugfs_open, \ | 621 | .open = simple_open, \ |
628 | .read = b43_debugfs_read, \ | 622 | .read = b43_debugfs_read, \ |
629 | .write = b43_debugfs_write, \ | 623 | .write = b43_debugfs_write, \ |
630 | .llseek = generic_file_llseek, \ | 624 | .llseek = generic_file_llseek, \ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index c79e6638c88d..e4d6dc2e37d1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -4827,8 +4827,14 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4827 | out_mutex_unlock: | 4827 | out_mutex_unlock: |
4828 | mutex_unlock(&wl->mutex); | 4828 | mutex_unlock(&wl->mutex); |
4829 | 4829 | ||
4830 | /* reload configuration */ | 4830 | /* |
4831 | b43_op_config(hw, ~0); | 4831 | * Configuration may have been overwritten during initialization. |
4832 | * Reload the configuration, but only if initialization was | ||
4833 | * successful. Reloading the configuration after a failed init | ||
4834 | * may hang the system. | ||
4835 | */ | ||
4836 | if (!err) | ||
4837 | b43_op_config(hw, ~0); | ||
4832 | 4838 | ||
4833 | return err; | 4839 | return err; |
4834 | } | 4840 | } |
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c index 5e28ad0d6d17..1965edb765a2 100644 --- a/drivers/net/wireless/b43legacy/debugfs.c +++ b/drivers/net/wireless/b43legacy/debugfs.c | |||
@@ -197,12 +197,6 @@ static int restart_write_file(struct b43legacy_wldev *dev, const char *buf, size | |||
197 | 197 | ||
198 | #undef fappend | 198 | #undef fappend |
199 | 199 | ||
200 | static int b43legacy_debugfs_open(struct inode *inode, struct file *file) | ||
201 | { | ||
202 | file->private_data = inode->i_private; | ||
203 | return 0; | ||
204 | } | ||
205 | |||
206 | static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf, | 200 | static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf, |
207 | size_t count, loff_t *ppos) | 201 | size_t count, loff_t *ppos) |
208 | { | 202 | { |
@@ -331,7 +325,7 @@ out_unlock: | |||
331 | .read = _read, \ | 325 | .read = _read, \ |
332 | .write = _write, \ | 326 | .write = _write, \ |
333 | .fops = { \ | 327 | .fops = { \ |
334 | .open = b43legacy_debugfs_open, \ | 328 | .open = simple_open, \ |
335 | .read = b43legacy_debugfs_read, \ | 329 | .read = b43legacy_debugfs_read, \ |
336 | .write = b43legacy_debugfs_write, \ | 330 | .write = b43legacy_debugfs_write, \ |
337 | .llseek = generic_file_llseek, \ | 331 | .llseek = generic_file_llseek, \ |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c index 4688904908ec..758c115b556e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c | |||
@@ -108,9 +108,15 @@ static inline int brcmf_sdioh_f0_write_byte(struct brcmf_sdio_dev *sdiodev, | |||
108 | sdio_release_host(sdfunc); | 108 | sdio_release_host(sdfunc); |
109 | } | 109 | } |
110 | } else if (regaddr == SDIO_CCCR_ABORT) { | 110 | } else if (regaddr == SDIO_CCCR_ABORT) { |
111 | sdfunc = kmemdup(sdiodev->func[0], sizeof(struct sdio_func), | ||
112 | GFP_KERNEL); | ||
113 | if (!sdfunc) | ||
114 | return -ENOMEM; | ||
115 | sdfunc->num = 0; | ||
111 | sdio_claim_host(sdfunc); | 116 | sdio_claim_host(sdfunc); |
112 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); | 117 | sdio_writeb(sdfunc, *byte, regaddr, &err_ret); |
113 | sdio_release_host(sdfunc); | 118 | sdio_release_host(sdfunc); |
119 | kfree(sdfunc); | ||
114 | } else if (regaddr < 0xF0) { | 120 | } else if (regaddr < 0xF0) { |
115 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); | 121 | brcmf_dbg(ERROR, "F0 Wr:0x%02x: write disallowed\n", regaddr); |
116 | err_ret = -EPERM; | 122 | err_ret = -EPERM; |
@@ -486,7 +492,7 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func, | |||
486 | kfree(bus_if); | 492 | kfree(bus_if); |
487 | return -ENOMEM; | 493 | return -ENOMEM; |
488 | } | 494 | } |
489 | sdiodev->func[0] = func->card->sdio_func[0]; | 495 | sdiodev->func[0] = func; |
490 | sdiodev->func[1] = func; | 496 | sdiodev->func[1] = func; |
491 | sdiodev->bus_if = bus_if; | 497 | sdiodev->bus_if = bus_if; |
492 | bus_if->bus_priv.sdio = sdiodev; | 498 | bus_if->bus_priv.sdio = sdiodev; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 2bf5dda29291..eb3829b03cd3 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -574,6 +574,8 @@ struct brcmf_sdio { | |||
574 | 574 | ||
575 | struct task_struct *dpc_tsk; | 575 | struct task_struct *dpc_tsk; |
576 | struct completion dpc_wait; | 576 | struct completion dpc_wait; |
577 | struct list_head dpc_tsklst; | ||
578 | spinlock_t dpc_tl_lock; | ||
577 | 579 | ||
578 | struct semaphore sdsem; | 580 | struct semaphore sdsem; |
579 | 581 | ||
@@ -2594,29 +2596,58 @@ clkwait: | |||
2594 | return resched; | 2596 | return resched; |
2595 | } | 2597 | } |
2596 | 2598 | ||
2599 | static inline void brcmf_sdbrcm_adddpctsk(struct brcmf_sdio *bus) | ||
2600 | { | ||
2601 | struct list_head *new_hd; | ||
2602 | unsigned long flags; | ||
2603 | |||
2604 | if (in_interrupt()) | ||
2605 | new_hd = kzalloc(sizeof(struct list_head), GFP_ATOMIC); | ||
2606 | else | ||
2607 | new_hd = kzalloc(sizeof(struct list_head), GFP_KERNEL); | ||
2608 | if (new_hd == NULL) | ||
2609 | return; | ||
2610 | |||
2611 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
2612 | list_add_tail(new_hd, &bus->dpc_tsklst); | ||
2613 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
2614 | } | ||
2615 | |||
2597 | static int brcmf_sdbrcm_dpc_thread(void *data) | 2616 | static int brcmf_sdbrcm_dpc_thread(void *data) |
2598 | { | 2617 | { |
2599 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; | 2618 | struct brcmf_sdio *bus = (struct brcmf_sdio *) data; |
2619 | struct list_head *cur_hd, *tmp_hd; | ||
2620 | unsigned long flags; | ||
2600 | 2621 | ||
2601 | allow_signal(SIGTERM); | 2622 | allow_signal(SIGTERM); |
2602 | /* Run until signal received */ | 2623 | /* Run until signal received */ |
2603 | while (1) { | 2624 | while (1) { |
2604 | if (kthread_should_stop()) | 2625 | if (kthread_should_stop()) |
2605 | break; | 2626 | break; |
2606 | if (!wait_for_completion_interruptible(&bus->dpc_wait)) { | 2627 | |
2607 | /* Call bus dpc unless it indicated down | 2628 | if (list_empty(&bus->dpc_tsklst)) |
2608 | (then clean stop) */ | 2629 | if (wait_for_completion_interruptible(&bus->dpc_wait)) |
2609 | if (bus->sdiodev->bus_if->state != BRCMF_BUS_DOWN) { | 2630 | break; |
2610 | if (brcmf_sdbrcm_dpc(bus)) | 2631 | |
2611 | complete(&bus->dpc_wait); | 2632 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); |
2612 | } else { | 2633 | list_for_each_safe(cur_hd, tmp_hd, &bus->dpc_tsklst) { |
2634 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
2635 | |||
2636 | if (bus->sdiodev->bus_if->state == BRCMF_BUS_DOWN) { | ||
2613 | /* after stopping the bus, exit thread */ | 2637 | /* after stopping the bus, exit thread */ |
2614 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); | 2638 | brcmf_sdbrcm_bus_stop(bus->sdiodev->dev); |
2615 | bus->dpc_tsk = NULL; | 2639 | bus->dpc_tsk = NULL; |
2616 | break; | 2640 | break; |
2617 | } | 2641 | } |
2618 | } else | 2642 | |
2619 | break; | 2643 | if (brcmf_sdbrcm_dpc(bus)) |
2644 | brcmf_sdbrcm_adddpctsk(bus); | ||
2645 | |||
2646 | spin_lock_irqsave(&bus->dpc_tl_lock, flags); | ||
2647 | list_del(cur_hd); | ||
2648 | kfree(cur_hd); | ||
2649 | } | ||
2650 | spin_unlock_irqrestore(&bus->dpc_tl_lock, flags); | ||
2620 | } | 2651 | } |
2621 | return 0; | 2652 | return 0; |
2622 | } | 2653 | } |
@@ -2669,8 +2700,10 @@ static int brcmf_sdbrcm_bus_txdata(struct device *dev, struct sk_buff *pkt) | |||
2669 | /* Schedule DPC if needed to send queued packet(s) */ | 2700 | /* Schedule DPC if needed to send queued packet(s) */ |
2670 | if (!bus->dpc_sched) { | 2701 | if (!bus->dpc_sched) { |
2671 | bus->dpc_sched = true; | 2702 | bus->dpc_sched = true; |
2672 | if (bus->dpc_tsk) | 2703 | if (bus->dpc_tsk) { |
2704 | brcmf_sdbrcm_adddpctsk(bus); | ||
2673 | complete(&bus->dpc_wait); | 2705 | complete(&bus->dpc_wait); |
2706 | } | ||
2674 | } | 2707 | } |
2675 | 2708 | ||
2676 | return ret; | 2709 | return ret; |
@@ -3514,8 +3547,10 @@ void brcmf_sdbrcm_isr(void *arg) | |||
3514 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); | 3547 | brcmf_dbg(ERROR, "isr w/o interrupt configured!\n"); |
3515 | 3548 | ||
3516 | bus->dpc_sched = true; | 3549 | bus->dpc_sched = true; |
3517 | if (bus->dpc_tsk) | 3550 | if (bus->dpc_tsk) { |
3551 | brcmf_sdbrcm_adddpctsk(bus); | ||
3518 | complete(&bus->dpc_wait); | 3552 | complete(&bus->dpc_wait); |
3553 | } | ||
3519 | } | 3554 | } |
3520 | 3555 | ||
3521 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | 3556 | static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) |
@@ -3559,8 +3594,10 @@ static bool brcmf_sdbrcm_bus_watchdog(struct brcmf_sdio *bus) | |||
3559 | bus->ipend = true; | 3594 | bus->ipend = true; |
3560 | 3595 | ||
3561 | bus->dpc_sched = true; | 3596 | bus->dpc_sched = true; |
3562 | if (bus->dpc_tsk) | 3597 | if (bus->dpc_tsk) { |
3598 | brcmf_sdbrcm_adddpctsk(bus); | ||
3563 | complete(&bus->dpc_wait); | 3599 | complete(&bus->dpc_wait); |
3600 | } | ||
3564 | } | 3601 | } |
3565 | } | 3602 | } |
3566 | 3603 | ||
@@ -3897,6 +3934,8 @@ void *brcmf_sdbrcm_probe(u32 regsva, struct brcmf_sdio_dev *sdiodev) | |||
3897 | } | 3934 | } |
3898 | /* Initialize DPC thread */ | 3935 | /* Initialize DPC thread */ |
3899 | init_completion(&bus->dpc_wait); | 3936 | init_completion(&bus->dpc_wait); |
3937 | INIT_LIST_HEAD(&bus->dpc_tsklst); | ||
3938 | spin_lock_init(&bus->dpc_tl_lock); | ||
3900 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, | 3939 | bus->dpc_tsk = kthread_run(brcmf_sdbrcm_dpc_thread, |
3901 | bus, "brcmf_dpc"); | 3940 | bus, "brcmf_dpc"); |
3902 | if (IS_ERR(bus->dpc_tsk)) { | 3941 | if (IS_ERR(bus->dpc_tsk)) { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c index 231ddf4a674f..b4d92792c502 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c | |||
@@ -847,8 +847,7 @@ brcms_c_dotxstatus(struct brcms_c_info *wlc, struct tx_status *txs) | |||
847 | */ | 847 | */ |
848 | if (!(txs->status & TX_STATUS_AMPDU) | 848 | if (!(txs->status & TX_STATUS_AMPDU) |
849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { | 849 | && (txs->status & TX_STATUS_INTERMEDIATE)) { |
850 | wiphy_err(wlc->wiphy, "%s: INTERMEDIATE but not AMPDU\n", | 850 | BCMMSG(wlc->wiphy, "INTERMEDIATE but not AMPDU\n"); |
851 | __func__); | ||
852 | return false; | 851 | return false; |
853 | } | 852 | } |
854 | 853 | ||
@@ -7614,6 +7613,7 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7614 | { | 7613 | { |
7615 | int len_mpdu; | 7614 | int len_mpdu; |
7616 | struct ieee80211_rx_status rx_status; | 7615 | struct ieee80211_rx_status rx_status; |
7616 | struct ieee80211_hdr *hdr; | ||
7617 | 7617 | ||
7618 | memset(&rx_status, 0, sizeof(rx_status)); | 7618 | memset(&rx_status, 0, sizeof(rx_status)); |
7619 | prep_mac80211_status(wlc, rxh, p, &rx_status); | 7619 | prep_mac80211_status(wlc, rxh, p, &rx_status); |
@@ -7623,6 +7623,13 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh, | |||
7623 | skb_pull(p, D11_PHY_HDR_LEN); | 7623 | skb_pull(p, D11_PHY_HDR_LEN); |
7624 | __skb_trim(p, len_mpdu); | 7624 | __skb_trim(p, len_mpdu); |
7625 | 7625 | ||
7626 | /* unmute transmit */ | ||
7627 | if (wlc->hw->suspended_fifos) { | ||
7628 | hdr = (struct ieee80211_hdr *)p->data; | ||
7629 | if (ieee80211_is_beacon(hdr->frame_control)) | ||
7630 | brcms_b_mute(wlc->hw, false); | ||
7631 | } | ||
7632 | |||
7626 | memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); | 7633 | memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status)); |
7627 | ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); | 7634 | ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p); |
7628 | } | 7635 | } |
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c index 4fcdac63a300..1779db3aa2b0 100644 --- a/drivers/net/wireless/ipw2x00/ipw2200.c +++ b/drivers/net/wireless/ipw2x00/ipw2200.c | |||
@@ -2191,6 +2191,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
2191 | { | 2191 | { |
2192 | int rc = 0; | 2192 | int rc = 0; |
2193 | unsigned long flags; | 2193 | unsigned long flags; |
2194 | unsigned long now, end; | ||
2194 | 2195 | ||
2195 | spin_lock_irqsave(&priv->lock, flags); | 2196 | spin_lock_irqsave(&priv->lock, flags); |
2196 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2197 | if (priv->status & STATUS_HCMD_ACTIVE) { |
@@ -2232,10 +2233,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd) | |||
2232 | } | 2233 | } |
2233 | spin_unlock_irqrestore(&priv->lock, flags); | 2234 | spin_unlock_irqrestore(&priv->lock, flags); |
2234 | 2235 | ||
2236 | now = jiffies; | ||
2237 | end = now + HOST_COMPLETE_TIMEOUT; | ||
2238 | again: | ||
2235 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, | 2239 | rc = wait_event_interruptible_timeout(priv->wait_command_queue, |
2236 | !(priv-> | 2240 | !(priv-> |
2237 | status & STATUS_HCMD_ACTIVE), | 2241 | status & STATUS_HCMD_ACTIVE), |
2238 | HOST_COMPLETE_TIMEOUT); | 2242 | end - now); |
2243 | if (rc < 0) { | ||
2244 | now = jiffies; | ||
2245 | if (time_before(now, end)) | ||
2246 | goto again; | ||
2247 | rc = 0; | ||
2248 | } | ||
2249 | |||
2239 | if (rc == 0) { | 2250 | if (rc == 0) { |
2240 | spin_lock_irqsave(&priv->lock, flags); | 2251 | spin_lock_irqsave(&priv->lock, flags); |
2241 | if (priv->status & STATUS_HCMD_ACTIVE) { | 2252 | if (priv->status & STATUS_HCMD_ACTIVE) { |
@@ -11507,9 +11518,9 @@ static int ipw_wdev_init(struct net_device *dev) | |||
11507 | rc = -ENOMEM; | 11518 | rc = -ENOMEM; |
11508 | goto out; | 11519 | goto out; |
11509 | } | 11520 | } |
11510 | /* translate geo->bg to a_band.channels */ | 11521 | /* translate geo->a to a_band.channels */ |
11511 | for (i = 0; i < geo->a_channels; i++) { | 11522 | for (i = 0; i < geo->a_channels; i++) { |
11512 | a_band->channels[i].band = IEEE80211_BAND_2GHZ; | 11523 | a_band->channels[i].band = IEEE80211_BAND_5GHZ; |
11513 | a_band->channels[i].center_freq = geo->a[i].freq; | 11524 | a_band->channels[i].center_freq = geo->a[i].freq; |
11514 | a_band->channels[i].hw_value = geo->a[i].channel; | 11525 | a_band->channels[i].hw_value = geo->a[i].channel; |
11515 | a_band->channels[i].max_power = geo->a[i].max_power; | 11526 | a_band->channels[i].max_power = geo->a[i].max_power; |
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index 0c1209390169..faec40467208 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -2673,8 +2673,6 @@ il3945_bg_restart(struct work_struct *data) | |||
2673 | 2673 | ||
2674 | if (test_and_clear_bit(S_FW_ERROR, &il->status)) { | 2674 | if (test_and_clear_bit(S_FW_ERROR, &il->status)) { |
2675 | mutex_lock(&il->mutex); | 2675 | mutex_lock(&il->mutex); |
2676 | /* FIXME: vif can be dereferenced */ | ||
2677 | il->vif = NULL; | ||
2678 | il->is_open = 0; | 2676 | il->is_open = 0; |
2679 | mutex_unlock(&il->mutex); | 2677 | mutex_unlock(&il->mutex); |
2680 | il3945_down(il); | 2678 | il3945_down(il); |
diff --git a/drivers/net/wireless/iwlegacy/3945-rs.c b/drivers/net/wireless/iwlegacy/3945-rs.c index 70bee1a4d876..4b10157d8686 100644 --- a/drivers/net/wireless/iwlegacy/3945-rs.c +++ b/drivers/net/wireless/iwlegacy/3945-rs.c | |||
@@ -821,12 +821,6 @@ out: | |||
821 | } | 821 | } |
822 | 822 | ||
823 | #ifdef CONFIG_MAC80211_DEBUGFS | 823 | #ifdef CONFIG_MAC80211_DEBUGFS |
824 | static int | ||
825 | il3945_open_file_generic(struct inode *inode, struct file *file) | ||
826 | { | ||
827 | file->private_data = inode->i_private; | ||
828 | return 0; | ||
829 | } | ||
830 | 824 | ||
831 | static ssize_t | 825 | static ssize_t |
832 | il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, | 826 | il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, |
@@ -862,7 +856,7 @@ il3945_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, | |||
862 | 856 | ||
863 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | 857 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { |
864 | .read = il3945_sta_dbgfs_stats_table_read, | 858 | .read = il3945_sta_dbgfs_stats_table_read, |
865 | .open = il3945_open_file_generic, | 859 | .open = simple_open, |
866 | .llseek = default_llseek, | 860 | .llseek = default_llseek, |
867 | }; | 861 | }; |
868 | 862 | ||
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 17f1c6853182..c46275a92565 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -5652,8 +5652,6 @@ il4965_bg_restart(struct work_struct *data) | |||
5652 | 5652 | ||
5653 | if (test_and_clear_bit(S_FW_ERROR, &il->status)) { | 5653 | if (test_and_clear_bit(S_FW_ERROR, &il->status)) { |
5654 | mutex_lock(&il->mutex); | 5654 | mutex_lock(&il->mutex); |
5655 | /* FIXME: do we dereference vif without mutex locked ? */ | ||
5656 | il->vif = NULL; | ||
5657 | il->is_open = 0; | 5655 | il->is_open = 0; |
5658 | 5656 | ||
5659 | __il4965_down(il); | 5657 | __il4965_down(il); |
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c index d7e2856e41d3..11ab1247fae1 100644 --- a/drivers/net/wireless/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/iwlegacy/4965-rs.c | |||
@@ -2518,12 +2518,6 @@ il4965_rs_free_sta(void *il_r, struct ieee80211_sta *sta, void *il_sta) | |||
2518 | } | 2518 | } |
2519 | 2519 | ||
2520 | #ifdef CONFIG_MAC80211_DEBUGFS | 2520 | #ifdef CONFIG_MAC80211_DEBUGFS |
2521 | static int | ||
2522 | il4965_open_file_generic(struct inode *inode, struct file *file) | ||
2523 | { | ||
2524 | file->private_data = inode->i_private; | ||
2525 | return 0; | ||
2526 | } | ||
2527 | 2521 | ||
2528 | static void | 2522 | static void |
2529 | il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx) | 2523 | il4965_rs_dbgfs_set_mcs(struct il_lq_sta *lq_sta, u32 * rate_n_flags, int idx) |
@@ -2695,7 +2689,7 @@ il4965_rs_sta_dbgfs_scale_table_read(struct file *file, char __user *user_buf, | |||
2695 | static const struct file_operations rs_sta_dbgfs_scale_table_ops = { | 2689 | static const struct file_operations rs_sta_dbgfs_scale_table_ops = { |
2696 | .write = il4965_rs_sta_dbgfs_scale_table_write, | 2690 | .write = il4965_rs_sta_dbgfs_scale_table_write, |
2697 | .read = il4965_rs_sta_dbgfs_scale_table_read, | 2691 | .read = il4965_rs_sta_dbgfs_scale_table_read, |
2698 | .open = il4965_open_file_generic, | 2692 | .open = simple_open, |
2699 | .llseek = default_llseek, | 2693 | .llseek = default_llseek, |
2700 | }; | 2694 | }; |
2701 | 2695 | ||
@@ -2740,7 +2734,7 @@ il4965_rs_sta_dbgfs_stats_table_read(struct file *file, char __user *user_buf, | |||
2740 | 2734 | ||
2741 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | 2735 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { |
2742 | .read = il4965_rs_sta_dbgfs_stats_table_read, | 2736 | .read = il4965_rs_sta_dbgfs_stats_table_read, |
2743 | .open = il4965_open_file_generic, | 2737 | .open = simple_open, |
2744 | .llseek = default_llseek, | 2738 | .llseek = default_llseek, |
2745 | }; | 2739 | }; |
2746 | 2740 | ||
@@ -2768,7 +2762,7 @@ il4965_rs_sta_dbgfs_rate_scale_data_read(struct file *file, | |||
2768 | 2762 | ||
2769 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { | 2763 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { |
2770 | .read = il4965_rs_sta_dbgfs_rate_scale_data_read, | 2764 | .read = il4965_rs_sta_dbgfs_rate_scale_data_read, |
2771 | .open = il4965_open_file_generic, | 2765 | .open = simple_open, |
2772 | .llseek = default_llseek, | 2766 | .llseek = default_llseek, |
2773 | }; | 2767 | }; |
2774 | 2768 | ||
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index e5ac04739bcc..eaf249452e51 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c | |||
@@ -4508,6 +4508,7 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
4508 | { | 4508 | { |
4509 | struct il_priv *il = hw->priv; | 4509 | struct il_priv *il = hw->priv; |
4510 | int err; | 4510 | int err; |
4511 | bool reset; | ||
4511 | 4512 | ||
4512 | mutex_lock(&il->mutex); | 4513 | mutex_lock(&il->mutex); |
4513 | D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); | 4514 | D_MAC80211("enter: type %d, addr %pM\n", vif->type, vif->addr); |
@@ -4518,7 +4519,12 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
4518 | goto out; | 4519 | goto out; |
4519 | } | 4520 | } |
4520 | 4521 | ||
4521 | if (il->vif) { | 4522 | /* |
4523 | * We do not support multiple virtual interfaces, but on hardware reset | ||
4524 | * we have to add the same interface again. | ||
4525 | */ | ||
4526 | reset = (il->vif == vif); | ||
4527 | if (il->vif && !reset) { | ||
4522 | err = -EOPNOTSUPP; | 4528 | err = -EOPNOTSUPP; |
4523 | goto out; | 4529 | goto out; |
4524 | } | 4530 | } |
@@ -4528,8 +4534,11 @@ il_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) | |||
4528 | 4534 | ||
4529 | err = il_set_mode(il); | 4535 | err = il_set_mode(il); |
4530 | if (err) { | 4536 | if (err) { |
4531 | il->vif = NULL; | 4537 | IL_WARN("Fail to set mode %d\n", vif->type); |
4532 | il->iw_mode = NL80211_IFTYPE_STATION; | 4538 | if (!reset) { |
4539 | il->vif = NULL; | ||
4540 | il->iw_mode = NL80211_IFTYPE_STATION; | ||
4541 | } | ||
4533 | } | 4542 | } |
4534 | 4543 | ||
4535 | out: | 4544 | out: |
@@ -5279,9 +5288,9 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
5279 | D_MAC80211("BSSID %pM\n", bss_conf->bssid); | 5288 | D_MAC80211("BSSID %pM\n", bss_conf->bssid); |
5280 | 5289 | ||
5281 | /* | 5290 | /* |
5282 | * If there is currently a HW scan going on in the | 5291 | * If there is currently a HW scan going on in the background, |
5283 | * background then we need to cancel it else the RXON | 5292 | * then we need to cancel it, otherwise sometimes we are not |
5284 | * below/in post_associate will fail. | 5293 | * able to authenticate (FIXME: why ?) |
5285 | */ | 5294 | */ |
5286 | if (il_scan_cancel_timeout(il, 100)) { | 5295 | if (il_scan_cancel_timeout(il, 100)) { |
5287 | D_MAC80211("leave - scan abort failed\n"); | 5296 | D_MAC80211("leave - scan abort failed\n"); |
@@ -5290,14 +5299,10 @@ il_mac_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
5290 | } | 5299 | } |
5291 | 5300 | ||
5292 | /* mac80211 only sets assoc when in STATION mode */ | 5301 | /* mac80211 only sets assoc when in STATION mode */ |
5293 | if (vif->type == NL80211_IFTYPE_ADHOC || bss_conf->assoc) { | 5302 | memcpy(il->staging.bssid_addr, bss_conf->bssid, ETH_ALEN); |
5294 | memcpy(il->staging.bssid_addr, bss_conf->bssid, | ||
5295 | ETH_ALEN); | ||
5296 | 5303 | ||
5297 | /* currently needed in a few places */ | 5304 | /* FIXME: currently needed in a few places */ |
5298 | memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); | 5305 | memcpy(il->bssid, bss_conf->bssid, ETH_ALEN); |
5299 | } else | ||
5300 | il->staging.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | ||
5301 | } | 5306 | } |
5302 | 5307 | ||
5303 | /* | 5308 | /* |
diff --git a/drivers/net/wireless/iwlegacy/debug.c b/drivers/net/wireless/iwlegacy/debug.c index 229849150aac..eff26501d60a 100644 --- a/drivers/net/wireless/iwlegacy/debug.c +++ b/drivers/net/wireless/iwlegacy/debug.c | |||
@@ -160,18 +160,12 @@ static ssize_t il_dbgfs_##name##_write(struct file *file, \ | |||
160 | const char __user *user_buf, \ | 160 | const char __user *user_buf, \ |
161 | size_t count, loff_t *ppos); | 161 | size_t count, loff_t *ppos); |
162 | 162 | ||
163 | static int | ||
164 | il_dbgfs_open_file_generic(struct inode *inode, struct file *file) | ||
165 | { | ||
166 | file->private_data = inode->i_private; | ||
167 | return 0; | ||
168 | } | ||
169 | 163 | ||
170 | #define DEBUGFS_READ_FILE_OPS(name) \ | 164 | #define DEBUGFS_READ_FILE_OPS(name) \ |
171 | DEBUGFS_READ_FUNC(name); \ | 165 | DEBUGFS_READ_FUNC(name); \ |
172 | static const struct file_operations il_dbgfs_##name##_ops = { \ | 166 | static const struct file_operations il_dbgfs_##name##_ops = { \ |
173 | .read = il_dbgfs_##name##_read, \ | 167 | .read = il_dbgfs_##name##_read, \ |
174 | .open = il_dbgfs_open_file_generic, \ | 168 | .open = simple_open, \ |
175 | .llseek = generic_file_llseek, \ | 169 | .llseek = generic_file_llseek, \ |
176 | }; | 170 | }; |
177 | 171 | ||
@@ -179,7 +173,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \ | |||
179 | DEBUGFS_WRITE_FUNC(name); \ | 173 | DEBUGFS_WRITE_FUNC(name); \ |
180 | static const struct file_operations il_dbgfs_##name##_ops = { \ | 174 | static const struct file_operations il_dbgfs_##name##_ops = { \ |
181 | .write = il_dbgfs_##name##_write, \ | 175 | .write = il_dbgfs_##name##_write, \ |
182 | .open = il_dbgfs_open_file_generic, \ | 176 | .open = simple_open, \ |
183 | .llseek = generic_file_llseek, \ | 177 | .llseek = generic_file_llseek, \ |
184 | }; | 178 | }; |
185 | 179 | ||
@@ -189,7 +183,7 @@ static const struct file_operations il_dbgfs_##name##_ops = { \ | |||
189 | static const struct file_operations il_dbgfs_##name##_ops = { \ | 183 | static const struct file_operations il_dbgfs_##name##_ops = { \ |
190 | .write = il_dbgfs_##name##_write, \ | 184 | .write = il_dbgfs_##name##_write, \ |
191 | .read = il_dbgfs_##name##_read, \ | 185 | .read = il_dbgfs_##name##_read, \ |
192 | .open = il_dbgfs_open_file_generic, \ | 186 | .open = simple_open, \ |
193 | .llseek = generic_file_llseek, \ | 187 | .llseek = generic_file_llseek, \ |
194 | }; | 188 | }; |
195 | 189 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index 5b0d888f746b..8d80e233bc7a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -46,8 +46,8 @@ | |||
46 | #include "iwl-prph.h" | 46 | #include "iwl-prph.h" |
47 | 47 | ||
48 | /* Highest firmware API version supported */ | 48 | /* Highest firmware API version supported */ |
49 | #define IWL1000_UCODE_API_MAX 6 | 49 | #define IWL1000_UCODE_API_MAX 5 |
50 | #define IWL100_UCODE_API_MAX 6 | 50 | #define IWL100_UCODE_API_MAX 5 |
51 | 51 | ||
52 | /* Oldest version we won't warn about */ | 52 | /* Oldest version we won't warn about */ |
53 | #define IWL1000_UCODE_API_OK 5 | 53 | #define IWL1000_UCODE_API_OK 5 |
@@ -226,5 +226,5 @@ const struct iwl_cfg iwl100_bg_cfg = { | |||
226 | IWL_DEVICE_100, | 226 | IWL_DEVICE_100, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX)); | 229 | MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK)); |
230 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX)); | 230 | MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c index 5635b9e2c69e..ea108622e0bd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-2000.c +++ b/drivers/net/wireless/iwlwifi/iwl-2000.c | |||
@@ -51,10 +51,10 @@ | |||
51 | #define IWL135_UCODE_API_MAX 6 | 51 | #define IWL135_UCODE_API_MAX 6 |
52 | 52 | ||
53 | /* Oldest version we won't warn about */ | 53 | /* Oldest version we won't warn about */ |
54 | #define IWL2030_UCODE_API_OK 5 | 54 | #define IWL2030_UCODE_API_OK 6 |
55 | #define IWL2000_UCODE_API_OK 5 | 55 | #define IWL2000_UCODE_API_OK 6 |
56 | #define IWL105_UCODE_API_OK 5 | 56 | #define IWL105_UCODE_API_OK 6 |
57 | #define IWL135_UCODE_API_OK 5 | 57 | #define IWL135_UCODE_API_OK 6 |
58 | 58 | ||
59 | /* Lowest firmware API version supported */ | 59 | /* Lowest firmware API version supported */ |
60 | #define IWL2030_UCODE_API_MIN 5 | 60 | #define IWL2030_UCODE_API_MIN 5 |
@@ -328,7 +328,7 @@ const struct iwl_cfg iwl135_bgn_cfg = { | |||
328 | .ht_params = &iwl2000_ht_params, | 328 | .ht_params = &iwl2000_ht_params, |
329 | }; | 329 | }; |
330 | 330 | ||
331 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX)); | 331 | MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK)); |
332 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX)); | 332 | MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK)); |
333 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX)); | 333 | MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK)); |
334 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX)); | 334 | MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index a805e97b89af..de0920c74cdd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -51,6 +51,10 @@ | |||
51 | #define IWL5000_UCODE_API_MAX 5 | 51 | #define IWL5000_UCODE_API_MAX 5 |
52 | #define IWL5150_UCODE_API_MAX 2 | 52 | #define IWL5150_UCODE_API_MAX 2 |
53 | 53 | ||
54 | /* Oldest version we won't warn about */ | ||
55 | #define IWL5000_UCODE_API_OK 5 | ||
56 | #define IWL5150_UCODE_API_OK 2 | ||
57 | |||
54 | /* Lowest firmware API version supported */ | 58 | /* Lowest firmware API version supported */ |
55 | #define IWL5000_UCODE_API_MIN 1 | 59 | #define IWL5000_UCODE_API_MIN 1 |
56 | #define IWL5150_UCODE_API_MIN 1 | 60 | #define IWL5150_UCODE_API_MIN 1 |
@@ -326,6 +330,7 @@ static const struct iwl_ht_params iwl5000_ht_params = { | |||
326 | #define IWL_DEVICE_5000 \ | 330 | #define IWL_DEVICE_5000 \ |
327 | .fw_name_pre = IWL5000_FW_PRE, \ | 331 | .fw_name_pre = IWL5000_FW_PRE, \ |
328 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ | 332 | .ucode_api_max = IWL5000_UCODE_API_MAX, \ |
333 | .ucode_api_ok = IWL5000_UCODE_API_OK, \ | ||
329 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ | 334 | .ucode_api_min = IWL5000_UCODE_API_MIN, \ |
330 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 335 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
331 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ | 336 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
@@ -371,6 +376,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
371 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", | 376 | .name = "Intel(R) WiMAX/WiFi Link 5350 AGN", |
372 | .fw_name_pre = IWL5000_FW_PRE, | 377 | .fw_name_pre = IWL5000_FW_PRE, |
373 | .ucode_api_max = IWL5000_UCODE_API_MAX, | 378 | .ucode_api_max = IWL5000_UCODE_API_MAX, |
379 | .ucode_api_ok = IWL5000_UCODE_API_OK, | ||
374 | .ucode_api_min = IWL5000_UCODE_API_MIN, | 380 | .ucode_api_min = IWL5000_UCODE_API_MIN, |
375 | .max_inst_size = IWLAGN_RTC_INST_SIZE, | 381 | .max_inst_size = IWLAGN_RTC_INST_SIZE, |
376 | .max_data_size = IWLAGN_RTC_DATA_SIZE, | 382 | .max_data_size = IWLAGN_RTC_DATA_SIZE, |
@@ -386,6 +392,7 @@ const struct iwl_cfg iwl5350_agn_cfg = { | |||
386 | #define IWL_DEVICE_5150 \ | 392 | #define IWL_DEVICE_5150 \ |
387 | .fw_name_pre = IWL5150_FW_PRE, \ | 393 | .fw_name_pre = IWL5150_FW_PRE, \ |
388 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ | 394 | .ucode_api_max = IWL5150_UCODE_API_MAX, \ |
395 | .ucode_api_ok = IWL5150_UCODE_API_OK, \ | ||
389 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ | 396 | .ucode_api_min = IWL5150_UCODE_API_MIN, \ |
390 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ | 397 | .max_inst_size = IWLAGN_RTC_INST_SIZE, \ |
391 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ | 398 | .max_data_size = IWLAGN_RTC_DATA_SIZE, \ |
@@ -409,5 +416,5 @@ const struct iwl_cfg iwl5150_abg_cfg = { | |||
409 | IWL_DEVICE_5150, | 416 | IWL_DEVICE_5150, |
410 | }; | 417 | }; |
411 | 418 | ||
412 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX)); | 419 | MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK)); |
413 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX)); | 420 | MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index 64060cd738b5..f0c91505a7f7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -53,6 +53,8 @@ | |||
53 | /* Oldest version we won't warn about */ | 53 | /* Oldest version we won't warn about */ |
54 | #define IWL6000_UCODE_API_OK 4 | 54 | #define IWL6000_UCODE_API_OK 4 |
55 | #define IWL6000G2_UCODE_API_OK 5 | 55 | #define IWL6000G2_UCODE_API_OK 5 |
56 | #define IWL6050_UCODE_API_OK 5 | ||
57 | #define IWL6000G2B_UCODE_API_OK 6 | ||
56 | 58 | ||
57 | /* Lowest firmware API version supported */ | 59 | /* Lowest firmware API version supported */ |
58 | #define IWL6000_UCODE_API_MIN 4 | 60 | #define IWL6000_UCODE_API_MIN 4 |
@@ -388,7 +390,7 @@ const struct iwl_cfg iwl6005_2agn_mow2_cfg = { | |||
388 | #define IWL_DEVICE_6030 \ | 390 | #define IWL_DEVICE_6030 \ |
389 | .fw_name_pre = IWL6030_FW_PRE, \ | 391 | .fw_name_pre = IWL6030_FW_PRE, \ |
390 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ | 392 | .ucode_api_max = IWL6000G2_UCODE_API_MAX, \ |
391 | .ucode_api_ok = IWL6000G2_UCODE_API_OK, \ | 393 | .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \ |
392 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ | 394 | .ucode_api_min = IWL6000G2_UCODE_API_MIN, \ |
393 | .max_inst_size = IWL60_RTC_INST_SIZE, \ | 395 | .max_inst_size = IWL60_RTC_INST_SIZE, \ |
394 | .max_data_size = IWL60_RTC_DATA_SIZE, \ | 396 | .max_data_size = IWL60_RTC_DATA_SIZE, \ |
@@ -557,6 +559,6 @@ const struct iwl_cfg iwl6000_3agn_cfg = { | |||
557 | }; | 559 | }; |
558 | 560 | ||
559 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); | 561 | MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK)); |
560 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX)); | 562 | MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK)); |
561 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 563 | MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK)); |
562 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX)); | 564 | MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 53f8c51cfcdb..7e590b349dd7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -3083,11 +3083,6 @@ static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta, | |||
3083 | } | 3083 | } |
3084 | 3084 | ||
3085 | #ifdef CONFIG_MAC80211_DEBUGFS | 3085 | #ifdef CONFIG_MAC80211_DEBUGFS |
3086 | static int open_file_generic(struct inode *inode, struct file *file) | ||
3087 | { | ||
3088 | file->private_data = inode->i_private; | ||
3089 | return 0; | ||
3090 | } | ||
3091 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, | 3086 | static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta, |
3092 | u32 *rate_n_flags, int index) | 3087 | u32 *rate_n_flags, int index) |
3093 | { | 3088 | { |
@@ -3226,7 +3221,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file, | |||
3226 | static const struct file_operations rs_sta_dbgfs_scale_table_ops = { | 3221 | static const struct file_operations rs_sta_dbgfs_scale_table_ops = { |
3227 | .write = rs_sta_dbgfs_scale_table_write, | 3222 | .write = rs_sta_dbgfs_scale_table_write, |
3228 | .read = rs_sta_dbgfs_scale_table_read, | 3223 | .read = rs_sta_dbgfs_scale_table_read, |
3229 | .open = open_file_generic, | 3224 | .open = simple_open, |
3230 | .llseek = default_llseek, | 3225 | .llseek = default_llseek, |
3231 | }; | 3226 | }; |
3232 | static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | 3227 | static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, |
@@ -3269,7 +3264,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | |||
3269 | 3264 | ||
3270 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | 3265 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { |
3271 | .read = rs_sta_dbgfs_stats_table_read, | 3266 | .read = rs_sta_dbgfs_stats_table_read, |
3272 | .open = open_file_generic, | 3267 | .open = simple_open, |
3273 | .llseek = default_llseek, | 3268 | .llseek = default_llseek, |
3274 | }; | 3269 | }; |
3275 | 3270 | ||
@@ -3295,7 +3290,7 @@ static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, | |||
3295 | 3290 | ||
3296 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { | 3291 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { |
3297 | .read = rs_sta_dbgfs_rate_scale_data_read, | 3292 | .read = rs_sta_dbgfs_rate_scale_data_read, |
3298 | .open = open_file_generic, | 3293 | .open = simple_open, |
3299 | .llseek = default_llseek, | 3294 | .llseek = default_llseek, |
3300 | }; | 3295 | }; |
3301 | 3296 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index f1226dbf789d..2a9a16f901c3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -863,7 +863,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work) | |||
863 | 863 | ||
864 | void iwlagn_prepare_restart(struct iwl_priv *priv) | 864 | void iwlagn_prepare_restart(struct iwl_priv *priv) |
865 | { | 865 | { |
866 | struct iwl_rxon_context *ctx; | ||
867 | bool bt_full_concurrent; | 866 | bool bt_full_concurrent; |
868 | u8 bt_ci_compliance; | 867 | u8 bt_ci_compliance; |
869 | u8 bt_load; | 868 | u8 bt_load; |
@@ -872,8 +871,6 @@ void iwlagn_prepare_restart(struct iwl_priv *priv) | |||
872 | 871 | ||
873 | lockdep_assert_held(&priv->mutex); | 872 | lockdep_assert_held(&priv->mutex); |
874 | 873 | ||
875 | for_each_context(priv, ctx) | ||
876 | ctx->vif = NULL; | ||
877 | priv->is_open = 0; | 874 | priv->is_open = 0; |
878 | 875 | ||
879 | /* | 876 | /* |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index b7b1c04f2fba..2bbaebd99ad4 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -84,17 +84,11 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \ | |||
84 | size_t count, loff_t *ppos); | 84 | size_t count, loff_t *ppos); |
85 | 85 | ||
86 | 86 | ||
87 | static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file) | ||
88 | { | ||
89 | file->private_data = inode->i_private; | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | #define DEBUGFS_READ_FILE_OPS(name) \ | 87 | #define DEBUGFS_READ_FILE_OPS(name) \ |
94 | DEBUGFS_READ_FUNC(name); \ | 88 | DEBUGFS_READ_FUNC(name); \ |
95 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 89 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
96 | .read = iwl_dbgfs_##name##_read, \ | 90 | .read = iwl_dbgfs_##name##_read, \ |
97 | .open = iwl_dbgfs_open_file_generic, \ | 91 | .open = simple_open, \ |
98 | .llseek = generic_file_llseek, \ | 92 | .llseek = generic_file_llseek, \ |
99 | }; | 93 | }; |
100 | 94 | ||
@@ -102,7 +96,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
102 | DEBUGFS_WRITE_FUNC(name); \ | 96 | DEBUGFS_WRITE_FUNC(name); \ |
103 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 97 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
104 | .write = iwl_dbgfs_##name##_write, \ | 98 | .write = iwl_dbgfs_##name##_write, \ |
105 | .open = iwl_dbgfs_open_file_generic, \ | 99 | .open = simple_open, \ |
106 | .llseek = generic_file_llseek, \ | 100 | .llseek = generic_file_llseek, \ |
107 | }; | 101 | }; |
108 | 102 | ||
@@ -113,7 +107,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
113 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 107 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
114 | .write = iwl_dbgfs_##name##_write, \ | 108 | .write = iwl_dbgfs_##name##_write, \ |
115 | .read = iwl_dbgfs_##name##_read, \ | 109 | .read = iwl_dbgfs_##name##_read, \ |
116 | .open = iwl_dbgfs_open_file_generic, \ | 110 | .open = simple_open, \ |
117 | .llseek = generic_file_llseek, \ | 111 | .llseek = generic_file_llseek, \ |
118 | }; | 112 | }; |
119 | 113 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h index 90208094b8eb..74bce97a8600 100644 --- a/drivers/net/wireless/iwlwifi/iwl-fh.h +++ b/drivers/net/wireless/iwlwifi/iwl-fh.h | |||
@@ -104,15 +104,29 @@ | |||
104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 | 104 | * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04 |
105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte | 105 | * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte |
106 | * aligned (address bits 0-7 must be 0). | 106 | * aligned (address bits 0-7 must be 0). |
107 | * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers | ||
108 | * for them are in different places. | ||
107 | * | 109 | * |
108 | * Bit fields in each pointer register: | 110 | * Bit fields in each pointer register: |
109 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned | 111 | * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned |
110 | */ | 112 | */ |
111 | #define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) | 113 | #define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0) |
112 | #define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) | 114 | #define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10) |
113 | 115 | #define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0) | |
114 | /* Find TFD CB base pointer for given queue (range 0-15). */ | 116 | #define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00) |
115 | #define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4) | 117 | #define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20) |
118 | #define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80) | ||
119 | |||
120 | /* Find TFD CB base pointer for given queue */ | ||
121 | static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl) | ||
122 | { | ||
123 | if (chnl < 16) | ||
124 | return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl; | ||
125 | if (chnl < 20) | ||
126 | return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16); | ||
127 | WARN_ON_ONCE(chnl >= 32); | ||
128 | return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20); | ||
129 | } | ||
116 | 130 | ||
117 | 131 | ||
118 | /** | 132 | /** |
diff --git a/drivers/net/wireless/iwlwifi/iwl-mac80211.c b/drivers/net/wireless/iwlwifi/iwl-mac80211.c index b6805f8e9a01..c24a7134a6f9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-mac80211.c +++ b/drivers/net/wireless/iwlwifi/iwl-mac80211.c | |||
@@ -1244,6 +1244,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1244 | struct iwl_rxon_context *tmp, *ctx = NULL; | 1244 | struct iwl_rxon_context *tmp, *ctx = NULL; |
1245 | int err; | 1245 | int err; |
1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); | 1246 | enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif); |
1247 | bool reset = false; | ||
1247 | 1248 | ||
1248 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", | 1249 | IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n", |
1249 | viftype, vif->addr); | 1250 | viftype, vif->addr); |
@@ -1265,6 +1266,13 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1265 | tmp->interface_modes | tmp->exclusive_interface_modes; | 1266 | tmp->interface_modes | tmp->exclusive_interface_modes; |
1266 | 1267 | ||
1267 | if (tmp->vif) { | 1268 | if (tmp->vif) { |
1269 | /* On reset we need to add the same interface again */ | ||
1270 | if (tmp->vif == vif) { | ||
1271 | reset = true; | ||
1272 | ctx = tmp; | ||
1273 | break; | ||
1274 | } | ||
1275 | |||
1268 | /* check if this busy context is exclusive */ | 1276 | /* check if this busy context is exclusive */ |
1269 | if (tmp->exclusive_interface_modes & | 1277 | if (tmp->exclusive_interface_modes & |
1270 | BIT(tmp->vif->type)) { | 1278 | BIT(tmp->vif->type)) { |
@@ -1291,7 +1299,7 @@ static int iwlagn_mac_add_interface(struct ieee80211_hw *hw, | |||
1291 | ctx->vif = vif; | 1299 | ctx->vif = vif; |
1292 | 1300 | ||
1293 | err = iwl_setup_interface(priv, ctx); | 1301 | err = iwl_setup_interface(priv, ctx); |
1294 | if (!err) | 1302 | if (!err || reset) |
1295 | goto out; | 1303 | goto out; |
1296 | 1304 | ||
1297 | ctx->vif = NULL; | 1305 | ctx->vif = NULL; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h index 75dc20bd965b..3b1069290fa9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-prph.h +++ b/drivers/net/wireless/iwlwifi/iwl-prph.h | |||
@@ -223,12 +223,33 @@ | |||
223 | #define SCD_AIT (SCD_BASE + 0x0c) | 223 | #define SCD_AIT (SCD_BASE + 0x0c) |
224 | #define SCD_TXFACT (SCD_BASE + 0x10) | 224 | #define SCD_TXFACT (SCD_BASE + 0x10) |
225 | #define SCD_ACTIVE (SCD_BASE + 0x14) | 225 | #define SCD_ACTIVE (SCD_BASE + 0x14) |
226 | #define SCD_QUEUE_WRPTR(x) (SCD_BASE + 0x18 + (x) * 4) | ||
227 | #define SCD_QUEUE_RDPTR(x) (SCD_BASE + 0x68 + (x) * 4) | ||
228 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) | 226 | #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8) |
229 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) | 227 | #define SCD_AGGR_SEL (SCD_BASE + 0x248) |
230 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) | 228 | #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108) |
231 | #define SCD_QUEUE_STATUS_BITS(x) (SCD_BASE + 0x10c + (x) * 4) | 229 | |
230 | static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl) | ||
231 | { | ||
232 | if (chnl < 20) | ||
233 | return SCD_BASE + 0x18 + chnl * 4; | ||
234 | WARN_ON_ONCE(chnl >= 32); | ||
235 | return SCD_BASE + 0x284 + (chnl - 20) * 4; | ||
236 | } | ||
237 | |||
238 | static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl) | ||
239 | { | ||
240 | if (chnl < 20) | ||
241 | return SCD_BASE + 0x68 + chnl * 4; | ||
242 | WARN_ON_ONCE(chnl >= 32); | ||
243 | return SCD_BASE + 0x2B4 + (chnl - 20) * 4; | ||
244 | } | ||
245 | |||
246 | static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl) | ||
247 | { | ||
248 | if (chnl < 20) | ||
249 | return SCD_BASE + 0x10c + chnl * 4; | ||
250 | WARN_ON_ONCE(chnl >= 32); | ||
251 | return SCD_BASE + 0x384 + (chnl - 20) * 4; | ||
252 | } | ||
232 | 253 | ||
233 | /*********************** END TX SCHEDULER *************************************/ | 254 | /*********************** END TX SCHEDULER *************************************/ |
234 | 255 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c index b4f796c82e1e..4d7b30d3e648 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie.c | |||
@@ -1898,17 +1898,11 @@ static ssize_t iwl_dbgfs_##name##_write(struct file *file, \ | |||
1898 | size_t count, loff_t *ppos); | 1898 | size_t count, loff_t *ppos); |
1899 | 1899 | ||
1900 | 1900 | ||
1901 | static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file) | ||
1902 | { | ||
1903 | file->private_data = inode->i_private; | ||
1904 | return 0; | ||
1905 | } | ||
1906 | |||
1907 | #define DEBUGFS_READ_FILE_OPS(name) \ | 1901 | #define DEBUGFS_READ_FILE_OPS(name) \ |
1908 | DEBUGFS_READ_FUNC(name); \ | 1902 | DEBUGFS_READ_FUNC(name); \ |
1909 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 1903 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
1910 | .read = iwl_dbgfs_##name##_read, \ | 1904 | .read = iwl_dbgfs_##name##_read, \ |
1911 | .open = iwl_dbgfs_open_file_generic, \ | 1905 | .open = simple_open, \ |
1912 | .llseek = generic_file_llseek, \ | 1906 | .llseek = generic_file_llseek, \ |
1913 | }; | 1907 | }; |
1914 | 1908 | ||
@@ -1916,7 +1910,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
1916 | DEBUGFS_WRITE_FUNC(name); \ | 1910 | DEBUGFS_WRITE_FUNC(name); \ |
1917 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 1911 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
1918 | .write = iwl_dbgfs_##name##_write, \ | 1912 | .write = iwl_dbgfs_##name##_write, \ |
1919 | .open = iwl_dbgfs_open_file_generic, \ | 1913 | .open = simple_open, \ |
1920 | .llseek = generic_file_llseek, \ | 1914 | .llseek = generic_file_llseek, \ |
1921 | }; | 1915 | }; |
1922 | 1916 | ||
@@ -1926,7 +1920,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
1926 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 1920 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
1927 | .write = iwl_dbgfs_##name##_write, \ | 1921 | .write = iwl_dbgfs_##name##_write, \ |
1928 | .read = iwl_dbgfs_##name##_read, \ | 1922 | .read = iwl_dbgfs_##name##_read, \ |
1929 | .open = iwl_dbgfs_open_file_generic, \ | 1923 | .open = simple_open, \ |
1930 | .llseek = generic_file_llseek, \ | 1924 | .llseek = generic_file_llseek, \ |
1931 | }; | 1925 | }; |
1932 | 1926 | ||
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c index 87eef5773a02..b6199d124bb9 100644 --- a/drivers/net/wireless/iwmc3200wifi/debugfs.c +++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c | |||
@@ -99,12 +99,6 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_iwm_dbg_modules, | |||
99 | iwm_debugfs_u32_read, iwm_debugfs_dbg_modules_write, | 99 | iwm_debugfs_u32_read, iwm_debugfs_dbg_modules_write, |
100 | "%llu\n"); | 100 | "%llu\n"); |
101 | 101 | ||
102 | static int iwm_generic_open(struct inode *inode, struct file *filp) | ||
103 | { | ||
104 | filp->private_data = inode->i_private; | ||
105 | return 0; | ||
106 | } | ||
107 | |||
108 | 102 | ||
109 | static ssize_t iwm_debugfs_txq_read(struct file *filp, char __user *buffer, | 103 | static ssize_t iwm_debugfs_txq_read(struct file *filp, char __user *buffer, |
110 | size_t count, loff_t *ppos) | 104 | size_t count, loff_t *ppos) |
@@ -401,28 +395,28 @@ out: | |||
401 | 395 | ||
402 | static const struct file_operations iwm_debugfs_txq_fops = { | 396 | static const struct file_operations iwm_debugfs_txq_fops = { |
403 | .owner = THIS_MODULE, | 397 | .owner = THIS_MODULE, |
404 | .open = iwm_generic_open, | 398 | .open = simple_open, |
405 | .read = iwm_debugfs_txq_read, | 399 | .read = iwm_debugfs_txq_read, |
406 | .llseek = default_llseek, | 400 | .llseek = default_llseek, |
407 | }; | 401 | }; |
408 | 402 | ||
409 | static const struct file_operations iwm_debugfs_tx_credit_fops = { | 403 | static const struct file_operations iwm_debugfs_tx_credit_fops = { |
410 | .owner = THIS_MODULE, | 404 | .owner = THIS_MODULE, |
411 | .open = iwm_generic_open, | 405 | .open = simple_open, |
412 | .read = iwm_debugfs_tx_credit_read, | 406 | .read = iwm_debugfs_tx_credit_read, |
413 | .llseek = default_llseek, | 407 | .llseek = default_llseek, |
414 | }; | 408 | }; |
415 | 409 | ||
416 | static const struct file_operations iwm_debugfs_rx_ticket_fops = { | 410 | static const struct file_operations iwm_debugfs_rx_ticket_fops = { |
417 | .owner = THIS_MODULE, | 411 | .owner = THIS_MODULE, |
418 | .open = iwm_generic_open, | 412 | .open = simple_open, |
419 | .read = iwm_debugfs_rx_ticket_read, | 413 | .read = iwm_debugfs_rx_ticket_read, |
420 | .llseek = default_llseek, | 414 | .llseek = default_llseek, |
421 | }; | 415 | }; |
422 | 416 | ||
423 | static const struct file_operations iwm_debugfs_fw_err_fops = { | 417 | static const struct file_operations iwm_debugfs_fw_err_fops = { |
424 | .owner = THIS_MODULE, | 418 | .owner = THIS_MODULE, |
425 | .open = iwm_generic_open, | 419 | .open = simple_open, |
426 | .read = iwm_debugfs_fw_err_read, | 420 | .read = iwm_debugfs_fw_err_read, |
427 | .llseek = default_llseek, | 421 | .llseek = default_llseek, |
428 | }; | 422 | }; |
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c index 764b40dd24ad..0042f204b07f 100644 --- a/drivers/net/wireless/iwmc3200wifi/sdio.c +++ b/drivers/net/wireless/iwmc3200wifi/sdio.c | |||
@@ -264,13 +264,6 @@ static int if_sdio_send_chunk(struct iwm_priv *iwm, u8 *buf, int count) | |||
264 | return ret; | 264 | return ret; |
265 | } | 265 | } |
266 | 266 | ||
267 | /* debugfs hooks */ | ||
268 | static int iwm_debugfs_sdio_open(struct inode *inode, struct file *filp) | ||
269 | { | ||
270 | filp->private_data = inode->i_private; | ||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static ssize_t iwm_debugfs_sdio_read(struct file *filp, char __user *buffer, | 267 | static ssize_t iwm_debugfs_sdio_read(struct file *filp, char __user *buffer, |
275 | size_t count, loff_t *ppos) | 268 | size_t count, loff_t *ppos) |
276 | { | 269 | { |
@@ -363,7 +356,7 @@ err: | |||
363 | 356 | ||
364 | static const struct file_operations iwm_debugfs_sdio_fops = { | 357 | static const struct file_operations iwm_debugfs_sdio_fops = { |
365 | .owner = THIS_MODULE, | 358 | .owner = THIS_MODULE, |
366 | .open = iwm_debugfs_sdio_open, | 359 | .open = simple_open, |
367 | .read = iwm_debugfs_sdio_read, | 360 | .read = iwm_debugfs_sdio_read, |
368 | .llseek = default_llseek, | 361 | .llseek = default_llseek, |
369 | }; | 362 | }; |
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c index 3fa1ecebadfd..2fa879b015b6 100644 --- a/drivers/net/wireless/libertas/cfg.c +++ b/drivers/net/wireless/libertas/cfg.c | |||
@@ -103,7 +103,7 @@ static const u32 cipher_suites[] = { | |||
103 | * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1 | 103 | * Convert NL80211's auth_type to the one from Libertas, see chapter 5.9.1 |
104 | * in the firmware spec | 104 | * in the firmware spec |
105 | */ | 105 | */ |
106 | static u8 lbs_auth_to_authtype(enum nl80211_auth_type auth_type) | 106 | static int lbs_auth_to_authtype(enum nl80211_auth_type auth_type) |
107 | { | 107 | { |
108 | int ret = -ENOTSUPP; | 108 | int ret = -ENOTSUPP; |
109 | 109 | ||
@@ -1411,7 +1411,12 @@ static int lbs_cfg_connect(struct wiphy *wiphy, struct net_device *dev, | |||
1411 | goto done; | 1411 | goto done; |
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | lbs_set_authtype(priv, sme); | 1414 | ret = lbs_set_authtype(priv, sme); |
1415 | if (ret == -ENOTSUPP) { | ||
1416 | wiphy_err(wiphy, "unsupported authtype 0x%x\n", sme->auth_type); | ||
1417 | goto done; | ||
1418 | } | ||
1419 | |||
1415 | lbs_set_radio(priv, preamble, 1); | 1420 | lbs_set_radio(priv, preamble, 1); |
1416 | 1421 | ||
1417 | /* Do the actual association */ | 1422 | /* Do the actual association */ |
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index c192671610fc..a06cc283e23d 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -21,12 +21,6 @@ static char *szStates[] = { | |||
21 | static void lbs_debug_init(struct lbs_private *priv); | 21 | static void lbs_debug_init(struct lbs_private *priv); |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | static int open_file_generic(struct inode *inode, struct file *file) | ||
25 | { | ||
26 | file->private_data = inode->i_private; | ||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static ssize_t write_file_dummy(struct file *file, const char __user *buf, | 24 | static ssize_t write_file_dummy(struct file *file, const char __user *buf, |
31 | size_t count, loff_t *ppos) | 25 | size_t count, loff_t *ppos) |
32 | { | 26 | { |
@@ -696,7 +690,7 @@ out_unlock: | |||
696 | 690 | ||
697 | #define FOPS(fread, fwrite) { \ | 691 | #define FOPS(fread, fwrite) { \ |
698 | .owner = THIS_MODULE, \ | 692 | .owner = THIS_MODULE, \ |
699 | .open = open_file_generic, \ | 693 | .open = simple_open, \ |
700 | .read = (fread), \ | 694 | .read = (fread), \ |
701 | .write = (fwrite), \ | 695 | .write = (fwrite), \ |
702 | .llseek = generic_file_llseek, \ | 696 | .llseek = generic_file_llseek, \ |
@@ -962,7 +956,7 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf, | |||
962 | 956 | ||
963 | static const struct file_operations lbs_debug_fops = { | 957 | static const struct file_operations lbs_debug_fops = { |
964 | .owner = THIS_MODULE, | 958 | .owner = THIS_MODULE, |
965 | .open = open_file_generic, | 959 | .open = simple_open, |
966 | .write = lbs_debugfs_write, | 960 | .write = lbs_debugfs_write, |
967 | .read = lbs_debugfs_read, | 961 | .read = lbs_debugfs_read, |
968 | .llseek = default_llseek, | 962 | .llseek = default_llseek, |
diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c index d26a78b6b3c4..1a845074c52a 100644 --- a/drivers/net/wireless/mwifiex/debugfs.c +++ b/drivers/net/wireless/mwifiex/debugfs.c | |||
@@ -140,18 +140,6 @@ static struct mwifiex_debug_data items[] = { | |||
140 | static int num_of_items = ARRAY_SIZE(items); | 140 | static int num_of_items = ARRAY_SIZE(items); |
141 | 141 | ||
142 | /* | 142 | /* |
143 | * Generic proc file open handler. | ||
144 | * | ||
145 | * This function is called every time a file is accessed for read or write. | ||
146 | */ | ||
147 | static int | ||
148 | mwifiex_open_generic(struct inode *inode, struct file *file) | ||
149 | { | ||
150 | file->private_data = inode->i_private; | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | /* | ||
155 | * Proc info file read handler. | 143 | * Proc info file read handler. |
156 | * | 144 | * |
157 | * This function is called when the 'info' file is opened for reading. | 145 | * This function is called when the 'info' file is opened for reading. |
@@ -676,19 +664,19 @@ done: | |||
676 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ | 664 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ |
677 | .read = mwifiex_##name##_read, \ | 665 | .read = mwifiex_##name##_read, \ |
678 | .write = mwifiex_##name##_write, \ | 666 | .write = mwifiex_##name##_write, \ |
679 | .open = mwifiex_open_generic, \ | 667 | .open = simple_open, \ |
680 | }; | 668 | }; |
681 | 669 | ||
682 | #define MWIFIEX_DFS_FILE_READ_OPS(name) \ | 670 | #define MWIFIEX_DFS_FILE_READ_OPS(name) \ |
683 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ | 671 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ |
684 | .read = mwifiex_##name##_read, \ | 672 | .read = mwifiex_##name##_read, \ |
685 | .open = mwifiex_open_generic, \ | 673 | .open = simple_open, \ |
686 | }; | 674 | }; |
687 | 675 | ||
688 | #define MWIFIEX_DFS_FILE_WRITE_OPS(name) \ | 676 | #define MWIFIEX_DFS_FILE_WRITE_OPS(name) \ |
689 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ | 677 | static const struct file_operations mwifiex_dfs_##name##_fops = { \ |
690 | .write = mwifiex_##name##_write, \ | 678 | .write = mwifiex_##name##_write, \ |
691 | .open = mwifiex_open_generic, \ | 679 | .open = simple_open, \ |
692 | }; | 680 | }; |
693 | 681 | ||
694 | 682 | ||
diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h index 445ff21772e2..2f218f9a3fd3 100644 --- a/drivers/net/wireless/mwifiex/pcie.h +++ b/drivers/net/wireless/mwifiex/pcie.h | |||
@@ -48,15 +48,15 @@ | |||
48 | #define PCIE_HOST_INT_STATUS_MASK 0xC3C | 48 | #define PCIE_HOST_INT_STATUS_MASK 0xC3C |
49 | #define PCIE_SCRATCH_2_REG 0xC40 | 49 | #define PCIE_SCRATCH_2_REG 0xC40 |
50 | #define PCIE_SCRATCH_3_REG 0xC44 | 50 | #define PCIE_SCRATCH_3_REG 0xC44 |
51 | #define PCIE_SCRATCH_4_REG 0xCC0 | 51 | #define PCIE_SCRATCH_4_REG 0xCD0 |
52 | #define PCIE_SCRATCH_5_REG 0xCC4 | 52 | #define PCIE_SCRATCH_5_REG 0xCD4 |
53 | #define PCIE_SCRATCH_6_REG 0xCC8 | 53 | #define PCIE_SCRATCH_6_REG 0xCD8 |
54 | #define PCIE_SCRATCH_7_REG 0xCCC | 54 | #define PCIE_SCRATCH_7_REG 0xCDC |
55 | #define PCIE_SCRATCH_8_REG 0xCD0 | 55 | #define PCIE_SCRATCH_8_REG 0xCE0 |
56 | #define PCIE_SCRATCH_9_REG 0xCD4 | 56 | #define PCIE_SCRATCH_9_REG 0xCE4 |
57 | #define PCIE_SCRATCH_10_REG 0xCD8 | 57 | #define PCIE_SCRATCH_10_REG 0xCE8 |
58 | #define PCIE_SCRATCH_11_REG 0xCDC | 58 | #define PCIE_SCRATCH_11_REG 0xCEC |
59 | #define PCIE_SCRATCH_12_REG 0xCE0 | 59 | #define PCIE_SCRATCH_12_REG 0xCF0 |
60 | 60 | ||
61 | #define CPU_INTR_DNLD_RDY BIT(0) | 61 | #define CPU_INTR_DNLD_RDY BIT(0) |
62 | #define CPU_INTR_DOOR_BELL BIT(1) | 62 | #define CPU_INTR_DOOR_BELL BIT(1) |
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index dd6c64ac406e..88e3ad2d1db8 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -1336,6 +1336,10 @@ static void qbuf_scan(struct orinoco_private *priv, void *buf, | |||
1336 | unsigned long flags; | 1336 | unsigned long flags; |
1337 | 1337 | ||
1338 | sd = kmalloc(sizeof(*sd), GFP_ATOMIC); | 1338 | sd = kmalloc(sizeof(*sd), GFP_ATOMIC); |
1339 | if (!sd) { | ||
1340 | printk(KERN_ERR "%s: failed to alloc memory\n", __func__); | ||
1341 | return; | ||
1342 | } | ||
1339 | sd->buf = buf; | 1343 | sd->buf = buf; |
1340 | sd->len = len; | 1344 | sd->len = len; |
1341 | sd->type = type; | 1345 | sd->type = type; |
@@ -1353,6 +1357,10 @@ static void qabort_scan(struct orinoco_private *priv) | |||
1353 | unsigned long flags; | 1357 | unsigned long flags; |
1354 | 1358 | ||
1355 | sd = kmalloc(sizeof(*sd), GFP_ATOMIC); | 1359 | sd = kmalloc(sizeof(*sd), GFP_ATOMIC); |
1360 | if (!sd) { | ||
1361 | printk(KERN_ERR "%s: failed to alloc memory\n", __func__); | ||
1362 | return; | ||
1363 | } | ||
1356 | sd->len = -1; /* Abort */ | 1364 | sd->len = -1; /* Abort */ |
1357 | 1365 | ||
1358 | spin_lock_irqsave(&priv->scan_lock, flags); | 1366 | spin_lock_irqsave(&priv->scan_lock, flags); |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index cd490abced91..001735f7a661 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -163,7 +163,13 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, | |||
163 | 163 | ||
164 | /* Reschedule urb to read TX status again instantly */ | 164 | /* Reschedule urb to read TX status again instantly */ |
165 | return true; | 165 | return true; |
166 | } else if (rt2800usb_txstatus_pending(rt2x00dev)) { | 166 | } |
167 | |||
168 | /* Check if there is any entry that timedout waiting on TX status */ | ||
169 | if (rt2800usb_txstatus_timeout(rt2x00dev)) | ||
170 | queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); | ||
171 | |||
172 | if (rt2800usb_txstatus_pending(rt2x00dev)) { | ||
167 | /* Read register after 250 us */ | 173 | /* Read register after 250 us */ |
168 | hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000), | 174 | hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000), |
169 | HRTIMER_MODE_REL); | 175 | HRTIMER_MODE_REL); |
@@ -178,7 +184,7 @@ stop_reading: | |||
178 | * here again if status reading is needed. | 184 | * here again if status reading is needed. |
179 | */ | 185 | */ |
180 | if (rt2800usb_txstatus_pending(rt2x00dev) && | 186 | if (rt2800usb_txstatus_pending(rt2x00dev) && |
181 | test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) | 187 | !test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) |
182 | return true; | 188 | return true; |
183 | else | 189 | else |
184 | return false; | 190 | return false; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index fc9901e027c1..90cc5e772650 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -1062,11 +1062,6 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
1062 | 1062 | ||
1063 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); | 1063 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
1064 | 1064 | ||
1065 | /* | ||
1066 | * Register the extra components. | ||
1067 | */ | ||
1068 | rt2x00rfkill_register(rt2x00dev); | ||
1069 | |||
1070 | return 0; | 1065 | return 0; |
1071 | } | 1066 | } |
1072 | 1067 | ||
@@ -1210,6 +1205,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1210 | rt2x00link_register(rt2x00dev); | 1205 | rt2x00link_register(rt2x00dev); |
1211 | rt2x00leds_register(rt2x00dev); | 1206 | rt2x00leds_register(rt2x00dev); |
1212 | rt2x00debug_register(rt2x00dev); | 1207 | rt2x00debug_register(rt2x00dev); |
1208 | rt2x00rfkill_register(rt2x00dev); | ||
1213 | 1209 | ||
1214 | return 0; | 1210 | return 0; |
1215 | 1211 | ||
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 510023554e5f..e54488db0e10 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -838,7 +838,10 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw, | |||
838 | __le16 fc = hdr->frame_control; | 838 | __le16 fc = hdr->frame_control; |
839 | 839 | ||
840 | txrate = ieee80211_get_tx_rate(hw, info); | 840 | txrate = ieee80211_get_tx_rate(hw, info); |
841 | tcb_desc->hw_rate = txrate->hw_value; | 841 | if (txrate) |
842 | tcb_desc->hw_rate = txrate->hw_value; | ||
843 | else | ||
844 | tcb_desc->hw_rate = 0; | ||
842 | 845 | ||
843 | if (ieee80211_is_data(fc)) { | 846 | if (ieee80211_is_data(fc)) { |
844 | /* | 847 | /* |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 07dd38efe62a..cc15fdb36060 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -912,8 +912,13 @@ static void _rtl_pci_prepare_bcn_tasklet(struct ieee80211_hw *hw) | |||
912 | memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); | 912 | memset(&tcb_desc, 0, sizeof(struct rtl_tcb_desc)); |
913 | ring = &rtlpci->tx_ring[BEACON_QUEUE]; | 913 | ring = &rtlpci->tx_ring[BEACON_QUEUE]; |
914 | pskb = __skb_dequeue(&ring->queue); | 914 | pskb = __skb_dequeue(&ring->queue); |
915 | if (pskb) | 915 | if (pskb) { |
916 | struct rtl_tx_desc *entry = &ring->desc[ring->idx]; | ||
917 | pci_unmap_single(rtlpci->pdev, rtlpriv->cfg->ops->get_desc( | ||
918 | (u8 *) entry, true, HW_DESC_TXBUFF_ADDR), | ||
919 | pskb->len, PCI_DMA_TODEVICE); | ||
916 | kfree_skb(pskb); | 920 | kfree_skb(pskb); |
921 | } | ||
917 | 922 | ||
918 | /*NB: the beacon data buffer must be 32-bit aligned. */ | 923 | /*NB: the beacon data buffer must be 32-bit aligned. */ |
919 | pskb = ieee80211_beacon_get(hw, mac->vif); | 924 | pskb = ieee80211_beacon_get(hw, mac->vif); |
@@ -1936,6 +1941,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev) | |||
1936 | rtl_deinit_deferred_work(hw); | 1941 | rtl_deinit_deferred_work(hw); |
1937 | rtlpriv->intf_ops->adapter_stop(hw); | 1942 | rtlpriv->intf_ops->adapter_stop(hw); |
1938 | } | 1943 | } |
1944 | rtlpriv->cfg->ops->disable_interrupt(hw); | ||
1939 | 1945 | ||
1940 | /*deinit rfkill */ | 1946 | /*deinit rfkill */ |
1941 | rtl_deinit_rfkill(hw); | 1947 | rtl_deinit_rfkill(hw); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c index 1eec3a06d1f3..4c016241f340 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | |||
@@ -1893,7 +1893,7 @@ void rtl92c_phy_set_io(struct ieee80211_hw *hw) | |||
1893 | break; | 1893 | break; |
1894 | case IO_CMD_PAUSE_DM_BY_SCAN: | 1894 | case IO_CMD_PAUSE_DM_BY_SCAN: |
1895 | rtlphy->initgain_backup.xaagccore1 = dm_digtable.cur_igvalue; | 1895 | rtlphy->initgain_backup.xaagccore1 = dm_digtable.cur_igvalue; |
1896 | dm_digtable.cur_igvalue = 0x17; | 1896 | dm_digtable.cur_igvalue = 0x37; |
1897 | rtl92c_dm_write_dig(hw); | 1897 | rtl92c_dm_write_dig(hw); |
1898 | break; | 1898 | break; |
1899 | default: | 1899 | default: |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c index 34591eeb8376..28fc5fb8057b 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c | |||
@@ -3077,7 +3077,7 @@ static void rtl92d_phy_set_io(struct ieee80211_hw *hw) | |||
3077 | break; | 3077 | break; |
3078 | case IO_CMD_PAUSE_DM_BY_SCAN: | 3078 | case IO_CMD_PAUSE_DM_BY_SCAN: |
3079 | rtlphy->initgain_backup.xaagccore1 = de_digtable.cur_igvalue; | 3079 | rtlphy->initgain_backup.xaagccore1 = de_digtable.cur_igvalue; |
3080 | de_digtable.cur_igvalue = 0x17; | 3080 | de_digtable.cur_igvalue = 0x37; |
3081 | rtl92d_dm_write_dig(hw); | 3081 | rtl92d_dm_write_dig(hw); |
3082 | break; | 3082 | break; |
3083 | default: | 3083 | default: |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c index 4898c502974d..480862c07f92 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c | |||
@@ -91,7 +91,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
91 | u8 tid; | 91 | u8 tid; |
92 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 92 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
93 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | 93 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); |
94 | static int header_print; | ||
95 | 94 | ||
96 | rtlpriv->dm.dm_initialgain_enable = true; | 95 | rtlpriv->dm.dm_initialgain_enable = true; |
97 | rtlpriv->dm.dm_flag = 0; | 96 | rtlpriv->dm.dm_flag = 0; |
@@ -171,10 +170,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
171 | for (tid = 0; tid < 8; tid++) | 170 | for (tid = 0; tid < 8; tid++) |
172 | skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); | 171 | skb_queue_head_init(&rtlpriv->mac80211.skb_waitq[tid]); |
173 | 172 | ||
174 | /* Only load firmware for first MAC */ | ||
175 | if (header_print) | ||
176 | return 0; | ||
177 | |||
178 | /* for firmware buf */ | 173 | /* for firmware buf */ |
179 | rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); | 174 | rtlpriv->rtlhal.pfirmware = vzalloc(0x8000); |
180 | if (!rtlpriv->rtlhal.pfirmware) { | 175 | if (!rtlpriv->rtlhal.pfirmware) { |
@@ -186,7 +181,6 @@ static int rtl92d_init_sw_vars(struct ieee80211_hw *hw) | |||
186 | rtlpriv->max_fw_size = 0x8000; | 181 | rtlpriv->max_fw_size = 0x8000; |
187 | pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); | 182 | pr_info("Driver for Realtek RTL8192DE WLAN interface\n"); |
188 | pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); | 183 | pr_info("Loading firmware file %s\n", rtlpriv->cfg->fw_name); |
189 | header_print++; | ||
190 | 184 | ||
191 | /* request fw */ | 185 | /* request fw */ |
192 | err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, | 186 | err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name, |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 2e1e352864bb..d04dbda13f5a 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -124,46 +124,38 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request, | |||
124 | return status; | 124 | return status; |
125 | } | 125 | } |
126 | 126 | ||
127 | static u32 _usb_read_sync(struct usb_device *udev, u32 addr, u16 len) | 127 | static u32 _usb_read_sync(struct rtl_priv *rtlpriv, u32 addr, u16 len) |
128 | { | 128 | { |
129 | struct device *dev = rtlpriv->io.dev; | ||
130 | struct usb_device *udev = to_usb_device(dev); | ||
129 | u8 request; | 131 | u8 request; |
130 | u16 wvalue; | 132 | u16 wvalue; |
131 | u16 index; | 133 | u16 index; |
132 | u32 *data; | 134 | __le32 *data = &rtlpriv->usb_data[rtlpriv->usb_data_index]; |
133 | u32 ret; | ||
134 | 135 | ||
135 | data = kmalloc(sizeof(u32), GFP_KERNEL); | ||
136 | if (!data) | ||
137 | return -ENOMEM; | ||
138 | request = REALTEK_USB_VENQT_CMD_REQ; | 136 | request = REALTEK_USB_VENQT_CMD_REQ; |
139 | index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ | 137 | index = REALTEK_USB_VENQT_CMD_IDX; /* n/a */ |
140 | 138 | ||
141 | wvalue = (u16)addr; | 139 | wvalue = (u16)addr; |
142 | _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len); | 140 | _usbctrl_vendorreq_sync_read(udev, request, wvalue, index, data, len); |
143 | ret = le32_to_cpu(*data); | 141 | if (++rtlpriv->usb_data_index >= RTL_USB_MAX_RX_COUNT) |
144 | kfree(data); | 142 | rtlpriv->usb_data_index = 0; |
145 | return ret; | 143 | return le32_to_cpu(*data); |
146 | } | 144 | } |
147 | 145 | ||
148 | static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr) | 146 | static u8 _usb_read8_sync(struct rtl_priv *rtlpriv, u32 addr) |
149 | { | 147 | { |
150 | struct device *dev = rtlpriv->io.dev; | 148 | return (u8)_usb_read_sync(rtlpriv, addr, 1); |
151 | |||
152 | return (u8)_usb_read_sync(to_usb_device(dev), addr, 1); | ||
153 | } | 149 | } |
154 | 150 | ||
155 | static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr) | 151 | static u16 _usb_read16_sync(struct rtl_priv *rtlpriv, u32 addr) |
156 | { | 152 | { |
157 | struct device *dev = rtlpriv->io.dev; | 153 | return (u16)_usb_read_sync(rtlpriv, addr, 2); |
158 | |||
159 | return (u16)_usb_read_sync(to_usb_device(dev), addr, 2); | ||
160 | } | 154 | } |
161 | 155 | ||
162 | static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr) | 156 | static u32 _usb_read32_sync(struct rtl_priv *rtlpriv, u32 addr) |
163 | { | 157 | { |
164 | struct device *dev = rtlpriv->io.dev; | 158 | return _usb_read_sync(rtlpriv, addr, 4); |
165 | |||
166 | return _usb_read_sync(to_usb_device(dev), addr, 4); | ||
167 | } | 159 | } |
168 | 160 | ||
169 | static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val, | 161 | static void _usb_write_async(struct usb_device *udev, u32 addr, u32 val, |
@@ -955,6 +947,11 @@ int __devinit rtl_usb_probe(struct usb_interface *intf, | |||
955 | return -ENOMEM; | 947 | return -ENOMEM; |
956 | } | 948 | } |
957 | rtlpriv = hw->priv; | 949 | rtlpriv = hw->priv; |
950 | rtlpriv->usb_data = kzalloc(RTL_USB_MAX_RX_COUNT * sizeof(u32), | ||
951 | GFP_KERNEL); | ||
952 | if (!rtlpriv->usb_data) | ||
953 | return -ENOMEM; | ||
954 | rtlpriv->usb_data_index = 0; | ||
958 | init_completion(&rtlpriv->firmware_loading_complete); | 955 | init_completion(&rtlpriv->firmware_loading_complete); |
959 | SET_IEEE80211_DEV(hw, &intf->dev); | 956 | SET_IEEE80211_DEV(hw, &intf->dev); |
960 | udev = interface_to_usbdev(intf); | 957 | udev = interface_to_usbdev(intf); |
@@ -1025,6 +1022,7 @@ void rtl_usb_disconnect(struct usb_interface *intf) | |||
1025 | /* rtl_deinit_rfkill(hw); */ | 1022 | /* rtl_deinit_rfkill(hw); */ |
1026 | rtl_usb_deinit(hw); | 1023 | rtl_usb_deinit(hw); |
1027 | rtl_deinit_core(hw); | 1024 | rtl_deinit_core(hw); |
1025 | kfree(rtlpriv->usb_data); | ||
1028 | rtlpriv->cfg->ops->deinit_sw_leds(hw); | 1026 | rtlpriv->cfg->ops->deinit_sw_leds(hw); |
1029 | rtlpriv->cfg->ops->deinit_sw_vars(hw); | 1027 | rtlpriv->cfg->ops->deinit_sw_vars(hw); |
1030 | _rtl_usb_io_handler_release(hw); | 1028 | _rtl_usb_io_handler_release(hw); |
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h index b591614c3b9b..28ebc69218a3 100644 --- a/drivers/net/wireless/rtlwifi/wifi.h +++ b/drivers/net/wireless/rtlwifi/wifi.h | |||
@@ -67,7 +67,7 @@ | |||
67 | #define QOS_QUEUE_NUM 4 | 67 | #define QOS_QUEUE_NUM 4 |
68 | #define RTL_MAC80211_NUM_QUEUE 5 | 68 | #define RTL_MAC80211_NUM_QUEUE 5 |
69 | #define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 | 69 | #define REALTEK_USB_VENQT_MAX_BUF_SIZE 254 |
70 | 70 | #define RTL_USB_MAX_RX_COUNT 100 | |
71 | #define QBSS_LOAD_SIZE 5 | 71 | #define QBSS_LOAD_SIZE 5 |
72 | #define MAX_WMMELE_LENGTH 64 | 72 | #define MAX_WMMELE_LENGTH 64 |
73 | 73 | ||
@@ -1629,6 +1629,10 @@ struct rtl_priv { | |||
1629 | interface or hardware */ | 1629 | interface or hardware */ |
1630 | unsigned long status; | 1630 | unsigned long status; |
1631 | 1631 | ||
1632 | /* data buffer pointer for USB reads */ | ||
1633 | __le32 *usb_data; | ||
1634 | int usb_data_index; | ||
1635 | |||
1632 | /*This must be the last item so | 1636 | /*This must be the last item so |
1633 | that it points to the data allocated | 1637 | that it points to the data allocated |
1634 | beyond this structure like: | 1638 | beyond this structure like: |
diff --git a/drivers/net/wireless/wl1251/debugfs.c b/drivers/net/wireless/wl1251/debugfs.c index 6c274007d200..448da1f8c22f 100644 --- a/drivers/net/wireless/wl1251/debugfs.c +++ b/drivers/net/wireless/wl1251/debugfs.c | |||
@@ -47,7 +47,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
47 | \ | 47 | \ |
48 | static const struct file_operations name## _ops = { \ | 48 | static const struct file_operations name## _ops = { \ |
49 | .read = name## _read, \ | 49 | .read = name## _read, \ |
50 | .open = wl1251_open_file_generic, \ | 50 | .open = simple_open, \ |
51 | .llseek = generic_file_llseek, \ | 51 | .llseek = generic_file_llseek, \ |
52 | }; | 52 | }; |
53 | 53 | ||
@@ -84,7 +84,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \ | |||
84 | \ | 84 | \ |
85 | static const struct file_operations sub## _ ##name## _ops = { \ | 85 | static const struct file_operations sub## _ ##name## _ops = { \ |
86 | .read = sub## _ ##name## _read, \ | 86 | .read = sub## _ ##name## _read, \ |
87 | .open = wl1251_open_file_generic, \ | 87 | .open = simple_open, \ |
88 | .llseek = generic_file_llseek, \ | 88 | .llseek = generic_file_llseek, \ |
89 | }; | 89 | }; |
90 | 90 | ||
@@ -117,12 +117,6 @@ out: | |||
117 | mutex_unlock(&wl->mutex); | 117 | mutex_unlock(&wl->mutex); |
118 | } | 118 | } |
119 | 119 | ||
120 | static int wl1251_open_file_generic(struct inode *inode, struct file *file) | ||
121 | { | ||
122 | file->private_data = inode->i_private; | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); | 120 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, 20, "%u"); |
127 | 121 | ||
128 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); | 122 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, 20, "%u"); |
@@ -235,7 +229,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, | |||
235 | 229 | ||
236 | static const struct file_operations tx_queue_len_ops = { | 230 | static const struct file_operations tx_queue_len_ops = { |
237 | .read = tx_queue_len_read, | 231 | .read = tx_queue_len_read, |
238 | .open = wl1251_open_file_generic, | 232 | .open = simple_open, |
239 | .llseek = generic_file_llseek, | 233 | .llseek = generic_file_llseek, |
240 | }; | 234 | }; |
241 | 235 | ||
@@ -257,7 +251,7 @@ static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf, | |||
257 | 251 | ||
258 | static const struct file_operations tx_queue_status_ops = { | 252 | static const struct file_operations tx_queue_status_ops = { |
259 | .read = tx_queue_status_read, | 253 | .read = tx_queue_status_read, |
260 | .open = wl1251_open_file_generic, | 254 | .open = simple_open, |
261 | .llseek = generic_file_llseek, | 255 | .llseek = generic_file_llseek, |
262 | }; | 256 | }; |
263 | 257 | ||
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c index 41302c7b1ad0..d1afb8e3b2ef 100644 --- a/drivers/net/wireless/wl1251/main.c +++ b/drivers/net/wireless/wl1251/main.c | |||
@@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) | |||
479 | cancel_work_sync(&wl->irq_work); | 479 | cancel_work_sync(&wl->irq_work); |
480 | cancel_work_sync(&wl->tx_work); | 480 | cancel_work_sync(&wl->tx_work); |
481 | cancel_work_sync(&wl->filter_work); | 481 | cancel_work_sync(&wl->filter_work); |
482 | cancel_delayed_work_sync(&wl->elp_work); | ||
482 | 483 | ||
483 | mutex_lock(&wl->mutex); | 484 | mutex_lock(&wl->mutex); |
484 | 485 | ||
diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c index f78694295c39..1b851f650e07 100644 --- a/drivers/net/wireless/wl1251/sdio.c +++ b/drivers/net/wireless/wl1251/sdio.c | |||
@@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func) | |||
315 | 315 | ||
316 | if (wl->irq) | 316 | if (wl->irq) |
317 | free_irq(wl->irq, wl); | 317 | free_irq(wl->irq, wl); |
318 | kfree(wl_sdio); | ||
319 | wl1251_free_hw(wl); | 318 | wl1251_free_hw(wl); |
319 | kfree(wl_sdio); | ||
320 | 320 | ||
321 | sdio_claim_host(func); | 321 | sdio_claim_host(func); |
322 | sdio_release_irq(func); | 322 | sdio_release_irq(func); |
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index e1cf72765965..564d49575c94 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -63,7 +63,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
63 | \ | 63 | \ |
64 | static const struct file_operations name## _ops = { \ | 64 | static const struct file_operations name## _ops = { \ |
65 | .read = name## _read, \ | 65 | .read = name## _read, \ |
66 | .open = wl1271_open_file_generic, \ | 66 | .open = simple_open, \ |
67 | .llseek = generic_file_llseek, \ | 67 | .llseek = generic_file_llseek, \ |
68 | }; | 68 | }; |
69 | 69 | ||
@@ -96,7 +96,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \ | |||
96 | \ | 96 | \ |
97 | static const struct file_operations sub## _ ##name## _ops = { \ | 97 | static const struct file_operations sub## _ ##name## _ops = { \ |
98 | .read = sub## _ ##name## _read, \ | 98 | .read = sub## _ ##name## _read, \ |
99 | .open = wl1271_open_file_generic, \ | 99 | .open = simple_open, \ |
100 | .llseek = generic_file_llseek, \ | 100 | .llseek = generic_file_llseek, \ |
101 | }; | 101 | }; |
102 | 102 | ||
@@ -126,12 +126,6 @@ out: | |||
126 | mutex_unlock(&wl->mutex); | 126 | mutex_unlock(&wl->mutex); |
127 | } | 127 | } |
128 | 128 | ||
129 | static int wl1271_open_file_generic(struct inode *inode, struct file *file) | ||
130 | { | ||
131 | file->private_data = inode->i_private; | ||
132 | return 0; | ||
133 | } | ||
134 | |||
135 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u"); | 129 | DEBUGFS_FWSTATS_FILE(tx, internal_desc_overflow, "%u"); |
136 | 130 | ||
137 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u"); | 131 | DEBUGFS_FWSTATS_FILE(rx, out_of_mem, "%u"); |
@@ -243,7 +237,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, | |||
243 | 237 | ||
244 | static const struct file_operations tx_queue_len_ops = { | 238 | static const struct file_operations tx_queue_len_ops = { |
245 | .read = tx_queue_len_read, | 239 | .read = tx_queue_len_read, |
246 | .open = wl1271_open_file_generic, | 240 | .open = simple_open, |
247 | .llseek = default_llseek, | 241 | .llseek = default_llseek, |
248 | }; | 242 | }; |
249 | 243 | ||
@@ -289,7 +283,7 @@ static ssize_t gpio_power_write(struct file *file, | |||
289 | static const struct file_operations gpio_power_ops = { | 283 | static const struct file_operations gpio_power_ops = { |
290 | .read = gpio_power_read, | 284 | .read = gpio_power_read, |
291 | .write = gpio_power_write, | 285 | .write = gpio_power_write, |
292 | .open = wl1271_open_file_generic, | 286 | .open = simple_open, |
293 | .llseek = default_llseek, | 287 | .llseek = default_llseek, |
294 | }; | 288 | }; |
295 | 289 | ||
@@ -308,7 +302,7 @@ static ssize_t start_recovery_write(struct file *file, | |||
308 | 302 | ||
309 | static const struct file_operations start_recovery_ops = { | 303 | static const struct file_operations start_recovery_ops = { |
310 | .write = start_recovery_write, | 304 | .write = start_recovery_write, |
311 | .open = wl1271_open_file_generic, | 305 | .open = simple_open, |
312 | .llseek = default_llseek, | 306 | .llseek = default_llseek, |
313 | }; | 307 | }; |
314 | 308 | ||
@@ -372,7 +366,7 @@ out: | |||
372 | static const struct file_operations dynamic_ps_timeout_ops = { | 366 | static const struct file_operations dynamic_ps_timeout_ops = { |
373 | .read = dynamic_ps_timeout_read, | 367 | .read = dynamic_ps_timeout_read, |
374 | .write = dynamic_ps_timeout_write, | 368 | .write = dynamic_ps_timeout_write, |
375 | .open = wl1271_open_file_generic, | 369 | .open = simple_open, |
376 | .llseek = default_llseek, | 370 | .llseek = default_llseek, |
377 | }; | 371 | }; |
378 | 372 | ||
@@ -441,7 +435,7 @@ out: | |||
441 | static const struct file_operations forced_ps_ops = { | 435 | static const struct file_operations forced_ps_ops = { |
442 | .read = forced_ps_read, | 436 | .read = forced_ps_read, |
443 | .write = forced_ps_write, | 437 | .write = forced_ps_write, |
444 | .open = wl1271_open_file_generic, | 438 | .open = simple_open, |
445 | .llseek = default_llseek, | 439 | .llseek = default_llseek, |
446 | }; | 440 | }; |
447 | 441 | ||
@@ -483,7 +477,7 @@ static ssize_t split_scan_timeout_write(struct file *file, | |||
483 | static const struct file_operations split_scan_timeout_ops = { | 477 | static const struct file_operations split_scan_timeout_ops = { |
484 | .read = split_scan_timeout_read, | 478 | .read = split_scan_timeout_read, |
485 | .write = split_scan_timeout_write, | 479 | .write = split_scan_timeout_write, |
486 | .open = wl1271_open_file_generic, | 480 | .open = simple_open, |
487 | .llseek = default_llseek, | 481 | .llseek = default_llseek, |
488 | }; | 482 | }; |
489 | 483 | ||
@@ -566,7 +560,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, | |||
566 | 560 | ||
567 | static const struct file_operations driver_state_ops = { | 561 | static const struct file_operations driver_state_ops = { |
568 | .read = driver_state_read, | 562 | .read = driver_state_read, |
569 | .open = wl1271_open_file_generic, | 563 | .open = simple_open, |
570 | .llseek = default_llseek, | 564 | .llseek = default_llseek, |
571 | }; | 565 | }; |
572 | 566 | ||
@@ -675,7 +669,7 @@ static ssize_t vifs_state_read(struct file *file, char __user *user_buf, | |||
675 | 669 | ||
676 | static const struct file_operations vifs_state_ops = { | 670 | static const struct file_operations vifs_state_ops = { |
677 | .read = vifs_state_read, | 671 | .read = vifs_state_read, |
678 | .open = wl1271_open_file_generic, | 672 | .open = simple_open, |
679 | .llseek = default_llseek, | 673 | .llseek = default_llseek, |
680 | }; | 674 | }; |
681 | 675 | ||
@@ -733,7 +727,7 @@ static ssize_t dtim_interval_write(struct file *file, | |||
733 | static const struct file_operations dtim_interval_ops = { | 727 | static const struct file_operations dtim_interval_ops = { |
734 | .read = dtim_interval_read, | 728 | .read = dtim_interval_read, |
735 | .write = dtim_interval_write, | 729 | .write = dtim_interval_write, |
736 | .open = wl1271_open_file_generic, | 730 | .open = simple_open, |
737 | .llseek = default_llseek, | 731 | .llseek = default_llseek, |
738 | }; | 732 | }; |
739 | 733 | ||
@@ -791,7 +785,7 @@ static ssize_t suspend_dtim_interval_write(struct file *file, | |||
791 | static const struct file_operations suspend_dtim_interval_ops = { | 785 | static const struct file_operations suspend_dtim_interval_ops = { |
792 | .read = suspend_dtim_interval_read, | 786 | .read = suspend_dtim_interval_read, |
793 | .write = suspend_dtim_interval_write, | 787 | .write = suspend_dtim_interval_write, |
794 | .open = wl1271_open_file_generic, | 788 | .open = simple_open, |
795 | .llseek = default_llseek, | 789 | .llseek = default_llseek, |
796 | }; | 790 | }; |
797 | 791 | ||
@@ -849,7 +843,7 @@ static ssize_t beacon_interval_write(struct file *file, | |||
849 | static const struct file_operations beacon_interval_ops = { | 843 | static const struct file_operations beacon_interval_ops = { |
850 | .read = beacon_interval_read, | 844 | .read = beacon_interval_read, |
851 | .write = beacon_interval_write, | 845 | .write = beacon_interval_write, |
852 | .open = wl1271_open_file_generic, | 846 | .open = simple_open, |
853 | .llseek = default_llseek, | 847 | .llseek = default_llseek, |
854 | }; | 848 | }; |
855 | 849 | ||
@@ -904,7 +898,7 @@ static ssize_t rx_streaming_interval_read(struct file *file, | |||
904 | static const struct file_operations rx_streaming_interval_ops = { | 898 | static const struct file_operations rx_streaming_interval_ops = { |
905 | .read = rx_streaming_interval_read, | 899 | .read = rx_streaming_interval_read, |
906 | .write = rx_streaming_interval_write, | 900 | .write = rx_streaming_interval_write, |
907 | .open = wl1271_open_file_generic, | 901 | .open = simple_open, |
908 | .llseek = default_llseek, | 902 | .llseek = default_llseek, |
909 | }; | 903 | }; |
910 | 904 | ||
@@ -959,7 +953,7 @@ static ssize_t rx_streaming_always_read(struct file *file, | |||
959 | static const struct file_operations rx_streaming_always_ops = { | 953 | static const struct file_operations rx_streaming_always_ops = { |
960 | .read = rx_streaming_always_read, | 954 | .read = rx_streaming_always_read, |
961 | .write = rx_streaming_always_write, | 955 | .write = rx_streaming_always_write, |
962 | .open = wl1271_open_file_generic, | 956 | .open = simple_open, |
963 | .llseek = default_llseek, | 957 | .llseek = default_llseek, |
964 | }; | 958 | }; |
965 | 959 | ||
@@ -1003,7 +997,7 @@ out: | |||
1003 | 997 | ||
1004 | static const struct file_operations beacon_filtering_ops = { | 998 | static const struct file_operations beacon_filtering_ops = { |
1005 | .write = beacon_filtering_write, | 999 | .write = beacon_filtering_write, |
1006 | .open = wl1271_open_file_generic, | 1000 | .open = simple_open, |
1007 | .llseek = default_llseek, | 1001 | .llseek = default_llseek, |
1008 | }; | 1002 | }; |
1009 | 1003 | ||
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 663b32c2e931..0ebbb1906c30 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1965,7 +1965,7 @@ static int __init netif_init(void) | |||
1965 | if (xen_initial_domain()) | 1965 | if (xen_initial_domain()) |
1966 | return 0; | 1966 | return 0; |
1967 | 1967 | ||
1968 | if (!xen_platform_pci_unplug) | 1968 | if (xen_hvm_domain() && !xen_platform_pci_unplug) |
1969 | return -ENODEV; | 1969 | return -ENODEV; |
1970 | 1970 | ||
1971 | printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n"); | 1971 | printk(KERN_INFO "Initialising Xen virtual ethernet driver.\n"); |
diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c index bba81216b4db..bf984b6dc477 100644 --- a/drivers/of/gpio.c +++ b/drivers/of/gpio.c | |||
@@ -140,7 +140,7 @@ int of_gpio_simple_xlate(struct gpio_chip *gc, | |||
140 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) | 140 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) |
141 | return -EINVAL; | 141 | return -EINVAL; |
142 | 142 | ||
143 | if (gpiospec->args[0] > gc->ngpio) | 143 | if (gpiospec->args[0] >= gc->ngpio) |
144 | return -EINVAL; | 144 | return -EINVAL; |
145 | 145 | ||
146 | if (flags) | 146 | if (flags) |
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index ee8fd037bb53..849357c1045c 100644 --- a/drivers/oprofile/oprofilefs.c +++ b/drivers/oprofile/oprofilefs.c | |||
@@ -117,25 +117,17 @@ static ssize_t ulong_write_file(struct file *file, char const __user *buf, size_ | |||
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | static int default_open(struct inode *inode, struct file *filp) | ||
121 | { | ||
122 | if (inode->i_private) | ||
123 | filp->private_data = inode->i_private; | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | |||
128 | static const struct file_operations ulong_fops = { | 120 | static const struct file_operations ulong_fops = { |
129 | .read = ulong_read_file, | 121 | .read = ulong_read_file, |
130 | .write = ulong_write_file, | 122 | .write = ulong_write_file, |
131 | .open = default_open, | 123 | .open = simple_open, |
132 | .llseek = default_llseek, | 124 | .llseek = default_llseek, |
133 | }; | 125 | }; |
134 | 126 | ||
135 | 127 | ||
136 | static const struct file_operations ulong_ro_fops = { | 128 | static const struct file_operations ulong_ro_fops = { |
137 | .read = ulong_read_file, | 129 | .read = ulong_read_file, |
138 | .open = default_open, | 130 | .open = simple_open, |
139 | .llseek = default_llseek, | 131 | .llseek = default_llseek, |
140 | }; | 132 | }; |
141 | 133 | ||
@@ -187,7 +179,7 @@ static ssize_t atomic_read_file(struct file *file, char __user *buf, size_t coun | |||
187 | 179 | ||
188 | static const struct file_operations atomic_ro_fops = { | 180 | static const struct file_operations atomic_ro_fops = { |
189 | .read = atomic_read_file, | 181 | .read = atomic_read_file, |
190 | .open = default_open, | 182 | .open = simple_open, |
191 | .llseek = default_llseek, | 183 | .llseek = default_llseek, |
192 | }; | 184 | }; |
193 | 185 | ||
diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 083a49fee56a..165274c064bc 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile | |||
@@ -42,6 +42,7 @@ obj-$(CONFIG_UNICORE32) += setup-bus.o setup-irq.o | |||
42 | obj-$(CONFIG_PARISC) += setup-bus.o | 42 | obj-$(CONFIG_PARISC) += setup-bus.o |
43 | obj-$(CONFIG_SUPERH) += setup-bus.o setup-irq.o | 43 | obj-$(CONFIG_SUPERH) += setup-bus.o setup-irq.o |
44 | obj-$(CONFIG_PPC) += setup-bus.o | 44 | obj-$(CONFIG_PPC) += setup-bus.o |
45 | obj-$(CONFIG_FRV) += setup-bus.o | ||
45 | obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o | 46 | obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o |
46 | obj-$(CONFIG_X86_VISWS) += setup-irq.o | 47 | obj-$(CONFIG_X86_VISWS) += setup-irq.o |
47 | obj-$(CONFIG_MN10300) += setup-bus.o | 48 | obj-$(CONFIG_MN10300) += setup-bus.o |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 0f150f271c2a..1929c0c63b75 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -200,7 +200,7 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev) | |||
200 | return PCI_D1; | 200 | return PCI_D1; |
201 | case ACPI_STATE_D2: | 201 | case ACPI_STATE_D2: |
202 | return PCI_D2; | 202 | return PCI_D2; |
203 | case ACPI_STATE_D3: | 203 | case ACPI_STATE_D3_HOT: |
204 | return PCI_D3hot; | 204 | return PCI_D3hot; |
205 | case ACPI_STATE_D3_COLD: | 205 | case ACPI_STATE_D3_COLD: |
206 | return PCI_D3cold; | 206 | return PCI_D3cold; |
@@ -223,7 +223,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
223 | [PCI_D0] = ACPI_STATE_D0, | 223 | [PCI_D0] = ACPI_STATE_D0, |
224 | [PCI_D1] = ACPI_STATE_D1, | 224 | [PCI_D1] = ACPI_STATE_D1, |
225 | [PCI_D2] = ACPI_STATE_D2, | 225 | [PCI_D2] = ACPI_STATE_D2, |
226 | [PCI_D3hot] = ACPI_STATE_D3, | 226 | [PCI_D3hot] = ACPI_STATE_D3_HOT, |
227 | [PCI_D3cold] = ACPI_STATE_D3 | 227 | [PCI_D3cold] = ACPI_STATE_D3 |
228 | }; | 228 | }; |
229 | int error = -EINVAL; | 229 | int error = -EINVAL; |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 815674415267..111569ccab43 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -967,16 +967,59 @@ pci_save_state(struct pci_dev *dev) | |||
967 | return 0; | 967 | return 0; |
968 | } | 968 | } |
969 | 969 | ||
970 | static void pci_restore_config_dword(struct pci_dev *pdev, int offset, | ||
971 | u32 saved_val, int retry) | ||
972 | { | ||
973 | u32 val; | ||
974 | |||
975 | pci_read_config_dword(pdev, offset, &val); | ||
976 | if (val == saved_val) | ||
977 | return; | ||
978 | |||
979 | for (;;) { | ||
980 | dev_dbg(&pdev->dev, "restoring config space at offset " | ||
981 | "%#x (was %#x, writing %#x)\n", offset, val, saved_val); | ||
982 | pci_write_config_dword(pdev, offset, saved_val); | ||
983 | if (retry-- <= 0) | ||
984 | return; | ||
985 | |||
986 | pci_read_config_dword(pdev, offset, &val); | ||
987 | if (val == saved_val) | ||
988 | return; | ||
989 | |||
990 | mdelay(1); | ||
991 | } | ||
992 | } | ||
993 | |||
994 | static void pci_restore_config_space_range(struct pci_dev *pdev, | ||
995 | int start, int end, int retry) | ||
996 | { | ||
997 | int index; | ||
998 | |||
999 | for (index = end; index >= start; index--) | ||
1000 | pci_restore_config_dword(pdev, 4 * index, | ||
1001 | pdev->saved_config_space[index], | ||
1002 | retry); | ||
1003 | } | ||
1004 | |||
1005 | static void pci_restore_config_space(struct pci_dev *pdev) | ||
1006 | { | ||
1007 | if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) { | ||
1008 | pci_restore_config_space_range(pdev, 10, 15, 0); | ||
1009 | /* Restore BARs before the command register. */ | ||
1010 | pci_restore_config_space_range(pdev, 4, 9, 10); | ||
1011 | pci_restore_config_space_range(pdev, 0, 3, 0); | ||
1012 | } else { | ||
1013 | pci_restore_config_space_range(pdev, 0, 15, 0); | ||
1014 | } | ||
1015 | } | ||
1016 | |||
970 | /** | 1017 | /** |
971 | * pci_restore_state - Restore the saved state of a PCI device | 1018 | * pci_restore_state - Restore the saved state of a PCI device |
972 | * @dev: - PCI device that we're dealing with | 1019 | * @dev: - PCI device that we're dealing with |
973 | */ | 1020 | */ |
974 | void pci_restore_state(struct pci_dev *dev) | 1021 | void pci_restore_state(struct pci_dev *dev) |
975 | { | 1022 | { |
976 | int i; | ||
977 | u32 val; | ||
978 | int tries; | ||
979 | |||
980 | if (!dev->state_saved) | 1023 | if (!dev->state_saved) |
981 | return; | 1024 | return; |
982 | 1025 | ||
@@ -984,24 +1027,8 @@ void pci_restore_state(struct pci_dev *dev) | |||
984 | pci_restore_pcie_state(dev); | 1027 | pci_restore_pcie_state(dev); |
985 | pci_restore_ats_state(dev); | 1028 | pci_restore_ats_state(dev); |
986 | 1029 | ||
987 | /* | 1030 | pci_restore_config_space(dev); |
988 | * The Base Address register should be programmed before the command | 1031 | |
989 | * register(s) | ||
990 | */ | ||
991 | for (i = 15; i >= 0; i--) { | ||
992 | pci_read_config_dword(dev, i * 4, &val); | ||
993 | tries = 10; | ||
994 | while (tries && val != dev->saved_config_space[i]) { | ||
995 | dev_dbg(&dev->dev, "restoring config " | ||
996 | "space at offset %#x (was %#x, writing %#x)\n", | ||
997 | i, val, (int)dev->saved_config_space[i]); | ||
998 | pci_write_config_dword(dev,i * 4, | ||
999 | dev->saved_config_space[i]); | ||
1000 | pci_read_config_dword(dev, i * 4, &val); | ||
1001 | mdelay(10); | ||
1002 | tries--; | ||
1003 | } | ||
1004 | } | ||
1005 | pci_restore_pcix_state(dev); | 1032 | pci_restore_pcix_state(dev); |
1006 | pci_restore_msi_state(dev); | 1033 | pci_restore_msi_state(dev); |
1007 | pci_restore_iov_state(dev); | 1034 | pci_restore_iov_state(dev); |
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index fd00ff02ab4d..d6cc62cb4cf7 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -290,6 +290,7 @@ static int pci_frontend_enable_msix(struct pci_dev *dev, | |||
290 | } else { | 290 | } else { |
291 | printk(KERN_DEBUG "enable msix get value %x\n", | 291 | printk(KERN_DEBUG "enable msix get value %x\n", |
292 | op.value); | 292 | op.value); |
293 | err = op.value; | ||
293 | } | 294 | } |
294 | } else { | 295 | } else { |
295 | dev_err(&dev->dev, "enable msix get err %x\n", err); | 296 | dev_err(&dev->dev, "enable msix get err %x\n", err); |
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index ec3b8cc188af..df6296c5f47b 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c | |||
@@ -908,10 +908,6 @@ static int pinctrl_groups_show(struct seq_file *s, void *what) | |||
908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | 908 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; |
909 | unsigned selector = 0; | 909 | unsigned selector = 0; |
910 | 910 | ||
911 | /* No grouping */ | ||
912 | if (!ops) | ||
913 | return 0; | ||
914 | |||
915 | mutex_lock(&pinctrl_mutex); | 911 | mutex_lock(&pinctrl_mutex); |
916 | 912 | ||
917 | seq_puts(s, "registered pin groups:\n"); | 913 | seq_puts(s, "registered pin groups:\n"); |
@@ -1225,6 +1221,19 @@ static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev) | |||
1225 | 1221 | ||
1226 | #endif | 1222 | #endif |
1227 | 1223 | ||
1224 | static int pinctrl_check_ops(struct pinctrl_dev *pctldev) | ||
1225 | { | ||
1226 | const struct pinctrl_ops *ops = pctldev->desc->pctlops; | ||
1227 | |||
1228 | if (!ops || | ||
1229 | !ops->list_groups || | ||
1230 | !ops->get_group_name || | ||
1231 | !ops->get_group_pins) | ||
1232 | return -EINVAL; | ||
1233 | |||
1234 | return 0; | ||
1235 | } | ||
1236 | |||
1228 | /** | 1237 | /** |
1229 | * pinctrl_register() - register a pin controller device | 1238 | * pinctrl_register() - register a pin controller device |
1230 | * @pctldesc: descriptor for this pin controller | 1239 | * @pctldesc: descriptor for this pin controller |
@@ -1256,6 +1265,14 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc, | |||
1256 | INIT_LIST_HEAD(&pctldev->gpio_ranges); | 1265 | INIT_LIST_HEAD(&pctldev->gpio_ranges); |
1257 | pctldev->dev = dev; | 1266 | pctldev->dev = dev; |
1258 | 1267 | ||
1268 | /* check core ops for sanity */ | ||
1269 | ret = pinctrl_check_ops(pctldev); | ||
1270 | if (ret) { | ||
1271 | pr_err("%s pinctrl ops lacks necessary functions\n", | ||
1272 | pctldesc->name); | ||
1273 | goto out_err; | ||
1274 | } | ||
1275 | |||
1259 | /* If we're implementing pinmuxing, check the ops for sanity */ | 1276 | /* If we're implementing pinmuxing, check the ops for sanity */ |
1260 | if (pctldesc->pmxops) { | 1277 | if (pctldesc->pmxops) { |
1261 | ret = pinmux_check_ops(pctldev); | 1278 | ret = pinmux_check_ops(pctldev); |
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c index bc8384c6f3eb..639db4d0aa76 100644 --- a/drivers/platform/x86/acerhdf.c +++ b/drivers/platform/x86/acerhdf.c | |||
@@ -50,7 +50,7 @@ | |||
50 | */ | 50 | */ |
51 | #undef START_IN_KERNEL_MODE | 51 | #undef START_IN_KERNEL_MODE |
52 | 52 | ||
53 | #define DRV_VER "0.5.24" | 53 | #define DRV_VER "0.5.26" |
54 | 54 | ||
55 | /* | 55 | /* |
56 | * According to the Atom N270 datasheet, | 56 | * According to the Atom N270 datasheet, |
@@ -83,8 +83,8 @@ static int kernelmode; | |||
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | static unsigned int interval = 10; | 85 | static unsigned int interval = 10; |
86 | static unsigned int fanon = 63000; | 86 | static unsigned int fanon = 60000; |
87 | static unsigned int fanoff = 58000; | 87 | static unsigned int fanoff = 53000; |
88 | static unsigned int verbose; | 88 | static unsigned int verbose; |
89 | static unsigned int fanstate = ACERHDF_FAN_AUTO; | 89 | static unsigned int fanstate = ACERHDF_FAN_AUTO; |
90 | static char force_bios[16]; | 90 | static char force_bios[16]; |
@@ -150,6 +150,8 @@ static const struct bios_settings_t bios_tbl[] = { | |||
150 | {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, | 150 | {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} }, |
151 | {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, | 151 | {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} }, |
152 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, | 152 | {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, |
153 | /* LT1005u */ | ||
154 | {"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} }, | ||
153 | /* Acer 1410 */ | 155 | /* Acer 1410 */ |
154 | {"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 156 | {"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
155 | {"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, | 157 | {"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, |
@@ -161,6 +163,7 @@ static const struct bios_settings_t bios_tbl[] = { | |||
161 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, | 163 | {"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, |
162 | {"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, | 164 | {"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, |
163 | {"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 165 | {"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
166 | {"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | ||
164 | /* Acer 1810xx */ | 167 | /* Acer 1810xx */ |
165 | {"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 168 | {"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
166 | {"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 169 | {"Acer", "Aspire 1810T", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
@@ -183,29 +186,44 @@ static const struct bios_settings_t bios_tbl[] = { | |||
183 | {"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 186 | {"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
184 | {"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, | 187 | {"Acer", "Aspire 1810T", "v1.3310", 0x55, 0x58, {0x9e, 0x00} }, |
185 | {"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | 188 | {"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, |
189 | {"Acer", "Aspire 1810T", "v1.3314", 0x55, 0x58, {0x9e, 0x00} }, | ||
186 | /* Acer 531 */ | 190 | /* Acer 531 */ |
191 | {"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} }, | ||
187 | {"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} }, | 192 | {"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} }, |
193 | {"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} }, | ||
194 | /* Acer 751 */ | ||
195 | {"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} }, | ||
196 | /* Acer 1825 */ | ||
197 | {"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} }, | ||
198 | {"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} }, | ||
199 | /* Acer TravelMate 7730 */ | ||
200 | {"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} }, | ||
188 | /* Gateway */ | 201 | /* Gateway */ |
189 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, | 202 | {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} }, |
190 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, | 203 | {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} }, |
191 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} }, | 204 | {"Gateway", "LT31", "v1.3103", 0x55, 0x58, {0x9e, 0x00} }, |
192 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | 205 | {"Gateway", "LT31", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, |
193 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | 206 | {"Gateway", "LT31", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, |
207 | {"Gateway", "LT31", "v1.3303t", 0x55, 0x58, {0x9e, 0x00} }, | ||
194 | /* Packard Bell */ | 208 | /* Packard Bell */ |
195 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, | 209 | {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} }, |
196 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, | 210 | {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, |
197 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, | 211 | {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} }, |
198 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, | 212 | {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} }, |
199 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, | 213 | {"Packard Bell", "ENBFT", "V1.3118", 0x55, 0x58, {0x9e, 0x00} }, |
200 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} }, | 214 | {"Packard Bell", "ENBFT", "V1.3127", 0x55, 0x58, {0x9e, 0x00} }, |
201 | {"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, | 215 | {"Packard Bell", "DOTMU", "v1.3303", 0x55, 0x58, {0x9e, 0x00} }, |
202 | {"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, | 216 | {"Packard Bell", "DOTMU", "v0.3120", 0x55, 0x58, {0x9e, 0x00} }, |
203 | {"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} }, | 217 | {"Packard Bell", "DOTMU", "v0.3108", 0x55, 0x58, {0x9e, 0x00} }, |
204 | {"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} }, | 218 | {"Packard Bell", "DOTMU", "v0.3113", 0x55, 0x58, {0x9e, 0x00} }, |
205 | {"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} }, | 219 | {"Packard Bell", "DOTMU", "v0.3115", 0x55, 0x58, {0x9e, 0x00} }, |
206 | {"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} }, | 220 | {"Packard Bell", "DOTMU", "v0.3117", 0x55, 0x58, {0x9e, 0x00} }, |
207 | {"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | 221 | {"Packard Bell", "DOTMU", "v0.3119", 0x55, 0x58, {0x9e, 0x00} }, |
208 | {"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | 222 | {"Packard Bell", "DOTMU", "v1.3204", 0x55, 0x58, {0x9e, 0x00} }, |
223 | {"Packard Bell", "DOTMA", "v1.3201", 0x55, 0x58, {0x9e, 0x00} }, | ||
224 | {"Packard Bell", "DOTMA", "v1.3302", 0x55, 0x58, {0x9e, 0x00} }, | ||
225 | {"Packard Bell", "DOTMA", "v1.3303t", 0x55, 0x58, {0x9e, 0x00} }, | ||
226 | {"Packard Bell", "DOTVR46", "v1.3308", 0x55, 0x58, {0x9e, 0x00} }, | ||
209 | /* pewpew-terminator */ | 227 | /* pewpew-terminator */ |
210 | {"", "", "", 0, 0, {0, 0} } | 228 | {"", "", "", 0, 0, {0, 0} } |
211 | }; | 229 | }; |
@@ -701,15 +719,20 @@ MODULE_LICENSE("GPL"); | |||
701 | MODULE_AUTHOR("Peter Feuerer"); | 719 | MODULE_AUTHOR("Peter Feuerer"); |
702 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); | 720 | MODULE_DESCRIPTION("Aspire One temperature and fan driver"); |
703 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); | 721 | MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:"); |
722 | MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:"); | ||
704 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:"); | 723 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:"); |
705 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:"); | 724 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:"); |
725 | MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:"); | ||
706 | MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:"); | 726 | MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:"); |
727 | MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:"); | ||
707 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); | 728 | MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:"); |
708 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); | 729 | MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:"); |
709 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:"); | 730 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:"); |
710 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOA*:"); | 731 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOA*:"); |
711 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:"); | 732 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:"); |
733 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:"); | ||
712 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:"); | 734 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:"); |
735 | MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:"); | ||
713 | 736 | ||
714 | module_init(acerhdf_init); | 737 | module_init(acerhdf_init); |
715 | module_exit(acerhdf_exit); | 738 | module_exit(acerhdf_exit); |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index a05fc9c955d8..e6c08ee8d46c 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -212,6 +212,7 @@ static struct dmi_system_id __devinitdata dell_quirks[] = { | |||
212 | }, | 212 | }, |
213 | .driver_data = &quirk_dell_vostro_v130, | 213 | .driver_data = &quirk_dell_vostro_v130, |
214 | }, | 214 | }, |
215 | { } | ||
215 | }; | 216 | }; |
216 | 217 | ||
217 | static struct calling_interface_buffer *buffer; | 218 | static struct calling_interface_buffer *buffer; |
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c index f7ba316e0ed6..0ffdb3cde2bb 100644 --- a/drivers/platform/x86/intel_ips.c +++ b/drivers/platform/x86/intel_ips.c | |||
@@ -1565,7 +1565,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1565 | ips->poll_turbo_status = true; | 1565 | ips->poll_turbo_status = true; |
1566 | 1566 | ||
1567 | if (!ips_get_i915_syms(ips)) { | 1567 | if (!ips_get_i915_syms(ips)) { |
1568 | dev_err(&dev->dev, "failed to get i915 symbols, graphics turbo disabled\n"); | 1568 | dev_info(&dev->dev, "failed to get i915 symbols, graphics turbo disabled until i915 loads\n"); |
1569 | ips->gpu_turbo_enabled = false; | 1569 | ips->gpu_turbo_enabled = false; |
1570 | } else { | 1570 | } else { |
1571 | dev_dbg(&dev->dev, "graphics turbo enabled\n"); | 1571 | dev_dbg(&dev->dev, "graphics turbo enabled\n"); |
diff --git a/drivers/platform/x86/intel_mid_powerbtn.c b/drivers/platform/x86/intel_mid_powerbtn.c index 0a3594c7e912..bcbad8452a6f 100644 --- a/drivers/platform/x86/intel_mid_powerbtn.c +++ b/drivers/platform/x86/intel_mid_powerbtn.c | |||
@@ -78,7 +78,7 @@ static int __devinit mfld_pb_probe(struct platform_device *pdev) | |||
78 | 78 | ||
79 | input_set_capability(input, EV_KEY, KEY_POWER); | 79 | input_set_capability(input, EV_KEY, KEY_POWER); |
80 | 80 | ||
81 | error = request_threaded_irq(irq, NULL, mfld_pb_isr, 0, | 81 | error = request_threaded_irq(irq, NULL, mfld_pb_isr, IRQF_NO_SUSPEND, |
82 | DRIVER_NAME, input); | 82 | DRIVER_NAME, input); |
83 | if (error) { | 83 | if (error) { |
84 | dev_err(&pdev->dev, "Unable to request irq %d for mfld power" | 84 | dev_err(&pdev->dev, "Unable to request irq %d for mfld power" |
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 17499a55113d..81fd606e47bc 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -138,9 +138,10 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev) | |||
138 | rdesc->type = REGULATOR_VOLTAGE; | 138 | rdesc->type = REGULATOR_VOLTAGE; |
139 | rdesc->owner = THIS_MODULE; | 139 | rdesc->owner = THIS_MODULE; |
140 | sreg->mfd = anatopmfd; | 140 | sreg->mfd = anatopmfd; |
141 | ret = of_property_read_u32(np, "reg", &sreg->control_reg); | 141 | ret = of_property_read_u32(np, "anatop-reg-offset", |
142 | &sreg->control_reg); | ||
142 | if (ret) { | 143 | if (ret) { |
143 | dev_err(dev, "no reg property set\n"); | 144 | dev_err(dev, "no anatop-reg-offset property set\n"); |
144 | goto anatop_probe_end; | 145 | goto anatop_probe_end; |
145 | } | 146 | } |
146 | ret = of_property_read_u32(np, "anatop-vol-bit-width", | 147 | ret = of_property_read_u32(np, "anatop-vol-bit-width", |
@@ -213,7 +214,7 @@ static struct of_device_id __devinitdata of_anatop_regulator_match_tbl[] = { | |||
213 | { /* end */ } | 214 | { /* end */ } |
214 | }; | 215 | }; |
215 | 216 | ||
216 | static struct platform_driver anatop_regulator = { | 217 | static struct platform_driver anatop_regulator_driver = { |
217 | .driver = { | 218 | .driver = { |
218 | .name = "anatop_regulator", | 219 | .name = "anatop_regulator", |
219 | .owner = THIS_MODULE, | 220 | .owner = THIS_MODULE, |
@@ -225,13 +226,13 @@ static struct platform_driver anatop_regulator = { | |||
225 | 226 | ||
226 | static int __init anatop_regulator_init(void) | 227 | static int __init anatop_regulator_init(void) |
227 | { | 228 | { |
228 | return platform_driver_register(&anatop_regulator); | 229 | return platform_driver_register(&anatop_regulator_driver); |
229 | } | 230 | } |
230 | postcore_initcall(anatop_regulator_init); | 231 | postcore_initcall(anatop_regulator_init); |
231 | 232 | ||
232 | static void __exit anatop_regulator_exit(void) | 233 | static void __exit anatop_regulator_exit(void) |
233 | { | 234 | { |
234 | platform_driver_unregister(&anatop_regulator); | 235 | platform_driver_unregister(&anatop_regulator_driver); |
235 | } | 236 | } |
236 | module_exit(anatop_regulator_exit); | 237 | module_exit(anatop_regulator_exit); |
237 | 238 | ||
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index c056abd7562a..e70dd382a009 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -2992,14 +2992,14 @@ void regulator_unregister(struct regulator_dev *rdev) | |||
2992 | if (rdev == NULL) | 2992 | if (rdev == NULL) |
2993 | return; | 2993 | return; |
2994 | 2994 | ||
2995 | if (rdev->supply) | ||
2996 | regulator_put(rdev->supply); | ||
2995 | mutex_lock(®ulator_list_mutex); | 2997 | mutex_lock(®ulator_list_mutex); |
2996 | debugfs_remove_recursive(rdev->debugfs); | 2998 | debugfs_remove_recursive(rdev->debugfs); |
2997 | flush_work_sync(&rdev->disable_work.work); | 2999 | flush_work_sync(&rdev->disable_work.work); |
2998 | WARN_ON(rdev->open_count); | 3000 | WARN_ON(rdev->open_count); |
2999 | unset_regulator_supplies(rdev); | 3001 | unset_regulator_supplies(rdev); |
3000 | list_del(&rdev->list); | 3002 | list_del(&rdev->list); |
3001 | if (rdev->supply) | ||
3002 | regulator_put(rdev->supply); | ||
3003 | kfree(rdev->constraints); | 3003 | kfree(rdev->constraints); |
3004 | device_unregister(&rdev->dev); | 3004 | device_unregister(&rdev->dev); |
3005 | mutex_unlock(®ulator_list_mutex); | 3005 | mutex_unlock(®ulator_list_mutex); |
diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c index 30d0a15b8949..cacd33c9d042 100644 --- a/drivers/regulator/fixed-helper.c +++ b/drivers/regulator/fixed-helper.c | |||
@@ -18,7 +18,6 @@ static void regulator_fixed_release(struct device *dev) | |||
18 | 18 | ||
19 | /** | 19 | /** |
20 | * regulator_register_fixed - register a no-op fixed regulator | 20 | * regulator_register_fixed - register a no-op fixed regulator |
21 | * @name: supply name | ||
22 | * @id: platform device id | 21 | * @id: platform device id |
23 | * @supplies: consumers for this regulator | 22 | * @supplies: consumers for this regulator |
24 | * @num_supplies: number of consumers | 23 | * @num_supplies: number of consumers |
@@ -32,7 +31,7 @@ struct platform_device *regulator_register_fixed(int id, | |||
32 | if (!data) | 31 | if (!data) |
33 | return NULL; | 32 | return NULL; |
34 | 33 | ||
35 | data->cfg.supply_name = "dummy"; | 34 | data->cfg.supply_name = "fixed-dummy"; |
36 | data->cfg.microvolts = 0; | 35 | data->cfg.microvolts = 0; |
37 | data->cfg.gpio = -EINVAL; | 36 | data->cfg.gpio = -EINVAL; |
38 | data->cfg.enabled_at_boot = 1; | 37 | data->cfg.enabled_at_boot = 1; |
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index e8cfc99dd8f0..845aa2263b8a 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c | |||
@@ -552,7 +552,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
552 | mc13xxx_lock(mc13892); | 552 | mc13xxx_lock(mc13892); |
553 | ret = mc13xxx_reg_read(mc13892, MC13892_REVISION, &val); | 553 | ret = mc13xxx_reg_read(mc13892, MC13892_REVISION, &val); |
554 | if (ret) | 554 | if (ret) |
555 | goto err_free; | 555 | goto err_unlock; |
556 | 556 | ||
557 | /* enable switch auto mode */ | 557 | /* enable switch auto mode */ |
558 | if ((val & 0x0000FFFF) == 0x45d0) { | 558 | if ((val & 0x0000FFFF) == 0x45d0) { |
@@ -562,7 +562,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
562 | MC13892_SWITCHERS4_SW1MODE_AUTO | | 562 | MC13892_SWITCHERS4_SW1MODE_AUTO | |
563 | MC13892_SWITCHERS4_SW2MODE_AUTO); | 563 | MC13892_SWITCHERS4_SW2MODE_AUTO); |
564 | if (ret) | 564 | if (ret) |
565 | goto err_free; | 565 | goto err_unlock; |
566 | 566 | ||
567 | ret = mc13xxx_reg_rmw(mc13892, MC13892_SWITCHERS5, | 567 | ret = mc13xxx_reg_rmw(mc13892, MC13892_SWITCHERS5, |
568 | MC13892_SWITCHERS5_SW3MODE_M | | 568 | MC13892_SWITCHERS5_SW3MODE_M | |
@@ -570,7 +570,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
570 | MC13892_SWITCHERS5_SW3MODE_AUTO | | 570 | MC13892_SWITCHERS5_SW3MODE_AUTO | |
571 | MC13892_SWITCHERS5_SW4MODE_AUTO); | 571 | MC13892_SWITCHERS5_SW4MODE_AUTO); |
572 | if (ret) | 572 | if (ret) |
573 | goto err_free; | 573 | goto err_unlock; |
574 | } | 574 | } |
575 | mc13xxx_unlock(mc13892); | 575 | mc13xxx_unlock(mc13892); |
576 | 576 | ||
@@ -612,10 +612,10 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) | |||
612 | err: | 612 | err: |
613 | while (--i >= 0) | 613 | while (--i >= 0) |
614 | regulator_unregister(priv->regulators[i]); | 614 | regulator_unregister(priv->regulators[i]); |
615 | return ret; | ||
615 | 616 | ||
616 | err_free: | 617 | err_unlock: |
617 | mc13xxx_unlock(mc13892); | 618 | mc13xxx_unlock(mc13892); |
618 | |||
619 | return ret; | 619 | return ret; |
620 | } | 620 | } |
621 | 621 | ||
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 58447db15de1..4ca2db059004 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
@@ -311,8 +311,7 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev, | |||
311 | struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); | 311 | struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); |
312 | const struct s5m_voltage_desc *desc; | 312 | const struct s5m_voltage_desc *desc; |
313 | int reg_id = rdev_get_id(rdev); | 313 | int reg_id = rdev_get_id(rdev); |
314 | int reg, mask, ret; | 314 | int sel, reg, mask, ret; |
315 | int i; | ||
316 | u8 val; | 315 | u8 val; |
317 | 316 | ||
318 | switch (reg_id) { | 317 | switch (reg_id) { |
@@ -333,19 +332,20 @@ static int s5m8767_set_voltage(struct regulator_dev *rdev, | |||
333 | 332 | ||
334 | desc = reg_voltage_map[reg_id]; | 333 | desc = reg_voltage_map[reg_id]; |
335 | 334 | ||
336 | i = s5m8767_convert_voltage_to_sel(desc, min_uV, max_uV); | 335 | sel = s5m8767_convert_voltage_to_sel(desc, min_uV, max_uV); |
337 | if (i < 0) | 336 | if (sel < 0) |
338 | return i; | 337 | return sel; |
339 | 338 | ||
340 | ret = s5m8767_get_voltage_register(rdev, ®); | 339 | ret = s5m8767_get_voltage_register(rdev, ®); |
341 | if (ret) | 340 | if (ret) |
342 | return ret; | 341 | return ret; |
343 | 342 | ||
344 | s5m_reg_read(s5m8767->iodev, reg, &val); | 343 | s5m_reg_read(s5m8767->iodev, reg, &val); |
345 | val = val & mask; | 344 | val &= ~mask; |
345 | val |= sel; | ||
346 | 346 | ||
347 | ret = s5m_reg_write(s5m8767->iodev, reg, val); | 347 | ret = s5m_reg_write(s5m8767->iodev, reg, val); |
348 | *selector = i; | 348 | *selector = sel; |
349 | 349 | ||
350 | return ret; | 350 | return ret; |
351 | } | 351 | } |
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 29b615ce3aff..cfc1f16f7771 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
@@ -79,6 +79,11 @@ static int tps6586x_ldo_list_voltage(struct regulator_dev *rdev, | |||
79 | unsigned selector) | 79 | unsigned selector) |
80 | { | 80 | { |
81 | struct tps6586x_regulator *info = rdev_get_drvdata(rdev); | 81 | struct tps6586x_regulator *info = rdev_get_drvdata(rdev); |
82 | int rid = rdev_get_id(rdev); | ||
83 | |||
84 | /* LDO0 has minimal voltage 1.2V rather than 1.25V */ | ||
85 | if ((rid == TPS6586X_ID_LDO_0) && (selector == 0)) | ||
86 | return (info->voltages[0] - 50) * 1000; | ||
82 | 87 | ||
83 | return info->voltages[selector] * 1000; | 88 | return info->voltages[selector] * 1000; |
84 | } | 89 | } |
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 4904a40b0d46..ff810e787eac 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -380,13 +380,15 @@ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev, | |||
380 | int i; | 380 | int i; |
381 | 381 | ||
382 | for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) { | 382 | for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) { |
383 | if (max_uA <= wm831x_dcdc_ilim[i]) | 383 | if ((min_uA <= wm831x_dcdc_ilim[i]) && |
384 | (wm831x_dcdc_ilim[i] <= max_uA)) | ||
384 | break; | 385 | break; |
385 | } | 386 | } |
386 | if (i == ARRAY_SIZE(wm831x_dcdc_ilim)) | 387 | if (i == ARRAY_SIZE(wm831x_dcdc_ilim)) |
387 | return -EINVAL; | 388 | return -EINVAL; |
388 | 389 | ||
389 | return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK, i); | 390 | return wm831x_set_bits(wm831x, reg, WM831X_DC1_HC_THR_MASK, |
391 | i << WM831X_DC1_HC_THR_SHIFT); | ||
390 | } | 392 | } |
391 | 393 | ||
392 | static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) | 394 | static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) |
@@ -400,7 +402,8 @@ static int wm831x_buckv_get_current_limit(struct regulator_dev *rdev) | |||
400 | if (val < 0) | 402 | if (val < 0) |
401 | return val; | 403 | return val; |
402 | 404 | ||
403 | return wm831x_dcdc_ilim[val & WM831X_DC1_HC_THR_MASK]; | 405 | val = (val & WM831X_DC1_HC_THR_MASK) >> WM831X_DC1_HC_THR_SHIFT; |
406 | return wm831x_dcdc_ilim[val]; | ||
404 | } | 407 | } |
405 | 408 | ||
406 | static struct regulator_ops wm831x_buckv_ops = { | 409 | static struct regulator_ops wm831x_buckv_ops = { |
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c index 634aac3f2d5f..b414e09c5620 100644 --- a/drivers/regulator/wm831x-isink.c +++ b/drivers/regulator/wm831x-isink.c | |||
@@ -101,7 +101,7 @@ static int wm831x_isink_set_current(struct regulator_dev *rdev, | |||
101 | 101 | ||
102 | for (i = 0; i < ARRAY_SIZE(wm831x_isinkv_values); i++) { | 102 | for (i = 0; i < ARRAY_SIZE(wm831x_isinkv_values); i++) { |
103 | int val = wm831x_isinkv_values[i]; | 103 | int val = wm831x_isinkv_values[i]; |
104 | if (min_uA >= val && val <= max_uA) { | 104 | if (min_uA <= val && val <= max_uA) { |
105 | ret = wm831x_set_bits(wm831x, isink->reg, | 105 | ret = wm831x_set_bits(wm831x, isink->reg, |
106 | WM831X_CS1_ISEL_MASK, i); | 106 | WM831X_CS1_ISEL_MASK, i); |
107 | return ret; | 107 | return ret; |
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index f1e4ab0f9fda..641e9f6499d1 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c | |||
@@ -506,22 +506,19 @@ static int wm831x_aldo_set_mode(struct regulator_dev *rdev, | |||
506 | { | 506 | { |
507 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); | 507 | struct wm831x_ldo *ldo = rdev_get_drvdata(rdev); |
508 | struct wm831x *wm831x = ldo->wm831x; | 508 | struct wm831x *wm831x = ldo->wm831x; |
509 | int ctrl_reg = ldo->base + WM831X_LDO_CONTROL; | ||
510 | int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; | 509 | int on_reg = ldo->base + WM831X_LDO_ON_CONTROL; |
511 | int ret; | 510 | int ret; |
512 | 511 | ||
513 | 512 | ||
514 | switch (mode) { | 513 | switch (mode) { |
515 | case REGULATOR_MODE_NORMAL: | 514 | case REGULATOR_MODE_NORMAL: |
516 | ret = wm831x_set_bits(wm831x, on_reg, | 515 | ret = wm831x_set_bits(wm831x, on_reg, WM831X_LDO7_ON_MODE, 0); |
517 | WM831X_LDO7_ON_MODE, 0); | ||
518 | if (ret < 0) | 516 | if (ret < 0) |
519 | return ret; | 517 | return ret; |
520 | break; | 518 | break; |
521 | 519 | ||
522 | case REGULATOR_MODE_IDLE: | 520 | case REGULATOR_MODE_IDLE: |
523 | ret = wm831x_set_bits(wm831x, ctrl_reg, | 521 | ret = wm831x_set_bits(wm831x, on_reg, WM831X_LDO7_ON_MODE, |
524 | WM831X_LDO7_ON_MODE, | ||
525 | WM831X_LDO7_ON_MODE); | 522 | WM831X_LDO7_ON_MODE); |
526 | if (ret < 0) | 523 | if (ret < 0) |
527 | return ret; | 524 | return ret; |
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index ab1e183a74b5..05ecfb872319 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -99,7 +99,7 @@ static int get_isink_val(int min_uA, int max_uA, u16 *setting) | |||
99 | { | 99 | { |
100 | int i; | 100 | int i; |
101 | 101 | ||
102 | for (i = ARRAY_SIZE(isink_cur) - 1; i >= 0; i--) { | 102 | for (i = 0; i < ARRAY_SIZE(isink_cur); i++) { |
103 | if (min_uA <= isink_cur[i] && max_uA >= isink_cur[i]) { | 103 | if (min_uA <= isink_cur[i] && max_uA >= isink_cur[i]) { |
104 | *setting = i; | 104 | *setting = i; |
105 | return 0; | 105 | return 0; |
@@ -186,7 +186,7 @@ static int wm8350_isink_get_current(struct regulator_dev *rdev) | |||
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | return DIV_ROUND_CLOSEST(isink_cur[val], 100); | 189 | return isink_cur[val]; |
190 | } | 190 | } |
191 | 191 | ||
192 | /* turn on ISINK followed by DCDC */ | 192 | /* turn on ISINK followed by DCDC */ |
@@ -495,25 +495,25 @@ static int wm8350_dcdc_set_suspend_enable(struct regulator_dev *rdev) | |||
495 | val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER) | 495 | val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER) |
496 | & ~WM8350_DCDC_HIB_MODE_MASK; | 496 | & ~WM8350_DCDC_HIB_MODE_MASK; |
497 | wm8350_reg_write(wm8350, WM8350_DCDC1_LOW_POWER, | 497 | wm8350_reg_write(wm8350, WM8350_DCDC1_LOW_POWER, |
498 | wm8350->pmic.dcdc1_hib_mode); | 498 | val | wm8350->pmic.dcdc1_hib_mode); |
499 | break; | 499 | break; |
500 | case WM8350_DCDC_3: | 500 | case WM8350_DCDC_3: |
501 | val = wm8350_reg_read(wm8350, WM8350_DCDC3_LOW_POWER) | 501 | val = wm8350_reg_read(wm8350, WM8350_DCDC3_LOW_POWER) |
502 | & ~WM8350_DCDC_HIB_MODE_MASK; | 502 | & ~WM8350_DCDC_HIB_MODE_MASK; |
503 | wm8350_reg_write(wm8350, WM8350_DCDC3_LOW_POWER, | 503 | wm8350_reg_write(wm8350, WM8350_DCDC3_LOW_POWER, |
504 | wm8350->pmic.dcdc3_hib_mode); | 504 | val | wm8350->pmic.dcdc3_hib_mode); |
505 | break; | 505 | break; |
506 | case WM8350_DCDC_4: | 506 | case WM8350_DCDC_4: |
507 | val = wm8350_reg_read(wm8350, WM8350_DCDC4_LOW_POWER) | 507 | val = wm8350_reg_read(wm8350, WM8350_DCDC4_LOW_POWER) |
508 | & ~WM8350_DCDC_HIB_MODE_MASK; | 508 | & ~WM8350_DCDC_HIB_MODE_MASK; |
509 | wm8350_reg_write(wm8350, WM8350_DCDC4_LOW_POWER, | 509 | wm8350_reg_write(wm8350, WM8350_DCDC4_LOW_POWER, |
510 | wm8350->pmic.dcdc4_hib_mode); | 510 | val | wm8350->pmic.dcdc4_hib_mode); |
511 | break; | 511 | break; |
512 | case WM8350_DCDC_6: | 512 | case WM8350_DCDC_6: |
513 | val = wm8350_reg_read(wm8350, WM8350_DCDC6_LOW_POWER) | 513 | val = wm8350_reg_read(wm8350, WM8350_DCDC6_LOW_POWER) |
514 | & ~WM8350_DCDC_HIB_MODE_MASK; | 514 | & ~WM8350_DCDC_HIB_MODE_MASK; |
515 | wm8350_reg_write(wm8350, WM8350_DCDC6_LOW_POWER, | 515 | wm8350_reg_write(wm8350, WM8350_DCDC6_LOW_POWER, |
516 | wm8350->pmic.dcdc6_hib_mode); | 516 | val | wm8350->pmic.dcdc6_hib_mode); |
517 | break; | 517 | break; |
518 | case WM8350_DCDC_2: | 518 | case WM8350_DCDC_2: |
519 | case WM8350_DCDC_5: | 519 | case WM8350_DCDC_5: |
@@ -535,25 +535,25 @@ static int wm8350_dcdc_set_suspend_disable(struct regulator_dev *rdev) | |||
535 | val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER); | 535 | val = wm8350_reg_read(wm8350, WM8350_DCDC1_LOW_POWER); |
536 | wm8350->pmic.dcdc1_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; | 536 | wm8350->pmic.dcdc1_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; |
537 | wm8350_reg_write(wm8350, WM8350_DCDC1_LOW_POWER, | 537 | wm8350_reg_write(wm8350, WM8350_DCDC1_LOW_POWER, |
538 | WM8350_DCDC_HIB_MODE_DIS); | 538 | val | WM8350_DCDC_HIB_MODE_DIS); |
539 | break; | 539 | break; |
540 | case WM8350_DCDC_3: | 540 | case WM8350_DCDC_3: |
541 | val = wm8350_reg_read(wm8350, WM8350_DCDC3_LOW_POWER); | 541 | val = wm8350_reg_read(wm8350, WM8350_DCDC3_LOW_POWER); |
542 | wm8350->pmic.dcdc3_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; | 542 | wm8350->pmic.dcdc3_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; |
543 | wm8350_reg_write(wm8350, WM8350_DCDC3_LOW_POWER, | 543 | wm8350_reg_write(wm8350, WM8350_DCDC3_LOW_POWER, |
544 | WM8350_DCDC_HIB_MODE_DIS); | 544 | val | WM8350_DCDC_HIB_MODE_DIS); |
545 | break; | 545 | break; |
546 | case WM8350_DCDC_4: | 546 | case WM8350_DCDC_4: |
547 | val = wm8350_reg_read(wm8350, WM8350_DCDC4_LOW_POWER); | 547 | val = wm8350_reg_read(wm8350, WM8350_DCDC4_LOW_POWER); |
548 | wm8350->pmic.dcdc4_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; | 548 | wm8350->pmic.dcdc4_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; |
549 | wm8350_reg_write(wm8350, WM8350_DCDC4_LOW_POWER, | 549 | wm8350_reg_write(wm8350, WM8350_DCDC4_LOW_POWER, |
550 | WM8350_DCDC_HIB_MODE_DIS); | 550 | val | WM8350_DCDC_HIB_MODE_DIS); |
551 | break; | 551 | break; |
552 | case WM8350_DCDC_6: | 552 | case WM8350_DCDC_6: |
553 | val = wm8350_reg_read(wm8350, WM8350_DCDC6_LOW_POWER); | 553 | val = wm8350_reg_read(wm8350, WM8350_DCDC6_LOW_POWER); |
554 | wm8350->pmic.dcdc6_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; | 554 | wm8350->pmic.dcdc6_hib_mode = val & WM8350_DCDC_HIB_MODE_MASK; |
555 | wm8350_reg_write(wm8350, WM8350_DCDC6_LOW_POWER, | 555 | wm8350_reg_write(wm8350, WM8350_DCDC6_LOW_POWER, |
556 | WM8350_DCDC_HIB_MODE_DIS); | 556 | val | WM8350_DCDC_HIB_MODE_DIS); |
557 | break; | 557 | break; |
558 | case WM8350_DCDC_2: | 558 | case WM8350_DCDC_2: |
559 | case WM8350_DCDC_5: | 559 | case WM8350_DCDC_5: |
@@ -575,13 +575,13 @@ static int wm8350_dcdc25_set_suspend_enable(struct regulator_dev *rdev) | |||
575 | val = wm8350_reg_read(wm8350, WM8350_DCDC2_CONTROL) | 575 | val = wm8350_reg_read(wm8350, WM8350_DCDC2_CONTROL) |
576 | & ~WM8350_DC2_HIB_MODE_MASK; | 576 | & ~WM8350_DC2_HIB_MODE_MASK; |
577 | wm8350_reg_write(wm8350, WM8350_DCDC2_CONTROL, val | | 577 | wm8350_reg_write(wm8350, WM8350_DCDC2_CONTROL, val | |
578 | WM8350_DC2_HIB_MODE_ACTIVE); | 578 | (WM8350_DC2_HIB_MODE_ACTIVE << WM8350_DC2_HIB_MODE_SHIFT)); |
579 | break; | 579 | break; |
580 | case WM8350_DCDC_5: | 580 | case WM8350_DCDC_5: |
581 | val = wm8350_reg_read(wm8350, WM8350_DCDC5_CONTROL) | 581 | val = wm8350_reg_read(wm8350, WM8350_DCDC5_CONTROL) |
582 | & ~WM8350_DC2_HIB_MODE_MASK; | 582 | & ~WM8350_DC5_HIB_MODE_MASK; |
583 | wm8350_reg_write(wm8350, WM8350_DCDC5_CONTROL, val | | 583 | wm8350_reg_write(wm8350, WM8350_DCDC5_CONTROL, val | |
584 | WM8350_DC5_HIB_MODE_ACTIVE); | 584 | (WM8350_DC5_HIB_MODE_ACTIVE << WM8350_DC5_HIB_MODE_SHIFT)); |
585 | break; | 585 | break; |
586 | default: | 586 | default: |
587 | return -EINVAL; | 587 | return -EINVAL; |
@@ -600,13 +600,13 @@ static int wm8350_dcdc25_set_suspend_disable(struct regulator_dev *rdev) | |||
600 | val = wm8350_reg_read(wm8350, WM8350_DCDC2_CONTROL) | 600 | val = wm8350_reg_read(wm8350, WM8350_DCDC2_CONTROL) |
601 | & ~WM8350_DC2_HIB_MODE_MASK; | 601 | & ~WM8350_DC2_HIB_MODE_MASK; |
602 | wm8350_reg_write(wm8350, WM8350_DCDC2_CONTROL, val | | 602 | wm8350_reg_write(wm8350, WM8350_DCDC2_CONTROL, val | |
603 | WM8350_DC2_HIB_MODE_DISABLE); | 603 | (WM8350_DC2_HIB_MODE_DISABLE << WM8350_DC2_HIB_MODE_SHIFT)); |
604 | break; | 604 | break; |
605 | case WM8350_DCDC_5: | 605 | case WM8350_DCDC_5: |
606 | val = wm8350_reg_read(wm8350, WM8350_DCDC5_CONTROL) | 606 | val = wm8350_reg_read(wm8350, WM8350_DCDC5_CONTROL) |
607 | & ~WM8350_DC2_HIB_MODE_MASK; | 607 | & ~WM8350_DC5_HIB_MODE_MASK; |
608 | wm8350_reg_write(wm8350, WM8350_DCDC5_CONTROL, val | | 608 | wm8350_reg_write(wm8350, WM8350_DCDC5_CONTROL, val | |
609 | WM8350_DC2_HIB_MODE_DISABLE); | 609 | (WM8350_DC5_HIB_MODE_DISABLE << WM8350_DC5_HIB_MODE_SHIFT)); |
610 | break; | 610 | break; |
611 | default: | 611 | default: |
612 | return -EINVAL; | 612 | return -EINVAL; |
@@ -749,7 +749,7 @@ static int wm8350_ldo_set_suspend_disable(struct regulator_dev *rdev) | |||
749 | 749 | ||
750 | /* all LDOs have same mV bits */ | 750 | /* all LDOs have same mV bits */ |
751 | val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_LDO1_HIB_MODE_MASK; | 751 | val = wm8350_reg_read(wm8350, volt_reg) & ~WM8350_LDO1_HIB_MODE_MASK; |
752 | wm8350_reg_write(wm8350, volt_reg, WM8350_LDO1_HIB_MODE_DIS); | 752 | wm8350_reg_write(wm8350, volt_reg, val | WM8350_LDO1_HIB_MODE_DIS); |
753 | return 0; | 753 | return 0; |
754 | } | 754 | } |
755 | 755 | ||
diff --git a/drivers/remoteproc/remoteproc_debugfs.c b/drivers/remoteproc/remoteproc_debugfs.c index 70277a530133..85d31a69e117 100644 --- a/drivers/remoteproc/remoteproc_debugfs.c +++ b/drivers/remoteproc/remoteproc_debugfs.c | |||
@@ -50,16 +50,9 @@ static ssize_t rproc_trace_read(struct file *filp, char __user *userbuf, | |||
50 | return simple_read_from_buffer(userbuf, count, ppos, trace->va, len); | 50 | return simple_read_from_buffer(userbuf, count, ppos, trace->va, len); |
51 | } | 51 | } |
52 | 52 | ||
53 | static int rproc_open_generic(struct inode *inode, struct file *file) | ||
54 | { | ||
55 | file->private_data = inode->i_private; | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static const struct file_operations trace_rproc_ops = { | 53 | static const struct file_operations trace_rproc_ops = { |
61 | .read = rproc_trace_read, | 54 | .read = rproc_trace_read, |
62 | .open = rproc_open_generic, | 55 | .open = simple_open, |
63 | .llseek = generic_file_llseek, | 56 | .llseek = generic_file_llseek, |
64 | }; | 57 | }; |
65 | 58 | ||
@@ -94,7 +87,7 @@ static ssize_t rproc_state_read(struct file *filp, char __user *userbuf, | |||
94 | 87 | ||
95 | static const struct file_operations rproc_state_ops = { | 88 | static const struct file_operations rproc_state_ops = { |
96 | .read = rproc_state_read, | 89 | .read = rproc_state_read, |
97 | .open = rproc_open_generic, | 90 | .open = simple_open, |
98 | .llseek = generic_file_llseek, | 91 | .llseek = generic_file_llseek, |
99 | }; | 92 | }; |
100 | 93 | ||
@@ -114,7 +107,7 @@ static ssize_t rproc_name_read(struct file *filp, char __user *userbuf, | |||
114 | 107 | ||
115 | static const struct file_operations rproc_name_ops = { | 108 | static const struct file_operations rproc_name_ops = { |
116 | .read = rproc_name_read, | 109 | .read = rproc_name_read, |
117 | .open = rproc_open_generic, | 110 | .open = simple_open, |
118 | .llseek = generic_file_llseek, | 111 | .llseek = generic_file_llseek, |
119 | }; | 112 | }; |
120 | 113 | ||
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c index afee0e8ae714..feddefc42109 100644 --- a/drivers/rtc/rtc-88pm860x.c +++ b/drivers/rtc/rtc-88pm860x.c | |||
@@ -72,9 +72,9 @@ static int pm860x_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
72 | struct pm860x_rtc_info *info = dev_get_drvdata(dev); | 72 | struct pm860x_rtc_info *info = dev_get_drvdata(dev); |
73 | 73 | ||
74 | if (enabled) | 74 | if (enabled) |
75 | pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM, ALARM); | 75 | pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, ALARM_EN); |
76 | else | 76 | else |
77 | pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM, 0); | 77 | pm860x_set_bits(info->i2c, PM8607_RTC1, ALARM_EN, 0); |
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index cd188ab72f79..c293d0cdb104 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c | |||
@@ -902,6 +902,7 @@ read_rtc: | |||
902 | } | 902 | } |
903 | ds1307->nvram->attr.name = "nvram"; | 903 | ds1307->nvram->attr.name = "nvram"; |
904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; | 904 | ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR; |
905 | sysfs_bin_attr_init(ds1307->nvram); | ||
905 | ds1307->nvram->read = ds1307_nvram_read, | 906 | ds1307->nvram->read = ds1307_nvram_read, |
906 | ds1307->nvram->write = ds1307_nvram_write, | 907 | ds1307->nvram->write = ds1307_nvram_write, |
907 | ds1307->nvram->size = chip->nvram_size; | 908 | ds1307->nvram->size = chip->nvram_size; |
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 550292304b0f..c9f890b088da 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c | |||
@@ -213,7 +213,6 @@ static struct platform_driver efi_rtc_driver = { | |||
213 | .name = "rtc-efi", | 213 | .name = "rtc-efi", |
214 | .owner = THIS_MODULE, | 214 | .owner = THIS_MODULE, |
215 | }, | 215 | }, |
216 | .probe = efi_rtc_probe, | ||
217 | .remove = __exit_p(efi_rtc_remove), | 216 | .remove = __exit_p(efi_rtc_remove), |
218 | }; | 217 | }; |
219 | 218 | ||
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c index 42f5f829b3ee..029e421baaed 100644 --- a/drivers/rtc/rtc-mpc5121.c +++ b/drivers/rtc/rtc-mpc5121.c | |||
@@ -360,12 +360,11 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op) | |||
360 | &mpc5200_rtc_ops, THIS_MODULE); | 360 | &mpc5200_rtc_ops, THIS_MODULE); |
361 | } | 361 | } |
362 | 362 | ||
363 | rtc->rtc->uie_unsupported = 1; | ||
364 | |||
365 | if (IS_ERR(rtc->rtc)) { | 363 | if (IS_ERR(rtc->rtc)) { |
366 | err = PTR_ERR(rtc->rtc); | 364 | err = PTR_ERR(rtc->rtc); |
367 | goto out_free_irq; | 365 | goto out_free_irq; |
368 | } | 366 | } |
367 | rtc->rtc->uie_unsupported = 1; | ||
369 | 368 | ||
370 | return 0; | 369 | return 0; |
371 | 370 | ||
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 692de7360e94..684ef4bbfce4 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -339,8 +339,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id) | |||
339 | dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision); | 339 | dev_dbg(&adev->dev, "revision = 0x%01x\n", ldata->hw_revision); |
340 | 340 | ||
341 | /* Enable the clockwatch on ST Variants */ | 341 | /* Enable the clockwatch on ST Variants */ |
342 | if ((ldata->hw_designer == AMBA_VENDOR_ST) && | 342 | if (ldata->hw_designer == AMBA_VENDOR_ST) |
343 | (ldata->hw_revision > 1)) | ||
344 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, | 343 | writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN, |
345 | ldata->base + RTC_CR); | 344 | ldata->base + RTC_CR); |
346 | 345 | ||
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c index 7f8e6c247935..33b6ba0afa0d 100644 --- a/drivers/rtc/rtc-r9701.c +++ b/drivers/rtc/rtc-r9701.c | |||
@@ -122,6 +122,7 @@ static const struct rtc_class_ops r9701_rtc_ops = { | |||
122 | static int __devinit r9701_probe(struct spi_device *spi) | 122 | static int __devinit r9701_probe(struct spi_device *spi) |
123 | { | 123 | { |
124 | struct rtc_device *rtc; | 124 | struct rtc_device *rtc; |
125 | struct rtc_time dt; | ||
125 | unsigned char tmp; | 126 | unsigned char tmp; |
126 | int res; | 127 | int res; |
127 | 128 | ||
@@ -132,6 +133,27 @@ static int __devinit r9701_probe(struct spi_device *spi) | |||
132 | return -ENODEV; | 133 | return -ENODEV; |
133 | } | 134 | } |
134 | 135 | ||
136 | /* | ||
137 | * The device seems to be present. Now check if the registers | ||
138 | * contain invalid values. If so, try to write a default date: | ||
139 | * 2000/1/1 00:00:00 | ||
140 | */ | ||
141 | r9701_get_datetime(&spi->dev, &dt); | ||
142 | if (rtc_valid_tm(&dt)) { | ||
143 | dev_info(&spi->dev, "trying to repair invalid date/time\n"); | ||
144 | dt.tm_sec = 0; | ||
145 | dt.tm_min = 0; | ||
146 | dt.tm_hour = 0; | ||
147 | dt.tm_mday = 1; | ||
148 | dt.tm_mon = 0; | ||
149 | dt.tm_year = 100; | ||
150 | |||
151 | if (r9701_set_datetime(&spi->dev, &dt)) { | ||
152 | dev_err(&spi->dev, "cannot repair RTC register\n"); | ||
153 | return -ENODEV; | ||
154 | } | ||
155 | } | ||
156 | |||
135 | rtc = rtc_device_register("r9701", | 157 | rtc = rtc_device_register("r9701", |
136 | &spi->dev, &r9701_rtc_ops, THIS_MODULE); | 158 | &spi->dev, &r9701_rtc_ops, THIS_MODULE); |
137 | if (IS_ERR(rtc)) | 159 | if (IS_ERR(rtc)) |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 9ccea134a996..3f3a29752369 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -40,6 +40,10 @@ enum s3c_cpu_type { | |||
40 | TYPE_S3C64XX, | 40 | TYPE_S3C64XX, |
41 | }; | 41 | }; |
42 | 42 | ||
43 | struct s3c_rtc_drv_data { | ||
44 | int cpu_type; | ||
45 | }; | ||
46 | |||
43 | /* I have yet to find an S3C implementation with more than one | 47 | /* I have yet to find an S3C implementation with more than one |
44 | * of these rtc blocks in */ | 48 | * of these rtc blocks in */ |
45 | 49 | ||
@@ -446,10 +450,12 @@ static const struct of_device_id s3c_rtc_dt_match[]; | |||
446 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) | 450 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) |
447 | { | 451 | { |
448 | #ifdef CONFIG_OF | 452 | #ifdef CONFIG_OF |
453 | struct s3c_rtc_drv_data *data; | ||
449 | if (pdev->dev.of_node) { | 454 | if (pdev->dev.of_node) { |
450 | const struct of_device_id *match; | 455 | const struct of_device_id *match; |
451 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); | 456 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); |
452 | return match->data; | 457 | data = (struct s3c_rtc_drv_data *) match->data; |
458 | return data->cpu_type; | ||
453 | } | 459 | } |
454 | #endif | 460 | #endif |
455 | return platform_get_device_id(pdev)->driver_data; | 461 | return platform_get_device_id(pdev)->driver_data; |
@@ -664,20 +670,27 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
664 | #define s3c_rtc_resume NULL | 670 | #define s3c_rtc_resume NULL |
665 | #endif | 671 | #endif |
666 | 672 | ||
673 | static struct s3c_rtc_drv_data s3c_rtc_drv_data_array[] = { | ||
674 | [TYPE_S3C2410] = { TYPE_S3C2410 }, | ||
675 | [TYPE_S3C2416] = { TYPE_S3C2416 }, | ||
676 | [TYPE_S3C2443] = { TYPE_S3C2443 }, | ||
677 | [TYPE_S3C64XX] = { TYPE_S3C64XX }, | ||
678 | }; | ||
679 | |||
667 | #ifdef CONFIG_OF | 680 | #ifdef CONFIG_OF |
668 | static const struct of_device_id s3c_rtc_dt_match[] = { | 681 | static const struct of_device_id s3c_rtc_dt_match[] = { |
669 | { | 682 | { |
670 | .compatible = "samsung,s3c2410-rtc" | 683 | .compatible = "samsung,s3c2410-rtc", |
671 | .data = TYPE_S3C2410, | 684 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2410], |
672 | }, { | 685 | }, { |
673 | .compatible = "samsung,s3c2416-rtc" | 686 | .compatible = "samsung,s3c2416-rtc", |
674 | .data = TYPE_S3C2416, | 687 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2416], |
675 | }, { | 688 | }, { |
676 | .compatible = "samsung,s3c2443-rtc" | 689 | .compatible = "samsung,s3c2443-rtc", |
677 | .data = TYPE_S3C2443, | 690 | .data = &s3c_rtc_drv_data_array[TYPE_S3C2443], |
678 | }, { | 691 | }, { |
679 | .compatible = "samsung,s3c6410-rtc" | 692 | .compatible = "samsung,s3c6410-rtc", |
680 | .data = TYPE_S3C64XX, | 693 | .data = &s3c_rtc_drv_data_array[TYPE_S3C64XX], |
681 | }, | 694 | }, |
682 | {}, | 695 | {}, |
683 | }; | 696 | }; |
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 4c2c6df2a9ef..258abeabf624 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
@@ -112,6 +112,7 @@ static const u8 twl6030_rtc_reg_map[] = { | |||
112 | #define BIT_RTC_CTRL_REG_TEST_MODE_M 0x10 | 112 | #define BIT_RTC_CTRL_REG_TEST_MODE_M 0x10 |
113 | #define BIT_RTC_CTRL_REG_SET_32_COUNTER_M 0x20 | 113 | #define BIT_RTC_CTRL_REG_SET_32_COUNTER_M 0x20 |
114 | #define BIT_RTC_CTRL_REG_GET_TIME_M 0x40 | 114 | #define BIT_RTC_CTRL_REG_GET_TIME_M 0x40 |
115 | #define BIT_RTC_CTRL_REG_RTC_V_OPT 0x80 | ||
115 | 116 | ||
116 | /* RTC_STATUS_REG bitfields */ | 117 | /* RTC_STATUS_REG bitfields */ |
117 | #define BIT_RTC_STATUS_REG_RUN_M 0x02 | 118 | #define BIT_RTC_STATUS_REG_RUN_M 0x02 |
@@ -235,25 +236,57 @@ static int twl_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
235 | unsigned char rtc_data[ALL_TIME_REGS + 1]; | 236 | unsigned char rtc_data[ALL_TIME_REGS + 1]; |
236 | int ret; | 237 | int ret; |
237 | u8 save_control; | 238 | u8 save_control; |
239 | u8 rtc_control; | ||
238 | 240 | ||
239 | ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG); | 241 | ret = twl_rtc_read_u8(&save_control, REG_RTC_CTRL_REG); |
240 | if (ret < 0) | 242 | if (ret < 0) { |
243 | dev_err(dev, "%s: reading CTRL_REG, error %d\n", __func__, ret); | ||
241 | return ret; | 244 | return ret; |
245 | } | ||
246 | /* for twl6030/32 make sure BIT_RTC_CTRL_REG_GET_TIME_M is clear */ | ||
247 | if (twl_class_is_6030()) { | ||
248 | if (save_control & BIT_RTC_CTRL_REG_GET_TIME_M) { | ||
249 | save_control &= ~BIT_RTC_CTRL_REG_GET_TIME_M; | ||
250 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | ||
251 | if (ret < 0) { | ||
252 | dev_err(dev, "%s clr GET_TIME, error %d\n", | ||
253 | __func__, ret); | ||
254 | return ret; | ||
255 | } | ||
256 | } | ||
257 | } | ||
242 | 258 | ||
243 | save_control |= BIT_RTC_CTRL_REG_GET_TIME_M; | 259 | /* Copy RTC counting registers to static registers or latches */ |
260 | rtc_control = save_control | BIT_RTC_CTRL_REG_GET_TIME_M; | ||
244 | 261 | ||
245 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | 262 | /* for twl6030/32 enable read access to static shadowed registers */ |
246 | if (ret < 0) | 263 | if (twl_class_is_6030()) |
264 | rtc_control |= BIT_RTC_CTRL_REG_RTC_V_OPT; | ||
265 | |||
266 | ret = twl_rtc_write_u8(rtc_control, REG_RTC_CTRL_REG); | ||
267 | if (ret < 0) { | ||
268 | dev_err(dev, "%s: writing CTRL_REG, error %d\n", __func__, ret); | ||
247 | return ret; | 269 | return ret; |
270 | } | ||
248 | 271 | ||
249 | ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data, | 272 | ret = twl_i2c_read(TWL_MODULE_RTC, rtc_data, |
250 | (rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS); | 273 | (rtc_reg_map[REG_SECONDS_REG]), ALL_TIME_REGS); |
251 | 274 | ||
252 | if (ret < 0) { | 275 | if (ret < 0) { |
253 | dev_err(dev, "rtc_read_time error %d\n", ret); | 276 | dev_err(dev, "%s: reading data, error %d\n", __func__, ret); |
254 | return ret; | 277 | return ret; |
255 | } | 278 | } |
256 | 279 | ||
280 | /* for twl6030 restore original state of rtc control register */ | ||
281 | if (twl_class_is_6030()) { | ||
282 | ret = twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); | ||
283 | if (ret < 0) { | ||
284 | dev_err(dev, "%s: restore CTRL_REG, error %d\n", | ||
285 | __func__, ret); | ||
286 | return ret; | ||
287 | } | ||
288 | } | ||
289 | |||
257 | tm->tm_sec = bcd2bin(rtc_data[0]); | 290 | tm->tm_sec = bcd2bin(rtc_data[0]); |
258 | tm->tm_min = bcd2bin(rtc_data[1]); | 291 | tm->tm_min = bcd2bin(rtc_data[1]); |
259 | tm->tm_hour = bcd2bin(rtc_data[2]); | 292 | tm->tm_hour = bcd2bin(rtc_data[2]); |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index c21871a4e73d..bc2e8a7c265b 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -2844,6 +2844,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2844 | sector_t recid, trkid; | 2844 | sector_t recid, trkid; |
2845 | unsigned int offs; | 2845 | unsigned int offs; |
2846 | unsigned int count, count_to_trk_end; | 2846 | unsigned int count, count_to_trk_end; |
2847 | int ret; | ||
2847 | 2848 | ||
2848 | basedev = block->base; | 2849 | basedev = block->base; |
2849 | if (rq_data_dir(req) == READ) { | 2850 | if (rq_data_dir(req) == READ) { |
@@ -2884,8 +2885,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2884 | 2885 | ||
2885 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); | 2886 | itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); |
2886 | if (IS_ERR(itcw)) { | 2887 | if (IS_ERR(itcw)) { |
2887 | dasd_sfree_request(cqr, startdev); | 2888 | ret = -EINVAL; |
2888 | return ERR_PTR(-EINVAL); | 2889 | goto out_error; |
2889 | } | 2890 | } |
2890 | cqr->cpaddr = itcw_get_tcw(itcw); | 2891 | cqr->cpaddr = itcw_get_tcw(itcw); |
2891 | if (prepare_itcw(itcw, first_trk, last_trk, | 2892 | if (prepare_itcw(itcw, first_trk, last_trk, |
@@ -2897,8 +2898,8 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2897 | /* Clock not in sync and XRC is enabled. | 2898 | /* Clock not in sync and XRC is enabled. |
2898 | * Try again later. | 2899 | * Try again later. |
2899 | */ | 2900 | */ |
2900 | dasd_sfree_request(cqr, startdev); | 2901 | ret = -EAGAIN; |
2901 | return ERR_PTR(-EAGAIN); | 2902 | goto out_error; |
2902 | } | 2903 | } |
2903 | len_to_track_end = 0; | 2904 | len_to_track_end = 0; |
2904 | /* | 2905 | /* |
@@ -2937,8 +2938,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2937 | tidaw_flags = 0; | 2938 | tidaw_flags = 0; |
2938 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, | 2939 | last_tidaw = itcw_add_tidaw(itcw, tidaw_flags, |
2939 | dst, part_len); | 2940 | dst, part_len); |
2940 | if (IS_ERR(last_tidaw)) | 2941 | if (IS_ERR(last_tidaw)) { |
2941 | return ERR_PTR(-EINVAL); | 2942 | ret = -EINVAL; |
2943 | goto out_error; | ||
2944 | } | ||
2942 | dst += part_len; | 2945 | dst += part_len; |
2943 | } | 2946 | } |
2944 | } | 2947 | } |
@@ -2947,8 +2950,10 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2947 | dst = page_address(bv->bv_page) + bv->bv_offset; | 2950 | dst = page_address(bv->bv_page) + bv->bv_offset; |
2948 | last_tidaw = itcw_add_tidaw(itcw, 0x00, | 2951 | last_tidaw = itcw_add_tidaw(itcw, 0x00, |
2949 | dst, bv->bv_len); | 2952 | dst, bv->bv_len); |
2950 | if (IS_ERR(last_tidaw)) | 2953 | if (IS_ERR(last_tidaw)) { |
2951 | return ERR_PTR(-EINVAL); | 2954 | ret = -EINVAL; |
2955 | goto out_error; | ||
2956 | } | ||
2952 | } | 2957 | } |
2953 | } | 2958 | } |
2954 | last_tidaw->flags |= TIDAW_FLAGS_LAST; | 2959 | last_tidaw->flags |= TIDAW_FLAGS_LAST; |
@@ -2968,6 +2973,9 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( | |||
2968 | cqr->buildclk = get_clock(); | 2973 | cqr->buildclk = get_clock(); |
2969 | cqr->status = DASD_CQR_FILLED; | 2974 | cqr->status = DASD_CQR_FILLED; |
2970 | return cqr; | 2975 | return cqr; |
2976 | out_error: | ||
2977 | dasd_sfree_request(cqr, startdev); | ||
2978 | return ERR_PTR(ret); | ||
2971 | } | 2979 | } |
2972 | 2980 | ||
2973 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, | 2981 | static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, |
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index 85f4a9a5d12e..73bef0bd394c 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c | |||
@@ -903,7 +903,7 @@ static int ur_set_online(struct ccw_device *cdev) | |||
903 | goto fail_urdev_put; | 903 | goto fail_urdev_put; |
904 | } | 904 | } |
905 | 905 | ||
906 | cdev_init(urd->char_device, &ur_fops); | 906 | urd->char_device->ops = &ur_fops; |
907 | urd->char_device->dev = MKDEV(major, minor); | 907 | urd->char_device->dev = MKDEV(major, minor); |
908 | urd->char_device->owner = ur_fops.owner; | 908 | urd->char_device->owner = ur_fops.owner; |
909 | 909 | ||
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 120955c66410..8334dadc681d 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -1672,7 +1672,8 @@ static void qeth_configure_blkt_default(struct qeth_card *card, char *prcd) | |||
1672 | { | 1672 | { |
1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); | 1673 | QETH_DBF_TEXT(SETUP, 2, "cfgblkt"); |
1674 | 1674 | ||
1675 | if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && prcd[76] == 0xF5) { | 1675 | if (prcd[74] == 0xF0 && prcd[75] == 0xF0 && |
1676 | (prcd[76] == 0xF5 || prcd[76] == 0xF6)) { | ||
1676 | card->info.blkt.time_total = 250; | 1677 | card->info.blkt.time_total = 250; |
1677 | card->info.blkt.inter_packet = 5; | 1678 | card->info.blkt.inter_packet = 5; |
1678 | card->info.blkt.inter_packet_jumbo = 15; | 1679 | card->info.blkt.inter_packet_jumbo = 15; |
@@ -4540,7 +4541,8 @@ static void qeth_determine_capabilities(struct qeth_card *card) | |||
4540 | goto out_offline; | 4541 | goto out_offline; |
4541 | } | 4542 | } |
4542 | qeth_configure_unitaddr(card, prcd); | 4543 | qeth_configure_unitaddr(card, prcd); |
4543 | qeth_configure_blkt_default(card, prcd); | 4544 | if (ddev_offline) |
4545 | qeth_configure_blkt_default(card, prcd); | ||
4544 | kfree(prcd); | 4546 | kfree(prcd); |
4545 | 4547 | ||
4546 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); | 4548 | rc = qdio_get_ssqd_desc(ddev, &card->ssqd); |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index e002cd466e9a..467dc38246f9 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -4549,8 +4549,12 @@ static int ipr_ata_slave_alloc(struct scsi_device *sdev) | |||
4549 | ENTER; | 4549 | ENTER; |
4550 | if (sdev->sdev_target) | 4550 | if (sdev->sdev_target) |
4551 | sata_port = sdev->sdev_target->hostdata; | 4551 | sata_port = sdev->sdev_target->hostdata; |
4552 | if (sata_port) | 4552 | if (sata_port) { |
4553 | rc = ata_sas_port_init(sata_port->ap); | 4553 | rc = ata_sas_port_init(sata_port->ap); |
4554 | if (rc == 0) | ||
4555 | rc = ata_sas_sync_probe(sata_port->ap); | ||
4556 | } | ||
4557 | |||
4554 | if (rc) | 4558 | if (rc) |
4555 | ipr_slave_destroy(sdev); | 4559 | ipr_slave_destroy(sdev); |
4556 | 4560 | ||
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index ef9560dff295..cc83b66d45b7 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -1742,17 +1742,19 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp, | |||
1742 | 1742 | ||
1743 | mfs = ntohs(flp->fl_csp.sp_bb_data) & | 1743 | mfs = ntohs(flp->fl_csp.sp_bb_data) & |
1744 | FC_SP_BB_DATA_MASK; | 1744 | FC_SP_BB_DATA_MASK; |
1745 | if (mfs >= FC_SP_MIN_MAX_PAYLOAD && | 1745 | |
1746 | mfs <= lport->mfs) { | 1746 | if (mfs < FC_SP_MIN_MAX_PAYLOAD || mfs > FC_SP_MAX_MAX_PAYLOAD) { |
1747 | lport->mfs = mfs; | ||
1748 | fc_host_maxframe_size(lport->host) = mfs; | ||
1749 | } else { | ||
1750 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " | 1747 | FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, " |
1751 | "lport->mfs:%hu\n", mfs, lport->mfs); | 1748 | "lport->mfs:%hu\n", mfs, lport->mfs); |
1752 | fc_lport_error(lport, fp); | 1749 | fc_lport_error(lport, fp); |
1753 | goto err; | 1750 | goto err; |
1754 | } | 1751 | } |
1755 | 1752 | ||
1753 | if (mfs <= lport->mfs) { | ||
1754 | lport->mfs = mfs; | ||
1755 | fc_host_maxframe_size(lport->host) = mfs; | ||
1756 | } | ||
1757 | |||
1756 | csp_flags = ntohs(flp->fl_csp.sp_features); | 1758 | csp_flags = ntohs(flp->fl_csp.sp_features); |
1757 | r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); | 1759 | r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov); |
1758 | e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); | 1760 | e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov); |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index bc0cecc6ad62..441d88ad99a7 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
@@ -546,11 +546,12 @@ static struct ata_port_info sata_port_info = { | |||
546 | .port_ops = &sas_sata_ops | 546 | .port_ops = &sas_sata_ops |
547 | }; | 547 | }; |
548 | 548 | ||
549 | int sas_ata_init_host_and_port(struct domain_device *found_dev) | 549 | int sas_ata_init(struct domain_device *found_dev) |
550 | { | 550 | { |
551 | struct sas_ha_struct *ha = found_dev->port->ha; | 551 | struct sas_ha_struct *ha = found_dev->port->ha; |
552 | struct Scsi_Host *shost = ha->core.shost; | 552 | struct Scsi_Host *shost = ha->core.shost; |
553 | struct ata_port *ap; | 553 | struct ata_port *ap; |
554 | int rc; | ||
554 | 555 | ||
555 | ata_host_init(&found_dev->sata_dev.ata_host, | 556 | ata_host_init(&found_dev->sata_dev.ata_host, |
556 | ha->dev, | 557 | ha->dev, |
@@ -567,8 +568,11 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev) | |||
567 | ap->private_data = found_dev; | 568 | ap->private_data = found_dev; |
568 | ap->cbl = ATA_CBL_SATA; | 569 | ap->cbl = ATA_CBL_SATA; |
569 | ap->scsi_host = shost; | 570 | ap->scsi_host = shost; |
570 | /* publish initialized ata port */ | 571 | rc = ata_sas_port_init(ap); |
571 | smp_wmb(); | 572 | if (rc) { |
573 | ata_sas_port_destroy(ap); | ||
574 | return rc; | ||
575 | } | ||
572 | found_dev->sata_dev.ap = ap; | 576 | found_dev->sata_dev.ap = ap; |
573 | 577 | ||
574 | return 0; | 578 | return 0; |
@@ -648,18 +652,13 @@ static void sas_get_ata_command_set(struct domain_device *dev) | |||
648 | void sas_probe_sata(struct asd_sas_port *port) | 652 | void sas_probe_sata(struct asd_sas_port *port) |
649 | { | 653 | { |
650 | struct domain_device *dev, *n; | 654 | struct domain_device *dev, *n; |
651 | int err; | ||
652 | 655 | ||
653 | mutex_lock(&port->ha->disco_mutex); | 656 | mutex_lock(&port->ha->disco_mutex); |
654 | list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node) { | 657 | list_for_each_entry(dev, &port->disco_list, disco_list_node) { |
655 | if (!dev_is_sata(dev)) | 658 | if (!dev_is_sata(dev)) |
656 | continue; | 659 | continue; |
657 | 660 | ||
658 | err = sas_ata_init_host_and_port(dev); | 661 | ata_sas_async_probe(dev->sata_dev.ap); |
659 | if (err) | ||
660 | sas_fail_probe(dev, __func__, err); | ||
661 | else | ||
662 | ata_sas_async_port_init(dev->sata_dev.ap); | ||
663 | } | 662 | } |
664 | mutex_unlock(&port->ha->disco_mutex); | 663 | mutex_unlock(&port->ha->disco_mutex); |
665 | 664 | ||
@@ -718,18 +717,6 @@ static void async_sas_ata_eh(void *data, async_cookie_t cookie) | |||
718 | sas_put_device(dev); | 717 | sas_put_device(dev); |
719 | } | 718 | } |
720 | 719 | ||
721 | static bool sas_ata_dev_eh_valid(struct domain_device *dev) | ||
722 | { | ||
723 | struct ata_port *ap; | ||
724 | |||
725 | if (!dev_is_sata(dev)) | ||
726 | return false; | ||
727 | ap = dev->sata_dev.ap; | ||
728 | /* consume fully initialized ata ports */ | ||
729 | smp_rmb(); | ||
730 | return !!ap; | ||
731 | } | ||
732 | |||
733 | void sas_ata_strategy_handler(struct Scsi_Host *shost) | 720 | void sas_ata_strategy_handler(struct Scsi_Host *shost) |
734 | { | 721 | { |
735 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | 722 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); |
@@ -753,7 +740,7 @@ void sas_ata_strategy_handler(struct Scsi_Host *shost) | |||
753 | 740 | ||
754 | spin_lock(&port->dev_list_lock); | 741 | spin_lock(&port->dev_list_lock); |
755 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { | 742 | list_for_each_entry(dev, &port->dev_list, dev_list_node) { |
756 | if (!sas_ata_dev_eh_valid(dev)) | 743 | if (!dev_is_sata(dev)) |
757 | continue; | 744 | continue; |
758 | async_schedule_domain(async_sas_ata_eh, dev, &async); | 745 | async_schedule_domain(async_sas_ata_eh, dev, &async); |
759 | } | 746 | } |
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 364679675602..629a0865b130 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c | |||
@@ -72,6 +72,7 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
72 | struct asd_sas_phy *phy; | 72 | struct asd_sas_phy *phy; |
73 | struct sas_rphy *rphy; | 73 | struct sas_rphy *rphy; |
74 | struct domain_device *dev; | 74 | struct domain_device *dev; |
75 | int rc = -ENODEV; | ||
75 | 76 | ||
76 | dev = sas_alloc_device(); | 77 | dev = sas_alloc_device(); |
77 | if (!dev) | 78 | if (!dev) |
@@ -110,9 +111,16 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
110 | 111 | ||
111 | sas_init_dev(dev); | 112 | sas_init_dev(dev); |
112 | 113 | ||
114 | dev->port = port; | ||
113 | switch (dev->dev_type) { | 115 | switch (dev->dev_type) { |
114 | case SAS_END_DEV: | ||
115 | case SATA_DEV: | 116 | case SATA_DEV: |
117 | rc = sas_ata_init(dev); | ||
118 | if (rc) { | ||
119 | rphy = NULL; | ||
120 | break; | ||
121 | } | ||
122 | /* fall through */ | ||
123 | case SAS_END_DEV: | ||
116 | rphy = sas_end_device_alloc(port->port); | 124 | rphy = sas_end_device_alloc(port->port); |
117 | break; | 125 | break; |
118 | case EDGE_DEV: | 126 | case EDGE_DEV: |
@@ -131,19 +139,14 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
131 | 139 | ||
132 | if (!rphy) { | 140 | if (!rphy) { |
133 | sas_put_device(dev); | 141 | sas_put_device(dev); |
134 | return -ENODEV; | 142 | return rc; |
135 | } | 143 | } |
136 | 144 | ||
137 | spin_lock_irq(&port->phy_list_lock); | ||
138 | list_for_each_entry(phy, &port->phy_list, port_phy_el) | ||
139 | sas_phy_set_target(phy, dev); | ||
140 | spin_unlock_irq(&port->phy_list_lock); | ||
141 | rphy->identify.phy_identifier = phy->phy->identify.phy_identifier; | 145 | rphy->identify.phy_identifier = phy->phy->identify.phy_identifier; |
142 | memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE); | 146 | memcpy(dev->sas_addr, port->attached_sas_addr, SAS_ADDR_SIZE); |
143 | sas_fill_in_rphy(dev, rphy); | 147 | sas_fill_in_rphy(dev, rphy); |
144 | sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr); | 148 | sas_hash_addr(dev->hashed_sas_addr, dev->sas_addr); |
145 | port->port_dev = dev; | 149 | port->port_dev = dev; |
146 | dev->port = port; | ||
147 | dev->linkrate = port->linkrate; | 150 | dev->linkrate = port->linkrate; |
148 | dev->min_linkrate = port->linkrate; | 151 | dev->min_linkrate = port->linkrate; |
149 | dev->max_linkrate = port->linkrate; | 152 | dev->max_linkrate = port->linkrate; |
@@ -155,6 +158,7 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
155 | sas_device_set_phy(dev, port->port); | 158 | sas_device_set_phy(dev, port->port); |
156 | 159 | ||
157 | dev->rphy = rphy; | 160 | dev->rphy = rphy; |
161 | get_device(&dev->rphy->dev); | ||
158 | 162 | ||
159 | if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) | 163 | if (dev_is_sata(dev) || dev->dev_type == SAS_END_DEV) |
160 | list_add_tail(&dev->disco_list_node, &port->disco_list); | 164 | list_add_tail(&dev->disco_list_node, &port->disco_list); |
@@ -164,6 +168,11 @@ static int sas_get_port_device(struct asd_sas_port *port) | |||
164 | spin_unlock_irq(&port->dev_list_lock); | 168 | spin_unlock_irq(&port->dev_list_lock); |
165 | } | 169 | } |
166 | 170 | ||
171 | spin_lock_irq(&port->phy_list_lock); | ||
172 | list_for_each_entry(phy, &port->phy_list, port_phy_el) | ||
173 | sas_phy_set_target(phy, dev); | ||
174 | spin_unlock_irq(&port->phy_list_lock); | ||
175 | |||
167 | return 0; | 176 | return 0; |
168 | } | 177 | } |
169 | 178 | ||
@@ -205,8 +214,7 @@ void sas_notify_lldd_dev_gone(struct domain_device *dev) | |||
205 | static void sas_probe_devices(struct work_struct *work) | 214 | static void sas_probe_devices(struct work_struct *work) |
206 | { | 215 | { |
207 | struct domain_device *dev, *n; | 216 | struct domain_device *dev, *n; |
208 | struct sas_discovery_event *ev = | 217 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
209 | container_of(work, struct sas_discovery_event, work); | ||
210 | struct asd_sas_port *port = ev->port; | 218 | struct asd_sas_port *port = ev->port; |
211 | 219 | ||
212 | clear_bit(DISCE_PROBE, &port->disc.pending); | 220 | clear_bit(DISCE_PROBE, &port->disc.pending); |
@@ -255,6 +263,9 @@ void sas_free_device(struct kref *kref) | |||
255 | { | 263 | { |
256 | struct domain_device *dev = container_of(kref, typeof(*dev), kref); | 264 | struct domain_device *dev = container_of(kref, typeof(*dev), kref); |
257 | 265 | ||
266 | put_device(&dev->rphy->dev); | ||
267 | dev->rphy = NULL; | ||
268 | |||
258 | if (dev->parent) | 269 | if (dev->parent) |
259 | sas_put_device(dev->parent); | 270 | sas_put_device(dev->parent); |
260 | 271 | ||
@@ -291,8 +302,7 @@ static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_d | |||
291 | static void sas_destruct_devices(struct work_struct *work) | 302 | static void sas_destruct_devices(struct work_struct *work) |
292 | { | 303 | { |
293 | struct domain_device *dev, *n; | 304 | struct domain_device *dev, *n; |
294 | struct sas_discovery_event *ev = | 305 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
295 | container_of(work, struct sas_discovery_event, work); | ||
296 | struct asd_sas_port *port = ev->port; | 306 | struct asd_sas_port *port = ev->port; |
297 | 307 | ||
298 | clear_bit(DISCE_DESTRUCT, &port->disc.pending); | 308 | clear_bit(DISCE_DESTRUCT, &port->disc.pending); |
@@ -302,7 +312,6 @@ static void sas_destruct_devices(struct work_struct *work) | |||
302 | 312 | ||
303 | sas_remove_children(&dev->rphy->dev); | 313 | sas_remove_children(&dev->rphy->dev); |
304 | sas_rphy_delete(dev->rphy); | 314 | sas_rphy_delete(dev->rphy); |
305 | dev->rphy = NULL; | ||
306 | sas_unregister_common_dev(port, dev); | 315 | sas_unregister_common_dev(port, dev); |
307 | } | 316 | } |
308 | } | 317 | } |
@@ -314,11 +323,11 @@ void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *dev) | |||
314 | /* this rphy never saw sas_rphy_add */ | 323 | /* this rphy never saw sas_rphy_add */ |
315 | list_del_init(&dev->disco_list_node); | 324 | list_del_init(&dev->disco_list_node); |
316 | sas_rphy_free(dev->rphy); | 325 | sas_rphy_free(dev->rphy); |
317 | dev->rphy = NULL; | ||
318 | sas_unregister_common_dev(port, dev); | 326 | sas_unregister_common_dev(port, dev); |
327 | return; | ||
319 | } | 328 | } |
320 | 329 | ||
321 | if (dev->rphy && !test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { | 330 | if (!test_and_set_bit(SAS_DEV_DESTROY, &dev->state)) { |
322 | sas_rphy_unlink(dev->rphy); | 331 | sas_rphy_unlink(dev->rphy); |
323 | list_move_tail(&dev->disco_list_node, &port->destroy_list); | 332 | list_move_tail(&dev->disco_list_node, &port->destroy_list); |
324 | sas_discover_event(dev->port, DISCE_DESTRUCT); | 333 | sas_discover_event(dev->port, DISCE_DESTRUCT); |
@@ -377,8 +386,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
377 | { | 386 | { |
378 | struct domain_device *dev; | 387 | struct domain_device *dev; |
379 | int error = 0; | 388 | int error = 0; |
380 | struct sas_discovery_event *ev = | 389 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
381 | container_of(work, struct sas_discovery_event, work); | ||
382 | struct asd_sas_port *port = ev->port; | 390 | struct asd_sas_port *port = ev->port; |
383 | 391 | ||
384 | clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending); | 392 | clear_bit(DISCE_DISCOVER_DOMAIN, &port->disc.pending); |
@@ -419,8 +427,6 @@ static void sas_discover_domain(struct work_struct *work) | |||
419 | 427 | ||
420 | if (error) { | 428 | if (error) { |
421 | sas_rphy_free(dev->rphy); | 429 | sas_rphy_free(dev->rphy); |
422 | dev->rphy = NULL; | ||
423 | |||
424 | list_del_init(&dev->disco_list_node); | 430 | list_del_init(&dev->disco_list_node); |
425 | spin_lock_irq(&port->dev_list_lock); | 431 | spin_lock_irq(&port->dev_list_lock); |
426 | list_del_init(&dev->dev_list_node); | 432 | list_del_init(&dev->dev_list_node); |
@@ -437,8 +443,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
437 | static void sas_revalidate_domain(struct work_struct *work) | 443 | static void sas_revalidate_domain(struct work_struct *work) |
438 | { | 444 | { |
439 | int res = 0; | 445 | int res = 0; |
440 | struct sas_discovery_event *ev = | 446 | struct sas_discovery_event *ev = to_sas_discovery_event(work); |
441 | container_of(work, struct sas_discovery_event, work); | ||
442 | struct asd_sas_port *port = ev->port; | 447 | struct asd_sas_port *port = ev->port; |
443 | struct sas_ha_struct *ha = port->ha; | 448 | struct sas_ha_struct *ha = port->ha; |
444 | 449 | ||
@@ -466,21 +471,25 @@ static void sas_revalidate_domain(struct work_struct *work) | |||
466 | 471 | ||
467 | /* ---------- Events ---------- */ | 472 | /* ---------- Events ---------- */ |
468 | 473 | ||
469 | static void sas_chain_work(struct sas_ha_struct *ha, struct work_struct *work) | 474 | static void sas_chain_work(struct sas_ha_struct *ha, struct sas_work *sw) |
470 | { | 475 | { |
471 | /* chained work is not subject to SA_HA_DRAINING or SAS_HA_REGISTERED */ | 476 | /* chained work is not subject to SA_HA_DRAINING or |
472 | scsi_queue_work(ha->core.shost, work); | 477 | * SAS_HA_REGISTERED, because it is either submitted in the |
478 | * workqueue, or known to be submitted from a context that is | ||
479 | * not racing against draining | ||
480 | */ | ||
481 | scsi_queue_work(ha->core.shost, &sw->work); | ||
473 | } | 482 | } |
474 | 483 | ||
475 | static void sas_chain_event(int event, unsigned long *pending, | 484 | static void sas_chain_event(int event, unsigned long *pending, |
476 | struct work_struct *work, | 485 | struct sas_work *sw, |
477 | struct sas_ha_struct *ha) | 486 | struct sas_ha_struct *ha) |
478 | { | 487 | { |
479 | if (!test_and_set_bit(event, pending)) { | 488 | if (!test_and_set_bit(event, pending)) { |
480 | unsigned long flags; | 489 | unsigned long flags; |
481 | 490 | ||
482 | spin_lock_irqsave(&ha->state_lock, flags); | 491 | spin_lock_irqsave(&ha->state_lock, flags); |
483 | sas_chain_work(ha, work); | 492 | sas_chain_work(ha, sw); |
484 | spin_unlock_irqrestore(&ha->state_lock, flags); | 493 | spin_unlock_irqrestore(&ha->state_lock, flags); |
485 | } | 494 | } |
486 | } | 495 | } |
@@ -519,7 +528,7 @@ void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *port) | |||
519 | 528 | ||
520 | disc->pending = 0; | 529 | disc->pending = 0; |
521 | for (i = 0; i < DISC_NUM_EVENTS; i++) { | 530 | for (i = 0; i < DISC_NUM_EVENTS; i++) { |
522 | INIT_WORK(&disc->disc_work[i].work, sas_event_fns[i]); | 531 | INIT_SAS_WORK(&disc->disc_work[i].work, sas_event_fns[i]); |
523 | disc->disc_work[i].port = port; | 532 | disc->disc_work[i].port = port; |
524 | } | 533 | } |
525 | } | 534 | } |
diff --git a/drivers/scsi/libsas/sas_event.c b/drivers/scsi/libsas/sas_event.c index 16639bbae629..4e4292d210c1 100644 --- a/drivers/scsi/libsas/sas_event.c +++ b/drivers/scsi/libsas/sas_event.c | |||
@@ -27,19 +27,21 @@ | |||
27 | #include "sas_internal.h" | 27 | #include "sas_internal.h" |
28 | #include "sas_dump.h" | 28 | #include "sas_dump.h" |
29 | 29 | ||
30 | void sas_queue_work(struct sas_ha_struct *ha, struct work_struct *work) | 30 | void sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw) |
31 | { | 31 | { |
32 | if (!test_bit(SAS_HA_REGISTERED, &ha->state)) | 32 | if (!test_bit(SAS_HA_REGISTERED, &ha->state)) |
33 | return; | 33 | return; |
34 | 34 | ||
35 | if (test_bit(SAS_HA_DRAINING, &ha->state)) | 35 | if (test_bit(SAS_HA_DRAINING, &ha->state)) { |
36 | list_add(&work->entry, &ha->defer_q); | 36 | /* add it to the defer list, if not already pending */ |
37 | else | 37 | if (list_empty(&sw->drain_node)) |
38 | scsi_queue_work(ha->core.shost, work); | 38 | list_add(&sw->drain_node, &ha->defer_q); |
39 | } else | ||
40 | scsi_queue_work(ha->core.shost, &sw->work); | ||
39 | } | 41 | } |
40 | 42 | ||
41 | static void sas_queue_event(int event, unsigned long *pending, | 43 | static void sas_queue_event(int event, unsigned long *pending, |
42 | struct work_struct *work, | 44 | struct sas_work *work, |
43 | struct sas_ha_struct *ha) | 45 | struct sas_ha_struct *ha) |
44 | { | 46 | { |
45 | if (!test_and_set_bit(event, pending)) { | 47 | if (!test_and_set_bit(event, pending)) { |
@@ -55,7 +57,7 @@ static void sas_queue_event(int event, unsigned long *pending, | |||
55 | void __sas_drain_work(struct sas_ha_struct *ha) | 57 | void __sas_drain_work(struct sas_ha_struct *ha) |
56 | { | 58 | { |
57 | struct workqueue_struct *wq = ha->core.shost->work_q; | 59 | struct workqueue_struct *wq = ha->core.shost->work_q; |
58 | struct work_struct *w, *_w; | 60 | struct sas_work *sw, *_sw; |
59 | 61 | ||
60 | set_bit(SAS_HA_DRAINING, &ha->state); | 62 | set_bit(SAS_HA_DRAINING, &ha->state); |
61 | /* flush submitters */ | 63 | /* flush submitters */ |
@@ -66,9 +68,9 @@ void __sas_drain_work(struct sas_ha_struct *ha) | |||
66 | 68 | ||
67 | spin_lock_irq(&ha->state_lock); | 69 | spin_lock_irq(&ha->state_lock); |
68 | clear_bit(SAS_HA_DRAINING, &ha->state); | 70 | clear_bit(SAS_HA_DRAINING, &ha->state); |
69 | list_for_each_entry_safe(w, _w, &ha->defer_q, entry) { | 71 | list_for_each_entry_safe(sw, _sw, &ha->defer_q, drain_node) { |
70 | list_del_init(&w->entry); | 72 | list_del_init(&sw->drain_node); |
71 | sas_queue_work(ha, w); | 73 | sas_queue_work(ha, sw); |
72 | } | 74 | } |
73 | spin_unlock_irq(&ha->state_lock); | 75 | spin_unlock_irq(&ha->state_lock); |
74 | } | 76 | } |
@@ -151,7 +153,7 @@ int sas_init_events(struct sas_ha_struct *sas_ha) | |||
151 | int i; | 153 | int i; |
152 | 154 | ||
153 | for (i = 0; i < HA_NUM_EVENTS; i++) { | 155 | for (i = 0; i < HA_NUM_EVENTS; i++) { |
154 | INIT_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); | 156 | INIT_SAS_WORK(&sas_ha->ha_events[i].work, sas_ha_event_fns[i]); |
155 | sas_ha->ha_events[i].ha = sas_ha; | 157 | sas_ha->ha_events[i].ha = sas_ha; |
156 | } | 158 | } |
157 | 159 | ||
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index 05acd9e35fc4..caa0525d2523 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c | |||
@@ -202,6 +202,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
202 | u8 sas_addr[SAS_ADDR_SIZE]; | 202 | u8 sas_addr[SAS_ADDR_SIZE]; |
203 | struct smp_resp *resp = rsp; | 203 | struct smp_resp *resp = rsp; |
204 | struct discover_resp *dr = &resp->disc; | 204 | struct discover_resp *dr = &resp->disc; |
205 | struct sas_ha_struct *ha = dev->port->ha; | ||
205 | struct expander_device *ex = &dev->ex_dev; | 206 | struct expander_device *ex = &dev->ex_dev; |
206 | struct ex_phy *phy = &ex->ex_phy[phy_id]; | 207 | struct ex_phy *phy = &ex->ex_phy[phy_id]; |
207 | struct sas_rphy *rphy = dev->rphy; | 208 | struct sas_rphy *rphy = dev->rphy; |
@@ -209,6 +210,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
209 | char *type; | 210 | char *type; |
210 | 211 | ||
211 | if (new_phy) { | 212 | if (new_phy) { |
213 | if (WARN_ON_ONCE(test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state))) | ||
214 | return; | ||
212 | phy->phy = sas_phy_alloc(&rphy->dev, phy_id); | 215 | phy->phy = sas_phy_alloc(&rphy->dev, phy_id); |
213 | 216 | ||
214 | /* FIXME: error_handling */ | 217 | /* FIXME: error_handling */ |
@@ -233,6 +236,8 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
233 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); | 236 | memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); |
234 | 237 | ||
235 | phy->attached_dev_type = to_dev_type(dr); | 238 | phy->attached_dev_type = to_dev_type(dr); |
239 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | ||
240 | goto out; | ||
236 | phy->phy_id = phy_id; | 241 | phy->phy_id = phy_id; |
237 | phy->linkrate = dr->linkrate; | 242 | phy->linkrate = dr->linkrate; |
238 | phy->attached_sata_host = dr->attached_sata_host; | 243 | phy->attached_sata_host = dr->attached_sata_host; |
@@ -240,7 +245,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
240 | phy->attached_sata_ps = dr->attached_sata_ps; | 245 | phy->attached_sata_ps = dr->attached_sata_ps; |
241 | phy->attached_iproto = dr->iproto << 1; | 246 | phy->attached_iproto = dr->iproto << 1; |
242 | phy->attached_tproto = dr->tproto << 1; | 247 | phy->attached_tproto = dr->tproto << 1; |
243 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | 248 | /* help some expanders that fail to zero sas_address in the 'no |
249 | * device' case | ||
250 | */ | ||
251 | if (phy->attached_dev_type == NO_DEVICE || | ||
252 | phy->linkrate < SAS_LINK_RATE_1_5_GBPS) | ||
253 | memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE); | ||
254 | else | ||
255 | memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE); | ||
244 | phy->attached_phy_id = dr->attached_phy_id; | 256 | phy->attached_phy_id = dr->attached_phy_id; |
245 | phy->phy_change_count = dr->change_count; | 257 | phy->phy_change_count = dr->change_count; |
246 | phy->routing_attr = dr->routing_attr; | 258 | phy->routing_attr = dr->routing_attr; |
@@ -266,6 +278,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
266 | return; | 278 | return; |
267 | } | 279 | } |
268 | 280 | ||
281 | out: | ||
269 | switch (phy->attached_dev_type) { | 282 | switch (phy->attached_dev_type) { |
270 | case SATA_PENDING: | 283 | case SATA_PENDING: |
271 | type = "stp pending"; | 284 | type = "stp pending"; |
@@ -304,7 +317,15 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp) | |||
304 | else | 317 | else |
305 | return; | 318 | return; |
306 | 319 | ||
307 | SAS_DPRINTK("ex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", | 320 | /* if the attached device type changed and ata_eh is active, |
321 | * make sure we run revalidation when eh completes (see: | ||
322 | * sas_enable_revalidation) | ||
323 | */ | ||
324 | if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) | ||
325 | set_bit(DISCE_REVALIDATE_DOMAIN, &dev->port->disc.pending); | ||
326 | |||
327 | SAS_DPRINTK("%sex %016llx phy%02d:%c:%X attached: %016llx (%s)\n", | ||
328 | test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state) ? "ata: " : "", | ||
308 | SAS_ADDR(dev->sas_addr), phy->phy_id, | 329 | SAS_ADDR(dev->sas_addr), phy->phy_id, |
309 | sas_route_char(dev, phy), phy->linkrate, | 330 | sas_route_char(dev, phy), phy->linkrate, |
310 | SAS_ADDR(phy->attached_sas_addr), type); | 331 | SAS_ADDR(phy->attached_sas_addr), type); |
@@ -776,13 +797,16 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
776 | if (res) | 797 | if (res) |
777 | goto out_free; | 798 | goto out_free; |
778 | 799 | ||
800 | sas_init_dev(child); | ||
801 | res = sas_ata_init(child); | ||
802 | if (res) | ||
803 | goto out_free; | ||
779 | rphy = sas_end_device_alloc(phy->port); | 804 | rphy = sas_end_device_alloc(phy->port); |
780 | if (unlikely(!rphy)) | 805 | if (!rphy) |
781 | goto out_free; | 806 | goto out_free; |
782 | 807 | ||
783 | sas_init_dev(child); | ||
784 | |||
785 | child->rphy = rphy; | 808 | child->rphy = rphy; |
809 | get_device(&rphy->dev); | ||
786 | 810 | ||
787 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
788 | 812 | ||
@@ -806,6 +830,7 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
806 | sas_init_dev(child); | 830 | sas_init_dev(child); |
807 | 831 | ||
808 | child->rphy = rphy; | 832 | child->rphy = rphy; |
833 | get_device(&rphy->dev); | ||
809 | sas_fill_in_rphy(child, rphy); | 834 | sas_fill_in_rphy(child, rphy); |
810 | 835 | ||
811 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); | 836 | list_add_tail(&child->disco_list_node, &parent->port->disco_list); |
@@ -830,8 +855,6 @@ static struct domain_device *sas_ex_discover_end_dev( | |||
830 | 855 | ||
831 | out_list_del: | 856 | out_list_del: |
832 | sas_rphy_free(child->rphy); | 857 | sas_rphy_free(child->rphy); |
833 | child->rphy = NULL; | ||
834 | |||
835 | list_del(&child->disco_list_node); | 858 | list_del(&child->disco_list_node); |
836 | spin_lock_irq(&parent->port->dev_list_lock); | 859 | spin_lock_irq(&parent->port->dev_list_lock); |
837 | list_del(&child->dev_list_node); | 860 | list_del(&child->dev_list_node); |
@@ -911,6 +934,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
911 | } | 934 | } |
912 | port = parent->port; | 935 | port = parent->port; |
913 | child->rphy = rphy; | 936 | child->rphy = rphy; |
937 | get_device(&rphy->dev); | ||
914 | edev = rphy_to_expander_device(rphy); | 938 | edev = rphy_to_expander_device(rphy); |
915 | child->dev_type = phy->attached_dev_type; | 939 | child->dev_type = phy->attached_dev_type; |
916 | kref_get(&parent->kref); | 940 | kref_get(&parent->kref); |
@@ -934,6 +958,7 @@ static struct domain_device *sas_ex_discover_expander( | |||
934 | 958 | ||
935 | res = sas_discover_expander(child); | 959 | res = sas_discover_expander(child); |
936 | if (res) { | 960 | if (res) { |
961 | sas_rphy_delete(rphy); | ||
937 | spin_lock_irq(&parent->port->dev_list_lock); | 962 | spin_lock_irq(&parent->port->dev_list_lock); |
938 | list_del(&child->dev_list_node); | 963 | list_del(&child->dev_list_node); |
939 | spin_unlock_irq(&parent->port->dev_list_lock); | 964 | spin_unlock_irq(&parent->port->dev_list_lock); |
@@ -1718,9 +1743,17 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | |||
1718 | int phy_change_count = 0; | 1743 | int phy_change_count = 0; |
1719 | 1744 | ||
1720 | res = sas_get_phy_change_count(dev, i, &phy_change_count); | 1745 | res = sas_get_phy_change_count(dev, i, &phy_change_count); |
1721 | if (res) | 1746 | switch (res) { |
1722 | goto out; | 1747 | case SMP_RESP_PHY_VACANT: |
1723 | else if (phy_change_count != ex->ex_phy[i].phy_change_count) { | 1748 | case SMP_RESP_NO_PHY: |
1749 | continue; | ||
1750 | case SMP_RESP_FUNC_ACC: | ||
1751 | break; | ||
1752 | default: | ||
1753 | return res; | ||
1754 | } | ||
1755 | |||
1756 | if (phy_change_count != ex->ex_phy[i].phy_change_count) { | ||
1724 | if (update) | 1757 | if (update) |
1725 | ex->ex_phy[i].phy_change_count = | 1758 | ex->ex_phy[i].phy_change_count = |
1726 | phy_change_count; | 1759 | phy_change_count; |
@@ -1728,8 +1761,7 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id, | |||
1728 | return 0; | 1761 | return 0; |
1729 | } | 1762 | } |
1730 | } | 1763 | } |
1731 | out: | 1764 | return 0; |
1732 | return res; | ||
1733 | } | 1765 | } |
1734 | 1766 | ||
1735 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) | 1767 | static int sas_get_ex_change_count(struct domain_device *dev, int *ecc) |
diff --git a/drivers/scsi/libsas/sas_init.c b/drivers/scsi/libsas/sas_init.c index 120bff64be30..10cb5ae30977 100644 --- a/drivers/scsi/libsas/sas_init.c +++ b/drivers/scsi/libsas/sas_init.c | |||
@@ -94,8 +94,7 @@ void sas_hash_addr(u8 *hashed, const u8 *sas_addr) | |||
94 | 94 | ||
95 | void sas_hae_reset(struct work_struct *work) | 95 | void sas_hae_reset(struct work_struct *work) |
96 | { | 96 | { |
97 | struct sas_ha_event *ev = | 97 | struct sas_ha_event *ev = to_sas_ha_event(work); |
98 | container_of(work, struct sas_ha_event, work); | ||
99 | struct sas_ha_struct *ha = ev->ha; | 98 | struct sas_ha_struct *ha = ev->ha; |
100 | 99 | ||
101 | clear_bit(HAE_RESET, &ha->pending); | 100 | clear_bit(HAE_RESET, &ha->pending); |
@@ -369,14 +368,14 @@ static void sas_phy_release(struct sas_phy *phy) | |||
369 | 368 | ||
370 | static void phy_reset_work(struct work_struct *work) | 369 | static void phy_reset_work(struct work_struct *work) |
371 | { | 370 | { |
372 | struct sas_phy_data *d = container_of(work, typeof(*d), reset_work); | 371 | struct sas_phy_data *d = container_of(work, typeof(*d), reset_work.work); |
373 | 372 | ||
374 | d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset); | 373 | d->reset_result = transport_sas_phy_reset(d->phy, d->hard_reset); |
375 | } | 374 | } |
376 | 375 | ||
377 | static void phy_enable_work(struct work_struct *work) | 376 | static void phy_enable_work(struct work_struct *work) |
378 | { | 377 | { |
379 | struct sas_phy_data *d = container_of(work, typeof(*d), enable_work); | 378 | struct sas_phy_data *d = container_of(work, typeof(*d), enable_work.work); |
380 | 379 | ||
381 | d->enable_result = sas_phy_enable(d->phy, d->enable); | 380 | d->enable_result = sas_phy_enable(d->phy, d->enable); |
382 | } | 381 | } |
@@ -389,8 +388,8 @@ static int sas_phy_setup(struct sas_phy *phy) | |||
389 | return -ENOMEM; | 388 | return -ENOMEM; |
390 | 389 | ||
391 | mutex_init(&d->event_lock); | 390 | mutex_init(&d->event_lock); |
392 | INIT_WORK(&d->reset_work, phy_reset_work); | 391 | INIT_SAS_WORK(&d->reset_work, phy_reset_work); |
393 | INIT_WORK(&d->enable_work, phy_enable_work); | 392 | INIT_SAS_WORK(&d->enable_work, phy_enable_work); |
394 | d->phy = phy; | 393 | d->phy = phy; |
395 | phy->hostdata = d; | 394 | phy->hostdata = d; |
396 | 395 | ||
diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h index f05c63879949..507e4cf12e56 100644 --- a/drivers/scsi/libsas/sas_internal.h +++ b/drivers/scsi/libsas/sas_internal.h | |||
@@ -45,10 +45,10 @@ struct sas_phy_data { | |||
45 | struct mutex event_lock; | 45 | struct mutex event_lock; |
46 | int hard_reset; | 46 | int hard_reset; |
47 | int reset_result; | 47 | int reset_result; |
48 | struct work_struct reset_work; | 48 | struct sas_work reset_work; |
49 | int enable; | 49 | int enable; |
50 | int enable_result; | 50 | int enable_result; |
51 | struct work_struct enable_work; | 51 | struct sas_work enable_work; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | void sas_scsi_recover_host(struct Scsi_Host *shost); | 54 | void sas_scsi_recover_host(struct Scsi_Host *shost); |
@@ -80,7 +80,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work); | |||
80 | void sas_porte_link_reset_err(struct work_struct *work); | 80 | void sas_porte_link_reset_err(struct work_struct *work); |
81 | void sas_porte_timer_event(struct work_struct *work); | 81 | void sas_porte_timer_event(struct work_struct *work); |
82 | void sas_porte_hard_reset(struct work_struct *work); | 82 | void sas_porte_hard_reset(struct work_struct *work); |
83 | void sas_queue_work(struct sas_ha_struct *ha, struct work_struct *work); | 83 | void sas_queue_work(struct sas_ha_struct *ha, struct sas_work *sw); |
84 | 84 | ||
85 | int sas_notify_lldd_dev_found(struct domain_device *); | 85 | int sas_notify_lldd_dev_found(struct domain_device *); |
86 | void sas_notify_lldd_dev_gone(struct domain_device *); | 86 | void sas_notify_lldd_dev_gone(struct domain_device *); |
diff --git a/drivers/scsi/libsas/sas_phy.c b/drivers/scsi/libsas/sas_phy.c index dcfd4a9105c5..521422e857ab 100644 --- a/drivers/scsi/libsas/sas_phy.c +++ b/drivers/scsi/libsas/sas_phy.c | |||
@@ -32,8 +32,7 @@ | |||
32 | 32 | ||
33 | static void sas_phye_loss_of_signal(struct work_struct *work) | 33 | static void sas_phye_loss_of_signal(struct work_struct *work) |
34 | { | 34 | { |
35 | struct asd_sas_event *ev = | 35 | struct asd_sas_event *ev = to_asd_sas_event(work); |
36 | container_of(work, struct asd_sas_event, work); | ||
37 | struct asd_sas_phy *phy = ev->phy; | 36 | struct asd_sas_phy *phy = ev->phy; |
38 | 37 | ||
39 | clear_bit(PHYE_LOSS_OF_SIGNAL, &phy->phy_events_pending); | 38 | clear_bit(PHYE_LOSS_OF_SIGNAL, &phy->phy_events_pending); |
@@ -43,8 +42,7 @@ static void sas_phye_loss_of_signal(struct work_struct *work) | |||
43 | 42 | ||
44 | static void sas_phye_oob_done(struct work_struct *work) | 43 | static void sas_phye_oob_done(struct work_struct *work) |
45 | { | 44 | { |
46 | struct asd_sas_event *ev = | 45 | struct asd_sas_event *ev = to_asd_sas_event(work); |
47 | container_of(work, struct asd_sas_event, work); | ||
48 | struct asd_sas_phy *phy = ev->phy; | 46 | struct asd_sas_phy *phy = ev->phy; |
49 | 47 | ||
50 | clear_bit(PHYE_OOB_DONE, &phy->phy_events_pending); | 48 | clear_bit(PHYE_OOB_DONE, &phy->phy_events_pending); |
@@ -53,8 +51,7 @@ static void sas_phye_oob_done(struct work_struct *work) | |||
53 | 51 | ||
54 | static void sas_phye_oob_error(struct work_struct *work) | 52 | static void sas_phye_oob_error(struct work_struct *work) |
55 | { | 53 | { |
56 | struct asd_sas_event *ev = | 54 | struct asd_sas_event *ev = to_asd_sas_event(work); |
57 | container_of(work, struct asd_sas_event, work); | ||
58 | struct asd_sas_phy *phy = ev->phy; | 55 | struct asd_sas_phy *phy = ev->phy; |
59 | struct sas_ha_struct *sas_ha = phy->ha; | 56 | struct sas_ha_struct *sas_ha = phy->ha; |
60 | struct asd_sas_port *port = phy->port; | 57 | struct asd_sas_port *port = phy->port; |
@@ -85,8 +82,7 @@ static void sas_phye_oob_error(struct work_struct *work) | |||
85 | 82 | ||
86 | static void sas_phye_spinup_hold(struct work_struct *work) | 83 | static void sas_phye_spinup_hold(struct work_struct *work) |
87 | { | 84 | { |
88 | struct asd_sas_event *ev = | 85 | struct asd_sas_event *ev = to_asd_sas_event(work); |
89 | container_of(work, struct asd_sas_event, work); | ||
90 | struct asd_sas_phy *phy = ev->phy; | 86 | struct asd_sas_phy *phy = ev->phy; |
91 | struct sas_ha_struct *sas_ha = phy->ha; | 87 | struct sas_ha_struct *sas_ha = phy->ha; |
92 | struct sas_internal *i = | 88 | struct sas_internal *i = |
@@ -127,14 +123,12 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
127 | phy->error = 0; | 123 | phy->error = 0; |
128 | INIT_LIST_HEAD(&phy->port_phy_el); | 124 | INIT_LIST_HEAD(&phy->port_phy_el); |
129 | for (k = 0; k < PORT_NUM_EVENTS; k++) { | 125 | for (k = 0; k < PORT_NUM_EVENTS; k++) { |
130 | INIT_WORK(&phy->port_events[k].work, | 126 | INIT_SAS_WORK(&phy->port_events[k].work, sas_port_event_fns[k]); |
131 | sas_port_event_fns[k]); | ||
132 | phy->port_events[k].phy = phy; | 127 | phy->port_events[k].phy = phy; |
133 | } | 128 | } |
134 | 129 | ||
135 | for (k = 0; k < PHY_NUM_EVENTS; k++) { | 130 | for (k = 0; k < PHY_NUM_EVENTS; k++) { |
136 | INIT_WORK(&phy->phy_events[k].work, | 131 | INIT_SAS_WORK(&phy->phy_events[k].work, sas_phy_event_fns[k]); |
137 | sas_phy_event_fns[k]); | ||
138 | phy->phy_events[k].phy = phy; | 132 | phy->phy_events[k].phy = phy; |
139 | } | 133 | } |
140 | 134 | ||
@@ -144,8 +138,7 @@ int sas_register_phys(struct sas_ha_struct *sas_ha) | |||
144 | spin_lock_init(&phy->sas_prim_lock); | 138 | spin_lock_init(&phy->sas_prim_lock); |
145 | phy->frame_rcvd_size = 0; | 139 | phy->frame_rcvd_size = 0; |
146 | 140 | ||
147 | phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, | 141 | phy->phy = sas_phy_alloc(&sas_ha->core.shost->shost_gendev, i); |
148 | i); | ||
149 | if (!phy->phy) | 142 | if (!phy->phy) |
150 | return -ENOMEM; | 143 | return -ENOMEM; |
151 | 144 | ||
diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c index eb19c016d500..e884a8c58a0c 100644 --- a/drivers/scsi/libsas/sas_port.c +++ b/drivers/scsi/libsas/sas_port.c | |||
@@ -123,7 +123,7 @@ static void sas_form_port(struct asd_sas_phy *phy) | |||
123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); | 123 | spin_unlock_irqrestore(&sas_ha->phy_port_lock, flags); |
124 | 124 | ||
125 | if (!port->port) { | 125 | if (!port->port) { |
126 | port->port = sas_port_alloc(phy->phy->dev.parent, phy->id); | 126 | port->port = sas_port_alloc(phy->phy->dev.parent, port->id); |
127 | BUG_ON(!port->port); | 127 | BUG_ON(!port->port); |
128 | sas_port_add(port->port); | 128 | sas_port_add(port->port); |
129 | } | 129 | } |
@@ -208,8 +208,7 @@ void sas_deform_port(struct asd_sas_phy *phy, int gone) | |||
208 | 208 | ||
209 | void sas_porte_bytes_dmaed(struct work_struct *work) | 209 | void sas_porte_bytes_dmaed(struct work_struct *work) |
210 | { | 210 | { |
211 | struct asd_sas_event *ev = | 211 | struct asd_sas_event *ev = to_asd_sas_event(work); |
212 | container_of(work, struct asd_sas_event, work); | ||
213 | struct asd_sas_phy *phy = ev->phy; | 212 | struct asd_sas_phy *phy = ev->phy; |
214 | 213 | ||
215 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); | 214 | clear_bit(PORTE_BYTES_DMAED, &phy->port_events_pending); |
@@ -219,8 +218,7 @@ void sas_porte_bytes_dmaed(struct work_struct *work) | |||
219 | 218 | ||
220 | void sas_porte_broadcast_rcvd(struct work_struct *work) | 219 | void sas_porte_broadcast_rcvd(struct work_struct *work) |
221 | { | 220 | { |
222 | struct asd_sas_event *ev = | 221 | struct asd_sas_event *ev = to_asd_sas_event(work); |
223 | container_of(work, struct asd_sas_event, work); | ||
224 | struct asd_sas_phy *phy = ev->phy; | 222 | struct asd_sas_phy *phy = ev->phy; |
225 | unsigned long flags; | 223 | unsigned long flags; |
226 | u32 prim; | 224 | u32 prim; |
@@ -237,8 +235,7 @@ void sas_porte_broadcast_rcvd(struct work_struct *work) | |||
237 | 235 | ||
238 | void sas_porte_link_reset_err(struct work_struct *work) | 236 | void sas_porte_link_reset_err(struct work_struct *work) |
239 | { | 237 | { |
240 | struct asd_sas_event *ev = | 238 | struct asd_sas_event *ev = to_asd_sas_event(work); |
241 | container_of(work, struct asd_sas_event, work); | ||
242 | struct asd_sas_phy *phy = ev->phy; | 239 | struct asd_sas_phy *phy = ev->phy; |
243 | 240 | ||
244 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); | 241 | clear_bit(PORTE_LINK_RESET_ERR, &phy->port_events_pending); |
@@ -248,8 +245,7 @@ void sas_porte_link_reset_err(struct work_struct *work) | |||
248 | 245 | ||
249 | void sas_porte_timer_event(struct work_struct *work) | 246 | void sas_porte_timer_event(struct work_struct *work) |
250 | { | 247 | { |
251 | struct asd_sas_event *ev = | 248 | struct asd_sas_event *ev = to_asd_sas_event(work); |
252 | container_of(work, struct asd_sas_event, work); | ||
253 | struct asd_sas_phy *phy = ev->phy; | 249 | struct asd_sas_phy *phy = ev->phy; |
254 | 250 | ||
255 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); | 251 | clear_bit(PORTE_TIMER_EVENT, &phy->port_events_pending); |
@@ -259,8 +255,7 @@ void sas_porte_timer_event(struct work_struct *work) | |||
259 | 255 | ||
260 | void sas_porte_hard_reset(struct work_struct *work) | 256 | void sas_porte_hard_reset(struct work_struct *work) |
261 | { | 257 | { |
262 | struct asd_sas_event *ev = | 258 | struct asd_sas_event *ev = to_asd_sas_event(work); |
263 | container_of(work, struct asd_sas_event, work); | ||
264 | struct asd_sas_phy *phy = ev->phy; | 259 | struct asd_sas_phy *phy = ev->phy; |
265 | 260 | ||
266 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); | 261 | clear_bit(PORTE_HARD_RESET, &phy->port_events_pending); |
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 5bdf2eecb178..af04b0d6688d 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -997,13 +997,6 @@ lpfc_debugfs_dumpDataDif_write(struct file *file, const char __user *buf, | |||
997 | return nbytes; | 997 | return nbytes; |
998 | } | 998 | } |
999 | 999 | ||
1000 | static int | ||
1001 | lpfc_debugfs_dif_err_open(struct inode *inode, struct file *file) | ||
1002 | { | ||
1003 | file->private_data = inode->i_private; | ||
1004 | return 0; | ||
1005 | } | ||
1006 | |||
1007 | static ssize_t | 1000 | static ssize_t |
1008 | lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, | 1001 | lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, |
1009 | size_t nbytes, loff_t *ppos) | 1002 | size_t nbytes, loff_t *ppos) |
@@ -3541,7 +3534,7 @@ static const struct file_operations lpfc_debugfs_op_dumpDif = { | |||
3541 | #undef lpfc_debugfs_op_dif_err | 3534 | #undef lpfc_debugfs_op_dif_err |
3542 | static const struct file_operations lpfc_debugfs_op_dif_err = { | 3535 | static const struct file_operations lpfc_debugfs_op_dif_err = { |
3543 | .owner = THIS_MODULE, | 3536 | .owner = THIS_MODULE, |
3544 | .open = lpfc_debugfs_dif_err_open, | 3537 | .open = simple_open, |
3545 | .llseek = lpfc_debugfs_lseek, | 3538 | .llseek = lpfc_debugfs_lseek, |
3546 | .read = lpfc_debugfs_dif_err_read, | 3539 | .read = lpfc_debugfs_dif_err_read, |
3547 | .write = lpfc_debugfs_dif_err_write, | 3540 | .write = lpfc_debugfs_dif_err_write, |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 2cfcbffa41fd..386f0c53bea7 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -835,7 +835,7 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, unsigned char *cmnd, | |||
835 | 835 | ||
836 | scsi_eh_restore_cmnd(scmd, &ses); | 836 | scsi_eh_restore_cmnd(scmd, &ses); |
837 | 837 | ||
838 | if (sdrv->eh_action) | 838 | if (sdrv && sdrv->eh_action) |
839 | rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); | 839 | rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); |
840 | 840 | ||
841 | return rtn; | 841 | return rtn; |
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-davinci.c b/drivers/spi/spi-davinci.c index 31bfba805cf4..9b2901feaf78 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -653,7 +653,7 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
653 | dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n", | 653 | dev_dbg(sdev, "Couldn't DMA map a %d bytes RX buffer\n", |
654 | rx_buf_count); | 654 | rx_buf_count); |
655 | if (t->tx_buf) | 655 | if (t->tx_buf) |
656 | dma_unmap_single(NULL, t->tx_dma, t->len, | 656 | dma_unmap_single(&spi->dev, t->tx_dma, t->len, |
657 | DMA_TO_DEVICE); | 657 | DMA_TO_DEVICE); |
658 | return -ENOMEM; | 658 | return -ENOMEM; |
659 | } | 659 | } |
@@ -692,10 +692,10 @@ static int davinci_spi_bufs(struct spi_device *spi, struct spi_transfer *t) | |||
692 | if (spicfg->io_type == SPI_IO_TYPE_DMA) { | 692 | if (spicfg->io_type == SPI_IO_TYPE_DMA) { |
693 | 693 | ||
694 | if (t->tx_buf) | 694 | if (t->tx_buf) |
695 | dma_unmap_single(NULL, t->tx_dma, t->len, | 695 | dma_unmap_single(&spi->dev, t->tx_dma, t->len, |
696 | DMA_TO_DEVICE); | 696 | DMA_TO_DEVICE); |
697 | 697 | ||
698 | dma_unmap_single(NULL, t->rx_dma, rx_buf_count, | 698 | dma_unmap_single(&spi->dev, t->rx_dma, rx_buf_count, |
699 | DMA_FROM_DEVICE); | 699 | DMA_FROM_DEVICE); |
700 | 700 | ||
701 | clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN); | 701 | clear_io_bits(dspi->base + SPIINT, SPIINT_DMA_REQ_EN); |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 082458d73ce9..d1a495f64e2d 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -63,12 +63,6 @@ struct chip_data { | |||
63 | }; | 63 | }; |
64 | 64 | ||
65 | #ifdef CONFIG_DEBUG_FS | 65 | #ifdef CONFIG_DEBUG_FS |
66 | static int spi_show_regs_open(struct inode *inode, struct file *file) | ||
67 | { | ||
68 | file->private_data = inode->i_private; | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | #define SPI_REGS_BUFSIZE 1024 | 66 | #define SPI_REGS_BUFSIZE 1024 |
73 | static ssize_t spi_show_regs(struct file *file, char __user *user_buf, | 67 | static ssize_t spi_show_regs(struct file *file, char __user *user_buf, |
74 | size_t count, loff_t *ppos) | 68 | size_t count, loff_t *ppos) |
@@ -128,7 +122,7 @@ static ssize_t spi_show_regs(struct file *file, char __user *user_buf, | |||
128 | 122 | ||
129 | static const struct file_operations mrst_spi_regs_ops = { | 123 | static const struct file_operations mrst_spi_regs_ops = { |
130 | .owner = THIS_MODULE, | 124 | .owner = THIS_MODULE, |
131 | .open = spi_show_regs_open, | 125 | .open = simple_open, |
132 | .read = spi_show_regs, | 126 | .read = spi_show_regs, |
133 | .llseek = default_llseek, | 127 | .llseek = default_llseek, |
134 | }; | 128 | }; |
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-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 24cacff57786..5f748c0d96bd 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi) | |||
139 | static void fsl_spi_chipselect(struct spi_device *spi, int value) | 139 | static void fsl_spi_chipselect(struct spi_device *spi, int value) |
140 | { | 140 | { |
141 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 141 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); |
142 | struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data; | 142 | struct fsl_spi_platform_data *pdata; |
143 | bool pol = spi->mode & SPI_CS_HIGH; | 143 | bool pol = spi->mode & SPI_CS_HIGH; |
144 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 144 | struct spi_mpc8xxx_cs *cs = spi->controller_state; |
145 | 145 | ||
146 | pdata = spi->dev.parent->parent->platform_data; | ||
147 | |||
146 | if (value == BITBANG_CS_INACTIVE) { | 148 | if (value == BITBANG_CS_INACTIVE) { |
147 | if (pdata->cs_control) | 149 | if (pdata->cs_control) |
148 | pdata->cs_control(spi, !pol); | 150 | pdata->cs_control(spi, !pol); |
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c index 31054e3de4c1..570f22053be8 100644 --- a/drivers/spi/spi-imx.c +++ b/drivers/spi/spi-imx.c | |||
@@ -83,7 +83,7 @@ struct spi_imx_data { | |||
83 | struct spi_bitbang bitbang; | 83 | struct spi_bitbang bitbang; |
84 | 84 | ||
85 | struct completion xfer_done; | 85 | struct completion xfer_done; |
86 | void *base; | 86 | void __iomem *base; |
87 | int irq; | 87 | int irq; |
88 | struct clk *clk; | 88 | struct clk *clk; |
89 | unsigned long spi_clk; | 89 | unsigned long spi_clk; |
@@ -766,8 +766,12 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
766 | } | 766 | } |
767 | 767 | ||
768 | ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs); | 768 | ret = of_property_read_u32(np, "fsl,spi-num-chipselects", &num_cs); |
769 | if (ret < 0) | 769 | if (ret < 0) { |
770 | num_cs = mxc_platform_info->num_chipselect; | 770 | if (mxc_platform_info) |
771 | num_cs = mxc_platform_info->num_chipselect; | ||
772 | else | ||
773 | return ret; | ||
774 | } | ||
771 | 775 | ||
772 | master = spi_alloc_master(&pdev->dev, | 776 | master = spi_alloc_master(&pdev->dev, |
773 | sizeof(struct spi_imx_data) + sizeof(int) * num_cs); | 777 | sizeof(struct spi_imx_data) + sizeof(int) * num_cs); |
@@ -784,7 +788,7 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
784 | 788 | ||
785 | for (i = 0; i < master->num_chipselect; i++) { | 789 | for (i = 0; i < master->num_chipselect; i++) { |
786 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); | 790 | int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); |
787 | if (cs_gpio < 0) | 791 | if (cs_gpio < 0 && mxc_platform_info) |
788 | cs_gpio = mxc_platform_info->chipselect[i]; | 792 | cs_gpio = mxc_platform_info->chipselect[i]; |
789 | 793 | ||
790 | spi_imx->chipselect[i] = cs_gpio; | 794 | spi_imx->chipselect[i] = cs_gpio; |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 96f0da66b185..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 */ |
@@ -2195,7 +2205,6 @@ static int pl022_runtime_suspend(struct device *dev) | |||
2195 | struct pl022 *pl022 = dev_get_drvdata(dev); | 2205 | struct pl022 *pl022 = dev_get_drvdata(dev); |
2196 | 2206 | ||
2197 | clk_disable(pl022->clk); | 2207 | clk_disable(pl022->clk); |
2198 | amba_vcore_disable(pl022->adev); | ||
2199 | 2208 | ||
2200 | return 0; | 2209 | return 0; |
2201 | } | 2210 | } |
@@ -2204,7 +2213,6 @@ static int pl022_runtime_resume(struct device *dev) | |||
2204 | { | 2213 | { |
2205 | struct pl022 *pl022 = dev_get_drvdata(dev); | 2214 | struct pl022 *pl022 = dev_get_drvdata(dev); |
2206 | 2215 | ||
2207 | amba_vcore_enable(pl022->adev); | ||
2208 | clk_enable(pl022->clk); | 2216 | clk_enable(pl022->clk); |
2209 | 2217 | ||
2210 | return 0; | 2218 | return 0; |
diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 08a3b1133d29..eb1dee26bda3 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig | |||
@@ -27,13 +27,14 @@ config ANDROID_LOGGER | |||
27 | 27 | ||
28 | config ANDROID_PERSISTENT_RAM | 28 | config ANDROID_PERSISTENT_RAM |
29 | bool | 29 | bool |
30 | depends on HAVE_MEMBLOCK | ||
30 | select REED_SOLOMON | 31 | select REED_SOLOMON |
31 | select REED_SOLOMON_ENC8 | 32 | select REED_SOLOMON_ENC8 |
32 | select REED_SOLOMON_DEC8 | 33 | select REED_SOLOMON_DEC8 |
33 | 34 | ||
34 | config ANDROID_RAM_CONSOLE | 35 | config ANDROID_RAM_CONSOLE |
35 | bool "Android RAM buffer console" | 36 | bool "Android RAM buffer console" |
36 | depends on !S390 && !UML | 37 | depends on !S390 && !UML && HAVE_MEMBLOCK |
37 | select ANDROID_PERSISTENT_RAM | 38 | select ANDROID_PERSISTENT_RAM |
38 | default n | 39 | default n |
39 | 40 | ||
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 052b43e4e505..b91e4bc332a7 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c | |||
@@ -55,7 +55,6 @@ static int lowmem_minfree[6] = { | |||
55 | }; | 55 | }; |
56 | static int lowmem_minfree_size = 4; | 56 | static int lowmem_minfree_size = 4; |
57 | 57 | ||
58 | static struct task_struct *lowmem_deathpending; | ||
59 | static unsigned long lowmem_deathpending_timeout; | 58 | static unsigned long lowmem_deathpending_timeout; |
60 | 59 | ||
61 | #define lowmem_print(level, x...) \ | 60 | #define lowmem_print(level, x...) \ |
@@ -64,24 +63,6 @@ static unsigned long lowmem_deathpending_timeout; | |||
64 | printk(x); \ | 63 | printk(x); \ |
65 | } while (0) | 64 | } while (0) |
66 | 65 | ||
67 | static int | ||
68 | task_notify_func(struct notifier_block *self, unsigned long val, void *data); | ||
69 | |||
70 | static struct notifier_block task_nb = { | ||
71 | .notifier_call = task_notify_func, | ||
72 | }; | ||
73 | |||
74 | static int | ||
75 | task_notify_func(struct notifier_block *self, unsigned long val, void *data) | ||
76 | { | ||
77 | struct task_struct *task = data; | ||
78 | |||
79 | if (task == lowmem_deathpending) | ||
80 | lowmem_deathpending = NULL; | ||
81 | |||
82 | return NOTIFY_OK; | ||
83 | } | ||
84 | |||
85 | static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | 66 | static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) |
86 | { | 67 | { |
87 | struct task_struct *tsk; | 68 | struct task_struct *tsk; |
@@ -97,19 +78,6 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
97 | int other_file = global_page_state(NR_FILE_PAGES) - | 78 | int other_file = global_page_state(NR_FILE_PAGES) - |
98 | global_page_state(NR_SHMEM); | 79 | global_page_state(NR_SHMEM); |
99 | 80 | ||
100 | /* | ||
101 | * If we already have a death outstanding, then | ||
102 | * bail out right away; indicating to vmscan | ||
103 | * that we have nothing further to offer on | ||
104 | * this pass. | ||
105 | * | ||
106 | * Note: Currently you need CONFIG_PROFILING | ||
107 | * for this to work correctly. | ||
108 | */ | ||
109 | if (lowmem_deathpending && | ||
110 | time_before_eq(jiffies, lowmem_deathpending_timeout)) | ||
111 | return 0; | ||
112 | |||
113 | if (lowmem_adj_size < array_size) | 81 | if (lowmem_adj_size < array_size) |
114 | array_size = lowmem_adj_size; | 82 | array_size = lowmem_adj_size; |
115 | if (lowmem_minfree_size < array_size) | 83 | if (lowmem_minfree_size < array_size) |
@@ -148,6 +116,12 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
148 | if (!p) | 116 | if (!p) |
149 | continue; | 117 | continue; |
150 | 118 | ||
119 | if (test_tsk_thread_flag(p, TIF_MEMDIE) && | ||
120 | time_before_eq(jiffies, lowmem_deathpending_timeout)) { | ||
121 | task_unlock(p); | ||
122 | rcu_read_unlock(); | ||
123 | return 0; | ||
124 | } | ||
151 | oom_score_adj = p->signal->oom_score_adj; | 125 | oom_score_adj = p->signal->oom_score_adj; |
152 | if (oom_score_adj < min_score_adj) { | 126 | if (oom_score_adj < min_score_adj) { |
153 | task_unlock(p); | 127 | task_unlock(p); |
@@ -174,15 +148,9 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) | |||
174 | lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", | 148 | lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", |
175 | selected->pid, selected->comm, | 149 | selected->pid, selected->comm, |
176 | selected_oom_score_adj, selected_tasksize); | 150 | selected_oom_score_adj, selected_tasksize); |
177 | /* | ||
178 | * If CONFIG_PROFILING is off, then we don't want to stall | ||
179 | * the killer by setting lowmem_deathpending. | ||
180 | */ | ||
181 | #ifdef CONFIG_PROFILING | ||
182 | lowmem_deathpending = selected; | ||
183 | lowmem_deathpending_timeout = jiffies + HZ; | 151 | lowmem_deathpending_timeout = jiffies + HZ; |
184 | #endif | ||
185 | send_sig(SIGKILL, selected, 0); | 152 | send_sig(SIGKILL, selected, 0); |
153 | set_tsk_thread_flag(selected, TIF_MEMDIE); | ||
186 | rem -= selected_tasksize; | 154 | rem -= selected_tasksize; |
187 | } | 155 | } |
188 | lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n", | 156 | lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n", |
@@ -198,7 +166,6 @@ static struct shrinker lowmem_shrinker = { | |||
198 | 166 | ||
199 | static int __init lowmem_init(void) | 167 | static int __init lowmem_init(void) |
200 | { | 168 | { |
201 | task_handoff_register(&task_nb); | ||
202 | register_shrinker(&lowmem_shrinker); | 169 | register_shrinker(&lowmem_shrinker); |
203 | return 0; | 170 | return 0; |
204 | } | 171 | } |
@@ -206,7 +173,6 @@ static int __init lowmem_init(void) | |||
206 | static void __exit lowmem_exit(void) | 173 | static void __exit lowmem_exit(void) |
207 | { | 174 | { |
208 | unregister_shrinker(&lowmem_shrinker); | 175 | unregister_shrinker(&lowmem_shrinker); |
209 | task_handoff_unregister(&task_nb); | ||
210 | } | 176 | } |
211 | 177 | ||
212 | module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); | 178 | module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); |
diff --git a/drivers/staging/android/persistent_ram.c b/drivers/staging/android/persistent_ram.c index e08f2574e30a..8d8c1e33e0ff 100644 --- a/drivers/staging/android/persistent_ram.c +++ b/drivers/staging/android/persistent_ram.c | |||
@@ -399,12 +399,12 @@ static __init | |||
399 | struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | 399 | struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) |
400 | { | 400 | { |
401 | struct persistent_ram_zone *prz; | 401 | struct persistent_ram_zone *prz; |
402 | int ret; | 402 | int ret = -ENOMEM; |
403 | 403 | ||
404 | prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); | 404 | prz = kzalloc(sizeof(struct persistent_ram_zone), GFP_KERNEL); |
405 | if (!prz) { | 405 | if (!prz) { |
406 | pr_err("persistent_ram: failed to allocate persistent ram zone\n"); | 406 | pr_err("persistent_ram: failed to allocate persistent ram zone\n"); |
407 | return ERR_PTR(-ENOMEM); | 407 | goto err; |
408 | } | 408 | } |
409 | 409 | ||
410 | INIT_LIST_HEAD(&prz->node); | 410 | INIT_LIST_HEAD(&prz->node); |
@@ -412,13 +412,13 @@ struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | |||
412 | ret = persistent_ram_buffer_init(dev_name(dev), prz); | 412 | ret = persistent_ram_buffer_init(dev_name(dev), prz); |
413 | if (ret) { | 413 | if (ret) { |
414 | pr_err("persistent_ram: failed to initialize buffer\n"); | 414 | pr_err("persistent_ram: failed to initialize buffer\n"); |
415 | return ERR_PTR(ret); | 415 | goto err; |
416 | } | 416 | } |
417 | 417 | ||
418 | prz->ecc = ecc; | 418 | prz->ecc = ecc; |
419 | ret = persistent_ram_init_ecc(prz, prz->buffer_size); | 419 | ret = persistent_ram_init_ecc(prz, prz->buffer_size); |
420 | if (ret) | 420 | if (ret) |
421 | return ERR_PTR(ret); | 421 | goto err; |
422 | 422 | ||
423 | if (prz->buffer->sig == PERSISTENT_RAM_SIG) { | 423 | if (prz->buffer->sig == PERSISTENT_RAM_SIG) { |
424 | if (buffer_size(prz) > prz->buffer_size || | 424 | if (buffer_size(prz) > prz->buffer_size || |
@@ -442,6 +442,9 @@ struct persistent_ram_zone *__persistent_ram_init(struct device *dev, bool ecc) | |||
442 | atomic_set(&prz->buffer->size, 0); | 442 | atomic_set(&prz->buffer->size, 0); |
443 | 443 | ||
444 | return prz; | 444 | return prz; |
445 | err: | ||
446 | kfree(prz); | ||
447 | return ERR_PTR(ret); | ||
445 | } | 448 | } |
446 | 449 | ||
447 | struct persistent_ram_zone * __init | 450 | struct persistent_ram_zone * __init |
diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index bc723eff11af..45c522cbe784 100644 --- a/drivers/staging/android/timed_gpio.c +++ b/drivers/staging/android/timed_gpio.c | |||
@@ -85,7 +85,7 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
85 | struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; | 85 | struct timed_gpio_platform_data *pdata = pdev->dev.platform_data; |
86 | struct timed_gpio *cur_gpio; | 86 | struct timed_gpio *cur_gpio; |
87 | struct timed_gpio_data *gpio_data, *gpio_dat; | 87 | struct timed_gpio_data *gpio_data, *gpio_dat; |
88 | int i, j, ret = 0; | 88 | int i, ret; |
89 | 89 | ||
90 | if (!pdata) | 90 | if (!pdata) |
91 | return -EBUSY; | 91 | return -EBUSY; |
@@ -108,18 +108,12 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
108 | gpio_dat->dev.get_time = gpio_get_time; | 108 | gpio_dat->dev.get_time = gpio_get_time; |
109 | gpio_dat->dev.enable = gpio_enable; | 109 | gpio_dat->dev.enable = gpio_enable; |
110 | ret = gpio_request(cur_gpio->gpio, cur_gpio->name); | 110 | ret = gpio_request(cur_gpio->gpio, cur_gpio->name); |
111 | if (ret >= 0) { | 111 | if (ret < 0) |
112 | ret = timed_output_dev_register(&gpio_dat->dev); | 112 | goto err_out; |
113 | if (ret < 0) | 113 | ret = timed_output_dev_register(&gpio_dat->dev); |
114 | gpio_free(cur_gpio->gpio); | ||
115 | } | ||
116 | if (ret < 0) { | 114 | if (ret < 0) { |
117 | for (j = 0; j < i; j++) { | 115 | gpio_free(cur_gpio->gpio); |
118 | timed_output_dev_unregister(&gpio_data[i].dev); | 116 | goto err_out; |
119 | gpio_free(gpio_data[i].gpio); | ||
120 | } | ||
121 | kfree(gpio_data); | ||
122 | return ret; | ||
123 | } | 117 | } |
124 | 118 | ||
125 | gpio_dat->gpio = cur_gpio->gpio; | 119 | gpio_dat->gpio = cur_gpio->gpio; |
@@ -131,6 +125,15 @@ static int timed_gpio_probe(struct platform_device *pdev) | |||
131 | platform_set_drvdata(pdev, gpio_data); | 125 | platform_set_drvdata(pdev, gpio_data); |
132 | 126 | ||
133 | return 0; | 127 | return 0; |
128 | |||
129 | err_out: | ||
130 | while (--i >= 0) { | ||
131 | timed_output_dev_unregister(&gpio_data[i].dev); | ||
132 | gpio_free(gpio_data[i].gpio); | ||
133 | } | ||
134 | kfree(gpio_data); | ||
135 | |||
136 | return ret; | ||
134 | } | 137 | } |
135 | 138 | ||
136 | static int timed_gpio_remove(struct platform_device *pdev) | 139 | static int timed_gpio_remove(struct platform_device *pdev) |
diff --git a/drivers/staging/iio/inkern.c b/drivers/staging/iio/inkern.c index de2c8ea64965..ef07a02bf542 100644 --- a/drivers/staging/iio/inkern.c +++ b/drivers/staging/iio/inkern.c | |||
@@ -82,6 +82,7 @@ int iio_map_array_unregister(struct iio_dev *indio_dev, | |||
82 | ret = -ENODEV; | 82 | ret = -ENODEV; |
83 | goto error_ret; | 83 | goto error_ret; |
84 | } | 84 | } |
85 | i++; | ||
85 | } | 86 | } |
86 | error_ret: | 87 | error_ret: |
87 | mutex_unlock(&iio_map_list_lock); | 88 | mutex_unlock(&iio_map_list_lock); |
diff --git a/drivers/staging/iio/magnetometer/ak8975.c b/drivers/staging/iio/magnetometer/ak8975.c index d5ddac3d8831..ebc2d0840caf 100644 --- a/drivers/staging/iio/magnetometer/ak8975.c +++ b/drivers/staging/iio/magnetometer/ak8975.c | |||
@@ -108,7 +108,8 @@ static const int ak8975_index_to_reg[] = { | |||
108 | static int ak8975_write_data(struct i2c_client *client, | 108 | static int ak8975_write_data(struct i2c_client *client, |
109 | u8 reg, u8 val, u8 mask, u8 shift) | 109 | u8 reg, u8 val, u8 mask, u8 shift) |
110 | { | 110 | { |
111 | struct ak8975_data *data = i2c_get_clientdata(client); | 111 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
112 | struct ak8975_data *data = iio_priv(indio_dev); | ||
112 | u8 regval; | 113 | u8 regval; |
113 | int ret; | 114 | int ret; |
114 | 115 | ||
@@ -159,7 +160,8 @@ static int ak8975_read_data(struct i2c_client *client, | |||
159 | */ | 160 | */ |
160 | static int ak8975_setup(struct i2c_client *client) | 161 | static int ak8975_setup(struct i2c_client *client) |
161 | { | 162 | { |
162 | struct ak8975_data *data = i2c_get_clientdata(client); | 163 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
164 | struct ak8975_data *data = iio_priv(indio_dev); | ||
163 | u8 device_id; | 165 | u8 device_id; |
164 | int ret; | 166 | int ret; |
165 | 167 | ||
@@ -509,6 +511,7 @@ static int ak8975_probe(struct i2c_client *client, | |||
509 | goto exit_gpio; | 511 | goto exit_gpio; |
510 | } | 512 | } |
511 | data = iio_priv(indio_dev); | 513 | data = iio_priv(indio_dev); |
514 | i2c_set_clientdata(client, indio_dev); | ||
512 | /* Perform some basic start-of-day setup of the device. */ | 515 | /* Perform some basic start-of-day setup of the device. */ |
513 | err = ak8975_setup(client); | 516 | err = ak8975_setup(client); |
514 | if (err < 0) { | 517 | if (err < 0) { |
@@ -516,7 +519,6 @@ static int ak8975_probe(struct i2c_client *client, | |||
516 | goto exit_free_iio; | 519 | goto exit_free_iio; |
517 | } | 520 | } |
518 | 521 | ||
519 | i2c_set_clientdata(client, indio_dev); | ||
520 | data->client = client; | 522 | data->client = client; |
521 | mutex_init(&data->lock); | 523 | mutex_init(&data->lock); |
522 | data->eoc_irq = client->irq; | 524 | data->eoc_irq = client->irq; |
diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c index 91dd3da70cb4..e00b416c4d33 100644 --- a/drivers/staging/iio/magnetometer/hmc5843.c +++ b/drivers/staging/iio/magnetometer/hmc5843.c | |||
@@ -521,7 +521,9 @@ static int hmc5843_detect(struct i2c_client *client, | |||
521 | /* Called when we have found a new HMC5843. */ | 521 | /* Called when we have found a new HMC5843. */ |
522 | static void hmc5843_init_client(struct i2c_client *client) | 522 | static void hmc5843_init_client(struct i2c_client *client) |
523 | { | 523 | { |
524 | struct hmc5843_data *data = i2c_get_clientdata(client); | 524 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
525 | struct hmc5843_data *data = iio_priv(indio_dev); | ||
526 | |||
525 | hmc5843_set_meas_conf(client, data->meas_conf); | 527 | hmc5843_set_meas_conf(client, data->meas_conf); |
526 | hmc5843_set_rate(client, data->rate); | 528 | hmc5843_set_rate(client, data->rate); |
527 | hmc5843_configure(client, data->operating_mode); | 529 | hmc5843_configure(client, data->operating_mode); |
diff --git a/drivers/staging/media/as102/as102_fw.c b/drivers/staging/media/as102/as102_fw.c index 43ebc43e6b9a..1075fb1df0d9 100644 --- a/drivers/staging/media/as102/as102_fw.c +++ b/drivers/staging/media/as102/as102_fw.c | |||
@@ -165,7 +165,7 @@ error: | |||
165 | int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap) | 165 | int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap) |
166 | { | 166 | { |
167 | int errno = -EFAULT; | 167 | int errno = -EFAULT; |
168 | const struct firmware *firmware; | 168 | const struct firmware *firmware = NULL; |
169 | unsigned char *cmd_buf = NULL; | 169 | unsigned char *cmd_buf = NULL; |
170 | char *fw1, *fw2; | 170 | char *fw1, *fw2; |
171 | struct usb_device *dev = bus_adap->usb_dev; | 171 | struct usb_device *dev = bus_adap->usb_dev; |
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c index 400df8cbee53..d91751f9ffe8 100644 --- a/drivers/staging/octeon/ethernet-rx.c +++ b/drivers/staging/octeon/ethernet-rx.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/prefetch.h> | 36 | #include <linux/prefetch.h> |
37 | #include <linux/ratelimit.h> | 37 | #include <linux/ratelimit.h> |
38 | #include <linux/smp.h> | 38 | #include <linux/smp.h> |
39 | #include <linux/interrupt.h> | ||
39 | #include <net/dst.h> | 40 | #include <net/dst.h> |
40 | #ifdef CONFIG_XFRM | 41 | #ifdef CONFIG_XFRM |
41 | #include <linux/xfrm.h> | 42 | #include <linux/xfrm.h> |
diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c index 56d74dc2fbd5..91a97b3e45c6 100644 --- a/drivers/staging/octeon/ethernet-tx.c +++ b/drivers/staging/octeon/ethernet-tx.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/ip.h> | 32 | #include <linux/ip.h> |
33 | #include <linux/ratelimit.h> | 33 | #include <linux/ratelimit.h> |
34 | #include <linux/string.h> | 34 | #include <linux/string.h> |
35 | #include <linux/interrupt.h> | ||
35 | #include <net/dst.h> | 36 | #include <net/dst.h> |
36 | #ifdef CONFIG_XFRM | 37 | #ifdef CONFIG_XFRM |
37 | #include <linux/xfrm.h> | 38 | #include <linux/xfrm.h> |
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c index 9112cd882154..60cba8194de3 100644 --- a/drivers/staging/octeon/ethernet.c +++ b/drivers/staging/octeon/ethernet.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/etherdevice.h> | 31 | #include <linux/etherdevice.h> |
32 | #include <linux/phy.h> | 32 | #include <linux/phy.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/interrupt.h> | ||
34 | 35 | ||
35 | #include <net/dst.h> | 36 | #include <net/dst.h> |
36 | 37 | ||
diff --git a/drivers/staging/omapdrm/omap_drv.c b/drivers/staging/omapdrm/omap_drv.c index 3df5b4c58ecd..620b8d54223d 100644 --- a/drivers/staging/omapdrm/omap_drv.c +++ b/drivers/staging/omapdrm/omap_drv.c | |||
@@ -803,9 +803,6 @@ static void pdev_shutdown(struct platform_device *device) | |||
803 | static int pdev_probe(struct platform_device *device) | 803 | static int pdev_probe(struct platform_device *device) |
804 | { | 804 | { |
805 | DBG("%s", device->name); | 805 | DBG("%s", device->name); |
806 | if (platform_driver_register(&omap_dmm_driver)) | ||
807 | dev_err(&device->dev, "DMM registration failed\n"); | ||
808 | |||
809 | return drm_platform_init(&omap_drm_driver, device); | 806 | return drm_platform_init(&omap_drm_driver, device); |
810 | } | 807 | } |
811 | 808 | ||
@@ -833,6 +830,10 @@ struct platform_driver pdev = { | |||
833 | static int __init omap_drm_init(void) | 830 | static int __init omap_drm_init(void) |
834 | { | 831 | { |
835 | DBG("init"); | 832 | DBG("init"); |
833 | if (platform_driver_register(&omap_dmm_driver)) { | ||
834 | /* we can continue on without DMM.. so not fatal */ | ||
835 | dev_err(NULL, "DMM registration failed\n"); | ||
836 | } | ||
836 | return platform_driver_register(&pdev); | 837 | return platform_driver_register(&pdev); |
837 | } | 838 | } |
838 | 839 | ||
diff --git a/drivers/staging/ozwpan/TODO b/drivers/staging/ozwpan/TODO index f7a9c122f596..c2d30a7112f3 100644 --- a/drivers/staging/ozwpan/TODO +++ b/drivers/staging/ozwpan/TODO | |||
@@ -8,5 +8,7 @@ TODO: | |||
8 | - code review by USB developer community. | 8 | - code review by USB developer community. |
9 | - testing with as many devices as possible. | 9 | - testing with as many devices as possible. |
10 | 10 | ||
11 | Please send any patches for this driver to Chris Kelly <ckelly@ozmodevices.com> | 11 | Please send any patches for this driver to |
12 | Rupesh Gujare <rgujare@ozmodevices.com> | ||
13 | Chris Kelly <ckelly@ozmodevices.com> | ||
12 | and Greg Kroah-Hartman <gregkh@linuxfoundation.org>. | 14 | and Greg Kroah-Hartman <gregkh@linuxfoundation.org>. |
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/ramster/Kconfig b/drivers/staging/ramster/Kconfig index 8b57b87edda4..4af1f8d4b953 100644 --- a/drivers/staging/ramster/Kconfig +++ b/drivers/staging/ramster/Kconfig | |||
@@ -1,10 +1,6 @@ | |||
1 | # Dependency on CONFIG_BROKEN is because there is a commit dependency | ||
2 | # on a cleancache naming change to be submitted by Konrad Wilk | ||
3 | # a39c00ded70339603ffe1b0ffdf3ade85bcf009a "Merge branch 'stable/cleancache.v13' | ||
4 | # into linux-next. Once this commit is present, BROKEN can be removed | ||
5 | config RAMSTER | 1 | config RAMSTER |
6 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" | 2 | bool "Cross-machine RAM capacity sharing, aka peer-to-peer tmem" |
7 | depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM && BROKEN | 3 | depends on (CLEANCACHE || FRONTSWAP) && CONFIGFS_FS=y && !ZCACHE && !XVMALLOC && !HIGHMEM |
8 | select LZO_COMPRESS | 4 | select LZO_COMPRESS |
9 | select LZO_DECOMPRESS | 5 | select LZO_DECOMPRESS |
10 | default n | 6 | default n |
diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c index 66341dff8c99..f9a4498984cc 100644 --- a/drivers/staging/rts_pstor/ms.c +++ b/drivers/staging/rts_pstor/ms.c | |||
@@ -3498,7 +3498,8 @@ static int ms_rw_multi_sector(struct scsi_cmnd *srb, struct rtsx_chip *chip, u32 | |||
3498 | 3498 | ||
3499 | log_blk++; | 3499 | log_blk++; |
3500 | 3500 | ||
3501 | for (seg_no = 0; seg_no < sizeof(ms_start_idx)/2; seg_no++) { | 3501 | for (seg_no = 0; seg_no < ARRAY_SIZE(ms_start_idx) - 1; |
3502 | seg_no++) { | ||
3502 | if (log_blk < ms_start_idx[seg_no+1]) | 3503 | if (log_blk < ms_start_idx[seg_no+1]) |
3503 | break; | 3504 | break; |
3504 | } | 3505 | } |
diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c index a7feb3e328a0..1dccd933a7e4 100644 --- a/drivers/staging/rts_pstor/rtsx.c +++ b/drivers/staging/rts_pstor/rtsx.c | |||
@@ -1000,6 +1000,11 @@ static int __devinit rtsx_probe(struct pci_dev *pci, | |||
1000 | 1000 | ||
1001 | rtsx_init_chip(dev->chip); | 1001 | rtsx_init_chip(dev->chip); |
1002 | 1002 | ||
1003 | /* set the supported max_lun and max_id for the scsi host | ||
1004 | * NOTE: the minimal value of max_id is 1 */ | ||
1005 | host->max_id = 1; | ||
1006 | host->max_lun = dev->chip->max_lun; | ||
1007 | |||
1003 | /* Start up our control thread */ | 1008 | /* Start up our control thread */ |
1004 | th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME); | 1009 | th = kthread_run(rtsx_control_thread, dev, CR_DRIVER_NAME); |
1005 | if (IS_ERR(th)) { | 1010 | if (IS_ERR(th)) { |
diff --git a/drivers/staging/rts_pstor/rtsx_transport.c b/drivers/staging/rts_pstor/rtsx_transport.c index 4e3d2c106af0..9b2e5c99870f 100644 --- a/drivers/staging/rts_pstor/rtsx_transport.c +++ b/drivers/staging/rts_pstor/rtsx_transport.c | |||
@@ -335,6 +335,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
335 | int sg_cnt, i, resid; | 335 | int sg_cnt, i, resid; |
336 | int err = 0; | 336 | int err = 0; |
337 | long timeleft; | 337 | long timeleft; |
338 | struct scatterlist *sg_ptr; | ||
338 | u32 val = TRIG_DMA; | 339 | u32 val = TRIG_DMA; |
339 | 340 | ||
340 | if ((sg == NULL) || (num_sg <= 0) || !offset || !index) | 341 | if ((sg == NULL) || (num_sg <= 0) || !offset || !index) |
@@ -371,7 +372,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
371 | sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); | 372 | sg_cnt = dma_map_sg(&(rtsx->pci->dev), sg, num_sg, dma_dir); |
372 | 373 | ||
373 | resid = size; | 374 | resid = size; |
374 | 375 | sg_ptr = sg; | |
375 | chip->sgi = 0; | 376 | chip->sgi = 0; |
376 | /* Usually the next entry will be @sg@ + 1, but if this sg element | 377 | /* Usually the next entry will be @sg@ + 1, but if this sg element |
377 | * is part of a chained scatterlist, it could jump to the start of | 378 | * is part of a chained scatterlist, it could jump to the start of |
@@ -379,14 +380,14 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
379 | * the proper sg | 380 | * the proper sg |
380 | */ | 381 | */ |
381 | for (i = 0; i < *index; i++) | 382 | for (i = 0; i < *index; i++) |
382 | sg = sg_next(sg); | 383 | sg_ptr = sg_next(sg_ptr); |
383 | for (i = *index; i < sg_cnt; i++) { | 384 | for (i = *index; i < sg_cnt; i++) { |
384 | dma_addr_t addr; | 385 | dma_addr_t addr; |
385 | unsigned int len; | 386 | unsigned int len; |
386 | u8 option; | 387 | u8 option; |
387 | 388 | ||
388 | addr = sg_dma_address(sg); | 389 | addr = sg_dma_address(sg_ptr); |
389 | len = sg_dma_len(sg); | 390 | len = sg_dma_len(sg_ptr); |
390 | 391 | ||
391 | RTSX_DEBUGP("DMA addr: 0x%x, Len: 0x%x\n", | 392 | RTSX_DEBUGP("DMA addr: 0x%x, Len: 0x%x\n", |
392 | (unsigned int)addr, len); | 393 | (unsigned int)addr, len); |
@@ -415,7 +416,7 @@ static int rtsx_transfer_sglist_adma_partial(struct rtsx_chip *chip, u8 card, | |||
415 | if (!resid) | 416 | if (!resid) |
416 | break; | 417 | break; |
417 | 418 | ||
418 | sg = sg_next(sg); | 419 | sg_ptr = sg_next(sg_ptr); |
419 | } | 420 | } |
420 | 421 | ||
421 | RTSX_DEBUGP("SG table count = %d\n", chip->sgi); | 422 | RTSX_DEBUGP("SG table count = %d\n", chip->sgi); |
diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c index ad54c2e5c932..f1701bc6e312 100644 --- a/drivers/staging/sep/sep_main.c +++ b/drivers/staging/sep/sep_main.c | |||
@@ -3114,7 +3114,7 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
3114 | current->pid); | 3114 | current->pid); |
3115 | if (1 == test_bit(SEP_LEGACY_SENDMSG_DONE_OFFSET, | 3115 | if (1 == test_bit(SEP_LEGACY_SENDMSG_DONE_OFFSET, |
3116 | &call_status->status)) { | 3116 | &call_status->status)) { |
3117 | dev_warn(&sep->pdev->dev, | 3117 | dev_dbg(&sep->pdev->dev, |
3118 | "[PID%d] dcb prep needed before send msg\n", | 3118 | "[PID%d] dcb prep needed before send msg\n", |
3119 | current->pid); | 3119 | current->pid); |
3120 | error = -EPROTO; | 3120 | error = -EPROTO; |
@@ -3122,9 +3122,9 @@ static long sep_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
3122 | } | 3122 | } |
3123 | 3123 | ||
3124 | if (!arg) { | 3124 | if (!arg) { |
3125 | dev_warn(&sep->pdev->dev, | 3125 | dev_dbg(&sep->pdev->dev, |
3126 | "[PID%d] dcb null arg\n", current->pid); | 3126 | "[PID%d] dcb null arg\n", current->pid); |
3127 | error = EINVAL; | 3127 | error = -EINVAL; |
3128 | goto end_function; | 3128 | goto end_function; |
3129 | } | 3129 | } |
3130 | 3130 | ||
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/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c index 9fedc442a779..573c80003f0c 100644 --- a/drivers/staging/vme/devices/vme_pio2_core.c +++ b/drivers/staging/vme/devices/vme_pio2_core.c | |||
@@ -35,10 +35,10 @@ static int vector[PIO2_CARDS_MAX]; | |||
35 | static int vector_num; | 35 | static int vector_num; |
36 | static int level[PIO2_CARDS_MAX]; | 36 | static int level[PIO2_CARDS_MAX]; |
37 | static int level_num; | 37 | static int level_num; |
38 | static const char *variant[PIO2_CARDS_MAX]; | 38 | static char *variant[PIO2_CARDS_MAX]; |
39 | static int variant_num; | 39 | static int variant_num; |
40 | 40 | ||
41 | static int loopback; | 41 | static bool loopback; |
42 | 42 | ||
43 | static int pio2_match(struct vme_dev *); | 43 | static int pio2_match(struct vme_dev *); |
44 | static int __devinit pio2_probe(struct vme_dev *); | 44 | static int __devinit pio2_probe(struct vme_dev *); |
diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c index 0ff8d7bbf2a7..774b0d4a7e06 100644 --- a/drivers/staging/vt6655/key.c +++ b/drivers/staging/vt6655/key.c | |||
@@ -655,6 +655,9 @@ bool KeybSetDefaultKey ( | |||
655 | return (false); | 655 | return (false); |
656 | } | 656 | } |
657 | 657 | ||
658 | if (uKeyLength > MAX_KEY_LEN) | ||
659 | return false; | ||
660 | |||
658 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; | 661 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = true; |
659 | for(ii=0;ii<ETH_ALEN;ii++) | 662 | for(ii=0;ii<ETH_ALEN;ii++) |
660 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; | 663 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; |
diff --git a/drivers/staging/vt6656/ioctl.c b/drivers/staging/vt6656/ioctl.c index 1463d76895f0..d59456c29df1 100644 --- a/drivers/staging/vt6656/ioctl.c +++ b/drivers/staging/vt6656/ioctl.c | |||
@@ -565,7 +565,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) | |||
565 | result = -ENOMEM; | 565 | result = -ENOMEM; |
566 | break; | 566 | break; |
567 | } | 567 | } |
568 | pNodeList = (PSNodeList)kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); | 568 | pNodeList = kmalloc(sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)), (int)GFP_ATOMIC); |
569 | if (pNodeList == NULL) { | 569 | if (pNodeList == NULL) { |
570 | result = -ENOMEM; | 570 | result = -ENOMEM; |
571 | break; | 571 | break; |
@@ -601,6 +601,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) | |||
601 | } | 601 | } |
602 | } | 602 | } |
603 | if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { | 603 | if (copy_to_user(pReq->data, pNodeList, sizeof(SNodeList) + (sNodeList.uItem * sizeof(SNodeItem)))) { |
604 | kfree(pNodeList); | ||
604 | result = -EFAULT; | 605 | result = -EFAULT; |
605 | break; | 606 | break; |
606 | } | 607 | } |
diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 27bb523c8a97..ee62a06a75f4 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c | |||
@@ -684,6 +684,9 @@ BOOL KeybSetDefaultKey( | |||
684 | return (FALSE); | 684 | return (FALSE); |
685 | } | 685 | } |
686 | 686 | ||
687 | if (uKeyLength > MAX_KEY_LEN) | ||
688 | return false; | ||
689 | |||
687 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; | 690 | pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; |
688 | for (ii = 0; ii < ETH_ALEN; ii++) | 691 | for (ii = 0; ii < ETH_ALEN; ii++) |
689 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; | 692 | pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; |
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 94d5c35e22fb..3650bbff7686 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c | |||
@@ -61,7 +61,7 @@ XGINew_GetXG20DRAMType(struct xgi_hw_device_info *HwDeviceExtension, | |||
61 | } | 61 | } |
62 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); | 62 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); |
63 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ | 63 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ |
64 | if ((temp & 0x88) == 0x80) | 64 | if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) |
65 | data = 0; /* DDR */ | 65 | data = 0; /* DDR */ |
66 | else | 66 | else |
67 | data = 1; /* DDRII */ | 67 | data = 1; /* DDRII */ |
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 2919924213c4..60d4adf99923 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c | |||
@@ -152,6 +152,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) | |||
152 | pVBInfo->pXGINew_CR97 = &XG20_CR97; | 152 | pVBInfo->pXGINew_CR97 = &XG20_CR97; |
153 | 153 | ||
154 | if (ChipType == XG27) { | 154 | if (ChipType == XG27) { |
155 | unsigned char temp; | ||
155 | pVBInfo->MCLKData | 156 | pVBInfo->MCLKData |
156 | = (struct SiS_MCLKData *) XGI27New_MCLKData; | 157 | = (struct SiS_MCLKData *) XGI27New_MCLKData; |
157 | pVBInfo->CR40 = XGI27_cr41; | 158 | pVBInfo->CR40 = XGI27_cr41; |
@@ -162,7 +163,13 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) | |||
162 | pVBInfo->pCRDE = XG27_CRDE; | 163 | pVBInfo->pCRDE = XG27_CRDE; |
163 | pVBInfo->pSR40 = &XG27_SR40; | 164 | pVBInfo->pSR40 = &XG27_SR40; |
164 | pVBInfo->pSR41 = &XG27_SR41; | 165 | pVBInfo->pSR41 = &XG27_SR41; |
166 | pVBInfo->SR15 = XG27_SR13; | ||
165 | 167 | ||
168 | /*Z11m DDR*/ | ||
169 | temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); | ||
170 | /* SR3B[7][3]MAA15 MAA11 (Power on Trapping) */ | ||
171 | if (((temp & 0x88) == 0x80) || ((temp & 0x88) == 0x08)) | ||
172 | pVBInfo->pXGINew_CR97 = &Z11m_CR97; | ||
166 | } | 173 | } |
167 | 174 | ||
168 | if (ChipType >= XG20) { | 175 | if (ChipType >= XG20) { |
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index dddf261ed53d..e8d6f674b274 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h | |||
@@ -33,6 +33,13 @@ static struct XGI_ECLKDataStruct XGI340_ECLKData[] = { | |||
33 | {0x5c, 0x23, 0x01, 166} | 33 | {0x5c, 0x23, 0x01, 166} |
34 | }; | 34 | }; |
35 | 35 | ||
36 | static unsigned char XG27_SR13[4][8] = { | ||
37 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ | ||
38 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ | ||
39 | {0x32, 0x32, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR18 */ | ||
40 | {0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00} /* SR1B */ | ||
41 | }; | ||
42 | |||
36 | static unsigned char XGI340_SR13[4][8] = { | 43 | static unsigned char XGI340_SR13[4][8] = { |
37 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ | 44 | {0x35, 0x45, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR13 */ |
38 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ | 45 | {0x41, 0x51, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00}, /* SR14 */ |
@@ -71,7 +78,7 @@ static unsigned char XGI27_cr41[24][8] = { | |||
71 | {0x20, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0 CR41 */ | 78 | {0x20, 0x40, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0 CR41 */ |
72 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 1 CR8A */ | 79 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 1 CR8A */ |
73 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 2 CR8B */ | 80 | {0xC4, 0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 2 CR8B */ |
74 | {0xB5, 0x13, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 3 CR40[7], | 81 | {0xB3, 0x13, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 3 CR40[7], |
75 | CR99[2:0], | 82 | CR99[2:0], |
76 | CR45[3:0]*/ | 83 | CR45[3:0]*/ |
77 | {0xf0, 0xf5, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 4 CR59 */ | 84 | {0xf0, 0xf5, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 4 CR59 */ |
@@ -2803,6 +2810,8 @@ static unsigned char XG27_CRDE[2]; | |||
2803 | static unsigned char XG27_SR40 = 0x04 ; | 2810 | static unsigned char XG27_SR40 = 0x04 ; |
2804 | static unsigned char XG27_SR41 = 0x00 ; | 2811 | static unsigned char XG27_SR41 = 0x00 ; |
2805 | 2812 | ||
2813 | static unsigned char Z11m_CR97 = 0x80 ; | ||
2814 | |||
2806 | static struct XGI330_VCLKDataStruct XGI_VCLKData[] = { | 2815 | static struct XGI330_VCLKDataStruct XGI_VCLKData[] = { |
2807 | /* SR2B,SR2C,SR2D */ | 2816 | /* SR2B,SR2C,SR2D */ |
2808 | {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ | 2817 | {0x1B, 0xE1, 25}, /* 00 (25.175MHz) */ |
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/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 09caa4f2687e..917461c66014 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c | |||
@@ -267,33 +267,39 @@ static unsigned long obj_idx_to_offset(struct page *page, | |||
267 | return off + obj_idx * class_size; | 267 | return off + obj_idx * class_size; |
268 | } | 268 | } |
269 | 269 | ||
270 | static void reset_page(struct page *page) | ||
271 | { | ||
272 | clear_bit(PG_private, &page->flags); | ||
273 | clear_bit(PG_private_2, &page->flags); | ||
274 | set_page_private(page, 0); | ||
275 | page->mapping = NULL; | ||
276 | page->freelist = NULL; | ||
277 | reset_page_mapcount(page); | ||
278 | } | ||
279 | |||
270 | static void free_zspage(struct page *first_page) | 280 | static void free_zspage(struct page *first_page) |
271 | { | 281 | { |
272 | struct page *nextp, *tmp; | 282 | struct page *nextp, *tmp, *head_extra; |
273 | 283 | ||
274 | BUG_ON(!is_first_page(first_page)); | 284 | BUG_ON(!is_first_page(first_page)); |
275 | BUG_ON(first_page->inuse); | 285 | BUG_ON(first_page->inuse); |
276 | 286 | ||
277 | nextp = (struct page *)page_private(first_page); | 287 | head_extra = (struct page *)page_private(first_page); |
278 | 288 | ||
279 | clear_bit(PG_private, &first_page->flags); | 289 | reset_page(first_page); |
280 | clear_bit(PG_private_2, &first_page->flags); | ||
281 | set_page_private(first_page, 0); | ||
282 | first_page->mapping = NULL; | ||
283 | first_page->freelist = NULL; | ||
284 | reset_page_mapcount(first_page); | ||
285 | __free_page(first_page); | 290 | __free_page(first_page); |
286 | 291 | ||
287 | /* zspage with only 1 system page */ | 292 | /* zspage with only 1 system page */ |
288 | if (!nextp) | 293 | if (!head_extra) |
289 | return; | 294 | return; |
290 | 295 | ||
291 | list_for_each_entry_safe(nextp, tmp, &nextp->lru, lru) { | 296 | list_for_each_entry_safe(nextp, tmp, &head_extra->lru, lru) { |
292 | list_del(&nextp->lru); | 297 | list_del(&nextp->lru); |
293 | clear_bit(PG_private_2, &nextp->flags); | 298 | reset_page(nextp); |
294 | nextp->index = 0; | ||
295 | __free_page(nextp); | 299 | __free_page(nextp); |
296 | } | 300 | } |
301 | reset_page(head_extra); | ||
302 | __free_page(head_extra); | ||
297 | } | 303 | } |
298 | 304 | ||
299 | /* Initialize a newly allocated zspage */ | 305 | /* Initialize a newly allocated zspage */ |
diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h index 830657908db8..c5eb3c33c3db 100644 --- a/drivers/target/tcm_fc/tcm_fc.h +++ b/drivers/target/tcm_fc/tcm_fc.h | |||
@@ -122,6 +122,7 @@ struct ft_cmd { | |||
122 | /* Local sense buffer */ | 122 | /* Local sense buffer */ |
123 | unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER]; | 123 | unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER]; |
124 | u32 was_ddp_setup:1; /* Set only if ddp is setup */ | 124 | u32 was_ddp_setup:1; /* Set only if ddp is setup */ |
125 | u32 aborted:1; /* Set if aborted by reset or timeout */ | ||
125 | struct scatterlist *sg; /* Set only if DDP is setup */ | 126 | struct scatterlist *sg; /* Set only if DDP is setup */ |
126 | u32 sg_cnt; /* No. of item in scatterlist */ | 127 | u32 sg_cnt; /* No. of item in scatterlist */ |
127 | }; | 128 | }; |
diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c index 62dec9715ce5..a375f257aabc 100644 --- a/drivers/target/tcm_fc/tfc_cmd.c +++ b/drivers/target/tcm_fc/tfc_cmd.c | |||
@@ -121,6 +121,8 @@ int ft_queue_status(struct se_cmd *se_cmd) | |||
121 | struct fc_exch *ep; | 121 | struct fc_exch *ep; |
122 | size_t len; | 122 | size_t len; |
123 | 123 | ||
124 | if (cmd->aborted) | ||
125 | return 0; | ||
124 | ft_dump_cmd(cmd, __func__); | 126 | ft_dump_cmd(cmd, __func__); |
125 | ep = fc_seq_exch(cmd->seq); | 127 | ep = fc_seq_exch(cmd->seq); |
126 | lport = ep->lp; | 128 | lport = ep->lp; |
@@ -187,6 +189,8 @@ int ft_write_pending(struct se_cmd *se_cmd) | |||
187 | 189 | ||
188 | ft_dump_cmd(cmd, __func__); | 190 | ft_dump_cmd(cmd, __func__); |
189 | 191 | ||
192 | if (cmd->aborted) | ||
193 | return 0; | ||
190 | ep = fc_seq_exch(cmd->seq); | 194 | ep = fc_seq_exch(cmd->seq); |
191 | lport = ep->lp; | 195 | lport = ep->lp; |
192 | fp = fc_frame_alloc(lport, sizeof(*txrdy)); | 196 | fp = fc_frame_alloc(lport, sizeof(*txrdy)); |
@@ -252,10 +256,10 @@ static void ft_recv_seq(struct fc_seq *sp, struct fc_frame *fp, void *arg) | |||
252 | struct ft_cmd *cmd = arg; | 256 | struct ft_cmd *cmd = arg; |
253 | struct fc_frame_header *fh; | 257 | struct fc_frame_header *fh; |
254 | 258 | ||
255 | if (IS_ERR(fp)) { | 259 | if (unlikely(IS_ERR(fp))) { |
256 | /* XXX need to find cmd if queued */ | 260 | /* XXX need to find cmd if queued */ |
257 | cmd->seq = NULL; | 261 | cmd->seq = NULL; |
258 | transport_generic_free_cmd(&cmd->se_cmd, 0); | 262 | cmd->aborted = true; |
259 | return; | 263 | return; |
260 | } | 264 | } |
261 | 265 | ||
@@ -399,6 +403,8 @@ int ft_queue_tm_resp(struct se_cmd *se_cmd) | |||
399 | struct se_tmr_req *tmr = se_cmd->se_tmr_req; | 403 | struct se_tmr_req *tmr = se_cmd->se_tmr_req; |
400 | enum fcp_resp_rsp_codes code; | 404 | enum fcp_resp_rsp_codes code; |
401 | 405 | ||
406 | if (cmd->aborted) | ||
407 | return 0; | ||
402 | switch (tmr->response) { | 408 | switch (tmr->response) { |
403 | case TMR_FUNCTION_COMPLETE: | 409 | case TMR_FUNCTION_COMPLETE: |
404 | code = FCP_TMF_CMPL; | 410 | code = FCP_TMF_CMPL; |
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c index f357039349ba..2948dc944619 100644 --- a/drivers/target/tcm_fc/tfc_conf.c +++ b/drivers/target/tcm_fc/tfc_conf.c | |||
@@ -300,6 +300,7 @@ static struct se_portal_group *ft_add_tpg( | |||
300 | { | 300 | { |
301 | struct ft_lport_acl *lacl; | 301 | struct ft_lport_acl *lacl; |
302 | struct ft_tpg *tpg; | 302 | struct ft_tpg *tpg; |
303 | struct workqueue_struct *wq; | ||
303 | unsigned long index; | 304 | unsigned long index; |
304 | int ret; | 305 | int ret; |
305 | 306 | ||
@@ -321,18 +322,20 @@ static struct se_portal_group *ft_add_tpg( | |||
321 | tpg->lport_acl = lacl; | 322 | tpg->lport_acl = lacl; |
322 | INIT_LIST_HEAD(&tpg->lun_list); | 323 | INIT_LIST_HEAD(&tpg->lun_list); |
323 | 324 | ||
324 | ret = core_tpg_register(&ft_configfs->tf_ops, wwn, &tpg->se_tpg, | 325 | wq = alloc_workqueue("tcm_fc", 0, 1); |
325 | tpg, TRANSPORT_TPG_TYPE_NORMAL); | 326 | if (!wq) { |
326 | if (ret < 0) { | ||
327 | kfree(tpg); | 327 | kfree(tpg); |
328 | return NULL; | 328 | return NULL; |
329 | } | 329 | } |
330 | 330 | ||
331 | tpg->workqueue = alloc_workqueue("tcm_fc", 0, 1); | 331 | ret = core_tpg_register(&ft_configfs->tf_ops, wwn, &tpg->se_tpg, |
332 | if (!tpg->workqueue) { | 332 | tpg, TRANSPORT_TPG_TYPE_NORMAL); |
333 | if (ret < 0) { | ||
334 | destroy_workqueue(wq); | ||
333 | kfree(tpg); | 335 | kfree(tpg); |
334 | return NULL; | 336 | return NULL; |
335 | } | 337 | } |
338 | tpg->workqueue = wq; | ||
336 | 339 | ||
337 | mutex_lock(&ft_lport_lock); | 340 | mutex_lock(&ft_lport_lock); |
338 | list_add_tail(&tpg->list, &lacl->tpg_list); | 341 | list_add_tail(&tpg->list, &lacl->tpg_list); |
diff --git a/drivers/target/tcm_fc/tfc_io.c b/drivers/target/tcm_fc/tfc_io.c index 2b693eefac55..dc7c0db26e20 100644 --- a/drivers/target/tcm_fc/tfc_io.c +++ b/drivers/target/tcm_fc/tfc_io.c | |||
@@ -81,6 +81,8 @@ int ft_queue_data_in(struct se_cmd *se_cmd) | |||
81 | void *from; | 81 | void *from; |
82 | void *to = NULL; | 82 | void *to = NULL; |
83 | 83 | ||
84 | if (cmd->aborted) | ||
85 | return 0; | ||
84 | ep = fc_seq_exch(cmd->seq); | 86 | ep = fc_seq_exch(cmd->seq); |
85 | lport = ep->lp; | 87 | lport = ep->lp; |
86 | cmd->seq = lport->tt.seq_start_next(cmd->seq); | 88 | cmd->seq = lport->tt.seq_start_next(cmd->seq); |
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c index 24145c30c9b0..6cc4358f68c1 100644 --- a/drivers/tty/amiserial.c +++ b/drivers/tty/amiserial.c | |||
@@ -1073,8 +1073,10 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state, | |||
1073 | (new_serial.close_delay != port->close_delay) || | 1073 | (new_serial.close_delay != port->close_delay) || |
1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || | 1074 | (new_serial.xmit_fifo_size != state->xmit_fifo_size) || |
1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != | 1075 | ((new_serial.flags & ~ASYNC_USR_MASK) != |
1076 | (port->flags & ~ASYNC_USR_MASK))) | 1076 | (port->flags & ~ASYNC_USR_MASK))) { |
1077 | tty_unlock(); | ||
1077 | return -EPERM; | 1078 | return -EPERM; |
1079 | } | ||
1078 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | | 1080 | port->flags = ((port->flags & ~ASYNC_USR_MASK) | |
1079 | (new_serial.flags & ASYNC_USR_MASK)); | 1081 | (new_serial.flags & ASYNC_USR_MASK)); |
1080 | state->custom_divisor = new_serial.custom_divisor; | 1082 | state->custom_divisor = new_serial.custom_divisor; |
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 5b149b466ec8..5c27f7e6c9f1 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c | |||
@@ -1572,13 +1572,11 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id) | |||
1572 | do { | 1572 | do { |
1573 | struct uart_8250_port *up; | 1573 | struct uart_8250_port *up; |
1574 | struct uart_port *port; | 1574 | struct uart_port *port; |
1575 | bool skip; | ||
1576 | 1575 | ||
1577 | up = list_entry(l, struct uart_8250_port, list); | 1576 | up = list_entry(l, struct uart_8250_port, list); |
1578 | port = &up->port; | 1577 | port = &up->port; |
1579 | skip = pass_counter && up->port.flags & UPF_IIR_ONCE; | ||
1580 | 1578 | ||
1581 | if (!skip && port->handle_irq(port)) { | 1579 | if (port->handle_irq(port)) { |
1582 | handled = 1; | 1580 | handled = 1; |
1583 | end = NULL; | 1581 | end = NULL; |
1584 | } else if (end == NULL) | 1582 | } else if (end == NULL) |
@@ -2037,10 +2035,12 @@ static int serial8250_startup(struct uart_port *port) | |||
2037 | spin_unlock_irqrestore(&port->lock, flags); | 2035 | spin_unlock_irqrestore(&port->lock, flags); |
2038 | 2036 | ||
2039 | /* | 2037 | /* |
2040 | * If the interrupt is not reasserted, setup a timer to | 2038 | * If the interrupt is not reasserted, or we otherwise |
2041 | * kick the UART on a regular basis. | 2039 | * don't trust the iir, setup a timer to kick the UART |
2040 | * on a regular basis. | ||
2042 | */ | 2041 | */ |
2043 | if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { | 2042 | if ((!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) || |
2043 | up->port.flags & UPF_BUG_THRE) { | ||
2044 | up->bugs |= UART_BUG_THRE; | 2044 | up->bugs |= UART_BUG_THRE; |
2045 | pr_debug("ttyS%d - using backup timer\n", | 2045 | pr_debug("ttyS%d - using backup timer\n", |
2046 | serial_index(port)); | 2046 | serial_index(port)); |
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index da2b0b0a183f..858dca865d6a 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c | |||
@@ -1096,7 +1096,7 @@ static int kt_serial_setup(struct serial_private *priv, | |||
1096 | const struct pciserial_board *board, | 1096 | const struct pciserial_board *board, |
1097 | struct uart_port *port, int idx) | 1097 | struct uart_port *port, int idx) |
1098 | { | 1098 | { |
1099 | port->flags |= UPF_IIR_ONCE; | 1099 | port->flags |= UPF_BUG_THRE; |
1100 | return skip_tx_en_setup(priv, board, port, idx); | 1100 | return skip_tx_en_setup(priv, board, port, idx); |
1101 | } | 1101 | } |
1102 | 1102 | ||
@@ -1118,18 +1118,6 @@ pci_xr17c154_setup(struct serial_private *priv, | |||
1118 | return pci_default_setup(priv, board, port, idx); | 1118 | return pci_default_setup(priv, board, port, idx); |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | static int try_enable_msi(struct pci_dev *dev) | ||
1122 | { | ||
1123 | /* use msi if available, but fallback to legacy otherwise */ | ||
1124 | pci_enable_msi(dev); | ||
1125 | return 0; | ||
1126 | } | ||
1127 | |||
1128 | static void disable_msi(struct pci_dev *dev) | ||
1129 | { | ||
1130 | pci_disable_msi(dev); | ||
1131 | } | ||
1132 | |||
1133 | #define PCI_VENDOR_ID_SBSMODULARIO 0x124B | 1121 | #define PCI_VENDOR_ID_SBSMODULARIO 0x124B |
1134 | #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B | 1122 | #define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B |
1135 | #define PCI_DEVICE_ID_OCTPRO 0x0001 | 1123 | #define PCI_DEVICE_ID_OCTPRO 0x0001 |
@@ -1249,9 +1237,7 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = { | |||
1249 | .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT, | 1237 | .device = PCI_DEVICE_ID_INTEL_PATSBURG_KT, |
1250 | .subvendor = PCI_ANY_ID, | 1238 | .subvendor = PCI_ANY_ID, |
1251 | .subdevice = PCI_ANY_ID, | 1239 | .subdevice = PCI_ANY_ID, |
1252 | .init = try_enable_msi, | ||
1253 | .setup = kt_serial_setup, | 1240 | .setup = kt_serial_setup, |
1254 | .exit = disable_msi, | ||
1255 | }, | 1241 | }, |
1256 | /* | 1242 | /* |
1257 | * ITE | 1243 | * ITE |
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 665beb68f670..070b442c1f81 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1041,7 +1041,7 @@ config SERIAL_OMAP | |||
1041 | 1041 | ||
1042 | config SERIAL_OMAP_CONSOLE | 1042 | config SERIAL_OMAP_CONSOLE |
1043 | bool "Console on OMAP serial port" | 1043 | bool "Console on OMAP serial port" |
1044 | depends on SERIAL_OMAP | 1044 | depends on SERIAL_OMAP=y |
1045 | select SERIAL_CORE_CONSOLE | 1045 | select SERIAL_CORE_CONSOLE |
1046 | help | 1046 | help |
1047 | Select this option if you would like to use omap serial port as | 1047 | Select this option if you would like to use omap serial port as |
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index e7903751e058..1f0330915d5a 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -556,7 +556,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
556 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 556 | res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
557 | if (res_mem) | 557 | if (res_mem) |
558 | port->mapbase = res_mem->start; | 558 | port->mapbase = res_mem->start; |
559 | else if (platp->mapbase) | 559 | else if (platp) |
560 | port->mapbase = platp->mapbase; | 560 | port->mapbase = platp->mapbase; |
561 | else | 561 | else |
562 | return -EINVAL; | 562 | return -EINVAL; |
@@ -564,7 +564,7 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
564 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 564 | res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
565 | if (res_irq) | 565 | if (res_irq) |
566 | port->irq = res_irq->start; | 566 | port->irq = res_irq->start; |
567 | else if (platp->irq) | 567 | else if (platp) |
568 | port->irq = platp->irq; | 568 | port->irq = platp->irq; |
569 | 569 | ||
570 | /* Check platform data first so we can override device node data */ | 570 | /* Check platform data first so we can override device node data */ |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index 0c65c9e66986..3d569cd68f58 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -1946,10 +1946,6 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
1946 | goto unmap; | 1946 | goto unmap; |
1947 | } | 1947 | } |
1948 | 1948 | ||
1949 | /* Ensure interrupts from this UART are masked and cleared */ | ||
1950 | writew(0, uap->port.membase + UART011_IMSC); | ||
1951 | writew(0xffff, uap->port.membase + UART011_ICR); | ||
1952 | |||
1953 | uap->vendor = vendor; | 1949 | uap->vendor = vendor; |
1954 | uap->lcrh_rx = vendor->lcrh_rx; | 1950 | uap->lcrh_rx = vendor->lcrh_rx; |
1955 | uap->lcrh_tx = vendor->lcrh_tx; | 1951 | uap->lcrh_tx = vendor->lcrh_tx; |
@@ -1967,6 +1963,10 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) | |||
1967 | uap->port.line = i; | 1963 | uap->port.line = i; |
1968 | pl011_dma_probe(uap); | 1964 | pl011_dma_probe(uap); |
1969 | 1965 | ||
1966 | /* Ensure interrupts from this UART are masked and cleared */ | ||
1967 | writew(0, uap->port.membase + UART011_IMSC); | ||
1968 | writew(0xffff, uap->port.membase + UART011_ICR); | ||
1969 | |||
1970 | snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev)); | 1970 | snprintf(uap->type, sizeof(uap->type), "PL011 rev%u", amba_rev(dev)); |
1971 | 1971 | ||
1972 | amba_ports[i] = uap; | 1972 | amba_ports[i] = uap; |
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index f9a6be7a9bed..3d7e1ee2fa57 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c | |||
@@ -389,6 +389,8 @@ static void atmel_start_rx(struct uart_port *port) | |||
389 | { | 389 | { |
390 | UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */ | 390 | UART_PUT_CR(port, ATMEL_US_RSTSTA); /* reset status and receiver */ |
391 | 391 | ||
392 | UART_PUT_CR(port, ATMEL_US_RXEN); | ||
393 | |||
392 | if (atmel_use_dma_rx(port)) { | 394 | if (atmel_use_dma_rx(port)) { |
393 | /* enable PDC controller */ | 395 | /* enable PDC controller */ |
394 | UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | | 396 | UART_PUT_IER(port, ATMEL_US_ENDRX | ATMEL_US_TIMEOUT | |
@@ -404,6 +406,8 @@ static void atmel_start_rx(struct uart_port *port) | |||
404 | */ | 406 | */ |
405 | static void atmel_stop_rx(struct uart_port *port) | 407 | static void atmel_stop_rx(struct uart_port *port) |
406 | { | 408 | { |
409 | UART_PUT_CR(port, ATMEL_US_RXDIS); | ||
410 | |||
407 | if (atmel_use_dma_rx(port)) { | 411 | if (atmel_use_dma_rx(port)) { |
408 | /* disable PDC receive */ | 412 | /* disable PDC receive */ |
409 | UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS); | 413 | UART_PUT_PTCR(port, ATMEL_PDC_RXTDIS); |
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c index e6c3dbd781d6..836fe2731234 100644 --- a/drivers/tty/serial/clps711x.c +++ b/drivers/tty/serial/clps711x.c | |||
@@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | |||
154 | port->x_char = 0; | 154 | port->x_char = 0; |
155 | return IRQ_HANDLED; | 155 | return IRQ_HANDLED; |
156 | } | 156 | } |
157 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { | 157 | |
158 | clps711xuart_stop_tx(port); | 158 | if (uart_circ_empty(xmit) || uart_tx_stopped(port)) |
159 | return IRQ_HANDLED; | 159 | goto disable_tx_irq; |
160 | } | ||
161 | 160 | ||
162 | count = port->fifosize >> 1; | 161 | count = port->fifosize >> 1; |
163 | do { | 162 | do { |
@@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id) | |||
171 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 170 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
172 | uart_write_wakeup(port); | 171 | uart_write_wakeup(port); |
173 | 172 | ||
174 | if (uart_circ_empty(xmit)) | 173 | if (uart_circ_empty(xmit)) { |
175 | clps711xuart_stop_tx(port); | 174 | disable_tx_irq: |
175 | disable_irq_nosync(TX_IRQ(port)); | ||
176 | tx_enabled(port) = 0; | ||
177 | } | ||
176 | 178 | ||
177 | return IRQ_HANDLED; | 179 | return IRQ_HANDLED; |
178 | } | 180 | } |
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c index a9234ba8f8d5..c4b50af46c44 100644 --- a/drivers/tty/serial/mfd.c +++ b/drivers/tty/serial/mfd.c | |||
@@ -127,11 +127,6 @@ static inline void serial_out(struct uart_hsu_port *up, int offset, int value) | |||
127 | 127 | ||
128 | #define HSU_REGS_BUFSIZE 1024 | 128 | #define HSU_REGS_BUFSIZE 1024 |
129 | 129 | ||
130 | static int hsu_show_regs_open(struct inode *inode, struct file *file) | ||
131 | { | ||
132 | file->private_data = inode->i_private; | ||
133 | return 0; | ||
134 | } | ||
135 | 130 | ||
136 | static ssize_t port_show_regs(struct file *file, char __user *user_buf, | 131 | static ssize_t port_show_regs(struct file *file, char __user *user_buf, |
137 | size_t count, loff_t *ppos) | 132 | size_t count, loff_t *ppos) |
@@ -231,14 +226,14 @@ static ssize_t dma_show_regs(struct file *file, char __user *user_buf, | |||
231 | 226 | ||
232 | static const struct file_operations port_regs_ops = { | 227 | static const struct file_operations port_regs_ops = { |
233 | .owner = THIS_MODULE, | 228 | .owner = THIS_MODULE, |
234 | .open = hsu_show_regs_open, | 229 | .open = simple_open, |
235 | .read = port_show_regs, | 230 | .read = port_show_regs, |
236 | .llseek = default_llseek, | 231 | .llseek = default_llseek, |
237 | }; | 232 | }; |
238 | 233 | ||
239 | static const struct file_operations dma_regs_ops = { | 234 | static const struct file_operations dma_regs_ops = { |
240 | .owner = THIS_MODULE, | 235 | .owner = THIS_MODULE, |
241 | .open = hsu_show_regs_open, | 236 | .open = simple_open, |
242 | .read = dma_show_regs, | 237 | .read = dma_show_regs, |
243 | .llseek = default_llseek, | 238 | .llseek = default_llseek, |
244 | }; | 239 | }; |
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c index 0121486ac4fa..d00b38eb268e 100644 --- a/drivers/tty/serial/omap-serial.c +++ b/drivers/tty/serial/omap-serial.c | |||
@@ -1381,29 +1381,24 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1381 | return -ENODEV; | 1381 | return -ENODEV; |
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | if (!request_mem_region(mem->start, resource_size(mem), | 1384 | if (!devm_request_mem_region(&pdev->dev, mem->start, resource_size(mem), |
1385 | pdev->dev.driver->name)) { | 1385 | pdev->dev.driver->name)) { |
1386 | dev_err(&pdev->dev, "memory region already claimed\n"); | 1386 | dev_err(&pdev->dev, "memory region already claimed\n"); |
1387 | return -EBUSY; | 1387 | return -EBUSY; |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); | 1390 | dma_rx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); |
1391 | if (!dma_rx) { | 1391 | if (!dma_rx) |
1392 | ret = -EINVAL; | 1392 | return -ENXIO; |
1393 | goto err; | ||
1394 | } | ||
1395 | 1393 | ||
1396 | dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); | 1394 | dma_tx = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); |
1397 | if (!dma_tx) { | 1395 | if (!dma_tx) |
1398 | ret = -EINVAL; | 1396 | return -ENXIO; |
1399 | goto err; | 1397 | |
1400 | } | 1398 | up = devm_kzalloc(&pdev->dev, sizeof(*up), GFP_KERNEL); |
1399 | if (!up) | ||
1400 | return -ENOMEM; | ||
1401 | 1401 | ||
1402 | up = kzalloc(sizeof(*up), GFP_KERNEL); | ||
1403 | if (up == NULL) { | ||
1404 | ret = -ENOMEM; | ||
1405 | goto do_release_region; | ||
1406 | } | ||
1407 | up->pdev = pdev; | 1402 | up->pdev = pdev; |
1408 | up->port.dev = &pdev->dev; | 1403 | up->port.dev = &pdev->dev; |
1409 | up->port.type = PORT_OMAP; | 1404 | up->port.type = PORT_OMAP; |
@@ -1423,16 +1418,17 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1423 | dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", | 1418 | dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n", |
1424 | up->port.line); | 1419 | up->port.line); |
1425 | ret = -ENODEV; | 1420 | ret = -ENODEV; |
1426 | goto err; | 1421 | goto err_port_line; |
1427 | } | 1422 | } |
1428 | 1423 | ||
1429 | sprintf(up->name, "OMAP UART%d", up->port.line); | 1424 | sprintf(up->name, "OMAP UART%d", up->port.line); |
1430 | up->port.mapbase = mem->start; | 1425 | up->port.mapbase = mem->start; |
1431 | up->port.membase = ioremap(mem->start, resource_size(mem)); | 1426 | up->port.membase = devm_ioremap(&pdev->dev, mem->start, |
1427 | resource_size(mem)); | ||
1432 | if (!up->port.membase) { | 1428 | if (!up->port.membase) { |
1433 | dev_err(&pdev->dev, "can't ioremap UART\n"); | 1429 | dev_err(&pdev->dev, "can't ioremap UART\n"); |
1434 | ret = -ENOMEM; | 1430 | ret = -ENOMEM; |
1435 | goto err; | 1431 | goto err_ioremap; |
1436 | } | 1432 | } |
1437 | 1433 | ||
1438 | up->port.flags = omap_up_info->flags; | 1434 | up->port.flags = omap_up_info->flags; |
@@ -1478,16 +1474,19 @@ static int serial_omap_probe(struct platform_device *pdev) | |||
1478 | 1474 | ||
1479 | ret = uart_add_one_port(&serial_omap_reg, &up->port); | 1475 | ret = uart_add_one_port(&serial_omap_reg, &up->port); |
1480 | if (ret != 0) | 1476 | if (ret != 0) |
1481 | goto do_release_region; | 1477 | goto err_add_port; |
1482 | 1478 | ||
1483 | pm_runtime_put(&pdev->dev); | 1479 | pm_runtime_put(&pdev->dev); |
1484 | platform_set_drvdata(pdev, up); | 1480 | platform_set_drvdata(pdev, up); |
1485 | return 0; | 1481 | return 0; |
1486 | err: | 1482 | |
1483 | err_add_port: | ||
1484 | pm_runtime_put(&pdev->dev); | ||
1485 | pm_runtime_disable(&pdev->dev); | ||
1486 | err_ioremap: | ||
1487 | err_port_line: | ||
1487 | dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", | 1488 | dev_err(&pdev->dev, "[UART%d]: failure [%s]: %d\n", |
1488 | pdev->id, __func__, ret); | 1489 | pdev->id, __func__, ret); |
1489 | do_release_region: | ||
1490 | release_mem_region(mem->start, resource_size(mem)); | ||
1491 | return ret; | 1490 | return ret; |
1492 | } | 1491 | } |
1493 | 1492 | ||
@@ -1499,8 +1498,6 @@ static int serial_omap_remove(struct platform_device *dev) | |||
1499 | pm_runtime_disable(&up->pdev->dev); | 1498 | pm_runtime_disable(&up->pdev->dev); |
1500 | uart_remove_one_port(&serial_omap_reg, &up->port); | 1499 | uart_remove_one_port(&serial_omap_reg, &up->port); |
1501 | pm_qos_remove_request(&up->pm_qos_request); | 1500 | pm_qos_remove_request(&up->pm_qos_request); |
1502 | |||
1503 | kfree(up); | ||
1504 | } | 1501 | } |
1505 | 1502 | ||
1506 | platform_set_drvdata(dev, NULL); | 1503 | platform_set_drvdata(dev, NULL); |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index e825460478be..c2816f494807 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -210,6 +210,7 @@ enum { | |||
210 | #define CMITC_UARTCLK 192000000 /* 192.0000 MHz */ | 210 | #define CMITC_UARTCLK 192000000 /* 192.0000 MHz */ |
211 | #define FRI2_64_UARTCLK 64000000 /* 64.0000 MHz */ | 211 | #define FRI2_64_UARTCLK 64000000 /* 64.0000 MHz */ |
212 | #define FRI2_48_UARTCLK 48000000 /* 48.0000 MHz */ | 212 | #define FRI2_48_UARTCLK 48000000 /* 48.0000 MHz */ |
213 | #define NTC1_UARTCLK 64000000 /* 64.0000 MHz */ | ||
213 | 214 | ||
214 | struct pch_uart_buffer { | 215 | struct pch_uart_buffer { |
215 | unsigned char *buf; | 216 | unsigned char *buf; |
@@ -304,11 +305,7 @@ static const int trigger_level_1[4] = { 1, 1, 1, 1 }; | |||
304 | #ifdef CONFIG_DEBUG_FS | 305 | #ifdef CONFIG_DEBUG_FS |
305 | 306 | ||
306 | #define PCH_REGS_BUFSIZE 1024 | 307 | #define PCH_REGS_BUFSIZE 1024 |
307 | static int pch_show_regs_open(struct inode *inode, struct file *file) | 308 | |
308 | { | ||
309 | file->private_data = inode->i_private; | ||
310 | return 0; | ||
311 | } | ||
312 | 309 | ||
313 | static ssize_t port_show_regs(struct file *file, char __user *user_buf, | 310 | static ssize_t port_show_regs(struct file *file, char __user *user_buf, |
314 | size_t count, loff_t *ppos) | 311 | size_t count, loff_t *ppos) |
@@ -362,7 +359,7 @@ static ssize_t port_show_regs(struct file *file, char __user *user_buf, | |||
362 | 359 | ||
363 | static const struct file_operations port_regs_ops = { | 360 | static const struct file_operations port_regs_ops = { |
364 | .owner = THIS_MODULE, | 361 | .owner = THIS_MODULE, |
365 | .open = pch_show_regs_open, | 362 | .open = simple_open, |
366 | .read = port_show_regs, | 363 | .read = port_show_regs, |
367 | .llseek = default_llseek, | 364 | .llseek = default_llseek, |
368 | }; | 365 | }; |
@@ -388,6 +385,12 @@ static int pch_uart_get_uartclk(void) | |||
388 | if (cmp && strstr(cmp, "Fish River Island II")) | 385 | if (cmp && strstr(cmp, "Fish River Island II")) |
389 | return FRI2_48_UARTCLK; | 386 | return FRI2_48_UARTCLK; |
390 | 387 | ||
388 | /* Kontron COMe-mTT10 (nanoETXexpress-TT) */ | ||
389 | cmp = dmi_get_system_info(DMI_BOARD_NAME); | ||
390 | if (cmp && (strstr(cmp, "COMe-mTT") || | ||
391 | strstr(cmp, "nanoETXexpress-TT"))) | ||
392 | return NTC1_UARTCLK; | ||
393 | |||
391 | return DEFAULT_UARTCLK; | 394 | return DEFAULT_UARTCLK; |
392 | } | 395 | } |
393 | 396 | ||
@@ -1444,9 +1447,11 @@ static int pch_uart_verify_port(struct uart_port *port, | |||
1444 | __func__); | 1447 | __func__); |
1445 | return -EOPNOTSUPP; | 1448 | return -EOPNOTSUPP; |
1446 | #endif | 1449 | #endif |
1447 | priv->use_dma = 1; | ||
1448 | priv->use_dma_flag = 1; | 1450 | priv->use_dma_flag = 1; |
1449 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); | 1451 | dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n"); |
1452 | if (!priv->use_dma) | ||
1453 | pch_request_dma(port); | ||
1454 | priv->use_dma = 1; | ||
1450 | } | 1455 | } |
1451 | 1456 | ||
1452 | return 0; | 1457 | return 0; |
@@ -1655,6 +1660,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev, | |||
1655 | } | 1660 | } |
1656 | 1661 | ||
1657 | pci_enable_msi(pdev); | 1662 | pci_enable_msi(pdev); |
1663 | pci_set_master(pdev); | ||
1658 | 1664 | ||
1659 | iobase = pci_resource_start(pdev, 0); | 1665 | iobase = pci_resource_start(pdev, 0); |
1660 | mapbase = pci_resource_start(pdev, 1); | 1666 | mapbase = pci_resource_start(pdev, 1); |
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/serial/samsung.c b/drivers/tty/serial/samsung.c index de249d265bec..d8b0aee35632 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c | |||
@@ -982,6 +982,7 @@ static void s3c24xx_serial_resetport(struct uart_port *port, | |||
982 | 982 | ||
983 | ucon &= ucon_mask; | 983 | ucon &= ucon_mask; |
984 | wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); | 984 | wr_regl(port, S3C2410_UCON, ucon | cfg->ucon); |
985 | wr_regl(port, S3C2410_ULCON, cfg->ulcon); | ||
985 | 986 | ||
986 | /* reset both fifos */ | 987 | /* reset both fifos */ |
987 | wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); | 988 | wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH); |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index bf461cf99616..3158e17b665c 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -355,9 +355,6 @@ static void sci_serial_out(struct uart_port *p, int offset, int value) | |||
355 | WARN(1, "Invalid register access\n"); | 355 | WARN(1, "Invalid register access\n"); |
356 | } | 356 | } |
357 | 357 | ||
358 | #define sci_in(up, offset) (up->serial_in(up, offset)) | ||
359 | #define sci_out(up, offset, value) (up->serial_out(up, offset, value)) | ||
360 | |||
361 | static int sci_probe_regmap(struct plat_sci_port *cfg) | 358 | static int sci_probe_regmap(struct plat_sci_port *cfg) |
362 | { | 359 | { |
363 | switch (cfg->type) { | 360 | switch (cfg->type) { |
@@ -422,9 +419,9 @@ static int sci_poll_get_char(struct uart_port *port) | |||
422 | int c; | 419 | int c; |
423 | 420 | ||
424 | do { | 421 | do { |
425 | status = sci_in(port, SCxSR); | 422 | status = serial_port_in(port, SCxSR); |
426 | if (status & SCxSR_ERRORS(port)) { | 423 | if (status & SCxSR_ERRORS(port)) { |
427 | sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port)); | 424 | serial_port_out(port, SCxSR, SCxSR_ERROR_CLEAR(port)); |
428 | continue; | 425 | continue; |
429 | } | 426 | } |
430 | break; | 427 | break; |
@@ -433,11 +430,11 @@ static int sci_poll_get_char(struct uart_port *port) | |||
433 | if (!(status & SCxSR_RDxF(port))) | 430 | if (!(status & SCxSR_RDxF(port))) |
434 | return NO_POLL_CHAR; | 431 | return NO_POLL_CHAR; |
435 | 432 | ||
436 | c = sci_in(port, SCxRDR); | 433 | c = serial_port_in(port, SCxRDR); |
437 | 434 | ||
438 | /* Dummy read */ | 435 | /* Dummy read */ |
439 | sci_in(port, SCxSR); | 436 | serial_port_in(port, SCxSR); |
440 | sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); | 437 | serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); |
441 | 438 | ||
442 | return c; | 439 | return c; |
443 | } | 440 | } |
@@ -448,11 +445,11 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c) | |||
448 | unsigned short status; | 445 | unsigned short status; |
449 | 446 | ||
450 | do { | 447 | do { |
451 | status = sci_in(port, SCxSR); | 448 | status = serial_port_in(port, SCxSR); |
452 | } while (!(status & SCxSR_TDxE(port))); | 449 | } while (!(status & SCxSR_TDxE(port))); |
453 | 450 | ||
454 | sci_out(port, SCxTDR, c); | 451 | serial_port_out(port, SCxTDR, c); |
455 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port)); | 452 | serial_port_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port)); |
456 | } | 453 | } |
457 | #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */ | 454 | #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */ |
458 | 455 | ||
@@ -480,10 +477,10 @@ static void sci_init_pins(struct uart_port *port, unsigned int cflag) | |||
480 | ((!(cflag & CRTSCTS)))) { | 477 | ((!(cflag & CRTSCTS)))) { |
481 | unsigned short status; | 478 | unsigned short status; |
482 | 479 | ||
483 | status = sci_in(port, SCSPTR); | 480 | status = serial_port_in(port, SCSPTR); |
484 | status &= ~SCSPTR_CTSIO; | 481 | status &= ~SCSPTR_CTSIO; |
485 | status |= SCSPTR_RTSIO; | 482 | status |= SCSPTR_RTSIO; |
486 | sci_out(port, SCSPTR, status); /* Set RTS = 1 */ | 483 | serial_port_out(port, SCSPTR, status); /* Set RTS = 1 */ |
487 | } | 484 | } |
488 | } | 485 | } |
489 | 486 | ||
@@ -493,13 +490,13 @@ static int sci_txfill(struct uart_port *port) | |||
493 | 490 | ||
494 | reg = sci_getreg(port, SCTFDR); | 491 | reg = sci_getreg(port, SCTFDR); |
495 | if (reg->size) | 492 | if (reg->size) |
496 | return sci_in(port, SCTFDR) & 0xff; | 493 | return serial_port_in(port, SCTFDR) & 0xff; |
497 | 494 | ||
498 | reg = sci_getreg(port, SCFDR); | 495 | reg = sci_getreg(port, SCFDR); |
499 | if (reg->size) | 496 | if (reg->size) |
500 | return sci_in(port, SCFDR) >> 8; | 497 | return serial_port_in(port, SCFDR) >> 8; |
501 | 498 | ||
502 | return !(sci_in(port, SCxSR) & SCI_TDRE); | 499 | return !(serial_port_in(port, SCxSR) & SCI_TDRE); |
503 | } | 500 | } |
504 | 501 | ||
505 | static int sci_txroom(struct uart_port *port) | 502 | static int sci_txroom(struct uart_port *port) |
@@ -513,13 +510,13 @@ static int sci_rxfill(struct uart_port *port) | |||
513 | 510 | ||
514 | reg = sci_getreg(port, SCRFDR); | 511 | reg = sci_getreg(port, SCRFDR); |
515 | if (reg->size) | 512 | if (reg->size) |
516 | return sci_in(port, SCRFDR) & 0xff; | 513 | return serial_port_in(port, SCRFDR) & 0xff; |
517 | 514 | ||
518 | reg = sci_getreg(port, SCFDR); | 515 | reg = sci_getreg(port, SCFDR); |
519 | if (reg->size) | 516 | if (reg->size) |
520 | return sci_in(port, SCFDR) & ((port->fifosize << 1) - 1); | 517 | return serial_port_in(port, SCFDR) & ((port->fifosize << 1) - 1); |
521 | 518 | ||
522 | return (sci_in(port, SCxSR) & SCxSR_RDxF(port)) != 0; | 519 | return (serial_port_in(port, SCxSR) & SCxSR_RDxF(port)) != 0; |
523 | } | 520 | } |
524 | 521 | ||
525 | /* | 522 | /* |
@@ -547,14 +544,14 @@ static void sci_transmit_chars(struct uart_port *port) | |||
547 | unsigned short ctrl; | 544 | unsigned short ctrl; |
548 | int count; | 545 | int count; |
549 | 546 | ||
550 | status = sci_in(port, SCxSR); | 547 | status = serial_port_in(port, SCxSR); |
551 | if (!(status & SCxSR_TDxE(port))) { | 548 | if (!(status & SCxSR_TDxE(port))) { |
552 | ctrl = sci_in(port, SCSCR); | 549 | ctrl = serial_port_in(port, SCSCR); |
553 | if (uart_circ_empty(xmit)) | 550 | if (uart_circ_empty(xmit)) |
554 | ctrl &= ~SCSCR_TIE; | 551 | ctrl &= ~SCSCR_TIE; |
555 | else | 552 | else |
556 | ctrl |= SCSCR_TIE; | 553 | ctrl |= SCSCR_TIE; |
557 | sci_out(port, SCSCR, ctrl); | 554 | serial_port_out(port, SCSCR, ctrl); |
558 | return; | 555 | return; |
559 | } | 556 | } |
560 | 557 | ||
@@ -573,27 +570,27 @@ static void sci_transmit_chars(struct uart_port *port) | |||
573 | break; | 570 | break; |
574 | } | 571 | } |
575 | 572 | ||
576 | sci_out(port, SCxTDR, c); | 573 | serial_port_out(port, SCxTDR, c); |
577 | 574 | ||
578 | port->icount.tx++; | 575 | port->icount.tx++; |
579 | } while (--count > 0); | 576 | } while (--count > 0); |
580 | 577 | ||
581 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); | 578 | serial_port_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); |
582 | 579 | ||
583 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | 580 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
584 | uart_write_wakeup(port); | 581 | uart_write_wakeup(port); |
585 | if (uart_circ_empty(xmit)) { | 582 | if (uart_circ_empty(xmit)) { |
586 | sci_stop_tx(port); | 583 | sci_stop_tx(port); |
587 | } else { | 584 | } else { |
588 | ctrl = sci_in(port, SCSCR); | 585 | ctrl = serial_port_in(port, SCSCR); |
589 | 586 | ||
590 | if (port->type != PORT_SCI) { | 587 | if (port->type != PORT_SCI) { |
591 | sci_in(port, SCxSR); /* Dummy read */ | 588 | serial_port_in(port, SCxSR); /* Dummy read */ |
592 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); | 589 | serial_port_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); |
593 | } | 590 | } |
594 | 591 | ||
595 | ctrl |= SCSCR_TIE; | 592 | ctrl |= SCSCR_TIE; |
596 | sci_out(port, SCSCR, ctrl); | 593 | serial_port_out(port, SCSCR, ctrl); |
597 | } | 594 | } |
598 | } | 595 | } |
599 | 596 | ||
@@ -608,7 +605,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
608 | unsigned short status; | 605 | unsigned short status; |
609 | unsigned char flag; | 606 | unsigned char flag; |
610 | 607 | ||
611 | status = sci_in(port, SCxSR); | 608 | status = serial_port_in(port, SCxSR); |
612 | if (!(status & SCxSR_RDxF(port))) | 609 | if (!(status & SCxSR_RDxF(port))) |
613 | return; | 610 | return; |
614 | 611 | ||
@@ -621,7 +618,7 @@ static void sci_receive_chars(struct uart_port *port) | |||
621 | break; | 618 | break; |
622 | 619 | ||
623 | if (port->type == PORT_SCI) { | 620 | if (port->type == PORT_SCI) { |
624 | char c = sci_in(port, SCxRDR); | 621 | char c = serial_port_in(port, SCxRDR); |
625 | if (uart_handle_sysrq_char(port, c) || | 622 | if (uart_handle_sysrq_char(port, c) || |
626 | sci_port->break_flag) | 623 | sci_port->break_flag) |
627 | count = 0; | 624 | count = 0; |
@@ -629,9 +626,9 @@ static void sci_receive_chars(struct uart_port *port) | |||
629 | tty_insert_flip_char(tty, c, TTY_NORMAL); | 626 | tty_insert_flip_char(tty, c, TTY_NORMAL); |
630 | } else { | 627 | } else { |
631 | for (i = 0; i < count; i++) { | 628 | for (i = 0; i < count; i++) { |
632 | char c = sci_in(port, SCxRDR); | 629 | char c = serial_port_in(port, SCxRDR); |
633 | 630 | ||
634 | status = sci_in(port, SCxSR); | 631 | status = serial_port_in(port, SCxSR); |
635 | #if defined(CONFIG_CPU_SH3) | 632 | #if defined(CONFIG_CPU_SH3) |
636 | /* Skip "chars" during break */ | 633 | /* Skip "chars" during break */ |
637 | if (sci_port->break_flag) { | 634 | if (sci_port->break_flag) { |
@@ -672,8 +669,8 @@ static void sci_receive_chars(struct uart_port *port) | |||
672 | } | 669 | } |
673 | } | 670 | } |
674 | 671 | ||
675 | sci_in(port, SCxSR); /* dummy read */ | 672 | serial_port_in(port, SCxSR); /* dummy read */ |
676 | sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); | 673 | serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); |
677 | 674 | ||
678 | copied += count; | 675 | copied += count; |
679 | port->icount.rx += count; | 676 | port->icount.rx += count; |
@@ -683,8 +680,8 @@ static void sci_receive_chars(struct uart_port *port) | |||
683 | /* Tell the rest of the system the news. New characters! */ | 680 | /* Tell the rest of the system the news. New characters! */ |
684 | tty_flip_buffer_push(tty); | 681 | tty_flip_buffer_push(tty); |
685 | } else { | 682 | } else { |
686 | sci_in(port, SCxSR); /* dummy read */ | 683 | serial_port_in(port, SCxSR); /* dummy read */ |
687 | sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); | 684 | serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); |
688 | } | 685 | } |
689 | } | 686 | } |
690 | 687 | ||
@@ -726,7 +723,7 @@ static void sci_break_timer(unsigned long data) | |||
726 | static int sci_handle_errors(struct uart_port *port) | 723 | static int sci_handle_errors(struct uart_port *port) |
727 | { | 724 | { |
728 | int copied = 0; | 725 | int copied = 0; |
729 | unsigned short status = sci_in(port, SCxSR); | 726 | unsigned short status = serial_port_in(port, SCxSR); |
730 | struct tty_struct *tty = port->state->port.tty; | 727 | struct tty_struct *tty = port->state->port.tty; |
731 | struct sci_port *s = to_sci_port(port); | 728 | struct sci_port *s = to_sci_port(port); |
732 | 729 | ||
@@ -804,8 +801,8 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
804 | if (!reg->size) | 801 | if (!reg->size) |
805 | return 0; | 802 | return 0; |
806 | 803 | ||
807 | if ((sci_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) { | 804 | if ((serial_port_in(port, SCLSR) & (1 << s->cfg->overrun_bit))) { |
808 | sci_out(port, SCLSR, 0); | 805 | serial_port_out(port, SCLSR, 0); |
809 | 806 | ||
810 | port->icount.overrun++; | 807 | port->icount.overrun++; |
811 | 808 | ||
@@ -822,7 +819,7 @@ static int sci_handle_fifo_overrun(struct uart_port *port) | |||
822 | static int sci_handle_breaks(struct uart_port *port) | 819 | static int sci_handle_breaks(struct uart_port *port) |
823 | { | 820 | { |
824 | int copied = 0; | 821 | int copied = 0; |
825 | unsigned short status = sci_in(port, SCxSR); | 822 | unsigned short status = serial_port_in(port, SCxSR); |
826 | struct tty_struct *tty = port->state->port.tty; | 823 | struct tty_struct *tty = port->state->port.tty; |
827 | struct sci_port *s = to_sci_port(port); | 824 | struct sci_port *s = to_sci_port(port); |
828 | 825 | ||
@@ -859,8 +856,8 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) | |||
859 | struct sci_port *s = to_sci_port(port); | 856 | struct sci_port *s = to_sci_port(port); |
860 | 857 | ||
861 | if (s->chan_rx) { | 858 | if (s->chan_rx) { |
862 | u16 scr = sci_in(port, SCSCR); | 859 | u16 scr = serial_port_in(port, SCSCR); |
863 | u16 ssr = sci_in(port, SCxSR); | 860 | u16 ssr = serial_port_in(port, SCxSR); |
864 | 861 | ||
865 | /* Disable future Rx interrupts */ | 862 | /* Disable future Rx interrupts */ |
866 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { | 863 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
@@ -869,9 +866,9 @@ static irqreturn_t sci_rx_interrupt(int irq, void *ptr) | |||
869 | } else { | 866 | } else { |
870 | scr &= ~SCSCR_RIE; | 867 | scr &= ~SCSCR_RIE; |
871 | } | 868 | } |
872 | sci_out(port, SCSCR, scr); | 869 | serial_port_out(port, SCSCR, scr); |
873 | /* Clear current interrupt */ | 870 | /* Clear current interrupt */ |
874 | sci_out(port, SCxSR, ssr & ~(1 | SCxSR_RDxF(port))); | 871 | serial_port_out(port, SCxSR, ssr & ~(1 | SCxSR_RDxF(port))); |
875 | dev_dbg(port->dev, "Rx IRQ %lu: setup t-out in %u jiffies\n", | 872 | dev_dbg(port->dev, "Rx IRQ %lu: setup t-out in %u jiffies\n", |
876 | jiffies, s->rx_timeout); | 873 | jiffies, s->rx_timeout); |
877 | mod_timer(&s->rx_timer, jiffies + s->rx_timeout); | 874 | mod_timer(&s->rx_timer, jiffies + s->rx_timeout); |
@@ -909,15 +906,15 @@ static irqreturn_t sci_er_interrupt(int irq, void *ptr) | |||
909 | if (port->type == PORT_SCI) { | 906 | if (port->type == PORT_SCI) { |
910 | if (sci_handle_errors(port)) { | 907 | if (sci_handle_errors(port)) { |
911 | /* discard character in rx buffer */ | 908 | /* discard character in rx buffer */ |
912 | sci_in(port, SCxSR); | 909 | serial_port_in(port, SCxSR); |
913 | sci_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); | 910 | serial_port_out(port, SCxSR, SCxSR_RDxF_CLEAR(port)); |
914 | } | 911 | } |
915 | } else { | 912 | } else { |
916 | sci_handle_fifo_overrun(port); | 913 | sci_handle_fifo_overrun(port); |
917 | sci_rx_interrupt(irq, ptr); | 914 | sci_rx_interrupt(irq, ptr); |
918 | } | 915 | } |
919 | 916 | ||
920 | sci_out(port, SCxSR, SCxSR_ERROR_CLEAR(port)); | 917 | serial_port_out(port, SCxSR, SCxSR_ERROR_CLEAR(port)); |
921 | 918 | ||
922 | /* Kick the transmission */ | 919 | /* Kick the transmission */ |
923 | sci_tx_interrupt(irq, ptr); | 920 | sci_tx_interrupt(irq, ptr); |
@@ -931,7 +928,7 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) | |||
931 | 928 | ||
932 | /* Handle BREAKs */ | 929 | /* Handle BREAKs */ |
933 | sci_handle_breaks(port); | 930 | sci_handle_breaks(port); |
934 | sci_out(port, SCxSR, SCxSR_BREAK_CLEAR(port)); | 931 | serial_port_out(port, SCxSR, SCxSR_BREAK_CLEAR(port)); |
935 | 932 | ||
936 | return IRQ_HANDLED; | 933 | return IRQ_HANDLED; |
937 | } | 934 | } |
@@ -955,8 +952,8 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | |||
955 | struct sci_port *s = to_sci_port(port); | 952 | struct sci_port *s = to_sci_port(port); |
956 | irqreturn_t ret = IRQ_NONE; | 953 | irqreturn_t ret = IRQ_NONE; |
957 | 954 | ||
958 | ssr_status = sci_in(port, SCxSR); | 955 | ssr_status = serial_port_in(port, SCxSR); |
959 | scr_status = sci_in(port, SCSCR); | 956 | scr_status = serial_port_in(port, SCSCR); |
960 | err_enabled = scr_status & port_rx_irq_mask(port); | 957 | err_enabled = scr_status & port_rx_irq_mask(port); |
961 | 958 | ||
962 | /* Tx Interrupt */ | 959 | /* Tx Interrupt */ |
@@ -1170,7 +1167,7 @@ static void sci_free_gpios(struct sci_port *port) | |||
1170 | 1167 | ||
1171 | static unsigned int sci_tx_empty(struct uart_port *port) | 1168 | static unsigned int sci_tx_empty(struct uart_port *port) |
1172 | { | 1169 | { |
1173 | unsigned short status = sci_in(port, SCxSR); | 1170 | unsigned short status = serial_port_in(port, SCxSR); |
1174 | unsigned short in_tx_fifo = sci_txfill(port); | 1171 | unsigned short in_tx_fifo = sci_txfill(port); |
1175 | 1172 | ||
1176 | return (status & SCxSR_TEND(port)) && !in_tx_fifo ? TIOCSER_TEMT : 0; | 1173 | return (status & SCxSR_TEND(port)) && !in_tx_fifo ? TIOCSER_TEMT : 0; |
@@ -1198,7 +1195,7 @@ static void sci_set_mctrl(struct uart_port *port, unsigned int mctrl) | |||
1198 | */ | 1195 | */ |
1199 | reg = sci_getreg(port, SCFCR); | 1196 | reg = sci_getreg(port, SCFCR); |
1200 | if (reg->size) | 1197 | if (reg->size) |
1201 | sci_out(port, SCFCR, sci_in(port, SCFCR) | 1); | 1198 | serial_port_out(port, SCFCR, serial_port_in(port, SCFCR) | 1); |
1202 | } | 1199 | } |
1203 | } | 1200 | } |
1204 | 1201 | ||
@@ -1240,8 +1237,8 @@ static void sci_dma_tx_complete(void *arg) | |||
1240 | } else { | 1237 | } else { |
1241 | s->cookie_tx = -EINVAL; | 1238 | s->cookie_tx = -EINVAL; |
1242 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { | 1239 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
1243 | u16 ctrl = sci_in(port, SCSCR); | 1240 | u16 ctrl = serial_port_in(port, SCSCR); |
1244 | sci_out(port, SCSCR, ctrl & ~SCSCR_TIE); | 1241 | serial_port_out(port, SCSCR, ctrl & ~SCSCR_TIE); |
1245 | } | 1242 | } |
1246 | } | 1243 | } |
1247 | 1244 | ||
@@ -1494,13 +1491,13 @@ static void sci_start_tx(struct uart_port *port) | |||
1494 | 1491 | ||
1495 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | 1492 | #ifdef CONFIG_SERIAL_SH_SCI_DMA |
1496 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { | 1493 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
1497 | u16 new, scr = sci_in(port, SCSCR); | 1494 | u16 new, scr = serial_port_in(port, SCSCR); |
1498 | if (s->chan_tx) | 1495 | if (s->chan_tx) |
1499 | new = scr | 0x8000; | 1496 | new = scr | 0x8000; |
1500 | else | 1497 | else |
1501 | new = scr & ~0x8000; | 1498 | new = scr & ~0x8000; |
1502 | if (new != scr) | 1499 | if (new != scr) |
1503 | sci_out(port, SCSCR, new); | 1500 | serial_port_out(port, SCSCR, new); |
1504 | } | 1501 | } |
1505 | 1502 | ||
1506 | if (s->chan_tx && !uart_circ_empty(&s->port.state->xmit) && | 1503 | if (s->chan_tx && !uart_circ_empty(&s->port.state->xmit) && |
@@ -1512,8 +1509,8 @@ static void sci_start_tx(struct uart_port *port) | |||
1512 | 1509 | ||
1513 | if (!s->chan_tx || port->type == PORT_SCIFA || port->type == PORT_SCIFB) { | 1510 | if (!s->chan_tx || port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
1514 | /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */ | 1511 | /* Set TIE (Transmit Interrupt Enable) bit in SCSCR */ |
1515 | ctrl = sci_in(port, SCSCR); | 1512 | ctrl = serial_port_in(port, SCSCR); |
1516 | sci_out(port, SCSCR, ctrl | SCSCR_TIE); | 1513 | serial_port_out(port, SCSCR, ctrl | SCSCR_TIE); |
1517 | } | 1514 | } |
1518 | } | 1515 | } |
1519 | 1516 | ||
@@ -1522,40 +1519,40 @@ static void sci_stop_tx(struct uart_port *port) | |||
1522 | unsigned short ctrl; | 1519 | unsigned short ctrl; |
1523 | 1520 | ||
1524 | /* Clear TIE (Transmit Interrupt Enable) bit in SCSCR */ | 1521 | /* Clear TIE (Transmit Interrupt Enable) bit in SCSCR */ |
1525 | ctrl = sci_in(port, SCSCR); | 1522 | ctrl = serial_port_in(port, SCSCR); |
1526 | 1523 | ||
1527 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) | 1524 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) |
1528 | ctrl &= ~0x8000; | 1525 | ctrl &= ~0x8000; |
1529 | 1526 | ||
1530 | ctrl &= ~SCSCR_TIE; | 1527 | ctrl &= ~SCSCR_TIE; |
1531 | 1528 | ||
1532 | sci_out(port, SCSCR, ctrl); | 1529 | serial_port_out(port, SCSCR, ctrl); |
1533 | } | 1530 | } |
1534 | 1531 | ||
1535 | static void sci_start_rx(struct uart_port *port) | 1532 | static void sci_start_rx(struct uart_port *port) |
1536 | { | 1533 | { |
1537 | unsigned short ctrl; | 1534 | unsigned short ctrl; |
1538 | 1535 | ||
1539 | ctrl = sci_in(port, SCSCR) | port_rx_irq_mask(port); | 1536 | ctrl = serial_port_in(port, SCSCR) | port_rx_irq_mask(port); |
1540 | 1537 | ||
1541 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) | 1538 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) |
1542 | ctrl &= ~0x4000; | 1539 | ctrl &= ~0x4000; |
1543 | 1540 | ||
1544 | sci_out(port, SCSCR, ctrl); | 1541 | serial_port_out(port, SCSCR, ctrl); |
1545 | } | 1542 | } |
1546 | 1543 | ||
1547 | static void sci_stop_rx(struct uart_port *port) | 1544 | static void sci_stop_rx(struct uart_port *port) |
1548 | { | 1545 | { |
1549 | unsigned short ctrl; | 1546 | unsigned short ctrl; |
1550 | 1547 | ||
1551 | ctrl = sci_in(port, SCSCR); | 1548 | ctrl = serial_port_in(port, SCSCR); |
1552 | 1549 | ||
1553 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) | 1550 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) |
1554 | ctrl &= ~0x4000; | 1551 | ctrl &= ~0x4000; |
1555 | 1552 | ||
1556 | ctrl &= ~port_rx_irq_mask(port); | 1553 | ctrl &= ~port_rx_irq_mask(port); |
1557 | 1554 | ||
1558 | sci_out(port, SCSCR, ctrl); | 1555 | serial_port_out(port, SCSCR, ctrl); |
1559 | } | 1556 | } |
1560 | 1557 | ||
1561 | static void sci_enable_ms(struct uart_port *port) | 1558 | static void sci_enable_ms(struct uart_port *port) |
@@ -1589,13 +1586,13 @@ static void rx_timer_fn(unsigned long arg) | |||
1589 | { | 1586 | { |
1590 | struct sci_port *s = (struct sci_port *)arg; | 1587 | struct sci_port *s = (struct sci_port *)arg; |
1591 | struct uart_port *port = &s->port; | 1588 | struct uart_port *port = &s->port; |
1592 | u16 scr = sci_in(port, SCSCR); | 1589 | u16 scr = serial_port_in(port, SCSCR); |
1593 | 1590 | ||
1594 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { | 1591 | if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
1595 | scr &= ~0x4000; | 1592 | scr &= ~0x4000; |
1596 | enable_irq(s->cfg->irqs[1]); | 1593 | enable_irq(s->cfg->irqs[1]); |
1597 | } | 1594 | } |
1598 | sci_out(port, SCSCR, scr | SCSCR_RIE); | 1595 | serial_port_out(port, SCSCR, scr | SCSCR_RIE); |
1599 | dev_dbg(port->dev, "DMA Rx timed out\n"); | 1596 | dev_dbg(port->dev, "DMA Rx timed out\n"); |
1600 | schedule_work(&s->work_rx); | 1597 | schedule_work(&s->work_rx); |
1601 | } | 1598 | } |
@@ -1776,14 +1773,14 @@ static void sci_reset(struct uart_port *port) | |||
1776 | unsigned int status; | 1773 | unsigned int status; |
1777 | 1774 | ||
1778 | do { | 1775 | do { |
1779 | status = sci_in(port, SCxSR); | 1776 | status = serial_port_in(port, SCxSR); |
1780 | } while (!(status & SCxSR_TEND(port))); | 1777 | } while (!(status & SCxSR_TEND(port))); |
1781 | 1778 | ||
1782 | sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ | 1779 | serial_port_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ |
1783 | 1780 | ||
1784 | reg = sci_getreg(port, SCFCR); | 1781 | reg = sci_getreg(port, SCFCR); |
1785 | if (reg->size) | 1782 | if (reg->size) |
1786 | sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); | 1783 | serial_port_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); |
1787 | } | 1784 | } |
1788 | 1785 | ||
1789 | static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | 1786 | static void sci_set_termios(struct uart_port *port, struct ktermios *termios, |
@@ -1812,7 +1809,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1812 | 1809 | ||
1813 | sci_reset(port); | 1810 | sci_reset(port); |
1814 | 1811 | ||
1815 | smr_val = sci_in(port, SCSMR) & 3; | 1812 | smr_val = serial_port_in(port, SCSMR) & 3; |
1816 | 1813 | ||
1817 | if ((termios->c_cflag & CSIZE) == CS7) | 1814 | if ((termios->c_cflag & CSIZE) == CS7) |
1818 | smr_val |= 0x40; | 1815 | smr_val |= 0x40; |
@@ -1825,19 +1822,19 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1825 | 1822 | ||
1826 | uart_update_timeout(port, termios->c_cflag, baud); | 1823 | uart_update_timeout(port, termios->c_cflag, baud); |
1827 | 1824 | ||
1828 | sci_out(port, SCSMR, smr_val); | 1825 | serial_port_out(port, SCSMR, smr_val); |
1829 | 1826 | ||
1830 | dev_dbg(port->dev, "%s: SMR %x, t %x, SCSCR %x\n", __func__, smr_val, t, | 1827 | dev_dbg(port->dev, "%s: SMR %x, t %x, SCSCR %x\n", __func__, smr_val, t, |
1831 | s->cfg->scscr); | 1828 | s->cfg->scscr); |
1832 | 1829 | ||
1833 | if (t > 0) { | 1830 | if (t > 0) { |
1834 | if (t >= 256) { | 1831 | if (t >= 256) { |
1835 | sci_out(port, SCSMR, (sci_in(port, SCSMR) & ~3) | 1); | 1832 | serial_port_out(port, SCSMR, (serial_port_in(port, SCSMR) & ~3) | 1); |
1836 | t >>= 2; | 1833 | t >>= 2; |
1837 | } else | 1834 | } else |
1838 | sci_out(port, SCSMR, sci_in(port, SCSMR) & ~3); | 1835 | serial_port_out(port, SCSMR, serial_port_in(port, SCSMR) & ~3); |
1839 | 1836 | ||
1840 | sci_out(port, SCBRR, t); | 1837 | serial_port_out(port, SCBRR, t); |
1841 | udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */ | 1838 | udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */ |
1842 | } | 1839 | } |
1843 | 1840 | ||
@@ -1845,7 +1842,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1845 | 1842 | ||
1846 | reg = sci_getreg(port, SCFCR); | 1843 | reg = sci_getreg(port, SCFCR); |
1847 | if (reg->size) { | 1844 | if (reg->size) { |
1848 | unsigned short ctrl = sci_in(port, SCFCR); | 1845 | unsigned short ctrl = serial_port_in(port, SCFCR); |
1849 | 1846 | ||
1850 | if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) { | 1847 | if (s->cfg->capabilities & SCIx_HAVE_RTSCTS) { |
1851 | if (termios->c_cflag & CRTSCTS) | 1848 | if (termios->c_cflag & CRTSCTS) |
@@ -1861,10 +1858,10 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1861 | */ | 1858 | */ |
1862 | ctrl &= ~(SCFCR_RFRST | SCFCR_TFRST); | 1859 | ctrl &= ~(SCFCR_RFRST | SCFCR_TFRST); |
1863 | 1860 | ||
1864 | sci_out(port, SCFCR, ctrl); | 1861 | serial_port_out(port, SCFCR, ctrl); |
1865 | } | 1862 | } |
1866 | 1863 | ||
1867 | sci_out(port, SCSCR, s->cfg->scscr); | 1864 | serial_port_out(port, SCSCR, s->cfg->scscr); |
1868 | 1865 | ||
1869 | #ifdef CONFIG_SERIAL_SH_SCI_DMA | 1866 | #ifdef CONFIG_SERIAL_SH_SCI_DMA |
1870 | /* | 1867 | /* |
@@ -2166,7 +2163,7 @@ static void serial_console_write(struct console *co, const char *s, | |||
2166 | 2163 | ||
2167 | /* wait until fifo is empty and last bit has been transmitted */ | 2164 | /* wait until fifo is empty and last bit has been transmitted */ |
2168 | bits = SCxSR_TDxE(port) | SCxSR_TEND(port); | 2165 | bits = SCxSR_TDxE(port) | SCxSR_TEND(port); |
2169 | while ((sci_in(port, SCxSR) & bits) != bits) | 2166 | while ((serial_port_in(port, SCxSR) & bits) != bits) |
2170 | cpu_relax(); | 2167 | cpu_relax(); |
2171 | 2168 | ||
2172 | sci_port_disable(sci_port); | 2169 | sci_port_disable(sci_port); |
@@ -2260,12 +2257,12 @@ static int sci_runtime_suspend(struct device *dev) | |||
2260 | if (uart_console(port)) { | 2257 | if (uart_console(port)) { |
2261 | struct plat_sci_reg *reg; | 2258 | struct plat_sci_reg *reg; |
2262 | 2259 | ||
2263 | sci_port->saved_smr = sci_in(port, SCSMR); | 2260 | sci_port->saved_smr = serial_port_in(port, SCSMR); |
2264 | sci_port->saved_brr = sci_in(port, SCBRR); | 2261 | sci_port->saved_brr = serial_port_in(port, SCBRR); |
2265 | 2262 | ||
2266 | reg = sci_getreg(port, SCFCR); | 2263 | reg = sci_getreg(port, SCFCR); |
2267 | if (reg->size) | 2264 | if (reg->size) |
2268 | sci_port->saved_fcr = sci_in(port, SCFCR); | 2265 | sci_port->saved_fcr = serial_port_in(port, SCFCR); |
2269 | else | 2266 | else |
2270 | sci_port->saved_fcr = 0; | 2267 | sci_port->saved_fcr = 0; |
2271 | } | 2268 | } |
@@ -2279,13 +2276,13 @@ static int sci_runtime_resume(struct device *dev) | |||
2279 | 2276 | ||
2280 | if (uart_console(port)) { | 2277 | if (uart_console(port)) { |
2281 | sci_reset(port); | 2278 | sci_reset(port); |
2282 | sci_out(port, SCSMR, sci_port->saved_smr); | 2279 | serial_port_out(port, SCSMR, sci_port->saved_smr); |
2283 | sci_out(port, SCBRR, sci_port->saved_brr); | 2280 | serial_port_out(port, SCBRR, sci_port->saved_brr); |
2284 | 2281 | ||
2285 | if (sci_port->saved_fcr) | 2282 | if (sci_port->saved_fcr) |
2286 | sci_out(port, SCFCR, sci_port->saved_fcr); | 2283 | serial_port_out(port, SCFCR, sci_port->saved_fcr); |
2287 | 2284 | ||
2288 | sci_out(port, SCSCR, sci_port->cfg->scscr); | 2285 | serial_port_out(port, SCSCR, sci_port->cfg->scscr); |
2289 | } | 2286 | } |
2290 | return 0; | 2287 | return 0; |
2291 | } | 2288 | } |
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h index a1a2d364f92b..4c22a1529aac 100644 --- a/drivers/tty/serial/sh-sci.h +++ b/drivers/tty/serial/sh-sci.h | |||
@@ -20,10 +20,10 @@ | |||
20 | defined(CONFIG_ARCH_SH7372) || \ | 20 | defined(CONFIG_ARCH_SH7372) || \ |
21 | defined(CONFIG_ARCH_R8A7740) | 21 | defined(CONFIG_ARCH_R8A7740) |
22 | 22 | ||
23 | # define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc) | 23 | # define SCxSR_RDxF_CLEAR(port) (serial_port_in(port, SCxSR) & 0xfffc) |
24 | # define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73) | 24 | # define SCxSR_ERROR_CLEAR(port) (serial_port_in(port, SCxSR) & 0xfd73) |
25 | # define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf) | 25 | # define SCxSR_TDxE_CLEAR(port) (serial_port_in(port, SCxSR) & 0xffdf) |
26 | # define SCxSR_BREAK_CLEAR(port) (sci_in(port, SCxSR) & 0xffe3) | 26 | # define SCxSR_BREAK_CLEAR(port) (serial_port_in(port, SCxSR) & 0xffe3) |
27 | #else | 27 | #else |
28 | # define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc) | 28 | # define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc) |
29 | # define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073) | 29 | # define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073) |
diff --git a/drivers/tty/serial/sunzilog.c b/drivers/tty/serial/sunzilog.c index b3b70b0bf85b..babd9470982b 100644 --- a/drivers/tty/serial/sunzilog.c +++ b/drivers/tty/serial/sunzilog.c | |||
@@ -1581,7 +1581,7 @@ static int __init sunzilog_init(void) | |||
1581 | if (err) | 1581 | if (err) |
1582 | goto out_unregister_uart; | 1582 | goto out_unregister_uart; |
1583 | 1583 | ||
1584 | if (!zilog_irq) { | 1584 | if (zilog_irq) { |
1585 | struct uart_sunzilog_port *up = sunzilog_irq_chain; | 1585 | struct uart_sunzilog_port *up = sunzilog_irq_chain; |
1586 | err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED, | 1586 | err = request_irq(zilog_irq, sunzilog_interrupt, IRQF_SHARED, |
1587 | "zs", sunzilog_irq_chain); | 1587 | "zs", sunzilog_irq_chain); |
@@ -1622,7 +1622,7 @@ static void __exit sunzilog_exit(void) | |||
1622 | { | 1622 | { |
1623 | platform_driver_unregister(&zs_driver); | 1623 | platform_driver_unregister(&zs_driver); |
1624 | 1624 | ||
1625 | if (!zilog_irq) { | 1625 | if (zilog_irq) { |
1626 | struct uart_sunzilog_port *up = sunzilog_irq_chain; | 1626 | struct uart_sunzilog_port *up = sunzilog_irq_chain; |
1627 | 1627 | ||
1628 | /* Disable Interrupts */ | 1628 | /* Disable Interrupts */ |
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c index 136e86faa1e1..05728894a88c 100644 --- a/drivers/tty/sysrq.c +++ b/drivers/tty/sysrq.c | |||
@@ -327,7 +327,7 @@ static void send_sig_all(int sig) | |||
327 | if (is_global_init(p)) | 327 | if (is_global_init(p)) |
328 | continue; | 328 | continue; |
329 | 329 | ||
330 | force_sig(sig, p); | 330 | do_send_sig_info(sig, SEND_SIG_FORCED, p, true); |
331 | } | 331 | } |
332 | read_unlock(&tasklist_lock); | 332 | read_unlock(&tasklist_lock); |
333 | } | 333 | } |
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/tty/vt/vt.c b/drivers/tty/vt/vt.c index 3bdd4b19dd06..2156188db4a6 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c | |||
@@ -2932,11 +2932,10 @@ static int __init con_init(void) | |||
2932 | gotoxy(vc, vc->vc_x, vc->vc_y); | 2932 | gotoxy(vc, vc->vc_x, vc->vc_y); |
2933 | csi_J(vc, 0); | 2933 | csi_J(vc, 0); |
2934 | update_screen(vc); | 2934 | update_screen(vc); |
2935 | pr_info("Console: %s %s %dx%d", | 2935 | pr_info("Console: %s %s %dx%d\n", |
2936 | vc->vc_can_do_color ? "colour" : "mono", | 2936 | vc->vc_can_do_color ? "colour" : "mono", |
2937 | display_desc, vc->vc_cols, vc->vc_rows); | 2937 | display_desc, vc->vc_cols, vc->vc_rows); |
2938 | printable = 1; | 2938 | printable = 1; |
2939 | printk("\n"); | ||
2940 | 2939 | ||
2941 | console_unlock(); | 2940 | console_unlock(); |
2942 | 2941 | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index cbd8f5f80596..76316a33061b 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -2,14 +2,6 @@ | |||
2 | # USB device configuration | 2 | # USB device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig USB_SUPPORT | ||
6 | bool "USB support" | ||
7 | depends on HAS_IOMEM | ||
8 | default y | ||
9 | ---help--- | ||
10 | This option adds core support for Universal Serial Bus (USB). | ||
11 | You will also need drivers from the following menu to make use of it. | ||
12 | |||
13 | # many non-PCI SOC chips embed OHCI | 5 | # many non-PCI SOC chips embed OHCI |
14 | config USB_ARCH_HAS_OHCI | 6 | config USB_ARCH_HAS_OHCI |
15 | boolean | 7 | boolean |
@@ -63,6 +55,14 @@ config USB_ARCH_HAS_XHCI | |||
63 | boolean | 55 | boolean |
64 | default PCI | 56 | default PCI |
65 | 57 | ||
58 | menuconfig USB_SUPPORT | ||
59 | bool "USB support" | ||
60 | depends on HAS_IOMEM | ||
61 | default y | ||
62 | ---help--- | ||
63 | This option adds core support for Universal Serial Bus (USB). | ||
64 | You will also need drivers from the following menu to make use of it. | ||
65 | |||
66 | if USB_SUPPORT | 66 | if USB_SUPPORT |
67 | 67 | ||
68 | config USB_COMMON | 68 | config USB_COMMON |
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/driver.c b/drivers/usb/core/driver.c index f8e2d6d52e5c..9a56635dc19c 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1189,8 +1189,13 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
1189 | if (status == 0) { | 1189 | if (status == 0) { |
1190 | status = usb_suspend_device(udev, msg); | 1190 | status = usb_suspend_device(udev, msg); |
1191 | 1191 | ||
1192 | /* Again, ignore errors during system sleep transitions */ | 1192 | /* |
1193 | if (!PMSG_IS_AUTO(msg)) | 1193 | * Ignore errors from non-root-hub devices during |
1194 | * system sleep transitions. For the most part, | ||
1195 | * these devices should go to low power anyway when | ||
1196 | * the entire bus is suspended. | ||
1197 | */ | ||
1198 | if (udev->parent && !PMSG_IS_AUTO(msg)) | ||
1194 | status = 0; | 1199 | status = 0; |
1195 | } | 1200 | } |
1196 | 1201 | ||
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 622b4a48e732..57ed9e400c06 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -493,6 +493,15 @@ static int hcd_pci_suspend_noirq(struct device *dev) | |||
493 | 493 | ||
494 | pci_save_state(pci_dev); | 494 | pci_save_state(pci_dev); |
495 | 495 | ||
496 | /* | ||
497 | * Some systems crash if an EHCI controller is in D3 during | ||
498 | * a sleep transition. We have to leave such controllers in D0. | ||
499 | */ | ||
500 | if (hcd->broken_pci_sleep) { | ||
501 | dev_dbg(dev, "Staying in PCI D0\n"); | ||
502 | return retval; | ||
503 | } | ||
504 | |||
496 | /* If the root hub is dead rather than suspended, disallow remote | 505 | /* If the root hub is dead rather than suspended, disallow remote |
497 | * wakeup. usb_hc_died() should ensure that both hosts are marked as | 506 | * wakeup. usb_hc_died() should ensure that both hosts are marked as |
498 | * dying, so we only need to check the primary roothub. | 507 | * dying, so we only need to check the primary roothub. |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 9d7fc9a39933..140d3e11f212 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1978,6 +1978,18 @@ int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg) | |||
1978 | if (status == 0) { | 1978 | if (status == 0) { |
1979 | usb_set_device_state(rhdev, USB_STATE_SUSPENDED); | 1979 | usb_set_device_state(rhdev, USB_STATE_SUSPENDED); |
1980 | hcd->state = HC_STATE_SUSPENDED; | 1980 | hcd->state = HC_STATE_SUSPENDED; |
1981 | |||
1982 | /* Did we race with a root-hub wakeup event? */ | ||
1983 | if (rhdev->do_remote_wakeup) { | ||
1984 | char buffer[6]; | ||
1985 | |||
1986 | status = hcd->driver->hub_status_data(hcd, buffer); | ||
1987 | if (status != 0) { | ||
1988 | dev_dbg(&rhdev->dev, "suspend raced with wakeup event\n"); | ||
1989 | hcd_bus_resume(rhdev, PMSG_AUTO_RESUME); | ||
1990 | status = -EBUSY; | ||
1991 | } | ||
1992 | } | ||
1981 | } else { | 1993 | } else { |
1982 | spin_lock_irq(&hcd_root_hub_lock); | 1994 | spin_lock_irq(&hcd_root_hub_lock); |
1983 | if (!HCD_DEAD(hcd)) { | 1995 | if (!HCD_DEAD(hcd)) { |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 28664eb7f555..ec6c97dadbe4 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1667,7 +1667,6 @@ void usb_disconnect(struct usb_device **pdev) | |||
1667 | { | 1667 | { |
1668 | struct usb_device *udev = *pdev; | 1668 | struct usb_device *udev = *pdev; |
1669 | int i; | 1669 | int i; |
1670 | struct usb_hcd *hcd = bus_to_hcd(udev->bus); | ||
1671 | 1670 | ||
1672 | /* mark the device as inactive, so any further urb submissions for | 1671 | /* mark the device as inactive, so any further urb submissions for |
1673 | * this device (and any of its children) will fail immediately. | 1672 | * this device (and any of its children) will fail immediately. |
@@ -1690,9 +1689,7 @@ void usb_disconnect(struct usb_device **pdev) | |||
1690 | * so that the hardware is now fully quiesced. | 1689 | * so that the hardware is now fully quiesced. |
1691 | */ | 1690 | */ |
1692 | dev_dbg (&udev->dev, "unregistering device\n"); | 1691 | dev_dbg (&udev->dev, "unregistering device\n"); |
1693 | mutex_lock(hcd->bandwidth_mutex); | ||
1694 | usb_disable_device(udev, 0); | 1692 | usb_disable_device(udev, 0); |
1695 | mutex_unlock(hcd->bandwidth_mutex); | ||
1696 | usb_hcd_synchronize_unlinks(udev); | 1693 | usb_hcd_synchronize_unlinks(udev); |
1697 | 1694 | ||
1698 | usb_remove_ep_devs(&udev->ep0); | 1695 | usb_remove_ep_devs(&udev->ep0); |
@@ -3163,6 +3160,22 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
3163 | if (retval) | 3160 | if (retval) |
3164 | goto fail; | 3161 | goto fail; |
3165 | 3162 | ||
3163 | /* | ||
3164 | * Some superspeed devices have finished the link training process | ||
3165 | * and attached to a superspeed hub port, but the device descriptor | ||
3166 | * got from those devices show they aren't superspeed devices. Warm | ||
3167 | * reset the port attached by the devices can fix them. | ||
3168 | */ | ||
3169 | if ((udev->speed == USB_SPEED_SUPER) && | ||
3170 | (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) { | ||
3171 | dev_err(&udev->dev, "got a wrong device descriptor, " | ||
3172 | "warm reset device\n"); | ||
3173 | hub_port_reset(hub, port1, udev, | ||
3174 | HUB_BH_RESET_TIME, true); | ||
3175 | retval = -EINVAL; | ||
3176 | goto fail; | ||
3177 | } | ||
3178 | |||
3166 | if (udev->descriptor.bMaxPacketSize0 == 0xff || | 3179 | if (udev->descriptor.bMaxPacketSize0 == 0xff || |
3167 | udev->speed == USB_SPEED_SUPER) | 3180 | udev->speed == USB_SPEED_SUPER) |
3168 | i = 512; | 3181 | i = 512; |
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index cefa0c8b5b6a..d2b9af59cba9 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -428,18 +428,10 @@ static loff_t default_file_lseek (struct file *file, loff_t offset, int orig) | |||
428 | return retval; | 428 | return retval; |
429 | } | 429 | } |
430 | 430 | ||
431 | static int default_open (struct inode *inode, struct file *file) | ||
432 | { | ||
433 | if (inode->i_private) | ||
434 | file->private_data = inode->i_private; | ||
435 | |||
436 | return 0; | ||
437 | } | ||
438 | |||
439 | static const struct file_operations default_file_operations = { | 431 | static const struct file_operations default_file_operations = { |
440 | .read = default_read_file, | 432 | .read = default_read_file, |
441 | .write = default_write_file, | 433 | .write = default_write_file, |
442 | .open = default_open, | 434 | .open = simple_open, |
443 | .llseek = default_file_lseek, | 435 | .llseek = default_file_lseek, |
444 | }; | 436 | }; |
445 | 437 | ||
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index b3bdfede45e6..ca717da3be95 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -308,7 +308,8 @@ static void sg_complete(struct urb *urb) | |||
308 | retval = usb_unlink_urb(io->urbs [i]); | 308 | retval = usb_unlink_urb(io->urbs [i]); |
309 | if (retval != -EINPROGRESS && | 309 | if (retval != -EINPROGRESS && |
310 | retval != -ENODEV && | 310 | retval != -ENODEV && |
311 | retval != -EBUSY) | 311 | retval != -EBUSY && |
312 | retval != -EIDRM) | ||
312 | dev_err(&io->dev->dev, | 313 | dev_err(&io->dev->dev, |
313 | "%s, unlink --> %d\n", | 314 | "%s, unlink --> %d\n", |
314 | __func__, retval); | 315 | __func__, retval); |
@@ -317,7 +318,6 @@ static void sg_complete(struct urb *urb) | |||
317 | } | 318 | } |
318 | spin_lock(&io->lock); | 319 | spin_lock(&io->lock); |
319 | } | 320 | } |
320 | urb->dev = NULL; | ||
321 | 321 | ||
322 | /* on the last completion, signal usb_sg_wait() */ | 322 | /* on the last completion, signal usb_sg_wait() */ |
323 | io->bytes += urb->actual_length; | 323 | io->bytes += urb->actual_length; |
@@ -524,7 +524,6 @@ void usb_sg_wait(struct usb_sg_request *io) | |||
524 | case -ENXIO: /* hc didn't queue this one */ | 524 | case -ENXIO: /* hc didn't queue this one */ |
525 | case -EAGAIN: | 525 | case -EAGAIN: |
526 | case -ENOMEM: | 526 | case -ENOMEM: |
527 | io->urbs[i]->dev = NULL; | ||
528 | retval = 0; | 527 | retval = 0; |
529 | yield(); | 528 | yield(); |
530 | break; | 529 | break; |
@@ -542,7 +541,6 @@ void usb_sg_wait(struct usb_sg_request *io) | |||
542 | 541 | ||
543 | /* fail any uncompleted urbs */ | 542 | /* fail any uncompleted urbs */ |
544 | default: | 543 | default: |
545 | io->urbs[i]->dev = NULL; | ||
546 | io->urbs[i]->status = retval; | 544 | io->urbs[i]->status = retval; |
547 | dev_dbg(&io->dev->dev, "%s, submit --> %d\n", | 545 | dev_dbg(&io->dev->dev, "%s, submit --> %d\n", |
548 | __func__, retval); | 546 | __func__, retval); |
@@ -593,7 +591,10 @@ void usb_sg_cancel(struct usb_sg_request *io) | |||
593 | if (!io->urbs [i]->dev) | 591 | if (!io->urbs [i]->dev) |
594 | continue; | 592 | continue; |
595 | retval = usb_unlink_urb(io->urbs [i]); | 593 | retval = usb_unlink_urb(io->urbs [i]); |
596 | if (retval != -EINPROGRESS && retval != -EBUSY) | 594 | if (retval != -EINPROGRESS |
595 | && retval != -ENODEV | ||
596 | && retval != -EBUSY | ||
597 | && retval != -EIDRM) | ||
597 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", | 598 | dev_warn(&io->dev->dev, "%s, unlink --> %d\n", |
598 | __func__, retval); | 599 | __func__, retval); |
599 | } | 600 | } |
@@ -1135,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf, | |||
1135 | * Deallocates hcd/hardware state for the endpoints (nuking all or most | 1136 | * Deallocates hcd/hardware state for the endpoints (nuking all or most |
1136 | * pending urbs) and usbcore state for the interfaces, so that usbcore | 1137 | * pending urbs) and usbcore state for the interfaces, so that usbcore |
1137 | * must usb_set_configuration() before any interfaces could be used. | 1138 | * must usb_set_configuration() before any interfaces could be used. |
1138 | * | ||
1139 | * Must be called with hcd->bandwidth_mutex held. | ||
1140 | */ | 1139 | */ |
1141 | void usb_disable_device(struct usb_device *dev, int skip_ep0) | 1140 | void usb_disable_device(struct usb_device *dev, int skip_ep0) |
1142 | { | 1141 | { |
@@ -1189,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
1189 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); | 1188 | usb_disable_endpoint(dev, i + USB_DIR_IN, false); |
1190 | } | 1189 | } |
1191 | /* Remove endpoints from the host controller internal state */ | 1190 | /* Remove endpoints from the host controller internal state */ |
1191 | mutex_lock(hcd->bandwidth_mutex); | ||
1192 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | 1192 | usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); |
1193 | mutex_unlock(hcd->bandwidth_mutex); | ||
1193 | /* Second pass: remove endpoint pointers */ | 1194 | /* Second pass: remove endpoint pointers */ |
1194 | } | 1195 | } |
1195 | for (i = skip_ep0; i < 16; ++i) { | 1196 | for (i = skip_ep0; i < 16; ++i) { |
@@ -1749,7 +1750,6 @@ free_interfaces: | |||
1749 | /* if it's already configured, clear out old state first. | 1750 | /* if it's already configured, clear out old state first. |
1750 | * getting rid of old interfaces means unbinding their drivers. | 1751 | * getting rid of old interfaces means unbinding their drivers. |
1751 | */ | 1752 | */ |
1752 | mutex_lock(hcd->bandwidth_mutex); | ||
1753 | if (dev->state != USB_STATE_ADDRESS) | 1753 | if (dev->state != USB_STATE_ADDRESS) |
1754 | usb_disable_device(dev, 1); /* Skip ep0 */ | 1754 | usb_disable_device(dev, 1); /* Skip ep0 */ |
1755 | 1755 | ||
@@ -1762,6 +1762,7 @@ free_interfaces: | |||
1762 | * host controller will not allow submissions to dropped endpoints. If | 1762 | * host controller will not allow submissions to dropped endpoints. If |
1763 | * this call fails, the device state is unchanged. | 1763 | * this call fails, the device state is unchanged. |
1764 | */ | 1764 | */ |
1765 | mutex_lock(hcd->bandwidth_mutex); | ||
1765 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); | 1766 | ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL); |
1766 | if (ret < 0) { | 1767 | if (ret < 0) { |
1767 | mutex_unlock(hcd->bandwidth_mutex); | 1768 | mutex_unlock(hcd->bandwidth_mutex); |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index 7239a73c1b8c..cd9b3a2cd8a7 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -539,6 +539,10 @@ EXPORT_SYMBOL_GPL(usb_submit_urb); | |||
539 | * never submitted, or it was unlinked before, or the hardware is already | 539 | * never submitted, or it was unlinked before, or the hardware is already |
540 | * finished with it), even if the completion handler has not yet run. | 540 | * finished with it), even if the completion handler has not yet run. |
541 | * | 541 | * |
542 | * The URB must not be deallocated while this routine is running. In | ||
543 | * particular, when a driver calls this routine, it must insure that the | ||
544 | * completion handler cannot deallocate the URB. | ||
545 | * | ||
542 | * Unlinking and Endpoint Queues: | 546 | * Unlinking and Endpoint Queues: |
543 | * | 547 | * |
544 | * [The behaviors and guarantees described below do not apply to virtual | 548 | * [The behaviors and guarantees described below do not apply to virtual |
@@ -603,6 +607,10 @@ EXPORT_SYMBOL_GPL(usb_unlink_urb); | |||
603 | * with error -EPERM. Thus even if the URB's completion handler always | 607 | * with error -EPERM. Thus even if the URB's completion handler always |
604 | * tries to resubmit, it will not succeed and the URB will become idle. | 608 | * tries to resubmit, it will not succeed and the URB will become idle. |
605 | * | 609 | * |
610 | * The URB must not be deallocated while this routine is running. In | ||
611 | * particular, when a driver calls this routine, it must insure that the | ||
612 | * completion handler cannot deallocate the URB. | ||
613 | * | ||
606 | * This routine may not be used in an interrupt context (such as a bottom | 614 | * This routine may not be used in an interrupt context (such as a bottom |
607 | * half or a completion handler), or when holding a spinlock, or in other | 615 | * half or a completion handler), or when holding a spinlock, or in other |
608 | * situations where the caller can't schedule(). | 616 | * situations where the caller can't schedule(). |
@@ -640,6 +648,10 @@ EXPORT_SYMBOL_GPL(usb_kill_urb); | |||
640 | * with error -EPERM. Thus even if the URB's completion handler always | 648 | * with error -EPERM. Thus even if the URB's completion handler always |
641 | * tries to resubmit, it will not succeed and the URB will become idle. | 649 | * tries to resubmit, it will not succeed and the URB will become idle. |
642 | * | 650 | * |
651 | * The URB must not be deallocated while this routine is running. In | ||
652 | * particular, when a driver calls this routine, it must insure that the | ||
653 | * completion handler cannot deallocate the URB. | ||
654 | * | ||
643 | * This routine may not be used in an interrupt context (such as a bottom | 655 | * This routine may not be used in an interrupt context (such as a bottom |
644 | * half or a completion handler), or when holding a spinlock, or in other | 656 | * half or a completion handler), or when holding a spinlock, or in other |
645 | * situations where the caller can't schedule(). | 657 | * situations where the caller can't schedule(). |
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7bd815a507e8..99b58d84553a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c | |||
@@ -206,11 +206,11 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc) | |||
206 | 206 | ||
207 | for (i = 0; i < dwc->num_event_buffers; i++) { | 207 | for (i = 0; i < dwc->num_event_buffers; i++) { |
208 | evt = dwc->ev_buffs[i]; | 208 | evt = dwc->ev_buffs[i]; |
209 | if (evt) { | 209 | if (evt) |
210 | dwc3_free_one_event_buffer(dwc, evt); | 210 | dwc3_free_one_event_buffer(dwc, evt); |
211 | dwc->ev_buffs[i] = NULL; | ||
212 | } | ||
213 | } | 211 | } |
212 | |||
213 | kfree(dwc->ev_buffs); | ||
214 | } | 214 | } |
215 | 215 | ||
216 | /** | 216 | /** |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 25910e251c04..3584a169886f 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -353,6 +353,9 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, | |||
353 | 353 | ||
354 | dwc->test_mode_nr = wIndex >> 8; | 354 | dwc->test_mode_nr = wIndex >> 8; |
355 | dwc->test_mode = true; | 355 | dwc->test_mode = true; |
356 | break; | ||
357 | default: | ||
358 | return -EINVAL; | ||
356 | } | 359 | } |
357 | break; | 360 | break; |
358 | 361 | ||
@@ -559,15 +562,20 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
559 | length = trb->size & DWC3_TRB_SIZE_MASK; | 562 | length = trb->size & DWC3_TRB_SIZE_MASK; |
560 | 563 | ||
561 | if (dwc->ep0_bounced) { | 564 | if (dwc->ep0_bounced) { |
565 | unsigned transfer_size = ur->length; | ||
566 | unsigned maxp = ep0->endpoint.maxpacket; | ||
567 | |||
568 | transfer_size += (maxp - (transfer_size % maxp)); | ||
562 | transferred = min_t(u32, ur->length, | 569 | transferred = min_t(u32, ur->length, |
563 | ep0->endpoint.maxpacket - length); | 570 | transfer_size - length); |
564 | memcpy(ur->buf, dwc->ep0_bounce, transferred); | 571 | memcpy(ur->buf, dwc->ep0_bounce, transferred); |
565 | dwc->ep0_bounced = false; | 572 | dwc->ep0_bounced = false; |
566 | } else { | 573 | } else { |
567 | transferred = ur->length - length; | 574 | transferred = ur->length - length; |
568 | ur->actual += transferred; | ||
569 | } | 575 | } |
570 | 576 | ||
577 | ur->actual += transferred; | ||
578 | |||
571 | if ((epnum & 1) && ur->actual < ur->length) { | 579 | if ((epnum & 1) && ur->actual < ur->length) { |
572 | /* for some reason we did not get everything out */ | 580 | /* for some reason we did not get everything out */ |
573 | 581 | ||
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 0c935d7c65bd..9d7bcd910074 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1863,8 +1863,8 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1863 | mod_timer(&udc->vbus_timer, | 1863 | mod_timer(&udc->vbus_timer, |
1864 | jiffies + VBUS_POLL_TIMEOUT); | 1864 | jiffies + VBUS_POLL_TIMEOUT); |
1865 | } else { | 1865 | } else { |
1866 | if (request_irq(udc->board.vbus_pin, at91_vbus_irq, | 1866 | if (request_irq(gpio_to_irq(udc->board.vbus_pin), |
1867 | 0, driver_name, udc)) { | 1867 | at91_vbus_irq, 0, driver_name, udc)) { |
1868 | DBG("request vbus irq %d failed\n", | 1868 | DBG("request vbus irq %d failed\n", |
1869 | udc->board.vbus_pin); | 1869 | udc->board.vbus_pin); |
1870 | retval = -EBUSY; | 1870 | retval = -EBUSY; |
@@ -1886,7 +1886,7 @@ static int __devinit at91udc_probe(struct platform_device *pdev) | |||
1886 | return 0; | 1886 | return 0; |
1887 | fail4: | 1887 | fail4: |
1888 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) | 1888 | if (gpio_is_valid(udc->board.vbus_pin) && !udc->board.vbus_polled) |
1889 | free_irq(udc->board.vbus_pin, udc); | 1889 | free_irq(gpio_to_irq(udc->board.vbus_pin), udc); |
1890 | fail3: | 1890 | fail3: |
1891 | if (gpio_is_valid(udc->board.vbus_pin)) | 1891 | if (gpio_is_valid(udc->board.vbus_pin)) |
1892 | gpio_free(udc->board.vbus_pin); | 1892 | gpio_free(udc->board.vbus_pin); |
@@ -1924,7 +1924,7 @@ static int __exit at91udc_remove(struct platform_device *pdev) | |||
1924 | device_init_wakeup(&pdev->dev, 0); | 1924 | device_init_wakeup(&pdev->dev, 0); |
1925 | remove_debug_file(udc); | 1925 | remove_debug_file(udc); |
1926 | if (gpio_is_valid(udc->board.vbus_pin)) { | 1926 | if (gpio_is_valid(udc->board.vbus_pin)) { |
1927 | free_irq(udc->board.vbus_pin, udc); | 1927 | free_irq(gpio_to_irq(udc->board.vbus_pin), udc); |
1928 | gpio_free(udc->board.vbus_pin); | 1928 | gpio_free(udc->board.vbus_pin); |
1929 | } | 1929 | } |
1930 | free_irq(udc->udp_irq, udc); | 1930 | free_irq(udc->udp_irq, udc); |
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index a6dfd2164166..170cbe89d9f8 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -927,7 +927,6 @@ static int dummy_udc_stop(struct usb_gadget *g, | |||
927 | 927 | ||
928 | dum->driver = NULL; | 928 | dum->driver = NULL; |
929 | 929 | ||
930 | dummy_pullup(&dum->gadget, 0); | ||
931 | return 0; | 930 | return 0; |
932 | } | 931 | } |
933 | 932 | ||
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c index 1cbba70836bc..f52cb1ae45d9 100644 --- a/drivers/usb/gadget/f_fs.c +++ b/drivers/usb/gadget/f_fs.c | |||
@@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value) | |||
712 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { | 712 | if (code == FUNCTIONFS_INTERFACE_REVMAP) { |
713 | struct ffs_function *func = ffs->func; | 713 | struct ffs_function *func = ffs->func; |
714 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; | 714 | ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV; |
715 | } else if (gadget->ops->ioctl) { | 715 | } else if (gadget && gadget->ops->ioctl) { |
716 | ret = gadget->ops->ioctl(gadget, code, value); | 716 | ret = gadget->ops->ioctl(gadget, code, value); |
717 | } else { | 717 | } else { |
718 | ret = -ENOTTY; | 718 | ret = -ENOTTY; |
@@ -1382,6 +1382,7 @@ static void functionfs_unbind(struct ffs_data *ffs) | |||
1382 | ffs->ep0req = NULL; | 1382 | ffs->ep0req = NULL; |
1383 | ffs->gadget = NULL; | 1383 | ffs->gadget = NULL; |
1384 | ffs_data_put(ffs); | 1384 | ffs_data_put(ffs); |
1385 | clear_bit(FFS_FL_BOUND, &ffs->flags); | ||
1385 | } | 1386 | } |
1386 | } | 1387 | } |
1387 | 1388 | ||
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index a371e966425f..cb8c162cae5a 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c | |||
@@ -2189,7 +2189,7 @@ unknown_cmnd: | |||
2189 | common->data_size_from_cmnd = 0; | 2189 | common->data_size_from_cmnd = 0; |
2190 | sprintf(unknown, "Unknown x%02x", common->cmnd[0]); | 2190 | sprintf(unknown, "Unknown x%02x", common->cmnd[0]); |
2191 | reply = check_command(common, common->cmnd_size, | 2191 | reply = check_command(common, common->cmnd_size, |
2192 | DATA_DIR_UNKNOWN, 0xff, 0, unknown); | 2192 | DATA_DIR_UNKNOWN, ~0, 0, unknown); |
2193 | if (reply == 0) { | 2193 | if (reply == 0) { |
2194 | common->curlun->sense_data = SS_INVALID_COMMAND; | 2194 | common->curlun->sense_data = SS_INVALID_COMMAND; |
2195 | reply = -EINVAL; | 2195 | reply = -EINVAL; |
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 85a5cebe96b3..965a6293206a 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -345,7 +345,7 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req) | |||
345 | } | 345 | } |
346 | 346 | ||
347 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, | 347 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, |
348 | skb->len <= 1, req->actual, req->actual); | 348 | skb->len <= 1, req->actual, PAGE_SIZE); |
349 | page = NULL; | 349 | page = NULL; |
350 | 350 | ||
351 | if (req->actual < req->length) { /* Last fragment */ | 351 | if (req->actual < req->length) { /* Last fragment */ |
diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c index 7b1cf18df5e3..52343654f5df 100644 --- a/drivers/usb/gadget/f_rndis.c +++ b/drivers/usb/gadget/f_rndis.c | |||
@@ -500,6 +500,7 @@ rndis_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) | |||
500 | if (buf) { | 500 | if (buf) { |
501 | memcpy(req->buf, buf, n); | 501 | memcpy(req->buf, buf, n); |
502 | req->complete = rndis_response_complete; | 502 | req->complete = rndis_response_complete; |
503 | req->context = rndis; | ||
503 | rndis_free_response(rndis->config, buf); | 504 | rndis_free_response(rndis->config, buf); |
504 | value = n; | 505 | value = n; |
505 | } | 506 | } |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 4fac56927741..a896d73f7a93 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -2579,7 +2579,7 @@ static int do_scsi_command(struct fsg_dev *fsg) | |||
2579 | fsg->data_size_from_cmnd = 0; | 2579 | fsg->data_size_from_cmnd = 0; |
2580 | sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); | 2580 | sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]); |
2581 | if ((reply = check_command(fsg, fsg->cmnd_size, | 2581 | if ((reply = check_command(fsg, fsg->cmnd_size, |
2582 | DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) { | 2582 | DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) { |
2583 | fsg->curlun->sense_data = SS_INVALID_COMMAND; | 2583 | fsg->curlun->sense_data = SS_INVALID_COMMAND; |
2584 | reply = -EINVAL; | 2584 | reply = -EINVAL; |
2585 | } | 2585 | } |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 5f94e79cd6b9..55abfb6bd612 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -730,7 +730,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) | |||
730 | : (1 << (ep_index(ep))); | 730 | : (1 << (ep_index(ep))); |
731 | 731 | ||
732 | /* check if the pipe is empty */ | 732 | /* check if the pipe is empty */ |
733 | if (!(list_empty(&ep->queue))) { | 733 | if (!(list_empty(&ep->queue)) && !(ep_index(ep) == 0)) { |
734 | /* Add td to the end */ | 734 | /* Add td to the end */ |
735 | struct fsl_req *lastreq; | 735 | struct fsl_req *lastreq; |
736 | lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); | 736 | lastreq = list_entry(ep->queue.prev, struct fsl_req, queue); |
@@ -918,10 +918,6 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
918 | return -ENOMEM; | 918 | return -ENOMEM; |
919 | } | 919 | } |
920 | 920 | ||
921 | /* Update ep0 state */ | ||
922 | if ((ep_index(ep) == 0)) | ||
923 | udc->ep0_state = DATA_STATE_XMIT; | ||
924 | |||
925 | /* irq handler advances the queue */ | 921 | /* irq handler advances the queue */ |
926 | if (req != NULL) | 922 | if (req != NULL) |
927 | list_add_tail(&req->queue, &ep->queue); | 923 | list_add_tail(&req->queue, &ep->queue); |
@@ -1279,7 +1275,8 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction) | |||
1279 | udc->ep0_dir = USB_DIR_OUT; | 1275 | udc->ep0_dir = USB_DIR_OUT; |
1280 | 1276 | ||
1281 | ep = &udc->eps[0]; | 1277 | ep = &udc->eps[0]; |
1282 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | 1278 | if (udc->ep0_state != DATA_STATE_XMIT) |
1279 | udc->ep0_state = WAIT_FOR_OUT_STATUS; | ||
1283 | 1280 | ||
1284 | req->ep = ep; | 1281 | req->ep = ep; |
1285 | req->req.length = 0; | 1282 | req->req.length = 0; |
@@ -1384,6 +1381,9 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value, | |||
1384 | 1381 | ||
1385 | list_add_tail(&req->queue, &ep->queue); | 1382 | list_add_tail(&req->queue, &ep->queue); |
1386 | udc->ep0_state = DATA_STATE_XMIT; | 1383 | udc->ep0_state = DATA_STATE_XMIT; |
1384 | if (ep0_prime_status(udc, EP_DIR_OUT)) | ||
1385 | ep0stall(udc); | ||
1386 | |||
1387 | return; | 1387 | return; |
1388 | stall: | 1388 | stall: |
1389 | ep0stall(udc); | 1389 | ep0stall(udc); |
@@ -1492,6 +1492,14 @@ static void setup_received_irq(struct fsl_udc *udc, | |||
1492 | spin_lock(&udc->lock); | 1492 | spin_lock(&udc->lock); |
1493 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) | 1493 | udc->ep0_state = (setup->bRequestType & USB_DIR_IN) |
1494 | ? DATA_STATE_XMIT : DATA_STATE_RECV; | 1494 | ? DATA_STATE_XMIT : DATA_STATE_RECV; |
1495 | /* | ||
1496 | * If the data stage is IN, send status prime immediately. | ||
1497 | * See 2.0 Spec chapter 8.5.3.3 for detail. | ||
1498 | */ | ||
1499 | if (udc->ep0_state == DATA_STATE_XMIT) | ||
1500 | if (ep0_prime_status(udc, EP_DIR_OUT)) | ||
1501 | ep0stall(udc); | ||
1502 | |||
1495 | } else { | 1503 | } else { |
1496 | /* No data phase, IN status from gadget */ | 1504 | /* No data phase, IN status from gadget */ |
1497 | udc->ep0_dir = USB_DIR_IN; | 1505 | udc->ep0_dir = USB_DIR_IN; |
@@ -1520,9 +1528,8 @@ static void ep0_req_complete(struct fsl_udc *udc, struct fsl_ep *ep0, | |||
1520 | 1528 | ||
1521 | switch (udc->ep0_state) { | 1529 | switch (udc->ep0_state) { |
1522 | case DATA_STATE_XMIT: | 1530 | case DATA_STATE_XMIT: |
1523 | /* receive status phase */ | 1531 | /* already primed at setup_received_irq */ |
1524 | if (ep0_prime_status(udc, EP_DIR_OUT)) | 1532 | udc->ep0_state = WAIT_FOR_OUT_STATUS; |
1525 | ep0stall(udc); | ||
1526 | break; | 1533 | break; |
1527 | case DATA_STATE_RECV: | 1534 | case DATA_STATE_RECV: |
1528 | /* send status phase */ | 1535 | /* send status phase */ |
diff --git a/drivers/usb/gadget/g_ffs.c b/drivers/usb/gadget/g_ffs.c index 331cd6729d3c..a85eaf40b948 100644 --- a/drivers/usb/gadget/g_ffs.c +++ b/drivers/usb/gadget/g_ffs.c | |||
@@ -161,7 +161,7 @@ static struct usb_composite_driver gfs_driver = { | |||
161 | static struct ffs_data *gfs_ffs_data; | 161 | static struct ffs_data *gfs_ffs_data; |
162 | static unsigned long gfs_registered; | 162 | static unsigned long gfs_registered; |
163 | 163 | ||
164 | static int gfs_init(void) | 164 | static int __init gfs_init(void) |
165 | { | 165 | { |
166 | ENTER(); | 166 | ENTER(); |
167 | 167 | ||
@@ -169,7 +169,7 @@ static int gfs_init(void) | |||
169 | } | 169 | } |
170 | module_init(gfs_init); | 170 | module_init(gfs_init); |
171 | 171 | ||
172 | static void gfs_exit(void) | 172 | static void __exit gfs_exit(void) |
173 | { | 173 | { |
174 | ENTER(); | 174 | ENTER(); |
175 | 175 | ||
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 8793f32bab11..e58b16442971 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -1574,7 +1574,6 @@ static void destroy_ep_files (struct dev_data *dev) | |||
1574 | DBG (dev, "%s %d\n", __func__, dev->state); | 1574 | DBG (dev, "%s %d\n", __func__, dev->state); |
1575 | 1575 | ||
1576 | /* dev->state must prevent interference */ | 1576 | /* dev->state must prevent interference */ |
1577 | restart: | ||
1578 | spin_lock_irq (&dev->lock); | 1577 | spin_lock_irq (&dev->lock); |
1579 | while (!list_empty(&dev->epfiles)) { | 1578 | while (!list_empty(&dev->epfiles)) { |
1580 | struct ep_data *ep; | 1579 | struct ep_data *ep; |
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 69295ba9d99a..105b206cd844 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -340,7 +340,7 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) | |||
340 | /* currently we allocate TX FIFOs for all possible endpoints, | 340 | /* currently we allocate TX FIFOs for all possible endpoints, |
341 | * and assume that they are all the same size. */ | 341 | * and assume that they are all the same size. */ |
342 | 342 | ||
343 | for (ep = 0; ep <= 15; ep++) { | 343 | for (ep = 1; ep <= 15; ep++) { |
344 | val = addr; | 344 | val = addr; |
345 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; | 345 | val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT; |
346 | addr += size; | 346 | addr += size; |
@@ -741,7 +741,7 @@ static void s3c_hsotg_start_req(struct s3c_hsotg *hsotg, | |||
741 | /* write size / packets */ | 741 | /* write size / packets */ |
742 | writel(epsize, hsotg->regs + epsize_reg); | 742 | writel(epsize, hsotg->regs + epsize_reg); |
743 | 743 | ||
744 | if (using_dma(hsotg)) { | 744 | if (using_dma(hsotg) && !continuing) { |
745 | unsigned int dma_reg; | 745 | unsigned int dma_reg; |
746 | 746 | ||
747 | /* write DMA address to control register, buffer already | 747 | /* write DMA address to control register, buffer already |
@@ -1696,10 +1696,12 @@ static void s3c_hsotg_set_ep_maxpacket(struct s3c_hsotg *hsotg, | |||
1696 | reg |= mpsval; | 1696 | reg |= mpsval; |
1697 | writel(reg, regs + S3C_DIEPCTL(ep)); | 1697 | writel(reg, regs + S3C_DIEPCTL(ep)); |
1698 | 1698 | ||
1699 | reg = readl(regs + S3C_DOEPCTL(ep)); | 1699 | if (ep) { |
1700 | reg &= ~S3C_DxEPCTL_MPS_MASK; | 1700 | reg = readl(regs + S3C_DOEPCTL(ep)); |
1701 | reg |= mpsval; | 1701 | reg &= ~S3C_DxEPCTL_MPS_MASK; |
1702 | writel(reg, regs + S3C_DOEPCTL(ep)); | 1702 | reg |= mpsval; |
1703 | writel(reg, regs + S3C_DOEPCTL(ep)); | ||
1704 | } | ||
1703 | 1705 | ||
1704 | return; | 1706 | return; |
1705 | 1707 | ||
@@ -1919,7 +1921,8 @@ static void s3c_hsotg_epint(struct s3c_hsotg *hsotg, unsigned int idx, | |||
1919 | ints & S3C_DIEPMSK_TxFIFOEmpty) { | 1921 | ints & S3C_DIEPMSK_TxFIFOEmpty) { |
1920 | dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", | 1922 | dev_dbg(hsotg->dev, "%s: ep%d: TxFIFOEmpty\n", |
1921 | __func__, idx); | 1923 | __func__, idx); |
1922 | s3c_hsotg_trytx(hsotg, hs_ep); | 1924 | if (!using_dma(hsotg)) |
1925 | s3c_hsotg_trytx(hsotg, hs_ep); | ||
1923 | } | 1926 | } |
1924 | } | 1927 | } |
1925 | } | 1928 | } |
diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c index 56da49f31d6c..e5e44f8cde9a 100644 --- a/drivers/usb/gadget/udc-core.c +++ b/drivers/usb/gadget/udc-core.c | |||
@@ -263,9 +263,9 @@ static void usb_gadget_remove_driver(struct usb_udc *udc) | |||
263 | 263 | ||
264 | if (udc_is_newstyle(udc)) { | 264 | if (udc_is_newstyle(udc)) { |
265 | udc->driver->disconnect(udc->gadget); | 265 | udc->driver->disconnect(udc->gadget); |
266 | usb_gadget_disconnect(udc->gadget); | ||
266 | udc->driver->unbind(udc->gadget); | 267 | udc->driver->unbind(udc->gadget); |
267 | usb_gadget_udc_stop(udc->gadget, udc->driver); | 268 | usb_gadget_udc_stop(udc->gadget, udc->driver); |
268 | usb_gadget_disconnect(udc->gadget); | ||
269 | } else { | 269 | } else { |
270 | usb_gadget_stop(udc->gadget, udc->driver); | 270 | usb_gadget_stop(udc->gadget, udc->driver); |
271 | } | 271 | } |
@@ -411,9 +411,13 @@ static ssize_t usb_udc_softconn_store(struct device *dev, | |||
411 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); | 411 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); |
412 | 412 | ||
413 | if (sysfs_streq(buf, "connect")) { | 413 | if (sysfs_streq(buf, "connect")) { |
414 | if (udc_is_newstyle(udc)) | ||
415 | usb_gadget_udc_start(udc->gadget, udc->driver); | ||
414 | usb_gadget_connect(udc->gadget); | 416 | usb_gadget_connect(udc->gadget); |
415 | } else if (sysfs_streq(buf, "disconnect")) { | 417 | } else if (sysfs_streq(buf, "disconnect")) { |
416 | usb_gadget_disconnect(udc->gadget); | 418 | usb_gadget_disconnect(udc->gadget); |
419 | if (udc_is_newstyle(udc)) | ||
420 | usb_gadget_udc_stop(udc->gadget, udc->driver); | ||
417 | } else { | 421 | } else { |
418 | dev_err(dev, "unsupported command '%s'\n", buf); | 422 | dev_err(dev, "unsupported command '%s'\n", buf); |
419 | return -EINVAL; | 423 | return -EINVAL; |
diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h index bc78c606c12b..ca4e03a1c73a 100644 --- a/drivers/usb/gadget/uvc.h +++ b/drivers/usb/gadget/uvc.h | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | struct uvc_request_data | 29 | struct uvc_request_data |
30 | { | 30 | { |
31 | unsigned int length; | 31 | __s32 length; |
32 | __u8 data[60]; | 32 | __u8 data[60]; |
33 | }; | 33 | }; |
34 | 34 | ||
diff --git a/drivers/usb/gadget/uvc_queue.c b/drivers/usb/gadget/uvc_queue.c index d776adb2da67..0cdf89d32a15 100644 --- a/drivers/usb/gadget/uvc_queue.c +++ b/drivers/usb/gadget/uvc_queue.c | |||
@@ -543,11 +543,11 @@ done: | |||
543 | return ret; | 543 | return ret; |
544 | } | 544 | } |
545 | 545 | ||
546 | /* called with queue->irqlock held.. */ | ||
546 | static struct uvc_buffer * | 547 | static struct uvc_buffer * |
547 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) | 548 | uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) |
548 | { | 549 | { |
549 | struct uvc_buffer *nextbuf; | 550 | struct uvc_buffer *nextbuf; |
550 | unsigned long flags; | ||
551 | 551 | ||
552 | if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && | 552 | if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && |
553 | buf->buf.length != buf->buf.bytesused) { | 553 | buf->buf.length != buf->buf.bytesused) { |
@@ -556,14 +556,12 @@ uvc_queue_next_buffer(struct uvc_video_queue *queue, struct uvc_buffer *buf) | |||
556 | return buf; | 556 | return buf; |
557 | } | 557 | } |
558 | 558 | ||
559 | spin_lock_irqsave(&queue->irqlock, flags); | ||
560 | list_del(&buf->queue); | 559 | list_del(&buf->queue); |
561 | if (!list_empty(&queue->irqqueue)) | 560 | if (!list_empty(&queue->irqqueue)) |
562 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, | 561 | nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, |
563 | queue); | 562 | queue); |
564 | else | 563 | else |
565 | nextbuf = NULL; | 564 | nextbuf = NULL; |
566 | spin_unlock_irqrestore(&queue->irqlock, flags); | ||
567 | 565 | ||
568 | buf->buf.sequence = queue->sequence++; | 566 | buf->buf.sequence = queue->sequence++; |
569 | do_gettimeofday(&buf->buf.timestamp); | 567 | do_gettimeofday(&buf->buf.timestamp); |
diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c index f6e083b50191..54d7ca559cb2 100644 --- a/drivers/usb/gadget/uvc_v4l2.c +++ b/drivers/usb/gadget/uvc_v4l2.c | |||
@@ -39,7 +39,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data) | |||
39 | if (data->length < 0) | 39 | if (data->length < 0) |
40 | return usb_ep_set_halt(cdev->gadget->ep0); | 40 | return usb_ep_set_halt(cdev->gadget->ep0); |
41 | 41 | ||
42 | req->length = min(uvc->event_length, data->length); | 42 | req->length = min_t(unsigned int, uvc->event_length, data->length); |
43 | req->zero = data->length < uvc->event_length; | 43 | req->zero = data->length < uvc->event_length; |
44 | req->dma = DMA_ADDR_INVALID; | 44 | req->dma = DMA_ADDR_INVALID; |
45 | 45 | ||
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index 19f318ababa2..cf14c95a6700 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/of.h> | ||
16 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
17 | 18 | ||
18 | /* interface and function clocks */ | 19 | /* interface and function clocks */ |
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index fd9109d7eb0e..680e1a31fb87 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c | |||
@@ -352,7 +352,6 @@ static int debug_async_open(struct inode *, struct file *); | |||
352 | static int debug_periodic_open(struct inode *, struct file *); | 352 | static int debug_periodic_open(struct inode *, struct file *); |
353 | static int debug_registers_open(struct inode *, struct file *); | 353 | static int debug_registers_open(struct inode *, struct file *); |
354 | static int debug_async_open(struct inode *, struct file *); | 354 | static int debug_async_open(struct inode *, struct file *); |
355 | static int debug_lpm_open(struct inode *, struct file *); | ||
356 | static ssize_t debug_lpm_read(struct file *file, char __user *user_buf, | 355 | static ssize_t debug_lpm_read(struct file *file, char __user *user_buf, |
357 | size_t count, loff_t *ppos); | 356 | size_t count, loff_t *ppos); |
358 | static ssize_t debug_lpm_write(struct file *file, const char __user *buffer, | 357 | static ssize_t debug_lpm_write(struct file *file, const char __user *buffer, |
@@ -385,7 +384,7 @@ static const struct file_operations debug_registers_fops = { | |||
385 | }; | 384 | }; |
386 | static const struct file_operations debug_lpm_fops = { | 385 | static const struct file_operations debug_lpm_fops = { |
387 | .owner = THIS_MODULE, | 386 | .owner = THIS_MODULE, |
388 | .open = debug_lpm_open, | 387 | .open = simple_open, |
389 | .read = debug_lpm_read, | 388 | .read = debug_lpm_read, |
390 | .write = debug_lpm_write, | 389 | .write = debug_lpm_write, |
391 | .release = debug_lpm_close, | 390 | .release = debug_lpm_close, |
@@ -970,12 +969,6 @@ static int debug_registers_open(struct inode *inode, struct file *file) | |||
970 | return file->private_data ? 0 : -ENOMEM; | 969 | return file->private_data ? 0 : -ENOMEM; |
971 | } | 970 | } |
972 | 971 | ||
973 | static int debug_lpm_open(struct inode *inode, struct file *file) | ||
974 | { | ||
975 | file->private_data = inode->i_private; | ||
976 | return 0; | ||
977 | } | ||
978 | |||
979 | static int debug_lpm_close(struct inode *inode, struct file *file) | 972 | static int debug_lpm_close(struct inode *inode, struct file *file) |
980 | { | 973 | { |
981 | return 0; | 974 | return 0; |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 3e7345172e03..d0a84bd3f3eb 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -218,6 +218,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
218 | u32 portsc; | 218 | u32 portsc; |
219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); | 219 | struct usb_hcd *hcd = ehci_to_hcd(ehci); |
220 | void __iomem *non_ehci = hcd->regs; | 220 | void __iomem *non_ehci = hcd->regs; |
221 | struct fsl_usb2_platform_data *pdata; | ||
222 | |||
223 | pdata = hcd->self.controller->platform_data; | ||
221 | 224 | ||
222 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); | 225 | portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); |
223 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); | 226 | portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); |
@@ -234,7 +237,9 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, | |||
234 | /* fall through */ | 237 | /* fall through */ |
235 | case FSL_USB2_PHY_UTMI: | 238 | case FSL_USB2_PHY_UTMI: |
236 | /* enable UTMI PHY */ | 239 | /* enable UTMI PHY */ |
237 | setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); | 240 | if (pdata->have_sysif_regs) |
241 | setbits32(non_ehci + FSL_SOC_USB_CTRL, | ||
242 | CTRL_UTMI_PHY_EN); | ||
238 | portsc |= PORT_PTS_UTMI; | 243 | portsc |= PORT_PTS_UTMI; |
239 | break; | 244 | break; |
240 | case FSL_USB2_PHY_NONE: | 245 | case FSL_USB2_PHY_NONE: |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 057cdda7a489..4a3bc5b7a06f 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -347,6 +347,8 @@ static int ehci_reset (struct ehci_hcd *ehci) | |||
347 | if (ehci->debug) | 347 | if (ehci->debug) |
348 | dbgp_external_startup(); | 348 | dbgp_external_startup(); |
349 | 349 | ||
350 | ehci->port_c_suspend = ehci->suspended_ports = | ||
351 | ehci->resuming_ports = 0; | ||
350 | return retval; | 352 | return retval; |
351 | } | 353 | } |
352 | 354 | ||
@@ -856,8 +858,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
856 | goto dead; | 858 | goto dead; |
857 | } | 859 | } |
858 | 860 | ||
861 | /* | ||
862 | * We don't use STS_FLR, but some controllers don't like it to | ||
863 | * remain on, so mask it out along with the other status bits. | ||
864 | */ | ||
865 | masked_status = status & (INTR_MASK | STS_FLR); | ||
866 | |||
859 | /* Shared IRQ? */ | 867 | /* Shared IRQ? */ |
860 | masked_status = status & INTR_MASK; | ||
861 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { | 868 | if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) { |
862 | spin_unlock(&ehci->lock); | 869 | spin_unlock(&ehci->lock); |
863 | return IRQ_NONE; | 870 | return IRQ_NONE; |
@@ -908,7 +915,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
908 | pcd_status = status; | 915 | pcd_status = status; |
909 | 916 | ||
910 | /* resume root hub? */ | 917 | /* resume root hub? */ |
911 | if (!(cmd & CMD_RUN)) | 918 | if (ehci->rh_state == EHCI_RH_SUSPENDED) |
912 | usb_hcd_resume_root_hub(hcd); | 919 | usb_hcd_resume_root_hub(hcd); |
913 | 920 | ||
914 | /* get per-port change detect bits */ | 921 | /* get per-port change detect bits */ |
@@ -939,6 +946,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
939 | * like usb_port_resume() does. | 946 | * like usb_port_resume() does. |
940 | */ | 947 | */ |
941 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); | 948 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
949 | set_bit(i, &ehci->resuming_ports); | ||
942 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 950 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
943 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 951 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
944 | } | 952 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 256fbd42e48c..38fe07623152 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -223,15 +223,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
223 | * remote wakeup, we must fail the suspend. | 223 | * remote wakeup, we must fail the suspend. |
224 | */ | 224 | */ |
225 | if (hcd->self.root_hub->do_remote_wakeup) { | 225 | if (hcd->self.root_hub->do_remote_wakeup) { |
226 | port = HCS_N_PORTS(ehci->hcs_params); | 226 | if (ehci->resuming_ports) { |
227 | while (port--) { | 227 | spin_unlock_irq(&ehci->lock); |
228 | if (ehci->reset_done[port] != 0) { | 228 | ehci_dbg(ehci, "suspend failed because a port is resuming\n"); |
229 | spin_unlock_irq(&ehci->lock); | 229 | return -EBUSY; |
230 | ehci_dbg(ehci, "suspend failed because " | ||
231 | "port %d is resuming\n", | ||
232 | port + 1); | ||
233 | return -EBUSY; | ||
234 | } | ||
235 | } | 230 | } |
236 | } | 231 | } |
237 | 232 | ||
@@ -554,16 +549,12 @@ static int | |||
554 | ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | 549 | ehci_hub_status_data (struct usb_hcd *hcd, char *buf) |
555 | { | 550 | { |
556 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 551 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
557 | u32 temp, status = 0; | 552 | u32 temp, status; |
558 | u32 mask; | 553 | u32 mask; |
559 | int ports, i, retval = 1; | 554 | int ports, i, retval = 1; |
560 | unsigned long flags; | 555 | unsigned long flags; |
561 | u32 ppcd = 0; | 556 | u32 ppcd = 0; |
562 | 557 | ||
563 | /* if !USB_SUSPEND, root hub timers won't get shut down ... */ | ||
564 | if (ehci->rh_state != EHCI_RH_RUNNING) | ||
565 | return 0; | ||
566 | |||
567 | /* init status to no-changes */ | 558 | /* init status to no-changes */ |
568 | buf [0] = 0; | 559 | buf [0] = 0; |
569 | ports = HCS_N_PORTS (ehci->hcs_params); | 560 | ports = HCS_N_PORTS (ehci->hcs_params); |
@@ -572,6 +563,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
572 | retval++; | 563 | retval++; |
573 | } | 564 | } |
574 | 565 | ||
566 | /* Inform the core about resumes-in-progress by returning | ||
567 | * a non-zero value even if there are no status changes. | ||
568 | */ | ||
569 | status = ehci->resuming_ports; | ||
570 | |||
575 | /* Some boards (mostly VIA?) report bogus overcurrent indications, | 571 | /* Some boards (mostly VIA?) report bogus overcurrent indications, |
576 | * causing massive log spam unless we completely ignore them. It | 572 | * causing massive log spam unless we completely ignore them. It |
577 | * may be relevant that VIA VT8235 controllers, where PORT_POWER is | 573 | * may be relevant that VIA VT8235 controllers, where PORT_POWER is |
@@ -846,6 +842,7 @@ static int ehci_hub_control ( | |||
846 | ehci_writel(ehci, | 842 | ehci_writel(ehci, |
847 | temp & ~(PORT_RWC_BITS | PORT_RESUME), | 843 | temp & ~(PORT_RWC_BITS | PORT_RESUME), |
848 | status_reg); | 844 | status_reg); |
845 | clear_bit(wIndex, &ehci->resuming_ports); | ||
849 | retval = handshake(ehci, status_reg, | 846 | retval = handshake(ehci, status_reg, |
850 | PORT_RESUME, 0, 2000 /* 2msec */); | 847 | PORT_RESUME, 0, 2000 /* 2msec */); |
851 | if (retval != 0) { | 848 | if (retval != 0) { |
@@ -864,6 +861,7 @@ static int ehci_hub_control ( | |||
864 | ehci->reset_done[wIndex])) { | 861 | ehci->reset_done[wIndex])) { |
865 | status |= USB_PORT_STAT_C_RESET << 16; | 862 | status |= USB_PORT_STAT_C_RESET << 16; |
866 | ehci->reset_done [wIndex] = 0; | 863 | ehci->reset_done [wIndex] = 0; |
864 | clear_bit(wIndex, &ehci->resuming_ports); | ||
867 | 865 | ||
868 | /* force reset to complete */ | 866 | /* force reset to complete */ |
869 | ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), | 867 | ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), |
@@ -884,8 +882,10 @@ static int ehci_hub_control ( | |||
884 | ehci_readl(ehci, status_reg)); | 882 | ehci_readl(ehci, status_reg)); |
885 | } | 883 | } |
886 | 884 | ||
887 | if (!(temp & (PORT_RESUME|PORT_RESET))) | 885 | if (!(temp & (PORT_RESUME|PORT_RESET))) { |
888 | ehci->reset_done[wIndex] = 0; | 886 | ehci->reset_done[wIndex] = 0; |
887 | clear_bit(wIndex, &ehci->resuming_ports); | ||
888 | } | ||
889 | 889 | ||
890 | /* transfer dedicated ports to the companion hc */ | 890 | /* transfer dedicated ports to the companion hc */ |
891 | if ((temp & PORT_CONNECT) && | 891 | if ((temp & PORT_CONNECT) && |
@@ -920,6 +920,7 @@ static int ehci_hub_control ( | |||
920 | status |= USB_PORT_STAT_SUSPEND; | 920 | status |= USB_PORT_STAT_SUSPEND; |
921 | } else if (test_bit(wIndex, &ehci->suspended_ports)) { | 921 | } else if (test_bit(wIndex, &ehci->suspended_ports)) { |
922 | clear_bit(wIndex, &ehci->suspended_ports); | 922 | clear_bit(wIndex, &ehci->suspended_ports); |
923 | clear_bit(wIndex, &ehci->resuming_ports); | ||
923 | ehci->reset_done[wIndex] = 0; | 924 | ehci->reset_done[wIndex] = 0; |
924 | if (temp & PORT_PE) | 925 | if (temp & PORT_PE) |
925 | set_bit(wIndex, &ehci->port_c_suspend); | 926 | set_bit(wIndex, &ehci->port_c_suspend); |
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index bba9850f32f0..5c78f9e71466 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <plat/usb.h> | 42 | #include <plat/usb.h> |
43 | #include <linux/regulator/consumer.h> | 43 | #include <linux/regulator/consumer.h> |
44 | #include <linux/pm_runtime.h> | 44 | #include <linux/pm_runtime.h> |
45 | #include <linux/gpio.h> | ||
45 | 46 | ||
46 | /* EHCI Register Set */ | 47 | /* EHCI Register Set */ |
47 | #define EHCI_INSNREG04 (0xA0) | 48 | #define EHCI_INSNREG04 (0xA0) |
@@ -191,6 +192,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
191 | } | 192 | } |
192 | } | 193 | } |
193 | 194 | ||
195 | if (pdata->phy_reset) { | ||
196 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
197 | gpio_request_one(pdata->reset_gpio_port[0], | ||
198 | GPIOF_OUT_INIT_LOW, "USB1 PHY reset"); | ||
199 | |||
200 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
201 | gpio_request_one(pdata->reset_gpio_port[1], | ||
202 | GPIOF_OUT_INIT_LOW, "USB2 PHY reset"); | ||
203 | |||
204 | /* Hold the PHY in RESET for enough time till DIR is high */ | ||
205 | udelay(10); | ||
206 | } | ||
207 | |||
194 | pm_runtime_enable(dev); | 208 | pm_runtime_enable(dev); |
195 | pm_runtime_get_sync(dev); | 209 | pm_runtime_get_sync(dev); |
196 | 210 | ||
@@ -237,6 +251,19 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
237 | /* root ports should always stay powered */ | 251 | /* root ports should always stay powered */ |
238 | ehci_port_power(omap_ehci, 1); | 252 | ehci_port_power(omap_ehci, 1); |
239 | 253 | ||
254 | if (pdata->phy_reset) { | ||
255 | /* Hold the PHY in RESET for enough time till | ||
256 | * PHY is settled and ready | ||
257 | */ | ||
258 | udelay(10); | ||
259 | |||
260 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
261 | gpio_set_value(pdata->reset_gpio_port[0], 1); | ||
262 | |||
263 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
264 | gpio_set_value(pdata->reset_gpio_port[1], 1); | ||
265 | } | ||
266 | |||
240 | return 0; | 267 | return 0; |
241 | 268 | ||
242 | err_add_hcd: | 269 | err_add_hcd: |
@@ -259,8 +286,9 @@ err_io: | |||
259 | */ | 286 | */ |
260 | static int ehci_hcd_omap_remove(struct platform_device *pdev) | 287 | static int ehci_hcd_omap_remove(struct platform_device *pdev) |
261 | { | 288 | { |
262 | struct device *dev = &pdev->dev; | 289 | struct device *dev = &pdev->dev; |
263 | struct usb_hcd *hcd = dev_get_drvdata(dev); | 290 | struct usb_hcd *hcd = dev_get_drvdata(dev); |
291 | struct ehci_hcd_omap_platform_data *pdata = dev->platform_data; | ||
264 | 292 | ||
265 | usb_remove_hcd(hcd); | 293 | usb_remove_hcd(hcd); |
266 | disable_put_regulator(dev->platform_data); | 294 | disable_put_regulator(dev->platform_data); |
@@ -269,6 +297,13 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev) | |||
269 | pm_runtime_put_sync(dev); | 297 | pm_runtime_put_sync(dev); |
270 | pm_runtime_disable(dev); | 298 | pm_runtime_disable(dev); |
271 | 299 | ||
300 | if (pdata->phy_reset) { | ||
301 | if (gpio_is_valid(pdata->reset_gpio_port[0])) | ||
302 | gpio_free(pdata->reset_gpio_port[0]); | ||
303 | |||
304 | if (gpio_is_valid(pdata->reset_gpio_port[1])) | ||
305 | gpio_free(pdata->reset_gpio_port[1]); | ||
306 | } | ||
272 | return 0; | 307 | return 0; |
273 | } | 308 | } |
274 | 309 | ||
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 01bb7241d6ef..fe8dc069164e 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -144,6 +144,14 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
144 | hcd->has_tt = 1; | 144 | hcd->has_tt = 1; |
145 | tdi_reset(ehci); | 145 | tdi_reset(ehci); |
146 | } | 146 | } |
147 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) { | ||
148 | /* EHCI #1 or #2 on 6 Series/C200 Series chipset */ | ||
149 | if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) { | ||
150 | ehci_info(ehci, "broken D3 during system sleep on ASUS\n"); | ||
151 | hcd->broken_pci_sleep = 1; | ||
152 | device_set_wakeup_capable(&pdev->dev, false); | ||
153 | } | ||
154 | } | ||
147 | break; | 155 | break; |
148 | case PCI_VENDOR_ID_TDI: | 156 | case PCI_VENDOR_ID_TDI: |
149 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 157 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 3de48a2d7955..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 | ||
@@ -224,6 +223,7 @@ static int tegra_ehci_hub_control( | |||
224 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); | 223 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); |
225 | /* start resume signalling */ | 224 | /* start resume signalling */ |
226 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); | 225 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); |
226 | set_bit(wIndex-1, &ehci->resuming_ports); | ||
227 | 227 | ||
228 | spin_unlock_irqrestore(&ehci->lock, flags); | 228 | spin_unlock_irqrestore(&ehci->lock, flags); |
229 | msleep(20); | 229 | msleep(20); |
@@ -236,6 +236,7 @@ static int tegra_ehci_hub_control( | |||
236 | pr_err("%s: timeout waiting for SUSPEND\n", __func__); | 236 | pr_err("%s: timeout waiting for SUSPEND\n", __func__); |
237 | 237 | ||
238 | ehci->reset_done[wIndex-1] = 0; | 238 | ehci->reset_done[wIndex-1] = 0; |
239 | clear_bit(wIndex-1, &ehci->resuming_ports); | ||
239 | 240 | ||
240 | tegra->port_resuming = 1; | 241 | tegra->port_resuming = 1; |
241 | goto done; | 242 | goto done; |
@@ -271,120 +272,6 @@ static void tegra_ehci_restart(struct usb_hcd *hcd) | |||
271 | up_write(&ehci_cf_port_reset_rwsem); | 272 | up_write(&ehci_cf_port_reset_rwsem); |
272 | } | 273 | } |
273 | 274 | ||
274 | static int tegra_usb_suspend(struct usb_hcd *hcd) | ||
275 | { | ||
276 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
277 | struct ehci_regs __iomem *hw = tegra->ehci->regs; | ||
278 | unsigned long flags; | ||
279 | |||
280 | spin_lock_irqsave(&tegra->ehci->lock, flags); | ||
281 | |||
282 | tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3; | ||
283 | ehci_halt(tegra->ehci); | ||
284 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
285 | |||
286 | spin_unlock_irqrestore(&tegra->ehci->lock, flags); | ||
287 | |||
288 | tegra_ehci_power_down(hcd); | ||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | static int tegra_usb_resume(struct usb_hcd *hcd) | ||
293 | { | ||
294 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
295 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
296 | struct ehci_regs __iomem *hw = ehci->regs; | ||
297 | unsigned long val; | ||
298 | |||
299 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
300 | tegra_ehci_power_up(hcd); | ||
301 | |||
302 | if (tegra->port_speed > TEGRA_USB_PHY_PORT_SPEED_HIGH) { | ||
303 | /* Wait for the phy to detect new devices | ||
304 | * before we restart the controller */ | ||
305 | msleep(10); | ||
306 | goto restart; | ||
307 | } | ||
308 | |||
309 | /* Force the phy to keep data lines in suspend state */ | ||
310 | tegra_ehci_phy_restore_start(tegra->phy, tegra->port_speed); | ||
311 | |||
312 | /* Enable host mode */ | ||
313 | tdi_reset(ehci); | ||
314 | |||
315 | /* Enable Port Power */ | ||
316 | val = readl(&hw->port_status[0]); | ||
317 | val |= PORT_POWER; | ||
318 | writel(val, &hw->port_status[0]); | ||
319 | udelay(10); | ||
320 | |||
321 | /* Check if the phy resume from LP0. When the phy resume from LP0 | ||
322 | * USB register will be reset. */ | ||
323 | if (!readl(&hw->async_next)) { | ||
324 | /* Program the field PTC based on the saved speed mode */ | ||
325 | val = readl(&hw->port_status[0]); | ||
326 | val &= ~PORT_TEST(~0); | ||
327 | if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
328 | val |= PORT_TEST_FORCE; | ||
329 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_FULL) | ||
330 | val |= PORT_TEST(6); | ||
331 | else if (tegra->port_speed == TEGRA_USB_PHY_PORT_SPEED_LOW) | ||
332 | val |= PORT_TEST(7); | ||
333 | writel(val, &hw->port_status[0]); | ||
334 | udelay(10); | ||
335 | |||
336 | /* Disable test mode by setting PTC field to NORMAL_OP */ | ||
337 | val = readl(&hw->port_status[0]); | ||
338 | val &= ~PORT_TEST(~0); | ||
339 | writel(val, &hw->port_status[0]); | ||
340 | udelay(10); | ||
341 | } | ||
342 | |||
343 | /* Poll until CCS is enabled */ | ||
344 | if (handshake(ehci, &hw->port_status[0], PORT_CONNECT, | ||
345 | PORT_CONNECT, 2000)) { | ||
346 | pr_err("%s: timeout waiting for PORT_CONNECT\n", __func__); | ||
347 | goto restart; | ||
348 | } | ||
349 | |||
350 | /* Poll until PE is enabled */ | ||
351 | if (handshake(ehci, &hw->port_status[0], PORT_PE, | ||
352 | PORT_PE, 2000)) { | ||
353 | pr_err("%s: timeout waiting for USB_PORTSC1_PE\n", __func__); | ||
354 | goto restart; | ||
355 | } | ||
356 | |||
357 | /* Clear the PCI status, to avoid an interrupt taken upon resume */ | ||
358 | val = readl(&hw->status); | ||
359 | val |= STS_PCD; | ||
360 | writel(val, &hw->status); | ||
361 | |||
362 | /* Put controller in suspend mode by writing 1 to SUSP bit of PORTSC */ | ||
363 | val = readl(&hw->port_status[0]); | ||
364 | if ((val & PORT_POWER) && (val & PORT_PE)) { | ||
365 | val |= PORT_SUSPEND; | ||
366 | writel(val, &hw->port_status[0]); | ||
367 | |||
368 | /* Wait until port suspend completes */ | ||
369 | if (handshake(ehci, &hw->port_status[0], PORT_SUSPEND, | ||
370 | PORT_SUSPEND, 1000)) { | ||
371 | pr_err("%s: timeout waiting for PORT_SUSPEND\n", | ||
372 | __func__); | ||
373 | goto restart; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | tegra_ehci_phy_restore_end(tegra->phy); | ||
378 | return 0; | ||
379 | |||
380 | restart: | ||
381 | if (tegra->port_speed <= TEGRA_USB_PHY_PORT_SPEED_HIGH) | ||
382 | tegra_ehci_phy_restore_end(tegra->phy); | ||
383 | |||
384 | tegra_ehci_restart(hcd); | ||
385 | return 0; | ||
386 | } | ||
387 | |||
388 | static void tegra_ehci_shutdown(struct usb_hcd *hcd) | 275 | static void tegra_ehci_shutdown(struct usb_hcd *hcd) |
389 | { | 276 | { |
390 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | 277 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); |
@@ -432,36 +319,6 @@ static int tegra_ehci_setup(struct usb_hcd *hcd) | |||
432 | return retval; | 319 | return retval; |
433 | } | 320 | } |
434 | 321 | ||
435 | #ifdef CONFIG_PM | ||
436 | static int tegra_ehci_bus_suspend(struct usb_hcd *hcd) | ||
437 | { | ||
438 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
439 | int error_status = 0; | ||
440 | |||
441 | error_status = ehci_bus_suspend(hcd); | ||
442 | if (!error_status && tegra->power_down_on_bus_suspend) { | ||
443 | tegra_usb_suspend(hcd); | ||
444 | tegra->bus_suspended = 1; | ||
445 | } | ||
446 | |||
447 | return error_status; | ||
448 | } | ||
449 | |||
450 | static int tegra_ehci_bus_resume(struct usb_hcd *hcd) | ||
451 | { | ||
452 | struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller); | ||
453 | |||
454 | if (tegra->bus_suspended && tegra->power_down_on_bus_suspend) { | ||
455 | tegra_usb_resume(hcd); | ||
456 | tegra->bus_suspended = 0; | ||
457 | } | ||
458 | |||
459 | tegra_usb_phy_preresume(tegra->phy); | ||
460 | tegra->port_resuming = 1; | ||
461 | return ehci_bus_resume(hcd); | ||
462 | } | ||
463 | #endif | ||
464 | |||
465 | struct temp_buffer { | 322 | struct temp_buffer { |
466 | void *kmalloc_ptr; | 323 | void *kmalloc_ptr; |
467 | void *old_xfer_buffer; | 324 | void *old_xfer_buffer; |
@@ -572,8 +429,8 @@ static const struct hc_driver tegra_ehci_hc_driver = { | |||
572 | .hub_control = tegra_ehci_hub_control, | 429 | .hub_control = tegra_ehci_hub_control, |
573 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | 430 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, |
574 | #ifdef CONFIG_PM | 431 | #ifdef CONFIG_PM |
575 | .bus_suspend = tegra_ehci_bus_suspend, | 432 | .bus_suspend = ehci_bus_suspend, |
576 | .bus_resume = tegra_ehci_bus_resume, | 433 | .bus_resume = ehci_bus_resume, |
577 | #endif | 434 | #endif |
578 | .relinquish_port = ehci_relinquish_port, | 435 | .relinquish_port = ehci_relinquish_port, |
579 | .port_handed_over = ehci_port_handed_over, | 436 | .port_handed_over = ehci_port_handed_over, |
@@ -601,11 +458,187 @@ static int setup_vbus_gpio(struct platform_device *pdev) | |||
601 | dev_err(&pdev->dev, "can't enable vbus\n"); | 458 | dev_err(&pdev->dev, "can't enable vbus\n"); |
602 | return err; | 459 | return err; |
603 | } | 460 | } |
604 | gpio_set_value(gpio, 1); | ||
605 | 461 | ||
606 | return err; | 462 | return err; |
607 | } | 463 | } |
608 | 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 | |||
609 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); | 642 | static u64 tegra_ehci_dma_mask = DMA_BIT_MASK(32); |
610 | 643 | ||
611 | static int tegra_ehci_probe(struct platform_device *pdev) | 644 | static int tegra_ehci_probe(struct platform_device *pdev) |
@@ -720,7 +753,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
720 | } | 753 | } |
721 | 754 | ||
722 | tegra->host_resumed = 1; | 755 | tegra->host_resumed = 1; |
723 | tegra->power_down_on_bus_suspend = pdata->power_down_on_bus_suspend; | ||
724 | tegra->ehci = hcd_to_ehci(hcd); | 756 | tegra->ehci = hcd_to_ehci(hcd); |
725 | 757 | ||
726 | irq = platform_get_irq(pdev, 0); | 758 | irq = platform_get_irq(pdev, 0); |
@@ -729,7 +761,6 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
729 | err = -ENODEV; | 761 | err = -ENODEV; |
730 | goto fail; | 762 | goto fail; |
731 | } | 763 | } |
732 | set_irq_flags(irq, IRQF_VALID); | ||
733 | 764 | ||
734 | #ifdef CONFIG_USB_OTG_UTILS | 765 | #ifdef CONFIG_USB_OTG_UTILS |
735 | if (pdata->operating_mode == TEGRA_USB_OTG) { | 766 | if (pdata->operating_mode == TEGRA_USB_OTG) { |
@@ -745,6 +776,14 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
745 | goto fail; | 776 | goto fail; |
746 | } | 777 | } |
747 | 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); | ||
748 | return err; | 787 | return err; |
749 | 788 | ||
750 | fail: | 789 | fail: |
@@ -771,33 +810,6 @@ fail_hcd: | |||
771 | return err; | 810 | return err; |
772 | } | 811 | } |
773 | 812 | ||
774 | #ifdef CONFIG_PM | ||
775 | static int tegra_ehci_resume(struct platform_device *pdev) | ||
776 | { | ||
777 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
778 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
779 | |||
780 | if (tegra->bus_suspended) | ||
781 | return 0; | ||
782 | |||
783 | return tegra_usb_resume(hcd); | ||
784 | } | ||
785 | |||
786 | static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state) | ||
787 | { | ||
788 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | ||
789 | struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci); | ||
790 | |||
791 | if (tegra->bus_suspended) | ||
792 | return 0; | ||
793 | |||
794 | if (time_before(jiffies, tegra->ehci->next_statechange)) | ||
795 | msleep(10); | ||
796 | |||
797 | return tegra_usb_suspend(hcd); | ||
798 | } | ||
799 | #endif | ||
800 | |||
801 | static int tegra_ehci_remove(struct platform_device *pdev) | 813 | static int tegra_ehci_remove(struct platform_device *pdev) |
802 | { | 814 | { |
803 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); | 815 | struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev); |
@@ -806,6 +818,10 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
806 | if (tegra == NULL || hcd == NULL) | 818 | if (tegra == NULL || hcd == NULL) |
807 | return -EINVAL; | 819 | return -EINVAL; |
808 | 820 | ||
821 | pm_runtime_get_sync(&pdev->dev); | ||
822 | pm_runtime_disable(&pdev->dev); | ||
823 | pm_runtime_put_noidle(&pdev->dev); | ||
824 | |||
809 | #ifdef CONFIG_USB_OTG_UTILS | 825 | #ifdef CONFIG_USB_OTG_UTILS |
810 | if (tegra->transceiver) { | 826 | if (tegra->transceiver) { |
811 | otg_set_host(tegra->transceiver->otg, NULL); | 827 | otg_set_host(tegra->transceiver->otg, NULL); |
@@ -846,13 +862,12 @@ static struct of_device_id tegra_ehci_of_match[] __devinitdata = { | |||
846 | static struct platform_driver tegra_ehci_driver = { | 862 | static struct platform_driver tegra_ehci_driver = { |
847 | .probe = tegra_ehci_probe, | 863 | .probe = tegra_ehci_probe, |
848 | .remove = tegra_ehci_remove, | 864 | .remove = tegra_ehci_remove, |
849 | #ifdef CONFIG_PM | ||
850 | .suspend = tegra_ehci_suspend, | ||
851 | .resume = tegra_ehci_resume, | ||
852 | #endif | ||
853 | .shutdown = tegra_ehci_hcd_shutdown, | 865 | .shutdown = tegra_ehci_hcd_shutdown, |
854 | .driver = { | 866 | .driver = { |
855 | .name = "tegra-ehci", | 867 | .name = "tegra-ehci", |
856 | .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 | ||
857 | } | 872 | } |
858 | }; | 873 | }; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 8f9acbc96fde..2694ed6558d2 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -117,6 +117,8 @@ struct ehci_hcd { /* one per controller */ | |||
117 | the change-suspend feature turned on */ | 117 | the change-suspend feature turned on */ |
118 | unsigned long suspended_ports; /* which ports are | 118 | unsigned long suspended_ports; /* which ports are |
119 | suspended */ | 119 | suspended */ |
120 | unsigned long resuming_ports; /* which ports have | ||
121 | started to resume */ | ||
120 | 122 | ||
121 | /* per-HC memory pools (could be per-bus, but ...) */ | 123 | /* per-HC memory pools (could be per-bus, but ...) */ |
122 | struct dma_pool *qh_pool; /* qh per active urb */ | 124 | struct dma_pool *qh_pool; /* qh per active urb */ |
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index db8963f5fbce..13ebeca8e73e 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -27,6 +27,10 @@ | |||
27 | #error "CONFIG_ARCH_AT91 must be defined." | 27 | #error "CONFIG_ARCH_AT91 must be defined." |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #define valid_port(index) ((index) >= 0 && (index) < AT91_MAX_USBH_PORTS) | ||
31 | #define at91_for_each_port(index) \ | ||
32 | for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++) | ||
33 | |||
30 | /* interface and function clocks; sometimes also an AHB clock */ | 34 | /* interface and function clocks; sometimes also an AHB clock */ |
31 | static struct clk *iclk, *fclk, *hclk; | 35 | static struct clk *iclk, *fclk, *hclk; |
32 | static int clocked; | 36 | static int clocked; |
@@ -90,7 +94,7 @@ static void at91_stop_hc(struct platform_device *pdev) | |||
90 | 94 | ||
91 | /*-------------------------------------------------------------------------*/ | 95 | /*-------------------------------------------------------------------------*/ |
92 | 96 | ||
93 | static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | 97 | static void __devexit usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); |
94 | 98 | ||
95 | /* configure so an HC device and id are always provided */ | 99 | /* configure so an HC device and id are always provided */ |
96 | /* always called with process context; sleeping is OK */ | 100 | /* always called with process context; sleeping is OK */ |
@@ -104,7 +108,7 @@ static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *); | |||
104 | * then invokes the start() method for the HCD associated with it | 108 | * then invokes the start() method for the HCD associated with it |
105 | * through the hotplug entry's driver_data. | 109 | * through the hotplug entry's driver_data. |
106 | */ | 110 | */ |
107 | static int usb_hcd_at91_probe(const struct hc_driver *driver, | 111 | static int __devinit usb_hcd_at91_probe(const struct hc_driver *driver, |
108 | struct platform_device *pdev) | 112 | struct platform_device *pdev) |
109 | { | 113 | { |
110 | int retval; | 114 | int retval; |
@@ -199,7 +203,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
199 | * context, "rmmod" or something similar. | 203 | * context, "rmmod" or something similar. |
200 | * | 204 | * |
201 | */ | 205 | */ |
202 | static void usb_hcd_at91_remove(struct usb_hcd *hcd, | 206 | static void __devexit usb_hcd_at91_remove(struct usb_hcd *hcd, |
203 | struct platform_device *pdev) | 207 | struct platform_device *pdev) |
204 | { | 208 | { |
205 | usb_remove_hcd(hcd); | 209 | usb_remove_hcd(hcd); |
@@ -240,26 +244,26 @@ ohci_at91_start (struct usb_hcd *hcd) | |||
240 | 244 | ||
241 | static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable) | 245 | static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable) |
242 | { | 246 | { |
243 | if (port < 0 || port >= 2) | 247 | if (!valid_port(port)) |
244 | return; | 248 | return; |
245 | 249 | ||
246 | if (!gpio_is_valid(pdata->vbus_pin[port])) | 250 | if (!gpio_is_valid(pdata->vbus_pin[port])) |
247 | return; | 251 | return; |
248 | 252 | ||
249 | gpio_set_value(pdata->vbus_pin[port], | 253 | gpio_set_value(pdata->vbus_pin[port], |
250 | !pdata->vbus_pin_active_low[port] ^ enable); | 254 | pdata->vbus_pin_active_low[port] ^ enable); |
251 | } | 255 | } |
252 | 256 | ||
253 | static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) | 257 | static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) |
254 | { | 258 | { |
255 | if (port < 0 || port >= 2) | 259 | if (!valid_port(port)) |
256 | return -EINVAL; | 260 | return -EINVAL; |
257 | 261 | ||
258 | if (!gpio_is_valid(pdata->vbus_pin[port])) | 262 | if (!gpio_is_valid(pdata->vbus_pin[port])) |
259 | return -EINVAL; | 263 | return -EINVAL; |
260 | 264 | ||
261 | return gpio_get_value(pdata->vbus_pin[port]) ^ | 265 | return gpio_get_value(pdata->vbus_pin[port]) ^ |
262 | !pdata->vbus_pin_active_low[port]; | 266 | pdata->vbus_pin_active_low[port]; |
263 | } | 267 | } |
264 | 268 | ||
265 | /* | 269 | /* |
@@ -271,9 +275,9 @@ static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
271 | int length = ohci_hub_status_data(hcd, buf); | 275 | int length = ohci_hub_status_data(hcd, buf); |
272 | int port; | 276 | int port; |
273 | 277 | ||
274 | for (port = 0; port < ARRAY_SIZE(pdata->overcurrent_pin); port++) { | 278 | at91_for_each_port(port) { |
275 | if (pdata->overcurrent_changed[port]) { | 279 | if (pdata->overcurrent_changed[port]) { |
276 | if (! length) | 280 | if (!length) |
277 | length = 1; | 281 | length = 1; |
278 | buf[0] |= 1 << (port + 1); | 282 | buf[0] |= 1 << (port + 1); |
279 | } | 283 | } |
@@ -297,11 +301,17 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
297 | "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", | 301 | "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", |
298 | hcd, typeReq, wValue, wIndex, buf, wLength); | 302 | hcd, typeReq, wValue, wIndex, buf, wLength); |
299 | 303 | ||
304 | wIndex--; | ||
305 | |||
300 | switch (typeReq) { | 306 | switch (typeReq) { |
301 | case SetPortFeature: | 307 | case SetPortFeature: |
302 | if (wValue == USB_PORT_FEAT_POWER) { | 308 | if (wValue == USB_PORT_FEAT_POWER) { |
303 | dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); | 309 | dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); |
304 | ohci_at91_usb_set_power(pdata, wIndex - 1, 1); | 310 | if (valid_port(wIndex)) { |
311 | ohci_at91_usb_set_power(pdata, wIndex, 1); | ||
312 | ret = 0; | ||
313 | } | ||
314 | |||
305 | goto out; | 315 | goto out; |
306 | } | 316 | } |
307 | break; | 317 | break; |
@@ -312,9 +322,9 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
312 | dev_dbg(hcd->self.controller, | 322 | dev_dbg(hcd->self.controller, |
313 | "ClearPortFeature: C_OVER_CURRENT\n"); | 323 | "ClearPortFeature: C_OVER_CURRENT\n"); |
314 | 324 | ||
315 | if (wIndex == 1 || wIndex == 2) { | 325 | if (valid_port(wIndex)) { |
316 | pdata->overcurrent_changed[wIndex-1] = 0; | 326 | pdata->overcurrent_changed[wIndex] = 0; |
317 | pdata->overcurrent_status[wIndex-1] = 0; | 327 | pdata->overcurrent_status[wIndex] = 0; |
318 | } | 328 | } |
319 | 329 | ||
320 | goto out; | 330 | goto out; |
@@ -323,9 +333,8 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
323 | dev_dbg(hcd->self.controller, | 333 | dev_dbg(hcd->self.controller, |
324 | "ClearPortFeature: OVER_CURRENT\n"); | 334 | "ClearPortFeature: OVER_CURRENT\n"); |
325 | 335 | ||
326 | if (wIndex == 1 || wIndex == 2) { | 336 | if (valid_port(wIndex)) |
327 | pdata->overcurrent_status[wIndex-1] = 0; | 337 | pdata->overcurrent_status[wIndex] = 0; |
328 | } | ||
329 | 338 | ||
330 | goto out; | 339 | goto out; |
331 | 340 | ||
@@ -333,15 +342,15 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
333 | dev_dbg(hcd->self.controller, | 342 | dev_dbg(hcd->self.controller, |
334 | "ClearPortFeature: POWER\n"); | 343 | "ClearPortFeature: POWER\n"); |
335 | 344 | ||
336 | if (wIndex == 1 || wIndex == 2) { | 345 | if (valid_port(wIndex)) { |
337 | ohci_at91_usb_set_power(pdata, wIndex - 1, 0); | 346 | ohci_at91_usb_set_power(pdata, wIndex, 0); |
338 | return 0; | 347 | return 0; |
339 | } | 348 | } |
340 | } | 349 | } |
341 | break; | 350 | break; |
342 | } | 351 | } |
343 | 352 | ||
344 | ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); | 353 | ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength); |
345 | if (ret) | 354 | if (ret) |
346 | goto out; | 355 | goto out; |
347 | 356 | ||
@@ -377,18 +386,15 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
377 | 386 | ||
378 | dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); | 387 | dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); |
379 | 388 | ||
380 | if (wIndex == 1 || wIndex == 2) { | 389 | if (valid_port(wIndex)) { |
381 | if (! ohci_at91_usb_get_power(pdata, wIndex-1)) { | 390 | if (!ohci_at91_usb_get_power(pdata, wIndex)) |
382 | *data &= ~cpu_to_le32(RH_PS_PPS); | 391 | *data &= ~cpu_to_le32(RH_PS_PPS); |
383 | } | ||
384 | 392 | ||
385 | if (pdata->overcurrent_changed[wIndex-1]) { | 393 | if (pdata->overcurrent_changed[wIndex]) |
386 | *data |= cpu_to_le32(RH_PS_OCIC); | 394 | *data |= cpu_to_le32(RH_PS_OCIC); |
387 | } | ||
388 | 395 | ||
389 | if (pdata->overcurrent_status[wIndex-1]) { | 396 | if (pdata->overcurrent_status[wIndex]) |
390 | *data |= cpu_to_le32(RH_PS_POCI); | 397 | *data |= cpu_to_le32(RH_PS_POCI); |
391 | } | ||
392 | } | 398 | } |
393 | } | 399 | } |
394 | 400 | ||
@@ -450,14 +456,14 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data) | |||
450 | 456 | ||
451 | /* From the GPIO notifying the over-current situation, find | 457 | /* From the GPIO notifying the over-current situation, find |
452 | * out the corresponding port */ | 458 | * out the corresponding port */ |
453 | for (port = 0; port < ARRAY_SIZE(pdata->overcurrent_pin); port++) { | 459 | at91_for_each_port(port) { |
454 | if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { | 460 | if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { |
455 | gpio = pdata->overcurrent_pin[port]; | 461 | gpio = pdata->overcurrent_pin[port]; |
456 | break; | 462 | break; |
457 | } | 463 | } |
458 | } | 464 | } |
459 | 465 | ||
460 | if (port == ARRAY_SIZE(pdata->overcurrent_pin)) { | 466 | if (port == AT91_MAX_USBH_PORTS) { |
461 | dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n"); | 467 | dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n"); |
462 | return IRQ_HANDLED; | 468 | return IRQ_HANDLED; |
463 | } | 469 | } |
@@ -467,7 +473,7 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data) | |||
467 | /* When notified of an over-current situation, disable power | 473 | /* When notified of an over-current situation, disable power |
468 | on the corresponding port, and mark this port in | 474 | on the corresponding port, and mark this port in |
469 | over-current. */ | 475 | over-current. */ |
470 | if (! val) { | 476 | if (!val) { |
471 | ohci_at91_usb_set_power(pdata, port, 0); | 477 | ohci_at91_usb_set_power(pdata, port, 0); |
472 | pdata->overcurrent_status[port] = 1; | 478 | pdata->overcurrent_status[port] = 1; |
473 | pdata->overcurrent_changed[port] = 1; | 479 | pdata->overcurrent_changed[port] = 1; |
@@ -492,7 +498,7 @@ static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32); | |||
492 | static int __devinit ohci_at91_of_init(struct platform_device *pdev) | 498 | static int __devinit ohci_at91_of_init(struct platform_device *pdev) |
493 | { | 499 | { |
494 | struct device_node *np = pdev->dev.of_node; | 500 | struct device_node *np = pdev->dev.of_node; |
495 | int i, ret, gpio; | 501 | int i, gpio; |
496 | enum of_gpio_flags flags; | 502 | enum of_gpio_flags flags; |
497 | struct at91_usbh_data *pdata; | 503 | struct at91_usbh_data *pdata; |
498 | u32 ports; | 504 | u32 ports; |
@@ -514,48 +520,17 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev) | |||
514 | if (!of_property_read_u32(np, "num-ports", &ports)) | 520 | if (!of_property_read_u32(np, "num-ports", &ports)) |
515 | pdata->ports = ports; | 521 | pdata->ports = ports; |
516 | 522 | ||
517 | for (i = 0; i < 2; i++) { | 523 | at91_for_each_port(i) { |
518 | gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags); | 524 | gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags); |
519 | pdata->vbus_pin[i] = gpio; | 525 | pdata->vbus_pin[i] = gpio; |
520 | if (!gpio_is_valid(gpio)) | 526 | if (!gpio_is_valid(gpio)) |
521 | continue; | 527 | continue; |
522 | pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW; | 528 | pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW; |
523 | ret = gpio_request(gpio, "ohci_vbus"); | ||
524 | if (ret) { | ||
525 | dev_warn(&pdev->dev, "can't request vbus gpio %d", gpio); | ||
526 | continue; | ||
527 | } | ||
528 | ret = gpio_direction_output(gpio, !(flags & OF_GPIO_ACTIVE_LOW) ^ 1); | ||
529 | if (ret) | ||
530 | dev_warn(&pdev->dev, "can't put vbus gpio %d as output %d", | ||
531 | !(flags & OF_GPIO_ACTIVE_LOW) ^ 1, gpio); | ||
532 | } | 529 | } |
533 | 530 | ||
534 | for (i = 0; i < 2; i++) { | 531 | at91_for_each_port(i) |
535 | gpio = of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags); | 532 | pdata->overcurrent_pin[i] = |
536 | pdata->overcurrent_pin[i] = gpio; | 533 | of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags); |
537 | if (!gpio_is_valid(gpio)) | ||
538 | continue; | ||
539 | ret = gpio_request(gpio, "ohci_overcurrent"); | ||
540 | if (ret) { | ||
541 | dev_err(&pdev->dev, "can't request overcurrent gpio %d", gpio); | ||
542 | continue; | ||
543 | } | ||
544 | |||
545 | ret = gpio_direction_input(gpio); | ||
546 | if (ret) { | ||
547 | dev_err(&pdev->dev, "can't configure overcurrent gpio %d as input", gpio); | ||
548 | continue; | ||
549 | } | ||
550 | |||
551 | ret = request_irq(gpio_to_irq(gpio), | ||
552 | ohci_hcd_at91_overcurrent_irq, | ||
553 | IRQF_SHARED, "ohci_overcurrent", pdev); | ||
554 | if (ret) { | ||
555 | gpio_free(gpio); | ||
556 | dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n"); | ||
557 | } | ||
558 | } | ||
559 | 534 | ||
560 | pdev->dev.platform_data = pdata; | 535 | pdev->dev.platform_data = pdata; |
561 | 536 | ||
@@ -570,39 +545,73 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev) | |||
570 | 545 | ||
571 | /*-------------------------------------------------------------------------*/ | 546 | /*-------------------------------------------------------------------------*/ |
572 | 547 | ||
573 | static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | 548 | static int __devinit ohci_hcd_at91_drv_probe(struct platform_device *pdev) |
574 | { | 549 | { |
575 | struct at91_usbh_data *pdata; | 550 | struct at91_usbh_data *pdata; |
576 | int i; | 551 | int i; |
552 | int gpio; | ||
553 | int ret; | ||
577 | 554 | ||
578 | i = ohci_at91_of_init(pdev); | 555 | ret = ohci_at91_of_init(pdev); |
579 | 556 | if (ret) | |
580 | if (i) | 557 | return ret; |
581 | return i; | ||
582 | 558 | ||
583 | pdata = pdev->dev.platform_data; | 559 | pdata = pdev->dev.platform_data; |
584 | 560 | ||
585 | if (pdata) { | 561 | if (pdata) { |
586 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { | 562 | at91_for_each_port(i) { |
587 | if (!gpio_is_valid(pdata->vbus_pin[i])) | 563 | if (!gpio_is_valid(pdata->vbus_pin[i])) |
588 | continue; | 564 | continue; |
589 | gpio_request(pdata->vbus_pin[i], "ohci_vbus"); | 565 | gpio = pdata->vbus_pin[i]; |
566 | |||
567 | ret = gpio_request(gpio, "ohci_vbus"); | ||
568 | if (ret) { | ||
569 | dev_err(&pdev->dev, | ||
570 | "can't request vbus gpio %d\n", gpio); | ||
571 | continue; | ||
572 | } | ||
573 | ret = gpio_direction_output(gpio, | ||
574 | !pdata->vbus_pin_active_low[i]); | ||
575 | if (ret) { | ||
576 | dev_err(&pdev->dev, | ||
577 | "can't put vbus gpio %d as output %d\n", | ||
578 | gpio, !pdata->vbus_pin_active_low[i]); | ||
579 | gpio_free(gpio); | ||
580 | continue; | ||
581 | } | ||
582 | |||
590 | ohci_at91_usb_set_power(pdata, i, 1); | 583 | ohci_at91_usb_set_power(pdata, i, 1); |
591 | } | 584 | } |
592 | 585 | ||
593 | for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { | 586 | at91_for_each_port(i) { |
594 | int ret; | ||
595 | |||
596 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) | 587 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) |
597 | continue; | 588 | continue; |
598 | gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent"); | 589 | gpio = pdata->overcurrent_pin[i]; |
590 | |||
591 | ret = gpio_request(gpio, "ohci_overcurrent"); | ||
592 | if (ret) { | ||
593 | dev_err(&pdev->dev, | ||
594 | "can't request overcurrent gpio %d\n", | ||
595 | gpio); | ||
596 | continue; | ||
597 | } | ||
598 | |||
599 | ret = gpio_direction_input(gpio); | ||
600 | if (ret) { | ||
601 | dev_err(&pdev->dev, | ||
602 | "can't configure overcurrent gpio %d as input\n", | ||
603 | gpio); | ||
604 | gpio_free(gpio); | ||
605 | continue; | ||
606 | } | ||
599 | 607 | ||
600 | ret = request_irq(gpio_to_irq(pdata->overcurrent_pin[i]), | 608 | ret = request_irq(gpio_to_irq(gpio), |
601 | ohci_hcd_at91_overcurrent_irq, | 609 | ohci_hcd_at91_overcurrent_irq, |
602 | IRQF_SHARED, "ohci_overcurrent", pdev); | 610 | IRQF_SHARED, "ohci_overcurrent", pdev); |
603 | if (ret) { | 611 | if (ret) { |
604 | gpio_free(pdata->overcurrent_pin[i]); | 612 | gpio_free(gpio); |
605 | dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n"); | 613 | dev_err(&pdev->dev, |
614 | "can't get gpio IRQ for overcurrent\n"); | ||
606 | } | 615 | } |
607 | } | 616 | } |
608 | } | 617 | } |
@@ -611,20 +620,20 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
611 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); | 620 | return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev); |
612 | } | 621 | } |
613 | 622 | ||
614 | static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | 623 | static int __devexit ohci_hcd_at91_drv_remove(struct platform_device *pdev) |
615 | { | 624 | { |
616 | struct at91_usbh_data *pdata = pdev->dev.platform_data; | 625 | struct at91_usbh_data *pdata = pdev->dev.platform_data; |
617 | int i; | 626 | int i; |
618 | 627 | ||
619 | if (pdata) { | 628 | if (pdata) { |
620 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { | 629 | at91_for_each_port(i) { |
621 | if (!gpio_is_valid(pdata->vbus_pin[i])) | 630 | if (!gpio_is_valid(pdata->vbus_pin[i])) |
622 | continue; | 631 | continue; |
623 | ohci_at91_usb_set_power(pdata, i, 0); | 632 | ohci_at91_usb_set_power(pdata, i, 0); |
624 | gpio_free(pdata->vbus_pin[i]); | 633 | gpio_free(pdata->vbus_pin[i]); |
625 | } | 634 | } |
626 | 635 | ||
627 | for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { | 636 | at91_for_each_port(i) { |
628 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) | 637 | if (!gpio_is_valid(pdata->overcurrent_pin[i])) |
629 | continue; | 638 | continue; |
630 | free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); | 639 | free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); |
@@ -687,7 +696,7 @@ MODULE_ALIAS("platform:at91_ohci"); | |||
687 | 696 | ||
688 | static struct platform_driver ohci_hcd_at91_driver = { | 697 | static struct platform_driver ohci_hcd_at91_driver = { |
689 | .probe = ohci_hcd_at91_drv_probe, | 698 | .probe = ohci_hcd_at91_drv_probe, |
690 | .remove = ohci_hcd_at91_drv_remove, | 699 | .remove = __devexit_p(ohci_hcd_at91_drv_remove), |
691 | .shutdown = usb_hcd_platform_shutdown, | 700 | .shutdown = usb_hcd_platform_shutdown, |
692 | .suspend = ohci_hcd_at91_drv_suspend, | 701 | .suspend = ohci_hcd_at91_drv_suspend, |
693 | .resume = ohci_hcd_at91_drv_resume, | 702 | .resume = ohci_hcd_at91_drv_resume, |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 11de5f1be981..32dada8c8b4f 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -825,9 +825,13 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev) | |||
825 | } | 825 | } |
826 | } | 826 | } |
827 | 827 | ||
828 | /* Disable any BIOS SMIs */ | 828 | val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); |
829 | writel(XHCI_LEGACY_DISABLE_SMI, | 829 | /* Mask off (turn off) any enabled SMIs */ |
830 | base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); | 830 | val &= XHCI_LEGACY_DISABLE_SMI; |
831 | /* Mask all SMI events bits, RW1C */ | ||
832 | val |= XHCI_LEGACY_SMI_EVENTS; | ||
833 | /* Disable any BIOS SMIs and clear all SMI events*/ | ||
834 | writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); | ||
831 | 835 | ||
832 | if (usb_is_intel_switchable_xhci(pdev)) | 836 | if (usb_is_intel_switchable_xhci(pdev)) |
833 | usb_enable_xhci_ports(pdev); | 837 | usb_enable_xhci_ports(pdev); |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 045cde4cbc3d..768d54295a20 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -196,11 +196,12 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
196 | status = get_hub_status_data(uhci, buf); | 196 | status = get_hub_status_data(uhci, buf); |
197 | 197 | ||
198 | switch (uhci->rh_state) { | 198 | switch (uhci->rh_state) { |
199 | case UHCI_RH_SUSPENDING: | ||
200 | case UHCI_RH_SUSPENDED: | 199 | case UHCI_RH_SUSPENDED: |
201 | /* if port change, ask to be resumed */ | 200 | /* if port change, ask to be resumed */ |
202 | if (status || uhci->resuming_ports) | 201 | if (status || uhci->resuming_ports) { |
202 | status = 1; | ||
203 | usb_hcd_resume_root_hub(hcd); | 203 | usb_hcd_resume_root_hub(hcd); |
204 | } | ||
204 | break; | 205 | break; |
205 | 206 | ||
206 | case UHCI_RH_AUTO_STOPPED: | 207 | case UHCI_RH_AUTO_STOPPED: |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index e9b0f043455d..4b436f5a4171 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -119,7 +119,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci) | |||
119 | xhci_dbg(xhci, " Event Interrupts %s\n", | 119 | xhci_dbg(xhci, " Event Interrupts %s\n", |
120 | (temp & CMD_EIE) ? "enabled " : "disabled"); | 120 | (temp & CMD_EIE) ? "enabled " : "disabled"); |
121 | xhci_dbg(xhci, " Host System Error Interrupts %s\n", | 121 | xhci_dbg(xhci, " Host System Error Interrupts %s\n", |
122 | (temp & CMD_EIE) ? "enabled " : "disabled"); | 122 | (temp & CMD_HSEIE) ? "enabled " : "disabled"); |
123 | xhci_dbg(xhci, " HC has %sfinished light reset\n", | 123 | xhci_dbg(xhci, " HC has %sfinished light reset\n", |
124 | (temp & CMD_LRESET) ? "not " : ""); | 124 | (temp & CMD_LRESET) ? "not " : ""); |
125 | } | 125 | } |
diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h index c7f33123d4c0..377f4242dabb 100644 --- a/drivers/usb/host/xhci-ext-caps.h +++ b/drivers/usb/host/xhci-ext-caps.h | |||
@@ -62,8 +62,9 @@ | |||
62 | /* USB Legacy Support Control and Status Register - section 7.1.2 */ | 62 | /* USB Legacy Support Control and Status Register - section 7.1.2 */ |
63 | /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ | 63 | /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ |
64 | #define XHCI_LEGACY_CONTROL_OFFSET (0x04) | 64 | #define XHCI_LEGACY_CONTROL_OFFSET (0x04) |
65 | /* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ | 65 | /* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ |
66 | #define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) | 66 | #define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17)) |
67 | #define XHCI_LEGACY_SMI_EVENTS (0x7 << 29) | ||
67 | 68 | ||
68 | /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ | 69 | /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ |
69 | #define XHCI_L1C (1 << 16) | 70 | #define XHCI_L1C (1 << 16) |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index cae4c6f2845a..68eaa908ac8e 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1796,11 +1796,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1796 | int i; | 1796 | int i; |
1797 | 1797 | ||
1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
1799 | if (xhci->ir_set) { | ||
1800 | xhci_writel(xhci, 0, &xhci->ir_set->erst_size); | ||
1801 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_base); | ||
1802 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue); | ||
1803 | } | ||
1804 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 1799 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
1805 | if (xhci->erst.entries) | 1800 | if (xhci->erst.entries) |
1806 | dma_free_coherent(&pdev->dev, size, | 1801 | dma_free_coherent(&pdev->dev, size, |
@@ -1812,7 +1807,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1812 | xhci->event_ring = NULL; | 1807 | xhci->event_ring = NULL; |
1813 | xhci_dbg(xhci, "Freed event ring\n"); | 1808 | xhci_dbg(xhci, "Freed event ring\n"); |
1814 | 1809 | ||
1815 | xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring); | ||
1816 | if (xhci->cmd_ring) | 1810 | if (xhci->cmd_ring) |
1817 | xhci_ring_free(xhci, xhci->cmd_ring); | 1811 | xhci_ring_free(xhci, xhci->cmd_ring); |
1818 | xhci->cmd_ring = NULL; | 1812 | xhci->cmd_ring = NULL; |
@@ -1841,7 +1835,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1841 | xhci->medium_streams_pool = NULL; | 1835 | xhci->medium_streams_pool = NULL; |
1842 | xhci_dbg(xhci, "Freed medium stream array pool\n"); | 1836 | xhci_dbg(xhci, "Freed medium stream array pool\n"); |
1843 | 1837 | ||
1844 | xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr); | ||
1845 | if (xhci->dcbaa) | 1838 | if (xhci->dcbaa) |
1846 | dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), | 1839 | dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), |
1847 | xhci->dcbaa, xhci->dcbaa->dma); | 1840 | xhci->dcbaa, xhci->dcbaa->dma); |
@@ -2459,6 +2452,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2459 | 2452 | ||
2460 | fail: | 2453 | fail: |
2461 | xhci_warn(xhci, "Couldn't initialize memory\n"); | 2454 | xhci_warn(xhci, "Couldn't initialize memory\n"); |
2455 | xhci_halt(xhci); | ||
2456 | xhci_reset(xhci); | ||
2462 | xhci_mem_cleanup(xhci); | 2457 | xhci_mem_cleanup(xhci); |
2463 | return -ENOMEM; | 2458 | return -ENOMEM; |
2464 | } | 2459 | } |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index ef98b38626fb..7a856a767e77 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -95,6 +95,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
95 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 95 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
96 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); | 96 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); |
97 | } | 97 | } |
98 | if (pdev->vendor == PCI_VENDOR_ID_VIA) | ||
99 | xhci->quirks |= XHCI_RESET_ON_RESUME; | ||
98 | } | 100 | } |
99 | 101 | ||
100 | /* called during probe() after chip reset completes */ | 102 | /* called during probe() after chip reset completes */ |
@@ -326,7 +328,7 @@ int __init xhci_register_pci(void) | |||
326 | return pci_register_driver(&xhci_pci_driver); | 328 | return pci_register_driver(&xhci_pci_driver); |
327 | } | 329 | } |
328 | 330 | ||
329 | void __exit xhci_unregister_pci(void) | 331 | void xhci_unregister_pci(void) |
330 | { | 332 | { |
331 | pci_unregister_driver(&xhci_pci_driver); | 333 | pci_unregister_driver(&xhci_pci_driver); |
332 | } | 334 | } |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 6bd9d53062eb..3d9422f16a20 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2417,7 +2417,7 @@ hw_died: | |||
2417 | u32 irq_pending; | 2417 | u32 irq_pending; |
2418 | /* Acknowledge the PCI interrupt */ | 2418 | /* Acknowledge the PCI interrupt */ |
2419 | irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 2419 | irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
2420 | irq_pending |= 0x3; | 2420 | irq_pending |= IMAN_IP; |
2421 | xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); | 2421 | xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); |
2422 | } | 2422 | } |
2423 | 2423 | ||
@@ -2734,7 +2734,7 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2734 | urb->dev->speed == USB_SPEED_FULL) | 2734 | urb->dev->speed == USB_SPEED_FULL) |
2735 | urb->interval /= 8; | 2735 | urb->interval /= 8; |
2736 | } | 2736 | } |
2737 | return xhci_queue_bulk_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); | 2737 | return xhci_queue_bulk_tx(xhci, mem_flags, urb, slot_id, ep_index); |
2738 | } | 2738 | } |
2739 | 2739 | ||
2740 | /* | 2740 | /* |
@@ -3514,7 +3514,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3514 | } | 3514 | } |
3515 | ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; | 3515 | ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; |
3516 | 3516 | ||
3517 | return xhci_queue_isoc_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); | 3517 | return xhci_queue_isoc_tx(xhci, mem_flags, urb, slot_id, ep_index); |
3518 | } | 3518 | } |
3519 | 3519 | ||
3520 | /**** Command Ring Operations ****/ | 3520 | /**** Command Ring Operations ****/ |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e1963d4a430f..36641a7f2371 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -106,6 +106,9 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
106 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); | 106 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); |
107 | if (!ret) | 107 | if (!ret) |
108 | xhci->xhc_state |= XHCI_STATE_HALTED; | 108 | xhci->xhc_state |= XHCI_STATE_HALTED; |
109 | else | ||
110 | xhci_warn(xhci, "Host not halted after %u microseconds.\n", | ||
111 | XHCI_MAX_HALT_USEC); | ||
109 | return ret; | 112 | return ret; |
110 | } | 113 | } |
111 | 114 | ||
@@ -664,11 +667,11 @@ static void xhci_save_registers(struct xhci_hcd *xhci) | |||
664 | xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); | 667 | xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); |
665 | xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); | 668 | xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); |
666 | xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); | 669 | xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); |
667 | xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | ||
668 | xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); | ||
669 | xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); | 670 | xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); |
670 | xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); | 671 | xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); |
671 | xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); | 672 | xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); |
673 | xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | ||
674 | xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); | ||
672 | } | 675 | } |
673 | 676 | ||
674 | static void xhci_restore_registers(struct xhci_hcd *xhci) | 677 | static void xhci_restore_registers(struct xhci_hcd *xhci) |
@@ -677,10 +680,11 @@ static void xhci_restore_registers(struct xhci_hcd *xhci) | |||
677 | xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); | 680 | xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); |
678 | xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); | 681 | xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); |
679 | xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); | 682 | xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); |
680 | xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); | ||
681 | xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); | ||
682 | xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); | 683 | xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); |
683 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); | 684 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); |
685 | xhci_write_64(xhci, xhci->s3.erst_dequeue, &xhci->ir_set->erst_dequeue); | ||
686 | xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); | ||
687 | xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); | ||
684 | } | 688 | } |
685 | 689 | ||
686 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) | 690 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 91074fdab3eb..3d69c4b2b542 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -205,6 +205,10 @@ struct xhci_op_regs { | |||
205 | #define CMD_PM_INDEX (1 << 11) | 205 | #define CMD_PM_INDEX (1 << 11) |
206 | /* bits 12:31 are reserved (and should be preserved on writes). */ | 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ |
207 | 207 | ||
208 | /* IMAN - Interrupt Management Register */ | ||
209 | #define IMAN_IP (1 << 1) | ||
210 | #define IMAN_IE (1 << 0) | ||
211 | |||
208 | /* USBSTS - USB status - status bitmasks */ | 212 | /* USBSTS - USB status - status bitmasks */ |
209 | /* HC not running - set to 1 when run/stop bit is cleared. */ | 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ |
210 | #define STS_HALT XHCI_STS_HALT | 214 | #define STS_HALT XHCI_STS_HALT |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 959145baf3cf..9dcb68f04f03 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -423,7 +423,7 @@ alloc_sglist(int nents, int max, int vary) | |||
423 | unsigned i; | 423 | unsigned i; |
424 | unsigned size = max; | 424 | unsigned size = max; |
425 | 425 | ||
426 | sg = kmalloc(nents * sizeof *sg, GFP_KERNEL); | 426 | sg = kmalloc_array(nents, sizeof *sg, GFP_KERNEL); |
427 | if (!sg) | 427 | if (!sg) |
428 | return NULL; | 428 | return NULL; |
429 | sg_init_table(sg, nents); | 429 | sg_init_table(sg, nents); |
@@ -904,6 +904,9 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param) | |||
904 | struct ctrl_ctx context; | 904 | struct ctrl_ctx context; |
905 | int i; | 905 | int i; |
906 | 906 | ||
907 | if (param->sglen == 0 || param->iterations > UINT_MAX / param->sglen) | ||
908 | return -EOPNOTSUPP; | ||
909 | |||
907 | spin_lock_init(&context.lock); | 910 | spin_lock_init(&context.lock); |
908 | context.dev = dev; | 911 | context.dev = dev; |
909 | init_completion(&context.complete); | 912 | init_completion(&context.complete); |
@@ -1981,8 +1984,6 @@ usbtest_ioctl(struct usb_interface *intf, unsigned int code, void *buf) | |||
1981 | 1984 | ||
1982 | /* queued control messaging */ | 1985 | /* queued control messaging */ |
1983 | case 10: | 1986 | case 10: |
1984 | if (param->sglen == 0) | ||
1985 | break; | ||
1986 | retval = 0; | 1987 | retval = 0; |
1987 | dev_info(&intf->dev, | 1988 | dev_info(&intf->dev, |
1988 | "TEST 10: queue %d control calls, %d times\n", | 1989 | "TEST 10: queue %d control calls, %d times\n", |
@@ -2276,6 +2277,8 @@ usbtest_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2276 | if (status < 0) { | 2277 | if (status < 0) { |
2277 | WARNING(dev, "couldn't get endpoints, %d\n", | 2278 | WARNING(dev, "couldn't get endpoints, %d\n", |
2278 | status); | 2279 | status); |
2280 | kfree(dev->buf); | ||
2281 | kfree(dev); | ||
2279 | return status; | 2282 | return status; |
2280 | } | 2283 | } |
2281 | /* may find bulk or ISO pipes */ | 2284 | /* may find bulk or ISO pipes */ |
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c index 897edda42270..70201462e19c 100644 --- a/drivers/usb/misc/yurex.c +++ b/drivers/usb/misc/yurex.c | |||
@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref) | |||
99 | usb_put_dev(dev->udev); | 99 | usb_put_dev(dev->udev); |
100 | if (dev->cntl_urb) { | 100 | if (dev->cntl_urb) { |
101 | usb_kill_urb(dev->cntl_urb); | 101 | usb_kill_urb(dev->cntl_urb); |
102 | if (dev->cntl_req) | 102 | kfree(dev->cntl_req); |
103 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | ||
104 | dev->cntl_req, dev->cntl_urb->setup_dma); | ||
105 | if (dev->cntl_buffer) | 103 | if (dev->cntl_buffer) |
106 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, | 104 | usb_free_coherent(dev->udev, YUREX_BUF_SIZE, |
107 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); | 105 | dev->cntl_buffer, dev->cntl_urb->transfer_dma); |
@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
234 | } | 232 | } |
235 | 233 | ||
236 | /* allocate buffer for control req */ | 234 | /* allocate buffer for control req */ |
237 | dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE, | 235 | dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL); |
238 | GFP_KERNEL, | ||
239 | &dev->cntl_urb->setup_dma); | ||
240 | if (!dev->cntl_req) { | 236 | if (!dev->cntl_req) { |
241 | err("Could not allocate cntl_req"); | 237 | err("Could not allocate cntl_req"); |
242 | goto error; | 238 | goto error; |
@@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_ | |||
286 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), | 282 | usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), |
287 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, | 283 | dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt, |
288 | dev, 1); | 284 | dev, 1); |
289 | dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 285 | dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
290 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { | 286 | if (usb_submit_urb(dev->urb, GFP_KERNEL)) { |
291 | retval = -EIO; | 287 | retval = -EIO; |
292 | err("Could not submitting URB"); | 288 | err("Could not submitting URB"); |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 97ab975fa442..768b4b55c816 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -386,7 +386,7 @@ static int davinci_musb_init(struct musb *musb) | |||
386 | usb_nop_xceiv_register(); | 386 | usb_nop_xceiv_register(); |
387 | musb->xceiv = usb_get_transceiver(); | 387 | musb->xceiv = usb_get_transceiver(); |
388 | if (!musb->xceiv) | 388 | if (!musb->xceiv) |
389 | return -ENODEV; | 389 | goto unregister; |
390 | 390 | ||
391 | musb->mregs += DAVINCI_BASE_OFFSET; | 391 | musb->mregs += DAVINCI_BASE_OFFSET; |
392 | 392 | ||
@@ -444,6 +444,7 @@ static int davinci_musb_init(struct musb *musb) | |||
444 | 444 | ||
445 | fail: | 445 | fail: |
446 | usb_put_transceiver(musb->xceiv); | 446 | usb_put_transceiver(musb->xceiv); |
447 | unregister: | ||
447 | usb_nop_xceiv_unregister(); | 448 | usb_nop_xceiv_unregister(); |
448 | return -ENODEV; | 449 | return -ENODEV; |
449 | } | 450 | } |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 0f8b82918a40..66aaccf04490 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -137,6 +137,9 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | |||
137 | int i = 0; | 137 | int i = 0; |
138 | u8 r; | 138 | u8 r; |
139 | u8 power; | 139 | u8 power; |
140 | int ret; | ||
141 | |||
142 | pm_runtime_get_sync(phy->io_dev); | ||
140 | 143 | ||
141 | /* Make sure the transceiver is not in low power mode */ | 144 | /* Make sure the transceiver is not in low power mode */ |
142 | power = musb_readb(addr, MUSB_POWER); | 145 | power = musb_readb(addr, MUSB_POWER); |
@@ -154,15 +157,22 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) | |||
154 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) | 157 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
155 | & MUSB_ULPI_REG_CMPLT)) { | 158 | & MUSB_ULPI_REG_CMPLT)) { |
156 | i++; | 159 | i++; |
157 | if (i == 10000) | 160 | if (i == 10000) { |
158 | return -ETIMEDOUT; | 161 | ret = -ETIMEDOUT; |
162 | goto out; | ||
163 | } | ||
159 | 164 | ||
160 | } | 165 | } |
161 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); | 166 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); |
162 | r &= ~MUSB_ULPI_REG_CMPLT; | 167 | r &= ~MUSB_ULPI_REG_CMPLT; |
163 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); | 168 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); |
164 | 169 | ||
165 | return musb_readb(addr, MUSB_ULPI_REG_DATA); | 170 | ret = musb_readb(addr, MUSB_ULPI_REG_DATA); |
171 | |||
172 | out: | ||
173 | pm_runtime_put(phy->io_dev); | ||
174 | |||
175 | return ret; | ||
166 | } | 176 | } |
167 | 177 | ||
168 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | 178 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
@@ -171,6 +181,9 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | |||
171 | int i = 0; | 181 | int i = 0; |
172 | u8 r = 0; | 182 | u8 r = 0; |
173 | u8 power; | 183 | u8 power; |
184 | int ret = 0; | ||
185 | |||
186 | pm_runtime_get_sync(phy->io_dev); | ||
174 | 187 | ||
175 | /* Make sure the transceiver is not in low power mode */ | 188 | /* Make sure the transceiver is not in low power mode */ |
176 | power = musb_readb(addr, MUSB_POWER); | 189 | power = musb_readb(addr, MUSB_POWER); |
@@ -184,15 +197,20 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) | |||
184 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) | 197 | while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) |
185 | & MUSB_ULPI_REG_CMPLT)) { | 198 | & MUSB_ULPI_REG_CMPLT)) { |
186 | i++; | 199 | i++; |
187 | if (i == 10000) | 200 | if (i == 10000) { |
188 | return -ETIMEDOUT; | 201 | ret = -ETIMEDOUT; |
202 | goto out; | ||
203 | } | ||
189 | } | 204 | } |
190 | 205 | ||
191 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); | 206 | r = musb_readb(addr, MUSB_ULPI_REG_CONTROL); |
192 | r &= ~MUSB_ULPI_REG_CMPLT; | 207 | r &= ~MUSB_ULPI_REG_CMPLT; |
193 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); | 208 | musb_writeb(addr, MUSB_ULPI_REG_CONTROL, r); |
194 | 209 | ||
195 | return 0; | 210 | out: |
211 | pm_runtime_put(phy->io_dev); | ||
212 | |||
213 | return ret; | ||
196 | } | 214 | } |
197 | #else | 215 | #else |
198 | #define musb_ulpi_read NULL | 216 | #define musb_ulpi_read NULL |
@@ -1904,14 +1922,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1904 | 1922 | ||
1905 | if (!musb->isr) { | 1923 | if (!musb->isr) { |
1906 | status = -ENODEV; | 1924 | status = -ENODEV; |
1907 | goto fail3; | 1925 | goto fail2; |
1908 | } | 1926 | } |
1909 | 1927 | ||
1910 | if (!musb->xceiv->io_ops) { | 1928 | if (!musb->xceiv->io_ops) { |
1929 | musb->xceiv->io_dev = musb->controller; | ||
1911 | musb->xceiv->io_priv = musb->mregs; | 1930 | musb->xceiv->io_priv = musb->mregs; |
1912 | musb->xceiv->io_ops = &musb_ulpi_access; | 1931 | musb->xceiv->io_ops = &musb_ulpi_access; |
1913 | } | 1932 | } |
1914 | 1933 | ||
1934 | pm_runtime_get_sync(musb->controller); | ||
1935 | |||
1915 | #ifndef CONFIG_MUSB_PIO_ONLY | 1936 | #ifndef CONFIG_MUSB_PIO_ONLY |
1916 | if (use_dma && dev->dma_mask) { | 1937 | if (use_dma && dev->dma_mask) { |
1917 | struct dma_controller *c; | 1938 | struct dma_controller *c; |
@@ -2023,6 +2044,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2023 | goto fail5; | 2044 | goto fail5; |
2024 | #endif | 2045 | #endif |
2025 | 2046 | ||
2047 | pm_runtime_put(musb->controller); | ||
2048 | |||
2026 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", | 2049 | dev_info(dev, "USB %s mode controller at %p using %s, IRQ %d\n", |
2027 | ({char *s; | 2050 | ({char *s; |
2028 | switch (musb->board_mode) { | 2051 | switch (musb->board_mode) { |
@@ -2047,6 +2070,9 @@ fail4: | |||
2047 | musb_gadget_cleanup(musb); | 2070 | musb_gadget_cleanup(musb); |
2048 | 2071 | ||
2049 | fail3: | 2072 | fail3: |
2073 | pm_runtime_put_sync(musb->controller); | ||
2074 | |||
2075 | fail2: | ||
2050 | if (musb->irq_wake) | 2076 | if (musb->irq_wake) |
2051 | device_init_wakeup(dev, 0); | 2077 | device_init_wakeup(dev, 0); |
2052 | musb_platform_exit(musb); | 2078 | musb_platform_exit(musb); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 93de517a32a0..f4a40f001c88 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -449,7 +449,7 @@ struct musb { | |||
449 | * We added this flag to forcefully disable double | 449 | * We added this flag to forcefully disable double |
450 | * buffering until we get it working. | 450 | * buffering until we get it working. |
451 | */ | 451 | */ |
452 | unsigned double_buffer_not_ok:1 __deprecated; | 452 | unsigned double_buffer_not_ok:1; |
453 | 453 | ||
454 | struct musb_hdrc_config *config; | 454 | struct musb_hdrc_config *config; |
455 | 455 | ||
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 79cb0af779fa..ef8d744800ac 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2098,7 +2098,7 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) | |||
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | /* turn off DMA requests, discard state, stop polling ... */ | 2100 | /* turn off DMA requests, discard state, stop polling ... */ |
2101 | if (is_in) { | 2101 | if (ep->epnum && is_in) { |
2102 | /* giveback saves bulk toggle */ | 2102 | /* giveback saves bulk toggle */ |
2103 | csr = musb_h_flush_rxfifo(ep, 0); | 2103 | csr = musb_h_flush_rxfifo(ep, 0); |
2104 | 2104 | ||
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 2ae0bb309994..c7785e81254c 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -282,7 +282,8 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work) | |||
282 | 282 | ||
283 | static int omap2430_musb_init(struct musb *musb) | 283 | static int omap2430_musb_init(struct musb *musb) |
284 | { | 284 | { |
285 | u32 l, status = 0; | 285 | u32 l; |
286 | int status = 0; | ||
286 | struct device *dev = musb->controller; | 287 | struct device *dev = musb->controller; |
287 | struct musb_hdrc_platform_data *plat = dev->platform_data; | 288 | struct musb_hdrc_platform_data *plat = dev->platform_data; |
288 | struct omap_musb_board_data *data = plat->board_data; | 289 | struct omap_musb_board_data *data = plat->board_data; |
@@ -301,7 +302,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
301 | 302 | ||
302 | status = pm_runtime_get_sync(dev); | 303 | status = pm_runtime_get_sync(dev); |
303 | if (status < 0) { | 304 | if (status < 0) { |
304 | dev_err(dev, "pm_runtime_get_sync FAILED"); | 305 | dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status); |
305 | goto err1; | 306 | goto err1; |
306 | } | 307 | } |
307 | 308 | ||
@@ -333,6 +334,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
333 | 334 | ||
334 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); | 335 | setup_timer(&musb_idle_timer, musb_do_idle, (unsigned long) musb); |
335 | 336 | ||
337 | pm_runtime_put_noidle(musb->controller); | ||
336 | return 0; | 338 | return 0; |
337 | 339 | ||
338 | err1: | 340 | err1: |
@@ -452,14 +454,14 @@ static int __devinit omap2430_probe(struct platform_device *pdev) | |||
452 | goto err2; | 454 | goto err2; |
453 | } | 455 | } |
454 | 456 | ||
457 | pm_runtime_enable(&pdev->dev); | ||
458 | |||
455 | ret = platform_device_add(musb); | 459 | ret = platform_device_add(musb); |
456 | if (ret) { | 460 | if (ret) { |
457 | dev_err(&pdev->dev, "failed to register musb device\n"); | 461 | dev_err(&pdev->dev, "failed to register musb device\n"); |
458 | goto err2; | 462 | goto err2; |
459 | } | 463 | } |
460 | 464 | ||
461 | pm_runtime_enable(&pdev->dev); | ||
462 | |||
463 | return 0; | 465 | return 0; |
464 | 466 | ||
465 | err2: | 467 | err2: |
@@ -478,7 +480,6 @@ static int __devexit omap2430_remove(struct platform_device *pdev) | |||
478 | 480 | ||
479 | platform_device_del(glue->musb); | 481 | platform_device_del(glue->musb); |
480 | platform_device_put(glue->musb); | 482 | platform_device_put(glue->musb); |
481 | pm_runtime_put(&pdev->dev); | ||
482 | kfree(glue); | 483 | kfree(glue); |
483 | 484 | ||
484 | return 0; | 485 | return 0; |
@@ -491,11 +492,13 @@ static int omap2430_runtime_suspend(struct device *dev) | |||
491 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 492 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
492 | struct musb *musb = glue_to_musb(glue); | 493 | struct musb *musb = glue_to_musb(glue); |
493 | 494 | ||
494 | musb->context.otg_interfsel = musb_readl(musb->mregs, | 495 | if (musb) { |
495 | OTG_INTERFSEL); | 496 | musb->context.otg_interfsel = musb_readl(musb->mregs, |
497 | OTG_INTERFSEL); | ||
496 | 498 | ||
497 | omap2430_low_level_exit(musb); | 499 | omap2430_low_level_exit(musb); |
498 | usb_phy_set_suspend(musb->xceiv, 1); | 500 | usb_phy_set_suspend(musb->xceiv, 1); |
501 | } | ||
499 | 502 | ||
500 | return 0; | 503 | return 0; |
501 | } | 504 | } |
@@ -505,11 +508,13 @@ static int omap2430_runtime_resume(struct device *dev) | |||
505 | struct omap2430_glue *glue = dev_get_drvdata(dev); | 508 | struct omap2430_glue *glue = dev_get_drvdata(dev); |
506 | struct musb *musb = glue_to_musb(glue); | 509 | struct musb *musb = glue_to_musb(glue); |
507 | 510 | ||
508 | omap2430_low_level_init(musb); | 511 | if (musb) { |
509 | musb_writel(musb->mregs, OTG_INTERFSEL, | 512 | omap2430_low_level_init(musb); |
510 | musb->context.otg_interfsel); | 513 | musb_writel(musb->mregs, OTG_INTERFSEL, |
514 | musb->context.otg_interfsel); | ||
511 | 515 | ||
512 | usb_phy_set_suspend(musb->xceiv, 0); | 516 | usb_phy_set_suspend(musb->xceiv, 0); |
517 | } | ||
513 | 518 | ||
514 | return 0; | 519 | return 0; |
515 | } | 520 | } |
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index 3ece43a2e4c1..a0a2178974fe 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c | |||
@@ -96,7 +96,7 @@ static void gpio_vbus_work(struct work_struct *work) | |||
96 | struct gpio_vbus_data *gpio_vbus = | 96 | struct gpio_vbus_data *gpio_vbus = |
97 | container_of(work, struct gpio_vbus_data, work); | 97 | container_of(work, struct gpio_vbus_data, work); |
98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; | 98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; |
99 | int gpio; | 99 | int gpio, status; |
100 | 100 | ||
101 | if (!gpio_vbus->phy.otg->gadget) | 101 | if (!gpio_vbus->phy.otg->gadget) |
102 | return; | 102 | return; |
@@ -108,7 +108,9 @@ static void gpio_vbus_work(struct work_struct *work) | |||
108 | */ | 108 | */ |
109 | gpio = pdata->gpio_pullup; | 109 | gpio = pdata->gpio_pullup; |
110 | if (is_vbus_powered(pdata)) { | 110 | if (is_vbus_powered(pdata)) { |
111 | status = USB_EVENT_VBUS; | ||
111 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; | 112 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; |
113 | gpio_vbus->phy.last_event = status; | ||
112 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); | 114 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); |
113 | 115 | ||
114 | /* drawing a "unit load" is *always* OK, except for OTG */ | 116 | /* drawing a "unit load" is *always* OK, except for OTG */ |
@@ -117,6 +119,9 @@ static void gpio_vbus_work(struct work_struct *work) | |||
117 | /* optionally enable D+ pullup */ | 119 | /* optionally enable D+ pullup */ |
118 | if (gpio_is_valid(gpio)) | 120 | if (gpio_is_valid(gpio)) |
119 | gpio_set_value(gpio, !pdata->gpio_pullup_inverted); | 121 | gpio_set_value(gpio, !pdata->gpio_pullup_inverted); |
122 | |||
123 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | ||
124 | status, gpio_vbus->phy.otg->gadget); | ||
120 | } else { | 125 | } else { |
121 | /* optionally disable D+ pullup */ | 126 | /* optionally disable D+ pullup */ |
122 | if (gpio_is_valid(gpio)) | 127 | if (gpio_is_valid(gpio)) |
@@ -125,7 +130,12 @@ static void gpio_vbus_work(struct work_struct *work) | |||
125 | set_vbus_draw(gpio_vbus, 0); | 130 | set_vbus_draw(gpio_vbus, 0); |
126 | 131 | ||
127 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); | 132 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); |
133 | status = USB_EVENT_NONE; | ||
128 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; | 134 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; |
135 | gpio_vbus->phy.last_event = status; | ||
136 | |||
137 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | ||
138 | status, gpio_vbus->phy.otg->gadget); | ||
129 | } | 139 | } |
130 | } | 140 | } |
131 | 141 | ||
@@ -287,6 +297,9 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
287 | irq, err); | 297 | irq, err); |
288 | goto err_irq; | 298 | goto err_irq; |
289 | } | 299 | } |
300 | |||
301 | ATOMIC_INIT_NOTIFIER_HEAD(&gpio_vbus->phy.notifier); | ||
302 | |||
290 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); | 303 | INIT_WORK(&gpio_vbus->work, gpio_vbus_work); |
291 | 304 | ||
292 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); | 305 | gpio_vbus->vbus_draw = regulator_get(&pdev->dev, "vbus_draw"); |
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 7f547dc3a590..ed8adb052ca7 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -60,8 +60,6 @@ static int usb_serial_device_probe(struct device *dev) | |||
60 | retval = -ENODEV; | 60 | retval = -ENODEV; |
61 | goto exit; | 61 | goto exit; |
62 | } | 62 | } |
63 | if (port->dev_state != PORT_REGISTERING) | ||
64 | goto exit; | ||
65 | 63 | ||
66 | driver = port->serial->type; | 64 | driver = port->serial->type; |
67 | if (driver->port_probe) { | 65 | if (driver->port_probe) { |
@@ -98,9 +96,6 @@ static int usb_serial_device_remove(struct device *dev) | |||
98 | if (!port) | 96 | if (!port) |
99 | return -ENODEV; | 97 | return -ENODEV; |
100 | 98 | ||
101 | if (port->dev_state != PORT_UNREGISTERING) | ||
102 | return retval; | ||
103 | |||
104 | device_remove_file(&port->dev, &dev_attr_port_number); | 99 | device_remove_file(&port->dev, &dev_attr_port_number); |
105 | 100 | ||
106 | driver = port->serial->type; | 101 | driver = port->serial->type; |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 0310e2df59f5..ec30f95ef399 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -287,7 +287,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, | |||
287 | /* Issue the request, attempting to read 'size' bytes */ | 287 | /* Issue the request, attempting to read 'size' bytes */ |
288 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), | 288 | result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
289 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, | 289 | request, REQTYPE_DEVICE_TO_HOST, 0x0000, |
290 | port_priv->bInterfaceNumber, buf, size, 300); | 290 | port_priv->bInterfaceNumber, buf, size, |
291 | USB_CTRL_GET_TIMEOUT); | ||
291 | 292 | ||
292 | /* Convert data into an array of integers */ | 293 | /* Convert data into an array of integers */ |
293 | for (i = 0; i < length; i++) | 294 | for (i = 0; i < length; i++) |
@@ -340,12 +341,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, | |||
340 | result = usb_control_msg(serial->dev, | 341 | result = usb_control_msg(serial->dev, |
341 | usb_sndctrlpipe(serial->dev, 0), | 342 | usb_sndctrlpipe(serial->dev, 0), |
342 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, | 343 | request, REQTYPE_HOST_TO_DEVICE, 0x0000, |
343 | port_priv->bInterfaceNumber, buf, size, 300); | 344 | port_priv->bInterfaceNumber, buf, size, |
345 | USB_CTRL_SET_TIMEOUT); | ||
344 | } else { | 346 | } else { |
345 | result = usb_control_msg(serial->dev, | 347 | result = usb_control_msg(serial->dev, |
346 | usb_sndctrlpipe(serial->dev, 0), | 348 | usb_sndctrlpipe(serial->dev, 0), |
347 | request, REQTYPE_HOST_TO_DEVICE, data[0], | 349 | request, REQTYPE_HOST_TO_DEVICE, data[0], |
348 | port_priv->bInterfaceNumber, NULL, 0, 300); | 350 | port_priv->bInterfaceNumber, NULL, 0, |
351 | USB_CTRL_SET_TIMEOUT); | ||
349 | } | 352 | } |
350 | 353 | ||
351 | kfree(buf); | 354 | kfree(buf); |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ff8605b4b4be..02e7f2d32d52 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -75,7 +75,8 @@ struct ftdi_private { | |||
75 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 75 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
76 | struct async_icount icount; | 76 | struct async_icount icount; |
77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | 77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ |
78 | char prev_status, diff_status; /* Used for TIOCMIWAIT */ | 78 | char prev_status; /* Used for TIOCMIWAIT */ |
79 | bool dev_gone; /* Used to abort TIOCMIWAIT */ | ||
79 | char transmit_empty; /* If transmitter is empty or not */ | 80 | char transmit_empty; /* If transmitter is empty or not */ |
80 | struct usb_serial_port *port; | 81 | struct usb_serial_port *port; |
81 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface | 82 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface |
@@ -1681,6 +1682,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1681 | init_waitqueue_head(&priv->delta_msr_wait); | 1682 | init_waitqueue_head(&priv->delta_msr_wait); |
1682 | 1683 | ||
1683 | priv->flags = ASYNC_LOW_LATENCY; | 1684 | priv->flags = ASYNC_LOW_LATENCY; |
1685 | priv->dev_gone = false; | ||
1684 | 1686 | ||
1685 | if (quirk && quirk->port_probe) | 1687 | if (quirk && quirk->port_probe) |
1686 | quirk->port_probe(priv); | 1688 | quirk->port_probe(priv); |
@@ -1839,6 +1841,9 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) | |||
1839 | 1841 | ||
1840 | dbg("%s", __func__); | 1842 | dbg("%s", __func__); |
1841 | 1843 | ||
1844 | priv->dev_gone = true; | ||
1845 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1846 | |||
1842 | remove_sysfs_attrs(port); | 1847 | remove_sysfs_attrs(port); |
1843 | 1848 | ||
1844 | kref_put(&priv->kref, ftdi_sio_priv_release); | 1849 | kref_put(&priv->kref, ftdi_sio_priv_release); |
@@ -1982,17 +1987,19 @@ static int ftdi_process_packet(struct tty_struct *tty, | |||
1982 | N.B. packet may be processed more than once, but differences | 1987 | N.B. packet may be processed more than once, but differences |
1983 | are only processed once. */ | 1988 | are only processed once. */ |
1984 | status = packet[0] & FTDI_STATUS_B0_MASK; | 1989 | status = packet[0] & FTDI_STATUS_B0_MASK; |
1985 | if (status & FTDI_RS0_CTS) | ||
1986 | priv->icount.cts++; | ||
1987 | if (status & FTDI_RS0_DSR) | ||
1988 | priv->icount.dsr++; | ||
1989 | if (status & FTDI_RS0_RI) | ||
1990 | priv->icount.rng++; | ||
1991 | if (status & FTDI_RS0_RLSD) | ||
1992 | priv->icount.dcd++; | ||
1993 | if (status != priv->prev_status) { | 1990 | if (status != priv->prev_status) { |
1994 | priv->diff_status |= status ^ priv->prev_status; | 1991 | char diff_status = status ^ priv->prev_status; |
1995 | wake_up_interruptible(&priv->delta_msr_wait); | 1992 | |
1993 | if (diff_status & FTDI_RS0_CTS) | ||
1994 | priv->icount.cts++; | ||
1995 | if (diff_status & FTDI_RS0_DSR) | ||
1996 | priv->icount.dsr++; | ||
1997 | if (diff_status & FTDI_RS0_RI) | ||
1998 | priv->icount.rng++; | ||
1999 | if (diff_status & FTDI_RS0_RLSD) | ||
2000 | priv->icount.dcd++; | ||
2001 | |||
2002 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1996 | priv->prev_status = status; | 2003 | priv->prev_status = status; |
1997 | } | 2004 | } |
1998 | 2005 | ||
@@ -2395,15 +2402,12 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2395 | */ | 2402 | */ |
2396 | case TIOCMIWAIT: | 2403 | case TIOCMIWAIT: |
2397 | cprev = priv->icount; | 2404 | cprev = priv->icount; |
2398 | while (1) { | 2405 | while (!priv->dev_gone) { |
2399 | interruptible_sleep_on(&priv->delta_msr_wait); | 2406 | interruptible_sleep_on(&priv->delta_msr_wait); |
2400 | /* see if a signal did it */ | 2407 | /* see if a signal did it */ |
2401 | if (signal_pending(current)) | 2408 | if (signal_pending(current)) |
2402 | return -ERESTARTSYS; | 2409 | return -ERESTARTSYS; |
2403 | cnow = priv->icount; | 2410 | cnow = priv->icount; |
2404 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | ||
2405 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | ||
2406 | return -EIO; /* no change => error */ | ||
2407 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | 2411 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
2408 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | 2412 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
2409 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || | 2413 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || |
@@ -2412,7 +2416,7 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2412 | } | 2416 | } |
2413 | cprev = cnow; | 2417 | cprev = cnow; |
2414 | } | 2418 | } |
2415 | /* not reached */ | 2419 | return -EIO; |
2416 | break; | 2420 | break; |
2417 | case TIOCSERGETLSR: | 2421 | case TIOCSERGETLSR: |
2418 | return get_lsr_info(port, (struct serial_struct __user *)arg); | 2422 | return get_lsr_info(port, (struct serial_struct __user *)arg); |
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 6e1622f2a297..08d16e8c002d 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | /* Product information. */ | 28 | /* Product information. */ |
29 | #define FOCUS_VENDOR_ID 0x0C2E | 29 | #define FOCUS_VENDOR_ID 0x0C2E |
30 | #define FOCUS_PRODUCT_ID 0x0720 | 30 | #define FOCUS_PRODUCT_ID_BI 0x0720 |
31 | #define FOCUS_PRODUCT_ID_UNI 0x0710 | 31 | #define FOCUS_PRODUCT_ID_UNI 0x0700 |
32 | 32 | ||
33 | #define METROUSB_SET_REQUEST_TYPE 0x40 | 33 | #define METROUSB_SET_REQUEST_TYPE 0x40 |
34 | #define METROUSB_SET_MODEM_CTRL_REQUEST 10 | 34 | #define METROUSB_SET_MODEM_CTRL_REQUEST 10 |
@@ -47,7 +47,7 @@ struct metrousb_private { | |||
47 | 47 | ||
48 | /* Device table list. */ | 48 | /* Device table list. */ |
49 | static struct usb_device_id id_table[] = { | 49 | static struct usb_device_id id_table[] = { |
50 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID) }, | 50 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, |
51 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, | 51 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, |
52 | { }, /* Terminating entry. */ | 52 | { }, /* Terminating entry. */ |
53 | }; | 53 | }; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 836cfa9a515f..f4465ccddc35 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -708,6 +708,7 @@ static const struct usb_device_id option_ids[] = { | |||
708 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, | 708 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, |
709 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, | 709 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, |
710 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, | 710 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, |
711 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED) }, | ||
711 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, | 712 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, |
712 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, | 713 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, |
713 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, | 714 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ff4a174fa5de..a1a9062954c4 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -420,7 +420,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
420 | control = priv->line_control; | 420 | control = priv->line_control; |
421 | if ((cflag & CBAUD) == B0) | 421 | if ((cflag & CBAUD) == B0) |
422 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); | 422 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); |
423 | else | 423 | else if ((old_termios->c_cflag & CBAUD) == B0) |
424 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); | 424 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); |
425 | if (control != priv->line_control) { | 425 | if (control != priv->line_control) { |
426 | control = priv->line_control; | 426 | control = priv->line_control; |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index f14465a83dd1..8c8bf806f6fa 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = { | |||
221 | }; | 221 | }; |
222 | 222 | ||
223 | /* 'blacklist' of interfaces not served by this driver */ | 223 | /* 'blacklist' of interfaces not served by this driver */ |
224 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 }; | 224 | static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 }; |
225 | static const struct sierra_iface_info direct_ip_interface_blacklist = { | 225 | static const struct sierra_iface_info direct_ip_interface_blacklist = { |
226 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), | 226 | .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces), |
227 | .ifaceinfo = direct_ip_non_serial_ifaces, | 227 | .ifaceinfo = direct_ip_non_serial_ifaces, |
@@ -298,6 +298,9 @@ static const struct usb_device_id id_table[] = { | |||
298 | /* Sierra Wireless HSPA Non-Composite Device */ | 298 | /* Sierra Wireless HSPA Non-Composite Device */ |
299 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 299 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
300 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | 300 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ |
301 | { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */ | ||
302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
303 | }, | ||
301 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 304 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 305 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
303 | }, | 306 | }, |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 69230f01056a..97355a15bbea 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1059,6 +1059,12 @@ int usb_serial_probe(struct usb_interface *interface, | |||
1059 | serial->attached = 1; | 1059 | serial->attached = 1; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | /* Avoid race with tty_open and serial_install by setting the | ||
1063 | * disconnected flag and not clearing it until all ports have been | ||
1064 | * registered. | ||
1065 | */ | ||
1066 | serial->disconnected = 1; | ||
1067 | |||
1062 | if (get_free_serial(serial, num_ports, &minor) == NULL) { | 1068 | if (get_free_serial(serial, num_ports, &minor) == NULL) { |
1063 | dev_err(&interface->dev, "No more free serial devices\n"); | 1069 | dev_err(&interface->dev, "No more free serial devices\n"); |
1064 | goto probe_error; | 1070 | goto probe_error; |
@@ -1070,19 +1076,16 @@ int usb_serial_probe(struct usb_interface *interface, | |||
1070 | port = serial->port[i]; | 1076 | port = serial->port[i]; |
1071 | dev_set_name(&port->dev, "ttyUSB%d", port->number); | 1077 | dev_set_name(&port->dev, "ttyUSB%d", port->number); |
1072 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); | 1078 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); |
1073 | port->dev_state = PORT_REGISTERING; | ||
1074 | device_enable_async_suspend(&port->dev); | 1079 | device_enable_async_suspend(&port->dev); |
1075 | 1080 | ||
1076 | retval = device_add(&port->dev); | 1081 | retval = device_add(&port->dev); |
1077 | if (retval) { | 1082 | if (retval) |
1078 | dev_err(&port->dev, "Error registering port device, " | 1083 | dev_err(&port->dev, "Error registering port device, " |
1079 | "continuing\n"); | 1084 | "continuing\n"); |
1080 | port->dev_state = PORT_UNREGISTERED; | ||
1081 | } else { | ||
1082 | port->dev_state = PORT_REGISTERED; | ||
1083 | } | ||
1084 | } | 1085 | } |
1085 | 1086 | ||
1087 | serial->disconnected = 0; | ||
1088 | |||
1086 | usb_serial_console_init(debug, minor); | 1089 | usb_serial_console_init(debug, minor); |
1087 | 1090 | ||
1088 | exit: | 1091 | exit: |
@@ -1124,22 +1127,8 @@ void usb_serial_disconnect(struct usb_interface *interface) | |||
1124 | } | 1127 | } |
1125 | kill_traffic(port); | 1128 | kill_traffic(port); |
1126 | cancel_work_sync(&port->work); | 1129 | cancel_work_sync(&port->work); |
1127 | if (port->dev_state == PORT_REGISTERED) { | 1130 | if (device_is_registered(&port->dev)) |
1128 | |||
1129 | /* Make sure the port is bound so that the | ||
1130 | * driver's port_remove method is called. | ||
1131 | */ | ||
1132 | if (!port->dev.driver) { | ||
1133 | int rc; | ||
1134 | |||
1135 | port->dev.driver = | ||
1136 | &serial->type->driver; | ||
1137 | rc = device_bind_driver(&port->dev); | ||
1138 | } | ||
1139 | port->dev_state = PORT_UNREGISTERING; | ||
1140 | device_del(&port->dev); | 1131 | device_del(&port->dev); |
1141 | port->dev_state = PORT_UNREGISTERED; | ||
1142 | } | ||
1143 | } | 1132 | } |
1144 | } | 1133 | } |
1145 | serial->type->disconnect(serial); | 1134 | serial->type->disconnect(serial); |
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index c18538e4a6db..2653e73db623 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -132,6 +132,35 @@ static struct us_unusual_dev for_dynamic_ids = | |||
132 | #undef COMPLIANT_DEV | 132 | #undef COMPLIANT_DEV |
133 | #undef USUAL_DEV | 133 | #undef USUAL_DEV |
134 | 134 | ||
135 | #ifdef CONFIG_LOCKDEP | ||
136 | |||
137 | static struct lock_class_key us_interface_key[USB_MAXINTERFACES]; | ||
138 | |||
139 | static void us_set_lock_class(struct mutex *mutex, | ||
140 | struct usb_interface *intf) | ||
141 | { | ||
142 | struct usb_device *udev = interface_to_usbdev(intf); | ||
143 | struct usb_host_config *config = udev->actconfig; | ||
144 | int i; | ||
145 | |||
146 | for (i = 0; i < config->desc.bNumInterfaces; i++) { | ||
147 | if (config->interface[i] == intf) | ||
148 | break; | ||
149 | } | ||
150 | |||
151 | BUG_ON(i == config->desc.bNumInterfaces); | ||
152 | |||
153 | lockdep_set_class(mutex, &us_interface_key[i]); | ||
154 | } | ||
155 | |||
156 | #else | ||
157 | |||
158 | static void us_set_lock_class(struct mutex *mutex, | ||
159 | struct usb_interface *intf) | ||
160 | { | ||
161 | } | ||
162 | |||
163 | #endif | ||
135 | 164 | ||
136 | #ifdef CONFIG_PM /* Minimal support for suspend and resume */ | 165 | #ifdef CONFIG_PM /* Minimal support for suspend and resume */ |
137 | 166 | ||
@@ -895,6 +924,7 @@ int usb_stor_probe1(struct us_data **pus, | |||
895 | *pus = us = host_to_us(host); | 924 | *pus = us = host_to_us(host); |
896 | memset(us, 0, sizeof(struct us_data)); | 925 | memset(us, 0, sizeof(struct us_data)); |
897 | mutex_init(&(us->dev_mutex)); | 926 | mutex_init(&(us->dev_mutex)); |
927 | us_set_lock_class(&us->dev_mutex, intf); | ||
898 | init_completion(&us->cmnd_ready); | 928 | init_completion(&us->cmnd_ready); |
899 | init_completion(&(us->notify)); | 929 | init_completion(&(us->notify)); |
900 | init_waitqueue_head(&us->delay_wait); | 930 | init_waitqueue_head(&us->delay_wait); |
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c index 66797e9c5010..810c90ae2c55 100644 --- a/drivers/uwb/hwa-rc.c +++ b/drivers/uwb/hwa-rc.c | |||
@@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb) | |||
645 | dev_err(dev, "NEEP: URB error %d\n", urb->status); | 645 | dev_err(dev, "NEEP: URB error %d\n", urb->status); |
646 | } | 646 | } |
647 | result = usb_submit_urb(urb, GFP_ATOMIC); | 647 | result = usb_submit_urb(urb, GFP_ATOMIC); |
648 | if (result < 0) { | 648 | if (result < 0 && result != -ENODEV && result != -EPERM) { |
649 | /* ignoring unrecoverable errors */ | ||
649 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", | 650 | dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n", |
650 | result); | 651 | result); |
651 | goto error; | 652 | goto error; |
diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c index a269937be1b8..8cb71bb333c2 100644 --- a/drivers/uwb/neh.c +++ b/drivers/uwb/neh.c | |||
@@ -107,6 +107,7 @@ struct uwb_rc_neh { | |||
107 | u8 evt_type; | 107 | u8 evt_type; |
108 | __le16 evt; | 108 | __le16 evt; |
109 | u8 context; | 109 | u8 context; |
110 | u8 completed; | ||
110 | uwb_rc_cmd_cb_f cb; | 111 | uwb_rc_cmd_cb_f cb; |
111 | void *arg; | 112 | void *arg; |
112 | 113 | ||
@@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | |||
409 | struct device *dev = &rc->uwb_dev.dev; | 410 | struct device *dev = &rc->uwb_dev.dev; |
410 | struct uwb_rc_neh *neh; | 411 | struct uwb_rc_neh *neh; |
411 | struct uwb_rceb *notif; | 412 | struct uwb_rceb *notif; |
413 | unsigned long flags; | ||
412 | 414 | ||
413 | if (rceb->bEventContext == 0) { | 415 | if (rceb->bEventContext == 0) { |
414 | notif = kmalloc(size, GFP_ATOMIC); | 416 | notif = kmalloc(size, GFP_ATOMIC); |
@@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size | |||
422 | } else { | 424 | } else { |
423 | neh = uwb_rc_neh_lookup(rc, rceb); | 425 | neh = uwb_rc_neh_lookup(rc, rceb); |
424 | if (neh) { | 426 | if (neh) { |
425 | del_timer_sync(&neh->timer); | 427 | spin_lock_irqsave(&rc->neh_lock, flags); |
428 | /* to guard against a timeout */ | ||
429 | neh->completed = 1; | ||
430 | del_timer(&neh->timer); | ||
431 | spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
426 | uwb_rc_neh_cb(neh, rceb, size); | 432 | uwb_rc_neh_cb(neh, rceb, size); |
427 | } else | 433 | } else |
428 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", | 434 | dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n", |
@@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg) | |||
568 | unsigned long flags; | 574 | unsigned long flags; |
569 | 575 | ||
570 | spin_lock_irqsave(&rc->neh_lock, flags); | 576 | spin_lock_irqsave(&rc->neh_lock, flags); |
577 | if (neh->completed) { | ||
578 | spin_unlock_irqrestore(&rc->neh_lock, flags); | ||
579 | return; | ||
580 | } | ||
571 | if (neh->context) | 581 | if (neh->context) |
572 | __uwb_rc_neh_rm(rc, neh); | 582 | __uwb_rc_neh_rm(rc, neh); |
573 | else | 583 | else |
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c index 2eecec0c13c9..6ec45beb7af5 100644 --- a/drivers/uwb/uwb-debug.c +++ b/drivers/uwb/uwb-debug.c | |||
@@ -159,13 +159,6 @@ static int cmd_ie_rm(struct uwb_rc *rc, struct uwb_dbg_cmd_ie *ie_to_rm) | |||
159 | return uwb_rc_ie_rm(rc, ie_to_rm->data[0]); | 159 | return uwb_rc_ie_rm(rc, ie_to_rm->data[0]); |
160 | } | 160 | } |
161 | 161 | ||
162 | static int command_open(struct inode *inode, struct file *file) | ||
163 | { | ||
164 | file->private_data = inode->i_private; | ||
165 | |||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | static ssize_t command_write(struct file *file, const char __user *buf, | 162 | static ssize_t command_write(struct file *file, const char __user *buf, |
170 | size_t len, loff_t *off) | 163 | size_t len, loff_t *off) |
171 | { | 164 | { |
@@ -206,7 +199,7 @@ static ssize_t command_write(struct file *file, const char __user *buf, | |||
206 | } | 199 | } |
207 | 200 | ||
208 | static const struct file_operations command_fops = { | 201 | static const struct file_operations command_fops = { |
209 | .open = command_open, | 202 | .open = simple_open, |
210 | .write = command_write, | 203 | .write = command_write, |
211 | .read = NULL, | 204 | .read = NULL, |
212 | .llseek = no_llseek, | 205 | .llseek = no_llseek, |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index f0da2c32fbde..1f21d2a1e528 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -238,7 +238,7 @@ static void handle_tx(struct vhost_net *net) | |||
238 | 238 | ||
239 | vq->heads[vq->upend_idx].len = len; | 239 | vq->heads[vq->upend_idx].len = len; |
240 | ubuf->callback = vhost_zerocopy_callback; | 240 | ubuf->callback = vhost_zerocopy_callback; |
241 | ubuf->arg = vq->ubufs; | 241 | ubuf->ctx = vq->ubufs; |
242 | ubuf->desc = vq->upend_idx; | 242 | ubuf->desc = vq->upend_idx; |
243 | msg.msg_control = ubuf; | 243 | msg.msg_control = ubuf; |
244 | msg.msg_controllen = sizeof(ubuf); | 244 | msg.msg_controllen = sizeof(ubuf); |
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index fc9a1d75281f..3de00d9fae2e 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c | |||
@@ -155,7 +155,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) | |||
155 | 155 | ||
156 | vhost_test_stop(n, &private); | 156 | vhost_test_stop(n, &private); |
157 | vhost_test_flush(n); | 157 | vhost_test_flush(n); |
158 | vhost_dev_cleanup(&n->dev); | 158 | vhost_dev_cleanup(&n->dev, false); |
159 | /* We do an extra flush before freeing memory, | 159 | /* We do an extra flush before freeing memory, |
160 | * since jobs can re-queue themselves. */ | 160 | * since jobs can re-queue themselves. */ |
161 | vhost_test_flush(n); | 161 | vhost_test_flush(n); |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 947f00d8e091..51e4c1eeec4f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -1598,10 +1598,9 @@ void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs) | |||
1598 | kfree(ubufs); | 1598 | kfree(ubufs); |
1599 | } | 1599 | } |
1600 | 1600 | ||
1601 | void vhost_zerocopy_callback(void *arg) | 1601 | void vhost_zerocopy_callback(struct ubuf_info *ubuf) |
1602 | { | 1602 | { |
1603 | struct ubuf_info *ubuf = arg; | 1603 | struct vhost_ubuf_ref *ubufs = ubuf->ctx; |
1604 | struct vhost_ubuf_ref *ubufs = ubuf->arg; | ||
1605 | struct vhost_virtqueue *vq = ubufs->vq; | 1604 | struct vhost_virtqueue *vq = ubufs->vq; |
1606 | 1605 | ||
1607 | /* set len = 1 to mark this desc buffers done DMA */ | 1606 | /* set len = 1 to mark this desc buffers done DMA */ |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 8dcf4cca6bf2..8de1fd5b8efb 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -188,7 +188,7 @@ bool vhost_enable_notify(struct vhost_dev *, struct vhost_virtqueue *); | |||
188 | 188 | ||
189 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, | 189 | int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log, |
190 | unsigned int log_num, u64 len); | 190 | unsigned int log_num, u64 len); |
191 | void vhost_zerocopy_callback(void *arg); | 191 | void vhost_zerocopy_callback(struct ubuf_info *); |
192 | int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq); | 192 | int vhost_zerocopy_signal_used(struct vhost_virtqueue *vq); |
193 | 193 | ||
194 | #define vq_err(vq, fmt, ...) do { \ | 194 | #define vq_err(vq, fmt, ...) do { \ |
diff --git a/drivers/video/au1100fb.c b/drivers/video/au1100fb.c index befcbd8ef019..ffbce4525468 100644 --- a/drivers/video/au1100fb.c +++ b/drivers/video/au1100fb.c | |||
@@ -499,7 +499,8 @@ static int __devinit au1100fb_drv_probe(struct platform_device *dev) | |||
499 | au1100fb_fix.mmio_start = regs_res->start; | 499 | au1100fb_fix.mmio_start = regs_res->start; |
500 | au1100fb_fix.mmio_len = resource_size(regs_res); | 500 | au1100fb_fix.mmio_len = resource_size(regs_res); |
501 | 501 | ||
502 | if (!devm_request_mem_region(au1100fb_fix.mmio_start, | 502 | if (!devm_request_mem_region(&dev->dev, |
503 | au1100fb_fix.mmio_start, | ||
503 | au1100fb_fix.mmio_len, | 504 | au1100fb_fix.mmio_len, |
504 | DRIVER_NAME)) { | 505 | DRIVER_NAME)) { |
505 | print_err("fail to lock memory region at 0x%08lx", | 506 | print_err("fail to lock memory region at 0x%08lx", |
@@ -516,7 +517,7 @@ static int __devinit au1100fb_drv_probe(struct platform_device *dev) | |||
516 | fbdev->fb_len = fbdev->panel->xres * fbdev->panel->yres * | 517 | fbdev->fb_len = fbdev->panel->xres * fbdev->panel->yres * |
517 | (fbdev->panel->bpp >> 3) * AU1100FB_NBR_VIDEO_BUFFERS; | 518 | (fbdev->panel->bpp >> 3) * AU1100FB_NBR_VIDEO_BUFFERS; |
518 | 519 | ||
519 | fbdev->fb_mem = dmam_alloc_coherent(&dev->dev, &dev->dev, | 520 | fbdev->fb_mem = dmam_alloc_coherent(&dev->dev, |
520 | PAGE_ALIGN(fbdev->fb_len), | 521 | PAGE_ALIGN(fbdev->fb_len), |
521 | &fbdev->fb_phys, GFP_KERNEL); | 522 | &fbdev->fb_phys, GFP_KERNEL); |
522 | if (!fbdev->fb_mem) { | 523 | if (!fbdev->fb_mem) { |
diff --git a/drivers/video/au1200fb.c b/drivers/video/au1200fb.c index 3e9a773db09f..7ca79f02056e 100644 --- a/drivers/video/au1200fb.c +++ b/drivers/video/au1200fb.c | |||
@@ -1724,7 +1724,7 @@ static int __devinit au1200fb_drv_probe(struct platform_device *dev) | |||
1724 | /* Allocate the framebuffer to the maximum screen size */ | 1724 | /* Allocate the framebuffer to the maximum screen size */ |
1725 | fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; | 1725 | fbdev->fb_len = (win->w[plane].xres * win->w[plane].yres * bpp) / 8; |
1726 | 1726 | ||
1727 | fbdev->fb_mem = dmam_alloc_noncoherent(&dev->dev, &dev->dev, | 1727 | fbdev->fb_mem = dmam_alloc_noncoherent(&dev->dev, |
1728 | PAGE_ALIGN(fbdev->fb_len), | 1728 | PAGE_ALIGN(fbdev->fb_len), |
1729 | &fbdev->fb_phys, GFP_KERNEL); | 1729 | &fbdev->fb_phys, GFP_KERNEL); |
1730 | if (!fbdev->fb_mem) { | 1730 | if (!fbdev->fb_mem) { |
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 7ed9991fa747..af16884491ed 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -245,6 +245,12 @@ config BACKLIGHT_DA903X | |||
245 | If you have a LCD backlight connected to the WLED output of DA9030 | 245 | If you have a LCD backlight connected to the WLED output of DA9030 |
246 | or DA9034 WLED output, say Y here to enable this driver. | 246 | or DA9034 WLED output, say Y here to enable this driver. |
247 | 247 | ||
248 | config BACKLIGHT_DA9052 | ||
249 | tristate "Dialog DA9052/DA9053 WLED" | ||
250 | depends on PMIC_DA9052 | ||
251 | help | ||
252 | Enable the Backlight Driver for DA9052-BC and DA9053-AA/Bx PMICs. | ||
253 | |||
248 | config BACKLIGHT_MAX8925 | 254 | config BACKLIGHT_MAX8925 |
249 | tristate "Backlight driver for MAX8925" | 255 | tristate "Backlight driver for MAX8925" |
250 | depends on MFD_MAX8925 | 256 | depends on MFD_MAX8925 |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index 8071eb656147..36855ae887d6 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -29,6 +29,7 @@ obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o | |||
29 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o | 29 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o |
30 | obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o | 30 | obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o |
31 | obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o | 31 | obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o |
32 | obj-$(CONFIG_BACKLIGHT_DA9052) += da9052_bl.o | ||
32 | obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o | 33 | obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o |
33 | obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o | 34 | obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o |
34 | obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o | 35 | obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o |
diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c new file mode 100644 index 000000000000..b628d68f5162 --- /dev/null +++ b/drivers/video/backlight/da9052_bl.c | |||
@@ -0,0 +1,187 @@ | |||
1 | /* | ||
2 | * Backlight Driver for Dialog DA9052 PMICs | ||
3 | * | ||
4 | * Copyright(c) 2012 Dialog Semiconductor Ltd. | ||
5 | * | ||
6 | * Author: David Dajun Chen <dchen@diasemi.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/backlight.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/fb.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/platform_device.h> | ||
20 | |||
21 | #include <linux/mfd/da9052/da9052.h> | ||
22 | #include <linux/mfd/da9052/reg.h> | ||
23 | |||
24 | #define DA9052_MAX_BRIGHTNESS 0xFF | ||
25 | |||
26 | enum { | ||
27 | DA9052_WLEDS_OFF, | ||
28 | DA9052_WLEDS_ON, | ||
29 | }; | ||
30 | |||
31 | enum { | ||
32 | DA9052_TYPE_WLED1, | ||
33 | DA9052_TYPE_WLED2, | ||
34 | DA9052_TYPE_WLED3, | ||
35 | }; | ||
36 | |||
37 | static unsigned char wled_bank[] = { | ||
38 | DA9052_LED1_CONF_REG, | ||
39 | DA9052_LED2_CONF_REG, | ||
40 | DA9052_LED3_CONF_REG, | ||
41 | }; | ||
42 | |||
43 | struct da9052_bl { | ||
44 | struct da9052 *da9052; | ||
45 | uint brightness; | ||
46 | uint state; | ||
47 | uint led_reg; | ||
48 | }; | ||
49 | |||
50 | static int da9052_adjust_wled_brightness(struct da9052_bl *wleds) | ||
51 | { | ||
52 | unsigned char boost_en; | ||
53 | unsigned char i_sink; | ||
54 | int ret; | ||
55 | |||
56 | boost_en = 0x3F; | ||
57 | i_sink = 0xFF; | ||
58 | if (wleds->state == DA9052_WLEDS_OFF) { | ||
59 | boost_en = 0x00; | ||
60 | i_sink = 0x00; | ||
61 | } | ||
62 | |||
63 | ret = da9052_reg_write(wleds->da9052, DA9052_BOOST_REG, boost_en); | ||
64 | if (ret < 0) | ||
65 | return ret; | ||
66 | |||
67 | ret = da9052_reg_write(wleds->da9052, DA9052_LED_CONT_REG, i_sink); | ||
68 | if (ret < 0) | ||
69 | return ret; | ||
70 | |||
71 | ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg], 0x0); | ||
72 | if (ret < 0) | ||
73 | return ret; | ||
74 | |||
75 | msleep(10); | ||
76 | |||
77 | if (wleds->brightness) { | ||
78 | ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg], | ||
79 | wleds->brightness); | ||
80 | if (ret < 0) | ||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static int da9052_backlight_update_status(struct backlight_device *bl) | ||
88 | { | ||
89 | int brightness = bl->props.brightness; | ||
90 | struct da9052_bl *wleds = bl_get_data(bl); | ||
91 | |||
92 | wleds->brightness = brightness; | ||
93 | wleds->state = DA9052_WLEDS_ON; | ||
94 | |||
95 | return da9052_adjust_wled_brightness(wleds); | ||
96 | } | ||
97 | |||
98 | static int da9052_backlight_get_brightness(struct backlight_device *bl) | ||
99 | { | ||
100 | struct da9052_bl *wleds = bl_get_data(bl); | ||
101 | |||
102 | return wleds->brightness; | ||
103 | } | ||
104 | |||
105 | static const struct backlight_ops da9052_backlight_ops = { | ||
106 | .update_status = da9052_backlight_update_status, | ||
107 | .get_brightness = da9052_backlight_get_brightness, | ||
108 | }; | ||
109 | |||
110 | static int da9052_backlight_probe(struct platform_device *pdev) | ||
111 | { | ||
112 | struct backlight_device *bl; | ||
113 | struct backlight_properties props; | ||
114 | struct da9052_bl *wleds; | ||
115 | |||
116 | wleds = devm_kzalloc(&pdev->dev, sizeof(struct da9052_bl), GFP_KERNEL); | ||
117 | if (!wleds) | ||
118 | return -ENOMEM; | ||
119 | |||
120 | wleds->da9052 = dev_get_drvdata(pdev->dev.parent); | ||
121 | wleds->brightness = 0; | ||
122 | wleds->led_reg = platform_get_device_id(pdev)->driver_data; | ||
123 | wleds->state = DA9052_WLEDS_OFF; | ||
124 | |||
125 | props.type = BACKLIGHT_RAW; | ||
126 | props.max_brightness = DA9052_MAX_BRIGHTNESS; | ||
127 | |||
128 | bl = backlight_device_register(pdev->name, wleds->da9052->dev, wleds, | ||
129 | &da9052_backlight_ops, &props); | ||
130 | if (IS_ERR(bl)) { | ||
131 | dev_err(&pdev->dev, "Failed to register backlight\n"); | ||
132 | devm_kfree(&pdev->dev, wleds); | ||
133 | return PTR_ERR(bl); | ||
134 | } | ||
135 | |||
136 | bl->props.max_brightness = DA9052_MAX_BRIGHTNESS; | ||
137 | bl->props.brightness = 0; | ||
138 | platform_set_drvdata(pdev, bl); | ||
139 | |||
140 | return da9052_adjust_wled_brightness(wleds); | ||
141 | } | ||
142 | |||
143 | static int da9052_backlight_remove(struct platform_device *pdev) | ||
144 | { | ||
145 | struct backlight_device *bl = platform_get_drvdata(pdev); | ||
146 | struct da9052_bl *wleds = bl_get_data(bl); | ||
147 | |||
148 | wleds->brightness = 0; | ||
149 | wleds->state = DA9052_WLEDS_OFF; | ||
150 | da9052_adjust_wled_brightness(wleds); | ||
151 | backlight_device_unregister(bl); | ||
152 | devm_kfree(&pdev->dev, wleds); | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | static struct platform_device_id da9052_wled_ids[] = { | ||
158 | { | ||
159 | .name = "da9052-wled1", | ||
160 | .driver_data = DA9052_TYPE_WLED1, | ||
161 | }, | ||
162 | { | ||
163 | .name = "da9052-wled2", | ||
164 | .driver_data = DA9052_TYPE_WLED2, | ||
165 | }, | ||
166 | { | ||
167 | .name = "da9052-wled3", | ||
168 | .driver_data = DA9052_TYPE_WLED3, | ||
169 | }, | ||
170 | }; | ||
171 | |||
172 | static struct platform_driver da9052_wled_driver = { | ||
173 | .probe = da9052_backlight_probe, | ||
174 | .remove = da9052_backlight_remove, | ||
175 | .id_table = da9052_wled_ids, | ||
176 | .driver = { | ||
177 | .name = "da9052-wled", | ||
178 | .owner = THIS_MODULE, | ||
179 | }, | ||
180 | }; | ||
181 | |||
182 | module_platform_driver(da9052_wled_driver); | ||
183 | |||
184 | MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>"); | ||
185 | MODULE_DESCRIPTION("Backlight driver for DA9052 PMIC"); | ||
186 | MODULE_LICENSE("GPL"); | ||
187 | MODULE_ALIAS("platform:da9052-backlight"); | ||
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index be20b5cbe26c..3a6d5419e3e3 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c | |||
@@ -229,14 +229,7 @@ static struct locomo_driver poodle_lcd_driver = { | |||
229 | 229 | ||
230 | static int __init locomolcd_init(void) | 230 | static int __init locomolcd_init(void) |
231 | { | 231 | { |
232 | int ret = locomo_driver_register(&poodle_lcd_driver); | 232 | return locomo_driver_register(&poodle_lcd_driver); |
233 | if (ret) | ||
234 | return ret; | ||
235 | |||
236 | #ifdef CONFIG_SA1100_COLLIE | ||
237 | sa1100fb_lcd_power = locomolcd_power; | ||
238 | #endif | ||
239 | return 0; | ||
240 | } | 233 | } |
241 | 234 | ||
242 | static void __exit locomolcd_exit(void) | 235 | static void __exit locomolcd_exit(void) |
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/video/kyro/STG4000Reg.h b/drivers/video/kyro/STG4000Reg.h index 5d6269882589..50f4670e9252 100644 --- a/drivers/video/kyro/STG4000Reg.h +++ b/drivers/video/kyro/STG4000Reg.h | |||
@@ -73,210 +73,210 @@ typedef enum _OVRL_PIX_FORMAT { | |||
73 | /* Register Table */ | 73 | /* Register Table */ |
74 | typedef struct { | 74 | typedef struct { |
75 | /* 0h */ | 75 | /* 0h */ |
76 | volatile unsigned long Thread0Enable; /* 0x0000 */ | 76 | volatile u32 Thread0Enable; /* 0x0000 */ |
77 | volatile unsigned long Thread1Enable; /* 0x0004 */ | 77 | volatile u32 Thread1Enable; /* 0x0004 */ |
78 | volatile unsigned long Thread0Recover; /* 0x0008 */ | 78 | volatile u32 Thread0Recover; /* 0x0008 */ |
79 | volatile unsigned long Thread1Recover; /* 0x000C */ | 79 | volatile u32 Thread1Recover; /* 0x000C */ |
80 | volatile unsigned long Thread0Step; /* 0x0010 */ | 80 | volatile u32 Thread0Step; /* 0x0010 */ |
81 | volatile unsigned long Thread1Step; /* 0x0014 */ | 81 | volatile u32 Thread1Step; /* 0x0014 */ |
82 | volatile unsigned long VideoInStatus; /* 0x0018 */ | 82 | volatile u32 VideoInStatus; /* 0x0018 */ |
83 | volatile unsigned long Core2InSignStart; /* 0x001C */ | 83 | volatile u32 Core2InSignStart; /* 0x001C */ |
84 | volatile unsigned long Core1ResetVector; /* 0x0020 */ | 84 | volatile u32 Core1ResetVector; /* 0x0020 */ |
85 | volatile unsigned long Core1ROMOffset; /* 0x0024 */ | 85 | volatile u32 Core1ROMOffset; /* 0x0024 */ |
86 | volatile unsigned long Core1ArbiterPriority; /* 0x0028 */ | 86 | volatile u32 Core1ArbiterPriority; /* 0x0028 */ |
87 | volatile unsigned long VideoInControl; /* 0x002C */ | 87 | volatile u32 VideoInControl; /* 0x002C */ |
88 | volatile unsigned long VideoInReg0CtrlA; /* 0x0030 */ | 88 | volatile u32 VideoInReg0CtrlA; /* 0x0030 */ |
89 | volatile unsigned long VideoInReg0CtrlB; /* 0x0034 */ | 89 | volatile u32 VideoInReg0CtrlB; /* 0x0034 */ |
90 | volatile unsigned long VideoInReg1CtrlA; /* 0x0038 */ | 90 | volatile u32 VideoInReg1CtrlA; /* 0x0038 */ |
91 | volatile unsigned long VideoInReg1CtrlB; /* 0x003C */ | 91 | volatile u32 VideoInReg1CtrlB; /* 0x003C */ |
92 | volatile unsigned long Thread0Kicker; /* 0x0040 */ | 92 | volatile u32 Thread0Kicker; /* 0x0040 */ |
93 | volatile unsigned long Core2InputSign; /* 0x0044 */ | 93 | volatile u32 Core2InputSign; /* 0x0044 */ |
94 | volatile unsigned long Thread0ProgCtr; /* 0x0048 */ | 94 | volatile u32 Thread0ProgCtr; /* 0x0048 */ |
95 | volatile unsigned long Thread1ProgCtr; /* 0x004C */ | 95 | volatile u32 Thread1ProgCtr; /* 0x004C */ |
96 | volatile unsigned long Thread1Kicker; /* 0x0050 */ | 96 | volatile u32 Thread1Kicker; /* 0x0050 */ |
97 | volatile unsigned long GPRegister1; /* 0x0054 */ | 97 | volatile u32 GPRegister1; /* 0x0054 */ |
98 | volatile unsigned long GPRegister2; /* 0x0058 */ | 98 | volatile u32 GPRegister2; /* 0x0058 */ |
99 | volatile unsigned long GPRegister3; /* 0x005C */ | 99 | volatile u32 GPRegister3; /* 0x005C */ |
100 | volatile unsigned long GPRegister4; /* 0x0060 */ | 100 | volatile u32 GPRegister4; /* 0x0060 */ |
101 | volatile unsigned long SerialIntA; /* 0x0064 */ | 101 | volatile u32 SerialIntA; /* 0x0064 */ |
102 | 102 | ||
103 | volatile unsigned long Fill0[6]; /* GAP 0x0068 - 0x007C */ | 103 | volatile u32 Fill0[6]; /* GAP 0x0068 - 0x007C */ |
104 | 104 | ||
105 | volatile unsigned long SoftwareReset; /* 0x0080 */ | 105 | volatile u32 SoftwareReset; /* 0x0080 */ |
106 | volatile unsigned long SerialIntB; /* 0x0084 */ | 106 | volatile u32 SerialIntB; /* 0x0084 */ |
107 | 107 | ||
108 | volatile unsigned long Fill1[37]; /* GAP 0x0088 - 0x011C */ | 108 | volatile u32 Fill1[37]; /* GAP 0x0088 - 0x011C */ |
109 | 109 | ||
110 | volatile unsigned long ROMELQV; /* 0x011C */ | 110 | volatile u32 ROMELQV; /* 0x011C */ |
111 | volatile unsigned long WLWH; /* 0x0120 */ | 111 | volatile u32 WLWH; /* 0x0120 */ |
112 | volatile unsigned long ROMELWL; /* 0x0124 */ | 112 | volatile u32 ROMELWL; /* 0x0124 */ |
113 | 113 | ||
114 | volatile unsigned long dwFill_1; /* GAP 0x0128 */ | 114 | volatile u32 dwFill_1; /* GAP 0x0128 */ |
115 | 115 | ||
116 | volatile unsigned long IntStatus; /* 0x012C */ | 116 | volatile u32 IntStatus; /* 0x012C */ |
117 | volatile unsigned long IntMask; /* 0x0130 */ | 117 | volatile u32 IntMask; /* 0x0130 */ |
118 | volatile unsigned long IntClear; /* 0x0134 */ | 118 | volatile u32 IntClear; /* 0x0134 */ |
119 | 119 | ||
120 | volatile unsigned long Fill2[6]; /* GAP 0x0138 - 0x014C */ | 120 | volatile u32 Fill2[6]; /* GAP 0x0138 - 0x014C */ |
121 | 121 | ||
122 | volatile unsigned long ROMGPIOA; /* 0x0150 */ | 122 | volatile u32 ROMGPIOA; /* 0x0150 */ |
123 | volatile unsigned long ROMGPIOB; /* 0x0154 */ | 123 | volatile u32 ROMGPIOB; /* 0x0154 */ |
124 | volatile unsigned long ROMGPIOC; /* 0x0158 */ | 124 | volatile u32 ROMGPIOC; /* 0x0158 */ |
125 | volatile unsigned long ROMGPIOD; /* 0x015C */ | 125 | volatile u32 ROMGPIOD; /* 0x015C */ |
126 | 126 | ||
127 | volatile unsigned long Fill3[2]; /* GAP 0x0160 - 0x0168 */ | 127 | volatile u32 Fill3[2]; /* GAP 0x0160 - 0x0168 */ |
128 | 128 | ||
129 | volatile unsigned long AGPIntID; /* 0x0168 */ | 129 | volatile u32 AGPIntID; /* 0x0168 */ |
130 | volatile unsigned long AGPIntClassCode; /* 0x016C */ | 130 | volatile u32 AGPIntClassCode; /* 0x016C */ |
131 | volatile unsigned long AGPIntBIST; /* 0x0170 */ | 131 | volatile u32 AGPIntBIST; /* 0x0170 */ |
132 | volatile unsigned long AGPIntSSID; /* 0x0174 */ | 132 | volatile u32 AGPIntSSID; /* 0x0174 */ |
133 | volatile unsigned long AGPIntPMCSR; /* 0x0178 */ | 133 | volatile u32 AGPIntPMCSR; /* 0x0178 */ |
134 | volatile unsigned long VGAFrameBufBase; /* 0x017C */ | 134 | volatile u32 VGAFrameBufBase; /* 0x017C */ |
135 | volatile unsigned long VGANotify; /* 0x0180 */ | 135 | volatile u32 VGANotify; /* 0x0180 */ |
136 | volatile unsigned long DACPLLMode; /* 0x0184 */ | 136 | volatile u32 DACPLLMode; /* 0x0184 */ |
137 | volatile unsigned long Core1VideoClockDiv; /* 0x0188 */ | 137 | volatile u32 Core1VideoClockDiv; /* 0x0188 */ |
138 | volatile unsigned long AGPIntStat; /* 0x018C */ | 138 | volatile u32 AGPIntStat; /* 0x018C */ |
139 | 139 | ||
140 | /* | 140 | /* |
141 | volatile unsigned long Fill4[0x0400/4 - 0x0190/4]; //GAP 0x0190 - 0x0400 | 141 | volatile u32 Fill4[0x0400/4 - 0x0190/4]; //GAP 0x0190 - 0x0400 |
142 | volatile unsigned long Fill5[0x05FC/4 - 0x0400/4]; //GAP 0x0400 - 0x05FC Fog Table | 142 | volatile u32 Fill5[0x05FC/4 - 0x0400/4]; //GAP 0x0400 - 0x05FC Fog Table |
143 | volatile unsigned long Fill6[0x0604/4 - 0x0600/4]; //GAP 0x0600 - 0x0604 | 143 | volatile u32 Fill6[0x0604/4 - 0x0600/4]; //GAP 0x0600 - 0x0604 |
144 | volatile unsigned long Fill7[0x0680/4 - 0x0608/4]; //GAP 0x0608 - 0x0680 | 144 | volatile u32 Fill7[0x0680/4 - 0x0608/4]; //GAP 0x0608 - 0x0680 |
145 | volatile unsigned long Fill8[0x07FC/4 - 0x0684/4]; //GAP 0x0684 - 0x07FC | 145 | volatile u32 Fill8[0x07FC/4 - 0x0684/4]; //GAP 0x0684 - 0x07FC |
146 | */ | 146 | */ |
147 | volatile unsigned long Fill4[412]; /* 0x0190 - 0x07FC */ | 147 | volatile u32 Fill4[412]; /* 0x0190 - 0x07FC */ |
148 | 148 | ||
149 | volatile unsigned long TACtrlStreamBase; /* 0x0800 */ | 149 | volatile u32 TACtrlStreamBase; /* 0x0800 */ |
150 | volatile unsigned long TAObjDataBase; /* 0x0804 */ | 150 | volatile u32 TAObjDataBase; /* 0x0804 */ |
151 | volatile unsigned long TAPtrDataBase; /* 0x0808 */ | 151 | volatile u32 TAPtrDataBase; /* 0x0808 */ |
152 | volatile unsigned long TARegionDataBase; /* 0x080C */ | 152 | volatile u32 TARegionDataBase; /* 0x080C */ |
153 | volatile unsigned long TATailPtrBase; /* 0x0810 */ | 153 | volatile u32 TATailPtrBase; /* 0x0810 */ |
154 | volatile unsigned long TAPtrRegionSize; /* 0x0814 */ | 154 | volatile u32 TAPtrRegionSize; /* 0x0814 */ |
155 | volatile unsigned long TAConfiguration; /* 0x0818 */ | 155 | volatile u32 TAConfiguration; /* 0x0818 */ |
156 | volatile unsigned long TAObjDataStartAddr; /* 0x081C */ | 156 | volatile u32 TAObjDataStartAddr; /* 0x081C */ |
157 | volatile unsigned long TAObjDataEndAddr; /* 0x0820 */ | 157 | volatile u32 TAObjDataEndAddr; /* 0x0820 */ |
158 | volatile unsigned long TAXScreenClip; /* 0x0824 */ | 158 | volatile u32 TAXScreenClip; /* 0x0824 */ |
159 | volatile unsigned long TAYScreenClip; /* 0x0828 */ | 159 | volatile u32 TAYScreenClip; /* 0x0828 */ |
160 | volatile unsigned long TARHWClamp; /* 0x082C */ | 160 | volatile u32 TARHWClamp; /* 0x082C */ |
161 | volatile unsigned long TARHWCompare; /* 0x0830 */ | 161 | volatile u32 TARHWCompare; /* 0x0830 */ |
162 | volatile unsigned long TAStart; /* 0x0834 */ | 162 | volatile u32 TAStart; /* 0x0834 */ |
163 | volatile unsigned long TAObjReStart; /* 0x0838 */ | 163 | volatile u32 TAObjReStart; /* 0x0838 */ |
164 | volatile unsigned long TAPtrReStart; /* 0x083C */ | 164 | volatile u32 TAPtrReStart; /* 0x083C */ |
165 | volatile unsigned long TAStatus1; /* 0x0840 */ | 165 | volatile u32 TAStatus1; /* 0x0840 */ |
166 | volatile unsigned long TAStatus2; /* 0x0844 */ | 166 | volatile u32 TAStatus2; /* 0x0844 */ |
167 | volatile unsigned long TAIntStatus; /* 0x0848 */ | 167 | volatile u32 TAIntStatus; /* 0x0848 */ |
168 | volatile unsigned long TAIntMask; /* 0x084C */ | 168 | volatile u32 TAIntMask; /* 0x084C */ |
169 | 169 | ||
170 | volatile unsigned long Fill5[235]; /* GAP 0x0850 - 0x0BF8 */ | 170 | volatile u32 Fill5[235]; /* GAP 0x0850 - 0x0BF8 */ |
171 | 171 | ||
172 | volatile unsigned long TextureAddrThresh; /* 0x0BFC */ | 172 | volatile u32 TextureAddrThresh; /* 0x0BFC */ |
173 | volatile unsigned long Core1Translation; /* 0x0C00 */ | 173 | volatile u32 Core1Translation; /* 0x0C00 */ |
174 | volatile unsigned long TextureAddrReMap; /* 0x0C04 */ | 174 | volatile u32 TextureAddrReMap; /* 0x0C04 */ |
175 | volatile unsigned long RenderOutAGPRemap; /* 0x0C08 */ | 175 | volatile u32 RenderOutAGPRemap; /* 0x0C08 */ |
176 | volatile unsigned long _3DRegionReadTrans; /* 0x0C0C */ | 176 | volatile u32 _3DRegionReadTrans; /* 0x0C0C */ |
177 | volatile unsigned long _3DPtrReadTrans; /* 0x0C10 */ | 177 | volatile u32 _3DPtrReadTrans; /* 0x0C10 */ |
178 | volatile unsigned long _3DParamReadTrans; /* 0x0C14 */ | 178 | volatile u32 _3DParamReadTrans; /* 0x0C14 */ |
179 | volatile unsigned long _3DRegionReadThresh; /* 0x0C18 */ | 179 | volatile u32 _3DRegionReadThresh; /* 0x0C18 */ |
180 | volatile unsigned long _3DPtrReadThresh; /* 0x0C1C */ | 180 | volatile u32 _3DPtrReadThresh; /* 0x0C1C */ |
181 | volatile unsigned long _3DParamReadThresh; /* 0x0C20 */ | 181 | volatile u32 _3DParamReadThresh; /* 0x0C20 */ |
182 | volatile unsigned long _3DRegionReadAGPRemap; /* 0x0C24 */ | 182 | volatile u32 _3DRegionReadAGPRemap; /* 0x0C24 */ |
183 | volatile unsigned long _3DPtrReadAGPRemap; /* 0x0C28 */ | 183 | volatile u32 _3DPtrReadAGPRemap; /* 0x0C28 */ |
184 | volatile unsigned long _3DParamReadAGPRemap; /* 0x0C2C */ | 184 | volatile u32 _3DParamReadAGPRemap; /* 0x0C2C */ |
185 | volatile unsigned long ZBufferAGPRemap; /* 0x0C30 */ | 185 | volatile u32 ZBufferAGPRemap; /* 0x0C30 */ |
186 | volatile unsigned long TAIndexAGPRemap; /* 0x0C34 */ | 186 | volatile u32 TAIndexAGPRemap; /* 0x0C34 */ |
187 | volatile unsigned long TAVertexAGPRemap; /* 0x0C38 */ | 187 | volatile u32 TAVertexAGPRemap; /* 0x0C38 */ |
188 | volatile unsigned long TAUVAddrTrans; /* 0x0C3C */ | 188 | volatile u32 TAUVAddrTrans; /* 0x0C3C */ |
189 | volatile unsigned long TATailPtrCacheTrans; /* 0x0C40 */ | 189 | volatile u32 TATailPtrCacheTrans; /* 0x0C40 */ |
190 | volatile unsigned long TAParamWriteTrans; /* 0x0C44 */ | 190 | volatile u32 TAParamWriteTrans; /* 0x0C44 */ |
191 | volatile unsigned long TAPtrWriteTrans; /* 0x0C48 */ | 191 | volatile u32 TAPtrWriteTrans; /* 0x0C48 */ |
192 | volatile unsigned long TAParamWriteThresh; /* 0x0C4C */ | 192 | volatile u32 TAParamWriteThresh; /* 0x0C4C */ |
193 | volatile unsigned long TAPtrWriteThresh; /* 0x0C50 */ | 193 | volatile u32 TAPtrWriteThresh; /* 0x0C50 */ |
194 | volatile unsigned long TATailPtrCacheAGPRe; /* 0x0C54 */ | 194 | volatile u32 TATailPtrCacheAGPRe; /* 0x0C54 */ |
195 | volatile unsigned long TAParamWriteAGPRe; /* 0x0C58 */ | 195 | volatile u32 TAParamWriteAGPRe; /* 0x0C58 */ |
196 | volatile unsigned long TAPtrWriteAGPRe; /* 0x0C5C */ | 196 | volatile u32 TAPtrWriteAGPRe; /* 0x0C5C */ |
197 | volatile unsigned long SDRAMArbiterConf; /* 0x0C60 */ | 197 | volatile u32 SDRAMArbiterConf; /* 0x0C60 */ |
198 | volatile unsigned long SDRAMConf0; /* 0x0C64 */ | 198 | volatile u32 SDRAMConf0; /* 0x0C64 */ |
199 | volatile unsigned long SDRAMConf1; /* 0x0C68 */ | 199 | volatile u32 SDRAMConf1; /* 0x0C68 */ |
200 | volatile unsigned long SDRAMConf2; /* 0x0C6C */ | 200 | volatile u32 SDRAMConf2; /* 0x0C6C */ |
201 | volatile unsigned long SDRAMRefresh; /* 0x0C70 */ | 201 | volatile u32 SDRAMRefresh; /* 0x0C70 */ |
202 | volatile unsigned long SDRAMPowerStat; /* 0x0C74 */ | 202 | volatile u32 SDRAMPowerStat; /* 0x0C74 */ |
203 | 203 | ||
204 | volatile unsigned long Fill6[2]; /* GAP 0x0C78 - 0x0C7C */ | 204 | volatile u32 Fill6[2]; /* GAP 0x0C78 - 0x0C7C */ |
205 | 205 | ||
206 | volatile unsigned long RAMBistData; /* 0x0C80 */ | 206 | volatile u32 RAMBistData; /* 0x0C80 */ |
207 | volatile unsigned long RAMBistCtrl; /* 0x0C84 */ | 207 | volatile u32 RAMBistCtrl; /* 0x0C84 */ |
208 | volatile unsigned long FIFOBistKey; /* 0x0C88 */ | 208 | volatile u32 FIFOBistKey; /* 0x0C88 */ |
209 | volatile unsigned long RAMBistResult; /* 0x0C8C */ | 209 | volatile u32 RAMBistResult; /* 0x0C8C */ |
210 | volatile unsigned long FIFOBistResult; /* 0x0C90 */ | 210 | volatile u32 FIFOBistResult; /* 0x0C90 */ |
211 | 211 | ||
212 | /* | 212 | /* |
213 | volatile unsigned long Fill11[0x0CBC/4 - 0x0C94/4]; //GAP 0x0C94 - 0x0CBC | 213 | volatile u32 Fill11[0x0CBC/4 - 0x0C94/4]; //GAP 0x0C94 - 0x0CBC |
214 | volatile unsigned long Fill12[0x0CD0/4 - 0x0CC0/4]; //GAP 0x0CC0 - 0x0CD0 3DRegisters | 214 | volatile u32 Fill12[0x0CD0/4 - 0x0CC0/4]; //GAP 0x0CC0 - 0x0CD0 3DRegisters |
215 | */ | 215 | */ |
216 | 216 | ||
217 | volatile unsigned long Fill7[16]; /* 0x0c94 - 0x0cd0 */ | 217 | volatile u32 Fill7[16]; /* 0x0c94 - 0x0cd0 */ |
218 | 218 | ||
219 | volatile unsigned long SDRAMAddrSign; /* 0x0CD4 */ | 219 | volatile u32 SDRAMAddrSign; /* 0x0CD4 */ |
220 | volatile unsigned long SDRAMDataSign; /* 0x0CD8 */ | 220 | volatile u32 SDRAMDataSign; /* 0x0CD8 */ |
221 | volatile unsigned long SDRAMSignConf; /* 0x0CDC */ | 221 | volatile u32 SDRAMSignConf; /* 0x0CDC */ |
222 | 222 | ||
223 | /* DWFILL; //GAP 0x0CE0 */ | 223 | /* DWFILL; //GAP 0x0CE0 */ |
224 | volatile unsigned long dwFill_2; | 224 | volatile u32 dwFill_2; |
225 | 225 | ||
226 | volatile unsigned long ISPSignature; /* 0x0CE4 */ | 226 | volatile u32 ISPSignature; /* 0x0CE4 */ |
227 | 227 | ||
228 | volatile unsigned long Fill8[454]; /*GAP 0x0CE8 - 0x13FC */ | 228 | volatile u32 Fill8[454]; /*GAP 0x0CE8 - 0x13FC */ |
229 | 229 | ||
230 | volatile unsigned long DACPrimAddress; /* 0x1400 */ | 230 | volatile u32 DACPrimAddress; /* 0x1400 */ |
231 | volatile unsigned long DACPrimSize; /* 0x1404 */ | 231 | volatile u32 DACPrimSize; /* 0x1404 */ |
232 | volatile unsigned long DACCursorAddr; /* 0x1408 */ | 232 | volatile u32 DACCursorAddr; /* 0x1408 */ |
233 | volatile unsigned long DACCursorCtrl; /* 0x140C */ | 233 | volatile u32 DACCursorCtrl; /* 0x140C */ |
234 | volatile unsigned long DACOverlayAddr; /* 0x1410 */ | 234 | volatile u32 DACOverlayAddr; /* 0x1410 */ |
235 | volatile unsigned long DACOverlayUAddr; /* 0x1414 */ | 235 | volatile u32 DACOverlayUAddr; /* 0x1414 */ |
236 | volatile unsigned long DACOverlayVAddr; /* 0x1418 */ | 236 | volatile u32 DACOverlayVAddr; /* 0x1418 */ |
237 | volatile unsigned long DACOverlaySize; /* 0x141C */ | 237 | volatile u32 DACOverlaySize; /* 0x141C */ |
238 | volatile unsigned long DACOverlayVtDec; /* 0x1420 */ | 238 | volatile u32 DACOverlayVtDec; /* 0x1420 */ |
239 | 239 | ||
240 | volatile unsigned long Fill9[9]; /* GAP 0x1424 - 0x1444 */ | 240 | volatile u32 Fill9[9]; /* GAP 0x1424 - 0x1444 */ |
241 | 241 | ||
242 | volatile unsigned long DACVerticalScal; /* 0x1448 */ | 242 | volatile u32 DACVerticalScal; /* 0x1448 */ |
243 | volatile unsigned long DACPixelFormat; /* 0x144C */ | 243 | volatile u32 DACPixelFormat; /* 0x144C */ |
244 | volatile unsigned long DACHorizontalScal; /* 0x1450 */ | 244 | volatile u32 DACHorizontalScal; /* 0x1450 */ |
245 | volatile unsigned long DACVidWinStart; /* 0x1454 */ | 245 | volatile u32 DACVidWinStart; /* 0x1454 */ |
246 | volatile unsigned long DACVidWinEnd; /* 0x1458 */ | 246 | volatile u32 DACVidWinEnd; /* 0x1458 */ |
247 | volatile unsigned long DACBlendCtrl; /* 0x145C */ | 247 | volatile u32 DACBlendCtrl; /* 0x145C */ |
248 | volatile unsigned long DACHorTim1; /* 0x1460 */ | 248 | volatile u32 DACHorTim1; /* 0x1460 */ |
249 | volatile unsigned long DACHorTim2; /* 0x1464 */ | 249 | volatile u32 DACHorTim2; /* 0x1464 */ |
250 | volatile unsigned long DACHorTim3; /* 0x1468 */ | 250 | volatile u32 DACHorTim3; /* 0x1468 */ |
251 | volatile unsigned long DACVerTim1; /* 0x146C */ | 251 | volatile u32 DACVerTim1; /* 0x146C */ |
252 | volatile unsigned long DACVerTim2; /* 0x1470 */ | 252 | volatile u32 DACVerTim2; /* 0x1470 */ |
253 | volatile unsigned long DACVerTim3; /* 0x1474 */ | 253 | volatile u32 DACVerTim3; /* 0x1474 */ |
254 | volatile unsigned long DACBorderColor; /* 0x1478 */ | 254 | volatile u32 DACBorderColor; /* 0x1478 */ |
255 | volatile unsigned long DACSyncCtrl; /* 0x147C */ | 255 | volatile u32 DACSyncCtrl; /* 0x147C */ |
256 | volatile unsigned long DACStreamCtrl; /* 0x1480 */ | 256 | volatile u32 DACStreamCtrl; /* 0x1480 */ |
257 | volatile unsigned long DACLUTAddress; /* 0x1484 */ | 257 | volatile u32 DACLUTAddress; /* 0x1484 */ |
258 | volatile unsigned long DACLUTData; /* 0x1488 */ | 258 | volatile u32 DACLUTData; /* 0x1488 */ |
259 | volatile unsigned long DACBurstCtrl; /* 0x148C */ | 259 | volatile u32 DACBurstCtrl; /* 0x148C */ |
260 | volatile unsigned long DACCrcTrigger; /* 0x1490 */ | 260 | volatile u32 DACCrcTrigger; /* 0x1490 */ |
261 | volatile unsigned long DACCrcDone; /* 0x1494 */ | 261 | volatile u32 DACCrcDone; /* 0x1494 */ |
262 | volatile unsigned long DACCrcResult1; /* 0x1498 */ | 262 | volatile u32 DACCrcResult1; /* 0x1498 */ |
263 | volatile unsigned long DACCrcResult2; /* 0x149C */ | 263 | volatile u32 DACCrcResult2; /* 0x149C */ |
264 | volatile unsigned long DACLinecount; /* 0x14A0 */ | 264 | volatile u32 DACLinecount; /* 0x14A0 */ |
265 | 265 | ||
266 | volatile unsigned long Fill10[151]; /*GAP 0x14A4 - 0x16FC */ | 266 | volatile u32 Fill10[151]; /*GAP 0x14A4 - 0x16FC */ |
267 | 267 | ||
268 | volatile unsigned long DigVidPortCtrl; /* 0x1700 */ | 268 | volatile u32 DigVidPortCtrl; /* 0x1700 */ |
269 | volatile unsigned long DigVidPortStat; /* 0x1704 */ | 269 | volatile u32 DigVidPortStat; /* 0x1704 */ |
270 | 270 | ||
271 | /* | 271 | /* |
272 | volatile unsigned long Fill11[0x1FFC/4 - 0x1708/4]; //GAP 0x1708 - 0x1FFC | 272 | volatile u32 Fill11[0x1FFC/4 - 0x1708/4]; //GAP 0x1708 - 0x1FFC |
273 | volatile unsigned long Fill17[0x3000/4 - 0x2FFC/4]; //GAP 0x2000 - 0x2FFC ALUT | 273 | volatile u32 Fill17[0x3000/4 - 0x2FFC/4]; //GAP 0x2000 - 0x2FFC ALUT |
274 | */ | 274 | */ |
275 | 275 | ||
276 | volatile unsigned long Fill11[1598]; | 276 | volatile u32 Fill11[1598]; |
277 | 277 | ||
278 | /* DWFILL; //GAP 0x3000 ALUT 256MB offset */ | 278 | /* DWFILL; //GAP 0x3000 ALUT 256MB offset */ |
279 | volatile unsigned long Fill_3; | 279 | volatile u32 Fill_3; |
280 | 280 | ||
281 | } STG4000REG; | 281 | } STG4000REG; |
282 | 282 | ||
diff --git a/drivers/video/msm/mddi.c b/drivers/video/msm/mddi.c index 4527cbf0a4ec..b061d709bc44 100644 --- a/drivers/video/msm/mddi.c +++ b/drivers/video/msm/mddi.c | |||
@@ -420,7 +420,7 @@ static void mddi_resume(struct msm_mddi_client_data *cdata) | |||
420 | mddi_set_auto_hibernate(&mddi->client_data, 1); | 420 | mddi_set_auto_hibernate(&mddi->client_data, 1); |
421 | } | 421 | } |
422 | 422 | ||
423 | static int __init mddi_get_client_caps(struct mddi_info *mddi) | 423 | static int __devinit mddi_get_client_caps(struct mddi_info *mddi) |
424 | { | 424 | { |
425 | int i, j; | 425 | int i, j; |
426 | 426 | ||
@@ -622,9 +622,9 @@ uint32_t mddi_remote_read(struct msm_mddi_client_data *cdata, uint32_t reg) | |||
622 | 622 | ||
623 | static struct mddi_info mddi_info[2]; | 623 | static struct mddi_info mddi_info[2]; |
624 | 624 | ||
625 | static int __init mddi_clk_setup(struct platform_device *pdev, | 625 | static int __devinit mddi_clk_setup(struct platform_device *pdev, |
626 | struct mddi_info *mddi, | 626 | struct mddi_info *mddi, |
627 | unsigned long clk_rate) | 627 | unsigned long clk_rate) |
628 | { | 628 | { |
629 | int ret; | 629 | int ret; |
630 | 630 | ||
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c index 260cca7ddb41..26e83d7fdd6f 100644 --- a/drivers/video/uvesafb.c +++ b/drivers/video/uvesafb.c | |||
@@ -815,8 +815,15 @@ static int __devinit uvesafb_vbe_init(struct fb_info *info) | |||
815 | par->pmi_setpal = pmi_setpal; | 815 | par->pmi_setpal = pmi_setpal; |
816 | par->ypan = ypan; | 816 | par->ypan = ypan; |
817 | 817 | ||
818 | if (par->pmi_setpal || par->ypan) | 818 | if (par->pmi_setpal || par->ypan) { |
819 | uvesafb_vbe_getpmi(task, par); | 819 | if (__supported_pte_mask & _PAGE_NX) { |
820 | par->pmi_setpal = par->ypan = 0; | ||
821 | printk(KERN_WARNING "uvesafb: NX protection is actively." | ||
822 | "We have better not to use the PMI.\n"); | ||
823 | } else { | ||
824 | uvesafb_vbe_getpmi(task, par); | ||
825 | } | ||
826 | } | ||
820 | #else | 827 | #else |
821 | /* The protected mode interface is not available on non-x86. */ | 828 | /* The protected mode interface is not available on non-x86. */ |
822 | par->pmi_setpal = par->ypan = 0; | 829 | par->pmi_setpal = par->ypan = 0; |
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 05f0a80818a2..c2d05a8279fd 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -28,6 +28,13 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | 30 | ||
31 | /* | ||
32 | * Balloon device works in 4K page units. So each page is pointed to by | ||
33 | * multiple balloon pages. All memory counters in this driver are in balloon | ||
34 | * page units. | ||
35 | */ | ||
36 | #define VIRTIO_BALLOON_PAGES_PER_PAGE (PAGE_SIZE >> VIRTIO_BALLOON_PFN_SHIFT) | ||
37 | |||
31 | struct virtio_balloon | 38 | struct virtio_balloon |
32 | { | 39 | { |
33 | struct virtio_device *vdev; | 40 | struct virtio_device *vdev; |
@@ -42,8 +49,13 @@ struct virtio_balloon | |||
42 | /* Waiting for host to ack the pages we released. */ | 49 | /* Waiting for host to ack the pages we released. */ |
43 | struct completion acked; | 50 | struct completion acked; |
44 | 51 | ||
45 | /* The pages we've told the Host we're not using. */ | 52 | /* Number of balloon pages we've told the Host we're not using. */ |
46 | unsigned int num_pages; | 53 | unsigned int num_pages; |
54 | /* | ||
55 | * The pages we've told the Host we're not using. | ||
56 | * Each page on this list adds VIRTIO_BALLOON_PAGES_PER_PAGE | ||
57 | * to num_pages above. | ||
58 | */ | ||
47 | struct list_head pages; | 59 | struct list_head pages; |
48 | 60 | ||
49 | /* The array of pfns we tell the Host about. */ | 61 | /* The array of pfns we tell the Host about. */ |
@@ -66,7 +78,13 @@ static u32 page_to_balloon_pfn(struct page *page) | |||
66 | 78 | ||
67 | BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT); | 79 | BUILD_BUG_ON(PAGE_SHIFT < VIRTIO_BALLOON_PFN_SHIFT); |
68 | /* Convert pfn from Linux page size to balloon page size. */ | 80 | /* Convert pfn from Linux page size to balloon page size. */ |
69 | return pfn >> (PAGE_SHIFT - VIRTIO_BALLOON_PFN_SHIFT); | 81 | return pfn * VIRTIO_BALLOON_PAGES_PER_PAGE; |
82 | } | ||
83 | |||
84 | static struct page *balloon_pfn_to_page(u32 pfn) | ||
85 | { | ||
86 | BUG_ON(pfn % VIRTIO_BALLOON_PAGES_PER_PAGE); | ||
87 | return pfn_to_page(pfn / VIRTIO_BALLOON_PAGES_PER_PAGE); | ||
70 | } | 88 | } |
71 | 89 | ||
72 | static void balloon_ack(struct virtqueue *vq) | 90 | static void balloon_ack(struct virtqueue *vq) |
@@ -96,12 +114,23 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) | |||
96 | wait_for_completion(&vb->acked); | 114 | wait_for_completion(&vb->acked); |
97 | } | 115 | } |
98 | 116 | ||
117 | static void set_page_pfns(u32 pfns[], struct page *page) | ||
118 | { | ||
119 | unsigned int i; | ||
120 | |||
121 | /* Set balloon pfns pointing at this page. | ||
122 | * Note that the first pfn points at start of the page. */ | ||
123 | for (i = 0; i < VIRTIO_BALLOON_PAGES_PER_PAGE; i++) | ||
124 | pfns[i] = page_to_balloon_pfn(page) + i; | ||
125 | } | ||
126 | |||
99 | static void fill_balloon(struct virtio_balloon *vb, size_t num) | 127 | static void fill_balloon(struct virtio_balloon *vb, size_t num) |
100 | { | 128 | { |
101 | /* We can only do one array worth at a time. */ | 129 | /* We can only do one array worth at a time. */ |
102 | num = min(num, ARRAY_SIZE(vb->pfns)); | 130 | num = min(num, ARRAY_SIZE(vb->pfns)); |
103 | 131 | ||
104 | for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { | 132 | for (vb->num_pfns = 0; vb->num_pfns < num; |
133 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { | ||
105 | struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | | 134 | struct page *page = alloc_page(GFP_HIGHUSER | __GFP_NORETRY | |
106 | __GFP_NOMEMALLOC | __GFP_NOWARN); | 135 | __GFP_NOMEMALLOC | __GFP_NOWARN); |
107 | if (!page) { | 136 | if (!page) { |
@@ -113,9 +142,9 @@ static void fill_balloon(struct virtio_balloon *vb, size_t num) | |||
113 | msleep(200); | 142 | msleep(200); |
114 | break; | 143 | break; |
115 | } | 144 | } |
116 | vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); | 145 | set_page_pfns(vb->pfns + vb->num_pfns, page); |
146 | vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE; | ||
117 | totalram_pages--; | 147 | totalram_pages--; |
118 | vb->num_pages++; | ||
119 | list_add(&page->lru, &vb->pages); | 148 | list_add(&page->lru, &vb->pages); |
120 | } | 149 | } |
121 | 150 | ||
@@ -130,8 +159,9 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num) | |||
130 | { | 159 | { |
131 | unsigned int i; | 160 | unsigned int i; |
132 | 161 | ||
133 | for (i = 0; i < num; i++) { | 162 | /* Find pfns pointing at start of each page, get pages and free them. */ |
134 | __free_page(pfn_to_page(pfns[i])); | 163 | for (i = 0; i < num; i += VIRTIO_BALLOON_PAGES_PER_PAGE) { |
164 | __free_page(balloon_pfn_to_page(pfns[i])); | ||
135 | totalram_pages++; | 165 | totalram_pages++; |
136 | } | 166 | } |
137 | } | 167 | } |
@@ -143,11 +173,12 @@ static void leak_balloon(struct virtio_balloon *vb, size_t num) | |||
143 | /* We can only do one array worth at a time. */ | 173 | /* We can only do one array worth at a time. */ |
144 | num = min(num, ARRAY_SIZE(vb->pfns)); | 174 | num = min(num, ARRAY_SIZE(vb->pfns)); |
145 | 175 | ||
146 | for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) { | 176 | for (vb->num_pfns = 0; vb->num_pfns < num; |
177 | vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE) { | ||
147 | page = list_first_entry(&vb->pages, struct page, lru); | 178 | page = list_first_entry(&vb->pages, struct page, lru); |
148 | list_del(&page->lru); | 179 | list_del(&page->lru); |
149 | vb->pfns[vb->num_pfns] = page_to_balloon_pfn(page); | 180 | set_page_pfns(vb->pfns + vb->num_pfns, page); |
150 | vb->num_pages--; | 181 | vb->num_pages -= VIRTIO_BALLOON_PAGES_PER_PAGE; |
151 | } | 182 | } |
152 | 183 | ||
153 | /* | 184 | /* |
@@ -234,11 +265,14 @@ static void virtballoon_changed(struct virtio_device *vdev) | |||
234 | 265 | ||
235 | static inline s64 towards_target(struct virtio_balloon *vb) | 266 | static inline s64 towards_target(struct virtio_balloon *vb) |
236 | { | 267 | { |
237 | u32 v; | 268 | __le32 v; |
269 | s64 target; | ||
270 | |||
238 | vb->vdev->config->get(vb->vdev, | 271 | vb->vdev->config->get(vb->vdev, |
239 | offsetof(struct virtio_balloon_config, num_pages), | 272 | offsetof(struct virtio_balloon_config, num_pages), |
240 | &v, sizeof(v)); | 273 | &v, sizeof(v)); |
241 | return (s64)v - vb->num_pages; | 274 | target = le32_to_cpu(v); |
275 | return target - vb->num_pages; | ||
242 | } | 276 | } |
243 | 277 | ||
244 | static void update_balloon_size(struct virtio_balloon *vb) | 278 | static void update_balloon_size(struct virtio_balloon *vb) |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index cbc7ceef2786..9f13b897fd64 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -435,16 +435,16 @@ static void hpwdt_start(void) | |||
435 | { | 435 | { |
436 | reload = SECS_TO_TICKS(soft_margin); | 436 | reload = SECS_TO_TICKS(soft_margin); |
437 | iowrite16(reload, hpwdt_timer_reg); | 437 | iowrite16(reload, hpwdt_timer_reg); |
438 | iowrite16(0x85, hpwdt_timer_con); | 438 | iowrite8(0x85, hpwdt_timer_con); |
439 | } | 439 | } |
440 | 440 | ||
441 | static void hpwdt_stop(void) | 441 | static void hpwdt_stop(void) |
442 | { | 442 | { |
443 | unsigned long data; | 443 | unsigned long data; |
444 | 444 | ||
445 | data = ioread16(hpwdt_timer_con); | 445 | data = ioread8(hpwdt_timer_con); |
446 | data &= 0xFE; | 446 | data &= 0xFE; |
447 | iowrite16(data, hpwdt_timer_con); | 447 | iowrite8(data, hpwdt_timer_con); |
448 | } | 448 | } |
449 | 449 | ||
450 | static void hpwdt_ping(void) | 450 | static void hpwdt_ping(void) |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 4b33acd8ed4e..0a8a17cd80be 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -274,7 +274,7 @@ static unsigned int cpu_from_evtchn(unsigned int evtchn) | |||
274 | 274 | ||
275 | static bool pirq_check_eoi_map(unsigned irq) | 275 | static bool pirq_check_eoi_map(unsigned irq) |
276 | { | 276 | { |
277 | return test_bit(irq, pirq_eoi_map); | 277 | return test_bit(pirq_from_irq(irq), pirq_eoi_map); |
278 | } | 278 | } |
279 | 279 | ||
280 | static bool pirq_needs_eoi_flag(unsigned irq) | 280 | static bool pirq_needs_eoi_flag(unsigned irq) |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 99d8151c824a..1ffd03bf8e10 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -722,7 +722,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma) | |||
722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; | 722 | vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND; |
723 | 723 | ||
724 | if (use_ptemod) | 724 | if (use_ptemod) |
725 | vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP; | 725 | vma->vm_flags |= VM_DONTCOPY; |
726 | 726 | ||
727 | vma->vm_private_data = map; | 727 | vma->vm_private_data = map; |
728 | 728 | ||
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index b4d4eac761db..f100ce20b16b 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c | |||
@@ -1029,6 +1029,7 @@ int gnttab_init(void) | |||
1029 | int i; | 1029 | int i; |
1030 | unsigned int max_nr_glist_frames, nr_glist_frames; | 1030 | unsigned int max_nr_glist_frames, nr_glist_frames; |
1031 | unsigned int nr_init_grefs; | 1031 | unsigned int nr_init_grefs; |
1032 | int ret; | ||
1032 | 1033 | ||
1033 | nr_grant_frames = 1; | 1034 | nr_grant_frames = 1; |
1034 | boot_max_nr_grant_frames = __max_nr_grant_frames(); | 1035 | boot_max_nr_grant_frames = __max_nr_grant_frames(); |
@@ -1047,12 +1048,16 @@ int gnttab_init(void) | |||
1047 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | 1048 | nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; |
1048 | for (i = 0; i < nr_glist_frames; i++) { | 1049 | for (i = 0; i < nr_glist_frames; i++) { |
1049 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); | 1050 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); |
1050 | if (gnttab_list[i] == NULL) | 1051 | if (gnttab_list[i] == NULL) { |
1052 | ret = -ENOMEM; | ||
1051 | goto ini_nomem; | 1053 | goto ini_nomem; |
1054 | } | ||
1052 | } | 1055 | } |
1053 | 1056 | ||
1054 | if (gnttab_resume() < 0) | 1057 | if (gnttab_resume() < 0) { |
1055 | return -ENODEV; | 1058 | ret = -ENODEV; |
1059 | goto ini_nomem; | ||
1060 | } | ||
1056 | 1061 | ||
1057 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; | 1062 | nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; |
1058 | 1063 | ||
@@ -1070,7 +1075,7 @@ int gnttab_init(void) | |||
1070 | for (i--; i >= 0; i--) | 1075 | for (i--; i >= 0; i--) |
1071 | free_page((unsigned long)gnttab_list[i]); | 1076 | free_page((unsigned long)gnttab_list[i]); |
1072 | kfree(gnttab_list); | 1077 | kfree(gnttab_list); |
1073 | return -ENOMEM; | 1078 | return ret; |
1074 | } | 1079 | } |
1075 | EXPORT_SYMBOL_GPL(gnttab_init); | 1080 | EXPORT_SYMBOL_GPL(gnttab_init); |
1076 | 1081 | ||
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 9e14ae6cd49c..412b96cc5305 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -132,6 +132,7 @@ static void do_suspend(void) | |||
132 | err = dpm_suspend_end(PMSG_FREEZE); | 132 | err = dpm_suspend_end(PMSG_FREEZE); |
133 | if (err) { | 133 | if (err) { |
134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); | 134 | printk(KERN_ERR "dpm_suspend_end failed: %d\n", err); |
135 | si.cancelled = 0; | ||
135 | goto out_resume; | 136 | goto out_resume; |
136 | } | 137 | } |
137 | 138 | ||
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 19e6a2041371..1afb4fba11b4 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c | |||
@@ -204,7 +204,8 @@ error: | |||
204 | 204 | ||
205 | void * | 205 | void * |
206 | xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 206 | xen_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
207 | dma_addr_t *dma_handle, gfp_t flags) | 207 | dma_addr_t *dma_handle, gfp_t flags, |
208 | struct dma_attrs *attrs) | ||
208 | { | 209 | { |
209 | void *ret; | 210 | void *ret; |
210 | int order = get_order(size); | 211 | int order = get_order(size); |
@@ -253,7 +254,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_alloc_coherent); | |||
253 | 254 | ||
254 | void | 255 | void |
255 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, | 256 | xen_swiotlb_free_coherent(struct device *hwdev, size_t size, void *vaddr, |
256 | dma_addr_t dev_addr) | 257 | dma_addr_t dev_addr, struct dma_attrs *attrs) |
257 | { | 258 | { |
258 | int order = get_order(size); | 259 | int order = get_order(size); |
259 | phys_addr_t phys; | 260 | phys_addr_t phys; |
diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c index 174b5653cd8a..0b48579a9cd6 100644 --- a/drivers/xen/xen-acpi-processor.c +++ b/drivers/xen/xen-acpi-processor.c | |||
@@ -128,7 +128,10 @@ static int push_cxx_to_hypervisor(struct acpi_processor *_pr) | |||
128 | pr_debug(" C%d: %s %d uS\n", | 128 | pr_debug(" C%d: %s %d uS\n", |
129 | cx->type, cx->desc, (u32)cx->latency); | 129 | cx->type, cx->desc, (u32)cx->latency); |
130 | } | 130 | } |
131 | } else | 131 | } else if (ret != -EINVAL) |
132 | /* EINVAL means the ACPI ID is incorrect - meaning the ACPI | ||
133 | * table is referencing a non-existing CPU - which can happen | ||
134 | * with broken ACPI tables. */ | ||
132 | pr_err(DRV_NAME "(CX): Hypervisor error (%d) for ACPI CPU%u\n", | 135 | pr_err(DRV_NAME "(CX): Hypervisor error (%d) for ACPI CPU%u\n", |
133 | ret, _pr->acpi_id); | 136 | ret, _pr->acpi_id); |
134 | 137 | ||
diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c index 63616d7453e6..97f5d264c31e 100644 --- a/drivers/xen/xen-pciback/pciback_ops.c +++ b/drivers/xen/xen-pciback/pciback_ops.c | |||
@@ -234,7 +234,7 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev, | |||
234 | if (dev_data) | 234 | if (dev_data) |
235 | dev_data->ack_intr = 0; | 235 | dev_data->ack_intr = 0; |
236 | 236 | ||
237 | return result; | 237 | return result > 0 ? 0 : result; |
238 | } | 238 | } |
239 | 239 | ||
240 | static | 240 | static |
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c index f20c5f178b40..a31b54d48839 100644 --- a/drivers/xen/xenbus/xenbus_probe_frontend.c +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c | |||
@@ -135,7 +135,7 @@ static int read_backend_details(struct xenbus_device *xendev) | |||
135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); | 135 | return xenbus_read_otherend_details(xendev, "backend-id", "backend"); |
136 | } | 136 | } |
137 | 137 | ||
138 | static int is_device_connecting(struct device *dev, void *data) | 138 | static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential) |
139 | { | 139 | { |
140 | struct xenbus_device *xendev = to_xenbus_device(dev); | 140 | struct xenbus_device *xendev = to_xenbus_device(dev); |
141 | struct device_driver *drv = data; | 141 | struct device_driver *drv = data; |
@@ -152,16 +152,41 @@ static int is_device_connecting(struct device *dev, void *data) | |||
152 | if (drv && (dev->driver != drv)) | 152 | if (drv && (dev->driver != drv)) |
153 | return 0; | 153 | return 0; |
154 | 154 | ||
155 | if (ignore_nonessential) { | ||
156 | /* With older QEMU, for PVonHVM guests the guest config files | ||
157 | * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0'] | ||
158 | * which is nonsensical as there is no PV FB (there can be | ||
159 | * a PVKB) running as HVM guest. */ | ||
160 | |||
161 | if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0)) | ||
162 | return 0; | ||
163 | |||
164 | if ((strncmp(xendev->nodename, "device/vfb", 10) == 0)) | ||
165 | return 0; | ||
166 | } | ||
155 | xendrv = to_xenbus_driver(dev->driver); | 167 | xendrv = to_xenbus_driver(dev->driver); |
156 | return (xendev->state < XenbusStateConnected || | 168 | return (xendev->state < XenbusStateConnected || |
157 | (xendev->state == XenbusStateConnected && | 169 | (xendev->state == XenbusStateConnected && |
158 | xendrv->is_ready && !xendrv->is_ready(xendev))); | 170 | xendrv->is_ready && !xendrv->is_ready(xendev))); |
159 | } | 171 | } |
172 | static int essential_device_connecting(struct device *dev, void *data) | ||
173 | { | ||
174 | return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */); | ||
175 | } | ||
176 | static int non_essential_device_connecting(struct device *dev, void *data) | ||
177 | { | ||
178 | return is_device_connecting(dev, data, false); | ||
179 | } | ||
160 | 180 | ||
161 | static int exists_connecting_device(struct device_driver *drv) | 181 | static int exists_essential_connecting_device(struct device_driver *drv) |
162 | { | 182 | { |
163 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | 183 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, |
164 | is_device_connecting); | 184 | essential_device_connecting); |
185 | } | ||
186 | static int exists_non_essential_connecting_device(struct device_driver *drv) | ||
187 | { | ||
188 | return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv, | ||
189 | non_essential_device_connecting); | ||
165 | } | 190 | } |
166 | 191 | ||
167 | static int print_device_status(struct device *dev, void *data) | 192 | static int print_device_status(struct device *dev, void *data) |
@@ -192,6 +217,23 @@ static int print_device_status(struct device *dev, void *data) | |||
192 | /* We only wait for device setup after most initcalls have run. */ | 217 | /* We only wait for device setup after most initcalls have run. */ |
193 | static int ready_to_wait_for_devices; | 218 | static int ready_to_wait_for_devices; |
194 | 219 | ||
220 | static bool wait_loop(unsigned long start, unsigned int max_delay, | ||
221 | unsigned int *seconds_waited) | ||
222 | { | ||
223 | if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) { | ||
224 | if (!*seconds_waited) | ||
225 | printk(KERN_WARNING "XENBUS: Waiting for " | ||
226 | "devices to initialise: "); | ||
227 | *seconds_waited += 5; | ||
228 | printk("%us...", max_delay - *seconds_waited); | ||
229 | if (*seconds_waited == max_delay) | ||
230 | return true; | ||
231 | } | ||
232 | |||
233 | schedule_timeout_interruptible(HZ/10); | ||
234 | |||
235 | return false; | ||
236 | } | ||
195 | /* | 237 | /* |
196 | * On a 5-minute timeout, wait for all devices currently configured. We need | 238 | * On a 5-minute timeout, wait for all devices currently configured. We need |
197 | * to do this to guarantee that the filesystems and / or network devices | 239 | * to do this to guarantee that the filesystems and / or network devices |
@@ -215,19 +257,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv) | |||
215 | if (!ready_to_wait_for_devices || !xen_domain()) | 257 | if (!ready_to_wait_for_devices || !xen_domain()) |
216 | return; | 258 | return; |
217 | 259 | ||
218 | while (exists_connecting_device(drv)) { | 260 | while (exists_non_essential_connecting_device(drv)) |
219 | if (time_after(jiffies, start + (seconds_waited+5)*HZ)) { | 261 | if (wait_loop(start, 30, &seconds_waited)) |
220 | if (!seconds_waited) | 262 | break; |
221 | printk(KERN_WARNING "XENBUS: Waiting for " | 263 | |
222 | "devices to initialise: "); | 264 | /* Skips PVKB and PVFB check.*/ |
223 | seconds_waited += 5; | 265 | while (exists_essential_connecting_device(drv)) |
224 | printk("%us...", 300 - seconds_waited); | 266 | if (wait_loop(start, 270, &seconds_waited)) |
225 | if (seconds_waited == 300) | 267 | break; |
226 | break; | ||
227 | } | ||
228 | |||
229 | schedule_timeout_interruptible(HZ/10); | ||
230 | } | ||
231 | 268 | ||
232 | if (seconds_waited) | 269 | if (seconds_waited) |
233 | printk("\n"); | 270 | printk("\n"); |