xref: /wlan-driver/qca-wifi-host-cmn/hif/src/dispatcher/multibus_usb.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2018,2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #include "hif.h"
20 #include "hif_main.h"
21 #include "multibus.h"
22 #include "usb_api.h"
23 #include "hif_io32.h"
24 #include "dummy.h"
25 #include "if_usb.h"
26 
27 /**
28  * hif_initialize_usb_ops() - initialize the usb ops
29  * @bus_ops: hif_bus_ops table pointer to initialize
30  *
31  * Return: QDF_STATUS_SUCCESS
32  */
hif_initialize_usb_ops(struct hif_bus_ops * bus_ops)33 QDF_STATUS hif_initialize_usb_ops(struct hif_bus_ops *bus_ops)
34 {
35 	bus_ops->hif_bus_open = &hif_usb_open;
36 	bus_ops->hif_bus_close = &hif_usb_close;
37 	bus_ops->hif_bus_prevent_linkdown = &hif_dummy_bus_prevent_linkdown;
38 	bus_ops->hif_reset_soc = &hif_dummy_reset_soc;
39 	bus_ops->hif_bus_suspend = &hif_usb_bus_suspend;
40 	bus_ops->hif_bus_resume = &hif_usb_bus_resume;
41 	bus_ops->hif_target_sleep_state_adjust =
42 			&hif_dummy_target_sleep_state_adjust;
43 	bus_ops->hif_disable_isr = &hif_usb_disable_isr;
44 	bus_ops->hif_nointrs = &hif_usb_nointrs;
45 	bus_ops->hif_enable_bus = &hif_usb_enable_bus;
46 	bus_ops->hif_disable_bus = &hif_usb_disable_bus;
47 	bus_ops->hif_bus_configure = &hif_usb_bus_configure;
48 	bus_ops->hif_get_config_item = &hif_dummy_get_config_item;
49 	bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap;
50 	bus_ops->hif_claim_device = &hif_dummy_claim_device;
51 	bus_ops->hif_shutdown_device = &hif_usb_shutdown_bus_device;
52 	bus_ops->hif_stop = &hif_usb_stop_device;
53 	bus_ops->hif_cancel_deferred_target_sleep =
54 				&hif_dummy_cancel_deferred_target_sleep;
55 	bus_ops->hif_irq_disable = &hif_usb_irq_disable;
56 	bus_ops->hif_irq_enable = &hif_usb_irq_enable;
57 	bus_ops->hif_dump_registers = &hif_dummy_dump_registers;
58 	bus_ops->hif_dump_target_memory = &hif_dummy_dump_target_memory;
59 	bus_ops->hif_reg_read32 = &hif_dummy_bus_reg_read32;
60 	bus_ops->hif_reg_write32 = &hif_dummy_bus_reg_write32;
61 	bus_ops->hif_ipa_get_ce_resource = &hif_dummy_ipa_get_ce_resource;
62 	bus_ops->hif_mask_interrupt_call = &hif_dummy_mask_interrupt_call;
63 	bus_ops->hif_enable_power_management =
64 			&hif_dummy_enable_power_management;
65 	bus_ops->hif_disable_power_management =
66 			&hif_dummy_disable_power_management;
67 	bus_ops->hif_addr_in_boundary = &hif_dummy_addr_in_boundary;
68 	bus_ops->hif_set_bundle_mode = &hif_usb_set_bundle_mode;
69 	bus_ops->hif_bus_reset_resume = &hif_usb_bus_reset_resume;
70 	bus_ops->hif_map_ce_to_irq = &hif_dummy_map_ce_to_irq;
71 	bus_ops->hif_needs_bmi = &hif_usb_needs_bmi;
72 	bus_ops->hif_log_bus_info = &hif_dummy_log_bus_info;
73 
74 	return QDF_STATUS_SUCCESS;
75 }
76 
77 /**
78  * hif_usb_get_context_size() - return the size of the usb context
79  *
80  * Return the size of the context.  (0 for invalid bus)
81  */
hif_usb_get_context_size(void)82 int hif_usb_get_context_size(void)
83 {
84 	return sizeof(struct hif_usb_softc);
85 }
86