12 #include <linux/types.h>
13 #include <linux/ethtool.h>
27 for (i = 0; i < 22; ++
i)
28 if (
id & (1 << (i + 10)))
35 int spins,
int spintime)
54 static int efx_mdio_check_mmd(
struct efx_nic *efx,
int mmd)
63 "PHY MMD %d not responding.\n", mmd);
72 #define MDIO45_RESET_TIME 1000
73 #define MDIO45_RESET_ITERS 100
92 "failed to read status of"
97 in_reset |= (1 << mmd);
109 "not all MMDs came out of reset in time."
110 " MMDs still in reset: %x\n", in_reset);
118 int mmd = 0, probe_mmd, devs1, devs2;
128 devs1 = efx_mdio_read(efx, probe_mmd,
MDIO_DEVS1);
129 devs2 = efx_mdio_read(efx, probe_mmd,
MDIO_DEVS2);
130 if (devs1 < 0 || devs2 < 0) {
132 "failed to read devices present\n");
135 devices = devs1 | (devs2 << 16);
136 if ((devices & mmd_mask) != mmd_mask) {
138 "required MMDs not present: got %x, wanted %x\n",
146 if ((mmd_mask & 1) && efx_mdio_check_mmd(efx, mmd))
148 mmd_mask = mmd_mask >> 1;
163 else if (efx_phy_mode_disabled(efx->
phy_mode))
201 static void efx_mdio_set_mmd_lpower(
struct efx_nic *efx,
216 int low_power,
unsigned int mmd_mask)
222 efx_mdio_set_mmd_lpower(efx, low_power, mmd);
223 mmd_mask = (mmd_mask >> 1);
237 efx->
phy_op->get_settings(efx, &prev);
240 ethtool_cmd_speed(ecmd) == ethtool_cmd_speed(&prev) &&
296 return mii_resolve_flowctrl_fdx(
305 u16 physid1, physid2;
312 if ((physid1 == 0x0000) || (physid1 == 0xffff) ||
313 (physid2 == 0x0000) || (physid2 == 0xffff)) {
315 "no MDIO PHY present with ID %d\n", efx->
mdio.prtad);