Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751666AbdFIJMn (ORCPT ); Fri, 9 Jun 2017 05:12:43 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:41071 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751881AbdFIJMk (ORCPT ); Fri, 9 Jun 2017 05:12:40 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.59 with qID v599CcTI015375, This message is accepted by code: ctloc85258 From: Hayes Wang To: CC: , , , Hayes Wang Subject: [PATCH net-next 09/11] r8152: check if disabling ALDPS is finished Date: Fri, 9 Jun 2017 17:11:46 +0800 Message-ID: <1394712342-15778-269-Taiwan-albertk@realtek.com> X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1394712342-15778-260-Taiwan-albertk@realtek.com> References: <1394712342-15778-260-Taiwan-albertk@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.177.200] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 759 Lines: 30 Use PLA 0xe000 bit 8 to check if disabling ALDPS is finished. Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index f43b7a8..204f4b2 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; + } } } -- 2.7.4