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