r8152: reset flow control patch when linking on for RTL8153B
authorHayes Wang <hayeswang@realtek.com>
Wed, 22 Jan 2020 08:02:06 +0000 (16:02 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 Jan 2020 10:20:57 +0000 (11:20 +0100)
When linking ON, the patch of flow control has to be reset. This
makes sure the patch works normally.

Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/r8152.c

index 1155597..504db23 100644 (file)
@@ -2865,6 +2865,17 @@ static int rtl8153_enable(struct r8152 *tp)
        r8153_set_rx_early_timeout(tp);
        r8153_set_rx_early_size(tp);
 
+       if (tp->version == RTL_VER_09) {
+               u32 ocp_data;
+
+               ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_FW_TASK);
+               ocp_data &= ~FC_PATCH_TASK;
+               ocp_write_word(tp, MCU_TYPE_USB, USB_FW_TASK, ocp_data);
+               usleep_range(1000, 2000);
+               ocp_data |= FC_PATCH_TASK;
+               ocp_write_word(tp, MCU_TYPE_USB, USB_FW_TASK, ocp_data);
+       }
+
        return rtl_enable(tp);
 }