Make the tcc usb driver compile without warnings. No functional changes
[kugel-rb.git] / firmware / target / arm / usb-tcc.c
blob9d5ae2d50a1fe068d38879f54a2aefed42a8d3c6
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 by Vitja Makarov
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "config.h"
23 #include "usb.h"
25 #include "usb-tcc.h"
27 #include "cpu.h"
28 #include "system.h"
29 #include "kernel.h"
30 #include "panic.h"
32 #ifdef HAVE_USBSTACK
33 #include "usb_ch9.h"
34 #include "usb_core.h"
36 #define TCC7xx_USB_EPIF_IRQ_MASK 0xf
38 static int dbg_level = 0x00;
39 static int global_ep_irq_mask = 0x1;
40 #define DEBUG(level, fmt, args...) do { if (dbg_level & (level)) printf(fmt, ## args); } while (0)
42 #include <inttypes.h>
45 #include "sprintf.h"
46 #include "power.h"
48 #ifndef BOOTLOADER
49 #define printf(...) do {} while (0)
50 #define panicf_my panicf
51 #else
52 int printf(const char *fmt, ...);
53 #define panicf_my(fmt, args...) { \
54 int flags = disable_irq_save(); \
55 printf("*** PANIC ***"); \
56 printf(fmt, ## args); \
57 printf("*** PANIC ***"); \
58 while (usb_detect() == USB_INSERTED) \
59 ; \
60 power_off(); \
61 while(1); \
62 restore_irq(flags); \
64 #endif
66 struct tcc_ep {
67 unsigned char dir; /* endpoint direction */
68 volatile uint16_t *ep; /* hw ep buffer */
69 int id; /* Endpoint id */
70 int mask; /* Endpoint bit mask */
71 char *buf; /* user buffer to store data */
72 int max_len; /* how match data will fit */
73 int count; /* actual data count */
74 bool busy;
75 } ;
77 static struct tcc_ep tcc_endpoints[] = {
78 /* control */
80 .dir = -1,
81 .ep = &TCC7xx_USB_EP0_BUF,
82 }, { /* bulk */
83 .dir = -1,
84 .ep = &TCC7xx_USB_EP1_BUF,
85 }, { /* bulk */
86 .dir = -1,
87 .ep = &TCC7xx_USB_EP2_BUF,
88 }, { /* interrupt */
89 .dir = -1,
90 .ep = &TCC7xx_USB_EP3_BUF,
92 } ;
94 static bool usb_drv_write_ep(struct tcc_ep *ep);
95 static void usb_set_speed(int);
97 int usb_drv_request_endpoint(int type, int dir)
99 int flags = disable_irq_save();
100 size_t ep;
101 int ret = 0;
103 if (type != USB_ENDPOINT_XFER_BULK)
104 return -1;
106 if (dir == USB_DIR_IN)
107 ep = 1;
108 else
109 ep = 2;
111 if (!tcc_endpoints[ep].busy) {
112 tcc_endpoints[ep].busy = true;
113 tcc_endpoints[ep].dir = dir;
114 ret = ep | dir;
115 } else {
116 ret = -1;
119 restore_irq(flags);
120 return ret;
123 void usb_drv_release_endpoint(int ep)
125 int flags;
126 ep = ep & 0x7f;
128 if (ep < 1 || ep > USB_NUM_ENDPOINTS)
129 return ;
131 flags = disable_irq_save();
133 tcc_endpoints[ep].busy = false;
134 tcc_endpoints[ep].dir = -1;
136 restore_irq(flags);
139 static inline void pullup_on(void)
141 TCC7xx_USB_PHY_CFG = 0x000c;
144 static inline void pullup_off(void)
146 TCC7xx_USB_PHY_CFG = 0x3e4c;
149 #if 0
150 static
151 char *dump_data(char *data, int count)
153 static char buf[1024];
154 char *dump = buf;
155 int i;
157 for (i = 0; i < count; i++)
158 dump += snprintf(dump, sizeof(buf) - (dump - buf), "%02x", data[i]);
159 return buf;
161 #endif
163 static
164 void handle_control(void)
166 /* control are always 8 bytes len */
167 static unsigned char ep_control[8];
168 struct usb_ctrlrequest *req =
169 (struct usb_ctrlrequest *) ep_control;
170 unsigned short stat;
171 unsigned short count = 0;
172 int i;
173 int type;
175 /* select control endpoint */
176 TCC7xx_USB_INDEX = 0x00;
177 stat = TCC7xx_USB_EP0_STAT;
179 if (stat & 0x10) {
180 DEBUG(2, "stall");
181 TCC7xx_USB_EP0_STAT = 0x10;
184 if (TCC7xx_USB_EP0_STAT & 0x01) { /* RX */
185 uint16_t *ptr = (uint16_t *) ep_control;
187 count = TCC7xx_USB_EP_BRCR;
189 if (TCC7xx_USB_EP0_STAT & 0x2)
190 TCC7xx_USB_EP0_STAT = 0x02;
192 if (count != 4) { /* bad control? */
193 unsigned short dummy;
195 while (count--)
196 dummy = TCC7xx_USB_EP0_BUF;
197 DEBUG(1, "WTF: count = %d", count);
198 } else {
199 /* simply read control packet */
200 for (i = 0; i < count; i++)
201 ptr[i] = TCC7xx_USB_EP0_BUF;
204 count *= 2;
205 TCC7xx_USB_EP0_STAT = 0x01;
206 DEBUG(1, "CTRL: len = %d %04x", count, stat);
207 } else if (TCC7xx_USB_EP0_STAT & 0x02) { /* TX */
208 TCC7xx_USB_EP0_STAT = 0x02;
209 DEBUG(2, "TX Done\n");
210 } else {
211 DEBUG(1, "stat: %04x", stat);
214 TCC7xx_USB_EPIF = 1;
216 if (0 == (stat & 0x1) || count != 8)
217 return ;
218 #if 1 /* TODO: remove me someday */
220 int i;
221 uint16_t *ptr = (uint16_t *) ep_control;
222 for (i = 1; i < (count>>1); i++) {
223 if (ptr[i] != ptr[0])
224 break;
226 if (i == (count>>1)) {
227 /*DEBUG(2, */panicf_my("sanity failed");
228 return ;
231 #endif
232 type = req->bRequestType;
234 /* TODO: don't pass some kinds of requests to upper level */
235 switch (req->bRequest) {
236 case USB_REQ_CLEAR_FEATURE:
237 DEBUG(2, "USB_REQ_CLEAR_FEATURE");
238 DEBUG(2, "...%04x %04x", req->wValue, req->wIndex);
239 break;
240 case USB_REQ_SET_ADDRESS:
241 //DEBUG(2, "USB_REQ_SET_ADDRESS, %d %d", req->wValue, TCC7xx_USB_FUNC);
242 /* seems we don't have to set it manually
243 TCC7xx_USB_FUNC = req->wValue; */
244 break;
245 case USB_REQ_GET_DESCRIPTOR:
246 DEBUG(2, "gd, %02x %02x", req->wValue, req->wIndex);
247 break;
248 case USB_REQ_GET_CONFIGURATION:
249 DEBUG(2, "USB_REQ_GET_CONFIGURATION");
250 break;
251 default:
252 DEBUG(2, "req: %02x %02d", req->bRequestType, req->bRequest);
255 usb_core_control_request(req);
258 static
259 void handle_ep_in(struct tcc_ep *tcc_ep, uint16_t stat)
261 uint8_t *buf = tcc_ep->buf;
262 uint16_t *wbuf = (uint16_t *) buf;
263 int wcount;
264 int count;
265 int i;
267 if (tcc_ep->dir != USB_DIR_OUT) {
268 panicf_my("ep%d: is input only", tcc_ep->id);
271 wcount = TCC7xx_USB_EP_BRCR;
273 DEBUG(2, "ep%d: %04x %04x", tcc_ep->id, stat, wcount);
275 /* read data */
276 count = wcount * 2;
277 if (stat & TCC7xx_USP_EP_STAT_LWO) {
278 count--;
279 wcount--;
282 if (buf == NULL)
283 panicf_my("ep%d: Unexpected packet! %d %x", tcc_ep->id, count, TCC7xx_USB_EP_CTRL);
284 if (tcc_ep->max_len < count)
285 panicf_my("Too big packet: %d excepted %d %x", count, tcc_ep->max_len, TCC7xx_USB_EP_CTRL);
287 for (i = 0; i < wcount; i++)
288 wbuf[i] = *tcc_ep->ep;
290 if (count & 1) { /* lwo */
291 uint16_t tmp = *tcc_ep->ep;
292 buf[count - 1] = tmp & 0xff;
295 tcc_ep->buf = NULL;
297 TCC7xx_USB_EP_STAT = TCC7xx_USB_EP_STAT;
298 TCC7xx_USB_EPIF = tcc_ep->mask;
299 TCC7xx_USB_EPIE &= ~tcc_ep->mask; /* TODO: use INGLD? */
300 global_ep_irq_mask &= ~tcc_ep->mask;
302 if (TCC7xx_USB_EP_STAT & 0x1)
303 panicf_my("One more packet?");
305 TCC7xx_USB_EP_CTRL |= TCC7xx_USB_EP_CTRL_OUTHD;
307 usb_core_transfer_complete(tcc_ep->id, USB_DIR_OUT, 0, count);
310 static
311 void handle_ep_out(struct tcc_ep *tcc_ep, uint16_t stat)
313 bool done;
314 (void) stat;
316 if (tcc_ep->dir != USB_DIR_IN) {
317 panicf_my("ep%d: is out only", tcc_ep->id);
320 // if (tcc_ep->buf == NULL) {
321 // panicf_my("%s:%d", __FILE__, __LINE__);
322 // }
324 done = usb_drv_write_ep(tcc_ep);
326 // TCC7xx_USB_EP_STAT = 0x2; /* Clear TX stat */
327 TCC7xx_USB_EPIF = tcc_ep->mask;
329 if (done) { // tcc_ep->buf == NULL) {
330 TCC7xx_USB_EPIE &= ~tcc_ep->mask;
331 global_ep_irq_mask &= ~tcc_ep->mask;
333 // usb_core_transfer_complete(tcc_ep->id, USB_DIR_IN, 0, tcc_ep->count);
337 static
338 void handle_ep(unsigned short ep_irq)
340 if (ep_irq & 0x1) {
341 handle_control();
344 if (ep_irq & 0xe) {
345 int endpoint;
347 for (endpoint = 1; endpoint < 4; endpoint++) {
348 struct tcc_ep *tcc_ep = &tcc_endpoints[endpoint];
349 uint16_t stat;
351 if (0 == (ep_irq & (1 << endpoint)))
352 continue;
353 if (!tcc_ep->busy)
354 panicf_my("ep%d: wasn't requested", endpoint);
356 TCC7xx_USB_INDEX = endpoint;
357 stat = TCC7xx_USB_EP_STAT;
359 DEBUG(1, "ep%d: %04x", endpoint, stat);
361 if (stat & 0x1)
362 handle_ep_in(tcc_ep, stat);
363 else if (stat & 0x2)
364 handle_ep_out(tcc_ep, stat);
365 else /* TODO: remove me? */
366 panicf_my("Unhandled ep%d state: %x, %d", endpoint, TCC7xx_USB_EP_STAT, TCC7xx_USB_INDEX);
371 static void usb_set_speed(int high_speed)
373 TCC7xx_USB_EP_DIR = 0x0000;
375 /* control endpoint */
376 TCC7xx_USB_INDEX = 0;
377 TCC7xx_USB_EP0_CTRL = 0x0000;
378 TCC7xx_USB_EP_MAXP = 64;
379 TCC7xx_USB_EP_CTRL = TCC7xx_USB_EP_CTRL_CDP | TCC7xx_USB_EP_CTRL_FLUSH;
381 /* ep1: bulk-in, to host */
382 TCC7xx_USB_INDEX = 1;
383 TCC7xx_USB_EP_DIR |= (1 << 1);
384 TCC7xx_USB_EP_CTRL = TCC7xx_USB_EP_CTRL_CDP;
386 if (high_speed)
387 TCC7xx_USB_EP_MAXP = 512;
388 else
389 TCC7xx_USB_EP_MAXP = 64;
391 TCC7xx_USB_EP_DMA_CTRL = 0x0;
393 /* ep2: bulk-out, from host */
394 TCC7xx_USB_INDEX = 2;
395 TCC7xx_USB_EP_DIR &= ~(1 << 2);
396 TCC7xx_USB_EP_CTRL = TCC7xx_USB_EP_CTRL_CDP;
398 if (high_speed)
399 TCC7xx_USB_EP_MAXP = 512;
400 else
401 TCC7xx_USB_EP_MAXP = 64;
403 TCC7xx_USB_EP_DMA_CTRL = 0x0;
405 /* ep3: interrupt in */
406 TCC7xx_USB_INDEX = 3;
407 TCC7xx_USB_EP_DIR &= ~(1 << 3);
408 TCC7xx_USB_EP_CTRL = TCC7xx_USB_EP_CTRL_CDP;
409 TCC7xx_USB_EP_MAXP = 64;
411 TCC7xx_USB_EP_DMA_CTRL = 0x0;
415 Reset TCC7xx usb device
417 static void usb_reset(void)
419 pullup_on();
421 TCC7xx_USB_DELAY_CTRL |= 0x81;
423 TCC7xx_USB_SYS_CTRL = 0xa000 |
424 TCC7xx_USB_SYS_CTRL_RESET |
425 TCC7xx_USB_SYS_CTRL_RFRE |
426 TCC7xx_USB_SYS_CTRL_SPDEN |
427 TCC7xx_USB_SYS_CTRL_VBONE |
428 TCC7xx_USB_SYS_CTRL_VBOFE;
430 usb_set_speed(1);
431 pullup_on();
433 TCC7xx_USB_EPIF = TCC7xx_USB_EPIF_IRQ_MASK;
434 global_ep_irq_mask = 0x1;
435 TCC7xx_USB_EPIE = global_ep_irq_mask;
437 usb_core_bus_reset();
440 /* IRQ handler */
441 void USB_DEVICE(void)
443 unsigned short sys_stat;
444 unsigned short ep_irq;
445 unsigned short index_save;
447 sys_stat = TCC7xx_USB_SYS_STAT;
449 if (sys_stat & TCC7xx_USB_SYS_STAT_RESET) {
450 TCC7xx_USB_SYS_STAT = TCC7xx_USB_SYS_STAT_RESET;
451 usb_reset();
452 TCC7xx_USB_SYS_CTRL |= TCC7xx_USB_SYS_CTRL_SUSPEND;
453 DEBUG(2, "reset");
456 if (sys_stat & TCC7xx_USB_SYS_STAT_RESUME) {
457 TCC7xx_USB_SYS_STAT = TCC7xx_USB_SYS_STAT_RESUME;
458 usb_reset();
459 TCC7xx_USB_SYS_CTRL |= TCC7xx_USB_SYS_CTRL_SUSPEND;
460 DEBUG(2, "resume");
463 if (sys_stat & TCC7xx_USB_SYS_STAT_SPD_END) {
464 usb_set_speed(1);
465 TCC7xx_USB_SYS_STAT = TCC7xx_USB_SYS_STAT_SPD_END;
466 DEBUG(2, "spd end");
469 if (sys_stat & TCC7xx_USB_SYS_STAT_ERRORS) {
470 DEBUG(2, "errors: %4x", sys_stat & TCC7xx_USB_SYS_STAT_ERRORS);
471 TCC7xx_USB_SYS_STAT = sys_stat & TCC7xx_USB_SYS_STAT_ERRORS;
474 // TCC7xx_USB_SYS_STAT = sys_stat;
476 index_save = TCC7xx_USB_INDEX;
478 ep_irq = TCC7xx_USB_EPIF & global_ep_irq_mask;
480 while (ep_irq & TCC7xx_USB_EPIF_IRQ_MASK) {
481 handle_ep(ep_irq);
483 /* is that really needed, btw not a problem for rockbox */
484 udelay(50);
485 ep_irq = TCC7xx_USB_EPIF & global_ep_irq_mask;
488 TCC7xx_USB_INDEX = index_save;
491 void usb_drv_set_address(int address)
493 (void) address;
494 DEBUG(2, "setting address %d %d", address, TCC7xx_USB_FUNC);
497 int usb_drv_port_speed(void)
499 return (TCC7xx_USB_SYS_STAT & 0x10) ? 1 : 0;
502 static int usb_drv_write_packet(volatile unsigned short *buf, unsigned char *data, int len, int max)
504 uint16_t *wbuf = (uint16_t *) data;
505 int count, i;
507 len = MIN(len, max);
508 count = (len + 1) / 2;
510 TCC7xx_USB_EP_BWCR = len;
512 for (i = 0; i < count; i++)
513 *buf = *wbuf++;
515 return len;
518 static bool usb_drv_write_ep(struct tcc_ep *ep)
520 int count;
522 if (ep->max_len == 0)
523 return true;
525 count = usb_drv_write_packet(ep->ep, ep->buf, ep->max_len, 512);
526 TCC7xx_USB_EP_STAT = 0x2; /* Clear TX stat */
528 ep->buf += count;
529 ep->count += count;
530 ep->max_len -= count;
532 if (ep->max_len == 0) {
533 usb_core_transfer_complete(ep->id, USB_DIR_IN, 0, ep->count);
534 ep->buf = NULL;
535 // return true;
538 return false;
541 int usb_drv_send(int endpoint, void *ptr, int length)
543 int flags = disable_irq_save();
544 int rc = 0;
545 char *data = (unsigned char*) ptr;
547 DEBUG(2, "%s(%d,%d)" , __func__, endpoint, length);
549 if (endpoint != 0)
550 panicf_my("%s(%d,%d)", __func__, endpoint, length);
552 TCC7xx_USB_INDEX = 0;
553 while (length > 0) {
554 int ret;
556 ret = usb_drv_write_packet(&TCC7xx_USB_EP0_BUF, data, length, 64);
557 length -= ret;
558 data += ret;
560 while (0 == (TCC7xx_USB_EP0_STAT & 0x2))
562 TCC7xx_USB_EP0_STAT = 0x2;
565 restore_irq(flags);
566 return rc;
570 int usb_drv_send_nonblocking(int endpoint, void *ptr, int length)
572 int flags;
573 int rc = 0, count = length;
574 char *data = (unsigned char*) ptr;
575 struct tcc_ep *ep = &tcc_endpoints[endpoint & 0x7f];
577 if (ep->dir != USB_DIR_IN || length == 0)
578 panicf_my("%s(%d,%d): Not supported", __func__, endpoint, length);
580 DEBUG(2, "%s(%d,%d):", __func__, endpoint, length);
582 flags = disable_irq_save();
584 if(ep->buf != NULL) {
585 panicf_my("%s: ep is already busy", __func__);
588 ep->buf = data;
589 ep->max_len = length;
590 ep->count = count;
592 TCC7xx_USB_INDEX = ep->id;
593 #if 1
594 TCC7xx_USB_EP_STAT = 0x2;
595 /* TODO: use interrupts instead */
596 while (!usb_drv_write_ep(ep)) {
597 while (0==(TCC7xx_USB_EP_STAT & 0x2))
600 #else
601 if (!usb_drv_write_ep(ep)) {
602 TCC7xx_USB_EPIE |= ep->mask;
603 global_ep_irq_mask |= ep->mask;
605 #endif
606 restore_irq(flags);
608 DEBUG(2, "%s end", __func__);
610 return rc;
613 int usb_drv_recv(int endpoint, void* ptr, int length)
615 volatile struct tcc_ep *tcc_ep = &tcc_endpoints[endpoint & 0x7f];
616 int flags;
618 if (length == 0) {
619 if (endpoint != 0)
620 panicf_my("%s(%d,%d) zero length?", __func__, endpoint, length);
621 return 0;
623 // TODO: check ep
624 if (tcc_ep->dir != USB_DIR_OUT)
625 panicf_my("%s(%d,%d)", __func__, endpoint, length);
627 DEBUG(2, "%s(%d,%d)", __func__, endpoint, length);
629 flags = disable_irq_save();
631 if (tcc_ep->buf) {
632 panicf_my("%s: overrun: %x %x", __func__,
633 (unsigned int)tcc_ep->buf, (unsigned int)tcc_ep);
636 tcc_ep->buf = ptr;
637 tcc_ep->max_len = length;
638 tcc_ep->count = 0;
640 TCC7xx_USB_INDEX = tcc_ep->id;
642 TCC7xx_USB_EP_CTRL &= ~TCC7xx_USB_EP_CTRL_OUTHD;
643 TCC7xx_USB_EPIE |= tcc_ep->mask;
644 global_ep_irq_mask |= tcc_ep->mask;
646 restore_irq(flags);
648 return 0;
651 void usb_drv_cancel_all_transfers(void)
653 int endpoint;
654 int flags;
656 DEBUG(2, "%s", __func__);
658 flags = disable_irq_save();
659 for (endpoint = 0; endpoint < 4; endpoint++) {
660 if (tcc_endpoints[endpoint].buf) {
661 /* usb_core_transfer_complete(tcc_endpoints[endpoint].id,
662 tcc_endpoints[endpoint].dir, -1, 0); */
663 tcc_endpoints[endpoint].buf = NULL;
667 global_ep_irq_mask = 1;
668 TCC7xx_USB_EPIE = global_ep_irq_mask;
669 TCC7xx_USB_EPIF = TCC7xx_USB_EPIF_IRQ_MASK;
670 restore_irq(flags);
673 void usb_drv_set_test_mode(int mode)
675 panicf_my("%s(%d)", __func__, mode);
678 bool usb_drv_stalled(int endpoint, bool in)
680 panicf_my("%s(%d,%d)", __func__, endpoint, in);
681 return false;
684 void usb_drv_stall(int endpoint, bool stall,bool in)
686 (void) endpoint;
687 (void) stall;
688 (void) in;
689 printf("%s(%d,%d,%d)", __func__, endpoint, stall, in);
692 void usb_drv_init(void)
694 size_t i;
696 DEBUG(2, "%s", __func__);
698 for (i = 0; i < sizeof(tcc_endpoints)/sizeof(struct tcc_ep); i++) {
699 tcc_endpoints[i].id = i;
700 tcc_endpoints[i].mask = 1 << i;
701 tcc_endpoints[i].buf = NULL;
702 tcc_endpoints[i].busy = false;
703 tcc_endpoints[i].dir = -1;
706 /* Enable USB clock */
707 BCLKCTR |= DEV_USBD;
709 /* switch USB to host and then reset */
710 TCC7xx_USB_PHY_CFG = 0x3e4c;
711 SWRESET |= DEV_USBD;
712 udelay(50);
713 SWRESET &= ~DEV_USBD;
715 usb_reset();
717 /* unmask irq */
718 CREQ = USBD_IRQ_MASK;
719 IRQSEL |= USBD_IRQ_MASK;
720 TMODE &= ~USBD_IRQ_MASK;
721 IEN |= USBD_IRQ_MASK;
724 void usb_drv_exit(void)
726 TCC7xx_USB_EPIE = 0;
727 BCLKCTR &= ~DEV_USBD;
729 SWRESET |= DEV_USBD;
730 udelay(50);
731 SWRESET &= ~DEV_USBD;
733 pullup_off();
736 void usb_init_device(void)
740 void usb_enable(bool on)
742 if (on)
743 usb_core_init();
744 else
745 usb_core_exit();
748 void usb_attach(void)
750 usb_enable(true);
753 int usb_detect(void)
755 /* TODO: not correct for all targets, we should poll VBUS
756 signal on USB bus. */
757 if (charger_inserted())
758 return USB_INSERTED;
759 return USB_EXTRACTED;
762 #ifdef BOOTLOADER
763 #include "ata.h"
764 void usb_test(void)
766 int rc;
768 printf("ATA");
769 rc = ata_init();
771 if(rc) {
772 panicf("ata_init failed");
775 usb_init();
776 usb_start_monitoring();
777 usb_acknowledge(SYS_USB_CONNECTED_ACK);
779 while (1) {
780 sleep(HZ);
781 // usb_serial_send("Hello\r\n", 7);
784 #endif
785 #else
786 void usb_init_device(void)
788 /* simply switch USB off for now */
789 BCLKCTR |= DEV_USBD;
790 TCC7xx_USB_PHY_CFG = 0x3e4c;
791 BCLKCTR &= ~DEV_USBD;
794 void usb_enable(bool on)
796 (void)on;
799 /* Always return false for now */
800 int usb_detect(void)
802 return USB_EXTRACTED;
804 #endif