From patchwork Mon Apr 1 04:25:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 282511800 for ; Mon, 1 Apr 2019 04:26:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1275D287B6 for ; Mon, 1 Apr 2019 04:26:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05ECA28823; Mon, 1 Apr 2019 04:26:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A33F287B6 for ; Mon, 1 Apr 2019 04:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726531AbfDAE0e (ORCPT ); Mon, 1 Apr 2019 00:26:34 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:46571 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731623AbfDAE0M (ORCPT ); Mon, 1 Apr 2019 00:26:12 -0400 Received: by mail-pl1-f195.google.com with SMTP id y6so3807334pll.13; Sun, 31 Mar 2019 21:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M15SSsqswOiwxhWnX177mGnZWvforApyHb7iTG1lMyk=; b=Kk/se5en2Sz3Z9ozRJsvt0DDkH163RP+1KxrChuxNkDXtcI+ornsyrIb4FUeqE38mk 3lyTAPSM7qKKdFLKAy2FDY0jCGNenhwMhQDXUBbli59hxBATipLzGsqFgFYiylgcocJ6 mPd5s6jXuTiQeRx7+Jox1XXFa8lKRLECwvaF8ZVRsoccXRnyClyMQMasd/v+dGVWkeSn HzN+ivz8pEH8LnwbAwmjn0rqNW8Hy3jCXibBk66JbSrRdx47x2vLsjzrMnUgw9wHN0EC 8BUPNdiqlgJsxZprTWRa7lpU/2yxEfZ4j5gNvnJmFjj/MV6WJTAwdfDpilhOMTsgyFKs lyZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M15SSsqswOiwxhWnX177mGnZWvforApyHb7iTG1lMyk=; b=Y+V3mwO2fd5O/IOxBTr+IpS1VQZfpW4j4wDC+UJps+qDOL0nbOMPHkN3oE0aaLIjr6 DlPfs0lT/vtvIefGNuMT+LxkJ7IdXrWSE64peWkkqpHZsyECSYQ5buJYrYoRWIuPVTDo 3K2q+iMpChwa99D8gZavRGhjZgF91a9HB6keaZ0XEG/CrcNHBlT/H6hCSh/Yoeaw5pZU gPyc92a7OornfAyVTp7wj1p80ZXSWz8UxK377Mmhm3VOs47C2g0l0DGnJtqt69c+8rSi 0tF1jhnlpu4YO5BBjxUQ6kx5Du+xwLBcgXHxTxTHf7LZHXv7qt2RQSJ9WL9C/w0eYDjn 8dtw== X-Gm-Message-State: APjAAAWTxcrgftskZ+VARzCGfN4011zETSl4LDp+yCY1l/HZWI06U7NA vNIMe/FRyN6ejsDlDSdMklDQRS82 X-Google-Smtp-Source: APXvYqwq3u5r+Nbh207nAuIiYhD64NsYeBWNELTtxBIqjDwvuAxTG6ibbn9YVdv+6ZQQsuUtGcbK9A== X-Received: by 2002:a17:902:e90b:: with SMTP id cs11mr3464210plb.243.1554092771562; Sun, 31 Mar 2019 21:26:11 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id t22sm10996829pgu.45.2019.03.31.21.26.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:10 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 08/11] PCI: imx6: Simplify pcie_phy_poll_ack() Date: Sun, 31 Mar 2019 21:25:44 -0700 Message-Id: <20190401042547.14067-9-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190401042547.14067-1-andrew.smirnov@gmail.com> References: <20190401042547.14067-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify pcie_phy_poll_ack() by incorporating shifting into constant definition and convert the code to use 'bool'. No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pci-imx6.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index a49e5e491e12..7c3ffb751002 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -112,7 +112,7 @@ struct imx6_pcie { #define PCIE_PHY_CTRL_RD BIT(19) #define PCIE_PHY_STAT (PL_OFFSET + 0x110) -#define PCIE_PHY_STAT_ACK_LOC 16 +#define PCIE_PHY_STAT_ACK BIT(16) #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C @@ -151,16 +151,16 @@ struct imx6_pcie { #define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5) #define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3) -static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, int exp_val) +static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) { struct dw_pcie *pci = imx6_pcie->pci; - u32 val; + bool val; u32 max_iterations = 10; u32 wait_counter = 0; do { - val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); - val = (val >> PCIE_PHY_STAT_ACK_LOC) & 0x1; + val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT) & + PCIE_PHY_STAT_ACK; wait_counter++; if (val == exp_val)