Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 1 | /* |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 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 | |
Venu Byravarasu | 1ba8216 | 2012-09-05 18:50:23 +0530 | [diff] [blame] | 15 | #ifndef __TEGRA_USB_PHY_H |
| 16 | #define __TEGRA_USB_PHY_H |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 17 | |
| 18 | #include <linux/clk.h> |
| 19 | #include <linux/usb/otg.h> |
| 20 | |
Tuomas Tynkkynen | 3e63520 | 2013-08-12 16:06:51 +0300 | [diff] [blame] | 21 | /* |
| 22 | * utmi_pll_config_in_car_module: true if the UTMI PLL configuration registers |
| 23 | * should be set up by clk-tegra, false if by the PHY code |
| 24 | * has_hostpc: true if the USB controller has the HOSTPC extension, which |
| 25 | * changes the location of the PHCD and PTS fields |
| 26 | * requires_usbmode_setup: true if the USBMODE register needs to be set to |
| 27 | * enter host mode |
| 28 | * requires_extra_tuning_parameters: true if xcvr_hsslew, hssquelch_level |
| 29 | * and hsdiscon_level should be set for adequate signal quality |
| 30 | */ |
| 31 | |
| 32 | struct tegra_phy_soc_config { |
| 33 | bool utmi_pll_config_in_car_module; |
| 34 | bool has_hostpc; |
| 35 | bool requires_usbmode_setup; |
| 36 | bool requires_extra_tuning_parameters; |
| 37 | }; |
| 38 | |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 39 | struct tegra_utmip_config { |
| 40 | u8 hssync_start_delay; |
| 41 | u8 elastic_limit; |
| 42 | u8 idle_wait_delay; |
| 43 | u8 term_range_adj; |
Tuomas Tynkkynen | e497a24 | 2013-08-12 16:06:53 +0300 | [diff] [blame] | 44 | bool xcvr_setup_use_fuses; |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 45 | u8 xcvr_setup; |
| 46 | u8 xcvr_lsfslew; |
| 47 | u8 xcvr_lsrslew; |
Tuomas Tynkkynen | e497a24 | 2013-08-12 16:06:53 +0300 | [diff] [blame] | 48 | u8 xcvr_hsslew; |
| 49 | u8 hssquelch_level; |
| 50 | u8 hsdiscon_level; |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 51 | }; |
| 52 | |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 53 | enum tegra_usb_phy_port_speed { |
| 54 | TEGRA_USB_PHY_PORT_SPEED_FULL = 0, |
| 55 | TEGRA_USB_PHY_PORT_SPEED_LOW, |
| 56 | TEGRA_USB_PHY_PORT_SPEED_HIGH, |
| 57 | }; |
| 58 | |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 59 | struct tegra_xtal_freq; |
| 60 | |
| 61 | struct tegra_usb_phy { |
| 62 | int instance; |
| 63 | const struct tegra_xtal_freq *freq; |
| 64 | void __iomem *regs; |
| 65 | void __iomem *pad_regs; |
| 66 | struct clk *clk; |
| 67 | struct clk *pll_u; |
| 68 | struct clk *pad_clk; |
Mikko Perttunen | f5b8c8b | 2013-07-17 10:37:49 +0300 | [diff] [blame] | 69 | struct regulator *vbus; |
Tuomas Tynkkynen | 6558d7e | 2013-07-25 21:38:09 +0300 | [diff] [blame] | 70 | enum usb_dr_mode mode; |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 71 | void *config; |
Tuomas Tynkkynen | 3e63520 | 2013-08-12 16:06:51 +0300 | [diff] [blame] | 72 | const struct tegra_phy_soc_config *soc_config; |
Heikki Krogerus | 8675381 | 2012-02-13 13:24:02 +0200 | [diff] [blame] | 73 | struct usb_phy *ulpi; |
Venu Byravarasu | 1ba8216 | 2012-09-05 18:50:23 +0530 | [diff] [blame] | 74 | struct usb_phy u_phy; |
Venu Byravarasu | 3a55c6a | 2013-01-16 03:30:20 +0000 | [diff] [blame] | 75 | bool is_legacy_phy; |
Venu Byravarasu | 3f9db1a | 2013-01-16 03:30:21 +0000 | [diff] [blame] | 76 | bool is_ulpi_phy; |
Venu Byravarasu | 12ea18e | 2013-05-16 19:43:00 +0530 | [diff] [blame] | 77 | int reset_gpio; |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 78 | }; |
| 79 | |
Venu Byravarasu | ab137d0 | 2013-01-24 15:57:03 +0530 | [diff] [blame] | 80 | void tegra_usb_phy_preresume(struct usb_phy *phy); |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 81 | |
Venu Byravarasu | ab137d0 | 2013-01-24 15:57:03 +0530 | [diff] [blame] | 82 | void tegra_usb_phy_postresume(struct usb_phy *phy); |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 83 | |
Venu Byravarasu | ab137d0 | 2013-01-24 15:57:03 +0530 | [diff] [blame] | 84 | void tegra_ehci_phy_restore_start(struct usb_phy *phy, |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 85 | enum tegra_usb_phy_port_speed port_speed); |
| 86 | |
Venu Byravarasu | ab137d0 | 2013-01-24 15:57:03 +0530 | [diff] [blame] | 87 | void tegra_ehci_phy_restore_end(struct usb_phy *phy); |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 88 | |
Venu Byravarasu | 1ba8216 | 2012-09-05 18:50:23 +0530 | [diff] [blame] | 89 | #endif /* __TEGRA_USB_PHY_H */ |