aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/falcon_xmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/sfc/falcon_xmac.c')
-rw-r--r--drivers/net/sfc/falcon_xmac.c248
1 files changed, 110 insertions, 138 deletions
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c
index 5620d9d13925..a9ae06a2ae2d 100644
--- a/drivers/net/sfc/falcon_xmac.c
+++ b/drivers/net/sfc/falcon_xmac.c
@@ -23,48 +23,20 @@
23 23
24/************************************************************************** 24/**************************************************************************
25 * 25 *
26 * MAC register access
27 *
28 **************************************************************************/
29
30/* Offset of an XMAC register within Falcon */
31#define FALCON_XMAC_REG(mac_reg) \
32 (FALCON_XMAC_REGBANK + ((mac_reg) * FALCON_XMAC_REG_SIZE))
33
34void falcon_xmac_writel(struct efx_nic *efx,
35 efx_dword_t *value, unsigned int mac_reg)
36{
37 efx_oword_t temp;
38
39 EFX_POPULATE_OWORD_1(temp, MAC_DATA, EFX_DWORD_FIELD(*value, MAC_DATA));
40 falcon_write(efx, &temp, FALCON_XMAC_REG(mac_reg));
41}
42
43void falcon_xmac_readl(struct efx_nic *efx,
44 efx_dword_t *value, unsigned int mac_reg)
45{
46 efx_oword_t temp;
47
48 falcon_read(efx, &temp, FALCON_XMAC_REG(mac_reg));
49 EFX_POPULATE_DWORD_1(*value, MAC_DATA, EFX_OWORD_FIELD(temp, MAC_DATA));
50}
51
52/**************************************************************************
53 *
54 * MAC operations 26 * MAC operations
55 * 27 *
56 *************************************************************************/ 28 *************************************************************************/
57static int falcon_reset_xmac(struct efx_nic *efx) 29static int falcon_reset_xmac(struct efx_nic *efx)
58{ 30{
59 efx_dword_t reg; 31 efx_oword_t reg;
60 int count; 32 int count;
61 33
62 EFX_POPULATE_DWORD_1(reg, XM_CORE_RST, 1); 34 EFX_POPULATE_OWORD_1(reg, XM_CORE_RST, 1);
63 falcon_xmac_writel(efx, &reg, XM_GLB_CFG_REG_MAC); 35 falcon_write(efx, &reg, XM_GLB_CFG_REG);
64 36
65 for (count = 0; count < 10000; count++) { /* wait upto 100ms */ 37 for (count = 0; count < 10000; count++) { /* wait upto 100ms */
66 falcon_xmac_readl(efx, &reg, XM_GLB_CFG_REG_MAC); 38 falcon_read(efx, &reg, XM_GLB_CFG_REG);
67 if (EFX_DWORD_FIELD(reg, XM_CORE_RST) == 0) 39 if (EFX_OWORD_FIELD(reg, XM_CORE_RST) == 0)
68 return 0; 40 return 0;
69 udelay(10); 41 udelay(10);
70 } 42 }
@@ -76,25 +48,25 @@ static int falcon_reset_xmac(struct efx_nic *efx)
76/* Configure the XAUI driver that is an output from Falcon */ 48/* Configure the XAUI driver that is an output from Falcon */
77static void falcon_setup_xaui(struct efx_nic *efx) 49static void falcon_setup_xaui(struct efx_nic *efx)
78{ 50{
79 efx_dword_t sdctl, txdrv; 51 efx_oword_t sdctl, txdrv;
80 52
81 /* Move the XAUI into low power, unless there is no PHY, in 53 /* Move the XAUI into low power, unless there is no PHY, in
82 * which case the XAUI will have to drive a cable. */ 54 * which case the XAUI will have to drive a cable. */
83 if (efx->phy_type == PHY_TYPE_NONE) 55 if (efx->phy_type == PHY_TYPE_NONE)
84 return; 56 return;
85 57
86 falcon_xmac_readl(efx, &sdctl, XX_SD_CTL_REG_MAC); 58 falcon_read(efx, &sdctl, XX_SD_CTL_REG);
87 EFX_SET_DWORD_FIELD(sdctl, XX_HIDRVD, XX_SD_CTL_DRV_DEFAULT); 59 EFX_SET_OWORD_FIELD(sdctl, XX_HIDRVD, XX_SD_CTL_DRV_DEFAULT);
88 EFX_SET_DWORD_FIELD(sdctl, XX_LODRVD, XX_SD_CTL_DRV_DEFAULT); 60 EFX_SET_OWORD_FIELD(sdctl, XX_LODRVD, XX_SD_CTL_DRV_DEFAULT);
89 EFX_SET_DWORD_FIELD(sdctl, XX_HIDRVC, XX_SD_CTL_DRV_DEFAULT); 61 EFX_SET_OWORD_FIELD(sdctl, XX_HIDRVC, XX_SD_CTL_DRV_DEFAULT);
90 EFX_SET_DWORD_FIELD(sdctl, XX_LODRVC, XX_SD_CTL_DRV_DEFAULT); 62 EFX_SET_OWORD_FIELD(sdctl, XX_LODRVC, XX_SD_CTL_DRV_DEFAULT);
91 EFX_SET_DWORD_FIELD(sdctl, XX_HIDRVB, XX_SD_CTL_DRV_DEFAULT); 63 EFX_SET_OWORD_FIELD(sdctl, XX_HIDRVB, XX_SD_CTL_DRV_DEFAULT);
92 EFX_SET_DWORD_FIELD(sdctl, XX_LODRVB, XX_SD_CTL_DRV_DEFAULT); 64 EFX_SET_OWORD_FIELD(sdctl, XX_LODRVB, XX_SD_CTL_DRV_DEFAULT);
93 EFX_SET_DWORD_FIELD(sdctl, XX_HIDRVA, XX_SD_CTL_DRV_DEFAULT); 65 EFX_SET_OWORD_FIELD(sdctl, XX_HIDRVA, XX_SD_CTL_DRV_DEFAULT);
94 EFX_SET_DWORD_FIELD(sdctl, XX_LODRVA, XX_SD_CTL_DRV_DEFAULT); 66 EFX_SET_OWORD_FIELD(sdctl, XX_LODRVA, XX_SD_CTL_DRV_DEFAULT);
95 falcon_xmac_writel(efx, &sdctl, XX_SD_CTL_REG_MAC); 67 falcon_write(efx, &sdctl, XX_SD_CTL_REG);
96 68
97 EFX_POPULATE_DWORD_8(txdrv, 69 EFX_POPULATE_OWORD_8(txdrv,
98 XX_DEQD, XX_TXDRV_DEQ_DEFAULT, 70 XX_DEQD, XX_TXDRV_DEQ_DEFAULT,
99 XX_DEQC, XX_TXDRV_DEQ_DEFAULT, 71 XX_DEQC, XX_TXDRV_DEQ_DEFAULT,
100 XX_DEQB, XX_TXDRV_DEQ_DEFAULT, 72 XX_DEQB, XX_TXDRV_DEQ_DEFAULT,
@@ -103,67 +75,67 @@ static void falcon_setup_xaui(struct efx_nic *efx)
103 XX_DTXC, XX_TXDRV_DTX_DEFAULT, 75 XX_DTXC, XX_TXDRV_DTX_DEFAULT,
104 XX_DTXB, XX_TXDRV_DTX_DEFAULT, 76 XX_DTXB, XX_TXDRV_DTX_DEFAULT,
105 XX_DTXA, XX_TXDRV_DTX_DEFAULT); 77 XX_DTXA, XX_TXDRV_DTX_DEFAULT);
106 falcon_xmac_writel(efx, &txdrv, XX_TXDRV_CTL_REG_MAC); 78 falcon_write(efx, &txdrv, XX_TXDRV_CTL_REG);
107} 79}
108 80
109static void falcon_hold_xaui_in_rst(struct efx_nic *efx) 81static void falcon_hold_xaui_in_rst(struct efx_nic *efx)
110{ 82{
111 efx_dword_t reg; 83 efx_oword_t reg;
112 84
113 EFX_ZERO_DWORD(reg); 85 EFX_ZERO_OWORD(reg);
114 EFX_SET_DWORD_FIELD(reg, XX_PWRDNA_EN, 1); 86 EFX_SET_OWORD_FIELD(reg, XX_PWRDNA_EN, 1);
115 EFX_SET_DWORD_FIELD(reg, XX_PWRDNB_EN, 1); 87 EFX_SET_OWORD_FIELD(reg, XX_PWRDNB_EN, 1);
116 EFX_SET_DWORD_FIELD(reg, XX_PWRDNC_EN, 1); 88 EFX_SET_OWORD_FIELD(reg, XX_PWRDNC_EN, 1);
117 EFX_SET_DWORD_FIELD(reg, XX_PWRDND_EN, 1); 89 EFX_SET_OWORD_FIELD(reg, XX_PWRDND_EN, 1);
118 EFX_SET_DWORD_FIELD(reg, XX_RSTPLLAB_EN, 1); 90 EFX_SET_OWORD_FIELD(reg, XX_RSTPLLAB_EN, 1);
119 EFX_SET_DWORD_FIELD(reg, XX_RSTPLLCD_EN, 1); 91 EFX_SET_OWORD_FIELD(reg, XX_RSTPLLCD_EN, 1);
120 EFX_SET_DWORD_FIELD(reg, XX_RESETA_EN, 1); 92 EFX_SET_OWORD_FIELD(reg, XX_RESETA_EN, 1);
121 EFX_SET_DWORD_FIELD(reg, XX_RESETB_EN, 1); 93 EFX_SET_OWORD_FIELD(reg, XX_RESETB_EN, 1);
122 EFX_SET_DWORD_FIELD(reg, XX_RESETC_EN, 1); 94 EFX_SET_OWORD_FIELD(reg, XX_RESETC_EN, 1);
123 EFX_SET_DWORD_FIELD(reg, XX_RESETD_EN, 1); 95 EFX_SET_OWORD_FIELD(reg, XX_RESETD_EN, 1);
124 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSRX_EN, 1); 96 EFX_SET_OWORD_FIELD(reg, XX_RSTXGXSRX_EN, 1);
125 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSTX_EN, 1); 97 EFX_SET_OWORD_FIELD(reg, XX_RSTXGXSTX_EN, 1);
126 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 98 falcon_write(efx, &reg, XX_PWR_RST_REG);
127 udelay(10); 99 udelay(10);
128} 100}
129 101
130static int _falcon_reset_xaui_a(struct efx_nic *efx) 102static int _falcon_reset_xaui_a(struct efx_nic *efx)
131{ 103{
132 efx_dword_t reg; 104 efx_oword_t reg;
133 105
134 falcon_hold_xaui_in_rst(efx); 106 falcon_hold_xaui_in_rst(efx);
135 falcon_xmac_readl(efx, &reg, XX_PWR_RST_REG_MAC); 107 falcon_read(efx, &reg, XX_PWR_RST_REG);
136 108
137 /* Follow the RAMBUS XAUI data reset sequencing 109 /* Follow the RAMBUS XAUI data reset sequencing
138 * Channels A and B first: power down, reset PLL, reset, clear 110 * Channels A and B first: power down, reset PLL, reset, clear
139 */ 111 */
140 EFX_SET_DWORD_FIELD(reg, XX_PWRDNA_EN, 0); 112 EFX_SET_OWORD_FIELD(reg, XX_PWRDNA_EN, 0);
141 EFX_SET_DWORD_FIELD(reg, XX_PWRDNB_EN, 0); 113 EFX_SET_OWORD_FIELD(reg, XX_PWRDNB_EN, 0);
142 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 114 falcon_write(efx, &reg, XX_PWR_RST_REG);
143 udelay(10); 115 udelay(10);
144 116
145 EFX_SET_DWORD_FIELD(reg, XX_RSTPLLAB_EN, 0); 117 EFX_SET_OWORD_FIELD(reg, XX_RSTPLLAB_EN, 0);
146 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 118 falcon_write(efx, &reg, XX_PWR_RST_REG);
147 udelay(10); 119 udelay(10);
148 120
149 EFX_SET_DWORD_FIELD(reg, XX_RESETA_EN, 0); 121 EFX_SET_OWORD_FIELD(reg, XX_RESETA_EN, 0);
150 EFX_SET_DWORD_FIELD(reg, XX_RESETB_EN, 0); 122 EFX_SET_OWORD_FIELD(reg, XX_RESETB_EN, 0);
151 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 123 falcon_write(efx, &reg, XX_PWR_RST_REG);
152 udelay(10); 124 udelay(10);
153 125
154 /* Channels C and D: power down, reset PLL, reset, clear */ 126 /* Channels C and D: power down, reset PLL, reset, clear */
155 EFX_SET_DWORD_FIELD(reg, XX_PWRDNC_EN, 0); 127 EFX_SET_OWORD_FIELD(reg, XX_PWRDNC_EN, 0);
156 EFX_SET_DWORD_FIELD(reg, XX_PWRDND_EN, 0); 128 EFX_SET_OWORD_FIELD(reg, XX_PWRDND_EN, 0);
157 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 129 falcon_write(efx, &reg, XX_PWR_RST_REG);
158 udelay(10); 130 udelay(10);
159 131
160 EFX_SET_DWORD_FIELD(reg, XX_RSTPLLCD_EN, 0); 132 EFX_SET_OWORD_FIELD(reg, XX_RSTPLLCD_EN, 0);
161 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 133 falcon_write(efx, &reg, XX_PWR_RST_REG);
162 udelay(10); 134 udelay(10);
163 135
164 EFX_SET_DWORD_FIELD(reg, XX_RESETC_EN, 0); 136 EFX_SET_OWORD_FIELD(reg, XX_RESETC_EN, 0);
165 EFX_SET_DWORD_FIELD(reg, XX_RESETD_EN, 0); 137 EFX_SET_OWORD_FIELD(reg, XX_RESETD_EN, 0);
166 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 138 falcon_write(efx, &reg, XX_PWR_RST_REG);
167 udelay(10); 139 udelay(10);
168 140
169 /* Setup XAUI */ 141 /* Setup XAUI */
@@ -171,8 +143,8 @@ static int _falcon_reset_xaui_a(struct efx_nic *efx)
171 udelay(10); 143 udelay(10);
172 144
173 /* Take XGXS out of reset */ 145 /* Take XGXS out of reset */
174 EFX_ZERO_DWORD(reg); 146 EFX_ZERO_OWORD(reg);
175 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 147 falcon_write(efx, &reg, XX_PWR_RST_REG);
176 udelay(10); 148 udelay(10);
177 149
178 return 0; 150 return 0;
@@ -180,16 +152,16 @@ static int _falcon_reset_xaui_a(struct efx_nic *efx)
180 152
181static int _falcon_reset_xaui_b(struct efx_nic *efx) 153static int _falcon_reset_xaui_b(struct efx_nic *efx)
182{ 154{
183 efx_dword_t reg; 155 efx_oword_t reg;
184 int count; 156 int count;
185 157
186 EFX_POPULATE_DWORD_1(reg, XX_RST_XX_EN, 1); 158 EFX_POPULATE_DWORD_1(reg, XX_RST_XX_EN, 1);
187 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 159 falcon_write(efx, &reg, XX_PWR_RST_REG);
188 160
189 /* Give some time for the link to establish */ 161 /* Give some time for the link to establish */
190 for (count = 0; count < 1000; count++) { /* wait upto 10ms */ 162 for (count = 0; count < 1000; count++) { /* wait upto 10ms */
191 falcon_xmac_readl(efx, &reg, XX_PWR_RST_REG_MAC); 163 falcon_read(efx, &reg, XX_PWR_RST_REG);
192 if (EFX_DWORD_FIELD(reg, XX_RST_XX_EN) == 0) { 164 if (EFX_OWORD_FIELD(reg, XX_RST_XX_EN) == 0) {
193 falcon_setup_xaui(efx); 165 falcon_setup_xaui(efx);
194 return 0; 166 return 0;
195 } 167 }
@@ -215,17 +187,17 @@ int falcon_reset_xaui(struct efx_nic *efx)
215 187
216static bool falcon_xgmii_status(struct efx_nic *efx) 188static bool falcon_xgmii_status(struct efx_nic *efx)
217{ 189{
218 efx_dword_t reg; 190 efx_oword_t reg;
219 191
220 if (falcon_rev(efx) < FALCON_REV_B0) 192 if (falcon_rev(efx) < FALCON_REV_B0)
221 return true; 193 return true;
222 194
223 /* The ISR latches, so clear it and re-read */ 195 /* The ISR latches, so clear it and re-read */
224 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0); 196 falcon_read(efx, &reg, XM_MGT_INT_REG_B0);
225 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0); 197 falcon_read(efx, &reg, XM_MGT_INT_REG_B0);
226 198
227 if (EFX_DWORD_FIELD(reg, XM_LCLFLT) || 199 if (EFX_OWORD_FIELD(reg, XM_LCLFLT) ||
228 EFX_DWORD_FIELD(reg, XM_RMTFLT)) { 200 EFX_OWORD_FIELD(reg, XM_RMTFLT)) {
229 EFX_INFO(efx, "MGT_INT: "EFX_DWORD_FMT"\n", EFX_DWORD_VAL(reg)); 201 EFX_INFO(efx, "MGT_INT: "EFX_DWORD_FMT"\n", EFX_DWORD_VAL(reg));
230 return false; 202 return false;
231 } 203 }
@@ -235,19 +207,19 @@ static bool falcon_xgmii_status(struct efx_nic *efx)
235 207
236static void falcon_mask_status_intr(struct efx_nic *efx, bool enable) 208static void falcon_mask_status_intr(struct efx_nic *efx, bool enable)
237{ 209{
238 efx_dword_t reg; 210 efx_oword_t reg;
239 211
240 if ((falcon_rev(efx) < FALCON_REV_B0) || LOOPBACK_INTERNAL(efx)) 212 if ((falcon_rev(efx) < FALCON_REV_B0) || LOOPBACK_INTERNAL(efx))
241 return; 213 return;
242 214
243 /* Flush the ISR */ 215 /* Flush the ISR */
244 if (enable) 216 if (enable)
245 falcon_xmac_readl(efx, &reg, XM_MGT_INT_REG_MAC_B0); 217 falcon_read(efx, &reg, XM_MGT_INT_REG_B0);
246 218
247 EFX_POPULATE_DWORD_2(reg, 219 EFX_POPULATE_OWORD_2(reg,
248 XM_MSK_RMTFLT, !enable, 220 XM_MSK_RMTFLT, !enable,
249 XM_MSK_LCLFLT, !enable); 221 XM_MSK_LCLFLT, !enable);
250 falcon_xmac_writel(efx, &reg, XM_MGT_INT_MSK_REG_MAC_B0); 222 falcon_write(efx, &reg, XM_MGT_INT_MSK_REG_B0);
251} 223}
252 224
253int falcon_init_xmac(struct efx_nic *efx) 225int falcon_init_xmac(struct efx_nic *efx)
@@ -281,7 +253,7 @@ int falcon_init_xmac(struct efx_nic *efx)
281 253
282bool falcon_xaui_link_ok(struct efx_nic *efx) 254bool falcon_xaui_link_ok(struct efx_nic *efx)
283{ 255{
284 efx_dword_t reg; 256 efx_oword_t reg;
285 bool align_done, link_ok = false; 257 bool align_done, link_ok = false;
286 int sync_status; 258 int sync_status;
287 259
@@ -289,18 +261,18 @@ bool falcon_xaui_link_ok(struct efx_nic *efx)
289 return true; 261 return true;
290 262
291 /* Read link status */ 263 /* Read link status */
292 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC); 264 falcon_read(efx, &reg, XX_CORE_STAT_REG);
293 265
294 align_done = EFX_DWORD_FIELD(reg, XX_ALIGN_DONE); 266 align_done = EFX_OWORD_FIELD(reg, XX_ALIGN_DONE);
295 sync_status = EFX_DWORD_FIELD(reg, XX_SYNC_STAT); 267 sync_status = EFX_OWORD_FIELD(reg, XX_SYNC_STAT);
296 if (align_done && (sync_status == XX_SYNC_STAT_DECODE_SYNCED)) 268 if (align_done && (sync_status == XX_SYNC_STAT_DECODE_SYNCED))
297 link_ok = true; 269 link_ok = true;
298 270
299 /* Clear link status ready for next read */ 271 /* Clear link status ready for next read */
300 EFX_SET_DWORD_FIELD(reg, XX_COMMA_DET, XX_COMMA_DET_RESET); 272 EFX_SET_OWORD_FIELD(reg, XX_COMMA_DET, XX_COMMA_DET_RESET);
301 EFX_SET_DWORD_FIELD(reg, XX_CHARERR, XX_CHARERR_RESET); 273 EFX_SET_OWORD_FIELD(reg, XX_CHARERR, XX_CHARERR_RESET);
302 EFX_SET_DWORD_FIELD(reg, XX_DISPERR, XX_DISPERR_RESET); 274 EFX_SET_OWORD_FIELD(reg, XX_DISPERR, XX_DISPERR_RESET);
303 falcon_xmac_writel(efx, &reg, XX_CORE_STAT_REG_MAC); 275 falcon_write(efx, &reg, XX_CORE_STAT_REG);
304 276
305 /* If the link is up, then check the phy side of the xaui link 277 /* If the link is up, then check the phy side of the xaui link
306 * (error conditions from the wire side propoagate back through 278 * (error conditions from the wire side propoagate back through
@@ -321,7 +293,7 @@ bool falcon_xaui_link_ok(struct efx_nic *efx)
321static void falcon_reconfigure_xmac_core(struct efx_nic *efx) 293static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
322{ 294{
323 unsigned int max_frame_len; 295 unsigned int max_frame_len;
324 efx_dword_t reg; 296 efx_oword_t reg;
325 bool rx_fc = !!(efx->flow_control & EFX_FC_RX); 297 bool rx_fc = !!(efx->flow_control & EFX_FC_RX);
326 298
327 /* Configure MAC - cut-thru mode is hard wired on */ 299 /* Configure MAC - cut-thru mode is hard wired on */
@@ -329,7 +301,7 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
329 XM_RX_JUMBO_MODE, 1, 301 XM_RX_JUMBO_MODE, 1,
330 XM_TX_STAT_EN, 1, 302 XM_TX_STAT_EN, 1,
331 XM_RX_STAT_EN, 1); 303 XM_RX_STAT_EN, 1);
332 falcon_xmac_writel(efx, &reg, XM_GLB_CFG_REG_MAC); 304 falcon_write(efx, &reg, XM_GLB_CFG_REG);
333 305
334 /* Configure TX */ 306 /* Configure TX */
335 EFX_POPULATE_DWORD_6(reg, 307 EFX_POPULATE_DWORD_6(reg,
@@ -339,7 +311,7 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
339 XM_TXCRC, 1, 311 XM_TXCRC, 1,
340 XM_FCNTL, 1, 312 XM_FCNTL, 1,
341 XM_IPG, 0x3); 313 XM_IPG, 0x3);
342 falcon_xmac_writel(efx, &reg, XM_TX_CFG_REG_MAC); 314 falcon_write(efx, &reg, XM_TX_CFG_REG);
343 315
344 /* Configure RX */ 316 /* Configure RX */
345 EFX_POPULATE_DWORD_5(reg, 317 EFX_POPULATE_DWORD_5(reg,
@@ -348,21 +320,21 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
348 XM_ACPT_ALL_MCAST, 1, 320 XM_ACPT_ALL_MCAST, 1,
349 XM_ACPT_ALL_UCAST, efx->promiscuous, 321 XM_ACPT_ALL_UCAST, efx->promiscuous,
350 XM_PASS_CRC_ERR, 1); 322 XM_PASS_CRC_ERR, 1);
351 falcon_xmac_writel(efx, &reg, XM_RX_CFG_REG_MAC); 323 falcon_write(efx, &reg, XM_RX_CFG_REG);
352 324
353 /* Set frame length */ 325 /* Set frame length */
354 max_frame_len = EFX_MAX_FRAME_LEN(efx->net_dev->mtu); 326 max_frame_len = EFX_MAX_FRAME_LEN(efx->net_dev->mtu);
355 EFX_POPULATE_DWORD_1(reg, XM_MAX_RX_FRM_SIZE, max_frame_len); 327 EFX_POPULATE_DWORD_1(reg, XM_MAX_RX_FRM_SIZE, max_frame_len);
356 falcon_xmac_writel(efx, &reg, XM_RX_PARAM_REG_MAC); 328 falcon_write(efx, &reg, XM_RX_PARAM_REG);
357 EFX_POPULATE_DWORD_2(reg, 329 EFX_POPULATE_DWORD_2(reg,
358 XM_MAX_TX_FRM_SIZE, max_frame_len, 330 XM_MAX_TX_FRM_SIZE, max_frame_len,
359 XM_TX_JUMBO_MODE, 1); 331 XM_TX_JUMBO_MODE, 1);
360 falcon_xmac_writel(efx, &reg, XM_TX_PARAM_REG_MAC); 332 falcon_write(efx, &reg, XM_TX_PARAM_REG);
361 333
362 EFX_POPULATE_DWORD_2(reg, 334 EFX_POPULATE_DWORD_2(reg,
363 XM_PAUSE_TIME, 0xfffe, /* MAX PAUSE TIME */ 335 XM_PAUSE_TIME, 0xfffe, /* MAX PAUSE TIME */
364 XM_DIS_FCNTL, !rx_fc); 336 XM_DIS_FCNTL, !rx_fc);
365 falcon_xmac_writel(efx, &reg, XM_FC_REG_MAC); 337 falcon_write(efx, &reg, XM_FC_REG);
366 338
367 /* Set MAC address */ 339 /* Set MAC address */
368 EFX_POPULATE_DWORD_4(reg, 340 EFX_POPULATE_DWORD_4(reg,
@@ -370,16 +342,16 @@ static void falcon_reconfigure_xmac_core(struct efx_nic *efx)
370 XM_ADR_1, efx->net_dev->dev_addr[1], 342 XM_ADR_1, efx->net_dev->dev_addr[1],
371 XM_ADR_2, efx->net_dev->dev_addr[2], 343 XM_ADR_2, efx->net_dev->dev_addr[2],
372 XM_ADR_3, efx->net_dev->dev_addr[3]); 344 XM_ADR_3, efx->net_dev->dev_addr[3]);
373 falcon_xmac_writel(efx, &reg, XM_ADR_LO_REG_MAC); 345 falcon_write(efx, &reg, XM_ADR_LO_REG);
374 EFX_POPULATE_DWORD_2(reg, 346 EFX_POPULATE_DWORD_2(reg,
375 XM_ADR_4, efx->net_dev->dev_addr[4], 347 XM_ADR_4, efx->net_dev->dev_addr[4],
376 XM_ADR_5, efx->net_dev->dev_addr[5]); 348 XM_ADR_5, efx->net_dev->dev_addr[5]);
377 falcon_xmac_writel(efx, &reg, XM_ADR_HI_REG_MAC); 349 falcon_write(efx, &reg, XM_ADR_HI_REG);
378} 350}
379 351
380static void falcon_reconfigure_xgxs_core(struct efx_nic *efx) 352static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
381{ 353{
382 efx_dword_t reg; 354 efx_oword_t reg;
383 bool xgxs_loopback = (efx->loopback_mode == LOOPBACK_XGXS); 355 bool xgxs_loopback = (efx->loopback_mode == LOOPBACK_XGXS);
384 bool xaui_loopback = (efx->loopback_mode == LOOPBACK_XAUI); 356 bool xaui_loopback = (efx->loopback_mode == LOOPBACK_XAUI);
385 bool xgmii_loopback = (efx->loopback_mode == LOOPBACK_XGMII); 357 bool xgmii_loopback = (efx->loopback_mode == LOOPBACK_XGMII);
@@ -390,44 +362,44 @@ static void falcon_reconfigure_xgxs_core(struct efx_nic *efx)
390 bool old_xgmii_loopback, old_xgxs_loopback, old_xaui_loopback; 362 bool old_xgmii_loopback, old_xgxs_loopback, old_xaui_loopback;
391 bool reset_xgxs; 363 bool reset_xgxs;
392 364
393 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC); 365 falcon_read(efx, &reg, XX_CORE_STAT_REG);
394 old_xgxs_loopback = EFX_DWORD_FIELD(reg, XX_XGXS_LB_EN); 366 old_xgxs_loopback = EFX_OWORD_FIELD(reg, XX_XGXS_LB_EN);
395 old_xgmii_loopback = EFX_DWORD_FIELD(reg, XX_XGMII_LB_EN); 367 old_xgmii_loopback = EFX_OWORD_FIELD(reg, XX_XGMII_LB_EN);
396 368
397 falcon_xmac_readl(efx, &reg, XX_SD_CTL_REG_MAC); 369 falcon_read(efx, &reg, XX_SD_CTL_REG);
398 old_xaui_loopback = EFX_DWORD_FIELD(reg, XX_LPBKA); 370 old_xaui_loopback = EFX_OWORD_FIELD(reg, XX_LPBKA);
399 371
400 /* The PHY driver may have turned XAUI off */ 372 /* The PHY driver may have turned XAUI off */
401 reset_xgxs = ((xgxs_loopback != old_xgxs_loopback) || 373 reset_xgxs = ((xgxs_loopback != old_xgxs_loopback) ||
402 (xaui_loopback != old_xaui_loopback) || 374 (xaui_loopback != old_xaui_loopback) ||
403 (xgmii_loopback != old_xgmii_loopback)); 375 (xgmii_loopback != old_xgmii_loopback));
404 if (reset_xgxs) { 376 if (reset_xgxs) {
405 falcon_xmac_readl(efx, &reg, XX_PWR_RST_REG_MAC); 377 falcon_read(efx, &reg, XX_PWR_RST_REG);
406 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSTX_EN, 1); 378 EFX_SET_OWORD_FIELD(reg, XX_RSTXGXSTX_EN, 1);
407 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSRX_EN, 1); 379 EFX_SET_OWORD_FIELD(reg, XX_RSTXGXSRX_EN, 1);
408 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 380 falcon_write(efx, &reg, XX_PWR_RST_REG);
409 udelay(1); 381 udelay(1);
410 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSTX_EN, 0); 382 EFX_SET_OWORD_FIELD(reg, XX_RSTXGXSTX_EN, 0);
411 EFX_SET_DWORD_FIELD(reg, XX_RSTXGXSRX_EN, 0); 383 EFX_SET_OWORD_FIELD(reg, XX_RSTXGXSRX_EN, 0);
412 falcon_xmac_writel(efx, &reg, XX_PWR_RST_REG_MAC); 384 falcon_write(efx, &reg, XX_PWR_RST_REG);
413 udelay(1); 385 udelay(1);
414 } 386 }
415 } 387 }
416 388
417 falcon_xmac_readl(efx, &reg, XX_CORE_STAT_REG_MAC); 389 falcon_read(efx, &reg, XX_CORE_STAT_REG);
418 EFX_SET_DWORD_FIELD(reg, XX_FORCE_SIG, 390 EFX_SET_OWORD_FIELD(reg, XX_FORCE_SIG,
419 (xgxs_loopback || xaui_loopback) ? 391 (xgxs_loopback || xaui_loopback) ?
420 XX_FORCE_SIG_DECODE_FORCED : 0); 392 XX_FORCE_SIG_DECODE_FORCED : 0);
421 EFX_SET_DWORD_FIELD(reg, XX_XGXS_LB_EN, xgxs_loopback); 393 EFX_SET_OWORD_FIELD(reg, XX_XGXS_LB_EN, xgxs_loopback);
422 EFX_SET_DWORD_FIELD(reg, XX_XGMII_LB_EN, xgmii_loopback); 394 EFX_SET_OWORD_FIELD(reg, XX_XGMII_LB_EN, xgmii_loopback);
423 falcon_xmac_writel(efx, &reg, XX_CORE_STAT_REG_MAC); 395 falcon_write(efx, &reg, XX_CORE_STAT_REG);
424 396
425 falcon_xmac_readl(efx, &reg, XX_SD_CTL_REG_MAC); 397 falcon_read(efx, &reg, XX_SD_CTL_REG);
426 EFX_SET_DWORD_FIELD(reg, XX_LPBKD, xaui_loopback); 398 EFX_SET_OWORD_FIELD(reg, XX_LPBKD, xaui_loopback);
427 EFX_SET_DWORD_FIELD(reg, XX_LPBKC, xaui_loopback); 399 EFX_SET_OWORD_FIELD(reg, XX_LPBKC, xaui_loopback);
428 EFX_SET_DWORD_FIELD(reg, XX_LPBKB, xaui_loopback); 400 EFX_SET_OWORD_FIELD(reg, XX_LPBKB, xaui_loopback);
429 EFX_SET_DWORD_FIELD(reg, XX_LPBKA, xaui_loopback); 401 EFX_SET_OWORD_FIELD(reg, XX_LPBKA, xaui_loopback);
430 falcon_xmac_writel(efx, &reg, XX_SD_CTL_REG_MAC); 402 falcon_write(efx, &reg, XX_SD_CTL_REG);
431} 403}
432 404
433 405