aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/qt202x_phy.c
diff options
context:
space:
mode:
authorSteve Hodgson <shodgson@solarflare.com>2009-11-28 00:34:05 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-29 02:58:50 -0500
commitfdaa9aed21c8c8b529f3c94a5ffa138bf3360b75 (patch)
tree6db7fd76481b3f87f0f4e94e1bd55c0624fba296 /drivers/net/sfc/qt202x_phy.c
parent5e7565930524410f097f5b04f8aba663089a6ffc (diff)
sfc: Simplify PHY polling
Falcon can generate events for LASI interrupts from the PHY, but in practice we have never implemented this in reference designs. Instead we have polled, inserted the appropriate events, and then handled the events later. This is a waste of time and code. Instead, make PHY poll functions update the link state synchronously and report whether it changed. We can still make use of the LASI registers as a shortcut on the SFT9001. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/qt202x_phy.c')
-rw-r--r--drivers/net/sfc/qt202x_phy.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c
index f9c354e9fc3c..1b174c3e6c12 100644
--- a/drivers/net/sfc/qt202x_phy.c
+++ b/drivers/net/sfc/qt202x_phy.c
@@ -167,29 +167,26 @@ static int qt202x_phy_init(struct efx_nic *efx)
167 return rc; 167 return rc;
168} 168}
169 169
170static void qt202x_phy_clear_interrupt(struct efx_nic *efx)
171{
172 /* Read to clear link status alarm */
173 efx_mdio_read(efx, MDIO_MMD_PMAPMD, MDIO_PMA_LASI_STAT);
174}
175
176static int qt202x_link_ok(struct efx_nic *efx) 170static int qt202x_link_ok(struct efx_nic *efx)
177{ 171{
178 return efx_mdio_links_ok(efx, QT202X_REQUIRED_DEVS); 172 return efx_mdio_links_ok(efx, QT202X_REQUIRED_DEVS);
179} 173}
180 174
181static void qt202x_phy_poll(struct efx_nic *efx) 175static bool qt202x_phy_poll(struct efx_nic *efx)
182{ 176{
183 int link_up = qt202x_link_ok(efx); 177 bool was_up = efx->link_state.up;
184 /* Simulate a PHY event if link state has changed */ 178
185 if (link_up != efx->link_state.up) 179 efx->link_state.up = qt202x_link_ok(efx);
186 falcon_sim_phy_event(efx); 180 efx->link_state.speed = 10000;
181 efx->link_state.fd = true;
182 efx->link_state.fc = efx->wanted_fc;
183
184 return efx->link_state.up != was_up;
187} 185}
188 186
189static void qt202x_phy_reconfigure(struct efx_nic *efx) 187static void qt202x_phy_reconfigure(struct efx_nic *efx)
190{ 188{
191 struct qt202x_phy_data *phy_data = efx->phy_data; 189 struct qt202x_phy_data *phy_data = efx->phy_data;
192 struct efx_link_state *link_state = &efx->link_state;
193 190
194 if (efx->phy_type == PHY_TYPE_QT2025C) { 191 if (efx->phy_type == PHY_TYPE_QT2025C) {
195 /* There are several different register bits which can 192 /* There are several different register bits which can
@@ -216,10 +213,6 @@ static void qt202x_phy_reconfigure(struct efx_nic *efx)
216 efx_mdio_phy_reconfigure(efx); 213 efx_mdio_phy_reconfigure(efx);
217 214
218 phy_data->phy_mode = efx->phy_mode; 215 phy_data->phy_mode = efx->phy_mode;
219 link_state->up = qt202x_link_ok(efx);
220 link_state->speed = 10000;
221 link_state->fd = true;
222 link_state->fc = efx->wanted_fc;
223} 216}
224 217
225static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) 218static void qt202x_phy_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
@@ -240,7 +233,6 @@ struct efx_phy_operations falcon_qt202x_phy_ops = {
240 .reconfigure = qt202x_phy_reconfigure, 233 .reconfigure = qt202x_phy_reconfigure,
241 .poll = qt202x_phy_poll, 234 .poll = qt202x_phy_poll,
242 .fini = qt202x_phy_fini, 235 .fini = qt202x_phy_fini,
243 .clear_interrupt = qt202x_phy_clear_interrupt,
244 .get_settings = qt202x_phy_get_settings, 236 .get_settings = qt202x_phy_get_settings,
245 .set_settings = efx_mdio_set_settings, 237 .set_settings = efx_mdio_set_settings,
246 .mmds = QT202X_REQUIRED_DEVS, 238 .mmds = QT202X_REQUIRED_DEVS,