1 /****************************************************************************
2 * Driver for Solarflare Solarstorm network controllers and boards
3 * Copyright 2009 Solarflare Communications Inc.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published
7 * by the Free Software Foundation, incorporated herein by reference.
11 * Driver for PHY related operations via MCDI.
17 #include "mcdi_pcol.h"
20 struct efx_mcdi_phy_cfg {
35 efx_mcdi_get_phy_cfg(struct efx_nic *efx, struct efx_mcdi_phy_cfg *cfg)
37 u8 outbuf[MC_CMD_GET_PHY_CFG_OUT_LEN];
41 BUILD_BUG_ON(MC_CMD_GET_PHY_CFG_IN_LEN != 0);
42 BUILD_BUG_ON(MC_CMD_GET_PHY_CFG_OUT_NAME_LEN != sizeof(cfg->name));
44 rc = efx_mcdi_rpc(efx, MC_CMD_GET_PHY_CFG, NULL, 0,
45 outbuf, sizeof(outbuf), &outlen);
49 if (outlen < MC_CMD_GET_PHY_CFG_OUT_LEN) {
54 cfg->flags = MCDI_DWORD(outbuf, GET_PHY_CFG_OUT_FLAGS);
55 cfg->type = MCDI_DWORD(outbuf, GET_PHY_CFG_OUT_TYPE);
57 MCDI_DWORD(outbuf, GET_PHY_CFG_OUT_SUPPORTED_CAP);
58 cfg->channel = MCDI_DWORD(outbuf, GET_PHY_CFG_OUT_CHANNEL);
59 cfg->port = MCDI_DWORD(outbuf, GET_PHY_CFG_OUT_PRT);
60 cfg->stats_mask = MCDI_DWORD(outbuf, GET_PHY_CFG_OUT_STATS_MASK);
61 memcpy(cfg->name, MCDI_PTR(outbuf, GET_PHY_CFG_OUT_NAME),
63 cfg->media = MCDI_DWORD(outbuf, GET_PHY_CFG_OUT_MEDIA_TYPE);
64 cfg->mmd_mask = MCDI_DWORD(outbuf, GET_PHY_CFG_OUT_MMD_MASK);
65 memcpy(cfg->revision, MCDI_PTR(outbuf, GET_PHY_CFG_OUT_REVISION),
66 sizeof(cfg->revision));
71 EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc);
75 static int efx_mcdi_set_link(struct efx_nic *efx, u32 capabilities,
76 u32 flags, u32 loopback_mode,
79 u8 inbuf[MC_CMD_SET_LINK_IN_LEN];
82 BUILD_BUG_ON(MC_CMD_SET_LINK_OUT_LEN != 0);
84 MCDI_SET_DWORD(inbuf, SET_LINK_IN_CAP, capabilities);
85 MCDI_SET_DWORD(inbuf, SET_LINK_IN_FLAGS, flags);
86 MCDI_SET_DWORD(inbuf, SET_LINK_IN_LOOPBACK_MODE, loopback_mode);
87 MCDI_SET_DWORD(inbuf, SET_LINK_IN_LOOPBACK_SPEED, loopback_speed);
89 rc = efx_mcdi_rpc(efx, MC_CMD_SET_LINK, inbuf, sizeof(inbuf),
97 EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc);
101 static int efx_mcdi_loopback_modes(struct efx_nic *efx, u64 *loopback_modes)
103 u8 outbuf[MC_CMD_GET_LOOPBACK_MODES_OUT_LEN];
107 rc = efx_mcdi_rpc(efx, MC_CMD_GET_LOOPBACK_MODES, NULL, 0,
108 outbuf, sizeof(outbuf), &outlen);
112 if (outlen < MC_CMD_GET_LOOPBACK_MODES_OUT_LEN) {
117 *loopback_modes = MCDI_QWORD(outbuf, GET_LOOPBACK_MODES_SUGGESTED);
122 EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc);
126 int efx_mcdi_mdio_read(struct efx_nic *efx, unsigned int bus,
127 unsigned int prtad, unsigned int devad, u16 addr,
128 u16 *value_out, u32 *status_out)
130 u8 inbuf[MC_CMD_MDIO_READ_IN_LEN];
131 u8 outbuf[MC_CMD_MDIO_READ_OUT_LEN];
135 MCDI_SET_DWORD(inbuf, MDIO_READ_IN_BUS, bus);
136 MCDI_SET_DWORD(inbuf, MDIO_READ_IN_PRTAD, prtad);
137 MCDI_SET_DWORD(inbuf, MDIO_READ_IN_DEVAD, devad);
138 MCDI_SET_DWORD(inbuf, MDIO_READ_IN_ADDR, addr);
140 rc = efx_mcdi_rpc(efx, MC_CMD_MDIO_READ, inbuf, sizeof(inbuf),
141 outbuf, sizeof(outbuf), &outlen);
145 *value_out = (u16)MCDI_DWORD(outbuf, MDIO_READ_OUT_VALUE);
146 *status_out = MCDI_DWORD(outbuf, MDIO_READ_OUT_STATUS);
150 EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc);
154 int efx_mcdi_mdio_write(struct efx_nic *efx, unsigned int bus,
155 unsigned int prtad, unsigned int devad, u16 addr,
156 u16 value, u32 *status_out)
158 u8 inbuf[MC_CMD_MDIO_WRITE_IN_LEN];
159 u8 outbuf[MC_CMD_MDIO_WRITE_OUT_LEN];
163 MCDI_SET_DWORD(inbuf, MDIO_WRITE_IN_BUS, bus);
164 MCDI_SET_DWORD(inbuf, MDIO_WRITE_IN_PRTAD, prtad);
165 MCDI_SET_DWORD(inbuf, MDIO_WRITE_IN_DEVAD, devad);
166 MCDI_SET_DWORD(inbuf, MDIO_WRITE_IN_ADDR, addr);
167 MCDI_SET_DWORD(inbuf, MDIO_WRITE_IN_VALUE, value);
169 rc = efx_mcdi_rpc(efx, MC_CMD_MDIO_WRITE, inbuf, sizeof(inbuf),
170 outbuf, sizeof(outbuf), &outlen);
174 *status_out = MCDI_DWORD(outbuf, MDIO_WRITE_OUT_STATUS);
178 EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc);
182 static u32 mcdi_to_ethtool_cap(u32 media, u32 cap)
187 case MC_CMD_MEDIA_KX4:
188 result |= SUPPORTED_Backplane;
189 if (cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN))
190 result |= SUPPORTED_1000baseKX_Full;
191 if (cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
192 result |= SUPPORTED_10000baseKX4_Full;
195 case MC_CMD_MEDIA_XFP:
196 case MC_CMD_MEDIA_SFP_PLUS:
197 result |= SUPPORTED_FIBRE;
200 case MC_CMD_MEDIA_BASE_T:
201 result |= SUPPORTED_TP;
202 if (cap & (1 << MC_CMD_PHY_CAP_10HDX_LBN))
203 result |= SUPPORTED_10baseT_Half;
204 if (cap & (1 << MC_CMD_PHY_CAP_10FDX_LBN))
205 result |= SUPPORTED_10baseT_Full;
206 if (cap & (1 << MC_CMD_PHY_CAP_100HDX_LBN))
207 result |= SUPPORTED_100baseT_Half;
208 if (cap & (1 << MC_CMD_PHY_CAP_100FDX_LBN))
209 result |= SUPPORTED_100baseT_Full;
210 if (cap & (1 << MC_CMD_PHY_CAP_1000HDX_LBN))
211 result |= SUPPORTED_1000baseT_Half;
212 if (cap & (1 << MC_CMD_PHY_CAP_1000FDX_LBN))
213 result |= SUPPORTED_1000baseT_Full;
214 if (cap & (1 << MC_CMD_PHY_CAP_10000FDX_LBN))
215 result |= SUPPORTED_10000baseT_Full;
219 if (cap & (1 << MC_CMD_PHY_CAP_PAUSE_LBN))
220 result |= SUPPORTED_Pause;
221 if (cap & (1 << MC_CMD_PHY_CAP_ASYM_LBN))
222 result |= SUPPORTED_Asym_Pause;
223 if (cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
224 result |= SUPPORTED_Autoneg;
229 static u32 ethtool_to_mcdi_cap(u32 cap)
233 if (cap & SUPPORTED_10baseT_Half)
234 result |= (1 << MC_CMD_PHY_CAP_10HDX_LBN);
235 if (cap & SUPPORTED_10baseT_Full)
236 result |= (1 << MC_CMD_PHY_CAP_10FDX_LBN);
237 if (cap & SUPPORTED_100baseT_Half)
238 result |= (1 << MC_CMD_PHY_CAP_100HDX_LBN);
239 if (cap & SUPPORTED_100baseT_Full)
240 result |= (1 << MC_CMD_PHY_CAP_100FDX_LBN);
241 if (cap & SUPPORTED_1000baseT_Half)
242 result |= (1 << MC_CMD_PHY_CAP_1000HDX_LBN);
243 if (cap & (SUPPORTED_1000baseT_Full | SUPPORTED_1000baseKX_Full))
244 result |= (1 << MC_CMD_PHY_CAP_1000FDX_LBN);
245 if (cap & (SUPPORTED_10000baseT_Full | SUPPORTED_10000baseKX4_Full))
246 result |= (1 << MC_CMD_PHY_CAP_10000FDX_LBN);
247 if (cap & SUPPORTED_Pause)
248 result |= (1 << MC_CMD_PHY_CAP_PAUSE_LBN);
249 if (cap & SUPPORTED_Asym_Pause)
250 result |= (1 << MC_CMD_PHY_CAP_ASYM_LBN);
251 if (cap & SUPPORTED_Autoneg)
252 result |= (1 << MC_CMD_PHY_CAP_AN_LBN);
257 static u32 efx_get_mcdi_phy_flags(struct efx_nic *efx)
259 struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
260 enum efx_phy_mode mode, supported;
263 /* TODO: Advertise the capabilities supported by this PHY */
265 if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_TXDIS_LBN))
266 supported |= PHY_MODE_TX_DISABLED;
267 if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_LOWPOWER_LBN))
268 supported |= PHY_MODE_LOW_POWER;
269 if (phy_cfg->flags & (1 << MC_CMD_GET_PHY_CFG_POWEROFF_LBN))
270 supported |= PHY_MODE_OFF;
272 mode = efx->phy_mode & supported;
275 if (mode & PHY_MODE_TX_DISABLED)
276 flags |= (1 << MC_CMD_SET_LINK_TXDIS_LBN);
277 if (mode & PHY_MODE_LOW_POWER)
278 flags |= (1 << MC_CMD_SET_LINK_LOWPOWER_LBN);
279 if (mode & PHY_MODE_OFF)
280 flags |= (1 << MC_CMD_SET_LINK_POWEROFF_LBN);
285 static u32 mcdi_to_ethtool_media(u32 media)
288 case MC_CMD_MEDIA_XAUI:
289 case MC_CMD_MEDIA_CX4:
290 case MC_CMD_MEDIA_KX4:
293 case MC_CMD_MEDIA_XFP:
294 case MC_CMD_MEDIA_SFP_PLUS:
297 case MC_CMD_MEDIA_BASE_T:
305 static int efx_mcdi_phy_probe(struct efx_nic *efx)
307 struct efx_mcdi_phy_cfg *phy_data;
308 u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
312 /* Initialise and populate phy_data */
313 phy_data = kzalloc(sizeof(*phy_data), GFP_KERNEL);
314 if (phy_data == NULL)
317 rc = efx_mcdi_get_phy_cfg(efx, phy_data);
321 /* Read initial link advertisement */
322 BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0);
323 rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
324 outbuf, sizeof(outbuf), NULL);
328 /* Fill out nic state */
329 efx->phy_data = phy_data;
330 efx->phy_type = phy_data->type;
332 efx->mdio_bus = phy_data->channel;
333 efx->mdio.prtad = phy_data->port;
334 efx->mdio.mmds = phy_data->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22);
335 efx->mdio.mode_support = 0;
336 if (phy_data->mmd_mask & (1 << MC_CMD_MMD_CLAUSE22))
337 efx->mdio.mode_support |= MDIO_SUPPORTS_C22;
338 if (phy_data->mmd_mask & ~(1 << MC_CMD_MMD_CLAUSE22))
339 efx->mdio.mode_support |= MDIO_SUPPORTS_C45 | MDIO_EMULATE_C22;
341 caps = MCDI_DWORD(outbuf, GET_LINK_OUT_CAP);
342 if (caps & (1 << MC_CMD_PHY_CAP_AN_LBN))
343 efx->link_advertising =
344 mcdi_to_ethtool_cap(phy_data->media, caps);
346 phy_data->forced_cap = caps;
348 /* Assert that we can map efx -> mcdi loopback modes */
349 BUILD_BUG_ON(LOOPBACK_NONE != MC_CMD_LOOPBACK_NONE);
350 BUILD_BUG_ON(LOOPBACK_DATA != MC_CMD_LOOPBACK_DATA);
351 BUILD_BUG_ON(LOOPBACK_GMAC != MC_CMD_LOOPBACK_GMAC);
352 BUILD_BUG_ON(LOOPBACK_XGMII != MC_CMD_LOOPBACK_XGMII);
353 BUILD_BUG_ON(LOOPBACK_XGXS != MC_CMD_LOOPBACK_XGXS);
354 BUILD_BUG_ON(LOOPBACK_XAUI != MC_CMD_LOOPBACK_XAUI);
355 BUILD_BUG_ON(LOOPBACK_GMII != MC_CMD_LOOPBACK_GMII);
356 BUILD_BUG_ON(LOOPBACK_SGMII != MC_CMD_LOOPBACK_SGMII);
357 BUILD_BUG_ON(LOOPBACK_XGBR != MC_CMD_LOOPBACK_XGBR);
358 BUILD_BUG_ON(LOOPBACK_XFI != MC_CMD_LOOPBACK_XFI);
359 BUILD_BUG_ON(LOOPBACK_XAUI_FAR != MC_CMD_LOOPBACK_XAUI_FAR);
360 BUILD_BUG_ON(LOOPBACK_GMII_FAR != MC_CMD_LOOPBACK_GMII_FAR);
361 BUILD_BUG_ON(LOOPBACK_SGMII_FAR != MC_CMD_LOOPBACK_SGMII_FAR);
362 BUILD_BUG_ON(LOOPBACK_XFI_FAR != MC_CMD_LOOPBACK_XFI_FAR);
363 BUILD_BUG_ON(LOOPBACK_GPHY != MC_CMD_LOOPBACK_GPHY);
364 BUILD_BUG_ON(LOOPBACK_PHYXS != MC_CMD_LOOPBACK_PHYXS);
365 BUILD_BUG_ON(LOOPBACK_PCS != MC_CMD_LOOPBACK_PCS);
366 BUILD_BUG_ON(LOOPBACK_PMAPMD != MC_CMD_LOOPBACK_PMAPMD);
367 BUILD_BUG_ON(LOOPBACK_XPORT != MC_CMD_LOOPBACK_XPORT);
368 BUILD_BUG_ON(LOOPBACK_XGMII_WS != MC_CMD_LOOPBACK_XGMII_WS);
369 BUILD_BUG_ON(LOOPBACK_XAUI_WS != MC_CMD_LOOPBACK_XAUI_WS);
370 BUILD_BUG_ON(LOOPBACK_XAUI_WS_FAR != MC_CMD_LOOPBACK_XAUI_WS_FAR);
371 BUILD_BUG_ON(LOOPBACK_XAUI_WS_NEAR != MC_CMD_LOOPBACK_XAUI_WS_NEAR);
372 BUILD_BUG_ON(LOOPBACK_GMII_WS != MC_CMD_LOOPBACK_GMII_WS);
373 BUILD_BUG_ON(LOOPBACK_XFI_WS != MC_CMD_LOOPBACK_XFI_WS);
374 BUILD_BUG_ON(LOOPBACK_XFI_WS_FAR != MC_CMD_LOOPBACK_XFI_WS_FAR);
375 BUILD_BUG_ON(LOOPBACK_PHYXS_WS != MC_CMD_LOOPBACK_PHYXS_WS);
377 rc = efx_mcdi_loopback_modes(efx, &efx->loopback_modes);
380 /* The MC indicates that LOOPBACK_NONE is a valid loopback mode,
381 * but by convention we don't */
382 efx->loopback_modes &= ~(1 << LOOPBACK_NONE);
384 /* Set the initial link mode */
385 efx_mcdi_phy_decode_link(
386 efx, &efx->link_state,
387 MCDI_DWORD(outbuf, GET_LINK_OUT_LINK_SPEED),
388 MCDI_DWORD(outbuf, GET_LINK_OUT_FLAGS),
389 MCDI_DWORD(outbuf, GET_LINK_OUT_FCNTL));
391 /* Default to Autonegotiated flow control if the PHY supports it */
392 efx->wanted_fc = EFX_FC_RX | EFX_FC_TX;
393 if (phy_data->supported_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
394 efx->wanted_fc |= EFX_FC_AUTO;
403 int efx_mcdi_phy_reconfigure(struct efx_nic *efx)
405 struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
406 u32 caps = (efx->link_advertising ?
407 ethtool_to_mcdi_cap(efx->link_advertising) :
408 phy_cfg->forced_cap);
410 return efx_mcdi_set_link(efx, caps, efx_get_mcdi_phy_flags(efx),
411 efx->loopback_mode, 0);
414 void efx_mcdi_phy_decode_link(struct efx_nic *efx,
415 struct efx_link_state *link_state,
416 u32 speed, u32 flags, u32 fcntl)
419 case MC_CMD_FCNTL_AUTO:
420 WARN_ON(1); /* This is not a link mode */
421 link_state->fc = EFX_FC_AUTO | EFX_FC_TX | EFX_FC_RX;
423 case MC_CMD_FCNTL_BIDIR:
424 link_state->fc = EFX_FC_TX | EFX_FC_RX;
426 case MC_CMD_FCNTL_RESPOND:
427 link_state->fc = EFX_FC_RX;
431 case MC_CMD_FCNTL_OFF:
436 link_state->up = !!(flags & (1 << MC_CMD_GET_LINK_LINK_UP_LBN));
437 link_state->fd = !!(flags & (1 << MC_CMD_GET_LINK_FULL_DUPLEX_LBN));
438 link_state->speed = speed;
441 /* Verify that the forced flow control settings (!EFX_FC_AUTO) are
442 * supported by the link partner. Warn the user if this isn't the case
444 void efx_mcdi_phy_check_fcntl(struct efx_nic *efx, u32 lpa)
446 struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
449 /* The link partner capabilities are only relevent if the
450 * link supports flow control autonegotiation */
451 if (~phy_cfg->supported_cap & (1 << MC_CMD_PHY_CAP_AN_LBN))
454 /* If flow control autoneg is supported and enabled, then fine */
455 if (efx->wanted_fc & EFX_FC_AUTO)
459 if (lpa & (1 << MC_CMD_PHY_CAP_PAUSE_LBN))
460 rmtadv |= ADVERTISED_Pause;
461 if (lpa & (1 << MC_CMD_PHY_CAP_ASYM_LBN))
462 rmtadv |= ADVERTISED_Asym_Pause;
464 if ((efx->wanted_fc & EFX_FC_TX) && rmtadv == ADVERTISED_Asym_Pause)
465 EFX_ERR(efx, "warning: link partner doesn't support "
469 static bool efx_mcdi_phy_poll(struct efx_nic *efx)
471 struct efx_link_state old_state = efx->link_state;
472 u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
475 WARN_ON(!mutex_is_locked(&efx->mac_lock));
477 BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0);
479 rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
480 outbuf, sizeof(outbuf), NULL);
482 EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc);
483 efx->link_state.up = false;
485 efx_mcdi_phy_decode_link(
486 efx, &efx->link_state,
487 MCDI_DWORD(outbuf, GET_LINK_OUT_LINK_SPEED),
488 MCDI_DWORD(outbuf, GET_LINK_OUT_FLAGS),
489 MCDI_DWORD(outbuf, GET_LINK_OUT_FCNTL));
492 return !efx_link_state_equal(&efx->link_state, &old_state);
495 static void efx_mcdi_phy_remove(struct efx_nic *efx)
497 struct efx_mcdi_phy_data *phy_data = efx->phy_data;
499 efx->phy_data = NULL;
503 static void efx_mcdi_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
505 struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
506 u8 outbuf[MC_CMD_GET_LINK_OUT_LEN];
510 mcdi_to_ethtool_cap(phy_cfg->media, phy_cfg->supported_cap);
511 ecmd->advertising = efx->link_advertising;
512 ecmd->speed = efx->link_state.speed;
513 ecmd->duplex = efx->link_state.fd;
514 ecmd->port = mcdi_to_ethtool_media(phy_cfg->media);
515 ecmd->phy_address = phy_cfg->port;
516 ecmd->transceiver = XCVR_INTERNAL;
517 ecmd->autoneg = !!(efx->link_advertising & ADVERTISED_Autoneg);
518 ecmd->mdio_support = (efx->mdio.mode_support &
519 (MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22));
521 BUILD_BUG_ON(MC_CMD_GET_LINK_IN_LEN != 0);
522 rc = efx_mcdi_rpc(efx, MC_CMD_GET_LINK, NULL, 0,
523 outbuf, sizeof(outbuf), NULL);
525 EFX_ERR(efx, "%s: failed rc=%d\n", __func__, rc);
528 ecmd->lp_advertising =
529 mcdi_to_ethtool_cap(phy_cfg->media,
530 MCDI_DWORD(outbuf, GET_LINK_OUT_LP_CAP));
533 static int efx_mcdi_phy_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
535 struct efx_mcdi_phy_cfg *phy_cfg = efx->phy_data;
540 caps = (ethtool_to_mcdi_cap(ecmd->advertising) |
541 1 << MC_CMD_PHY_CAP_AN_LBN);
542 } else if (ecmd->duplex) {
543 switch (ecmd->speed) {
544 case 10: caps = 1 << MC_CMD_PHY_CAP_10FDX_LBN; break;
545 case 100: caps = 1 << MC_CMD_PHY_CAP_100FDX_LBN; break;
546 case 1000: caps = 1 << MC_CMD_PHY_CAP_1000FDX_LBN; break;
547 case 10000: caps = 1 << MC_CMD_PHY_CAP_10000FDX_LBN; break;
548 default: return -EINVAL;
551 switch (ecmd->speed) {
552 case 10: caps = 1 << MC_CMD_PHY_CAP_10HDX_LBN; break;
553 case 100: caps = 1 << MC_CMD_PHY_CAP_100HDX_LBN; break;
554 case 1000: caps = 1 << MC_CMD_PHY_CAP_1000HDX_LBN; break;
555 default: return -EINVAL;
559 rc = efx_mcdi_set_link(efx, caps, efx_get_mcdi_phy_flags(efx),
560 efx->loopback_mode, 0);
565 efx_link_set_advertising(
566 efx, ecmd->advertising | ADVERTISED_Autoneg);
567 phy_cfg->forced_cap = 0;
569 efx_link_set_advertising(efx, 0);
570 phy_cfg->forced_cap = caps;
575 static int efx_mcdi_phy_test_alive(struct efx_nic *efx)
577 u8 outbuf[MC_CMD_GET_PHY_STATE_OUT_LEN];
581 BUILD_BUG_ON(MC_CMD_GET_PHY_STATE_IN_LEN != 0);
583 rc = efx_mcdi_rpc(efx, MC_CMD_GET_PHY_STATE, NULL, 0,
584 outbuf, sizeof(outbuf), &outlen);
588 if (outlen < MC_CMD_GET_PHY_STATE_OUT_LEN)
590 if (MCDI_DWORD(outbuf, GET_PHY_STATE_STATE) != MC_CMD_PHY_STATE_OK)
596 struct efx_phy_operations efx_mcdi_phy_ops = {
597 .probe = efx_mcdi_phy_probe,
598 .init = efx_port_dummy_op_int,
599 .reconfigure = efx_mcdi_phy_reconfigure,
600 .poll = efx_mcdi_phy_poll,
601 .fini = efx_port_dummy_op_void,
602 .remove = efx_mcdi_phy_remove,
603 .get_settings = efx_mcdi_phy_get_settings,
604 .set_settings = efx_mcdi_phy_set_settings,
605 .test_alive = efx_mcdi_phy_test_alive,