Thread (15 messages) flat view 15 messages, 2 authors, 2d ago

RE: [PATCH net-next 1/8] r8152: refactor r8156_init

From: Chih Kai Hsu <hidden>
Date: 2026-09-03 02:58:05
Also in: linux-usb, lkml

On Wed, Sep 2, 2026 08:54 PM +0800, Andrew wrote:
quoted
-static int r8159_wait_backup_restore(struct r8152 *tp)
+static void r8156_init(struct r8152 *tp)
 {
-     u32 ocp_data;
+     u16 data;
+     int i;

-     ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0);
-     if (!(ocp_data & PCUT_STATUS))
-             return 0;
+     if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
+             return;

-     return poll_timeout_us(ocp_data = ocp_read_word(tp,
MCU_TYPE_USB, USB_GPHY_CTRL),
quoted
-                            ocp_data & BACKUP_RESTRORE, 200,
20000, false);
quoted
+     ocp_byte_clr_bits(tp, MCU_TYPE_USB, USB_ECM_OP,
EN_ALL_SPEED);
quoted
+
+     ocp_write_word(tp, MCU_TYPE_USB, USB_SPEED_OPTION, 0);
+
+     ocp_word_set_bits(tp, MCU_TYPE_USB, USB_ECM_OPTION,
+ BYPASS_MAC_RESET);
+
+     r8153b_u1u2en(tp, false);
+
+     for (i = 0; i < 500; i++) {
+             if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
+                 AUTOLOAD_DONE)
+                     break;
+
+             msleep(20);
+             if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
+                     return;
+     }
Please use one of the macros from iopoll.h. And return ETIMEDOUT on error.

        Andrew
Ok, I will do it in the next version.

Thank you,
Chih-Kai
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help