summaryrefslogtreecommitdiff
path: root/include/linux/platform_data/tegra_usb.h
blob: 97472714e8e6d5b94e844dbbfdbffe225b5e3599 (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
141
142
143
144
145
146
147
148
149
/*
 * Copyright (C) 2010 Google, Inc.
 * Copyright (C) 2010-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 _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,
};

/**
 * 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;
};

/**
 * 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;
};

/**
 * configuration structure for setting up hsic phy
 */
struct tegra_hsic_config {
	u8 sync_start_delay;
	u8 idle_wait_delay;
	u8 term_range_adj;
	u8 elastic_underrun_limit;
	u8 elastic_overrun_limit;
};

/**
 * 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 (*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;
	bool charging_supported;
	bool remote_wakeup_supported;
};

/**
 * defines structure for platform dependent host parameters
 */
struct tegra_usb_host_mode_data {
	int vbus_gpio;
	const char *vbus_reg;
	bool hot_plug;
	bool remote_wakeup_supported;
	bool power_off_on_suspend;
};

/**
 * defines structure for usb platform data
 */
struct tegra_usb_platform_data {
	bool port_otg;
	bool has_hostpc;
	bool builtin_host_disabled;
	enum tegra_usb_phy_interface phy_intf;
	enum tegra_usb_operation_mode op_mode;

	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;
		struct tegra_hsic_config hsic;
	} 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;
};

#endif /* _TEGRA_USB_H_ */