s3c2410_udc.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * linux/drivers/usb/gadget/s3c2410_udc.h
  3. * Samsung on-chip full speed USB device controllers
  4. *
  5. * Copyright (C) 2004-2007 Herbert Pötzl - Arnaud Patard
  6. * Additional cleanups by Ben Dooks <ben-linux@fluff.org>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #ifndef _S3C2410_UDC_H
  14. #define _S3C2410_UDC_H
  15. struct s3c2410_ep {
  16. struct list_head queue;
  17. unsigned long last_io; /* jiffies timestamp */
  18. struct usb_gadget *gadget;
  19. struct s3c2410_udc *dev;
  20. struct usb_ep ep;
  21. u8 num;
  22. unsigned short fifo_size;
  23. u8 bEndpointAddress;
  24. u8 bmAttributes;
  25. unsigned halted : 1;
  26. unsigned already_seen : 1;
  27. unsigned setup_stage : 1;
  28. };
  29. /* Warning : ep0 has a fifo of 16 bytes */
  30. /* Don't try to set 32 or 64 */
  31. /* also testusb 14 fails wit 16 but is */
  32. /* fine with 8 */
  33. #define EP0_FIFO_SIZE 8
  34. #define EP_FIFO_SIZE 64
  35. #define DEFAULT_POWER_STATE 0x00
  36. #define S3C2440_EP_FIFO_SIZE 128
  37. static const char ep0name [] = "ep0";
  38. static const char *const ep_name[] = {
  39. ep0name, /* everyone has ep0 */
  40. /* s3c2410 four bidirectional bulk endpoints */
  41. "ep1-bulk", "ep2-bulk", "ep3-bulk", "ep4-bulk",
  42. };
  43. #define S3C2410_ENDPOINTS ARRAY_SIZE(ep_name)
  44. struct s3c2410_request {
  45. struct list_head queue; /* ep's requests */
  46. struct usb_request req;
  47. };
  48. enum ep0_state {
  49. EP0_IDLE,
  50. EP0_IN_DATA_PHASE,
  51. EP0_OUT_DATA_PHASE,
  52. EP0_END_XFER,
  53. EP0_STALL,
  54. };
  55. static const char *ep0states[]= {
  56. "EP0_IDLE",
  57. "EP0_IN_DATA_PHASE",
  58. "EP0_OUT_DATA_PHASE",
  59. "EP0_END_XFER",
  60. "EP0_STALL",
  61. };
  62. struct s3c2410_udc {
  63. spinlock_t lock;
  64. struct s3c2410_ep ep[S3C2410_ENDPOINTS];
  65. int address;
  66. struct usb_gadget gadget;
  67. struct usb_gadget_driver *driver;
  68. struct s3c2410_request fifo_req;
  69. u8 fifo_buf[EP_FIFO_SIZE];
  70. u16 devstatus;
  71. u32 port_status;
  72. int ep0state;
  73. unsigned got_irq : 1;
  74. unsigned req_std : 1;
  75. unsigned req_config : 1;
  76. unsigned req_pending : 1;
  77. u8 vbus;
  78. struct dentry *regs_info;
  79. };
  80. #define to_s3c2410(g) (container_of((g), struct s3c2410_udc, gadget))
  81. #endif