From patchwork Tue Mar 25 22:24:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 3890811 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E52669F334 for ; Tue, 25 Mar 2014 22:24:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 166EC201EC for ; Tue, 25 Mar 2014 22:24:45 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 125F1201C8 for ; Tue, 25 Mar 2014 22:24:44 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSZls-00026I-IF; Tue, 25 Mar 2014 22:24:36 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSZlq-0004G6-4u; Tue, 25 Mar 2014 22:24:34 +0000 Received: from quartz.orcorp.ca ([184.70.90.242]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WSZln-0004EO-4c for linux-arm-kernel@lists.infradead.org; Tue, 25 Mar 2014 22:24:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=6PIwbUiAzxG+FB4KkEofkVyGuPasiSjAJHfG3Z8pCJI=; b=Lq54cIsuu4H6i/8u03tvUfmQ0h7sv/E75geIS57cfQp78/sNkgKMDkG1pUr9F0/zTFOfKXSOg3tvj/oRUYjr5feFiXNcdjD1eeaSLcvG0aSpMFjKL94JDOru8Ian8X1t02fWatKYkXTDUWHazxU8XmZ4kysvretiFabJYnRjSNU=; Received: from [10.0.0.161] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1WSZlM-000726-Ex; Tue, 25 Mar 2014 16:24:04 -0600 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.80) (envelope-from ) id 1WSZlM-00040n-2R; Tue, 25 Mar 2014 16:24:04 -0600 Date: Tue, 25 Mar 2014 16:24:04 -0600 From: Jason Gunthorpe To: Neil Greatorex Subject: Re: Intel I350 mini-PCIe card (igb) on Mirabox (mvebu / Armada 370) Message-ID: <20140325222404.GC14718@obsidianresearch.com> References: <20140325202249.GA10378@obsidianresearch.com> <20140325213638.5aba54b6@skate> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.161 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140325_182431_294274_6A963E16 X-CRM114-Status: GOOD ( 12.79 ) X-Spam-Score: -2.0 (--) Cc: Thomas Petazzoni , Bjorn Helgaas , Jason Cooper , linux-arm-kernel , Willy Tarreau X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 On Tue, Mar 25, 2014 at 10:03:29PM +0000, Neil Greatorex wrote: > I then replaced it with mdelay(1000) out of interest, and it succeeded > in detecting the card at boot. It then proceeded exactly as described > by Willy in his later e-mail (it successfully registers an MSI-X > interrupt for one port, and then proceeds to implode). Seem to confirm not enough time after reset.. Try this (untested) debugging patch: Also, are you using the "reset-gpios" DT property? If so, ensure the delay is at least 100 ms. There is still an oddball problem: 00:01.0 PCI bridge: Marvell Technology Group Ltd. Device 6710 (rev 01) (prog-if 00 [Normal decode]) Bus: primary=00, secondary=01, subordinate=02, sec-latency=0 I think the subordinate bus should be 01 - not sure what is going on there... Maybe related to the rescan problem.. Jason diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index b8f2fc9..74e2e20 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c @@ -999,6 +999,34 @@ static int mvebu_pcie_probe(struct platform_device *pdev) mvebu_pcie_set_local_dev_nr(port, 1); + /* Wait for the link to come up */ + if (!mvebu_pcie_link_up(port)) { + unsigned int I; + + dev_info(&pdev->dev, "Waiting for link up\n"); + for (I = 0; I != 100; I++) { + udelay(100); + if (mvebu_pcie_link_up(port)) + break; + } + dev_info(&pdev->dev, "Link is %u\n", + mvebu_pcie_link_up(port)); + } + + /* Turn on CRS Software Visibility */ + mvebu_writel(port, mvebu_readl(port, PCIE_CTRL_OFF) | BIT(31), + PCIE_CTRL_OFF); + + /* Read the vendor ID from the connected device */ + mvebu_writel(port, PCIE_CONF_ADDR(1, 0, 0), PCIE_CONF_ADDR_OFF); + dev_info(&pdev->dev, "Vendor ID is %x\n", + mvebu_readl(port, PCIE_CONF_DATA_OFF)); + msleep(1000); + mvebu_writel(port, PCIE_CONF_ADDR(1, 0, 0), PCIE_CONF_ADDR_OFF); + dev_info(&pdev->dev, "Try 2: Vendor ID is %x\n", + mvebu_readl(port, PCIE_CONF_DATA_OFF)); + + port->dn = child; spin_lock_init(&port->conf_lock); mvebu_sw_pci_bridge_init(port);