xref: /wlan-driver/qca-wifi-host-cmn/hif/src/sdio/if_sdio.h (revision 5113495b16420b49004c444715d2daae2066e7dc) !
1 /*
2  * Copyright (c) 2013-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 #ifndef __IF_SDIO_H__
20 #define __IF_SDIO_H__
21 
22 #include <linux/version.h>
23 #include <linux/semaphore.h>
24 #include <linux/interrupt.h>
25 #include <osdep.h>
26 #include <ol_if_athvar.h>
27 #include <athdefs.h>
28 #include "a_osapi.h"
29 #include "pld_sdio.h"
30 #include "hif_internal.h"
31 
32 
33 #define AR6320_HEADERS_DEF
34 
35 #define ATH_DBG_DEFAULT   0
36 
37 #define RAMDUMP_ADDR     0x8F000000
38 #define RAMDUMP_SIZE     0x700000
39 
40 struct hif_sdio_softc {
41 	struct hif_softc ol_sc;
42 	struct device *dev;
43 	/*
44 	 * Guard changes to Target HW state and to software
45 	 * structures that track hardware state.
46 	 */
47 	spinlock_t target_lock;
48 	void *hif_handle;
49 	void *ramdump_base;
50 	unsigned long ramdump_address;
51 	unsigned long ramdump_size;
52 	struct targetdef_s *targetdef;
53 	struct hostdef_s *hostdef;
54 };
55 
56 #if defined(CONFIG_ATH_PROCFS_DIAG_SUPPORT)
57 int athdiag_procfs_init(void *scn);
58 void athdiag_procfs_remove(void);
59 #else
athdiag_procfs_init(void * scn)60 static inline int athdiag_procfs_init(void *scn)
61 {
62 	return 0;
63 }
64 
athdiag_procfs_remove(void)65 static inline void athdiag_procfs_remove(void)
66 {
67 }
68 #endif
69 
70 #define DMA_MAPPING_ERROR(dev, addr) dma_mapping_error((dev), (addr))
71 
72 int ath_sdio_probe(void *context, void *hif_handle);
73 void ath_sdio_remove(void *context, void *hif_handle);
74 int ath_sdio_suspend(void *context);
75 int ath_sdio_resume(void *context);
76 
77 /*These functions are exposed to HDD*/
78 void hif_init_qdf_ctx(qdf_device_t qdf_dev, void *ol_sc);
79 void hif_deinit_qdf_ctx(void *ol_sc);
80 
81 /**
82  * hif_sdio_device_inserted() - Wrapper function for hif-sdio driver probe
83  * handler
84  * @ol_sc: HIF device context
85  * @dev: pointer to device structure
86  * @id: pointer to sdio_device_id
87  *
88  * Return: QDF_STATUS
89  */
90 QDF_STATUS hif_sdio_device_inserted(struct hif_softc *ol_sc,
91 				    struct device *dev,
92 				    const struct sdio_device_id *id);
93 
94 void hif_sdio_stop(struct hif_softc *hif_ctx);
95 void hif_sdio_shutdown(struct hif_softc *hif_ctx);
96 void hif_sdio_device_removed(struct hif_softc *hif_ctx, struct sdio_func *func);
97 int hif_device_suspend(struct hif_softc *ol_sc, struct device *dev);
98 int hif_device_resume(struct hif_softc *ol_sc, struct device *dev);
99 void hif_register_tbl_attach(struct hif_softc *scn,
100 			     u32 hif_type);
101 void target_register_tbl_attach(struct hif_softc *scn,
102 				u32 target_type);
103 void hif_enable_power_gating(void *hif_ctx);
104 void hif_sdio_close(struct hif_softc *hif_sc);
105 QDF_STATUS hif_sdio_open(struct hif_softc *hif_sc,
106 			 enum qdf_bus_type bus_type);
107 void hif_ar6k_fetch_target_regs(struct hif_sdio_dev *hif_device,
108 				uint32_t *targregs);
109 QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
110 					 struct bmi_target_info *targ_info);
111 #endif /* __IF_SDIO_H__ */
112