From patchwork Thu May 21 18:35:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 6458251 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A232C9F318 for ; Thu, 21 May 2015 18:38:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DE0A720525 for ; Thu, 21 May 2015 18:38:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 20CE12051D for ; Thu, 21 May 2015 18:38:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YvVKM-0006aB-5b; Thu, 21 May 2015 18:36:18 +0000 Received: from mail-pd0-f174.google.com ([209.85.192.174]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YvVKH-0006TH-Pi for linux-arm-kernel@lists.infradead.org; Thu, 21 May 2015 18:36:14 +0000 Received: by pdfh10 with SMTP id h10so116809793pdf.3 for ; Thu, 21 May 2015 11:35:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Yp+wzNszWTFLKzQ3kLWoaFa122WteKzaNR0dgqtEuMM=; b=m8nFKHoSAyEgYsYZ1Hg/fpvtQ+OJTWLf704tEMO1gSHWfjrRa1VFJcSCzBBSuN8toi L7nmNKL/v02lb/0KX5m+yd1k0ZpSUs0LzWXXYAB2oYvnVBdmwPK+fA0PwVpV3EuOFUdI ml2XKtAOk1JfNoM5+bEXh7nplL9/ctNQ+p7iiMtUOzQf2HVKbdd3mixHYIwcxOLNYTZT p7MdcoVgKLF3W2L3Ru3QW1i/6gIblpqO4XSNU9go30UaV6zewVsWdaQG3AcSsDUWZZYS OIkb0mkyABGT1ubyDzrAbJDWsz/XxuExyRxNV+skN0KC/AuAbrjgdiG1sME1ND2HgB8D BwgQ== X-Gm-Message-State: ALoCoQmGlQCo6Jz/gBRnkMjBv2Vrt6bocKplYM5imoehwlbrIqR8FvRAG4CRwomTj7pvaym1dGoM X-Received: by 10.66.121.227 with SMTP id ln3mr8264316pab.68.1432233351834; Thu, 21 May 2015 11:35:51 -0700 (PDT) Received: from localhost.localdomain (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by mx.google.com with ESMTPSA id gj5sm19906459pbb.22.2015.05.21.11.35.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 May 2015 11:35:51 -0700 (PDT) From: Troy Kisky To: festevam@gmail.com Subject: [RFC PATCH 1/1] pci-imx6: add speed change timeout message Date: Thu, 21 May 2015 11:35:45 -0700 Message-Id: <1432233345-10160-1-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150521_113613_903710_2164C115 X-CRM114-Status: GOOD ( 13.25 ) X-Spam-Score: -1.8 (-) Cc: marex@denx.de, r65037@freescale.com, Troy Kisky , linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, the timeout is never detected as count has a value of -1 if a timeout happens, but the code is checking for 0. Signed-off-by: Troy Kisky --- This patch breaks pcie for imx6sx as my board always times out. So, if someone could check this on an imx6sx I'd appreciate it. Signed-off-by: Troy Kisky --- drivers/pci/host/pci-imx6.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index fdb9536..51be92c 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -398,20 +398,22 @@ static int imx6_pcie_start_link(struct pcie_port *pp) writel(tmp, pp->dbi_base + PCIE_LINK_WIDTH_SPEED_CONTROL); count = 200; - while (count--) { + while (1) { tmp = readl(pp->dbi_base + PCIE_LINK_WIDTH_SPEED_CONTROL); /* Test if the speed change finished. */ - if (!(tmp & PORT_LOGIC_SPEED_CHANGE)) + if (!(tmp & PORT_LOGIC_SPEED_CHANGE)) { + /* Make sure link training is finished as well! */ + ret = imx6_pcie_wait_for_link(pp); + break; + } + if (count-- == 0) { + dev_err(pp->dev, "Speed change timeout\n"); + ret = -EINVAL; break; + } usleep_range(100, 1000); } - /* Make sure link training is finished as well! */ - if (count) - ret = imx6_pcie_wait_for_link(pp); - else - ret = -EINVAL; - if (ret) { dev_err(pp->dev, "Failed to bring link up!\n"); } else {