usb.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. #include <plat/board.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. /*-------------------------------------------------------------------------*/
  54. struct omap_musb_board_data {
  55. u8 interface_type;
  56. u8 mode;
  57. u16 power;
  58. unsigned extvbus:1;
  59. void (*set_phy_power)(u8 on);
  60. void (*clear_irq)(void);
  61. void (*set_mode)(u8 mode);
  62. void (*reset)(void);
  63. };
  64. enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI};
  65. extern void usb_musb_init(struct omap_musb_board_data *board_data);
  66. extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
  67. extern int omap4430_phy_power(struct device *dev, int ID, int on);
  68. extern int omap4430_phy_set_clk(struct device *dev, int on);
  69. extern int omap4430_phy_init(struct device *dev);
  70. extern int omap4430_phy_exit(struct device *dev);
  71. extern int omap4430_phy_suspend(struct device *dev, int suspend);
  72. #endif
  73. extern void am35x_musb_reset(void);
  74. extern void am35x_musb_phy_power(u8 on);
  75. extern void am35x_musb_clear_irq(void);
  76. extern void am35x_set_mode(u8 musb_mode);
  77. extern void ti81xx_musb_phy_power(u8 on);
  78. /* AM35x */
  79. /* USB 2.0 PHY Control */
  80. #define CONF2_PHY_GPIOMODE (1 << 23)
  81. #define CONF2_OTGMODE (3 << 14)
  82. #define CONF2_NO_OVERRIDE (0 << 14)
  83. #define CONF2_FORCE_HOST (1 << 14)
  84. #define CONF2_FORCE_DEVICE (2 << 14)
  85. #define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
  86. #define CONF2_SESENDEN (1 << 13)
  87. #define CONF2_VBDTCTEN (1 << 12)
  88. #define CONF2_REFFREQ_24MHZ (2 << 8)
  89. #define CONF2_REFFREQ_26MHZ (7 << 8)
  90. #define CONF2_REFFREQ_13MHZ (6 << 8)
  91. #define CONF2_REFFREQ (0xf << 8)
  92. #define CONF2_PHYCLKGD (1 << 7)
  93. #define CONF2_VBUSSENSE (1 << 6)
  94. #define CONF2_PHY_PLLON (1 << 5)
  95. #define CONF2_RESET (1 << 4)
  96. #define CONF2_PHYPWRDN (1 << 3)
  97. #define CONF2_OTGPWRDN (1 << 2)
  98. #define CONF2_DATPOL (1 << 1)
  99. /* TI81XX specific definitions */
  100. #define USBCTRL0 0x620
  101. #define USBSTAT0 0x624
  102. /* TI816X PHY controls bits */
  103. #define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
  104. #define TI816X_USBPHY_REFCLK_OSC (1 << 8)
  105. /* TI814X PHY controls bits */
  106. #define USBPHY_CM_PWRDN (1 << 0)
  107. #define USBPHY_OTG_PWRDN (1 << 1)
  108. #define USBPHY_CHGDET_DIS (1 << 2)
  109. #define USBPHY_CHGDET_RSTRT (1 << 3)
  110. #define USBPHY_SRCONDM (1 << 4)
  111. #define USBPHY_SINKONDP (1 << 5)
  112. #define USBPHY_CHGISINK_EN (1 << 6)
  113. #define USBPHY_CHGVSRC_EN (1 << 7)
  114. #define USBPHY_DMPULLUP (1 << 8)
  115. #define USBPHY_DPPULLUP (1 << 9)
  116. #define USBPHY_CDET_EXTCTL (1 << 10)
  117. #define USBPHY_GPIO_MODE (1 << 12)
  118. #define USBPHY_DPOPBUFCTL (1 << 13)
  119. #define USBPHY_DMOPBUFCTL (1 << 14)
  120. #define USBPHY_DPINPUT (1 << 15)
  121. #define USBPHY_DMINPUT (1 << 16)
  122. #define USBPHY_DPGPIO_PD (1 << 17)
  123. #define USBPHY_DMGPIO_PD (1 << 18)
  124. #define USBPHY_OTGVDET_EN (1 << 19)
  125. #define USBPHY_OTGSESSEND_EN (1 << 20)
  126. #define USBPHY_DATA_POLARITY (1 << 23)
  127. #if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB)
  128. u32 omap1_usb0_init(unsigned nwires, unsigned is_device);
  129. u32 omap1_usb1_init(unsigned nwires);
  130. u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup);
  131. #else
  132. static inline u32 omap1_usb0_init(unsigned nwires, unsigned is_device)
  133. {
  134. return 0;
  135. }
  136. static inline u32 omap1_usb1_init(unsigned nwires)
  137. {
  138. return 0;
  139. }
  140. static inline u32 omap1_usb2_init(unsigned nwires, unsigned alt_pingroup)
  141. {
  142. return 0;
  143. }
  144. #endif
  145. #endif /* __ASM_ARCH_OMAP_USB_H */