aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/falcon.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2012-07-03 22:58:33 -0400
committerBen Hutchings <bhutchings@solarflare.com>2012-07-17 11:12:33 -0400
commitd4f2cecce138c34960c467d0ae38a6d4bcd6af7b (patch)
tree19a93bad8f6a56361b3b2f12beecae97be4d8ea0 /drivers/net/ethernet/sfc/falcon.c
parent0f1e54ae52b950ed79074ae794d027d6c97fd34e (diff)
sfc: Disable VF queues during register self-test
Currently VF queues and drivers may remain active during this test. This could cause memory corruption or spurious test failures. Therefore we reset the port/function before running these tests on Siena. On Falcon this doesn't work: we have to do some additional initialisation before some blocks will work again. So refactor the reset/register-test sequence into an efx_nic_type method so efx_selftest() doesn't have to consider such quirks. In the process, fix another minor bug: Siena does not have an 'invisible' reset and the self-test currently fails to push the PHY configuration after resetting. Passing RESET_TYPE_ALL to efx_reset_{down,up}() fixes this. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers/net/ethernet/sfc/falcon.c')
-rw-r--r--drivers/net/ethernet/sfc/falcon.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c
index 3a1ca2bd154..12b573a8e82 100644
--- a/drivers/net/ethernet/sfc/falcon.c
+++ b/drivers/net/ethernet/sfc/falcon.c
@@ -25,9 +25,12 @@
25#include "io.h" 25#include "io.h"
26#include "phy.h" 26#include "phy.h"
27#include "workarounds.h" 27#include "workarounds.h"
28#include "selftest.h"
28 29
29/* Hardware control for SFC4000 (aka Falcon). */ 30/* Hardware control for SFC4000 (aka Falcon). */
30 31
32static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method);
33
31static const unsigned int 34static const unsigned int
32/* "Large" EEPROM device: Atmel AT25640 or similar 35/* "Large" EEPROM device: Atmel AT25640 or similar
33 * 8 KB, 16-bit address, 32 B write block */ 36 * 8 KB, 16-bit address, 32 B write block */
@@ -1034,10 +1037,34 @@ static const struct efx_nic_register_test falcon_b0_register_tests[] = {
1034 EFX_OWORD32(0x0003FF0F, 0x00000000, 0x00000000, 0x00000000) }, 1037 EFX_OWORD32(0x0003FF0F, 0x00000000, 0x00000000, 0x00000000) },
1035}; 1038};
1036 1039
1037static int falcon_b0_test_registers(struct efx_nic *efx) 1040static int
1041falcon_b0_test_chip(struct efx_nic *efx, struct efx_self_tests *tests)
1038{ 1042{
1039 return efx_nic_test_registers(efx, falcon_b0_register_tests, 1043 enum reset_type reset_method = RESET_TYPE_INVISIBLE;
1040 ARRAY_SIZE(falcon_b0_register_tests)); 1044 int rc, rc2;
1045
1046 mutex_lock(&efx->mac_lock);
1047 if (efx->loopback_modes) {
1048 /* We need the 312 clock from the PHY to test the XMAC
1049 * registers, so move into XGMII loopback if available */
1050 if (efx->loopback_modes & (1 << LOOPBACK_XGMII))
1051 efx->loopback_mode = LOOPBACK_XGMII;
1052 else
1053 efx->loopback_mode = __ffs(efx->loopback_modes);
1054 }
1055 __efx_reconfigure_port(efx);
1056 mutex_unlock(&efx->mac_lock);
1057
1058 efx_reset_down(efx, reset_method);
1059
1060 tests->registers =
1061 efx_nic_test_registers(efx, falcon_b0_register_tests,
1062 ARRAY_SIZE(falcon_b0_register_tests))
1063 ? -1 : 1;
1064
1065 rc = falcon_reset_hw(efx, reset_method);
1066 rc2 = efx_reset_up(efx, reset_method, rc == 0);
1067 return rc ? rc : rc2;
1041} 1068}
1042 1069
1043/************************************************************************** 1070/**************************************************************************
@@ -1818,7 +1845,7 @@ const struct efx_nic_type falcon_b0_nic_type = {
1818 .get_wol = falcon_get_wol, 1845 .get_wol = falcon_get_wol,
1819 .set_wol = falcon_set_wol, 1846 .set_wol = falcon_set_wol,
1820 .resume_wol = efx_port_dummy_op_void, 1847 .resume_wol = efx_port_dummy_op_void,
1821 .test_registers = falcon_b0_test_registers, 1848 .test_chip = falcon_b0_test_chip,
1822 .test_nvram = falcon_test_nvram, 1849 .test_nvram = falcon_test_nvram,
1823 1850
1824 .revision = EFX_REV_FALCON_B0, 1851 .revision = EFX_REV_FALCON_B0,