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