diff options
author | Felipe Balbi <balbi@ti.com> | 2012-05-29 07:26:09 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-06-03 16:11:29 -0400 |
commit | 80dd1358d33e6c85018e1e1c5d78b29ac466221a (patch) | |
tree | 9b94d1f08caea39475041903f15b9eca0e18eb03 /drivers/usb | |
parent | ae3725716edf5a73ab66831c0808542c21fa3bba (diff) |
usb: gadget: omap_udc: make checkpatch.pl happy
This patch is just a cleanup patch to make
checkpatch.pl a little happier with the
omap_udc.c driver.
No functional changes.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/omap_udc.c | 201 |
1 files changed, 121 insertions, 80 deletions
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 24d81dcb7b4b..aa2d174a2521 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -36,9 +36,9 @@ | |||
36 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
37 | #include <linux/clk.h> | 37 | #include <linux/clk.h> |
38 | #include <linux/prefetch.h> | 38 | #include <linux/prefetch.h> |
39 | #include <linux/io.h> | ||
39 | 40 | ||
40 | #include <asm/byteorder.h> | 41 | #include <asm/byteorder.h> |
41 | #include <asm/io.h> | ||
42 | #include <asm/irq.h> | 42 | #include <asm/irq.h> |
43 | #include <asm/unaligned.h> | 43 | #include <asm/unaligned.h> |
44 | #include <asm/mach-types.h> | 44 | #include <asm/mach-types.h> |
@@ -84,14 +84,14 @@ | |||
84 | #ifdef USE_ISO | 84 | #ifdef USE_ISO |
85 | static unsigned fifo_mode = 3; | 85 | static unsigned fifo_mode = 3; |
86 | #else | 86 | #else |
87 | static unsigned fifo_mode = 0; | 87 | static unsigned fifo_mode; |
88 | #endif | 88 | #endif |
89 | 89 | ||
90 | /* "modprobe omap_udc fifo_mode=42", or else as a kernel | 90 | /* "modprobe omap_udc fifo_mode=42", or else as a kernel |
91 | * boot parameter "omap_udc:fifo_mode=42" | 91 | * boot parameter "omap_udc:fifo_mode=42" |
92 | */ | 92 | */ |
93 | module_param (fifo_mode, uint, 0); | 93 | module_param(fifo_mode, uint, 0); |
94 | MODULE_PARM_DESC (fifo_mode, "endpoint configuration"); | 94 | MODULE_PARM_DESC(fifo_mode, "endpoint configuration"); |
95 | 95 | ||
96 | #ifdef USE_DMA | 96 | #ifdef USE_DMA |
97 | static bool use_dma = 1; | 97 | static bool use_dma = 1; |
@@ -99,8 +99,8 @@ static bool use_dma = 1; | |||
99 | /* "modprobe omap_udc use_dma=y", or else as a kernel | 99 | /* "modprobe omap_udc use_dma=y", or else as a kernel |
100 | * boot parameter "omap_udc:use_dma=y" | 100 | * boot parameter "omap_udc:use_dma=y" |
101 | */ | 101 | */ |
102 | module_param (use_dma, bool, 0); | 102 | module_param(use_dma, bool, 0); |
103 | MODULE_PARM_DESC (use_dma, "enable/disable DMA"); | 103 | MODULE_PARM_DESC(use_dma, "enable/disable DMA"); |
104 | #else /* !USE_DMA */ | 104 | #else /* !USE_DMA */ |
105 | 105 | ||
106 | /* save a bit of code */ | 106 | /* save a bit of code */ |
@@ -108,8 +108,8 @@ MODULE_PARM_DESC (use_dma, "enable/disable DMA"); | |||
108 | #endif /* !USE_DMA */ | 108 | #endif /* !USE_DMA */ |
109 | 109 | ||
110 | 110 | ||
111 | static const char driver_name [] = "omap_udc"; | 111 | static const char driver_name[] = "omap_udc"; |
112 | static const char driver_desc [] = DRIVER_DESC; | 112 | static const char driver_desc[] = DRIVER_DESC; |
113 | 113 | ||
114 | /*-------------------------------------------------------------------------*/ | 114 | /*-------------------------------------------------------------------------*/ |
115 | 115 | ||
@@ -247,7 +247,7 @@ static int omap_ep_disable(struct usb_ep *_ep) | |||
247 | 247 | ||
248 | spin_lock_irqsave(&ep->udc->lock, flags); | 248 | spin_lock_irqsave(&ep->udc->lock, flags); |
249 | ep->ep.desc = NULL; | 249 | ep->ep.desc = NULL; |
250 | nuke (ep, -ESHUTDOWN); | 250 | nuke(ep, -ESHUTDOWN); |
251 | ep->ep.maxpacket = ep->maxpacket; | 251 | ep->ep.maxpacket = ep->maxpacket; |
252 | ep->has_dma = 0; | 252 | ep->has_dma = 0; |
253 | omap_writew(UDC_SET_HALT, UDC_CTRL); | 253 | omap_writew(UDC_SET_HALT, UDC_CTRL); |
@@ -270,7 +270,7 @@ omap_alloc_request(struct usb_ep *ep, gfp_t gfp_flags) | |||
270 | req = kzalloc(sizeof(*req), gfp_flags); | 270 | req = kzalloc(sizeof(*req), gfp_flags); |
271 | if (req) { | 271 | if (req) { |
272 | req->req.dma = DMA_ADDR_INVALID; | 272 | req->req.dma = DMA_ADDR_INVALID; |
273 | INIT_LIST_HEAD (&req->queue); | 273 | INIT_LIST_HEAD(&req->queue); |
274 | } | 274 | } |
275 | return &req->req; | 275 | return &req->req; |
276 | } | 276 | } |
@@ -281,7 +281,7 @@ omap_free_request(struct usb_ep *ep, struct usb_request *_req) | |||
281 | struct omap_req *req = container_of(_req, struct omap_req, req); | 281 | struct omap_req *req = container_of(_req, struct omap_req, req); |
282 | 282 | ||
283 | if (_req) | 283 | if (_req) |
284 | kfree (req); | 284 | kfree(req); |
285 | } | 285 | } |
286 | 286 | ||
287 | /*-------------------------------------------------------------------------*/ | 287 | /*-------------------------------------------------------------------------*/ |
@@ -361,10 +361,10 @@ write_packet(u8 *buf, struct omap_req *req, unsigned max) | |||
361 | return len; | 361 | return len; |
362 | } | 362 | } |
363 | 363 | ||
364 | // FIXME change r/w fifo calling convention | 364 | /* FIXME change r/w fifo calling convention */ |
365 | 365 | ||
366 | 366 | ||
367 | // return: 0 = still running, 1 = completed, negative = errno | 367 | /* return: 0 = still running, 1 = completed, negative = errno */ |
368 | static int write_fifo(struct omap_ep *ep, struct omap_req *req) | 368 | static int write_fifo(struct omap_ep *ep, struct omap_req *req) |
369 | { | 369 | { |
370 | u8 *buf; | 370 | u8 *buf; |
@@ -426,7 +426,7 @@ read_packet(u8 *buf, struct omap_req *req, unsigned avail) | |||
426 | return len; | 426 | return len; |
427 | } | 427 | } |
428 | 428 | ||
429 | // return: 0 = still running, 1 = queue empty, negative = errno | 429 | /* return: 0 = still running, 1 = queue empty, negative = errno */ |
430 | static int read_fifo(struct omap_ep *ep, struct omap_req *req) | 430 | static int read_fifo(struct omap_ep *ep, struct omap_req *req) |
431 | { | 431 | { |
432 | u8 *buf; | 432 | u8 *buf; |
@@ -662,7 +662,7 @@ static void dma_irq(struct omap_udc *udc, u16 irq_src) | |||
662 | } | 662 | } |
663 | omap_writew(UDC_TXN_DONE, UDC_IRQ_SRC); | 663 | omap_writew(UDC_TXN_DONE, UDC_IRQ_SRC); |
664 | 664 | ||
665 | if (!list_empty (&ep->queue)) { | 665 | if (!list_empty(&ep->queue)) { |
666 | req = container_of(ep->queue.next, | 666 | req = container_of(ep->queue.next, |
667 | struct omap_req, queue); | 667 | struct omap_req, queue); |
668 | next_in_dma(ep, req); | 668 | next_in_dma(ep, req); |
@@ -681,7 +681,7 @@ static void dma_irq(struct omap_udc *udc, u16 irq_src) | |||
681 | } | 681 | } |
682 | omap_writew(UDC_RXN_EOT, UDC_IRQ_SRC); | 682 | omap_writew(UDC_RXN_EOT, UDC_IRQ_SRC); |
683 | 683 | ||
684 | if (!list_empty (&ep->queue)) { | 684 | if (!list_empty(&ep->queue)) { |
685 | req = container_of(ep->queue.next, | 685 | req = container_of(ep->queue.next, |
686 | struct omap_req, queue); | 686 | struct omap_req, queue); |
687 | next_out_dma(ep, req); | 687 | next_out_dma(ep, req); |
@@ -954,7 +954,7 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
954 | int is_in; | 954 | int is_in; |
955 | 955 | ||
956 | if (ep->bEndpointAddress == 0) { | 956 | if (ep->bEndpointAddress == 0) { |
957 | if (!udc->ep0_pending || !list_empty (&ep->queue)) { | 957 | if (!udc->ep0_pending || !list_empty(&ep->queue)) { |
958 | spin_unlock_irqrestore(&udc->lock, flags); | 958 | spin_unlock_irqrestore(&udc->lock, flags); |
959 | return -EL2HLT; | 959 | return -EL2HLT; |
960 | } | 960 | } |
@@ -981,7 +981,8 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
981 | * always an IN ... even for IN transfers, | 981 | * always an IN ... even for IN transfers, |
982 | * a weird case which seem to stall OMAP. | 982 | * a weird case which seem to stall OMAP. |
983 | */ | 983 | */ |
984 | omap_writew(UDC_EP_SEL | UDC_EP_DIR, UDC_EP_NUM); | 984 | omap_writew(UDC_EP_SEL | UDC_EP_DIR, |
985 | UDC_EP_NUM); | ||
985 | omap_writew(UDC_CLR_EP, UDC_CTRL); | 986 | omap_writew(UDC_CLR_EP, UDC_CTRL); |
986 | omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); | 987 | omap_writew(UDC_SET_FIFO_EN, UDC_CTRL); |
987 | omap_writew(UDC_EP_DIR, UDC_EP_NUM); | 988 | omap_writew(UDC_EP_DIR, UDC_EP_NUM); |
@@ -993,7 +994,8 @@ omap_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
993 | 994 | ||
994 | /* non-empty DATA stage */ | 995 | /* non-empty DATA stage */ |
995 | } else if (is_in) { | 996 | } else if (is_in) { |
996 | omap_writew(UDC_EP_SEL | UDC_EP_DIR, UDC_EP_NUM); | 997 | omap_writew(UDC_EP_SEL | UDC_EP_DIR, |
998 | UDC_EP_NUM); | ||
997 | } else { | 999 | } else { |
998 | if (udc->ep0_setup) | 1000 | if (udc->ep0_setup) |
999 | goto irq_wait; | 1001 | goto irq_wait; |
@@ -1041,7 +1043,7 @@ static int omap_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
1041 | spin_lock_irqsave(&ep->udc->lock, flags); | 1043 | spin_lock_irqsave(&ep->udc->lock, flags); |
1042 | 1044 | ||
1043 | /* make sure it's actually queued on this endpoint */ | 1045 | /* make sure it's actually queued on this endpoint */ |
1044 | list_for_each_entry (req, &ep->queue, queue) { | 1046 | list_for_each_entry(req, &ep->queue, queue) { |
1045 | if (&req->req == _req) | 1047 | if (&req->req == _req) |
1046 | break; | 1048 | break; |
1047 | } | 1049 | } |
@@ -1148,8 +1150,8 @@ static struct usb_ep_ops omap_ep_ops = { | |||
1148 | .dequeue = omap_ep_dequeue, | 1150 | .dequeue = omap_ep_dequeue, |
1149 | 1151 | ||
1150 | .set_halt = omap_ep_set_halt, | 1152 | .set_halt = omap_ep_set_halt, |
1151 | // fifo_status ... report bytes in fifo | 1153 | /* fifo_status ... report bytes in fifo */ |
1152 | // fifo_flush ... flush fifo | 1154 | /* fifo_flush ... flush fifo */ |
1153 | }; | 1155 | }; |
1154 | 1156 | ||
1155 | /*-------------------------------------------------------------------------*/ | 1157 | /*-------------------------------------------------------------------------*/ |
@@ -1379,7 +1381,7 @@ static void udc_quiesce(struct omap_udc *udc) | |||
1379 | 1381 | ||
1380 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 1382 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
1381 | nuke(&udc->ep[0], -ESHUTDOWN); | 1383 | nuke(&udc->ep[0], -ESHUTDOWN); |
1382 | list_for_each_entry (ep, &udc->gadget.ep_list, ep.ep_list) | 1384 | list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) |
1383 | nuke(ep, -ESHUTDOWN); | 1385 | nuke(ep, -ESHUTDOWN); |
1384 | } | 1386 | } |
1385 | 1387 | ||
@@ -1495,7 +1497,8 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src) | |||
1495 | /* read next OUT packet of request, maybe | 1497 | /* read next OUT packet of request, maybe |
1496 | * reactiviting the fifo; stall on errors. | 1498 | * reactiviting the fifo; stall on errors. |
1497 | */ | 1499 | */ |
1498 | if (!req || (stat = read_fifo(ep0, req)) < 0) { | 1500 | stat = read_fifo(ep0, req); |
1501 | if (!req || stat < 0) { | ||
1499 | omap_writew(UDC_STALL_CMD, UDC_SYSCON2); | 1502 | omap_writew(UDC_STALL_CMD, UDC_SYSCON2); |
1500 | udc->ep0_pending = 0; | 1503 | udc->ep0_pending = 0; |
1501 | stat = 0; | 1504 | stat = 0; |
@@ -1628,7 +1631,7 @@ static void ep0_irq(struct omap_udc *udc, u16 irq_src) | |||
1628 | /* this has rude side-effects (aborts) and | 1631 | /* this has rude side-effects (aborts) and |
1629 | * can't really work if DMA-IN is active | 1632 | * can't really work if DMA-IN is active |
1630 | */ | 1633 | */ |
1631 | DBG("%s host set_halt, NYET \n", ep->name); | 1634 | DBG("%s host set_halt, NYET\n", ep->name); |
1632 | goto do_stall; | 1635 | goto do_stall; |
1633 | } | 1636 | } |
1634 | use_ep(ep, 0); | 1637 | use_ep(ep, 0); |
@@ -1719,7 +1722,7 @@ delegate: | |||
1719 | */ | 1722 | */ |
1720 | udc->ep0_setup = 1; | 1723 | udc->ep0_setup = 1; |
1721 | spin_unlock(&udc->lock); | 1724 | spin_unlock(&udc->lock); |
1722 | status = udc->driver->setup (&udc->gadget, &u.r); | 1725 | status = udc->driver->setup(&udc->gadget, &u.r); |
1723 | spin_lock(&udc->lock); | 1726 | spin_lock(&udc->lock); |
1724 | udc->ep0_setup = 0; | 1727 | udc->ep0_setup = 0; |
1725 | } | 1728 | } |
@@ -1764,7 +1767,7 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src) | |||
1764 | VDBG("connect\n"); | 1767 | VDBG("connect\n"); |
1765 | if (!udc->transceiver) | 1768 | if (!udc->transceiver) |
1766 | pullup_enable(udc); | 1769 | pullup_enable(udc); |
1767 | // if (driver->connect) call it | 1770 | /* if (driver->connect) call it */ |
1768 | } else if (udc->gadget.speed != USB_SPEED_UNKNOWN) { | 1771 | } else if (udc->gadget.speed != USB_SPEED_UNKNOWN) { |
1769 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 1772 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
1770 | if (!udc->transceiver) | 1773 | if (!udc->transceiver) |
@@ -1796,7 +1799,7 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src) | |||
1796 | } | 1799 | } |
1797 | if (change & UDC_SUS) { | 1800 | if (change & UDC_SUS) { |
1798 | if (udc->gadget.speed != USB_SPEED_UNKNOWN) { | 1801 | if (udc->gadget.speed != USB_SPEED_UNKNOWN) { |
1799 | // FIXME tell isp1301 to suspend/resume (?) | 1802 | /* FIXME tell isp1301 to suspend/resume (?) */ |
1800 | if (devstat & UDC_SUS) { | 1803 | if (devstat & UDC_SUS) { |
1801 | VDBG("suspend\n"); | 1804 | VDBG("suspend\n"); |
1802 | update_otg(udc); | 1805 | update_otg(udc); |
@@ -1999,7 +2002,7 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev) | |||
1999 | spin_lock_irqsave(&udc->lock, flags); | 2002 | spin_lock_irqsave(&udc->lock, flags); |
2000 | 2003 | ||
2001 | /* handle all non-DMA ISO transfers */ | 2004 | /* handle all non-DMA ISO transfers */ |
2002 | list_for_each_entry (ep, &udc->iso, iso) { | 2005 | list_for_each_entry(ep, &udc->iso, iso) { |
2003 | u16 stat; | 2006 | u16 stat; |
2004 | struct omap_req *req; | 2007 | struct omap_req *req; |
2005 | 2008 | ||
@@ -2058,11 +2061,11 @@ static irqreturn_t omap_udc_iso_irq(int irq, void *_dev) | |||
2058 | 2061 | ||
2059 | static inline int machine_without_vbus_sense(void) | 2062 | static inline int machine_without_vbus_sense(void) |
2060 | { | 2063 | { |
2061 | return (machine_is_omap_innovator() | 2064 | return machine_is_omap_innovator() |
2062 | || machine_is_omap_osk() | 2065 | || machine_is_omap_osk() |
2063 | || machine_is_sx1() | 2066 | || machine_is_sx1() |
2064 | || cpu_is_omap7xx() /* No known omap7xx boards with vbus sense */ | 2067 | /* No known omap7xx boards with vbus sense */ |
2065 | ); | 2068 | || cpu_is_omap7xx(); |
2066 | } | 2069 | } |
2067 | 2070 | ||
2068 | static int omap_udc_start(struct usb_gadget_driver *driver, | 2071 | static int omap_udc_start(struct usb_gadget_driver *driver, |
@@ -2076,7 +2079,7 @@ static int omap_udc_start(struct usb_gadget_driver *driver, | |||
2076 | if (!udc) | 2079 | if (!udc) |
2077 | return -ENODEV; | 2080 | return -ENODEV; |
2078 | if (!driver | 2081 | if (!driver |
2079 | // FIXME if otg, check: driver->is_otg | 2082 | /* FIXME if otg, check: driver->is_otg */ |
2080 | || driver->max_speed < USB_SPEED_FULL | 2083 | || driver->max_speed < USB_SPEED_FULL |
2081 | || !bind || !driver->setup) | 2084 | || !bind || !driver->setup) |
2082 | return -EINVAL; | 2085 | return -EINVAL; |
@@ -2088,7 +2091,7 @@ static int omap_udc_start(struct usb_gadget_driver *driver, | |||
2088 | } | 2091 | } |
2089 | 2092 | ||
2090 | /* reset state */ | 2093 | /* reset state */ |
2091 | list_for_each_entry (ep, &udc->gadget.ep_list, ep.ep_list) { | 2094 | list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { |
2092 | ep->irqs = 0; | 2095 | ep->irqs = 0; |
2093 | if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) | 2096 | if (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) |
2094 | continue; | 2097 | continue; |
@@ -2126,7 +2129,7 @@ static int omap_udc_start(struct usb_gadget_driver *driver, | |||
2126 | if (status < 0) { | 2129 | if (status < 0) { |
2127 | ERR("can't bind to transceiver\n"); | 2130 | ERR("can't bind to transceiver\n"); |
2128 | if (driver->unbind) { | 2131 | if (driver->unbind) { |
2129 | driver->unbind (&udc->gadget); | 2132 | driver->unbind(&udc->gadget); |
2130 | udc->gadget.dev.driver = NULL; | 2133 | udc->gadget.dev.driver = NULL; |
2131 | udc->driver = NULL; | 2134 | udc->driver = NULL; |
2132 | } | 2135 | } |
@@ -2134,9 +2137,9 @@ static int omap_udc_start(struct usb_gadget_driver *driver, | |||
2134 | } | 2137 | } |
2135 | } else { | 2138 | } else { |
2136 | if (can_pullup(udc)) | 2139 | if (can_pullup(udc)) |
2137 | pullup_enable (udc); | 2140 | pullup_enable(udc); |
2138 | else | 2141 | else |
2139 | pullup_disable (udc); | 2142 | pullup_disable(udc); |
2140 | } | 2143 | } |
2141 | 2144 | ||
2142 | /* boards that don't have VBUS sensing can't autogate 48MHz; | 2145 | /* boards that don't have VBUS sensing can't autogate 48MHz; |
@@ -2195,7 +2198,7 @@ static int omap_udc_stop(struct usb_gadget_driver *driver) | |||
2195 | static const char proc_filename[] = "driver/udc"; | 2198 | static const char proc_filename[] = "driver/udc"; |
2196 | 2199 | ||
2197 | #define FOURBITS "%s%s%s%s" | 2200 | #define FOURBITS "%s%s%s%s" |
2198 | #define EIGHTBITS FOURBITS FOURBITS | 2201 | #define EIGHTBITS "%s%s%s%s%s%s%s%s" |
2199 | 2202 | ||
2200 | static void proc_ep_show(struct seq_file *s, struct omap_ep *ep) | 2203 | static void proc_ep_show(struct seq_file *s, struct omap_ep *ep) |
2201 | { | 2204 | { |
@@ -2217,12 +2220,21 @@ static void proc_ep_show(struct seq_file *s, struct omap_ep *ep) | |||
2217 | "\n%s %s%s%sirqs %ld stat %04x " EIGHTBITS FOURBITS "%s\n", | 2220 | "\n%s %s%s%sirqs %ld stat %04x " EIGHTBITS FOURBITS "%s\n", |
2218 | ep->name, buf, | 2221 | ep->name, buf, |
2219 | ep->double_buf ? "dbuf " : "", | 2222 | ep->double_buf ? "dbuf " : "", |
2220 | ({char *s; switch(ep->ackwait){ | 2223 | ({ char *s; |
2221 | case 0: s = ""; break; | 2224 | switch (ep->ackwait) { |
2222 | case 1: s = "(ackw) "; break; | 2225 | case 0: |
2223 | case 2: s = "(ackw2) "; break; | 2226 | s = ""; |
2224 | default: s = "(?) "; break; | 2227 | break; |
2225 | } s;}), | 2228 | case 1: |
2229 | s = "(ackw) "; | ||
2230 | break; | ||
2231 | case 2: | ||
2232 | s = "(ackw2) "; | ||
2233 | break; | ||
2234 | default: | ||
2235 | s = "(?) "; | ||
2236 | break; | ||
2237 | } s; }), | ||
2226 | ep->irqs, stat_flg, | 2238 | ep->irqs, stat_flg, |
2227 | (stat_flg & UDC_NO_RXPACKET) ? "no_rxpacket " : "", | 2239 | (stat_flg & UDC_NO_RXPACKET) ? "no_rxpacket " : "", |
2228 | (stat_flg & UDC_MISS_IN) ? "miss_in " : "", | 2240 | (stat_flg & UDC_MISS_IN) ? "miss_in " : "", |
@@ -2238,10 +2250,10 @@ static void proc_ep_show(struct seq_file *s, struct omap_ep *ep) | |||
2238 | (stat_flg & UDC_NON_ISO_FIFO_EMPTY) ? "fifo_empty " : "", | 2250 | (stat_flg & UDC_NON_ISO_FIFO_EMPTY) ? "fifo_empty " : "", |
2239 | (stat_flg & UDC_NON_ISO_FIFO_FULL) ? "fifo_full " : ""); | 2251 | (stat_flg & UDC_NON_ISO_FIFO_FULL) ? "fifo_full " : ""); |
2240 | 2252 | ||
2241 | if (list_empty (&ep->queue)) | 2253 | if (list_empty(&ep->queue)) |
2242 | seq_printf(s, "\t(queue empty)\n"); | 2254 | seq_printf(s, "\t(queue empty)\n"); |
2243 | else | 2255 | else |
2244 | list_for_each_entry (req, &ep->queue, queue) { | 2256 | list_for_each_entry(req, &ep->queue, queue) { |
2245 | unsigned length = req->req.actual; | 2257 | unsigned length = req->req.actual; |
2246 | 2258 | ||
2247 | if (use_dma && buf[0]) { | 2259 | if (use_dma && buf[0]) { |
@@ -2259,11 +2271,16 @@ static void proc_ep_show(struct seq_file *s, struct omap_ep *ep) | |||
2259 | static char *trx_mode(unsigned m, int enabled) | 2271 | static char *trx_mode(unsigned m, int enabled) |
2260 | { | 2272 | { |
2261 | switch (m) { | 2273 | switch (m) { |
2262 | case 0: return enabled ? "*6wire" : "unused"; | 2274 | case 0: |
2263 | case 1: return "4wire"; | 2275 | return enabled ? "*6wire" : "unused"; |
2264 | case 2: return "3wire"; | 2276 | case 1: |
2265 | case 3: return "6wire"; | 2277 | return "4wire"; |
2266 | default: return "unknown"; | 2278 | case 2: |
2279 | return "3wire"; | ||
2280 | case 3: | ||
2281 | return "6wire"; | ||
2282 | default: | ||
2283 | return "unknown"; | ||
2267 | } | 2284 | } |
2268 | } | 2285 | } |
2269 | 2286 | ||
@@ -2295,7 +2312,7 @@ static int proc_otg_show(struct seq_file *s) | |||
2295 | " b_ase_brst=%d hmc=%d\n", tmp, | 2312 | " b_ase_brst=%d hmc=%d\n", tmp, |
2296 | (tmp & OTG_EN) ? " otg_en" : "", | 2313 | (tmp & OTG_EN) ? " otg_en" : "", |
2297 | (tmp & USBX_SYNCHRO) ? " synchro" : "", | 2314 | (tmp & USBX_SYNCHRO) ? " synchro" : "", |
2298 | // much more SRP stuff | 2315 | /* much more SRP stuff */ |
2299 | (tmp & SRP_DATA) ? " srp_data" : "", | 2316 | (tmp & SRP_DATA) ? " srp_data" : "", |
2300 | (tmp & SRP_VBUS) ? " srp_vbus" : "", | 2317 | (tmp & SRP_VBUS) ? " srp_vbus" : "", |
2301 | (tmp & OTG_PADEN) ? " otg_paden" : "", | 2318 | (tmp & OTG_PADEN) ? " otg_paden" : "", |
@@ -2383,7 +2400,7 @@ static int proc_udc_show(struct seq_file *s, void *_) | |||
2383 | (tmp & UDC_SELF_PWR) ? " self_pwr" : "", | 2400 | (tmp & UDC_SELF_PWR) ? " self_pwr" : "", |
2384 | (tmp & UDC_SOFF_DIS) ? " soff_dis" : "", | 2401 | (tmp & UDC_SOFF_DIS) ? " soff_dis" : "", |
2385 | (tmp & UDC_PULLUP_EN) ? " PULLUP" : ""); | 2402 | (tmp & UDC_PULLUP_EN) ? " PULLUP" : ""); |
2386 | // syscon2 is write-only | 2403 | /* syscon2 is write-only */ |
2387 | 2404 | ||
2388 | /* UDC controller registers */ | 2405 | /* UDC controller registers */ |
2389 | if (!(tmp & UDC_PULLUP_EN)) { | 2406 | if (!(tmp & UDC_PULLUP_EN)) { |
@@ -2467,7 +2484,7 @@ static int proc_udc_show(struct seq_file *s, void *_) | |||
2467 | if (tmp & UDC_ATT) { | 2484 | if (tmp & UDC_ATT) { |
2468 | proc_ep_show(s, &udc->ep[0]); | 2485 | proc_ep_show(s, &udc->ep[0]); |
2469 | if (tmp & UDC_ADD) { | 2486 | if (tmp & UDC_ADD) { |
2470 | list_for_each_entry (ep, &udc->gadget.ep_list, | 2487 | list_for_each_entry(ep, &udc->gadget.ep_list, |
2471 | ep.ep_list) { | 2488 | ep.ep_list) { |
2472 | if (ep->ep.desc) | 2489 | if (ep->ep.desc) |
2473 | proc_ep_show(s, ep); | 2490 | proc_ep_show(s, ep); |
@@ -2536,14 +2553,29 @@ omap_ep_setup(char *name, u8 addr, u8 type, | |||
2536 | /* chip setup ... bit values are same for IN, OUT */ | 2553 | /* chip setup ... bit values are same for IN, OUT */ |
2537 | if (type == USB_ENDPOINT_XFER_ISOC) { | 2554 | if (type == USB_ENDPOINT_XFER_ISOC) { |
2538 | switch (maxp) { | 2555 | switch (maxp) { |
2539 | case 8: epn_rxtx = 0 << 12; break; | 2556 | case 8: |
2540 | case 16: epn_rxtx = 1 << 12; break; | 2557 | epn_rxtx = 0 << 12; |
2541 | case 32: epn_rxtx = 2 << 12; break; | 2558 | break; |
2542 | case 64: epn_rxtx = 3 << 12; break; | 2559 | case 16: |
2543 | case 128: epn_rxtx = 4 << 12; break; | 2560 | epn_rxtx = 1 << 12; |
2544 | case 256: epn_rxtx = 5 << 12; break; | 2561 | break; |
2545 | case 512: epn_rxtx = 6 << 12; break; | 2562 | case 32: |
2546 | default: BUG(); | 2563 | epn_rxtx = 2 << 12; |
2564 | break; | ||
2565 | case 64: | ||
2566 | epn_rxtx = 3 << 12; | ||
2567 | break; | ||
2568 | case 128: | ||
2569 | epn_rxtx = 4 << 12; | ||
2570 | break; | ||
2571 | case 256: | ||
2572 | epn_rxtx = 5 << 12; | ||
2573 | break; | ||
2574 | case 512: | ||
2575 | epn_rxtx = 6 << 12; | ||
2576 | break; | ||
2577 | default: | ||
2578 | BUG(); | ||
2547 | } | 2579 | } |
2548 | epn_rxtx |= UDC_EPN_RX_ISO; | 2580 | epn_rxtx |= UDC_EPN_RX_ISO; |
2549 | dbuf = 1; | 2581 | dbuf = 1; |
@@ -2556,11 +2588,20 @@ omap_ep_setup(char *name, u8 addr, u8 type, | |||
2556 | dbuf = 0; | 2588 | dbuf = 0; |
2557 | 2589 | ||
2558 | switch (maxp) { | 2590 | switch (maxp) { |
2559 | case 8: epn_rxtx = 0 << 12; break; | 2591 | case 8: |
2560 | case 16: epn_rxtx = 1 << 12; break; | 2592 | epn_rxtx = 0 << 12; |
2561 | case 32: epn_rxtx = 2 << 12; break; | 2593 | break; |
2562 | case 64: epn_rxtx = 3 << 12; break; | 2594 | case 16: |
2563 | default: BUG(); | 2595 | epn_rxtx = 1 << 12; |
2596 | break; | ||
2597 | case 32: | ||
2598 | epn_rxtx = 2 << 12; | ||
2599 | break; | ||
2600 | case 64: | ||
2601 | epn_rxtx = 3 << 12; | ||
2602 | break; | ||
2603 | default: | ||
2604 | BUG(); | ||
2564 | } | 2605 | } |
2565 | if (dbuf && addr) | 2606 | if (dbuf && addr) |
2566 | epn_rxtx |= UDC_EPN_RX_DB; | 2607 | epn_rxtx |= UDC_EPN_RX_DB; |
@@ -2600,7 +2641,7 @@ omap_ep_setup(char *name, u8 addr, u8 type, | |||
2600 | ep->ep.name = ep->name; | 2641 | ep->ep.name = ep->name; |
2601 | ep->ep.ops = &omap_ep_ops; | 2642 | ep->ep.ops = &omap_ep_ops; |
2602 | ep->ep.maxpacket = ep->maxpacket = maxp; | 2643 | ep->ep.maxpacket = ep->maxpacket = maxp; |
2603 | list_add_tail (&ep->ep.ep_list, &udc->gadget.ep_list); | 2644 | list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); |
2604 | 2645 | ||
2605 | return buf; | 2646 | return buf; |
2606 | } | 2647 | } |
@@ -2608,7 +2649,7 @@ omap_ep_setup(char *name, u8 addr, u8 type, | |||
2608 | static void omap_udc_release(struct device *dev) | 2649 | static void omap_udc_release(struct device *dev) |
2609 | { | 2650 | { |
2610 | complete(udc->done); | 2651 | complete(udc->done); |
2611 | kfree (udc); | 2652 | kfree(udc); |
2612 | udc = NULL; | 2653 | udc = NULL; |
2613 | } | 2654 | } |
2614 | 2655 | ||
@@ -2626,13 +2667,13 @@ omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv) | |||
2626 | omap_writew(0, UDC_TXDMA_CFG); | 2667 | omap_writew(0, UDC_TXDMA_CFG); |
2627 | 2668 | ||
2628 | /* UDC_PULLUP_EN gates the chip clock */ | 2669 | /* UDC_PULLUP_EN gates the chip clock */ |
2629 | // OTG_SYSCON_1 |= DEV_IDLE_EN; | 2670 | /* OTG_SYSCON_1 |= DEV_IDLE_EN; */ |
2630 | 2671 | ||
2631 | udc = kzalloc(sizeof(*udc), GFP_KERNEL); | 2672 | udc = kzalloc(sizeof(*udc), GFP_KERNEL); |
2632 | if (!udc) | 2673 | if (!udc) |
2633 | return -ENOMEM; | 2674 | return -ENOMEM; |
2634 | 2675 | ||
2635 | spin_lock_init (&udc->lock); | 2676 | spin_lock_init(&udc->lock); |
2636 | 2677 | ||
2637 | udc->gadget.ops = &omap_gadget_ops; | 2678 | udc->gadget.ops = &omap_gadget_ops; |
2638 | udc->gadget.ep0 = &udc->ep[0].ep; | 2679 | udc->gadget.ep0 = &udc->ep[0].ep; |
@@ -2662,13 +2703,13 @@ omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv) | |||
2662 | omap_writew(0, UDC_EP_TX(tmp)); | 2703 | omap_writew(0, UDC_EP_TX(tmp)); |
2663 | } | 2704 | } |
2664 | 2705 | ||
2665 | #define OMAP_BULK_EP(name,addr) \ | 2706 | #define OMAP_BULK_EP(name, addr) \ |
2666 | buf = omap_ep_setup(name "-bulk", addr, \ | 2707 | buf = omap_ep_setup(name "-bulk", addr, \ |
2667 | USB_ENDPOINT_XFER_BULK, buf, 64, 1); | 2708 | USB_ENDPOINT_XFER_BULK, buf, 64, 1); |
2668 | #define OMAP_INT_EP(name,addr, maxp) \ | 2709 | #define OMAP_INT_EP(name, addr, maxp) \ |
2669 | buf = omap_ep_setup(name "-int", addr, \ | 2710 | buf = omap_ep_setup(name "-int", addr, \ |
2670 | USB_ENDPOINT_XFER_INT, buf, maxp, 0); | 2711 | USB_ENDPOINT_XFER_INT, buf, maxp, 0); |
2671 | #define OMAP_ISO_EP(name,addr, maxp) \ | 2712 | #define OMAP_ISO_EP(name, addr, maxp) \ |
2672 | buf = omap_ep_setup(name "-iso", addr, \ | 2713 | buf = omap_ep_setup(name "-iso", addr, \ |
2673 | USB_ENDPOINT_XFER_ISOC, buf, maxp, 1); | 2714 | USB_ENDPOINT_XFER_ISOC, buf, maxp, 1); |
2674 | 2715 | ||
@@ -2869,11 +2910,11 @@ bad_on_1710: | |||
2869 | 2910 | ||
2870 | /* a "gadget" abstracts/virtualizes the controller */ | 2911 | /* a "gadget" abstracts/virtualizes the controller */ |
2871 | status = omap_udc_setup(pdev, xceiv); | 2912 | status = omap_udc_setup(pdev, xceiv); |
2872 | if (status) { | 2913 | if (status) |
2873 | goto cleanup0; | 2914 | goto cleanup0; |
2874 | } | 2915 | |
2875 | xceiv = NULL; | 2916 | xceiv = NULL; |
2876 | // "udc" is now valid | 2917 | /* "udc" is now valid */ |
2877 | pullup_disable(udc); | 2918 | pullup_disable(udc); |
2878 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) | 2919 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
2879 | udc->gadget.is_otg = (config->otg != 0); | 2920 | udc->gadget.is_otg = (config->otg != 0); |
@@ -2887,7 +2928,7 @@ bad_on_1710: | |||
2887 | 2928 | ||
2888 | /* USB general purpose IRQ: ep0, state changes, dma, etc */ | 2929 | /* USB general purpose IRQ: ep0, state changes, dma, etc */ |
2889 | status = request_irq(pdev->resource[1].start, omap_udc_irq, | 2930 | status = request_irq(pdev->resource[1].start, omap_udc_irq, |
2890 | IRQF_SAMPLE_RANDOM, driver_name, udc); | 2931 | 0, driver_name, udc); |
2891 | if (status != 0) { | 2932 | if (status != 0) { |
2892 | ERR("can't get irq %d, err %d\n", | 2933 | ERR("can't get irq %d, err %d\n", |
2893 | (int) pdev->resource[1].start, status); | 2934 | (int) pdev->resource[1].start, status); |
@@ -2896,7 +2937,7 @@ bad_on_1710: | |||
2896 | 2937 | ||
2897 | /* USB "non-iso" IRQ (PIO for all but ep0) */ | 2938 | /* USB "non-iso" IRQ (PIO for all but ep0) */ |
2898 | status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, | 2939 | status = request_irq(pdev->resource[2].start, omap_udc_pio_irq, |
2899 | IRQF_SAMPLE_RANDOM, "omap_udc pio", udc); | 2940 | 0, "omap_udc pio", udc); |
2900 | if (status != 0) { | 2941 | if (status != 0) { |
2901 | ERR("can't get irq %d, err %d\n", | 2942 | ERR("can't get irq %d, err %d\n", |
2902 | (int) pdev->resource[2].start, status); | 2943 | (int) pdev->resource[2].start, status); |
@@ -2939,7 +2980,7 @@ cleanup2: | |||
2939 | free_irq(pdev->resource[1].start, udc); | 2980 | free_irq(pdev->resource[1].start, udc); |
2940 | 2981 | ||
2941 | cleanup1: | 2982 | cleanup1: |
2942 | kfree (udc); | 2983 | kfree(udc); |
2943 | udc = NULL; | 2984 | udc = NULL; |
2944 | 2985 | ||
2945 | cleanup0: | 2986 | cleanup0: |