1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Structure used by apps whose drivers access SDIO drivers. 3*4882a593Smuzhiyun * Pulled out separately so dhdu and wlu can both use it. 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Copyright (C) 1999-2017, Broadcom Corporation 8*4882a593Smuzhiyun * 9*4882a593Smuzhiyun * Unless you and Broadcom execute a separate written software license 10*4882a593Smuzhiyun * agreement governing use of this software, this software is licensed to you 11*4882a593Smuzhiyun * under the terms of the GNU General Public License version 2 (the "GPL"), 12*4882a593Smuzhiyun * available at http://www.broadcom.com/licenses/GPLv2.php, with the 13*4882a593Smuzhiyun * following added to such license: 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * As a special exception, the copyright holders of this software give you 16*4882a593Smuzhiyun * permission to link this software with independent modules, and to copy and 17*4882a593Smuzhiyun * distribute the resulting executable under terms of your choice, provided that 18*4882a593Smuzhiyun * you also meet, for each linked independent module, the terms and conditions of 19*4882a593Smuzhiyun * the license of that module. An independent module is a module which is not 20*4882a593Smuzhiyun * derived from this software. The special exception does not apply to any 21*4882a593Smuzhiyun * modifications of the software. 22*4882a593Smuzhiyun * 23*4882a593Smuzhiyun * Notwithstanding the above, under no circumstances may you combine this 24*4882a593Smuzhiyun * software in any way with any other Broadcom software provided under a license 25*4882a593Smuzhiyun * other than the GPL, without Broadcom's express prior written consent. 26*4882a593Smuzhiyun * 27*4882a593Smuzhiyun * 28*4882a593Smuzhiyun * <<Broadcom-WL-IPTag/Open:>> 29*4882a593Smuzhiyun * 30*4882a593Smuzhiyun * $Id: sdiovar.h 660496 2016-09-20 19:28:50Z $ 31*4882a593Smuzhiyun */ 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun #ifndef _sdiovar_h_ 34*4882a593Smuzhiyun #define _sdiovar_h_ 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun #include <typedefs.h> 37*4882a593Smuzhiyun 38*4882a593Smuzhiyun typedef struct sdreg { 39*4882a593Smuzhiyun int func; 40*4882a593Smuzhiyun int offset; 41*4882a593Smuzhiyun int value; 42*4882a593Smuzhiyun } sdreg_t; 43*4882a593Smuzhiyun 44*4882a593Smuzhiyun /* Common msglevel constants */ 45*4882a593Smuzhiyun #define SDH_ERROR_VAL 0x0001 /* Error */ 46*4882a593Smuzhiyun #define SDH_TRACE_VAL 0x0002 /* Trace */ 47*4882a593Smuzhiyun #define SDH_INFO_VAL 0x0004 /* Info */ 48*4882a593Smuzhiyun #define SDH_DEBUG_VAL 0x0008 /* Debug */ 49*4882a593Smuzhiyun #define SDH_DATA_VAL 0x0010 /* Data */ 50*4882a593Smuzhiyun #define SDH_CTRL_VAL 0x0020 /* Control Regs */ 51*4882a593Smuzhiyun #define SDH_LOG_VAL 0x0040 /* Enable bcmlog */ 52*4882a593Smuzhiyun #define SDH_DMA_VAL 0x0080 /* DMA */ 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun #define NUM_PREV_TRANSACTIONS 16 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun #ifdef BCMSPI 57*4882a593Smuzhiyun /* Error statistics for gSPI */ 58*4882a593Smuzhiyun struct spierrstats_t { 59*4882a593Smuzhiyun uint32 dna; /* The requested data is not available. */ 60*4882a593Smuzhiyun uint32 rdunderflow; /* FIFO underflow happened due to current (F2, F3) rd command */ 61*4882a593Smuzhiyun uint32 wroverflow; /* FIFO underflow happened due to current (F1, F2, F3) wr command */ 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun uint32 f2interrupt; /* OR of all F2 related intr status bits. */ 64*4882a593Smuzhiyun uint32 f3interrupt; /* OR of all F3 related intr status bits. */ 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun uint32 f2rxnotready; /* F2 FIFO is not ready to receive data (FIFO empty) */ 67*4882a593Smuzhiyun uint32 f3rxnotready; /* F3 FIFO is not ready to receive data (FIFO empty) */ 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun uint32 hostcmddataerr; /* Error in command or host data, detected by CRC/checksum 70*4882a593Smuzhiyun * (optional) 71*4882a593Smuzhiyun */ 72*4882a593Smuzhiyun uint32 f2pktavailable; /* Packet is available in F2 TX FIFO */ 73*4882a593Smuzhiyun uint32 f3pktavailable; /* Packet is available in F2 TX FIFO */ 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun uint32 dstatus[NUM_PREV_TRANSACTIONS]; /* dstatus bits of last 16 gSPI transactions */ 76*4882a593Smuzhiyun uint32 spicmd[NUM_PREV_TRANSACTIONS]; 77*4882a593Smuzhiyun }; 78*4882a593Smuzhiyun #endif /* BCMSPI */ 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun typedef struct sdio_bus_metrics { 81*4882a593Smuzhiyun uint32 active_dur; /* msecs */ 82*4882a593Smuzhiyun 83*4882a593Smuzhiyun /* Generic */ 84*4882a593Smuzhiyun uint32 data_intr_cnt; /* data interrupt counter */ 85*4882a593Smuzhiyun uint32 mb_intr_cnt; /* mailbox interrupt counter */ 86*4882a593Smuzhiyun uint32 error_intr_cnt; /* error interrupt counter */ 87*4882a593Smuzhiyun uint32 wakehost_cnt; /* counter for OOB wakehost */ 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun /* DS forcewake */ 90*4882a593Smuzhiyun uint32 ds_wake_on_cnt; /* counter for (clock) ON */ 91*4882a593Smuzhiyun uint32 ds_wake_on_dur; /* duration for (clock) ON) */ 92*4882a593Smuzhiyun uint32 ds_wake_off_cnt; /* counter for (clock) OFF */ 93*4882a593Smuzhiyun uint32 ds_wake_off_dur; /* duration for (clock) OFF */ 94*4882a593Smuzhiyun 95*4882a593Smuzhiyun /* DS_D0 state */ 96*4882a593Smuzhiyun uint32 ds_d0_cnt; /* counter for DS_D0 state */ 97*4882a593Smuzhiyun uint32 ds_d0_dur; /* duration for DS_D0 state */ 98*4882a593Smuzhiyun 99*4882a593Smuzhiyun /* DS_D3 state */ 100*4882a593Smuzhiyun uint32 ds_d3_cnt; /* counter for DS_D3 state */ 101*4882a593Smuzhiyun uint32 ds_d3_dur; /* duration for DS_D3 state */ 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun /* DS DEV_WAKE */ 104*4882a593Smuzhiyun uint32 ds_dw_assrt_cnt; /* counter for DW_ASSERT */ 105*4882a593Smuzhiyun uint32 ds_dw_dassrt_cnt; /* counter for DW_DASSERT */ 106*4882a593Smuzhiyun 107*4882a593Smuzhiyun /* DS mailbox signals */ 108*4882a593Smuzhiyun uint32 ds_tx_dsreq_cnt; /* counter for tx HMB_DATA_DSREQ */ 109*4882a593Smuzhiyun uint32 ds_tx_dsexit_cnt; /* counter for tx HMB_DATA_DSEXIT */ 110*4882a593Smuzhiyun uint32 ds_tx_d3ack_cnt; /* counter for tx HMB_DATA_D3ACK */ 111*4882a593Smuzhiyun uint32 ds_tx_d3exit_cnt; /* counter for tx HMB_DATA_D3EXIT */ 112*4882a593Smuzhiyun uint32 ds_rx_dsack_cnt; /* counter for rx SMB_DATA_DSACK */ 113*4882a593Smuzhiyun uint32 ds_rx_dsnack_cnt; /* counter for rx SMB_DATA_DSNACK */ 114*4882a593Smuzhiyun uint32 ds_rx_d3inform_cnt; /* counter for rx SMB_DATA_D3INFORM */ 115*4882a593Smuzhiyun } sdio_bus_metrics_t; 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun /* Bus interface info for SDIO */ 118*4882a593Smuzhiyun typedef struct wl_pwr_sdio_stats { 119*4882a593Smuzhiyun uint16 type; /* WL_PWRSTATS_TYPE_SDIO */ 120*4882a593Smuzhiyun uint16 len; /* Up to 4K-1, top 4 bits are reserved */ 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun sdio_bus_metrics_t sdio; /* stats from SDIO bus driver */ 123*4882a593Smuzhiyun } wl_pwr_sdio_stats_t; 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun #endif /* _sdiovar_h_ */ 126