From patchwork Tue May 22 12:24:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10418555 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 2C0226032A for ; Tue, 22 May 2018 12:24:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B21B28B38 for ; Tue, 22 May 2018 12:24:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F9F628BAF; Tue, 22 May 2018 12:24:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 640B7289ED for ; Tue, 22 May 2018 12:24:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751559AbeEVMY0 (ORCPT ); Tue, 22 May 2018 08:24:26 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35360 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751548AbeEVMYY (ORCPT ); Tue, 22 May 2018 08:24:24 -0400 Received: by mail-wr0-f194.google.com with SMTP id i14-v6so19833399wre.2; Tue, 22 May 2018 05:24:23 -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; bh=CmE9ohHUpZb6VsllsUksDQU+8nmTnA0oVRc5CY8ZQAo=; b=vS/9Xkb6jD2Fvz0vlAojLeAGhgx6DwypHh5Bx6zE7zBPzODPrR1/Llvgn7xLO8m7zB 6BPPwMRn4xA9A/VGYVK+xcTBP34/X4eSXLva5wOq3ZxyEx0T05QigdIFR9fTcbTJhpfc r8p1kJhmih3hKVip5KkpAvLDAoOjvsPMRiVYBlJUluSCPYEde5vyQHQgRroFcIUi7SL5 afaIGy9DL/Fk793LsV61yRi5yMDzKgqAAn2i0V9VX1dztwnvVk4LoYwPbaKDZxcFfrAS UQNrLyVNlfXxOasWikMCxKyz6WByQlOTKyN03oz4UWPrzaK08Idz7ahbJ5hLoW2rkLlh sM9w== 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; bh=CmE9ohHUpZb6VsllsUksDQU+8nmTnA0oVRc5CY8ZQAo=; b=JAnR3noQJNxDVFQL5CTV447UGVC7fGy3LAAaTgY2xEuMLXiETn7u4UJdOrEaljYl+f p4xN7We/4VXxFluq7P5AKGpofwOU+OLAkYVW01FUMcuu/RWAipbRuSNLNntR/+3NJyBu jRrNwzZ/nPSIZDRV6MMx/wBRnzUX3pXFtmDo+ISmgELlLd2EF4jGChgFF7CchtIYy7jr ZzaDpaH5Zgyq77c0utraEdyBthRy6MenN5ApxBO88eOWsD8nuMTYsf7teU32SYvYMpWI xQ7WAn6sgh2xNVuR3o56zQWLd1Emgd+zZEhqZI0WK7XpWWXnhKZ1LQrQfQqboWvHtOX+ XKFQ== X-Gm-Message-State: ALKqPwc4d0Ka60FTtTz4BuX0nxm81ea6Z3sEulUIInQAiagqT6RTC6RO K97mWiw+Q0zXDdmlusf2pZpBC71Z X-Google-Smtp-Source: AB8JxZrPYTcflVvpVsP3Ihy8D7v5yeXPv2iXp1p+kecWUUxzandOllckL4VSW9IZyqT+mm3+wTezpg== X-Received: by 2002:adf:a9aa:: with SMTP id b39-v6mr19236118wrd.36.1526991862705; Tue, 22 May 2018 05:24:22 -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 141-v6sm25810344wmf.35.2018.05.22.05.24.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 05:24:21 -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 V3] PCI: rcar: Poll more often in rcar_pcie_wait_for_dl() Date: Tue, 22 May 2018 14:24:20 +0200 Message-Id: <20180522122420.24002-1-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 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 Reviewed-by: Simon Horman --- 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 5c365f743df5..3aa6fe5f2d64 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -529,13 +529,14 @@ static void phy_write_reg(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;