mhi_misc.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */
  3. #ifndef _MHI_MISC_H_
  4. #define _MHI_MISC_H_
  5. #include <linux/mhi.h>
  6. #include <linux/ipc_logging.h>
  7. /**
  8. * enum MHI_DEBUG_LEVEL - various debugging levels
  9. */
  10. enum MHI_DEBUG_LEVEL {
  11. MHI_MSG_LVL_VERBOSE,
  12. MHI_MSG_LVL_INFO,
  13. MHI_MSG_LVL_ERROR,
  14. MHI_MSG_LVL_CRITICAL,
  15. MHI_MSG_LVL_MASK_ALL,
  16. MHI_MSG_LVL_MAX,
  17. };
  18. /**
  19. * struct mhi_buf - MHI Buffer description
  20. * @node: list entry point
  21. * @buf: Virtual address of the buffer
  22. * @name: Buffer label. For offload channel, configurations name must be:
  23. * ECA - Event context array data
  24. * CCA - Channel context array data
  25. * @dma_addr: IOMMU address of the buffer
  26. * @phys_addr: physical address of the buffer
  27. * @len: # of bytes
  28. * @is_io: buffer is of IO/registesr type (resource) rather than of DDR/RAM type
  29. */
  30. struct mhi_buf_extended {
  31. struct list_head node;
  32. void *buf;
  33. const char *name;
  34. dma_addr_t dma_addr;
  35. phys_addr_t phys_addr;
  36. size_t len;
  37. bool is_io;
  38. };
  39. #ifdef CONFIG_MHI_BUS_MISC
  40. /**
  41. * mhi_report_error - Can be used by controller to signal error condition to the
  42. * MHI core driver in case of any need to halt processing or incoming sideband
  43. * signal detects an error on endpoint
  44. * @mhi_cntrl: MHI controller
  45. *
  46. * Returns:
  47. * 0 if success in reporting the error condition to MHI core
  48. * error code on failure
  49. */
  50. int mhi_report_error(struct mhi_controller *mhi_cntrl);
  51. /**
  52. * mhi_controller_set_privdata - Set private data for MHI controller
  53. * @mhi_cntrl: MHI controller
  54. * @priv: pointer to data
  55. */
  56. void mhi_controller_set_privdata(struct mhi_controller *mhi_cntrl, void *priv);
  57. /**
  58. * mhi_controller_get_privdata - Get private data from MHI controller
  59. * @mhi_cntrl: MHI controller
  60. */
  61. void *mhi_controller_get_privdata(struct mhi_controller *mhi_cntrl);
  62. /**
  63. * mhi_bdf_to_controller - Get controller associated with given BDF values
  64. * @domain: Domain or root complex of PCIe port
  65. * @bus: Bus number
  66. * @slot: PCI slot or function number
  67. * @dev_id: Device ID of the endpoint
  68. *
  69. * Returns:
  70. * MHI controller structure pointer if BDF match is found
  71. * NULL if cookie is not found
  72. */
  73. struct mhi_controller *mhi_bdf_to_controller(u32 domain, u32 bus, u32 slot, u32 dev_id);
  74. /**
  75. * mhi_set_m2_timeout_ms - Set M2 timeout in milliseconds to wait before a
  76. * fast/silent suspend
  77. * @mhi_cntrl: MHI controller
  78. * @timeout: timeout in ms
  79. */
  80. void mhi_set_m2_timeout_ms(struct mhi_controller *mhi_cntrl, u32 timeout);
  81. /**
  82. * mhi_pm_fast_resume - Resume MHI from a fast/silent suspended state
  83. * @mhi_cntrl: MHI controller
  84. * @notify_clients: if true, clients will be notified of the resume transition
  85. */
  86. int mhi_pm_fast_resume(struct mhi_controller *mhi_cntrl, bool notify_clients);
  87. /**
  88. * mhi_pm_fast_suspend - Move MHI into a fast/silent suspended state
  89. * @mhi_cntrl: MHI controller
  90. * @notify_clients: if true, clients will be notified of the suspend transition
  91. */
  92. int mhi_pm_fast_suspend(struct mhi_controller *mhi_cntrl, bool notify_clients);
  93. /**
  94. * mhi_debug_reg_dump - dump MHI registers for debug purpose
  95. * @mhi_cntrl: MHI controller
  96. */
  97. void mhi_debug_reg_dump(struct mhi_controller *mhi_cntrl);
  98. /**
  99. * mhi_dump_sfr - Print SFR string from RDDM table.
  100. * @mhi_cntrl: MHI controller
  101. */
  102. void mhi_dump_sfr(struct mhi_controller *mhi_cntrl);
  103. /**
  104. * mhi_device_configure - Allow devices with offload channels to setup their own
  105. * channel and event ring context.
  106. * @mhi_dev: MHI device
  107. * @dir: direction associated with the channel needed to configure
  108. * @cfg_tbl: Buffer with ECA/CCA information and data needed to setup context
  109. * @elements: Number of items to iterate over from the configuration table
  110. */
  111. int mhi_device_configure(struct mhi_device *mhi_dev,
  112. enum dma_data_direction dir,
  113. struct mhi_buf *cfg_tbl,
  114. int elements);
  115. /**
  116. * mhi_scan_rddm_cookie - Look for supplied cookie value in the BHI debug
  117. * registers set by device to indicate rddm readiness for debugging purposes.
  118. * @mhi_cntrl: MHI controller
  119. * @cookie: cookie/pattern value to match
  120. *
  121. * Returns:
  122. * true if cookie is found
  123. * false if cookie is not found
  124. */
  125. bool mhi_scan_rddm_cookie(struct mhi_controller *mhi_cntrl, u32 cookie);
  126. /**
  127. * mhi_device_get_sync_atomic - Asserts device_wait and moves device to M0
  128. * @mhi_dev: Device associated with the channels
  129. * @timeout_us: timeout, in micro-seconds
  130. * @in_panic: If requested while kernel is in panic state and no ISRs expected
  131. *
  132. * The device_wake is asserted to keep device in M0 or bring it to M0.
  133. * If device is not in M0 state, then this function will wait for device to
  134. * move to M0, until @timeout_us elapses.
  135. * However, if device's M1 state-change event races with this function
  136. * then there is a possiblity of device moving from M0 to M2 and back
  137. * to M0. That can't be avoided as host must transition device from M1 to M2
  138. * as per the spec.
  139. * Clients can ignore that transition after this function returns as the device
  140. * is expected to immediately move from M2 to M0 as wake is asserted and
  141. * wouldn't enter low power state.
  142. * If in_panic boolean is set, no ISRs are expected, hence this API will have to
  143. * resort to reading the MHI status register and poll on M0 state change.
  144. *
  145. * Returns:
  146. * 0 if operation was successful (however, M0 -> M2 -> M0 is possible later) as
  147. * mentioned above.
  148. * -ETIMEDOUT is device faled to move to M0 before @timeout_us elapsed
  149. * -EIO if the MHI state is one of the ERROR states.
  150. */
  151. int mhi_device_get_sync_atomic(struct mhi_device *mhi_dev, int timeout_us,
  152. bool in_panic);
  153. /**
  154. * mhi_controller_set_bw_scale_cb - Set the BW scale callback for MHI controller
  155. * @mhi_cntrl: MHI controller
  156. * @cb_func: Callback to set for the MHI controller to receive BW scale requests
  157. */
  158. void mhi_controller_set_bw_scale_cb(struct mhi_controller *mhi_cntrl,
  159. int (*cb_func)(struct mhi_controller *mhi_cntrl,
  160. struct mhi_link_info *link_info));
  161. /**
  162. * mhi_controller_set_base - Set the controller base / resource start address
  163. * @mhi_cntrl: MHI controller
  164. * @base: Physical address to be set for future reference
  165. */
  166. void mhi_controller_set_base(struct mhi_controller *mhi_cntrl,
  167. phys_addr_t base);
  168. /**
  169. * mhi_controller_get_base - Get the controller base / resource start address
  170. * @mhi_cntrl: MHI controller
  171. * @base: Pointer to physical address to be populated
  172. */
  173. int mhi_controller_get_base(struct mhi_controller *mhi_cntrl,
  174. phys_addr_t *base);
  175. /**
  176. * mhi_controller_get_numeric_id - set numeric ID for controller
  177. * @mhi_cntrl: MHI controller
  178. * returns value set as ID or 0 if no value was set
  179. */
  180. u32 mhi_controller_get_numeric_id(struct mhi_controller *mhi_cntrl);
  181. /**
  182. * mhi_get_channel_db_base - retrieve the channel doorbell base address
  183. * @mhi_dev: Device associated with the channels
  184. * @value: Pointer to an address value which will be populated
  185. */
  186. int mhi_get_channel_db_base(struct mhi_device *mhi_dev, phys_addr_t *value);
  187. /**
  188. * mhi_get_event_ring_db_base - retrieve the event ring doorbell base address
  189. * @mhi_dev: Device associated with the channels
  190. * @value: Pointer to an address value which will be populated
  191. */
  192. int mhi_get_event_ring_db_base(struct mhi_device *mhi_dev, phys_addr_t *value);
  193. /**
  194. * mhi_get_device_for_channel - get the MHI device for a specific channel number
  195. * @mhi_cntrl: MHI controller
  196. * @channel - channel number
  197. *
  198. * Returns:
  199. * Pointer to the MHI device associated with the channel
  200. */
  201. struct mhi_device *mhi_get_device_for_channel(struct mhi_controller *mhi_cntrl,
  202. u32 channel);
  203. /**
  204. * mhi_device_ioctl - user space IOCTL support for MHI channels
  205. * Native support for setting TIOCM
  206. * @mhi_dev: Device associated with the channels
  207. * @cmd: IOCTL cmd
  208. * @arg: Optional parameter, iotcl cmd specific
  209. */
  210. long mhi_device_ioctl(struct mhi_device *mhi_dev, unsigned int cmd,
  211. unsigned long arg);
  212. /**
  213. * mhi_controller_set_sfr_support - Set support for subsystem failure reason
  214. * @mhi_cntrl: MHI controller
  215. *
  216. * Returns:
  217. * 0 for success, error code for failure
  218. */
  219. int mhi_controller_set_sfr_support(struct mhi_controller *mhi_cntrl,
  220. size_t len);
  221. /**
  222. * mhi_controller_setup_timesync - Set support for time synchronization feature
  223. * @mhi_cntrl: MHI controller
  224. * @time_get: Callback to set for the MHI controller to receive host time
  225. * @lpm_disable: Callback to set for the MHI controller to disable link LPM
  226. * @lpm_enable: Callback to set for the MHI controller to enable link LPM
  227. *
  228. * Returns:
  229. * 0 for success, error code for failure
  230. */
  231. int mhi_controller_setup_timesync(struct mhi_controller *mhi_cntrl,
  232. u64 (*time_get)(struct mhi_controller *c),
  233. int (*lpm_disable)(struct mhi_controller *c),
  234. int (*lpm_enable)(struct mhi_controller *c));
  235. /**
  236. * mhi_get_remote_time_sync - Get external soc time relative to local soc time
  237. * using MMIO method.
  238. * @mhi_dev: Device associated with the channels
  239. * @t_host: Pointer to output local soc time
  240. * @t_dev: Pointer to output remote soc time
  241. *
  242. * Returns:
  243. * 0 for success, error code for failure
  244. */
  245. int mhi_get_remote_time_sync(struct mhi_device *mhi_dev,
  246. u64 *t_host,
  247. u64 *t_dev);
  248. /**
  249. * mhi_get_remote_time - Get external modem time relative to host time
  250. * Trigger event to capture modem time, also capture host time so client
  251. * can do a relative drift comparision.
  252. * Recommended only tsync device calls this method and do not call this
  253. * from atomic context
  254. * @mhi_dev: Device associated with the channels
  255. * @sequence:unique sequence id track event
  256. * @cb_func: callback function to call back
  257. *
  258. * Returns:
  259. * 0 for success, error code for failure
  260. */
  261. int mhi_get_remote_time(struct mhi_device *mhi_dev,
  262. u32 sequence,
  263. void (*cb_func)(struct mhi_device *mhi_dev,
  264. u32 sequence,
  265. u64 local_time,
  266. u64 remote_time));
  267. /**
  268. * mhi_force_reset - does host reset request to collect device side dumps
  269. * for debugging purpose
  270. * @mhi_cntrl: MHI controller
  271. */
  272. int mhi_force_reset(struct mhi_controller *mhi_cntrl);
  273. /**
  274. * mhi_controller_set_loglevel - API for controller to set a desired log level
  275. * which will be set to VERBOSE or 0 by default
  276. * @mhi_cntrl: MHI controller
  277. * @lvl: Log level from MHI_DEBUG_LEVEL enumerator
  278. */
  279. void mhi_controller_set_loglevel(struct mhi_controller *mhi_cntrl,
  280. enum MHI_DEBUG_LEVEL lvl);
  281. /**
  282. * mhi_get_soc_info - Get SoC info before registering mhi controller
  283. * @mhi_cntrl: MHI controller
  284. */
  285. int mhi_get_soc_info(struct mhi_controller *mhi_cntrl);
  286. /**
  287. * mhi_host_notify_db_disable_trace - Host notification to ring channel DB
  288. * to MHI device to stop tracing due SMMU fault
  289. * @mhi_cntrl: MHI controller
  290. */
  291. int mhi_host_notify_db_disable_trace(struct mhi_controller *mhi_cntrl);
  292. #else
  293. /**
  294. * mhi_report_error - Can be used by controller to signal error condition to the
  295. * MHI core driver in case of any need to halt processing or incoming sideband
  296. * signal detects an error on endpoint
  297. * @mhi_cntrl: MHI controller
  298. *
  299. * Returns:
  300. * 0 if success in reporting the error condition to MHI core
  301. * error code on failure
  302. */
  303. static inline int mhi_report_error(struct mhi_controller *mhi_cntrl)
  304. {
  305. return -EPERM;
  306. }
  307. /**
  308. * mhi_controller_set_privdata - Set private data for MHI controller
  309. * @mhi_cntrl: MHI controller
  310. * @priv: pointer to data
  311. */
  312. void mhi_controller_set_privdata(struct mhi_controller *mhi_cntrl, void *priv)
  313. {
  314. }
  315. /**
  316. * mhi_controller_get_privdata - Get private data from MHI controller
  317. * @mhi_cntrl: MHI controller
  318. */
  319. void *mhi_controller_get_privdata(struct mhi_controller *mhi_cntrl)
  320. {
  321. return ERR_PTR(-EINVAL);
  322. }
  323. /**
  324. * mhi_bdf_to_controller - Get controller associated with given BDF values
  325. * @domain: Domain or root complex of PCIe port
  326. * @bus: Bus number
  327. * @slot: PCI slot or function number
  328. * @dev_id: Device ID of the endpoint
  329. *
  330. * Returns:
  331. * MHI controller structure pointer if BDF match is found
  332. * NULL if cookie is not found
  333. */
  334. struct mhi_controller *mhi_bdf_to_controller(u32 domain, u32 bus, u32 slot, u32 dev_id)
  335. {
  336. return ERR_PTR(-EINVAL);
  337. }
  338. /**
  339. * mhi_set_m2_timeout_ms - Set M2 timeout in milliseconds to wait before a
  340. * fast/silent suspend
  341. * @mhi_cntrl: MHI controller
  342. * @timeout: timeout in ms
  343. */
  344. void mhi_set_m2_timeout_ms(struct mhi_controller *mhi_cntrl, u32 timeout)
  345. {
  346. }
  347. /**
  348. * mhi_pm_fast_resume - Resume MHI from a fast/silent suspended state
  349. * @mhi_cntrl: MHI controller
  350. * @notify_clients: if true, clients will be notified of the resume transition
  351. */
  352. int mhi_pm_fast_resume(struct mhi_controller *mhi_cntrl, bool notify_clients)
  353. {
  354. return -EPERM;
  355. }
  356. /**
  357. * mhi_pm_fast_suspend - Move MHI into a fast/silent suspended state
  358. * @mhi_cntrl: MHI controller
  359. * @notify_clients: if true, clients will be notified of the suspend transition
  360. */
  361. int mhi_pm_fast_suspend(struct mhi_controller *mhi_cntrl, bool notify_clients)
  362. {
  363. return -EPERM;
  364. }
  365. /**
  366. * mhi_debug_reg_dump - dump MHI registers for debug purpose
  367. * @mhi_cntrl: MHI controller
  368. */
  369. void mhi_debug_reg_dump(struct mhi_controller *mhi_cntrl)
  370. {
  371. }
  372. /**
  373. * mhi_dump_sfr - Print SFR string from RDDM table.
  374. * @mhi_cntrl: MHI controller
  375. */
  376. void mhi_dump_sfr(struct mhi_controller *mhi_cntrl)
  377. {
  378. }
  379. /**
  380. * mhi_device_configure - Allow devices with offload channels to setup their own
  381. * channel and event ring context.
  382. * @mhi_dev: MHI device
  383. * @dir: direction associated with the channel needed to configure
  384. * @cfg_tbl: Buffer with ECA/CCA information and data needed to setup context
  385. * @elements: Number of items to iterate over from the configuration table
  386. */
  387. int mhi_device_configure(struct mhi_device *mhi_dev,
  388. enum dma_data_direction dir,
  389. struct mhi_buf *cfg_tbl,
  390. int elements)
  391. {
  392. return -EPERM;
  393. }
  394. /**
  395. * mhi_scan_rddm_cookie - Look for supplied cookie value in the BHI debug
  396. * registers set by device to indicate rddm readiness for debugging purposes.
  397. * @mhi_cntrl: MHI controller
  398. * @cookie: cookie/pattern value to match
  399. *
  400. * Returns:
  401. * true if cookie is found
  402. * false if cookie is not found
  403. */
  404. bool mhi_scan_rddm_cookie(struct mhi_controller *mhi_cntrl, u32 cookie)
  405. {
  406. return false;
  407. }
  408. /**
  409. * mhi_device_get_sync_atomic - Asserts device_wait and moves device to M0
  410. * @mhi_dev: Device associated with the channels
  411. * @timeout_us: timeout, in micro-seconds
  412. * @in_panic: If requested while kernel is in panic state and no ISRs expected
  413. *
  414. * The device_wake is asserted to keep device in M0 or bring it to M0.
  415. * If device is not in M0 state, then this function will wait for device to
  416. * move to M0, until @timeout_us elapses.
  417. * However, if device's M1 state-change event races with this function
  418. * then there is a possiblity of device moving from M0 to M2 and back
  419. * to M0. That can't be avoided as host must transition device from M1 to M2
  420. * as per the spec.
  421. * Clients can ignore that transition after this function returns as the device
  422. * is expected to immediately move from M2 to M0 as wake is asserted and
  423. * wouldn't enter low power state.
  424. * If in_panic boolean is set, no ISRs are expected, hence this API will have to
  425. * resort to reading the MHI status register and poll on M0 state change.
  426. *
  427. * Returns:
  428. * 0 if operation was successful (however, M0 -> M2 -> M0 is possible later) as
  429. * mentioned above.
  430. * -ETIMEDOUT is device faled to move to M0 before @timeout_us elapsed
  431. * -EIO if the MHI state is one of the ERROR states.
  432. */
  433. int mhi_device_get_sync_atomic(struct mhi_device *mhi_dev, int timeout_us,
  434. bool in_panic)
  435. {
  436. return -EPERM;
  437. }
  438. /**
  439. * mhi_controller_set_bw_scale_cb - Set the BW scale callback for MHI controller
  440. * @mhi_cntrl: MHI controller
  441. * @cb_func: Callback to set for the MHI controller to receive BW scale requests
  442. */
  443. void mhi_controller_set_bw_scale_cb(struct mhi_controller *mhi_cntrl,
  444. int (*cb_func)(struct mhi_controller *mhi_cntrl,
  445. struct mhi_link_info *link_info))
  446. {
  447. }
  448. /**
  449. * mhi_controller_set_base - Set the controller base / resource start address
  450. * @mhi_cntrl: MHI controller
  451. * @base: Physical address to be set for future reference
  452. */
  453. void mhi_controller_set_base(struct mhi_controller *mhi_cntrl,
  454. phys_addr_t base)
  455. {
  456. }
  457. /**
  458. * mhi_controller_get_base - Get the controller base / resource start address
  459. * @mhi_cntrl: MHI controller
  460. * @base: Pointer to physical address to be populated
  461. */
  462. int mhi_controller_get_base(struct mhi_controller *mhi_cntrl,
  463. phys_addr_t *base)
  464. {
  465. return -EINVAL;
  466. }
  467. /**
  468. * mhi_controller_get_numeric_id - set numeric ID for controller
  469. * @mhi_cntrl: MHI controller
  470. * returns value set as ID or 0 if no value was set
  471. */
  472. u32 mhi_controller_get_numeric_id(struct mhi_controller *mhi_cntrl)
  473. {
  474. return 0;
  475. }
  476. /**
  477. * mhi_get_channel_db_base - retrieve the channel doorbell base address
  478. * @mhi_dev: Device associated with the channels
  479. * @value: Pointer to an address value which will be populated
  480. */
  481. int mhi_get_channel_db_base(struct mhi_device *mhi_dev, phys_addr_t *value)
  482. {
  483. return -EPERM;
  484. }
  485. /**
  486. * mhi_get_event_ring_db_base - retrieve the event ring doorbell base address
  487. * @mhi_dev: Device associated with the channels
  488. * @value: Pointer to an address value which will be populated
  489. */
  490. int mhi_get_event_ring_db_base(struct mhi_device *mhi_dev, phys_addr_t *value)
  491. {
  492. return -EPERM;
  493. }
  494. /**
  495. * mhi_get_device_for_channel - get the MHI device for a specific channel number
  496. * @mhi_cntrl: MHI controller
  497. * @channel - channel number
  498. *
  499. * Returns:
  500. * Pointer to the MHI device associated with the channel
  501. */
  502. struct mhi_device *mhi_get_device_for_channel(struct mhi_controller *mhi_cntrl,
  503. u32 channel)
  504. {
  505. return ERR_PTR(-EINVAL);
  506. }
  507. /**
  508. * mhi_device_ioctl - user space IOCTL support for MHI channels
  509. * Native support for setting TIOCM
  510. * @mhi_dev: Device associated with the channels
  511. * @cmd: IOCTL cmd
  512. * @arg: Optional parameter, iotcl cmd specific
  513. */
  514. long mhi_device_ioctl(struct mhi_device *mhi_dev, unsigned int cmd,
  515. unsigned long arg)
  516. {
  517. return -EPERM;
  518. }
  519. /**
  520. * mhi_controller_set_sfr_support - Set support for subsystem failure reason
  521. * @mhi_cntrl: MHI controller
  522. *
  523. * Returns:
  524. * 0 for success, error code for failure
  525. */
  526. int mhi_controller_set_sfr_support(struct mhi_controller *mhi_cntrl,
  527. size_t len)
  528. {
  529. return -EPERM;
  530. }
  531. /**
  532. * mhi_controller_setup_timesync - Set support for time synchronization feature
  533. * @mhi_cntrl: MHI controller
  534. * @time_get: Callback to set for the MHI controller to receive host time
  535. * @lpm_disable: Callback to set for the MHI controller to disable link LPM
  536. * @lpm_enable: Callback to set for the MHI controller to enable link LPM
  537. *
  538. * Returns:
  539. * 0 for success, error code for failure
  540. */
  541. int mhi_controller_setup_timesync(struct mhi_controller *mhi_cntrl,
  542. u64 (*time_get)(struct mhi_controller *c),
  543. int (*lpm_disable)(struct mhi_controller *c),
  544. int (*lpm_enable)(struct mhi_controller *c))
  545. {
  546. return -EPERM;
  547. }
  548. /**
  549. * mhi_get_remote_time_sync - Get external soc time relative to local soc time
  550. * using MMIO method.
  551. * @mhi_dev: Device associated with the channels
  552. * @t_host: Pointer to output local soc time
  553. * @t_dev: Pointer to output remote soc time
  554. *
  555. * Returns:
  556. * 0 for success, error code for failure
  557. */
  558. int mhi_get_remote_time_sync(struct mhi_device *mhi_dev,
  559. u64 *t_host,
  560. u64 *t_dev)
  561. {
  562. return -EPERM;
  563. }
  564. /**
  565. * mhi_get_remote_time - Get external modem time relative to host time
  566. * Trigger event to capture modem time, also capture host time so client
  567. * can do a relative drift comparision.
  568. * Recommended only tsync device calls this method and do not call this
  569. * from atomic context
  570. * @mhi_dev: Device associated with the channels
  571. * @sequence:unique sequence id track event
  572. * @cb_func: callback function to call back
  573. *
  574. * Returns:
  575. * 0 for success, error code for failure
  576. */
  577. int mhi_get_remote_time(struct mhi_device *mhi_dev,
  578. u32 sequence,
  579. void (*cb_func)(struct mhi_device *mhi_dev,
  580. u32 sequence,
  581. u64 local_time,
  582. u64 remote_time))
  583. {
  584. return -EPERM;
  585. }
  586. /**
  587. * mhi_force_reset - does host reset request to collect device side dumps
  588. * for debugging purpose
  589. * @mhi_cntrl: MHI controller
  590. */
  591. int mhi_force_reset(struct mhi_controller *mhi_cntrl)
  592. {
  593. return -EINVAL;
  594. }
  595. /**
  596. * mhi_controller_set_loglevel - API for controller to set a desired log level
  597. * which will be set to VERBOSE or 0 by default
  598. * @mhi_cntrl: MHI controller
  599. * @lvl: Log level from MHI_DEBUG_LEVEL enumerator
  600. */
  601. void mhi_controller_set_loglevel(struct mhi_controller *mhi_cntrl,
  602. enum MHI_DEBUG_LEVEL lvl)
  603. {
  604. }
  605. /**
  606. * mhi_get_soc_info - Get SoC info before registering mhi controller
  607. * @mhi_cntrl: MHI controller
  608. */
  609. int mhi_get_soc_info(struct mhi_controller *mhi_cntrl)
  610. {
  611. return -EINVAL;
  612. }
  613. /**
  614. * mhi_host_notify_db_disable_trace - Host notification to ring channel DB
  615. * to MHI device to stop tracing due SMMU fault
  616. * @mhi_cntrl: MHI controller
  617. */
  618. int mhi_host_notify_db_disable_trace(struct mhi_controller *mhi_cntrl)
  619. {
  620. return -EPERM;
  621. }
  622. #endif /* CONFIG_MHI_BUS_MISC */
  623. #endif /* _MHI_MISC_H_ */