gpio: rcar: Fix runtime PM imbalance on error
[linux/fpc-iii.git] / drivers / net / ethernet / sfc / enum.h
blob3332cdf2918a341a09a9649742a7c9227958bfde
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2007-2013 Solarflare Communications Inc.
5 */
7 #ifndef EFX_ENUM_H
8 #define EFX_ENUM_H
10 /**
11 * enum efx_loopback_mode - loopback modes
12 * @LOOPBACK_NONE: no loopback
13 * @LOOPBACK_DATA: data path loopback
14 * @LOOPBACK_GMAC: loopback within GMAC
15 * @LOOPBACK_XGMII: loopback after XMAC
16 * @LOOPBACK_XGXS: loopback within BPX after XGXS
17 * @LOOPBACK_XAUI: loopback within BPX before XAUI serdes
18 * @LOOPBACK_GMII: loopback within BPX after GMAC
19 * @LOOPBACK_SGMII: loopback within BPX within SGMII
20 * @LOOPBACK_XGBR: loopback within BPX within XGBR
21 * @LOOPBACK_XFI: loopback within BPX before XFI serdes
22 * @LOOPBACK_XAUI_FAR: loopback within BPX after XAUI serdes
23 * @LOOPBACK_GMII_FAR: loopback within BPX before SGMII
24 * @LOOPBACK_SGMII_FAR: loopback within BPX after SGMII
25 * @LOOPBACK_XFI_FAR: loopback after XFI serdes
26 * @LOOPBACK_GPHY: loopback within 1G PHY at unspecified level
27 * @LOOPBACK_PHYXS: loopback within 10G PHY at PHYXS level
28 * @LOOPBACK_PCS: loopback within 10G PHY at PCS level
29 * @LOOPBACK_PMAPMD: loopback within 10G PHY at PMAPMD level
30 * @LOOPBACK_XPORT: cross port loopback
31 * @LOOPBACK_XGMII_WS: wireside loopback excluding XMAC
32 * @LOOPBACK_XAUI_WS: wireside loopback within BPX within XAUI serdes
33 * @LOOPBACK_XAUI_WS_FAR: wireside loopback within BPX including XAUI serdes
34 * @LOOPBACK_XAUI_WS_NEAR: wireside loopback within BPX excluding XAUI serdes
35 * @LOOPBACK_GMII_WS: wireside loopback excluding GMAC
36 * @LOOPBACK_XFI_WS: wireside loopback excluding XFI serdes
37 * @LOOPBACK_XFI_WS_FAR: wireside loopback including XFI serdes
38 * @LOOPBACK_PHYXS_WS: wireside loopback within 10G PHY at PHYXS level
40 /* Please keep up-to-date w.r.t the following two #defines */
41 enum efx_loopback_mode {
42 LOOPBACK_NONE = 0,
43 LOOPBACK_DATA = 1,
44 LOOPBACK_GMAC = 2,
45 LOOPBACK_XGMII = 3,
46 LOOPBACK_XGXS = 4,
47 LOOPBACK_XAUI = 5,
48 LOOPBACK_GMII = 6,
49 LOOPBACK_SGMII = 7,
50 LOOPBACK_XGBR = 8,
51 LOOPBACK_XFI = 9,
52 LOOPBACK_XAUI_FAR = 10,
53 LOOPBACK_GMII_FAR = 11,
54 LOOPBACK_SGMII_FAR = 12,
55 LOOPBACK_XFI_FAR = 13,
56 LOOPBACK_GPHY = 14,
57 LOOPBACK_PHYXS = 15,
58 LOOPBACK_PCS = 16,
59 LOOPBACK_PMAPMD = 17,
60 LOOPBACK_XPORT = 18,
61 LOOPBACK_XGMII_WS = 19,
62 LOOPBACK_XAUI_WS = 20,
63 LOOPBACK_XAUI_WS_FAR = 21,
64 LOOPBACK_XAUI_WS_NEAR = 22,
65 LOOPBACK_GMII_WS = 23,
66 LOOPBACK_XFI_WS = 24,
67 LOOPBACK_XFI_WS_FAR = 25,
68 LOOPBACK_PHYXS_WS = 26,
69 LOOPBACK_MAX
71 #define LOOPBACK_TEST_MAX LOOPBACK_PMAPMD
73 /* These loopbacks occur within the controller */
74 #define LOOPBACKS_INTERNAL ((1 << LOOPBACK_DATA) | \
75 (1 << LOOPBACK_GMAC) | \
76 (1 << LOOPBACK_XGMII)| \
77 (1 << LOOPBACK_XGXS) | \
78 (1 << LOOPBACK_XAUI) | \
79 (1 << LOOPBACK_GMII) | \
80 (1 << LOOPBACK_SGMII) | \
81 (1 << LOOPBACK_SGMII) | \
82 (1 << LOOPBACK_XGBR) | \
83 (1 << LOOPBACK_XFI) | \
84 (1 << LOOPBACK_XAUI_FAR) | \
85 (1 << LOOPBACK_GMII_FAR) | \
86 (1 << LOOPBACK_SGMII_FAR) | \
87 (1 << LOOPBACK_XFI_FAR) | \
88 (1 << LOOPBACK_XGMII_WS) | \
89 (1 << LOOPBACK_XAUI_WS) | \
90 (1 << LOOPBACK_XAUI_WS_FAR) | \
91 (1 << LOOPBACK_XAUI_WS_NEAR) | \
92 (1 << LOOPBACK_GMII_WS) | \
93 (1 << LOOPBACK_XFI_WS) | \
94 (1 << LOOPBACK_XFI_WS_FAR))
96 #define LOOPBACKS_WS ((1 << LOOPBACK_XGMII_WS) | \
97 (1 << LOOPBACK_XAUI_WS) | \
98 (1 << LOOPBACK_XAUI_WS_FAR) | \
99 (1 << LOOPBACK_XAUI_WS_NEAR) | \
100 (1 << LOOPBACK_GMII_WS) | \
101 (1 << LOOPBACK_XFI_WS) | \
102 (1 << LOOPBACK_XFI_WS_FAR) | \
103 (1 << LOOPBACK_PHYXS_WS))
105 #define LOOPBACKS_EXTERNAL(_efx) \
106 ((_efx)->loopback_modes & ~LOOPBACKS_INTERNAL & \
107 ~(1 << LOOPBACK_NONE))
109 #define LOOPBACK_MASK(_efx) \
110 (1 << (_efx)->loopback_mode)
112 #define LOOPBACK_INTERNAL(_efx) \
113 (!!(LOOPBACKS_INTERNAL & LOOPBACK_MASK(_efx)))
115 #define LOOPBACK_EXTERNAL(_efx) \
116 (!!(LOOPBACK_MASK(_efx) & LOOPBACKS_EXTERNAL(_efx)))
118 #define LOOPBACK_CHANGED(_from, _to, _mask) \
119 (!!((LOOPBACK_MASK(_from) ^ LOOPBACK_MASK(_to)) & (_mask)))
121 #define LOOPBACK_OUT_OF(_from, _to, _mask) \
122 ((LOOPBACK_MASK(_from) & (_mask)) && !(LOOPBACK_MASK(_to) & (_mask)))
124 /*****************************************************************************/
127 * enum reset_type - reset types
129 * %RESET_TYPE_INVSIBLE, %RESET_TYPE_ALL, %RESET_TYPE_WORLD and
130 * %RESET_TYPE_DISABLE specify the method/scope of the reset. The
131 * other valuesspecify reasons, which efx_schedule_reset() will choose
132 * a method for.
134 * Reset methods are numbered in order of increasing scope.
136 * @RESET_TYPE_INVISIBLE: Reset datapath and MAC (Falcon only)
137 * @RESET_TYPE_RECOVER_OR_ALL: Try to recover. Apply RESET_TYPE_ALL
138 * if unsuccessful.
139 * @RESET_TYPE_ALL: Reset datapath, MAC and PHY
140 * @RESET_TYPE_WORLD: Reset as much as possible
141 * @RESET_TYPE_RECOVER_OR_DISABLE: Try to recover. Apply RESET_TYPE_DISABLE if
142 * unsuccessful.
143 * @RESET_TYPE_DATAPATH: Reset datapath only.
144 * @RESET_TYPE_MC_BIST: MC entering BIST mode.
145 * @RESET_TYPE_DISABLE: Reset datapath, MAC and PHY; leave NIC disabled
146 * @RESET_TYPE_TX_WATCHDOG: reset due to TX watchdog
147 * @RESET_TYPE_INT_ERROR: reset due to internal error
148 * @RESET_TYPE_DMA_ERROR: DMA error
149 * @RESET_TYPE_TX_SKIP: hardware completed empty tx descriptors
150 * @RESET_TYPE_MC_FAILURE: MC reboot/assertion
151 * @RESET_TYPE_MCDI_TIMEOUT: MCDI timeout.
153 enum reset_type {
154 RESET_TYPE_INVISIBLE,
155 RESET_TYPE_RECOVER_OR_ALL,
156 RESET_TYPE_ALL,
157 RESET_TYPE_WORLD,
158 RESET_TYPE_RECOVER_OR_DISABLE,
159 RESET_TYPE_DATAPATH,
160 RESET_TYPE_MC_BIST,
161 RESET_TYPE_DISABLE,
162 RESET_TYPE_MAX_METHOD,
163 RESET_TYPE_TX_WATCHDOG,
164 RESET_TYPE_INT_ERROR,
165 RESET_TYPE_DMA_ERROR,
166 RESET_TYPE_TX_SKIP,
167 RESET_TYPE_MC_FAILURE,
168 /* RESET_TYPE_MCDI_TIMEOUT is actually a method, not just a reason, but
169 * it doesn't fit the scope hierarchy (not well-ordered by inclusion).
170 * We encode this by having its enum value be greater than
171 * RESET_TYPE_MAX_METHOD.
173 RESET_TYPE_MCDI_TIMEOUT,
174 RESET_TYPE_MAX,
177 #endif /* EFX_ENUM_H */