blob: 3fefd524e8f6cc6876c84ac257c211977fb25e38 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* linux/include/mach/hsusb.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
5 * Author: Brian Swetland <swetland@google.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __ASM_ARCH_MSM_HSUSB_H
19#define __ASM_ARCH_MSM_HSUSB_H
20
21#include <linux/types.h>
22#include <linux/pm_qos_params.h>
23
24#define PHY_TYPE_MASK 0x0F
25#define PHY_TYPE_MODE 0xF0
26#define PHY_MODEL_MASK 0xFF00
27#define PHY_TYPE(x) ((x) & PHY_TYPE_MASK)
28#define PHY_MODEL(x) ((x) & PHY_MODEL_MASK)
29
30#define USB_PHY_MODEL_65NM 0x100
31#define USB_PHY_MODEL_180NM 0x200
32#define USB_PHY_MODEL_45NM 0x400
33#define USB_PHY_UNDEFINED 0x00
34#define USB_PHY_INTEGRATED 0x01
35#define USB_PHY_EXTERNAL 0x02
36#define USB_PHY_SERIAL_PMIC 0x04
37
38#define REQUEST_STOP 0
39#define REQUEST_START 1
40#define REQUEST_RESUME 2
41#define REQUEST_HNP_SUSPEND 3
42#define REQUEST_HNP_RESUME 4
43
44/* Flags required to read ID state of PHY for ACA */
45#define PHY_ID_MASK 0xB0
46#define PHY_ID_GND 0
47#define PHY_ID_C 0x10
48#define PHY_ID_B 0x30
49#define PHY_ID_A 0x90
50
51#define phy_id_state(ints) ((ints) & PHY_ID_MASK)
52#define phy_id_state_a(ints) (phy_id_state((ints)) == PHY_ID_A)
53#define phy_id_state_b(ints) (phy_id_state((ints)) == PHY_ID_B)
54#define phy_id_state_c(ints) (phy_id_state((ints)) == PHY_ID_C)
55#define phy_id_state_gnd(ints) (phy_id_state((ints)) == PHY_ID_GND)
56
57/* used to detect the OTG Mode */
58enum otg_mode {
59 OTG_ID = 0, /* ID pin detection */
60 OTG_USER_CONTROL, /* User configurable */
61 OTG_VCHG, /* Based on VCHG interrupt */
62};
63
64/* used to configure the default mode,if otg_mode is USER_CONTROL */
65enum usb_mode {
66 USB_HOST_MODE,
67 USB_PERIPHERAL_MODE,
68};
69
70enum chg_type {
71 USB_CHG_TYPE__SDP,
72 USB_CHG_TYPE__CARKIT,
73 USB_CHG_TYPE__WALLCHARGER,
74 USB_CHG_TYPE__INVALID
75};
76
77enum pre_emphasis_level {
78 PRE_EMPHASIS_DEFAULT,
79 PRE_EMPHASIS_DISABLE,
80 PRE_EMPHASIS_WITH_10_PERCENT = (1 << 5),
81 PRE_EMPHASIS_WITH_20_PERCENT = (3 << 4),
82};
83enum cdr_auto_reset {
84 CDR_AUTO_RESET_DEFAULT,
85 CDR_AUTO_RESET_ENABLE,
86 CDR_AUTO_RESET_DISABLE,
87};
88
89enum se1_gate_state {
90 SE1_GATING_DEFAULT,
91 SE1_GATING_ENABLE,
92 SE1_GATING_DISABLE,
93};
94
95enum hs_drv_amplitude {
96 HS_DRV_AMPLITUDE_DEFAULT,
97 HS_DRV_AMPLITUDE_ZERO_PERCENT,
98 HS_DRV_AMPLITUDE_25_PERCENTI = (1 << 2),
99 HS_DRV_AMPLITUDE_5_PERCENT = (1 << 3),
100 HS_DRV_AMPLITUDE_75_PERCENT = (3 << 2),
101};
102
103#define HS_DRV_SLOPE_DEFAULT (-1)
104
105/* used to configure the analog switch to select b/w host and peripheral */
106enum usb_switch_control {
107 USB_SWITCH_PERIPHERAL = 0, /* Configure switch in peripheral mode*/
108 USB_SWITCH_HOST, /* Host mode */
109 USB_SWITCH_DISABLE, /* No mode selected, shutdown power */
110};
111
112struct msm_hsusb_gadget_platform_data {
113 int *phy_init_seq;
114 void (*phy_reset)(void);
115
116 int self_powered;
117 int is_phy_status_timer_on;
118};
119
120struct msm_otg_platform_data {
121 int (*rpc_connect)(int);
122 int (*phy_reset)(void __iomem *);
123 unsigned int core_clk;
124 int pmic_vbus_irq;
125 /* if usb link is in sps there is no need for
126 * usb pclk as dayatona fabric clock will be
127 * used instead
128 */
129 int usb_in_sps;
130 enum pre_emphasis_level pemp_level;
131 enum cdr_auto_reset cdr_autoreset;
132 enum hs_drv_amplitude drv_ampl;
133 enum se1_gate_state se1_gating;
134 int hsdrvslope;
135 int phy_reset_sig_inverted;
136 int phy_can_powercollapse;
137 int pclk_required_during_lpm;
138
139 /* HSUSB core in 8660 has the capability to gate the
140 * pclk when not being used. Though this feature is
141 * now being disabled because of H/w issues
142 */
143 int pclk_is_hw_gated;
144 char *pclk_src_name;
145
146 int (*ldo_init) (int init);
147 int (*ldo_enable) (int enable);
148 int (*ldo_set_voltage) (int mV);
149
150 u32 swfi_latency;
151 /* pmic notfications apis */
152 int (*pmic_vbus_notif_init) (void (*callback)(int online), int init);
153 int (*pmic_id_notif_init) (void (*callback)(int online), int init);
154 int (*pmic_register_vbus_sn) (void (*callback)(int online));
155 void (*pmic_unregister_vbus_sn) (void (*callback)(int online));
156 int (*pmic_enable_ldo) (int);
157 int (*init_gpio)(int on);
158 void (*setup_gpio)(enum usb_switch_control mode);
159 u8 otg_mode;
160 u8 usb_mode;
161 void (*vbus_power) (unsigned phy_info, int on);
162
163 /* charger notification apis */
164 void (*chg_connected)(enum chg_type chg_type);
165 void (*chg_vbus_draw)(unsigned ma);
166 int (*chg_init)(int init);
167 int (*config_vddcx)(int high);
168 int (*init_vddcx)(int init);
169
170 struct pm_qos_request_list pm_qos_req_dma;
171};
172
173struct msm_usb_host_platform_data {
174 unsigned phy_info;
175 unsigned int power_budget;
176 void (*config_gpio)(unsigned int config);
177 void (*vbus_power) (unsigned phy_info, int on);
178 int (*vbus_init)(int init);
179 struct clk *ebi1_clk;
180};
181
182#endif