msm_hsusb.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. /* include/linux/usb/msm_hsusb.h
  2. *
  3. * Copyright (C) 2008 Google, Inc.
  4. * Author: Brian Swetland <swetland@google.com>
  5. * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
  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. #ifndef __ASM_ARCH_MSM_HSUSB_H
  18. #define __ASM_ARCH_MSM_HSUSB_H
  19. #include <linux/types.h>
  20. #include <linux/usb/ch9.h>
  21. #include <linux/usb/gadget.h>
  22. #include <linux/usb/otg.h>
  23. #include <linux/wakelock.h>
  24. #include <linux/pm_qos.h>
  25. #include <linux/hrtimer.h>
  26. #ifdef CONFIG_USB_HOST_NOTIFY
  27. #include <linux/host_notify.h>
  28. #endif
  29. #include <linux/power_supply.h>
  30. #include <linux/cdev.h>
  31. /*
  32. * The following are bit fields describing the usb_request.udc_priv word.
  33. * These bit fields are set by function drivers that wish to queue
  34. * usb_requests with sps/bam parameters.
  35. */
  36. #define MSM_PIPE_ID_MASK (0x1F)
  37. #define MSM_TX_PIPE_ID_OFS (16)
  38. #define MSM_SPS_MODE BIT(5)
  39. #define MSM_IS_FINITE_TRANSFER BIT(6)
  40. #define MSM_PRODUCER BIT(7)
  41. #define MSM_DISABLE_WB BIT(8)
  42. #define MSM_ETD_IOC BIT(9)
  43. #define MSM_INTERNAL_MEM BIT(10)
  44. #define MSM_VENDOR_ID BIT(16)
  45. /**
  46. * Requested USB votes for BUS bandwidth
  47. *
  48. * USB_NO_PERF_VOTE BUS Vote for inactive USB session or disconnect
  49. * USB_MAX_PERF_VOTE Maximum BUS bandwidth vote
  50. * USB_MIN_PERF_VOTE Minimum BUS bandwidth vote (for some hw same as NO_PERF)
  51. *
  52. */
  53. enum usb_bus_vote {
  54. USB_NO_PERF_VOTE = 0,
  55. USB_MAX_PERF_VOTE,
  56. USB_MIN_PERF_VOTE,
  57. };
  58. /**
  59. * Supported USB modes
  60. *
  61. * USB_PERIPHERAL Only peripheral mode is supported.
  62. * USB_HOST Only host mode is supported.
  63. * USB_OTG OTG mode is supported.
  64. *
  65. */
  66. enum usb_mode_type {
  67. USB_NONE = 0,
  68. USB_PERIPHERAL,
  69. USB_HOST,
  70. USB_OTG,
  71. };
  72. /**
  73. * OTG control
  74. *
  75. * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
  76. * only configuration.
  77. * OTG_PHY_CONTROL Id/VBUS notifications comes form USB PHY.
  78. * OTG_PMIC_CONTROL Id/VBUS notifications comes from PMIC hardware.
  79. * OTG_USER_CONTROL Id/VBUS notifcations comes from User via sysfs.
  80. *
  81. */
  82. enum otg_control_type {
  83. OTG_NO_CONTROL = 0,
  84. OTG_PHY_CONTROL,
  85. OTG_PMIC_CONTROL,
  86. OTG_USER_CONTROL,
  87. };
  88. /**
  89. * PHY used in
  90. *
  91. * INVALID_PHY Unsupported PHY
  92. * CI_45NM_INTEGRATED_PHY Chipidea 45nm integrated PHY
  93. * SNPS_28NM_INTEGRATED_PHY Synopsis 28nm integrated PHY
  94. *
  95. */
  96. enum msm_usb_phy_type {
  97. INVALID_PHY = 0,
  98. CI_45NM_INTEGRATED_PHY,
  99. SNPS_28NM_INTEGRATED_PHY,
  100. };
  101. #define IDEV_CHG_MAX 1500
  102. #define IDEV_CHG_MIN 500
  103. #define IUNIT 100
  104. #define IDEV_ACA_CHG_MAX 1500
  105. #define IDEV_ACA_CHG_LIMIT 500
  106. /**
  107. * Different states involved in USB charger detection.
  108. *
  109. * USB_CHG_STATE_UNDEFINED USB charger is not connected or detection
  110. * process is not yet started.
  111. * USB_CHG_STATE_WAIT_FOR_DCD Waiting for Data pins contact.
  112. * USB_CHG_STATE_DCD_DONE Data pin contact is detected.
  113. * USB_CHG_STATE_PRIMARY_DONE Primary detection is completed (Detects
  114. * between SDP and DCP/CDP).
  115. * USB_CHG_STATE_SECONDARY_DONE Secondary detection is completed (Detects
  116. * between DCP and CDP).
  117. * USB_CHG_STATE_DETECTED USB charger type is determined.
  118. *
  119. */
  120. enum usb_chg_state {
  121. USB_CHG_STATE_UNDEFINED = 0,
  122. USB_CHG_STATE_WAIT_FOR_DCD,
  123. USB_CHG_STATE_DCD_DONE,
  124. USB_CHG_STATE_PRIMARY_DONE,
  125. USB_CHG_STATE_SECONDARY_DONE,
  126. USB_CHG_STATE_DETECTED,
  127. };
  128. /**
  129. * USB charger types
  130. *
  131. * USB_INVALID_CHARGER Invalid USB charger.
  132. * USB_SDP_CHARGER Standard downstream port. Refers to a downstream port
  133. * on USB2.0 compliant host/hub.
  134. * USB_DCP_CHARGER Dedicated charger port (AC charger/ Wall charger).
  135. * USB_CDP_CHARGER Charging downstream port. Enumeration can happen and
  136. * IDEV_CHG_MAX can be drawn irrespective of USB state.
  137. * USB_ACA_A_CHARGER B-device is connected on accessory port with charger
  138. * connected on charging port. This configuration allows
  139. * charging in host mode.
  140. * USB_ACA_B_CHARGER No device (or A-device without VBUS) is connected on
  141. * accessory port with charger connected on charging port.
  142. * USB_ACA_C_CHARGER A-device (with VBUS) is connected on
  143. * accessory port with charger connected on charging port.
  144. * USB_ACA_DOCK_CHARGER A docking station that has one upstream port and one
  145. * or more downstream ports. Capable of supplying
  146. * IDEV_CHG_MAX irrespective of devices connected on
  147. * accessory ports.
  148. * USB_PROPRIETARY_CHARGER A proprietary charger pull DP and DM to specific
  149. * voltages between 2.0-3.3v for identification.
  150. *
  151. */
  152. enum usb_chg_type {
  153. USB_INVALID_CHARGER = 0,
  154. USB_SDP_CHARGER,
  155. USB_DCP_CHARGER,
  156. USB_CDP_CHARGER,
  157. USB_ACA_A_CHARGER,
  158. USB_ACA_B_CHARGER,
  159. USB_ACA_C_CHARGER,
  160. USB_ACA_DOCK_CHARGER,
  161. USB_PROPRIETARY_CHARGER,
  162. USB_FLOATED_CHARGER,
  163. };
  164. /**
  165. * Used different VDDCX voltage voting mechnism
  166. * VDDCX_CORNER Vote for VDDCX Corner voltage
  167. * VDDCX Vote for VDDCX Absolute voltage
  168. */
  169. enum usb_vdd_type {
  170. VDDCX_CORNER = 0,
  171. VDDCX,
  172. VDD_TYPE_MAX,
  173. };
  174. /**
  175. * Used different VDDCX voltage values
  176. */
  177. enum usb_vdd_value {
  178. VDD_NONE = 0,
  179. VDD_MIN,
  180. VDD_MAX,
  181. VDD_VAL_MAX,
  182. };
  183. /**
  184. * Maintain state for hvdcp external charger status
  185. * DEFAULT This is used when DCP is detected
  186. * ACTIVE This is used when ioctl is called to block LPM
  187. * INACTIVE This is used when ioctl is called to unblock LPM
  188. */
  189. enum usb_ext_chg_status {
  190. DEFAULT = 1,
  191. ACTIVE,
  192. INACTIVE,
  193. };
  194. /**
  195. * struct msm_otg_platform_data - platform device data
  196. * for msm_otg driver.
  197. * @phy_init_seq: PHY configuration sequence. val, reg pairs
  198. * terminated by -1.
  199. * @vbus_power: VBUS power on/off routine.It should return result
  200. * as success(zero value) or failure(non-zero value).
  201. * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
  202. * @mode: Supported mode (OTG/peripheral/host).
  203. * @otg_control: OTG switch controlled by user/Id pin
  204. * @default_mode: Default operational mode. Applicable only if
  205. * OTG switch is controller by user.
  206. * @pmic_id_irq: IRQ number assigned for PMIC USB ID line.
  207. * @mpm_otgsessvld_int: MPM wakeup pin assigned for OTG SESSVLD
  208. * interrupt. Used when .otg_control == OTG_PHY_CONTROL.
  209. * @mpm_dpshv_int: MPM wakeup pin assigned for DP SHV interrupt.
  210. * Used during host bus suspend.
  211. * @mpm_dmshv_int: MPM wakeup pin assigned for DM SHV interrupt.
  212. * Used during host bus suspend.
  213. * @mhl_enable: indicates MHL connector or not.
  214. * @disable_reset_on_disconnect: perform USB PHY and LINK reset
  215. * on USB cable disconnection.
  216. * @pnoc_errata_fix: workaround needed for PNOC hardware bug that
  217. * affects USB performance.
  218. * @enable_lpm_on_suspend: Enable the USB core to go into Low
  219. * Power Mode, when USB bus is suspended but cable
  220. * is connected.
  221. * @core_clk_always_on_workaround: Don't disable core_clk when
  222. * USB enters LPM.
  223. * @delay_lpm_on_disconnect: Use a delay before entering LPM
  224. * upon USB cable disconnection.
  225. * @enable_sec_phy: Use second HSPHY with USB2 core
  226. * @bus_scale_table: parameters for bus bandwidth requirements
  227. * @mhl_dev_name: MHL device name used to register with MHL driver.
  228. * @log2_itc: value of 2^(log2_itc-1) will be used as the
  229. * interrupt threshold (ITC), when log2_itc is
  230. * between 1 to 7.
  231. * @l1_supported: enable link power management support.
  232. * @dpdm_pulldown_added: Indicates whether pull down resistors are
  233. * connected on data lines or not.
  234. * @enable_ahb2ahb_bypass: Indicates whether enable AHB2AHB BYPASS
  235. * mode with controller in device mode.
  236. * @disable_retention_with_vdd_min: Indicates whether to enable allowing
  237. * VDD min without putting PHY into retention
  238. */
  239. struct msm_otg_platform_data {
  240. int *phy_init_seq;
  241. int (*vbus_power)(bool on);
  242. unsigned power_budget;
  243. enum usb_mode_type mode;
  244. enum otg_control_type otg_control;
  245. enum usb_mode_type default_mode;
  246. enum msm_usb_phy_type phy_type;
  247. void (*setup_gpio)(enum usb_otg_state state);
  248. int pmic_id_irq;
  249. unsigned int mpm_otgsessvld_int;
  250. unsigned int mpm_dpshv_int;
  251. unsigned int mpm_dmshv_int;
  252. bool mhl_enable;
  253. bool disable_reset_on_disconnect;
  254. #ifdef CONFIG_USB_HOST_NOTIFY
  255. int ovp_ctrl_gpio;
  256. #endif
  257. bool pnoc_errata_fix;
  258. bool enable_lpm_on_dev_suspend;
  259. bool core_clk_always_on_workaround;
  260. bool delay_lpm_on_disconnect;
  261. bool delay_lpm_hndshk_on_disconnect;
  262. bool dp_manual_pullup;
  263. bool enable_sec_phy;
  264. struct msm_bus_scale_pdata *bus_scale_table;
  265. const char *mhl_dev_name;
  266. int log2_itc;
  267. bool l1_supported;
  268. bool dpdm_pulldown_added;
  269. bool enable_ahb2ahb_bypass;
  270. bool disable_retention_with_vdd_min;
  271. };
  272. /* phy related flags */
  273. #define ENABLE_DP_MANUAL_PULLUP BIT(0)
  274. #define ENABLE_SECONDARY_PHY BIT(1)
  275. /* Timeout (in msec) values (min - max) associated with OTG timers */
  276. #define TA_WAIT_VRISE 100 /* ( - 100) */
  277. #define TA_WAIT_VFALL 500 /* ( - 1000) */
  278. /*
  279. * This option is set for embedded hosts or OTG devices in which leakage
  280. * currents are very minimal.
  281. */
  282. #ifdef CONFIG_USB_OTG
  283. #define TA_WAIT_BCON 30000 /* (1100 - 30000) */
  284. #else
  285. #define TA_WAIT_BCON -1
  286. #endif
  287. #define TA_AIDL_BDIS 500 /* (200 - ) */
  288. #define TA_BIDL_ADIS 155 /* (155 - 200) */
  289. #define TB_SRP_FAIL 6000 /* (5000 - 6000) */
  290. #define TB_ASE0_BRST 200 /* (155 - ) */
  291. /* TB_SSEND_SRP and TB_SE0_SRP are combined */
  292. #define TB_SRP_INIT 2000 /* (1500 - ) */
  293. #define TA_TST_MAINT 10100 /* (9900 - 10100) */
  294. #define TB_TST_SRP 3000 /* ( - 5000) */
  295. #define TB_TST_CONFIG 300
  296. /* Timeout variables */
  297. #define A_WAIT_VRISE 0
  298. #define A_WAIT_VFALL 1
  299. #define A_WAIT_BCON 2
  300. #define A_AIDL_BDIS 3
  301. #define A_BIDL_ADIS 4
  302. #define B_SRP_FAIL 5
  303. #define B_ASE0_BRST 6
  304. #define A_TST_MAINT 7
  305. #define B_TST_SRP 8
  306. #define B_TST_CONFIG 9
  307. /**
  308. * struct msm_otg: OTG driver data. Shared by HCD and DCD.
  309. * @otg: USB OTG Transceiver structure.
  310. * @pdata: otg device platform data.
  311. * @irq: IRQ number assigned for HSUSB controller.
  312. * @async_irq: IRQ number used by some controllers during low power state
  313. * @clk: clock struct of alt_core_clk.
  314. * @pclk: clock struct of iface_clk.
  315. * @core_clk: clock struct of core_bus_clk.
  316. * @sleep_clk: clock struct of sleep_clk for USB PHY.
  317. * @core_clk_rate: core clk max frequency
  318. * @regs: ioremapped register base address.
  319. * @usb_phy_ctrl_reg: relevant PHY_CTRL_REG register base address.
  320. * @inputs: OTG state machine inputs(Id, SessValid etc).
  321. * @sm_work: OTG state machine work.
  322. * @pm_suspended: OTG device is system(PM) suspended.
  323. * @pm_notify: Notifier to receive system wide PM transition events.
  324. It is used to defer wakeup events processing until
  325. system is RESUMED.
  326. * @in_lpm: indicates low power mode (LPM) state.
  327. * @async_int: IRQ line on which ASYNC interrupt arrived in LPM.
  328. * @cur_power: The amount of mA available from downstream port.
  329. * @chg_work: Charger detection work.
  330. * @chg_state: The state of charger detection process.
  331. * @chg_type: The type of charger attached.
  332. * @dcd_retires: The retry count used to track Data contact
  333. * detection process.
  334. * @wlock: Wake lock struct to prevent system suspend when
  335. * USB is active.
  336. * @usbdev_nb: The notifier block used to know about the B-device
  337. * connected. Useful only when ACA_A charger is
  338. * connected.
  339. * @mA_port: The amount of current drawn by the attached B-device.
  340. * @id_timer: The timer used for polling ID line to detect ACA states.
  341. * @xo_handle: TCXO buffer handle
  342. * @bus_perf_client: Bus performance client handle to request BUS bandwidth
  343. * @mhl_enabled: MHL driver registration successful and MHL enabled.
  344. * @host_bus_suspend: indicates host bus suspend or not.
  345. * @chg_check_timer: The timer used to implement the workaround to detect
  346. * very slow plug in of wall charger.
  347. * @ui_enabled: USB Intterupt is enabled or disabled.
  348. * @pm_done: It is used to increment the pm counter using pm_runtime_get_sync.
  349. This handles the race case when PM resume thread returns before
  350. the charger detection starts. When USB is disconnected pm_done
  351. is set to true.
  352. */
  353. struct msm_otg {
  354. struct usb_phy phy;
  355. struct msm_otg_platform_data *pdata;
  356. int irq;
  357. int async_irq;
  358. struct clk *xo_clk;
  359. struct clk *clk;
  360. struct clk *pclk;
  361. struct clk *core_clk;
  362. struct clk *sleep_clk;
  363. long core_clk_rate;
  364. struct resource *io_res;
  365. void __iomem *regs;
  366. void __iomem *usb_phy_ctrl_reg;
  367. #define ID 0
  368. #define B_SESS_VLD 1
  369. #define ID_A 2
  370. #define ID_B 3
  371. #define ID_C 4
  372. #define A_BUS_DROP 5
  373. #define A_BUS_REQ 6
  374. #define A_SRP_DET 7
  375. #define A_VBUS_VLD 8
  376. #define B_CONN 9
  377. #define ADP_CHANGE 10
  378. #define POWER_UP 11
  379. #define A_CLR_ERR 12
  380. #define A_BUS_RESUME 13
  381. #define A_BUS_SUSPEND 14
  382. #define A_CONN 15
  383. #define B_BUS_REQ 16
  384. #define MHL 17
  385. #define B_FALSE_SDP 18
  386. unsigned long inputs;
  387. struct work_struct sm_work;
  388. bool sm_work_pending;
  389. atomic_t pm_suspended;
  390. struct notifier_block pm_notify;
  391. atomic_t in_lpm;
  392. int async_int;
  393. unsigned cur_power;
  394. struct delayed_work chg_work;
  395. struct delayed_work pmic_id_status_work;
  396. struct delayed_work suspend_work;
  397. enum usb_chg_state chg_state;
  398. enum usb_chg_type chg_type;
  399. unsigned dcd_time;
  400. struct wake_lock wlock;
  401. struct notifier_block usbdev_nb;
  402. unsigned mA_port;
  403. struct timer_list id_timer;
  404. unsigned long caps;
  405. #ifdef CONFIG_USB_HOST_NOTIFY
  406. struct delayed_work late_power_work;
  407. int smartdock;
  408. #endif
  409. struct msm_xo_voter *xo_handle;
  410. uint32_t bus_perf_client;
  411. bool mhl_enabled;
  412. bool host_bus_suspend;
  413. struct timer_list chg_check_timer;
  414. /*
  415. * Allowing PHY power collpase turns off the HSUSB 3.3v and 1.8v
  416. * analog regulators while going to low power mode.
  417. * Currently only 28nm PHY has the support to allowing PHY
  418. * power collapse since it doesn't have leakage currents while
  419. * turning off the power rails.
  420. */
  421. #define ALLOW_PHY_POWER_COLLAPSE BIT(0)
  422. /*
  423. * Allow PHY RETENTION mode before turning off the digital
  424. * voltage regulator(VDDCX).
  425. */
  426. #define ALLOW_PHY_RETENTION BIT(1)
  427. /*
  428. * Allow putting the core in Low Power mode, when
  429. * USB bus is suspended but cable is connected.
  430. */
  431. #define ALLOW_LPM_ON_DEV_SUSPEND BIT(2)
  432. /*
  433. * Allowing PHY regulators LPM puts the HSUSB 3.3v and 1.8v
  434. * analog regulators into LPM while going to USB low power mode.
  435. */
  436. #define ALLOW_PHY_REGULATORS_LPM BIT(3)
  437. /*
  438. * Allow PHY RETENTION mode before turning off the digital
  439. * voltage regulator(VDDCX) during host mode.
  440. */
  441. #define ALLOW_HOST_PHY_RETENTION BIT(4)
  442. /*
  443. * Allow VDD minimization without putting PHY into retention
  444. * for fixing PHY current leakage issue when LDOs are turned off.
  445. */
  446. #define ALLOW_VDD_MIN_WITH_RETENTION_DISABLED BIT(5)
  447. unsigned long lpm_flags;
  448. #define PHY_PWR_COLLAPSED BIT(0)
  449. #define PHY_RETENTIONED BIT(1)
  450. #define XO_SHUTDOWN BIT(2)
  451. #define CLOCKS_DOWN BIT(3)
  452. #define PHY_REGULATORS_LPM BIT(4)
  453. int reset_counter;
  454. unsigned long b_last_se0_sess;
  455. unsigned long tmouts;
  456. u8 active_tmout;
  457. struct hrtimer timer;
  458. enum usb_vdd_type vdd_type;
  459. struct power_supply usb_psy;
  460. unsigned int online;
  461. unsigned int host_mode;
  462. unsigned int voltage_max;
  463. unsigned int current_max;
  464. unsigned int usbin_health;
  465. dev_t ext_chg_dev;
  466. struct cdev ext_chg_cdev;
  467. struct class *ext_chg_class;
  468. struct device *ext_chg_device;
  469. bool ext_chg_opened;
  470. enum usb_ext_chg_status ext_chg_active;
  471. struct completion ext_chg_wait;
  472. int ui_enabled;
  473. bool pm_done;
  474. struct qpnp_vadc_chip *vadc_dev;
  475. };
  476. struct ci13xxx_platform_data {
  477. u8 usb_core_id;
  478. /*
  479. * value of 2^(log2_itc-1) will be used as the interrupt threshold
  480. * (ITC), when log2_itc is between 1 to 7.
  481. */
  482. int log2_itc;
  483. void *prv_data;
  484. bool l1_supported;
  485. bool enable_ahb2ahb_bypass;
  486. };
  487. /**
  488. * struct msm_hsic_host_platform_data - platform device data
  489. * for msm_hsic_host driver.
  490. * @phy_sof_workaround: Enable ALL PHY SOF bug related workarounds for
  491. SUSPEND, RESET and RESUME.
  492. * @phy_susp_sof_workaround: Enable PHY SOF workaround only for SUSPEND.
  493. *
  494. */
  495. struct msm_hsic_host_platform_data {
  496. unsigned strobe;
  497. unsigned data;
  498. bool ignore_cal_pad_config;
  499. bool phy_sof_workaround;
  500. bool phy_susp_sof_workaround;
  501. u32 reset_delay;
  502. int strobe_pad_offset;
  503. int data_pad_offset;
  504. struct msm_bus_scale_pdata *bus_scale_table;
  505. unsigned log2_irq_thresh;
  506. /* gpio used to resume peripheral */
  507. unsigned resume_gpio;
  508. /*swfi latency is required while driving resume on to the bus */
  509. u32 swfi_latency;
  510. /*standalone latency is required when HSCI is active*/
  511. u32 standalone_latency;
  512. bool pool_64_bit_align;
  513. bool enable_hbm;
  514. bool disable_park_mode;
  515. bool consider_ipa_handshake;
  516. bool ahb_async_bridge_bypass;
  517. bool disable_cerr;
  518. };
  519. struct msm_usb_host_platform_data {
  520. unsigned int power_budget;
  521. int pmic_gpio_dp_irq;
  522. unsigned int dock_connect_irq;
  523. bool use_sec_phy;
  524. bool no_selective_suspend;
  525. int resume_gpio;
  526. bool is_uicc;
  527. };
  528. /**
  529. * struct msm_hsic_peripheral_platform_data: HSIC peripheral
  530. * platform data.
  531. * @core_clk_always_on_workaround: Don't disable core_clk when
  532. * HSIC enters LPM.
  533. */
  534. struct msm_hsic_peripheral_platform_data {
  535. bool core_clk_always_on_workaround;
  536. };
  537. /**
  538. * struct usb_ext_notification: event notification structure
  539. * @notify: pointer to client function to call when ID event is detected.
  540. * The function parameter is provided by driver to be called back when
  541. * external client indicates it is done using the USB. This function
  542. * should return 0 if handled successfully, otherise an error code.
  543. * @ctxt: client-specific context pointer
  544. *
  545. * This structure should be used by clients wishing to register (via
  546. * msm_register_usb_ext_notification) for event notification whenever a USB
  547. * cable is plugged in and ID pin status changes. Clients must provide a
  548. * callback function pointer. If this callback returns 0, the USB driver will
  549. * assume the client is "taking over" the connection, and will relinquish any
  550. * further processing until its callback (passed via the third parameter) is
  551. * called with the online parameter set to false.
  552. */
  553. struct usb_ext_notification {
  554. int (*notify)(void *, int, void (*)(void *, int online), void *);
  555. void *ctxt;
  556. };
  557. #ifdef CONFIG_USB_BAM
  558. bool msm_bam_lpm_ok(void);
  559. void msm_bam_notify_lpm_resume(void);
  560. void msm_bam_set_hsic_host_dev(struct device *dev);
  561. void msm_bam_wait_for_hsic_prod_granted(void);
  562. bool msm_bam_hsic_lpm_ok(void);
  563. void msm_bam_hsic_notify_on_resume(void);
  564. #else
  565. static inline bool msm_bam_lpm_ok(void) { return true; }
  566. static inline void msm_bam_notify_lpm_resume(void) {}
  567. static inline void msm_bam_set_hsic_host_dev(struct device *dev) {}
  568. static inline void msm_bam_wait_for_hsic_prod_granted(void) {}
  569. static inline bool msm_bam_hsic_lpm_ok(void) { return true; }
  570. static inline void msm_bam_hsic_notify_on_resume(void) {}
  571. #endif
  572. #ifdef CONFIG_USB_CI13XXX_MSM
  573. void msm_hw_bam_disable(bool bam_disable);
  574. #else
  575. static inline void msm_hw_bam_disable(bool bam_disable)
  576. {
  577. }
  578. #endif
  579. #ifdef CONFIG_USB_DWC3_MSM
  580. int msm_ep_config(struct usb_ep *ep);
  581. int msm_ep_unconfig(struct usb_ep *ep);
  582. void dwc3_tx_fifo_resize_request(struct usb_ep *ep, bool qdss_enable);
  583. int msm_data_fifo_config(struct usb_ep *ep, u32 addr, u32 size,
  584. u8 dst_pipe_idx);
  585. void msm_dwc3_restart_usb_session(struct usb_gadget *gadget);
  586. int msm_register_usb_ext_notification(struct usb_ext_notification *info);
  587. #else
  588. static inline int msm_data_fifo_config(struct usb_ep *ep, u32 addr, u32 size,
  589. u8 dst_pipe_idx)
  590. {
  591. return -ENODEV;
  592. }
  593. static inline int msm_ep_config(struct usb_ep *ep)
  594. {
  595. return -ENODEV;
  596. }
  597. static inline int msm_ep_unconfig(struct usb_ep *ep)
  598. {
  599. return -ENODEV;
  600. }
  601. static inline void dwc3_tx_fifo_resize_request(
  602. struct usb_ep *ep, bool qdss_enable)
  603. {
  604. return;
  605. }
  606. static inline void msm_dwc3_restart_usb_session(struct usb_gadget *gadget)
  607. {
  608. return;
  609. }
  610. static inline int msm_register_usb_ext_notification(
  611. struct usb_ext_notification *info)
  612. {
  613. return -ENODEV;
  614. }
  615. #endif
  616. #endif