From patchwork Tue Aug 25 02:03:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunfeng Yun X-Patchwork-Id: 11734697 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45E37138A for ; Tue, 25 Aug 2020 02:04:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2997A2072D for ; Tue, 25 Aug 2020 02:04:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="Dgjux9zI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726466AbgHYCEo (ORCPT ); Mon, 24 Aug 2020 22:04:44 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:48337 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725781AbgHYCEo (ORCPT ); Mon, 24 Aug 2020 22:04:44 -0400 X-UUID: f3eda44dd7d9449a9dbac3ed2a327111-20200825 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=DVHRh1RBZU+BcDSktqxKWMvFtrCLwtkjiR8252F3Grw=; b=Dgjux9zIVCoQHL5kknP6I1URpOzRZFTSRQhUV2J4JMkiGHNp6QEZdgi34O8g6vbGQl74404uDyf9aqjqr9Sb0dlvr4sQp+LVotOxKgnHFVa96j80+wZvrUD7xXNSXRKVkdEzq1rv4F18UhY5wtv2tgVbWvj/VGPYR5jSuMJGa+4=; X-UUID: f3eda44dd7d9449a9dbac3ed2a327111-20200825 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1259988992; Tue, 25 Aug 2020 10:04:39 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by MTKMBS31N2.mediatek.inc (172.27.4.87) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 Aug 2020 10:04:36 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 25 Aug 2020 10:04:36 +0800 From: Chunfeng Yun To: Kishon Vijay Abraham I CC: Vinod Koul , Andy Gross , Bjorn Andersson , Matthias Brugger , Chunfeng Yun , Rikard Falkeborn , Bharat Gooty , Rayagonda Kokatanur , , , , Subject: [PATCH 2/6] phy: phy-bcm-ns2-usbdrd: convert to readl_poll_timeout_atomic() Date: Tue, 25 Aug 2020 10:03:03 +0800 Message-ID: <1598320987-25518-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1598320987-25518-1-git-send-email-chunfeng.yun@mediatek.com> References: <1598320987-25518-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: EEC3529724919847FA126E25E02BCF7766E0E17551D1EF8D6C698E3376E31CD22000:8 X-MTK: N Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use readl_poll_timeout_atomic() to simplify code Signed-off-by: Chunfeng Yun --- drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c index 5276259..9630ac1 100644 --- a/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c +++ b/drivers/phy/broadcom/phy-bcm-ns2-usbdrd.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -87,17 +88,11 @@ struct ns2_phy_data { static inline int pll_lock_stat(u32 usb_reg, int reg_mask, struct ns2_phy_driver *driver) { - int retry = PLL_LOCK_RETRY; u32 val; - do { - udelay(1); - val = readl(driver->icfgdrd_regs + usb_reg); - if (val & reg_mask) - return 0; - } while (--retry > 0); - - return -EBUSY; + return readl_poll_timeout_atomic(driver->icfgdrd_regs + usb_reg, + val, (val & reg_mask), 1, + PLL_LOCK_RETRY); } static int ns2_drd_phy_init(struct phy *phy)