From patchwork Mon Apr 15 00:46: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: 10900051 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 97F3917EF for ; Mon, 15 Apr 2019 00:48:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 809F92012F for ; Mon, 15 Apr 2019 00:48:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74CFA2861C; Mon, 15 Apr 2019 00:48:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16012285FB for ; Mon, 15 Apr 2019 00:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726475AbfDOAr3 (ORCPT ); Sun, 14 Apr 2019 20:47:29 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:43421 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726178AbfDOAr3 (ORCPT ); Sun, 14 Apr 2019 20:47:29 -0400 Received: by mail-pf1-f195.google.com with SMTP id c8so7696905pfd.10; Sun, 14 Apr 2019 17:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ViVmupe5SgRSeZM1zRYXRJzTPlsKO2l+aVu7kqlxatY=; b=JlQAvIA9pt6NOCDRiqJXaJC8iDQVv4OdO9RlBdaREdFG6CBDsHikcZom6DrqoQeBY9 U61+MQw0j2GI0J3R6JG0XfDOP3xMZBtqC/klOHysSDEriq4uPZAEvIuSRgptJg1QwNOy Asl6N2OvUK/oLq0wsKZ8HpsbxNM7i9XRxlG++P6sbQ4tooVnlHpMLPrRprMZ6KMOlFqs Tis+mmAUZyV4+2srUvxfQUQAZqcX+6dSpwnykEX4wxzhPwAIVtJ51ZrfiN26+fF9G/p1 zG1b0zZzQeX5OcUEsORHtKB9qPjWHFNeaOwdN68sW103T+rYcptHZk74OPXw2LsMuS76 5YLQ== 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=ViVmupe5SgRSeZM1zRYXRJzTPlsKO2l+aVu7kqlxatY=; b=m7ipAvgNMTGKYy09ireM9XQtBAoppZUUDanNC4FrwhXughhNz7vSwHbNnYygT9l8CA UjAv/s2HtfijIzDq/vcueqW80wYc5R4eLKisXd2Y0d9d9aUdApTs4Fnt6HAUdVnpLQrm kKfy5XroNydcR6fFhOLJywCLiAioqV0SC4HlQ7dpCrvVS+Nk6H+MOrFSpJjZgr3qnQC7 sNDvXOUIYMPx4PHAr3l2dM1TDX6mE2gL6nTGYyh5accy/OURvuZHMQHX38CtMRp5ydi7 ow5igK1w7SYBEqcZl+CHR1q1StjOdo1/sXPS8o+aE/0/bgHlRnBy6E0bPiGzMBlRhKE5 4yLA== X-Gm-Message-State: APjAAAUe0gHtpwO28urXXDonr+0oLHhyOxCoEJ2LFi21Uz/zsKbIZSYY RAs/2rvR8A2th9osF7NqwOQ3cmze X-Google-Smtp-Source: APXvYqx8nC0z5GM5dQYPF8OiBO2vQYfluJMtmWdbKpd3utkYSJFxrERzsojaxRaK0XqfRqCWDAyKTw== X-Received: by 2002:a65:4108:: with SMTP id w8mr66630581pgp.236.1555289248042; Sun, 14 Apr 2019 17:47:28 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:26 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 01/11] PCI: imx6: Simplify imx7d_pcie_wait_for_phy_pll_lock() Date: Sun, 14 Apr 2019 17:46:22 -0700 Message-Id: <20190415004632.5907-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- 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 3d627f94a166..ea2617712a3b 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -89,9 +89,8 @@ struct imx6_pcie { }; /* Parameters for the waiting for PCIe PHY PLL to lock on i.MX7 */ -#define PHY_PLL_LOCK_WAIT_MAX_RETRIES 2000 -#define PHY_PLL_LOCK_WAIT_USLEEP_MIN 50 #define PHY_PLL_LOCK_WAIT_USLEEP_MAX 200 +#define PHY_PLL_LOCK_WAIT_TIMEOUT (2000 * PHY_PLL_LOCK_WAIT_USLEEP_MAX) /* PCIe Root Complex registers (memory-mapped) */ #define PCIE_RC_IMX6_MSI_CAP 0x50 @@ -488,20 +487,14 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) { u32 val; - unsigned int retries; struct device *dev = imx6_pcie->pci->dev; - for (retries = 0; retries < PHY_PLL_LOCK_WAIT_MAX_RETRIES; retries++) { - regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR22, &val); - - if (val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED) - return; - - usleep_range(PHY_PLL_LOCK_WAIT_USLEEP_MIN, - PHY_PLL_LOCK_WAIT_USLEEP_MAX); - } - - dev_err(dev, "PCIe PLL lock timeout\n"); + if (regmap_read_poll_timeout(imx6_pcie->iomuxc_gpr, + IOMUXC_GPR22, val, + val & IMX7D_GPR22_PCIE_PHY_PLL_LOCKED, + PHY_PLL_LOCK_WAIT_USLEEP_MAX, + PHY_PLL_LOCK_WAIT_TIMEOUT)) + dev_err(dev, "PCIe PLL lock timeout\n"); } static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) From patchwork Mon Apr 15 00:46: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: 10900031 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 D0A591390 for ; Mon, 15 Apr 2019 00:47:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B99312012F for ; Mon, 15 Apr 2019 00:47:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE2B52861C; Mon, 15 Apr 2019 00:47:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 819222012F for ; Mon, 15 Apr 2019 00:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbfDOArb (ORCPT ); Sun, 14 Apr 2019 20:47:31 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40504 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbfDOAra (ORCPT ); Sun, 14 Apr 2019 20:47:30 -0400 Received: by mail-pg1-f195.google.com with SMTP id d31so7714620pgl.7; Sun, 14 Apr 2019 17:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZAdm/vG86hflxhCcEg67tfgVoXjeF3f0FU+ijE2iqzc=; b=n9Y0RN4PNgdPwN6k9dTLOVyPbtIQID6vLeQ7waedD1PkU2iBk/RWWcQ6/HA0ra/2de tNSlt/OTfCJsuleI/4oRgv/WC9hT9MGOPj8i2UFDKaKeDeWkXMHX7wip8Z9tiyPna9Sa ir0ORdUV8xWu2oo3e3oMdSGRflm59HxZZADajkM9v/KcUT6ij6nowO8hUrNXmF+DUjtn I3lBVo+2DQv2YY/xu3Fhr5ADFTLRqnxeat+9ej0xdwqnF1P1cvMfB73l5Ndme4mrk50N scd0COfvlaIdusz/MgAX0VIL4JnxMlOb/nJ03kQGzVDugDHGpCppUfdja+95Hw8uLyL0 gojw== 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=ZAdm/vG86hflxhCcEg67tfgVoXjeF3f0FU+ijE2iqzc=; b=JI4PxBx4F34atCEFbCCDmc+L+P/ZjyTCI0iLBck0DbHKtl9nj/u8bXaqVwOECcHJH2 Zpo5x41IyrWYRqmD5hqG1edxpEWUZ3NfY+jcbNfA5NBU4ZUsLFfuzYzzG9xRorNAe1hg nV4evxDCw7llZSNiRhen84Cl7fhERcaGI8LONwsLtbcMHlpIJ8qGAEYxAGXjhRu9S+kZ x9Y/d+IbYNmQLaJHhqWJ/DuaI4D8VcTmpRA6vBsy7gFRvLQssM03QWp7ykWHq4HKKx7p EiD3OLF/dSBb0CyrSwYqb+f136UbyMFNyM0uVluAA49p3lxyaxnzPe5AkfDVYFUnToEb fq6w== X-Gm-Message-State: APjAAAX5WGYqCkcf2ieZdMC0cPY0js3vvjugecOG7jU7eUlRu1ADpZes mFgvGbDcEFqn7OcGcM2tub/tn1Td X-Google-Smtp-Source: APXvYqzu8CXJA8mDHVcGjK1dWj9/Er/DOXiIXfFhmRes9GcM+ZkEDh9IhgPgUrePDbv52YCYPmhDVw== X-Received: by 2002:a63:29c8:: with SMTP id p191mr67531444pgp.197.1555289249472; Sun, 14 Apr 2019 17:47:29 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:28 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 02/11] PCI: imx6: Drop imx6_pcie_wait_for_link() Date: Sun, 14 Apr 2019 17:46:23 -0700 Message-Id: <20190415004632.5907-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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, so there's no real reason we can't just use dw_pcie_wait_for_link(). Drop imx6_pcie_wait_for_link() and replace it with dw_pcie_wait_for_link(). Signed-off-by: Andrey Smirnov Suggested-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index ea2617712a3b..bb3dcfdbf697 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -723,21 +723,6 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) return 0; } -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; -} - static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) { struct dw_pcie *pci = imx6_pcie->pci; @@ -796,7 +781,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) /* Start LTSSM. */ imx6_pcie_ltssm_enable(dev); - ret = imx6_pcie_wait_for_link(imx6_pcie); + ret = dw_pcie_wait_for_link(pci); if (ret) goto err_reset_phy; @@ -834,7 +819,7 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) } /* Make sure link training is finished as well! */ - ret = imx6_pcie_wait_for_link(imx6_pcie); + ret = dw_pcie_wait_for_link(pci); if (ret) { dev_err(dev, "Failed to bring link up!\n"); goto err_reset_phy; From patchwork Mon Apr 15 00:46: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: 10900049 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 61FC91390 for ; Mon, 15 Apr 2019 00:48:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 487822012F for ; Mon, 15 Apr 2019 00:48:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B67428639; Mon, 15 Apr 2019 00:48:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EFFD2012F for ; Mon, 15 Apr 2019 00:48:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726626AbfDOAsW (ORCPT ); Sun, 14 Apr 2019 20:48:22 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36273 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726178AbfDOArb (ORCPT ); Sun, 14 Apr 2019 20:47:31 -0400 Received: by mail-pl1-f195.google.com with SMTP id ck15so7706942plb.3; Sun, 14 Apr 2019 17:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4GxuKyo+B/7MbRuzp+bShwrzV//RQSTv8UPpnXETmOQ=; b=Bwx1ORezfx4adyMoVZvaNhKYAezLR17LZ13BX1BGoyzy2boc3PRupDzTWIqjtVz88U 43BSUQZNj96vMWUCEdRSavtp6OEBYPDbJ2wWSTPlZikk11r4lLVym7wUDx38gfyzVXOq nEU7uzofvMNNwwo5wQH74Wi2sIdNnCl1IdKP3CNGWrucN2qkhEH8aCUHuG/HMBiXxSlg 4gesDnGKNIBqE9u/CvgOm8fQgLnO+AXz28DO1vaF/EFpgkHA/UL53S/4MiehkmXKGuRC VwHuOSU3URAZyhPNpm8N0+smr3wZM1tViEtGJJT9Gfzju5tzmNM9WxVMfOBTeKGtQqyj qGCQ== 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=4GxuKyo+B/7MbRuzp+bShwrzV//RQSTv8UPpnXETmOQ=; b=iterJMDffHxa0XUijLkuZYyWI9bMwm0Ie/9pa3CxYXc2MSQKvo8cQNJRrvcxqpXNKD 2mUGyZ5tXqtOhSLOmP115XjPO5HLFa40RxyYwhaK1mleEowTC6Kwou5qXfPq9K6IJuWq eKDHnCAKRmSmhPDdws+/FDZZhmUb9vurYX3YvvG/xFqKtPCtBga9Ytwb4xCsTl26varU ahuCK0ilWo9mGI0TgGfWZ3YfewqHFjZV8K8WexLBnRKGDoN0k4O5wCZH6/gUKhep5F/J g/Pq/6EhdZxjuDXhytrwz+rElzceXXeRiYZ9yUJGMN8iS8hB66y5rKLqZmdGkV+PdeX/ gyFA== X-Gm-Message-State: APjAAAXcLeJikzRiqm92PDHTZq4qmS1hqw2QC6UkSiNrADexJsXvzRH9 M6BkAIIADnpH8i/y1HEee5D0ZvLt X-Google-Smtp-Source: APXvYqxD8SPh+An9HHu8MKhajezK5gAKwk3tDKVhH1ykKQgMdA0SLfWlN9MHsbv6MlpKrjpkeJ8Stw== X-Received: by 2002:a17:902:2702:: with SMTP id c2mr53116686plb.37.1555289250700; Sun, 14 Apr 2019 17:47:30 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:29 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 03/11] PCI: imx6: Return -ETIMEOUT from imx6_pcie_wait_for_speed_change() Date: Sun, 14 Apr 2019 17:46:24 -0700 Message-Id: <20190415004632.5907-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- 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 bb3dcfdbf697..021ef121a058 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -739,7 +739,7 @@ static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) } dev_err(dev, "Speed change timeout\n"); - return -EINVAL; + return -ETIMEDOUT; } static void imx6_pcie_ltssm_enable(struct device *dev) From patchwork Mon Apr 15 00:46: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: 10900047 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 D63A6922 for ; Mon, 15 Apr 2019 00:48:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD7C92012F for ; Mon, 15 Apr 2019 00:48:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B20542861C; Mon, 15 Apr 2019 00:48: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 631252012F for ; Mon, 15 Apr 2019 00:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726880AbfDOArd (ORCPT ); Sun, 14 Apr 2019 20:47:33 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36331 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbfDOArd (ORCPT ); Sun, 14 Apr 2019 20:47:33 -0400 Received: by mail-pf1-f195.google.com with SMTP id z5so7716326pfn.3; Sun, 14 Apr 2019 17:47:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9beIuYqBF6SILMxXaavWO/q8AQSlMA1a2HjBO8p38og=; b=rZDowLZqJw3bbECWetTAiWiAIYWB/pbTb6fjFNQC/bCujN2AJJ0K/7GGmGKJiFASau pC8q56ANjK1KplTa6QSiN6LSNglmqhd3IqiKMc3HhVoSJLOoWKEzrC3X4k8j27QgxAFu l9Tc1aiSFc9yO3rxLjHl4oFHPhzuY7acsh6SgiZi+it1FwvEd6ksXF9ML8NS0xdXXejs lB4LHAnLjyTBob8mkR05GYwKvMqPwP2wRxvKbZQJLQjQXyPMBklEauf7vOE5lS/rECGE YXxJ9mBn7H9EZZvv/5DX+EfNiwDMnpRApe3r5+zAxNnyz3iipBT+/I9iBlxJ5z6vez22 68JQ== 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=9beIuYqBF6SILMxXaavWO/q8AQSlMA1a2HjBO8p38og=; b=E8paFmJ2sCai8BVh1ZpHmhxB/YbrECMH1uvnc63+/RYSSRSPPkcLHExChEZR/6M6Xr naevgLRwU0K/CJlO6gwzZAmu8wG5q531KjY/LRu1d5Ze/39HUzZt6kdFOUNV/OMvk3J1 BgbOMFfoGqnBhkvn3vE6HgkW5GkmMtHLsQRXNgUvtFriuWJEk/Cdn21ZYGzr+fFas4c4 AknD4XAWwHc2i5CNL0tJE6cYBvTB7wpQWYPfymehJ3nrbIwJulxTSkNmiWwb4v1SVdO7 yok0HmWuIgxYUQDrJmoT3GWjI6nCnFhGnhGDQ7RJWuPtk4a9h/edjLx7mvnAG45ddnwm Gzfw== X-Gm-Message-State: APjAAAVvBYVRTQc0UgxYUQuxBysJGgmfzVG50evSDDY4BRtgFUcp+4gB z7JeJYczmdIyBeO5Gq0BvPZoWnEw X-Google-Smtp-Source: APXvYqz0bqwjhWJfMUBVTSpq/0QGtNPgOBbelODk1fB1QPQAlQFtiF8DbRCfFyKiEO4dMKeFiqEWxA== X-Received: by 2002:a63:31ce:: with SMTP id x197mr65850514pgx.69.1555289252010; Sun, 14 Apr 2019 17:47:32 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:31 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 04/11] PCI: imx6: Remove PCIE_PL_PFLR_* constants Date: Sun, 14 Apr 2019 17:46:25 -0700 Message-Id: <20190415004632.5907-5-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- 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 021ef121a058..c0867df090f5 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -103,9 +103,6 @@ struct imx6_pcie { /* PCIe Port Logic registers (memory-mapped) */ #define PL_OFFSET 0x700 -#define PCIE_PL_PFLR (PL_OFFSET + 0x08) -#define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16) -#define PCIE_PL_PFLR_FORCE_LINK (1 << 15) #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) From patchwork Mon Apr 15 00:46:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10900045 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 CBD901390 for ; Mon, 15 Apr 2019 00:48:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B528B2012F for ; Mon, 15 Apr 2019 00:48:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9D742861C; Mon, 15 Apr 2019 00:48:13 +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 40CEC2012F for ; Mon, 15 Apr 2019 00:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727255AbfDOAsL (ORCPT ); Sun, 14 Apr 2019 20:48:11 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38742 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbfDOAre (ORCPT ); Sun, 14 Apr 2019 20:47:34 -0400 Received: by mail-pl1-f194.google.com with SMTP id f36so7703674plb.5; Sun, 14 Apr 2019 17:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GRRKksWBg4EhCsv5T20grqrVt88itkyQ3pyd2L45WlA=; b=BB5u/9weWQOpCIDmc+Rw8r0jraD5H0DePbSQL1+PuinWAzQ6ns/swpK4cNQNSt9rAc ly3SjLmi55bH9JqJNpy0t3S9dSbz6gByBjHKtK714ZF7PD/wTpCbvBMEXx4U7XQcWqg5 A16g+jD6kJqtTe5/KXN7rDybZrfH0XT4gYUXMr3hwjjp9c5Bq2GZYIjWBDxDbUsDVEWP IMWbCdMLMqhHnJjRmqu5eb9UGPbyftzWKdiUdBj6Nff2YAMJsF+/CR2OUtdWFnXC7929 p1pC851MYYo0y2OJS5IyDLlDjEbaSTm1d8ZQT+Z+L9/V9JHg06x3qlCpirYIFw0vRLnH l8HA== 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=GRRKksWBg4EhCsv5T20grqrVt88itkyQ3pyd2L45WlA=; b=WhzTuJgYl3NzTgdmuVPCzIfaJZ8rSYLaL7b20la4X9t5bBmS2p/qiQiirZMnk0INT8 M5IojC4NAdjEhKadIWXPL89ENN2XV+PbivWJ6kOoxZC8Us6DValiLTJQYnsgkwDOiIHJ CJgR0nKFXfwRji4QcJG/lp0J6AK3ezSUJNt9cyZFG+MIkRKNYBQBV0Y+FExNVBiHiGD0 J4F49fQjuzXG5a5eb0L63SH+A82t63i6OE6Bb07i0TyGHjy+q5ZV+Pm+COllnyojF/Oj YROiLiksBY1wmXZe1VXLkY9WcCj0qS53xvWtmdnwcnWmLG+Cu3Pwj76UV3ZNpW9mdOOm ldQQ== X-Gm-Message-State: APjAAAWj7vMvZ2WI+p51clJstJE5j5xsoCrqPFnpxHz2jo9lyL8LkQbL fhtqBxeyzno420j3RblFrizsx1GV X-Google-Smtp-Source: APXvYqxfJIZVDoFB584oAjLOJnB6U7puhCsYz4KNA0uGaQEYgVIB7Kgdou1tXO3to53X69vB2ydBwA== X-Received: by 2002:a17:902:9a03:: with SMTP id v3mr47617949plp.27.1555289253243; Sun, 14 Apr 2019 17:47:33 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:32 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 05/11] PCI: dwc: imx6: Share PHY debug register definitions Date: Sun, 14 Apr 2019 17:46:26 -0700 Message-Id: <20190415004632.5907-6-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- 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 c0867df090f5..eeacdebd9b50 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -103,8 +103,6 @@ struct imx6_pcie { /* PCIe Port Logic registers (memory-mapped) */ #define PL_OFFSET 0x700 -#define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) -#define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) #define PCIE_PHY_CTRL_DATA_LOC 0 @@ -831,8 +829,8 @@ static int imx6_pcie_establish_link(struct imx6_pcie *imx6_pcie) err_reset_phy: dev_dbg(dev, "PHY DEBUG_R0=0x%08x DEBUG_R1=0x%08x\n", - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R0), - dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1)); + dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), + dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); imx6_pcie_reset_phy(imx6_pcie); return ret; } diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 31f6331ca46f..086e87a40316 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -14,12 +14,6 @@ #include "pcie-designware.h" -/* PCIe Port Logic registers */ -#define PLR_OFFSET 0x700 -#define PCIE_PHY_DEBUG_R1 (PLR_OFFSET + 0x2c) -#define PCIE_PHY_DEBUG_R1_LINK_UP (0x1 << 4) -#define PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING (0x1 << 29) - int dw_pcie_read(void __iomem *addr, int size, u32 *val) { if (!IS_ALIGNED((uintptr_t)addr, size)) { @@ -334,9 +328,9 @@ int dw_pcie_link_up(struct dw_pcie *pci) if (pci->ops->link_up) return pci->ops->link_up(pci); - val = readl(pci->dbi_base + PCIE_PHY_DEBUG_R1); - return ((val & PCIE_PHY_DEBUG_R1_LINK_UP) && - (!(val & PCIE_PHY_DEBUG_R1_LINK_IN_TRAINING))); + val = readl(pci->dbi_base + PCIE_PORT_DEBUG1); + return ((val & PCIE_PORT_DEBUG1_LINK_UP) && + (!(val & PCIE_PORT_DEBUG1_LINK_IN_TRAINING))); } void dw_pcie_setup(struct dw_pcie *pci) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 377f4c0b52da..b33ae13194be 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -41,6 +41,9 @@ #define PCIE_PORT_DEBUG0 0x728 #define PORT_LOGIC_LTSSM_STATE_MASK 0x1f #define PORT_LOGIC_LTSSM_STATE_L0 0x11 +#define PCIE_PORT_DEBUG1 0x72C +#define PCIE_PORT_DEBUG1_LINK_UP BIT(4) +#define PCIE_PORT_DEBUG1_LINK_IN_TRAINING BIT(29) #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C #define PORT_LOGIC_SPEED_CHANGE BIT(17) From patchwork Mon Apr 15 00:46:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10900043 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 663BA1390 for ; Mon, 15 Apr 2019 00:48:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A7A22012F for ; Mon, 15 Apr 2019 00:48:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E8EB2861C; Mon, 15 Apr 2019 00:48:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DECC12012F for ; Mon, 15 Apr 2019 00:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726980AbfDOArg (ORCPT ); Sun, 14 Apr 2019 20:47:36 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34758 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbfDOArg (ORCPT ); Sun, 14 Apr 2019 20:47:36 -0400 Received: by mail-pg1-f195.google.com with SMTP id v12so7738637pgq.1; Sun, 14 Apr 2019 17:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8E2fKSZnUayyuhXz36lAvp2hLXuQRX96+mjdaNJTzGQ=; b=G5xfeGdrcw3arL+TlZ6a++5LDBaK3cSD4NmRGzIyetme2kmjcoie8vW/VU4TGZqTdG vTHiG0OcB1Lk1OUuNyyB9aK3aYipsQGMRkmLIT1IYb2vFkuJ03VqyD5HFO2sTipl5ntb x700F9TRb8G8KiRjvuLjf2O+9cmosn4bL8Z7VoGAm2VJRmnARUgmxQZ4yk+yg42QHVM8 fP/+NesX/4jI7mshJThbYu1ZMqCwuvqRldtYc0bZ128AiVraMTA1oqsN4JkxerG+4gkU onNklqq9KA/TcAZM5T3rH5XF5pjzjbwXanzi0S9OZdgeeQm249FfxhIzDquhrpDJCqmn wY3g== 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=8E2fKSZnUayyuhXz36lAvp2hLXuQRX96+mjdaNJTzGQ=; b=qk4LEHNNPEZUb3qgsnvRHcLonrvECmlRzH0x07CU9evEz6IuZHqTz3u4UkNhGcRwhS TXHy64BAY2dB08CDYtUdd7begfFyysNBXl+GdjLZAcGzBzCrf7Aa2Lrc4dDHWJzdD9E0 v6ep3sgpWo2Zl36jhsaqWS7kS5gEN5d2aokJ3v6JElpkcu9r9V+bMY/IF2ddNL0w3Fre ilTtptZ1ED1noUeJ/FnTTsida6L24prfbjbwK5BjDfvPRBk2kMBk5E+CeWgZ5maA1YmK w5Z5YQScTsUA1I1pQaeLNuAPhfFTt57NwZBX5qKLK/i3aoyIfqBm4nJCrvBH36z/QdGP 3k4A== X-Gm-Message-State: APjAAAVhrl5jGStV3R7dvspdKp3mxbaYMR8EsHhO4q5fRV4vu8hZ+MU+ khlQNrLwt9xo/+VUNzV8FUvLfCZZ X-Google-Smtp-Source: APXvYqyDzAo+3+R5otG7RS48KEnbSWMCudgZ/WtqQvqUYkhKGmYoC1bmhbkzIolnAiCraWtJ7ibwQg== X-Received: by 2002:a62:b61a:: with SMTP id j26mr72645015pff.203.1555289254763; Sun, 14 Apr 2019 17:47:34 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:33 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 06/11] PCI: imx6: Make use of BIT() in constant definitions Date: Sun, 14 Apr 2019 17:46:27 -0700 Message-Id: <20190415004632.5907-7-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- 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 eeacdebd9b50..5650642ab248 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -118,14 +118,14 @@ struct imx6_pcie { /* PHY registers (not memory-mapped) */ #define PCIE_PHY_ATEOVRD 0x10 -#define PCIE_PHY_ATEOVRD_EN (0x1 << 2) +#define PCIE_PHY_ATEOVRD_EN BIT(2) #define PCIE_PHY_ATEOVRD_REF_CLKDIV_SHIFT 0 #define PCIE_PHY_ATEOVRD_REF_CLKDIV_MASK 0x1 #define PCIE_PHY_MPLL_OVRD_IN_LO 0x11 #define PCIE_PHY_MPLL_MULTIPLIER_SHIFT 2 #define PCIE_PHY_MPLL_MULTIPLIER_MASK 0x7f -#define PCIE_PHY_MPLL_MULTIPLIER_OVRD (0x1 << 9) +#define PCIE_PHY_MPLL_MULTIPLIER_OVRD BIT(9) #define PCIE_PHY_RX_ASIC_OUT 0x100D #define PCIE_PHY_RX_ASIC_OUT_VALID (1 << 0) @@ -148,8 +148,8 @@ struct imx6_pcie { #define PCIE_PHY_CMN_REG26_ATT_MODE 0xBC #define PHY_RX_OVRD_IN_LO 0x1005 -#define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5) -#define PHY_RX_OVRD_IN_LO_RX_PLL_EN (1 << 3) +#define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5) +#define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3) static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, int exp_val) { From patchwork Mon Apr 15 00:46:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10900041 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 25C2B922 for ; Mon, 15 Apr 2019 00:48:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EED32012F for ; Mon, 15 Apr 2019 00:48:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02CFA2861C; Mon, 15 Apr 2019 00:48: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 809532012F for ; Mon, 15 Apr 2019 00:48:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727223AbfDOAsE (ORCPT ); Sun, 14 Apr 2019 20:48:04 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:42882 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbfDOArh (ORCPT ); Sun, 14 Apr 2019 20:47:37 -0400 Received: by mail-pf1-f195.google.com with SMTP id w25so7697914pfi.9; Sun, 14 Apr 2019 17:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L13IRovzl2lkh8fZqfgJAwxW5M+ezlBjSKK+Wru2o5g=; b=F5KiY7dSM4gv7vecZ2fbCcZYQOJacjwIm/hRetx1LiejQRgYPqo0o0qchoSXjkOag6 18Za21/VSzaSjnPPjIvOCv4PutqILpVEqbnnzCICTS6LpLX00lpEqigVJdhlKwjaj+qV ToPXwYPsAB+gGIIDVTslAUMXKBnb2UFO/mIbFceTyWMI02PwuvQFVllXNCi4/Qw/k3I9 AjQmywcPqjJp2HWykzKWgysmVl/UQEvwKQCdwUs6VYeKXgfoyoLX6Y9dAFxQ3iud/nIy OOh5xFpThEuKE1yf0f3CqzUurYrL8M3Q9FeKKgVl9dtydz7NFrN4r6deiIVB26LY9YrT hwnw== 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=L13IRovzl2lkh8fZqfgJAwxW5M+ezlBjSKK+Wru2o5g=; b=uiBTVL9wAf6keNrxZYtbaqYdJw/eAF9egV1aECOrXtYEaPzuH8/d19ZAqSR3RUJUUm s/VunSmR0Wm9uhzy7cM7n5w+mPjRzh9wbqkd42k5G78rYh8STxGwWA+3ZureyA4Y3An8 As75atvW2JLvZ1lWsQsqOaz92WeEP7oDcXSbRxBbZG4j14KIYKVoo/laNntBghpT0bcD ibFDXNjGwSCO5eis4PVAG4lcLkfIVJ7/MrZOdSW7BSwOpPj3791Ko/sv/hQA08YFsn+a Cj+8viQlDYEwKHM7R7LYZu5CtqHYOh4WYs6I23royVdOEHmW/YD4cdp+ol+Nz12CLtnd naEA== X-Gm-Message-State: APjAAAUmjYzmGfzCN1f8gx0AB5fl9f1rMs8fyLalHWQ7wmYZI5EtQhFd AF2aTLp6kZDLxSVoY0pyyiFYXxJ1 X-Google-Smtp-Source: APXvYqwFCmOpFcgLARCUUfeJXMChD9y2YF7dFl7cDxIJAiW3WbHssRc/GFIo8x/94nfaUlYfGrNqmg== X-Received: by 2002:aa7:928b:: with SMTP id j11mr52167548pfa.200.1555289256264; Sun, 14 Apr 2019 17:47:36 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:35 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 07/11] PCI: imx6: Simplify bit operations in PHY functions Date: Sun, 14 Apr 2019 17:46:28 -0700 Message-Id: <20190415004632.5907-8-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- 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 5650642ab248..669e01353026 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -105,11 +105,11 @@ struct imx6_pcie { #define PL_OFFSET 0x700 #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) -#define PCIE_PHY_CTRL_DATA_LOC 0 -#define PCIE_PHY_CTRL_CAP_ADR_LOC 16 -#define PCIE_PHY_CTRL_CAP_DAT_LOC 17 -#define PCIE_PHY_CTRL_WR_LOC 18 -#define PCIE_PHY_CTRL_RD_LOC 19 +#define PCIE_PHY_CTRL_DATA(x) FIELD_PREP(GENMASK(15, 0), (x)) +#define PCIE_PHY_CTRL_CAP_ADR BIT(16) +#define PCIE_PHY_CTRL_CAP_DAT BIT(17) +#define PCIE_PHY_CTRL_WR BIT(18) +#define PCIE_PHY_CTRL_RD BIT(19) #define PCIE_PHY_STAT (PL_OFFSET + 0x110) #define PCIE_PHY_STAT_ACK_LOC 16 @@ -178,17 +178,17 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) u32 val; int ret; - val = addr << PCIE_PHY_CTRL_DATA_LOC; + val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - val |= (0x1 << PCIE_PHY_CTRL_CAP_ADR_LOC); + val |= PCIE_PHY_CTRL_CAP_ADR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); ret = pcie_phy_poll_ack(imx6_pcie, 1); if (ret) return ret; - val = addr << PCIE_PHY_CTRL_DATA_LOC; + val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); return pcie_phy_poll_ack(imx6_pcie, 0); @@ -206,7 +206,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) return ret; /* assert Read signal */ - phy_ctl = 0x1 << PCIE_PHY_CTRL_RD_LOC; + phy_ctl = PCIE_PHY_CTRL_RD; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); ret = pcie_phy_poll_ack(imx6_pcie, 1); @@ -234,11 +234,11 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) if (ret) return ret; - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* capture data */ - var |= (0x1 << PCIE_PHY_CTRL_CAP_DAT_LOC); + var |= PCIE_PHY_CTRL_CAP_DAT; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); ret = pcie_phy_poll_ack(imx6_pcie, 1); @@ -246,7 +246,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* deassert cap data */ - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ @@ -255,7 +255,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* assert wr signal */ - var = 0x1 << PCIE_PHY_CTRL_WR_LOC; + var = PCIE_PHY_CTRL_WR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack */ @@ -264,7 +264,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) return ret; /* deassert wr signal */ - var = data << PCIE_PHY_CTRL_DATA_LOC; + var = PCIE_PHY_CTRL_DATA(data); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ From patchwork Mon Apr 15 00:46:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10900037 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 EDC641390 for ; Mon, 15 Apr 2019 00:47:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D63592012F for ; Mon, 15 Apr 2019 00:47:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA38C2861C; Mon, 15 Apr 2019 00:47:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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 9D14D2012F for ; Mon, 15 Apr 2019 00:47:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbfDOArl (ORCPT ); Sun, 14 Apr 2019 20:47:41 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39593 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbfDOArj (ORCPT ); Sun, 14 Apr 2019 20:47:39 -0400 Received: by mail-pl1-f193.google.com with SMTP id a96so7695580pla.6; Sun, 14 Apr 2019 17:47:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FLKtt3LlDBDSGbMrQM4p98Qt+1OhZn2fyX94k9jG/fo=; b=eqTlaS+iTu3DOILGraxqeMTT+Y7opvdJSYWxe3Rb5Eu9Vdrz+X7pBZAnlid4lMBD2/ TqVliGy/QVfufSWRcTllfua2s45RUoK/ELf7l/22gwMPyiiTJgfCOg7cfUzGiDWLE1AU psS8bXHA1gc6moXOKq4GmDLfXx7m+hnQ7hrytYTIg3FhvXCDd6Da5ACWPcZL7ZGXafsQ 2VzVUbXQKZ+6DeEy1rhjcad/1SgPlZB56XzcFSZQLRqkMO/CixRLNAq726Ji77P9j9dt lwIy34yISeAoXiOeUw2xB2kKvjdMYDt7urjQD1jLQHbrY/Lwgf0PAH2GL1AhVQBALA3p PMHQ== 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=FLKtt3LlDBDSGbMrQM4p98Qt+1OhZn2fyX94k9jG/fo=; b=V0RU+b3kL2huuwtXhoqC9KRAwuJhumQDQZfIhzceFbUokpGxpDoS1lvvdyI5NCIeXj UK1d9mbr81EaBffXzEW/xloHMCcpNmr/NyhA6olnZFPPMbWNEpHheSkzsXjioxNsLCYy GMOebsm2omEraQ9F/4gad63XBCo8XlTu0iZWiweYSGQAqCxLcTE1EFWje8x++oASfUiz N1ZfcGDpHSM8L8zV9GhOj7Ayr5vjM32viOgdLsvT47TuRzcr09t8ls6ZZmtL036g43ik SFyFS6HA4fROMJCCmG6LYjGTJtdCIhyovxrR4vQqn23iEB3E4XfbXLMFX10XwF8G+nqP 59GQ== X-Gm-Message-State: APjAAAV8L6n+3Q+gnM1/FbtB0RTx1Z9f48dXYGSsgX7hT3NxXj/PopUI blVDPJ0AYHQT+6VcVs9jKJTaZPW7 X-Google-Smtp-Source: APXvYqwOQVgh2IXAFyjAaSUoUa40KDdm+pAp80DOXteQ5VevKXjpRZEzcpIAREThPLScqFfB2xbnfw== X-Received: by 2002:a17:902:e683:: with SMTP id cn3mr71254696plb.115.1555289257844; Sun, 14 Apr 2019 17:47:37 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:36 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , Lucas Stach , linux-kernel@vger.kernel.org Subject: [PATCH v4 08/11] PCI: imx6: Simplify pcie_phy_poll_ack() Date: Sun, 14 Apr 2019 17:46:29 -0700 Message-Id: <20190415004632.5907-9-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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. Signed-off-by: Andrey Smirnov Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 669e01353026..3fd084357488 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -112,7 +112,7 @@ struct imx6_pcie { #define PCIE_PHY_CTRL_RD BIT(19) #define PCIE_PHY_STAT (PL_OFFSET + 0x110) -#define PCIE_PHY_STAT_ACK_LOC 16 +#define PCIE_PHY_STAT_ACK BIT(16) #define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C @@ -151,16 +151,16 @@ struct imx6_pcie { #define PHY_RX_OVRD_IN_LO_RX_DATA_EN BIT(5) #define PHY_RX_OVRD_IN_LO_RX_PLL_EN BIT(3) -static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, int exp_val) +static int pcie_phy_poll_ack(struct imx6_pcie *imx6_pcie, bool exp_val) { struct dw_pcie *pci = imx6_pcie->pci; - u32 val; + bool val; u32 max_iterations = 10; u32 wait_counter = 0; do { - val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); - val = (val >> PCIE_PHY_STAT_ACK_LOC) & 0x1; + val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT) & + PCIE_PHY_STAT_ACK; wait_counter++; if (val == exp_val) @@ -184,14 +184,14 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) val |= PCIE_PHY_CTRL_CAP_ADR; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - ret = pcie_phy_poll_ack(imx6_pcie, 1); + ret = pcie_phy_poll_ack(imx6_pcie, true); if (ret) return ret; val = PCIE_PHY_CTRL_DATA(addr); dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, val); - return pcie_phy_poll_ack(imx6_pcie, 0); + return pcie_phy_poll_ack(imx6_pcie, false); } /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ @@ -209,7 +209,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) phy_ctl = PCIE_PHY_CTRL_RD; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, phy_ctl); - ret = pcie_phy_poll_ack(imx6_pcie, 1); + ret = pcie_phy_poll_ack(imx6_pcie, true); if (ret) return ret; @@ -219,7 +219,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) /* deassert Read signal */ dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00); - return pcie_phy_poll_ack(imx6_pcie, 0); + return pcie_phy_poll_ack(imx6_pcie, false); } static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) @@ -241,7 +241,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) var |= PCIE_PHY_CTRL_CAP_DAT; dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); - ret = pcie_phy_poll_ack(imx6_pcie, 1); + ret = pcie_phy_poll_ack(imx6_pcie, true); if (ret) return ret; @@ -250,7 +250,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ - ret = pcie_phy_poll_ack(imx6_pcie, 0); + ret = pcie_phy_poll_ack(imx6_pcie, false); if (ret) return ret; @@ -259,7 +259,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack */ - ret = pcie_phy_poll_ack(imx6_pcie, 1); + ret = pcie_phy_poll_ack(imx6_pcie, true); if (ret) return ret; @@ -268,7 +268,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, var); /* wait for ack de-assertion */ - ret = pcie_phy_poll_ack(imx6_pcie, 0); + ret = pcie_phy_poll_ack(imx6_pcie, false); if (ret) return ret; From patchwork Mon Apr 15 00:46:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10900033 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 5542B922 for ; Mon, 15 Apr 2019 00:47:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D5272012F for ; Mon, 15 Apr 2019 00:47:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 319672861C; Mon, 15 Apr 2019 00:47: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 C2F0C2012F for ; Mon, 15 Apr 2019 00:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726147AbfDOArm (ORCPT ); Sun, 14 Apr 2019 20:47:42 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45462 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfDOArk (ORCPT ); Sun, 14 Apr 2019 20:47:40 -0400 Received: by mail-pl1-f195.google.com with SMTP id bf11so7676128plb.12; Sun, 14 Apr 2019 17:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5efM5EhjjdhBc/uhVsC3qJkDClRcXkF57SZv54KM6uw=; b=vT4TzE4MdQ5povk2xRlVpiKcthkKK8NtYQt5xE00W+j7zFxTHJnnt44ScNwmJ2x49C fENHkrMpwrVtupwiCzhlGJbY7PlsziVx+WkfgTjrExYTChn5/lyic+Ppz0mqM1JgtJF7 MuHgVeseu/cGDZCRYKzMs3GqU8S0WF0H4U043d9NWo7ZYlfFOS1TBJe0Adh4QCdKPpcX Mo4g6t3j/l0T4NhOxFIWdy71arNGQ3aWGOky8KywdzlbmMJYKFvHQpEs7sHaxH5r+jgK xhVxCA7PAULngefyHYvZvaycNVQ51BMXpYbkseLdd70dP5K8ignNYQrC8aMzGk5hoYKo ry1w== 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=5efM5EhjjdhBc/uhVsC3qJkDClRcXkF57SZv54KM6uw=; b=QwdfrqKm++cdd6/ujvgLY+XMCXlhK4RDdCKNlVU+0XpgTCQI/EJSoSa4vor+48WHQs FmjKFFNMX18gVPbriCYS0ybuXYvGzLSqomYrgEcyWL1R1MfR/VOs/z5j00/IwyHkaNvy jLvMfVo5ciEpKWveb2XweXmkbPXD8iunDpkkeUzsRI5aL3PJql6GxjREH8KDGXSXCRCL Gs9kGa6n4YrBZnv7OE3cBlVcvpNCJc9hD9LhN9xKn+U3A+E6+UfCs8j3nXmx59huFOj8 9ZmAdZiFwZFbzmFI0WMAqoLmV0NuEKqd9b3aIFIGCd1UsOQ502aQNOnMlTMb1ShHaIT/ W5Dg== X-Gm-Message-State: APjAAAU3M4ebIBo5KEkGFoX8/vIymejAM9/EdNbn6nr9DcE4ebqXLKNk sA8tQQ/w9MtN4RGnKkARyDk3/vre X-Google-Smtp-Source: APXvYqx1CfuQQh2h1tN/SfdIAKdJTnxG14U4dUQbOGhbaKkAbRKJWNShouYLs4PG44fh+AHwPeFjTA== X-Received: by 2002:a17:902:a5ca:: with SMTP id t10mr69668931plq.234.1555289259247; Sun, 14 Apr 2019 17:47:39 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:38 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 09/11] PCI: imx6: Restrict PHY register data to 16-bit Date: Sun, 14 Apr 2019 17:46:30 -0700 Message-Id: <20190415004632.5907-10-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- 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 3fd084357488..30e764b6cbcc 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -195,10 +195,10 @@ static int pcie_phy_wait_ack(struct imx6_pcie *imx6_pcie, int addr) } /* Read from the 16-bit PCIe PHY control registers (not memory-mapped) */ -static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) +static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, u16 *data) { struct dw_pcie *pci = imx6_pcie->pci; - u32 val, phy_ctl; + u32 phy_ctl; int ret; ret = pcie_phy_wait_ack(imx6_pcie, addr); @@ -213,8 +213,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) if (ret) return ret; - val = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); - *data = val & 0xffff; + *data = dw_pcie_readl_dbi(pci, PCIE_PHY_STAT); /* deassert Read signal */ dw_pcie_writel_dbi(pci, PCIE_PHY_CTRL, 0x00); @@ -222,7 +221,7 @@ static int pcie_phy_read(struct imx6_pcie *imx6_pcie, int addr, int *data) return pcie_phy_poll_ack(imx6_pcie, false); } -static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) +static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, u16 data) { struct dw_pcie *pci = imx6_pcie->pci; u32 var; @@ -279,7 +278,7 @@ static int pcie_phy_write(struct imx6_pcie *imx6_pcie, int addr, int data) static void imx6_pcie_reset_phy(struct imx6_pcie *imx6_pcie) { - u32 tmp; + u16 tmp; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return; @@ -675,7 +674,7 @@ static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) { unsigned long phy_rate = clk_get_rate(imx6_pcie->pcie_phy); int mult, div; - u32 val; + u16 val; if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) return 0; From patchwork Mon Apr 15 00:46:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10900035 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 59A271390 for ; Mon, 15 Apr 2019 00:47:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EEC12012F for ; Mon, 15 Apr 2019 00:47:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F36D2861C; Mon, 15 Apr 2019 00:47: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 C22A02012F for ; Mon, 15 Apr 2019 00:47:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727087AbfDOArn (ORCPT ); Sun, 14 Apr 2019 20:47:43 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45595 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727055AbfDOArl (ORCPT ); Sun, 14 Apr 2019 20:47:41 -0400 Received: by mail-pg1-f196.google.com with SMTP id y3so7704218pgk.12; Sun, 14 Apr 2019 17:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dxSuTYLON4k2Acu5zoiaFP6YKp7Q+JzqRTJrEqqzkK8=; b=DV7U3jVgs5Pb9ApK85mkLkstDpuk2sd2BMLX/4gbOh5xshFzFH1QwI5OscPSVAdDIA +cgmK+y0x5f8Hy/HsCK2gQgiRZr81FnwyxeQyUnP3Y2dw1CaRM3h69dBisVGb4kDKEX9 uC60FVOQJIlPLKCl7N7QCPKgrKg27tAdNZtaY0vLsmg4cWkwXocrvexEdQINy8KHOGQw 7yxVgwqL9akaugiSIwbWOtQ1qWyrN7qX0KrpyGCF0o9yljYYUAJC9ze0qrTf1r1NGRuy Fwm710aRlLJr4+96VeEncc5PXUW+bITng4HpWbG8ykQj+3Cpt0njkpHbe9wOtflFt0Km crww== 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=dxSuTYLON4k2Acu5zoiaFP6YKp7Q+JzqRTJrEqqzkK8=; b=gtzV123hAi9uZgUw8Wavk7NGLDHnGa3Xa4nfInZ/I//koRN/FqlJSCynwEecfdF3Pq UZECIrxqQHjq3Um75hnL4gUTnz1ZgD8dd41zg1mxUgbbn+XymHXwL+Gc6toz6dbYaVRt 8S+POSUXQRTAC9lA7lTjO4Zgw+JuIcFwJsfj9wBDklPwkkMeCZ3inSC59/91AMVHlpo1 aiEOwvpu+KAqeW9dwH4nWLvynAlUkF3/uvf+49s+5xb6931Gjanl//zH7r/C7ssNNN1F EsTaGu+/gRImWkZzUCgYtLnqUALxxrm6muwNCApWEYsv00G27Kf9xg0t1JYkFDZ7C5aE 3PkQ== X-Gm-Message-State: APjAAAXS3KZxX9Im1YDmOC+VCJ9IjcnrNS+brQk7AlzZbZsmGOBv91PK hzL8eGR3b4ktwWk/M86BCtjGnORU X-Google-Smtp-Source: APXvYqyM68Fi5qwDdQa8Pie5oUjJ3L+HG8WftuWSEtyoz46DzbGVfsG2irR1v4jjKcpHyYVW6H7wlA== X-Received: by 2002:a62:2687:: with SMTP id m129mr70980078pfm.204.1555289260421; Sun, 14 Apr 2019 17:47:40 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:39 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lucas Stach , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , linux-kernel@vger.kernel.org Subject: [PATCH v4 10/11] PCI: imx6: Use flags to indicate support for suspend Date: Sun, 14 Apr 2019 17:46:31 -0700 Message-Id: <20190415004632.5907-11-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that driver data has flags variable that can be used to indicate quirks/features supported we can switch the code to use it instead of having a special function that does so based on variant alone. No functional change intended. Signed-off-by: Andrey Smirnov Reviewed-by: Lucas Stach Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org --- drivers/pci/controller/dwc/pci-imx6.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 30e764b6cbcc..3e45f49b8a4f 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -52,6 +52,7 @@ enum imx6_pcie_variants { #define IMX6_PCIE_FLAG_IMX6_PHY BIT(0) #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) +#define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) struct imx6_pcie_drvdata { enum imx6_pcie_variants variant; @@ -965,17 +966,11 @@ static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) } } -static inline bool imx6_pcie_supports_suspend(struct imx6_pcie *imx6_pcie) -{ - return (imx6_pcie->drvdata->variant == IMX7D || - imx6_pcie->drvdata->variant == IMX6SX); -} - static int imx6_pcie_suspend_noirq(struct device *dev) { struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); - if (!imx6_pcie_supports_suspend(imx6_pcie)) + if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; imx6_pcie_pm_turnoff(imx6_pcie); @@ -991,7 +986,7 @@ static int imx6_pcie_resume_noirq(struct device *dev) struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); struct pcie_port *pp = &imx6_pcie->pci->pp; - if (!imx6_pcie_supports_suspend(imx6_pcie)) + if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_SUSPEND)) return 0; imx6_pcie_assert_core_reset(imx6_pcie); @@ -1221,7 +1216,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { [IMX6SX] = { .variant = IMX6SX, .flags = IMX6_PCIE_FLAG_IMX6_PHY | - IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, + IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | + IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, }, [IMX6QP] = { .variant = IMX6QP, @@ -1230,6 +1226,7 @@ static const struct imx6_pcie_drvdata drvdata[] = { }, [IMX7D] = { .variant = IMX7D, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, }, [IMX8MQ] = { .variant = IMX8MQ, From patchwork Mon Apr 15 00:46:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10900039 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 431D5922 for ; Mon, 15 Apr 2019 00:48:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B3632012F for ; Mon, 15 Apr 2019 00:48:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F5902861C; Mon, 15 Apr 2019 00:48: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 C53182012F for ; Mon, 15 Apr 2019 00:48:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725997AbfDOAr6 (ORCPT ); Sun, 14 Apr 2019 20:47:58 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44232 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbfDOArm (ORCPT ); Sun, 14 Apr 2019 20:47:42 -0400 Received: by mail-pl1-f193.google.com with SMTP id g12so7677660pll.11; Sun, 14 Apr 2019 17:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3VaYvWVwzOkdBmgVwNCUSm0J2jSP5fZYz6kavihb0vk=; b=KZWcBo51AOew8nyqaGo3kd7C++QD9lIb/qtq2eBsUf2OxzI/HIRTAxSd5PuLV/2T4g KvqA7KLH9VpIWqLe4L+zQpYzReb4UUTXvGatEzbDJwTHeHB7jcjppZpT5Be8uO1KfLCo UprxIIZf//kePk7Zz7oHDmNZxJhqfeebTTi5AV32XhKSbosue9+csmaDTmU4IErNhhMs kchMvx3aa+z+6dFeWYXDcJNrhcK2xCogY1W3+UMzBNmQM2/yaAwUsEODpvpJqB3JIjNr zdsHsd9RRJE8I7znrw5HannwTPEls8gqxfwjxGperLfJ+cuHs4/xwgoMkuzZmkGVbhRW dFmQ== 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=3VaYvWVwzOkdBmgVwNCUSm0J2jSP5fZYz6kavihb0vk=; b=So3IB1UADYpZuky1osRB0HyifJa8Rnth1oWvO2Sth2i8j2oyIyNoda/mhfwTqbiGKQ 7aQW5BCVq4bV508WZbfOFd/sJuo8ilPaNJpel3B6Nlxy9EqfCTfArI/IueUEiIhxhtSD fZItC7FUiGfa2TuQb+woW31FtzPmGss8+GBJMQqU9Lbq2e+R8CGKm1ZlPwri+RL0pbF1 87MQJo1skGJQOK0d1s+s24Vf/q6VMsKwMx3RYHmgqcwIDhbvXNO+TaJUrpztzGSZatCB mQfjvrdsFhzWMPYyuJMeGTheLIym1QwhbDajUavNCUcFsM52yYmUAqvIbgYhFCugMy9a /89g== X-Gm-Message-State: APjAAAWimSIaylUQ97MRFOohFJZucf2N4TCxNennIQX64BMXiVc9w0EZ xmb5O0clZ0mSEdyZbidxjQyE6w9J X-Google-Smtp-Source: APXvYqz2zECm3zq6MDJMmsxC6n9r+1USMjhRz7oMfT9xqxy4W8H/wJJwDZgoFSCbeDn0YQsblUmoGw== X-Received: by 2002:a17:902:aa85:: with SMTP id d5mr72889689plr.251.1555289261729; Sun, 14 Apr 2019 17:47:41 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id u17sm66111981pfn.19.2019.04.14.17.47.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 14 Apr 2019 17:47:40 -0700 (PDT) From: Andrey Smirnov To: linux-pci@vger.kernel.org Cc: Andrey Smirnov , Lorenzo Pieralisi , Bjorn Helgaas , Chris Healy , Lucas Stach , linux-kernel@vger.kernel.org Subject: [PATCH v4 11/11] PCI: imx6: Use usleep_range() in imx6_pcie_enable_ref_clk() Date: Sun, 14 Apr 2019 17:46:32 -0700 Message-Id: <20190415004632.5907-12-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190415004632.5907-1-andrew.smirnov@gmail.com> References: <20190415004632.5907-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 imx6_pcie_enable_ref_clk() is never called in atomic context, so there's no need to use udelay(). Replace it with usleep_range(). Signed-off-by: Andrey Smirnov Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Cc: Chris Healy Cc: Lucas Stach Cc: linux-kernel@vger.kernel.org Cc: linux-pci@vger.kernel.org Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 3e45f49b8a4f..c6d6bde4d860 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -449,7 +449,7 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) * reset time is too short, cannot meet the requirement. * add one ~10us delay here. */ - udelay(10); + usleep_range(10, 100); regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); break;