Skip to content

Commit 165f4d1

Browse files
Michael Chandavem330
authored andcommitted
tg3: Fix the setting of the APE_HAS_NCSI flag
The driver currently skips setting this flag if the VPD contains the firmware version string. We fix this by separating the probing of NCSI from the reading of the NCSI version string. The APE_HAS_NCSI flag is needed to properly read sensor data. Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5a308f4 commit 165f4d1

File tree

1 file changed

+21
-21
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+21
-21
lines changed

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13858,14 +13858,9 @@ static void __devinit tg3_read_mgmtfw_ver(struct tg3 *tp)
1385813858
}
1385913859
}
1386013860

13861-
static void __devinit tg3_read_dash_ver(struct tg3 *tp)
13861+
static void __devinit tg3_probe_ncsi(struct tg3 *tp)
1386213862
{
13863-
int vlen;
1386413863
u32 apedata;
13865-
char *fwtype;
13866-
13867-
if (!tg3_flag(tp, ENABLE_APE) || !tg3_flag(tp, ENABLE_ASF))
13868-
return;
1386913864

1387013865
apedata = tg3_ape_read32(tp, TG3_APE_SEG_SIG);
1387113866
if (apedata != APE_SEG_SIG_MAGIC)
@@ -13875,14 +13870,22 @@ static void __devinit tg3_read_dash_ver(struct tg3 *tp)
1387513870
if (!(apedata & APE_FW_STATUS_READY))
1387613871
return;
1387713872

13873+
if (tg3_ape_read32(tp, TG3_APE_FW_FEATURES) & TG3_APE_FW_FEATURE_NCSI)
13874+
tg3_flag_set(tp, APE_HAS_NCSI);
13875+
}
13876+
13877+
static void __devinit tg3_read_dash_ver(struct tg3 *tp)
13878+
{
13879+
int vlen;
13880+
u32 apedata;
13881+
char *fwtype;
13882+
1387813883
apedata = tg3_ape_read32(tp, TG3_APE_FW_VERSION);
1387913884

13880-
if (tg3_ape_read32(tp, TG3_APE_FW_FEATURES) & TG3_APE_FW_FEATURE_NCSI) {
13881-
tg3_flag_set(tp, APE_HAS_NCSI);
13885+
if (tg3_flag(tp, APE_HAS_NCSI))
1388213886
fwtype = "NCSI";
13883-
} else {
13887+
else
1388413888
fwtype = "DASH";
13885-
}
1388613889

1388713890
vlen = strlen(tp->fw_ver);
1388813891

@@ -13916,20 +13919,17 @@ static void __devinit tg3_read_fw_ver(struct tg3 *tp)
1391613919
tg3_read_sb_ver(tp, val);
1391713920
else if ((val & TG3_EEPROM_MAGIC_HW_MSK) == TG3_EEPROM_MAGIC_HW)
1391813921
tg3_read_hwsb_ver(tp);
13919-
else
13920-
return;
1392113922

13922-
if (vpd_vers)
13923-
goto done;
13924-
13925-
if (tg3_flag(tp, ENABLE_APE)) {
13926-
if (tg3_flag(tp, ENABLE_ASF))
13927-
tg3_read_dash_ver(tp);
13928-
} else if (tg3_flag(tp, ENABLE_ASF)) {
13929-
tg3_read_mgmtfw_ver(tp);
13923+
if (tg3_flag(tp, ENABLE_ASF)) {
13924+
if (tg3_flag(tp, ENABLE_APE)) {
13925+
tg3_probe_ncsi(tp);
13926+
if (!vpd_vers)
13927+
tg3_read_dash_ver(tp);
13928+
} else if (!vpd_vers) {
13929+
tg3_read_mgmtfw_ver(tp);
13930+
}
1393013931
}
1393113932

13932-
done:
1393313933
tp->fw_ver[TG3_VER_SIZE - 1] = 0;
1393413934
}
1393513935

0 commit comments

Comments
 (0)