tegra_usb_phy.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2010 Google, Inc.
  4. *
  5. * This software is licensed under the terms of the GNU General Public
  6. * License version 2, as published by the Free Software Foundation, and
  7. * may be copied, distributed, and modified under those terms.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. */
  15. #ifndef __TEGRA_USB_PHY_H
  16. #define __TEGRA_USB_PHY_H
  17. #include <linux/clk.h>
  18. #include <linux/usb/otg.h>
  19. /*
  20. * utmi_pll_config_in_car_module: true if the UTMI PLL configuration registers
  21. * should be set up by clk-tegra, false if by the PHY code
  22. * has_hostpc: true if the USB controller has the HOSTPC extension, which
  23. * changes the location of the PHCD and PTS fields
  24. * requires_usbmode_setup: true if the USBMODE register needs to be set to
  25. * enter host mode
  26. * requires_extra_tuning_parameters: true if xcvr_hsslew, hssquelch_level
  27. * and hsdiscon_level should be set for adequate signal quality
  28. */
  29. struct tegra_phy_soc_config {
  30. bool utmi_pll_config_in_car_module;
  31. bool has_hostpc;
  32. bool requires_usbmode_setup;
  33. bool requires_extra_tuning_parameters;
  34. };
  35. struct tegra_utmip_config {
  36. u8 hssync_start_delay;
  37. u8 elastic_limit;
  38. u8 idle_wait_delay;
  39. u8 term_range_adj;
  40. bool xcvr_setup_use_fuses;
  41. u8 xcvr_setup;
  42. u8 xcvr_lsfslew;
  43. u8 xcvr_lsrslew;
  44. u8 xcvr_hsslew;
  45. u8 hssquelch_level;
  46. u8 hsdiscon_level;
  47. };
  48. enum tegra_usb_phy_port_speed {
  49. TEGRA_USB_PHY_PORT_SPEED_FULL = 0,
  50. TEGRA_USB_PHY_PORT_SPEED_LOW,
  51. TEGRA_USB_PHY_PORT_SPEED_HIGH,
  52. };
  53. struct tegra_xtal_freq;
  54. struct tegra_usb_phy {
  55. int instance;
  56. const struct tegra_xtal_freq *freq;
  57. void __iomem *regs;
  58. void __iomem *pad_regs;
  59. struct clk *clk;
  60. struct clk *pll_u;
  61. struct clk *pad_clk;
  62. struct regulator *vbus;
  63. enum usb_dr_mode mode;
  64. void *config;
  65. const struct tegra_phy_soc_config *soc_config;
  66. struct usb_phy *ulpi;
  67. struct usb_phy u_phy;
  68. bool is_legacy_phy;
  69. bool is_ulpi_phy;
  70. int reset_gpio;
  71. };
  72. void tegra_usb_phy_preresume(struct usb_phy *phy);
  73. void tegra_usb_phy_postresume(struct usb_phy *phy);
  74. void tegra_ehci_phy_restore_start(struct usb_phy *phy,
  75. enum tegra_usb_phy_port_speed port_speed);
  76. void tegra_ehci_phy_restore_end(struct usb_phy *phy);
  77. #endif /* __TEGRA_USB_PHY_H */