xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/nxp/mlinux/moal_sdio.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /** @file moal_sdio.h
2  *
3  * @brief This file contains definitions for SDIO interface.
4  * driver.
5  *
6  *
7  * Copyright 2008-2022 NXP
8  *
9  * This software file (the File) is distributed by NXP
10  * under the terms of the GNU General Public License Version 2, June 1991
11  * (the License).  You may use, redistribute and/or modify the File in
12  * accordance with the terms and conditions of the License, a copy of which
13  * is available by writing to the Free Software Foundation, Inc.,
14  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
15  * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
16  *
17  * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
19  * ARE EXPRESSLY DISCLAIMED.  The License provides additional details about
20  * this warranty disclaimer.
21  *
22  */
23 /****************************************************
24 Change log:
25 ****************************************************/
26 
27 #ifndef _MOAL_SDIO_H
28 #define _MOAL_SDIO_H
29 
30 #include <linux/mmc/sdio.h>
31 #include <linux/mmc/sdio_ids.h>
32 #include <linux/mmc/sdio_func.h>
33 #include <linux/mmc/card.h>
34 #include <linux/mmc/host.h>
35 
36 #include "moal_main.h"
37 
38 #ifndef BLOCK_MODE
39 /** Block mode */
40 #define BLOCK_MODE 1
41 #endif
42 
43 #ifndef BYTE_MODE
44 /** Byte Mode */
45 #define BYTE_MODE 0
46 #endif
47 
48 #ifndef FIXED_ADDRESS
49 /** Fixed address mode */
50 #define FIXED_ADDRESS 0
51 #endif
52 
53 #if defined(SD8977)
54 #define SD8977_V0 0x0
55 #define SD8977_V1 0x8
56 #define SD8977_V2 0x9
57 #define SD8977_V0_FW_NAME "nxp/sdsd8977_combo.bin"
58 #define SD8977_V1_FW_NAME "nxp/sdsd8977_combo_v1.bin"
59 #define SD8977_V2_FW_NAME "nxp/sdsd8977_combo_v2.bin"
60 #define SD8977_WLAN_V2_FW_NAME "nxp/sd8977_wlan_v2.bin"
61 #define SD8977_WLAN_V1_FW_NAME "nxp/sd8977_wlan_v1.bin"
62 #define SD8977_WLAN_V0_FW_NAME "nxp/sd8977_wlan.bin"
63 #endif /* SD8977_MULTI_FW */
64 
65 #if defined(SD8887)
66 /** SD8887 chip revision ID */
67 #define SD8887_A0 0x0
68 #define SD8887_A2 0x2
69 
70 #define SD8887_A0_FW_NAME "nxp/sd8887_uapsta.bin"
71 #define SD8887_A2_FW_NAME "nxp/sd8887_uapsta_a2.bin"
72 #define SD8887_WLAN_A2_FW_NAME "nxp/sd8887_wlan_a2.bin"
73 #define SD8887_WLAN_A0_FW_NAME "nxp/sd8887_wlan.bin"
74 #endif /* SD8887_MULTI_FW */
75 
76 #ifdef SD8801
77 #define SD8801_DEFAULT_WLAN_FW_NAME "nxp/sd8801_uapsta.bin"
78 #endif /* SD8801 */
79 
80 /** Default firmware name */
81 #ifdef SD8887
82 #define SD8887_DEFAULT_COMBO_FW_NAME "nxp/sd8887_uapsta_a2.bin"
83 #define SD8887_DEFAULT_WLAN_FW_NAME "nxp/sd8887_wlan_a2.bin"
84 #endif /* SD8887 */
85 
86 #ifdef SD8977
87 #define SD8977_DEFAULT_COMBO_FW_NAME "nxp/sdsd8977_combo_v2.bin"
88 #define SD8977_DEFAULT_WLAN_FW_NAME "nxp/sd8977_wlan_v2.bin"
89 #endif /* SD8977 */
90 
91 #ifdef SD8997
92 #define SD8997_DEFAULT_COMBO_FW_NAME "nxp/sdsd8997_combo_v4.bin"
93 #define SDUART8997_DEFAULT_COMBO_FW_NAME "nxp/sduart8997_combo_v4.bin"
94 #define SDSD8997_DEFAULT_COMBO_FW_NAME "nxp/sdsd8997_combo_v4.bin"
95 #define SD8997_DEFAULT_WLAN_FW_NAME "nxp/sd8997_wlan_v4.bin"
96 #endif /* SD8997 */
97 
98 #ifdef SD8987
99 #define SD8987_DEFAULT_COMBO_FW_NAME "nxp/sdsd8987_combo.bin"
100 #define SDUART8987_DEFAULT_COMBO_FW_NAME "nxp/sduart8987_combo.bin"
101 #define SDSD8987_DEFAULT_COMBO_FW_NAME "nxp/sdsd8987_combo.bin"
102 #define SD8987_DEFAULT_WLAN_FW_NAME "nxp/sd8987_wlan.bin"
103 #endif /* SD8987 */
104 
105 #ifdef SD8897
106 #define SD8897_DEFAULT_COMBO_FW_NAME "nxp/sdsd8897_uapsta.bin"
107 #define SD8897_DEFAULT_WLAN_FW_NAME "nxp/sd8897_wlan.bin"
108 #endif /* SD8897 */
109 
110 #ifdef SD8978
111 #define SD8978_DEFAULT_COMBO_FW_NAME "nxp/sdsdiw416_combo.bin"
112 #define SDUART8978_DEFAULT_COMBO_FW_NAME "nxp/sduartiw416_combo.bin"
113 #define SDSD8978_DEFAULT_COMBO_FW_NAME "nxp/sdsdiw416_combo.bin"
114 #define SD8978_DEFAULT_WLAN_FW_NAME "nxp/sdiw416_wlan.bin"
115 #endif /* SD8978 */
116 
117 #ifdef SD9098
118 #define SD9098_Z1Z2 0x00
119 #define SD9098_A0 0x01
120 #define SD9098_A1 0x02
121 #define SD9098_A2 0x03
122 #define SD9098_DEFAULT_COMBO_FW_NAME "nxp/sdsd9098_combo.bin"
123 #define SDUART9098_DEFAULT_COMBO_FW_NAME "nxp/sduart9098_combo.bin"
124 #define SDSD9098_DEFAULT_COMBO_FW_NAME "nxp/sdsd9098_combo.bin"
125 #define SD9098_DEFAULT_WLAN_FW_NAME "nxp/sd9098_wlan.bin"
126 #define SDUART9098_COMBO_V1_FW_NAME "nxp/sduart9098_combo_v1.bin"
127 #define SDSD9098_COMBO_V1_FW_NAME "nxp/sdsd9098_combo_v1.bin"
128 #define SD9098_WLAN_V1_FW_NAME "nxp/sd9098_wlan_v1.bin"
129 #endif /* SD9098 */
130 
131 #ifdef SD9097
132 #define SD9097_B0 0x01
133 #define SD9097_B1 0x02
134 #define SD9097_DEFAULT_COMBO_FW_NAME "nxp/sdsdiw620_combo_v1.bin"
135 
136 #define SD9097_DEFAULT_WLAN_FW_NAME "nxp/sdiw620_wlan_v1.bin"
137 #define SDUART9097_COMBO_V1_FW_NAME "nxp/sduartiw620_combo_v1.bin"
138 #define SDSD9097_COMBO_V1_FW_NAME "nxp/sdsdiw620_combo_v1.bin"
139 #define SD9097_WLAN_V1_FW_NAME "nxp/sdiw620_wlan_v1.bin"
140 #endif /* SD9097 */
141 
142 #ifdef SDNW62X
143 #define SDNW62X_DEFAULT_COMBO_FW_NAME "nxp/sdsd_nw62x.bin"
144 #define SDUARTNW62X_COMBO_FW_NAME "nxp/sduart_nw62x.bin"
145 #define SDSDNW62X_COMBO_FW_NAME "sdsd_nw62x.bin"
146 #define SDNW62X_DEFAULT_WLAN_FW_NAME "nxp/sd_nw62x.bin"
147 #endif /* SDNW62X */
148 
149 #ifdef SD9177
150 #define SD9177_A0 0x00
151 #define SD9177_A1 0x01
152 #define SD9177_DEFAULT_COMBO_FW_NAME "nxp/sdsd_nw61x.bin"
153 #define SD9177_DEFAULT_COMBO_V1_FW_NAME "nxp/sduart_nw61x_v1.bin"
154 #define SDUART9177_DEFAULT_COMBO_FW_NAME "nxp/sduart_nw61x.bin"
155 #define SDSD9177_DEFAULT_COMBO_FW_NAME "nxp/sdsd_nw61x.bin"
156 #define SD9177_DEFAULT_WLAN_FW_NAME "nxp/sd_w61x.bin"
157 #define SDUART9177_DEFAULT_COMBO_V1_FW_NAME "nxp/sduart_nw61x_v1.bin"
158 #define SDSD9177_DEFAULT_COMBO_V1_FW_NAME "nxp/sdsd_nw61x_v1.bin"
159 #define SD9177_DEFAULT_WLAN_V1_FW_NAME "nxp/sd_w61x_v1.bin"
160 #endif /* SD9177 */
161 
162 /********************************************************
163 		Global Functions
164 ********************************************************/
165 
166 /** Register to bus driver function */
167 mlan_status woal_sdiommc_bus_register(void);
168 /** Unregister from bus driver function */
169 void woal_sdiommc_bus_unregister(void);
170 
171 int woal_sdio_set_bus_clock(moal_handle *handle, t_u8 option);
172 
173 #ifdef SDIO_SUSPEND_RESUME
174 #ifdef MMC_PM_FUNC_SUSPENDED
175 /** Notify SDIO bus driver that WLAN is suspended */
176 void woal_wlan_is_suspended(moal_handle *handle);
177 #endif
178 /** SDIO Suspend */
179 int woal_sdio_suspend(struct device *dev);
180 /** SDIO Resume */
181 int woal_sdio_resume(struct device *dev);
182 #endif /* SDIO_SUSPEND_RESUME */
183 
184 #ifdef SDIO_MMC
185 /** Structure: SDIO MMC card */
186 struct sdio_mmc_card {
187 	/** sdio_func structure pointer */
188 	struct sdio_func *func;
189 	/** moal_handle structure pointer */
190 	moal_handle *handle;
191 	/** saved host clock value */
192 	unsigned int host_clock;
193 };
194 void woal_sdio_reset_hw(moal_handle *handle);
195 #endif /* SDIO_MMC */
196 
197 /** cmd52 read write */
198 int woal_sdio_read_write_cmd52(moal_handle *handle, int func, int reg, int val);
199 #endif /* _MOAL_SDIO_H */
200