omap_control_phy.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * omap_control_phy.h - Header file for the PHY part of control module.
  4. *
  5. * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
  6. * Author: Kishon Vijay Abraham I <[email protected]>
  7. */
  8. #ifndef __OMAP_CONTROL_PHY_H__
  9. #define __OMAP_CONTROL_PHY_H__
  10. enum omap_control_phy_type {
  11. OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
  12. OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
  13. OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
  14. OMAP_CTRL_TYPE_PCIE, /* RX TX control of ACSPCIE */
  15. OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
  16. OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
  17. };
  18. struct omap_control_phy {
  19. struct device *dev;
  20. u32 __iomem *otghs_control;
  21. u32 __iomem *power;
  22. u32 __iomem *power_aux;
  23. u32 __iomem *pcie_pcs;
  24. struct clk *sys_clk;
  25. enum omap_control_phy_type type;
  26. };
  27. enum omap_control_usb_mode {
  28. USB_MODE_UNDEFINED = 0,
  29. USB_MODE_HOST,
  30. USB_MODE_DEVICE,
  31. USB_MODE_DISCONNECT,
  32. };
  33. #define OMAP_CTRL_DEV_PHY_PD BIT(0)
  34. #define OMAP_CTRL_DEV_AVALID BIT(0)
  35. #define OMAP_CTRL_DEV_BVALID BIT(1)
  36. #define OMAP_CTRL_DEV_VBUSVALID BIT(2)
  37. #define OMAP_CTRL_DEV_SESSEND BIT(3)
  38. #define OMAP_CTRL_DEV_IDDIG BIT(4)
  39. #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
  40. #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
  41. #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
  42. #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
  43. #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
  44. #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
  45. #define OMAP_CTRL_PCIE_PCS_MASK 0xff
  46. #define OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT 16
  47. #define OMAP_CTRL_USB2_PHY_PD BIT(28)
  48. #define AM437X_CTRL_USB2_PHY_PD BIT(0)
  49. #define AM437X_CTRL_USB2_OTG_PD BIT(1)
  50. #define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
  51. #define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
  52. #if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
  53. void omap_control_phy_power(struct device *dev, int on);
  54. void omap_control_usb_set_mode(struct device *dev,
  55. enum omap_control_usb_mode mode);
  56. void omap_control_pcie_pcs(struct device *dev, u8 delay);
  57. #else
  58. static inline void omap_control_phy_power(struct device *dev, int on)
  59. {
  60. }
  61. static inline void omap_control_usb_set_mode(struct device *dev,
  62. enum omap_control_usb_mode mode)
  63. {
  64. }
  65. static inline void omap_control_pcie_pcs(struct device *dev, u8 delay)
  66. {
  67. }
  68. #endif
  69. #endif /* __OMAP_CONTROL_PHY_H__ */