xref: /wlan-driver/qca-wifi-host-cmn/hif/src/sdio/if_sdio.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name #ifndef __IF_SDIO_H__
20*5113495bSYour Name #define __IF_SDIO_H__
21*5113495bSYour Name 
22*5113495bSYour Name #include <linux/version.h>
23*5113495bSYour Name #include <linux/semaphore.h>
24*5113495bSYour Name #include <linux/interrupt.h>
25*5113495bSYour Name #include <osdep.h>
26*5113495bSYour Name #include <ol_if_athvar.h>
27*5113495bSYour Name #include <athdefs.h>
28*5113495bSYour Name #include "a_osapi.h"
29*5113495bSYour Name #include "pld_sdio.h"
30*5113495bSYour Name #include "hif_internal.h"
31*5113495bSYour Name 
32*5113495bSYour Name 
33*5113495bSYour Name #define AR6320_HEADERS_DEF
34*5113495bSYour Name 
35*5113495bSYour Name #define ATH_DBG_DEFAULT   0
36*5113495bSYour Name 
37*5113495bSYour Name #define RAMDUMP_ADDR     0x8F000000
38*5113495bSYour Name #define RAMDUMP_SIZE     0x700000
39*5113495bSYour Name 
40*5113495bSYour Name struct hif_sdio_softc {
41*5113495bSYour Name 	struct hif_softc ol_sc;
42*5113495bSYour Name 	struct device *dev;
43*5113495bSYour Name 	/*
44*5113495bSYour Name 	 * Guard changes to Target HW state and to software
45*5113495bSYour Name 	 * structures that track hardware state.
46*5113495bSYour Name 	 */
47*5113495bSYour Name 	spinlock_t target_lock;
48*5113495bSYour Name 	void *hif_handle;
49*5113495bSYour Name 	void *ramdump_base;
50*5113495bSYour Name 	unsigned long ramdump_address;
51*5113495bSYour Name 	unsigned long ramdump_size;
52*5113495bSYour Name 	struct targetdef_s *targetdef;
53*5113495bSYour Name 	struct hostdef_s *hostdef;
54*5113495bSYour Name };
55*5113495bSYour Name 
56*5113495bSYour Name #if defined(CONFIG_ATH_PROCFS_DIAG_SUPPORT)
57*5113495bSYour Name int athdiag_procfs_init(void *scn);
58*5113495bSYour Name void athdiag_procfs_remove(void);
59*5113495bSYour Name #else
athdiag_procfs_init(void * scn)60*5113495bSYour Name static inline int athdiag_procfs_init(void *scn)
61*5113495bSYour Name {
62*5113495bSYour Name 	return 0;
63*5113495bSYour Name }
64*5113495bSYour Name 
athdiag_procfs_remove(void)65*5113495bSYour Name static inline void athdiag_procfs_remove(void)
66*5113495bSYour Name {
67*5113495bSYour Name }
68*5113495bSYour Name #endif
69*5113495bSYour Name 
70*5113495bSYour Name #define DMA_MAPPING_ERROR(dev, addr) dma_mapping_error((dev), (addr))
71*5113495bSYour Name 
72*5113495bSYour Name int ath_sdio_probe(void *context, void *hif_handle);
73*5113495bSYour Name void ath_sdio_remove(void *context, void *hif_handle);
74*5113495bSYour Name int ath_sdio_suspend(void *context);
75*5113495bSYour Name int ath_sdio_resume(void *context);
76*5113495bSYour Name 
77*5113495bSYour Name /*These functions are exposed to HDD*/
78*5113495bSYour Name void hif_init_qdf_ctx(qdf_device_t qdf_dev, void *ol_sc);
79*5113495bSYour Name void hif_deinit_qdf_ctx(void *ol_sc);
80*5113495bSYour Name 
81*5113495bSYour Name /**
82*5113495bSYour Name  * hif_sdio_device_inserted() - Wrapper function for hif-sdio driver probe
83*5113495bSYour Name  * handler
84*5113495bSYour Name  * @ol_sc: HIF device context
85*5113495bSYour Name  * @dev: pointer to device structure
86*5113495bSYour Name  * @id: pointer to sdio_device_id
87*5113495bSYour Name  *
88*5113495bSYour Name  * Return: QDF_STATUS
89*5113495bSYour Name  */
90*5113495bSYour Name QDF_STATUS hif_sdio_device_inserted(struct hif_softc *ol_sc,
91*5113495bSYour Name 				    struct device *dev,
92*5113495bSYour Name 				    const struct sdio_device_id *id);
93*5113495bSYour Name 
94*5113495bSYour Name void hif_sdio_stop(struct hif_softc *hif_ctx);
95*5113495bSYour Name void hif_sdio_shutdown(struct hif_softc *hif_ctx);
96*5113495bSYour Name void hif_sdio_device_removed(struct hif_softc *hif_ctx, struct sdio_func *func);
97*5113495bSYour Name int hif_device_suspend(struct hif_softc *ol_sc, struct device *dev);
98*5113495bSYour Name int hif_device_resume(struct hif_softc *ol_sc, struct device *dev);
99*5113495bSYour Name void hif_register_tbl_attach(struct hif_softc *scn,
100*5113495bSYour Name 			     u32 hif_type);
101*5113495bSYour Name void target_register_tbl_attach(struct hif_softc *scn,
102*5113495bSYour Name 				u32 target_type);
103*5113495bSYour Name void hif_enable_power_gating(void *hif_ctx);
104*5113495bSYour Name void hif_sdio_close(struct hif_softc *hif_sc);
105*5113495bSYour Name QDF_STATUS hif_sdio_open(struct hif_softc *hif_sc,
106*5113495bSYour Name 			 enum qdf_bus_type bus_type);
107*5113495bSYour Name void hif_ar6k_fetch_target_regs(struct hif_sdio_dev *hif_device,
108*5113495bSYour Name 				uint32_t *targregs);
109*5113495bSYour Name QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
110*5113495bSYour Name 					 struct bmi_target_info *targ_info);
111*5113495bSYour Name #endif /* __IF_SDIO_H__ */
112