Skip to content

Commit d84a3ff

Browse files
Jiawen WuPaolo Abeni
authored andcommitted
net: txgbe: Restrict the use of mismatched FW versions
The new added mailbox commands require a new released firmware version. Otherwise, a lot of logs "Unknown FW command" would be printed. And the devices may not work properly. So add the test command in the probe function. Signed-off-by: Jiawen Wu <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent c0f2e51 commit d84a3ff

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

drivers/net/ethernet/wangxun/txgbe/txgbe_aml.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ irqreturn_t txgbe_gpio_irq_handler_aml(int irq, void *data)
5050
return IRQ_HANDLED;
5151
}
5252

53+
int txgbe_test_hostif(struct wx *wx)
54+
{
55+
struct txgbe_hic_ephy_getlink buffer;
56+
57+
if (wx->mac.type != wx_mac_aml)
58+
return 0;
59+
60+
buffer.hdr.cmd = FW_PHY_GET_LINK_CMD;
61+
buffer.hdr.buf_len = sizeof(struct txgbe_hic_ephy_getlink) -
62+
sizeof(struct wx_hic_hdr);
63+
buffer.hdr.cmd_or_resp.cmd_resv = FW_CEM_CMD_RESERVED;
64+
65+
return wx_host_interface_command(wx, (u32 *)&buffer, sizeof(buffer),
66+
WX_HI_COMMAND_TIMEOUT, true);
67+
}
68+
5369
static int txgbe_identify_sfp_hostif(struct wx *wx, struct txgbe_hic_i2c_read *buffer)
5470
{
5571
buffer->hdr.cmd = FW_READ_SFP_INFO_CMD;

drivers/net/ethernet/wangxun/txgbe/txgbe_aml.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
void txgbe_gpio_init_aml(struct wx *wx);
88
irqreturn_t txgbe_gpio_irq_handler_aml(int irq, void *data);
9+
int txgbe_test_hostif(struct wx *wx);
910
int txgbe_set_phy_link(struct wx *wx);
1011
int txgbe_identify_sfp(struct wx *wx);
1112
void txgbe_setup_link(struct wx *wx);

drivers/net/ethernet/wangxun/txgbe/txgbe_main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,13 @@ static int txgbe_probe(struct pci_dev *pdev,
864864
if (etrack_id < 0x20010)
865865
dev_warn(&pdev->dev, "Please upgrade the firmware to 0x20010 or above.\n");
866866

867+
err = txgbe_test_hostif(wx);
868+
if (err != 0) {
869+
dev_err(&pdev->dev, "Mismatched Firmware version\n");
870+
err = -EIO;
871+
goto err_release_hw;
872+
}
873+
867874
txgbe = devm_kzalloc(&pdev->dev, sizeof(*txgbe), GFP_KERNEL);
868875
if (!txgbe) {
869876
err = -ENOMEM;

0 commit comments

Comments
 (0)