From patchwork Mon Nov 5 18:11:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trent Piepho X-Patchwork-Id: 10668835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A961C18FD for ; Mon, 5 Nov 2018 18:12:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99BF129AE1 for ; Mon, 5 Nov 2018 18:12:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B06129AF0; Mon, 5 Nov 2018 18:12:09 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 6965A29AE9 for ; Mon, 5 Nov 2018 18:11:58 +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: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:In-Reply-To:References: List-Owner; bh=0MdMOcbf2HXj1vu2PQpZAm5dZOrmgQCNKxAvTJZfkN0=; b=WIpTbmOvFGEwlC MCtziLqZo6nQZdjMYCdWTO3CV3KD8ytupbEMBDIk8l+I2eujzwg8RTinoC/gcS5hv/VFQg25+DeLO 3bI6fWu7j45jK2+ZDuhwAJNx3ER4GZv8NA3DzYYhvrY99GAV+SyTyq39bII2ZiS46N1VnGSwDNNfy b8NeSj2TaViJEw4ktu8/hVSVc4UTHk/FZC2izDut4Q6tJE/6cezaooKXwqsKu2698UXAg4UGEt+6f v3tNiIOiyAIP62SWYYNEz9JnZJG0X7dIe/3D1fCu5Bs697IKu7NJsj33QkfvwwotMnG9hH/xvBCPs z0BNLGc522sNHavxbZfA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjLt-0006Tn-Vn; Mon, 05 Nov 2018 18:11:53 +0000 Received: from mail-eopbgr720116.outbound.protection.outlook.com ([40.107.72.116] helo=NAM05-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gJjLq-0006Sv-TL for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2018 18:11:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impinj.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mbf/yl2pvv0LzwX9BrBppMo9xpywyCz75bAesw5rLXc=; b=h2LVBufOeEvgAT4jqO8lLgWciifxTDEpk2yuSf3Nz7SyPyFbJYU9cSTkwyc+Y/dH/UYC0nLmaiplArRu5yslKsjq9EJB3mGZptf+sozWadD20jQU4Yc4h0i90Y55wNaUvafljT2YFodjn29Z+mHPIBcFZh6nxFvEVfSjDdfFbAA= Received: from MWHPR0601MB3708.namprd06.prod.outlook.com (10.167.236.38) by MWHPR0601MB3755.namprd06.prod.outlook.com (10.167.236.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.20; Mon, 5 Nov 2018 18:11:37 +0000 Received: from MWHPR0601MB3708.namprd06.prod.outlook.com ([fe80::f51a:d8dd:1aad:3bf9]) by MWHPR0601MB3708.namprd06.prod.outlook.com ([fe80::f51a:d8dd:1aad:3bf9%3]) with mapi id 15.20.1294.028; Mon, 5 Nov 2018 18:11:37 +0000 From: Trent Piepho To: "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v3] PCI: imx6: Check for link training status in link up check Thread-Topic: [PATCH v3] PCI: imx6: Check for link training status in link up check Thread-Index: AQHUdTL91W3lyQ/o7U6vC5FlfPYIwg== Date: Mon, 5 Nov 2018 18:11:36 +0000 Message-ID: <20181105181117.23230-1-tpiepho@impinj.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MWHPR01CA0041.prod.exchangelabs.com (2603:10b6:300:101::27) To MWHPR0601MB3708.namprd06.prod.outlook.com (2603:10b6:301:7c::38) authentication-results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [216.207.205.253] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; MWHPR0601MB3755; 6:82XSRBf4KPtZ9PcRpvZxKJmLzfg1XaqS3LMSWasLdktks4GxdeEiMuJjWQyOWbbLKnhM8MKrYVUFdZhbeJJEyIlksuIorf+al0zU0nnlMVR0WaB04cdHIDyyYITnXlhTfeowwjWji5ccK647IaBG5oPHimq8SSl0p6DQV6JX3BidsNAigmAQfjsdydebRQo2mwIQzsbZ8IBtx/ARfqwrze/ei/HLWUo227fnpeLcRJpBHTSfMB6f7kAlgyj6kHE39JHovn8c7M1lG/2nBKGhaTvwpgnucCWMRBYJmdSdyqJ6AI6slq+m/OdmCp3spidGHSJ6uwpCyAU1XHLYk2yULBTPgZ5bns88CViMGkAyVkb8lAba1k9a9CUMuTCzd2mSSs105UQTE5/J3q8ANLLuEZ55Zb59ygmu4F1tuC+mkJaLfRjWnINFbhBv2xJH/5lR5hCTCVCuDV36u1uVgjjXhA==; 5:mNE0Ky+fQ7bq5kOlwt21U09oNYW/0a+/psFP4hHVEVJ7hIm98awRkbsdpTTv1Cx4Zv27diqnHHGBugYz972JOLosV7YrgEeZHk0oldwIwNsp7XGhOCJ6PvXKeHTIWQS+zONMUFXYcmg6w9vtBAoVB6ml4AQ8lR9Ix7aHI6LAWhk=; 7:aWiWJj/pS688JBJ2ZW5toMpiixS7CorLlAStCTv+fStY6yCslrRQeuLOoczuF6Mj6IqG++iJSewsIjz7ItGxdOCldtT3t8K1sxxkMfgjqV6k/Yx3IgWpOoyjV1n/oJoi3HnO0+9LwyFKSw3Z2YqeEA== x-ms-office365-filtering-correlation-id: ab50c71e-c012-48f1-7cb9-08d6434a200e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:MWHPR0601MB3755; x-ms-traffictypediagnostic: MWHPR0601MB3755: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(211936372134217)(153496737603132)(180628864354917)(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:MWHPR0601MB3755; BCL:0; PCL:0; RULEID:; SRVR:MWHPR0601MB3755; x-forefront-prvs: 08476BC6EF x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(346002)(366004)(39840400004)(376002)(396003)(189003)(199004)(3846002)(86362001)(2906002)(6486002)(6116002)(6512007)(6436002)(97736004)(316002)(1076002)(36756003)(305945005)(52116002)(2616005)(386003)(6506007)(5660300001)(26005)(7736002)(102836004)(186003)(486006)(476003)(81156014)(81166006)(8936002)(8676002)(25786009)(71200400001)(54906003)(110136005)(256004)(2900100001)(2501003)(99286004)(71190400001)(106356001)(14454004)(4326008)(66066001)(478600001)(68736007)(53936002)(105586002); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR0601MB3755; H:MWHPR0601MB3708.namprd06.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: impinj.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: ThD8rO7Mzks/SGUPKKX8wIyxPVETBfXGbUCSV2K9krV+N9fNbCDPvmfM2itYk/SlXdcFYQ7ZyW6T57sy7FRhTubf4tDxwE3kxIm0TFKyTlDAfBOJ+zSAAbyCYDd4HoEodrr6I/IQxm98AUKZjJWcMJTwe539907FD3yWaEs9PSpHFH9o6cDPGtloMylqu6zLPXv7VJik5KXz3fT+kLRYfxZUHVY41nEScqKR5p1sR+a6VsDQEyGldG/whyKFmz5+nHWsoAJQ+/4K1Jba5PJEB9g4VRIJYTym16nn7YGuI16saT6uLsxZm2wf0pi2RllItb36xggSPShFX3ReYXMLT3rl42RDZjGa9807G6dAfXI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: impinj.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab50c71e-c012-48f1-7cb9-08d6434a200e X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Nov 2018 18:11:36.8728 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6de70f0f-7357-4529-a415-d8cbb7e93e5e X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0601MB3755 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181105_101151_003197_F6B0FEED X-CRM114-Status: GOOD ( 13.86 ) 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 , Lorenzo Pieralisi , Joao Pinto , Richard Zhu , 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 Eliminate imx6_pcie_link_up() so that the default handler, dw_pcie_link_up(), is used instead. The default handler has the correct code, which checks for link up and also not still training. This bug was fixed some time ago, but the fix was lost in the merge commit 562df5c8521e ("Merge branch 'pci/host-designware' into next"). This was due to the interaction for two commits on either branch of the merge. 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(). And the result was the link training check got lost for the imx6 driver. Fixes: 562df5c8521e ("Merge branch 'pci/host-designware' into next") Cc: Bjorn Helgaas Cc: Joao Pinto Cc: Lorenzo Pieralisi Cc: Richard Zhu Reviewed-by: Lucas Stach Signed-off-by: Trent Piepho --- drivers/pci/controller/dwc/pci-imx6.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 4a9a673b4777..975050a69494 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -80,8 +80,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 @@ -641,12 +639,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, }; @@ -679,7 +671,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)