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: 10879061 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 69A451390 for ; Mon, 1 Apr 2019 04:26:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FA4A287B6 for ; Mon, 1 Apr 2019 04:26:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43E462881E; Mon, 1 Apr 2019 04:26:23 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 36AFB287B6 for ; Mon, 1 Apr 2019 04:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YTOL43SDRWicG5YaV50sWsxlbBJ+9UxWlMDdE2KCPCg=; b=mSLyOeFPS/vs/E qwJVXjH717HyKdDeCO68ddKxXHjml0OpP81nov2yB9D2mgImj1O43fesXxTRC8k3YX5B3GZLoTfvs hFn6ZqZiIqZUztNHd66ogJe2kuUF6jWcha2k2XNaY8GC/Js8ORzjyGg3ONhMU0+BeaWvYqq4A1HAM /3QF0IOt+vbqwfD1Now3PSqrI3vtMjQ0XKWbT9L/xMrEsave1RKmNQq3T6Ha1mczCWOcOxJLYe4yo G2Wn5DuHPfSJSnEG70UIAarWi2hyt5hFpw61fMzPRYxPSr4739EILyeot5INbVV8C4qtCB/ynYzqI T/RxdGyUfWi7kt5BwrHA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWa-0003iq-RK; Mon, 01 Apr 2019 04:26:20 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWH-0003Nr-7p for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:02 +0000 Received: by mail-pl1-x643.google.com with SMTP id m10so3810691plt.10 for ; 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=sw2Rnr9EiBLfLZnKQZlsOn1AGZaEk25UpUYpaSM1KkGe734R2QosTa6vyhg1NqeRSV j/s5BTNSD1J9IAuDRy0sMcQEqvXDcxxitfV+00Hoi0VU6jz1L6VGiiH2rBEcIY2nyqhK vGfUsETuevsoDFvQJRCtgfRSN88a9QT6s+UzKkPDEqgN2x+4pmyfeQmktGtTuBRxZqnz tcm6TJ/KoMiZtcwStiLk4+I4YrV+78b4O7a/EAsCoRtjkZN16rZJTaS/DHBxJplba5Ts uJ3uepogPEGf4cMbeZvNTfKQYm58D2CLqBUWZtRN72Bwj3dP2fCKJt8Y4QsHraqScAcy ZkGg== X-Gm-Message-State: APjAAAUv72d6e2vZmK2H+kzsmvhfzSgryMJT/5wbtc3oS5+4ftsWom44 dKzlPTL09vRmz1xeS57fhz0= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212601_275039_6E04AA30 X-CRM114-Status: GOOD ( 12.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10879063 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 2C167139A for ; Mon, 1 Apr 2019 04:26:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 119D1287B6 for ; Mon, 1 Apr 2019 04:26:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 059962881E; Mon, 1 Apr 2019 04:26:30 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA392287B6 for ; Mon, 1 Apr 2019 04:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8zozwoBxG2uxGFh7GiJI05hbB5neePGiLV4xjsepH4s=; b=mAorbW3VPy8D/5 wpuOsackIB1FPWp4XqK/aD1y+3rpzu3MbZdwbNqep+gC1rUUajtsSGijGnwtrBoYp1WPI6AgbUqn+ 5XJs3/JjMa+uhBlBTrAySjRru9FAGsUIc9lRXNFpfzTeYR8lTEjBChBtW6mrUjGJzek04P9/WiI1G gJwkjrkMGXgPgvErJnHOL3oKtoh5bf5dphncIPtqPXhACZQd0goGil+8WGgg+PeJ9UVWzOKk7xTzF 722ZjSJMzz/hbHekfT2nLszkM/O0Vh5rMCw+NDIrjz0RB5nV18Pv2ZO3pkX8ZTBz7uMPe+nFc0iK2 SF1/YuIinA+3lnpem6Lw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWh-0003sw-SN; Mon, 01 Apr 2019 04:26:27 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWJ-0003OG-3h for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:05 +0000 Received: by mail-pl1-x644.google.com with SMTP id y6so3807179pll.13 for ; 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=olcufEc/o3G5zoIrSD5i8gJXeh0Kv5k7US7gi4Edgtw2wXI+2NqPGH6fHi3hGt/O2A MFkLLJERS3cLesxGmut1J4t50O8u3mGuodq7Dpy1juKyC1IkLLzYJPdhyodRHRlBduk9 o85k1zP3wH71p/u+3o7FyDeM6fbo+Rb8nIAIsdzG1C+LiAkYXon9fSn5G2bfgFFtsduV IWox+tfDFRsa6X1w682l4+ZuB32dfHk8CjPaXyEszSSATg23Gpf7nkwgDAi5tsJ3YikE rpqHroxoILYdxNHn9Dm0d64bl3gHQJfOx0ewbTfyJRhcP2TnEajHIt81C62EscR0RZ0z +vNg== X-Gm-Message-State: APjAAAX5wyD1+MG/aS3x+65yWhMg1V+zImC0+XEr0Abfcsct1EjSQySs CrnHI8wOBvj55hd5VffI7bI= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212603_281297_3FD52002 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10879077 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 44AB6139A 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 2AB91287B6 for ; Mon, 1 Apr 2019 04:26:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EDF3287EA; Mon, 1 Apr 2019 04:26:43 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C753B2881E for ; Mon, 1 Apr 2019 04:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PFImwyM0ctL7UPMPIsBWUJ5ch/l4bmgtN53jZtwTVLw=; b=cJXKNQYxt9sg+e WubKvF/QG6Z2WmgVPquMpxAUHsv11m4e8CvMaJg76dSlm580i6CRJWEoap+RVBpQZbJWgnGO3BXoC yI4wkFaOXukVE4wiAdnYPnHORFKZl8Ls7rd59WUb3u2FPUgIQ47dqbqAcXYwx5b5Zbp+/0rJfvu3E GlEZOkWtMoWqZbI1QEjH1DFGhZ7I7erlUxxeoWIXzTf7LaYu/d5EeMpeKZ8MXOfYPl/z0DAE+xkQC +iFuk0qfS0LgkCL6wPkN/9yfvc7jLaWlsH803co7yK7b00/FHPxBWHhlQaf+A0w8s5RfIpdAJtRrY i+cxfBZ2uOeUwBsbkKWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWu-00049G-BN; Mon, 01 Apr 2019 04:26:40 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWL-0003QS-VX for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:09 +0000 Received: by mail-pl1-x641.google.com with SMTP id ck15so2615333plb.3 for ; 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=dN3845OA4572CeZVHMiVzsWndXY830Jj7FZYdiy/A5QRKlVRAZU01PnzSI9IzpXq+y oAjwamEm6HNb/fv0zkaaKenBj3X9wUiYrpLtzOhPr2MaEjBlxwonyJUUWjlNo6pQ1Znt OUFOvjVNGXaqKRDM0vo604eZGiYQ58HrxNWaNGLDO1cUjE4mfNDYaY3GCMDVSXsV6J6g /ZYYhiSNfHEWdYnbflLTt96vb1UraIlkcSfnF1ettTtj2RlKzMhu6lkuacuxcnUxEywD 4BsH0HD1mLovKxwBbscF7pV8GI0glFchK77O7uaAmpvpnxLwoph+6e0GKbkUdZAzKktd ZFGQ== X-Gm-Message-State: APjAAAX0yzdH6XbD68WwXcv7UU4n7tboGo2HJLl1xzPPFW4+h2ps61ME BlCD2woNtrBVjiAhju9LkDE= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212606_501515_33EA6C58 X-CRM114-Status: GOOD ( 13.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10879085 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 2EEA4139A for ; Mon, 1 Apr 2019 04:26:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1545C287B6 for ; Mon, 1 Apr 2019 04:26:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0919E2881E; Mon, 1 Apr 2019 04:26:57 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A4ABD287B6 for ; Mon, 1 Apr 2019 04:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4d/gNSADLwDrkqEv8e22RSJt9USOy4ATd9nXHG+zhCc=; b=TckjwmhMG0fI6g CtkCFpDOSMMP9pnQV1HnR5My8h8wCgnqEx4wXSiRQjOsby1ggyGsb7nMcIXBJuGhJuUsTNE4gTX6x n6nEZYSziaamMHfvx+jFsnZcjM9eT4XYmwc0ngw0qDz5//G2ZgfkBpf0Qv6gbnjc4+z/EyqzEnx5u LrojBfXjnxSveBPUZOr5HQ1dmGYLb51J+KoCWLh1ZWei1JdeRv6UEnco0LyHygFzrncmC3ploXMwj zpOtH9Diyz0S7rQ6V82DaQ34Vfsdw82Xq4eXB+4489Ut85gIDKC9yNgCKSrBEeYi/MpmB5Ks71jdm UHzOuMbZlRpnGgIMzFJQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoX3-0004PQ-VP; Mon, 01 Apr 2019 04:26:50 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWM-0003SK-E1 for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:09 +0000 Received: by mail-pg1-x541.google.com with SMTP id k3so4068549pga.6 for ; 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=ixEIJzXgt3hR0pFgfql+/vv1jAL3nXqZ6dg98iYsFQO81rXQxm6zil4qitpsLif+N+ sn0Ht7Kp5Oj5IVVX9hs62Y660EwpdIA8fYRlKVuMP69VhEMlYSIoBoGrag5ijbidPplm zGmcQ7bNJZ92GuE2y0SaEMTuncj2I48kia55bpj3E0rG/EIbEjNUEXEyd7KDoVUqMX3X cagZlPGO/2l6XfwoLTmQFia9FbLanG7lNp6KskeUki7LYLOq3KBEdlzhWt0b2BeWSmYP 9nYv+enXj/dhd+g/5TG6y9ByW3+qgIf6o/i2itPltXMyk/0RVfPEIBOY/zBat5cQxCNj kViA== X-Gm-Message-State: APjAAAXim2PdWOWT1ntt2hX+vsQdHOwozsNSozfCXxBX2VKRCViyvxn7 lkqnSOepkenzGtEOKzK6hrU+hrM6 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212606_945455_E39996CA X-CRM114-Status: GOOD ( 10.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10879087 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 7F119139A for ; Mon, 1 Apr 2019 04:27:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6319C287B6 for ; Mon, 1 Apr 2019 04:27:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55CB02881E; Mon, 1 Apr 2019 04:27:18 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9DD8287B6 for ; Mon, 1 Apr 2019 04:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=48itXLSdNUyZW0i/wspipfas1Jw6aJ72lmufyktGUfI=; b=INsOBWF9JOr2zZ IJESjWGwQeOyuFZ/sYrdbXF3Q/Tj3HTeAwKql7x2Ro62ric1PsIqYdItnCVsrq0iCSqB9hxW4DLtc CP5WKzPsvG/lisMY96igeNjmonyeyjfhMWobIzJSI6KEym6z+6mZGmkeqkjCZm8hdi3bh6NaMzF+f vnA6a7vW03JnDEMqgADS/6v4VlBFHDOnUwC9xScZifUnCL3JcQPIZvXsgwp5ivNNdAgfcE1PlLjoY FDDaParOa6U3broLzzij1W1QjQzabmgvJ3kstoKisei9g04smCexP/NtJ+PmrVHUNpw5HRhGFxR01 qQwD3ipc1KfanAuSR6sg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoXP-0004q9-IF; Mon, 01 Apr 2019 04:27:11 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWN-0003Up-Or for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:13 +0000 Received: by mail-pg1-x544.google.com with SMTP id q206so4074037pgq.4 for ; 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=ulfJXm3hKrp6buosNnERt7ToCfKGEzrLW/kZzUFIq1tcWtIIPij0A2/Ti07AMovSWW 71vfAKodsIdlaL1gGmWPnaRCJJsIlk+KD+T4f3SB5V39eX9h6Nn8PiwnYex9rdJtzSsE /X3zk1VOsqbjKb9Cn5IJ+pSgbznfVeDpLw9fwpoLD9lpuv/334aGjRww8SpOnbuMsNOv gnoAAkpFF4eDMx5TiTMZfG1cCQ2LvA0vWpfCjX3wbuNvUh+5TY6Gqb0mPnF0N8XivU9+ GjTHhKubcbFDLS7d5Vhbz08qPZrTnqnif7igOeErzCPmGtYuN/1nMdT0o/qao2/kB/ZJ mpHQ== X-Gm-Message-State: APjAAAXNZChWwrJrDeceSisUeDQjdP3k7VJGM9L/c5R2CnFuu215tt8K DcKlxalDkjhSuQTL+sjXRbk= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212608_249037_45A019D1 X-CRM114-Status: GOOD ( 12.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10879095 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 33BF417E1 for ; Mon, 1 Apr 2019 04:37:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FEFD287E0 for ; Mon, 1 Apr 2019 04:37:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0345B287EA; Mon, 1 Apr 2019 04:37:17 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9D829287E0 for ; Mon, 1 Apr 2019 04:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MvaoYqeCH9VFLcFeVNdxLzLKlM3ttRP1qDiDqzswASE=; b=d6K1bq6Qi1LksP SrXGYcjKRndtu9/uj3UZyyV4JR4ez5c7nY6rAOm5MFsyHRPLRf59iYh4ZpGaTxCZ3WG3zAdE5YM1J HVq5vd23PYHp3PDaoEwx2Va9IO5qkaoafDP5zK/p8wrh3ghwpIu0ya1xqXnWS+SryhFMTblM1zGoo uZjEfEjV8sR3dCGGzUDMUfafBV6PNQqHqzNvdLc5+43N6wddzMs9AQ3oxKFz7EE8bWXU5Fqw9B1Vc f/odYb2PWFjRaBb8unBDdOPf3mxmRAaqDtPcwTrzo5YcAbPjX9pjjhVgHpqRoL5dcuMWJRMqYsl1I Iqu2lNA0wRszqDYPZZMw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoh7-0000Nn-79; Mon, 01 Apr 2019 04:37:13 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWP-0003XG-66 for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:13 +0000 Received: by mail-pf1-x442.google.com with SMTP id i17so3881113pfo.6 for ; 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=FRbDMNXXvXzaohm8bsJ4A7zRua3OEWIUvn3/irRvXAEIdTj4V+k9+ccNzzNBEqwqg/ 4w2lOOlR7LmH8qeq71GN0NHfUIvFa9E6yAQNgbPHcp535DNy1c+5qkXC/zmtP5xAGarn 4zkvDcsrpabZpAug+pAadPgeQXN3UyAmN5bOKYuAWs4hdu+tozyMhr9fRTF+mtq+aD4Q FMo03crfpGp+X+H2mqcN+DnX3PLSgMVNGwJKpt8uucLiJ6uJaiLMifqf5LeLzF4/L6pP awgZia9+n0gEFVjhtVKsYA9VJNVf9QXhNTuua7q4H2oUQFcoXjcQmEcX3bvNsvOstbVz 6Ngg== X-Gm-Message-State: APjAAAWydiDwjvwqUka7I22SK1bE5SI6uRbI6zDKMTBWk4qypmR9vJNL 0gydc0TPbrsfKyaFR/OuDQ0= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212609_549507_EF5CCDBB X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10879091 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 12F64139A for ; Mon, 1 Apr 2019 04:28:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4E7F287EA for ; Mon, 1 Apr 2019 04:28:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D661428823; Mon, 1 Apr 2019 04:28:07 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 778CC287EA for ; Mon, 1 Apr 2019 04:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wC6OQHnbxSZ2OMNtzF8JstRLNAdfjFEO7VA7C7kA1kQ=; b=lIn1I4IFgnsn7G Cn1UE3y/MDSg+gah6Aw4mbijlxFlXMPpKw1qKP2Ylnef8uUteqIX3ZfxxapZI79Qagzqus9+zvkPs L4BBccpPHP/GVFB/Wt4cQqggiqFDf+rlb3UIO8uiE4VoBEXLnrgX467ydlKO1EejMDsbMdZQK9h3z p8YDSmJcQ6cSr5glmX0mKf5SDegZJZuElKsRv4QLUWptJ1kRMq0MsLmbFbGhPxFFLbqm+4bCI5urS Vmti2B/oXLE+WSCnxnlhJO1n2DqHXYAuqeHFHRy1hYMRNmLrUbn3LEk7Ng17TlCdWObJRaXRp9jFV u53zdJRdBNIhJWRJ0AEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoYH-0005Ju-2m; Mon, 01 Apr 2019 04:28:05 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWQ-0003Zy-NF for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:16 +0000 Received: by mail-pl1-x641.google.com with SMTP id d1so2124050plj.8 for ; 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=jMUqpwBBBtjtdUZvNPJAzB4Kcr8zhh8Kb1xg4iXmWl0nwaBSG/FogEkn11nPa8BmGL Z6xDYfzBvXPQWCvqLik1CZJHADMu92CIpmHOJ+BuU3Xee5YbzuYC+HfA+cV+l8VvtL4W nHSw3b0bUDo73232f0TC1BKeLtYjPxi4lbohV5Uo01v4OCuXu2nnH0uvAyyiYb9jOQN3 P2wGNJSvdTfOzFIq2LOxaSyA0Ik5djbbihjiOsaAf1P0NySVENYVr1OgeMDAoEn71uiY gPoTWUiWxPzr52vCDa9MIoE7mvGCmYuYOXFqjs8lVHDEiRWDE5npN6IOq+V7zG8MXDrR NGSg== X-Gm-Message-State: APjAAAVQRWAHbn4RycTb68c7TqeVrBONHxaawRsFbgvtMd8deSPWTssr ierCfDlSDqkxyFO6Iso7HXI= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212611_087106_8AA83AF9 X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10879089 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 33C071390 for ; Mon, 1 Apr 2019 04:27:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18F6D287B6 for ; Mon, 1 Apr 2019 04:27:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C1B02881E; Mon, 1 Apr 2019 04:27:59 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 85758287B6 for ; Mon, 1 Apr 2019 04:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cGPCpdOKWVxaJsA5m4L/wHOvWBYEDYSvJmg4oJpczK8=; b=DWjmAbXuE7kUvX 47N99pDRhZVYM+VnAUHqZg/Sa+/bANf1BlS5F0hOp63mKAgCUtSX42HUnkEI4NTguy5Z8Tcc8Tzbl qEIhE8nJWLIVYeGs9xZVCCCSXIM2MOajQjr5LJrVCtGcsQ1eaoB4gkKFqnVR+LuYQpjgKytZnDnal feYQhwF7vvuPprxPYyobVzXDeWI6KtwRFwAZGWkAyfYBocQC3WVdJdSAx1Bse2wWkO/uxka2Sa+hj 1XaYblvkOqpc6z4V1ffHuVujD1LTc27vhDNUAta9a6i0DCwkuFftdm6y0CtxKtt2ECEFamvZyvQsj 6jIq4ivrMXYdIIqvbaPA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoY8-0005Au-UD; Mon, 01 Apr 2019 04:27:56 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWS-0003cK-3S for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:16 +0000 Received: by mail-pl1-x641.google.com with SMTP id b3so831896plr.7 for ; 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=FiHtCrknnFABjX/w/BQ/ORDLK86DZHyvNLkjgKv11qf/8UfmWc9RKKNmXE2B5S4Xx/ eS+yY9D8aY2NkosPFpV6JjgwYDgmCROteNc6tlAhvhWT6d/lMAcFIpmHkTV/sBinrLRF SUOWDjVwvmUXjx1/AVwzVSSXdgah6EdI/8M28McMNE7NLas4+jzmO1y4+vzcRCKHQciK SKb+4+6bMgssyIjgC9386jENrXmSusDWE/ZEphpSJn1COVHpuoRq2jQH/CxxlowAafSM Mbw4nkbz3sopCJeRs/lKp343lK3xsHjDyX3VB2u1cK/3UQhjBU4xap1Yr/Vzaki9lTAg O3Pw== X-Gm-Message-State: APjAAAURb3ITcUBJdHuTvB6PEZAGwMOIKuCVBO2r7JQsZHkdSLFH45Av Fs9yROvYmweRsKQyF7B2l7s= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212612_515107_7CFFCE60 X-CRM114-Status: GOOD ( 14.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: 10879093 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 7D266139A for ; Mon, 1 Apr 2019 04:28:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61EC9287B6 for ; Mon, 1 Apr 2019 04:28:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54C782881E; Mon, 1 Apr 2019 04:28:19 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 04006287B6 for ; Mon, 1 Apr 2019 04:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5jiJnPs/qtEFgg4wslmgeDlJ5nlWwKamcnxhOKipeIA=; b=upxDE261Y6iUTs oo3vc0cPE9v8nUBKehsHJUZRddIB56NAzIqSRs1UkK8c3oB1TqSpL2DUyINEYlxmCp4uZztqhBIPY qv56XjBD0GCmquD7WMWvRYa9trlGLmqE1cJDMtPqLLHd/7hy0wNGCMEp4lh45/7DBav0RpFTemy7i FKlndqEcAcOHW9G9jhEG7ViQd4aK35l/jt3C8WCITJyzfl2vjo4xibTn5OODeyma0qBOWt0vlE9sG 21S27xJ8plpranfWuWzwyKl7LnO8q4UupsrWa7xp0MS5+tmByytrPDURx6YJavue/qRQ6k4kYGBa0 BI6RE1NIZaHY9jf74bTA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoYS-0005Zf-MM; Mon, 01 Apr 2019 04:28:16 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hAoWT-0003eY-VA for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 04:26:18 +0000 Received: by mail-pg1-x542.google.com with SMTP id q206so4074131pgq.4 for ; 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=rIwXsJa6plDOGvGwzXpqh4Y7gOYQ8re3JF/rPUFUBYBEzoyW1ywT1a6bcL1M7iye4C woL0ULPW+g/Sb2chK4R3ySI9ESPLa/rAt4u6nJ0mxFR9nUIyMIwFTLEEWw9pqe4jN29v ecCVLM5+leT2vG+KSVoDGjJ3vQmwL1sesqlttlatdq9/dCDYnyE3M5C/3MhREqV/PRNG tkzOXiXQLClj69BrWuiyCMlm8ZQa16rx2Cjs01Atvf7EIyZTOd8zb2otj9l9uXJ5VESq Ycrc+e6wJWIkQzS8Pkc+aLrswEUb6gSDhJS4oAIPfx18QjAnflWZwDi03MPNO9EZGQ6b UNIA== X-Gm-Message-State: APjAAAUxxapKIqpNT/7Zt6ESBKy8frOsUTfT9lSHiLeUzhg5KdQ3jnNE y8XgIP4Jq3g4eEEO2VfH6Xk= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190331_212614_294644_F0E73C4C X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "A.s. Dong" , Lorenzo Pieralisi , Richard Zhu , linux-arm-kernel@lists.infradead.org, Andrey Smirnov , linux-kernel@vger.kernel.org, Fabio Estevam , linux-imx@nxp.com, Bjorn Helgaas , Leonard Crestez , Chris Healy , Lucas Stach Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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;