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