musbfsh.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 "musbfsh_hdrc". It encapsulates
  7. * key configuration differences between boards.
  8. */
  9. #ifndef __LINUX_USB_MUSBFSH_H
  10. #define __LINUX_USB_MUSBFSH_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 musbfsh_mode {
  15. MUSBFSH_UNDEFINED = 0,
  16. MUSBFSH_HOST, /* A or Mini-A connector */
  17. MUSBFSH_PERIPHERAL, /* B or Mini-B connector */
  18. MUSBFSH_OTG /* Mini-AB connector */
  19. };
  20. struct clk;
  21. enum musbfsh_fifo_style {
  22. FIFO_RXTX,
  23. FIFO_TX,
  24. FIFO_RX
  25. } __packed;
  26. enum musbfsh_buf_mode {
  27. BUF_SINGLE,
  28. BUF_DOUBLE
  29. } __packed;
  30. struct musbfsh_fifo_cfg {
  31. u8 hw_ep_num;
  32. enum musbfsh_fifo_style style;
  33. enum musbfsh_buf_mode mode;
  34. u16 maxpacket;
  35. };
  36. #define MUSBFSH_EP_FIFO(ep, st, m, pkt) \
  37. { \
  38. .hw_ep_num = ep, \
  39. .style = st, \
  40. .mode = m, \
  41. .maxpacket = pkt, \
  42. }
  43. #define MUSBFSH_EP_FIFO_SINGLE(ep, st, pkt) \
  44. MUSBFSH_EP_FIFO(ep, st, BUF_SINGLE, pkt)
  45. #define MUSBFSH_EP_FIFO_DOUBLE(ep, st, pkt) \
  46. MUSBFSH_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
  47. struct musbfsh_hdrc_eps_bits {
  48. const char name[16];
  49. u8 bits;
  50. };
  51. struct musbfsh_hdrc_config {
  52. struct musbfsh_fifo_cfg *fifo_cfg; /* board fifo configuration */
  53. unsigned fifo_cfg_size; /* size of the fifo configuration */
  54. /* MUSB configuration-specific details */
  55. unsigned multipoint:1; /* multipoint device */
  56. unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
  57. unsigned soft_con:1 __deprecated; /* soft connect required */
  58. unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */
  59. unsigned big_endian:1; /* true if CPU uses big-endian */
  60. unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
  61. unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
  62. unsigned high_iso_tx:1; /* Tx ep required for HB iso */
  63. unsigned high_iso_rx:1; /* Rx ep required for HD iso */
  64. unsigned dma:1 __deprecated; /* supports DMA */
  65. unsigned vendor_req:1 __deprecated; /* vendor registers required */
  66. u8 num_eps; /* number of endpoints _with_ ep0 */
  67. u8 dma_channels __deprecated; /* number of dma channels */
  68. u8 dyn_fifo_size; /* dynamic size in bytes */
  69. u8 vendor_ctrl __deprecated; /* vendor control reg width */
  70. u8 vendor_stat __deprecated; /* vendor status reg witdh */
  71. u8 dma_req_chan __deprecated; /* bitmask for required dma channels */
  72. u8 ram_bits; /* ram address size */
  73. struct musbfsh_hdrc_eps_bits *eps_bits __deprecated;
  74. };
  75. struct musbfsh_hdrc_platform_data {
  76. /* MUSBFSH_HOST, MUSBFSH_PERIPHERAL, or MUSBFSH_OTG */
  77. u8 mode;
  78. const char *clock;
  79. /* (HOST or OTG) switch VBUS on/off */
  80. int (*set_vbus)(struct device *dev, int is_on);
  81. /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
  82. u8 power;
  83. u8 min_power;
  84. u8 potpgt;
  85. /* (HOST or OTG) program PHY for external Vbus */
  86. unsigned extvbus:1;
  87. /* Power the device on or off */
  88. int (*set_power)(int state);
  89. /* MUSB configuration-specific details */
  90. struct musbfsh_hdrc_config *config;
  91. void *board_data;
  92. const void *platform_ops;
  93. };
  94. #endif /* __LINUX_USB_MUSBFSH_H */