Skip to content

Commit 9843814

Browse files
Jiawen Wukuba-moo
authored andcommitted
net: txgbe: change LAN reset mode
The old way to do LAN reset is sending reset command to firmware. Once firmware performs reset, it reconfigures what it needs. In the new firmware versions, veto bit is introduced for NCSI/LLDP to block PHY domain in LAN reset. At this point, writing register of LAN reset directly makes the same effect as the old way. And it does not reset MNG domain, so that veto bit does not change. Since veto bit was never used, the old firmware is compatible with the driver before and after this change. The new firmware needs to use with the driver after this change if it wants to implement the new feature, otherwise it is the same as the old firmware. Signed-off-by: Jiawen Wu <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3645c71 commit 9843814

File tree

3 files changed

+4
-70
lines changed

3 files changed

+4
-70
lines changed

drivers/net/ethernet/wangxun/libwx/wx_hw.c

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -431,71 +431,6 @@ int wx_read_ee_hostif_buffer(struct wx *wx,
431431
}
432432
EXPORT_SYMBOL(wx_read_ee_hostif_buffer);
433433

434-
/**
435-
* wx_calculate_checksum - Calculate checksum for buffer
436-
* @buffer: pointer to EEPROM
437-
* @length: size of EEPROM to calculate a checksum for
438-
* Calculates the checksum for some buffer on a specified length. The
439-
* checksum calculated is returned.
440-
**/
441-
static u8 wx_calculate_checksum(u8 *buffer, u32 length)
442-
{
443-
u8 sum = 0;
444-
u32 i;
445-
446-
if (!buffer)
447-
return 0;
448-
449-
for (i = 0; i < length; i++)
450-
sum += buffer[i];
451-
452-
return (u8)(0 - sum);
453-
}
454-
455-
/**
456-
* wx_reset_hostif - send reset cmd to fw
457-
* @wx: pointer to hardware structure
458-
*
459-
* Sends reset cmd to firmware through the manageability
460-
* block.
461-
**/
462-
int wx_reset_hostif(struct wx *wx)
463-
{
464-
struct wx_hic_reset reset_cmd;
465-
int ret_val = 0;
466-
int i;
467-
468-
reset_cmd.hdr.cmd = FW_RESET_CMD;
469-
reset_cmd.hdr.buf_len = FW_RESET_LEN;
470-
reset_cmd.hdr.cmd_or_resp.cmd_resv = FW_CEM_CMD_RESERVED;
471-
reset_cmd.lan_id = wx->bus.func;
472-
reset_cmd.reset_type = (u16)wx->reset_type;
473-
reset_cmd.hdr.checksum = 0;
474-
reset_cmd.hdr.checksum = wx_calculate_checksum((u8 *)&reset_cmd,
475-
(FW_CEM_HDR_LEN +
476-
reset_cmd.hdr.buf_len));
477-
478-
for (i = 0; i <= FW_CEM_MAX_RETRIES; i++) {
479-
ret_val = wx_host_interface_command(wx, (u32 *)&reset_cmd,
480-
sizeof(reset_cmd),
481-
WX_HI_COMMAND_TIMEOUT,
482-
true);
483-
if (ret_val != 0)
484-
continue;
485-
486-
if (reset_cmd.hdr.cmd_or_resp.ret_status ==
487-
FW_CEM_RESP_STATUS_SUCCESS)
488-
ret_val = 0;
489-
else
490-
ret_val = -EFAULT;
491-
492-
break;
493-
}
494-
495-
return ret_val;
496-
}
497-
EXPORT_SYMBOL(wx_reset_hostif);
498-
499434
/**
500435
* wx_init_eeprom_params - Initialize EEPROM params
501436
* @wx: pointer to hardware structure

drivers/net/ethernet/wangxun/libwx/wx_hw.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ int wx_host_interface_command(struct wx *wx, u32 *buffer,
1414
int wx_read_ee_hostif(struct wx *wx, u16 offset, u16 *data);
1515
int wx_read_ee_hostif_buffer(struct wx *wx,
1616
u16 offset, u16 words, u16 *data);
17-
int wx_reset_hostif(struct wx *wx);
1817
void wx_init_eeprom_params(struct wx *wx);
1918
void wx_get_mac_addr(struct wx *wx, u8 *mac_addr);
2019
void wx_init_rx_addrs(struct wx *wx);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,16 @@ static void txgbe_reset_misc(struct wx *wx)
257257
int txgbe_reset_hw(struct wx *wx)
258258
{
259259
int status;
260+
u32 val;
260261

261262
/* Call adapter stop to disable tx/rx and clear interrupts */
262263
status = wx_stop_adapter(wx);
263264
if (status != 0)
264265
return status;
265266

266-
if (!(((wx->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) ||
267-
((wx->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP)))
268-
wx_reset_hostif(wx);
269-
267+
val = WX_MIS_RST_LAN_RST(wx->bus.func);
268+
wr32(wx, WX_MIS_RST, val | rd32(wx, WX_MIS_RST));
269+
WX_WRITE_FLUSH(wx);
270270
usleep_range(10, 100);
271271

272272
status = wx_check_flash_load(wx, TXGBE_SPI_ILDR_STATUS_LAN_SW_RST(wx->bus.func));

0 commit comments

Comments
 (0)