1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
4  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
5  */
6 
7 #ifndef _CNSS_BUS_H
8 #define _CNSS_BUS_H
9 
10 #include "main.h"
11 
12 #define QCA6174_REV_ID_OFFSET		0x08
13 #define QCA6174_REV3_VERSION		0x5020000
14 #define QCA6174_REV3_2_VERSION		0x5030000
15 
16 enum cnss_dev_bus_type cnss_get_dev_bus_type(struct device *dev);
17 enum cnss_dev_bus_type cnss_get_bus_type(struct cnss_plat_data *plat_priv);
18 void *cnss_bus_dev_to_bus_priv(struct device *dev);
19 struct cnss_plat_data *cnss_bus_dev_to_plat_priv(struct device *dev);
20 int cnss_bus_init(struct cnss_plat_data *plat_priv);
21 void cnss_bus_deinit(struct cnss_plat_data *plat_priv);
22 void cnss_bus_add_fw_prefix_name(struct cnss_plat_data *plat_priv,
23 				 char *prefix_name, char *name);
24 int cnss_bus_load_tme_patch(struct cnss_plat_data *plat_priv);
25 int cnss_bus_load_tme_opt_file(struct cnss_plat_data *plat_priv,
26 				enum wlfw_tme_lite_file_type_v01 file);
27 int cnss_bus_runtime_pm_get_sync(struct cnss_plat_data *plat_priv);
28 void cnss_bus_runtime_pm_put(struct cnss_plat_data *plat_priv);
29 int cnss_bus_load_m3(struct cnss_plat_data *plat_priv);
30 int cnss_bus_load_aux(struct cnss_plat_data *plat_priv);
31 int cnss_bus_handle_dev_sol_irq(struct cnss_plat_data *plat_priv);
32 int cnss_bus_alloc_fw_mem(struct cnss_plat_data *plat_priv);
33 int cnss_bus_alloc_qdss_mem(struct cnss_plat_data *plat_priv);
34 void cnss_bus_free_qdss_mem(struct cnss_plat_data *plat_priv);
35 u32 cnss_bus_get_wake_irq(struct cnss_plat_data *plat_priv);
36 int cnss_bus_force_fw_assert_hdlr(struct cnss_plat_data *plat_priv);
37 int cnss_bus_qmi_send_get(struct cnss_plat_data *plat_priv);
38 int cnss_bus_qmi_send_put(struct cnss_plat_data *plat_priv);
39 void cnss_bus_fw_boot_timeout_hdlr(struct timer_list *t);
40 void cnss_bus_collect_dump_info(struct cnss_plat_data *plat_priv,
41 				bool in_panic);
42 void cnss_bus_device_crashed(struct cnss_plat_data *plat_priv);
43 int cnss_bus_call_driver_probe(struct cnss_plat_data *plat_priv);
44 int cnss_bus_call_driver_remove(struct cnss_plat_data *plat_priv);
45 int cnss_bus_dev_powerup(struct cnss_plat_data *plat_priv);
46 int cnss_bus_dev_shutdown(struct cnss_plat_data *plat_priv);
47 int cnss_bus_dev_crash_shutdown(struct cnss_plat_data *plat_priv);
48 int cnss_bus_dev_ramdump(struct cnss_plat_data *plat_priv);
49 int cnss_bus_register_driver_hdlr(struct cnss_plat_data *plat_priv, void *data);
50 int cnss_bus_unregister_driver_hdlr(struct cnss_plat_data *plat_priv);
51 int cnss_bus_call_driver_modem_status(struct cnss_plat_data *plat_priv,
52 				      int modem_current_status);
53 int cnss_bus_update_status(struct cnss_plat_data *plat_priv,
54 			   enum cnss_driver_status status);
55 int cnss_bus_update_uevent(struct cnss_plat_data *plat_priv,
56 			   enum cnss_driver_status status, void *data);
57 int cnss_bus_is_device_down(struct cnss_plat_data *plat_priv);
58 int cnss_bus_shutdown_cleanup(struct cnss_plat_data *plat_priv);
59 int cnss_bus_check_link_status(struct cnss_plat_data *plat_priv);
60 int cnss_bus_recover_link_down(struct cnss_plat_data *plat_priv);
61 int cnss_bus_debug_reg_read(struct cnss_plat_data *plat_priv, u32 offset,
62 			    u32 *val, bool raw_access);
63 int cnss_bus_debug_reg_write(struct cnss_plat_data *plat_priv, u32 offset,
64 			     u32 val, bool raw_access);
65 int cnss_bus_get_iova(struct cnss_plat_data *plat_priv, u64 *addr, u64 *size);
66 int cnss_bus_get_iova_ipa(struct cnss_plat_data *plat_priv, u64 *addr,
67 			  u64 *size);
68 bool cnss_bus_is_smmu_s1_enabled(struct cnss_plat_data *plat_priv);
69 int cnss_bus_update_time_sync_period(struct cnss_plat_data *plat_priv,
70 				     unsigned int time_sync_period);
71 void cnss_bus_disable_mhi_satellite_cfg(struct cnss_plat_data *plat_priv);
72 int cnss_bus_set_therm_cdev_state(struct cnss_plat_data *plat_priv,
73 				  unsigned long thermal_state,
74 				  int tcdev_id);
75 int cnss_bus_get_msi_assignment(struct cnss_plat_data *plat_priv,
76 				char *msi_name,
77 				int *num_vectors,
78 				u32 *user_base_data,
79 				u32 *base_vector);
80 #endif /* _CNSS_BUS_H */
81