Skip to content

Commit cdf0b86

Browse files
hayesorzkuba-moo
authored andcommitted
r8152: fix a WOL issue
This fixes that the platform is waked by an unexpected packet. The size and range of FIFO is different when the device enters S3 state, so it is necessary to correct some settings when suspending. Regardless of jumbo frame, set RMS to 1522 and MTPS to MTPS_DEFAULT. Besides, enable MCU_BORW_EN to update the method of calculating the pointer of data. Then, the hardware could get the correct data. Fixes: 195aae3 ("r8152: support new chips") Signed-off-by: Hayes Wang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b3fcfc4 commit cdf0b86

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/net/usb/r8152.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define NETNEXT_VERSION "12"
3333

3434
/* Information for net */
35-
#define NET_VERSION "12"
35+
#define NET_VERSION "13"
3636

3737
#define DRIVER_VERSION "v1." NETNEXT_VERSION "." NET_VERSION
3838
#define DRIVER_AUTHOR "Realtek linux nic maintainers <[email protected]>"
@@ -5917,7 +5917,8 @@ static void r8153_enter_oob(struct r8152 *tp)
59175917

59185918
wait_oob_link_list_ready(tp);
59195919

5920-
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, mtu_to_size(tp->netdev->mtu));
5920+
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, 1522);
5921+
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_MTPS, MTPS_DEFAULT);
59215922

59225923
switch (tp->version) {
59235924
case RTL_VER_03:
@@ -5953,6 +5954,10 @@ static void r8153_enter_oob(struct r8152 *tp)
59535954
ocp_data |= NOW_IS_OOB | DIS_MCU_CLROOB;
59545955
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
59555956

5957+
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7);
5958+
ocp_data |= MCU_BORW_EN;
5959+
ocp_write_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7, ocp_data);
5960+
59565961
rxdy_gated_en(tp, false);
59575962

59585963
ocp_data = ocp_read_dword(tp, MCU_TYPE_PLA, PLA_RCR);
@@ -6555,6 +6560,9 @@ static void rtl8156_down(struct r8152 *tp)
65556560
rtl_disable(tp);
65566561
rtl_reset_bmu(tp);
65576562

6563+
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, 1522);
6564+
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_MTPS, MTPS_DEFAULT);
6565+
65586566
/* Clear teredo wake event. bit[15:8] is the teredo wakeup
65596567
* type. Set it to zero. bits[7:0] are the W1C bits about
65606568
* the events. Set them to all 1 to clear them.
@@ -6565,6 +6573,10 @@ static void rtl8156_down(struct r8152 *tp)
65656573
ocp_data |= NOW_IS_OOB;
65666574
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL, ocp_data);
65676575

6576+
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7);
6577+
ocp_data |= MCU_BORW_EN;
6578+
ocp_write_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7, ocp_data);
6579+
65686580
rtl_rx_vlan_en(tp, true);
65696581
rxdy_gated_en(tp, false);
65706582

0 commit comments

Comments
 (0)