From patchwork Fri Jan 4 17:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748605 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 2358F1575 for ; Fri, 4 Jan 2019 17:49:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1410D28573 for ; Fri, 4 Jan 2019 17:49:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0739F285B6; Fri, 4 Jan 2019 17:49: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 999E528573 for ; Fri, 4 Jan 2019 17:49: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=IhZps1CmI+cNWhDaVCD3jV0lQ/azepyfVy/x5J2r1Gg=; b=lPD8LZ/uCryZwZ nsNRtv63DU39nsmupYS0j2GXce+7u/TkkNLgAi6eZxdj7kp98Jrwt1cmWx9HYiwJjBLWrR1lVBCRa HZ3tiQ7fRhKw4pOCzXxUKZQXXrzEf7A4ePLTpOg8yBeLty20lAvXSbgwGLzrqF1sRFG7TeFCMnttO 9x9aowEosgr7l3Lh0e1W5+9R2c2wxUFOFZBayQibdx7agMKnsumL95++QLRJ4b/y42Ry2We625Aov ObUmbVy1+5d8o1AXzBrrvO9SD3cLNQ6oxx31nXK1byNY7oPjnUcRgO2RCfmG1J3gAb70T6kebfH97 k6/k2GCUkwCPeYGDoZHA==; 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 1gfTbX-0004GZ-4y; Fri, 04 Jan 2019 17:49:55 +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 1gfTbK-00043T-2g for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:49:43 +0000 Received: by mail-pg1-x541.google.com with SMTP id d72so17766017pga.9 for ; Fri, 04 Jan 2019 09:49:41 -0800 (PST) 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=SKJa7zEhO/trHQqEjEW1IcZtpd/PYQwbclM+tRkTBpo=; b=oKAjY0PKvzJmTqSAvtXWedrQvqbliB4L1vI4Hhc5nAPWIqnFLyUoscPOLjJIvzMusj 4vdIm1sPATs5dxmZryGBlgT1rclkEmznR08UXj1BblyRl3P8bNjQElqb/jyaSSBZzXok ipoWetngUFR/b3oT9yLNp1UQYB9Ba7qUQB8ldTW+pU2dHJ0V9DNdAJavyz464ViB0qB5 RvTpZzPKPUoUSxwbDHNi2iH3FM6quo7QV/zd3UAJhHj4K5cF+hErydcWKT4YApELfhSD 0KlF/1jY5WiHsQPIBEht2JkAa2F0MLDKRNUNsbPFSffS26/BAvDxYFdY9oS4UXrU5uI/ PPWg== 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=SKJa7zEhO/trHQqEjEW1IcZtpd/PYQwbclM+tRkTBpo=; b=SIvSi3afldb5ysUjypA/WDVZ2lfOVZJi8X25Hi/FFqyxnCWB52R3EPJsrM+nJjhbhc O0neW3FmpDyyk1qT1VYe0StoJT1pIhXLGuVHBKy24R0loY7ZWMqJXcrTlKB06WyZZpe1 ngvTLBvDir89mQUwRtIdtgOC3/eUGC2UyF2Ayc0ufy3t7h//NX/XMg4JabNaW64txqDK 3TAdE7GiXni9umyUIoQ2v1aRbVoiiZfU4pofuNH9iKAaX14oj8/RFzL/xkLVqFL4TdTm PdBh508/XWj0Rl3wUkdQv9W5pVYqJsl1ebJjoS+b5iJ4pYI4ySWeLVMZRBGGggwYEbur SURg== X-Gm-Message-State: AJcUukd/Ao0e0Vu8EIwitRt73eVkqyk+7UT2UIW53/+5B6w+AGKcSsba GSVwjskOEregDfZxjKiYItO/t55kCVg= X-Google-Smtp-Source: ALg8bN5QBpDrJLeoSdKMrCQL9CbxLzeC6h/BT2qr3lg4ES+HltYQyU/0jZrnnT77QyM+EIwTAaS3KA== X-Received: by 2002:a63:a401:: with SMTP id c1mr2443713pgf.403.1546624181277; Fri, 04 Jan 2019 09:49:41 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:40 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 01/20] PCI: imx6: Simplify imx7d_pcie_wait_for_phy_pll_lock() Date: Fri, 4 Jan 2019 09:49:06 -0800 Message-Id: <20190104174925.17153-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094942_163342_3B65B80F X-CRM114-Status: GOOD ( 12.25 ) 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 --- 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 4380ee797c04..c73c7a6a4c55 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -86,9 +86,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_LCR 0x7c @@ -459,20 +458,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 Fri Jan 4 17:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748629 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 555AE6C2 for ; Fri, 4 Jan 2019 17:50:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4653F285B6 for ; Fri, 4 Jan 2019 17:50:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A218285E1; Fri, 4 Jan 2019 17:50:39 +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 CC79A285B6 for ; Fri, 4 Jan 2019 17:50:38 +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=1MoU0yc3JGcc7c0bc3AAsTR9HbQndRKwmApdToAmDx0=; b=EjwVkE4jzOKsLR ZlhWIciiKMAhrom6l/hWPHqy5qhKYPnzRg3pxMyg0q59AQc5q57/a8Aextr2D0dA+J87OBkDFKBDZ 8f4O3UkNoUE62lEC6kpMN73yZQswVgKCyAy35LiHR6GD2yQM4LzvdrnoZuvrlk8CS/FGF2c3eP+6W sClhKljrI4MeLLdMr+DTxasEdV9Jm0nXp1dwIK+//WK0xA4Dd2VE/lpN5ljGjyLpMfYMok1mdkD2N UHh7OvJgXigUM6Jr2tPOagChPqT57VL7Y6nxeRM3s1Abixc11Z7iKf0NUjB2rynPzYyzmkMxkl27y WNG0bAtoYszwPJcq2TPw==; 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 1gfTc7-00065j-81; Fri, 04 Jan 2019 17:50:31 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbM-00044D-9S for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:49:49 +0000 Received: by mail-pf1-x443.google.com with SMTP id 64so18619449pfr.9 for ; Fri, 04 Jan 2019 09:49:44 -0800 (PST) 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=qGsfwtEO4Mu6yENA4Q+2w4zzaj5XitiKPr8jlGDyGeo=; b=YxuskCBM45AXemDIJ2J/t1aM4U212J7AUmDeYvPZaIXjSGh9cy7GbOd7yfKc/NYuHh t9oivhxz5ZRzufDm1+dfzLGwj1nYYbWBk29iZbo+1TJU/DHUDlzRFzmRIolbi6ntWDan WOfcXmgxq7YT/zJqs4TIYnUv4H5sYKi8o1PeBu/L8OslxCZ/fXzvjWOB0vZcPNHIzr6A TjOZP25L4PpmSj5aqL6oeX3sPBmmZ7ZEQawAdNw7NTiJKME9qVsyOoy93Hf4JBiWoV+p VT9PnQR00RzoWy/fQFhVVMKIX4P035yXvE2SeLImzJ3lyXeI+xdpGko1hh0VKJRqnvtC uPlg== 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=qGsfwtEO4Mu6yENA4Q+2w4zzaj5XitiKPr8jlGDyGeo=; b=SO7nrx4Rg7lkDE/JUwQFYpvfwTrgsUx2UinyBHtaddGH8O6mCy7wo7sWEz0mSgKubI MeEpDIjegXZtMygQkJOOwlkGxib77angDHlZVrOqkT77J+uQDYmtBvHpGU8KSaQ+AIzz 83Hri2C0AhYCI2dLEcd8tuYMEdFT+710/UvO8wqKKkzkTXrA6lu+pkDRiWM8JFuH+RiP dhmnWm9mGtWRlwO9je5/+wvRyy3ObgvKCS2vp4E3/dhjICuOv62KLMp9TAWKXFoPlky9 lB0erR0+dEsMnYHcOD8f9TpGkR8PFBapKofhxel5RuSiiIrJ+dZYLhI4ng3w4wdFmhYi kZRQ== X-Gm-Message-State: AJcUukfmDm73llgqqmi3PduslrSaymanjPfihBEhK5/v7RiBHJK3RztQ vdbV/L0rx49lcuet/DfVmPs= X-Google-Smtp-Source: ALg8bN4hDTKnyz/RSy+cC/+oLPKwkfJ8lmWA+5xUtKcgLiApBqTMtrA3ryaQxQYLrzSgPDJfaCpfPg== X-Received: by 2002:a63:d5e:: with SMTP id 30mr2431937pgn.54.1546624183460; Fri, 04 Jan 2019 09:49:43 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:42 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 02/20] PCI: imx6: Remove redundant debug tracing Date: Fri, 4 Jan 2019 09:49:07 -0800 Message-Id: <20190104174925.17153-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094944_595662_AA8CF361 X-CRM114-Status: GOOD ( 12.68 ) 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 c73c7a6a4c55..491a93a02c80 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -677,16 +677,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 Fri Jan 4 17:49:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748623 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 EF87B14DE for ; Fri, 4 Jan 2019 17:50:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E164D285B6 for ; Fri, 4 Jan 2019 17:50:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5298285E1; Fri, 4 Jan 2019 17:50: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 8B2C4285B6 for ; Fri, 4 Jan 2019 17:50: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=8P5fcltGfKKMdnkLy9JrpQEI5mL0giTBGXm6H96BERQ=; b=r0e+vIHKAxH/XH KGoz2gNUFTCXeGDoFRkqf0gILZLsObjKgGoOM4Ct1kFB42NEOJQy39eMNQIowfLJqikFRPQeXMvTP YB+nmN6zIpiezPGeHg8JpXWkHo4ecYpudMDr5zGK1B2rh7xcpLkmyCliGVD6w5WnXsNvrWXhgeZbX MjkC9Wv+muwCM8BzwViD/dDziy6Pww+4gJ7X7RMDAp4XYI8vowbarMeUp7f0JbIolfyhUtPp9xbBf +AwSMG6dFQYTpGpAz8TwieuOVu/oWCvJa9oKgQUHManSWXsbGEVcFzydFdGGHZ7CjptQSmtprLEJw u8yeyRSzpDVmGbbiMnnQ==; 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 1gfTbq-00057n-Fj; Fri, 04 Jan 2019 17:50:14 +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 1gfTbO-00046L-9A for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:49:48 +0000 Received: by mail-pf1-x442.google.com with SMTP id b85so18629486pfc.3 for ; Fri, 04 Jan 2019 09:49:46 -0800 (PST) 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=KJzDYEASCtJoBvSDPXwzAPQP14rP9PAwK4xPdCOMwW0=; b=nemLFnIamffqdBky0GXQXY3CwxeEZ6YWQvEdffEfXhg1yhDLxnXlcalOt573u1sphT MQA2tC0oNIURJ61ez6iZL53jSASIHY5+LzZb90k4qAmV4XRPeyI/P5VXpBL0QiKy6CWi ueaQzXxxy0vHwwxqoZXYOjkhInhi70mODbn0ZiLqifwqLK61gAA/ee3HcRfIKCBNnoAa EABmaBKKY+l00GJLewcwRGIIO4t5/9fCCwcbrrWvzAIZcZBCXpU6sOgTCp+XXZKJA3LS kU44lTNF6hmLVyGYszi9bl4yiX97Sr2l9Shz7uJinixiBQMWR/OkHqhDmvbdw5e9io5M MA+w== 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=KJzDYEASCtJoBvSDPXwzAPQP14rP9PAwK4xPdCOMwW0=; b=TeVnGU65rRYM7qHI/oQ9CUZjKo9Y3Jc1w7w0/Ty7kt6THalJ3Wa+Z0yxnCNn4GbN9l /IsBODfmdCPUFbivkowSiIC+lsRkBOwryLKJEt4yQ/bvuNmOb5lc2KDFK8Xl3cjNJFDN 3CCg7SOZrXAOvNNHFSdtXCzw7AjH5Rph9n5kSIiVtg5yf89XDhK75+QLw8skeE9BCRlp Rf1Itld/3nRU9G377IuYJgoXU9awLMeYHVoA6E1kTZskWxUWa4UKceMy36rV16Xa4BxT DWa6n2jeHaktMrXWksDxuVzzY3rYivqSqZ/Ya9Oo5lmalO0INvKuwLSwLfCW88W9fjg3 561w== X-Gm-Message-State: AJcUuke4jiks7N8yhIUiaQx2bF22GJIRb4XIQcrp0/jvUd2sP8Z04/sU kzy3QODRdc2fLQMbVFmoTZY= X-Google-Smtp-Source: ALg8bN62Z/ONTKavQulh6umuVA7rLaQLdKNV4XVr/H5+FtFegah5dPfF4bl9v0EW0vr/zUZ1sJ9Pfg== X-Received: by 2002:a63:9b11:: with SMTP id r17mr2459416pgd.416.1546624185485; Fri, 04 Jan 2019 09:49:45 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:44 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 03/20] PCI: imx6: Return -ETIMEOUT from imx6_pcie_wait_for_speed_change() Date: Fri, 4 Jan 2019 09:49:08 -0800 Message-Id: <20190104174925.17153-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094946_797125_8CA356CF X-CRM114-Status: GOOD ( 13.15 ) 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 --- 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 491a93a02c80..a81edfac9974 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -698,7 +698,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 Fri Jan 4 17:49:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748631 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 D05586C2 for ; Fri, 4 Jan 2019 17:50:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF23A2861E for ; Fri, 4 Jan 2019 17:50:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1001285CD; Fri, 4 Jan 2019 17:50:49 +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 39A00285CD for ; Fri, 4 Jan 2019 17:50:49 +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=UOOYtzCMTwCN6MCnHliwKBC02ZRhmxNFy6gPzUsDhFs=; b=WFRRasoHkanstP aGKZQV8Ec6zzla1BlWykvl7GH4nzNy3UsYEuEc12l/krOniRHPM7xstTwnn9nvbp0ClINtLc6M/ye AI2K8g40STGo3JnqgL6JEwJ071XRHs5suatCpDfPqpyFb/WbXx0XvQ1Kttcaf6byySCLYw16Cz9qr sFSQsiJlesKq/mKTA2ytU+K6Zq0v7HulKvT059zQKdZBkDF59Euzb/28iXYO8jSEqxPsQI2laKUGb n0VFjNf/MobnV0BX/A9SGU13JJAx8xn6Bgs+Rgv5uGHtZWeJkRbjl1eKq20umXJwozjTrV21B8kmC 2MbT5VzS4hp4SkYhxJLw==; 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 1gfTcK-0006K7-SL; Fri, 04 Jan 2019 17:50:44 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbQ-00048R-3t for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:49:54 +0000 Received: by mail-pf1-x444.google.com with SMTP id 64so18619506pfr.9 for ; Fri, 04 Jan 2019 09:49:47 -0800 (PST) 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=mCqECGpQL31DJ49A/L9K3JSZYoIJTRJ5Yhw/wHfMJEY=; b=PMXNaB96VaHiHNXXRIHAGRolmiJt2VeTXMHSbsRa+yIvRjh8vO2UvjjDajS06DTCHp jWutAyiiydc4NkFnXGLy8N/TKPZKD6KMPwY3EH+dHSSqDsvDJOlUsxKYJWDAh6GSQBpn x78yK7yfbVBbCqEJID6hSONoqZQSylqhwLN/GB57ydLzk+Xzhvt7k+tLziAYM6vOSaoU i9jqZUIk1WWJ1dquNnOEhxnLwI/4LTQFPBe+w3G5H/iSDgyC1EpnPh1XFnw3Qf1uD8WJ zsnZmx2+2cVthJVX+X04/hP4lWTKK5jC6pt2X0GbBJ4VNyGlGIQFWqAUUSj4CguTLscm KsmQ== 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=mCqECGpQL31DJ49A/L9K3JSZYoIJTRJ5Yhw/wHfMJEY=; b=K06HYzyCRQrDNm4o/vt/H7W+tR50p4qpYjhI5un+SVrK0+cYRZHx2LpZfTaA5r8dBQ ++wEKcn19OemtCDvXL7dz7MmADPukXGX9s4gDW213WGhjQH846jMyNk5doMVi94VZH8r iJBtsgthp7hwAyuDUqATR2zsIbdAoi5ktOLWDmGPgBB+x0g8+7zZAEdde5IJOweaOosz 3J5LIj6yBW1XaiKFjsZ4qPYaW5IpftdW4jqpfMvUqwNkWrMlJAbtbXzSy95+ua2nL34/ x44kwpLWa/f2dO5VDJHpNgpCnHLwlmuWWkar5f7huIEckV+S150yBZ6mWgsDeHJzyh/Y xbaA== X-Gm-Message-State: AJcUukflZ8d0I7mM7RcGSWauxvlSe/As027hLeSW+CCtCzu7E+wMt3Df 7k3deJ6EA7djTLVazcp0RpI= X-Google-Smtp-Source: ALg8bN7X7QAfuXbhJyAnQ0K3OS6WnTAeWqdTDKnmKlvEbHUmdoUhGMy5B/iQDijGEZKW7/W0AWPMFA== X-Received: by 2002:a63:34c3:: with SMTP id b186mr2346117pga.184.1546624187337; Fri, 04 Jan 2019 09:49:47 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:46 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 04/20] PCI: imx6: Remove duplicate macro definitions Date: Fri, 4 Jan 2019 09:49:09 -0800 Message-Id: <20190104174925.17153-5-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094948_299372_91936DCD X-CRM114-Status: GOOD ( 10.39 ) 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_LINK_WIDTH_SPEED_CONTROL and PORT_LOGIC_SPEED_CHANGE are already defined in pcie-desingware.h, so drop duplicate definintion in pci-imx6.c. 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 | 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 a81edfac9974..5090a618c3e2 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -115,9 +115,6 @@ struct imx6_pcie { #define PCIE_PHY_STAT (PL_OFFSET + 0x110) #define PCIE_PHY_STAT_ACK_LOC 16 -#define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C -#define PORT_LOGIC_SPEED_CHANGE (0x1 << 17) - /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 #define PCIE_PHY_ATEOVRD_EN (0x1 << 2) From patchwork Fri Jan 4 17:49:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748633 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 AC30D6C2 for ; Fri, 4 Jan 2019 17:51:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CAB5285CD for ; Fri, 4 Jan 2019 17:51:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9086E28627; Fri, 4 Jan 2019 17:51:03 +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 27F8E285CD for ; Fri, 4 Jan 2019 17:51:03 +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=6awoPxhoSoAPCMnXGWhS5jZhhihZivHl26/w7trteOo=; b=YuqU8Aj5YrrhD1 8u4RRpS1PN0ei99d81KGgThk9aXC6GNIpTZmCkMIZSMXP5O6Rrw6X7qLPU+fZcWWyH0PcioM8I+pM swPbM9wZ9tpohHFncvk16OnojTtg2gzl/UNguv29KUTu3Ci7/FduD9pV9CeKNSWzruCMnUuUiVP9f J6QBLOS8omL8OH2840vIi+GFhLyTggvqNVKwo8unY7kYwR0EyIrUG3nLVr4V9pwb36z/cgXJcFtK3 +BwcxoDy3GH2tIVbHB7CJJHCNVlUs3hIabkVLHjFzncU2hCris17WjbgjXlfLOTjHqI+hEKG+WSjl T1sMAXgWCCnxmG2/0BEg==; 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 1gfTcZ-0006a1-Pv; Fri, 04 Jan 2019 17:50:59 +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 1gfTbR-0004Ac-Pg for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:49:56 +0000 Received: by mail-pg1-x544.google.com with SMTP id y4so17766696pgc.12 for ; Fri, 04 Jan 2019 09:49:49 -0800 (PST) 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=BTd99CHE5iLaVoOAVJd8WfMcBFC6tGpgGczKpbbc3Sc=; b=KZRJ3v8fnd9guo51anuzyHME3XTBHLulXCoUd46xXupoa9GJBDDSahPQaeaI6PLGVr 8WGYsbFLDSaqyj4vvuSYG5SYiOJLBRczG4BTCT412zHy0aHlx67BJF/5bkIB3ajth8M3 j0DOWvO/vyFVPj9cdvQt3pkHf/p2UMnt6OUkI2HKxtpV20UXZk5glYy6iKg5mDpqKjxi hcAFFzi7QNbmQbGsn3A0vnbCTD4Xz1FWDYBl9/cDKuzVr5ZdDGbup+l0Yu9qrXJK/XMo W0iKa/8vKbVIyT/WW+X1irJAlhyfyKoLZGtxCaBxnthGEZW6chT2vwCL5iJJ7SR4zOqo /rqg== 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=BTd99CHE5iLaVoOAVJd8WfMcBFC6tGpgGczKpbbc3Sc=; b=lfU7cH03Io0UHj/zadvnE58F4m1K1ezKesZDFcMus5KeAMmSdrBSL4KV2F6FPTzg4V lM0bZDn2qLVvDzDGIEm2Y2Yu0L2HXO8tK4aAOjgn2pj4uR1+do6TBYQpSWcML5LrJI/O rQEuV6cX/Df4ZkqiamJOHlT6xNScBlKruAvQMyZK2MtvQpl6erfBFduZt3RM1MCyJZuJ U52cQsS4ZDn99JyL05NnvF+qnJ3n15/9IMGEnu0jl4l+sYPpzfl30EiJDkNzmBr7bWt9 x+02JHxnis+CzDvoTfi3RI7h8KVKjapnwvM/+HtOk/qg+7747IudXu4pYJCbz378Hfdx rk5g== X-Gm-Message-State: AA+aEWaeYp4v68SfXShdySNLK04rGPGWN9w/9miQoq6f49gUNsVT6A5U tkrgmueDlLOYLvOjbvhLh8g= X-Google-Smtp-Source: ALg8bN4Qb8qQMO7TZhcNjLcZcF+mDwHVBnDykUSYqKB+NrSY3NbwaLE59uALn6HrKRe517RVcaaUeQ== X-Received: by 2002:a62:520b:: with SMTP id g11mr53858019pfb.53.1546624189099; Fri, 04 Jan 2019 09:49:49 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:48 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 05/20] PCI: imx6: Remove PCIE_PL_PFLR_* constants Date: Fri, 4 Jan 2019 09:49:10 -0800 Message-Id: <20190104174925.17153-6-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094950_783357_1A51D22B X-CRM114-Status: GOOD ( 10.00 ) 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 --- 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 5090a618c3e2..a7192b9e0e71 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -99,9 +99,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 Fri Jan 4 17:49:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748643 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 6688A6C2 for ; Fri, 4 Jan 2019 17:51:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58A5128305 for ; Fri, 4 Jan 2019 17:51:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CAAC28627; Fri, 4 Jan 2019 17:51:15 +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 0324E28668 for ; Fri, 4 Jan 2019 17:51:15 +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=OMN7vOg+R1qirVy5O3nXR2NAGyqAjjEPR3o2k2Aju/c=; b=ZMT/yBNCaO5CDj W/0alQqlrDLcdpR62JptT/ewMXalP+K0lD2bYRcjI1P3rdsaQH8UGmY2rztrPIIlqZrzG6nfTPVfN 4mUjclFRA6CmCDtqpRaNgfy6n2lV62OS6X7vMfvBRmCZ9mp8TI2TmJvEW7fZXBphLq6vfupGZqYMh 983NVZXe8Nqb4HNEiYz+uYmytEVGJINgSXuzxZZM7n61Ehr5ZsVoEtiKLTkFWfTe94N1VVV4Y3RqC IsAbZ5z+tSXAT3S5DsPxt4VoQaDZ9/FJsauzKvanm8E/RknO87x2D+QyYT9rwPX42d5mpSny0UUuu Cijx159WhjBTSkEvniZA==; 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 1gfTco-0006ok-3c; Fri, 04 Jan 2019 17:51:14 +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 1gfTbU-0004D4-41 for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:03 +0000 Received: by mail-pg1-x542.google.com with SMTP id y4so17766733pgc.12 for ; Fri, 04 Jan 2019 09:49:51 -0800 (PST) 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=3VOwOJYTEi9UR4UgeiKLcvLz0osJ4eyuFQfv798N0kw=; b=cIQDFnbbZQ7zun0bPoYcKlx4CAsV3EdWh8sQLP0WqF9Y45of71SulNq2FVC8xni2F0 NW7GmTzooeTKpkIuN/g2s879lKeRldJQNhRxB0FpP7j+m9mBmZSSyHklkczn+yfZI6Xz BWjQl6TtJNNh964Grs9JFAUqrD7oAmW5nRJ2vasVyDn0pnMm4PgKlkEXdSLibNVdsi8w 9xQEhxC6V6KwlpXt+wbL7QbIigPIGkuTpl8zWtYUvmupl+q4L2ENNZE7OMPHDlWdDH+7 Ekno1l0RTMm69qLLs6FPaiUl5Zamvg+3jST6R9lJMWCOY0AGyEIR4DZahVRmpH7z1jlw Ww+w== 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=3VOwOJYTEi9UR4UgeiKLcvLz0osJ4eyuFQfv798N0kw=; b=dsU9ncwkW4wWKTZ0mShpHjuODVfLQuCzxOF8Vc+UIPNYbkQMJ3iHto9PjrqbwQomwF JmxqUSqFxz2LbtxLQV2oL1+PmuyQKj+ysL6xYtNgW3sdUmrEDeNy3EYFzZ5dWgCKTgGc 0GD6fGWMizm6Eyrq/ZX0V/UmBydR52myTmF5SCo0PwI7DGX+d9Th9jY+FbnsC/RwsM4Z 1gButU0dW+Cc+Ivpe1VO7kzpQnxCm5V8s7mMvDGOsK9BpkaCKk0XFw1Dv5Q4EXMzgA8K dkC5n/KNWwomzQ4RcfkpxMqHoU0YgcRDiht+sEAumL926SFlyLQCXD7FrC1nfGWmKk5N Ezow== X-Gm-Message-State: AJcUukcKQuF5uqTxvm3LtGvz4+J9U+nQxXvxnRSxwrTovC2teDJekjND g6hybZJW4OhTtkU5ZfyjWns= X-Google-Smtp-Source: ALg8bN63AGT6KHsPf4+9iTaT+C2aMgpdrT4E6ZaEu9GWtQHOwSDB5//W1Fa3tk9pOsUCFndg/m44ow== X-Received: by 2002:a63:1904:: with SMTP id z4mr2364785pgl.135.1546624191241; Fri, 04 Jan 2019 09:49:51 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:50 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 06/20] PCI: imx6: Remove PCIE_PHY_RX_ASIC_OUT* constants Date: Fri, 4 Jan 2019 09:49:11 -0800 Message-Id: <20190104174925.17153-7-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094952_532111_B58D5FBB X-CRM114-Status: UNSURE ( 9.81 ) X-CRM114-Notice: Please train this message. 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 a77c5422d758 ("PCI: imx6: Remove broken Gen2 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 --- 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 a7192b9e0e71..282b09076fea 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -123,9 +123,6 @@ struct imx6_pcie { #define PCIE_PHY_MPLL_MULTIPLIER_MASK 0x7f #define PCIE_PHY_MPLL_MULTIPLIER_OVRD (0x1 << 9) -#define PCIE_PHY_RX_ASIC_OUT 0x100D -#define PCIE_PHY_RX_ASIC_OUT_VALID (1 << 0) - #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) From patchwork Fri Jan 4 17:49:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748653 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 EE3A613AD for ; Fri, 4 Jan 2019 17:51:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFE2928305 for ; Fri, 4 Jan 2019 17:51:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D24382863E; Fri, 4 Jan 2019 17:51: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=-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 8138628305 for ; Fri, 4 Jan 2019 17:51:32 +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=jgnatUXscBnDEJP5Q21b9N6W+vBUjQuEUKsFe97QZpw=; b=GuZIlMfn7CGeTG W5J4r0ff0sCeyk7ob0KHdndkbaWMyk91bOjQFjfor5mrlhYITYuDcUIulkSYKdFsfr0RDMsBinRHU vN5pDxYidhZx6vlawtHMD3N8l0xlComVnv1pmw2WmZm2gkphzFdbm6BwOSc5DK1vg7mrLYlXQYZ+E rxCT5wW0FaC9c7i1luvDHLqsbYHlMu3J4DvQCmyM3T4oAATLXMc8tElny42kkpc6o2m/ZhF6RAqVo sgV0dHm+fV8vC3w5sAzdXR5apjxqlZIBAw+s4y0qUqriZjmXSCgh080tY6HqQGodj48KK/p3IhPeq qz/zPa7kWsLO1xX1UPdw==; 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 1gfTd5-00077z-9O; Fri, 04 Jan 2019 17:51:31 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbV-0004Ft-TV for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:09 +0000 Received: by mail-pf1-x441.google.com with SMTP id 64so18619611pfr.9 for ; Fri, 04 Jan 2019 09:49:53 -0800 (PST) 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=QhqhT8k9cRoxWOByjnw4+D3pr2bPAqv3RKgBmGiID7Y=; b=puOa+Oa5mf9v7e1IlYNfFflOsFbHuywQvz56JQu5xhuT1CWhPCFLj5SYPYM0yYmSxf /3ltIOT1DOuf/cpIxyBhUhuMcaU4KjjEeEw1v4Vp+uJ3/5Wswg9DE0gIpvZBEf4NTwgG g/Z+0G0NDf6OlV+Ajjkw/F4DhmocblP0TRHEL3hokf2GHWJ5twOYmMsVgsUhoPqohYz7 zbbrvcYT13Eyp+txwqEY8zgTO1SEd+AEvdzWdSzcHuZwLdtEfyg5o2uw7tTj3v0ngKwP hQfOk4ZWVwOUb0AxvHfRCFHbgaChQbx7CK2zY/tDmCMQZNrW/4FH8cjdhfuUu68LEUd7 YgPQ== 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=QhqhT8k9cRoxWOByjnw4+D3pr2bPAqv3RKgBmGiID7Y=; b=V2xEYeoRlGVdB+KxplPxJQIalsZb6ODAfgCxS1niOPfyu2zgVBo/P0Iw/msm+Jx4Xq /SI6BOVMHI3sVwlS3V4x+MzY0Ys6nunug/JUfXlyLSFTnlJtc+qWaWXvKCwF+Jp8i0C/ ie4qH6049bhW7VlfXXB854/x0dCqU2ggUCj2b96+wGndKPjVFq24UrrdlA+xuPvD3Sp8 Z+ijNQH/h3Xledt8Mvav69tGfHjAzjfkcusEhUb71/99Mc2LS9xM8NcXrGgyWZqf2oPD Rz6p8xF794g1sc9JwPWtneRVAZFPWlHXT4u6RMZHVKkR3VH9fWTB8sCTW7KFbc0VBRNV 9tOw== X-Gm-Message-State: AJcUukcEGyvZD+dTfNjtg80PpDcybRJudySMl8C8XjffHNWJ7AKnAsnm IyQ2+SvK+6yj+WQIPa9xhMsqW2KLE9I= X-Google-Smtp-Source: ALg8bN4LPvul9EoVP+PUo/2OYcZzz1whMoTFA5PuuZ/nPLmsezd3LBKPNU19q/O3Rnl3lTb/V3kfzg== X-Received: by 2002:a63:c00b:: with SMTP id h11mr2485051pgg.429.1546624193159; Fri, 04 Jan 2019 09:49:53 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:52 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 07/20] PCI: dwc: Make use of IS_ALIGNED() Date: Fri, 4 Jan 2019 09:49:12 -0800 Message-Id: <20190104174925.17153-8-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094954_700625_4FEA34FA 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 , Gustavo Pimentel , 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 the intent a bit more clear as well as get rid of explicit arithmetic by using IS_ALIGNED() to determine if "addr" is aligned to "size". 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pcie-designware.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 93ef8c31fb39..67236379c61a 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -22,7 +22,7 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val) { - if ((uintptr_t)addr & (size - 1)) { + if (!IS_ALIGNED((uintptr_t)addr, size)) { *val = 0; return PCIBIOS_BAD_REGISTER_NUMBER; } @@ -43,7 +43,7 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val) int dw_pcie_write(void __iomem *addr, int size, u32 val) { - if ((uintptr_t)addr & (size - 1)) + if (!IS_ALIGNED((uintptr_t)addr, size)) return PCIBIOS_BAD_REGISTER_NUMBER; if (size == 4) From patchwork Fri Jan 4 17:49:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748665 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 1F9746C2 for ; Fri, 4 Jan 2019 17:51:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 114DA28305 for ; Fri, 4 Jan 2019 17:51:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 055EE2863E; Fri, 4 Jan 2019 17:51: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=-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 8AEAB285B6 for ; Fri, 4 Jan 2019 17:51:47 +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=yQwxqhcXCocFPPwphep1vt0FJqVXQ/wKjpTpXonvQHA=; b=OU/55XQLDgZYC1 6iVxLEL9rdkmehxWQ4yQRr7RrCOw9SuKvkU4fc0KKbUG/sJtc9zQFGHLXHNotMo7ivLk5uABsjhsz z1JQdxNTonKHiVwIBU1WqmxGNYZq/eENPU8mHh2+ZnfDPJ/tu3t8dY5P7qdBBvQRdQm6WkguMScBR +k+NcRacB71C9X6/58sZGcb1PdXeOTBvUd2ZwEa8AWz92+/P20CPa5yl5Eop94Gtyplt4y/EsmK4V RCQIWhfK7kHOkXgLnFioRMKXc8nWKwhJX5vcqMHbPR3qf6s6CfLZfV9NM+946iFlhYAYSt4OxP7xU UVZU+FS8c3VqauKx5z1A==; 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 1gfTdG-0007IG-P6; Fri, 04 Jan 2019 17:51:42 +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 1gfTbY-0004Ib-5z for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:13 +0000 Received: by mail-pl1-x641.google.com with SMTP id g9so17734282plo.3 for ; Fri, 04 Jan 2019 09:49:56 -0800 (PST) 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=x2fXdz4Ik0AFAzOQLJZdPMvlCQxR5gTcFSjR6Jns4ok=; b=o0FDJgev9btFmYYkveMGrkg/Hkmls0C8+1uS/nygLw4Uk7vy/dy9p8BKoV/YhfH3wp 4vGK5MGwAkx10+ic3evz42ug6d/Sf5yOaTxPqhZP6wjJlVFYtP0ZvgwjLyd76mPsftVQ QerpaZdGIkOxN2mZxUgu4kvKEWGSVzRYWONCfW0jLa+y/mwm7G9rnvxe/X9e9xH/R9KM +csBimpxYMZfnbZTCSBBaXL2SJ6bER9uaFzg+3aO1jPf7xrzezyC3KP0t2ba2c8mrzHj LDoPufDPALnR77DADEmjBJJrrvChh2HBsXvzeZdSdx0YmmMFBczmk/udUxfQ7PZtoy4W USFQ== 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=x2fXdz4Ik0AFAzOQLJZdPMvlCQxR5gTcFSjR6Jns4ok=; b=Si3hplWh/sf/UkEt5t/6TV/DjjjHBL9ElSNeXUK+A3GVnOeZTUtqsTQyob335PoXTl MvIuk18QzzzqluAI+pWnB87HTmQ941Yj86tCMbBMU2gMVuwpCp2/ZyVwjw/+96RKS+5O OqY42utfZxD3w9Op9XWPVvskBG3CGYQbrIEp6xpy+ffXN2XZXr+lRpAbM6OSYbjhzEX3 ar6DRIDy797Hb0zCrPyur53nIW4D9seiV32NpUrkkU3/6SbYswN0dRqmnT56jsVjkrTJ CaKEbhdDeaKLE1zA2tCeJ4Y78oDyNQtYsepZ51UlZBGCzkmkeGlgKEnYrkt0rBD+/aYH nXkQ== X-Gm-Message-State: AJcUukc0jmHLqepcWbbiDeWwiFddbIFMo51JH9gcrftkv5tteqefsrbB 78tHIGChN6bg4oW6Vq3yI1I= X-Google-Smtp-Source: ALg8bN5ad63oBiClCtZSZLIALm9EAJPHW2K5pki0ZrSO3gi4fH5hTpIUwFEptho0YVi2j6ZqVHykMA== X-Received: by 2002:a17:902:1105:: with SMTP id d5mr49894927pla.47.1546624195161; Fri, 04 Jan 2019 09:49:55 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:54 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 08/20] PCI: dwc: Share code for dw_pcie_rd/wr_other_conf() Date: Fri, 4 Jan 2019 09:49:13 -0800 Message-Id: <20190104174925.17153-9-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094957_410163_FB49A4EF X-CRM114-Status: GOOD ( 13.93 ) 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 , Gustavo Pimentel , 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 Default implementation of pcie_rd_other_conf() and dw_pcie_wd_other_conf() share more than 80% of their code. Move shared code into a dedicated subroutine and convert pcie_rd_other_conf() and dw_pcie_wd_other_conf() to use it. 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- .../pci/controller/dwc/pcie-designware-host.c | 61 +++++++------------ 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 721d60a5d9e4..8f957cd6901b 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -512,8 +512,9 @@ int dw_pcie_host_init(struct pcie_port *pp) return ret; } -static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, - u32 devfn, int where, int size, u32 *val) +static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus, + u32 devfn, int where, int size, u32 *val, + bool write) { int ret, type; u32 busdev, cfg_size; @@ -521,9 +522,6 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, void __iomem *va_cfg_base; struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - if (pp->ops->rd_other_conf) - return pp->ops->rd_other_conf(pp, bus, devfn, where, size, val); - busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) | PCIE_ATU_FUNC(PCI_FUNC(devfn)); @@ -542,7 +540,11 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX1, type, cpu_addr, busdev, cfg_size); - ret = dw_pcie_read(va_cfg_base + where, size, val); + if (write) + ret = dw_pcie_write(va_cfg_base + where, size, *val); + else + ret = dw_pcie_read(va_cfg_base + where, size, val); + if (pci->num_viewport <= 2) dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX1, PCIE_ATU_TYPE_IO, pp->io_base, @@ -551,43 +553,26 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, return ret; } +static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, + u32 devfn, int where, int size, u32 *val) +{ + if (pp->ops->rd_other_conf) + return pp->ops->rd_other_conf(pp, bus, devfn, where, + size, val); + + return dw_pcie_access_other_conf(pp, bus, devfn, where, size, val, + false); +} + static int dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus, u32 devfn, int where, int size, u32 val) { - int ret, type; - u32 busdev, cfg_size; - u64 cpu_addr; - void __iomem *va_cfg_base; - struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - if (pp->ops->wr_other_conf) - return pp->ops->wr_other_conf(pp, bus, devfn, where, size, val); - - busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) | - PCIE_ATU_FUNC(PCI_FUNC(devfn)); + return pp->ops->wr_other_conf(pp, bus, devfn, where, + size, val); - if (bus->parent->number == pp->root_bus_nr) { - type = PCIE_ATU_TYPE_CFG0; - cpu_addr = pp->cfg0_base; - cfg_size = pp->cfg0_size; - va_cfg_base = pp->va_cfg0_base; - } else { - type = PCIE_ATU_TYPE_CFG1; - cpu_addr = pp->cfg1_base; - cfg_size = pp->cfg1_size; - va_cfg_base = pp->va_cfg1_base; - } - - dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX1, - type, cpu_addr, - busdev, cfg_size); - ret = dw_pcie_write(va_cfg_base + where, size, val); - if (pci->num_viewport <= 2) - dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX1, - PCIE_ATU_TYPE_IO, pp->io_base, - pp->io_bus_addr, pp->io_size); - - return ret; + return dw_pcie_access_other_conf(pp, bus, devfn, where, size, &val, + true); } static int dw_pcie_valid_device(struct pcie_port *pp, struct pci_bus *bus, From patchwork Fri Jan 4 17:49:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748673 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 B0DBE13AD for ; Fri, 4 Jan 2019 17:52:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4731286B5 for ; Fri, 4 Jan 2019 17:52:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98657286B2; Fri, 4 Jan 2019 17:52:00 +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 EDF7028668 for ; Fri, 4 Jan 2019 17:51:59 +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=vb261sJecCBTIWcXpDT4yjJ9DYwsxGgnTraiG1zlh6U=; b=laCpPBz+OphdG7 HLnEmaXE/AJJ1kVnFJ+2l+xboksjhNOxqSBHynkpXaZHO38QwoTYD+FREy8sUzjMVqWjteQSlCGcJ puEQ+ZML7coZtbJovMRKc6bGikHu26x22r7WvofkDhfzMBYa2mk9SjReqZq0VX+sFrOT/ocmQdcTg +Rt8XYmgELKRwtittvPn4ESt8jonXVAujaLfUJn4DGZsBugnAzx/tgEb6GplAzmyUNWbL5BpW8RoY lO3uMC249BNMQ9vpf3LdD2BU/effTItYdhp5jjFLJG5l8ZoQmuHUvBUH0cYFT148fk0LGszYfa3mH CmLyt/qglSGxPEY/eBIg==; 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 1gfTdU-0007WF-0N; Fri, 04 Jan 2019 17:51:56 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTba-0004L0-2d for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:16 +0000 Received: by mail-pl1-x642.google.com with SMTP id 101so17733742pld.6 for ; Fri, 04 Jan 2019 09:49:57 -0800 (PST) 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=shK5Doptk0Qhk1JfbtIOZ/odHZxsAlF8OFxlwBmTSmo=; b=cl1DLcwRE/0QWpXSbhSh5i0/TvsBDRwsOkAAPfQn0820+d/QVQbClX49IoSnREMRBL zxnfMG4pWoNcC8D0cP6VPi2bj6s10QjS2/WG1XgllsKJPtdSAMIrQm20reIhnEw6z9HX +BLrO1ogIB0/6RxoBfW+KluWbWMcl+Q5Jqq66h0OXhirOVEKyLYFZKyQ/NCM0GCeWaLA IE6sgPXDOv9RtA56sojeXdqs/ewJ58mXxoaP7WeXq4VU54Zxk5GwgtBibUyYZTZcTqAa iSVVH/4dWXNs7hVbX17zPNm0jN+VsFQRG+iwmunKx71ox3qmkzuzdUUf8/iIlym9kc9r 3j+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=shK5Doptk0Qhk1JfbtIOZ/odHZxsAlF8OFxlwBmTSmo=; b=dovLph8ygF5Xppo7ZtCIIDSSEyDFGyEB+UyK6HrYJ3ZZgBY76YeaZkf255ffyDcg4U F/+5FhxOpSmOSarL9v16IP8e9spWLFHjFGbBfK+yYyHARvM7DdWozybW1S9AidIuj0o1 HtETwqFZatNO9HfIvPSgh2VEmu8OyiVYwNgPjO6lbJi6rFS4IJDau9PvVA/PWXgeFc3S NntN87OYZ9rlPTfborfT5QwByiTJ1f8kF3TAFHo4AotqgwR8i2b4Lz6iRSiI8UUonlmt E6QhitgqggKCGiwu2tLI5SnA5B5zdzoxKTB4Ou0GrXxNY5cA7Z+BlB3cmeMKraNJi+BT 5AzQ== X-Gm-Message-State: AJcUukcuM3qygy4E8kN/tlnMTaud6TmDOoLRd6k4rXA6MTlYg1yYJu0W hW6EvEYxQwC3N2mX9IVzD4c= X-Google-Smtp-Source: ALg8bN7xL2Wj0D3OvOejOoR/ru4ykY6LA92CJfEgjRNXWosVQ6tj6c/GwLJV5CaMLFa9MqTdBrCMeA== X-Received: by 2002:a17:902:5982:: with SMTP id p2mr51337128pli.39.1546624197107; Fri, 04 Jan 2019 09:49:57 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:56 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 09/20] PCI: dwc: imx6: Share PHY debug register definitions Date: Fri, 4 Jan 2019 09:49:14 -0800 Message-Id: <20190104174925.17153-10-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_094958_641686_C63F26FA X-CRM114-Status: GOOD ( 12.44 ) 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 --- 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 282b09076fea..5e7fab089bde 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -99,8 +99,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 @@ -784,8 +782,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 67236379c61a..d123ac290b9e 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 9943d8c68335..58735fd01668 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -39,6 +39,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 (0x1 << 17) From patchwork Fri Jan 4 17:49:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748679 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 263396C2 for ; Fri, 4 Jan 2019 17:52:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18A77285B6 for ; Fri, 4 Jan 2019 17:52:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0CCF7286AE; Fri, 4 Jan 2019 17:52:14 +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 A54D2285B6 for ; Fri, 4 Jan 2019 17:52:13 +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=o5baCJXp+NBA0vgNpTRlUkPBD77zSE6y6kLy0uF9mlU=; b=tvXtyrSXnRocWD U46RTWLPiBLX3RUBYe/YR0ne070Xe7MvSBBGdEK07KnXfGvrHnXyIkeJ5IV5/zMxalEW3RLBmK59P /Tjj3mIeGR898fHRv2wCsfsX0dQB0MJmGS7bmofx+pafmE8pBeIJ86ssAAVI5nin1jBU9Q6l694Se yuTUgYaR8gYe3ZzSEgYy/T7TgXCARYWiFkOmvvqO+DzyLXthnI3jkiDRKnXYfu875M+8/mOx6ru6D KONk7fe5KxPC+av4PZK4KAxAASls1PLJuPkF6ryEEd+rUQIO+Tr/wTMJ7XcIOUcOX7hKuKU7jS45F b8503QbQgp2fS+QdKx/g==; 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 1gfTdk-0007na-3m; Fri, 04 Jan 2019 17:52:12 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbc-0004OE-Ta for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:27 +0000 Received: by mail-pg1-x543.google.com with SMTP id w7so17760310pgp.13 for ; Fri, 04 Jan 2019 09:50:00 -0800 (PST) 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=5GPVKMBGU5ZvNu6g1jC/voOA4PDlqiI+yiygPIURHSo=; b=Um3WmXbSD2WHftXb7YDOCm2GnKkStW9iff77m/sinDSPuAyDCa2CkNOhrWt+5bAZ2+ fVtQRJAOXwY3/14+mCUAmm3B7Wza1kiMGA5l5l53catA+AOanNdzl7AHXFuTkqgVQ7If gthkNJVv093LCzdTcZCJ/Q22OAxLwFvwK5ygTCqK6tAmILOvpNtwWe8QTLj1VbQIkztd D/FTCrXL0QQ+6PfXwDX+1Gpm0nIiWImGBPquaWETLsXeTwLRM4MZFzeeXhNu6AFEzTSd sAd1AACcrluL2oXJBXK+gpQpuR9VlutzaR7EaGgCBvgmO8xb7/P5F96cX0qWW1pJGa+x 01EQ== 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=5GPVKMBGU5ZvNu6g1jC/voOA4PDlqiI+yiygPIURHSo=; b=rP66lmGFRxbegAWgUnLgtmxTirhnGtGWkU7qrSHr+FXgWUzZJASOw4I5LWKS0YppLE v8RtZhudqDCPFwlvJL9i6VzNXMFVA1JApYaB7KzoyqLixBwSWf1noXEteUnlzZRBC0wa qInLYZ6R6ouoVa+d7Gysa0/R/EEn0bywkzHxZ/Cx3fJN1CTprsmmnbcMFih7Ec8DeyNl sviQWT5GEvlDc1IXZ8SAAjrBNeAgvczlkMRbwEKJkEaAVplULeSFffBylc9XQqy1nv+3 ggyZAVsDPJ7c+lfVwz+POv2+bLy23Zjkrv6jnPQh7djjkw6pabxUo+/1tXHwaCLPI6xy A7qQ== X-Gm-Message-State: AA+aEWbjSZ6td/nbdMq3xexKeX7lNgoXh4QTUb4+p/7fxCVdF0RQEYxV DWETs7B2LiP5ofZdzXMw8TCRuFvsqmY= X-Google-Smtp-Source: AFSGD/VZP1C1IS24z+0UcPkxVu/MZQFkTGhZq3FCBDvgZajuV5DLwpdWnMLZ7mFUMZPpd/VByx2xxA== X-Received: by 2002:a62:1e87:: with SMTP id e129mr52726011pfe.221.1546624199860; Fri, 04 Jan 2019 09:49:59 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:59 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 10/20] PCI: dwc: Make use of BIT() in constant definitions Date: Fri, 4 Jan 2019 09:49:15 -0800 Message-Id: <20190104174925.17153-11-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_095001_491294_1829F15B X-CRM114-Status: GOOD ( 10.75 ) 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 , Gustavo Pimentel , 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pcie-designware.c | 2 +- drivers/pci/controller/dwc/pcie-designware.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index d123ac290b9e..086e87a40316 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -300,7 +300,7 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, int index, } dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, region | index); - dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, ~PCIE_ATU_ENABLE); + dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, (u32)~PCIE_ATU_ENABLE); } int dw_pcie_wait_for_link(struct dw_pcie *pci) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 58735fd01668..348e91b6daa2 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -40,11 +40,11 @@ #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_PORT_DEBUG1_LINK_UP BIT(4) +#define PCIE_PORT_DEBUG1_LINK_IN_TRAINING BIT(29) #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C -#define PORT_LOGIC_SPEED_CHANGE (0x1 << 17) +#define PORT_LOGIC_SPEED_CHANGE BIT(17) #define PORT_LOGIC_LINK_WIDTH_MASK (0x1f << 8) #define PORT_LOGIC_LINK_WIDTH_1_LANES (0x1 << 8) #define PORT_LOGIC_LINK_WIDTH_2_LANES (0x2 << 8) @@ -58,8 +58,8 @@ #define PCIE_MSI_INTR0_STATUS 0x830 #define PCIE_ATU_VIEWPORT 0x900 -#define PCIE_ATU_REGION_INBOUND (0x1 << 31) -#define PCIE_ATU_REGION_OUTBOUND (0x0 << 31) +#define PCIE_ATU_REGION_INBOUND BIT(31) +#define PCIE_ATU_REGION_OUTBOUND 0 #define PCIE_ATU_REGION_INDEX2 (0x2 << 0) #define PCIE_ATU_REGION_INDEX1 (0x1 << 0) #define PCIE_ATU_REGION_INDEX0 (0x0 << 0) @@ -69,8 +69,8 @@ #define PCIE_ATU_TYPE_CFG0 (0x4 << 0) #define PCIE_ATU_TYPE_CFG1 (0x5 << 0) #define PCIE_ATU_CR2 0x908 -#define PCIE_ATU_ENABLE (0x1 << 31) -#define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30) +#define PCIE_ATU_ENABLE BIT(31) +#define PCIE_ATU_BAR_MODE_ENABLE BIT(30) #define PCIE_ATU_LOWER_BASE 0x90C #define PCIE_ATU_UPPER_BASE 0x910 #define PCIE_ATU_LIMIT 0x914 @@ -81,7 +81,7 @@ #define PCIE_ATU_UPPER_TARGET 0x91C #define PCIE_MISC_CONTROL_1_OFF 0x8BC -#define PCIE_DBI_RO_WR_EN (0x1 << 0) +#define PCIE_DBI_RO_WR_EN BIT(0) /* * iATU Unroll-specific register definitions @@ -108,7 +108,7 @@ ((region) << 9) #define PCIE_GET_ATU_INB_UNR_REG_OFFSET(region) \ - (((region) << 9) | (0x1 << 8)) + (((region) << 9) | BIT(8)) #define MAX_MSI_IRQS 256 #define MAX_MSI_IRQS_PER_CTRL 32 From patchwork Fri Jan 4 17:49:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748731 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 76FF891E for ; Fri, 4 Jan 2019 18:03:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69843286F2 for ; Fri, 4 Jan 2019 18:03:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D072286FF; Fri, 4 Jan 2019 18:03:06 +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 D29EB286F2 for ; Fri, 4 Jan 2019 18:03:02 +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=ZfpqIjkI+meWrSZkyX2BiI/WMimrQonIEy7FSIgKUDY=; b=ArZmFZdOXFNW70 5vTm3D+nzYn2w1Ru8jCzCfxmv7/6NSPyIPyP9Fe1Md4mh2UK21IPP3414pnVxae643bjBWAo9dMwu AjOpOPX8gMcoJ+40cozSIF4/SiohU1C0j4dHD5k0cO0OC4zdusFSCzPqAz083Ls3qhJVU9Wf1RNIB VEs17iG+vn8DSEXRR/U/pXrAxMAiLPPnxzZON+hKMWA1Lai/JI5S0JcBw2z8Da0bTdTg/tq9mx6iw +uNG+nhsPrSldlwJBf6TpLWrjzQmx17fNTQz13iXnVzoCyK++AO/SsdHODEYE8g6t1poxegwRLeDe O22DMjNnReAmgAASaG2g==; 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 1gfTo9-0000HU-AH; Fri, 04 Jan 2019 18:02:57 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbk-0004h5-3C for linux-arm-kernel@bombadil.infradead.org; Fri, 04 Jan 2019 17:50:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xAm2jIq52pUhEC2sZCasu0hrDgVXQMY4yfjOEAVqYOg=; b=ZxaW+KgHS5LYpBKJUKNYe89Vv9 QkVAJ2vwJDwdeZR9mZ7OOJgC1mGtsGHQvi/FJHBvN8mlVM+eQxxioPVY9GynPguCtueAjsag/3YOW LlLZ+rBbRN47MnSCG3kmQhxmXonz/5soBJckZxncuScCSiGWogBNyGjfcnqFjA/n3PHWxyjAvJxmf 95f72Z/BaSb/f0pjGbWIlRW7nOFu3x1layG/0WQe5UnfZ8LzJUFrDaYEt9tDzyzjiXwHAVImx/JGZ Cj8U8I4q318hY0HAvTt5uuxOWo5qcOj/P7sEW//3cPxzyVAP3co6l69I+dSdM9qLCjSWZjBkFiha2 XJmQ2www==; Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbg-0004T1-PM for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:06 +0000 Received: by mail-pg1-x541.google.com with SMTP id m1so17784555pgq.8 for ; Fri, 04 Jan 2019 09:50:04 -0800 (PST) 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=xAm2jIq52pUhEC2sZCasu0hrDgVXQMY4yfjOEAVqYOg=; b=mMiOwlSG4DC/Fg65Au78ypOcmntahyb2RvO65PwPALy3W5u+zIqvl1kRo6cjfSVzAG C8XGHCWqRYNl3tZReBRxpTWxJHsgA9FDYpLUwN0j/Sb2anz6hfNVplUdlig/rOvq1SaF DcCmtLyUiT4k6779xkqnyIFkUNVCu7DnRqHBi1fUBaON/B59O0FHd3m/jvmUv/E68SEL v9xEyegM2PTVmL9v1vujXnMfHAM5HEE7lLrxKov2muITiK3+hjPAO/6FpgjgqgwlND65 Ap9cV8/YvBH1RqnWF0uaaWTbUE/l/HvA/HVnmvPSIG2LKC+D2RBMU4UOtLoN8om3XTKs WYVw== 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=xAm2jIq52pUhEC2sZCasu0hrDgVXQMY4yfjOEAVqYOg=; b=PkWs6A9f1suz5+29qbkZka5kwROVeloIvjAN2Ncyj3BXMmQMGSomrciiTyLkTFTlRL TyzlHsqnwMA1+c819J+0gAa58Mi+iSOP3dlMdpKff3kNT7xzNPfqMty+tWSeKhfr1emK Pv+2GakX6LIHm/7L9Jrfb9ikxq1cv/ky94VoGhuzMDiHnMNAu6xDP642z2ZwL3cRkN65 pKlB/zAnQOBNEmOHJyxTeVf1meYkzpI7JbmMUGgibpiyoqJNJ/WXItUDa6cnx2Rcs4uH 0heoGBmg9BNDWvUs+XEi21pwcXuOaSKxgoENYjNj8g+chRPVUSOA6bZ4dOp7DlfF0+gM 7bQA== X-Gm-Message-State: AJcUukfKD8K64rG2l31OtBhkN2Dsn7cHCIXORTij1Bf1rW4bshUfALrk SKKUdz1kkugJxfiHa+wvuso= X-Google-Smtp-Source: AFSGD/U8/aliG21Hl9OPuMY8e2lEDtbWolIemfd93+t+jlOoz3jIbHM1T819Xm5vLncIZ0Lj8YKbXA== X-Received: by 2002:a62:6f88:: with SMTP id k130mr52806398pfc.234.1546624202196; Fri, 04 Jan 2019 09:50:02 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:01 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 11/20] PCI: imx6: Make use of BIT() in constant definitions Date: Fri, 4 Jan 2019 09:49:16 -0800 Message-Id: <20190104174925.17153-12-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_175004_850211_0F79EBD2 X-CRM114-Status: GOOD ( 12.55 ) 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 --- 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 5e7fab089bde..180ba57da4e8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -112,18 +112,18 @@ 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 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 Fri Jan 4 17:49:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748681 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 A04A76C2 for ; Fri, 4 Jan 2019 17:52:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 927F2286AE for ; Fri, 4 Jan 2019 17:52:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86FF0286B5; Fri, 4 Jan 2019 17:52: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=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 0C439286B2 for ; Fri, 4 Jan 2019 17:52:30 +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=dmPZOKE1vFdSvPPGeaLj/SaX+Qdn/V4kZwGIgI/avyI=; b=qrRdCOcIKL+kl9 o/AMa9Z0lLBIKGl3xdtHdVFE1u1rIDi3iMq3tCUbjET2T3y9dGvDLtx2k8MWFKchh0HqmgtB2a2V4 EdjHDaZmrH9Ks91bquEJYIa1bC4wmnr12N0q3fDiDmsU+ZFkjZJvYKUMixbjiQIr3QWLgi2s1NPB1 rDX6WHJxsmLtbbTGj7PCNdEqTWQgiyv+yKbm8mQYSnhtHKeJ2rj7JfxcX/t1kpkp6fFC2bJ3aKzCT u3z9PkjuaE5sYp+1BKjAmGIY8ULwe81LMewUHp0Q9LmTUqCJ9MNTZbczzuGqf7dXw5qy4BZUX4VeX Zj3n46iTWsCPYN18Mhnw==; 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 1gfTe0-00084C-FZ; Fri, 04 Jan 2019 17:52:28 +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 1gfTbh-0004Y0-51 for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:31 +0000 Received: by mail-pl1-x641.google.com with SMTP id e11so17728338plt.11 for ; Fri, 04 Jan 2019 09:50:04 -0800 (PST) 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=w9KU/W4CQap2RK2hsRI+gNohsIozdtadfTJIN88KMTs=; b=Ub8qeaY7l5BX2LdG1ZfhbYVBmhPQMPROSTMWAoNKmswTP6VRDypf41vEOf9/56STcq Anh+omXnyVcUeLEIrOfIWiQOpWL3u2qSB6G99UYvPn8trxp217l6WKeCVGV0pxlsF8tj QSoBShRy22VYH5FAkjasJKoeqz4BM/GTA8uc6af0eYf9da0FswdPOz2tXikRe7CQ4eJR CUiWdp9rKeB9ZIrE+6Xb+o3OH5LTNkvI9k5S2mXTHcNHgHsxQUtz/DOYhK+uvWPzkZmD gsVhWgB3stIYSY7EDMWD6ilSne+FzxTdywtd3xV/fhXmnI/+1jcAgA8eys/0t4NhdWzI 1i/A== 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=w9KU/W4CQap2RK2hsRI+gNohsIozdtadfTJIN88KMTs=; b=qOPsOZSDXIe8LSs3pG4iRGMImnE5mgagTBVaaKQnwCjDKKlJv5RgsIXe9Jt2vE0geI xIJA/YKGmtCprkp8SflcuK3PKqcaE2JuUncM3IwgeZ1Ru4pUHc41n6pEWPVbLT8yQWA3 qVlw+tsHVehQGq5EXU5Xq0YTOnBD/YkYH693j4wJ0XX50rSJZD8zy48q2gBRQURRe6KW 47VAZzr2EFg9raG90C4GpDo2QN3ea/9GpbxVzv41z0mv9xov6BZOVHadokVoVNXndn8+ 9/7QR6lB+uCvdC2HRwMtUWANeTvLEAn9+2HwM1GfTjGVBNhYpXzeWYiXWP/GyPXeafr2 XJ1A== X-Gm-Message-State: AJcUukfqG0FbaCqhYSzOhwcyM2c0vpvn1k1uIKXEyDaWfqc7KXE3l59G JWo1ixcGUAVWNNG3OQS8uZH/wvmmBPU= X-Google-Smtp-Source: ALg8bN6gxG1OAvAuFAEIXqh5twg6wRoU+lumMTfjKcijYxQpWYiI8n+XqMJIwBM8BgFO/2q8sdi8JQ== X-Received: by 2002:a17:902:14b:: with SMTP id 69mr52373171plb.52.1546624204331; Fri, 04 Jan 2019 09:50:04 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:03 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 12/20] PCI: imx6: Simplify bit operations in PHY functions Date: Fri, 4 Jan 2019 09:49:17 -0800 Message-Id: <20190104174925.17153-13-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_095005_805188_100C4E38 X-CRM114-Status: GOOD ( 11.85 ) 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 --- 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 180ba57da4e8..672332483324 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -101,11 +101,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 @@ -152,17 +152,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); @@ -180,7 +180,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); @@ -208,11 +208,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); @@ -220,7 +220,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 */ @@ -229,7 +229,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 */ @@ -238,7 +238,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 Fri Jan 4 17:49:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748683 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 E92176C2 for ; Fri, 4 Jan 2019 17:52:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA821286AE for ; Fri, 4 Jan 2019 17:52:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE0A9286B5; Fri, 4 Jan 2019 17:52:46 +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 711F1286AE for ; Fri, 4 Jan 2019 17:52:46 +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=L0yzBWFZ3XBgbvN/rMWCJvU+5OEkrUSYPRmkMAn4050=; b=TBATgsyibXbVy3 dK8ZvRlyYN9JW20Gn9HQHzf3PLSp6iC0QNM9wM2Wziu/yiS9737OyffL/xr/ijAiblmkfZrDfnVLu k4znvioGZ3xtxBmF+ecCsC2pnzTmE/tEfuB1Ehb3IY2tfF7ZVTaJQ2QTITi79Tr8QZGrx5k7BhmR9 o4sAfTx7ZRvHtpofkelNYgh4to6QNxonglLa78VLIBorZAEVXNqGXeaMzknDMRBGqag851urQB1BS Xi9SMIxNHWbZRvF2aNNTKYwoiMUnwI/TK+mdBWcDETbqeQKjDIBrPFOWcAzJ9RbcfjMSvqxBIlgtA UE+17pYIBQR7vv0uRYHQ==; 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 1gfTeF-0008Oh-3D; Fri, 04 Jan 2019 17:52:43 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbi-0004eh-LO for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:36 +0000 Received: by mail-pf1-x444.google.com with SMTP id h3so18633719pfg.1 for ; Fri, 04 Jan 2019 09:50:06 -0800 (PST) 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=GIZtkIt7F6fxURYaK6v1S5ghisv1YvKa7oaIjfa51B4=; b=RbIy6QxQ4n6nLxPbvAynBbX8pf4uJ3NYcuGkNvB7KF8kscdYTdyKmRtNArPL2pDcSA iTQhHQ0y01l4EQ1Vi1g8EdSB2ORRoI4qVgtOEehGATgzveaMve0i3uvUkyGua+1impAp z7wVNs9/xNj8ZRp8BHTrPX8jVaXgc6ilSMzKjB4ME2ibriLmPWbzbnO9Xod9UH7Qp+rm jSFg706OlVopTyG8KdrTFVkQ1FHKblrb7x9YtVpMng5TTL5DXnpvRhjoBSk54mgJ9RxT gDjcfNdR41pZHNcgY0/EKccsyg0FEXnUE4Fr4FlSaHVfotexHSoyh2V5rLKFH7VaNZCa 6jcg== 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=GIZtkIt7F6fxURYaK6v1S5ghisv1YvKa7oaIjfa51B4=; b=sOQQkNyIyoylhLan8SaZRGzKpKOrRqjw6MLdYOch4NfcAWoLwY7mS/+9vmUBEvhBBn HZSu/l+awf5PCYt/r/IsFiyk1EsQ+kGaOUpxJeLF+/DBe0Wug7CJ8oIhR2YGG4tjAqdw 6rG8Dd8SkflR77r4XpxDQqGCNRiPMr85yGQ8WnM6LRFWWB8oFA7eYjx6u1G55wGf6gm+ WOBmbP6oO1MiztfkQ6jb66hS7moFyoVLVtDvUzU4G3kYEapRVxJHbz7630YM7eeT1qHU NyZzYAmZF12YZ6KWifQSgmtlB8MbsUJs4AFYrRYOcOC7LWbGwkS11zxtsrtmsExiY0Gy vK8Q== X-Gm-Message-State: AJcUukdVcytkaMqwqeXOnxFk6LO4f3p4VV8vgDcgKVTHqO60nX7UbGv4 kXYcJOMH9fghYU2qJaLlyws= X-Google-Smtp-Source: ALg8bN5jrhYevzmE+NEUJvgXp4+NCs5ehGhkPFepwPChUleu0X3pnfm/f5l65XdV6q4QeM5GgnVf9g== X-Received: by 2002:a63:3703:: with SMTP id e3mr2397705pga.348.1546624205986; Fri, 04 Jan 2019 09:50:05 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:05 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 13/20] PCI: imx6: Simplify pcie_phy_poll_ack() Date: Fri, 4 Jan 2019 09:49:18 -0800 Message-Id: <20190104174925.17153-14-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_095007_814905_FD532DEC X-CRM114-Status: GOOD ( 13.92 ) 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 672332483324..2a7075a9cba6 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -108,7 +108,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) /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 @@ -125,16 +125,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 Fri Jan 4 17:49:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748685 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 802436C2 for ; Fri, 4 Jan 2019 17:52:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 71C6E286AE for ; Fri, 4 Jan 2019 17:52:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6459F286B5; Fri, 4 Jan 2019 17:52: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=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 17D76286AE for ; Fri, 4 Jan 2019 17:52:59 +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=RWMBBbkxD7bWZ7X1W/G9BxMUeityygEpTbosj7kAQSo=; b=qKLRLdOjhKkHpO JDCNyRUVfWwJpcE24jGEervVrIUZX7KmPyJA9vRz3EVo8O0iQoemuA6RiVKB4Q78H0Mn+H8keDUcc +z86HE2O2JsYW02csT8UTOyA72wMhlnTv/20L6viA2QuXg0UV5QmSydRPVbfFGqtmvbZLwTWzO2gS Ct4DRks1YTcS2hus7IRl5ODNP6+mYU7QT1npXPEcvtGF4D5D8pE6CWrf87GxrnAf0rNj1SGyfPwLy FhEyEhf0FoJhuhKk0rJuSLiP8w4yJiIiFp5kKFf4G6jkrYCOC/h9+aMbW+zfUnYc5DRm7UW9PdlKO rXrybq7Ujn3EE8qiVD5A==; 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 1gfTeS-0000Br-G0; Fri, 04 Jan 2019 17:52:56 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbk-0004kJ-FX for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:44 +0000 Received: by mail-pf1-x443.google.com with SMTP id g62so18615090pfd.12 for ; Fri, 04 Jan 2019 09:50:08 -0800 (PST) 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=l5Ov7DgLo0x+QhZh8MrjSzuZLAXS/elFdRJcT/iufBQ=; b=Z+x2Knz6I5ntkAKsqCwQ9anK0XjHjRnyoafbwABQO+I7pDLITu4um2CPX2i1Bckg6v 29Hh89TWOMYuvDjF+SUnwxxiFpptVU8xpnaxPHB/LFhUOAEHkr37M47CbH1XyoLDokRz uC7TfNtUpsaZh62rmf+rmbT+IF60xhv0/FjsFgkgAYaYoY0ShTPmCis2MPCFBsvQnEd8 gr6oPY1yKgev0dck7068HdqsS2bdNFzGKpt7Jn/Ailm+wrk/JlqWSHMI3mJ/VzaJxnSt HwP9NmJe/nY8wP2lhdvUBwjZKKkOMfRnLTpBUdqngwJ7ZcL4OIXFncAukcyntFifsoTK EuMw== 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=l5Ov7DgLo0x+QhZh8MrjSzuZLAXS/elFdRJcT/iufBQ=; b=AoBYZqMjs4ZDCg157LQi/b75XQi3xZToO2pEgkoRR3m2Uyts9Czpk0eEyyDpOjyhnv SijFZQTHZVYCMzsxBgMeY4BmAjUvdmtwUnxBsth4+yq1FUi7LgPMSLIv+L4Cy/kzUuXP 2sbFaGZCyUocef3nvD9eWiR/jOKv6Maru5GE+HuAhJrrXMmlF16ZopcddA831HPeuA8w pm3Gh8ubyN9N+1SZLNTetgGmdgV22umJuthlVdLvpfykeqqVH5i22hrR2HYVX79Pp9Mb PB4XwOGeviUDUtuDunNP/9VCTeOO2W5ia8J3oNCp0jYjDf0j4qNQREMmXnF3oPdGRHqo RmPA== X-Gm-Message-State: AJcUukdh8Ic8ME6znai94neAZ2YTuPdyTHdCA/e1zOZP+tnVLk8IMJ9d PxRgJ7grgJTOKQkqHaB5TdE= X-Google-Smtp-Source: ALg8bN7BnbCyiCZzhA0J1wCL/o1gaSR4ShCULsxdY5pRgwbfRrYr+yjjrTRBrpw6u9ccj+3j9K7Vwg== X-Received: by 2002:a63:2c82:: with SMTP id s124mr2385458pgs.73.1546624207694; Fri, 04 Jan 2019 09:50:07 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:06 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 14/20] PCI: imx6: Restrict PHY register data to 16-bit Date: Fri, 4 Jan 2019 09:49:19 -0800 Message-Id: <20190104174925.17153-15-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_095009_253591_6D7A3BB2 X-CRM114-Status: GOOD ( 12.84 ) 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 --- 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 2a7075a9cba6..02342b1762fa 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -169,10 +169,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); @@ -187,8 +187,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); @@ -196,7 +195,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; @@ -253,7 +252,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; @@ -620,7 +619,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 Fri Jan 4 17:49:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748687 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 3B62313AD for ; Fri, 4 Jan 2019 17:53:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2D318286B2 for ; Fri, 4 Jan 2019 17:53:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20A85286BD; Fri, 4 Jan 2019 17:53: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=-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 C5FCF286B2 for ; Fri, 4 Jan 2019 17:53:11 +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=jT67gFD+njNX2UhqJ3p7sbdG8rKNV2QFBAesWHz/HwU=; b=bSsNk26zUBvjXp XT3mmcjWJI9fexD6CV8bejdofXSwrHcLss1pFuvQsdKsL0r17fh7Ug4PdzT3D5ZH6PSZSmwM1H3vr nLMqKPeWprERg5QZ/PDaR1Rfl1GXEZdc7j4j45ZpRR5YwcQ7TUy5aIi+An8PImMe0msp33QE/tO8l uFfYytdOL/dw5dODbbFXVD+JAwVNgyH9XyBnoAO1Z2guFEzkNE5rAzwOuqvvhh4R8oy63vIzpjlF9 F3i0P9kLt9RZj2RhJ5U5HNLRp1dPTmnkOEF1Rz76JW/QO5aKlPzU4WqfeqNN3qii6R3vpRDxNyA4c MFyKF6qnIo6B4IVXQJ7Q==; 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 1gfTef-0000Qc-Lp; Fri, 04 Jan 2019 17:53:09 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbm-0004sf-Jx for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:46 +0000 Received: by mail-pl1-x642.google.com with SMTP id z23so17737849plo.0 for ; Fri, 04 Jan 2019 09:50:10 -0800 (PST) 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=2ynqU9RdFevJBXRMN2+g/v2PRS5HmTSTnfcgRpzk4u8=; b=Yxm6kEFjm2RkQF9s49Wl9lpLEKQaWCgrgGzJK5R9UHJS1UVgwCfVpbBNj348R2XrVH vCKcWseU0/+SDTW0SZCIQnfpwsLSPhFicU+1miWDTDv2N66o0oUW66Exns97ffW+qrfw RMf4fsveTwbB6IsQfIdhNAXuG6oduKU6iSd+XRY7PHg7obcSUgVAuy0yZbDag9KtjSWI +St4d34B1pyzcoTEqfExqV6SL8H4dXFEe+Yv66NljD3ZMlSUIpGTv0/l0B8NjVXA6vmB O+trOHSZ+k+E8Bzm7hX8+fd+d5A4GoWUzwwnWqL4aIxl0VMuts8wPyWmv55CRMoWYIan yM+w== 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=2ynqU9RdFevJBXRMN2+g/v2PRS5HmTSTnfcgRpzk4u8=; b=XMJzo0+E5Ca3y/wzSfvEjF27Rp8yrE9OJ/GPG9yAlGbOQtoBgo0H5dq68tNBkgkk4F sjnYGg7jdo3A4I3sXdXNEIi+nbTO8aybpvGcciQKYqnTP0n3hnQl6iRlkzkCtHSXao6O sc41ReVVsDFjgx/hyQBwLS54hP2bppw2AQgAlz1QbZWU7aUNQCJsZAfgI6lxHpfMKkfA 8AvEOUQnlRSUKoGDSsSpiNv4A2U/0UIqFGT1qE4rq3rVdn2o6uX3gC6CxNCV3mh1c9xN ipbCBJmaXrIRDavU/MWIbBhOqv9A4L2O1Ag0hrJ+lTQ/UOyPB3QXw/GCgpDXNIZdQfyW Kwzw== X-Gm-Message-State: AJcUukft+W5W0+X0w1hX4lYmxZsropvlXtH35SRQl75CIz8wQ41vcPBn 08kIKk6NYAJen3ZInKnCb/Q= X-Google-Smtp-Source: ALg8bN74f+KdjZLhDwczdKTH2whSmV69SzJxJ0xGAw4m/5SP+7k3rouC0lpqbaMiEbcPeqt+HnovEA== X-Received: by 2002:a17:902:20b:: with SMTP id 11mr51889493plc.57.1546624209871; Fri, 04 Jan 2019 09:50:09 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:09 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 15/20] PCI: imx6: Pass data to dw_pcie_writel_dbi() directly Date: Fri, 4 Jan 2019 09:49:20 -0800 Message-Id: <20190104174925.17153-16-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_095011_194251_51DC87EF X-CRM114-Status: GOOD ( 12.35 ) 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 Save a couple of lines of code by dropping assignement to 'var' and passing constants as via function arguments directly. 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 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 02342b1762fa..befbc09c9c41 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -172,7 +172,6 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) { struct dw_pcie *pci = imx6_pcie->pci; - u32 phy_ctl; int ret; ret = pcie_phy_wait_ack(imx6_pcie, addr); @@ -180,8 +179,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) return ret; /* assert Read signal */ - phy_ctl = PCIE_PHY_CTRL_RD; - dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); + dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, PCIE_PHY_CTRL_RD); ret = pcie_phy_poll_ack(imx6_pcie, 1); if (ret) @@ -219,8 +217,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return ret; /* deassert cap data */ - var = PCIE_PHY_CTRL_DATA(data); - dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); + dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, PCIE_PHY_CTRL_DATA(data)); /* wait for ack de-assertion */ ret = pcie_phy_poll_ack(imx6_pcie, 0); @@ -228,8 +225,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return ret; /* assert wr signal */ - var = PCIE_PHY_CTRL_WR; - dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); + dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, PCIE_PHY_CTRL_WR); /* wait for ack */ ret = pcie_phy_poll_ack(imx6_pcie, 1); @@ -237,8 +233,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return ret; /* deassert wr signal */ - var = PCIE_PHY_CTRL_DATA(data); - dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); + dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, PCIE_PHY_CTRL_DATA(data)); /* wait for ack de-assertion */ ret = pcie_phy_poll_ack(imx6_pcie, 0); From patchwork Fri Jan 4 17:49:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748741 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 4EF3E6C5 for ; Fri, 4 Jan 2019 18:07:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40F4D285FF for ; Fri, 4 Jan 2019 18:07:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 351EE28706; Fri, 4 Jan 2019 18:07:10 +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 D58D6285FF for ; Fri, 4 Jan 2019 18:07:09 +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=xdlpOcWFIYKPokEbmiC7jyBTluftCQ3TaZiiHEC5kXQ=; b=OWfoXMap4RVs5T KgT12fBQDRyuX68ph/gawWqi1hLDhox9/oIPHKDUj8gyEfOCvFNmM7y2AOL0MrtarbCM/wXr7xbBZ lQSX08sabKAd4FQwp/mXDxLR/jFX5QUMlDfvDzFowV8kXYJhu1GVI4rws7r5XHjcKuXQ9gi5+JOiB wqXnJyb1UNATf/BXXs6kEMn+q9n/DJQPWn8RNt5XbP7YQTkjCmdMo3UyDWZJ+z08AUdzEALMErz1b SGpyZzVQqdgl+vlNhGXRoAadsqaoDVii1VsPkiS+dBYZn0qiDXmRvLOLrwFMHqYHwbnqyUDmbsDo7 //ET6UeQs000WkGiMV5Q==; 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 1gfTsA-00030N-TS; Fri, 04 Jan 2019 18:07:06 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTs1-0002Vg-OG for linux-arm-kernel@bombadil.infradead.org; Fri, 04 Jan 2019 18:06:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wgbDW5dpUQt98rEUFIyBYJEI6ndB9gcDqUzY7mel/6s=; b=u+UpNPMITZLG2P9ldkG9FyU1+s zUnZ9IqUsZEDsL5LYWMNOA3rupK7i3l+kaEpn1H7TESxckYkWxYs5ZbrUcXDD/2r0/ys//4fBgNfM W+fl82dMH1HfE6Aw/46lWMPaBriwlTmT0U/ZlX27ky3c2UA7rxw5SYLZ9UKIbj8wqIn/wCvON1IDN Ku40gzwBa/cAJeK6eEVIt8/N1le32aSmjdvpyZlgUUFuPG2p2APD26SlBeYslN/IaLVGdcKqlsEn3 smgHHUuXn7NChQQUT+7bf82R81YlL9tIhkRN4QjR3GA01Q4oq0laYkQ617e6GKPm1tiF1rfYKfcUm sn2s3S9w==; Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbp-0004UK-H3 for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:15 +0000 Received: by mail-pl1-x644.google.com with SMTP id 101so17734000pld.6 for ; Fri, 04 Jan 2019 09:50:13 -0800 (PST) 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=wgbDW5dpUQt98rEUFIyBYJEI6ndB9gcDqUzY7mel/6s=; b=iEoo1a/OKkKJZtfMoSTJBNRwLRmxHYiy5BELr0ZahkEJGPUnWHwAwbGSGWVnA2K3N8 DWThaSV1BEmfcBxiAl1ghAgv91foOjqkSX4pMTvTNUCjzCLNrdOz1weDJPulXHqesjzh eo5y6w4t7zvPtU5sktiCfCu1pXpsRxMjWppuO9SHLgmgKT9gXL2SX8Wfj6adxuE+Rugt GNg31n1h4+XGXfq7q7scRS3JKuR0gATy2gkluOWZDDgVBnj+gkDP79Tcl6mcoJ0SV7QR 2uJGVeXBm/wDHSiTwgvW5dPiDfSObElXccqjn1ADPmRyVU/oijZ3B9efIS2HA31eCYsK FvuQ== 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=wgbDW5dpUQt98rEUFIyBYJEI6ndB9gcDqUzY7mel/6s=; b=YXv4EkWG2QQtDX6OgI+MhHHS6Ni3uctPY0dYzkNj19OqhDawT1mgNkmSP/okheqHXl 1zjNJymLxz+N8ua4sX5ysIMVGvWYQeWUDGV1OnGpPGCz4ojxzRctmwGk4fsJOzUCVwJA Kgi7iQQJvW2ghhpEA99PkMPoaQQpAFgr0wSPzDo/UaP0xuHMs4hrjPMCTrDDOWh/Qe+W lo+VMwsyVc/Yx1iyyGdHshGZCzLIxfYqusmdFMrRp6CrEOQI7QKKdIgvyY4z5bo7Npiq 5vG3ttadA49NVZqio0bYMIGaiyBhZ6haQGTLdYFkeIPSOxgCCnXeAfiuyVR8tBgyka8/ MJCw== X-Gm-Message-State: AJcUukddL0i9WwCmMkyTZJu4YBtLjM2i4E9rYYTn7HJrlOs/s+6AAG27 VJFxauUcT0ypOr7TwYL+rj0= X-Google-Smtp-Source: ALg8bN7DWXymiFDJPJKMM8BjkzXwfxTzSSAkZlFhar78VPcv/On4+5l+ipcw6E2WWjhb9eRrCzZmFw== X-Received: by 2002:a17:902:2a66:: with SMTP id i93mr50874325plb.113.1546624211721; Fri, 04 Jan 2019 09:50:11 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:11 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 16/20] PCI: imx6: Use common mask in imx6_pcie_reset_phy() Date: Fri, 4 Jan 2019 09:49:21 -0800 Message-Id: <20190104174925.17153-17-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_175013_597046_F6834530 X-CRM114-Status: GOOD ( 12.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 Simplify imx6_pcie_reset_phy() by using common mask. 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 | 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 befbc09c9c41..130f577670c8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -247,21 +247,21 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) { + const u16 mask = PHY_RX_OVRD_IN_LO_RX_DATA_EN | + PHY_RX_OVRD_IN_LO_RX_PLL_EN; u16 tmp; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return; pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); - tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | - PHY_RX_OVRD_IN_LO_RX_PLL_EN); + tmp |= mask; pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); usleep_range(2000, 3000); pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); - tmp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN | - PHY_RX_OVRD_IN_LO_RX_PLL_EN); + tmp &= ~mask; pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); } From patchwork Fri Jan 4 17:49:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748689 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 8F9FD13AD for ; Fri, 4 Jan 2019 17:53:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 822C2286AE for ; Fri, 4 Jan 2019 17:53:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 733C1286B5; Fri, 4 Jan 2019 17:53:26 +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 27F7F286AE for ; Fri, 4 Jan 2019 17:53:26 +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=64r+i+n59/ey+vaM+vGKMb6tn1xSx3fvxvrrB4bKjB4=; b=rmKjfYqVmiChwc E/OurynZd+P/56H1p/H7biFIycbGlDQm1IuysKaZSkBRWZrFL6wjQQ82zPoKzJY3S1AiLzMLiRB4S 6EJTXPBIZh0WzuCv07O5uaqOLpr7qN4ah0X5I/5tLayklPInv+plZo/dnHERFLeeq07p4CQDzcvtr UZY/pc4MBUnVKOynViXiI1VYW1AFTidnts4fX1X8HPOJ8/wV+wCrnmCNaT7uIczxgeSjcW2b6gfSz SqHVNnt8cj9BhSvoCazAXDAJucLMAUSoN7J3X23UcLwplNHDcVKzZjAuGW7EPvRQ6mjaMVnEudE/g s8j5Sc9xvms63yLEZc7g==; 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 1gfTet-0000fV-Bs; Fri, 04 Jan 2019 17:53:23 +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 1gfTbq-0005AA-As for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:54 +0000 Received: by mail-pl1-x641.google.com with SMTP id gn14so17739537plb.10 for ; Fri, 04 Jan 2019 09:50:14 -0800 (PST) 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=smdD9M2YSE1AOghnOpWt9rwK4kDd0JsF0HnKCn2DuJU=; b=odqTjkGm12K4IG7dhiJR/Ldk4BrRbMGJwKZ5NN0FMikHY6exsnheg/PUKCX4tP/ZhO 3OK8vBUSevmn55+OSq4+JSTdbaCmnMHVuFJXMrecrW1FJlRIGC0s2sxuD7v6ABcIqCz8 zge2uOu/5aItwK/nFBEluYgZTJkQn+Gry4X2RRxlbLlYE1E1Rx7wMPuhQXu7FnHEpPzR 6JcFr1VcaJJt5ed6yiqF+isMKu7jGWAiaJ4+RbgVmYOv3Y8IVCsUYOtZIlsWCrRPhx3y OANpKALDhlvo9X4nwvaJCniSuD4gR0FQ7yNQSxWh/8mlIFvMewVj3JQ4heyc7upI/oj/ nlRQ== 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=smdD9M2YSE1AOghnOpWt9rwK4kDd0JsF0HnKCn2DuJU=; b=ujeg9gWN54oXoGJYpbWqqRqaaKKccXAMxG8qXfcOHMZyFFA0skBOG/dxTFO59XJE2H yWgV9tnWTXDEmCMj1uvwvdRxvNl8p8yr+pA4kX3lAuD3V5YOfJ76yzrl9BYcBM+ANZL9 zFnriDe2jnoId3ADND7asf5W/RHaiAthIUxg73Vi33nOLssjk9S7DGoNYp8kcDG85S6w FVBf6I74GNfOk1P0CeU0ew3leYjwSXAHPmDooXbHvO1ye2rdckmc4QTsQPm1PbEpbvNq kDVFt3v9/aYvMLqCU3qigFNzMI4M8kbODfOJ4hm4XwC1rOevgMSIQPG4FLxBTPilUpYp f60w== X-Gm-Message-State: AJcUuke0ZlFjaFH7F64AJ+/KY66Bu49tjU0I9k45f8DyTdUzFtI4Nkme qKq8L9pfNSgCU+D8yyt1sREP5jPGHcI= X-Google-Smtp-Source: ALg8bN5qQdMltuObfh6awk76R3n49OZJYHiTOTK09WcJejGUwexLIMohtoIHao0UtMQAlWHg3BT+TQ== X-Received: by 2002:a17:902:8306:: with SMTP id bd6mr52122019plb.217.1546624213731; Fri, 04 Jan 2019 09:50:13 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:12 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 17/20] PCI: imx6: Simplify bit operations in imx6_setup_phy_mpll() Date: Fri, 4 Jan 2019 09:49:22 -0800 Message-Id: <20190104174925.17153-18-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_095014_657560_1EB44A98 X-CRM114-Status: GOOD ( 11.20 ) 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 bit operations in imx6_setup_phy_mpll() by using GENMASK/FIELD_PREP. 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 | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 130f577670c8..d8aef9da476f 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -113,12 +113,10 @@ struct imx6_pcie { /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 #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_ATEOVRD_REF_CLKDIV BIT(0) #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 GENMASK(8, 2) #define PCIE_PHY_MPLL_MULTIPLIER_OVRD BIT(9) #define PHY_RX_OVRD_IN_LO 0x1005 @@ -641,16 +639,14 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) } pcie_phy_read(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, &val); - val &= ~(PCIE_PHY_MPLL_MULTIPLIER_MASK << - PCIE_PHY_MPLL_MULTIPLIER_SHIFT); - val |= mult << PCIE_PHY_MPLL_MULTIPLIER_SHIFT; + val &= ~PCIE_PHY_MPLL_MULTIPLIER; + val |= FIELD_PREP(PCIE_PHY_MPLL_MULTIPLIER, mult); val |= PCIE_PHY_MPLL_MULTIPLIER_OVRD; pcie_phy_write(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, val); pcie_phy_read(imx6_pcie, PCIE_PHY_ATEOVRD, &val); - val &= ~(PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK << - PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT); - val |= div << PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT; + val &= ~PCIE_PHY_ATEOVRD_REF_CLKDIV; + val |= FIELD_PREP(PCIE_PHY_ATEOVRD_REF_CLKDIV, div); val |= PCIE_PHY_ATEOVRD_EN; pcie_phy_write(imx6_pcie, PCIE_PHY_ATEOVRD, val); From patchwork Fri Jan 4 17:49:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748691 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 35CD76C2 for ; Fri, 4 Jan 2019 17:53:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25061286B2 for ; Fri, 4 Jan 2019 17:53:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 154BC286BD; Fri, 4 Jan 2019 17:53:40 +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 9C279286B2 for ; Fri, 4 Jan 2019 17:53:39 +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=dul4Y0xidthA9WYd4vzqgRjbt+vkANeBhJ9J9GRSSXE=; b=Kqi+vPJXYRlTly xqlfpKHpRgNw+OhAX6a3p6wwNfROyzP9+C3T3g15rVlGQhgw2CwNhjrO7/d23xUvIE/iz9fvEixwf BedXnGeeLP90cDdsIeNYBWxjCBxDkOBEHJzrHLBGf/Fg85+ZoE/3tuK99abTw9nfSzFSQUqr6ZP2g 1fcGDxHk8tUhBYcQ0wioizUJaN7aG5cb4a0JpZhGcOr3DgX/L2mhhQ6DWQdROGvqnYi5SpbidmlEC dV01cXChCxm13T+a+gmaMkZ9go2bySfFSZB4wCGpWWaJOAHhcxY68+YBQbHPMYpk87HE4cRl0fIGR yMMXamEatG4C1BdJYYVw==; 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 1gfTf7-0000uj-Gh; Fri, 04 Jan 2019 17:53:37 +0000 Received: from mail-pl1-f194.google.com ([209.85.214.194]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbt-0005JO-0N for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:55 +0000 Received: by mail-pl1-f194.google.com with SMTP id t13so17718796ply.13 for ; Fri, 04 Jan 2019 09:50:16 -0800 (PST) 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=UaA45DYiu1lBKpFMAL9ysyx77C82thANkIMXH/mfBAE=; b=Bs3tzkr/uZcCHPaZu2HC5rYTi8GL2xZCuXOZqzuKLivxSlZKMduu5g57xFjts444WS aLTTJjrYRcQxVpLNnfPQt6OAoisHm/NSpTJyfXH1d7PytSHs27GbyRNl8SujipOFhyjJ NnYUlQHLxMA8ZgnFhxlLbO/haYwJFygVbnASjw7l9I68RaR3h5MyZOhTAKG4USmh1gRP ygOOi61RG7LOGat1w7HY23N82Kqk/IV+4VnGyP6ZkLlIFadq7Wf6ag4EMlfirn8HPMh0 XbJe22qc5MXA1xr4f2TLR+/SemO5mZu9d9crmelJJTrHpoYR2hGIJ+Z8fYPjnxrQrxpe mvPQ== 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=UaA45DYiu1lBKpFMAL9ysyx77C82thANkIMXH/mfBAE=; b=RHzvpoBHhGb+BUeIfcm6XxPIReKBPttQqJbOv/ytnCJSKHEPrffqTTXmN3p82yTwIj WX2nCm0o84rDX3b3WLn5LvnFyRv6XXQONaYwS66Hk6smhfedCuAJ7H7/TOjqsOwo+Wd+ OTTnnaWDt5DZV38/j9G2RFSZnuoB7vA1Q+h0z2l3AFyyVD0de8gDEJfN54xEEQb+tkfE efQakBpmmLU0kLtd5spJD4jfrSPohIgQ+QaHrT2b1haO8E9qMiLwGK4GpOXdYF0r4vvI n50a5uobMxeCQbK2TdANBxm/53+QpqmpJ2qH+ZbUSTuDZfXjnM7OL0vN+ulfz6dCcjGj 4olg== X-Gm-Message-State: AJcUukfdx511cAIOmDI0nr2TW+RxnbiCjmo8RA/ojDWGAfLxpXlcsX7H RQwAlPQLR/L+V6YWxG0S6D4= X-Google-Smtp-Source: ALg8bN6KeuZvj5+hH6fAqcxHS1bkhdDruLVrs8+ZmBPnURzylt69qWEgGUKtUB4UE4vpX1xHqF/LzA== X-Received: by 2002:a17:902:981:: with SMTP id 1mr50372962pln.142.1546624215901; Fri, 04 Jan 2019 09:50:15 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:15 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 18/20] PCI: imx6: Remove magic numbers from imx6_pcie_establish_link() Date: Fri, 4 Jan 2019 09:49:23 -0800 Message-Id: <20190104174925.17153-19-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_095017_813499_2C60340C X-CRM114-Status: GOOD ( 12.12 ) 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 Explicitly define PCIE_RC_LCSR_LINK_SPEED and remove magic numbers from imx6_pcie_establish_link(). 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index d8aef9da476f..f2aca339e9b7 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -96,6 +96,7 @@ struct imx6_pcie { #define PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK 0xf #define PCIE_RC_LCSR 0x80 +#define PCIE_RC_LCSR_LINK_SPEED GENMASK(19, 16) /* PCIe Port Logic registers (memory-mapped) */ #define PL_OFFSET 0x700 @@ -766,8 +767,9 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) dev_info(dev, "Link: Gen2 disabled\n"); } - tmp = dw_pcie_readl_dbi(pci, PCIE_RC_LCSR); - dev_info(dev, "Link up, Gen%i\n", (tmp >> 16) & 0xf); + tmp = FIELD_GET(PCIE_RC_LCSR_LINK_SPEED, + dw_pcie_readl_dbi(pci, PCIE_RC_LCSR)); + dev_info(dev, "Link up, Gen%i\n", tmp); return 0; err_reset_phy: From patchwork Fri Jan 4 17:49:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748779 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 2B7786C5 for ; Fri, 4 Jan 2019 18:38:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C1A528669 for ; Fri, 4 Jan 2019 18:38:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EE5328675; Fri, 4 Jan 2019 18:38:06 +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 90F5528669 for ; Fri, 4 Jan 2019 18:38:05 +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=t3xbhva58QNmnG4J5zVLkm+6N6wWM1PuogtFVMWbduQ=; b=ICfdtgeTWNsBQ4 AgMjjKwNGQ4Ewg8HCxzSV5hyAvRMm6zeoRvNz3doZJNwGe31HALiEtopkkLdsz0tEjRoPfS85R+2P htUJb4SlUeVfd7X8rgen9vv3pSleq4MIG5JMZSfxoTldHkQU6f4lSSF2bo0clOIuX9jxIyXPS05pP Y5zbLhwMfyFvPPfhrA+UXfvnbw8VLK/4yfba91Oy8s5QYEUXM5hzl5EybwV6IPi3IIRKrHDoNHPba O8qnWKYUlbx6OSd+4xVf4dWHx/USPbSwtucC5hK0Mqsl4njIrbAxs3xcAkMI4BKVBvNN2YzOwNN5K h3zTQBr1Ku7j1jMGfqUg==; 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 1gfUM8-0001Lj-9V; Fri, 04 Jan 2019 18:38:04 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfULe-0000ng-8G for linux-arm-kernel@bombadil.infradead.org; Fri, 04 Jan 2019 18:37:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ov2inzM6fmFsHxVXZyw47G5jAGapuFYmlo7Z2pYF+A4=; b=dujIBNp5gNSDjQz9yjSKKSVIw7 AS4rxayD0Zbo0ygseUpSFElH2gKhkxroYddvkLqLKR+Z+v3p8NFjRmdrlebhMqfuoOA0ZyMhd1Re8 KR32kl0ribS4884UzpVLiX/rSeE8ybgflKYXnoG8dwtkLblvEE4TGHmJGnruxBjDx0QxNrtJatX8l gye584hBhJe9hHO1P5lwRoZoS9A27Yhn7yE6Pt2mZOv40eJI19r49O9ExSby1m8LM4WhIHs9PeXxH ukHWjeSuCoEzlRHm4TRFdnriklaxEvYKNqNwmB4HPj8cpOfbekC/tWg7+Ckx93JioASS75cNE1GSC zi9mCfbg==; Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gfTbz-0006DY-TG for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:50:24 +0000 Received: by mail-pl1-x644.google.com with SMTP id z23so17738021plo.0 for ; Fri, 04 Jan 2019 09:50:20 -0800 (PST) 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=Ov2inzM6fmFsHxVXZyw47G5jAGapuFYmlo7Z2pYF+A4=; b=NSDrUz1+OyzaRb50gRYowv+DmQFRwrYEXrwcexaVdgpbtm2OcCQH/c6IsvgxnNbUQV SQnmB0ervyPs5xksbILe2uICoHmidWtJwA5H2aSuVzCNH2SnOSQAG9JA+m/FQLPV+R2d BWu0VNNM4KYaWIkv89pXgIjtQ5sqARb4KvuDe39Zr/GX37GyEyLcdWgUrgRAXHmUZWav WXHC4xgs1eMbwmJmahKuHVMHa7RCRA4CsIRoFR+XJEGBlNy0Tr6d2+HVQJ15EG3dhgKx fd+3ru78xYV8vf/pv1+yvVtpnzKqIyoA9+I7oxfxUvQ+8eNm4GzUD5R8A8Xd0sSTEP4k XOpQ== 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=Ov2inzM6fmFsHxVXZyw47G5jAGapuFYmlo7Z2pYF+A4=; b=nJJKxu/PYC9whIBVvA4mvmZ/wOOECZL33U9GvvWYu3+iVaGBfEgM8+e5dkh2K8LRW3 IZXWUuuwc2j5f4kumjC/nZAVgAymSmU1z5Fq/alXsENx/kmZzEhlVZk0738H7pEy77d6 iSvU9YEVfnhCjkeK65mhiXBPU4exE+J3bGjP033h5HjKcGQAbLBn2T+kJWK6nMpiO2BN OvTRkmxPkDNkXYMNhSy882hG8znsAFHr2yX2aH+FEWFIIdhXKOdMekJomwbpVeiKmRXS XdD4haVpBDSRPhiBjfNS7ZSoG700YZaJjey+Lq4y+spao2ytKrjtdsIln2cUJMT2NZRa AO6A== X-Gm-Message-State: AJcUukckGlm5jUDhIPVNxpDcqNYYfCV4qTSYb5CT/GJWg8gnvtdfi8JX ZlI7y03aGddanQSBO6DoMI0= X-Google-Smtp-Source: ALg8bN7dll8BIEIMeQjyCMVC2YFm7bkE5lkyAhEm2YQ+R2M1KCYoAMOgs4MlapKUQffzuuYBvNp1nw== X-Received: by 2002:a17:902:4324:: with SMTP id i33mr50716390pld.227.1546624218388; Fri, 04 Jan 2019 09:50:18 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:17 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 19/20] PCI: dwc: Make use of GENMASK/FIELD_PREP Date: Fri, 4 Jan 2019 09:49:24 -0800 Message-Id: <20190104174925.17153-20-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_125023_957680_1C732C38 X-CRM114-Status: GOOD ( 12.10 ) 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 , Gustavo Pimentel , 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 Convert various mult-bit fields to be defined using GENMASK/FIELD_PREP. This way bit field boundaries are defined in a single place only as well as defined in a way that makes it easier to verify them against reference manual. 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pcie-designware.h | 29 +++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 348e91b6daa2..0de653284fca 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -11,6 +11,7 @@ #ifndef _PCIE_DESIGNWARE_H #define _PCIE_DESIGNWARE_H +#include #include #include #include @@ -30,11 +31,12 @@ /* Synopsys-specific PCIe configuration registers */ #define PCIE_PORT_LINK_CONTROL 0x710 -#define PORT_LINK_MODE_MASK (0x3f << 16) -#define PORT_LINK_MODE_1_LANES (0x1 << 16) -#define PORT_LINK_MODE_2_LANES (0x3 << 16) -#define PORT_LINK_MODE_4_LANES (0x7 << 16) -#define PORT_LINK_MODE_8_LANES (0xf << 16) +#define PORT_LINK_MODE_MASK GENMASK(21, 16) +#define PORT_LINK_MODE(n) FIELD_PREP(PORT_LINK_MODE_MASK, n) +#define PORT_LINK_MODE_1_LANES PORT_LINK_MODE(0x1) +#define PORT_LINK_MODE_2_LANES PORT_LINK_MODE(0x3) +#define PORT_LINK_MODE_4_LANES PORT_LINK_MODE(0x7) +#define PORT_LINK_MODE_8_LANES PORT_LINK_MODE(0xf) #define PCIE_PORT_DEBUG0 0x728 #define PORT_LOGIC_LTSSM_STATE_MASK 0x1f @@ -45,11 +47,12 @@ #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C #define PORT_LOGIC_SPEED_CHANGE BIT(17) -#define PORT_LOGIC_LINK_WIDTH_MASK (0x1f << 8) -#define PORT_LOGIC_LINK_WIDTH_1_LANES (0x1 << 8) -#define PORT_LOGIC_LINK_WIDTH_2_LANES (0x2 << 8) -#define PORT_LOGIC_LINK_WIDTH_4_LANES (0x4 << 8) -#define PORT_LOGIC_LINK_WIDTH_8_LANES (0x8 << 8) +#define PORT_LOGIC_LINK_WIDTH_MASK GENMASK(12, 8) +#define PORT_LOGIC_LINK_WIDTH(n) FIELD_PREP(PORT_LOGIC_LINK_WIDTH_MASK, n) +#define PORT_LOGIC_LINK_WIDTH_1_LANES PORT_LOGIC_LINK_WIDTH(0x1) +#define PORT_LOGIC_LINK_WIDTH_2_LANES PORT_LOGIC_LINK_WIDTH(0x2) +#define PORT_LOGIC_LINK_WIDTH_4_LANES PORT_LOGIC_LINK_WIDTH(0x4) +#define PORT_LOGIC_LINK_WIDTH_8_LANES PORT_LOGIC_LINK_WIDTH(0x8) #define PCIE_MSI_ADDR_LO 0x820 #define PCIE_MSI_ADDR_HI 0x824 @@ -75,9 +78,9 @@ #define PCIE_ATU_UPPER_BASE 0x910 #define PCIE_ATU_LIMIT 0x914 #define PCIE_ATU_LOWER_TARGET 0x918 -#define PCIE_ATU_BUS(x) (((x) & 0xff) << 24) -#define PCIE_ATU_DEV(x) (((x) & 0x1f) << 19) -#define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16) +#define PCIE_ATU_BUS(x) FIELD_PREP(GENMASK(31, 24), x) +#define PCIE_ATU_DEV(x) FIELD_PREP(GENMASK(23, 19), x) +#define PCIE_ATU_FUNC(x) FIELD_PREP(GENMASK(18, 16), x) #define PCIE_ATU_UPPER_TARGET 0x91C #define PCIE_MISC_CONTROL_1_OFF 0x8BC From patchwork Fri Jan 4 17:49:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748697 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 17A136C2 for ; Fri, 4 Jan 2019 17:53:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 098AB286D5 for ; Fri, 4 Jan 2019 17:53:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F179D286E0; Fri, 4 Jan 2019 17:53: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=-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 8754A286D5 for ; Fri, 4 Jan 2019 17:53:53 +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=Hc1zHveRVEPnFXVPBOrmp4zcbF48JN2Y+gK00JKpo54=; b=gCwTRYRG2ofGQb 3k3a0HFAqTQ/iAmiy8lIDdDOr0SCuaF33AnZt5JmJv1jjihbTegBbfvJahqEVv4KrTIGSmj2GhtKr 5trWqQCCg8f1HZ33OoRigNAG5lT0RUdAZk9wOnKx0AXbuAkpSjs6WpMYqm9IMjvSJ2jWfbiw5HmiJ pJ0tG5tXnyMcNbyr4T8E0QgS8sTccfdiWyfFatnkBNlZm8bdYFs3hX02d6Pi3UBm4//LOf919NWKz BRooHbcQ8L5Q4TmGfyjqabFQcG/VwHT11ego4nn3UJtOR+rB1ssZHIGUgUoVNvv8PshNRVHYKAEPJ XJAwZdpu75HOBINtzgaA==; 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 1gfTfK-00018a-V8; Fri, 04 Jan 2019 17:53: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 1gfTbx-0005hK-NY for linux-arm-kernel@lists.infradead.org; Fri, 04 Jan 2019 17:51:02 +0000 Received: by mail-pg1-x541.google.com with SMTP id n2so17790438pgm.3 for ; Fri, 04 Jan 2019 09:50:21 -0800 (PST) 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=f2zFuyHm8nEdjnfJDmsDhZ6LWDdoDXqHHbGY0Z+L7BY=; b=avaFwitLVqF1WLutZiOj/v4o0ynDRwJO+ElVicQxUpG98KuEEireOp+xpZrw0xZwQJ ZRAGv4+qsLQgbVhAcF9uO9Y6gEaR+sZjErsYYABnmU8YLifDJOAr0VF8ER7QjkN25cZ4 Mo4/c65UDgYj6+LWmmHgXokUoyvTIQ3CTnH3FI41NV9oFMT85aFnVRe1VX8RVKjIOCNq Tltk/1tpieU8sKkw+F7vxxDoUXpUaTcnEqq8g/doK3gfwhu84q4INt5Vns35qRcqHaQe RvzwMLJL867FhnTHC8tW3P40eEa9/NFvtOeq1//QcNhDabh1qto0u2VZxjmCRGkSY690 BENQ== 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=f2zFuyHm8nEdjnfJDmsDhZ6LWDdoDXqHHbGY0Z+L7BY=; b=QnVVY2Pb+3+E8lBEkXItirRYxLjDkqWfJXhbj1j3D/pTS/V0JVPNa5/LJ70rKdlch6 5vlCmsD9+Kc+wdzRGVNTXAIeDngPIoJBgnNHRoNUuy1kPdpxExUd2CbtK7ZEeKL9FGGY KrA4lZgy0GM0AdH9FIERJ+h8OSz3sMPtxNd6B7oPv3jYlKZwwKPBb6Shnu39ILrehrw3 dSDK7SrHN785YLkIZnNV8AKZa54fZtHV+9ISTB900TgAXJ58iKj/WjROpnfl3J1/rtcd Z3BlQ6/yxLlMN6DBP7eOeFDSA3Kd7Zqv2ntm9/QM4Gs4LZBnKkGavoHR/NVHTi1+DCir oqOA== X-Gm-Message-State: AA+aEWYAZP9AR2JOu3OWG1HsGEa8czvT8FxeckBRcVKmlyp5CRMliwev BtrDi84jSIgrYcVaxm6Ig1E= X-Google-Smtp-Source: AFSGD/UUBJh8pSGiYrD6XyoNobfobXZ/MOuQezUc5bLzOuCVreeYIfxnWKi2HmVlZZroiMi3VbEUZw== X-Received: by 2002:a62:3811:: with SMTP id f17mr54238299pfa.206.1546624221002; Fri, 04 Jan 2019 09:50:21 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:20 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Subject: [PATCH v2 20/20] PCI: dwc: Remove superfluous shifting in definitions Date: Fri, 4 Jan 2019 09:49:25 -0800 Message-Id: <20190104174925.17153-21-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-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-20190104_095022_171337_4CB1716C X-CRM114-Status: UNSURE ( 9.83 ) X-CRM114-Notice: Please train this message. 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 , Gustavo Pimentel , 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 Surrounding definitions no longer use explicit shift, so "<< 0" here serve no purpose. Remove them. 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pcie-designware.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 0de653284fca..636689fd4ee7 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -63,14 +63,14 @@ #define PCIE_ATU_VIEWPORT 0x900 #define PCIE_ATU_REGION_INBOUND BIT(31) #define PCIE_ATU_REGION_OUTBOUND 0 -#define PCIE_ATU_REGION_INDEX2 (0x2 << 0) -#define PCIE_ATU_REGION_INDEX1 (0x1 << 0) -#define PCIE_ATU_REGION_INDEX0 (0x0 << 0) +#define PCIE_ATU_REGION_INDEX2 0x2 +#define PCIE_ATU_REGION_INDEX1 0x1 +#define PCIE_ATU_REGION_INDEX0 0x0 #define PCIE_ATU_CR1 0x904 -#define PCIE_ATU_TYPE_MEM (0x0 << 0) -#define PCIE_ATU_TYPE_IO (0x2 << 0) -#define PCIE_ATU_TYPE_CFG0 (0x4 << 0) -#define PCIE_ATU_TYPE_CFG1 (0x5 << 0) +#define PCIE_ATU_TYPE_MEM 0x0 +#define PCIE_ATU_TYPE_IO 0x2 +#define PCIE_ATU_TYPE_CFG0 0x4 +#define PCIE_ATU_TYPE_CFG1 0x5 #define PCIE_ATU_CR2 0x908 #define PCIE_ATU_ENABLE BIT(31) #define PCIE_ATU_BAR_MODE_ENABLE BIT(30)