ARM: tegra: usb_phy: continues driving FS-J during resume
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-tegra / include / mach / usb_phy.h
1 /*
2  * arch/arm/mach-tegra/include/mach/usb_phy.h
3  *
4  * Copyright (C) 2010 Google, Inc.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16
17 #ifndef __MACH_USB_PHY_H
18 #define __MACH_USB_PHY_H
19
20 #include <linux/platform_device.h>
21 #include <linux/clk.h>
22
23 #define USB_PHY_MAX_CONTEXT_REGS 10
24
25 struct tegra_utmip_config {
26         u8 hssync_start_delay;
27         u8 elastic_limit;
28         u8 idle_wait_delay;
29         u8 term_range_adj;
30         u8 xcvr_setup;
31         u8 xcvr_lsfslew;
32         u8 xcvr_lsrslew;
33 };
34
35 struct tegra_ulpi_config {
36         int reset_gpio;
37         const char *clk;
38 };
39
40 enum tegra_usb_phy_port_speed {
41         TEGRA_USB_PHY_PORT_SPEED_FULL = 0,
42         TEGRA_USB_PHY_PORT_SPEED_LOW,
43         TEGRA_USB_PHY_PORT_HIGH,
44 };
45
46 struct tegra_utmip_context {
47         bool valid;
48         u32 regs[USB_PHY_MAX_CONTEXT_REGS];
49         int regs_count;
50         enum tegra_usb_phy_port_speed port_speed;
51 };
52
53 enum tegra_usb_phy_mode {
54         TEGRA_USB_PHY_MODE_DEVICE,
55         TEGRA_USB_PHY_MODE_HOST,
56 };
57
58 struct tegra_usb_phy {
59         int instance;
60         int freq_sel;
61         void __iomem *regs;
62         void __iomem *pad_regs;
63         struct clk *clk;
64         struct clk *pll_u;
65         struct clk *pad_clk;
66         enum tegra_usb_phy_mode mode;
67         void *config;
68         struct tegra_utmip_context context;
69 };
70
71 struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
72                         void *config, enum tegra_usb_phy_mode phy_mode);
73
74 int tegra_usb_phy_power_on(struct tegra_usb_phy *phy);
75
76 int tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy);
77
78 int tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy);
79
80 int tegra_usb_phy_power_off(struct tegra_usb_phy *phy);
81
82 int tegra_usb_phy_preresume(struct tegra_usb_phy *phy);
83
84 int tegra_usb_phy_postresume(struct tegra_usb_phy *phy);
85
86 int tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy);
87
88 int tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy);
89
90 int tegra_usb_phy_close(struct tegra_usb_phy *phy);
91
92 #endif //__MACH_USB_PHY_H