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: 918280 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vS/9Xkb6"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40qvwF1pPfz9s4q for ; Tue, 22 May 2018 22:24:29 +1000 (AEST) 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 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;