blob: b4880a26d8b7eec077f23784948f8d4af46d18ab [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)
Pavankumar Kondeti9e49ea92011-07-13 17:51:40 +053052#define phy_id_state_gnd(ints) (phy_id_state((ints)) == PHY_ID_GND)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053#define phy_id_state_a(ints) (phy_id_state((ints)) == PHY_ID_A)
Pavankumar Kondeti9e49ea92011-07-13 17:51:40 +053054/* RID_B and RID_C states does not exist with standard ACA */
55#ifdef CONFIG_USB_MSM_STANDARD_ACA
56#define phy_id_state_b(ints) 0
57#define phy_id_state_c(ints) 0
58#else
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070059#define phy_id_state_b(ints) (phy_id_state((ints)) == PHY_ID_B)
60#define phy_id_state_c(ints) (phy_id_state((ints)) == PHY_ID_C)
Pavankumar Kondeti9e49ea92011-07-13 17:51:40 +053061#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062
63/* used to detect the OTG Mode */
64enum otg_mode {
65 OTG_ID = 0, /* ID pin detection */
66 OTG_USER_CONTROL, /* User configurable */
67 OTG_VCHG, /* Based on VCHG interrupt */
68};
69
70/* used to configure the default mode,if otg_mode is USER_CONTROL */
71enum usb_mode {
72 USB_HOST_MODE,
73 USB_PERIPHERAL_MODE,
74};
75
76enum chg_type {
77 USB_CHG_TYPE__SDP,
78 USB_CHG_TYPE__CARKIT,
79 USB_CHG_TYPE__WALLCHARGER,
80 USB_CHG_TYPE__INVALID
81};
82
83enum pre_emphasis_level {
84 PRE_EMPHASIS_DEFAULT,
85 PRE_EMPHASIS_DISABLE,
86 PRE_EMPHASIS_WITH_10_PERCENT = (1 << 5),
87 PRE_EMPHASIS_WITH_20_PERCENT = (3 << 4),
88};
89enum cdr_auto_reset {
90 CDR_AUTO_RESET_DEFAULT,
91 CDR_AUTO_RESET_ENABLE,
92 CDR_AUTO_RESET_DISABLE,
93};
94
95enum se1_gate_state {
96 SE1_GATING_DEFAULT,
97 SE1_GATING_ENABLE,
98 SE1_GATING_DISABLE,
99};
100
101enum hs_drv_amplitude {
102 HS_DRV_AMPLITUDE_DEFAULT,
103 HS_DRV_AMPLITUDE_ZERO_PERCENT,
104 HS_DRV_AMPLITUDE_25_PERCENTI = (1 << 2),
105 HS_DRV_AMPLITUDE_5_PERCENT = (1 << 3),
106 HS_DRV_AMPLITUDE_75_PERCENT = (3 << 2),
107};
108
109#define HS_DRV_SLOPE_DEFAULT (-1)
110
111/* used to configure the analog switch to select b/w host and peripheral */
112enum usb_switch_control {
113 USB_SWITCH_PERIPHERAL = 0, /* Configure switch in peripheral mode*/
114 USB_SWITCH_HOST, /* Host mode */
115 USB_SWITCH_DISABLE, /* No mode selected, shutdown power */
116};
117
118struct msm_hsusb_gadget_platform_data {
119 int *phy_init_seq;
120 void (*phy_reset)(void);
121
122 int self_powered;
123 int is_phy_status_timer_on;
124};
125
126struct msm_otg_platform_data {
127 int (*rpc_connect)(int);
128 int (*phy_reset)(void __iomem *);
129 unsigned int core_clk;
130 int pmic_vbus_irq;
131 /* if usb link is in sps there is no need for
132 * usb pclk as dayatona fabric clock will be
133 * used instead
134 */
135 int usb_in_sps;
136 enum pre_emphasis_level pemp_level;
137 enum cdr_auto_reset cdr_autoreset;
138 enum hs_drv_amplitude drv_ampl;
139 enum se1_gate_state se1_gating;
140 int hsdrvslope;
141 int phy_reset_sig_inverted;
142 int phy_can_powercollapse;
143 int pclk_required_during_lpm;
Chandra Devireddyb3fc78c2011-08-30 17:25:55 +0530144 int bam_disable;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700145 /* HSUSB core in 8660 has the capability to gate the
146 * pclk when not being used. Though this feature is
147 * now being disabled because of H/w issues
148 */
149 int pclk_is_hw_gated;
150 char *pclk_src_name;
151
152 int (*ldo_init) (int init);
153 int (*ldo_enable) (int enable);
154 int (*ldo_set_voltage) (int mV);
155
156 u32 swfi_latency;
157 /* pmic notfications apis */
158 int (*pmic_vbus_notif_init) (void (*callback)(int online), int init);
159 int (*pmic_id_notif_init) (void (*callback)(int online), int init);
160 int (*pmic_register_vbus_sn) (void (*callback)(int online));
161 void (*pmic_unregister_vbus_sn) (void (*callback)(int online));
162 int (*pmic_enable_ldo) (int);
163 int (*init_gpio)(int on);
164 void (*setup_gpio)(enum usb_switch_control mode);
165 u8 otg_mode;
166 u8 usb_mode;
167 void (*vbus_power) (unsigned phy_info, int on);
168
169 /* charger notification apis */
170 void (*chg_connected)(enum chg_type chg_type);
171 void (*chg_vbus_draw)(unsigned ma);
172 int (*chg_init)(int init);
173 int (*config_vddcx)(int high);
174 int (*init_vddcx)(int init);
175
176 struct pm_qos_request_list pm_qos_req_dma;
177};
178
179struct msm_usb_host_platform_data {
180 unsigned phy_info;
181 unsigned int power_budget;
182 void (*config_gpio)(unsigned int config);
183 void (*vbus_power) (unsigned phy_info, int on);
184 int (*vbus_init)(int init);
185 struct clk *ebi1_clk;
186};
187
188#endif