-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathodroid-c-uboot-2015.04.06-replace-wait-ms-with-mdelay.patch
1122 lines (1035 loc) · 33.1 KB
/
odroid-c-uboot-2015.04.06-replace-wait-ms-with-mdelay.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
From 5b84dd67cfd8c07c4adff935310224a03d0c4d01 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
Date: Mon, 5 Mar 2012 13:47:00 +0000
Subject: [PATCH] usb: replace wait_ms() with mdelay()
Common code has a mdelay() func, so use that instead of the usb-specific
wait_ms() func. This also fixes the build errors:
ohci-hcd.c: In function 'submit_common_msg':
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1519:9: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1816:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1827:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1844:10: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1563:11: sorry, unimplemented: called from here
/usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available
ohci-hcd.c:1583:9: sorry, unimplemented: called from here
make[1]: *** [ohci-hcd.o] Error 1
Signed-off-by: Mike Frysinger <[email protected]>
Acked-by: Marek Vasut <[email protected]>
---
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c | 28 ++++++++++++-------------
arch/arm/cpu/pxa/usb.c | 2 +-
arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c | 28 ++++++++++++-------------
arch/powerpc/cpu/mpc5xxx/usb_ohci.c | 6 +++---
arch/powerpc/cpu/ppc4xx/usb_ohci.c | 6 +++---
arch/sparc/cpu/leon3/usb_uhci.c | 8 +++----
board/efikamx/efikamx-usb.c | 2 +-
board/mcc200/auto_update.c | 4 ++--
board/mpl/common/usb_uhci.c | 8 +++----
board/renesas/sh7785lcr/selfcheck.c | 10 ++-------
common/usb.c | 16 +++-----------
common/usb_hub.c | 10 ++++-----
common/usb_storage.c | 16 +++++++-------
drivers/usb/host/ehci-hcd.c | 4 ++--
drivers/usb/host/isp116x-hcd.c | 12 +++++------
drivers/usb/host/ohci-hcd.c | 28 ++++++++++++-------------
drivers/usb/host/r8a66597-hcd.c | 14 ++++++-------
include/usb.h | 1 -
18 files changed, 93 insertions(+), 110 deletions(-)
diff --git a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
index 80bb61b27..cf0335c 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
@@ -1054,7 +1054,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)",
usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (usb_pipeint(pipe)) {
info("Root-Hub submit IRQ: NOT implemented");
@@ -1257,7 +1257,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
#ifdef DEBUG
ohci_dump_roothub(&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
len = min_t(int, len, leni);
@@ -1272,7 +1272,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
pkt_print(dev, pipe, buffer, transfer_len, cmd, "RET(rh)",
0 /*usb_pipein(pipe) */);
#else
- wait_ms(1);
+ mdelay(1);
#endif
return stat;
@@ -1299,7 +1299,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB",
usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_common_message: pipesize for pipe %lx is zero",
@@ -1313,7 +1313,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
return -1;
}
- wait_ms(10);
+ mdelay(10);
/* ohci_dump_status(&gohci); */
/* allow more time for a BULK device to react - some are slow */
@@ -1348,7 +1348,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
if (--timeout) {
- wait_ms(1);
+ mdelay(1);
if (!urb_finished)
dbg("\%");
@@ -1393,7 +1393,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(dev, pipe, buffer, transfer_len, setup, "RET(ctlr)",
usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* free TDs in urb_priv */
@@ -1420,7 +1420,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB",
usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_control_message: pipesize for pipe %lx is zero",
@@ -1460,7 +1460,7 @@ static int hc_reset(struct ohci *ohci)
writel(OHCI_OCR, &ohci->regs->cmdstatus);
info("USB HC TakeOver from SMM");
while (readl(&ohci->regs->control) & OHCI_CTRL_IR) {
- wait_ms(10);
+ mdelay(10);
if (--smm_timeout == 0) {
err("USB HC TakeOver failed!");
return -1;
@@ -1598,7 +1598,7 @@ static int hc_interrupt(void)
#ifdef DEBUG
ohci_dump(ohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* FIXME: be optimistic, hope that bug won't repeat often. */
/* Make some non-interrupt context restart the controller. */
@@ -1609,7 +1609,7 @@ static int hc_interrupt(void)
}
if (ints & OHCI_INTR_WDH) {
- wait_ms(1);
+ mdelay(1);
writel(OHCI_INTR_WDH, ®s->intrdisable);
stat = dl_done_list(&gohci, dl_reverse_done_list(&gohci));
@@ -1625,7 +1625,7 @@ static int hc_interrupt(void)
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = m16_swap(ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
writel(OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
writel(OHCI_INTR_SF, ®s->intrenable);
@@ -1716,7 +1716,7 @@ int usb_lowlevel_init(void)
/* FIXME this is a second HC reset; why?? */
gohci.hc_control = OHCI_USB_RESET;
writel(gohci.hc_control, &gohci.regs->control);
- wait_ms(10);
+ mdelay(10);
if (hc_start(&gohci) < 0) {
err("can't start usb-%s", gohci.slot_name);
@@ -1728,7 +1728,7 @@ int usb_lowlevel_init(void)
#ifdef DEBUG
ohci_dump(&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
ohci_inited = 1;
urb_finished = 1;
diff --git a/arch/arm/cpu/pxa/usb.c b/arch/arm/cpu/pxa/usb.c
index 307fc6c..6c7e496 100644
--- a/arch/arm/cpu/pxa/usb.c
+++ b/arch/arm/cpu/pxa/usb.c
@@ -48,7 +48,7 @@ int usb_cpu_init(void)
#endif
writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
- wait_ms(11);
+ mdelay(11);
writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
diff --git a/arch/mips/cpu/au1x00_usb_ohci.c b/arch/mips/cpu/au1x00_usb_ohci.c
index 307fc6c..6c7e496 100644
--- a/arch/mips/cpu/au1x00_usb_ohci.c
+++ b/arch/mips/cpu/au1x00_usb_ohci.c
@@ -1012,7 +1012,7 @@
urb_priv.actual_length = 0;
pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (usb_pipeint(pipe)) {
info("Root-Hub submit IRQ: NOT implemented");
@@ -1189,7 +1189,7 @@
#ifdef DEBUG
ohci_dump_roothub (&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
len = min_t(int, len, leni);
@@ -1203,7 +1203,7 @@
urb_priv.actual_length = transfer_len;
pkt_print(dev, pipe, buffer, transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/);
#else
- wait_ms(1);
+ mdelay(1);
#endif
return stat;
@@ -1230,7 +1230,7 @@
urb_priv.actual_length = 0;
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_common_message: pipesize for pipe %lx is zero",
@@ -1243,7 +1243,7 @@
return -1;
}
- wait_ms(10);
+ mdelay(10);
/* ohci_dump_status(&gohci); */
/* allow more time for a BULK device to react - some are slow */
@@ -1267,7 +1267,7 @@
break;
}
if (--timeout) {
- udelay(250); /* wait_ms(1); */
+ udelay(250); /* mdelay(1); */
} else {
err("CTL:TIMEOUT ");
stat = USB_ST_CRC_ERR;
@@ -1302,7 +1302,7 @@
#ifdef DEBUG
pkt_print(dev, pipe, buffer, transfer_len, setup, "RET(ctlr)", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* free TDs in urb_priv */
@@ -1328,7 +1328,7 @@
urb_priv.actual_length = 0;
pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_control_message: pipesize for pipe %lx is zero",
@@ -1491,7 +1491,7 @@
#ifdef DEBUG
ohci_dump (ohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* FIXME: be optimistic, hope that bug won't repeat often. */
/* Make some non-interrupt context restart the controller. */
@@ -1502,7 +1502,7 @@
}
if (ints & OHCI_INTR_WDH) {
- wait_ms(1);
+ mdelay(1);
writel (OHCI_INTR_WDH, ®s->intrdisable);
stat = dl_done_list (&gohci, dl_reverse_done_list (&gohci));
writel (OHCI_INTR_WDH, ®s->intrenable);
@@ -1517,7 +1517,7 @@
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = m16_swap (ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
writel (OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
writel (OHCI_INTR_SF, ®s->intrenable);
@@ -1695,7 +1695,7 @@
#ifdef DEBUG
ohci_dump (&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
ohci_inited = 1;
return 0;
diff --git a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
index d250c19..6d91525 100644
--- a/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
+++ b/arch/powerpc/cpu/mpc5xxx/usb_ohci.c
@@ -1270,7 +1270,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
if (--timeout) {
- wait_ms(1);
+ mdelay(1);
if (!urb_finished)
dbg("\%");
@@ -1373,7 +1373,7 @@ static int hc_reset (ohci_t *ohci)
writel (OHCI_OCR, &ohci->regs->cmdstatus); /* request ownership */
info("USB HC TakeOver from SMM");
while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
- wait_ms (10);
+ mdelay (10);
if (--smm_timeout == 0) {
err("USB HC TakeOver failed!");
return -1;
@@ -1531,7 +1531,7 @@ hc_interrupt (void)
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = ohci_cpu_to_le16 (ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
writel (OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
writel (OHCI_INTR_SF, ®s->intrenable);
diff --git a/arch/powerpc/cpu/ppc4xx/usb_ohci.c b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
index 4fb7031..14c6a28 100644
--- a/arch/powerpc/cpu/ppc4xx/usb_ohci.c
+++ b/arch/powerpc/cpu/ppc4xx/usb_ohci.c
@@ -1277,7 +1277,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
if (--timeout) {
- wait_ms(1);
+ mdelay(1);
if (!urb_finished)
dbg("\%");
@@ -1380,7 +1380,7 @@ static int hc_reset (ohci_t *ohci)
writel (OHCI_OCR, &ohci->regs->cmdstatus); /* request ownership */
info("USB HC TakeOver from SMM");
while (readl (&ohci->regs->control) & OHCI_CTRL_IR) {
- wait_ms (10);
+ mdelay (10);
if (--smm_timeout == 0) {
err("USB HC TakeOver failed!");
return -1;
@@ -1538,7 +1538,7 @@ hc_interrupt (void)
/* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
if (ints & OHCI_INTR_SF) {
unsigned int frame = ohci_cpu_to_le16 (ohci->hcca->frame_no) & 1;
- wait_ms(1);
+ mdelay(1);
writel (OHCI_INTR_SF, ®s->intrdisable);
if (ohci->ed_rm_list[frame] != NULL)
writel (OHCI_INTR_SF, ®s->intrenable);
diff --git a/arch/sparc/cpu/leon3/usb_uhci.c b/arch/sparc/cpu/leon3/usb_uhci.c
index 358e52a..62cc25d 100644
--- a/arch/sparc/cpu/leon3/usb_uhci.c
+++ b/arch/sparc/cpu/leon3/usb_uhci.c
@@ -515,9 +515,9 @@ void reset_hc(void)
out16r(usb_base_addr + USBCMD, USBCMD_GRESET | USBCMD_RS);
/* Turn off all interrupts */
out16r(usb_base_addr + USBINTR, 0);
- wait_ms(50);
+ mdelay(50);
out16r(usb_base_addr + USBCMD, 0);
- wait_ms(10);
+ mdelay(10);
}
void start_hc(void)
@@ -1044,7 +1044,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
status = (status & 0xfff5) | USBPORTSC_PR;
out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1),
status);
- wait_ms(10);
+ mdelay(10);
status = (status & 0xfff5) & ~USBPORTSC_PR;
out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1),
status);
@@ -1052,7 +1052,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
status = (status & 0xfff5) | USBPORTSC_PE;
out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1),
status);
- wait_ms(10);
+ mdelay(10);
status = (status & 0xfff5) | 0xa;
out16r(usb_base_addr + USBPORTSC1 + 2 * (wIndex - 1),
status);
diff --git a/board/mcc200/auto_update.c b/board/mcc200/auto_update.c
index 4152873..b9ff311 100644
--- a/board/mcc200/auto_update.c
+++ b/board/mcc200/auto_update.c
@@ -284,7 +284,7 @@ int au_do_update(int idx, long sz)
*/
debug ("flash_sect_erase(%lx, %lx);\n", start, end);
flash_sect_erase(start, end);
- wait_ms(100);
+ mdelay(100);
#ifdef CONFIG_PROGRESSBAR
show_progress(end - start, totsize);
#endif
@@ -352,7 +352,7 @@ int do_auto_update(void)
* Read keypad status
*/
i2c_read(I2C_PSOC_KEYPAD_ADDR, 0, 0, keypad_status1, 2);
- wait_ms(500);
+ mdelay(500);
i2c_read(I2C_PSOC_KEYPAD_ADDR, 0, 0, keypad_status2, 2);
/*
diff --git a/board/mpl/common/usb_uhci.c b/board/mpl/common/usb_uhci.c
index 89d2e0a..ddca587 100644
--- a/board/mpl/common/usb_uhci.c
+++ b/board/mpl/common/usb_uhci.c
@@ -435,9 +435,9 @@ void reset_hc(void)
out16r( usb_base_addr + USBCMD,USBCMD_GRESET | USBCMD_RS);
/* Turn off all interrupts */
out16r(usb_base_addr + USBINTR,0);
- wait_ms(50);
+ mdelay(50);
out16r( usb_base_addr + USBCMD,0);
- wait_ms(10);
+ mdelay(10);
}
void start_hc(void)
@@ -926,13 +926,13 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
status = in16r(usb_base_addr+USBPORTSC1+2*(wIndex-1));
status = (status & 0xfff5) | USBPORTSC_PR;
out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status);
- wait_ms(10);
+ mdelay(10);
status = (status & 0xfff5) & ~USBPORTSC_PR;
out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status);
udelay(10);
status = (status & 0xfff5) | USBPORTSC_PE;
out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status);
- wait_ms(10);
+ mdelay(10);
status = (status & 0xfff5) | 0xa;
out16r(usb_base_addr+USBPORTSC1+2*(wIndex-1),status);
len=0;
diff --git a/board/renesas/sh7785lcr/selfcheck.c b/board/renesas/sh7785lcr/selfcheck.c
index 6d92c83..2cd2ad0 100644
--- a/board/renesas/sh7785lcr/selfcheck.c
+++ b/board/renesas/sh7785lcr/selfcheck.c
@@ -33,12 +33,6 @@
#define SM107_DEVICEID (0x13e00060 + NOCACHE_OFFSET)
-static void wait_ms(unsigned long time)
-{
- while (time--)
- udelay(1000);
-}
-
static void test_pld(void)
{
printf("PLD version = %04x\n", readb(PLD_VERSR));
@@ -53,10 +47,10 @@ static void test_led(void)
{
printf("turn on LEDs 3, 5, 7, 9\n");
writeb(0x55, PLD_LEDCR);
- wait_ms(2000);
+ mdelay(2000);
printf("turn on LEDs 4, 6, 8, 10\n");
writeb(0xaa, PLD_LEDCR);
- wait_ms(2000);
+ mdelay(2000);
writeb(0x00, PLD_LEDCR);
}
diff --git a/board/trab/auto_update.c b/board/trab/auto_update.c
index 307fc6c..6c7e496 100644
--- a/board/trab/auto_update.c
+++ b/board/trab/auto_update.c
@@ -377,7 +377,7 @@
*/
debug ("flash_sect_erase(%lx, %lx);\n", start, end);
flash_sect_erase(start, end);
- wait_ms(100);
+ mdelay(100);
/* strip the header - except for the kernel and ramdisk */
if (image_check_type (hdr, IH_TYPE_KERNEL) ||
image_check_type (hdr, IH_TYPE_RAMDISK)) {
diff --git a/common/usb.c b/common/usb.c
index 3c9ede4..1ec30bc 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -86,16 +86,6 @@ char usb_started; /* flag for the started/stopped USB status */
static int hub_port_reset(struct usb_device *dev, int port,
unsigned short *portstat);
-/***********************************************************************
- * wait_ms
- */
-
-inline void wait_ms(unsigned long ms)
-{
- while (ms-- > 0)
- udelay(1000);
-}
-
/***************************************************************************
* Init USB Device
*/
@@ -212,7 +202,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe,
while (timeout--) {
if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
break;
- wait_ms(1);
+ mdelay(1);
}
if (dev->status)
return -1;
@@ -236,7 +226,7 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
while (timeout--) {
if (!((volatile unsigned long)dev->status & USB_ST_NOT_PROC))
break;
- wait_ms(1);
+ mdelay(1);
}
*actual_length = dev->act_len;
if (dev->status == 0)
@@ -883,7 +873,7 @@ int usb_new_device(struct usb_device *dev)
return 1;
}
- wait_ms(10); /* Let the SET_ADDRESS settle */
+ mdelay(10); /* Let the SET_ADDRESS settle */
tmp = sizeof(dev->descriptor);
@@ -1032,7 +1032,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
for (i = 0; i < dev->maxchild; i++) {
usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
USB_HUB_PRINTF("port %d returns %lX\n", i + 1, dev->status);
- wait_ms(hub->desc.bPwrOn2PwrGood * 2);
+ mdelay(hub->desc.bPwrOn2PwrGood * 2);
}
}
@@ -1073,7 +1073,7 @@ int hub_port_reset(struct usb_device *dev, int port,
for (tries = 0; tries < MAX_TRIES; tries++) {
usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET);
- wait_ms(200);
+ mdelay(200);
if (usb_get_port_status(dev, port + 1, &portsts) < 0) {
USB_HUB_PRINTF("get_port_status failed status %lX\n",
@@ -1100,7 +1100,7 @@ int hub_port_reset(struct usb_device *dev, int port,
if (portstatus & USB_PORT_STAT_ENABLE)
break;
- wait_ms(200);
+ mdelay(200);
}
if (tries == MAX_TRIES) {
@@ -1144,7 +1144,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
if (!(portstatus & USB_PORT_STAT_CONNECTION))
return;
}
- wait_ms(200);
+ mdelay(200);
/* Reset the port */
if (hub_port_reset(dev, port, &portstatus) < 0) {
@@ -1152,7 +1152,7 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port)
return;
}
- wait_ms(200);
+ mdelay(200);
/* Allocate a new device struct for it */
usb = usb_alloc_new_device();
diff --git a/common/usb_storage.c b/common/usb_storage.c
index de84c8d..1208333 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -410,19 +410,19 @@ static int usb_stor_BBB_reset(struct us_data *us)
}
/* long wait for reset */
- wait_ms(150);
+ mdelay(150);
USB_STOR_PRINTF("BBB_reset result %d: status %X reset\n", result,
us->pusb_dev->status);
pipe = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
result = usb_clear_halt(us->pusb_dev, pipe);
/* long wait for reset */
- wait_ms(150);
+ mdelay(150);
USB_STOR_PRINTF("BBB_reset result %d: status %X clearing IN endpoint\n",
result, us->pusb_dev->status);
/* long wait for reset */
pipe = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
result = usb_clear_halt(us->pusb_dev, pipe);
- wait_ms(150);
+ mdelay(150);
USB_STOR_PRINTF("BBB_reset result %d: status %X"
" clearing OUT endpoint\n", result,
us->pusb_dev->status);
@@ -450,7 +450,7 @@ static int usb_stor_CB_reset(struct us_data *us)
USB_CNTL_TIMEOUT * 5);
/* long wait for reset */
- wait_ms(1500);
+ mdelay(1500);
USB_STOR_PRINTF("CB_reset result %d: status %X"
" clearing endpoint halt\n", result,
us->pusb_dev->status);
@@ -593,7 +593,7 @@ int usb_stor_CBI_get_status(ccb *srb, struct us_data *us)
while (timeout--) {
if ((volatile int *) us->ip_wanted == 0)
break;
- wait_ms(10);
+ mdelay(10);
}
if (us->ip_wanted) {
printf(" Did not get interrupt on CBI\n");
@@ -664,7 +664,7 @@ int usb_stor_BBB_transport(ccb *srb, struct us_data *us)
usb_stor_BBB_reset(us);
return USB_STOR_TRANSPORT_FAILED;
}
- wait_ms(5);
+ mdelay(5);
pipein = usb_rcvbulkpipe(us->pusb_dev, us->ep_in);
pipeout = usb_sndbulkpipe(us->pusb_dev, us->ep_out);
/* DATA phase + error handling */
@@ -709,7 +709,7 @@
&actlen, USB_CNTL_TIMEOUT*5);
if((result < 0)&&(retry < 100) && ((us->pusb_dev->status & USB_ST_STALLED) == 0)){
- wait_ms(10);
+ mdelay(10);
retry++;
goto again;
}
@@ -862,7 +862,7 @@ do_retry:
srb->sense_buf[12], srb->sense_buf[13]);
return USB_STOR_TRANSPORT_FAILED;
} else {
- wait_ms(100);
+ mdelay(100);
goto do_retry;
}
break;
@@ -935,7 +935,7 @@ static int usb_test_unit_ready(ccb *srb, struct us_data *ss)
if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD)
return 0;
usb_request_sense(srb, ss);
- wait_ms(100);
+ mdelay(100);
} while (retries--);
return -1;
diff --git a/drivers/usb/host/dwc_otg_hcd_294.c b/drivers/usb/host/dwc_otg_hcd_294.c
--- a/drivers/usb/host/dwc_otg_hcd_294.c
+++ b/drivers/usb/host/dwc_otg_hcd_294.c
@@ -379,7 +379,7 @@
/*
* Wait for 3 PHY Clocks
*/
- wait_ms(100);
+ mdelay(100);
}
/**
@@ -1016,7 +1016,7 @@
hc_regs = host_if->hc_regs[hcnum];
/*
if(!is_insert && (!core_if->dma_enable)){
- wait_ms(10);
+ mdelay(10);
if(dwc_otg_interrupt(core_if, is_setup,hcnum,buffer) == -2)
is_insert = 1;
else{
@@ -1364,7 +1364,7 @@
/*
* Wait for 3 PHY Clocks
*/
- wait_ms(1);
+ mdelay(1);
}
/**
@@ -1396,7 +1396,7 @@
/*
* Wait for 3 PHY Clocks
*/
- wait_ms(1);
+ mdelay(1);
}
static void
dwc_otg_set_vbus_power(dwc_otg_core_if_t * _core_if, int is_power_on)
@@ -1619,11 +1619,11 @@
hprt0.b.prtrst = 1;
dwc_write_reg32(_core_if->host_if->hprt0, hprt0.d32);
- wait_ms(60);
+ mdelay(60);
hprt0.b.prtrst = 0;
dwc_write_reg32(_core_if->host_if->hprt0, hprt0.d32);
- wait_ms(20);
+ mdelay(20);
}
static int
@@ -1642,7 +1642,7 @@
hprt0_modify.b.prtenchng = 0;
hprt0_modify.b.prtovrcurrchng = 0;
- wait_ms(30);
+ mdelay(30);
*/
next:
hprt0.d32 = dwc_read_reg32(_core_if->host_if->hprt0);
@@ -1654,9 +1654,9 @@
/*
* clear detect intr
*/
- wait_ms(30);
+ mdelay(30);
dwc_write_reg32(_core_if->host_if->hprt0, hprt0_modify.d32);
- wait_ms(30);
+ mdelay(30);
/*
* reset port 6.1.1.6
*/
@@ -1664,7 +1664,7 @@
hprt0_modify.b.prtconndet = 1;
}else{
- wait_ms(100);
+ mdelay(100);
if(retry--)
goto next;
INFO("No USB device found !");
diff --git a/drivers/usb/host/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg_hcd.c
index 307fc6c..6c7e496 100644
--- a/drivers/usb/host/dwc_otg_hcd.c
+++ b/drivers/usb/host/dwc_otg_hcd.c
@@ -299,7 +299,7 @@
/*
* Wait for 3 PHY Clocks
*/
- wait_ms(100);
+ mdelay(100);
}
/**
@@ -946,7 +946,7 @@
hc_regs = host_if->hc_regs[hcnum];
/*
if(!is_insert && (!core_if->dma_enable)){
- wait_ms(10);
+ mdelay(10);
if(dwc_otg_interrupt(core_if, is_setup,hcnum,buffer) == -2)
is_insert = 1;
else{
@@ -1281,7 +1281,7 @@
/*
* Wait for 3 PHY Clocks
*/
- wait_ms(1);
+ mdelay(1);
}
/**
@@ -1313,7 +1313,7 @@
/*
* Wait for 3 PHY Clocks
*/
- wait_ms(1);
+ mdelay(1);
}
static void
dwc_otg_set_vbus_power(dwc_otg_core_if_t * _core_if, int is_power_on)
@@ -1536,11 +1536,11 @@
hprt0.b.prtrst = 1;
dwc_write_reg32(_core_if->host_if->hprt0, hprt0.d32);
- wait_ms(60);
+ mdelay(60);
hprt0.b.prtrst = 0;
dwc_write_reg32(_core_if->host_if->hprt0, hprt0.d32);
- wait_ms(20);
+ mdelay(20);
}
static int
@@ -1559,7 +1559,7 @@
hprt0_modify.b.prtenchng = 0;
hprt0_modify.b.prtovrcurrchng = 0;
- wait_ms(30);
+ mdelay(30);
*/
next:
hprt0.d32 = dwc_read_reg32(_core_if->host_if->hprt0);
@@ -1571,9 +1571,9 @@
/*
* clear detect intr
*/
- wait_ms(30);
+ mdelay(30);
dwc_write_reg32(_core_if->host_if->hprt0, hprt0_modify.d32);
- wait_ms(30);
+ mdelay(30);
/*
* reset port 6.1.1.6
*/
@@ -1581,7 +1581,7 @@
hprt0_modify.b.prtconndet = 1;
}else{
- wait_ms(100);
+ mdelay(100);
if(retry--)
goto next;
INFO("No USB device found !");
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index d6fee81..ef5afc2 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -710,7 +710,7 @@
* usb 2.0 specification say 50 ms resets on
* root
*/
- wait_ms(50);
+ mdelay(50);
/* terminate the reset */
ehci_writel(status_reg, reg & ~EHCI_PS_PR);
/*
@@ -769,7 +769,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
goto unknown;
}
- wait_ms(1);
+ mdelay(1);
len = min3(srclen, le16_to_cpu(req->length), length);
if (srcptr != NULL && len > 0)
memcpy(buffer, srcptr, len);
@@ -850,7 +850,7 @@ int usb_lowlevel_init(void)
ehci_writel(&hcor->or_configflag, cmd);
/* unblock posted write */
cmd = ehci_readl(&hcor->or_usbcmd);
- wait_ms(5);
+ mdelay(5);
reg = HC_VERSION(ehci_readl(&hccr->cr_capbase));
printf("USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index abdcbb4..5ef34c3 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -578,7 +578,7 @@ static int isp116x_interrupt(struct isp116x *isp116x)
/* When root hub or any of its ports is going
to come out of suspend, it may take more
than 10ms for status bits to stabilize. */
- wait_ms(20);
+ mdelay(20);
}
if (intstat & HCINT_SO) {
@@ -679,7 +679,7 @@ retry_same:
/* Pack data into FIFO ram */
pack_fifo(isp116x, dev, pipe, ptd, 1, buffer, len);
#ifdef EXTRA_DELAY
- wait_ms(EXTRA_DELAY);
+ mdelay(EXTRA_DELAY);
#endif
/* Start the data transfer */
@@ -983,11 +983,11 @@ static int isp116x_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
HCRHPORT1 + wIndex - 1);
if (!(tmp & RH_PS_PRS))
break;
- wait_ms(1);
+ mdelay(1);
}
isp116x_write_reg32(isp116x, HCRHPORT1 + wIndex - 1,
RH_PS_PRS);
- wait_ms(10);
+ mdelay(10);
len = 0;
break;
@@ -1251,7 +1251,7 @@ static int isp116x_sw_reset(struct isp116x *isp116x)
isp116x_write_reg32(isp116x, HCCMDSTAT, HCCMDSTAT_HCR);
while (--retries) {
/* It usually resets within 1 ms */
- wait_ms(1);
+ mdelay(1);
if (!(isp116x_read_reg32(isp116x, HCCMDSTAT) & HCCMDSTAT_HCR))
break;
}
@@ -1278,7 +1278,7 @@ static int isp116x_reset(struct isp116x *isp116x)
clkrdy = isp116x_read_reg16(isp116x, HCuPINT) & HCuPINT_CLKRDY;
if (clkrdy)
break;
- wait_ms(1);
+ mdelay(1);
}
if (!clkrdy) {
ERR("clock not ready after %dms", timeout);
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 1a428e9..d24f2f1 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1273,7 +1273,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
pkt_print(NULL, dev, pipe, buffer, transfer_len,
cmd, "SUB(rh)", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (usb_pipeint(pipe)) {
info("Root-Hub submit IRQ: NOT implemented");
@@ -1354,7 +1354,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
OK(0);
case (RH_PORT_POWER):
WR_RH_PORTSTAT(RH_PS_PPS);
- wait_ms(100);
+ mdelay(100);
OK(0);
case (RH_PORT_ENABLE): /* BUG IN HUP CODE *********/
if (RD_RH_PORTSTAT & RH_PS_CCS)
@@ -1455,7 +1455,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
#ifdef DEBUG
ohci_dump_roothub(&gohci, 1);
#else
- wait_ms(1);
+ mdelay(1);
#endif
len = min_t(int, len, leni);
@@ -1468,7 +1468,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
pkt_print(NULL, dev, pipe, buffer,
transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/);
#else
- wait_ms(1);
+ mdelay(1);
#endif
return stat;
@@ -1506,7 +1506,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(urb, dev, pipe, buffer, transfer_len,
setup, "SUB", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
if (!maxsize) {
err("submit_common_message: pipesize for pipe %lx is zero",
@@ -1520,7 +1520,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
#if 0
- wait_ms(10);
+ mdelay(10);
/* ohci_dump_status(&gohci); */
#endif
@@ -1550,7 +1550,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
}
if (--timeout) {
- wait_ms(1);
+ mdelay(1);
if (!urb->finished)
dbg("*");
@@ -1570,7 +1570,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(urb, dev, pipe, buffer, transfer_len,
setup, "RET(ctlr)", usb_pipein(pipe));
#else
- wait_ms(1);
+ mdelay(1);
#endif
/* free TDs in urb_priv */
@@ -1597,7 +1597,7 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
pkt_print(NULL, dev, pipe, buffer, transfer_len,
setup, "SUB", usb_pipein(pipe));
#else