summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/include/mach/usb_phy.h
blob: c721642c44172ac8d8b5b5848c37f586f47457e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
 * arch/arm/mach-tegra/include/mach/usb_phy.h
 *
 * Copyright (C) 2010 Google, Inc.
 * Copyright (C) 2011 NVIDIA Corporation.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __MACH_USB_PHY_H
#define __MACH_USB_PHY_H

/**
 * Tegra USB phy opaque handle
 */
struct tegra_usb_phy;

/**
 * Opens the usb phy associated to the USB platform device
 * tegra usb phy open must be called before accessing any phy APIs
 */
struct tegra_usb_phy *tegra_usb_phy_open(struct platform_device *pdev);

/**
 * Closes the phy controller and its resources
 */
void tegra_usb_phy_close(struct tegra_usb_phy *phy);

/**
 * Handles interrupts specific to the phy interface
 * Note: udc or ehci driver will handle the controller interrupts
 */
int tegra_usb_phy_irq(struct tegra_usb_phy *phy);

/**
 * Initializes the phy specific functions after phy is power on
 */
int tegra_usb_phy_init(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality after driver reset
 */
int tegra_usb_phy_reset(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality before driver suspend
 * Also, handles platform specific pre suspend functions
 */
int tegra_usb_phy_pre_suspend(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific suspend functionality
 */
int tegra_usb_phy_suspend(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality after driver suspend
 */
int tegra_usb_phy_post_suspend(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality before driver resume
 * Also, handles platform specific pre resume functions
 */
int tegra_usb_phy_pre_resume(struct tegra_usb_phy *phy, bool remote_wakeup);

/**
 * Handles phy interface specific resume functionality
 */
int tegra_usb_phy_resume(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality after driver resume
 */
int tegra_usb_phy_post_resume(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality during port power on
 */
int tegra_usb_phy_port_power(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality during bus reset
 */
int tegra_usb_phy_bus_reset(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality for turning off the phy to
 * put the phy in low power mode
 */
int tegra_usb_phy_power_off(struct tegra_usb_phy *phy);

/**
 * Handles phy interface specific functionality for turning on the phy to
 * bring phy out of low power mode
 */
int tegra_usb_phy_power_on(struct tegra_usb_phy *phy);

/**
 * Indicates whether phy registers are accessible or not
 * if phy is powered off then returns false else true
 */
bool tegra_usb_phy_hw_accessible(struct tegra_usb_phy *phy);

/**
 * Indicates whether compliance charger is connected or not
 * if compliance charger is detected then returns true else false
 */
bool tegra_usb_phy_charger_detected(struct tegra_usb_phy *phy);

/**
 * Indicates whether phy resumed due to the remote wake event or not
 * returns true if remote wake is detected.
 */
bool tegra_usb_phy_remote_wakeup(struct tegra_usb_phy *phy);

/**
 * Indicates controller has HOST PC register set or not
 */
bool tegra_usb_phy_has_hostpc(struct tegra_usb_phy *phy);

/**
 * Indicates controller port supports OTG or not
 */
bool tegra_usb_phy_otg_supported(struct tegra_usb_phy *phy);


void tegra_usb_phy_memory_prefetch_on(struct tegra_usb_phy *phy);

void tegra_usb_phy_memory_prefetch_off(struct tegra_usb_phy *phy);

#endif /* __MACH_USB_PHY_H */