]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - include/linux/platform_data/tegra_usb.h
Revert "ARM: tegra: skip USB resume from LP0"
[sojka/nv-tegra/linux-3.10.git] / include / linux / platform_data / tegra_usb.h
1 /*
2  * Copyright (C) 2010 Google, Inc.
3  * Copyright (c) 2010-2014, NVIDIA CORPORATION.  All rights reserved.
4  *
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  */
15
16 #ifndef _TEGRA_USB_H_
17 #define _TEGRA_USB_H_
18
19 /**
20  * defines operation mode of the USB controller
21  */
22 enum tegra_usb_operation_mode {
23         TEGRA_USB_OPMODE_DEVICE,
24         TEGRA_USB_OPMODE_HOST,
25 };
26
27 /**
28  * defines the various phy interface mode supported by controller
29  */
30 enum tegra_usb_phy_interface {
31         TEGRA_USB_PHY_INTF_UTMI = 0,
32         TEGRA_USB_PHY_INTF_ULPI_LINK = 1,
33         TEGRA_USB_PHY_INTF_ULPI_NULL = 2,
34         TEGRA_USB_PHY_INTF_HSIC = 3,
35         TEGRA_USB_PHY_INTF_ICUSB = 4,
36 };
37
38 /**
39  * defines the various ID cable detection types
40  */
41 enum tegra_usb_id_detection {
42         TEGRA_USB_ID = 0,
43         TEGRA_USB_PMU_ID = 1,
44         TEGRA_USB_GPIO_ID = 2,
45         TEGRA_USB_VIRTUAL_ID = 3,
46 };
47
48 /**
49  * Set the maximum voltage that can be supplied
50  * over USB vbus that the board supports if we use
51  * a quick charge 2 wall charger.
52  * a low value means longer charge time
53  * a too high value will blow up the board.
54  * if not sure what board supports use 5V.
55  * Allowed values:
56  *      TEGRA_USB_QC2_5V
57  *      TEGRA_USB_QC2_9V
58  *      TEGRA_USB_QC2_12V
59  *      TEGRA_USB_QC2_20V (probably not safe)
60  *
61  * specify the maximum current that the internal charger
62  * can draw from an external wall charger
63  */
64 enum tegra_usb_qc2_voltage {
65         TEGRA_USB_QC2_5V = 0,
66         TEGRA_USB_QC2_9V = 1,
67         TEGRA_USB_QC2_12V = 2,
68         TEGRA_USB_QC2_20V = 3,
69 };
70
71
72 /**
73  * configuration structure for setting up utmi phy
74  */
75 struct tegra_utmi_config {
76         u8 hssync_start_delay;
77         u8 elastic_limit;
78         u8 idle_wait_delay;
79         u8 term_range_adj;
80         u8 xcvr_setup;
81         u8 xcvr_lsfslew;
82         u8 xcvr_lsrslew;
83         signed char xcvr_setup_offset;
84         u8 xcvr_use_lsb;
85         u8 xcvr_use_fuses;
86         u8 vbus_oc_map;
87         unsigned char xcvr_hsslew_lsb:2;
88         unsigned char xcvr_hsslew_msb:7;
89 };
90
91 /**
92  * configuration structure for setting up ulpi phy
93  */
94 struct tegra_ulpi_config {
95         u8 shadow_clk_delay;
96         u8 clock_out_delay;
97         u8 data_trimmer;
98         u8 stpdirnxt_trimmer;
99         u8 dir_trimmer;
100         const char *clk;
101         int phy_restore_gpio;
102 };
103
104 /**
105  * Platform specific operations that will be controlled
106  * during the phy operations.
107  */
108 struct tegra_usb_phy_platform_ops {
109         void (*open)(void);
110         void (*init)(void);
111         void (*pre_suspend)(void);
112         void (*post_suspend)(void);
113         void (*pre_resume)(void);
114         void (*post_resume)(void);
115         void (*post_remote_wakeup)(void);
116         void (*pre_phy_off)(void);
117         void (*post_phy_off)(void);
118         void (*pre_phy_on)(void);
119         void (*post_phy_on)(void);
120         void (*port_power)(void);
121         void (*close)(void);
122 };
123
124 /**
125  * defines structure for platform dependent device parameters
126  */
127 struct tegra_usb_dev_mode_data {
128         int vbus_pmu_irq;
129         int dcp_current_limit_ma;
130         int qc2_current_limit_ma;
131         bool charging_supported;
132         bool remote_wakeup_supported;
133         bool is_xhci;
134 };
135
136 /**
137  * defines structure for platform dependent host parameters
138  */
139 struct tegra_usb_host_mode_data {
140         bool hot_plug;
141         bool remote_wakeup_supported;
142         bool power_off_on_suspend;
143         bool turn_off_vbus_on_lp0;
144         bool support_y_cable;
145 };
146
147 /**
148  * defines structure for usb platform data
149  */
150 struct tegra_usb_platform_data {
151         bool port_otg;
152         bool has_hostpc;
153         bool unaligned_dma_buf_supported;
154         bool support_pmu_vbus;
155         const char *vbus_extcon_dev_name;
156         const char *id_extcon_dev_name;
157         enum tegra_usb_id_detection id_det_type;
158         enum tegra_usb_phy_interface phy_intf;
159         enum tegra_usb_operation_mode op_mode;
160         enum tegra_usb_qc2_voltage qc2_voltage;
161
162         union {
163                 struct tegra_usb_dev_mode_data dev;
164                 struct tegra_usb_host_mode_data host;
165         } u_data;
166
167         union {
168                 struct tegra_utmi_config utmi;
169                 struct tegra_ulpi_config ulpi;
170         } u_cfg;
171
172         struct tegra_usb_phy_platform_ops *ops;
173 };
174
175 /**
176  * defines structure for platform dependent OTG parameters
177  */
178 struct tegra_usb_otg_data {
179         struct platform_device *ehci_device;
180         struct tegra_usb_platform_data *ehci_pdata;
181         int id_det_gpio;
182         bool is_xhci;
183 };
184
185 #endif /* _TEGRA_USB_H_ */