omap_control_usb.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * omap_control_usb.h - Header file for the USB part of control module.
  3. *
  4. * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Author: Kishon Vijay Abraham I <kishon@ti.com>
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. */
  18. #ifndef __OMAP_CONTROL_USB_H__
  19. #define __OMAP_CONTROL_USB_H__
  20. enum omap_control_usb_type {
  21. OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
  22. OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
  23. OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
  24. OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
  25. };
  26. struct omap_control_usb {
  27. struct device *dev;
  28. u32 __iomem *otghs_control;
  29. u32 __iomem *power;
  30. u32 __iomem *power_aux;
  31. struct clk *sys_clk;
  32. enum omap_control_usb_type type;
  33. };
  34. enum omap_control_usb_mode {
  35. USB_MODE_UNDEFINED = 0,
  36. USB_MODE_HOST,
  37. USB_MODE_DEVICE,
  38. USB_MODE_DISCONNECT,
  39. };
  40. #define OMAP_CTRL_DEV_PHY_PD BIT(0)
  41. #define OMAP_CTRL_DEV_AVALID BIT(0)
  42. #define OMAP_CTRL_DEV_BVALID BIT(1)
  43. #define OMAP_CTRL_DEV_VBUSVALID BIT(2)
  44. #define OMAP_CTRL_DEV_SESSEND BIT(3)
  45. #define OMAP_CTRL_DEV_IDDIG BIT(4)
  46. #define OMAP_CTRL_USB_PWRCTL_CLK_CMD_MASK 0x003FC000
  47. #define OMAP_CTRL_USB_PWRCTL_CLK_CMD_SHIFT 0xE
  48. #define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_MASK 0xFFC00000
  49. #define OMAP_CTRL_USB_PWRCTL_CLK_FREQ_SHIFT 0x16
  50. #define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
  51. #define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
  52. #define OMAP_CTRL_USB2_PHY_PD BIT(28)
  53. #if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
  54. extern struct device *omap_get_control_dev(void);
  55. extern void omap_control_usb_phy_power(struct device *dev, int on);
  56. extern void omap_control_usb_set_mode(struct device *dev,
  57. enum omap_control_usb_mode mode);
  58. #else
  59. static inline struct device *omap_get_control_dev(void)
  60. {
  61. return ERR_PTR(-ENODEV);
  62. }
  63. static inline void omap_control_usb_phy_power(struct device *dev, int on)
  64. {
  65. }
  66. static inline void omap_control_usb_set_mode(struct device *dev,
  67. enum omap_control_usb_mode mode)
  68. {
  69. }
  70. #endif
  71. #endif /* __OMAP_CONTROL_USB_H__ */