diff options
Diffstat (limited to 'drivers/net/ethernet/sfc/falcon.c')
-rw-r--r-- | drivers/net/ethernet/sfc/falcon.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sfc/falcon.c b/drivers/net/ethernet/sfc/falcon.c index 3a1ca2bd1548..12b573a8e82b 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 | ||
32 | static int falcon_reset_hw(struct efx_nic *efx, enum reset_type method); | ||
33 | |||
31 | static const unsigned int | 34 | static 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 | ||
1037 | static int falcon_b0_test_registers(struct efx_nic *efx) | 1040 | static int |
1041 | falcon_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, |