xref: /wlan-dirver/qca-wifi-host-cmn/hif/src/dispatcher/multibus_snoc.c (revision c8e2987f9325baadee03d0265544a08c4a0217b0)
1 /*
2  * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 
28 #include "hif.h"
29 #include "hif_main.h"
30 #include "multibus.h"
31 #include "ce_main.h"
32 #include "snoc_api.h"
33 #include "dummy.h"
34 #include "ce_api.h"
35 
36 /**
37  * hif_initialize_pci_ops() - initialize the pci ops
38  * @bus_ops: hif_bus_ops table pointer to initialize
39  *
40  * Return: QDF_STATUS_SUCCESS
41  */
42 QDF_STATUS hif_initialize_snoc_ops(struct hif_bus_ops *bus_ops)
43 {
44 	bus_ops->hif_bus_open = &hif_snoc_open;
45 	bus_ops->hif_bus_close = &hif_snoc_close;
46 	bus_ops->hif_bus_prevent_linkdown = &hif_dummy_bus_prevent_linkdown;
47 	bus_ops->hif_reset_soc = &hif_dummy_reset_soc;
48 	bus_ops->hif_bus_early_suspend = &hif_ce_bus_early_suspend;
49 	bus_ops->hif_bus_late_resume = &hif_ce_bus_late_resume;
50 	bus_ops->hif_bus_suspend = &hif_snoc_bus_suspend;
51 	bus_ops->hif_bus_resume = &hif_snoc_bus_resume;
52 	bus_ops->hif_bus_suspend_noirq = &hif_snoc_bus_suspend_noirq;
53 	/* snoc_bus_resume_noirq had no side effects, use dummy resume_noirq */
54 	bus_ops->hif_bus_resume_noirq = &hif_dummy_bus_resume_noirq;
55 	bus_ops->hif_target_sleep_state_adjust =
56 		&hif_dummy_target_sleep_state_adjust;
57 
58 	bus_ops->hif_disable_isr = &hif_snoc_disable_isr;
59 	bus_ops->hif_nointrs = &hif_snoc_nointrs;
60 	bus_ops->hif_enable_bus = &hif_snoc_enable_bus;
61 	bus_ops->hif_disable_bus = &hif_snoc_disable_bus;
62 	bus_ops->hif_bus_configure = &hif_snoc_bus_configure;
63 	bus_ops->hif_get_config_item = &hif_dummy_get_config_item;
64 	bus_ops->hif_set_mailbox_swap = &hif_dummy_set_mailbox_swap;
65 	bus_ops->hif_claim_device = &hif_dummy_claim_device;
66 	bus_ops->hif_shutdown_device = &hif_ce_stop;
67 	bus_ops->hif_stop = &hif_ce_stop;
68 	bus_ops->hif_cancel_deferred_target_sleep =
69 				&hif_dummy_cancel_deferred_target_sleep;
70 	bus_ops->hif_irq_disable = &hif_snoc_irq_disable;
71 	bus_ops->hif_irq_enable = &hif_snoc_irq_enable;
72 	bus_ops->hif_dump_registers = &hif_snoc_dump_registers;
73 	bus_ops->hif_dump_target_memory = &hif_ce_dump_target_memory;
74 	bus_ops->hif_ipa_get_ce_resource = &hif_ce_ipa_get_ce_resource;
75 	bus_ops->hif_mask_interrupt_call = &hif_dummy_mask_interrupt_call;
76 	bus_ops->hif_enable_power_management =
77 		&hif_dummy_enable_power_management;
78 	bus_ops->hif_disable_power_management =
79 		&hif_dummy_disable_power_management;
80 	bus_ops->hif_display_stats =
81 		&hif_snoc_display_stats;
82 	bus_ops->hif_clear_stats =
83 		&hif_snoc_clear_stats;
84 	bus_ops->hif_map_ce_to_irq = &hif_snoc_map_ce_to_irq;
85 	bus_ops->hif_addr_in_boundary = &hif_dummy_addr_in_boundary;
86 	bus_ops->hif_needs_bmi = &hif_snoc_needs_bmi;
87 
88 	return QDF_STATUS_SUCCESS;
89 }
90 
91 /**
92  * hif_snoc_get_context_size() - return the size of the snoc context
93  *
94  * Return the size of the context.  (0 for invalid bus)
95  */
96 int hif_snoc_get_context_size(void)
97 {
98 	return sizeof(struct HIF_CE_state);
99 }
100