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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
/*
* Copyright (C) 2010 Google, Inc.
* Copyright (c) 2010-2014, NVIDIA CORPORATION. All rights reserved.
*
* 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 _TEGRA_USB_H_
#define _TEGRA_USB_H_
/**
* defines operation mode of the USB controller
*/
enum tegra_usb_operation_mode {
TEGRA_USB_OPMODE_DEVICE,
TEGRA_USB_OPMODE_HOST,
};
/**
* defines the various phy interface mode supported by controller
*/
enum tegra_usb_phy_interface {
TEGRA_USB_PHY_INTF_UTMI = 0,
TEGRA_USB_PHY_INTF_ULPI_LINK = 1,
TEGRA_USB_PHY_INTF_ULPI_NULL = 2,
TEGRA_USB_PHY_INTF_HSIC = 3,
TEGRA_USB_PHY_INTF_ICUSB = 4,
};
/**
* defines the various ID cable detection types
*/
enum tegra_usb_id_detection {
TEGRA_USB_ID = 0,
TEGRA_USB_PMU_ID = 1,
TEGRA_USB_GPIO_ID = 2,
TEGRA_USB_VIRTUAL_ID = 3,
};
/**
* Set the maximum voltage that can be supplied
* over USB vbus that the board supports if we use
* a quick charge 2 wall charger.
* a low value means longer charge time
* a too high value will blow up the board.
* if not sure what board supports use 5V.
* Allowed values:
* TEGRA_USB_QC2_5V
* TEGRA_USB_QC2_9V
* TEGRA_USB_QC2_12V
* TEGRA_USB_QC2_20V (probably not safe)
*
* specify the maximum current that the internal charger
* can draw from an external wall charger
*/
enum tegra_usb_qc2_voltage {
TEGRA_USB_QC2_5V = 0,
TEGRA_USB_QC2_9V = 1,
TEGRA_USB_QC2_12V = 2,
TEGRA_USB_QC2_20V = 3,
};
/**
* configuration structure for setting up utmi phy
*/
struct tegra_utmi_config {
u8 hssync_start_delay;
u8 elastic_limit;
u8 idle_wait_delay;
u8 term_range_adj;
u8 xcvr_setup;
u8 xcvr_lsfslew;
u8 xcvr_lsrslew;
signed char xcvr_setup_offset;
u8 xcvr_use_lsb;
u8 xcvr_use_fuses;
u8 vbus_oc_map;
unsigned char xcvr_hsslew_lsb:2;
unsigned char xcvr_hsslew_msb:7;
};
/**
* configuration structure for setting up ulpi phy
*/
struct tegra_ulpi_config {
u8 shadow_clk_delay;
u8 clock_out_delay;
u8 data_trimmer;
u8 stpdirnxt_trimmer;
u8 dir_trimmer;
const char *clk;
int phy_restore_gpio;
};
/**
* Platform specific operations that will be controlled
* during the phy operations.
*/
struct tegra_usb_phy_platform_ops {
void (*open)(void);
void (*init)(void);
void (*pre_suspend)(void);
void (*post_suspend)(void);
void (*pre_resume)(void);
void (*post_resume)(void);
void (*post_remote_wakeup)(void);
void (*pre_phy_off)(void);
void (*post_phy_off)(void);
void (*pre_phy_on)(void);
void (*post_phy_on)(void);
void (*port_power)(void);
void (*close)(void);
};
/**
* defines structure for platform dependent device parameters
*/
struct tegra_usb_dev_mode_data {
int vbus_pmu_irq;
int vbus_gpio;
int dcp_current_limit_ma;
int qc2_current_limit_ma;
bool charging_supported;
bool remote_wakeup_supported;
bool is_xhci;
};
/**
* defines structure for platform dependent host parameters
*/
struct tegra_usb_host_mode_data {
int vbus_gpio;
bool hot_plug;
bool remote_wakeup_supported;
bool power_off_on_suspend;
bool turn_off_vbus_on_lp0;
bool support_y_cable;
bool skip_resume;
};
/**
* defines structure for usb platform data
*/
struct tegra_usb_platform_data {
bool port_otg;
bool has_hostpc;
bool unaligned_dma_buf_supported;
bool support_pmu_vbus;
char *vbus_extcon_dev_name;
char *id_extcon_dev_name;
enum tegra_usb_id_detection id_det_type;
enum tegra_usb_phy_interface phy_intf;
enum tegra_usb_operation_mode op_mode;
enum tegra_usb_qc2_voltage qc2_voltage;
union {
struct tegra_usb_dev_mode_data dev;
struct tegra_usb_host_mode_data host;
} u_data;
union {
struct tegra_utmi_config utmi;
struct tegra_ulpi_config ulpi;
} u_cfg;
struct tegra_usb_phy_platform_ops *ops;
};
/**
* defines structure for platform dependent OTG parameters
*/
struct tegra_usb_otg_data {
struct platform_device *ehci_device;
struct tegra_usb_platform_data *ehci_pdata;
int id_det_gpio;
bool is_xhci;
};
#endif /* _TEGRA_USB_H_ */
|