tegra_usb_phy.h 2.3 KB

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