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