Linux Audio

Check our new training course

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