blob: aaf0a05828a099ad6bb4509388b9cbbdd5d42192 [file] [log] [blame]
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +05301/* linux/include/asm-arm/arch-msm/hsusb.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
Duy Truonge833aca2013-02-12 13:35:08 -08005 * Copyright (c) 2009-2012, 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>
Flemmard77ad3212013-02-12 16:25:42 +010026#ifdef CONFIG_MACH_HTC
27#include <mach/board.h>
28#endif
Steve Mucklef132c6c2012-06-06 18:30:57 -070029#include <linux/pm_qos.h>
Ido Shayevitz5a6178b2012-06-10 16:31:13 +030030#include <linux/hrtimer.h>
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +053031
Ido Shayevitzd1cb16c2012-03-28 18:57:47 +020032/*
33 * The following are bit fields describing the usb_request.udc_priv word.
34 * These bit fields are set by function drivers that wish to queue
35 * usb_requests with sps/bam parameters.
36 */
37#define MSM_PIPE_ID_MASK (0x1F)
38#define MSM_TX_PIPE_ID_OFS (16)
39#define MSM_SPS_MODE BIT(5)
40#define MSM_IS_FINITE_TRANSFER BIT(6)
41#define MSM_PRODUCER BIT(7)
42#define MSM_DISABLE_WB BIT(8)
43#define MSM_ETD_IOC BIT(9)
44#define MSM_INTERNAL_MEM BIT(10)
45#define MSM_VENDOR_ID BIT(16)
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +053046
47/**
48 * Supported USB modes
49 *
50 * USB_PERIPHERAL Only peripheral mode is supported.
51 * USB_HOST Only host mode is supported.
52 * USB_OTG OTG mode is supported.
53 *
54 */
55enum usb_mode_type {
56 USB_NONE = 0,
57 USB_PERIPHERAL,
58 USB_HOST,
59 USB_OTG,
60};
61
62/**
63 * OTG control
64 *
65 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
66 * only configuration.
67 * OTG_PHY_CONTROL Id/VBUS notifications comes form USB PHY.
68 * OTG_PMIC_CONTROL Id/VBUS notifications comes from PMIC hardware.
69 * OTG_USER_CONTROL Id/VBUS notifcations comes from User via sysfs.
70 *
71 */
72enum otg_control_type {
73 OTG_NO_CONTROL = 0,
74 OTG_PHY_CONTROL,
75 OTG_PMIC_CONTROL,
76 OTG_USER_CONTROL,
77};
78
79/**
Pavankumar Kondetid8608522011-05-04 10:19:47 +053080 * PHY used in
81 *
82 * INVALID_PHY Unsupported PHY
83 * CI_45NM_INTEGRATED_PHY Chipidea 45nm integrated PHY
84 * SNPS_28NM_INTEGRATED_PHY Synopsis 28nm integrated PHY
85 *
86 */
87enum msm_usb_phy_type {
88 INVALID_PHY = 0,
89 CI_45NM_INTEGRATED_PHY,
90 SNPS_28NM_INTEGRATED_PHY,
91};
92
93#define IDEV_CHG_MAX 1500
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070094#define IDEV_CHG_MIN 500
Pavankumar Kondetid8608522011-05-04 10:19:47 +053095#define IUNIT 100
96
Pavankumar Kondetiaa449e12011-11-04 11:09:26 +053097#define IDEV_ACA_CHG_MAX 1500
98#define IDEV_ACA_CHG_LIMIT 500
99
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530100/**
101 * Different states involved in USB charger detection.
102 *
103 * USB_CHG_STATE_UNDEFINED USB charger is not connected or detection
104 * process is not yet started.
105 * USB_CHG_STATE_WAIT_FOR_DCD Waiting for Data pins contact.
106 * USB_CHG_STATE_DCD_DONE Data pin contact is detected.
107 * USB_CHG_STATE_PRIMARY_DONE Primary detection is completed (Detects
108 * between SDP and DCP/CDP).
109 * USB_CHG_STATE_SECONDARY_DONE Secondary detection is completed (Detects
110 * between DCP and CDP).
111 * USB_CHG_STATE_DETECTED USB charger type is determined.
112 *
113 */
114enum usb_chg_state {
115 USB_CHG_STATE_UNDEFINED = 0,
116 USB_CHG_STATE_WAIT_FOR_DCD,
117 USB_CHG_STATE_DCD_DONE,
118 USB_CHG_STATE_PRIMARY_DONE,
119 USB_CHG_STATE_SECONDARY_DONE,
120 USB_CHG_STATE_DETECTED,
121};
122
123/**
124 * USB charger types
125 *
126 * USB_INVALID_CHARGER Invalid USB charger.
127 * USB_SDP_CHARGER Standard downstream port. Refers to a downstream port
128 * on USB2.0 compliant host/hub.
129 * USB_DCP_CHARGER Dedicated charger port (AC charger/ Wall charger).
130 * USB_CDP_CHARGER Charging downstream port. Enumeration can happen and
131 * IDEV_CHG_MAX can be drawn irrespective of USB state.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700132 * USB_ACA_A_CHARGER B-device is connected on accessory port with charger
133 * connected on charging port. This configuration allows
134 * charging in host mode.
135 * USB_ACA_B_CHARGER No device (or A-device without VBUS) is connected on
136 * accessory port with charger connected on charging port.
137 * USB_ACA_C_CHARGER A-device (with VBUS) is connected on
138 * accessory port with charger connected on charging port.
139 * USB_ACA_DOCK_CHARGER A docking station that has one upstream port and one
140 * or more downstream ports. Capable of supplying
141 * IDEV_CHG_MAX irrespective of devices connected on
142 * accessory ports.
Pavankumar Kondeti9ec21d32012-05-07 15:50:23 +0530143 * USB_PROPRIETARY_CHARGER A proprietary charger pull DP and DM to specific
144 * voltages between 2.0-3.3v for identification.
145 *
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530146 */
147enum usb_chg_type {
148 USB_INVALID_CHARGER = 0,
149 USB_SDP_CHARGER,
150 USB_DCP_CHARGER,
151 USB_CDP_CHARGER,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700152 USB_ACA_A_CHARGER,
153 USB_ACA_B_CHARGER,
154 USB_ACA_C_CHARGER,
155 USB_ACA_DOCK_CHARGER,
Pavankumar Kondeti9ec21d32012-05-07 15:50:23 +0530156 USB_PROPRIETARY_CHARGER,
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530157};
158
159/**
Mayank Rana248698c2012-04-19 00:03:16 +0530160 * Used different VDDCX voltage voting mechnism
161 * VDDCX_CORNER Vote for VDDCX Corner voltage
162 * VDDCX Vote for VDDCX Absolute voltage
163 */
164enum usb_vdd_type {
165 VDDCX_CORNER = 0,
166 VDDCX,
167 VDD_TYPE_MAX,
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530168};
169
170/**
Amit Blayd6ea6102012-06-07 16:26:24 +0300171 * Used different VDDCX voltage values
172 */
173enum usb_vdd_value {
174 VDD_NONE = 0,
175 VDD_MIN,
176 VDD_MAX,
177 VDD_VAL_MAX,
178};
179
Flemmard77ad3212013-02-12 16:25:42 +0100180#define POWER_COLLAPSE_LDO3V3 (1 << 0) /* Regulator L3 */
181#define POWER_COLLAPSE_LDO1V8 (1 << 1) /* Regulator L4 */
182
Amit Blayd6ea6102012-06-07 16:26:24 +0300183/**
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530184 * struct msm_otg_platform_data - platform device data
Pavankumar Kondetidfb21302011-03-04 22:45:02 +0530185 * for msm_otg driver.
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530186 * @phy_init_seq: PHY configuration sequence. val, reg pairs
187 * terminated by -1.
Mayank Rana8549e632012-01-23 12:49:54 +0530188 * @vbus_power: VBUS power on/off routine.It should return result
189 * as success(zero value) or failure(non-zero value).
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530190 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
191 * @mode: Supported mode (OTG/peripheral/host).
192 * @otg_control: OTG switch controlled by user/Id pin
193 * @default_mode: Default operational mode. Applicable only if
194 * OTG switch is controller by user.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195 * @pmic_id_irq: IRQ number assigned for PMIC USB ID line.
Jack Pham87f202f2012-08-06 00:24:22 -0700196 * @mpm_otgsessvld_int: MPM wakeup pin assigned for OTG SESSVLD
197 * interrupt. Used when .otg_control == OTG_PHY_CONTROL.
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +0530198 * @mhl_enable: indicates MHL connector or not.
Ofir Cohen4da266f2012-01-03 10:19:29 +0200199 * @disable_reset_on_disconnect: perform USB PHY and LINK reset
200 * on USB cable disconnection.
Amit Blay6fa647a2012-05-24 14:12:08 +0300201 * @enable_lpm_on_suspend: Enable the USB core to go into Low
202 * Power Mode, when USB bus is suspended but cable
203 * is connected.
Amit Blay9b6e58b2012-06-18 13:12:49 +0300204 * @core_clk_always_on_workaround: Don't disable core_clk when
205 * USB enters LPM.
Manu Gautamcd82e9d2011-12-20 14:17:28 +0530206 * @bus_scale_table: parameters for bus bandwidth requirements
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530207 * @mhl_dev_name: MHL device name used to register with MHL driver.
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530208 */
209struct msm_otg_platform_data {
210 int *phy_init_seq;
Mayank Rana8549e632012-01-23 12:49:54 +0530211 int (*vbus_power)(bool on);
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530212 unsigned power_budget;
213 enum usb_mode_type mode;
214 enum otg_control_type otg_control;
215 enum usb_mode_type default_mode;
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530216 enum msm_usb_phy_type phy_type;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530217 void (*setup_gpio)(enum usb_otg_state state);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700218 int pmic_id_irq;
Jack Pham87f202f2012-08-06 00:24:22 -0700219 unsigned int mpm_otgsessvld_int;
Vijayavardhan Vennapusafc464f02011-11-04 21:54:00 +0530220 bool mhl_enable;
Ofir Cohen4da266f2012-01-03 10:19:29 +0200221 bool disable_reset_on_disconnect;
Flemmard77ad3212013-02-12 16:25:42 +0100222#ifdef CONFIG_MACH_HTC
223 bool enable_dcd;
224#endif
Amit Blay6fa647a2012-05-24 14:12:08 +0300225 bool enable_lpm_on_dev_suspend;
Amit Blay9b6e58b2012-06-18 13:12:49 +0300226 bool core_clk_always_on_workaround;
Manu Gautamcd82e9d2011-12-20 14:17:28 +0530227 struct msm_bus_scale_pdata *bus_scale_table;
Flemmard77ad3212013-02-12 16:25:42 +0100228#ifdef CONFIG_MACH_HTC
229 int reset_phy_before_lpm;
230 void (*usb_uart_switch)(int uart);
231 int ldo_power_collapse;
232#else
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530233 const char *mhl_dev_name;
Flemmard77ad3212013-02-12 16:25:42 +0100234#endif
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530235};
236
Vijayavardhan Vennapusaa3152032012-03-05 16:29:30 +0530237/* Timeout (in msec) values (min - max) associated with OTG timers */
238
239#define TA_WAIT_VRISE 100 /* ( - 100) */
240#define TA_WAIT_VFALL 500 /* ( - 1000) */
241
242/*
243 * This option is set for embedded hosts or OTG devices in which leakage
244 * currents are very minimal.
245 */
246#ifdef CONFIG_USB_OTG
247#define TA_WAIT_BCON 30000 /* (1100 - 30000) */
248#else
249#define TA_WAIT_BCON -1
250#endif
251
252#define TA_AIDL_BDIS 500 /* (200 - ) */
253#define TA_BIDL_ADIS 155 /* (155 - 200) */
254#define TB_SRP_FAIL 6000 /* (5000 - 6000) */
255#define TB_ASE0_BRST 200 /* (155 - ) */
256
257/* TB_SSEND_SRP and TB_SE0_SRP are combined */
258#define TB_SRP_INIT 2000 /* (1500 - ) */
259
260#define TA_TST_MAINT 10100 /* (9900 - 10100) */
261#define TB_TST_SRP 3000 /* ( - 5000) */
262#define TB_TST_CONFIG 300
263
264/* Timeout variables */
265
266#define A_WAIT_VRISE 0
267#define A_WAIT_VFALL 1
268#define A_WAIT_BCON 2
269#define A_AIDL_BDIS 3
270#define A_BIDL_ADIS 4
271#define B_SRP_FAIL 5
272#define B_ASE0_BRST 6
273#define A_TST_MAINT 7
274#define B_TST_SRP 8
275#define B_TST_CONFIG 9
276
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530277/**
278 * struct msm_otg: OTG driver data. Shared by HCD and DCD.
279 * @otg: USB OTG Transceiver structure.
280 * @pdata: otg device platform data.
281 * @irq: IRQ number assigned for HSUSB controller.
Manu Gautamf8c45642012-08-10 10:20:56 -0700282 * @async_irq: IRQ number used by some controllers during low power state
Manu Gautam5143b252012-01-05 19:25:23 -0800283 * @clk: clock struct of alt_core_clk.
284 * @pclk: clock struct of iface_clk.
285 * @phy_reset_clk: clock struct of phy_clk.
286 * @core_clk: clock struct of core_bus_clk.
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 Kondetie0c201f2010-12-07 17:53:55 +0530308 */
309struct msm_otg {
Heikki Krogerus1d4c9292012-02-13 13:24:09 +0200310 struct usb_phy phy;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530311 struct msm_otg_platform_data *pdata;
312 int irq;
Flemmard77ad3212013-02-12 16:25:42 +0100313#ifndef CONFIG_MACH_HTC
Manu Gautamf8c45642012-08-10 10:20:56 -0700314 int async_irq;
Flemmard77ad3212013-02-12 16:25:42 +0100315#endif
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530316 struct clk *clk;
317 struct clk *pclk;
318 struct clk *phy_reset_clk;
319 struct clk *core_clk;
320 void __iomem *regs;
321#define ID 0
322#define B_SESS_VLD 1
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700323#define ID_A 2
324#define ID_B 3
325#define ID_C 4
Vijayavardhan Vennapusaa3152032012-03-05 16:29:30 +0530326#define A_BUS_DROP 5
327#define A_BUS_REQ 6
328#define A_SRP_DET 7
329#define A_VBUS_VLD 8
330#define B_CONN 9
331#define ADP_CHANGE 10
332#define POWER_UP 11
333#define A_CLR_ERR 12
334#define A_BUS_RESUME 13
335#define A_BUS_SUSPEND 14
336#define A_CONN 15
337#define B_BUS_REQ 16
Flemmard77ad3212013-02-12 16:25:42 +0100338#ifndef CONFIG_MACH_HTC
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530339#define MHL 17
Flemmard77ad3212013-02-12 16:25:42 +0100340#endif
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530341 unsigned long inputs;
342 struct work_struct sm_work;
Jack Pham5ca279b2012-05-14 18:42:54 -0700343 bool sm_work_pending;
344 atomic_t pm_suspended;
Pavankumar Kondeti87c01042010-12-07 17:53:58 +0530345 atomic_t in_lpm;
346 int async_int;
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530347 unsigned cur_power;
348 struct delayed_work chg_work;
Vijayavardhan Vennapusa68d55cf2012-06-27 20:06:12 +0530349 struct delayed_work pmic_id_status_work;
Flemmard77ad3212013-02-12 16:25:42 +0100350#ifndef CONFIG_MACH_HTC
kibum.leeec040442012-08-22 22:29:46 +0900351 struct delayed_work check_ta_work;
Flemmard77ad3212013-02-12 16:25:42 +0100352#endif
Pavankumar Kondetid8608522011-05-04 10:19:47 +0530353 enum usb_chg_state chg_state;
354 enum usb_chg_type chg_type;
Pavankumar Kondeti39504502013-01-04 12:28:10 +0530355 unsigned dcd_time;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700356 struct wake_lock wlock;
Flemmard77ad3212013-02-12 16:25:42 +0100357#ifdef CONFIG_MACH_HTC
358 struct wake_lock usb_otg_wlock;
359 struct wake_lock cable_detect_wlock;
360#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700361 struct notifier_block usbdev_nb;
362 unsigned mA_port;
Pavankumar Kondetiaa449e12011-11-04 11:09:26 +0530363 struct timer_list id_timer;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700364 unsigned long caps;
Stephen Boyd30ad10b2012-03-01 14:51:04 -0800365 struct msm_xo_voter *xo_handle;
Manu Gautamcd82e9d2011-12-20 14:17:28 +0530366 uint32_t bus_perf_client;
Flemmard77ad3212013-02-12 16:25:42 +0100367#ifndef CONFIG_MACH_HTC
Pavankumar Kondeti2aec9f32012-06-13 09:06:03 +0530368 bool mhl_enabled;
Flemmard77ad3212013-02-12 16:25:42 +0100369#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700370 /*
371 * Allowing PHY power collpase turns off the HSUSB 3.3v and 1.8v
372 * analog regulators while going to low power mode.
373 * Currently only 8960(28nm PHY) has the support to allowing PHY
374 * power collapse since it doesn't have leakage currents while
375 * turning off the power rails.
376 */
377#define ALLOW_PHY_POWER_COLLAPSE BIT(0)
378 /*
379 * Allow PHY RETENTION mode before turning off the digital
380 * voltage regulator(VDDCX).
381 */
382#define ALLOW_PHY_RETENTION BIT(1)
Amit Blay6fa647a2012-05-24 14:12:08 +0300383 /*
384 * Allow putting the core in Low Power mode, when
385 * USB bus is suspended but cable is connected.
386 */
387#define ALLOW_LPM_ON_DEV_SUSPEND BIT(2)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700388 unsigned long lpm_flags;
389#define PHY_PWR_COLLAPSED BIT(0)
390#define PHY_RETENTIONED BIT(1)
Vijayavardhan Vennapusabbdd6082012-06-06 14:14:25 +0530391#define XO_SHUTDOWN BIT(2)
Flemmard77ad3212013-02-12 16:25:42 +0100392#ifndef CONFIG_MACH_HTC
Ido Shayevitzc5c0f572012-07-31 13:58:45 +0300393#define CLOCKS_DOWN BIT(3)
Flemmard77ad3212013-02-12 16:25:42 +0100394#endif
395#ifdef CONFIG_MACH_HTC
396 struct work_struct notifier_work;
397 enum usb_connect_type connect_type;
398 int connect_type_ready;
399 struct workqueue_struct *usb_wq;
400 struct delayed_work ac_detect_work;
401 int ac_detect_count;
402 int reset_phy_before_lpm;
403#endif
Ofir Cohen4da266f2012-01-03 10:19:29 +0200404 int reset_counter;
Vijayavardhan Vennapusaa3152032012-03-05 16:29:30 +0530405 unsigned long b_last_se0_sess;
406 unsigned long tmouts;
407 u8 active_tmout;
408 struct hrtimer timer;
Mayank Rana248698c2012-04-19 00:03:16 +0530409 enum usb_vdd_type vdd_type;
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530410};
411
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530412struct msm_hsic_host_platform_data {
413 unsigned strobe;
414 unsigned data;
Hemant Kumare6275972012-02-29 20:06:21 -0800415 struct msm_bus_scale_pdata *bus_scale_table;
Ajay Dudanic4e40db2012-08-20 14:44:40 -0700416 unsigned log2_irq_thresh;
Pavankumar Kondetife2d4d32012-09-07 15:33:09 +0530417 u32 swfi_latency;
Vijayavardhan Vennapusae3316a12011-10-15 06:05:17 +0530418};
419
Manu Gautam91223e02011-11-08 15:27:22 +0530420struct msm_usb_host_platform_data {
421 unsigned int power_budget;
Vijayavardhan Vennapusa4fa13692012-08-02 14:35:03 +0530422 int pmic_gpio_dp_irq;
Hemant Kumar56925352012-02-13 16:59:52 -0800423 unsigned int dock_connect_irq;
Manu Gautam91223e02011-11-08 15:27:22 +0530424};
425
Amit Blay9b6e58b2012-06-18 13:12:49 +0300426/**
427 * struct msm_hsic_peripheral_platform_data: HSIC peripheral
428 * platform data.
429 * @core_clk_always_on_workaround: Don't disable core_clk when
430 * HSIC enters LPM.
431 */
Amit Blay4d57d362012-04-28 11:00:21 +0300432struct msm_hsic_peripheral_platform_data {
Amit Blay9b6e58b2012-06-18 13:12:49 +0300433 bool core_clk_always_on_workaround;
Amit Blay4d57d362012-04-28 11:00:21 +0300434};
435
Shimrit Malichi255b5342012-08-02 21:01:43 +0300436/**
437 * struct usb_bam_pipe_connect: pipe connection information
438 * between USB/HSIC BAM and another BAM. USB/HSIC BAM can be
439 * either src BAM or dst BAM
440 * @src_phy_addr: src bam physical address.
441 * @src_pipe_index: src bam pipe index.
442 * @dst_phy_addr: dst bam physical address.
443 * @dst_pipe_index: dst bam pipe index.
444 * @data_fifo_base_offset: data fifo offset.
445 * @data_fifo_size: data fifo size.
446 * @desc_fifo_base_offset: descriptor fifo offset.
447 * @desc_fifo_size: descriptor fifo size.
448 */
Ofir Cohenc7827e42011-12-13 20:10:01 +0200449struct usb_bam_pipe_connect {
450 u32 src_phy_addr;
Shimrit Malichi255b5342012-08-02 21:01:43 +0300451 u32 src_pipe_index;
Ofir Cohenc7827e42011-12-13 20:10:01 +0200452 u32 dst_phy_addr;
Shimrit Malichi255b5342012-08-02 21:01:43 +0300453 u32 dst_pipe_index;
Ofir Cohenc7827e42011-12-13 20:10:01 +0200454 u32 data_fifo_base_offset;
455 u32 data_fifo_size;
456 u32 desc_fifo_base_offset;
457 u32 desc_fifo_size;
458};
459
Shimrit Malichi255b5342012-08-02 21:01:43 +0300460/**
461 * struct msm_usb_bam_platform_data: pipe connection information
462 * between USB/HSIC BAM and another BAM. USB/HSIC BAM can be
463 * either src BAM or dst BAM
464 * @connections: holds all pipe connections data.
465 * @usb_active_bam: set USB or HSIC as the active BAM.
466 * @usb_bam_num_pipes: max number of pipes to use.
467 * @active_conn_num: number of active pipe connections.
468 * @usb_base_address: BAM physical address.
469 */
Ofir Cohenc7827e42011-12-13 20:10:01 +0200470struct msm_usb_bam_platform_data {
471 struct usb_bam_pipe_connect *connections;
Ofir Cohen010009b2012-01-26 16:49:17 +0200472 int usb_active_bam;
Ofir Cohenc7827e42011-12-13 20:10:01 +0200473 int usb_bam_num_pipes;
Shimrit Malichi255b5342012-08-02 21:01:43 +0300474 u32 total_bam_num;
475 u32 usb_base_address;
Ofir Cohenc7827e42011-12-13 20:10:01 +0200476};
Ofir Cohen010009b2012-01-26 16:49:17 +0200477
478enum usb_bam {
479 HSUSB_BAM = 0,
480 HSIC_BAM,
481};
Ido Shayevitzd1cb16c2012-03-28 18:57:47 +0200482
Shimrit Malichi255b5342012-08-02 21:01:43 +0300483#ifdef CONFIG_USB_DWC3_MSM
Ido Shayevitz9fb83452012-04-01 17:45:58 +0300484int msm_ep_config(struct usb_ep *ep);
485int msm_ep_unconfig(struct usb_ep *ep);
Shimrit Malichi255b5342012-08-02 21:01:43 +0300486int msm_data_fifo_config(struct usb_ep *ep, u32 addr, u32 size,
487 u8 dst_pipe_idx);
Ido Shayevitz9fb83452012-04-01 17:45:58 +0300488
Shimrit Malichi255b5342012-08-02 21:01:43 +0300489#else
490static inline int msm_data_fifo_config(struct usb_ep *ep, u32 addr, u32 size,
491 u8 dst_pipe_idx)
492{
493 return -ENODEV;
494}
495
496static inline int msm_ep_config(struct usb_ep *ep)
497{
498 return -ENODEV;
499}
500
501static inline int msm_ep_unconfig(struct usb_ep *ep)
502{
503 return -ENODEV;
504}
505#endif
Pavankumar Kondetie0c201f2010-12-07 17:53:55 +0530506#endif