From patchwork Fri Dec 21 07:26:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740047 X-Patchwork-Delegate: bhelgaas@google.com 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 D7F1C13BF for ; Fri, 21 Dec 2018 07:30:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE2EB28429 for ; Fri, 21 Dec 2018 07:30:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B225728462; Fri, 21 Dec 2018 07:30: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63C0C28429 for ; Fri, 21 Dec 2018 07:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732732AbeLUH1p (ORCPT ); Fri, 21 Dec 2018 02:27:45 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33279 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730788AbeLUH1m (ORCPT ); Fri, 21 Dec 2018 02:27:42 -0500 Received: by mail-pl1-f193.google.com with SMTP id z23so2121723plo.0; Thu, 20 Dec 2018 23:27: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=hVVP0IYzly0vMq5I85m0FEXZqGuHFqhL3TgllfB/KdA=; b=jWKr5iYU9+2g6DtIQu8snbJTc9PNoAsCGi1RT8t3Pz7KQSHl6HNF77Qo21gyyeLUng AzPkU3n6zaQZyTEzdTbDl+pcsFL9TPECklIiWSpFMr1vxEfP1g3SttLUV5/cN1nRJVcp 5v4prI5j6rTWUwhyemQ/VTQGYRRw7iap1KO/CXAt+NxDA90L6OF0f808MsGtEJe+YKMS UP7hbezFpqaOEvKo7zz2VaXqpnF7lKdrLD4Do6Hj3nYMIe4nMu2wi1ijsBzE2xu6fJC/ gpTCv62SYB173S5alFQFat7CMOKIB7USTR/0E4W9olZuLCh8xffJu+hYo4YlxH8dxk3k UTuA== 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=hVVP0IYzly0vMq5I85m0FEXZqGuHFqhL3TgllfB/KdA=; b=ofr/KLexvbn5JYTQ90zwbWb31IzEr3UHWL+t2uqrIN2STrZ4MBSbBkBvvEdFClMloY sQRN/VhliSDBxLvbZLv2k0jD52XykQtlWuLIEjWO0UT3AFhmORNLhEDRoPQrcsZvAHyQ tyrU4ee0yu5dh0HeYXbGXYhmU+2r+GGuikDhxlmimhyKkZ9BrClT9rRGk0XoK1AFy19n SSniX9DQ7GN8oW1c8L14ogAGvdcvNwBDwcXsc8v7geagNZYiJGyjL0GZHg5SDrNS3ZwX UjLimwI7eIYrS1OYKx4+KPatDXI33Z43PJFzikwDbJU/sEyKouIQwlr+aPAnT+cttOPn mAyg== X-Gm-Message-State: AJcUukcJMsNkkjbOKDXsdn0HBYTigaG2vLJCbLQbihVKJNH1/p0Cilce bKM6pyvgkJsNXTrld7iFnWk/eovA X-Google-Smtp-Source: ALg8bN6J5cKmyuuAHi7yPnlOzdegH1xGaUvuu41+zv9Bkm4p3XWirADGk2+fC1OIgNE/+wBOtr3hAQ== X-Received: by 2002:a17:902:654a:: with SMTP id d10mr1401337pln.324.1545377261015; Thu, 20 Dec 2018 23:27: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 t90sm44971921pfj.23.2018.12.20.23.27.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:40 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/21] PCI: imx6: Simplify imx7d_pcie_wait_for_phy_pll_lock() Date: Thu, 20 Dec 2018 23:26:56 -0800 Message-Id: <20181221072716.29017-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make use of regmap_read_poll_timeout() to simplify imx7d_pcie_wait_for_phy_pll_lock(). No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- 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 26087b3da590..c87ecc305dc7 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -69,9 +69,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 @@ -418,20 +417,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 Dec 21 07:26:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740049 X-Patchwork-Delegate: bhelgaas@google.com 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 99FDF13BF for ; Fri, 21 Dec 2018 07:30:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80E8B28459 for ; Fri, 21 Dec 2018 07:30:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7503C285EB; Fri, 21 Dec 2018 07:30:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 288C128459 for ; Fri, 21 Dec 2018 07:30:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732661AbeLUH1o (ORCPT ); Fri, 21 Dec 2018 02:27:44 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44531 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732605AbeLUH1o (ORCPT ); Fri, 21 Dec 2018 02:27:44 -0500 Received: by mail-pg1-f194.google.com with SMTP id t13so2099655pgr.11; Thu, 20 Dec 2018 23:27:43 -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=ztf5h/VWPT7ArQCZI10FTS3FX1Is4iZLXtzrxnewglA=; b=Z0RQ48qVC17QilVa8yi3aGpnZwguKR/WyE+4MBjNXYtoiFkEn3DbOkzl8eTrDH8SrC hJxXDFDktmaS/zbBB7u4k4n89JoZKkbpYgQpZ0x8yEWuP+8XT9bZudbtFTtRBq1Nj4k4 q98upDxxo743ASCAc0YT6fzWT6US+YxYF/TmvELJXb1oNidOjrDrU9sDCceGlgxfThCw RePdxCZi4zJC+0ftJoX8+WDBYlZ23u8Z3mt/pA0mLyqp7DHFWYYzRmUWTHmYPZZuPvNk diXoM5kSofwsbhYNkV8FmyIQzIhmnu7lH0P/NhWmVTh+RP56PJtGN5SwEohDLdQgYU7g hp+Q== 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=ztf5h/VWPT7ArQCZI10FTS3FX1Is4iZLXtzrxnewglA=; b=rYwIKNHezRtQP6lPpw4QDcgrJPfKU3/AHfoPgBs0kb6F6dgG2jnvATT155kBrfXRos t2yMy1IGl7RV3ufZlk9T3WspfbSB2XM7Y/mU6AMLVEk7uCF57nM9CK2C7SwHqhTa4/Ab NNHBXmxRliPwHOXUL3kFO9U7WEZ/htQAYyCNjsQKD7rN7VyyJ1IwIOVGho9ZrcufTZAI IRjrK4NaRfwE8lCuN5pTkyA4hE5lcNSW/SnNpByldivhMBj9w/qNCzYyhqhrZFLcumHo ws1z8Mi4GwgMhQmOOC9/jQOTc/zmCT3zHxdTowzLkvgRetjBHKisDN/idxs0u/Hi0sH8 8BVA== X-Gm-Message-State: AJcUukdQhkdFS4R8UfjCH03FyldL7+zM+4Hpjqy1WRNDiYU25ri/LiDH CiSWXyFjz4hlEf1hUazAacpbmIh5 X-Google-Smtp-Source: ALg8bN4kuEkoNrTKNB0wpF/5vWQcMC7fRyxDCmjDgx2qgcgkIg7lFa/THiq5EvaaYM5XXMW22MMbpQ== X-Received: by 2002:a63:9712:: with SMTP id n18mr1307291pge.295.1545377262911; Thu, 20 Dec 2018 23:27:42 -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 t90sm44971921pfj.23.2018.12.20.23.27.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:42 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/21] PCI: imx6: Remove redundant debug tracing Date: Thu, 20 Dec 2018 23:26:57 -0800 Message-Id: <20181221072716.29017-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP All calls to imx6_pcie_wait_for_link() share the same error path and the state of PHY debug registers will already be printed there. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pci-imx6.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index c87ecc305dc7..6ffadc29d21b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -603,16 +603,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 Dec 21 07:26:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740043 X-Patchwork-Delegate: bhelgaas@google.com 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 50A1C13BF for ; Fri, 21 Dec 2018 07:30:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36A6028429 for ; Fri, 21 Dec 2018 07:30:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B0CC284DC; Fri, 21 Dec 2018 07:30:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D603928429 for ; Fri, 21 Dec 2018 07:30:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729578AbeLUHaa (ORCPT ); Fri, 21 Dec 2018 02:30:30 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46319 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732882AbeLUH1q (ORCPT ); Fri, 21 Dec 2018 02:27:46 -0500 Received: by mail-pg1-f193.google.com with SMTP id w7so2096256pgp.13; Thu, 20 Dec 2018 23:27:45 -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=O4mASvI0bC/QugbLYbpYLoCaECc3OWgx8IVqS8xMLbI=; b=PfjIAf5EaQ4lUe8mFdDhZEXTw9YDuTBnZNuNCgOaIqXKdeiCfnEHFnYYEwSd1z8YN7 PrgsP3bh5563mr/+qA3bXaP0taH3DBzdn2kdZHMAJmwf9Ua5EafJzp76aWf8lyPrJWRB 0WndyHY+qDCbfJYyjIqZgvBfGBYR1YA5jpyZAQO4KCGhRtow+wHb2+Rm9qTlx3yZ+9Q/ /1W9Gsx1vhJ6J1dl0VR08NVrfAXGjo3e6SsKN9ePnzvx1N8Xkv+5XTD/Vgs9Bj31EOgd DCBINsu3cMbgeSTrQlZ76PzZoANdiwI/MFx4cow8RWKkijlz7jxXEZpfPhhANd3N+wyW MlnQ== 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=O4mASvI0bC/QugbLYbpYLoCaECc3OWgx8IVqS8xMLbI=; b=LtFTLUn39MBTXrUvduCluUJhDjtY1xhbhwkDgt5Z4l85dYFRBUetrraZiBbl6SClYh ePFcI00aAuH6hWryeFR/nNxQW95VLsyQv8a645LTUvlxP9bSGEGepFfhqO3NFsOijsLD d2vvAc6jJFhBSnaHvO1zGF+RWuFngmVP9oCyVxTtdTyhufbselNwW7iSTuwo88/SYlu7 gR3PVuRKtECN4fppSem4tui+zCM2ei7RH9MqOv+UAxF5hSLAHn7AQkdafyeeyslwb//c FSiHZIipykqoac+DZO9fbzbOaIcods0Nx2ndj4MsH+c0LqflTZ0geXRix91KntCRWDH6 WgWw== X-Gm-Message-State: AJcUukciu+ZOxT82lgjllmyEsUM6ZU4zYXKXY7i/oYER7XDyxPHIxTnE Mgo7moHK3RAG9k+64gHqyx0kMll0 X-Google-Smtp-Source: ALg8bN4ONRm6Owxg+TWoErIgIUP722JgVl/i35d0LJyd36E21155w3ghEdpl/I6V0E928xCSKECv2Q== X-Received: by 2002:a63:2e88:: with SMTP id u130mr1366861pgu.9.1545377264837; Thu, 20 Dec 2018 23:27:44 -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 t90sm44971921pfj.23.2018.12.20.23.27.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:44 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/21] PCI: imx6: Return -ETIMEOUT from imx6_pcie_wait_for_speed_change() Date: Thu, 20 Dec 2018 23:26:58 -0800 Message-Id: <20181221072716.29017-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change error code from EINVAL to ETIMEDOUT in imx6_pcie_wait_for_speed_change() since that error code seems more appropriate. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- 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 6ffadc29d21b..e990030564d8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -624,7 +624,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 Dec 21 07:26:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740037 X-Patchwork-Delegate: bhelgaas@google.com 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 4E84D746 for ; Fri, 21 Dec 2018 07:30:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34C0F28429 for ; Fri, 21 Dec 2018 07:30:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2844628462; Fri, 21 Dec 2018 07:30: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5DA428429 for ; Fri, 21 Dec 2018 07:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387465AbeLUH1v (ORCPT ); Fri, 21 Dec 2018 02:27:51 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:46214 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732384AbeLUH1r (ORCPT ); Fri, 21 Dec 2018 02:27:47 -0500 Received: by mail-pf1-f195.google.com with SMTP id c73so2168143pfe.13; Thu, 20 Dec 2018 23:27: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=fltZQbZSIQgUXi/Z+xP/+nOzCe8SxwJBjLTLp8RDlGA=; b=rrBrVytiDnat/KCHZDBMlr2Q4rK7dzYqetel/FN3IPPM07pVdKgmLf2nl+yaPN4i6h reGL4tQFU2bZ2oANOA6ueS9c2dh55HWlgZu+eJYLmRT+yoJI/NuEDPdgVEbbYr3z7b58 nxs3DDTX2GiLuvPhpBByWtA/l2/F+7TZ2BxmRRt/Qpv5mkJFlQ0iSkk3imIeRrJdRmzA 1bvBZEkw46EzOinWphj81lvnvNm3BzQxrRSAV3xEDW7IalBojTLDVV9IdQJTEhExudwK h6SmNPoY9y06VaT8Ed83PqIHZI7LcknkWGdqsoy6aaZIqqg9wFMsiXq45cElV9ur7Vz1 z4XQ== 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=fltZQbZSIQgUXi/Z+xP/+nOzCe8SxwJBjLTLp8RDlGA=; b=kAnOJGLLHiV5r14TYwKzBcn7eAu0ppSyDy6jlrdpPu3rWJ/M1bzgwk6jeYPxpWb7/0 S0y2NvZWZa1/r5GYGhMKCWMCLVaQ6Qm20VkxpzR84oQ7Nx2AMXinGxwEPJk+Mk5lehHI RqlxWmtiAwUR9AHcK5dvO0ExOha1G6uE6/xXN133mLxE2VbfhyfEW1/Jd/+83JsltuQZ V9ON/fH6kD+gMlbj/wMqGH6BmR7XxZnFnDKAWNJifwxkZUGuQiKrPytTsg+I1y+h72A0 KUg21OiYRCZCT3PuNmjtzyIaCUOi/+p5JZl3KYSAr+qSE8AdwtPtvJ2uAqx/b3hrYl6g tIIQ== X-Gm-Message-State: AJcUukdf8Pr8Fzcer6AWvisxHWQzDbOie0aP6v81BqPNAxL4Lna/0a/u xDmxMR1CYEZC+1CzaO+1WHQvIMAY X-Google-Smtp-Source: ALg8bN7so8dNzKUeH8NV9oDrLTu7hCW6lX/cL+aAyLv7GoPIg1L2wuobljjFpsXFADTv8zZvuVc/Sw== X-Received: by 2002:a63:ae01:: with SMTP id q1mr1321976pgf.402.1545377266708; Thu, 20 Dec 2018 23:27:46 -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 t90sm44971921pfj.23.2018.12.20.23.27.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:45 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/21] PCI: imx6: Remove duplicate macro definitions Date: Thu, 20 Dec 2018 23:26:59 -0800 Message-Id: <20181221072716.29017-5-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Both PCIE_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 e990030564d8..2265f4b40e39 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -100,9 +100,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 Dec 21 07:27:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740041 X-Patchwork-Delegate: bhelgaas@google.com 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 E363613BF for ; Fri, 21 Dec 2018 07:30:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9E9C28429 for ; Fri, 21 Dec 2018 07:30:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDACA28462; Fri, 21 Dec 2018 07:30:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 900C728429 for ; Fri, 21 Dec 2018 07:30:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729539AbeLUHaP (ORCPT ); Fri, 21 Dec 2018 02:30:15 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37420 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387432AbeLUH1u (ORCPT ); Fri, 21 Dec 2018 02:27:50 -0500 Received: by mail-pf1-f193.google.com with SMTP id y126so2186980pfb.4; Thu, 20 Dec 2018 23:27: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=J1XPUyhdugQdjD1RjA8TcbqShFQ6vNfPgtVDRPKD26M=; b=D+v8BjIwaeBkHWCUn0SIc9Vauqh6k/EcRAx/6NL+x5IkPsPR441bJb8zpvorrru7tf WQpOaXEz0F1I4yQjIp9cCpkZZstdoQUvPF3cliFgyAXSrybbqb/8LC1ZPsZ/pgufsNk1 AqoNPMrKD5/PZcnFX859gEz7gy30NgnwpnnDc2apCYY1C/yyrzFwKlpvRbN19PuE17mw +WDInCgOVD3V4o4MLInCLYjY7gnhvqx71hXA3y/rOjwfCq96gemXDtl252k3YS+E2Rbb 76bKO8WtEZwQ1BWm8+h7aJDHIQopoRuLzD2zYjXfyDwD9usA8s80o2WQvuznD7ZxgcER j7Bw== 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=J1XPUyhdugQdjD1RjA8TcbqShFQ6vNfPgtVDRPKD26M=; b=FNR5LcGb6LNCSN7wNwbCm6TLui4I/L+U7tYlKSKmQ/wXkVqJOwVzb1KgzOP4+2cMXi k+ysMilWqD5GZeASBCiGdAWMArtedA2eFqQYUrOSeKGKqea+sR6yF7XbjxXV13gPLzbD HhvAC5WUlIsJgHpY5gVNJv2CRFfHCumQVnNmNwb+VCYnFP/D18hMI6tZIxeo+fI4XKON /dOcCieWa1B4SNizM570SQqCZRFCrCpOwgbonHaDR4zv8WS2cOgA6iTEFhSdLimz1VXR 3CHPW+j45lUkWPjqp0WWaO4Jj+6l6YrbckNJ+5VZx4lOPKCFG9FjvhIIxiyXHSI1kLMr w7eQ== X-Gm-Message-State: AJcUukdIdnnbzHDsTemJUdIkIvHxQcCzchfL2j40X0Y/5mFJ8att+LjZ RiUTT9kbfGO5/sjJzfXCr0MMZXFv X-Google-Smtp-Source: ALg8bN7DefFb9r+kRTFCRUxMnRCb2jxCddzSWYYkcXZREmCl0oq4M1VuRrjtSzH7qve+8RIUv4nlxw== X-Received: by 2002:a63:70c:: with SMTP id 12mr1315807pgh.352.1545377268946; Thu, 20 Dec 2018 23:27:48 -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 t90sm44971921pfj.23.2018.12.20.23.27.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:48 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/21] PCI: imx6: Remove PCIE_PL_PFLR_* constants Date: Thu, 20 Dec 2018 23:27:00 -0800 Message-Id: <20181221072716.29017-6-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Code using these constants was removed in commit a71280722eeb ("PCI: imx6: Remove LTSSM disable workaround"). No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- 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 2265f4b40e39..60803f1f16f8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -82,9 +82,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) #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) From patchwork Fri Dec 21 07:27:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740035 X-Patchwork-Delegate: bhelgaas@google.com 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 114BE14DE for ; Fri, 21 Dec 2018 07:30:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC57D28459 for ; Fri, 21 Dec 2018 07:30:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0647284DC; Fri, 21 Dec 2018 07:30:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97A8C28459 for ; Fri, 21 Dec 2018 07:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387632AbeLUH1x (ORCPT ); Fri, 21 Dec 2018 02:27:53 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:44540 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732384AbeLUH1x (ORCPT ); Fri, 21 Dec 2018 02:27:53 -0500 Received: by mail-pg1-f193.google.com with SMTP id t13so2099862pgr.11; Thu, 20 Dec 2018 23:27: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=d+ZYsrQDzgljKv7Hwi24dI5tor2oRWLv2kgiIeP0lnI=; b=Z4zvbexJFGJpGh32+7HGRQJGf6LTreqO/NmuvyBGVazPAY0h38tNQYijQDnyfi3QPw Zkvn54K8ava4sziwAA6w/Q9AIBKSE6lM0Bvt2NPsHGg9fRaMQZiJToJMqMBbbbfUgPwc 99RndgkRnhG1ZyrXbhPws6Hag+v8/OXuDqa9EOPRpggP1oCMMTyzWzxkfd3agbv9dy+5 TqMgrK6Ur0Xw3/mt6+GI7+RAa025bD/gDyK6eM7DBbx6BKGs5/XYjxEQVIabiwDDG5sT SyPVnhijHovEidUWEGCZH5O644uq161RRE5MNd2vCNtxe6JZ+wY+L1TtCLruPMqh001H ntlQ== 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=d+ZYsrQDzgljKv7Hwi24dI5tor2oRWLv2kgiIeP0lnI=; b=rgNjhXzxWhyQ7da4u0esaYcboOCE1ZTieztVzcJN+nFeT7UYHHuCDOrquhVOgo+aLc vDo6BI1XkdR10zK7tc/JGWdF/U4gmxtqnAgU4F9BdxbtYNAtZ5aqDuRdfZSq9DY5xEvd efLLBrq3AKkRaN4hXb3Va256GynTpGOv8Xo9se5zJOLIJKStLj97BUdNQHe+GDv1g2T+ 1qTB+x7N6+iRNXG4mxzoPz3eH5oxOFNbz6kxcPvTuiFmwAIfatA3vFlqXntBpEbbXvkj qA6SmuFpP4JukH4INM344vmUfQ1lKp8smDiKJVWSd6Vq1igcy1qEO+EBfkKuxhw8T4ia blvA== X-Gm-Message-State: AJcUukcygeS3eiQs+jWB2R9JDsyx/6NO4lOnrK19baLJym7WY23nMqF7 dYJtkNzvPDniX487pZDPOSoLYKJt X-Google-Smtp-Source: AFSGD/WzK6aotUaeFQYslS1ZuCcb0xGrM4bYW4RJdzTkpTf9ea02REhEidYhtufShyRIHnc/I9ASqQ== X-Received: by 2002:a62:4c:: with SMTP id 73mr1424657pfa.24.1545377271247; Thu, 20 Dec 2018 23:27: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 t90sm44971921pfj.23.2018.12.20.23.27.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:50 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/21] PCI: imx6: Remove PCIE_PHY_RX_ASIC_OUT* constants Date: Thu, 20 Dec 2018 23:27:01 -0800 Message-Id: <20181221072716.29017-7-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Code using these constants was removed in commit 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 60803f1f16f8..937d630f8c9d 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -108,9 +108,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 Dec 21 07:27:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740033 X-Patchwork-Delegate: bhelgaas@google.com 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 8F7FE13BF for ; Fri, 21 Dec 2018 07:30:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 737D328459 for ; Fri, 21 Dec 2018 07:30:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 639FB284DC; Fri, 21 Dec 2018 07:30:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DDE228459 for ; Fri, 21 Dec 2018 07:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730639AbeLUHaE (ORCPT ); Fri, 21 Dec 2018 02:30:04 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:42665 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387631AbeLUH1y (ORCPT ); Fri, 21 Dec 2018 02:27:54 -0500 Received: by mail-pf1-f196.google.com with SMTP id 64so2177445pfr.9; Thu, 20 Dec 2018 23:27: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=dUwToKhhL89vx1LjgzipUu4yk4Mqqx0vIAofTHjHZac=; b=ShvpZPrvcZfDw0J1ASzD0s3YT+jY0oS1MadiUlCWWjzz5X5zDssoIvCHAloq9QV5xC NjF1rpzikWkybtHcGu4YjiZKY4KAoohtfSZsMzW1qJB+ZSiDdNcHxyug7LkwUWD5OpTk qmksrnvAHxMg9bf3m5lOM4e7opmqBfi2JuMtRoBinthmsui86Y5DvN1TzH8lKSWPBgWh xCjIGY45Q6rwEo5Bm/5Vo8c6WxKZO2lCzUp0tchyY/Odxeyts6XvWLZjmlZhEtuekZCE UlTYTDThf99GmmFa6/nTdxRaY+Jr7AJymU93pMSI6FDUAjJHf3J/K4+4q5TDxLV9RDrS PerA== 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=dUwToKhhL89vx1LjgzipUu4yk4Mqqx0vIAofTHjHZac=; b=EhpsuuXV3TGAN0ycM5PrmJo45kMjY11LpmvEhlhVIsjT6pCKX6RyGXt/xb6w9VpWNC Ei8BK4jK/lM+HNykHA5SBx2fwCjbXWuj39fbXko+tYWOJ7cFobgi+1sQvotQ6+aBbWXC O4DmIOl1ST7w1S4CDPOX5VTdbogj9fJG6RKuXbijCSffXI+5vN+TkMaeqEft36MdYwMX YbLneWqEwBeUIDxgvkdkPC37y1+Xxb8s5M+RlXTPCqzo0853/5Td08IPWu3uisGSxtp1 OhqjOIDVxuYSqFNVGHQTxzjoheVj3Ph+7mV7CZM5Bc6hmnLi4sNKgrAIxiACWftPOMSC 3DwA== X-Gm-Message-State: AA+aEWZbgoYqRy3NlJ0sNLTYk8Tar61RClVoJic2UgR7wJ+65RiAbN/U o7XSV6x//kl8T7lePq8RitF/O+0f X-Google-Smtp-Source: AFSGD/VUQQi8yisb9aoewB9+qE7nuQLuYz8kYTpt3NojM7V2vPNF3ZlRLRnTQ6Sz6/Yix3QYYdtGqw== X-Received: by 2002:a62:a99:: with SMTP id 25mr1380678pfk.121.1545377272845; Thu, 20 Dec 2018 23:27:52 -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 t90sm44971921pfj.23.2018.12.20.23.27.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:52 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/21] PCI: designware: Make use of IS_ALIGNED() Date: Thu, 20 Dec 2018 23:27:02 -0800 Message-Id: <20181221072716.29017-8-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make 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 Signed-off-by: Andrey Smirnov Acked-by: Gustavo Pimentel --- 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 Dec 21 07:27:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740029 X-Patchwork-Delegate: bhelgaas@google.com 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 B209B746 for ; Fri, 21 Dec 2018 07:30:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 998E828429 for ; Fri, 21 Dec 2018 07:30:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8CA9028433; Fri, 21 Dec 2018 07:30:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C3112842A for ; Fri, 21 Dec 2018 07:30:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387731AbeLUH14 (ORCPT ); Fri, 21 Dec 2018 02:27:56 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41636 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387698AbeLUH14 (ORCPT ); Fri, 21 Dec 2018 02:27:56 -0500 Received: by mail-pl1-f193.google.com with SMTP id u6so2104774plm.8; Thu, 20 Dec 2018 23:27:55 -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=HjLeQTWp5O7b44WjnLWHOp2yQfeZyWOrOmzsZ5Uzh4Y=; b=KTqzBDIwbk8ZHx2tP5xo+RJ6k0Rtiom1wUPdSfWrQLfmWAWIcDeb9pZBilfkdAy0L2 16e1Y+iBEIA2ewRbwsdjFjZj2+cvI0wWoN1bCikxwzltvLQVp0WzC+ehLcBuf1qQqpIK HKwGJmRDYq8XLNMn76kI2T7ZeB174SgVkSwl0FiwW7Wnt/HKaEZ/qL1HcOQ2VtlAzwAR JvyZdIN5aklji9Ik6z01yKMCx0d22urVSNlTu9nIJMZ3rTgYFacEs7JiEqfbEMHPYxMr 09UD9dXs2keLcKMbiFFjm22Hle8Px1eR5itAbRLp5WIhADejfBAm94pbaChoH+D3M3fJ 1u9Q== 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=HjLeQTWp5O7b44WjnLWHOp2yQfeZyWOrOmzsZ5Uzh4Y=; b=OJRTTHy645Yyisvzn78HW29sPGZRXJvVpI2nrJAUN5btnAwDMbCJWLApvbGiiSFl0O gyQgVysFxTQjSDvnkQ0n343E4LzWSO34eWH6MKyL6cI4iL8mBn2vZjxjblXYlrRRuT6h EfVGw7Rps1/X0ZRZ6Thf86AM5kxWWMXdFx9D4+QWT9NSwllaSJqC9LhDLo7B+6hFBxkF PXSt5EOO9vyqc8BYYjE7A1SF6pgmKftok245dDrVappISnkEmU7iyRx7P7QjRL1/Kg2U IPY4x/9MlRmjnGqPHBeuxCN3dTkPv8K5Tq6WVsdi1AiXH78j2E2AiyoWOSaMKjaMvxsz gpNw== X-Gm-Message-State: AJcUukeDQfgV894tJOnimCftECO9X07Ha3Vh0kwOemWt68jB2vzu/cuR ZYssStT5a8p+h2X7q4RkxnBEIwpE X-Google-Smtp-Source: ALg8bN7D4v9/OXU3SC/7OBc9bHk3mU9wKahu3Y3BLBBhoK5P7vGe6/FObat6UBE2nlztKwrrrd7oAA== X-Received: by 2002:a17:902:f64:: with SMTP id 91mr1437737ply.132.1545377274451; Thu, 20 Dec 2018 23:27:54 -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 t90sm44971921pfj.23.2018.12.20.23.27.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:53 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/21] PCI: designware: Share code for dw_pcie_rd/wr_other_conf() Date: Thu, 20 Dec 2018 23:27:03 -0800 Message-Id: <20181221072716.29017-9-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Andrey Smirnov Acked-by: Gustavo Pimentel --- .../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 Dec 21 07:27:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740027 X-Patchwork-Delegate: bhelgaas@google.com 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 1803B13A4 for ; Fri, 21 Dec 2018 07:30:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0007628429 for ; Fri, 21 Dec 2018 07:30:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E80EF2842B; Fri, 21 Dec 2018 07:30: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E11B228429 for ; Fri, 21 Dec 2018 07:29:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731108AbeLUH3r (ORCPT ); Fri, 21 Dec 2018 02:29:47 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42134 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387775AbeLUH15 (ORCPT ); Fri, 21 Dec 2018 02:27:57 -0500 Received: by mail-pg1-f193.google.com with SMTP id d72so2101299pga.9; Thu, 20 Dec 2018 23:27: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=u1hnIy8vmdV/yZX7E7Jm64Qo+GuGNv09m6Pi4D4/jFs=; b=igx2pbzCncxfVAQhjH9xaI/FCAIaddYLG9x2Ieuc5tdWQzv3z0MRHJ2KIenPF8WV63 27/RiEAvf91QtmM/jEQgI9eyV+NhU/PU18Q+py2Gp/j37fvH+i7GGtwxWIlty+PHFvUH Va3uTUJCjPQxAdkVT3b86nHZOSfjjGh87OT09JNdzIzMwJ6rphof1OdaYiYbySpiUTpY /3tS4m+UEU3uqZpKCzV8LgRTqXfSsJbbfzqS45E8uxSx7JbCCH9NfWFb0bDhoUjtRHPB gEQLQacnRuVmTtuv4k4vSBTCWnooTZxxj4CgWe1mV3aYE2toxh040AN136AF8Qv97XbR JeeQ== 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=u1hnIy8vmdV/yZX7E7Jm64Qo+GuGNv09m6Pi4D4/jFs=; b=FGX7gFRdJU6cNcnkAzOjNFpSemKiehTmS0jVsz9SF1jgCHMJ5Ok3KYz4F8sxhd9PTA F9ZVHXenA1DapfeL8FJpwLVF0o25vfGR1ZHiRH6cU5ryoVLTulvW+DKzurJ6Cjg250SE T/bnzC/H+gc+odfpQqQ0XF84VEd6nDxf0bWFosE8DSuAvIbqzXLUVDAB427YpmA3pToV SrHveIexgfIeABHfcg1x+48fc2LjJ7QmMZDtFgAuLOnRHroV5zOlUQz5rlA0bKD1g72B Q3vo3J6Z/08DsgYNnc/lQnmcG+B61pbJ9JcMtzh05eGPKk8pXuRkwfJQ3TdlvXYEK1Ht Vu3A== X-Gm-Message-State: AJcUukdWUZP45bPlqVrn9/rTDnVe/nb5ZiDgi0ioi9+u5uGOMJamrMCd EExBcPA9dBRqPmurBFLAc9vNHMt+ X-Google-Smtp-Source: ALg8bN4vox9LZebHZGx5bOBLDLief4pJfhpahT2U2GmwxOnNKMv9alUCzjnwm7VG02285/dOUUeVLQ== X-Received: by 2002:a65:4381:: with SMTP id m1mr1327155pgp.358.1545377276324; Thu, 20 Dec 2018 23:27:56 -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 t90sm44971921pfj.23.2018.12.20.23.27.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:55 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/21] PCI: imx6: Drop imx6_pcie_link_up() Date: Thu, 20 Dec 2018 23:27:04 -0800 Message-Id: <20181221072716.29017-10-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Until commit 4d107d3b5a68 ("PCI: imx6: Move link up check into imx6_pcie_wait_for_link()") the driver relied on both LINK_UP and LINK_IN_TRAINING to determine if PCIE link was up. I can't seem to find out why, but code using LINK_IN_TRAINING seem to disappear after commit 886bc5ceb5cc ("PCI: designware: Add generic dw_pcie_wait_for_link()") and from then on only LINK_UP seems to be tested (dw_pcie_wait_for_link() -> dw_pcie_link_up() -> imx6_pcie_link_up()). At the same time the default behavior of dw_pcie_link_up() went from using just LINK_UP in commit dac29e6c5460 ("PCI: designware: Add default link up check if sub-driver doesn't override") to using both LINK_IN_TRAINING and LINK_UP in commit 01c076732e82 ("PCI: designware: Check LTSSM training bit before deciding link is up"). Given all that it seems that i.MX6 doesn't really need a special .link_up() callback and imx6_pcie_link_up() can be dropped. 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 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 937d630f8c9d..74faca11eeae 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -84,8 +84,6 @@ struct imx6_pcie { #define PL_OFFSET 0x700 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) -#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) -#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP (1 << 4) #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) #define PCIE_PHY_CTRL_DATA_LOC 0 @@ -732,12 +730,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp) return 0; } -static int imx6_pcie_link_up(struct dw_pcie *pci) -{ - return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) & - PCIE_PHY_DEBUG_R1_XMLH_LINK_UP; -} - static const struct dw_pcie_host_ops imx6_pcie_host_ops = { .host_init = imx6_pcie_host_init, }; @@ -769,9 +761,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie, return 0; } -static const struct dw_pcie_ops dw_pcie_ops = { - .link_up = imx6_pcie_link_up, -}; +static const struct dw_pcie_ops dw_pcie_ops; #ifdef CONFIG_PM_SLEEP static void imx6_pcie_ltssm_disable(struct device *dev) From patchwork Fri Dec 21 07:27:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10739989 X-Patchwork-Delegate: bhelgaas@google.com 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 A0D8613A4 for ; Fri, 21 Dec 2018 07:28:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8683226255 for ; Fri, 21 Dec 2018 07:28:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7A53128714; Fri, 21 Dec 2018 07:28:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0F2926255 for ; Fri, 21 Dec 2018 07:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387743AbeLUH2A (ORCPT ); Fri, 21 Dec 2018 02:28:00 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42066 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387860AbeLUH16 (ORCPT ); Fri, 21 Dec 2018 02:27:58 -0500 Received: by mail-pl1-f196.google.com with SMTP id y1so2097821plp.9; Thu, 20 Dec 2018 23:27:58 -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=rMjeSwqTVYgU8Pkh3tt+I27KOANJIXmBbqHJEBxidRc=; b=fuJydmjOCe/aNVUWccFNTUhSXJgPFuBevZ0KZvetPIaHuw3xlUcl1eRP/w46kKKE8H yP7FYF5virlsp+ZnSFEKDQ1atdLjHEi+O3vIDrOEFdN2QYO6mklcZhp/ex5ph7RE01pL 0Gwg1LqSMmTRXF904GVVqjBxsUL1Xt6hDuuGqCUL+txnGNrUGkSmjeK+BJcTl2+PbTxY 8LGsxFT3yTx9d7RMDAfPC6cKVhI34UwfG7WPgF7tzIyelnarJzSMRPkfhod74r7LT7qz 8JieMinuEVFwP/GO7Y+hVCWAusX1EJ/qrKjlPEBhQdnPRrQPEZzJdRNr3jgHXHUoyKOj bREw== 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=rMjeSwqTVYgU8Pkh3tt+I27KOANJIXmBbqHJEBxidRc=; b=WPpN1J9qfDSAuoYn9SsS34KjcaV6/v4tOLfj/xXCBtW1+ZGigNS30//5mQxZfsEW5V V4f29n2dUso3PLsFGXvRy8CiSIjeK2iF76yOUwqiR0MPJbD/TCt7l4yXPDjJ+QBI2Obn MQEKqC6Th8wIsshZ1xVVDM13gNOjUV1PfFh/lpVu5WHO35p9T9qtQvcTJe82QQ1WML/0 i02lgGsdmmH+TNT7WdBTVjvwhiDPC10G9lmtGfZRH5IN/oBxJAIHilTUjhMCdEt2/TOU VLFNvB1+rkQpOB62vMX5HqXT1egSWxjgU2rdAJXtjVzMoMnHbMbhEzYY4uVg0xE0KwQn 1FxQ== X-Gm-Message-State: AJcUukcP2y6tsxW0tiWlLI59+DO9UWKcSotWme2tzqWdAwgBikja6fPi LWYhgNFKS8LCUiy/1PmpLpEHT+iS X-Google-Smtp-Source: ALg8bN6q73Q1NnW5DO0vkV8WUnO939ff0oDQK8QdIco6O92Xhm1cJd9Vi5e7YSWBjPhBUsepla/bug== X-Received: by 2002:a17:902:d01:: with SMTP id 1mr1435404plu.127.1545377277849; Thu, 20 Dec 2018 23:27: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 t90sm44971921pfj.23.2018.12.20.23.27.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:57 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/21] PCI: designware: imx6: Share PHY debug register definitions Date: Thu, 20 Dec 2018 23:27:05 -0800 Message-Id: <20181221072716.29017-11-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Both pcie-designware.c and pci-imx6.c contain custom definitions for PHY debug registers R0/R1 and on top of that there's already a definition for R0 in pcie-designware.h. Move all of the definitions to pcie-designware.h. No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- 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 74faca11eeae..c0b073cf20c0 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -82,8 +82,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 @@ -706,8 +704,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 Dec 21 07:27:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740023 X-Patchwork-Delegate: bhelgaas@google.com 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 F22ED13A4 for ; Fri, 21 Dec 2018 07:29:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D285728429 for ; Fri, 21 Dec 2018 07:29:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BFBF52842B; Fri, 21 Dec 2018 07:29:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60FD228429 for ; Fri, 21 Dec 2018 07:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387897AbeLUH2B (ORCPT ); Fri, 21 Dec 2018 02:28:01 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34609 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387869AbeLUH2A (ORCPT ); Fri, 21 Dec 2018 02:28:00 -0500 Received: by mail-pl1-f193.google.com with SMTP id w4so2118558plz.1; Thu, 20 Dec 2018 23:28: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=m7MEN22xZYILSeqqlIU1BMlYkd4ApqQIfal0i82aqSc=; b=ZZmGDu3T8HXjZFjkvSVQYq7jVhGdL3AOkVax6x+BkXgM7pqjSvQXUwGuM1jjj1Cka9 iVg1ODnpiLTcgoKDJO0JSB63ZejLwNhWWekLZ+GjwC4htx3yUrUp5cGoNuWhKI3ZtoZY hH7z2gMXQ2a2QVlCrB39PECb+EhTxs2IHDts+7RXDqW7jygOhRbLpkyyRmV0GyzKypxu zhs9/dE+2ZvXKbo22+c6Kr62Og2tybOwpVBKzVjd/rOgGXgr7JeVdpPkVdwyZMuvmL05 lPJ7vPv2xIpZ1aGiPQZcbDV510X42FNJfUkHYG7Z17u1Amz58+63ZJvW9EfWTRRMQqHL Pl+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=m7MEN22xZYILSeqqlIU1BMlYkd4ApqQIfal0i82aqSc=; b=fCXXZhAhzLruhw3TObXimR1rH6IVzpeo8iHqeLUa9PPGYCxHOuK3e/haB5yVkmFGSV 6B7XkmY0EU24VAK3vbIMt+W5FiWWtzZzrYjShSxkcJ4ZmlNIBFGVhZuJI/bFtFHRBG2b 8XPIHLfZa0YXvz0bXVqz8hPMmndP/4yhnorqP1eiR9+pkXUT6ywFfy4tSzP2ZVfgqOFS Ox2jjFPjZI0GprPL/ygniu0rRLvHgIvq9lus5qiApyrwdQxX9KYNXq95YKbDOxY1yxYW GGnk4jpzv8Vr9ERIWUMsVduvympkQ8cBV6Z9ew574/Dmrd3SHQiDrJ3ieCYmtIFKXDE8 yvHw== X-Gm-Message-State: AJcUukcJuoshSYXotredwf5aesLFqvNOowl2lQ7h01yRGWFf4MV11N5Y V9LKEY1j1E9ctAZ703mfIB02pJZB X-Google-Smtp-Source: ALg8bN6ThoRT6OXXj55K3ngrcTHhbGq34vHZw6EHKrvfvxBcvviztT6l0Lj/cOoLrG1/tx5VZ/ocdA== X-Received: by 2002:a17:902:5ac2:: with SMTP id g2mr1398311plm.313.1545377279885; Thu, 20 Dec 2018 23:27: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 t90sm44971921pfj.23.2018.12.20.23.27.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:27:58 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/21] PCI: designware: Make use of BIT() in constant definitions Date: Thu, 20 Dec 2018 23:27:06 -0800 Message-Id: <20181221072716.29017-12-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid using explicit left shifts and convert various definitions to use BIT() instead. No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov Acked-by: Gustavo Pimentel --- 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 Dec 21 07:27:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740019 X-Patchwork-Delegate: bhelgaas@google.com 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 3E47E746 for ; Fri, 21 Dec 2018 07:29:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2615628429 for ; Fri, 21 Dec 2018 07:29:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19E8B2842B; Fri, 21 Dec 2018 07:29: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C36E528429 for ; Fri, 21 Dec 2018 07:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388032AbeLUH2D (ORCPT ); Fri, 21 Dec 2018 02:28:03 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41649 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387982AbeLUH2C (ORCPT ); Fri, 21 Dec 2018 02:28:02 -0500 Received: by mail-pl1-f193.google.com with SMTP id u6so2104920plm.8; Thu, 20 Dec 2018 23:28:02 -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=TqYCFphTE89qwX5r9RN/jgIceUrAGJyLboLH1gjiqTU=; b=T9Auu21dO+fPpRqohnW/C+5tSklOBK/DUBX20FiVnu8xHc0T/An1rBo5B2i+ENO0+N gipONMVohHBbWbt4wqeDEZa4gB0NGELCRQZA4INafJ7EntVQy4Kf5WIb54oCOT+Ct3yI pu2UFPnDwqLo2DgBb1qi9z1wmJ+1sUbJtsCCeROo4OC4DrB3Y8iwJqiEvshv5sg/sxvG XOy3AuJ6oDQwNGR9hm3NmGGspi4kgJP4lPAMfnB/ZunBOlmuoX+cC4M32WlLoeYOAGPd swEszRp5rZxwIRTzF5N81LYeL4jiPmy0shs30vcTC9bqaYnp3DZ2DmfkY3uH3/DrY0iF fgCQ== 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=TqYCFphTE89qwX5r9RN/jgIceUrAGJyLboLH1gjiqTU=; b=C/uQo3rgUDsdex5Q3RtNQ5EiVYF/Wpcnl7zRcW/rT9MFKSbZZW8t2sOllyxT09pXa4 FQWLI3jyyaQpM0zc2jVj6tYCwGEKZ1239rv81UDChg4YJ5nADxqjTWIzzZxtDiPila5B UiMb5KB39OcACNJkYj21ZTiWa9oEvFGjl1pqwDbXkgNX00hL76+cxLiDiDBBnT66icjk AGzkO8IBubaS0a3Q56ZktDCpxniY7oe4hue6gbKH3HuZ35HGq4R33GRU6COx5mTK24uq 3mnN6Wxhhu+6Vykc9BmO2WY8nfPyHytc/NFyXCT5Js7GMjvm4ymeUJ8NFhqn/T2nbsa8 Mhfw== X-Gm-Message-State: AJcUukdxB4ajHYT6sj1tJmwsmp0Ycec19QlwQZ5QM5RcngRacSuMH1+G 4pw+aLkvHR/WM+kYXW4tj5tv5e9u X-Google-Smtp-Source: ALg8bN7VFNOfyipcRVN4uHadck2NF4rcy2dCIULEnDmBnNnp6tn/CxUmIVmP48c7+xPdGJUmJd7jdg== X-Received: by 2002:a17:902:9b93:: with SMTP id y19mr1437738plp.336.1545377281678; Thu, 20 Dec 2018 23:28:01 -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 t90sm44971921pfj.23.2018.12.20.23.27.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:00 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/21] PCI: imx6: Make use of BIT() in constant definitions Date: Thu, 20 Dec 2018 23:27:07 -0800 Message-Id: <20181221072716.29017-13-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid using explicit left shifts and convert various definitions to use BIT() instead. No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- 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 c0b073cf20c0..2737526158fa 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -95,18 +95,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 Dec 21 07:27:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740017 X-Patchwork-Delegate: bhelgaas@google.com 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 435B113A4 for ; Fri, 21 Dec 2018 07:29:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2985228429 for ; Fri, 21 Dec 2018 07:29:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D7DA2842B; Fri, 21 Dec 2018 07:29: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA8A728429 for ; Fri, 21 Dec 2018 07:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731476AbeLUH3b (ORCPT ); Fri, 21 Dec 2018 02:29:31 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:46606 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388056AbeLUH2E (ORCPT ); Fri, 21 Dec 2018 02:28:04 -0500 Received: by mail-pl1-f194.google.com with SMTP id t13so2096063ply.13; Thu, 20 Dec 2018 23:28: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=UyXZTOk3menKB/t8eFutGA3nZkIu5JphmYQKvkOh16M=; b=laDZnjBh2J4T2ev7D1FV58fMa8r4adUyojMiRp0SJ3Ugh4ByRxvLrmgvzHWUCdP+kD mD1gRJiYoLmAzhMcwt6Q03hCiDyV/qW96AZlDDhpVhRpxnYMxqgeOaLX2YNB6cy7qX68 TTyAMHhlheu060Br6rSsPccyVgh4nLgyxU+xuxZqZ6hK2K8gZF1+iDulI9qnGsijAPtc R3Kj+rEsW9PcLgh37LiM+kb4hIGUMf3UV/Z7Syw5lXYdcWXDd37/St4InI+jAILu/ILP xUr9TB+GWOCaW7gUoK+wvKBT7IM/zWRDjzTY+gxVpGwsYWRd+PKrKVAgvDdJPGgs3eIB Tekg== 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=UyXZTOk3menKB/t8eFutGA3nZkIu5JphmYQKvkOh16M=; b=lym7d2tmLy0ueUSLZ3CSaifYkSXxPvHwgQuuugf3g1wc8OqzZd7KyBJICdIVUIDa36 GTgCceKEryvv0A34RjSQBR32EuMBRYP7W/yhY7zKtXtYOFQjLfL/mR9FM+bZW+X4OW8N QZnh4p+ZBbcrBggaN2W3HGhSh/I2R2/U872XD5PD0+8g5hG3nlXGatc9hqujAfP324jU CT8t+ylHND32RdmYMmhBTruGTgDiIHBiNDWb1NR0P1v3KszrI+VxzWcTk/FkEt0iKz+D 1UdHoJuiLxdZBQqogO9z8DmeEgH/xN0rt2eyj1C4C3W27UXDl9f1qzzKLRGm235IhFMv SAgw== X-Gm-Message-State: AJcUukfgeN38K6KI8txEsjqSBLb70yC40D/8qYVshE/bA++OaDW8in0C uNCXrGAIgxf194bSpCMFnvDvpn+C X-Google-Smtp-Source: ALg8bN4woDopvm84fXXLBZIgM5gLLHjUS68sG/W844AnAlmgZsycDcfGBv5dKNpXSO98w/5WbH1sbA== X-Received: by 2002:a17:902:e002:: with SMTP id ca2mr1438205plb.103.1545377283510; Thu, 20 Dec 2018 23:28:03 -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 t90sm44971921pfj.23.2018.12.20.23.28.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:02 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/21] PCI: imx6: Simplify bit operations in PHY functions Date: Thu, 20 Dec 2018 23:27:08 -0800 Message-Id: <20181221072716.29017-14-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the code by incorporating left shifts into constant defnitions as well as using FIELD_PREP/GENMASK. No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- 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 2737526158fa..40d348bb9a2b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -84,11 +84,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 @@ -135,17 +135,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); @@ -163,7 +163,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); @@ -191,11 +191,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); @@ -203,7 +203,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 */ @@ -212,7 +212,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 */ @@ -221,7 +221,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 Dec 21 07:27:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740015 X-Patchwork-Delegate: bhelgaas@google.com 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 1017D13A4 for ; Fri, 21 Dec 2018 07:29:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB46E2842A for ; Fri, 21 Dec 2018 07:29:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DCB0C28433; Fri, 21 Dec 2018 07:29: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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 925742842A for ; Fri, 21 Dec 2018 07:29:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387982AbeLUH2I (ORCPT ); Fri, 21 Dec 2018 02:28:08 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46353 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388202AbeLUH2H (ORCPT ); Fri, 21 Dec 2018 02:28:07 -0500 Received: by mail-pg1-f194.google.com with SMTP id w7so2096731pgp.13; Thu, 20 Dec 2018 23:28: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=aOG8CavLyhRq8sCBntFikyTFeErNCHKkbYlORQ4DvNg=; b=TqnJTIu8I0HdwEONz46eJlxXRn76Mr445orVTvClpARztJpH9rMAlTuv7nejWztxyn DuMPpfio0T351PMzmI+JIDxpUqJsiWPVC/QDukseBDLsA7uJY4y9LSMuF/IMeZ79aT0U lQXDVgEfsi3IRrmrokm3pzsC4PeiIGKamsMv4usncYvREexnQavMulx6JA1tol6q/3Fi jh433KJiMmH7h7fqz1mg6ep0gl2nVGYJywEucavYIlLpYn8UlM05roCmyguNr/4l1DWB y8ml5bt790P5FCicXFp41bFm9uhRBD1+oSpE7Tn6x938/gVurnxl77erxV+Yc4kW8Cce Ce+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=aOG8CavLyhRq8sCBntFikyTFeErNCHKkbYlORQ4DvNg=; b=h0kCKJZoJIFuOejY8F7T0bxWtirioMzBWMhT8+/GCVXa9uvmM6PetRV0PpzUt9TGkc 8cyRLfRXsPgUakreYLHHkIkV/6EJN06CHAFw7TJU4HDtuTsdIfqwSXDWMf9V+bQBPKvr 5Lhl4NE+BCcCOnrQNm0nOv9Lj89iXBrgNZ22HwAggKKLLZ7WBWubLzYpozgRisQOAZrG +YXeX778gwOuDQWx3iRcHJsVn77n8gkqxqyRXV+0IPmYt8Q383hY1j9JeTdgryfUGTzI s2P/6HS08hIPMSExCsmcX6dPgA5/2vJJJcZHXSaI0QgCMRgf3xmFEyrkgFHD4Iu/JB3O cuzQ== X-Gm-Message-State: AJcUuke3hmI0t0/LZEVD0YrqB/0wDdC4dPT+V1Z2pnrfdyBCVnagJDrc I/XkkAnwCohIrKcxbq5Ub5IhZJjH X-Google-Smtp-Source: ALg8bN7yhNSbFck0nnNIRDg47AJKYuZqq6R/Ffo/4KF2NT1W+iFq6lGG7eFQhBRw7NMV971VW8LGHg== X-Received: by 2002:a63:4002:: with SMTP id n2mr1316312pga.137.1545377285389; Thu, 20 Dec 2018 23:28: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 t90sm44971921pfj.23.2018.12.20.23.28.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:04 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/21] PCI: imx6: Simplify pcie_phy_poll_ack() Date: Thu, 20 Dec 2018 23:27:09 -0800 Message-Id: <20181221072716.29017-15-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify pcie_phy_poll_ack() by incorporating shifting into constant definition and convert the code to use 'bool'. No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pci-imx6.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 40d348bb9a2b..ddab1859a07e 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -91,7 +91,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 @@ -108,16 +108,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 Dec 21 07:27:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740013 X-Patchwork-Delegate: bhelgaas@google.com 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 2DBE6746 for ; Fri, 21 Dec 2018 07:29:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14FBB28433 for ; Fri, 21 Dec 2018 07:29:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0928828459; Fri, 21 Dec 2018 07:29:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A794C28433 for ; Fri, 21 Dec 2018 07:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388280AbeLUH2J (ORCPT ); Fri, 21 Dec 2018 02:28:09 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37449 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388220AbeLUH2I (ORCPT ); Fri, 21 Dec 2018 02:28:08 -0500 Received: by mail-pf1-f194.google.com with SMTP id y126so2187394pfb.4; Thu, 20 Dec 2018 23:28: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=eae5kd40WjRlq9zOByiDPPD319NoPNuivhFx9H6fzrQ=; b=GRg0NhYFHUyygYkVSFXYtmsieJ+LveULDsOkgKglG8BJJVcPiWV9qMrCq31CoAFk1Z MHM8v/PiYCKo7w1Tb7m3EkmnXdDNh9ZvIDRY/F8Wz5C5VgeCxaCnU12kvw/jGjmhnSzO wtYt+YK0q45NjRE/ywjsiAayK5YQAD+xUIC1t7Mue9nhZSqSpmqYRvyEcabxZwhqfnYA lT6e8u/Vm11g2k9LfxAQLE55+6O0LX8AulBPIKLDJIi19qYvNZ0H2MSeAY9RAKbvifqS kmkX5c4t4XCA1yU4oeTdqUyPOPGEDm937Mwk7tu4XyuT/m/VMXNCoutY1/CZCtZjUHYi Z2ZQ== 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=eae5kd40WjRlq9zOByiDPPD319NoPNuivhFx9H6fzrQ=; b=uks/i5fj0egDeptWv8HHlZkT9i9YbNPyld8Eygrb4nXziWsIMmNVzMzh9f7SHOzbO1 vhQVHsoZtBqPaiKfgNv7YGnFewttRFLFgvtgV5U7Lamz/enCKeP4Z8iN9JtLXN7BGuZU 8S7rlwzOSst8wiPakrXZc3i6wmwWH8ZniCkQS+zBgAIIkf3IlLPe70D7be0fL6Rjcxw+ i2MWh+ALNMPahT/LST0FiesLQKmJOU2b6QidGc8S2bnwBOvVckeuRf3Mf/iohCtr0LGZ shgA6wBjKvV1Jw8cp6LQU5C7IaWYSE08bMOoLOu4ovcdQAFa9tQZ+o0DH73s72pU8jD6 I40A== X-Gm-Message-State: AJcUukc7rsZfvITEk9zFWSZ8fgs6Mq4YlbHpADLe39HjzCpUx6kvy4j6 uwBrEfU7G4/h5LicNnx9DbNXMoxA X-Google-Smtp-Source: ALg8bN4Apu6v2hERGWDIotDPk7xa48XrCB98F2x4qGIaU6XU06Q/pdE8/BPYRN79uXOW1j3j9qBvIA== X-Received: by 2002:a63:20e:: with SMTP id 14mr1327440pgc.161.1545377287259; Thu, 20 Dec 2018 23:28: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 t90sm44971921pfj.23.2018.12.20.23.28.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:06 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 15/21] PCI: imx6: Restrict PHY register data to 16-bit Date: Thu, 20 Dec 2018 23:27:10 -0800 Message-Id: <20181221072716.29017-16-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PHY registers on i.MX6 are 16-bit wide, so we can get rid of explicit masking if we restrict pcie_phy_read/pcie_phy_write to use 'u16' instead of 'int'. No functional change intended. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Fabio Estevam Cc: Chris Healy Cc: Lucas Stach Cc: Leonard Crestez Cc: "A.s. Dong" Cc: Richard Zhu Cc: linux-imx@nxp.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Signed-off-by: Andrey Smirnov --- 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 ddab1859a07e..98e3730e75fa 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -152,10 +152,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); @@ -170,8 +170,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); @@ -179,7 +178,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; @@ -236,7 +235,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; pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | @@ -547,7 +546,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; switch (phy_rate) { case 125000000: From patchwork Fri Dec 21 07:27:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740003 X-Patchwork-Delegate: bhelgaas@google.com 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 BCB4513A4 for ; Fri, 21 Dec 2018 07:28:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A22BA2834A for ; Fri, 21 Dec 2018 07:28:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 953F128372; Fri, 21 Dec 2018 07:28:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41A472834A for ; Fri, 21 Dec 2018 07:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388414AbeLUH2M (ORCPT ); Fri, 21 Dec 2018 02:28:12 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36708 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388341AbeLUH2L (ORCPT ); Fri, 21 Dec 2018 02:28:11 -0500 Received: by mail-pl1-f195.google.com with SMTP id g9so2112548plo.3; Thu, 20 Dec 2018 23:28: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=t+Ph+iIWzFZpNu9UO0nka2W/68YLTAo65CCi/cOl030=; b=j0FQH0vp+t6h9imxvu+6dBbyxK3d4Ipy5RIH8JbEGIqHCo8P81v3vgw2YU2UpunsOS Fo+msqpMgIKuVOXKJJg0M4q2lLh7vdIJj0mx4eF4scSJAYpEotocf4aVc5Eojw53LC/Z mAsKiH3OGVkJ6vc90Wnz50ZWgMB5ZowlpGOVmoiqKORVay+S9L/F3PZ3/Ks+Ih9kg0Hb gkDFAafLkxizxQyd/zjfmOTpxkaTGxlmLuZTJ52QBwkfxcxNcH2udLXl0ZhWZDlBA3yx hyCQICAPgGHyPVo8JDKxgDjxv8/jDulwG+a2jXSbC76KGqfUeVZ/c0og3vuQcqRF6gjM ZgZA== 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=t+Ph+iIWzFZpNu9UO0nka2W/68YLTAo65CCi/cOl030=; b=oE0LphgI0H3RYhI/6WR+8ovOni0Yb2dmFmhvmX2ExvyX14nKvtDBg4xBQp8Q8yuoJa SgL+37BDBdWxMSqfOpHnAELoCQxQLoNyQt+0WTpAMo9CE82xtylQcmZoZz+0E06i8wYU 2CF5fl2jIloR+q2rkrnVsVvQgkhgSNeLo50qlmdN9/lBxCQFrkAEQajrFdXpVdw4SeyP Ec7gDB/YJ0eTtOmnGbTXd4ya2v66rNHfEXFLXQm90JlJrH4Q6G+rJ4toBLKX8PcFmdR2 eiNLjjC1br3Os8GX4qZH7IWxT9lCl4eN4HAIXtO5wSH9KNp7yjVrm7NO5F1CRZjP+U+8 ALNw== X-Gm-Message-State: AJcUukfmh5KlJoqq77vMR9bQlgcu3ORuV11bRGTHgOBwtVQj86rfnINi PQ+cQyYwWi+oZCwPCGlD8g5XZHKq X-Google-Smtp-Source: ALg8bN71+thEST0OsUXu3TFyPC+dUURS3WkuHuuBEe7LNF1pOVQoxUDkkNhtWIxNF1diH4o8CzIqag== X-Received: by 2002:a17:902:8641:: with SMTP id y1mr1406449plt.159.1545377289324; Thu, 20 Dec 2018 23:28: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 t90sm44971921pfj.23.2018.12.20.23.28.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:08 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 16/21] PCI: imx6: Pass data to dw_pcie_writel_dbi() directly Date: Thu, 20 Dec 2018 23:27:11 -0800 Message-Id: <20181221072716.29017-17-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 98e3730e75fa..bade9d608605 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -155,7 +155,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); @@ -163,8 +162,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) @@ -202,8 +200,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); @@ -211,8 +208,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); @@ -220,8 +216,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 Dec 21 07:27:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740007 X-Patchwork-Delegate: bhelgaas@google.com 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 06F3213BF for ; Fri, 21 Dec 2018 07:28:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E198728329 for ; Fri, 21 Dec 2018 07:28:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5A1A2834A; Fri, 21 Dec 2018 07:28:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A0F42833E for ; Fri, 21 Dec 2018 07:28:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732394AbeLUH2n (ORCPT ); Fri, 21 Dec 2018 02:28:43 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:42089 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388220AbeLUH2M (ORCPT ); Fri, 21 Dec 2018 02:28:12 -0500 Received: by mail-pl1-f195.google.com with SMTP id y1so2098129plp.9; Thu, 20 Dec 2018 23:28:12 -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=os5HCIWWSeiXp86kNFBUOm5Js1nl9fgasgDsX5LPT/Y=; b=Kj97J01vYaRO2Tsth4vmAsL09eUm8ZfT+Y1IlvimyYHPKsSNx4cwmrtBkpYQB/pyrY L2QtTUlnNmLrAX6TAqZr6yne1yTCd7kLgANDnmAiDbBQ+jDHoohFzgZOxUlnDHv54PDr p/0c8okKY+ylW2UNiyjZoYDn0AP/jOhvFNzjPn5SlLTkBMhpXeuShdh29XLKsxy2//6M x2UDRXm0qvBnzH1AQz5M7CD4goUCjur5DPjsL2jX1PMz9RAxheMINSdKvTaZpiUJOT3E 0jBzNJMp0nMuxAbU6/aBF4PL85YI9mSyYL39bKCxPVSI4Th1puQCwHYDr5+7U9jYU7CT KdOA== 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=os5HCIWWSeiXp86kNFBUOm5Js1nl9fgasgDsX5LPT/Y=; b=NO8vcNdo64O/524uHyDp9Ve8CsLyhZedNJWsV0jRJ6g8ABW5yiyHSMbQJEhEaAjhDg YLJ1LchlPjNRNk/+QmiHrHRn8CHGI2vz1zgLyzWkrPFOy0rW2rfqjPfLgz2DGY1QrFzZ POZXtZLDyHTKeeNUWPJOne7HksuDBjWAOfRS7KtTAM3soGOBCqwPwsd7cR7KFCvceEC1 IRKM13f427EDLVOawwKJyPwq88gjS8JTESExLhl2y1B/ZZA/lDBECWqVLiO/w+81HW9Z vKSv/RZuVTIbnfGsBi6yNbDZstAbAA76Qy5JITO1qnNJwY1cLPNN9vXZp8Q6TS4zWnTn FUGA== X-Gm-Message-State: AJcUukfACISpaNouh3ZVdQgfbyDAG3kOSlzFTS/ltEvRekmLmZECQJel p2iac0jE+hUUk0ZCE/wLVtk9IErs X-Google-Smtp-Source: ALg8bN4z4ZU5nz72DBY5q8YOvRp5wW78zQBbybW7pRGQW2hcy8aJw7wfTvss0oEMNvtfTdMs0MWtMQ== X-Received: by 2002:a17:902:d697:: with SMTP id v23mr1388203ply.261.1545377291783; Thu, 20 Dec 2018 23:28: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 t90sm44971921pfj.23.2018.12.20.23.28.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:10 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 17/21] PCI: imx6: Use common mask in imx6_pcie_reset_phy() Date: Thu, 20 Dec 2018 23:27:12 -0800 Message-Id: <20181221072716.29017-18-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify 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 bade9d608605..38c8e8baa077 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -230,18 +230,18 @@ 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; 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 Dec 21 07:27:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10740001 X-Patchwork-Delegate: bhelgaas@google.com 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 F1CC613A4 for ; Fri, 21 Dec 2018 07:28:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7D8128329 for ; Fri, 21 Dec 2018 07:28:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBB862833E; Fri, 21 Dec 2018 07:28:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A8B128329 for ; Fri, 21 Dec 2018 07:28:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388484AbeLUH2P (ORCPT ); Fri, 21 Dec 2018 02:28:15 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44230 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388415AbeLUH2O (ORCPT ); Fri, 21 Dec 2018 02:28:14 -0500 Received: by mail-pf1-f196.google.com with SMTP id u6so2172378pfh.11; Thu, 20 Dec 2018 23:28: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=5ARpz9jknH5H4OT3/qhVId8qmQoNOpINqmDP2FaaZjU=; b=NIAPuSL/hJ9VQhEPvORXCppBEwzMPcpOj+Yz1GdpGMptpcWx6R/lfmtmqP52n7x6NE Y/jNRWGJhUvcF0oks69JriSQNc4Q6xDTQT6Fjn/VsLFiL+sYTznDXO4g4p27zWTzfudR ItnCJqyGMARxqtTyEOSOVdi4pfnje11fMcLawX3vBpuKhfQBlIbmSlcrW/RXPD0xdapR I5oFZvehmIFXXCyOFEpl4FbGq7UDdC+bB3/jomelhAUpNK7YMv53b7wV6vsnbMPFqcXJ tUM0upyMAiRySpzkZeTtBu6ngv7iKvq5euUG9Fg9pEOWWVtvYw+OGcak7W6Ln9Nhtu2g C3VA== 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=5ARpz9jknH5H4OT3/qhVId8qmQoNOpINqmDP2FaaZjU=; b=n/7vH4gSIwa6mhyf+SsnV4Dc2aA+N2edmy5AoO1ojQm74ME8KpacPMuqVezw4vd+pX /6jgOhUS4EKsKrzZk1q+9J/axgnyGGSS3ag8Rk/AayfmN5YpxGzTzdf8kE7zvDlYSaRG dMPuHTD5Xmom8Zvck4bZVw+xbfuW9NSEwyAwUW4UlnoW7xwUiot/7d+6P8vXCNuTY6ta pOZafmqBYy4N+8BGNLuFrYwV28KnTT+JKrfxgryUCVQrWSr3r2onQawjoJWjhqgC8lWA HqpcbEvbYsVenJqJqV+o5N2+LDa48ni+vWMI4yNqh8IVAukGdmAUcqMmq6a6Phz02CKa A2uw== X-Gm-Message-State: AA+aEWbkuM4I3BbOzehEnuSz3sb0ORY+scFQydHfxM83tTRwmtQj27bA h8XYDXjyHGpLK2inkVxgxx4kWrx0 X-Google-Smtp-Source: AFSGD/WHbfSdl51UrygLkZMS8SUXS+WuEQRRNZr7+xB+nhOhArYgwZi+iDHx+rhFP2zfPhYRg/P9+w== X-Received: by 2002:a62:35c7:: with SMTP id c190mr1466498pfa.76.1545377293403; Thu, 20 Dec 2018 23:28: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 t90sm44971921pfj.23.2018.12.20.23.28.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:12 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/21] PCI: imx6: Simplify bit operations in imx6_setup_phy_mpll() Date: Thu, 20 Dec 2018 23:27:13 -0800 Message-Id: <20181221072716.29017-19-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify 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 38c8e8baa077..678f5fa85e12 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -96,12 +96,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 @@ -565,16 +563,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 Dec 21 07:27:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10739999 X-Patchwork-Delegate: bhelgaas@google.com 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 76516746 for ; Fri, 21 Dec 2018 07:28:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E0A226255 for ; Fri, 21 Dec 2018 07:28:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51591286B3; Fri, 21 Dec 2018 07:28:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4370426255 for ; Fri, 21 Dec 2018 07:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388415AbeLUH2R (ORCPT ); Fri, 21 Dec 2018 02:28:17 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37872 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388601AbeLUH2R (ORCPT ); Fri, 21 Dec 2018 02:28:17 -0500 Received: by mail-pg1-f193.google.com with SMTP id c25so2115489pgb.4; Thu, 20 Dec 2018 23:28:15 -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=TOnTTJb5k0hJqk9drUFS28Vo1VkvNAjAcTVESkJjprE=; b=a9+tbe7CR5UO46XozmMgmDfw5gfEdE1Cgh/dugA1o/gngbng/PNMICEPKMOiEGVoE/ S0Ury7jhXQ3IZSU3XOlfgsUgm3Gm+r8Y+T9uVMR0xWRL3q11dZRUJOauZzRLcULGHUDT GpL0O2KCZ5lokYMl7OSIMwYg3ON5jlbc0hYt1mPV854yc7ORVA2U7BrX2O2Ygl15xElB KG5R7F6pXhg1WnrRHBZX+ZeX6Jqp6JTXxB5Ze8oqeWbYGxS90UMK7DbyjxWWs0yV8CQd xqSncCapvzUcfhyzzvyqVR+ZpsNwczR1ZHh/6rZbf++CF2o6d/rgeCQd2yNlpaPcsYd1 Gqgg== 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=TOnTTJb5k0hJqk9drUFS28Vo1VkvNAjAcTVESkJjprE=; b=jXCgzulPJqLJKYxM+6zSyCqOyl1NwPdWb6DdVFrLWr9UqgCzdLZmUTaLU2rPOlGzZv 16eI06qfTTy0c8A9gxv7IBW+Yv8ZZzIz9TZ7GDgegc11Ijhay2sNqUwnBJGHEI8D+bsu 43aczfADV0wwhcMcn9SB2E+/d0q9odHF/9M8DjPNaJp82rsdotu+HEEecCWeFV7yhr+l XcPH1QGcSwSBRM/yivaFNqdKJTgJQgsfHMS5SxwVAmlqK29nBWCiDSYvsQBremBu0oRO elwQ3L5ud7tnDEZh575Y1fsCpy135YxBJVshGwU9xsZYuUatFsvgPoKPwMQ3EWBzcV6E Ne2w== X-Gm-Message-State: AA+aEWY2eJKBZ7pl9QvVfvi9K4z9HPGlKWO/dYkJpGT+WMKx6hinfr94 KA3eIP7Z+6r57qZcJWLelA5hE8h7 X-Google-Smtp-Source: ALg8bN50gFFgY3nBEzPGNZnloJzl5Z8OSiIYjw1gQKEwJYi3/td0fh6QxZjdAqqMWVWlHBHpzlhj2A== X-Received: by 2002:a62:15d5:: with SMTP id 204mr1421947pfv.103.1545377295233; Thu, 20 Dec 2018 23:28: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 t90sm44971921pfj.23.2018.12.20.23.28.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:14 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 19/21] PCI: imx6: Remove magic numbers from imx6_pcie_establish_link() Date: Thu, 20 Dec 2018 23:27:14 -0800 Message-Id: <20181221072716.29017-20-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 678f5fa85e12..2b312f287fd7 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -79,6 +79,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 @@ -688,8 +689,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 Dec 21 07:27:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10739997 X-Patchwork-Delegate: bhelgaas@google.com 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 19745746 for ; Fri, 21 Dec 2018 07:28:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 003F626255 for ; Fri, 21 Dec 2018 07:28:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8279286B3; Fri, 21 Dec 2018 07:28:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C22826255 for ; Fri, 21 Dec 2018 07:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729744AbeLUH22 (ORCPT ); Fri, 21 Dec 2018 02:28:28 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36754 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388661AbeLUH2T (ORCPT ); Fri, 21 Dec 2018 02:28:19 -0500 Received: by mail-pf1-f195.google.com with SMTP id b85so2188412pfc.3; Thu, 20 Dec 2018 23:28:17 -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=ceA3OOHkrp0/rBgfzfMs4oo9EwOqW1+SB1EA7e79xlA=; b=TLiKURRBbXaznllUhiqXzwJmMzNw9zNpxqRqosDaxG7rXC5+tiqPlP5vHq/TDxHkEg pivODxC1imDMsSrrqPKMbzS25+VaONbZAm834Vt+t/7BONwc++ZWNO1HVALX+Lseh3gf RUX95M11hEaQ+QrCxmaJ+pwo2VgmV2oPxHMhKcmnkkRq7Ry/1roNPNKdKif5NZO0XfRk xWbRoeFMmOltYYW0BV/y0jri+x2f01mptdX6QMsJ5tqWAQqgMQWl6BGaePye33jHOyoZ S1P8Cj2+BuNOwzltRmfkJTTq6DwqwFyAIt1AV/OJOECI0EopA5qGxpV+2/74tMSoSBZi jVxg== 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=ceA3OOHkrp0/rBgfzfMs4oo9EwOqW1+SB1EA7e79xlA=; b=E9M4WYGp121P37HElRvHqN7885mcBz+0Na9pnhqtr7eyEaZHztQuO67D64/m6RiNYk FMP1d2ASdAglhs3rT+0vOb1jxo1wUA0Z1g9PK6p0H2RIKwHcSHNzZ7AKKcn5HypLKPUl jnU4KELNXHFOVIpHY+xDPrZOVPLTKgZ10Jlr3qn9uyeKAbxyIOrQp+btY1gCA0EHKam+ myQ03Dk2L4tePnNTfnqZWXNFZuWOtUbq8Ctn5JkPbfPeegxdbe39VyahC1a+lfuJD5z/ pWwZnaqXDBzqlGByCAzPLWscxBAKbVAaHgSpF032ERa3f7MbjszB4rgh2wlxoqr/7rMf Nkhg== X-Gm-Message-State: AJcUukcLciaZZjUbBpY9iYmtGSM6yPb/ULw/m2QjYu9rMWQS8yOq1giE DCdBt1g6IA57t1pkNYZXBNmWHZDM X-Google-Smtp-Source: ALg8bN5zSz1wxg+PBVvIZ84CcYmXtIjNqUGxU8XxDrd1F6hHjuSlR1HFpP0O4hXHsxF4/BZSSjKQxg== X-Received: by 2002:a63:a611:: with SMTP id t17mr1326464pge.338.1545377296834; Thu, 20 Dec 2018 23:28:16 -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 t90sm44971921pfj.23.2018.12.20.23.28.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:16 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 20/21] PCI: designware: Make use of GENMASK/FIELD_PREP Date: Thu, 20 Dec 2018 23:27:15 -0800 Message-Id: <20181221072716.29017-21-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Andrey Smirnov Acked-by: Gustavo Pimentel --- 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 Dec 21 07:27:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10739993 X-Patchwork-Delegate: bhelgaas@google.com 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 DD1B213A4 for ; Fri, 21 Dec 2018 07:28:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C343E26255 for ; Fri, 21 Dec 2018 07:28:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3F93286B3; Fri, 21 Dec 2018 07:28:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B4D126255 for ; Fri, 21 Dec 2018 07:28:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388601AbeLUH2W (ORCPT ); Fri, 21 Dec 2018 02:28:22 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:38951 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388687AbeLUH2T (ORCPT ); Fri, 21 Dec 2018 02:28:19 -0500 Received: by mail-pf1-f196.google.com with SMTP id r136so2180675pfc.6; Thu, 20 Dec 2018 23:28:19 -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=8dhLzSnPx3HKyxwtCcSuNx1W6yfU30Y/Wfx+1/N/Vew=; b=bLSqRc9dwd9ei5Ve+zw/9pLETxqpu8pBnK9BeL8a2X3DonypYSPOmVeYpocbvhAmZi OblCtyzJyjuoDulFLvvONYRpinSVdrHXiYRe7vPro4Eq5n7SH0FsQcTZiOh9xsv09uYF yroXC7ScFFbGTjW9qaa+z67bAKFqMkdzQZvLO4G9Z2Zw2JfJKj2ypNX5GlKIhEuhKqWw JUO1ml2sFBMha9Tp2dl9KpDVUqhf9mTY5MutviY1sIP6RFa3R3fuUL+F8d4h5J6bl6A/ JFkOcIQwYFNHwR61CL2e4DT/DxT4PmmtA8Hct8PEsbpyqA/QxKlMlYUPa5xeMvs1twYZ dGZg== 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=8dhLzSnPx3HKyxwtCcSuNx1W6yfU30Y/Wfx+1/N/Vew=; b=K6tIIA9oWiO0dynSyk+5Wdo7dDP4gcIpEoLAV6u86LZ56RMBSSajs5VAmmlaUyzLYW QDHLGU0oBy58a4M7BrGy6gq2xO1lKl9RY5VcP+D4S8+oUgE5ur5RjdMgjLrRNDUPvgRE cXCB0Djj9VwASVtTIBG6/gZAOiirQGdZTxpz6j2cE4yjm5zXzbyQ7S5H6C9YZKJqRb8C 6cprfusSkZ+hAjJ3iUoe+Sfg62kvLqFXSu8Obd1vimOwy2vdZCdXwgnEK61wKo+BzSZQ uMJp6j1T8AG7QviMW1f6qa864NrvjVQFbpiG90yFN26QwOXjwGgUZwGuz/U3h2Y7LciP TiMg== X-Gm-Message-State: AA+aEWZKAW8c8u9ezmAx4gtvX4hKBkwZ9HEc4Fxp7ltMyDLdTDn8l+QC DmRd2yYacNgayU2idXVZ/v4pNjZr X-Google-Smtp-Source: ALg8bN7J7z15Vw9jy9SjMTeALt7WAUznlJJWop7q8AhJdKts8Qxw224THgFRSQek6rXMFVsm083Vkg== X-Received: by 2002:a62:34c6:: with SMTP id b189mr1424691pfa.229.1545377298459; Thu, 20 Dec 2018 23:28: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 t90sm44971921pfj.23.2018.12.20.23.28.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Dec 2018 23:28:17 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Fabio Estevam , Chris Healy , Lucas Stach , Leonard Crestez , "A.s. Dong" , Richard Zhu , linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 21/21] PCI: designware: Remove superfluous shifting in definitions Date: Thu, 20 Dec 2018 23:27:16 -0800 Message-Id: <20181221072716.29017-22-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181221072716.29017-1-andrew.smirnov@gmail.com> References: <20181221072716.29017-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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)