aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/imx_udc.h
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2009-03-26 17:28:11 -0400
committerJames Morris <jmorris@namei.org>2009-03-26 17:28:11 -0400
commit1987f17d2266e882862528841429b5bf67bc8fe5 (patch)
tree5c3fbee88018ab7259a18c10e6320e575d0ed679 /drivers/usb/gadget/imx_udc.h
parent7198e2eeb44b3fe7cc97f997824002da47a9c644 (diff)
parent0384e2959127a56d0640505d004d8dd92f9c29f5 (diff)
Merge branch 'master' into next
Diffstat (limited to 'drivers/usb/gadget/imx_udc.h')
-rw-r--r--drivers/usb/gadget/imx_udc.h49
1 files changed, 32 insertions, 17 deletions
diff --git a/drivers/usb/gadget/imx_udc.h b/drivers/usb/gadget/imx_udc.h
index 850076937d8d..b48ad59603d1 100644
--- a/drivers/usb/gadget/imx_udc.h
+++ b/drivers/usb/gadget/imx_udc.h
@@ -23,7 +23,8 @@
23/* Helper macros */ 23/* Helper macros */
24#define EP_NO(ep) ((ep->bEndpointAddress) & ~USB_DIR_IN) /* IN:1, OUT:0 */ 24#define EP_NO(ep) ((ep->bEndpointAddress) & ~USB_DIR_IN) /* IN:1, OUT:0 */
25#define EP_DIR(ep) ((ep->bEndpointAddress) & USB_DIR_IN ? 1 : 0) 25#define EP_DIR(ep) ((ep->bEndpointAddress) & USB_DIR_IN ? 1 : 0)
26#define irq_to_ep(irq) (((irq) >= USBD_INT0) || ((irq) <= USBD_INT6) ? ((irq) - USBD_INT0) : (USBD_INT6)) /*should not happen*/ 26#define irq_to_ep(irq) (((irq) >= USBD_INT0) || ((irq) <= USBD_INT6) \
27 ? ((irq) - USBD_INT0) : (USBD_INT6)) /*should not happen*/
27#define ep_to_irq(ep) (EP_NO((ep)) + USBD_INT0) 28#define ep_to_irq(ep) (EP_NO((ep)) + USBD_INT0)
28#define IMX_USB_NB_EP 6 29#define IMX_USB_NB_EP 6
29 30
@@ -58,6 +59,7 @@ struct imx_udc_struct {
58 struct device *dev; 59 struct device *dev;
59 struct imx_ep_struct imx_ep[IMX_USB_NB_EP]; 60 struct imx_ep_struct imx_ep[IMX_USB_NB_EP];
60 struct clk *clk; 61 struct clk *clk;
62 struct timer_list timer;
61 enum ep0_state ep0state; 63 enum ep0_state ep0state;
62 struct resource *res; 64 struct resource *res;
63 void __iomem *base; 65 void __iomem *base;
@@ -88,8 +90,8 @@ struct imx_udc_struct {
88#define USB_EP_FDAT3(x) (0x3F + (x*0x30)) /* USB FIFO data */ 90#define USB_EP_FDAT3(x) (0x3F + (x*0x30)) /* USB FIFO data */
89#define USB_EP_FSTAT(x) (0x40 + (x*0x30)) /* USB FIFO status */ 91#define USB_EP_FSTAT(x) (0x40 + (x*0x30)) /* USB FIFO status */
90#define USB_EP_FCTRL(x) (0x44 + (x*0x30)) /* USB FIFO control */ 92#define USB_EP_FCTRL(x) (0x44 + (x*0x30)) /* USB FIFO control */
91#define USB_EP_LRFP(x) (0x48 + (x*0x30)) /* USB last read frame pointer */ 93#define USB_EP_LRFP(x) (0x48 + (x*0x30)) /* USB last rd f. pointer */
92#define USB_EP_LWFP(x) (0x4C + (x*0x30)) /* USB last write frame pointer */ 94#define USB_EP_LWFP(x) (0x4C + (x*0x30)) /* USB last wr f. pointer */
93#define USB_EP_FALRM(x) (0x50 + (x*0x30)) /* USB FIFO alarm */ 95#define USB_EP_FALRM(x) (0x50 + (x*0x30)) /* USB FIFO alarm */
94#define USB_EP_FRDP(x) (0x54 + (x*0x30)) /* USB FIFO read pointer */ 96#define USB_EP_FRDP(x) (0x54 + (x*0x30)) /* USB FIFO read pointer */
95#define USB_EP_FWRP(x) (0x58 + (x*0x30)) /* USB FIFO write pointer */ 97#define USB_EP_FWRP(x) (0x58 + (x*0x30)) /* USB FIFO write pointer */
@@ -170,7 +172,7 @@ struct imx_udc_struct {
170/* #define DEBUG_IRQ */ 172/* #define DEBUG_IRQ */
171/* #define DEBUG_EPIRQ */ 173/* #define DEBUG_EPIRQ */
172/* #define DEBUG_DUMP */ 174/* #define DEBUG_DUMP */
173#define DEBUG_ERR 175/* #define DEBUG_ERR */
174 176
175#ifdef DEBUG_REQ 177#ifdef DEBUG_REQ
176 #define D_REQ(dev, args...) dev_dbg(dev, ## args) 178 #define D_REQ(dev, args...) dev_dbg(dev, ## args)
@@ -228,7 +230,8 @@ struct imx_udc_struct {
228#endif /* DEBUG_IRQ */ 230#endif /* DEBUG_IRQ */
229 231
230#ifdef DEBUG_EPIRQ 232#ifdef DEBUG_EPIRQ
231 static void dump_ep_intr(const char *label, int nr, int irqreg, struct device *dev) 233 static void dump_ep_intr(const char *label, int nr, int irqreg,
234 struct device *dev)
232 { 235 {
233 dev_dbg(dev, "<%s> EP%d_INTR=[%s%s%s%s%s%s%s%s%s]\n", label, nr, 236 dev_dbg(dev, "<%s> EP%d_INTR=[%s%s%s%s%s%s%s%s%s]\n", label, nr,
234 (irqreg & EPINTR_FIFO_FULL) ? " full" : "", 237 (irqreg & EPINTR_FIFO_FULL) ? " full" : "",
@@ -246,7 +249,8 @@ struct imx_udc_struct {
246#endif /* DEBUG_IRQ */ 249#endif /* DEBUG_IRQ */
247 250
248#ifdef DEBUG_DUMP 251#ifdef DEBUG_DUMP
249 static void dump_usb_stat(const char *label, struct imx_udc_struct *imx_usb) 252 static void dump_usb_stat(const char *label,
253 struct imx_udc_struct *imx_usb)
250 { 254 {
251 int temp = __raw_readl(imx_usb->base + USB_STAT); 255 int temp = __raw_readl(imx_usb->base + USB_STAT);
252 256
@@ -259,12 +263,15 @@ struct imx_udc_struct {
259 (temp & STAT_ALTSET)); 263 (temp & STAT_ALTSET));
260 } 264 }
261 265
262 static void dump_ep_stat(const char *label, struct imx_ep_struct *imx_ep) 266 static void dump_ep_stat(const char *label,
267 struct imx_ep_struct *imx_ep)
263 { 268 {
264 int temp = __raw_readl(imx_ep->imx_usb->base + USB_EP_INTR(EP_NO(imx_ep))); 269 int temp = __raw_readl(imx_ep->imx_usb->base
270 + USB_EP_INTR(EP_NO(imx_ep)));
265 271
266 dev_dbg(imx_ep->imx_usb->dev, 272 dev_dbg(imx_ep->imx_usb->dev,
267 "<%s> EP%d_INTR=[%s%s%s%s%s%s%s%s%s]\n", label, EP_NO(imx_ep), 273 "<%s> EP%d_INTR=[%s%s%s%s%s%s%s%s%s]\n",
274 label, EP_NO(imx_ep),
268 (temp & EPINTR_FIFO_FULL) ? " full" : "", 275 (temp & EPINTR_FIFO_FULL) ? " full" : "",
269 (temp & EPINTR_FIFO_EMPTY) ? " fempty" : "", 276 (temp & EPINTR_FIFO_EMPTY) ? " fempty" : "",
270 (temp & EPINTR_FIFO_ERROR) ? " ferr" : "", 277 (temp & EPINTR_FIFO_ERROR) ? " ferr" : "",
@@ -275,18 +282,22 @@ struct imx_udc_struct {
275 (temp & EPINTR_DEVREQ) ? " devreq" : "", 282 (temp & EPINTR_DEVREQ) ? " devreq" : "",
276 (temp & EPINTR_EOT) ? " eot" : ""); 283 (temp & EPINTR_EOT) ? " eot" : "");
277 284
278 temp = __raw_readl(imx_ep->imx_usb->base + USB_EP_STAT(EP_NO(imx_ep))); 285 temp = __raw_readl(imx_ep->imx_usb->base
286 + USB_EP_STAT(EP_NO(imx_ep)));
279 287
280 dev_dbg(imx_ep->imx_usb->dev, 288 dev_dbg(imx_ep->imx_usb->dev,
281 "<%s> EP%d_STAT=[%s%s bcount=%d]\n", label, EP_NO(imx_ep), 289 "<%s> EP%d_STAT=[%s%s bcount=%d]\n",
290 label, EP_NO(imx_ep),
282 (temp & EPSTAT_SIP) ? " sip" : "", 291 (temp & EPSTAT_SIP) ? " sip" : "",
283 (temp & EPSTAT_STALL) ? " stall" : "", 292 (temp & EPSTAT_STALL) ? " stall" : "",
284 (temp & EPSTAT_BCOUNT) >> 16); 293 (temp & EPSTAT_BCOUNT) >> 16);
285 294
286 temp = __raw_readl(imx_ep->imx_usb->base + USB_EP_FSTAT(EP_NO(imx_ep))); 295 temp = __raw_readl(imx_ep->imx_usb->base
296 + USB_EP_FSTAT(EP_NO(imx_ep)));
287 297
288 dev_dbg(imx_ep->imx_usb->dev, 298 dev_dbg(imx_ep->imx_usb->dev,
289 "<%s> EP%d_FSTAT=[%s%s%s%s%s%s%s]\n", label, EP_NO(imx_ep), 299 "<%s> EP%d_FSTAT=[%s%s%s%s%s%s%s]\n",
300 label, EP_NO(imx_ep),
290 (temp & FSTAT_ERR) ? " ferr" : "", 301 (temp & FSTAT_ERR) ? " ferr" : "",
291 (temp & FSTAT_UF) ? " funder" : "", 302 (temp & FSTAT_UF) ? " funder" : "",
292 (temp & FSTAT_OF) ? " fover" : "", 303 (temp & FSTAT_OF) ? " fover" : "",
@@ -296,19 +307,23 @@ struct imx_udc_struct {
296 (temp & FSTAT_EMPTY) ? " fempty" : ""); 307 (temp & FSTAT_EMPTY) ? " fempty" : "");
297 } 308 }
298 309
299 static void dump_req(const char *label, struct imx_ep_struct *imx_ep, struct usb_request *req) 310 static void dump_req(const char *label, struct imx_ep_struct *imx_ep,
311 struct usb_request *req)
300 { 312 {
301 int i; 313 int i;
302 314
303 if (!req || !req->buf) { 315 if (!req || !req->buf) {
304 dev_dbg(imx_ep->imx_usb->dev, "<%s> req or req buf is free\n", label); 316 dev_dbg(imx_ep->imx_usb->dev,
317 "<%s> req or req buf is free\n", label);
305 return; 318 return;
306 } 319 }
307 320
308 if ((!EP_NO(imx_ep) && imx_ep->imx_usb->ep0state == EP0_IN_DATA_PHASE) 321 if ((!EP_NO(imx_ep) && imx_ep->imx_usb->ep0state
322 == EP0_IN_DATA_PHASE)
309 || (EP_NO(imx_ep) && EP_DIR(imx_ep))) { 323 || (EP_NO(imx_ep) && EP_DIR(imx_ep))) {
310 324
311 dev_dbg(imx_ep->imx_usb->dev, "<%s> request dump <", label); 325 dev_dbg(imx_ep->imx_usb->dev,
326 "<%s> request dump <", label);
312 for (i = 0; i < req->length; i++) 327 for (i = 0; i < req->length; i++)
313 printk("%02x-", *((u8 *)req->buf + i)); 328 printk("%02x-", *((u8 *)req->buf + i));
314 printk(">\n"); 329 printk(">\n");