2 * Copyright (C) 2011-2014 MediaTek Inc.
4 * This program is free software: you can redistribute it and/or modify it under the terms of the
5 * GNU General Public License version 2 as published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 * See the GNU General Public License for more details.
11 * You should have received a copy of the GNU General Public License along with this program.
12 * If not, see <http://www.gnu.org/licenses/>.
16 \brief Declaration of library functions
18 Any definitions in this file will be shared among GLUE Layer and internal Driver Stack.
25 #include "osal_typedef.h"
27 #include <mach/mtk_wcn_cmb_stub.h>
29 //#include "mtk_wcn_consys_hw.h"
32 /*******************************************************************************
33 * C O M P I L E R F L A G S
34 ********************************************************************************
37 /*******************************************************************************
39 ********************************************************************************
43 #if 1 /* moved from wmt_exp.h */
45 #define DFT_TAG "[WMT-DFT]"
48 #define WMT_PLAT_LOG_LOUD 4
49 #define WMT_PLAT_LOG_DBG 3
50 #define WMT_PLAT_LOG_INFO 2
51 #define WMT_PLAT_LOG_WARN 1
52 #define WMT_PLAT_LOG_ERR 0
54 extern UINT32 wmtPlatLogLvl
;
56 #define WMT_PLAT_LOUD_FUNC(fmt, arg...) if(wmtPlatLogLvl >= WMT_PLAT_LOG_LOUD) { printk(KERN_DEBUG DFT_TAG "[L]%s:" fmt, __FUNCTION__ ,##arg);}
57 #define WMT_PLAT_INFO_FUNC(fmt, arg...) if(wmtPlatLogLvl >= WMT_PLAT_LOG_INFO) { printk(KERN_ERR DFT_TAG "[I]%s:" fmt, __FUNCTION__ ,##arg);}
58 #define WMT_PLAT_WARN_FUNC(fmt, arg...) if(wmtPlatLogLvl >= WMT_PLAT_LOG_WARN) { printk(KERN_WARNING DFT_TAG "[W]%s:" fmt, __FUNCTION__ ,##arg);}
59 #define WMT_PLAT_ERR_FUNC(fmt, arg...) if(wmtPlatLogLvl >= WMT_PLAT_LOG_ERR) { printk(KERN_ERR DFT_TAG "[E]%s(%d):" fmt, __FUNCTION__ , __LINE__, ##arg);}
60 #define WMT_PLAT_DBG_FUNC(fmt, arg...) if(wmtPlatLogLvl >= WMT_PLAT_LOG_DBG) { printk(KERN_DEBUG DFT_TAG "[D]%s:" fmt, __FUNCTION__ ,##arg);}
65 #define CFG_WMT_PS_SUPPORT 1 /* moved from wmt_exp.h */
66 #define CFG_WMT_DUMP_INT_STATUS 0
67 #define CONSYS_ENALBE_SET_JTAG 1
68 #define CONSYS_WMT_REG_SUSPEND_CB_ENABLE 0
70 /*******************************************************************************
72 ********************************************************************************
75 /*******************************************************************************
77 ********************************************************************************
80 typedef enum _ENUM_FUNC_STATE_
{
86 } ENUM_FUNC_STATE
, *P_ENUM_FUNC_STATE
;
88 typedef enum _ENUM_PIN_ID_
{
93 #if CFG_WMT_LTE_COEX_HANDLING
97 } ENUM_PIN_ID
, *P_ENUM_PIN_ID
;
99 typedef enum _ENUM_PIN_STATE_
{
106 PIN_STA_EINT_DIS
= 6,
110 } ENUM_PIN_STATE
, *P_ENUM_PIN_STATE
;
112 typedef enum _CMB_IF_TYPE_
{
114 CMB_IF_WIFI_SDIO
= 1,
116 CMB_IF_BGWF_SDIO
= 3,
118 } CMB_IF_TYPE
, *P_CMB_IF_TYPE
;
120 typedef INT32 (*fp_set_pin
)(ENUM_PIN_STATE
);
122 typedef enum _ENUM_WL_OP_
{
126 } ENUM_WL_OP
, *P_ENUM_WL_OP
;
128 typedef enum _ENUM_PALDO_TYPE_
{
133 PMIC_CHIPID_PALDO
= 4,
136 }ENUM_PALDO_TYPE
,*P_ENUM_PALDO_TYPE
;
138 typedef enum _ENUM_PALDO_OP_
{
142 }ENUM_PALDO_OP
,*P_ENUM_PALDO_OP
;
144 typedef enum _ENUM_HOST_DUMP_STATE_T
{
145 STP_HOST_DUMP_NOT_START
= 0,
146 STP_HOST_DUMP_GET
= 1,
147 STP_HOST_DUMP_GET_DONE
= 2,
148 STP_HOST_DUMP_END
= 3,
150 }ENUM_HOST_DUMP_STATE
,*P_ENUM_HOST_DUMP_STATE_T
;
152 typedef enum _ENUM_FORCE_TRG_ASSERT_T
{
153 STP_FORCE_TRG_ASSERT_EMI
= 0,
154 STP_FORCE_TRG_ASSERT_DEBUG_PIN
= 1,
155 STP_FORCE_TRG_ASSERT_MAX
= 2
156 }ENUM_FORCE_TRG_ASSERT_T
,*P_ENUM_FORCE_TRG_ASSERT_T
;
158 typedef enum _ENUM_CHIP_DUMP_STATE_T
{
159 STP_CHIP_DUMP_NOT_START
= 0,
160 STP_CHIP_DUMP_PUT
= 1,
161 STP_CHIP_DUMP_PUT_DONE
= 2,
162 STP_CHIP_DUMP_END
= 3,
164 }ENUM_CHIP_DUMP_STATE
,*P_ENUM_CHIP_DUMP_STATE_T
;
166 typedef struct _EMI_CTRL_STATE_OFFSET_
{
167 UINT32 emi_apmem_ctrl_state
;
168 UINT32 emi_apmem_ctrl_host_sync_state
;
169 UINT32 emi_apmem_ctrl_host_sync_num
;
170 UINT32 emi_apmem_ctrl_chip_sync_state
;
171 UINT32 emi_apmem_ctrl_chip_sync_num
;
172 UINT32 emi_apmem_ctrl_chip_sync_addr
;
173 UINT32 emi_apmem_ctrl_chip_sync_len
;
174 UINT32 emi_apmem_ctrl_chip_print_buff_start
;
175 UINT32 emi_apmem_ctrl_chip_print_buff_len
;
176 UINT32 emi_apmem_ctrl_chip_print_buff_idx
;
177 UINT32 emi_apmem_ctrl_chip_int_status
;
178 UINT32 emi_apmem_ctrl_chip_paded_dump_end
;
179 UINT32 emi_apmem_ctrl_host_outband_assert_w1
;
180 }EMI_CTRL_STATE_OFFSET
, *P_EMI_CTRL_STATE_OFFSET
;
182 typedef struct _BGF_IRQ_BALANCE_
{
186 }BGF_IRQ_BALANCE
,*P_BGF_IRQ_BALANCE
;
188 typedef struct _CONSYS_EMI_ADDR_INFO_
{
190 UINT32 paged_trace_off
;
191 UINT32 paged_dump_off
;
192 UINT32 full_dump_off
;
193 P_EMI_CTRL_STATE_OFFSET p_emi_ctrl_state_offset
;
194 }CONSYS_EMI_ADDR_INFO
,*P_CONSYS_EMI_ADDR_INFO
;
196 typedef struct _GPIO_TDM_REQ_INFO_
{
197 UINT32 ant_sel_index
;
200 }GPIO_TDM_REQ_INFO
,*P_GPIO_TDM_REQ_INFO
;
202 typedef VOID (*irq_cb
)(VOID
);
203 typedef INT32 (*device_audio_if_cb
) (CMB_STUB_AIF_X aif
, MTK_WCN_BOOL share
);
204 typedef VOID (*func_ctrl_cb
)(UINT32 on
,UINT32 type
);
205 typedef long (*thermal_query_ctrl_cb
)(VOID
);
206 typedef INT32 (*deep_idle_ctrl_cb
)(UINT32
);
208 /*******************************************************************************
209 * E X T E R N A L R E F E R E N C E S
210 ********************************************************************************
213 /*******************************************************************************
214 * P U B L I C D A T A
215 ********************************************************************************
217 extern UINT32 gWmtDbgLvl
;
220 /*******************************************************************************
221 * P R I V A T E D A T A
222 ********************************************************************************
225 /*******************************************************************************
226 * F U N C T I O N D E C L A R A T I O N S
227 ********************************************************************************
231 wmt_plat_init (UINT32 co_clock_en
);
234 wmt_plat_deinit (VOID
);
239 ENUM_FUNC_STATE state
257 wmt_plat_wake_lock_ctrl(
263 wmt_plat_audio_ctrl (
264 CMB_STUB_AIF_X state
,
265 CMB_STUB_AIF_CTRL ctrl
268 VOID
wmt_plat_irq_cb_reg (irq_cb bgf_irq_cb
);
269 VOID
wmt_plat_aif_cb_reg (device_audio_if_cb aif_ctrl_cb
);
270 VOID
wmt_plat_func_ctrl_cb_reg(func_ctrl_cb subsys_func_ctrl
);
271 VOID
wmt_plat_thermal_ctrl_cb_reg(thermal_query_ctrl_cb thermal_query_ctrl
);
272 VOID
wmt_plat_deep_idle_ctrl_cb_reg(deep_idle_ctrl_cb deep_idle_ctrl
);
274 INT32
wmt_plat_soc_paldo_ctrl(ENUM_PALDO_TYPE ePt
,ENUM_PALDO_OP ePo
);
275 UINT8
*wmt_plat_get_emi_virt_add(UINT32 offset
);
276 #if CONSYS_ENALBE_SET_JTAG
277 UINT32
wmt_plat_jtag_flag_ctrl(UINT32 en
);
279 #if CONSYS_WMT_REG_SUSPEND_CB_ENABLE
280 UINT32
wmt_plat_soc_osc_en_ctrl(UINT32 en
);
282 #if CFG_WMT_DUMP_INT_STATUS
283 VOID
wmt_plat_BGF_irq_dump_status(VOID
);
285 P_CONSYS_EMI_ADDR_INFO
wmt_plat_get_emi_phy_add(VOID
);
286 UINT32
wmt_plat_read_cpupcr(VOID
);
287 UINT32
wmt_plat_read_dmaregs(UINT32
);
288 INT32
wmt_plat_set_host_dump_state(ENUM_HOST_DUMP_STATE state
);
289 UINT32
wmt_plat_force_trigger_assert(ENUM_FORCE_TRG_ASSERT_T type
);
290 INT32
wmt_plat_update_host_sync_num(VOID
);
291 INT32
wmt_plat_get_dump_info(UINT32 offset
);
292 UINT32
wmt_plat_get_soc_chipid(VOID
);
293 #if CFG_WMT_LTE_COEX_HANDLING
294 INT32
wmt_plat_get_tdm_antsel_index(VOID
);
296 /*******************************************************************************
298 ********************************************************************************
301 #endif /* _WMT_PLAT_H_ */