From patchwork Thu May 24 14:36:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10424911 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.web.codeaurora.org (Postfix) with ESMTP id 6479E60327 for ; Thu, 24 May 2018 14:36:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F0592951B for ; Thu, 24 May 2018 14:36:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63F7C29634; Thu, 24 May 2018 14:36: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 B3C7929620 for ; Thu, 24 May 2018 14:36:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965695AbeEXOgl (ORCPT ); Thu, 24 May 2018 10:36:41 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:37332 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033380AbeEXOgh (ORCPT ); Thu, 24 May 2018 10:36:37 -0400 Received: by mail-wr0-f195.google.com with SMTP id i12-v6so3580071wrc.4; Thu, 24 May 2018 07:36:37 -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; bh=3yb5Kj6X3v3zRqVJsSIUDem1QP9z+BCyImgl9SH+bak=; b=aoXoNonREHcPrehsq3LQjHEAK8fSE/foDWJnSeuAvqWi30eG/F/GV/0zI3RgzDH4FK eB+BrQLEmin6xSicJ+5MbERY+Vq8HjQjjK2Y3rFG9ED25nrO1lSnww81U+z3iJGEl7ml OCbQpYau5zoCTFuQwmR9snFfpKjitUGUeiV5QlUE/Z7EKletolGDmRLCYCfjroJWhB33 59rIgc495VE3NqTKfZIuEw15i6kGsNyZZPB9EB32BSMujmVLEc2JbOlTHRjoEtQXs8/M bFjbuutCLrDYdZL97FEaDdnsbt9tayaJvmDyQBJEwJEC469dST5zQg2KiC7kvojqDhGr qcRQ== 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; bh=3yb5Kj6X3v3zRqVJsSIUDem1QP9z+BCyImgl9SH+bak=; b=X9cSxqnDa6OXNhj3zvC8DiYA4cPfJPjG1RiHQGlal34ZF186swDYJ0vLiVfhBFrUBT JmXMTHomUfcygBqIUXIcA6Z+wRCdxhUV+Gyq7M69Iy4iE96V86CY3hNdxgtXh47E65+o CAhcSPcM6CjtB5yY6pLFqBxA38eILd3euIRSuQvfQgJZ8OKYTxt9xv8o0tN6e/vZlBL+ aEUvRvPACEqkFfrUB/sLRji44Csi/WXgTN+gk5IUfaBj0QfSywcEvkOCyCNGSrG68Rj5 vpjlwWBizLcX2HGS1XnqRQNE8+63gjBxSt6w+Uc4INedsrvCWxrncAGOmY9K6A68GzpF nlmw== X-Gm-Message-State: ALKqPwekA4dUepoHn3ROURX6Ipn14Hjy4eIZReaOd8k3NOwCpnRPMiST 4RRrY238e0owtQ7gBzBd4Bl3rHpv X-Google-Smtp-Source: AB8JxZoQF+i01O23ZZlyWkV8zUyMqd9yckzPlishOvp6SlGO5HNOWBdTzqY3QthmfGJ8CpDFBwi+3Q== X-Received: by 2002:adf:9246:: with SMTP id 64-v6mr7491483wrj.90.1527172596174; Thu, 24 May 2018 07:36:36 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id x17-v6sm14348276wmd.46.2018.05.24.07.36.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 07:36:35 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Lorenzo Pieralisi , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH v4 4/6] PCI: rcar: Poll more often in rcar_pcie_wait_for_dl() Date: Thu, 24 May 2018 16:36:22 +0200 Message-Id: <20180524143624.26718-5-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180524143624.26718-1-marek.vasut+renesas@gmail.com> References: <20180524143624.26718-1-marek.vasut+renesas@gmail.com> 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 The data link active signal usually takes ~20 uSec to be asserted, poll the bit more often to avoid useless delays in this function. Use udelay() instead of usleep() for such a small delay as suggested by the timer documentation and because this will be used in atomic context later on when the suspend/resume patches land. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Lorenzo Pieralisi Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org Acked-by: Simon Horman --- V2: s/content/context in commit message V3: Add cpu_relax() V4: Rebase on top of Lorenzo's pci/rcar, fix up the rebase breakage induced by patches therein --- drivers/pci/host/pcie-rcar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index d6a7e8482dcf..4843a4dc6059 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -546,13 +546,14 @@ static int rcar_pcie_wait_for_phyrdy(struct rcar_pcie *pcie) static int rcar_pcie_wait_for_dl(struct rcar_pcie *pcie) { - unsigned int timeout = 10; + unsigned int timeout = 10000; while (timeout--) { if ((rcar_pci_read_reg(pcie, PCIETSTR) & DATA_LINK_ACTIVE)) return 0; - msleep(5); + udelay(5); + cpu_relax(); } return -ETIMEDOUT;