18 #include <linux/module.h>
19 #include <linux/kernel.h>
21 #include <linux/types.h>
22 #include <linux/errno.h>
24 #include <linux/slab.h>
27 #include <linux/list.h>
33 #include <linux/usb/ch9.h>
39 #include <linux/prefetch.h>
42 #include <asm/byteorder.h>
44 #include <asm/unaligned.h>
61 #define DRIVER_DESC "OMAP UDC driver"
62 #define DRIVER_VERSION "4 October 2004"
85 static unsigned fifo_mode = 3;
87 static unsigned fifo_mode;
130 static inline void deselect_ep(
void)
144 static int omap_ep_enable(
struct usb_ep *_ep,
156 || ep->
maxpacket < usb_endpoint_maxp(desc)) {
157 DBG(
"%s, bad ep or descriptor\n", __func__);
160 maxp = usb_endpoint_maxp(desc);
163 || usb_endpoint_maxp(desc) > ep->
maxpacket
165 DBG(
"%s, bad %s maxpacket\n", __func__, _ep->
name);
173 DBG(
"%s, unsupported ISO period %dms\n", _ep->
name,
179 DBG(
"%s, ISO nyet\n", _ep->
name);
188 DBG(
"%s, %s type mismatch\n", __func__, _ep->
name);
194 DBG(
"%s, bogus device state\n", __func__);
203 ep->
ep.maxpacket = maxp;
215 list_add(&ep->
iso, &udc->
iso);
220 dma_channel_claim(ep, 0);
230 spin_unlock_irqrestore(&udc->
lock, flags);
237 static int omap_ep_disable(
struct usb_ep *_ep)
242 if (!_ep || !ep->
ep.desc) {
243 DBG(
"%s, %s not enabled\n", __func__,
244 _ep ? ep->
ep.name :
NULL);
254 list_del_init(&ep->
iso);
257 spin_unlock_irqrestore(&ep->
udc->lock, flags);
266 omap_alloc_request(
struct usb_ep *ep,
gfp_t gfp_flags)
270 req = kzalloc(
sizeof(*req), gfp_flags);
274 INIT_LIST_HEAD(&req->
queue);
295 list_del_init(&req->
queue);
300 status = req->
req.status;
309 VDBG(
"complete %s req %p stat %d len %u/%u\n",
310 ep->
ep.name, &req->
req, status,
311 req->
req.actual, req->
req.length);
315 spin_unlock(&ep->
udc->lock);
316 req->
req.complete(&ep->
ep, &req->
req);
317 spin_lock(&ep->
udc->lock);
323 #define UDC_FIFO_FULL (UDC_NON_ISO_FIFO_FULL | UDC_ISO_FIFO_FULL)
324 #define UDC_FIFO_UNWRITABLE (UDC_EP_HALTED | UDC_FIFO_FULL)
326 #define FIFO_EMPTY (UDC_NON_ISO_FIFO_EMPTY | UDC_ISO_FIFO_EMPTY)
327 #define FIFO_UNREADABLE (UDC_EP_HALTED | FIFO_EMPTY)
335 len =
min(req->
req.length - req->
req.actual, max);
336 req->
req.actual += len;
339 if (
likely((((
int)buf) & 1) == 0)) {
363 buf = req->
req.buf + req->
req.actual;
371 count = ep->
ep.maxpacket;
372 count = write_packet(buf, req, count);
377 if (count != ep->
ep.maxpacket)
379 else if (req->
req.length == req->
req.actual
400 len =
min(req->
req.length - req->
req.actual, avail);
401 req->
req.actual += len;
404 if (
likely((((
int)buf) & 1) == 0)) {
424 buf = req->
req.buf + req->
req.actual;
440 avail = ep->
ep.maxpacket;
445 count = read_packet(buf, req, avail);
451 if (count != avail) {
457 }
else if (req->
req.length == req->
req.actual)
487 end |= start & (0xffff << 16);
501 end |= start & (0xffff << 16);
529 length, 1, sync_mode, dma_trigger, 0);
535 ep->
ep.maxpacket >> 1, length, sync_mode,
552 static void finish_in_dma(
struct omap_ep *ep,
struct omap_req *req,
int status)
560 if (req->
req.actual < req->
req.length)
567 req->
req.actual += dma_src_len(ep, req->
req.dma
575 done(ep, req, status);
585 packets /= ep->
ep.maxpacket;
589 ep->
ep.maxpacket >> 1, packets,
614 count = dma_dest_len(ep, req->
req.dma + req->
req.actual);
615 count += req->
req.actual;
618 if (count <= req->req.length)
625 else if (req->
req.actual < req->
req.length)
632 done(ep, req, status);
635 static void dma_irq(
struct omap_udc *udc,
u16 irq_src)
646 if (!list_empty(&ep->
queue)) {
649 finish_in_dma(ep, req, 0);
653 if (!list_empty(&ep->
queue)) {
656 next_in_dma(ep, req);
665 if (!list_empty(&ep->
queue)) {
672 if (!list_empty(&ep->
queue)) {
675 next_out_dma(ep, req);
683 VDBG(
"%s, RX_CNT irq?\n", ep->
ep.name);
688 static void dma_error(
int lch,
u16 ch_status,
void *
data)
694 ERR(
"%s dma error, lch %d status %02x\n", ep->
ep.name, lch, ch_status);
699 static void dma_channel_claim(
struct omap_ep *ep,
unsigned channel)
714 if (channel == 0 || channel > 3) {
715 if ((reg & 0x0f00) == 0)
717 else if ((reg & 0x00f0) == 0)
719 else if ((reg & 0x000f) == 0)
732 ep->
ep.name, dma_error, ep, &ep->
lch);
749 ep->
ep.name, dma_error, ep, &ep->
lch);
780 DBG(
"%s no dma channel: %d%s\n", ep->
ep.name, status,
781 restart ?
" (restart)" :
"");
783 DBG(
"%s claimed %cxdma%d lch %d%s\n", ep->
ep.name,
786 restart ?
" (restart)" :
"");
792 (is_in ? next_in_dma : next_out_dma)(ep, req);
795 (is_in ? write_fifo : read_fifo)(ep, req);
806 static void dma_channel_release(
struct omap_ep *ep)
814 if (!list_empty(&ep->
queue))
821 DBG(
"%s release %s %cxdma%d %p\n", ep->
ep.name,
822 active ?
"active" :
"idle",
874 if (!_req || !req->
req.complete || !req->
req.buf
875 || !list_empty(&req->
queue)) {
876 DBG(
"%s, bad params\n", __func__);
880 DBG(
"%s, bad ep\n", __func__);
884 if (req->
req.length > ep->
ep.maxpacket)
896 && (req->
req.length % ep->
ep.maxpacket) != 0) {
897 DBG(
"%s, no partial packet OUT reads\n", __func__);
909 VDBG(
"%s queue req %p, len %d buf %p\n",
929 spin_unlock_irqrestore(&udc->
lock, flags);
935 if (!req->
req.length) {
983 (is_in ? next_in_dma : next_out_dma)(ep, req);
985 if ((is_in ? write_fifo : read_fifo)(
ep,
req) == 1)
1000 spin_unlock_irqrestore(&udc->
lock, flags);
1009 unsigned long flags;
1018 if (&req->
req == _req)
1021 if (&req->
req != _req) {
1022 spin_unlock_irqrestore(&ep->
udc->lock, flags);
1032 dma_channel_release(ep);
1033 dma_channel_claim(ep, channel);
1036 spin_unlock_irqrestore(&ep->
udc->lock, flags);
1042 static int omap_ep_set_halt(
struct usb_ep *_ep,
int value)
1045 unsigned long flags;
1052 if (!ep->
udc->ep0_pending)
1055 if (ep->
udc->ep0_set_config) {
1056 WARNING(
"error changing config?\n");
1060 ep->
udc->ep0_pending = 0;
1070 && !list_empty(&ep->
queue)) {
1079 && !list_empty(&ep->
queue)) {
1081 dma_channel_release(ep);
1094 dma_channel_claim(ep, channel);
1106 VDBG(
"%s %s halt stat %d\n", ep->
ep.name,
1107 value ?
"set" :
"clear", status);
1109 spin_unlock_irqrestore(&ep->
udc->lock, flags);
1114 .enable = omap_ep_enable,
1115 .disable = omap_ep_disable,
1117 .alloc_request = omap_alloc_request,
1118 .free_request = omap_free_request,
1120 .queue = omap_ep_queue,
1121 .dequeue = omap_ep_dequeue,
1123 .set_halt = omap_ep_set_halt,
1130 static int omap_get_frame(
struct usb_gadget *gadget)
1136 static int omap_wakeup(
struct usb_gadget *gadget)
1139 unsigned long flags;
1150 DBG(
"remote wakeup...\n");
1160 spin_unlock_irqrestore(&udc->
lock, flags);
1166 omap_set_selfpowered(
struct usb_gadget *gadget,
int is_selfpowered)
1169 unsigned long flags;
1180 spin_unlock_irqrestore(&udc->
lock, flags);
1185 static int can_pullup(
struct omap_udc *udc)
1190 static void pullup_enable(
struct omap_udc *udc)
1207 static void pullup_disable(
struct omap_udc *udc)
1226 static void omap_udc_enable_clock(
int enable)
1248 unsigned long flags;
1253 VDBG(
"VBUS %s\n", is_active ?
"on" :
"off");
1266 omap_udc_enable_clock(1);
1270 if (can_pullup(udc))
1273 pullup_disable(udc);
1276 omap_udc_enable_clock(0);
1280 spin_unlock_irqrestore(&udc->
lock, flags);
1284 static int omap_vbus_draw(
struct usb_gadget *gadget,
unsigned mA)
1294 static int omap_pullup(
struct usb_gadget *gadget,
int is_on)
1297 unsigned long flags;
1302 if (can_pullup(udc))
1305 pullup_disable(udc);
1306 spin_unlock_irqrestore(&udc->
lock, flags);
1315 .get_frame = omap_get_frame,
1316 .wakeup = omap_wakeup,
1317 .set_selfpowered = omap_set_selfpowered,
1318 .vbus_session = omap_vbus_session,
1319 .vbus_draw = omap_vbus_draw,
1320 .pullup = omap_pullup,
1321 .start = omap_udc_start,
1322 .stop = omap_udc_stop,
1328 static void nuke(
struct omap_ep *ep,
int status)
1335 dma_channel_release(ep);
1342 while (!list_empty(&ep->
queue)) {
1344 done(ep, req, status);
1349 static void udc_quiesce(
struct omap_udc *udc)
1365 if (!gadget_is_otg(&udc->gadget))
1380 if (udc->gadget.b_hnp_enable) {
1390 static void ep0_irq(
struct omap_udc *udc,
u16 irq_src)
1418 if (!list_empty(&ep0->
queue))
1434 stat = write_fifo(ep0, req);
1465 if (stat & UDC_ACK) {
1471 stat = read_fifo(ep0, req);
1472 if (!req || stat < 0) {
1476 }
else if (stat == 0)
1506 if (irq_src & UDC_SETUP) {
1525 #define w_value le16_to_cpu(u.r.wValue)
1526 #define w_index le16_to_cpu(u.r.wIndex)
1527 #define w_length le16_to_cpu(u.r.wLength)
1538 switch (
u.r.bRequest) {
1547 VDBG(
"set config %d\n", w_value);
1586 VDBG(
"%s halt cleared by host\n", ep->
name);
1587 goto ep0out_status_stage;
1596 if (w_index & USB_DIR_IN)
1599 || ep == ep0 || !ep->
ep.desc)
1605 DBG(
"%s host set_halt, NYET\n", ep->
name);
1612 VDBG(
"%s halted by host\n", ep->
name);
1613 ep0out_status_stage:
1627 if (!(w_index & 0xf))
1632 if (w_index & USB_DIR_IN)
1642 ERR(
"%s status, can't report\n", ep->
ep.name);
1649 if (
u.r.bRequestType
1660 VDBG(
"GET_STATUS, interface %d\n", w_index);
1666 if (!udc->
ep0_in && w_length) {
1675 VDBG(
"SETUP %02x.%02x v%04x i%04x l%04x\n",
1676 u.r.bRequestType,
u.r.bRequest,
1677 w_value, w_index, w_length);
1695 spin_unlock(&udc->
lock);
1697 spin_lock(&udc->
lock);
1703 VDBG(
"req %02x.%02x protocol STALL; stat %d\n",
1704 u.r.bRequestType,
u.r.bRequest, status);
1707 WARNING(
"error resetting config?\n");
1719 #define OTG_FLAGS (UDC_B_HNP_ENABLE|UDC_A_HNP_SUPPORT|UDC_A_ALT_HNP_SUPPORT)
1721 static void devstate_irq(
struct omap_udc *udc,
u16 irq_src)
1723 u16 devstat, change;
1726 change = devstat ^ udc->
devstat;
1736 if (devstat & UDC_ATT) {
1745 pullup_disable(udc);
1746 DBG(
"disconnect, gadget %s\n",
1747 udc->
driver->driver.name);
1748 if (udc->
driver->disconnect) {
1749 spin_unlock(&udc->
lock);
1751 spin_lock(&udc->
lock);
1758 if (devstat & UDC_USB_RESET) {
1762 INFO(
"USB reset done, gadget %s\n",
1763 udc->
driver->driver.name);
1768 change &= ~UDC_USB_RESET;
1774 if (devstat & UDC_SUS) {
1779 && udc->
driver->suspend) {
1780 spin_unlock(&udc->
lock);
1782 spin_lock(&udc->
lock);
1785 usb_phy_set_suspend(
1790 usb_phy_set_suspend(
1793 && udc->
driver->resume) {
1794 spin_unlock(&udc->
lock);
1796 spin_lock(&udc->
lock);
1804 change &= ~OTG_FLAGS;
1809 VDBG(
"devstat %03x, ignore change %03x\n",
1815 static irqreturn_t omap_udc_irq(
int irq,
void *_udc)
1820 unsigned long flags;
1827 devstate_irq(_udc, irq_src);
1829 irq_src &= ~UDC_DS_CHG;
1833 if (irq_src & (UDC_EP0_RX|UDC_SETUP|UDC_EP0_TX)) {
1834 ep0_irq(_udc, irq_src);
1836 irq_src &= ~(UDC_EP0_RX|UDC_SETUP|
UDC_EP0_TX);
1841 dma_irq(_udc, irq_src);
1848 DBG(
"udc_irq, unhandled %03x\n", irq_src);
1849 spin_unlock_irqrestore(&udc->
lock, flags);
1855 #define PIO_OUT_TIMEOUT (jiffies + HZ/3)
1856 #define HALF_FULL(f) (!((f)&(UDC_NON_ISO_FIFO_FULL|UDC_NON_ISO_FIFO_EMPTY)))
1858 static void pio_out_timer(
unsigned long _ep)
1860 struct omap_ep *ep = (
void *) _ep;
1861 unsigned long flags;
1869 if ((stat_flg & UDC_ACK) && (!(stat_flg &
UDC_FIFO_EN)
1873 VDBG(
"%s: lose, %04x\n", ep->
ep.name, stat_flg);
1876 (
void) read_fifo(ep, req);
1884 spin_unlock_irqrestore(&ep->
udc->lock, flags);
1887 static irqreturn_t omap_udc_pio_irq(
int irq,
void *_dev)
1889 u16 epn_stat, irq_src;
1895 unsigned long flags;
1903 epnum = (epn_stat >> 8) & 0x0f;
1906 ep = &udc->
ep[epnum];
1913 if (!list_empty(&ep->
queue)) {
1917 stat = read_fifo(ep, req);
1939 epnum = epn_stat & 0x0f;
1942 ep = &udc->
ep[16 + epnum];
1948 if (!list_empty(&ep->
queue)) {
1951 (
void) write_fifo(ep, req);
1961 spin_unlock_irqrestore(&udc->
lock, flags);
1966 static irqreturn_t omap_udc_iso_irq(
int irq,
void *_dev)
1971 unsigned long flags;
1994 write_fifo(ep, req);
2014 if (!list_empty(&ep->
queue))
2026 spin_unlock_irqrestore(&udc->
lock, flags);
2033 static inline int machine_without_vbus_sense(
void)
2035 return machine_is_omap_innovator()
2036 || machine_is_omap_osk()
2047 unsigned long flags;
2055 || !bind || !driver->
setup)
2060 spin_unlock_irqrestore(&udc->
lock, flags);
2073 udc->
ep[0].irqs = 0;
2080 spin_unlock_irqrestore(&udc->
lock, flags);
2083 omap_udc_enable_clock(1);
2085 status = bind(&udc->
gadget, driver);
2087 DBG(
"bind to %s --> %d\n", driver->
driver.name, status);
2092 DBG(
"bound to driver %s\n", driver->
driver.name);
2098 status = otg_set_peripheral(udc->
transceiver->otg,
2101 ERR(
"can't bind to transceiver\n");
2110 if (can_pullup(udc))
2113 pullup_disable(udc);
2119 if (machine_without_vbus_sense())
2120 omap_vbus_session(&udc->
gadget, 1);
2124 omap_udc_enable_clock(0);
2130 unsigned long flags;
2135 if (!driver || driver != udc->
driver || !driver->
unbind)
2139 omap_udc_enable_clock(1);
2141 if (machine_without_vbus_sense())
2142 omap_vbus_session(&udc->
gadget, 0);
2147 pullup_disable(udc);
2151 spin_unlock_irqrestore(&udc->
lock, flags);
2158 omap_udc_enable_clock(0);
2159 DBG(
"unregistered driver '%s'\n", driver->
driver.name);
2165 #ifdef CONFIG_USB_GADGET_DEBUG_FILES
2169 static const char proc_filename[] =
"driver/udc";
2171 #define FOURBITS "%s%s%s%s"
2172 #define EIGHTBITS "%s%s%s%s%s%s%s%s"
2183 snprintf(buf,
sizeof buf,
"(%cxdma%d lch%d) ",
2191 "\n%s %s%s%sirqs %ld stat %04x " EIGHTBITS FOURBITS
"%s\n",
2210 (stat_flg & UDC_NO_RXPACKET) ?
"no_rxpacket " :
"",
2212 (stat_flg & UDC_DATA_FLUSH) ?
"data_flush " :
"",
2213 (stat_flg & UDC_ISO_ERR) ?
"iso_err " :
"",
2216 (stat_flg & UDC_EP_HALTED) ?
"HALT " :
"",
2218 (stat_flg &
UDC_NAK) ?
"NAK " :
"",
2219 (stat_flg & UDC_ACK) ?
"ACK " :
"",
2221 (stat_flg & UDC_NON_ISO_FIFO_EMPTY) ?
"fifo_empty " :
"",
2224 if (list_empty(&ep->
queue))
2228 unsigned length = req->
req.actual;
2232 ? dma_src_len : dma_dest_len)
2238 req->
req.length, req->
req.buf);
2242 static char *trx_mode(
unsigned m,
int enabled)
2246 return enabled ?
"*6wire" :
"unused";
2258 static int proc_otg_show(
struct seq_file *s)
2262 char *ctrl_name =
"(UNKNOWN)";
2265 ctrl_name =
"tranceiver_ctrl";
2268 tmp >> 4, tmp & 0xf, ctrl_name, trans);
2270 seq_printf(s,
"otg_syscon1 %08x usb2 %s, usb1 %s, usb0 %s,"
2283 " b_ase_brst=%d hmc=%d\n", tmp,
2284 (tmp &
OTG_EN) ?
" otg_en" :
"",
2287 (tmp &
SRP_DATA) ?
" srp_data" :
"",
2288 (tmp &
SRP_VBUS) ?
" srp_vbus" :
"",
2291 (tmp &
UHOST_EN) ?
" uhost_en" :
"",
2297 seq_printf(s,
"otg_ctrl %06x" EIGHTBITS EIGHTBITS
"%s\n", tmp,
2302 (tmp & OTG_ID) ?
" id" :
"",
2327 static int proc_udc_show(
struct seq_file *s,
void *
_)
2331 unsigned long flags;
2345 "UDC rev %d.%d, fifo mode %d, gadget %s\n"
2346 "hmc %d, transceiver %s\n",
2347 tmp >> 4, tmp & 0xf,
2354 ?
"external" :
"(none)"));
2355 seq_printf(s,
"ULPD control %04x req %04x status %04x\n",
2365 seq_printf(s,
"\nsyscon1 %04x" EIGHTBITS
"\n", tmp,
2379 spin_unlock_irqrestore(&udc->
lock, flags);
2384 seq_printf(s,
"devstat %04x" EIGHTBITS
"%s%s\n", tmp,
2390 (tmp &
UDC_SUS) ?
" SUS" :
"",
2391 (tmp &
UDC_CFG) ?
" CFG" :
"",
2392 (tmp &
UDC_ADD) ?
" ADD" :
"",
2393 (tmp &
UDC_DEF) ?
" DEF" :
"",
2394 (tmp &
UDC_ATT) ?
" ATT" :
"");
2397 seq_printf(s,
"irq_en %04x" FOURBITS
"%s\n", tmp,
2404 seq_printf(s,
"irq_src %04x" EIGHTBITS
"%s%s\n", tmp,
2405 (tmp & UDC_TXN_DONE) ?
" txn_done" :
"",
2407 (tmp & UDC_RXN_EOT) ?
" rxn_eot" :
"",
2409 (tmp & UDC_EPN_RX) ?
" epn_rx" :
"",
2410 (tmp & UDC_EPN_TX) ?
" epn_tx" :
"",
2411 (tmp & UDC_DS_CHG) ?
" ds_chg" :
"",
2412 (tmp & UDC_SETUP) ?
" setup" :
"",
2413 (tmp & UDC_EP0_RX) ?
" ep0out" :
"",
2414 (tmp & UDC_EP0_TX) ?
" ep0in" :
"");
2419 seq_printf(s,
"dma_irq_en %04x%s" EIGHTBITS
"\n", tmp,
2435 for (i = 0; i < 3; i++) {
2436 if ((tmp & (0x0f << (i * 4))) == 0)
2445 for (i = 0; i < 3; i++) {
2446 if (!(tmp & (0x0f << (i * 4))))
2456 proc_ep_show(s, &udc->
ep[0]);
2457 if (tmp & UDC_ADD) {
2461 proc_ep_show(s, ep);
2465 spin_unlock_irqrestore(&udc->
lock, flags);
2476 .open = proc_udc_open,
2484 proc_create(proc_filename, 0,
NULL, &proc_ops);
2511 unsigned buf,
unsigned maxp,
int dbuf)
2517 ep = &udc->
ep[addr & 0xf];
2518 if (addr & USB_DIR_IN)
2580 ep->
timer.function = pio_out_timer;
2586 epn_rxtx |= buf >> 3;
2588 DBG(
"%s addr %02x rxtx %04x maxp %d%s buf %d\n",
2589 name, addr, epn_rxtx, maxp, dbuf ?
"x2" :
"", buf);
2591 if (addr & USB_DIR_IN)
2605 INIT_LIST_HEAD(&ep->
queue);
2606 INIT_LIST_HEAD(&ep->
iso);
2613 ep->
ep.ops = &omap_ep_ops;
2620 static void omap_udc_release(
struct device *
dev)
2649 udc->
gadget.ops = &omap_gadget_ops;
2651 INIT_LIST_HEAD(&udc->
gadget.ep_list);
2652 INIT_LIST_HEAD(&udc->
iso);
2659 udc->
gadget.dev.release = omap_udc_release;
2662 udc->
gadget.dev.dma_mask = odev->
dev.dma_mask;
2669 list_del_init(&udc->
ep[0].ep.ep_list);
2672 for (tmp = 1; tmp < 15; tmp++) {
2677 #define OMAP_BULK_EP(name, addr) \
2678 buf = omap_ep_setup(name "-bulk", addr, \
2679 USB_ENDPOINT_XFER_BULK, buf, 64, 1);
2680 #define OMAP_INT_EP(name, addr, maxp) \
2681 buf = omap_ep_setup(name "-int", addr, \
2682 USB_ENDPOINT_XFER_INT, buf, maxp, 0);
2683 #define OMAP_ISO_EP(name, addr, maxp) \
2684 buf = omap_ep_setup(name "-iso", addr, \
2685 USB_ENDPOINT_XFER_ISOC, buf, maxp, 1);
2687 switch (fifo_mode) {
2756 ERR(
"unsupported fifo_mode #%d\n", fifo_mode);
2760 INFO(
"fifo mode %d, %d bytes not used\n", fifo_mode, 2048 - buf);
2769 const char *type =
NULL;
2781 DBG(
"request_mem_region failed\n");
2788 BUG_ON(IS_ERR(dc_clk) || IS_ERR(hhc_clk));
2798 BUG_ON(IS_ERR(dc_clk) || IS_ERR(hhc_clk));
2805 INFO(
"OMAP UDC rev %d.%d%s\n",
2807 config->
otg ?
", Mini-AB" :
"");
2814 if (machine_without_vbus_sense()) {
2835 if (!IS_ERR_OR_NULL(xceiv))
2836 type = xceiv->
label;
2837 else if (config->
otg) {
2838 DBG(
"OTG requires external transceiver!\n");
2850 type =
"integrated";
2859 if (IS_ERR_OR_NULL(xceiv)) {
2860 DBG(
"external transceiver not registered!\n");
2878 ERR(
"unrecognized UDC HMC mode %d\n", hmc);
2883 INFO(
"hmc mode %d, %s transceiver\n", hmc, type);
2886 status = omap_udc_setup(pdev, xceiv);
2892 pullup_disable(udc);
2893 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
2894 udc->
gadget.is_otg = (config->
otg != 0);
2907 ERR(
"can't get irq %d, err %d\n",
2908 (
int) pdev->
resource[1].start, status);
2914 0,
"omap_udc pio", udc);
2916 ERR(
"can't get irq %d, err %d\n",
2917 (
int) pdev->
resource[2].start, status);
2922 0,
"omap_udc iso", udc);
2924 ERR(
"can't get irq %d, err %d\n",
2925 (
int) pdev->
resource[3].start, status);
2961 if (!IS_ERR_OR_NULL(xceiv))
2990 pullup_disable(udc);
3007 omap_udc_enable_clock(0);
3041 if ((devstat & UDC_ATT) != 0 && (devstat & UDC_SUS) == 0) {
3042 WARNING(
"session active; suspend requires disconnect\n");
3043 omap_pullup(&udc->
gadget, 0);
3051 DBG(
"resume + wakeup/SRP\n");
3052 omap_pullup(&udc->
gadget, 1);
3056 return omap_wakeup(&udc->
gadget);
3062 .probe = omap_udc_probe,
3064 .suspend = omap_udc_suspend,
3065 .resume = omap_udc_resume,