From patchwork Thu May 24 07:23:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10422955 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 2544C602D8 for ; Thu, 24 May 2018 07:23:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1079129014 for ; Thu, 24 May 2018 07:23:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0540329010; Thu, 24 May 2018 07:23: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=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 AED4629010 for ; Thu, 24 May 2018 07:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935643AbeEXHXi (ORCPT ); Thu, 24 May 2018 03:23:38 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:35662 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935605AbeEXHXh (ORCPT ); Thu, 24 May 2018 03:23:37 -0400 Received: by mail-wr0-f196.google.com with SMTP id i14-v6so1130495wre.2; Thu, 24 May 2018 00:23: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; bh=zuNeicoflWk0j4S2kF/eI7Kjk1dDDKbWxZYtHokpiTA=; b=j1BmcNydIt3/SJmMb1d50FjZyZ2WLGq1YJUkST7C0RWfEzU9TzL5lvtUOBA0W48fu4 9wWok/ZkeAVuXOcpzrGMbIF55fB/m37lFvhio0WL65K+bju7yUo5X2cTaYAZL/FabXz9 +4d2v9i5ETrFpBmZvvoxggjwAiNbpr4iIpwFHk7SFR0tOWupJf0COWFcnFBPLi5CqlLc y4sR5FfXahTAoWVYYKQOE4d27K2fdLtAMFxhFhNeJeUYXj8YfDvimFU/lHZSetrNCfJc 9Kq7t9Ozf+qfNhobnbC6W/MOYZBZjfwZb7pOTGcFE9HcOiYpQSs6zScFD65eqO8ijVSk 3ukA== 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=zuNeicoflWk0j4S2kF/eI7Kjk1dDDKbWxZYtHokpiTA=; b=JWpDbAwMvjP0YraKX9lqafQvFc2bleD+R2KmNQDLx1WaJTC2FjKLz6lmW/ROjL8+hB k+EuUq0pb4jKB+lIErMcmJolZOx3tSy4YZ6+2Gqwn1ou/j9mYR5ius3T16TB2mT9HbOH ctUL8R4Srk0RvXzOSC8PruF7km+Op53YzKmrWXxGo+tUAt5gB70rBc0+1nQR3ZfXs20e gBZiyZQy4zx74zPKgTO1YpNSbiYnUSzvLdpaKVWnC8rEdnB9h9MPCPQit+/YRynnMxoc +tXLTVMj46NbPKFm0XDE5tCWNFgp5taQgjoMnFQYOAIEt7kZ++vz2yS+sofjkRL8rCwS TtXA== X-Gm-Message-State: ALKqPwd8j2oGfqQ0Ch1uKzt7g7nppCe2gOShRDxUKfAaEFvHbhdlcHSC YhHgf5s96QCICL0cuuRNMMIg677u X-Google-Smtp-Source: AB8JxZqoYxnnUyQ2wYFUXWTPlow0Zdm+V/Ca6mMdk+IeMGSg8q5fkGnwxVKKfYinW9kAneMq3wUfpw== X-Received: by 2002:adf:c3c2:: with SMTP id d2-v6mr349017wrg.68.1527146615880; Thu, 24 May 2018 00:23:35 -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 j13-v6sm10997919wre.38.2018.05.24.00.23.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 00:23:34 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH 4/6] PCI: rcar: Poll more often in rcar_pcie_wait_for_dl() Date: Thu, 24 May 2018 09:23:21 +0200 Message-Id: <20180524072323.22115-4-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180524072323.22115-1-marek.vasut+renesas@gmail.com> References: <20180524072323.22115-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: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org --- V2: s/content/context in commit message V3: Add cpu_relax() --- 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;