From: hayeswang Date: Fri, 9 Jun 2017 09:11:46 +0000 (+0800) Subject: r8152: check if disabling ALDPS is finished X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4214cc550bf9d986699a072988503e33d3d3155d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git r8152: check if disabling ALDPS is finished Use PLA 0xe000 bit 8 to check if disabling ALDPS is finished. Signed-off-by: Hayes Wang Signed-off-by: David S. Miller --- diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index f43b7a8ecfff..204f4b2155ae 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -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; + } } }