tegra_usb_phy.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2010 Google, Inc.
  4. */
  5. #ifndef __TEGRA_USB_PHY_H
  6. #define __TEGRA_USB_PHY_H
  7. #include <linux/clk.h>
  8. #include <linux/gpio.h>
  9. #include <linux/regmap.h>
  10. #include <linux/reset.h>
  11. #include <linux/usb/otg.h>
  12. /*
  13. * utmi_pll_config_in_car_module: true if the UTMI PLL configuration registers
  14. * should be set up by clk-tegra, false if by the PHY code
  15. * has_hostpc: true if the USB controller has the HOSTPC extension, which
  16. * changes the location of the PHCD and PTS fields
  17. * requires_usbmode_setup: true if the USBMODE register needs to be set to
  18. * enter host mode
  19. * requires_extra_tuning_parameters: true if xcvr_hsslew, hssquelch_level
  20. * and hsdiscon_level should be set for adequate signal quality
  21. * requires_pmc_ao_power_up: true if USB AO is powered down by default
  22. */
  23. struct tegra_phy_soc_config {
  24. bool utmi_pll_config_in_car_module;
  25. bool has_hostpc;
  26. bool requires_usbmode_setup;
  27. bool requires_extra_tuning_parameters;
  28. bool requires_pmc_ao_power_up;
  29. };
  30. struct tegra_utmip_config {
  31. u8 hssync_start_delay;
  32. u8 elastic_limit;
  33. u8 idle_wait_delay;
  34. u8 term_range_adj;
  35. bool xcvr_setup_use_fuses;
  36. u8 xcvr_setup;
  37. u8 xcvr_lsfslew;
  38. u8 xcvr_lsrslew;
  39. u8 xcvr_hsslew;
  40. u8 hssquelch_level;
  41. u8 hsdiscon_level;
  42. };
  43. enum tegra_usb_phy_port_speed {
  44. TEGRA_USB_PHY_PORT_SPEED_FULL = 0,
  45. TEGRA_USB_PHY_PORT_SPEED_LOW,
  46. TEGRA_USB_PHY_PORT_SPEED_HIGH,
  47. };
  48. struct tegra_xtal_freq;
  49. struct tegra_usb_phy {
  50. int irq;
  51. int instance;
  52. const struct tegra_xtal_freq *freq;
  53. void __iomem *regs;
  54. void __iomem *pad_regs;
  55. struct clk *clk;
  56. struct clk *pll_u;
  57. struct clk *pad_clk;
  58. struct regulator *vbus;
  59. struct regmap *pmc_regmap;
  60. enum usb_dr_mode mode;
  61. void *config;
  62. const struct tegra_phy_soc_config *soc_config;
  63. struct usb_phy *ulpi;
  64. struct usb_phy u_phy;
  65. bool is_legacy_phy;
  66. bool is_ulpi_phy;
  67. struct gpio_desc *reset_gpio;
  68. struct reset_control *pad_rst;
  69. bool wakeup_enabled;
  70. bool pad_wakeup;
  71. bool powered_on;
  72. };
  73. void tegra_usb_phy_preresume(struct usb_phy *phy);
  74. void tegra_usb_phy_postresume(struct usb_phy *phy);
  75. void tegra_ehci_phy_restore_start(struct usb_phy *phy,
  76. enum tegra_usb_phy_port_speed port_speed);
  77. void tegra_ehci_phy_restore_end(struct usb_phy *phy);
  78. #endif /* __TEGRA_USB_PHY_H */