xref: /wlan-driver/qca-wifi-host-cmn/hif/src/sdio/hif_sdio_dev.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2013-2016, 2018-2019 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 HIF_SDIO_DEV_H_
20*5113495bSYour Name #define HIF_SDIO_DEV_H_
21*5113495bSYour Name 
22*5113495bSYour Name #include "qdf_net_types.h"
23*5113495bSYour Name #include "a_types.h"
24*5113495bSYour Name #include "athdefs.h"
25*5113495bSYour Name #include "a_osapi.h"
26*5113495bSYour Name #include <hif.h>
27*5113495bSYour Name #include "athstartpack.h"
28*5113495bSYour Name #include "hif_internal.h"
29*5113495bSYour Name #include "if_sdio.h"
30*5113495bSYour Name 
31*5113495bSYour Name struct hif_sdio_device *hif_dev_from_hif(struct hif_sdio_dev *hif_device);
32*5113495bSYour Name 
33*5113495bSYour Name struct hif_sdio_device *hif_dev_create(struct hif_sdio_dev *hif_device,
34*5113495bSYour Name 				struct hif_msg_callbacks *callbacks,
35*5113495bSYour Name 				void *target);
36*5113495bSYour Name 
37*5113495bSYour Name void hif_dev_destroy(struct hif_sdio_device *htc_sdio_device);
38*5113495bSYour Name 
39*5113495bSYour Name QDF_STATUS hif_dev_setup(struct hif_sdio_device *htc_sdio_device);
40*5113495bSYour Name 
41*5113495bSYour Name QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *htc_sdio_device);
42*5113495bSYour Name 
43*5113495bSYour Name QDF_STATUS hif_dev_disable_interrupts(struct hif_sdio_device *htc_sdio_device);
44*5113495bSYour Name 
45*5113495bSYour Name QDF_STATUS hif_dev_send_buffer(struct hif_sdio_device *htc_sdio_device,
46*5113495bSYour Name 			     unsigned int transfer_id, uint8_t pipe,
47*5113495bSYour Name 			     unsigned int nbytes, qdf_nbuf_t buf);
48*5113495bSYour Name 
49*5113495bSYour Name QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
50*5113495bSYour Name 					bool *done,
51*5113495bSYour Name 					bool *async_processing);
52*5113495bSYour Name 
53*5113495bSYour Name void hif_dev_mask_interrupts(struct hif_sdio_device *pdev);
54*5113495bSYour Name 
55*5113495bSYour Name QDF_STATUS hif_dev_map_service_to_pipe(struct hif_sdio_dev *pdev,
56*5113495bSYour Name 				       uint16_t service_id,
57*5113495bSYour Name 				       uint8_t *ul_pipe,
58*5113495bSYour Name 				       uint8_t *dl_pipe);
59*5113495bSYour Name 
60*5113495bSYour Name void hif_dev_unmask_interrupts(struct hif_sdio_device *pdev);
61*5113495bSYour Name 
62*5113495bSYour Name int hif_dev_setup_device(struct hif_sdio_device *pdev);
63*5113495bSYour Name 
64*5113495bSYour Name int hif_dev_get_fifo_address(struct hif_sdio_dev *pdev,
65*5113495bSYour Name 			     void *config,
66*5113495bSYour Name 			     uint32_t config_len);
67*5113495bSYour Name 
68*5113495bSYour Name void hif_dev_get_block_size(void *config);
69*5113495bSYour Name 
70*5113495bSYour Name void hif_dev_set_mailbox_swap(struct hif_sdio_dev *pdev);
71*5113495bSYour Name 
72*5113495bSYour Name bool hif_dev_get_mailbox_swap(struct hif_sdio_dev *pdev);
73*5113495bSYour Name 
74*5113495bSYour Name QDF_STATUS hif_read_write(struct hif_sdio_dev *device, unsigned long address,
75*5113495bSYour Name 			  char *buffer,	uint32_t length, uint32_t request,
76*5113495bSYour Name 			  void *context);
77*5113495bSYour Name 
78*5113495bSYour Name #ifdef CONFIG_SDIO_TRANSFER_MAILBOX
get_hif_device(struct hif_softc * hif_ctx,struct sdio_func * func)79*5113495bSYour Name static inline struct hif_sdio_dev *get_hif_device(struct hif_softc *hif_ctx,
80*5113495bSYour Name 						  struct sdio_func *func)
81*5113495bSYour Name {
82*5113495bSYour Name 	qdf_assert(func);
83*5113495bSYour Name 	return (struct hif_sdio_dev *)sdio_get_drvdata(func);
84*5113495bSYour Name }
85*5113495bSYour Name 
86*5113495bSYour Name /**
87*5113495bSYour Name  * hif_sdio_set_drvdata() - set wlan driver data into upper layer private
88*5113495bSYour Name  * @hif_ctx: HIF object
89*5113495bSYour Name  * @func: pointer to sdio function
90*5113495bSYour Name  * @hifdevice: pointer to hif device
91*5113495bSYour Name  *
92*5113495bSYour Name  * Return: zero for success.
93*5113495bSYour Name  */
hif_sdio_set_drvdata(struct hif_softc * hif_ctx,struct sdio_func * func,struct hif_sdio_dev * hifdevice)94*5113495bSYour Name static inline int hif_sdio_set_drvdata(struct hif_softc *hif_ctx,
95*5113495bSYour Name 				       struct sdio_func *func,
96*5113495bSYour Name 				       struct hif_sdio_dev *hifdevice)
97*5113495bSYour Name {
98*5113495bSYour Name 	sdio_set_drvdata(func, hifdevice);
99*5113495bSYour Name 	return 0;
100*5113495bSYour Name }
101*5113495bSYour Name 
hif_dev_configure_pipes(struct hif_sdio_dev * pdev,struct sdio_func * func)102*5113495bSYour Name static inline int hif_dev_configure_pipes(struct hif_sdio_dev *pdev,
103*5113495bSYour Name 					  struct sdio_func *func)
104*5113495bSYour Name {
105*5113495bSYour Name 	return 0;
106*5113495bSYour Name }
107*5113495bSYour Name 
hif_dev_register_channels(struct hif_sdio_dev * dev,struct sdio_func * func)108*5113495bSYour Name static inline int hif_dev_register_channels(struct hif_sdio_dev *dev,
109*5113495bSYour Name 					    struct sdio_func *func)
110*5113495bSYour Name {
111*5113495bSYour Name 	return 0;
112*5113495bSYour Name }
113*5113495bSYour Name 
hif_dev_unregister_channels(struct hif_sdio_dev * dev,struct sdio_func * func)114*5113495bSYour Name static inline void hif_dev_unregister_channels(struct hif_sdio_dev *dev,
115*5113495bSYour Name 					       struct sdio_func *func)
116*5113495bSYour Name {
117*5113495bSYour Name }
118*5113495bSYour Name #else
get_hif_device(struct hif_softc * hif_ctx,struct sdio_func * func)119*5113495bSYour Name static inline struct hif_sdio_dev *get_hif_device(struct hif_softc *hif_ctx,
120*5113495bSYour Name 						  struct sdio_func *func)
121*5113495bSYour Name {
122*5113495bSYour Name 	struct hif_sdio_softc *scn = (struct hif_sdio_softc *)hif_ctx;
123*5113495bSYour Name 
124*5113495bSYour Name 	return (struct hif_sdio_dev *)scn->hif_handle;
125*5113495bSYour Name }
126*5113495bSYour Name 
127*5113495bSYour Name /**
128*5113495bSYour Name  * hif_sdio_set_drvdata() - set wlan driver data into upper layer private
129*5113495bSYour Name  * @hif_ctx: HIF object
130*5113495bSYour Name  * @func: pointer to sdio function
131*5113495bSYour Name  * @hifdevice: pointer to hif device
132*5113495bSYour Name  *
133*5113495bSYour Name  * Return: zero for success.
134*5113495bSYour Name  */
hif_sdio_set_drvdata(struct hif_softc * hif_ctx,struct sdio_func * func,struct hif_sdio_dev * hifdevice)135*5113495bSYour Name static inline int hif_sdio_set_drvdata(struct hif_softc *hif_ctx,
136*5113495bSYour Name 				       struct sdio_func *func,
137*5113495bSYour Name 				       struct hif_sdio_dev *hifdevice)
138*5113495bSYour Name {
139*5113495bSYour Name 	struct hif_sdio_softc *sc = (struct hif_sdio_softc *)hif_ctx;
140*5113495bSYour Name 
141*5113495bSYour Name 	sc->hif_handle = hifdevice;
142*5113495bSYour Name 
143*5113495bSYour Name 	return 0;
144*5113495bSYour Name }
145*5113495bSYour Name 
146*5113495bSYour Name int hif_dev_configure_pipes(struct hif_sdio_dev *pdev,
147*5113495bSYour Name 			    struct sdio_func *func);
148*5113495bSYour Name 
149*5113495bSYour Name int hif_dev_register_channels(struct hif_sdio_dev *dev,
150*5113495bSYour Name 			      struct sdio_func *func);
151*5113495bSYour Name 
152*5113495bSYour Name void hif_dev_unregister_channels(struct hif_sdio_dev *dev,
153*5113495bSYour Name 				 struct sdio_func *func);
154*5113495bSYour Name #endif /* SDIO_TRANSFER */
155*5113495bSYour Name QDF_STATUS hif_enable_func(struct hif_softc *ol_sc, struct hif_sdio_dev *device,
156*5113495bSYour Name 			   struct sdio_func *func, bool resume);
157*5113495bSYour Name QDF_STATUS hif_disable_func(struct hif_sdio_dev *device,
158*5113495bSYour Name 			    struct sdio_func *func,
159*5113495bSYour Name 			    bool reset);
160*5113495bSYour Name A_STATUS hif_sdio_probe(struct hif_softc *ol_sc,
161*5113495bSYour Name 			struct sdio_func *func,
162*5113495bSYour Name 			struct hif_sdio_dev *device);
163*5113495bSYour Name #endif /* HIF_SDIO_DEV_H_ */
164