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 | |
| 21 | struct tegra_utmip_config { |
| 22 | u8 hssync_start_delay; |
| 23 | u8 elastic_limit; |
| 24 | u8 idle_wait_delay; |
| 25 | u8 term_range_adj; |
| 26 | u8 xcvr_setup; |
| 27 | u8 xcvr_lsfslew; |
| 28 | u8 xcvr_lsrslew; |
| 29 | }; |
| 30 | |
| 31 | struct tegra_ulpi_config { |
| 32 | int reset_gpio; |
| 33 | const char *clk; |
| 34 | }; |
| 35 | |
| 36 | enum tegra_usb_phy_port_speed { |
| 37 | TEGRA_USB_PHY_PORT_SPEED_FULL = 0, |
| 38 | TEGRA_USB_PHY_PORT_SPEED_LOW, |
| 39 | TEGRA_USB_PHY_PORT_SPEED_HIGH, |
| 40 | }; |
| 41 | |
| 42 | enum tegra_usb_phy_mode { |
| 43 | TEGRA_USB_PHY_MODE_DEVICE, |
| 44 | TEGRA_USB_PHY_MODE_HOST, |
Venu Byravarasu | 9cd9384 | 2013-05-16 19:42:59 +0530 | [diff] [blame] | 45 | TEGRA_USB_PHY_MODE_OTG, |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | struct tegra_xtal_freq; |
| 49 | |
| 50 | struct tegra_usb_phy { |
| 51 | int instance; |
| 52 | const struct tegra_xtal_freq *freq; |
| 53 | void __iomem *regs; |
| 54 | void __iomem *pad_regs; |
| 55 | struct clk *clk; |
| 56 | struct clk *pll_u; |
| 57 | struct clk *pad_clk; |
Mikko Perttunen | f5b8c8b | 2013-07-17 10:37:49 +0300 | [diff] [blame^] | 58 | struct regulator *vbus; |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 59 | enum tegra_usb_phy_mode mode; |
| 60 | void *config; |
Heikki Krogerus | 8675381 | 2012-02-13 13:24:02 +0200 | [diff] [blame] | 61 | struct usb_phy *ulpi; |
Venu Byravarasu | 1ba8216 | 2012-09-05 18:50:23 +0530 | [diff] [blame] | 62 | struct usb_phy u_phy; |
| 63 | struct device *dev; |
Venu Byravarasu | 3a55c6a | 2013-01-16 03:30:20 +0000 | [diff] [blame] | 64 | bool is_legacy_phy; |
Venu Byravarasu | 3f9db1a | 2013-01-16 03:30:21 +0000 | [diff] [blame] | 65 | bool is_ulpi_phy; |
Venu Byravarasu | 12ea18e | 2013-05-16 19:43:00 +0530 | [diff] [blame] | 66 | int reset_gpio; |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 67 | }; |
| 68 | |
Venu Byravarasu | 2d22b42 | 2013-05-16 19:43:02 +0530 | [diff] [blame] | 69 | struct usb_phy *tegra_usb_get_phy(struct device_node *dn); |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 70 | |
Venu Byravarasu | ab137d0 | 2013-01-24 15:57:03 +0530 | [diff] [blame] | 71 | void tegra_usb_phy_preresume(struct usb_phy *phy); |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 72 | |
Venu Byravarasu | ab137d0 | 2013-01-24 15:57:03 +0530 | [diff] [blame] | 73 | void tegra_usb_phy_postresume(struct usb_phy *phy); |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 74 | |
Venu Byravarasu | ab137d0 | 2013-01-24 15:57:03 +0530 | [diff] [blame] | 75 | void tegra_ehci_phy_restore_start(struct usb_phy *phy, |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 76 | enum tegra_usb_phy_port_speed port_speed); |
| 77 | |
Venu Byravarasu | ab137d0 | 2013-01-24 15:57:03 +0530 | [diff] [blame] | 78 | void tegra_ehci_phy_restore_end(struct usb_phy *phy); |
Benoit Goby | 91525d0 | 2011-03-09 16:28:55 -0800 | [diff] [blame] | 79 | |
Venu Byravarasu | 1ba8216 | 2012-09-05 18:50:23 +0530 | [diff] [blame] | 80 | #endif /* __TEGRA_USB_PHY_H */ |