blob: f9729c45c879d96c1e8c5e26a5b649a1d887c8fb [file] [log] [blame]
Shimrit Malichidbf43d72013-03-16 03:32:27 +02001/* include/linux/usb/msm_hsusb.h
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +05302 *
3 * Copyright (C) 2008 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
Manu Gautam355270a2012-12-21 16:52:50 +05305 * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +05306 *
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>
Ido Shayevitz9fb83452012-04-01 17:45:58 +030022#include <linux/usb/ch9.h>
23#include <linux/usb/gadget.h>
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +053024#include <linux/usb/otg.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025#include <linux/wakelock.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070026#include <linux/pm_qos.h>
Ido Shayevitz5a6178b2012-06-10 16:31:13 +030027#include <linux/hrtimer.h>
David Keitel272ce522012-08-17 16:25:24 -070028#include <linux/power_supply.h>
Ido Shayevitzd1cb16c2012-03-28 18:57:47 +020029/*
30 * The following are bit fields describing the usb_request.udc_priv word.
31 * These bit fields are set by function drivers that wish to queue
32 * usb_requests with sps/bam parameters.
33 */
34#define MSM_PIPE_ID_MASK (0x1F)
35#define MSM_TX_PIPE_ID_OFS (16)
36#define MSM_SPS_MODE BIT(5)
37#define MSM_IS_FINITE_TRANSFER BIT(6)
38#define MSM_PRODUCER BIT(7)
39#define MSM_DISABLE_WB BIT(8)
40#define MSM_ETD_IOC BIT(9)
41#define MSM_INTERNAL_MEM BIT(10)
42#define MSM_VENDOR_ID BIT(16)
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +053043
44/**
45 * Supported USB modes
46 *
47 * USB_PERIPHERAL Only peripheral mode is supported.
48 * USB_HOST Only host mode is supported.
49 * USB_OTG OTG mode is supported.
50 *
51 */
52enum usb_mode_type {
53 USB_NONE = 0,
54 USB_PERIPHERAL,
55 USB_HOST,
56 USB_OTG,
57};
58
59/**
60 * OTG control
61 *
62 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
63 * only configuration.
64 * OTG_PHY_CONTROL Id/VBUS notifications comes form USB PHY.
65 * OTG_PMIC_CONTROL Id/VBUS notifications comes from PMIC hardware.
66 * OTG_USER_CONTROL Id/VBUS notifcations comes from User via sysfs.
67 *
68 */
69enum otg_control_type {
70 OTG_NO_CONTROL = 0,
71 OTG_PHY_CONTROL,
72 OTG_PMIC_CONTROL,
73 OTG_USER_CONTROL,
74};
75
76/**
Pavankumar Kondetid8608522011-05-04 10:19:47 +053077 * PHY used in
78 *
79 * INVALID_PHY Unsupported PHY
80 * CI_45NM_INTEGRATED_PHY Chipidea 45nm integrated PHY
81 * SNPS_28NM_INTEGRATED_PHY Synopsis 28nm integrated PHY
82 *
83 */
84enum msm_usb_phy_type {
85 INVALID_PHY = 0,
86 CI_45NM_INTEGRATED_PHY,
87 SNPS_28NM_INTEGRATED_PHY,
88};
89
90#define IDEV_CHG_MAX 1500
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091#define IDEV_CHG_MIN 500
Pavankumar Kondetid8608522011-05-04 10:19:47 +053092#define IUNIT 100
93
Pavankumar Kondetiaa449e12011-11-04 11:09:26 +053094#define IDEV_ACA_CHG_MAX 1500
95#define IDEV_ACA_CHG_LIMIT 500
96
Pavankumar Kondetid8608522011-05-04 10:19:47 +053097/**
98 * Different states involved in USB charger detection.
99 *
100 * USB_CHG_STATE_UNDEFINED USB charger is not connected or detection
101 * process is not yet started.
102 * USB_CHG_STATE_WAIT_FOR_DCD Waiting for Data pins contact.
103 * USB_CHG_STATE_DCD_DONE Data pin contact is detected.
104 * USB_CHG_STATE_PRIMARY_DONE Primary detection is completed (Detects
105 * between SDP and DCP/CDP).
106 * USB_CHG_STATE_SECONDARY_DONE Secondary detection is completed (Detects
107 * between DCP and CDP).
108 * USB_CHG_STATE_DETECTED USB charger type is determined.
109 *
110 */
111enum usb_chg_state {
112 USB_CHG_STATE_UNDEFINED = 0,
113 USB_CHG_STATE_WAIT_FOR_DCD,
114 USB_CHG_STATE_DCD_DONE,
115 USB_CHG_STATE_PRIMARY_DONE,
116 USB_CHG_STATE_SECONDARY_DONE,
117 USB_CHG_STATE_DETECTED,
118};
119
120/**
121 * USB charger types
122 *
123 * USB_INVALID_CHARGER Invalid USB charger.
124 * USB_SDP_CHARGER Standard downstream port. Refers to a downstream port
125 * on USB2.0 compliant host/hub.
126 * USB_DCP_CHARGER Dedicated charger port (AC charger/ Wall charger).
127 * USB_CDP_CHARGER Charging downstream port. Enumeration can happen and
128 * IDEV_CHG_MAX can be drawn irrespective of USB state.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700129 * USB_ACA_A_CHARGER B-device is connected on accessory port with charger
130 * connected on charging port. This configuration allows
131 * charging in host mode.
132 * USB_ACA_B_CHARGER No device (or A-device without VBUS) is connected on
133 * accessory port with charger connected on charging port.
134 * USB_ACA_C_CHARGER A-device (with VBUS) is connected on
135 * accessory port with charger connected on charging port.
136 * USB_ACA_DOCK_CHARGER A docking station that has one upstream port and one
137 * or more downstream ports. Capable of supplying
138 * IDEV_CHG_MAX irrespective of devices connected on
139 * accessory ports.
Pavankumar Kondeti9ec21d32012-05-07 15:50:23 +0530140 * USB_PROPRIETARY_CHARGER A proprietary charger pull DP and DM to specific
141 * voltages between 2.0-3.3v for identification.
142 *
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530143 */
144enum usb_chg_type {
145 USB_INVALID_CHARGER = 0,
146 USB_SDP_CHARGER,
147 USB_DCP_CHARGER,
148 USB_CDP_CHARGER,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700149 USB_ACA_A_CHARGER,
150 USB_ACA_B_CHARGER,
151 USB_ACA_C_CHARGER,
152 USB_ACA_DOCK_CHARGER,
Pavankumar Kondeti9ec21d32012-05-07 15:50:23 +0530153 USB_PROPRIETARY_CHARGER,
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530154};
155
156/**
Mayank Rana248698c2012-04-19 00:03:16 +0530157 * Used different VDDCX voltage voting mechnism
158 * VDDCX_CORNER Vote for VDDCX Corner voltage
159 * VDDCX Vote for VDDCX Absolute voltage
160 */
161enum usb_vdd_type {
162 VDDCX_CORNER = 0,
163 VDDCX,
164 VDD_TYPE_MAX,
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530165};
166
167/**
Amit Blayd6ea6102012-06-07 16:26:24 +0300168 * Used different VDDCX voltage values
169 */
170enum usb_vdd_value {
171 VDD_NONE = 0,
172 VDD_MIN,
173 VDD_MAX,
174 VDD_VAL_MAX,
175};
176
177/**
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530178 * struct msm_otg_platform_data - platform device data
Pavankumar Kondetidfb21302011-03-04 22:45:02 +0530179 * for msm_otg driver.
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530180 * @phy_init_seq: PHY configuration sequence. val, reg pairs
181 * terminated by -1.
Mayank Rana8549e632012-01-23 12:49:54 +0530182 * @vbus_power: VBUS power on/off routine.It should return result
183 * as success(zero value) or failure(non-zero value).
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530184 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
185 * @mode: Supported mode (OTG/peripheral/host).
186 * @otg_control: OTG switch controlled by user/Id pin
187 * @default_mode: Default operational mode. Applicable only if
188 * OTG switch is controller by user.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700189 * @pmic_id_irq: IRQ number assigned for PMIC USB ID line.
Jack Pham87f202f2012-08-06 00:24:22 -0700190 * @mpm_otgsessvld_int: MPM wakeup pin assigned for OTG SESSVLD
191 * interrupt. Used when .otg_control == OTG_PHY_CONTROL.
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +0530192 * @mhl_enable: indicates MHL connector or not.
Ofir Cohen4da266f2012-01-03 10:19:29 +0200193 * @disable_reset_on_disconnect: perform USB PHY and LINK reset
194 * on USB cable disconnection.
Manu Gautam0ddbd922012-09-21 17:17:38 +0530195 * @pnoc_errata_fix: workaround needed for PNOC hardware bug that
196 * affects USB performance.
Amit Blay6fa647a2012-05-24 14:12:08 +0300197 * @enable_lpm_on_suspend: Enable the USB core to go into Low
198 * Power Mode, when USB bus is suspended but cable
199 * is connected.
Amit Blay9b6e58b2012-06-18 13:12:49 +0300200 * @core_clk_always_on_workaround: Don't disable core_clk when
201 * USB enters LPM.
Amit Blayd6f38282012-10-29 13:13:46 +0200202 * @delay_lpm_on_disconnect: Use a delay before entering LPM
203 * upon USB cable disconnection.
Manu Gautam0fd2d0e2013-03-26 18:09:11 +0530204 * @enable_sec_phy: Use second HSPHY with USB2 core
Manu Gautamcd82e9d2011-12-20 14:17:28 +0530205 * @bus_scale_table: parameters for bus bandwidth requirements
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530206 * @mhl_dev_name: MHL device name used to register with MHL driver.
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530207 */
208struct msm_otg_platform_data {
209 int *phy_init_seq;
Mayank Rana8549e632012-01-23 12:49:54 +0530210 int (*vbus_power)(bool on);
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530211 unsigned power_budget;
212 enum usb_mode_type mode;
213 enum otg_control_type otg_control;
214 enum usb_mode_type default_mode;
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530215 enum msm_usb_phy_type phy_type;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530216 void (*setup_gpio)(enum usb_otg_state state);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700217 int pmic_id_irq;
Jack Pham87f202f2012-08-06 00:24:22 -0700218 unsigned int mpm_otgsessvld_int;
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +0530219 bool mhl_enable;
Ofir Cohen4da266f2012-01-03 10:19:29 +0200220 bool disable_reset_on_disconnect;
Manu Gautam0ddbd922012-09-21 17:17:38 +0530221 bool pnoc_errata_fix;
Amit Blay6fa647a2012-05-24 14:12:08 +0300222 bool enable_lpm_on_dev_suspend;
Amit Blay9b6e58b2012-06-18 13:12:49 +0300223 bool core_clk_always_on_workaround;
Amit Blayd6f38282012-10-29 13:13:46 +0200224 bool delay_lpm_on_disconnect;
Lena Salmanabde35d2013-04-25 15:29:43 +0300225 bool delay_lpm_hndshk_on_disconnect;
Vamsi Krishna1a1684b2013-03-02 16:14:52 -0800226 bool dp_manual_pullup;
Manu Gautam0fd2d0e2013-03-26 18:09:11 +0530227 bool enable_sec_phy;
Manu Gautamcd82e9d2011-12-20 14:17:28 +0530228 struct msm_bus_scale_pdata *bus_scale_table;
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530229 const char *mhl_dev_name;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530230};
231
Vamsi Krishna1a1684b2013-03-02 16:14:52 -0800232/* phy related flags */
233#define ENABLE_DP_MANUAL_PULLUP BIT(0)
Manu Gautam0fd2d0e2013-03-26 18:09:11 +0530234#define ENABLE_SECONDARY_PHY BIT(1)
Vamsi Krishna1a1684b2013-03-02 16:14:52 -0800235
Vijayavardhan Vennapusaa3152032012-03-05 16:29:30 +0530236/* Timeout (in msec) values (min - max) associated with OTG timers */
237
238#define TA_WAIT_VRISE 100 /* ( - 100) */
239#define TA_WAIT_VFALL 500 /* ( - 1000) */
240
241/*
242 * This option is set for embedded hosts or OTG devices in which leakage
243 * currents are very minimal.
244 */
245#ifdef CONFIG_USB_OTG
246#define TA_WAIT_BCON 30000 /* (1100 - 30000) */
247#else
248#define TA_WAIT_BCON -1
249#endif
250
251#define TA_AIDL_BDIS 500 /* (200 - ) */
252#define TA_BIDL_ADIS 155 /* (155 - 200) */
253#define TB_SRP_FAIL 6000 /* (5000 - 6000) */
254#define TB_ASE0_BRST 200 /* (155 - ) */
255
256/* TB_SSEND_SRP and TB_SE0_SRP are combined */
257#define TB_SRP_INIT 2000 /* (1500 - ) */
258
259#define TA_TST_MAINT 10100 /* (9900 - 10100) */
260#define TB_TST_SRP 3000 /* ( - 5000) */
261#define TB_TST_CONFIG 300
262
263/* Timeout variables */
264
265#define A_WAIT_VRISE 0
266#define A_WAIT_VFALL 1
267#define A_WAIT_BCON 2
268#define A_AIDL_BDIS 3
269#define A_BIDL_ADIS 4
270#define B_SRP_FAIL 5
271#define B_ASE0_BRST 6
272#define A_TST_MAINT 7
273#define B_TST_SRP 8
274#define B_TST_CONFIG 9
275
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530276/**
277 * struct msm_otg: OTG driver data. Shared by HCD and DCD.
278 * @otg: USB OTG Transceiver structure.
279 * @pdata: otg device platform data.
280 * @irq: IRQ number assigned for HSUSB controller.
Manu Gautamf8c45642012-08-10 10:20:56 -0700281 * @async_irq: IRQ number used by some controllers during low power state
Manu Gautam5143b252012-01-05 19:25:23 -0800282 * @clk: clock struct of alt_core_clk.
283 * @pclk: clock struct of iface_clk.
284 * @phy_reset_clk: clock struct of phy_clk.
285 * @core_clk: clock struct of core_bus_clk.
Mayank Rana3eaf28d2013-03-27 14:04:04 +0530286 * @core_clk_rate: core clk max frequency
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530287 * @regs: ioremapped register base address.
288 * @inputs: OTG state machine inputs(Id, SessValid etc).
289 * @sm_work: OTG state machine work.
Pavankumar Kondeti87c01042010-12-07 17:53:58 +0530290 * @in_lpm: indicates low power mode (LPM) state.
Manu Gautamf8c45642012-08-10 10:20:56 -0700291 * @async_int: IRQ line on which ASYNC interrupt arrived in LPM.
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530292 * @cur_power: The amount of mA available from downstream port.
293 * @chg_work: Charger detection work.
294 * @chg_state: The state of charger detection process.
295 * @chg_type: The type of charger attached.
296 * @dcd_retires: The retry count used to track Data contact
297 * detection process.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700298 * @wlock: Wake lock struct to prevent system suspend when
299 * USB is active.
300 * @usbdev_nb: The notifier block used to know about the B-device
301 * connected. Useful only when ACA_A charger is
302 * connected.
303 * @mA_port: The amount of current drawn by the attached B-device.
Pavankumar Kondetiaa449e12011-11-04 11:09:26 +0530304 * @id_timer: The timer used for polling ID line to detect ACA states.
Anji jonnala7da3f262011-12-02 17:22:14 -0800305 * @xo_handle: TCXO buffer handle
Manu Gautamcd82e9d2011-12-20 14:17:28 +0530306 * @bus_perf_client: Bus performance client handle to request BUS bandwidth
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530307 * @mhl_enabled: MHL driver registration successful and MHL enabled.
Pavankumar Kondeti458d8792012-09-28 14:45:18 +0530308 * @chg_check_timer: The timer used to implement the workaround to detect
309 * very slow plug in of wall charger.
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530310 */
311struct msm_otg {
Heikki Krogerus1d4c9292012-02-13 13:24:09 +0200312 struct usb_phy phy;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530313 struct msm_otg_platform_data *pdata;
314 int irq;
Manu Gautamf8c45642012-08-10 10:20:56 -0700315 int async_irq;
Vijayavardhan Vennapusa0cab6172013-02-20 19:51:15 +0530316 struct clk *xo_clk;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530317 struct clk *clk;
318 struct clk *pclk;
319 struct clk *phy_reset_clk;
320 struct clk *core_clk;
Mayank Rana3eaf28d2013-03-27 14:04:04 +0530321 long core_clk_rate;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530322 void __iomem *regs;
323#define ID 0
324#define B_SESS_VLD 1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700325#define ID_A 2
326#define ID_B 3
327#define ID_C 4
Vijayavardhan Vennapusaa3152032012-03-05 16:29:30 +0530328#define A_BUS_DROP 5
329#define A_BUS_REQ 6
330#define A_SRP_DET 7
331#define A_VBUS_VLD 8
332#define B_CONN 9
333#define ADP_CHANGE 10
334#define POWER_UP 11
335#define A_CLR_ERR 12
336#define A_BUS_RESUME 13
337#define A_BUS_SUSPEND 14
338#define A_CONN 15
339#define B_BUS_REQ 16
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530340#define MHL 17
Pavankumar Kondeti458d8792012-09-28 14:45:18 +0530341#define B_FALSE_SDP 18
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530342 unsigned long inputs;
343 struct work_struct sm_work;
Jack Pham5ca279b2012-05-14 18:42:54 -0700344 bool sm_work_pending;
345 atomic_t pm_suspended;
Pavankumar Kondeti87c01042010-12-07 17:53:58 +0530346 atomic_t in_lpm;
347 int async_int;
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530348 unsigned cur_power;
349 struct delayed_work chg_work;
Vijayavardhan Vennapusa68d55cf2012-06-27 20:06:12 +0530350 struct delayed_work pmic_id_status_work;
Amit Blayd0fe07b2012-09-05 16:42:09 +0300351 struct delayed_work suspend_work;
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530352 enum usb_chg_state chg_state;
353 enum usb_chg_type chg_type;
Pavankumar Kondetiebb4a2d2013-01-04 12:28:10 +0530354 unsigned dcd_time;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700355 struct wake_lock wlock;
356 struct notifier_block usbdev_nb;
357 unsigned mA_port;
Pavankumar Kondetiaa449e12011-11-04 11:09:26 +0530358 struct timer_list id_timer;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 unsigned long caps;
Stephen Boyd30ad10b2012-03-01 14:51:04 -0800360 struct msm_xo_voter *xo_handle;
Manu Gautamcd82e9d2011-12-20 14:17:28 +0530361 uint32_t bus_perf_client;
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530362 bool mhl_enabled;
Pavankumar Kondeti458d8792012-09-28 14:45:18 +0530363 struct timer_list chg_check_timer;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700364 /*
365 * Allowing PHY power collpase turns off the HSUSB 3.3v and 1.8v
366 * analog regulators while going to low power mode.
Amit Blay81801aa2012-09-19 12:08:12 +0200367 * Currently only 28nm PHY has the support to allowing PHY
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700368 * power collapse since it doesn't have leakage currents while
369 * turning off the power rails.
370 */
371#define ALLOW_PHY_POWER_COLLAPSE BIT(0)
372 /*
373 * Allow PHY RETENTION mode before turning off the digital
374 * voltage regulator(VDDCX).
375 */
376#define ALLOW_PHY_RETENTION BIT(1)
Amit Blay6fa647a2012-05-24 14:12:08 +0300377 /*
378 * Allow putting the core in Low Power mode, when
379 * USB bus is suspended but cable is connected.
380 */
Amit Blay81801aa2012-09-19 12:08:12 +0200381#define ALLOW_LPM_ON_DEV_SUSPEND BIT(2)
382 /*
383 * Allowing PHY regulators LPM puts the HSUSB 3.3v and 1.8v
384 * analog regulators into LPM while going to USB low power mode.
385 */
386#define ALLOW_PHY_REGULATORS_LPM BIT(3)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700387 unsigned long lpm_flags;
388#define PHY_PWR_COLLAPSED BIT(0)
389#define PHY_RETENTIONED BIT(1)
Vijayavardhan Vennapusabbdd6082012-06-06 14:14:25 +0530390#define XO_SHUTDOWN BIT(2)
Ido Shayevitzc5c0f572012-07-31 13:58:45 +0300391#define CLOCKS_DOWN BIT(3)
Amit Blay81801aa2012-09-19 12:08:12 +0200392#define PHY_REGULATORS_LPM BIT(4)
Ofir Cohen4da266f2012-01-03 10:19:29 +0200393 int reset_counter;
Vijayavardhan Vennapusaa3152032012-03-05 16:29:30 +0530394 unsigned long b_last_se0_sess;
395 unsigned long tmouts;
396 u8 active_tmout;
397 struct hrtimer timer;
Mayank Rana248698c2012-04-19 00:03:16 +0530398 enum usb_vdd_type vdd_type;
David Keitel272ce522012-08-17 16:25:24 -0700399 struct power_supply usb_psy;
400 unsigned int online;
401 unsigned int host_mode;
402 unsigned int current_max;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530403};
404
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530405struct msm_hsic_host_platform_data {
406 unsigned strobe;
407 unsigned data;
Manu Gautam863b74132012-11-21 14:30:04 +0530408 bool ignore_cal_pad_config;
Manu Gautam3c598392013-03-22 16:59:10 +0530409 bool phy_sof_workaround;
Manu Gautam863b74132012-11-21 14:30:04 +0530410 int strobe_pad_offset;
411 int data_pad_offset;
412
Hemant Kumare6275972012-02-29 20:06:21 -0800413 struct msm_bus_scale_pdata *bus_scale_table;
Hemant Kumar30d361c2012-08-20 14:44:40 -0700414 unsigned log2_irq_thresh;
Hemant Kumarbc8bdf62012-10-17 12:29:51 -0700415
Vamsi Krishnabef91832013-03-11 14:10:20 -0700416 /* gpio used to resume peripheral */
417 unsigned resume_gpio;
418
Hemant Kumarbc8bdf62012-10-17 12:29:51 -0700419 /*swfi latency is required while driving resume on to the bus */
Pavankumar Kondeti4f5dc3b2012-09-07 15:33:09 +0530420 u32 swfi_latency;
Hemant Kumarbc8bdf62012-10-17 12:29:51 -0700421
422 /*standalone latency is required when HSCI is active*/
423 u32 standalone_latency;
Shimrit Malichi36a0c852013-03-10 11:39:10 +0200424 bool pool_64_bit_align;
Shimrit Malichi82d7cbc2013-03-12 15:36:54 +0200425 bool enable_hbm;
Shimrit Malichi08f07342013-04-24 13:09:12 +0300426 bool disable_park_mode;
Ido Shayevitzaa165c52013-05-12 16:01:28 +0200427 bool consider_ipa_handshake;
Amit Blay1dfbbcc2013-05-26 17:33:13 +0300428 bool ahb_async_bridge_bypass;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530429};
430
Manu Gautam91223e02011-11-08 15:27:22 +0530431struct msm_usb_host_platform_data {
432 unsigned int power_budget;
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530433 int pmic_gpio_dp_irq;
Hemant Kumar56925352012-02-13 16:59:52 -0800434 unsigned int dock_connect_irq;
Vijayavardhan Vennapusa1f5da0b2013-01-08 20:03:57 +0530435 bool use_sec_phy;
Manu Gautam91223e02011-11-08 15:27:22 +0530436};
437
Amit Blay9b6e58b2012-06-18 13:12:49 +0300438/**
439 * struct msm_hsic_peripheral_platform_data: HSIC peripheral
440 * platform data.
441 * @core_clk_always_on_workaround: Don't disable core_clk when
442 * HSIC enters LPM.
443 */
Amit Blay4d57d362012-04-28 11:00:21 +0300444struct msm_hsic_peripheral_platform_data {
Amit Blay9b6e58b2012-06-18 13:12:49 +0300445 bool core_clk_always_on_workaround;
Amit Blay4d57d362012-04-28 11:00:21 +0300446};
447
Jack Phamfadd6432012-12-07 19:03:41 -0800448/**
449 * struct usb_ext_notification: event notification structure
450 * @notify: pointer to client function to call when ID event is detected.
451 * The last parameter is provided by driver to be called back when
452 * external client indicates it is done using the USB. This function
453 * should return 0 if handled successfully, otherise an error code.
454 * @ctxt: client-specific context pointer
455 *
456 * This structure should be used by clients wishing to register (via
457 * msm_register_usb_ext_notification) for event notification whenever a USB
458 * cable is plugged in and ID pin status changes. Clients must provide a
459 * callback function pointer. If this callback returns 0, the USB driver will
460 * assume the client is "taking over" the connection, and will relinquish any
461 * further processing until its callback (passed via the third parameter) is
462 * called with the online parameter set to false.
463 */
464struct usb_ext_notification {
465 int (*notify)(void *, int, void (*)(int online));
466 void *ctxt;
467};
Lena Salmanabde35d2013-04-25 15:29:43 +0300468#ifdef CONFIG_USB_BAM
469bool msm_bam_lpm_ok(void);
Ido Shayevitzaa165c52013-05-12 16:01:28 +0200470void msm_bam_set_hsic_host_dev(struct device *dev);
471void msm_bam_wait_for_hsic_prod_granted(void);
472bool msm_bam_hsic_lpm_ok(void);
473void msm_bam_hsic_notify_on_resume(void);
Lena Salmanabde35d2013-04-25 15:29:43 +0300474#else
475static inline bool msm_bam_lpm_ok(void) { return true; }
Ido Shayevitzaa165c52013-05-12 16:01:28 +0200476static inline void msm_bam_set_hsic_host_dev(struct device *dev) {}
477static inline void msm_bam_wait_for_hsic_prod_granted(void) {}
478static inline bool msm_bam_hsic_lpm_ok(void) { return true; }
479static inline void msm_bam_hsic_notify_on_resume(void) {}
Lena Salmanabde35d2013-04-25 15:29:43 +0300480#endif
Amit Blay1572b492012-11-27 16:45:32 +0200481#ifdef CONFIG_USB_CI13XXX_MSM
482void msm_hw_bam_disable(bool bam_disable);
Amit Blay1572b492012-11-27 16:45:32 +0200483#else
484static inline void msm_hw_bam_disable(bool bam_disable)
485{
486}
487#endif
488
Shimrit Malichi255b5342012-08-02 21:01:43 +0300489#ifdef CONFIG_USB_DWC3_MSM
Ido Shayevitz9fb83452012-04-01 17:45:58 +0300490int msm_ep_config(struct usb_ep *ep);
491int msm_ep_unconfig(struct usb_ep *ep);
Shimrit Malichi255b5342012-08-02 21:01:43 +0300492int msm_data_fifo_config(struct usb_ep *ep, u32 addr, u32 size,
493 u8 dst_pipe_idx);
Ido Shayevitz9fb83452012-04-01 17:45:58 +0300494
Manu Gautam6eb13e32013-02-01 15:19:15 +0530495void msm_dwc3_restart_usb_session(void);
Jack Phamfadd6432012-12-07 19:03:41 -0800496
Manu Gautam6eb13e32013-02-01 15:19:15 +0530497int msm_register_usb_ext_notification(struct usb_ext_notification *info);
Shimrit Malichi255b5342012-08-02 21:01:43 +0300498#else
499static inline int msm_data_fifo_config(struct usb_ep *ep, u32 addr, u32 size,
500 u8 dst_pipe_idx)
501{
502 return -ENODEV;
503}
504
505static inline int msm_ep_config(struct usb_ep *ep)
506{
507 return -ENODEV;
508}
509
510static inline int msm_ep_unconfig(struct usb_ep *ep)
511{
512 return -ENODEV;
513}
Jack Phamfadd6432012-12-07 19:03:41 -0800514
Manu Gautam6eb13e32013-02-01 15:19:15 +0530515static inline void msm_dwc3_restart_usb_session(void)
516{
517 return;
518}
519
Jack Phamfadd6432012-12-07 19:03:41 -0800520static inline int msm_register_usb_ext_notification(
521 struct usb_ext_notification *info)
522{
523 return -ENODEV;
524}
Shimrit Malichi255b5342012-08-02 21:01:43 +0300525#endif
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530526#endif