xref: /wlan-dirver/qca-wifi-host-cmn/hif/src/sdio/if_sdio.h (revision 503663c6daafffe652fa360bde17243568cd6d2a)
1 /*
2  * Copyright (c) 2013-2019 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
60 static inline int athdiag_procfs_init(void *scn)
61 {
62 	return 0;
63 }
64 
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 int hif_sdio_device_inserted(struct hif_softc *ol_sc,
82 			     struct device *dev,
83 			     const struct sdio_device_id *id);
84 void hif_sdio_stop(struct hif_softc *hif_ctx);
85 void hif_sdio_shutdown(struct hif_softc *hif_ctx);
86 void hif_sdio_device_removed(struct hif_softc *hif_ctx, struct sdio_func *func);
87 int hif_device_suspend(struct hif_softc *ol_sc, struct device *dev);
88 int hif_device_resume(struct hif_softc *ol_sc, struct device *dev);
89 void hif_register_tbl_attach(struct hif_softc *scn,
90 			     u32 hif_type);
91 void target_register_tbl_attach(struct hif_softc *scn,
92 				u32 target_type);
93 void hif_enable_power_gating(void *hif_ctx);
94 void hif_sdio_close(struct hif_softc *hif_sc);
95 QDF_STATUS hif_sdio_open(struct hif_softc *hif_sc,
96 			 enum qdf_bus_type bus_type);
97 void hif_ar6k_fetch_target_regs(struct hif_sdio_dev *hif_device,
98 				uint32_t *targregs);
99 QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
100 					 struct bmi_target_info *targ_info);
101 #endif /* __IF_SDIO_H__ */
102