usb.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. // include/asm-arm/mach-omap/usb.h
  2. #ifndef __ASM_ARCH_OMAP_USB_H
  3. #define __ASM_ARCH_OMAP_USB_H
  4. #include <linux/io.h>
  5. #include <linux/platform_device.h>
  6. #include <linux/usb/musb.h>
  7. #define OMAP3_HS_USB_PORTS 3
  8. enum usbhs_omap_port_mode {
  9. OMAP_USBHS_PORT_MODE_UNUSED,
  10. OMAP_EHCI_PORT_MODE_PHY,
  11. OMAP_EHCI_PORT_MODE_TLL,
  12. OMAP_EHCI_PORT_MODE_HSIC,
  13. OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
  14. OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM,
  15. OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0,
  16. OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM,
  17. OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0,
  18. OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM,
  19. OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0,
  20. OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM,
  21. OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0,
  22. OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM
  23. };
  24. struct usbhs_omap_board_data {
  25. enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
  26. /* have to be valid if phy_reset is true and portx is in phy mode */
  27. int reset_gpio_port[OMAP3_HS_USB_PORTS];
  28. /* Set this to true for ES2.x silicon */
  29. unsigned es2_compatibility:1;
  30. unsigned phy_reset:1;
  31. /*
  32. * Regulators for USB PHYs.
  33. * Each PHY can have a separate regulator.
  34. */
  35. struct regulator *regulator[OMAP3_HS_USB_PORTS];
  36. };
  37. #ifdef CONFIG_ARCH_OMAP2PLUS
  38. struct ehci_hcd_omap_platform_data {
  39. enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
  40. int reset_gpio_port[OMAP3_HS_USB_PORTS];
  41. struct regulator *regulator[OMAP3_HS_USB_PORTS];
  42. unsigned phy_reset:1;
  43. };
  44. struct ohci_hcd_omap_platform_data {
  45. enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
  46. unsigned es2_compatibility:1;
  47. };
  48. struct usbhs_omap_platform_data {
  49. enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
  50. struct ehci_hcd_omap_platform_data *ehci_data;
  51. struct ohci_hcd_omap_platform_data *ohci_data;
  52. };
  53. struct usbtll_omap_platform_data {
  54. enum usbhs_omap_port_mode port_mode[OMAP3_HS_USB_PORTS];
  55. };
  56. /*-------------------------------------------------------------------------*/
  57. struct omap_musb_board_data {
  58. u8 interface_type;
  59. u8 mode;
  60. u16 power;
  61. unsigned extvbus:1;
  62. void (*set_phy_power)(u8 on);
  63. void (*clear_irq)(void);
  64. void (*set_mode)(u8 mode);
  65. void (*reset)(void);
  66. };
  67. enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
  68. extern void usb_musb_init(struct omap_musb_board_data *board_data);
  69. extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
  70. extern int omap_tll_enable(void);
  71. extern int omap_tll_disable(void);
  72. extern int omap4430_phy_power(struct device *dev, int ID, int on);
  73. extern int omap4430_phy_set_clk(struct device *dev, int on);
  74. extern int omap4430_phy_init(struct device *dev);
  75. extern int omap4430_phy_exit(struct device *dev);
  76. extern int omap4430_phy_suspend(struct device *dev, int suspend);
  77. #endif
  78. extern void am35x_musb_reset(void);
  79. extern void am35x_musb_phy_power(u8 on);
  80. extern void am35x_musb_clear_irq(void);
  81. extern void am35x_set_mode(u8 musb_mode);
  82. extern void ti81xx_musb_phy_power(u8 on);
  83. /* AM35x */
  84. /* USB 2.0 PHY Control */
  85. #define CONF2_PHY_GPIOMODE (1 << 23)
  86. #define CONF2_OTGMODE (3 << 14)
  87. #define CONF2_NO_OVERRIDE (0 << 14)
  88. #define CONF2_FORCE_HOST (1 << 14)
  89. #define CONF2_FORCE_DEVICE (2 << 14)
  90. #define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
  91. #define CONF2_SESENDEN (1 << 13)
  92. #define CONF2_VBDTCTEN (1 << 12)
  93. #define CONF2_REFFREQ_24MHZ (2 << 8)
  94. #define CONF2_REFFREQ_26MHZ (7 << 8)
  95. #define CONF2_REFFREQ_13MHZ (6 << 8)
  96. #define CONF2_REFFREQ (0xf << 8)
  97. #define CONF2_PHYCLKGD (1 << 7)
  98. #define CONF2_VBUSSENSE (1 << 6)
  99. #define CONF2_PHY_PLLON (1 << 5)
  100. #define CONF2_RESET (1 << 4)
  101. #define CONF2_PHYPWRDN (1 << 3)
  102. #define CONF2_OTGPWRDN (1 << 2)
  103. #define CONF2_DATPOL (1 << 1)
  104. /* TI81XX specific definitions */
  105. #define USBCTRL0 0x620
  106. #define USBSTAT0 0x624
  107. /* TI816X PHY controls bits */
  108. #define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
  109. #define TI816X_USBPHY_REFCLK_OSC (1 << 8)
  110. /* TI814X PHY controls bits */
  111. #define USBPHY_CM_PWRDN (1 << 0)
  112. #define USBPHY_OTG_PWRDN (1 << 1)
  113. #define USBPHY_CHGDET_DIS (1 << 2)
  114. #define USBPHY_CHGDET_RSTRT (1 << 3)
  115. #define USBPHY_SRCONDM (1 << 4)
  116. #define USBPHY_SINKONDP (1 << 5)
  117. #define USBPHY_CHGISINK_EN (1 << 6)
  118. #define USBPHY_CHGVSRC_EN (1 << 7)
  119. #define USBPHY_DMPULLUP (1 << 8)
  120. #define USBPHY_DPPULLUP (1 << 9)
  121. #define USBPHY_CDET_EXTCTL (1 << 10)
  122. #define USBPHY_GPIO_MODE (1 << 12)
  123. #define USBPHY_DPOPBUFCTL (1 << 13)
  124. #define USBPHY_DMOPBUFCTL (1 << 14)
  125. #define USBPHY_DPINPUT (1 << 15)
  126. #define USBPHY_DMINPUT (1 << 16)
  127. #define USBPHY_DPGPIO_PD (1 << 17)
  128. #define USBPHY_DMGPIO_PD (1 << 18)
  129. #define USBPHY_OTGVDET_EN (1 << 19)
  130. #define USBPHY_OTGSESSEND_EN (1 << 20)
  131. #define USBPHY_DATA_POLARITY (1 << 23)
  132. #if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB)
  133. u32 omap1_usb0_init(unsigned nwires, unsigned is_device);
  134. u32 omap1_usb1_init(unsigned nwires);
  135. u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup);
  136. #else
  137. static inline u32 omap1_usb0_init(unsigned nwires, unsigned is_device)
  138. {
  139. return 0;
  140. }
  141. static inline u32 omap1_usb1_init(unsigned nwires)
  142. {
  143. return 0;
  144. }
  145. static inline u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
  146. {
  147. return 0;
  148. }
  149. #endif
  150. #endif /* __ASM_ARCH_OMAP_USB_H */