usb.h 4.8 KB

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