omap_control_phy.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * omap_control_phy.h - Header file for the PHY 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_PHY_H__
  19. #define __OMAP_CONTROL_PHY_H__
  20. enum omap_control_phy_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_PCIE, /* RX TX control of ACSPCIE */
  25. OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
  26. OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
  27. };
  28. struct omap_control_phy {
  29. struct device *dev;
  30. u32 __iomem *otghs_control;
  31. u32 __iomem *power;
  32. u32 __iomem *power_aux;
  33. u32 __iomem *pcie_pcs;
  34. struct clk *sys_clk;
  35. enum omap_control_phy_type type;
  36. };
  37. enum omap_control_usb_mode {
  38. USB_MODE_UNDEFINED = 0,
  39. USB_MODE_HOST,
  40. USB_MODE_DEVICE,
  41. USB_MODE_DISCONNECT,
  42. };
  43. #define OMAP_CTRL_DEV_PHY_PD BIT(0)
  44. #define OMAP_CTRL_DEV_AVALID BIT(0)
  45. #define OMAP_CTRL_DEV_BVALID BIT(1)
  46. #define OMAP_CTRL_DEV_VBUSVALID BIT(2)
  47. #define OMAP_CTRL_DEV_SESSEND BIT(3)
  48. #define OMAP_CTRL_DEV_IDDIG BIT(4)
  49. #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
  50. #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT 0xE
  51. #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK 0xFFC00000
  52. #define OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT 0x16
  53. #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON 0x3
  54. #define OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF 0x0
  55. #define OMAP_CTRL_PCIE_PCS_MASK 0xff
  56. #define OMAP_CTRL_PCIE_PCS_DELAY_COUNT_SHIFT 16
  57. #define OMAP_CTRL_USB2_PHY_PD BIT(28)
  58. #define AM437X_CTRL_USB2_PHY_PD BIT(0)
  59. #define AM437X_CTRL_USB2_OTG_PD BIT(1)
  60. #define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
  61. #define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
  62. #if IS_ENABLED(CONFIG_OMAP_CONTROL_PHY)
  63. void omap_control_phy_power(struct device *dev, int on);
  64. void omap_control_usb_set_mode(struct device *dev,
  65. enum omap_control_usb_mode mode);
  66. void omap_control_pcie_pcs(struct device *dev, u8 delay);
  67. #else
  68. static inline void omap_control_phy_power(struct device *dev, int on)
  69. {
  70. }
  71. static inline void omap_control_usb_set_mode(struct device *dev,
  72. enum omap_control_usb_mode mode)
  73. {
  74. }
  75. static inline void omap_control_pcie_pcs(struct device *dev, u8 delay)
  76. {
  77. }
  78. #endif
  79. #endif /* __OMAP_CONTROL_PHY_H__ */