tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / drivers / usb / gadget / dwc_otg / dwc_common_linux.c
1 /* OS-Level Implementations */
2
3 /* This is the Linux kernel implementation of the DWC platform library. */
4 #include <common.h>
5 #include <malloc.h>
6
7 /*
8 #include <linux/device.h>
9 #include <linux/dma-mapping.h>
10 #include <linux/interrupt.h>
11 */
12 #include <linux/list.h>
13 #include <linux/string.h>
14 //#include <linux/timer.h>
15 #include <usb.h>
16 //#include <linux/usb/gadget.h>
17 #include <asm/io.h>
18
19 #include "dwc_os.h"
20 #include "dwc_list.h"
21 /* MISC */
22
23 void *DWC_MEMSET(void *dest, uint8_t byte, uint32_t size)
24 {
25         return memset(dest, byte, size);
26 }
27
28
29 void *DWC_MEMCPY(void *dest, void const *src, uint32_t size)
30 {
31         return memcpy(dest, src, size);
32 }
33
34
35 void *DWC_MEMMOVE(void *dest, void *src, uint32_t size)
36 {
37         return memmove(dest, src, size);
38 }
39
40
41 int DWC_MEMCMP(void *m1, void *m2, uint32_t size)
42 {
43         return memcmp(m1, m2, size);
44 }
45
46
47 int DWC_STRNCMP(void *s1, void *s2, uint32_t size)
48 {
49         return strncmp(s1, s2, size);
50 }
51
52
53 int DWC_STRCMP(void *s1, void *s2)
54 {
55         return strcmp(s1, s2);
56 }
57
58
59 int DWC_STRLEN(char const *str)
60 {
61         return strlen(str);
62 }
63
64
65 char *DWC_STRCPY(char *to, const char *from)
66 {
67         return strcpy(to, from);
68 }
69
70
71 char *DWC_STRDUP(char const *str)
72 {
73         int len = DWC_STRLEN(str) + 1;
74         char *new = DWC_ALLOC_ATOMIC(len);
75         if (!new) {
76                 return NULL;
77         }
78         DWC_MEMCPY(new, str, len);
79         return new;
80 }
81
82
83 int DWC_ATOI(char *str, int32_t *value)
84 {
85         char *end = NULL;
86         *value = simple_strtol(str, &end, 0);
87         if (*end == '\0') {
88                 return 0;
89         }
90         return -1;
91 }
92
93
94 int DWC_ATOUI(char *str, uint32_t *value)
95 {
96         char *end = NULL;
97         *value = simple_strtoul(str, &end, 0);
98         if (*end == '\0') {
99                 return 0;
100         }
101         return -1;
102 }
103
104
105 /* dwc_debug.h */
106
107 dwc_bool_t DWC_IN_IRQ(void)
108 {
109         //return in_irq();
110         return 0;
111 }
112
113
114 void DWC_VPRINTF(char *format, va_list args)
115 {
116         vprintf(format, args);
117 }
118
119
120 int DWC_VSNPRINTF(char *str, int size, char *format, va_list args)
121 {
122         vsprintf(str, format, args);
123        return 0;
124 }
125
126 void DWC_PRINTF(char *format, ...)
127 {
128         va_list args;
129         va_start(args, format);
130         DWC_VPRINTF(format, args);
131         va_end(args);
132 }
133
134
135 int DWC_SPRINTF(char *buffer, char *format, ...)
136 {
137         int retval;
138         va_list args;
139         va_start(args, format);
140         retval = vsprintf(buffer, format, args);
141         va_end(args);
142         return retval;
143 }
144
145
146 int DWC_SNPRINTF(char *buffer, int size, char *format, ...)
147 {
148         int retval;
149         va_list args;
150         va_start(args, format);
151         retval = vsprintf(buffer, format, args);
152         va_end(args);
153         return retval;
154 }
155
156
157 void __DWC_WARN(char *format, ...)
158 {
159         va_list args;
160         va_start(args, format);
161         //DWC_PRINTF(KERN_WARNING);
162         DWC_VPRINTF(format, args);
163         va_end(args);
164 }
165
166
167 void __DWC_ERROR(char *format, ...)
168 {
169         va_list args;
170         va_start(args, format);
171         //DWC_PRINTF(KERN_ERR);
172         DWC_VPRINTF(format, args);
173         va_end(args);
174 }
175
176
177 void DWC_EXCEPTION(char *format, ...)
178 {
179         va_list args;
180         va_start(args, format);
181         //DWC_PRINTF(KERN_ERR);
182         DWC_VPRINTF(format, args);
183         va_end(args);
184         BUG_ON(1);
185 }
186
187
188 #ifdef DEBUG
189 void __DWC_DEBUG(char *format, ...)
190 {
191         va_list args;
192         va_start(args, format);
193         //DWC_PRINTF(KERN_DEBUG);
194         DWC_VPRINTF(format, args);
195         va_end(args);
196 }
197 #endif
198
199
200
201 /* dwc_mem.h */
202
203 void *__DWC_DMA_ALLOC(uint32_t size, dwc_dma_t *dma_addr)
204 {
205 /*
206         void *buf = dma_alloc_coherent(NULL, (size_t)size, dma_addr, GFP_KERNEL);
207         if (!buf) {
208                 return NULL;
209         }
210         memset(buf, 0, (size_t)size);
211 */
212         void * buf = NULL;
213         dwc_debug("NO SUPPORT %s\r\n", __func__);
214         return buf;
215 }
216
217 void __DWC_DMA_FREE(uint32_t size, void *virt_addr, dwc_dma_t dma_addr)
218 {
219         //dma_free_coherent(NULL, size, virt_addr, dma_addr);
220         dwc_debug("NO SUPPORT %s\r\n", __func__);
221 }
222
223 void *__DWC_ALLOC(uint32_t size)
224 {
225         //return kzalloc(size, GFP_KERNEL);
226         void * ptr;
227         ptr = malloc(size);
228         if(!ptr)
229                 return NULL;
230         else {
231                 memset(ptr, 0, size);
232                 return ptr;
233         }
234 }
235
236 void *__DWC_ALLOC_ATOMIC(uint32_t size)
237 {
238         //return kzalloc(size, GFP_ATOMIC);
239         return __DWC_ALLOC(size);
240 }
241
242 void __DWC_FREE(void *addr)
243 {
244         //kfree(addr);
245         free(addr);
246 }
247
248
249 /* Registers */
250
251 uint32_t DWC_READ_REG32(uint32_t volatile *reg)
252 {
253         return readl(reg);
254 }
255
256
257 void DWC_WRITE_REG32(uint32_t volatile *reg, uint32_t value)
258 {
259         writel(value, reg);
260 }
261
262
263 void DWC_MODIFY_REG32(uint32_t volatile *reg, uint32_t clear_mask, uint32_t set_mask)
264 {
265         writel( (readl(reg) & ~clear_mask) | set_mask, reg );
266 }
267
268 /* Threading */
269
270 typedef struct work_container
271 {
272         dwc_work_callback_t cb;
273         void *data;
274         dwc_workq_t *wq;
275         char *name;
276
277 #ifdef DEBUG
278         DWC_CIRCLEQ_ENTRY(work_container) entry;
279 #endif
280
281         //struct delayed_work work;
282 } work_container_t;
283
284 #ifdef DEBUG
285 DWC_CIRCLEQ_HEAD(work_container_queue, work_container);
286 #endif
287
288 struct dwc_workq
289 {
290         //struct workqueue_struct *wq;
291         int pending;
292         dwc_spinlock_t *lock;
293         dwc_waitq_t *waitq;
294
295 #ifdef DEBUG
296         struct work_container_queue entries;
297 #endif
298 };
299
300 #if 0
301 static void do_work(struct work_struct *work)
302 {
303         unsigned long flags;
304         struct delayed_work *dw = container_of(work, struct delayed_work, work);
305         work_container_t *container = container_of(dw, struct work_container, work);
306         dwc_workq_t *wq = container->wq;
307
308         container->cb(container->data);
309
310 #ifdef DEBUG
311         DWC_CIRCLEQ_REMOVE(&wq->entries, container, entry);
312 #endif
313
314         DWC_DEBUG("Work done: %s, container=%p", container->name, container);
315         if (container->name) {
316                 DWC_FREE(container->name);
317         }
318         DWC_FREE(container);
319
320         DWC_SPINLOCK_IRQSAVE(wq->lock, &flags);
321         wq->pending --;
322         DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags);
323         DWC_WAITQ_TRIGGER(wq->waitq);
324 }
325
326 static int work_done(void *data)
327 {
328         dwc_workq_t *workq = (dwc_workq_t *)data;
329         return workq->pending == 0;
330 }
331 #endif
332
333 int DWC_WORKQ_WAIT_WORK_DONE(dwc_workq_t *workq, int timeout)
334 {
335         dwc_debug("NO SUPPORT %s\r\n", __func__);
336        return 0;
337         //return DWC_WAITQ_WAIT_TIMEOUT(workq->waitq, work_done, workq, timeout);
338 }
339
340 dwc_workq_t *DWC_WORKQ_ALLOC(char *name)
341 {
342         dwc_debug("NO SUPPORT %s\r\n", __func__);
343         return NULL;
344 #if 0
345         dwc_workq_t *wq = DWC_ALLOC(sizeof(*wq));
346         wq->wq = create_singlethread_workqueue(name);
347         wq->pending = 0;
348         wq->lock = DWC_SPINLOCK_ALLOC();
349         wq->waitq = DWC_WAITQ_ALLOC();
350 #ifdef DEBUG
351         DWC_CIRCLEQ_INIT(&wq->entries);
352 #endif
353         return wq;
354 #endif
355 }
356
357 void DWC_WORKQ_FREE(dwc_workq_t *wq)
358 {
359 #if 0
360 #ifdef DEBUG
361         if (wq->pending != 0) {
362                 struct work_container *wc;
363                 DWC_ERROR("Destroying work queue with pending work");
364                 DWC_CIRCLEQ_FOREACH(wc, &wq->entries, entry) {
365                         DWC_ERROR("Work %s still pending", wc->name);
366                 }
367         }
368 #endif
369         destroy_workqueue((struct workqueue_struct *)wq->wq);
370         DWC_SPINLOCK_FREE(wq->lock);
371         DWC_WAITQ_FREE(wq->waitq);
372         DWC_FREE(wq);
373 #endif
374         dwc_debug("NO SUPPORT %s\r\n", __func__);
375 }
376
377 void DWC_WORKQ_SCHEDULE(dwc_workq_t *wq, dwc_work_callback_t work_cb, void *data, char *format, ...)
378 {
379         dwc_debug("NO SUPPORT %s\r\n", __func__);
380 #if 0
381         unsigned long flags;
382         work_container_t *container;
383         static char name[128];
384
385         va_list args;
386         va_start(args, format);
387         DWC_VSNPRINTF(name, 128, format, args);
388         va_end(args);
389
390         DWC_SPINLOCK_IRQSAVE(wq->lock, &flags);
391         wq->pending ++;
392         DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags);
393         DWC_WAITQ_TRIGGER(wq->waitq);
394
395         container = DWC_ALLOC_ATOMIC(sizeof(*container));
396
397         container->data = data;
398         container->cb = work_cb;
399         container->wq = wq;
400         container->name = DWC_STRDUP(name);
401         DWC_DEBUG("Queueing work: %s, contianer=%p", container->name, container);
402         INIT_WORK(&container->work.work, do_work);
403
404 #ifdef DEBUG
405         DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry);
406 #endif
407
408         queue_work(wq->wq, &container->work.work);
409 #endif
410 }
411
412 void DWC_WORKQ_SCHEDULE_DELAYED(dwc_workq_t *wq, dwc_work_callback_t work_cb, void *data, uint32_t time, char *format, ...)
413 {
414         dwc_debug("NO SUPPORT %s\r\n", __func__);
415 #if 0
416         unsigned long flags;
417         work_container_t *container;
418         static char name[128];
419
420         va_list args;
421         va_start(args, format);
422         DWC_VSNPRINTF(name, 128, format, args);
423         va_end(args);
424
425         DWC_SPINLOCK_IRQSAVE(wq->lock, &flags);
426         wq->pending ++;
427         DWC_SPINUNLOCK_IRQRESTORE(wq->lock, flags);
428         DWC_WAITQ_TRIGGER(wq->waitq);
429
430         container = DWC_ALLOC_ATOMIC(sizeof(*container));
431
432         container->data = data;
433         container->cb = work_cb;
434         container->wq = wq;
435         container->name = DWC_STRDUP(name);
436         DWC_DEBUG("Queueing work: %s, contianer=%p", container->name, container);
437         INIT_DELAYED_WORK(&container->work, do_work);
438
439 #ifdef DEBUG
440         DWC_CIRCLEQ_INSERT_TAIL(&wq->entries, container, entry);
441 #endif
442
443         queue_delayed_work(wq->wq, &container->work, msecs_to_jiffies(time));
444 #endif
445 }
446
447 int DWC_WORKQ_PENDING(dwc_workq_t *wq)
448 {
449         return wq->pending;
450 }
451
452 dwc_spinlock_t *DWC_SPINLOCK_ALLOC(void)
453 {
454         dwc_spinlock_t *sl = (dwc_spinlock_t *)1;
455 #if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP)
456         sl = DWC_ALLOC(sizeof(*sl));
457         spin_lock_init(sl);
458 #endif
459         return (dwc_spinlock_t *)sl;
460 }
461
462 void DWC_SPINLOCK_FREE(dwc_spinlock_t *lock)
463 {       
464 #if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP)
465         DWC_FREE(lock);
466 #endif
467 }
468
469 void DWC_SPINLOCK(dwc_spinlock_t *lock)
470 {
471 #if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP)
472         spin_lock((spinlock_t *)lock);
473 #endif
474 }
475
476 void DWC_SPINUNLOCK(dwc_spinlock_t *lock)
477 {
478 #if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP)
479         spin_unlock((spinlock_t *)lock);
480 #endif
481 }
482
483 void DWC_SPINLOCK_IRQSAVE(dwc_spinlock_t *lock, unsigned long *flags)
484 {
485         unsigned long f;
486 #if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP)
487         spin_lock_irqsave((spinlock_t *)lock, f);
488 #else
489         local_irq_save(f);
490 #endif
491         *flags = f;
492 }
493
494 void DWC_SPINUNLOCK_IRQRESTORE(dwc_spinlock_t *lock, unsigned long flags)
495 {
496 #if defined(CONFIG_PREEMPT) || defined(CONFIG_SMP)
497         spin_unlock_irqrestore((spinlock_t *)lock, flags);
498 #else
499         local_irq_restore(flags);
500 #endif
501 }
502
503 dwc_mutex_t *DWC_MUTEX_ALLOC(void)
504 {
505         dwc_debug("NO SUPPORT %s\r\n", __func__);
506 #if 0
507         dwc_mutex_t *mutex = (dwc_mutex_t*)DWC_ALLOC(sizeof(struct mutex));
508         struct mutex *m = (struct mutex *)mutex;
509         mutex_init(m);
510         return mutex;
511 #endif
512        return NULL;
513 }
514
515 #if (defined(DWC_LINUX) && defined(CONFIG_DEBUG_MUTEXES))
516 #else
517 void DWC_MUTEX_FREE(dwc_mutex_t *mutex)
518 {
519         dwc_debug("NO SUPPORT %s\r\n", __func__);
520 #if 0
521         mutex_destroy((struct mutex *)mutex);
522         DWC_FREE(mutex);
523 #endif
524 }
525 #endif
526
527 void DWC_MUTEX_LOCK(dwc_mutex_t *mutex)
528 {
529         dwc_debug("NO SUPPORT %s\r\n", __func__);
530 /*
531         struct mutex *m = (struct mutex *)mutex;
532         mutex_lock(m);
533 */
534 }
535
536
537 int DWC_MUTEX_TRYLOCK(dwc_mutex_t *mutex)
538 {
539         dwc_debug("NO SUPPORT %s\r\n", __func__);
540 /*
541         struct mutex *m = (struct mutex *)mutex;
542         return mutex_trylock(m);
543 */
544        return 0;
545 }
546
547
548 void DWC_MUTEX_UNLOCK(dwc_mutex_t *mutex)
549 {
550 /*
551         struct mutex *m = (struct mutex *)mutex;
552         mutex_unlock(m);
553 */
554 }
555
556
557 /* Timers */
558
559 struct dwc_timer
560 {
561         //struct timer_list *t;
562         char *name;
563         dwc_timer_callback_t cb;
564         void *data;
565         uint8_t scheduled;
566         dwc_spinlock_t *lock;
567 };
568
569 #if 0
570 static void set_scheduled(dwc_timer_t *t, int s)
571 {
572         unsigned long flags;
573         DWC_SPINLOCK_IRQSAVE(t->lock, &flags);
574         t->scheduled = s;
575         DWC_SPINUNLOCK_IRQRESTORE(t->lock, flags);
576 }
577
578 static int get_scheduled(dwc_timer_t *t)
579 {
580         int s;
581         unsigned long flags;
582         DWC_SPINLOCK_IRQSAVE(t->lock, &flags);
583         s = t->scheduled;
584         DWC_SPINUNLOCK_IRQRESTORE(t->lock, flags);
585         return s;
586 }
587
588 static void timer_callback(unsigned long data)
589 {
590         dwc_timer_t *timer = (dwc_timer_t *)data;
591         set_scheduled(timer, 0);
592         DWC_DEBUG("Timer %s callback", timer->name);
593         timer->cb(timer->data);
594 }
595
596 #endif
597
598 dwc_timer_t *DWC_TIMER_ALLOC(char *name, dwc_timer_callback_t cb, void *data)
599 {
600         dwc_debug("NO SUPPORT %s\r\n", __func__);
601
602 #if 0
603         dwc_timer_t *t = DWC_ALLOC(sizeof(*t));
604         if (!t) {
605                 DWC_ERROR("Cannot allocate memory for timer");
606                 return NULL;
607         }
608         t->t = DWC_ALLOC(sizeof(*t->t));
609         if (!t->t) {
610                 DWC_ERROR("Cannot allocate memory for timer->t");
611                 goto no_timer;
612         }
613
614         t->name = DWC_STRDUP(name);
615         if (!t->name) {
616                 DWC_ERROR("Cannot allocate memory for timer->name");
617                 goto no_name;
618         }
619
620         t->lock = DWC_SPINLOCK_ALLOC();
621         if (!t->lock) {
622                 DWC_ERROR("Cannot allocate memory for lock");
623                 goto no_lock;
624         }
625         t->scheduled = 0;
626         t->t->base = &boot_tvec_bases;
627         t->t->expires = jiffies;
628         setup_timer(t->t, timer_callback, (unsigned long)t);
629
630         t->cb = cb;
631         t->data = data;
632
633         return t;
634
635  no_lock:
636         DWC_FREE(t->name);
637  no_name:
638         DWC_FREE(t->t);
639  no_timer:
640         DWC_FREE(t);
641 #endif
642         return NULL;
643 }
644
645 void DWC_TIMER_FREE(dwc_timer_t *timer)
646 {
647         dwc_debug("NO SUPPORT %s\r\n", __func__);
648 #if 0
649         if (get_scheduled(timer)) {
650                 del_timer(timer->t);
651         }
652
653         DWC_SPINLOCK_FREE(timer->lock);
654         DWC_FREE(timer->t);
655         DWC_FREE(timer->name);
656         DWC_FREE(timer);
657 #endif
658 }
659
660 void DWC_TIMER_SCHEDULE(dwc_timer_t *timer, uint32_t time)
661 {
662         dwc_debug("NO SUPPORT %s\r\n", __func__);
663         
664 #if 0
665         if (!get_scheduled(timer)) {
666                 set_scheduled(timer, 1);
667                 DWC_DEBUG("Scheduling timer %s to expire in +%d msec", timer->name, time);
668                 timer->t->expires = jiffies + msecs_to_jiffies(time);
669                 add_timer(timer->t);
670         }
671         else {
672                 DWC_DEBUG("Modifying timer %s to expire in +%d msec", timer->name, time);
673                 mod_timer(timer->t, jiffies + msecs_to_jiffies(time));
674         }
675 #endif
676 }
677
678 void DWC_TIMER_CANCEL(dwc_timer_t *timer)
679 {
680         dwc_debug("NO SUPPORT %s\r\n", __func__);
681         //del_timer(timer->t);
682 }
683
684 struct dwc_tasklet
685 {
686 //      struct tasklet_struct t;
687         dwc_tasklet_callback_t cb;
688         void *data;
689 };
690
691 #if 0
692 static void tasklet_callback(unsigned long data)
693 {
694         dwc_tasklet_t *t = (dwc_tasklet_t *)data;
695         t->cb(t->data);
696 }
697 #endif
698
699 dwc_tasklet_t *DWC_TASK_ALLOC(dwc_tasklet_callback_t cb, void *data)
700 {
701         dwc_debug("NO SUPPORT %s\r\n", __func__);
702 #if 0
703         dwc_tasklet_t *t = DWC_ALLOC(sizeof(*t));
704
705         if(t) {
706                 t->data = data;
707                 t->cb = cb;
708                 tasklet_init(&t->t, tasklet_callback, (unsigned long)t);
709         } else {
710                 DWC_ERROR("Cannot allocate memory for tasklet\n");
711         }
712
713         return t;
714 #endif
715         return NULL;
716 }
717
718 void DWC_TASK_FREE(dwc_tasklet_t *t)
719 {
720         dwc_debug("NO SUPPORT %s\r\n", __func__);
721         //DWC_FREE(t);
722 }
723
724 void DWC_TASK_SCHEDULE(dwc_tasklet_t *task)
725 {
726         dwc_debug("NO SUPPORT %s\r\n", __func__);
727 //      tasklet_schedule(&task->t);
728 }
729 /* Timing */
730
731 void DWC_UDELAY(uint32_t usecs)
732 {
733         udelay(usecs);
734 }
735
736 void DWC_MDELAY(uint32_t msecs)
737 {
738         //mdelay(msecs);
739         udelay(msecs * 1000);
740 }
741
742 void DWC_MSLEEP(uint32_t msecs)
743 {
744         //msleep(msecs);
745         DWC_MDELAY(msecs);
746 }
747
748 uint32_t DWC_TIME(void)
749 {
750         dwc_debug("NO SUPPORT %s\r\n", __func__);
751         //return jiffies_to_msecs(jiffies);
752        return 0;
753 }
754
755
756 /* Wait Queues */
757
758 struct dwc_waitq
759 {
760 //      wait_queue_head_t queue;
761         int abort;
762 };
763
764 dwc_waitq_t *DWC_WAITQ_ALLOC(void)
765 {
766         dwc_debug("NO SUPPORT %s\r\n", __func__);
767 #if 0
768         dwc_waitq_t *wq = DWC_ALLOC(sizeof(*wq));
769         init_waitqueue_head(&wq->queue);
770         wq->abort = 0;
771         return wq;
772 #endif
773         return NULL;
774 }
775
776 void DWC_WAITQ_FREE(dwc_waitq_t *wq)
777 {
778         dwc_debug("NO SUPPORT %s\r\n", __func__);
779         //DWC_FREE(wq);
780 }
781
782 #if 0
783 static int32_t check_result(dwc_waitq_t *wq, int result)
784 {       int32_t msecs;
785         if (result > 0) {
786                 msecs = jiffies_to_msecs(result);
787                 if (!msecs) {
788                         return 1;
789                 }
790                 return msecs;
791         }
792
793         if (result == 0) {
794                 return -DWC_E_TIMEOUT;
795         }
796
797         if ((result == -ERESTARTSYS) || (wq->abort == 1)) {
798                 return -DWC_E_ABORT;
799         }
800
801         return -DWC_E_UNKNOWN;
802 }
803 #endif
804
805 int32_t DWC_WAITQ_WAIT(dwc_waitq_t *wq, dwc_waitq_condition_t condition, void *data)
806 {
807         dwc_debug("NO SUPPORT %s\r\n", __func__);
808 #if 0
809         int result = wait_event_interruptible(wq->queue,
810                                                   condition(data) || wq->abort);
811         return check_result(wq, result);
812 #endif 
813         return 0;
814 }
815
816 int32_t DWC_WAITQ_WAIT_TIMEOUT(dwc_waitq_t *wq, dwc_waitq_condition_t condition,
817                                void *data, int32_t msecs)
818 {
819         dwc_debug("NO SUPPORT %s\r\n", __func__);
820
821 #if 0
822         int result = wait_event_interruptible_timeout(wq->queue,
823                                                           condition(data) || wq->abort,
824                                                           msecs_to_jiffies(msecs));
825         return check_result(wq, result);
826 #endif
827         return 0;
828 }
829
830 void DWC_WAITQ_TRIGGER(dwc_waitq_t *wq)
831 {
832         dwc_debug("NO SUPPORT %s\r\n", __func__);
833 //      wake_up_interruptible(&wq->queue);
834 }
835
836 void DWC_WAITQ_ABORT(dwc_waitq_t *wq)
837 {
838         dwc_debug("NO SUPPORT %s\r\n", __func__);
839         /*
840         wq->abort = 1;
841         DWC_WAITQ_TRIGGER(wq);
842         */
843 }