bus.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #include "bus.h"
  7. #include "debug.h"
  8. #include "pci.h"
  9. enum cnss_dev_bus_type cnss_get_dev_bus_type(struct device *dev)
  10. {
  11. if (!dev)
  12. return CNSS_BUS_NONE;
  13. if (!dev->bus)
  14. return CNSS_BUS_NONE;
  15. if (memcmp(dev->bus->name, "pci", 3) == 0)
  16. return CNSS_BUS_PCI;
  17. else
  18. return CNSS_BUS_NONE;
  19. }
  20. enum cnss_dev_bus_type cnss_get_bus_type(struct cnss_plat_data *plat_priv)
  21. {
  22. int ret;
  23. struct device *dev;
  24. u32 bus_type_dt = CNSS_BUS_NONE;
  25. if (plat_priv->dt_type == CNSS_DTT_MULTIEXCHG) {
  26. dev = &plat_priv->plat_dev->dev;
  27. ret = of_property_read_u32(dev->of_node, "qcom,bus-type",
  28. &bus_type_dt);
  29. if (!ret)
  30. if (bus_type_dt < CNSS_BUS_MAX)
  31. cnss_pr_dbg("Got bus type[%u] from dt\n",
  32. bus_type_dt);
  33. else
  34. bus_type_dt = CNSS_BUS_NONE;
  35. else
  36. cnss_pr_err("No bus type for multi-exchg dt\n");
  37. return bus_type_dt;
  38. }
  39. switch (plat_priv->device_id) {
  40. case QCA6174_DEVICE_ID:
  41. case QCA6290_DEVICE_ID:
  42. case QCA6390_DEVICE_ID:
  43. case QCN7605_DEVICE_ID:
  44. case QCA6490_DEVICE_ID:
  45. case KIWI_DEVICE_ID:
  46. case MANGO_DEVICE_ID:
  47. case PEACH_DEVICE_ID:
  48. return CNSS_BUS_PCI;
  49. default:
  50. cnss_pr_err("Unknown device_id: 0x%lx\n", plat_priv->device_id);
  51. return CNSS_BUS_NONE;
  52. }
  53. }
  54. void *cnss_bus_dev_to_bus_priv(struct device *dev)
  55. {
  56. if (!dev)
  57. return NULL;
  58. switch (cnss_get_dev_bus_type(dev)) {
  59. case CNSS_BUS_PCI:
  60. return cnss_get_pci_priv(to_pci_dev(dev));
  61. default:
  62. return NULL;
  63. }
  64. }
  65. struct cnss_plat_data *cnss_bus_dev_to_plat_priv(struct device *dev)
  66. {
  67. void *bus_priv;
  68. if (!dev)
  69. return cnss_get_plat_priv(NULL);
  70. bus_priv = cnss_bus_dev_to_bus_priv(dev);
  71. if (!bus_priv)
  72. return NULL;
  73. switch (cnss_get_dev_bus_type(dev)) {
  74. case CNSS_BUS_PCI:
  75. return cnss_pci_priv_to_plat_priv(bus_priv);
  76. default:
  77. return NULL;
  78. }
  79. }
  80. int cnss_bus_init(struct cnss_plat_data *plat_priv)
  81. {
  82. if (!plat_priv)
  83. return -ENODEV;
  84. switch (plat_priv->bus_type) {
  85. case CNSS_BUS_PCI:
  86. return cnss_pci_init(plat_priv);
  87. default:
  88. cnss_pr_err("Unsupported bus type: %d\n",
  89. plat_priv->bus_type);
  90. return -EINVAL;
  91. }
  92. }
  93. void cnss_bus_deinit(struct cnss_plat_data *plat_priv)
  94. {
  95. if (!plat_priv)
  96. return;
  97. switch (plat_priv->bus_type) {
  98. case CNSS_BUS_PCI:
  99. return cnss_pci_deinit(plat_priv);
  100. default:
  101. cnss_pr_err("Unsupported bus type: %d\n",
  102. plat_priv->bus_type);
  103. return;
  104. }
  105. }
  106. void cnss_bus_add_fw_prefix_name(struct cnss_plat_data *plat_priv,
  107. char *prefix_name, char *name)
  108. {
  109. if (!plat_priv)
  110. return;
  111. switch (plat_priv->bus_type) {
  112. case CNSS_BUS_PCI:
  113. return cnss_pci_add_fw_prefix_name(plat_priv->bus_priv,
  114. prefix_name, name);
  115. default:
  116. cnss_pr_err("Unsupported bus type: %d\n",
  117. plat_priv->bus_type);
  118. return;
  119. }
  120. }
  121. int cnss_bus_load_tme_patch(struct cnss_plat_data *plat_priv)
  122. {
  123. if (!plat_priv)
  124. return -ENODEV;
  125. switch (plat_priv->bus_type) {
  126. case CNSS_BUS_PCI:
  127. return cnss_pci_load_tme_patch(plat_priv->bus_priv);
  128. default:
  129. cnss_pr_err("Unsupported bus type: %d\n",
  130. plat_priv->bus_type);
  131. return -EINVAL;
  132. }
  133. }
  134. int cnss_bus_load_m3(struct cnss_plat_data *plat_priv)
  135. {
  136. if (!plat_priv)
  137. return -ENODEV;
  138. switch (plat_priv->bus_type) {
  139. case CNSS_BUS_PCI:
  140. return cnss_pci_load_m3(plat_priv->bus_priv);
  141. default:
  142. cnss_pr_err("Unsupported bus type: %d\n",
  143. plat_priv->bus_type);
  144. return -EINVAL;
  145. }
  146. }
  147. int cnss_bus_load_aux(struct cnss_plat_data *plat_priv)
  148. {
  149. if (!plat_priv)
  150. return -ENODEV;
  151. switch (plat_priv->bus_type) {
  152. case CNSS_BUS_PCI:
  153. return cnss_pci_load_aux(plat_priv->bus_priv);
  154. default:
  155. cnss_pr_err("Unsupported bus type: %d\n",
  156. plat_priv->bus_type);
  157. return -EINVAL;
  158. }
  159. }
  160. int cnss_bus_handle_dev_sol_irq(struct cnss_plat_data *plat_priv)
  161. {
  162. if (!plat_priv)
  163. return -ENODEV;
  164. switch (plat_priv->bus_type) {
  165. case CNSS_BUS_PCI:
  166. return cnss_pci_handle_dev_sol_irq(plat_priv->bus_priv);
  167. default:
  168. cnss_pr_err("Unsupported bus type: %d\n",
  169. plat_priv->bus_type);
  170. return -EINVAL;
  171. }
  172. }
  173. int cnss_bus_alloc_fw_mem(struct cnss_plat_data *plat_priv)
  174. {
  175. if (!plat_priv)
  176. return -ENODEV;
  177. switch (plat_priv->bus_type) {
  178. case CNSS_BUS_PCI:
  179. return cnss_pci_alloc_fw_mem(plat_priv->bus_priv);
  180. default:
  181. cnss_pr_err("Unsupported bus type: %d\n",
  182. plat_priv->bus_type);
  183. return -EINVAL;
  184. }
  185. }
  186. int cnss_bus_alloc_qdss_mem(struct cnss_plat_data *plat_priv)
  187. {
  188. if (!plat_priv)
  189. return -ENODEV;
  190. switch (plat_priv->bus_type) {
  191. case CNSS_BUS_PCI:
  192. return cnss_pci_alloc_qdss_mem(plat_priv->bus_priv);
  193. default:
  194. cnss_pr_err("Unsupported bus type: %d\n",
  195. plat_priv->bus_type);
  196. return -EINVAL;
  197. }
  198. }
  199. void cnss_bus_free_qdss_mem(struct cnss_plat_data *plat_priv)
  200. {
  201. if (!plat_priv)
  202. return;
  203. switch (plat_priv->bus_type) {
  204. case CNSS_BUS_PCI:
  205. cnss_pci_free_qdss_mem(plat_priv->bus_priv);
  206. return;
  207. default:
  208. cnss_pr_err("Unsupported bus type: %d\n",
  209. plat_priv->bus_type);
  210. return;
  211. }
  212. }
  213. u32 cnss_bus_get_wake_irq(struct cnss_plat_data *plat_priv)
  214. {
  215. if (!plat_priv)
  216. return -ENODEV;
  217. switch (plat_priv->bus_type) {
  218. case CNSS_BUS_PCI:
  219. return cnss_pci_get_wake_msi(plat_priv->bus_priv);
  220. default:
  221. cnss_pr_err("Unsupported bus type: %d\n",
  222. plat_priv->bus_type);
  223. return -EINVAL;
  224. }
  225. }
  226. int cnss_bus_force_fw_assert_hdlr(struct cnss_plat_data *plat_priv)
  227. {
  228. if (!plat_priv)
  229. return -ENODEV;
  230. switch (plat_priv->bus_type) {
  231. case CNSS_BUS_PCI:
  232. return cnss_pci_force_fw_assert_hdlr(plat_priv->bus_priv);
  233. default:
  234. cnss_pr_err("Unsupported bus type: %d\n",
  235. plat_priv->bus_type);
  236. return -EINVAL;
  237. }
  238. }
  239. int cnss_bus_qmi_send_get(struct cnss_plat_data *plat_priv)
  240. {
  241. if (!plat_priv)
  242. return -ENODEV;
  243. switch (plat_priv->bus_type) {
  244. case CNSS_BUS_PCI:
  245. return cnss_pci_qmi_send_get(plat_priv->bus_priv);
  246. default:
  247. cnss_pr_err("Unsupported bus type: %d\n",
  248. plat_priv->bus_type);
  249. return -EINVAL;
  250. }
  251. }
  252. int cnss_bus_qmi_send_put(struct cnss_plat_data *plat_priv)
  253. {
  254. if (!plat_priv)
  255. return -ENODEV;
  256. switch (plat_priv->bus_type) {
  257. case CNSS_BUS_PCI:
  258. return cnss_pci_qmi_send_put(plat_priv->bus_priv);
  259. default:
  260. cnss_pr_err("Unsupported bus type: %d\n",
  261. plat_priv->bus_type);
  262. return -EINVAL;
  263. }
  264. }
  265. void cnss_bus_fw_boot_timeout_hdlr(struct timer_list *t)
  266. {
  267. struct cnss_plat_data *plat_priv =
  268. from_timer(plat_priv, t, fw_boot_timer);
  269. if (!plat_priv)
  270. return;
  271. switch (plat_priv->bus_type) {
  272. case CNSS_BUS_PCI:
  273. return cnss_pci_fw_boot_timeout_hdlr(plat_priv->bus_priv);
  274. default:
  275. cnss_pr_err("Unsupported bus type: %d\n",
  276. plat_priv->bus_type);
  277. return;
  278. }
  279. }
  280. void cnss_bus_collect_dump_info(struct cnss_plat_data *plat_priv, bool in_panic)
  281. {
  282. if (!plat_priv)
  283. return;
  284. switch (plat_priv->bus_type) {
  285. case CNSS_BUS_PCI:
  286. return cnss_pci_collect_dump_info(plat_priv->bus_priv,
  287. in_panic);
  288. default:
  289. cnss_pr_err("Unsupported bus type: %d\n",
  290. plat_priv->bus_type);
  291. return;
  292. }
  293. }
  294. void cnss_bus_device_crashed(struct cnss_plat_data *plat_priv)
  295. {
  296. if (!plat_priv)
  297. return;
  298. switch (plat_priv->bus_type) {
  299. case CNSS_BUS_PCI:
  300. return cnss_pci_device_crashed(plat_priv->bus_priv);
  301. default:
  302. cnss_pr_err("Unsupported bus type: %d\n",
  303. plat_priv->bus_type);
  304. return;
  305. }
  306. }
  307. int cnss_bus_call_driver_probe(struct cnss_plat_data *plat_priv)
  308. {
  309. if (!plat_priv)
  310. return -ENODEV;
  311. switch (plat_priv->bus_type) {
  312. case CNSS_BUS_PCI:
  313. return cnss_pci_call_driver_probe(plat_priv->bus_priv);
  314. default:
  315. cnss_pr_err("Unsupported bus type: %d\n",
  316. plat_priv->bus_type);
  317. return -EINVAL;
  318. }
  319. }
  320. int cnss_bus_call_driver_remove(struct cnss_plat_data *plat_priv)
  321. {
  322. if (!plat_priv)
  323. return -ENODEV;
  324. switch (plat_priv->bus_type) {
  325. case CNSS_BUS_PCI:
  326. return cnss_pci_call_driver_remove(plat_priv->bus_priv);
  327. default:
  328. cnss_pr_err("Unsupported bus type: %d\n",
  329. plat_priv->bus_type);
  330. return -EINVAL;
  331. }
  332. }
  333. int cnss_bus_dev_powerup(struct cnss_plat_data *plat_priv)
  334. {
  335. if (!plat_priv)
  336. return -ENODEV;
  337. switch (plat_priv->bus_type) {
  338. case CNSS_BUS_PCI:
  339. return cnss_pci_dev_powerup(plat_priv->bus_priv);
  340. default:
  341. cnss_pr_err("Unsupported bus type: %d\n",
  342. plat_priv->bus_type);
  343. return -EINVAL;
  344. }
  345. }
  346. int cnss_bus_dev_shutdown(struct cnss_plat_data *plat_priv)
  347. {
  348. if (!plat_priv)
  349. return -ENODEV;
  350. switch (plat_priv->bus_type) {
  351. case CNSS_BUS_PCI:
  352. return cnss_pci_dev_shutdown(plat_priv->bus_priv);
  353. default:
  354. cnss_pr_err("Unsupported bus type: %d\n",
  355. plat_priv->bus_type);
  356. return -EINVAL;
  357. }
  358. }
  359. int cnss_bus_dev_crash_shutdown(struct cnss_plat_data *plat_priv)
  360. {
  361. if (!plat_priv)
  362. return -ENODEV;
  363. switch (plat_priv->bus_type) {
  364. case CNSS_BUS_PCI:
  365. return cnss_pci_dev_crash_shutdown(plat_priv->bus_priv);
  366. default:
  367. cnss_pr_err("Unsupported bus type: %d\n",
  368. plat_priv->bus_type);
  369. return -EINVAL;
  370. }
  371. }
  372. int cnss_bus_dev_ramdump(struct cnss_plat_data *plat_priv)
  373. {
  374. if (!plat_priv)
  375. return -ENODEV;
  376. switch (plat_priv->bus_type) {
  377. case CNSS_BUS_PCI:
  378. return cnss_pci_dev_ramdump(plat_priv->bus_priv);
  379. default:
  380. cnss_pr_err("Unsupported bus type: %d\n",
  381. plat_priv->bus_type);
  382. return -EINVAL;
  383. }
  384. }
  385. int cnss_bus_register_driver_hdlr(struct cnss_plat_data *plat_priv, void *data)
  386. {
  387. if (!plat_priv)
  388. return -ENODEV;
  389. switch (plat_priv->bus_type) {
  390. case CNSS_BUS_PCI:
  391. return cnss_pci_register_driver_hdlr(plat_priv->bus_priv, data);
  392. default:
  393. cnss_pr_err("Unsupported bus type: %d\n",
  394. plat_priv->bus_type);
  395. return -EINVAL;
  396. }
  397. }
  398. int cnss_bus_unregister_driver_hdlr(struct cnss_plat_data *plat_priv)
  399. {
  400. if (!plat_priv)
  401. return -ENODEV;
  402. switch (plat_priv->bus_type) {
  403. case CNSS_BUS_PCI:
  404. return cnss_pci_unregister_driver_hdlr(plat_priv->bus_priv);
  405. default:
  406. cnss_pr_err("Unsupported bus type: %d\n",
  407. plat_priv->bus_type);
  408. return -EINVAL;
  409. }
  410. }
  411. int cnss_bus_call_driver_modem_status(struct cnss_plat_data *plat_priv,
  412. int modem_current_status)
  413. {
  414. if (!plat_priv)
  415. return -ENODEV;
  416. switch (plat_priv->bus_type) {
  417. case CNSS_BUS_PCI:
  418. return cnss_pci_call_driver_modem_status(plat_priv->bus_priv,
  419. modem_current_status);
  420. default:
  421. cnss_pr_err("Unsupported bus type: %d\n",
  422. plat_priv->bus_type);
  423. return -EINVAL;
  424. }
  425. }
  426. int cnss_bus_update_status(struct cnss_plat_data *plat_priv,
  427. enum cnss_driver_status status)
  428. {
  429. if (!plat_priv)
  430. return -ENODEV;
  431. switch (plat_priv->bus_type) {
  432. case CNSS_BUS_PCI:
  433. return cnss_pci_update_status(plat_priv->bus_priv, status);
  434. default:
  435. cnss_pr_err("Unsupported bus type: %d\n",
  436. plat_priv->bus_type);
  437. return -EINVAL;
  438. }
  439. }
  440. int cnss_bus_update_uevent(struct cnss_plat_data *plat_priv,
  441. enum cnss_driver_status status, void *data)
  442. {
  443. if (!plat_priv)
  444. return -ENODEV;
  445. switch (plat_priv->bus_type) {
  446. case CNSS_BUS_PCI:
  447. return cnss_pci_call_driver_uevent(plat_priv->bus_priv,
  448. status, data);
  449. default:
  450. cnss_pr_err("Unsupported bus type: %d\n",
  451. plat_priv->bus_type);
  452. return -EINVAL;
  453. }
  454. }
  455. int cnss_bus_is_device_down(struct cnss_plat_data *plat_priv)
  456. {
  457. if (!plat_priv)
  458. return -ENODEV;
  459. switch (plat_priv->bus_type) {
  460. case CNSS_BUS_PCI:
  461. return cnss_pcie_is_device_down(plat_priv->bus_priv);
  462. default:
  463. cnss_pr_dbg("Unsupported bus type: %d\n",
  464. plat_priv->bus_type);
  465. return 0;
  466. }
  467. }
  468. int cnss_bus_check_link_status(struct cnss_plat_data *plat_priv)
  469. {
  470. if (!plat_priv)
  471. return -ENODEV;
  472. switch (plat_priv->bus_type) {
  473. case CNSS_BUS_PCI:
  474. return cnss_pci_check_link_status(plat_priv->bus_priv);
  475. default:
  476. cnss_pr_dbg("Unsupported bus type: %d\n",
  477. plat_priv->bus_type);
  478. return 0;
  479. }
  480. }
  481. int cnss_bus_recover_link_down(struct cnss_plat_data *plat_priv)
  482. {
  483. if (!plat_priv)
  484. return -ENODEV;
  485. switch (plat_priv->bus_type) {
  486. case CNSS_BUS_PCI:
  487. return cnss_pci_recover_link_down(plat_priv->bus_priv);
  488. default:
  489. cnss_pr_dbg("Unsupported bus type: %d\n",
  490. plat_priv->bus_type);
  491. return -EINVAL;
  492. }
  493. }
  494. int cnss_bus_debug_reg_read(struct cnss_plat_data *plat_priv, u32 offset,
  495. u32 *val, bool raw_access)
  496. {
  497. if (!plat_priv)
  498. return -ENODEV;
  499. switch (plat_priv->bus_type) {
  500. case CNSS_BUS_PCI:
  501. return cnss_pci_debug_reg_read(plat_priv->bus_priv, offset,
  502. val, raw_access);
  503. default:
  504. cnss_pr_dbg("Unsupported bus type: %d\n",
  505. plat_priv->bus_type);
  506. return 0;
  507. }
  508. }
  509. int cnss_bus_debug_reg_write(struct cnss_plat_data *plat_priv, u32 offset,
  510. u32 val, bool raw_access)
  511. {
  512. if (!plat_priv)
  513. return -ENODEV;
  514. switch (plat_priv->bus_type) {
  515. case CNSS_BUS_PCI:
  516. return cnss_pci_debug_reg_write(plat_priv->bus_priv, offset,
  517. val, raw_access);
  518. default:
  519. cnss_pr_dbg("Unsupported bus type: %d\n",
  520. plat_priv->bus_type);
  521. return 0;
  522. }
  523. }
  524. int cnss_bus_get_iova(struct cnss_plat_data *plat_priv, u64 *addr, u64 *size)
  525. {
  526. if (!plat_priv)
  527. return -ENODEV;
  528. switch (plat_priv->bus_type) {
  529. case CNSS_BUS_PCI:
  530. return cnss_pci_get_iova(plat_priv->bus_priv, addr, size);
  531. default:
  532. cnss_pr_err("Unsupported bus type: %d\n",
  533. plat_priv->bus_type);
  534. return -EINVAL;
  535. }
  536. }
  537. int cnss_bus_get_iova_ipa(struct cnss_plat_data *plat_priv, u64 *addr,
  538. u64 *size)
  539. {
  540. if (!plat_priv)
  541. return -ENODEV;
  542. switch (plat_priv->bus_type) {
  543. case CNSS_BUS_PCI:
  544. return cnss_pci_get_iova_ipa(plat_priv->bus_priv, addr, size);
  545. default:
  546. cnss_pr_err("Unsupported bus type: %d\n",
  547. plat_priv->bus_type);
  548. return -EINVAL;
  549. }
  550. }
  551. bool cnss_bus_is_smmu_s1_enabled(struct cnss_plat_data *plat_priv)
  552. {
  553. if (!plat_priv)
  554. return false;
  555. switch (plat_priv->bus_type) {
  556. case CNSS_BUS_PCI:
  557. return cnss_pci_is_smmu_s1_enabled(plat_priv->bus_priv);
  558. default:
  559. cnss_pr_err("Unsupported bus type: %d\n",
  560. plat_priv->bus_type);
  561. return false;
  562. }
  563. }
  564. int cnss_bus_update_time_sync_period(struct cnss_plat_data *plat_priv,
  565. unsigned int time_sync_period)
  566. {
  567. if (!plat_priv)
  568. return -ENODEV;
  569. switch (plat_priv->bus_type) {
  570. case CNSS_BUS_PCI:
  571. return cnss_pci_update_time_sync_period(plat_priv->bus_priv,
  572. time_sync_period);
  573. default:
  574. cnss_pr_err("Unsupported bus type: %d\n",
  575. plat_priv->bus_type);
  576. return -EINVAL;
  577. }
  578. }
  579. int cnss_bus_set_therm_cdev_state(struct cnss_plat_data *plat_priv,
  580. unsigned long thermal_state,
  581. int tcdev_id)
  582. {
  583. if (!plat_priv)
  584. return -ENODEV;
  585. switch (plat_priv->bus_type) {
  586. case CNSS_BUS_PCI:
  587. return cnss_pci_set_therm_cdev_state(plat_priv->bus_priv,
  588. thermal_state,
  589. tcdev_id);
  590. default:
  591. cnss_pr_err("Unsupported bus type: %d\n", plat_priv->bus_type);
  592. return -EINVAL;
  593. }
  594. }
  595. int cnss_bus_get_msi_assignment(struct cnss_plat_data *plat_priv,
  596. char *msi_name,
  597. int *num_vectors,
  598. u32 *user_base_data,
  599. u32 *base_vector)
  600. {
  601. if (!plat_priv)
  602. return -ENODEV;
  603. switch (plat_priv->bus_type) {
  604. case CNSS_BUS_PCI:
  605. return cnss_pci_get_user_msi_assignment(plat_priv->bus_priv,
  606. msi_name,
  607. num_vectors,
  608. user_base_data,
  609. base_vector);
  610. default:
  611. cnss_pr_err("Unsupported bus type: %d\n", plat_priv->bus_type);
  612. return -EINVAL;
  613. }
  614. }
  615. #if IS_ENABLED(CONFIG_MHI_BUS_MISC)
  616. void cnss_bus_disable_mhi_satellite_cfg(struct cnss_plat_data *plat_priv)
  617. {
  618. struct cnss_pci_data *pci_priv;
  619. pci_priv = plat_priv->bus_priv;
  620. if (!pci_priv) {
  621. cnss_pr_err("mhi satellite could not be disabled since pci_priv is NULL\n");
  622. return;
  623. }
  624. switch (plat_priv->bus_type) {
  625. case CNSS_BUS_PCI:
  626. /* MHI satellite configuration is only for KIWI V2 and
  627. * that too only in DRV mode.
  628. */
  629. if (plat_priv->device_id == KIWI_DEVICE_ID &&
  630. plat_priv->device_version.major_version == FW_V2_NUMBER) {
  631. cnss_pr_dbg("Remove MHI satellite configuration\n");
  632. return cnss_mhi_controller_set_base(pci_priv, 0);
  633. }
  634. break;
  635. default:
  636. cnss_pr_dbg("Unsupported bus type: %d, ignore disable mhi satellite cfg\n",
  637. plat_priv->bus_type);
  638. return;
  639. }
  640. return;
  641. }
  642. #else
  643. void cnss_bus_disable_mhi_satellite_cfg(struct cnss_plat_data *pci_priv)
  644. {
  645. }
  646. #endif