Commit | Line | Data |
---|---|---|
91525d08 | 1 | /* |
91525d08 BG |
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 | ||
1ba8216f VB |
15 | #ifndef __TEGRA_USB_PHY_H |
16 | #define __TEGRA_USB_PHY_H | |
91525d08 BG |
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, | |
9cd9384c | 45 | TEGRA_USB_PHY_MODE_OTG, |
91525d08 BG |
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; | |
58 | enum tegra_usb_phy_mode mode; | |
59 | void *config; | |
86753811 | 60 | struct usb_phy *ulpi; |
1ba8216f VB |
61 | struct usb_phy u_phy; |
62 | struct device *dev; | |
3a55c6a8 | 63 | bool is_legacy_phy; |
3f9db1a1 | 64 | bool is_ulpi_phy; |
ee5d5499 AB |
65 | void (*set_pts)(struct usb_phy *x, u8 pts_val); |
66 | void (*set_phcd)(struct usb_phy *x, bool enable); | |
91525d08 BG |
67 | }; |
68 | ||
aa607ebf | 69 | struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance, |
9cd9384c | 70 | void __iomem *regs, void *config, |
ee5d5499 AB |
71 | void (*set_pts)(struct usb_phy *x, u8 pts_val), |
72 | void (*set_phcd)(struct usb_phy *x, bool enable)); | |
91525d08 | 73 | |
ab137d04 | 74 | void tegra_usb_phy_preresume(struct usb_phy *phy); |
91525d08 | 75 | |
ab137d04 | 76 | void tegra_usb_phy_postresume(struct usb_phy *phy); |
91525d08 | 77 | |
ab137d04 | 78 | void tegra_ehci_phy_restore_start(struct usb_phy *phy, |
91525d08 BG |
79 | enum tegra_usb_phy_port_speed port_speed); |
80 | ||
ab137d04 | 81 | void tegra_ehci_phy_restore_end(struct usb_phy *phy); |
91525d08 | 82 | |
1ba8216f | 83 | #endif /* __TEGRA_USB_PHY_H */ |