musb.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. #ifndef __deprecated
  12. #define __deprecated
  13. #endif
  14. #include <linux/compat.h>
  15. /* The USB role is defined by the connector used on the board, so long as
  16. * standards are being followed. (Developer boards sometimes won't.)
  17. */
  18. enum musb_mode {
  19. MUSB_UNDEFINED = 0,
  20. MUSB_HOST, /* A or Mini-A connector */
  21. MUSB_PERIPHERAL, /* B or Mini-B connector */
  22. MUSB_OTG /* Mini-AB connector */
  23. };
  24. struct clk;
  25. enum musb_fifo_style {
  26. FIFO_RXTX,
  27. FIFO_TX,
  28. FIFO_RX
  29. } __attribute__ ((packed));
  30. enum musb_buf_mode {
  31. BUF_SINGLE,
  32. BUF_DOUBLE
  33. } __attribute__ ((packed));
  34. struct musb_fifo_cfg {
  35. u8 hw_ep_num;
  36. enum musb_fifo_style style;
  37. enum musb_buf_mode mode;
  38. u16 maxpacket;
  39. };
  40. #define MUSB_EP_FIFO(ep, st, m, pkt) \
  41. { \
  42. .hw_ep_num = ep, \
  43. .style = st, \
  44. .mode = m, \
  45. .maxpacket = pkt, \
  46. }
  47. #define MUSB_EP_FIFO_SINGLE(ep, st, pkt) \
  48. MUSB_EP_FIFO(ep, st, BUF_SINGLE, pkt)
  49. #define MUSB_EP_FIFO_DOUBLE(ep, st, pkt) \
  50. MUSB_EP_FIFO(ep, st, BUF_DOUBLE, pkt)
  51. struct musb_hdrc_eps_bits {
  52. const char name[16];
  53. u8 bits;
  54. };
  55. struct musb_hdrc_config {
  56. struct musb_fifo_cfg *fifo_cfg; /* board fifo configuration */
  57. unsigned fifo_cfg_size; /* size of the fifo configuration */
  58. /* MUSB configuration-specific details */
  59. unsigned multipoint:1; /* multipoint device */
  60. unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */
  61. unsigned soft_con:1 __deprecated; /* soft connect required */
  62. unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */
  63. unsigned big_endian:1; /* true if CPU uses big-endian */
  64. unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */
  65. unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */
  66. unsigned high_iso_tx:1; /* Tx ep required for HB iso */
  67. unsigned high_iso_rx:1; /* Rx ep required for HD iso */
  68. unsigned dma:1 __deprecated; /* supports DMA */
  69. unsigned vendor_req:1 __deprecated; /* vendor registers required */
  70. u8 num_eps; /* number of endpoints _with_ ep0 */
  71. u8 dma_channels __deprecated; /* number of dma channels */
  72. u8 dyn_fifo_size; /* dynamic size in bytes */
  73. u8 vendor_ctrl __deprecated; /* vendor control reg width */
  74. u8 vendor_stat __deprecated; /* vendor status reg witdh */
  75. u8 dma_req_chan __deprecated; /* bitmask for required dma channels */
  76. u8 ram_bits; /* ram address size */
  77. struct musb_hdrc_eps_bits *eps_bits __deprecated;
  78. };
  79. struct musb_hdrc_platform_data {
  80. /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
  81. u8 mode;
  82. /* for clk_get() */
  83. const char *clock;
  84. /* (HOST or OTG) switch VBUS on/off */
  85. int (*set_vbus)(struct device *dev, int is_on);
  86. /* (HOST or OTG) mA/2 power supplied on (default = 8mA) */
  87. u8 power;
  88. /* (PERIPHERAL) mA/2 max power consumed (default = 100mA) */
  89. u8 min_power;
  90. /* (HOST or OTG) msec/2 after VBUS on till power good */
  91. u8 potpgt;
  92. /* (HOST or OTG) program PHY for external Vbus */
  93. unsigned extvbus:1;
  94. /* Power the device on or off */
  95. int (*set_power)(int state);
  96. /* MUSB configuration-specific details */
  97. struct musb_hdrc_config *config;
  98. /* Architecture specific board data */
  99. void *board_data;
  100. /* Platform specific struct musb_ops pointer */
  101. const void *platform_ops;
  102. };
  103. /* TUSB 6010 support */
  104. #define TUSB6010_OSCCLK_60 16667 /* psec/clk @ 60.0 MHz */
  105. #define TUSB6010_REFCLK_24 41667 /* psec/clk @ 24.0 MHz XI */
  106. #define TUSB6010_REFCLK_19 52083 /* psec/clk @ 19.2 MHz CLKIN */
  107. #ifdef CONFIG_ARCH_OMAP2PLUS
  108. extern int __init tusb6010_setup_interface(
  109. struct musb_hdrc_platform_data *data,
  110. unsigned ps_refclk, unsigned waitpin,
  111. unsigned async_cs, unsigned sync_cs,
  112. unsigned irq, unsigned dmachan);
  113. extern int tusb6010_platform_retime(unsigned is_refclk);
  114. #endif /* OMAP2 */
  115. /*
  116. * U-Boot specfic stuff
  117. */
  118. struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
  119. void *ctl_regs);
  120. #endif /* __LINUX_USB_MUSB_H */