musb.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * This is used to for host and peripheral modes of the driver for
  3. * Inventra (Multidrop) Highspeed Dual-Role Controllers: (M)HDRC.
  4. *
  5. * Board initialization should put one of these into dev->platform_data,
  6. * probably on some platform_device named "musb-hdrc". It encapsulates
  7. * key configuration differences between boards.
  8. */
  9. #ifndef __LINUX_USB_MUSB_H
  10. #define __LINUX_USB_MUSB_H
  11. /* The USB role is defined by the connector used on the board, so long as
  12. * standards are being followed. (Developer boards sometimes won't.)
  13. */
  14. enum musb_mode {
  15. MUSB_UNDEFINED = 0,
  16. MUSB_HOST, /* A or Mini-A connector */
  17. MUSB_PERIPHERAL, /* B or Mini-B connector */
  18. MUSB_OTG /* Mini-AB connector */
  19. };
  20. struct clk;
  21. enum musb_fifo_style {
  22. MUSB_FIFO_RXTX, /* add MUSB_ prefix to avoid confilicts with musbfsh.h, gang */
  23. MUSB_FIFO_TX,
  24. MUSB_FIFO_RX
  25. } __packed;
  26. enum musb_buf_mode {
  27. MUSB_BUF_SINGLE, /* add MUSB_ prefix to avoid confilicts with musbfsh.h, gang */
  28. MUSB_BUF_DOUBLE
  29. } __packed;
  30. enum musb_ep_mode {
  31. EP_CONT,
  32. EP_INT,
  33. EP_BULK,
  34. EP_ISO
  35. } __packed;
  36. struct musb_fifo_cfg {
  37. u8 hw_ep_num;
  38. enum musb_fifo_style style;
  39. enum musb_buf_mode mode;
  40. u16 maxpacket;
  41. enum musb_ep_mode ep_mode;
  42. };
  43. #define MUSB_EP_FIFO(ep, st, m, pkt) \
  44. { \
  45. .hw_ep_num = ep, \
  46. .style = st, \
  47. .mode = m, \
  48. .maxpacket = pkt, \
  49. }
  50. #define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
  51. MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
  52. #define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
  53. MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
  54. struct musb_hdrc_eps_bits {
  55. const char name[16];
  56. u8 bits;
  57. };
  58. struct musb_hdrc_config {
  59. struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */
  60. unsigned fifo_cfg_size; /* size of the fifo configuration */
  61. /* MUSB configuration-specific details */
  62. unsigned multipoint:1; /* multipoint device */
  63. unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
  64. unsigned soft_con:1 __deprecated; /* soft connect required */
  65. unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */
  66. unsigned big_endian:1; /* true if CPU uses big-endian */
  67. unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
  68. unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
  69. unsigned high_iso_tx:1; /* Tx ep required for HB iso */
  70. unsigned high_iso_rx:1; /* Rx ep required for HD iso */
  71. unsigned dma:1 __deprecated; /* supports DMA */
  72. unsigned vendor_req:1 __deprecated; /* vendor registers required */
  73. u8 num_eps; /* number of endpoints _with_ ep0 */
  74. u8 dma_channels __deprecated; /* number of dma channels */
  75. u8 dyn_fifo_size; /* dynamic size in bytes */
  76. u8 vendor_ctrl __deprecated; /* vendor control reg width */
  77. u8 vendor_stat __deprecated; /* vendor status reg witdh */
  78. u8 dma_req_chan __deprecated; /* bitmask for required dma channels */
  79. u8 ram_bits; /* ram address size */
  80. struct musb_hdrc_eps_bits *eps_bits __deprecated;
  81. };
  82. struct musb_hdrc_platform_data {
  83. /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
  84. u8 mode;
  85. /* for clk_get() */
  86. const char *clock;
  87. /* (HOST or OTG) switch VBUS on/off */
  88. int (*set_vbus)(struct device *dev, int is_on);
  89. /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
  90. u8 power;
  91. /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */
  92. u8 min_power;
  93. /* (HOST or OTG) msec/2 after VBUS on till power good */
  94. u8 potpgt;
  95. /* (HOST or OTG) program PHY for external Vbus */
  96. unsigned extvbus:1;
  97. /* Power the device on or off */
  98. int (*set_power)(int state);
  99. /* MUSB configuration-specific details */
  100. struct musb_hdrc_config *config;
  101. /* Architecture specific board data */
  102. void *board_data;
  103. /* Platform specific struct musb_ops pointer */
  104. const void *platform_ops;
  105. };
  106. #endif /* __LINUX_USB_MUSB_H */