From patchwork Fri Jan 4 17:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748677 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 A5F5F6C2 for ; Fri, 4 Jan 2019 17:52:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9958E285B6 for ; Fri, 4 Jan 2019 17:52:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D849286AE; Fri, 4 Jan 2019 17:52:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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 3AE17285B6 for ; Fri, 4 Jan 2019 17:52:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728017AbfADRtn (ORCPT ); Fri, 4 Jan 2019 12:49:43 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35682 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727883AbfADRtm (ORCPT ); Fri, 4 Jan 2019 12:49:42 -0500 Received: by mail-pf1-f193.google.com with SMTP id z9so18624653pfi.2; Fri, 04 Jan 2019 09:49:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SKJa7zEhO/trHQqEjEW1IcZtpd/PYQwbclM+tRkTBpo=; b=oKAjY0PKvzJmTqSAvtXWedrQvqbliB4L1vI4Hhc5nAPWIqnFLyUoscPOLjJIvzMusj 4vdIm1sPATs5dxmZryGBlgT1rclkEmznR08UXj1BblyRl3P8bNjQElqb/jyaSSBZzXok ipoWetngUFR/b3oT9yLNp1UQYB9Ba7qUQB8ldTW+pU2dHJ0V9DNdAJavyz464ViB0qB5 RvTpZzPKPUoUSxwbDHNi2iH3FM6quo7QV/zd3UAJhHj4K5cF+hErydcWKT4YApELfhSD 0KlF/1jY5WiHsQPIBEht2JkAa2F0MLDKRNUNsbPFSffS26/BAvDxYFdY9oS4UXrU5uI/ PPWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SKJa7zEhO/trHQqEjEW1IcZtpd/PYQwbclM+tRkTBpo=; b=Yr7xs/u//WQc15dgDHlfeFwx30SiGRAmXPkmFEOeNq5kb7kl+ujtjrzMNNHk4b2K6a 7S1TiRxwdTLNS9+upo7+vMiFjaU3rxAPi1gKFznJHKtD4HYUXcHIbR8Yk7lv7N8+kr/o IUQy7/dORHOYhRyeW2HgXQmv6S5YzuyK93UPSZdgIkqosnuCEIYs46k6R/tx2Z+URe/2 Nu71IyP8hN9mpGiuFcxSOxnl2A/afwZYq4eYbRm8Zp9LIOYjOOOsGpRRkO7XZlqRDlNG 5oMABNCKfFgOzExx3qoICOy/o6jPXUjVkoNg59rm/sYjTNNbGa40NbqQrd8THo1XMC/m aDHA== X-Gm-Message-State: AJcUukfnmFcuE/CURy7zmM1/JaS9s552yVpLRYdaExRKinkoFqjkBXo0 Cruio/e/hAxQWAGgGL6sYp1GGnKJE/o= X-Google-Smtp-Source: ALg8bN5QBpDrJLeoSdKMrCQL9CbxLzeC6h/BT2qr3lg4ES+HltYQyU/0jZrnnT77QyM+EIwTAaS3KA== X-Received: by 2002:a63:a401:: with SMTP id c1mr2443713pgf.403.1546624181277; Fri, 04 Jan 2019 09:49:41 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:40 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 01/20] PCI: imx6: Simplify imx7d_pcie_wait_for_phy_pll_lock() Date: Fri, 4 Jan 2019 09:49:06 -0800 Message-Id: <20190104174925.17153-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 4380ee797c04..c73c7a6a4c55 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -86,9 +86,8 @@ struct imx6_pcie { }; /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */ -#define PHY_PLL_LOCK_WAIT_MAX_RETRIES 2000 -#define PHY_PLL_LOCK_WAIT_USLEEP_MIN 50 #define PHY_PLL_LOCK_WAIT_USLEEP_MAX 200 +#define PHY_PLL_LOCK_WAIT_TIMEOUT (2000 * PHY_PLL_LOCK_WAIT_USLEEP_MAX) /* PCIe Root Complex registers (memory-mapped) */ #define PCIE_RC_LCR 0x7c @@ -459,20 +458,14 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) { u32 val; - unsigned int retries; struct device *dev = imx6_pcie->pci->dev; - for (retries = 0; retries < PHY_PLL_LOCK_WAIT_MAX_RETRIES; retries++) { - regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR22, &val); - - if (val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED) - return; - - usleep_range(PHY_PLL_LOCK_WAIT_USLEEP_MIN, - PHY_PLL_LOCK_WAIT_USLEEP_MAX); - } - - dev_err(dev, "PCIe PLL lock timeout\n"); + if (regmap_read_poll_timeout(imx6_pcie->iomuxc_gpr, + IOMUXC_GPR22, val, + val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED, + PHY_PLL_LOCK_WAIT_USLEEP_MAX, + PHY_PLL_LOCK_WAIT_TIMEOUT)) + dev_err(dev, "PCIe PLL lock timeout\n"); } static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) From patchwork Fri Jan 4 17:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748675 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 2EBC213AD for ; Fri, 4 Jan 2019 17:52:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 217B9285B6 for ; Fri, 4 Jan 2019 17:52:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15FE9286AE; Fri, 4 Jan 2019 17:52:04 +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 B26F0285B6 for ; Fri, 4 Jan 2019 17:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728391AbfADRtp (ORCPT ); Fri, 4 Jan 2019 12:49:45 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45393 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728236AbfADRtp (ORCPT ); Fri, 4 Jan 2019 12:49:45 -0500 Received: by mail-pf1-f193.google.com with SMTP id g62so18614636pfd.12; Fri, 04 Jan 2019 09:49:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qGsfwtEO4Mu6yENA4Q+2w4zzaj5XitiKPr8jlGDyGeo=; b=YxuskCBM45AXemDIJ2J/t1aM4U212J7AUmDeYvPZaIXjSGh9cy7GbOd7yfKc/NYuHh t9oivhxz5ZRzufDm1+dfzLGwj1nYYbWBk29iZbo+1TJU/DHUDlzRFzmRIolbi6ntWDan WOfcXmgxq7YT/zJqs4TIYnUv4H5sYKi8o1PeBu/L8OslxCZ/fXzvjWOB0vZcPNHIzr6A TjOZP25L4PpmSj5aqL6oeX3sPBmmZ7ZEQawAdNw7NTiJKME9qVsyOoy93Hf4JBiWoV+p VT9PnQR00RzoWy/fQFhVVMKIX4P035yXvE2SeLImzJ3lyXeI+xdpGko1hh0VKJRqnvtC uPlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qGsfwtEO4Mu6yENA4Q+2w4zzaj5XitiKPr8jlGDyGeo=; b=uf5b+4uqkF/Z3nakCY4uv7NtXFPllyCJEMpLfatc39QzAb7oWR6+NRDcamE3NVeHe8 Rgss7dueX2N4HAZRkepFL3fPa/fTB7GBM4lfrFSLIJj0W1/bMJRf5KignqHSjKeE+bZA rS8257YfLdByR2sguuzWHpaUnAqaOUnLR+X/bLeaZHaHWf6uLYw73O03D63Khm38+2nf 93i7vWX8ucurHGXY3Lx3vOn87HZ2+/Sl/5u/Gx6fOBzLj0z3OY+UEgGFWNaMZ4pEHwP4 DMHVppjLcGrLsjeLf+jfYjruq7DsvH49Fp9aLwQmGfVU12EIUt3JYEeyk9bjfpt28zI+ KSgQ== X-Gm-Message-State: AJcUukd4L4CE0jnTxfi9bqGM6f5WecFgUa8EovLleFoRoFfmQurUKYIA mPmlEdj2n8Y3U6z9RD0tOysjgJyVNPE= X-Google-Smtp-Source: ALg8bN4hDTKnyz/RSy+cC/+oLPKwkfJ8lmWA+5xUtKcgLiApBqTMtrA3ryaQxQYLrzSgPDJfaCpfPg== X-Received: by 2002:a63:d5e:: with SMTP id 30mr2431937pgn.54.1546624183460; Fri, 04 Jan 2019 09:49:43 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:42 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 02/20] PCI: imx6: Remove redundant debug tracing Date: Fri, 4 Jan 2019 09:49:07 -0800 Message-Id: <20190104174925.17153-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 c73c7a6a4c55..491a93a02c80 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -677,16 +677,9 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) static int imx6_pcie_wait_for_link(struct imx6_pcie *imx6_pcie) { struct dw_pcie *pci = imx6_pcie->pci; - struct device *dev = pci->dev; /* check if the link is up or not */ - if (!dw_pcie_wait_for_link(pci)) - return 0; - - dev_dbg(dev, "DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n", - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0), - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1)); - return -ETIMEDOUT; + return dw_pcie_wait_for_link(pci); } static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) From patchwork Fri Jan 4 17:49:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748671 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 148856C2 for ; Fri, 4 Jan 2019 17:51:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0718B286B1 for ; Fri, 4 Jan 2019 17:51:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF507286BD; Fri, 4 Jan 2019 17:51:58 +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 8D49E286B2 for ; Fri, 4 Jan 2019 17:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728617AbfADRtr (ORCPT ); Fri, 4 Jan 2019 12:49:47 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41972 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728595AbfADRtq (ORCPT ); Fri, 4 Jan 2019 12:49:46 -0500 Received: by mail-pf1-f196.google.com with SMTP id b7so18618904pfi.8; Fri, 04 Jan 2019 09:49:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KJzDYEASCtJoBvSDPXwzAPQP14rP9PAwK4xPdCOMwW0=; b=nemLFnIamffqdBky0GXQXY3CwxeEZ6YWQvEdffEfXhg1yhDLxnXlcalOt573u1sphT MQA2tC0oNIURJ61ez6iZL53jSASIHY5+LzZb90k4qAmV4XRPeyI/P5VXpBL0QiKy6CWi ueaQzXxxy0vHwwxqoZXYOjkhInhi70mODbn0ZiLqifwqLK61gAA/ee3HcRfIKCBNnoAa EABmaBKKY+l00GJLewcwRGIIO4t5/9fCCwcbrrWvzAIZcZBCXpU6sOgTCp+XXZKJA3LS kU44lTNF6hmLVyGYszi9bl4yiX97Sr2l9Shz7uJinixiBQMWR/OkHqhDmvbdw5e9io5M MA+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KJzDYEASCtJoBvSDPXwzAPQP14rP9PAwK4xPdCOMwW0=; b=Tlwtzg4yxF2kaU+mGwhY7CrJV0vXwBYn8xdEeqPxoWlFoo9r62I1wyacczfME0WH3r pmEVHSwAUpAB6pNNg9TkWWMf9OjTBW1B8v1ATkniIRa8vEcorLnax3zAx6h6bw5sL+eH FhspVkGLFTioe1RiLHViviQNX2CwBo8xlJvMarOg9lTn10Bi+LEsAJJes6NcLBaiTGxX mnxZx3Ekhv6+ucCxO1QTQpxb3T5L/luDdV6vQYgJWW7VdC6zIdbw4a4HP7/mof8Tr6wA 2U10a9rcZm5heUz3szGCtHs6DLilQoGbW41FMipFv6353Lae+eQGnLiFeMMT0dStufJT p6Lw== X-Gm-Message-State: AJcUukePDilYMzCiX4ncYl07eTAdGPmnxdyuqEQ/3QnQ5+mojW9yKlCA rRA0pdloBtyN2dcrhOOYhXIxunXQ9mo= X-Google-Smtp-Source: ALg8bN62Z/ONTKavQulh6umuVA7rLaQLdKNV4XVr/H5+FtFegah5dPfF4bl9v0EW0vr/zUZ1sJ9Pfg== X-Received: by 2002:a63:9b11:: with SMTP id r17mr2459416pgd.416.1546624185485; Fri, 04 Jan 2019 09:49:45 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:44 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 03/20] PCI: imx6: Return -ETIMEOUT from imx6_pcie_wait_for_speed_change() Date: Fri, 4 Jan 2019 09:49:08 -0800 Message-Id: <20190104174925.17153-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 491a93a02c80..a81edfac9974 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -698,7 +698,7 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) } dev_err(dev, "Speed change timeout\n"); - return -EINVAL; + return -ETIMEDOUT; } static void imx6_pcie_ltssm_enable(struct device *dev) From patchwork Fri Jan 4 17:49:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748669 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 582BE1575 for ; Fri, 4 Jan 2019 17:51:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 47D8B285B6 for ; Fri, 4 Jan 2019 17:51:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B8EA28668; Fri, 4 Jan 2019 17:51:56 +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 DB03B285B6 for ; Fri, 4 Jan 2019 17:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728644AbfADRtt (ORCPT ); Fri, 4 Jan 2019 12:49:49 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45400 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728638AbfADRtt (ORCPT ); Fri, 4 Jan 2019 12:49:49 -0500 Received: by mail-pf1-f194.google.com with SMTP id g62so18614714pfd.12; Fri, 04 Jan 2019 09:49:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mCqECGpQL31DJ49A/L9K3JSZYoIJTRJ5Yhw/wHfMJEY=; b=PMXNaB96VaHiHNXXRIHAGRolmiJt2VeTXMHSbsRa+yIvRjh8vO2UvjjDajS06DTCHp jWutAyiiydc4NkFnXGLy8N/TKPZKD6KMPwY3EH+dHSSqDsvDJOlUsxKYJWDAh6GSQBpn x78yK7yfbVBbCqEJID6hSONoqZQSylqhwLN/GB57ydLzk+Xzhvt7k+tLziAYM6vOSaoU i9jqZUIk1WWJ1dquNnOEhxnLwI/4LTQFPBe+w3G5H/iSDgyC1EpnPh1XFnw3Qf1uD8WJ zsnZmx2+2cVthJVX+X04/hP4lWTKK5jC6pt2X0GbBJ4VNyGlGIQFWqAUUSj4CguTLscm KsmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mCqECGpQL31DJ49A/L9K3JSZYoIJTRJ5Yhw/wHfMJEY=; b=GI4NN9s2hWna0hCpdpGrxZ94Q+eNJgCClJvMvmsXTSakmPXcJb2+w4hot3PD/nOccO 7kJ85mkpfgK+57yKVO+vkA1Q8iOb56sHml4Fnc1cy7e7LA6gUttF47MLfnRPA2r9D83H NJ9Z1OzK0X6UGbpdK0aAgC410K8oiBNOhypTxr7aMynfba1syM+sWp8zvfOtL+e9NV3H kf9uSu3kz90WmZrUTSB3/nkPFUPG9Mb0PfEB12O6TWMBTUBvnCjRt+0rHJxSbcFbo6jM aESwWDFuLx+vxsFDyFj7kOYQ9lIaA44iDLzSd3DxQLPAnZefNtx55QC/9kfR6nDxFhfR A06g== X-Gm-Message-State: AJcUukdrb16oLUe7qpXiTlfg4N/avsauhQSOJM6NHuGDghEDHXbw1Set rNQ6Y6V6dhzrz+2GKAptHYb/fYtVu3g= X-Google-Smtp-Source: ALg8bN7X7QAfuXbhJyAnQ0K3OS6WnTAeWqdTDKnmKlvEbHUmdoUhGMy5B/iQDijGEZKW7/W0AWPMFA== X-Received: by 2002:a63:34c3:: with SMTP id b186mr2346117pga.184.1546624187337; Fri, 04 Jan 2019 09:49:47 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:46 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 04/20] PCI: imx6: Remove duplicate macro definitions Date: Fri, 4 Jan 2019 09:49:09 -0800 Message-Id: <20190104174925.17153-5-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 a81edfac9974..5090a618c3e2 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -115,9 +115,6 @@ struct imx6_pcie { #define PCIE_PHY_STAT (PL_OFFSET + 0x110) #define PCIE_PHY_STAT_ACK_LOC 16 -#define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C -#define PORT_LOGIC_SPEED_CHANGE (0x1 << 17) - /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 #define PCIE_PHY_ATEOVRD_EN (0x1 << 2) From patchwork Fri Jan 4 17:49:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748667 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 F2AAA13AD for ; Fri, 4 Jan 2019 17:51:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E33572863E for ; Fri, 4 Jan 2019 17:51:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D009F28668; Fri, 4 Jan 2019 17:51:55 +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 7B36A285B6 for ; Fri, 4 Jan 2019 17:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726919AbfADRvr (ORCPT ); Fri, 4 Jan 2019 12:51:47 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:41975 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728647AbfADRtu (ORCPT ); Fri, 4 Jan 2019 12:49:50 -0500 Received: by mail-pf1-f196.google.com with SMTP id b7so18618962pfi.8; Fri, 04 Jan 2019 09:49:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BTd99CHE5iLaVoOAVJd8WfMcBFC6tGpgGczKpbbc3Sc=; b=KZRJ3v8fnd9guo51anuzyHME3XTBHLulXCoUd46xXupoa9GJBDDSahPQaeaI6PLGVr 8WGYsbFLDSaqyj4vvuSYG5SYiOJLBRczG4BTCT412zHy0aHlx67BJF/5bkIB3ajth8M3 j0DOWvO/vyFVPj9cdvQt3pkHf/p2UMnt6OUkI2HKxtpV20UXZk5glYy6iKg5mDpqKjxi hcAFFzi7QNbmQbGsn3A0vnbCTD4Xz1FWDYBl9/cDKuzVr5ZdDGbup+l0Yu9qrXJK/XMo W0iKa/8vKbVIyT/WW+X1irJAlhyfyKoLZGtxCaBxnthGEZW6chT2vwCL5iJJ7SR4zOqo /rqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BTd99CHE5iLaVoOAVJd8WfMcBFC6tGpgGczKpbbc3Sc=; b=c/syLtwfH6SrxeedTdtF67+G4yl46GT1D/TynSiSMn83VOMtVmXFG5RcDi54gO4TD3 ON1LpSWRIE73BEVmyq/7SH8OMsecHvMXmlG4EE8w25mu7nfJHnOSqTwEBJZnv6V65Z52 jVgg2o9SDG4xVOh2ogf150seIICuNHcq9Il0yqg2hUedfzVDJnMzvDcayeHf98V5CwBm WGtCUaAv2YWl9pl6+XsqxpgQd/dF5b4hBEKZQel2cLgB60GcCPDjpL7NpPdFOHjZeqtX E292nGjBJ9V1XiMIDv1gtfIpME7Ses7czG4jkJAWz6NOsZfsGNfCDDdqGNSr0YiOc1VW i8EQ== X-Gm-Message-State: AA+aEWZS/YSqPrhrsEfnK4j/RoxvrnmhWYyDV1Y/Lokuss4Ac2YjBVmm KcHBdMIif4ZYElTwiy2J3GLJ/e5Zfjo= X-Google-Smtp-Source: ALg8bN4Qb8qQMO7TZhcNjLcZcF+mDwHVBnDykUSYqKB+NrSY3NbwaLE59uALn6HrKRe517RVcaaUeQ== X-Received: by 2002:a62:520b:: with SMTP id g11mr53858019pfb.53.1546624189099; Fri, 04 Jan 2019 09:49:49 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:48 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 05/20] PCI: imx6: Remove PCIE_PL_PFLR_* constants Date: Fri, 4 Jan 2019 09:49:10 -0800 Message-Id: <20190104174925.17153-6-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 5090a618c3e2..a7192b9e0e71 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -99,9 +99,6 @@ struct imx6_pcie { /* PCIe Port Logic registers (memory-mapped) */ #define PL_OFFSET 0x700 -#define PCIE_PL_PFLR (PL_OFFSET + 0x08) -#define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16) -#define PCIE_PL_PFLR_FORCE_LINK (1 << 15) #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) From patchwork Fri Jan 4 17:49:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748663 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 CD10913AD for ; Fri, 4 Jan 2019 17:51:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C23D128305 for ; Fri, 4 Jan 2019 17:51:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6A8A28668; Fri, 4 Jan 2019 17:51:47 +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 644E928305 for ; Fri, 4 Jan 2019 17:51:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728638AbfADRtx (ORCPT ); Fri, 4 Jan 2019 12:49:53 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46376 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728670AbfADRtw (ORCPT ); Fri, 4 Jan 2019 12:49:52 -0500 Received: by mail-pg1-f193.google.com with SMTP id w7so17760159pgp.13; Fri, 04 Jan 2019 09:49:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3VOwOJYTEi9UR4UgeiKLcvLz0osJ4eyuFQfv798N0kw=; b=cIQDFnbbZQ7zun0bPoYcKlx4CAsV3EdWh8sQLP0WqF9Y45of71SulNq2FVC8xni2F0 NW7GmTzooeTKpkIuN/g2s879lKeRldJQNhRxB0FpP7j+m9mBmZSSyHklkczn+yfZI6Xz BWjQl6TtJNNh964Grs9JFAUqrD7oAmW5nRJ2vasVyDn0pnMm4PgKlkEXdSLibNVdsi8w 9xQEhxC6V6KwlpXt+wbL7QbIigPIGkuTpl8zWtYUvmupl+q4L2ENNZE7OMPHDlWdDH+7 Ekno1l0RTMm69qLLs6FPaiUl5Zamvg+3jST6R9lJMWCOY0AGyEIR4DZahVRmpH7z1jlw Ww+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3VOwOJYTEi9UR4UgeiKLcvLz0osJ4eyuFQfv798N0kw=; b=Wf0ZmAqFNOlb0ADZX9nJ+59HSrMG+PdHTFlXp+VUZHfoh0OGyJ2bfWuIzjpPkfeluE ZXGwBp9/VtG7I2rImPH7qFLwO2+v4fQgg+1jgbyGzAssMpdtvAsTpqsQlufMLUhUSkVZ Nve+5TSE38oiUwei6h1tPHnQa/6LSnrx7vP/9h+WxHX4/r14PBMA3KYrTNV+Fj+5U58n WZHSKQ66dFhBYZ+d/fpFMj5nkM19mMdVakHpt8tSOcQ7XLEkeZZLZ+N7kTf4R1v+OtDy 8ElVT9nkpORAP3Y1BE+IKKaPIZqOVZPq79ASUXQpSLHbsIyq10H8PuXKEUH6ybRVX/Yg Z/YQ== X-Gm-Message-State: AJcUuke5cXHH+bFDZwDL7q04PlapwJjCmpq3DNBZ6DeB3NS9DIZoXDOV Ey9vloWQlTqX/OIvLrHoKWhwoZND+8A= X-Google-Smtp-Source: ALg8bN63AGT6KHsPf4+9iTaT+C2aMgpdrT4E6ZaEu9GWtQHOwSDB5//W1Fa3tk9pOsUCFndg/m44ow== X-Received: by 2002:a63:1904:: with SMTP id z4mr2364785pgl.135.1546624191241; Fri, 04 Jan 2019 09:49:51 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:50 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 06/20] PCI: imx6: Remove PCIE_PHY_RX_ASIC_OUT* constants Date: Fri, 4 Jan 2019 09:49:11 -0800 Message-Id: <20190104174925.17153-7-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 a7192b9e0e71..282b09076fea 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -123,9 +123,6 @@ struct imx6_pcie { #define PCIE_PHY_MPLL_MULTIPLIER_MASK 0x7f #define PCIE_PHY_MPLL_MULTIPLIER_OVRD (0x1 << 9) -#define PCIE_PHY_RX_ASIC_OUT 0x100D -#define PCIE_PHY_RX_ASIC_OUT_VALID (1 << 0) - #define PHY_RX_OVRD_IN_LO 0x1005 #define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5) #define PHY_RX_OVRD_IN_LO_RX_PLL_EN (1 << 3) From patchwork Fri Jan 4 17:49:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748661 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 EF70813AD for ; Fri, 4 Jan 2019 17:51:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D1E28305 for ; Fri, 4 Jan 2019 17:51:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4C3F2863E; Fri, 4 Jan 2019 17:51:44 +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 7914828305 for ; Fri, 4 Jan 2019 17:51:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728199AbfADRvi (ORCPT ); Fri, 4 Jan 2019 12:51:38 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:34810 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728677AbfADRtz (ORCPT ); Fri, 4 Jan 2019 12:49:55 -0500 Received: by mail-pg1-f196.google.com with SMTP id j10so17791758pga.1; Fri, 04 Jan 2019 09:49:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QhqhT8k9cRoxWOByjnw4+D3pr2bPAqv3RKgBmGiID7Y=; b=puOa+Oa5mf9v7e1IlYNfFflOsFbHuywQvz56JQu5xhuT1CWhPCFLj5SYPYM0yYmSxf /3ltIOT1DOuf/cpIxyBhUhuMcaU4KjjEeEw1v4Vp+uJ3/5Wswg9DE0gIpvZBEf4NTwgG g/Z+0G0NDf6OlV+Ajjkw/F4DhmocblP0TRHEL3hokf2GHWJ5twOYmMsVgsUhoPqohYz7 zbbrvcYT13Eyp+txwqEY8zgTO1SEd+AEvdzWdSzcHuZwLdtEfyg5o2uw7tTj3v0ngKwP hQfOk4ZWVwOUb0AxvHfRCFHbgaChQbx7CK2zY/tDmCMQZNrW/4FH8cjdhfuUu68LEUd7 YgPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QhqhT8k9cRoxWOByjnw4+D3pr2bPAqv3RKgBmGiID7Y=; b=a1WtZqmv1gP53u1/FYll/7VURzn6hbo7Iq/dWrZnkBT+dX1m8lrZOc245wnQkUwuOh d1yzt4s5TA6DsGNJqd895mP6v/3UGiVC6SChDBtsj43qjaE7HEmaz9A2Ozc8v+g3kGbh mM2uHJSYGQrZIaebeS4JOPsynn+k1eC5/kvrGieTSoc37078eHYaYw5NuAW81LHv/+Hr s4z+eg+iAHZ1fvWmd5pkxw8uZ8pJfz3xs6Gqqw8bjnmbufWNVJDe1zWkhvE5EUYuSomQ rN7FFkTXOEi9FnkKxlKoamzmVyYdxAWcehzPNmll7YYqVqENCUIjfBFRVypYx+XfGtOV 9KQA== X-Gm-Message-State: AJcUukffKE2Ddvn4VfRrgaXcn/g4l7eAkRYdc87XYCuA/DF2LdTpML3u GSbDKXhzg5ykNwYtENidvcozq50ebw8= X-Google-Smtp-Source: ALg8bN4LPvul9EoVP+PUo/2OYcZzz1whMoTFA5PuuZ/nPLmsezd3LBKPNU19q/O3Rnl3lTb/V3kfzg== X-Received: by 2002:a63:c00b:: with SMTP id h11mr2485051pgg.429.1546624193159; Fri, 04 Jan 2019 09:49:53 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:52 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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, Gustavo Pimentel Subject: [PATCH v2 07/20] PCI: dwc: Make use of IS_ALIGNED() Date: Fri, 4 Jan 2019 09:49:12 -0800 Message-Id: <20190104174925.17153-8-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pcie-designware.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 93ef8c31fb39..67236379c61a 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -22,7 +22,7 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val) { - if ((uintptr_t)addr & (size - 1)) { + if (!IS_ALIGNED((uintptr_t)addr, size)) { *val = 0; return PCIBIOS_BAD_REGISTER_NUMBER; } @@ -43,7 +43,7 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val) int dw_pcie_write(void __iomem *addr, int size, u32 val) { - if ((uintptr_t)addr & (size - 1)) + if (!IS_ALIGNED((uintptr_t)addr, size)) return PCIBIOS_BAD_REGISTER_NUMBER; if (size == 4) From patchwork Fri Jan 4 17:49:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748613 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 EBC911575 for ; Fri, 4 Jan 2019 17:50:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE10328536 for ; Fri, 4 Jan 2019 17:50:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2399285B6; Fri, 4 Jan 2019 17:50: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 15F6828536 for ; Fri, 4 Jan 2019 17:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728694AbfADRt5 (ORCPT ); Fri, 4 Jan 2019 12:49:57 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:41169 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728689AbfADRt4 (ORCPT ); Fri, 4 Jan 2019 12:49:56 -0500 Received: by mail-pl1-f196.google.com with SMTP id u6so17726333plm.8; Fri, 04 Jan 2019 09:49: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=x2fXdz4Ik0AFAzOQLJZdPMvlCQxR5gTcFSjR6Jns4ok=; b=o0FDJgev9btFmYYkveMGrkg/Hkmls0C8+1uS/nygLw4Uk7vy/dy9p8BKoV/YhfH3wp 4vGK5MGwAkx10+ic3evz42ug6d/Sf5yOaTxPqhZP6wjJlVFYtP0ZvgwjLyd76mPsftVQ QerpaZdGIkOxN2mZxUgu4kvKEWGSVzRYWONCfW0jLa+y/mwm7G9rnvxe/X9e9xH/R9KM +csBimpxYMZfnbZTCSBBaXL2SJ6bER9uaFzg+3aO1jPf7xrzezyC3KP0t2ba2c8mrzHj LDoPufDPALnR77DADEmjBJJrrvChh2HBsXvzeZdSdx0YmmMFBczmk/udUxfQ7PZtoy4W USFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x2fXdz4Ik0AFAzOQLJZdPMvlCQxR5gTcFSjR6Jns4ok=; b=gthsFPoPFa1wlrugc2LTND7A1leaJv9+CNh175xFssGWj1VHeC9f8rxtyATlurrcSW M2O57o2aPpk9B8URsspWDuuoBg8Hvuym/VaMbWTJBX/CCyUSSD+iqKg+gn2PX8xCDZGf 8FshInBunYNoq092KS3sThLcmo7pb2HSUmVXOmoxYwPs3963u09sCroaYtWLkyV4y8wy LBF3Ftw5pmbbHLblV4VEySpiYSv7NX+UqDWJ5qsOeJgZS4z4KCxpS/Qgw0B58a72+acK Or8i0dCAL2NDNTvti+epDjxrfWZdIK1VJ2y42FW4JwS9qB52oGQ9g2FhbzAJmB9V50OV 6XqQ== X-Gm-Message-State: AJcUukcTaaILYKmxxafUc69GmGntyawcw8fJraT6uXaw84AgD50LcB0d b9zsBBMOtYwjU+6VwrfAPGuRd5T1pNw= X-Google-Smtp-Source: ALg8bN5ad63oBiClCtZSZLIALm9EAJPHW2K5pki0ZrSO3gi4fH5hTpIUwFEptho0YVi2j6ZqVHykMA== X-Received: by 2002:a17:902:1105:: with SMTP id d5mr49894927pla.47.1546624195161; Fri, 04 Jan 2019 09:49:55 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:54 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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, Gustavo Pimentel Subject: [PATCH v2 08/20] PCI: dwc: Share code for dw_pcie_rd/wr_other_conf() Date: Fri, 4 Jan 2019 09:49:13 -0800 Message-Id: <20190104174925.17153-9-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- .../pci/controller/dwc/pcie-designware-host.c | 61 +++++++------------ 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 721d60a5d9e4..8f957cd6901b 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -512,8 +512,9 @@ int dw_pcie_host_init(struct pcie_port *pp) return ret; } -static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, - u32 devfn, int where, int size, u32 *val) +static int dw_pcie_access_other_conf(struct pcie_port *pp, struct pci_bus *bus, + u32 devfn, int where, int size, u32 *val, + bool write) { int ret, type; u32 busdev, cfg_size; @@ -521,9 +522,6 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, void __iomem *va_cfg_base; struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - if (pp->ops->rd_other_conf) - return pp->ops->rd_other_conf(pp, bus, devfn, where, size, val); - busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) | PCIE_ATU_FUNC(PCI_FUNC(devfn)); @@ -542,7 +540,11 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX1, type, cpu_addr, busdev, cfg_size); - ret = dw_pcie_read(va_cfg_base + where, size, val); + if (write) + ret = dw_pcie_write(va_cfg_base + where, size, *val); + else + ret = dw_pcie_read(va_cfg_base + where, size, val); + if (pci->num_viewport <= 2) dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX1, PCIE_ATU_TYPE_IO, pp->io_base, @@ -551,43 +553,26 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, return ret; } +static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, + u32 devfn, int where, int size, u32 *val) +{ + if (pp->ops->rd_other_conf) + return pp->ops->rd_other_conf(pp, bus, devfn, where, + size, val); + + return dw_pcie_access_other_conf(pp, bus, devfn, where, size, val, + false); +} + static int dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus, u32 devfn, int where, int size, u32 val) { - int ret, type; - u32 busdev, cfg_size; - u64 cpu_addr; - void __iomem *va_cfg_base; - struct dw_pcie *pci = to_dw_pcie_from_pp(pp); - if (pp->ops->wr_other_conf) - return pp->ops->wr_other_conf(pp, bus, devfn, where, size, val); - - busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) | - PCIE_ATU_FUNC(PCI_FUNC(devfn)); + return pp->ops->wr_other_conf(pp, bus, devfn, where, + size, val); - if (bus->parent->number == pp->root_bus_nr) { - type = PCIE_ATU_TYPE_CFG0; - cpu_addr = pp->cfg0_base; - cfg_size = pp->cfg0_size; - va_cfg_base = pp->va_cfg0_base; - } else { - type = PCIE_ATU_TYPE_CFG1; - cpu_addr = pp->cfg1_base; - cfg_size = pp->cfg1_size; - va_cfg_base = pp->va_cfg1_base; - } - - dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX1, - type, cpu_addr, - busdev, cfg_size); - ret = dw_pcie_write(va_cfg_base + where, size, val); - if (pci->num_viewport <= 2) - dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX1, - PCIE_ATU_TYPE_IO, pp->io_base, - pp->io_bus_addr, pp->io_size); - - return ret; + return dw_pcie_access_other_conf(pp, bus, devfn, where, size, &val, + true); } static int dw_pcie_valid_device(struct pcie_port *pp, struct pci_bus *bus, From patchwork Fri Jan 4 17:49:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748657 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 402656C2 for ; Fri, 4 Jan 2019 17:51:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31CF228305 for ; Fri, 4 Jan 2019 17:51:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25EBB2863E; Fri, 4 Jan 2019 17:51: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 AB91F28305 for ; Fri, 4 Jan 2019 17:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728709AbfADRuA (ORCPT ); Fri, 4 Jan 2019 12:50:00 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:32790 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728465AbfADRt7 (ORCPT ); Fri, 4 Jan 2019 12:49:59 -0500 Received: by mail-pl1-f195.google.com with SMTP id z23so17737613plo.0; Fri, 04 Jan 2019 09:49:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=shK5Doptk0Qhk1JfbtIOZ/odHZxsAlF8OFxlwBmTSmo=; b=cl1DLcwRE/0QWpXSbhSh5i0/TvsBDRwsOkAAPfQn0820+d/QVQbClX49IoSnREMRBL zxnfMG4pWoNcC8D0cP6VPi2bj6s10QjS2/WG1XgllsKJPtdSAMIrQm20reIhnEw6z9HX +BLrO1ogIB0/6RxoBfW+KluWbWMcl+Q5Jqq66h0OXhirOVEKyLYFZKyQ/NCM0GCeWaLA IE6sgPXDOv9RtA56sojeXdqs/ewJ58mXxoaP7WeXq4VU54Zxk5GwgtBibUyYZTZcTqAa iSVVH/4dWXNs7hVbX17zPNm0jN+VsFQRG+iwmunKx71ox3qmkzuzdUUf8/iIlym9kc9r 3j+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=shK5Doptk0Qhk1JfbtIOZ/odHZxsAlF8OFxlwBmTSmo=; b=cO0p1mhrsPB9aj10LDZ+aP+QimxQ4OcFGLB46sVo6Lpc0bvYskoGBI4cOjCmDoMdwi /0LzeKn4GwJl+7YRk66zRU4YsYworRrvos30210rvRGX4FD3vN32IDifYwt1k5qP4x8R ZTv+FzFwuSzmtxa06PZM+YktNz0ghwtMBBuWm/yfkAUJJZ+FMN3wT6htT+shc9Nd30N/ FVNQ39kKJGoHmXZpHpIdv2cVeYjnOlg/zDEzlnMbU89YgwVmdL866QXikVSS9/sjJZY6 XF8+xHV/Le7qAqARZOMz3zOHaYMODWsmbZoHBWg8+JyEye211Bx1M2135Lqc1q1e9Zpq O/Lg== X-Gm-Message-State: AJcUuketT8q8opUjLTYWaWlTnkUDswT6Wk5TFzozZ3qJHFJaGy1v5izx ogy2xgkfgEKKhoUxO96PpgyuA0QQyO8= X-Google-Smtp-Source: ALg8bN7xL2Wj0D3OvOejOoR/ru4ykY6LA92CJfEgjRNXWosVQ6tj6c/GwLJV5CaMLFa9MqTdBrCMeA== X-Received: by 2002:a17:902:5982:: with SMTP id p2mr51337128pli.39.1546624197107; Fri, 04 Jan 2019 09:49:57 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:56 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 09/20] PCI: dwc: imx6: Share PHY debug register definitions Date: Fri, 4 Jan 2019 09:49:14 -0800 Message-Id: <20190104174925.17153-10-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 282b09076fea..5e7fab089bde 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -99,8 +99,6 @@ struct imx6_pcie { /* PCIe Port Logic registers (memory-mapped) */ #define PL_OFFSET 0x700 -#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) -#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) #define PCIE_PHY_CTRL_DATA_LOC 0 @@ -784,8 +782,8 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) err_reset_phy: dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n", - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0), - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1)); + dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), + dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); imx6_pcie_reset_phy(imx6_pcie); return ret; } diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 67236379c61a..d123ac290b9e 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -14,12 +14,6 @@ #include "pcie-designware.h" -/* PCIe Port Logic registers */ -#define PLR_OFFSET 0x700 -#define PCIE_PHY_DEBUG_R1 (PLR_OFFSET + 0x2c) -#define PCIE_PHY_DEBUG_R1_LINK_UP (0x1 << 4) -#define PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING (0x1 << 29) - int dw_pcie_read(void __iomem *addr, int size, u32 *val) { if (!IS_ALIGNED((uintptr_t)addr, size)) { @@ -334,9 +328,9 @@ int dw_pcie_link_up(struct dw_pcie *pci) if (pci->ops->link_up) return pci->ops->link_up(pci); - val = readl(pci->dbi_base + PCIE_PHY_DEBUG_R1); - return ((val & PCIE_PHY_DEBUG_R1_LINK_UP) && - (!(val & PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING))); + val = readl(pci->dbi_base + PCIE_PORT_DEBUG1); + return ((val & PCIE_PORT_DEBUG1_LINK_UP) && + (!(val & PCIE_PORT_DEBUG1_LINK_IN_TRAINING))); } void dw_pcie_setup(struct dw_pcie *pci) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 9943d8c68335..58735fd01668 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -39,6 +39,9 @@ #define PCIE_PORT_DEBUG0 0x728 #define PORT_LOGIC_LTSSM_STATE_MASK 0x1f #define PORT_LOGIC_LTSSM_STATE_L0 0x11 +#define PCIE_PORT_DEBUG1 0x72C +#define PCIE_PORT_DEBUG1_LINK_UP (0x1 << 4) +#define PCIE_PORT_DEBUG1_LINK_IN_TRAINING (0x1 << 29) #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C #define PORT_LOGIC_SPEED_CHANGE (0x1 << 17) From patchwork Fri Jan 4 17:49:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748655 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 EEBC213AD for ; Fri, 4 Jan 2019 17:51:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEFEF285B6 for ; Fri, 4 Jan 2019 17:51:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D078628668; Fri, 4 Jan 2019 17:51:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65547285B6 for ; Fri, 4 Jan 2019 17:51:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727760AbfADRuC (ORCPT ); Fri, 4 Jan 2019 12:50:02 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:33422 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728728AbfADRuC (ORCPT ); Fri, 4 Jan 2019 12:50:02 -0500 Received: by mail-pg1-f195.google.com with SMTP id z11so17797260pgu.0; Fri, 04 Jan 2019 09:50:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5GPVKMBGU5ZvNu6g1jC/voOA4PDlqiI+yiygPIURHSo=; b=Um3WmXbSD2WHftXb7YDOCm2GnKkStW9iff77m/sinDSPuAyDCa2CkNOhrWt+5bAZ2+ fVtQRJAOXwY3/14+mCUAmm3B7Wza1kiMGA5l5l53catA+AOanNdzl7AHXFuTkqgVQ7If gthkNJVv093LCzdTcZCJ/Q22OAxLwFvwK5ygTCqK6tAmILOvpNtwWe8QTLj1VbQIkztd D/FTCrXL0QQ+6PfXwDX+1Gpm0nIiWImGBPquaWETLsXeTwLRM4MZFzeeXhNu6AFEzTSd sAd1AACcrluL2oXJBXK+gpQpuR9VlutzaR7EaGgCBvgmO8xb7/P5F96cX0qWW1pJGa+x 01EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5GPVKMBGU5ZvNu6g1jC/voOA4PDlqiI+yiygPIURHSo=; b=l+ym4YWorm7Hs0ct6S+KhaALgzEEaq32CCOKHbOKxO1FOX78aqjJoKkc1mDUCx53sL SwbrbpCYCrIBps5J8pb9jhKpFfWD4BZHrpCrQxrqgYzF6K00mLm8yzy4vaF/jWspNCaA LI/Gu5ndPYDhlEcZztcIuDDtKtD2e5xQhCkp3RcrFSf0LNc4E/pY9oIo49Q1d+kSPpGY s1ZIA8Pqh2bpmeb+6cCFSOrzlNvdLSbnlgP4G3vQF9TbzZ3PtzyUALo6tbTPlw3jY6ed FsskSZY5FRNBC3DKl7YE+7l0evnTUkv/X+5XJeX/0oWgb0cHVq6Zl8tls1Nuxto6hmJA 8+Ow== X-Gm-Message-State: AA+aEWbmtGx7rJLPLLcS2P2B9tPhF8Ts9VInKHmYXWTctNtcMbc2PT3H z1awX8KaAbMYWugqJ2nlB6ZqmRV9kno= X-Google-Smtp-Source: AFSGD/VZP1C1IS24z+0UcPkxVu/MZQFkTGhZq3FCBDvgZajuV5DLwpdWnMLZ7mFUMZPpd/VByx2xxA== X-Received: by 2002:a62:1e87:: with SMTP id e129mr52726011pfe.221.1546624199860; Fri, 04 Jan 2019 09:49:59 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.49.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:49:59 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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, Gustavo Pimentel Subject: [PATCH v2 10/20] PCI: dwc: Make use of BIT() in constant definitions Date: Fri, 4 Jan 2019 09:49:15 -0800 Message-Id: <20190104174925.17153-11-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pcie-designware.c | 2 +- drivers/pci/controller/dwc/pcie-designware.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index d123ac290b9e..086e87a40316 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -300,7 +300,7 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, int index, } dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, region | index); - dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, ~PCIE_ATU_ENABLE); + dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, (u32)~PCIE_ATU_ENABLE); } int dw_pcie_wait_for_link(struct dw_pcie *pci) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 58735fd01668..348e91b6daa2 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -40,11 +40,11 @@ #define PORT_LOGIC_LTSSM_STATE_MASK 0x1f #define PORT_LOGIC_LTSSM_STATE_L0 0x11 #define PCIE_PORT_DEBUG1 0x72C -#define PCIE_PORT_DEBUG1_LINK_UP (0x1 << 4) -#define PCIE_PORT_DEBUG1_LINK_IN_TRAINING (0x1 << 29) +#define PCIE_PORT_DEBUG1_LINK_UP BIT(4) +#define PCIE_PORT_DEBUG1_LINK_IN_TRAINING BIT(29) #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C -#define PORT_LOGIC_SPEED_CHANGE (0x1 << 17) +#define PORT_LOGIC_SPEED_CHANGE BIT(17) #define PORT_LOGIC_LINK_WIDTH_MASK (0x1f << 8) #define PORT_LOGIC_LINK_WIDTH_1_LANES (0x1 << 8) #define PORT_LOGIC_LINK_WIDTH_2_LANES (0x2 << 8) @@ -58,8 +58,8 @@ #define PCIE_MSI_INTR0_STATUS 0x830 #define PCIE_ATU_VIEWPORT 0x900 -#define PCIE_ATU_REGION_INBOUND (0x1 << 31) -#define PCIE_ATU_REGION_OUTBOUND (0x0 << 31) +#define PCIE_ATU_REGION_INBOUND BIT(31) +#define PCIE_ATU_REGION_OUTBOUND 0 #define PCIE_ATU_REGION_INDEX2 (0x2 << 0) #define PCIE_ATU_REGION_INDEX1 (0x1 << 0) #define PCIE_ATU_REGION_INDEX0 (0x0 << 0) @@ -69,8 +69,8 @@ #define PCIE_ATU_TYPE_CFG0 (0x4 << 0) #define PCIE_ATU_TYPE_CFG1 (0x5 << 0) #define PCIE_ATU_CR2 0x908 -#define PCIE_ATU_ENABLE (0x1 << 31) -#define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30) +#define PCIE_ATU_ENABLE BIT(31) +#define PCIE_ATU_BAR_MODE_ENABLE BIT(30) #define PCIE_ATU_LOWER_BASE 0x90C #define PCIE_ATU_UPPER_BASE 0x910 #define PCIE_ATU_LIMIT 0x914 @@ -81,7 +81,7 @@ #define PCIE_ATU_UPPER_TARGET 0x91C #define PCIE_MISC_CONTROL_1_OFF 0x8BC -#define PCIE_DBI_RO_WR_EN (0x1 << 0) +#define PCIE_DBI_RO_WR_EN BIT(0) /* * iATU Unroll-specific register definitions @@ -108,7 +108,7 @@ ((region) << 9) #define PCIE_GET_ATU_INB_UNR_REG_OFFSET(region) \ - (((region) << 9) | (0x1 << 8)) + (((region) << 9) | BIT(8)) #define MAX_MSI_IRQS 256 #define MAX_MSI_IRQS_PER_CTRL 32 From patchwork Fri Jan 4 17:49:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748651 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 126F46C2 for ; Fri, 4 Jan 2019 17:51:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05DD728305 for ; Fri, 4 Jan 2019 17:51:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE54E2863E; Fri, 4 Jan 2019 17:51:31 +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 94AC828305 for ; Fri, 4 Jan 2019 17:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728750AbfADRuE (ORCPT ); Fri, 4 Jan 2019 12:50:04 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37383 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728739AbfADRuD (ORCPT ); Fri, 4 Jan 2019 12:50:03 -0500 Received: by mail-pg1-f194.google.com with SMTP id c25so17786682pgb.4; Fri, 04 Jan 2019 09:50:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xAm2jIq52pUhEC2sZCasu0hrDgVXQMY4yfjOEAVqYOg=; b=mMiOwlSG4DC/Fg65Au78ypOcmntahyb2RvO65PwPALy3W5u+zIqvl1kRo6cjfSVzAG C8XGHCWqRYNl3tZReBRxpTWxJHsgA9FDYpLUwN0j/Sb2anz6hfNVplUdlig/rOvq1SaF DcCmtLyUiT4k6779xkqnyIFkUNVCu7DnRqHBi1fUBaON/B59O0FHd3m/jvmUv/E68SEL v9xEyegM2PTVmL9v1vujXnMfHAM5HEE7lLrxKov2muITiK3+hjPAO/6FpgjgqgwlND65 Ap9cV8/YvBH1RqnWF0uaaWTbUE/l/HvA/HVnmvPSIG2LKC+D2RBMU4UOtLoN8om3XTKs WYVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xAm2jIq52pUhEC2sZCasu0hrDgVXQMY4yfjOEAVqYOg=; b=ud3HPRizDZFvVf2h71NSwD2uB7ydBO/Yc5+fQsgTtQxW93Tvv0rjpUhwXhI3B+sAZG SKQC55TWSCdmZWY3zcOFjocnfPtvStPXMkRAvCSMQ7SIvwLGQBl6vM6wvROwjbU/YONv xB9Okl7xUG1mecviXCKEPb7p9m0Vvn8a4gzaFLcNVr8OWSEa0OuN2pjpmIkd0/gCYCfZ fwOVqQ1F2aTKRcCffuMTBz6v1aRcj2K2us6nyHslIVz57WxgA4ab2fSBPW1iIs5aSR14 ZQm5/fhLkJrZbUxV7yfuWnk5QdDzUMBF18Z59mL+q/K0yxmuLmhueTAVkSTelcr+Bc3T ukeg== X-Gm-Message-State: AJcUukf5cPJEpyA+NaVflT2lnxwJeDkciDov2eUyq1Ym+5o4WKS+pvfA 99Uht1zJY7St51xqDWMRAFRTmT1lttk= X-Google-Smtp-Source: AFSGD/U8/aliG21Hl9OPuMY8e2lEDtbWolIemfd93+t+jlOoz3jIbHM1T819Xm5vLncIZ0Lj8YKbXA== X-Received: by 2002:a62:6f88:: with SMTP id k130mr52806398pfc.234.1546624202196; Fri, 04 Jan 2019 09:50:02 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:01 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 11/20] PCI: imx6: Make use of BIT() in constant definitions Date: Fri, 4 Jan 2019 09:49:16 -0800 Message-Id: <20190104174925.17153-12-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 5e7fab089bde..180ba57da4e8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -112,18 +112,18 @@ struct imx6_pcie { /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 -#define PCIE_PHY_ATEOVRD_EN (0x1 << 2) +#define PCIE_PHY_ATEOVRD_EN BIT(2) #define PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT 0 #define PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK 0x1 #define PCIE_PHY_MPLL_OVRD_IN_LO 0x11 #define PCIE_PHY_MPLL_MULTIPLIER_SHIFT 2 #define PCIE_PHY_MPLL_MULTIPLIER_MASK 0x7f -#define PCIE_PHY_MPLL_MULTIPLIER_OVRD (0x1 << 9) +#define PCIE_PHY_MPLL_MULTIPLIER_OVRD BIT(9) #define PHY_RX_OVRD_IN_LO 0x1005 -#define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5) -#define PHY_RX_OVRD_IN_LO_RX_PLL_EN (1 << 3) +#define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5) +#define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3) static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, int exp_val) { From patchwork Fri Jan 4 17:49:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748649 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 A7A2413AD for ; Fri, 4 Jan 2019 17:51:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96E1C285B6 for ; Fri, 4 Jan 2019 17:51:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 898DF2863E; Fri, 4 Jan 2019 17:51:31 +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 079B028305 for ; Fri, 4 Jan 2019 17:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726143AbfADRvY (ORCPT ); Fri, 4 Jan 2019 12:51:24 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37711 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728473AbfADRuF (ORCPT ); Fri, 4 Jan 2019 12:50:05 -0500 Received: by mail-pl1-f195.google.com with SMTP id b5so17736185plr.4; Fri, 04 Jan 2019 09:50:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w9KU/W4CQap2RK2hsRI+gNohsIozdtadfTJIN88KMTs=; b=Ub8qeaY7l5BX2LdG1ZfhbYVBmhPQMPROSTMWAoNKmswTP6VRDypf41vEOf9/56STcq Anh+omXnyVcUeLEIrOfIWiQOpWL3u2qSB6G99UYvPn8trxp217l6WKeCVGV0pxlsF8tj QSoBShRy22VYH5FAkjasJKoeqz4BM/GTA8uc6af0eYf9da0FswdPOz2tXikRe7CQ4eJR CUiWdp9rKeB9ZIrE+6Xb+o3OH5LTNkvI9k5S2mXTHcNHgHsxQUtz/DOYhK+uvWPzkZmD gsVhWgB3stIYSY7EDMWD6ilSne+FzxTdywtd3xV/fhXmnI/+1jcAgA8eys/0t4NhdWzI 1i/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w9KU/W4CQap2RK2hsRI+gNohsIozdtadfTJIN88KMTs=; b=rVn7N2qYEX6AKuzeTt1BuMzKyHpBfBn9DJ77yz9HBC9BoaW6/PP5Acv8ym2E6BD4Om R6vzEh6joqPSMd49VuZQgeMTlG4pOA1Yjs1BpgY8XGCAt6u2+h61H/515hKA4JQGQk5n Wko59L7zsZBST6EUutKLxkOnZ1vAKJ97KWxyoRBThQ3GvYqWAvX4tSi7+WdfAt7hAXun 8yxFIDnnM/60W+OQfeq+uLkc+JzssnpZvxgsFcEyeGKN9UtXyF2brLHwmAVC5F1b8Tyn Vxg7JppyZJ2hnD1oVUO9D1/KvJu8nFOCT3S9ert5oR6zRASfEXV8crKJA1xVijUsuzYj JHpQ== X-Gm-Message-State: AJcUukeLKARFJ+j75nZAS1AyyVsE+Vujnj3Yv7S9pHiRxdj0O6d9y2G7 2aqbXGrnmdY1XI8vGKhWeSkEGPzp8vs= X-Google-Smtp-Source: ALg8bN6gxG1OAvAuFAEIXqh5twg6wRoU+lumMTfjKcijYxQpWYiI8n+XqMJIwBM8BgFO/2q8sdi8JQ== X-Received: by 2002:a17:902:14b:: with SMTP id 69mr52373171plb.52.1546624204331; Fri, 04 Jan 2019 09:50:04 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:03 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 12/20] PCI: imx6: Simplify bit operations in PHY functions Date: Fri, 4 Jan 2019 09:49:17 -0800 Message-Id: <20190104174925.17153-13-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 180ba57da4e8..672332483324 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -101,11 +101,11 @@ struct imx6_pcie { #define PL_OFFSET 0x700 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) -#define PCIE_PHY_CTRL_DATA_LOC 0 -#define PCIE_PHY_CTRL_CAP_ADR_LOC 16 -#define PCIE_PHY_CTRL_CAP_DAT_LOC 17 -#define PCIE_PHY_CTRL_WR_LOC 18 -#define PCIE_PHY_CTRL_RD_LOC 19 +#define PCIE_PHY_CTRL_DATA(x) FIELD_PREP(GENMASK(15, 0), (x)) +#define PCIE_PHY_CTRL_CAP_ADR BIT(16) +#define PCIE_PHY_CTRL_CAP_DAT BIT(17) +#define PCIE_PHY_CTRL_WR BIT(18) +#define PCIE_PHY_CTRL_RD BIT(19) #define PCIE_PHY_STAT (PL_OFFSET + 0x110) #define PCIE_PHY_STAT_ACK_LOC 16 @@ -152,17 +152,17 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) u32 val; int ret; - val = addr << PCIE_PHY_CTRL_DATA_LOC; + val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - val |= (0x1 << PCIE_PHY_CTRL_CAP_ADR_LOC); + val |= PCIE_PHY_CTRL_CAP_ADR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); ret = pcie_phy_poll_ack(imx6_pcie, 1); if (ret) return ret; - val = addr << PCIE_PHY_CTRL_DATA_LOC; + val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); return pcie_phy_poll_ack(imx6_pcie, 0); @@ -180,7 +180,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) return ret; /* assert Read signal */ - phy_ctl = 0x1 << PCIE_PHY_CTRL_RD_LOC; + phy_ctl = PCIE_PHY_CTRL_RD; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); ret = pcie_phy_poll_ack(imx6_pcie, 1); @@ -208,11 +208,11 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) if (ret) return ret; - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* capture data */ - var |= (0x1 << PCIE_PHY_CTRL_CAP_DAT_LOC); + var |= PCIE_PHY_CTRL_CAP_DAT; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); ret = pcie_phy_poll_ack(imx6_pcie, 1); @@ -220,7 +220,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* deassert cap data */ - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ @@ -229,7 +229,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* assert wr signal */ - var = 0x1 << PCIE_PHY_CTRL_WR_LOC; + var = PCIE_PHY_CTRL_WR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack */ @@ -238,7 +238,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* deassert wr signal */ - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ From patchwork Fri Jan 4 17:49:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748647 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 E3DC813AD for ; Fri, 4 Jan 2019 17:51:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3F0828627 for ; Fri, 4 Jan 2019 17:51:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5FC028305; Fri, 4 Jan 2019 17:51:22 +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 64EE528305 for ; Fri, 4 Jan 2019 17:51:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725958AbfADRvQ (ORCPT ); Fri, 4 Jan 2019 12:51:16 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40971 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728728AbfADRuH (ORCPT ); Fri, 4 Jan 2019 12:50:07 -0500 Received: by mail-pf1-f194.google.com with SMTP id b7so18619287pfi.8; Fri, 04 Jan 2019 09:50:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GIZtkIt7F6fxURYaK6v1S5ghisv1YvKa7oaIjfa51B4=; b=RbIy6QxQ4n6nLxPbvAynBbX8pf4uJ3NYcuGkNvB7KF8kscdYTdyKmRtNArPL2pDcSA iTQhHQ0y01l4EQ1Vi1g8EdSB2ORRoI4qVgtOEehGATgzveaMve0i3uvUkyGua+1impAp z7wVNs9/xNj8ZRp8BHTrPX8jVaXgc6ilSMzKjB4ME2ibriLmPWbzbnO9Xod9UH7Qp+rm jSFg706OlVopTyG8KdrTFVkQ1FHKblrb7x9YtVpMng5TTL5DXnpvRhjoBSk54mgJ9RxT gDjcfNdR41pZHNcgY0/EKccsyg0FEXnUE4Fr4FlSaHVfotexHSoyh2V5rLKFH7VaNZCa 6jcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GIZtkIt7F6fxURYaK6v1S5ghisv1YvKa7oaIjfa51B4=; b=TXQizBm74AUlBurzzq8IMCk8H2w1iGUz24H6MiYsVJKQ02B9EcSI7YOGnpXUAMeRW7 K+cuRHv7Rk6BMPsMebrqsqA6AaRfB+vj0DQGePGBc1X0Zk5R5eL2JiWL16JhFBzROLlA 6pJIoiDOaVaminS5tqerkCZ06DM/saLUi5Kqd3NTWHDz529L6VAfRHR18PqjSGyUxe2k LY/EnYUSSLmYK6PNzbgwvGLdXrucYk+etqYBAAV74/w+3YtaJCXm9umZgmQ5Q/VAJ46f V5Nrscso2W/scTijWpOQCRV4rsp2ahAn7Y9GU+fxyrFE3msAtcklEyAHzf/7iaVIlrrz 5KgA== X-Gm-Message-State: AJcUukfTvf0p2HCPPzPuO4eiyu3iLeA9qtzEXL41n+CvFogfN9iiFsaM jTsdsBBZll11dF1a/NOsYPRPZa50bTs= X-Google-Smtp-Source: ALg8bN5jrhYevzmE+NEUJvgXp4+NCs5ehGhkPFepwPChUleu0X3pnfm/f5l65XdV6q4QeM5GgnVf9g== X-Received: by 2002:a63:3703:: with SMTP id e3mr2397705pga.348.1546624205986; Fri, 04 Jan 2019 09:50:05 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:05 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 13/20] PCI: imx6: Simplify pcie_phy_poll_ack() Date: Fri, 4 Jan 2019 09:49:18 -0800 Message-Id: <20190104174925.17153-14-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 672332483324..2a7075a9cba6 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -108,7 +108,7 @@ struct imx6_pcie { #define PCIE_PHY_CTRL_RD BIT(19) #define PCIE_PHY_STAT (PL_OFFSET + 0x110) -#define PCIE_PHY_STAT_ACK_LOC 16 +#define PCIE_PHY_STAT_ACK BIT(16) /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 @@ -125,16 +125,16 @@ struct imx6_pcie { #define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5) #define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3) -static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, int exp_val) +static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) { struct dw_pcie *pci = imx6_pcie->pci; - u32 val; + bool val; u32 max_iterations = 10; u32 wait_counter = 0; do { - val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); - val = (val >> PCIE_PHY_STAT_ACK_LOC) & 0x1; + val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT) & + PCIE_PHY_STAT_ACK; wait_counter++; if (val == exp_val) From patchwork Fri Jan 4 17:49:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748621 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 81C661575 for ; Fri, 4 Jan 2019 17:50:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7383428536 for ; Fri, 4 Jan 2019 17:50:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 679F528581; Fri, 4 Jan 2019 17:50:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EB1928536 for ; Fri, 4 Jan 2019 17:50:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728796AbfADRuJ (ORCPT ); Fri, 4 Jan 2019 12:50:09 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36033 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728739AbfADRuI (ORCPT ); Fri, 4 Jan 2019 12:50:08 -0500 Received: by mail-pf1-f196.google.com with SMTP id b85so18629875pfc.3; Fri, 04 Jan 2019 09:50:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l5Ov7DgLo0x+QhZh8MrjSzuZLAXS/elFdRJcT/iufBQ=; b=Z+x2Knz6I5ntkAKsqCwQ9anK0XjHjRnyoafbwABQO+I7pDLITu4um2CPX2i1Bckg6v 29Hh89TWOMYuvDjF+SUnwxxiFpptVU8xpnaxPHB/LFhUOAEHkr37M47CbH1XyoLDokRz uC7TfNtUpsaZh62rmf+rmbT+IF60xhv0/FjsFgkgAYaYoY0ShTPmCis2MPCFBsvQnEd8 gr6oPY1yKgev0dck7068HdqsS2bdNFzGKpt7Jn/Ailm+wrk/JlqWSHMI3mJ/VzaJxnSt HwP9NmJe/nY8wP2lhdvUBwjZKKkOMfRnLTpBUdqngwJ7ZcL4OIXFncAukcyntFifsoTK EuMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l5Ov7DgLo0x+QhZh8MrjSzuZLAXS/elFdRJcT/iufBQ=; b=tMHddmEb1iyvSqEpUuZn0v+C7hW2Zt/byI/hdmW4VWmTY7PIRrHvpYfe+XIOiE3+at dXso55fugbSH0z/8YUxyJAf2WUXgjvRCeJEHAoxVR3i/BfVHAEq5ve0sJl4O03z2x16q jeL2MQWGsbxscg/SsLNfEc3nUPXmdrUh2sgkiOKh5m9nZscWTFOW3LkAznJo56A6X5IE WNtxtyAPlPUXYdg0BLQwK0H6FrSXflvlCKomdUsV6zRfKgMfGo5LQVfgYhn4tJGYzX2E mHXt2W5Z1x5LLTZoeY7spfH8eb59NiPs9qCdfyP2umdxbScHiXOAN2pBeDQ4AaaTFwHz 6S3w== X-Gm-Message-State: AJcUukfZljBMDAz/1eKY7XkyKlk/L8JIcIF1AIHFhwKKd/9IXrAu0BqD RpAHlft3baljjox4iyozbeblR+PK/EQ= X-Google-Smtp-Source: ALg8bN7BnbCyiCZzhA0J1wCL/o1gaSR4ShCULsxdY5pRgwbfRrYr+yjjrTRBrpw6u9ccj+3j9K7Vwg== X-Received: by 2002:a63:2c82:: with SMTP id s124mr2385458pgs.73.1546624207694; Fri, 04 Jan 2019 09:50:07 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:06 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 14/20] PCI: imx6: Restrict PHY register data to 16-bit Date: Fri, 4 Jan 2019 09:49:19 -0800 Message-Id: <20190104174925.17153-15-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 2a7075a9cba6..02342b1762fa 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -169,10 +169,10 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) } /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ -static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) +static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) { struct dw_pcie *pci = imx6_pcie->pci; - u32 val, phy_ctl; + u32 phy_ctl; int ret; ret = pcie_phy_wait_ack(imx6_pcie, addr); @@ -187,8 +187,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) if (ret) return ret; - val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); - *data = val & 0xffff; + *data = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); /* deassert Read signal */ dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00); @@ -196,7 +195,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) return pcie_phy_poll_ack(imx6_pcie, 0); } -static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) +static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) { struct dw_pcie *pci = imx6_pcie->pci; u32 var; @@ -253,7 +252,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) { - u32 tmp; + u16 tmp; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return; @@ -620,7 +619,7 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) { unsigned long phy_rate = clk_get_rate(imx6_pcie->pcie_phy); int mult, div; - u32 val; + u16 val; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return 0; From patchwork Fri Jan 4 17:49:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748641 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 0AE8913AD for ; Fri, 4 Jan 2019 17:51:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1BC628305 for ; Fri, 4 Jan 2019 17:51:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3B2D2863E; Fri, 4 Jan 2019 17:51:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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 5DF3328305 for ; Fri, 4 Jan 2019 17:51:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728807AbfADRuL (ORCPT ); Fri, 4 Jan 2019 12:50:11 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42780 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728799AbfADRuK (ORCPT ); Fri, 4 Jan 2019 12:50:10 -0500 Received: by mail-pl1-f193.google.com with SMTP id y1so17723712plp.9; Fri, 04 Jan 2019 09:50:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2ynqU9RdFevJBXRMN2+g/v2PRS5HmTSTnfcgRpzk4u8=; b=Yxm6kEFjm2RkQF9s49Wl9lpLEKQaWCgrgGzJK5R9UHJS1UVgwCfVpbBNj348R2XrVH vCKcWseU0/+SDTW0SZCIQnfpwsLSPhFicU+1miWDTDv2N66o0oUW66Exns97ffW+qrfw RMf4fsveTwbB6IsQfIdhNAXuG6oduKU6iSd+XRY7PHg7obcSUgVAuy0yZbDag9KtjSWI +St4d34B1pyzcoTEqfExqV6SL8H4dXFEe+Yv66NljD3ZMlSUIpGTv0/l0B8NjVXA6vmB O+trOHSZ+k+E8Bzm7hX8+fd+d5A4GoWUzwwnWqL4aIxl0VMuts8wPyWmv55CRMoWYIan yM+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2ynqU9RdFevJBXRMN2+g/v2PRS5HmTSTnfcgRpzk4u8=; b=XZl6X68qlhqdyGS4yqXvhSvx57eWOd2FY6cFdbcH/VlhAZRrQnodtC0PaWMOUL1V2t /Llj/aGOQAtjbu1dO5UKlwH+T5WBujRw+oGuhg2JH9PFn1+EMI1La27kQ6w4wDAr6QG9 DRpb0MHxqmQD8FoTr75l3HWk2hLsfz2w6F7p+sA0qmFp19jEh5Sk12O4F71zwYJOn+if gTPGipYMfwEpZ2xgf72zg6NDYdl21V/x0qtpmx+27RjZOBD9GBKRYhNO5FY+I0h02edT 4L4vBUsw+BRNKBiSDesJgLFhYXIqEtVLfatINItphCsRXIFsodXUYm7A/Hih1Vk6h/oZ 2NkA== X-Gm-Message-State: AJcUukdOBba8othGwRxIYjOguVuV32YHVQ2KZwT3iU6a21nMTBjpEOAP Zn3aooH59E33dyWHSKdD06An2jxmxYE= X-Google-Smtp-Source: ALg8bN74f+KdjZLhDwczdKTH2whSmV69SzJxJ0xGAw4m/5SP+7k3rouC0lpqbaMiEbcPeqt+HnovEA== X-Received: by 2002:a17:902:20b:: with SMTP id 11mr51889493plc.57.1546624209871; Fri, 04 Jan 2019 09:50:09 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:09 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 15/20] PCI: imx6: Pass data to dw_pcie_writel_dbi() directly Date: Fri, 4 Jan 2019 09:49:20 -0800 Message-Id: <20190104174925.17153-16-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 02342b1762fa..befbc09c9c41 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -172,7 +172,6 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) { struct dw_pcie *pci = imx6_pcie->pci; - u32 phy_ctl; int ret; ret = pcie_phy_wait_ack(imx6_pcie, addr); @@ -180,8 +179,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) return ret; /* assert Read signal */ - phy_ctl = PCIE_PHY_CTRL_RD; - dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); + dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, PCIE_PHY_CTRL_RD); ret = pcie_phy_poll_ack(imx6_pcie, 1); if (ret) @@ -219,8 +217,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return ret; /* deassert cap data */ - var = PCIE_PHY_CTRL_DATA(data); - dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); + dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, PCIE_PHY_CTRL_DATA(data)); /* wait for ack de-assertion */ ret = pcie_phy_poll_ack(imx6_pcie, 0); @@ -228,8 +225,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return ret; /* assert wr signal */ - var = PCIE_PHY_CTRL_WR; - dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); + dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, PCIE_PHY_CTRL_WR); /* wait for ack */ ret = pcie_phy_poll_ack(imx6_pcie, 1); @@ -237,8 +233,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) return ret; /* deassert wr signal */ - var = PCIE_PHY_CTRL_DATA(data); - dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); + dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, PCIE_PHY_CTRL_DATA(data)); /* wait for ack de-assertion */ ret = pcie_phy_poll_ack(imx6_pcie, 0); From patchwork Fri Jan 4 17:49:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748639 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 343D913AD for ; Fri, 4 Jan 2019 17:51:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26CF428305 for ; Fri, 4 Jan 2019 17:51:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B22528630; Fri, 4 Jan 2019 17:51:09 +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 B782928305 for ; Fri, 4 Jan 2019 17:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728799AbfADRuN (ORCPT ); Fri, 4 Jan 2019 12:50:13 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:46553 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728830AbfADRuN (ORCPT ); Fri, 4 Jan 2019 12:50:13 -0500 Received: by mail-pl1-f196.google.com with SMTP id t13so17718730ply.13; Fri, 04 Jan 2019 09:50: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=wgbDW5dpUQt98rEUFIyBYJEI6ndB9gcDqUzY7mel/6s=; b=iEoo1a/OKkKJZtfMoSTJBNRwLRmxHYiy5BELr0ZahkEJGPUnWHwAwbGSGWVnA2K3N8 DWThaSV1BEmfcBxiAl1ghAgv91foOjqkSX4pMTvTNUCjzCLNrdOz1weDJPulXHqesjzh eo5y6w4t7zvPtU5sktiCfCu1pXpsRxMjWppuO9SHLgmgKT9gXL2SX8Wfj6adxuE+Rugt GNg31n1h4+XGXfq7q7scRS3JKuR0gATy2gkluOWZDDgVBnj+gkDP79Tcl6mcoJ0SV7QR 2uJGVeXBm/wDHSiTwgvW5dPiDfSObElXccqjn1ADPmRyVU/oijZ3B9efIS2HA31eCYsK FvuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wgbDW5dpUQt98rEUFIyBYJEI6ndB9gcDqUzY7mel/6s=; b=r15BFLgmVEGcWausMZX0/AtVHYZoYD4kTVZ+nfr8DHD5g5nc/588u6UTI2StSQeIQt Z38Y5awggrIFr0EkcboJm1vT4cv5/MEhx19UOZebMqP1KWxXtSPcS/ST4+X8bH3jOm6G 0k05mcVwEPLvzV+IFZatxMY9u8tD+VCOtooM3ankRwSCmQKoMD1Qhh3eSvErnj3lBin3 OomUyoe0sPPGAJ/1d0mFP44uGgbj8hvhY3MEq7ADzRfUCM3am08TPpHdWXkUApbHT2vc OvLpw+y+apa9lcNtD4GZX4MVw+pb27f5ghjgIJOVasxmQKolsNQaY4nFohVMNOGE3fgO mdDw== X-Gm-Message-State: AJcUukegV9vrZvO1H62dJ63i1lEbAvGqQRnz9drOCR9ZfZ6EnpXhNqbY Q0Y0ucqt65uCQxKPpF4Ri3S1mW0/Ztw= X-Google-Smtp-Source: ALg8bN7DWXymiFDJPJKMM8BjkzXwfxTzSSAkZlFhar78VPcv/On4+5l+ipcw6E2WWjhb9eRrCzZmFw== X-Received: by 2002:a17:902:2a66:: with SMTP id i93mr50874325plb.113.1546624211721; Fri, 04 Jan 2019 09:50:11 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:11 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 16/20] PCI: imx6: Use common mask in imx6_pcie_reset_phy() Date: Fri, 4 Jan 2019 09:49:21 -0800 Message-Id: <20190104174925.17153-17-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 befbc09c9c41..130f577670c8 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -247,21 +247,21 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) { + const u16 mask = PHY_RX_OVRD_IN_LO_RX_DATA_EN | + PHY_RX_OVRD_IN_LO_RX_PLL_EN; u16 tmp; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return; pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); - tmp |= (PHY_RX_OVRD_IN_LO_RX_DATA_EN | - PHY_RX_OVRD_IN_LO_RX_PLL_EN); + tmp |= mask; pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); usleep_range(2000, 3000); pcie_phy_read(imx6_pcie, PHY_RX_OVRD_IN_LO, &tmp); - tmp &= ~(PHY_RX_OVRD_IN_LO_RX_DATA_EN | - PHY_RX_OVRD_IN_LO_RX_PLL_EN); + tmp &= ~mask; pcie_phy_write(imx6_pcie, PHY_RX_OVRD_IN_LO, tmp); } From patchwork Fri Jan 4 17:49:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748637 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 042046C2 for ; Fri, 4 Jan 2019 17:51:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC5DA28305 for ; Fri, 4 Jan 2019 17:51:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEB4928630; Fri, 4 Jan 2019 17:51:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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 7E02928305 for ; Fri, 4 Jan 2019 17:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728877AbfADRuU (ORCPT ); Fri, 4 Jan 2019 12:50:20 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:40651 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728856AbfADRuO (ORCPT ); Fri, 4 Jan 2019 12:50:14 -0500 Received: by mail-pl1-f193.google.com with SMTP id u18so17726605plq.7; Fri, 04 Jan 2019 09:50:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=smdD9M2YSE1AOghnOpWt9rwK4kDd0JsF0HnKCn2DuJU=; b=odqTjkGm12K4IG7dhiJR/Ldk4BrRbMGJwKZ5NN0FMikHY6exsnheg/PUKCX4tP/ZhO 3OK8vBUSevmn55+OSq4+JSTdbaCmnMHVuFJXMrecrW1FJlRIGC0s2sxuD7v6ABcIqCz8 zge2uOu/5aItwK/nFBEluYgZTJkQn+Gry4X2RRxlbLlYE1E1Rx7wMPuhQXu7FnHEpPzR 6JcFr1VcaJJt5ed6yiqF+isMKu7jGWAiaJ4+RbgVmYOv3Y8IVCsUYOtZIlsWCrRPhx3y OANpKALDhlvo9X4nwvaJCniSuD4gR0FQ7yNQSxWh/8mlIFvMewVj3JQ4heyc7upI/oj/ nlRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=smdD9M2YSE1AOghnOpWt9rwK4kDd0JsF0HnKCn2DuJU=; b=h3UiMGtaoEOjp65BA1kc3uvxan30YsC3FyZw11xJViepRengM3nUeaSog28haBYcqC 1VOT+urMPfKFUr2gBC5l7b3m9LfURtpXRFN6BTcgHOSxijDOUpiv+A5obPwtsMEM0gHP aOPoiVoNPMBh1FU6UCfYb/czpyDkkzTU4eyksew+a2yX+66cnuf4JuvCBWyyyhMb39xH iOrBeSGs5mtHW5IGgHsdYCpwaXCKKdibYvc6DVgJpNaWQFe9erKdD4jsSMvw7B5S54HH k1VLKC2JvMBpT/kg0urL9zudFdXbOKfNQDugnCq44Dw7txGijOGwBkqytPbIWawjCLcD tMlQ== X-Gm-Message-State: AJcUukeQrX8PEQlLejQlnf0WlCFQSgIZWRcNQ6S2IWzt5PhPcResGJjy lYbJ1k+VE8hKOT/WasS6sRl6OiReiAw= X-Google-Smtp-Source: ALg8bN5qQdMltuObfh6awk76R3n49OZJYHiTOTK09WcJejGUwexLIMohtoIHao0UtMQAlWHg3BT+TQ== X-Received: by 2002:a17:902:8306:: with SMTP id bd6mr52122019plb.217.1546624213731; Fri, 04 Jan 2019 09:50:13 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:12 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 17/20] PCI: imx6: Simplify bit operations in imx6_setup_phy_mpll() Date: Fri, 4 Jan 2019 09:49:22 -0800 Message-Id: <20190104174925.17153-18-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 130f577670c8..d8aef9da476f 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -113,12 +113,10 @@ struct imx6_pcie { /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 #define PCIE_PHY_ATEOVRD_EN BIT(2) -#define PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT 0 -#define PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK 0x1 +#define PCIE_PHY_ATEOVRD_REF_CLKDIV BIT(0) #define PCIE_PHY_MPLL_OVRD_IN_LO 0x11 -#define PCIE_PHY_MPLL_MULTIPLIER_SHIFT 2 -#define PCIE_PHY_MPLL_MULTIPLIER_MASK 0x7f +#define PCIE_PHY_MPLL_MULTIPLIER GENMASK(8, 2) #define PCIE_PHY_MPLL_MULTIPLIER_OVRD BIT(9) #define PHY_RX_OVRD_IN_LO 0x1005 @@ -641,16 +639,14 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) } pcie_phy_read(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, &val); - val &= ~(PCIE_PHY_MPLL_MULTIPLIER_MASK << - PCIE_PHY_MPLL_MULTIPLIER_SHIFT); - val |= mult << PCIE_PHY_MPLL_MULTIPLIER_SHIFT; + val &= ~PCIE_PHY_MPLL_MULTIPLIER; + val |= FIELD_PREP(PCIE_PHY_MPLL_MULTIPLIER, mult); val |= PCIE_PHY_MPLL_MULTIPLIER_OVRD; pcie_phy_write(imx6_pcie, PCIE_PHY_MPLL_OVRD_IN_LO, val); pcie_phy_read(imx6_pcie, PCIE_PHY_ATEOVRD, &val); - val &= ~(PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK << - PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT); - val |= div << PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT; + val &= ~PCIE_PHY_ATEOVRD_REF_CLKDIV; + val |= FIELD_PREP(PCIE_PHY_ATEOVRD_REF_CLKDIV, div); val |= PCIE_PHY_ATEOVRD_EN; pcie_phy_write(imx6_pcie, PCIE_PHY_ATEOVRD, val); From patchwork Fri Jan 4 17:49:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748625 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 B07381575 for ; Fri, 4 Jan 2019 17:50:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A2DFE285B6 for ; Fri, 4 Jan 2019 17:50:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9725D285E1; Fri, 4 Jan 2019 17:50:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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 3F8F3285B6 for ; Fri, 4 Jan 2019 17:50:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728830AbfADRuR (ORCPT ); Fri, 4 Jan 2019 12:50:17 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:39312 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728869AbfADRuR (ORCPT ); Fri, 4 Jan 2019 12:50:17 -0500 Received: by mail-pl1-f196.google.com with SMTP id 101so17734076pld.6; Fri, 04 Jan 2019 09:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UaA45DYiu1lBKpFMAL9ysyx77C82thANkIMXH/mfBAE=; b=Bs3tzkr/uZcCHPaZu2HC5rYTi8GL2xZCuXOZqzuKLivxSlZKMduu5g57xFjts444WS aLTTJjrYRcQxVpLNnfPQt6OAoisHm/NSpTJyfXH1d7PytSHs27GbyRNl8SujipOFhyjJ NnYUlQHLxMA8ZgnFhxlLbO/haYwJFygVbnASjw7l9I68RaR3h5MyZOhTAKG4USmh1gRP ygOOi61RG7LOGat1w7HY23N82Kqk/IV+4VnGyP6ZkLlIFadq7Wf6ag4EMlfirn8HPMh0 XbJe22qc5MXA1xr4f2TLR+/SemO5mZu9d9crmelJJTrHpoYR2hGIJ+Z8fYPjnxrQrxpe mvPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UaA45DYiu1lBKpFMAL9ysyx77C82thANkIMXH/mfBAE=; b=gIbWFrZmzZ+asUTEYfQwq6V1nVU6NCLW12TkQVKIBtc3QwDg0Bf2b5nePJ6pe9tueE FxN4k2d+FO0otan4syajXlPRPpm+jRoq7ia5WH5Cl2lB4a1SMvUwGucBF9VIQO9T0Uxj jRHlzko+LVeinEy+9ObKLCe6klEhBL7XraQgLTnmNLq4rNndgfjaGnffqlLq+kpvNYWc JMSYX5teA/FTSEPiKYBWxe8uaUITbH+VSgihm7WS7u3AunZtQiwhmq9r6afAG+9PASrN ah8lh8n7Tbbr3B/J+NtIrmdpTWsSjQv/9cecm1VRQ8yW0oKjys7oGxiu0+J5Y45xPsRs CT7A== X-Gm-Message-State: AJcUukfvcHW7BbjbKgmwsxIklTFRIEdVIQ0uGVdtmIG+mrZ8eCQsQ6Ew fKuCXdRWt2UWZJ2I0KdFf0yg1DvEgU0= X-Google-Smtp-Source: ALg8bN6KeuZvj5+hH6fAqcxHS1bkhdDruLVrs8+ZmBPnURzylt69qWEgGUKtUB4UE4vpX1xHqF/LzA== X-Received: by 2002:a17:902:981:: with SMTP id 1mr50372962pln.142.1546624215901; Fri, 04 Jan 2019 09:50:15 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:15 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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 v2 18/20] PCI: imx6: Remove magic numbers from imx6_pcie_establish_link() Date: Fri, 4 Jan 2019 09:49:23 -0800 Message-Id: <20190104174925.17153-19-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 d8aef9da476f..f2aca339e9b7 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -96,6 +96,7 @@ struct imx6_pcie { #define PCIE_RC_LCR_MAX_LINK_SPEEDS_MASK 0xf #define PCIE_RC_LCSR 0x80 +#define PCIE_RC_LCSR_LINK_SPEED GENMASK(19, 16) /* PCIe Port Logic registers (memory-mapped) */ #define PL_OFFSET 0x700 @@ -766,8 +767,9 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) dev_info(dev, "Link: Gen2 disabled\n"); } - tmp = dw_pcie_readl_dbi(pci, PCIE_RC_LCSR); - dev_info(dev, "Link up, Gen%i\n", (tmp >> 16) & 0xf); + tmp = FIELD_GET(PCIE_RC_LCSR_LINK_SPEED, + dw_pcie_readl_dbi(pci, PCIE_RC_LCSR)); + dev_info(dev, "Link up, Gen%i\n", tmp); return 0; err_reset_phy: From patchwork Fri Jan 4 17:49:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748627 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 078DE1575 for ; Fri, 4 Jan 2019 17:50:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE525285B6 for ; Fri, 4 Jan 2019 17:50:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2D06285E1; Fri, 4 Jan 2019 17:50:21 +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 77A02285B6 for ; Fri, 4 Jan 2019 17:50:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728874AbfADRuU (ORCPT ); Fri, 4 Jan 2019 12:50:20 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45433 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728873AbfADRuT (ORCPT ); Fri, 4 Jan 2019 12:50:19 -0500 Received: by mail-pl1-f194.google.com with SMTP id a14so17709428plm.12; Fri, 04 Jan 2019 09:50: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=Ov2inzM6fmFsHxVXZyw47G5jAGapuFYmlo7Z2pYF+A4=; b=NSDrUz1+OyzaRb50gRYowv+DmQFRwrYEXrwcexaVdgpbtm2OcCQH/c6IsvgxnNbUQV SQnmB0ervyPs5xksbILe2uICoHmidWtJwA5H2aSuVzCNH2SnOSQAG9JA+m/FQLPV+R2d BWu0VNNM4KYaWIkv89pXgIjtQ5sqARb4KvuDe39Zr/GX37GyEyLcdWgUrgRAXHmUZWav WXHC4xgs1eMbwmJmahKuHVMHa7RCRA4CsIRoFR+XJEGBlNy0Tr6d2+HVQJ15EG3dhgKx fd+3ru78xYV8vf/pv1+yvVtpnzKqIyoA9+I7oxfxUvQ+8eNm4GzUD5R8A8Xd0sSTEP4k XOpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ov2inzM6fmFsHxVXZyw47G5jAGapuFYmlo7Z2pYF+A4=; b=PBjpBiyflVo2MdpodW5Q1Qgezv1qBXrxlhwrdKKjKPfUZfG5VORPMXzlnZ6iLYUrSl ONidgvY84KRrpNxDKMeDA7HC2eucMGkqqd8pXWM7bwLo9dauPzIO7La8xtlnKfji5QnZ /0XbuymZx8EXa1rV/gJ7GOWbEC/T5wjkK3xoofDgra2C+X3ZtgDiV6BW3R5gnmQKAhSP vHmRLsKo7EahQ2/iwk5i37wBS2uype6Bmk/Fvytyu9f9ZHCurE6m07Xi5RGD2/a83kfc zEDTlV54BCWWAlpKOG5Ke4qJuisVYskAeSW2937C/5e2/xSd6XMI9tVNOBVLahSfMm96 e57g== X-Gm-Message-State: AJcUukd0Wd8pJ1SzUUwByaPxikXIx1HM9oCv6L0tcbRp7NfsgMnIfrm2 cYcsjtkQauviC0aiwgXMhgtEHbP1AxA= X-Google-Smtp-Source: ALg8bN7dll8BIEIMeQjyCMVC2YFm7bkE5lkyAhEm2YQ+R2M1KCYoAMOgs4MlapKUQffzuuYBvNp1nw== X-Received: by 2002:a17:902:4324:: with SMTP id i33mr50716390pld.227.1546624218388; Fri, 04 Jan 2019 09:50:18 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:17 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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, Gustavo Pimentel Subject: [PATCH v2 19/20] PCI: dwc: Make use of GENMASK/FIELD_PREP Date: Fri, 4 Jan 2019 09:49:24 -0800 Message-Id: <20190104174925.17153-20-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pcie-designware.h | 29 +++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 348e91b6daa2..0de653284fca 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -11,6 +11,7 @@ #ifndef _PCIE_DESIGNWARE_H #define _PCIE_DESIGNWARE_H +#include #include #include #include @@ -30,11 +31,12 @@ /* Synopsys-specific PCIe configuration registers */ #define PCIE_PORT_LINK_CONTROL 0x710 -#define PORT_LINK_MODE_MASK (0x3f << 16) -#define PORT_LINK_MODE_1_LANES (0x1 << 16) -#define PORT_LINK_MODE_2_LANES (0x3 << 16) -#define PORT_LINK_MODE_4_LANES (0x7 << 16) -#define PORT_LINK_MODE_8_LANES (0xf << 16) +#define PORT_LINK_MODE_MASK GENMASK(21, 16) +#define PORT_LINK_MODE(n) FIELD_PREP(PORT_LINK_MODE_MASK, n) +#define PORT_LINK_MODE_1_LANES PORT_LINK_MODE(0x1) +#define PORT_LINK_MODE_2_LANES PORT_LINK_MODE(0x3) +#define PORT_LINK_MODE_4_LANES PORT_LINK_MODE(0x7) +#define PORT_LINK_MODE_8_LANES PORT_LINK_MODE(0xf) #define PCIE_PORT_DEBUG0 0x728 #define PORT_LOGIC_LTSSM_STATE_MASK 0x1f @@ -45,11 +47,12 @@ #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C #define PORT_LOGIC_SPEED_CHANGE BIT(17) -#define PORT_LOGIC_LINK_WIDTH_MASK (0x1f << 8) -#define PORT_LOGIC_LINK_WIDTH_1_LANES (0x1 << 8) -#define PORT_LOGIC_LINK_WIDTH_2_LANES (0x2 << 8) -#define PORT_LOGIC_LINK_WIDTH_4_LANES (0x4 << 8) -#define PORT_LOGIC_LINK_WIDTH_8_LANES (0x8 << 8) +#define PORT_LOGIC_LINK_WIDTH_MASK GENMASK(12, 8) +#define PORT_LOGIC_LINK_WIDTH(n) FIELD_PREP(PORT_LOGIC_LINK_WIDTH_MASK, n) +#define PORT_LOGIC_LINK_WIDTH_1_LANES PORT_LOGIC_LINK_WIDTH(0x1) +#define PORT_LOGIC_LINK_WIDTH_2_LANES PORT_LOGIC_LINK_WIDTH(0x2) +#define PORT_LOGIC_LINK_WIDTH_4_LANES PORT_LOGIC_LINK_WIDTH(0x4) +#define PORT_LOGIC_LINK_WIDTH_8_LANES PORT_LOGIC_LINK_WIDTH(0x8) #define PCIE_MSI_ADDR_LO 0x820 #define PCIE_MSI_ADDR_HI 0x824 @@ -75,9 +78,9 @@ #define PCIE_ATU_UPPER_BASE 0x910 #define PCIE_ATU_LIMIT 0x914 #define PCIE_ATU_LOWER_TARGET 0x918 -#define PCIE_ATU_BUS(x) (((x) & 0xff) << 24) -#define PCIE_ATU_DEV(x) (((x) & 0x1f) << 19) -#define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16) +#define PCIE_ATU_BUS(x) FIELD_PREP(GENMASK(31, 24), x) +#define PCIE_ATU_DEV(x) FIELD_PREP(GENMASK(23, 19), x) +#define PCIE_ATU_FUNC(x) FIELD_PREP(GENMASK(18, 16), x) #define PCIE_ATU_UPPER_TARGET 0x91C #define PCIE_MISC_CONTROL_1_OFF 0x8BC From patchwork Fri Jan 4 17:49:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10748635 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 752686C2 for ; Fri, 4 Jan 2019 17:51:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 689EE2861E for ; Fri, 4 Jan 2019 17:51:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5B99428630; Fri, 4 Jan 2019 17:51:05 +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 F0DED2861E for ; Fri, 4 Jan 2019 17:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728969AbfADRuk (ORCPT ); Fri, 4 Jan 2019 12:50:40 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:45379 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728887AbfADRuW (ORCPT ); Fri, 4 Jan 2019 12:50:22 -0500 Received: by mail-pg1-f195.google.com with SMTP id y4so17767240pgc.12; Fri, 04 Jan 2019 09:50:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f2zFuyHm8nEdjnfJDmsDhZ6LWDdoDXqHHbGY0Z+L7BY=; b=avaFwitLVqF1WLutZiOj/v4o0ynDRwJO+ElVicQxUpG98KuEEireOp+xpZrw0xZwQJ ZRAGv4+qsLQgbVhAcF9uO9Y6gEaR+sZjErsYYABnmU8YLifDJOAr0VF8ER7QjkN25cZ4 Mo4/c65UDgYj6+LWmmHgXokUoyvTIQ3CTnH3FI41NV9oFMT85aFnVRe1VX8RVKjIOCNq Tltk/1tpieU8sKkw+F7vxxDoUXpUaTcnEqq8g/doK3gfwhu84q4INt5Vns35qRcqHaQe RvzwMLJL867FhnTHC8tW3P40eEa9/NFvtOeq1//QcNhDabh1qto0u2VZxjmCRGkSY690 BENQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f2zFuyHm8nEdjnfJDmsDhZ6LWDdoDXqHHbGY0Z+L7BY=; b=AVyke1iqSTlXwz1ftaK/iXsVKvwiAJtZIxywVTCjC+ipdFG+bPTupCy+CuxIkgCymw bAtZ3ByqCjcDIZRpqSIf/gcs0Lz+3dqVimEYJk+9aK7HHgUXzj+Id0scKzeNxaySkJXw cl+qlnvC/ujLqpdahzVNMYGWqLZSANT2qlrXxTZ5t1OkQorhXOtxpnalibi3tpczksea k86xOKM5Bj1JQG/NkDmx2OnIe5KmHzvc4F3RohQUrWlWsaG29GXcEgXZqPjqESIo40W8 /LdQTA56Y/ohcuhaw3s4DMcjsQrrSm/cJ+e75VG3AwYEoOpDYL0FnphmY8Gf8slF6S5E 2ydQ== X-Gm-Message-State: AA+aEWYqcDD7i/njUlGk9lRYKqImFXjyPz4VboZyjUNmkwM2HlhIlWAb IbVMBCZ9h/dLvi6mt5Tk3cVCVfPRscM= X-Google-Smtp-Source: AFSGD/UUBJh8pSGiYrD6XyoNobfobXZ/MOuQezUc5bLzOuCVreeYIfxnWKi2HmVlZZroiMi3VbEUZw== X-Received: by 2002:a62:3811:: with SMTP id f17mr54238299pfa.206.1546624221002; Fri, 04 Jan 2019 09:50:21 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id i193sm100699632pgc.22.2019.01.04.09.50.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Jan 2019 09:50:20 -0800 (PST) From: Andrey Smirnov To: linux-pci@vger.kernel.org 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, Gustavo Pimentel Subject: [PATCH v2 20/20] PCI: dwc: Remove superfluous shifting in definitions Date: Fri, 4 Jan 2019 09:49:25 -0800 Message-Id: <20190104174925.17153-21-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190104174925.17153-1-andrew.smirnov@gmail.com> References: <20190104174925.17153-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 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 Acked-by: Gustavo Pimentel Signed-off-by: Andrey Smirnov --- drivers/pci/controller/dwc/pcie-designware.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 0de653284fca..636689fd4ee7 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -63,14 +63,14 @@ #define PCIE_ATU_VIEWPORT 0x900 #define PCIE_ATU_REGION_INBOUND BIT(31) #define PCIE_ATU_REGION_OUTBOUND 0 -#define PCIE_ATU_REGION_INDEX2 (0x2 << 0) -#define PCIE_ATU_REGION_INDEX1 (0x1 << 0) -#define PCIE_ATU_REGION_INDEX0 (0x0 << 0) +#define PCIE_ATU_REGION_INDEX2 0x2 +#define PCIE_ATU_REGION_INDEX1 0x1 +#define PCIE_ATU_REGION_INDEX0 0x0 #define PCIE_ATU_CR1 0x904 -#define PCIE_ATU_TYPE_MEM (0x0 << 0) -#define PCIE_ATU_TYPE_IO (0x2 << 0) -#define PCIE_ATU_TYPE_CFG0 (0x4 << 0) -#define PCIE_ATU_TYPE_CFG1 (0x5 << 0) +#define PCIE_ATU_TYPE_MEM 0x0 +#define PCIE_ATU_TYPE_IO 0x2 +#define PCIE_ATU_TYPE_CFG0 0x4 +#define PCIE_ATU_TYPE_CFG1 0x5 #define PCIE_ATU_CR2 0x908 #define PCIE_ATU_ENABLE BIT(31) #define PCIE_ATU_BAR_MODE_ENABLE BIT(30)