summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhayeswang <hayeswang@realtek.com>2017-06-09 17:11:46 +0800
committerDavid S. Miller <davem@davemloft.net>2017-06-09 15:37:01 -0400
commit4214cc550bf9d986699a072988503e33d3d3155d (patch)
tree3bf6b5297ec94e675ad31b6f09c6537a75665292
parentbefb2de18195d1ab6b843dd6ca921a222a32a588 (diff)
downloadlinux-4214cc550bf9d986699a072988503e33d3d3155d.tar.gz
linux-4214cc550bf9d986699a072988503e33d3d3155d.tar.bz2
linux-4214cc550bf9d986699a072988503e33d3d3155d.zip
r8152: check if disabling ALDPS is finished
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>
-rw-r--r--drivers/net/usb/r8152.c8
1 files changed, 7 insertions, 1 deletions
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;
+ }
}
}