]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
r8152: check if disabling ALDPS is finished
authorhayeswang <hayeswang@realtek.com>
Fri, 9 Jun 2017 09:11:46 +0000 (17:11 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 Jun 2017 19:37:01 +0000 (15:37 -0400)
Use PLA 0xe000 bit 8 to check if disabling ALDPS is finished.

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

index f43b7a8ecfffc72b22500c3603cad34bfb366ebf..204f4b2155ae0db3fbb67660a7bf92794ca0fdd0 100644 (file)
@@ -2836,9 +2836,15 @@ static void r8153_aldps_en(struct r8152 *tp, bool enable)
                data |= EN_ALDPS;
                ocp_reg_write(tp, OCP_POWER_CFG, data);
        } else {
+               int i;
+
                data &= ~EN_ALDPS;
                ocp_reg_write(tp, OCP_POWER_CFG, data);
-               msleep(20);
+               for (i = 0; i < 20; i++) {
+                       usleep_range(1000, 2000);
+                       if (ocp_read_word(tp, MCU_TYPE_PLA, 0xe000) & 0x0100)
+                               break;
+               }
        }
 }