s3c2410_udc.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. *
  22. */
  23. #ifndef _S3C2410_UDC_H
  24. #define _S3C2410_UDC_H
  25. struct s3c2410_ep {
  26. struct list_head queue;
  27. unsigned long last_io; /* jiffies timestamp */
  28. struct usb_gadget *gadget;
  29. struct s3c2410_udc *dev;
  30. const struct usb_endpoint_descriptor *desc;
  31. struct usb_ep ep;
  32. u8 num;
  33. unsigned short fifo_size;
  34. u8 bEndpointAddress;
  35. u8 bmAttributes;
  36. unsigned halted : 1;
  37. unsigned already_seen : 1;
  38. unsigned setup_stage : 1;
  39. };
  40. /* Warning : ep0 has a fifo of 16 bytes */
  41. /* Don't try to set 32 or 64 */
  42. /* also testusb 14 fails wit 16 but is */
  43. /* fine with 8 */
  44. #define EP0_FIFO_SIZE 8
  45. #define EP_FIFO_SIZE 64
  46. #define DEFAULT_POWER_STATE 0x00
  47. #define S3C2440_EP_FIFO_SIZE 128
  48. static const char ep0name [] = "ep0";
  49. static const char *const ep_name[] = {
  50. ep0name, /* everyone has ep0 */
  51. /* s3c2410 four bidirectional bulk endpoints */
  52. "ep1-bulk", "ep2-bulk", "ep3-bulk", "ep4-bulk",
  53. };
  54. #define S3C2410_ENDPOINTS ARRAY_SIZE(ep_name)
  55. struct s3c2410_request {
  56. struct list_head queue; /* ep's requests */
  57. struct usb_request req;
  58. };
  59. enum ep0_state {
  60. EP0_IDLE,
  61. EP0_IN_DATA_PHASE,
  62. EP0_OUT_DATA_PHASE,
  63. EP0_END_XFER,
  64. EP0_STALL,
  65. };
  66. static const char *ep0states[]= {
  67. "EP0_IDLE",
  68. "EP0_IN_DATA_PHASE",
  69. "EP0_OUT_DATA_PHASE",
  70. "EP0_END_XFER",
  71. "EP0_STALL",
  72. };
  73. struct s3c2410_udc {
  74. spinlock_t lock;
  75. struct s3c2410_ep ep[S3C2410_ENDPOINTS];
  76. int address;
  77. struct usb_gadget gadget;
  78. struct usb_gadget_driver *driver;
  79. struct s3c2410_request fifo_req;
  80. u8 fifo_buf[EP_FIFO_SIZE];
  81. u16 devstatus;
  82. u32 port_status;
  83. int ep0state;
  84. unsigned got_irq : 1;
  85. unsigned req_std : 1;
  86. unsigned req_config : 1;
  87. unsigned req_pending : 1;
  88. u8 vbus;
  89. struct dentry *regs_info;
  90. };
  91. #endif