1 /** @file moal_sdio.h 2 * 3 * @brief This file contains definitions for SDIO interface. 4 * driver. 5 * 6 * Copyright (C) 2008-2017, Marvell International Ltd. 7 * 8 * This software file (the "File") is distributed by Marvell International 9 * Ltd. under the terms of the GNU General Public License Version 2, June 1991 10 * (the "License"). You may use, redistribute and/or modify this File in 11 * accordance with the terms and conditions of the License, a copy of which 12 * is available by writing to the Free Software Foundation, Inc., 13 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the 14 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 15 * 16 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE 18 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about 19 * this warranty disclaimer. 20 * 21 */ 22 /**************************************************** 23 Change log: 24 ****************************************************/ 25 26 #ifndef _MOAL_SDIO_H 27 #define _MOAL_SDIO_H 28 29 #include <linux/mmc/sdio.h> 30 #include <linux/mmc/sdio_ids.h> 31 #include <linux/mmc/sdio_func.h> 32 #include <linux/mmc/card.h> 33 #include <linux/mmc/host.h> 34 35 #include "moal_main.h" 36 37 #ifndef BLOCK_MODE 38 /** Block mode */ 39 #define BLOCK_MODE 1 40 #endif 41 42 #ifndef BYTE_MODE 43 /** Byte Mode */ 44 #define BYTE_MODE 0 45 #endif 46 47 #ifndef FIXED_ADDRESS 48 /** Fixed address mode */ 49 #define FIXED_ADDRESS 0 50 #endif 51 52 #define SD8977_V0 0x0 53 #define SD8977_V1 0x8 54 #define SD8977_V2 0x9 55 #define SD8977_V0_FW_NAME "mrvl/sdsd8977_combo.bin" 56 #define SD8977_V1_FW_NAME "mrvl/sdsd8977_combo_v1.bin" 57 #define SD8977_V2_FW_NAME "mrvl/sdsd8977_combo_v2.bin" 58 #define SD8977_WLAN_V2_FW_NAME "mrvl/sd8977_wlan_v2.bin" 59 #define SD8977_WLAN_V1_FW_NAME "mrvl/sd8977_wlan_v1.bin" 60 #define SD8977_WLAN_V0_FW_NAME "mrvl/sd8977_wlan.bin" 61 62 #ifdef STA_SUPPORT 63 /** Default firmware name */ 64 65 #define DEFAULT_FW_NAME "mrvl/sdsd8977_combo.bin" 66 67 #ifndef DEFAULT_FW_NAME 68 #define DEFAULT_FW_NAME "" 69 #endif 70 #endif /* STA_SUPPORT */ 71 72 #ifdef UAP_SUPPORT 73 /** Default firmware name */ 74 75 #define DEFAULT_AP_FW_NAME "mrvl/sdsd8977_combo.bin" 76 #define DEFAULT_WLAN_FW_NAME "mrvl/sd8977_wlan.bin" 77 78 #ifndef DEFAULT_AP_FW_NAME 79 #define DEFAULT_AP_FW_NAME "" 80 #endif 81 #endif /* UAP_SUPPORT */ 82 83 /** Default firmaware name */ 84 85 #define DEFAULT_AP_STA_FW_NAME "mrvl/sdsd8977_combo.bin" 86 #define DEFAULT_WLAN_FW_NAME "mrvl/sd8977_wlan.bin" 87 88 #ifndef DEFAULT_AP_STA_FW_NAME 89 #define DEFAULT_AP_STA_FW_NAME "" 90 #endif 91 92 /******************************************************** 93 Global Functions 94 ********************************************************/ 95 96 /** Function to write register */ 97 mlan_status woal_write_reg(moal_handle *handle, t_u32 reg, t_u32 data); 98 /** Function to read register */ 99 mlan_status woal_read_reg(moal_handle *handle, t_u32 reg, t_u32 *data); 100 /** Function to write data to IO memory */ 101 mlan_status woal_write_data_sync(moal_handle *handle, mlan_buffer *pmbuf, 102 t_u32 port, t_u32 timeout); 103 /** Function to read data from IO memory */ 104 mlan_status woal_read_data_sync(moal_handle *handle, mlan_buffer *pmbuf, 105 t_u32 port, t_u32 timeout); 106 107 /** Register to bus driver function */ 108 mlan_status woal_bus_register(void); 109 /** Unregister from bus driver function */ 110 void woal_bus_unregister(void); 111 112 /** Register device function */ 113 mlan_status woal_register_dev(moal_handle *handle); 114 /** Unregister device function */ 115 void woal_unregister_dev(moal_handle *handle); 116 117 int woal_sdio_set_bus_clock(moal_handle *handle, t_u8 option); 118 119 #ifdef SDIO_SUSPEND_RESUME 120 #ifdef MMC_PM_FUNC_SUSPENDED 121 /** Notify SDIO bus driver that WLAN is suspended */ 122 void woal_wlan_is_suspended(moal_handle *handle); 123 #endif 124 /** SDIO Suspend */ 125 int woal_sdio_suspend(struct device *dev); 126 /** SDIO Resume */ 127 int woal_sdio_resume(struct device *dev); 128 #endif /* SDIO_SUSPEND_RESUME */ 129 130 /** Structure: SDIO MMC card */ 131 struct sdio_mmc_card { 132 /** sdio_func structure pointer */ 133 struct sdio_func *func; 134 /** moal_handle structure pointer */ 135 moal_handle *handle; 136 /** saved host clock value */ 137 unsigned int host_clock; 138 }; 139 140 /** cmd52 read write */ 141 int woal_sdio_read_write_cmd52(moal_handle *handle, int func, int reg, int val); 142 143 #endif /* _MOAL_SDIO_H */ 144