From patchwork Tue Oct 17 00:11:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10010317 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 A85CA60235 for ; Tue, 17 Oct 2017 00:13:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9753128709 for ; Tue, 17 Oct 2017 00:13:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A7FB28715; Tue, 17 Oct 2017 00:13: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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0F5FC28709 for ; Tue, 17 Oct 2017 00:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Yx2jgJgErcQWxoIUyx0XCVbXvSZgsFpFlMCeWqIOp+I=; b=sHVjFxfOa650vQ Bxk0bV866sTEKHQfrY9wle+nzS+tURKcJYDnLfxdqKqDMpbDiC8SRpcp/99JcWcvavEu29D7BISPf V9pieA+uheBoOV0quMqRCWv1H8DygWrZF2AJCmTedNIlye0HiZWARmiCV5tNZLd5cTIuXA6Dz8Eou 1YtV1pZN6ipcUY0zTwHoeqg6vuiOGc9eN5CEs1YOStaGd8FYTuvlMkXroIrF6pRJLFUGS2pc4FdI6 GFMirSJ1lrjmS4+L9xYKxSbXnHvMiZexKVyIllz98Cm9vkd5/CG+KpWZv84ISSrkV7aTSDlpsHaOr dfFoP/vXWNW8vgXP/LJw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e4FVb-0004uv-J6; Tue, 17 Oct 2017 00:13:23 +0000 Received: from mail-by2nam01on0113.outbound.protection.outlook.com ([104.47.34.113] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e4FVB-0004a6-Kg for linux-arm-kernel@lists.infradead.org; Tue, 17 Oct 2017 00:12:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impinj.onmicrosoft.com; s=selector1-impinj-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JUE3ePFtvm04E279GcDwIWalxTxDIjGpcq0Gd9/cDnE=; b=PYQqlOueCBRR9naUsda1ddIi+u+L5akQbWFOaKOUAjwIIsPW/OkgtwsED3jgoYX3fN78TBYryfNMH4A5dcFBs5e7/5SitETkqeTnBw6yfhLMPCPzCG4euflk8UNk98itMyBbVQiLE4hnYDOAMTsbb2Xr/k0F7Baq+j7jRHab/g0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; Received: from impinj.com (216.243.31.162) by CY4PR06MB2806.namprd06.prod.outlook.com (10.175.117.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 17 Oct 2017 00:12:39 +0000 From: Trent Piepho To: linux-arm-kernel , linux-pci@vger.kernel.org Subject: [PATCH 2/2] PCI: imx6: Check for link training status in link up check Date: Mon, 16 Oct 2017 17:11:59 -0700 Message-Id: <20171017001159.109152-2-tpiepho@impinj.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171017001159.109152-1-tpiepho@impinj.com> References: <20171017001159.109152-1-tpiepho@impinj.com> MIME-Version: 1.0 X-Originating-IP: [216.243.31.162] X-ClientProxiedBy: CY4PR20CA0007.namprd20.prod.outlook.com (10.173.116.145) To CY4PR06MB2806.namprd06.prod.outlook.com (10.175.117.150) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c5606151-3e75-4248-8407-08d514f3c76d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:CY4PR06MB2806; X-Microsoft-Exchange-Diagnostics: 1; CY4PR06MB2806; 3:LKDMbpdKbPqlGArqPZlCDumtqB9KtcTLEMN3RF0vyCU3aS1hgn5KCcGLk6G/BYtbzBhpzDOBaIs5fdIJPf2PKNBVK8tLQZ40d80GIMNrBjx1ot1kWnP65+CUsjnAzxQOH8ksfvBrxdiy2VUKO4Y1Q7b+athB6FvC3ggFLQPscmTPNQagJ2FblS2kVUbPjgUnrnsOpFizmTy4JKvhDla1BcE06mbAf3C2Z/iOvKrcV+zB/1AT2c84AOCCC+8vYxOQ; 25:0TaVUTvohwBxPPMAPjR4mjBF/Megxy2q2Jg0X8HWjw0DWGqlGnGrvOdZmZOAXlGUan+lhMbVAtckwYjg915fq7rBmDklDOmE21ydsyjlWaLOj7x+rF7TOPhZ2BWxYrBLVWzKuopQ2Ya5jU8PxX2YtX37ACo7b3Pf7wYyZkrs9V4/J351vTfjaFQC5jme1cDWtceBud3rADa1MISxkjLBYMyg4gz6ulZfwKc9eBjZHy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xZhnOOpcVG6mr9LnrhIvaUaa28NvfScesqJt/Z+71rGKBfb2Dx7bRTwDkmzvzrNM723lQUUIPWQqJVm9XZNQksVWVKY+zf6kRM/pUYzMjKuf4CSdC8a1H7grwnsHxxQVynK5Jb6iY6qpkV7dzIJX8h6O5NeYfNxutoUY9jeqRrPx57ZuIgXz20g6wPd7iicPTwlHleNhrEITvjoQ6tIxCFA35uzbaA96tFy4ezGkbIxy7p X-Exchange-Antispam-Report-Test: UriScan:(211936372134217)(153496737603132)(17755550239193); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(920507026)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR06MB2806; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR06MB2806; X-Forefront-PRVS: 04631F8F77 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(376002)(346002)(189002)(199003)(2906002)(69596002)(6666003)(105586002)(68736007)(5660300001)(5003940100001)(55016002)(81166006)(316002)(34040400001)(54906003)(3846002)(6116002)(53936002)(8936002)(16526018)(1076002)(16586007)(4326008)(81156014)(36756003)(25786009)(97736004)(7736002)(86362001)(575784001)(8676002)(50226002)(66066001)(305945005)(189998001)(21086003)(2950100002)(478600001)(50466002)(106356001)(48376002)(33646002)(101416001)(50986999)(47776003)(76176999); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR06MB2806; H:impinj.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: impinj.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR06MB2806; 23:Oh6qnWEoSjEaaFbCsXoVYcVKBrZIP6AB8Q945LOB8?= =?us-ascii?Q?fDFflzjgbZnOEsjJsdlM/0MhdebWuMQ+L3xS4CpeaQ9hWK3qn5gYUpD88N9d?= =?us-ascii?Q?cvXF75qGMYK2tCDBet5AYkNMluJzr6S/F/aOg9xXkwKRw+9+94IOxN0Qy6oG?= =?us-ascii?Q?XfmOVKG4sDgrsNfxl1nP6WgyuWxYmkN5zmByiE24/vfJWiXFUtEdI42QVWq4?= =?us-ascii?Q?4tzeWWhmXoEuuuVZLiad4ox66HrpIji4s46lzNaITGlW5cBVGDeAdk8r1Mta?= =?us-ascii?Q?wGwiJ1QJdjQJcUUcKM8M4pDRME9QHp9NHF5eiDAWP3jmh+osEpu/Cm933QBH?= =?us-ascii?Q?UKLDb9iHgpZdepXslpd3L7lec3PBmSUUM660dA1qGKHHpzW+1R1yvpXUabZ1?= =?us-ascii?Q?1yeq8k2lsV6UkxTnhezyZh7A4f96mdJqSs2Phudla3wdL3l0ttC7U4iRc9a4?= =?us-ascii?Q?fngqbKECRCeN9u/kOD6KlHPFJ/omvyMmPDvAU6FfYdGUGaGQgVl5Lv64m+tg?= =?us-ascii?Q?hYx/q/nsFmVac/seiSve7mLf3zTZ6NxeM23pAdp9i+6eb2QeVEjQnp94udGy?= =?us-ascii?Q?qOo7ttkhLAwZqMgqNVqROOLUDa9ADG+7vucVyZy2utcPiPb7yjxDSQzj9p3W?= =?us-ascii?Q?DahFDutWQyDX9ubBvBGHYsMfLxzO6JX6ORLIUy9aGCRqu61XdfcM2W+k4gpF?= =?us-ascii?Q?cRQZUmYFXuQaQK22z2cb1X4t+qcFj6UlDB1T2byyC6+ihx9TvJ6QiebA9Cpj?= =?us-ascii?Q?Zx3EN+zs8s4o4xDb5ZGr6skm5s2rSqn+ikizyeBdiLd/W4K/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bsMAVg=; 7:d9JG4Ah4lOYnJp1Q6+RWaUDkk8yrheSeQ3oUNVRK2e9vnUqOAvnrn0Oy84+SWjSpkRjaE9/pho1mZjgXnmjOSu6sccwD1GE98xi97IAW9EOaYhvhhWsmNtcCKEdzZ3+gE9FwKmGaFm37vqlrruiG0extOBil3mv7PJtrpWttmKFSjAIuSlEmIwZH3NGZ83TTtJpvHSkzMeJ+h+rU/zZvSrwD949hXJt2XSD1IWozGbU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2017 00:12:39.5744 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR06MB2806 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171016_171257_752868_C18ECC63 X-CRM114-Status: GOOD ( 14.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bjorn Helgaas , Joao Pinto , Lucas Stach , Trent Piepho Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This fixes a regression introduced in merge 562df5c8521e. Prior to this the link up check done by imx6_pcie_wait_for_link() consisted of a polling loop on imx6_pcie_link_up() (via the former calling dw_pcie_link_up() which called the latter as callback), and imx6_pcie_link_up() polled the link status register checking for link up *and link not still training*. This was a polling loop inside another polling loop. And the outermost loop was duplicated with minor variations in a number of other dwc based host drivers. This was addressed in two commits. Commit 4d107d3b5a68 ("PCI: imx6: Move link up check into imx6_pcie_wait_for_link()"), changed imx6_pcie_wait_for_link() to poll the link status register directly, checking for link up and not training, and made imx6_pcie_link_up() only check the link up bit (once, not a polling loop). While commit commit 886bc5ceb5cc ("PCI: designware: Add generic dw_pcie_wait_for_link()"), replaced the loop in imx6_pcie_wait_for_link() with a call to a new dwc core function, which polled imx6_pcie_link_up(), which still checked both link up and not training in a loop. When these two commits were merged, the version of imx6_pcie_wait_for_link() from '886 was kept, which eliminated the link training check placed there by '4d1. But the version of imx6_pcie_link_up() from '4d1 was kept, which eliminated the link training check that had been there and was moved to imx6_pcie_wait_for_link(). There result is no link training check. Then commit dac29e6c5460 ("PCI: designware: Add default link up check if sub-driver doesn't override") added a link training check to the default version of dw_pcie_link_up(), but since imx6 uses imx6_pcie_link_up() it does not use the default version with this fix. This commit eliminates imx6_pcie_link_up() so that the default dw_pcie_link_up() is used. The default has the correct code and is what the imx6 driver used to do. Fixes: 562df5c8521e1371f3cbd0b7b868034da376d714 Cc: Bjorn Helgaas Cc: Joao Pinto Cc: Lucas Stach Signed-off-by: Trent Piepho Reviewed-by: Lucas Stach --- drivers/pci/dwc/pci-imx6.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/pci/dwc/pci-imx6.c b/drivers/pci/dwc/pci-imx6.c index b73483534a5b..1f1069b70e45 100644 --- a/drivers/pci/dwc/pci-imx6.c +++ b/drivers/pci/dwc/pci-imx6.c @@ -83,8 +83,6 @@ struct imx6_pcie { #define PCIE_PL_PFLR_FORCE_LINK (1 << 15) #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) -#define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) -#define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP (1 << 4) #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) #define PCIE_PHY_CTRL_DATA_LOC 0 @@ -653,12 +651,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp) return 0; } -static int imx6_pcie_link_up(struct dw_pcie *pci) -{ - return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) & - PCIE_PHY_DEBUG_R1_XMLH_LINK_UP; -} - static const struct dw_pcie_host_ops imx6_pcie_host_ops = { .host_init = imx6_pcie_host_init, }; @@ -701,7 +693,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie, } static const struct dw_pcie_ops dw_pcie_ops = { - .link_up = imx6_pcie_link_up, + /* No special ops needed, but pcie-designware still expects this struct */ }; static int imx6_pcie_probe(struct platform_device *pdev)