aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/ec.c22
-rw-r--r--drivers/acpi/internal.h5
-rw-r--r--drivers/acpi/processor_idle.c17
-rw-r--r--drivers/acpi/sleep.c57
-rw-r--r--drivers/char/Kconfig1
-rw-r--r--drivers/misc/vmware_balloon.c18
-rw-r--r--drivers/mmc/host/omap.c1
-rw-r--r--drivers/rtc/rtc-s3c.c9
-rw-r--r--drivers/sfi/sfi_core.c4
-rw-r--r--drivers/usb/class/cdc-acm.c6
-rw-r--r--drivers/usb/core/driver.c2
-rw-r--r--drivers/usb/gadget/Kconfig1
-rw-r--r--drivers/usb/gadget/f_audio.c4
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c57
-rw-r--r--drivers/usb/host/ehci-hcd.c20
-rw-r--r--drivers/usb/host/isp1362.h2
-rw-r--r--drivers/usb/host/xhci-pci.c2
-rw-r--r--drivers/usb/host/xhci-ring.c31
-rw-r--r--drivers/usb/host/xhci.c57
-rw-r--r--drivers/usb/host/xhci.h12
-rw-r--r--drivers/usb/serial/digi_acceleport.c3
-rw-r--r--drivers/usb/serial/ftdi_sio.c4
-rw-r--r--drivers/usb/serial/mos7840.c1
-rw-r--r--drivers/video/Kconfig6
-rw-r--r--drivers/video/fb_defio.c52
25 files changed, 283 insertions, 111 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index e61d4f8e62a5..5f2027d782e8 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -79,7 +79,7 @@ enum {
79 EC_FLAGS_GPE_STORM, /* GPE storm detected */ 79 EC_FLAGS_GPE_STORM, /* GPE storm detected */
80 EC_FLAGS_HANDLERS_INSTALLED, /* Handlers for GPE and 80 EC_FLAGS_HANDLERS_INSTALLED, /* Handlers for GPE and
81 * OpReg are installed */ 81 * OpReg are installed */
82 EC_FLAGS_FROZEN, /* Transactions are suspended */ 82 EC_FLAGS_BLOCKED, /* Transactions are blocked */
83}; 83};
84 84
85/* If we find an EC via the ECDT, we need to keep a ptr to its context */ 85/* If we find an EC via the ECDT, we need to keep a ptr to its context */
@@ -293,7 +293,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
293 if (t->rdata) 293 if (t->rdata)
294 memset(t->rdata, 0, t->rlen); 294 memset(t->rdata, 0, t->rlen);
295 mutex_lock(&ec->lock); 295 mutex_lock(&ec->lock);
296 if (test_bit(EC_FLAGS_FROZEN, &ec->flags)) { 296 if (test_bit(EC_FLAGS_BLOCKED, &ec->flags)) {
297 status = -EINVAL; 297 status = -EINVAL;
298 goto unlock; 298 goto unlock;
299 } 299 }
@@ -459,7 +459,7 @@ int ec_transaction(u8 command,
459 459
460EXPORT_SYMBOL(ec_transaction); 460EXPORT_SYMBOL(ec_transaction);
461 461
462void acpi_ec_suspend_transactions(void) 462void acpi_ec_block_transactions(void)
463{ 463{
464 struct acpi_ec *ec = first_ec; 464 struct acpi_ec *ec = first_ec;
465 465
@@ -468,11 +468,11 @@ void acpi_ec_suspend_transactions(void)
468 468
469 mutex_lock(&ec->lock); 469 mutex_lock(&ec->lock);
470 /* Prevent transactions from being carried out */ 470 /* Prevent transactions from being carried out */
471 set_bit(EC_FLAGS_FROZEN, &ec->flags); 471 set_bit(EC_FLAGS_BLOCKED, &ec->flags);
472 mutex_unlock(&ec->lock); 472 mutex_unlock(&ec->lock);
473} 473}
474 474
475void acpi_ec_resume_transactions(void) 475void acpi_ec_unblock_transactions(void)
476{ 476{
477 struct acpi_ec *ec = first_ec; 477 struct acpi_ec *ec = first_ec;
478 478
@@ -481,10 +481,20 @@ void acpi_ec_resume_transactions(void)
481 481
482 mutex_lock(&ec->lock); 482 mutex_lock(&ec->lock);
483 /* Allow transactions to be carried out again */ 483 /* Allow transactions to be carried out again */
484 clear_bit(EC_FLAGS_FROZEN, &ec->flags); 484 clear_bit(EC_FLAGS_BLOCKED, &ec->flags);
485 mutex_unlock(&ec->lock); 485 mutex_unlock(&ec->lock);
486} 486}
487 487
488void acpi_ec_unblock_transactions_early(void)
489{
490 /*
491 * Allow transactions to happen again (this function is called from
492 * atomic context during wakeup, so we don't need to acquire the mutex).
493 */
494 if (first_ec)
495 clear_bit(EC_FLAGS_BLOCKED, &first_ec->flags);
496}
497
488static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) 498static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data)
489{ 499{
490 int result; 500 int result;
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index e28411367239..f8f190ec066e 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -49,8 +49,9 @@ void acpi_early_processor_set_pdc(void);
49int acpi_ec_init(void); 49int acpi_ec_init(void);
50int acpi_ec_ecdt_probe(void); 50int acpi_ec_ecdt_probe(void);
51int acpi_boot_ec_enable(void); 51int acpi_boot_ec_enable(void);
52void acpi_ec_suspend_transactions(void); 52void acpi_ec_block_transactions(void);
53void acpi_ec_resume_transactions(void); 53void acpi_ec_unblock_transactions(void);
54void acpi_ec_unblock_transactions_early(void);
54 55
55/*-------------------------------------------------------------------------- 56/*--------------------------------------------------------------------------
56 Suspend/Resume 57 Suspend/Resume
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 2e8c27d48f2b..b1b385692f46 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -80,7 +80,7 @@ module_param(nocst, uint, 0000);
80static unsigned int latency_factor __read_mostly = 2; 80static unsigned int latency_factor __read_mostly = 2;
81module_param(latency_factor, uint, 0644); 81module_param(latency_factor, uint, 0644);
82 82
83static s64 us_to_pm_timer_ticks(s64 t) 83static u64 us_to_pm_timer_ticks(s64 t)
84{ 84{
85 return div64_u64(t * PM_TIMER_FREQUENCY, 1000000); 85 return div64_u64(t * PM_TIMER_FREQUENCY, 1000000);
86} 86}
@@ -731,10 +731,10 @@ static int acpi_processor_power_seq_show(struct seq_file *seq, void *offset)
731 731
732 seq_puts(seq, "demotion[--] "); 732 seq_puts(seq, "demotion[--] ");
733 733
734 seq_printf(seq, "latency[%03d] usage[%08d] duration[%020llu]\n", 734 seq_printf(seq, "latency[%03d] usage[%08d] duration[%020Lu]\n",
735 pr->power.states[i].latency, 735 pr->power.states[i].latency,
736 pr->power.states[i].usage, 736 pr->power.states[i].usage,
737 (unsigned long long)pr->power.states[i].time); 737 us_to_pm_timer_ticks(pr->power.states[i].time));
738 } 738 }
739 739
740 end: 740 end:
@@ -861,7 +861,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
861 ktime_t kt1, kt2; 861 ktime_t kt1, kt2;
862 s64 idle_time_ns; 862 s64 idle_time_ns;
863 s64 idle_time; 863 s64 idle_time;
864 s64 sleep_ticks = 0;
865 864
866 pr = __get_cpu_var(processors); 865 pr = __get_cpu_var(processors);
867 866
@@ -906,8 +905,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
906 idle_time = idle_time_ns; 905 idle_time = idle_time_ns;
907 do_div(idle_time, NSEC_PER_USEC); 906 do_div(idle_time, NSEC_PER_USEC);
908 907
909 sleep_ticks = us_to_pm_timer_ticks(idle_time);
910
911 /* Tell the scheduler how much we idled: */ 908 /* Tell the scheduler how much we idled: */
912 sched_clock_idle_wakeup_event(idle_time_ns); 909 sched_clock_idle_wakeup_event(idle_time_ns);
913 910
@@ -918,7 +915,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
918 cx->usage++; 915 cx->usage++;
919 916
920 lapic_timer_state_broadcast(pr, cx, 0); 917 lapic_timer_state_broadcast(pr, cx, 0);
921 cx->time += sleep_ticks; 918 cx->time += idle_time;
922 return idle_time; 919 return idle_time;
923} 920}
924 921
@@ -940,7 +937,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
940 ktime_t kt1, kt2; 937 ktime_t kt1, kt2;
941 s64 idle_time_ns; 938 s64 idle_time_ns;
942 s64 idle_time; 939 s64 idle_time;
943 s64 sleep_ticks = 0;
944 940
945 941
946 pr = __get_cpu_var(processors); 942 pr = __get_cpu_var(processors);
@@ -1022,11 +1018,10 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1022 spin_unlock(&c3_lock); 1018 spin_unlock(&c3_lock);
1023 } 1019 }
1024 kt2 = ktime_get_real(); 1020 kt2 = ktime_get_real();
1025 idle_time_ns = ktime_to_us(ktime_sub(kt2, kt1)); 1021 idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
1026 idle_time = idle_time_ns; 1022 idle_time = idle_time_ns;
1027 do_div(idle_time, NSEC_PER_USEC); 1023 do_div(idle_time, NSEC_PER_USEC);
1028 1024
1029 sleep_ticks = us_to_pm_timer_ticks(idle_time);
1030 /* Tell the scheduler how much we idled: */ 1025 /* Tell the scheduler how much we idled: */
1031 sched_clock_idle_wakeup_event(idle_time_ns); 1026 sched_clock_idle_wakeup_event(idle_time_ns);
1032 1027
@@ -1037,7 +1032,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
1037 cx->usage++; 1032 cx->usage++;
1038 1033
1039 lapic_timer_state_broadcast(pr, cx, 0); 1034 lapic_timer_state_broadcast(pr, cx, 0);
1040 cx->time += sleep_ticks; 1035 cx->time += idle_time;
1041 return idle_time; 1036 return idle_time;
1042} 1037}
1043 1038
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 4ab2275b4461..3fb4bdea7e06 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -94,11 +94,13 @@ void __init acpi_old_suspend_ordering(void)
94} 94}
95 95
96/** 96/**
97 * acpi_pm_disable_gpes - Disable the GPEs. 97 * acpi_pm_freeze - Disable the GPEs and suspend EC transactions.
98 */ 98 */
99static int acpi_pm_disable_gpes(void) 99static int acpi_pm_freeze(void)
100{ 100{
101 acpi_disable_all_gpes(); 101 acpi_disable_all_gpes();
102 acpi_os_wait_events_complete(NULL);
103 acpi_ec_block_transactions();
102 return 0; 104 return 0;
103} 105}
104 106
@@ -126,7 +128,8 @@ static int acpi_pm_prepare(void)
126 int error = __acpi_pm_prepare(); 128 int error = __acpi_pm_prepare();
127 129
128 if (!error) 130 if (!error)
129 acpi_disable_all_gpes(); 131 acpi_pm_freeze();
132
130 return error; 133 return error;
131} 134}
132 135
@@ -256,6 +259,8 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
256 * acpi_leave_sleep_state will reenable specific GPEs later 259 * acpi_leave_sleep_state will reenable specific GPEs later
257 */ 260 */
258 acpi_disable_all_gpes(); 261 acpi_disable_all_gpes();
262 /* Allow EC transactions to happen. */
263 acpi_ec_unblock_transactions_early();
259 264
260 local_irq_restore(flags); 265 local_irq_restore(flags);
261 printk(KERN_DEBUG "Back to C!\n"); 266 printk(KERN_DEBUG "Back to C!\n");
@@ -267,6 +272,12 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
267 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 272 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
268} 273}
269 274
275static void acpi_suspend_finish(void)
276{
277 acpi_ec_unblock_transactions();
278 acpi_pm_finish();
279}
280
270static int acpi_suspend_state_valid(suspend_state_t pm_state) 281static int acpi_suspend_state_valid(suspend_state_t pm_state)
271{ 282{
272 u32 acpi_state; 283 u32 acpi_state;
@@ -288,7 +299,7 @@ static struct platform_suspend_ops acpi_suspend_ops = {
288 .begin = acpi_suspend_begin, 299 .begin = acpi_suspend_begin,
289 .prepare_late = acpi_pm_prepare, 300 .prepare_late = acpi_pm_prepare,
290 .enter = acpi_suspend_enter, 301 .enter = acpi_suspend_enter,
291 .wake = acpi_pm_finish, 302 .wake = acpi_suspend_finish,
292 .end = acpi_pm_end, 303 .end = acpi_pm_end,
293}; 304};
294 305
@@ -314,9 +325,9 @@ static int acpi_suspend_begin_old(suspend_state_t pm_state)
314static struct platform_suspend_ops acpi_suspend_ops_old = { 325static struct platform_suspend_ops acpi_suspend_ops_old = {
315 .valid = acpi_suspend_state_valid, 326 .valid = acpi_suspend_state_valid,
316 .begin = acpi_suspend_begin_old, 327 .begin = acpi_suspend_begin_old,
317 .prepare_late = acpi_pm_disable_gpes, 328 .prepare_late = acpi_pm_freeze,
318 .enter = acpi_suspend_enter, 329 .enter = acpi_suspend_enter,
319 .wake = acpi_pm_finish, 330 .wake = acpi_suspend_finish,
320 .end = acpi_pm_end, 331 .end = acpi_pm_end,
321 .recover = acpi_pm_finish, 332 .recover = acpi_pm_finish,
322}; 333};
@@ -433,6 +444,7 @@ static int acpi_hibernation_enter(void)
433static void acpi_hibernation_finish(void) 444static void acpi_hibernation_finish(void)
434{ 445{
435 hibernate_nvs_free(); 446 hibernate_nvs_free();
447 acpi_ec_unblock_transactions();
436 acpi_pm_finish(); 448 acpi_pm_finish();
437} 449}
438 450
@@ -453,19 +465,13 @@ static void acpi_hibernation_leave(void)
453 } 465 }
454 /* Restore the NVS memory area */ 466 /* Restore the NVS memory area */
455 hibernate_nvs_restore(); 467 hibernate_nvs_restore();
468 /* Allow EC transactions to happen. */
469 acpi_ec_unblock_transactions_early();
456} 470}
457 471
458static int acpi_pm_pre_restore(void) 472static void acpi_pm_thaw(void)
459{
460 acpi_disable_all_gpes();
461 acpi_os_wait_events_complete(NULL);
462 acpi_ec_suspend_transactions();
463 return 0;
464}
465
466static void acpi_pm_restore_cleanup(void)
467{ 473{
468 acpi_ec_resume_transactions(); 474 acpi_ec_unblock_transactions();
469 acpi_enable_all_runtime_gpes(); 475 acpi_enable_all_runtime_gpes();
470} 476}
471 477
@@ -477,8 +483,8 @@ static struct platform_hibernation_ops acpi_hibernation_ops = {
477 .prepare = acpi_pm_prepare, 483 .prepare = acpi_pm_prepare,
478 .enter = acpi_hibernation_enter, 484 .enter = acpi_hibernation_enter,
479 .leave = acpi_hibernation_leave, 485 .leave = acpi_hibernation_leave,
480 .pre_restore = acpi_pm_pre_restore, 486 .pre_restore = acpi_pm_freeze,
481 .restore_cleanup = acpi_pm_restore_cleanup, 487 .restore_cleanup = acpi_pm_thaw,
482}; 488};
483 489
484/** 490/**
@@ -510,12 +516,9 @@ static int acpi_hibernation_begin_old(void)
510 516
511static int acpi_hibernation_pre_snapshot_old(void) 517static int acpi_hibernation_pre_snapshot_old(void)
512{ 518{
513 int error = acpi_pm_disable_gpes(); 519 acpi_pm_freeze();
514 520 hibernate_nvs_save();
515 if (!error) 521 return 0;
516 hibernate_nvs_save();
517
518 return error;
519} 522}
520 523
521/* 524/*
@@ -527,11 +530,11 @@ static struct platform_hibernation_ops acpi_hibernation_ops_old = {
527 .end = acpi_pm_end, 530 .end = acpi_pm_end,
528 .pre_snapshot = acpi_hibernation_pre_snapshot_old, 531 .pre_snapshot = acpi_hibernation_pre_snapshot_old,
529 .finish = acpi_hibernation_finish, 532 .finish = acpi_hibernation_finish,
530 .prepare = acpi_pm_disable_gpes, 533 .prepare = acpi_pm_freeze,
531 .enter = acpi_hibernation_enter, 534 .enter = acpi_hibernation_enter,
532 .leave = acpi_hibernation_leave, 535 .leave = acpi_hibernation_leave,
533 .pre_restore = acpi_pm_pre_restore, 536 .pre_restore = acpi_pm_freeze,
534 .restore_cleanup = acpi_pm_restore_cleanup, 537 .restore_cleanup = acpi_pm_thaw,
535 .recover = acpi_pm_finish, 538 .recover = acpi_pm_finish,
536}; 539};
537#endif /* CONFIG_HIBERNATION */ 540#endif /* CONFIG_HIBERNATION */
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index f09fc0e2062d..7cfcc629a7fd 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -1123,6 +1123,7 @@ source "drivers/s390/char/Kconfig"
1123 1123
1124config RAMOOPS 1124config RAMOOPS
1125 tristate "Log panic/oops to a RAM buffer" 1125 tristate "Log panic/oops to a RAM buffer"
1126 depends on HAS_IOMEM
1126 default n 1127 default n
1127 help 1128 help
1128 This enables panic and oops messages to be logged to a circular 1129 This enables panic and oops messages to be logged to a circular
diff --git a/drivers/misc/vmware_balloon.c b/drivers/misc/vmware_balloon.c
index db9cd0240c6f..2a1e804a71aa 100644
--- a/drivers/misc/vmware_balloon.c
+++ b/drivers/misc/vmware_balloon.c
@@ -45,7 +45,7 @@
45 45
46MODULE_AUTHOR("VMware, Inc."); 46MODULE_AUTHOR("VMware, Inc.");
47MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver"); 47MODULE_DESCRIPTION("VMware Memory Control (Balloon) Driver");
48MODULE_VERSION("1.2.1.0-K"); 48MODULE_VERSION("1.2.1.1-k");
49MODULE_ALIAS("dmi:*:svnVMware*:*"); 49MODULE_ALIAS("dmi:*:svnVMware*:*");
50MODULE_ALIAS("vmware_vmmemctl"); 50MODULE_ALIAS("vmware_vmmemctl");
51MODULE_LICENSE("GPL"); 51MODULE_LICENSE("GPL");
@@ -101,6 +101,8 @@ MODULE_LICENSE("GPL");
101/* Maximum number of page allocations without yielding processor */ 101/* Maximum number of page allocations without yielding processor */
102#define VMW_BALLOON_YIELD_THRESHOLD 1024 102#define VMW_BALLOON_YIELD_THRESHOLD 1024
103 103
104/* Maximum number of refused pages we accumulate during inflation cycle */
105#define VMW_BALLOON_MAX_REFUSED 16
104 106
105/* 107/*
106 * Hypervisor communication port definitions. 108 * Hypervisor communication port definitions.
@@ -183,6 +185,7 @@ struct vmballoon {
183 185
184 /* transient list of non-balloonable pages */ 186 /* transient list of non-balloonable pages */
185 struct list_head refused_pages; 187 struct list_head refused_pages;
188 unsigned int n_refused_pages;
186 189
187 /* balloon size in pages */ 190 /* balloon size in pages */
188 unsigned int size; 191 unsigned int size;
@@ -428,14 +431,21 @@ static int vmballoon_reserve_page(struct vmballoon *b, bool can_sleep)
428 /* inform monitor */ 431 /* inform monitor */
429 locked = vmballoon_send_lock_page(b, page_to_pfn(page)); 432 locked = vmballoon_send_lock_page(b, page_to_pfn(page));
430 if (!locked) { 433 if (!locked) {
434 STATS_INC(b->stats.refused_alloc);
435
431 if (b->reset_required) { 436 if (b->reset_required) {
432 __free_page(page); 437 __free_page(page);
433 return -EIO; 438 return -EIO;
434 } 439 }
435 440
436 /* place on list of non-balloonable pages, retry allocation */ 441 /*
442 * Place page on the list of non-balloonable pages
443 * and retry allocation, unless we already accumulated
444 * too many of them, in which case take a breather.
445 */
437 list_add(&page->lru, &b->refused_pages); 446 list_add(&page->lru, &b->refused_pages);
438 STATS_INC(b->stats.refused_alloc); 447 if (++b->n_refused_pages >= VMW_BALLOON_MAX_REFUSED)
448 return -EIO;
439 } 449 }
440 } while (!locked); 450 } while (!locked);
441 451
@@ -483,6 +493,8 @@ static void vmballoon_release_refused_pages(struct vmballoon *b)
483 __free_page(page); 493 __free_page(page);
484 STATS_INC(b->stats.refused_free); 494 STATS_INC(b->stats.refused_free);
485 } 495 }
496
497 b->n_refused_pages = 0;
486} 498}
487 499
488/* 500/*
diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 2b281680e320..d98ddcfac5e5 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1157,7 +1157,6 @@ static void mmc_omap_start_request(struct mmc_omap_host *host,
1157 mmc_omap_start_command(host, req->cmd); 1157 mmc_omap_start_command(host, req->cmd);
1158 if (host->dma_in_use) 1158 if (host->dma_in_use)
1159 omap_start_dma(host->dma_ch); 1159 omap_start_dma(host->dma_ch);
1160 BUG_ON(irqs_disabled());
1161} 1160}
1162 1161
1163static void mmc_omap_request(struct mmc_host *mmc, struct mmc_request *req) 1162static void mmc_omap_request(struct mmc_host *mmc, struct mmc_request *req)
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index e5972b2c17b7..70b68d35f969 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -495,8 +495,6 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
495 pr_debug("s3c2410_rtc: RTCCON=%02x\n", 495 pr_debug("s3c2410_rtc: RTCCON=%02x\n",
496 readb(s3c_rtc_base + S3C2410_RTCCON)); 496 readb(s3c_rtc_base + S3C2410_RTCCON));
497 497
498 s3c_rtc_setfreq(&pdev->dev, 1);
499
500 device_init_wakeup(&pdev->dev, 1); 498 device_init_wakeup(&pdev->dev, 1);
501 499
502 /* register RTC and exit */ 500 /* register RTC and exit */
@@ -510,14 +508,17 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
510 goto err_nortc; 508 goto err_nortc;
511 } 509 }
512 510
511 s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
512
513 if (s3c_rtc_cpu_type == TYPE_S3C64XX) 513 if (s3c_rtc_cpu_type == TYPE_S3C64XX)
514 rtc->max_user_freq = 32768; 514 rtc->max_user_freq = 32768;
515 else 515 else
516 rtc->max_user_freq = 128; 516 rtc->max_user_freq = 128;
517 517
518 s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
519
520 platform_set_drvdata(pdev, rtc); 518 platform_set_drvdata(pdev, rtc);
519
520 s3c_rtc_setfreq(&pdev->dev, 1);
521
521 return 0; 522 return 0;
522 523
523 err_nortc: 524 err_nortc:
diff --git a/drivers/sfi/sfi_core.c b/drivers/sfi/sfi_core.c
index 005195958647..ceba593dc84f 100644
--- a/drivers/sfi/sfi_core.c
+++ b/drivers/sfi/sfi_core.c
@@ -441,8 +441,10 @@ struct sfi_table_attr __init *sfi_sysfs_install_table(u64 pa)
441 441
442 ret = sysfs_create_bin_file(tables_kobj, 442 ret = sysfs_create_bin_file(tables_kobj,
443 &tbl_attr->attr); 443 &tbl_attr->attr);
444 if (ret) 444 if (ret) {
445 kfree(tbl_attr); 445 kfree(tbl_attr);
446 tbl_attr = NULL;
447 }
446 448
447 sfi_unmap_table(th); 449 sfi_unmap_table(th);
448 return tbl_attr; 450 return tbl_attr;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 0c2f14ff9696..61d75507d5d0 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1201,7 +1201,7 @@ made_compressed_probe:
1201 if (rcv->urb == NULL) { 1201 if (rcv->urb == NULL) {
1202 dev_dbg(&intf->dev, 1202 dev_dbg(&intf->dev,
1203 "out of memory (read urbs usb_alloc_urb)\n"); 1203 "out of memory (read urbs usb_alloc_urb)\n");
1204 goto alloc_fail7; 1204 goto alloc_fail6;
1205 } 1205 }
1206 1206
1207 rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; 1207 rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
@@ -1225,7 +1225,7 @@ made_compressed_probe:
1225 if (snd->urb == NULL) { 1225 if (snd->urb == NULL) {
1226 dev_dbg(&intf->dev, 1226 dev_dbg(&intf->dev,
1227 "out of memory (write urbs usb_alloc_urb)"); 1227 "out of memory (write urbs usb_alloc_urb)");
1228 goto alloc_fail7; 1228 goto alloc_fail8;
1229 } 1229 }
1230 1230
1231 if (usb_endpoint_xfer_int(epwrite)) 1231 if (usb_endpoint_xfer_int(epwrite))
@@ -1264,6 +1264,7 @@ made_compressed_probe:
1264 i = device_create_file(&intf->dev, 1264 i = device_create_file(&intf->dev,
1265 &dev_attr_iCountryCodeRelDate); 1265 &dev_attr_iCountryCodeRelDate);
1266 if (i < 0) { 1266 if (i < 0) {
1267 device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
1267 kfree(acm->country_codes); 1268 kfree(acm->country_codes);
1268 goto skip_countries; 1269 goto skip_countries;
1269 } 1270 }
@@ -1300,6 +1301,7 @@ alloc_fail8:
1300 usb_free_urb(acm->wb[i].urb); 1301 usb_free_urb(acm->wb[i].urb);
1301alloc_fail7: 1302alloc_fail7:
1302 acm_read_buffers_free(acm); 1303 acm_read_buffers_free(acm);
1304alloc_fail6:
1303 for (i = 0; i < num_rx_buf; i++) 1305 for (i = 0; i < num_rx_buf; i++)
1304 usb_free_urb(acm->ru[i].urb); 1306 usb_free_urb(acm->ru[i].urb);
1305 usb_free_urb(acm->ctrlurb); 1307 usb_free_urb(acm->ctrlurb);
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index ded550eda5d9..de98a94d1853 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1328,6 +1328,7 @@ int usb_resume(struct device *dev, pm_message_t msg)
1328 1328
1329 /* For all other calls, take the device back to full power and 1329 /* For all other calls, take the device back to full power and
1330 * tell the PM core in case it was autosuspended previously. 1330 * tell the PM core in case it was autosuspended previously.
1331 * Unbind the interfaces that will need rebinding later.
1331 */ 1332 */
1332 } else { 1333 } else {
1333 status = usb_resume_both(udev, msg); 1334 status = usb_resume_both(udev, msg);
@@ -1336,6 +1337,7 @@ int usb_resume(struct device *dev, pm_message_t msg)
1336 pm_runtime_set_active(dev); 1337 pm_runtime_set_active(dev);
1337 pm_runtime_enable(dev); 1338 pm_runtime_enable(dev);
1338 udev->last_busy = jiffies; 1339 udev->last_busy = jiffies;
1340 do_unbind_rebind(udev, DO_REBIND);
1339 } 1341 }
1340 } 1342 }
1341 1343
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 649c0c5f7158..591ae9fde199 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -295,6 +295,7 @@ config USB_GADGET_S3C_HSOTG
295 boolean "S3C HS/OtG USB Device controller" 295 boolean "S3C HS/OtG USB Device controller"
296 depends on S3C_DEV_USB_HSOTG 296 depends on S3C_DEV_USB_HSOTG
297 select USB_GADGET_S3C_HSOTG_PIO 297 select USB_GADGET_S3C_HSOTG_PIO
298 select USB_GADGET_DUALSPEED
298 help 299 help
299 The Samsung S3C64XX USB2.0 high-speed gadget controller 300 The Samsung S3C64XX USB2.0 high-speed gadget controller
300 integrated into the S3C64XX series SoC. 301 integrated into the S3C64XX series SoC.
diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c
index 43bf44514c41..b91115f84b13 100644
--- a/drivers/usb/gadget/f_audio.c
+++ b/drivers/usb/gadget/f_audio.c
@@ -101,7 +101,7 @@ static struct uac_feature_unit_descriptor_0 feature_unit_desc = {
101static struct usb_audio_control mute_control = { 101static struct usb_audio_control mute_control = {
102 .list = LIST_HEAD_INIT(mute_control.list), 102 .list = LIST_HEAD_INIT(mute_control.list),
103 .name = "Mute Control", 103 .name = "Mute Control",
104 .type = UAC_MUTE_CONTROL, 104 .type = UAC_FU_MUTE,
105 /* Todo: add real Mute control code */ 105 /* Todo: add real Mute control code */
106 .set = generic_set_cmd, 106 .set = generic_set_cmd,
107 .get = generic_get_cmd, 107 .get = generic_get_cmd,
@@ -110,7 +110,7 @@ static struct usb_audio_control mute_control = {
110static struct usb_audio_control volume_control = { 110static struct usb_audio_control volume_control = {
111 .list = LIST_HEAD_INIT(volume_control.list), 111 .list = LIST_HEAD_INIT(volume_control.list),
112 .name = "Volume Control", 112 .name = "Volume Control",
113 .type = UAC_VOLUME_CONTROL, 113 .type = UAC_FU_VOLUME,
114 /* Todo: add real Volume control code */ 114 /* Todo: add real Volume control code */
115 .set = generic_set_cmd, 115 .set = generic_set_cmd,
116 .get = generic_get_cmd, 116 .get = generic_get_cmd,
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 1f73b485732d..26193eceb323 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -297,6 +297,12 @@ static void s3c_hsotg_ctrl_epint(struct s3c_hsotg *hsotg,
297 */ 297 */
298static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg) 298static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
299{ 299{
300 unsigned int ep;
301 unsigned int addr;
302 unsigned int size;
303 int timeout;
304 u32 val;
305
300 /* the ryu 2.6.24 release ahs 306 /* the ryu 2.6.24 release ahs
301 writel(0x1C0, hsotg->regs + S3C_GRXFSIZ); 307 writel(0x1C0, hsotg->regs + S3C_GRXFSIZ);
302 writel(S3C_GNPTXFSIZ_NPTxFStAddr(0x200) | 308 writel(S3C_GNPTXFSIZ_NPTxFStAddr(0x200) |
@@ -310,6 +316,51 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
310 writel(S3C_GNPTXFSIZ_NPTxFStAddr(2048) | 316 writel(S3C_GNPTXFSIZ_NPTxFStAddr(2048) |
311 S3C_GNPTXFSIZ_NPTxFDep(0x1C0), 317 S3C_GNPTXFSIZ_NPTxFDep(0x1C0),
312 hsotg->regs + S3C_GNPTXFSIZ); 318 hsotg->regs + S3C_GNPTXFSIZ);
319
320 /* arange all the rest of the TX FIFOs, as some versions of this
321 * block have overlapping default addresses. This also ensures
322 * that if the settings have been changed, then they are set to
323 * known values. */
324
325 /* start at the end of the GNPTXFSIZ, rounded up */
326 addr = 2048 + 1024;
327 size = 768;
328
329 /* currently we allocate TX FIFOs for all possible endpoints,
330 * and assume that they are all the same size. */
331
332 for (ep = 0; ep <= 15; ep++) {
333 val = addr;
334 val |= size << S3C_DPTXFSIZn_DPTxFSize_SHIFT;
335 addr += size;
336
337 writel(val, hsotg->regs + S3C_DPTXFSIZn(ep));
338 }
339
340 /* according to p428 of the design guide, we need to ensure that
341 * all fifos are flushed before continuing */
342
343 writel(S3C_GRSTCTL_TxFNum(0x10) | S3C_GRSTCTL_TxFFlsh |
344 S3C_GRSTCTL_RxFFlsh, hsotg->regs + S3C_GRSTCTL);
345
346 /* wait until the fifos are both flushed */
347 timeout = 100;
348 while (1) {
349 val = readl(hsotg->regs + S3C_GRSTCTL);
350
351 if ((val & (S3C_GRSTCTL_TxFFlsh | S3C_GRSTCTL_RxFFlsh)) == 0)
352 break;
353
354 if (--timeout == 0) {
355 dev_err(hsotg->dev,
356 "%s: timeout flushing fifos (GRSTCTL=%08x)\n",
357 __func__, val);
358 }
359
360 udelay(1);
361 }
362
363 dev_dbg(hsotg->dev, "FIFOs reset, timeout at %d\n", timeout);
313} 364}
314 365
315/** 366/**
@@ -2574,6 +2625,9 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
2574 writel(S3C_DCTL_CGOUTNak | S3C_DCTL_CGNPInNAK, 2625 writel(S3C_DCTL_CGOUTNak | S3C_DCTL_CGNPInNAK,
2575 hsotg->regs + S3C_DCTL); 2626 hsotg->regs + S3C_DCTL);
2576 2627
2628 /* must be at-least 3ms to allow bus to see disconnect */
2629 msleep(3);
2630
2577 /* remove the soft-disconnect and let's go */ 2631 /* remove the soft-disconnect and let's go */
2578 __bic32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon); 2632 __bic32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon);
2579 2633
@@ -2730,6 +2784,9 @@ static void s3c_hsotg_init(struct s3c_hsotg *hsotg)
2730 2784
2731 writel(0, hsotg->regs + S3C_DAINTMSK); 2785 writel(0, hsotg->regs + S3C_DAINTMSK);
2732 2786
2787 /* Be in disconnected state until gadget is registered */
2788 __orr32(hsotg->regs + S3C_DCTL, S3C_DCTL_SftDiscon);
2789
2733 if (0) { 2790 if (0) {
2734 /* post global nak until we're ready */ 2791 /* post global nak until we're ready */
2735 writel(S3C_DCTL_SGNPInNAK | S3C_DCTL_SGOUTNak, 2792 writel(S3C_DCTL_SGNPInNAK | S3C_DCTL_SGOUTNak,
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index ef3e88f0b3c3..a3ef2a9d9dc2 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1135,7 +1135,7 @@ MODULE_LICENSE ("GPL");
1135 1135
1136#ifdef CONFIG_XPS_USB_HCD_XILINX 1136#ifdef CONFIG_XPS_USB_HCD_XILINX
1137#include "ehci-xilinx-of.c" 1137#include "ehci-xilinx-of.c"
1138#define OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver 1138#define XILINX_OF_PLATFORM_DRIVER ehci_hcd_xilinx_of_driver
1139#endif 1139#endif
1140 1140
1141#ifdef CONFIG_PLAT_ORION 1141#ifdef CONFIG_PLAT_ORION
@@ -1159,7 +1159,8 @@ MODULE_LICENSE ("GPL");
1159#endif 1159#endif
1160 1160
1161#if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \ 1161#if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
1162 !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) 1162 !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
1163 !defined(XILINX_OF_PLATFORM_DRIVER)
1163#error "missing bus glue for ehci-hcd" 1164#error "missing bus glue for ehci-hcd"
1164#endif 1165#endif
1165 1166
@@ -1213,10 +1214,20 @@ static int __init ehci_hcd_init(void)
1213 if (retval < 0) 1214 if (retval < 0)
1214 goto clean3; 1215 goto clean3;
1215#endif 1216#endif
1217
1218#ifdef XILINX_OF_PLATFORM_DRIVER
1219 retval = of_register_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
1220 if (retval < 0)
1221 goto clean4;
1222#endif
1216 return retval; 1223 return retval;
1217 1224
1225#ifdef XILINX_OF_PLATFORM_DRIVER
1226 /* of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER); */
1227clean4:
1228#endif
1218#ifdef OF_PLATFORM_DRIVER 1229#ifdef OF_PLATFORM_DRIVER
1219 /* of_unregister_platform_driver(&OF_PLATFORM_DRIVER); */ 1230 of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
1220clean3: 1231clean3:
1221#endif 1232#endif
1222#ifdef PS3_SYSTEM_BUS_DRIVER 1233#ifdef PS3_SYSTEM_BUS_DRIVER
@@ -1243,6 +1254,9 @@ module_init(ehci_hcd_init);
1243 1254
1244static void __exit ehci_hcd_cleanup(void) 1255static void __exit ehci_hcd_cleanup(void)
1245{ 1256{
1257#ifdef XILINX_OF_PLATFORM_DRIVER
1258 of_unregister_platform_driver(&XILINX_OF_PLATFORM_DRIVER);
1259#endif
1246#ifdef OF_PLATFORM_DRIVER 1260#ifdef OF_PLATFORM_DRIVER
1247 of_unregister_platform_driver(&OF_PLATFORM_DRIVER); 1261 of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
1248#endif 1262#endif
diff --git a/drivers/usb/host/isp1362.h b/drivers/usb/host/isp1362.h
index 5151516ea1de..d995351f9bed 100644
--- a/drivers/usb/host/isp1362.h
+++ b/drivers/usb/host/isp1362.h
@@ -65,7 +65,7 @@ static inline void delayed_insw(unsigned int addr, void *buf, int len)
65 unsigned short *bp = (unsigned short *)buf; 65 unsigned short *bp = (unsigned short *)buf;
66 while (len--) { 66 while (len--) {
67 DUMMY_DELAY_ACCESS; 67 DUMMY_DELAY_ACCESS;
68 *bp++ = inw((void *)addr); 68 *bp++ = inw(addr);
69 } 69 }
70} 70}
71 71
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index edffd81fc253..11482b6b9381 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -78,6 +78,8 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
78 xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure" 78 xhci_dbg(xhci, "QUIRK: Fresco Logic xHC needs configure"
79 " endpoint cmd after reset endpoint\n"); 79 " endpoint cmd after reset endpoint\n");
80 } 80 }
81 if (pdev->vendor == PCI_VENDOR_ID_NEC)
82 xhci->quirks |= XHCI_NEC_HOST;
81 83
82 /* Make sure the HC is halted. */ 84 /* Make sure the HC is halted. */
83 retval = xhci_halt(xhci); 85 retval = xhci_halt(xhci);
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 36c858e5b529..9012098add6b 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1071,6 +1071,15 @@ bandwidth_change:
1071 xhci_warn(xhci, "Reset device command completion " 1071 xhci_warn(xhci, "Reset device command completion "
1072 "for disabled slot %u\n", slot_id); 1072 "for disabled slot %u\n", slot_id);
1073 break; 1073 break;
1074 case TRB_TYPE(TRB_NEC_GET_FW):
1075 if (!(xhci->quirks & XHCI_NEC_HOST)) {
1076 xhci->error_bitmask |= 1 << 6;
1077 break;
1078 }
1079 xhci_dbg(xhci, "NEC firmware version %2x.%02x\n",
1080 NEC_FW_MAJOR(event->status),
1081 NEC_FW_MINOR(event->status));
1082 break;
1074 default: 1083 default:
1075 /* Skip over unknown commands on the event ring */ 1084 /* Skip over unknown commands on the event ring */
1076 xhci->error_bitmask |= 1 << 6; 1085 xhci->error_bitmask |= 1 << 6;
@@ -1079,6 +1088,17 @@ bandwidth_change:
1079 inc_deq(xhci, xhci->cmd_ring, false); 1088 inc_deq(xhci, xhci->cmd_ring, false);
1080} 1089}
1081 1090
1091static void handle_vendor_event(struct xhci_hcd *xhci,
1092 union xhci_trb *event)
1093{
1094 u32 trb_type;
1095
1096 trb_type = TRB_FIELD_TO_TYPE(event->generic.field[3]);
1097 xhci_dbg(xhci, "Vendor specific event TRB type = %u\n", trb_type);
1098 if (trb_type == TRB_NEC_CMD_COMP && (xhci->quirks & XHCI_NEC_HOST))
1099 handle_cmd_completion(xhci, &event->event_cmd);
1100}
1101
1082static void handle_port_status(struct xhci_hcd *xhci, 1102static void handle_port_status(struct xhci_hcd *xhci,
1083 union xhci_trb *event) 1103 union xhci_trb *event)
1084{ 1104{
@@ -1659,7 +1679,10 @@ void xhci_handle_event(struct xhci_hcd *xhci)
1659 update_ptrs = 0; 1679 update_ptrs = 0;
1660 break; 1680 break;
1661 default: 1681 default:
1662 xhci->error_bitmask |= 1 << 3; 1682 if ((event->event_cmd.flags & TRB_TYPE_BITMASK) >= TRB_TYPE(48))
1683 handle_vendor_event(xhci, event);
1684 else
1685 xhci->error_bitmask |= 1 << 3;
1663 } 1686 }
1664 /* Any of the above functions may drop and re-acquire the lock, so check 1687 /* Any of the above functions may drop and re-acquire the lock, so check
1665 * to make sure a watchdog timer didn't mark the host as non-responsive. 1688 * to make sure a watchdog timer didn't mark the host as non-responsive.
@@ -2378,6 +2401,12 @@ int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr,
2378 false); 2401 false);
2379} 2402}
2380 2403
2404int xhci_queue_vendor_command(struct xhci_hcd *xhci,
2405 u32 field1, u32 field2, u32 field3, u32 field4)
2406{
2407 return queue_command(xhci, field1, field2, field3, field4, false);
2408}
2409
2381/* Queue a reset device command TRB */ 2410/* Queue a reset device command TRB */
2382int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id) 2411int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id)
2383{ 2412{
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 40e0a0c221b8..27345cd04da0 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -106,6 +106,33 @@ int xhci_halt(struct xhci_hcd *xhci)
106} 106}
107 107
108/* 108/*
109 * Set the run bit and wait for the host to be running.
110 */
111int xhci_start(struct xhci_hcd *xhci)
112{
113 u32 temp;
114 int ret;
115
116 temp = xhci_readl(xhci, &xhci->op_regs->command);
117 temp |= (CMD_RUN);
118 xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n",
119 temp);
120 xhci_writel(xhci, temp, &xhci->op_regs->command);
121
122 /*
123 * Wait for the HCHalted Status bit to be 0 to indicate the host is
124 * running.
125 */
126 ret = handshake(xhci, &xhci->op_regs->status,
127 STS_HALT, 0, XHCI_MAX_HALT_USEC);
128 if (ret == -ETIMEDOUT)
129 xhci_err(xhci, "Host took too long to start, "
130 "waited %u microseconds.\n",
131 XHCI_MAX_HALT_USEC);
132 return ret;
133}
134
135/*
109 * Reset a halted HC, and set the internal HC state to HC_STATE_HALT. 136 * Reset a halted HC, and set the internal HC state to HC_STATE_HALT.
110 * 137 *
111 * This resets pipelines, timers, counters, state machines, etc. 138 * This resets pipelines, timers, counters, state machines, etc.
@@ -116,6 +143,7 @@ int xhci_reset(struct xhci_hcd *xhci)
116{ 143{
117 u32 command; 144 u32 command;
118 u32 state; 145 u32 state;
146 int ret;
119 147
120 state = xhci_readl(xhci, &xhci->op_regs->status); 148 state = xhci_readl(xhci, &xhci->op_regs->status);
121 if ((state & STS_HALT) == 0) { 149 if ((state & STS_HALT) == 0) {
@@ -130,7 +158,17 @@ int xhci_reset(struct xhci_hcd *xhci)
130 /* XXX: Why does EHCI set this here? Shouldn't other code do this? */ 158 /* XXX: Why does EHCI set this here? Shouldn't other code do this? */
131 xhci_to_hcd(xhci)->state = HC_STATE_HALT; 159 xhci_to_hcd(xhci)->state = HC_STATE_HALT;
132 160
133 return handshake(xhci, &xhci->op_regs->command, CMD_RESET, 0, 250 * 1000); 161 ret = handshake(xhci, &xhci->op_regs->command,
162 CMD_RESET, 0, 250 * 1000);
163 if (ret)
164 return ret;
165
166 xhci_dbg(xhci, "Wait for controller to be ready for doorbell rings\n");
167 /*
168 * xHCI cannot write to any doorbells or operational registers other
169 * than status until the "Controller Not Ready" flag is cleared.
170 */
171 return handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
134} 172}
135 173
136 174
@@ -448,17 +486,20 @@ int xhci_run(struct usb_hcd *hcd)
448 486
449 if (NUM_TEST_NOOPS > 0) 487 if (NUM_TEST_NOOPS > 0)
450 doorbell = xhci_setup_one_noop(xhci); 488 doorbell = xhci_setup_one_noop(xhci);
489 if (xhci->quirks & XHCI_NEC_HOST)
490 xhci_queue_vendor_command(xhci, 0, 0, 0,
491 TRB_TYPE(TRB_NEC_GET_FW));
492
493 if (xhci_start(xhci)) {
494 xhci_halt(xhci);
495 return -ENODEV;
496 }
451 497
452 temp = xhci_readl(xhci, &xhci->op_regs->command);
453 temp |= (CMD_RUN);
454 xhci_dbg(xhci, "// Turn on HC, cmd = 0x%x.\n",
455 temp);
456 xhci_writel(xhci, temp, &xhci->op_regs->command);
457 /* Flush PCI posted writes */
458 temp = xhci_readl(xhci, &xhci->op_regs->command);
459 xhci_dbg(xhci, "// @%p = 0x%x\n", &xhci->op_regs->command, temp); 498 xhci_dbg(xhci, "// @%p = 0x%x\n", &xhci->op_regs->command, temp);
460 if (doorbell) 499 if (doorbell)
461 (*doorbell)(xhci); 500 (*doorbell)(xhci);
501 if (xhci->quirks & XHCI_NEC_HOST)
502 xhci_ring_cmd_db(xhci);
462 503
463 xhci_dbg(xhci, "Finished xhci_run\n"); 504 xhci_dbg(xhci, "Finished xhci_run\n");
464 return 0; 505 return 0;
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index dada2fb59261..8b4b7d39f79c 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -925,6 +925,7 @@ union xhci_trb {
925/* TRB bit mask */ 925/* TRB bit mask */
926#define TRB_TYPE_BITMASK (0xfc00) 926#define TRB_TYPE_BITMASK (0xfc00)
927#define TRB_TYPE(p) ((p) << 10) 927#define TRB_TYPE(p) ((p) << 10)
928#define TRB_FIELD_TO_TYPE(p) (((p) & TRB_TYPE_BITMASK) >> 10)
928/* TRB type IDs */ 929/* TRB type IDs */
929/* bulk, interrupt, isoc scatter/gather, and control data stage */ 930/* bulk, interrupt, isoc scatter/gather, and control data stage */
930#define TRB_NORMAL 1 931#define TRB_NORMAL 1
@@ -992,6 +993,14 @@ union xhci_trb {
992#define TRB_MFINDEX_WRAP 39 993#define TRB_MFINDEX_WRAP 39
993/* TRB IDs 40-47 reserved, 48-63 is vendor-defined */ 994/* TRB IDs 40-47 reserved, 48-63 is vendor-defined */
994 995
996/* Nec vendor-specific command completion event. */
997#define TRB_NEC_CMD_COMP 48
998/* Get NEC firmware revision. */
999#define TRB_NEC_GET_FW 49
1000
1001#define NEC_FW_MINOR(p) (((p) >> 0) & 0xff)
1002#define NEC_FW_MAJOR(p) (((p) >> 8) & 0xff)
1003
995/* 1004/*
996 * TRBS_PER_SEGMENT must be a multiple of 4, 1005 * TRBS_PER_SEGMENT must be a multiple of 4,
997 * since the command ring is 64-byte aligned. 1006 * since the command ring is 64-byte aligned.
@@ -1172,6 +1181,7 @@ struct xhci_hcd {
1172 unsigned int quirks; 1181 unsigned int quirks;
1173#define XHCI_LINK_TRB_QUIRK (1 << 0) 1182#define XHCI_LINK_TRB_QUIRK (1 << 0)
1174#define XHCI_RESET_EP_QUIRK (1 << 1) 1183#define XHCI_RESET_EP_QUIRK (1 << 1)
1184#define XHCI_NEC_HOST (1 << 2)
1175}; 1185};
1176 1186
1177/* For testing purposes */ 1187/* For testing purposes */
@@ -1379,6 +1389,8 @@ void xhci_set_hc_event_deq(struct xhci_hcd *xhci);
1379int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id); 1389int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id);
1380int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, 1390int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr,
1381 u32 slot_id); 1391 u32 slot_id);
1392int xhci_queue_vendor_command(struct xhci_hcd *xhci,
1393 u32 field1, u32 field2, u32 field3, u32 field4);
1382int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id, 1394int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id,
1383 unsigned int ep_index); 1395 unsigned int ep_index);
1384int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, 1396int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb,
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 3edda3ed822a..fd35f73b5721 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1239,8 +1239,7 @@ static void digi_write_bulk_callback(struct urb *urb)
1239 1239
1240 /* port and serial sanity check */ 1240 /* port and serial sanity check */
1241 if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { 1241 if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) {
1242 dev_err(&port->dev, 1242 pr_err("%s: port or port->private is NULL, status=%d\n",
1243 "%s: port or port->private is NULL, status=%d\n",
1244 __func__, status); 1243 __func__, status);
1245 return; 1244 return;
1246 } 1245 }
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 050211afc07e..79dd1ae195e5 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -2005,6 +2005,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
2005 "urb failed to set to rts/cts flow control\n"); 2005 "urb failed to set to rts/cts flow control\n");
2006 } 2006 }
2007 2007
2008 /* raise DTR/RTS */
2009 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
2008 } else { 2010 } else {
2009 /* 2011 /*
2010 * Xon/Xoff code 2012 * Xon/Xoff code
@@ -2052,6 +2054,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
2052 } 2054 }
2053 } 2055 }
2054 2056
2057 /* lower DTR/RTS */
2058 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
2055 } 2059 }
2056 return; 2060 return;
2057} 2061}
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index f8424d1bfc1b..585b7e663740 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -730,7 +730,6 @@ static void mos7840_bulk_in_callback(struct urb *urb)
730 mos7840_port = urb->context; 730 mos7840_port = urb->context;
731 if (!mos7840_port) { 731 if (!mos7840_port) {
732 dbg("%s", "NULL mos7840_port pointer"); 732 dbg("%s", "NULL mos7840_port pointer");
733 mos7840_port->read_urb_busy = false;
734 return; 733 return;
735 } 734 }
736 735
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 1e6fec487973..3d94a1471724 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -8,6 +8,9 @@ menu "Graphics support"
8config HAVE_FB_ATMEL 8config HAVE_FB_ATMEL
9 bool 9 bool
10 10
11config HAVE_FB_IMX
12 bool
13
11source "drivers/char/agp/Kconfig" 14source "drivers/char/agp/Kconfig"
12 15
13source "drivers/gpu/vga/Kconfig" 16source "drivers/gpu/vga/Kconfig"
@@ -400,9 +403,6 @@ config FB_SA1100
400 If you plan to use the LCD display with your SA-1100 system, say 403 If you plan to use the LCD display with your SA-1100 system, say
401 Y here. 404 Y here.
402 405
403config HAVE_FB_IMX
404 bool
405
406config FB_IMX 406config FB_IMX
407 tristate "Motorola i.MX LCD support" 407 tristate "Motorola i.MX LCD support"
408 depends on FB && (HAVE_FB_IMX || ARCH_MX1 || ARCH_MX2) 408 depends on FB && (HAVE_FB_IMX || ARCH_MX1 || ARCH_MX2)
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index 073c9b408cf7..6b93ef93cb12 100644
--- a/drivers/video/fb_defio.c
+++ b/drivers/video/fb_defio.c
@@ -100,6 +100,16 @@ static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
100 /* protect against the workqueue changing the page list */ 100 /* protect against the workqueue changing the page list */
101 mutex_lock(&fbdefio->lock); 101 mutex_lock(&fbdefio->lock);
102 102
103 /*
104 * We want the page to remain locked from ->page_mkwrite until
105 * the PTE is marked dirty to avoid page_mkclean() being called
106 * before the PTE is updated, which would leave the page ignored
107 * by defio.
108 * Do this by locking the page here and informing the caller
109 * about it with VM_FAULT_LOCKED.
110 */
111 lock_page(page);
112
103 /* we loop through the pagelist before adding in order 113 /* we loop through the pagelist before adding in order
104 to keep the pagelist sorted */ 114 to keep the pagelist sorted */
105 list_for_each_entry(cur, &fbdefio->pagelist, lru) { 115 list_for_each_entry(cur, &fbdefio->pagelist, lru) {
@@ -121,7 +131,7 @@ page_already_added:
121 131
122 /* come back after delay to process the deferred IO */ 132 /* come back after delay to process the deferred IO */
123 schedule_delayed_work(&info->deferred_work, fbdefio->delay); 133 schedule_delayed_work(&info->deferred_work, fbdefio->delay);
124 return 0; 134 return VM_FAULT_LOCKED;
125} 135}
126 136
127static const struct vm_operations_struct fb_deferred_io_vm_ops = { 137static const struct vm_operations_struct fb_deferred_io_vm_ops = {
@@ -155,41 +165,25 @@ static void fb_deferred_io_work(struct work_struct *work)
155{ 165{
156 struct fb_info *info = container_of(work, struct fb_info, 166 struct fb_info *info = container_of(work, struct fb_info,
157 deferred_work.work); 167 deferred_work.work);
168 struct list_head *node, *next;
169 struct page *cur;
158 struct fb_deferred_io *fbdefio = info->fbdefio; 170 struct fb_deferred_io *fbdefio = info->fbdefio;
159 struct page *page, *tmp_page;
160 struct list_head *node, *tmp_node;
161 struct list_head non_dirty;
162
163 INIT_LIST_HEAD(&non_dirty);
164 171
165 /* here we mkclean the pages, then do all deferred IO */ 172 /* here we mkclean the pages, then do all deferred IO */
166 mutex_lock(&fbdefio->lock); 173 mutex_lock(&fbdefio->lock);
167 list_for_each_entry_safe(page, tmp_page, &fbdefio->pagelist, lru) { 174 list_for_each_entry(cur, &fbdefio->pagelist, lru) {
168 lock_page(page); 175 lock_page(cur);
169 /* 176 page_mkclean(cur);
170 * The workqueue callback can be triggered after a 177 unlock_page(cur);
171 * ->page_mkwrite() call but before the PTE has been marked
172 * dirty. In this case page_mkclean() won't "rearm" the page.
173 *
174 * To avoid this, remove those "non-dirty" pages from the
175 * pagelist before calling the driver's callback, then add
176 * them back to get processed on the next work iteration.
177 * At that time, their PTEs will hopefully be dirty for real.
178 */
179 if (!page_mkclean(page))
180 list_move_tail(&page->lru, &non_dirty);
181 unlock_page(page);
182 } 178 }
183 179
184 /* driver's callback with pagelist */ 180 /* driver's callback with pagelist */
185 fbdefio->deferred_io(info, &fbdefio->pagelist); 181 fbdefio->deferred_io(info, &fbdefio->pagelist);
186 182
187 /* clear the list... */ 183 /* clear the list */
188 list_for_each_safe(node, tmp_node, &fbdefio->pagelist) { 184 list_for_each_safe(node, next, &fbdefio->pagelist) {
189 list_del(node); 185 list_del(node);
190 } 186 }
191 /* ... and add back the "non-dirty" pages to the list */
192 list_splice_tail(&non_dirty, &fbdefio->pagelist);
193 mutex_unlock(&fbdefio->lock); 187 mutex_unlock(&fbdefio->lock);
194} 188}
195 189
@@ -218,7 +212,6 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_open);
218void fb_deferred_io_cleanup(struct fb_info *info) 212void fb_deferred_io_cleanup(struct fb_info *info)
219{ 213{
220 struct fb_deferred_io *fbdefio = info->fbdefio; 214 struct fb_deferred_io *fbdefio = info->fbdefio;
221 struct list_head *node, *tmp_node;
222 struct page *page; 215 struct page *page;
223 int i; 216 int i;
224 217
@@ -226,13 +219,6 @@ void fb_deferred_io_cleanup(struct fb_info *info)
226 cancel_delayed_work(&info->deferred_work); 219 cancel_delayed_work(&info->deferred_work);
227 flush_scheduled_work(); 220 flush_scheduled_work();
228 221
229 /* the list may have still some non-dirty pages at this point */
230 mutex_lock(&fbdefio->lock);
231 list_for_each_safe(node, tmp_node, &fbdefio->pagelist) {
232 list_del(node);
233 }
234 mutex_unlock(&fbdefio->lock);
235
236 /* clear out the mapping that we setup */ 222 /* clear out the mapping that we setup */
237 for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) { 223 for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
238 page = fb_deferred_io_page(info, i); 224 page = fb_deferred_io_page(info, i);