From patchwork Mon Apr 1 04:25:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879083 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 693141390 for ; Mon, 1 Apr 2019 04:26:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54BE7287B6 for ; Mon, 1 Apr 2019 04:26:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 488B42881E; Mon, 1 Apr 2019 04:26:53 +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=unavailable 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 E9E51287B6 for ; Mon, 1 Apr 2019 04:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726845AbfDAE0C (ORCPT ); Mon, 1 Apr 2019 00:26:02 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45168 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbfDAE0C (ORCPT ); Mon, 1 Apr 2019 00:26:02 -0400 Received: by mail-pl1-f195.google.com with SMTP id bf11so3804930plb.12; Sun, 31 Mar 2019 21:26:01 -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=9lh2H/6g5jBbi6IngiMFn0hLKnDUr/9F5dB06DXbVl8=; b=mkFyuQqc67MMHTIgJJyZ3+5FCf97MK+MCJJde3c4fvPP9R0wzD+WU09igJNyqLJbpE NQkiNtUCciSKNlCdFMGz9H8OOfxMjI3g9aSyczXB0WLVY+NbY5HBvTg0NTZbWsX8xHhi a2bxAa+mfh8L8CHdOYaqhfJnaBtJUJzHGpBxZyG4h72JFLoorc0YB8nWnA/2VuV9ADq3 bTu6HJZ2AVu2ufGtJGI2xdmBobTXb35zMfTxXzshkhyoX1bArrvrGJsw5EVa/iTEGqvp 5DoE5AyvbN3HQbrx2R2ucoKKhVQbpDmiMiozWO7FNN63cA+nOm/ScbBzRNWn+KoDV+H9 AyTw== 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=9lh2H/6g5jBbi6IngiMFn0hLKnDUr/9F5dB06DXbVl8=; b=cvkLG5kDQ65I9ijG/3g7oX81YacsIy2VxlGkPAZWMobnZJLwmUCzhs40EgmACj6tZG FgmyD9SG7WpLbq64/R40zU6YRWK8Cqrv90NJjx3S+1Odev7cAURk0x1swh4rfIQD7N47 dW7ueEc4EQNZPZS/NoZOw4Sa+nvuEzZ/caKaPEGPw/dj8ttDofXPZHZYYD0uI1DeleLG XZaSqlSQ8LP+vSLJyx1edNtQj0XM5XJhGRWSRsifpbxpXpWtZalWNM1cjHfsTxc4/NJ9 ryJr8GSyklwbk3Mtp7d8E8sGKpwXHfeqtQaMCEBRlOjC9GsscKhH9RoHRaXkK4JZUdN5 fm9Q== X-Gm-Message-State: APjAAAVI3BVmkmjJZlUyzY2VXDfFcIshUnQvu+lBbJEWMbx8Brzlx6Lk LvqZ+qrhhXdYlUn5HZlWSR1G+GR0 X-Google-Smtp-Source: APXvYqxSB7+e3gFaCzu0rvu02ORh1qy0wI09Zfrn2l5rMxegtyN5WyS5gC7XMT60Ya2Epy0acP9aow== X-Received: by 2002:a17:902:a513:: with SMTP id s19mr10169288plq.97.1554092760719; Sun, 31 Mar 2019 21:26:00 -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.25.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:25:59 -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 01/11] PCI: imx6: Simplify imx7d_pcie_wait_for_phy_pll_lock() Date: Sun, 31 Mar 2019 21:25:37 -0700 Message-Id: <20190401042547.14067-2-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 Make use of regmap_read_poll_timeout() to simplify imx7d_pcie_wait_for_phy_pll_lock(). 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 Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 2eb39d5de4f6..fb0b29e5b1f0 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -89,9 +89,8 @@ struct imx6_pcie { }; /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */ -#define PHY_PLL_LOCK_WAIT_MAX_RETRIES 2000 -#define PHY_PLL_LOCK_WAIT_USLEEP_MIN 50 #define PHY_PLL_LOCK_WAIT_USLEEP_MAX 200 +#define PHY_PLL_LOCK_WAIT_TIMEOUT (2000 * PHY_PLL_LOCK_WAIT_USLEEP_MAX) /* PCIe Root Complex registers (memory-mapped) */ #define PCIE_RC_IMX6_MSI_CAP 0x50 @@ -488,20 +487,14 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) { u32 val; - unsigned int retries; struct device *dev = imx6_pcie->pci->dev; - for (retries = 0; retries < PHY_PLL_LOCK_WAIT_MAX_RETRIES; retries++) { - regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR22, &val); - - if (val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED) - return; - - usleep_range(PHY_PLL_LOCK_WAIT_USLEEP_MIN, - PHY_PLL_LOCK_WAIT_USLEEP_MAX); - } - - dev_err(dev, "PCIe PLL lock timeout\n"); + if (regmap_read_poll_timeout(imx6_pcie->iomuxc_gpr, + IOMUXC_GPR22, val, + val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED, + PHY_PLL_LOCK_WAIT_USLEEP_MAX, + PHY_PLL_LOCK_WAIT_TIMEOUT)) + dev_err(dev, "PCIe PLL lock timeout\n"); } static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) From patchwork Mon Apr 1 04:25:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879081 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 6868B1390 for ; Mon, 1 Apr 2019 04:26:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53C44287B6 for ; Mon, 1 Apr 2019 04:26:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 481242881E; Mon, 1 Apr 2019 04:26:51 +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 E5CA3287B6 for ; Mon, 1 Apr 2019 04:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbfDAE0D (ORCPT ); Mon, 1 Apr 2019 00:26:03 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39604 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbfDAE0D (ORCPT ); Mon, 1 Apr 2019 00:26:03 -0400 Received: by mail-pl1-f193.google.com with SMTP id b65so3816223plb.6; Sun, 31 Mar 2019 21:26:02 -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=F8oXQCp56ZlNvc+eSoHWKahah7TDd6mimNeNhGWIK+s=; b=rtN8s57WRffcMH2IkFTtr1Iyk6C/knJjziPcbblRi7bEaR8VImlr9xv+6B7m8lirKO 0E6M/XRUApMMrh5uFLpCnBY77gNftJI9LjuZWKMIMHOaI5O6MaV/z2EPQfbRrTyxN9Vp 9Ncxm5qRGhZWyYPHq3VurGOlbpWWjhHWxxr9W6RDzv/7hnv/ZMKJyiGF1fOKvotv9dN5 jLqo3HymvrGMTsEeQvA0+CBQN617c1Ps9cTfzXDWMdVLNNrwUdpk/ddkD7JwE9Kp3mfI y3BgoOqpdkpLbTq+zIkZ7FK58QvC2iXJp10siqkwGayR/jKuObnSJxPRf5vhopch4jeb Cqvg== 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=F8oXQCp56ZlNvc+eSoHWKahah7TDd6mimNeNhGWIK+s=; b=kgRMZnPlEQeRqbqFM9SB23pRdNAdnby1g4dOGQSbeGzO3eGpv8skMakgbcLTORx/gL xCdE8GQGrn06P/H/1XZeyNWgnlH3Tg2fvkrCdNBxWSQIZPk8zbA8c9V+G2R2Ci09f8a2 xJhNNHI/BVD2ApmdqTceDv8RjjjmCAtvulUtC12pc2IUoQjpdrV86e4hetKnt6ZH6EqB fV68dVVcubrC8/XyyEHdFdRaIThMMa5Ga4O5rjuIpd0ziH0tS2ZInfUHYnQXbsfx1ZPI r69LZOEeOCA4OWW0/0F1zfbQu6FCvx9gyHsEnO3vxd8RHaJRVgegwrYs/xYYDURAiz3J ZrFA== X-Gm-Message-State: APjAAAV40+jdujT2XIihzKCAv7hxu2YqZahEqV9Rory4hIyZJI5tKR7S CkM6exwUnfzp26+G6eHAL9kKjrTn X-Google-Smtp-Source: APXvYqxsOciJD3nXK9tfj+BsoGE2REapwqP7u/Wjlo23MzmgnpD2lRXHzbHjJ+F3JxqG9Hv28f/NGQ== X-Received: by 2002:a17:902:8349:: with SMTP id z9mr41663324pln.144.1554092762162; Sun, 31 Mar 2019 21:26:02 -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.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:01 -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 02/11] PCI: imx6: Remove redundant debug tracing Date: Sun, 31 Mar 2019 21:25:38 -0700 Message-Id: <20190401042547.14067-3-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 All calls to imx6_pcie_wait_for_link() share the same error path and the state of PHY debug registers will already be printed there. 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 | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index fb0b29e5b1f0..7582d0b2fbe7 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -726,16 +726,9 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) static int imx6_pcie_wait_for_link(struct imx6_pcie *imx6_pcie) { struct dw_pcie *pci = imx6_pcie->pci; - struct device *dev = pci->dev; /* check if the link is up or not */ - if (!dw_pcie_wait_for_link(pci)) - return 0; - - dev_dbg(dev, "DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n", - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0), - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1)); - return -ETIMEDOUT; + return dw_pcie_wait_for_link(pci); } static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) From patchwork Mon Apr 1 04:25:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879057 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 2E51F139A for ; Mon, 1 Apr 2019 04:26:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19A86287B6 for ; Mon, 1 Apr 2019 04:26:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DEBF2881E; Mon, 1 Apr 2019 04:26:11 +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 A1D5A287B6 for ; Mon, 1 Apr 2019 04:26:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731210AbfDAE0J (ORCPT ); Mon, 1 Apr 2019 00:26:09 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43260 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727447AbfDAE0F (ORCPT ); Mon, 1 Apr 2019 00:26:05 -0400 Received: by mail-pl1-f193.google.com with SMTP id m10so3810749plt.10; Sun, 31 Mar 2019 21:26:04 -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=lRIMMJnFx48ZsTwclAff4hTCypRB7eLLBoMHJVX8zVw=; b=YdJza43BOnVXl9w4aQozS74ldOjIc2qmzmlWkf+Rwl8s9hWdwv0lPiAIAGYAlEf+C1 6sOKRcqWnBbADp51djipuN4KA5q8DAhPigCcZCZsap+TpsLaGBDDq/7gcQN3K4/CiDOT zK/pSCYjJRrKtwgCc6XM9H6wgayOD0bIHCh7p3ModGUslfawaNzTKShKHGknuQbvPF8/ 0PJJybLnyDeMDKlemP4vluJWGOFokCDDtAlYaOG3hWG76sV9f6VGZhNUHMPBfFyFDpoj wNP5mRdx/lRSWtJTKmIpsd6nzEgRrFrZsOhR9wnkDaXYdOn8P6zYOQ5WXamlKUnswHqy kXKw== 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=lRIMMJnFx48ZsTwclAff4hTCypRB7eLLBoMHJVX8zVw=; b=nUOV72CXSoclBFSRKtEd7EoMIJPIUdNFOmlPJwNZd3MKNSejbR/EY4iIA2VEkcYBB7 3y9u2sS/yvgqnHWzdKzeVjWgBc7b8TWnSBae3nPH9b1PouCbe89vVpANCDxZS/LOYDzP ch0RsB3NBvl5p6p9nMfVifyxoLlhcMfKxgbuK1sLnI/Azsc8dFkB9tRwmkvGAnOy8+vT A1e+ptqaNqaMH95dIkCj3eB7HC8jeWACAPa18xJDOriIWh6nf9vcIpZKWfo6tnJXLXHx lkMsam0AJoum8C1OZJezp90K8LegKep+UaIzLCBHAaX4PHbXkgP1tzf/GsA3pAjeSBUw sq4g== X-Gm-Message-State: APjAAAXjQZIrTUmoJcDCN4SmeRaZA55S/MN3dsJyZdsQxCrvgck8HyET /ZbU77z0hNRb+DBCpkl/vJqauglU X-Google-Smtp-Source: APXvYqxffyBQyjAtvVDGeBIA7I3n5OMk2RMcayjx8YTwssnSmQDR2SuLAIdmd2JKzBnrn+YGHp6XWw== X-Received: by 2002:a17:902:6b81:: with SMTP id p1mr62773899plk.106.1554092764177; Sun, 31 Mar 2019 21:26:04 -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.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:03 -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 03/11] PCI: imx6: Return -ETIMEOUT from imx6_pcie_wait_for_speed_change() Date: Sun, 31 Mar 2019 21:25:39 -0700 Message-Id: <20190401042547.14067-4-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 Change error code from EINVAL to ETIMEDOUT in imx6_pcie_wait_for_speed_change() since that error code seems more appropriate. 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 Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 7582d0b2fbe7..3f4707072942 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -747,7 +747,7 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) } dev_err(dev, "Speed change timeout\n"); - return -EINVAL; + return -ETIMEDOUT; } static void imx6_pcie_ltssm_enable(struct device *dev) From patchwork Mon Apr 1 04:25:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879075 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 0301E1390 for ; Mon, 1 Apr 2019 04:26:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E20D1287B6 for ; Mon, 1 Apr 2019 04:26:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2F0E28823; Mon, 1 Apr 2019 04:26:42 +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 75C2C287B6 for ; Mon, 1 Apr 2019 04:26:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731111AbfDAE0I (ORCPT ); Mon, 1 Apr 2019 00:26:08 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38732 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbfDAE0H (ORCPT ); Mon, 1 Apr 2019 00:26:07 -0400 Received: by mail-pf1-f195.google.com with SMTP id 10so3882042pfo.5; Sun, 31 Mar 2019 21:26:06 -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=xPS6eriV1RNG7+i63e9okUWFl9H6ovMd2i7tJGd9Na4=; b=It3my+tkm2rh7qzaj/fwyBLYrbSqe48T9Vw3hzIRFfZc773481pr2ncPrOATkFlkPK vo4QBeUJHihvMlYFjW0tbuWh41jlbk5u1SOAuGwv0p5PKFhYtthLdWutJEOLAe6QZKuc VpOrkyeQFlCm/x3M0Q9ri9yvMTwQ9dVKcZ2BJDfW0wjalzquVlGY7JoN0Iw0iEjiQv66 frEEus3FQb/amVjKofKQBdAmybwLT4kjTAJH9CAeSPq0LqggaAwovOJzmo7vz4HCy7zn vZr1RRDyPLyhuwbbztEFCLKcjjdr1egOgxDAoy65CeMArejMPoBlGAEu1ffkYY4pphsp ZG8w== 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=xPS6eriV1RNG7+i63e9okUWFl9H6ovMd2i7tJGd9Na4=; b=RLRQmZhQeMro9w+HupVPMw30SLA9JUb6Z/DoM2sf1Yzda0mfVyaXwdx4Hv7BnfV/op NQE1vrCAY9ZA0YQD7Wk5tLpHOQQ2LMWHd98NPY6IkPezfw2Ki6r1dKMtnZnuqU862KtC bQfIMCXC02hbPHp+k4Pbj0igfSFZ+34MIUDssOoNhrubb+JrrCF8/+maE1avdjPgfRqE rlSo0SajPUpulPxqhsozJ6TcZVMIZYu2XWTq7SMmgLVUhh9Y1decV7VE7wIaka6taXUx ic8tAT6J1/jjQMCJBtg2jo09hAKvcerIyp3qj4i1x4JNdB5IRhsGjoNXmtRJGcSZNcc1 8agQ== X-Gm-Message-State: APjAAAUm7xc6KoxB9kPYOEKATrf7MdFTPWmeypurn4tk/jWE1v/vZqWN 7E2yMZGKatb92RM6GN9r/lNxayer X-Google-Smtp-Source: APXvYqyicxturgChify1dQhXwW+Mi6Yxk6kl0UDNKC5iRrwsnBkTMDrHa3stZlY2uOb3PHG92oC5GA== X-Received: by 2002:a63:2106:: with SMTP id h6mr58279524pgh.441.1554092765627; Sun, 31 Mar 2019 21:26:05 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:04 -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 04/11] PCI: imx6: Remove PCIE_PL_PFLR_* constants Date: Sun, 31 Mar 2019 21:25:40 -0700 Message-Id: <20190401042547.14067-5-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 Code using these constants was removed in commit a71280722eeb ("PCI: imx6: Remove LTSSM disable workaround"). 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 Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 3f4707072942..92c40c250a34 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -103,9 +103,6 @@ struct imx6_pcie { /* PCIe Port Logic registers (memory-mapped) */ #define PL_OFFSET 0x700 -#define PCIE_PL_PFLR (PL_OFFSET + 0x08) -#define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16) -#define PCIE_PL_PFLR_FORCE_LINK (1 << 15) #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) From patchwork Mon Apr 1 04:25:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879059 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 49CB41390 for ; Mon, 1 Apr 2019 04:26:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 354DF287B6 for ; Mon, 1 Apr 2019 04:26:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25E7B2881E; Mon, 1 Apr 2019 04:26:12 +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 A8AA0287B6 for ; Mon, 1 Apr 2019 04:26:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731364AbfDAE0J (ORCPT ); Mon, 1 Apr 2019 00:26:09 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:39805 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbfDAE0I (ORCPT ); Mon, 1 Apr 2019 00:26:08 -0400 Received: by mail-pg1-f196.google.com with SMTP id k3so4068582pga.6; Sun, 31 Mar 2019 21:26:07 -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=8whUmPYH8KsqvkwsmrRZwN7fZI8OQ9E54/C8jqSTYVM=; b=vLKrtTIXy4SD7SlQWtGDn/Rm38iDuIjIeGocg0oZARQHvW0QgDXqxpGBaC/CIBXIaa tlug3ab3KQuyxMKo5ALEcNQEbFmlkV7L8LxOVpkzWotBEPydQ5ux9nm38/xk+lzeft4q VFmeJX8EW/Dk8hI6Oex4a0wnZxY2ES3brJT5OVhz0Nd59Jp+WlviyRxWCYJ2DdeXALSD 0eQFYNM36x/bApzkmP3NAPd5t8WQh58vSBhGyaDe4ujIbjuOzhkku9ACLXBmU9Rke9ob 7fLWHk/JiElZpT5pw/MTxL1oXe/R92NYcFfB21qr6CpfVVq7LRjr6gxvvUM/dg0ihPSr 5Csw== 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=8whUmPYH8KsqvkwsmrRZwN7fZI8OQ9E54/C8jqSTYVM=; b=VkF5B7Gs+sP0slQfSTdST0+oM9R/4Go9CYrDLLXboe5ysjgtoGWwmFFJj7kYjQ5+CG OC58NDMMsMTd9SyXv/d1Fw0GL1dF4XikJHgg0fJ4EkPGfKGQdHLU+kk8A3YsVeE+Vq+5 qsNWElBxdeJPN3SSWmAiTkuzTfepJt02AqRAaT08eOwazDrEGyQTieu4YKR3VJxM/6FB FVqvfHd+rHfAEH/6TrBpCCkuqGSEn9/5PIQb/xLWamrjXh2QaA4Qm6zKS9+TznoafYPa UHQjw+WEARbygUyqNGrpiOyVQtwg6BVrPraB0+plLfZ9VvxXZRGGbPBahpuI3c4/KoJe EgNA== X-Gm-Message-State: APjAAAVXiH9hirvP02mUJxTqYQSyChC0RRN8woqF9a43toX7PMQ2er36 PYw+Vvcx6nwb2smimGj+uT3T4vrZ X-Google-Smtp-Source: APXvYqyglTsuRlhl/0izWWPDsxD4hoX3JRd6WuETqcXR6P2heRnmooiXnKqhRPv23Ruocf8sZyxL/w== X-Received: by 2002:a63:fa54:: with SMTP id g20mr4043801pgk.242.1554092767129; Sun, 31 Mar 2019 21:26:07 -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.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:06 -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 05/11] PCI: dwc: imx6: Share PHY debug register definitions Date: Sun, 31 Mar 2019 21:25:41 -0700 Message-Id: <20190401042547.14067-6-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 Both pcie-designware.c and pci-imx6.c contain custom definitions for PHY debug registers R0/R1 and on top of that there's already a definition for R0 in pcie-designware.h. Move all of the definitions to pcie-designware.h. 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 Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 6 ++---- drivers/pci/controller/dwc/pcie-designware.c | 12 +++--------- drivers/pci/controller/dwc/pcie-designware.h | 3 +++ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 92c40c250a34..bb95a3273ca2 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -103,8 +103,6 @@ struct imx6_pcie { /* PCIe Port Logic registers (memory-mapped) */ #define PL_OFFSET 0x700 -#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) -#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) #define PCIE_PHY_CTRL_DATA_LOC 0 @@ -839,8 +837,8 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) err_reset_phy: dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n", - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0), - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1)); + dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), + dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); imx6_pcie_reset_phy(imx6_pcie); return ret; } diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 31f6331ca46f..086e87a40316 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -14,12 +14,6 @@ #include "pcie-designware.h" -/* PCIe Port Logic registers */ -#define PLR_OFFSET 0x700 -#define PCIE_PHY_DEBUG_R1 (PLR_OFFSET + 0x2c) -#define PCIE_PHY_DEBUG_R1_LINK_UP (0x1 << 4) -#define PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING (0x1 << 29) - int dw_pcie_read(void __iomem *addr, int size, u32 *val) { if (!IS_ALIGNED((uintptr_t)addr, size)) { @@ -334,9 +328,9 @@ int dw_pcie_link_up(struct dw_pcie *pci) if (pci->ops->link_up) return pci->ops->link_up(pci); - val = readl(pci->dbi_base + PCIE_PHY_DEBUG_R1); - return ((val & PCIE_PHY_DEBUG_R1_LINK_UP) && - (!(val & PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING))); + val = readl(pci->dbi_base + PCIE_PORT_DEBUG1); + return ((val & PCIE_PORT_DEBUG1_LINK_UP) && + (!(val & PCIE_PORT_DEBUG1_LINK_IN_TRAINING))); } void dw_pcie_setup(struct dw_pcie *pci) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 377f4c0b52da..662bb9082c76 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -41,6 +41,9 @@ #define PCIE_PORT_DEBUG0 0x728 #define PORT_LOGIC_LTSSM_STATE_MASK 0x1f #define PORT_LOGIC_LTSSM_STATE_L0 0x11 +#define PCIE_PORT_DEBUG1 0x72C +#define PCIE_PORT_DEBUG1_LINK_UP (0x1 << 4) +#define PCIE_PORT_DEBUG1_LINK_IN_TRAINING (0x1 << 29) #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C #define PORT_LOGIC_SPEED_CHANGE BIT(17) From patchwork Mon Apr 1 04:25:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879079 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 D99B81390 for ; Mon, 1 Apr 2019 04:26:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C314C287B6 for ; Mon, 1 Apr 2019 04:26:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B76232881E; Mon, 1 Apr 2019 04:26:48 +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 5B761287B6 for ; Mon, 1 Apr 2019 04:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731623AbfDAE0l (ORCPT ); Mon, 1 Apr 2019 00:26:41 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:40449 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731160AbfDAE0J (ORCPT ); Mon, 1 Apr 2019 00:26:09 -0400 Received: by mail-pf1-f193.google.com with SMTP id c207so3879463pfc.7; Sun, 31 Mar 2019 21:26:09 -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=CGjdSjCoRVjM4VFnkLgtsjJRQadXXrAea1wagTahPCc=; b=UqcaChFBSFJ0SPaeuxtJBB1cSPnCZ2sEe3S1PPXX5rBeNvR8PwTB1ZsKtyObu88+QO vvsRpyRFEB55r9hgoiffK/cF1vhWwSUYQ333HgUFhpNf1/qkdNoJx71EUQsRASAFjX4m zjuuOy81iBVV5jPfQ5rFqaqMdjE+LvK9357jyb0I5ARhUhveiGfQjcEfzDLedUzhpjlj p3To993VV/FtD5C+k9ig3o1UNZzHHMakfLpgyeDuhpmYDLfC37kCJEznCPFOPjeNUGpT CejT0ehhqF3DIt3teTeBM7Kvg102eSmqMMAlhGzFNM7umWpm7t9UypSzg9JO9RlFUJCj kdog== 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=CGjdSjCoRVjM4VFnkLgtsjJRQadXXrAea1wagTahPCc=; b=StoZ6WClIXMdvf6Rxmw01MpyUrRYhB/GqNmwF5AqgcLwNLSy7w0xE8QX0WpkFBF7Yc 5GZNEld/EE4uiK5BHEE1BZhXJZBFt+H2oKLgq9lf95s78r/9s2qMjcx5kiqP4IdcGuEM rXGgxtjfMko2kYI6giT2EYkJzFzxrzpguFM6xQLUSb9i1c6kO9yqsyOTXoBhiHE4hn38 GwtYbya8s0yYWpKDBZ6pAHiz8w5dRiwjL6U8rCfIsEAspNlPrZISqjcNQjRf6iUiTfBs F6ciMlAYEfsJwMY/x2OtMZBlKttJYRlDbFlbRFjWiK12kSo4RpWEkSPcKqj8D+/j6gMb j87g== X-Gm-Message-State: APjAAAWjbDjX+d7TAzmlCq4wrqjFYPE1ByaP91xK+ezDt6bDfDpY5O1f /iuRGKqJ9RMDRGVzv3rPy+lklC4Y X-Google-Smtp-Source: APXvYqzJ1deNkqroSYDhGhDcfZIBagXvLbOQeCE2B1UedaPnBWHx5yIpvdvCf3VWGPMNBiv/Qf9tkQ== X-Received: by 2002:a65:6150:: with SMTP id o16mr28828934pgv.285.1554092768571; Sun, 31 Mar 2019 21:26:08 -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.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:07 -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 06/11] PCI: imx6: Make use of BIT() in constant definitions Date: Sun, 31 Mar 2019 21:25:42 -0700 Message-Id: <20190401042547.14067-7-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 Avoid using explicit left shifts and convert various definitions to use BIT() instead. 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 Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index bb95a3273ca2..b1f30b94fb30 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -118,14 +118,14 @@ struct imx6_pcie { /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 -#define PCIE_PHY_ATEOVRD_EN (0x1 << 2) +#define PCIE_PHY_ATEOVRD_EN BIT(2) #define PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT 0 #define PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK 0x1 #define PCIE_PHY_MPLL_OVRD_IN_LO 0x11 #define PCIE_PHY_MPLL_MULTIPLIER_SHIFT 2 #define PCIE_PHY_MPLL_MULTIPLIER_MASK 0x7f -#define PCIE_PHY_MPLL_MULTIPLIER_OVRD (0x1 << 9) +#define PCIE_PHY_MPLL_MULTIPLIER_OVRD BIT(9) #define PCIE_PHY_RX_ASIC_OUT 0x100D #define PCIE_PHY_RX_ASIC_OUT_VALID (1 << 0) @@ -148,8 +148,8 @@ struct imx6_pcie { #define PCIE_PHY_CMN_REG26_ATT_MODE 0xBC #define PHY_RX_OVRD_IN_LO 0x1005 -#define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5) -#define PHY_RX_OVRD_IN_LO_RX_PLL_EN (1 << 3) +#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) { From patchwork Mon Apr 1 04:25:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879073 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 56376139A 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 41ED4287B6 for ; Mon, 1 Apr 2019 04:26:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 365BE2881E; 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 BB075287EA for ; Mon, 1 Apr 2019 04:26:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731601AbfDAE0M (ORCPT ); Mon, 1 Apr 2019 00:26:12 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39612 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731447AbfDAE0L (ORCPT ); Mon, 1 Apr 2019 00:26:11 -0400 Received: by mail-pl1-f196.google.com with SMTP id b65so3816370plb.6; Sun, 31 Mar 2019 21:26:10 -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=DPEGr1stj8HHuq07bDPJ9C3bFxP/x6zeZ48HncgfwJA=; b=PcEAFYHx+3G1YrL7bvuO+t1T6tpy/mBZNDaUSVs/nD7gI6ZpouToBFhappYNYhEqtP 9HXsBZFxbhtJ0IRtR6eFRnyZn6ZArKp9aWcZvwsZae8ES8MSlEXrafaXVWEmVomrCQEl NoacawgXL3Ee0KKS4DogD0im7QOtf4y6O0yQKsExSYwSqaL4dKSK6MyW56xtehY6nsYr ehyaQFbxv/z2/rZfJMYHaHLESlCR2VMa/GAuP10CQ8GkxT+4MBznKkh5x+TRWSHaSBNr gSEPN9JsZBZ5q1aQY0CP9Kt48E0Sk6Psvo9URhnqJ62i/Ddb412QfDRSjDtww7PqRBVt 0IpA== 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=DPEGr1stj8HHuq07bDPJ9C3bFxP/x6zeZ48HncgfwJA=; b=UIcVWgd85Oq1NvsEhPvJOgzMujX1hf7a9LLObm4NU5PfNfLu0B1hnuEqBH9z8+rORL eLjUx7jFl/CQG75QalNdT/g4CFHTmppbRd7xZ2aNYg1nmeEHxWgxAPUi70LAaSPdN2pS l96SD2hxzeh8DkpMZd7fXGJJWlRzt9Xjpu7/FQHsLNu6cAoBU+4wcpUgIJ96KGFbJr1/ GzKW4O+lHM/A+U3JMRb83KQuE+OzxHJV4P+D/vECbdpmoN+hlDl6x4f65pSv5OBQQ7/X YXmzon/GMcPQwpXFjHtbOaUsf9k2aqtJepXYZaqZ6vfgPq4OzMvCao5QPcPOGrQN0t1M 81PQ== X-Gm-Message-State: APjAAAUDmPorkiznQT71LTZiOHMufcL4mwiMrLuKMGHexwEbeo6aomJr wjScmZhAtXWYge6PC4uAgOGIVW4O X-Google-Smtp-Source: APXvYqwNb2baCl18Luhf89oTpsGwP19JyOrT9BqBhk6RVm8934y7nJOc6596+P/JnfQz3mwJqxpKWA== X-Received: by 2002:a17:902:8202:: with SMTP id x2mr55060083pln.318.1554092770088; Sun, 31 Mar 2019 21:26:10 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:09 -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 07/11] PCI: imx6: Simplify bit operations in PHY functions Date: Sun, 31 Mar 2019 21:25:43 -0700 Message-Id: <20190401042547.14067-8-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 the code by incorporating left shifts into constant defnitions as well as using FIELD_PREP/GENMASK. 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 Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index b1f30b94fb30..a49e5e491e12 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -105,11 +105,11 @@ struct imx6_pcie { #define PL_OFFSET 0x700 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) -#define PCIE_PHY_CTRL_DATA_LOC 0 -#define PCIE_PHY_CTRL_CAP_ADR_LOC 16 -#define PCIE_PHY_CTRL_CAP_DAT_LOC 17 -#define PCIE_PHY_CTRL_WR_LOC 18 -#define PCIE_PHY_CTRL_RD_LOC 19 +#define PCIE_PHY_CTRL_DATA(x) FIELD_PREP(GENMASK(15, 0), (x)) +#define PCIE_PHY_CTRL_CAP_ADR BIT(16) +#define PCIE_PHY_CTRL_CAP_DAT BIT(17) +#define PCIE_PHY_CTRL_WR BIT(18) +#define PCIE_PHY_CTRL_RD BIT(19) #define PCIE_PHY_STAT (PL_OFFSET + 0x110) #define PCIE_PHY_STAT_ACK_LOC 16 @@ -178,17 +178,17 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) u32 val; int ret; - val = addr << PCIE_PHY_CTRL_DATA_LOC; + val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - val |= (0x1 << PCIE_PHY_CTRL_CAP_ADR_LOC); + val |= PCIE_PHY_CTRL_CAP_ADR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); ret = pcie_phy_poll_ack(imx6_pcie, 1); if (ret) return ret; - val = addr << PCIE_PHY_CTRL_DATA_LOC; + val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); return pcie_phy_poll_ack(imx6_pcie, 0); @@ -206,7 +206,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) return ret; /* assert Read signal */ - phy_ctl = 0x1 << PCIE_PHY_CTRL_RD_LOC; + phy_ctl = PCIE_PHY_CTRL_RD; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); ret = pcie_phy_poll_ack(imx6_pcie, 1); @@ -234,11 +234,11 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) if (ret) return ret; - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* capture data */ - var |= (0x1 << PCIE_PHY_CTRL_CAP_DAT_LOC); + var |= PCIE_PHY_CTRL_CAP_DAT; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); ret = pcie_phy_poll_ack(imx6_pcie, 1); @@ -246,7 +246,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* deassert cap data */ - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ @@ -255,7 +255,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* assert wr signal */ - var = 0x1 << PCIE_PHY_CTRL_WR_LOC; + var = PCIE_PHY_CTRL_WR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack */ @@ -264,7 +264,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* deassert wr signal */ - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ 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) From patchwork Mon Apr 1 04:25:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879069 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 C14871800 for ; Mon, 1 Apr 2019 04:26:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC5EF287B6 for ; Mon, 1 Apr 2019 04:26:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E4182881E; Mon, 1 Apr 2019 04:26:33 +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 38A6A287B6 for ; Mon, 1 Apr 2019 04:26:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731724AbfDAE0P (ORCPT ); Mon, 1 Apr 2019 00:26:15 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34792 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731700AbfDAE0O (ORCPT ); Mon, 1 Apr 2019 00:26:14 -0400 Received: by mail-pg1-f194.google.com with SMTP id v12so4084316pgq.1; Sun, 31 Mar 2019 21:26:13 -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=zo7YY9RlZFhjrvNNH/TAsWEOA9xZ2TYMIrq7kVWYlhI=; b=OffdOUSanEiUxIJd7PSU2U6oXzGltjOS8gf7Dtzb6CuutkuQRCwje9coS7rXJcFSyn QObonRcDyhfvI3OxeMm1/kcWC7/xfd8Y4gWoUqfR6oX/WZs4KuJuD214QfvDpitlrdM5 acPi92z28qSAxUmrxnVXLAUGbXYaqRmF42UOWalxNaxr5ytElLkaFGBD4xGRKm/EXMEX 1Jwwkl9b/IjtO6pP/gbhhaoGwci9XCUxjiaWpVsSAFbymhYQHBcvymmePAIvR8S2OawN 2cj8vEqzf99MK7O3IpvJW/LVRNHayf8gc7zXZpS6COqJMR/o6yRgy19kFCxqva0cm1HY /ncg== 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=zo7YY9RlZFhjrvNNH/TAsWEOA9xZ2TYMIrq7kVWYlhI=; b=cmF8DOpb39r1I2+wEp+Cn2Vv2fZvLT63pJ10FcYmFflexMVJY92MkMlq1xqIz76hBR uXpJ4FGjdTdQAozYRbnaMFam1rSpdrX1RFXcBOMyzI2j6NcCSisVnOVETphcnY0Q5tvg c25LfqZ+PjZc9yIeFEV4vkfbJufz5y37a5j6l/ddVumgQGmxAxkGEuZBR9vt3Y8yXtdE iFpOBbrDWqA6hJouoZAJ4E62Y5AVOxrLpJh+DxmoF2GLTX45eJXNS4sSvyfe2/6B4qRc jZhf2BU6A4WSh21oUwelLeuqbR+f7y7ZWkBurYs3IgvgLf7suCh4GTRbmQC/0gzPzKIU SXBg== X-Gm-Message-State: APjAAAU/46196+6pj4WihWPxCi/3x0pvQbP5s85HRsfyaMwnRDJZF2vW Me7WjiCNoIZAySkW4DQa6T9b9Ooi X-Google-Smtp-Source: APXvYqwMa6Q4rl8JVXlTJS0o6bbwUSeH9MZAjfNv6K8hbtJj8Zr9NyuFIgHFImzQhkbieODuBeKwLQ== X-Received: by 2002:a62:ed08:: with SMTP id u8mr60360752pfh.200.1554092773027; Sun, 31 Mar 2019 21:26:13 -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.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:12 -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 09/11] PCI: imx6: Restrict PHY register data to 16-bit Date: Sun, 31 Mar 2019 21:25:45 -0700 Message-Id: <20190401042547.14067-10-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 PHY registers on i.MX6 are 16-bit wide, so we can get rid of explicit masking if we restrict pcie_phy_read/pcie_phy_write to use 'u16' instead of 'int'. 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 Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 7c3ffb751002..9c658ef55aa4 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -195,10 +195,10 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) } /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ -static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) +static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) { struct dw_pcie *pci = imx6_pcie->pci; - u32 val, phy_ctl; + u32 phy_ctl; int ret; ret = pcie_phy_wait_ack(imx6_pcie, addr); @@ -213,8 +213,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) if (ret) return ret; - val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); - *data = val & 0xffff; + *data = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); /* deassert Read signal */ dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00); @@ -222,7 +221,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) return pcie_phy_poll_ack(imx6_pcie, 0); } -static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) +static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) { struct dw_pcie *pci = imx6_pcie->pci; u32 var; @@ -279,7 +278,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) { - u32 tmp; + u16 tmp; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return; @@ -675,7 +674,7 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) { unsigned long phy_rate = clk_get_rate(imx6_pcie->pcie_phy); int mult, div; - u32 val; + u16 val; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return 0; From patchwork Mon Apr 1 04:25:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879067 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 1F2151390 for ; Mon, 1 Apr 2019 04:26:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A737287B6 for ; Mon, 1 Apr 2019 04:26:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1D1C2881E; Mon, 1 Apr 2019 04:26:32 +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 99BC8287EA for ; Mon, 1 Apr 2019 04:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726168AbfDAE0a (ORCPT ); Mon, 1 Apr 2019 00:26:30 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:35315 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731714AbfDAE0P (ORCPT ); Mon, 1 Apr 2019 00:26:15 -0400 Received: by mail-pg1-f196.google.com with SMTP id g8so4078636pgf.2 for ; Sun, 31 Mar 2019 21:26:14 -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=kKSmgFelw3p2OWL+OlwzOpWPsYOlwS6LbJMo8debjJI=; b=nKGvunNgcjxkrbzEsS0HcWRlKMa8rRjj6bwXWIo15bS1CYeXKnW9iico1gkc1fHUXa dAcGOZIfIvIHTc/IGf9B0cvT4kUKmT9geMVanP1UOy6GBdLS0+luqJ510cE0jCo2cqpj W0GQc8tumq/hFeJAk3DV9P/BOEIC4WOe+zvF24N666ruxLKQ7WtKrGHUgmXVvOTLg7H1 SbYI6xmcG2pkPOxcsGzAnvgaHk2V/rv7UrHn+z2B0WiuhK5e8BPDPQelyfwsyarPXKMP JJNvm82Nn32OlotKTKepFWSyLsCbTNCO4d14iLuVj1sjxF6N0NNEFiOIv2W3A1M30EUH t1/g== 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=kKSmgFelw3p2OWL+OlwzOpWPsYOlwS6LbJMo8debjJI=; b=GBzrWsZ0GqC7dn2pXZbRhdqpxrR1OpOp+kDE/q/KMevS+MOB+ePz2Lls6ASF+s49Zd E0kDjgjHd02fPLDgJChMP8G2G+AXp48m/sqbA6HgJzR8b7xIDzfQqlh+p+0BaSdbMCYR 1p7md9guVpW4A2zKcWLchTccFHZ/ZEdDYwpKF6LCAAQUDDfoM/aZkLfnWGWYGqLJ2db4 vwYRMC74/7So7/+JG+eTN7bkH/756nTqx42WwIORDgrRxtm+Kjf47DEaRss0aqkZVG37 hC3Vg6pcIM4uJnKvbYaKNPGQBUrRTHDxiMIFYv9s6s/0ThQHHdPaCU+8gi68f27KIxx3 w8WQ== X-Gm-Message-State: APjAAAXN+3PYt+RSunxDMLavt/hBCzIb+0s/WnGi9SUDjnf9ieS1KfJi j2s7hOsEP18By1LXNvMI6oxlptPO X-Google-Smtp-Source: APXvYqwmYXY/pA9858rM19p3WyyMpHO9Jd4Br1UZc1rPhzb+U7OOWitWPbUaNQavUGs18GRyekClpQ== X-Received: by 2002:aa7:91c8:: with SMTP id z8mr49683054pfa.110.1554092773792; Sun, 31 Mar 2019 21:26:13 -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.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:13 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov Subject: [PATCH v3 10/11] PCI: imx6: Use flags to indicate support for suspend Date: Sun, 31 Mar 2019 21:25:46 -0700 Message-Id: <20190401042547.14067-11-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 Now that driver data has flags variable that can be used to indicate quirks/features supported we can switch the code to use it instead of having a special function that does so based on variant alone. No functional change intended. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 9c658ef55aa4..c9431a8a7ca1 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -52,6 +52,7 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) +#define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; @@ -973,17 +974,11 @@ static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) } } -static inline bool imx6_pcie_supports_suspend(struct imx6_pcie *imx6_pcie) -{ - return (imx6_pcie->drvdata->variant == IMX7D || - imx6_pcie->drvdata->variant == IMX6SX); -} - static int imx6_pcie_suspend_noirq(struct device *dev) { struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - if (!imx6_pcie_supports_suspend(imx6_pcie)) + if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; imx6_pcie_pm_turnoff(imx6_pcie); @@ -999,7 +994,7 @@ static int imx6_pcie_resume_noirq(struct device *dev) struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); struct pcie_port *pp = &imx6_pcie->pci->pp; - if (!imx6_pcie_supports_suspend(imx6_pcie)) + if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; imx6_pcie_assert_core_reset(imx6_pcie); @@ -1229,7 +1224,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { [IMX6SX] = { .variant = IMX6SX, .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, + IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | + IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, }, [IMX6QP] = { .variant = IMX6QP, @@ -1238,6 +1234,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX7D] = { .variant = IMX7D, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, }, [IMX8MQ] = { .variant = IMX8MQ, From patchwork Mon Apr 1 04:25:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10879065 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 97FD2139A for ; Mon, 1 Apr 2019 04:26:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 838C4287B6 for ; Mon, 1 Apr 2019 04:26:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77DB42881E; Mon, 1 Apr 2019 04:26:32 +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 31F7E287B6 for ; Mon, 1 Apr 2019 04:26:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731757AbfDAE0P (ORCPT ); Mon, 1 Apr 2019 00:26:15 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37060 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731733AbfDAE0P (ORCPT ); Mon, 1 Apr 2019 00:26:15 -0400 Received: by mail-pf1-f193.google.com with SMTP id 8so3885773pfr.4 for ; Sun, 31 Mar 2019 21:26:15 -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=mazOhM/Ixdx4XrIQEzfQUJQ6M0vk6dsGZPlsezBBEYs=; b=J++HdVaFD5MxBTo9R9V3p0ngV9ndVJjPlu1SM+uHPfvjz1Q6vzQtOFVU2+iHI54wvL 9TlZ1BnXCyRE7Mr0mA1J9lqEbxzFaCUJVJEHJIMiVivjiV+vutyaDXuiW2TtQpWVXr/g 2S69fh2Z9qNzjL42qC0xSz6g+PZXqq8peUsjxZn1P8miABNHoHJbYc6/agl/8b3xbsPf EWBydgsNvR51kZS2Ec+bAPu78Lg8w6gATKHnGuONftzKqW3R1vPpJv9pvkmBOD/Wk+i8 Xpy5PjSqXnadiHptiZ9poFoWId9jdLF3TJC4CkEvV3M0m9o0DBTABsdk8HtcHlUqigV+ rqmA== 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=mazOhM/Ixdx4XrIQEzfQUJQ6M0vk6dsGZPlsezBBEYs=; b=QO0gyBTrlTj+czVqtGD+CeLLKNIHSDMxtnjV3PlvFRt6Eo0Wg98mpDFGfpw90HvD9m kz4Gc34XhmvNdBAownwfQRQY3hEdu9jeGZ9pujuk2iWcNAPU4ZODCDMQHiMtBs3WIO18 8LLgtKicSvmNAj2mt7BXh/J8eLC8jbq52JwmY1Ioa+GJrRcJpEbvbLp5Xq7kbJdGlYsj +OiIfwHTZm7J1pzpO7Oz+mWzS9VGrevurYMhuyBwfgIn0AAI+Zbc6YoxIlpEY/dJxyXl j9q2lBkKZZ4d9c0Vp25w5P7pWIW1f7rh7Md6ZFyMsj9KW58k6cO4KXsR1cpptPmMurrl ZQPw== X-Gm-Message-State: APjAAAUqrRLZY90OqKG3vUiqGioiHBROstoy5iL66+wFw8szymKhxNYr /8vCXyFMagrvDbqjfZr9tEEAKfMW X-Google-Smtp-Source: APXvYqxuZh0KscYmqFTKXUnjJ0fdaQwV0wM//Zt1xhJnz+EgMAElu50FQ/fmsfVZ/n9DS+dINwAR/Q== X-Received: by 2002:a63:e051:: with SMTP id n17mr58367463pgj.19.1554092774562; Sun, 31 Mar 2019 21:26:14 -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.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 31 Mar 2019 21:26:13 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov Subject: [PATCH v3 11/11] PCI: imx6: Replace calls to udelay() with usleep_range() Date: Sun, 31 Mar 2019 21:25:47 -0700 Message-Id: <20190401042547.14067-12-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 In both cases udelay() is called in non-atomic context, so there's really no need to use it there. Change the code to use usleep_range() instead. Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pci-imx6.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index c9431a8a7ca1..3f13022991ec 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -167,7 +167,7 @@ static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) if (val == exp_val) return 0; - udelay(1); + usleep_range(10, 100); } while (wait_counter < max_iterations); return -ETIMEDOUT; @@ -449,7 +449,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) * reset time is too short, cannot meet the requirement. * add one ~10us delay here. */ - udelay(10); + usleep_range(10, 100); regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break;