Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (C) 2010 Google, Inc.
0004  */
0005 
0006 #ifndef __TEGRA_USB_PHY_H
0007 #define __TEGRA_USB_PHY_H
0008 
0009 #include <linux/clk.h>
0010 #include <linux/gpio.h>
0011 #include <linux/regmap.h>
0012 #include <linux/reset.h>
0013 #include <linux/usb/otg.h>
0014 
0015 /*
0016  * utmi_pll_config_in_car_module: true if the UTMI PLL configuration registers
0017  *     should be set up by clk-tegra, false if by the PHY code
0018  * has_hostpc: true if the USB controller has the HOSTPC extension, which
0019  *     changes the location of the PHCD and PTS fields
0020  * requires_usbmode_setup: true if the USBMODE register needs to be set to
0021  *      enter host mode
0022  * requires_extra_tuning_parameters: true if xcvr_hsslew, hssquelch_level
0023  *      and hsdiscon_level should be set for adequate signal quality
0024  * requires_pmc_ao_power_up: true if USB AO is powered down by default
0025  */
0026 
0027 struct tegra_phy_soc_config {
0028     bool utmi_pll_config_in_car_module;
0029     bool has_hostpc;
0030     bool requires_usbmode_setup;
0031     bool requires_extra_tuning_parameters;
0032     bool requires_pmc_ao_power_up;
0033 };
0034 
0035 struct tegra_utmip_config {
0036     u8 hssync_start_delay;
0037     u8 elastic_limit;
0038     u8 idle_wait_delay;
0039     u8 term_range_adj;
0040     bool xcvr_setup_use_fuses;
0041     u8 xcvr_setup;
0042     u8 xcvr_lsfslew;
0043     u8 xcvr_lsrslew;
0044     u8 xcvr_hsslew;
0045     u8 hssquelch_level;
0046     u8 hsdiscon_level;
0047 };
0048 
0049 enum tegra_usb_phy_port_speed {
0050     TEGRA_USB_PHY_PORT_SPEED_FULL = 0,
0051     TEGRA_USB_PHY_PORT_SPEED_LOW,
0052     TEGRA_USB_PHY_PORT_SPEED_HIGH,
0053 };
0054 
0055 struct tegra_xtal_freq;
0056 
0057 struct tegra_usb_phy {
0058     int irq;
0059     int instance;
0060     const struct tegra_xtal_freq *freq;
0061     void __iomem *regs;
0062     void __iomem *pad_regs;
0063     struct clk *clk;
0064     struct clk *pll_u;
0065     struct clk *pad_clk;
0066     struct regulator *vbus;
0067     struct regmap *pmc_regmap;
0068     enum usb_dr_mode mode;
0069     void *config;
0070     const struct tegra_phy_soc_config *soc_config;
0071     struct usb_phy *ulpi;
0072     struct usb_phy u_phy;
0073     bool is_legacy_phy;
0074     bool is_ulpi_phy;
0075     struct gpio_desc *reset_gpio;
0076     struct reset_control *pad_rst;
0077     bool wakeup_enabled;
0078     bool pad_wakeup;
0079     bool powered_on;
0080 };
0081 
0082 void tegra_usb_phy_preresume(struct usb_phy *phy);
0083 
0084 void tegra_usb_phy_postresume(struct usb_phy *phy);
0085 
0086 void tegra_ehci_phy_restore_start(struct usb_phy *phy,
0087                  enum tegra_usb_phy_port_speed port_speed);
0088 
0089 void tegra_ehci_phy_restore_end(struct usb_phy *phy);
0090 
0091 #endif /* __TEGRA_USB_PHY_H */